From 2a4d3d7a4aa157e043edf00f16abe2ba5f57a882 Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Sun, 16 Feb 2025 15:59:17 -0500 Subject: [PATCH] [decompiler] More inline vector functions (#3861) This adds more recognition for inlined vector functions to the decompiler, which can clean up a bunch of ugly looking code/`rlet`s. ![image](https://github.com/user-attachments/assets/1f7b4627-81bd-481b-b828-76b9f7ba13b3) Unfortunately, this changes the numbering of ops in the decomp, since all the vector instructions get combined in a single "operation" by the decompiler. I really tried to avoid having this ever happen in the decompiler and this is one of the few cases where it has. So I had to update a bunch of type casts. For that reason I haven't turned this on in Jak 2 yet, although I am planning to do that at some point. (probably at the same time as porting back a bunch of jak 3 improvements to jak 2) --------- Co-authored-by: water111 --- decompiler/IR2/AtomicOp.cpp | 6 + decompiler/IR2/AtomicOp.h | 2 + decompiler/IR2/AtomicOpTypeAnalysis.cpp | 1 + decompiler/IR2/Form.cpp | 4 + decompiler/IR2/Form.h | 1 + decompiler/IR2/FormExpressionAnalysis.cpp | 17 +- decompiler/IR2/IR2_common.h | 2 + decompiler/analysis/atomic_op_builder.cpp | 153 +- decompiler/config/jak3/all-types.gc | 43 +- decompiler/config/jak3/ntsc_v1/hacks.jsonc | 2 +- .../jak3/ntsc_v1/stack_structures.jsonc | 1 - .../config/jak3/ntsc_v1/type_casts.jsonc | 181 +- decompiler/types2/ForwardProp.cpp | 2 + goal_src/jak3/engine/ambient/ambient-h.gc | 2 +- goal_src/jak3/engine/ambient/ambient.gc | 6 +- goal_src/jak3/engine/anim/aligner-h.gc | 19 +- goal_src/jak3/engine/anim/aligner.gc | 10 +- goal_src/jak3/engine/anim/joint-exploder.gc | 93 +- goal_src/jak3/engine/anim/joint-mod.gc | 28 +- goal_src/jak3/engine/camera/cam-master.gc | 29 +- goal_src/jak3/engine/camera/cam-states-dbg.gc | 137 +- goal_src/jak3/engine/collide/collide-cache.gc | 195 +- .../jak3/engine/collide/collide-edge-grab.gc | 26 +- goal_src/jak3/engine/collide/collide-shape.gc | 26 +- goal_src/jak3/engine/common-obs/debris.gc | 207 +- .../engine/common-obs/guard-projectile.gc | 76 +- .../engine/common-obs/metalhead-projectile.gc | 74 +- goal_src/jak3/engine/common-obs/voicebox.gc | 68 +- goal_src/jak3/engine/common-obs/water-flow.gc | 306 +-- goal_src/jak3/engine/debug/debug.gc | 71 +- goal_src/jak3/engine/debug/manipulator.gc | 718 +++--- goal_src/jak3/engine/debug/viewer.gc | 2 +- goal_src/jak3/engine/math/quaternion.gc | 10 +- goal_src/jak3/engine/math/vector.gc | 36 +- goal_src/jak3/engine/nav/nav-control.gc | 435 ++-- goal_src/jak3/engine/nav/nav-enemy.gc | 379 ++-- goal_src/jak3/engine/nav/nav-mesh.gc | 88 +- goal_src/jak3/engine/physics/chain-physics.gc | 25 +- goal_src/jak3/engine/physics/cloth.gc | 95 +- goal_src/jak3/engine/physics/ragdoll.gc | 457 ++-- goal_src/jak3/engine/physics/rigid-body.gc | 153 +- goal_src/jak3/engine/physics/trajectory.gc | 57 +- .../jak3/engine/spatial-hash/collide-hash.gc | 11 +- .../jak3/engine/target/board/board-states.gc | 6 +- .../jak3/engine/target/board/target-board.gc | 80 +- .../jak3/engine/target/flut/flut-racer.gc | 98 +- .../jak3/engine/target/flut/target-flut.gc | 352 +-- .../jak3/engine/target/gun/gun-blue-shot.gc | 13 +- .../jak3/engine/target/gun/gun-dark-shot.gc | 2 +- .../jak3/engine/target/gun/gun-red-shot.gc | 476 ++-- .../jak3/engine/target/gun/gun-yellow-shot.gc | 136 +- .../engine/target/indax/target-indax-hang.gc | 19 +- .../jak3/engine/target/indax/target-indax.gc | 8 +- goal_src/jak3/engine/target/logic-target.gc | 380 ++-- goal_src/jak3/engine/target/mech/mech-part.gc | 97 +- .../jak3/engine/target/mech/mech-states.gc | 2 +- .../jak3/engine/target/mech/target-mech.gc | 328 +-- goal_src/jak3/engine/target/pilot-states.gc | 17 +- goal_src/jak3/engine/target/target-anim.gc | 6 +- goal_src/jak3/engine/target/target-darkjak.gc | 10 +- goal_src/jak3/engine/target/target-death.gc | 261 +-- goal_src/jak3/engine/target/target-ladder.gc | 4 +- .../jak3/engine/target/target-lightjak.gc | 97 +- goal_src/jak3/engine/target/target-part.gc | 40 +- goal_src/jak3/engine/target/target-swim.gc | 12 +- goal_src/jak3/engine/target/target-tube.gc | 2 +- .../jak3/engine/target/target-turret-shot.gc | 76 +- goal_src/jak3/engine/target/target-turret.gc | 56 +- goal_src/jak3/engine/target/target-util.gc | 89 +- goal_src/jak3/engine/target/target.gc | 18 +- goal_src/jak3/engine/target/target2.gc | 8 +- .../levels/city/blow-tower/blow-tower-obs2.gc | 119 +- .../levels/city/blow-tower/cty-blow-tower.gc | 4 +- goal_src/jak3/levels/city/bombbot/bombbot.gc | 1989 ++++++----------- .../jak3/levels/city/common/guard-states.gc | 184 +- .../jak3/levels/city/common/guard-tazer.gc | 474 ++-- goal_src/jak3/levels/city/ctywide-obs.gc | 746 +++---- .../city/destroy-grid/cty-destroy-grid.gc | 398 ++-- .../levels/city/hijack/cty-hijack-missile.gc | 2 +- .../jak3/levels/city/hijack/kg-vehicles.gc | 2 +- .../levels/city/protect/assault-enemies.gc | 185 +- .../levels/city/protect/protect-gunship.gc | 74 +- .../levels/city/sniper/cty-sniper-turret.gc | 72 +- .../levels/city/traffic/citizen/citizen.gc | 349 ++- .../levels/city/traffic/citizen/civilian.gc | 70 +- .../jak3/levels/city/traffic/citizen/guard.gc | 439 ++-- .../city/traffic/citizen/metalhead-grunt.gc | 65 +- .../traffic/citizen/metalhead-predator.gc | 44 +- .../levels/city/traffic/traffic-engine.gc | 276 ++- .../city/traffic/vehicle/vehicle-control.gc | 174 +- .../city/traffic/vehicle/vehicle-effects.gc | 149 +- .../city/traffic/vehicle/vehicle-states.gc | 137 +- .../city/traffic/vehicle/vehicle-util.gc | 53 +- .../levels/city/traffic/vehicle/vehicle.gc | 231 +- goal_src/jak3/levels/comb/comb-field.gc | 215 +- goal_src/jak3/levels/comb/comb-sentry.gc | 284 +-- goal_src/jak3/levels/comb/h-sled.gc | 633 +++--- .../jak3/levels/common/ai/ashelin/ash-shot.gc | 70 +- goal_src/jak3/levels/common/ai/ashelin/ash.gc | 86 +- goal_src/jak3/levels/common/ai/bot.gc | 126 +- goal_src/jak3/levels/common/enemy/grunt.gc | 65 +- goal_src/jak3/levels/common/enemy/kg-grunt.gc | 65 +- goal_src/jak3/levels/common/enemy/mantis.gc | 221 +- .../jak3/levels/common/enemy/roboguard.gc | 95 +- goal_src/jak3/levels/common/enemy/spyder.gc | 181 +- .../levels/common/hvehicle/squad-control.gc | 16 +- .../levels/common/hvehicle/turret-control.gc | 63 +- .../jak3/levels/common/race/race-manager.gc | 482 ++-- goal_src/jak3/levels/common/race/race-mesh.gc | 71 +- .../levels/desert/boss/terraformer-setup.gc | 1023 ++++----- goal_src/jak3/levels/desert/chase/marauder.gc | 400 ++-- .../jak3/levels/desert/des-burning-bush.gc | 235 +- goal_src/jak3/levels/desert/des-cactus.gc | 121 +- .../jak3/levels/desert/hover/des-beast-2.gc | 99 +- .../jak3/levels/desert/hover/des-beast.gc | 62 +- goal_src/jak3/levels/desert/hover/mh-flyer.gc | 9 +- .../levels/desert/rescue/desert-rescue.gc | 2 +- .../jak3/levels/desert/rescue/rope-system.gc | 6 +- .../levels/desert/rescue/wland-passenger.gc | 70 +- .../desert/wvehicle/was-squad-control.gc | 183 +- .../desert/wvehicle/wcar-projectiles.gc | 70 +- .../levels/desert/wvehicle/wcar-turtle.gc | 187 +- .../levels/desert/wvehicle/wvehicle-ai.gc | 373 ++-- .../desert/wvehicle/wvehicle-physics.gc | 241 +- .../levels/desert/wvehicle/wvehicle-race.gc | 525 ++--- .../levels/desert/wvehicle/wvehicle-util.gc | 53 +- .../jak3/levels/desert/wvehicle/wvehicle.gc | 148 +- .../levels/factory/car/hvehicle-physics.gc | 538 +++-- .../jak3/levels/factory/car/hvehicle-util.gc | 436 ++-- goal_src/jak3/levels/factory/car/hvehicle.gc | 226 +- goal_src/jak3/levels/factory/fac-gunturret.gc | 85 +- goal_src/jak3/levels/factory/fac-robotank.gc | 105 +- goal_src/jak3/levels/factory/fac-tower.gc | 77 +- .../jak3/levels/factory/factory-manager.gc | 579 ++--- .../jak3/levels/factory/ffight-projectile.gc | 72 +- .../jak3/levels/factory/ftank-projectile.gc | 72 +- .../jak3/levels/factory/fturret-projectile.gc | 76 +- goal_src/jak3/levels/factory/h-warf.gc | 553 ++--- goal_src/jak3/levels/factory/missile-bot.gc | 111 +- .../jak3/levels/factory/warf-projectile.gc | 140 +- .../jak3/levels/forest/for-turret-shot.gc | 74 +- .../jak3/levels/forest/forest-ring-chase.gc | 2 +- goal_src/jak3/levels/glider/glider-manager.gc | 434 ++-- goal_src/jak3/levels/glider/glider-ring.gc | 436 ++-- goal_src/jak3/levels/glider/h-glider.gc | 1193 +++++----- goal_src/jak3/levels/gungame/gun-dummy.gc | 25 +- .../jak3/levels/gungame/gungame-manager.gc | 52 +- .../jak3/levels/mhcity/destroy-dark-eco.gc | 179 +- goal_src/jak3/levels/mine/gekko.gc | 27 +- goal_src/jak3/levels/mine/prebot-states.gc | 44 +- goal_src/jak3/levels/mine/rat.gc | 4 +- goal_src/jak3/levels/nest/egg-spider.gc | 403 ++-- goal_src/jak3/levels/nest/mh-bat.gc | 9 +- goal_src/jak3/levels/nest/mh-centipede.gc | 552 ++--- goal_src/jak3/levels/nest/nst-part.gc | 20 +- goal_src/jak3/levels/precursor/precura-obs.gc | 105 +- goal_src/jak3/levels/precursor/precurc-obs.gc | 137 +- goal_src/jak3/levels/sewer/kg-hopper.gc | 123 +- .../jak3/levels/sewer/saberfish-spawner.gc | 58 +- goal_src/jak3/levels/sewer/saberfish.gc | 63 +- .../jak3/levels/sewer/sewer-move-turret.gc | 36 +- .../jak3/levels/stadium/dm-mine-spider.gc | 101 +- goal_src/jak3/levels/stadium/king-rider.gc | 77 +- goal_src/jak3/levels/stadium/rubble-obs.gc | 73 +- goal_src/jak3/levels/temple/temple-obs.gc | 400 ++-- goal_src/jak3/levels/title/title-obs.gc | 210 +- goal_src/jak3/levels/wascity/ctymark-obs.gc | 89 +- goal_src/jak3/levels/wascity/traffic-util.gc | 177 +- .../jak3/levels/wascity/wascity-turret.gc | 388 +--- .../jak3/levels/wascity/wasdef-manager.gc | 246 +- .../jak3/levels/wascity/wasgun-manager.gc | 434 ++-- .../levels/wascity/wasstadium/sig-rider.gc | 143 +- .../wascity/wasstadium/wasstada-part.gc | 10 +- .../levels/wascity/wasstadium/wasstadc-obs.gc | 240 +- goal_src/jak3/levels/wascity/waswide-part.gc | 26 +- goal_src/jak3/levels/wascity/wlander-male.gc | 63 +- goal_src/jak3/pc/debug/anim-tester-x.gc | 2 +- .../jak3/engine/ambient/ambient-h_REF.gc | 2 +- .../jak3/engine/ambient/ambient_REF.gc | 6 +- .../jak3/engine/anim/aligner-h_REF.gc | 19 +- .../reference/jak3/engine/anim/aligner_REF.gc | 10 +- .../jak3/engine/anim/joint-exploder_REF.gc | 93 +- .../jak3/engine/anim/joint-mod_REF.gc | 28 +- .../jak3/engine/camera/cam-master_REF.gc | 29 +- .../jak3/engine/camera/cam-states-dbg_REF.gc | 137 +- .../jak3/engine/collide/collide-cache_REF.gc | 491 +--- .../engine/collide/collide-edge-grab_REF.gc | 26 +- .../jak3/engine/collide/collide-shape_REF.gc | 27 +- .../jak3/engine/common-obs/debris_REF.gc | 207 +- .../engine/common-obs/guard-projectile_REF.gc | 76 +- .../common-obs/metalhead-projectile_REF.gc | 74 +- .../jak3/engine/common-obs/voicebox_REF.gc | 68 +- .../jak3/engine/common-obs/water-flow_REF.gc | 306 +-- .../reference/jak3/engine/debug/debug_REF.gc | 71 +- .../jak3/engine/debug/manipulator_REF.gc | 718 +++--- .../reference/jak3/engine/debug/viewer_REF.gc | 2 +- .../jak3/engine/math/quaternion_REF.gc | 10 +- .../reference/jak3/engine/math/vector_REF.gc | 79 +- .../jak3/engine/nav/nav-control_REF.gc | 435 ++-- .../jak3/engine/nav/nav-enemy_REF.gc | 379 ++-- .../reference/jak3/engine/nav/nav-mesh_REF.gc | 88 +- .../jak3/engine/physics/chain-physics_REF.gc | 25 +- .../jak3/engine/physics/cloth_REF.gc | 95 +- .../jak3/engine/physics/ragdoll_REF.gc | 457 ++-- .../jak3/engine/physics/rigid-body_REF.gc | 153 +- .../jak3/engine/physics/trajectory_REF.gc | 57 +- .../engine/spatial-hash/collide-hash_REF.gc | 12 +- .../engine/target/board/board-states_REF.gc | 6 +- .../engine/target/board/target-board_REF.gc | 80 +- .../jak3/engine/target/flut/flut-racer_REF.gc | 98 +- .../engine/target/flut/target-flut_REF.gc | 352 +-- .../engine/target/gun/gun-blue-shot_REF.gc | 13 +- .../engine/target/gun/gun-dark-shot_REF.gc | 2 +- .../engine/target/gun/gun-red-shot_REF.gc | 472 ++-- .../engine/target/gun/gun-yellow-shot_REF.gc | 136 +- .../target/indax/target-indax-hang_REF.gc | 8 +- .../engine/target/indax/target-indax_REF.gc | 8 +- .../jak3/engine/target/logic-target_REF.gc | 380 ++-- .../jak3/engine/target/mech/mech-part_REF.gc | 97 +- .../engine/target/mech/mech-states_REF.gc | 2 +- .../engine/target/mech/target-mech_REF.gc | 328 +-- .../jak3/engine/target/pilot-states_REF.gc | 17 +- .../jak3/engine/target/target-anim_REF.gc | 6 +- .../jak3/engine/target/target-darkjak_REF.gc | 10 +- .../jak3/engine/target/target-death_REF.gc | 261 +-- .../jak3/engine/target/target-ladder_REF.gc | 4 +- .../jak3/engine/target/target-lightjak_REF.gc | 96 +- .../jak3/engine/target/target-part_REF.gc | 40 +- .../jak3/engine/target/target-swim_REF.gc | 12 +- .../jak3/engine/target/target-tube_REF.gc | 2 +- .../engine/target/target-turret-shot_REF.gc | 76 +- .../jak3/engine/target/target-turret_REF.gc | 56 +- .../jak3/engine/target/target-util_REF.gc | 89 +- .../jak3/engine/target/target2_REF.gc | 8 +- .../jak3/engine/target/target_REF.gc | 16 +- .../city/blow-tower/blow-tower-obs2_REF.gc | 119 +- .../city/blow-tower/cty-blow-tower_REF.gc | 4 +- .../jak3/levels/city/bombbot/bombbot_REF.gc | 1987 ++++++---------- .../levels/city/common/guard-states_REF.gc | 184 +- .../levels/city/common/guard-tazer_REF.gc | 474 ++-- .../jak3/levels/city/ctyport-obs_REF.gc | 170 +- .../jak3/levels/city/ctywide-obs_REF.gc | 746 +++---- .../city/destroy-grid/cty-destroy-grid_REF.gc | 398 ++-- .../city/hijack/cty-hijack-missile_REF.gc | 2 +- .../levels/city/hijack/kg-vehicles_REF.gc | 2 +- .../city/protect/assault-enemies_REF.gc | 185 +- .../city/protect/protect-gunship_REF.gc | 74 +- .../city/sniper/cty-sniper-turret_REF.gc | 72 +- .../city/traffic/citizen/citizen_REF.gc | 349 ++- .../city/traffic/citizen/civilian_REF.gc | 70 +- .../levels/city/traffic/citizen/guard_REF.gc | 447 ++-- .../traffic/citizen/metalhead-grunt_REF.gc | 65 +- .../traffic/citizen/metalhead-predator_REF.gc | 44 +- .../levels/city/traffic/traffic-engine_REF.gc | 276 ++- .../traffic/vehicle/vehicle-control_REF.gc | 174 +- .../traffic/vehicle/vehicle-effects_REF.gc | 149 +- .../traffic/vehicle/vehicle-states_REF.gc | 137 +- .../city/traffic/vehicle/vehicle-util_REF.gc | 53 +- .../city/traffic/vehicle/vehicle_REF.gc | 231 +- .../jak3/levels/comb/comb-field_REF.gc | 215 +- .../jak3/levels/comb/comb-sentry_REF.gc | 284 +-- .../reference/jak3/levels/comb/h-sled_REF.gc | 633 +++--- .../levels/common/ai/ashelin/ash-shot_REF.gc | 70 +- .../jak3/levels/common/ai/ashelin/ash_REF.gc | 86 +- .../jak3/levels/common/ai/bot_REF.gc | 126 +- .../jak3/levels/common/enemy/grunt_REF.gc | 65 +- .../jak3/levels/common/enemy/kg-grunt_REF.gc | 65 +- .../jak3/levels/common/enemy/mantis_REF.gc | 221 +- .../jak3/levels/common/enemy/roboguard_REF.gc | 95 +- .../jak3/levels/common/enemy/spyder_REF.gc | 181 +- .../common/hvehicle/squad-control_REF.gc | 16 +- .../common/hvehicle/turret-control_REF.gc | 63 +- .../levels/common/race/race-manager_REF.gc | 482 ++-- .../jak3/levels/common/race/race-mesh_REF.gc | 71 +- .../desert/boss/terraformer-setup_REF.gc | 1023 ++++----- .../jak3/levels/desert/chase/marauder_REF.gc | 397 ++-- .../levels/desert/des-burning-bush_REF.gc | 235 +- .../jak3/levels/desert/des-cactus_REF.gc | 121 +- .../levels/desert/hover/des-beast-2_REF.gc | 99 +- .../jak3/levels/desert/hover/des-beast_REF.gc | 62 +- .../jak3/levels/desert/hover/mh-flyer_REF.gc | 9 +- .../levels/desert/rescue/desert-rescue_REF.gc | 2 +- .../levels/desert/rescue/rope-system_REF.gc | 6 +- .../desert/rescue/wland-passenger_REF.gc | 70 +- .../desert/wvehicle/was-squad-control_REF.gc | 183 +- .../desert/wvehicle/wcar-projectiles_REF.gc | 70 +- .../levels/desert/wvehicle/wcar-turtle_REF.gc | 187 +- .../levels/desert/wvehicle/wvehicle-ai_REF.gc | 373 ++-- .../desert/wvehicle/wvehicle-physics_REF.gc | 241 +- .../desert/wvehicle/wvehicle-race_REF.gc | 525 ++--- .../desert/wvehicle/wvehicle-util_REF.gc | 53 +- .../levels/desert/wvehicle/wvehicle_REF.gc | 148 +- .../factory/car/hvehicle-physics_REF.gc | 538 +++-- .../levels/factory/car/hvehicle-util_REF.gc | 436 ++-- .../jak3/levels/factory/car/hvehicle_REF.gc | 226 +- .../jak3/levels/factory/fac-gunturret_REF.gc | 85 +- .../jak3/levels/factory/fac-robotank_REF.gc | 105 +- .../jak3/levels/factory/fac-tower_REF.gc | 77 +- .../levels/factory/factory-manager_REF.gc | 579 ++--- .../levels/factory/ffight-projectile_REF.gc | 72 +- .../levels/factory/ftank-projectile_REF.gc | 72 +- .../levels/factory/fturret-projectile_REF.gc | 76 +- .../jak3/levels/factory/h-warf_REF.gc | 553 ++--- .../jak3/levels/factory/missile-bot_REF.gc | 111 +- .../levels/factory/warf-projectile_REF.gc | 140 +- .../jak3/levels/forest/for-turret-shot_REF.gc | 74 +- .../levels/forest/forest-ring-chase_REF.gc | 2 +- .../jak3/levels/glider/glider-manager_REF.gc | 434 ++-- .../jak3/levels/glider/glider-ring_REF.gc | 436 ++-- .../jak3/levels/glider/h-glider_REF.gc | 1193 +++++----- .../jak3/levels/gungame/gun-dummy_REF.gc | 25 +- .../levels/gungame/gungame-manager_REF.gc | 52 +- .../levels/mhcity/destroy-dark-eco_REF.gc | 179 +- .../reference/jak3/levels/mine/gekko_REF.gc | 27 +- .../jak3/levels/mine/prebot-states_REF.gc | 44 +- .../reference/jak3/levels/mine/rat_REF.gc | 4 +- .../jak3/levels/nest/egg-spider_REF.gc | 403 ++-- .../reference/jak3/levels/nest/mh-bat_REF.gc | 9 +- .../jak3/levels/nest/mh-centipede_REF.gc | 552 ++--- .../jak3/levels/nest/nst-part_REF.gc | 20 +- .../jak3/levels/precursor/precura-obs_REF.gc | 105 +- .../jak3/levels/precursor/precurc-obs_REF.gc | 137 +- .../jak3/levels/sewer/kg-hopper_REF.gc | 123 +- .../levels/sewer/saberfish-spawner_REF.gc | 58 +- .../jak3/levels/sewer/saberfish_REF.gc | 63 +- .../levels/sewer/sewer-move-turret_REF.gc | 36 +- .../jak3/levels/stadium/dm-mine-spider_REF.gc | 101 +- .../jak3/levels/stadium/king-rider_REF.gc | 77 +- .../jak3/levels/stadium/rubble-obs_REF.gc | 73 +- .../jak3/levels/temple/temple-obs_REF.gc | 400 ++-- .../jak3/levels/title/title-obs_REF.gc | 210 +- .../jak3/levels/wascity/ctymark-obs_REF.gc | 89 +- .../jak3/levels/wascity/traffic-util_REF.gc | 177 +- .../jak3/levels/wascity/wascity-turret_REF.gc | 388 +--- .../jak3/levels/wascity/wasdef-manager_REF.gc | 246 +- .../jak3/levels/wascity/wasgun-manager_REF.gc | 434 ++-- .../wascity/wasstadium/sig-rider_REF.gc | 143 +- .../wascity/wasstadium/wasstada-part_REF.gc | 10 +- .../wascity/wasstadium/wasstadc-obs_REF.gc | 240 +- .../jak3/levels/wascity/wlander-male_REF.gc | 139 +- 340 files changed, 22771 insertions(+), 36134 deletions(-) diff --git a/decompiler/IR2/AtomicOp.cpp b/decompiler/IR2/AtomicOp.cpp index 43674b72bb..7801ffc164 100644 --- a/decompiler/IR2/AtomicOp.cpp +++ b/decompiler/IR2/AtomicOp.cpp @@ -369,8 +369,12 @@ std::string get_simple_expression_op_name(SimpleExpression::Kind kind) { return "vec4dot"; case SimpleExpression::Kind::VECTOR_LENGTH: return "veclength"; + case SimpleExpression::Kind::VECTOR_LENGTH_SQUARED: + return "veclength-squared"; case SimpleExpression::Kind::VECTOR_PLUS_FLOAT_TIMES: return "vecplusfloattimes"; + case SimpleExpression::Kind::VECTOR_PLUS_TIMES: + return "vecplustimes"; case SimpleExpression::Kind::SET_ON_LESS_THAN: case SimpleExpression::Kind::SET_ON_LESS_THAN_IMM: return "set-on-less-than"; @@ -440,8 +444,10 @@ int get_simple_expression_arg_count(SimpleExpression::Kind kind) { case SimpleExpression::Kind::SET_ON_LESS_THAN_IMM: return 2; case SimpleExpression::Kind::VECTOR_LENGTH: + case SimpleExpression::Kind::VECTOR_LENGTH_SQUARED: return 1; case SimpleExpression::Kind::VECTOR_PLUS_FLOAT_TIMES: + case SimpleExpression::Kind::VECTOR_PLUS_TIMES: return 4; default: ASSERT(false); diff --git a/decompiler/IR2/AtomicOp.h b/decompiler/IR2/AtomicOp.h index 5d610d115b..61c6231f40 100644 --- a/decompiler/IR2/AtomicOp.h +++ b/decompiler/IR2/AtomicOp.h @@ -262,7 +262,9 @@ class SimpleExpression { VECTOR_3_DOT, VECTOR_4_DOT, VECTOR_LENGTH, // jak 2 only. + VECTOR_LENGTH_SQUARED, // jak 2 only. VECTOR_PLUS_FLOAT_TIMES, // jak 2 only. + VECTOR_PLUS_TIMES, SET_ON_LESS_THAN, SET_ON_LESS_THAN_IMM }; diff --git a/decompiler/IR2/AtomicOpTypeAnalysis.cpp b/decompiler/IR2/AtomicOpTypeAnalysis.cpp index 927a91fd22..b13f50d6e7 100644 --- a/decompiler/IR2/AtomicOpTypeAnalysis.cpp +++ b/decompiler/IR2/AtomicOpTypeAnalysis.cpp @@ -247,6 +247,7 @@ TP_Type SimpleExpression::get_type(const TypeState& input, case Kind::VECTOR_3_DOT: case Kind::VECTOR_4_DOT: case Kind::VECTOR_LENGTH: + case Kind::VECTOR_LENGTH_SQUARED: return TP_Type::make_from_ts("float"); default: throw std::runtime_error("Simple expression cannot get_type: " + diff --git a/decompiler/IR2/Form.cpp b/decompiler/IR2/Form.cpp index 4657dfe398..34fa481561 100644 --- a/decompiler/IR2/Form.cpp +++ b/decompiler/IR2/Form.cpp @@ -1890,8 +1890,12 @@ std::string fixed_operator_to_string(FixedOperatorKind kind) { return "mouse-hold?"; case FixedOperatorKind::VECTOR_LENGTH: return "vector-length"; + case FixedOperatorKind::VECTOR_LENGTH_SQUARED: + return "vector-length-squared"; case FixedOperatorKind::VECTOR_PLUS_FLOAT_TIMES: return "vector+float*!"; + case FixedOperatorKind::VECTOR_PLUS_TIMES: + return "vector+*!"; case FixedOperatorKind::FOCUS_TEST: return "focus-test?"; default: diff --git a/decompiler/IR2/Form.h b/decompiler/IR2/Form.h index 0e5e18fe3d..61e46615c0 100644 --- a/decompiler/IR2/Form.h +++ b/decompiler/IR2/Form.h @@ -231,6 +231,7 @@ class SimpleExpressionElement : public FormElement { void update_from_stack_vector_plus_float_times(const Env& env, FormPool& pool, FormStack& stack, + FixedOperatorKind op, std::vector* result, bool allow_side_effects); void update_from_stack_vectors_in_common(FixedOperatorKind kind, diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index a59142c801..be57aed682 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -1652,6 +1652,7 @@ void SimpleExpressionElement::update_from_stack_vector_plus_float_times( const Env& env, FormPool& pool, FormStack& stack, + FixedOperatorKind op, std::vector* result, bool allow_side_effects) { std::vector popped_args = pop_to_forms({m_expr.get_arg(0).var(), m_expr.get_arg(1).var(), @@ -1668,9 +1669,8 @@ void SimpleExpressionElement::update_from_stack_vector_plus_float_times( } auto new_form = pool.alloc_element( - GenericOperator::make_fixed(FixedOperatorKind::VECTOR_PLUS_FLOAT_TIMES), - std::vector{popped_args.at(0), popped_args.at(1), popped_args.at(2), - popped_args.at(3)}); + GenericOperator::make_fixed(op), std::vector{popped_args.at(0), popped_args.at(1), + popped_args.at(2), popped_args.at(3)}); result->push_back(new_form); } @@ -2585,8 +2585,17 @@ void SimpleExpressionElement::update_from_stack(const Env& env, update_from_stack_vectors_in_common(FixedOperatorKind::VECTOR_LENGTH, env, pool, stack, result, allow_side_effects); break; + case SimpleExpression::Kind::VECTOR_LENGTH_SQUARED: + update_from_stack_vectors_in_common(FixedOperatorKind::VECTOR_LENGTH_SQUARED, env, pool, + stack, result, allow_side_effects); + break; case SimpleExpression::Kind::VECTOR_PLUS_FLOAT_TIMES: - update_from_stack_vector_plus_float_times(env, pool, stack, result, allow_side_effects); + update_from_stack_vector_plus_float_times( + env, pool, stack, FixedOperatorKind::VECTOR_PLUS_FLOAT_TIMES, result, allow_side_effects); + break; + case SimpleExpression::Kind::VECTOR_PLUS_TIMES: + update_from_stack_vector_plus_float_times( + env, pool, stack, FixedOperatorKind::VECTOR_PLUS_TIMES, result, allow_side_effects); break; default: throw std::runtime_error( diff --git a/decompiler/IR2/IR2_common.h b/decompiler/IR2/IR2_common.h index 2c01d37acd..589c34a969 100644 --- a/decompiler/IR2/IR2_common.h +++ b/decompiler/IR2/IR2_common.h @@ -171,7 +171,9 @@ enum class FixedOperatorKind { PPOINTER_TO_PROCESS, VECTOR_4_DOT, VECTOR_LENGTH, + VECTOR_LENGTH_SQUARED, VECTOR_PLUS_FLOAT_TIMES, + VECTOR_PLUS_TIMES, SEND_EVENT, CPAD_PRESSED_P, CPAD_HOLD_P, diff --git a/decompiler/analysis/atomic_op_builder.cpp b/decompiler/analysis/atomic_op_builder.cpp index d5d357d7da..e9a963672e 100644 --- a/decompiler/analysis/atomic_op_builder.cpp +++ b/decompiler/analysis/atomic_op_builder.cpp @@ -1962,6 +1962,75 @@ std::unique_ptr convert_6(const Instruction& i0, return nullptr; } +std::unique_ptr convert_vector_length_squared(const Instruction* instrs, int idx) { + // 0: lqc2 vf1, 0(a0) + if (instrs[0].kind != InstructionKind::LQC2 || instrs[0].get_dst(0).get_reg() != make_vf(1) || + !instrs[0].get_src(0).is_imm(0)) { + return nullptr; + } + Register vec_src = instrs[0].get_src(1).get_reg(); + + auto vf0 = make_vf(0); + auto vf1 = make_vf(1); + auto vf2 = make_vf(2); + + // 1: vaddw.x vf2, vf0, vf0 + if (instrs[1].kind != InstructionKind::VADD_BC || instrs[1].get_dst(0).get_reg() != vf2 || + instrs[1].get_src(0).get_reg() != vf0 || instrs[1].get_src(1).get_reg() != vf0 || + instrs[1].cop2_dest != 0b1000 || instrs[1].cop2_bc != 3) { + return nullptr; + } + + // 2: vmul.xyzw vf1, vf1, vf1 + if (instrs[2].kind != InstructionKind::VMUL || instrs[2].get_dst(0).get_reg() != vf1 || + instrs[2].get_src(0).get_reg() != vf1 || instrs[2].get_src(1).get_reg() != vf1 || + instrs[2].cop2_dest != 0b1111) { + return nullptr; + } + + // 3: vmulax.x acc, vf2, vf1 + if (instrs[3].kind != InstructionKind::VMULA_BC || instrs[3].get_src(0).get_reg() != vf2 || + instrs[3].get_src(1).get_reg() != vf1 || instrs[3].cop2_dest != 0b1000 || + instrs[3].cop2_bc != 0) { + return nullptr; + } + + // 4: vmadday.x acc, vf2, vf1 + if (instrs[4].kind != InstructionKind::VMADDA_BC || instrs[4].get_src(0).get_reg() != vf2 || + instrs[4].get_src(1).get_reg() != vf1 || instrs[4].cop2_dest != 0b1000 || + instrs[4].cop2_bc != 1) { + return nullptr; + } + + // 5: vmaddz.x vf1, vf2, vf1 + if (instrs[5].kind != InstructionKind::VMADD_BC || instrs[5].get_dst(0).get_reg() != vf1 || + instrs[5].get_src(0).get_reg() != vf2 || instrs[5].get_src(1).get_reg() != vf1 || + instrs[5].cop2_dest != 0b1000 || instrs[5].cop2_bc != 2) { + return nullptr; + } + + // 6: qmfc2.i v0, vf1 + if (instrs[6].kind != InstructionKind::QMFC2 || instrs[6].src->get_reg() != vf1) { + return nullptr; + } + auto dst = instrs[6].get_dst(0).get_reg(); + return std::make_unique( + make_dst_var(dst, idx), + SimpleExpression(SimpleExpression::Kind::VECTOR_LENGTH_SQUARED, make_src_atom(vec_src, idx)), + idx); +} + +std::unique_ptr convert_7(const Instruction* instrs, int idx, GameVersion version) { + if (version == GameVersion::Jak3) { + auto as_vector_length_squared = convert_vector_length_squared(instrs, idx); + if (as_vector_length_squared) { + return as_vector_length_squared; + } + } + + return nullptr; +} + std::unique_ptr convert_vector_plus_float_times(const Instruction* instrs, int idx) { // lqc2 vf2, 0(a2) if (instrs[0].kind != InstructionKind::LQC2 || instrs[0].get_dst(0).get_reg() != make_vf(2) || @@ -2029,11 +2098,83 @@ std::unique_ptr convert_vector_plus_float_times(const Instruction* ins idx); } -std::unique_ptr convert_8(const Instruction* instrs, int idx) { +std::unique_ptr convert_vector_plus_times(const Instruction* instrs, int idx) { + // 0: mfc1 a3, f0 + if (instrs[0].kind != InstructionKind::MFC1) { + return nullptr; + } + Register flt_src_3 = instrs[0].get_src(0).get_reg(); + Register temp = instrs[0].get_dst(0).get_reg(); + + // 1: qmtc2.i vf7, a3 + if (instrs[1].kind != InstructionKind::QMTC2 || instrs[1].get_dst(0).get_reg() != make_vf(7) || + instrs[1].get_src(0).get_reg() != temp) { + return nullptr; + } + // 2: lqc2 vf5, 0(a2) + if (instrs[2].kind != InstructionKind::LQC2 || instrs[2].get_dst(0).get_reg() != make_vf(5) || + !instrs[2].get_src(0).is_imm(0)) { + return nullptr; + } + Register vec_src_2 = instrs[2].get_src(1).get_reg(); + + // 3: lqc2 vf4, 0(a1) + if (instrs[3].kind != InstructionKind::LQC2 || instrs[3].get_dst(0).get_reg() != make_vf(4) || + !instrs[3].get_src(0).is_imm(0)) { + return nullptr; + } + Register vec_src_1 = instrs[3].get_src(1).get_reg(); + + // 4: vaddx.w vf6, vf0, vf0 + if (instrs[4].kind != InstructionKind::VADD_BC || instrs[4].get_dst(0).get_reg() != make_vf(6) || + instrs[4].get_src(0).get_reg() != make_vf(0) || + instrs[4].get_src(1).get_reg() != make_vf(0) || instrs[4].cop2_bc != 0 || + instrs[4].cop2_dest != 0b0001) { + return nullptr; + } + // 5: vmulax.xyz acc, vf5, vf7 + // vmulax.xyz acc, vf5, vf7 + if (instrs[5].kind != InstructionKind::VMULA_BC || instrs[5].get_src(0).get_reg() != make_vf(5) || + instrs[5].get_src(1).get_reg() != make_vf(7) || instrs[5].cop2_dest != 0b1110 || + instrs[5].cop2_bc != 0) { + return nullptr; + } + + // 6: vmaddw.xyz vf6, vf4, vf0 + if (instrs[6].kind != InstructionKind::VMADD_BC || instrs[6].get_dst(0).get_reg() != make_vf(6) || + instrs[6].get_src(0).get_reg() != make_vf(4) || + instrs[6].get_src(1).get_reg() != make_vf(0) || instrs[6].cop2_dest != 0b1110 || + instrs[6].cop2_bc != 3) { + return nullptr; + } + + // 7: sqc2 vf6, 0(a0) + if (instrs[7].kind != InstructionKind::SQC2 || instrs[7].get_src(0).get_reg() != make_vf(6) || + !instrs[7].get_src(1).is_imm(0)) { + return nullptr; + } + Register dst = instrs[7].get_src(2).get_reg(); + + return std::make_unique( + make_dst_var(dst, idx), + SimpleExpression(SimpleExpression::Kind::VECTOR_PLUS_TIMES, make_src_atom(dst, idx), + make_src_atom(vec_src_1, idx), make_src_atom(vec_src_2, idx), + make_src_atom(flt_src_3, idx)), + idx); +} + +std::unique_ptr convert_8(const Instruction* instrs, int idx, GameVersion version) { auto as_vector_float_plus_times = convert_vector_plus_float_times(instrs, idx); if (as_vector_float_plus_times) { return as_vector_float_plus_times; } + + if (version == GameVersion::Jak3) { + auto as_vector_plus_times = convert_vector_plus_times(instrs, idx); + if (as_vector_plus_times) { + return as_vector_plus_times; + } + } return nullptr; } @@ -2378,13 +2519,21 @@ int convert_block_to_atomic_ops(int begin_idx, } if (!converted && n_instr >= 8) { - op = convert_8(&instr[0], op_idx); + op = convert_8(&instr[0], op_idx, version); if (op) { converted = true; length = 8; } } + if (!converted && n_instr >= 7) { + op = convert_7(&instr[0], op_idx, version); + if (op) { + converted = true; + length = 7; + } + } + if (!converted && n_instr >= 6) { // try 6 instructions op = convert_6(instr[0], instr[1], instr[2], instr[3], instr[4], instr[5], op_idx); diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc index 788bd08f30..eac8c2aad9 100644 --- a/decompiler/config/jak3/all-types.gc +++ b/decompiler/config/jak3/all-types.gc @@ -2398,7 +2398,7 @@ (define-extern quaternion-rotate-y-to-vector! (function quaternion quaternion quaternion float quaternion)) (define-extern vector-rotate-around-axis! "Rotate along y so z-axis points to match another. Use arg3 as the max rotation amount." - (function vector quaternion float vector vector)) + (function vector vector float vector vector)) (define-extern vector-rotate-x! "Rotate vector along x axis." (function vector vector float vector)) (define-extern vector-rotate-y! "Rotate vector along y axis." (function vector vector float vector)) (define-extern vector-rotate-z! "Rotate vector along z axis." (function vector vector float vector)) @@ -17618,7 +17618,7 @@ exit ;; 16 ) (:methods - (talker-method-17 (_type_) none) ;; 17 + (draw-text (_type_) none) ;; 17 ) ) @@ -19477,6 +19477,21 @@ ;; ---aligner-h:align-opts (deftype align-control (basic) + "Align-control is a utility for moving a process-drawable based on its animation. + The animation format has two special parent-like joints: prejoint and align. + The prejoint is the parent for all joints, so it causes all bones to move. + The align joint has no children, but the convention is that moving align will + cause the entire process-drawable's root to move, effectively moving the entire character. + Most of the time, this is the preferable way to move a character as part of an animation - + it will update their velocity and when the animation ends or is canceled, + the offset in position from playing the animation will stay. For example, if Jak punches, + his velocity will increase due to the animated align in the punch animation. + To implement this, the align-control computes the relative transform between align frames. + To apply the position offset, typically the velocity is updated, then the normal per-frame + physics update will end up moving the position. For orientation, there is no concept of + angular velocity, so instead align-control directly modifies the quaternion. + Unlike normal animation evaluation, the alignment's blend is computed in a different way + that doesn't blend and instead just picks the most recently pushed animation." ((flags align-flags :offset-assert 4) ;; guessed by decompiler (process process-drawable :offset-assert 8) ;; guessed by decompiler (frame-group art-joint-anim :offset-assert 12) ;; guessed by decompiler @@ -19492,11 +19507,12 @@ :flag-assert #xe00000134 (:methods (new (symbol type process) _type_) ;; 0 - (compute-alignment! (_type_) transformq) ;; 9 - (align! (_type_ align-opts float float float) trsqv) ;; 10 - (align-vel-and-quat-only! (_type_ align-opts vector int float float) trsqv) ;; 11 - (first-transform (_type_) transform) ;; 12 - (second-transform (_type_) transform) ;; 13 + (compute-delta-align! "Compute the change in align since the last time this was called." (_type_) transformq) ;; 9 + (align! "Apply the alignment to the process-drawable." (_type_ align-opts float float float) trsqv) ;; 10 + (adjust-root-no-gravity! "Adjust the quat and transv of the process drawable to take into account the + most recent change in align." (_type_ align-opts vector int float float) trsqv) ;; 11 + (first-transform "Get the more recent align transform" (_type_) transform) ;; 12 + (second-transform "Get the second most recent align trasnform" (_type_) transform) ;; 13 ) ) @@ -42344,6 +42360,7 @@ ) (deftype joint-exploder-list (structure) + "Linked list of joint-exploder-joint." ((head int32 :offset-assert 0) (pre-moved? symbol :offset-assert 4) ;; guessed by decompiler (bbox-valid? symbol :offset-assert 8) ;; guessed by decompiler @@ -42364,6 +42381,8 @@ ) (deftype joint-exploder (process-drawable) + "The joint-exploder animates an object exploding into pieces. + For example, geyser rock dummies, or the jak 1 zoomer." ((parent (pointer process-drawable) :override) (die-if-below-y float :offset-assert 200) (die-if-beyond-xz-dist-sqrd float :offset-assert 204) @@ -42379,14 +42398,14 @@ :size-assert #x158 :flag-assert #x1e00e00158 (:methods - (add-joint-to-list (_type_ joint-exploder-list int) int) ;; 20 - (update-bbox-for-joint (_type_ joint-exploder-list joint-exploder-joint) none) ;; 21 + (add-joint-to-list "Add a joint to the given linked list of joints." (_type_ joint-exploder-list int) int) ;; 20 + (update-bbox-for-joint "Update the bounding box to include the joint" (_type_ joint-exploder-list joint-exploder-joint) none) ;; 21 (do-collision-response (_type_ joint-exploder-list) none) ;; 22 (init-joint-list (_type_) none) ;; 23 - (remove-from-list-and-reset (_type_ joint-exploder-list int) int) ;; 24 + (remove-from-list-and-reset "Remove a joint from the list and clear its transform" (_type_ joint-exploder-list int) int) ;; 24 (final-adjust (_type_ joint-exploder-list int) int) ;; 25 (integrate-and-kill (_type_ joint-exploder-list) none) ;; 26 - (remove-joint-from-list (_type_ joint-exploder-list int) int) ;; 27 + (remove-joint-from-list "Remove a joint from the linked list and invalidate the bbox." (_type_ joint-exploder-list int) int) ;; 27 (adjust-bbox-for-limits-along-axis (_type_ joint-exploder-list int) joint-exploder-list) ;; 28 (adjust-bbox-for-limits (_type_ joint-exploder-list) none) ;; 29 ) @@ -42395,7 +42414,7 @@ ) ) -(define-extern joint-exploder-joint-callback (function draw-control cspace-array joint-control none)) +(define-extern joint-exploder-joint-callback "Postbind callback to set bones to the result of the joint-exploder." (function draw-control cspace-array joint-control none)) (define-extern joint-exploder-init-by-other (function skeleton-group int joint-exploder-tuning joint-exploder-static-params object :behavior joint-exploder)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/decompiler/config/jak3/ntsc_v1/hacks.jsonc b/decompiler/config/jak3/ntsc_v1/hacks.jsonc index de1f4f5540..556909555e 100644 --- a/decompiler/config/jak3/ntsc_v1/hacks.jsonc +++ b/decompiler/config/jak3/ntsc_v1/hacks.jsonc @@ -558,7 +558,7 @@ "(method 32 task-manager-dark-punch-training)": [[53, 0]], "(method 32 task-manager-lightjak-training-shield)": [[53, 0]], "(trans credits highres-viewer-manager)": [[185, 0]], - "(trans idle hirez-viewer)": [[356, 0]], + "(trans idle hirez-viewer)": [[342, 0]], "(trans idle burning-bush)": [ [171, 1], [202, 0] diff --git a/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc b/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc index 6d8ddeb6f5..9ec8d17870 100644 --- a/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc +++ b/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc @@ -1927,7 +1927,6 @@ [16, "vector"], [32, ["array", "collide-shape", 384]] ], - "(method 35 fac-gun-tower)": [[32, "vector"]], "fac-robotank-init-by-other": [[32, "vector"]], "(trans flying factory-fighter)": [[16, "vector"]], "(method 16 factory-manager)": [ diff --git a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc index bc53861a7a..ec93734605 100644 --- a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc @@ -584,7 +584,7 @@ [6, "gp", "joint-mod-ik"], [9, "gp", "joint-mod-ik"], [[1, 35], "gp", "joint-mod-ik"], - [[1, 422], "gp", "joint-mod-ik"] + [[1, 414], "gp", "joint-mod-ik"] ], "real-joint-mod-gun-look-at-handler": [ [1, "v1", "joint-mod"], @@ -2226,13 +2226,16 @@ [512, "v1", "camera-slave"], [542, "v1", "camera-slave"], [611, "a0", "vector"], - [799, "v1", "float"], - [784, "v1", "vector"], + [789, "v1", "float"], + [792, "v1", "float"], + [794, "v0", "float"], + + // [784, "v1", "vector"], [589, "v1", "float"], [593, "v1", "float"], [602, "v1", "float"], - [606, "v1", "float"], - [796, "v1", "float"] + [606, "v1", "float"] + // [796, "v1", "float"] ], "master-track-target": [ [53, "gp", "process-focusable"], @@ -3339,7 +3342,7 @@ [298, "a0", "process-focusable"], [300, "a0", "process-focusable"] ], - "(method 14 rigid-body-control)": [[18, "v1", "vector"]], + "(method 14 rigid-body-control)": [[11, "v1", "vector"]], "transform-rigid-body-prims": [[4, "v1", "collide-shape-prim-group"]], "(method 67 collide-shape-moving)": [ [8, "v1", "collide-shape-prim-group"], @@ -3554,10 +3557,10 @@ [314, "s1", "process-focusable"] ], "gun-fire-red-1": [ - [147, "v1", "manipy"], - [191, "v1", "manipy"], - [194, "v1", "manipy"], - [197, "v1", "manipy"] + [140, "v1", "manipy"], + [184, "v1", "manipy"], + [187, "v1", "manipy"], + [190, "v1", "manipy"] ], "(method 23 gun-red-shot)": [[10, "s4", "process-focusable"]], "(method 26 gun-red-shot)": [ @@ -3930,10 +3933,10 @@ [254, "a0", "(state target)"] ], "collide-list-fill-bg-using-line-sphere": [ - [261, "a0", "collide-hash-scratch"], - [[279, 285], "v1", "collide-hash-scratch"], - [[246, 251], "v1", "collide-hash-scratch"], - [293, "a0", "collide-hash-scratch"], + [287, "a0", "collide-hash-scratch"], + [[272, 280], "v1", "collide-hash-scratch"], + [[239, 246], "v1", "collide-hash-scratch"], + [255, "a0", "collide-hash-scratch"], [102, "v1", "float"] ], "collide-list-fill-bg-using-box": [ @@ -3994,9 +3997,9 @@ "(method 9 collide-edge-edge)": [[20, "a0", "collide-shape-moving"]], "(method 13 collide-edge-work)": [[[8, 119], "s1", "collide-edge-edge"]], "(method 20 collide-edge-work)": [ - [100, "a0", "collide-shape-moving"], - [179, "v1", "int"], - [179, "a1", "int"] + [93, "a0", "collide-shape-moving"], + [172, "v1", "int"], + [172, "a1", "int"] ], "collide-shape-draw-debug-marks": [ [24, "v1", "connection"], @@ -4048,7 +4051,7 @@ ], "(method 19 collide-shape-prim)": [[[3, 32], "s4", "collide-shape-prim"]], "(method 18 collide-shape-prim-sphere)": [ - [79, "s4", "collide-shape-prim-mesh"] + [72, "s4", "collide-shape-prim-mesh"] ], "(method 66 collide-shape-moving)": [[[29, 58], "s0", "collide-cache-prim"]], "(method 56 collide-shape-moving)": [ @@ -4096,10 +4099,10 @@ [65, "s4", "(inline-array collide-cache-prim)"] ], "(method 20 collide-cache)": [ - [50, "v1", "connection"], - [51, "s1", "collide-shape"], - [114, "v1", "connection"], - [115, "s1", "collide-shape"] + [44, "v1", "connection"], + [45, "s1", "collide-shape"], + [108, "v1", "connection"], + [109, "s1", "collide-shape"] ], "(method 19 collide-cache)": [ [26, "a0", "connection"], @@ -4806,7 +4809,7 @@ [3, "v1", "process-drawable"], [36, "s5", "collide-shape"], [41, "s5", "collide-shape"], - [85, "s5", "collide-shape-moving"] + [78, "s5", "collide-shape-moving"] ], "target-mech-collision": [[108, "v0", "carry-info"]], "(anon-function 8 target-mech)": [ @@ -4925,7 +4928,7 @@ [3, "v1", "process-drawable"], [36, "s5", "collide-shape"], [41, "s5", "collide-shape"], - [96, "s5", "collide-shape-moving"] + [89, "s5", "collide-shape-moving"] ], "(anon-function 74 target-flut)": [ [[0, 56], "gp", "target"], @@ -6380,13 +6383,13 @@ "(method 13 was-squad-control)": [ [42, "v1", "process-focusable"], [47, "v1", "process-focusable"], + [121, "s3", "process-focusable"], [127, "s3", "process-focusable"], - [133, "s3", "process-focusable"], - [138, "s3", "process-focusable"], - [142, "s3", "process-focusable"], - [69, "v1", "process-focusable"], - [265, "a1", "process-focusable"], - [233, "v1", "process-focusable"] + [132, "s3", "process-focusable"], + [136, "s3", "process-focusable"], + [63, "v1", "process-focusable"], + [259, "a1", "process-focusable"], + [227, "v1", "process-focusable"] ], "(method 35 was-squad-control)": [ [37, "s4", "process-focusable"], @@ -6427,9 +6430,9 @@ [477, "v1", "float"] ], "(method 77 wvehicle)": [ - [179, "s4", "process-focusable"], - [186, "s4", "process-focusable"], - [194, "s4", "process-focusable"] + [167, "s4", "process-focusable"], + [174, "s4", "process-focusable"], + [182, "s4", "process-focusable"] ], "(method 165 wvehicle)": [ [102, "s2", "process-focusable"], @@ -6511,18 +6514,18 @@ [45, "a0", "process-focusable"] ], "(code target-pilot-impact)": [ - [102, "v1", "art-joint-anim"], - [157, "v1", "art-joint-anim"], - [220, "v1", "art-joint-anim"], - [275, "v1", "art-joint-anim"], - [329, "v1", "art-joint-anim"], - [389, "v1", "art-joint-anim"], - [447, "v1", "art-joint-anim"], - [517, "v1", "art-joint-anim"], - [572, "v1", "art-joint-anim"], - [626, "v1", "art-joint-anim"], - [686, "v1", "art-joint-anim"], - [744, "v1", "art-joint-anim"] + [96, "v1", "art-joint-anim"], + [151, "v1", "art-joint-anim"], + [214, "v1", "art-joint-anim"], + [269, "v1", "art-joint-anim"], + [323, "v1", "art-joint-anim"], + [383, "v1", "art-joint-anim"], + [441, "v1", "art-joint-anim"], + [511, "v1", "art-joint-anim"], + [566, "v1", "art-joint-anim"], + [620, "v1", "art-joint-anim"], + [680, "v1", "art-joint-anim"], + [738, "v1", "art-joint-anim"] ], "(code target-pilot-daxter-perch)": [ [16, "v1", "art-joint-anim"], @@ -6734,8 +6737,8 @@ [26, "s2", "process-focusable"], [33, "s2", "process-focusable"], [39, "s2", "process-focusable"], - [78, "s2", "process-focusable"], - [108, "s2", "process-focusable"], + [71, "s2", "process-focusable"], + [101, "s2", "process-focusable"], [111, "s2", "process-focusable"] ], "(code on-vehicle egg-spider)": [ @@ -6780,9 +6783,9 @@ [172, "gp", "wvehicle"] ], "(trans idle spider-manager)": [ - [252, "gp", "process-focusable"], - [255, "gp", "process-focusable"], - [265, "gp", "process-focusable"] + [245, "gp", "process-focusable"], + [248, "gp", "process-focusable"], + [258, "gp", "process-focusable"] ], "(method 23 spider-manager)": [ [18, "v1", "egg-spider"], @@ -7846,7 +7849,7 @@ "(trans hostile mantis)": [ [27, "gp", "process-focusable"], [41, "gp", "process-focusable"], - [100, "gp", "process-focusable"] + [93, "gp", "process-focusable"] ], "(code ambush-crawling mantis)": [[23, "v1", "art-joint-anim"]], "(code active mantis)": [ @@ -7858,7 +7861,7 @@ "(code hop-away mantis)": [ [24, "gp", "process-focusable"], [59, "gp", "process-focusable"], - [133, "v1", "art-joint-anim"] + [126, "v1", "art-joint-anim"] ], "(method 75 mantis)": [ [20, "a0", "process-focusable"], @@ -8031,7 +8034,7 @@ [21, "v1", "art-joint-anim"], [88, "v1", "art-joint-anim"] ], - "(code ambush marauder)": [[101, "v1", "art-joint-anim"]], + "(code ambush marauder)": [[87, "v1", "art-joint-anim"]], "(code victory marauder)": [ [26, "v1", "art-joint-anim"], [81, "v1", "art-joint-anim"] @@ -8288,10 +8291,10 @@ [257, "s2", "process-drawable"], [273, "s2", "process-drawable"], [274, "v1", "collide-shape"], - [357, "a0", "collide-shape-prim-group"], - [385, "a0", "collide-shape-prim-group"], - [403, "a1", "collide-shape-prim-group"], - [429, "a0", "collide-shape-prim-group"], + [350, "a0", "collide-shape-prim-group"], + [378, "a0", "collide-shape-prim-group"], + [396, "a1", "collide-shape-prim-group"], + [422, "a0", "collide-shape-prim-group"], [10, "v0", "(array collide-shape)"], [309, "a1", "skeet"] ], @@ -8316,17 +8319,17 @@ ], "(method 33 hvehicle)": [[39, "s5", "rigid-body-vehicle-constants"]], "(method 94 hvehicle)": [[42, "f0", "float"]], - "(method 18 vehicle-controller)": [[[231, 316], "v1", "hvehicle"]], + "(method 18 vehicle-controller)": [[[224, 304], "v1", "hvehicle"]], "(method 31 hvehicle)": [ [69, "v1", "float"], [164, "v1", "float"], [67, "a0", "int"], [162, "a0", "int"] ], - "(method 97 hvehicle)": [[159, "a0", "vector"]], + "(method 97 hvehicle)": [[152, "a0", "vector"]], "(post idle glider-ring)": [ - [203, "v1", "art-joint-anim"], - [[413, 424], "v1", "glider-prim"] + [189, "v1", "art-joint-anim"], + [[402, 410], "v1", "glider-prim"] ], "(method 25 glider-ring)": [[15, "v1", "glider-prim"]], "glider-ring-standard-event-handler": [ @@ -8340,7 +8343,7 @@ [21, "a1", "vector"], [25, "a1", "vector"] ], - "(method 97 h-glider)": [[159, "a0", "vector"]], + "(method 97 h-glider)": [[152, "a0", "vector"]], "glider-thermal-updraft-velocity": [ [20, "v1", "task-manager-desert-glide"], [23, "v1", "task-manager-desert-glide"] @@ -8468,9 +8471,9 @@ ], "(event idle terraformer-leg)": [ [57, "s5", "process-drawable"], - [99, "gp", "vehicle"], - [202, "a0", "nav-mesh"], - [205, "a0", "nav-mesh"] + [93, "gp", "vehicle"], + [196, "a0", "nav-mesh"], + [199, "a0", "nav-mesh"] ], "(post attack terraformer-drone)": [ [14, "a0", "process-focusable"], @@ -8813,8 +8816,8 @@ "(trans die mh-centipede)": [[16, "v0", "vehicle"]], "mh-centipede-active-handler": [ [[5, 119], "s4", "touching-shapes-entry"], - [91, "gp", "vehicle"], - [[208, 227], "v1", "attack-info"] + [85, "gp", "vehicle"], + [[203, 221], "v1", "attack-info"] ], "(enter impact mh-centipede-shot)": [[71, "a0", "process"]], "(event hidden rod-spawner)": [ @@ -9174,14 +9177,14 @@ [148, "v1", "process-drawable"], [155, "v1", "process-drawable"], [158, "a0", "process-drawable"], + [165, "v1", "process-drawable"], [172, "v1", "process-drawable"], - [179, "v1", "process-drawable"], - [182, "a0", "process-drawable"], - [195, "v1", "process-drawable"], - [198, "a0", "process-drawable"], - [267, "v1", "process-drawable"], - [275, "gp", "collide-shape"], - [284, "gp", "collide-shape"], + [175, "a0", "process-drawable"], + [181, "v1", "process-drawable"], + [184, "a0", "process-drawable"], + [246, "v1", "process-drawable"], + [254, "gp", "collide-shape"], + [263, "gp", "collide-shape"], [[203, 207], "a2", "float"] ], "(method 62 h-sled)": [[[4, 41], "s5", "collide-shape-prim-group"]], @@ -9213,7 +9216,7 @@ [354, "v0", "vehicle"] ], "(method 54 h-warf)": [[[15, 21], "a0", "process-focusable"]], - "(method 97 h-warf)": [[159, "a0", "vector"]], + "(method 97 h-warf)": [[152, "a0", "vector"]], "(method 156 fac-gunturret)": [[[11, 19], "a0", "process-focusable"]], "(method 155 fac-gunturret)": [[[15, 23], "a0", "process-focusable"]], "(code fire fac-robotank-turret)": [ @@ -9248,7 +9251,9 @@ "(event idle fac-gun-tower-base)": [[[18, 86], "s4", "projectile"]], "(code idle fac-gun-tower-base)": [[10, "v1", "art-joint-anim"]], "(method 36 fac-gun-tower)": [[46, "s2", "process-focusable"]], - "(method 35 fac-gun-tower)": [[79, "v0", "vehicle"]], + "(method 35 fac-gun-tower)": [ + [[72,76], "a0", "vehicle"] + ], "fac-robotank-init-by-other": [ [182, "gp", "factory-manager"], [208, "gp", "factory-manager"], @@ -9271,7 +9276,7 @@ "fac-target-standard-event-handler": [[[48, 54], "v1", "attack-info"]], "(enter idle fac-target)": [[63, "v1", "art-joint-anim"]], "(enter retracted fac-target)": [[33, "v1", "art-joint-anim"]], - "(method 60 factory-fighter)": [[52, "v0", "vehicle"]], + "(method 60 factory-fighter)": [[38, "v0", "vehicle"]], "(code die factory-fighter)": [[11, "v1", "art-joint-anim"]], "(method 32 task-manager-factory-sky-battle)": [["_stack_", 16, "res-tag"]], "update-railx-lights": [[[33, 88], "s3", "railx-states"]], @@ -9841,7 +9846,7 @@ ], "(code knocked-recover crimson-guard)": [[23, "a1", "art-joint-anim"]], "(method 289 crimson-guard)": [[21, "v1", "float"]], - "(method 258 crimson-guard)": [[152, "v1", "collide-shape-prim"]], + "(method 258 crimson-guard)": [[138, "v1", "collide-shape-prim"]], "(method 212 crimson-guard)": [[[246, 249], "v1", "vehicle"]], "(method 265 crimson-guard)": [ [22, "s4", "process-focusable"], @@ -10171,13 +10176,13 @@ [149, "v1", "process-drawable"], [156, "v1", "process-drawable"], [159, "a0", "process-drawable"], + [166, "v1", "process-drawable"], [173, "v1", "process-drawable"], - [180, "v1", "process-drawable"], - [183, "a0", "process-drawable"], - [196, "v1", "process-drawable"], - [199, "a0", "process-drawable"], - [281, "v1", "process-drawable"], - [291, "a0", "collide-shape"], + [176, "a0", "process-drawable"], + [182, "v1", "process-drawable"], + [185, "a0", "process-drawable"], + [260, "v1", "process-drawable"], + [270, "a0", "collide-shape"], [[204, 208], "a2", "float"] ], "(method 33 task-manager-bbush-board)": [[55, "v1", "hud"]], @@ -10333,7 +10338,7 @@ "(enter explode bombbot-bomb)": [[59, "a0", "process"]], "(method 26 task-manager-port-fight)": [[[315, 343], "s2", "bombbot"]], "(code hostile bombbot-player)": [[38, "v1", "art-joint-anim"]], - "(method 196 bombbot-player)": [[[214, 218], "a0", "process-focusable"]], + "(method 196 bombbot-player)": [[[207, 211], "a0", "process-focusable"]], "(trans hostile bomb-bot)": [[[34, 61], "gp", "process-focusable"]], "(method 196 bomb-bot)": [ [[1, 119], "gp", "process-focusable"], @@ -10349,7 +10354,7 @@ "(code blow-wall bombbot)": [[10, "v1", "art-joint-anim"]], "(code drop-bombs bombbot)": [[10, "v1", "art-joint-anim"]], "(code hostile bombbot)": [[10, "v1", "art-joint-anim"]], - "(trans hostile bombbot)": [[[45, 94], "v1", "process-focusable"]], + "(trans hostile bombbot)": [[[45, 87], "v1", "process-focusable"]], "(enter hostile bombbot)": [[15, "v1", "collide-shape-prim-group"]], "(method 200 bombbot)": [[4, "v1", "collide-shape-prim-group"]], "(method 194 bombbot)": [ @@ -10505,7 +10510,7 @@ "(trans move-to-vehicle jinx)": [[[11, 46], "s0", "vehicle"]], "(method 26 task-manager-city-destroy-grid)": [ [[17, 666], "s5", "jinx"], - [[193, 210], "v1", "vehicle"], + [[189, 203], "v1", "vehicle"], [[253, 287], "a2", "vehicle"], [[494, 664], "s4", "vehicle"] ], @@ -10948,7 +10953,7 @@ "(enter fail task-manager-protect-hq)": [ [26, "v0", "(state resetter-params task-manager-protect-hq)"] ], - "(trans hostile assault-bombbot)": [[[76, 125], "v1", "process-focusable"]], + "(trans hostile assault-bombbot)": [[[76, 119], "v1", "process-focusable"]], "(method 209 assault-bombbot)": [[48, "v1", "process-focusable"]], "(code wait-for-enemies assault-crimson-guard)": [ [22, "v1", "art-joint-anim"] diff --git a/decompiler/types2/ForwardProp.cpp b/decompiler/types2/ForwardProp.cpp index bb0ec3cd20..fd858d1448 100644 --- a/decompiler/types2/ForwardProp.cpp +++ b/decompiler/types2/ForwardProp.cpp @@ -1611,6 +1611,7 @@ void types2_for_expr(types2::Type& type_out, case SimpleExpression::Kind::VECTOR_3_DOT: case SimpleExpression::Kind::VECTOR_4_DOT: case SimpleExpression::Kind::VECTOR_LENGTH: + case SimpleExpression::Kind::VECTOR_LENGTH_SQUARED: types2_for_vectors_in_float_out(type_out, expr, input_types, dts, extras); break; case SimpleExpression::Kind::VECTOR_CROSS: @@ -1623,6 +1624,7 @@ void types2_for_expr(types2::Type& type_out, types2_for_vector_float_product(type_out, expr, input_types, dts, extras); break; case SimpleExpression::Kind::VECTOR_PLUS_FLOAT_TIMES: + case SimpleExpression::Kind::VECTOR_PLUS_TIMES: types2_for_vector_plus_float_times(type_out, expr, input_types, dts, extras); break; case SimpleExpression::Kind::PCPYLD: diff --git a/goal_src/jak3/engine/ambient/ambient-h.gc b/goal_src/jak3/engine/ambient/ambient-h.gc index 16b35eca9d..77ce4e6ee4 100644 --- a/goal_src/jak3/engine/ambient/ambient-h.gc +++ b/goal_src/jak3/engine/ambient/ambient-h.gc @@ -83,7 +83,7 @@ and neg-state is greater than or equal to neg. exit ) (:methods - (talker-method-17 (_type_) none) + (draw-text (_type_) none) ) ) diff --git a/goal_src/jak3/engine/ambient/ambient.gc b/goal_src/jak3/engine/ambient/ambient.gc index f920adc7cf..479bfcb964 100644 --- a/goal_src/jak3/engine/ambient/ambient.gc +++ b/goal_src/jak3/engine/ambient/ambient.gc @@ -287,7 +287,7 @@ (none) ) -(defmethod talker-method-17 ((this talker)) +(defmethod draw-text ((this talker)) (let ((gp-0 (new 'stack 'font-context *font-default-matrix* 36 310 0.0 (font-color default) (font-flags shadow kerning)) ) @@ -516,7 +516,7 @@ (seek! (-> self interp) 1.0 (* 0.5 (seconds-per-frame))) (seek! (-> self interp) 1.0 (* 4.0 (seconds-per-frame))) ) - (talker-method-17 self) + (draw-text self) ) (suspend) ) @@ -528,7 +528,7 @@ (seek! (-> self interp) 0.0 (* 4.0 (seconds-per-frame))) ) (if (and (= (get-status *gui-control* (-> self message-id)) (gui-status active)) (not (paused?))) - (talker-method-17 self) + (draw-text self) ) (suspend) ) diff --git a/goal_src/jak3/engine/anim/aligner-h.gc b/goal_src/jak3/engine/anim/aligner-h.gc index 48c9c0f9cb..8b049614dd 100644 --- a/goal_src/jak3/engine/anim/aligner-h.gc +++ b/goal_src/jak3/engine/anim/aligner-h.gc @@ -38,6 +38,21 @@ ;; DECOMP BEGINS (deftype align-control (basic) + "Align-control is a utility for moving a process-drawable based on its animation. +The animation format has two special parent-like joints: prejoint and align. +The prejoint is the parent for all joints, so it causes all bones to move. +The align joint has no children, but the convention is that moving align will +cause the entire process-drawable's root to move, effectively moving the entire character. +Most of the time, this is the preferable way to move a character as part of an animation - +it will update their velocity and when the animation ends or is canceled, +the offset in position from playing the animation will stay. For example, if Jak punches, +his velocity will increase due to the animated align in the punch animation. +To implement this, the align-control computes the relative transform between align frames. +To apply the position offset, typically the velocity is updated, then the normal per-frame +physics update will end up moving the position. For orientation, there is no concept of +angular velocity, so instead align-control directly modifies the quaternion. +Unlike normal animation evaluation, the alignment's blend is computed in a different way +that doesn't blend and instead just picks the most recently pushed animation." ((flags align-flags) (process process-drawable) (frame-group art-joint-anim) @@ -50,9 +65,9 @@ ) (:methods (new (symbol type process) _type_) - (compute-alignment! (_type_) transformq) + (compute-delta-align! (_type_) transformq) (align! (_type_ align-opts float float float) trsqv) - (align-vel-and-quat-only! (_type_ align-opts vector int float float) trsqv) + (adjust-root-no-gravity! (_type_ align-opts vector int float float) trsqv) (first-transform (_type_) transform) (second-transform (_type_) transform) ) diff --git a/goal_src/jak3/engine/anim/aligner.gc b/goal_src/jak3/engine/anim/aligner.gc index c306fa9632..4bcd4b9d9c 100644 --- a/goal_src/jak3/engine/anim/aligner.gc +++ b/goal_src/jak3/engine/anim/aligner.gc @@ -9,7 +9,8 @@ ;; ERROR: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)] ;; ERROR: Unsupported inline assembly instruction kind - [jr ra] -(defmethod compute-alignment! ((this align-control)) +(defmethod compute-delta-align! ((this align-control)) + "Compute the change in align since the last time this was called." (local-vars (disable? symbol) (s7-0 none) (ra-0 int)) (update-anim-data (-> this process skel)) (let ((num-chans (-> this process skel active-channels))) @@ -110,14 +111,17 @@ ;; WARN: Return type mismatch (inline-array transform) vs transform. (defmethod first-transform ((this align-control)) + "Get the more recent align transform" (the-as transform (-> this transform)) ) (defmethod second-transform ((this align-control)) + "Get the second most recent align trasnform" (-> this transform 1) ) (defmethod align! ((this align-control) (arg0 align-opts) (arg1 float) (arg2 float) (arg3 float)) + "Apply the alignment to the process-drawable." (when (not (logtest? (-> this flags) (align-flags disabled))) (let* ((a0-1 (-> this process)) (t9-0 (method-of-object a0-1 apply-alignment)) @@ -156,7 +160,9 @@ ) ) -(defmethod align-vel-and-quat-only! ((this align-control) (arg0 align-opts) (arg1 vector) (arg2 int) (arg3 float) (arg4 float)) +(defmethod adjust-root-no-gravity! ((this align-control) (arg0 align-opts) (arg1 vector) (arg2 int) (arg3 float) (arg4 float)) + "Adjust the quat and transv of the process drawable to take into account the + most recent change in align." (with-pp (when (not (logtest? (-> this flags) (align-flags disabled))) (let ((s5-0 (-> this delta))) diff --git a/goal_src/jak3/engine/anim/joint-exploder.gc b/goal_src/jak3/engine/anim/joint-exploder.gc index f4a160b53c..519b198592 100644 --- a/goal_src/jak3/engine/anim/joint-exploder.gc +++ b/goal_src/jak3/engine/anim/joint-exploder.gc @@ -75,6 +75,7 @@ (deftype joint-exploder-list (structure) + "Linked list of joint-exploder-joint." ((head int32) (pre-moved? symbol) (bbox-valid? symbol) @@ -93,6 +94,8 @@ (set! (-> joint-exploder-list-array heap-base) (the-as uint 48)) (deftype joint-exploder (process-drawable) + "The joint-exploder animates an object exploding into pieces. +For example, geyser rock dummies, or the jak 1 zoomer." ((parent (pointer process-drawable) :override) (die-if-below-y float) (die-if-beyond-xz-dist-sqrd float) @@ -137,6 +140,7 @@ ) (defun joint-exploder-joint-callback ((arg0 draw-control) (arg1 cspace-array) (arg2 joint-control)) + "Postbind callback to set bones to the result of the joint-exploder." (let ((s4-0 (the-as joint-exploder (-> arg0 process)))) (let ((s3-0 (-> s4-0 joints))) (countdown (s2-0 (-> s3-0 num-joints)) @@ -168,6 +172,7 @@ ) (defmethod remove-from-list-and-reset ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + "Remove a joint from the list and clear its transform" (let ((v0-0 (remove-joint-from-list this arg0 arg1))) (let* ((v1-1 (-> this joints)) (v1-2 (-> v1-1 joint arg1)) @@ -182,6 +187,7 @@ ) (defmethod remove-joint-from-list ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + "Remove a joint from the linked list and invalidate the bbox." (let* ((v1-0 (-> this joints)) (a2-1 (-> v1-0 joint arg1)) (a0-4 (-> a2-1 prev)) @@ -213,6 +219,7 @@ ) (defmethod add-joint-to-list ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + "Add a joint to the given linked list of joints." (let* ((v1-0 (-> this joints)) (a3-0 (-> v1-0 joint arg1)) (a0-4 (-> arg0 head)) @@ -228,6 +235,7 @@ ) (defmethod update-bbox-for-joint ((this joint-exploder) (arg0 joint-exploder-list) (arg1 joint-exploder-joint)) + "Update the bounding box to include the joint" (let ((a1-1 (-> arg1 mat trans))) (cond ((-> arg0 bbox-valid?) @@ -448,62 +456,47 @@ ) (defmethod integrate-and-kill ((this joint-exploder) (arg0 joint-exploder-list)) - (local-vars (v1-8 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (set! (-> arg0 bbox-valid?) #f) - (set! (-> arg0 pre-moved?) #t) - (let ((s4-0 (-> this joints)) - (f30-0 (* (-> this tuning gravity) (seconds-per-frame))) - (s3-0 (-> arg0 head)) - ) - (while (>= s3-0 0) - (let* ((s2-0 (-> s4-0 joint s3-0)) - (s1-0 (-> s2-0 mat trans)) - ) - (vector-copy! (-> s2-0 prev-pos) s1-0) - (+! (-> s2-0 transv y) f30-0) - (when (< 0.0 (-> this tuning friction)) - (.lvf vf1 (&-> (-> s2-0 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 v1-8 vf1) - (let* ((f0-4 v1-8) - (f1-5 (* 0.00001 (seconds-per-frame) (-> this tuning friction) f0-4)) - (f0-6 (- (sqrtf f0-4) f1-5)) - ) - (if (< f0-6 0.0) - (set! f0-6 0.0) - ) - (vector-normalize! (-> s2-0 transv) f0-6) - ) - ) - (vector-v+! s1-0 s1-0 (-> s2-0 transv)) - (matrix*! (-> s2-0 rmat) (-> s2-0 rmat) (-> s2-0 update-rmat)) - (cond - ((or (< (-> s1-0 y) (-> this die-if-below-y)) - (< (-> this die-if-beyond-xz-dist-sqrd) (vector-vector-xz-distance s1-0 (-> this root trans))) - ) - (set! s3-0 (remove-from-list-and-reset this arg0 s3-0)) + (set! (-> arg0 bbox-valid?) #f) + (set! (-> arg0 pre-moved?) #t) + (let ((s4-0 (-> this joints)) + (f30-0 (* (-> this tuning gravity) (seconds-per-frame))) + (s3-0 (-> arg0 head)) + ) + (while (>= s3-0 0) + (let* ((s2-0 (-> s4-0 joint s3-0)) + (s1-0 (-> s2-0 mat trans)) ) - (else - (update-bbox-for-joint this arg0 s2-0) - (set! s3-0 (-> s2-0 next)) - ) + (vector-copy! (-> s2-0 prev-pos) s1-0) + (+! (-> s2-0 transv y) f30-0) + (when (< 0.0 (-> this tuning friction)) + (let* ((f0-4 (vector-length-squared (-> s2-0 transv))) + (f1-5 (* 0.00001 (seconds-per-frame) (-> this tuning friction) f0-4)) + (f0-6 (- (sqrtf f0-4) f1-5)) + ) + (if (< f0-6 0.0) + (set! f0-6 0.0) + ) + (vector-normalize! (-> s2-0 transv) f0-6) + ) + ) + (vector-v+! s1-0 s1-0 (-> s2-0 transv)) + (matrix*! (-> s2-0 rmat) (-> s2-0 rmat) (-> s2-0 update-rmat)) + (cond + ((or (< (-> s1-0 y) (-> this die-if-below-y)) + (< (-> this die-if-beyond-xz-dist-sqrd) (vector-vector-xz-distance s1-0 (-> this root trans))) + ) + (set! s3-0 (remove-from-list-and-reset this arg0 s3-0)) + ) + (else + (update-bbox-for-joint this arg0 s2-0) + (set! s3-0 (-> s2-0 next)) ) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod do-collision-response ((this joint-exploder) (arg0 joint-exploder-list)) diff --git a/goal_src/jak3/engine/anim/joint-mod.gc b/goal_src/jak3/engine/anim/joint-mod.gc index 48ca1e15f6..48a706331c 100644 --- a/goal_src/jak3/engine/anim/joint-mod.gc +++ b/goal_src/jak3/engine/anim/joint-mod.gc @@ -31,12 +31,10 @@ (sv-768 matrix) (sv-784 vector) ) - (rlet ((acc :class vf) - (vf0 :class vf) + (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((gp-0 (the-as joint-mod-ik (-> arg0 param1)))) @@ -82,21 +80,7 @@ 0.0 (vector-copy! s2-0 (-> s5-0 trans)) (vector-copy! sv-784 (-> s4-1 trans)) - (let ((a1-5 s0-0)) - (let ((v1-27 sv-784)) - (let ((a0-13 (-> s4-1 uvec))) - (let ((a2-2 (-> gp-0 hand-dist))) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-13 quad)) - ) - (.lvf vf4 (&-> v1-27 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-5 quad) vf6) - ) + (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) ) @@ -226,19 +210,19 @@ ) (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-20 (quaternion->matrix (new 'stack-no-clear 'matrix) sv-368)) + (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-20) + (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-21 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) s5-0)) + (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-21) + (matrix*! s4-1 s4-1 a2-20) (matrix*! s5-0 s5-0 s3-2) (vector-copy! (-> s5-0 trans) (-> gp-2 rvec)) ) diff --git a/goal_src/jak3/engine/camera/cam-master.gc b/goal_src/jak3/engine/camera/cam-master.gc index f27bfd54aa..a65e759331 100644 --- a/goal_src/jak3/engine/camera/cam-master.gc +++ b/goal_src/jak3/engine/camera/cam-master.gc @@ -582,13 +582,7 @@ (defstate cam-master-active (camera-master) :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (local-vars (v0-0 object) (v1-125 uint)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) + (rlet ((vf0 :class vf)) (init-vf0-vector) (case message (('dist-from-interp-src) @@ -905,23 +899,16 @@ ) ) (('point-of-interest) - (let ((v1-232 (the-as object (-> block param 0)))) - (let ((a0-103 *math-camera*)) - (set! v0-0 (-> a0-103 trans)) - (let ((a0-104 (-> a0-103 inv-camera-rot fvec))) - (let ((a1-36 (- (-> self interest-dist)))) - (.mov vf7 a1-36) - ) - (.lvf vf5 (&-> a0-104 quad)) + (let ((v1-232 (-> block param 0)) + (a0-103 *math-camera*) ) + (vector+*! + (-> a0-103 trans) + (the-as vector v1-232) + (-> a0-103 inv-camera-rot fvec) + (- (-> self interest-dist)) ) - (.lvf vf4 (&-> (the-as vector v1-232) 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 (&-> (the-as vector v0-0) quad) vf6) - v0-0 ) (('part-water-drip) (set-time! (-> self water-drip-time)) diff --git a/goal_src/jak3/engine/camera/cam-states-dbg.gc b/goal_src/jak3/engine/camera/cam-states-dbg.gc index c9253a2143..0751c3c91f 100644 --- a/goal_src/jak3/engine/camera/cam-states-dbg.gc +++ b/goal_src/jak3/engine/camera/cam-states-dbg.gc @@ -94,96 +94,59 @@ (define *CAM_FREE-bank* (new 'static 'cam-free-bank :speed 1600.0 :rot-speed (degrees 0.6))) (defun cam-mouse-input ((arg0 matrix) (arg1 vector) (arg2 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (vector-! v1-0 (-> *mouse* pos 0) (-> *mouse* pos 1)) + (if (< (-> *camera* interest-dist) 409.6) + (set! (-> *camera* interest-dist) 409.6) + ) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (let ((a0-9 (new 'stack-no-clear 'vector))) + 0.0 + (vector+*! a0-9 (-> *math-camera* trans) (-> arg0 fvec) (-> *camera* interest-dist)) + (vector-! s3-0 (-> *math-camera* trans) a0-9) + ) + (vector-length s3-0) + (cond + ((mouse-hold? left) + (let ((f30-0 (* 72.81778 (-> *mouse* speedy))) + (f28-0 (* -72.81778 (-> *mouse* speedx))) + ) + (let ((a2-8 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) (-> arg0 rvec) f30-0))) + (vector-orient-by-quat! s2-0 s3-0 a2-8) + ) + (let ((a2-10 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *y-vector* f28-0))) + (vector-orient-by-quat! s2-0 s2-0 a2-10) + ) + (vector-! s2-0 s2-0 s3-0) + (vector-matrix*! s2-0 s2-0 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) arg0)) + (+! (-> arg2 x) (-> s2-0 x)) + (+! (-> arg2 y) (-> s2-0 y)) + (+! (-> arg2 z) (-> s2-0 z)) + (+! (-> arg1 x) f30-0) + (set! (-> arg1 y) (+ (-> arg1 y) f28-0)) + ) ) - (init-vf0-vector) - (let ((v1-0 (new 'stack-no-clear 'vector))) - (vector-! v1-0 (-> *mouse* pos 0) (-> *mouse* pos 1)) - (if (< (-> *camera* interest-dist) 409.6) - (set! (-> *camera* interest-dist) 409.6) - ) - (let ((s3-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - ) - (let ((a0-9 (new 'stack-no-clear 'vector))) - 0.0 - (let ((a1-3 a0-9)) - (let ((a2-4 (-> *math-camera* trans))) - (let ((a3-0 (-> arg0 fvec))) - (let ((t0-1 (-> *camera* interest-dist))) - (.mov vf7 t0-1) - ) - (.lvf vf5 (&-> a3-0 quad)) - ) - (.lvf vf4 (&-> a2-4 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-3 quad) vf6) - ) - (vector-! s3-0 (-> *math-camera* trans) a0-9) - ) - (vector-length s3-0) - (cond - ((mouse-hold? left) - (let ((f30-0 (* 72.81778 (-> *mouse* speedy))) - (f28-0 (* -72.81778 (-> *mouse* speedx))) - ) - (let ((a2-8 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) (-> arg0 rvec) f30-0))) - (vector-orient-by-quat! s2-0 s3-0 a2-8) - ) - (let ((a2-10 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *y-vector* f28-0))) - (vector-orient-by-quat! s2-0 s2-0 a2-10) - ) - (vector-! s2-0 s2-0 s3-0) - (vector-matrix*! s2-0 s2-0 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) arg0)) - (+! (-> arg2 x) (-> s2-0 x)) - (+! (-> arg2 y) (-> s2-0 y)) - (+! (-> arg2 z) (-> s2-0 z)) - (+! (-> arg1 x) f30-0) - (set! (-> arg1 y) (+ (-> arg1 y) f28-0)) + ((mouse-hold? right) + (+! (-> arg2 z) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) + (set! (-> *camera* interest-dist) (- (-> *camera* interest-dist) (* (-> *CAM_FREE-bank* speed) (-> v1-0 x)))) + (if (< (-> *camera* interest-dist) 409.6) + (set! (-> *camera* interest-dist) 409.6) + ) + (when (< -8192.0 (vector-dot (-> arg0 fvec) s3-0)) + (let ((t0-1 (new 'static 'vector :w 1.0))) + (vector+*! t0-1 (-> *setting-control* cam-current mouse-tumble-point) (-> arg0 fvec) 8192.0) + (set-setting! 'mouse-tumble-point 'abs t0-1 0) ) ) - ((mouse-hold? right) - (+! (-> arg2 z) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) - (set! (-> *camera* interest-dist) (- (-> *camera* interest-dist) (* (-> *CAM_FREE-bank* speed) (-> v1-0 x)))) - (if (< (-> *camera* interest-dist) 409.6) - (set! (-> *camera* interest-dist) 409.6) - ) - (when (< -8192.0 (vector-dot (-> arg0 fvec) s3-0)) - (let ((t0-2 (new 'static 'vector :w 1.0))) - (let ((v1-18 t0-2)) - (let ((a0-33 (-> *setting-control* cam-current mouse-tumble-point))) - (let ((a1-12 (-> arg0 fvec))) - (let ((a2-13 8192.0)) - (.mov vf7 a2-13) - ) - (.lvf vf5 (&-> a1-12 quad)) - ) - (.lvf vf4 (&-> a0-33 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-18 quad) vf6) - ) - (set-setting! 'mouse-tumble-point 'abs t0-2 0) - ) - ) - ) - ((mouse-hold? middle) - (+! (-> arg2 x) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) - (+! (-> arg2 y) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed))) - (new 'static 'vector :w 1.0) - #f - ) - ) + ) + ((mouse-hold? middle) + (+! (-> arg2 x) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) + (+! (-> arg2 y) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed))) + (new 'static 'vector :w 1.0) + #f + ) ) ) ) diff --git a/goal_src/jak3/engine/collide/collide-cache.gc b/goal_src/jak3/engine/collide/collide-cache.gc index 4cf02eea83..07244352c2 100644 --- a/goal_src/jak3/engine/collide/collide-cache.gc +++ b/goal_src/jak3/engine/collide/collide-cache.gc @@ -629,130 +629,115 @@ (defmethod-mips2c "(method 10 collide-shape-prim-group)" 10 collide-shape-prim-group) (defmethod fill-from-fg-line-sphere ((this collide-cache) (arg0 collide-query)) - (local-vars (v1-9 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (-> arg0 collide-with))) - (set! *actor-list-length* 0) - (if (logtest? s4-0 (collide-spec hit-by-others-list)) - (set! *actor-list-length* (fill-actor-list-for-sphere - *actor-hash* - (-> arg0 start-pos) - (-> arg0 move-dist) - (-> arg0 radius) - *actor-list* - 256 - -1 - ) - ) - ) - (let ((f30-0 0.0) - (s3-0 (new 'stack-no-clear 'matrix)) - ) - (.lvf vf1 (&-> (-> arg0 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-9 vf1) - (let ((f0-1 v1-9)) - (if (< 0.0 f0-1) - (set! f30-0 (/ 1.0 f0-1)) + (let ((s4-0 (-> arg0 collide-with))) + (set! *actor-list-length* 0) + (if (logtest? s4-0 (collide-spec hit-by-others-list)) + (set! *actor-list-length* (fill-actor-list-for-sphere + *actor-hash* + (-> arg0 start-pos) + (-> arg0 move-dist) + (-> arg0 radius) + *actor-list* + 256 + -1 + ) ) + ) + (let ((f30-0 0.0) + (s3-0 (new 'stack-no-clear 'matrix)) ) - (when (logtest? s4-0 (collide-spec player-list)) - (let ((v1-17 (-> *collide-player-list* alive-list next0))) - *collide-player-list* - (let ((s2-0 (-> v1-17 next0))) - (while (!= v1-17 (-> *collide-player-list* alive-list-end)) - (let* ((s1-0 (-> (the-as connection v1-17) param1)) - (v1-18 (-> (the-as collide-shape s1-0) root-prim)) - ) - (when (logtest? s4-0 (-> v1-18 prim-core collide-as)) - (let ((s0-0 (-> v1-18 prim-core))) - (vector-! (-> s3-0 uvec) (-> s0-0 world-sphere) (-> arg0 start-pos)) - (let* ((f1-2 (* (vector-dot (-> arg0 move-dist) (-> s3-0 uvec)) f30-0)) - (f0-6 (fmax 0.0 (fmin 1.0 f1-2))) - ) - (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)) - ) + (let ((f0-1 (vector-length-squared (-> arg0 move-dist)))) + (if (< 0.0 f0-1) + (set! f30-0 (/ 1.0 f0-1)) + ) + ) + (when (logtest? s4-0 (collide-spec player-list)) + (let ((v1-17 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((s2-0 (-> v1-17 next0))) + (while (!= v1-17 (-> *collide-player-list* alive-list-end)) + (let* ((s1-0 (-> (the-as connection v1-17) param1)) + (v1-18 (-> (the-as collide-shape s1-0) root-prim)) + ) + (when (logtest? s4-0 (-> v1-18 prim-core collide-as)) + (let ((s0-0 (-> v1-18 prim-core))) + (vector-! (-> s3-0 uvec) (-> s0-0 world-sphere) (-> arg0 start-pos)) + (let* ((f1-2 (* (vector-dot (-> arg0 move-dist) (-> s3-0 uvec)) f30-0)) + (f0-6 (fmax 0.0 (fmin 1.0 f1-2))) + ) + (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)) ) ) ) ) ) - (set! v1-17 s2-0) - *collide-player-list* - (set! s2-0 (-> s2-0 next0)) - ) - ) - ) - ) - (when (logtest? s4-0 (collide-spec hit-by-player-list)) - (let ((v1-38 (-> *collide-hit-by-player-list* alive-list next0))) - *collide-hit-by-player-list* - (let ((s2-1 (-> v1-38 next0))) - (while (!= v1-38 (-> *collide-hit-by-player-list* alive-list-end)) - (let* ((s1-1 (-> (the-as connection v1-38) param1)) - (v1-39 (-> (the-as collide-shape s1-1) root-prim)) - ) - (when (logtest? s4-0 (-> v1-39 prim-core collide-as)) - (let ((s0-1 (-> v1-39 prim-core))) - (vector-! (-> s3-0 uvec) (-> s0-1 world-sphere) (-> arg0 start-pos)) - (let* ((f1-8 (* (vector-dot (-> arg0 move-dist) (-> s3-0 uvec)) f30-0)) - (f0-11 (fmax 0.0 (fmin 1.0 f1-8))) - ) - (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)) - ) - ) - ) - ) - ) - ) - (set! v1-38 s2-1) - *collide-hit-by-player-list* - (set! s2-1 (-> s2-1 next0)) ) + (set! v1-17 s2-0) + *collide-player-list* + (set! s2-0 (-> s2-0 next0)) ) ) ) ) - (dotimes (s3-1 *actor-list-length*) - (let ((v1-58 (-> *actor-list* s3-1))) - (when (logtest? s4-0 (-> v1-58 root-prim prim-core collide-as)) - (let ((a0-37 (-> v1-58 process))) - (if (not (or (= a0-37 (-> this ignore-processes 0)) (= a0-37 (-> this ignore-processes 1)))) - (add-fg-prim-using-line-sphere (-> v1-58 root-prim) this arg0) + (when (logtest? s4-0 (collide-spec hit-by-player-list)) + (let ((v1-38 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((s2-1 (-> v1-38 next0))) + (while (!= v1-38 (-> *collide-hit-by-player-list* alive-list-end)) + (let* ((s1-1 (-> (the-as connection v1-38) param1)) + (v1-39 (-> (the-as collide-shape s1-1) root-prim)) + ) + (when (logtest? s4-0 (-> v1-39 prim-core collide-as)) + (let ((s0-1 (-> v1-39 prim-core))) + (vector-! (-> s3-0 uvec) (-> s0-1 world-sphere) (-> arg0 start-pos)) + (let* ((f1-8 (* (vector-dot (-> arg0 move-dist) (-> s3-0 uvec)) f30-0)) + (f0-11 (fmax 0.0 (fmin 1.0 f1-8))) + ) + (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)) + ) + ) + ) + ) ) + ) + (set! v1-38 s2-1) + *collide-hit-by-player-list* + (set! s2-1 (-> s2-1 next0)) ) ) ) ) ) - 0 - (none) + (dotimes (s3-1 *actor-list-length*) + (let ((v1-58 (-> *actor-list* s3-1))) + (when (logtest? s4-0 (-> v1-58 root-prim prim-core collide-as)) + (let ((a0-37 (-> v1-58 process))) + (if (not (or (= a0-37 (-> this ignore-processes 0)) (= a0-37 (-> this ignore-processes 1)))) + (add-fg-prim-using-line-sphere (-> v1-58 root-prim) this arg0) + ) + ) + ) + ) + ) ) + 0 + (none) ) ;; WARN: Return type mismatch object vs none. diff --git a/goal_src/jak3/engine/collide/collide-edge-grab.gc b/goal_src/jak3/engine/collide/collide-edge-grab.gc index 511f221c60..95296bc5f2 100644 --- a/goal_src/jak3/engine/collide/collide-edge-grab.gc +++ b/goal_src/jak3/engine/collide/collide-edge-grab.gc @@ -146,21 +146,7 @@ (s4-0 (-> s1-0 prim-index)) ) (let ((s0-0 (new 'stack-no-clear 'vector))) - (let ((a1-1 s0-0)) - (let ((v1-1 (-> arg0 center-pt))) - (let ((a0-1 (-> s2-0 edge-vec-norm))) - (let ((a2-2 1105.92)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-1 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-1 quad) vf6) - ) + (vector+*! s0-0 (-> arg0 center-pt) (-> s2-0 edge-vec-norm) 1105.92) (let ((f0-1 (get-best-hand-point this (-> arg1 right-hand-hold) s0-0 (the-as int s4-0)))) (if (< 491.52 f0-1) (return (the-as symbol #f)) @@ -212,8 +198,8 @@ (-> this spec local-player-spheres) 12 ) - (let ((a1-12 (new 'stack-no-clear 'collide-query))) - (let ((v1-28 a1-12)) + (let ((a1-13 (new 'stack-no-clear 'collide-query))) + (let ((v1-28 a1-13)) (set! (-> v1-28 best-dist) (the-as float (-> this world-player-spheres))) (set! (-> v1-28 best-other-prim) (the-as collide-shape-prim 12)) (set! (-> v1-28 collide-with) (-> this cshape root-prim prim-core collide-with)) @@ -225,7 +211,7 @@ (set! (-> v1-28 best-my-prim) (the-as collide-shape-prim #t)) (set! (-> v1-28 action-mask) (collide-action solid)) ) - (if (probe-using-spheres (-> this ccache) a1-12) + (if (probe-using-spheres (-> this ccache) a1-13) (return (the-as symbol #f)) ) ) @@ -240,12 +226,12 @@ (a0-44 (set! (-> arg1 actor-cshape-prim-offset) (- (the-as int v1-41) (the-as uint (the-as int (-> a0-44 process))))) (set! (-> arg1 actor-handle) (process->handle (-> a0-44 process))) - (let ((a1-19 + (let ((a1-20 (-> a0-44 process node-list data (-> (the-as collide-shape-prim v1-41) transform-index) bone transform) ) (s5-1 (new 'stack-no-clear 'matrix)) ) - (matrix-4x4-inverse! s5-1 a1-19) + (matrix-4x4-inverse! s5-1 a1-20) (dotimes (s4-1 8) (vector-matrix*! (-> arg1 local-vertex s4-1) (-> arg1 world-vertex s4-1) s5-1) ) diff --git a/goal_src/jak3/engine/collide/collide-shape.gc b/goal_src/jak3/engine/collide/collide-shape.gc index 7857bcd73a..53e6684095 100644 --- a/goal_src/jak3/engine/collide/collide-shape.gc +++ b/goal_src/jak3/engine/collide/collide-shape.gc @@ -316,17 +316,8 @@ ) ) (v1-11 (vector-cross! (new 'stack-no-clear 'vector) s3-0 a0-8)) - (a0-9 (-> arg1 best-other-tri vertex 2)) ) - (let ((a1-7 4096.0)) - (.mov vf7 a1-7) - ) - (.lvf vf5 (&-> v1-11 quad)) - (.lvf vf4 (&-> s4-1 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) + (vector+*! (-> arg1 best-other-tri vertex 2) s4-1 v1-11 4096.0) ) ) (b! #t cfg-9 :delay (nop!)) @@ -352,7 +343,7 @@ (vector+! s3-2 s3-2 (-> this prim-core world-sphere)) (set! (-> arg1 best-other-tri vertex 0 quad) (-> s3-2 quad)) (point-in-plane-<-point+normal! (-> arg1 best-other-tri vertex 1) s3-2 s4-2) - (let* ((a0-23 (vector-normalize! + (let* ((a0-24 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri vertex 1) @@ -361,18 +352,9 @@ 1.0 ) ) - (v1-23 (vector-cross! (new 'stack-no-clear 'vector) s4-2 a0-23)) - (a0-24 (-> arg1 best-other-tri vertex 2)) + (v1-23 (vector-cross! (new 'stack-no-clear 'vector) s4-2 a0-24)) ) - (let ((a1-18 4096.0)) - (.mov vf7 a1-18) - ) - (.lvf vf5 (&-> v1-23 quad)) - (.lvf vf4 (&-> s3-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 (&-> a0-24 quad) vf6) + (vector+*! (-> arg1 best-other-tri vertex 2) s3-2 v1-23 4096.0) ) ) ) diff --git a/goal_src/jak3/engine/common-obs/debris.gc b/goal_src/jak3/engine/common-obs/debris.gc index 65409a8805..c1655d75d6 100644 --- a/goal_src/jak3/engine/common-obs/debris.gc +++ b/goal_src/jak3/engine/common-obs/debris.gc @@ -153,126 +153,103 @@ (sv-80 (function sound-name sound-id int int int sound-group object sound-id :behavior process-drawable)) (name sound-name) ) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((debris-box (-> this boxes idx)) + (box-num (-> debris-box num)) + (box-start (-> debris-box start)) + (bbox (-> debris-box bbox)) ) - (init-vf0-vector) - (let* ((debris-box (-> this boxes idx)) - (box-num (-> debris-box num)) - (box-start (-> debris-box start)) - (bbox (-> debris-box bbox)) - ) - (when (> box-num 0) - (let ((cquery (new 'static 'collide-query))) - (let ((debris-start (-> this debris box-start))) - (let ((a3-0 (-> cquery bbox)) - (a1-2 (-> bbox min)) - (a2-0 (new 'stack-no-clear 'vector)) - ) - (set! (-> a2-0 x) 4096.0) - (set! (-> a2-0 y) 4096.0) - (set! (-> a2-0 z) 4096.0) - (set! (-> a2-0 w) 1.0) - (vector-! (-> a3-0 min) a1-2 a2-0) - ) - (let ((a1-3 (-> cquery bbox max)) - (a0-2 (-> bbox max)) - (a2-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> a2-1 x) 4096.0) - (set! (-> a2-1 y) 4096.0) - (set! (-> a2-1 z) 4096.0) - (set! (-> a2-1 w) 1.0) - (vector+! a1-3 a0-2 a2-1) - ) - (set! (-> cquery collide-with) (-> debris-start params collide-spec)) - ) - (set! (-> cquery ignore-process0) #f) - (set! (-> cquery ignore-process1) #f) - (set! (-> cquery ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (when (> box-num 0) + (let ((cquery (new 'static 'collide-query))) + (let ((debris-start (-> this debris box-start))) + (let ((a3-0 (-> cquery bbox)) + (a1-2 (-> bbox min)) + (a2-0 (new 'stack-no-clear 'vector)) ) - (set! (-> cquery action-mask) (collide-action solid)) - (fill-using-bounding-box *collide-cache* cquery) - (dotimes (s2-0 (the-as int box-num)) - (let ((s1-0 (-> this debris (+ s2-0 box-start)))) - (when (not (logtest? (-> this debris (+ s2-0 box-start) draw status) (draw-control-status no-draw))) - (let ((f0-9 (* (-> s1-0 gravity) (seconds-per-frame))) - (s0-0 (new 'stack-no-clear 'quaternion)) - ) - (vector-copy! (-> s1-0 prev-pos) (-> s1-0 root trans)) - (+! (-> s1-0 transv y) f0-9) - (vector-v+! (-> s1-0 root trans) (-> s1-0 root trans) (-> s1-0 transv)) - (quaternion-vector-angle! s0-0 (-> s1-0 rot-axis) (* (-> s1-0 rot-angle) (seconds-per-frame))) - (quaternion*! (-> s1-0 root quat) (-> s1-0 root quat) s0-0) - ) - (quaternion-normalize! (-> s1-0 root quat)) - (set! (-> s1-0 rot-angle) (- (-> s1-0 rot-angle) (* (seconds-per-frame) (-> s1-0 rot-angle)))) - (when (nonzero? (-> s1-0 params collide-spec)) - (let ((s0-1 (new 'stack-no-clear 'vector))) - (vector-! (-> cquery move-dist) (-> s1-0 root trans) (-> s1-0 prev-pos)) - (vector-copy! (-> cquery start-pos) (-> s1-0 prev-pos)) - (let ((v1-34 cquery)) - (set! (-> v1-34 radius) 2048.0) - (set! (-> v1-34 collide-with) (-> s1-0 params collide-spec)) - (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)) - ) - (let ((f0-16 (probe-using-line-sphere *collide-cache* cquery))) - (when (>= f0-16 0.0) - (let ((a1-12 s0-1)) - (let ((v1-37 (-> cquery start-pos))) - (let ((a0-21 (-> cquery move-dist))) - (let ((a2-5 f0-16)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-21 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-12 quad) vf6) + (set! (-> a2-0 x) 4096.0) + (set! (-> a2-0 y) 4096.0) + (set! (-> a2-0 z) 4096.0) + (set! (-> a2-0 w) 1.0) + (vector-! (-> a3-0 min) a1-2 a2-0) + ) + (let ((a1-3 (-> cquery bbox max)) + (a0-2 (-> bbox max)) + (a2-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a2-1 x) 4096.0) + (set! (-> a2-1 y) 4096.0) + (set! (-> a2-1 z) 4096.0) + (set! (-> a2-1 w) 1.0) + (vector+! a1-3 a0-2 a2-1) + ) + (set! (-> cquery collide-with) (-> debris-start params collide-spec)) + ) + (set! (-> cquery ignore-process0) #f) + (set! (-> cquery ignore-process1) #f) + (set! (-> cquery ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> cquery action-mask) (collide-action solid)) + (fill-using-bounding-box *collide-cache* cquery) + (dotimes (s2-0 (the-as int box-num)) + (let ((s1-0 (-> this debris (+ s2-0 box-start)))) + (when (not (logtest? (-> this debris (+ s2-0 box-start) draw status) (draw-control-status no-draw))) + (let ((f0-9 (* (-> s1-0 gravity) (seconds-per-frame))) + (s0-0 (new 'stack-no-clear 'quaternion)) + ) + (vector-copy! (-> s1-0 prev-pos) (-> s1-0 root trans)) + (+! (-> s1-0 transv y) f0-9) + (vector-v+! (-> s1-0 root trans) (-> s1-0 root trans) (-> s1-0 transv)) + (quaternion-vector-angle! s0-0 (-> s1-0 rot-axis) (* (-> s1-0 rot-angle) (seconds-per-frame))) + (quaternion*! (-> s1-0 root quat) (-> s1-0 root quat) s0-0) + ) + (quaternion-normalize! (-> s1-0 root quat)) + (set! (-> s1-0 rot-angle) (- (-> s1-0 rot-angle) (* (seconds-per-frame) (-> s1-0 rot-angle)))) + (when (nonzero? (-> s1-0 params collide-spec)) + (let ((s0-1 (new 'stack-no-clear 'vector))) + (vector-! (-> cquery move-dist) (-> s1-0 root trans) (-> s1-0 prev-pos)) + (vector-copy! (-> cquery start-pos) (-> s1-0 prev-pos)) + (let ((v1-34 cquery)) + (set! (-> v1-34 radius) 2048.0) + (set! (-> v1-34 collide-with) (-> s1-0 params collide-spec)) + (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) ) - (let* ((v1-38 (-> s1-0 transv)) - (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 ((id (new-sound-id)) - (a2-6 1024) - (a3-6 0) - (t0-4 0) - (t1-0 0) - (t2-0 (-> s1-0 root)) - ) - (sv-80 name id a2-6 a3-6 t0-4 (the-as sound-group t1-0) t2-0) - ) + (set! (-> v1-34 action-mask) (collide-action solid)) + ) + (let ((f0-16 (probe-using-line-sphere *collide-cache* cquery))) + (when (>= f0-16 0.0) + (vector+*! s0-1 (-> cquery start-pos) (-> cquery move-dist) f0-16) + (let* ((v1-38 (-> s1-0 transv)) + (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) ) - (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) - ) - (let ((f28-1 (-> s1-0 transv y))) - (vector-xz-normalize! (-> s1-0 transv) (* f30-0 (-> s1-0 hit-xz-reaction))) - (set! (-> s1-0 transv y) (* f28-1 (-> s1-0 hit-y-reaction))) ) + (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) + ) + (let ((f28-1 (-> s1-0 transv y))) + (vector-xz-normalize! (-> s1-0 transv) (* f30-0 (-> s1-0 hit-xz-reaction))) + (set! (-> s1-0 transv y) (* f28-1 (-> s1-0 hit-y-reaction))) ) - (+! (-> s0-1 y) (* 40.96 (-> cquery best-other-tri normal y))) - (set! (-> s0-1 w) 1.0) - (set! (-> s1-0 root trans quad) (-> s0-1 quad)) ) + (+! (-> s0-1 y) (* 40.96 (-> cquery best-other-tri normal y))) + (set! (-> s0-1 w) 1.0) + (set! (-> s1-0 root trans quad) (-> s0-1 quad)) ) ) ) @@ -282,9 +259,9 @@ ) ) ) - 0 - (none) ) + 0 + (none) ) (defstate idle (debris-group) diff --git a/goal_src/jak3/engine/common-obs/guard-projectile.gc b/goal_src/jak3/engine/common-obs/guard-projectile.gc index 3af3ceba57..fe4d84a49c 100644 --- a/goal_src/jak3/engine/common-obs/guard-projectile.gc +++ b/goal_src/jak3/engine/common-obs/guard-projectile.gc @@ -335,59 +335,37 @@ ) (defmethod projectile-method-25 ((this guard-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 850 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 850 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 850) a1-0 s5-1 #f) - (set! (-> *part-id-table* 850 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 851) s4-0) - (launch-particles (-> *part-id-table* 852) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f26-0 (/ f30-0 (meters 9))) - (f30-1 (-> *part-id-table* 853 init-specs 3 initial-valuef)) - (f28-1 (-> *part-id-table* 853 init-specs 4 initial-valuef)) - ) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 853 init-specs 3 initial-valuef) (* f26-0 f30-1)) - (set! (-> *part-id-table* 853 init-specs 4 initial-valuef) (* f26-0 f28-1)) - (launch-particles (-> *part-id-table* 853) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 853 init-specs 3 initial-valuef) f30-1) - (set! (-> *part-id-table* 853 init-specs 4 initial-valuef) f28-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 850 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 850 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 850) a1-0 s5-1 #f) + (set! (-> *part-id-table* 850 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 851) s4-1) + (launch-particles (-> *part-id-table* 852) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f26-0 (/ f30-0 (meters 9))) + (f30-1 (-> *part-id-table* 853 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 853 init-specs 4 initial-valuef)) + ) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 853 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 853 init-specs 4 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 853) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 853 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 853 init-specs 4 initial-valuef) f28-1) ) - 0 - (none) ) + 0 + (none) ) (defmethod projectile-method-26 ((this guard-shot)) diff --git a/goal_src/jak3/engine/common-obs/metalhead-projectile.gc b/goal_src/jak3/engine/common-obs/metalhead-projectile.gc index 169353d336..44b3b6ca50 100644 --- a/goal_src/jak3/engine/common-obs/metalhead-projectile.gc +++ b/goal_src/jak3/engine/common-obs/metalhead-projectile.gc @@ -331,58 +331,36 @@ ) (defmethod projectile-method-25 ((this metalhead-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 863 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 863 init-specs 4 initial-valuef) (fmin f28-0 (vector-length s5-1))) - (draw-beam (-> *part-id-table* 863) a1-0 s5-1 #f) - (set! (-> *part-id-table* 863 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 864) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f26-0 (/ f30-0 (meters 12))) - (f30-1 (-> *part-id-table* 865 init-specs 3 initial-valuef)) - (f28-1 (-> *part-id-table* 865 init-specs 5 initial-valuef)) - ) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 865 init-specs 3 initial-valuef) (* f26-0 f30-1)) - (set! (-> *part-id-table* 865 init-specs 5 initial-valuef) (* f26-0 f28-1)) - (launch-particles (-> *part-id-table* 865) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 865 init-specs 3 initial-valuef) f30-1) - (set! (-> *part-id-table* 865 init-specs 5 initial-valuef) f28-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 863 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 863 init-specs 4 initial-valuef) (fmin f28-0 (vector-length s5-1))) + (draw-beam (-> *part-id-table* 863) a1-0 s5-1 #f) + (set! (-> *part-id-table* 863 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 864) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f26-0 (/ f30-0 (meters 12))) + (f30-1 (-> *part-id-table* 865 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 865 init-specs 5 initial-valuef)) + ) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 865 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 865 init-specs 5 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 865) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 865 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 865 init-specs 5 initial-valuef) f28-1) ) - 0 - (none) ) + 0 + (none) ) (defmethod projectile-method-26 ((this metalhead-shot)) diff --git a/goal_src/jak3/engine/common-obs/voicebox.gc b/goal_src/jak3/engine/common-obs/voicebox.gc index b7743b61eb..27826228e9 100644 --- a/goal_src/jak3/engine/common-obs/voicebox.gc +++ b/goal_src/jak3/engine/common-obs/voicebox.gc @@ -99,52 +99,32 @@ (defmethod post-common ((this remote)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (ja-post) - (if (type? (-> this root) collide-shape) - (update-transforms (the-as collide-shape (-> this root))) - ) - (when (and (nonzero? (-> this part)) (and (or (and (-> this next-state) (= (-> this next-state name) 'idle)) - (and (-> this next-state) (= (-> this next-state name) 'enter)) - ) - (-> this speak-effect?) - ) - ) - (let ((v1-15 - (vector-float*! (new 'stack-no-clear 'vector) (-> this parent 0 velocity) (-> pp clock frames-per-second)) - ) - (a0-8 *particle-vel*) - ) - (let ((a1-4 (-> this node-list data 3 bone transform fvec))) - (let ((a2-1 20480.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-4 quad)) - ) - (.lvf vf4 (&-> v1-15 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-8 quad) vf6) - ) - (let ((v1-16 *particle-vel*) - (a0-9 *particle-vel*) - (f0-2 300.0) - ) - (vector-float*! v1-16 a0-9 (/ 1.0 f0-2)) - ) - (spawn-from-cspace (-> this part) (-> this node-list data 3)) + (ja-post) + (if (type? (-> this root) collide-shape) + (update-transforms (the-as collide-shape (-> this root))) ) - 0 - (none) + (when (and (nonzero? (-> this part)) (and (or (and (-> this next-state) (= (-> this next-state name) 'idle)) + (and (-> this next-state) (= (-> this next-state name) 'enter)) + ) + (-> this speak-effect?) + ) + ) + (let ((v1-15 + (vector-float*! (new 'stack-no-clear 'vector) (-> this parent 0 velocity) (-> pp clock frames-per-second)) + ) + ) + (vector+*! *particle-vel* v1-15 (-> this node-list data 3 bone transform fvec) 20480.0) + ) + (let ((v1-16 *particle-vel*) + (a0-10 *particle-vel*) + (f0-2 300.0) + ) + (vector-float*! v1-16 a0-10 (/ 1.0 f0-2)) + ) + (spawn-from-cspace (-> this part) (-> this node-list data 3)) ) + 0 + (none) ) ) diff --git a/goal_src/jak3/engine/common-obs/water-flow.gc b/goal_src/jak3/engine/common-obs/water-flow.gc index 93b3c427f3..b4e8fa9e6a 100644 --- a/goal_src/jak3/engine/common-obs/water-flow.gc +++ b/goal_src/jak3/engine/common-obs/water-flow.gc @@ -76,225 +76,155 @@ (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)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 arg1) - (set! (-> s5-0 w) 1.0) - (when (>= (vector4-dot s5-0 (the-as vector (-> this leading))) 0.0) - (let* ((s1-0 (-> this sections)) - (s2-0 (-> s1-0 length)) - (a3-0 (the-as object (-> this leading))) - ) - (dotimes (s4-0 s2-0) - (let ((s3-0 (-> s1-0 data s4-0))) - (when (< (vector4-dot s5-0 (the-as vector (-> s3-0 trailing))) 0.0) - (let ((v1-10 (new 'stack-no-clear 'vector))) - (vector-! v1-10 s5-0 (-> s3-0 start)) - (when (>= (-> this belt-radius) (fabs (vector-dot v1-10 (-> s3-0 radial-dir)))) - (let* ((f0-7 (vector-dot v1-10 (-> s3-0 pull-dir))) - (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)) - ) - (let ((a1-6 (new 'stack-no-clear 'vector))) - (let ((v1-16 (-> s3-0 start))) - (let ((a0-13 (-> s3-0 pull-dir))) - (let ((a2-6 12288.0)) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-13 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 (&-> a1-6 quad) vf6) - ) - 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 ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 arg1) + (set! (-> s5-0 w) 1.0) + (when (>= (vector4-dot s5-0 (the-as vector (-> this leading))) 0.0) + (let* ((s1-0 (-> this sections)) + (s2-0 (-> s1-0 length)) + (a3-0 (the-as object (-> this leading))) + ) + (dotimes (s4-0 s2-0) + (let ((s3-0 (-> s1-0 data s4-0))) + (when (< (vector4-dot s5-0 (the-as vector (-> s3-0 trailing))) 0.0) + (let ((v1-10 (new 'stack-no-clear 'vector))) + (vector-! v1-10 s5-0 (-> s3-0 start)) + (when (>= (-> this belt-radius) (fabs (vector-dot v1-10 (-> s3-0 radial-dir)))) + (let* ((f0-7 (vector-dot v1-10 (-> s3-0 pull-dir))) + (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 ((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) - ) - (let ((a1-10 (new 'stack-no-clear 'vector))) - (let ((a0-17 s5-0)) - (let ((a2-9 2048.0)) - (.mov vf7 a2-9) - ) - (.lvf vf5 (&-> v1-22 quad)) - (.lvf vf4 (&-> a0-17 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-10 quad) vf6) - ) - ) - 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 ((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)) - ) - ) - (if (< (-> arg0 normal y) 0.0) - (vector-negate! (-> arg0 normal) (-> arg0 normal)) - ) - 0 - (return #t) ) + (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 ((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)) + ) + ) + (if (< (-> arg0 normal y) 0.0) + (vector-negate! (-> arg0 normal) (-> arg0 normal)) + ) + 0 + (return #t) ) ) ) ) ) - (set! a3-0 (+ (the-as uint (-> s1-0 data 0 trailing)) (* 80 s4-0))) ) + (set! a3-0 (+ (the-as uint (-> s1-0 data 0 trailing)) (* 80 s4-0))) ) ) ) - (return #f) - v0-7 ) + (return #f) + v0-7 ) ;; WARN: Function (method 11 flow-control) has a return type of none, but the expression builder found a return statement. (defmethod push-process ((this flow-control) (arg0 process-focusable)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 (get-trans arg0 0)) - (set! (-> s5-0 w) 1.0) - (when (>= (vector4-dot s5-0 (the-as vector (-> this leading))) 0.0) - (let* ((v1-7 (-> this sections)) - (a0-3 (-> v1-7 length)) - (a3-0 (the-as object (-> this leading))) - ) - (dotimes (s3-1 a0-3) - (let ((s2-0 (-> v1-7 data s3-1))) - (when (< (vector4-dot s5-0 (the-as vector (-> s2-0 trailing))) 0.0) - (let ((v1-8 (new 'stack-no-clear 'vector))) - (vector-! v1-8 s5-0 (-> s2-0 start)) - (when (>= (-> this belt-radius) (fabs (vector-dot v1-8 (-> s2-0 radial-dir)))) - (let* ((f0-7 (vector-dot v1-8 (-> s2-0 pull-dir))) - (f0-9 (- (-> v1-8 y) (* (-> s2-0 pull-dir y) f0-7))) - ) - (when (and (>= f0-9 -41984.0) (>= 41779.2 f0-9)) - (let* ((a0-11 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - (f30-0 (ray-plane-equation-intersect a0-11 s5-0 (-> s2-0 pull-dir) (the-as vector a3-0))) - (f0-10 (ray-plane-equation-intersect s1-0 s5-0 (-> s2-0 pull-dir) (-> s2-0 trailing))) - ) - (let ((a1-13 (new 'stack-no-clear 'vector))) - (let ((v1-13 (-> s2-0 start))) - (let ((a0-13 (-> s2-0 pull-dir))) - (let ((a2-6 12288.0)) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-13 quad)) - ) - (.lvf vf4 (&-> v1-13 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-13 quad) vf6) - ) - 0 - (let ((f0-12 (/ f30-0 (- f30-0 f0-10))) - (s1-1 (new 'stack-no-clear 'vector)) - ) - (displacement-between-two-points-normalized! (-> this path) s1-1 (+ (the float s3-1) f0-12)) - (let ((v1-17 (new 'stack-no-clear 'vector))) - (vector-float*! v1-17 s1-1 (* (-> s2-0 speed) (seconds-per-frame))) - (let ((a1-16 (new 'stack-no-clear 'vector))) - (let ((a0-17 v1-17)) - (let ((a2-9 2048.0)) - (.mov vf7 a2-9) - ) - (.lvf vf5 (&-> a0-17 quad)) - ) - (.lvf vf4 (&-> s5-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 (&-> a1-16 quad) vf6) - ) - 0 - (send-event arg0 'push-trans v1-17 (seconds 10)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 (get-trans arg0 0)) + (set! (-> s5-0 w) 1.0) + (when (>= (vector4-dot s5-0 (the-as vector (-> this leading))) 0.0) + (let* ((v1-7 (-> this sections)) + (a0-3 (-> v1-7 length)) + (a3-0 (the-as object (-> this leading))) + ) + (dotimes (s3-1 a0-3) + (let ((s2-0 (-> v1-7 data s3-1))) + (when (< (vector4-dot s5-0 (the-as vector (-> s2-0 trailing))) 0.0) + (let ((v1-8 (new 'stack-no-clear 'vector))) + (vector-! v1-8 s5-0 (-> s2-0 start)) + (when (>= (-> this belt-radius) (fabs (vector-dot v1-8 (-> s2-0 radial-dir)))) + (let* ((f0-7 (vector-dot v1-8 (-> s2-0 pull-dir))) + (f0-9 (- (-> v1-8 y) (* (-> s2-0 pull-dir y) f0-7))) + ) + (when (and (>= f0-9 -41984.0) (>= 41779.2 f0-9)) + (let* ((a0-11 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + (f30-0 (ray-plane-equation-intersect a0-11 s5-0 (-> s2-0 pull-dir) (the-as vector a3-0))) + (f0-10 (ray-plane-equation-intersect s1-0 s5-0 (-> s2-0 pull-dir) (-> s2-0 trailing))) + ) + (vector+*! (new 'stack-no-clear 'vector) (-> s2-0 start) (-> s2-0 pull-dir) 12288.0) + 0 + (let ((f0-12 (/ f30-0 (- f30-0 f0-10))) + (s1-1 (new 'stack-no-clear 'vector)) ) + (displacement-between-two-points-normalized! (-> this path) s1-1 (+ (the float s3-1) f0-12)) + (let ((v1-17 (new 'stack-no-clear 'vector))) + (vector-float*! v1-17 s1-1 (* (-> s2-0 speed) (seconds-per-frame))) + (vector+*! (new 'stack-no-clear 'vector) s5-0 v1-17 2048.0) + 0 + (send-event arg0 'push-trans v1-17 (seconds 10)) ) ) ) ) ) ) - (return #f) ) + (return #f) ) - (set! a3-0 (+ (the-as uint (-> v1-7 data 0 trailing)) (* 80 s3-1))) ) + (set! a3-0 (+ (the-as uint (-> v1-7 data 0 trailing)) (* 80 s3-1))) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod find-and-push-things ((this flow-control)) diff --git a/goal_src/jak3/engine/debug/debug.gc b/goal_src/jak3/engine/debug/debug.gc index 494fa52d65..0f26768d27 100644 --- a/goal_src/jak3/engine/debug/debug.gc +++ b/goal_src/jak3/engine/debug/debug.gc @@ -1350,56 +1350,35 @@ ) (defun-debug add-debug-light ((arg0 symbol) (arg1 bucket-id) (arg2 light) (arg3 vector) (arg4 string)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (if (not (or arg0 *display-capture-mode*)) - (return #f) - ) - (when (!= (-> arg2 extra x) 0.0) - (add-debug-vector - arg0 - arg1 - arg3 - (-> arg2 direction) - (meters 3) - (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) - ) - (let ((s2-0 (new-stack-vector0))) - (let ((v1-4 (-> arg2 direction))) - (let ((a0-3 (* 12288.0 (-> arg2 extra x)))) - (.mov vf7 a0-3) - ) - (.lvf vf5 (&-> v1-4 quad)) - ) - (.lvf vf4 (&-> arg3 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 (&-> s2-0 quad) vf6) - (let ((s1-1 (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 extra x)) - (let ((t0-2 *temp-string*)) - (add-debug-text-sphere arg0 arg1 s2-0 (* 2048.0 (-> arg2 extra x)) t0-2 (the-as rgba s1-1)) - ) + (if (not (or arg0 *display-capture-mode*)) + (return #f) + ) + (when (!= (-> arg2 extra x) 0.0) + (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 extra x)))) + (s1-1 (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 extra x)) + (let ((t0-2 *temp-string*)) + (add-debug-text-sphere arg0 arg1 s2-1 (* 2048.0 (-> arg2 extra x)) t0-2 (the-as rgba s1-1)) ) ) - #f ) + #f ) (defun-debug add-debug-lights ((arg0 symbol) (arg1 bucket-id) (arg2 (inline-array light)) (arg3 vector)) diff --git a/goal_src/jak3/engine/debug/manipulator.gc b/goal_src/jak3/engine/debug/manipulator.gc index 806d30e190..65648cf007 100644 --- a/goal_src/jak3/engine/debug/manipulator.gc +++ b/goal_src/jak3/engine/debug/manipulator.gc @@ -92,30 +92,17 @@ ) (vector-cross! s1-0 s1-0 arg1) (vector-normalize! s1-0 1.0) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (let ((v1-10 arg0)) - (let ((a0-8 arg1)) - (let ((a1-10 arg2)) - (.mov vf7 a1-10) - ) - (.lvf vf5 (&-> a0-8 quad)) - ) - (.lvf vf4 (&-> v1-10 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 (&-> s0-0 quad) vf6) + (let ((s0-1 (vector+*! (new 'stack-no-clear 'vector) arg0 arg1 arg2))) (set! 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-0)) + (let ((v1-16 s0-1)) (let ((a0-9 arg1)) - (let ((a1-11 arg3)) - (.mov vf7 a1-11) + (let ((a1-10 arg3)) + (.mov vf7 a1-10) ) (.lvf vf5 (&-> a0-9 quad)) ) @@ -126,7 +113,7 @@ (.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-0) + (set! sv-240 s0-1) (let* ((a2-3 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) arg1 (* 182.04445 (the float (* 45 sv-160)))) ) @@ -143,7 +130,7 @@ (.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-0) + (set! sv-272 s0-1) (let* ((a2-7 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) arg1 @@ -184,277 +171,161 @@ (defmethod manipulator-method-11 ((this manipulator)) (local-vars (sv-240 rgba) (sv-256 vector) (sv-272 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (format *stdcon* "~M ~M ~M~%" (-> this position x) (-> this position y) (-> this position z)) - (let ((s5-0 (-> this position))) - 0.0 - (let* ((v0-1 - (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> *math-camera* trans) (-> this position)) 1.0) - ) - (s4-0 (< (fabs (vector-dot v0-1 (-> this mat rvec))) 0.9)) - (s3-0 (< (fabs (vector-dot v0-1 (-> this mat uvec))) 0.9)) - (s2-0 (< (fabs (vector-dot v0-1 (-> this mat fvec))) 0.9)) - (f30-1 (* 0.15 (vector-vector-distance (-> *math-camera* trans) s5-0))) + (format *stdcon* "~M ~M ~M~%" (-> this position x) (-> this position y) (-> this position z)) + (let ((s5-0 (-> this position))) + 0.0 + (let* ((v0-1 + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> *math-camera* trans) (-> this position)) 1.0) ) - (if s4-0 - (draw-axis s5-0 (-> this mat rvec) f30-1 (/ f30-1 4) (if (= (-> this action) (manipulator-action ma1)) - *color-yellow* - *color-red* - ) - ) + (s4-0 (< (fabs (vector-dot v0-1 (-> this mat rvec))) 0.9)) + (s3-0 (< (fabs (vector-dot v0-1 (-> this mat uvec))) 0.9)) + (s2-0 (< (fabs (vector-dot v0-1 (-> this mat fvec))) 0.9)) + (f30-1 (* 0.15 (vector-vector-distance (-> *math-camera* trans) s5-0))) + ) + (if s4-0 + (draw-axis s5-0 (-> this mat rvec) f30-1 (/ f30-1 4) (if (= (-> this action) (manipulator-action ma1)) + *color-yellow* + *color-red* + ) + ) + ) + (if s3-0 + (draw-axis s5-0 (-> this mat uvec) f30-1 (/ f30-1 4) (if (= (-> this action) (manipulator-action ma2)) + *color-yellow* + *color-green* + ) + ) + ) + (if s2-0 + (draw-axis s5-0 (-> this mat fvec) f30-1 (/ f30-1 4) (if (= (-> this action) (manipulator-action ma3)) + *color-yellow* + *color-blue* + ) + ) + ) + (let ((s1-0 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) ) - (if s3-0 - (draw-axis s5-0 (-> this mat uvec) f30-1 (/ f30-1 4) (if (= (-> this action) (manipulator-action ma2)) - *color-yellow* - *color-green* - ) - ) - ) - (if s2-0 - (draw-axis s5-0 (-> this mat fvec) f30-1 (/ f30-1 4) (if (= (-> this action) (manipulator-action ma3)) - *color-yellow* - *color-blue* - ) - ) - ) - (let ((s1-0 (new 'stack-no-clear 'vector)) - (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*) ) - (let ((f28-0 0.1)) - (if (= (-> this action) (manipulator-action ma7)) - (set! sv-240 *color-yellow*) - (set! sv-240 *color-light-blue*) - ) - (let ((a1-7 s1-0)) - (let ((v1-26 s5-0)) - (let ((a0-13 (vector+! - (new 'stack-no-clear 'vector) - (-> *math-camera* inv-camera-rot rvec) - (-> *math-camera* inv-camera-rot uvec) - ) + (vector+*! + s1-0 + s5-0 + (vector+! + (new 'stack-no-clear 'vector) + (-> *math-camera* inv-camera-rot rvec) + (-> *math-camera* inv-camera-rot uvec) + ) + (* f30-1 f28-0) + ) + (vector+*! s0-0 s1-0 (-> *math-camera* inv-camera-rot uvec) (* -2.0 f30-1 f28-0)) + (add-debug-line #t (bucket-id debug-no-zbuf1) s1-0 s0-0 sv-240 #f (the-as rgba -1)) + (vector-copy! s1-0 s0-0) + (vector+*! s0-0 s0-0 (-> *math-camera* inv-camera-rot rvec) (* -2.0 f30-1 f28-0)) + (add-debug-line #t (bucket-id debug-no-zbuf1) s1-0 s0-0 sv-240 #f (the-as rgba -1)) + (vector-copy! s1-0 s0-0) + (vector+*! s0-0 s0-0 (-> *math-camera* inv-camera-rot uvec) (* 2.0 f30-1 f28-0)) + (add-debug-line #t (bucket-id debug-no-zbuf1) s1-0 s0-0 sv-240 #f (the-as rgba -1)) + (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)) + ) + ) + (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 ((a2-6 (* f30-1 f28-0))) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-13 quad)) + ) ) - (.lvf vf4 (&-> v1-26 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-7 quad) vf6) - ) - (let ((a0-14 s0-0)) - (let ((v1-27 s1-0)) - (let ((a1-9 (-> *math-camera* inv-camera-rot uvec))) - (let ((a2-8 (* -2.0 f30-1 f28-0))) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a1-9 quad)) - ) - (.lvf vf4 (&-> v1-27 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-14 quad) vf6) - ) - (add-debug-line #t (bucket-id debug-no-zbuf1) s1-0 s0-0 sv-240 #f (the-as rgba -1)) - (vector-copy! s1-0 s0-0) - (let ((a0-18 s0-0)) - (let ((v1-29 s0-0)) - (let ((a1-12 (-> *math-camera* inv-camera-rot))) - (let ((a2-11 (* -2.0 f30-1 f28-0))) - (.mov vf7 a2-11) - ) - (.lvf vf5 (&-> a1-12 rvec quad)) - ) - (.lvf vf4 (&-> v1-29 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-18 quad) vf6) - ) - (add-debug-line #t (bucket-id debug-no-zbuf1) s1-0 s0-0 sv-240 #f (the-as rgba -1)) - (vector-copy! s1-0 s0-0) - (let ((a0-22 s0-0)) - (let ((v1-31 s0-0)) - (let ((a1-15 (-> *math-camera* inv-camera-rot uvec))) - (let ((a2-14 (* 2.0 f30-1 f28-0))) - (.mov vf7 a2-14) - ) - (.lvf vf5 (&-> a1-15 quad)) - ) - (.lvf vf4 (&-> v1-31 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-22 quad) vf6) - ) - (add-debug-line #t (bucket-id debug-no-zbuf1) s1-0 s0-0 sv-240 #f (the-as rgba -1)) - (vector-copy! s1-0 s0-0) - (let ((a0-26 s0-0)) - (let ((v1-33 s0-0)) - (let ((a1-18 (-> *math-camera* inv-camera-rot))) - (let ((a2-17 (* 2.0 f30-1 f28-0))) - (.mov vf7 a2-17) - ) - (.lvf vf5 (&-> a1-18 rvec quad)) - ) - (.lvf vf4 (&-> v1-33 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-26 quad) vf6) + (s0-1 sv-256 a1-24 a2-15 a3-11 t0-11) ) ) - (let ((t9-9 add-debug-line) - (a0-27 #t) - (a1-19 577) - (t1-3 #f) - (t2-3 -1) - ) - (t9-9 a0-27 (the-as bucket-id a1-19) s1-0 s0-0 sv-240 t1-3 (the-as rgba t2-3)) + (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* + ) + ) + ) + (s0-2 sv-272 a1-26 a2-16 a3-12 t0-12) + ) ) ) - (let ((s1-1 (new 'stack-no-clear 'vector))) - (when (and s3-0 s2-0) - (let ((a1-20 s1-1)) - (let ((v1-36 s5-0)) - (let ((a0-29 (vector+! (new 'stack-no-clear 'vector) (-> this mat fvec) (-> this mat uvec)))) - (let ((a2-20 f30-1)) - (.mov vf7 a2-20) - ) - (.lvf vf5 (&-> a0-29 quad)) - ) - (.lvf vf4 (&-> v1-36 quad)) + (set! s2-0 (and s4-0 s2-0)) + (when s2-0 + (vector+*! s1-1 s5-0 (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat fvec)) f30-1) + (draw-axis + s1-1 + (vector-negate! (new 'stack-no-clear 'vector) (-> this mat rvec)) + (* 0.15 f30-1) + (* 0.15 f30-1) + (if (= (-> this action) (manipulator-action ma5)) + *color-yellow* + *color-red* ) - (.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) - ) - (let ((s0-1 draw-axis)) - (set! sv-256 s1-1) - (let ((a1-22 (vector-negate! (new 'stack-no-clear 'vector) (-> this mat uvec))) - (a2-21 (* 0.15 f30-1)) - (a3-11 (* 0.15 f30-1)) - (t0-11 (if (= (-> this action) (manipulator-action ma6)) - *color-yellow* - *color-green* - ) - ) - ) - (s0-1 sv-256 a1-22 a2-21 a3-11 t0-11) - ) - ) - (let ((s0-2 draw-axis)) - (set! sv-272 s1-1) - (let ((a1-24 (vector-negate! (new 'stack-no-clear 'vector) (-> this mat fvec))) - (a2-22 (* 0.15 f30-1)) - (a3-12 (* 0.15 f30-1)) - (t0-12 (if (= (-> this action) (manipulator-action ma6)) - *color-yellow* - *color-blue* - ) - ) - ) - (s0-2 sv-272 a1-24 a2-22 a3-12 t0-12) - ) - ) ) - (set! s2-0 (and s4-0 s2-0)) - (when s2-0 - (let ((a1-25 s1-1)) - (let ((v1-44 s5-0)) - (let ((a0-37 (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat fvec)))) - (let ((a2-24 f30-1)) - (.mov vf7 a2-24) - ) - (.lvf vf5 (&-> a0-37 quad)) - ) - (.lvf vf4 (&-> v1-44 quad)) + (draw-axis + s1-1 + (vector-negate! (new 'stack-no-clear 'vector) (-> this mat fvec)) + (* 0.15 f30-1) + (* 0.15 f30-1) + (if (= (-> this action) (manipulator-action ma5)) + *color-yellow* + *color-blue* ) - (.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-25 quad) vf6) - ) - (draw-axis - s1-1 - (vector-negate! (new 'stack-no-clear 'vector) (-> this mat rvec)) - (* 0.15 f30-1) - (* 0.15 f30-1) - (if (= (-> this action) (manipulator-action ma5)) - *color-yellow* - *color-red* - ) - ) - (draw-axis - s1-1 - (vector-negate! (new 'stack-no-clear 'vector) (-> this mat fvec)) - (* 0.15 f30-1) - (* 0.15 f30-1) - (if (= (-> this action) (manipulator-action ma5)) - *color-yellow* - *color-blue* - ) - ) ) - (set! s3-0 (and s4-0 s3-0)) - (when s3-0 - (let ((a0-44 s1-1)) - (let ((v1-52 (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat uvec)))) - (let ((a1-31 f30-1)) - (.mov vf7 a1-31) - ) - (.lvf vf5 (&-> v1-52 quad)) + ) + (set! s3-0 (and s4-0 s3-0)) + (when s3-0 + (vector+*! s1-1 s5-0 (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat uvec)) f30-1) + (draw-axis + s1-1 + (vector-negate! (new 'stack-no-clear 'vector) (-> this mat rvec)) + (* 0.15 f30-1) + (* 0.15 f30-1) + (if (= (-> this action) (manipulator-action ma4)) + *color-yellow* + *color-red* + ) + ) + (draw-axis + s1-1 + (vector-negate! (new 'stack-no-clear 'vector) (-> this mat uvec)) + (* 0.15 f30-1) + (* 0.15 f30-1) + (if (= (-> this action) (manipulator-action ma4)) + *color-yellow* + *color-green* ) - (.lvf vf4 (&-> s5-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-44 quad) vf6) - ) - (draw-axis - s1-1 - (vector-negate! (new 'stack-no-clear 'vector) (-> this mat rvec)) - (* 0.15 f30-1) - (* 0.15 f30-1) - (if (= (-> this action) (manipulator-action ma4)) - *color-yellow* - *color-red* - ) - ) - (draw-axis - s1-1 - (vector-negate! (new 'stack-no-clear 'vector) (-> this mat uvec)) - (* 0.15 f30-1) - (* 0.15 f30-1) - (if (= (-> this action) (manipulator-action ma4)) - *color-yellow* - *color-green* - ) - ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod manipulator-method-12 ((this manipulator) (arg0 vector)) @@ -468,200 +339,137 @@ ) (defmethod manipulator-method-13 ((this manipulator) (arg0 vector) (arg1 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (cond - ((= (-> this mode) (manipulator-mode mm0)) - (vector-copy! (-> this speed) (-> this position)) - (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) arg1 arg0)) - (s4-1 (vector-! (new 'stack-no-clear 'vector) (-> this mouse-ref-position) arg0)) - ) - 0.0 - 0.0 - (let ((s2-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - ) - (cond - ((or (= (-> this action) (manipulator-action ma1)) - (= (-> this action) (manipulator-action ma2)) - (= (-> this action) (manipulator-action ma3)) - ) - (cond - ((= (-> this action) (manipulator-action ma1)) - (cond - ((< (fabs (vector-dot s5-1 (-> this mat uvec))) (fabs (vector-dot s5-1 (-> this mat fvec)))) - (vector-copy! s2-0 (-> this mat fvec)) - (vector-copy! s1-0 (-> this mat uvec)) - ) - (else - (vector-copy! s2-0 (-> this mat uvec)) - (vector-copy! s1-0 (-> this mat fvec)) - ) - ) - ) - ((= (-> this action) (manipulator-action ma2)) - (cond - ((< (fabs (vector-dot s5-1 (-> this mat rvec))) (fabs (vector-dot s5-1 (-> this mat fvec)))) - (vector-copy! s2-0 (-> this mat fvec)) - (vector-copy! s1-0 (-> this mat rvec)) - ) - (else - (vector-copy! s2-0 (-> this mat rvec)) - (vector-copy! s1-0 (-> this mat fvec)) - ) - ) - ) - ((= (-> this action) (manipulator-action ma3)) - (cond - ((< (fabs (vector-dot s5-1 (-> this mat uvec))) (fabs (vector-dot s5-1 (-> this mat rvec)))) - (vector-copy! s2-0 (-> this mat rvec)) - (vector-copy! s1-0 (-> this mat uvec)) - ) - (else - (vector-copy! s2-0 (-> this mat uvec)) - (vector-copy! s1-0 (-> this mat rvec)) - ) - ) - ) - ) - (let ((f30-0 (intersect-ray-plane arg0 s5-1 (-> this position) s2-0)) - (f0-11 (intersect-ray-plane arg0 s4-1 (-> this position) s2-0)) - ) - (let ((a1-3 s5-1)) - (let ((v1-41 arg0)) - (let ((a0-43 s5-1)) - (let ((a2-3 f30-0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-43 quad)) - ) - (.lvf vf4 (&-> v1-41 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-3 quad) vf6) - ) - (let ((a0-44 s4-1)) - (let ((v1-42 s4-1)) - (let ((a1-4 f0-11)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> v1-42 quad)) - ) - (.lvf vf4 (&-> arg0 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-flatten! s5-1 (vector-! (new 'stack-no-clear 'vector) s5-1 (-> this position)) s1-0) - (vector-flatten! s4-1 (vector-! (new 'stack-no-clear 'vector) s4-1 (-> this position)) s1-0) - (let ((v1-46 (vector-! (new 'stack-no-clear 'vector) s5-1 s4-1))) - (vector+! (-> this position) (-> this drag-ref-position) v1-46) - (format *stdcon* "delta ~M ~M ~M~%" (-> v1-46 x) (-> v1-46 y) (-> v1-46 z)) - ) - ) - ((or (= (-> this action) (manipulator-action ma4)) - (= (-> this action) (manipulator-action ma5)) - (= (-> this action) (manipulator-action ma6)) - (= (-> this action) (manipulator-action ma7)) - ) - (cond - ((= (-> this action) (manipulator-action ma4)) - (vector-copy! s2-0 *z-vector*) - ) - ((= (-> this action) (manipulator-action ma5)) - (vector-copy! s2-0 *y-vector*) - ) - ((= (-> this action) (manipulator-action ma6)) - (vector-copy! s2-0 *x-vector*) - ) - ((= (-> this action) (manipulator-action ma7)) - (vector-copy! s2-0 (-> *math-camera* inv-camera-rot fvec)) - ) - ) - (vector-normalize! s2-0 1.0) - (let ((f30-1 (intersect-ray-plane arg0 s5-1 (-> this position) s2-0)) - (f0-15 (intersect-ray-plane arg0 s4-1 (-> this position) s2-0)) - ) - (let ((a1-14 s5-1)) - (let ((v1-69 arg0)) - (let ((a0-69 s5-1)) - (let ((a2-13 f30-1)) - (.mov vf7 a2-13) - ) - (.lvf vf5 (&-> a0-69 quad)) - ) - (.lvf vf4 (&-> v1-69 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 ((v1-70 s4-1)) - (let ((a0-70 arg0)) - (let ((a1-15 s4-1)) - (let ((a2-14 f0-15)) - (.mov vf7 a2-14) - ) - (.lvf vf5 (&-> a1-15 quad)) - ) - (.lvf vf4 (&-> a0-70 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-70 quad) vf6) - ) - ) - (vector+! (-> this position) (-> this drag-ref-position) (vector-! (new 'stack-no-clear 'vector) s5-1 s4-1)) - ) - ) + (cond + ((= (-> this mode) (manipulator-mode mm0)) + (vector-copy! (-> this speed) (-> this position)) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) arg1 arg0)) + (s4-1 (vector-! (new 'stack-no-clear 'vector) (-> this mouse-ref-position) arg0)) ) - ) - (vector-! (-> this speed) (-> this position) (-> this speed)) - ) - ((= (-> this mode) (manipulator-mode mm1)) - (let ((s4-2 (- (-> this rotate-ref) (the int (-> *mouse* posx)))) - (s5-2 (new 'stack-no-clear 'matrix)) + 0.0 + 0.0 + (let ((s2-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) ) - (new 'stack 'euler-angles) - (matrix-identity! s5-2) (cond - ((= (-> this action) (manipulator-action ma1)) - (matrix-axis-angle! s5-2 (-> this mat rvec) (* 182.04445 (the float s4-2))) + ((or (= (-> this action) (manipulator-action ma1)) + (= (-> this action) (manipulator-action ma2)) + (= (-> this action) (manipulator-action ma3)) + ) + (cond + ((= (-> this action) (manipulator-action ma1)) + (cond + ((< (fabs (vector-dot s5-1 (-> this mat uvec))) (fabs (vector-dot s5-1 (-> this mat fvec)))) + (vector-copy! s2-0 (-> this mat fvec)) + (vector-copy! s1-0 (-> this mat uvec)) + ) + (else + (vector-copy! s2-0 (-> this mat uvec)) + (vector-copy! s1-0 (-> this mat fvec)) + ) + ) + ) + ((= (-> this action) (manipulator-action ma2)) + (cond + ((< (fabs (vector-dot s5-1 (-> this mat rvec))) (fabs (vector-dot s5-1 (-> this mat fvec)))) + (vector-copy! s2-0 (-> this mat fvec)) + (vector-copy! s1-0 (-> this mat rvec)) + ) + (else + (vector-copy! s2-0 (-> this mat rvec)) + (vector-copy! s1-0 (-> this mat fvec)) + ) + ) + ) + ((= (-> this action) (manipulator-action ma3)) + (cond + ((< (fabs (vector-dot s5-1 (-> this mat uvec))) (fabs (vector-dot s5-1 (-> this mat rvec)))) + (vector-copy! s2-0 (-> this mat rvec)) + (vector-copy! s1-0 (-> this mat uvec)) + ) + (else + (vector-copy! s2-0 (-> this mat uvec)) + (vector-copy! s1-0 (-> this mat rvec)) + ) + ) + ) + ) + (let ((f30-0 (intersect-ray-plane arg0 s5-1 (-> this position) s2-0)) + (f0-11 (intersect-ray-plane arg0 s4-1 (-> this position) s2-0)) + ) + (vector+*! s5-1 arg0 s5-1 f30-0) + (vector+*! s4-1 arg0 s4-1 f0-11) + ) + (vector-flatten! s5-1 (vector-! (new 'stack-no-clear 'vector) s5-1 (-> this position)) s1-0) + (vector-flatten! s4-1 (vector-! (new 'stack-no-clear 'vector) s4-1 (-> this position)) s1-0) + (let ((v1-46 (vector-! (new 'stack-no-clear 'vector) s5-1 s4-1))) + (vector+! (-> this position) (-> this drag-ref-position) v1-46) + (format *stdcon* "delta ~M ~M ~M~%" (-> v1-46 x) (-> v1-46 y) (-> v1-46 z)) + ) ) - ((= (-> this action) (manipulator-action ma2)) - (matrix-axis-angle! s5-2 (-> this mat uvec) (* 182.04445 (the float s4-2))) - ) - ((= (-> this action) (manipulator-action ma3)) - (matrix-axis-angle! s5-2 (-> this mat fvec) (* 182.04445 (the float s4-2))) + ((or (= (-> this action) (manipulator-action ma4)) + (= (-> this action) (manipulator-action ma5)) + (= (-> this action) (manipulator-action ma6)) + (= (-> this action) (manipulator-action ma7)) + ) + (cond + ((= (-> this action) (manipulator-action ma4)) + (vector-copy! s2-0 *z-vector*) + ) + ((= (-> this action) (manipulator-action ma5)) + (vector-copy! s2-0 *y-vector*) + ) + ((= (-> this action) (manipulator-action ma6)) + (vector-copy! s2-0 *x-vector*) + ) + ((= (-> this action) (manipulator-action ma7)) + (vector-copy! s2-0 (-> *math-camera* inv-camera-rot fvec)) + ) + ) + (vector-normalize! s2-0 1.0) + (let ((f30-1 (intersect-ray-plane arg0 s5-1 (-> this position) s2-0)) + (f0-15 (intersect-ray-plane arg0 s4-1 (-> this position) s2-0)) + ) + (vector+*! s5-1 arg0 s5-1 f30-1) + (vector+*! s4-1 arg0 s4-1 f0-15) + ) + (vector+! (-> this position) (-> this drag-ref-position) (vector-! (new 'stack-no-clear 'vector) s5-1 s4-1)) ) ) - (matrix*! (-> this mat) (-> this mat) s5-2) ) - (vector-normalize! (-> this mat rvec) 1.0) - (vector-normalize! (-> this mat uvec) 1.0) - (vector-normalize! (-> this mat fvec) 1.0) - (matrix->eul (-> this angles) (-> this mat) 21) - (format *stdcon* "X = ~R~%Y = ~R~%Z = ~R~%" (-> this angles x) (-> this angles y) (-> this angles z)) - (set! (-> this rotate-ref) (the int (-> *mouse* posx))) ) - (else - ) + (vector-! (-> this speed) (-> this position) (-> this speed)) + ) + ((= (-> this mode) (manipulator-mode mm1)) + (let ((s4-2 (- (-> this rotate-ref) (the int (-> *mouse* posx)))) + (s5-2 (new 'stack-no-clear 'matrix)) + ) + (new 'stack 'euler-angles) + (matrix-identity! s5-2) + (cond + ((= (-> this action) (manipulator-action ma1)) + (matrix-axis-angle! s5-2 (-> this mat rvec) (* 182.04445 (the float s4-2))) + ) + ((= (-> this action) (manipulator-action ma2)) + (matrix-axis-angle! s5-2 (-> this mat uvec) (* 182.04445 (the float s4-2))) + ) + ((= (-> this action) (manipulator-action ma3)) + (matrix-axis-angle! s5-2 (-> this mat fvec) (* 182.04445 (the float s4-2))) + ) + ) + (matrix*! (-> this mat) (-> this mat) s5-2) + ) + (vector-normalize! (-> this mat rvec) 1.0) + (vector-normalize! (-> this mat uvec) 1.0) + (vector-normalize! (-> this mat fvec) 1.0) + (matrix->eul (-> this angles) (-> this mat) 21) + (format *stdcon* "X = ~R~%Y = ~R~%Z = ~R~%" (-> this angles x) (-> this angles y) (-> this angles z)) + (set! (-> this rotate-ref) (the int (-> *mouse* posx))) + ) + (else ) - 0 - (none) ) + 0 + (none) ) (defmethod manipulator-method-14 ((this manipulator)) diff --git a/goal_src/jak3/engine/debug/viewer.gc b/goal_src/jak3/engine/debug/viewer.gc index 61acf4cc4d..164ebb533a 100644 --- a/goal_src/jak3/engine/debug/viewer.gc +++ b/goal_src/jak3/engine/debug/viewer.gc @@ -34,7 +34,7 @@ :frame-num 0.0 ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-x-vel adjust-y-vel adjust-xz-vel keep-other-velocities adjust-quat) diff --git a/goal_src/jak3/engine/math/quaternion.gc b/goal_src/jak3/engine/math/quaternion.gc index 14fc579fee..01c1ef9fa5 100644 --- a/goal_src/jak3/engine/math/quaternion.gc +++ b/goal_src/jak3/engine/math/quaternion.gc @@ -978,26 +978,26 @@ ) ) -(defun vector-rotate-around-axis! ((arg0 vector) (arg1 quaternion) (arg2 float) (arg3 vector)) +(defun vector-rotate-around-axis! ((arg0 vector) (arg1 vector) (arg2 float) (arg3 vector)) "Rotate along y so z-axis points to match another. Use arg3 as the max rotation amount." (let ((a2-1 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) arg3 arg2))) - (vector-orient-by-quat! arg0 (-> arg1 vec) a2-1) + (vector-orient-by-quat! arg0 arg1 a2-1) ) ) (defun vector-rotate-x! ((arg0 vector) (arg1 vector) (arg2 float)) "Rotate vector along x axis." - (vector-rotate-around-axis! arg0 (the-as quaternion arg1) arg2 *x-vector*) + (vector-rotate-around-axis! arg0 arg1 arg2 *x-vector*) ) (defun vector-rotate-y! ((arg0 vector) (arg1 vector) (arg2 float)) "Rotate vector along y axis." - (vector-rotate-around-axis! arg0 (the-as quaternion arg1) arg2 *y-vector*) + (vector-rotate-around-axis! arg0 arg1 arg2 *y-vector*) ) (defun vector-rotate-z! ((arg0 vector) (arg1 vector) (arg2 float)) "Rotate vector along z axis." - (vector-rotate-around-axis! arg0 (the-as quaternion arg1) arg2 *z-vector*) + (vector-rotate-around-axis! arg0 arg1 arg2 *z-vector*) ) (defun vector-y-angle ((arg0 vector)) diff --git a/goal_src/jak3/engine/math/vector.gc b/goal_src/jak3/engine/math/vector.gc index dea6ff5d03..21dd3b3522 100644 --- a/goal_src/jak3/engine/math/vector.gc +++ b/goal_src/jak3/engine/math/vector.gc @@ -1640,33 +1640,19 @@ ) (defun rand-vu-sphere-point-uniform! ((arg0 vector) (arg1 float)) - (local-vars (v1-3 float) (f0-5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - 666.6 - (until (>= 1.0 f0-5) - (set-vector! - arg0 - (rand-vu-float-range -1.0 1.0) - (rand-vu-float-range -1.0 1.0) - (rand-vu-float-range -1.0 1.0) - 1.0 - ) - (.lvf vf1 (&-> arg0 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-3 vf1) - (set! f0-5 v1-3) + (local-vars (f0-5 float)) + 666.6 + (until (>= 1.0 f0-5) + (set-vector! + arg0 + (rand-vu-float-range -1.0 1.0) + (rand-vu-float-range -1.0 1.0) + (rand-vu-float-range -1.0 1.0) + 1.0 ) - (vector-float*! arg0 arg0 arg1) + (set! f0-5 (vector-length-squared arg0)) ) + (vector-float*! arg0 arg0 arg1) ) (defmethod print ((this vector2)) diff --git a/goal_src/jak3/engine/nav/nav-control.gc b/goal_src/jak3/engine/nav/nav-control.gc index e3de00b438..c1b98547cf 100644 --- a/goal_src/jak3/engine/nav/nav-control.gc +++ b/goal_src/jak3/engine/nav/nav-control.gc @@ -500,10 +500,6 @@ (vf1 :class vf) (vf2 :class vf) (vf3 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((t1-0 (new 'stack-no-clear 'vector)) @@ -550,33 +546,8 @@ (a0-9 (new 'stack-no-clear 'vector)) ) (vector-float*! a0-9 t0-0 f1-3) - (let ((t0-1 arg2)) - (let ((a1-3 a0-9)) - (let ((a2-1 v1-0)) - (let ((t1-1 f0-7)) - (.mov vf7 t1-1) - ) - (.lvf vf5 (&-> a2-1 quad)) - ) - (.lvf vf4 (&-> a1-3 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 (&-> t0-1 quad) vf6) - ) - (let ((v0-0 arg3)) - (let ((a1-4 (- f0-7))) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> v1-0 quad)) - (.lvf vf4 (&-> a0-9 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 (&-> v0-0 quad) vf6) - v0-0 - ) + (vector+*! arg2 a0-9 v1-0 f0-7) + (vector+*! arg3 a0-9 v1-0 (- f0-7)) ) ) ) @@ -2155,192 +2126,172 @@ ) (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 (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)) + ) + (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) ) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (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) (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)) + (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 ) - (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 - ) - (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) - ) - ) - ) - ) - ) - ) - (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) - ) - ) - (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) - ) - ) + ) + (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-13 f30-0) - (set! f30-0 f0-13) - (set! s5-2 s3-1) + (when (< f0-10 f2-8) + (set! f0-10 f2-8) + (set! s5-2 a0-41) ) ) ) ) ) - (vector-! (-> this travel) (-> sv-120 s5-2) (-> this virtual-current-pos-local)) ) - (set! (-> this travel y) 0.0) + (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) + ) + ) + (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)) ) + (set! (-> this travel y) 0.0) ) - (.lvf vf1 (&-> (-> this travel) 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-117 vf1) - (let ((f0-15 v1-117) - (f1-10 (-> this nav nav-cull-radius)) - ) - (if (< (* f1-10 f1-10) f0-15) - (vector-float*! (-> this travel) (-> this travel) (/ (-> this nav nav-cull-radius) (sqrtf f0-15))) - ) - ) - 0 - (none) ) + (let ((f0-15 (vector-length-squared (-> this travel))) + (f1-10 (-> this nav nav-cull-radius)) + ) + (if (< (* f1-10 f1-10) f0-15) + (vector-float*! (-> this travel) (-> this travel) (/ (-> this nav nav-cull-radius) (sqrtf f0-15))) + ) + ) + 0 + (none) ) (defmethod navigate-using-best-dir-use-existing-avoid-spheres ((this nav-state) (arg0 nav-avoid-spheres-params)) @@ -3300,65 +3251,43 @@ ) (defmethod update-travel-dir-from-spheres ((this nav-state)) - (local-vars (v1-11 float) (v1-25 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'nav-control-cfs-work))) - (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! (-> 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)) - (let ((s3-0 (-> this nav sphere-array s4-0))) - (vector-! (-> s5-0 right-dir) (-> this current-pos-local) (the-as vector s3-0)) - (.lvf vf1 (&-> (-> s5-0 right-dir) 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 ((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)) - (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)) - ) + (let ((s5-0 (new 'stack-no-clear 'nav-control-cfs-work))) + (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! (-> 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)) + (let ((s3-0 (-> this nav sphere-array s4-0))) + (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)) + (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)) ) ) - (vector+! (-> s5-0 in-dir) (-> s5-0 in-dir) (-> s5-0 right-dir)) ) - (vector+! (-> this target-dir) (-> this target-dir) (-> s5-0 in-dir)) + (vector+! (-> s5-0 in-dir) (-> s5-0 in-dir) (-> s5-0 right-dir)) ) - (set! (-> this target-dir y) 0.0) - (vector+float*! (-> this velocity) (-> this velocity) (-> this target-dir) (-> this nav sec-per-frame)) - (.lvf vf1 (&-> (-> this 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-25 vf1) - (let ((f0-11 v1-25) - (f1-4 (-> this nav target-speed)) - ) - (if (< (* f1-4 f1-4) f0-11) - (vector-float*! (-> this velocity) (-> this velocity) (/ (-> this nav target-speed) (sqrtf f0-11))) - ) - ) - (vector-float*! (-> this travel) (-> this velocity) (-> this nav sec-per-frame)) - 0 - (none) + (vector+! (-> this target-dir) (-> this target-dir) (-> s5-0 in-dir)) ) + (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) + (vector-float*! (-> this velocity) (-> this velocity) (/ (-> this nav target-speed) (sqrtf f0-11))) + ) + ) + (vector-float*! (-> this travel) (-> this velocity) (-> this nav sec-per-frame)) + 0 + (none) ) (defmethod compute-speed-simple ((this nav-state)) diff --git a/goal_src/jak3/engine/nav/nav-enemy.gc b/goal_src/jak3/engine/nav/nav-enemy.gc index c684f97d37..08ed979fd5 100644 --- a/goal_src/jak3/engine/nav/nav-enemy.gc +++ b/goal_src/jak3/engine/nav/nav-enemy.gc @@ -640,223 +640,172 @@ ;; WARN: Return type mismatch int vs object. (defmethod setup-enemy! ((this nav-enemy) (arg0 nav-enemy-info)) (local-vars (sv-16 res-tag)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (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!)) - (set! (-> a0-2 param1) #f) - (set! (-> a0-2 param2) #f) - ) - (logior! (-> this enemy-flags) (enemy-flag drawn-mirrored)) + (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!)) + (set! (-> a0-2 param1) #f) + (set! (-> a0-2 param2) #f) ) - (logior! (-> this mask) (process-mask enemy)) - (logior! (-> this mask) (process-mask actor-pause)) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) - (set! (-> this nav-radius-backup) (-> this root nav-radius)) - (set-enemy-info! this arg0) - (set! (-> this enemy-info callback-info) *default-nav-callback-info*) - (set! (-> this ragdoll-proc) (the-as handle #f)) - (let ((a1-2 (-> this enemy-info idle-anim-script))) - (if a1-2 - (init! (-> this idle-anim-player) a1-2) - ) - ) - (if (-> this draw shadow) - (set! (-> this draw shadow-ctrl) (new - 'process - 'shadow-control - (-> this enemy-info shadow-min-y) - (-> this enemy-info shadow-max-y) - (-> this enemy-info shadow-locus-dist) - (the-as vector #f) - (shadow-flags shdf00 shdf04) - 245760.0 - ) - ) - (set! (-> this draw shadow-ctrl) *nav-enemy-dummy-shadow-control*) - ) - (get-nav-control this (-> arg0 nav-mesh)) - (set! (-> this water-max-height) (-> this nav state mesh water-max-height)) - (let ((v1-32 this)) - (set! (-> v1-32 enemy-flags) (the-as enemy-flag (logclear (-> v1-32 enemy-flags) (enemy-flag ef37)))) - (set! (-> v1-32 nav callback-info) *null-nav-callback-info*) - ) - 0 - (let ((v1-35 this)) - (set! (-> v1-35 enemy-flags) (the-as enemy-flag (logior (enemy-flag ef38) (-> v1-35 enemy-flags)))) - ) - 0 - (logior! (-> this nav flags) (nav-control-flag display-marks limit-rotation-rate)) - (logior! (-> this nav flags) (nav-control-flag update-heading-from-facing)) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag ef44) (-> this enemy-flags)))) - (let ((v1-46 (-> this nav))) - (set! (-> v1-46 target-speed) 0.0) - ) - 0 - (let ((v1-48 (-> this nav))) - (set! (-> v1-48 acceleration) (-> this enemy-info walk-acceleration)) - ) - 0 - (let ((v1-50 (-> this nav))) - (set! (-> v1-50 turning-acceleration) (-> this enemy-info walk-turning-acceleration)) - ) - 0 - (let ((v1-52 (-> this nav))) - (set! (-> v1-52 max-rotation-rate) (-> this enemy-info maximum-rotation-rate)) - ) - 0 - (nav-enemy-method-175 this) - (set! (-> this path) (new 'process 'path-control this 'path 0.0 (the-as entity #f) #f)) - (when (and (zero? (-> this path curve num-cverts)) (-> this entity)) - (set! (-> this path curve num-cverts) 3) - (set! (-> this path curve cverts) (-> (new 'process 'vector-array 3) data)) - (logclear! (-> this path flags) (path-control-flag not-found)) - (let ((v1-69 (-> this path curve cverts 0))) - (let ((a0-33 (-> this entity trans))) - (let ((a1-9 *x-vector*)) - (let ((a2-4 6144.0)) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a1-9 quad)) - ) - (.lvf vf4 (&-> a0-33 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-69 quad) vf6) - ) - (let ((v1-72 (-> this path curve cverts 1))) - (let ((a0-35 (-> this entity trans))) - (let ((a1-10 *x-vector*)) - (let ((a2-6 -6144.0)) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a1-10 quad)) - ) - (.lvf vf4 (&-> a0-35 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-72 quad) vf6) - ) - (let ((v1-75 (-> this path curve cverts 2))) - (let ((a0-37 (-> this entity trans))) - (let ((a1-11 *z-vector*)) - (let ((a2-8 6144.0)) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a1-11 quad)) - ) - (.lvf vf4 (&-> a0-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 (&-> v1-75 quad) vf6) - ) - ) - (if (and (nonzero? (-> this path)) (nonzero? (-> this path curve num-cverts))) - (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) - ) - (if (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) - (set! (-> this hit-points) (* 2.0 (-> this enemy-info default-hit-points))) - (set! (-> this hit-points) (-> this enemy-info default-hit-points)) - ) - (let* ((v1-91 *game-info*) - (a0-42 (+ (-> v1-91 attack-id) 1)) - ) - (set! (-> v1-91 attack-id) a0-42) - (set! (-> this attack-id) a0-42) - ) - (let* ((v1-92 *game-info*) - (a0-44 (+ (-> v1-92 attack-id) 1)) - ) - (set! (-> v1-92 attack-id) a0-44) - (set! (-> this persistent-attack-id) a0-44) - ) - (set! (-> this gnd-collide-with) (-> this enemy-info gnd-collide-with)) - (set! (-> this fact) (new 'process 'fact-info-enemy this (the-as (pointer float) (-> arg0 fact-defaults)))) - (let ((cspec (if (logtest? (enemy-option multi-focus) (-> this fact enemy-options)) - (the-as collide-spec (collide-spec jak bot player-list jak-vehicle)) - (the-as collide-spec (collide-spec jak player-list jak-vehicle)) - ) - ) - ) - (reset-to-collide-spec (-> this focus) (the-as collide-spec cspec)) - ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-101 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) - (cond - ((and v1-101 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-101)) - (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - ) - (else - (set! (-> this actor-group) (the-as (pointer actor-group) #f)) - (set! (-> this actor-group-count) 0) - 0 - ) - ) - ) - (set! (-> this on-notice) (res-lump-struct (-> this entity) 'on-notice pair)) - (set! (-> this on-active) (res-lump-struct (-> this entity) 'on-active pair)) - (set! (-> this on-hostile) (res-lump-struct (-> this entity) 'on-hostile pair)) - (set! (-> this on-death) (res-lump-struct (-> this entity) 'on-death pair)) - (if (-> this on-notice) - (logior! (-> this enemy-flags) (enemy-flag enable-on-notice)) - ) - (if (-> this on-active) - (logior! (-> this enemy-flags) (enemy-flag enable-on-active)) - ) - (if (-> this on-hostile) - (logior! (-> this enemy-flags) (enemy-flag enable-on-hostile)) - ) - (set! (-> this incoming attacker-handle) (the-as handle #f)) - (let ((s4-0 (-> this root))) - (set! (-> this penetrated-by-all) (-> this root penetrated-by)) - (set! (-> this root penetrated-by) (get-penetrated-by this)) - (set! (-> s4-0 event-self) 'touched) - ) - (set! (-> this penetrate-flinch) (-> arg0 penetrate-flinch)) - (set! (-> this penetrate-knocked) (-> arg0 penetrate-knocked)) - (set! (-> this reaction-time) (rnd-time-frame this (seconds 0.1) (seconds 0.8))) - (let* ((v1-132 (-> this enemy-flags)) - (a0-61 (-> this fact enemy-options)) - (v1-133 - (logior (enemy-flag vulnerable vulnerable-backup use-notice-distance attackable-backup trackable trackable-backup) - v1-132 - ) - ) - ) - (if (logtest? (enemy-option multi-focus) a0-61) - (set! v1-133 (logior (enemy-flag multi-focus) v1-133)) - ) - (if (logtest? (enemy-option has-trigger) a0-61) - (set! v1-133 (logior (enemy-flag use-trigger) v1-133)) - ) - (set! (-> this enemy-flags) v1-133) - ) - (do-navigation-to-destination (-> this nav state) (-> this root trans)) - (if (and (should-move-to-ground? this) - (not (logtest? (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) - (not (logtest? (enemy-option ambush) (-> this fact enemy-options))) - ) - (move-to-ground this (meters 10) (meters 10) #t (-> this gnd-collide-with)) - ) - (if (zero? (-> this draw light-index)) - (set! (-> this draw light-index) (the-as uint 10)) - ) - 0 + (logior! (-> this enemy-flags) (enemy-flag drawn-mirrored)) ) + (logior! (-> this mask) (process-mask enemy)) + (logior! (-> this mask) (process-mask actor-pause)) + (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (set! (-> this nav-radius-backup) (-> this root nav-radius)) + (set-enemy-info! this arg0) + (set! (-> this enemy-info callback-info) *default-nav-callback-info*) + (set! (-> this ragdoll-proc) (the-as handle #f)) + (let ((a1-2 (-> this enemy-info idle-anim-script))) + (if a1-2 + (init! (-> this idle-anim-player) a1-2) + ) + ) + (if (-> this draw shadow) + (set! (-> this draw shadow-ctrl) (new + 'process + 'shadow-control + (-> this enemy-info shadow-min-y) + (-> this enemy-info shadow-max-y) + (-> this enemy-info shadow-locus-dist) + (the-as vector #f) + (shadow-flags shdf00 shdf04) + 245760.0 + ) + ) + (set! (-> this draw shadow-ctrl) *nav-enemy-dummy-shadow-control*) + ) + (get-nav-control this (-> arg0 nav-mesh)) + (set! (-> this water-max-height) (-> this nav state mesh water-max-height)) + (let ((v1-32 this)) + (set! (-> v1-32 enemy-flags) (the-as enemy-flag (logclear (-> v1-32 enemy-flags) (enemy-flag ef37)))) + (set! (-> v1-32 nav callback-info) *null-nav-callback-info*) + ) + 0 + (let ((v1-35 this)) + (set! (-> v1-35 enemy-flags) (the-as enemy-flag (logior (enemy-flag ef38) (-> v1-35 enemy-flags)))) + ) + 0 + (logior! (-> this nav flags) (nav-control-flag display-marks limit-rotation-rate)) + (logior! (-> this nav flags) (nav-control-flag update-heading-from-facing)) + (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag ef44) (-> this enemy-flags)))) + (let ((v1-46 (-> this nav))) + (set! (-> v1-46 target-speed) 0.0) + ) + 0 + (let ((v1-48 (-> this nav))) + (set! (-> v1-48 acceleration) (-> this enemy-info walk-acceleration)) + ) + 0 + (let ((v1-50 (-> this nav))) + (set! (-> v1-50 turning-acceleration) (-> this enemy-info walk-turning-acceleration)) + ) + 0 + (let ((v1-52 (-> this nav))) + (set! (-> v1-52 max-rotation-rate) (-> this enemy-info maximum-rotation-rate)) + ) + 0 + (nav-enemy-method-175 this) + (set! (-> this path) (new 'process 'path-control this 'path 0.0 (the-as entity #f) #f)) + (when (and (zero? (-> this path curve num-cverts)) (-> this entity)) + (set! (-> this path curve num-cverts) 3) + (set! (-> this path curve cverts) (-> (new 'process 'vector-array 3) data)) + (logclear! (-> this path flags) (path-control-flag not-found)) + (vector+*! (-> this path curve cverts 0) (-> this entity trans) *x-vector* 6144.0) + (vector+*! (-> this path curve cverts 1) (-> this entity trans) *x-vector* -6144.0) + (vector+*! (-> this path curve cverts 2) (-> this entity trans) *z-vector* 6144.0) + ) + (if (and (nonzero? (-> this path)) (nonzero? (-> this path curve num-cverts))) + (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) + ) + (if (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) + (set! (-> this hit-points) (* 2.0 (-> this enemy-info default-hit-points))) + (set! (-> this hit-points) (-> this enemy-info default-hit-points)) + ) + (let* ((v1-94 *game-info*) + (a0-42 (+ (-> v1-94 attack-id) 1)) + ) + (set! (-> v1-94 attack-id) a0-42) + (set! (-> this attack-id) a0-42) + ) + (let* ((v1-95 *game-info*) + (a0-44 (+ (-> v1-95 attack-id) 1)) + ) + (set! (-> v1-95 attack-id) a0-44) + (set! (-> this persistent-attack-id) a0-44) + ) + (set! (-> this gnd-collide-with) (-> this enemy-info gnd-collide-with)) + (set! (-> this fact) (new 'process 'fact-info-enemy this (the-as (pointer float) (-> arg0 fact-defaults)))) + (let ((cspec (if (logtest? (enemy-option multi-focus) (-> this fact enemy-options)) + (the-as collide-spec (collide-spec jak bot player-list jak-vehicle)) + (the-as collide-spec (collide-spec jak player-list jak-vehicle)) + ) + ) + ) + (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)))) + (cond + ((and v1-104 (nonzero? (-> sv-16 elt-count))) + (set! (-> this actor-group) (the-as (pointer actor-group) v1-104)) + (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) + ) + (else + (set! (-> this actor-group) (the-as (pointer actor-group) #f)) + (set! (-> this actor-group-count) 0) + 0 + ) + ) + ) + (set! (-> this on-notice) (res-lump-struct (-> this entity) 'on-notice pair)) + (set! (-> this on-active) (res-lump-struct (-> this entity) 'on-active pair)) + (set! (-> this on-hostile) (res-lump-struct (-> this entity) 'on-hostile pair)) + (set! (-> this on-death) (res-lump-struct (-> this entity) 'on-death pair)) + (if (-> this on-notice) + (logior! (-> this enemy-flags) (enemy-flag enable-on-notice)) + ) + (if (-> this on-active) + (logior! (-> this enemy-flags) (enemy-flag enable-on-active)) + ) + (if (-> this on-hostile) + (logior! (-> this enemy-flags) (enemy-flag enable-on-hostile)) + ) + (set! (-> this incoming attacker-handle) (the-as handle #f)) + (let ((s4-0 (-> this root))) + (set! (-> this penetrated-by-all) (-> this root penetrated-by)) + (set! (-> this root penetrated-by) (get-penetrated-by this)) + (set! (-> s4-0 event-self) 'touched) + ) + (set! (-> this penetrate-flinch) (-> arg0 penetrate-flinch)) + (set! (-> this penetrate-knocked) (-> arg0 penetrate-knocked)) + (set! (-> this reaction-time) (rnd-time-frame this (seconds 0.1) (seconds 0.8))) + (let* ((v1-135 (-> this enemy-flags)) + (a0-61 (-> this fact enemy-options)) + (v1-136 + (logior (enemy-flag vulnerable vulnerable-backup use-notice-distance attackable-backup trackable trackable-backup) + v1-135 + ) + ) + ) + (if (logtest? (enemy-option multi-focus) a0-61) + (set! v1-136 (logior (enemy-flag multi-focus) v1-136)) + ) + (if (logtest? (enemy-option has-trigger) a0-61) + (set! v1-136 (logior (enemy-flag use-trigger) v1-136)) + ) + (set! (-> this enemy-flags) v1-136) + ) + (do-navigation-to-destination (-> this nav state) (-> this root trans)) + (if (and (should-move-to-ground? this) + (not (logtest? (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) + (not (logtest? (enemy-option ambush) (-> this fact enemy-options))) + ) + (move-to-ground this (meters 10) (meters 10) #t (-> this gnd-collide-with)) + ) + (if (zero? (-> this draw light-index)) + (set! (-> this draw light-index) (the-as uint 10)) + ) + 0 ) ;; WARN: Return type mismatch int vs object. diff --git a/goal_src/jak3/engine/nav/nav-mesh.gc b/goal_src/jak3/engine/nav/nav-mesh.gc index cdc806b788..c9c434d409 100644 --- a/goal_src/jak3/engine/nav/nav-mesh.gc +++ b/goal_src/jak3/engine/nav/nav-mesh.gc @@ -1161,29 +1161,11 @@ (vf1 :class vf) (vf2 :class vf) (vf3 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (set! (-> arg0 current-poly) arg1) (vector-copy! (-> arg0 current-pos) arg2) - (let ((a1-3 (-> arg0 dest-pos))) - (let ((v1-1 (-> arg0 current-pos))) - (let ((a2-1 arg3)) - (let ((a3-1 arg4)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-1 quad)) - ) - (.lvf vf4 (&-> v1-1 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-3 quad) vf6) - ) + (vector+*! (-> arg0 dest-pos) (-> arg0 current-pos) arg3 arg4) (let ((v1-2 arg0)) (vector-! (-> v1-2 dir) (-> v1-2 dest-pos) (-> v1-2 current-pos)) (set! (-> v1-2 dir y) 0.0) @@ -1191,8 +1173,8 @@ (let ((f0-2 1.0)) (.lvf vf1 (&-> a0-2 quad)) (.mul.vf.xyz vf2 vf1 vf1) - (let ((a1-6 f0-2)) - (.mov vf3 a1-6) + (let ((a1-7 f0-2)) + (.mov vf3 a1-7) ) ) (.mul.x.vf.w acc vf0 vf2) @@ -1843,44 +1825,30 @@ ) (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)) - (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 (the-as vector (-> 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 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) - ) + (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) ) ) ) @@ -1891,8 +1859,8 @@ ) ) ) - sv-68 ) + sv-68 ) (defmethod nav-mesh-method-10 ((this nav-mesh) (arg0 vector) (arg1 vector) (arg2 nav-poly)) diff --git a/goal_src/jak3/engine/physics/chain-physics.gc b/goal_src/jak3/engine/physics/chain-physics.gc index 3101b1a237..01669ccbd3 100644 --- a/goal_src/jak3/engine/physics/chain-physics.gc +++ b/goal_src/jak3/engine/physics/chain-physics.gc @@ -73,7 +73,6 @@ (defmethod update ((this chain-physics) (arg0 process-drawable)) (local-vars - (v1-78 float) (f0-11 float) (sv-272 chain-physics-joint) (sv-288 vector) @@ -254,22 +253,14 @@ (.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))) - ) - ) + (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) diff --git a/goal_src/jak3/engine/physics/cloth.gc b/goal_src/jak3/engine/physics/cloth.gc index 8bcfb68824..bae56545e3 100644 --- a/goal_src/jak3/engine/physics/cloth.gc +++ b/goal_src/jak3/engine/physics/cloth.gc @@ -1019,8 +1019,6 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod cloth-system-method-22 ((this cloth-system)) (local-vars - (v1-25 float) - (v1-27 float) (sv-16 sphere) (sv-24 int) (sv-32 verlet-particle) @@ -1038,69 +1036,48 @@ (sv-164 float) (sv-168 vector) ) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-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)) - (.lvf vf1 (&-> sv-96 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-25 vf1) - (set! sv-104 v1-25) - (.lvf vf1 (&-> sv-100 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-27 vf1) - (set! sv-108 v1-27) - (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) + (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-24 (+ sv-24 1)) + (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) ) (set! sv-24 (+ sv-24 1)) ) + (set! sv-24 (+ sv-24 1)) ) - (none) ) + (none) ) (defmethod run-one-iteration ((this cloth-system)) diff --git a/goal_src/jak3/engine/physics/ragdoll.gc b/goal_src/jak3/engine/physics/ragdoll.gc index 5fddb72f68..2f7c2d9313 100644 --- a/goal_src/jak3/engine/physics/ragdoll.gc +++ b/goal_src/jak3/engine/physics/ragdoll.gc @@ -110,80 +110,65 @@ ) (defmethod ragdoll-method-19 ((this ragdoll) (arg0 vector) (arg1 int) (arg2 object) (arg3 matrix)) - (local-vars (v1-22 float)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (vector-float*! arg0 (-> this gravity) (* 122.88 (-> pp clock time-adjust-ratio))) - (if (logtest? (-> this ragdoll-joints arg1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - (vector-float*! arg0 arg0 0.15) - ) - (cond - ((logtest? (-> this ragdoll-joints arg1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) - (vector+float*! - arg0 - arg0 - (the-as vector (+ (the-as uint (-> this ragdoll-joints 0 bounce)) (* 192 arg1))) - 0.5 - ) - (vector+float*! - arg0 - arg0 - (the-as vector (+ (the-as uint (-> this ragdoll-joints 0 velocity)) (* 192 arg1))) - 0.7 - ) + (vector-float*! arg0 (-> this gravity) (* 122.88 (-> pp clock time-adjust-ratio))) + (if (logtest? (-> this ragdoll-joints arg1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + (vector-float*! arg0 arg0 0.15) + ) + (cond + ((logtest? (-> this ragdoll-joints arg1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) + (vector+float*! + arg0 + arg0 + (the-as vector (+ (the-as uint (-> this ragdoll-joints 0 bounce)) (* 192 arg1))) + 0.5 ) - (else - (vector+float*! - arg0 - arg0 - (the-as vector (+ (the-as uint (-> this ragdoll-joints 0 velocity)) (* 192 arg1))) - 1.0 - ) + (vector+float*! + arg0 + arg0 + (the-as vector (+ (the-as uint (-> this ragdoll-joints 0 velocity)) (* 192 arg1))) + 0.7 + ) + ) + (else + (vector+float*! + arg0 + arg0 + (the-as vector (+ (the-as uint (-> this ragdoll-joints 0 velocity)) (* 192 arg1))) + 1.0 ) ) - (.lvf vf1 (&-> arg0 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-22 vf1) - (let ((f0-6 v1-22) - (f1-1 16384.0) - ) - (if (and (zero? arg1) - (not (logtest? (-> this ragdoll-joints arg1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2))) - ) - (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))) - ) - ) - ) - (when (nonzero? (-> this rotate-adj-count)) - (quaternion-slerp! (-> this rotate-vel) (-> this rotate-vel) (-> this rotate-adj) 0.5) - (quaternion-identity! (-> this rotate-adj)) - (set! (-> this rotate-adj-count) 0) - 0 - ) - (if (< (-> this rotate-vel w) 0.0) - (quaternion-negate! (-> this rotate-vel) (-> this rotate-vel)) - ) - (when (< (-> this rotate-vel w) (cos 7281.778)) - (let ((a1-4 (vector-normalize! (-> this rotate-vel vec) 1.0))) - (quaternion-vector-angle! (-> this rotate-vel) a1-4 7281.778) - ) - ) - 0 - (none) ) + (let ((f0-6 (vector-length-squared arg0)) + (f1-1 16384.0) + ) + (if (and (zero? arg1) + (not (logtest? (-> this ragdoll-joints arg1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2))) + ) + (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))) + ) + ) + ) + (when (nonzero? (-> this rotate-adj-count)) + (quaternion-slerp! (-> this rotate-vel) (-> this rotate-vel) (-> this rotate-adj) 0.5) + (quaternion-identity! (-> this rotate-adj)) + (set! (-> this rotate-adj-count) 0) + 0 + ) + (if (< (-> this rotate-vel w) 0.0) + (quaternion-negate! (-> this rotate-vel) (-> this rotate-vel)) + ) + (when (< (-> this rotate-vel w) (cos 7281.778)) + (let ((a1-4 (vector-normalize! (-> this rotate-vel vec) 1.0))) + (quaternion-vector-angle! (-> this rotate-vel) a1-4 7281.778) + ) + ) + 0 + (none) ) ) @@ -264,174 +249,157 @@ ) (defmethod ragdoll-method-24 ((this ragdoll) (arg0 vector) (arg1 int)) - (local-vars (v1-85 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (when *debug-segment* - (let ((s3-0 (-> *display* frames (-> *display* on-screen) profile-array data 0)) - (v1-7 'ragdoll-collision) - (s2-0 *color-white*) - ) - (when (and *dproc* *debug-segment*) - (let ((s1-0 (-> s3-0 data (-> s3-0 count)))) - (let ((s0-0 (-> s3-0 base-time))) - (set! (-> s1-0 name) v1-7) - (set! (-> s1-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s0-0)))) - ) - (set! (-> s1-0 depth) (the-as uint (-> s3-0 depth))) - (set! (-> s1-0 color) s2-0) - (set! (-> s3-0 segment (-> s3-0 depth)) s1-0) - ) - (set! (-> s3-0 count) (min 1023 (+ (-> s3-0 count) 1))) - (+! (-> s3-0 depth) 1) - (set! (-> s3-0 max-depth) (max (-> s3-0 max-depth) (-> s3-0 depth))) + (when *debug-segment* + (let ((s3-0 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-7 'ragdoll-collision) + (s2-0 *color-white*) ) + (when (and *dproc* *debug-segment*) + (let ((s1-0 (-> s3-0 data (-> s3-0 count)))) + (let ((s0-0 (-> s3-0 base-time))) + (set! (-> s1-0 name) v1-7) + (set! (-> s1-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s0-0)))) + ) + (set! (-> s1-0 depth) (the-as uint (-> s3-0 depth))) + (set! (-> s1-0 color) s2-0) + (set! (-> s3-0 segment (-> s3-0 depth)) s1-0) + ) + (set! (-> s3-0 count) (min 1023 (+ (-> s3-0 count) 1))) + (+! (-> s3-0 depth) 1) + (set! (-> s3-0 max-depth) (max (-> s3-0 max-depth) (-> s3-0 depth))) ) - 0 - ) - (let ((s4-1 (-> this ragdoll-joints arg1))) - (when (and (logtest? (-> this ragdoll-flags) (ragdoll-flag rf0)) (!= (-> s4-1 coll-rad) 0.0)) - (when (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) - (vector-matrix*! arg0 arg0 (-> this mirror)) - (vector-matrix*! (-> s4-1 position) (-> s4-1 position) (-> this mirror)) - ) - (let ((s2-1 (new 'stack-no-clear 'collide-query)) - (s3-2 (vector-! (new 'stack-no-clear 'vector) arg0 (-> s4-1 position))) - (s1-1 0) - ) - (logclear! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1 rjf3)) - (if (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) - (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1)) - ) - (if (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf3)) - ) - (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) (begin - (.lvf vf1 (&-> s3-2 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-85 vf1) - (let ((f0-13 v1-85) - (f1-4 409.6) - ) - (< f0-13 (* f1-4 f1-4)) - ) - ) - ) - (+! s1-1 1) - (vector-copy! (-> s2-1 start-pos) arg0) - (vector-copy! (-> s2-1 move-dist) s3-2) - (let ((v1-49 s2-1)) - (set! (-> v1-49 radius) (-> s4-1 coll-rad)) - (set! (-> v1-49 collide-with) (the-as collide-spec (-> this bg-collide-with))) - (set! (-> v1-49 ignore-process0) #f) - (set! (-> v1-49 ignore-process1) #f) - (set! (-> v1-49 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-49 action-mask) (collide-action solid)) - ) - (set! (-> s2-1 best-other-prim) #f) - (let ((f30-0 (probe-using-line-sphere *collide-cache* s2-1))) - (cond - ((>= f30-0 0.0) - (cond - ((logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) - ) - ((logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1)) - (set! (-> s4-1 original-speed) (vector-length s3-2)) - (ragdoll-method-23 this (-> s4-1 position) *zero-vector* 1.0 #f) - ) - (else - (set! (-> s4-1 original-speed) (vector-length s3-2)) - (ragdoll-method-23 this (-> s4-1 position) *zero-vector* 1.0 #f) - ) - ) - (set! (-> s4-1 ground-pat) (-> s2-1 best-other-tri pat)) - (let ((f0-7 (fmin 1.0 f30-0))) - (vector+float*! arg0 arg0 s3-2 f0-7) - (vector-float*! s3-2 s3-2 (- 1.0 f0-7)) - ) - (let ((f0-10 (vector-dot s3-2 (-> s2-1 best-other-tri normal)))) - (vector--float*! s3-2 s3-2 (-> s2-1 best-other-tri normal) (* 1.2 f0-10)) - ) - (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) - (vector-float*! (-> s4-1 bounce) (-> s2-1 best-other-tri normal) (-> s4-1 original-speed)) - ) - (else - (vector+! arg0 arg0 s3-2) - (goto cfg-34) - ) - ) - ) - ) - ) - (label cfg-34) - (if (and (not (logtest? (-> this ragdoll-flags) (ragdoll-flag rf11))) - (logtest? (water-flag touch-water) (-> this water-info flags)) - (< (- (-> arg0 y) (-> s4-1 coll-rad)) (-> this water-info base-height)) - ) - (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - ) - (when (and (nonzero? (-> s4-1 hit-sound)) - (or (and (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) - (not (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1 rjf2))) - ) - (and (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - (not (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf3))) - ) - ) - ) - (let ((v1-107 (the int (lerp-scale 0.0 1024.0 (-> s4-1 original-speed) 409.6 2867.2))) - (s3-3 (new 'static 'sound-spec)) - ) - (when (nonzero? v1-107) - (set! (-> s3-3 sound-name) (-> s4-1 hit-sound)) - (set! (-> s3-3 volume) v1-107) - (set! (-> s3-3 reg 0) (the-as uint 0)) - (if (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - (set! (-> s3-3 reg 0) (the-as uint 127)) - (set! (-> s3-3 reg 0) (the-as uint (-> s4-1 ground-pat material))) - ) - (sound-play-by-spec s3-3 (new-sound-id) (-> s4-1 position)) - ) - ) - ) - (when (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) - (vector-matrix*! arg0 arg0 (-> this mirror)) - (vector-matrix*! (-> s4-1 position) (-> s4-1 position) (-> this mirror)) - ) - ) - ) - (when *debug-segment* - (let ((gp-1 (-> *display* frames (-> *display* on-screen) profile-array data 0))) - (when (and *dproc* *debug-segment*) - (let* ((v1-129 (+ (-> gp-1 depth) -1)) - (s5-1 (-> gp-1 segment v1-129)) - (s4-2 (-> gp-1 base-time)) - ) - (when (>= v1-129 0) - (set! (-> s5-1 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-2)))) - (+! (-> gp-1 depth) -1) - ) - ) - ) - ) - 0 ) 0 - (none) ) + (let ((s4-1 (-> this ragdoll-joints arg1))) + (when (and (logtest? (-> this ragdoll-flags) (ragdoll-flag rf0)) (!= (-> s4-1 coll-rad) 0.0)) + (when (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) + (vector-matrix*! arg0 arg0 (-> this mirror)) + (vector-matrix*! (-> s4-1 position) (-> s4-1 position) (-> this mirror)) + ) + (let ((s2-1 (new 'stack-no-clear 'collide-query)) + (s3-2 (vector-! (new 'stack-no-clear 'vector) arg0 (-> s4-1 position))) + (s1-1 0) + ) + (logclear! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1 rjf3)) + (if (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) + (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1)) + ) + (if (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf3)) + ) + (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)) + ) + ) + (+! s1-1 1) + (vector-copy! (-> s2-1 start-pos) arg0) + (vector-copy! (-> s2-1 move-dist) s3-2) + (let ((v1-49 s2-1)) + (set! (-> v1-49 radius) (-> s4-1 coll-rad)) + (set! (-> v1-49 collide-with) (the-as collide-spec (-> this bg-collide-with))) + (set! (-> v1-49 ignore-process0) #f) + (set! (-> v1-49 ignore-process1) #f) + (set! (-> v1-49 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-49 action-mask) (collide-action solid)) + ) + (set! (-> s2-1 best-other-prim) #f) + (let ((f30-0 (probe-using-line-sphere *collide-cache* s2-1))) + (cond + ((>= f30-0 0.0) + (cond + ((logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) + ) + ((logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1)) + (set! (-> s4-1 original-speed) (vector-length s3-2)) + (ragdoll-method-23 this (-> s4-1 position) *zero-vector* 1.0 #f) + ) + (else + (set! (-> s4-1 original-speed) (vector-length s3-2)) + (ragdoll-method-23 this (-> s4-1 position) *zero-vector* 1.0 #f) + ) + ) + (set! (-> s4-1 ground-pat) (-> s2-1 best-other-tri pat)) + (let ((f0-7 (fmin 1.0 f30-0))) + (vector+float*! arg0 arg0 s3-2 f0-7) + (vector-float*! s3-2 s3-2 (- 1.0 f0-7)) + ) + (let ((f0-10 (vector-dot s3-2 (-> s2-1 best-other-tri normal)))) + (vector--float*! s3-2 s3-2 (-> s2-1 best-other-tri normal) (* 1.2 f0-10)) + ) + (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) + (vector-float*! (-> s4-1 bounce) (-> s2-1 best-other-tri normal) (-> s4-1 original-speed)) + ) + (else + (vector+! arg0 arg0 s3-2) + (goto cfg-34) + ) + ) + ) + ) + ) + (label cfg-34) + (if (and (not (logtest? (-> this ragdoll-flags) (ragdoll-flag rf11))) + (logtest? (water-flag touch-water) (-> this water-info flags)) + (< (- (-> arg0 y) (-> s4-1 coll-rad)) (-> this water-info base-height)) + ) + (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + ) + (when (and (nonzero? (-> s4-1 hit-sound)) + (or (and (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) + (not (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1 rjf2))) + ) + (and (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + (not (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf3))) + ) + ) + ) + (let ((v1-107 (the int (lerp-scale 0.0 1024.0 (-> s4-1 original-speed) 409.6 2867.2))) + (s3-3 (new 'static 'sound-spec)) + ) + (when (nonzero? v1-107) + (set! (-> s3-3 sound-name) (-> s4-1 hit-sound)) + (set! (-> s3-3 volume) v1-107) + (set! (-> s3-3 reg 0) (the-as uint 0)) + (if (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + (set! (-> s3-3 reg 0) (the-as uint 127)) + (set! (-> s3-3 reg 0) (the-as uint (-> s4-1 ground-pat material))) + ) + (sound-play-by-spec s3-3 (new-sound-id) (-> s4-1 position)) + ) + ) + ) + (when (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) + (vector-matrix*! arg0 arg0 (-> this mirror)) + (vector-matrix*! (-> s4-1 position) (-> s4-1 position) (-> this mirror)) + ) + ) + ) + (when *debug-segment* + (let ((gp-1 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-129 (+ (-> gp-1 depth) -1)) + (s5-1 (-> gp-1 segment v1-129)) + (s4-2 (-> gp-1 base-time)) + ) + (when (>= v1-129 0) + (set! (-> s5-1 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-2)))) + (+! (-> gp-1 depth) -1) + ) + ) + ) + ) + 0 + ) + 0 + (none) ) (defmethod enable-ragdoll! ((this ragdoll) (proc process-drawable)) @@ -990,7 +958,6 @@ (defmethod ragdoll-method-15 ((this ragdoll) (arg0 process-drawable) (arg1 ragdoll-edit-info)) (local-vars (at-0 int) - (v1-156 float) (f0-14 float) (sv-320 vector) (sv-336 vector) @@ -1229,22 +1196,14 @@ (t9-20 a0-72 a1-23 sv-464 a3-6) ) ) - (let ((a2-12 (vector-! (new 'stack-no-clear 'vector) (-> s2-1 trans) sv-560))) - (.lvf vf1 (&-> a2-12 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-156 vf1) - (let* ((f0-17 v1-156) - (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))) - ) - ) + (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))) + ) ) ) (else diff --git a/goal_src/jak3/engine/physics/rigid-body.gc b/goal_src/jak3/engine/physics/rigid-body.gc index 44f29b6dbc..79b69aa06e 100644 --- a/goal_src/jak3/engine/physics/rigid-body.gc +++ b/goal_src/jak3/engine/physics/rigid-body.gc @@ -147,33 +147,13 @@ ;; WARN: Return type mismatch vector vs none. (defmethod rigid-body-control-method-24 ((this rigid-body-control) (arg0 vector) (arg1 vector)) - (local-vars (t0-5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((v1-0 (new 'stack-no-clear 'inline-array 'vector 2))) - (vector-! (-> v1-0 0) arg0 (-> this position)) - (vector-cross! (-> v1-0 1) (-> this torque) (-> v1-0 0)) - (let ((a1-2 (-> v1-0 1)) - (a3-3 (-> v1-0 1)) - (f0-0 1.0) - ) - (.lvf vf1 (&-> (-> v1-0 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 t0-5 vf1) - (vector-float*! a1-2 a3-3 (/ f0-0 t0-5)) - ) - (vector+! arg1 (-> v1-0 1) (-> this force)) - ) - (none) + (let ((v1-0 (new 'stack-no-clear 'inline-array 'vector 2))) + (vector-! (-> v1-0 0) arg0 (-> this position)) + (vector-cross! (-> v1-0 1) (-> this torque) (-> v1-0 0)) + (vector-float*! (-> v1-0 1) (-> v1-0 1) (/ 1.0 (vector-length-squared (-> v1-0 0)))) + (vector+! arg1 (-> v1-0 1) (-> this force)) ) + (none) ) (defun matrix-3x3-triple-transpose-product ((arg0 matrix) (arg1 matrix) (arg2 matrix)) @@ -188,68 +168,20 @@ ) (defmethod rigid-body-control-method-12 ((this rigid-body-control) (arg0 float)) - (local-vars (v1-6 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (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) ) - (init-vf0-vector) - (let ((a2-0 (-> this lin-momentum))) - (let ((v1-0 (-> this lin-momentum))) - (let ((a0-1 (-> this force))) - (let ((a3-0 arg0)) - (.mov vf7 a3-0) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-0 quad)) + (if (< (* f1-1 f1-1) (vector-length-squared (-> this ang-momentum))) + (vector-normalize! (-> this ang-momentum) f0-3) ) - (.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-0 quad) vf6) - ) - (let ((a2-1 (-> this ang-momentum))) - (let ((v1-1 (-> this ang-momentum))) - (let ((a0-2 (-> this torque))) - (let ((a1-1 arg0)) - (.mov vf7 a1-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-1 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-1 quad) vf6) - ) - (let* ((f0-3 (* 500000000.0 (-> this info mass))) - (f1-1 f0-3) - (f1-3 (* f1-1 f1-1)) - ) - (.lvf vf1 (&-> (-> this ang-momentum) 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-6 vf1) - (if (< f1-3 v1-6) - (vector-normalize! (-> this ang-momentum) f0-3) - ) - ) - (set! (-> this force quad) (the-as uint128 0)) - (set! (-> this torque quad) (the-as uint128 0)) - 0 - 0 - (none) ) + (set! (-> this force quad) (the-as uint128 0)) + (set! (-> this torque quad) (the-as uint128 0)) + 0 + 0 + (none) ) (defmethod init-velocities! ((this rigid-body-control)) @@ -263,44 +195,21 @@ ) (defmethod rigid-body-control-method-14 ((this rigid-body-control) (arg0 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((a1-1 (-> this position))) - (let ((v1-0 (-> this position))) - (let ((a0-1 (-> this lin-velocity))) - (let ((a2-0 arg0)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-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 (&-> a1-1 quad) vf6) - ) - (let ((s4-0 (new 'stack-no-clear 'quaternion))) - (set! (-> (the-as vector (&-> s4-0 x)) quad) (-> this ang-velocity quad)) - (set! (-> s4-0 w) 0.0) - (quaternion*! s4-0 s4-0 (the-as quaternion (-> this rot))) - (quaternion-float*! s4-0 s4-0 0.5) - (+! (-> this rot x) (* (-> s4-0 x) arg0)) - (+! (-> this rot y) (* (-> s4-0 y) arg0)) - (+! (-> this rot z) (* (-> s4-0 z) arg0)) - (+! (-> this rot w) (* (-> s4-0 w) arg0)) - ) - (quaternion-normalize! (the-as quaternion (-> this rot))) - (rigid-body-control-method-26 this) - 0 - (none) + (vector+*! (-> this position) (-> this position) (-> this lin-velocity) arg0) + (let ((s4-0 (new 'stack-no-clear 'quaternion))) + (set! (-> (the-as vector (&-> s4-0 x)) quad) (-> this ang-velocity quad)) + (set! (-> s4-0 w) 0.0) + (quaternion*! s4-0 s4-0 (the-as quaternion (-> this rot))) + (quaternion-float*! s4-0 s4-0 0.5) + (+! (-> this rot x) (* (-> s4-0 x) arg0)) + (+! (-> this rot y) (* (-> s4-0 y) arg0)) + (+! (-> this rot z) (* (-> s4-0 z) arg0)) + (+! (-> this rot w) (* (-> s4-0 w) arg0)) ) + (quaternion-normalize! (the-as quaternion (-> this rot))) + (rigid-body-control-method-26 this) + 0 + (none) ) (defun damping-time-adjust ((arg0 float) (arg1 float)) diff --git a/goal_src/jak3/engine/physics/trajectory.gc b/goal_src/jak3/engine/physics/trajectory.gc index 3fe3fb8769..00803e2ae0 100644 --- a/goal_src/jak3/engine/physics/trajectory.gc +++ b/goal_src/jak3/engine/physics/trajectory.gc @@ -386,47 +386,24 @@ ) (defmethod cubic-curve-method-9 ((this cubic-curve) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (set! (-> this vec 0 quad) (-> arg0 quad)) - (vector-copy! (-> this mat uvec) arg1) - (let ((v1-2 (new 'stack-no-clear 'trajectory))) - (vector-! (-> v1-2 initial-velocity) arg2 arg0) - (vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) 3.0) - (let ((t1-7 (-> v1-2 initial-position))) - (let ((a1-3 (-> v1-2 initial-position))) - (let ((a3-2 arg1)) - (let ((t2-1 -2.0)) - (.mov vf7 t2-1) - ) - (.lvf vf5 (&-> a3-2 quad)) - ) - (.lvf vf4 (&-> a1-3 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 (&-> t1-7 quad) vf6) - ) - (vector-! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3) - (vector-copy! (-> this mat fvec) (-> v1-2 initial-position)) - (vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) -2.0) - (vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg1) - (vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3) - (vector-copy! (-> this mat trans) (-> v1-2 initial-position)) - ) - (dotimes (v1-5 4) - (set! (-> this vec v1-5 w) 0.0) - ) - 0 - (none) + (set! (-> this vec 0 quad) (-> arg0 quad)) + (vector-copy! (-> this mat uvec) arg1) + (let ((v1-2 (new 'stack-no-clear 'trajectory))) + (vector-! (-> v1-2 initial-velocity) arg2 arg0) + (vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) 3.0) + (vector+*! (-> v1-2 initial-position) (-> v1-2 initial-position) arg1 -2.0) + (vector-! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3) + (vector-copy! (-> this mat fvec) (-> v1-2 initial-position)) + (vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) -2.0) + (vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg1) + (vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3) + (vector-copy! (-> this mat trans) (-> v1-2 initial-position)) ) + (dotimes (v1-5 4) + (set! (-> this vec v1-5 w) 0.0) + ) + 0 + (none) ) (defmethod cubic-curve-method-10 ((this cubic-curve) (arg0 vector) (arg1 float)) diff --git a/goal_src/jak3/engine/spatial-hash/collide-hash.gc b/goal_src/jak3/engine/spatial-hash/collide-hash.gc index eb95eb16de..5b2d0837d3 100644 --- a/goal_src/jak3/engine/spatial-hash/collide-hash.gc +++ b/goal_src/jak3/engine/spatial-hash/collide-hash.gc @@ -512,16 +512,7 @@ (/ 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 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 diff --git a/goal_src/jak3/engine/target/board/board-states.gc b/goal_src/jak3/engine/target/board/board-states.gc index 026ba2839e..a249e0cc1d 100644 --- a/goal_src/jak3/engine/target/board/board-states.gc +++ b/goal_src/jak3/engine/target/board/board-states.gc @@ -1572,7 +1572,7 @@ (set! (-> self control transv z) (-> v1-21 z)) ) (vector-xz-normalize! (-> self control transv) (the-as float (-> self control unknown-word04))) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) @@ -2409,11 +2409,11 @@ (ja-channel-push! 1 (seconds 0.04)) (ja :group! jakb-board-turn-around-ja :num! min) (quaternion-rotate-y! (-> self control dir-targ) (-> self control quat-for-control) 32768.0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (until (ja-done? 0) (suspend) (ja :num! (seek! max 1.25)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (set! (-> self control ctrl-xz-vel) (* f30-0 (* (/ (-> self clock frames-per-second) (meters 10)) (-> self align delta trans z))) diff --git a/goal_src/jak3/engine/target/board/target-board.gc b/goal_src/jak3/engine/target/board/target-board.gc index d34d2814c6..04c8721026 100644 --- a/goal_src/jak3/engine/target/board/target-board.gc +++ b/goal_src/jak3/engine/target/board/target-board.gc @@ -494,43 +494,28 @@ ;; WARN: Return type mismatch object vs none. (defbehavior target-board-green-eco-attack target ((arg0 symbol)) - (local-vars (v1-14 float) (v1-25 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (cond - (arg0 - (vector-copy! gp-0 (-> self control trans)) - (set! (-> gp-0 w) 49152.0) - ) - (else - (vector-normalize! (vector-z-quaternion! gp-0 (-> self control quat)) -12288.0) - (vector+! gp-0 gp-0 (-> self control trans)) - (set! (-> gp-0 w) 24576.0) - ) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (cond + (arg0 + (vector-copy! gp-0 (-> self control trans)) + (set! (-> gp-0 w) 49152.0) ) - (let ((s5-1 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s4-0 (fill-actor-list-for-box *actor-hash* gp-0 s5-1 384)) - (let ((v1-10 (as-type (-> s5-1 s4-0) collide-shape))) - (when v1-10 - (let ((a0-11 (as-type (-> v1-10 process) process-focusable))) - (when a0-11 - (when (!= *target* a0-11) - (let ((v1-13 (vector-! (new 'stack-no-clear 'vector) (-> a0-11 root trans) gp-0))) - 0.0 - (.lvf vf1 (&-> v1-13 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-14 vf1) - (let ((f0-3 v1-14) + (else + (vector-normalize! (vector-z-quaternion! gp-0 (-> self control quat)) -12288.0) + (vector+! gp-0 gp-0 (-> self control trans)) + (set! (-> gp-0 w) 24576.0) + ) + ) + (let ((s5-1 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s4-0 (fill-actor-list-for-box *actor-hash* gp-0 s5-1 384)) + (let ((v1-10 (as-type (-> s5-1 s4-0) collide-shape))) + (when v1-10 + (let ((a0-11 (as-type (-> v1-10 process) process-focusable))) + (when a0-11 + (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) @@ -544,20 +529,13 @@ ) ) ) - (let ((s5-2 (the-as target (as-type *target* process-focusable)))) - (when (and s5-2 (< (vector-vector-distance (get-trans s5-2 0) gp-0) (-> gp-0 w))) - (when (!= *target* s5-2) - (let ((v1-24 (vector-! (new 'stack-no-clear 'vector) (-> s5-2 control trans) gp-0))) - 0.0 - (.lvf vf1 (&-> v1-24 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-25 vf1) - (let ((f0-6 v1-25) + ) + (let ((s5-2 (the-as target (as-type *target* process-focusable)))) + (when (and s5-2 (< (vector-vector-distance (get-trans s5-2 0) gp-0) (-> gp-0 w))) + (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) @@ -568,8 +546,8 @@ ) ) ) - (none) ) + (none) ) ;; WARN: Return type mismatch float vs none. diff --git a/goal_src/jak3/engine/target/flut/flut-racer.gc b/goal_src/jak3/engine/target/flut/flut-racer.gc index 6241b27f54..45d53f4554 100644 --- a/goal_src/jak3/engine/target/flut/flut-racer.gc +++ b/goal_src/jak3/engine/target/flut/flut-racer.gc @@ -500,52 +500,37 @@ ) (defmethod nav-enemy-method-187 ((this flut-racer)) - (local-vars (v1-26 float) (v1-40 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((t9-0 (method-of-type nav-enemy nav-enemy-method-187))) - (t9-0 this) + (let ((t9-0 (method-of-type nav-enemy nav-enemy-method-187))) + (t9-0 this) + ) + (let ((s5-0 (new 'stack 'traffic-danger-info))) + (set! (-> s5-0 danger-type) (the-as uint 8)) + (set! (-> s5-0 sphere quad) (-> this root trans quad)) + (set! (-> s5-0 sphere r) 122880.0) + (copy-nav-state-vel! this (-> s5-0 velocity)) + (vector-normalize! (-> s5-0 velocity) 122880.0) + (set! (-> s5-0 danger-level) 0.5) + (set! (-> s5-0 notify-radius) 491520.0) + (set! (-> s5-0 decay-rate) 0.0) + (add-danger *traffic-engine* s5-0) + ) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (vector-normalize! + (vector-z-quaternion! s5-1 (-> this root quat)) + (* (-> this nav target-speed) (seconds-per-frame) (seconds-per-frame)) ) - (let ((s5-0 (new 'stack 'traffic-danger-info))) - (set! (-> s5-0 danger-type) (the-as uint 8)) - (set! (-> s5-0 sphere quad) (-> this root trans quad)) - (set! (-> s5-0 sphere r) 122880.0) - (copy-nav-state-vel! this (-> s5-0 velocity)) - (vector-normalize! (-> s5-0 velocity) 122880.0) - (set! (-> s5-0 danger-level) 0.5) - (set! (-> s5-0 notify-radius) 491520.0) - (set! (-> s5-0 decay-rate) 0.0) - (add-danger *traffic-engine* s5-0) - ) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (vector-normalize! - (vector-z-quaternion! s5-1 (-> this root quat)) - (* (-> this nav target-speed) (seconds-per-frame) (seconds-per-frame)) - ) - (vector+! s5-1 s5-1 (-> this root trans)) - (set! (-> s5-1 w) 16384.0) - (let ((s4-1 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s3-0 (fill-actor-list-for-box *actor-hash* s5-1 s4-1 384)) - (let ((v1-21 (as-type (-> s4-1 s3-0) collide-shape))) - (when v1-21 - (let ((s2-1 (as-type (-> v1-21 process) process-focusable))) - (when s2-1 - (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 - (.lvf vf1 (&-> v1-25 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) - (let ((f0-10 v1-26) + (vector+! s5-1 s5-1 (-> this root trans)) + (set! (-> s5-1 w) 16384.0) + (let ((s4-1 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s3-0 (fill-actor-list-for-box *actor-hash* s5-1 s4-1 384)) + (let ((v1-21 (as-type (-> s4-1 s3-0) collide-shape))) + (when v1-21 + (let ((s2-1 (as-type (-> v1-21 process) process-focusable))) + (when s2-1 + (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) @@ -562,20 +547,13 @@ ) ) ) - (let ((s4-2 (the-as target (as-type *target* process-focusable)))) - (when (and s4-2 (< (vector-vector-distance (get-trans s4-2 0) s5-1) (-> s5-1 w))) - (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 - (.lvf vf1 (&-> v1-39 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-40 vf1) - (let ((f0-13 v1-40) + ) + (let ((s4-2 (the-as target (as-type *target* process-focusable)))) + (when (and s4-2 (< (vector-vector-distance (get-trans s4-2 0) s5-1) (-> s5-1 w))) + (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) @@ -589,8 +567,8 @@ ) ) ) - (none) ) + (none) ) (defmethod init-enemy! ((this flut-racer)) diff --git a/goal_src/jak3/engine/target/flut/target-flut.gc b/goal_src/jak3/engine/target/flut/target-flut.gc index ea37196063..2f9b4de0c6 100644 --- a/goal_src/jak3/engine/target/flut/target-flut.gc +++ b/goal_src/jak3/engine/target/flut/target-flut.gc @@ -338,242 +338,136 @@ ) (defun flut-leg-ik-callback ((arg0 joint-mod-ik) (arg1 object) (arg2 object) (arg3 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 arg3) - (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) - (if (< 6144.0 f0-1) - (set! f0-1 6144.0) - ) - (if (< f0-1 -6144.0) - (set! f0-1 -6144.0) - ) - (+! (-> arg0 user-position y) f0-1) - ) - (let ((f0-4 (- (-> arg3 y) (-> arg0 user-position y)))) - (seek! (-> arg0 user-float) f0-4 (* 40960.0 (seconds-per-frame))) - ) - (let* ((f28-0 (-> arg0 user-float)) - (f30-1 (lerp-scale 1.0 0.0 f28-0 0.0 12288.0)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-12 s5-0)) - (let ((a0-4 *up-vector*)) - (let ((a1-4 8192.0)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-4 quad)) - ) - (.lvf vf4 (&-> v1-12 quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 arg3) + (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) + (if (< 6144.0 f0-1) + (set! f0-1 6144.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 (&-> s3-0 quad) vf6) - (vector-float*! (new 'stack-no-clear 'vector) *up-vector* -16384.0) - (let ((s2-0 (new 'stack-no-clear 'vector))) - 0.0 - (let ((f0-11 (intersect-ray-plane s3-0 *up-vector* (-> arg0 user-position) *up-vector*)) - (a0-7 s2-0) - ) - (let ((v1-15 *up-vector*)) - (let ((a1-7 f0-11)) - (.mov vf7 a1-7) - ) - (.lvf vf5 (&-> v1-15 quad)) - ) - (.lvf vf4 (&-> s3-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-7 quad) vf6) - ) - (let ((a0-8 s2-0)) - (let ((v1-16 *up-vector*)) - (let ((a1-8 (- f28-0))) - (.mov vf7 a1-8) - ) - (.lvf vf5 (&-> v1-16 quad)) - ) - (.lvf vf4 (&-> arg3 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-8 quad) vf6) - ) - (let ((a1-9 s5-0)) - (let ((v1-17 s5-0)) - (let ((a0-10 (vector-! (new 'stack-no-clear 'vector) s2-0 s5-0))) - (let ((a2-6 (fmin 1.0 (* (-> arg0 user-blend) f30-1)))) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-10 quad)) - ) - (.lvf vf4 (&-> v1-17 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-9 quad) vf6) - ) + (if (< f0-1 -6144.0) + (set! f0-1 -6144.0) ) - ) - (set-ik-target! arg0 s5-0) + (+! (-> arg0 user-position y) f0-1) ) - (none) + (let ((f0-4 (- (-> arg3 y) (-> arg0 user-position y)))) + (seek! (-> arg0 user-float) f0-4 (* 40960.0 (seconds-per-frame))) + ) + (let* ((f28-0 (-> arg0 user-float)) + (f30-1 (lerp-scale 1.0 0.0 f28-0 0.0 12288.0)) + (s3-1 (vector+*! (new 'stack-no-clear 'vector) s5-0 *up-vector* 8192.0)) + ) + (vector-float*! (new 'stack-no-clear 'vector) *up-vector* -16384.0) + (let ((s2-0 (new 'stack-no-clear 'vector))) + 0.0 + (let ((f0-11 (intersect-ray-plane s3-1 *up-vector* (-> arg0 user-position) *up-vector*))) + (vector+*! s2-0 s3-1 *up-vector* f0-11) + ) + (vector+*! s2-0 arg3 *up-vector* (- f28-0)) + (vector+*! + s5-0 + s5-0 + (vector-! (new 'stack-no-clear 'vector) s2-0 s5-0) + (fmin 1.0 (* (-> arg0 user-blend) f30-1)) + ) + ) + ) + (set-ik-target! arg0 s5-0) ) + (none) ) ;; WARN: Return type mismatch int vs object. (defbehavior flut-update-ik target () (local-vars (sv-720 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'collide-query)) - (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) + ) + (let ((a1-0 (-> gp-0 bbox)) + (v1-2 (-> s5-0 trans)) + (a0-0 (new 'stack-no-clear 'vector)) ) - (let ((a1-0 (-> gp-0 bbox)) - (v1-2 (-> s5-0 trans)) - (a0-0 (new 'stack-no-clear 'vector)) - ) - (set! (-> a0-0 x) 10240.0) - (set! (-> a0-0 y) 10240.0) - (set! (-> a0-0 z) 10240.0) - (set! (-> a0-0 w) 1.0) - (vector-! (-> a1-0 min) v1-2 a0-0) - ) - (let ((a1-2 (-> gp-0 bbox max)) - (v1-3 (-> s5-0 trans)) - (a0-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> a0-1 x) 10240.0) - (set! (-> a0-1 y) 10240.0) - (set! (-> a0-1 z) 10240.0) - (set! (-> a0-1 w) 1.0) - (vector+! a1-2 v1-3 a0-1) - ) - (set! (-> gp-0 collide-with) (-> (the-as collide-shape s5-0) root-prim prim-core collide-with)) - (set! (-> gp-0 ignore-process0) #f) - (set! (-> gp-0 ignore-process1) #f) - (set! (-> gp-0 ignore-pat) (-> (the-as collide-shape s5-0) pat-ignore-mask)) - (fill-using-bounding-box *collide-cache* gp-0) - (dotimes (s4-0 2) - (let ((s3-0 (-> self mech-ik s4-0))) - #t - (set! (-> s3-0 callback) (the-as (function joint-mod-ik matrix matrix vector object) flut-leg-ik-callback)) - (let ((a1-6 (not (logtest? (target-flags lleg-no-ik rleg-no-ik) (-> *target* target-flags))))) - (enable-set! s3-0 a1-6) - ) - (-> s3-0 shoulder-matrix-no-ik) - (let ((v1-17 (-> s3-0 elbow-matrix-no-ik)) - (s0-0 (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) + (set! (-> a0-0 x) 10240.0) + (set! (-> a0-0 y) 10240.0) + (set! (-> a0-0 z) 10240.0) + (set! (-> a0-0 w) 1.0) + (vector-! (-> a1-0 min) v1-2 a0-0) + ) + (let ((a1-2 (-> gp-0 bbox max)) + (v1-3 (-> s5-0 trans)) + (a0-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-1 x) 10240.0) + (set! (-> a0-1 y) 10240.0) + (set! (-> a0-1 z) 10240.0) + (set! (-> a0-1 w) 1.0) + (vector+! a1-2 v1-3 a0-1) + ) + (set! (-> gp-0 collide-with) (-> (the-as collide-shape s5-0) root-prim prim-core collide-with)) + (set! (-> gp-0 ignore-process0) #f) + (set! (-> gp-0 ignore-process1) #f) + (set! (-> gp-0 ignore-pat) (-> (the-as collide-shape s5-0) pat-ignore-mask)) + (fill-using-bounding-box *collide-cache* gp-0) + (dotimes (s4-0 2) + (let ((s3-0 (-> self mech-ik s4-0))) + #t + (set! (-> s3-0 callback) (the-as (function joint-mod-ik matrix matrix vector object) flut-leg-ik-callback)) + (let ((a1-6 (not (logtest? (target-flags lleg-no-ik rleg-no-ik) (-> *target* target-flags))))) + (enable-set! s3-0 a1-6) + ) + (-> s3-0 shoulder-matrix-no-ik) + (let ((v1-17 (-> s3-0 elbow-matrix-no-ik)) + (s0-0 (new 'stack-no-clear 'vector)) ) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (new 'stack-no-clear 'vector) - (let ((s1-0 (new 'stack-no-clear 'vector))) - (let ((a1-8 s0-0)) - (let ((a0-11 (-> v1-17 trans))) - (let ((v1-18 (-> v1-17 uvec))) - (let ((a2-8 (-> s3-0 hand-dist))) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> v1-18 quad)) + (set! sv-720 (new 'stack-no-clear 'vector)) + (let ((a0-8 (-> *y-vector* quad))) + (set! (-> sv-720 quad) a0-8) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (vector+*! s0-0 (-> v1-17 trans) (-> v1-17 uvec) (-> s3-0 hand-dist)) + (let ((f0-11 + (lerp-scale 1.0 0.0 (- (-> s0-0 y) (-> (the-as collide-shape-moving s5-0) gspot-pos y)) 2048.0 12288.0) ) - (.lvf vf4 (&-> a0-11 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-8 quad) vf6) - ) - (let ((f0-11 - (lerp-scale 1.0 0.0 (- (-> s0-0 y) (-> (the-as collide-shape-moving s5-0) gspot-pos y)) 2048.0 12288.0) - ) - ) - (seek! (-> s3-0 user-blend) f0-11 (* 4.0 (seconds-per-frame))) - ) - (let ((a1-11 (-> gp-0 start-pos))) - (let ((v1-22 s0-0)) - (let ((a0-14 sv-720)) - (let ((a2-12 6144.0)) - (.mov vf7 a2-12) - ) - (.lvf vf5 (&-> a0-14 quad)) - ) - (.lvf vf4 (&-> v1-22 quad)) + (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) ) - (.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-11 quad) vf6) - ) - (let ((v1-23 (-> gp-0 move-dist)) - (f0-16 -20480.0) + (vector-float*! v1-23 sv-720 f0-16) + ) + (let ((v1-25 gp-0)) + (set! (-> v1-25 radius) 4.096) + (set! (-> v1-25 collide-with) (-> gp-0 collide-with)) + (set! (-> v1-25 ignore-process0) #f) + (set! (-> v1-25 ignore-process1) #f) + (set! (-> v1-25 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (vector-float*! v1-23 sv-720 f0-16) - ) - (let ((v1-25 gp-0)) - (set! (-> v1-25 radius) 4.096) - (set! (-> v1-25 collide-with) (-> gp-0 collide-with)) - (set! (-> v1-25 ignore-process0) #f) - (set! (-> v1-25 ignore-process1) #f) - (set! (-> v1-25 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-25 action-mask) (collide-action solid)) - ) - (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) - (cond - ((>= f30-0 0.0) - (vector-copy! s1-0 (-> gp-0 best-other-tri normal)) - (when (< 8192.0 (vector-vector-angle-safe *y-vector* s1-0)) - (let* ((a1-16 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s1-0) 1.0)) - (a2-14 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-16 8192.0)) - ) - (vector-orient-by-quat! s1-0 *y-vector* a2-14) - ) + (set! (-> v1-25 action-mask) (collide-action solid)) + ) + (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) + (cond + ((>= f30-0 0.0) + (vector-copy! s1-0 (-> gp-0 best-other-tri normal)) + (when (< 8192.0 (vector-vector-angle-safe *y-vector* s1-0)) + (let* ((a1-18 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s1-0) 1.0)) + (a2-12 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-18 8192.0)) + ) + (vector-orient-by-quat! s1-0 *y-vector* a2-12) ) - (let ((a1-18 s2-0)) - (let ((v1-32 (-> gp-0 start-pos))) - (let ((a0-29 (-> gp-0 move-dist))) - (let ((a2-15 f30-0)) - (.mov vf7 a2-15) - ) - (.lvf vf5 (&-> a0-29 quad)) - ) - (.lvf vf4 (&-> v1-32 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) - ) - (vector-copy! (-> s3-0 user-position) s2-0) - (vector-copy! (-> s3-0 user-normal) s1-0) ) - (else - (set! (-> s0-0 y) (-> (target-pos 0) y)) - (vector-copy! (-> s3-0 user-position) s0-0) - (vector-copy! (-> s3-0 user-normal) *y-vector*) - ) + (vector+*! s2-0 (-> gp-0 start-pos) (-> gp-0 move-dist) f30-0) + (vector-copy! (-> s3-0 user-position) s2-0) + (vector-copy! (-> s3-0 user-normal) s1-0) + ) + (else + (set! (-> s0-0 y) (-> (target-pos 0) y)) + (vector-copy! (-> s3-0 user-position) s0-0) + (vector-copy! (-> s3-0 user-normal) *y-vector*) ) ) ) @@ -582,8 +476,8 @@ ) ) ) - 0 ) + 0 ) (defbehavior target-flut-get-off? target () @@ -805,7 +699,7 @@ (ja-channel-set! 1) (ja-no-eval :group! jakb-flut-air-attack-land-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) @@ -2362,7 +2256,7 @@ ) ) (until (or (ja-done? 0) (< f30-0 0.05)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (not (ja-min? 0)) (cond ((and (>= (ja-aframe-num 0) 20.0) @@ -2426,7 +2320,7 @@ ) (ja-no-eval :group! jakb-flut-running-attack-end-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 f30-0) (suspend) (ja :num! (seek!)) @@ -2536,14 +2430,14 @@ (ja-channel-push! 1 (seconds 0.05)) (ja-no-eval :group! jakb-flut-air-attack-ja :num! (seek! (ja-aframe 8.0 0)) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) (suspend) (ja :num! (seek! (ja-aframe 8.0 0))) ) (ja-no-eval :group! jakb-flut-air-attack-ja :num! (seek!) :frame-num (ja-aframe 8.0 0)) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) @@ -2611,7 +2505,7 @@ (ja-channel-set! 1) (ja-no-eval :group! jakb-flut-air-attack-land-ja :num! (seek! (ja-aframe 22.0 0)) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) (suspend) (ja :num! (seek! (ja-aframe 22.0 0))) @@ -2619,7 +2513,7 @@ (target-danger-set! 'harmless #f) (ja-no-eval :group! jakb-flut-air-attack-land-ja :num! (seek!) :frame-num (ja-aframe 22.0 0)) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) @@ -3128,7 +3022,7 @@ (ja-no-eval :group! a1-48 :num! (seek!) :frame-num 0.0) ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (let ((s5-13 (new 'stack-no-clear 'vector))) (when (not (logtest? (-> self align flags) (align-flags disabled))) (vector-matrix*! s5-13 (-> self align delta trans) (-> self control c-R-w)) @@ -3238,7 +3132,7 @@ (ja-no-eval :group! a1-52 :num! (seek!) :frame-num 0.0) ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (let ((s5-14 (new 'stack-no-clear 'vector))) (when (not (logtest? (-> self align flags) (align-flags disabled))) (vector-matrix*! s5-14 (-> self align delta trans) (-> self control c-R-w)) 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 0d0ca9832b..c889586752 100644 --- a/goal_src/jak3/engine/target/gun/gun-blue-shot.gc +++ b/goal_src/jak3/engine/target/gun/gun-blue-shot.gc @@ -264,12 +264,7 @@ ) (vector-cross! s2-0 (-> s3-0 vec-to-target) (-> s3-0 current-dir-vec)) (vector-normalize! s2-0 1.0) - (vector-rotate-around-axis! - (-> s3-0 current-dir-vec) - (the-as quaternion (-> s3-0 current-dir-vec)) - (* -1.0 f22-1) - s2-0 - ) + (vector-rotate-around-axis! (-> s3-0 current-dir-vec) (-> s3-0 current-dir-vec) (* -1.0 f22-1) s2-0) ) ) ) @@ -857,7 +852,7 @@ (.svf (&-> v1-20 quad) vf3) ) (vector-normalize! sv-80 1.0) - (vector-rotate-around-axis! sv-96 (the-as quaternion sv-96) f28-1 sv-80) + (vector-rotate-around-axis! sv-96 sv-96 f28-1 sv-80) ) ) (vector-normalize! sv-96 1.0) @@ -1942,7 +1937,7 @@ (the float (sar (shl (the int (+ (-> this sway-angle) (* 5461.3335 (the float s5-4)))) 48) 48)) (vector-rotate-around-axis! (-> s4-1 uvec) - (the-as quaternion (-> s4-1 uvec)) + (-> s4-1 uvec) f0-9 (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-4))) ) @@ -2067,7 +2062,7 @@ 5461.3335 (vector-cross! s5-1 sv-800 sv-776) (vector-normalize! s5-1 1.0) - (vector-rotate-around-axis! sv-800 (the-as quaternion sv-776) f28-0 s5-1) + (vector-rotate-around-axis! sv-800 sv-776 f28-0 s5-1) ) ) ) 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 688511a652..f3c38a8ad5 100644 --- a/goal_src/jak3/engine/target/gun/gun-dark-shot.gc +++ b/goal_src/jak3/engine/target/gun/gun-dark-shot.gc @@ -2411,7 +2411,7 @@ (v1-39 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-40 (the-as number (logior #x3f800000 v1-39))) ) - (s3-1 s2-2 (the-as quaternion s1-0) (+ f30-0 (* f28-0 (+ -1.0 (the-as float v1-40)))) *up-vector*) + (s3-1 s2-2 s1-0 (+ f30-0 (* f28-0 (+ -1.0 (the-as float v1-40)))) *up-vector*) ) (let ((f0-18 (/ (-> self obj-radius) (meters 4)))) 0.0 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 07fff71497..91152d6c09 100644 --- a/goal_src/jak3/engine/target/gun/gun-red-shot.gc +++ b/goal_src/jak3/engine/target/gun/gun-red-shot.gc @@ -210,68 +210,53 @@ ) (defmethod find-and-damage-targets ((this gun-red-3-grenade)) - (local-vars (v1-21 float) (v1-45 float)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector)) - (a1-0 (new 'stack-no-clear 'event-message-block)) - ) - (set! (-> a1-0 from) (process->ppointer pp)) - (set! (-> a1-0 num-params) 0) - (set! (-> a1-0 message) 'get-vehicle) - (let ((s4-0 (send-event-function *target* a1-0))) - (vector-copy! s5-0 (-> this root trans)) - (set! (-> s5-0 w) (-> this blast-radius)) - (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s2-0 (fill-actor-list-for-box *actor-hash* s5-0 s3-0 384)) - (let ((a0-8 (as-type (-> s3-0 s2-0) collide-shape))) - (when a0-8 - (let ((s1-1 (as-type (-> a0-8 process) process-focusable))) - (when s1-1 - (when (and (!= s4-0 s1-1) - (not (focus-test? (the-as process-focusable s1-1) disable dead inactive)) - (pc-check-focus-fix (the-as process-focusable s1-1)) ;; og:preserve-this - (logtest? (process-mask crate enemy guard vehicle civilian) (-> s1-1 mask)) - (nonzero? (-> (the-as process-focusable s1-1) root root-prim prim-core collide-with)) - ) - (+! (-> *game-info* shots-hit 1) 1.0) - (let ((s0-2 - (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s1-1) 3) (-> this root trans)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (a1-0 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-0 from) (process->ppointer pp)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'get-vehicle) + (let ((s4-0 (send-event-function *target* a1-0))) + (vector-copy! s5-0 (-> this root trans)) + (set! (-> s5-0 w) (-> this blast-radius)) + (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s2-0 (fill-actor-list-for-box *actor-hash* s5-0 s3-0 384)) + (let ((a0-8 (as-type (-> s3-0 s2-0) collide-shape))) + (when a0-8 + (let ((s1-1 (as-type (-> a0-8 process) process-focusable))) + (when s1-1 + (when (and (!= s4-0 s1-1) + (not (focus-test? (the-as process-focusable s1-1) disable dead inactive)) + (pc-check-focus-fix (the-as process-focusable s1-1)) ;; og:preserve-this + (logtest? (process-mask crate enemy guard vehicle civilian) (-> s1-1 mask)) + (nonzero? (-> (the-as process-focusable s1-1) root root-prim prim-core collide-with)) + ) + (+! (-> *game-info* shots-hit 1) 1.0) + (let ((s0-2 + (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s1-1) 3) (-> this root trans)) + ) + ) + 0.0 + (let ((f0-4 (vector-length-squared s0-2)) + (f1-1 (-> this blast-radius)) + ) + (if (>= (* f1-1 f1-1) f0-4) + (send-event + s1-1 + 'attack + #f + (static-attack-info :mask (vehicle-impulse-factor) ((id (-> this attack-id)) + (damage 12.0) + (vehicle-damage-factor 3.0) + (vehicle-impulse-factor 1.0) + (mode 'explode) + (attacker-velocity s0-2) + (penetrate-using (penetrate explode)) + ) + ) ) ) - 0.0 - (.lvf vf1 (&-> s0-2 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-21 vf1) - (let ((f0-4 v1-21) - (f1-1 (-> this blast-radius)) - ) - (if (>= (* f1-1 f1-1) f0-4) - (send-event - s1-1 - 'attack - #f - (static-attack-info :mask (vehicle-impulse-factor) ((id (-> this attack-id)) - (damage 12.0) - (vehicle-damage-factor 3.0) - (vehicle-impulse-factor 1.0) - (mode 'explode) - (attacker-velocity s0-2) - (penetrate-using (penetrate explode)) - ) - ) - ) - ) - ) ) ) ) @@ -280,44 +265,37 @@ ) ) ) - (let ((s3-1 (the-as target (as-type *target* process-focusable)))) - (when (and s3-1 (< (vector-vector-distance (get-trans s3-1 0) s5-0) (-> s5-0 w))) - (when (and (!= s4-0 s3-1) - (not (focus-test? s3-1 disable dead inactive)) - (pc-check-focus-fix (the-as process-focusable s3-1)) ;; og:preserve-this - (logtest? (process-mask crate enemy guard vehicle civilian) (-> s3-1 mask)) - (nonzero? (-> s3-1 control root-prim prim-core collide-with)) - ) - (+! (-> *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 - (.lvf vf1 (&-> s5-2 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-45 vf1) - (let ((f0-12 v1-45) - (f1-6 (-> this blast-radius)) + ) + (let ((s3-1 (the-as target (as-type *target* process-focusable)))) + (when (and s3-1 (< (vector-vector-distance (get-trans s3-1 0) s5-0) (-> s5-0 w))) + (when (and (!= s4-0 s3-1) + (not (focus-test? s3-1 disable dead inactive)) + (pc-check-focus-fix (the-as process-focusable s3-1)) ;; og:preserve-this + (logtest? (process-mask crate enemy guard vehicle civilian) (-> s3-1 mask)) + (nonzero? (-> s3-1 control root-prim prim-core collide-with)) + ) + (+! (-> *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) + (send-event + s3-1 + 'attack + #f + (static-attack-info :mask (vehicle-impulse-factor) ((id (-> this attack-id)) + (damage 12.0) + (vehicle-damage-factor 3.0) + (vehicle-impulse-factor 1.0) + (mode 'explode) + (attacker-velocity s5-2) + (penetrate-using (penetrate explode)) + ) + ) ) - (if (>= (* f1-6 f1-6) f0-12) - (send-event - s3-1 - 'attack - #f - (static-attack-info :mask (vehicle-impulse-factor) ((id (-> this attack-id)) - (damage 12.0) - (vehicle-damage-factor 3.0) - (vehicle-impulse-factor 1.0) - (mode 'explode) - (attacker-velocity s5-2) - (penetrate-using (penetrate explode)) - ) - ) - ) - ) - ) + ) ) ) ) @@ -929,126 +907,98 @@ (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)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (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)) - ) - ) - ) - (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 - ) + (if (>= (-> this next-computed-collision-point) (-> this num-collision-pts-to-generate)) + (return 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) - (let ((v1-33 sv-612)) - (let ((a0-17 (-> sv-560 start-pos))) - (let ((a1-7 (-> sv-560 move-dist))) - (let ((a2-0 f0-25)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a1-7 quad)) - ) - (.lvf vf4 (&-> a0-17 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-33 quad) vf6) + (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)) + ) ) - (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))) - ) + ) + (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))) ) - (-> 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) + (-> sv-560 best-other-tri normal quad) ) - (vector-normalize! s5-1 1.0) - (dotimes (s2-1 4) - (vector-rotate-around-axis! - s4-0 - (the-as quaternion 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-59 sv-560)) - (set! (-> v1-59 radius) 40.96) - (set! (-> v1-59 collide-with) (collide-spec backgnd hit-by-others-list pusher impenetrable-obj)) - (set! (-> v1-59 ignore-process0) #f) - (set! (-> v1-59 ignore-process1) #f) - (set! (-> v1-59 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-59 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) + (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) + ) + (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) ) ) ) ) - (label cfg-11) - (let ((v0-0 (+ (-> this next-computed-collision-point) 1))) - (set! (-> this next-computed-collision-point) v0-0) - v0-0 - ) + ) + (label cfg-11) + (let ((v0-0 (+ (-> this next-computed-collision-point) 1))) + (set! (-> this next-computed-collision-point) v0-0) + v0-0 ) ) @@ -1922,85 +1872,63 @@ ;; WARN: Return type mismatch (pointer process) vs object. (defbehavior gun-fire-red-1 target () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (-> self gun))) - (let ((s5-0 (-> *part-id-table* 216))) - (get-field-spec-by-id s5-0 (sp-field-id spt-omega)) - (let ((s5-1 (get-field-spec-by-id s5-0 (sp-field-id spt-rotate-y)))) - (if s5-1 - (set! (-> s5-1 initial-valuef) (y-angle (-> self control))) - ) - ) - ) - (launch-particles (-> *part-id-table* 216) (-> gp-0 fire-point)) - (let ((s5-2 (new 'stack-no-clear 'vector))) - (let ((v1-10 (-> gp-0 fire-point))) - (let ((a0-4 (-> gp-0 fire-dir-out))) - (let ((a1-4 24576.0)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-4 quad)) + (let ((gp-0 (-> self gun))) + (let ((s5-0 (-> *part-id-table* 216))) + (get-field-spec-by-id s5-0 (sp-field-id spt-omega)) + (let ((s5-1 (get-field-spec-by-id s5-0 (sp-field-id spt-rotate-y)))) + (if s5-1 + (set! (-> s5-1 initial-valuef) (y-angle (-> self control))) ) - (.lvf vf4 (&-> v1-10 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 (&-> s5-2 quad) vf6) - (set! (-> s5-2 w) 24576.0) - (when (and (sphere-in-view-frustum? (the-as sphere s5-2)) - (< 24576.0 (vector-vector-distance s5-2 (math-camera-pos))) - ) - (let ((s5-3 - (process-spawn - manipy - :init manipy-init - (-> gp-0 fire-point) - (-> self entity) - (art-group-get-by-name *level* "skel-gun-red-cone" (the-as (pointer level) #f)) - #f - 0 - :name "manipy" - :to self - :stack-size #x20000 - ) + ) + ) + (launch-particles (-> *part-id-table* 216) (-> gp-0 fire-point)) + (let ((s5-3 (vector+*! (new 'stack-no-clear 'vector) (-> gp-0 fire-point) (-> gp-0 fire-dir-out) 24576.0))) + (set! (-> s5-3 w) 24576.0) + (when (and (sphere-in-view-frustum? (the-as sphere s5-3)) + (< 24576.0 (vector-vector-distance s5-3 (math-camera-pos))) + ) + (let ((s5-4 + (process-spawn + manipy + :init manipy-init + (-> gp-0 fire-point) + (-> self entity) + (art-group-get-by-name *level* "skel-gun-red-cone" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 ) ) - (when s5-3 - (send-event (ppointer->process s5-3) 'anim-mode 'play1) - (send-event (ppointer->process s5-3) 'anim "idle") - (forward-up->quaternion (-> (the-as manipy (-> s5-3 0)) root quat) (-> gp-0 fire-dir-out) *up-vector*) - (let ((f30-1 - (vector-dot - (-> gp-0 fire-dir-out) - (vector-! (new 'stack-no-clear 'vector) (-> gp-0 fire-point) (math-camera-pos)) - ) + ) + (when s5-4 + (send-event (ppointer->process s5-4) 'anim-mode 'play1) + (send-event (ppointer->process s5-4) 'anim "idle") + (forward-up->quaternion (-> (the-as manipy (-> s5-4 0)) root quat) (-> gp-0 fire-dir-out) *up-vector*) + (let ((f30-1 + (vector-dot + (-> gp-0 fire-dir-out) + (vector-! (new 'stack-no-clear 'vector) (-> gp-0 fire-point) (math-camera-pos)) ) - (f0-5 (vector-vector-xz-distance (-> gp-0 fire-point) (math-camera-pos))) ) - (when (and (< f30-1 0.0) (< f0-5 32768.0)) - (set! (-> (the-as manipy (-> s5-3 0)) root scale z) (lerp-scale 0.2 1.0 (fabs f0-5) 20480.0 32768.0)) - (set! (-> (the-as manipy (-> s5-3 0)) root scale x) (-> (the-as manipy (-> s5-3 0)) root scale z)) + (f0-5 (vector-vector-xz-distance (-> gp-0 fire-point) (math-camera-pos))) ) + (when (and (< f30-1 0.0) (< f0-5 32768.0)) + (set! (-> (the-as manipy (-> s5-4 0)) root scale z) (lerp-scale 0.2 1.0 (fabs f0-5) 20480.0 32768.0)) + (set! (-> (the-as manipy (-> s5-4 0)) root scale x) (-> (the-as manipy (-> s5-4 0)) root scale z)) ) ) ) ) ) - (process-spawn - gun-red-shot - (-> gp-0 fire-point) - (-> gp-0 fire-dir-out) - :name "gun-red-shot" - :to (ppointer->process (-> gp-0 gun)) - ) + ) + (process-spawn + gun-red-shot + (-> gp-0 fire-point) + (-> gp-0 fire-dir-out) + :name "gun-red-shot" + :to (ppointer->process (-> gp-0 gun)) ) ) ) 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 86c44f77c9..ef2f5af444 100644 --- a/goal_src/jak3/engine/target/gun/gun-yellow-shot.gc +++ b/goal_src/jak3/engine/target/gun/gun-yellow-shot.gc @@ -1059,63 +1059,41 @@ ) (defmethod projectile-method-25 ((this gun-yellow-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((s4-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (gp-1 (vector-! (new 'stack-no-clear 'vector) s4-0 a1-0)) ) - (init-vf0-vector) - (let* ((s4-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (gp-1 (vector-! (new 'stack-no-clear 'vector) s4-0 a1-0)) - ) - (let ((f30-0 (vector-length gp-1))) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 gp-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s3-0 quad) vf6) - (draw-main-shot this a1-0 gp-1) - (vector-normalize! gp-1 1.0) - (spawn-particles this s3-0) - ) - (let ((s3-1 (new 'stack-no-clear 'matrix)) - (f30-1 (fmin 1.0 (/ f30-0 (meters 16)))) - (f28-0 (-> *part-id-table* 267 init-specs 3 initial-valuef)) - ) - (forward-up->inv-matrix s3-1 gp-1 *up-vector*) - (vector-copy! (-> s3-1 trans) s4-0) - (gun-yellow-shot-method-42 this f30-1 f28-0 s3-1) - ) + (let ((f30-0 (vector-length gp-1))) + (let ((s3-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 gp-1 0.8))) + (draw-main-shot this a1-0 gp-1) + (vector-normalize! gp-1 1.0) + (spawn-particles this s3-1) ) - (let ((f0-3 (vector-dot gp-1 (-> (camera-matrix) fvec)))) - (when (< 0.0 f0-3) - (let ((f2-0 (* f0-3 f0-3)) - (f0-4 (-> *part-id-table* 266 init-specs 8 initial-valuef)) - (f1-3 (-> *part-id-table* 266 init-specs 8 random-rangef)) - ) - (set! (-> *part-id-table* 266 init-specs 8 initial-valuef) (* f0-4 f2-0)) - (set! (-> *part-id-table* 266 init-specs 8 random-rangef) (* f1-3 f2-0)) - (set! (-> *part-id-table* 266 init-specs 8 initial-valuef) f0-4) - (set! (-> *part-id-table* 266 init-specs 8 random-rangef) f1-3) + (let ((s3-2 (new 'stack-no-clear 'matrix)) + (f30-1 (fmin 1.0 (/ f30-0 (meters 16)))) + (f28-0 (-> *part-id-table* 267 init-specs 3 initial-valuef)) ) + (forward-up->inv-matrix s3-2 gp-1 *up-vector*) + (vector-copy! (-> s3-2 trans) s4-0) + (gun-yellow-shot-method-42 this f30-1 f28-0 s3-2) + ) + ) + (let ((f0-3 (vector-dot gp-1 (-> (camera-matrix) fvec)))) + (when (< 0.0 f0-3) + (let ((f2-0 (* f0-3 f0-3)) + (f0-4 (-> *part-id-table* 266 init-specs 8 initial-valuef)) + (f1-3 (-> *part-id-table* 266 init-specs 8 random-rangef)) + ) + (set! (-> *part-id-table* 266 init-specs 8 initial-valuef) (* f0-4 f2-0)) + (set! (-> *part-id-table* 266 init-specs 8 random-rangef) (* f1-3 f2-0)) + (set! (-> *part-id-table* 266 init-specs 8 initial-valuef) f0-4) + (set! (-> *part-id-table* 266 init-specs 8 random-rangef) f1-3) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod deal-damage! ((this gun-yellow-shot) (arg0 process) (arg1 event-message-block)) @@ -1960,49 +1938,27 @@ ) (defmethod projectile-method-25 ((this gun-yellow-shot-2)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((s5-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-0 a1-0)) + (f30-0 (vector-length s4-1)) ) - (init-vf0-vector) - (let* ((s5-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-0 a1-0)) - (f30-0 (vector-length s4-1)) - ) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s4-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s3-0 quad) vf6) - (draw-main-shot this a1-0 s4-1) - (vector-normalize! s4-1 1.0) - (launch-particles (-> *part-id-table* 270) s3-0) - ) - (let ((s3-1 (new 'stack-no-clear 'matrix)) - (f30-1 (fmin 1.0 (/ f30-0 (meters 16)))) - (f28-0 (-> *part-id-table* 267 init-specs 3 initial-valuef)) - ) - (forward-up->inv-matrix s3-1 s4-1 *up-vector*) - (vector-copy! (-> s3-1 trans) s5-0) - (gun-yellow-shot-method-42 this f30-1 f28-0 s3-1) - ) + (let ((s3-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s4-1 0.8))) + (draw-main-shot this a1-0 s4-1) + (vector-normalize! s4-1 1.0) + (launch-particles (-> *part-id-table* 270) s3-1) + ) + (let ((s3-2 (new 'stack-no-clear 'matrix)) + (f30-1 (fmin 1.0 (/ f30-0 (meters 16)))) + (f28-0 (-> *part-id-table* 267 init-specs 3 initial-valuef)) + ) + (forward-up->inv-matrix s3-2 s4-1 *up-vector*) + (vector-copy! (-> s3-2 trans) s5-0) + (gun-yellow-shot-method-42 this f30-1 f28-0 s3-2) ) - 0 - (none) ) + 0 + (none) ) (defmethod spawn-particles ((this gun-yellow-shot) (arg0 vector)) diff --git a/goal_src/jak3/engine/target/indax/target-indax-hang.gc b/goal_src/jak3/engine/target/indax/target-indax-hang.gc index 48e74229cc..cf2003fda6 100644 --- a/goal_src/jak3/engine/target/indax/target-indax-hang.gc +++ b/goal_src/jak3/engine/target/indax/target-indax-hang.gc @@ -135,7 +135,7 @@ ) (set! (-> v1-0 action-mask) (collide-action solid)) ) - (set! (-> gp-0 start-pos quad) (-> self control trans quad)) + (vector-copy! (-> gp-0 start-pos) (-> self control trans)) (vector-reset! (-> gp-0 move-dist)) (set! (-> gp-0 move-dist y) 40960.0) (when (not (and (>= (fill-and-probe-using-line-sphere *collide-cache* gp-0) 0.0) @@ -236,7 +236,7 @@ ) :post (behavior () (let ((gp-0 (new 'stack-no-clear 'vector))) - (set! (-> gp-0 quad) (-> self control trans quad)) + (vector-copy! gp-0 (-> self control trans)) (let ((a0-0 (-> self state parent))) (when a0-0 (let ((t9-0 (-> a0-0 post))) @@ -272,9 +272,10 @@ (go target-indax-hang-dodge) ) (when (and (turn-around?) (time-elapsed? (-> self state-time) (seconds 0.3))) - (set! (-> self control transv quad) - (-> self control transv-history (-> self control idx-of-fastest-xz-vel) quad) - ) + (vector-copy! + (-> self control transv) + (-> self control transv-history (-> self control idx-of-fastest-xz-vel)) + ) (set! (-> self control transv w) 1.0) (go target-indax-hang-turn-around) ) @@ -290,7 +291,7 @@ (ja-channel-push! 1 (seconds 0.05)) (ja-no-eval :group! jakb-dummy-59-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) @@ -403,7 +404,7 @@ (ja-channel-push! 1 (seconds 0.05)) (ja-no-eval :group! jakb-ladder-stance-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (let ((v1-19 (and (>= (ja-aframe-num 0) 4.0) (>= 9.0 (ja-aframe-num 0))))) (if v1-19 (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) @@ -462,11 +463,11 @@ (ja-channel-push! 1 (seconds 0.04)) (ja :group! jakb-ladder-get-on-ja :num! min) (quaternion-rotate-y! (-> self control dir-targ) (-> self control dir-targ) 32768.0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (until (ja-done? 0) (suspend) (ja :num! (seek! max 2.0)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) ) (remove-exit) diff --git a/goal_src/jak3/engine/target/indax/target-indax.gc b/goal_src/jak3/engine/target/indax/target-indax.gc index 1f4372f15a..9c7c4ef9bd 100644 --- a/goal_src/jak3/engine/target/indax/target-indax.gc +++ b/goal_src/jak3/engine/target/indax/target-indax.gc @@ -1148,7 +1148,7 @@ (ja-channel-push! 1 (seconds 0.02)) (ja-no-eval :group! daxter-indax-trip-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 2.0) (suspend) (ja :num! (seek!)) @@ -1180,7 +1180,7 @@ (ja-no-eval :group! gp-0 :num! (seek! max (-> self control current-surface align-speed)) :frame-num 0.0) ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) ;; og:preserve-this - High FPS Fix (when (and (recently-pressed? x) @@ -1219,7 +1219,7 @@ (ja-no-eval :group! gp-0 :num! (seek! max (-> self control current-surface align-speed)) :frame-num 0.0) ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) ;; og:preserve-this - High FPS Fix (when (and (recently-pressed? x) @@ -1264,7 +1264,7 @@ (f28-0 1.0) ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (not (ja-min? 0)) (cond ((and (>= (ja-aframe-num 0) 20.0) diff --git a/goal_src/jak3/engine/target/logic-target.gc b/goal_src/jak3/engine/target/logic-target.gc index 1f840602c6..ffcf31cf76 100644 --- a/goal_src/jak3/engine/target/logic-target.gc +++ b/goal_src/jak3/engine/target/logic-target.gc @@ -1391,265 +1391,145 @@ ) (defun leg-ik-callback ((arg0 joint-mod-ik) (arg1 object) (arg2 object) (arg3 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 arg3) - (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) - (if (< 1228.8 f0-1) - (set! f0-1 1228.8) - ) - (if (< f0-1 409.6) - (set! f0-1 409.6) - ) - (+! (-> arg0 user-position y) f0-1) - ) - (let* ((f0-4 - (vector-dot (-> arg0 user-normal) (vector-! (new 'stack-no-clear 'vector) arg3 (-> arg0 user-position))) - ) - (f30-1 (lerp-scale 1.0 0.0 f0-4 0.0 2048.0)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-13 s5-0)) - (let ((a0-4 (-> arg0 user-normal))) - (let ((a1-4 4096.0)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-4 quad)) - ) - (.lvf vf4 (&-> v1-13 quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 arg3) + (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) + (if (< 1228.8 f0-1) + (set! f0-1 1228.8) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> s3-0 quad) vf6) - (vector-float*! (new 'stack-no-clear 'vector) (-> arg0 user-normal) -8192.0) - (let ((s4-1 (new 'stack-no-clear 'vector))) - 0.0 - (let ((f0-8 (intersect-ray-plane s3-0 (-> arg0 user-normal) (-> arg0 user-position) (-> arg0 user-normal))) - (a0-7 s4-1) - ) - (let ((v1-16 (-> arg0 user-normal))) - (let ((a1-7 f0-8)) - (.mov vf7 a1-7) - ) - (.lvf vf5 (&-> v1-16 quad)) - ) - (.lvf vf4 (&-> s3-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-7 quad) vf6) - ) - (let ((a1-8 s4-1)) - (let ((v1-17 s4-1)) - (let ((a0-8 (-> arg0 user-normal))) - (let ((a2-6 - (- (vector-dot (-> arg0 user-normal) (vector-! (new 'stack-no-clear 'vector) s4-1 (-> arg0 user-position)))) - ) - ) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-8 quad)) - ) - (.lvf vf4 (&-> v1-17 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-8 quad) vf6) - ) - (let ((a1-9 s5-0)) - (let ((v1-18 s5-0)) - (let ((a0-10 (vector-! (new 'stack-no-clear 'vector) s4-1 s5-0))) - (let ((a2-9 (fmin 1.0 (* (-> arg0 user-blend) f30-1)))) - (.mov vf7 a2-9) - ) - (.lvf vf5 (&-> a0-10 quad)) - ) - (.lvf vf4 (&-> v1-18 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-9 quad) vf6) - ) + (if (< f0-1 409.6) + (set! f0-1 409.6) ) - ) - (set-ik-target! arg0 s5-0) + (+! (-> arg0 user-position y) f0-1) ) - (none) + (let* ((f0-4 + (vector-dot (-> arg0 user-normal) (vector-! (new 'stack-no-clear 'vector) arg3 (-> arg0 user-position))) + ) + (f30-1 (lerp-scale 1.0 0.0 f0-4 0.0 2048.0)) + (s3-1 (vector+*! (new 'stack-no-clear 'vector) s5-0 (-> arg0 user-normal) 4096.0)) + ) + (vector-float*! (new 'stack-no-clear 'vector) (-> arg0 user-normal) -8192.0) + (let ((s4-1 (new 'stack-no-clear 'vector))) + 0.0 + (let ((f0-8 (intersect-ray-plane s3-1 (-> arg0 user-normal) (-> arg0 user-position) (-> arg0 user-normal)))) + (vector+*! s4-1 s3-1 (-> arg0 user-normal) f0-8) + ) + (vector+*! + s4-1 + s4-1 + (-> arg0 user-normal) + (- (vector-dot (-> arg0 user-normal) (vector-! (new 'stack-no-clear 'vector) s4-1 (-> arg0 user-position)))) + ) + (vector+*! + s5-0 + s5-0 + (vector-! (new 'stack-no-clear 'vector) s4-1 s5-0) + (fmin 1.0 (* (-> arg0 user-blend) f30-1)) + ) + ) + ) + (set-ik-target! arg0 s5-0) ) + (none) ) (defbehavior target-update-ik target () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'collide-query))) - (let ((v1-0 (-> gp-0 bbox)) - (a0-1 (-> self control trans)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-0 x) 8192.0) - (set! (-> a1-0 y) 6144.0) - (set! (-> a1-0 z) 8192.0) - (set! (-> a1-0 w) 1.0) - (vector-! (-> v1-0 min) a0-1 a1-0) - ) - (let ((v1-2 (-> gp-0 bbox max)) - (a0-3 (-> self control trans)) - (a1-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-1 x) 8192.0) - (set! (-> a1-1 y) 6144.0) - (set! (-> a1-1 z) 8192.0) - (set! (-> a1-1 w) 1.0) - (vector+! v1-2 a0-3 a1-1) - ) - (set! (-> gp-0 collide-with) (-> self control root-prim prim-core collide-with)) - (set! (-> gp-0 ignore-process0) self) - (set! (-> gp-0 ignore-process1) #f) - (set! (-> gp-0 ignore-pat) (-> self control pat-ignore-mask)) - (fill-using-bounding-box *collide-cache* gp-0) - (dotimes (s5-0 2) - (let ((a1-4 (not (or (logtest? (target-flags lleg-no-ik rleg-no-ik) (-> self target-flags)) - (and (logtest? (-> self control mod-surface flags) (surface-flag air)) - (not (logtest? (-> self control status) (collide-status on-surface))) - ) - (focus-test? self edge-grab pole flut pilot mech) - ) - ) - ) - ) - (enable-set! (-> self leg-ik s5-0) a1-4) + (let ((gp-0 (new 'stack-no-clear 'collide-query))) + (let ((v1-0 (-> gp-0 bbox)) + (a0-1 (-> self control trans)) + (a1-0 (new 'stack-no-clear 'vector)) ) - (vector-copy! (-> self foot s5-0 twist-max) (-> self control ground-contact-normal)) - (vector-copy! (-> self foot s5-0 trans) (-> self control gspot-pos)) - (vector-y-quaternion! (-> self foot s5-0 target) (-> self control quat-for-control)) - (set! (-> self foot s5-0 flex-blend) (if (if (zero? s5-0) - (logtest? (target-flags lleg-no-ik) (-> self target-flags)) - (logtest? (target-flags rleg-no-ik) (-> self target-flags)) - ) - 0.0 - 1.0 - ) - ) - (-> self leg-ik s5-0 shoulder-matrix-no-ik) - (let ((v1-51 (-> self leg-ik s5-0 elbow-matrix-no-ik)) - (s2-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s1-0 *y-vector*) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (new 'stack-no-clear 'vector) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((a2-8 s2-0)) - (let ((a0-27 (-> v1-51 trans))) - (let ((a1-8 (-> v1-51 uvec))) - (let ((a3-3 (-> self leg-ik s5-0 hand-dist))) - (.mov vf7 a3-3) - ) - (.lvf vf5 (&-> a1-8 quad)) - ) - (.lvf vf4 (&-> a0-27 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-8 quad) vf6) - ) - (let ((a1-9 s2-0)) - (let ((a0-28 (-> v1-51 trans))) - (let ((v1-52 (-> v1-51 uvec))) - (let ((a2-12 (-> self leg-ik s5-0 hand-dist))) - (.mov vf7 a2-12) - ) - (.lvf vf5 (&-> v1-52 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 (&-> a1-9 quad) vf6) - ) - (let ((f0-13 (lerp-scale 1.0 0.0 (- (-> s2-0 y) (-> self control gspot-pos y)) 819.2 2048.0))) - (seek! (-> self leg-ik s5-0 user-blend) f0-13 (* 4.0 (seconds-per-frame))) - ) - (let ((a1-12 (-> gp-0 start-pos))) - (let ((v1-63 s2-0)) - (let ((a0-31 s1-0)) - (let ((a2-16 4096.0)) - (.mov vf7 a2-16) - ) - (.lvf vf5 (&-> a0-31 quad)) - ) - (.lvf vf4 (&-> v1-63 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) - ) - (vector-float*! (-> gp-0 move-dist) s1-0 -8192.0) - (let ((v1-66 gp-0)) - (set! (-> v1-66 radius) 4.096) - (set! (-> v1-66 collide-with) (-> gp-0 collide-with)) - (set! (-> v1-66 ignore-process0) #f) - (set! (-> v1-66 ignore-process1) #f) - (set! (-> v1-66 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-66 action-mask) (collide-action solid)) - ) - (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) - (cond - ((and (>= f30-0 0.0) (< 0.5 (-> gp-0 best-other-tri normal y))) - (vector-copy! s4-0 (-> gp-0 best-other-tri normal)) - (when (< 8192.0 (vector-vector-angle-safe *y-vector* s4-0)) - (let* ((a1-17 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s4-0) 1.0)) - (a2-18 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-17 8192.0)) - ) - (vector-orient-by-quat! s4-0 *y-vector* a2-18) - ) - ) - (let ((a1-19 s3-0)) - (let ((v1-77 (-> gp-0 start-pos))) - (let ((a0-45 (-> gp-0 move-dist))) - (let ((a2-19 f30-0)) - (.mov vf7 a2-19) + (set! (-> a1-0 x) 8192.0) + (set! (-> a1-0 y) 6144.0) + (set! (-> a1-0 z) 8192.0) + (set! (-> a1-0 w) 1.0) + (vector-! (-> v1-0 min) a0-1 a1-0) + ) + (let ((v1-2 (-> gp-0 bbox max)) + (a0-3 (-> self control trans)) + (a1-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-1 x) 8192.0) + (set! (-> a1-1 y) 6144.0) + (set! (-> a1-1 z) 8192.0) + (set! (-> a1-1 w) 1.0) + (vector+! v1-2 a0-3 a1-1) + ) + (set! (-> gp-0 collide-with) (-> self control root-prim prim-core collide-with)) + (set! (-> gp-0 ignore-process0) self) + (set! (-> gp-0 ignore-process1) #f) + (set! (-> gp-0 ignore-pat) (-> self control pat-ignore-mask)) + (fill-using-bounding-box *collide-cache* gp-0) + (dotimes (s5-0 2) + (let ((a1-4 (not (or (logtest? (target-flags lleg-no-ik rleg-no-ik) (-> self target-flags)) + (and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (not (logtest? (-> self control status) (collide-status on-surface))) + ) + (focus-test? self edge-grab pole flut pilot mech) ) - (.lvf vf5 (&-> a0-45 quad)) - ) - (.lvf vf4 (&-> v1-77 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-19 quad) vf6) - ) - (vector-copy! (-> self leg-ik s5-0 user-position) s3-0) - (vector-copy! (-> self leg-ik s5-0 user-normal) s4-0) - (vector-copy! (-> self foot s5-0 twist-max) s4-0) - ) - (else - (vector-copy! (-> self leg-ik s5-0 user-position) s2-0) - (vector-copy! (-> self leg-ik s5-0 user-normal) *y-vector*) - (vector-copy! (-> self foot s5-0 twist-max) *y-vector*) + ) + ) + (enable-set! (-> self leg-ik s5-0) a1-4) + ) + (vector-copy! (-> self foot s5-0 twist-max) (-> self control ground-contact-normal)) + (vector-copy! (-> self foot s5-0 trans) (-> self control gspot-pos)) + (vector-y-quaternion! (-> self foot s5-0 target) (-> self control quat-for-control)) + (set! (-> self foot s5-0 flex-blend) (if (if (zero? s5-0) + (logtest? (target-flags lleg-no-ik) (-> self target-flags)) + (logtest? (target-flags rleg-no-ik) (-> self target-flags)) + ) + 0.0 + 1.0 + ) + ) + (-> self leg-ik s5-0 shoulder-matrix-no-ik) + (let ((v1-51 (-> self leg-ik s5-0 elbow-matrix-no-ik)) + (s2-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s1-0 *y-vector*) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector+*! s2-0 (-> v1-51 trans) (-> v1-51 uvec) (-> self leg-ik s5-0 hand-dist)) + (vector+*! s2-0 (-> v1-51 trans) (-> v1-51 uvec) (-> self leg-ik s5-0 hand-dist)) + (let ((f0-13 (lerp-scale 1.0 0.0 (- (-> s2-0 y) (-> self control gspot-pos y)) 819.2 2048.0))) + (seek! (-> self leg-ik s5-0 user-blend) f0-13 (* 4.0 (seconds-per-frame))) + ) + (vector+*! (-> gp-0 start-pos) s2-0 s1-0 4096.0) + (vector-float*! (-> gp-0 move-dist) s1-0 -8192.0) + (let ((v1-66 gp-0)) + (set! (-> v1-66 radius) 4.096) + (set! (-> v1-66 collide-with) (-> gp-0 collide-with)) + (set! (-> v1-66 ignore-process0) #f) + (set! (-> v1-66 ignore-process1) #f) + (set! (-> v1-66 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) + (set! (-> v1-66 action-mask) (collide-action solid)) + ) + (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) + (cond + ((and (>= f30-0 0.0) (< 0.5 (-> gp-0 best-other-tri normal y))) + (vector-copy! s4-0 (-> gp-0 best-other-tri normal)) + (when (< 8192.0 (vector-vector-angle-safe *y-vector* s4-0)) + (let* ((a1-19 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s4-0) 1.0)) + (a2-17 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-19 8192.0)) + ) + (vector-orient-by-quat! s4-0 *y-vector* a2-17) + ) + ) + (vector+*! s3-0 (-> gp-0 start-pos) (-> gp-0 move-dist) f30-0) + (vector-copy! (-> self leg-ik s5-0 user-position) s3-0) + (vector-copy! (-> self leg-ik s5-0 user-normal) s4-0) + (vector-copy! (-> self foot s5-0 twist-max) s4-0) + ) + (else + (vector-copy! (-> self leg-ik s5-0 user-position) s2-0) + (vector-copy! (-> self leg-ik s5-0 user-normal) *y-vector*) + (vector-copy! (-> self foot s5-0 twist-max) *y-vector*) ) ) ) @@ -1657,9 +1537,9 @@ ) ) ) - 0 - (none) ) + 0 + (none) ) (defbehavior pre-collide-setup target () diff --git a/goal_src/jak3/engine/target/mech/mech-part.gc b/goal_src/jak3/engine/target/mech/mech-part.gc index 54e037a023..3bbbba0576 100644 --- a/goal_src/jak3/engine/target/mech/mech-part.gc +++ b/goal_src/jak3/engine/target/mech/mech-part.gc @@ -134,71 +134,50 @@ ) (defun mech-spawn-thruster ((arg0 mech-info) (arg1 vector) (arg2 vector) (arg3 float) (arg4 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (set! (-> arg0 part-thruster) (-> *part-id-table* 1037)) - (set! (-> arg0 part-thruster-scale-x) (-> *part-id-table* 1037 init-specs 4)) - (set! (-> arg0 part-thruster-scale-y) (-> *part-id-table* 1037 init-specs 5)) - (let ((s1-0 (new 'stack-no-clear 'quaternion)) - (s0-0 (new 'stack-no-clear 'vector)) - ) - (forward-up->quaternion s1-0 arg2 (new 'static 'vector :y 1.0 :w 1.0)) - (quaternion-rotate-local-x! s1-0 s1-0 32768.0) - (let ((a0-3 s0-0)) - (let ((v1-10 arg1)) - (let ((a1-4 (/ arg4 2))) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> arg2 quad)) - (.lvf vf4 (&-> v1-10 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-3 quad) vf6) + (set! (-> arg0 part-thruster) (-> *part-id-table* 1037)) + (set! (-> arg0 part-thruster-scale-x) (-> *part-id-table* 1037 init-specs 4)) + (set! (-> arg0 part-thruster-scale-y) (-> *part-id-table* 1037 init-specs 5)) + (let ((s1-0 (new 'stack-no-clear 'quaternion)) + (s0-0 (new 'stack-no-clear 'vector)) ) - (set! (-> arg0 part-thruster-scale-x initial-valuef) arg3) - (set! (-> arg0 part-thruster-scale-y initial-valuef) arg4) - (dotimes (s4-1 2) - (quaternion-rotate-local-z! s1-0 s1-0 16384.0) - (quaternion-copy! (-> arg0 part-quat) s1-0) - (let ((t9-4 sp-launch-particles-var) - (a0-6 (-> arg0 particle-system-3d)) - (a1-7 (-> arg0 part-thruster)) - (a2-4 *launch-matrix*) - ) - (vector-copy! (-> a2-4 trans) s0-0) - (t9-4 - (the-as sparticle-system a0-6) - a1-7 - a2-4 - (the-as sparticle-launch-state #f) - (the-as sparticle-launch-control #f) - 1.0 + (forward-up->quaternion s1-0 arg2 (new 'static 'vector :y 1.0 :w 1.0)) + (quaternion-rotate-local-x! s1-0 s1-0 32768.0) + (vector+*! s0-0 arg1 arg2 (/ arg4 2)) + (set! (-> arg0 part-thruster-scale-x initial-valuef) arg3) + (set! (-> arg0 part-thruster-scale-y initial-valuef) arg4) + (dotimes (s4-1 2) + (quaternion-rotate-local-z! s1-0 s1-0 16384.0) + (quaternion-copy! (-> arg0 part-quat) s1-0) + (let ((t9-4 sp-launch-particles-var) + (a0-7 (-> arg0 particle-system-3d)) + (a1-6 (-> arg0 part-thruster)) + (a2-4 *launch-matrix*) ) + (vector-copy! (-> a2-4 trans) s0-0) + (t9-4 + (the-as sparticle-system a0-7) + a1-6 + a2-4 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 ) ) ) - (launch-particles (-> *part-id-table* 1043) arg1) - (launch-particles (-> *part-id-table* 1038) arg1) - (cond - ((!= (-> *setting-control* user-current under-water-pitch-mod) 0.0) - (launch-particles (-> *part-id-table* 1043) arg1) - ) - (else - (launch-particles (-> *part-id-table* 1039) arg1) - (launch-particles (-> *part-id-table* 1041) arg1) - ) - ) - 0 - (none) ) + (launch-particles (-> *part-id-table* 1043) arg1) + (launch-particles (-> *part-id-table* 1038) arg1) + (cond + ((!= (-> *setting-control* user-current under-water-pitch-mod) 0.0) + (launch-particles (-> *part-id-table* 1043) arg1) + ) + (else + (launch-particles (-> *part-id-table* 1039) arg1) + (launch-particles (-> *part-id-table* 1041) arg1) + ) + ) + 0 + (none) ) (defpart 1045 diff --git a/goal_src/jak3/engine/target/mech/mech-states.gc b/goal_src/jak3/engine/target/mech/mech-states.gc index 754837213f..a447974878 100644 --- a/goal_src/jak3/engine/target/mech/mech-states.gc +++ b/goal_src/jak3/engine/target/mech/mech-states.gc @@ -549,7 +549,7 @@ ) (target-mech-punch-pick (the-as symbol gp-0)) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (and (not (focus-test? self dangerous)) (let ((v1-10 (ja-group))) (and v1-10 (or (= v1-10 jakb-mech-punch-l-ja) diff --git a/goal_src/jak3/engine/target/mech/target-mech.gc b/goal_src/jak3/engine/target/mech/target-mech.gc index ef3c009886..58db3e0aaf 100644 --- a/goal_src/jak3/engine/target/mech/target-mech.gc +++ b/goal_src/jak3/engine/target/mech/target-mech.gc @@ -905,237 +905,131 @@ ;; WARN: Return type mismatch none vs object. (defbehavior mech-leg-ik-callback target ((arg0 joint-mod-ik) (arg1 matrix) (arg2 matrix) (arg3 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 arg3) - (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) - (if (< 6144.0 f0-1) - (set! f0-1 6144.0) - ) - (if (< f0-1 -6144.0) - (set! f0-1 -6144.0) - ) - (+! (-> arg0 user-position y) f0-1) - ) - (let ((f0-4 (- (-> arg3 y) (-> arg0 user-position y)))) - (seek! (-> arg0 user-float) f0-4 (* 40960.0 (seconds-per-frame))) - ) - (let* ((f28-0 (-> arg0 user-float)) - (f30-1 (lerp-scale 1.0 0.0 f28-0 0.0 12288.0)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-12 s5-0)) - (let ((a0-4 *up-vector*)) - (let ((a1-4 8192.0)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-4 quad)) - ) - (.lvf vf4 (&-> v1-12 quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 arg3) + (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) + (if (< 6144.0 f0-1) + (set! f0-1 6144.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 (&-> s3-0 quad) vf6) - (vector-float*! (new 'stack-no-clear 'vector) *up-vector* -16384.0) - (let ((s2-0 (new 'stack-no-clear 'vector))) - 0.0 - (let ((f0-11 (intersect-ray-plane s3-0 *up-vector* (-> arg0 user-position) *up-vector*)) - (a0-7 s2-0) - ) - (let ((v1-15 *up-vector*)) - (let ((a1-7 f0-11)) - (.mov vf7 a1-7) - ) - (.lvf vf5 (&-> v1-15 quad)) - ) - (.lvf vf4 (&-> s3-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-7 quad) vf6) - ) - (let ((a0-8 s2-0)) - (let ((v1-16 *up-vector*)) - (let ((a1-8 (- f28-0))) - (.mov vf7 a1-8) - ) - (.lvf vf5 (&-> v1-16 quad)) - ) - (.lvf vf4 (&-> arg3 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-8 quad) vf6) - ) - (let ((a1-9 s5-0)) - (let ((v1-17 s5-0)) - (let ((a0-10 (vector-! (new 'stack-no-clear 'vector) s2-0 s5-0))) - (let ((a2-6 (fmin 1.0 (* (-> arg0 user-blend) f30-1)))) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-10 quad)) - ) - (.lvf vf4 (&-> v1-17 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-9 quad) vf6) - ) + (if (< f0-1 -6144.0) + (set! f0-1 -6144.0) ) - ) - (set-ik-target! arg0 s5-0) + (+! (-> arg0 user-position y) f0-1) ) + (let ((f0-4 (- (-> arg3 y) (-> arg0 user-position y)))) + (seek! (-> arg0 user-float) f0-4 (* 40960.0 (seconds-per-frame))) + ) + (let* ((f28-0 (-> arg0 user-float)) + (f30-1 (lerp-scale 1.0 0.0 f28-0 0.0 12288.0)) + (s3-1 (vector+*! (new 'stack-no-clear 'vector) s5-0 *up-vector* 8192.0)) + ) + (vector-float*! (new 'stack-no-clear 'vector) *up-vector* -16384.0) + (let ((s2-0 (new 'stack-no-clear 'vector))) + 0.0 + (let ((f0-11 (intersect-ray-plane s3-1 *up-vector* (-> arg0 user-position) *up-vector*))) + (vector+*! s2-0 s3-1 *up-vector* f0-11) + ) + (vector+*! s2-0 arg3 *up-vector* (- f28-0)) + (vector+*! + s5-0 + s5-0 + (vector-! (new 'stack-no-clear 'vector) s2-0 s5-0) + (fmin 1.0 (* (-> arg0 user-blend) f30-1)) + ) + ) + ) + (set-ik-target! arg0 s5-0) ) ) (defbehavior mech-update-ik target () (local-vars (sv-720 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'collide-query)) - (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) + ) + (let ((a1-0 (-> gp-0 bbox)) + (v1-2 (-> s5-0 trans)) + (a0-0 (new 'stack-no-clear 'vector)) ) - (let ((a1-0 (-> gp-0 bbox)) - (v1-2 (-> s5-0 trans)) - (a0-0 (new 'stack-no-clear 'vector)) - ) - (set! (-> a0-0 x) 10240.0) - (set! (-> a0-0 y) 10240.0) - (set! (-> a0-0 z) 10240.0) - (set! (-> a0-0 w) 1.0) - (vector-! (-> a1-0 min) v1-2 a0-0) - ) - (let ((a1-2 (-> gp-0 bbox max)) - (v1-3 (-> s5-0 trans)) - (a0-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> a0-1 x) 10240.0) - (set! (-> a0-1 y) 10240.0) - (set! (-> a0-1 z) 10240.0) - (set! (-> a0-1 w) 1.0) - (vector+! a1-2 v1-3 a0-1) - ) - (set! (-> gp-0 collide-with) (-> (the-as collide-shape s5-0) root-prim prim-core collide-with)) - (set! (-> gp-0 ignore-process0) #f) - (set! (-> gp-0 ignore-process1) #f) - (set! (-> gp-0 ignore-pat) (-> (the-as collide-shape s5-0) pat-ignore-mask)) - (fill-using-bounding-box *collide-cache* gp-0) - (dotimes (s4-0 2) - (let ((s3-0 (-> self mech-ik s4-0))) - #t - (set! (-> s3-0 callback) mech-leg-ik-callback) - (-> s3-0 shoulder-matrix-no-ik) - (let ((v1-13 (-> s3-0 elbow-matrix-no-ik)) - (s0-0 (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) + (set! (-> a0-0 x) 10240.0) + (set! (-> a0-0 y) 10240.0) + (set! (-> a0-0 z) 10240.0) + (set! (-> a0-0 w) 1.0) + (vector-! (-> a1-0 min) v1-2 a0-0) + ) + (let ((a1-2 (-> gp-0 bbox max)) + (v1-3 (-> s5-0 trans)) + (a0-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-1 x) 10240.0) + (set! (-> a0-1 y) 10240.0) + (set! (-> a0-1 z) 10240.0) + (set! (-> a0-1 w) 1.0) + (vector+! a1-2 v1-3 a0-1) + ) + (set! (-> gp-0 collide-with) (-> (the-as collide-shape s5-0) root-prim prim-core collide-with)) + (set! (-> gp-0 ignore-process0) #f) + (set! (-> gp-0 ignore-process1) #f) + (set! (-> gp-0 ignore-pat) (-> (the-as collide-shape s5-0) pat-ignore-mask)) + (fill-using-bounding-box *collide-cache* gp-0) + (dotimes (s4-0 2) + (let ((s3-0 (-> self mech-ik s4-0))) + #t + (set! (-> s3-0 callback) mech-leg-ik-callback) + (-> s3-0 shoulder-matrix-no-ik) + (let ((v1-13 (-> s3-0 elbow-matrix-no-ik)) + (s0-0 (new 'stack-no-clear 'vector)) ) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (new 'stack-no-clear 'vector) - (let ((s1-0 (new 'stack-no-clear 'vector))) - (let ((a1-6 s0-0)) - (let ((a0-8 (-> v1-13 trans))) - (let ((v1-14 (-> v1-13 uvec))) - (let ((a2-8 (-> s3-0 hand-dist))) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> v1-14 quad)) + (set! sv-720 (new 'stack-no-clear 'vector)) + (let ((a0-5 (-> *y-vector* quad))) + (set! (-> sv-720 quad) a0-5) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (vector+*! s0-0 (-> v1-13 trans) (-> v1-13 uvec) (-> s3-0 hand-dist)) + (let ((f0-11 + (lerp-scale 1.0 0.0 (- (-> s0-0 y) (-> (the-as collide-shape-moving s5-0) gspot-pos y)) 2048.0 12288.0) ) - (.lvf vf4 (&-> a0-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 (&-> a1-6 quad) vf6) - ) - (let ((f0-11 - (lerp-scale 1.0 0.0 (- (-> s0-0 y) (-> (the-as collide-shape-moving s5-0) gspot-pos y)) 2048.0 12288.0) - ) - ) - (seek! (-> s3-0 user-blend) f0-11 (* 4.0 (seconds-per-frame))) - ) - (let ((a1-9 (-> gp-0 start-pos))) - (let ((v1-18 s0-0)) - (let ((a0-11 sv-720)) - (let ((a2-12 6144.0)) - (.mov vf7 a2-12) - ) - (.lvf vf5 (&-> a0-11 quad)) - ) - (.lvf vf4 (&-> v1-18 quad)) + (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) ) - (.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-9 quad) vf6) - ) - (let ((v1-19 (-> gp-0 move-dist)) - (f0-16 -20480.0) + (vector-float*! v1-19 sv-720 f0-16) + ) + (let ((v1-21 gp-0)) + (set! (-> v1-21 radius) 4.096) + (set! (-> v1-21 collide-with) (-> gp-0 collide-with)) + (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) ) - (vector-float*! v1-19 sv-720 f0-16) - ) - (let ((v1-21 gp-0)) - (set! (-> v1-21 radius) 4.096) - (set! (-> v1-21 collide-with) (-> gp-0 collide-with)) - (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)) - ) - (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) - (cond - ((>= f30-0 0.0) - (vector-copy! s1-0 (-> gp-0 best-other-tri normal)) - (when (< 8192.0 (vector-vector-angle-safe *y-vector* s1-0)) - (let* ((a1-14 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s1-0) 1.0)) - (a2-14 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-14 8192.0)) - ) - (vector-orient-by-quat! s1-0 *y-vector* a2-14) - ) + (set! (-> v1-21 action-mask) (collide-action solid)) + ) + (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) + (cond + ((>= f30-0 0.0) + (vector-copy! s1-0 (-> gp-0 best-other-tri normal)) + (when (< 8192.0 (vector-vector-angle-safe *y-vector* s1-0)) + (let* ((a1-16 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s1-0) 1.0)) + (a2-12 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-16 8192.0)) + ) + (vector-orient-by-quat! s1-0 *y-vector* a2-12) ) - (let ((a1-16 s2-0)) - (let ((v1-28 (-> gp-0 start-pos))) - (let ((a0-26 (-> gp-0 move-dist))) - (let ((a2-15 f30-0)) - (.mov vf7 a2-15) - ) - (.lvf vf5 (&-> a0-26 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 (&-> a1-16 quad) vf6) - ) - (vector-copy! (-> s3-0 user-position) s2-0) - (vector-copy! (-> s3-0 user-normal) s1-0) ) - (else - (set! (-> s0-0 y) (-> (target-pos 0) y)) - (vector-copy! (-> s3-0 user-position) s0-0) - (vector-copy! (-> s3-0 user-normal) *y-vector*) - ) + (vector+*! s2-0 (-> gp-0 start-pos) (-> gp-0 move-dist) f30-0) + (vector-copy! (-> s3-0 user-position) s2-0) + (vector-copy! (-> s3-0 user-normal) s1-0) + ) + (else + (set! (-> s0-0 y) (-> (target-pos 0) y)) + (vector-copy! (-> s3-0 user-position) s0-0) + (vector-copy! (-> s3-0 user-normal) *y-vector*) ) ) ) @@ -1144,9 +1038,9 @@ ) ) ) - 0 - (none) ) + 0 + (none) ) ;; WARN: Return type mismatch object vs none. diff --git a/goal_src/jak3/engine/target/pilot-states.gc b/goal_src/jak3/engine/target/pilot-states.gc index 59da17b064..588a961e59 100644 --- a/goal_src/jak3/engine/target/pilot-states.gc +++ b/goal_src/jak3/engine/target/pilot-states.gc @@ -395,22 +395,11 @@ :exit target-pilot-exit :trans target-pilot-trans :code (behavior () - (local-vars (v1-1 float) (v1-196 int)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) + (local-vars (v1-196 int)) + (rlet ((vf0 :class vf)) (init-vf0-vector) (let ((gp-0 (-> self pilot))) - (.lvf vf1 (&-> (-> gp-0 local-accel) 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-1 vf1) - (let ((f0-0 v1-1) + (let ((f0-0 (vector-length-squared (-> gp-0 local-accel))) (s5-0 (new 'stack-no-clear 'vector)) ) (vector-copy! s5-0 (-> gp-0 local-accel)) diff --git a/goal_src/jak3/engine/target/target-anim.gc b/goal_src/jak3/engine/target/target-anim.gc index 3c150aaf2c..f964626737 100644 --- a/goal_src/jak3/engine/target/target-anim.gc +++ b/goal_src/jak3/engine/target/target-anim.gc @@ -179,7 +179,7 @@ (if (and gp-0 (using-gun? self)) (goto cfg-43) ) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) @@ -1322,7 +1322,7 @@ (set! (-> s5-0 frame-num) 0.0) (joint-control-channel-group! s5-0 (the-as art-joint-anim jakb-flop-down-land-ja) num-func-seek!) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (if arg1 @@ -1756,7 +1756,7 @@ (set! (-> self control unknown-sound-id01) (sound-play "spin-kick")) (ja-no-eval :group! jakb-attack-from-jump-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) diff --git a/goal_src/jak3/engine/target/target-darkjak.gc b/goal_src/jak3/engine/target/target-darkjak.gc index 357dc27480..164f49cf16 100644 --- a/goal_src/jak3/engine/target/target-darkjak.gc +++ b/goal_src/jak3/engine/target/target-darkjak.gc @@ -1347,7 +1347,7 @@ (the-as (pointer int64) (& sv-40)) ) ) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (not (ja-min? 0)) (cond ((and (>= (ja-frame-num 0) 20.0) @@ -1980,7 +1980,7 @@ (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-alignment! (-> self align)) + (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)) @@ -2325,7 +2325,7 @@ (set! (-> self neck flex-blend) 0.0) (set-setting! 'music-volume 'rel 0.0 0) (set-setting! 'ambient-volume 'rel 0.0 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (set-action! *gui-control* (gui-action play) @@ -2340,7 +2340,7 @@ (ja-no-eval :num! (seek! max f0-1)) ) (while (not (ja-done? 0)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (set! (-> self control turn-go-the-long-way) 1.0) (set! (-> self darkjak clock-vel) -4.0) (set! (-> self darkjak clock-on) #t) @@ -2461,7 +2461,7 @@ (ja-no-eval :group! (-> self draw art-group data 471) :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (ja-blend-eval) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (set! (-> self control turn-go-the-long-way) 1.0) (set! (-> self darkjak clock-vel) 4.0) (suspend) diff --git a/goal_src/jak3/engine/target/target-death.gc b/goal_src/jak3/engine/target/target-death.gc index e6f0297a15..ff8af5f115 100644 --- a/goal_src/jak3/engine/target/target-death.gc +++ b/goal_src/jak3/engine/target/target-death.gc @@ -228,175 +228,138 @@ ;; WARN: Return type mismatch object vs none. (defbehavior apply-pos-from-entity target ((arg0 continue-point)) (local-vars (sv-1328 collide-query)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s1-0 (entity-by-name (the-as string (-> arg0 on-goto))))) - (cond - (s1-0 - (entity-birth-no-kill s1-0) - (let ((a1-0 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-0 from) (process->ppointer self)) - (set! (-> a1-0 num-params) 0) - (set! (-> a1-0 message) 'apply-pos-from-entity) - (let ((t9-2 send-event-function) - (v1-2 s1-0) - ) - (t9-2 - (if v1-2 - (-> v1-2 extra process) - ) - a1-0 + (let ((s1-0 (entity-by-name (the-as string (-> arg0 on-goto))))) + (cond + (s1-0 + (entity-birth-no-kill s1-0) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'apply-pos-from-entity) + (let ((t9-2 send-event-function) + (v1-2 s1-0) ) + (t9-2 + (if v1-2 + (-> v1-2 extra process) + ) + a1-0 ) ) - (let ((s0-0 (-> s1-0 extra perm))) - (logior! (-> s0-0 status) (entity-perm-status bit-5)) - (let ((s2-0 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - (s5-0 (new 'stack-no-clear 'matrix)) + ) + (let ((s0-0 (-> s1-0 extra perm))) + (logior! (-> s0-0 status) (entity-perm-status bit-5)) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'matrix)) + ) + (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) + ) + (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! (-> 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) + ) + ) + (set! (-> s3-0 x) (* 4096.0 (the float (-> s0-0 user-int16 2)))) + (set! (-> s3-0 y) (-> s1-0 extra trans y)) + (set! (-> s3-0 z) (* 4096.0 (the float (-> s0-0 user-int16 3)))) + (let ((s1-1 (new 'stack-no-clear 'collide-query))) + (set-vector! (-> s1-1 move-dist) 0.0 -204800.0 0.0 1.0) + (vector-copy! (-> s1-1 start-pos) s3-0) + (+! (-> s1-1 start-pos y) 102400.0) + (let ((v1-34 s1-1)) + (set! (-> v1-34 radius) 409.6) + (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-20 action-mask) (collide-action solid)) + (set! (-> v1-34 action-mask) (collide-action solid)) ) - (let ((f0-12 (fill-and-probe-using-line-sphere *collide-cache* sv-1328))) + (let ((f0-27 (fill-and-probe-using-line-sphere *collide-cache* s1-1))) (cond - ((>= f0-12 0.0) - (let ((v1-22 s2-0)) - (let ((a0-15 (-> sv-1328 start-pos))) - (let ((a1-3 (-> sv-1328 move-dist))) - (let ((a2-0 f0-12)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> a0-15 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-22 quad) vf6) - ) - (set! (-> s2-0 y) (+ 4096.0 (-> s2-0 y))) + ((>= f0-27 0.0) + (vector+*! s3-0 (-> s1-1 start-pos) (-> s1-1 move-dist) f0-27) + (set! (-> s3-0 y) (+ 4096.0 (-> s3-0 y))) ) (else - (format 0 "failed to find gem ground on pos-from-entity~%") + (format 0 "failed to find jak ground on pos-from-entity~%") ) ) ) - (set! (-> s3-0 x) (* 4096.0 (the float (-> s0-0 user-int16 2)))) - (set! (-> s3-0 y) (-> s1-0 extra trans y)) - (set! (-> s3-0 z) (* 4096.0 (the float (-> s0-0 user-int16 3)))) - (let ((s1-1 (new 'stack-no-clear 'collide-query))) - (set-vector! (-> s1-1 move-dist) 0.0 -204800.0 0.0 1.0) - (vector-copy! (-> s1-1 start-pos) s3-0) - (+! (-> s1-1 start-pos y) 102400.0) - (let ((v1-33 s1-1)) - (set! (-> v1-33 radius) 409.6) - (set! (-> v1-33 collide-with) (collide-spec backgnd)) - (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)) - ) - (let ((f0-27 (fill-and-probe-using-line-sphere *collide-cache* s1-1))) - (cond - ((>= f0-27 0.0) - (let ((a0-26 s3-0)) - (let ((v1-35 (-> s1-1 start-pos))) - (let ((a1-6 (-> s1-1 move-dist))) - (let ((a2-1 f0-27)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-6 quad)) - ) - (.lvf vf4 (&-> v1-35 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-26 quad) vf6) - ) - (set! (-> s3-0 y) (+ 4096.0 (-> s3-0 y))) - ) - (else - (format 0 "failed to find jak ground on pos-from-entity~%") - ) - ) - ) - ) - (vector-copy! (-> arg0 trans) s3-0) - (vector-! s4-0 s3-0 s2-0) - (set! (-> s4-0 y) 16384.0) - (vector+! (-> arg0 camera-trans) s4-0 s3-0) - (vector-negate! s4-0 s4-0) - (set! (-> s4-0 y) 0.0) - (vector-normalize! s4-0 1.0) - (let ((s3-1 (new 'stack-no-clear 'quaternion))) - (quaternion-from-two-vectors! s3-1 (new 'static 'vector :z 1.0) s4-0) - (quaternion->matrix s5-0 s3-1) - (set-vector! - (-> arg0 quat) - (the int (* 32767.0 (-> s3-1 x))) - (the int (* 32767.0 (-> s3-1 y))) - (the int (* 32767.0 (-> s3-1 z))) - (the int (* 32767.0 (-> s3-1 w))) - ) - ) - (set! (-> arg0 camera-rot 0) (the int (* 32767.0 (-> s5-0 rvec x)))) - (set! (-> arg0 camera-rot 1) (the int (* 32767.0 (-> s5-0 rvec y)))) - (set! (-> arg0 camera-rot 2) (the int (* 32767.0 (-> s5-0 rvec z)))) - (set! (-> arg0 camera-rot 3) (the int (* 32767.0 (-> s5-0 uvec x)))) - (set! (-> arg0 camera-rot 4) (the int (* 32767.0 (-> s5-0 uvec y)))) - (set! (-> arg0 camera-rot 5) (the int (* 32767.0 (-> s5-0 uvec z)))) - (set! (-> arg0 camera-rot 6) (the int (* 32767.0 (-> s5-0 fvec x)))) - (set! (-> arg0 camera-rot 7) (the int (* 32767.0 (-> s5-0 fvec y)))) - (set! (-> arg0 camera-rot 8) (the int (* 32767.0 (-> s5-0 fvec z)))) ) - ) - (let ((t9-11 quaternion-copy!) - (a0-46 (-> self control quat-for-control)) - (a1-12 (new 'stack-no-clear 'quaternion)) + (vector-copy! (-> arg0 trans) s3-0) + (vector-! s4-0 s3-0 s2-0) + (set! (-> s4-0 y) 16384.0) + (vector+! (-> arg0 camera-trans) s4-0 s3-0) + (vector-negate! s4-0 s4-0) + (set! (-> s4-0 y) 0.0) + (vector-normalize! s4-0 1.0) + (let ((s3-1 (new 'stack-no-clear 'quaternion))) + (quaternion-from-two-vectors! s3-1 (new 'static 'vector :z 1.0) s4-0) + (quaternion->matrix s5-0 s3-1) + (set-vector! + (-> arg0 quat) + (the int (* 32767.0 (-> s3-1 x))) + (the int (* 32767.0 (-> s3-1 y))) + (the int (* 32767.0 (-> s3-1 z))) + (the int (* 32767.0 (-> s3-1 w))) ) - (set! (-> a1-12 x) (* 0.00003051851 (the float (-> arg0 quat x)))) - (set! (-> a1-12 y) (* 0.00003051851 (the float (-> arg0 quat y)))) - (set! (-> a1-12 z) (* 0.00003051851 (the float (-> arg0 quat z)))) - (set! (-> a1-12 w) (* 0.00003051851 (the float (-> arg0 quat w)))) - (t9-11 a0-46 a1-12) + ) + (set! (-> arg0 camera-rot 0) (the int (* 32767.0 (-> s5-0 rvec x)))) + (set! (-> arg0 camera-rot 1) (the int (* 32767.0 (-> s5-0 rvec y)))) + (set! (-> arg0 camera-rot 2) (the int (* 32767.0 (-> s5-0 rvec z)))) + (set! (-> arg0 camera-rot 3) (the int (* 32767.0 (-> s5-0 uvec x)))) + (set! (-> arg0 camera-rot 4) (the int (* 32767.0 (-> s5-0 uvec y)))) + (set! (-> arg0 camera-rot 5) (the int (* 32767.0 (-> s5-0 uvec z)))) + (set! (-> arg0 camera-rot 6) (the int (* 32767.0 (-> s5-0 fvec x)))) + (set! (-> arg0 camera-rot 7) (the int (* 32767.0 (-> s5-0 fvec y)))) + (set! (-> arg0 camera-rot 8) (the int (* 32767.0 (-> s5-0 fvec z)))) ) - (move-to-point! (-> self control) (-> arg0 trans)) - (rot->dir-targ! (-> self control)) - (vector-copy! (-> self control camera-pos) (-> self control trans)) ) - (else - (format 0 "ERROR: failed to find '~S' for pos-from-entity~%" (-> arg0 on-goto)) + (let ((t9-11 quaternion-copy!) + (a0-47 (-> self control quat-for-control)) + (a1-12 (new 'stack-no-clear 'quaternion)) + ) + (set! (-> a1-12 x) (* 0.00003051851 (the float (-> arg0 quat x)))) + (set! (-> a1-12 y) (* 0.00003051851 (the float (-> arg0 quat y)))) + (set! (-> a1-12 z) (* 0.00003051851 (the float (-> arg0 quat z)))) + (set! (-> a1-12 w) (* 0.00003051851 (the float (-> arg0 quat w)))) + (t9-11 a0-47 a1-12) ) + (move-to-point! (-> self control) (-> arg0 trans)) + (rot->dir-targ! (-> self control)) + (vector-copy! (-> self control camera-pos) (-> self control trans)) + ) + (else + (format 0 "ERROR: failed to find '~S' for pos-from-entity~%" (-> arg0 on-goto)) ) ) - (none) ) + (none) ) (defbehavior target-continue-init-art target () @@ -1814,7 +1777,7 @@ (defbehavior target-death-anim-trans target () (send-event *camera* 'joystick 0.0 -1.0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (let ((gp-0 (new 'stack-no-clear 'vector))) (when (not (logtest? (-> self align flags) (align-flags disabled))) (vector-matrix*! gp-0 (-> self align delta trans) (-> self control c-R-w)) diff --git a/goal_src/jak3/engine/target/target-ladder.gc b/goal_src/jak3/engine/target/target-ladder.gc index b4bc91b9cb..c3bd8338b0 100644 --- a/goal_src/jak3/engine/target/target-ladder.gc +++ b/goal_src/jak3/engine/target/target-ladder.gc @@ -590,7 +590,7 @@ (let ((f30-0 (-> self ladder flip))) (ja-no-eval :group! jakb-ladder-switch-ja :num! (seek! max 1.25) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (set! (-> self ladder flip) (the float (sar (shl (the int (lerp-scale f30-0 (+ 32768.0 f30-0) (ja-aframe-num 0) 0.0 30.0)) 48) 48)) ) @@ -612,7 +612,7 @@ (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! jakb-ladder-jump-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) diff --git a/goal_src/jak3/engine/target/target-lightjak.gc b/goal_src/jak3/engine/target/target-lightjak.gc index bd76c5b6c8..590d8f5646 100644 --- a/goal_src/jak3/engine/target/target-lightjak.gc +++ b/goal_src/jak3/engine/target/target-lightjak.gc @@ -1607,7 +1607,7 @@ ) (ja-no-eval :group! jakb-lightjak-get-on-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel) 1.0 f30-0 1.0) (suspend) (ja :num! (seek!)) @@ -2277,41 +2277,21 @@ ) (defmethod freeze-screen-method-24 ((this freeze-screen)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s3-0 (camera-matrix)) - (s5-0 (new 'stack-no-clear 'vector)) - (gp-0 (new 'stack-no-clear 'vector)) - (f30-0 4096.0) - ) - ;; og:preserve-this resize effect based on aspect ratio - (let ((f0-4 (* 0.00013563369 (tan (* 0.5 (-> *math-camera* fov))) f30-0))) - (set-vector! (-> this root scale) (* f0-4 (if (-> *pc-settings* use-vis?) 1.0 (-> *pc-settings* aspect-ratio-scale))) f0-4 f0-4 1.0) - ) - (vector-copy! gp-0 (camera-pos)) - (vector-normalize-copy! s5-0 (-> s3-0 fvec) 1.0) - (matrix->quaternion (-> this root quat) s3-0) - (let ((v1-10 (-> this root trans))) - (let ((a0-5 f30-0)) - (.mov vf7 a0-5) - ) - (.lvf vf5 (&-> s5-0 quad)) - (.lvf vf4 (&-> gp-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 (&-> v1-10 quad) vf6) + (let ((s3-0 (camera-matrix)) + (s5-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + (f30-0 4096.0) ) + (let ((f0-4 (* 0.00013563369 (tan (/ (-> *math-camera* fov) 2)) f30-0))) + (set-vector! (-> this root scale) (* f0-4 (if (-> *pc-settings* use-vis?) 1.0 (-> *pc-settings* aspect-ratio-scale))) f0-4 f0-4 1.0) ) - 0 - (none) + (vector-copy! gp-0 (camera-pos)) + (vector-normalize-copy! s5-0 (-> s3-0 fvec) 1.0) + (matrix->quaternion (-> this root quat) s3-0) + (vector+*! (-> this root trans) gp-0 s5-0 f30-0) ) + 0 + (none) ) (defbehavior freeze-screen-init freeze-screen ((arg0 vector) (arg1 quaternion) (arg2 entity)) @@ -2790,7 +2770,7 @@ (ja-no-eval :group! gp-0 :num! (seek! max (-> self control current-surface align-speed)) :frame-num 0.0) ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (suspend) (ja :num! (seek! max (-> self control current-surface align-speed))) @@ -2881,7 +2861,7 @@ (show-hud 'hud-health) (ja-no-eval :group! jakb-lightjak-heal-ja :num! (seek!) :frame-num (ja-aframe f28-0 0)) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel) 1.0 2.0 1.0) (set-forward-vel (* 0.6 (-> self control ctrl-xz-vel))) (suspend) @@ -3020,42 +3000,23 @@ #f ) :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s3-0 (the-as target (as-type (ppointer->process (-> self parent)) process-focusable))) - (s4-0 (camera-matrix)) - (s5-0 (new 'stack-no-clear 'vector)) - (gp-1 (new 'stack-no-clear 'vector)) - (f30-0 4096.0) - ) - (let ((f0-0 3.0)) - (set-vector! (-> self root scale) f0-0 f0-0 f0-0 1.0) - ) - (vector-copy! gp-1 (get-trans s3-0 5)) - (vector-normalize-copy! s5-0 (-> s4-0 fvec) 0.0) - (matrix->quaternion (-> self root quat) s4-0) - (let ((v1-11 (-> self root trans))) - (let ((a0-5 f30-0)) - (.mov vf7 a0-5) - ) - (.lvf vf5 (&-> s5-0 quad)) - (.lvf vf4 (&-> gp-1 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-11 quad) vf6) + (let ((s3-0 (the-as target (as-type (ppointer->process (-> self parent)) process-focusable))) + (s4-0 (camera-matrix)) + (s5-0 (new 'stack-no-clear 'vector)) + (gp-1 (new 'stack-no-clear 'vector)) + (f30-0 4096.0) ) + (let ((f0-0 3.0)) + (set-vector! (-> self root scale) f0-0 f0-0 f0-0 1.0) ) - (set! (-> self draw force-fade) (the-as uint (the int (* 128.0 (- 1.0 (-> self fade)))))) - (sound-play "ltjak-shield" :id (the-as sound-id (-> self tone))) - (ja-post) + (vector-copy! gp-1 (get-trans s3-0 5)) + (vector-normalize-copy! s5-0 (-> s4-0 fvec) 0.0) + (matrix->quaternion (-> self root quat) s4-0) + (vector+*! (-> self root trans) gp-1 s5-0 f30-0) ) + (set! (-> self draw force-fade) (the-as uint (the int (* 128.0 (- 1.0 (-> self fade)))))) + (sound-play "ltjak-shield" :id (the-as sound-id (-> self tone))) + (ja-post) ) ) diff --git a/goal_src/jak3/engine/target/target-part.gc b/goal_src/jak3/engine/target/target-part.gc index e0164738ee..5d8d17f167 100644 --- a/goal_src/jak3/engine/target/target-part.gc +++ b/goal_src/jak3/engine/target/target-part.gc @@ -3223,12 +3223,10 @@ (sv-624 int) (sv-640 vector) ) - (rlet ((acc :class vf) - (vf0 :class vf) + (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((s1-0 (-> arg0 draw lod-set lod (-> arg0 draw cur-lod) geo length))) @@ -3345,21 +3343,7 @@ (s2-1 (new 'stack-no-clear 'vector)) ) (set! (-> s4-1 state points-to-draw) 0) - (let ((a1-32 s3-1)) - (let ((v1-44 sv-432)) - (let ((a0-38 sv-448)) - (let ((a2-30 arg4)) - (.mov vf7 a2-30) - ) - (.lvf vf5 (&-> a0-38 quad)) - ) - (.lvf vf4 (&-> v1-44 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) - ) + (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) @@ -3371,26 +3355,12 @@ (quaternion-from-two-vectors! sv-480 s0-2 sv-464) (vector-orient-by-quat! s1-2 sv-448 sv-480) (vector-copy! s1-2 sv-448) - (let ((a1-40 s2-1)) - (let ((v1-56 sv-640)) - (let ((a0-47 s1-2)) - (let ((a2-34 arg4)) - (.mov vf7 a2-34) - ) - (.lvf vf5 (&-> a0-47 quad)) - ) - (.lvf vf4 (&-> v1-56 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-40 quad) vf6) - ) + (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-36 (vector-average! (new 'stack-no-clear 'vector) s2-1 s3-1))) - (sv-592 sv-608 sv-624 a2-36) + (let ((a2-34 (vector-average! (new 'stack-no-clear 'vector) s2-1 s3-1))) + (sv-592 sv-608 sv-624 a2-34) ) (+! (-> s4-1 state points-to-draw) 1) (set-point! s4-1 (-> s4-1 state points-to-draw) s2-1) diff --git a/goal_src/jak3/engine/target/target-swim.gc b/goal_src/jak3/engine/target/target-swim.gc index b456775632..3f6c175ffb 100644 --- a/goal_src/jak3/engine/target/target-swim.gc +++ b/goal_src/jak3/engine/target/target-swim.gc @@ -549,7 +549,7 @@ (ja-channel-push! 1 (seconds 0.15)) (ja-no-eval :group! jakb-swim-walk-ja :num! (seek!) :frame-num (ja-aframe 19.0 0)) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (if (not (logtest? (-> self align flags) (align-flags disabled))) (set! (-> self control mod-surface target-speed) (* (-> self align delta trans z) (-> self control current-surface alignv) (-> self clock frames-per-second)) @@ -567,7 +567,7 @@ (until #f (ja-no-eval :group! jakb-swim-walk-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (if (not (logtest? (-> self align flags) (align-flags disabled))) (set! (-> self control mod-surface target-speed) (* (-> self align delta trans z) (-> self control current-surface alignv) (-> self clock frames-per-second)) @@ -719,7 +719,7 @@ (let ((s4-0 #f)) (ja-no-eval :group! jakb-swim-walk-to-down-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) (when (and (>= (ja-aframe-num 0) 73.0) (not s4-0)) (set! s4-0 #t) @@ -884,7 +884,7 @@ ) (goto cfg-51) ) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (not (logtest? (-> self water flags) (water-flag under-water))) (logior! (-> self water flags) (water-flag swim-ground)) (set! s5-0 #f) @@ -913,7 +913,7 @@ (if (cpad-pressed? (-> self control cpad number) x) (set! f30-0 2.0) ) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (logtest? (-> self water flags) (water-flag under-water)) (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) (set! (-> self control transv y) (+ 8192.0 (* 8192.0 f30-0))) @@ -967,7 +967,7 @@ (ja-channel-push! 1 (seconds 0.05)) (ja :group! jakb-swim-jump-ja :num! min) (until (and (ja-done? 0) (= (-> self skel root-channel 0) (-> self skel channel))) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (if (not (logtest? (-> self align flags) (align-flags disabled))) (+! (-> self water align-offset) (* 0.6 (-> self align delta trans y))) ) diff --git a/goal_src/jak3/engine/target/target-tube.gc b/goal_src/jak3/engine/target/target-tube.gc index 101b195b0a..74aa796faf 100644 --- a/goal_src/jak3/engine/target/target-tube.gc +++ b/goal_src/jak3/engine/target/target-tube.gc @@ -982,7 +982,7 @@ (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! jakb-deatha-ja :num! (seek! (ja-aframe 134.0 0)) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (let ((gp-2 (new 'stack-no-clear 'vector))) (when (not (logtest? (-> self align flags) (align-flags disabled))) (vector-matrix*! gp-2 (-> self align delta trans) (-> self control c-R-w)) diff --git a/goal_src/jak3/engine/target/target-turret-shot.gc b/goal_src/jak3/engine/target/target-turret-shot.gc index 35635cf999..31b394f782 100644 --- a/goal_src/jak3/engine/target/target-turret-shot.gc +++ b/goal_src/jak3/engine/target/target-turret-shot.gc @@ -234,59 +234,37 @@ ) (defmethod projectile-method-25 ((this turret-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 1013 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 1013 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 1013) a1-0 s5-1 #f) - (set! (-> *part-id-table* 1013 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 851) s4-0) - (launch-particles (-> *part-id-table* 852) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f26-0 (/ f30-0 (meters 9))) - (f30-1 (-> *part-id-table* 1021 init-specs 3 initial-valuef)) - (f28-1 (-> *part-id-table* 1021 init-specs 4 initial-valuef)) - ) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 1021 init-specs 3 initial-valuef) (* f26-0 f30-1)) - (set! (-> *part-id-table* 1021 init-specs 4 initial-valuef) (* f26-0 f28-1)) - (launch-particles (-> *part-id-table* 1021) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 1021 init-specs 3 initial-valuef) f30-1) - (set! (-> *part-id-table* 1021 init-specs 4 initial-valuef) f28-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 1013 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 1013 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 1013) a1-0 s5-1 #f) + (set! (-> *part-id-table* 1013 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 851) s4-1) + (launch-particles (-> *part-id-table* 852) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f26-0 (/ f30-0 (meters 9))) + (f30-1 (-> *part-id-table* 1021 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 1021 init-specs 4 initial-valuef)) + ) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 1021 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 1021 init-specs 4 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 1021) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 1021 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 1021 init-specs 4 initial-valuef) f28-1) ) - 0 - (none) ) + 0 + (none) ) (defmethod projectile-method-26 ((this turret-shot)) diff --git a/goal_src/jak3/engine/target/target-turret.gc b/goal_src/jak3/engine/target/target-turret.gc index 15eefdf10e..05ac2bb78c 100644 --- a/goal_src/jak3/engine/target/target-turret.gc +++ b/goal_src/jak3/engine/target/target-turret.gc @@ -1382,48 +1382,30 @@ ) (defbehavior target-turret-blend-mat target ((arg0 cam-rotation-tracker) (arg1 matrix) (arg2 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (cond - ((>= arg2 1.0) - (dotimes (s4-1 3) - (vector-normalize-copy! (the-as vector (&-> arg0 inv-mat quad s4-1)) (the-as vector (&-> arg1 quad s4-1)) 1.0) - (set! (-> arg0 inv-mat vector s4-1 w) 0.0) - ) + (cond + ((>= arg2 1.0) + (dotimes (s4-1 3) + (vector-normalize-copy! (the-as vector (&-> arg0 inv-mat quad s4-1)) (the-as vector (&-> arg1 quad s4-1)) 1.0) + (set! (-> arg0 inv-mat vector s4-1 w) 0.0) ) - (else - (dotimes (s3-0 3) - (set! arg2 (fmax 0.0 (fmin 1.0 arg2))) - (vector-normalize! (the-as vector (&-> arg0 inv-mat quad s3-0)) (- 1.0 arg2)) - (let ((v1-15 (&-> arg0 inv-mat quad s3-0))) - (let ((a0-5 (&-> arg0 inv-mat quad s3-0))) - (let ((a1-5 (&-> arg1 quad s3-0))) - (let ((a2-2 arg2)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a1-5 0)) - ) - (.lvf vf4 (&-> a0-5 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 (&-> v1-15 0) vf6) - ) - (vector-normalize! (the-as vector (&-> arg0 inv-mat quad s3-0)) 1.0) - (set! (-> arg0 inv-mat vector s3-0 w) 0.0) + ) + (else + (dotimes (s3-0 3) + (set! arg2 (fmax 0.0 (fmin 1.0 arg2))) + (vector-normalize! (the-as vector (&-> arg0 inv-mat quad s3-0)) (- 1.0 arg2)) + (vector+*! + (the-as vector (&-> arg0 inv-mat quad s3-0)) + (the-as vector (&-> arg0 inv-mat quad s3-0)) + (the-as vector (&-> arg1 quad s3-0)) + arg2 ) + (vector-normalize! (the-as vector (&-> arg0 inv-mat quad s3-0)) 1.0) + (set! (-> arg0 inv-mat vector s3-0 w) 0.0) ) ) - 0 - (none) ) + 0 + (none) ) (defstate cam-turret (camera-slave) diff --git a/goal_src/jak3/engine/target/target-util.gc b/goal_src/jak3/engine/target/target-util.gc index e0d3adc897..eb7aaa9e39 100644 --- a/goal_src/jak3/engine/target/target-util.gc +++ b/goal_src/jak3/engine/target/target-util.gc @@ -1698,66 +1698,51 @@ ) (defmethod attack-info-method-9 ((this attack-info) (arg0 attack-info) (arg1 process-drawable) (arg2 process-drawable)) - (local-vars (v1-14 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) + (let ((s5-0 (as-type arg1 process-drawable))) + (let ((v1-0 (as-type arg2 process-drawable))) + (cond + ((logtest? (attack-mask attacker-velocity) (-> this mask)) + (vector-copy! (-> arg0 attacker-velocity) (-> this attacker-velocity)) + (vector-normalize-copy! (-> arg0 trans) (-> arg0 attacker-velocity) 1.0) ) - (init-vf0-vector) - (let ((s5-0 (as-type arg1 process-drawable))) - (let ((v1-0 (as-type arg2 process-drawable))) - (cond - ((logtest? (attack-mask attacker-velocity) (-> this mask)) - (vector-copy! (-> arg0 attacker-velocity) (-> this attacker-velocity)) - (vector-normalize-copy! (-> arg0 trans) (-> arg0 attacker-velocity) 1.0) - ) - (v1-0 - (cond - (s5-0 - (vector-! (-> arg0 trans) (-> v1-0 root trans) (-> s5-0 root trans)) - (vector-normalize! (-> arg0 trans) 1.0) - (vector-copy! (-> arg0 attacker-velocity) (-> arg0 trans)) - ) - (else - (vector-z-quaternion! (-> arg0 trans) (-> v1-0 root quat)) - (vector-negate-in-place! (-> arg0 trans)) - (vector-normalize! (-> arg0 trans) 1.0) - (vector-copy! (-> arg0 attacker-velocity) (-> arg0 trans)) - ) + (v1-0 + (cond + (s5-0 + (vector-! (-> arg0 trans) (-> v1-0 root trans) (-> s5-0 root trans)) + (vector-normalize! (-> arg0 trans) 1.0) + (vector-copy! (-> arg0 attacker-velocity) (-> arg0 trans)) + ) + (else + (vector-z-quaternion! (-> arg0 trans) (-> v1-0 root quat)) + (vector-negate-in-place! (-> arg0 trans)) + (vector-normalize! (-> arg0 trans) 1.0) + (vector-copy! (-> arg0 attacker-velocity) (-> arg0 trans)) ) ) - (else - (set! (-> arg0 trans quad) (the-as uint128 0)) - (set! (-> arg0 attacker-velocity quad) (the-as uint128 0)) - ) + ) + (else + (set! (-> arg0 trans quad) (the-as uint128 0)) + (set! (-> arg0 attacker-velocity quad) (the-as uint128 0)) ) ) - (if s5-0 - (vector-copy! (-> arg0 intersection) (-> s5-0 root trans)) - (vector-copy! (-> arg0 intersection) (target-pos 0)) - ) ) - (.lvf vf1 (&-> (-> arg0 trans) 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-14 vf1) - (cond - ((!= v1-14 0.0) - (vector-copy! (-> arg0 vector) (-> arg0 trans)) - (set! (-> arg0 vector y) 0.0) - (vector-xz-normalize! (-> arg0 vector) 1.0) - ) - (else - (set! (-> arg0 vector quad) (the-as uint128 0)) + (if s5-0 + (vector-copy! (-> arg0 intersection) (-> s5-0 root trans)) + (vector-copy! (-> arg0 intersection) (target-pos 0)) ) - ) - 0 - (none) ) + (cond + ((!= (vector-length-squared (-> arg0 trans)) 0.0) + (vector-copy! (-> arg0 vector) (-> arg0 trans)) + (set! (-> arg0 vector y) 0.0) + (vector-xz-normalize! (-> arg0 vector) 1.0) + ) + (else + (set! (-> arg0 vector quad) (the-as uint128 0)) + ) + ) + 0 + (none) ) (defmethod compute-intersect-info ((this attack-info) (arg0 object) (arg1 process-drawable) (arg2 process) (arg3 touching-shapes-entry)) diff --git a/goal_src/jak3/engine/target/target.gc b/goal_src/jak3/engine/target/target.gc index ffb7f9f7be..768f36c3a3 100644 --- a/goal_src/jak3/engine/target/target.gc +++ b/goal_src/jak3/engine/target/target.gc @@ -324,11 +324,11 @@ (ja-channel-push! 1 (seconds 0.04)) (ja :group! jakb-turn-around-ja :num! min) (quaternion-rotate-y! (-> self control dir-targ) (-> self control dir-targ) 32768.0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (until (ja-done? 0) (suspend) (ja :num! (seek! max 2.0)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) ) (remove-exit) @@ -2216,7 +2216,7 @@ (ja-channel-push! 1 (seconds 0.05)) (ja-no-eval :group! s5-0 :num! (seek! max (-> self control current-surface align-speed)) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (set! (-> self control mod-surface) *attack-mods*) (when (and gp-0 (send-event (handle->process (-> self control unknown-combo-tracker00 target)) 'combo)) @@ -2615,7 +2615,7 @@ (f28-0 1.0) ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (not (ja-min? 0)) (cond ((and (>= (ja-aframe-num 0) 20.0) @@ -3293,11 +3293,11 @@ ) ) ) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (until (ja-done? 0) (suspend) (ja :num! (seek! max 0.9)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (set! (-> self control turn-go-the-long-way) 1.0) (let ((v1-27 (ja-group))) (if (and v1-27 (= v1-27 jakb-attack-uppercut-ja)) @@ -3691,12 +3691,14 @@ ) :exit target-exit :trans (behavior () + (when (and (!= (-> self control unknown-spool-anim00) 'stuck) (!= (-> self state-time) (current-time))) ;; og:preserve-this - High FPS Fix (if (and (recently-pressed? circle) (can-feet? #f) ) (go target-attack-air 'flop) ) + ) (when (and (and (= (-> self fact eco-type) 2) (>= (-> self fact eco-level) 1.0)) (not (time-elapsed? (-> self state-time) (seconds 0.25))) ) @@ -3822,7 +3824,7 @@ (if (cpad-pressed? (-> self control cpad number) square) (current-time) ) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (cond ((nonzero? s5-0) ) @@ -3944,7 +3946,7 @@ ) (let ((f30-0 1.0)) (until v1-37 - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (if (not (ja-max? 0)) (align! (-> self align) diff --git a/goal_src/jak3/engine/target/target2.gc b/goal_src/jak3/engine/target/target2.gc index a85c8b0a5c..0184c8f7f5 100644 --- a/goal_src/jak3/engine/target/target2.gc +++ b/goal_src/jak3/engine/target/target2.gc @@ -32,7 +32,7 @@ (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! jakb-trip-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) (let ((a1-3 (new 'stack-no-clear 'event-message-block))) (let ((v1-22 (process->ppointer self))) @@ -1125,7 +1125,7 @@ (target-compute-edge-rider) ) ) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (not (logtest? (-> self align flags) (align-flags disabled))) (vector-matrix*! s3-0 (-> self align delta trans) (-> self control c-R-w)) (move-by-vector! (-> self control) s3-0) @@ -1175,7 +1175,7 @@ ) (ja-no-eval :group! jakb-edge-grab-off-ja :num! (seek! (ja-aframe 191.0 0)) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (not (logtest? (-> self align flags) (align-flags disabled))) (vector-matrix*! gp-0 (-> self align delta trans) (-> self control c-R-w)) (move-by-vector! (-> self control) gp-0) @@ -1293,7 +1293,7 @@ ) (until (ja-done? 0) (gp-0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel) 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 8743637a05..ab9011a8cf 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 @@ -2842,44 +2842,30 @@ ) (defun kg-bombbot-find-nearest-nav-mesh ((arg0 kg-bombbot) (arg1 float)) - (local-vars (v1-15 float) (sv-64 nav-poly) (sv-68 nav-mesh) (sv-72 float) (sv-76 kg-bombbot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-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) - (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))) - (.lvf vf1 (&-> (-> sv-64 vertex) 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-15 vf1) - (let ((f0-1 v1-15) - (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) - ) + (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) ) ) ) @@ -2890,8 +2876,8 @@ ) ) ) - sv-68 ) + sv-68 ) (defmethod bombbot-method-205 ((this kg-bombbot)) @@ -2920,50 +2906,27 @@ ;; WARN: Return type mismatch object vs none. (defmethod bombbot-method-196 ((this kg-bombbot) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 - (as-type - (handle->process (-> *blow-tower-targets* target-handles (logand (rand-uint31-gen *random-generator*) 1))) - process-focusable - ) + (let ((s5-0 + (as-type + (handle->process (-> *blow-tower-targets* target-handles (logand (rand-uint31-gen *random-generator*) 1))) + process-focusable ) ) - (cond - (s5-0 - (vector-copy! (-> this target-pos) (get-trans s5-0 3)) - (let ((v1-9 (-> this target-pos))) - (let ((a0-9 (-> s5-0 root trans))) - (let ((a1-5 (-> s5-0 root transv))) - (let ((a2-0 0.0)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a1-5 quad)) - ) - (.lvf vf4 (&-> a0-9 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-9 quad) vf6) - ) - (vector-copy! (-> this start-target-pos) (-> this target-pos)) - (vector-copy! (-> this start-target-vel) (-> s5-0 root transv)) - (focus-on! (-> this focus) s5-0 this) - ) - (else - (clear-focused (-> this focus)) - ) + ) + (cond + (s5-0 + (vector-copy! (-> this target-pos) (get-trans s5-0 3)) + (vector+*! (-> this target-pos) (-> s5-0 root trans) (-> s5-0 root transv) 0.0) + (vector-copy! (-> this start-target-pos) (-> this target-pos)) + (vector-copy! (-> this start-target-vel) (-> s5-0 root transv)) + (focus-on! (-> this focus) s5-0 this) + ) + (else + (clear-focused (-> this focus)) ) ) - (none) ) + (none) ) (defstate hostile (kg-bombbot) 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 423ee49035..eaf854cc29 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 @@ -1006,7 +1006,7 @@ ) (set! sv-176 f30-1) (let ((a3-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) arg2))) - (s4-1 s3-1 (the-as quaternion s0-1) sv-176 a3-1) + (s4-1 s3-1 s0-1 sv-176 a3-1) ) ) (vector+! s2-0 s2-0 s1-0) @@ -3022,7 +3022,7 @@ (s3-3 (-> this pitch-quat)) ) (let ((f28-1 (-> this roll-amount))) - (vector-rotate-around-axis! sv-268 (the-as quaternion sv-260) (-> v1-68 rot-y-shift) *up-vector*) + (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) diff --git a/goal_src/jak3/levels/city/bombbot/bombbot.gc b/goal_src/jak3/levels/city/bombbot/bombbot.gc index 6a7e605d3c..c7e582d4c4 100644 --- a/goal_src/jak3/levels/city/bombbot/bombbot.gc +++ b/goal_src/jak3/levels/city/bombbot/bombbot.gc @@ -335,14 +335,9 @@ (defmethod bombbot-bomb-method-32 ((this bombbot-bomb)) (local-vars (at-0 int)) - (rlet ((acc :class vf) - (vf0 :class vf) + (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((s5-0 (-> this root))) @@ -386,21 +381,7 @@ (quaternion-normalize! (-> this root quat)) (let ((a1-6 (-> this root))) (when (logtest? (-> a1-6 status) (collide-status touch-surface)) - (let ((a0-14 (-> a1-6 transv))) - (let ((v1-20 (-> a1-6 transv))) - (let ((a1-7 (-> a1-6 transv))) - (let ((a2-8 (* -15.0 (seconds-per-frame)))) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a1-7 quad)) - ) - (.lvf vf4 (&-> v1-20 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-14 quad) vf6) - ) + (vector+*! (-> a1-6 transv) (-> a1-6 transv) (-> a1-6 transv) (* -15.0 (seconds-per-frame))) (set! (-> this rot-angle) (* -4.0 (vector-length (-> this root transv)))) ) ) @@ -446,91 +427,54 @@ ) (defbehavior bombbot-bomb-handler bombbot-bomb ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (case arg2 - (('attack) - (cond - ((= (-> arg0 type) target) - (let ((s3-0 (as-type (ppointer->process (-> self parent)) process-focusable)) - (s5-0 (new 'stack-no-clear 'traj3d-params)) - (gp-1 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (when s3-0 - (vector-rotate-around-y! gp-1 *x-vector* (* 182.04445 (rand-vu-float-range 0.0 360.0))) - (let ((s2-1 (-> s5-0 dest))) - (let ((v1-6 (get-trans s3-0 3))) - (let ((a0-6 gp-1)) - (let ((a1-7 8192.0)) - (.mov vf7 a1-7) - ) - (.lvf vf5 (&-> a0-6 quad)) + (case arg2 + (('attack) + (cond + ((= (-> arg0 type) target) + (let ((s3-0 (as-type (ppointer->process (-> self parent)) process-focusable)) + (s5-0 (new 'stack-no-clear 'traj3d-params)) + (gp-1 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (when s3-0 + (vector-rotate-around-y! gp-1 *x-vector* (* 182.04445 (rand-vu-float-range 0.0 360.0))) + (vector+*! (-> s5-0 dest) (get-trans s3-0 3) gp-1 8192.0) + (vector+*! (-> s5-0 dest) (-> s5-0 dest) (get-transv s3-0) 2.0) + (vector-copy! (-> s5-0 src) (-> self root trans)) + (set! (-> s5-0 initial-tilt) (* 182.04445 (rand-vu-float-range 30.0 50.0))) + (set! (-> s5-0 gravity) 184320.0) + (when (traj3d-calc-initial-velocity-using-tilt s5-0) + (vector-! gp-1 (-> self root trans) (target-pos 0)) + (set! (-> gp-1 y) 0.0) + (vector-normalize! gp-1 1.0) + (vector-copy! s4-0 (-> s5-0 initial-velocity)) + (set! (-> s4-0 y) 0.0) + (vector-normalize! s4-0 1.0) + (cond + ((< 0.7 (vector-dot gp-1 s4-0)) + (vector-copy! (-> self root transv) (-> s5-0 initial-velocity)) + ) + (else + (let ((t9-10 vector-normalize!) + (a0-21 gp-1) + (v1-20 (-> s5-0 initial-velocity)) + ) + (t9-10 a0-21 (sqrtf (+ (* (-> v1-20 x) (-> v1-20 x)) (* (-> v1-20 z) (-> v1-20 z))))) ) - (.lvf vf4 (&-> v1-6 quad)) + (set! (-> gp-1 y) (-> s5-0 initial-velocity y)) + (vector-copy! (-> self root transv) gp-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 (&-> s2-1 quad) vf6) - ) - (let ((s1-1 (-> s5-0 dest))) - (let ((s2-2 (-> s5-0 dest))) - (let ((v1-8 (get-transv s3-0))) - (let ((a0-9 2.0)) - (.mov vf7 a0-9) - ) - (.lvf vf5 (&-> v1-8 quad)) - ) - (.lvf vf4 (&-> s2-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 (&-> s1-1 quad) vf6) - ) - (vector-copy! (-> s5-0 src) (-> self root trans)) - (set! (-> s5-0 initial-tilt) (* 182.04445 (rand-vu-float-range 30.0 50.0))) - (set! (-> s5-0 gravity) 184320.0) - (when (traj3d-calc-initial-velocity-using-tilt s5-0) - (vector-! gp-1 (-> self root trans) (target-pos 0)) - (set! (-> gp-1 y) 0.0) - (vector-normalize! gp-1 1.0) - (vector-copy! s4-0 (-> s5-0 initial-velocity)) - (set! (-> s4-0 y) 0.0) - (vector-normalize! s4-0 1.0) - (cond - ((< 0.7 (vector-dot gp-1 s4-0)) - (vector-copy! (-> self root transv) (-> s5-0 initial-velocity)) - ) - (else - (let ((t9-10 vector-normalize!) - (a0-22 gp-1) - (v1-20 (-> s5-0 initial-velocity)) - ) - (t9-10 a0-22 (sqrtf (+ (* (-> v1-20 x) (-> v1-20 x)) (* (-> v1-20 z) (-> v1-20 z))))) - ) - (set! (-> gp-1 y) (-> s5-0 initial-velocity y)) - (vector-copy! (-> self root transv) gp-1) - ) - ) - (go-virtual back) ) + (go-virtual back) ) ) ) - (else - #f - ) + ) + (else + #f ) ) - ) + ) ) ) @@ -1075,70 +1019,18 @@ ) (defun bombbot-do-spline ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((f1-1 (* arg5 arg5)) + (f0-2 (* arg5 f1-1)) ) - (init-vf0-vector) - (let* ((f1-1 (* arg5 arg5)) - (f0-2 (* arg5 f1-1)) - ) - (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) - (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) - (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) - ) - (vector-float*! arg0 arg1 f2-3) - (let ((t2-0 arg0)) - (let ((v1-10 arg0)) - (let ((t1-3 (vector+! (new 'stack-no-clear 'vector) arg1 arg2))) - (let ((a1-1 f3-7)) - (.mov vf7 a1-1) - ) - (.lvf vf5 (&-> t1-3 quad)) - ) - (.lvf vf4 (&-> v1-10 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 (&-> t2-0 quad) vf6) + (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) + (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) + (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) ) - (let ((a2-1 arg0)) - (let ((v1-11 arg0)) - (let ((a1-3 (vector+! (new 'stack-no-clear 'vector) arg3 arg4))) - (let ((t0-1 f1-3)) - (.mov vf7 t0-1) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> v1-11 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-1 quad) vf6) - ) - ) - (let ((v0-0 arg0)) - (let ((v1-12 arg0)) - (let ((a0-1 arg3)) - (let ((a1-4 f0-2)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-12 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 (&-> v0-0 quad) vf6) - v0-0 - ) + (vector-float*! arg0 arg1 f2-3) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg1 arg2) f3-7) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg3 arg4) f1-3) ) + (vector+*! arg0 arg0 arg3 f0-2) ) ) @@ -1172,86 +1064,63 @@ ) (defmethod bombbot-method-204 ((this bombbot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s1-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) - (new 'stack-no-clear 'vector) - (let ((s3-0 (new 'stack-no-clear 'collide-query)) - (s5-0 (new 'stack-no-clear 'vector)) - (gp-0 (new 'stack-no-clear 'vector)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector)) - (f30-0 (lerp-scale 1.0 0.0 (* 0.0033333334 (the float (- (-> this next-target) (current-time)))) 2.5 3.5)) - ) - (if (= (-> this focus handle) #f) - (set! f30-0 0.0) - ) - (matrix->trans s1-0 gp-0) - (let ((a1-3 gp-0)) - (let ((v1-10 gp-0)) - (let ((a0-4 (-> s1-0 fvec))) - (let ((a2-6 8192.0)) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-4 quad)) - ) - (.lvf vf4 (&-> v1-10 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-3 quad) vf6) - ) - (vector-normalize-copy! s5-0 (-> s1-0 fvec) 819200.0) - (vector-copy! (-> s3-0 start-pos) gp-0) - (vector-copy! (-> s3-0 move-dist) s5-0) - (let ((v1-13 s3-0)) - (set! (-> v1-13 radius) 40.96) - (set! (-> v1-13 collide-with) (collide-spec backgnd enemy hit-by-others-list)) - (set! (-> v1-13 ignore-process0) this) - (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-4 (fill-and-probe-using-line-sphere *collide-cache* s3-0))) - (when (>= f0-4 0.0) - (vector+float*! s4-0 (-> s3-0 start-pos) (-> s3-0 move-dist) f0-4) - (vector-float*! s5-0 s5-0 f0-4) - (let ((s2-1 (as-type (-> s3-0 best-other-tri collide-ptr) collide-shape-prim)) - (v1-22 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> s3-0 start-pos) s4-0) 1638.4)) - (s3-1 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s3-1 s4-0) - (vector+! s3-1 s3-1 v1-22) - (cond - (s2-1 - (launch-particles (-> *part-id-table* 2061) s3-1) - (launch-particles (-> *part-id-table* 2060) s3-1) - ) - (else - (launch-particles (-> *part-id-table* 2062) s3-1) - ) - ) - ) - ) - ) - (set! (-> *part-id-table* 2059 init-specs 5 initial-valuef) (* 255.0 f30-0)) - (set! (-> *part-id-table* 2059 init-specs 7 initial-valuef) (* 255.0 (- 1.0 f30-0))) + (let ((s1-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) + (new 'stack-no-clear 'vector) + (let ((s3-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) ) - (draw-beam (-> *part-id-table* 2059) gp-0 s5-0 #t) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (f30-0 (lerp-scale 1.0 0.0 (* 0.0033333334 (the float (- (-> this next-target) (current-time)))) 2.5 3.5)) + ) + (if (= (-> this focus handle) #f) + (set! f30-0 0.0) + ) + (matrix->trans s1-0 gp-0) + (vector+*! gp-0 gp-0 (-> s1-0 fvec) 8192.0) + (vector-normalize-copy! s5-0 (-> s1-0 fvec) 819200.0) + (vector-copy! (-> s3-0 start-pos) gp-0) + (vector-copy! (-> s3-0 move-dist) s5-0) + (let ((v1-13 s3-0)) + (set! (-> v1-13 radius) 40.96) + (set! (-> v1-13 collide-with) (collide-spec backgnd enemy hit-by-others-list)) + (set! (-> v1-13 ignore-process0) this) + (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-4 (fill-and-probe-using-line-sphere *collide-cache* s3-0))) + (when (>= f0-4 0.0) + (vector+float*! s4-0 (-> s3-0 start-pos) (-> s3-0 move-dist) f0-4) + (vector-float*! s5-0 s5-0 f0-4) + (let ((s2-1 (as-type (-> s3-0 best-other-tri collide-ptr) collide-shape-prim)) + (v1-22 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> s3-0 start-pos) s4-0) 1638.4)) + (s3-1 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s3-1 s4-0) + (vector+! s3-1 s3-1 v1-22) + (cond + (s2-1 + (launch-particles (-> *part-id-table* 2061) s3-1) + (launch-particles (-> *part-id-table* 2060) s3-1) + ) + (else + (launch-particles (-> *part-id-table* 2062) s3-1) + ) + ) + ) + ) + ) + (set! (-> *part-id-table* 2059 init-specs 5 initial-valuef) (* 255.0 f30-0)) + (set! (-> *part-id-table* 2059 init-specs 7 initial-valuef) (* 255.0 (- 1.0 f30-0))) ) + (draw-beam (-> *part-id-table* 2059) gp-0 s5-0 #t) ) - 0 - (none) ) + 0 + (none) ) (defmethod valid-target? ((this bombbot) (arg0 process-focusable)) @@ -1358,8 +1227,6 @@ ;; ERROR: Stack slot load at 912 mismatch: defined as size 4, got size 16 ;; 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 -;; 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) @@ -1377,10 +1244,6 @@ (vf1 :class vf) (vf2 :class vf) (vf3 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((s5-0 (new 'stack-no-clear 'collide-query))) @@ -1458,53 +1321,16 @@ (.svf (&-> a0-12 quad) vf1) (vector+! a1-6 v1-42 a0-12) ) - (let ((a1-8 (-> s1-0 speed))) - (let ((v1-43 (-> s1-0 speed))) - (let ((a0-14 (vector-! (new 'stack-no-clear 'vector) s0-0 (-> s1-0 speed)))) - (let ((a2-15 (* 4.0 (seconds-per-frame)))) - (.mov vf7 a2-15) - ) - (.lvf vf5 (&-> a0-14 quad)) - ) - (.lvf vf4 (&-> v1-43 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-8 quad) vf6) - ) - (let ((a1-9 s3-0)) - (let ((v1-44 s3-0)) - (let ((a0-15 (-> s1-0 speed))) - (let ((a2-17 (+ 0.2 f26-0))) - (.mov vf7 a2-17) - ) - (.lvf vf5 (&-> a0-15 quad)) - ) - (.lvf vf4 (&-> v1-44 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-9 quad) vf6) + (vector+*! + (-> s1-0 speed) + (-> s1-0 speed) + (vector-! (new 'stack-no-clear 'vector) s0-0 (-> s1-0 speed)) + (* 4.0 (seconds-per-frame)) ) + (vector+*! s3-0 s3-0 (-> s1-0 speed) (+ 0.2 f26-0)) ) (vector+! s3-0 s3-0 (-> this root trans)) - (let ((a1-12 (-> s5-0 start-pos))) - (let ((v1-46 s3-0)) - (let ((a0-18 s2-0)) - (let ((a2-19 24576.0)) - (.mov vf7 a2-19) - ) - (.lvf vf5 (&-> a0-18 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-12 quad) vf6) - ) + (vector+*! (-> s5-0 start-pos) s3-0 s2-0 24576.0) (vector-float*! (-> s5-0 move-dist) s2-0 -49152.0) (let ((v1-49 s5-0)) (set! (-> v1-49 radius) 40.96) @@ -1518,55 +1344,33 @@ ) (let ((f0-25 (probe-using-line-sphere *collide-cache* s5-0))) (when (>= f0-25 0.0) - (let ((v1-51 (new 'stack-no-clear 'vector))) - (let ((a0-26 (-> s5-0 start-pos))) - (let ((a1-15 (-> s5-0 move-dist))) - (let ((a2-20 f0-25)) - (.mov vf7 a2-20) - ) - (.lvf vf5 (&-> a1-15 quad)) - ) - (.lvf vf4 (&-> a0-26 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-51 quad) vf6) - (- (-> s3-0 y) (-> v1-51 y)) - (vector-copy! s3-0 v1-51) + (let ((v1-52 (vector+*! (new 'stack-no-clear 'vector) (-> s5-0 start-pos) (-> s5-0 move-dist) f0-25))) + (- (-> s3-0 y) (-> v1-52 y)) + (vector-copy! s3-0 v1-52) ) ) ) (vector-copy! (-> s1-0 next-position) s3-0) (set! (-> s1-0 moving) #t) - (let ((a1-16 s3-0)) - (let ((v1-55 (-> s1-0 position))) - (let ((a0-31 (vector-! (new 'stack-no-clear 'vector) (-> s1-0 next-position) (-> s1-0 position)))) - (let ((a2-22 (/ f28-0 f30-0))) - (.mov vf7 a2-22) - ) - (.lvf vf5 (&-> a0-31 quad)) - ) - (.lvf vf4 (&-> v1-55 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-16 quad) vf6) + (vector+*! + s3-0 + (-> s1-0 position) + (vector-! (new 'stack-no-clear 'vector) (-> s1-0 next-position) (-> s1-0 position)) + (/ f28-0 f30-0) ) (let ((t9-6 bombbot-do-spline) (a0-32 (new 'stack-no-clear 'vector)) - (a1-17 (new 'stack-no-clear 'vector)) + (a1-21 (new 'stack-no-clear 'vector)) ) - (set! (-> a1-17 x) 0.0) - (set! (-> a1-17 y) 0.0) - (set! (-> a1-17 z) 0.0) - (set! (-> a1-17 w) 1.0) - (let ((a2-23 (new 'stack-no-clear 'vector))) - (set! (-> a2-23 x) 0.0) - (set! (-> a2-23 y) 0.0) - (set! (-> a2-23 z) 0.5) - (set! (-> a2-23 w) 1.0) + (set! (-> a1-21 x) 0.0) + (set! (-> a1-21 y) 0.0) + (set! (-> a1-21 z) 0.0) + (set! (-> a1-21 w) 1.0) + (let ((a2-18 (new 'stack-no-clear 'vector))) + (set! (-> a2-18 x) 0.0) + (set! (-> a2-18 y) 0.0) + (set! (-> a2-18 z) 0.5) + (set! (-> a2-18 w) 1.0) (let ((a3-1 (new 'stack-no-clear 'vector))) (set! (-> a3-1 x) 0.0) (set! (-> a3-1 y) 0.0) @@ -1577,7 +1381,7 @@ (set! (-> t0-0 y) 4.0) (set! (-> t0-0 z) 0.0) (set! (-> t0-0 w) 1.0) - (let ((v0-6 (t9-6 a0-32 a1-17 a2-23 a3-1 t0-0 (/ f28-0 f30-0)))) + (let ((v0-6 (t9-6 a0-32 a1-21 a2-18 a3-1 t0-0 (/ f28-0 f30-0)))) (set! (-> s1-0 delta-y) (* (/ (-> v0-6 y) 20) (vector-length (-> s1-0 speed)))) ) ) @@ -1596,11 +1400,11 @@ (set! sv-912 (the-as float 0.0)) (set! sv-928 vector-vector-distance) (let* ((a0-36 (camera-pos)) - (a1-19 (-> s1-0 position)) - (a2-25 (sv-928 a0-36 a1-19)) + (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-25 a3-2 t0-1)) + (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) @@ -1621,28 +1425,28 @@ ((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-28 (new-sound-id)) - (a2-37 1024) + (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-28 a2-37 a3-8 t0-3 (the-as sound-group t1-2) t2-1) + (s0-4 (the-as sound-name sv-944) a1-32 a2-32 a3-8 t0-3 (the-as sound-group t1-2) t2-1) ) ) ) (else (let ((s0-5 sound-play-by-name)) (set! sv-960 (make-u128 0 (the-as uint #x6b6c61772d6262))) - (let ((a1-29 (new-sound-id)) - (a2-38 1024) + (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-29 a2-38 a3-9 t0-4 (the-as sound-group t1-3) t2-2) + (s0-5 (the-as sound-name sv-960) a1-33 a2-33 a3-9 t0-4 (the-as sound-group t1-3) t2-2) ) ) ) @@ -1660,53 +1464,26 @@ ) ) ) - (let ((a1-31 (-> s5-0 start-pos))) - (let ((v1-133 s3-0)) - (let ((a0-62 s2-0)) - (let ((a2-41 12288.0)) - (.mov vf7 a2-41) - ) - (.lvf vf5 (&-> a0-62 quad)) - ) - (.lvf vf4 (&-> v1-133 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-31 quad) vf6) - ) + (vector+*! (-> s5-0 start-pos) s3-0 s2-0 12288.0) (vector-float*! (-> s5-0 move-dist) s2-0 -24576.0) - (let ((v1-136 s5-0)) - (set! (-> v1-136 radius) 40.96) - (set! (-> v1-136 collide-with) (collide-spec backgnd)) - (set! (-> v1-136 ignore-process0) #f) - (set! (-> v1-136 ignore-process1) #f) - (set! (-> v1-136 ignore-pat) + (let ((v1-137 s5-0)) + (set! (-> v1-137 radius) 40.96) + (set! (-> v1-137 collide-with) (collide-spec backgnd)) + (set! (-> v1-137 ignore-process0) #f) + (set! (-> v1-137 ignore-process1) #f) + (set! (-> v1-137 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (set! (-> v1-136 action-mask) (collide-action solid)) + (set! (-> v1-137 action-mask) (collide-action solid)) ) (let ((f0-63 (probe-using-line-sphere *collide-cache* s5-0))) (when (>= f0-63 0.0) - (let ((s0-6 (new 'stack-no-clear 'vector))) - (let ((v1-139 (-> s5-0 start-pos))) - (let ((a0-69 (-> s5-0 move-dist))) - (let ((a1-34 f0-63)) - (.mov vf7 a1-34) - ) - (.lvf vf5 (&-> a0-69 quad)) - ) - (.lvf vf4 (&-> v1-139 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 (&-> s0-6 quad) vf6) - (let ((f0-65 (- (-> s3-0 y) (-> s0-6 y)))) + (let ((s0-7 (vector+*! (new 'stack-no-clear 'vector) (-> s5-0 start-pos) (-> s5-0 move-dist) f0-63))) + (let ((f0-65 (- (-> s3-0 y) (-> s0-7 y)))) (lerp-scale 1.0 0.0 f0-65 0.0 8192.0) ) - (- (-> s0-6 y) (-> this root trans y)) - (vector-dot s2-0 (vector-! (new 'stack-no-clear 'vector) s0-6 (-> this root trans))) + (- (-> s0-7 y) (-> this root trans y)) + (vector-dot s2-0 (vector-! (new 'stack-no-clear 'vector) s0-7 (-> this root trans))) ) ) ) @@ -1826,38 +1603,10 @@ (defmethod get-trans ((this bombbot) (arg0 int)) "Get the `trans` for this process." - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (cond - ((= arg0 4) - (let ((v0-0 (new 'static 'vector))) - (let ((v1-2 (-> this root trans))) - (let ((a0-1 *y-vector*)) - (let ((a1-2 12288.0)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-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 (&-> v0-0 quad) vf6) - v0-0 - ) - ) - (else - ((method-of-type nav-enemy get-trans) this arg0) - ) + (if (= arg0 4) + (vector+*! (new 'static 'vector) (-> this root trans) *y-vector* 12288.0) + ((method-of-type nav-enemy get-trans) this arg0) ) - ) ) (defmethod msg-for-incoming-attack ((this bombbot) (arg0 process) (arg1 event-message-block) (arg2 float)) @@ -1977,38 +1726,29 @@ ) (defmethod bombbot-method-196 ((this bombbot) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (the-as process-drawable #f))) - (let ((f30-0 (the-as float #x7f800000)) - (s3-0 (new 'stack-no-clear 'array 'collide-shape 64)) - ) - (countdown (s2-0 (fill-actor-list-for-box *actor-hash* arg0 s3-0 64)) - (let ((a0-3 (as-type (-> s3-0 s2-0) collide-shape))) - (when a0-3 - (let ((s1-1 (as-type (-> a0-3 process) process-focusable))) - (when (and s1-1 - (!= this s1-1) - (not (focus-test? this inactive)) - (not (focus-test? this disable)) - (not (focus-test? this dead)) - (not (logtest? (process-mask guard) (-> s1-1 mask))) - (not (logtest? (process-mask crate) (-> s1-1 mask))) - (logtest? (process-mask guard vehicle) (-> s1-1 mask)) - s1-1 - (not (logtest? (-> (the-as process-focusable s1-1) focus-status) (focus-status disable dead ignore grabbed))) - ) - (let ((f0-0 (vector-vector-xz-distance (-> this root trans) (-> (the-as process-focusable s1-1) root trans)))) - (when (or (not gp-0) (< f0-0 f30-0)) - (set! gp-0 s1-1) - (set! f30-0 f0-0) - ) + (let ((gp-0 (the-as process-drawable #f))) + (let ((f30-0 (the-as float #x7f800000)) + (s3-0 (new 'stack-no-clear 'array 'collide-shape 64)) + ) + (countdown (s2-0 (fill-actor-list-for-box *actor-hash* arg0 s3-0 64)) + (let ((a0-3 (as-type (-> s3-0 s2-0) collide-shape))) + (when a0-3 + (let ((s1-1 (as-type (-> a0-3 process) process-focusable))) + (when (and s1-1 + (!= this s1-1) + (not (focus-test? this inactive)) + (not (focus-test? this disable)) + (not (focus-test? this dead)) + (not (logtest? (process-mask guard) (-> s1-1 mask))) + (not (logtest? (process-mask crate) (-> s1-1 mask))) + (logtest? (process-mask guard vehicle) (-> s1-1 mask)) + s1-1 + (not (logtest? (-> (the-as process-focusable s1-1) focus-status) (focus-status disable dead ignore grabbed))) + ) + (let ((f0-0 (vector-vector-xz-distance (-> this root trans) (-> (the-as process-focusable s1-1) root trans)))) + (when (or (not gp-0) (< f0-0 f30-0)) + (set! gp-0 s1-1) + (set! f30-0 f0-0) ) ) ) @@ -2016,39 +1756,25 @@ ) ) ) - (if (and *target* (< (vector-vector-distance (target-pos 0) arg0) (-> arg0 w))) - (set! gp-0 *target*) - ) - (cond - (gp-0 - (vector-copy! (-> this target-pos) (get-trans (the-as process-focusable gp-0) 3)) - (let ((v1-34 (-> this target-pos))) - (let ((a0-16 (-> gp-0 root trans))) - (let ((a1-8 (-> gp-0 root transv))) - (let ((a2-1 0.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-8 quad)) - ) - (.lvf vf4 (&-> a0-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 (&-> v1-34 quad) vf6) - ) - (vector-copy! (-> this start-target-pos) (-> gp-0 root trans)) - (vector-copy! (-> this start-target-vel) (-> gp-0 root transv)) - (focus-on! (-> this focus) (the-as process-focusable gp-0) this) - ) - (else - (clear-focused (-> this focus)) - ) + ) + (if (and *target* (< (vector-vector-distance (target-pos 0) arg0) (-> arg0 w))) + (set! gp-0 *target*) + ) + (cond + (gp-0 + (vector-copy! (-> this target-pos) (get-trans (the-as process-focusable gp-0) 3)) + (vector+*! (-> this target-pos) (-> gp-0 root trans) (-> gp-0 root transv) 0.0) + (vector-copy! (-> this start-target-pos) (-> gp-0 root trans)) + (vector-copy! (-> this start-target-vel) (-> gp-0 root transv)) + (focus-on! (-> this focus) (the-as process-focusable gp-0) this) + ) + (else + (clear-focused (-> this focus)) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod bombbot-method-208 ((this bombbot) (arg0 vector) (arg1 vector)) @@ -2057,63 +1783,40 @@ ) (defmethod bombbot-method-203 ((this bombbot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) + (let ((s4-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) + (new 'stack-no-clear 'vector) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + ) (new 'stack-no-clear 'vector) - (let ((s2-0 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (new 'stack-no-clear 'vector) - (let ((s5-0 (new 'stack-no-clear 'traj3d-params))) - (matrix->trans s4-0 s3-0) - (let ((a1-2 s3-0)) - (let ((v1-5 s3-0)) - (let ((a0-3 (-> s4-0 fvec))) - (let ((a2-3 8192.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-3 quad)) - ) - (.lvf vf4 (&-> v1-5 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-2 quad) vf6) - ) - (vector-normalize-copy! s2-0 (-> s4-0 fvec) 819200.0) - (vector-copy! (-> s5-0 dest) (bombbot-method-208 this s3-0 (new 'stack-no-clear 'vector))) - (vector-copy! (-> s5-0 src) s3-0) - (set! (-> s5-0 initial-tilt) (+ 3640.889 (-> this angle-gun))) - (set! (-> s5-0 gravity) 184320.0) - (when (traj3d-calc-initial-velocity-using-tilt s5-0) - (new 'stack-no-clear 'vector) - (sound-play "bb-fire-grenade") - (process-spawn bombbot-bomb (-> s5-0 src) (-> s5-0 initial-velocity) :name "bombbot-bomb" :to this) - (let ((s4-4 (new 'stack-no-clear 'vector))) - (vector-copy! s4-4 (-> s5-0 initial-velocity)) - (vector-normalize! s4-4 -2048000.0) - (vector-inv-orient-by-quat! s4-4 s4-4 (-> this root quat)) - (apply-impact! - (-> this rigidbody) - (rigid-body-control-method-25 (-> this rigidbody) (new 'stack-no-clear 'vector)) - s4-4 - ) + (let ((s5-0 (new 'stack-no-clear 'traj3d-params))) + (matrix->trans s4-0 s3-0) + (vector+*! s3-0 s3-0 (-> s4-0 fvec) 8192.0) + (vector-normalize-copy! s2-0 (-> s4-0 fvec) 819200.0) + (vector-copy! (-> s5-0 dest) (bombbot-method-208 this s3-0 (new 'stack-no-clear 'vector))) + (vector-copy! (-> s5-0 src) s3-0) + (set! (-> s5-0 initial-tilt) (+ 3640.889 (-> this angle-gun))) + (set! (-> s5-0 gravity) 184320.0) + (when (traj3d-calc-initial-velocity-using-tilt s5-0) + (new 'stack-no-clear 'vector) + (sound-play "bb-fire-grenade") + (process-spawn bombbot-bomb (-> s5-0 src) (-> s5-0 initial-velocity) :name "bombbot-bomb" :to this) + (let ((s4-4 (new 'stack-no-clear 'vector))) + (vector-copy! s4-4 (-> s5-0 initial-velocity)) + (vector-normalize! s4-4 -2048000.0) + (vector-inv-orient-by-quat! s4-4 s4-4 (-> this root quat)) + (apply-impact! + (-> this rigidbody) + (rigid-body-control-method-25 (-> this rigidbody) (new 'stack-no-clear 'vector)) + s4-4 ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) (deftype bombbot-shot (guard-shot) @@ -2146,43 +1849,20 @@ ) (defmethod projectile-method-25 ((this bombbot-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((v1-1 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (a2-1 (vector-! (new 'stack-no-clear 'vector) v1-1 a1-0)) ) - (init-vf0-vector) - (let* ((v1-1 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (a2-1 (vector-! (new 'stack-no-clear 'vector) v1-1 a1-0)) - ) - (vector-length a2-1) - (let ((a3-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 a2-1)) - (let ((t0-1 0.8)) - (.mov vf7 t0-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> a3-0 quad) vf6) - ) - (let ((f30-0 (-> *part-id-table* 2056 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 2056 init-specs 4 initial-valuef) (* 2.0 (vector-length a2-1))) - (draw-beam (-> *part-id-table* 2056) a1-0 a2-1 #f) - (set! (-> *part-id-table* 2056 init-specs 4 initial-valuef) f30-0) - ) + (vector-length a2-1) + (vector+*! (new 'stack-no-clear 'vector) a1-0 a2-1 0.8) + (let ((f30-0 (-> *part-id-table* 2056 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 2056 init-specs 4 initial-valuef) (* 2.0 (vector-length a2-1))) + (draw-beam (-> *part-id-table* 2056) a1-0 a2-1 #f) + (set! (-> *part-id-table* 2056 init-specs 4 initial-valuef) f30-0) ) - 0 - (none) ) + 0 + (none) ) (defmethod projectile-method-26 ((this bombbot-shot)) @@ -2277,70 +1957,47 @@ ) (defmethod bombbot-method-197 ((this bombbot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (handle->process (-> this focus handle)) - (cond - ((nonzero? (-> this gun-type)) - (when (>= (+ (current-time) (seconds -1)) (-> this next-shoot)) - (set-time! (-> this next-shoot)) - (bombbot-method-203 this) - ) + (handle->process (-> this focus handle)) + (cond + ((nonzero? (-> this gun-type)) + (when (>= (+ (current-time) (seconds -1)) (-> this next-shoot)) + (set-time! (-> this next-shoot)) + (bombbot-method-203 this) ) - (else - (when (>= (+ (current-time) (seconds -0.2)) (-> this next-shoot)) - (set-time! (-> this next-shoot)) - (handle->process (-> this focus handle)) - (let ((s5-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) - (new 'stack-no-clear 'matrix) - (new 'stack-no-clear 'vector) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (new 'stack-no-clear 'vector) - (matrix->trans s5-0 s3-0) - (let ((a1-4 s3-0)) - (let ((v1-32 s3-0)) - (let ((a0-14 (-> s5-0 fvec))) - (let ((a2-3 8192.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-14 quad)) - ) - (.lvf vf4 (&-> v1-32 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-4 quad) vf6) - ) - (vector-normalize-copy! s4-0 (-> s5-0 fvec) 819200.0) - (fire-shot this s3-0 (vector+! (new 'stack-no-clear 'vector) s3-0 s4-0)) - ) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (vector-copy! s5-1 s4-0) - (vector-normalize! s5-1 -2048000.0) - (vector-inv-orient-by-quat! s5-1 s5-1 (-> this root quat)) - (apply-impact! - (-> this rigidbody) - (rigid-body-control-method-25 (-> this rigidbody) (new 'stack-no-clear 'vector)) - s5-1 - ) + ) + (else + (when (>= (+ (current-time) (seconds -0.2)) (-> this next-shoot)) + (set-time! (-> this next-shoot)) + (handle->process (-> this focus handle)) + (let ((s5-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) + (new 'stack-no-clear 'matrix) + (new 'stack-no-clear 'vector) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (matrix->trans s5-0 s3-0) + (vector+*! s3-0 s3-0 (-> s5-0 fvec) 8192.0) + (vector-normalize-copy! s4-0 (-> s5-0 fvec) 819200.0) + (fire-shot this s3-0 (vector+! (new 'stack-no-clear 'vector) s3-0 s4-0)) + ) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (vector-copy! s5-1 s4-0) + (vector-normalize! s5-1 -2048000.0) + (vector-inv-orient-by-quat! s5-1 s5-1 (-> this root quat)) + (apply-impact! + (-> this rigidbody) + (rigid-body-control-method-25 (-> this rigidbody) (new 'stack-no-clear 'vector)) + s5-1 ) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod normalize-heading! ((this bombbot) (arg0 nav-control)) @@ -2435,79 +2092,61 @@ 0 ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (if (>= (+ (current-time) (seconds -13)) (-> self stop-shoot)) - (go-virtual drop-bombs) - ) - (when (< (-> self next-target) (current-time)) - (let ((a1-0 (new 'stack-no-clear 'vector))) - (vector-copy! a1-0 (-> self root trans)) - (set! (-> a1-0 w) 204800.0) - (bombbot-method-196 self a1-0) - ) - (set! (-> self next-target) (+ (current-time) (seconds 5))) - (set! (-> self gun-type) (the-as uint 0)) - 0 + (if (>= (+ (current-time) (seconds -13)) (-> self stop-shoot)) + (go-virtual drop-bombs) ) - (let ((v1-19 (the-as process-focusable (handle->process (-> self focus handle))))) - (when v1-19 - (when (< (current-time) (+ (-> self next-target) (seconds -3.5))) - (set-time! (-> self start-target)) - (vector-copy! (-> self start-target-pos) (-> v1-19 root trans)) - (vector-copy! (-> self start-target-vel) (-> v1-19 root transv)) - (vector-! (-> self target-delta) (-> v1-19 root trans) (-> self root trans)) - ) - (let ((a2-2 (-> self target-pos))) - (let ((a0-21 (-> self start-target-pos))) - (let ((a1-12 (-> self start-target-vel))) - (let ((a3-4 (* 0.0033333334 (the float (- (current-time) (-> self start-target)))))) - (.mov vf7 a3-4) - ) - (.lvf vf5 (&-> a1-12 quad)) - ) - (.lvf vf4 (&-> a0-21 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) - ) - (if (= (-> v1-19 type) target) - (vector-copy! (-> self target-pos) (-> self start-target-pos)) - ) - (if (< (+ (-> self next-target) (seconds -1)) (current-time)) - (bombbot-method-197 self) - (bombbot-method-204 self) - ) - ) + (when (< (-> self next-target) (current-time)) + (let ((a1-0 (new 'stack-no-clear 'vector))) + (vector-copy! a1-0 (-> self root trans)) + (set! (-> a1-0 w) 204800.0) + (bombbot-method-196 self a1-0) ) - (bombbot-method-205 self) - (new 'stack-no-clear 'vector) - (let ((f0-4 (* 0.25 (+ (-> self feet 0 next-position y) - (-> self feet 1 next-position y) - (-> self feet 2 next-position y) - (-> self feet 3 next-position y) - ) - ) - ) - ) - (if (!= (-> self nav state mesh) *default-nav-mesh*) - (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-4 (-> self root trans y)))) - ) - ) - (if (= (vector-length (-> self root transv)) 0.0) - (set-time! (-> self state-time)) - ) - (bombbot-method-202 self) - (bombbot-method-195 self) + (set! (-> self next-target) (+ (current-time) (seconds 5))) + (set! (-> self gun-type) (the-as uint 0)) + 0 ) + (let ((v1-19 (the-as process-focusable (handle->process (-> self focus handle))))) + (when v1-19 + (when (< (current-time) (+ (-> self next-target) (seconds -3.5))) + (set-time! (-> self start-target)) + (vector-copy! (-> self start-target-pos) (-> v1-19 root trans)) + (vector-copy! (-> self start-target-vel) (-> v1-19 root transv)) + (vector-! (-> self target-delta) (-> v1-19 root trans) (-> self root trans)) + ) + (vector+*! + (-> self target-pos) + (-> self start-target-pos) + (-> self start-target-vel) + (* 0.0033333334 (the float (- (current-time) (-> self start-target)))) + ) + (if (= (-> v1-19 type) target) + (vector-copy! (-> self target-pos) (-> self start-target-pos)) + ) + (if (< (+ (-> self next-target) (seconds -1)) (current-time)) + (bombbot-method-197 self) + (bombbot-method-204 self) + ) + ) + ) + (bombbot-method-205 self) + (new 'stack-no-clear 'vector) + (let ((f0-4 (* 0.25 (+ (-> self feet 0 next-position y) + (-> self feet 1 next-position y) + (-> self feet 2 next-position y) + (-> self feet 3 next-position y) + ) + ) + ) + ) + (if (!= (-> self nav state mesh) *default-nav-mesh*) + (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-4 (-> self root trans y)))) + ) + ) + (if (= (vector-length (-> self root transv)) 0.0) + (set-time! (-> self state-time)) + ) + (bombbot-method-202 self) + (bombbot-method-195 self) ) :code (behavior () (until #f @@ -2581,71 +2220,51 @@ (set-time! (-> self stop-shoot)) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (and (nonzero? (-> self drop-num)) (< (-> self next-target) (current-time))) - (let ((v1-5 (rnd-int-excluding-masked self 5 (the-as int (-> self drop-mask))))) - (logior! (-> self drop-mask) (ash 1 v1-5)) - (set! (-> self next-shoot) (+ (current-time) (seconds 0.8))) - (set! (-> self next-target) (+ (current-time) (seconds 1))) - (set! (-> self gun-type) (the-as uint 1)) - (let ((gp-0 (-> self target-pos))) - (let ((s5-0 (-> self root trans))) - (let ((v1-7 (vector-rotate-around-y! - (new 'stack-no-clear 'vector) - *x-vector* - (+ 16384.0 (* 3640.889 (the float (+ v1-5 -2))) (-> self drop-angle)) - ) - ) - ) - (let ((a0-15 61440.0)) - (.mov vf7 a0-15) - ) - (.lvf vf5 (&-> v1-7 quad)) - ) - (.lvf vf4 (&-> s5-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 (&-> gp-0 quad) vf6) + (when (and (nonzero? (-> self drop-num)) (< (-> self next-target) (current-time))) + (let ((v1-5 (rnd-int-excluding-masked self 5 (the-as int (-> self drop-mask))))) + (logior! (-> self drop-mask) (ash 1 v1-5)) + (set! (-> self next-shoot) (+ (current-time) (seconds 0.8))) + (set! (-> self next-target) (+ (current-time) (seconds 1))) + (set! (-> self gun-type) (the-as uint 1)) + (vector+*! + (-> self target-pos) + (-> self root trans) + (vector-rotate-around-y! + (new 'stack-no-clear 'vector) + *x-vector* + (+ 16384.0 (* 3640.889 (the float (+ v1-5 -2))) (-> self drop-angle)) ) + 61440.0 ) - (+! (-> self drop-num) -1) ) - (when (< (-> self next-shoot) (current-time)) - (set! (-> self next-shoot) (+ (current-time) (seconds 10))) - (bombbot-method-203 self) - ) - (if (>= (+ (current-time) (seconds -12)) (-> self start-target)) - (go-virtual hostile) - ) - (bombbot-method-205 self) - (new 'stack-no-clear 'vector) - (let ((f0-5 (* 0.25 (+ (-> self feet 0 next-position y) - (-> self feet 1 next-position y) - (-> self feet 2 next-position y) - (-> self feet 3 next-position y) - ) - ) - ) - ) - (if (!= (-> self nav state mesh) *default-nav-mesh*) - (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-5 (-> self root trans y)))) - ) - ) - (if (= (vector-length (-> self root transv)) 0.0) - (set-time! (-> self state-time)) - ) - (bombbot-method-202 self) - (bombbot-method-195 self) + (+! (-> self drop-num) -1) ) + (when (< (-> self next-shoot) (current-time)) + (set! (-> self next-shoot) (+ (current-time) (seconds 10))) + (bombbot-method-203 self) + ) + (if (>= (+ (current-time) (seconds -12)) (-> self start-target)) + (go-virtual hostile) + ) + (bombbot-method-205 self) + (new 'stack-no-clear 'vector) + (let ((f0-5 (* 0.25 (+ (-> self feet 0 next-position y) + (-> self feet 1 next-position y) + (-> self feet 2 next-position y) + (-> self feet 3 next-position y) + ) + ) + ) + ) + (if (!= (-> self nav state mesh) *default-nav-mesh*) + (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-5 (-> self root trans y)))) + ) + ) + (if (= (vector-length (-> self root transv)) 0.0) + (set-time! (-> self state-time)) + ) + (bombbot-method-202 self) + (bombbot-method-195 self) ) :code (behavior () (until #f @@ -3186,16 +2805,10 @@ (sv-240 vector) ) (rlet ((acc :class vf) - (vf0 :class vf) (vf1 :class vf) (vf2 :class vf) (vf3 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) ) - (init-vf0-vector) (let ((s4-0 (the-as bombbot (-> arg0 param1)))) (let ((s1-0 (new 'stack-no-clear 'vector)) (s3-0 (quaternion-copy! (new 'stack-no-clear 'quaternion) *unity-quaternion*)) @@ -3205,21 +2818,7 @@ ) (dotimes (s0-0 4) (let ((v1-3 (-> s4-0 feet s0-0))) - (let ((a1-2 s2-0)) - (let ((a0-2 s2-0)) - (let ((a2-1 (+ (the-as uint (-> s4-0 feet 0 real-position)) (* 112 s0-0)))) - (let ((a3-3 0.25)) - (.mov vf7 a3-3) - ) - (.lvf vf5 (&-> (the-as (pointer int128) a2-1))) - ) - (.lvf vf4 (&-> a0-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 (&-> a1-2 quad) vf6) - ) + (vector+*! s2-0 s2-0 (the-as vector (+ (the-as uint (-> s4-0 feet 0 real-position)) (* 112 s0-0))) 0.25) (set! (-> v1-3 main-y) (- (-> s4-0 feet s0-0 real-position y) (-> s4-0 root trans y))) (set! (-> v1-3 main-y) (-> v1-3 delta-y)) (+! f30-0 (/ (-> v1-3 main-y) 4)) @@ -3236,14 +2835,14 @@ (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)) + (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-8 quad) vf3) - (let ((a2-5 (t9-4 a0-14 a1-8 f0-8))) + (.svf (&-> a1-9 quad) vf3) + (let ((a2-5 (t9-4 a0-14 a1-9 f0-8))) (sv-176 sv-192 sv-208 a2-5) ) ) @@ -3261,20 +2860,11 @@ (+! (-> s4-0 main-pos-y) (* (-> s4-0 main-spd-y) (seconds-per-frame))) (vector-! s2-0 s2-0 (-> s4-0 root trans)) (vector-inv-orient-by-quat! s2-0 s2-0 (-> s4-0 root quat)) - (let ((a1-13 (-> s4-0 main-pos))) - (let ((v1-19 (-> s4-0 main-pos))) - (let ((a0-20 (vector-! (new 'stack-no-clear 'vector) s2-0 (-> s4-0 main-pos)))) - (let ((a2-10 (* 4.0 (seconds-per-frame)))) - (.mov vf7 a2-10) - ) - (.lvf vf5 (&-> a0-20 quad)) - ) - (.lvf vf4 (&-> v1-19 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-13 quad) vf6) + (vector+*! + (-> s4-0 main-pos) + (-> s4-0 main-pos) + (vector-! (new 'stack-no-clear 'vector) s2-0 (-> s4-0 main-pos)) + (* 4.0 (seconds-per-frame)) ) ) (quaternion-slerp! (-> s4-0 main-quat) (-> s4-0 main-quat) s3-0 0.8) @@ -3738,38 +3328,29 @@ (defmethod bombbot-method-196 ((this bomb-bot) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (the-as process-focusable #f))) - (let ((f30-0 (the-as float #x7f800000)) - (s4-0 (new 'stack-no-clear 'array 'collide-shape 64)) - ) - (countdown (s3-0 (fill-actor-list-for-box *actor-hash* arg0 s4-0 64)) - (let ((a0-3 (as-type (-> s4-0 s3-0) collide-shape))) - (when a0-3 - (let ((s2-1 (as-type (-> a0-3 process) process-focusable))) - (when (and (the-as process-focusable s2-1) - (and (!= this (the-as process-focusable s2-1)) - (not (focus-test? this inactive)) - (not (focus-test? this disable)) - (not (focus-test? this dead)) - (and (as-type (the-as process-focusable s2-1) bombbot) - (the-as process-focusable s2-1) - (not (logtest? (-> (the-as process-focusable s2-1) focus-status) (focus-status disable dead ignore grabbed))) - ) - ) - ) - (let ((f0-0 (vector-vector-xz-distance (-> this root trans) (-> (the-as process-focusable s2-1) root trans)))) - (when (or (not gp-0) (< f0-0 f30-0)) - (set! gp-0 (the-as process-focusable s2-1)) - (set! f30-0 f0-0) - ) + (let ((gp-0 (the-as process-focusable #f))) + (let ((f30-0 (the-as float #x7f800000)) + (s4-0 (new 'stack-no-clear 'array 'collide-shape 64)) + ) + (countdown (s3-0 (fill-actor-list-for-box *actor-hash* arg0 s4-0 64)) + (let ((a0-3 (as-type (-> s4-0 s3-0) collide-shape))) + (when a0-3 + (let ((s2-1 (as-type (-> a0-3 process) process-focusable))) + (when (and (the-as process-focusable s2-1) + (and (!= this (the-as process-focusable s2-1)) + (not (focus-test? this inactive)) + (not (focus-test? this disable)) + (not (focus-test? this dead)) + (and (as-type (the-as process-focusable s2-1) bombbot) + (the-as process-focusable s2-1) + (not (logtest? (-> (the-as process-focusable s2-1) focus-status) (focus-status disable dead ignore grabbed))) + ) + ) + ) + (let ((f0-0 (vector-vector-xz-distance (-> this root trans) (-> (the-as process-focusable s2-1) root trans)))) + (when (or (not gp-0) (< f0-0 f30-0)) + (set! gp-0 (the-as process-focusable s2-1)) + (set! f30-0 f0-0) ) ) ) @@ -3777,36 +3358,22 @@ ) ) ) - (cond - (gp-0 - (vector-copy! (-> this target-pos) (get-trans gp-0 3)) - (let ((v1-25 (-> this target-pos))) - (let ((a0-12 (-> gp-0 root trans))) - (let ((a1-7 (-> gp-0 root transv))) - (let ((a2-1 0.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-7 quad)) - ) - (.lvf vf4 (&-> a0-12 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-25 quad) vf6) - ) - (vector-copy! (-> this start-target-pos) (-> this target-pos)) - (vector-copy! (-> this start-target-vel) (-> gp-0 root transv)) - (focus-on! (-> this focus) gp-0 this) - ) - (else - (clear-focused (-> this focus)) - ) + ) + (cond + (gp-0 + (vector-copy! (-> this target-pos) (get-trans gp-0 3)) + (vector+*! (-> this target-pos) (-> gp-0 root trans) (-> gp-0 root transv) 0.0) + (vector-copy! (-> this start-target-pos) (-> this target-pos)) + (vector-copy! (-> this start-target-vel) (-> gp-0 root transv)) + (focus-on! (-> this focus) gp-0 this) + ) + (else + (clear-focused (-> this focus)) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod go-fallback-init ((this bomb-bot)) @@ -3817,74 +3384,56 @@ (defstate hostile (bomb-bot) :virtual #t :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (< (-> self next-target) (current-time)) - (let ((a1-0 (new 'stack-no-clear 'vector))) - (vector-copy! a1-0 (-> self root trans)) - (set! (-> a1-0 w) 409600.0) - (bombbot-method-196 self a1-0) - ) - (set! (-> self next-target) (+ (current-time) (seconds 4))) - (set! (-> self gun-type) (the-as uint 0)) - 0 + (when (< (-> self next-target) (current-time)) + (let ((a1-0 (new 'stack-no-clear 'vector))) + (vector-copy! a1-0 (-> self root trans)) + (set! (-> a1-0 w) 409600.0) + (bombbot-method-196 self a1-0) ) - (let ((gp-0 (the-as process-focusable (handle->process (-> self focus handle))))) - (when gp-0 - (when (< (current-time) (+ (-> self next-target) (seconds -2))) - (set-time! (-> self start-target)) - (vector-copy! (-> self start-target-pos) (get-trans gp-0 3)) - (vector-copy! (-> self start-target-vel) (-> gp-0 root transv)) - (vector-! (-> self target-delta) (-> gp-0 root trans) (-> self root trans)) - ) - (let ((a1-5 (-> self target-pos))) - (let ((v1-26 (-> self start-target-pos))) - (let ((a0-17 (-> self start-target-vel))) - (let ((a2-4 (* 0.0033333334 (the float (- (current-time) (-> self start-target)))))) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a0-17 quad)) - ) - (.lvf vf4 (&-> v1-26 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-5 quad) vf6) - ) - (vector-copy! (-> self target-pos) (-> self start-target-pos)) - (if (< (+ (-> self next-target) (seconds -1)) (current-time)) - (bombbot-method-197 self) - (bombbot-method-204 self) - ) - ) - ) - (bombbot-method-205 self) - (new 'stack-no-clear 'vector) - (let ((f0-4 (* 0.25 (+ (-> self feet 0 next-position y) - (-> self feet 1 next-position y) - (-> self feet 2 next-position y) - (-> self feet 3 next-position y) - ) - ) - ) - ) - (if (!= (-> self nav state mesh) *default-nav-mesh*) - (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-4 (-> self root trans y)))) - ) - ) - (if (= (vector-length (-> self root transv)) 0.0) - (set-time! (-> self state-time)) - ) - (bombbot-method-202 self) - (bombbot-method-195 self) + (set! (-> self next-target) (+ (current-time) (seconds 4))) + (set! (-> self gun-type) (the-as uint 0)) + 0 ) + (let ((gp-0 (the-as process-focusable (handle->process (-> self focus handle))))) + (when gp-0 + (when (< (current-time) (+ (-> self next-target) (seconds -2))) + (set-time! (-> self start-target)) + (vector-copy! (-> self start-target-pos) (get-trans gp-0 3)) + (vector-copy! (-> self start-target-vel) (-> gp-0 root transv)) + (vector-! (-> self target-delta) (-> gp-0 root trans) (-> self root trans)) + ) + (vector+*! + (-> self target-pos) + (-> self start-target-pos) + (-> self start-target-vel) + (* 0.0033333334 (the float (- (current-time) (-> self start-target)))) + ) + (vector-copy! (-> self target-pos) (-> self start-target-pos)) + (if (< (+ (-> self next-target) (seconds -1)) (current-time)) + (bombbot-method-197 self) + (bombbot-method-204 self) + ) + ) + ) + (bombbot-method-205 self) + (new 'stack-no-clear 'vector) + (let ((f0-4 (* 0.25 (+ (-> self feet 0 next-position y) + (-> self feet 1 next-position y) + (-> self feet 2 next-position y) + (-> self feet 3 next-position y) + ) + ) + ) + ) + (if (!= (-> self nav state mesh) *default-nav-mesh*) + (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-4 (-> self root trans y)))) + ) + ) + (if (= (vector-length (-> self root transv)) 0.0) + (set-time! (-> self state-time)) + ) + (bombbot-method-202 self) + (bombbot-method-195 self) ) :post (behavior () (cond @@ -4047,53 +3596,17 @@ (defmethod get-trans ((this bombbot-player) (arg0 int)) "Get the `trans` for this process." - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (cond - ((= arg0 4) - (let ((gp-0 (new 'static 'vector))) - (let ((v1-2 (-> this root trans))) - (let ((a0-1 *y-vector*)) - (let ((a1-2 12288.0)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-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 (&-> gp-0 quad) vf6) - (let ((s4-0 gp-0)) - (let ((s5-0 gp-0)) - (let ((v1-3 (-> (camera-matrix) rvec))) - (let ((a0-2 0.0)) - (.mov vf7 a0-2) - ) - (.lvf vf5 (&-> v1-3 quad)) - ) - (.lvf vf4 (&-> s5-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 (&-> s4-0 quad) vf6) - ) - gp-0 - ) - ) - (else - ((method-of-type nav-enemy get-trans) this arg0) - ) + (local-vars (gp-1 vector)) + (cond + ((= arg0 4) + (set! gp-1 (vector+*! (new 'static 'vector) (-> this root trans) *y-vector* 12288.0)) + (vector+*! gp-1 gp-1 (-> (camera-matrix) rvec) 0.0) + ) + (else + (set! gp-1 ((method-of-type nav-enemy get-trans) this arg0)) ) ) + gp-1 ) (defmethod bombbot-method-196 ((this bombbot-player) (arg0 vector)) @@ -4107,171 +3620,125 @@ (sv-888 vector) (sv-896 int) ) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (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) - (let ((s5-1 sv-876)) - (let ((v1-8 (camera-pos))) - (let ((a0-2 sv-888)) - (let ((a1-3 40960.0)) - (.mov vf7 a1-3) - ) - (.lvf vf5 (&-> a0-2 quad)) + (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) ) - (.lvf vf4 (&-> v1-8 quad)) + (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) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> s5-1 quad) vf6) - ) - (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) - ) - ) - (set! sv-896 (fill-actor-list-for-sphere *actor-hash* sv-876 sv-872 40960.0 sv-884 64 -1)) - (countdown (s5-3 sv-896) - (let ((a0-19 (as-type (-> sv-884 s5-3) 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) - ) + ) + (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)) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod bombbot-method-197 ((this bombbot-player)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (handle->process (-> this focus handle)) - (let ((s5-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) - (new 'stack-no-clear 'matrix) - (new 'stack-no-clear 'vector) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (new 'stack-no-clear 'vector) - (matrix->trans s5-0 s3-0) - (let ((a1-3 s3-0)) - (let ((v1-12 s3-0)) - (let ((a0-7 (-> s5-0 fvec))) - (let ((a2-3 8192.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-7 quad)) - ) - (.lvf vf4 (&-> v1-12 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-3 quad) vf6) - ) - (vector-normalize-copy! s4-0 (-> s5-0 fvec) 614400.0) - (spawn-bombbot-projectile - this - s3-0 - (vector+! (new 'stack-no-clear 'vector) s3-0 s4-0) - 819200.0 - (the-as vector #f) - 3.0 - ) - (launch-particles (-> *part-id-table* 2055) s3-0) + (handle->process (-> this focus handle)) + (let ((s5-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) + (new 'stack-no-clear 'matrix) + (new 'stack-no-clear 'vector) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (matrix->trans s5-0 s3-0) + (vector+*! s3-0 s3-0 (-> s5-0 fvec) 8192.0) + (vector-normalize-copy! s4-0 (-> s5-0 fvec) 614400.0) + (spawn-bombbot-projectile + this + s3-0 + (vector+! (new 'stack-no-clear 'vector) s3-0 s4-0) + 819200.0 + (the-as vector #f) + 3.0 ) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (vector-copy! s5-1 s4-0) - (vector-normalize! s5-1 -2048000.0) - (vector-inv-orient-by-quat! s5-1 s5-1 (-> this root quat)) - (apply-impact! - (-> this rigidbody) - (rigid-body-control-method-25 (-> this rigidbody) (new 'stack-no-clear 'vector)) - s5-1 - ) + (launch-particles (-> *part-id-table* 2055) s3-0) + ) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (vector-copy! s5-1 s4-0) + (vector-normalize! s5-1 -2048000.0) + (vector-inv-orient-by-quat! s5-1 s5-1 (-> this root quat)) + (apply-impact! + (-> this rigidbody) + (rigid-body-control-method-25 (-> this rigidbody) (new 'stack-no-clear 'vector)) + s5-1 ) ) ) - 0 - (none) ) + 0 + (none) ) (defstate hostile (bombbot-player) @@ -4303,93 +3770,70 @@ (sound-stop (-> self cannon-sound)) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((f0-1 (the float (+ (-> *cpad-list* cpads 0 righty) -128)))) - (when (< 32.0 (fabs f0-1)) - (set! (-> self camera-x-angle) (- (-> self camera-x-angle) (* 0.3 (seconds-per-frame) f0-1))) - (if (< 25.0 (-> self camera-x-angle)) - (set! (-> self camera-x-angle) 25.0) - ) - (if (< (-> self camera-x-angle) -4.0) - (set! (-> self camera-x-angle) -4.0) - ) - ) - ) - (let ((f30-0 (* 182.04445 (-> self camera-x-angle)))) - (set-setting! 'string-min-height 'abs (+ -4096.0 (* 61440.0 (sin f30-0))) 0) - (set-setting! 'string-max-height 'abs (+ 4096.0 (* 61440.0 (sin f30-0))) 0) - (set-setting! 'string-min-length 'abs (+ -4096.0 (* 61440.0 (cos f30-0))) 0) - (set-setting! 'string-max-length 'abs (+ 4096.0 (* 61440.0 (cos f30-0))) 0) - (set-setting! 'slave-options 'set 0.0 (cam-slave-options BOMBBOT)) - (if *camera* - (vector-normalize! (-> *camera* slave 0 view-flat) (+ 4096.0 (* 61440.0 (cos f30-0)))) + (let ((f0-1 (the float (+ (-> *cpad-list* cpads 0 righty) -128)))) + (when (< 32.0 (fabs f0-1)) + (set! (-> self camera-x-angle) (- (-> self camera-x-angle) (* 0.3 (seconds-per-frame) f0-1))) + (if (< 25.0 (-> self camera-x-angle)) + (set! (-> self camera-x-angle) 25.0) + ) + (if (< (-> self camera-x-angle) -4.0) + (set! (-> self camera-x-angle) -4.0) ) ) - (set-setting! 'immediate-string-min-max #f 0.0 0) - (let* ((v1-45 *game-info*) - (a0-13 (+ (-> v1-45 attack-id) 1)) - ) - (set! (-> v1-45 attack-id) a0-13) - (set! (-> self attack-id) a0-13) - ) - (let ((s5-5 (-> self target-pos))) - (let ((gp-5 (camera-pos))) - (let ((v1-46 (-> (camera-matrix) fvec))) - (let ((a0-15 204800.0)) - (.mov vf7 a0-15) - ) - (.lvf vf5 (&-> v1-46 quad)) - ) - (.lvf vf4 (&-> gp-5 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 (&-> s5-5 quad) vf6) - ) - (let ((a1-7 (new 'stack-no-clear 'vector))) - (vector-copy! a1-7 (-> self root trans)) - (set! (-> a1-7 w) 204800.0) - (bombbot-method-196 self a1-7) - ) - (set! (-> self next-target) (+ (current-time) (seconds 2))) - (set-time! (-> self start-target)) - (cond - ((and (-> self hold-fire) (>= (+ (current-time) (seconds -0.3)) (-> self hold-fire-time))) - (+! (-> self extra-angle-gun) (* -8192.0 (seconds-per-frame))) - (if (< (-> self extra-angle-gun) -3640.889) - (set! (-> self extra-angle-gun) -3640.889) - ) - ) - (else - (+! (-> self extra-angle-gun) (* 18204.445 (seconds-per-frame))) - (if (< 0.0 (-> self extra-angle-gun)) - (set! (-> self extra-angle-gun) 0.0) - ) - (bombbot-method-204 self) - ) - ) - (when (handle->process (-> self focus handle)) - ) - (when (and (cpad-pressed? 0 r1) (>= (+ (current-time) (seconds -0.02)) (-> self next-shoot))) - (set-time! (-> self next-shoot)) - (bombbot-method-197 self) - ) - (bombbot-method-205 self) - (if (= (vector-length (-> self root transv)) 0.0) - (set-time! (-> self state-time)) - ) - (bombbot-method-202 self) - (bombbot-method-195 self) - (send-event *camera* 'change-target self) ) + (let ((f30-0 (* 182.04445 (-> self camera-x-angle)))) + (set-setting! 'string-min-height 'abs (+ -4096.0 (* 61440.0 (sin f30-0))) 0) + (set-setting! 'string-max-height 'abs (+ 4096.0 (* 61440.0 (sin f30-0))) 0) + (set-setting! 'string-min-length 'abs (+ -4096.0 (* 61440.0 (cos f30-0))) 0) + (set-setting! 'string-max-length 'abs (+ 4096.0 (* 61440.0 (cos f30-0))) 0) + (set-setting! 'slave-options 'set 0.0 (cam-slave-options BOMBBOT)) + (if *camera* + (vector-normalize! (-> *camera* slave 0 view-flat) (+ 4096.0 (* 61440.0 (cos f30-0)))) + ) + ) + (set-setting! 'immediate-string-min-max #f 0.0 0) + (let* ((v1-45 *game-info*) + (a0-13 (+ (-> v1-45 attack-id) 1)) + ) + (set! (-> v1-45 attack-id) a0-13) + (set! (-> self attack-id) a0-13) + ) + (vector+*! (-> self target-pos) (camera-pos) (-> (camera-matrix) fvec) 204800.0) + (let ((a1-7 (new 'stack-no-clear 'vector))) + (vector-copy! a1-7 (-> self root trans)) + (set! (-> a1-7 w) 204800.0) + (bombbot-method-196 self a1-7) + ) + (set! (-> self next-target) (+ (current-time) (seconds 2))) + (set-time! (-> self start-target)) + (cond + ((and (-> self hold-fire) (>= (+ (current-time) (seconds -0.3)) (-> self hold-fire-time))) + (+! (-> self extra-angle-gun) (* -8192.0 (seconds-per-frame))) + (if (< (-> self extra-angle-gun) -3640.889) + (set! (-> self extra-angle-gun) -3640.889) + ) + ) + (else + (+! (-> self extra-angle-gun) (* 18204.445 (seconds-per-frame))) + (if (< 0.0 (-> self extra-angle-gun)) + (set! (-> self extra-angle-gun) 0.0) + ) + (bombbot-method-204 self) + ) + ) + (when (handle->process (-> self focus handle)) + ) + (when (and (cpad-pressed? 0 r1) (>= (+ (current-time) (seconds -0.02)) (-> self next-shoot))) + (set-time! (-> self next-shoot)) + (bombbot-method-197 self) + ) + (bombbot-method-205 self) + (if (= (vector-length (-> self root transv)) 0.0) + (set-time! (-> self state-time)) + ) + (bombbot-method-202 self) + (bombbot-method-195 self) + (send-event *camera* 'change-target self) ) :code (behavior () (local-vars (v1-1 object)) @@ -4409,70 +3853,47 @@ #f ) :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (new 'stack-no-clear 'vector) - (-> self root) - (cond - ((= (-> self nav state mesh) *default-nav-mesh*) - (enemy-common-post self) - (update-transforms (-> self root)) - ) - (else - (-> *math-camera* inv-camera-rot) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (vector-copy! gp-0 (-> *math-camera* inv-camera-rot fvec)) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (set! (-> gp-0 y) 0.0) - (vector-normalize! gp-0 1.0) - (vector-rotate90-around-y! s4-0 gp-0) - (vector-cross! gp-0 (-> self root gspot-normal) s4-0) + (new 'stack-no-clear 'vector) + (-> self root) + (cond + ((= (-> self nav state mesh) *default-nav-mesh*) + (enemy-common-post self) + (update-transforms (-> self root)) + ) + (else + (-> *math-camera* inv-camera-rot) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-copy! gp-0 (-> *math-camera* inv-camera-rot fvec)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 y) 0.0) + (vector-normalize! gp-0 1.0) + (vector-rotate90-around-y! s4-0 gp-0) + (vector-cross! gp-0 (-> self root gspot-normal) s4-0) + ) + (vector-rotate-around-y! gp-0 gp-0 (-> *cpad-list* cpads 0 stick0-dir)) + (vector+*! s5-0 (-> self root trans) gp-0 (* 12288.0 (-> *cpad-list* cpads 0 stick0-speed))) + (set! (-> self root transv y) 0.0) + (when (< 0.4 (-> *cpad-list* cpads 0 stick0-speed)) + (let ((v1-25 (-> self nav state))) + (logclear! (-> v1-25 flags) (nav-state-flag directional-mode)) + (logior! (-> v1-25 flags) (nav-state-flag target-poly-dirty)) + (vector-copy! (-> v1-25 target-pos) s5-0) ) - (vector-rotate-around-y! gp-0 gp-0 (-> *cpad-list* cpads 0 stick0-dir)) - (let ((v1-17 s5-0)) - (let ((a0-10 (-> self root trans))) - (let ((a1-3 gp-0)) - (let ((a2-4 (* 12288.0 (-> *cpad-list* cpads 0 stick0-speed)))) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> a0-10 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-17 quad) vf6) - ) - (set! (-> self root transv y) 0.0) - (when (< 0.4 (-> *cpad-list* cpads 0 stick0-speed)) - (let ((v1-24 (-> self nav state))) - (logclear! (-> v1-24 flags) (nav-state-flag directional-mode)) - (logior! (-> v1-24 flags) (nav-state-flag target-poly-dirty)) - (vector-copy! (-> v1-24 target-pos) s5-0) - ) - 0 - (when *target* - (quaternion-look-at! (-> *target* control dir-targ) gp-0 *up-vector*) - (quaternion-look-at! (-> *target* control quat) gp-0 *up-vector*) - ) + 0 + (when *target* + (quaternion-look-at! (-> *target* control dir-targ) gp-0 *up-vector*) + (quaternion-look-at! (-> *target* control quat) gp-0 *up-vector*) ) ) ) - (let ((v1-34 (-> self nav))) - (set! (-> v1-34 target-speed) (* 49152.0 (-> *cpad-list* cpads 0 stick0-speed))) - ) - 0 - (nav-enemy-method-187 self) ) + (let ((v1-35 (-> self nav))) + (set! (-> v1-35 target-speed) (* 49152.0 (-> *cpad-list* cpads 0 stick0-speed))) + ) + 0 + (nav-enemy-method-187 self) ) ) ) @@ -4512,69 +3933,43 @@ ) (defbehavior bombbot-player-init-by-other bombbot-player ((arg0 bombbot-spawn-params)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (stack-size-set! (-> self main-thread) 512) - (set! (-> self city-path) (-> arg0 path)) - (set! (-> self current-node) (the-as uint 0)) - (init-enemy-collision! self) - (vector-copy! (-> self root trans) (-> arg0 position)) - (quaternion-copy! (-> self root quat) (-> arg0 quat)) - (vector-identity! (-> self root scale)) - (-> arg0 nav-mesh) - (set! (-> *bombbot-nav-enemy-info* nav-mesh) *default-nav-mesh*) - (init-enemy! self) - (set! (-> self gun-rotation-speed) 7281.778) - (set! (-> self shot-count) (the-as uint 5)) - (vector-copy! (-> self last-trans) (-> self root trans)) - (set! (-> self minimap) #f) - (logior! (-> self mask) (process-mask enemy guard)) - (send-event *camera* 'change-target self) - (let ((a1-3 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-3 from) (process->ppointer self)) - (set! (-> a1-3 num-params) 1) - (set! (-> a1-3 message) 'teleport-to-vector-start-string) - (let ((v1-25 (new 'stack-no-clear 'vector))) - (let ((a0-16 (-> arg0 position))) - (let ((a2-0 *z-vector*)) - (let ((a3-1 40960.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> a0-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 (&-> v1-25 quad) vf6) - (set! (-> a1-3 param 0) (the-as uint v1-25)) - ) - (send-event-function *camera* a1-3) - ) - (set! (-> self shoot-duration) 1.0) - (set! (-> self hold-fire) #f) - (set! (-> self draw light-index) (the-as uint 10)) - (set! (-> self max-hit-points) (the float (+ (* 50 (the int (you-suck-scale *game-info* #f 0))) 50))) - (set! (-> self hit-points) (-> self max-hit-points)) - (set! (-> self health-hud) - (ppointer->handle (process-spawn bombbot-hud :init hud-init-by-other :name "bombbot-hud" :to self)) - ) - (set! (-> self mission-squad) *cty-attack-controller*) - (when (-> self mission-squad) - (set! (-> self attacker-info) (allocate-attacker (-> self mission-squad))) - (init! (-> self attacker-info) self 13) - (set! (-> self attacker-info max-num-attackers) (the-as uint 16)) - (logior! (-> self attacker-info flags) (city-attacker-info-flag cai1 cai4)) - ) - (go-virtual hostile) + (stack-size-set! (-> self main-thread) 512) + (set! (-> self city-path) (-> arg0 path)) + (set! (-> self current-node) (the-as uint 0)) + (init-enemy-collision! self) + (vector-copy! (-> self root trans) (-> arg0 position)) + (quaternion-copy! (-> self root quat) (-> arg0 quat)) + (vector-identity! (-> self root scale)) + (-> arg0 nav-mesh) + (set! (-> *bombbot-nav-enemy-info* nav-mesh) *default-nav-mesh*) + (init-enemy! self) + (set! (-> self gun-rotation-speed) 7281.778) + (set! (-> self shot-count) (the-as uint 5)) + (vector-copy! (-> self last-trans) (-> self root trans)) + (set! (-> self minimap) #f) + (logior! (-> self mask) (process-mask enemy guard)) + (send-event *camera* 'change-target self) + (send-event + *camera* + 'teleport-to-vector-start-string + (vector+*! (new 'stack-no-clear 'vector) (-> arg0 position) *z-vector* 40960.0) ) + (set! (-> self shoot-duration) 1.0) + (set! (-> self hold-fire) #f) + (set! (-> self draw light-index) (the-as uint 10)) + (set! (-> self max-hit-points) (the float (+ (* 50 (the int (you-suck-scale *game-info* #f 0))) 50))) + (set! (-> self hit-points) (-> self max-hit-points)) + (set! (-> self health-hud) + (ppointer->handle (process-spawn bombbot-hud :init hud-init-by-other :name "bombbot-hud" :to self)) + ) + (set! (-> self mission-squad) *cty-attack-controller*) + (when (-> self mission-squad) + (set! (-> self attacker-info) (allocate-attacker (-> self mission-squad))) + (init! (-> self attacker-info) self 13) + (set! (-> self attacker-info max-num-attackers) (the-as uint 16)) + (logior! (-> self attacker-info flags) (city-attacker-info-flag cai1 cai4)) + ) + (go-virtual hostile) ) (deftype task-manager-blow-barricade (task-manager) diff --git a/goal_src/jak3/levels/city/common/guard-states.gc b/goal_src/jak3/levels/city/common/guard-states.gc index 6de00d2cd8..819277516a 100644 --- a/goal_src/jak3/levels/city/common/guard-states.gc +++ b/goal_src/jak3/levels/city/common/guard-states.gc @@ -494,74 +494,51 @@ (defmethod crimson-guard-method-254 ((this crimson-guard)) (local-vars (sv-112 vector) (sv-128 vector) (sv-144 int)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (handle->process (-> this focus handle)) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 (-> this move-position)) - (when (< 8192000.0 (-> this target-self-xz-dist)) - (let ((s3-0 (-> this root trans)) - (s2-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)) - ) - (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)) + (handle->process (-> this focus handle)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 (-> this move-position)) + (when (< 8192000.0 (-> this target-self-xz-dist)) + (let ((s3-0 (-> this root trans)) + (s2-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)) ) - (set! (-> sv-128 w) 1.0) - (let ((a1-2 s1-0)) - (let ((v1-21 s1-0)) - (let ((a0-13 s0-0)) - (let ((a2-1 12288.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-13 quad)) - ) - (.lvf vf4 (&-> v1-21 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-2 quad) vf6) - ) - (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)) - ) - (do-spline s4-0 s3-0 s2-0 s1-0 s0-0 0.9) - (vector-copy! s4-0 s5-0) + (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)) ) - ) - (let ((v1-39 (-> this nav state))) - (logclear! (-> v1-39 flags) (nav-state-flag directional-mode)) - (logior! (-> v1-39 flags) (nav-state-flag target-poly-dirty)) - (vector-copy! (-> v1-39 target-pos) s5-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)) + ) + (do-spline s4-0 s3-0 s2-0 s1-0 s0-0 0.9) + (vector-copy! s4-0 s5-0) ) ) - 0 - (nav-enemy-method-187 this) - (none) + (let ((v1-39 (-> this nav state))) + (logclear! (-> v1-39 flags) (nav-state-flag directional-mode)) + (logior! (-> v1-39 flags) (nav-state-flag target-poly-dirty)) + (vector-copy! (-> v1-39 target-pos) s5-0) + ) ) + 0 + (nav-enemy-method-187 this) + (none) ) (defstate hostile (crimson-guard) @@ -1047,60 +1024,39 @@ ) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (not (-> self already-shot)) - (crimson-guard-method-265 self 1.0) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (vector-copy! gp-0 (-> self root trans)) - (let ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) - (s5-0 (new 'stack 'collide-query)) - ) - (let ((a0-3 gp-0)) - (let ((v1-8 gp-0)) - (let ((a1-4 20480.0)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> s4-0 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-3 quad) vf6) + (when (not (-> self already-shot)) + (crimson-guard-method-265 self 1.0) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-copy! gp-0 (-> self root trans)) + (let ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) + (s5-0 (new 'stack 'collide-query)) + ) + (vector+*! gp-0 gp-0 s4-0 20480.0) + (if (enemy-above-ground? self s5-0 gp-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (set! (-> gp-0 y) (-> s5-0 best-other-tri intersect y)) ) - (if (enemy-above-ground? self s5-0 gp-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) - (set! (-> gp-0 y) (-> s5-0 best-other-tri intersect y)) - ) - ) ) - (when (!= (crimson-guard-method-266 self (-> self event-param-point)) 0.0) - (let* ((v1-16 (-> self nav)) - (a1-7 (-> self event-param-point)) - (f0-3 (-> v1-16 extra-nav-sphere w)) - ) - (vector-copy! (-> v1-16 extra-nav-sphere) a1-7) - (set! (-> v1-16 extra-nav-sphere w) f0-3) - ) - 0 - (let ((v1-19 (-> self nav))) - (set! (-> v1-19 extra-nav-sphere w) (-> self nav-radius-backup)) - ) - 0 - (let ((v1-21 (-> self nav))) - (logior! (-> v1-21 shape nav-flags) (nav-flags has-extra-sphere)) - ) - 0 - (set! (-> self already-shot) #t) - ) - (crimson-guard-method-265 self 0.0) ) + (when (!= (crimson-guard-method-266 self (-> self event-param-point)) 0.0) + (let* ((v1-16 (-> self nav)) + (a1-6 (-> self event-param-point)) + (f0-3 (-> v1-16 extra-nav-sphere w)) + ) + (vector-copy! (-> v1-16 extra-nav-sphere) a1-6) + (set! (-> v1-16 extra-nav-sphere w) f0-3) + ) + 0 + (let ((v1-19 (-> self nav))) + (set! (-> v1-19 extra-nav-sphere w) (-> self nav-radius-backup)) + ) + 0 + (let ((v1-21 (-> self nav))) + (logior! (-> v1-21 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (set! (-> self already-shot) #t) + ) + (crimson-guard-method-265 self 0.0) ) ) :code (behavior () diff --git a/goal_src/jak3/levels/city/common/guard-tazer.gc b/goal_src/jak3/levels/city/common/guard-tazer.gc index 37fc8fc157..f7c9a927ea 100644 --- a/goal_src/jak3/levels/city/common/guard-tazer.gc +++ b/goal_src/jak3/levels/city/common/guard-tazer.gc @@ -9,313 +9,227 @@ (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) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 arg1) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (vector-copy! s4-0 arg2) - (let ((s3-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'quaternion)) - ) - (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) - (while (< sv-640 6) - (let ((v1-6 s0-0)) - (set! (-> v1-6 radius) 2867.2) - (set! (-> v1-6 collide-with) - (collide-spec jak bot civilian enemy vehicle-sphere hit-by-others-list player-list) - ) - (set! (-> v1-6 ignore-process0) #f) - (set! (-> v1-6 ignore-process1) #f) - (set! (-> v1-6 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-6 action-mask) (collide-action solid)) - ) - (vector-copy! (-> s0-0 start-pos) s5-0) - (vector-copy! (-> s0-0 move-dist) s4-0) - (set-from-point-offset-pad! (-> s0-0 bbox) (-> s0-0 start-pos) (-> s0-0 move-dist) (-> s0-0 radius)) - (fill-using-bounding-box *collide-cache* s0-0) - (set! (-> s0-0 radius) 409.6) - (let ((f0-4 (probe-using-line-sphere *collide-cache* s0-0))) - (cond - ((>= f0-4 0.0) - (let ((a1-4 s3-0)) - (let ((v1-13 (-> s0-0 start-pos))) - (let ((a0-12 (-> s0-0 move-dist))) - (let ((a2-2 f0-4)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-12 quad)) - ) - (.lvf vf4 (&-> v1-13 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-4 quad) vf6) - ) - (vector-copy! s5-0 s3-0) - ) - (else - (vector+! (-> s0-0 start-pos) s5-0 s4-0) - (let ((a1-7 (-> s0-0 start-pos))) - (let ((v1-16 (-> s0-0 start-pos))) - (let ((a0-16 s1-0)) - (let ((a2-4 -2048.0)) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a0-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 (&-> a1-7 quad) vf6) - ) - (vector-negate! (-> s0-0 move-dist) s4-0) - (set! f0-4 (probe-using-line-sphere *collide-cache* s0-0)) - (when (>= f0-4 0.0) - (let ((a1-10 s3-0)) - (let ((v1-19 (-> s0-0 start-pos))) - (let ((a0-19 (-> s0-0 move-dist))) - (let ((a2-5 f0-4)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-19 quad)) - ) - (.lvf vf4 (&-> v1-19 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-10 quad) vf6) - ) - (let ((a1-11 s3-0)) - (let ((v1-20 s3-0)) - (let ((a0-20 s1-0)) - (let ((a2-7 2048.0)) - (.mov vf7 a2-7) - ) - (.lvf vf5 (&-> a0-20 quad)) - ) - (.lvf vf4 (&-> v1-20 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-11 quad) vf6) - ) - (vector-copy! s5-0 s3-0) - ) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 arg1) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-copy! s4-0 arg2) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'quaternion)) + ) + (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) + (while (< sv-640 6) + (let ((v1-6 s0-0)) + (set! (-> v1-6 radius) 2867.2) + (set! (-> v1-6 collide-with) + (collide-spec jak bot civilian enemy vehicle-sphere hit-by-others-list player-list) ) - ) - (cond - ((>= f0-4 0.0) - (+! (-> s3-0 x) (rand-vu-float-range -819.2 819.2)) - (+! (-> s3-0 y) (rand-vu-float-range -819.2 819.2)) - (+! (-> 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) - ) - (else - (vector+! s5-0 s5-0 s4-0) - (when (< sv-640 6) - (set-point! arg0 (-> arg0 state points-to-draw) s5-0) - (+! (-> arg0 state points-to-draw) 1) - ) + (set! (-> v1-6 ignore-process0) #f) + (set! (-> v1-6 ignore-process1) #f) + (set! (-> v1-6 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - ) - ) - (set! sv-640 (+ sv-640 1)) + (set! (-> v1-6 action-mask) (collide-action solid)) ) + (vector-copy! (-> s0-0 start-pos) s5-0) + (vector-copy! (-> s0-0 move-dist) s4-0) + (set-from-point-offset-pad! (-> s0-0 bbox) (-> s0-0 start-pos) (-> s0-0 move-dist) (-> s0-0 radius)) + (fill-using-bounding-box *collide-cache* s0-0) + (set! (-> s0-0 radius) 409.6) + (let ((f0-4 (probe-using-line-sphere *collide-cache* s0-0))) + (cond + ((>= f0-4 0.0) + (vector+*! s3-0 (-> s0-0 start-pos) (-> s0-0 move-dist) f0-4) + (vector-copy! s5-0 s3-0) + ) + (else + (vector+! (-> s0-0 start-pos) s5-0 s4-0) + (vector+*! (-> s0-0 start-pos) (-> s0-0 start-pos) s1-0 -2048.0) + (vector-negate! (-> s0-0 move-dist) s4-0) + (set! f0-4 (probe-using-line-sphere *collide-cache* s0-0)) + (when (>= f0-4 0.0) + (vector+*! s3-0 (-> s0-0 start-pos) (-> s0-0 move-dist) f0-4) + (vector+*! s3-0 s3-0 s1-0 2048.0) + (vector-copy! s5-0 s3-0) + ) + ) + ) + (cond + ((>= f0-4 0.0) + (+! (-> s3-0 x) (rand-vu-float-range -819.2 819.2)) + (+! (-> s3-0 y) (rand-vu-float-range -819.2 819.2)) + (+! (-> 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) + ) + (else + (vector+! s5-0 s5-0 s4-0) + (when (< sv-640 6) + (set-point! arg0 (-> arg0 state points-to-draw) s5-0) + (+! (-> arg0 state points-to-draw) 1) + ) + ) + ) + ) + (set! sv-640 (+ sv-640 1)) ) ) ) ) ) - #f ) + #f ) ;; WARN: Return type mismatch object vs none. (defmethod crimson-guard-method-263 ((this crimson-guard)) (local-vars (sv-832 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (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)) + (s1-0 + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> this target-pos-predict-miss) s4-0) 16384.0) + ) + (s5-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'collide-query)) ) - (init-vf0-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)) - (s1-0 - (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> this target-pos-predict-miss) s4-0) 16384.0) + (when (< 1820.4445 (vector-vector-angle-safe s2-0 s1-0)) + (let* ((a1-9 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) s2-0 s1-0) 1.0)) + (a2-1 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-9 1820.4445)) ) - (s5-0 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'collide-query)) - ) - (when (< 1820.4445 (vector-vector-angle-safe s2-0 s1-0)) - (let* ((a1-9 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) s2-0 s1-0) 1.0)) - (a2-1 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-9 1820.4445)) - ) - (vector-orient-by-quat! s1-0 s2-0 a2-1) - ) + (vector-orient-by-quat! s1-0 s2-0 a2-1) ) - (let ((a0-12 s4-0)) - (let ((v1-8 s4-0)) - (let ((a1-12 0.2)) - (.mov vf7 a1-12) + ) + (vector+*! s4-0 s4-0 s2-0 0.2) + (vector+! s5-0 s4-0 s1-0) + (let ((v1-10 s3-0)) + (set! (-> v1-10 radius) 409.6) + (set! (-> v1-10 collide-with) + (collide-spec jak bot civilian enemy vehicle-sphere hit-by-others-list player-list) ) - (.lvf vf5 (&-> s2-0 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-12 quad) vf6) - ) - (vector+! s5-0 s4-0 s1-0) - (let ((v1-10 s3-0)) - (set! (-> v1-10 radius) 409.6) - (set! (-> v1-10 collide-with) - (collide-spec jak bot civilian enemy vehicle-sphere hit-by-others-list player-list) - ) - (set! (-> v1-10 ignore-process0) #f) - (set! (-> v1-10 ignore-process1) #f) - (set! (-> v1-10 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-10 action-mask) (collide-action solid)) - ) - (vector-copy! (-> s3-0 start-pos) s4-0) - (vector-copy! (-> s3-0 move-dist) s1-0) - (set! (-> this l-control state points-to-draw) 0) - (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* s3-0)) - (s2-1 (new 'stack-no-clear 'vector)) + (set! (-> v1-10 ignore-process0) #f) + (set! (-> v1-10 ignore-process1) #f) + (set! (-> v1-10 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (cond - ((>= f0-3 0.0) - (vector-float*! s1-0 (-> s3-0 move-dist) f0-3) - (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)) - ) - (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) + (set! (-> v1-10 action-mask) (collide-action solid)) + ) + (vector-copy! (-> s3-0 start-pos) s4-0) + (vector-copy! (-> s3-0 move-dist) s1-0) + (set! (-> this l-control state points-to-draw) 0) + (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* s3-0)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (cond + ((>= f0-3 0.0) + (vector-float*! s1-0 (-> s3-0 move-dist) f0-3) + (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)) ) - ) - (cond - ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) s4-0) - (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) s4-0) - (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) - ) - ) - (cond - ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) s5-0) - (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) s5-0) - (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) - ) - ) - (set-point! (-> this l-control) 0 s4-0) - (set-point! (-> this l-control) 1 s5-0) - (set! (-> this l-control spec) (-> *lightning-spec-id-table* 19)) - (+! (-> this l-control state points-to-draw) 2) - (let ((v1-91 (as-type (-> s3-0 best-other-tri collide-ptr) collide-shape-prim)) - (s1-7 #t) - ) - (when v1-91 - (set! s1-7 #f) - (let ((s0-1 (new 'stack-no-clear 'projectile-init-by-other-params))) - (set! (-> s0-1 ent) (-> this entity)) - (set! (-> s0-1 charge) 1.0) - (set! (-> s0-1 options) (projectile-options)) - (logclear! (-> s0-1 options) (projectile-options po14 po15 po16)) - (set! (-> s0-1 notify-handle) (process->handle this)) - (set! (-> s0-1 owner-handle) (the-as handle #f)) - (set! (-> s0-1 target-handle) (the-as handle #f)) - (set! (-> s0-1 target-pos quad) (the-as uint128 0)) - (set! (-> s0-1 ignore-handle) (process->handle this)) - (set! (-> s0-1 attack-id) (-> this attack-id)) - (set! (-> s0-1 timeout) (seconds 4)) - (vector-copy! (-> s0-1 pos) s4-0) - (vector-! (-> s0-1 vel) s5-0 s4-0) - (vector-normalize! (-> s0-1 vel) 131072.0) - (spawn-projectile guard-lazer-shot s0-1 this *default-dead-pool*) - ) - ) - ) - (spread-lightning-lazer (-> this l-control) s5-0 s2-1 (-> s3-0 best-other-tri normal)) - ) - (else - (cond - ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) s4-0) - (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) s4-0) - (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) - ) - ) - (cond - ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) s5-0) - (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) s5-0) - (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) - ) - ) - (set! (-> this l-control state points-to-draw) 9) - (set! (-> this l-control spec) (-> *lightning-spec-id-table* 20)) - (let ((v1-176 s4-0)) - (set! (-> this l-control state meet data 0 quad) (-> v1-176 quad)) - ) - (let ((a0-97 (-> this l-control)) - (v1-178 s5-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-copy! (-> a0-97 state meet data (+ (-> a0-97 state points-to-draw) -1)) v1-178) + (vector-orient-by-quat! s2-1 s2-1 a2-4) + ) + ) + (cond + ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) s4-0) + (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) s4-0) + (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) + ) + ) + (cond + ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) s5-0) + (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) s5-0) + (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) + ) + ) + (set-point! (-> this l-control) 0 s4-0) + (set-point! (-> this l-control) 1 s5-0) + (set! (-> this l-control spec) (-> *lightning-spec-id-table* 19)) + (+! (-> this l-control state points-to-draw) 2) + (let ((v1-91 (as-type (-> s3-0 best-other-tri collide-ptr) collide-shape-prim)) + (s1-7 #t) + ) + (when v1-91 + (set! s1-7 #f) + (let ((s0-1 (new 'stack-no-clear 'projectile-init-by-other-params))) + (set! (-> s0-1 ent) (-> this entity)) + (set! (-> s0-1 charge) 1.0) + (set! (-> s0-1 options) (projectile-options)) + (logclear! (-> s0-1 options) (projectile-options po14 po15 po16)) + (set! (-> s0-1 notify-handle) (process->handle this)) + (set! (-> s0-1 owner-handle) (the-as handle #f)) + (set! (-> s0-1 target-handle) (the-as handle #f)) + (set! (-> s0-1 target-pos quad) (the-as uint128 0)) + (set! (-> s0-1 ignore-handle) (process->handle this)) + (set! (-> s0-1 attack-id) (-> this attack-id)) + (set! (-> s0-1 timeout) (seconds 4)) + (vector-copy! (-> s0-1 pos) s4-0) + (vector-! (-> s0-1 vel) s5-0 s4-0) + (vector-normalize! (-> s0-1 vel) 131072.0) + (spawn-projectile guard-lazer-shot s0-1 this *default-dead-pool*) + ) + ) + ) + (spread-lightning-lazer (-> this l-control) s5-0 s2-1 (-> s3-0 best-other-tri normal)) + ) + (else + (cond + ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) s4-0) + (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) s4-0) + (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) ) ) + (cond + ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) s5-0) + (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) s5-0) + (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) + ) + ) + (set! (-> this l-control state points-to-draw) 9) + (set! (-> this l-control spec) (-> *lightning-spec-id-table* 20)) + (let ((v1-176 s4-0)) + (set! (-> this l-control state meet data 0 quad) (-> v1-176 quad)) + ) + (let ((a0-98 (-> this l-control)) + (v1-178 s5-0) + ) + (vector-copy! (-> a0-98 state meet data (+ (-> a0-98 state points-to-draw) -1)) v1-178) + ) ) ) ) - (none) ) + (none) ) (defstate attack (crimson-guard) diff --git a/goal_src/jak3/levels/city/ctywide-obs.gc b/goal_src/jak3/levels/city/ctywide-obs.gc index 24142d9cc9..548c8453ad 100644 --- a/goal_src/jak3/levels/city/ctywide-obs.gc +++ b/goal_src/jak3/levels/city/ctywide-obs.gc @@ -233,145 +233,106 @@ (defstate idle-close (security-wall) :virtual #t :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (case message - (('on) - (let ((v1-2 (-> self root root-prim))) - (set! (-> v1-2 prim-core collide-as) (-> self root backup-collide-as)) - (let ((v0-0 (the-as object (-> self root backup-collide-with)))) - (set! (-> v1-2 prim-core collide-with) (the-as collide-spec v0-0)) - v0-0 - ) + (case message + (('on) + (let ((v1-2 (-> self root root-prim))) + (set! (-> v1-2 prim-core collide-as) (-> self root backup-collide-as)) + (let ((v0-0 (the-as object (-> self root backup-collide-with)))) + (set! (-> v1-2 prim-core collide-with) (the-as collide-spec v0-0)) + v0-0 ) ) - (('off) - (let ((v1-4 (-> self root root-prim))) - (set! (-> v1-4 prim-core collide-as) (collide-spec)) - (set! (-> v1-4 prim-core collide-with) (collide-spec)) - ) - 0 + ) + (('off) + (let ((v1-4 (-> self root root-prim))) + (set! (-> v1-4 prim-core collide-as) (collide-spec)) + (set! (-> v1-4 prim-core collide-with) (collide-spec)) ) - (('attack) - (let ((v1-5 (the-as attack-info (-> block param 1)))) - (when (!= (-> v1-5 id) (-> self incoming-attack-id)) - (set! (-> self incoming-attack-id) (-> v1-5 id)) - (let ((s3-0 (as-type proc process-drawable))) - (when s3-0 - (let ((s5-1 (process-spawn - manipy - :init manipy-init - (-> (the-as process-drawable s3-0) root trans) - (-> self entity) - (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer level) #f)) - #f - 0 - :name "manipy" - :to self - :stack-size #x20000 - ) + 0 + ) + (('attack) + (let ((v1-5 (the-as attack-info (-> block param 1)))) + (when (!= (-> v1-5 id) (-> self incoming-attack-id)) + (set! (-> self incoming-attack-id) (-> v1-5 id)) + (let ((s3-0 (as-type proc process-drawable))) + (when s3-0 + (let ((s5-1 (process-spawn + manipy + :init manipy-init + (-> (the-as process-drawable s3-0) root trans) + (-> self entity) + (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 ) - ) - (when s5-1 - (send-event (ppointer->process s5-1) 'anim-mode 'play1) - (send-event (ppointer->process s5-1) 'speed 1.5) - (send-event (ppointer->process s5-1) 'art-joint-anim "generic-ripples-idle" 0) - (set-vector! (-> (the-as process-drawable (-> s5-1 0)) root scale) 1.0 1.0 1.0 1.0) - (quaternion-rotate-local-x! (-> (the-as process-drawable (-> s5-1 0)) root quat) (-> self root quat) -16384.0) - (let ((v1-43 (-> (the-as process-drawable (-> s5-1 0)) root trans))) - (let ((a0-29 (-> (the-as process-drawable (-> s5-1 0)) root trans))) - (let ((a1-11 *up-vector*)) - (let ((a2-7 8192.0)) - (.mov vf7 a2-7) - ) - (.lvf vf5 (&-> a1-11 quad)) ) - (.lvf vf4 (&-> a0-29 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-43 quad) vf6) - ) - (let ((f0-6 (vector4-dot (-> (the-as process-drawable (-> s5-1 0)) root trans) (the-as vector (-> self plane))))) - (let ((v1-50 (-> (the-as process-drawable (-> s5-1 0)) root trans))) - (let ((a0-33 (-> (the-as process-drawable (-> s5-1 0)) root trans))) - (let ((a1-12 (-> self plane))) - (let ((a2-8 (- f0-6))) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a1-12 quad)) - ) - (.lvf vf4 (&-> a0-33 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-50 quad) vf6) - ) - (let ((v1-53 (-> (the-as process-drawable (-> s5-1 0)) root trans))) - (let ((a0-36 (-> (the-as process-drawable (-> s5-1 0)) root trans))) - (let ((a1-13 (-> self plane))) - (let ((a2-10 (the-as float (if (< 0.0 f0-6) - -2048.0 - 2048.0 - ) - ) - ) - ) - (.mov vf7 a2-10) - ) - (.lvf vf5 (&-> a1-13 quad)) - ) - (.lvf vf4 (&-> a0-36 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-53 quad) vf6) - ) - ) - (send-event (ppointer->process s5-1) 'trans-hook (lambda () #f)) ) + (when s5-1 + (send-event (ppointer->process s5-1) 'anim-mode 'play1) + (send-event (ppointer->process s5-1) 'speed 1.5) + (send-event (ppointer->process s5-1) 'art-joint-anim "generic-ripples-idle" 0) + (set-vector! (-> (the-as process-drawable (-> s5-1 0)) root scale) 1.0 1.0 1.0 1.0) + (quaternion-rotate-local-x! (-> (the-as process-drawable (-> s5-1 0)) root quat) (-> self root quat) -16384.0) + (vector+*! + (-> (the-as process-drawable (-> s5-1 0)) root trans) + (-> (the-as process-drawable (-> s5-1 0)) root trans) + *up-vector* + 8192.0 + ) + (let ((f0-6 (vector4-dot (-> (the-as process-drawable (-> s5-1 0)) root trans) (the-as vector (-> self plane))))) + (vector+*! + (-> (the-as process-drawable (-> s5-1 0)) root trans) + (-> (the-as process-drawable (-> s5-1 0)) root trans) + (the-as vector (-> self plane)) + (- f0-6) + ) + (vector+*! + (-> (the-as process-drawable (-> s5-1 0)) root trans) + (-> (the-as process-drawable (-> s5-1 0)) root trans) + (the-as vector (-> self plane)) + (if (< 0.0 f0-6) + -2048.0 + 2048.0 + ) + ) + ) + (send-event (ppointer->process s5-1) 'trans-hook (lambda () #f)) ) ) ) - (when (zero? (-> self touch-count)) - (+! (-> self touch-count) 1) - (set! (-> self flash) 0.375) - ) + ) + (when (zero? (-> self touch-count)) (+! (-> self touch-count) 1) - (if (and (logtest? (-> proc mask) (process-mask target)) - (not (logtest? (process-mask projectile) (-> proc mask))) - ) + (set! (-> self flash) 0.375) + ) + (+! (-> self touch-count) 1) + (if (and (logtest? (-> proc mask) (process-mask target)) + (not (logtest? (process-mask projectile) (-> proc mask))) + ) + (play-speech self) + ) + ) + ) + ) + (('touched) + (when (zero? (-> self touch-count)) + (+! (-> self touch-count) 1) + (set! (-> self flash) 0.375) + ) + (+! (-> self touch-count) 1) + (let ((v1-84 (as-type proc process-focusable))) + (when v1-84 + (let ((a0-45 (as-type (-> (the-as process-drawable v1-84) root) collide-shape))) + (if (and a0-45 (logtest? (-> (the-as collide-shape a0-45) root-prim prim-core collide-as) (collide-spec jak))) (play-speech self) ) ) ) ) - (('touched) - (when (zero? (-> self touch-count)) - (+! (-> self touch-count) 1) - (set! (-> self flash) 0.375) - ) - (+! (-> self touch-count) 1) - (let ((v1-81 (as-type proc process-focusable))) - (when v1-81 - (let ((a0-45 (as-type (-> (the-as process-drawable v1-81) root) collide-shape))) - (if (and a0-45 (logtest? (-> (the-as collide-shape a0-45) root-prim prim-core collide-as) (collide-spec jak))) - (play-speech self) - ) - ) - ) - ) - ) - ) + ) ) ) :trans (behavior () @@ -1069,96 +1030,59 @@ (defstate idle (propa) :virtual #t :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (case message - (('attack) - (get-penetrate-using-from-attack-event (the-as process-drawable proc) block) - (let ((v1-2 (the-as object (-> block param 1)))) - (when (!= (-> (the-as attack-info v1-2) id) (-> self incoming-attack-id)) - (set! (-> self incoming-attack-id) (-> (the-as attack-info v1-2) id)) - (let ((s5-1 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block))) - (if (and (not (logtest? (penetrate dark-skin) s5-1)) (zero? (propa-pu->knocked-type s5-1))) - (set! (-> self hit-points) (- (-> self hit-points) (the int (penetrate-using->damage s5-1)))) - (+! (-> self hit-points) -10) - ) - ) - (cond - ((< (-> self hit-points) 3) - (setup-masks (-> self draw) 0 -1) - (setup-masks (-> self draw) 1 0) - (let* ((a0-9 (the-as collide-shape-prim-group (-> self root root-prim))) - (v1-18 (-> a0-9 child 0)) - ) - (let ((a0-11 (-> a0-9 child 1))) - (set! (-> a0-11 prim-core collide-as) (-> v1-18 prim-core collide-as)) - (set! (-> a0-11 prim-core collide-with) (-> v1-18 prim-core collide-with)) - ) - (set! (-> v1-18 prim-core collide-as) (collide-spec)) - (set! (-> v1-18 prim-core collide-with) (collide-spec)) - ) - 0 - (cond - ((logtest? (-> *part-group-id-table* 224 flags) (sp-group-flag sp13)) - (let ((v1-25 (-> *launch-matrix* trans)) - (a0-12 (new 'stack-no-clear 'vector)) - ) - (let ((a1-9 (-> self root trans))) - (let ((a2-3 *up-vector*)) - (let ((a3-2 8192.0)) - (.mov vf7 a3-2) - ) - (.lvf vf5 (&-> a2-3 quad)) - ) - (.lvf vf4 (&-> a1-9 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-12 quad) vf6) - (vector-copy! v1-25 a0-12) + (case message + (('attack) + (get-penetrate-using-from-attack-event (the-as process-drawable proc) block) + (let ((v1-2 (the-as object (-> block param 1)))) + (when (!= (-> (the-as attack-info v1-2) id) (-> self incoming-attack-id)) + (set! (-> self incoming-attack-id) (-> (the-as attack-info v1-2) id)) + (let ((s5-1 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block))) + (if (and (not (logtest? (penetrate dark-skin) s5-1)) (zero? (propa-pu->knocked-type s5-1))) + (set! (-> self hit-points) (- (-> self hit-points) (the int (penetrate-using->damage s5-1)))) + (+! (-> self hit-points) -10) + ) + ) + (cond + ((< (-> self hit-points) 3) + (setup-masks (-> self draw) 0 -1) + (setup-masks (-> self draw) 1 0) + (let* ((a0-9 (the-as collide-shape-prim-group (-> self root root-prim))) + (v1-18 (-> a0-9 child 0)) ) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 224)) - ) - (else - (let ((v1-40 (-> *launch-matrix* trans)) - (a0-17 (new 'stack-no-clear 'vector)) - ) - (let ((a1-14 (-> self root trans))) - (let ((a2-9 *up-vector*)) - (let ((a3-6 8192.0)) - (.mov vf7 a3-6) - ) - (.lvf vf5 (&-> a2-9 quad)) - ) - (.lvf vf4 (&-> a1-14 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-17 quad) vf6) - (vector-copy! v1-40 a0-17) - ) - (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 224)) - ) + (let ((a0-11 (-> a0-9 child 1))) + (set! (-> a0-11 prim-core collide-as) (-> v1-18 prim-core collide-as)) + (set! (-> a0-11 prim-core collide-with) (-> v1-18 prim-core collide-with)) ) - (go-virtual broken) + (set! (-> v1-18 prim-core collide-as) (collide-spec)) + (set! (-> v1-18 prim-core collide-with) (collide-spec)) ) - ((< (-> self hit-points) 6) - (setup-masks (-> self draw) 0 -1) - (setup-masks (-> self draw) 2 0) + 0 + (cond + ((logtest? (-> *part-group-id-table* 224 flags) (sp-group-flag sp13)) + (vector-copy! + (-> *launch-matrix* trans) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 8192.0) + ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 224)) + ) + (else + (vector-copy! + (-> *launch-matrix* trans) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 8192.0) + ) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 224)) + ) ) - ) + (go-virtual broken) + ) + ((< (-> self hit-points) 6) + (setup-masks (-> self draw) 0 -1) + (setup-masks (-> self draw) 2 0) + ) ) ) ) - ) + ) ) ) :exit (behavior () @@ -1537,36 +1461,14 @@ ) :code sleep-code :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let* ((a0-0 (-> *target* neck)) - (t9-0 (method-of-object a0-0 look-at!)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-4 (-> self root trans))) - (let ((a2-0 *up-vector*)) - (let ((a3-1 20480.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> v1-4 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-0 quad) vf6) - (t9-0 a0-0 a1-0 #f self) + (if *target* + (look-at! + (-> *target* neck) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 20480.0) + #f + self ) ) - ) ) ) @@ -1596,79 +1498,59 @@ (sv-320 float) (sv-336 float) ) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (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)) - (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))) + (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-copy! (-> *camera* slave 0 trans) gp-0) - (let ((t9-4 forward-down->inv-matrix) - (a0-6 (-> *camera* slave 0 tracking)) - (a1-3 (new 'stack-no-clear 'vector)) - (v1-18 (new 'stack-no-clear 'vector)) - ) - (let ((a2-4 (-> self root trans))) - (let ((a3-1 *up-vector*)) - (let ((t0-2 20480.0)) - (.mov vf7 t0-2) - ) - (.lvf vf5 (&-> a3-1 quad)) - ) - (.lvf vf4 (&-> a2-4 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-18 quad) vf6) - (t9-4 (-> a0-6 inv-mat) (vector-! a1-3 v1-18 gp-0) (-> *camera* local-down)) + (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))) ) ) - ) - (let ((gp-1 (matrix-copy! (new 'stack-no-clear 'matrix) (-> self node-list data 3 bone transform)))) - (if (< (vector-dot - (-> gp-1 fvec) - (vector-! (new 'stack-no-clear 'vector) (camera-pos) (matrix->trans gp-1 (new 'stack-no-clear 'vector))) - ) - 0.0 - ) - (matrix*! gp-1 (matrix-rotate-y! (new 'stack-no-clear 'matrix) 32768.0) gp-1) + (vector-copy! (-> *camera* slave 0 trans) gp-0) + (forward-down->inv-matrix + (-> *camera* slave 0 tracking inv-mat) + (vector-! + (new 'stack-no-clear 'vector) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 20480.0) + gp-0 ) - (+! (-> self angle) (* 100.0 (rand-vu))) - (set! (-> *part-id-table* 1180 init-specs 4 initial-valuef) - (+ 14336.0 (* 1228.8 (cos (* 182.04445 (-> self angle))))) - ) - (set! (-> *part-id-table* 1181 init-specs 4 initial-valuef) - (+ 2048.0 (-> *part-id-table* 1180 init-specs 4 initial-valuef)) - ) - (spawn-from-mat (-> self part) gp-1) + (-> *camera* local-down) + ) ) ) + (let ((gp-1 (matrix-copy! (new 'stack-no-clear 'matrix) (-> self node-list data 3 bone transform)))) + (if (< (vector-dot + (-> gp-1 fvec) + (vector-! (new 'stack-no-clear 'vector) (camera-pos) (matrix->trans gp-1 (new 'stack-no-clear 'vector))) + ) + 0.0 + ) + (matrix*! gp-1 (matrix-rotate-y! (new 'stack-no-clear 'matrix) 32768.0) gp-1) + ) + (+! (-> self angle) (* 100.0 (rand-vu))) + (set! (-> *part-id-table* 1180 init-specs 4 initial-valuef) + (+ 14336.0 (* 1228.8 (cos (* 182.04445 (-> self angle))))) + ) + (set! (-> *part-id-table* 1181 init-specs 4 initial-valuef) + (+ 2048.0 (-> *part-id-table* 1180 init-specs 4 initial-valuef)) + ) + (spawn-from-mat (-> self part) gp-1) + ) ) :code (behavior () (set-setting! 'mode-name 'cam-really-fixed 0.0 0) @@ -1718,36 +1600,14 @@ (go-virtual idle) ) :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let* ((a0-0 (-> *target* neck)) - (t9-0 (method-of-object a0-0 look-at!)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-4 (-> self root trans))) - (let ((a2-0 *up-vector*)) - (let ((a3-1 20480.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> v1-4 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-0 quad) vf6) - (t9-0 a0-0 a1-0 #f self) + (if *target* + (look-at! + (-> *target* neck) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 20480.0) + #f + self ) ) - ) ) ) @@ -1765,119 +1625,99 @@ (remove-setting! 'mode-name) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (time-elapsed? (-> self state-time) (seconds 1.5)) - (let ((gp-0 0) - (s5-0 0) + (when (time-elapsed? (-> self state-time) (seconds 1.5)) + (let ((gp-0 0) + (s5-0 0) + ) + (when (cpad-pressed? 0 down l-analog-down) + (+! s5-0 1) + (if (< (+ gp-0 -1) s5-0) + (set! s5-0 (+ gp-0 -1)) + (sound-play "menu-up-down") ) - (when (cpad-pressed? 0 down l-analog-down) - (+! s5-0 1) - (if (< (+ gp-0 -1) s5-0) - (set! s5-0 (+ gp-0 -1)) - (sound-play "menu-up-down") - ) - ) - (when (cpad-pressed? 0 up l-analog-up) - (+! s5-0 -1) - (if (< s5-0 0) - (set! s5-0 0) - (sound-play "menu-up-down") - ) - ) - (let* ((s4-2 40) - (s3-2 36) - (s2-0 (- 228 (* gp-0 (/ s4-2 2)))) - (v1-19 (new - 'stack - 'font-context - *font-default-matrix* - s3-2 - s2-0 - 0.0 - (font-color default) - (font-flags shadow kerning) - ) + ) + (when (cpad-pressed? 0 up l-analog-up) + (+! s5-0 -1) + (if (< s5-0 0) + (set! s5-0 0) + (sound-play "menu-up-down") + ) + ) + (let* ((s4-2 40) + (s3-2 36) + (s2-0 (- 228 (* gp-0 (/ s4-2 2)))) + (v1-19 (new + 'stack + 'font-context + *font-default-matrix* + s3-2 + s2-0 + 0.0 + (font-color default) + (font-flags shadow kerning) ) - ) - (set! (-> v1-19 flags) (font-flags shadow kerning middle middle-vert large)) - (set-width! v1-19 440) - (set-height! v1-19 50) - (set-scale! v1-19 1.0) - (set-origin! v1-19 s3-2 40) - (let ((a1-7 v1-19)) - (set! (-> a1-7 color) (font-color progress-old-yellow)) - ) - (set-height! v1-19 s4-2) - (dotimes (a0-23 gp-0) - (set-origin! v1-19 s3-2 s2-0) - (set-scale! v1-19 (if (= a0-23 s5-0) - 0.8 - 0.6 - ) - ) - (let ((a2-6 v1-19)) - (set! (-> a2-6 color) (if (= a0-23 s5-0) - (font-color progress-old-selected) - (font-color default) - ) ) - ) - (+! s2-0 s4-2) - ) - ) - ) - ) - (when (!= (-> self time) -1.0) - (let ((gp-1 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (vector+! gp-1 (-> self root trans) (vector-orient-by-quat! - (new 'stack-no-clear 'vector) - (new 'static 'vector :y 24166.4 :z 32768.0 :w 1.0) - (-> self root quat) - ) - ) - (vector-copy! (-> *camera* slave 0 trans) gp-1) - (let ((t9-6 forward-down->inv-matrix) - (a0-27 (-> *camera* slave 0 tracking)) - (a1-13 (new 'stack-no-clear 'vector)) - (v1-35 (new 'stack-no-clear 'vector)) - ) - (let ((a2-9 (-> self root trans))) - (let ((a3-4 *up-vector*)) - (let ((t0-4 24166.4)) - (.mov vf7 t0-4) - ) - (.lvf vf5 (&-> a3-4 quad)) - ) - (.lvf vf4 (&-> a2-9 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-35 quad) vf6) - (t9-6 (-> a0-27 inv-mat) (vector-! a1-13 v1-35 gp-1) (-> *camera* local-down)) - ) - ) - ) - (let ((gp-2 (matrix-copy! (new 'stack-no-clear 'matrix) (-> self node-list data 3 bone transform)))) - (if (< (vector-dot - (-> gp-2 fvec) - (vector-! (new 'stack-no-clear 'vector) (camera-pos) (matrix->trans gp-2 (new 'stack-no-clear 'vector))) - ) - 0.0 ) - (matrix*! gp-2 (matrix-rotate-y! (new 'stack-no-clear 'matrix) 32768.0) gp-2) + (set! (-> v1-19 flags) (font-flags shadow kerning middle middle-vert large)) + (set-width! v1-19 440) + (set-height! v1-19 50) + (set-scale! v1-19 1.0) + (set-origin! v1-19 s3-2 40) + (let ((a1-7 v1-19)) + (set! (-> a1-7 color) (font-color progress-old-yellow)) ) - (spawn-from-mat (-> self part-off) gp-2) + (set-height! v1-19 s4-2) + (dotimes (a0-23 gp-0) + (set-origin! v1-19 s3-2 s2-0) + (set-scale! v1-19 (if (= a0-23 s5-0) + 0.8 + 0.6 + ) + ) + (let ((a2-6 v1-19)) + (set! (-> a2-6 color) (if (= a0-23 s5-0) + (font-color progress-old-selected) + (font-color default) + ) + ) + ) + (+! s2-0 s4-2) + ) + ) ) ) + (when (!= (-> self time) -1.0) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (vector+! gp-1 (-> self root trans) (vector-orient-by-quat! + (new 'stack-no-clear 'vector) + (new 'static 'vector :y 24166.4 :z 32768.0 :w 1.0) + (-> self root quat) + ) + ) + (vector-copy! (-> *camera* slave 0 trans) gp-1) + (forward-down->inv-matrix + (-> *camera* slave 0 tracking inv-mat) + (vector-! + (new 'stack-no-clear 'vector) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 24166.4) + gp-1 + ) + (-> *camera* local-down) + ) + ) + ) + (let ((gp-2 (matrix-copy! (new 'stack-no-clear 'matrix) (-> self node-list data 3 bone transform)))) + (if (< (vector-dot + (-> gp-2 fvec) + (vector-! (new 'stack-no-clear 'vector) (camera-pos) (matrix->trans gp-2 (new 'stack-no-clear 'vector))) + ) + 0.0 + ) + (matrix*! gp-2 (matrix-rotate-y! (new 'stack-no-clear 'matrix) 32768.0) gp-2) + ) + (spawn-from-mat (-> self part-off) gp-2) + ) ) :code (behavior () (set-setting! 'mode-name 'cam-really-fixed 0.0 0) @@ -1931,36 +1771,14 @@ (go-virtual idle) ) :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let* ((a0-0 (-> *target* neck)) - (t9-0 (method-of-object a0-0 look-at!)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-4 (-> self root trans))) - (let ((a2-0 *up-vector*)) - (let ((a3-1 20480.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> v1-4 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-0 quad) vf6) - (t9-0 a0-0 a1-0 #f self) + (if *target* + (look-at! + (-> *target* neck) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 20480.0) + #f + self ) ) - ) ) ) 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 f3eae999a3..4bbeb04141 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 @@ -835,33 +835,10 @@ (defstate waiting-idle (jinx) :virtual #t :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (-> self destination))) - (let ((v1-0 (target-pos 0))) - (let ((a0-1 (-> self follow-dir))) - (let ((a1-0 (-> self follow-offset))) - (.mov vf7 a1-0) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-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 (&-> gp-0 quad) vf6) + (vector+*! (-> self destination) (target-pos 0) (-> self follow-dir) (-> self follow-offset)) + (if (< 12288.0 (vector-vector-distance (-> self destination) (-> self root trans))) + (go-virtual traveling) ) - (if (< 12288.0 (vector-vector-distance (-> self destination) (-> self root trans))) - (go-virtual traveling) - ) - ) ) :code (behavior () (let ((v1-2 (ja-group))) @@ -919,37 +896,14 @@ (nav-enemy-method-177 self) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (-> self destination))) - (let ((v1-0 (target-pos 0))) - (let ((a0-1 (-> self follow-dir))) - (let ((a1-0 (-> self follow-offset))) - (.mov vf7 a1-0) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-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 (&-> gp-0 quad) vf6) - ) - (cond - ((< (vector-vector-distance (-> self destination) (-> self root trans)) 8192.0) - (go-virtual waiting-idle) - ) - ((and (time-elapsed? (-> self state-time) (seconds 0.5)) (player-blocking-travel? self)) - (go-virtual traveling-blocked) - ) - ) + (vector+*! (-> self destination) (target-pos 0) (-> self follow-dir) (-> self follow-offset)) + (cond + ((< (vector-vector-distance (-> self destination) (-> self root trans)) 8192.0) + (go-virtual waiting-idle) + ) + ((and (time-elapsed? (-> self state-time) (seconds 0.5)) (player-blocking-travel? self)) + (go-virtual traveling-blocked) + ) ) ) :code (behavior () @@ -1665,222 +1619,194 @@ ) (defmethod task-manager-method-26 ((this task-manager-city-destroy-grid)) - (local-vars (v1-180 float) (v1-201 float)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (update-jinx-speech this) - (when (nonzero? (-> this jinx)) - (let ((s5-0 (the-as jinx (handle->process (-> this jinx))))) - (when s5-0 - (when (nonzero? (-> this actor-group)) - (dotimes (s4-0 (length (-> this actor-group 0))) - (let ((s3-0 (-> this actor-group 0 data s4-0))) - (when (= (-> this next-box) s4-0) - (vector-copy! (-> this goal-pos) (-> s3-0 actor trans)) - (let ((s2-0 (-> this goal-pos-front))) - (let ((s1-0 (-> s3-0 actor trans))) - (let ((v1-17 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-0 actor quat)))) - (let ((a0-12 8192.0)) - (.mov vf7 a0-12) - ) - (.lvf vf5 (&-> v1-17 quad)) - ) - (.lvf vf4 (&-> s1-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 (&-> s2-0 quad) vf6) - ) - (when (< (vector-vector-distance (-> s3-0 actor trans) (-> s5-0 root trans)) 40960.0) - ) + (update-jinx-speech this) + (when (nonzero? (-> this jinx)) + (let ((s5-0 (the-as jinx (handle->process (-> this jinx))))) + (when s5-0 + (when (nonzero? (-> this actor-group)) + (dotimes (s4-0 (length (-> this actor-group 0))) + (let ((s3-0 (-> this actor-group 0 data s4-0))) + (when (= (-> this next-box) s4-0) + (vector-copy! (-> this goal-pos) (-> s3-0 actor trans)) + (vector+*! + (-> this goal-pos-front) + (-> s3-0 actor trans) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-0 actor quat)) + 8192.0 + ) + (when (< (vector-vector-distance (-> s3-0 actor trans) (-> s5-0 root trans)) 40960.0) ) ) ) ) + ) + (cond + ((as-type (entity-nav-mesh-by-aid (-> s5-0 nav-mesh-aid)) entity-nav-mesh) + ) + (else + ) + ) + (when (= (+ (length (-> this actor-group 0)) 1) (-> this next-box)) + (+! (-> this next-box) 1) + (deactivate s5-0) + (let ((a0-19 (handle->process (-> this vehicle)))) + (if a0-19 + (deactivate a0-19) + ) + ) + (let ((a0-22 (-> this arrow-h process 0))) + (if a0-22 + (deactivate a0-22) + ) + ) + (send-event this 'complete) + ) + (let ((a1-6 *target*)) + (when (and a1-6 (focus-test? a1-6 pilot)) + (set-setting! 'music 'cityfi 0.0 0) + (when (not (-> this intro-play?)) + (set-setting! 'airlock #f 0.0 0) + (set-speech-name this "jinx102" 300 600) + (set! (-> this intro-play?) #t) + ) + ) + ) + (let ((v1-67 (handle->process (-> this vehicle)))) (cond - ((as-type (entity-nav-mesh-by-aid (-> s5-0 nav-mesh-aid)) entity-nav-mesh) - ) + (v1-67 + (logior! (-> (the-as vehicle v1-67) v-flags) (vehicle-flag persistent)) + (if (or (and (-> (the-as vehicle v1-67) next-state) (= (-> (the-as vehicle v1-67) next-state name) 'inactive)) + (focus-test? (the-as vehicle v1-67) dead) + ) + (send-event this 'fail) + ) + ) (else + (send-event this 'fail) ) ) - (when (= (+ (length (-> this actor-group 0)) 1) (-> this next-box)) - (+! (-> this next-box) 1) - (deactivate s5-0) - (let ((a0-20 (handle->process (-> this vehicle)))) - (if a0-20 - (deactivate a0-20) - ) - ) - (let ((a0-23 (-> this arrow-h process 0))) - (if a0-23 - (deactivate a0-23) - ) - ) - (send-event this 'complete) - ) - (let ((a1-6 *target*)) - (when (and a1-6 (focus-test? a1-6 pilot)) - (set-setting! 'music 'cityfi 0.0 0) - (when (not (-> this intro-play?)) - (set-setting! 'airlock #f 0.0 0) - (set-speech-name this "jinx102" 300 600) - (set! (-> this intro-play?) #t) + ) + (when (-> this arrow-h) + (let ((a0-46 (-> this arrow-h process 0)) + (v1-82 *target*) + (a2-4 (handle->process (-> this vehicle))) ) - ) - ) - (let ((v1-67 (the-as vehicle (handle->process (-> this vehicle))))) (cond - (v1-67 - (logior! (-> v1-67 v-flags) (vehicle-flag persistent)) - (if (or (and (-> v1-67 next-state) (= (-> v1-67 next-state name) 'inactive)) (focus-test? v1-67 dead)) - (send-event this 'fail) - ) - ) + ((and (-> s5-0 next-state) (= (-> s5-0 next-state name) 'wait-for-ride)) + (logclear! (-> (the-as vehicle a2-4) v-flags) (vehicle-flag persistent)) + (if (and (the-as vehicle a2-4) v1-82 (not (logtest? (focus-status pilot) (-> v1-82 focus-status)))) + (send-event a0-46 'set-position (-> (the-as vehicle a2-4) root trans)) + (send-event a0-46 'set-position (-> s5-0 root trans)) + ) + (send-event (handle->process (-> this arrow-h)) 'show) + ) + ((and (-> s5-0 next-state) (= (-> s5-0 next-state name) 'ride)) + (cond + ((and a2-4 v1-82 (not (logtest? (focus-status pilot) (-> v1-82 focus-status)))) + (send-event a0-46 'set-position (-> s5-0 root trans)) + (send-event (handle->process (-> this arrow-h)) 'show) + ) + (else + (send-event (handle->process (-> this arrow-h)) 'set-position (-> this goal-pos)) + (send-event (handle->process (-> this arrow-h)) 'show) + ) + ) + ) (else - (send-event this 'fail) + (send-event (handle->process (-> this arrow-h)) 'hide) ) ) ) - (when (-> this arrow-h) - (let ((a0-47 (-> this arrow-h process 0)) - (v1-82 *target*) - (a2-4 (handle->process (-> this vehicle))) - ) + ) + (when *target* + (if (< 819200.0 (vector-vector-distance (-> s5-0 root trans) (target-pos 0))) + (send-event this 'fail) + ) + (let ((s4-4 (handle->process (-> this vehicle)))) + (when s4-4 (cond - ((and (-> s5-0 next-state) (= (-> s5-0 next-state name) 'wait-for-ride)) - (logclear! (-> (the-as vehicle a2-4) v-flags) (vehicle-flag persistent)) - (if (and (the-as vehicle a2-4) v1-82 (not (logtest? (focus-status pilot) (-> v1-82 focus-status)))) - (send-event a0-47 'set-position (-> (the-as vehicle a2-4) root trans)) - (send-event a0-47 'set-position (-> s5-0 root trans)) - ) - (send-event (handle->process (-> this arrow-h)) 'show) - ) ((and (-> s5-0 next-state) (= (-> s5-0 next-state name) 'ride)) - (cond - ((and a2-4 v1-82 (not (logtest? (focus-status pilot) (-> v1-82 focus-status)))) - (send-event a0-47 'set-position (-> s5-0 root trans)) - (send-event (handle->process (-> this arrow-h)) 'show) - ) - (else - (send-event (handle->process (-> this arrow-h)) 'set-position (-> this goal-pos)) - (send-event (handle->process (-> this arrow-h)) 'show) + (when (= (-> this next-box) (length (-> this actor-group 0))) + (deactivate s5-0) + (let ((a0-84 (handle->process (-> this vehicle)))) + (if a0-84 + (deactivate a0-84) + ) ) + (let ((a0-87 (-> this arrow-h process 0))) + (if a0-87 + (deactivate a0-87) + ) + ) + (send-event this 'complete) ) - ) - (else - (send-event (handle->process (-> this arrow-h)) 'hide) - ) - ) - ) - ) - (when *target* - (if (< 819200.0 (vector-vector-distance (-> s5-0 root trans) (target-pos 0))) - (send-event this 'fail) - ) - (let ((s4-4 (the-as vehicle (handle->process (-> this vehicle))))) - (when s4-4 - (cond - ((and (-> s5-0 next-state) (= (-> s5-0 next-state name) 'ride)) - (when (= (-> this next-box) (length (-> this actor-group 0))) - (deactivate s5-0) - (let ((a0-85 (handle->process (-> this vehicle)))) - (if a0-85 - (deactivate a0-85) - ) - ) - (let ((a0-88 (-> this arrow-h process 0))) - (if a0-88 - (deactivate a0-88) - ) - ) - (send-event this 'complete) - ) - (if (and (< (vector-vector-distance (-> this goal-pos) (-> s5-0 root trans)) 163840.0) - (begin - (.lvf vf1 (&-> (-> s4-4 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 v1-180 vf1) - (let ((f0-4 v1-180) - (f1-2 12288.0) - ) - (< f0-4 (* f1-2 f1-2)) + (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)) ) - (send-event s5-0 'exit-vehicle (-> this goal-pos-front)) - ) - ) - ((and (-> s5-0 next-state) (= (-> s5-0 next-state name) 'wait-for-ride)) - (let ((v1-197 (get-best-seat s4-4 (-> s4-4 root trans) (the-as vehicle-seat-flag (-> s5-0 info seat-flag)) 1))) - (when (!= v1-197 -1) - (.lvf vf1 (&-> (-> s4-4 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 v1-201 vf1) - (let ((f0-5 v1-201) - (f1-5 32768.0) - ) - (when (and (< f0-5 (* f1-5 f1-5)) - (let ((f0-6 (vector-vector-distance-squared (-> s4-4 root trans) (-> s5-0 root trans))) - (f1-8 204800.0) - ) - (< f0-6 (* f1-8 f1-8)) - ) - ) - (send-event s5-0 'board-vehicle s4-4) - (when (and (nonzero? (-> this next-box)) (!= (-> 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 - ) + ) + (send-event s5-0 'exit-vehicle (-> this goal-pos-front)) + ) + ) + ((and (-> s5-0 next-state) (= (-> s5-0 next-state name) 'wait-for-ride)) + (let ((v1-197 (get-best-seat + (the-as vehicle s4-4) + (-> (the-as vehicle s4-4) root trans) + (the-as vehicle-seat-flag (-> s5-0 info seat-flag)) + 1 ) ) - (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)) + ) + (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)) ) + (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)) + ) ) ) ) ) ) - ) + ) ) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ) 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 2779e67107..dbc2cc96a7 100644 --- a/goal_src/jak3/levels/city/hijack/cty-hijack-missile.gc +++ b/goal_src/jak3/levels/city/hijack/cty-hijack-missile.gc @@ -661,7 +661,7 @@ ) (vector-normalize! s4-1 1.0) (let ((f0-12 (fmin f30-0 (* f28-0 (seconds-per-frame))))) - (vector-rotate-around-axis! gp-0 (the-as quaternion gp-0) f0-12 s4-1) + (vector-rotate-around-axis! gp-0 gp-0 f0-12 s4-1) ) ) (quaternion-look-at! (-> self root quat) gp-0 *up-vector*) diff --git a/goal_src/jak3/levels/city/hijack/kg-vehicles.gc b/goal_src/jak3/levels/city/hijack/kg-vehicles.gc index 735507a786..d46a73a4e7 100644 --- a/goal_src/jak3/levels/city/hijack/kg-vehicles.gc +++ b/goal_src/jak3/levels/city/hijack/kg-vehicles.gc @@ -825,7 +825,7 @@ ) (vector-normalize! s2-1 1.0) (let ((f0-23 (fmin f28-0 (* 16384.0 arg0)))) - (vector-rotate-around-axis! s4-2 (the-as quaternion s4-2) f0-23 s2-1) + (vector-rotate-around-axis! s4-2 s4-2 f0-23 s2-1) ) ) ) diff --git a/goal_src/jak3/levels/city/protect/assault-enemies.gc b/goal_src/jak3/levels/city/protect/assault-enemies.gc index 2886587ade..7ab368249d 100644 --- a/goal_src/jak3/levels/city/protect/assault-enemies.gc +++ b/goal_src/jak3/levels/city/protect/assault-enemies.gc @@ -1679,44 +1679,21 @@ ;; WARN: Return type mismatch object vs none. (defmethod bombbot-method-196 ((this assault-bombbot) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (the-as target (as-type *target* process-focusable)))) - (cond - (gp-0 - (vector-copy! (-> this target-pos) (get-trans gp-0 3)) - (let ((v1-3 (-> this target-pos))) - (let ((a0-4 (-> gp-0 control trans))) - (let ((a1-4 (-> gp-0 control transv))) - (let ((a2-0 0.0)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a1-4 quad)) - ) - (.lvf vf4 (&-> a0-4 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-3 quad) vf6) - ) - (vector-copy! (-> this start-target-pos) (-> this target-pos)) - (vector-copy! (-> this start-target-vel) (-> gp-0 control transv)) - (focus-on! (-> this focus) gp-0 this) - ) - (else - (clear-focused (-> this focus)) - ) + (let ((gp-0 (the-as target (as-type *target* process-focusable)))) + (cond + (gp-0 + (vector-copy! (-> this target-pos) (get-trans gp-0 3)) + (vector+*! (-> this target-pos) (-> gp-0 control trans) (-> gp-0 control transv) 0.0) + (vector-copy! (-> this start-target-pos) (-> this target-pos)) + (vector-copy! (-> this start-target-vel) (-> gp-0 control transv)) + (focus-on! (-> this focus) gp-0 this) + ) + (else + (clear-focused (-> this focus)) ) ) - (none) ) + (none) ) (defmethod assault-bombbot-method-209 ((this assault-bombbot)) @@ -1814,89 +1791,71 @@ ) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (not (-> self is-final?)) - (let ((f30-0 (/ (-> self hit-points) (-> self max-hp)))) - (when (time-elapsed? (-> self stop-shoot) (seconds 6)) - (dotimes (gp-0 (-> *bombbot-bomb-hp-thresholds* length)) - (if (and (>= (-> *bombbot-bomb-hp-thresholds* gp-0) f30-0) - (>= f30-0 (+ -0.1 (-> *bombbot-bomb-hp-thresholds* gp-0))) - ) - (go-virtual drop-bombs) - ) - ) - ) - ) - ) - (when (< (-> self next-target) (current-time)) - (let ((a1-0 (new 'stack-no-clear 'vector))) - (vector-copy! a1-0 (-> self root trans)) - (set! (-> a1-0 w) 204800.0) - (bombbot-method-196 self a1-0) - ) - (set! (-> self next-target) (+ (current-time) (seconds 8))) - (set! (-> self gun-type) (the-as uint 0)) - 0 - ) - (let ((v1-33 (the-as process-focusable (handle->process (-> self focus handle))))) - (when v1-33 - (when (< (current-time) (+ (-> self next-target) (seconds -2))) - (set-time! (-> self start-target)) - (vector-copy! (-> self start-target-pos) (-> v1-33 root trans)) - (vector-copy! (-> self start-target-vel) (-> v1-33 root transv)) - (vector-! (-> self target-delta) (-> v1-33 root trans) (-> self root trans)) - ) - (let ((a2-2 (-> self target-pos))) - (let ((a0-23 (-> self start-target-pos))) - (let ((a1-12 (-> self start-target-vel))) - (let ((a3-4 (* 0.0033333334 (the float (- (current-time) (-> self start-target)))))) - (.mov vf7 a3-4) - ) - (.lvf vf5 (&-> a1-12 quad)) - ) - (.lvf vf4 (&-> a0-23 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) - ) - (if (= (-> v1-33 type) target) - (vector-copy! (-> self target-pos) (-> self start-target-pos)) - ) - (if (< (+ (-> self next-target) (seconds -1)) (current-time)) - (bombbot-method-197 self) - (bombbot-method-204 self) - ) - ) - ) - (bombbot-method-205 self) - (new 'stack-no-clear 'vector) - (let ((f0-8 (* 0.25 (+ (-> self feet 0 next-position y) - (-> self feet 1 next-position y) - (-> self feet 2 next-position y) - (-> self feet 3 next-position y) - ) + (when (not (-> self is-final?)) + (let ((f30-0 (/ (-> self hit-points) (-> self max-hp)))) + (when (time-elapsed? (-> self stop-shoot) (seconds 6)) + (dotimes (gp-0 (-> *bombbot-bomb-hp-thresholds* length)) + (if (and (>= (-> *bombbot-bomb-hp-thresholds* gp-0) f30-0) + (>= f30-0 (+ -0.1 (-> *bombbot-bomb-hp-thresholds* gp-0))) ) - ) + (go-virtual drop-bombs) + ) ) - (if (!= (-> self nav state mesh) *default-nav-mesh*) - (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-8 (-> self root trans y)))) + ) + ) + ) + (when (< (-> self next-target) (current-time)) + (let ((a1-0 (new 'stack-no-clear 'vector))) + (vector-copy! a1-0 (-> self root trans)) + (set! (-> a1-0 w) 204800.0) + (bombbot-method-196 self a1-0) + ) + (set! (-> self next-target) (+ (current-time) (seconds 8))) + (set! (-> self gun-type) (the-as uint 0)) + 0 + ) + (let ((v1-33 (the-as process-focusable (handle->process (-> self focus handle))))) + (when v1-33 + (when (< (current-time) (+ (-> self next-target) (seconds -2))) + (set-time! (-> self start-target)) + (vector-copy! (-> self start-target-pos) (-> v1-33 root trans)) + (vector-copy! (-> self start-target-vel) (-> v1-33 root transv)) + (vector-! (-> self target-delta) (-> v1-33 root trans) (-> self root trans)) + ) + (vector+*! + (-> self target-pos) + (-> self start-target-pos) + (-> self start-target-vel) + (* 0.0033333334 (the float (- (current-time) (-> self start-target)))) + ) + (if (= (the-as process-focusable (-> v1-33 type)) target) + (vector-copy! (-> self target-pos) (-> self start-target-pos)) + ) + (if (< (+ (-> self next-target) (seconds -1)) (current-time)) + (bombbot-method-197 self) + (bombbot-method-204 self) ) ) - (if (= (vector-length (-> self root transv)) 0.0) - (set-time! (-> self state-time)) - ) - (bombbot-method-202 self) - (bombbot-method-195 self) ) + (bombbot-method-205 self) + (new 'stack-no-clear 'vector) + (let ((f0-8 (* 0.25 (+ (-> self feet 0 next-position y) + (-> self feet 1 next-position y) + (-> self feet 2 next-position y) + (-> self feet 3 next-position y) + ) + ) + ) + ) + (if (!= (-> self nav state mesh) *default-nav-mesh*) + (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-8 (-> self root trans y)))) + ) + ) + (if (= (vector-length (-> self root transv)) 0.0) + (set-time! (-> self state-time)) + ) + (bombbot-method-202 self) + (bombbot-method-195 self) ) :post (behavior () (let ((v1-0 1200)) diff --git a/goal_src/jak3/levels/city/protect/protect-gunship.gc b/goal_src/jak3/levels/city/protect/protect-gunship.gc index 2d9b82bee8..420c227a1b 100644 --- a/goal_src/jak3/levels/city/protect/protect-gunship.gc +++ b/goal_src/jak3/levels/city/protect/protect-gunship.gc @@ -1274,45 +1274,31 @@ ) (defun find-nearest-nav-mesh-protect ((arg0 vector) (arg1 float)) - (local-vars (v1-15 float) (sv-64 nav-poly) (sv-68 nav-mesh) (sv-72 float) (sv-76 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-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))) - (.lvf vf1 (&-> (-> sv-64 vertex) 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-15 vf1) - (let ((f0-1 v1-15) - (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) - ) + (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) ) ) ) @@ -1324,8 +1310,8 @@ ) ) ) - sv-68 ) + sv-68 ) (defbehavior gunship-event-handler protect-gunship ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) @@ -1637,7 +1623,7 @@ ) (vector-rotate-around-axis! (-> s4-0 fvec) - (the-as quaternion (-> s4-0 fvec)) + (-> s4-0 fvec) (+ 8192.0 (* 16384.0 (the float s2-0))) (-> s4-0 uvec) ) @@ -2331,7 +2317,7 @@ (let ((s5-0 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> this root quat)))) (vector-rotate-around-axis! (-> s5-0 fvec) - (the-as quaternion (-> s5-0 fvec)) + (-> s5-0 fvec) (+ 8192.0 (* 16384.0 (the float arg0))) (-> s5-0 uvec) ) @@ -3248,7 +3234,7 @@ (seek! (-> self current-laser-rotate-speed) (-> self laser-rotate-speed) (* 3640.889 (seconds-per-frame))) (vector-rotate-around-axis! (-> self base-laser-dir) - (the-as quaternion (-> self base-laser-dir)) + (-> self base-laser-dir) (* (-> self current-laser-rotate-speed) (seconds-per-frame)) *up-vector* ) @@ -3327,7 +3313,7 @@ ((time-elapsed? (-> self state-time) (seconds 3)) (dotimes (s3-1 s4-0) (fire-laser self gp-4 s5-0) - (vector-rotate-around-axis! s5-0 (the-as quaternion s5-0) (/ 65536.0 (the float s4-0)) *up-vector*) + (vector-rotate-around-axis! s5-0 s5-0 (/ 65536.0 (the float s4-0)) *up-vector*) ) ) ((time-elapsed? (-> self state-time) (seconds 1.5)) 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 9cd4951294..69916511e2 100644 --- a/goal_src/jak3/levels/city/sniper/cty-sniper-turret.gc +++ b/goal_src/jak3/levels/city/sniper/cty-sniper-turret.gc @@ -1143,57 +1143,35 @@ ) (defmethod projectile-method-25 ((this cty-sniper-turret-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 4844 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 4844 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 4844) a1-0 s5-1 #f) - (set! (-> *part-id-table* 4844 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 4845) s4-0) - (launch-particles (-> *part-id-table* 4846) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f28-1 (/ f30-0 (meters 16))) - (f30-1 (-> *part-id-table* 4847 init-specs 3 initial-valuef)) - ) - (-> *part-id-table* 4847 init-specs 4 initial-valuef) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 4847 init-specs 3 initial-valuef) (* f28-1 f30-1)) - (launch-particles (-> *part-id-table* 4847) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 4847 init-specs 3 initial-valuef) f30-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 4844 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 4844 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 4844) a1-0 s5-1 #f) + (set! (-> *part-id-table* 4844 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 4845) s4-1) + (launch-particles (-> *part-id-table* 4846) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f28-1 (/ f30-0 (meters 16))) + (f30-1 (-> *part-id-table* 4847 init-specs 3 initial-valuef)) + ) + (-> *part-id-table* 4847 init-specs 4 initial-valuef) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 4847 init-specs 3 initial-valuef) (* f28-1 f30-1)) + (launch-particles (-> *part-id-table* 4847) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 4847 init-specs 3 initial-valuef) f30-1) ) - 0 - (none) ) + 0 + (none) ) (defmethod projectile-method-26 ((this cty-sniper-turret-shot)) diff --git a/goal_src/jak3/levels/city/traffic/citizen/citizen.gc b/goal_src/jak3/levels/city/traffic/citizen/citizen.gc index ca786ea59c..1c266daa2b 100644 --- a/goal_src/jak3/levels/city/traffic/citizen/citizen.gc +++ b/goal_src/jak3/levels/city/traffic/citizen/citizen.gc @@ -608,131 +608,111 @@ (defmethod move-above-ground! ((this citizen) (arg0 vector) (arg1 move-above-ground-params)) "Move the enemy. May keep the enemy snapped to the ground depending on flags." - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let ((gp-0 (-> this root))) + (set! (-> arg1 on-ground?) #f) + (set! (-> arg1 do-move?) #t) + (vector-copy! (-> arg1 old-gspot-pos) (-> gp-0 gspot-pos)) + (vector-copy! (-> arg1 old-gspot-normal) (-> gp-0 gspot-normal)) + (set! (-> gp-0 trans-old-old-old quad) (-> gp-0 trans-old-old quad)) + (set! (-> gp-0 trans-old-old quad) (-> gp-0 trans-old quad)) + (set! (-> gp-0 trans-old quad) (-> gp-0 trans quad)) + (set! (-> gp-0 prev-status) (-> gp-0 status)) + (vector-v+! (-> gp-0 trans) (-> gp-0 trans) arg0) + (vector-copy! (-> arg1 new-pos) (-> gp-0 trans)) + (when (not (logtest? (logxor (-> this traffic-id) (the-as int (-> this probe-counter))) 7)) + (let ((s2-0 (new 'stack-no-clear 'collide-query))) + (logclear! (-> gp-0 status) (collide-status on-ground)) + (when (enemy-above-ground? + this + s2-0 + (vector+*! (new 'stack-no-clear 'vector) (-> gp-0 trans) (-> gp-0 transv) 0.15) + (-> arg1 gnd-collide-with) + 16384.0 + 81920.0 + 1024.0 + ) + (vector-copy! (-> gp-0 gspot-pos) (-> gp-0 trans)) + (set! (-> gp-0 gspot-pos y) (-> s2-0 best-other-tri intersect y)) + (vector-copy! (-> gp-0 gspot-normal) (-> s2-0 best-other-tri normal)) + (logior! (-> gp-0 status) (collide-status on-ground)) + (set! (-> gp-0 ground-pat) (-> s2-0 best-other-tri pat)) + ) + ) + (set! (-> this gnd-height) (-> gp-0 gspot-pos y)) + (set! (-> gp-0 gspot-pos y) (-> arg1 old-gspot-pos y)) + ) + (let ((f0-5 (- (-> this gnd-height) (-> gp-0 gspot-pos y)))) + (cond + ((< 0.0 f0-5) + (+! (-> gp-0 gspot-pos y) (* 10.0 (seconds-per-frame) f0-5)) ) - (init-vf0-vector) - (let ((gp-0 (-> this root))) - (set! (-> arg1 on-ground?) #f) - (set! (-> arg1 do-move?) #t) - (vector-copy! (-> arg1 old-gspot-pos) (-> gp-0 gspot-pos)) - (vector-copy! (-> arg1 old-gspot-normal) (-> gp-0 gspot-normal)) - (set! (-> gp-0 trans-old-old-old quad) (-> gp-0 trans-old-old quad)) - (set! (-> gp-0 trans-old-old quad) (-> gp-0 trans-old quad)) - (set! (-> gp-0 trans-old quad) (-> gp-0 trans quad)) - (set! (-> gp-0 prev-status) (-> gp-0 status)) - (vector-v+! (-> gp-0 trans) (-> gp-0 trans) arg0) - (vector-copy! (-> arg1 new-pos) (-> gp-0 trans)) - (when (not (logtest? (logxor (-> this traffic-id) (the-as int (-> this probe-counter))) 7)) - (let ((s2-0 (new 'stack-no-clear 'collide-query))) - (logclear! (-> gp-0 status) (collide-status on-ground)) - (let* ((a0-10 this) - (t9-1 (method-of-object a0-10 enemy-above-ground?)) - (a1-2 s2-0) - (a2-2 (new 'stack-no-clear 'vector)) - ) - (let ((v1-15 (-> gp-0 trans))) - (let ((a3-0 (-> gp-0 transv))) - (let ((t0-1 0.15)) - (.mov vf7 t0-1) - ) - (.lvf vf5 (&-> a3-0 quad)) - ) - (.lvf vf4 (&-> v1-15 quad)) + (else + (+! (-> gp-0 gspot-pos y) (* 10.0 (seconds-per-frame) f0-5)) + (if (< (-> gp-0 gspot-pos y) (-> this gnd-height)) + (set! (-> gp-0 gspot-pos y) (-> this gnd-height)) ) - (.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) - (when (t9-1 a0-10 a1-2 a2-2 (-> arg1 gnd-collide-with) 16384.0 81920.0 1024.0) - (vector-copy! (-> gp-0 gspot-pos) (-> gp-0 trans)) - (set! (-> gp-0 gspot-pos y) (-> s2-0 best-other-tri intersect y)) - (vector-copy! (-> gp-0 gspot-normal) (-> s2-0 best-other-tri normal)) - (logior! (-> gp-0 status) (collide-status on-ground)) - (set! (-> gp-0 ground-pat) (-> s2-0 best-other-tri pat)) - ) - ) - ) - (set! (-> this gnd-height) (-> gp-0 gspot-pos y)) - (set! (-> gp-0 gspot-pos y) (-> arg1 old-gspot-pos y)) - ) - (let ((f0-5 (- (-> this gnd-height) (-> gp-0 gspot-pos y)))) - (cond - ((< 0.0 f0-5) - (+! (-> gp-0 gspot-pos y) (* 10.0 (seconds-per-frame) f0-5)) - ) - (else - (+! (-> gp-0 gspot-pos y) (* 10.0 (seconds-per-frame) f0-5)) - (if (< (-> gp-0 gspot-pos y) (-> this gnd-height)) - (set! (-> gp-0 gspot-pos y) (-> this gnd-height)) - ) - ) ) ) - (set! (-> arg1 on-ground?) #t) - (set! (-> arg1 pat) (-> gp-0 ground-pat)) - (when (>= (-> gp-0 gspot-pos y) (-> arg1 new-pos y)) - (set! (-> arg1 new-pos y) (-> gp-0 gspot-pos y)) - (set! (-> gp-0 ground-impact-vel) (- (vector-dot arg0 (-> gp-0 dynam gravity-normal)))) - (set! (-> arg0 y) 0.0) - ) - (vector-copy! (-> gp-0 trans) (-> arg1 new-pos)) - (when (-> arg1 do-move?) - (cond - ((-> arg1 on-ground?) - (let ((a1-3 (-> gp-0 gspot-pos)) - (a0-18 (-> gp-0 gspot-normal)) - (v1-42 (-> arg1 pat)) - ) - (vector-copy! (-> gp-0 ground-touch-point) a1-3) - (vector-copy! (-> gp-0 poly-normal) a0-18) - (vector-copy! (-> gp-0 surface-normal) a0-18) - (vector-copy! (-> gp-0 local-normal) a0-18) - (vector-copy! (-> gp-0 ground-poly-normal) a0-18) - (set! (-> gp-0 poly-pat) v1-42) - (set! (-> gp-0 cur-pat) v1-42) - (set! (-> gp-0 ground-pat) v1-42) - ) - (logior! (-> gp-0 status) (collide-status on-surface on-ground touch-surface)) + ) + (set! (-> arg1 on-ground?) #t) + (set! (-> arg1 pat) (-> gp-0 ground-pat)) + (when (>= (-> gp-0 gspot-pos y) (-> arg1 new-pos y)) + (set! (-> arg1 new-pos y) (-> gp-0 gspot-pos y)) + (set! (-> gp-0 ground-impact-vel) (- (vector-dot arg0 (-> gp-0 dynam gravity-normal)))) + (set! (-> arg0 y) 0.0) + ) + (vector-copy! (-> gp-0 trans) (-> arg1 new-pos)) + (when (-> arg1 do-move?) + (cond + ((-> arg1 on-ground?) + (let ((a1-3 (-> gp-0 gspot-pos)) + (a0-18 (-> gp-0 gspot-normal)) + (v1-42 (-> arg1 pat)) + ) + (vector-copy! (-> gp-0 ground-touch-point) a1-3) + (vector-copy! (-> gp-0 poly-normal) a0-18) + (vector-copy! (-> gp-0 surface-normal) a0-18) + (vector-copy! (-> gp-0 local-normal) a0-18) + (vector-copy! (-> gp-0 ground-poly-normal) a0-18) + (set! (-> gp-0 poly-pat) v1-42) + (set! (-> gp-0 cur-pat) v1-42) + (set! (-> gp-0 ground-pat) v1-42) ) - (else - (logclear! (-> gp-0 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 - ) - ) - (when (not (logtest? (-> gp-0 root-prim prim-core action) (collide-action no-normal-reset))) - (let ((v1-52 (-> gp-0 dynam gravity-normal))) - (vector-copy! (-> gp-0 local-normal) v1-52) - (vector-copy! (-> gp-0 surface-normal) v1-52) - (vector-copy! (-> gp-0 poly-normal) v1-52) - ) - (set! (-> gp-0 coverage) 0.0) - (set! (-> gp-0 touch-angle) 0.0) + (logior! (-> gp-0 status) (collide-status on-surface on-ground touch-surface)) + ) + (else + (logclear! (-> gp-0 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 + ) + ) + (when (not (logtest? (-> gp-0 root-prim prim-core action) (collide-action no-normal-reset))) + (let ((v1-52 (-> gp-0 dynam gravity-normal))) + (vector-copy! (-> gp-0 local-normal) v1-52) + (vector-copy! (-> gp-0 surface-normal) v1-52) + (vector-copy! (-> gp-0 poly-normal) v1-52) ) + (set! (-> gp-0 coverage) 0.0) + (set! (-> gp-0 touch-angle) 0.0) ) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod normalize-heading! ((this citizen) (arg0 nav-control)) @@ -1142,99 +1122,76 @@ (defun iter-seg-clear-path ((arg0 iter-seg) (arg1 nav-segment)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s2-0 (-> arg0 self)) - (a0-1 (-> arg1 branch src-node)) - (s4-0 (new 'stack-no-clear 'vector)) + (let ((s2-0 (-> arg0 self)) + (a0-1 (-> arg1 branch src-node)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s4-0 (-> a0-1 position)) + (set! (-> s4-0 w) 1.0) + (let ((a0-4 (-> arg1 branch dest-node)) + (s3-0 (new 'stack-no-clear 'vector)) ) - (vector-copy! s4-0 (-> a0-1 position)) + (vector-copy! s3-0 (-> a0-4 position)) + (set! (-> s3-0 w) 1.0) + (set! (-> s4-0 y) 0.0) + (set! (-> s3-0 y) 0.0) (set! (-> s4-0 w) 1.0) - (let ((a0-4 (-> arg1 branch dest-node)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s3-0 (-> a0-4 position)) - (set! (-> s3-0 w) 1.0) - (set! (-> s4-0 y) 0.0) - (set! (-> s3-0 y) 0.0) - (set! (-> s4-0 w) 1.0) - (set! (-> s3-0 w) 1.0) - (when *citizen-debug* - ) - (when #t - (cond - ((< 0.0 (vector4-dot (the-as vector (-> arg0 cp-plane)) s3-0)) - (let ((s0-1 (vector-! (new 'stack-no-clear 'vector) s3-0 s4-0)) - (s1-1 (vector-! (new 'stack-no-clear 'vector) (-> s2-0 root trans) s4-0)) - ) - (set! (-> s1-1 y) 0.0) - (vector-rotate90-around-y! s0-1 s0-1) - (vector-normalize! s0-1 1.0) - (let ((a1-3 s1-1)) - (let ((v1-17 s1-1)) - (let ((a0-12 s0-1)) - (let ((a2-2 (- (vector-dot s0-1 s1-1)))) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-12 quad)) - ) - (.lvf vf4 (&-> v1-17 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-3 quad) vf6) + (set! (-> s3-0 w) 1.0) + (when *citizen-debug* + ) + (when #t + (cond + ((< 0.0 (vector4-dot (the-as vector (-> arg0 cp-plane)) s3-0)) + (let ((s0-1 (vector-! (new 'stack-no-clear 'vector) s3-0 s4-0)) + (s1-1 (vector-! (new 'stack-no-clear 'vector) (-> s2-0 root trans) s4-0)) ) - (vector+! s1-1 s1-1 s4-0) - (cond - ((< 0.0 (vector-dot (the-as vector (-> arg0 cp-plane)) (vector-! (new 'stack-no-clear 'vector) s3-0 s1-1))) - (vector-vector-xz-distance s3-0 (-> s2-0 cp-sphere)) - (let ((s1-3 (vector-! (new 'stack-no-clear 'vector) s3-0 (the-as vector (-> s2-0 cp-sphere)))) - (s0-2 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s0-2 (-> s2-0 cp-vec)) - (set! (-> s0-2 y) 0.0) - (vector-normalize! s0-2 1.0) - (set! (-> s1-3 y) 0.0) - (let ((f30-0 (vector-dot s0-2 s1-3))) - (if (and *cty-faction-manager* (not (logtest? (cty-faction-manager-method-9 - *cty-faction-manager* - (the-as int (-> arg1 branch clock-type)) - (-> pp level name) - ) - 1 + (set! (-> s1-1 y) 0.0) + (vector-rotate90-around-y! s0-1 s0-1) + (vector-normalize! s0-1 1.0) + (vector+*! s1-1 s1-1 s0-1 (- (vector-dot s0-1 s1-1))) + (vector+! s1-1 s1-1 s4-0) + (cond + ((< 0.0 (vector-dot (the-as vector (-> arg0 cp-plane)) (vector-! (new 'stack-no-clear 'vector) s3-0 s1-1))) + (vector-vector-xz-distance s3-0 (-> s2-0 cp-sphere)) + (let ((s1-3 (vector-! (new 'stack-no-clear 'vector) s3-0 (the-as vector (-> s2-0 cp-sphere)))) + (s0-2 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s0-2 (-> s2-0 cp-vec)) + (set! (-> s0-2 y) 0.0) + (vector-normalize! s0-2 1.0) + (set! (-> s1-3 y) 0.0) + (let ((f30-0 (vector-dot s0-2 s1-3))) + (if (and *cty-faction-manager* (not (logtest? (cty-faction-manager-method-9 + *cty-faction-manager* + (the-as int (-> arg1 branch clock-type)) + (-> pp level name) ) - ) - ) - (set! f30-0 (+ -409600.0 f30-0)) - ) - (when (< (-> arg0 score) f30-0) - (set! (-> arg0 score) f30-0) - (set! (-> arg0 seg) arg1) + 1 + ) + ) + ) + (set! f30-0 (+ -409600.0 f30-0)) ) + (when (< (-> arg0 score) f30-0) + (set! (-> arg0 score) f30-0) + (set! (-> arg0 seg) arg1) ) ) - (if *citizen-debug* - (add-debug-line #t (bucket-id debug-no-zbuf1) s4-0 s3-0 *color-black* #f *color-white*) - ) ) - (else - (if *citizen-debug* - (add-debug-line #t (bucket-id debug-no-zbuf1) s1-1 s3-0 *color-red* #f (the-as rgba -1)) - ) - ) + (if *citizen-debug* + (add-debug-line #t (bucket-id debug-no-zbuf1) s4-0 s3-0 *color-black* #f *color-white*) + ) + ) + (else + (if *citizen-debug* + (add-debug-line #t (bucket-id debug-no-zbuf1) s1-1 s3-0 *color-red* #f (the-as rgba -1)) + ) ) ) ) - (else - #f - ) + ) + (else + #f ) ) ) diff --git a/goal_src/jak3/levels/city/traffic/citizen/civilian.gc b/goal_src/jak3/levels/city/traffic/citizen/civilian.gc index f128dcbce1..bef40300a9 100644 --- a/goal_src/jak3/levels/city/traffic/citizen/civilian.gc +++ b/goal_src/jak3/levels/city/traffic/citizen/civilian.gc @@ -1542,70 +1542,18 @@ ) (defun do-spline2 ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((f1-1 (* arg5 arg5)) + (f0-2 (* arg5 f1-1)) ) - (init-vf0-vector) - (let* ((f1-1 (* arg5 arg5)) - (f0-2 (* arg5 f1-1)) - ) - (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) - (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) - (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) - ) - (vector-float*! arg0 arg1 f2-3) - (let ((t2-0 arg0)) - (let ((v1-10 arg0)) - (let ((t1-3 (vector+! (new 'stack-no-clear 'vector) arg1 arg2))) - (let ((a1-1 f3-7)) - (.mov vf7 a1-1) - ) - (.lvf vf5 (&-> t1-3 quad)) - ) - (.lvf vf4 (&-> v1-10 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 (&-> t2-0 quad) vf6) + (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) + (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) + (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) ) - (let ((a2-1 arg0)) - (let ((v1-11 arg0)) - (let ((a1-3 (vector+! (new 'stack-no-clear 'vector) arg3 arg4))) - (let ((t0-1 f1-3)) - (.mov vf7 t0-1) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> v1-11 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-1 quad) vf6) - ) - ) - (let ((v0-0 arg0)) - (let ((v1-12 arg0)) - (let ((a0-1 arg3)) - (let ((a1-4 f0-2)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-12 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 (&-> v0-0 quad) vf6) - v0-0 - ) + (vector-float*! arg0 arg1 f2-3) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg1 arg2) f3-7) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg3 arg4) f1-3) ) + (vector+*! arg0 arg0 arg3 f0-2) ) ) diff --git a/goal_src/jak3/levels/city/traffic/citizen/guard.gc b/goal_src/jak3/levels/city/traffic/citizen/guard.gc index dcd737e79a..32eb880760 100644 --- a/goal_src/jak3/levels/city/traffic/citizen/guard.gc +++ b/goal_src/jak3/levels/city/traffic/citizen/guard.gc @@ -235,125 +235,57 @@ (sv-304 vector) (sv-320 vector) ) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (set! sv-240 arg0) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (let ((v1-1 (-> this root trans))) - (let ((a0-1 *y-vector*)) - (let ((a1-2 8192.0)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-1 quad)) + (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)) ) - (.lvf vf4 (&-> v1-1 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 (&-> 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)) - (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-0 (-> this root trans)) - (cond - ((logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) - (let ((a1-6 s0-0)) - (let ((v1-13 s0-0)) - (let ((a0-9 s4-0)) - (let ((a2-1 4096.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-9 quad)) - ) - (.lvf vf4 (&-> v1-13 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-6 quad) vf6) + (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)) ) - ) - (else - (let ((a1-7 s0-0)) - (let ((v1-14 s0-0)) - (let ((a0-10 s4-0)) - (let ((a2-3 2048.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-10 quad)) - ) - (.lvf vf4 (&-> v1-14 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-7 quad) vf6) - ) - ) - ) - (let ((a1-8 s0-0)) - (let ((v1-15 s0-0)) - (let ((a0-11 s3-0)) - (let ((a2-5 8540.16)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-11 quad)) - ) - (.lvf vf4 (&-> v1-15 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-8 quad) vf6) - ) - (vector-normalize! (vector-! sv-320 sv-240 s0-0) 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-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) - (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+! sv-288 sv-288 v0-5) + ) + (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))) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod crimson-guard-method-260 ((this crimson-guard)) @@ -860,116 +792,81 @@ ) (defmethod crimson-guard-method-258 ((this crimson-guard) (arg0 vector) (arg1 vector) (arg2 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (let ((f0-0 1228.8) - (f30-0 6144.0) - ) - (vector-copy! (-> s5-0 start-pos) arg0) - (vector-! (-> s5-0 move-dist) arg1 arg0) - (let ((v1-4 s5-0)) - (set! (-> v1-4 radius) f0-0) - (set! (-> v1-4 collide-with) (collide-spec backgnd)) - (set! (-> v1-4 ignore-process0) this) - (set! (-> v1-4 ignore-process1) (handle->process (-> this focus handle))) - (set! (-> v1-4 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-4 action-mask) (collide-action solid)) + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (let ((f0-0 1228.8) + (f30-0 6144.0) ) - (let ((f0-1 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) - (cond - ((>= f0-1 0.0) - (vector-float*! (-> s5-0 move-dist) (-> s5-0 move-dist) f0-1) - (cond - ((< (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 + (vector-copy! (-> s5-0 start-pos) arg0) + (vector-! (-> s5-0 move-dist) arg1 arg0) + (let ((v1-4 s5-0)) + (set! (-> v1-4 radius) f0-0) + (set! (-> v1-4 collide-with) (collide-spec backgnd)) + (set! (-> v1-4 ignore-process0) this) + (set! (-> v1-4 ignore-process1) (handle->process (-> this focus handle))) + (set! (-> v1-4 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-4 action-mask) (collide-action solid)) + ) + (let ((f0-1 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) + (cond + ((>= f0-1 0.0) + (vector-float*! (-> s5-0 move-dist) (-> s5-0 move-dist) f0-1) + (cond + ((< (vector-dot + (-> s5-0 best-other-tri normal) + (vector-! (new 'stack-no-clear 'vector) arg2 (the-as vector (-> s5-0 best-other-tri))) ) - (return 1) - ) - (else + 0.0 ) + (return 1) + ) + (else + ) + ) + ) + (else + (vector-! (-> s5-0 move-dist) arg1 arg0) + ) + ) + ) + (vector-copy! (-> s5-0 start-pos) arg0) + (vector+*! (-> s5-0 start-pos) arg0 (-> s5-0 move-dist) -0.1) + (vector+*! (-> s5-0 move-dist) (-> s5-0 move-dist) (-> s5-0 move-dist) 0.1) + (let ((v1-17 s5-0)) + (set! (-> v1-17 radius) f30-0) + (set! (-> v1-17 collide-with) (collide-spec civilian enemy hit-by-player-list hit-by-others-list)) + (set! (-> v1-17 ignore-process0) this) + (set! (-> v1-17 ignore-process1) (handle->process (-> this focus handle))) + (set! (-> v1-17 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-17 action-mask) (collide-action solid)) + ) + ) + (cond + ((< (fill-and-probe-using-line-sphere *collide-cache* s5-0) 0.0) + 0 + ) + (else + (let ((v1-20 (as-type (-> s5-0 best-other-tri collide-ptr) collide-shape-prim))) + (cond + ((and v1-20 (< (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 + ) + ) + (let ((v1-22 (-> (the-as collide-shape-prim v1-20) cshape process))) + (if (and v1-22 (= (-> v1-22 type) target)) + 1 + 2 + ) ) ) (else - (vector-! (-> s5-0 move-dist) arg1 arg0) - ) - ) - ) - (vector-copy! (-> s5-0 start-pos) arg0) - (let ((a0-19 (-> s5-0 start-pos))) - (let ((v1-15 (-> s5-0 move-dist))) - (let ((a1-10 -0.1)) - (.mov vf7 a1-10) - ) - (.lvf vf5 (&-> v1-15 quad)) - ) - (.lvf vf4 (&-> arg0 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-19 quad) vf6) - ) - (let ((a1-11 (-> s5-0 move-dist))) - (let ((v1-16 (-> s5-0 move-dist))) - (let ((a0-20 (-> s5-0 move-dist))) - (let ((a2-4 0.1)) - (.mov vf7 a2-4) - ) - (.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 (&-> a1-11 quad) vf6) - ) - (let ((v1-17 s5-0)) - (set! (-> v1-17 radius) f30-0) - (set! (-> v1-17 collide-with) (collide-spec civilian enemy hit-by-player-list hit-by-others-list)) - (set! (-> v1-17 ignore-process0) this) - (set! (-> v1-17 ignore-process1) (handle->process (-> this focus handle))) - (set! (-> v1-17 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-17 action-mask) (collide-action solid)) - ) - ) - (cond - ((< (fill-and-probe-using-line-sphere *collide-cache* s5-0) 0.0) - 0 - ) - (else - (let ((v1-20 (as-type (-> s5-0 best-other-tri collide-ptr) collide-shape-prim))) - (cond - ((and v1-20 (< (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 - ) - ) - (let ((v1-22 (-> (the-as collide-shape-prim v1-20) cshape process))) - (if (and v1-22 (= (-> v1-22 type) target)) - 1 - 2 - ) - ) - ) - (else - 0 - ) + 0 ) ) ) @@ -1063,7 +960,7 @@ (vector-normalize-copy! s4-2 s5-2 1.0) (quaternion-vector-angle! s0-0 s4-2 (rnd-float-range this -32768.0 32768.0)) (vector-orient-by-quat! s3-1 *y-vector* s0-0) - (vector-rotate-around-axis! s5-2 (the-as quaternion s5-2) (rnd-float-range this -910.2222 910.2222) s3-1) + (vector-rotate-around-axis! s5-2 s5-2 (rnd-float-range this -910.2222 910.2222) s3-1) ) ) (vector+! (-> this target-pos-predict-miss) (-> this root trans) s5-2) @@ -1269,70 +1166,18 @@ ) (defun do-spline ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((f1-1 (* arg5 arg5)) + (f0-2 (* arg5 f1-1)) ) - (init-vf0-vector) - (let* ((f1-1 (* arg5 arg5)) - (f0-2 (* arg5 f1-1)) - ) - (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) - (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) - (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) - ) - (vector-float*! arg0 arg1 f2-3) - (let ((t2-0 arg0)) - (let ((v1-10 arg0)) - (let ((t1-3 (vector+! (new 'stack-no-clear 'vector) arg1 arg2))) - (let ((a1-1 f3-7)) - (.mov vf7 a1-1) - ) - (.lvf vf5 (&-> t1-3 quad)) - ) - (.lvf vf4 (&-> v1-10 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 (&-> t2-0 quad) vf6) + (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) + (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) + (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) ) - (let ((a2-1 arg0)) - (let ((v1-11 arg0)) - (let ((a1-3 (vector+! (new 'stack-no-clear 'vector) arg3 arg4))) - (let ((t0-1 f1-3)) - (.mov vf7 t0-1) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> v1-11 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-1 quad) vf6) - ) - ) - (let ((v0-0 arg0)) - (let ((v1-12 arg0)) - (let ((a0-1 arg3)) - (let ((a1-4 f0-2)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-12 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 (&-> v0-0 quad) vf6) - v0-0 - ) + (vector-float*! arg0 arg1 f2-3) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg1 arg2) f3-7) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg3 arg4) f1-3) ) + (vector+*! arg0 arg0 arg3 f0-2) ) ) @@ -1435,12 +1280,10 @@ (sv-816 nav-poly) (sv-832 vector) ) - (rlet ((acc :class vf) - (vf0 :class vf) + (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) @@ -1454,32 +1297,18 @@ (s0-0 (new 'stack 'collide-query)) ) (vector-rotate-around-y! sv-768 s4-0 (* 182.04445 (the float (+ (* 23 s2-0) -70)))) - (let ((v1-10 s1-0)) - (let ((a0-6 (-> this root trans))) - (let ((a1-5 sv-768)) - (let ((a2-2 1.0)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a1-5 quad)) - ) - (.lvf vf4 (&-> a0-6 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-10 quad) vf6) - ) + (vector+*! s1-0 (-> this root trans) sv-768 1.0) (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)) ) - (let ((v1-14 (-> this nav)) + (let ((v1-15 (-> this nav)) (a0-8 s1-0) (a1-7 (new 'stack-no-clear 'nav-poly)) ) - (vector-! (-> a1-7 vertex 0) a0-8 (the-as vector (-> v1-14 state mesh bounds))) - (set! (-> a1-7 vertex1 x) (-> v1-14 nearest-y-threshold)) + (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-14 state mesh) a1-7)) + (set! sv-816 (nav-mesh-method-45 (-> v1-15 state mesh) a1-7)) ) (when sv-816 (let* ((v1-18 s4-0) @@ -1508,23 +1337,23 @@ (let ((a3-3 (new 'stack-no-clear 'vector))) (set! sv-800 (-> this nav)) (set! sv-832 sv-784) - (let* ((v1-29 s1-0) + (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-29 (the-as vector (-> sv-800 state mesh bounds)))) + (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-7 a3-3 t0-2) + (t9-7 a0-18 sv-816 a2-6 a3-3 t0-2) ) ) - (let ((v1-30 sv-832)) + (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-30 quad) vf6) + (.svf (&-> v1-31 quad) vf6) ) 0 (set! (-> s1-0 y) (-> sv-784 y)) 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 f9e80e1e76..8f174adc60 100644 --- a/goal_src/jak3/levels/city/traffic/citizen/metalhead-grunt.gc +++ b/goal_src/jak3/levels/city/traffic/citizen/metalhead-grunt.gc @@ -989,53 +989,38 @@ ) (defmethod metalhead-grunt-method-228 ((this metalhead-grunt) (arg0 float)) - (local-vars (v1-5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (get-focus! this))) - (when gp-0 - (let ((v1-3 (get-trans gp-0 0)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (vector-! s4-0 v1-3 (-> this 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-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 ((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)))) - (go (method-of-object this attack)) - ) - ((let ((f0-10 12288.0)) - (< f30-0 (* f0-10 f0-10)) - ) - (go (method-of-object this spin-attack)) - ) + (let ((gp-0 (get-focus! this))) + (when gp-0 + (let ((v1-3 (get-trans gp-0 0)) + (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 ((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)))) + (go (method-of-object this attack)) + ) + ((let ((f0-10 12288.0)) + (< f30-0 (* f0-10 f0-10)) + ) + (go (method-of-object this spin-attack)) + ) ) ) ) ) ) - gp-0 ) + gp-0 ) ) 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 47172be024..684a2baac2 100644 --- a/goal_src/jak3/levels/city/traffic/citizen/metalhead-predator.gc +++ b/goal_src/jak3/levels/city/traffic/citizen/metalhead-predator.gc @@ -718,37 +718,23 @@ (let ((s0-0 (new 'stack-no-clear 'vector)) (s1-1 (new 'stack-no-clear 'vector)) ) - (let ((a0-20 s2-0)) - (let ((v1-34 s2-0)) - (let ((a1-6 (-> s3-0 root transv))) - (let ((a2-2 f0-6)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a1-6 quad)) - ) - (.lvf vf4 (&-> v1-34 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-20 quad) vf6) - ) + (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) (vector-normalize! sv-288 1.0) (vector-cross! s0-0 sv-272 sv-288) (vector-normalize! s0-0 1.0) - (let ((a2-5 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) sv-272 (-> this shoot-angle)))) - (vector-orient-by-quat! sv-288 sv-288 a2-5) + (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-28 (new 'stack-no-clear 'quaternion)) - (a2-6 (-> this shoot-angle)) - (a2-7 (t9-9 a0-28 sv-272 a2-6)) + (a0-29 (new 'stack-no-clear 'quaternion)) + (a2-5 (-> this shoot-angle)) + (a2-6 (t9-9 a0-29 sv-272 a2-5)) ) - (vector-orient-by-quat! s0-0 s0-0 a2-7) + (vector-orient-by-quat! s0-0 s0-0 a2-6) ) - (let ((a0-30 s1-1)) + (let ((a0-31 s1-1)) (let ((v1-36 s2-0)) (let ((a1-17 (-> this miss-amount))) (.mov vf7 a1-17) @@ -759,19 +745,9 @@ (.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-30 quad) vf6) - ) - (let ((v1-37 s2-0)) - (let ((a0-31 (* arg1 (-> this miss-amount)))) - (.mov vf7 a0-31) - ) - (.lvf vf5 (&-> s0-0 quad)) - (.lvf vf4 (&-> s1-1 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-37 quad) vf6) + (.svf (&-> a0-31 quad) vf6) ) + (vector+*! s2-0 s1-1 s0-0 (* arg1 (-> this miss-amount))) ) ) (vector-! (-> s5-0 vel) s2-0 (-> s5-0 pos)) diff --git a/goal_src/jak3/levels/city/traffic/traffic-engine.gc b/goal_src/jak3/levels/city/traffic/traffic-engine.gc index 854dbe8f28..8e49f25fa3 100644 --- a/goal_src/jak3/levels/city/traffic/traffic-engine.gc +++ b/goal_src/jak3/levels/city/traffic/traffic-engine.gc @@ -930,162 +930,138 @@ ) (defmethod update-danger-from-target ((this traffic-engine)) - (local-vars (v1-20 float) (v1-32 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 *target*)) - (when s5-0 - (let ((v1-1 (-> this danger-sphere-array))) - (set! (-> v1-1 0 handle) (process->handle s5-0)) - (let ((a0-4 (-> s5-0 focus-status)) - (f0-0 0.0) - (f1-0 0.0) - (f3-0 1.0) - (f2-0 0.0) - ) - (cond - ((logtest? (focus-status mech dark shooting) a0-4) - (set! f0-0 245760.0) - (set! f1-0 163840.0) - (set! f2-0 1.0) - (set! f3-0 0.0) - ) - ((logtest? (focus-status gun) a0-4) - (set! f0-0 102400.0) - (set! f1-0 61440.0) - (set! f2-0 0.5) - (set! f3-0 0.5) - ) - ((logtest? (focus-status flut board pilot) a0-4) - (set! f0-0 40960.0) - (set! f1-0 24576.0) - (set! f2-0 0.5) - ) - ((logtest? a0-4 (focus-status dangerous)) - (set! f0-0 61440.0) - (set! f1-0 40960.0) - (set! f3-0 0.0) - (set! f2-0 0.5) - ) - (else - (set! f3-0 1.5) - ) + (let ((s5-0 *target*)) + (when s5-0 + (let ((v1-1 (-> this danger-sphere-array))) + (set! (-> v1-1 0 handle) (process->handle s5-0)) + (let ((a0-4 (-> s5-0 focus-status)) + (f0-0 0.0) + (f1-0 0.0) + (f3-0 1.0) + (f2-0 0.0) ) - (set! (-> v1-1 0 decay-rate) (/ f3-0 10)) - (when (< (-> v1-1 0 danger-level) f2-0) - (set! (-> v1-1 0 danger-level) f2-0) - (set! (-> v1-1 0 sphere r) f1-0) - (set! (-> v1-1 0 notify-radius) f0-0) + (cond + ((logtest? (focus-status mech dark shooting) a0-4) + (set! f0-0 245760.0) + (set! f1-0 163840.0) + (set! f2-0 1.0) + (set! f3-0 0.0) + ) + ((logtest? (focus-status gun) a0-4) + (set! f0-0 102400.0) + (set! f1-0 61440.0) + (set! f2-0 0.5) + (set! f3-0 0.5) + ) + ((logtest? (focus-status flut board pilot) a0-4) + (set! f0-0 40960.0) + (set! f1-0 24576.0) + (set! f2-0 0.5) + ) + ((logtest? a0-4 (focus-status dangerous)) + (set! f0-0 61440.0) + (set! f1-0 40960.0) + (set! f3-0 0.0) + (set! f2-0 0.5) + ) + (else + (set! f3-0 1.5) ) ) - (let ((f0-1 (-> v1-1 0 sphere r))) - (set! (-> v1-1 0 sphere quad) (-> s5-0 control trans quad)) - (set! (-> v1-1 0 sphere r) f0-1) - ) - (vector-copy! (-> v1-1 0 velocity) (-> s5-0 control transv)) - (let ((f0-3 (- (-> v1-1 0 danger-level) (* (-> v1-1 0 decay-rate) (seconds-per-frame))))) - (set! (-> v1-1 0 danger-level) (fmax 0.0 f0-3)) + (set! (-> v1-1 0 decay-rate) (/ f3-0 10)) + (when (< (-> v1-1 0 danger-level) f2-0) + (set! (-> v1-1 0 danger-level) f2-0) + (set! (-> v1-1 0 sphere r) f1-0) + (set! (-> v1-1 0 notify-radius) f0-0) ) ) - (let ((s3-0 (-> s5-0 focus-status)) - (f30-0 0.0) - (s4-0 (new 'stack-no-clear 'inline-array 'traffic-suppression-box 2)) - ) - (vector-copy! (-> s4-0 0 bbox max) (-> s5-0 control transv)) - (vector-z-quaternion! (the-as vector (-> s4-0 1)) (get-quat s5-0 3)) - (set! (-> s4-0 1 data 16) (the-as uint 3)) - (cond - ((logtest? (focus-status shooting) s3-0) - (vector-float*! (the-as vector (-> s4-0 0)) (the-as vector (-> s4-0 1)) 409600.0) - (set! f30-0 4096.0) - (set! (-> s4-0 1 data 16) (the-as uint 0)) - 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)) - ) - (.lvf vf1 (&-> v1-19 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-20 vf1) - (< f0-8 v1-20) - ) - ) - ) - ) - (vector-float*! (the-as vector (-> s4-0 0)) (the-as vector (-> s4-0 1)) 163840.0) - (set! f30-0 8192.0) - (set! (-> s4-0 1 data 16) (the-as uint 1)) - ) - ((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) - (f0-13 (* f0-11 f0-11)) - ) - (.lvf vf1 (&-> v1-31 bbox min 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-13 v1-32) - (set! f30-0 20480.0) - ) - ) - (set! (-> s4-0 1 data 16) (the-as uint (cond - ((logtest? (focus-status pilot) s3-0) - 3 - ) - ((logtest? (focus-status flut board) s3-0) - 2 - ) - ((logtest? s3-0 (focus-status dangerous)) - 4 - ) - (else - 5 - ) - ) - ) - ) - ) + (let ((f0-1 (-> v1-1 0 sphere r))) + (set! (-> v1-1 0 sphere quad) (-> s5-0 control trans quad)) + (set! (-> v1-1 0 sphere r) f0-1) + ) + (vector-copy! (-> v1-1 0 velocity) (-> s5-0 control transv)) + (let ((f0-3 (- (-> v1-1 0 danger-level) (* (-> v1-1 0 decay-rate) (seconds-per-frame))))) + (set! (-> v1-1 0 danger-level) (fmax 0.0 f0-3)) + ) + ) + (let ((s3-0 (-> s5-0 focus-status)) + (f30-0 0.0) + (s4-0 (new 'stack-no-clear 'inline-array 'traffic-suppression-box 2)) ) - (when (< 0.0 f30-0) - (let ((s3-1 (new 'stack-no-clear 'array 'collide-shape 40)) - (s2-1 (new 'stack 'traffic-danger-info)) - ) - (set! (-> s2-1 sphere quad) (-> s5-0 control trans quad)) - (set! (-> s2-1 danger-type) (-> s4-0 1 data 16)) - (set! (-> s2-1 sphere r) f30-0) - (vector-copy! (-> s2-1 velocity) (-> s4-0 0 bbox min)) - (let ((gp-1 (fill-actor-list-for-sphere - (-> this object-hash) - (-> s2-1 sphere) - (-> s2-1 velocity) - (-> s2-1 sphere r) - s3-1 - 40 - -1 - ) + (vector-copy! (-> s4-0 0 bbox max) (-> s5-0 control transv)) + (vector-z-quaternion! (the-as vector (-> s4-0 1)) (get-quat s5-0 3)) + (set! (-> s4-0 1 data 16) (the-as uint 3)) + (cond + ((logtest? (focus-status shooting) s3-0) + (vector-float*! (the-as vector (-> s4-0 0)) (the-as vector (-> s4-0 1)) 409600.0) + (set! f30-0 4096.0) + (set! (-> s4-0 1 data 16) (the-as uint 0)) + 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)) + ) + ) + ) + ) + (vector-float*! (the-as vector (-> s4-0 0)) (the-as vector (-> s4-0 1)) 163840.0) + (set! f30-0 8192.0) + (set! (-> s4-0 1 data 16) (the-as uint 1)) + ) + ((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))) + (set! f30-0 20480.0) + ) + ) + (set! (-> s4-0 1 data 16) (the-as uint (cond + ((logtest? (focus-status pilot) s3-0) + 3 + ) + ((logtest? (focus-status flut board) s3-0) + 2 + ) + ((logtest? s3-0 (focus-status dangerous)) + 4 + ) + (else + 5 + ) + ) + ) + ) + ) + ) + (when (< 0.0 f30-0) + (let ((s3-1 (new 'stack-no-clear 'array 'collide-shape 40)) + (s2-1 (new 'stack 'traffic-danger-info)) + ) + (set! (-> s2-1 sphere quad) (-> s5-0 control trans quad)) + (set! (-> s2-1 danger-type) (-> s4-0 1 data 16)) + (set! (-> s2-1 sphere r) f30-0) + (vector-copy! (-> s2-1 velocity) (-> s4-0 0 bbox min)) + (let ((gp-1 (fill-actor-list-for-sphere + (-> this object-hash) + (-> s2-1 sphere) + (-> s2-1 velocity) + (-> s2-1 sphere r) + s3-1 + 40 + -1 ) - ) - (dotimes (s5-1 gp-1) - (let ((a0-52 (as-type (-> s3-1 s5-1) citizen))) - (if a0-52 - (send-event (the-as process-tree a0-52) 'clear-path s2-1) ) - ) + ) + (dotimes (s5-1 gp-1) + (let ((a0-52 (as-type (-> s3-1 s5-1) citizen))) + (if a0-52 + (send-event (the-as process-tree a0-52) 'clear-path s2-1) + ) ) ) ) @@ -1093,9 +1069,9 @@ ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod update-danger ((this traffic-engine)) 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 abcc9f0c69..859a87cbbd 100644 --- a/goal_src/jak3/levels/city/traffic/vehicle/vehicle-control.gc +++ b/goal_src/jak3/levels/city/traffic/vehicle/vehicle-control.gc @@ -96,61 +96,38 @@ ) (defmethod vehicle-controller-method-20 ((this vehicle-controller) (arg0 vector) (arg1 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (set! (-> this max-turn-speed) (sqrtf (* (fmax 16384.0 arg1) (-> this turn-accel)))) - (let ((v1-1 (new 'stack-no-clear 'inline-array 'vector 2))) - (vector-! (-> v1-1 1) (-> this turn-exit-point) arg0) - (vector-copy! (-> v1-1 0) (-> this turn-exit-dir)) - (set! (-> v1-1 0 x) (-> this turn-exit-dir z)) - (set! (-> v1-1 0 z) (- (-> this turn-exit-dir x))) - (logior! (-> this flags) (vehicle-controller-flag left-turn)) - (when (< 0.0 (vector-dot (-> v1-1 1) (-> v1-1 0))) - (logclear! (-> this flags) (vehicle-controller-flag left-turn)) - (vector-float*! (-> v1-1 0) (-> v1-1 0) -1.0) - ) - (let ((a1-6 (-> this dest-circle))) - (let ((a0-12 (-> this turn-exit-point))) - (let ((v1-2 (-> v1-1 0))) - (let ((a3-3 arg1)) - (.mov vf7 a3-3) - ) - (.lvf vf5 (&-> v1-2 quad)) - ) - (.lvf vf4 (&-> a0-12 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-6 quad) vf6) - ) + (set! (-> this max-turn-speed) (sqrtf (* (fmax 16384.0 arg1) (-> this turn-accel)))) + (let ((v1-1 (new 'stack-no-clear 'inline-array 'vector 2))) + (vector-! (-> v1-1 1) (-> this turn-exit-point) arg0) + (vector-copy! (-> v1-1 0) (-> this turn-exit-dir)) + (set! (-> v1-1 0 x) (-> this turn-exit-dir z)) + (set! (-> v1-1 0 z) (- (-> this turn-exit-dir x))) + (logior! (-> this flags) (vehicle-controller-flag left-turn)) + (when (< 0.0 (vector-dot (-> v1-1 1) (-> v1-1 0))) + (logclear! (-> this flags) (vehicle-controller-flag left-turn)) + (vector-float*! (-> v1-1 0) (-> v1-1 0) -1.0) ) - (set! (-> this dest-circle w) arg1) - 0 - (vehicle-controller-method-16 this (-> this path-prev-point) (-> this turn-enter-point)) - (vector-copy! (-> this target-point) (-> this turn-enter-point)) - (vector-! (-> this turn-enter-dir) (-> this turn-enter-point) (-> this path-prev-point)) - (set! (-> this turn-enter-dir y) 0.0) - (vector-normalize! (-> this turn-enter-dir) 1.0) - (let ((f0-12 (cos 8192.0)) - (f30-0 (vector-dot (-> this turn-enter-dir) (-> this turn-exit-dir))) - ) - (set! (-> this max-turn-speed) - (* (-> this max-turn-speed) (+ 1.0 (fmax 0.0 (/ (- f30-0 f0-12) (- 1.0 f0-12))))) - ) - (if (>= f30-0 (cos 1820.4445)) - (set! (-> this max-turn-speed) 409600.0) - ) - ) - 0 - (none) + (vector+*! (-> this dest-circle) (-> this turn-exit-point) (-> v1-1 0) arg1) ) + (set! (-> this dest-circle w) arg1) + 0 + (vehicle-controller-method-16 this (-> this path-prev-point) (-> this turn-enter-point)) + (vector-copy! (-> this target-point) (-> this turn-enter-point)) + (vector-! (-> this turn-enter-dir) (-> this turn-enter-point) (-> this path-prev-point)) + (set! (-> this turn-enter-dir y) 0.0) + (vector-normalize! (-> this turn-enter-dir) 1.0) + (let ((f0-12 (cos 8192.0)) + (f30-0 (vector-dot (-> this turn-enter-dir) (-> this turn-exit-dir))) + ) + (set! (-> this max-turn-speed) + (* (-> this max-turn-speed) (+ 1.0 (fmax 0.0 (/ (- f30-0 f0-12) (- 1.0 f0-12))))) + ) + (if (>= f30-0 (cos 1820.4445)) + (set! (-> this max-turn-speed) 409600.0) + ) + ) + 0 + (none) ) (defmethod vehicle-controller-method-19 ((this vehicle-controller) (arg0 vector) (arg1 object) (arg2 vector) (arg3 vector)) @@ -255,74 +232,37 @@ ) (defmethod vehicle-controller-method-16 ((this vehicle-controller) (arg0 vector) (arg1 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (new 'stack-no-clear 'inline-array 'vector 2))) - (vector-! (-> s4-0 0) (-> this dest-circle) arg0) - (set! (-> s4-0 0 y) 0.0) - (let* ((v1-1 (-> s4-0 0)) - (f30-0 (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z))))) - (f28-0 (-> this dest-circle w)) - ) - (vector-xz-normalize! (-> s4-0 0) 1.0) - (set! (-> s4-0 1 x) (-> s4-0 0 z)) - (set! (-> s4-0 1 y) 0.0) - (set! (-> s4-0 1 z) (- (-> s4-0 0 x))) - (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)))) - (f0-15 (/ (* f28-0 f1-6) f30-0)) - ) - (let ((f1-9 (/ (* f1-6 f1-6) f30-0))) - (vector-copy! arg1 arg0) - (let ((a1-5 arg1)) - (let ((v1-12 arg1)) - (let ((a0-5 (-> s4-0 0))) - (let ((a2-1 f1-9)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-5 quad)) - ) - (.lvf vf4 (&-> v1-12 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-5 quad) vf6) - ) - ) - (let ((a0-6 arg1)) - (let ((v1-13 arg1)) - (let ((a1-6 (-> s4-0 1))) - (let ((a2-2 f0-15)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a1-6 quad)) - ) - (.lvf vf4 (&-> v1-13 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-6 quad) vf6) - ) + (let ((s4-0 (new 'stack-no-clear 'inline-array 'vector 2))) + (vector-! (-> s4-0 0) (-> this dest-circle) arg0) + (set! (-> s4-0 0 y) 0.0) + (let* ((v1-1 (-> s4-0 0)) + (f30-0 (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z))))) + (f28-0 (-> this dest-circle w)) + ) + (vector-xz-normalize! (-> s4-0 0) 1.0) + (set! (-> s4-0 1 x) (-> s4-0 0 z)) + (set! (-> s4-0 1 y) 0.0) + (set! (-> s4-0 1 z) (- (-> s4-0 0 x))) + (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)))) + (f0-15 (/ (* f28-0 f1-6) f30-0)) + ) + (let ((f1-9 (/ (* f1-6 f1-6) f30-0))) + (vector-copy! arg1 arg0) + (vector+*! arg1 arg1 (-> s4-0 0) f1-9) + ) + (vector+*! arg1 arg1 (-> s4-0 1) f0-15) ) ) - (set! (-> arg1 y) (-> this turn-exit-point y)) - 0 - (none) ) + (set! (-> arg1 y) (-> this turn-exit-point y)) + 0 + (none) ) (defmethod vehicle-controller-method-10 ((this vehicle-controller) (arg0 nav-branch)) 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 c783deca3a..ea264af6c5 100644 --- a/goal_src/jak3/levels/city/traffic/vehicle/vehicle-effects.gc +++ b/goal_src/jak3/levels/city/traffic/vehicle/vehicle-effects.gc @@ -327,100 +327,63 @@ ) (defun vehicle-draw-thruster ((arg0 vehicle-particle-common-info) (arg1 vehicle-draw-thruster-params)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vehicle-thruster-work))) - (vector-copy! (-> s5-0 vec2) (-> arg1 trans)) - (quaternion-copy! (-> s5-0 quat1) (-> arg1 quat)) - (quaternion-rotate-local-x! (-> s5-0 quat1) (-> s5-0 quat1) 32768.0) - (quaternion->matrix (the-as matrix (-> s5-0 quat0)) (-> s5-0 quat1)) - (vector-copy! (-> s5-0 vec4) (-> s5-0 vec0)) - (let ((f0-0 (rand-vu-float-range 1.0 1.33))) - (set! (-> s5-0 float0) (* f0-0 (-> arg1 length) (-> arg1 thrust))) - (set! (-> s5-0 float1) (fmin (* (-> arg1 width) f0-0) (/ (-> s5-0 float0) 2))) - ) - (let ((a1-5 (-> s5-0 vec3))) - (let ((v1-4 (-> arg1 trans))) - (let ((a0-9 (-> s5-0 vec4))) - (let ((a2-2 (/ (-> s5-0 float0) 4))) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-9 quad)) - ) - (.lvf vf4 (&-> v1-4 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-5 quad) vf6) - ) - (quad-copy! (the-as pointer (-> s5-0 glow)) (the-as pointer (-> arg0 thruster-glow-template)) 4) - (let* ((v1-5 (-> s5-0 glow)) - (a1-7 (-> s5-0 vec3)) - (f0-5 (-> v1-5 position w)) - ) - (vector-copy! (-> v1-5 position) a1-7) - (set! (-> v1-5 position w) f0-5) - ) - 0 - (set! (-> s5-0 glow color y) (rand-vu-float-range 0.0 64.0)) - (set! (-> s5-0 glow color w) (* (-> arg1 fog-fade) (+ (* 16.0 (-> arg1 thrust)) (* 4.0 (rand-vu))))) - (let ((f0-13 (* 4.0 (-> s5-0 float1)))) - (set! (-> s5-0 glow position w) f0-13) - (set! (-> s5-0 glow size-y) f0-13) - (set! (-> s5-0 glow size-probe) (/ f0-13 40)) - ) - (add! *simple-sprite-system* (-> s5-0 glow)) - (let ((v1-15 (-> s5-0 vec3))) - (let ((a0-14 (-> arg1 trans))) - (let ((a1-11 (-> s5-0 vec4))) - (let ((a2-5 (/ (-> s5-0 float0) 2))) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a1-11 quad)) - ) - (.lvf vf4 (&-> a0-14 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-15 quad) vf6) - ) - (set! (-> arg0 part-thruster-x initial-valuef) (-> s5-0 float1)) - (set! (-> arg0 part-spec2 initial-valuef) (-> s5-0 float0)) - (vector-copy! (-> s5-0 vec1) (-> s5-0 vec3)) - (launch-particles - :system (-> arg0 sp-system3d) - (-> arg0 part-thruster) - (the-as matrix (-> s5-0 quat0)) - :origin-is-matrix #t - ) - (quaternion-rotate-local-z! (-> s5-0 quat1) (-> s5-0 quat1) 10922.667) - (quaternion->matrix (the-as matrix (-> s5-0 quat0)) (-> s5-0 quat1)) - (vector-copy! (-> s5-0 vec1) (-> s5-0 vec3)) - (launch-particles - :system (-> arg0 sp-system3d) - (-> arg0 part-thruster) - (the-as matrix (-> s5-0 quat0)) - :origin-is-matrix #t - ) - (quaternion-rotate-local-z! (-> s5-0 quat1) (-> s5-0 quat1) 10922.667) - (quaternion->matrix (the-as matrix (-> s5-0 quat0)) (-> s5-0 quat1)) - (vector-copy! (-> s5-0 vec1) (-> s5-0 vec3)) - (launch-particles - :system (-> arg0 sp-system3d) - (-> arg0 part-thruster) - (the-as matrix (-> s5-0 quat0)) - :origin-is-matrix #t - ) + (let ((s5-0 (new 'stack-no-clear 'vehicle-thruster-work))) + (vector-copy! (-> s5-0 vec2) (-> arg1 trans)) + (quaternion-copy! (-> s5-0 quat1) (-> arg1 quat)) + (quaternion-rotate-local-x! (-> s5-0 quat1) (-> s5-0 quat1) 32768.0) + (quaternion->matrix (the-as matrix (-> s5-0 quat0)) (-> s5-0 quat1)) + (vector-copy! (-> s5-0 vec4) (-> s5-0 vec0)) + (let ((f0-0 (rand-vu-float-range 1.0 1.33))) + (set! (-> s5-0 float0) (* f0-0 (-> arg1 length) (-> arg1 thrust))) + (set! (-> s5-0 float1) (fmin (* (-> arg1 width) f0-0) (/ (-> s5-0 float0) 2))) + ) + (vector+*! (-> s5-0 vec3) (-> arg1 trans) (-> s5-0 vec4) (/ (-> s5-0 float0) 4)) + (quad-copy! (the-as pointer (-> s5-0 glow)) (the-as pointer (-> arg0 thruster-glow-template)) 4) + (let* ((v1-5 (-> s5-0 glow)) + (a1-8 (-> s5-0 vec3)) + (f0-5 (-> v1-5 position w)) + ) + (vector-copy! (-> v1-5 position) a1-8) + (set! (-> v1-5 position w) f0-5) ) 0 - (none) + (set! (-> s5-0 glow color y) (rand-vu-float-range 0.0 64.0)) + (set! (-> s5-0 glow color w) (* (-> arg1 fog-fade) (+ (* 16.0 (-> arg1 thrust)) (* 4.0 (rand-vu))))) + (let ((f0-13 (* 4.0 (-> s5-0 float1)))) + (set! (-> s5-0 glow position w) f0-13) + (set! (-> s5-0 glow size-y) f0-13) + (set! (-> s5-0 glow size-probe) (/ f0-13 40)) + ) + (add! *simple-sprite-system* (-> s5-0 glow)) + (vector+*! (-> s5-0 vec3) (-> arg1 trans) (-> s5-0 vec4) (/ (-> s5-0 float0) 2)) + (set! (-> arg0 part-thruster-x initial-valuef) (-> s5-0 float1)) + (set! (-> arg0 part-spec2 initial-valuef) (-> s5-0 float0)) + (vector-copy! (-> s5-0 vec1) (-> s5-0 vec3)) + (launch-particles + :system (-> arg0 sp-system3d) + (-> arg0 part-thruster) + (the-as matrix (-> s5-0 quat0)) + :origin-is-matrix #t + ) + (quaternion-rotate-local-z! (-> s5-0 quat1) (-> s5-0 quat1) 10922.667) + (quaternion->matrix (the-as matrix (-> s5-0 quat0)) (-> s5-0 quat1)) + (vector-copy! (-> s5-0 vec1) (-> s5-0 vec3)) + (launch-particles + :system (-> arg0 sp-system3d) + (-> arg0 part-thruster) + (the-as matrix (-> s5-0 quat0)) + :origin-is-matrix #t + ) + (quaternion-rotate-local-z! (-> s5-0 quat1) (-> s5-0 quat1) 10922.667) + (quaternion->matrix (the-as matrix (-> s5-0 quat0)) (-> s5-0 quat1)) + (vector-copy! (-> s5-0 vec1) (-> s5-0 vec3)) + (launch-particles + :system (-> arg0 sp-system3d) + (-> arg0 part-thruster) + (the-as matrix (-> s5-0 quat0)) + :origin-is-matrix #t + ) ) + 0 + (none) ) 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 55cee93121..3a6a72965d 100644 --- a/goal_src/jak3/levels/city/traffic/vehicle/vehicle-states.gc +++ b/goal_src/jak3/levels/city/traffic/vehicle/vehicle-states.gc @@ -248,92 +248,69 @@ ) (defbehavior vehicle-explode-post vehicle () - (local-vars (v1-42 float) (v1-47 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (set! (-> self camera-dist2) (vector-vector-distance-squared (-> self root trans) (camera-pos))) - (set! (-> self player-dist2) (vector-vector-distance-squared (-> self root trans) (target-pos 0))) - (cond - ((logtest? (-> self draw status) (draw-control-status on-screen)) - (set! (-> self offscreen-time) (the-as uint (current-time))) - ) - (else - (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)) + (set! (-> self camera-dist2) (vector-vector-distance-squared (-> self root trans) (camera-pos))) + (set! (-> self player-dist2) (vector-vector-distance-squared (-> self root trans) (target-pos 0))) + (cond + ((logtest? (-> self draw status) (draw-control-status on-screen)) + (set! (-> self offscreen-time) (the-as uint (current-time))) + ) + (else + (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)) + ) + ) + (go-virtual die) + ) + ) + ) + ) + (let ((f0-5 819200.0)) + (if (< (* f0-5 f0-5) (-> 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))) ) ) - (go-virtual die) - ) - ) - ) - ) - (let ((f0-5 819200.0)) - (if (< (* f0-5 f0-5) (-> 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))) - ) - (.lvf vf1 (&-> (-> self 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-42 vf1) - (if (and (< v1-42 f0-13) (begin - (.lvf vf1 (&-> (-> self rbody lin-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-47 vf1) - (let ((f1-9 v1-47) - (f2-0 614.4) - ) - (< f1-9 (* f0-13 (* f2-0 f2-0))) - ) - ) - ) - (logclear! (-> self v-flags) (vehicle-flag disturbed)) - ) - ) - ) - (when (not (vehicle-method-102 self)) - (disable-physics! self) - (let ((gp-2 (-> self rbody))) - (logclear! (-> gp-2 flags) (rigid-body-flag enable-physics active)) - (vehicle-method-142 self) - (set! (-> gp-2 force quad) (the-as uint128 0)) - (set! (-> gp-2 torque quad) (the-as uint128 0)) - ) - 0 - (logior! (-> self v-flags) (vehicle-flag nav-spheres)) - (vehicle-method-140 self) + (logclear! (-> self v-flags) (vehicle-flag disturbed)) + ) ) ) - (else - (rigid-body-object-method-30 self) - ) + (when (not (vehicle-method-102 self)) + (disable-physics! self) + (let ((gp-2 (-> self rbody))) + (logclear! (-> gp-2 flags) (rigid-body-flag enable-physics active)) + (vehicle-method-142 self) + (set! (-> gp-2 force quad) (the-as uint128 0)) + (set! (-> gp-2 torque quad) (the-as uint128 0)) + ) + 0 + (logior! (-> self v-flags) (vehicle-flag nav-spheres)) + (vehicle-method-140 self) + ) + ) + (else + (rigid-body-object-method-30 self) ) - 0 - (none) ) + 0 + (none) ) (defstate explode (vehicle) 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 bf97e8bbe0..c27fe120a5 100644 --- a/goal_src/jak3/levels/city/traffic/vehicle/vehicle-util.gc +++ b/goal_src/jak3/levels/city/traffic/vehicle/vehicle-util.gc @@ -1122,48 +1122,25 @@ ) (defmethod vehicle-method-103 ((this vehicle)) - (local-vars (v1-8 float) (v1-13 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 (and (< v1-8 f0-1) (begin - (.lvf vf1 (&-> (-> this rbody lin-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-13 vf1) - (let ((f1-4 v1-13) - (f2-0 614.4) - ) - (< f1-4 (* f0-1 (* f2-0 f2-0))) - ) - ) + (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))) + ) + (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))) ) - (logclear! (-> this v-flags) (vehicle-flag disturbed)) - (vehicle-method-142 this) - ) + ) + (logclear! (-> this v-flags) (vehicle-flag disturbed)) + (vehicle-method-142 this) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod vehicle-method-79 ((this vehicle)) diff --git a/goal_src/jak3/levels/city/traffic/vehicle/vehicle.gc b/goal_src/jak3/levels/city/traffic/vehicle/vehicle.gc index 4e8aea956e..7e719ff766 100644 --- a/goal_src/jak3/levels/city/traffic/vehicle/vehicle.gc +++ b/goal_src/jak3/levels/city/traffic/vehicle/vehicle.gc @@ -39,137 +39,122 @@ ) (defmethod on-impact ((this vehicle) (arg0 rigid-body-impact)) - (local-vars (v1-79 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) + (logior! (-> this v-flags) (vehicle-flag impact)) + (vector-copy! (-> this impact-pos) (-> arg0 point)) + (let ((s4-0 (new 'stack-no-clear 'matrix))) + (matrix-inverse-of-rot-trans! (the-as matrix (-> s4-0 rvec)) (-> this rbody matrix)) + (vector-matrix*! (-> this impact-local-pos) (-> this impact-pos) (the-as matrix (-> s4-0 rvec))) + ) + (set! (-> this prev-impact-time) (-> this impact-time)) + (set! (-> this impact-time) (the-as uint (current-time))) + (set! (-> this impact-pat) (the-as uint (-> arg0 pat))) + (set! (-> this impact-proc) (the-as handle #f)) + (let ((a0-5 (-> arg0 process))) + (if a0-5 + (set! (-> this impact-proc) (process->handle a0-5)) + ) + ) + (let ((s4-1 (-> this info)) + (f0-0 1.0) + ) + (let ((v1-14 (-> arg0 prim-id))) + (if (logtest? v1-14 512) + (set! f0-0 (* 1.5 f0-0)) + ) + (if (logtest? v1-14 1024) + (set! f0-0 (* 2.0 f0-0)) + ) + (if (logtest? v1-14 2048) + (set! f0-0 (* 4.0 f0-0)) + ) + (if (logtest? v1-14 256) + (set! f0-0 (/ 1.0 f0-0)) + ) + ) + (let ((f30-0 (* (-> arg0 impulse) f0-0 (-> s4-1 info inv-mass) (-> s4-1 damage inv-toughness-factor)))) + (set! (-> this crash-impulse) (-> arg0 impulse)) + (cond + ((< f30-0 (-> s4-1 damage hit-threshold)) ) - (init-vf0-vector) - (logior! (-> this v-flags) (vehicle-flag impact)) - (vector-copy! (-> this impact-pos) (-> arg0 point)) - (let ((s4-0 (new 'stack-no-clear 'matrix))) - (matrix-inverse-of-rot-trans! (the-as matrix (-> s4-0 rvec)) (-> this rbody matrix)) - (vector-matrix*! (-> this impact-local-pos) (-> this impact-pos) (the-as matrix (-> s4-0 rvec))) - ) - (set! (-> this prev-impact-time) (-> this impact-time)) - (set! (-> this impact-time) (the-as uint (current-time))) - (set! (-> this impact-pat) (the-as uint (-> arg0 pat))) - (set! (-> this impact-proc) (the-as handle #f)) - (let ((a0-5 (-> arg0 process))) - (if a0-5 - (set! (-> this impact-proc) (process->handle a0-5)) + ((>= f30-0 (-> s4-1 damage hit-deadly)) + (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 1)) + 0 + ) + (apply-damage this (* 2.0 (-> s4-1 damage hit-points)) arg0) + (vehicle-method-74 this 2 (seconds 1)) + ) + ((>= f30-0 (-> s4-1 damage hit-big)) + (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) + 0 + ) + (apply-damage this (* 10.0 (-> s4-1 damage impact-damage-factor)) arg0) + (vehicle-method-74 this 1 (seconds 0.25)) + ) + ((>= f30-0 (-> s4-1 damage hit-small)) + (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.25)) + 0 + ) + (apply-damage this (* 5.0 (-> s4-1 damage impact-damage-factor)) arg0) + (vehicle-method-74 this 1 (seconds 0.25)) + ) + (else + (let* ((f0-14 0.0) + (f1-10 40.0) + (f2-0 16384000.0) + (f0-15 (fmax f0-14 (* f1-10 (/ 1.0 f2-0) (- f30-0 (-> s4-1 damage hit-threshold))))) + ) + (apply-damage this (* f0-15 (-> s4-1 damage impact-damage-factor)) arg0) + ) + (when (< 32768.0 f30-0) + (if (logtest? (vehicle-flag player-driving) (-> this v-flags)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.1)) + ) + ) ) - ) - (let ((s4-1 (-> this info)) - (f0-0 1.0) - ) - (let ((v1-14 (-> arg0 prim-id))) - (if (logtest? v1-14 512) - (set! f0-0 (* 1.5 f0-0)) - ) - (if (logtest? v1-14 1024) - (set! f0-0 (* 2.0 f0-0)) - ) - (if (logtest? v1-14 2048) - (set! f0-0 (* 4.0 f0-0)) - ) - (if (logtest? v1-14 256) - (set! f0-0 (/ 1.0 f0-0)) - ) ) - (let ((f30-0 (* (-> arg0 impulse) f0-0 (-> s4-1 info inv-mass) (-> s4-1 damage inv-toughness-factor)))) - (set! (-> this crash-impulse) (-> arg0 impulse)) + (let* ((f0-18 1.0) + (f1-14 61440.0) + (f28-0 (fmin f0-18 (* f30-0 (/ 1.0 f1-14)))) + ) (cond - ((< f30-0 (-> s4-1 damage hit-threshold)) - ) - ((>= f30-0 (-> s4-1 damage hit-deadly)) - (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 1)) - 0 - ) - (apply-damage this (* 2.0 (-> s4-1 damage hit-points)) arg0) - (vehicle-method-74 this 2 (seconds 1)) - ) - ((>= f30-0 (-> s4-1 damage hit-big)) - (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) - 0 - ) - (apply-damage this (* 10.0 (-> s4-1 damage impact-damage-factor)) arg0) - (vehicle-method-74 this 1 (seconds 0.25)) - ) ((>= f30-0 (-> s4-1 damage hit-small)) - (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.25)) + (sound-play-by-name + (-> this info sound impact-sound) + (new-sound-id) + (the int (* 1024.0 f28-0)) 0 + 0 + (sound-group) + #t ) - (apply-damage this (* 5.0 (-> s4-1 damage impact-damage-factor)) arg0) - (vehicle-method-74 this 1 (seconds 0.25)) + (logclear! (-> this v-flags) (vehicle-flag turbo-boost)) ) - (else - (let* ((f0-14 0.0) - (f1-10 40.0) - (f2-0 16384000.0) - (f0-15 (fmax f0-14 (* f1-10 (/ 1.0 f2-0) (- f30-0 (-> s4-1 damage hit-threshold))))) - ) - (apply-damage this (* f0-15 (-> s4-1 damage impact-damage-factor)) arg0) - ) - (when (< 32768.0 f30-0) - (if (logtest? (vehicle-flag player-driving) (-> this v-flags)) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.1)) - ) - ) - ) - ) - (let* ((f0-18 1.0) - (f1-14 61440.0) - (f28-0 (fmin f0-18 (* f30-0 (/ 1.0 f1-14)))) - ) - (cond - ((>= f30-0 (-> s4-1 damage hit-small)) - (sound-play-by-name - (-> this info sound impact-sound) - (new-sound-id) - (the int (* 1024.0 f28-0)) - 0 - 0 - (sound-group) - #t - ) - (logclear! (-> this v-flags) (vehicle-flag turbo-boost)) + ((< 0.1 f28-0) + (sound-play-by-name + (-> this info sound glance-sound) + (new-sound-id) + (the int (* 1024.0 f28-0)) + 0 + 0 + (sound-group) + #t ) - ((< 0.1 f28-0) - (sound-play-by-name - (-> this info sound glance-sound) - (new-sound-id) - (the int (* 1024.0 f28-0)) - 0 - 0 - (sound-group) - #t - ) - ) - ) + ) ) ) ) - (let ((a0-39 (new 'stack-no-clear 'vector))) - (vector+float*! - a0-39 - (-> arg0 velocity) - (-> arg0 normal) - (- (vector-dot (-> arg0 velocity) (-> arg0 normal))) - ) - (.lvf vf1 (&-> a0-39 quad)) + ) + (let ((a0-39 (new 'stack-no-clear 'vector))) + (vector+float*! + a0-39 + (-> arg0 velocity) + (-> arg0 normal) + (- (vector-dot (-> arg0 velocity) (-> arg0 normal))) ) - (.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-79 vf1) - (let ((f0-30 v1-79) + (let ((f0-30 (vector-length-squared a0-39)) (f1-18 12288.0) ) (when (< (* f1-18 f1-18) f0-30) @@ -179,12 +164,12 @@ ) ) ) - (if (>= 0.0 (-> this hit-points)) - (vehicle-method-74 this 2 (seconds 1)) - ) - 0 - (none) ) + (if (>= 0.0 (-> this hit-points)) + (vehicle-method-74 this 2 (seconds 1)) + ) + 0 + (none) ) (defmethod vehicle-method-92 ((this vehicle) (arg0 vehicle-controls)) diff --git a/goal_src/jak3/levels/comb/comb-field.gc b/goal_src/jak3/levels/comb/comb-field.gc index 49aa83e480..606331473a 100644 --- a/goal_src/jak3/levels/comb/comb-field.gc +++ b/goal_src/jak3/levels/comb/comb-field.gc @@ -77,151 +77,112 @@ :virtual #t :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (local-vars (v0-0 object)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (case message - (('on) - (let ((v1-2 (-> self root root-prim))) - (set! (-> v1-2 prim-core collide-as) (-> self root backup-collide-as)) - (set! v0-0 (-> self root backup-collide-with)) - (set! (-> v1-2 prim-core collide-with) (the-as collide-spec v0-0)) - ) - v0-0 + (case message + (('on) + (let ((v1-2 (-> self root root-prim))) + (set! (-> v1-2 prim-core collide-as) (-> self root backup-collide-as)) + (set! v0-0 (-> self root backup-collide-with)) + (set! (-> v1-2 prim-core collide-with) (the-as collide-spec v0-0)) ) - (('off) - (let ((v1-4 (-> self root root-prim))) - (set! (-> v1-4 prim-core collide-as) (collide-spec)) - (set! (-> v1-4 prim-core collide-with) (collide-spec)) - ) - 0 + v0-0 + ) + (('off) + (let ((v1-4 (-> self root root-prim))) + (set! (-> v1-4 prim-core collide-as) (collide-spec)) + (set! (-> v1-4 prim-core collide-with) (collide-spec)) ) - (('attack) - (let ((v1-5 (the-as attack-info (-> block param 1)))) - (when (!= (-> v1-5 id) (-> self incoming-attack-id)) - (set! (-> self incoming-attack-id) (-> v1-5 id)) - (let ((s4-0 (as-type proc process-drawable))) - (when s4-0 - (let ((gp-1 (process-spawn - manipy - :init manipy-init - (-> (the-as process-drawable s4-0) root trans) - (-> self entity) - (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer level) #f)) - #f - 0 - :name "manipy" - :to self - :stack-size #x20000 - ) + 0 + ) + (('attack) + (let ((v1-5 (the-as attack-info (-> block param 1)))) + (when (!= (-> v1-5 id) (-> self incoming-attack-id)) + (set! (-> self incoming-attack-id) (-> v1-5 id)) + (let ((s4-0 (as-type proc process-drawable))) + (when s4-0 + (let ((gp-1 (process-spawn + manipy + :init manipy-init + (-> (the-as process-drawable s4-0) root trans) + (-> self entity) + (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 ) - ) - (when gp-1 - (send-event (ppointer->process gp-1) 'anim-mode 'play1) - (send-event (ppointer->process gp-1) 'speed 1.5) - (send-event (ppointer->process gp-1) 'art-joint-anim "generic-ripples-idle" 0) - (set-vector! (-> (the-as process-drawable (-> gp-1 0)) root scale) 1.0 1.0 1.0 1.0) - (quaternion-rotate-local-x! (-> (the-as process-drawable (-> gp-1 0)) root quat) (-> self root quat) -16384.0) - (let ((v1-43 (-> (the-as process-drawable (-> gp-1 0)) root trans))) - (let ((a0-22 (-> (the-as process-drawable (-> gp-1 0)) root trans))) - (let ((a1-17 *up-vector*)) - (let ((a2-8 8192.0)) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a1-17 quad)) ) - (.lvf vf4 (&-> a0-22 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-43 quad) vf6) - ) - (let ((f0-6 (vector4-dot (-> (the-as process-drawable (-> gp-1 0)) root trans) (the-as vector (-> self plane))))) - (let ((v1-50 (-> (the-as process-drawable (-> gp-1 0)) root trans))) - (let ((a0-26 (-> (the-as process-drawable (-> gp-1 0)) root trans))) - (let ((a1-18 (-> self plane))) - (let ((a2-9 (- f0-6))) - (.mov vf7 a2-9) - ) - (.lvf vf5 (&-> a1-18 quad)) - ) - (.lvf vf4 (&-> a0-26 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-50 quad) vf6) - ) - (let ((v1-53 (-> (the-as process-drawable (-> gp-1 0)) root trans))) - (let ((a0-29 (-> (the-as process-drawable (-> gp-1 0)) root trans))) - (let ((a1-19 (-> self plane))) - (let ((a2-11 (the-as float (if (< 0.0 f0-6) - -2048.0 - 2048.0 - ) - ) - ) - ) - (.mov vf7 a2-11) - ) - (.lvf vf5 (&-> a1-19 quad)) - ) - (.lvf vf4 (&-> a0-29 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-53 quad) vf6) - ) - ) - (send-event (ppointer->process gp-1) 'trans-hook (lambda () #f)) ) + (when gp-1 + (send-event (ppointer->process gp-1) 'anim-mode 'play1) + (send-event (ppointer->process gp-1) 'speed 1.5) + (send-event (ppointer->process gp-1) 'art-joint-anim "generic-ripples-idle" 0) + (set-vector! (-> (the-as process-drawable (-> gp-1 0)) root scale) 1.0 1.0 1.0 1.0) + (quaternion-rotate-local-x! (-> (the-as process-drawable (-> gp-1 0)) root quat) (-> self root quat) -16384.0) + (vector+*! + (-> (the-as process-drawable (-> gp-1 0)) root trans) + (-> (the-as process-drawable (-> gp-1 0)) root trans) + *up-vector* + 8192.0 + ) + (let ((f0-6 (vector4-dot (-> (the-as process-drawable (-> gp-1 0)) root trans) (the-as vector (-> self plane))))) + (vector+*! + (-> (the-as process-drawable (-> gp-1 0)) root trans) + (-> (the-as process-drawable (-> gp-1 0)) root trans) + (the-as vector (-> self plane)) + (- f0-6) + ) + (vector+*! + (-> (the-as process-drawable (-> gp-1 0)) root trans) + (-> (the-as process-drawable (-> gp-1 0)) root trans) + (the-as vector (-> self plane)) + (if (< 0.0 f0-6) + -2048.0 + 2048.0 + ) + ) + ) + (send-event (ppointer->process gp-1) 'trans-hook (lambda () #f)) ) ) ) - (when (zero? (-> self touch-count)) - (+! (-> self touch-count) 1) - (set! (-> self flash) 0.375) - ) - (set! v0-0 (+ (-> self touch-count) 1)) - (set! (-> self touch-count) (the-as int v0-0)) - v0-0 ) + (when (zero? (-> self touch-count)) + (+! (-> self touch-count) 1) + (set! (-> self flash) 0.375) + ) + (set! v0-0 (+ (-> self touch-count) 1)) + (set! (-> self touch-count) (the-as int v0-0)) + v0-0 ) ) - (('touched) - (when (zero? (-> self touch-count)) - (+! (-> self touch-count) 1) - (set! (-> self flash) 0.375) - ) + ) + (('touched) + (when (zero? (-> self touch-count)) (+! (-> self touch-count) 1) - (let ((v1-75 (as-type proc process-focusable))) - (when v1-75 - (let ((gp-4 (as-type (-> (the-as process-drawable v1-75) root) collide-shape))) - (when gp-4 - (if (logtest? (-> (the-as collide-shape gp-4) root-prim prim-core collide-as) (collide-spec jak)) - (on-jak-touch self) - ) - (when (logtest? (-> (the-as collide-shape gp-4) root-prim prim-core collide-as) (collide-spec vehicle-sphere)) - (when (not (-> self breach)) - (sound-play "barrier-cross") - (set! v0-0 #t) - (set! (-> self breach) (the-as symbol v0-0)) - v0-0 - ) + (set! (-> self flash) 0.375) + ) + (+! (-> self touch-count) 1) + (let ((v1-78 (as-type proc process-focusable))) + (when v1-78 + (let ((gp-4 (as-type (-> (the-as process-drawable v1-78) root) collide-shape))) + (when gp-4 + (if (logtest? (-> (the-as collide-shape gp-4) root-prim prim-core collide-as) (collide-spec jak)) + (on-jak-touch self) + ) + (when (logtest? (-> (the-as collide-shape gp-4) root-prim prim-core collide-as) (collide-spec vehicle-sphere)) + (when (not (-> self breach)) + (sound-play "barrier-cross") + (set! v0-0 #t) + (set! (-> self breach) (the-as symbol v0-0)) + v0-0 ) ) ) ) ) ) - ) + ) ) ) :trans (behavior () diff --git a/goal_src/jak3/levels/comb/comb-sentry.gc b/goal_src/jak3/levels/comb/comb-sentry.gc index 926cf13111..6368e64b08 100644 --- a/goal_src/jak3/levels/comb/comb-sentry.gc +++ b/goal_src/jak3/levels/comb/comb-sentry.gc @@ -46,59 +46,37 @@ ) (defmethod projectile-method-25 ((this comb-sentry-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 4236 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 4236 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 4236) a1-0 s5-1 #f) - (set! (-> *part-id-table* 4236 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 4237) s4-0) - (launch-particles (-> *part-id-table* 4238) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f26-0 (/ f30-0 (meters 9))) - (f30-1 (-> *part-id-table* 4239 init-specs 3 initial-valuef)) - (f28-1 (-> *part-id-table* 4239 init-specs 4 initial-valuef)) - ) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 4239 init-specs 3 initial-valuef) (* f26-0 f30-1)) - (set! (-> *part-id-table* 4239 init-specs 4 initial-valuef) (* f26-0 f28-1)) - (launch-particles (-> *part-id-table* 4239) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 4239 init-specs 3 initial-valuef) f30-1) - (set! (-> *part-id-table* 4239 init-specs 4 initial-valuef) f28-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 4236 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 4236 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 4236) a1-0 s5-1 #f) + (set! (-> *part-id-table* 4236 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 4237) s4-1) + (launch-particles (-> *part-id-table* 4238) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f26-0 (/ f30-0 (meters 9))) + (f30-1 (-> *part-id-table* 4239 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 4239 init-specs 4 initial-valuef)) + ) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 4239 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 4239 init-specs 4 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 4239) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 4239 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 4239 init-specs 4 initial-valuef) f28-1) ) - 0 - (none) ) + 0 + (none) ) (defmethod projectile-method-26 ((this comb-sentry-shot)) @@ -440,123 +418,107 @@ ) (defmethod sentry-post ((this comb-sentry)) - (local-vars (v1-25 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (if (and (= (-> this player-vehicle) #f) *target* (focus-test? *target* pilot-riding)) - (set! (-> this player-vehicle) (-> *target* pilot vehicle)) - ) - (set! (-> this should-attack) #f) - (let ((s5-0 (the-as process-focusable (handle->process (-> this player-vehicle))))) - (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)) - ) + (if (and (= (-> this player-vehicle) #f) *target* (focus-test? *target* pilot-riding)) + (set! (-> this player-vehicle) (-> *target* pilot vehicle)) + ) + (set! (-> this should-attack) #f) + (let ((s5-0 (the-as process-focusable (handle->process (-> this player-vehicle))))) + (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)) ) - (set! (-> this should-attack) #t) - ) - (let ((v1-23 (new 'stack-no-clear 'matrix))) - (vector-copy! (-> v1-23 rvec) (-> s5-0 root trans)) - (vector-copy! (-> v1-23 uvec) (-> s5-0 root transv)) - (vector+float*! (-> this target-pos) (-> v1-23 rvec) (-> v1-23 uvec) 0.1) - (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) - (f0-6 (* f0-4 f0-4)) - ) - (.lvf vf1 (&-> v1-24 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-25 vf1) - (if (< f0-6 v1-25) - (set! (-> this target-dist) 4096000.0) - ) - ) + ) + (set! (-> this should-attack) #t) + ) + (let ((v1-23 (new 'stack-no-clear 'matrix))) + (vector-copy! (-> v1-23 rvec) (-> s5-0 root trans)) + (vector-copy! (-> v1-23 uvec) (-> s5-0 root transv)) + (vector+float*! (-> this target-pos) (-> v1-23 rvec) (-> v1-23 uvec) 0.1) + (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)) + (set! (-> this target-dist) 4096000.0) + ) ) ) ) - (if (not (-> this should-attack)) - (set-time! (-> this in-range-time)) - ) - (set! (-> this path-dt) (* 0.00024414062 (- 163840.0 (-> this target-dist)))) - (set! (-> this path-dt) (fmax -8.0 (fmin 8.0 (-> this path-dt)))) - (+! (-> this path-t) (* (-> this path-dt) (seconds-per-frame))) - (set! (-> this path-t) (fmax 0.0 (fmin (-> this path-t) (get-num-segments (-> this path))))) - (if (= (-> this path-t) (get-num-segments (-> this path))) - (go-explode this) - ) - (get-point-in-path! (-> this path) (-> this root trans) (-> this path-t) 'interp) - (let ((s5-1 (new 'stack-no-clear 'inline-array 'vector 5))) - (vector-! (-> s5-1 0) (-> this target-pos) (-> this root trans)) - (vector-normalize! (-> s5-1 0) 1.0) - (vector-copy! (-> s5-1 1) (-> this up-dir)) - (set! (-> s5-1 4 x) (vector-dot (-> s5-1 0) (-> s5-1 1))) - (vector+float*! (-> s5-1 1) (-> s5-1 1) (-> s5-1 0) (- (-> s5-1 4 x))) - (vector-normalize! (-> s5-1 1) 1.0) - (vector-copy! (-> this up-dir) (-> s5-1 1)) - (forward-up-nopitch->quaternion (the-as quaternion (-> s5-1 2)) (-> s5-1 0) (-> s5-1 1)) - (+! (-> this angle) (* (-> this spin) (seconds-per-frame))) - (set! (-> this angle) (the float (sar (shl (the int (-> this angle)) 48) 48))) - (quaternion-axis-angle! (the-as quaternion (-> s5-1 3)) 0.0 0.0 1.0 (-> this angle)) - (quaternion*! (the-as quaternion (-> s5-1 2)) (the-as quaternion (-> s5-1 2)) (the-as quaternion (-> s5-1 3))) - (quaternion-copy! (-> this root quat) (the-as quaternion (-> s5-1 2))) - ) - (cond - ((-> this shooting) - (seek! (-> this spin) 131072.0 (* 262144.0 (seconds-per-frame))) - (when (time-elapsed? (-> this shot-time) (seconds 0.2)) - (set-time! (-> this shot-time)) - (fire-shot this) - ) - (when (or (time-elapsed? (-> this attack-time) (seconds 1)) (not (-> this should-attack))) - (set-time! (-> this attack-time)) - (set! (-> this shooting) #f) - ) - ) - (else - (seek! (-> this spin) 32768.0 (* 65536.0 (seconds-per-frame))) - (when (and (time-elapsed? (-> this attack-time) (seconds 3)) - (time-elapsed? (-> this in-range-time) (seconds 4)) - (-> this should-attack) - ) - (set-time! (-> this attack-time)) - (set! (-> this shooting) #t) - ) - ) - ) - (cond - ((-> this should-attack) - (if (zero? (-> this hum-id)) - (set! (-> this hum-id) (new-sound-id)) - ) - (sound-play "sentry-engine" :id (-> this hum-id)) - ) - (else - (when (nonzero? (-> this hum-id)) - (sound-stop (-> this hum-id)) - (set! (-> this hum-id) (new 'static 'sound-id)) - 0 - ) - ) - ) - (transform-post) - (draw-glow-sprites this) - 0 - (none) ) + (if (not (-> this should-attack)) + (set-time! (-> this in-range-time)) + ) + (set! (-> this path-dt) (* 0.00024414062 (- 163840.0 (-> this target-dist)))) + (set! (-> this path-dt) (fmax -8.0 (fmin 8.0 (-> this path-dt)))) + (+! (-> this path-t) (* (-> this path-dt) (seconds-per-frame))) + (set! (-> this path-t) (fmax 0.0 (fmin (-> this path-t) (get-num-segments (-> this path))))) + (if (= (-> this path-t) (get-num-segments (-> this path))) + (go-explode this) + ) + (get-point-in-path! (-> this path) (-> this root trans) (-> this path-t) 'interp) + (let ((s5-1 (new 'stack-no-clear 'inline-array 'vector 5))) + (vector-! (-> s5-1 0) (-> this target-pos) (-> this root trans)) + (vector-normalize! (-> s5-1 0) 1.0) + (vector-copy! (-> s5-1 1) (-> this up-dir)) + (set! (-> s5-1 4 x) (vector-dot (-> s5-1 0) (-> s5-1 1))) + (vector+float*! (-> s5-1 1) (-> s5-1 1) (-> s5-1 0) (- (-> s5-1 4 x))) + (vector-normalize! (-> s5-1 1) 1.0) + (vector-copy! (-> this up-dir) (-> s5-1 1)) + (forward-up-nopitch->quaternion (the-as quaternion (-> s5-1 2)) (-> s5-1 0) (-> s5-1 1)) + (+! (-> this angle) (* (-> this spin) (seconds-per-frame))) + (set! (-> this angle) (the float (sar (shl (the int (-> this angle)) 48) 48))) + (quaternion-axis-angle! (the-as quaternion (-> s5-1 3)) 0.0 0.0 1.0 (-> this angle)) + (quaternion*! (the-as quaternion (-> s5-1 2)) (the-as quaternion (-> s5-1 2)) (the-as quaternion (-> s5-1 3))) + (quaternion-copy! (-> this root quat) (the-as quaternion (-> s5-1 2))) + ) + (cond + ((-> this shooting) + (seek! (-> this spin) 131072.0 (* 262144.0 (seconds-per-frame))) + (when (time-elapsed? (-> this shot-time) (seconds 0.2)) + (set-time! (-> this shot-time)) + (fire-shot this) + ) + (when (or (time-elapsed? (-> this attack-time) (seconds 1)) (not (-> this should-attack))) + (set-time! (-> this attack-time)) + (set! (-> this shooting) #f) + ) + ) + (else + (seek! (-> this spin) 32768.0 (* 65536.0 (seconds-per-frame))) + (when (and (time-elapsed? (-> this attack-time) (seconds 3)) + (time-elapsed? (-> this in-range-time) (seconds 4)) + (-> this should-attack) + ) + (set-time! (-> this attack-time)) + (set! (-> this shooting) #t) + ) + ) + ) + (cond + ((-> this should-attack) + (if (zero? (-> this hum-id)) + (set! (-> this hum-id) (new-sound-id)) + ) + (sound-play "sentry-engine" :id (-> this hum-id)) + ) + (else + (when (nonzero? (-> this hum-id)) + (sound-stop (-> this hum-id)) + (set! (-> this hum-id) (new 'static 'sound-id)) + 0 + ) + ) + ) + (transform-post) + (draw-glow-sprites this) + 0 + (none) ) (defmethod go-explode ((this comb-sentry)) diff --git a/goal_src/jak3/levels/comb/h-sled.gc b/goal_src/jak3/levels/comb/h-sled.gc index 857219ba45..1abc1abf1c 100644 --- a/goal_src/jak3/levels/comb/h-sled.gc +++ b/goal_src/jak3/levels/comb/h-sled.gc @@ -120,55 +120,40 @@ ) (defun sled-find-mesh-dir ((arg0 vector) (arg1 vector) (arg2 collide-tri-result)) - (local-vars (a0-8 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (new 'stack-no-clear 'h-sled-stack-var0))) - (vector-! (-> s4-0 vec 0) (-> arg2 vertex 2) (-> arg2 vertex 1)) - (vector-! (-> s4-0 vec 1) (-> arg2 vertex 0) (-> arg2 vertex 2)) - (vector-! (-> s4-0 vec 2) (-> arg2 vertex 1) (-> arg2 vertex 0)) - (set! (-> s4-0 byte0) -1) - (set! (-> s4-0 float1) -1.0) - (dotimes (v1-5 3) - (.lvf vf1 (&-> (-> s4-0 vec v1-5) 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-8 vf1) - (set! (-> s4-0 float0) a0-8) - (when (< (-> s4-0 float1) (-> s4-0 float0)) - (set! (-> s4-0 float1) (-> s4-0 float0)) - (set! (-> s4-0 byte0) v1-5) - ) + (let ((s4-0 (new 'stack-no-clear 'h-sled-stack-var0))) + (vector-! (-> s4-0 vec 0) (-> arg2 vertex 2) (-> arg2 vertex 1)) + (vector-! (-> s4-0 vec 1) (-> arg2 vertex 0) (-> arg2 vertex 2)) + (vector-! (-> s4-0 vec 2) (-> arg2 vertex 1) (-> arg2 vertex 0)) + (set! (-> s4-0 byte0) -1) + (set! (-> s4-0 float1) -1.0) + (dotimes (v1-5 3) + (set! (-> s4-0 float0) (vector-length-squared (-> s4-0 vec v1-5))) + (when (< (-> s4-0 float1) (-> s4-0 float0)) + (set! (-> s4-0 float1) (-> s4-0 float0)) + (set! (-> s4-0 byte0) v1-5) ) - (if (< (-> s4-0 byte0) 2) - (vector-copy! (-> s4-0 vec (-> s4-0 byte0)) (-> s4-0 vec 2)) - ) - (dotimes (s3-0 2) - (let ((s2-0 (-> s4-0 vec1 s3-0))) - (vector-normalize-copy! s2-0 (-> s4-0 vec s3-0) 1.0) - (let ((f0-5 (vector-dot s2-0 arg1))) - (when (< f0-5 0.0) - (vector-float*! s2-0 s2-0 -1.0) - (set! f0-5 (* -1.0 f0-5)) - ) - (if (>= f0-5 0.866) - (vector-copy! arg0 s2-0) - ) + ) + (if (< (-> s4-0 byte0) 2) + (vector-copy! (-> s4-0 vec (-> s4-0 byte0)) (-> s4-0 vec 2)) + ) + (dotimes (s3-0 2) + (let ((s2-0 (-> s4-0 vec1 s3-0))) + (vector-normalize-copy! s2-0 (-> s4-0 vec s3-0) 1.0) + (let ((f0-5 (vector-dot s2-0 arg1))) + (when (< f0-5 0.0) + (vector-float*! s2-0 s2-0 -1.0) + (set! f0-5 (* -1.0 f0-5)) ) + (if (>= f0-5 0.866) + (vector-copy! arg0 s2-0) + ) ) ) ) - 0 - 0 - (none) ) + 0 + 0 + (none) ) (deftype sled-shot (projectile) @@ -194,53 +179,31 @@ ) (defmethod projectile-method-25 ((this sled-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 4231 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 4231 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 4231) a1-0 s5-1 #f) - (set! (-> *part-id-table* 4231 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 4232) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix))) - (/ f30-0 (meters 9)) - (-> *part-id-table* 4233 init-specs 3 initial-valuef) - (-> *part-id-table* 4233 init-specs 4 initial-valuef) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (launch-particles (-> *part-id-table* 4233) s4-1 :origin-is-matrix #t) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 4231 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 4231 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 4231) a1-0 s5-1 #f) + (set! (-> *part-id-table* 4231 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 4232) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix))) + (/ f30-0 (meters 9)) + (-> *part-id-table* 4233 init-specs 3 initial-valuef) + (-> *part-id-table* 4233 init-specs 4 initial-valuef) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (launch-particles (-> *part-id-table* 4233) s4-2 :origin-is-matrix #t) ) - 0 - (none) ) + 0 + (none) ) (defmethod projectile-method-26 ((this sled-shot)) @@ -1275,56 +1238,41 @@ ) (defmethod vehicle-method-77 ((this h-sled)) - (local-vars (v1-10 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds particles) (-> this v-flags)))) - (let ((v1-3 (-> this rbody))) - (cond - ((logtest? (vehicle-flag overturned) (-> this v-flags)) - (if (and (not (logtest? (-> this v-flags) (vehicle-flag in-air))) (< 0.0 (-> v1-3 matrix uvec y))) - (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag overturned)))) - ) - ) - (else - (when (and (logtest? (-> this v-flags) (vehicle-flag in-air)) - (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (< (-> v1-3 matrix uvec y) 0.0) - (let ((v1-9 (-> v1-3 ang-velocity)) - (f1-2 4.0) - ) - (.lvf vf1 (&-> v1-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-10 vf1) - (< v1-10 (* f1-2 f1-2)) - ) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds particles) (-> this v-flags)))) + (let ((v1-3 (-> this rbody))) + (cond + ((logtest? (vehicle-flag overturned) (-> this v-flags)) + (if (and (not (logtest? (-> this v-flags) (vehicle-flag in-air))) (< 0.0 (-> v1-3 matrix uvec y))) + (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag overturned)))) + ) + ) + (else + (when (and (logtest? (-> this v-flags) (vehicle-flag in-air)) + (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (< (-> v1-3 matrix uvec y) 0.0) + (let ((v1-9 (-> v1-3 ang-velocity)) + (f1-2 4.0) + ) + (< (vector-length-squared v1-9) (* f1-2 f1-2)) ) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag overturned) (-> this v-flags)))) - (set-time! (-> this overturned-time)) - ) + ) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag overturned) (-> this v-flags)))) + (set-time! (-> this overturned-time)) ) ) ) - (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) - (when (and (logtest? (-> this controls flags) (vehicle-controls-flag vcf1)) - (time-elapsed? (-> this shoot-time) (the-as time-frame (-> this shoot-delay))) - ) - (set-time! (-> this shoot-time)) - (fire-shot this) - ) - (set! (-> *game-info* health-bar-vehicle) (-> this hit-points)) - ) - ((method-of-type vehicle vehicle-method-77) this) - (none) ) + (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) + (when (and (logtest? (-> this controls flags) (vehicle-controls-flag vcf1)) + (time-elapsed? (-> this shoot-time) (the-as time-frame (-> this shoot-delay))) + ) + (set-time! (-> this shoot-time)) + (fire-shot this) + ) + (set! (-> *game-info* health-bar-vehicle) (-> this hit-points)) + ) + ((method-of-type vehicle vehicle-method-77) this) + (none) ) (defmethod vehicle-method-106 ((this h-sled)) @@ -1439,191 +1387,165 @@ ) (defmethod vehicle-method-97 ((this h-sled) (arg0 float) (arg1 vehicle-physics-work)) - (local-vars (v1-59 float) (v1-63 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s3-0 (-> this rbody))) - (mem-copy! (the-as pointer (-> (the-as h-sled-physics-work arg1) mat)) (the-as pointer (-> s3-0 matrix)) 64) - (logior! (-> this v-flags) (vehicle-flag in-air)) - (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) - (vector-reset! (-> this sum-ground-normal)) - (let ((f30-0 (-> this info handling ground-probe-distance)) - (s2-0 (new 'stack-no-clear 'collide-query)) + (let ((s3-0 (-> this rbody))) + (mem-copy! (the-as pointer (-> (the-as h-sled-physics-work arg1) mat)) (the-as pointer (-> s3-0 matrix)) 64) + (logior! (-> this v-flags) (vehicle-flag in-air)) + (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) + (vector-reset! (-> this sum-ground-normal)) + (let ((f30-0 (-> this info handling ground-probe-distance)) + (s2-0 (new 'stack-no-clear 'collide-query)) + ) + (set! (-> (the-as h-sled-physics-work arg1) speed-factor) + (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) ) - (set! (-> (the-as h-sled-physics-work arg1) speed-factor) - (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) + (vector-float*! + (-> (the-as h-sled-physics-work arg1) lift-dir) + (-> (the-as h-sled-physics-work arg1) mat uvec) + -1.0 + ) + (vector-float*! (-> s2-0 move-dist) (-> (the-as h-sled-physics-work arg1) lift-dir) (the-as float f30-0)) + (let ((v1-15 s2-0)) + (set! (-> v1-15 radius) 409.6) + (set! (-> v1-15 collide-with) (collide-spec + backgnd + bot + obstacle + hit-by-player-list + hit-by-others-list + player-list + water + collectable + blocking-plane + pusher + vehicle-mesh-probeable + shield + vehicle-sphere-no-probe + ) ) - (vector-float*! - (-> (the-as h-sled-physics-work arg1) lift-dir) - (-> (the-as h-sled-physics-work arg1) mat uvec) - -1.0 - ) - (vector-float*! (-> s2-0 move-dist) (-> (the-as h-sled-physics-work arg1) lift-dir) (the-as float f30-0)) - (let ((v1-15 s2-0)) - (set! (-> v1-15 radius) 409.6) - (set! (-> v1-15 collide-with) (collide-spec - backgnd - bot - obstacle - hit-by-player-list - hit-by-others-list - player-list - water - collectable - blocking-plane - pusher - vehicle-mesh-probeable - shield - vehicle-sphere-no-probe - ) - ) - (set! (-> v1-15 ignore-process0) #f) - (set! (-> v1-15 ignore-process1) #f) - (set! (-> v1-15 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) - (set! (-> v1-15 action-mask) (collide-action solid)) - ) - (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) - (let ((v1-18 (-> this info physics-model lift-thruster-array s1-0)) - (s0-0 (-> (the-as h-sled-physics-work arg1) probe-work-array s1-0)) - ) - (vector-copy! (-> s0-0 local-pos) (-> v1-18 local-pos)) - (vector-copy! (-> s0-0 local-normal) (-> v1-18 rot)) - (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> (the-as h-sled-physics-work arg1) mat)) - (vector-copy! (-> s0-0 probe-pos) (-> s0-0 world-pos)) - (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) - (vector-reset! (-> s0-0 ground-normal)) - (vector-reset! (-> s0-0 u-dir)) - (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) - (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) - (set! (-> s0-0 probe-uu) (probe-using-line-sphere *collide-cache* s2-0)) - (cond - ((and (>= (-> s0-0 probe-uu) 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) - (logclear! (-> this v-flags) (vehicle-flag in-air)) - (logior! (-> this v-flags) (vehicle-flag on-ground)) - (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) - (vector+! (-> this sum-ground-normal) (-> this sum-ground-normal) (-> s0-0 ground-normal)) - (sled-find-mesh-dir (-> s0-0 u-dir) (-> this path-dir) (-> s2-0 best-other-tri)) - ) - (else - (set! (-> s0-0 probe-uu) 1.0) - ) - ) - (vector+float*! - (-> s0-0 ground-pos) - (-> s0-0 probe-pos) - (-> (the-as h-sled-physics-work arg1) lift-dir) - (the-as float f30-0) - ) - 0 + (set! (-> v1-15 ignore-process0) #f) + (set! (-> v1-15 ignore-process1) #f) + (set! (-> v1-15 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) + (set! (-> v1-15 action-mask) (collide-action solid)) + ) + (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) + (let ((v1-18 (-> this info physics-model lift-thruster-array s1-0)) + (s0-0 (-> (the-as h-sled-physics-work arg1) probe-work-array s1-0)) ) - ) - ) - ) - (vector-copy! (-> this prev-tunnel-dir) (-> this tunnel-dir)) - (vector-reset! (-> this tunnel-dir)) - (dotimes (v1-55 (-> this info physics-model lift-thruster-count)) - (let ((a2-5 (-> (the-as h-sled-physics-work arg1) probe-work-array v1-55))) - (vector+! (-> this tunnel-dir) (-> this tunnel-dir) (-> a2-5 u-dir)) - ) - ) - (let ((f0-9 0.0)) - (.lvf vf1 (&-> (-> this tunnel-dir) 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-59 vf1) - (if (< f0-9 v1-59) - (vector-normalize! (-> this tunnel-dir) 1.0) - (vector-copy! (-> this tunnel-dir) (-> this path-dir)) - ) - ) - (let ((f0-10 0.0)) - (.lvf vf1 (&-> (-> this sum-ground-normal) 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-63 vf1) - (when (< f0-10 v1-63) - (vector-copy! (-> this normal-dir) (-> this sum-ground-normal)) - (vector-normalize! (-> this normal-dir) 1.0) - (vector-float*! (-> this gravity-dir) (-> this normal-dir) -1.0) - (vector-cross! (-> this side-dir) (-> this normal-dir) (-> this tunnel-dir)) - (vector-normalize! (-> this side-dir) 1.0) - ) - ) - (when (logtest? (-> this v-flags) (vehicle-flag on-ground)) - (let ((s2-1 (new 'stack-no-clear 'inline-array 'vector 1))) - (matrix-from-two-vectors! (the-as matrix (-> s2-1 0)) (-> this prev-tunnel-dir) (-> this tunnel-dir)) - (vector-rotate*! (-> s3-0 lin-momentum) (-> s3-0 lin-momentum) (the-as matrix (-> s2-1 0))) - ) - (init-velocities! (-> this rbody)) - ) - (dotimes (s2-2 (-> this info physics-model lift-thruster-count)) - (let ((v1-78 (-> (the-as h-sled-physics-work arg1) probe-work-array s2-2))) - (vector-copy! (-> (the-as h-sled-physics-work arg1) world-pos) (-> v1-78 world-pos)) - (vector-copy! (-> (the-as h-sled-physics-work arg1) velocity) (-> v1-78 velocity)) - (let ((s1-1 (new 'stack-no-clear 'vector))) - (when (< (-> v1-78 probe-uu) 1.0) - (set! (-> s1-1 x) (- 0.5 (-> v1-78 probe-uu))) - (let ((a0-54 (-> (the-as h-sled-physics-work arg1) force)) - (a1-26 (-> v1-78 ground-normal)) - (f0-15 0.5) - (f1-7 arg0) - ) - (vector-float*! - a0-54 - a1-26 - (* f0-15 - (/ 1.0 f1-7) - (-> this info physics-model inv-lift-thruster-count) - (-> this info info mass) - (- (vector-dot (-> (the-as h-sled-physics-work arg1) velocity) (-> v1-78 ground-normal))) - ) - ) - ) - (apply-impact! - s3-0 - (-> (the-as h-sled-physics-work arg1) world-pos) - (-> (the-as h-sled-physics-work arg1) force) - ) - (let ((f0-25 - (* 16.0 - (-> this info info mass) - (-> this info extra gravity) - (-> this info physics-model inv-lift-thruster-count) - (-> s1-1 x) - (-> this info handling spring-lift-factor) - ) - ) - ) - (vector-float*! - (-> (the-as h-sled-physics-work arg1) force) - (-> (the-as h-sled-physics-work arg1) lift-dir) - (* -1.0 f0-25) - ) - ) - (apply-impact! - s3-0 - (-> (the-as h-sled-physics-work arg1) world-pos) - (-> (the-as h-sled-physics-work arg1) force) + (vector-copy! (-> s0-0 local-pos) (-> v1-18 local-pos)) + (vector-copy! (-> s0-0 local-normal) (-> v1-18 rot)) + (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> (the-as h-sled-physics-work arg1) mat)) + (vector-copy! (-> s0-0 probe-pos) (-> s0-0 world-pos)) + (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) + (vector-reset! (-> s0-0 ground-normal)) + (vector-reset! (-> s0-0 u-dir)) + (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) + (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) + (set! (-> s0-0 probe-uu) (probe-using-line-sphere *collide-cache* s2-0)) + (cond + ((and (>= (-> s0-0 probe-uu) 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) + (logclear! (-> this v-flags) (vehicle-flag in-air)) + (logior! (-> this v-flags) (vehicle-flag on-ground)) + (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) + (vector+! (-> this sum-ground-normal) (-> this sum-ground-normal) (-> s0-0 ground-normal)) + (sled-find-mesh-dir (-> s0-0 u-dir) (-> this path-dir) (-> s2-0 best-other-tri)) + ) + (else + (set! (-> s0-0 probe-uu) 1.0) ) ) + (vector+float*! + (-> s0-0 ground-pos) + (-> s0-0 probe-pos) + (-> (the-as h-sled-physics-work arg1) lift-dir) + (the-as float f30-0) + ) + 0 ) ) - 0 ) ) - 0 - (none) + (vector-copy! (-> this prev-tunnel-dir) (-> this tunnel-dir)) + (vector-reset! (-> this tunnel-dir)) + (dotimes (v1-55 (-> this info physics-model lift-thruster-count)) + (let ((a2-5 (-> (the-as h-sled-physics-work arg1) probe-work-array v1-55))) + (vector+! (-> this tunnel-dir) (-> this tunnel-dir) (-> a2-5 u-dir)) + ) + ) + (if (< 0.0 (vector-length-squared (-> this tunnel-dir))) + (vector-normalize! (-> this tunnel-dir) 1.0) + (vector-copy! (-> this tunnel-dir) (-> this path-dir)) + ) + (when (< 0.0 (vector-length-squared (-> this sum-ground-normal))) + (vector-copy! (-> this normal-dir) (-> this sum-ground-normal)) + (vector-normalize! (-> this normal-dir) 1.0) + (vector-float*! (-> this gravity-dir) (-> this normal-dir) -1.0) + (vector-cross! (-> this side-dir) (-> this normal-dir) (-> this tunnel-dir)) + (vector-normalize! (-> this side-dir) 1.0) + ) + (when (logtest? (-> this v-flags) (vehicle-flag on-ground)) + (let ((s2-1 (new 'stack-no-clear 'inline-array 'vector 1))) + (matrix-from-two-vectors! (the-as matrix (-> s2-1 0)) (-> this prev-tunnel-dir) (-> this tunnel-dir)) + (vector-rotate*! (-> s3-0 lin-momentum) (-> s3-0 lin-momentum) (the-as matrix (-> s2-1 0))) + ) + (init-velocities! (-> this rbody)) + ) + (dotimes (s2-2 (-> this info physics-model lift-thruster-count)) + (let ((v1-78 (-> (the-as h-sled-physics-work arg1) probe-work-array s2-2))) + (vector-copy! (-> (the-as h-sled-physics-work arg1) world-pos) (-> v1-78 world-pos)) + (vector-copy! (-> (the-as h-sled-physics-work arg1) velocity) (-> v1-78 velocity)) + (let ((s1-1 (new 'stack-no-clear 'vector))) + (when (< (-> v1-78 probe-uu) 1.0) + (set! (-> s1-1 x) (- 0.5 (-> v1-78 probe-uu))) + (let ((a0-54 (-> (the-as h-sled-physics-work arg1) force)) + (a1-26 (-> v1-78 ground-normal)) + (f0-15 0.5) + (f1-7 arg0) + ) + (vector-float*! + a0-54 + a1-26 + (* f0-15 + (/ 1.0 f1-7) + (-> this info physics-model inv-lift-thruster-count) + (-> this info info mass) + (- (vector-dot (-> (the-as h-sled-physics-work arg1) velocity) (-> v1-78 ground-normal))) + ) + ) + ) + (apply-impact! + s3-0 + (-> (the-as h-sled-physics-work arg1) world-pos) + (-> (the-as h-sled-physics-work arg1) force) + ) + (let ((f0-25 + (* 16.0 + (-> this info info mass) + (-> this info extra gravity) + (-> this info physics-model inv-lift-thruster-count) + (-> s1-1 x) + (-> this info handling spring-lift-factor) + ) + ) + ) + (vector-float*! + (-> (the-as h-sled-physics-work arg1) force) + (-> (the-as h-sled-physics-work arg1) lift-dir) + (* -1.0 f0-25) + ) + ) + (apply-impact! + s3-0 + (-> (the-as h-sled-physics-work arg1) world-pos) + (-> (the-as h-sled-physics-work arg1) force) + ) + ) + ) + ) + 0 + ) ) + 0 + (none) ) (defmethod apply-gravity! ((this h-sled) (arg0 float)) @@ -1852,72 +1774,55 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod vehicle-method-78 ((this h-sled)) - (local-vars (a0-13 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'h-sled-stack-var1))) - (matrix-copy! (-> s5-0 mat) (-> this node-list data 0 bone transform)) - (let ((s4-0 (new 'static 'inline-array vector 8 - (new 'static 'vector :x 6144.0 :y 4096.0 :z -20480.0 :w 1.0) - (new 'static 'vector :x -6144.0 :y 4096.0 :z -20480.0 :w 1.0) - (new 'static 'vector :x 1638.4 :y 4096.0 :z -17203.2 :w 1.0) - (new 'static 'vector :x -1638.4 :y 4096.0 :z -17203.2 :w 1.0) - (new 'static 'vector :x 7782.4 :y 7782.4 :z -12288.0 :w 1.0) - (new 'static 'vector :x -7782.4 :y 7782.4 :z -12288.0 :w 1.0) - (new 'static 'vector :x 11059.2 :y 5734.4 :z -1638.4 :w 1.0) - (new 'static 'vector :x -11059.2 :y 5734.4 :z -1638.4 :w 1.0) - ) + (let ((s5-0 (new 'stack-no-clear 'h-sled-stack-var1))) + (matrix-copy! (-> s5-0 mat) (-> this node-list data 0 bone transform)) + (let ((s4-0 (new 'static 'inline-array vector 8 + (new 'static 'vector :x 6144.0 :y 4096.0 :z -20480.0 :w 1.0) + (new 'static 'vector :x -6144.0 :y 4096.0 :z -20480.0 :w 1.0) + (new 'static 'vector :x 1638.4 :y 4096.0 :z -17203.2 :w 1.0) + (new 'static 'vector :x -1638.4 :y 4096.0 :z -17203.2 :w 1.0) + (new 'static 'vector :x 7782.4 :y 7782.4 :z -12288.0 :w 1.0) + (new 'static 'vector :x -7782.4 :y 7782.4 :z -12288.0 :w 1.0) + (new 'static 'vector :x 11059.2 :y 5734.4 :z -1638.4 :w 1.0) + (new 'static 'vector :x -11059.2 :y 5734.4 :z -1638.4 :w 1.0) ) + ) + ) + (when (logtest? (vehicle-flag ignition) (-> this v-flags)) + (dotimes (s3-0 8) + (quad-copy! + (the-as pointer (-> s5-0 glow)) + (the-as pointer (-> this info particle-common headlight-glow-template)) + 4 ) - (when (logtest? (vehicle-flag ignition) (-> this v-flags)) - (dotimes (s3-0 8) - (quad-copy! - (the-as pointer (-> s5-0 glow)) - (the-as pointer (-> this info particle-common headlight-glow-template)) - 4 - ) - (vector-matrix*! (-> s5-0 vec0) (-> s4-0 s3-0) (-> s5-0 mat)) - (let* ((v1-7 (-> s5-0 glow)) - (a1-3 (-> s5-0 vec0)) - (f0-0 (-> v1-7 position w)) - ) - (vector-copy! (-> v1-7 position) a1-3) - (set! (-> v1-7 position w) f0-0) - ) - 0 - (set! (-> s5-0 glow rot-angle) (* 182.04445 (rand-vu-float-range -17.0 -13.0))) - (set! (-> s5-0 glow color x) 0.0) - (set! (-> s5-0 glow color y) 0.0) - (set! (-> s5-0 glow color z) 255.0) - (set! (-> s5-0 glow color w) (* 2.0 (rand-vu-float-range 16.0 18.0))) - (add! *simple-sprite-system* (-> s5-0 glow)) + (vector-matrix*! (-> s5-0 vec0) (-> s4-0 s3-0) (-> s5-0 mat)) + (let* ((v1-7 (-> s5-0 glow)) + (a1-3 (-> s5-0 vec0)) + (f0-0 (-> v1-7 position w)) + ) + (vector-copy! (-> v1-7 position) a1-3) + (set! (-> v1-7 position w) f0-0) ) + 0 + (set! (-> s5-0 glow rot-angle) (* 182.04445 (rand-vu-float-range -17.0 -13.0))) + (set! (-> s5-0 glow color x) 0.0) + (set! (-> s5-0 glow color y) 0.0) + (set! (-> s5-0 glow color z) 255.0) + (set! (-> s5-0 glow color w) (* 2.0 (rand-vu-float-range 16.0 18.0))) + (add! *simple-sprite-system* (-> s5-0 glow)) ) ) - (when (logtest? (vehicle-flag ignition) (-> this v-flags)) - (dotimes (s4-1 4) - (let ((v1-21 (-> this ground-pos-array s4-1)) - (f0-8 0.0) - ) - (.lvf vf1 (&-> v1-21 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-13 vf1) - (when (< f0-8 a0-13) - (vector-copy! (-> s5-0 mat trans) v1-21) - (spawn-from-mat (-> this parts s4-1) (-> s5-0 mat)) - ) + ) + (when (logtest? (vehicle-flag ignition) (-> this v-flags)) + (dotimes (s4-1 4) + (let ((v1-21 (-> this ground-pos-array s4-1))) + (when (< 0.0 (vector-length-squared v1-21)) + (vector-copy! (-> s5-0 mat trans) v1-21) + (spawn-from-mat (-> this parts s4-1) (-> s5-0 mat)) ) ) ) ) - (none) ) + (none) ) 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 0ba93ae619..1167d2da46 100644 --- a/goal_src/jak3/levels/common/ai/ashelin/ash-shot.gc +++ b/goal_src/jak3/levels/common/ai/ashelin/ash-shot.gc @@ -259,57 +259,35 @@ ) (defmethod projectile-method-25 ((this ashelin-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((v1-1 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) v1-1 a1-0)) + (gp-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8)) ) - (init-vf0-vector) - (let* ((v1-1 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) v1-1 a1-0)) - (gp-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-2 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-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 (&-> gp-0 quad) vf6) - (let ((f30-0 (-> *part-id-table* 900 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 900 init-specs 4 initial-valuef) (fmin f30-0 (vector-length s5-1))) - (draw-beam (-> *part-id-table* 900) a1-0 s5-1 #f) - (set! (-> *part-id-table* 900 init-specs 4 initial-valuef) f30-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 901) gp-0) - (let ((f0-4 (vector-dot s5-1 (-> (camera-matrix) fvec)))) - (when (< 0.0 f0-4) - (let ((f0-5 (* f0-4 f0-4)) - (f30-1 (-> *part-id-table* 902 init-specs 8 initial-valuef)) - (f28-0 (-> *part-id-table* 902 init-specs 8 random-rangef)) - ) - (set! (-> *part-id-table* 902 init-specs 8 initial-valuef) (* f30-1 f0-5)) - (set! (-> *part-id-table* 902 init-specs 8 random-rangef) (* f28-0 f0-5)) - (launch-particles (-> *part-id-table* 902) gp-0) - (set! (-> *part-id-table* 902 init-specs 8 initial-valuef) f30-1) - (set! (-> *part-id-table* 902 init-specs 8 random-rangef) f28-0) - ) + (let ((f30-0 (-> *part-id-table* 900 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 900 init-specs 4 initial-valuef) (fmin f30-0 (vector-length s5-1))) + (draw-beam (-> *part-id-table* 900) a1-0 s5-1 #f) + (set! (-> *part-id-table* 900 init-specs 4 initial-valuef) f30-0) + ) + (vector-normalize! s5-1 1.0) + (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)) + (f30-1 (-> *part-id-table* 902 init-specs 8 initial-valuef)) + (f28-0 (-> *part-id-table* 902 init-specs 8 random-rangef)) + ) + (set! (-> *part-id-table* 902 init-specs 8 initial-valuef) (* f30-1 f0-5)) + (set! (-> *part-id-table* 902 init-specs 8 random-rangef) (* f28-0 f0-5)) + (launch-particles (-> *part-id-table* 902) gp-1) + (set! (-> *part-id-table* 902 init-specs 8 initial-valuef) f30-1) + (set! (-> *part-id-table* 902 init-specs 8 random-rangef) f28-0) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod projectile-method-26 ((this ashelin-shot)) diff --git a/goal_src/jak3/levels/common/ai/ashelin/ash.gc b/goal_src/jak3/levels/common/ai/ashelin/ash.gc index 6df0444bf7..dcb1c59c34 100644 --- a/goal_src/jak3/levels/common/ai/ashelin/ash.gc +++ b/goal_src/jak3/levels/common/ai/ashelin/ash.gc @@ -1230,61 +1230,47 @@ ) (defmethod ashelin-method-248 ((this ashelin) (arg0 vector) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) - (local-vars (v1-23 float) (sv-272 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) + (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)) + (a2-2 (-> v1-0 state mesh bounds)) + (a3-1 (-> v1-0 root-nav-sphere)) + (t0-1 (-> v1-0 sphere-count)) ) - (init-vf0-vector) - (let* ((v1-0 (-> this nav)) - (a0-3 (-> v1-0 state mesh sphere-hash sphere-array)) - (a1-1 (-> v1-0 sphere-id-array)) - (a2-2 (-> v1-0 state mesh bounds)) - (a3-1 (-> v1-0 root-nav-sphere)) - (t0-1 (-> v1-0 sphere-count)) - ) - (dotimes (t1-1 t0-1) - (let ((t3-0 (-> a0-3 (-> a1-1 t1-1))) - (t2-4 (-> v1-0 sphere-array t1-1)) - ) - (vector-! (the-as vector t2-4) (the-as vector t3-0) (the-as vector a2-2)) - (set! (-> t2-4 r) (+ (-> t3-0 r) (-> a3-1 w))) - ) - ) - ) - 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) - (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) - (vector-copy! arg0 (-> s0-0 out-travel 0)) - ) - 0 - (when (>= arg2 (fabs (deg- arg1 (atan (-> arg0 x) (-> arg0 z))))) - (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) - ) - (.lvf vf1 (&-> arg0 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-23 vf1) - (let ((f0-11 v1-23) - (f1-1 arg4) + (dotimes (t1-1 t0-1) + (let ((t3-0 (-> a0-3 (-> a1-1 t1-1))) + (t2-4 (-> v1-0 sphere-array t1-1)) ) - (>= f0-11 (* f1-1 f1-1)) + (vector-! (the-as vector t2-4) (the-as vector t3-0) (the-as vector a2-2)) + (set! (-> t2-4 r) (+ (-> t3-0 r) (-> a3-1 w))) ) ) ) + 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) + (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) + (vector-copy! arg0 (-> s0-0 out-travel 0)) + ) + 0 + (when (>= arg2 (fabs (deg- arg1 (atan (-> arg0 x) (-> arg0 z))))) + (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)) + ) + ) ) (defmethod normalize-heading! ((this ashelin) (arg0 nav-control)) diff --git a/goal_src/jak3/levels/common/ai/bot.gc b/goal_src/jak3/levels/common/ai/bot.gc index d7465b21a7..560765c88b 100644 --- a/goal_src/jak3/levels/common/ai/bot.gc +++ b/goal_src/jak3/levels/common/ai/bot.gc @@ -1506,46 +1506,25 @@ ) (defmethod bot-method-194 ((this bot) (arg0 bot-turn-info) (arg1 process-focusable) (arg2 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (-> this root))) - (quaternion-copy! (-> arg0 src-quat) (-> s5-0 quat)) - (vector-z-quaternion! (-> arg0 facing-dir) (-> s5-0 quat)) - (set! (-> arg0 facing-ry) (atan (-> arg0 facing-dir x) (-> arg0 facing-dir z))) - (vector-copy! (-> arg0 targ-pos) (get-trans arg1 3)) - (set! (-> arg0 targ-ry) - (atan (- (-> arg0 targ-pos x) (-> s5-0 trans x)) (- (-> arg0 targ-pos z) (-> s5-0 trans z))) - ) - (let ((a0-7 (get-transv arg1)) - (a1-6 (-> arg0 predicted-targ-pos)) - ) - (let ((v1-4 (-> arg0 targ-pos))) - (let ((a2-1 arg2)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-7 quad)) - (.lvf vf4 (&-> v1-4 quad)) + (let ((s5-0 (-> this root))) + (quaternion-copy! (-> arg0 src-quat) (-> s5-0 quat)) + (vector-z-quaternion! (-> arg0 facing-dir) (-> s5-0 quat)) + (set! (-> arg0 facing-ry) (atan (-> arg0 facing-dir x) (-> arg0 facing-dir z))) + (vector-copy! (-> arg0 targ-pos) (get-trans arg1 3)) + (set! (-> arg0 targ-ry) + (atan (- (-> arg0 targ-pos x) (-> s5-0 trans x)) (- (-> arg0 targ-pos z) (-> s5-0 trans z))) ) - (.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-6 quad) vf6) - ) - (set! (-> arg0 predicted-targ-ry) (atan - (- (-> arg0 predicted-targ-pos x) (-> s5-0 trans x)) - (- (-> arg0 predicted-targ-pos z) (-> s5-0 trans z)) - ) - ) + (let ((a0-7 (get-transv arg1))) + (vector+*! (-> arg0 predicted-targ-pos) (-> arg0 targ-pos) a0-7 arg2) ) - (set! (-> arg0 ry-diff) (deg- (-> arg0 targ-ry) (-> arg0 facing-ry))) - (set! (-> arg0 predicted-ry-diff) (deg- (-> arg0 predicted-targ-ry) (-> arg0 facing-ry))) + (set! (-> arg0 predicted-targ-ry) (atan + (- (-> arg0 predicted-targ-pos x) (-> s5-0 trans x)) + (- (-> arg0 predicted-targ-pos z) (-> s5-0 trans z)) + ) + ) ) + (set! (-> arg0 ry-diff) (deg- (-> arg0 targ-ry) (-> arg0 facing-ry))) + (set! (-> arg0 predicted-ry-diff) (deg- (-> arg0 predicted-targ-ry) (-> arg0 facing-ry))) ) (defmethod bot-method-220 ((this bot)) @@ -1820,70 +1799,19 @@ ) (defmethod bot-method-193 ((this bot) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((f1-1 (* arg5 arg5)) + (f0-2 (* arg5 f1-1)) ) - (init-vf0-vector) - (let* ((f1-1 (* arg5 arg5)) - (f0-2 (* arg5 f1-1)) - ) - (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) - (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) - (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) - ) - (vector-float*! arg0 arg1 f2-3) - (let ((t2-1 arg0)) - (let ((v1-10 arg0)) - (let ((a0-3 (vector+! (new 'stack-no-clear 'vector) arg1 arg2))) - (let ((a2-1 f3-7)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-3 quad)) - ) - (.lvf vf4 (&-> v1-10 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 (&-> t2-1 quad) vf6) + (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) + (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) + (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) ) - (let ((a2-2 arg0)) - (let ((v1-11 arg0)) - (let ((a0-5 (vector+! (new 'stack-no-clear 'vector) arg3 arg4))) - (let ((a3-2 f1-3)) - (.mov vf7 a3-2) - ) - (.lvf vf5 (&-> a0-5 quad)) - ) - (.lvf vf4 (&-> v1-11 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 ((v1-12 arg0)) - (let ((a0-6 arg0)) - (let ((a1-1 arg3)) - (let ((a2-3 f0-2)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a1-1 quad)) - ) - (.lvf vf4 (&-> a0-6 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-12 quad) vf6) - ) + (vector-float*! arg0 arg1 f2-3) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg1 arg2) f3-7) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg3 arg4) f1-3) ) - 0 - (none) + (vector+*! arg0 arg0 arg3 f0-2) ) + 0 + (none) ) diff --git a/goal_src/jak3/levels/common/enemy/grunt.gc b/goal_src/jak3/levels/common/enemy/grunt.gc index 80827b31df..3247a7c6c0 100644 --- a/goal_src/jak3/levels/common/enemy/grunt.gc +++ b/goal_src/jak3/levels/common/enemy/grunt.gc @@ -1198,53 +1198,38 @@ ) (defmethod grunt-method-196 ((this grunt) (arg0 float)) - (local-vars (v1-5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (get-focus! this))) - (when gp-0 - (let ((v1-3 (get-trans gp-0 0)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (vector-! s4-0 v1-3 (-> this 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-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 ((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)))) - (go (method-of-object this attack)) - ) - ((let ((f0-10 12288.0)) - (< f30-0 (* f0-10 f0-10)) - ) - (go (method-of-object this spin-attack)) - ) + (let ((gp-0 (get-focus! this))) + (when gp-0 + (let ((v1-3 (get-trans gp-0 0)) + (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 ((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)))) + (go (method-of-object this attack)) + ) + ((let ((f0-10 12288.0)) + (< f30-0 (* f0-10 f0-10)) + ) + (go (method-of-object this spin-attack)) + ) ) ) ) ) ) - gp-0 ) + gp-0 ) ) diff --git a/goal_src/jak3/levels/common/enemy/kg-grunt.gc b/goal_src/jak3/levels/common/enemy/kg-grunt.gc index 2e40578e07..2a0114dd02 100644 --- a/goal_src/jak3/levels/common/enemy/kg-grunt.gc +++ b/goal_src/jak3/levels/common/enemy/kg-grunt.gc @@ -1048,53 +1048,38 @@ ) (defmethod go-attack ((this kg-grunt) (arg0 float)) - (local-vars (v1-5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (get-focus! this))) - (when gp-0 - (let ((v1-3 (get-trans gp-0 0)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (vector-! s4-0 v1-3 (-> this 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-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 ((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)))) - (go (method-of-object this attack)) - ) - ((let ((f0-10 12288.0)) - (< f30-0 (* f0-10 f0-10)) - ) - (go (method-of-object this spin-attack)) - ) + (let ((gp-0 (get-focus! this))) + (when gp-0 + (let ((v1-3 (get-trans gp-0 0)) + (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 ((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)))) + (go (method-of-object this attack)) + ) + ((let ((f0-10 12288.0)) + (< f30-0 (* f0-10 f0-10)) + ) + (go (method-of-object this spin-attack)) + ) ) ) ) ) ) - gp-0 ) + gp-0 ) ) diff --git a/goal_src/jak3/levels/common/enemy/mantis.gc b/goal_src/jak3/levels/common/enemy/mantis.gc index b0a7e50e14..254a421037 100644 --- a/goal_src/jak3/levels/common/enemy/mantis.gc +++ b/goal_src/jak3/levels/common/enemy/mantis.gc @@ -906,77 +906,56 @@ (logclear! (-> self flags) (mantis-flag attack1-enabled)) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((t9-0 (-> (method-of-type nav-enemy hostile) trans))) - (if t9-0 - (t9-0) + (let ((t9-0 (-> (method-of-type nav-enemy hostile) trans))) + (if t9-0 + (t9-0) + ) + ) + (let ((gp-0 (handle->process (-> self focus handle)))) + (when gp-0 + (let* ((s4-0 (-> self focus-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) s4-0 (-> self root trans))) + ) + (let ((s2-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable gp-0) 0)))) + (vector+*! s5-1 s5-1 s2-1 (* 2.0 (vector-length (get-transv (the-as process-focusable gp-0))))) ) - ) - (let ((gp-0 (handle->process (-> self focus handle)))) - (when gp-0 - (let* ((s4-0 (-> self focus-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) s4-0 (-> self root trans))) + (let ((f30-1 (vector-length s5-1))) + (when (not (logtest? (-> self flags) (mantis-flag tracked))) + (cond + ((not (time-elapsed? (-> self attack-timer) (seconds 5))) + (if (and (< 73728.0 f30-1) (mantis-method-206 self)) + (go-virtual crawl) + ) + ) + ((< 40960.0 f30-1) + (mantis-method-202 self (the-as process-focusable gp-0) s5-1) ) - (let ((s2-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable gp-0) 0))) - (s1-0 s5-1) - ) - (let ((s3-1 s5-1)) - (let ((v1-14 (* 2.0 (vector-length (get-transv (the-as process-focusable gp-0)))))) - (.mov vf7 v1-14) - ) - (.lvf vf5 (&-> s2-1 quad)) - (.lvf vf4 (&-> s3-1 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 (&-> s1-0 quad) vf6) - ) - (let ((f30-1 (vector-length s5-1))) - (when (not (logtest? (-> self flags) (mantis-flag tracked))) - (cond - ((not (time-elapsed? (-> self attack-timer) (seconds 5))) - (if (and (< 73728.0 f30-1) (mantis-method-206 self)) - (go-virtual crawl) - ) - ) - ((< 40960.0 f30-1) - (mantis-method-202 self (the-as process-focusable gp-0) s5-1) - ) - ) - ) - (when (and (and gp-0 - (not (logtest? (-> (the-as process-focusable gp-0) focus-status) (focus-status disable dead ignore grabbed))) - ) - (and (time-elapsed? (-> self attack-timer) (seconds 5)) (pointing-toward? self s4-0 8192.0) (< f30-1 32768.0)) - ) - (cond - ((< 24576.0 f30-1) - (if (logtest? (-> self flags) (mantis-flag attack1-enabled)) - (go-virtual attack1) - ) - ) - ((< 16384.0 f30-1) - (go-virtual attack0) - ) - ) ) ) - (if (pointing-toward? self s4-0 10922.667) - (mantis-method-199 self) - ) - (if (logtest? (-> self flags) (mantis-flag tracked)) - (mantis-method-204 self (the-as process-focusable gp-0) s5-1) - (mantis-method-203 self (the-as process-focusable gp-0) s5-1) + (when (and (and gp-0 + (not (logtest? (-> (the-as process-focusable gp-0) focus-status) (focus-status disable dead ignore grabbed))) + ) + (and (time-elapsed? (-> self attack-timer) (seconds 5)) (pointing-toward? self s4-0 8192.0) (< f30-1 32768.0)) + ) + (cond + ((< 24576.0 f30-1) + (if (logtest? (-> self flags) (mantis-flag attack1-enabled)) + (go-virtual attack1) + ) + ) + ((< 16384.0 f30-1) + (go-virtual attack0) + ) ) + ) ) + (if (pointing-toward? self s4-0 10922.667) + (mantis-method-199 self) + ) + (if (logtest? (-> self flags) (mantis-flag tracked)) + (mantis-method-204 self (the-as process-focusable gp-0) s5-1) + (mantis-method-203 self (the-as process-focusable gp-0) s5-1) + ) ) ) ) @@ -1349,61 +1328,40 @@ '() ) :code (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (ja-channel-push! 1 (seconds 0.2)) - (until #f - (let ((gp-0 (handle->process (-> self focus handle)))) - (when gp-0 - (let* ((v1-5 (-> self focus-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) v1-5 (-> self root trans))) - ) - (let ((s4-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable gp-0) 0)))) - (if (and (>= (vector-length s5-1) 122880.0) (mantis-method-206 self)) - (go-virtual crawl) - ) - (let ((s2-0 s5-1)) - (let ((s3-1 s5-1)) - (let ((v1-21 (* 0.2 (vector-length (get-transv (the-as process-focusable gp-0)))))) - (.mov vf7 v1-21) - ) - (.lvf vf5 (&-> s4-1 quad)) - (.lvf vf4 (&-> s3-1 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 (&-> s2-0 quad) vf6) - ) - ) - (if (not (or (mantis-method-203 self (the-as process-focusable gp-0) s5-1) (not (mantis-method-206 self)))) + (ja-channel-push! 1 (seconds 0.2)) + (until #f + (let ((gp-0 (handle->process (-> self focus handle)))) + (when gp-0 + (let* ((v1-5 (-> self focus-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) v1-5 (-> self root trans))) + ) + (let ((s4-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable gp-0) 0)))) + (if (and (>= (vector-length s5-1) 122880.0) (mantis-method-206 self)) (go-virtual crawl) ) + (vector+*! s5-1 s5-1 s4-1 (* 0.2 (vector-length (get-transv (the-as process-focusable gp-0))))) ) - (if (and (time-elapsed? (-> self state-time) (-> self reaction-time)) - (>= (the-as int (-> self focus aware)) 3) - (get-focus! self) - ) - (go-hostile self) + (if (not (or (mantis-method-203 self (the-as process-focusable gp-0) s5-1) (not (mantis-method-206 self)))) + (go-virtual crawl) ) ) - ) - (dotimes (gp-1 (rnd-time-frame self (seconds 0.007) (seconds 0.015))) - (ja-no-eval :group! mantis-idle0-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek!)) - ) + (if (and (time-elapsed? (-> self state-time) (-> self reaction-time)) + (>= (the-as int (-> self focus aware)) 3) + (get-focus! self) + ) + (go-hostile self) + ) + ) + ) + (dotimes (gp-1 (rnd-time-frame self (seconds 0.007) (seconds 0.015))) + (ja-no-eval :group! mantis-idle0-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) ) ) - #f ) + #f ) :post nav-enemy-face-focus-post ) @@ -1700,40 +1658,19 @@ ) (defmethod mantis-method-200 ((this mantis)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (handle->process (-> this focus handle)))) - (when s5-0 - (let* ((v1-4 (-> this focus-pos)) - (s4-1 (vector-! (new 'stack-no-clear 'vector) v1-4 (-> this root trans))) - ) - (let ((s2-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable s5-0) 0))) - (s1-0 s4-1) - ) - (let ((s3-1 s4-1)) - (let ((v1-10 (* 0.2 (vector-length (get-transv (the-as process-focusable s5-0)))))) - (.mov vf7 v1-10) - ) - (.lvf vf5 (&-> s2-1 quad)) - (.lvf vf4 (&-> s3-1 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 (&-> s1-0 quad) vf6) - ) - (mantis-method-203 this (the-as process-focusable s5-0) s4-1) + (let ((s5-0 (handle->process (-> this focus handle)))) + (when s5-0 + (let* ((v1-4 (-> this focus-pos)) + (s4-1 (vector-! (new 'stack-no-clear 'vector) v1-4 (-> this root trans))) + ) + (let ((s2-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable s5-0) 0)))) + (vector+*! s4-1 s4-1 s2-1 (* 0.2 (vector-length (get-transv (the-as process-focusable s5-0))))) ) + (mantis-method-203 this (the-as process-focusable s5-0) s4-1) ) ) - (none) ) + (none) ) (defmethod go-stare ((this mantis)) diff --git a/goal_src/jak3/levels/common/enemy/roboguard.gc b/goal_src/jak3/levels/common/enemy/roboguard.gc index 01975d2e01..45884a2f78 100644 --- a/goal_src/jak3/levels/common/enemy/roboguard.gc +++ b/goal_src/jak3/levels/common/enemy/roboguard.gc @@ -1099,67 +1099,44 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (sound-play "robo-explode") - (let ((v1-2 (-> self root root-prim))) - (set! (-> v1-2 prim-core collide-as) (collide-spec)) - (set! (-> v1-2 prim-core collide-with) (collide-spec)) + (sound-play "robo-explode") + (let ((v1-2 (-> self root root-prim))) + (set! (-> v1-2 prim-core collide-as) (collide-spec)) + (set! (-> v1-2 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> self draw status) (draw-control-status no-draw)) + (set! (-> self root root-prim local-sphere w) 491520.0) + (send-event self 'death-start) + (let ((gp-1 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (vector+*! (-> gp-1 fountain-rand-transv-lo) (-> self root trans) *up-vector* 2048.0) + (vector-copy! s5-1 (-> self incoming attack-direction)) + (vector-normalize-copy! (-> gp-1 fountain-rand-transv-lo) s5-1 -20480.0) + (vector-normalize-copy! (-> gp-1 fountain-rand-transv-hi) s5-1 122880.0) ) - 0 - (logior! (-> self draw status) (draw-control-status no-draw)) - (set! (-> self root root-prim local-sphere w) 491520.0) - (send-event self 'death-start) - (let ((gp-1 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (let ((v1-14 (-> gp-1 fountain-rand-transv-lo))) - (let ((a0-8 (-> self root trans))) - (let ((a1-3 *up-vector*)) - (let ((a2-3 2048.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> a0-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 (&-> v1-14 quad) vf6) - ) - (vector-copy! s5-1 (-> self incoming attack-direction)) - (vector-normalize-copy! (-> gp-1 fountain-rand-transv-lo) s5-1 -20480.0) - (vector-normalize-copy! (-> gp-1 fountain-rand-transv-hi) s5-1 122880.0) - ) - (set! (-> gp-1 fountain-rand-transv-lo y) 40960.0) - (set! (-> gp-1 fountain-rand-transv-hi y) 81920.0) - (process-spawn - joint-exploder - (art-group-get-by-name *level* "skel-roboguard-explode" (the-as (pointer level) #f)) - 35 - gp-1 - *roboguard-exploder-params* - :name "joint-exploder" - :to self - :unk 0 - ) + (set! (-> gp-1 fountain-rand-transv-lo y) 40960.0) + (set! (-> gp-1 fountain-rand-transv-hi y) 81920.0) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-roboguard-explode" (the-as (pointer level) #f)) + 35 + gp-1 + *roboguard-exploder-params* + :name "joint-exploder" + :to self + :unk 0 ) - (let ((v1-25 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node roboguard-lod0-jg chest)))) - (cond - ((logtest? (-> *part-group-id-table* 219 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) v1-25) - (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 219)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) v1-25) - (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 219)) - ) + ) + (let ((v1-26 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node roboguard-lod0-jg chest)))) + (cond + ((logtest? (-> *part-group-id-table* 219 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) v1-26) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 219)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) v1-26) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 219)) ) ) ) diff --git a/goal_src/jak3/levels/common/enemy/spyder.gc b/goal_src/jak3/levels/common/enemy/spyder.gc index 686463871f..213f18c626 100644 --- a/goal_src/jak3/levels/common/enemy/spyder.gc +++ b/goal_src/jak3/levels/common/enemy/spyder.gc @@ -725,126 +725,75 @@ ) (defmethod spyder-method-197 ((this spyder)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (let ((v1-0 (-> s5-0 bbox)) - (a0-2 (-> this root trans)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-0 x) 22528.0) - (set! (-> a1-0 y) 22528.0) - (set! (-> a1-0 z) 22528.0) - (set! (-> a1-0 w) 1.0) - (vector-! (-> v1-0 min) a0-2 a1-0) - ) - (let ((v1-2 (-> s5-0 bbox max)) - (a0-4 (-> this root trans)) - (a1-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-1 x) 22528.0) - (set! (-> a1-1 y) 22528.0) - (set! (-> a1-1 z) 22528.0) - (set! (-> a1-1 w) 1.0) - (vector+! v1-2 a0-4 a1-1) - ) - (set! (-> s5-0 collide-with) (collide-spec backgnd)) - (set! (-> s5-0 ignore-process0) #f) - (set! (-> s5-0 ignore-process1) #f) - (set! (-> s5-0 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (fill-using-bounding-box *collide-cache* s5-0) - (dotimes (s4-0 4) - (-> this joint-ik s4-0 shoulder-matrix-no-ik) - (let ((a2-8 (-> this joint-ik s4-0 elbow-matrix-no-ik)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-15 (new 'stack-no-clear 'vector))) - (vector-copy! v1-15 *y-vector*) - (new 'stack-no-clear 'vector) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (let ((a1-3 s3-0)) - (let ((a0-9 (-> a2-8 trans))) - (let ((a2-9 (-> a2-8 uvec))) - (let ((a3-3 (-> this joint-ik s4-0 hand-dist))) - (.mov vf7 a3-3) - ) - (.lvf vf5 (&-> a2-9 quad)) - ) - (.lvf vf4 (&-> a0-9 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-3 quad) vf6) - ) - (vector-copy! s2-0 s3-0) - (set! (-> s2-0 y) (-> this root trans y)) - (let ((a2-10 (-> s5-0 start-pos))) - (let ((a0-12 s2-0)) - (let ((a1-6 v1-15)) - (let ((a3-5 16384.0)) - (.mov vf7 a3-5) - ) - (.lvf vf5 (&-> a1-6 quad)) - ) - (.lvf vf4 (&-> a0-12 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-10 quad) vf6) - ) - (vector-float*! (-> s5-0 move-dist) v1-15 -32768.0) - (let ((v1-16 s5-0)) - (set! (-> v1-16 radius) 40.96) - (set! (-> v1-16 collide-with) (collide-spec backgnd)) - (set! (-> v1-16 ignore-process0) #f) - (set! (-> v1-16 ignore-process1) #f) - (set! (-> v1-16 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-16 action-mask) (collide-action solid)) - ) - (let ((f0-13 (probe-using-line-sphere *collide-cache* s5-0))) - (when (>= f0-13 0.0) - (let ((a1-10 s2-0)) - (let ((v1-19 (-> s5-0 start-pos))) - (let ((a0-20 (-> s5-0 move-dist))) - (let ((a2-11 f0-13)) - (.mov vf7 a2-11) - ) - (.lvf vf5 (&-> a0-20 quad)) - ) - (.lvf vf4 (&-> v1-19 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-10 quad) vf6) - ) - ) - ) - (let ((f0-15 (fmax -8192.0 (fmin 8192.0 (- (-> s2-0 y) (-> s3-0 y)))))) - (+! (-> this delta-y-ik s4-0) (* 10.0 (seconds-per-frame) (- f0-15 (-> this delta-y-ik s4-0)))) - ) - ) - ) - (+! (-> s3-0 y) (-> this delta-y-ik s4-0)) - (set-ik-target! (-> this joint-ik s4-0) s3-0) + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (let ((v1-0 (-> s5-0 bbox)) + (a0-2 (-> this root trans)) + (a1-0 (new 'stack-no-clear 'vector)) ) + (set! (-> a1-0 x) 22528.0) + (set! (-> a1-0 y) 22528.0) + (set! (-> a1-0 z) 22528.0) + (set! (-> a1-0 w) 1.0) + (vector-! (-> v1-0 min) a0-2 a1-0) + ) + (let ((v1-2 (-> s5-0 bbox max)) + (a0-4 (-> this root trans)) + (a1-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-1 x) 22528.0) + (set! (-> a1-1 y) 22528.0) + (set! (-> a1-1 z) 22528.0) + (set! (-> a1-1 w) 1.0) + (vector+! v1-2 a0-4 a1-1) + ) + (set! (-> s5-0 collide-with) (collide-spec backgnd)) + (set! (-> s5-0 ignore-process0) #f) + (set! (-> s5-0 ignore-process1) #f) + (set! (-> s5-0 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (fill-using-bounding-box *collide-cache* s5-0) + (dotimes (s4-0 4) + (-> this joint-ik s4-0 shoulder-matrix-no-ik) + (let ((a2-8 (-> this joint-ik s4-0 elbow-matrix-no-ik)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((v1-15 (new 'stack-no-clear 'vector))) + (vector-copy! v1-15 *y-vector*) + (new 'stack-no-clear 'vector) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (vector+*! s3-0 (-> a2-8 trans) (-> a2-8 uvec) (-> this joint-ik s4-0 hand-dist)) + (vector-copy! s2-0 s3-0) + (set! (-> s2-0 y) (-> this root trans y)) + (vector+*! (-> s5-0 start-pos) s2-0 v1-15 16384.0) + (vector-float*! (-> s5-0 move-dist) v1-15 -32768.0) + (let ((v1-16 s5-0)) + (set! (-> v1-16 radius) 40.96) + (set! (-> v1-16 collide-with) (collide-spec backgnd)) + (set! (-> v1-16 ignore-process0) #f) + (set! (-> v1-16 ignore-process1) #f) + (set! (-> v1-16 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-16 action-mask) (collide-action solid)) + ) + (let ((f0-13 (probe-using-line-sphere *collide-cache* s5-0))) + (if (>= f0-13 0.0) + (vector+*! s2-0 (-> s5-0 start-pos) (-> s5-0 move-dist) f0-13) + ) + ) + (let ((f0-15 (fmax -8192.0 (fmin 8192.0 (- (-> s2-0 y) (-> s3-0 y)))))) + (+! (-> this delta-y-ik s4-0) (* 10.0 (seconds-per-frame) (- f0-15 (-> this delta-y-ik s4-0)))) + ) + ) + ) + (+! (-> s3-0 y) (-> this delta-y-ik s4-0)) + (set-ik-target! (-> this joint-ik s4-0) s3-0) ) ) - 0 - (none) ) + 0 + (none) ) (defstate hostile (spyder) diff --git a/goal_src/jak3/levels/common/hvehicle/squad-control.gc b/goal_src/jak3/levels/common/hvehicle/squad-control.gc index e2e120d649..67ccc15348 100644 --- a/goal_src/jak3/levels/common/hvehicle/squad-control.gc +++ b/goal_src/jak3/levels/common/hvehicle/squad-control.gc @@ -382,11 +382,8 @@ ;; 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 (v1-40 float) (sv-672 float) (sv-688 vector) (sv-704 int)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) + (local-vars (sv-672 float) (sv-688 vector) (sv-704 int)) + (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) @@ -460,14 +457,7 @@ (if (< 0.0 (-> s2-0 float3)) (vector-float*! (-> s2-0 vec0) (-> s2-0 vec0) (-> s2-0 float3)) ) - (.lvf vf1 (&-> (-> s2-0 vec0) 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-40 vf1) - (let ((f0-17 v1-40) + (let ((f0-17 (vector-length-squared (-> s2-0 vec0))) (f1-4 (/ arg3 2)) ) (when (< (* f1-4 f1-4) f0-17) diff --git a/goal_src/jak3/levels/common/hvehicle/turret-control.gc b/goal_src/jak3/levels/common/hvehicle/turret-control.gc index 1e42afc7a7..db04326384 100644 --- a/goal_src/jak3/levels/common/hvehicle/turret-control.gc +++ b/goal_src/jak3/levels/common/hvehicle/turret-control.gc @@ -176,54 +176,33 @@ ) (defun vehicle-draw-beam ((arg0 sparticle-launcher) (arg1 vector) (arg2 vector) (arg3 object) (arg4 symbol)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((a1-2 (vector+! (new 'stack-no-clear 'vector) arg1 arg2))) - (when (or (not arg4) (line-in-view-frustum? arg1 a1-2)) - (let ((s5-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'quaternion)) - ) - (if (get-field-spec-by-id arg0 (sp-field-id spt-scale-y)) - (set! (-> *beam-info* y-scale) (vector-length arg2)) - ) - (let ((a0-4 s5-0)) - (let ((v1-10 arg2)) - (let ((a1-5 0.5)) - (.mov vf7 a1-5) - ) - (.lvf vf5 (&-> v1-10 quad)) - ) - (.lvf vf4 (&-> arg1 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-4 quad) vf6) + (let ((a1-2 (vector+! (new 'stack-no-clear 'vector) arg1 arg2))) + (when (or (not arg4) (line-in-view-frustum? arg1 a1-2)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'quaternion)) ) - (forward-up->quaternion s4-0 arg2 (new 'static 'vector :y 1.0 :w 1.0)) - (dotimes (s3-1 3) - (quaternion-rotate-local-z! s4-0 s4-0 10922.667) - (quaternion-copy! *particle-quat* s4-0) - (let ((t9-5 sp-launch-particles-var) - (a0-8 *sp-particle-system-3d*) - (a1-9 arg0) - (a2-3 *launch-matrix*) - ) - (vector-copy! (-> a2-3 trans) s5-0) - (t9-5 a0-8 a1-9 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) - ) + (if (get-field-spec-by-id arg0 (sp-field-id spt-scale-y)) + (set! (-> *beam-info* y-scale) (vector-length arg2)) + ) + (vector+*! s5-0 arg1 arg2 0.5) + (forward-up->quaternion s4-0 arg2 (new 'static 'vector :y 1.0 :w 1.0)) + (dotimes (s3-1 3) + (quaternion-rotate-local-z! s4-0 s4-0 10922.667) + (quaternion-copy! *particle-quat* s4-0) + (let ((t9-5 sp-launch-particles-var) + (a0-9 *sp-particle-system-3d*) + (a1-8 arg0) + (a2-3 *launch-matrix*) + ) + (vector-copy! (-> a2-3 trans) s5-0) + (t9-5 a0-9 a1-8 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) ) ) - 0 - (none) ) + 0 + (none) ) (defun vehicle-draw-laser-spot ((arg0 vector) (arg1 vector) (arg2 symbol)) diff --git a/goal_src/jak3/levels/common/race/race-manager.gc b/goal_src/jak3/levels/common/race/race-manager.gc index 1b797b42fc..43be0e8bd8 100644 --- a/goal_src/jak3/levels/common/race/race-manager.gc +++ b/goal_src/jak3/levels/common/race/race-manager.gc @@ -29,45 +29,24 @@ ;; DECOMP BEGINS (defun race-find-ground ((arg0 vector) (arg1 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> s5-0 start-pos) arg1) - (vector-reset! (-> s5-0 move-dist)) - (set! (-> s5-0 move-dist y) -409600.0) - (let ((v1-3 s5-0)) - (set! (-> v1-3 radius) 2048.0) - (set! (-> v1-3 collide-with) (collide-spec backgnd)) - (set! (-> v1-3 ignore-process0) #f) - (set! (-> v1-3 ignore-process1) #f) - (set! (-> v1-3 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-3 action-mask) (collide-action solid)) - ) - (let ((f0-2 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) - (when (>= f0-2 0.0) - (let ((v1-6 (-> s5-0 start-pos))) - (let ((a0-8 (-> s5-0 move-dist))) - (let ((a1-2 f0-2)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-8 quad)) - ) - (.lvf vf4 (&-> v1-6 quad)) + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> s5-0 start-pos) arg1) + (vector-reset! (-> s5-0 move-dist)) + (set! (-> s5-0 move-dist y) -409600.0) + (let ((v1-3 s5-0)) + (set! (-> v1-3 radius) 2048.0) + (set! (-> v1-3 collide-with) (collide-spec backgnd)) + (set! (-> v1-3 ignore-process0) #f) + (set! (-> v1-3 ignore-process1) #f) + (set! (-> v1-3 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> arg0 quad) vf6) - #t - ) + (set! (-> v1-3 action-mask) (collide-action solid)) + ) + (let ((f0-2 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) + (when (>= f0-2 0.0) + (vector+*! arg0 (-> s5-0 start-pos) (-> s5-0 move-dist) f0-2) + #t ) ) ) @@ -209,118 +188,103 @@ ) (defmethod update-lap-distance ((this racer-state) (arg0 race-state)) - (local-vars (a0-29 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'matrix3))) - (-> arg0 info) - (let ((v1-2 (handle->process (-> this racer)))) - (cond - (v1-2 - (if (focus-test? (the-as process-focusable v1-2) dead inactive) - (logior! (-> this flags) (racer-state-flags rsf2)) - ) - (set! (-> s5-0 vector 0 quad) (-> (the-as process-focusable v1-2) root trans quad)) - (when (not (logtest? (-> this flags) (racer-state-flags rsf1 rsf2))) - (let ((s3-0 (new 'stack-no-clear 'race-mesh-slice-query))) - (set! (-> s3-0 search-sphere quad) (-> s5-0 vector 0 quad)) - (set! (-> s3-0 search-sphere r) 0.0) - (race-mesh-method-13 (-> arg0 info mesh) (the-as race-mesh-slice-query (&-> s3-0 slice-id))) - (set! (-> this lap-distance-prev) (-> this lap-distance)) - (cond - ((>= (-> s3-0 slice-id) 0) - (set! (-> this lap-distance) (-> s3-0 lap-dist)) - (if (not (logtest? (-> this flags) (racer-state-flags rsf6))) - (set! (-> this lap-distance-prev) (-> this lap-distance)) - ) - (logior! (-> this flags) (racer-state-flags rsf6)) - ) - (else - (logclear! (-> this flags) (racer-state-flags rsf6)) - ) + (let ((s5-0 (new 'stack-no-clear 'matrix3))) + (-> arg0 info) + (let ((v1-2 (handle->process (-> this racer)))) + (cond + (v1-2 + (if (focus-test? (the-as process-focusable v1-2) dead inactive) + (logior! (-> this flags) (racer-state-flags rsf2)) + ) + (set! (-> s5-0 vector 0 quad) (-> (the-as process-focusable v1-2) root trans quad)) + (when (not (logtest? (-> this flags) (racer-state-flags rsf1 rsf2))) + (let ((s3-0 (new 'stack-no-clear 'race-mesh-slice-query))) + (set! (-> s3-0 search-sphere quad) (-> s5-0 vector 0 quad)) + (set! (-> s3-0 search-sphere r) 0.0) + (race-mesh-method-13 (-> arg0 info mesh) (the-as race-mesh-slice-query (&-> s3-0 slice-id))) + (set! (-> this lap-distance-prev) (-> this lap-distance)) + (cond + ((>= (-> s3-0 slice-id) 0) + (set! (-> this lap-distance) (-> s3-0 lap-dist)) + (if (not (logtest? (-> this flags) (racer-state-flags rsf6))) + (set! (-> this lap-distance-prev) (-> this lap-distance)) + ) + (logior! (-> this flags) (racer-state-flags rsf6)) + ) + (else + (logclear! (-> this flags) (racer-state-flags rsf6)) ) - (cond - ((logtest? (-> arg0 info mesh flags) (race-mesh-flag rmf0)) - (when (>= (-> s3-0 slice-id) 0) - (let ((v1-29 (min 3 (the int (* 4.0 (-> s3-0 lap-dist)))))) - (when (= v1-29 (logand (+ (-> this lap-quadrant) 1) 3)) - (set! (-> this lap-quadrant) v1-29) - (when (zero? v1-29) - (if (logtest? (-> this flags) (racer-state-flags rsf0)) - (end-lap this arg0) - (begin-race arg0) - ) - (begin-lap this arg0) - ) + ) + (cond + ((logtest? (-> arg0 info mesh flags) (race-mesh-flag rmf0)) + (when (>= (-> s3-0 slice-id) 0) + (let ((v1-29 (min 3 (the int (* 4.0 (-> s3-0 lap-dist)))))) + (when (= v1-29 (logand (+ (-> this lap-quadrant) 1) 3)) + (set! (-> this lap-quadrant) v1-29) + (when (zero? v1-29) + (if (logtest? (-> this flags) (racer-state-flags rsf0)) + (end-lap this arg0) + (begin-race arg0) + ) + (begin-lap this arg0) ) ) ) ) - ((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))) - (.lvf vf1 (&-> (-> v1-39 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 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 (-> v1-39 0) (-> arg0 info finish-dir)))) - (end-lap this arg0) - ) - ) + ) + ((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) + ) ) ) - (else - (when (< 0.0 (-> this lap-distance)) - (begin-race arg0) - (begin-lap this arg0) - ) + ) + (else + (when (< 0.0 (-> this lap-distance)) + (begin-race arg0) + (begin-lap this arg0) ) ) ) - (let ((f0-10 (-> arg0 info ai-max-speed-factor))) - (if (< (+ (-> arg0 target-pos) (-> this target-pos-offset)) (-> this pos)) - (set! f0-10 (-> arg0 info ai-min-speed-factor)) - ) - (seek! (-> this speed-factor) f0-10 (* 0.2 (seconds-per-frame))) - ) - 0 ) - (if (logtest? (-> this flags) (racer-state-flags rsf1)) - (seek! (-> this speed-factor) 0.9 (* 0.2 (seconds-per-frame))) - ) - (when (logtest? (-> this flags) (racer-state-flags rsf0)) - (dotimes (s3-1 (-> arg0 info decision-point-count)) - (let ((v1-70 (-> arg0 info decision-point-array s3-1))) - (if (and (< (-> this lap-distance-prev) (-> v1-70 pos)) (>= (-> this lap-distance) (-> v1-70 pos))) - (send-event (handle->process (-> this racer)) 'race-decision-point v1-70) - ) + (let ((f0-10 (-> arg0 info ai-max-speed-factor))) + (if (< (+ (-> arg0 target-pos) (-> this target-pos-offset)) (-> this pos)) + (set! f0-10 (-> arg0 info ai-min-speed-factor)) ) - ) - (set! (-> this pos) (+ (-> this lap-distance) (the float (-> this lap-count)))) + (seek! (-> this speed-factor) f0-10 (* 0.2 (seconds-per-frame))) ) - (vector-copy! (-> this position) (-> s5-0 vector 0)) + 0 ) - (else - (logior! (-> this flags) (racer-state-flags rsf2)) + (if (logtest? (-> this flags) (racer-state-flags rsf1)) + (seek! (-> this speed-factor) 0.9 (* 0.2 (seconds-per-frame))) + ) + (when (logtest? (-> this flags) (racer-state-flags rsf0)) + (dotimes (s3-1 (-> arg0 info decision-point-count)) + (let ((v1-70 (-> arg0 info decision-point-array s3-1))) + (if (and (< (-> this lap-distance-prev) (-> v1-70 pos)) (>= (-> this lap-distance) (-> v1-70 pos))) + (send-event (handle->process (-> this racer)) 'race-decision-point v1-70) + ) + ) + ) + (set! (-> this pos) (+ (-> this lap-distance) (the float (-> this lap-count)))) ) + (vector-copy! (-> this position) (-> s5-0 vector 0)) + ) + (else + (logior! (-> this flags) (racer-state-flags rsf2)) ) ) ) - (when (logtest? (-> this flags) (racer-state-flags rsf7)) - ) - 0 - (none) ) + (when (logtest? (-> this flags) (racer-state-flags rsf7)) + ) + 0 + (none) ) (defmethod print-laps ((this racer-state) (arg0 race-state) (arg1 string)) @@ -762,46 +726,23 @@ ) (defmethod race-state-method-15 ((this race-state)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (= (level-status? *level* 'lracelit #f) 'active) - (let ((gp-1 (-> this info))) - (handle->process (-> this manager)) - (let ((s5-1 (new 'stack-no-clear 'matrix))) - (vector-float*! (-> s5-1 fvec) (-> gp-1 start-dir) -1.0) - (forward-up-nopitch->quaternion - (the-as quaternion (-> s5-1 uvec)) - (-> s5-1 fvec) - (new 'static 'vector :y 1.0 :w 1.0) - ) - (let ((a0-8 (-> s5-1 rvec))) - (let ((v1-9 (-> gp-1 start-sphere))) - (let ((a1-4 (-> gp-1 start-dir))) - (let ((a2-3 49152.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a1-4 quad)) - ) - (.lvf vf4 (&-> v1-9 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-8 quad) vf6) - ) - (+! (-> s5-1 rvec y) 22528.0) + (when (= (level-status? *level* 'lracelit #f) 'active) + (let ((gp-1 (-> this info))) + (handle->process (-> this manager)) + (let ((s5-1 (new 'stack-no-clear 'matrix))) + (vector-float*! (-> s5-1 fvec) (-> gp-1 start-dir) -1.0) + (forward-up-nopitch->quaternion + (the-as quaternion (-> s5-1 uvec)) + (-> s5-1 fvec) + (new 'static 'vector :y 1.0 :w 1.0) ) + (vector+*! (-> s5-1 rvec) (the-as vector (-> gp-1 start-sphere)) (-> gp-1 start-dir) 49152.0) + (+! (-> s5-1 rvec y) 22528.0) ) ) - 0 - (none) ) + 0 + (none) ) ;; WARN: Return type mismatch symbol vs none. @@ -815,129 +756,92 @@ ) (defmethod initialize ((this race-state) (arg0 process) (arg1 race-info)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s3-0 (-> this flags))) - (mem-set32! (the-as pointer this) 328 0) - (set! (-> this flags) s3-0) - ) - (set! (-> this info) arg1) - (set! (-> this manager) (process->handle arg0)) - (set! (-> this scene-player) (the-as handle #f)) - (set! (-> this hud-timer) (the-as handle #f)) - (set! (-> this hud-lap-counter) (the-as handle #f)) - (set! (-> this hud-turbo-counter) (the-as handle #f)) - (set! (-> this hud-position) (the-as handle #f)) - (set! (-> this arrow) (the-as handle #f)) - (set! (-> this race-signal) (the-as handle #f)) - (set! (-> this state) (race-state-enum rs0)) - (set! (-> this racer-count) (-> arg1 racer-count)) - (set! (-> this finished-count) 0) - (set! (-> this i-player) -1) - (set! (-> this player-win?) #f) - (set! (-> this new-score?) #f) - (dotimes (v1-5 (-> arg1 racer-count)) - (let ((a0-7 (-> arg1 racer-array v1-5 rider))) - (if (or (zero? a0-7) (= a0-7 1)) - (set! (-> this i-player) v1-5) - ) - ) - ) - (let ((v1-8 (new 'stack-no-clear 'race-manager-stack-var0))) - (set! (-> v1-8 vec1 z) 61440.0) - (set! (-> v1-8 word) 1) - (set! (-> v1-8 vec0 z) (/ (-> v1-8 vec1 z) -2)) - (set! (-> v1-8 vec0 w) -20480.0) - (set! (-> v1-8 vec1 x) (/ (-> v1-8 vec1 z) (the float (max 1 (+ (-> v1-8 word) -1))))) - (set! (-> v1-8 vec1 y) -40960.0) - (set! (-> v1-8 mat rvec quad) (-> arg1 start-sphere quad)) - (vector-copy! (-> v1-8 mat uvec) (-> arg1 start-dir)) - (set-vector! (-> v1-8 mat fvec) (-> v1-8 mat uvec z) 0.0 (- (-> v1-8 mat uvec x)) 1.0) - (dotimes (a0-22 (-> arg1 racer-count)) - (cond - (#t - (let ((a1-12 a0-22)) - (let ((a2-2 (logand a0-22 1))) - (set! (-> v1-8 vec0 x) (+ (-> v1-8 vec0 z) (* (-> v1-8 vec1 x) (the float a2-2)))) - ) - (set! (-> v1-8 vec0 y) (+ (-> v1-8 vec0 w) (* (-> v1-8 vec1 y) (the float a1-12)))) - ) - ) - (else - (let ((a1-15 (/ a0-22 (-> v1-8 word)))) - (let ((a2-5 (- a0-22 (* a1-15 (-> v1-8 word))))) - (set! (-> v1-8 vec0 x) (+ (-> v1-8 vec0 z) (* (-> v1-8 vec1 x) (the float a2-5)))) - ) - (set! (-> v1-8 vec0 y) (+ (-> v1-8 vec0 w) (* (-> v1-8 vec1 y) (the float a1-15)))) - ) - ) - ) - (let ((a1-20 (-> this racer-array a0-22))) - (-> arg1 racer-array a0-22) - (vector-copy! (-> v1-8 mat trans) (-> v1-8 mat rvec)) - (let ((t0-0 (-> v1-8 mat trans))) - (let ((a2-9 (-> v1-8 mat trans))) - (let ((a3-3 (-> v1-8 mat uvec))) - (let ((t1-0 (-> v1-8 vec0 y))) - (.mov vf7 t1-0) - ) - (.lvf vf5 (&-> a3-3 quad)) - ) - (.lvf vf4 (&-> a2-9 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 (&-> t0-0 quad) vf6) - ) - (let ((t0-1 (-> v1-8 mat trans))) - (let ((a2-10 (-> v1-8 mat trans))) - (let ((a3-4 (-> v1-8 mat fvec))) - (let ((t1-1 (-> v1-8 vec0 x))) - (.mov vf7 t1-1) - ) - (.lvf vf5 (&-> a3-4 quad)) - ) - (.lvf vf4 (&-> a2-10 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 (&-> t0-1 quad) vf6) - ) - (vector-copy! (-> a1-20 start-position) (-> v1-8 mat trans)) - (set! (-> a1-20 rank) a0-22) - (set! (-> a1-20 speed-factor) 1.0) - (set! (-> a1-20 racer) (the-as handle #f)) - ) - (set! (-> this rankings a0-22) a0-22) - ) - ) - (dotimes (v1-11 (-> this info turbo-pad-count)) - (set! (-> this info turbo-pad-array v1-11 handle) (the-as handle #f)) - ) - (let ((v1-17 (-> *game-info* sub-task-list (-> arg1 task-node)))) - (set! (-> this suck-factor) 0.0) - (if (not (logtest? (-> arg1 flags) (racer-info-flag rif3))) - (set! (-> this suck-factor) (fmax 0.0 (fmin 1.0 (* 0.3333 (+ -2.0 (the float (-> v1-17 death-count))))))) - ) - (format - #t - "race-state::initialize: death-count ~d, suck-factor ~f~%" - (-> v1-17 death-count) - (-> this suck-factor) - ) - ) - (logior! (-> this flags) (race-flag rf16)) - 0 - (none) + (let ((s3-0 (-> this flags))) + (mem-set32! (the-as pointer this) 328 0) + (set! (-> this flags) s3-0) ) + (set! (-> this info) arg1) + (set! (-> this manager) (process->handle arg0)) + (set! (-> this scene-player) (the-as handle #f)) + (set! (-> this hud-timer) (the-as handle #f)) + (set! (-> this hud-lap-counter) (the-as handle #f)) + (set! (-> this hud-turbo-counter) (the-as handle #f)) + (set! (-> this hud-position) (the-as handle #f)) + (set! (-> this arrow) (the-as handle #f)) + (set! (-> this race-signal) (the-as handle #f)) + (set! (-> this state) (race-state-enum rs0)) + (set! (-> this racer-count) (-> arg1 racer-count)) + (set! (-> this finished-count) 0) + (set! (-> this i-player) -1) + (set! (-> this player-win?) #f) + (set! (-> this new-score?) #f) + (dotimes (v1-5 (-> arg1 racer-count)) + (let ((a0-7 (-> arg1 racer-array v1-5 rider))) + (if (or (zero? a0-7) (= a0-7 1)) + (set! (-> this i-player) v1-5) + ) + ) + ) + (let ((v1-8 (new 'stack-no-clear 'race-manager-stack-var0))) + (set! (-> v1-8 vec1 z) 61440.0) + (set! (-> v1-8 word) 1) + (set! (-> v1-8 vec0 z) (/ (-> v1-8 vec1 z) -2)) + (set! (-> v1-8 vec0 w) -20480.0) + (set! (-> v1-8 vec1 x) (/ (-> v1-8 vec1 z) (the float (max 1 (+ (-> v1-8 word) -1))))) + (set! (-> v1-8 vec1 y) -40960.0) + (set! (-> v1-8 mat rvec quad) (-> arg1 start-sphere quad)) + (vector-copy! (-> v1-8 mat uvec) (-> arg1 start-dir)) + (set-vector! (-> v1-8 mat fvec) (-> v1-8 mat uvec z) 0.0 (- (-> v1-8 mat uvec x)) 1.0) + (dotimes (a0-22 (-> arg1 racer-count)) + (cond + (#t + (let ((a1-12 a0-22)) + (let ((a2-2 (logand a0-22 1))) + (set! (-> v1-8 vec0 x) (+ (-> v1-8 vec0 z) (* (-> v1-8 vec1 x) (the float a2-2)))) + ) + (set! (-> v1-8 vec0 y) (+ (-> v1-8 vec0 w) (* (-> v1-8 vec1 y) (the float a1-12)))) + ) + ) + (else + (let ((a1-15 (/ a0-22 (-> v1-8 word)))) + (let ((a2-5 (- a0-22 (* a1-15 (-> v1-8 word))))) + (set! (-> v1-8 vec0 x) (+ (-> v1-8 vec0 z) (* (-> v1-8 vec1 x) (the float a2-5)))) + ) + (set! (-> v1-8 vec0 y) (+ (-> v1-8 vec0 w) (* (-> v1-8 vec1 y) (the float a1-15)))) + ) + ) + ) + (let ((a1-20 (-> this racer-array a0-22))) + (-> arg1 racer-array a0-22) + (vector-copy! (-> v1-8 mat trans) (-> v1-8 mat rvec)) + (vector+*! (-> v1-8 mat trans) (-> v1-8 mat trans) (-> v1-8 mat uvec) (-> v1-8 vec0 y)) + (vector+*! (-> v1-8 mat trans) (-> v1-8 mat trans) (-> v1-8 mat fvec) (-> v1-8 vec0 x)) + (vector-copy! (-> a1-20 start-position) (-> v1-8 mat trans)) + (set! (-> a1-20 rank) a0-22) + (set! (-> a1-20 speed-factor) 1.0) + (set! (-> a1-20 racer) (the-as handle #f)) + ) + (set! (-> this rankings a0-22) a0-22) + ) + ) + (dotimes (v1-11 (-> this info turbo-pad-count)) + (set! (-> this info turbo-pad-array v1-11 handle) (the-as handle #f)) + ) + (let ((v1-17 (-> *game-info* sub-task-list (-> arg1 task-node)))) + (set! (-> this suck-factor) 0.0) + (if (not (logtest? (-> arg1 flags) (racer-info-flag rif3))) + (set! (-> this suck-factor) (fmax 0.0 (fmin 1.0 (* 0.3333 (+ -2.0 (the float (-> v1-17 death-count))))))) + ) + (format + #t + "race-state::initialize: death-count ~d, suck-factor ~f~%" + (-> v1-17 death-count) + (-> this suck-factor) + ) + ) + (logior! (-> this flags) (race-flag rf16)) + 0 + (none) ) (define *race-state* (new 'static 'race-state)) diff --git a/goal_src/jak3/levels/common/race/race-mesh.gc b/goal_src/jak3/levels/common/race/race-mesh.gc index 52a9ef9f93..08f460bbff 100644 --- a/goal_src/jak3/levels/common/race/race-mesh.gc +++ b/goal_src/jak3/levels/common/race/race-mesh.gc @@ -200,52 +200,35 @@ ) (defmethod race-path-method-12 ((this race-path) (arg0 vector) (arg1 float) (arg2 float)) - (local-vars (v1-15 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 arg2) - (s4-0 (new 'stack-no-clear 'matrix)) - (f30-0 (the float (-> this sample-count))) - ) - (if (< f30-0 gp-0) - (set! gp-0 (- gp-0 f30-0)) - ) - (if (< arg1 0.0) - (set! arg1 (+ arg1 f30-0)) - ) - (race-path-method-10 this (-> s4-0 rvec) arg1 arg2) - (race-path-method-10 this (-> s4-0 uvec) gp-0 arg2) - (vector-! (-> s4-0 fvec) (-> s4-0 uvec) (-> s4-0 rvec)) - (vector-! (-> s4-0 trans) arg0 (-> s4-0 rvec)) - (let ((f0-7 0.0) - (f1-1 1.0) - (f2-1 (vector-dot (-> s4-0 fvec) (-> s4-0 trans))) - ) - (.lvf vf1 (&-> (-> s4-0 fvec) 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-8 (fmax f0-7 (fmin f1-1 (/ f2-1 v1-15))))) - (if (< gp-0 arg1) - (set! gp-0 (+ gp-0 f30-0)) - ) - (let ((f0-10 (+ (* arg1 (- 1.0 f0-8)) (* gp-0 f0-8)))) - (if (< f30-0 f0-10) - (set! f0-10 (- f0-10 f30-0)) - ) - (if (< f0-10 0.0) - (+! f0-10 f30-0) - ) - f0-10 + (let ((gp-0 arg2) + (s4-0 (new 'stack-no-clear 'matrix)) + (f30-0 (the float (-> this sample-count))) + ) + (if (< f30-0 gp-0) + (set! gp-0 (- gp-0 f30-0)) + ) + (if (< arg1 0.0) + (set! arg1 (+ arg1 f30-0)) + ) + (race-path-method-10 this (-> s4-0 rvec) arg1 arg2) + (race-path-method-10 this (-> s4-0 uvec) gp-0 arg2) + (vector-! (-> s4-0 fvec) (-> s4-0 uvec) (-> s4-0 rvec)) + (vector-! (-> s4-0 trans) arg0 (-> s4-0 rvec)) + (let ((f0-8 + (fmax 0.0 (fmin 1.0 (/ (vector-dot (-> s4-0 fvec) (-> s4-0 trans)) (vector-length-squared (-> s4-0 fvec))))) ) ) + (if (< gp-0 arg1) + (set! gp-0 (+ gp-0 f30-0)) + ) + (let ((f0-10 (+ (* arg1 (- 1.0 f0-8)) (* gp-0 f0-8)))) + (if (< f30-0 f0-10) + (set! f0-10 (- f0-10 f30-0)) + ) + (if (< f0-10 0.0) + (+! f0-10 f30-0) + ) + f0-10 ) ) ) diff --git a/goal_src/jak3/levels/desert/boss/terraformer-setup.gc b/goal_src/jak3/levels/desert/boss/terraformer-setup.gc index 364029b20d..480cb7a007 100644 --- a/goal_src/jak3/levels/desert/boss/terraformer-setup.gc +++ b/goal_src/jak3/levels/desert/boss/terraformer-setup.gc @@ -51,118 +51,95 @@ ) (defmethod terraformer-foot-mark-pt-array-method-10 ((this terraformer-foot-mark-pt-array)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (if (>= (-> this current-point) 20) - (return 0) + (if (>= (-> this current-point) 20) + (return 0) + ) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (-> this points (-> this current-point))) ) - (let ((gp-0 (new 'stack-no-clear 'collide-query)) - (s5-0 (-> this points (-> this current-point))) - ) - (set! (-> s5-0 found?) #f) - (let* ((f0-0 3449.2632) - (f30-0 (* f0-0 (the float (-> this current-point)))) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (let ((f0-3 (+ f30-0 (rand-vu-float-range (* -0.43 f0-0) (* 0.43 f0-0))))) - (set! (-> s5-0 angle) f0-3) - (sincos! s3-0 f0-3) - ) - (set! (-> s3-0 z) (* (-> s3-0 y) (-> this radius) (rand-vu-float-range 0.7 0.9))) - (set! (-> s3-0 y) 32768.0) - (set! (-> s3-0 x) (* (-> s3-0 x) (-> this radius) (rand-vu-float-range 0.7 0.9))) - (vector+! (-> gp-0 start-pos) (-> this origin) s3-0) + (set! (-> s5-0 found?) #f) + (let* ((f0-0 3449.2632) + (f30-0 (* f0-0 (the float (-> this current-point)))) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((f0-3 (+ f30-0 (rand-vu-float-range (* -0.43 f0-0) (* 0.43 f0-0))))) + (set! (-> s5-0 angle) f0-3) + (sincos! s3-0 f0-3) ) - (set-vector! (-> gp-0 move-dist) 0.0 -65536.0 0.0 1.0) - (let ((v1-13 gp-0)) - (set! (-> v1-13 radius) 409.6) - (set! (-> v1-13 collide-with) (collide-spec backgnd pusher)) - (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)) - ) - (+! (-> this current-point) 1) - (let ((f0-16 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) - (when (>= f0-16 0.0) - (let ((a1-5 (-> s5-0 collision-pt))) - (let ((v1-19 (-> gp-0 start-pos))) - (let ((a0-15 (-> gp-0 move-dist))) - (let ((a2-0 f0-16)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a0-15 quad)) - ) - (.lvf vf4 (&-> v1-19 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-5 quad) vf6) + (set! (-> s3-0 z) (* (-> s3-0 y) (-> this radius) (rand-vu-float-range 0.7 0.9))) + (set! (-> s3-0 y) 32768.0) + (set! (-> s3-0 x) (* (-> s3-0 x) (-> this radius) (rand-vu-float-range 0.7 0.9))) + (vector+! (-> gp-0 start-pos) (-> this origin) s3-0) + ) + (set-vector! (-> gp-0 move-dist) 0.0 -65536.0 0.0 1.0) + (let ((v1-13 gp-0)) + (set! (-> v1-13 radius) 409.6) + (set! (-> v1-13 collide-with) (collide-spec backgnd pusher)) + (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) ) - (+! (-> s5-0 collision-pt y) 204.8) - (set! (-> s5-0 found?) #t) - (vector-normalize-copy! (-> s5-0 normal) (-> gp-0 best-other-tri normal) 1.0) - (let ((s3-1 (new 'stack-no-clear 'vector)) - (s4-1 (new 'stack-no-clear 'inline-array 'vector 4)) - ) - (vector-cross! s3-1 (-> s5-0 normal) (vector-get-unique! (new 'stack-no-clear 'vector) (-> s5-0 normal))) - (vector-normalize! s3-1 10240.0) - (vector-copy! (-> s4-1 0) s3-1) - (vector-cross! (-> s4-1 1) s3-1 (-> s5-0 normal)) - (vector-negate! (-> s4-1 2) s3-1) - (vector-cross! (-> s4-1 3) (-> s5-0 normal) s3-1) - (vector-float*! s3-1 (-> s5-0 normal) 3072.0) - (dotimes (v1-28 4) - (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) s3-1) - (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) (-> s5-0 collision-pt)) + (set! (-> v1-13 action-mask) (collide-action solid)) + ) + (+! (-> this current-point) 1) + (let ((f0-16 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) + (when (>= f0-16 0.0) + (vector+*! (-> s5-0 collision-pt) (-> gp-0 start-pos) (-> gp-0 move-dist) f0-16) + (+! (-> s5-0 collision-pt y) 204.8) + (set! (-> s5-0 found?) #t) + (vector-normalize-copy! (-> s5-0 normal) (-> gp-0 best-other-tri normal) 1.0) + (let ((s3-1 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack-no-clear 'inline-array 'vector 4)) ) - (vector-float*! (-> gp-0 move-dist) s3-1 -2.0) - (let ((s3-2 (new 'stack-no-clear 'collide-query))) - (let ((a1-19 (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)) - ) - (set-vector! v1-38 f0-22 f0-22 f0-22 1.0) - (vector+! (-> a1-19 max) (-> s5-0 collision-pt) v1-38) - (vector-! (-> a1-19 min) (-> s5-0 collision-pt) v1-38) - ) - (set! (-> s3-2 collide-with) (collide-spec backgnd pusher)) - (set! (-> s3-2 ignore-process0) #f) - (set! (-> s3-2 ignore-process1) #f) - (set! (-> s3-2 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> s3-2 action-mask) (collide-action solid)) - (mem-copy! (the-as pointer (-> s3-2 bbox)) (the-as pointer a1-19) 32) + (vector-cross! s3-1 (-> s5-0 normal) (vector-get-unique! (new 'stack-no-clear 'vector) (-> s5-0 normal))) + (vector-normalize! s3-1 10240.0) + (vector-copy! (-> s4-1 0) s3-1) + (vector-cross! (-> s4-1 1) s3-1 (-> s5-0 normal)) + (vector-negate! (-> s4-1 2) s3-1) + (vector-cross! (-> s4-1 3) (-> s5-0 normal) s3-1) + (vector-float*! s3-1 (-> s5-0 normal) 3072.0) + (dotimes (v1-28 4) + (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) s3-1) + (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) (-> s5-0 collision-pt)) + ) + (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)) + ) + (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) ) - (fill-using-bounding-box *collide-cache* s3-2) + (set! (-> s3-2 collide-with) (collide-spec backgnd pusher)) + (set! (-> s3-2 ignore-process0) #f) + (set! (-> s3-2 ignore-process1) #f) + (set! (-> s3-2 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> s3-2 action-mask) (collide-action solid)) + (mem-copy! (the-as pointer (-> s3-2 bbox)) (the-as pointer a1-20) 32) ) - (dotimes (s3-3 4) - (vector-copy! (-> gp-0 start-pos) (-> s4-1 s3-3)) - (when (< (probe-using-line-sphere *collide-cache* gp-0) 0.0) - (set! (-> s5-0 found?) #f) - (return 0) - ) + (fill-using-bounding-box *collide-cache* s3-2) + ) + (dotimes (s3-3 4) + (vector-copy! (-> gp-0 start-pos) (-> s4-1 s3-3)) + (when (< (probe-using-line-sphere *collide-cache* gp-0) 0.0) + (set! (-> s5-0 found?) #f) + (return 0) ) ) ) ) ) - 0 ) + 0 ) (defmethod terraformer-foot-mark-pt-array-method-11 ((this terraformer-foot-mark-pt-array) (arg0 process)) @@ -732,145 +709,122 @@ (vector-copy! (-> self root trans) (-> self src-pos)) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (cond - ((zero? (-> self which-trajectory)) - (+! (-> self x-rotate) 4369.067) - (+! (-> self y-rotate) 3458.8445) - ) - (else - (+! (-> self x-rotate) 2730.6667) - (+! (-> self y-rotate) 2002.4889) - ) + (cond + ((zero? (-> self which-trajectory)) + (+! (-> self x-rotate) 4369.067) + (+! (-> self y-rotate) 3458.8445) + ) + (else + (+! (-> self x-rotate) 2730.6667) + (+! (-> self y-rotate) 2002.4889) ) - (if (< 65536.0 (-> self x-rotate)) - (+! (-> self x-rotate) -65536.0) - ) - (if (< 65536.0 (-> self y-rotate)) - (+! (-> self y-rotate) -65536.0) - ) - (let ((s5-0 (new 'stack-no-clear 'quaternion)) - (gp-0 (new 'stack-no-clear 'quaternion)) - ) - (quaternion-set! s5-0 (sin (/ (-> self x-rotate) 2)) 0.0 0.0 (cos (/ (-> self x-rotate) 2))) - (quaternion-set! gp-0 0.0 (sin (/ (-> self y-rotate) 2)) 0.0 (cos (/ (-> self y-rotate) 2))) - (quaternion-normalize! (quaternion*! (-> self root quat) gp-0 s5-0)) + ) + (if (< 65536.0 (-> self x-rotate)) + (+! (-> self x-rotate) -65536.0) ) - (cond - ((time-elapsed? (-> self state-time) (the int (-> self traj time))) - (cond - ((zero? (-> self which-trajectory)) - (set! (-> self which-trajectory) 1) - (compute-trans-at-time - (-> self traj) - (fmin (-> self traj time) (the float (- (current-time) (-> self state-time)))) - (-> self root trans) - ) - (let ((gp-1 (new 'stack-no-clear 'matrix))) - (matrix-identity! gp-1) - (vector-copy! (-> gp-1 trans) (-> self root trans)) - (if (logtest? (-> *part-group-id-table* 432 flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group (-> *part-group-id-table* 432) - :duration (seconds 1) - :mat-joint gp-1 - ) - (part-tracker-spawn - part-tracker - :to *entity-pool* - :group (-> *part-group-id-table* 432) - :duration (seconds 1) - :mat-joint gp-1 - ) - ) - ) - (set-time! (-> self state-time)) - (let ((gp-3 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) (-> self traj initial-position)))) - (set! (-> gp-3 y) 0.0) - (vector-normalize! gp-3 12288.0) - (vector+! gp-3 gp-3 (-> self root trans)) - (let ((s5-3 (new 'stack-no-clear 'collide-query))) - (set-vector! (-> s5-3 move-dist) 0.0 -122880.0 0.0 1.0) - (vector-copy! (-> s5-3 start-pos) gp-3) - (+! (-> s5-3 start-pos y) 61440.0) - (let ((v1-69 s5-3)) - (set! (-> v1-69 radius) 4096.0) - (set! (-> v1-69 collide-with) (collide-spec backgnd)) - (set! (-> v1-69 ignore-process0) #f) - (set! (-> v1-69 ignore-process1) #f) - (set! (-> v1-69 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-69 action-mask) (collide-action solid)) - ) - (let ((f0-35 (fill-and-probe-using-line-sphere *collide-cache* s5-3))) - (when (>= f0-35 0.0) - (let ((a0-35 gp-3)) - (let ((v1-72 (-> s5-3 start-pos))) - (let ((a1-15 (-> s5-3 move-dist))) - (let ((a2-14 f0-35)) - (.mov vf7 a2-14) - ) - (.lvf vf5 (&-> a1-15 quad)) - ) - (.lvf vf4 (&-> v1-72 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-35 quad) vf6) - ) - ) - ) - ) - (setup-from-to-duration-and-height! (-> self traj) (-> self root trans) gp-3 180.0 61440.0) - ) - ) - (else - (go-virtual idle) - ) - ) - ) - (else + (if (< 65536.0 (-> self y-rotate)) + (+! (-> self y-rotate) -65536.0) + ) + (let ((s5-0 (new 'stack-no-clear 'quaternion)) + (gp-0 (new 'stack-no-clear 'quaternion)) + ) + (quaternion-set! s5-0 (sin (/ (-> self x-rotate) 2)) 0.0 0.0 (cos (/ (-> self x-rotate) 2))) + (quaternion-set! gp-0 0.0 (sin (/ (-> self y-rotate) 2)) 0.0 (cos (/ (-> self y-rotate) 2))) + (quaternion-normalize! (quaternion*! (-> self root quat) gp-0 s5-0)) + ) + (cond + ((time-elapsed? (-> self state-time) (the int (-> self traj time))) + (cond + ((zero? (-> self which-trajectory)) + (set! (-> self which-trajectory) 1) (compute-trans-at-time (-> self traj) (fmin (-> self traj time) (the float (- (current-time) (-> self state-time)))) (-> self root trans) ) + (let ((gp-1 (new 'stack-no-clear 'matrix))) + (matrix-identity! gp-1) + (vector-copy! (-> gp-1 trans) (-> self root trans)) + (if (logtest? (-> *part-group-id-table* 432 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group (-> *part-group-id-table* 432) + :duration (seconds 1) + :mat-joint gp-1 + ) + (part-tracker-spawn + part-tracker + :to *entity-pool* + :group (-> *part-group-id-table* 432) + :duration (seconds 1) + :mat-joint gp-1 + ) + ) + ) + (set-time! (-> self state-time)) + (let ((gp-3 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) (-> self traj initial-position)))) + (set! (-> gp-3 y) 0.0) + (vector-normalize! gp-3 12288.0) + (vector+! gp-3 gp-3 (-> self root trans)) + (let ((s5-3 (new 'stack-no-clear 'collide-query))) + (set-vector! (-> s5-3 move-dist) 0.0 -122880.0 0.0 1.0) + (vector-copy! (-> s5-3 start-pos) gp-3) + (+! (-> s5-3 start-pos y) 61440.0) + (let ((v1-69 s5-3)) + (set! (-> v1-69 radius) 4096.0) + (set! (-> v1-69 collide-with) (collide-spec backgnd)) + (set! (-> v1-69 ignore-process0) #f) + (set! (-> v1-69 ignore-process1) #f) + (set! (-> v1-69 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-69 action-mask) (collide-action solid)) + ) + (let ((f0-35 (fill-and-probe-using-line-sphere *collide-cache* s5-3))) + (if (>= f0-35 0.0) + (vector+*! gp-3 (-> s5-3 start-pos) (-> s5-3 move-dist) f0-35) + ) + ) + ) + (setup-from-to-duration-and-height! (-> self traj) (-> self root trans) gp-3 180.0 61440.0) + ) + ) + (else + (go-virtual idle) + ) + ) + ) + (else + (compute-trans-at-time + (-> self traj) + (fmin (-> self traj time) (the float (- (current-time) (-> self state-time)))) + (-> self root trans) ) ) - (cond - ((zero? (-> self which-trajectory)) - (when (and (not (-> self incoming-sound-played)) - (time-elapsed? (-> self state-time) (the int (+ -135.0 (-> self traj time)))) - ) - (sound-play "mine-incoming" :position (-> self root trans)) - (set! (-> self incoming-sound-played) #t) - ) - (if (nonzero? (-> self trail-part)) - (push-back (-> self trail-part) (-> self root trans)) - ) + ) + (cond + ((zero? (-> self which-trajectory)) + (when (and (not (-> self incoming-sound-played)) + (time-elapsed? (-> self state-time) (the int (+ -135.0 (-> self traj time)))) + ) + (sound-play "mine-incoming" :position (-> self root trans)) + (set! (-> self incoming-sound-played) #t) ) - (else - (when (and (not (-> self expand-sound-played)) - (time-elapsed? (-> self state-time) (the int (+ -90.0 (-> self traj time)))) - ) - (sound-play "mine-expand" :position (-> self root trans)) - (set! (-> self expand-sound-played) #t) - ) - (if (time-elapsed? (-> self state-time) (the int (+ -30.0 (-> self traj time)))) - (ja :num! (seek!)) - ) + (if (nonzero? (-> self trail-part)) + (push-back (-> self trail-part) (-> self root trans)) + ) + ) + (else + (when (and (not (-> self expand-sound-played)) + (time-elapsed? (-> self state-time) (the int (+ -90.0 (-> self traj time)))) + ) + (sound-play "mine-expand" :position (-> self root trans)) + (set! (-> self expand-sound-played) #t) ) + (if (time-elapsed? (-> self state-time) (the int (+ -30.0 (-> self traj time)))) + (ja :num! (seek!)) + ) ) ) ) @@ -1526,314 +1480,276 @@ ;; WARN: Return type mismatch int vs object. (defbehavior terraformer-leg-update-ik terraformer-leg () (local-vars (sv-720 int)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (cond + ((nonzero? (-> self joint-ik)) + (let ((a1-0 (-> self joint-ik elbow-matrix-no-ik))) + (vector+*! gp-0 (-> a1-0 trans) (-> a1-0 uvec) (-> *terraformer-ik-setup* hand-dist)) ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (cond - ((nonzero? (-> self joint-ik)) - (let ((a1-0 (-> self joint-ik elbow-matrix-no-ik)) - (a0-0 gp-0) - ) - (let ((v1-2 (-> a1-0 trans))) - (let ((a1-1 (-> a1-0 uvec))) - (let ((a2-1 (-> *terraformer-ik-setup* hand-dist))) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-1 quad)) - ) - (.lvf vf4 (&-> v1-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 (&-> a0-0 quad) vf6) - ) - ) - (else - (vector<-cspace! gp-0 (-> self node-list data 6)) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-normalize-copy! - s5-0 - (-> self node-list data 6 bone transform uvec) - (-> *terraformer-ik-setup* hand-dist) - ) - (vector+! gp-0 gp-0 s5-0) + ) + (else + (vector<-cspace! gp-0 (-> self node-list data 6)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-normalize-copy! + s5-0 + (-> self node-list data 6 bone transform uvec) + (-> *terraformer-ik-setup* hand-dist) ) + (vector+! gp-0 gp-0 s5-0) ) ) - (cond - ((zero? (-> self last-effect)) - (when (< (terraformer-leg-frames-till-up) 12.0) - (set! (-> self last-effect) 1) - (sound-play "joint-servo-up" :position (-> self foot-lock old-position)) - ) + ) + (cond + ((zero? (-> self last-effect)) + (when (< (terraformer-leg-frames-till-up) 12.0) + (set! (-> self last-effect) 1) + (sound-play "joint-servo-up" :position (-> self foot-lock old-position)) ) - (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) + ) + (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) ) ) ) ) - (cond - ((not (-> self foot-lock initialized)) - ) - ((terraformer-leg-should-be-up?) - (if (nonzero? (-> self foot-marks)) - (terraformer-foot-mark-pt-array-method-11 (-> self foot-marks) self) - ) - (when (!= (-> self foot-lock lock target) 0.0) - (set! (-> self foot-lock lock target) 0.0) - (let ((s5-3 (new 'stack-no-clear 'matrix))) - (matrix-from-two-vectors! s5-3 (new 'static 'vector :y 1.0) (-> self foot-lock old-normal)) - (vector-copy! (-> s5-3 trans) (-> self foot-lock old-position)) - (cond - ((-> self stepped-in-water) - (set! (-> s5-3 trans y) 37273.6) - (if (logtest? (-> *part-group-id-table* 438 flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group (-> *part-group-id-table* 438) - :duration (seconds 1) - :mat-joint s5-3 - ) - (part-tracker-spawn - part-tracker - :to *entity-pool* - :group (-> *part-group-id-table* 438) - :duration (seconds 1) - :mat-joint s5-3 - ) + ) + (cond + ((not (-> self foot-lock initialized)) + ) + ((terraformer-leg-should-be-up?) + (if (nonzero? (-> self foot-marks)) + (terraformer-foot-mark-pt-array-method-11 (-> self foot-marks) self) + ) + (when (!= (-> self foot-lock lock target) 0.0) + (set! (-> self foot-lock lock target) 0.0) + (let ((s5-3 (new 'stack-no-clear 'matrix))) + (matrix-from-two-vectors! s5-3 (new 'static 'vector :y 1.0) (-> self foot-lock old-normal)) + (vector-copy! (-> s5-3 trans) (-> self foot-lock old-position)) + (cond + ((-> self stepped-in-water) + (set! (-> s5-3 trans y) 37273.6) + (if (logtest? (-> *part-group-id-table* 438 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group (-> *part-group-id-table* 438) + :duration (seconds 1) + :mat-joint s5-3 + ) + (part-tracker-spawn + part-tracker + :to *entity-pool* + :group (-> *part-group-id-table* 438) + :duration (seconds 1) + :mat-joint s5-3 ) - ) - ((begin (+! (-> s5-3 trans y) 4096.0) (logtest? (-> *part-group-id-table* 434 flags) (sp-group-flag sp13))) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group (-> *part-group-id-table* 434) - :duration (seconds 1) - :mat-joint s5-3 ) + ) + ((begin (+! (-> s5-3 trans y) 4096.0) (logtest? (-> *part-group-id-table* 434 flags) (sp-group-flag sp13))) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group (-> *part-group-id-table* 434) + :duration (seconds 1) + :mat-joint s5-3 ) - (else - (part-tracker-spawn - part-tracker - :to *entity-pool* - :group (-> *part-group-id-table* 434) - :duration (seconds 1) - :mat-joint s5-3 - ) + ) + (else + (part-tracker-spawn + part-tracker + :to *entity-pool* + :group (-> *part-group-id-table* 434) + :duration (seconds 1) + :mat-joint s5-3 ) ) ) ) ) - ((= (-> self foot-lock lock target) 1.0) - (if (nonzero? (-> self foot-marks)) - (terraformer-foot-mark-pt-array-method-10 (-> self foot-marks)) - ) - ) - (else - (let ((s5-4 (new 'stack-no-clear 'collide-query))) - (let ((v1-92 (new 'stack-no-clear 'vector))) - (vector-copy! - v1-92 - (-> self node-list data (+ (-> *terraformer-ik-setup* elbow-index) 1) bone transform trans) - ) - (let ((a2-30 (-> s5-4 bbox)) - (a0-30 v1-92) - (a1-26 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-26 x) 32768.0) - (set! (-> a1-26 y) 327680.0) - (set! (-> a1-26 z) 32768.0) - (set! (-> a1-26 w) 1.0) - (vector-! (-> a2-30 min) a0-30 a1-26) - ) - (let ((a1-27 (-> s5-4 bbox max)) - (a0-31 (new 'stack-no-clear 'vector)) - ) - (set! (-> a0-31 x) 32768.0) - (set! (-> a0-31 y) 163840.0) - (set! (-> a0-31 z) 32768.0) - (set! (-> a0-31 w) 1.0) - (vector+! a1-27 v1-92 a0-31) - ) + ) + ((= (-> self foot-lock lock target) 1.0) + (if (nonzero? (-> self foot-marks)) + (terraformer-foot-mark-pt-array-method-10 (-> self foot-marks)) + ) + ) + (else + (let ((s5-4 (new 'stack-no-clear 'collide-query))) + (let ((v1-92 (new 'stack-no-clear 'vector))) + (vector-copy! + v1-92 + (-> self node-list data (+ (-> *terraformer-ik-setup* elbow-index) 1) bone transform trans) ) - (set! (-> s5-4 collide-with) (collide-spec backgnd)) - (set! (-> s5-4 ignore-process0) #f) - (set! (-> s5-4 ignore-process1) #f) - (set! (-> s5-4 ignore-pat) + (let ((a2-29 (-> s5-4 bbox)) + (a0-31 v1-92) + (a1-26 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-26 x) 32768.0) + (set! (-> a1-26 y) 327680.0) + (set! (-> a1-26 z) 32768.0) + (set! (-> a1-26 w) 1.0) + (vector-! (-> a2-29 min) a0-31 a1-26) + ) + (let ((a1-27 (-> s5-4 bbox max)) + (a0-32 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-32 x) 32768.0) + (set! (-> a0-32 y) 163840.0) + (set! (-> a0-32 z) 32768.0) + (set! (-> a0-32 w) 1.0) + (vector+! a1-27 v1-92 a0-32) + ) + ) + (set! (-> s5-4 collide-with) (collide-spec backgnd)) + (set! (-> s5-4 ignore-process0) #f) + (set! (-> s5-4 ignore-process1) #f) + (set! (-> s5-4 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (fill-using-bounding-box *collide-cache* s5-4) + (vector-copy! (-> s5-4 start-pos) gp-0) + (+! (-> s5-4 start-pos y) 163840.0) + (set-vector! (-> s5-4 move-dist) 0.0 -327680.0 0.0 1.0) + (let ((v1-99 s5-4)) + (set! (-> v1-99 radius) 40.96) + (set! (-> v1-99 collide-with) (collide-spec backgnd)) + (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) ) - (fill-using-bounding-box *collide-cache* s5-4) - (vector-copy! (-> s5-4 start-pos) gp-0) - (+! (-> s5-4 start-pos y) 163840.0) - (set-vector! (-> s5-4 move-dist) 0.0 -327680.0 0.0 1.0) - (let ((v1-99 s5-4)) - (set! (-> v1-99 radius) 40.96) - (set! (-> v1-99 collide-with) (collide-spec backgnd)) - (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-27 (probe-using-line-sphere *collide-cache* s5-4))) - (when (>= f0-27 0.0) - (set! (-> self foot-lock lock target) 1.0) - (vector+float*! (-> self foot-lock old-position) (-> s5-4 start-pos) (-> s5-4 move-dist) f0-27) - (vector-copy! (-> self foot-lock old-normal) (-> s5-4 best-other-tri normal)) - (foot-impact) - (if (nonzero? (-> self foot-marks)) - (init! (-> self foot-marks) (-> self foot-lock old-position) 32768.0) - ) - ) + (set! (-> v1-99 action-mask) (collide-action solid)) + ) + (let ((f0-27 (probe-using-line-sphere *collide-cache* s5-4))) + (when (>= f0-27 0.0) + (set! (-> self foot-lock lock target) 1.0) + (vector+float*! (-> self foot-lock old-position) (-> s5-4 start-pos) (-> s5-4 move-dist) f0-27) + (vector-copy! (-> self foot-lock old-normal) (-> s5-4 best-other-tri normal)) + (foot-impact) + (if (nonzero? (-> self foot-marks)) + (init! (-> self foot-marks) (-> self foot-lock old-position) 32768.0) + ) ) ) ) ) - ((method-of-type cam-float-seeker update!) (-> self foot-lock lock) 0.0) - (if (-> self foot-lock initialized) - (vector-lerp! - gp-0 - gp-0 - (-> self foot-lock old-position) - (parameter-ease-sin-clamp (-> self foot-lock lock value)) - ) - (set! (-> self foot-lock initialized) #t) - ) - (if (nonzero? (-> self joint-ik)) - (set-ik-target! (-> self joint-ik) gp-0) - ) ) - 0 + ((method-of-type cam-float-seeker update!) (-> self foot-lock lock) 0.0) + (if (-> self foot-lock initialized) + (vector-lerp! + gp-0 + gp-0 + (-> self foot-lock old-position) + (parameter-ease-sin-clamp (-> self foot-lock lock value)) + ) + (set! (-> self foot-lock initialized) #t) + ) + (if (nonzero? (-> self joint-ik)) + (set-ik-target! (-> self joint-ik) gp-0) + ) ) + 0 ) (defstate idle (terraformer-leg) :virtual #t :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (local-vars (v1-19 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (case message - (('touched) - (cond - ((or (not (terraformer-leg-deadly?)) (!= (-> self kind) 2)) - ) - ((type? proc process-drawable) - (let ((s5-0 proc) - (s4-0 (new 'stack-no-clear 'vector)) - (f30-0 1.0) - ) - (let ((v1-7 (-> self kind))) - (cond - ((zero? v1-7) - (vector<-cspace! s4-0 (-> self node-list data 3)) - ) - ((= v1-7 1) - (vector<-cspace! s4-0 (-> self node-list data 4)) - ) - ((= v1-7 2) - (vector<-cspace! s4-0 (-> self node-list data 6)) - ) - (else - (vector<-cspace! s4-0 (-> self node-list data 3)) - ) - ) + (case message + (('touched) + (cond + ((or (not (terraformer-leg-deadly?)) (!= (-> self kind) 2)) + ) + ((type? proc process-drawable) + (let ((s5-0 proc) + (s4-0 (new 'stack-no-clear 'vector)) + (f30-0 1.0) ) - (vector-! s4-0 (-> (the-as process-drawable s5-0) root trans) s4-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-19 vf1) - (let ((f0-1 v1-19) - (f1-0 1.0) - ) - (if (< f0-1 (* f1-0 f1-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) - (if (type? s5-0 vehicle) - (set! f30-0 (-> (the-as vehicle proc) info info mass)) - ) - (let ((a1-10 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-10 from) (process->ppointer self)) - (set! (-> a1-10 num-params) 2) - (set! (-> a1-10 message) 'attack) - (set! (-> a1-10 param 0) (the-as uint #f)) - (set! (-> a1-10 param 1) - (the-as uint (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) - (damage 8.0) - (vehicle-damage-factor 0.8325) - (vehicle-impulse-factor (* 0.625 f30-0)) - (shield-damage 5.0) - (knock (knocked-type dark-shot)) - (attacker-velocity s4-0) - (shove-back (meters 20)) - (shove-up (meters 4)) - ) - ) - ) - ) - (when (and (send-event-function s5-0 a1-10) (or (= proc *target*) (type? s5-0 vehicle))) - (dotimes (gp-1 6) - (send-event (handle->process (-> self targets gp-1)) 'disable-collision) - ) - (set-time! (-> self collision-disable-timer)) - (let ((v1-52 (-> self root root-prim))) - (set! (-> v1-52 prim-core collide-as) (collide-spec)) - (set! (-> v1-52 prim-core collide-with) (collide-spec)) - ) - 0 + (let ((v1-7 (-> self kind))) + (cond + ((zero? v1-7) + (vector<-cspace! s4-0 (-> self node-list data 3)) + ) + ((= v1-7 1) + (vector<-cspace! s4-0 (-> self node-list data 4)) + ) + ((= v1-7 2) + (vector<-cspace! s4-0 (-> self node-list data 6)) + ) + (else + (vector<-cspace! s4-0 (-> self node-list data 3)) ) ) ) + (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) + ) + ) + (vector-normalize! s4-0 1.0) + (set! (-> s4-0 y) 0.3) + (vector-float*! s4-0 s4-0 4096.0) + (if (type? s5-0 vehicle) + (set! f30-0 (-> (the-as vehicle proc) info info mass)) + ) + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) (process->ppointer self)) + (set! (-> a1-10 num-params) 2) + (set! (-> a1-10 message) 'attack) + (set! (-> a1-10 param 0) (the-as uint #f)) + (set! (-> a1-10 param 1) + (the-as uint (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 8.0) + (vehicle-damage-factor 0.8325) + (vehicle-impulse-factor (* 0.625 f30-0)) + (shield-damage 5.0) + (knock (knocked-type dark-shot)) + (attacker-velocity s4-0) + (shove-back (meters 20)) + (shove-up (meters 4)) + ) + ) + ) + ) + (when (and (send-event-function s5-0 a1-10) (or (= proc *target*) (type? s5-0 vehicle))) + (dotimes (gp-1 6) + (send-event (handle->process (-> self targets gp-1)) 'disable-collision) + ) + (set-time! (-> self collision-disable-timer)) + (let ((v1-52 (-> self root root-prim))) + (set! (-> v1-52 prim-core collide-as) (collide-spec)) + (set! (-> v1-52 prim-core collide-with) (collide-spec)) + ) + 0 + ) + ) ) - ) - #t - ) - (('change-to) - (let ((a0-34 (the-as object (-> block param 0)))) - (if (the-as uint a0-34) - (change-to (the-as nav-mesh a0-34) self) - ) - ) - ) - (else - #t ) + ) + #t + ) + (('change-to) + (let ((a0-34 (the-as object (-> block param 0)))) + (if (the-as uint a0-34) + (change-to (the-as nav-mesh a0-34) self) + ) + ) + ) + (else + #t ) ) ) @@ -1985,77 +1901,52 @@ ) (defbehavior find-mine-dest terraformer ((arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (if (zero? (-> self older-target-time)) - (return #f) - ) - (cond - ((-> self launch-drones) - (vector-copy! arg0 (-> self target-rot fvec)) - (set! (-> arg0 y) 0.0) - (vector-normalize! arg0 819200.0) - (vector+! arg0 arg0 (-> self old-target-pos)) - ) - (else - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-! s5-0 (-> self old-target-pos) (-> self older-target-pos)) - (vector-float*! s5-0 s5-0 (/ 1.0 (the float (- (-> self old-target-time) (-> self older-target-time))))) - (vector+float*! arg0 (-> self old-target-pos) s5-0 300.0) - (vector-normalize! s5-0 163840.0) - (vector+! arg0 arg0 s5-0) - ) + (if (zero? (-> self older-target-time)) + (return #f) + ) + (cond + ((-> self launch-drones) + (vector-copy! arg0 (-> self target-rot fvec)) + (set! (-> arg0 y) 0.0) + (vector-normalize! arg0 819200.0) + (vector+! arg0 arg0 (-> self old-target-pos)) + ) + (else + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-! s5-0 (-> self old-target-pos) (-> self older-target-pos)) + (vector-float*! s5-0 s5-0 (/ 1.0 (the float (- (-> self old-target-time) (-> self older-target-time))))) + (vector+float*! arg0 (-> self old-target-pos) s5-0 300.0) + (vector-normalize! s5-0 163840.0) + (vector+! arg0 arg0 s5-0) ) ) - (let ((f30-1 (* 65536.0 (rand-vu)))) - (+! (-> arg0 x) (* 32768.0 (sin f30-1))) - (+! (-> arg0 z) (* 32768.0 (cos f30-1))) - ) - (let ((s5-1 (new 'stack-no-clear 'collide-query))) - (set-vector! (-> s5-1 move-dist) 0.0 -245760.0 0.0 1.0) - (vector-copy! (-> s5-1 start-pos) arg0) - (+! (-> s5-1 start-pos y) 122880.0) - (let ((v1-19 s5-1)) - (set! (-> v1-19 radius) 4096.0) - (set! (-> v1-19 collide-with) (collide-spec backgnd)) - (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 ((f0-18 (fill-and-probe-using-line-sphere *collide-cache* s5-1))) - (cond - ((>= f0-18 0.0) - (let ((v1-22 (-> s5-1 start-pos))) - (let ((a0-22 (-> s5-1 move-dist))) - (let ((a1-11 f0-18)) - (.mov vf7 a1-11) - ) - (.lvf vf5 (&-> a0-22 quad)) - ) - (.lvf vf4 (&-> v1-22 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 (&-> arg0 quad) vf6) - ) - (else - (return #f) - ) - ) - ) - ) - #t ) + (let ((f30-1 (* 65536.0 (rand-vu)))) + (+! (-> arg0 x) (* 32768.0 (sin f30-1))) + (+! (-> arg0 z) (* 32768.0 (cos f30-1))) + ) + (let ((s5-1 (new 'stack-no-clear 'collide-query))) + (set-vector! (-> s5-1 move-dist) 0.0 -245760.0 0.0 1.0) + (vector-copy! (-> s5-1 start-pos) arg0) + (+! (-> s5-1 start-pos y) 122880.0) + (let ((v1-19 s5-1)) + (set! (-> v1-19 radius) 4096.0) + (set! (-> v1-19 collide-with) (collide-spec backgnd)) + (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 ((f0-18 (fill-and-probe-using-line-sphere *collide-cache* s5-1))) + (if (>= f0-18 0.0) + (vector+*! arg0 (-> s5-1 start-pos) (-> s5-1 move-dist) f0-18) + (return #f) + ) + ) + ) + #t ) ;; WARN: Return type mismatch int vs object. diff --git a/goal_src/jak3/levels/desert/chase/marauder.gc b/goal_src/jak3/levels/desert/chase/marauder.gc index d0830b3875..8be5210b8f 100644 --- a/goal_src/jak3/levels/desert/chase/marauder.gc +++ b/goal_src/jak3/levels/desert/chase/marauder.gc @@ -1093,78 +1093,57 @@ 0 ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((t9-0 (-> (method-of-type nav-enemy hostile) trans))) - (if t9-0 - (t9-0) - ) - ) - (if (-> self save) - (go-virtual save) + (let ((t9-0 (-> (method-of-type nav-enemy hostile) trans))) + (if t9-0 + (t9-0) ) - (when (and (time-elapsed? (-> self state-time) (-> self reaction-time)) (not (-> self jump-attack))) - (let ((gp-0 (as-type (handle->process (-> self focus handle)) process-focusable))) - (when gp-0 - (los-control-method-9 - (-> self los) - (the-as process-focusable gp-0) - (get-trans (the-as process-focusable gp-0) 3) - 819.2 - 4096.0 - ) - (let* ((v1-21 (get-trans (the-as process-focusable gp-0) 0)) - (f30-0 (vector-length (vector-! (new 'stack-no-clear 'vector) v1-21 (-> self root trans)))) - ) - (when (pointing-toward-focus? self 8192.0 #t) - (should-check-los? (-> self los) 0) - (cond - ((< f30-0 32768.0) - (cond - ((rand-vu-percent? 0.5) - (let ((gp-1 (new 'stack-no-clear 'vector))) - (vector-copy! gp-1 (-> self root trans)) - (let ((a0-16 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) - (a1-10 gp-1) - ) - (let ((v1-33 gp-1)) - (let ((a2-3 16384.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-16 quad)) - (.lvf vf4 (&-> v1-33 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-10 quad) vf6) - ) - (set! (-> self jump-attack) #t) - (sound-play "marauder-attack") - (set! (-> self enemy-flags) - (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) - ) - (send-event self 'jump 0 gp-1) + ) + (if (-> self save) + (go-virtual save) + ) + (when (and (time-elapsed? (-> self state-time) (-> self reaction-time)) (not (-> self jump-attack))) + (let ((gp-0 (as-type (handle->process (-> self focus handle)) process-focusable))) + (when gp-0 + (los-control-method-9 + (-> self los) + (the-as process-focusable gp-0) + (get-trans (the-as process-focusable gp-0) 3) + 819.2 + 4096.0 + ) + (let* ((v1-21 (get-trans (the-as process-focusable gp-0) 0)) + (f30-0 (vector-length (vector-! (new 'stack-no-clear 'vector) v1-21 (-> self root trans)))) + ) + (when (pointing-toward-focus? self 8192.0 #t) + (should-check-los? (-> self los) 0) + (cond + ((< f30-0 32768.0) + (cond + ((rand-vu-percent? 0.5) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (vector-copy! gp-1 (-> self root trans)) + (let ((a0-16 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) + (vector+*! gp-1 gp-1 a0-16 16384.0) ) + (set! (-> self jump-attack) #t) + (sound-play "marauder-attack") + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) + (send-event self 'jump 0 gp-1) ) - (else - (sound-play "marauder-attack") - (go-virtual attack-run) - ) + ) + (else + (sound-play "marauder-attack") + (go-virtual attack-run) ) ) - ((and (< f30-0 122880.0) - (and (< 61440.0 f30-0) (-> self gun?) (logtest? (-> self draw status) (draw-control-status on-screen))) - ) - (go-virtual gun-shoot) - ) - ) + ) + ((and (< f30-0 122880.0) + (and (< 61440.0 f30-0) (-> self gun?) (logtest? (-> self draw status) (draw-control-status on-screen))) + ) + (go-virtual gun-shoot) + ) ) ) ) @@ -1212,72 +1191,46 @@ ) (defmethod fire-shot ((this marauder)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (as-type (handle->process (-> this focus handle)) process-focusable)) - (s5-1 (new 'stack-no-clear 'vector)) - ) - (when s4-0 - (vector-! s5-1 (-> this root trans) (get-trans (the-as process-focusable s4-0) 0)) - (set! (-> s5-1 y) 0.0) - (vector-normalize! s5-1 1.0) - (vector-rotate90-around-y! s5-1 s5-1) - (if (< 0.0 (vector-dot s5-1 (get-transv (the-as process-focusable s4-0)))) - (vector-negate-in-place! s5-1) - ) - (let ((s3-4 (-> this target-pos))) - (let ((s4-1 (get-trans (the-as process-focusable s4-0) 3))) - (let ((v1-13 (the-as float (if (rand-vu-percent? 0.66) - 8192.0 - 0.0 - ) - ) - ) - ) - (.mov vf7 v1-13) - ) - (.lvf vf5 (&-> s5-1 quad)) - (.lvf vf4 (&-> s4-1 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 (&-> s3-4 quad) vf6) + (let ((s4-0 (as-type (handle->process (-> this focus handle)) process-focusable)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (when s4-0 + (vector-! s5-1 (-> this root trans) (get-trans (the-as process-focusable s4-0) 0)) + (set! (-> s5-1 y) 0.0) + (vector-normalize! s5-1 1.0) + (vector-rotate90-around-y! s5-1 s5-1) + (if (< 0.0 (vector-dot s5-1 (get-transv (the-as process-focusable s4-0)))) + (vector-negate-in-place! s5-1) ) + (vector+*! + (-> this target-pos) + (get-trans (the-as process-focusable s4-0) 3) + s5-1 + (the-as float (if (rand-vu-percent? 0.66) + 8192.0 + 0.0 + ) + ) ) ) - (let* ((s5-2 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 13))) - (s4-2 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> this target-pos) s5-2) 1.0)) - ) - (new 'stack-no-clear 'vector) - (new 'stack-no-clear 'vector) - (vector-normalize! s4-2 1.0) - (sound-play "marauder-fire") - (let ((t9-13 spawn-guard-projectile) - (a1-11 s5-2) - (a2-1 (new 'stack-no-clear 'vector)) - ) - (let ((v1-20 122880.0)) - (.mov vf7 v1-20) - ) - (.lvf vf5 (&-> s4-2 quad)) - (.lvf vf4 (&-> s5-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 (&-> a2-1 quad) vf6) - (t9-13 this a1-11 a2-1 819200.0 (the-as vector #f)) - ) - ) - 0 - (none) ) + (let* ((s5-2 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 13))) + (s4-2 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> this target-pos) s5-2) 1.0)) + ) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (vector-normalize! s4-2 1.0) + (sound-play "marauder-fire") + (spawn-guard-projectile + this + s5-2 + (vector+*! (new 'stack-no-clear 'vector) s5-2 s4-2 122880.0) + 819200.0 + (the-as vector #f) + ) + ) + 0 + (none) ) (defstate gun-shoot (marauder) @@ -1585,141 +1538,68 @@ (defstate ambush (marauder) :virtual #t :code (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'sphere))) - (set! (-> gp-0 quad) (-> self root trans quad)) - (set! (-> gp-0 r) 81920.0) - (when (not (and (-> self skip-jump) (not (sphere-in-view-frustum? gp-0)))) - ) - ;; og:preserve-this prevent vf0 clobbering - ; (suspend) - (when (and (-> self skip-jump) (not (sphere-in-view-frustum? gp-0))) - (let ((gp-1 (new 'stack-no-clear 'vector))) - (vector-copy! gp-1 (-> self root trans)) - (let ((a0-6 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) - (a1-1 gp-1) - ) - (let ((v1-13 gp-1)) - (let ((a2-1 61440.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-6 quad)) - (.lvf vf4 (&-> v1-13 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-1 quad) vf6) - ) - (let ((a1-2 gp-1)) - (let ((v1-14 gp-1)) - (let ((a0-7 *y-vector*)) - (let ((a2-3 -32768.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-7 quad)) - ) - (.lvf vf4 (&-> v1-14 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-2 quad) vf6) - ) - (vector-copy! (-> self root trans) gp-1) + (let ((gp-0 (new 'stack-no-clear 'sphere))) + (set! (-> gp-0 quad) (-> self root trans quad)) + (set! (-> gp-0 r) 81920.0) + (when (not (and (-> self skip-jump) (not (sphere-in-view-frustum? gp-0)))) + ) + (suspend) + (when (and (-> self skip-jump) (not (sphere-in-view-frustum? gp-0))) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (vector-copy! gp-1 (-> self root trans)) + (let ((a0-6 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) + (vector+*! gp-1 gp-1 a0-6 61440.0) ) - (go-virtual hostile) + (vector+*! gp-1 gp-1 *y-vector* -32768.0) + (vector-copy! (-> self root trans) gp-1) ) + (go-virtual hostile) ) - (let ((v1-21 (-> self root root-prim))) - (set! (-> v1-21 prim-core collide-as) (collide-spec)) - (set! (-> v1-21 prim-core collide-with) (collide-spec)) - ) - 0 - (set! (-> self ambush?) #t) - (let ((f30-0 (rnd-float-range self 1.2 1.25)) - (f28-0 0.0) - ) - (ja-no-eval :group! marauder-male-run0-ja :num! (seek! max f30-0) :frame-num 0.0) - (until (ja-done? 0) - (let ((gp-2 (-> self root trans))) - (let ((s5-0 (-> self root trans))) - (let ((v1-43 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) - (let ((a0-14 (* 24576.0 (seconds-per-frame)))) - (.mov vf7 a0-14) - ) - (.lvf vf5 (&-> v1-43 quad)) - ) - (.lvf vf4 (&-> s5-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 (&-> gp-2 quad) vf6) - ) - (+! f28-0 (seconds-per-frame)) - (if (< 1.0 f28-0) - (set! f28-0 1.0) - ) - (suspend) - ;; og:preserve-this fix vf0 clobbering after suspend - (init-vf0-vector) - (ja :num! (seek! max f30-0)) - ) - ) - (let ((v1-58 (-> self root root-prim))) - (set! (-> v1-58 prim-core collide-as) (-> self root backup-collide-as)) - (set! (-> v1-58 prim-core collide-with) (-> self root backup-collide-with)) - ) - (let ((gp-3 (new 'stack-no-clear 'vector))) - (vector-copy! gp-3 (-> self root trans)) - (let ((a0-22 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) - (a1-8 gp-3) - ) - (let ((v1-63 gp-3)) - (let ((a2-8 61440.0)) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a0-22 quad)) - (.lvf vf4 (&-> v1-63 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-8 quad) vf6) - ) - (let ((a1-9 gp-3)) - (let ((v1-64 gp-3)) - (let ((a0-23 *y-vector*)) - (let ((a2-10 -81920.0)) - (.mov vf7 a2-10) - ) - (.lvf vf5 (&-> a0-23 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 (&-> a1-9 quad) vf6) - ) - (set! (-> self enemy-flags) - (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) - ) - (send-event self 'jump 0 gp-3) - ) - (until #f - (suspend) - ) - #f ) + (let ((v1-21 (-> self root root-prim))) + (set! (-> v1-21 prim-core collide-as) (collide-spec)) + (set! (-> v1-21 prim-core collide-with) (collide-spec)) + ) + 0 + (set! (-> self ambush?) #t) + (let ((f30-0 (rnd-float-range self 1.2 1.25)) + (f28-0 0.0) + ) + (ja-no-eval :group! marauder-male-run0-ja :num! (seek! max f30-0) :frame-num 0.0) + (until (ja-done? 0) + (vector+*! + (-> self root trans) + (-> self root trans) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) + (* 24576.0 (seconds-per-frame)) + ) + (+! f28-0 (seconds-per-frame)) + (if (< 1.0 f28-0) + (set! f28-0 1.0) + ) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + (let ((v1-58 (-> self root root-prim))) + (set! (-> v1-58 prim-core collide-as) (-> self root backup-collide-as)) + (set! (-> v1-58 prim-core collide-with) (-> self root backup-collide-with)) + ) + (let ((gp-4 (new 'stack-no-clear 'vector))) + (vector-copy! gp-4 (-> self root trans)) + (let ((a0-21 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) + (vector+*! gp-4 gp-4 a0-21 61440.0) + ) + (vector+*! gp-4 gp-4 *y-vector* -81920.0) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) + (send-event self 'jump 0 gp-4) + ) + (until #f + (suspend) + ) + #f ) :post (behavior () (enemy-common-post self) diff --git a/goal_src/jak3/levels/desert/des-burning-bush.gc b/goal_src/jak3/levels/desert/des-burning-bush.gc index a68abe68dd..d1abf3544f 100644 --- a/goal_src/jak3/levels/desert/des-burning-bush.gc +++ b/goal_src/jak3/levels/desert/des-burning-bush.gc @@ -350,37 +350,15 @@ ) :code sleep-code :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let* ((a0-0 (-> *target* neck)) - (t9-0 (method-of-object a0-0 look-at!)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-5 (-> self root trans))) - (let ((a2-0 *up-vector*)) - (let ((a3-1 12288.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> v1-5 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-0 quad) vf6) - (t9-0 a0-0 a1-0 #f self) + (if *target* + (look-at! + (-> *target* neck) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 12288.0) + #f + self ) ) - (des-burning-bush-method-35 self) - ) + (des-burning-bush-method-35 self) ) ) @@ -428,52 +406,29 @@ (remove-setting! 'mode-name) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'des-burning-bush-stack-var0))) - (when (!= (-> self time) -1.0) - (quaternion-rotate-local-y! - (-> gp-0 quat) - (-> self root quat) - (lerp-scale (-> self rotmin) (-> self rotmax) (sin (* 7281.778 (-> self time))) -1.0 1.0) - ) - (vector-orient-by-quat! (-> gp-0 vec2) (new 'static 'vector :y 16384.0 :z 40960.0 :w 1.0) (-> gp-0 quat)) - (vector+! (-> gp-0 vec1) (-> self root trans) (-> gp-0 vec2)) - (vector-copy! (-> *camera* slave 0 trans) (-> gp-0 vec1)) - (let ((v1-10 (-> gp-0 vec2))) - (let ((a0-9 (-> self root trans))) - (let ((a1-4 *up-vector*)) - (let ((a2-4 12288.0)) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a1-4 quad)) - ) - (.lvf vf4 (&-> a0-9 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-10 quad) vf6) - ) - (vector-! (-> gp-0 vec3) (-> gp-0 vec2) (-> gp-0 vec1)) - (forward-down->inv-matrix (-> *camera* slave 0 tracking inv-mat) (-> gp-0 vec3) (-> *camera* local-down)) - ) - (matrix-copy! (-> gp-0 mat) (-> self node-list data 3 bone transform)) - (matrix->trans (-> gp-0 mat) (-> gp-0 vec2)) - (vector-! (-> gp-0 vec2) (camera-pos) (-> gp-0 vec2)) - (when (< (vector-dot (-> gp-0 mat fvec) (-> gp-0 vec2)) 0.0) - (matrix-rotate-y! (the-as matrix (-> gp-0 vec0)) 32768.0) - (matrix*! (-> gp-0 mat) (the-as matrix (-> gp-0 vec0)) (-> gp-0 mat)) + (let ((gp-0 (new 'stack-no-clear 'des-burning-bush-stack-var0))) + (when (!= (-> self time) -1.0) + (quaternion-rotate-local-y! + (-> gp-0 quat) + (-> self root quat) + (lerp-scale (-> self rotmin) (-> self rotmax) (sin (* 7281.778 (-> self time))) -1.0 1.0) ) + (vector-orient-by-quat! (-> gp-0 vec2) (new 'static 'vector :y 16384.0 :z 40960.0 :w 1.0) (-> gp-0 quat)) + (vector+! (-> gp-0 vec1) (-> self root trans) (-> gp-0 vec2)) + (vector-copy! (-> *camera* slave 0 trans) (-> gp-0 vec1)) + (vector+*! (-> gp-0 vec2) (-> self root trans) *up-vector* 12288.0) + (vector-! (-> gp-0 vec3) (-> gp-0 vec2) (-> gp-0 vec1)) + (forward-down->inv-matrix (-> *camera* slave 0 tracking inv-mat) (-> gp-0 vec3) (-> *camera* local-down)) + ) + (matrix-copy! (-> gp-0 mat) (-> self node-list data 3 bone transform)) + (matrix->trans (-> gp-0 mat) (-> gp-0 vec2)) + (vector-! (-> gp-0 vec2) (camera-pos) (-> gp-0 vec2)) + (when (< (vector-dot (-> gp-0 mat fvec) (-> gp-0 vec2)) 0.0) + (matrix-rotate-y! (the-as matrix (-> gp-0 vec0)) 32768.0) + (matrix*! (-> gp-0 mat) (the-as matrix (-> gp-0 vec0)) (-> gp-0 mat)) ) - (+! (-> self angle) (* 100.0 (rand-vu))) ) + (+! (-> self angle) (* 100.0 (rand-vu))) ) :code (behavior () (set-setting! 'mode-name 'cam-really-fixed 0.0 0) @@ -523,37 +478,15 @@ (go-virtual idle) ) :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let* ((a0-0 (-> *target* neck)) - (t9-0 (method-of-object a0-0 look-at!)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-5 (-> self root trans))) - (let ((a2-0 *up-vector*)) - (let ((a3-1 12288.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> v1-5 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-0 quad) vf6) - (t9-0 a0-0 a1-0 #f self) + (if *target* + (look-at! + (-> *target* neck) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 12288.0) + #f + self ) ) - (des-burning-bush-method-35 self) - ) + (des-burning-bush-method-35 self) ) ) @@ -769,50 +702,30 @@ (remove-setting! 'mode-name) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (and (time-elapsed? (-> self state-time) (seconds 1.5)) (not (-> self menu-exit?))) - (if (-> self menu-have-req?) - (des-burning-bush-method-37 self) - (des-burning-bush-method-38 self) - ) - ) - (when (!= (-> self time) -1.0) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (vector+! gp-0 (-> self root trans) (vector-orient-by-quat! - (new 'stack-no-clear 'vector) - (new 'static 'vector :y 24166.4 :z 32768.0 :w 1.0) - (-> self root quat) - ) - ) - (vector-copy! (-> *camera* slave 0 trans) gp-0) - (let ((t9-3 forward-down->inv-matrix) - (a0-7 (-> *camera* slave 0 tracking)) - (a1-1 (new 'stack-no-clear 'vector)) - (v1-23 (new 'stack-no-clear 'vector)) - ) - (let ((a2-2 (-> self root trans))) - (let ((a3-0 *up-vector*)) - (let ((t0-1 24166.4)) - (.mov vf7 t0-1) + (when (and (time-elapsed? (-> self state-time) (seconds 1.5)) (not (-> self menu-exit?))) + (if (-> self menu-have-req?) + (des-burning-bush-method-37 self) + (des-burning-bush-method-38 self) + ) + ) + (when (!= (-> self time) -1.0) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (vector+! gp-0 (-> self root trans) (vector-orient-by-quat! + (new 'stack-no-clear 'vector) + (new 'static 'vector :y 24166.4 :z 32768.0 :w 1.0) + (-> self root quat) + ) ) - (.lvf vf5 (&-> a3-0 quad)) - ) - (.lvf vf4 (&-> a2-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 (&-> v1-23 quad) vf6) - (t9-3 (-> a0-7 inv-mat) (vector-! a1-1 v1-23 gp-0) (-> *camera* local-down)) + (vector-copy! (-> *camera* slave 0 trans) gp-0) + (forward-down->inv-matrix + (-> *camera* slave 0 tracking inv-mat) + (vector-! + (new 'stack-no-clear 'vector) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 24166.4) + gp-0 ) + (-> *camera* local-down) ) ) ) @@ -879,37 +792,15 @@ (go-virtual idle) ) :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let* ((a0-0 (-> *target* neck)) - (t9-0 (method-of-object a0-0 look-at!)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-5 (-> self root trans))) - (let ((a2-0 *up-vector*)) - (let ((a3-1 20480.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> v1-5 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-0 quad) vf6) - (t9-0 a0-0 a1-0 #f self) + (if *target* + (look-at! + (-> *target* neck) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 20480.0) + #f + self ) ) - (des-burning-bush-method-35 self) - ) + (des-burning-bush-method-35 self) ) ) diff --git a/goal_src/jak3/levels/desert/des-cactus.gc b/goal_src/jak3/levels/desert/des-cactus.gc index 781f9f7a60..95c8f564cf 100644 --- a/goal_src/jak3/levels/desert/des-cactus.gc +++ b/goal_src/jak3/levels/desert/des-cactus.gc @@ -35,85 +35,52 @@ (defmethod des-plant-method-30 ((this des-plant)) - (local-vars (v1-2 float) (v1-16 float) (v1-21 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((v1-0 (new 'stack-no-clear 'vector))) - (set! (-> v1-0 x) (seconds-per-frame)) - (set! (-> v1-0 y) 500.0) - (set! (-> v1-0 z) 10.0) - (vector+float*! - (-> this spring-vel) - (-> this spring-vel) - (-> this spring-pos) - (* -1.0 (-> v1-0 x) (-> v1-0 y)) - ) - (vector-float*! (-> this spring-vel) (-> this spring-vel) (fmax 0.0 (+ 1.0 (* -1.0 (-> v1-0 z) (-> v1-0 x))))) - (vector+float*! (-> this spring-pos) (-> this spring-pos) (-> this spring-vel) (-> v1-0 x)) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (set! (-> v1-0 x) (seconds-per-frame)) + (set! (-> v1-0 y) 500.0) + (set! (-> v1-0 z) 10.0) + (vector+float*! + (-> this spring-vel) + (-> this spring-vel) + (-> this spring-pos) + (* -1.0 (-> v1-0 x) (-> v1-0 y)) ) - (set! (-> this spring-pos y) 0.0) - (.lvf vf1 (&-> (-> this spring-pos) 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-2 vf1) - (let ((f0-10 v1-2)) - (when (< 1.0 f0-10) - (vector-float*! (-> this spring-pos) (-> this spring-pos) (/ 1.0 (sqrtf f0-10))) - (vector-reset! (-> this spring-vel)) - ) - ) - (let ((s5-0 (new 'stack-no-clear 'inline-array 'quaternion 10))) - (quaternion-conjugate! (-> s5-0 1) (-> this root quat)) - (quaternion->matrix (the-as matrix (-> s5-0 2)) (-> s5-0 1)) - (set! (-> s5-0 7 x) 2730.6667) - (set! (-> s5-0 7 z) (sin (/ (-> s5-0 7 x) 2))) - (set! (-> s5-0 7 y) (cos (/ (-> s5-0 7 x) 2))) - (vector-rotate90-around-y! (-> s5-0 6 vec) (-> this spring-pos)) - (vector-float*! (-> s5-0 6 vec) (-> s5-0 6 vec) (* -1.0 (-> s5-0 7 z))) - (vector-rotate*! (-> s5-0 6 vec) (-> s5-0 6 vec) (the-as matrix (-> s5-0 2))) - (set! (-> s5-0 0 x) (-> s5-0 6 x)) - (set! (-> s5-0 0 y) (-> s5-0 6 y)) - (set! (-> s5-0 0 z) (-> s5-0 6 z)) - (let ((f0-25 1.0)) - (.lvf vf1 (&-> (-> s5-0 6) 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-16 vf1) - (set! (-> s5-0 0 w) (sqrtf (- f0-25 v1-16))) - ) - (quaternion-copy! (-> this jmods 0 rotation) (-> s5-0 0)) - (vector-float*! (-> s5-0 6 vec) (-> s5-0 6 vec) 1.0) - (set! (-> s5-0 0 x) (-> s5-0 6 x)) - (set! (-> s5-0 0 y) (-> s5-0 6 y)) - (set! (-> s5-0 0 z) (-> s5-0 6 z)) - (let ((f0-32 1.0)) - (.lvf vf1 (&-> (-> s5-0 6) 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-21 vf1) - (set! (-> s5-0 0 w) (sqrtf (- f0-32 v1-21))) - ) - (quaternion-copy! (-> this jmods 1 rotation) (-> s5-0 0)) - (quaternion-copy! (-> this jmods 2 rotation) (-> s5-0 0)) - (quaternion-copy! (-> this jmods 3 rotation) (-> s5-0 0)) - ) - (ja-post) - 0 - (none) + (vector-float*! (-> this spring-vel) (-> this spring-vel) (fmax 0.0 (+ 1.0 (* -1.0 (-> v1-0 z) (-> v1-0 x))))) + (vector+float*! (-> this spring-pos) (-> this spring-pos) (-> this spring-vel) (-> v1-0 x)) ) + (set! (-> this spring-pos y) 0.0) + (let ((f0-10 (vector-length-squared (-> this spring-pos)))) + (when (< 1.0 f0-10) + (vector-float*! (-> this spring-pos) (-> this spring-pos) (/ 1.0 (sqrtf f0-10))) + (vector-reset! (-> this spring-vel)) + ) + ) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'quaternion 10))) + (quaternion-conjugate! (-> s5-0 1) (-> this root quat)) + (quaternion->matrix (the-as matrix (-> s5-0 2)) (-> s5-0 1)) + (set! (-> s5-0 7 x) 2730.6667) + (set! (-> s5-0 7 z) (sin (/ (-> s5-0 7 x) 2))) + (set! (-> s5-0 7 y) (cos (/ (-> s5-0 7 x) 2))) + (vector-rotate90-around-y! (-> s5-0 6 vec) (-> this spring-pos)) + (vector-float*! (-> s5-0 6 vec) (-> s5-0 6 vec) (* -1.0 (-> s5-0 7 z))) + (vector-rotate*! (-> s5-0 6 vec) (-> s5-0 6 vec) (the-as matrix (-> s5-0 2))) + (set! (-> s5-0 0 x) (-> s5-0 6 x)) + (set! (-> s5-0 0 y) (-> s5-0 6 y)) + (set! (-> s5-0 0 z) (-> s5-0 6 z)) + (set! (-> s5-0 0 w) (sqrtf (- 1.0 (vector-length-squared (-> s5-0 6 vec))))) + (quaternion-copy! (-> this jmods 0 rotation) (-> s5-0 0)) + (vector-float*! (-> s5-0 6 vec) (-> s5-0 6 vec) 1.0) + (set! (-> s5-0 0 x) (-> s5-0 6 x)) + (set! (-> s5-0 0 y) (-> s5-0 6 y)) + (set! (-> s5-0 0 z) (-> s5-0 6 z)) + (set! (-> s5-0 0 w) (sqrtf (- 1.0 (vector-length-squared (-> s5-0 6 vec))))) + (quaternion-copy! (-> this jmods 1 rotation) (-> s5-0 0)) + (quaternion-copy! (-> this jmods 2 rotation) (-> s5-0 0)) + (quaternion-copy! (-> this jmods 3 rotation) (-> s5-0 0)) + ) + (ja-post) + 0 + (none) ) (defmethod des-plant-method-31 ((this des-plant)) 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 836c4fc094..d8913399a3 100644 --- a/goal_src/jak3/levels/desert/hover/des-beast-2.gc +++ b/goal_src/jak3/levels/desert/hover/des-beast-2.gc @@ -50,72 +50,49 @@ (defstate idle (quantum-reflector) :virtual #t :enter (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (set-time! (-> self state-time)) - (set-vector! (-> self root scale) 2.0 2.0 2.0 1.0) - (logclear! (-> self mask) (process-mask actor-pause)) - (let ((v1-8 (-> self entity extra perm))) - (set! (-> self root trans x) (* 4096.0 (the float (-> v1-8 user-int16 0)))) - (set! (-> self root trans y) (* 4096.0 (the float (-> v1-8 user-int16 1)))) - (set! (-> self root trans z) (* 4096.0 (the float (-> v1-8 user-int16 2)))) - ) - (let ((gp-0 (new 'stack-no-clear 'collide-query))) - (set-vector! (-> gp-0 move-dist) 0.0 -204800.0 0.0 1.0) - (vector-copy! (-> gp-0 start-pos) (-> self root trans)) - (+! (-> gp-0 start-pos y) 102400.0) - (let ((v1-15 gp-0)) - (set! (-> v1-15 radius) 409.6) - (set! (-> v1-15 collide-with) (collide-spec backgnd)) - (set! (-> v1-15 ignore-process0) #f) - (set! (-> v1-15 ignore-process1) #f) - (set! (-> v1-15 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-15 action-mask) (collide-action solid)) - ) - (let ((f0-17 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) - (cond - ((>= f0-17 0.0) - (let ((a0-22 (-> self root trans))) - (let ((v1-19 (-> gp-0 start-pos))) - (let ((a1-1 (-> gp-0 move-dist))) - (let ((a2-0 f0-17)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a1-1 quad)) - ) - (.lvf vf4 (&-> v1-19 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-22 quad) vf6) - ) - (+! (-> self root trans y) 10240.0) - ) - (else - (format 0 "~A failed to find ground~%" (-> self name)) + (set-time! (-> self state-time)) + (set-vector! (-> self root scale) 2.0 2.0 2.0 1.0) + (logclear! (-> self mask) (process-mask actor-pause)) + (let ((v1-8 (-> self entity extra perm))) + (set! (-> self root trans x) (* 4096.0 (the float (-> v1-8 user-int16 0)))) + (set! (-> self root trans y) (* 4096.0 (the float (-> v1-8 user-int16 1)))) + (set! (-> self root trans z) (* 4096.0 (the float (-> v1-8 user-int16 2)))) + ) + (let ((gp-0 (new 'stack-no-clear 'collide-query))) + (set-vector! (-> gp-0 move-dist) 0.0 -204800.0 0.0 1.0) + (vector-copy! (-> gp-0 start-pos) (-> self root trans)) + (+! (-> gp-0 start-pos y) 102400.0) + (let ((v1-15 gp-0)) + (set! (-> v1-15 radius) 409.6) + (set! (-> v1-15 collide-with) (collide-spec backgnd)) + (set! (-> v1-15 ignore-process0) #f) + (set! (-> v1-15 ignore-process1) #f) + (set! (-> v1-15 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) + (set! (-> v1-15 action-mask) (collide-action solid)) + ) + (let ((f0-17 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) + (cond + ((>= f0-17 0.0) + (vector+*! (-> self root trans) (-> gp-0 start-pos) (-> gp-0 move-dist) f0-17) + (+! (-> self root trans y) 10240.0) + ) + (else + (format 0 "~A failed to find ground~%" (-> self name)) ) ) ) - (set! (-> self minimap) (add-icon! *minimap* self (the-as uint 12) (the-as int #f) (the-as vector #t) 0)) - (let ((gp-1 (new 'stack-no-clear 'task-arrow-params))) - (vector-copy! (-> gp-1 pos) (-> self root trans)) - (quaternion-identity! (-> gp-1 quat)) - (set! (-> gp-1 flags) (task-arrow-flags taf3 taf5)) - (set! (-> gp-1 map-icon) (the-as uint 12)) - (set! (-> self rod) (process->handle (task-arrow-spawn gp-1 self))) - ) - (ja-no-eval :group! quantum-reflector-idle-ja :num! zero) ) + (set! (-> self minimap) (add-icon! *minimap* self (the-as uint 12) (the-as int #f) (the-as vector #t) 0)) + (let ((gp-1 (new 'stack-no-clear 'task-arrow-params))) + (vector-copy! (-> gp-1 pos) (-> self root trans)) + (quaternion-identity! (-> gp-1 quat)) + (set! (-> gp-1 flags) (task-arrow-flags taf3 taf5)) + (set! (-> gp-1 map-icon) (the-as uint 12)) + (set! (-> self rod) (process->handle (task-arrow-spawn gp-1 self))) + ) + (ja-no-eval :group! quantum-reflector-idle-ja :num! zero) ) :exit (behavior () (send-event (handle->process (-> self rod)) 'die) diff --git a/goal_src/jak3/levels/desert/hover/des-beast.gc b/goal_src/jak3/levels/desert/hover/des-beast.gc index 06f543f693..4f8f43331a 100644 --- a/goal_src/jak3/levels/desert/hover/des-beast.gc +++ b/goal_src/jak3/levels/desert/hover/des-beast.gc @@ -1400,54 +1400,26 @@ (define *beast-camera-slow-motion* (new 'static 'vector)) (defbehavior des-beast-active-post des-beast () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 *target*) - (s4-0 (new 'stack-no-clear 'vector)) - (gp-0 (new 'stack-no-clear 'vector)) - ) - (when s5-0 - (vector-! s4-0 (-> self root trans) (get-trans s5-0 0)) - (vector-normalize! s4-0 1.0) - (vector-rotate90-around-y! gp-0 s4-0) - (let ((s3-3 (-> self target-gun-pos))) - (let ((s2-1 (get-trans s5-0 0))) - (let ((v1-8 (* 0.5 (vector-length (get-transv s5-0))))) - (.mov vf7 v1-8) - ) - (.lvf vf5 (&-> s4-0 quad)) - (.lvf vf4 (&-> s2-1 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 (&-> s3-3 quad) vf6) - ) - (let ((s3-4 (-> self target-gun-pos))) - (let ((s4-1 (-> self target-gun-pos))) - (let ((v1-13 (* 0.2 (vector-length (get-transv s5-0)) (rand-vu-float-range -1.0 1.0)))) - (.mov vf7 v1-13) - ) - (.lvf vf5 (&-> gp-0 quad)) - (.lvf vf4 (&-> s4-1 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 (&-> s3-4 quad) vf6) - ) + (let ((s5-0 *target*) + (s4-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (when s5-0 + (vector-! s4-0 (-> self root trans) (get-trans s5-0 0)) + (vector-normalize! s4-0 1.0) + (vector-rotate90-around-y! gp-0 s4-0) + (vector+*! (-> self target-gun-pos) (get-trans s5-0 0) s4-0 (* 0.5 (vector-length (get-transv s5-0)))) + (vector+*! + (-> self target-gun-pos) + (-> self target-gun-pos) + gp-0 + (* 0.2 (vector-length (get-transv s5-0)) (rand-vu-float-range -1.0 1.0)) ) ) - (enemy-common-post self) - 0 - (none) ) + (enemy-common-post self) + 0 + (none) ) (defstate idle (des-beast) diff --git a/goal_src/jak3/levels/desert/hover/mh-flyer.gc b/goal_src/jak3/levels/desert/hover/mh-flyer.gc index f6079483b0..2854337783 100644 --- a/goal_src/jak3/levels/desert/hover/mh-flyer.gc +++ b/goal_src/jak3/levels/desert/hover/mh-flyer.gc @@ -995,18 +995,13 @@ ) (seek! (-> self pitch-angle) f0-6 (* 32768.0 (seconds-per-frame))) ) - (vector-rotate-around-axis! - gp-0 - (the-as quaternion *y-vector*) - (-> self pitch-angle) - (-> self rotation-matrix rvec) - ) + (vector-rotate-around-axis! gp-0 *y-vector* (-> self pitch-angle) (-> self rotation-matrix rvec)) (let* ((v1-25 (vector-flatten! (new 'stack-no-clear 'vector) s5-0 *y-vector*)) (f0-12 (lerp-scale -15473.777 15473.777 (vector-dot (-> self rotation-matrix rvec) v1-25) 131072.0 -131072.0)) ) (seek! (-> self bank-angle) f0-12 (* 10922.667 (seconds-per-frame))) ) - (vector-rotate-around-axis! gp-0 (the-as quaternion gp-0) (-> self bank-angle) (-> self rotation-matrix fvec)) + (vector-rotate-around-axis! gp-0 gp-0 (-> self bank-angle) (-> self rotation-matrix fvec)) (let ((s5-1 (new 'stack-no-clear 'inline-array 'vector 2))) (vector-copy! (-> s5-1 1) (-> self root transv)) (vector-normalize! (-> s5-1 1) 1.0) diff --git a/goal_src/jak3/levels/desert/rescue/desert-rescue.gc b/goal_src/jak3/levels/desert/rescue/desert-rescue.gc index 92848c3791..b03b96aff4 100644 --- a/goal_src/jak3/levels/desert/rescue/desert-rescue.gc +++ b/goal_src/jak3/levels/desert/rescue/desert-rescue.gc @@ -1510,7 +1510,7 @@ (else (vector-cross! s4-0 s5-0 s3-1) (let ((f0-6 (fmin (acos f0-4) (* 5461.3335 (seconds-per-frame))))) - (vector-rotate-around-axis! s5-0 (the-as quaternion s5-0) f0-6 s4-0) + (vector-rotate-around-axis! s5-0 s5-0 f0-6 s4-0) ) ) ) diff --git a/goal_src/jak3/levels/desert/rescue/rope-system.gc b/goal_src/jak3/levels/desert/rescue/rope-system.gc index 79ff4e66ed..20fafe3e6b 100644 --- a/goal_src/jak3/levels/desert/rescue/rope-system.gc +++ b/goal_src/jak3/levels/desert/rescue/rope-system.gc @@ -125,7 +125,7 @@ ) (vector-cross! s0-0 s2-1 (-> s1-0 dir)) (vector-normalize! s0-0 1.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s0-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s0-0) ) (vector-normalize! s2-1 1.0) (if (< s5-0 (+ (-> this knot-constraints length) -1)) @@ -231,8 +231,8 @@ (.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 (the-as quaternion sv-240) f24-0 s0-0) - (vector-rotate-around-axis! sv-256 (the-as quaternion sv-256) f24-0 s0-0) + (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 diff --git a/goal_src/jak3/levels/desert/rescue/wland-passenger.gc b/goal_src/jak3/levels/desert/rescue/wland-passenger.gc index 6efe5fc4e7..d1f67f5707 100644 --- a/goal_src/jak3/levels/desert/rescue/wland-passenger.gc +++ b/goal_src/jak3/levels/desert/rescue/wland-passenger.gc @@ -424,70 +424,18 @@ ) (defun do-spline3 ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((f1-1 (* arg5 arg5)) + (f0-2 (* arg5 f1-1)) ) - (init-vf0-vector) - (let* ((f1-1 (* arg5 arg5)) - (f0-2 (* arg5 f1-1)) - ) - (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) - (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) - (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) - ) - (vector-float*! arg0 arg1 f2-3) - (let ((t2-0 arg0)) - (let ((v1-10 arg0)) - (let ((t1-3 (vector+! (new 'stack-no-clear 'vector) arg1 arg2))) - (let ((a1-1 f3-7)) - (.mov vf7 a1-1) - ) - (.lvf vf5 (&-> t1-3 quad)) - ) - (.lvf vf4 (&-> v1-10 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 (&-> t2-0 quad) vf6) + (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) + (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) + (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) ) - (let ((a2-1 arg0)) - (let ((v1-11 arg0)) - (let ((a1-3 (vector+! (new 'stack-no-clear 'vector) arg3 arg4))) - (let ((t0-1 f1-3)) - (.mov vf7 t0-1) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> v1-11 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-1 quad) vf6) - ) - ) - (let ((v0-0 arg0)) - (let ((v1-12 arg0)) - (let ((a0-1 arg3)) - (let ((a1-4 f0-2)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-12 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 (&-> v0-0 quad) vf6) - v0-0 - ) + (vector-float*! arg0 arg1 f2-3) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg1 arg2) f3-7) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg3 arg4) f1-3) ) + (vector+*! arg0 arg0 arg3 f0-2) ) ) 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 ffa64efb5c..947e93c719 100644 --- a/goal_src/jak3/levels/desert/wvehicle/was-squad-control.gc +++ b/goal_src/jak3/levels/desert/wvehicle/was-squad-control.gc @@ -285,63 +285,46 @@ ) (defmethod update ((this was-squad-control)) - (local-vars (a0-14 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (set-sync-mask this) - (set! (-> this nav-mesh) (find-nearest-nav-mesh (target-pos 0) (the-as float #x7f800000))) - (if (not (-> this nav-mesh)) - (set! (-> this nav-mesh) (get-nav-mesh (the-as actor-id #xa7d6))) + (set-sync-mask this) + (set! (-> this nav-mesh) (find-nearest-nav-mesh (target-pos 0) (the-as float #x7f800000))) + (if (not (-> this nav-mesh)) + (set! (-> this nav-mesh) (get-nav-mesh (the-as actor-id #xa7d6))) + ) + (let ((s5-1 (new 'stack-no-clear 'inline-array 'matrix 2)) + (v1-8 (as-type (handle->process (-> this alert-state target-status handle)) process-focusable)) ) - (let ((s5-1 (new 'stack-no-clear 'inline-array 'matrix 2)) - (v1-8 (as-type (handle->process (-> this alert-state target-status handle)) process-focusable)) + (when v1-8 + (vector-copy! (-> s5-1 0 uvec) (-> (the-as process-focusable v1-8) root trans)) + (vector-copy! (-> s5-1 0 fvec) (-> (the-as process-focusable v1-8) root transv)) + (if (< 8192.0 (vector-length-squared (-> s5-1 0 fvec))) + (vector-copy! (-> s5-1 0 trans) (-> s5-1 0 fvec)) + (vector-copy! (-> s5-1 0 trans) (-> (the-as process-focusable v1-8) node-list data 0 bone transform fvec)) ) - (when v1-8 - (vector-copy! (-> s5-1 0 uvec) (-> (the-as process-focusable v1-8) root trans)) - (vector-copy! (-> s5-1 0 fvec) (-> (the-as process-focusable v1-8) root transv)) - (let ((f0-0 8192.0)) - (.lvf vf1 (&-> (-> s5-1 0 fvec) 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-14 vf1) - (if (< f0-0 a0-14) - (vector-copy! (-> s5-1 0 trans) (-> s5-1 0 fvec)) - (vector-copy! (-> s5-1 0 trans) (-> (the-as process-focusable v1-8) node-list data 0 bone transform fvec)) - ) - ) - (set! (-> s5-1 0 trans y) 0.0) - (vector-normalize! (-> s5-1 0 trans) 1.0) - (vector-rotate-around-y! (-> s5-1 1 rvec) (-> s5-1 0 trans) 14563.556) - (vector-rotate-around-y! (-> s5-1 1 uvec) (-> s5-1 0 trans) -14563.556) - (set! (-> s5-1 1 rvec w) (- (vector-dot (-> s5-1 1 rvec) (-> s5-1 0 uvec)))) - (set! (-> s5-1 1 uvec w) (- (vector-dot (-> s5-1 1 uvec) (-> s5-1 0 uvec)))) - (dotimes (s4-1 10) - (let ((s3-0 (as-type (handle->process (-> this units s4-1)) process-focusable))) - (when (and s3-0 - (not (focus-test? (the-as process-focusable s3-0) dead)) - (time-elapsed? (-> (the-as process-focusable s3-0) state-time) (seconds 2)) - ) - (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)) - ) + (set! (-> s5-1 0 trans y) 0.0) + (vector-normalize! (-> s5-1 0 trans) 1.0) + (vector-rotate-around-y! (-> s5-1 1 rvec) (-> s5-1 0 trans) 14563.556) + (vector-rotate-around-y! (-> s5-1 1 uvec) (-> s5-1 0 trans) -14563.556) + (set! (-> s5-1 1 rvec w) (- (vector-dot (-> s5-1 1 rvec) (-> s5-1 0 uvec)))) + (set! (-> s5-1 1 uvec w) (- (vector-dot (-> s5-1 1 uvec) (-> s5-1 0 uvec)))) + (dotimes (s4-1 10) + (let ((s3-0 (as-type (handle->process (-> this units s4-1)) process-focusable))) + (when (and s3-0 + (not (focus-test? (the-as process-focusable s3-0) dead)) + (time-elapsed? (-> (the-as process-focusable s3-0) state-time) (seconds 2)) + ) + (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)) ) ) ) @@ -350,62 +333,62 @@ ) ) ) - (let ((s5-2 0) - (s4-2 0) - ) - (dotimes (s3-1 10) - (let ((v1-62 (as-type (handle->process (-> this units s3-1)) process-focusable))) - (when v1-62 - (+! s5-2 1) - (if (not (focus-test? (the-as process-focusable v1-62) dead)) - (+! s4-2 1) - ) - ) + ) + (let ((s5-2 0) + (s4-2 0) + ) + (dotimes (s3-1 10) + (let ((v1-62 (as-type (handle->process (-> this units s3-1)) process-focusable))) + (when v1-62 + (+! s5-2 1) + (if (not (focus-test? (the-as process-focusable v1-62) dead)) + (+! s4-2 1) + ) ) ) - (set! (-> this process-count) s5-2) - (set! (-> this active-count) s4-2) ) - 0 - (let ((a1-20 (as-type (handle->process (-> this alert-state target-status handle)) process-focusable))) - (cond - (a1-20 - (let ((v1-71 (new 'stack-no-clear 'matrix))) - (vector-copy! (-> v1-71 rvec) (-> (the-as process-focusable a1-20) root trans)) - (cond - ((and (< (-> this active-count) (-> this target-count)) - (> (-> this reserve-count) 0) - (< (-> this process-count) 10) - (-> this nav-mesh) - (not (logtest? (-> this nav-mesh flags) (nav-mesh-flag water))) - (nav-mesh-method-11 (-> this nav-mesh) (-> v1-71 rvec)) - ) - (let ((v1-73 (new 'stack-no-clear 'array 'uint32 1))) - (set! (-> v1-73 0) (the-as uint (current-time))) - (if (and (< (the-as uint 300) (- (-> v1-73 0) (-> this spawnable-time))) - (< (-> this spawn-delay) (- (-> v1-73 0) (-> this spawn-time))) - ) - (spawn-unit-offscreen this) - ) - ) + (set! (-> this process-count) s5-2) + (set! (-> this active-count) s4-2) + ) + 0 + (let ((a1-20 (as-type (handle->process (-> this alert-state target-status handle)) process-focusable))) + (cond + (a1-20 + (let ((v1-71 (new 'stack-no-clear 'matrix))) + (vector-copy! (-> v1-71 rvec) (-> (the-as process-focusable a1-20) root trans)) + (cond + ((and (< (-> this active-count) (-> this target-count)) + (> (-> this reserve-count) 0) + (< (-> this process-count) 10) + (-> this nav-mesh) + (not (logtest? (-> this nav-mesh flags) (nav-mesh-flag water))) + (nav-mesh-method-11 (-> this nav-mesh) (-> v1-71 rvec)) + ) + (let ((v1-73 (new 'stack-no-clear 'array 'uint32 1))) + (set! (-> v1-73 0) (the-as uint (current-time))) + (if (and (< (the-as uint 300) (- (-> v1-73 0) (-> this spawnable-time))) + (< (-> this spawn-delay) (- (-> v1-73 0) (-> this spawn-time))) + ) + (spawn-unit-offscreen this) + ) ) - (else - (set! (-> this spawnable-time) (the-as uint (current-time))) - ) + ) + (else + (set! (-> this spawnable-time) (the-as uint (current-time))) ) ) ) - (else - (when *target* - (format #t "was-squad-control::update: setting target~%") - (set! (-> this alert-state target-status handle) (process->handle *target*)) - ) + ) + (else + (when *target* + (format #t "was-squad-control::update: setting target~%") + (set! (-> this alert-state target-status handle) (process->handle *target*)) ) ) ) - 0 - (none) ) + 0 + (none) ) (define *was-squad-control* (new 'static 'was-squad-control)) diff --git a/goal_src/jak3/levels/desert/wvehicle/wcar-projectiles.gc b/goal_src/jak3/levels/desert/wvehicle/wcar-projectiles.gc index 0c16a59f39..23f0fb0509 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wcar-projectiles.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wcar-projectiles.gc @@ -260,55 +260,33 @@ ) (defmethod projectile-method-25 ((this v-rhino-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (set! (-> *part-id-table* 980 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 980) a1-0 s5-1 #f) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 981) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f26-0 (/ f30-0 (meters 30))) - (f30-1 (-> *part-id-table* 982 init-specs 3 initial-valuef)) - (f28-0 (-> *part-id-table* 982 init-specs 5 initial-valuef)) - ) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 982 init-specs 3 initial-valuef) (* f26-0 f30-1)) - (set! (-> *part-id-table* 982 init-specs 5 initial-valuef) (* f26-0 f28-0)) - (launch-particles (-> *part-id-table* 982) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 982 init-specs 3 initial-valuef) f30-1) - (set! (-> *part-id-table* 982 init-specs 5 initial-valuef) f28-0) - ) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (set! (-> *part-id-table* 980 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 980) a1-0 s5-1 #f) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 981) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f26-0 (/ f30-0 (meters 30))) + (f30-1 (-> *part-id-table* 982 init-specs 3 initial-valuef)) + (f28-0 (-> *part-id-table* 982 init-specs 5 initial-valuef)) + ) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 982 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 982 init-specs 5 initial-valuef) (* f26-0 f28-0)) + (launch-particles (-> *part-id-table* 982) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 982 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 982 init-specs 5 initial-valuef) f28-0) ) - 0 - (none) ) + 0 + (none) ) (defmethod projectile-method-26 ((this v-rhino-shot)) diff --git a/goal_src/jak3/levels/desert/wvehicle/wcar-turtle.gc b/goal_src/jak3/levels/desert/wvehicle/wcar-turtle.gc index 7da9b5be74..eec1ee6064 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wcar-turtle.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wcar-turtle.gc @@ -112,121 +112,88 @@ ) (defmethod vehicle-method-79 ((this v-turtle)) - (local-vars (v1-33 float) (v1-47 float) (v1-52 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (set-vector! (-> this root scale) 1.0 1.0 1.07 1.0) - (let ((s5-0 (new 'stack-no-clear 'inline-array 'quaternion 3))) - (set-vector! (-> s5-0 2) -3640.889 3640.889 3640.889 -3640.889) - (dotimes (s4-0 (-> this info physics-model wheel-count)) - (let ((v1-6 (-> this wheel s4-0))) - (-> v1-6 info) - (let ((s3-0 (-> this jmod-axles s4-0))) - (quaternion-set! - (-> s5-0 0) - 0.0 - 0.0 - (* (-> v1-6 sin-susp-ang) (-> v1-6 x-scale)) - (+ 1.0 (-> v1-6 cos-susp-ang)) - ) - (quaternion-normalize! (-> s5-0 0)) - (quaternion-axis-angle! (-> s5-0 1) 0.0 1.0 0.0 (-> (&-> s5-0 0 data s4-0) 8)) - (quaternion*! (-> s3-0 rotation) (-> s5-0 0) (-> s5-0 1)) + (set-vector! (-> this root scale) 1.0 1.0 1.07 1.0) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'quaternion 3))) + (set-vector! (-> s5-0 2) -3640.889 3640.889 3640.889 -3640.889) + (dotimes (s4-0 (-> this info physics-model wheel-count)) + (let ((v1-6 (-> this wheel s4-0))) + (-> v1-6 info) + (let ((s3-0 (-> this jmod-axles s4-0))) + (quaternion-set! + (-> s5-0 0) + 0.0 + 0.0 + (* (-> v1-6 sin-susp-ang) (-> v1-6 x-scale)) + (+ 1.0 (-> v1-6 cos-susp-ang)) ) + (quaternion-normalize! (-> s5-0 0)) + (quaternion-axis-angle! (-> s5-0 1) 0.0 1.0 0.0 (-> (&-> s5-0 0 data s4-0) 8)) + (quaternion*! (-> s3-0 rotation) (-> s5-0 0) (-> s5-0 1)) ) - 0 ) + 0 ) - (let ((s5-1 (new 'stack-no-clear 'wvehicle-physics-work))) - (set! (-> s5-1 mat trans x) (seconds-per-frame)) - (vector-matrix*! (-> s5-1 mat uvec) (new 'static 'vector :y 20480.0 :z -8192.0 :w 1.0) (-> this rbody matrix)) - (rigid-body-control-method-23 (-> this rbody) (-> s5-1 mat uvec) (-> s5-1 mat rvec)) - (vector-! (-> s5-1 mat fvec) (-> s5-1 mat rvec) (-> this ant-tip-vel)) - (vector-copy! (-> this ant-tip-vel) (-> s5-1 mat rvec)) - (vector-float*! (-> s5-1 mat fvec) (-> s5-1 mat fvec) (/ 1.0 (-> s5-1 mat trans x))) - (vector+float*! - (-> this spring-vel) - (-> this spring-vel) - (-> s5-1 mat fvec) - (/ (-> s5-1 mat trans x) (meters -1)) - ) - (set! (-> s5-1 mat trans y) 500.0) - (set! (-> s5-1 mat trans z) 5.0) - (vector+float*! - (-> this spring-vel) - (-> this spring-vel) - (-> this spring-pos) - (* -1.0 (-> s5-1 mat trans x) (-> s5-1 mat trans y)) - ) - (vector-float*! - (-> this spring-vel) - (-> this spring-vel) - (fmax 0.0 (+ 1.0 (* -1.0 (-> s5-1 mat trans z) (-> s5-1 mat trans x)))) - ) - (vector+float*! (-> this spring-pos) (-> this spring-pos) (-> this spring-vel) (-> s5-1 mat trans x)) - ) - (set! (-> this spring-pos y) 0.0) - (.lvf vf1 (&-> (-> this spring-pos) 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-33 vf1) - (let ((f0-27 v1-33)) - (when (< 1.0 f0-27) - (vector-float*! (-> this spring-pos) (-> this spring-pos) (/ 1.0 (sqrtf f0-27))) - (vector-reset! (-> this spring-vel)) - ) - ) - (let ((s5-2 (new 'stack-no-clear 'wvehicle-jmod-work))) - (quaternion-conjugate! (-> s5-2 quat1) (-> this root quat)) - (quaternion->matrix (-> s5-2 mat0) (-> s5-2 quat1)) - (set! (-> s5-2 float0) 8192.0) - (set! (-> s5-2 float2) (sin (/ (-> s5-2 float0) 2))) - (set! (-> s5-2 float1) (cos (/ (-> s5-2 float0) 2))) - (vector-rotate90-around-y! (-> s5-2 vec0) (-> this spring-pos)) - (vector-float*! (-> s5-2 vec0) (-> s5-2 vec0) (* -1.0 (-> s5-2 float2))) - (vector-rotate*! (-> s5-2 vec0) (-> s5-2 vec0) (-> s5-2 mat0)) - (set! (-> s5-2 quat0 x) (-> s5-2 vec0 x)) - (set! (-> s5-2 quat0 y) (-> s5-2 vec0 y)) - (set! (-> s5-2 quat0 z) (-> s5-2 vec0 z)) - (let ((f0-42 1.0)) - (.lvf vf1 (&-> (-> s5-2 vec0) 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-47 vf1) - (set! (-> s5-2 quat0 w) (sqrtf (- f0-42 v1-47))) - ) - (quaternion-copy! (-> this jmod-antenna 0 rotation) (-> s5-2 quat0)) - (vector-float*! (-> s5-2 vec0) (-> s5-2 vec0) 1.0) - (set! (-> s5-2 quat0 x) (-> s5-2 vec0 x)) - (set! (-> s5-2 quat0 y) (-> s5-2 vec0 y)) - (set! (-> s5-2 quat0 z) (-> s5-2 vec0 z)) - (let ((f0-49 1.0)) - (.lvf vf1 (&-> (-> s5-2 vec0) 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-52 vf1) - (set! (-> s5-2 quat0 w) (sqrtf (- f0-49 v1-52))) - ) - (quaternion-copy! (-> this jmod-antenna 1 rotation) (-> s5-2 quat0)) - (quaternion-copy! (-> this jmod-antenna 2 rotation) (-> s5-2 quat0)) - (quaternion-copy! (-> this jmod-antenna 3 rotation) (-> s5-2 quat0)) - ) - 0 - (none) ) + (let ((s5-1 (new 'stack-no-clear 'wvehicle-physics-work))) + (set! (-> s5-1 mat trans x) (seconds-per-frame)) + (vector-matrix*! (-> s5-1 mat uvec) (new 'static 'vector :y 20480.0 :z -8192.0 :w 1.0) (-> this rbody matrix)) + (rigid-body-control-method-23 (-> this rbody) (-> s5-1 mat uvec) (-> s5-1 mat rvec)) + (vector-! (-> s5-1 mat fvec) (-> s5-1 mat rvec) (-> this ant-tip-vel)) + (vector-copy! (-> this ant-tip-vel) (-> s5-1 mat rvec)) + (vector-float*! (-> s5-1 mat fvec) (-> s5-1 mat fvec) (/ 1.0 (-> s5-1 mat trans x))) + (vector+float*! + (-> this spring-vel) + (-> this spring-vel) + (-> s5-1 mat fvec) + (/ (-> s5-1 mat trans x) (meters -1)) + ) + (set! (-> s5-1 mat trans y) 500.0) + (set! (-> s5-1 mat trans z) 5.0) + (vector+float*! + (-> this spring-vel) + (-> this spring-vel) + (-> this spring-pos) + (* -1.0 (-> s5-1 mat trans x) (-> s5-1 mat trans y)) + ) + (vector-float*! + (-> this spring-vel) + (-> this spring-vel) + (fmax 0.0 (+ 1.0 (* -1.0 (-> s5-1 mat trans z) (-> s5-1 mat trans x)))) + ) + (vector+float*! (-> this spring-pos) (-> this spring-pos) (-> this spring-vel) (-> s5-1 mat trans x)) + ) + (set! (-> this spring-pos y) 0.0) + (let ((f0-27 (vector-length-squared (-> this spring-pos)))) + (when (< 1.0 f0-27) + (vector-float*! (-> this spring-pos) (-> this spring-pos) (/ 1.0 (sqrtf f0-27))) + (vector-reset! (-> this spring-vel)) + ) + ) + (let ((s5-2 (new 'stack-no-clear 'wvehicle-jmod-work))) + (quaternion-conjugate! (-> s5-2 quat1) (-> this root quat)) + (quaternion->matrix (-> s5-2 mat0) (-> s5-2 quat1)) + (set! (-> s5-2 float0) 8192.0) + (set! (-> s5-2 float2) (sin (/ (-> s5-2 float0) 2))) + (set! (-> s5-2 float1) (cos (/ (-> s5-2 float0) 2))) + (vector-rotate90-around-y! (-> s5-2 vec0) (-> this spring-pos)) + (vector-float*! (-> s5-2 vec0) (-> s5-2 vec0) (* -1.0 (-> s5-2 float2))) + (vector-rotate*! (-> s5-2 vec0) (-> s5-2 vec0) (-> s5-2 mat0)) + (set! (-> s5-2 quat0 x) (-> s5-2 vec0 x)) + (set! (-> s5-2 quat0 y) (-> s5-2 vec0 y)) + (set! (-> s5-2 quat0 z) (-> s5-2 vec0 z)) + (set! (-> s5-2 quat0 w) (sqrtf (- 1.0 (vector-length-squared (-> s5-2 vec0))))) + (quaternion-copy! (-> this jmod-antenna 0 rotation) (-> s5-2 quat0)) + (vector-float*! (-> s5-2 vec0) (-> s5-2 vec0) 1.0) + (set! (-> s5-2 quat0 x) (-> s5-2 vec0 x)) + (set! (-> s5-2 quat0 y) (-> s5-2 vec0 y)) + (set! (-> s5-2 quat0 z) (-> s5-2 vec0 z)) + (set! (-> s5-2 quat0 w) (sqrtf (- 1.0 (vector-length-squared (-> s5-2 vec0))))) + (quaternion-copy! (-> this jmod-antenna 1 rotation) (-> s5-2 quat0)) + (quaternion-copy! (-> this jmod-antenna 2 rotation) (-> s5-2 quat0)) + (quaternion-copy! (-> this jmod-antenna 3 rotation) (-> s5-2 quat0)) + ) + 0 + (none) ) (defmethod init-rbody-control! ((this v-turtle)) diff --git a/goal_src/jak3/levels/desert/wvehicle/wvehicle-ai.gc b/goal_src/jak3/levels/desert/wvehicle/wvehicle-ai.gc index 79b3c44c49..3a1647d21b 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wvehicle-ai.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wvehicle-ai.gc @@ -57,205 +57,188 @@ ) (defmethod control-hook-ai ((this wvehicle) (arg0 vehicle-controls)) - (local-vars (v1-50 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'wvehicle-physics-work))) - (mem-set32! (the-as pointer (-> gp-0 forward-dir)) 6 0) - (set! (-> gp-0 wsphere r) (seconds-per-frame)) - (set! (-> gp-0 friction-coef) (the-as float (current-time))) - (vehicle-method-140 this) - (set! (-> gp-0 mat rvec quad) (-> this rbody position quad)) - (vector-copy! (-> gp-0 mat uvec) (-> this rbody lin-velocity)) - (vector-copy! (-> gp-0 probe-dir) (-> this rbody matrix fvec)) - (vector-copy! (-> gp-0 steering-axis) (-> this rbody matrix rvec)) - (set! (-> gp-0 steering-axis y) 0.0) - (set! (-> gp-0 side-dir z) (vector-length (-> gp-0 mat uvec))) - (set! (-> gp-0 wheel-axis z) (vector-dot (-> gp-0 mat uvec) (-> gp-0 probe-dir))) - (cond - ((logtest? (vehicle-flag rammed-target) (-> this v-flags)) - (if (or (and (< (the-as uint 600) (- (the-as uint (-> gp-0 friction-coef)) (the-as uint (-> this ram-time)))) - (< (the-as uint 150) (- (the-as uint (-> gp-0 friction-coef)) (the-as uint (-> this impact-time)))) - ) - (and (logtest? (-> this v-flags) (vehicle-flag impact)) (< (-> this impact-local-pos z) 0.0)) - ) - (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag rammed-target)))) - ) - ) - (else - (when (and (logtest? (-> this v-flags) (vehicle-flag impact)) - (< (- (the-as uint (-> gp-0 friction-coef)) (the-as uint (-> this prev-impact-time))) (the-as uint 30)) - (< (-> gp-0 wheel-axis z) 40960.0) - (< 0.0 (-> gp-0 wheel-axis z)) - (< 0.0 (-> this impact-local-pos z)) - ) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag rammed-target) (-> this v-flags)))) - (set! (-> this ram-time) (the-as uint (-> gp-0 friction-coef))) - ) - ) - ) - (set! (-> gp-0 wheel-axis x) 0.0) - (let ((v1-38 (-> this ai-state))) - (b! (!= v1-38 1) cfg-45 :delay (empty-form)) - (let ((a0-32 (as-type (handle->process (-> this target-status handle)) process-focusable))) - (b! a0-32 cfg-39 :delay (empty-form)) - (set! (-> gp-0 side-dir x) 1.0) - (b! #t cfg-64 :delay (nop!)) - (label cfg-39) - (vector-copy! (-> gp-0 force) (-> (the-as process-focusable a0-32) node-list data 0 bone transform fvec)) - ) - (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) - (f0-13 (* f0-11 f0-11)) - ) - (.lvf vf1 (&-> (-> gp-0 mat trans) 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-50 vf1) - (if (< f0-13 v1-50) - (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)) - ) - (vector-normalize! (-> gp-0 force) 1.0) - (vector+float*! (-> gp-0 velocity) (-> gp-0 mat fvec) (-> gp-0 force) 81920.0) - (vector+float*! (-> gp-0 velocity) (-> gp-0 velocity) (-> gp-0 mat trans) 0.5) - (when (logtest? (vehicle-flag vf54) (-> this v-flags)) - (vector-copy! (-> gp-0 axis) (-> gp-0 mat rvec)) - (vector-copy! (-> gp-0 dir) (-> gp-0 mat uvec)) - (vector-copy! (-> gp-0 ground-normal-sum) (-> gp-0 mat fvec)) - (vector-copy! (-> gp-0 ground-pos) (-> gp-0 mat trans)) - (set! (-> gp-0 axis y) 0.0) - (set! (-> gp-0 dir y) 0.0) - (set! (-> gp-0 ground-normal-sum y) 0.0) - (set! (-> gp-0 ground-pos y) 0.0) - (set! (-> gp-0 wsphere z) (nearest-dist2-between-moving-points - (-> gp-0 mat rvec) - (-> gp-0 mat uvec) - (-> gp-0 mat fvec) - (-> gp-0 mat trans) - 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 - ) - ) - ) - 0 - (b! #t cfg-49 :delay (nop!)) - (label cfg-45) - (cond - ((= v1-38 2) - (vector-copy! (-> gp-0 velocity) (-> this ai-target-point)) - (set! (-> gp-0 wheel-axis x) (-> this ai-max-speed)) - ) - ((zero? v1-38) - ) - ) - ) - (label cfg-49) - (cond - ((>= 0.0 (-> gp-0 wheel-axis x)) - (set! (-> gp-0 side-dir x) 1.0) - ) - ((begin - (cond - ((logtest? (vehicle-flag vf52) (-> this v-flags)) - (vector-! (-> gp-0 mat trans) (-> gp-0 velocity) (-> this root trans)) - (vector-normalize! (-> gp-0 mat trans) (-> gp-0 wheel-axis x)) - ) - (else - (when (-> this nav) - (let ((a0-69 (-> this nav state)) - (v1-92 (-> gp-0 velocity)) - ) - (logclear! (-> a0-69 flags) (nav-state-flag directional-mode)) - (logior! (-> a0-69 flags) (nav-state-flag target-poly-dirty)) - (vector-copy! (-> a0-69 target-pos) v1-92) - ) - 0 - (let ((v1-95 (-> this nav))) - (set! (-> v1-95 target-speed) (-> gp-0 wheel-axis x)) - ) - 0 - (let ((a1-22 (-> this nav state))) - (vector-copy! (-> gp-0 mat trans) (-> a1-22 velocity)) - ) - ) - ) - ) - (when (< (vector-dot (-> gp-0 mat trans) (-> gp-0 probe-dir)) 0.0) - (vector-float*! - (-> gp-0 mat trans) - (-> gp-0 steering-axis) - (vector-dot (-> gp-0 mat trans) (-> gp-0 steering-axis)) - ) - (vector-normalize! (-> gp-0 mat trans) (-> gp-0 wheel-axis x)) - ) - (vector-! (-> gp-0 local-pos) (-> gp-0 mat trans) (-> gp-0 mat uvec)) - (vector-float*! (-> gp-0 tmp) (-> gp-0 local-pos) 1.5) - (set! (-> gp-0 wheel-axis w) 0.0) - (dotimes (v1-108 2) - (let ((a0-80 (-> this wheel (+ v1-108 2)))) - (if (logtest? (-> a0-80 flags) 2) - (+! (-> gp-0 wheel-axis w) (-> a0-80 side-vel)) - ) - ) - ) - (set! (-> gp-0 wheel-axis y) - (* 60.0 - (+ (* 0.0000061035157 (- (-> gp-0 wheel-axis x) (-> gp-0 side-dir z))) - (* -0.0000061035157 (fabs (-> gp-0 wheel-axis w))) - ) - (-> this info handling ai-throttle-factor) + (let ((gp-0 (new 'stack-no-clear 'wvehicle-physics-work))) + (mem-set32! (the-as pointer (-> gp-0 forward-dir)) 6 0) + (set! (-> gp-0 wsphere r) (seconds-per-frame)) + (set! (-> gp-0 friction-coef) (the-as float (current-time))) + (vehicle-method-140 this) + (set! (-> gp-0 mat rvec quad) (-> this rbody position quad)) + (vector-copy! (-> gp-0 mat uvec) (-> this rbody lin-velocity)) + (vector-copy! (-> gp-0 probe-dir) (-> this rbody matrix fvec)) + (vector-copy! (-> gp-0 steering-axis) (-> this rbody matrix rvec)) + (set! (-> gp-0 steering-axis y) 0.0) + (set! (-> gp-0 side-dir z) (vector-length (-> gp-0 mat uvec))) + (set! (-> gp-0 wheel-axis z) (vector-dot (-> gp-0 mat uvec) (-> gp-0 probe-dir))) + (cond + ((logtest? (vehicle-flag rammed-target) (-> this v-flags)) + (if (or (and (< (the-as uint 600) (- (the-as uint (-> gp-0 friction-coef)) (the-as uint (-> this ram-time)))) + (< (the-as uint 150) (- (the-as uint (-> gp-0 friction-coef)) (the-as uint (-> this impact-time)))) ) - ) - (set! (-> gp-0 forward-dir y) - (fmax 0.0 (fmin 1.0 (+ (-> this controls throttle) (* (-> gp-0 wsphere r) (-> gp-0 wheel-axis y))))) - ) - (set! (-> gp-0 forward-dir z) - (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ (- -4096.0 (-> gp-0 wheel-axis x)) (-> gp-0 side-dir z))))) - ) - (set! (-> gp-0 wsphere x) (vector-dot (-> gp-0 steering-axis) (-> gp-0 tmp))) - (set! (-> gp-0 wsphere y) (- (-> gp-0 wheel-axis w) (fmax -12288.0 (fmin 12288.0 (-> gp-0 wheel-axis w))))) - (set! (-> gp-0 forward-dir x) (fmax -1.0 (fmin 1.0 (* 2.0 - (-> this info handling ai-steering-factor) - (/ 1.0 (+ 4096.0 (-> gp-0 side-dir z))) - (+ (-> gp-0 wsphere x) (-> gp-0 wsphere y)) - ) - ) - ) - ) - (logtest? (vehicle-flag rammed-target) (-> this v-flags)) + (and (logtest? (-> this v-flags) (vehicle-flag impact)) (< (-> this impact-local-pos z) 0.0)) + ) + (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag rammed-target)))) ) - (set! (-> gp-0 forward-dir y) 0.0) - (set! (-> gp-0 forward-dir z) 1.0) - (set! (-> gp-0 forward-dir x) (* -1.0 (-> gp-0 forward-dir x))) + ) + (else + (when (and (logtest? (-> this v-flags) (vehicle-flag impact)) + (< (- (the-as uint (-> gp-0 friction-coef)) (the-as uint (-> this prev-impact-time))) (the-as uint 30)) + (< (-> gp-0 wheel-axis z) 40960.0) + (< 0.0 (-> gp-0 wheel-axis z)) + (< 0.0 (-> this impact-local-pos z)) + ) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag rammed-target) (-> this v-flags)))) + (set! (-> this ram-time) (the-as uint (-> gp-0 friction-coef))) + ) + ) + ) + (set! (-> gp-0 wheel-axis x) 0.0) + (let ((v1-38 (-> this ai-state))) + (b! (!= v1-38 1) cfg-45 :delay (empty-form)) + (let ((a0-32 (as-type (handle->process (-> this target-status handle)) process-focusable))) + (b! a0-32 cfg-39 :delay (empty-form)) + (set! (-> gp-0 side-dir x) 1.0) + (b! #t cfg-64 :delay (nop!)) + (label cfg-39) + (vector-copy! (-> gp-0 force) (-> (the-as process-focusable a0-32) node-list data 0 bone transform fvec)) + ) + (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)) + ) + ) + (set! (-> gp-0 wheel-axis x) + (fmax (fmin (+ 20480.0 (vector-length (-> gp-0 mat trans))) (-> this ai-max-speed)) (-> this ai-min-speed)) + ) + (vector-normalize! (-> gp-0 force) 1.0) + (vector+float*! (-> gp-0 velocity) (-> gp-0 mat fvec) (-> gp-0 force) 81920.0) + (vector+float*! (-> gp-0 velocity) (-> gp-0 velocity) (-> gp-0 mat trans) 0.5) + (when (logtest? (vehicle-flag vf54) (-> this v-flags)) + (vector-copy! (-> gp-0 axis) (-> gp-0 mat rvec)) + (vector-copy! (-> gp-0 dir) (-> gp-0 mat uvec)) + (vector-copy! (-> gp-0 ground-normal-sum) (-> gp-0 mat fvec)) + (vector-copy! (-> gp-0 ground-pos) (-> gp-0 mat trans)) + (set! (-> gp-0 axis y) 0.0) + (set! (-> gp-0 dir y) 0.0) + (set! (-> gp-0 ground-normal-sum y) 0.0) + (set! (-> gp-0 ground-pos y) 0.0) + (set! (-> gp-0 wsphere z) (nearest-dist2-between-moving-points + (-> gp-0 mat rvec) + (-> gp-0 mat uvec) + (-> gp-0 mat fvec) + (-> gp-0 mat trans) + 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 + ) + ) + ) + 0 + (b! #t cfg-49 :delay (nop!)) + (label cfg-45) + (cond + ((= v1-38 2) + (vector-copy! (-> gp-0 velocity) (-> this ai-target-point)) + (set! (-> gp-0 wheel-axis x) (-> this ai-max-speed)) + ) + ((zero? v1-38) ) ) - (label cfg-64) - (vehicle-method-92 this (the-as vehicle-controls (-> gp-0 forward-dir))) ) - 0 - (none) + (label cfg-49) + (cond + ((>= 0.0 (-> gp-0 wheel-axis x)) + (set! (-> gp-0 side-dir x) 1.0) + ) + ((begin + (cond + ((logtest? (vehicle-flag vf52) (-> this v-flags)) + (vector-! (-> gp-0 mat trans) (-> gp-0 velocity) (-> this root trans)) + (vector-normalize! (-> gp-0 mat trans) (-> gp-0 wheel-axis x)) + ) + (else + (when (-> this nav) + (let ((a0-69 (-> this nav state)) + (v1-92 (-> gp-0 velocity)) + ) + (logclear! (-> a0-69 flags) (nav-state-flag directional-mode)) + (logior! (-> a0-69 flags) (nav-state-flag target-poly-dirty)) + (vector-copy! (-> a0-69 target-pos) v1-92) + ) + 0 + (let ((v1-95 (-> this nav))) + (set! (-> v1-95 target-speed) (-> gp-0 wheel-axis x)) + ) + 0 + (let ((a1-22 (-> this nav state))) + (vector-copy! (-> gp-0 mat trans) (-> a1-22 velocity)) + ) + ) + ) + ) + (when (< (vector-dot (-> gp-0 mat trans) (-> gp-0 probe-dir)) 0.0) + (vector-float*! + (-> gp-0 mat trans) + (-> gp-0 steering-axis) + (vector-dot (-> gp-0 mat trans) (-> gp-0 steering-axis)) + ) + (vector-normalize! (-> gp-0 mat trans) (-> gp-0 wheel-axis x)) + ) + (vector-! (-> gp-0 local-pos) (-> gp-0 mat trans) (-> gp-0 mat uvec)) + (vector-float*! (-> gp-0 tmp) (-> gp-0 local-pos) 1.5) + (set! (-> gp-0 wheel-axis w) 0.0) + (dotimes (v1-108 2) + (let ((a0-80 (-> this wheel (+ v1-108 2)))) + (if (logtest? (-> a0-80 flags) 2) + (+! (-> gp-0 wheel-axis w) (-> a0-80 side-vel)) + ) + ) + ) + (set! (-> gp-0 wheel-axis y) + (* 60.0 + (+ (* 0.0000061035157 (- (-> gp-0 wheel-axis x) (-> gp-0 side-dir z))) + (* -0.0000061035157 (fabs (-> gp-0 wheel-axis w))) + ) + (-> this info handling ai-throttle-factor) + ) + ) + (set! (-> gp-0 forward-dir y) + (fmax 0.0 (fmin 1.0 (+ (-> this controls throttle) (* (-> gp-0 wsphere r) (-> gp-0 wheel-axis y))))) + ) + (set! (-> gp-0 forward-dir z) + (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ (- -4096.0 (-> gp-0 wheel-axis x)) (-> gp-0 side-dir z))))) + ) + (set! (-> gp-0 wsphere x) (vector-dot (-> gp-0 steering-axis) (-> gp-0 tmp))) + (set! (-> gp-0 wsphere y) (- (-> gp-0 wheel-axis w) (fmax -12288.0 (fmin 12288.0 (-> gp-0 wheel-axis w))))) + (set! (-> gp-0 forward-dir x) (fmax -1.0 (fmin 1.0 (* 2.0 + (-> this info handling ai-steering-factor) + (/ 1.0 (+ 4096.0 (-> gp-0 side-dir z))) + (+ (-> gp-0 wsphere x) (-> gp-0 wsphere y)) + ) + ) + ) + ) + (logtest? (vehicle-flag rammed-target) (-> this v-flags)) + ) + (set! (-> gp-0 forward-dir y) 0.0) + (set! (-> gp-0 forward-dir z) 1.0) + (set! (-> gp-0 forward-dir x) (* -1.0 (-> gp-0 forward-dir x))) + ) + ) + (label cfg-64) + (vehicle-method-92 this (the-as vehicle-controls (-> gp-0 forward-dir))) ) + 0 + (none) ) diff --git a/goal_src/jak3/levels/desert/wvehicle/wvehicle-physics.gc b/goal_src/jak3/levels/desert/wvehicle/wvehicle-physics.gc index fe8e2e6927..32187cca8d 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wvehicle-physics.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wvehicle-physics.gc @@ -494,140 +494,123 @@ ) (defmethod apply-gravity! ((this wvehicle) (arg0 float)) - (local-vars (v1-51 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (wvehicle-method-162 this arg0) - (wvehicle-method-163 this) - (let ((gp-0 (new 'stack-no-clear 'wvehicle-physics-work)) - (s5-0 (-> this rbody)) - (s4-0 (-> this info)) - ) - (set! (-> gp-0 cur-time) (the-as uint (current-time))) - (cond - ((logtest? (-> this v-flags) (vehicle-flag dead)) - (vector-reset! (-> gp-0 ground-normal-sum)) - ) - (else - (wvehicle-method-160 this gp-0) - (vector-reset! (-> gp-0 force)) - (set! (-> gp-0 force y) (* 2.0 (-> s4-0 info mass) (-> s4-0 extra gravity) (-> this jump-control))) - (add-force! s5-0 (-> gp-0 force)) - (vehicle-method-97 this arg0 (the-as vehicle-physics-work gp-0)) - ) + (wvehicle-method-162 this arg0) + (wvehicle-method-163 this) + (let ((gp-0 (new 'stack-no-clear 'wvehicle-physics-work)) + (s5-0 (-> this rbody)) + (s4-0 (-> this info)) ) - (when (logtest? (vehicle-flag turbo-boost) (-> this v-flags)) - (let ((f0-6 (* (-> this turbo-boost-factor) (-> s4-0 info mass) (-> s4-0 extra gravity)))) - (vector-float*! (-> gp-0 force) (-> gp-0 mat fvec) f0-6) - ) - (add-force! s5-0 (-> gp-0 force)) - ) - (when (logtest? (-> this v-flags) (vehicle-flag in-air)) - (let* ((v1-29 (-> this rbody ang-momentum)) - (a0-10 (-> this rbody ang-momentum)) - (f3-0 (-> s4-0 handling air-angular-damping)) - (f2-0 arg0) - (f0-7 0.0) - (f1-5 1.0) - (f2-1 (* -1.0 (- 1.0 f3-0) f2-0)) - (f3-3 0.016666668) - ) - (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) - ) - (cond - ((< f0-13 (* f1-10 f1-10)) - (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)) - (vector-reset! (-> gp-0 force)) - (set! (-> gp-0 force x) (* (-> s4-0 handling hop-turn-torque) (-> this controls steering))) - (set! (-> gp-0 force y) (* -1.0 (-> this controls lean-z) (-> s4-0 handling air-pitch-torque))) - (vector-rotate*! (-> gp-0 force) (-> gp-0 force) (-> gp-0 mat)) - (rigid-body-control-method-22 s5-0 (-> gp-0 world-pos) (-> gp-0 force)) - ) - (else - (vector-copy! (-> gp-0 local-pos) (-> s4-0 info cm-offset-joint)) - (+! (-> gp-0 local-pos y) 4096.0) - (vector-matrix*! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> gp-0 mat)) - (vector-reset! (-> gp-0 force)) - (set! (-> gp-0 force x) (* (-> s4-0 handling air-roll-torque) (-> this controls steering))) - (set! (-> gp-0 force z) (* (-> s4-0 handling air-pitch-torque) (-> this controls lean-z))) - (vector-rotate*! (-> gp-0 force) (-> gp-0 force) (-> gp-0 mat)) - (rigid-body-control-method-22 s5-0 (-> gp-0 world-pos) (-> gp-0 force)) - ) - ) - ) - ) - (when (not (logtest? (vehicle-flag gun-dark-2-zero-g) (-> this v-flags))) - (let ((f0-27 0.0)) - (.lvf vf1 (&-> (-> gp-0 ground-normal-sum) 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-51 vf1) - (if (= f0-27 v1-51) - (set! (-> gp-0 ground-normal-sum y) 1.0) - ) - ) - (+! (-> gp-0 ground-normal-sum y) 6.0) - (vector-normalize! (-> gp-0 ground-normal-sum) 1.0) - (vector-float*! (-> this gravity-dir) (-> gp-0 ground-normal-sum) -1.0) - (vector-float*! (-> gp-0 force) (-> this gravity-dir) (* (-> s4-0 extra gravity) (-> s4-0 info mass))) - (add-force! s5-0 (-> gp-0 force)) - ) - (rigid-body-object-method-53 this arg0) - (vehicle-method-96 this arg0) - (countdown (s1-0 (-> s4-0 physics-model wheel-count)) - (let* ((a1-25 (-> this wheel s1-0)) - (v1-69 (-> a1-25 info)) - ) - (set! (-> gp-0 wsphere quad) (-> a1-25 trans quad)) - (set! (-> gp-0 wsphere r) (* (-> v1-69 scale) (-> v1-69 radius))) - ) - (vehicle-method-95 this (-> gp-0 wsphere) arg0) - 0 - ) - (let ((f0-38 (* -0.000012207031 (vector-length (-> s5-0 lin-velocity)) (-> s4-0 handling drag-force-factor)))) - (vector-float*! (-> gp-0 force) (-> s5-0 lin-velocity) f0-38) - ) - (add-force! s5-0 (-> gp-0 force)) - (when (or (and (logtest? (-> this v-flags) (vehicle-flag in-air)) - (and (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (and (< (-> s5-0 matrix uvec y) 0.0) (< (- (-> gp-0 cur-time) (-> this impact-time)) (the-as uint 10))) - ) - ) - (logtest? (vehicle-flag overturned) (-> this v-flags)) - ) - (vector-reset! (-> gp-0 local-pos)) - (set! (-> gp-0 local-pos y) -6144.0) - (when (logtest? (vehicle-flag overturned) (-> this v-flags)) - (let ((f0-42 (* 0.0033333334 (the float (- (current-time) (the-as int (-> this overturned-time))))))) - (set! (-> gp-0 local-pos y) (* (+ -32768.0 (* -16384.0 f0-42)) - (-> s4-0 handling roll-control-factor) - (fmax 0.1 (- (-> s5-0 matrix uvec y))) - ) - ) - ) - ) - (vector-matrix*! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> gp-0 mat)) + (set! (-> gp-0 cur-time) (the-as uint (current-time))) + (cond + ((logtest? (-> this v-flags) (vehicle-flag dead)) + (vector-reset! (-> gp-0 ground-normal-sum)) + ) + (else + (wvehicle-method-160 this gp-0) (vector-reset! (-> gp-0 force)) - (set! (-> gp-0 force y) (* (/ (-> s4-0 extra gravity) -2) (-> s4-0 info mass))) - (rigid-body-control-method-22 s5-0 (-> gp-0 world-pos) (-> gp-0 force)) + (set! (-> gp-0 force y) (* 2.0 (-> s4-0 info mass) (-> s4-0 extra gravity) (-> this jump-control))) + (add-force! s5-0 (-> gp-0 force)) + (vehicle-method-97 this arg0 (the-as vehicle-physics-work gp-0)) ) ) - 0 - (none) + (when (logtest? (vehicle-flag turbo-boost) (-> this v-flags)) + (let ((f0-6 (* (-> this turbo-boost-factor) (-> s4-0 info mass) (-> s4-0 extra gravity)))) + (vector-float*! (-> gp-0 force) (-> gp-0 mat fvec) f0-6) + ) + (add-force! s5-0 (-> gp-0 force)) + ) + (when (logtest? (-> this v-flags) (vehicle-flag in-air)) + (let* ((v1-29 (-> this rbody ang-momentum)) + (a0-10 (-> this rbody ang-momentum)) + (f3-0 (-> s4-0 handling air-angular-damping)) + (f2-0 arg0) + (f0-7 0.0) + (f1-5 1.0) + (f2-1 (* -1.0 (- 1.0 f3-0) f2-0)) + (f3-3 0.016666668) + ) + (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) + ) + (cond + ((< f0-13 (* f1-10 f1-10)) + (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)) + (vector-reset! (-> gp-0 force)) + (set! (-> gp-0 force x) (* (-> s4-0 handling hop-turn-torque) (-> this controls steering))) + (set! (-> gp-0 force y) (* -1.0 (-> this controls lean-z) (-> s4-0 handling air-pitch-torque))) + (vector-rotate*! (-> gp-0 force) (-> gp-0 force) (-> gp-0 mat)) + (rigid-body-control-method-22 s5-0 (-> gp-0 world-pos) (-> gp-0 force)) + ) + (else + (vector-copy! (-> gp-0 local-pos) (-> s4-0 info cm-offset-joint)) + (+! (-> gp-0 local-pos y) 4096.0) + (vector-matrix*! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> gp-0 mat)) + (vector-reset! (-> gp-0 force)) + (set! (-> gp-0 force x) (* (-> s4-0 handling air-roll-torque) (-> this controls steering))) + (set! (-> gp-0 force z) (* (-> s4-0 handling air-pitch-torque) (-> this controls lean-z))) + (vector-rotate*! (-> gp-0 force) (-> gp-0 force) (-> gp-0 mat)) + (rigid-body-control-method-22 s5-0 (-> gp-0 world-pos) (-> gp-0 force)) + ) + ) + ) + ) + (when (not (logtest? (vehicle-flag gun-dark-2-zero-g) (-> this v-flags))) + (if (= 0.0 (vector-length-squared (-> gp-0 ground-normal-sum))) + (set! (-> gp-0 ground-normal-sum y) 1.0) + ) + (+! (-> gp-0 ground-normal-sum y) 6.0) + (vector-normalize! (-> gp-0 ground-normal-sum) 1.0) + (vector-float*! (-> this gravity-dir) (-> gp-0 ground-normal-sum) -1.0) + (vector-float*! (-> gp-0 force) (-> this gravity-dir) (* (-> s4-0 extra gravity) (-> s4-0 info mass))) + (add-force! s5-0 (-> gp-0 force)) + ) + (rigid-body-object-method-53 this arg0) + (vehicle-method-96 this arg0) + (countdown (s1-0 (-> s4-0 physics-model wheel-count)) + (let* ((a1-25 (-> this wheel s1-0)) + (v1-69 (-> a1-25 info)) + ) + (set! (-> gp-0 wsphere quad) (-> a1-25 trans quad)) + (set! (-> gp-0 wsphere r) (* (-> v1-69 scale) (-> v1-69 radius))) + ) + (vehicle-method-95 this (-> gp-0 wsphere) arg0) + 0 + ) + (let ((f0-38 (* -0.000012207031 (vector-length (-> s5-0 lin-velocity)) (-> s4-0 handling drag-force-factor)))) + (vector-float*! (-> gp-0 force) (-> s5-0 lin-velocity) f0-38) + ) + (add-force! s5-0 (-> gp-0 force)) + (when (or (and (logtest? (-> this v-flags) (vehicle-flag in-air)) + (and (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (and (< (-> s5-0 matrix uvec y) 0.0) (< (- (-> gp-0 cur-time) (-> this impact-time)) (the-as uint 10))) + ) + ) + (logtest? (vehicle-flag overturned) (-> this v-flags)) + ) + (vector-reset! (-> gp-0 local-pos)) + (set! (-> gp-0 local-pos y) -6144.0) + (when (logtest? (vehicle-flag overturned) (-> this v-flags)) + (let ((f0-42 (* 0.0033333334 (the float (- (current-time) (the-as int (-> this overturned-time))))))) + (set! (-> gp-0 local-pos y) (* (+ -32768.0 (* -16384.0 f0-42)) + (-> s4-0 handling roll-control-factor) + (fmax 0.1 (- (-> s5-0 matrix uvec y))) + ) + ) + ) + ) + (vector-matrix*! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> gp-0 mat)) + (vector-reset! (-> gp-0 force)) + (set! (-> gp-0 force y) (* (/ (-> s4-0 extra gravity) -2) (-> s4-0 info mass))) + (rigid-body-control-method-22 s5-0 (-> gp-0 world-pos) (-> gp-0 force)) + ) ) + 0 + (none) ) (defmethod apply-gravity ((this wvehicle) (arg0 float)) diff --git a/goal_src/jak3/levels/desert/wvehicle/wvehicle-race.gc b/goal_src/jak3/levels/desert/wvehicle/wvehicle-race.gc index 62b1b8fcd8..622a2af138 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wvehicle-race.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wvehicle-race.gc @@ -62,338 +62,235 @@ ) (defmethod wvehicle-method-181 ((this wvehicle)) - (local-vars (v1-23 float) (v1-32 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((a1-0 (new 'stack-no-clear 'wvehicle-physics-work))) - (set! (-> a1-0 cur-time) (the-as uint (current-time))) - (wvehicle-method-160 this a1-0) - ) - (let ((s5-0 (-> this race))) - (when #t - (race-control-method-11 s5-0 0.0) - (let ((s4-0 (-> this rbody)) - (f30-0 (seconds-per-frame)) - ) - 1.0 - (let ((s3-0 (new 'stack-no-clear 'wvehicle-physics-work)) - (f28-0 - (fmin - (* (+ (vector-length (-> s4-0 lin-velocity)) (* 163840.0 f30-0)) - (/ 1.0 (fmax 1.0 (vector-length (-> s5-0 lin-velocity)))) - ) - (-> s5-0 racer-state speed-factor) - ) - ) - ) - (set! (-> s3-0 velocity x) 819200.0) - (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)) - (.lvf vf1 (&-> (-> s3-0 mat trans) 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-23 vf1) - (let ((f0-6 v1-23) - (f1-5 1.0) - (f2-2 40960.0) - ) - (set! (-> this path-deviation) (* f0-6 (/ f1-5 (* f2-2 f2-2)))) - ) - (let ((a1-5 (-> s3-0 mat fvec))) - (let ((v1-27 (-> s3-0 mat fvec))) - (let ((a0-6 (-> s3-0 mat trans))) - (let ((a2-1 1.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-6 quad)) - ) - (.lvf vf4 (&-> v1-27 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-5 quad) vf6) - ) - (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)) - (f0-12 (* f0-10 f0-10)) - ) - (.lvf vf1 (&-> v1-31 rvec 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-12 v1-32) - (vector-normalize! (-> s3-0 mat rvec) (-> s3-0 velocity x)) - ) - ) - (let ((a1-10 (-> s4-0 lin-velocity))) - (let ((v1-36 (-> s4-0 lin-velocity))) - (let ((a0-11 (-> s3-0 mat))) - (let ((a2-2 f30-0)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-11 rvec quad)) - ) - (.lvf vf4 (&-> v1-36 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-10 quad) vf6) - ) - (let ((a1-11 (-> s4-0 position))) - (let ((v1-37 (-> s4-0 position))) - (let ((a0-12 (-> s4-0 lin-velocity))) - (let ((a2-3 f30-0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-12 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-11 quad) vf6) - ) - (quaternion-pseudo-seek - (the-as quaternion (-> s4-0 rot)) - (the-as quaternion (-> s4-0 rot)) - (the-as quaternion (-> s3-0 force)) - (* 10.0 f30-0) - ) - (vector-float*! (-> s4-0 lin-momentum) (-> s4-0 lin-velocity) (-> this info info mass)) - (vector-reset! (-> s4-0 ang-momentum)) - (rigid-body-control-method-26 s4-0) - (init-velocities! s4-0) - (vector-copy! (-> this root transv) (-> s4-0 lin-velocity)) - (quaternion-copy! (-> this root quat) (the-as quaternion (-> s4-0 rot))) - (rigid-body-control-method-25 s4-0 (-> this root trans)) - (matrix-copy! (-> this node-list data 0 bone transform) (-> s4-0 matrix)) - (vector-copy! (-> this node-list data 0 bone transform trans) (-> this root trans)) - (race-control-method-11 s5-0 (* f30-0 f28-0)) + (let ((a1-0 (new 'stack-no-clear 'wvehicle-physics-work))) + (set! (-> a1-0 cur-time) (the-as uint (current-time))) + (wvehicle-method-160 this a1-0) + ) + (let ((s5-0 (-> this race))) + (when #t + (race-control-method-11 s5-0 0.0) + (let ((s4-0 (-> this rbody)) + (f30-0 (seconds-per-frame)) ) + 1.0 + (let ((s3-0 (new 'stack-no-clear 'wvehicle-physics-work)) + (f28-0 + (fmin + (* (+ (vector-length (-> s4-0 lin-velocity)) (* 163840.0 f30-0)) + (/ 1.0 (fmax 1.0 (vector-length (-> s5-0 lin-velocity)))) + ) + (-> s5-0 racer-state speed-factor) + ) + ) + ) + (set! (-> s3-0 velocity x) 819200.0) + (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)))) + ) + (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))) + (vector-normalize! (-> s3-0 mat rvec) (-> s3-0 velocity x)) + ) + ) + (vector+*! (-> s4-0 lin-velocity) (-> s4-0 lin-velocity) (-> s3-0 mat rvec) f30-0) + (vector+*! (-> s4-0 position) (-> s4-0 position) (-> s4-0 lin-velocity) f30-0) + (quaternion-pseudo-seek + (the-as quaternion (-> s4-0 rot)) + (the-as quaternion (-> s4-0 rot)) + (the-as quaternion (-> s3-0 force)) + (* 10.0 f30-0) + ) + (vector-float*! (-> s4-0 lin-momentum) (-> s4-0 lin-velocity) (-> this info info mass)) + (vector-reset! (-> s4-0 ang-momentum)) + (rigid-body-control-method-26 s4-0) + (init-velocities! s4-0) + (vector-copy! (-> this root transv) (-> s4-0 lin-velocity)) + (quaternion-copy! (-> this root quat) (the-as quaternion (-> s4-0 rot))) + (rigid-body-control-method-25 s4-0 (-> this root trans)) + (matrix-copy! (-> this node-list data 0 bone transform) (-> s4-0 matrix)) + (vector-copy! (-> this node-list data 0 bone transform trans) (-> this root trans)) + (race-control-method-11 s5-0 (* f30-0 f28-0)) ) ) ) - (vehicle-method-77 this) - (rigid-body-object-method-30 this) - (update-transforms (-> this root)) - (let ((a1-18 (new 'stack-no-clear 'overlaps-others-params))) - (set! (-> a1-18 options) (overlaps-others-options)) - (set! (-> a1-18 collide-with-filter) (collide-spec civilian enemy obstacle)) - (set! (-> a1-18 tlist) *touching-list*) - (find-overlapping-shapes (-> this root) a1-18) - ) - 0 - (none) ) + (vehicle-method-77 this) + (rigid-body-object-method-30 this) + (update-transforms (-> this root)) + (let ((a1-21 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-21 options) (overlaps-others-options)) + (set! (-> a1-21 collide-with-filter) (collide-spec civilian enemy obstacle)) + (set! (-> a1-21 tlist) *touching-list*) + (find-overlapping-shapes (-> this root) a1-21) + ) + 0 + (none) ) (defmethod wvehicle-method-177 ((this wvehicle) (arg0 vehicle-controls)) - (local-vars (v1-90 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (-> this race)) - (gp-0 (new 'stack-no-clear 'wvehicle-race-stack-var0)) - ) - (mem-set32! (the-as pointer (-> gp-0 vec11)) 6 0) - (set! (-> gp-0 time) (the-as uint (current-time))) - (vector-copy! (-> gp-0 vec0) (-> this rbody position)) - (vector-copy! (-> gp-0 vec1) (-> this rbody lin-velocity)) - (set! (-> gp-0 float5) 0.0) - (vector-copy! (-> gp-0 vec8) (-> this rbody matrix rvec)) - (set! (-> gp-0 vec8 y) 0.0) - (vector-normalize! (-> gp-0 vec8) 1.0) - (vector-copy! (-> gp-0 vec9) (-> this rbody matrix fvec)) - (set! (-> gp-0 vec13 x) (* (-> this rbody ang-velocity y) (vector-length (-> this rbody lin-velocity)))) - (set! (-> gp-0 float1) (seconds-per-frame)) - (set! (-> gp-0 float8) (vector-dot (-> gp-0 vec1) (-> gp-0 vec9))) - (cond - ((logtest? (vehicle-flag rammed-target) (-> this v-flags)) - (if (or (and (< (the-as uint 600) (- (the-as uint (-> gp-0 time)) (-> this ram-time))) - (< (the-as uint 150) (- (the-as uint (-> gp-0 time)) (-> this impact-time))) - ) - (and (logtest? (-> this v-flags) (vehicle-flag impact)) (< (-> this impact-local-pos z) 0.0)) - ) - (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag rammed-target)))) - ) - ) - (else - (when (logtest? (-> this v-flags) (vehicle-flag impact)) - (when (and (< (- (-> gp-0 time) (-> this prev-impact-time)) (the-as uint 30)) - (< 0.0 (-> this impact-local-pos z)) - (< 0.0 (-> gp-0 float8)) - (< (-> gp-0 float8) 40960.0) - ) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag rammed-target) (-> this v-flags)))) - (set! (-> this ram-time) (-> gp-0 time)) - ) - ) - ) + (let ((s4-0 (-> this race)) + (gp-0 (new 'stack-no-clear 'wvehicle-race-stack-var0)) ) - (race-control-method-12 s4-0 (-> gp-0 vec0)) - (set! (-> gp-0 vec13 y) (vector-length (-> gp-0 vec1))) - (set! (-> gp-0 vec13 z) (vector-length (-> s4-0 lin-velocity))) - (set! (-> gp-0 vec13 w) - (* (-> gp-0 vec13 z) (fmax (-> s4-0 racer-state speed-factor) (-> this shortcut-speed-factor))) - ) - (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)) - ) - (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)))) - (when v1-60 - (when (!= v1-60 this) - (vector-copy! (-> gp-0 vec2) (-> (the-as process-drawable v1-60) root trans)) - (vector-copy! (-> gp-0 vec3) (-> (the-as process-drawable v1-60) root transv)) - (vector-copy! (-> gp-0 vec4) (-> (the-as process-drawable v1-60) rbody matrix fvec)) - (set! (-> gp-0 float6) - (nearest-dist2-between-moving-points (-> gp-0 vec0) (-> gp-0 vec1) (-> gp-0 vec2) (-> gp-0 vec3) 0.5) - ) - (when (< (-> gp-0 float6) (-> gp-0 float7)) - (vector-! (-> gp-0 vec6) (-> gp-0 vec2) (-> gp-0 vec0)) - (when (< 0.0 (vector-dot (-> gp-0 vec1) (-> gp-0 vec6))) - (set! (-> gp-0 vec13 w) - (fmin - (-> gp-0 vec13 w) - (* 0.95 - (fmax 0.0 (vector-dot (-> gp-0 vec9) (-> gp-0 vec4))) - (fmax 0.0 (vector-dot (-> gp-0 vec9) (-> gp-0 vec3))) - ) - ) - ) - 0 + (mem-set32! (the-as pointer (-> gp-0 vec11)) 6 0) + (set! (-> gp-0 time) (the-as uint (current-time))) + (vector-copy! (-> gp-0 vec0) (-> this rbody position)) + (vector-copy! (-> gp-0 vec1) (-> this rbody lin-velocity)) + (set! (-> gp-0 float5) 0.0) + (vector-copy! (-> gp-0 vec8) (-> this rbody matrix rvec)) + (set! (-> gp-0 vec8 y) 0.0) + (vector-normalize! (-> gp-0 vec8) 1.0) + (vector-copy! (-> gp-0 vec9) (-> this rbody matrix fvec)) + (set! (-> gp-0 vec13 x) (* (-> this rbody ang-velocity y) (vector-length (-> this rbody lin-velocity)))) + (set! (-> gp-0 float1) (seconds-per-frame)) + (set! (-> gp-0 float8) (vector-dot (-> gp-0 vec1) (-> gp-0 vec9))) + (cond + ((logtest? (vehicle-flag rammed-target) (-> this v-flags)) + (if (or (and (< (the-as uint 600) (- (the-as uint (-> gp-0 time)) (-> this ram-time))) + (< (the-as uint 150) (- (the-as uint (-> gp-0 time)) (-> this impact-time))) ) + (and (logtest? (-> this v-flags) (vehicle-flag impact)) (< (-> this impact-local-pos z) 0.0)) + ) + (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag rammed-target)))) + ) + ) + (else + (when (logtest? (-> this v-flags) (vehicle-flag impact)) + (when (and (< (- (-> gp-0 time) (-> this prev-impact-time)) (the-as uint 30)) + (< 0.0 (-> this impact-local-pos z)) + (< 0.0 (-> gp-0 float8)) + (< (-> gp-0 float8) 40960.0) + ) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag rammed-target) (-> this v-flags)))) + (set! (-> this ram-time) (-> gp-0 time)) + ) + ) + ) + ) + (race-control-method-12 s4-0 (-> gp-0 vec0)) + (set! (-> gp-0 vec13 y) (vector-length (-> gp-0 vec1))) + (set! (-> gp-0 vec13 z) (vector-length (-> s4-0 lin-velocity))) + (set! (-> gp-0 vec13 w) + (* (-> gp-0 vec13 z) (fmax (-> s4-0 racer-state speed-factor) (-> this shortcut-speed-factor))) + ) + (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)) + ) + (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)))) + (when v1-60 + (when (!= v1-60 this) + (vector-copy! (-> gp-0 vec2) (-> (the-as process-drawable v1-60) root trans)) + (vector-copy! (-> gp-0 vec3) (-> (the-as process-drawable v1-60) root transv)) + (vector-copy! (-> gp-0 vec4) (-> (the-as process-drawable v1-60) rbody matrix fvec)) + (set! (-> gp-0 float6) + (nearest-dist2-between-moving-points (-> gp-0 vec0) (-> gp-0 vec1) (-> gp-0 vec2) (-> gp-0 vec3) 0.5) + ) + (when (< (-> gp-0 float6) (-> gp-0 float7)) + (vector-! (-> gp-0 vec6) (-> gp-0 vec2) (-> gp-0 vec0)) + (when (< 0.0 (vector-dot (-> gp-0 vec1) (-> gp-0 vec6))) + (set! (-> gp-0 vec13 w) + (fmin + (-> gp-0 vec13 w) + (* 0.95 + (fmax 0.0 (vector-dot (-> gp-0 vec9) (-> gp-0 vec4))) + (fmax 0.0 (vector-dot (-> gp-0 vec9) (-> gp-0 vec3))) + ) + ) + ) + 0 ) ) ) ) ) ) - (let ((v1-76 (-> s4-0 path-sample))) - (set! (-> gp-0 vec11 x) (* 0.007874016 (the float (-> v1-76 stick-x)))) - (set! (-> gp-0 vec11 w) (* 0.007874016 (the float (-> v1-76 stick-y)))) - (set! (-> gp-0 vec11 y) (* 0.003921569 (the float (-> v1-76 throttle)))) - (set! (-> gp-0 vec11 z) (if (logtest? (-> v1-76 flags) 1) - 1.0 - 0.0 - ) - ) - ) - (set! (-> gp-0 float0) 0.0) - (let ((f0-35 (+ (-> s4-0 path-t) (* 1.875 (/ 1.0 (-> gp-0 vec13 z)) (-> gp-0 vec13 y))))) - (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) - (f1-25 (/ f1-24 (* f2-8 f2-8))) - ) - (.lvf vf1 (&-> (-> gp-0 vec6) 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-90 vf1) - (set! (-> gp-0 float5) (+ f0-36 (* f1-25 v1-90))) - ) - (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)))) - ) - ) - (set! (-> this path-deviation) (-> gp-0 float5)) - (let ((a1-20 (-> gp-0 vec5))) - (let ((v1-94 (-> gp-0 vec12))) - (let ((a0-54 (-> gp-0 vec6))) - (let ((a2-4 1.0)) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a0-54 quad)) - ) - (.lvf vf4 (&-> v1-94 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-! (-> gp-0 vec7) (-> gp-0 vec5) (-> gp-0 vec1)) - (vector-float*! (-> gp-0 vec10) (-> gp-0 vec7) 1.5) - (set! (-> gp-0 float2) 0.0) - (dotimes (v1-98 2) - (let ((a0-60 (-> this wheel (+ v1-98 2)))) - (if (logtest? (-> a0-60 flags) 2) - (+! (-> gp-0 float2) (-> a0-60 side-vel)) - ) - ) - ) - (let ((f1-36 - (+ (* 0.00036621094 (- (-> gp-0 vec13 w) (-> gp-0 vec13 y)) (-> gp-0 float1)) - (* -0.000024414063 (fabs (-> gp-0 float2))) - ) - ) - ) - (set! (-> this ai-controls throttle) (fmax 0.0 (fmin 1.0 (+ (-> this ai-controls throttle) f1-36)))) - ) - (set! (-> this ai-controls brake) - (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ (- -4096.0 (-> gp-0 vec13 w)) (-> gp-0 vec13 y))))) - ) - (+! (-> this ai-controls brake) (* (- (-> this ai-controls brake)) (fmin 1.0 (* 8.0 (-> gp-0 float1))))) - (set! (-> gp-0 float3) (* 0.00001001358 (vector-dot (-> gp-0 vec8) (-> gp-0 vec10)))) - (set! (-> gp-0 float4) (* 0.00001001358 (- (-> gp-0 float2) (fmax -12288.0 (fmin 12288.0 (-> gp-0 float2)))))) - (set! (-> this ai-controls steering) (fmax -1.0 (fmin 1.0 (+ (-> gp-0 float3) (-> gp-0 float4))))) - (set! (-> gp-0 vec11 x) (-> this ai-controls steering)) - (set! (-> gp-0 vec11 y) (-> this ai-controls throttle)) - (set! (-> gp-0 vec11 z) (-> this ai-controls brake)) - (when (logtest? (vehicle-flag rammed-target) (-> this v-flags)) - (set! (-> gp-0 vec11 y) 0.0) - (set! (-> gp-0 vec11 z) 1.0) - (set! (-> gp-0 vec11 x) (* -1.0 (-> gp-0 vec11 x))) - ) - (if (logtest? (-> s4-0 path-sample flags) 2) - (logior! (-> gp-0 byte0) 1) - ) - (vehicle-method-92 this (the-as vehicle-controls (-> gp-0 vec11))) ) - 0 - (none) + (let ((v1-76 (-> s4-0 path-sample))) + (set! (-> gp-0 vec11 x) (* 0.007874016 (the float (-> v1-76 stick-x)))) + (set! (-> gp-0 vec11 w) (* 0.007874016 (the float (-> v1-76 stick-y)))) + (set! (-> gp-0 vec11 y) (* 0.003921569 (the float (-> v1-76 throttle)))) + (set! (-> gp-0 vec11 z) (if (logtest? (-> v1-76 flags) 1) + 1.0 + 0.0 + ) + ) + ) + (set! (-> gp-0 float0) 0.0) + (let ((f0-35 (+ (-> s4-0 path-t) (* 1.875 (/ 1.0 (-> gp-0 vec13 z)) (-> gp-0 vec13 y))))) + (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)))) + ) + ) + (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)) + (vector-float*! (-> gp-0 vec10) (-> gp-0 vec7) 1.5) + (set! (-> gp-0 float2) 0.0) + (dotimes (v1-98 2) + (let ((a0-60 (-> this wheel (+ v1-98 2)))) + (if (logtest? (-> a0-60 flags) 2) + (+! (-> gp-0 float2) (-> a0-60 side-vel)) + ) + ) + ) + (let ((f1-36 + (+ (* 0.00036621094 (- (-> gp-0 vec13 w) (-> gp-0 vec13 y)) (-> gp-0 float1)) + (* -0.000024414063 (fabs (-> gp-0 float2))) + ) + ) + ) + (set! (-> this ai-controls throttle) (fmax 0.0 (fmin 1.0 (+ (-> this ai-controls throttle) f1-36)))) + ) + (set! (-> this ai-controls brake) + (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ (- -4096.0 (-> gp-0 vec13 w)) (-> gp-0 vec13 y))))) + ) + (+! (-> this ai-controls brake) (* (- (-> this ai-controls brake)) (fmin 1.0 (* 8.0 (-> gp-0 float1))))) + (set! (-> gp-0 float3) (* 0.00001001358 (vector-dot (-> gp-0 vec8) (-> gp-0 vec10)))) + (set! (-> gp-0 float4) (* 0.00001001358 (- (-> gp-0 float2) (fmax -12288.0 (fmin 12288.0 (-> gp-0 float2)))))) + (set! (-> this ai-controls steering) (fmax -1.0 (fmin 1.0 (+ (-> gp-0 float3) (-> gp-0 float4))))) + (set! (-> gp-0 vec11 x) (-> this ai-controls steering)) + (set! (-> gp-0 vec11 y) (-> this ai-controls throttle)) + (set! (-> gp-0 vec11 z) (-> this ai-controls brake)) + (when (logtest? (vehicle-flag rammed-target) (-> this v-flags)) + (set! (-> gp-0 vec11 y) 0.0) + (set! (-> gp-0 vec11 z) 1.0) + (set! (-> gp-0 vec11 x) (* -1.0 (-> gp-0 vec11 x))) + ) + (if (logtest? (-> s4-0 path-sample flags) 2) + (logior! (-> gp-0 byte0) 1) + ) + (vehicle-method-92 this (the-as vehicle-controls (-> gp-0 vec11))) ) + 0 + (none) ) (defmethod wvehicle-method-183 ((this wvehicle) (arg0 vehicle-controls)) diff --git a/goal_src/jak3/levels/desert/wvehicle/wvehicle-util.gc b/goal_src/jak3/levels/desert/wvehicle/wvehicle-util.gc index b5b4aebaa6..6dd0a1498c 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wvehicle-util.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wvehicle-util.gc @@ -482,48 +482,25 @@ ) (defmethod vehicle-method-103 ((this wvehicle)) - (local-vars (v1-8 float) (v1-13 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 (and (< v1-8 f0-1) (begin - (.lvf vf1 (&-> (-> this rbody lin-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-13 vf1) - (let ((f1-4 v1-13) - (f2-0 614.4) - ) - (< f1-4 (* f0-1 (* f2-0 f2-0))) - ) - ) + (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))) + ) + (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))) ) - (logclear! (-> this v-flags) (vehicle-flag disturbed)) - (vehicle-method-142 this) - ) + ) + (logclear! (-> this v-flags) (vehicle-flag disturbed)) + (vehicle-method-142 this) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod spawn-wheels! ((this wvehicle) (arg0 skeleton-group) (arg1 skeleton-group) (arg2 skeleton-group) (arg3 skeleton-group)) diff --git a/goal_src/jak3/levels/desert/wvehicle/wvehicle.gc b/goal_src/jak3/levels/desert/wvehicle/wvehicle.gc index 7d89f600fd..fb5ed7b13b 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wvehicle.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wvehicle.gc @@ -208,97 +208,75 @@ ) (defmethod vehicle-method-77 ((this wvehicle)) - (local-vars (a0-19 float) (a0-23 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (if (-> this nav) - (logior! (-> this nav flags) (nav-control-flag output-sphere-hash)) - ) - (if (not (logtest? (-> this rbody flags) (rigid-body-flag enable-physics))) - (vehicle-method-142 this) - ) - (if (logtest? (-> this v-flags) (vehicle-flag in-air)) - (set! (-> this ground-time) (the-as uint (current-time))) - ) - (let ((v1-16 (-> this rbody))) - (cond - ((logtest? (vehicle-flag overturned) (-> this v-flags)) - (if (and (not (logtest? (-> this v-flags) (vehicle-flag in-air))) (< 0.0 (-> v1-16 matrix uvec y))) - (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag overturned)))) - ) - ) - (else - (when (and (logtest? (-> this v-flags) (vehicle-flag in-air)) - (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (< (-> v1-16 matrix uvec y) 0.0) - (let ((a0-18 (-> v1-16 lin-velocity)) - (f1-2 16384.0) - ) - (.lvf vf1 (&-> a0-18 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-19 vf1) - (< a0-19 (* f1-2 f1-2)) - ) - (let ((a0-22 (-> v1-16 ang-velocity)) - (f1-5 4.0) - ) - (.lvf vf1 (&-> a0-22 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-23 vf1) - (< a0-23 (* f1-5 f1-5)) - ) + (if (-> this nav) + (logior! (-> this nav flags) (nav-control-flag output-sphere-hash)) + ) + (if (not (logtest? (-> this rbody flags) (rigid-body-flag enable-physics))) + (vehicle-method-142 this) + ) + (if (logtest? (-> this v-flags) (vehicle-flag in-air)) + (set! (-> this ground-time) (the-as uint (current-time))) + ) + (let ((v1-16 (-> this rbody))) + (cond + ((logtest? (vehicle-flag overturned) (-> this v-flags)) + (if (and (not (logtest? (-> this v-flags) (vehicle-flag in-air))) (< 0.0 (-> v1-16 matrix uvec y))) + (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag overturned)))) + ) + ) + (else + (when (and (logtest? (-> this v-flags) (vehicle-flag in-air)) + (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (< (-> v1-16 matrix uvec y) 0.0) + (let ((a0-18 (-> v1-16 lin-velocity)) + (f1-2 16384.0) + ) + (< (vector-length-squared a0-18) (* f1-2 f1-2)) ) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag overturned) (-> this v-flags)))) - (set! (-> this overturned-time) (the-as uint (current-time))) - ) + (let ((a0-22 (-> v1-16 ang-velocity)) + (f1-5 4.0) + ) + (< (vector-length-squared a0-22) (* f1-5 f1-5)) + ) + ) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag overturned) (-> this v-flags)))) + (set! (-> this overturned-time) (the-as uint (current-time))) ) ) - (if (and (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (< (+ 8192.0 (-> v1-16 position y)) (-> this water-height)) - ) - (go (method-of-object this sink)) - ) ) - (when (logtest? (vehicle-flag player-driving net-player-driving) (-> this v-flags)) - (when (and (logtest? (-> this controls flags) (vehicle-controls-flag vcf1)) - (>= (the-as uint (- (current-time) (the-as int (-> this shoot-time)))) (-> this shoot-delay)) - ) - (set! (-> this shoot-time) (the-as uint (current-time))) - (wvehicle-method-169 this) + (if (and (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (< (+ 8192.0 (-> v1-16 position y)) (-> this water-height)) + ) + (go (method-of-object this sink)) ) - ) - (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) - (let ((v1-39 *game-info*)) - (set! (-> v1-39 health-bar-vehicle) (-> this hit-points)) - (set! (-> v1-39 race-number-turbos) (the int (-> this turbo-supply))) - (set! (-> v1-39 vehicle-turbo-ready) (-> this turbo-ready)) - ) - (new 'stack-no-clear 'vector) - (dotimes (s5-0 (-> this info rider attach-point-count)) - (let ((s4-0 (as-type (handle->process (-> this attached-array s5-0)) process-focusable))) - (when (and s4-0 (focus-test? (the-as process-focusable s4-0) pilot-riding)) - (wvehicle-method-171 this (-> (the-as process-focusable s4-0) root trans) s5-0) - (wvehicle-method-172 this (-> (the-as process-focusable s4-0) root quat) s5-0) - ) - ) - ) - 0 - ) - ((method-of-type vehicle vehicle-method-77) this) - (none) ) + (when (logtest? (vehicle-flag player-driving net-player-driving) (-> this v-flags)) + (when (and (logtest? (-> this controls flags) (vehicle-controls-flag vcf1)) + (>= (the-as uint (- (current-time) (the-as int (-> this shoot-time)))) (-> this shoot-delay)) + ) + (set! (-> this shoot-time) (the-as uint (current-time))) + (wvehicle-method-169 this) + ) + ) + (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) + (let ((v1-39 *game-info*)) + (set! (-> v1-39 health-bar-vehicle) (-> this hit-points)) + (set! (-> v1-39 race-number-turbos) (the int (-> this turbo-supply))) + (set! (-> v1-39 vehicle-turbo-ready) (-> this turbo-ready)) + ) + (new 'stack-no-clear 'vector) + (dotimes (s5-0 (-> this info rider attach-point-count)) + (let ((s4-0 (as-type (handle->process (-> this attached-array s5-0)) process-focusable))) + (when (and s4-0 (focus-test? (the-as process-focusable s4-0) pilot-riding)) + (wvehicle-method-171 this (-> (the-as process-focusable s4-0) root trans) s5-0) + (wvehicle-method-172 this (-> (the-as process-focusable s4-0) root quat) s5-0) + ) + ) + ) + 0 + ) + ((method-of-type vehicle vehicle-method-77) this) + (none) ) ;; WARN: Return type mismatch symbol vs object. diff --git a/goal_src/jak3/levels/factory/car/hvehicle-physics.gc b/goal_src/jak3/levels/factory/car/hvehicle-physics.gc index 6632ad0962..2624d14810 100644 --- a/goal_src/jak3/levels/factory/car/hvehicle-physics.gc +++ b/goal_src/jak3/levels/factory/car/hvehicle-physics.gc @@ -8,321 +8,285 @@ ;; DECOMP BEGINS (defmethod vehicle-method-97 ((this hvehicle) (arg0 float) (arg1 vehicle-physics-work)) - (local-vars (v1-78 float) (v1-177 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s3-0 (-> this rbody))) - (mem-copy! (the-as pointer (-> arg1 mat)) (the-as pointer (-> s3-0 matrix)) 64) - (let* ((f28-0 (* -1.0 (-> this controls steering) (-> this info handling tire-steering-angle))) - (f30-0 (cos f28-0)) - (f0-2 (sin f28-0)) - ) - (set! (-> arg1 steering-axis x) f30-0) - (set! (-> arg1 steering-axis y) 0.0) - (set! (-> arg1 steering-axis z) f0-2) - ) - (vector-rotate*! (-> arg1 steering-axis) (-> arg1 steering-axis) (-> arg1 mat)) - (logior! (-> this v-flags) (vehicle-flag in-air)) - (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) - (vector-reset! (-> arg1 ground-normal)) - (set! (-> arg1 ground-normal y) 1.0) - (let ((f30-1 (-> this info handling ground-probe-distance))) - (let ((s2-0 (new 'stack-no-clear 'collide-query))) - (vector-reset! (-> arg1 lift-dir)) - (set! (-> arg1 lift-dir y) -1.0) - (set! (-> arg1 speed-factor) - (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) - ) - (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)) + (let ((s3-0 (-> this rbody))) + (mem-copy! (the-as pointer (-> arg1 mat)) (the-as pointer (-> s3-0 matrix)) 64) + (let* ((f28-0 (* -1.0 (-> this controls steering) (-> this info handling tire-steering-angle))) + (f30-0 (cos f28-0)) + (f0-2 (sin f28-0)) + ) + (set! (-> arg1 steering-axis x) f30-0) + (set! (-> arg1 steering-axis y) 0.0) + (set! (-> arg1 steering-axis z) f0-2) + ) + (vector-rotate*! (-> arg1 steering-axis) (-> arg1 steering-axis) (-> arg1 mat)) + (logior! (-> this v-flags) (vehicle-flag in-air)) + (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) + (vector-reset! (-> arg1 ground-normal)) + (set! (-> arg1 ground-normal y) 1.0) + (let ((f30-1 (-> this info handling ground-probe-distance))) + (let ((s2-0 (new 'stack-no-clear 'collide-query))) + (vector-reset! (-> arg1 lift-dir)) + (set! (-> arg1 lift-dir y) -1.0) + (set! (-> arg1 speed-factor) + (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) ) - (vector-normalize! (-> arg1 lift-dir) 1.0) - ) - (vector-float*! (-> s2-0 move-dist) (-> arg1 lift-dir) (the-as float f30-1)) - (let ((v1-26 s2-0)) - (set! (-> v1-26 radius) 409.6) - (set! (-> v1-26 collide-with) (collide-spec - backgnd - bot - obstacle - hit-by-player-list - hit-by-others-list - player-list - water - collectable - blocking-plane - pusher - vehicle-mesh-probeable - shield - vehicle-sphere-no-probe - ) - ) - (set! (-> v1-26 ignore-process0) #f) - (set! (-> v1-26 ignore-process1) #f) - (set! (-> v1-26 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) - (set! (-> v1-26 action-mask) (collide-action solid)) - ) - (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) - (let ((v1-29 (-> this info physics-model lift-thruster-array s1-0)) - (s0-0 (-> arg1 probe-work-array s1-0)) - ) - (vector-reset! (-> s0-0 tire-force)) - (vector-copy! (-> s0-0 local-pos) (-> v1-29 local-pos)) - (vector-copy! (-> s0-0 local-normal) (-> v1-29 rot)) - (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> arg1 mat)) - (let ((a1-9 (-> s0-0 probe-pos))) - (let ((v1-32 (-> s0-0 world-pos))) - (let ((a0-22 (-> arg1 mat uvec))) - (let ((a2-6 (-> this info handling ground-probe-offset))) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-22 quad)) - ) - (.lvf vf4 (&-> v1-32 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-9 quad) vf6) + (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)) ) - (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) - (vector-copy! (-> s0-0 wheel-axis) (the-as vector (if (< 0.0 (-> s0-0 local-pos z)) - (-> arg1 steering-axis) - (the-as vector (-> arg1 mat)) - ) - ) - ) - (vector-copy! (-> s0-0 ground-pos) (-> s0-0 probe-pos)) - (set! (-> s0-0 ground-pos y) 0.0) - (vector-reset! (-> s0-0 ground-normal)) - (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) - (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) - (let ((f0-15 (probe-using-line-sphere *collide-cache* s2-0))) - (cond - ((and (>= f0-15 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) - (logclear! (-> this v-flags) (vehicle-flag in-air)) - (logior! (-> this v-flags) (vehicle-flag on-ground)) - (set! (-> s0-0 ground-pos y) (- (-> s0-0 probe-pos y) (* f0-15 f30-1))) - (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) - (vector-copy! (-> arg1 ground-normal) (-> s0-0 ground-normal)) - ) - (else - (set! (-> s0-0 ground-pos y) (+ -81920.0 (-> s3-0 position y))) - ) + (t9-4 a0-7 a1-4 a2-3 (* f0-8 f0-8)) + ) + (vector-normalize! (-> arg1 lift-dir) 1.0) + ) + (vector-float*! (-> s2-0 move-dist) (-> arg1 lift-dir) (the-as float f30-1)) + (let ((v1-26 s2-0)) + (set! (-> v1-26 radius) 409.6) + (set! (-> v1-26 collide-with) (collide-spec + backgnd + bot + obstacle + hit-by-player-list + hit-by-others-list + player-list + water + collectable + blocking-plane + pusher + vehicle-mesh-probeable + shield + vehicle-sphere-no-probe + ) + ) + (set! (-> v1-26 ignore-process0) #f) + (set! (-> v1-26 ignore-process1) #f) + (set! (-> v1-26 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) + (set! (-> v1-26 action-mask) (collide-action solid)) + ) + (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) + (let ((v1-29 (-> this info physics-model lift-thruster-array s1-0)) + (s0-0 (-> arg1 probe-work-array s1-0)) + ) + (vector-reset! (-> s0-0 tire-force)) + (vector-copy! (-> s0-0 local-pos) (-> v1-29 local-pos)) + (vector-copy! (-> s0-0 local-normal) (-> v1-29 rot)) + (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> arg1 mat)) + (vector+*! + (-> s0-0 probe-pos) + (-> s0-0 world-pos) + (-> arg1 mat uvec) + (the-as float (-> this info handling ground-probe-offset)) + ) + (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) + (vector-copy! (-> s0-0 wheel-axis) (the-as vector (if (< 0.0 (-> s0-0 local-pos z)) + (-> arg1 steering-axis) + (the-as vector (-> arg1 mat)) + ) + ) + ) + (vector-copy! (-> s0-0 ground-pos) (-> s0-0 probe-pos)) + (set! (-> s0-0 ground-pos y) 0.0) + (vector-reset! (-> s0-0 ground-normal)) + (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) + (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) + (let ((f0-15 (probe-using-line-sphere *collide-cache* s2-0))) + (cond + ((and (>= f0-15 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) + (logclear! (-> this v-flags) (vehicle-flag in-air)) + (logior! (-> this v-flags) (vehicle-flag on-ground)) + (set! (-> s0-0 ground-pos y) (- (-> s0-0 probe-pos y) (* f0-15 f30-1))) + (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) + (vector-copy! (-> arg1 ground-normal) (-> s0-0 ground-normal)) + ) + (else + (set! (-> s0-0 ground-pos y) (+ -81920.0 (-> s3-0 position y))) ) ) - 0 ) + 0 ) ) ) - (set! (-> this lift-thrust 0) 0.0) - (set! (-> this lift-thrust 1) 0.0) - (set! (-> this lift-thrust 2) 0.0) - (set! (-> this lift-thrust 3) 0.0) - (set! (-> this roll-thrust 0) 0.0) - (set! (-> this roll-thrust 1) 0.0) - (when (>= 1 (-> this force-level)) - (dotimes (s2-1 (-> this info physics-model lift-thruster-count)) - (let ((s1-1 (-> arg1 probe-work-array s2-1))) - (vector-copy! (-> arg1 world-pos) (-> s1-1 world-pos)) - (vector-copy! (-> arg1 velocity) (-> s1-1 velocity)) - (let ((f28-1 (-> s1-1 probe-pos y))) - (when (> (-> this flight-level-index) 0) - (set! f28-1 (- f28-1 (+ 6144.0 (-> this flight-level)))) - (when (>= 0.0 f28-1) - (logclear! (-> this v-flags) (vehicle-flag in-air)) - (logior! (-> this v-flags) (vehicle-flag on-flight-level)) - (.lvf vf1 (&-> (-> s1-1 ground-normal) 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) - (if (= v1-78 0.0) - (set! (-> s1-1 ground-normal y) 1.0) - ) - ) + ) + (set! (-> this lift-thrust 0) 0.0) + (set! (-> this lift-thrust 1) 0.0) + (set! (-> this lift-thrust 2) 0.0) + (set! (-> this lift-thrust 3) 0.0) + (set! (-> this roll-thrust 0) 0.0) + (set! (-> this roll-thrust 1) 0.0) + (when (>= 1 (-> this force-level)) + (dotimes (s2-1 (-> this info physics-model lift-thruster-count)) + (let ((s1-1 (-> arg1 probe-work-array s2-1))) + (vector-copy! (-> arg1 world-pos) (-> s1-1 world-pos)) + (vector-copy! (-> arg1 velocity) (-> s1-1 velocity)) + (let ((f28-1 (-> s1-1 probe-pos y))) + (when (> (-> this flight-level-index) 0) + (set! f28-1 (- f28-1 (+ 6144.0 (-> this flight-level)))) + (when (>= 0.0 f28-1) + (logclear! (-> this v-flags) (vehicle-flag in-air)) + (logior! (-> this v-flags) (vehicle-flag on-flight-level)) + (if (= (vector-length-squared (-> s1-1 ground-normal)) 0.0) + (set! (-> s1-1 ground-normal y) 1.0) + ) ) - (when (or (logtest? (vehicle-flag flight-level-transition) (-> this v-flags)) - (and (> (-> this flight-level-index) 0) (< f28-1 0.0)) - ) - (if (zero? (-> this flight-level-index)) - (set! f28-1 40960.0) - ) - (let* ((f0-37 (* -1.0 - (-> this force-scale) - (-> this info physics-model inv-lift-thruster-count) - (-> this info info mass) - (-> this info extra gravity) - (+ 1.0 (* 2.0 (the float (-> this flight-level-index)))) - ) - ) - (f1-17 -1.0) - (f2-4 1.0) - (f3-4 16384.0) - (f3-7 (* f28-1 (/ 1.0 f3-4))) - (f4-2 0.5) - (f5-0 81920.0) - (f0-38 (* f0-37 (fmax f1-17 (fmin f2-4 (+ f3-7 (* f4-2 (/ 1.0 f5-0) (-> arg1 velocity y))))))) - ) - (let ((f1-20 (fmax 0.0 f0-38))) - (+! (-> this lift-thrust s2-1) f1-20) - (when (logtest? (vehicle-flag flight-level-transition) (-> this v-flags)) - (+! (-> this roll-thrust 0) (/ f1-20 20)) - (+! (-> this roll-thrust 1) (/ f1-20 20)) + ) + (when (or (logtest? (vehicle-flag flight-level-transition) (-> this v-flags)) + (and (> (-> this flight-level-index) 0) (< f28-1 0.0)) ) + (if (zero? (-> this flight-level-index)) + (set! f28-1 40960.0) + ) + (let* ((f0-37 (* -1.0 + (-> this force-scale) + (-> this info physics-model inv-lift-thruster-count) + (-> this info info mass) + (-> this info extra gravity) + (+ 1.0 (* 2.0 (the float (-> this flight-level-index)))) + ) + ) + (f1-17 -1.0) + (f2-4 1.0) + (f3-4 16384.0) + (f3-7 (* f28-1 (/ 1.0 f3-4))) + (f4-2 0.5) + (f5-0 81920.0) + (f0-38 (* f0-37 (fmax f1-17 (fmin f2-4 (+ f3-7 (* f4-2 (/ 1.0 f5-0) (-> arg1 velocity y))))))) + ) + (let ((f1-20 (fmax 0.0 f0-38))) + (+! (-> this lift-thrust s2-1) f1-20) + (when (logtest? (vehicle-flag flight-level-transition) (-> this v-flags)) + (+! (-> this roll-thrust 0) (/ f1-20 20)) + (+! (-> this roll-thrust 1) (/ f1-20 20)) ) - (vector-reset! (-> arg1 force)) - (set! (-> arg1 force y) f0-38) + ) + (vector-reset! (-> arg1 force)) + (set! (-> arg1 force y) f0-38) + ) + (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) + ) + (let ((f0-40 (+ 4096.0 f28-1))) + (when (or (and (logtest? (vehicle-flag flight-level-transition) (-> this v-flags)) + (< 0.0 f0-40) + (< 0.0 (-> arg1 velocity y)) + ) + (and (> (-> this flight-level-index) 0) (< f0-40 0.0) (< (-> arg1 velocity y) 0.0)) + ) + (vector-reset! (-> arg1 force)) + (let ((f0-43 (/ (-> this info physics-model inv-lift-thruster-count) -4)) + (f1-28 arg0) + ) + (set! (-> arg1 force y) (* f0-43 (/ 1.0 f1-28) (-> this info info mass) (-> arg1 velocity y))) ) (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) ) - (let ((f0-40 (+ 4096.0 f28-1))) - (when (or (and (logtest? (vehicle-flag flight-level-transition) (-> this v-flags)) - (< 0.0 f0-40) - (< 0.0 (-> arg1 velocity y)) - ) - (and (> (-> this flight-level-index) 0) (< f0-40 0.0) (< (-> arg1 velocity y) 0.0)) - ) - (vector-reset! (-> arg1 force)) - (let ((f0-43 (/ (-> this info physics-model inv-lift-thruster-count) -4)) - (f1-28 arg0) - ) - (set! (-> arg1 force y) (* f0-43 (/ 1.0 f1-28) (-> this info info mass) (-> arg1 velocity y))) - ) - (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) - (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) - ) - ) ) - (let* ((f1-36 (fmax 4096.0 (fmin (- (-> s1-1 probe-pos y) (-> s1-1 ground-pos y)) f30-1))) - (f28-2 (- 1.0 (/ (+ -4096.0 f1-36) (+ -4096.0 f30-1)))) - ) - (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s1-1 ground-normal) (-> arg1 mat uvec))) - (set! f28-2 0.0) + ) + (let* ((f1-36 (fmax 4096.0 (fmin (- (-> s1-1 probe-pos y) (-> s1-1 ground-pos y)) f30-1))) + (f28-2 (- 1.0 (/ (+ -4096.0 f1-36) (+ -4096.0 f30-1)))) + ) + (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s1-1 ground-normal) (-> arg1 mat uvec))) + (set! f28-2 0.0) + ) + (set! (-> arg1 tmp y) 0.0) + (set! (-> arg1 tmp x) (-> arg1 velocity z)) + (set! (-> arg1 tmp z) (- (-> arg1 velocity x))) + (vector-normalize! (-> arg1 tmp) 1.0) + (vector+float*! + (-> arg1 normal) + (-> s1-1 ground-normal) + (-> arg1 tmp) + (- (vector-dot (-> s1-1 ground-normal) (-> arg1 tmp))) + ) + (let ((v1-150 (-> arg1 force)) + (a0-55 (-> arg1 normal)) + (f0-58 (* 2.0 f28-2)) + (f1-41 arg0) ) - (set! (-> arg1 tmp y) 0.0) - (set! (-> arg1 tmp x) (-> arg1 velocity z)) - (set! (-> arg1 tmp z) (- (-> arg1 velocity x))) - (vector-normalize! (-> arg1 tmp) 1.0) - (vector+float*! - (-> arg1 normal) - (-> s1-1 ground-normal) - (-> arg1 tmp) - (- (vector-dot (-> s1-1 ground-normal) (-> arg1 tmp))) - ) - (let ((v1-150 (-> arg1 force)) - (a0-55 (-> arg1 normal)) - (f0-58 (* 2.0 f28-2)) - (f1-41 arg0) - ) - (vector-float*! v1-150 a0-55 (* f0-58 - (/ 1.0 f1-41) - (-> this info physics-model inv-lift-thruster-count) - (-> this info info mass) - (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> arg1 normal)))) - ) - ) - ) - (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) - (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) - (let ((f0-72 (* 8.0 - (-> this info info mass) - (-> this info extra gravity) - (-> this info physics-model inv-lift-thruster-count) - (+ (* (-> this info handling spring-lift-factor) f28-2) - (* 0.75 (-> this jump-thrust) (-> this info handling jump-thrust-factor)) - ) - (- (+ 1.0 (* 2.0 (rand-vu) (-> this power-fluctuation-factor))) (-> this power-fluctuation-factor)) + (vector-float*! v1-150 a0-55 (* f0-58 + (/ 1.0 f1-41) + (-> this info physics-model inv-lift-thruster-count) + (-> this info info mass) + (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> arg1 normal)))) + ) ) - ) - ) - (+! (-> this lift-thrust s2-1) f0-72) - (vector-float*! (-> arg1 force) (-> arg1 lift-dir) (* -1.0 f0-72)) - ) ) (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) - (when (and (< 0.0 (-> this info handling tire-friction-factor)) (let ((f0-75 0.0)) - (.lvf vf1 (&-> (-> s1-1 ground-normal) 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-177 vf1) - (< f0-75 v1-177) - ) - ) - (vector+float*! - (-> arg1 normal) - (-> s1-1 wheel-axis) - (-> s1-1 ground-normal) - (- (vector-dot (-> s1-1 wheel-axis) (-> s1-1 ground-normal))) - ) - (vector-normalize! (-> arg1 normal) 1.0) - (vector-copy! (-> arg1 world-pos) (-> s3-0 position)) - (vector-copy! (-> arg1 velocity) (-> s3-0 lin-velocity)) - (vector-! (-> arg1 p-body) (-> arg1 world-pos) (-> s3-0 position)) - (vector-cross! (-> arg1 tmp) (-> arg1 p-body) (-> arg1 normal)) - (vector-rotate*! (-> arg1 tmp) (-> arg1 tmp) (-> s3-0 inv-i-world)) - (vector-cross! (-> arg1 tmp) (-> arg1 tmp) (-> arg1 p-body)) - (set! (-> arg1 vel-dot-norm) (vector-dot (-> arg1 velocity) (-> arg1 normal))) - (let ((f0-82 (fabs (-> arg1 vel-dot-norm)))) - (set! (-> arg1 friction-coef) - (smooth-interp - (-> this info handling tire-static-friction) - (-> this info handling tire-dynamic-friction) - f0-82 - (-> this info handling tire-static-friction-speed) - (-> this info handling tire-dynamic-friction-speed) - ) - ) - ) - (set! (-> arg1 friction-coef) - (* (-> arg1 friction-coef) (+ 1.0 (* -0.75 (fmax 0.0 (fmin 1.0 (-> this engine-thrust)))))) - ) - (let ((f0-90 (* (-> arg1 friction-coef) - (-> this info handling tire-friction-factor) - (fmax 0.0 (vector-dot (-> s1-1 ground-normal) (-> s1-1 tire-force))) - ) - ) - ) - (set! (-> arg1 impulse) (/ (/ (-> arg1 vel-dot-norm) -2) - (* arg0 (+ (-> s3-0 info inv-mass) (vector-dot (-> arg1 normal) (-> arg1 tmp)))) - ) - ) - (set! (-> arg1 impulse) (fmax (fmin (-> arg1 impulse) f0-90) (- f0-90))) - ) - (vector-float*! (-> arg1 force) (-> arg1 normal) (-> arg1 impulse)) - (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + (let ((f0-72 (* 8.0 + (-> this info info mass) + (-> this info extra gravity) + (-> this info physics-model inv-lift-thruster-count) + (+ (* (-> this info handling spring-lift-factor) f28-2) + (* 0.75 (-> this jump-thrust) (-> this info handling jump-thrust-factor)) + ) + (- (+ 1.0 (* 2.0 (rand-vu) (-> this power-fluctuation-factor))) (-> this power-fluctuation-factor)) + ) + ) + ) + (+! (-> this lift-thrust s2-1) f0-72) + (vector-float*! (-> arg1 force) (-> arg1 lift-dir) (* -1.0 f0-72)) ) ) + (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) + (when (and (< 0.0 (-> this info handling tire-friction-factor)) + (< 0.0 (vector-length-squared (-> s1-1 ground-normal))) + ) + (vector+float*! + (-> arg1 normal) + (-> s1-1 wheel-axis) + (-> s1-1 ground-normal) + (- (vector-dot (-> s1-1 wheel-axis) (-> s1-1 ground-normal))) + ) + (vector-normalize! (-> arg1 normal) 1.0) + (vector-copy! (-> arg1 world-pos) (-> s3-0 position)) + (vector-copy! (-> arg1 velocity) (-> s3-0 lin-velocity)) + (vector-! (-> arg1 p-body) (-> arg1 world-pos) (-> s3-0 position)) + (vector-cross! (-> arg1 tmp) (-> arg1 p-body) (-> arg1 normal)) + (vector-rotate*! (-> arg1 tmp) (-> arg1 tmp) (-> s3-0 inv-i-world)) + (vector-cross! (-> arg1 tmp) (-> arg1 tmp) (-> arg1 p-body)) + (set! (-> arg1 vel-dot-norm) (vector-dot (-> arg1 velocity) (-> arg1 normal))) + (let ((f0-82 (fabs (-> arg1 vel-dot-norm)))) + (set! (-> arg1 friction-coef) + (smooth-interp + (-> this info handling tire-static-friction) + (-> this info handling tire-dynamic-friction) + f0-82 + (-> this info handling tire-static-friction-speed) + (-> this info handling tire-dynamic-friction-speed) + ) + ) + ) + (set! (-> arg1 friction-coef) + (* (-> arg1 friction-coef) (+ 1.0 (* -0.75 (fmax 0.0 (fmin 1.0 (-> this engine-thrust)))))) + ) + (let ((f0-90 (* (-> arg1 friction-coef) + (-> this info handling tire-friction-factor) + (fmax 0.0 (vector-dot (-> s1-1 ground-normal) (-> s1-1 tire-force))) + ) + ) + ) + (set! (-> arg1 impulse) (/ (/ (-> arg1 vel-dot-norm) -2) + (* arg0 (+ (-> s3-0 info inv-mass) (vector-dot (-> arg1 normal) (-> arg1 tmp)))) + ) + ) + (set! (-> arg1 impulse) (fmax (fmin (-> arg1 impulse) f0-90) (- f0-90))) + ) + (vector-float*! (-> arg1 force) (-> arg1 normal) (-> arg1 impulse)) + (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod apply-gravity! ((this hvehicle) (arg0 float)) diff --git a/goal_src/jak3/levels/factory/car/hvehicle-util.gc b/goal_src/jak3/levels/factory/car/hvehicle-util.gc index 241ef7b36e..f61dcf7c94 100644 --- a/goal_src/jak3/levels/factory/car/hvehicle-util.gc +++ b/goal_src/jak3/levels/factory/car/hvehicle-util.gc @@ -8,177 +8,146 @@ ;; DECOMP BEGINS (defmethod vehicle-controller-method-18 ((this vehicle-controller) (arg0 vector) (arg1 vector) (arg2 vehicle) (arg3 float)) - (local-vars - (v1-24 float) - (v1-87 float) - (a0-35 float) - (a0-95 int) - (a0-97 int) - (sv-16 vector) - (sv-20 float) - (sv-24 float) - ) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) + (local-vars (a0-95 int) (a0-97 int) (sv-16 vector) (sv-20 float) (sv-24 float)) + (let* ((v1-1 (-> *perf-stats* data 21)) + (a0-1 (-> v1-1 ctrl)) ) - (init-vf0-vector) - (let* ((v1-1 (-> *perf-stats* data 21)) - (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) - ) + (+! (-> v1-1 count) 1) + (b! (zero? a0-1) cfg-2 :delay (nop!)) + (.mtc0 Perf 0) (.sync.l) (.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))) - (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)) - (vector-z-quaternion! (-> gp-0 mat trans) (-> arg2 root quat)) - (vector-reset! (-> gp-0 mat fvec)) - (cond - ((logtest? (-> this flags) (vehicle-controller-flag on-straightaway)) - (vector-! (-> gp-0 world-pos) (-> this turn-enter-point) (-> gp-0 mat rvec)) - (let ((f0-5 (vector-dot (-> gp-0 world-pos) (-> this turn-enter-dir)))) - (vector+float*! (-> gp-0 force) (-> this turn-enter-point) (-> this turn-enter-dir) (- f0-5)) - (vector-copy! (-> gp-0 velocity) (-> this turn-enter-dir)) - (if (>= 0.0 f0-5) - (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))))) - (.lvf vf1 (&-> arg1 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-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 dir x) (fmin (-> gp-0 dir x) (-> this max-turn-speed))) - ) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf a0-1) + ) + (.sync.l) + (.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))) + (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)) + (vector-z-quaternion! (-> gp-0 mat trans) (-> arg2 root quat)) + (vector-reset! (-> gp-0 mat fvec)) + (cond + ((logtest? (-> this flags) (vehicle-controller-flag on-straightaway)) + (vector-! (-> gp-0 world-pos) (-> this turn-enter-point) (-> gp-0 mat rvec)) + (let ((f0-5 (vector-dot (-> gp-0 world-pos) (-> this turn-enter-dir)))) + (vector+float*! (-> gp-0 force) (-> this turn-enter-point) (-> this turn-enter-dir) (- f0-5)) + (vector-copy! (-> gp-0 velocity) (-> this turn-enter-dir)) + (if (>= 0.0 f0-5) + (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))) ) - ) ) ) ) - (else - (if (not (logtest? (-> this flags) (vehicle-controller-flag no-slowing-for-turns))) - (set! (-> gp-0 dir x) (fmin (-> gp-0 dir x) (-> this max-turn-speed))) - ) - (vector-! (-> gp-0 world-pos) (-> gp-0 mat rvec) (-> this dest-circle)) - (vector-normalize! (-> gp-0 world-pos) 1.0) - (set! (-> gp-0 velocity x) (- (-> gp-0 world-pos z))) - (set! (-> gp-0 velocity y) 0.0) - (set! (-> gp-0 velocity z) (-> gp-0 world-pos x)) - (if (logtest? (-> this flags) (vehicle-controller-flag left-turn)) - (vector-float*! (-> gp-0 velocity) (-> gp-0 velocity) -1.0) - ) - (vector-float*! (-> gp-0 world-pos) (-> gp-0 world-pos) (-> this dest-circle w)) - (vector+! (-> gp-0 force) (-> this dest-circle) (-> gp-0 world-pos)) - (when (logtest? (-> this flags) (vehicle-controller-flag attached)) - (vector-! (-> gp-0 steering-axis) (-> this turn-exit-point) (-> gp-0 mat rvec)) - (when (and (< (vector-dot (-> this turn-exit-dir) (-> gp-0 steering-axis)) 0.0) - (>= (vector-dot (-> this turn-exit-dir) (-> gp-0 mat trans)) (cos 8192.0)) - ) - (if (not (vehicle-controller-method-14 this arg2)) - (set! (-> gp-0 dir x) 0.0) - ) - ) + ) + (else + (if (not (logtest? (-> this flags) (vehicle-controller-flag no-slowing-for-turns))) + (set! (-> gp-0 dir x) (fmin (-> gp-0 dir x) (-> this max-turn-speed))) + ) + (vector-! (-> gp-0 world-pos) (-> gp-0 mat rvec) (-> this dest-circle)) + (vector-normalize! (-> gp-0 world-pos) 1.0) + (set! (-> gp-0 velocity x) (- (-> gp-0 world-pos z))) + (set! (-> gp-0 velocity y) 0.0) + (set! (-> gp-0 velocity z) (-> gp-0 world-pos x)) + (if (logtest? (-> this flags) (vehicle-controller-flag left-turn)) + (vector-float*! (-> gp-0 velocity) (-> gp-0 velocity) -1.0) + ) + (vector-float*! (-> gp-0 world-pos) (-> gp-0 world-pos) (-> this dest-circle w)) + (vector+! (-> gp-0 force) (-> this dest-circle) (-> gp-0 world-pos)) + (when (logtest? (-> this flags) (vehicle-controller-flag attached)) + (vector-! (-> gp-0 steering-axis) (-> this turn-exit-point) (-> gp-0 mat rvec)) + (when (and (< (vector-dot (-> this turn-exit-dir) (-> gp-0 steering-axis)) 0.0) + (>= (vector-dot (-> this turn-exit-dir) (-> gp-0 mat trans)) (cos 8192.0)) + ) + (if (not (vehicle-controller-method-14 this arg2)) + (set! (-> gp-0 dir x) 0.0) + ) ) ) ) - (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)) - ) + ) + (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)) ) - (let ((s3-1 (new 'stack-no-clear 'array 'collide-shape 10)) - (f30-1 (-> arg2 root root-prim prim-core world-sphere w)) - ) - (countdown (s4-1 (fill-actor-list-for-sphere - (-> this traffic object-hash) - (-> gp-0 mat rvec) - (-> gp-0 mat uvec) - (* 1.5 f30-1) - s3-1 - 10 - (-> arg2 traffic-hash-id) - ) + ) + (let ((s3-1 (new 'stack-no-clear 'array 'collide-shape 10)) + (f30-1 (-> arg2 root root-prim prim-core world-sphere w)) + ) + (countdown (s4-1 (fill-actor-list-for-sphere + (-> this traffic object-hash) + (-> gp-0 mat rvec) + (-> gp-0 mat uvec) + (* 1.5 f30-1) + s3-1 + 10 + (-> arg2 traffic-hash-id) ) - (let ((v1-70 (as-type (-> s3-1 s4-1) hvehicle))) - (when (and v1-70 (not (logtest? (-> v1-70 v-flags) (vehicle-flag dead))) (nonzero? (-> v1-70 flight-level-index))) - (vector-copy! (-> gp-0 lift-dir) (-> v1-70 root trans)) - (vector-copy! (-> gp-0 normal) (-> v1-70 root transv)) - (vector-! (-> gp-0 tmp) (-> gp-0 mat rvec) (-> gp-0 lift-dir)) - (.lvf vf1 (&-> (-> gp-0 tmp) 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-35 vf1) - (let ((f1-12 a0-35)) - (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 ((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)) - (vector-! (-> gp-0 p-body) (-> gp-0 mat uvec) (-> gp-0 normal)) - (let ((f1-14 (vector-dot (-> gp-0 axis) (-> gp-0 p-body)))) - (when (< f1-14 0.0) - (vector-float*! - (-> gp-0 world-pos) - (-> gp-0 axis) - (* -0.5 (/ sv-24 (+ sv-24 (-> v1-70 info info inv-mass))) sv-20 f1-14) - ) - (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) + ) + (let ((v1-70 (as-type (-> s3-1 s4-1) hvehicle))) + (when (and v1-70 (not (logtest? (-> v1-70 v-flags) (vehicle-flag dead))) (nonzero? (-> v1-70 flight-level-index))) + (vector-copy! (-> gp-0 lift-dir) (-> v1-70 root trans)) + (vector-copy! (-> gp-0 normal) (-> v1-70 root transv)) + (vector-! (-> gp-0 tmp) (-> gp-0 mat rvec) (-> gp-0 lift-dir)) + (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 ((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)) + (vector-! (-> gp-0 p-body) (-> gp-0 mat uvec) (-> gp-0 normal)) + (let ((f1-14 (vector-dot (-> gp-0 axis) (-> gp-0 p-body)))) + (when (< f1-14 0.0) + (vector-float*! + (-> gp-0 world-pos) + (-> gp-0 axis) + (* -0.5 (/ sv-24 (+ sv-24 (-> v1-70 info info inv-mass))) sv-20 f1-14) ) + (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) ) ) - (vector-float*! (-> gp-0 world-pos) (-> gp-0 axis) (* 163840.0 f0-31)) - (set! (-> gp-0 world-pos y) 0.0) - (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) ) + (vector-float*! (-> gp-0 world-pos) (-> gp-0 axis) (* 163840.0 f0-31)) + (set! (-> gp-0 world-pos y) 0.0) + (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) ) - (when (< (cos 8192.0) (- (vector-dot (-> gp-0 mat trans) (-> gp-0 axis)))) - (when (< (nearest-dist2-between-moving-points - (-> gp-0 mat rvec) - (-> gp-0 mat uvec) - (-> gp-0 lift-dir) - (-> gp-0 normal) - 2.0 - ) - f28-0 + ) + (when (< (cos 8192.0) (- (vector-dot (-> gp-0 mat trans) (-> gp-0 axis)))) + (when (< (nearest-dist2-between-moving-points + (-> gp-0 mat rvec) + (-> gp-0 mat uvec) + (-> gp-0 lift-dir) + (-> gp-0 normal) + 2.0 ) - (let ((f0-37 (fmax 0.0 (vector-dot (-> gp-0 mat trans) (-> gp-0 normal))))) - (set! (-> gp-0 dir x) (fmin (-> gp-0 dir x) f0-37)) - ) + f28-0 + ) + (let ((f0-37 (fmax 0.0 (vector-dot (-> gp-0 mat trans) (-> gp-0 normal))))) + (set! (-> gp-0 dir x) (fmin (-> gp-0 dir x) f0-37)) ) ) ) @@ -189,101 +158,94 @@ ) ) ) - (when (not (logtest? (-> this flags) (vehicle-controller-flag ignore-others))) - (vector-! (-> gp-0 world-pos) (-> gp-0 force) (-> gp-0 mat rvec)) - (.lvf vf1 (&-> (-> gp-0 world-pos) 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-87 vf1) - (let ((f0-39 v1-87)) - (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 (not (logtest? (-> this flags) (vehicle-controller-flag ignore-others))) + (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)) ) ) - (vector+float*! - (-> gp-0 world-pos) - (-> gp-0 mat uvec) - (-> gp-0 velocity) - (- (vector-dot (-> gp-0 velocity) (-> gp-0 mat uvec))) - ) - (vector-! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) ) - (cond - ((logtest? (-> this flags) (vehicle-controller-flag direct-mode)) - (vector-! (-> gp-0 world-normal) (-> this turn-exit-point) (-> gp-0 mat rvec)) - (vector-normalize! (-> gp-0 world-normal) (-> gp-0 dir x)) - (vector-! (-> gp-0 world-pos) (-> gp-0 world-normal) (-> gp-0 mat uvec)) - (vector-float*! (-> gp-0 world-pos) (-> gp-0 world-pos) 3.0) - (let ((f0-48 (vector-dot (-> gp-0 mat trans) (-> gp-0 world-pos)))) - (if (< f0-48 0.0) - (vector+float*! (-> gp-0 world-pos) (-> gp-0 world-pos) (-> gp-0 mat trans) (* -0.875 f0-48)) + (vector+float*! + (-> gp-0 world-pos) + (-> gp-0 mat uvec) + (-> gp-0 velocity) + (- (vector-dot (-> gp-0 velocity) (-> gp-0 mat uvec))) + ) + (vector-! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) + ) + (cond + ((logtest? (-> this flags) (vehicle-controller-flag direct-mode)) + (vector-! (-> gp-0 world-normal) (-> this turn-exit-point) (-> gp-0 mat rvec)) + (vector-normalize! (-> gp-0 world-normal) (-> gp-0 dir x)) + (vector-! (-> gp-0 world-pos) (-> gp-0 world-normal) (-> gp-0 mat uvec)) + (vector-float*! (-> gp-0 world-pos) (-> gp-0 world-pos) 3.0) + (let ((f0-48 (vector-dot (-> gp-0 mat trans) (-> gp-0 world-pos)))) + (if (< f0-48 0.0) + (vector+float*! (-> gp-0 world-pos) (-> gp-0 world-pos) (-> gp-0 mat trans) (* -0.875 f0-48)) + ) + ) + ) + (else + (vector+float*! (-> gp-0 local-pos) (-> gp-0 mat rvec) (-> gp-0 mat uvec) 0.4) + (vector-! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> this turn-enter-point)) + (cond + ((< (vector-dot (-> gp-0 world-pos) (-> this turn-enter-dir)) 0.0) + (vector-! (-> gp-0 world-normal) (-> this turn-enter-point) (-> gp-0 mat rvec)) + ) + ((begin + (vector-! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> this turn-exit-point)) + (< (vector-dot (-> gp-0 world-pos) (-> this turn-exit-dir)) 0.0) + ) + (vector-! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> this dest-circle)) + (set! (-> gp-0 world-normal x) (- (-> gp-0 world-pos z))) + (set! (-> gp-0 world-normal y) 0.0) + (set! (-> gp-0 world-normal z) (-> gp-0 world-pos x)) + (if (logtest? (-> this flags) (vehicle-controller-flag left-turn)) + (vector-float*! (-> gp-0 world-normal) (-> gp-0 world-normal) -1.0) ) ) - ) - (else - (vector+float*! (-> gp-0 local-pos) (-> gp-0 mat rvec) (-> gp-0 mat uvec) 0.4) - (vector-! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> this turn-enter-point)) - (cond - ((< (vector-dot (-> gp-0 world-pos) (-> this turn-enter-dir)) 0.0) - (vector-! (-> gp-0 world-normal) (-> this turn-enter-point) (-> gp-0 mat rvec)) - ) - ((begin - (vector-! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> this turn-exit-point)) - (< (vector-dot (-> gp-0 world-pos) (-> this turn-exit-dir)) 0.0) - ) - (vector-! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> this dest-circle)) - (set! (-> gp-0 world-normal x) (- (-> gp-0 world-pos z))) - (set! (-> gp-0 world-normal y) 0.0) - (set! (-> gp-0 world-normal z) (-> gp-0 world-pos x)) - (if (logtest? (-> this flags) (vehicle-controller-flag left-turn)) - (vector-float*! (-> gp-0 world-normal) (-> gp-0 world-normal) -1.0) - ) - ) - (else - (vector-copy! (-> gp-0 world-normal) (-> this turn-exit-dir)) - ) + (else + (vector-copy! (-> gp-0 world-normal) (-> this turn-exit-dir)) ) - (let ((f0-60 (vector-length (-> gp-0 world-normal)))) - (if (< 0.1 f0-60) - (vector-float*! (-> gp-0 world-normal) (-> gp-0 world-normal) (/ (-> gp-0 dir x) f0-60)) - ) - ) - (vector-! (-> gp-0 world-pos) (-> gp-0 world-normal) (-> gp-0 mat uvec)) - (vector-float*! (-> gp-0 world-pos) (-> gp-0 world-pos) 2.0) ) + (let ((f0-60 (vector-length (-> gp-0 world-normal)))) + (if (< 0.1 f0-60) + (vector-float*! (-> gp-0 world-normal) (-> gp-0 world-normal) (/ (-> gp-0 dir x) f0-60)) + ) + ) + (vector-! (-> gp-0 world-pos) (-> gp-0 world-normal) (-> gp-0 mat uvec)) + (vector-float*! (-> gp-0 world-pos) (-> gp-0 world-pos) 2.0) ) - (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) - (vector-copy! sv-16 (-> gp-0 mat fvec)) ) - (let ((v1-144 (-> *perf-stats* data 21))) - (b! (zero? (-> v1-144 ctrl)) cfg-76 :delay (nop!)) - (.mtc0 Perf 0) - (.sync.l) - (.sync.p) - (.mfpc a0-95 pcr0) - (+! (-> v1-144 accum0) a0-95) - (.mfpc a0-97 pcr1) - (+! (-> v1-144 accum1) a0-97) - ) - (label cfg-76) - 0 - 0 - (none) + (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) + (vector-copy! sv-16 (-> gp-0 mat fvec)) ) + (let ((v1-144 (-> *perf-stats* data 21))) + (b! (zero? (-> v1-144 ctrl)) cfg-76 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-95 pcr0) + (+! (-> v1-144 accum0) a0-95) + (.mfpc a0-97 pcr1) + (+! (-> v1-144 accum1) a0-97) + ) + (label cfg-76) + 0 + 0 + (none) ) (defmethod vehicle-controller-method-12 ((this vehicle-controller) diff --git a/goal_src/jak3/levels/factory/car/hvehicle.gc b/goal_src/jak3/levels/factory/car/hvehicle.gc index ff074602f9..3b75241b58 100644 --- a/goal_src/jak3/levels/factory/car/hvehicle.gc +++ b/goal_src/jak3/levels/factory/car/hvehicle.gc @@ -118,74 +118,44 @@ ) (defmethod vehicle-method-103 ((this hvehicle)) - (local-vars (v1-13 float) (v1-25 float) (v1-30 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)) - (cond - ((logtest? (vehicle-flag ai-driving) (-> this v-flags)) - (when (and (not (logtest? (-> this controller flags) (vehicle-controller-flag off-path))) - (>= (-> this rbody matrix uvec y) (cos 910.2222)) - ) - (.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-13 vf1) - (let ((f0-1 v1-13) - (f1-0 0.5) - ) - (if (< f0-1 (* f1-0 f1-0)) - (logclear! (-> this v-flags) (vehicle-flag disturbed)) - ) - ) + (when (time-elapsed? (-> this disturbed-time) (seconds 2)) + (cond + ((logtest? (vehicle-flag ai-driving) (-> this v-flags)) + (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)) + ) ) ) - (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))) - ) - (.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-25 vf1) - (when (and (< v1-25 f0-4) (begin - (.lvf vf1 (&-> (-> this rbody lin-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-30 vf1) - (let ((f1-7 v1-30) - (f2-0 614.4) - ) - (< f1-7 (* f0-4 (* f2-0 f2-0))) - ) - ) + ) + (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))) + ) + (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))) ) - (logclear! (-> this v-flags) (vehicle-flag disturbed)) - (vehicle-method-142 this) - ) + ) + (logclear! (-> this v-flags) (vehicle-flag disturbed)) + (vehicle-method-142 this) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod vehicle-method-101 ((this hvehicle)) @@ -521,95 +491,71 @@ ) (defmethod vehicle-method-94 ((this hvehicle)) - (local-vars (v1-14 float) (v1-24 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((f0-0 (the-as number -4096000.0))) - (dotimes (v1-1 (-> *level* length)) - (let ((a0-4 (-> *level* level v1-1))) - (when (= (-> a0-4 status) 'active) - (let ((a0-6 (-> a0-4 bsp city-level-info))) - (when (nonzero? a0-6) - (let ((f1-0 (the-as float (-> a0-6 camera-ceiling)))) - (if (= (the-as meters f1-0) 0.0) - (set! f1-0 40960000.0) - ) - (set! f0-0 (fmax (the-as float f0-0) f1-0)) - ) + (let ((f0-0 (the-as number -4096000.0))) + (dotimes (v1-1 (-> *level* length)) + (let ((a0-4 (-> *level* level v1-1))) + (when (= (-> a0-4 status) 'active) + (let ((a0-6 (-> a0-4 bsp city-level-info))) + (when (nonzero? a0-6) + (let ((f1-0 (the-as float (-> a0-6 camera-ceiling)))) + (if (= (the-as meters f1-0) 0.0) + (set! f1-0 40960000.0) + ) + (set! f0-0 (fmax (the-as float f0-0) f1-0)) ) ) ) ) ) - (if (>= -4096000.0 (the-as float f0-0)) - (set! f0-0 40960000.0) - ) - (set-setting! 'string-camera-ceiling 'abs (the-as float f0-0) 0) ) - (cond - ((logtest? (vehicle-flag camera-rapid-tracking-mode) (-> this v-flags)) - (.lvf vf1 (&-> (-> this 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 v1-14 vf1) - (let ((f0-1 v1-14) - (f1-2 122880.0) - ) - (if (< f0-1 (* f1-2 f1-2)) - (vehicle-method-87 this) - ) - ) - ) - (else - (let* ((f0-2 143360.0) - (f0-4 (* f0-2 f0-2)) - ) - (.lvf vf1 (&-> (-> this 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 v1-24 vf1) - (if (< f0-4 v1-24) - (vehicle-method-86 this) - ) - ) + (if (>= -4096000.0 (the-as float f0-0)) + (set! f0-0 40960000.0) ) - ) - (let ((t9-3 (method-of-type vehicle vehicle-method-94))) - (t9-3 this) - ) - (when *target* - (let ((v1-31 (math-camera-matrix)) - (a0-17 (new 'stack-no-clear 'matrix)) - ) - (vector-copy! (-> a0-17 uvec) (-> *target* alt-cam-pos)) - (vector-! (-> a0-17 rvec) (-> a0-17 uvec) (-> v1-31 trans)) - (let ((f0-7 (/ (vector-dot (-> a0-17 rvec) (-> v1-31 uvec)) (vector-dot (-> a0-17 rvec) (-> v1-31 fvec))))) - (cond - ((and (< f0-7 0.15) (< -0.5 f0-7)) - (set-setting! 'vertical-follow-matches-camera #f 0.0 0) - ) - (else - (if (< (fabs (-> this root transv y)) 8192.0) - (remove-setting! 'vertical-follow-matches-camera) - ) - ) - ) - ) - ) - ) - 0 - (none) + (set-setting! 'string-camera-ceiling 'abs (the-as float f0-0) 0) ) + (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) + ) + ) + ) + (else + (let ((f0-2 143360.0)) + (if (< (* f0-2 f0-2) (vector-length-squared (-> this root transv))) + (vehicle-method-86 this) + ) + ) + ) + ) + (let ((t9-3 (method-of-type vehicle vehicle-method-94))) + (t9-3 this) + ) + (when *target* + (let ((v1-31 (math-camera-matrix)) + (a0-17 (new 'stack-no-clear 'matrix)) + ) + (vector-copy! (-> a0-17 uvec) (-> *target* alt-cam-pos)) + (vector-! (-> a0-17 rvec) (-> a0-17 uvec) (-> v1-31 trans)) + (let ((f0-7 (/ (vector-dot (-> a0-17 rvec) (-> v1-31 uvec)) (vector-dot (-> a0-17 rvec) (-> v1-31 fvec))))) + (cond + ((and (< f0-7 0.15) (< -0.5 f0-7)) + (set-setting! 'vertical-follow-matches-camera #f 0.0 0) + ) + (else + (if (< (fabs (-> this root transv y)) 8192.0) + (remove-setting! 'vertical-follow-matches-camera) + ) + ) + ) + ) + ) + ) + 0 + (none) ) (defmethod vehicle-method-93 ((this hvehicle)) diff --git a/goal_src/jak3/levels/factory/fac-gunturret.gc b/goal_src/jak3/levels/factory/fac-gunturret.gc index 7d616c08bd..d91a356046 100644 --- a/goal_src/jak3/levels/factory/fac-gunturret.gc +++ b/goal_src/jak3/levels/factory/fac-gunturret.gc @@ -732,73 +732,24 @@ ;; WARN: Return type mismatch (pointer process) vs (pointer joint-exploder). (defmethod go-explode ((this fac-gunturret)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (sound-play "explosion") - (let ((v1-2 (-> s5-0 fountain-rand-transv-lo))) - (let ((a0-5 (-> this root trans))) - (let ((a1-2 *up-vector*)) - (let ((a2-3 2048.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a1-2 quad)) - ) - (.lvf vf4 (&-> a0-5 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-2 quad) vf6) - ) - (vector-float*! s4-0 *up-vector* (* 4096.0 (rand-vu-float-range 20.0 30.0))) - (let ((a1-4 (-> s5-0 fountain-rand-transv-lo))) - (let ((v1-4 s4-0)) - (let ((a0-7 *identity-vector*)) - (let ((a2-5 -204800.0)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-7 quad)) - ) - (.lvf vf4 (&-> v1-4 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-4 quad) vf6) - ) - (let ((a0-8 (-> s5-0 fountain-rand-transv-hi))) - (let ((v1-5 *identity-vector*)) - (let ((a1-6 204800.0)) - (.mov vf7 a1-6) - ) - (.lvf vf5 (&-> v1-5 quad)) - ) - (.lvf vf4 (&-> s4-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-8 quad) vf6) - ) - ) - (set! (-> s5-0 gravity) -122880.0) - (process-spawn - joint-exploder - (-> this params explode-sg) - 9 - s5-0 - *fac-gunturret-exploder-params* - :name "joint-exploder" - :to this - :unk 0 - ) + (let ((s5-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (sound-play "explosion") + (vector+*! (-> s5-0 fountain-rand-transv-lo) (-> this root trans) *up-vector* 2048.0) + (vector-float*! s4-0 *up-vector* (* 4096.0 (rand-vu-float-range 20.0 30.0))) + (vector+*! (-> s5-0 fountain-rand-transv-lo) s4-0 *identity-vector* -204800.0) + (vector+*! (-> s5-0 fountain-rand-transv-hi) s4-0 *identity-vector* 204800.0) + ) + (set! (-> s5-0 gravity) -122880.0) + (process-spawn + joint-exploder + (-> this params explode-sg) + 9 + s5-0 + *fac-gunturret-exploder-params* + :name "joint-exploder" + :to this + :unk 0 ) ) ) diff --git a/goal_src/jak3/levels/factory/fac-robotank.gc b/goal_src/jak3/levels/factory/fac-robotank.gc index c77946a895..4e4fbf8e35 100644 --- a/goal_src/jak3/levels/factory/fac-robotank.gc +++ b/goal_src/jak3/levels/factory/fac-robotank.gc @@ -550,84 +550,35 @@ ;; WARN: Return type mismatch (pointer process) vs (pointer joint-exploder). (defmethod go-explode ((this fac-robotank)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (sound-play "tank-explode") - (cond - ((logtest? (-> *part-group-id-table* 732 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) (-> this root trans)) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 732)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) (-> this root trans)) - (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 732)) - ) + (sound-play "tank-explode") + (cond + ((logtest? (-> *part-group-id-table* 732 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) (-> this root trans)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 732)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) (-> this root trans)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 732)) ) - (let ((s5-3 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((v1-34 (new 'stack-no-clear 'vector))) - (let ((a0-17 (-> s5-3 fountain-rand-transv-lo))) - (let ((a1-9 (-> this root trans))) - (let ((a2-12 *up-vector*)) - (let ((a3-6 2048.0)) - (.mov vf7 a3-6) - ) - (.lvf vf5 (&-> a2-12 quad)) - ) - (.lvf vf4 (&-> a1-9 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-17 quad) vf6) - ) - (vector-float*! v1-34 *up-vector* 81920.0) - (let ((a2-14 (-> s5-3 fountain-rand-transv-lo))) - (let ((a0-20 v1-34)) - (let ((a1-11 *identity-vector*)) - (let ((a3-8 -40960.0)) - (.mov vf7 a3-8) - ) - (.lvf vf5 (&-> a1-11 quad)) - ) - (.lvf vf4 (&-> a0-20 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-14 quad) vf6) - ) - (let ((a1-12 (-> s5-3 fountain-rand-transv-hi))) - (let ((a0-21 *identity-vector*)) - (let ((a2-16 40960.0)) - (.mov vf7 a2-16) - ) - (.lvf vf5 (&-> a0-21 quad)) - ) - (.lvf vf4 (&-> v1-34 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) - ) - ) - (set! (-> s5-3 gravity) -122880.0) - (set! (-> s5-3 rot-speed) 16.0) - (process-spawn - joint-exploder - (art-group-get-by-name *level* "skel-fac-robotank-explode" (the-as (pointer level) #f)) - 9 - s5-3 - *fac-robotank-exploder-params* - :name "joint-exploder" - :to this - :unk 0 - ) + ) + (let ((s5-3 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((v1-34 (new 'stack-no-clear 'vector))) + (vector+*! (-> s5-3 fountain-rand-transv-lo) (-> this root trans) *up-vector* 2048.0) + (vector-float*! v1-34 *up-vector* 81920.0) + (vector+*! (-> s5-3 fountain-rand-transv-lo) v1-34 *identity-vector* -40960.0) + (vector+*! (-> s5-3 fountain-rand-transv-hi) v1-34 *identity-vector* 40960.0) + ) + (set! (-> s5-3 gravity) -122880.0) + (set! (-> s5-3 rot-speed) 16.0) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-fac-robotank-explode" (the-as (pointer level) #f)) + 9 + s5-3 + *fac-robotank-exploder-params* + :name "joint-exploder" + :to this + :unk 0 ) ) ) diff --git a/goal_src/jak3/levels/factory/fac-tower.gc b/goal_src/jak3/levels/factory/fac-tower.gc index 376c9917d1..e3f9607f83 100644 --- a/goal_src/jak3/levels/factory/fac-tower.gc +++ b/goal_src/jak3/levels/factory/fac-tower.gc @@ -590,59 +590,38 @@ (defmethod fire-shot ((this fac-gun-tower)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let ((s5-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s4-0 (get-trans *target* 3)) - (let ((s2-0 (-> this node-list data 10 bone transform)) - (s3-0 (new 'stack-no-clear 'quaternion)) - ) - (let ((a2-0 (-> this node-list data (-> this gunrot) bone transform))) - (set-vector! s5-0 0.0 0.0 40960.0 1.0) - (vector-matrix*! s5-0 s5-0 a2-0) - ) - (set! (-> s3-0 quad) (-> s2-0 fvec quad)) - (set! (-> s3-0 y) 0.0) - (vector-normalize! (-> s3-0 vec) 1.0) - (vector-rotate-around-axis! (-> s3-0 vec) s3-0 (-> this pitch) (-> s2-0 rvec)) - (let ((a0-11 s4-0)) - (let ((v1-11 s5-0)) - (let ((a1-5 409600.0)) - (.mov vf7 a1-5) - ) - (.lvf vf5 (&-> s3-0 quad)) - (.lvf vf4 (&-> v1-11 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-11 quad) vf6) - ) + (when *target* + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) ) - (let ((s3-1 (new 'stack-no-clear 'vector)) - (a1-6 (new 'stack-no-clear 'event-message-block)) - ) - (set! (-> a1-6 from) (process->ppointer pp)) - (set! (-> a1-6 num-params) 0) - (set! (-> a1-6 message) 'get-vehicle) - (let ((a0-14 (the-as vehicle (send-event-function *target* a1-6)))) - (when a0-14 - (vector-float*! s3-1 (-> a0-14 rbody lin-velocity) 0.0) - (vector+! s4-0 s4-0 s3-1) - ) + (vector-copy! s4-0 (get-trans *target* 3)) + (let ((s2-0 (-> this node-list data 10 bone transform)) + (s3-0 (new 'stack-no-clear 'vector)) ) + (let ((a2-0 (-> this node-list data (-> this gunrot) bone transform))) + (set-vector! s5-0 0.0 0.0 40960.0 1.0) + (vector-matrix*! s5-0 s5-0 a2-0) ) - (spawn-fac-gun-tower-projectile this s5-0 s4-0 1638400.0) + (vector-copy! s3-0 (-> s2-0 fvec)) + (set! (-> s3-0 y) 0.0) + (vector-normalize! s3-0 1.0) + (vector-rotate-around-axis! s3-0 s3-0 (-> this pitch) (-> s2-0 rvec)) + (vector+*! s4-0 s5-0 s3-0 409600.0) ) + (let ((s3-1 (new 'stack-no-clear 'vector)) + (a1-5 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-5 from) (process->ppointer pp)) + (set! (-> a1-5 num-params) 0) + (set! (-> a1-5 message) 'get-vehicle) + (let ((a0-15 (the-as vehicle (send-event-function *target* a1-5)))) + (when a0-15 + (vector-float*! s3-1 (-> a0-15 rbody lin-velocity) 0.0) + (vector+! s4-0 s4-0 s3-1) + ) + ) + ) + (spawn-fac-gun-tower-projectile this s5-0 s4-0 1638400.0) ) ) ) diff --git a/goal_src/jak3/levels/factory/factory-manager.gc b/goal_src/jak3/levels/factory/factory-manager.gc index b20d9332dc..1de4e22547 100644 --- a/goal_src/jak3/levels/factory/factory-manager.gc +++ b/goal_src/jak3/levels/factory/factory-manager.gc @@ -574,69 +574,32 @@ (defmethod fire-shot ((this factory-fighter)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let ((s5-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s4-0 (get-trans *target* 3)) - (let ((v1-4 s5-0)) - (let ((a0-3 (-> this root trans))) - (let ((a1-1 (-> this forw))) - (let ((a2-1 17203.2)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-1 quad)) - ) - (.lvf vf4 (&-> a0-3 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-4 quad) vf6) + (when *target* + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) ) - (let ((a1-2 s5-0)) - (let ((v1-5 s5-0)) - (let ((a0-4 (-> this upvc))) - (let ((a2-3 2252.8)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-4 quad)) - ) - (.lvf vf4 (&-> v1-5 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-2 quad) vf6) - ) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (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) 'get-vehicle) - (let ((a0-7 (the-as vehicle (send-event-function *target* a1-3)))) - (when a0-7 - (vector-float*! s3-0 (-> a0-7 rbody lin-velocity) 0.4) - (vector+! s4-0 s4-0 s3-0) - (sound-play "fighter-fire") - ) + (vector-copy! s4-0 (get-trans *target* 3)) + (vector+*! s5-0 (-> this root trans) (-> this forw) 17203.2) + (vector+*! s5-0 s5-0 (-> this upvc) 2252.8) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (let ((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 ((a0-7 (the-as vehicle (send-event-function *target* a1-4)))) + (when a0-7 + (vector-float*! s3-0 (-> a0-7 rbody lin-velocity) 0.4) + (vector+! s4-0 s4-0 s3-0) + (sound-play "fighter-fire") ) ) - (when #t - (rand-vu-sphere-point-uniform! s3-0 (* 61440.0 (rand-vu))) - (vector+! s4-0 s4-0 s3-0) - ) ) - (spawn-ffight-projectile this s5-0 s4-0 819200.0 #f) + (when #t + (rand-vu-sphere-point-uniform! s3-0 (* 61440.0 (rand-vu))) + (vector+! s4-0 s4-0 s3-0) + ) ) + (spawn-ffight-projectile this s5-0 s4-0 819200.0 #f) ) ) ) @@ -660,104 +623,87 @@ ) (defmethod factory-fighter-method-61 ((this factory-fighter)) - (local-vars (v1-64 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((f30-0 (seconds-per-frame))) - 1.0 - (-> this path-pos) - (let* ((s5-0 (ppointer->process (-> this parent))) - (f0-2 f30-0) - (f28-0 (/ 1.0 f0-2)) - ) - (set! (-> this path-pos) - (path-control-method-26 (-> s5-0 fpath path (-> this path-idx)) (-> this path-pos) (* 143360.0 f30-0)) - ) - (when (>= (-> this path-pos) 1.0) - (set! (-> this newpath) 2) - (cond - ((logtest? (-> s5-0 fpath inout (-> this path-idx) flags) (factory-inout-flag fi0)) - (set! (-> this path-pos) 0.0) - (vector-reset! (-> this forw)) - (vector-reset! (-> this upvc)) - ) - ((>= (-> s5-0 fpath inout (-> this path-idx) lpath) 0) - (set! (-> this path-pos) (-> s5-0 fpath inout (-> this path-idx) lpos)) - (set! (-> this path-idx) (-> s5-0 fpath inout (-> this path-idx) lpath)) - (vector-reset! (-> this forw)) - (vector-reset! (-> this upvc)) - ) - (else - (set! (-> this disappear) #t) - ) + (let ((f30-0 (seconds-per-frame))) + 1.0 + (-> this path-pos) + (let* ((s5-0 (ppointer->process (-> this parent))) + (f0-2 f30-0) + (f28-0 (/ 1.0 f0-2)) + ) + (set! (-> this path-pos) + (path-control-method-26 (-> s5-0 fpath path (-> this path-idx)) (-> this path-pos) (* 143360.0 f30-0)) ) - ) - (vector-copy! (-> this ppos) (-> this root trans)) - (get-point-at-percent-along-path! - (-> s5-0 fpath path (-> this path-idx)) - (-> this root trans) - (-> this path-pos) - 'interp - ) - (let ((s4-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'vector)) - (s5-1 (new 'stack-no-clear 'vector)) - ) - (vector-! s2-0 (-> this root trans) (-> this ppos)) - (vector-float*! s2-0 s2-0 f28-0) - (vector-copy! s4-0 s2-0) - (vector-normalize! s4-0 1.0) - (vector-! s3-0 s2-0 (-> this pvel)) - (vector-copy! (-> this pvel) s2-0) - (vector-float*! s3-0 s3-0 (/ f28-0 (meters 15))) - (cond - ((< 0.0 (-> this blendpath)) - (let ((v1-52 (new 'stack-no-clear 'vector))) - (vector-float*! s3-0 s3-0 (- 1.0 (-> this blendpath))) - (vector-float*! v1-52 (-> this pacc) (-> this blendpath)) - (vector+! s3-0 s3-0 v1-52) - ) - (set! (-> this blendpath) (fmax 0.0 (- (-> this blendpath) (* 4.0 f30-0)))) - ) - ((zero? (-> this newpath)) - (vector-copy! (-> this pacc) s3-0) - ) - (else - (vector-copy! s3-0 (-> this pacc)) - (+! (-> this newpath) -1) - (if (zero? (-> this newpath)) - (set! (-> this blendpath) 1.0) - ) - ) + (when (>= (-> this path-pos) 1.0) + (set! (-> this newpath) 2) + (cond + ((logtest? (-> s5-0 fpath inout (-> this path-idx) flags) (factory-inout-flag fi0)) + (set! (-> this path-pos) 0.0) + (vector-reset! (-> this forw)) + (vector-reset! (-> this upvc)) + ) + ((>= (-> s5-0 fpath inout (-> this path-idx) lpath) 0) + (set! (-> this path-pos) (-> s5-0 fpath inout (-> this path-idx) lpos)) + (set! (-> this path-idx) (-> s5-0 fpath inout (-> this path-idx) lpath)) + (vector-reset! (-> this forw)) + (vector-reset! (-> this upvc)) + ) + (else + (set! (-> this disappear) #t) ) - (let ((f0-22 0.0)) - (.lvf vf1 (&-> s2-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-64 vf1) - (if (>= f0-22 v1-64) - (vector-reset! s3-0) - ) - ) - (vector+! s5-1 *up-vector* s3-0) - (vector-normalize! s5-1 1.0) - (forward-up->quaternion (-> this root quat) s4-0 s5-1) - (vector-copy! (-> this forw) s4-0) - (vector-copy! (-> this upvc) s5-1) ) ) + (vector-copy! (-> this ppos) (-> this root trans)) + (get-point-at-percent-along-path! + (-> s5-0 fpath path (-> this path-idx)) + (-> this root trans) + (-> this path-pos) + 'interp + ) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (vector-! s2-0 (-> this root trans) (-> this ppos)) + (vector-float*! s2-0 s2-0 f28-0) + (vector-copy! s4-0 s2-0) + (vector-normalize! s4-0 1.0) + (vector-! s3-0 s2-0 (-> this pvel)) + (vector-copy! (-> this pvel) s2-0) + (vector-float*! s3-0 s3-0 (/ f28-0 (meters 15))) + (cond + ((< 0.0 (-> this blendpath)) + (let ((v1-52 (new 'stack-no-clear 'vector))) + (vector-float*! s3-0 s3-0 (- 1.0 (-> this blendpath))) + (vector-float*! v1-52 (-> this pacc) (-> this blendpath)) + (vector+! s3-0 s3-0 v1-52) + ) + (set! (-> this blendpath) (fmax 0.0 (- (-> this blendpath) (* 4.0 f30-0)))) + ) + ((zero? (-> this newpath)) + (vector-copy! (-> this pacc) s3-0) + ) + (else + (vector-copy! s3-0 (-> this pacc)) + (+! (-> this newpath) -1) + (if (zero? (-> this newpath)) + (set! (-> this blendpath) 1.0) + ) + ) + ) + (if (>= 0.0 (vector-length-squared s2-0)) + (vector-reset! s3-0) + ) + (vector+! s5-1 *up-vector* s3-0) + (vector-normalize! s5-1 1.0) + (forward-up->quaternion (-> this root quat) s4-0 s5-1) + (vector-copy! (-> this forw) s4-0) + (vector-copy! (-> this upvc) s5-1) + ) ) - (transform-post) - (none) ) + (transform-post) + (none) ) (defstate flying (factory-fighter) @@ -800,79 +746,32 @@ ) ) :code (behavior () - (local-vars (v1-12 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (until #f - (when (and *target* (time-elapsed? (-> self last-fire) (seconds 2)) (time-elapsed? *fac-fighter-fired* (seconds 1))) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (let ((s5-0 (new 'stack-no-clear 'vector))) - 0.0 - (let ((v1-9 s5-0)) - (let ((a0-4 (-> self root trans))) - (let ((a1-0 (-> self forw))) - (let ((a2-1 17203.2)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-0 quad)) - ) - (.lvf vf4 (&-> a0-4 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-9 quad) vf6) - ) - (let ((a1-1 s5-0)) - (let ((v1-10 s5-0)) - (let ((a0-5 (-> self upvc))) - (let ((a2-3 2252.8)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-5 quad)) - ) - (.lvf vf4 (&-> v1-10 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-1 quad) vf6) - ) - (.lvf vf1 (&-> gp-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-12 vf1) - v1-12 - (vector-! gp-0 (get-trans *target* 3) s5-0) - ) - (vector-normalize! gp-0 1.0) - (when (and (logtest? (-> self draw status) (draw-control-status on-screen)) - (< 0.8 (vector-dot (-> self forw) gp-0)) - (< (vector-vector-distance (-> *target* control trans) (-> self root trans)) 491520.0) - (< 163840.0 (vector-vector-distance (-> *target* control trans) (-> self root trans))) - ) - (fire-shot self) - (set-time! (-> self last-fire)) - (set! *fac-fighter-fired* (current-time)) - ) + (until #f + (when (and *target* (time-elapsed? (-> self last-fire) (seconds 2)) (time-elapsed? *fac-fighter-fired* (seconds 1))) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + 0.0 + (vector+*! s5-0 (-> self root trans) (-> self forw) 17203.2) + (vector+*! s5-0 s5-0 (-> self upvc) 2252.8) + (vector-length-squared gp-0) + (vector-! gp-0 (get-trans *target* 3) s5-0) + ) + (vector-normalize! gp-0 1.0) + (when (and (logtest? (-> self draw status) (draw-control-status on-screen)) + (< 0.8 (vector-dot (-> self forw) gp-0)) + (< (vector-vector-distance (-> *target* control trans) (-> self root trans)) 491520.0) + (< 163840.0 (vector-vector-distance (-> *target* control trans) (-> self root trans))) + ) + (fire-shot self) + (set-time! (-> self last-fire)) + (set! *fac-fighter-fired* (current-time)) ) ) - (-> self skel root-channel 0) - (suspend) ) - #f + (-> self skel root-channel 0) + (suspend) ) + #f ) :post (behavior () (factory-fighter-method-61 self) @@ -966,96 +865,33 @@ '() ) :code (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((v1-1 (new 'stack-no-clear 'vector))) - (let ((a0-1 (-> gp-0 fountain-rand-transv-lo))) - (let ((a1-2 (-> self root trans))) - (let ((a2-1 *up-vector*)) - (let ((a3-1 2048.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-1 quad)) - ) - (.lvf vf4 (&-> a1-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 (&-> a0-1 quad) vf6) - ) - (let ((a2-2 v1-1)) - (let ((a0-2 (-> self pvel))) - (let ((a1-3 *up-vector*)) - (let ((a3-3 40960.0)) - (.mov vf7 a3-3) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> a0-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 (&-> a2-2 quad) vf6) - ) - (let ((a2-3 (-> gp-0 fountain-rand-transv-lo))) - (let ((a0-3 v1-1)) - (let ((a1-4 *identity-vector*)) - (let ((a3-5 -204800.0)) - (.mov vf7 a3-5) - ) - (.lvf vf5 (&-> a1-4 quad)) - ) - (.lvf vf4 (&-> a0-3 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-3 quad) vf6) - ) - (let ((a1-5 (-> gp-0 fountain-rand-transv-hi))) - (let ((a0-4 *identity-vector*)) - (let ((a2-5 204800.0)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-4 quad)) - ) - (.lvf vf4 (&-> v1-1 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-5 quad) vf6) - ) - ) - (set! (-> gp-0 gravity) -122880.0) - (set! (-> gp-0 rot-speed) 16.0) - (set! (-> gp-0 friction) 1.0) - (process-spawn - joint-exploder - (art-group-get-by-name *level* "skel-fac-fighter-explode" (the-as (pointer level) #f)) - 7 - gp-0 - *fac-fighter-exploder-params* - :name "joint-exploder" - :to self - :unk 0 - ) + (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((v1-1 (new 'stack-no-clear 'vector))) + (vector+*! (-> gp-0 fountain-rand-transv-lo) (-> self root trans) *up-vector* 2048.0) + (vector+*! v1-1 (-> self pvel) *up-vector* 40960.0) + (vector+*! (-> gp-0 fountain-rand-transv-lo) v1-1 *identity-vector* -204800.0) + (vector+*! (-> gp-0 fountain-rand-transv-hi) v1-1 *identity-vector* 204800.0) ) - (let ((v1-10 (ppointer->process (-> self parent)))) - (+! (-> v1-10 nfighters-spawned) -1) - ) - (while (-> self child) - (suspend) + (set! (-> gp-0 gravity) -122880.0) + (set! (-> gp-0 rot-speed) 16.0) + (set! (-> gp-0 friction) 1.0) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-fac-fighter-explode" (the-as (pointer level) #f)) + 7 + gp-0 + *fac-fighter-exploder-params* + :name "joint-exploder" + :to self + :unk 0 ) ) + (let ((v1-10 (ppointer->process (-> self parent)))) + (+! (-> v1-10 nfighters-spawned) -1) + ) + (while (-> self child) + (suspend) + ) ) :post (behavior () (let ((v1-0 (new 'stack-no-clear 'vector))) @@ -1391,98 +1227,49 @@ (defstate retract (fac-target) :virtual #t :enter (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (process-entity-status! self (entity-perm-status subtask-complete) #t) - (let ((v1-1 (-> self root root-prim))) - (set! (-> v1-1 prim-core collide-as) (collide-spec)) - (set! (-> v1-1 prim-core collide-with) (collide-spec)) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (let ((v1-1 (-> self root root-prim))) + (set! (-> v1-1 prim-core collide-as) (collide-spec)) + (set! (-> v1-1 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> self draw status) (draw-control-status no-draw)) + (fac-target-method-33 self) + (set-time! (-> self state-time)) + (when (-> self minimap) + (logior! (-> self minimap flags) (minimap-flag fade-out)) + (set! (-> self minimap) #f) + ) + (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((s4-0 (-> self node-list data 3 bone transform))) + (vector-float*! s5-0 (-> s4-0 fvec) (* 4096.0 (rand-vu-float-range 20.0 30.0))) + (vector+*! (-> gp-0 fountain-rand-transv-lo) (-> self root trans) (-> s4-0 fvec) 2048.0) + ) + (vector+*! (-> gp-0 fountain-rand-transv-lo) s5-0 *identity-vector* -204800.0) + (vector+*! (-> gp-0 fountain-rand-transv-hi) s5-0 *identity-vector* 204800.0) ) - 0 - (logior! (-> self draw status) (draw-control-status no-draw)) - (fac-target-method-33 self) - (set-time! (-> self state-time)) - (when (-> self minimap) - (logior! (-> self minimap flags) (minimap-flag fade-out)) - (set! (-> self minimap) #f) + (set! (-> gp-0 gravity) -122880.0) + (set! (-> gp-0 rot-speed) 16.0) + (cond + ((logtest? (-> *part-group-id-table* 733 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) (-> self root trans)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 733)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) (-> self root trans)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 733)) + ) ) - (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (let ((s4-0 (-> self node-list data 3 bone transform))) - (vector-float*! s5-0 (-> s4-0 fvec) (* 4096.0 (rand-vu-float-range 20.0 30.0))) - (let ((v1-20 (-> gp-0 fountain-rand-transv-lo))) - (let ((a0-7 (-> self root trans))) - (let ((a1-3 (-> s4-0 fvec))) - (let ((a2-3 2048.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> a0-7 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-20 quad) vf6) - ) - ) - (let ((a1-4 (-> gp-0 fountain-rand-transv-lo))) - (let ((v1-21 s5-0)) - (let ((a0-8 *identity-vector*)) - (let ((a2-5 -204800.0)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-8 quad)) - ) - (.lvf vf4 (&-> v1-21 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-4 quad) vf6) - ) - (let ((a0-9 (-> gp-0 fountain-rand-transv-hi))) - (let ((v1-22 *identity-vector*)) - (let ((a1-6 204800.0)) - (.mov vf7 a1-6) - ) - (.lvf vf5 (&-> v1-22 quad)) - ) - (.lvf vf4 (&-> s5-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-9 quad) vf6) - ) - ) - (set! (-> gp-0 gravity) -122880.0) - (set! (-> gp-0 rot-speed) 16.0) - (cond - ((logtest? (-> *part-group-id-table* 733 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) (-> self root trans)) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 733)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) (-> self root trans)) - (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 733)) - ) - ) - (process-spawn - joint-exploder - (art-group-get-by-name *level* "skel-fac-target-explode" (the-as (pointer level) #f)) - 9 - gp-0 - *fac-target-exploder-params* - :name "joint-exploder" - :to self - :unk 0 - ) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-fac-target-explode" (the-as (pointer level) #f)) + 9 + gp-0 + *fac-target-exploder-params* + :name "joint-exploder" + :to self + :unk 0 ) ) ) diff --git a/goal_src/jak3/levels/factory/ffight-projectile.gc b/goal_src/jak3/levels/factory/ffight-projectile.gc index 1c5262c264..b8031ec88d 100644 --- a/goal_src/jak3/levels/factory/ffight-projectile.gc +++ b/goal_src/jak3/levels/factory/ffight-projectile.gc @@ -324,57 +324,35 @@ ) (defmethod projectile-method-25 ((this ffight-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 2851 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 2851 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 2851) a1-0 s5-1 #f) - (set! (-> *part-id-table* 2851 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 2852) s4-0) - (launch-particles (-> *part-id-table* 2853) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f28-1 (/ f30-0 (meters 16))) - (f30-1 (-> *part-id-table* 2854 init-specs 3 initial-valuef)) - ) - (-> *part-id-table* 2854 init-specs 4 initial-valuef) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 2854 init-specs 3 initial-valuef) (* f28-1 f30-1)) - (launch-particles (-> *part-id-table* 2854) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 2854 init-specs 3 initial-valuef) f30-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 2851 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 2851 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 2851) a1-0 s5-1 #f) + (set! (-> *part-id-table* 2851 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 2852) s4-1) + (launch-particles (-> *part-id-table* 2853) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f28-1 (/ f30-0 (meters 16))) + (f30-1 (-> *part-id-table* 2854 init-specs 3 initial-valuef)) + ) + (-> *part-id-table* 2854 init-specs 4 initial-valuef) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 2854 init-specs 3 initial-valuef) (* f28-1 f30-1)) + (launch-particles (-> *part-id-table* 2854) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 2854 init-specs 3 initial-valuef) f30-1) ) - 0 - (none) ) + 0 + (none) ) (defmethod projectile-method-26 ((this ffight-shot)) diff --git a/goal_src/jak3/levels/factory/ftank-projectile.gc b/goal_src/jak3/levels/factory/ftank-projectile.gc index 36517ee6b1..3e6141ae80 100644 --- a/goal_src/jak3/levels/factory/ftank-projectile.gc +++ b/goal_src/jak3/levels/factory/ftank-projectile.gc @@ -254,57 +254,35 @@ ) (defmethod projectile-method-25 ((this ftank-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 2866 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 2866 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 2866) a1-0 s5-1 #f) - (set! (-> *part-id-table* 2866 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 2867) s4-0) - (launch-particles (-> *part-id-table* 2868) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f28-1 (/ f30-0 (meters 16))) - (f30-1 (-> *part-id-table* 2869 init-specs 3 initial-valuef)) - ) - (-> *part-id-table* 2869 init-specs 4 initial-valuef) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 2869 init-specs 3 initial-valuef) (* f28-1 f30-1)) - (launch-particles (-> *part-id-table* 2869) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 2869 init-specs 3 initial-valuef) f30-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 2866 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 2866 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 2866) a1-0 s5-1 #f) + (set! (-> *part-id-table* 2866 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 2867) s4-1) + (launch-particles (-> *part-id-table* 2868) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f28-1 (/ f30-0 (meters 16))) + (f30-1 (-> *part-id-table* 2869 init-specs 3 initial-valuef)) + ) + (-> *part-id-table* 2869 init-specs 4 initial-valuef) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 2869 init-specs 3 initial-valuef) (* f28-1 f30-1)) + (launch-particles (-> *part-id-table* 2869) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 2869 init-specs 3 initial-valuef) f30-1) ) - 0 - (none) ) + 0 + (none) ) (defmethod projectile-method-26 ((this ftank-shot)) diff --git a/goal_src/jak3/levels/factory/fturret-projectile.gc b/goal_src/jak3/levels/factory/fturret-projectile.gc index 1f68245cf4..53ae02e060 100644 --- a/goal_src/jak3/levels/factory/fturret-projectile.gc +++ b/goal_src/jak3/levels/factory/fturret-projectile.gc @@ -360,59 +360,37 @@ ) (defmethod projectile-method-25 ((this fturret-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 2878 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 2878 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 2878) a1-0 s5-1 #f) - (set! (-> *part-id-table* 2878 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 2879) s4-0) - (launch-particles (-> *part-id-table* 2880) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f26-0 (/ f30-0 (meters 9))) - (f30-1 (-> *part-id-table* 2881 init-specs 3 initial-valuef)) - (f28-1 (-> *part-id-table* 2881 init-specs 4 initial-valuef)) - ) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 2881 init-specs 3 initial-valuef) (* f26-0 f30-1)) - (set! (-> *part-id-table* 2881 init-specs 4 initial-valuef) (* f26-0 f28-1)) - (launch-particles (-> *part-id-table* 2881) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 2881 init-specs 3 initial-valuef) f30-1) - (set! (-> *part-id-table* 2881 init-specs 4 initial-valuef) f28-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 2878 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 2878 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 2878) a1-0 s5-1 #f) + (set! (-> *part-id-table* 2878 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 2879) s4-1) + (launch-particles (-> *part-id-table* 2880) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f26-0 (/ f30-0 (meters 9))) + (f30-1 (-> *part-id-table* 2881 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 2881 init-specs 4 initial-valuef)) + ) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 2881 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 2881 init-specs 4 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 2881) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 2881 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 2881 init-specs 4 initial-valuef) f28-1) ) - 0 - (none) ) + 0 + (none) ) (defmethod projectile-method-26 ((this fturret-shot)) diff --git a/goal_src/jak3/levels/factory/h-warf.gc b/goal_src/jak3/levels/factory/h-warf.gc index 3c3c3baf2f..f77f983904 100644 --- a/goal_src/jak3/levels/factory/h-warf.gc +++ b/goal_src/jak3/levels/factory/h-warf.gc @@ -927,250 +927,221 @@ ) (defmethod vehicle-method-97 ((this h-warf) (arg0 float) (arg1 vehicle-physics-work)) - (local-vars (v1-107 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s3-0 (-> this rbody))) - (mem-copy! (the-as pointer (-> arg1 mat)) (the-as pointer (-> s3-0 matrix)) 64) - (let* ((f28-0 (* -1.0 (-> this controls steering) (-> this info handling tire-steering-angle))) - (f30-0 (cos f28-0)) - (f0-2 (sin f28-0)) - ) - (set! (-> arg1 steering-axis x) f30-0) - (set! (-> arg1 steering-axis y) 0.0) - (set! (-> arg1 steering-axis z) f0-2) - ) - (vector-rotate*! (-> arg1 steering-axis) (-> arg1 steering-axis) (-> arg1 mat)) - (logior! (-> this v-flags) (vehicle-flag in-air)) - (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) - (vector-reset! (-> arg1 ground-normal)) - (set! (-> arg1 ground-normal y) 1.0) - (let ((f30-1 (-> this info handling ground-probe-distance))) - (let ((s2-0 (new 'stack-no-clear 'collide-query))) - (vector-reset! (-> arg1 lift-dir)) - (set! (-> arg1 lift-dir y) -1.0) - (set! (-> arg1 speed-factor) - (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) - ) - (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)) + (let ((s3-0 (-> this rbody))) + (mem-copy! (the-as pointer (-> arg1 mat)) (the-as pointer (-> s3-0 matrix)) 64) + (let* ((f28-0 (* -1.0 (-> this controls steering) (-> this info handling tire-steering-angle))) + (f30-0 (cos f28-0)) + (f0-2 (sin f28-0)) + ) + (set! (-> arg1 steering-axis x) f30-0) + (set! (-> arg1 steering-axis y) 0.0) + (set! (-> arg1 steering-axis z) f0-2) + ) + (vector-rotate*! (-> arg1 steering-axis) (-> arg1 steering-axis) (-> arg1 mat)) + (logior! (-> this v-flags) (vehicle-flag in-air)) + (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) + (vector-reset! (-> arg1 ground-normal)) + (set! (-> arg1 ground-normal y) 1.0) + (let ((f30-1 (-> this info handling ground-probe-distance))) + (let ((s2-0 (new 'stack-no-clear 'collide-query))) + (vector-reset! (-> arg1 lift-dir)) + (set! (-> arg1 lift-dir y) -1.0) + (set! (-> arg1 speed-factor) + (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) ) - (vector-normalize! (-> arg1 lift-dir) 1.0) - ) - (vector-float*! (-> s2-0 move-dist) (-> arg1 lift-dir) (the-as float f30-1)) - (let ((v1-26 s2-0)) - (set! (-> v1-26 radius) 409.6) - (set! (-> v1-26 collide-with) (collide-spec - backgnd - bot - obstacle - hit-by-player-list - hit-by-others-list - player-list - water - collectable - blocking-plane - pusher - vehicle-mesh-probeable - shield - vehicle-sphere-no-probe - ) - ) - (set! (-> v1-26 ignore-process0) #f) - (set! (-> v1-26 ignore-process1) #f) - (set! (-> v1-26 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) - (set! (-> v1-26 action-mask) (collide-action solid)) - ) - (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) - (let ((v1-29 (-> this info physics-model lift-thruster-array s1-0)) - (s0-0 (-> arg1 probe-work-array s1-0)) - ) - (vector-reset! (-> s0-0 tire-force)) - (vector-copy! (-> s0-0 local-pos) (-> v1-29 local-pos)) - (vector-copy! (-> s0-0 local-normal) (-> v1-29 rot)) - (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> arg1 mat)) - (let ((a1-9 (-> s0-0 probe-pos))) - (let ((v1-32 (-> s0-0 world-pos))) - (let ((a0-22 (-> arg1 mat uvec))) - (let ((a2-6 (-> this info handling ground-probe-offset))) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-22 quad)) - ) - (.lvf vf4 (&-> v1-32 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-9 quad) vf6) + (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)) ) - (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) - (vector-copy! (-> s0-0 wheel-axis) (the-as vector (if (< 0.0 (-> s0-0 local-pos z)) - (-> arg1 steering-axis) - (the-as vector (-> arg1 mat)) - ) - ) - ) - (vector-copy! (-> s0-0 ground-pos) (-> s0-0 probe-pos)) - (set! (-> s0-0 ground-pos y) 0.0) - (vector-reset! (-> s0-0 ground-normal)) - (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) - (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) - (let ((f0-15 (probe-using-line-sphere *collide-cache* s2-0))) - (cond - ((and (>= f0-15 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) - (logclear! (-> this v-flags) (vehicle-flag in-air)) - (logior! (-> this v-flags) (vehicle-flag on-ground)) - (set! (-> s0-0 ground-pos y) (- (-> s0-0 probe-pos y) (* f0-15 f30-1))) - (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) - (vector-copy! (-> arg1 ground-normal) (-> s0-0 ground-normal)) - ) - (else - (set! (-> s0-0 ground-pos y) (+ -81920.0 (-> s3-0 position y))) - ) + (t9-4 a0-7 a1-4 a2-3 (* f0-8 f0-8)) + ) + (vector-normalize! (-> arg1 lift-dir) 1.0) + ) + (vector-float*! (-> s2-0 move-dist) (-> arg1 lift-dir) (the-as float f30-1)) + (let ((v1-26 s2-0)) + (set! (-> v1-26 radius) 409.6) + (set! (-> v1-26 collide-with) (collide-spec + backgnd + bot + obstacle + hit-by-player-list + hit-by-others-list + player-list + water + collectable + blocking-plane + pusher + vehicle-mesh-probeable + shield + vehicle-sphere-no-probe + ) + ) + (set! (-> v1-26 ignore-process0) #f) + (set! (-> v1-26 ignore-process1) #f) + (set! (-> v1-26 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) + (set! (-> v1-26 action-mask) (collide-action solid)) + ) + (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) + (let ((v1-29 (-> this info physics-model lift-thruster-array s1-0)) + (s0-0 (-> arg1 probe-work-array s1-0)) + ) + (vector-reset! (-> s0-0 tire-force)) + (vector-copy! (-> s0-0 local-pos) (-> v1-29 local-pos)) + (vector-copy! (-> s0-0 local-normal) (-> v1-29 rot)) + (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> arg1 mat)) + (vector+*! + (-> s0-0 probe-pos) + (-> s0-0 world-pos) + (-> arg1 mat uvec) + (the-as float (-> this info handling ground-probe-offset)) + ) + (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) + (vector-copy! (-> s0-0 wheel-axis) (the-as vector (if (< 0.0 (-> s0-0 local-pos z)) + (-> arg1 steering-axis) + (the-as vector (-> arg1 mat)) + ) + ) + ) + (vector-copy! (-> s0-0 ground-pos) (-> s0-0 probe-pos)) + (set! (-> s0-0 ground-pos y) 0.0) + (vector-reset! (-> s0-0 ground-normal)) + (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) + (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) + (let ((f0-15 (probe-using-line-sphere *collide-cache* s2-0))) + (cond + ((and (>= f0-15 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) + (logclear! (-> this v-flags) (vehicle-flag in-air)) + (logior! (-> this v-flags) (vehicle-flag on-ground)) + (set! (-> s0-0 ground-pos y) (- (-> s0-0 probe-pos y) (* f0-15 f30-1))) + (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) + (vector-copy! (-> arg1 ground-normal) (-> s0-0 ground-normal)) + ) + (else + (set! (-> s0-0 ground-pos y) (+ -81920.0 (-> s3-0 position y))) ) ) - 0 ) + 0 ) ) ) - (set! (-> this lift-thrust 0) 0.0) - (set! (-> this lift-thrust 1) 0.0) - (set! (-> this lift-thrust 2) 0.0) - (set! (-> this lift-thrust 3) 0.0) - (set! (-> this roll-thrust 0) 0.0) - (set! (-> this roll-thrust 1) 0.0) - (when (>= 1 (-> this force-level)) - (dotimes (s2-1 (-> this info physics-model lift-thruster-count)) - (let ((s1-1 (-> arg1 probe-work-array s2-1))) - (vector-copy! (-> arg1 world-pos) (-> s1-1 world-pos)) - (vector-copy! (-> arg1 velocity) (-> s1-1 velocity)) - (let* ((f1-12 (fmax 4096.0 (fmin (- (-> s1-1 probe-pos y) (-> s1-1 ground-pos y)) f30-1))) - (f28-1 (- 1.0 (/ (+ -4096.0 f1-12) (+ -4096.0 f30-1)))) - ) - (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s1-1 ground-normal) (-> arg1 mat uvec))) - (set! f28-1 0.0) + ) + (set! (-> this lift-thrust 0) 0.0) + (set! (-> this lift-thrust 1) 0.0) + (set! (-> this lift-thrust 2) 0.0) + (set! (-> this lift-thrust 3) 0.0) + (set! (-> this roll-thrust 0) 0.0) + (set! (-> this roll-thrust 1) 0.0) + (when (>= 1 (-> this force-level)) + (dotimes (s2-1 (-> this info physics-model lift-thruster-count)) + (let ((s1-1 (-> arg1 probe-work-array s2-1))) + (vector-copy! (-> arg1 world-pos) (-> s1-1 world-pos)) + (vector-copy! (-> arg1 velocity) (-> s1-1 velocity)) + (let* ((f1-12 (fmax 4096.0 (fmin (- (-> s1-1 probe-pos y) (-> s1-1 ground-pos y)) f30-1))) + (f28-1 (- 1.0 (/ (+ -4096.0 f1-12) (+ -4096.0 f30-1)))) + ) + (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s1-1 ground-normal) (-> arg1 mat uvec))) + (set! f28-1 0.0) + ) + (set! (-> arg1 tmp y) 0.0) + (set! (-> arg1 tmp x) (-> arg1 velocity z)) + (set! (-> arg1 tmp z) (- (-> arg1 velocity x))) + (vector-normalize! (-> arg1 tmp) 1.0) + (vector+float*! + (-> arg1 normal) + (-> s1-1 ground-normal) + (-> arg1 tmp) + (- (vector-dot (-> s1-1 ground-normal) (-> arg1 tmp))) + ) + (let ((v1-80 (-> arg1 force)) + (a0-45 (-> arg1 normal)) + (f0-37 (* 2.0 f28-1)) + (f1-17 arg0) ) - (set! (-> arg1 tmp y) 0.0) - (set! (-> arg1 tmp x) (-> arg1 velocity z)) - (set! (-> arg1 tmp z) (- (-> arg1 velocity x))) - (vector-normalize! (-> arg1 tmp) 1.0) - (vector+float*! - (-> arg1 normal) - (-> s1-1 ground-normal) - (-> arg1 tmp) - (- (vector-dot (-> s1-1 ground-normal) (-> arg1 tmp))) - ) - (let ((v1-80 (-> arg1 force)) - (a0-45 (-> arg1 normal)) - (f0-37 (* 2.0 f28-1)) - (f1-17 arg0) - ) - (vector-float*! v1-80 a0-45 (* f0-37 - (/ 1.0 f1-17) - (-> this info physics-model inv-lift-thruster-count) - (-> this info info mass) - (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> arg1 normal)))) - ) - ) - ) - (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) - (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) - (let ((f0-51 (* 8.0 - (-> this info info mass) - (-> this info extra gravity) - (-> this info physics-model inv-lift-thruster-count) - (+ (* (-> this info handling spring-lift-factor) f28-1) - (* 0.75 (-> this jump-thrust) (-> this info handling jump-thrust-factor)) - ) - (- (+ 1.0 (* 2.0 (rand-vu) (-> this power-fluctuation-factor))) (-> this power-fluctuation-factor)) + (vector-float*! v1-80 a0-45 (* f0-37 + (/ 1.0 f1-17) + (-> this info physics-model inv-lift-thruster-count) + (-> this info info mass) + (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> arg1 normal)))) + ) ) - ) - ) - (+! (-> this lift-thrust s2-1) f0-51) - (vector-float*! (-> arg1 force) (-> arg1 lift-dir) (* -1.0 f0-51)) - ) ) (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) - (when (and (< 0.0 (-> this info handling tire-friction-factor)) (let ((f0-54 0.0)) - (.lvf vf1 (&-> (-> s1-1 ground-normal) 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-107 vf1) - (< f0-54 v1-107) - ) - ) - (vector+float*! - (-> arg1 normal) - (-> s1-1 wheel-axis) - (-> s1-1 ground-normal) - (- (vector-dot (-> s1-1 wheel-axis) (-> s1-1 ground-normal))) - ) - (vector-normalize! (-> arg1 normal) 1.0) - (vector-copy! (-> arg1 world-pos) (-> s3-0 position)) - (vector-copy! (-> arg1 velocity) (-> s3-0 lin-velocity)) - (vector-! (-> arg1 p-body) (-> arg1 world-pos) (-> s3-0 position)) - (vector-cross! (-> arg1 tmp) (-> arg1 p-body) (-> arg1 normal)) - (vector-rotate*! (-> arg1 tmp) (-> arg1 tmp) (-> s3-0 inv-i-world)) - (vector-cross! (-> arg1 tmp) (-> arg1 tmp) (-> arg1 p-body)) - (set! (-> arg1 vel-dot-norm) (vector-dot (-> arg1 velocity) (-> arg1 normal))) - (let ((f0-61 (fabs (-> arg1 vel-dot-norm)))) - (set! (-> arg1 friction-coef) - (smooth-interp - (-> this info handling tire-static-friction) - (-> this info handling tire-dynamic-friction) - f0-61 - (-> this info handling tire-static-friction-speed) - (-> this info handling tire-dynamic-friction-speed) - ) - ) - ) - (set! (-> arg1 friction-coef) - (* (-> arg1 friction-coef) (+ 1.0 (* -0.75 (fmax 0.0 (fmin 1.0 (-> this engine-thrust)))))) - ) - (let ((f0-69 (* (-> arg1 friction-coef) - (-> this info handling tire-friction-factor) - (fmax 0.0 (vector-dot (-> s1-1 ground-normal) (-> s1-1 tire-force))) - ) - ) - ) - (set! (-> arg1 impulse) (/ (* -1.0 (-> arg1 vel-dot-norm)) - (* arg0 (+ (-> s3-0 info inv-mass) (vector-dot (-> arg1 normal) (-> arg1 tmp)))) - ) - ) - (set! (-> arg1 impulse) (fmax (fmin (-> arg1 impulse) f0-69) (- f0-69))) - ) - (vector-float*! (-> arg1 force) (-> arg1 normal) (-> arg1 impulse)) - (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + (let ((f0-51 (* 8.0 + (-> this info info mass) + (-> this info extra gravity) + (-> this info physics-model inv-lift-thruster-count) + (+ (* (-> this info handling spring-lift-factor) f28-1) + (* 0.75 (-> this jump-thrust) (-> this info handling jump-thrust-factor)) + ) + (- (+ 1.0 (* 2.0 (rand-vu) (-> this power-fluctuation-factor))) (-> this power-fluctuation-factor)) + ) + ) + ) + (+! (-> this lift-thrust s2-1) f0-51) + (vector-float*! (-> arg1 force) (-> arg1 lift-dir) (* -1.0 f0-51)) ) ) + (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) + (when (and (< 0.0 (-> this info handling tire-friction-factor)) + (< 0.0 (vector-length-squared (-> s1-1 ground-normal))) + ) + (vector+float*! + (-> arg1 normal) + (-> s1-1 wheel-axis) + (-> s1-1 ground-normal) + (- (vector-dot (-> s1-1 wheel-axis) (-> s1-1 ground-normal))) + ) + (vector-normalize! (-> arg1 normal) 1.0) + (vector-copy! (-> arg1 world-pos) (-> s3-0 position)) + (vector-copy! (-> arg1 velocity) (-> s3-0 lin-velocity)) + (vector-! (-> arg1 p-body) (-> arg1 world-pos) (-> s3-0 position)) + (vector-cross! (-> arg1 tmp) (-> arg1 p-body) (-> arg1 normal)) + (vector-rotate*! (-> arg1 tmp) (-> arg1 tmp) (-> s3-0 inv-i-world)) + (vector-cross! (-> arg1 tmp) (-> arg1 tmp) (-> arg1 p-body)) + (set! (-> arg1 vel-dot-norm) (vector-dot (-> arg1 velocity) (-> arg1 normal))) + (let ((f0-61 (fabs (-> arg1 vel-dot-norm)))) + (set! (-> arg1 friction-coef) + (smooth-interp + (-> this info handling tire-static-friction) + (-> this info handling tire-dynamic-friction) + f0-61 + (-> this info handling tire-static-friction-speed) + (-> this info handling tire-dynamic-friction-speed) + ) + ) + ) + (set! (-> arg1 friction-coef) + (* (-> arg1 friction-coef) (+ 1.0 (* -0.75 (fmax 0.0 (fmin 1.0 (-> this engine-thrust)))))) + ) + (let ((f0-69 (* (-> arg1 friction-coef) + (-> this info handling tire-friction-factor) + (fmax 0.0 (vector-dot (-> s1-1 ground-normal) (-> s1-1 tire-force))) + ) + ) + ) + (set! (-> arg1 impulse) (/ (* -1.0 (-> arg1 vel-dot-norm)) + (* arg0 (+ (-> s3-0 info inv-mass) (vector-dot (-> arg1 normal) (-> arg1 tmp)))) + ) + ) + (set! (-> arg1 impulse) (fmax (fmin (-> arg1 impulse) f0-69) (- f0-69))) + ) + (vector-float*! (-> arg1 force) (-> arg1 normal) (-> arg1 impulse)) + (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod h-warf-method-163 ((this h-warf) (arg0 vector)) @@ -1644,94 +1615,66 @@ ) (defmethod draw-thrusters ((this h-warf) (arg0 float) (arg1 vector) (arg2 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 arg2) - (let ((s4-0 (new 'stack-no-clear 'matrix))) - (quaternion->matrix s4-0 (-> this root quat)) - (let ((a2-1 (matrix-transpose! (new 'stack-no-clear 'matrix) s4-0))) - (vector-rotate*! (-> this langvel) (-> this rbody ang-velocity) a2-1) + (when (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 arg2) + (let ((s4-0 (new 'stack-no-clear 'matrix))) + (quaternion->matrix s4-0 (-> this root quat)) + (let ((a2-1 (matrix-transpose! (new 'stack-no-clear 'matrix) s4-0))) + (vector-rotate*! (-> this langvel) (-> this rbody ang-velocity) a2-1) + ) + (cond + ((not (-> this bounce-state?)) + (vector-rotate-around-axis! s5-0 arg2 (* -2184.5334 (-> this langvel x)) (-> s4-0 rvec)) + (vector-rotate-around-axis! s5-0 s5-0 (* -1820.4445 (-> this langvel y)) (-> s4-0 uvec)) + (vector-rotate-around-axis! s5-0 s5-0 (* 182.04445 (-> this langvel z) (* 5.0 arg0)) (-> s4-0 rvec)) + ) + (else + (vector-copy! s5-0 arg2) ) - (cond - ((not (-> this bounce-state?)) - (vector-rotate-around-axis! s5-0 (the-as quaternion arg2) (* -2184.5334 (-> this langvel x)) (-> s4-0 rvec)) - (vector-rotate-around-axis! s5-0 (the-as quaternion s5-0) (* -1820.4445 (-> this langvel y)) (-> s4-0 uvec)) - (vector-rotate-around-axis! - s5-0 - (the-as quaternion s5-0) - (* 182.04445 (-> this langvel z) (* 5.0 arg0)) - (-> s4-0 rvec) - ) - ) - (else - (vector-copy! s5-0 arg2) - ) - ) - (vector-copy! (-> s4-0 trans) arg1) - (dotimes (s3-1 15) - (let* ((f28-0 (* 0.06666667 (- 15.0 (the float s3-1)))) - (f26-0 (* f28-0 (rand-vu-float-range 8192.0 9011.2))) - (f30-0 (* f28-0 (rand-vu-float-range 8192.0 12288.0))) - ) - (let ((a1-9 (-> s4-0 trans))) - (let ((v1-18 (-> s4-0 trans))) - (let ((a0-12 s5-0)) - (let ((a2-7 (+ (* 819.2 f28-0) (* 1024.0 (-> this engine-thrust) f28-0)))) - (.mov vf7 a2-7) - ) - (.lvf vf5 (&-> a0-12 quad)) - ) - (.lvf vf4 (&-> v1-18 quad)) + ) + (vector-copy! (-> s4-0 trans) arg1) + (dotimes (s3-1 15) + (let* ((f28-0 (* 0.06666667 (- 15.0 (the float s3-1)))) + (f26-0 (* f28-0 (rand-vu-float-range 8192.0 9011.2))) + (f30-0 (* f28-0 (rand-vu-float-range 8192.0 12288.0))) + ) + (vector+*! (-> s4-0 trans) (-> s4-0 trans) s5-0 (+ (* 819.2 f28-0) (* 1024.0 (-> this engine-thrust) f28-0))) + (set! (-> *part-id-table* 2761 init-specs 11 initial-valuef) + (+ (rand-vu-float-range 0.0 5.0) (* 60.0 f28-0 (-> this engine-thrust)) (* 40.0 f28-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-9 quad) vf6) - ) - (set! (-> *part-id-table* 2761 init-specs 11 initial-valuef) - (+ (rand-vu-float-range 0.0 5.0) (* 60.0 f28-0 (-> this engine-thrust)) (* 40.0 f28-0)) - ) - (set! (-> *part-id-table* 2761 init-specs 8 initial-valuef) - (+ (* 215.0 (-> this engine-thrust)) (* 40.0 f28-0)) - ) - (set! (-> *part-id-table* 2761 init-specs 10 initial-valuef) - (the float (- 255 (the int (* 255.0 (-> this engine-thrust))))) - ) - (set! (-> *part-id-table* 2761 init-specs 3 initial-valuef) f26-0) - (set! (-> *part-id-table* 2761 init-specs 7 initial-valuef) f26-0) - (set! (-> *part-id-table* 2762 init-specs 4 initial-valuef) (* 255.0 f28-0 (-> this engine-thrust))) - (set! (-> *part-id-table* 2762 init-specs 5 initial-valuef) - (the float (- 28 (the int (* 28.0 f28-0 (-> this engine-thrust))))) - ) - (set! (-> *part-id-table* 2762 init-specs 6 initial-valuef) - (the float (- 255 (the int (* 255.0 f28-0 (-> this engine-thrust))))) - ) - (set! (-> *part-id-table* 2762 init-specs 7 initial-valuef) - (+ (rand-vu-float-range 0.0 (* 40.0 (-> this engine-thrust))) - (* 20.0 f28-0 (-> this engine-thrust)) - (the float (* 30 (the int f28-0))) - ) - ) - (set! (-> *part-id-table* 2762 init-specs 2 initial-valuef) f30-0) - (set! (-> *part-id-table* 2762 init-specs 3 initial-valuef) f30-0) - ) - (launch-particles (-> *part-id-table* 2761) s4-0 :origin-is-matrix #t) - (launch-particles (-> *part-id-table* 2762) s4-0 :origin-is-matrix #t) + (set! (-> *part-id-table* 2761 init-specs 8 initial-valuef) + (+ (* 215.0 (-> this engine-thrust)) (* 40.0 f28-0)) + ) + (set! (-> *part-id-table* 2761 init-specs 10 initial-valuef) + (the float (- 255 (the int (* 255.0 (-> this engine-thrust))))) + ) + (set! (-> *part-id-table* 2761 init-specs 3 initial-valuef) f26-0) + (set! (-> *part-id-table* 2761 init-specs 7 initial-valuef) f26-0) + (set! (-> *part-id-table* 2762 init-specs 4 initial-valuef) (* 255.0 f28-0 (-> this engine-thrust))) + (set! (-> *part-id-table* 2762 init-specs 5 initial-valuef) + (the float (- 28 (the int (* 28.0 f28-0 (-> this engine-thrust))))) + ) + (set! (-> *part-id-table* 2762 init-specs 6 initial-valuef) + (the float (- 255 (the int (* 255.0 f28-0 (-> this engine-thrust))))) + ) + (set! (-> *part-id-table* 2762 init-specs 7 initial-valuef) + (+ (rand-vu-float-range 0.0 (* 40.0 (-> this engine-thrust))) + (* 20.0 f28-0 (-> this engine-thrust)) + (the float (* 30 (the int f28-0))) + ) + ) + (set! (-> *part-id-table* 2762 init-specs 2 initial-valuef) f30-0) + (set! (-> *part-id-table* 2762 init-specs 3 initial-valuef) f30-0) ) + (launch-particles (-> *part-id-table* 2761) s4-0 :origin-is-matrix #t) + (launch-particles (-> *part-id-table* 2762) s4-0 :origin-is-matrix #t) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod vehicle-method-78 ((this h-warf)) diff --git a/goal_src/jak3/levels/factory/missile-bot.gc b/goal_src/jak3/levels/factory/missile-bot.gc index 2e9d9264db..e46388dcdd 100644 --- a/goal_src/jak3/levels/factory/missile-bot.gc +++ b/goal_src/jak3/levels/factory/missile-bot.gc @@ -300,79 +300,56 @@ ) (defbehavior missile-bot-find-dest missile-bot ((arg0 vector)) - (local-vars (v1-22 float) (a2-3 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node missile-bot-lod0-jg main)))) - (vector-copy! arg0 s4-0) - (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) s4-0 (target-pos 0))) - (s3-1 (as-type (ppointer->process (-> self parent)) factory-boss)) - (s0-0 (new 'stack-no-clear 'vector)) - (s2-1 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - ) - (when s3-1 - (set! (-> s5-1 y) 0.0) - (vector-normalize! s5-1 1.0) - (vector-! s0-0 (-> s3-1 center) s4-0) - (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) - (f0-6 (* f0-4 f0-4)) - ) - (.lvf vf1 (&-> s1-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 a2-3 vf1) - (vector+float*! v1-10 a0-11 a1-7 (sqrtf (- f0-6 a2-3))) - ) - (if (< (vector-dot s5-1 arg0) 0.0) - (vector-reset! arg0) + (let ((s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node missile-bot-lod0-jg main)))) + (vector-copy! arg0 s4-0) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) s4-0 (target-pos 0))) + (s3-1 (as-type (ppointer->process (-> self parent)) factory-boss)) + (s0-0 (new 'stack-no-clear 'vector)) + (s2-1 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (when s3-1 + (set! (-> s5-1 y) 0.0) + (vector-normalize! s5-1 1.0) + (vector-! s0-0 (-> s3-1 center) s4-0) + (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+! s2-1 s2-1 s4-0) - (vector+! arg0 arg0 s4-0) - (let ((s2-3 (vector-! (new 'stack-no-clear 'vector) (-> s3-1 root trans) arg0))) - 0.0 - (let ((f0-13 (* -0.5 (vector-vector-distance arg0 s4-0)))) - (set! (-> s2-3 y) 0.0) - (.lvf vf1 (&-> s2-3 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-22 vf1) - (let ((f1-3 v1-22) - (f2-0 20480.0) - ) - (if (< (* f2-0 f2-0) f1-3) - (vector-float*! s2-3 s2-3 (/ 20480.0 (sqrtf f1-3))) - ) - ) - (let ((f1-7 (vector-dot s2-3 s5-1))) - (if (< f1-7 f0-13) - (vector-float*! s2-3 s2-3 (/ f0-13 f1-7)) - ) - ) - ) - (vector+! arg0 arg0 s2-3) + (vector+float*! v1-10 a0-11 a1-7 (sqrtf (- (* f0-4 f0-4) (vector-length-squared s1-0)))) + ) + (if (< (vector-dot s5-1 arg0) 0.0) + (vector-reset! arg0) ) + (vector+! s2-1 s2-1 s4-0) + (vector+! arg0 arg0 s4-0) + (let ((s2-3 (vector-! (new 'stack-no-clear 'vector) (-> s3-1 root trans) arg0))) + 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) + (vector-float*! s2-3 s2-3 (/ 20480.0 (sqrtf f1-3))) + ) + ) + (let ((f1-7 (vector-dot s2-3 s5-1))) + (if (< f1-7 f0-13) + (vector-float*! s2-3 s2-3 (/ f0-13 f1-7)) + ) + ) + ) + (vector+! arg0 arg0 s2-3) ) ) ) - arg0 ) + arg0 ) (defstate jump (missile-bot) diff --git a/goal_src/jak3/levels/factory/warf-projectile.gc b/goal_src/jak3/levels/factory/warf-projectile.gc index a63e9f436a..e2ec99f494 100644 --- a/goal_src/jak3/levels/factory/warf-projectile.gc +++ b/goal_src/jak3/levels/factory/warf-projectile.gc @@ -367,44 +367,24 @@ ) (defmethod projectile-method-25 ((this warf-projectile)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (v1-1 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 v1-1)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (v1-1 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 v1-1)) - (f30-0 (vector-length s5-1)) - ) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (let ((a0-4 s5-1)) - (let ((a1-2 0.8)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-4 quad)) - ) - (.lvf vf4 (&-> v1-1 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 (&-> s3-0 quad) vf6) - (vector-normalize! s5-1 1.0) - (warf-projectile-method-42 this s3-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix))) - (fmin 1.0 (/ f30-0 (meters 40))) - (-> *part-id-table* 2895 init-specs 3 initial-valuef) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - ) + (let ((s3-1 (vector+*! (new 'stack-no-clear 'vector) v1-1 s5-1 0.8))) + (vector-normalize! s5-1 1.0) + (warf-projectile-method-42 this s3-1) + ) + (let ((s4-1 (new 'stack-no-clear 'matrix))) + (fmin 1.0 (/ f30-0 (meters 40))) + (-> *part-id-table* 2895 init-specs 3 initial-valuef) + (forward-up->inv-matrix s4-1 s5-1 *up-vector*) + (vector-copy! (-> s4-1 trans) gp-0) ) - 0 - (none) ) + 0 + (none) ) (defmethod setup-collision! ((this warf-projectile)) @@ -945,49 +925,27 @@ ) (defmethod projectile-method-25 ((this gun-warf-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((s5-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-0 a1-0)) + (f30-0 (vector-length s4-1)) ) - (init-vf0-vector) - (let* ((s5-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-0 a1-0)) - (f30-0 (vector-length s4-1)) - ) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s4-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s3-0 quad) vf6) - (gun-warf-shot-method-41 this a1-0 s4-1) - (vector-normalize! s4-1 1.0) - (launch-part this s3-0) - ) - (let ((s3-1 (new 'stack-no-clear 'matrix)) - (f30-1 (fmin 1.0 (/ f30-0 (meters 30)))) - (f28-0 (-> *part-id-table* 2895 init-specs 3 initial-valuef)) - ) - (forward-up->inv-matrix s3-1 s4-1 *up-vector*) - (vector-copy! (-> s3-1 trans) s5-0) - (gun-warf-shot-method-42 this f30-1 f28-0 s3-1) - ) + (let ((s3-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s4-1 0.8))) + (gun-warf-shot-method-41 this a1-0 s4-1) + (vector-normalize! s4-1 1.0) + (launch-part this s3-1) + ) + (let ((s3-2 (new 'stack-no-clear 'matrix)) + (f30-1 (fmin 1.0 (/ f30-0 (meters 30)))) + (f28-0 (-> *part-id-table* 2895 init-specs 3 initial-valuef)) + ) + (forward-up->inv-matrix s3-2 s4-1 *up-vector*) + (vector-copy! (-> s3-2 trans) s5-0) + (gun-warf-shot-method-42 this f30-1 f28-0 s3-2) ) - 0 - (none) ) + 0 + (none) ) (defmethod deal-damage! ((this gun-warf-shot) (arg0 process) (arg1 event-message-block)) @@ -1040,33 +998,15 @@ ) (defmethod projectile-method-25 ((this fac-gun-tower-projectile)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((a1-0 (-> this root trans)) + (v1-1 (-> this tail-pos)) + (a2-1 (vector-! (new 'stack-no-clear 'vector) a1-0 v1-1)) + (a1-2 (vector+*! (new 'stack-no-clear 'vector) v1-1 a2-1 0.8)) ) - (init-vf0-vector) - (let* ((a1-0 (-> this root trans)) - (v1-1 (-> this tail-pos)) - (a2-1 (vector-! (new 'stack-no-clear 'vector) a1-0 v1-1)) - (a1-1 (new 'stack-no-clear 'vector)) - ) - (let ((a3-2 0.8)) - (.mov vf7 a3-2) - ) - (.lvf vf5 (&-> a2-1 quad)) - (.lvf vf4 (&-> v1-1 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-1 quad) vf6) - (spawn (-> this part) a1-1) - ) - 0 - (none) + (spawn (-> this part) a1-2) ) + 0 + (none) ) (defmethod play-impact-sound ((this fac-gun-tower-projectile) (arg0 projectile-options)) diff --git a/goal_src/jak3/levels/forest/for-turret-shot.gc b/goal_src/jak3/levels/forest/for-turret-shot.gc index 357aedaa5e..025ca7818e 100644 --- a/goal_src/jak3/levels/forest/for-turret-shot.gc +++ b/goal_src/jak3/levels/forest/for-turret-shot.gc @@ -338,58 +338,36 @@ ) (defmethod projectile-method-25 ((this for-turret-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 1065 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 1065 init-specs 4 initial-valuef) (fmin f28-0 (vector-length s5-1))) - (draw-beam (-> *part-id-table* 1065) a1-0 s5-1 #f) - (set! (-> *part-id-table* 1065 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 1066) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f26-0 (/ f30-0 (meters 30))) - (f30-1 (-> *part-id-table* 1067 init-specs 3 initial-valuef)) - (f28-1 (-> *part-id-table* 1067 init-specs 5 initial-valuef)) - ) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 1067 init-specs 3 initial-valuef) (* f26-0 f30-1)) - (set! (-> *part-id-table* 1067 init-specs 5 initial-valuef) (* f26-0 f28-1)) - (launch-particles (-> *part-id-table* 1067) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 1067 init-specs 3 initial-valuef) f30-1) - (set! (-> *part-id-table* 1067 init-specs 5 initial-valuef) f28-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 1065 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 1065 init-specs 4 initial-valuef) (fmin f28-0 (vector-length s5-1))) + (draw-beam (-> *part-id-table* 1065) a1-0 s5-1 #f) + (set! (-> *part-id-table* 1065 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 1066) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f26-0 (/ f30-0 (meters 30))) + (f30-1 (-> *part-id-table* 1067 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 1067 init-specs 5 initial-valuef)) + ) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 1067 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 1067 init-specs 5 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 1067) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 1067 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 1067 init-specs 5 initial-valuef) f28-1) ) - 0 - (none) ) + 0 + (none) ) (defmethod projectile-method-26 ((this for-turret-shot)) diff --git a/goal_src/jak3/levels/forest/forest-ring-chase.gc b/goal_src/jak3/levels/forest/forest-ring-chase.gc index fcea4c56da..b19e676c44 100644 --- a/goal_src/jak3/levels/forest/forest-ring-chase.gc +++ b/goal_src/jak3/levels/forest/forest-ring-chase.gc @@ -474,7 +474,7 @@ (vector-cross! s5-2 s3-0 s4-3) (vector-normalize! s5-2 1.0) (let ((f0-21 (deg-seek f28-1 f26-0 (* 49152.0 (seconds-per-frame))))) - (vector-rotate-around-axis! s4-3 (the-as quaternion s4-3) (* -1.0 f0-21) s5-2) + (vector-rotate-around-axis! s4-3 s4-3 (* -1.0 f0-21) s5-2) ) ) ) diff --git a/goal_src/jak3/levels/glider/glider-manager.gc b/goal_src/jak3/levels/glider/glider-manager.gc index bde7ef0751..6dd89d5d41 100644 --- a/goal_src/jak3/levels/glider/glider-manager.gc +++ b/goal_src/jak3/levels/glider/glider-manager.gc @@ -988,135 +988,112 @@ ) (defmethod task-manager-desert-glide-method-36 ((this task-manager-desert-glide)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (if (and (cpad-hold? 0 triangle) (cpad-hold? 0 up)) - (set! (-> this editing?) #t) - ) - (when (and *target* (focus-test? *target* pilot) (cpad-hold? 0 triangle) (cpad-pressed? 0 r1)) + (if (and (cpad-hold? 0 triangle) (cpad-hold? 0 up)) (set! (-> this editing?) #t) - (let ((s5-0 (new 'stack 'glider-ring-info))) - (let ((s4-0 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle))) - (b! (not s4-0) cfg-86 :delay (nop!)) - (vector-copy! (-> s5-0 pos) (-> s4-0 rbody matrix trans)) - (vector-copy! (-> s5-0 forw) (-> s4-0 rbody matrix fvec)) - (set! (-> s5-0 shootable) #f) - (set! (-> s5-0 speedmod) 1.0) - (cond - ((cpad-hold? 0 down) - (set! (-> s5-0 boost) 0.25) - ) - ((cpad-hold? 0 left) - (set! (-> s5-0 boost) 0.5) - ) - ((cpad-hold? 0 up) - (set! (-> s5-0 boost) 0.75) - ) - ((cpad-hold? 0 right) - (set! (-> s5-0 boost) 0.0) - ) - (else - (set! (-> s5-0 boost) 1.0) - ) - ) - (set! (-> s5-0 dist) 819200.0) - (glider-ring-spawn this s5-0 *ring-spawn-id* #f) - (send-event s4-0 'turbo-ring (-> s5-0 boost)) - ) - (mem-copy! (the-as pointer (-> *desert-glide-rings-tmp* *ring-spawn-id*)) (the-as pointer s5-0) 69) - ) - (set! *ring-spawn-id* (+ *ring-spawn-id* 1)) ) - (when (and *target* (focus-test? *target* pilot) (cpad-hold? 0 triangle) (cpad-pressed? 0 r2)) - (when (not (-> this creating-thermal?)) - (set! (-> this creating-thermal?) #t) - (set-time! (-> this thermal-start-time)) - ) - (set! (-> this editing?) #t) - (let ((s5-1 (new 'stack 'glider-thermal-info))) - (let ((v1-85 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle))) - (b! (not v1-85) cfg-86 :delay (nop!)) - (vector-copy! (-> s5-1 pos) (-> v1-85 rbody matrix trans)) - (set! (-> s5-1 pos w) 40960.0) - (set! (-> s5-1 thermal-time) 0) - (let ((a0-42 (new 'stack-no-clear 'vector))) - (let ((a2-2 a0-42)) - (let ((a1-13 (-> s5-1 pos))) - (let ((v1-87 (-> v1-85 rbody matrix fvec))) - (let ((a3-1 (-> s5-1 pos w))) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> v1-87 quad)) - ) - (.lvf vf4 (&-> a1-13 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) - ) - (set! (-> a0-42 w) (-> s5-1 pos w)) - (vector-copy! (-> s5-1 pos) a0-42) + (when (and *target* (focus-test? *target* pilot) (cpad-hold? 0 triangle) (cpad-pressed? 0 r1)) + (set! (-> this editing?) #t) + (let ((s5-0 (new 'stack 'glider-ring-info))) + (let ((s4-0 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle))) + (b! (not s4-0) cfg-86 :delay (nop!)) + (vector-copy! (-> s5-0 pos) (-> s4-0 rbody matrix trans)) + (vector-copy! (-> s5-0 forw) (-> s4-0 rbody matrix fvec)) + (set! (-> s5-0 shootable) #f) + (set! (-> s5-0 speedmod) 1.0) + (cond + ((cpad-hold? 0 down) + (set! (-> s5-0 boost) 0.25) + ) + ((cpad-hold? 0 left) + (set! (-> s5-0 boost) 0.5) + ) + ((cpad-hold? 0 up) + (set! (-> s5-0 boost) 0.75) + ) + ((cpad-hold? 0 right) + (set! (-> s5-0 boost) 0.0) + ) + (else + (set! (-> s5-0 boost) 1.0) ) ) - (set! (-> s5-1 hheight) 409600.0) - (set! (-> s5-1 curpos) 0.0) - (set! (-> s5-1 windspeed) 327680.0) - (mem-copy! (the-as pointer (-> *desert-glide-thermals-tmp* *thermal-spawn-id*)) (the-as pointer s5-1) 40) + (set! (-> s5-0 dist) 819200.0) + (glider-ring-spawn this s5-0 *ring-spawn-id* #f) + (send-event s4-0 'turbo-ring (-> s5-0 boost)) ) - (set! *thermal-spawn-id* (+ *thermal-spawn-id* 1)) - (set! *desert-glide-num-thermals* (+ *desert-glide-num-thermals* 1)) + (mem-copy! (the-as pointer (-> *desert-glide-rings-tmp* *ring-spawn-id*)) (the-as pointer s5-0) 69) ) - (when (-> this creating-thermal?) - (let ((s5-2 (-> *desert-glide-thermals-tmp* (+ *thermal-spawn-id* -1))) - (s3-1 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle)) - (s4-3 (new 'stack-no-clear 'vector)) - ) - 0.0 - 0.0 - (b! (not s3-1) cfg-86 :delay (nop!)) - (let ((f0-16 (vector-vector-xz-distance (-> s3-1 rbody matrix trans) (-> s5-2 pos)))) - (let ((f1-1 (- (-> s3-1 rbody matrix trans y) (-> s5-2 pos y)))) - (if (< (/ (-> s5-2 hheight) 2) f1-1) - (set! (-> s5-2 hheight) (* 2.0 f1-1)) - ) - ) - (if (< (-> s5-2 pos w) (+ 4096.0 f0-16)) - (set! (-> s5-2 pos w) (+ 4096.0 f0-16)) - ) - (when (not (cpad-hold? 0 r2)) - (vector+! s4-3 (-> s3-1 rbody matrix trans) (-> s5-2 pos)) - (vector-float*! (-> s5-2 pos) s4-3 0.5) - (set! (-> s5-2 pos w) (/ f0-16 2)) - (set! (-> s5-2 thermal-time) (- (current-time) (-> this thermal-start-time))) - (set! (-> this creating-thermal?) #f) - ) - ) - ) - ) - (when (and (cpad-pressed? 0 l1) (cpad-hold? 0 up)) - (dotimes (gp-1 (-> *desert-glide-rings* length)) - (to-static-macro (-> *desert-glide-rings* gp-1) #t) - ) - (dotimes (gp-2 *ring-spawn-id*) - (to-static-macro (-> *desert-glide-rings-tmp* gp-2) #t) - ) - ) - (when (and (cpad-pressed? 0 l2) (cpad-hold? 0 up)) - (dotimes (gp-3 *desert-glide-num-thermals*) - (to-static-macro (-> *desert-glide-thermals-tmp* gp-3) #t) - ) - ) - (label cfg-86) - 0 - (none) + (set! *ring-spawn-id* (+ *ring-spawn-id* 1)) ) + (when (and *target* (focus-test? *target* pilot) (cpad-hold? 0 triangle) (cpad-pressed? 0 r2)) + (when (not (-> this creating-thermal?)) + (set! (-> this creating-thermal?) #t) + (set-time! (-> this thermal-start-time)) + ) + (set! (-> this editing?) #t) + (let ((s5-1 (new 'stack 'glider-thermal-info))) + (let ((v1-85 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle))) + (b! (not v1-85) cfg-86 :delay (nop!)) + (vector-copy! (-> s5-1 pos) (-> v1-85 rbody matrix trans)) + (set! (-> s5-1 pos w) 40960.0) + (set! (-> s5-1 thermal-time) 0) + (let ((a0-42 (new 'stack-no-clear 'vector))) + (vector+*! a0-42 (-> s5-1 pos) (-> v1-85 rbody matrix fvec) (-> s5-1 pos w)) + (set! (-> a0-42 w) (-> s5-1 pos w)) + (vector-copy! (-> s5-1 pos) a0-42) + ) + ) + (set! (-> s5-1 hheight) 409600.0) + (set! (-> s5-1 curpos) 0.0) + (set! (-> s5-1 windspeed) 327680.0) + (mem-copy! (the-as pointer (-> *desert-glide-thermals-tmp* *thermal-spawn-id*)) (the-as pointer s5-1) 40) + ) + (set! *thermal-spawn-id* (+ *thermal-spawn-id* 1)) + (set! *desert-glide-num-thermals* (+ *desert-glide-num-thermals* 1)) + ) + (when (-> this creating-thermal?) + (let ((s5-2 (-> *desert-glide-thermals-tmp* (+ *thermal-spawn-id* -1))) + (s3-1 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle)) + (s4-3 (new 'stack-no-clear 'vector)) + ) + 0.0 + 0.0 + (b! (not s3-1) cfg-86 :delay (nop!)) + (let ((f0-16 (vector-vector-xz-distance (-> (the-as hvehicle s3-1) rbody matrix trans) (-> s5-2 pos)))) + (let ((f1-1 (- (-> (the-as hvehicle s3-1) rbody matrix trans y) (-> s5-2 pos y)))) + (if (< (/ (-> s5-2 hheight) 2) f1-1) + (set! (-> s5-2 hheight) (* 2.0 f1-1)) + ) + ) + (if (< (-> s5-2 pos w) (+ 4096.0 f0-16)) + (set! (-> s5-2 pos w) (+ 4096.0 f0-16)) + ) + (when (not (cpad-hold? 0 r2)) + (vector+! s4-3 (-> (the-as hvehicle s3-1) rbody matrix trans) (-> s5-2 pos)) + (vector-float*! (-> s5-2 pos) s4-3 0.5) + (set! (-> s5-2 pos w) (/ f0-16 2)) + (set! (-> s5-2 thermal-time) (- (current-time) (-> this thermal-start-time))) + (set! (-> this creating-thermal?) #f) + ) + ) + ) + ) + (when (and (cpad-pressed? 0 l1) (cpad-hold? 0 up)) + (dotimes (gp-1 (-> *desert-glide-rings* length)) + (to-static-macro (-> *desert-glide-rings* gp-1) #t) + ) + (dotimes (gp-2 *ring-spawn-id*) + (to-static-macro (-> *desert-glide-rings-tmp* gp-2) #t) + ) + ) + (when (and (cpad-pressed? 0 l2) (cpad-hold? 0 up)) + (dotimes (gp-3 *desert-glide-num-thermals*) + (to-static-macro (-> *desert-glide-thermals-tmp* gp-3) #t) + ) + ) + (label cfg-86) + 0 + (none) ) (defmethod task-manager-desert-glide-method-38 ((this task-manager-desert-glide)) @@ -1323,138 +1300,115 @@ (defmethod task-manager-method-26 ((this task-manager-desert-glide)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (task-manager-desert-glide-method-35 this) - (if (glider-too-low? (target-pos 0) (the-as int (-> this reset-too-low?))) - (desert-glide-task-done) - ) - (when (and (zero? (-> this whistle-sound)) (time-elapsed? (-> this start-time) (seconds 0.2))) - (set! (-> this whistle-sound) (new-sound-id)) - (sound-play "whistling-wind" :id (-> this whistle-sound)) + (task-manager-desert-glide-method-35 this) + (if (glider-too-low? (target-pos 0) (the-as int (-> this reset-too-low?))) + (desert-glide-task-done) ) - (set! (-> this reset-too-low?) #f) - (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)) + (when (and (zero? (-> this whistle-sound)) (time-elapsed? (-> this start-time) (seconds 0.2))) + (set! (-> this whistle-sound) (new-sound-id)) + (sound-play "whistling-wind" :id (-> this whistle-sound)) + ) + (set! (-> this reset-too-low?) #f) + (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*) ) - (< f0-0 (* f1-0 f1-0)) - ) + (f1-0 (-> *desert-glide-finish-sphere* r)) + ) + (< f0-0 (* f1-0 f1-0)) ) - (if (not (-> this editing?)) - (send-event this 'complete) - ) - (when (-> this editing?) - (dotimes (s4-1 (-> *desert-glide-rings* length)) - (to-static-macro (-> *desert-glide-rings* s4-1) #t) - ) - (dotimes (s4-2 *ring-spawn-id*) - (to-static-macro (-> *desert-glide-rings-tmp* s4-2) #t) - ) - (dotimes (s4-3 *desert-glide-num-thermals*) - (to-static-macro (-> *desert-glide-thermals-tmp* s4-3) #t) - ) + ) + (if (not (-> this editing?)) (send-event this 'complete) ) + (when (-> this editing?) + (dotimes (s4-1 (-> *desert-glide-rings* length)) + (to-static-macro (-> *desert-glide-rings* s4-1) #t) + ) + (dotimes (s4-2 *ring-spawn-id*) + (to-static-macro (-> *desert-glide-rings-tmp* s4-2) #t) + ) + (dotimes (s4-3 *desert-glide-num-thermals*) + (to-static-macro (-> *desert-glide-thermals-tmp* s4-3) #t) + ) + (send-event this 'complete) ) - (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))) + ) + (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*) ) - (< f0-1 (* f1-4 f1-4)) - ) + (f1-4 (+ 1228800.0 (-> *desert-glide-finish-sphere* r))) + ) + (< f0-1 (* f1-4 f1-4)) ) - (let ((a1-13 (new 'stack-no-clear 'array 'symbol 10))) - (set! (-> a1-13 9) #f) - (set! (-> a1-13 8) #f) - (set! (-> a1-13 7) #f) - (set! (-> a1-13 6) #f) - (set! (-> a1-13 5) #f) - (set! (-> a1-13 4) #f) - (set! (-> a1-13 3) #f) - (set! (-> a1-13 2) 'volcanox) - (set! (-> a1-13 1) 'hangb) - (set! (-> a1-13 0) 'hanga) - (want-levels *load-state* a1-13) - ) - (want-display-level *load-state* 'volcanox 'display) - (set! (-> this did-want-load?) #t) + ) + (let ((a1-13 (new 'stack-no-clear 'array 'symbol 10))) + (set! (-> a1-13 9) #f) + (set! (-> a1-13 8) #f) + (set! (-> a1-13 7) #f) + (set! (-> a1-13 6) #f) + (set! (-> a1-13 5) #f) + (set! (-> a1-13 4) #f) + (set! (-> a1-13 3) #f) + (set! (-> a1-13 2) 'volcanox) + (set! (-> a1-13 1) 'hangb) + (set! (-> a1-13 0) 'hanga) + (want-levels *load-state* a1-13) ) + (want-display-level *load-state* 'volcanox 'display) + (set! (-> this did-want-load?) #t) ) - (let ((s5-2 (new 'stack-no-clear 'vector))) - (let ((s4-4 (camera-matrix))) - (vector-copy! s5-2 (camera-pos)) - (let ((a0-29 s5-2)) - (let ((v1-73 s5-2)) - (let ((a1-15 (-> s4-4 fvec))) - (let ((a2-3 1187840.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a1-15 quad)) - ) - (.lvf vf4 (&-> v1-73 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-29 quad) vf6) - ) - ) - (vector-copy! *cloud-cube* s5-2) - ) - (set! (-> *cloud-cube* w) 2457600.0) - (task-manager-desert-glide-method-34 this) ) - (task-manager-desert-glide-method-38 this) - (when (time-elapsed? (-> this check-timer) (seconds 0.1)) - (if (not (-> this desert-glide-entity)) - (task-manager-desert-glide-method-33 this) - ) - (when (< (-> this cur-group) (-> this actor-group-count)) - (let ((s5-3 (-> this actor-group (-> this cur-group)))) - (dotimes (s4-5 (-> s5-3 length)) - (let ((a1-16 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-16 from) (process->ppointer pp)) - (set! (-> a1-16 num-params) 0) - (set! (-> a1-16 message) 'trigger) - (let ((t9-21 send-event-function) - (v1-98 (-> s5-3 data s4-5 actor)) - ) - (t9-21 - (if v1-98 - (-> v1-98 extra process) - ) - a1-16 - ) - ) - ) - ) - ) + (let ((s5-2 (new 'stack-no-clear 'vector))) + (let ((s4-4 (camera-matrix))) + (vector-copy! s5-2 (camera-pos)) + (vector+*! s5-2 s5-2 (-> s4-4 fvec) 1187840.0) ) - (if (< 1.0 (-> *game-info* counter)) - (set! (-> this sound-id) - (add-process *gui-control* this (gui-channel background) (gui-action queue) "miss001" -99.0 0) - ) - ) - (set! (-> *game-info* counter) 0.0) - (set-time! (-> this check-timer)) + (vector-copy! *cloud-cube* s5-2) ) - 0 - (none) + (set! (-> *cloud-cube* w) 2457600.0) + (task-manager-desert-glide-method-34 this) ) + (task-manager-desert-glide-method-38 this) + (when (time-elapsed? (-> this check-timer) (seconds 0.1)) + (if (not (-> this desert-glide-entity)) + (task-manager-desert-glide-method-33 this) + ) + (when (< (-> this cur-group) (-> this actor-group-count)) + (let ((s5-3 (-> this actor-group (-> this cur-group)))) + (dotimes (s4-5 (-> s5-3 length)) + (let ((a1-16 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-16 from) (process->ppointer pp)) + (set! (-> a1-16 num-params) 0) + (set! (-> a1-16 message) 'trigger) + (let ((t9-21 send-event-function) + (v1-98 (-> s5-3 data s4-5 actor)) + ) + (t9-21 + (if v1-98 + (-> v1-98 extra process) + ) + a1-16 + ) + ) + ) + ) + ) + ) + (if (< 1.0 (-> *game-info* counter)) + (set! (-> this sound-id) + (add-process *gui-control* this (gui-channel background) (gui-action queue) "miss001" -99.0 0) + ) + ) + (set! (-> *game-info* counter) 0.0) + (set-time! (-> this check-timer)) + ) + 0 + (none) ) ) diff --git a/goal_src/jak3/levels/glider/glider-ring.gc b/goal_src/jak3/levels/glider/glider-ring.gc index 59e7c45242..0ac9e61ad1 100644 --- a/goal_src/jak3/levels/glider/glider-ring.gc +++ b/goal_src/jak3/levels/glider/glider-ring.gc @@ -352,145 +352,118 @@ ) ) :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (if (and (-> self player-got) - (time-elapsed? (-> self touch-time) (seconds 0.5)) - (or (not *target*) (or (< 81920.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) - (focus-test? *target* teleporting) - ) - ) - (not (-> self persistent)) - ) - (go-virtual die) - ) - (if (< (vector-vector-distance-squared (target-pos 0) (-> self root trans)) *near-thermal-dist-squared*) - (set-far self #f) - (set-far self #t) - ) - (vector-copy! (-> self root trans) (-> self save-pos)) - (when (< 0.0 (-> self speedmod)) - (when (!= (-> self xdist) 0.0) - (let ((gp-1 (-> self root trans))) - (let ((s5-0 (-> self root trans))) - (let ((s4-0 (-> self right))) - (let ((v1-34 (* (-> self xdist) (sin (* 75.0 (-> self speedmod) (the float (+ (current-time) (-> self toff)))))))) - (.mov vf7 v1-34) - ) - (.lvf vf5 (&-> s4-0 quad)) - ) - (.lvf vf4 (&-> s5-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 (&-> gp-1 quad) vf6) - ) - ) - (when (!= (-> self ydist) 0.0) - (let ((gp-3 (-> self root trans))) - (let ((s5-1 (-> self root trans))) - (let ((s4-1 (-> self up))) - (let ((v1-41 (* (-> self ydist) (cos (* 75.0 (-> self speedmod) (the float (+ (current-time) (-> self toff)))))))) - (.mov vf7 v1-41) - ) - (.lvf vf5 (&-> s4-1 quad)) - ) - (.lvf vf4 (&-> s5-1 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 (&-> gp-3 quad) vf6) - ) - ) - ) - (if (and (-> self shootable) (not (-> self shot))) - (quaternion-rotate-local-z! (-> self root quat) (-> self root quat) (* 32768.0 (seconds-per-frame))) - ) - (vector-copy! (-> self mat trans) (-> self root trans)) - (when (and (nonzero? (-> self distant-part)) (not (-> self shootable))) - ) - (when (logtest? (-> self draw status) (draw-control-status on-screen)) - (cond - ((-> self shootable) - (when (-> self shot) - ) - ) - (else - ) - ) - ) - (when (-> self shootable) - (if (-> self shot) - (ja :group! des-glider-ring-expand-ja :num! (seek! max 10.0)) - ) - (if (not (-> self shot)) - (ja :num! (seek!)) - ) - ) - (when (and (-> self shootable) (-> self shot) (not (-> self blinky-gone?))) - (kill-particles (-> self blinky-part)) - (set! (-> self blinky-part) (the-as sparticle-launch-control 0)) - (set! (-> self blinky-gone?) #t) - ) - (when (and (-> self shootable) (not (or (-> self shot) (-> self blinky-gone?)))) - (let ((a1-10 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 0)))) - (set! (-> *part-id-table* 2555 init-specs 10 initial-valuef) (the float (-> self center-joint))) - (spawn (-> self blinky-part) a1-10) - ) - ) - (when (-> self do-trails?) - (dotimes (gp-4 5) - (let ((v1-121 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self trail-joint gp-4))))) - (send-event (handle->process (-> self trails gp-4)) 'notice 'add-crumb-pos v1-121) - ) - ) - ) - (when (and (-> self shootable) (and (-> self shot) - (time-elapsed? (-> self state-time) (seconds 0.5)) - (not (handle->process (-> self ring-prim))) - ) + (if (and (-> self player-got) + (time-elapsed? (-> self touch-time) (seconds 0.5)) + (or (not *target*) (or (< 81920.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (focus-test? *target* teleporting) + ) ) - (let ((gp-5 (get-process *default-dead-pool* glider-prim #x4000 1))) - (set! (-> self ring-prim) - (ppointer->handle - (when gp-5 - (let ((t9-17 (method-of-type process activate))) - (t9-17 gp-5 self "prim" (the-as pointer #x70004000)) - ) - (let ((t9-18 run-function-in-process) - (a0-41 gp-5) - (a1-17 simple-prim-init-by-other) - (a2-7 (-> self root trans)) - (a3-2 (new 'stack-no-clear 'vector)) - ) - (set! (-> a3-2 x) 32768.0) - (set! (-> a3-2 y) 32768.0) - (set! (-> a3-2 z) 32768.0) - (set! (-> a3-2 w) 1.0) - ((the-as (function object object object object object none) t9-18) a0-41 a1-17 a2-7 a3-2 #x5e700200) - ) - (-> gp-5 ppointer) + (not (-> self persistent)) + ) + (go-virtual die) + ) + (if (< (vector-vector-distance-squared (target-pos 0) (-> self root trans)) *near-thermal-dist-squared*) + (set-far self #f) + (set-far self #t) + ) + (vector-copy! (-> self root trans) (-> self save-pos)) + (when (< 0.0 (-> self speedmod)) + (if (!= (-> self xdist) 0.0) + (vector+*! + (-> self root trans) + (-> self root trans) + (-> self right) + (* (-> self xdist) (sin (* 75.0 (-> self speedmod) (the float (+ (current-time) (-> self toff)))))) + ) + ) + (if (!= (-> self ydist) 0.0) + (vector+*! + (-> self root trans) + (-> self root trans) + (-> self up) + (* (-> self ydist) (cos (* 75.0 (-> self speedmod) (the float (+ (current-time) (-> self toff)))))) + ) + ) + ) + (if (and (-> self shootable) (not (-> self shot))) + (quaternion-rotate-local-z! (-> self root quat) (-> self root quat) (* 32768.0 (seconds-per-frame))) + ) + (vector-copy! (-> self mat trans) (-> self root trans)) + (when (and (nonzero? (-> self distant-part)) (not (-> self shootable))) + ) + (when (logtest? (-> self draw status) (draw-control-status on-screen)) + (cond + ((-> self shootable) + (when (-> self shot) + ) + ) + (else + ) + ) + ) + (when (-> self shootable) + (if (-> self shot) + (ja :group! des-glider-ring-expand-ja :num! (seek! max 10.0)) + ) + (if (not (-> self shot)) + (ja :num! (seek!)) + ) + ) + (when (and (-> self shootable) (-> self shot) (not (-> self blinky-gone?))) + (kill-particles (-> self blinky-part)) + (set! (-> self blinky-part) (the-as sparticle-launch-control 0)) + (set! (-> self blinky-gone?) #t) + ) + (when (and (-> self shootable) (not (or (-> self shot) (-> self blinky-gone?)))) + (let ((a1-10 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 0)))) + (set! (-> *part-id-table* 2555 init-specs 10 initial-valuef) (the float (-> self center-joint))) + (spawn (-> self blinky-part) a1-10) + ) + ) + (when (-> self do-trails?) + (dotimes (gp-6 5) + (let ((v1-119 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self trail-joint gp-6))))) + (send-event (handle->process (-> self trails gp-6)) 'notice 'add-crumb-pos v1-119) + ) + ) + ) + (when (and (-> self shootable) (and (-> self shot) + (time-elapsed? (-> self state-time) (seconds 0.5)) + (not (handle->process (-> self ring-prim))) + ) + ) + (let ((gp-7 (get-process *default-dead-pool* glider-prim #x4000 1))) + (set! (-> self ring-prim) + (ppointer->handle + (when gp-7 + (let ((t9-17 (method-of-type process activate))) + (t9-17 gp-7 self "prim" (the-as pointer #x70004000)) ) + (let ((t9-18 run-function-in-process) + (a0-41 gp-7) + (a1-17 simple-prim-init-by-other) + (a2-7 (-> self root trans)) + (a3-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-2 x) 32768.0) + (set! (-> a3-2 y) 32768.0) + (set! (-> a3-2 z) 32768.0) + (set! (-> a3-2 w) 1.0) + ((the-as (function object object object object object none) t9-18) a0-41 a1-17 a2-7 a3-2 #x5e700200) + ) + (-> gp-7 ppointer) ) ) - ) + ) ) - (let ((v1-151 (the-as glider-prim (handle->process (-> self ring-prim))))) - (when v1-151 - (vector-copy! (-> v1-151 root trans) (-> self root trans)) - (quaternion-copy! (-> v1-151 root quat) (-> self root quat)) - ) - ) - (transform-post) ) + (let ((v1-149 (handle->process (-> self ring-prim)))) + (when v1-149 + (vector-copy! (-> (the-as glider-prim v1-149) root trans) (-> self root trans)) + (quaternion-copy! (-> (the-as glider-prim v1-149) root quat) (-> self root quat)) + ) + ) + (transform-post) ) ) @@ -590,122 +563,101 @@ ) (defbehavior glider-ring-init-by-other glider-ring ((arg0 glider-ring-info) (arg1 int) (arg2 symbol)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (init-collision! self) - (initialize-skeleton - self - (the-as skeleton-group (art-group-get-by-name *level* "skel-glider-ring" (the-as (pointer level) #f))) - (the-as pair 0) - ) - (set! (-> self entity) #f) - (cond - ((-> arg0 shootable) - (ja :group! des-glider-ring-idle-ja :num! min) - (set! (-> self ring-prim) (the-as handle #f)) - ) - (else - (ja :group! des-glider-ring-expand-ja :num! max) - (let ((s3-3 (get-process *default-dead-pool* glider-prim #x4000 1))) - (set! (-> self ring-prim) - (ppointer->handle - (when s3-3 - (let ((t9-6 (method-of-type process activate))) - (t9-6 s3-3 self "prim" (the-as pointer #x70004000)) - ) - (let ((t9-7 run-function-in-process) - (a0-8 s3-3) - (a1-7 simple-prim-init-by-other) - (a2-7 (-> self root trans)) - (a3-2 (new 'stack-no-clear 'vector)) - ) - (set! (-> a3-2 x) 32768.0) - (set! (-> a3-2 y) 32768.0) - (set! (-> a3-2 z) 32768.0) - (set! (-> a3-2 w) 1.0) - ((the-as (function object object object object object none) t9-7) a0-8 a1-7 a2-7 a3-2 #x5e700200) - ) - (-> s3-3 ppointer) + (init-collision! self) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-glider-ring" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> self entity) #f) + (cond + ((-> arg0 shootable) + (ja :group! des-glider-ring-idle-ja :num! min) + (set! (-> self ring-prim) (the-as handle #f)) + ) + (else + (ja :group! des-glider-ring-expand-ja :num! max) + (let ((s3-3 (get-process *default-dead-pool* glider-prim #x4000 1))) + (set! (-> self ring-prim) + (ppointer->handle + (when s3-3 + (let ((t9-6 (method-of-type process activate))) + (t9-6 s3-3 self "prim" (the-as pointer #x70004000)) ) + (let ((t9-7 run-function-in-process) + (a0-8 s3-3) + (a1-7 simple-prim-init-by-other) + (a2-7 (-> self root trans)) + (a3-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-2 x) 32768.0) + (set! (-> a3-2 y) 32768.0) + (set! (-> a3-2 z) 32768.0) + (set! (-> a3-2 w) 1.0) + ((the-as (function object object object object object none) t9-7) a0-8 a1-7 a2-7 a3-2 #x5e700200) + ) + (-> s3-3 ppointer) ) ) + ) + ) + ) + ) + (vector-copy! (-> self root trans) (-> arg0 pos)) + (quaternion-from-two-vectors! (-> self root quat) *z-vector* (-> arg0 forw)) + (let ((v1-37 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) + (vector+*! (-> self root trans) (-> self root trans) v1-37 10240.0) + ) + (vector-copy! (-> self save-pos) (-> self root trans)) + (set! (-> self boost) (-> arg0 boost)) + (set! (-> self id) arg1) + (set! (-> self persistent) arg2) + (set! (-> self xdist) (-> arg0 xdist)) + (set! (-> self ydist) (-> arg0 ydist)) + (set! (-> self toff) (-> arg0 toff)) + (set! (-> self speedmod) (-> arg0 speedmod)) + (set! (-> self checkpoint) (-> arg0 checkpoint)) + (set! (-> self shootable) (-> arg0 shootable)) + (set! (-> self lastring) (-> arg0 lastring)) + (set! (-> self shot) #f) + (set! (-> self do-trails?) (or (!= (-> self xdist) 0.0) (!= (-> self ydist) 0.0))) + (set! (-> self center-joint) (the-as uint 2)) + (set! (-> self trail-joint 0) (the-as uint 3)) + (set! (-> self trail-joint 1) (the-as uint 5)) + (set! (-> self trail-joint 2) (the-as uint 7)) + (set! (-> self trail-joint 3) (the-as uint 9)) + (set! (-> self trail-joint 4) (the-as uint 11)) + (when (-> self do-trails?) + (let ((gp-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params))) + (set! (-> gp-1 tracked-obj) (process->handle self)) + (set! (-> gp-1 appearance) *glider-ring-trail*) + (set! (-> gp-1 max-num-crumbs) (the int (* 0.25 (the float (-> gp-1 appearance max-age))))) + (set! (-> gp-1 track-immediately?) #t) + (dotimes (s5-1 5) + (let* ((v1-64 + (estimate-light-trail-mem-usage + (the-as uint (-> gp-1 max-num-crumbs)) + (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) + ) + ) + (s4-1 (get-process *default-dead-pool* light-trail-tracker-glider-ring (+ v1-64 8192) 1)) + ) + (set! (-> self trails s5-1) + (ppointer->handle (when s4-1 + (let ((t9-12 (method-of-type process activate))) + (t9-12 s4-1 self "light-trail" (the-as pointer #x70004000)) + ) + (run-now-in-process s4-1 light-trail-tracker-init-by-other gp-1) + (-> s4-1 ppointer) + ) + ) + ) ) ) ) - (vector-copy! (-> self root trans) (-> arg0 pos)) - (quaternion-from-two-vectors! (-> self root quat) *z-vector* (-> arg0 forw)) - (let ((v1-37 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) - (a0-17 (-> self root trans)) - ) - (let ((a1-11 (-> self root trans))) - (let ((a2-10 10240.0)) - (.mov vf7 a2-10) - ) - (.lvf vf5 (&-> v1-37 quad)) - (.lvf vf4 (&-> a1-11 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-17 quad) vf6) - ) - (vector-copy! (-> self save-pos) (-> self root trans)) - (set! (-> self boost) (-> arg0 boost)) - (set! (-> self id) arg1) - (set! (-> self persistent) arg2) - (set! (-> self xdist) (-> arg0 xdist)) - (set! (-> self ydist) (-> arg0 ydist)) - (set! (-> self toff) (-> arg0 toff)) - (set! (-> self speedmod) (-> arg0 speedmod)) - (set! (-> self checkpoint) (-> arg0 checkpoint)) - (set! (-> self shootable) (-> arg0 shootable)) - (set! (-> self lastring) (-> arg0 lastring)) - (set! (-> self shot) #f) - (set! (-> self do-trails?) (or (!= (-> self xdist) 0.0) (!= (-> self ydist) 0.0))) - (set! (-> self center-joint) (the-as uint 2)) - (set! (-> self trail-joint 0) (the-as uint 3)) - (set! (-> self trail-joint 1) (the-as uint 5)) - (set! (-> self trail-joint 2) (the-as uint 7)) - (set! (-> self trail-joint 3) (the-as uint 9)) - (set! (-> self trail-joint 4) (the-as uint 11)) - (when (-> self do-trails?) - (let ((gp-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params))) - (set! (-> gp-1 tracked-obj) (process->handle self)) - (set! (-> gp-1 appearance) *glider-ring-trail*) - (set! (-> gp-1 max-num-crumbs) (the int (* 0.25 (the float (-> gp-1 appearance max-age))))) - (set! (-> gp-1 track-immediately?) #t) - (dotimes (s5-1 5) - (let* ((v1-64 - (estimate-light-trail-mem-usage - (the-as uint (-> gp-1 max-num-crumbs)) - (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) - ) - ) - (s4-1 (get-process *default-dead-pool* light-trail-tracker-glider-ring (+ v1-64 8192) 1)) - ) - (set! (-> self trails s5-1) - (ppointer->handle (when s4-1 - (let ((t9-12 (method-of-type process activate))) - (t9-12 s4-1 self "light-trail" (the-as pointer #x70004000)) - ) - (run-now-in-process s4-1 light-trail-tracker-init-by-other gp-1) - (-> s4-1 ppointer) - ) - ) - ) - ) - ) - ) - ) - (init-fields! self) - (go-virtual idle) ) + (init-fields! self) + (go-virtual idle) ) ;; WARN: Return type mismatch process vs glider-ring. diff --git a/goal_src/jak3/levels/glider/h-glider.gc b/goal_src/jak3/levels/glider/h-glider.gc index a3b359fdab..dbe6e0148f 100644 --- a/goal_src/jak3/levels/glider/h-glider.gc +++ b/goal_src/jak3/levels/glider/h-glider.gc @@ -612,250 +612,221 @@ ) (defmethod vehicle-method-97 ((this h-glider) (arg0 float) (arg1 vehicle-physics-work)) - (local-vars (v1-107 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s3-0 (-> this rbody))) - (mem-copy! (the-as pointer (-> arg1 mat)) (the-as pointer (-> s3-0 matrix)) 64) - (let* ((f28-0 (* -1.0 (-> this controls steering) (-> this info handling tire-steering-angle))) - (f30-0 (cos f28-0)) - (f0-2 (sin f28-0)) - ) - (set! (-> arg1 steering-axis x) f30-0) - (set! (-> arg1 steering-axis y) 0.0) - (set! (-> arg1 steering-axis z) f0-2) - ) - (vector-rotate*! (-> arg1 steering-axis) (-> arg1 steering-axis) (-> arg1 mat)) - (logior! (-> this v-flags) (vehicle-flag in-air)) - (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) - (vector-reset! (-> arg1 ground-normal)) - (set! (-> arg1 ground-normal y) 1.0) - (let ((f30-1 (-> this info handling ground-probe-distance))) - (let ((s2-0 (new 'stack-no-clear 'collide-query))) - (vector-reset! (-> arg1 lift-dir)) - (set! (-> arg1 lift-dir y) -1.0) - (set! (-> arg1 speed-factor) - (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) - ) - (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)) + (let ((s3-0 (-> this rbody))) + (mem-copy! (the-as pointer (-> arg1 mat)) (the-as pointer (-> s3-0 matrix)) 64) + (let* ((f28-0 (* -1.0 (-> this controls steering) (-> this info handling tire-steering-angle))) + (f30-0 (cos f28-0)) + (f0-2 (sin f28-0)) + ) + (set! (-> arg1 steering-axis x) f30-0) + (set! (-> arg1 steering-axis y) 0.0) + (set! (-> arg1 steering-axis z) f0-2) + ) + (vector-rotate*! (-> arg1 steering-axis) (-> arg1 steering-axis) (-> arg1 mat)) + (logior! (-> this v-flags) (vehicle-flag in-air)) + (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) + (vector-reset! (-> arg1 ground-normal)) + (set! (-> arg1 ground-normal y) 1.0) + (let ((f30-1 (-> this info handling ground-probe-distance))) + (let ((s2-0 (new 'stack-no-clear 'collide-query))) + (vector-reset! (-> arg1 lift-dir)) + (set! (-> arg1 lift-dir y) -1.0) + (set! (-> arg1 speed-factor) + (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) ) - (vector-normalize! (-> arg1 lift-dir) 1.0) - ) - (vector-float*! (-> s2-0 move-dist) (-> arg1 lift-dir) (the-as float f30-1)) - (let ((v1-26 s2-0)) - (set! (-> v1-26 radius) 409.6) - (set! (-> v1-26 collide-with) (collide-spec - backgnd - bot - obstacle - hit-by-player-list - hit-by-others-list - player-list - water - collectable - blocking-plane - pusher - vehicle-mesh-probeable - shield - vehicle-sphere-no-probe - ) - ) - (set! (-> v1-26 ignore-process0) #f) - (set! (-> v1-26 ignore-process1) #f) - (set! (-> v1-26 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) - (set! (-> v1-26 action-mask) (collide-action solid)) - ) - (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) - (let ((v1-29 (-> this info physics-model lift-thruster-array s1-0)) - (s0-0 (-> arg1 probe-work-array s1-0)) - ) - (vector-reset! (-> s0-0 tire-force)) - (vector-copy! (-> s0-0 local-pos) (-> v1-29 local-pos)) - (vector-copy! (-> s0-0 local-normal) (-> v1-29 rot)) - (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> arg1 mat)) - (let ((a1-9 (-> s0-0 probe-pos))) - (let ((v1-32 (-> s0-0 world-pos))) - (let ((a0-22 (-> arg1 mat uvec))) - (let ((a2-6 (-> this info handling ground-probe-offset))) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-22 quad)) - ) - (.lvf vf4 (&-> v1-32 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-9 quad) vf6) + (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)) ) - (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) - (vector-copy! (-> s0-0 wheel-axis) (the-as vector (if (< 0.0 (-> s0-0 local-pos z)) - (-> arg1 steering-axis) - (the-as vector (-> arg1 mat)) - ) - ) - ) - (vector-copy! (-> s0-0 ground-pos) (-> s0-0 probe-pos)) - (set! (-> s0-0 ground-pos y) 0.0) - (vector-reset! (-> s0-0 ground-normal)) - (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) - (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) - (let ((f0-15 (probe-using-line-sphere *collide-cache* s2-0))) - (cond - ((and (>= f0-15 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) - (logclear! (-> this v-flags) (vehicle-flag in-air)) - (logior! (-> this v-flags) (vehicle-flag on-ground)) - (set! (-> s0-0 ground-pos y) (- (-> s0-0 probe-pos y) (* f0-15 f30-1))) - (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) - (vector-copy! (-> arg1 ground-normal) (-> s0-0 ground-normal)) - ) - (else - (set! (-> s0-0 ground-pos y) (+ -81920.0 (-> s3-0 position y))) - ) + (t9-4 a0-7 a1-4 a2-3 (* f0-8 f0-8)) + ) + (vector-normalize! (-> arg1 lift-dir) 1.0) + ) + (vector-float*! (-> s2-0 move-dist) (-> arg1 lift-dir) (the-as float f30-1)) + (let ((v1-26 s2-0)) + (set! (-> v1-26 radius) 409.6) + (set! (-> v1-26 collide-with) (collide-spec + backgnd + bot + obstacle + hit-by-player-list + hit-by-others-list + player-list + water + collectable + blocking-plane + pusher + vehicle-mesh-probeable + shield + vehicle-sphere-no-probe + ) + ) + (set! (-> v1-26 ignore-process0) #f) + (set! (-> v1-26 ignore-process1) #f) + (set! (-> v1-26 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) + (set! (-> v1-26 action-mask) (collide-action solid)) + ) + (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) + (let ((v1-29 (-> this info physics-model lift-thruster-array s1-0)) + (s0-0 (-> arg1 probe-work-array s1-0)) + ) + (vector-reset! (-> s0-0 tire-force)) + (vector-copy! (-> s0-0 local-pos) (-> v1-29 local-pos)) + (vector-copy! (-> s0-0 local-normal) (-> v1-29 rot)) + (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> arg1 mat)) + (vector+*! + (-> s0-0 probe-pos) + (-> s0-0 world-pos) + (-> arg1 mat uvec) + (the-as float (-> this info handling ground-probe-offset)) + ) + (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) + (vector-copy! (-> s0-0 wheel-axis) (the-as vector (if (< 0.0 (-> s0-0 local-pos z)) + (-> arg1 steering-axis) + (the-as vector (-> arg1 mat)) + ) + ) + ) + (vector-copy! (-> s0-0 ground-pos) (-> s0-0 probe-pos)) + (set! (-> s0-0 ground-pos y) 0.0) + (vector-reset! (-> s0-0 ground-normal)) + (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) + (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) + (let ((f0-15 (probe-using-line-sphere *collide-cache* s2-0))) + (cond + ((and (>= f0-15 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) + (logclear! (-> this v-flags) (vehicle-flag in-air)) + (logior! (-> this v-flags) (vehicle-flag on-ground)) + (set! (-> s0-0 ground-pos y) (- (-> s0-0 probe-pos y) (* f0-15 f30-1))) + (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) + (vector-copy! (-> arg1 ground-normal) (-> s0-0 ground-normal)) + ) + (else + (set! (-> s0-0 ground-pos y) (+ -81920.0 (-> s3-0 position y))) ) ) - 0 ) + 0 ) ) ) - (set! (-> this lift-thrust 0) 0.0) - (set! (-> this lift-thrust 1) 0.0) - (set! (-> this lift-thrust 2) 0.0) - (set! (-> this lift-thrust 3) 0.0) - (set! (-> this roll-thrust 0) 0.0) - (set! (-> this roll-thrust 1) 0.0) - (when (>= 1 (-> this force-level)) - (dotimes (s2-1 (-> this info physics-model lift-thruster-count)) - (let ((s1-1 (-> arg1 probe-work-array s2-1))) - (vector-copy! (-> arg1 world-pos) (-> s1-1 world-pos)) - (vector-copy! (-> arg1 velocity) (-> s1-1 velocity)) - (let* ((f1-12 (fmax 4096.0 (fmin (- (-> s1-1 probe-pos y) (-> s1-1 ground-pos y)) f30-1))) - (f28-1 (- 1.0 (/ (+ -4096.0 f1-12) (+ -4096.0 f30-1)))) - ) - (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s1-1 ground-normal) (-> arg1 mat uvec))) - (set! f28-1 0.0) + ) + (set! (-> this lift-thrust 0) 0.0) + (set! (-> this lift-thrust 1) 0.0) + (set! (-> this lift-thrust 2) 0.0) + (set! (-> this lift-thrust 3) 0.0) + (set! (-> this roll-thrust 0) 0.0) + (set! (-> this roll-thrust 1) 0.0) + (when (>= 1 (-> this force-level)) + (dotimes (s2-1 (-> this info physics-model lift-thruster-count)) + (let ((s1-1 (-> arg1 probe-work-array s2-1))) + (vector-copy! (-> arg1 world-pos) (-> s1-1 world-pos)) + (vector-copy! (-> arg1 velocity) (-> s1-1 velocity)) + (let* ((f1-12 (fmax 4096.0 (fmin (- (-> s1-1 probe-pos y) (-> s1-1 ground-pos y)) f30-1))) + (f28-1 (- 1.0 (/ (+ -4096.0 f1-12) (+ -4096.0 f30-1)))) + ) + (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s1-1 ground-normal) (-> arg1 mat uvec))) + (set! f28-1 0.0) + ) + (set! (-> arg1 tmp y) 0.0) + (set! (-> arg1 tmp x) (-> arg1 velocity z)) + (set! (-> arg1 tmp z) (- (-> arg1 velocity x))) + (vector-normalize! (-> arg1 tmp) 1.0) + (vector+float*! + (-> arg1 normal) + (-> s1-1 ground-normal) + (-> arg1 tmp) + (- (vector-dot (-> s1-1 ground-normal) (-> arg1 tmp))) + ) + (let ((v1-80 (-> arg1 force)) + (a0-45 (-> arg1 normal)) + (f0-37 (* 2.0 f28-1)) + (f1-17 arg0) ) - (set! (-> arg1 tmp y) 0.0) - (set! (-> arg1 tmp x) (-> arg1 velocity z)) - (set! (-> arg1 tmp z) (- (-> arg1 velocity x))) - (vector-normalize! (-> arg1 tmp) 1.0) - (vector+float*! - (-> arg1 normal) - (-> s1-1 ground-normal) - (-> arg1 tmp) - (- (vector-dot (-> s1-1 ground-normal) (-> arg1 tmp))) - ) - (let ((v1-80 (-> arg1 force)) - (a0-45 (-> arg1 normal)) - (f0-37 (* 2.0 f28-1)) - (f1-17 arg0) - ) - (vector-float*! v1-80 a0-45 (* f0-37 - (/ 1.0 f1-17) - (-> this info physics-model inv-lift-thruster-count) - (-> this info info mass) - (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> arg1 normal)))) - ) - ) - ) - (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) - (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) - (let ((f0-51 (* 8.0 - (-> this info info mass) - (-> this info extra gravity) - (-> this info physics-model inv-lift-thruster-count) - (+ (* (-> this info handling spring-lift-factor) f28-1) - (* 0.75 (-> this jump-thrust) (-> this info handling jump-thrust-factor)) - ) - (- (+ 1.0 (* 2.0 (rand-vu) (-> this power-fluctuation-factor))) (-> this power-fluctuation-factor)) + (vector-float*! v1-80 a0-45 (* f0-37 + (/ 1.0 f1-17) + (-> this info physics-model inv-lift-thruster-count) + (-> this info info mass) + (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> arg1 normal)))) + ) ) - ) - ) - (+! (-> this lift-thrust s2-1) f0-51) - (vector-float*! (-> arg1 force) (-> arg1 lift-dir) (* -1.0 f0-51)) - ) ) (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) - (when (and (< 0.0 (-> this info handling tire-friction-factor)) (let ((f0-54 0.0)) - (.lvf vf1 (&-> (-> s1-1 ground-normal) 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-107 vf1) - (< f0-54 v1-107) - ) - ) - (vector+float*! - (-> arg1 normal) - (-> s1-1 wheel-axis) - (-> s1-1 ground-normal) - (- (vector-dot (-> s1-1 wheel-axis) (-> s1-1 ground-normal))) - ) - (vector-normalize! (-> arg1 normal) 1.0) - (vector-copy! (-> arg1 world-pos) (-> s3-0 position)) - (vector-copy! (-> arg1 velocity) (-> s3-0 lin-velocity)) - (vector-! (-> arg1 p-body) (-> arg1 world-pos) (-> s3-0 position)) - (vector-cross! (-> arg1 tmp) (-> arg1 p-body) (-> arg1 normal)) - (vector-rotate*! (-> arg1 tmp) (-> arg1 tmp) (-> s3-0 inv-i-world)) - (vector-cross! (-> arg1 tmp) (-> arg1 tmp) (-> arg1 p-body)) - (set! (-> arg1 vel-dot-norm) (vector-dot (-> arg1 velocity) (-> arg1 normal))) - (let ((f0-61 (fabs (-> arg1 vel-dot-norm)))) - (set! (-> arg1 friction-coef) - (smooth-interp - (-> this info handling tire-static-friction) - (-> this info handling tire-dynamic-friction) - f0-61 - (-> this info handling tire-static-friction-speed) - (-> this info handling tire-dynamic-friction-speed) - ) - ) - ) - (set! (-> arg1 friction-coef) - (* (-> arg1 friction-coef) (+ 1.0 (* -0.75 (fmax 0.0 (fmin 1.0 (-> this engine-thrust)))))) - ) - (let ((f0-69 (* (-> arg1 friction-coef) - (-> this info handling tire-friction-factor) - (fmax 0.0 (vector-dot (-> s1-1 ground-normal) (-> s1-1 tire-force))) - ) - ) - ) - (set! (-> arg1 impulse) (/ (* -1.0 (-> arg1 vel-dot-norm)) - (* arg0 (+ (-> s3-0 info inv-mass) (vector-dot (-> arg1 normal) (-> arg1 tmp)))) - ) - ) - (set! (-> arg1 impulse) (fmax (fmin (-> arg1 impulse) f0-69) (- f0-69))) - ) - (vector-float*! (-> arg1 force) (-> arg1 normal) (-> arg1 impulse)) - (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + (let ((f0-51 (* 8.0 + (-> this info info mass) + (-> this info extra gravity) + (-> this info physics-model inv-lift-thruster-count) + (+ (* (-> this info handling spring-lift-factor) f28-1) + (* 0.75 (-> this jump-thrust) (-> this info handling jump-thrust-factor)) + ) + (- (+ 1.0 (* 2.0 (rand-vu) (-> this power-fluctuation-factor))) (-> this power-fluctuation-factor)) + ) + ) + ) + (+! (-> this lift-thrust s2-1) f0-51) + (vector-float*! (-> arg1 force) (-> arg1 lift-dir) (* -1.0 f0-51)) ) ) + (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) + (when (and (< 0.0 (-> this info handling tire-friction-factor)) + (< 0.0 (vector-length-squared (-> s1-1 ground-normal))) + ) + (vector+float*! + (-> arg1 normal) + (-> s1-1 wheel-axis) + (-> s1-1 ground-normal) + (- (vector-dot (-> s1-1 wheel-axis) (-> s1-1 ground-normal))) + ) + (vector-normalize! (-> arg1 normal) 1.0) + (vector-copy! (-> arg1 world-pos) (-> s3-0 position)) + (vector-copy! (-> arg1 velocity) (-> s3-0 lin-velocity)) + (vector-! (-> arg1 p-body) (-> arg1 world-pos) (-> s3-0 position)) + (vector-cross! (-> arg1 tmp) (-> arg1 p-body) (-> arg1 normal)) + (vector-rotate*! (-> arg1 tmp) (-> arg1 tmp) (-> s3-0 inv-i-world)) + (vector-cross! (-> arg1 tmp) (-> arg1 tmp) (-> arg1 p-body)) + (set! (-> arg1 vel-dot-norm) (vector-dot (-> arg1 velocity) (-> arg1 normal))) + (let ((f0-61 (fabs (-> arg1 vel-dot-norm)))) + (set! (-> arg1 friction-coef) + (smooth-interp + (-> this info handling tire-static-friction) + (-> this info handling tire-dynamic-friction) + f0-61 + (-> this info handling tire-static-friction-speed) + (-> this info handling tire-dynamic-friction-speed) + ) + ) + ) + (set! (-> arg1 friction-coef) + (* (-> arg1 friction-coef) (+ 1.0 (* -0.75 (fmax 0.0 (fmin 1.0 (-> this engine-thrust)))))) + ) + (let ((f0-69 (* (-> arg1 friction-coef) + (-> this info handling tire-friction-factor) + (fmax 0.0 (vector-dot (-> s1-1 ground-normal) (-> s1-1 tire-force))) + ) + ) + ) + (set! (-> arg1 impulse) (/ (* -1.0 (-> arg1 vel-dot-norm)) + (* arg0 (+ (-> s3-0 info inv-mass) (vector-dot (-> arg1 normal) (-> arg1 tmp)))) + ) + ) + (set! (-> arg1 impulse) (fmax (fmin (-> arg1 impulse) f0-69) (- f0-69))) + ) + (vector-float*! (-> arg1 force) (-> arg1 normal) (-> arg1 impulse)) + (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod h-glider-method-162 ((this h-glider)) @@ -880,408 +851,382 @@ ) (defmethod apply-gravity! ((this h-glider) (arg0 float)) - (local-vars (v1-15 float) (v1-267 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (h-glider-method-162 this) - (set! (-> *game-info* health-bar-vehicle) - (fmax 0.0 (fmin 1.0 (* 0.0000032552084 (+ -49152.0 (-> this speed))))) - ) - (if (-> this lost-lift?) - (set! (-> *game-info* health-bar-vehicle) 0.0) + (h-glider-method-162 this) + (set! (-> *game-info* health-bar-vehicle) + (fmax 0.0 (fmin 1.0 (* 0.0000032552084 (+ -49152.0 (-> this speed))))) ) - (let ((s3-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (when (and (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (begin - (.lvf vf1 (&-> (-> this rbody lin-momentum) 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) - (= v1-15 0.0) - ) - ) - (vector-copy! (-> this rbody lin-momentum) (-> this rbody matrix fvec)) - (vector-normalize! - (-> this rbody lin-momentum) - (if (task-node-closed? (game-task-node desert-glide-templetop)) - 153600.0 - 101376.01 - ) - ) - (vector-float*! (-> this rbody lin-momentum) (-> this rbody lin-momentum) (-> this rbody info mass)) + (if (-> this lost-lift?) + (set! (-> *game-info* health-bar-vehicle) 0.0) + ) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) ) - (when (and (logtest? (-> this v-flags) (vehicle-flag dead)) (not (-> this deathspin))) - (set! (-> this rbody info angular-damping) 1.0) - (set! (-> this hit-points) -1.0) - (logior! (-> this v-flags) (vehicle-flag dead)) - (set! (-> this deathspin) #t) - (set-vector! s3-0 4096.0 0.0 0.0 1.0) + (when (and (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (= (vector-length-squared (-> this rbody lin-momentum)) 0.0) + ) + (vector-copy! (-> this rbody lin-momentum) (-> this rbody matrix fvec)) + (vector-normalize! + (-> this rbody lin-momentum) + (if (task-node-closed? (game-task-node desert-glide-templetop)) + 153600.0 + 101376.01 + ) + ) + (vector-float*! (-> this rbody lin-momentum) (-> this rbody lin-momentum) (-> this rbody info mass)) + ) + (when (and (logtest? (-> this v-flags) (vehicle-flag dead)) (not (-> this deathspin))) + (set! (-> this rbody info angular-damping) 1.0) + (set! (-> this hit-points) -1.0) + (logior! (-> this v-flags) (vehicle-flag dead)) + (set! (-> this deathspin) #t) + (set-vector! s3-0 4096.0 0.0 0.0 1.0) + (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) + (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) + (vector-float*! s4-0 (-> this rbody matrix uvec) (* 4096.0 (rand-vu-float-range -40000.0 40000.0))) + (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) + ) + (let ((s2-3 (new 'stack-no-clear 'vehicle-physics-work))) + (when (and (< 0.0 (-> this rbody matrix uvec y)) (logtest? (-> this v-flags) (vehicle-flag riding))) + (matrix-transpose! (-> s2-3 mat) (-> this rbody matrix)) + (set! (-> s2-3 velocity x) (* 0.0000073242186 (-> this speed) (-> this controls steering))) + (vector-reset! s3-0) (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) - (vector-float*! s4-0 (-> this rbody matrix uvec) (* 4096.0 (rand-vu-float-range -40000.0 40000.0))) + (+! (-> s3-0 z) 4096.0) + (vector-copy! (-> s2-3 force) *x-vector*) + (let ((f0-20 (* 0.00024414062 (vector-length (-> this rbody lin-velocity))))) + (set! (-> s2-3 velocity z) (/ 1.0 f0-20)) + ) + (set! (-> s2-3 velocity z) (fmin 0.1 (-> s2-3 velocity z))) + (set! (-> s2-3 velocity z) (* 24576000.0 (-> s2-3 velocity z) (-> s2-3 velocity x))) + (vector-float*! s4-0 (-> s2-3 force) (-> s2-3 velocity z)) (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) ) - (let ((s2-3 (new 'stack-no-clear 'vehicle-physics-work))) - (when (and (< 0.0 (-> this rbody matrix uvec y)) (logtest? (-> this v-flags) (vehicle-flag riding))) - (matrix-transpose! (-> s2-3 mat) (-> this rbody matrix)) - (set! (-> s2-3 velocity x) (* 0.0000073242186 (-> this speed) (-> this controls steering))) - (vector-reset! s3-0) - (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) - (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) - (+! (-> s3-0 z) 4096.0) - (vector-copy! (-> s2-3 force) *x-vector*) - (let ((f0-20 (* 0.00024414062 (vector-length (-> this rbody lin-velocity))))) - (set! (-> s2-3 velocity z) (/ 1.0 f0-20)) - ) - (set! (-> s2-3 velocity z) (fmin 0.1 (-> s2-3 velocity z))) - (set! (-> s2-3 velocity z) (* 24576000.0 (-> s2-3 velocity z) (-> s2-3 velocity x))) - (vector-float*! s4-0 (-> s2-3 force) (-> s2-3 velocity z)) - (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) - ) - (when #f - (let ((f0-29 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 1.0))) - (set! (-> this rolling) #f) - (when (!= f0-29 0.0) - (set! (-> this rolling) #t) - (vector-float*! s4-0 (-> this rbody matrix uvec) (* 4096000.0 f0-29)) - (set-vector! s3-0 4096.0 0.0 0.0 1.0) - (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) - (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) - (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) - ) - ) - ) - 0.0 - 0.0 - (let ((f1-14 (-> this speed))) - (set! (-> s2-3 velocity z) (-> this controls steering)) - (let ((f30-1 (fmax 0.0 (fmin 1.0 (* 0.000012207031 (+ -20480.0 f1-14)))))) - (when (and (< 0.2 (fabs (* f30-1 (-> s2-3 velocity z)))) (time-elapsed? (-> this pitch-side-time) (seconds 2))) - (set-time! (-> this pitch-side-time)) - (sound-play "pitch-horizontl") - ) - (matrix-rotate-z! (-> s2-3 mat) (* 16384.0 (-> s2-3 velocity z) f30-1)) - ) - ) - (matrix*! (-> s2-3 mat) (-> s2-3 mat) (-> this rbody matrix)) - (set! (-> s2-3 velocity x) (- (-> s2-3 mat rvec y))) - (set! (-> s2-3 velocity y) (- (-> s2-3 velocity x) (-> this rollerr))) - (set! (-> this rollerr) (-> s2-3 velocity x)) - (let ((f30-2 (+ (* 24576000.0 (-> s2-3 velocity y)) (* 409600.0 (-> s2-3 velocity x))))) - (set-vector! s3-0 4096.0 0.0 0.0 1.0) - 0.0 - (let ((s1-3 (new 'stack-no-clear 'matrix))) - (let ((f0-56 (* 16384.0 (fmax -1.0 (fmin 1.0 (* (/ (-> this rbody ang-velocity y) (meters 200000)) (fabs f30-2)))))) - ) - (matrix-rotate-y! s1-3 f0-56) - ) - (vector-rotate*! s3-0 s3-0 s1-3) - ) - (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) - (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) - (vector-float*! s4-0 (-> this rbody matrix uvec) f30-2) - ) - (if (and (>= 1 (-> this force-level)) (not (-> this rolling))) + (when #f + (let ((f0-29 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 1.0))) + (set! (-> this rolling) #f) + (when (!= f0-29 0.0) + (set! (-> this rolling) #t) + (vector-float*! s4-0 (-> this rbody matrix uvec) (* 4096000.0 f0-29)) + (set-vector! s3-0 4096.0 0.0 0.0 1.0) + (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) + (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) ) - (if (>= (-> this force-level) 1) - (set! (-> this curalt) (-> this rbody matrix trans y)) - ) - (when #t - (set! (-> this speed) (vector-dot (-> this rbody lin-velocity) (-> this rbody matrix fvec))) - 0.0 - (let* ((v1-124 (-> this rbody lin-velocity)) - (f28-0 (sqrtf (+ (* (-> v1-124 x) (-> v1-124 x)) (* (-> v1-124 z) (-> v1-124 z))))) - (f30-3 (fmax 0.0 (fmin 1.0 (* 0.000030517578 (+ -4096.0 f28-0))))) - ) - (let ((t9-20 atan) - (a0-53 (-> this rbody lin-velocity y)) - (v1-131 (-> this rbody lin-velocity)) - ) - (set! (-> s2-3 velocity x) - (* f30-3 (t9-20 a0-53 (sqrtf (+ (* (-> v1-131 x) (-> v1-131 x)) (* (-> v1-131 z) (-> v1-131 z)))))) - ) - ) - (if (< 15473.777 (-> s2-3 velocity x)) - (set! (-> s2-3 velocity x) 15473.777) - ) - (if (< (-> s2-3 velocity x) -15473.777) - (set! (-> s2-3 velocity x) -15473.777) - ) - (cond - ((< (vector-dot (-> this rbody matrix fvec) (-> this rbody lin-velocity)) -16384.0) - (set! (-> s2-3 velocity x) (- (-> s2-3 velocity x))) - (set! (-> this curalt) - (- (-> this curalt) - (* (-> this controls lean-z) (+ (* -8192.0 (seconds-per-frame)) (* -0.1 (seconds-per-frame) f28-0))) - ) - ) - ) - (else - (+! (-> this curalt) - (* (-> this controls lean-z) (+ (* -8192.0 (seconds-per-frame)) (* -0.1 (seconds-per-frame) f28-0))) - ) - ) - ) - (when #f - (set-vector! - s4-0 - 0.0 - (* 40.96 (-> this info info mass) (- 1.0 f30-3) (- (-> this curalt) (-> this rbody matrix trans y))) - 0.0 - 1.0 - ) - (add-force! (-> this rbody) s4-0) - ) - ) - (if (< (-> this maxalt) (-> this curalt)) - (set! (-> this curalt) (-> this maxalt)) - ) - (if (< (-> this curalt) (-> this minalt)) - (set! (-> this curalt) (-> this minalt)) - ) - (matrix-rotate-x! (-> s2-3 mat) (-> s2-3 velocity x)) - (matrix*! (-> s2-3 mat) (-> s2-3 mat) (-> this rbody matrix)) - (set! (-> s2-3 velocity x) (-> s2-3 mat fvec y)) - (set! (-> s2-3 velocity y) (- (-> s2-3 velocity x) (-> this pitcherr))) - (set! (-> this pitcherr) (-> s2-3 velocity x)) - (set-vector! s3-0 0.0 0.0 4096.0 1.0) - (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) - (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) - (vector-float*! - s4-0 - (-> this rbody matrix uvec) - (- (+ (* 196608000.0 (-> s2-3 velocity y)) (* 1638400.0 (-> s2-3 velocity x)))) - ) - (if (and (not (-> this rolling)) - (or (logtest? (-> this v-flags) (vehicle-flag dead)) (>= 1 (-> this force-level))) - (>= (-> this speed) 0.0) - ) - (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) - ) ) ) - (when (< (-> this maxalt) (-> this rbody matrix trans y)) - (vector-float*! s4-0 *up-vector* (* -2000.0 (- (-> this rbody matrix trans y) (-> this maxalt)))) - (add-force! (-> this rbody) s4-0) - ) - (when (and (< (-> this rbody matrix trans y) (-> this minalt)) - (not (logtest? (-> this v-flags) (vehicle-flag dead))) - ) - (when (< (-> this speed) 0.0) - (set! (-> this hit-points) -1.0) - (logior! (-> this v-flags) (vehicle-flag dead)) - ) - (vector-float*! s4-0 *up-vector* (* -2000.0 (- (-> this rbody matrix trans y) (-> this minalt)))) - (add-force! (-> this rbody) s4-0) - ) - (let ((f0-118 (-> this speed))) - (-> this controls throttle) - (-> this controls brake) - 0.0 - 0.0 - (let* ((f1-66 0.0) - (f2-20 0.0) - (f4-8 (* 0.000024414063 (+ -4096.0 f0-118))) - (f4-10 (fmax 0.0 (fmin 1.0 f4-8))) - (f1-68 (* 819200.0 (- f1-66 (* 4.0 f4-10 f2-20)))) - ) - (if (and (< 307200.0 f0-118) (< 0.0 f1-68)) - (set! f1-68 0.0) - ) - (when (< f0-118 307200.0) - (if (not (time-elapsed? (-> this in-thermal-time) (seconds 1))) - (set! f1-68 (* 44.85294 (- 307200.0 f0-118))) - ) - ) - (if (and (-> this full-speed-boost?) (or (>= f0-118 307200.0) (>= f0-118 286720.0))) - (set! (-> this full-speed-boost?) #f) - ) - (if (and (-> this full-speed-boost?) (< f0-118 307200.0)) - (set! f1-68 4096000.0) - ) - (vector-float*! s4-0 (-> this rbody matrix fvec) f1-68) - ) - ) - (if (and (logtest? (-> this v-flags) (vehicle-flag riding)) - (not (logtest? (-> this v-flags) (vehicle-flag dead))) - ) - (add-force! (-> this rbody) s4-0) - ) - (vector-float*! s4-0 (-> this rbody lin-velocity) (- (-> this info handling drag-force-factor))) - (add-force! (-> this rbody) s4-0) - (let ((s3-1 (new 'stack-no-clear 'vector))) - 0.0 - (let ((f30-4 (glider-impact-reduction (the-as time-frame (-> this impact-time))))) - (vector-copy! s3-1 (-> this rbody matrix rvec)) - (set! (-> s3-1 y) 0.0000000001) - (vector-normalize! s3-1 1.0) - (vector-float*! - s4-0 - (-> this rbody matrix rvec) - (* -512.0 (vector-dot (-> this rbody lin-velocity) s3-1) f30-4) - ) - ) - ) - (set! (-> s4-0 y) 0.0) - (if (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (add-force! (-> this rbody) s4-0) - ) - (when (not (-> this amb-sound-playing)) - (set! (-> this amb-sound-playing) #t) - (sound-play "ambient-loop" :id (-> this amb-sound)) - ) - (when (time-elapsed? (-> this ambient-wind-sound-time) (the int (* 300.0 (rand-vu-float-range 3.0 5.0)))) - (set-time! (-> this ambient-wind-sound-time)) - (sound-play-by-name - (static-sound-name "windgusts") - (new-sound-id) - 1024 - (the int (* 1524.0 (rand-vu-float-range 0.8 1.2))) - 0 - (sound-group) - #t - ) - ) - (let ((f0-133 0.0)) - (.lvf vf1 (&-> (-> this progression-plane) 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-267 vf1) - (if (and (< f0-133 v1-267) - (< (vector-dot (-> this progression-plane) (-> this root trans)) (+ -4096.0 (-> this progression-plane w))) - ) - (desert-glide-task-done) - ) - ) - (vector-reset! s4-0) 0.0 - (let ((f0-137 (-> this controls lean-z))) - (when (-> this in-thermal) - (let ((f0-139 (* -1.0 (-> this thermal-strength)))) - (set! f0-137 (fmax -1.0 (fmin 1.0 f0-139))) + 0.0 + (let ((f1-14 (-> this speed))) + (set! (-> s2-3 velocity z) (-> this controls steering)) + (let ((f30-1 (fmax 0.0 (fmin 1.0 (* 0.000012207031 (+ -20480.0 f1-14)))))) + (when (and (< 0.2 (fabs (* f30-1 (-> s2-3 velocity z)))) (time-elapsed? (-> this pitch-side-time) (seconds 2))) + (set-time! (-> this pitch-side-time)) + (sound-play "pitch-horizontl") ) + (matrix-rotate-z! (-> s2-3 mat) (* 16384.0 (-> s2-3 velocity z) f30-1)) ) - (when (-> this lost-lift?) - (if (time-elapsed? (-> this lost-lift-time) (seconds 3)) - (desert-glide-task-done) - ) - (set! f0-137 1.0) + ) + (matrix*! (-> s2-3 mat) (-> s2-3 mat) (-> this rbody matrix)) + (set! (-> s2-3 velocity x) (- (-> s2-3 mat rvec y))) + (set! (-> s2-3 velocity y) (- (-> s2-3 velocity x) (-> this rollerr))) + (set! (-> this rollerr) (-> s2-3 velocity x)) + (let ((f30-2 (+ (* 24576000.0 (-> s2-3 velocity y)) (* 409600.0 (-> s2-3 velocity x))))) + (set-vector! s3-0 4096.0 0.0 0.0 1.0) + 0.0 + (let ((s1-3 (new 'stack-no-clear 'matrix))) + (let ((f0-56 (* 16384.0 (fmax -1.0 (fmin 1.0 (* (/ (-> this rbody ang-velocity y) (meters 200000)) (fabs f30-2)))))) + ) + (matrix-rotate-y! s1-3 f0-56) + ) + (vector-rotate*! s3-0 s3-0 s1-3) ) - (if (-> this in-thermal) - (set-time! (-> this in-thermal-time)) - ) - (if (and (< 32768.0 (-> this speed)) (or (-> this in-thermal) - (not (time-elapsed? (-> this in-thermal-time) (seconds 4))) - (-> this full-speed-boost?) - (logtest? (vehicle-flag turbo-boost) (-> this v-flags)) - ) - ) - (set! (-> this lost-lift?) #f) - ) - (let ((f1-80 (* -20.0 f0-137 (fabs (-> this speed))))) - (if (and (not (-> this in-thermal)) (< (-> this speed) 32768.0) (< f0-137 0.0)) - (set! f1-80 (* 0.00024414062 (+ -28672.0 (-> this speed)) f1-80)) - ) - (when (and (not (-> this lost-lift?)) (and (< (-> this speed) 49152.0) (time-elapsed? (-> this birth) (seconds 4)))) - (set! (-> this lost-lift?) #t) - (set-time! (-> this lost-lift-time)) - ) - (cond - ((< 0.0 f0-137) - (set! (-> s4-0 y) (+ (* -20.0 (-> this rbody lin-velocity y)) f1-80)) - (when (and (< 0.7 f0-137) (time-elapsed? (-> this pitch-down-time) (seconds 2))) - (set-time! (-> this pitch-down-time)) - (sound-play "pitchglider") + (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) + (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) + (vector-float*! s4-0 (-> this rbody matrix uvec) f30-2) + ) + (if (and (>= 1 (-> this force-level)) (not (-> this rolling))) + (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) + ) + (if (>= (-> this force-level) 1) + (set! (-> this curalt) (-> this rbody matrix trans y)) + ) + (when #t + (set! (-> this speed) (vector-dot (-> this rbody lin-velocity) (-> this rbody matrix fvec))) + 0.0 + (let* ((v1-124 (-> this rbody lin-velocity)) + (f28-0 (sqrtf (+ (* (-> v1-124 x) (-> v1-124 x)) (* (-> v1-124 z) (-> v1-124 z))))) + (f30-3 (fmax 0.0 (fmin 1.0 (* 0.000030517578 (+ -4096.0 f28-0))))) ) + (let ((t9-20 atan) + (a0-53 (-> this rbody lin-velocity y)) + (v1-131 (-> this rbody lin-velocity)) + ) + (set! (-> s2-3 velocity x) + (* f30-3 (t9-20 a0-53 (sqrtf (+ (* (-> v1-131 x) (-> v1-131 x)) (* (-> v1-131 z) (-> v1-131 z)))))) + ) + ) + (if (< 15473.777 (-> s2-3 velocity x)) + (set! (-> s2-3 velocity x) 15473.777) + ) + (if (< (-> s2-3 velocity x) -15473.777) + (set! (-> s2-3 velocity x) -15473.777) + ) + (cond + ((< (vector-dot (-> this rbody matrix fvec) (-> this rbody lin-velocity)) -16384.0) + (set! (-> s2-3 velocity x) (- (-> s2-3 velocity x))) + (set! (-> this curalt) + (- (-> this curalt) + (* (-> this controls lean-z) (+ (* -8192.0 (seconds-per-frame)) (* -0.1 (seconds-per-frame) f28-0))) + ) + ) ) (else - (set! (-> s4-0 y) (+ (* -20.0 (-> this rbody lin-velocity y)) f1-80)) - ) - ) - ) - ) - (when #t - (let ((s3-5 (new 'stack-no-clear 'vector)) - (s2-6 (new 'stack-no-clear 'vector)) - (f28-1 0.0) - ) - 0.0 - (let ((f30-7 (the-as float (-> this info extra gravity)))) - (when (-> this in-thermal) - (when (time-elapsed? (-> this thermal-sound-time) (seconds 3)) - (set-time! (-> this thermal-sound-time)) - (sound-play "thermal") - ) - (set! f30-7 0.0) - (when (< (-> this speed) 32768.0) - (let* ((f0-148 (* 0.00024414062 (+ -28672.0 (-> this speed)) f28-1)) - (f1-88 (* (+ -1.0 f0-148) (-> this info extra gravity))) - ) - (set! f30-7 - (+ (-> this info extra gravity) (* (-> this thermal-strength) (- f1-88 (-> this info extra gravity)))) - ) + (+! (-> this curalt) + (* (-> this controls lean-z) (+ (* -8192.0 (seconds-per-frame)) (* -0.1 (seconds-per-frame) f28-0))) ) - ) ) - (when (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (vector-copy! s3-5 (-> this rbody lin-velocity)) - (vector-normalize! s3-5 1.0) - (let ((f0-152 (vector-dot s3-5 s4-0))) - (vector-float*! s2-6 s3-5 f0-152) - ) - (vector-! s4-0 s4-0 s2-6) - (add-force! (-> this rbody) s4-0) - (vector-copy! s3-5 (-> this rbody matrix fvec)) - (vector-normalize! s3-5 1.0) - (vector-float*! s4-0 *up-vector* (* -1.0 (-> this info info mass) f30-7)) - (let ((f0-157 (vector-dot s3-5 s4-0))) - (vector-float*! s4-0 s3-5 f0-157) - ) - (add-force! (-> this rbody) s4-0) - (vector-copy! s3-5 (-> this rbody matrix uvec)) - (vector-normalize! s3-5 1.0) - (vector-float*! s4-0 *up-vector* (* -0.12 (-> this info info mass) f30-7)) - (let ((f0-162 (vector-dot s3-5 s4-0))) - (vector-float*! s4-0 s3-5 f0-162) - ) - (add-force! (-> this rbody) s4-0) + ) + (when #f + (set-vector! + s4-0 + 0.0 + (* 40.96 (-> this info info mass) (- 1.0 f30-3) (- (-> this curalt) (-> this rbody matrix trans y))) + 0.0 + 1.0 ) + (add-force! (-> this rbody) s4-0) + ) + ) + (if (< (-> this maxalt) (-> this curalt)) + (set! (-> this curalt) (-> this maxalt)) + ) + (if (< (-> this curalt) (-> this minalt)) + (set! (-> this curalt) (-> this minalt)) + ) + (matrix-rotate-x! (-> s2-3 mat) (-> s2-3 velocity x)) + (matrix*! (-> s2-3 mat) (-> s2-3 mat) (-> this rbody matrix)) + (set! (-> s2-3 velocity x) (-> s2-3 mat fvec y)) + (set! (-> s2-3 velocity y) (- (-> s2-3 velocity x) (-> this pitcherr))) + (set! (-> this pitcherr) (-> s2-3 velocity x)) + (set-vector! s3-0 0.0 0.0 4096.0 1.0) + (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) + (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) + (vector-float*! + s4-0 + (-> this rbody matrix uvec) + (- (+ (* 196608000.0 (-> s2-3 velocity y)) (* 1638400.0 (-> s2-3 velocity x)))) + ) + (if (and (not (-> this rolling)) + (or (logtest? (-> this v-flags) (vehicle-flag dead)) (>= 1 (-> this force-level))) + (>= (-> this speed) 0.0) + ) + (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) + ) + ) + ) + (when (< (-> this maxalt) (-> this rbody matrix trans y)) + (vector-float*! s4-0 *up-vector* (* -2000.0 (- (-> this rbody matrix trans y) (-> this maxalt)))) + (add-force! (-> this rbody) s4-0) + ) + (when (and (< (-> this rbody matrix trans y) (-> this minalt)) + (not (logtest? (-> this v-flags) (vehicle-flag dead))) + ) + (when (< (-> this speed) 0.0) + (set! (-> this hit-points) -1.0) + (logior! (-> this v-flags) (vehicle-flag dead)) + ) + (vector-float*! s4-0 *up-vector* (* -2000.0 (- (-> this rbody matrix trans y) (-> this minalt)))) + (add-force! (-> this rbody) s4-0) + ) + (let ((f0-118 (-> this speed))) + (-> this controls throttle) + (-> this controls brake) + 0.0 + 0.0 + (let* ((f1-66 0.0) + (f2-20 0.0) + (f4-8 (* 0.000024414063 (+ -4096.0 f0-118))) + (f4-10 (fmax 0.0 (fmin 1.0 f4-8))) + (f1-68 (* 819200.0 (- f1-66 (* 4.0 f4-10 f2-20)))) + ) + (if (and (< 307200.0 f0-118) (< 0.0 f1-68)) + (set! f1-68 0.0) + ) + (when (< f0-118 307200.0) + (if (not (time-elapsed? (-> this in-thermal-time) (seconds 1))) + (set! f1-68 (* 44.85294 (- 307200.0 f0-118))) + ) + ) + (if (and (-> this full-speed-boost?) (or (>= f0-118 307200.0) (>= f0-118 286720.0))) + (set! (-> this full-speed-boost?) #f) + ) + (if (and (-> this full-speed-boost?) (< f0-118 307200.0)) + (set! f1-68 4096000.0) + ) + (vector-float*! s4-0 (-> this rbody matrix fvec) f1-68) + ) + ) + (if (and (logtest? (-> this v-flags) (vehicle-flag riding)) + (not (logtest? (-> this v-flags) (vehicle-flag dead))) + ) + (add-force! (-> this rbody) s4-0) + ) + (vector-float*! s4-0 (-> this rbody lin-velocity) (- (-> this info handling drag-force-factor))) + (add-force! (-> this rbody) s4-0) + (let ((s3-1 (new 'stack-no-clear 'vector))) + 0.0 + (let ((f30-4 (glider-impact-reduction (the-as time-frame (-> this impact-time))))) + (vector-copy! s3-1 (-> this rbody matrix rvec)) + (set! (-> s3-1 y) 0.0000000001) + (vector-normalize! s3-1 1.0) + (vector-float*! + s4-0 + (-> this rbody matrix rvec) + (* -512.0 (vector-dot (-> this rbody lin-velocity) s3-1) f30-4) + ) + ) + ) + (set! (-> s4-0 y) 0.0) + (if (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (add-force! (-> this rbody) s4-0) + ) + (when (not (-> this amb-sound-playing)) + (set! (-> this amb-sound-playing) #t) + (sound-play "ambient-loop" :id (-> this amb-sound)) + ) + (when (time-elapsed? (-> this ambient-wind-sound-time) (the int (* 300.0 (rand-vu-float-range 3.0 5.0)))) + (set-time! (-> this ambient-wind-sound-time)) + (sound-play-by-name + (static-sound-name "windgusts") + (new-sound-id) + 1024 + (the int (* 1524.0 (rand-vu-float-range 0.8 1.2))) + 0 + (sound-group) + #t + ) + ) + (if (and (< 0.0 (vector-length-squared (-> this progression-plane))) + (< (vector-dot (-> this progression-plane) (-> this root trans)) (+ -4096.0 (-> this progression-plane w))) + ) + (desert-glide-task-done) + ) + (vector-reset! s4-0) + 0.0 + (let ((f0-137 (-> this controls lean-z))) + (when (-> this in-thermal) + (let ((f0-139 (* -1.0 (-> this thermal-strength)))) + (set! f0-137 (fmax -1.0 (fmin 1.0 f0-139))) + ) + ) + (when (-> this lost-lift?) + (if (time-elapsed? (-> this lost-lift-time) (seconds 3)) + (desert-glide-task-done) + ) + (set! f0-137 1.0) + ) + (if (-> this in-thermal) + (set-time! (-> this in-thermal-time)) + ) + (if (and (< 32768.0 (-> this speed)) (or (-> this in-thermal) + (not (time-elapsed? (-> this in-thermal-time) (seconds 4))) + (-> this full-speed-boost?) + (logtest? (vehicle-flag turbo-boost) (-> this v-flags)) + ) + ) + (set! (-> this lost-lift?) #f) + ) + (let ((f1-80 (* -20.0 f0-137 (fabs (-> this speed))))) + (if (and (not (-> this in-thermal)) (< (-> this speed) 32768.0) (< f0-137 0.0)) + (set! f1-80 (* 0.00024414062 (+ -28672.0 (-> this speed)) f1-80)) + ) + (when (and (not (-> this lost-lift?)) (and (< (-> this speed) 49152.0) (time-elapsed? (-> this birth) (seconds 4)))) + (set! (-> this lost-lift?) #t) + (set-time! (-> this lost-lift-time)) + ) + (cond + ((< 0.0 f0-137) + (set! (-> s4-0 y) (+ (* -20.0 (-> this rbody lin-velocity y)) f1-80)) + (when (and (< 0.7 f0-137) (time-elapsed? (-> this pitch-down-time) (seconds 2))) + (set-time! (-> this pitch-down-time)) + (sound-play "pitchglider") + ) + ) + (else + (set! (-> s4-0 y) (+ (* -20.0 (-> this rbody lin-velocity y)) f1-80)) ) ) ) - (when (logtest? (-> this v-flags) (vehicle-flag dead)) - (let* ((f2-47 (fmax 1.0 (* 0.00024414062 (vector-length (-> this rbody lin-velocity))))) - (f0-165 (+ -1.5 (* 50.0 (/ 1.0 f2-47)))) - ) - (if (logtest? (-> this v-flags) (vehicle-flag dead)) - (set! f0-165 2.0) + ) + (when #t + (let ((s3-5 (new 'stack-no-clear 'vector)) + (s2-6 (new 'stack-no-clear 'vector)) + (f28-1 0.0) + ) + 0.0 + (let ((f30-7 (the-as float (-> this info extra gravity)))) + (when (-> this in-thermal) + (when (time-elapsed? (-> this thermal-sound-time) (seconds 3)) + (set-time! (-> this thermal-sound-time)) + (sound-play "thermal") + ) + (set! f30-7 0.0) + (when (< (-> this speed) 32768.0) + (let* ((f0-148 (* 0.00024414062 (+ -28672.0 (-> this speed)) f28-1)) + (f1-88 (* (+ -1.0 f0-148) (-> this info extra gravity))) + ) + (set! f30-7 + (+ (-> this info extra gravity) (* (-> this thermal-strength) (- f1-88 (-> this info extra gravity)))) + ) + ) + ) + ) + (when (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (vector-copy! s3-5 (-> this rbody lin-velocity)) + (vector-normalize! s3-5 1.0) + (let ((f0-152 (vector-dot s3-5 s4-0))) + (vector-float*! s2-6 s3-5 f0-152) + ) + (vector-! s4-0 s4-0 s2-6) + (add-force! (-> this rbody) s4-0) + (vector-copy! s3-5 (-> this rbody matrix fvec)) + (vector-normalize! s3-5 1.0) + (vector-float*! s4-0 *up-vector* (* -1.0 (-> this info info mass) f30-7)) + (let ((f0-157 (vector-dot s3-5 s4-0))) + (vector-float*! s4-0 s3-5 f0-157) + ) + (add-force! (-> this rbody) s4-0) + (vector-copy! s3-5 (-> this rbody matrix uvec)) + (vector-normalize! s3-5 1.0) + (vector-float*! s4-0 *up-vector* (* -0.12 (-> this info info mass) f30-7)) + (let ((f0-162 (vector-dot s3-5 s4-0))) + (vector-float*! s4-0 s3-5 f0-162) ) - (when (< 0.0 f0-165) - (vector-float*! s4-0 *up-vector* (* -1.0 (-> this info info mass) (-> this info extra gravity) f0-165)) (add-force! (-> this rbody) s4-0) ) ) ) ) - (let ((a2-19 (new 'stack-no-clear 'vehicle-physics-work))) - (vehicle-method-97 this arg0 a2-19) + (when (logtest? (-> this v-flags) (vehicle-flag dead)) + (let* ((f2-47 (fmax 1.0 (* 0.00024414062 (vector-length (-> this rbody lin-velocity))))) + (f0-165 (+ -1.5 (* 50.0 (/ 1.0 f2-47)))) + ) + (if (logtest? (-> this v-flags) (vehicle-flag dead)) + (set! f0-165 2.0) + ) + (when (< 0.0 f0-165) + (vector-float*! s4-0 *up-vector* (* -1.0 (-> this info info mass) (-> this info extra gravity) f0-165)) + (add-force! (-> this rbody) s4-0) + ) + ) ) - 0 - (none) ) + (let ((a2-19 (new 'stack-no-clear 'vehicle-physics-work))) + (vehicle-method-97 this arg0 a2-19) + ) + 0 + (none) ) ;; WARN: Return type mismatch uint128 vs object. @@ -1302,48 +1247,24 @@ ) (defmethod vehicle-method-94 ((this h-glider)) - (local-vars (v1-2 float) (v1-12 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (cond - (#f - (.lvf vf1 (&-> (-> this 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 v1-2 vf1) - (let ((f0-0 v1-2) - (f1-0 122880.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (vehicle-method-87 this) - ) - ) - ) - (else - (let* ((f0-1 143360.0) - (f0-3 (* f0-1 f0-1)) - ) - (.lvf vf1 (&-> (-> this 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 v1-12 vf1) - (if (< f0-3 v1-12) - (vehicle-method-86 this) - ) - ) + (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) + ) + ) + ) + (else + (let ((f0-1 143360.0)) + (if (< (* f0-1 f0-1) (vector-length-squared (-> this root transv))) + (vehicle-method-86 this) + ) ) ) - ((method-of-type vehicle vehicle-method-94) this) - (none) ) + ((method-of-type vehicle vehicle-method-94) this) + (none) ) diff --git a/goal_src/jak3/levels/gungame/gun-dummy.gc b/goal_src/jak3/levels/gungame/gun-dummy.gc index 67bc596413..0f783d4222 100644 --- a/goal_src/jak3/levels/gungame/gun-dummy.gc +++ b/goal_src/jak3/levels/gungame/gun-dummy.gc @@ -248,14 +248,9 @@ (defmethod check-done? ((this gun-dummy)) (local-vars (at-0 int) (v0-1 symbol)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) + (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((s5-0 (-> this current)) @@ -386,20 +381,8 @@ (let ((v1-102 (new 'stack-no-clear 'vector))) (vector-copy! v1-102 (-> this root trans)) (vector-float*! (-> this root trans) s2-4 (- 1.0 f28-2)) - (let ((a0-63 (-> this root trans))) - (let ((a1-23 (-> this root trans))) - (let ((a2-17 f28-2)) - (.mov vf7 a2-17) - ) - (.lvf vf5 (&-> s3-4 quad)) - (.lvf vf4 (&-> a1-23 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-63 quad) vf6) - ) - (let ((a0-65 (-> this root transv))) + (vector+*! (-> this root trans) (-> this root trans) s3-4 f28-2) + (let ((a0-66 (-> this root transv))) (.lvf vf1 (&-> (vector-! (new 'stack-no-clear 'vector) (-> this root trans) v1-102) quad)) (let ((f0-50 (-> pp clock frames-per-second))) (.mov at-0 f0-50) @@ -407,7 +390,7 @@ (.mov vf2 at-0) (.mov.vf.w vf1 vf0) (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> a0-65 quad) vf1) + (.svf (&-> a0-66 quad) vf1) ) ) ) diff --git a/goal_src/jak3/levels/gungame/gungame-manager.gc b/goal_src/jak3/levels/gungame/gungame-manager.gc index eaf43fd586..d1793dcc61 100644 --- a/goal_src/jak3/levels/gungame/gungame-manager.gc +++ b/goal_src/jak3/levels/gungame/gungame-manager.gc @@ -1015,45 +1015,23 @@ ) (defmethod gungame-manager-method-28 ((this gungame-manager) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> s5-0 start-pos) arg0) - (set-vector! (-> s5-0 move-dist) 0.0 -8192.0 0.0 1.0) - (let ((v1-2 s5-0)) - (set! (-> v1-2 radius) 40.96) - (set! (-> v1-2 collide-with) (collide-spec backgnd)) - (set! (-> v1-2 ignore-process0) #f) - (set! (-> v1-2 ignore-process1) #f) - (set! (-> v1-2 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-2 action-mask) (collide-action solid)) - ) - (let ((f0-5 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) - (when (< 0.0 f0-5) - (let ((v0-1 arg0)) - (let ((v1-5 (-> s5-0 move-dist))) - (let ((a0-10 f0-5)) - (.mov vf7 a0-10) - ) - (.lvf vf5 (&-> v1-5 quad)) - ) - (.lvf vf4 (&-> arg0 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 (&-> v0-1 quad) vf6) - v0-1 + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> s5-0 start-pos) arg0) + (set-vector! (-> s5-0 move-dist) 0.0 -8192.0 0.0 1.0) + (let ((v1-2 s5-0)) + (set! (-> v1-2 radius) 40.96) + (set! (-> v1-2 collide-with) (collide-spec backgnd)) + (set! (-> v1-2 ignore-process0) #f) + (set! (-> v1-2 ignore-process1) #f) + (set! (-> v1-2 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) + (set! (-> v1-2 action-mask) (collide-action solid)) + ) + (let ((f0-5 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) + (if (< 0.0 f0-5) + (vector+*! arg0 arg0 (-> s5-0 move-dist) f0-5) ) - ) ) ) ) diff --git a/goal_src/jak3/levels/mhcity/destroy-dark-eco.gc b/goal_src/jak3/levels/mhcity/destroy-dark-eco.gc index 715c9fa517..9dd42763fd 100644 --- a/goal_src/jak3/levels/mhcity/destroy-dark-eco.gc +++ b/goal_src/jak3/levels/mhcity/destroy-dark-eco.gc @@ -534,7 +534,7 @@ (f26-0 (vector-vector-distance gp-2 s5-2)) ) (dotimes (s5-3 8) - (vector-rotate-around-axis! s1-0 (the-as quaternion s4-1) f28-0 s2-0) + (vector-rotate-around-axis! s1-0 s4-1 f28-0 s2-0) (vector-float*! s1-0 s1-0 f26-0) (vector+! (-> s3-1 0 pts s5-3) gp-2 s1-0) (+! f28-0 f30-0) @@ -1235,148 +1235,55 @@ :virtual #t :trans (behavior () (local-vars (sv-48 (pointer lightning-tracker)) (sv-52 sparticle-launcher)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector)) - (gp-0 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s5-0 (-> self root trans)) - (vector-copy! gp-0 (-> self root trans)) - (let ((s2-0 s5-0)) - (let ((s4-0 s5-0)) - (let ((s3-0 *x-vector*)) - (let ((v1-2 (rand-vu-float-range -4096.0 4096.0))) - (.mov vf7 v1-2) - ) - (.lvf vf5 (&-> s3-0 quad)) - ) - (.lvf vf4 (&-> s4-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 (&-> s2-0 quad) vf6) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) ) - (let ((s2-1 s5-0)) - (let ((s4-1 s5-0)) - (let ((s3-1 *y-vector*)) - (let ((v1-3 (rand-vu-float-range -4096.0 4096.0))) - (.mov vf7 v1-3) - ) - (.lvf vf5 (&-> s3-1 quad)) - ) - (.lvf vf4 (&-> s4-1 quad)) + (vector-copy! s5-0 (-> self root trans)) + (vector-copy! gp-0 (-> self root trans)) + (vector+*! s5-0 s5-0 *x-vector* (rand-vu-float-range -4096.0 4096.0)) + (vector+*! s5-0 s5-0 *y-vector* (rand-vu-float-range -4096.0 4096.0)) + (vector+*! s5-0 s5-0 *z-vector* (rand-vu-float-range -4096.0 4096.0)) + (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 + ) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> s2-1 quad) vf6) - ) - (let ((s2-2 s5-0)) - (let ((s4-2 s5-0)) - (let ((s3-2 *z-vector*)) - (let ((v1-4 (rand-vu-float-range -4096.0 4096.0))) - (.mov vf7 v1-4) + (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))) ) - (.lvf vf5 (&-> s3-2 quad)) - ) - (.lvf vf4 (&-> s4-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 (&-> s2-2 quad) vf6) - ) - (let ((s2-3 gp-0)) - (let ((s4-3 gp-0)) - (let ((s3-3 *x-vector*)) - (let ((v1-5 (rand-vu-float-range -4096.0 4096.0))) - (.mov vf7 v1-5) + (let ((t9-10 sp-launch-particles-var) + (a0-20 *sp-particle-system-2d*) + (a1-10 sv-52) + (a2-3 *launch-matrix*) ) - (.lvf vf5 (&-> s3-3 quad)) - ) - (.lvf vf4 (&-> s4-3 quad)) + (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) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> s2-3 quad) vf6) - ) - (let ((s2-4 gp-0)) - (let ((s4-4 gp-0)) - (let ((s3-4 *y-vector*)) - (let ((v1-6 (rand-vu-float-range -4096.0 4096.0))) - (.mov vf7 v1-6) + (let ((t9-11 sp-launch-particles-var) + (a0-21 *sp-particle-system-2d*) + (a1-11 sv-52) + (a2-4 *launch-matrix*) ) - (.lvf vf5 (&-> s3-4 quad)) - ) - (.lvf vf4 (&-> s4-4 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 (&-> s2-4 quad) vf6) - ) - (let ((s2-5 gp-0)) - (let ((s4-5 gp-0)) - (let ((s3-5 *z-vector*)) - (let ((v1-7 (rand-vu-float-range -4096.0 4096.0))) - (.mov vf7 v1-7) - ) - (.lvf vf5 (&-> s3-5 quad)) - ) - (.lvf vf4 (&-> s4-5 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 (&-> s2-5 quad) vf6) - ) - (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 - ) - ) - (set! sv-52 (-> *part-id-table* 160)) - (when sv-48 - (set! (-> sv-48 0 user-time 0) 0) - (when sv-52 - (let ((v1-19 (get-field-spec-by-id sv-52 (sp-field-id spt-timer)))) - (if v1-19 - (set! (-> v1-19 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) - ) + (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) ) ) ) diff --git a/goal_src/jak3/levels/mine/gekko.gc b/goal_src/jak3/levels/mine/gekko.gc index 979b0e3b03..bf9b351db8 100644 --- a/goal_src/jak3/levels/mine/gekko.gc +++ b/goal_src/jak3/levels/mine/gekko.gc @@ -2520,28 +2520,13 @@ (defmethod get-knockback-dir! ((this gekko) (arg0 vector)) "Compute the knockback direction for an incoming attack." - (local-vars (v1-2 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (vector-copy! arg0 (-> this incoming attack-direction)) - (.lvf vf1 (&-> arg0 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-2 vf1) - (when (= v1-2 0.0) - (vector-z-quaternion! arg0 (-> this root quat)) - (vector-negate-in-place! arg0) - ) - (vector-flatten! arg0 arg0 (-> this rot-matrix uvec)) - (vector-normalize! arg0 1.0) + (vector-copy! arg0 (-> this incoming attack-direction)) + (when (= (vector-length-squared arg0) 0.0) + (vector-z-quaternion! arg0 (-> this root quat)) + (vector-negate-in-place! arg0) ) + (vector-flatten! arg0 arg0 (-> this rot-matrix uvec)) + (vector-normalize! arg0 1.0) ) ;; WARN: Return type mismatch vector vs object. diff --git a/goal_src/jak3/levels/mine/prebot-states.gc b/goal_src/jak3/levels/mine/prebot-states.gc index a6a458923b..1dc73791e9 100644 --- a/goal_src/jak3/levels/mine/prebot-states.gc +++ b/goal_src/jak3/levels/mine/prebot-states.gc @@ -70,40 +70,16 @@ ) (defbehavior prebot-light-flash prebot ((arg0 float) (arg1 float) (arg2 float)) - (local-vars (v1-1 float) (a3-2 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((v1-0 (new 'stack-no-clear 'vector))) - (set! (-> v1-0 x) arg0) - (set! (-> v1-0 y) arg1) - (set! (-> v1-0 z) arg2) - (set! (-> v1-0 w) 1.0) - (.lvf vf1 (&-> (-> self light-flash value) 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 a3-2 vf1) - (let ((f0-4 a3-2)) - (.lvf vf1 (&-> v1-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-1 vf1) - (when (< f0-4 v1-1) - (set-vector! (-> self light-flash value) arg0 arg1 arg2 1.0) - (let ((v0-0 (-> self light-flash vel))) - (set! (-> v0-0 quad) (the-as uint128 0)) - v0-0 - ) - ) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (set! (-> v1-0 x) arg0) + (set! (-> v1-0 y) arg1) + (set! (-> v1-0 z) arg2) + (set! (-> v1-0 w) 1.0) + (when (< (vector-length-squared (-> self light-flash value)) (vector-length-squared v1-0)) + (set-vector! (-> self light-flash value) arg0 arg1 arg2 1.0) + (let ((v0-0 (-> self light-flash vel))) + (set! (-> v0-0 quad) (the-as uint128 0)) + v0-0 ) ) ) diff --git a/goal_src/jak3/levels/mine/rat.gc b/goal_src/jak3/levels/mine/rat.gc index d15bea3dd4..f8f7c7efb3 100644 --- a/goal_src/jak3/levels/mine/rat.gc +++ b/goal_src/jak3/levels/mine/rat.gc @@ -795,7 +795,7 @@ (ja-channel-push! 1 0) (ja-no-eval :group! rat-pipe-jump0-start-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) (vector-v++! (-> self root trans) (-> self root transv)) (suspend) @@ -803,7 +803,7 @@ ) (ja-no-eval :group! rat-pipe-jump0-end-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) (cond ((>= (-> self root gspot-pos y) (-> self root trans y)) diff --git a/goal_src/jak3/levels/nest/egg-spider.gc b/goal_src/jak3/levels/nest/egg-spider.gc index 4bd5c55f73..1b43ef181a 100644 --- a/goal_src/jak3/levels/nest/egg-spider.gc +++ b/goal_src/jak3/levels/nest/egg-spider.gc @@ -762,109 +762,79 @@ ) (defmethod egg-spider-method-194 ((this egg-spider)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s2-0 (as-type (handle->process (-> this focus handle)) process-focusable))) - (when s2-0 - (let ((s3-0 (vector-rotate-around-y! (new 'stack-no-clear 'vector) *z-vector* (-> this angle-spot))) - (s1-0 (get-trans (the-as process-focusable s2-0) 0)) - ) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (let ((s4-0 (get-trans (the-as process-focusable s2-0) 0))) - (let ((s0-0 (get-transv (the-as process-focusable s2-0)))) - (let ((v1-9 (rnd-float-range this 2.0 3.0))) - (.mov vf7 v1-9) - ) - (.lvf vf5 (&-> s0-0 quad)) - ) - (.lvf vf4 (&-> s4-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 (&-> s5-1 quad) vf6) + (let ((s2-0 (as-type (handle->process (-> this focus handle)) process-focusable))) + (when s2-0 + (let ((s3-0 (vector-rotate-around-y! (new 'stack-no-clear 'vector) *z-vector* (-> this angle-spot))) + (s1-0 (get-trans (the-as process-focusable s2-0) 0)) ) - (let* ((s5-2 (new 'stack-no-clear 'vector)) - (s4-2 (vector-! (new 'stack-no-clear 'vector) s1-0 (-> this root trans))) - (f30-0 (vector-length s4-2)) - ) - (let ((f28-0 (vector-vector-distance (-> this root trans) s1-0))) - (new 'stack-no-clear 'vector) - (let ((s1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable s2-0) 0)))) - (set! (-> s4-2 y) 0.0) - (vector-normalize! s4-2 1.0) - (set! (-> s1-2 y) 0.0) - (vector-normalize! s1-2 1.0) - (when (< 0.0 (vector-dot s3-0 s1-2)) - ) - ) - (let ((s1-3 s5-2)) - (let ((v1-21 (get-trans (the-as process-focusable s2-0) 0))) - (let ((a0-20 (+ 40960.0 (* 0.4 f28-0)))) - (.mov vf7 a0-20) - ) - (.lvf vf5 (&-> s3-0 quad)) - (.lvf vf4 (&-> v1-21 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 (&-> s1-3 quad) vf6) + (vector+*! + (new 'stack-no-clear 'vector) + (get-trans (the-as process-focusable s2-0) 0) + (get-transv (the-as process-focusable s2-0)) + (rnd-float-range this 2.0 3.0) + ) + (let* ((s5-3 (new 'stack-no-clear 'vector)) + (s4-2 (vector-! (new 'stack-no-clear 'vector) s1-0 (-> this root trans))) + (f30-0 (vector-length s4-2)) + ) + (let ((f28-0 (vector-vector-distance (-> this root trans) s1-0))) + (new 'stack-no-clear 'vector) + (let ((s1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable s2-0) 0)))) + (set! (-> s4-2 y) 0.0) + (vector-normalize! s4-2 1.0) + (set! (-> s1-2 y) 0.0) + (vector-normalize! s1-2 1.0) + (when (< 0.0 (vector-dot s3-0 s1-2)) ) ) - (cond - ((< f30-0 (-> this enemy-info notice-nav-radius)) - (vector-copy! (-> this target-pos) s5-2) - (let ((s3-1 (new 'stack-no-clear 'vector))) - (vector-copy! s3-1 s4-2) - (let ((s5-3 (new 'stack-no-clear 'vector))) - (vector-copy! s5-3 (-> this root transv)) - (vector-normalize! s5-3 f30-0) - (if (>= (vector-dot s3-1 s5-3) 0.98) - (go (method-of-object this attack)) - ) - ) + (vector+*! s5-3 (get-trans s2-0 0) s3-0 (+ 40960.0 (* 0.4 f28-0))) + ) + (cond + ((< f30-0 (-> this enemy-info notice-nav-radius)) + (vector-copy! (-> this target-pos) s5-3) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (vector-copy! s3-1 s4-2) + (let ((s5-4 (new 'stack-no-clear 'vector))) + (vector-copy! s5-4 (-> this root transv)) + (vector-normalize! s5-4 f30-0) + (if (>= (vector-dot s3-1 s5-4) 0.98) + (go (method-of-object this attack)) + ) ) ) - ((or (time-elapsed? (-> this last-change-dir) (-> this change-dir-time)) - (< (vector-vector-distance-squared (-> this root trans) (-> this target-pos)) 0.1) - ) - (set-time! (-> this last-change-dir)) - (set! (-> this change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) - (let ((s3-2 (new 'stack-no-clear 'vector)) - (f0-14 (* (/ f30-0 2) (tan (-> this move-angle)))) - (s2-1 (new 'stack-no-clear 'vector)) - ) - (if (-> this heading) - (set-vector! s3-2 (-> s4-2 z) (-> s4-2 y) (- (-> s4-2 x)) 1.0) - (set-vector! s3-2 (- (-> s4-2 z)) (-> s4-2 y) (-> s4-2 x) 1.0) - ) - (set! (-> this heading) (not (-> this heading))) - (let ((f28-2 (rand-vu-float-range (* 0.75 f0-14) f0-14)) - (s4-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) s4-2 (* -0.6 f30-0))) - ) - (vector-normalize! s3-2 f28-2) - (vector+! s3-2 s3-2 s4-3) - ) - (clamp-vector-to-mesh-cross-gaps (-> this nav state) s3-2) - (vector+! s2-1 s5-2 s3-2) - (vector-copy! (-> this target-pos) s2-1) + ) + ((or (time-elapsed? (-> this last-change-dir) (-> this change-dir-time)) + (< (vector-vector-distance-squared (-> this root trans) (-> this target-pos)) 0.1) ) + (set-time! (-> this last-change-dir)) + (set! (-> this change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) + (let ((s3-2 (new 'stack-no-clear 'vector)) + (f0-14 (* (/ f30-0 2) (tan (-> this move-angle)))) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (if (-> this heading) + (set-vector! s3-2 (-> s4-2 z) (-> s4-2 y) (- (-> s4-2 x)) 1.0) + (set-vector! s3-2 (- (-> s4-2 z)) (-> s4-2 y) (-> s4-2 x) 1.0) + ) + (set! (-> this heading) (not (-> this heading))) + (let ((f28-2 (rand-vu-float-range (* 0.75 f0-14) f0-14)) + (s4-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) s4-2 (* -0.6 f30-0))) + ) + (vector-normalize! s3-2 f28-2) + (vector+! s3-2 s3-2 s4-3) + ) + (clamp-vector-to-mesh-cross-gaps (-> this nav state) s3-2) + (vector+! s2-1 s5-3 s3-2) + (vector-copy! (-> this target-pos) s2-1) ) - ) + ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) (defstate idle (egg-spider) @@ -1079,84 +1049,52 @@ ) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (handle->process (-> self wvehicle))) - (s1-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'quaternion)) - (gp-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - ) - (cond - (s5-0 - (if (focus-test? (the-as process-focusable s5-0) dead) - (go-virtual knocked) - ) - (wvehicle-method-171 (the-as wvehicle s5-0) s1-0 (-> self seat-index)) - (wvehicle-method-172 (the-as wvehicle s5-0) (the-as quaternion s4-0) (-> self seat-index)) - (rigid-body-control-method-23 (-> (the-as wvehicle s5-0) rbody) (-> self root trans) gp-0) - (vector-y-quaternion! s2-0 (the-as quaternion s4-0)) - (let ((a1-5 s2-0)) - (let ((v1-16 s2-0)) - (let ((a0-7 gp-0)) - (let ((a2-4 -0.00001)) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a0-7 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 (&-> a1-5 quad) vf6) - ) - (vector-normalize! s2-0 1.0) - (let ((a1-7 (-> self vec-up))) - (let ((v1-17 (-> self vec-up))) - (let ((a0-10 (vector-! (new 'stack-no-clear 'vector) s2-0 (-> self vec-up)))) - (let ((a2-8 (* 2.0 (seconds-per-frame)))) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a0-10 quad)) - ) - (.lvf vf4 (&-> v1-17 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-7 quad) vf6) - ) - (vector-normalize! (-> self vec-up) 1.0) - (vector-copy! (-> self root trans) s1-0) - (quaternion-from-two-vectors! s3-0 (-> self vec-up) s2-0) - (quaternion*! (-> self root quat) (the-as quaternion s4-0) s3-0) - (send-event - s5-0 - 'attack - #f - (static-attack-info - :mask (vehicle-impulse-factor) - ((id (new-attack-id)) (damage 2.0) (vehicle-damage-factor 0.00333) (vehicle-impulse-factor 0.0)) - ) - ) - (when (and (< 49152.0 (vector-length gp-0)) (< *egg-spider-next-knocked-vehicle* (current-time))) - (set! *egg-spider-next-knocked-vehicle* (+ (current-time) (rand-vu-int-range (seconds 0.1) (seconds 0.3)))) - (set! (-> self vehicle-attack?) #f) + (let ((s5-0 (handle->process (-> self wvehicle))) + (s1-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'quaternion)) + (gp-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (cond + (s5-0 + (if (focus-test? (the-as process-focusable s5-0) dead) (go-virtual knocked) ) + (wvehicle-method-171 (the-as wvehicle s5-0) s1-0 (-> self seat-index)) + (wvehicle-method-172 (the-as wvehicle s5-0) (the-as quaternion s4-0) (-> self seat-index)) + (rigid-body-control-method-23 (-> (the-as wvehicle s5-0) rbody) (-> self root trans) gp-0) + (vector-y-quaternion! s2-0 (the-as quaternion s4-0)) + (vector+*! s2-0 s2-0 gp-0 -0.00001) + (vector-normalize! s2-0 1.0) + (vector+*! + (-> self vec-up) + (-> self vec-up) + (vector-! (new 'stack-no-clear 'vector) s2-0 (-> self vec-up)) + (* 2.0 (seconds-per-frame)) ) - (else + (vector-normalize! (-> self vec-up) 1.0) + (vector-copy! (-> self root trans) s1-0) + (quaternion-from-two-vectors! s3-0 (-> self vec-up) s2-0) + (quaternion*! (-> self root quat) (the-as quaternion s4-0) s3-0) + (send-event + s5-0 + 'attack + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (new-attack-id)) (damage 2.0) (vehicle-damage-factor 0.00333) (vehicle-impulse-factor 0.0)) + ) + ) + (when (and (< 49152.0 (vector-length gp-0)) (< *egg-spider-next-knocked-vehicle* (current-time))) + (set! *egg-spider-next-knocked-vehicle* (+ (current-time) (rand-vu-int-range (seconds 0.1) (seconds 0.3)))) + (set! (-> self vehicle-attack?) #f) (go-virtual knocked) ) ) + (else + (go-virtual knocked) + ) ) ) ) @@ -1635,93 +1573,74 @@ 0 ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (check-can-rid self) - (when (< (-> self next-spot-time) (current-time)) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 (camera-pos)) - (let ((f28-0 (camera-angle)) - (s4-0 (new 'stack-no-clear 'vector)) - (gp-0 (new 'stack-no-clear 'vector)) - ) - (let ((f30-0 0.0)) - (if *target* - (+! f30-0 (vector-length (-> *target* control transv))) - ) - (vector-rotate-around-y! s4-0 *z-vector* (+ f28-0 (* 182.04445 (rand-vu-float-range -30.0 30.0)))) - (let ((s3-1 gp-0)) - (let ((v1-17 (+ (* 2.0 f30-0) (* 4096.0 (rand-vu-float-range 40.0 80.0))))) - (.mov vf7 v1-17) - ) - (.lvf vf5 (&-> s4-0 quad)) - (.lvf vf4 (&-> s5-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 (&-> s3-1 quad) vf6) - ) - ) - (when (spider-manager-method-25 self (the-as sphere gp-0)) - (vector-copy! (-> self spawn-pos) gp-0) - (set! (-> self next-spot-time) - (+ (current-time) (rand-vu-int-range (-> self min-spot-delay) (-> self max-spot-delay))) - ) + (check-can-rid self) + (when (< (-> self next-spot-time) (current-time)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 (camera-pos)) + (let ((f28-0 (camera-angle)) + (s4-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) ) + (let ((f30-0 0.0)) + (if *target* + (+! f30-0 (vector-length (-> *target* control transv))) + ) + (vector-rotate-around-y! s4-0 *z-vector* (+ f28-0 (* 182.04445 (rand-vu-float-range -30.0 30.0)))) + (vector+*! gp-0 s5-0 s4-0 (+ (* 2.0 f30-0) (* 4096.0 (rand-vu-float-range 40.0 80.0)))) + ) + (when (spider-manager-method-25 self (the-as sphere gp-0)) + (vector-copy! (-> self spawn-pos) gp-0) + (set! (-> self next-spot-time) + (+ (current-time) (rand-vu-int-range (-> self min-spot-delay) (-> self max-spot-delay))) + ) ) ) ) - (if (and (= (-> self count-alive) (-> self count-max)) (-> self can-rid)) - (send-event (handle->process (-> self can-rid)) 'die-fast) - ) - (when (and (< (-> self count-alive) (-> self count-max)) - *target* - (not (-> *setting-control* user-current nuke-active?)) - ) - (when (< (-> self next-spawn-time) (current-time)) - (set! (-> self next-spawn-time) - (+ (current-time) (rand-vu-int-range (-> self min-spawn-delay) (-> self max-spawn-delay))) - ) - (let ((gp-3 (new 'stack-no-clear 'sphere))) - (set! (-> gp-3 quad) (-> self spawn-pos quad)) - (+! (-> gp-3 x) (* 4096.0 (rand-vu-float-range -3.0 3.0))) - (+! (-> gp-3 z) (* 4096.0 (rand-vu-float-range -3.0 3.0))) - (set! (-> gp-3 r) 4096.0) - (when (and (sphere-in-view-frustum? gp-3) (spider-manager-method-25 self gp-3)) - (let ((s5-1 (new 'stack-no-clear 'enemy-init-by-other-params))) - (vector-copy! (-> s5-1 trans) gp-3) - (quaternion-copy! (-> s5-1 quat) *unity-quaternion*) - (set! (-> s5-1 entity) (-> self actor-group 0 data 0 actor)) - (set! (-> s5-1 directed?) #f) - (set! (-> s5-1 no-initial-move-to-ground?) #f) - (set! (-> s5-1 art-level) #f) - (let ((gp-5 - (as-type - (ppointer->process (process-spawn egg-spider self s5-1 (-> self max-spawn-size) :name "egg-spider" :to self)) - process-focusable - ) + ) + (if (and (= (-> self count-alive) (-> self count-max)) (-> self can-rid)) + (send-event (handle->process (-> self can-rid)) 'die-fast) + ) + (when (and (< (-> self count-alive) (-> self count-max)) + *target* + (not (-> *setting-control* user-current nuke-active?)) + ) + (when (< (-> self next-spawn-time) (current-time)) + (set! (-> self next-spawn-time) + (+ (current-time) (rand-vu-int-range (-> self min-spawn-delay) (-> self max-spawn-delay))) + ) + (let ((gp-3 (new 'stack-no-clear 'sphere))) + (set! (-> gp-3 quad) (-> self spawn-pos quad)) + (+! (-> gp-3 x) (* 4096.0 (rand-vu-float-range -3.0 3.0))) + (+! (-> gp-3 z) (* 4096.0 (rand-vu-float-range -3.0 3.0))) + (set! (-> gp-3 r) 4096.0) + (when (and (sphere-in-view-frustum? gp-3) (spider-manager-method-25 self gp-3)) + (let ((s5-1 (new 'stack-no-clear 'enemy-init-by-other-params))) + (vector-copy! (-> s5-1 trans) gp-3) + (quaternion-copy! (-> s5-1 quat) *unity-quaternion*) + (set! (-> s5-1 entity) (-> self actor-group 0 data 0 actor)) + (set! (-> s5-1 directed?) #f) + (set! (-> s5-1 no-initial-move-to-ground?) #f) + (set! (-> s5-1 art-level) #f) + (let ((gp-5 + (as-type + (ppointer->process (process-spawn egg-spider self s5-1 (-> self max-spawn-size) :name "egg-spider" :to self)) + process-focusable ) - (s5-3 (as-type (entity-nav-mesh-by-aid (the-as actor-id (-> self nav-id))) entity-nav-mesh)) ) - (when (and (task-node-closed? (game-task-node forest-kill-plants-introduction)) - (not (task-node-closed? (game-task-node forest-kill-plants-resolution))) - ) - (set! (-> (the-as process-focusable gp-5) fact pickup-type) (pickup-type none)) - (set! (-> (the-as process-focusable gp-5) fact pickup-amount) 0.0) + (s5-3 (as-type (entity-nav-mesh-by-aid (the-as actor-id (-> self nav-id))) entity-nav-mesh)) ) - (when s5-3 - (change-to (-> s5-3 nav-mesh) (the-as process-drawable gp-5)) - (let ((v1-64 (-> (the-as process-focusable gp-5) nav state))) - (set! (-> v1-64 current-poly) (the-as nav-poly #f)) - ) - 0 + (when (and (task-node-closed? (game-task-node forest-kill-plants-introduction)) + (not (task-node-closed? (game-task-node forest-kill-plants-resolution))) + ) + (set! (-> (the-as process-focusable gp-5) fact pickup-type) (pickup-type none)) + (set! (-> (the-as process-focusable gp-5) fact pickup-amount) 0.0) + ) + (when s5-3 + (change-to (-> s5-3 nav-mesh) (the-as process-drawable gp-5)) + (let ((v1-63 (-> (the-as process-focusable gp-5) nav state))) + (set! (-> v1-63 current-poly) (the-as nav-poly #f)) ) + 0 ) ) ) diff --git a/goal_src/jak3/levels/nest/mh-bat.gc b/goal_src/jak3/levels/nest/mh-bat.gc index db62eb4101..764a44323e 100644 --- a/goal_src/jak3/levels/nest/mh-bat.gc +++ b/goal_src/jak3/levels/nest/mh-bat.gc @@ -1119,18 +1119,13 @@ ) (seek! (-> self pitch-angle) f0-3 (* 32768.0 (seconds-per-frame))) ) - (vector-rotate-around-axis! - gp-0 - (the-as quaternion *y-vector*) - (-> self pitch-angle) - (-> self rotation-matrix rvec) - ) + (vector-rotate-around-axis! gp-0 *y-vector* (-> self pitch-angle) (-> self rotation-matrix rvec)) (let* ((v1-17 (vector-flatten! (new 'stack-no-clear 'vector) s5-0 *y-vector*)) (f0-9 (lerp-scale -15473.777 15473.777 (vector-dot (-> self rotation-matrix rvec) v1-17) 163840.0 -163840.0)) ) (seek! (-> self bank-angle) f0-9 (* 10922.667 (seconds-per-frame))) ) - (vector-rotate-around-axis! gp-0 (the-as quaternion gp-0) (-> self bank-angle) (-> self rotation-matrix fvec)) + (vector-rotate-around-axis! gp-0 gp-0 (-> self bank-angle) (-> self rotation-matrix fvec)) ) ) 0 diff --git a/goal_src/jak3/levels/nest/mh-centipede.gc b/goal_src/jak3/levels/nest/mh-centipede.gc index bcfaed38fa..61e6b12bcc 100644 --- a/goal_src/jak3/levels/nest/mh-centipede.gc +++ b/goal_src/jak3/levels/nest/mh-centipede.gc @@ -646,70 +646,47 @@ (defstate idle (rod-spawner) :virtual #t :enter (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (set-time! (-> self state-time)) - (set-vector! (-> self root scale) 3.0 3.0 3.0 1.0) - (logclear! (-> self mask) (process-mask actor-pause)) - (let ((v1-8 (-> self entity extra perm))) - (logior! (-> v1-8 status) (entity-perm-status bit-5)) - (set! (-> self root trans x) (* 4096.0 (the float (-> v1-8 user-int16 0)))) - (set! (-> self root trans z) (* 4096.0 (the float (-> v1-8 user-int16 1)))) - ) - (set! (-> self minimap) (add-icon! *minimap* self (the-as uint 12) (the-as int #f) (the-as vector #t) 0)) - (let ((gp-0 (new 'stack-no-clear 'collide-query))) - (set-vector! (-> gp-0 move-dist) 0.0 -204800.0 0.0 1.0) - (vector-copy! (-> gp-0 start-pos) (-> self root trans)) - (+! (-> gp-0 start-pos y) 102400.0) - (let ((v1-17 gp-0)) - (set! (-> v1-17 radius) 409.6) - (set! (-> v1-17 collide-with) (collide-spec backgnd)) - (set! (-> v1-17 ignore-process0) #f) - (set! (-> v1-17 ignore-process1) #f) - (set! (-> v1-17 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-17 action-mask) (collide-action solid)) - ) - (let ((f0-15 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) - (cond - ((>= f0-15 0.0) - (let ((a0-22 (-> self root trans))) - (let ((v1-21 (-> gp-0 start-pos))) - (let ((a1-2 (-> gp-0 move-dist))) - (let ((a2-1 f0-15)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-2 quad)) - ) - (.lvf vf4 (&-> v1-21 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-22 quad) vf6) - ) - (+! (-> self root trans y) 4096.0) - ) - (else - (format 0 "~A failed to find ground~%" (-> self name)) + (set-time! (-> self state-time)) + (set-vector! (-> self root scale) 3.0 3.0 3.0 1.0) + (logclear! (-> self mask) (process-mask actor-pause)) + (let ((v1-8 (-> self entity extra perm))) + (logior! (-> v1-8 status) (entity-perm-status bit-5)) + (set! (-> self root trans x) (* 4096.0 (the float (-> v1-8 user-int16 0)))) + (set! (-> self root trans z) (* 4096.0 (the float (-> v1-8 user-int16 1)))) + ) + (set! (-> self minimap) (add-icon! *minimap* self (the-as uint 12) (the-as int #f) (the-as vector #t) 0)) + (let ((gp-0 (new 'stack-no-clear 'collide-query))) + (set-vector! (-> gp-0 move-dist) 0.0 -204800.0 0.0 1.0) + (vector-copy! (-> gp-0 start-pos) (-> self root trans)) + (+! (-> gp-0 start-pos y) 102400.0) + (let ((v1-17 gp-0)) + (set! (-> v1-17 radius) 409.6) + (set! (-> v1-17 collide-with) (collide-spec backgnd)) + (set! (-> v1-17 ignore-process0) #f) + (set! (-> v1-17 ignore-process1) #f) + (set! (-> v1-17 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) + (set! (-> v1-17 action-mask) (collide-action solid)) + ) + (let ((f0-15 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) + (cond + ((>= f0-15 0.0) + (vector+*! (-> self root trans) (-> gp-0 start-pos) (-> gp-0 move-dist) f0-15) + (+! (-> self root trans y) 4096.0) + ) + (else + (format 0 "~A failed to find ground~%" (-> self name)) ) ) ) - (let ((gp-1 (new 'stack-no-clear 'task-arrow-params))) - (vector-copy! (-> gp-1 pos) (-> self root trans)) - (quaternion-identity! (-> gp-1 quat)) - (set! (-> gp-1 flags) (task-arrow-flags taf3 taf5)) - (set! (-> gp-1 map-icon) (the-as uint 12)) - (set! (-> self rod) (process->handle (task-arrow-spawn gp-1 self))) - ) + ) + (let ((gp-1 (new 'stack-no-clear 'task-arrow-params))) + (vector-copy! (-> gp-1 pos) (-> self root trans)) + (quaternion-identity! (-> gp-1 quat)) + (set! (-> gp-1 flags) (task-arrow-flags taf3 taf5)) + (set! (-> gp-1 map-icon) (the-as uint 12)) + (set! (-> self rod) (process->handle (task-arrow-spawn gp-1 self))) ) ) :exit (behavior () @@ -1008,119 +985,96 @@ ;; WARN: Function (method 10 mh-centipede-crater-pt-array) has a return type of none, but the expression builder found a return statement. (defmethod mh-centipede-crater-pt-array-method-10 ((this mh-centipede-crater-pt-array)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (if (>= (-> this current-point) 20) - (return 0) + (if (>= (-> this current-point) 20) + (return 0) + ) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (-> this points (-> this current-point))) ) - (let ((gp-0 (new 'stack-no-clear 'collide-query)) - (s5-0 (-> this points (-> this current-point))) - ) - (set! (-> s5-0 found?) #f) - (let* ((f0-0 3449.2632) - (f30-0 (* f0-0 (the float (-> this current-point)))) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (let ((f0-3 (+ f30-0 (rand-vu-float-range (* -0.43 f0-0) (* 0.43 f0-0))))) - (set! (-> s5-0 angle) f0-3) - (sincos! s3-0 f0-3) - ) - (set! (-> s3-0 z) (* (-> s3-0 y) (-> this radius) (rand-vu-float-range 0.7 0.9))) - (set! (-> s3-0 y) 32768.0) - (set! (-> s3-0 x) (* (-> s3-0 x) (-> this radius) (rand-vu-float-range 0.7 0.9))) - (vector+! (-> gp-0 start-pos) (-> this origin) s3-0) + (set! (-> s5-0 found?) #f) + (let* ((f0-0 3449.2632) + (f30-0 (* f0-0 (the float (-> this current-point)))) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((f0-3 (+ f30-0 (rand-vu-float-range (* -0.43 f0-0) (* 0.43 f0-0))))) + (set! (-> s5-0 angle) f0-3) + (sincos! s3-0 f0-3) ) - (set-vector! (-> gp-0 move-dist) 0.0 -65536.0 0.0 1.0) - (let ((v1-13 gp-0)) - (set! (-> v1-13 radius) 409.6) - (set! (-> v1-13 collide-with) (collide-spec backgnd pusher)) - (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)) - ) - (+! (-> this current-point) 1) - (let ((f0-16 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) - (when (>= f0-16 0.0) - (let ((a1-5 (-> s5-0 collision-pt))) - (let ((v1-19 (-> gp-0 start-pos))) - (let ((a0-15 (-> gp-0 move-dist))) - (let ((a2-0 f0-16)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a0-15 quad)) - ) - (.lvf vf4 (&-> v1-19 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-5 quad) vf6) + (set! (-> s3-0 z) (* (-> s3-0 y) (-> this radius) (rand-vu-float-range 0.7 0.9))) + (set! (-> s3-0 y) 32768.0) + (set! (-> s3-0 x) (* (-> s3-0 x) (-> this radius) (rand-vu-float-range 0.7 0.9))) + (vector+! (-> gp-0 start-pos) (-> this origin) s3-0) + ) + (set-vector! (-> gp-0 move-dist) 0.0 -65536.0 0.0 1.0) + (let ((v1-13 gp-0)) + (set! (-> v1-13 radius) 409.6) + (set! (-> v1-13 collide-with) (collide-spec backgnd pusher)) + (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) ) - (+! (-> s5-0 collision-pt y) 204.8) - (set! (-> s5-0 found?) #t) - (vector-normalize-copy! (-> s5-0 normal) (-> gp-0 best-other-tri normal) 1.0) - (let ((s3-1 (new 'stack-no-clear 'vector)) - (s4-1 (new 'stack-no-clear 'inline-array 'vector 4)) - ) - (vector-cross! s3-1 (-> s5-0 normal) (vector-get-unique! (new 'stack-no-clear 'vector) (-> s5-0 normal))) - (vector-normalize! s3-1 10240.0) - (vector-copy! (-> s4-1 0) s3-1) - (vector-cross! (-> s4-1 1) s3-1 (-> s5-0 normal)) - (vector-negate! (-> s4-1 2) s3-1) - (vector-cross! (-> s4-1 3) (-> s5-0 normal) s3-1) - (vector-float*! s3-1 (-> s5-0 normal) 3072.0) - (dotimes (v1-28 4) - (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) s3-1) - (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) (-> s5-0 collision-pt)) + (set! (-> v1-13 action-mask) (collide-action solid)) + ) + (+! (-> this current-point) 1) + (let ((f0-16 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) + (when (>= f0-16 0.0) + (vector+*! (-> s5-0 collision-pt) (-> gp-0 start-pos) (-> gp-0 move-dist) f0-16) + (+! (-> s5-0 collision-pt y) 204.8) + (set! (-> s5-0 found?) #t) + (vector-normalize-copy! (-> s5-0 normal) (-> gp-0 best-other-tri normal) 1.0) + (let ((s3-1 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack-no-clear 'inline-array 'vector 4)) ) - (vector-float*! (-> gp-0 move-dist) s3-1 -2.0) - (let ((s3-2 (new 'stack-no-clear 'collide-query))) - (let ((a1-19 (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)) - ) - (set-vector! v1-38 f0-22 f0-22 f0-22 1.0) - (vector+! (-> a1-19 max) (-> s5-0 collision-pt) v1-38) - (vector-! (-> a1-19 min) (-> s5-0 collision-pt) v1-38) - ) - (set! (-> s3-2 collide-with) (collide-spec backgnd pusher)) - (set! (-> s3-2 ignore-process0) #f) - (set! (-> s3-2 ignore-process1) #f) - (set! (-> s3-2 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> s3-2 action-mask) (collide-action solid)) - (mem-copy! (the-as pointer (-> s3-2 bbox)) (the-as pointer a1-19) 32) + (vector-cross! s3-1 (-> s5-0 normal) (vector-get-unique! (new 'stack-no-clear 'vector) (-> s5-0 normal))) + (vector-normalize! s3-1 10240.0) + (vector-copy! (-> s4-1 0) s3-1) + (vector-cross! (-> s4-1 1) s3-1 (-> s5-0 normal)) + (vector-negate! (-> s4-1 2) s3-1) + (vector-cross! (-> s4-1 3) (-> s5-0 normal) s3-1) + (vector-float*! s3-1 (-> s5-0 normal) 3072.0) + (dotimes (v1-28 4) + (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) s3-1) + (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) (-> s5-0 collision-pt)) + ) + (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)) + ) + (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) ) - (fill-using-bounding-box *collide-cache* s3-2) + (set! (-> s3-2 collide-with) (collide-spec backgnd pusher)) + (set! (-> s3-2 ignore-process0) #f) + (set! (-> s3-2 ignore-process1) #f) + (set! (-> s3-2 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> s3-2 action-mask) (collide-action solid)) + (mem-copy! (the-as pointer (-> s3-2 bbox)) (the-as pointer a1-20) 32) ) - (dotimes (s3-3 4) - (vector-copy! (-> gp-0 start-pos) (-> s4-1 s3-3)) - (when (< (probe-using-line-sphere *collide-cache* gp-0) 0.0) - (set! (-> s5-0 found?) #f) - (return 0) - ) + (fill-using-bounding-box *collide-cache* s3-2) + ) + (dotimes (s3-3 4) + (vector-copy! (-> gp-0 start-pos) (-> s4-1 s3-3)) + (when (< (probe-using-line-sphere *collide-cache* gp-0) 0.0) + (set! (-> s5-0 found?) #f) + (return 0) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; WARN: Function (method 11 mh-centipede-crater-pt-array) has a return type of none, but the expression builder found a return statement. @@ -1347,49 +1301,28 @@ ) (defmethod probe-ground ((this mh-centipede) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (set-vector! (-> s5-0 move-dist) 0.0 -40960.0 0.0 1.0) - (vector-copy! (-> s5-0 start-pos) arg0) - (+! (-> s5-0 start-pos y) 20480.0) - (let ((v1-3 s5-0)) - (set! (-> v1-3 radius) 409.6) - (set! (-> v1-3 collide-with) (collide-spec backgnd)) - (set! (-> v1-3 ignore-process0) #f) - (set! (-> v1-3 ignore-process1) #f) - (set! (-> v1-3 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-3 action-mask) (collide-action solid)) - ) - (let ((f0-7 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) - (cond - ((>= f0-7 0.0) - (let ((v1-6 (-> s5-0 start-pos))) - (let ((a0-10 (-> s5-0 move-dist))) - (let ((a1-2 f0-7)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-10 quad)) - ) - (.lvf vf4 (&-> v1-6 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 (&-> arg0 quad) vf6) - #t - ) - (else - #f + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (set-vector! (-> s5-0 move-dist) 0.0 -40960.0 0.0 1.0) + (vector-copy! (-> s5-0 start-pos) arg0) + (+! (-> s5-0 start-pos y) 20480.0) + (let ((v1-3 s5-0)) + (set! (-> v1-3 radius) 409.6) + (set! (-> v1-3 collide-with) (collide-spec backgnd)) + (set! (-> v1-3 ignore-process0) #f) + (set! (-> v1-3 ignore-process1) #f) + (set! (-> v1-3 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) + (set! (-> v1-3 action-mask) (collide-action solid)) + ) + (let ((f0-7 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) + (cond + ((>= f0-7 0.0) + (vector+*! arg0 (-> s5-0 start-pos) (-> s5-0 move-dist) f0-7) + #t + ) + (else + #f ) ) ) @@ -1746,132 +1679,117 @@ ;; WARN: Return type mismatch symbol vs object. (defbehavior mh-centipede-active-handler mh-centipede ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (v1-13 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (case arg2 - (('touched) - (let ((s4-0 (the-as touching-shapes-entry (-> arg3 param 0)))) - (cond - ((not s4-0) - ) - ((type? arg0 vehicle) - (when (not (logtest? (-> self flags) (mh-centipede-flag mc6))) - (let ((s2-0 (-> s4-0 head))) - (when s2-0 - (let ((s3-0 (get-touched-prim s2-0 (-> self root) s4-0)) - (s5-1 (new 'stack-no-clear 'vector)) - ) - (when s3-0 - (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) - (.lvf vf1 (&-> s5-1 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-13 vf1) - (let ((f0-1 v1-13) - (f1-0 1.0) - ) - (if (< f0-1 (* f1-0 f1-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 - :mask (vehicle-impulse-factor) - ((id (new-attack-id)) - (damage 4.0) - (vehicle-damage-factor 0.8325) - (vehicle-impulse-factor (* 1.25 (-> (the-as vehicle arg0) info info mass))) - (shield-damage 1.0) - (knock (knocked-type dark-shot)) - (attacker-velocity s5-1) - ) - ) - ) - ) - (logior! (-> self flags) (mh-centipede-flag mc6)) - (nest-hunt-play-speech 5 (-> self effect-sphere)) + (case arg2 + (('touched) + (let ((s4-0 (the-as touching-shapes-entry (-> arg3 param 0)))) + (cond + ((not s4-0) + ) + ((type? arg0 vehicle) + (when (not (logtest? (-> self flags) (mh-centipede-flag mc6))) + (let ((s2-0 (-> s4-0 head))) + (when s2-0 + (let ((s3-0 (get-touched-prim s2-0 (-> self root) s4-0)) + (s5-1 (new 'stack-no-clear 'vector)) ) + (when s3-0 + (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) + ) + ) + (vector-normalize! s5-1 1.0) + (set! (-> s5-1 y) 0.1) + (when (send-event arg0 'attack #f (static-attack-info + :mask (vehicle-impulse-factor) + ((id (new-attack-id)) + (damage 4.0) + (vehicle-damage-factor 0.8325) + (vehicle-impulse-factor (* 1.25 (-> (the-as vehicle arg0) info info mass))) + (shield-damage 1.0) + (knock (knocked-type dark-shot)) + (attacker-velocity s5-1) + ) + ) + ) + ) + (logior! (-> self flags) (mh-centipede-flag mc6)) + (nest-hunt-play-speech 5 (-> self effect-sphere)) ) ) ) ) ) - ((prims-touching? s4-0 (-> self root) (the-as uint -1)) - (if (send-event - (as-type arg0 process-focusable) - 'attack - (-> arg3 param 0) - (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) - (damage 4.0) - (vehicle-damage-factor 1.0) - (vehicle-impulse-factor 1.0) - (knock (knocked-type dark-shot)) - ) - ) - ) - (nest-hunt-play-speech 5 (-> self effect-sphere)) + ) + ((prims-touching? s4-0 (-> self root) (the-as uint -1)) + (if (send-event + (as-type arg0 process-focusable) + 'attack + (-> arg3 param 0) + (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 4.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (knock (knocked-type dark-shot)) + ) + ) ) + (nest-hunt-play-speech 5 (-> self effect-sphere)) + ) + ) + ) + ) + #t + ) + (('attack) + (if (type? arg0 vehicle) + (return (the-as object #f)) + ) + (if (or (< (ja-aframe-num 0) (-> self current-anim vulnerable-start)) + (< (-> self current-anim vulnerable-end) (ja-aframe-num 0)) + ) + (return (the-as object #f)) + ) + (let ((f0-14 1.0) + (v1-50 (the-as attack-info (-> arg3 param 1))) + ) + (when (or (not (logtest? (-> v1-50 mask) (attack-mask id))) (!= (-> self incoming-attack-id) (-> v1-50 id))) + (if (logtest? (-> v1-50 mask) (attack-mask id)) + (set! (-> self incoming-attack-id) (-> v1-50 id)) + ) + (if (logtest? (attack-mask damage) (-> v1-50 mask)) + (set! f0-14 (-> v1-50 damage)) + ) + (if (and (-> self next-state) (= (-> self next-state name) 'shooting)) + (set! f0-14 (/ f0-14 2)) + ) + (if (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) + (set! f0-14 (* 0.6666667 f0-14)) + ) + (set! (-> self hit-points) (fmax 0.0 (- (-> self hit-points) f0-14))) + (set! (-> *game-info* health-bar) (-> self hit-points)) + (cond + ((= (-> self hit-points) 0.0) + (go-virtual die) ) - ) - ) - #t - ) - (('attack) - (if (type? arg0 vehicle) - (return (the-as object #f)) - ) - (if (or (< (ja-aframe-num 0) (-> self current-anim vulnerable-start)) - (< (-> self current-anim vulnerable-end) (ja-aframe-num 0)) - ) - (return (the-as object #f)) - ) - (let ((f0-14 1.0) - (v1-50 (the-as attack-info (-> arg3 param 1))) - ) - (when (or (not (logtest? (-> v1-50 mask) (attack-mask id))) (!= (-> self incoming-attack-id) (-> v1-50 id))) - (if (logtest? (-> v1-50 mask) (attack-mask id)) - (set! (-> self incoming-attack-id) (-> v1-50 id)) - ) - (if (logtest? (attack-mask damage) (-> v1-50 mask)) - (set! f0-14 (-> v1-50 damage)) - ) - (if (and (-> self next-state) (= (-> self next-state name) 'shooting)) - (set! f0-14 (/ f0-14 2)) - ) - (if (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) - (set! f0-14 (* 0.6666667 f0-14)) - ) - (set! (-> self hit-points) (fmax 0.0 (- (-> self hit-points) f0-14))) - (set! (-> *game-info* health-bar) (-> self hit-points)) - (cond - ((= (-> self hit-points) 0.0) - (go-virtual die) - ) - ((= f0-14 0.0) - ) - ((< (-> self hit-points) 20.0) - (nest-hunt-play-speech 3 (-> self effect-sphere)) - ) - (else - (nest-hunt-play-speech 2 (-> self effect-sphere)) - ) + ((= f0-14 0.0) + ) + ((< (-> self hit-points) 20.0) + (nest-hunt-play-speech 3 (-> self effect-sphere)) + ) + (else + (nest-hunt-play-speech 2 (-> self effect-sphere)) ) ) ) - #t ) - ) + #t + ) ) ) diff --git a/goal_src/jak3/levels/nest/nst-part.gc b/goal_src/jak3/levels/nest/nst-part.gc index cd37b30c29..c3514e5844 100644 --- a/goal_src/jak3/levels/nest/nst-part.gc +++ b/goal_src/jak3/levels/nest/nst-part.gc @@ -1233,7 +1233,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 8192.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1332,7 +1332,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 32768.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1431,7 +1431,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 20480.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1530,7 +1530,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 16384.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1629,7 +1629,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 24576.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1728,7 +1728,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 24576.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1827,7 +1827,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 8192.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1926,7 +1926,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 32768.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -2025,7 +2025,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 28672.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -2235,7 +2235,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 8192.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) diff --git a/goal_src/jak3/levels/precursor/precura-obs.gc b/goal_src/jak3/levels/precursor/precura-obs.gc index e803804e52..dacfcb8b78 100644 --- a/goal_src/jak3/levels/precursor/precura-obs.gc +++ b/goal_src/jak3/levels/precursor/precura-obs.gc @@ -2164,91 +2164,28 @@ ;; WARN: Return type mismatch (pointer process) vs (pointer joint-exploder). (defmethod spawn-exploder ((this precur-door-c)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((s4-0 (new 'stack-no-clear 'vector)) - (f0-0 (rand-vu-float-range 0.5 1.5)) - ) - (let ((v1-1 (-> gp-0 fountain-rand-transv-lo))) - (let ((a0-4 (-> this root trans))) - (let ((a1-2 *up-vector*)) - (let ((a2-1 0.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-2 quad)) - ) - (.lvf vf4 (&-> a0-4 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-1 quad) vf6) + (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (f0-0 (rand-vu-float-range 0.5 1.5)) ) - (vector-reset! s4-0) - (let ((a1-3 s4-0)) - (let ((v1-3 s4-0)) - (let ((a0-5 *up-vector*)) - (let ((a2-3 40960.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-5 quad)) - ) - (.lvf vf4 (&-> v1-3 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-3 quad) vf6) - ) - (let ((a1-4 (-> gp-0 fountain-rand-transv-lo))) - (let ((v1-4 s4-0)) - (let ((a0-6 *identity-vector*)) - (let ((a2-5 (* -204800.0 f0-0))) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-6 quad)) - ) - (.lvf vf4 (&-> v1-4 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-4 quad) vf6) - ) - (let ((a0-7 (-> gp-0 fountain-rand-transv-hi))) - (let ((v1-5 *identity-vector*)) - (let ((a1-6 (* 204800.0 f0-0))) - (.mov vf7 a1-6) - ) - (.lvf vf5 (&-> v1-5 quad)) - ) - (.lvf vf4 (&-> s4-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-7 quad) vf6) - ) - ) - (set! (-> gp-0 gravity) -122880.0) - (set! (-> gp-0 rot-speed) 16.0) - (set! (-> gp-0 friction) 0.3) - (process-spawn - joint-exploder - (art-group-get-by-name *level* "skel-precur-door-c-explode" (the-as (pointer level) #f)) - 5 - gp-0 - *precur-door-c-exploder-params* - :name "joint-exploder" - :to this - :unk 0 - ) + (vector+*! (-> gp-0 fountain-rand-transv-lo) (-> this root trans) *up-vector* 0.0) + (vector-reset! s4-0) + (vector+*! s4-0 s4-0 *up-vector* 40960.0) + (vector+*! (-> gp-0 fountain-rand-transv-lo) s4-0 *identity-vector* (* -204800.0 f0-0)) + (vector+*! (-> gp-0 fountain-rand-transv-hi) s4-0 *identity-vector* (* 204800.0 f0-0)) + ) + (set! (-> gp-0 gravity) -122880.0) + (set! (-> gp-0 rot-speed) 16.0) + (set! (-> gp-0 friction) 0.3) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-precur-door-c-explode" (the-as (pointer level) #f)) + 5 + gp-0 + *precur-door-c-exploder-params* + :name "joint-exploder" + :to this + :unk 0 ) ) ) diff --git a/goal_src/jak3/levels/precursor/precurc-obs.gc b/goal_src/jak3/levels/precursor/precurc-obs.gc index 1adf852d40..b2535d1307 100644 --- a/goal_src/jak3/levels/precursor/precurc-obs.gc +++ b/goal_src/jak3/levels/precursor/precurc-obs.gc @@ -244,106 +244,69 @@ (defmethod swingpole-method-22 ((this precur-swingpole-pop)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (-> this moving?) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (let ((s4-0 (-> this node-list data 3))) - 0.0 - (cond - ((zero? (-> this paused-time)) - (+! (-> this tt) (* 0.5 (seconds-per-frame))) - (when (< 1.0 (-> this tt)) - (let ((f0-4 (-> this tt))) - (set! (-> this tt) (- f0-4 (* (the float (the int (/ f0-4 1.0))) 1.0))) - ) - (set-time! (-> this paused-time)) + (when (-> this moving?) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((s4-0 (-> this node-list data 3))) + 0.0 + (cond + ((zero? (-> this paused-time)) + (+! (-> this tt) (* 0.5 (seconds-per-frame))) + (when (< 1.0 (-> this tt)) + (let ((f0-4 (-> this tt))) + (set! (-> this tt) (- f0-4 (* (the float (the int (/ f0-4 1.0))) 1.0))) ) + (set-time! (-> this paused-time)) ) - (else - (when (time-elapsed? (-> this paused-time) (seconds 1)) - (set! (-> this paused-time) 0) - (sound-play "spike-retract") - (set! (-> this halfway?) #f) - ) + ) + (else + (when (time-elapsed? (-> this paused-time) (seconds 1)) + (set! (-> this paused-time) 0) + (sound-play "spike-retract") + (set! (-> this halfway?) #f) ) ) - (when (and (not (-> this halfway?)) (< 0.5 (-> this tt))) - (set! (-> this halfway?) #t) - (sound-play "spike-reveal") - ) - (let ((f0-9 (cos (* 65536.0 (-> this tt))))) - (set! (-> this movedist) (* 20480.0 (+ -1.0 f0-9))) - ) - (vector-copy! s5-0 (-> this entity extra trans)) - (vector-normalize-copy! (-> this dir) (-> s4-0 bone transform fvec) 1.0) ) - (let ((a1-3 s5-0)) - (let ((v1-30 s5-0)) - (let ((a0-12 (-> this dir))) - (let ((a2-3 (-> this movedist))) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-12 quad)) - ) - (.lvf vf4 (&-> v1-30 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-3 quad) vf6) + (when (and (not (-> this halfway?)) (< 0.5 (-> this tt))) + (set! (-> this halfway?) #t) + (sound-play "spike-reveal") ) - (move-to-point! (-> this root) s5-0) - ) - (when (and (-> this moving?) - (< (fabs (-> this movedist)) 1228.8) - (< 122880.0 (vector-vector-distance (target-pos 0) (-> this entity extra trans))) - ) - (set! (-> this moving?) #f) - (set! (-> this player-grabbed?) #f) - (set-time! (-> this stopped-time)) + (let ((f0-9 (cos (* 65536.0 (-> this tt))))) + (set! (-> this movedist) (* 20480.0 (+ -1.0 f0-9))) + ) + (vector-copy! s5-0 (-> this entity extra trans)) + (vector-normalize-copy! (-> this dir) (-> s4-0 bone transform fvec) 1.0) ) + (vector+*! s5-0 s5-0 (-> this dir) (-> this movedist)) + (move-to-point! (-> this root) s5-0) ) - (when (-> this player-grabbed?) - (let ((s5-2 (new 'stack-no-clear 'vector))) - (vector-copy! s5-2 (-> this entity extra trans)) - (seek! (-> this movedist) 0.0 (* 36864.0 (seconds-per-frame))) - (let ((a1-7 s5-2)) - (let ((v1-48 s5-2)) - (let ((a0-21 (-> this dir))) - (let ((a2-5 (-> this movedist))) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-21 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-7 quad) vf6) - ) - (move-to-point! (-> this root) s5-2) - ) - ) - (when (and (not (-> this moving?)) (and (not (-> this player-grabbed?)) - (time-elapsed? (-> this stopped-time) (seconds 0.5)) - (< (vector-vector-distance (target-pos 0) (-> this root trans)) 122880.0) - ) + (when (and (-> this moving?) + (< (fabs (-> this movedist)) 1228.8) + (< 122880.0 (vector-vector-distance (target-pos 0) (-> this entity extra trans))) ) - (set! (-> this moving?) #t) + (set! (-> this moving?) #f) (set! (-> this player-grabbed?) #f) (set-time! (-> this stopped-time)) ) - (call-parent-method this) - (none) ) + (when (-> this player-grabbed?) + (let ((s5-2 (new 'stack-no-clear 'vector))) + (vector-copy! s5-2 (-> this entity extra trans)) + (seek! (-> this movedist) 0.0 (* 36864.0 (seconds-per-frame))) + (vector+*! s5-2 s5-2 (-> this dir) (-> this movedist)) + (move-to-point! (-> this root) s5-2) + ) + ) + (when (and (not (-> this moving?)) (and (not (-> this player-grabbed?)) + (time-elapsed? (-> this stopped-time) (seconds 0.5)) + (< (vector-vector-distance (target-pos 0) (-> this root trans)) 122880.0) + ) + ) + (set! (-> this moving?) #t) + (set! (-> this player-grabbed?) #f) + (set-time! (-> this stopped-time)) + ) + (call-parent-method this) + (none) ) (defstate idle (precur-swingpole-pop) diff --git a/goal_src/jak3/levels/sewer/kg-hopper.gc b/goal_src/jak3/levels/sewer/kg-hopper.gc index 212402f2e1..862bd8acc2 100644 --- a/goal_src/jak3/levels/sewer/kg-hopper.gc +++ b/goal_src/jak3/levels/sewer/kg-hopper.gc @@ -590,82 +590,59 @@ (defmethod kg-hopper-method-191 ((this kg-hopper)) (local-vars (sv-752 collide-query)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (+! (-> this step-num) -1) + (cond + ((>= (-> this step-num) 0) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (vector-rotate-around-y! + s3-0 + (-> this direction) + (* 182.04445 (the float (+ (* (-> this step-num) 16) -135))) ) - (init-vf0-vector) - (+! (-> this step-num) -1) - (cond - ((>= (-> this step-num) 0) - (let ((s3-0 (new 'stack-no-clear 'vector)) - (s5-0 (new 'stack-no-clear 'vector)) + (vector+*! s5-0 (-> this origin) s3-0 (-> this jump-dist)) + (let ((v1-8 (-> this nav)) + (a0-3 s5-0) + (a1-3 (new 'stack-no-clear 'nav-poly)) ) - (vector-rotate-around-y! - s3-0 - (-> this direction) - (* 182.04445 (the float (+ (* (-> this step-num) 16) -135))) - ) - (let ((a1-1 s5-0)) - (let ((v1-7 (-> this origin))) - (let ((a0-2 s3-0)) - (let ((a2-1 (-> this jump-dist))) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-7 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-1 quad) vf6) - ) - (let ((v1-8 (-> this nav)) - (a0-3 s5-0) - (a1-2 (new 'stack-no-clear 'nav-poly)) - ) - (vector-! (-> a1-2 vertex 0) a0-3 (the-as vector (-> v1-8 state mesh bounds))) - (set! (-> a1-2 vertex1 x) (-> v1-8 nearest-y-threshold)) - (set! (-> a1-2 data 20) (the-as uint 2)) - (let ((s4-0 (nav-mesh-method-45 (-> v1-8 state mesh) a1-2))) - (when s4-0 - (let ((f30-0 (vector-dot s3-0 (-> this direction)))) - (new 'stack-no-clear 'vector) - (let ((a1-3 (new 'stack-no-clear 'vector))) - (vector-copy! a1-3 s5-0) - (set! (-> a1-3 w) 6144.0) - (when (not (check-sphere-blocked! (-> this nav) a1-3 #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-5 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-5 (the-as vector sv-752) t0-1) + (vector-! (-> a1-3 vertex 0) a0-3 (the-as vector (-> v1-8 state mesh bounds))) + (set! (-> a1-3 vertex1 x) (-> v1-8 nearest-y-threshold)) + (set! (-> a1-3 data 20) (the-as uint 2)) + (let ((s4-0 (nav-mesh-method-45 (-> v1-8 state mesh) a1-3))) + (when s4-0 + (let ((f30-0 (vector-dot s3-0 (-> this direction)))) + (new 'stack-no-clear 'vector) + (let ((a1-4 (new 'stack-no-clear 'vector))) + (vector-copy! a1-4 s5-0) + (set! (-> a1-4 w) 6144.0) + (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) ) - (vector+! s1-0 s1-0 (the-as vector (-> s0-0 state mesh bounds))) + (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) ) - 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+! 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) ) + (vector-copy! (-> this best-point) s5-0) ) ) ) @@ -673,11 +650,11 @@ ) ) ) - #t ) - (else - #f - ) + #t + ) + (else + #f ) ) ) diff --git a/goal_src/jak3/levels/sewer/saberfish-spawner.gc b/goal_src/jak3/levels/sewer/saberfish-spawner.gc index c357419576..cb744306c2 100644 --- a/goal_src/jak3/levels/sewer/saberfish-spawner.gc +++ b/goal_src/jak3/levels/sewer/saberfish-spawner.gc @@ -334,49 +334,35 @@ ) (defmethod saberfish-spawner-method-22 ((this saberfish-spawner) (arg0 vector) (arg1 saberfish-find-behavior)) - (local-vars (v1-16 float) (sv-64 nav-poly) (sv-72 int) (sv-80 number) (sv-84 vector) (sv-88 symbol)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (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))) - (.lvf vf1 (&-> (-> sv-64 vertex) 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-16 vf1) - (let ((f0-1 v1-16) - (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) - ) + (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) ) ) ) ) ) ) - sv-72 ) + sv-72 ) (defmethod relocate ((this saberfish-spawner) (offset int)) diff --git a/goal_src/jak3/levels/sewer/saberfish.gc b/goal_src/jak3/levels/sewer/saberfish.gc index 9bc0e4055f..4acd38899e 100644 --- a/goal_src/jak3/levels/sewer/saberfish.gc +++ b/goal_src/jak3/levels/sewer/saberfish.gc @@ -967,45 +967,28 @@ ) (defbehavior saberfish-chase-post saberfish () - (local-vars (v1-10 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((a0-1 (handle->process (-> self focus handle)))) - (when a0-1 - (let ((gp-0 (get-trans (the-as process-focusable a0-1) 1))) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-! s5-0 (-> self root trans) gp-0) - (let ((f0-0 16384.0)) - (.lvf vf1 (&-> s5-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-10 vf1) - (if (< f0-0 v1-10) - (vector-normalize! s5-0 16384.0) - ) + (let ((a0-1 (handle->process (-> self focus handle)))) + (when a0-1 + (let ((gp-0 (get-trans (the-as process-focusable a0-1) 1))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-! s5-0 (-> self root trans) gp-0) + (if (< 16384.0 (vector-length-squared s5-0)) + (vector-normalize! s5-0 16384.0) ) - (vector+! gp-0 gp-0 s5-0) - ) - (let ((v1-15 (-> self nav state))) - (logclear! (-> v1-15 flags) (nav-state-flag directional-mode)) - (logior! (-> v1-15 flags) (nav-state-flag target-poly-dirty)) - (vector-copy! (-> v1-15 target-pos) gp-0) - ) + (vector+! gp-0 gp-0 s5-0) + ) + (let ((v1-15 (-> self nav state))) + (logclear! (-> v1-15 flags) (nav-state-flag directional-mode)) + (logior! (-> v1-15 flags) (nav-state-flag target-poly-dirty)) + (vector-copy! (-> v1-15 target-pos) gp-0) ) - 0 ) + 0 ) - (nav-enemy-method-187 self) - 0 - (none) ) + (nav-enemy-method-187 self) + 0 + (none) ) (defstate hit (saberfish) @@ -1460,7 +1443,7 @@ (vector-float*! (-> self post-spinflip-expected-heading) (-> self post-spinflip-expected-heading) -1.0) (let ((gp-0 #f)) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (set! (-> self root transv quad) (the-as uint128 0)) (vector-float*! (-> self root transv) (-> self root transv) -1.0) (vector-v++! (-> self root trans) (-> self root transv)) @@ -1695,7 +1678,7 @@ (let ((f30-1 (fmin (acos f28-0) (* 0.53333336 (seconds-per-frame) f30-0)))) (vector-cross! s4-1 gp-0 s5-0) (vector-normalize! s4-1 1.0) - (vector-rotate-around-axis! gp-0 (the-as quaternion gp-0) f30-1 s4-1) + (vector-rotate-around-axis! gp-0 gp-0 f30-1 s4-1) ) ) (set! (-> gp-0 y) 0.0) @@ -2084,7 +2067,7 @@ (ja-no-eval :group! (-> self draw art-group data (-> self jump land-anim)) :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (set! (-> self root transv quad) (the-as uint128 0)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-x-vel adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) (vector-v++! (-> self root trans) (-> self root transv)) (set! (-> self root transv quad) (the-as uint128 0)) @@ -2180,7 +2163,7 @@ (set! (-> gp-0 y) 0.0) (vector-normalize! gp-0 (-> self swim-speed)) (vector-v++! (-> self root trans) gp-0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) (set! (-> self root transv x) 0.0) (set! (-> self root transv z) 0.0) @@ -2203,7 +2186,7 @@ (defbehavior jump-from-land-dive-anim saberfish () (let ((f30-0 1.0)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (cond ((< (ja-frame-num 0) 4.5) (align! (-> self align) (align-opts adjust-x-vel adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) @@ -3068,7 +3051,7 @@ (when (saberfish-method-243 this) (case arg0 (((jump-stage landing)) - (compute-alignment! (-> this align)) + (compute-delta-align! (-> this align)) (align! (-> this align) (align-opts adjust-x-vel adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) (vector-v++! (-> this root trans) (-> this root transv)) (when (< (ja-frame-num 0) 8.0) diff --git a/goal_src/jak3/levels/sewer/sewer-move-turret.gc b/goal_src/jak3/levels/sewer/sewer-move-turret.gc index 713b3691db..107f5464bb 100644 --- a/goal_src/jak3/levels/sewer/sewer-move-turret.gc +++ b/goal_src/jak3/levels/sewer/sewer-move-turret.gc @@ -380,36 +380,18 @@ ) (defmethod projectile-method-25 ((this sew-move-turret-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((a1-0 (-> this root trans)) + (v1-1 (-> this tail-pos)) + (a0-2 (vector-! (new 'stack-no-clear 'vector) a1-0 v1-1)) ) - (init-vf0-vector) - (let* ((a1-0 (-> this root trans)) - (v1-1 (-> this tail-pos)) - (a0-2 (vector-! (new 'stack-no-clear 'vector) a1-0 v1-1)) - ) - (vector-length a0-2) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (let ((a1-4 0.8)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-2 quad)) - (.lvf vf4 (&-> v1-1 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 (&-> gp-0 quad) vf6) - (launch-particles (-> *part-id-table* 4940) gp-0) - (launch-particles (-> *part-id-table* 4941) gp-0) - ) + (vector-length a0-2) + (let ((gp-1 (vector+*! (new 'stack-no-clear 'vector) v1-1 a0-2 0.8))) + (launch-particles (-> *part-id-table* 4940) gp-1) + (launch-particles (-> *part-id-table* 4941) gp-1) ) - 0 - (none) ) + 0 + (none) ) (defmethod projectile-method-24 ((this sew-move-turret-shot)) diff --git a/goal_src/jak3/levels/stadium/dm-mine-spider.gc b/goal_src/jak3/levels/stadium/dm-mine-spider.gc index bf76ef78b9..7e2a9a88a4 100644 --- a/goal_src/jak3/levels/stadium/dm-mine-spider.gc +++ b/goal_src/jak3/levels/stadium/dm-mine-spider.gc @@ -755,73 +755,52 @@ ) (defmethod dm-mine-spider-method-192 ((this dm-mine-spider)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((a0-5 (as-type (handle->process (-> this focus handle)) process-focusable))) - (when a0-5 - (let* ((v1-5 (get-trans (the-as process-focusable a0-5) 0)) - (s4-1 (vector-! (new 'stack-no-clear 'vector) v1-5 (-> this root trans))) - (f30-0 (vector-length s4-1)) - (s5-1 (new 'stack-no-clear 'vector)) - ) - (let ((s3-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) - (let ((a1-4 (-> this nav state))) - (vector-copy! s5-1 (-> a1-4 target-pos)) - ) - (set! (-> s4-1 y) 0.0) - (vector-normalize! s4-1 1.0) - (cond - ((< f30-0 8192.0) - (go (method-of-object this attack)) - ) - ((time-elapsed? (-> this last-change-dir) (-> this change-dir-time)) - (if (rand-vu-percent? 0.25) - (go (method-of-object this run-stop)) - ) - (set-time! (-> this last-change-dir)) - (set! (-> this change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) - (if (< (vector-dot s4-1 s3-0) 0.0) - (vector-rotate-around-y! s4-1 s3-0 (if (rand-vu-percent? 0.5) - 24576.0 - -24576.0 - ) - ) - ) - (vector-deg-seek s4-1 s3-0 s4-1 16384.0) - (let ((v1-30 s5-1)) - (let ((a0-20 (-> this root trans))) - (let ((a1-13 (+ 40960.0 (* 0.4 f30-0)))) - (.mov vf7 a1-13) - ) - (.lvf vf5 (&-> s4-1 quad)) - (.lvf vf4 (&-> a0-20 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-30 quad) vf6) - ) - ) - ) + (let ((a0-5 (as-type (handle->process (-> this focus handle)) process-focusable))) + (when a0-5 + (let* ((v1-5 (get-trans (the-as process-focusable a0-5) 0)) + (s4-1 (vector-! (new 'stack-no-clear 'vector) v1-5 (-> this root trans))) + (f30-0 (vector-length s4-1)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (let ((s3-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) + (let ((a1-4 (-> this nav state))) + (vector-copy! s5-1 (-> a1-4 target-pos)) ) - (let ((v1-32 (-> this nav state))) - (logclear! (-> v1-32 flags) (nav-state-flag directional-mode)) - (logior! (-> v1-32 flags) (nav-state-flag target-poly-dirty)) - (vector-copy! (-> v1-32 target-pos) s5-1) + (set! (-> s4-1 y) 0.0) + (vector-normalize! s4-1 1.0) + (cond + ((< f30-0 8192.0) + (go (method-of-object this attack)) + ) + ((time-elapsed? (-> this last-change-dir) (-> this change-dir-time)) + (if (rand-vu-percent? 0.25) + (go (method-of-object this run-stop)) + ) + (set-time! (-> this last-change-dir)) + (set! (-> this change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) + (if (< (vector-dot s4-1 s3-0) 0.0) + (vector-rotate-around-y! s4-1 s3-0 (if (rand-vu-percent? 0.5) + 24576.0 + -24576.0 + ) + ) + ) + (vector-deg-seek s4-1 s3-0 s4-1 16384.0) + (vector+*! s5-1 (-> this root trans) s4-1 (+ 40960.0 (* 0.4 f30-0))) + ) ) ) - 0 + (let ((v1-33 (-> this nav state))) + (logclear! (-> v1-33 flags) (nav-state-flag directional-mode)) + (logior! (-> v1-33 flags) (nav-state-flag target-poly-dirty)) + (vector-copy! (-> v1-33 target-pos) s5-1) + ) ) + 0 ) - 0 - (none) ) + 0 + (none) ) ;; WARN: Return type mismatch float vs none. diff --git a/goal_src/jak3/levels/stadium/king-rider.gc b/goal_src/jak3/levels/stadium/king-rider.gc index 01b6c0dfa5..f2a6a3cc3f 100644 --- a/goal_src/jak3/levels/stadium/king-rider.gc +++ b/goal_src/jak3/levels/stadium/king-rider.gc @@ -112,58 +112,41 @@ ) ) :trans (behavior () - (local-vars (v1-26 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (king-pilot-trans) - (cond - ((and *target* - (focus-test? *target* pilot-riding) - (nonzero? (-> *target* pilot)) - (-> self parent) - (-> self parent 0) - (= *target* (find-rider (-> self parent 0))) - ) - (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)) - ) - (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))) - ) - (set! (-> self complain-speech) (mod (+ (-> self complain-speech) (rand-vu-int-range 2 6)) 9)) - (set-time! (-> self complain-time)) - ) + (king-pilot-trans) + (cond + ((and *target* + (focus-test? *target* pilot-riding) + (nonzero? (-> *target* pilot)) + (-> self parent) + (-> self parent 0) + (= *target* (find-rider (-> self parent 0))) + ) + (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)) + ) + (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))) + ) + (set! (-> self complain-speech) (mod (+ (-> self complain-speech) (rand-vu-int-range 2 6)) 9)) + (set-time! (-> self complain-time)) ) ) ) - (let* ((f0-4 20480.0) - (f0-6 (* f0-4 f0-4)) - ) - (.lvf vf1 (&-> (-> *target* control 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 v1-26 vf1) - (if (< f0-6 v1-26) - (set-time! (-> self last-moved-time)) - ) - ) - (if (time-elapsed? (-> self last-moved-time) (seconds 8)) - (set! (-> self last-moved-time) (+ (current-time) (seconds 24))) + ) + (let ((f0-4 20480.0)) + (if (< (* f0-4 f0-4) (vector-length-squared (-> *target* control transv))) + (set-time! (-> self last-moved-time)) ) ) - (else - (set-time! (-> self last-moved-time)) - ) + (if (time-elapsed? (-> self last-moved-time) (seconds 8)) + (set! (-> self last-moved-time) (+ (current-time) (seconds 24))) + ) + ) + (else + (set-time! (-> self last-moved-time)) ) ) ) diff --git a/goal_src/jak3/levels/stadium/rubble-obs.gc b/goal_src/jak3/levels/stadium/rubble-obs.gc index 2828c12eee..a8e35701c0 100644 --- a/goal_src/jak3/levels/stadium/rubble-obs.gc +++ b/goal_src/jak3/levels/stadium/rubble-obs.gc @@ -676,60 +676,37 @@ ) (defmethod toggle-blocking-plane ((this rub-elec-gate) (arg0 symbol)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (cond - (arg0 - (when (and (nonzero? (-> this path)) (nonzero? (-> this path-r))) - (let ((gp-0 (new 'static 'inline-array vector 2 (new 'static 'vector) (new 'static 'vector)))) - (let ((s4-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (get-point-at-percent-along-path! (-> this path) (-> gp-0 0) 0.0 'interp) - (get-point-at-percent-along-path! (-> this path) (-> gp-0 1) 1.0 'interp) - (vector-! s3-0 (-> gp-0 1) (-> gp-0 0)) - (get-point-at-percent-along-path! (-> this path-r) (-> gp-0 1) 0.0 'interp) - (vector-! s2-0 (-> gp-0 1) (-> gp-0 0)) - (set! (-> this width) (vector-length s2-0)) - (set! (-> this height) (vector-length s3-0)) - (let ((a1-8 (-> this root trans))) - (let ((v1-17 (-> gp-0 0))) - (let ((a0-7 s2-0)) - (let ((a2-4 0.5)) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a0-7 quad)) - ) - (.lvf vf4 (&-> v1-17 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-8 quad) vf6) + (cond + (arg0 + (when (and (nonzero? (-> this path)) (nonzero? (-> this path-r))) + (let ((gp-0 (new 'static 'inline-array vector 2 (new 'static 'vector) (new 'static 'vector)))) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) ) - (vector-normalize! (vector-cross! s4-0 s2-0 s3-0) 1.0) - (quaternion-look-at! (-> this root quat) s4-0 s3-0) - ) - (+! (-> gp-0 0 y) -20480.0) - (+! (-> gp-0 1 y) -20480.0) - (blocking-plane-spawn (the-as curve-control #f) gp-0 122880.0) + (get-point-at-percent-along-path! (-> this path) (-> gp-0 0) 0.0 'interp) + (get-point-at-percent-along-path! (-> this path) (-> gp-0 1) 1.0 'interp) + (vector-! s3-0 (-> gp-0 1) (-> gp-0 0)) + (get-point-at-percent-along-path! (-> this path-r) (-> gp-0 1) 0.0 'interp) + (vector-! s2-0 (-> gp-0 1) (-> gp-0 0)) + (set! (-> this width) (vector-length s2-0)) + (set! (-> this height) (vector-length s3-0)) + (vector+*! (-> this root trans) (-> gp-0 0) s2-0 0.5) + (vector-normalize! (vector-cross! s4-0 s2-0 s3-0) 1.0) + (quaternion-look-at! (-> this root quat) s4-0 s3-0) ) + (+! (-> gp-0 0 y) -20480.0) + (+! (-> gp-0 1 y) -20480.0) + (blocking-plane-spawn (the-as curve-control #f) gp-0 122880.0) ) ) - (else - (blocking-plane-destroy) - ) ) - 0 - (none) + (else + (blocking-plane-destroy) + ) ) + 0 + (none) ) ;; WARN: Return type mismatch process-drawable vs rub-elec-gate. diff --git a/goal_src/jak3/levels/temple/temple-obs.gc b/goal_src/jak3/levels/temple/temple-obs.gc index 5f8c1fb84e..e1b8f3bac3 100644 --- a/goal_src/jak3/levels/temple/temple-obs.gc +++ b/goal_src/jak3/levels/temple/temple-obs.gc @@ -1270,113 +1270,78 @@ ) (defmethod swingpole-method-22 ((this tpl-elec-swing-pole)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((t9-0 (method-of-type swingpole swingpole-method-22))) - (t9-0 this) - ) - (cond - ((-> this electrify) - (let ((f30-0 (-> *part-id-table* 2620 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 2620 init-specs 4 initial-valuef) (-> this edge-length)) - (draw-beam (-> *part-id-table* 2620) (-> this root trans) (-> this dir) #f) - (set! (-> *part-id-table* 2620 init-specs 4 initial-valuef) f30-0) - ) - (dotimes (s5-0 4) - (let ((f30-1 (rand-vu-float-range 0.0 (-> this edge-length))) - (f0-3 (rand-vu-float-range 0.0 (-> this edge-length))) - ) - (let ((a0-5 (-> this lightning s5-0)) - (v1-16 (new 'stack-no-clear 'vector)) - ) - (let ((a1-4 (-> this root trans))) - (let ((a2-1 (-> this dir))) - (let ((a3-1 f30-1)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-1 quad)) - ) - (.lvf vf4 (&-> a1-4 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-16 quad) vf6) - (set! (-> a0-5 state meet data 0 quad) (-> v1-16 quad)) - ) - (let ((a0-8 (-> this lightning s5-0)) - (v1-20 (new 'stack-no-clear 'vector)) - ) - (let ((a1-6 (-> this root trans))) - (let ((a2-2 (-> this dir))) - (let ((a3-2 f0-3)) - (.mov vf7 a3-2) - ) - (.lvf vf5 (&-> a2-2 quad)) - ) - (.lvf vf4 (&-> a1-6 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-20 quad) vf6) - (vector-copy! (-> a0-8 state meet data (+ (-> a0-8 state points-to-draw) -1)) v1-20) - ) - ) - (let ((v1-24 (-> this lightning s5-0)) - (a0-11 2) - ) - (let ((a1-12 (!= a0-11 (-> v1-24 state mode)))) - (case a0-11 - ((3) - (if a1-12 - (set! (-> v1-24 state counter) 0.0) - ) - ) - ((1) - (set! (-> v1-24 state start-color) (-> v1-24 spec start-color)) - (set! (-> v1-24 state end-color) (-> v1-24 spec end-color)) - ) - ) - ) - (set! (-> v1-24 state mode) (the-as uint a0-11)) - ) - ) - (sound-play "pole-hum-loop" :id (-> this sound-id)) + (let ((t9-0 (method-of-type swingpole swingpole-method-22))) + (t9-0 this) + ) + (cond + ((-> this electrify) + (let ((f30-0 (-> *part-id-table* 2620 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 2620 init-specs 4 initial-valuef) (-> this edge-length)) + (draw-beam (-> *part-id-table* 2620) (-> this root trans) (-> this dir) #f) + (set! (-> *part-id-table* 2620 init-specs 4 initial-valuef) f30-0) ) - (else - (sound-stop (-> this sound-id)) - (dotimes (v1-30 4) - (let ((a0-18 (-> this lightning v1-30)) - (a1-22 0) - ) - (let ((a2-6 (!= a1-22 (-> a0-18 state mode)))) - (case a1-22 - ((3) - (if a2-6 - (set! (-> a0-18 state counter) 0.0) - ) - ) - ((1) - (set! (-> a0-18 state start-color) (-> a0-18 spec start-color)) - (set! (-> a0-18 state end-color) (-> a0-18 spec end-color)) - ) - ) + (dotimes (s5-0 4) + (let ((f30-1 (rand-vu-float-range 0.0 (-> this edge-length))) + (f0-3 (rand-vu-float-range 0.0 (-> this edge-length))) + ) + (let ((a0-5 (-> this lightning s5-0)) + (v1-17 (vector+*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this dir) f30-1)) + ) + (set! (-> a0-5 state meet data 0 quad) (-> v1-17 quad)) + ) + (let ((a0-8 (-> this lightning s5-0)) + (v1-22 (vector+*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this dir) f0-3)) + ) + (vector-copy! (-> a0-8 state meet data (+ (-> a0-8 state points-to-draw) -1)) v1-22) + ) + ) + (let ((v1-26 (-> this lightning s5-0)) + (a0-11 2) + ) + (let ((a1-12 (!= a0-11 (-> v1-26 state mode)))) + (case a0-11 + ((3) + (if a1-12 + (set! (-> v1-26 state counter) 0.0) + ) + ) + ((1) + (set! (-> v1-26 state start-color) (-> v1-26 spec start-color)) + (set! (-> v1-26 state end-color) (-> v1-26 spec end-color)) + ) + ) + ) + (set! (-> v1-26 state mode) (the-as uint a0-11)) + ) + ) + (sound-play "pole-hum-loop" :id (-> this sound-id)) + ) + (else + (sound-stop (-> this sound-id)) + (dotimes (v1-32 4) + (let ((a0-18 (-> this lightning v1-32)) + (a1-22 0) + ) + (let ((a2-6 (!= a1-22 (-> a0-18 state mode)))) + (case a1-22 + ((3) + (if a2-6 + (set! (-> a0-18 state counter) 0.0) + ) + ) + ((1) + (set! (-> a0-18 state start-color) (-> a0-18 spec start-color)) + (set! (-> a0-18 state end-color) (-> a0-18 spec end-color)) + ) ) - (set! (-> a0-18 state mode) (the-as uint a1-22)) ) + (set! (-> a0-18 state mode) (the-as uint a1-22)) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; WARN: Return type mismatch swingpole vs tpl-elec-swing-pole. @@ -1520,143 +1485,106 @@ (defmethod init-from-entity! ((this tpl-elec-swing-pole) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (stack-size-set! (-> this main-thread) 128) - (set! (-> this y-start) (res-lump-float (-> this entity) 'y-start)) - (set! (-> this y-end) (res-lump-float (-> this entity) 'y-end)) - (set! (-> this electrify) #f) - (set! (-> this sound-id) (new-sound-id)) - (init-collision! this) - (vector-copy! (-> this root trans) (-> arg0 extra trans)) - (quaternion-copy! (-> this root quat) (-> arg0 quat)) - (vector-identity! (-> this root scale)) - (vector-z-quaternion! (-> this dir) (-> this root quat)) - (set! (-> this joint-track) -1) - (set! (-> this y-disable) (+ 37888.0 (-> this root trans y))) - (initialize-skeleton - this - (the-as skeleton-group (art-group-get-by-name *level* "skel-tpl-elec-swing-pole" (the-as (pointer level) #f))) - (the-as pair 0) - ) - (set! (-> this dir y) 0.0) - (vector-normalize! (-> this dir) 1.0) - (set! (-> this edge-length) 8192.0) - (let ((s4-1 (new 'stack-no-clear 'sync-info-params))) - (let ((a0-15 (res-lump-value arg0 'options uint128 :time -1000000000.0)) - (v1-19 0) - ) - (if (not (logtest? (the-as int a0-15) 8)) - (set! v1-19 (logior v1-19 1)) - ) - (set! (-> s4-1 sync-type) 'sync-eased) - (set! (-> s4-1 sync-flags) (the-as sync-flags v1-19)) - ) - (set! (-> s4-1 period) (the-as uint 0)) - (set! (-> s4-1 entity) arg0) - (set! (-> s4-1 percent) 0.0) - (set! (-> s4-1 ease-in) 0.2) - (set! (-> s4-1 ease-out) 0.2) - (set! (-> s4-1 pause-in) 0.0) - (set! (-> s4-1 pause-out) 0.0) - (initialize! (-> this sync) s4-1) - ) - (when (nonzero? (-> this sync period)) - (set! (-> this path) (new 'process 'path-control this 'path 0.0 (the-as entity #f) #f)) - (when (and (zero? (-> this path curve num-cverts)) (-> this entity)) - (set! (-> this path curve num-cverts) 2) - (set! (-> this path curve cverts) (-> (new 'process 'vector-array 2) data)) - (logclear! (-> this path flags) (path-control-flag not-found)) - (let ((v1-39 (-> this path curve cverts 0))) - (let ((a0-30 (-> this entity trans))) - (let ((a1-13 *y-vector*)) - (let ((a2-8 (* 4096.0 (-> this y-start)))) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a1-13 quad)) - ) - (.lvf vf4 (&-> a0-30 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-39 quad) vf6) - ) - (let ((v1-42 (-> this path curve cverts 1))) - (let ((a0-32 (-> this entity trans))) - (let ((a1-14 *y-vector*)) - (let ((a2-10 (* 4096.0 (-> this y-end)))) - (.mov vf7 a2-10) - ) - (.lvf vf5 (&-> a1-14 quad)) - ) - (.lvf vf4 (&-> a0-32 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-42 quad) vf6) - ) - ) - (if (and (nonzero? (-> this path)) (nonzero? (-> this path curve num-cverts))) - (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) - ) - ) - (set! (-> this sound) (new 'process 'ambient-sound (-> this entity) (-> this root trans) 0.0)) - (set! (-> this edge-length) 65536.0) - (dotimes (s5-1 4) - (set! (-> this lightning s5-1) (new - 'process - 'lightning-control - (new 'static 'lightning-spec - :name #f - :flags (lightning-spec-flags lsf0) - :start-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) - :end-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) - :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5) - :fade-start-factor 0.2 - :fade-time 120.0 - :texture (new 'static 'texture-id :index #x3f :page #x4) - :reduction 0.42 - :num-points 10 - :box-size 8192.0 - :merge-factor 0.5 - :merge-count 2 - :radius 512.0 - :duration -1.0 - :sound #f - ) - this - 0.0 - ) - ) - (let ((v1-57 (-> this lightning s5-1)) - (a0-39 0) - ) - (let ((a1-18 (!= a0-39 (-> v1-57 state mode)))) - (case a0-39 - ((3) - (if a1-18 - (set! (-> v1-57 state counter) 0.0) - ) - ) - ((1) - (set! (-> v1-57 state start-color) (-> v1-57 spec start-color)) - (set! (-> v1-57 state end-color) (-> v1-57 spec end-color)) - ) - ) - ) - (set! (-> v1-57 state mode) (the-as uint a0-39)) - ) - ) - (go (method-of-object this idle)) + (stack-size-set! (-> this main-thread) 128) + (set! (-> this y-start) (res-lump-float (-> this entity) 'y-start)) + (set! (-> this y-end) (res-lump-float (-> this entity) 'y-end)) + (set! (-> this electrify) #f) + (set! (-> this sound-id) (new-sound-id)) + (init-collision! this) + (vector-copy! (-> this root trans) (-> arg0 extra trans)) + (quaternion-copy! (-> this root quat) (-> arg0 quat)) + (vector-identity! (-> this root scale)) + (vector-z-quaternion! (-> this dir) (-> this root quat)) + (set! (-> this joint-track) -1) + (set! (-> this y-disable) (+ 37888.0 (-> this root trans y))) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-tpl-elec-swing-pole" (the-as (pointer level) #f))) + (the-as pair 0) ) + (set! (-> this dir y) 0.0) + (vector-normalize! (-> this dir) 1.0) + (set! (-> this edge-length) 8192.0) + (let ((s4-1 (new 'stack-no-clear 'sync-info-params))) + (let ((a0-15 (res-lump-value arg0 'options uint128 :time -1000000000.0)) + (v1-19 0) + ) + (if (not (logtest? (the-as int a0-15) 8)) + (set! v1-19 (logior v1-19 1)) + ) + (set! (-> s4-1 sync-type) 'sync-eased) + (set! (-> s4-1 sync-flags) (the-as sync-flags v1-19)) + ) + (set! (-> s4-1 period) (the-as uint 0)) + (set! (-> s4-1 entity) arg0) + (set! (-> s4-1 percent) 0.0) + (set! (-> s4-1 ease-in) 0.2) + (set! (-> s4-1 ease-out) 0.2) + (set! (-> s4-1 pause-in) 0.0) + (set! (-> s4-1 pause-out) 0.0) + (initialize! (-> this sync) s4-1) + ) + (when (nonzero? (-> this sync period)) + (set! (-> this path) (new 'process 'path-control this 'path 0.0 (the-as entity #f) #f)) + (when (and (zero? (-> this path curve num-cverts)) (-> this entity)) + (set! (-> this path curve num-cverts) 2) + (set! (-> this path curve cverts) (-> (new 'process 'vector-array 2) data)) + (logclear! (-> this path flags) (path-control-flag not-found)) + (vector+*! (-> this path curve cverts 0) (-> this entity trans) *y-vector* (* 4096.0 (-> this y-start))) + (vector+*! (-> this path curve cverts 1) (-> this entity trans) *y-vector* (* 4096.0 (-> this y-end))) + ) + (if (and (nonzero? (-> this path)) (nonzero? (-> this path curve num-cverts))) + (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) + ) + ) + (set! (-> this sound) (new 'process 'ambient-sound (-> this entity) (-> this root trans) 0.0)) + (set! (-> this edge-length) 65536.0) + (dotimes (s5-1 4) + (set! (-> this lightning s5-1) (new + 'process + 'lightning-control + (new 'static 'lightning-spec + :name #f + :flags (lightning-spec-flags lsf0) + :start-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + :end-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5) + :fade-start-factor 0.2 + :fade-time 120.0 + :texture (new 'static 'texture-id :index #x3f :page #x4) + :reduction 0.42 + :num-points 10 + :box-size 8192.0 + :merge-factor 0.5 + :merge-count 2 + :radius 512.0 + :duration -1.0 + :sound #f + ) + this + 0.0 + ) + ) + (let ((v1-59 (-> this lightning s5-1)) + (a0-39 0) + ) + (let ((a1-18 (!= a0-39 (-> v1-59 state mode)))) + (case a0-39 + ((3) + (if a1-18 + (set! (-> v1-59 state counter) 0.0) + ) + ) + ((1) + (set! (-> v1-59 state start-color) (-> v1-59 spec start-color)) + (set! (-> v1-59 state end-color) (-> v1-59 spec end-color)) + ) + ) + ) + (set! (-> v1-59 state mode) (the-as uint a0-39)) + ) + ) + (go (method-of-object this idle)) ) (deftype tpl-spindle (process-drawable) diff --git a/goal_src/jak3/levels/title/title-obs.gc b/goal_src/jak3/levels/title/title-obs.gc index 8629c58289..bb520f802f 100644 --- a/goal_src/jak3/levels/title/title-obs.gc +++ b/goal_src/jak3/levels/title/title-obs.gc @@ -1253,137 +1253,107 @@ ) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (and (nonzero? (-> self id)) (zero? (get-status *gui-control* (-> self id)))) - (set! (-> self id) (new 'static 'sound-id)) - (remove-setting! 'music-volume) - ) - (let ((v1-7 (-> *cpad-list* cpads 0))) - (let ((f1-0 (the float (+ (-> v1-7 rightx) -128))) - (f0-2 (the float (+ (-> v1-7 righty) -128))) - ) - (if (< 64.0 (fabs f1-0)) - (set! (-> self angley) (- (-> self angley) (* 364.0889 (seconds-per-frame) f1-0))) - ) - (when (< 64.0 (fabs f0-2)) - (set! (-> self anglex) (- (-> self anglex) (* 364.0889 (seconds-per-frame) f0-2))) - (set! (-> self anglex) (fmax -5461.3335 (fmin 5461.3335 (-> self anglex)))) + (when (and (nonzero? (-> self id)) (zero? (get-status *gui-control* (-> self id)))) + (set! (-> self id) (new 'static 'sound-id)) + (remove-setting! 'music-volume) + ) + (let ((v1-7 (-> *cpad-list* cpads 0))) + (let ((f1-0 (the float (+ (-> v1-7 rightx) -128))) + (f0-2 (the float (+ (-> v1-7 righty) -128))) ) - ) - (the float (+ (-> v1-7 leftx) -128)) - (let ((f0-10 (the float (+ (-> v1-7 lefty) -128)))) - (when (< 64.0 (fabs f0-10)) - (+! (-> self zoom) (* 204.8 (seconds-per-frame) f0-10)) - (set! (-> self zoom) (fmax (fmin (-> self zoom) (-> self char zoom-max)) (-> self char zoom-min))) + (if (< 64.0 (fabs f1-0)) + (set! (-> self angley) (- (-> self angley) (* 364.0889 (seconds-per-frame) f1-0))) ) - ) - (let ((f1-11 (the float (-> v1-7 abutton (abutton-idx r1)))) ;; og:preserve-this abutton indexing - (f0-18 (the float (-> v1-7 abutton (abutton-idx l1)))) ;; og:preserve-this abutton indexing - ) - (+! (-> self updown) (* 50.0 (seconds-per-frame) f1-11)) - (set! (-> self updown) (- (-> self updown) (* 50.0 (seconds-per-frame) f0-18))) + (when (< 64.0 (fabs f0-2)) + (set! (-> self anglex) (- (-> self anglex) (* 364.0889 (seconds-per-frame) f0-2))) + (set! (-> self anglex) (fmax -5461.3335 (fmin 5461.3335 (-> self anglex)))) ) ) - (set! (-> self updown) (fmax (fmin (-> self updown) (-> self char height-max)) (-> self char height-min))) - (+! (-> self pos-x) (* 5.0 (seconds-per-frame) (- (-> self dest-pos-x) (-> self pos-x)))) - (if (< 520.0 (fabs (-> self pos-x))) - (deactivate self) - ) - (if (nonzero? (-> self skel)) - (set-vector! (-> self draw color-mult) (-> self alpha) (-> self alpha) (-> self alpha) 1.0) - ) - (if (< (fabs (-> self dest-pos-x)) 200.0) - (seek! (-> self alpha) 1.0 (* 2.0 (seconds-per-frame))) - (seek! (-> self alpha) 0.0 (* 2.0 (seconds-per-frame))) - ) - (cond - ((not (time-elapsed? (-> self state-time) (-> self cloth-reset-time))) - (process-drawable-cloth-command self '(reset)) - ) - ((-> self use-orient-cloth-reset?) - (process-drawable-cloth-command self '(set-flags local-space)) - ) - (else - (process-drawable-cloth-command self '(set-flags local-space-xyz)) + (the float (+ (-> v1-7 leftx) -128)) + (let ((f0-10 (the float (+ (-> v1-7 lefty) -128)))) + (when (< 64.0 (fabs f0-10)) + (+! (-> self zoom) (* 204.8 (seconds-per-frame) f0-10)) + (set! (-> self zoom) (fmax (fmin (-> self zoom) (-> self char zoom-max)) (-> self char zoom-min))) ) ) - (let ((a2-3 (new 'stack-no-clear 'vector)) - (a1-7 (new 'stack-no-clear 'vector)) - (v1-40 (new 'stack-no-clear 'vector)) - (gp-2 (new 'stack-no-clear 'vector)) + (let ((f1-11 (the float (-> v1-7 abutton (abutton-idx r1)))) ;; og:preserve-this abutton indexing + (f0-18 (the float (-> v1-7 abutton (abutton-idx l1)))) ;; og:preserve-this abutton indexing ) - (let ((a3-0 (new 'stack-no-clear 'vector))) - (vector-copy! v1-40 (-> *math-camera* trans)) - (set-vector! a3-0 (-> self pos-x) 0.0 0.0 1.0) - (vector-copy! a2-3 (-> *math-camera* inv-camera-rot fvec)) - (let ((a0-42 a1-7)) - (let ((t0-8 (-> *math-camera* inv-camera-rot fvec))) - (let ((t1-0 (-> self zoom))) - (.mov vf7 t1-0) - ) - (.lvf vf5 (&-> t0-8 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 (&-> a0-42 quad) vf6) - ) - (reverse-transform-point! gp-2 a1-7 a2-3 a3-0) + (+! (-> self updown) (* 50.0 (seconds-per-frame) f1-11)) + (set! (-> self updown) (- (-> self updown) (* 50.0 (seconds-per-frame) f0-18))) + ) + ) + (set! (-> self updown) (fmax (fmin (-> self updown) (-> self char height-max)) (-> self char height-min))) + (+! (-> self pos-x) (* 5.0 (seconds-per-frame) (- (-> self dest-pos-x) (-> self pos-x)))) + (if (< 520.0 (fabs (-> self pos-x))) + (deactivate self) + ) + (if (nonzero? (-> self skel)) + (set-vector! (-> self draw color-mult) (-> self alpha) (-> self alpha) (-> self alpha) 1.0) + ) + (if (< (fabs (-> self dest-pos-x)) 200.0) + (seek! (-> self alpha) 1.0 (* 2.0 (seconds-per-frame))) + (seek! (-> self alpha) 0.0 (* 2.0 (seconds-per-frame))) + ) + (cond + ((not (time-elapsed? (-> self state-time) (-> self cloth-reset-time))) + (process-drawable-cloth-command self '(reset)) + ) + ((-> self use-orient-cloth-reset?) + (process-drawable-cloth-command self '(set-flags local-space)) + ) + (else + (process-drawable-cloth-command self '(set-flags local-space-xyz)) + ) + ) + (let ((a2-3 (new 'stack-no-clear 'vector)) + (a1-7 (new 'stack-no-clear 'vector)) + (v1-40 (new 'stack-no-clear 'vector)) + (gp-2 (new 'stack-no-clear 'vector)) ) - (vector-copy! (-> self root trans) gp-2) + (let ((a3-0 (new 'stack-no-clear 'vector))) + (vector-copy! v1-40 (-> *math-camera* trans)) + (set-vector! a3-0 (-> self pos-x) 0.0 0.0 1.0) + (vector-copy! a2-3 (-> *math-camera* inv-camera-rot fvec)) + (vector+*! a1-7 v1-40 (-> *math-camera* inv-camera-rot fvec) (-> self zoom)) + (reverse-transform-point! gp-2 a1-7 a2-3 a3-0) ) - (matrix->quaternion (-> self root quat) (-> *math-camera* inv-camera-rot)) - (quaternion*! - (-> self root quat) - (-> self root quat) - (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *y-vector* (-> self angley)) - ) - (let ((gp-4 (-> self root trans))) - (let ((s5-1 (-> self root trans))) - (let ((v1-50 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) - (let ((a0-49 (- (-> self updown)))) - (.mov vf7 a0-49) - ) - (.lvf vf5 (&-> v1-50 quad)) - ) - (.lvf vf4 (&-> s5-1 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 (&-> gp-4 quad) vf6) - ) - (let ((gp-5 (new - 'stack - 'font-context - *font-default-matrix* - 20 - 350 - 0.0 - (font-color font-color-43) - (font-flags shadow kerning) - ) + (vector-copy! (-> self root trans) gp-2) + ) + (matrix->quaternion (-> self root quat) (-> *math-camera* inv-camera-rot)) + (quaternion*! + (-> self root quat) + (-> self root quat) + (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *y-vector* (-> self angley)) + ) + (vector+*! + (-> self root trans) + (-> self root trans) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) + (- (-> self updown)) + ) + (let ((gp-6 (new + 'stack + 'font-context + *font-default-matrix* + 20 + 350 + 0.0 + (font-color font-color-43) + (font-flags shadow kerning) ) - ) - (set-width! gp-5 300) - (set-height! gp-5 30) - (set-scale! gp-5 0.7) - (let ((v1-55 gp-5)) - (set! (-> v1-55 alpha) (-> self alpha)) - ) - (set! (-> gp-5 flags) (font-flags shadow kerning large)) - (let ((s5-2 print-game-text)) - (format (clear *temp-string*) (lookup-text! *common-text* (-> self char text-id) #f)) - (s5-2 *temp-string* gp-5 #f 44 (bucket-id hud-draw-hud-alpha)) + ) ) + (set-width! gp-6 300) + (set-height! gp-6 30) + (set-scale! gp-6 0.7) + (let ((v1-55 gp-6)) + (set! (-> v1-55 alpha) (-> self alpha)) + ) + (set! (-> gp-6 flags) (font-flags shadow kerning large)) + (let ((s5-2 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (-> self char text-id) #f)) + (s5-2 *temp-string* gp-6 #f 44 (bucket-id hud-draw-hud-alpha)) ) ) ) diff --git a/goal_src/jak3/levels/wascity/ctymark-obs.gc b/goal_src/jak3/levels/wascity/ctymark-obs.gc index 45ec35a032..db1ac6c2b8 100644 --- a/goal_src/jak3/levels/wascity/ctymark-obs.gc +++ b/goal_src/jak3/levels/wascity/ctymark-obs.gc @@ -1152,74 +1152,37 @@ ) (defun fruit-sparticle-next-on-mode-1 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (-> arg1 key))) - (cond - ((zero? (-> s5-0 state-mode 0)) - (set! (-> arg1 next-time) - (the-as uint (* (max 1 (the-as int (-> *display* clock (-> arg1 clock-index) sparticle-data x))) 2)) - ) - ) - (else - (let ((s4-0 (new 'stack-no-clear 'vector))) - 0.0 - 0.0 - 0.0 - (let* ((f28-0 (/ 1.0 (/ (-> arg1 omega) METER_LENGTH))) - (f26-0 (* (rand-vu-float-range -136.53334 136.53334) f28-0)) - (f30-0 (* (rand-vu-float-range 0.0 136.53334) f28-0)) - (f0-8 (* (rand-vu-float-range -13.653334 54.613335) f28-0)) - ) - (vector-float*! s4-0 (-> s5-0 origin rvec) f26-0) - (let ((a1-5 s4-0)) - (let ((v1-8 s4-0)) - (let ((a0-10 (-> s5-0 origin uvec))) - (let ((a2-1 f30-0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-10 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 (&-> a1-5 quad) vf6) - ) - (let ((a1-6 s4-0)) - (let ((v1-9 s4-0)) - (let ((a0-11 (-> s5-0 origin fvec))) - (let ((a2-2 f0-8)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-11 quad)) - ) - (.lvf vf4 (&-> v1-9 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-6 quad) vf6) - ) - ) - (set! (-> arg1 vel-sxvel x) (-> s4-0 x)) - (set! (-> arg1 vel-sxvel y) (-> s4-0 y)) - (set! (-> arg1 vel-sxvel z) (-> s4-0 z)) + (let ((s5-0 (-> arg1 key))) + (cond + ((zero? (-> s5-0 state-mode 0)) + (set! (-> arg1 next-time) + (the-as uint (* (max 1 (the-as int (-> *display* clock (-> arg1 clock-index) sparticle-data x))) 2)) + ) + ) + (else + (let ((s4-0 (new 'stack-no-clear 'vector))) + 0.0 + 0.0 + 0.0 + (let* ((f28-0 (/ 1.0 (/ (-> arg1 omega) METER_LENGTH))) + (f26-0 (* (rand-vu-float-range -136.53334 136.53334) f28-0)) + (f30-0 (* (rand-vu-float-range 0.0 136.53334) f28-0)) + (f0-8 (* (rand-vu-float-range -13.653334 54.613335) f28-0)) + ) + (vector-float*! s4-0 (-> s5-0 origin rvec) f26-0) + (vector+*! s4-0 s4-0 (-> s5-0 origin uvec) f30-0) + (vector+*! s4-0 s4-0 (-> s5-0 origin fvec) f0-8) ) - (-> arg1 vel-sxvel) - (set! (-> arg1 user-float) (+ (-> s5-0 origin trans y) (-> arg1 omega))) + (set! (-> arg1 vel-sxvel x) (-> s4-0 x)) + (set! (-> arg1 vel-sxvel y) (-> s4-0 y)) + (set! (-> arg1 vel-sxvel z) (-> s4-0 z)) ) + (-> arg1 vel-sxvel) + (set! (-> arg1 user-float) (+ (-> s5-0 origin trans y) (-> arg1 omega))) ) ) - 0.0 ) + 0.0 ) (defpartgroup group-ctywide-fruit diff --git a/goal_src/jak3/levels/wascity/traffic-util.gc b/goal_src/jak3/levels/wascity/traffic-util.gc index 8e52c2b8aa..9384ebbc11 100644 --- a/goal_src/jak3/levels/wascity/traffic-util.gc +++ b/goal_src/jak3/levels/wascity/traffic-util.gc @@ -565,121 +565,74 @@ ) (defmethod city-level-info-method-12 ((this city-level-info) (arg0 vector) (arg1 nav-branch) (arg2 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s2-0 (-> arg1 dest-node)) - (s3-0 #t) - (s5-0 (new 'stack-no-clear 'inline-array 'vector 7)) + (let ((s2-0 (-> arg1 dest-node)) + (s3-0 #t) + (s5-0 (new 'stack-no-clear 'inline-array 'vector 7)) + ) + (let ((a1-1 s2-0) + (v1-0 (-> s5-0 2)) ) - (let ((a1-1 s2-0) - (v1-0 (-> s5-0 2)) - ) - (vector-copy! v1-0 (-> a1-1 position)) - (set! (-> v1-0 w) 1.0) - ) - (let ((v1-1 s2-0) - (s1-0 (-> s5-0 3)) - ) - (let ((f0-2 (the float (-> v1-1 angle))) - (s0-0 (new 'stack-no-clear 'vector)) - ) - (sincos! s0-0 f0-2) - (set! (-> s1-0 x) (-> s0-0 y)) - (set! (-> s1-0 y) 0.0) - (set! (-> s1-0 z) (- (-> s0-0 x))) - ) - (set! (-> s1-0 w) 1.0) - ) - (vector-! (-> s5-0 5) (-> s5-0 2) arg0) - (vector-copy! (-> s5-0 4) (-> s5-0 3)) - (set! (-> s5-0 4 x) (-> s5-0 3 z)) - (set! (-> s5-0 4 z) (- (-> s5-0 3 x))) - (when (< 0.0 (vector-dot (-> s5-0 5) (-> s5-0 4))) - (set! s3-0 #f) - (vector-float*! (-> s5-0 4) (-> s5-0 4) -1.0) - ) - (let ((a1-8 (-> s5-0 6))) - (let ((v1-12 (-> s5-0 2))) - (let ((a0-9 (-> s5-0 4))) - (let* ((a2-1 s2-0) - (a2-4 (* 1024.0 (the float (-> a2-1 radius)))) - ) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a0-9 quad)) - ) - (.lvf vf4 (&-> v1-12 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-8 quad) vf6) - ) - (set! (-> s5-0 6 w) (* 1024.0 (the float (-> s2-0 radius)))) - (vector-! (-> s5-0 0) (-> s5-0 6) arg0) - (set! (-> s5-0 0 y) 0.0) - (let* ((v1-17 (-> s5-0 0)) - (f30-0 (sqrtf (+ (* (-> v1-17 x) (-> v1-17 x)) (* (-> v1-17 z) (-> v1-17 z))))) - (f28-0 (-> s5-0 6 w)) - ) - (vector-xz-normalize! (-> s5-0 0) 1.0) - (set! (-> s5-0 1 x) (-> s5-0 0 z)) - (set! (-> s5-0 1 y) 0.0) - (set! (-> s5-0 1 z) (- (-> s5-0 0 x))) - (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))))) - (f0-35 (/ (* f28-0 f1-12) f30-0)) - ) - (let ((f1-15 (/ (* f1-12 f1-12) f30-0))) - (vector-copy! arg2 arg0) - (let ((a1-13 arg2)) - (let ((v1-26 arg2)) - (let ((a0-14 (-> s5-0 0))) - (let ((a2-5 f1-15)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-14 quad)) - ) - (.lvf vf4 (&-> v1-26 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-13 quad) vf6) - ) - ) - (let ((a1-14 arg2)) - (let ((v1-27 arg2)) - (let ((a0-15 (-> s5-0 1))) - (let ((a2-6 f0-35)) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-15 quad)) - ) - (.lvf vf4 (&-> v1-27 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! (-> arg2 y) (-> s5-0 2 y)) + (vector-copy! v1-0 (-> a1-1 position)) + (set! (-> v1-0 w) 1.0) ) - arg2 + (let ((v1-1 s2-0) + (s1-0 (-> s5-0 3)) + ) + (let ((f0-2 (the float (-> v1-1 angle))) + (s0-0 (new 'stack-no-clear 'vector)) + ) + (sincos! s0-0 f0-2) + (set! (-> s1-0 x) (-> s0-0 y)) + (set! (-> s1-0 y) 0.0) + (set! (-> s1-0 z) (- (-> s0-0 x))) + ) + (set! (-> s1-0 w) 1.0) + ) + (vector-! (-> s5-0 5) (-> s5-0 2) arg0) + (vector-copy! (-> s5-0 4) (-> s5-0 3)) + (set! (-> s5-0 4 x) (-> s5-0 3 z)) + (set! (-> s5-0 4 z) (- (-> s5-0 3 x))) + (when (< 0.0 (vector-dot (-> s5-0 5) (-> s5-0 4))) + (set! s3-0 #f) + (vector-float*! (-> s5-0 4) (-> s5-0 4) -1.0) + ) + (let ((a1-8 (-> s5-0 6)) + (v1-12 (-> s5-0 2)) + (a0-9 (-> s5-0 4)) + (a2-1 s2-0) + ) + (vector+*! a1-8 v1-12 a0-9 (* 1024.0 (the float (-> a2-1 radius)))) + ) + (set! (-> s5-0 6 w) (* 1024.0 (the float (-> s2-0 radius)))) + (vector-! (-> s5-0 0) (-> s5-0 6) arg0) + (set! (-> s5-0 0 y) 0.0) + (let* ((v1-17 (-> s5-0 0)) + (f30-0 (sqrtf (+ (* (-> v1-17 x) (-> v1-17 x)) (* (-> v1-17 z) (-> v1-17 z))))) + (f28-0 (-> s5-0 6 w)) + ) + (vector-xz-normalize! (-> s5-0 0) 1.0) + (set! (-> s5-0 1 x) (-> s5-0 0 z)) + (set! (-> s5-0 1 y) 0.0) + (set! (-> s5-0 1 z) (- (-> s5-0 0 x))) + (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))))) + (f0-35 (/ (* f28-0 f1-12) f30-0)) + ) + (let ((f1-15 (/ (* f1-12 f1-12) f30-0))) + (vector-copy! arg2 arg0) + (vector+*! arg2 arg2 (-> s5-0 0) f1-15) + ) + (vector+*! arg2 arg2 (-> s5-0 1) f0-35) + ) + ) + (set! (-> arg2 y) (-> s5-0 2 y)) ) + arg2 ) (defmethod city-level-info-method-18 ((this city-level-info)) diff --git a/goal_src/jak3/levels/wascity/wascity-turret.gc b/goal_src/jak3/levels/wascity/wascity-turret.gc index 4809b7d424..4b9081bb13 100644 --- a/goal_src/jak3/levels/wascity/wascity-turret.gc +++ b/goal_src/jak3/levels/wascity/wascity-turret.gc @@ -147,93 +147,44 @@ ) (defmethod explode-turret ((this wascity-turret)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((v1-1 (new 'stack-no-clear 'vector))) - (let ((a0-2 (-> s5-0 fountain-rand-transv-lo))) - (let ((a1-2 (-> this root trans))) - (let ((a2-1 *up-vector*)) - (let ((a3-1 2048.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-1 quad)) - ) - (.lvf vf4 (&-> a1-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 (&-> a0-2 quad) vf6) - ) - (vector-float*! v1-1 *up-vector* 81920.0) - (let ((a2-3 (-> s5-0 fountain-rand-transv-lo))) - (let ((a0-5 v1-1)) - (let ((a1-4 *identity-vector*)) - (let ((a3-3 -40960.0)) - (.mov vf7 a3-3) - ) - (.lvf vf5 (&-> a1-4 quad)) - ) - (.lvf vf4 (&-> a0-5 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-3 quad) vf6) - ) - (let ((a1-5 (-> s5-0 fountain-rand-transv-hi))) - (let ((a0-6 *identity-vector*)) - (let ((a2-5 40960.0)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-6 quad)) - ) - (.lvf vf4 (&-> v1-1 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-5 quad) vf6) - ) - ) - (set! (-> s5-0 gravity) -122880.0) - (set! (-> s5-0 rot-speed) 16.0) - (sound-play "turret-explode") - (process-spawn - joint-exploder - (art-group-get-by-name *level* "skel-wascity-turret-explode" (the-as (pointer level) #f)) - 7 - s5-0 - *wascity-turret-exploder-params* - :name "joint-exploder" - :to this - :unk 0 - ) + (let ((s5-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((v1-1 (new 'stack-no-clear 'vector))) + (vector+*! (-> s5-0 fountain-rand-transv-lo) (-> this root trans) *up-vector* 2048.0) + (vector-float*! v1-1 *up-vector* 81920.0) + (vector+*! (-> s5-0 fountain-rand-transv-lo) v1-1 *identity-vector* -40960.0) + (vector+*! (-> s5-0 fountain-rand-transv-hi) v1-1 *identity-vector* 40960.0) ) - (set! (-> *game-info* health-bar-vehicle) 0.0) - (let ((v1-12 (new 'stack-no-clear 'vector))) - (vector-copy! v1-12 (-> this root trans)) - (+! (-> v1-12 y) 8192.0) - (cond - ((logtest? (-> *part-group-id-table* 542 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) v1-12) - (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 542)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) v1-12) - (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 542)) - ) - ) + (set! (-> s5-0 gravity) -122880.0) + (set! (-> s5-0 rot-speed) 16.0) + (sound-play "turret-explode") + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-wascity-turret-explode" (the-as (pointer level) #f)) + 7 + s5-0 + *wascity-turret-exploder-params* + :name "joint-exploder" + :to this + :unk 0 ) - 0 - (none) ) + (set! (-> *game-info* health-bar-vehicle) 0.0) + (let ((v1-12 (new 'stack-no-clear 'vector))) + (vector-copy! v1-12 (-> this root trans)) + (+! (-> v1-12 y) 8192.0) + (cond + ((logtest? (-> *part-group-id-table* 542 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) v1-12) + (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 542)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) v1-12) + (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 542)) + ) + ) + ) + 0 + (none) ) (defmethod target-turret-method-36 ((this wascity-turret)) @@ -308,127 +259,62 @@ (define *wascity-display-offset* (new 'static 'vector :y 12583.731 :z 15139.635 :w 1.0)) (defmethod target-turret-method-44 ((this wascity-turret)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (wascity-turret-method-62 this) - (when (nonzero? (-> this part)) - (-> this node-list data 4 bone transform) - (let ((s4-0 (new 'stack-no-clear 'matrix)) - (s5-0 (new 'stack-no-clear 'matrix)) - ) - (quaternion->matrix s4-0 (-> this root quat)) - (vector-copy! (-> s4-0 trans) (-> this root trans)) - (matrix-identity! s5-0) - (vector-copy! (-> s5-0 trans) *wascity-display-offset*) - (matrix*! s5-0 s5-0 s4-0) - (vector-copy! (-> s4-0 trans) (-> s5-0 trans)) - (dotimes (s3-0 (the-as int (-> this radar-object-counter))) - (let* ((f0-1 (* 2867.2 (-> this radar-object s3-0 x))) - (f1-2 (* 819.2 (+ -0.12 (-> this radar-object s3-0 y)))) - (f1-3 (+ -0.12 f1-2)) - ) - (when (and (< -2867.2 f0-1) (< f0-1 2867.2) (< -819.2 f1-3) (< f1-3 819.2)) - (let ((a1-2 (-> s5-0 trans))) - (let ((v1-28 (-> s4-0 trans))) - (let ((a0-12 (-> s5-0 rvec))) - (let ((a2-1 f0-1)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-12 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 (&-> a1-2 quad) vf6) - ) - (let ((a1-3 (-> s5-0 trans))) - (let ((v1-29 (-> s5-0 trans))) - (let ((a0-13 (-> s5-0 uvec))) - (let ((a2-2 f1-3)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-13 quad)) - ) - (.lvf vf4 (&-> v1-29 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-3 quad) vf6) - ) - (spawn-from-mat (-> this part) s5-0) - ) + (wascity-turret-method-62 this) + (when (nonzero? (-> this part)) + (-> this node-list data 4 bone transform) + (let ((s4-0 (new 'stack-no-clear 'matrix)) + (s5-0 (new 'stack-no-clear 'matrix)) + ) + (quaternion->matrix s4-0 (-> this root quat)) + (vector-copy! (-> s4-0 trans) (-> this root trans)) + (matrix-identity! s5-0) + (vector-copy! (-> s5-0 trans) *wascity-display-offset*) + (matrix*! s5-0 s5-0 s4-0) + (vector-copy! (-> s4-0 trans) (-> s5-0 trans)) + (dotimes (s3-0 (the-as int (-> this radar-object-counter))) + (let* ((f0-1 (* 2867.2 (-> this radar-object s3-0 x))) + (f1-2 (* 819.2 (+ -0.12 (-> this radar-object s3-0 y)))) + (f1-3 (+ -0.12 f1-2)) + ) + (when (and (< -2867.2 f0-1) (< f0-1 2867.2) (< -819.2 f1-3) (< f1-3 819.2)) + (vector+*! (-> s5-0 trans) (-> s4-0 trans) (-> s5-0 rvec) f0-1) + (vector+*! (-> s5-0 trans) (-> s5-0 trans) (-> s5-0 uvec) f1-3) + (spawn-from-mat (-> this part) s5-0) ) ) - (when (nonzero? (-> this reticle-part)) - (let ((s1-0 (vector<-fire-pos! this (new 'stack-no-clear 'vector))) - (s2-0 (new 'stack-no-clear 'vector)) - (s3-1 (new 'stack-no-clear 'vector)) - ) - 0.0 - (vector-! s2-0 (target-pos 0) s1-0) - (let ((f0-6 (atan (-> s2-0 x) (fabs (-> s2-0 z))))) - (if (< (-> s2-0 z) 0.0) - (set! f0-6 (- f0-6)) - ) - (set! (-> s3-1 x) (/ f0-6 (meters 4))) + ) + (when (nonzero? (-> this reticle-part)) + (let ((s1-0 (vector<-fire-pos! this (new 'stack-no-clear 'vector))) + (s2-0 (new 'stack-no-clear 'vector)) + (s3-1 (new 'stack-no-clear 'vector)) ) - (let ((f0-13 (atan (-> s2-0 y) (sqrtf (+ (* (-> s2-0 x) (-> s2-0 x)) (* (-> s2-0 z) (-> s2-0 z))))))) - (set! (-> s3-1 y) (* -0.00014085036 f0-13)) - ) - (let ((f0-16 (* 2867.2 (-> s3-1 x))) - (f1-12 (* 819.2 (+ -0.12 (-> s3-1 y)))) - ) - (when (and (< -2867.2 f0-16) (< f0-16 2867.2) (< -819.2 f1-12) (< f1-12 819.2)) - (let ((v1-55 (-> s5-0 trans))) - (let ((a0-19 (-> s4-0 trans))) - (let ((a1-8 (-> s5-0 rvec))) - (let ((a2-3 f0-16)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a1-8 quad)) - ) - (.lvf vf4 (&-> a0-19 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-55 quad) vf6) - ) - (let ((a1-9 (-> s5-0 trans))) - (let ((v1-56 (-> s5-0 trans))) - (let ((a0-20 (-> s5-0 uvec))) - (let ((a2-4 f1-12)) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a0-20 quad)) - ) - (.lvf vf4 (&-> v1-56 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-9 quad) vf6) - ) - (spawn-from-mat (-> this reticle-part) s5-0) + 0.0 + (vector-! s2-0 (target-pos 0) s1-0) + (let ((f0-6 (atan (-> s2-0 x) (fabs (-> s2-0 z))))) + (if (< (-> s2-0 z) 0.0) + (set! f0-6 (- f0-6)) ) + (set! (-> s3-1 x) (/ f0-6 (meters 4))) + ) + (let ((f0-13 (atan (-> s2-0 y) (sqrtf (+ (* (-> s2-0 x) (-> s2-0 x)) (* (-> s2-0 z) (-> s2-0 z))))))) + (set! (-> s3-1 y) (* -0.00014085036 f0-13)) + ) + (let ((f0-16 (* 2867.2 (-> s3-1 x))) + (f1-12 (* 819.2 (+ -0.12 (-> s3-1 y)))) + ) + (when (and (< -2867.2 f0-16) (< f0-16 2867.2) (< -819.2 f1-12) (< f1-12 819.2)) + (vector+*! (-> s5-0 trans) (-> s4-0 trans) (-> s5-0 rvec) f0-16) + (vector+*! (-> s5-0 trans) (-> s5-0 trans) (-> s5-0 uvec) f1-12) + (spawn-from-mat (-> this reticle-part) s5-0) ) ) ) ) - 0 ) 0 - (none) ) + 0 + (none) ) (defmethod init! ((this wascity-turret)) @@ -920,82 +806,40 @@ ) (defmethod vector<-fire-pos! ((this wascity-turret) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((v0-0 arg0)) - (let ((v1-4 (-> this - node-list - data - (if (-> this left?) - 5 - 6 - ) - bone - transform - trans - ) - ) + (vector+*! + arg0 + (-> this + node-list + data + (if (-> this left?) + 5 + 6 ) - (let ((a0-1 (-> this aim-dir))) - (let ((a1-2 3276800.0)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-4 quad)) + bone + transform + trans ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> v0-0 quad) vf6) - v0-0 - ) + (-> this aim-dir) + 3276800.0 ) ) (defmethod vector<-reticle-fire-pos! ((this wascity-turret) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((v0-0 arg0)) - (let ((v1-4 (-> this - node-list - data - (if (-> this left?) - 5 - 6 - ) - bone - transform - trans - ) - ) + (vector+*! + arg0 + (-> this + node-list + data + (if (-> this left?) + 5 + 6 ) - (let ((a0-1 (-> this reticle-dir))) - (let ((a1-2 3276800.0)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-4 quad)) + bone + transform + trans ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> v0-0 quad) vf6) - v0-0 - ) + (-> this reticle-dir) + 3276800.0 ) ) @@ -1257,12 +1101,10 @@ (sv-1040 vector) ) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) + (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((s5-0 (new 'stack-no-clear 'matrix)) @@ -1369,21 +1211,7 @@ (if #f (add-debug-sphere #t (bucket-id debug) s1-1 (meters 12) *color-red*) ) - (let ((a0-43 s0-1)) - (let ((v1-89 s1-1)) - (let ((a1-15 (-> (the-as skeet sv-960) pvel))) - (let ((a2-9 f28-1)) - (.mov vf7 a2-9) - ) - (.lvf vf5 (&-> a1-15 quad)) - ) - (.lvf vf4 (&-> v1-89 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-43 quad) vf6) - ) + (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*) diff --git a/goal_src/jak3/levels/wascity/wasdef-manager.gc b/goal_src/jak3/levels/wascity/wasdef-manager.gc index 72f0022268..0a422081f5 100644 --- a/goal_src/jak3/levels/wascity/wasdef-manager.gc +++ b/goal_src/jak3/levels/wascity/wasdef-manager.gc @@ -746,51 +746,28 @@ ) (defmethod maker-method-41 ((this maker) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (new 'stack-no-clear 'collide-query)) - (s5-0 (new 'stack-no-clear 'vector)) - ) - (vector-copy! (-> s4-0 start-pos) arg0) - (+! (-> s4-0 start-pos y) 81920.0) - (set-vector! (-> s4-0 move-dist) 0.0 -163840.0 0.0 1.0) - (let ((v1-3 s4-0)) - (set! (-> v1-3 radius) 40.96) - (set! (-> v1-3 collide-with) (collide-spec backgnd)) - (set! (-> v1-3 ignore-process0) #f) - (set! (-> v1-3 ignore-process1) #f) - (set! (-> v1-3 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-3 action-mask) (collide-action solid)) + (let ((s4-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (new 'stack-no-clear 'vector)) ) - (let ((f0-7 (fill-and-probe-using-line-sphere *collide-cache* s4-0))) - (when (< 0.0 f0-7) - (let ((a0-11 s5-0)) - (let ((v1-6 (-> s4-0 start-pos))) - (let ((a1-2 (-> s4-0 move-dist))) - (let ((a2-0 f0-7)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a1-2 quad)) - ) - (.lvf vf4 (&-> v1-6 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-11 quad) vf6) + (vector-copy! (-> s4-0 start-pos) arg0) + (+! (-> s4-0 start-pos y) 81920.0) + (set-vector! (-> s4-0 move-dist) 0.0 -163840.0 0.0 1.0) + (let ((v1-3 s4-0)) + (set! (-> v1-3 radius) 40.96) + (set! (-> v1-3 collide-with) (collide-spec backgnd)) + (set! (-> v1-3 ignore-process0) #f) + (set! (-> v1-3 ignore-process1) #f) + (set! (-> v1-3 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - ) - ) - (- (-> s5-0 y) (-> arg0 y)) + (set! (-> v1-3 action-mask) (collide-action solid)) ) + (let ((f0-7 (fill-and-probe-using-line-sphere *collide-cache* s4-0))) + (if (< 0.0 f0-7) + (vector+*! s5-0 (-> s4-0 start-pos) (-> s4-0 move-dist) f0-7) + ) + ) + (- (-> s5-0 y) (-> arg0 y)) ) ) @@ -1260,119 +1237,96 @@ ) (defmethod maker-method-36 ((this maker)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((s4-0 (-> this node-list data 50)) + (s5-0 (vector<-cspace! (new 'stack-no-clear 'vector) s4-0)) + (s4-1 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s4-0 bone transform fvec) 1.0)) + (s3-0 (new 'stack-no-clear 'vector)) ) - (init-vf0-vector) - (let* ((s4-0 (-> this node-list data 50)) - (s5-0 (vector<-cspace! (new 'stack-no-clear 'vector) s4-0)) - (s4-1 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s4-0 bone transform fvec) 1.0)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s3-0 (target-pos 0)) - (new 'stack-no-clear 'vector) - 0.0 - 0.0 - (let ((f30-0 0.0)) - (vector-! s4-1 (target-pos 0) s5-0) - (set! (-> s4-1 y) 0.0) - (vector-normalize! s4-1 1.0) - (let ((a1-3 s5-0)) - (let ((v1-6 s5-0)) - (let ((a0-7 s4-1)) - (let ((a2-2 122880.0)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-7 quad)) - ) - (.lvf vf4 (&-> v1-6 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-3 quad) vf6) - ) - (let* ((f0-5 (* 0.18333334 (vector-vector-xz-distance s5-0 s3-0))) - (f28-1 (fmax 163840.0 (fmin 450560.0 f0-5))) - ) - (let ((f0-8 (/ (vector-vector-xz-distance s5-0 s3-0) f28-1))) - (if (< 0.0 f0-8) - (set! f30-0 (+ (/ (- (-> s3-0 y) (-> s5-0 y)) f0-8) (* 20480.0 f0-8))) - ) - ) - (cond - ((>= (-> this root trans z) -1937408.0) - (let ((s3-1 (new 'stack-no-clear 'projectile-init-by-other-params))) - (let ((s2-3 (rand-vu-sphere-point-uniform! (new 'stack-no-clear 'vector) (rand-vu-float-range 204800.0 409600.0)))) - (new 'stack-no-clear 'vector) - (vector-normalize! s4-1 f28-1) - (set! (-> s3-1 ent) (-> this entity)) - (set! (-> s3-1 charge) 1.0) - (set! (-> s3-1 options) (projectile-options)) - (logclear! (-> s3-1 options) (projectile-options po14 po15 po16)) - (vector-copy! (-> s3-1 pos) s5-0) - (vector-copy! (-> s3-1 vel) s2-3) - ) - (set! (-> s3-1 notify-handle) (the-as handle #f)) - (set! (-> s3-1 owner-handle) (the-as handle #f)) - (set! (-> s3-1 target-handle) (the-as handle #f)) - (set! (-> s3-1 target-pos quad) (the-as uint128 0)) - (set! (-> s3-1 ignore-handle) (process->handle this)) - (let* ((v1-26 *game-info*) - (a0-21 (+ (-> v1-26 attack-id) 1)) - ) - (set! (-> v1-26 attack-id) a0-21) - (set! (-> s3-1 attack-id) a0-21) - ) - (set! (-> s3-1 timeout) (seconds 4)) - (let ((s5-1 (new 'static 'vector4w))) - (+! (-> s5-1 x) 1) - (when (< 2 (-> s5-1 x)) - (sound-play "dm-throw") - (set! (-> s5-1 x) 0) - 0 - ) - ) - (spawn-projectile dm-flyer-shot s3-1 this *default-dead-pool*) - ) + (vector-copy! s3-0 (target-pos 0)) + (new 'stack-no-clear 'vector) + 0.0 + 0.0 + (let ((f30-0 0.0)) + (vector-! s4-1 (target-pos 0) s5-0) + (set! (-> s4-1 y) 0.0) + (vector-normalize! s4-1 1.0) + (vector+*! s5-0 s5-0 s4-1 122880.0) + (let* ((f0-5 (* 0.18333334 (vector-vector-xz-distance s5-0 s3-0))) + (f28-1 (fmax 163840.0 (fmin 450560.0 f0-5))) ) - (else - (vector-normalize! s4-1 f28-1) - (+! (-> s4-1 y) f30-0) - (let ((s3-2 (new 'stack-no-clear 'projectile-init-by-other-params))) - (set! (-> s3-2 ent) (-> this entity)) - (set! (-> s3-2 charge) 1.0) - (set! (-> s3-2 options) (projectile-options)) - (logclear! (-> s3-2 options) (projectile-options po14 po15 po16)) - (vector-copy! (-> s3-2 pos) s5-0) - (vector-copy! (-> s3-2 vel) s4-1) - (set! (-> s3-2 notify-handle) (the-as handle #f)) - (set! (-> s3-2 owner-handle) (process->handle this)) - (set! (-> s3-2 target-handle) (the-as handle #f)) - (vector-copy! (-> s3-2 target-pos) (target-pos 0)) - (set! (-> s3-2 ignore-handle) (process->handle this)) - (let* ((v1-50 *game-info*) - (a0-41 (+ (-> v1-50 attack-id) 1)) - ) - (set! (-> v1-50 attack-id) a0-41) - (set! (-> s3-2 attack-id) a0-41) - ) - (set! (-> s3-2 timeout) (seconds 4)) - (sound-play "ball-launch") - (spawn-projectile maker-grenade s3-2 this *default-dead-pool*) + (let ((f0-8 (/ (vector-vector-xz-distance s5-0 s3-0) f28-1))) + (if (< 0.0 f0-8) + (set! f30-0 (+ (/ (- (-> s3-0 y) (-> s5-0 y)) f0-8) (* 20480.0 f0-8))) + ) + ) + (cond + ((>= (-> this root trans z) -1937408.0) + (let ((s3-1 (new 'stack-no-clear 'projectile-init-by-other-params))) + (let ((s2-3 (rand-vu-sphere-point-uniform! (new 'stack-no-clear 'vector) (rand-vu-float-range 204800.0 409600.0)))) + (new 'stack-no-clear 'vector) + (vector-normalize! s4-1 f28-1) + (set! (-> s3-1 ent) (-> this entity)) + (set! (-> s3-1 charge) 1.0) + (set! (-> s3-1 options) (projectile-options)) + (logclear! (-> s3-1 options) (projectile-options po14 po15 po16)) + (vector-copy! (-> s3-1 pos) s5-0) + (vector-copy! (-> s3-1 vel) s2-3) + ) + (set! (-> s3-1 notify-handle) (the-as handle #f)) + (set! (-> s3-1 owner-handle) (the-as handle #f)) + (set! (-> s3-1 target-handle) (the-as handle #f)) + (set! (-> s3-1 target-pos quad) (the-as uint128 0)) + (set! (-> s3-1 ignore-handle) (process->handle this)) + (let* ((v1-26 *game-info*) + (a0-21 (+ (-> v1-26 attack-id) 1)) + ) + (set! (-> v1-26 attack-id) a0-21) + (set! (-> s3-1 attack-id) a0-21) + ) + (set! (-> s3-1 timeout) (seconds 4)) + (let ((s5-1 (new 'static 'vector4w))) + (+! (-> s5-1 x) 1) + (when (< 2 (-> s5-1 x)) + (sound-play "dm-throw") + (set! (-> s5-1 x) 0) + 0 + ) + ) + (spawn-projectile dm-flyer-shot s3-1 this *default-dead-pool*) + ) + ) + (else + (vector-normalize! s4-1 f28-1) + (+! (-> s4-1 y) f30-0) + (let ((s3-2 (new 'stack-no-clear 'projectile-init-by-other-params))) + (set! (-> s3-2 ent) (-> this entity)) + (set! (-> s3-2 charge) 1.0) + (set! (-> s3-2 options) (projectile-options)) + (logclear! (-> s3-2 options) (projectile-options po14 po15 po16)) + (vector-copy! (-> s3-2 pos) s5-0) + (vector-copy! (-> s3-2 vel) s4-1) + (set! (-> s3-2 notify-handle) (the-as handle #f)) + (set! (-> s3-2 owner-handle) (process->handle this)) + (set! (-> s3-2 target-handle) (the-as handle #f)) + (vector-copy! (-> s3-2 target-pos) (target-pos 0)) + (set! (-> s3-2 ignore-handle) (process->handle this)) + (let* ((v1-50 *game-info*) + (a0-41 (+ (-> v1-50 attack-id) 1)) + ) + (set! (-> v1-50 attack-id) a0-41) + (set! (-> s3-2 attack-id) a0-41) ) + (set! (-> s3-2 timeout) (seconds 4)) + (sound-play "ball-launch") + (spawn-projectile maker-grenade s3-2 this *default-dead-pool*) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) (define *maker-close* 40955904.0) diff --git a/goal_src/jak3/levels/wascity/wasgun-manager.gc b/goal_src/jak3/levels/wascity/wasgun-manager.gc index 3ce8ad8283..9181e28ce6 100644 --- a/goal_src/jak3/levels/wascity/wasgun-manager.gc +++ b/goal_src/jak3/levels/wascity/wasgun-manager.gc @@ -1352,189 +1352,126 @@ ;; WARN: Return type mismatch (pointer process) vs (pointer joint-exploder). (defmethod spawn-exploder ((this skeet)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((s5-0 (new 'stack-no-clear 'vector)) - (f0-0 (rand-vu-float-range 0.5 1.5)) - ) - (let ((v1-1 (-> gp-0 fountain-rand-transv-lo))) - (let ((a0-4 (-> this root trans))) - (let ((a1-2 *up-vector*)) - (let ((a2-1 0.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-2 quad)) - ) - (.lvf vf4 (&-> a0-4 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-1 quad) vf6) + (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (f0-0 (rand-vu-float-range 0.5 1.5)) ) - (vector-float*! s5-0 (-> this pvel) 1.0) - (let ((a1-4 s5-0)) - (let ((v1-4 s5-0)) - (let ((a0-6 *up-vector*)) - (let ((a2-3 40960.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-6 quad)) - ) - (.lvf vf4 (&-> v1-4 quad)) + (vector+*! (-> gp-0 fountain-rand-transv-lo) (-> this root trans) *up-vector* 0.0) + (vector-float*! s5-0 (-> this pvel) 1.0) + (vector+*! s5-0 s5-0 *up-vector* 40960.0) + (vector+*! (-> gp-0 fountain-rand-transv-lo) s5-0 *identity-vector* (* -204800.0 f0-0)) + (vector+*! (-> gp-0 fountain-rand-transv-hi) s5-0 *identity-vector* (* 204800.0 f0-0)) + ) + (set! (-> gp-0 gravity) -122880.0) + (set! (-> gp-0 rot-speed) 16.0) + (set! (-> gp-0 friction) 0.3) + (let ((s5-1 (get-process *default-dead-pool* joint-exploder #x4000 0))) + (the-as + (pointer joint-exploder) + (when s5-1 + (let ((t9-3 (method-of-type joint-exploder activate))) + (t9-3 (the-as joint-exploder s5-1) this "joint-exploder" (the-as pointer #x70004000)) ) - (.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-4 quad) vf6) - ) - (let ((a1-5 (-> gp-0 fountain-rand-transv-lo))) - (let ((v1-5 s5-0)) - (let ((a0-7 *identity-vector*)) - (let ((a2-5 (* -204800.0 f0-0))) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-7 quad)) - ) - (.lvf vf4 (&-> v1-5 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-5 quad) vf6) - ) - (let ((a0-8 (-> gp-0 fountain-rand-transv-hi))) - (let ((v1-6 *identity-vector*)) - (let ((a1-7 (* 204800.0 f0-0))) - (.mov vf7 a1-7) - ) - (.lvf vf5 (&-> v1-6 quad)) - ) - (.lvf vf4 (&-> s5-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-8 quad) vf6) - ) - ) - (set! (-> gp-0 gravity) -122880.0) - (set! (-> gp-0 rot-speed) 16.0) - (set! (-> gp-0 friction) 0.3) - (let ((s5-1 (get-process *default-dead-pool* joint-exploder #x4000 0))) - (the-as - (pointer joint-exploder) - (when s5-1 - (let ((t9-3 (method-of-type joint-exploder activate))) - (t9-3 (the-as joint-exploder s5-1) this "joint-exploder" (the-as pointer #x70004000)) - ) - (let* ((s4-0 run-function-in-process) - (s3-0 s5-1) - (s2-0 joint-exploder-init-by-other) - (v1-12 (-> this skeet-type)) - (a2-9 - (cond - ((or (= v1-12 (skeet-type a)) - (= v1-12 (skeet-type a-0)) - (= v1-12 (skeet-type a-1)) - (= v1-12 (skeet-type a-2)) - (= v1-12 (skeet-type a-3)) - (= v1-12 (skeet-type a-4)) - (= v1-12 (skeet-type a-5)) - (= v1-12 (skeet-type a-6)) - (= v1-12 (skeet-type a-7)) - ) - (art-group-get-by-name *level* "skel-skeet-explode" (the-as (pointer level) #f)) - ) - ((or (= v1-12 (skeet-type b)) - (= v1-12 (skeet-type b-8)) - (= v1-12 (skeet-type b-9)) - (= v1-12 (skeet-type b-10)) - (= v1-12 (skeet-type b-11)) - (= v1-12 (skeet-type b-12)) - (= v1-12 (skeet-type b-13)) - (= v1-12 (skeet-type b-14)) - (= v1-12 (skeet-type b-15)) - ) - (art-group-get-by-name *level* "skel-skeet-b-explode" (the-as (pointer level) #f)) - ) - ((or (= v1-12 (skeet-type c)) - (= v1-12 (skeet-type c-16)) - (= v1-12 (skeet-type c-17)) - (= v1-12 (skeet-type c-18)) - (= v1-12 (skeet-type c-19)) - (= v1-12 (skeet-type c-20)) - (= v1-12 (skeet-type c-22)) - (= v1-12 (skeet-type c-22)) - (= v1-12 (skeet-type c-23)) - ) - (art-group-get-by-name *level* "skel-skeet-c-explode" (the-as (pointer level) #f)) - ) - (else - (art-group-get-by-name *level* "skel-skeet-explode" (the-as (pointer level) #f)) - ) + (let* ((s4-0 run-function-in-process) + (s3-0 s5-1) + (s2-0 joint-exploder-init-by-other) + (v1-13 (-> this skeet-type)) + (a2-6 + (cond + ((or (= v1-13 (skeet-type a)) + (= v1-13 (skeet-type a-0)) + (= v1-13 (skeet-type a-1)) + (= v1-13 (skeet-type a-2)) + (= v1-13 (skeet-type a-3)) + (= v1-13 (skeet-type a-4)) + (= v1-13 (skeet-type a-5)) + (= v1-13 (skeet-type a-6)) + (= v1-13 (skeet-type a-7)) + ) + (art-group-get-by-name *level* "skel-skeet-explode" (the-as (pointer level) #f)) + ) + ((or (= v1-13 (skeet-type b)) + (= v1-13 (skeet-type b-8)) + (= v1-13 (skeet-type b-9)) + (= v1-13 (skeet-type b-10)) + (= v1-13 (skeet-type b-11)) + (= v1-13 (skeet-type b-12)) + (= v1-13 (skeet-type b-13)) + (= v1-13 (skeet-type b-14)) + (= v1-13 (skeet-type b-15)) + ) + (art-group-get-by-name *level* "skel-skeet-b-explode" (the-as (pointer level) #f)) + ) + ((or (= v1-13 (skeet-type c)) + (= v1-13 (skeet-type c-16)) + (= v1-13 (skeet-type c-17)) + (= v1-13 (skeet-type c-18)) + (= v1-13 (skeet-type c-19)) + (= v1-13 (skeet-type c-20)) + (= v1-13 (skeet-type c-22)) + (= v1-13 (skeet-type c-22)) + (= v1-13 (skeet-type c-23)) + ) + (art-group-get-by-name *level* "skel-skeet-c-explode" (the-as (pointer level) #f)) + ) + (else + (art-group-get-by-name *level* "skel-skeet-explode" (the-as (pointer level) #f)) ) ) - (a3-2 6) - (v1-18 (-> this skeet-type)) - ) - ((the-as (function object object object object object object none) s4-0) - s3-0 - s2-0 - a2-9 - a3-2 - gp-0 - (cond - ((or (= v1-18 (skeet-type a)) (or (= v1-18 (skeet-type a-0)) - (= v1-18 (skeet-type a-1)) - (= v1-18 (skeet-type a-2)) - (= v1-18 (skeet-type a-3)) - (= v1-18 (skeet-type a-4)) - (= v1-18 (skeet-type a-5)) - (= v1-18 (skeet-type a-6)) - (= v1-18 (skeet-type a-7)) - ) - ) - *skeet-exploder-params* - ) - ((or (= v1-18 (skeet-type b)) - (= v1-18 (skeet-type b-8)) - (= v1-18 (skeet-type b-9)) - (= v1-18 (skeet-type b-10)) - (= v1-18 (skeet-type b-11)) - (= v1-18 (skeet-type b-12)) - (= v1-18 (skeet-type b-13)) - (= v1-18 (skeet-type b-14)) - (= v1-18 (skeet-type b-15)) - ) - *skeet-b-exploder-params* - ) - ((or (= v1-18 (skeet-type c)) - (= v1-18 (skeet-type c-16)) - (= v1-18 (skeet-type c-17)) - (= v1-18 (skeet-type c-18)) - (= v1-18 (skeet-type c-19)) - (= v1-18 (skeet-type c-20)) - (= v1-18 (skeet-type c-22)) - (= v1-18 (skeet-type c-22)) - (= v1-18 (skeet-type c-23)) - ) - *skeet-c-exploder-params* - ) - (else - *skeet-exploder-params* ) + (a3-2 6) + (v1-19 (-> this skeet-type)) + ) + ((the-as (function object object object object object object none) s4-0) + s3-0 + s2-0 + a2-6 + a3-2 + gp-0 + (cond + ((or (= v1-19 (skeet-type a)) (or (= v1-19 (skeet-type a-0)) + (= v1-19 (skeet-type a-1)) + (= v1-19 (skeet-type a-2)) + (= v1-19 (skeet-type a-3)) + (= v1-19 (skeet-type a-4)) + (= v1-19 (skeet-type a-5)) + (= v1-19 (skeet-type a-6)) + (= v1-19 (skeet-type a-7)) + ) + ) + *skeet-exploder-params* + ) + ((or (= v1-19 (skeet-type b)) + (= v1-19 (skeet-type b-8)) + (= v1-19 (skeet-type b-9)) + (= v1-19 (skeet-type b-10)) + (= v1-19 (skeet-type b-11)) + (= v1-19 (skeet-type b-12)) + (= v1-19 (skeet-type b-13)) + (= v1-19 (skeet-type b-14)) + (= v1-19 (skeet-type b-15)) + ) + *skeet-b-exploder-params* + ) + ((or (= v1-19 (skeet-type c)) + (= v1-19 (skeet-type c-16)) + (= v1-19 (skeet-type c-17)) + (= v1-19 (skeet-type c-18)) + (= v1-19 (skeet-type c-19)) + (= v1-19 (skeet-type c-20)) + (= v1-19 (skeet-type c-22)) + (= v1-19 (skeet-type c-22)) + (= v1-19 (skeet-type c-23)) + ) + *skeet-c-exploder-params* + ) + (else + *skeet-exploder-params* ) ) - ) - (-> s5-1 ppointer) + ) ) + (-> s5-1 ppointer) ) ) ) @@ -1752,53 +1689,30 @@ ;; WARN: Return type mismatch symbol vs none. (defun def-launch-circle () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'vector))) - 8192.0 - (let ((s5-0 (new 'stack-no-clear 'vector)) - (f30-0 1720320.0) + (let ((gp-0 (new 'stack-no-clear 'vector))) + 8192.0 + (let ((s5-0 (new 'stack-no-clear 'vector)) + (f30-0 1720320.0) + ) + (set-vector! s5-0 6583861.5 36864.0 -1960301.9 1.0) + (let ((s4-0 1) + (s3-0 6) ) - (set-vector! s5-0 6583861.5 36864.0 -1960301.9 1.0) - (let ((s4-0 1) - (s3-0 6) - ) - (while (>= s3-0 s4-0) - (let ((f28-0 (+ 8192.0 (* 2339.2712 (the float s4-0))))) - (set! (-> gp-0 y) 0.0) - (set! (-> gp-0 x) (- (cos f28-0))) - (set! (-> gp-0 z) (- (sin f28-0))) - ) - (let ((a1-0 gp-0)) - (let ((v1-5 s5-0)) - (let ((a0-6 gp-0)) - (let ((a2-0 f30-0)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a0-6 quad)) - ) - (.lvf vf4 (&-> v1-5 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-0 quad) vf6) - ) - (set! (-> gp-0 w) (-> *skeet-offset-table* s4-0 w)) - (vector-copy! (-> *skeet-offset-table* s4-0) gp-0) - (+! s4-0 1) + (while (>= s3-0 s4-0) + (let ((f28-0 (+ 8192.0 (* 2339.2712 (the float s4-0))))) + (set! (-> gp-0 y) 0.0) + (set! (-> gp-0 x) (- (cos f28-0))) + (set! (-> gp-0 z) (- (sin f28-0))) ) + (vector+*! gp-0 s5-0 gp-0 f30-0) + (set! (-> gp-0 w) (-> *skeet-offset-table* s4-0 w)) + (vector-copy! (-> *skeet-offset-table* s4-0) gp-0) + (+! s4-0 1) ) ) ) - (none) ) + (none) ) ;; WARN: Return type mismatch skeet vs none. @@ -2308,60 +2222,42 @@ ) (defmethod task-manager-wascity-gungame-method-34 ((this task-manager-wascity-gungame)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (vector-! *skeet-launcher-pos* *skeet-launcher-pos* (target-pos 0)) - (vector-rotate-y! - *skeet-launcher-pos* - *skeet-launcher-pos* - (* 72.81778 (analog-input (the-as int (-> *cpad-list* cpads 1 leftx)) 128.0 48.0 110.0 -1.0)) - ) - (vector+! *skeet-launcher-pos* *skeet-launcher-pos* (target-pos 0)) - (let ((s5-4 (vector-! (new 'stack-no-clear 'vector) *skeet-launcher-pos* (target-pos 0)))) - (set! (-> s5-4 y) 0.0) - (vector-normalize! s5-4 1.0) - (let ((s2-0 *skeet-launcher-pos*)) - (let ((s4-6 *skeet-launcher-pos*)) - (let ((s3-1 s5-4)) - (let ((v1-9 (* 40960.0 (analog-input (the-as int (-> *cpad-list* cpads 1 lefty)) 128.0 48.0 110.0 -1.0)))) - (.mov vf7 v1-9) - ) - (.lvf vf5 (&-> s3-1 quad)) - ) - (.lvf vf4 (&-> s4-6 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 (&-> s2-0 quad) vf6) - ) - (set! (-> *skeet-launcher-pos* y) 36864.0) - (add-debug-sphere - #t - (bucket-id debug-no-zbuf1) - *skeet-launcher-pos* - (meters 10) - (new 'static 'rgba :r #xff :a #x80) - ) - (set! (-> *skeet-launcher-pos* w) (asin (/ (- (-> s5-4 x)) (vector-length s5-4)))) - ) - (if (cpad-pressed? 1 r1) - (print-and-spawn-skeet - this - (skeet-mode a-x0) - *skeet-launcher-pos* - (+ 10940.871 (* 5461.3335 (analog-input (the-as int (-> *cpad-list* cpads 1 righty)) 128.0 48.0 110.0 -1.0))) - 573440.0 - ) - ) - (none) + (vector-! *skeet-launcher-pos* *skeet-launcher-pos* (target-pos 0)) + (vector-rotate-y! + *skeet-launcher-pos* + *skeet-launcher-pos* + (* 72.81778 (analog-input (the-as int (-> *cpad-list* cpads 1 leftx)) 128.0 48.0 110.0 -1.0)) ) + (vector+! *skeet-launcher-pos* *skeet-launcher-pos* (target-pos 0)) + (let ((s5-4 (vector-! (new 'stack-no-clear 'vector) *skeet-launcher-pos* (target-pos 0)))) + (set! (-> s5-4 y) 0.0) + (vector-normalize! s5-4 1.0) + (vector+*! + *skeet-launcher-pos* + *skeet-launcher-pos* + s5-4 + (* 40960.0 (analog-input (the-as int (-> *cpad-list* cpads 1 lefty)) 128.0 48.0 110.0 -1.0)) + ) + (set! (-> *skeet-launcher-pos* y) 36864.0) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + *skeet-launcher-pos* + (meters 10) + (new 'static 'rgba :r #xff :a #x80) + ) + (set! (-> *skeet-launcher-pos* w) (asin (/ (- (-> s5-4 x)) (vector-length s5-4)))) + ) + (if (cpad-pressed? 1 r1) + (print-and-spawn-skeet + this + (skeet-mode a-x0) + *skeet-launcher-pos* + (+ 10940.871 (* 5461.3335 (analog-input (the-as int (-> *cpad-list* cpads 1 righty)) 128.0 48.0 110.0 -1.0))) + 573440.0 + ) + ) + (none) ) (defmethod task-manager-wascity-gungame-method-35 ((this task-manager-wascity-gungame)) diff --git a/goal_src/jak3/levels/wascity/wasstadium/sig-rider.gc b/goal_src/jak3/levels/wascity/wasstadium/sig-rider.gc index cdbb4b31fc..53c17bafe9 100644 --- a/goal_src/jak3/levels/wascity/wasstadium/sig-rider.gc +++ b/goal_src/jak3/levels/wascity/wasstadium/sig-rider.gc @@ -113,93 +113,76 @@ ) ) :trans (behavior () - (local-vars (v1-48 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (sig-pilot-trans) - (cond - ((and *target* - (focus-test? *target* pilot-riding) - (nonzero? (-> *target* pilot)) - (-> self parent) - (-> self parent 0) - (= *target* (find-rider (the-as vehicle (-> self parent 0)))) - ) - (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)) + (sig-pilot-trans) + (cond + ((and *target* + (focus-test? *target* pilot-riding) + (nonzero? (-> *target* pilot)) + (-> self parent) + (-> self parent 0) + (= *target* (find-rider (the-as vehicle (-> self parent 0)))) + ) + (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)) + ) + (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))) + ) + (set! (-> self complain-speech) (mod (+ (-> self complain-speech) (rand-vu-int-range 2 6)) 9)) + (let ((v1-19 (-> self complain-speech))) + (cond + ((zero? v1-19) + (talker-spawn-func (-> *nest-eggs-speech-list* 9) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 1) + (talker-spawn-func (-> *nest-eggs-speech-list* 10) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 2) + (talker-spawn-func (-> *nest-eggs-speech-list* 11) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 3) + (talker-spawn-func (-> *nest-eggs-speech-list* 12) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 4) + (talker-spawn-func (-> *nest-eggs-speech-list* 13) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 5) + (talker-spawn-func (-> *nest-eggs-speech-list* 14) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 6) + (talker-spawn-func (-> *nest-eggs-speech-list* 15) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 7) + (talker-spawn-func (-> *nest-eggs-speech-list* 16) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 8) + (talker-spawn-func (-> *nest-eggs-speech-list* 17) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 9) + (talker-spawn-func (-> *nest-eggs-speech-list* 18) *entity-pool* (target-pos 0) (the-as region #f)) ) - (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))) - ) - (set! (-> self complain-speech) (mod (+ (-> self complain-speech) (rand-vu-int-range 2 6)) 9)) - (let ((v1-19 (-> self complain-speech))) - (cond - ((zero? v1-19) - (talker-spawn-func (-> *nest-eggs-speech-list* 9) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 1) - (talker-spawn-func (-> *nest-eggs-speech-list* 10) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 2) - (talker-spawn-func (-> *nest-eggs-speech-list* 11) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 3) - (talker-spawn-func (-> *nest-eggs-speech-list* 12) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 4) - (talker-spawn-func (-> *nest-eggs-speech-list* 13) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 5) - (talker-spawn-func (-> *nest-eggs-speech-list* 14) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 6) - (talker-spawn-func (-> *nest-eggs-speech-list* 15) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 7) - (talker-spawn-func (-> *nest-eggs-speech-list* 16) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 8) - (talker-spawn-func (-> *nest-eggs-speech-list* 17) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 9) - (talker-spawn-func (-> *nest-eggs-speech-list* 18) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) ) - (set-time! (-> self complain-time)) ) + (set-time! (-> self complain-time)) ) ) ) - (let* ((f0-4 20480.0) - (f0-6 (* f0-4 f0-4)) - ) - (.lvf vf1 (&-> (-> *target* control 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 v1-48 vf1) - (if (< f0-6 v1-48) - (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))) - ) ) - (else - (set-time! (-> self last-moved-time)) - ) + (let ((f0-4 20480.0)) + (if (< (* f0-4 f0-4) (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))) + ) + ) + (else + (set-time! (-> self last-moved-time)) ) ) ) diff --git a/goal_src/jak3/levels/wascity/wasstadium/wasstada-part.gc b/goal_src/jak3/levels/wascity/wasstadium/wasstada-part.gc index 0577762579..0b00982341 100644 --- a/goal_src/jak3/levels/wascity/wasstadium/wasstada-part.gc +++ b/goal_src/jak3/levels/wascity/wasstadium/wasstada-part.gc @@ -1123,7 +1123,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 8192.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1231,7 +1231,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 32768.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1339,7 +1339,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 20480.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1447,7 +1447,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 16384.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1555,7 +1555,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 24576.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) diff --git a/goal_src/jak3/levels/wascity/wasstadium/wasstadc-obs.gc b/goal_src/jak3/levels/wascity/wasstadium/wasstadc-obs.gc index 47388090b8..cfa856cc2c 100644 --- a/goal_src/jak3/levels/wascity/wasstadium/wasstadc-obs.gc +++ b/goal_src/jak3/levels/wascity/wasstadium/wasstadc-obs.gc @@ -674,65 +674,41 @@ (sound-stop (-> self ambient-sound-id)) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (wstd-fight-plat-method-40 self) - (vector-copy! (-> self basetrans) (-> self basepos)) - (+! (-> self basetrans y) (-> self delta-y)) - (when (-> self spawn-lava?) - (activate! - *camera-smush-control* - (lerp-scale 409.6 0.0 (vector-vector-xz-distance (target-pos 0) (-> self root trans)) 114688.0 143360.0) - 37 - 600 - 1.0 - 0.2 - (-> self clock) - ) - (when (< (-> self next-lava-part) (current-time)) - 102400.0 - 102400.0 - (let ((gp-1 (new 'stack-no-clear 'vector))) - (let ((s3-1 (matrix<-transformq! (new 'stack-no-clear 'matrix) (the-as transformq (-> self root trans))))) - (vector-matrix*! gp-1 (-> *fight-plat-lava-pos* (rand-vu-int-count (-> *fight-plat-lava-pos* length))) s3-1) - ) - (set! (-> gp-1 y) 40960.0) - (vector-copy! (-> self part-lava-pos) gp-1) - ) - (set! (-> self next-lava-part) (+ (current-time) (seconds 0.01))) - ) - (spawn (-> self part) (-> self part-lava-pos)) + (wstd-fight-plat-method-40 self) + (vector-copy! (-> self basetrans) (-> self basepos)) + (+! (-> self basetrans y) (-> self delta-y)) + (when (-> self spawn-lava?) + (activate! + *camera-smush-control* + (lerp-scale 409.6 0.0 (vector-vector-xz-distance (target-pos 0) (-> self root trans)) 114688.0 143360.0) + 37 + 600 + 1.0 + 0.2 + (-> self clock) ) - (plat-trans) - (let ((v1-23 (as-type (entity-nav-mesh-by-aid (the-as actor-id #xab7e)) entity-nav-mesh))) - (when v1-23 - (let* ((a0-17 (-> v1-23 nav-mesh)) - (t9-12 (method-of-object a0-17 nav-mesh-method-38)) - (a1-7 (new 'stack-no-clear 'nav-poly)) - ) - (let ((v1-26 (-> self root trans))) - (let ((a2-3 *y-vector*)) - (let ((a3-3 4096.0)) - (.mov vf7 a3-3) - ) - (.lvf vf5 (&-> a2-3 quad)) - ) - (.lvf vf4 (&-> v1-26 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-7 vertex0 quad) vf6) - (t9-12 a0-17 a1-7) + (when (< (-> self next-lava-part) (current-time)) + 102400.0 + 102400.0 + (let ((gp-1 (new 'stack-no-clear 'vector))) + (let ((s3-1 (matrix<-transformq! (new 'stack-no-clear 'matrix) (the-as transformq (-> self root trans))))) + (vector-matrix*! gp-1 (-> *fight-plat-lava-pos* (rand-vu-int-count (-> *fight-plat-lava-pos* length))) s3-1) + ) + (set! (-> gp-1 y) 40960.0) + (vector-copy! (-> self part-lava-pos) gp-1) + ) + (set! (-> self next-lava-part) (+ (current-time) (seconds 0.01))) + ) + (spawn (-> self part) (-> self part-lava-pos)) + ) + (plat-trans) + (let ((v1-23 (as-type (entity-nav-mesh-by-aid (the-as actor-id #xab7e)) entity-nav-mesh))) + (if v1-23 + (nav-mesh-method-38 + (-> v1-23 nav-mesh) + (the-as nav-poly (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *y-vector* 4096.0)) ) ) - ) ) ) :code (behavior () @@ -1375,47 +1351,29 @@ ) (defmethod wstd-fight-plat-large-method-41 ((this wstd-fight-plat-large)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (dotimes (s5-0 (length *wstd-fight-large-house*)) - (when (-> this door s5-0) - (let ((s3-0 (-> this node-list data (-> *wstd-fight-large-house* s5-0 joint-index) bone transform)) - (s4-0 (the-as wstd-door (handle->process (-> this door s5-0)))) - ) - (matrix->trans s3-0 (-> s4-0 root trans)) - (matrix->quaternion (-> s4-0 root quat) s3-0) - (quaternion-rotate-local-y! - (-> s4-0 root quat) - (-> s4-0 root quat) - (-> *wstd-fight-large-house* s5-0 y-angle) - ) - (let ((s3-1 (-> s4-0 root trans))) - (let ((s2-0 (-> s4-0 root trans))) - (let ((v1-22 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> s4-0 root quat)))) - (let ((a0-16 (-> *wstd-fight-large-house* s5-0 x-offset))) - (.mov vf7 a0-16) - ) - (.lvf vf5 (&-> v1-22 quad)) - ) - (.lvf vf4 (&-> s2-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 (&-> s3-1 quad) vf6) + (dotimes (s5-0 (length *wstd-fight-large-house*)) + (when (-> this door s5-0) + (let ((s3-0 (-> this node-list data (-> *wstd-fight-large-house* s5-0 joint-index) bone transform)) + (s4-0 (the-as wstd-door (handle->process (-> this door s5-0)))) ) + (matrix->trans s3-0 (-> s4-0 root trans)) + (matrix->quaternion (-> s4-0 root quat) s3-0) + (quaternion-rotate-local-y! + (-> s4-0 root quat) + (-> s4-0 root quat) + (-> *wstd-fight-large-house* s5-0 y-angle) + ) + (vector+*! + (-> s4-0 root trans) + (-> s4-0 root trans) + (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> s4-0 root quat)) + (-> *wstd-fight-large-house* s5-0 x-offset) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod wstd-fight-plat-large-method-42 ((this wstd-fight-plat-large)) @@ -1524,45 +1482,21 @@ (sound-stop (-> self ambient-sound-id)) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (wstd-fight-plat-large-method-41 self) - (vector-copy! (-> self basetrans) (-> self basepos)) - (+! (-> self basetrans y) (-> self delta-y)) - (when (-> self spawn-lava?) - (wstd-fight-plat-large-method-42 self) - (activate! *camera-smush-control* 409.6 37 600 1.0 0.2 (-> self clock)) - ) - (plat-trans) - (let ((v1-9 (as-type (entity-nav-mesh-by-aid (the-as actor-id #xab7e)) entity-nav-mesh))) - (when v1-9 - (let* ((a0-7 (-> v1-9 nav-mesh)) - (t9-6 (method-of-object a0-7 nav-mesh-method-38)) - (a1-2 (new 'stack-no-clear 'nav-poly)) - ) - (let ((v1-12 (-> self root trans))) - (let ((a2-1 *y-vector*)) - (let ((a3-2 4096.0)) - (.mov vf7 a3-2) - ) - (.lvf vf5 (&-> a2-1 quad)) - ) - (.lvf vf4 (&-> v1-12 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-2 vertex0 quad) vf6) - (t9-6 a0-7 a1-2) + (wstd-fight-plat-large-method-41 self) + (vector-copy! (-> self basetrans) (-> self basepos)) + (+! (-> self basetrans y) (-> self delta-y)) + (when (-> self spawn-lava?) + (wstd-fight-plat-large-method-42 self) + (activate! *camera-smush-control* 409.6 37 600 1.0 0.2 (-> self clock)) + ) + (plat-trans) + (let ((v1-9 (as-type (entity-nav-mesh-by-aid (the-as actor-id #xab7e)) entity-nav-mesh))) + (if v1-9 + (nav-mesh-method-38 + (-> v1-9 nav-mesh) + (the-as nav-poly (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *y-vector* 4096.0)) ) ) - ) ) ) :code (behavior () @@ -1648,44 +1582,20 @@ (sound-stop (-> self ambient-sound-id)) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (wstd-fight-plat-large-method-41 self) - (vector-copy! (-> self basetrans) (-> self basepos)) - (+! (-> self basetrans y) (-> self delta-y)) - (if (-> self spawn-lava?) - (wstd-fight-plat-large-method-42 self) - ) - (plat-trans) - (let ((v1-7 (as-type (entity-nav-mesh-by-aid (the-as actor-id #xab7e)) entity-nav-mesh))) - (when v1-7 - (let* ((a0-6 (-> v1-7 nav-mesh)) - (t9-5 (method-of-object a0-6 nav-mesh-method-38)) - (a1-1 (new 'stack-no-clear 'nav-poly)) - ) - (let ((v1-10 (-> self root trans))) - (let ((a2-0 *y-vector*)) - (let ((a3-1 4096.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> v1-10 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-1 vertex0 quad) vf6) - (t9-5 a0-6 a1-1) + (wstd-fight-plat-large-method-41 self) + (vector-copy! (-> self basetrans) (-> self basepos)) + (+! (-> self basetrans y) (-> self delta-y)) + (if (-> self spawn-lava?) + (wstd-fight-plat-large-method-42 self) + ) + (plat-trans) + (let ((v1-7 (as-type (entity-nav-mesh-by-aid (the-as actor-id #xab7e)) entity-nav-mesh))) + (if v1-7 + (nav-mesh-method-38 + (-> v1-7 nav-mesh) + (the-as nav-poly (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *y-vector* 4096.0)) ) ) - ) ) ) :code (behavior () diff --git a/goal_src/jak3/levels/wascity/waswide-part.gc b/goal_src/jak3/levels/wascity/waswide-part.gc index 16bd38261a..90584ea8f8 100644 --- a/goal_src/jak3/levels/wascity/waswide-part.gc +++ b/goal_src/jak3/levels/wascity/waswide-part.gc @@ -2630,7 +2630,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 8192.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -2733,7 +2733,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 32768.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -2837,7 +2837,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 20480.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -2945,7 +2945,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 16384.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -3050,7 +3050,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 24576.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -3158,7 +3158,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 10240.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -3261,7 +3261,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 34816.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -3367,7 +3367,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 22528.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -3475,7 +3475,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 18432.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -3579,7 +3579,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 26624.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -3671,7 +3671,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 409.6) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -3757,7 +3757,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 4096.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -3843,7 +3843,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 6144.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) diff --git a/goal_src/jak3/levels/wascity/wlander-male.gc b/goal_src/jak3/levels/wascity/wlander-male.gc index 9a9bc2955a..cebbc2f539 100644 --- a/goal_src/jak3/levels/wascity/wlander-male.gc +++ b/goal_src/jak3/levels/wascity/wlander-male.gc @@ -540,51 +540,30 @@ ) (defmethod try-activate ((this wlander)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) - (new 'stack-no-clear 'vector) - (let ((gp-0 (new 'stack 'traffic-object-spawn-params))) - (set! (-> gp-0 object-type) (traffic-type wlander-male)) - (set! (-> gp-0 behavior) (the-as uint 12)) - (set! (-> gp-0 id) (the-as uint 0)) - (set! (-> gp-0 nav-mesh) (-> this nav state mesh)) - (set! (-> gp-0 nav-branch) #f) - (set! (-> gp-0 proc) #f) - (set! (-> gp-0 handle) (process->handle this)) - (set! (-> gp-0 user-data) (the-as uint 0)) - (set! (-> gp-0 flags) (traffic-spawn-flags)) - (set! (-> gp-0 guard-type) (the-as uint 11)) - (set! (-> gp-0 entity) #f) - (vector-reset! (-> gp-0 velocity)) - (let ((v1-12 (-> gp-0 position))) - (let ((a0-8 (-> this root trans))) - (let ((a1-3 16384.0)) - (.mov vf7 a1-3) - ) - (.lvf vf5 (&-> s4-0 quad)) - (.lvf vf4 (&-> a0-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 (&-> v1-12 quad) vf6) + (let ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) + (new 'stack-no-clear 'vector) + (let ((gp-0 (new 'stack 'traffic-object-spawn-params))) + (set! (-> gp-0 object-type) (traffic-type wlander-male)) + (set! (-> gp-0 behavior) (the-as uint 12)) + (set! (-> gp-0 id) (the-as uint 0)) + (set! (-> gp-0 nav-mesh) (-> this nav state mesh)) + (set! (-> gp-0 nav-branch) #f) + (set! (-> gp-0 proc) #f) + (set! (-> gp-0 handle) (process->handle this)) + (set! (-> gp-0 user-data) (the-as uint 0)) + (set! (-> gp-0 flags) (traffic-spawn-flags)) + (set! (-> gp-0 guard-type) (the-as uint 11)) + (set! (-> gp-0 entity) #f) + (vector-reset! (-> gp-0 velocity)) + (vector+*! (-> gp-0 position) (-> this root trans) s4-0 16384.0) + (quaternion-rotate-local-y! (-> gp-0 rotation) (-> this root quat) 32768.0) + (send-event *traffic-manager* 'activate-object gp-0) + (if (-> gp-0 proc) + (return #t) ) - (quaternion-rotate-local-y! (-> gp-0 rotation) (-> this root quat) 32768.0) - (send-event *traffic-manager* 'activate-object gp-0) - (if (-> gp-0 proc) - (return #t) - ) - ) ) - #f ) + #f ) (defstate standing (wlander) diff --git a/goal_src/jak3/pc/debug/anim-tester-x.gc b/goal_src/jak3/pc/debug/anim-tester-x.gc index 771da99ec9..918ec6bc26 100644 --- a/goal_src/jak3/pc/debug/anim-tester-x.gc +++ b/goal_src/jak3/pc/debug/anim-tester-x.gc @@ -361,7 +361,7 @@ (('loop) (ja :num! (loop! (-> *ATX-settings* speed)))) (('identity) (ja :num! (identity (-> *ATX-settings* frame-num)))) (('seek) (ja :num! (seek! max (-> *ATX-settings* speed)))))) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-x-vel adjust-y-vel adjust-xz-vel keep-other-velocities adjust-quat) 1.0 diff --git a/test/decompiler/reference/jak3/engine/ambient/ambient-h_REF.gc b/test/decompiler/reference/jak3/engine/ambient/ambient-h_REF.gc index bfb3e95c48..c2726207c5 100644 --- a/test/decompiler/reference/jak3/engine/ambient/ambient-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/ambient/ambient-h_REF.gc @@ -75,7 +75,7 @@ and neg-state is greater than or equal to neg. exit ) (:methods - (talker-method-17 (_type_) none) + (draw-text (_type_) none) ) ) diff --git a/test/decompiler/reference/jak3/engine/ambient/ambient_REF.gc b/test/decompiler/reference/jak3/engine/ambient/ambient_REF.gc index a83f8d0653..15d0ddabcb 100644 --- a/test/decompiler/reference/jak3/engine/ambient/ambient_REF.gc +++ b/test/decompiler/reference/jak3/engine/ambient/ambient_REF.gc @@ -303,7 +303,7 @@ ;; definition for method 17 of type talker ;; WARN: Return type mismatch int vs none. -(defmethod talker-method-17 ((this talker)) +(defmethod draw-text ((this talker)) (let ((gp-0 (new 'stack 'font-context *font-default-matrix* 36 310 0.0 (font-color default) (font-flags shadow kerning)) ) @@ -534,7 +534,7 @@ (seek! (-> self interp) 1.0 (* 0.5 (seconds-per-frame))) (seek! (-> self interp) 1.0 (* 4.0 (seconds-per-frame))) ) - (talker-method-17 self) + (draw-text self) ) (suspend) ) @@ -546,7 +546,7 @@ (seek! (-> self interp) 0.0 (* 4.0 (seconds-per-frame))) ) (if (and (= (get-status *gui-control* (-> self message-id)) (gui-status active)) (not (paused?))) - (talker-method-17 self) + (draw-text self) ) (suspend) ) diff --git a/test/decompiler/reference/jak3/engine/anim/aligner-h_REF.gc b/test/decompiler/reference/jak3/engine/anim/aligner-h_REF.gc index a01b98d49f..e94e22a8aa 100644 --- a/test/decompiler/reference/jak3/engine/anim/aligner-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/anim/aligner-h_REF.gc @@ -3,6 +3,21 @@ ;; definition of type align-control (deftype align-control (basic) + "Align-control is a utility for moving a process-drawable based on its animation. +The animation format has two special parent-like joints: prejoint and align. +The prejoint is the parent for all joints, so it causes all bones to move. +The align joint has no children, but the convention is that moving align will +cause the entire process-drawable's root to move, effectively moving the entire character. +Most of the time, this is the preferable way to move a character as part of an animation - +it will update their velocity and when the animation ends or is canceled, +the offset in position from playing the animation will stay. For example, if Jak punches, +his velocity will increase due to the animated align in the punch animation. +To implement this, the align-control computes the relative transform between align frames. +To apply the position offset, typically the velocity is updated, then the normal per-frame +physics update will end up moving the position. For orientation, there is no concept of +angular velocity, so instead align-control directly modifies the quaternion. +Unlike normal animation evaluation, the alignment's blend is computed in a different way +that doesn't blend and instead just picks the most recently pushed animation." ((flags align-flags) (process process-drawable) (frame-group art-joint-anim) @@ -15,9 +30,9 @@ ) (:methods (new (symbol type process) _type_) - (compute-alignment! (_type_) transformq) + (compute-delta-align! (_type_) transformq) (align! (_type_ align-opts float float float) trsqv) - (align-vel-and-quat-only! (_type_ align-opts vector int float float) trsqv) + (adjust-root-no-gravity! (_type_ align-opts vector int float float) trsqv) (first-transform (_type_) transform) (second-transform (_type_) transform) ) diff --git a/test/decompiler/reference/jak3/engine/anim/aligner_REF.gc b/test/decompiler/reference/jak3/engine/anim/aligner_REF.gc index 8c76e016ff..c14ff4fde7 100644 --- a/test/decompiler/reference/jak3/engine/anim/aligner_REF.gc +++ b/test/decompiler/reference/jak3/engine/anim/aligner_REF.gc @@ -5,7 +5,8 @@ ;; INFO: Used lq/sq ;; ERROR: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)] ;; ERROR: Unsupported inline assembly instruction kind - [jr ra] -(defmethod compute-alignment! ((this align-control)) +(defmethod compute-delta-align! ((this align-control)) + "Compute the change in align since the last time this was called." (local-vars (disable? symbol) (s7-0 none) (ra-0 int)) (update-anim-data (-> this process skel)) (let ((num-chans (-> this process skel active-channels))) @@ -105,16 +106,19 @@ ;; definition for method 12 of type align-control ;; WARN: Return type mismatch (inline-array transform) vs transform. (defmethod first-transform ((this align-control)) + "Get the more recent align transform" (the-as transform (-> this transform)) ) ;; definition for method 13 of type align-control (defmethod second-transform ((this align-control)) + "Get the second most recent align trasnform" (-> this transform 1) ) ;; definition for method 10 of type align-control (defmethod align! ((this align-control) (arg0 align-opts) (arg1 float) (arg2 float) (arg3 float)) + "Apply the alignment to the process-drawable." (when (not (logtest? (-> this flags) (align-flags disabled))) (let* ((a0-1 (-> this process)) (t9-0 (method-of-object a0-1 apply-alignment)) @@ -155,7 +159,9 @@ ) ;; definition for method 11 of type align-control -(defmethod align-vel-and-quat-only! ((this align-control) (arg0 align-opts) (arg1 vector) (arg2 int) (arg3 float) (arg4 float)) +(defmethod adjust-root-no-gravity! ((this align-control) (arg0 align-opts) (arg1 vector) (arg2 int) (arg3 float) (arg4 float)) + "Adjust the quat and transv of the process drawable to take into account the + most recent change in align." (with-pp (when (not (logtest? (-> this flags) (align-flags disabled))) (let ((s5-0 (-> this delta))) 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 a7b727ab60..45b6162501 100644 --- a/test/decompiler/reference/jak3/engine/anim/joint-exploder_REF.gc +++ b/test/decompiler/reference/jak3/engine/anim/joint-exploder_REF.gc @@ -162,6 +162,7 @@ ;; definition of type joint-exploder-list (deftype joint-exploder-list (structure) + "Linked list of joint-exploder-joint." ((head int32) (pre-moved? symbol) (bbox-valid? symbol) @@ -211,6 +212,8 @@ ;; definition of type joint-exploder (deftype joint-exploder (process-drawable) + "The joint-exploder animates an object exploding into pieces. +For example, geyser rock dummies, or the jak 1 zoomer." ((parent (pointer process-drawable) :override) (die-if-below-y float) (die-if-beyond-xz-dist-sqrd float) @@ -281,6 +284,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun joint-exploder-joint-callback ((arg0 draw-control) (arg1 cspace-array) (arg2 joint-control)) + "Postbind callback to set bones to the result of the joint-exploder." (let ((s4-0 (the-as joint-exploder (-> arg0 process)))) (let ((s3-0 (-> s4-0 joints))) (countdown (s2-0 (-> s3-0 num-joints)) @@ -314,6 +318,7 @@ ;; definition for method 24 of type joint-exploder ;; INFO: Used lq/sq (defmethod remove-from-list-and-reset ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + "Remove a joint from the list and clear its transform" (let ((v0-0 (remove-joint-from-list this arg0 arg1))) (let* ((v1-1 (-> this joints)) (v1-2 (-> v1-1 joint arg1)) @@ -329,6 +334,7 @@ ;; definition for method 27 of type joint-exploder (defmethod remove-joint-from-list ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + "Remove a joint from the linked list and invalidate the bbox." (let* ((v1-0 (-> this joints)) (a2-1 (-> v1-0 joint arg1)) (a0-4 (-> a2-1 prev)) @@ -361,6 +367,7 @@ ;; definition for method 20 of type joint-exploder (defmethod add-joint-to-list ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + "Add a joint to the given linked list of joints." (let* ((v1-0 (-> this joints)) (a3-0 (-> v1-0 joint arg1)) (a0-4 (-> arg0 head)) @@ -378,6 +385,7 @@ ;; definition for method 21 of type joint-exploder ;; INFO: Used lq/sq (defmethod update-bbox-for-joint ((this joint-exploder) (arg0 joint-exploder-list) (arg1 joint-exploder-joint)) + "Update the bounding box to include the joint" (let ((a1-1 (-> arg1 mat trans))) (cond ((-> arg0 bbox-valid?) @@ -607,62 +615,47 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod integrate-and-kill ((this joint-exploder) (arg0 joint-exploder-list)) - (local-vars (v1-8 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (set! (-> arg0 bbox-valid?) #f) - (set! (-> arg0 pre-moved?) #t) - (let ((s4-0 (-> this joints)) - (f30-0 (* (-> this tuning gravity) (seconds-per-frame))) - (s3-0 (-> arg0 head)) - ) - (while (>= s3-0 0) - (let* ((s2-0 (-> s4-0 joint s3-0)) - (s1-0 (-> s2-0 mat trans)) - ) - (vector-copy! (-> s2-0 prev-pos) s1-0) - (+! (-> s2-0 transv y) f30-0) - (when (< 0.0 (-> this tuning friction)) - (.lvf vf1 (&-> (-> s2-0 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 v1-8 vf1) - (let* ((f0-4 v1-8) - (f1-5 (* 0.00001 (seconds-per-frame) (-> this tuning friction) f0-4)) - (f0-6 (- (sqrtf f0-4) f1-5)) - ) - (if (< f0-6 0.0) - (set! f0-6 0.0) - ) - (vector-normalize! (-> s2-0 transv) f0-6) - ) - ) - (vector-v+! s1-0 s1-0 (-> s2-0 transv)) - (matrix*! (-> s2-0 rmat) (-> s2-0 rmat) (-> s2-0 update-rmat)) - (cond - ((or (< (-> s1-0 y) (-> this die-if-below-y)) - (< (-> this die-if-beyond-xz-dist-sqrd) (vector-vector-xz-distance s1-0 (-> this root trans))) - ) - (set! s3-0 (remove-from-list-and-reset this arg0 s3-0)) + (set! (-> arg0 bbox-valid?) #f) + (set! (-> arg0 pre-moved?) #t) + (let ((s4-0 (-> this joints)) + (f30-0 (* (-> this tuning gravity) (seconds-per-frame))) + (s3-0 (-> arg0 head)) + ) + (while (>= s3-0 0) + (let* ((s2-0 (-> s4-0 joint s3-0)) + (s1-0 (-> s2-0 mat trans)) ) - (else - (update-bbox-for-joint this arg0 s2-0) - (set! s3-0 (-> s2-0 next)) - ) + (vector-copy! (-> s2-0 prev-pos) s1-0) + (+! (-> s2-0 transv y) f30-0) + (when (< 0.0 (-> this tuning friction)) + (let* ((f0-4 (vector-length-squared (-> s2-0 transv))) + (f1-5 (* 0.00001 (seconds-per-frame) (-> this tuning friction) f0-4)) + (f0-6 (- (sqrtf f0-4) f1-5)) + ) + (if (< f0-6 0.0) + (set! f0-6 0.0) + ) + (vector-normalize! (-> s2-0 transv) f0-6) + ) + ) + (vector-v+! s1-0 s1-0 (-> s2-0 transv)) + (matrix*! (-> s2-0 rmat) (-> s2-0 rmat) (-> s2-0 update-rmat)) + (cond + ((or (< (-> s1-0 y) (-> this die-if-below-y)) + (< (-> this die-if-beyond-xz-dist-sqrd) (vector-vector-xz-distance s1-0 (-> this root trans))) + ) + (set! s3-0 (remove-from-list-and-reset this arg0 s3-0)) + ) + (else + (update-bbox-for-joint this arg0 s2-0) + (set! s3-0 (-> s2-0 next)) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 22 of type joint-exploder 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 611eca026b..b4a6f5d9ac 100644 --- a/test/decompiler/reference/jak3/engine/anim/joint-mod_REF.gc +++ b/test/decompiler/reference/jak3/engine/anim/joint-mod_REF.gc @@ -18,12 +18,10 @@ (sv-768 matrix) (sv-784 vector) ) - (rlet ((acc :class vf) - (vf0 :class vf) + (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((gp-0 (the-as joint-mod-ik (-> arg0 param1)))) @@ -69,21 +67,7 @@ 0.0 (vector-copy! s2-0 (-> s5-0 trans)) (vector-copy! sv-784 (-> s4-1 trans)) - (let ((a1-5 s0-0)) - (let ((v1-27 sv-784)) - (let ((a0-13 (-> s4-1 uvec))) - (let ((a2-2 (-> gp-0 hand-dist))) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-13 quad)) - ) - (.lvf vf4 (&-> v1-27 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-5 quad) vf6) - ) + (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) ) @@ -213,19 +197,19 @@ ) (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-20 (quaternion->matrix (new 'stack-no-clear 'matrix) sv-368)) + (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-20) + (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-21 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) s5-0)) + (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-21) + (matrix*! s4-1 s4-1 a2-20) (matrix*! s5-0 s5-0 s3-2) (vector-copy! (-> s5-0 trans) (-> gp-2 rvec)) ) 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 4a28b92c8d..adebc0debb 100644 --- a/test/decompiler/reference/jak3/engine/camera/cam-master_REF.gc +++ b/test/decompiler/reference/jak3/engine/camera/cam-master_REF.gc @@ -592,13 +592,7 @@ (defstate cam-master-active (camera-master) :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (local-vars (v0-0 object) (v1-125 uint)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) + (rlet ((vf0 :class vf)) (init-vf0-vector) (case message (('dist-from-interp-src) @@ -915,23 +909,16 @@ ) ) (('point-of-interest) - (let ((v1-232 (the-as object (-> block param 0)))) - (let ((a0-103 *math-camera*)) - (set! v0-0 (-> a0-103 trans)) - (let ((a0-104 (-> a0-103 inv-camera-rot fvec))) - (let ((a1-36 (- (-> self interest-dist)))) - (.mov vf7 a1-36) - ) - (.lvf vf5 (&-> a0-104 quad)) + (let ((v1-232 (-> block param 0)) + (a0-103 *math-camera*) ) + (vector+*! + (-> a0-103 trans) + (the-as vector v1-232) + (-> a0-103 inv-camera-rot fvec) + (- (-> self interest-dist)) ) - (.lvf vf4 (&-> (the-as vector v1-232) 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 (&-> (the-as vector v0-0) quad) vf6) - v0-0 ) (('part-water-drip) (set-time! (-> self water-drip-time)) diff --git a/test/decompiler/reference/jak3/engine/camera/cam-states-dbg_REF.gc b/test/decompiler/reference/jak3/engine/camera/cam-states-dbg_REF.gc index c1794e50d9..b310c53bc4 100644 --- a/test/decompiler/reference/jak3/engine/camera/cam-states-dbg_REF.gc +++ b/test/decompiler/reference/jak3/engine/camera/cam-states-dbg_REF.gc @@ -118,96 +118,59 @@ ;; definition for function cam-mouse-input (defun cam-mouse-input ((arg0 matrix) (arg1 vector) (arg2 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (vector-! v1-0 (-> *mouse* pos 0) (-> *mouse* pos 1)) + (if (< (-> *camera* interest-dist) 409.6) + (set! (-> *camera* interest-dist) 409.6) + ) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (let ((a0-9 (new 'stack-no-clear 'vector))) + 0.0 + (vector+*! a0-9 (-> *math-camera* trans) (-> arg0 fvec) (-> *camera* interest-dist)) + (vector-! s3-0 (-> *math-camera* trans) a0-9) + ) + (vector-length s3-0) + (cond + ((mouse-hold? left) + (let ((f30-0 (* 72.81778 (-> *mouse* speedy))) + (f28-0 (* -72.81778 (-> *mouse* speedx))) + ) + (let ((a2-8 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) (-> arg0 rvec) f30-0))) + (vector-orient-by-quat! s2-0 s3-0 a2-8) + ) + (let ((a2-10 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *y-vector* f28-0))) + (vector-orient-by-quat! s2-0 s2-0 a2-10) + ) + (vector-! s2-0 s2-0 s3-0) + (vector-matrix*! s2-0 s2-0 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) arg0)) + (+! (-> arg2 x) (-> s2-0 x)) + (+! (-> arg2 y) (-> s2-0 y)) + (+! (-> arg2 z) (-> s2-0 z)) + (+! (-> arg1 x) f30-0) + (set! (-> arg1 y) (+ (-> arg1 y) f28-0)) + ) ) - (init-vf0-vector) - (let ((v1-0 (new 'stack-no-clear 'vector))) - (vector-! v1-0 (-> *mouse* pos 0) (-> *mouse* pos 1)) - (if (< (-> *camera* interest-dist) 409.6) - (set! (-> *camera* interest-dist) 409.6) - ) - (let ((s3-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - ) - (let ((a0-9 (new 'stack-no-clear 'vector))) - 0.0 - (let ((a1-3 a0-9)) - (let ((a2-4 (-> *math-camera* trans))) - (let ((a3-0 (-> arg0 fvec))) - (let ((t0-1 (-> *camera* interest-dist))) - (.mov vf7 t0-1) - ) - (.lvf vf5 (&-> a3-0 quad)) - ) - (.lvf vf4 (&-> a2-4 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-3 quad) vf6) - ) - (vector-! s3-0 (-> *math-camera* trans) a0-9) - ) - (vector-length s3-0) - (cond - ((mouse-hold? left) - (let ((f30-0 (* 72.81778 (-> *mouse* speedy))) - (f28-0 (* -72.81778 (-> *mouse* speedx))) - ) - (let ((a2-8 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) (-> arg0 rvec) f30-0))) - (vector-orient-by-quat! s2-0 s3-0 a2-8) - ) - (let ((a2-10 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *y-vector* f28-0))) - (vector-orient-by-quat! s2-0 s2-0 a2-10) - ) - (vector-! s2-0 s2-0 s3-0) - (vector-matrix*! s2-0 s2-0 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) arg0)) - (+! (-> arg2 x) (-> s2-0 x)) - (+! (-> arg2 y) (-> s2-0 y)) - (+! (-> arg2 z) (-> s2-0 z)) - (+! (-> arg1 x) f30-0) - (set! (-> arg1 y) (+ (-> arg1 y) f28-0)) + ((mouse-hold? right) + (+! (-> arg2 z) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) + (set! (-> *camera* interest-dist) (- (-> *camera* interest-dist) (* (-> *CAM_FREE-bank* speed) (-> v1-0 x)))) + (if (< (-> *camera* interest-dist) 409.6) + (set! (-> *camera* interest-dist) 409.6) + ) + (when (< -8192.0 (vector-dot (-> arg0 fvec) s3-0)) + (let ((t0-1 (new 'static 'vector :w 1.0))) + (vector+*! t0-1 (-> *setting-control* cam-current mouse-tumble-point) (-> arg0 fvec) 8192.0) + (set-setting! 'mouse-tumble-point 'abs t0-1 0) ) ) - ((mouse-hold? right) - (+! (-> arg2 z) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) - (set! (-> *camera* interest-dist) (- (-> *camera* interest-dist) (* (-> *CAM_FREE-bank* speed) (-> v1-0 x)))) - (if (< (-> *camera* interest-dist) 409.6) - (set! (-> *camera* interest-dist) 409.6) - ) - (when (< -8192.0 (vector-dot (-> arg0 fvec) s3-0)) - (let ((t0-2 (new 'static 'vector :w 1.0))) - (let ((v1-18 t0-2)) - (let ((a0-33 (-> *setting-control* cam-current mouse-tumble-point))) - (let ((a1-12 (-> arg0 fvec))) - (let ((a2-13 8192.0)) - (.mov vf7 a2-13) - ) - (.lvf vf5 (&-> a1-12 quad)) - ) - (.lvf vf4 (&-> a0-33 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-18 quad) vf6) - ) - (set-setting! 'mouse-tumble-point 'abs t0-2 0) - ) - ) - ) - ((mouse-hold? middle) - (+! (-> arg2 x) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) - (+! (-> arg2 y) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed))) - (new 'static 'vector :w 1.0) - #f - ) - ) + ) + ((mouse-hold? middle) + (+! (-> arg2 x) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) + (+! (-> arg2 y) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed))) + (new 'static 'vector :w 1.0) + #f + ) ) ) ) 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 366188a7d7..8e11c204cd 100644 --- a/test/decompiler/reference/jak3/engine/collide/collide-cache_REF.gc +++ b/test/decompiler/reference/jak3/engine/collide/collide-cache_REF.gc @@ -240,301 +240,7 @@ ) ;; definition for method 13 of type collide-cache -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. -(defmethod fill-using-line-sphere ((this collide-cache) (arg0 collide-query)) - (local-vars (v1-11 float) (v1-20 float)) - (rlet ((acc :class vf) - (Q :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf10 :class vf) - (vf11 :class vf) - (vf12 :class vf) - (vf13 :class vf) - (vf14 :class vf) - (vf15 :class vf) - (vf16 :class vf) - (vf17 :class vf) - (vf18 :class vf) - (vf19 :class vf) - (vf2 :class vf) - (vf20 :class vf) - (vf22 :class vf) - (vf23 :class vf) - (vf3 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - (vf8 :class vf) - (vf9 :class vf) - ) - (init-vf0-vector) - (+! (-> *collide-stats* calls) 1) - (let ((v1-3 0)) - (if (< (fabs (-> arg0 move-dist x)) 4096.0) - (+! v1-3 1) - ) - (if (< (fabs (-> arg0 move-dist y)) 4096.0) - (+! v1-3 1) - ) - (if (< (fabs (-> arg0 move-dist z)) 4096.0) - (+! v1-3 1) - ) - (when (< 1 v1-3) - (set-from-point-offset-pad! (-> arg0 bbox) (-> arg0 start-pos) (-> arg0 move-dist) (-> arg0 radius)) - (fill-using-bounding-box this arg0) - (b! #t cfg-55 :delay (nop!)) - (the-as none 0) - ) - ) - (nop!) - (let ((v1-10 (-> arg0 ignore-pat-s32))) - (nop!) - (let ((a0-14 (-> arg0 ignore-process0))) - (nop!) - (let ((a1-3 (-> arg0 ignore-process1))) - (nop!) - (let ((a2-1 (-> arg0 collide-with-s32))) - (nop!) - (.lvf vf9 (&-> arg0 exit-planes 0 quad)) - (nop!) - (.lvf vf3 (&-> arg0 move-dist quad)) - (nop!) - (.mov.vf vf13 vf0) - (nop!) - (.lvf vf1 (&-> arg0 start-pos quad)) - (.mul.vf vf8 vf3 vf3) - (nop!) - (.add.vf vf2 vf1 vf3) - (set! (-> this ignore-mask) (the-as pat-surface v1-10)) - (.add.y.vf.x vf8 vf8 vf8) - (set! (-> this num-tris) 0) - (.min.vf vf4 vf1 vf2) - (set! (-> this num-prims) 0) - (.max.vf vf5 vf1 vf2) - (set! (-> this collide-with) (the-as collide-spec a2-1)) - ) - (.sub.w.vf.xyz vf10 vf0 vf9) - (set! (-> this ignore-processes 0) (the-as process a0-14)) - (.add.z.vf.x vf8 vf8 vf8) - (set! (-> this ignore-processes 1) (the-as process a1-3)) - ) - ) - ) - (.sub.w.vf.xyz vf4 vf4 vf9) - (nop!) - (.add.w.vf.xyz vf5 vf5 vf9) - (nop!) - (.ftoi.vf vf15 vf10) - (nop!) - (.isqrt.vf Q vf0 vf8 :fsf #b11 :ftf #b0) - (nop!) - (.add.w.vf.xyz vf11 vf0 vf9) - (nop!) - (nop!) - (nop!) - (nop!) - (.svf (&-> arg0 local-box4w min quad) vf15) - (.ftoi.vf vf6 vf4) - (.svf (&-> this collide-box min quad) vf4) - (.ftoi.vf vf7 vf5) - (.svf (&-> this collide-box max quad) vf5) - (nop!) - (.svf (&-> arg0 bbox min quad) vf4) - (nop!) - (.svf (&-> arg0 bbox max quad) vf5) - (nop!) - (.svf (&-> this collide-box4w min quad) vf6) - (nop!) - (.svf (&-> this collide-box4w max quad) vf7) - (nop!) - (.svf (&-> arg0 bbox4w min quad) vf6) - (nop!) - (.svf (&-> arg0 bbox4w max quad) vf7) - (.wait.vf) - (nop!) - (.add.vf.x vf8 vf0 Q) - (nop!) - (.mul.x.vf vf12 vf3 vf8) - (nop!) - (.nop.vf) - (nop!) - (.div.vf Q vf0 vf8 :fsf #b11 :ftf #b0) - (nop!) - (.mul.vf vf22 vf12 vf12) - (nop!) - (.abs.vf vf23 vf12) - (nop!) - (.add.y.vf.x vf22 vf22 vf22) - (.mov v1-11 vf23) - (.wait.vf) - (nop!) - (.add.vf.x vf8 vf0 Q) - (nop!) - (b! (zero? v1-11) cfg-12 :likely-delay (.add.z.vf.x vf13 vf0 vf12)) - (.sub.y.vf.x vf13 vf0 vf12) - (nop!) - (.isqrt.vf Q vf0 vf22 :fsf #b11 :ftf #b0) - (nop!) - (.add.x.vf.y vf13 vf0 vf12) - (nop!) - (.wait.vf) - (nop!) - (.mul.vf.xy vf13 vf13 Q) - (nop!) - (label cfg-12) - (.outer.product.a.vf acc vf12 vf13) - (nop!) - (.add.x.vf.x vf11 vf11 vf8) - (nop!) - (.outer.product.b.vf vf14 vf13 vf12 acc) - (nop!) - (.ftoi.vf vf16 vf11) - (nop!) - (.mov.vf vf17 vf12) - (nop!) - (.mov.vf vf18 vf13) - (nop!) - (.mov.vf vf19 vf14) - (nop!) - (.mov.vf.yzw vf17 vf0) - (.svf (&-> arg0 local-box4w max quad) vf16) - (.mov.vf.xzw vf18 vf0) - (nop!) - (.mov.vf.xyw vf19 vf0) - (nop!) - (.add.x.vf.y vf17 vf17 vf13) - (nop!) - (.add.y.vf.x vf18 vf18 vf12) - (nop!) - (.add.z.vf.x vf19 vf19 vf12) - (nop!) - (.add.x.vf.z vf17 vf17 vf14) - (nop!) - (.add.y.vf.z vf18 vf18 vf14) - (nop!) - (.add.z.vf.y vf19 vf19 vf13) - (nop!) - (.mul.x.vf acc vf17 vf1) - (nop!) - (.add.mul.y.vf acc vf18 vf1 acc) - (.svf (&-> arg0 inv-mat rvec quad) vf17) - (.add.mul.z.vf vf20 vf19 vf1 acc) - (.svf (&-> arg0 inv-mat uvec quad) vf18) - (.sub.vf vf20 vf0 vf20) - (.svf (&-> arg0 inv-mat fvec quad) vf19) - (nop!) - (.svf (&-> arg0 inv-mat trans quad) vf20) - (set! (-> arg0 rlength x) (if (= (-> arg0 move-dist x) 0.0) - 0.0 - (/ 1.0 (-> arg0 move-dist x)) - ) - ) - (set! (-> arg0 rlength y) (if (= (-> arg0 move-dist y) 0.0) - 0.0 - (/ 1.0 (-> arg0 move-dist y)) - ) - ) - (set! (-> arg0 rlength z) (if (= (-> arg0 move-dist z) 0.0) - 0.0 - (/ 1.0 (-> arg0 move-dist z)) - ) - ) - (let ((f0-19 1.0)) - (.lvf vf1 (&-> (-> arg0 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-20 vf1) - (set! (-> arg0 rlength w) (/ f0-19 v1-20)) - ) - (set! (-> arg0 exit-planes 0 x) (if (< 0.0 (-> arg0 move-dist x)) - 0.0 - 100000000000000000000000000000000000000.0 - ) - ) - (set! (-> arg0 exit-planes 0 y) (if (< 0.0 (-> arg0 move-dist y)) - 0.0 - 100000000000000000000000000000000000000.0 - ) - ) - (set! (-> arg0 exit-planes 0 z) (if (< 0.0 (-> arg0 move-dist z)) - 0.0 - 100000000000000000000000000000000000000.0 - ) - ) - (set! (-> arg0 exit-planes 1 x) (if (< (-> arg0 move-dist x) 0.0) - 0.0 - 100000000000000000000000000000000000000.0 - ) - ) - (set! (-> arg0 exit-planes 1 y) (if (< (-> arg0 move-dist y) 0.0) - 0.0 - 100000000000000000000000000000000000000.0 - ) - ) - (set! (-> arg0 exit-planes 1 z) (if (< (-> arg0 move-dist z) 0.0) - 0.0 - 100000000000000000000000000000000000000.0 - ) - ) - (when (logtest? (-> arg0 collide-with) (collide-spec backgnd)) - (fill-from-bg - this - (the-as - (function collide-hash int collide-list collide-query int) - (method-of-type collide-hash drawable-method-12) - ) - collide-list-fill-bg-using-line-sphere - arg0 - ) - (dotimes (s4-0 (-> *level* length)) - (let ((v1-36 (-> *level* level s4-0))) - (when (= (-> v1-36 status) 'active) - (let ((a0-18 (-> v1-36 bsp hfrag-drawable))) - (if (nonzero? a0-18) - (line-sphere-query (the-as hfragment a0-18) this arg0) - ) - ) - ) - ) - ) - (let ((a0-19 (-> this num-tris))) - (when (> a0-19 0) - (let ((v1-43 (-> this prims)) - (a1-11 *collide-shape-prim-backgnd*) - ) - (set! (-> v1-43 0 num-tris) (the-as uint a0-19)) - (set! (-> v1-43 0 prim) a1-11) - (set! (-> this num-prims) 1) - (set! (-> v1-43 0 first-tri) (the-as uint 0)) - (set! (-> v1-43 0 ccache) this) - (set! (-> v1-43 0 prim-core world-sphere quad) (-> a1-11 prim-core world-sphere quad)) - (set! (-> v1-43 0 prim-core quad 1) (-> a1-11 prim-core quad 1)) - ) - ) - ) - (+! (-> *collide-stats* output) (-> this num-tris)) - ) - (when (logtest? (-> arg0 collide-with) (collide-spec water)) - (let ((a1-13 (-> (the-as process-drawable (-> arg0 ignore-process0)) water))) - (if (nonzero? a1-13) - (fill-from-water this a1-13) - ) - ) - ) - (if (logtest? (-> arg0 collide-with) (collide-spec hit-by-player-list hit-by-others-list player-list)) - (fill-from-fg-line-sphere this arg0) - ) - 0 - (label cfg-55) - (none) - ) - ) +;; ERROR: function was not converted to expressions. Cannot decompile. ;; definition for method 19 of type collide-cache ;; WARN: Return type mismatch int vs none. @@ -646,130 +352,115 @@ ;; definition for method 20 of type collide-cache ;; WARN: Return type mismatch int vs none. (defmethod fill-from-fg-line-sphere ((this collide-cache) (arg0 collide-query)) - (local-vars (v1-9 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (-> arg0 collide-with))) - (set! *actor-list-length* 0) - (if (logtest? s4-0 (collide-spec hit-by-others-list)) - (set! *actor-list-length* (fill-actor-list-for-sphere - *actor-hash* - (-> arg0 start-pos) - (-> arg0 move-dist) - (-> arg0 radius) - *actor-list* - 256 - -1 - ) - ) - ) - (let ((f30-0 0.0) - (s3-0 (new 'stack-no-clear 'matrix)) - ) - (.lvf vf1 (&-> (-> arg0 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-9 vf1) - (let ((f0-1 v1-9)) - (if (< 0.0 f0-1) - (set! f30-0 (/ 1.0 f0-1)) + (let ((s4-0 (-> arg0 collide-with))) + (set! *actor-list-length* 0) + (if (logtest? s4-0 (collide-spec hit-by-others-list)) + (set! *actor-list-length* (fill-actor-list-for-sphere + *actor-hash* + (-> arg0 start-pos) + (-> arg0 move-dist) + (-> arg0 radius) + *actor-list* + 256 + -1 + ) ) + ) + (let ((f30-0 0.0) + (s3-0 (new 'stack-no-clear 'matrix)) ) - (when (logtest? s4-0 (collide-spec player-list)) - (let ((v1-17 (-> *collide-player-list* alive-list next0))) - *collide-player-list* - (let ((s2-0 (-> v1-17 next0))) - (while (!= v1-17 (-> *collide-player-list* alive-list-end)) - (let* ((s1-0 (-> (the-as connection v1-17) param1)) - (v1-18 (-> (the-as collide-shape s1-0) root-prim)) - ) - (when (logtest? s4-0 (-> v1-18 prim-core collide-as)) - (let ((s0-0 (-> v1-18 prim-core))) - (vector-! (-> s3-0 uvec) (-> s0-0 world-sphere) (-> arg0 start-pos)) - (let* ((f1-2 (* (vector-dot (-> arg0 move-dist) (-> s3-0 uvec)) f30-0)) - (f0-6 (fmax 0.0 (fmin 1.0 f1-2))) - ) - (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)) - ) + (let ((f0-1 (vector-length-squared (-> arg0 move-dist)))) + (if (< 0.0 f0-1) + (set! f30-0 (/ 1.0 f0-1)) + ) + ) + (when (logtest? s4-0 (collide-spec player-list)) + (let ((v1-17 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((s2-0 (-> v1-17 next0))) + (while (!= v1-17 (-> *collide-player-list* alive-list-end)) + (let* ((s1-0 (-> (the-as connection v1-17) param1)) + (v1-18 (-> (the-as collide-shape s1-0) root-prim)) + ) + (when (logtest? s4-0 (-> v1-18 prim-core collide-as)) + (let ((s0-0 (-> v1-18 prim-core))) + (vector-! (-> s3-0 uvec) (-> s0-0 world-sphere) (-> arg0 start-pos)) + (let* ((f1-2 (* (vector-dot (-> arg0 move-dist) (-> s3-0 uvec)) f30-0)) + (f0-6 (fmax 0.0 (fmin 1.0 f1-2))) + ) + (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)) ) ) ) ) ) - (set! v1-17 s2-0) - *collide-player-list* - (set! s2-0 (-> s2-0 next0)) - ) - ) - ) - ) - (when (logtest? s4-0 (collide-spec hit-by-player-list)) - (let ((v1-38 (-> *collide-hit-by-player-list* alive-list next0))) - *collide-hit-by-player-list* - (let ((s2-1 (-> v1-38 next0))) - (while (!= v1-38 (-> *collide-hit-by-player-list* alive-list-end)) - (let* ((s1-1 (-> (the-as connection v1-38) param1)) - (v1-39 (-> (the-as collide-shape s1-1) root-prim)) - ) - (when (logtest? s4-0 (-> v1-39 prim-core collide-as)) - (let ((s0-1 (-> v1-39 prim-core))) - (vector-! (-> s3-0 uvec) (-> s0-1 world-sphere) (-> arg0 start-pos)) - (let* ((f1-8 (* (vector-dot (-> arg0 move-dist) (-> s3-0 uvec)) f30-0)) - (f0-11 (fmax 0.0 (fmin 1.0 f1-8))) - ) - (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)) - ) - ) - ) - ) - ) - ) - (set! v1-38 s2-1) - *collide-hit-by-player-list* - (set! s2-1 (-> s2-1 next0)) ) + (set! v1-17 s2-0) + *collide-player-list* + (set! s2-0 (-> s2-0 next0)) ) ) ) ) - (dotimes (s3-1 *actor-list-length*) - (let ((v1-58 (-> *actor-list* s3-1))) - (when (logtest? s4-0 (-> v1-58 root-prim prim-core collide-as)) - (let ((a0-37 (-> v1-58 process))) - (if (not (or (= a0-37 (-> this ignore-processes 0)) (= a0-37 (-> this ignore-processes 1)))) - (add-fg-prim-using-line-sphere (-> v1-58 root-prim) this arg0) + (when (logtest? s4-0 (collide-spec hit-by-player-list)) + (let ((v1-38 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((s2-1 (-> v1-38 next0))) + (while (!= v1-38 (-> *collide-hit-by-player-list* alive-list-end)) + (let* ((s1-1 (-> (the-as connection v1-38) param1)) + (v1-39 (-> (the-as collide-shape s1-1) root-prim)) + ) + (when (logtest? s4-0 (-> v1-39 prim-core collide-as)) + (let ((s0-1 (-> v1-39 prim-core))) + (vector-! (-> s3-0 uvec) (-> s0-1 world-sphere) (-> arg0 start-pos)) + (let* ((f1-8 (* (vector-dot (-> arg0 move-dist) (-> s3-0 uvec)) f30-0)) + (f0-11 (fmax 0.0 (fmin 1.0 f1-8))) + ) + (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)) + ) + ) + ) + ) ) + ) + (set! v1-38 s2-1) + *collide-hit-by-player-list* + (set! s2-1 (-> s2-1 next0)) ) ) ) ) ) - 0 - (none) + (dotimes (s3-1 *actor-list-length*) + (let ((v1-58 (-> *actor-list* s3-1))) + (when (logtest? s4-0 (-> v1-58 root-prim prim-core collide-as)) + (let ((a0-37 (-> v1-58 process))) + (if (not (or (= a0-37 (-> this ignore-processes 0)) (= a0-37 (-> this ignore-processes 1)))) + (add-fg-prim-using-line-sphere (-> v1-58 root-prim) this arg0) + ) + ) + ) + ) + ) ) + 0 + (none) ) ;; definition for method 11 of type collide-shape-prim 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 6cea1c1d31..bb2ee5c420 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 @@ -164,21 +164,7 @@ (s4-0 (-> s1-0 prim-index)) ) (let ((s0-0 (new 'stack-no-clear 'vector))) - (let ((a1-1 s0-0)) - (let ((v1-1 (-> arg0 center-pt))) - (let ((a0-1 (-> s2-0 edge-vec-norm))) - (let ((a2-2 1105.92)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-1 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-1 quad) vf6) - ) + (vector+*! s0-0 (-> arg0 center-pt) (-> s2-0 edge-vec-norm) 1105.92) (let ((f0-1 (get-best-hand-point this (-> arg1 right-hand-hold) s0-0 (the-as int s4-0)))) (if (< 491.52 f0-1) (return (the-as symbol #f)) @@ -230,8 +216,8 @@ (-> this spec local-player-spheres) 12 ) - (let ((a1-12 (new 'stack-no-clear 'collide-query))) - (let ((v1-28 a1-12)) + (let ((a1-13 (new 'stack-no-clear 'collide-query))) + (let ((v1-28 a1-13)) (set! (-> v1-28 best-dist) (the-as float (-> this world-player-spheres))) (set! (-> v1-28 best-other-prim) (the-as collide-shape-prim 12)) (set! (-> v1-28 collide-with) (-> this cshape root-prim prim-core collide-with)) @@ -243,7 +229,7 @@ (set! (-> v1-28 best-my-prim) (the-as collide-shape-prim #t)) (set! (-> v1-28 action-mask) (collide-action solid)) ) - (if (probe-using-spheres (-> this ccache) a1-12) + (if (probe-using-spheres (-> this ccache) a1-13) (return (the-as symbol #f)) ) ) @@ -258,12 +244,12 @@ (a0-44 (set! (-> arg1 actor-cshape-prim-offset) (- (the-as int v1-41) (the-as uint (the-as int (-> a0-44 process))))) (set! (-> arg1 actor-handle) (process->handle (-> a0-44 process))) - (let ((a1-19 + (let ((a1-20 (-> a0-44 process node-list data (-> (the-as collide-shape-prim v1-41) transform-index) bone transform) ) (s5-1 (new 'stack-no-clear 'matrix)) ) - (matrix-4x4-inverse! s5-1 a1-19) + (matrix-4x4-inverse! s5-1 a1-20) (dotimes (s4-1 8) (vector-matrix*! (-> arg1 local-vertex s4-1) (-> arg1 world-vertex s4-1) s5-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 cd93920b37..966470fa79 100644 --- a/test/decompiler/reference/jak3/engine/collide/collide-shape_REF.gc +++ b/test/decompiler/reference/jak3/engine/collide/collide-shape_REF.gc @@ -256,7 +256,6 @@ (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((v1-0 (-> arg0 prim-core prim-type))) @@ -312,17 +311,8 @@ ) ) (v1-11 (vector-cross! (new 'stack-no-clear 'vector) s3-0 a0-8)) - (a0-9 (-> arg1 best-other-tri vertex 2)) ) - (let ((a1-7 4096.0)) - (.mov vf7 a1-7) - ) - (.lvf vf5 (&-> v1-11 quad)) - (.lvf vf4 (&-> s4-1 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) + (vector+*! (-> arg1 best-other-tri vertex 2) s4-1 v1-11 4096.0) ) ) (b! #t cfg-9 :delay (nop!)) @@ -348,7 +338,7 @@ (vector+! s3-2 s3-2 (-> this prim-core world-sphere)) (set! (-> arg1 best-other-tri vertex 0 quad) (-> s3-2 quad)) (point-in-plane-<-point+normal! (-> arg1 best-other-tri vertex 1) s3-2 s4-2) - (let* ((a0-23 (vector-normalize! + (let* ((a0-24 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri vertex 1) @@ -357,18 +347,9 @@ 1.0 ) ) - (v1-23 (vector-cross! (new 'stack-no-clear 'vector) s4-2 a0-23)) - (a0-24 (-> arg1 best-other-tri vertex 2)) + (v1-23 (vector-cross! (new 'stack-no-clear 'vector) s4-2 a0-24)) ) - (let ((a1-18 4096.0)) - (.mov vf7 a1-18) - ) - (.lvf vf5 (&-> v1-23 quad)) - (.lvf vf4 (&-> s3-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 (&-> a0-24 quad) vf6) + (vector+*! (-> arg1 best-other-tri vertex 2) s3-2 v1-23 4096.0) ) ) ) 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 6563fc4438..87d1bb9da6 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/debris_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/debris_REF.gc @@ -271,126 +271,103 @@ (sv-80 (function sound-name sound-id int int int sound-group object sound-id :behavior process-drawable)) (name sound-name) ) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((debris-box (-> this boxes idx)) + (box-num (-> debris-box num)) + (box-start (-> debris-box start)) + (bbox (-> debris-box bbox)) ) - (init-vf0-vector) - (let* ((debris-box (-> this boxes idx)) - (box-num (-> debris-box num)) - (box-start (-> debris-box start)) - (bbox (-> debris-box bbox)) - ) - (when (> box-num 0) - (let ((cquery (new 'static 'collide-query))) - (let ((debris-start (-> this debris box-start))) - (let ((a3-0 (-> cquery bbox)) - (a1-2 (-> bbox min)) - (a2-0 (new 'stack-no-clear 'vector)) - ) - (set! (-> a2-0 x) 4096.0) - (set! (-> a2-0 y) 4096.0) - (set! (-> a2-0 z) 4096.0) - (set! (-> a2-0 w) 1.0) - (vector-! (-> a3-0 min) a1-2 a2-0) - ) - (let ((a1-3 (-> cquery bbox max)) - (a0-2 (-> bbox max)) - (a2-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> a2-1 x) 4096.0) - (set! (-> a2-1 y) 4096.0) - (set! (-> a2-1 z) 4096.0) - (set! (-> a2-1 w) 1.0) - (vector+! a1-3 a0-2 a2-1) - ) - (set! (-> cquery collide-with) (-> debris-start params collide-spec)) - ) - (set! (-> cquery ignore-process0) #f) - (set! (-> cquery ignore-process1) #f) - (set! (-> cquery ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + (when (> box-num 0) + (let ((cquery (new 'static 'collide-query))) + (let ((debris-start (-> this debris box-start))) + (let ((a3-0 (-> cquery bbox)) + (a1-2 (-> bbox min)) + (a2-0 (new 'stack-no-clear 'vector)) ) - (set! (-> cquery action-mask) (collide-action solid)) - (fill-using-bounding-box *collide-cache* cquery) - (dotimes (s2-0 (the-as int box-num)) - (let ((s1-0 (-> this debris (+ s2-0 box-start)))) - (when (not (logtest? (-> this debris (+ s2-0 box-start) draw status) (draw-control-status no-draw))) - (let ((f0-9 (* (-> s1-0 gravity) (seconds-per-frame))) - (s0-0 (new 'stack-no-clear 'quaternion)) - ) - (vector-copy! (-> s1-0 prev-pos) (-> s1-0 root trans)) - (+! (-> s1-0 transv y) f0-9) - (vector-v+! (-> s1-0 root trans) (-> s1-0 root trans) (-> s1-0 transv)) - (quaternion-vector-angle! s0-0 (-> s1-0 rot-axis) (* (-> s1-0 rot-angle) (seconds-per-frame))) - (quaternion*! (-> s1-0 root quat) (-> s1-0 root quat) s0-0) - ) - (quaternion-normalize! (-> s1-0 root quat)) - (set! (-> s1-0 rot-angle) (- (-> s1-0 rot-angle) (* (seconds-per-frame) (-> s1-0 rot-angle)))) - (when (nonzero? (-> s1-0 params collide-spec)) - (let ((s0-1 (new 'stack-no-clear 'vector))) - (vector-! (-> cquery move-dist) (-> s1-0 root trans) (-> s1-0 prev-pos)) - (vector-copy! (-> cquery start-pos) (-> s1-0 prev-pos)) - (let ((v1-34 cquery)) - (set! (-> v1-34 radius) 2048.0) - (set! (-> v1-34 collide-with) (-> s1-0 params collide-spec)) - (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)) - ) - (let ((f0-16 (probe-using-line-sphere *collide-cache* cquery))) - (when (>= f0-16 0.0) - (let ((a1-12 s0-1)) - (let ((v1-37 (-> cquery start-pos))) - (let ((a0-21 (-> cquery move-dist))) - (let ((a2-5 f0-16)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-21 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-12 quad) vf6) + (set! (-> a2-0 x) 4096.0) + (set! (-> a2-0 y) 4096.0) + (set! (-> a2-0 z) 4096.0) + (set! (-> a2-0 w) 1.0) + (vector-! (-> a3-0 min) a1-2 a2-0) + ) + (let ((a1-3 (-> cquery bbox max)) + (a0-2 (-> bbox max)) + (a2-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a2-1 x) 4096.0) + (set! (-> a2-1 y) 4096.0) + (set! (-> a2-1 z) 4096.0) + (set! (-> a2-1 w) 1.0) + (vector+! a1-3 a0-2 a2-1) + ) + (set! (-> cquery collide-with) (-> debris-start params collide-spec)) + ) + (set! (-> cquery ignore-process0) #f) + (set! (-> cquery ignore-process1) #f) + (set! (-> cquery ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> cquery action-mask) (collide-action solid)) + (fill-using-bounding-box *collide-cache* cquery) + (dotimes (s2-0 (the-as int box-num)) + (let ((s1-0 (-> this debris (+ s2-0 box-start)))) + (when (not (logtest? (-> this debris (+ s2-0 box-start) draw status) (draw-control-status no-draw))) + (let ((f0-9 (* (-> s1-0 gravity) (seconds-per-frame))) + (s0-0 (new 'stack-no-clear 'quaternion)) + ) + (vector-copy! (-> s1-0 prev-pos) (-> s1-0 root trans)) + (+! (-> s1-0 transv y) f0-9) + (vector-v+! (-> s1-0 root trans) (-> s1-0 root trans) (-> s1-0 transv)) + (quaternion-vector-angle! s0-0 (-> s1-0 rot-axis) (* (-> s1-0 rot-angle) (seconds-per-frame))) + (quaternion*! (-> s1-0 root quat) (-> s1-0 root quat) s0-0) + ) + (quaternion-normalize! (-> s1-0 root quat)) + (set! (-> s1-0 rot-angle) (- (-> s1-0 rot-angle) (* (seconds-per-frame) (-> s1-0 rot-angle)))) + (when (nonzero? (-> s1-0 params collide-spec)) + (let ((s0-1 (new 'stack-no-clear 'vector))) + (vector-! (-> cquery move-dist) (-> s1-0 root trans) (-> s1-0 prev-pos)) + (vector-copy! (-> cquery start-pos) (-> s1-0 prev-pos)) + (let ((v1-34 cquery)) + (set! (-> v1-34 radius) 2048.0) + (set! (-> v1-34 collide-with) (-> s1-0 params collide-spec)) + (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) ) - (let* ((v1-38 (-> s1-0 transv)) - (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 ((id (new-sound-id)) - (a2-6 1024) - (a3-6 0) - (t0-4 0) - (t1-0 0) - (t2-0 (-> s1-0 root)) - ) - (sv-80 name id a2-6 a3-6 t0-4 (the-as sound-group t1-0) t2-0) - ) + (set! (-> v1-34 action-mask) (collide-action solid)) + ) + (let ((f0-16 (probe-using-line-sphere *collide-cache* cquery))) + (when (>= f0-16 0.0) + (vector+*! s0-1 (-> cquery start-pos) (-> cquery move-dist) f0-16) + (let* ((v1-38 (-> s1-0 transv)) + (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) ) - (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) - ) - (let ((f28-1 (-> s1-0 transv y))) - (vector-xz-normalize! (-> s1-0 transv) (* f30-0 (-> s1-0 hit-xz-reaction))) - (set! (-> s1-0 transv y) (* f28-1 (-> s1-0 hit-y-reaction))) ) + (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) + ) + (let ((f28-1 (-> s1-0 transv y))) + (vector-xz-normalize! (-> s1-0 transv) (* f30-0 (-> s1-0 hit-xz-reaction))) + (set! (-> s1-0 transv y) (* f28-1 (-> s1-0 hit-y-reaction))) ) - (+! (-> s0-1 y) (* 40.96 (-> cquery best-other-tri normal y))) - (set! (-> s0-1 w) 1.0) - (set! (-> s1-0 root trans quad) (-> s0-1 quad)) ) + (+! (-> s0-1 y) (* 40.96 (-> cquery best-other-tri normal y))) + (set! (-> s0-1 w) 1.0) + (set! (-> s1-0 root trans quad) (-> s0-1 quad)) ) ) ) @@ -400,9 +377,9 @@ ) ) ) - 0 - (none) ) + 0 + (none) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak3/engine/common-obs/guard-projectile_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/guard-projectile_REF.gc index 448abfcc7b..f10943efbe 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/guard-projectile_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/guard-projectile_REF.gc @@ -368,59 +368,37 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this guard-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 850 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 850 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 850) a1-0 s5-1 #f) - (set! (-> *part-id-table* 850 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 851) s4-0) - (launch-particles (-> *part-id-table* 852) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f26-0 (/ f30-0 (meters 9))) - (f30-1 (-> *part-id-table* 853 init-specs 3 initial-valuef)) - (f28-1 (-> *part-id-table* 853 init-specs 4 initial-valuef)) - ) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 853 init-specs 3 initial-valuef) (* f26-0 f30-1)) - (set! (-> *part-id-table* 853 init-specs 4 initial-valuef) (* f26-0 f28-1)) - (launch-particles (-> *part-id-table* 853) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 853 init-specs 3 initial-valuef) f30-1) - (set! (-> *part-id-table* 853 init-specs 4 initial-valuef) f28-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 850 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 850 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 850) a1-0 s5-1 #f) + (set! (-> *part-id-table* 850 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 851) s4-1) + (launch-particles (-> *part-id-table* 852) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f26-0 (/ f30-0 (meters 9))) + (f30-1 (-> *part-id-table* 853 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 853 init-specs 4 initial-valuef)) + ) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 853 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 853 init-specs 4 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 853) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 853 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 853 init-specs 4 initial-valuef) f28-1) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 26 of type guard-shot diff --git a/test/decompiler/reference/jak3/engine/common-obs/metalhead-projectile_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/metalhead-projectile_REF.gc index 605a634a03..68a265ca44 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/metalhead-projectile_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/metalhead-projectile_REF.gc @@ -363,58 +363,36 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this metalhead-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 863 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 863 init-specs 4 initial-valuef) (fmin f28-0 (vector-length s5-1))) - (draw-beam (-> *part-id-table* 863) a1-0 s5-1 #f) - (set! (-> *part-id-table* 863 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 864) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f26-0 (/ f30-0 (meters 12))) - (f30-1 (-> *part-id-table* 865 init-specs 3 initial-valuef)) - (f28-1 (-> *part-id-table* 865 init-specs 5 initial-valuef)) - ) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 865 init-specs 3 initial-valuef) (* f26-0 f30-1)) - (set! (-> *part-id-table* 865 init-specs 5 initial-valuef) (* f26-0 f28-1)) - (launch-particles (-> *part-id-table* 865) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 865 init-specs 3 initial-valuef) f30-1) - (set! (-> *part-id-table* 865 init-specs 5 initial-valuef) f28-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 863 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 863 init-specs 4 initial-valuef) (fmin f28-0 (vector-length s5-1))) + (draw-beam (-> *part-id-table* 863) a1-0 s5-1 #f) + (set! (-> *part-id-table* 863 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 864) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f26-0 (/ f30-0 (meters 12))) + (f30-1 (-> *part-id-table* 865 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 865 init-specs 5 initial-valuef)) + ) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 865 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 865 init-specs 5 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 865) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 865 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 865 init-specs 5 initial-valuef) f28-1) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 26 of type metalhead-shot diff --git a/test/decompiler/reference/jak3/engine/common-obs/voicebox_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/voicebox_REF.gc index 7fe1f9e15f..fc81f2c2d6 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/voicebox_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/voicebox_REF.gc @@ -132,52 +132,32 @@ ;; WARN: Return type mismatch int vs none. (defmethod post-common ((this remote)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (ja-post) - (if (type? (-> this root) collide-shape) - (update-transforms (the-as collide-shape (-> this root))) - ) - (when (and (nonzero? (-> this part)) (and (or (and (-> this next-state) (= (-> this next-state name) 'idle)) - (and (-> this next-state) (= (-> this next-state name) 'enter)) - ) - (-> this speak-effect?) - ) - ) - (let ((v1-15 - (vector-float*! (new 'stack-no-clear 'vector) (-> this parent 0 velocity) (-> pp clock frames-per-second)) - ) - (a0-8 *particle-vel*) - ) - (let ((a1-4 (-> this node-list data 3 bone transform fvec))) - (let ((a2-1 20480.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-4 quad)) - ) - (.lvf vf4 (&-> v1-15 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-8 quad) vf6) - ) - (let ((v1-16 *particle-vel*) - (a0-9 *particle-vel*) - (f0-2 300.0) - ) - (vector-float*! v1-16 a0-9 (/ 1.0 f0-2)) - ) - (spawn-from-cspace (-> this part) (-> this node-list data 3)) + (ja-post) + (if (type? (-> this root) collide-shape) + (update-transforms (the-as collide-shape (-> this root))) ) - 0 - (none) + (when (and (nonzero? (-> this part)) (and (or (and (-> this next-state) (= (-> this next-state name) 'idle)) + (and (-> this next-state) (= (-> this next-state name) 'enter)) + ) + (-> this speak-effect?) + ) + ) + (let ((v1-15 + (vector-float*! (new 'stack-no-clear 'vector) (-> this parent 0 velocity) (-> pp clock frames-per-second)) + ) + ) + (vector+*! *particle-vel* v1-15 (-> this node-list data 3 bone transform fvec) 20480.0) + ) + (let ((v1-16 *particle-vel*) + (a0-10 *particle-vel*) + (f0-2 300.0) + ) + (vector-float*! v1-16 a0-10 (/ 1.0 f0-2)) + ) + (spawn-from-cspace (-> this part) (-> this node-list data 3)) ) + 0 + (none) ) ) 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 88fde007d3..79591b5040 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 @@ -124,135 +124,100 @@ ;; 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)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 arg1) - (set! (-> s5-0 w) 1.0) - (when (>= (vector4-dot s5-0 (the-as vector (-> this leading))) 0.0) - (let* ((s1-0 (-> this sections)) - (s2-0 (-> s1-0 length)) - (a3-0 (the-as object (-> this leading))) - ) - (dotimes (s4-0 s2-0) - (let ((s3-0 (-> s1-0 data s4-0))) - (when (< (vector4-dot s5-0 (the-as vector (-> s3-0 trailing))) 0.0) - (let ((v1-10 (new 'stack-no-clear 'vector))) - (vector-! v1-10 s5-0 (-> s3-0 start)) - (when (>= (-> this belt-radius) (fabs (vector-dot v1-10 (-> s3-0 radial-dir)))) - (let* ((f0-7 (vector-dot v1-10 (-> s3-0 pull-dir))) - (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)) - ) - (let ((a1-6 (new 'stack-no-clear 'vector))) - (let ((v1-16 (-> s3-0 start))) - (let ((a0-13 (-> s3-0 pull-dir))) - (let ((a2-6 12288.0)) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-13 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 (&-> a1-6 quad) vf6) - ) - 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 ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 arg1) + (set! (-> s5-0 w) 1.0) + (when (>= (vector4-dot s5-0 (the-as vector (-> this leading))) 0.0) + (let* ((s1-0 (-> this sections)) + (s2-0 (-> s1-0 length)) + (a3-0 (the-as object (-> this leading))) + ) + (dotimes (s4-0 s2-0) + (let ((s3-0 (-> s1-0 data s4-0))) + (when (< (vector4-dot s5-0 (the-as vector (-> s3-0 trailing))) 0.0) + (let ((v1-10 (new 'stack-no-clear 'vector))) + (vector-! v1-10 s5-0 (-> s3-0 start)) + (when (>= (-> this belt-radius) (fabs (vector-dot v1-10 (-> s3-0 radial-dir)))) + (let* ((f0-7 (vector-dot v1-10 (-> s3-0 pull-dir))) + (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 ((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) - ) - (let ((a1-10 (new 'stack-no-clear 'vector))) - (let ((a0-17 s5-0)) - (let ((a2-9 2048.0)) - (.mov vf7 a2-9) - ) - (.lvf vf5 (&-> v1-22 quad)) - (.lvf vf4 (&-> a0-17 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-10 quad) vf6) - ) - ) - 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 ((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)) - ) - ) - (if (< (-> arg0 normal y) 0.0) - (vector-negate! (-> arg0 normal) (-> arg0 normal)) - ) - 0 - (return #t) ) + (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 ((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)) + ) + ) + (if (< (-> arg0 normal y) 0.0) + (vector-negate! (-> arg0 normal) (-> arg0 normal)) + ) + 0 + (return #t) ) ) ) ) ) - (set! a3-0 (+ (the-as uint (-> s1-0 data 0 trailing)) (* 80 s4-0))) ) + (set! a3-0 (+ (the-as uint (-> s1-0 data 0 trailing)) (* 80 s4-0))) ) ) ) - (return #f) - v0-7 ) + (return #f) + v0-7 ) ;; definition for method 11 of type flow-control @@ -260,92 +225,57 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: Function (method 11 flow-control) has a return type of none, but the expression builder found a return statement. (defmethod push-process ((this flow-control) (arg0 process-focusable)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 (get-trans arg0 0)) - (set! (-> s5-0 w) 1.0) - (when (>= (vector4-dot s5-0 (the-as vector (-> this leading))) 0.0) - (let* ((v1-7 (-> this sections)) - (a0-3 (-> v1-7 length)) - (a3-0 (the-as object (-> this leading))) - ) - (dotimes (s3-1 a0-3) - (let ((s2-0 (-> v1-7 data s3-1))) - (when (< (vector4-dot s5-0 (the-as vector (-> s2-0 trailing))) 0.0) - (let ((v1-8 (new 'stack-no-clear 'vector))) - (vector-! v1-8 s5-0 (-> s2-0 start)) - (when (>= (-> this belt-radius) (fabs (vector-dot v1-8 (-> s2-0 radial-dir)))) - (let* ((f0-7 (vector-dot v1-8 (-> s2-0 pull-dir))) - (f0-9 (- (-> v1-8 y) (* (-> s2-0 pull-dir y) f0-7))) - ) - (when (and (>= f0-9 -41984.0) (>= 41779.2 f0-9)) - (let* ((a0-11 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - (f30-0 (ray-plane-equation-intersect a0-11 s5-0 (-> s2-0 pull-dir) (the-as vector a3-0))) - (f0-10 (ray-plane-equation-intersect s1-0 s5-0 (-> s2-0 pull-dir) (-> s2-0 trailing))) - ) - (let ((a1-13 (new 'stack-no-clear 'vector))) - (let ((v1-13 (-> s2-0 start))) - (let ((a0-13 (-> s2-0 pull-dir))) - (let ((a2-6 12288.0)) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-13 quad)) - ) - (.lvf vf4 (&-> v1-13 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-13 quad) vf6) - ) - 0 - (let ((f0-12 (/ f30-0 (- f30-0 f0-10))) - (s1-1 (new 'stack-no-clear 'vector)) - ) - (displacement-between-two-points-normalized! (-> this path) s1-1 (+ (the float s3-1) f0-12)) - (let ((v1-17 (new 'stack-no-clear 'vector))) - (vector-float*! v1-17 s1-1 (* (-> s2-0 speed) (seconds-per-frame))) - (let ((a1-16 (new 'stack-no-clear 'vector))) - (let ((a0-17 v1-17)) - (let ((a2-9 2048.0)) - (.mov vf7 a2-9) - ) - (.lvf vf5 (&-> a0-17 quad)) - ) - (.lvf vf4 (&-> s5-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 (&-> a1-16 quad) vf6) - ) - 0 - (send-event arg0 'push-trans v1-17 (seconds 10)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 (get-trans arg0 0)) + (set! (-> s5-0 w) 1.0) + (when (>= (vector4-dot s5-0 (the-as vector (-> this leading))) 0.0) + (let* ((v1-7 (-> this sections)) + (a0-3 (-> v1-7 length)) + (a3-0 (the-as object (-> this leading))) + ) + (dotimes (s3-1 a0-3) + (let ((s2-0 (-> v1-7 data s3-1))) + (when (< (vector4-dot s5-0 (the-as vector (-> s2-0 trailing))) 0.0) + (let ((v1-8 (new 'stack-no-clear 'vector))) + (vector-! v1-8 s5-0 (-> s2-0 start)) + (when (>= (-> this belt-radius) (fabs (vector-dot v1-8 (-> s2-0 radial-dir)))) + (let* ((f0-7 (vector-dot v1-8 (-> s2-0 pull-dir))) + (f0-9 (- (-> v1-8 y) (* (-> s2-0 pull-dir y) f0-7))) + ) + (when (and (>= f0-9 -41984.0) (>= 41779.2 f0-9)) + (let* ((a0-11 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + (f30-0 (ray-plane-equation-intersect a0-11 s5-0 (-> s2-0 pull-dir) (the-as vector a3-0))) + (f0-10 (ray-plane-equation-intersect s1-0 s5-0 (-> s2-0 pull-dir) (-> s2-0 trailing))) + ) + (vector+*! (new 'stack-no-clear 'vector) (-> s2-0 start) (-> s2-0 pull-dir) 12288.0) + 0 + (let ((f0-12 (/ f30-0 (- f30-0 f0-10))) + (s1-1 (new 'stack-no-clear 'vector)) ) + (displacement-between-two-points-normalized! (-> this path) s1-1 (+ (the float s3-1) f0-12)) + (let ((v1-17 (new 'stack-no-clear 'vector))) + (vector-float*! v1-17 s1-1 (* (-> s2-0 speed) (seconds-per-frame))) + (vector+*! (new 'stack-no-clear 'vector) s5-0 v1-17 2048.0) + 0 + (send-event arg0 'push-trans v1-17 (seconds 10)) ) ) ) ) ) ) - (return #f) ) + (return #f) ) - (set! a3-0 (+ (the-as uint (-> v1-7 data 0 trailing)) (* 80 s3-1))) ) + (set! a3-0 (+ (the-as uint (-> v1-7 data 0 trailing)) (* 80 s3-1))) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 12 of type flow-control diff --git a/test/decompiler/reference/jak3/engine/debug/debug_REF.gc b/test/decompiler/reference/jak3/engine/debug/debug_REF.gc index 4f048c2fc5..d56ed05c9f 100644 --- a/test/decompiler/reference/jak3/engine/debug/debug_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/debug_REF.gc @@ -1466,56 +1466,35 @@ ;; definition (debug) for function add-debug-light ;; INFO: Used lq/sq (defun-debug add-debug-light ((arg0 symbol) (arg1 bucket-id) (arg2 light) (arg3 vector) (arg4 string)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (if (not (or arg0 *display-capture-mode*)) - (return #f) - ) - (when (!= (-> arg2 extra x) 0.0) - (add-debug-vector - arg0 - arg1 - arg3 - (-> arg2 direction) - (meters 3) - (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) - ) - (let ((s2-0 (new-stack-vector0))) - (let ((v1-4 (-> arg2 direction))) - (let ((a0-3 (* 12288.0 (-> arg2 extra x)))) - (.mov vf7 a0-3) - ) - (.lvf vf5 (&-> v1-4 quad)) - ) - (.lvf vf4 (&-> arg3 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 (&-> s2-0 quad) vf6) - (let ((s1-1 (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 extra x)) - (let ((t0-2 *temp-string*)) - (add-debug-text-sphere arg0 arg1 s2-0 (* 2048.0 (-> arg2 extra x)) t0-2 (the-as rgba s1-1)) - ) + (if (not (or arg0 *display-capture-mode*)) + (return #f) + ) + (when (!= (-> arg2 extra x) 0.0) + (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 extra x)))) + (s1-1 (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 extra x)) + (let ((t0-2 *temp-string*)) + (add-debug-text-sphere arg0 arg1 s2-1 (* 2048.0 (-> arg2 extra x)) t0-2 (the-as rgba s1-1)) ) ) - #f ) + #f ) ;; definition (debug) for function add-debug-lights diff --git a/test/decompiler/reference/jak3/engine/debug/manipulator_REF.gc b/test/decompiler/reference/jak3/engine/debug/manipulator_REF.gc index b7f3cb386a..426b751e7d 100644 --- a/test/decompiler/reference/jak3/engine/debug/manipulator_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/manipulator_REF.gc @@ -85,30 +85,17 @@ ) (vector-cross! s1-0 s1-0 arg1) (vector-normalize! s1-0 1.0) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (let ((v1-10 arg0)) - (let ((a0-8 arg1)) - (let ((a1-10 arg2)) - (.mov vf7 a1-10) - ) - (.lvf vf5 (&-> a0-8 quad)) - ) - (.lvf vf4 (&-> v1-10 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 (&-> s0-0 quad) vf6) + (let ((s0-1 (vector+*! (new 'stack-no-clear 'vector) arg0 arg1 arg2))) (set! 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-0)) + (let ((v1-16 s0-1)) (let ((a0-9 arg1)) - (let ((a1-11 arg3)) - (.mov vf7 a1-11) + (let ((a1-10 arg3)) + (.mov vf7 a1-10) ) (.lvf vf5 (&-> a0-9 quad)) ) @@ -119,7 +106,7 @@ (.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-0) + (set! sv-240 s0-1) (let* ((a2-3 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) arg1 (* 182.04445 (the float (* 45 sv-160)))) ) @@ -136,7 +123,7 @@ (.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-0) + (set! sv-272 s0-1) (let* ((a2-7 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) arg1 @@ -183,277 +170,161 @@ ;; WARN: Return type mismatch int vs none. (defmethod manipulator-method-11 ((this manipulator)) (local-vars (sv-240 rgba) (sv-256 vector) (sv-272 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (format *stdcon* "~M ~M ~M~%" (-> this position x) (-> this position y) (-> this position z)) - (let ((s5-0 (-> this position))) - 0.0 - (let* ((v0-1 - (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> *math-camera* trans) (-> this position)) 1.0) - ) - (s4-0 (< (fabs (vector-dot v0-1 (-> this mat rvec))) 0.9)) - (s3-0 (< (fabs (vector-dot v0-1 (-> this mat uvec))) 0.9)) - (s2-0 (< (fabs (vector-dot v0-1 (-> this mat fvec))) 0.9)) - (f30-1 (* 0.15 (vector-vector-distance (-> *math-camera* trans) s5-0))) + (format *stdcon* "~M ~M ~M~%" (-> this position x) (-> this position y) (-> this position z)) + (let ((s5-0 (-> this position))) + 0.0 + (let* ((v0-1 + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> *math-camera* trans) (-> this position)) 1.0) ) - (if s4-0 - (draw-axis s5-0 (-> this mat rvec) f30-1 (/ f30-1 4) (if (= (-> this action) (manipulator-action ma1)) - *color-yellow* - *color-red* - ) - ) + (s4-0 (< (fabs (vector-dot v0-1 (-> this mat rvec))) 0.9)) + (s3-0 (< (fabs (vector-dot v0-1 (-> this mat uvec))) 0.9)) + (s2-0 (< (fabs (vector-dot v0-1 (-> this mat fvec))) 0.9)) + (f30-1 (* 0.15 (vector-vector-distance (-> *math-camera* trans) s5-0))) + ) + (if s4-0 + (draw-axis s5-0 (-> this mat rvec) f30-1 (/ f30-1 4) (if (= (-> this action) (manipulator-action ma1)) + *color-yellow* + *color-red* + ) + ) + ) + (if s3-0 + (draw-axis s5-0 (-> this mat uvec) f30-1 (/ f30-1 4) (if (= (-> this action) (manipulator-action ma2)) + *color-yellow* + *color-green* + ) + ) + ) + (if s2-0 + (draw-axis s5-0 (-> this mat fvec) f30-1 (/ f30-1 4) (if (= (-> this action) (manipulator-action ma3)) + *color-yellow* + *color-blue* + ) + ) + ) + (let ((s1-0 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) ) - (if s3-0 - (draw-axis s5-0 (-> this mat uvec) f30-1 (/ f30-1 4) (if (= (-> this action) (manipulator-action ma2)) - *color-yellow* - *color-green* - ) - ) - ) - (if s2-0 - (draw-axis s5-0 (-> this mat fvec) f30-1 (/ f30-1 4) (if (= (-> this action) (manipulator-action ma3)) - *color-yellow* - *color-blue* - ) - ) - ) - (let ((s1-0 (new 'stack-no-clear 'vector)) - (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*) ) - (let ((f28-0 0.1)) - (if (= (-> this action) (manipulator-action ma7)) - (set! sv-240 *color-yellow*) - (set! sv-240 *color-light-blue*) - ) - (let ((a1-7 s1-0)) - (let ((v1-26 s5-0)) - (let ((a0-13 (vector+! - (new 'stack-no-clear 'vector) - (-> *math-camera* inv-camera-rot rvec) - (-> *math-camera* inv-camera-rot uvec) - ) + (vector+*! + s1-0 + s5-0 + (vector+! + (new 'stack-no-clear 'vector) + (-> *math-camera* inv-camera-rot rvec) + (-> *math-camera* inv-camera-rot uvec) + ) + (* f30-1 f28-0) + ) + (vector+*! s0-0 s1-0 (-> *math-camera* inv-camera-rot uvec) (* -2.0 f30-1 f28-0)) + (add-debug-line #t (bucket-id debug-no-zbuf1) s1-0 s0-0 sv-240 #f (the-as rgba -1)) + (vector-copy! s1-0 s0-0) + (vector+*! s0-0 s0-0 (-> *math-camera* inv-camera-rot rvec) (* -2.0 f30-1 f28-0)) + (add-debug-line #t (bucket-id debug-no-zbuf1) s1-0 s0-0 sv-240 #f (the-as rgba -1)) + (vector-copy! s1-0 s0-0) + (vector+*! s0-0 s0-0 (-> *math-camera* inv-camera-rot uvec) (* 2.0 f30-1 f28-0)) + (add-debug-line #t (bucket-id debug-no-zbuf1) s1-0 s0-0 sv-240 #f (the-as rgba -1)) + (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)) + ) + ) + (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 ((a2-6 (* f30-1 f28-0))) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-13 quad)) + ) ) - (.lvf vf4 (&-> v1-26 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-7 quad) vf6) - ) - (let ((a0-14 s0-0)) - (let ((v1-27 s1-0)) - (let ((a1-9 (-> *math-camera* inv-camera-rot uvec))) - (let ((a2-8 (* -2.0 f30-1 f28-0))) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a1-9 quad)) - ) - (.lvf vf4 (&-> v1-27 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-14 quad) vf6) - ) - (add-debug-line #t (bucket-id debug-no-zbuf1) s1-0 s0-0 sv-240 #f (the-as rgba -1)) - (vector-copy! s1-0 s0-0) - (let ((a0-18 s0-0)) - (let ((v1-29 s0-0)) - (let ((a1-12 (-> *math-camera* inv-camera-rot))) - (let ((a2-11 (* -2.0 f30-1 f28-0))) - (.mov vf7 a2-11) - ) - (.lvf vf5 (&-> a1-12 rvec quad)) - ) - (.lvf vf4 (&-> v1-29 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-18 quad) vf6) - ) - (add-debug-line #t (bucket-id debug-no-zbuf1) s1-0 s0-0 sv-240 #f (the-as rgba -1)) - (vector-copy! s1-0 s0-0) - (let ((a0-22 s0-0)) - (let ((v1-31 s0-0)) - (let ((a1-15 (-> *math-camera* inv-camera-rot uvec))) - (let ((a2-14 (* 2.0 f30-1 f28-0))) - (.mov vf7 a2-14) - ) - (.lvf vf5 (&-> a1-15 quad)) - ) - (.lvf vf4 (&-> v1-31 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-22 quad) vf6) - ) - (add-debug-line #t (bucket-id debug-no-zbuf1) s1-0 s0-0 sv-240 #f (the-as rgba -1)) - (vector-copy! s1-0 s0-0) - (let ((a0-26 s0-0)) - (let ((v1-33 s0-0)) - (let ((a1-18 (-> *math-camera* inv-camera-rot))) - (let ((a2-17 (* 2.0 f30-1 f28-0))) - (.mov vf7 a2-17) - ) - (.lvf vf5 (&-> a1-18 rvec quad)) - ) - (.lvf vf4 (&-> v1-33 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-26 quad) vf6) + (s0-1 sv-256 a1-24 a2-15 a3-11 t0-11) ) ) - (let ((t9-9 add-debug-line) - (a0-27 #t) - (a1-19 577) - (t1-3 #f) - (t2-3 -1) - ) - (t9-9 a0-27 (the-as bucket-id a1-19) s1-0 s0-0 sv-240 t1-3 (the-as rgba t2-3)) + (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* + ) + ) + ) + (s0-2 sv-272 a1-26 a2-16 a3-12 t0-12) + ) ) ) - (let ((s1-1 (new 'stack-no-clear 'vector))) - (when (and s3-0 s2-0) - (let ((a1-20 s1-1)) - (let ((v1-36 s5-0)) - (let ((a0-29 (vector+! (new 'stack-no-clear 'vector) (-> this mat fvec) (-> this mat uvec)))) - (let ((a2-20 f30-1)) - (.mov vf7 a2-20) - ) - (.lvf vf5 (&-> a0-29 quad)) - ) - (.lvf vf4 (&-> v1-36 quad)) + (set! s2-0 (and s4-0 s2-0)) + (when s2-0 + (vector+*! s1-1 s5-0 (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat fvec)) f30-1) + (draw-axis + s1-1 + (vector-negate! (new 'stack-no-clear 'vector) (-> this mat rvec)) + (* 0.15 f30-1) + (* 0.15 f30-1) + (if (= (-> this action) (manipulator-action ma5)) + *color-yellow* + *color-red* ) - (.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) - ) - (let ((s0-1 draw-axis)) - (set! sv-256 s1-1) - (let ((a1-22 (vector-negate! (new 'stack-no-clear 'vector) (-> this mat uvec))) - (a2-21 (* 0.15 f30-1)) - (a3-11 (* 0.15 f30-1)) - (t0-11 (if (= (-> this action) (manipulator-action ma6)) - *color-yellow* - *color-green* - ) - ) - ) - (s0-1 sv-256 a1-22 a2-21 a3-11 t0-11) - ) - ) - (let ((s0-2 draw-axis)) - (set! sv-272 s1-1) - (let ((a1-24 (vector-negate! (new 'stack-no-clear 'vector) (-> this mat fvec))) - (a2-22 (* 0.15 f30-1)) - (a3-12 (* 0.15 f30-1)) - (t0-12 (if (= (-> this action) (manipulator-action ma6)) - *color-yellow* - *color-blue* - ) - ) - ) - (s0-2 sv-272 a1-24 a2-22 a3-12 t0-12) - ) - ) ) - (set! s2-0 (and s4-0 s2-0)) - (when s2-0 - (let ((a1-25 s1-1)) - (let ((v1-44 s5-0)) - (let ((a0-37 (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat fvec)))) - (let ((a2-24 f30-1)) - (.mov vf7 a2-24) - ) - (.lvf vf5 (&-> a0-37 quad)) - ) - (.lvf vf4 (&-> v1-44 quad)) + (draw-axis + s1-1 + (vector-negate! (new 'stack-no-clear 'vector) (-> this mat fvec)) + (* 0.15 f30-1) + (* 0.15 f30-1) + (if (= (-> this action) (manipulator-action ma5)) + *color-yellow* + *color-blue* ) - (.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-25 quad) vf6) - ) - (draw-axis - s1-1 - (vector-negate! (new 'stack-no-clear 'vector) (-> this mat rvec)) - (* 0.15 f30-1) - (* 0.15 f30-1) - (if (= (-> this action) (manipulator-action ma5)) - *color-yellow* - *color-red* - ) - ) - (draw-axis - s1-1 - (vector-negate! (new 'stack-no-clear 'vector) (-> this mat fvec)) - (* 0.15 f30-1) - (* 0.15 f30-1) - (if (= (-> this action) (manipulator-action ma5)) - *color-yellow* - *color-blue* - ) - ) ) - (set! s3-0 (and s4-0 s3-0)) - (when s3-0 - (let ((a0-44 s1-1)) - (let ((v1-52 (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat uvec)))) - (let ((a1-31 f30-1)) - (.mov vf7 a1-31) - ) - (.lvf vf5 (&-> v1-52 quad)) + ) + (set! s3-0 (and s4-0 s3-0)) + (when s3-0 + (vector+*! s1-1 s5-0 (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat uvec)) f30-1) + (draw-axis + s1-1 + (vector-negate! (new 'stack-no-clear 'vector) (-> this mat rvec)) + (* 0.15 f30-1) + (* 0.15 f30-1) + (if (= (-> this action) (manipulator-action ma4)) + *color-yellow* + *color-red* + ) + ) + (draw-axis + s1-1 + (vector-negate! (new 'stack-no-clear 'vector) (-> this mat uvec)) + (* 0.15 f30-1) + (* 0.15 f30-1) + (if (= (-> this action) (manipulator-action ma4)) + *color-yellow* + *color-green* ) - (.lvf vf4 (&-> s5-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-44 quad) vf6) - ) - (draw-axis - s1-1 - (vector-negate! (new 'stack-no-clear 'vector) (-> this mat rvec)) - (* 0.15 f30-1) - (* 0.15 f30-1) - (if (= (-> this action) (manipulator-action ma4)) - *color-yellow* - *color-red* - ) - ) - (draw-axis - s1-1 - (vector-negate! (new 'stack-no-clear 'vector) (-> this mat uvec)) - (* 0.15 f30-1) - (* 0.15 f30-1) - (if (= (-> this action) (manipulator-action ma4)) - *color-yellow* - *color-green* - ) - ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 12 of type manipulator @@ -473,200 +344,137 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod manipulator-method-13 ((this manipulator) (arg0 vector) (arg1 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (cond - ((= (-> this mode) (manipulator-mode mm0)) - (vector-copy! (-> this speed) (-> this position)) - (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) arg1 arg0)) - (s4-1 (vector-! (new 'stack-no-clear 'vector) (-> this mouse-ref-position) arg0)) - ) - 0.0 - 0.0 - (let ((s2-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - ) - (cond - ((or (= (-> this action) (manipulator-action ma1)) - (= (-> this action) (manipulator-action ma2)) - (= (-> this action) (manipulator-action ma3)) - ) - (cond - ((= (-> this action) (manipulator-action ma1)) - (cond - ((< (fabs (vector-dot s5-1 (-> this mat uvec))) (fabs (vector-dot s5-1 (-> this mat fvec)))) - (vector-copy! s2-0 (-> this mat fvec)) - (vector-copy! s1-0 (-> this mat uvec)) - ) - (else - (vector-copy! s2-0 (-> this mat uvec)) - (vector-copy! s1-0 (-> this mat fvec)) - ) - ) - ) - ((= (-> this action) (manipulator-action ma2)) - (cond - ((< (fabs (vector-dot s5-1 (-> this mat rvec))) (fabs (vector-dot s5-1 (-> this mat fvec)))) - (vector-copy! s2-0 (-> this mat fvec)) - (vector-copy! s1-0 (-> this mat rvec)) - ) - (else - (vector-copy! s2-0 (-> this mat rvec)) - (vector-copy! s1-0 (-> this mat fvec)) - ) - ) - ) - ((= (-> this action) (manipulator-action ma3)) - (cond - ((< (fabs (vector-dot s5-1 (-> this mat uvec))) (fabs (vector-dot s5-1 (-> this mat rvec)))) - (vector-copy! s2-0 (-> this mat rvec)) - (vector-copy! s1-0 (-> this mat uvec)) - ) - (else - (vector-copy! s2-0 (-> this mat uvec)) - (vector-copy! s1-0 (-> this mat rvec)) - ) - ) - ) - ) - (let ((f30-0 (intersect-ray-plane arg0 s5-1 (-> this position) s2-0)) - (f0-11 (intersect-ray-plane arg0 s4-1 (-> this position) s2-0)) - ) - (let ((a1-3 s5-1)) - (let ((v1-41 arg0)) - (let ((a0-43 s5-1)) - (let ((a2-3 f30-0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-43 quad)) - ) - (.lvf vf4 (&-> v1-41 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-3 quad) vf6) - ) - (let ((a0-44 s4-1)) - (let ((v1-42 s4-1)) - (let ((a1-4 f0-11)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> v1-42 quad)) - ) - (.lvf vf4 (&-> arg0 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-flatten! s5-1 (vector-! (new 'stack-no-clear 'vector) s5-1 (-> this position)) s1-0) - (vector-flatten! s4-1 (vector-! (new 'stack-no-clear 'vector) s4-1 (-> this position)) s1-0) - (let ((v1-46 (vector-! (new 'stack-no-clear 'vector) s5-1 s4-1))) - (vector+! (-> this position) (-> this drag-ref-position) v1-46) - (format *stdcon* "delta ~M ~M ~M~%" (-> v1-46 x) (-> v1-46 y) (-> v1-46 z)) - ) - ) - ((or (= (-> this action) (manipulator-action ma4)) - (= (-> this action) (manipulator-action ma5)) - (= (-> this action) (manipulator-action ma6)) - (= (-> this action) (manipulator-action ma7)) - ) - (cond - ((= (-> this action) (manipulator-action ma4)) - (vector-copy! s2-0 *z-vector*) - ) - ((= (-> this action) (manipulator-action ma5)) - (vector-copy! s2-0 *y-vector*) - ) - ((= (-> this action) (manipulator-action ma6)) - (vector-copy! s2-0 *x-vector*) - ) - ((= (-> this action) (manipulator-action ma7)) - (vector-copy! s2-0 (-> *math-camera* inv-camera-rot fvec)) - ) - ) - (vector-normalize! s2-0 1.0) - (let ((f30-1 (intersect-ray-plane arg0 s5-1 (-> this position) s2-0)) - (f0-15 (intersect-ray-plane arg0 s4-1 (-> this position) s2-0)) - ) - (let ((a1-14 s5-1)) - (let ((v1-69 arg0)) - (let ((a0-69 s5-1)) - (let ((a2-13 f30-1)) - (.mov vf7 a2-13) - ) - (.lvf vf5 (&-> a0-69 quad)) - ) - (.lvf vf4 (&-> v1-69 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 ((v1-70 s4-1)) - (let ((a0-70 arg0)) - (let ((a1-15 s4-1)) - (let ((a2-14 f0-15)) - (.mov vf7 a2-14) - ) - (.lvf vf5 (&-> a1-15 quad)) - ) - (.lvf vf4 (&-> a0-70 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-70 quad) vf6) - ) - ) - (vector+! (-> this position) (-> this drag-ref-position) (vector-! (new 'stack-no-clear 'vector) s5-1 s4-1)) - ) - ) + (cond + ((= (-> this mode) (manipulator-mode mm0)) + (vector-copy! (-> this speed) (-> this position)) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) arg1 arg0)) + (s4-1 (vector-! (new 'stack-no-clear 'vector) (-> this mouse-ref-position) arg0)) ) - ) - (vector-! (-> this speed) (-> this position) (-> this speed)) - ) - ((= (-> this mode) (manipulator-mode mm1)) - (let ((s4-2 (- (-> this rotate-ref) (the int (-> *mouse* posx)))) - (s5-2 (new 'stack-no-clear 'matrix)) + 0.0 + 0.0 + (let ((s2-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) ) - (new 'stack 'euler-angles) - (matrix-identity! s5-2) (cond - ((= (-> this action) (manipulator-action ma1)) - (matrix-axis-angle! s5-2 (-> this mat rvec) (* 182.04445 (the float s4-2))) + ((or (= (-> this action) (manipulator-action ma1)) + (= (-> this action) (manipulator-action ma2)) + (= (-> this action) (manipulator-action ma3)) + ) + (cond + ((= (-> this action) (manipulator-action ma1)) + (cond + ((< (fabs (vector-dot s5-1 (-> this mat uvec))) (fabs (vector-dot s5-1 (-> this mat fvec)))) + (vector-copy! s2-0 (-> this mat fvec)) + (vector-copy! s1-0 (-> this mat uvec)) + ) + (else + (vector-copy! s2-0 (-> this mat uvec)) + (vector-copy! s1-0 (-> this mat fvec)) + ) + ) + ) + ((= (-> this action) (manipulator-action ma2)) + (cond + ((< (fabs (vector-dot s5-1 (-> this mat rvec))) (fabs (vector-dot s5-1 (-> this mat fvec)))) + (vector-copy! s2-0 (-> this mat fvec)) + (vector-copy! s1-0 (-> this mat rvec)) + ) + (else + (vector-copy! s2-0 (-> this mat rvec)) + (vector-copy! s1-0 (-> this mat fvec)) + ) + ) + ) + ((= (-> this action) (manipulator-action ma3)) + (cond + ((< (fabs (vector-dot s5-1 (-> this mat uvec))) (fabs (vector-dot s5-1 (-> this mat rvec)))) + (vector-copy! s2-0 (-> this mat rvec)) + (vector-copy! s1-0 (-> this mat uvec)) + ) + (else + (vector-copy! s2-0 (-> this mat uvec)) + (vector-copy! s1-0 (-> this mat rvec)) + ) + ) + ) + ) + (let ((f30-0 (intersect-ray-plane arg0 s5-1 (-> this position) s2-0)) + (f0-11 (intersect-ray-plane arg0 s4-1 (-> this position) s2-0)) + ) + (vector+*! s5-1 arg0 s5-1 f30-0) + (vector+*! s4-1 arg0 s4-1 f0-11) + ) + (vector-flatten! s5-1 (vector-! (new 'stack-no-clear 'vector) s5-1 (-> this position)) s1-0) + (vector-flatten! s4-1 (vector-! (new 'stack-no-clear 'vector) s4-1 (-> this position)) s1-0) + (let ((v1-46 (vector-! (new 'stack-no-clear 'vector) s5-1 s4-1))) + (vector+! (-> this position) (-> this drag-ref-position) v1-46) + (format *stdcon* "delta ~M ~M ~M~%" (-> v1-46 x) (-> v1-46 y) (-> v1-46 z)) + ) ) - ((= (-> this action) (manipulator-action ma2)) - (matrix-axis-angle! s5-2 (-> this mat uvec) (* 182.04445 (the float s4-2))) - ) - ((= (-> this action) (manipulator-action ma3)) - (matrix-axis-angle! s5-2 (-> this mat fvec) (* 182.04445 (the float s4-2))) + ((or (= (-> this action) (manipulator-action ma4)) + (= (-> this action) (manipulator-action ma5)) + (= (-> this action) (manipulator-action ma6)) + (= (-> this action) (manipulator-action ma7)) + ) + (cond + ((= (-> this action) (manipulator-action ma4)) + (vector-copy! s2-0 *z-vector*) + ) + ((= (-> this action) (manipulator-action ma5)) + (vector-copy! s2-0 *y-vector*) + ) + ((= (-> this action) (manipulator-action ma6)) + (vector-copy! s2-0 *x-vector*) + ) + ((= (-> this action) (manipulator-action ma7)) + (vector-copy! s2-0 (-> *math-camera* inv-camera-rot fvec)) + ) + ) + (vector-normalize! s2-0 1.0) + (let ((f30-1 (intersect-ray-plane arg0 s5-1 (-> this position) s2-0)) + (f0-15 (intersect-ray-plane arg0 s4-1 (-> this position) s2-0)) + ) + (vector+*! s5-1 arg0 s5-1 f30-1) + (vector+*! s4-1 arg0 s4-1 f0-15) + ) + (vector+! (-> this position) (-> this drag-ref-position) (vector-! (new 'stack-no-clear 'vector) s5-1 s4-1)) ) ) - (matrix*! (-> this mat) (-> this mat) s5-2) ) - (vector-normalize! (-> this mat rvec) 1.0) - (vector-normalize! (-> this mat uvec) 1.0) - (vector-normalize! (-> this mat fvec) 1.0) - (matrix->eul (-> this angles) (-> this mat) 21) - (format *stdcon* "X = ~R~%Y = ~R~%Z = ~R~%" (-> this angles x) (-> this angles y) (-> this angles z)) - (set! (-> this rotate-ref) (the int (-> *mouse* posx))) ) - (else - ) + (vector-! (-> this speed) (-> this position) (-> this speed)) + ) + ((= (-> this mode) (manipulator-mode mm1)) + (let ((s4-2 (- (-> this rotate-ref) (the int (-> *mouse* posx)))) + (s5-2 (new 'stack-no-clear 'matrix)) + ) + (new 'stack 'euler-angles) + (matrix-identity! s5-2) + (cond + ((= (-> this action) (manipulator-action ma1)) + (matrix-axis-angle! s5-2 (-> this mat rvec) (* 182.04445 (the float s4-2))) + ) + ((= (-> this action) (manipulator-action ma2)) + (matrix-axis-angle! s5-2 (-> this mat uvec) (* 182.04445 (the float s4-2))) + ) + ((= (-> this action) (manipulator-action ma3)) + (matrix-axis-angle! s5-2 (-> this mat fvec) (* 182.04445 (the float s4-2))) + ) + ) + (matrix*! (-> this mat) (-> this mat) s5-2) + ) + (vector-normalize! (-> this mat rvec) 1.0) + (vector-normalize! (-> this mat uvec) 1.0) + (vector-normalize! (-> this mat fvec) 1.0) + (matrix->eul (-> this angles) (-> this mat) 21) + (format *stdcon* "X = ~R~%Y = ~R~%Z = ~R~%" (-> this angles x) (-> this angles y) (-> this angles z)) + (set! (-> this rotate-ref) (the int (-> *mouse* posx))) + ) + (else ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 14 of type manipulator diff --git a/test/decompiler/reference/jak3/engine/debug/viewer_REF.gc b/test/decompiler/reference/jak3/engine/debug/viewer_REF.gc index 5e978b5404..1fccbe6fc4 100644 --- a/test/decompiler/reference/jak3/engine/debug/viewer_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/viewer_REF.gc @@ -41,7 +41,7 @@ :frame-num 0.0 ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-x-vel adjust-y-vel adjust-xz-vel keep-other-velocities adjust-quat) diff --git a/test/decompiler/reference/jak3/engine/math/quaternion_REF.gc b/test/decompiler/reference/jak3/engine/math/quaternion_REF.gc index 7a256f8dd5..1bd1ac68d2 100644 --- a/test/decompiler/reference/jak3/engine/math/quaternion_REF.gc +++ b/test/decompiler/reference/jak3/engine/math/quaternion_REF.gc @@ -996,29 +996,29 @@ ) ;; definition for function vector-rotate-around-axis! -(defun vector-rotate-around-axis! ((arg0 vector) (arg1 quaternion) (arg2 float) (arg3 vector)) +(defun vector-rotate-around-axis! ((arg0 vector) (arg1 vector) (arg2 float) (arg3 vector)) "Rotate along y so z-axis points to match another. Use arg3 as the max rotation amount." (let ((a2-1 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) arg3 arg2))) - (vector-orient-by-quat! arg0 (-> arg1 vec) a2-1) + (vector-orient-by-quat! arg0 arg1 a2-1) ) ) ;; definition for function vector-rotate-x! (defun vector-rotate-x! ((arg0 vector) (arg1 vector) (arg2 float)) "Rotate vector along x axis." - (vector-rotate-around-axis! arg0 (the-as quaternion arg1) arg2 *x-vector*) + (vector-rotate-around-axis! arg0 arg1 arg2 *x-vector*) ) ;; definition for function vector-rotate-y! (defun vector-rotate-y! ((arg0 vector) (arg1 vector) (arg2 float)) "Rotate vector along y axis." - (vector-rotate-around-axis! arg0 (the-as quaternion arg1) arg2 *y-vector*) + (vector-rotate-around-axis! arg0 arg1 arg2 *y-vector*) ) ;; definition for function vector-rotate-z! (defun vector-rotate-z! ((arg0 vector) (arg1 vector) (arg2 float)) "Rotate vector along z axis." - (vector-rotate-around-axis! arg0 (the-as quaternion arg1) arg2 *z-vector*) + (vector-rotate-around-axis! arg0 arg1 arg2 *z-vector*) ) ;; definition for function vector-y-angle diff --git a/test/decompiler/reference/jak3/engine/math/vector_REF.gc b/test/decompiler/reference/jak3/engine/math/vector_REF.gc index f1ced7c36d..a9f3a198e7 100644 --- a/test/decompiler/reference/jak3/engine/math/vector_REF.gc +++ b/test/decompiler/reference/jak3/engine/math/vector_REF.gc @@ -346,29 +346,9 @@ The step always points toward the target and has length (dist * alpha). If the step is longer than max-step, the step is projected onto a _square_ with side length arg2. Note that this doesn't project to a circle like the function below..." - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((v1-0 (new 'stack-no-clear 'vector))) - (vector-! v1-0 arg1 arg0) - (let ((v0-0 arg0)) - (let ((a1-2 (fmin 1.0 arg2))) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> v1-0 quad)) - (.lvf vf4 (&-> arg0 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 (&-> v0-0 quad) vf6) - v0-0 - ) - ) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (vector-! v1-0 arg1 arg0) + (vector+*! arg0 arg0 v1-0 (fmin 1.0 arg2)) ) ) @@ -624,22 +604,7 @@ ;; definition for function vector-length-squared (defun vector-length-squared ((arg0 vector)) "Get the squared length of the xyz part." - (local-vars (v0-0 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (.lvf vf1 (&-> arg0 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 v0-0 vf1) - v0-0 - ) + (vector-length-squared arg0) ) ;; definition for function vector-xz-length-squared @@ -1649,33 +1614,19 @@ ;; definition for function rand-vu-sphere-point-uniform! (defun rand-vu-sphere-point-uniform! ((arg0 vector) (arg1 float)) - (local-vars (v1-3 float) (f0-5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - 666.6 - (until (>= 1.0 f0-5) - (set-vector! - arg0 - (rand-vu-float-range -1.0 1.0) - (rand-vu-float-range -1.0 1.0) - (rand-vu-float-range -1.0 1.0) - 1.0 - ) - (.lvf vf1 (&-> arg0 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-3 vf1) - (set! f0-5 v1-3) + (local-vars (f0-5 float)) + 666.6 + (until (>= 1.0 f0-5) + (set-vector! + arg0 + (rand-vu-float-range -1.0 1.0) + (rand-vu-float-range -1.0 1.0) + (rand-vu-float-range -1.0 1.0) + 1.0 ) - (vector-float*! arg0 arg0 arg1) + (set! f0-5 (vector-length-squared arg0)) ) + (vector-float*! arg0 arg0 arg1) ) ;; definition for method 2 of type vector2 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 4e3e895370..2ebd4c49e4 100644 --- a/test/decompiler/reference/jak3/engine/nav/nav-control_REF.gc +++ b/test/decompiler/reference/jak3/engine/nav/nav-control_REF.gc @@ -589,10 +589,6 @@ (vf1 :class vf) (vf2 :class vf) (vf3 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((t1-0 (new 'stack-no-clear 'vector)) @@ -639,33 +635,8 @@ (a0-9 (new 'stack-no-clear 'vector)) ) (vector-float*! a0-9 t0-0 f1-3) - (let ((t0-1 arg2)) - (let ((a1-3 a0-9)) - (let ((a2-1 v1-0)) - (let ((t1-1 f0-7)) - (.mov vf7 t1-1) - ) - (.lvf vf5 (&-> a2-1 quad)) - ) - (.lvf vf4 (&-> a1-3 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 (&-> t0-1 quad) vf6) - ) - (let ((v0-0 arg3)) - (let ((a1-4 (- f0-7))) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> v1-0 quad)) - (.lvf vf4 (&-> a0-9 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 (&-> v0-0 quad) vf6) - v0-0 - ) + (vector+*! arg2 a0-9 v1-0 f0-7) + (vector+*! arg3 a0-9 v1-0 (- f0-7)) ) ) ) @@ -2321,192 +2292,172 @@ ;; 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 (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)) + ) + (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) ) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (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) (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)) + (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 ) - (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 - ) - (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) - ) - ) - ) - ) - ) - ) - (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) - ) - ) - (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) - ) - ) + ) + (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-13 f30-0) - (set! f30-0 f0-13) - (set! s5-2 s3-1) + (when (< f0-10 f2-8) + (set! f0-10 f2-8) + (set! s5-2 a0-41) ) ) ) ) ) - (vector-! (-> this travel) (-> sv-120 s5-2) (-> this virtual-current-pos-local)) ) - (set! (-> this travel y) 0.0) + (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) + ) + ) + (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)) ) + (set! (-> this travel y) 0.0) ) - (.lvf vf1 (&-> (-> this travel) 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-117 vf1) - (let ((f0-15 v1-117) - (f1-10 (-> this nav nav-cull-radius)) - ) - (if (< (* f1-10 f1-10) f0-15) - (vector-float*! (-> this travel) (-> this travel) (/ (-> this nav nav-cull-radius) (sqrtf f0-15))) - ) - ) - 0 - (none) ) + (let ((f0-15 (vector-length-squared (-> this travel))) + (f1-10 (-> this nav nav-cull-radius)) + ) + (if (< (* f1-10 f1-10) f0-15) + (vector-float*! (-> this travel) (-> this travel) (/ (-> this nav nav-cull-radius) (sqrtf f0-15))) + ) + ) + 0 + (none) ) ;; definition for method 50 of type nav-state @@ -3507,65 +3458,43 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod update-travel-dir-from-spheres ((this nav-state)) - (local-vars (v1-11 float) (v1-25 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'nav-control-cfs-work))) - (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! (-> 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)) - (let ((s3-0 (-> this nav sphere-array s4-0))) - (vector-! (-> s5-0 right-dir) (-> this current-pos-local) (the-as vector s3-0)) - (.lvf vf1 (&-> (-> s5-0 right-dir) 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 ((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)) - (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)) - ) + (let ((s5-0 (new 'stack-no-clear 'nav-control-cfs-work))) + (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! (-> 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)) + (let ((s3-0 (-> this nav sphere-array s4-0))) + (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)) + (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)) ) ) - (vector+! (-> s5-0 in-dir) (-> s5-0 in-dir) (-> s5-0 right-dir)) ) - (vector+! (-> this target-dir) (-> this target-dir) (-> s5-0 in-dir)) + (vector+! (-> s5-0 in-dir) (-> s5-0 in-dir) (-> s5-0 right-dir)) ) - (set! (-> this target-dir y) 0.0) - (vector+float*! (-> this velocity) (-> this velocity) (-> this target-dir) (-> this nav sec-per-frame)) - (.lvf vf1 (&-> (-> this 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-25 vf1) - (let ((f0-11 v1-25) - (f1-4 (-> this nav target-speed)) - ) - (if (< (* f1-4 f1-4) f0-11) - (vector-float*! (-> this velocity) (-> this velocity) (/ (-> this nav target-speed) (sqrtf f0-11))) - ) - ) - (vector-float*! (-> this travel) (-> this velocity) (-> this nav sec-per-frame)) - 0 - (none) + (vector+! (-> this target-dir) (-> this target-dir) (-> s5-0 in-dir)) ) + (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) + (vector-float*! (-> this velocity) (-> this velocity) (/ (-> this nav target-speed) (sqrtf f0-11))) + ) + ) + (vector-float*! (-> this travel) (-> this velocity) (-> this nav sec-per-frame)) + 0 + (none) ) ;; definition for method 33 of type nav-state 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 a9598b8d3f..c67090a7e7 100644 --- a/test/decompiler/reference/jak3/engine/nav/nav-enemy_REF.gc +++ b/test/decompiler/reference/jak3/engine/nav/nav-enemy_REF.gc @@ -697,223 +697,172 @@ ;; WARN: Return type mismatch int vs object. (defmethod setup-enemy! ((this nav-enemy) (arg0 nav-enemy-info)) (local-vars (sv-16 res-tag)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (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!)) - (set! (-> a0-2 param1) #f) - (set! (-> a0-2 param2) #f) - ) - (logior! (-> this enemy-flags) (enemy-flag drawn-mirrored)) + (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!)) + (set! (-> a0-2 param1) #f) + (set! (-> a0-2 param2) #f) ) - (logior! (-> this mask) (process-mask enemy)) - (logior! (-> this mask) (process-mask actor-pause)) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) - (set! (-> this nav-radius-backup) (-> this root nav-radius)) - (set-enemy-info! this arg0) - (set! (-> this enemy-info callback-info) *default-nav-callback-info*) - (set! (-> this ragdoll-proc) (the-as handle #f)) - (let ((a1-2 (-> this enemy-info idle-anim-script))) - (if a1-2 - (init! (-> this idle-anim-player) a1-2) - ) - ) - (if (-> this draw shadow) - (set! (-> this draw shadow-ctrl) (new - 'process - 'shadow-control - (-> this enemy-info shadow-min-y) - (-> this enemy-info shadow-max-y) - (-> this enemy-info shadow-locus-dist) - (the-as vector #f) - (shadow-flags shdf00 shdf04) - 245760.0 - ) - ) - (set! (-> this draw shadow-ctrl) *nav-enemy-dummy-shadow-control*) - ) - (get-nav-control this (-> arg0 nav-mesh)) - (set! (-> this water-max-height) (-> this nav state mesh water-max-height)) - (let ((v1-32 this)) - (set! (-> v1-32 enemy-flags) (the-as enemy-flag (logclear (-> v1-32 enemy-flags) (enemy-flag ef37)))) - (set! (-> v1-32 nav callback-info) *null-nav-callback-info*) - ) - 0 - (let ((v1-35 this)) - (set! (-> v1-35 enemy-flags) (the-as enemy-flag (logior (enemy-flag ef38) (-> v1-35 enemy-flags)))) - ) - 0 - (logior! (-> this nav flags) (nav-control-flag display-marks limit-rotation-rate)) - (logior! (-> this nav flags) (nav-control-flag update-heading-from-facing)) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag ef44) (-> this enemy-flags)))) - (let ((v1-46 (-> this nav))) - (set! (-> v1-46 target-speed) 0.0) - ) - 0 - (let ((v1-48 (-> this nav))) - (set! (-> v1-48 acceleration) (-> this enemy-info walk-acceleration)) - ) - 0 - (let ((v1-50 (-> this nav))) - (set! (-> v1-50 turning-acceleration) (-> this enemy-info walk-turning-acceleration)) - ) - 0 - (let ((v1-52 (-> this nav))) - (set! (-> v1-52 max-rotation-rate) (-> this enemy-info maximum-rotation-rate)) - ) - 0 - (nav-enemy-method-175 this) - (set! (-> this path) (new 'process 'path-control this 'path 0.0 (the-as entity #f) #f)) - (when (and (zero? (-> this path curve num-cverts)) (-> this entity)) - (set! (-> this path curve num-cverts) 3) - (set! (-> this path curve cverts) (-> (new 'process 'vector-array 3) data)) - (logclear! (-> this path flags) (path-control-flag not-found)) - (let ((v1-69 (-> this path curve cverts 0))) - (let ((a0-33 (-> this entity trans))) - (let ((a1-9 *x-vector*)) - (let ((a2-4 6144.0)) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a1-9 quad)) - ) - (.lvf vf4 (&-> a0-33 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-69 quad) vf6) - ) - (let ((v1-72 (-> this path curve cverts 1))) - (let ((a0-35 (-> this entity trans))) - (let ((a1-10 *x-vector*)) - (let ((a2-6 -6144.0)) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a1-10 quad)) - ) - (.lvf vf4 (&-> a0-35 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-72 quad) vf6) - ) - (let ((v1-75 (-> this path curve cverts 2))) - (let ((a0-37 (-> this entity trans))) - (let ((a1-11 *z-vector*)) - (let ((a2-8 6144.0)) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a1-11 quad)) - ) - (.lvf vf4 (&-> a0-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 (&-> v1-75 quad) vf6) - ) - ) - (if (and (nonzero? (-> this path)) (nonzero? (-> this path curve num-cverts))) - (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) - ) - (if (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) - (set! (-> this hit-points) (* 2.0 (-> this enemy-info default-hit-points))) - (set! (-> this hit-points) (-> this enemy-info default-hit-points)) - ) - (let* ((v1-91 *game-info*) - (a0-42 (+ (-> v1-91 attack-id) 1)) - ) - (set! (-> v1-91 attack-id) a0-42) - (set! (-> this attack-id) a0-42) - ) - (let* ((v1-92 *game-info*) - (a0-44 (+ (-> v1-92 attack-id) 1)) - ) - (set! (-> v1-92 attack-id) a0-44) - (set! (-> this persistent-attack-id) a0-44) - ) - (set! (-> this gnd-collide-with) (-> this enemy-info gnd-collide-with)) - (set! (-> this fact) (new 'process 'fact-info-enemy this (the-as (pointer float) (-> arg0 fact-defaults)))) - (let ((cspec (if (logtest? (enemy-option multi-focus) (-> this fact enemy-options)) - (the-as collide-spec (collide-spec jak bot player-list jak-vehicle)) - (the-as collide-spec (collide-spec jak player-list jak-vehicle)) - ) - ) - ) - (reset-to-collide-spec (-> this focus) (the-as collide-spec cspec)) - ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-101 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) - (cond - ((and v1-101 (nonzero? (-> sv-16 elt-count))) - (set! (-> this actor-group) (the-as (pointer actor-group) v1-101)) - (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) - ) - (else - (set! (-> this actor-group) (the-as (pointer actor-group) #f)) - (set! (-> this actor-group-count) 0) - 0 - ) - ) - ) - (set! (-> this on-notice) (res-lump-struct (-> this entity) 'on-notice pair)) - (set! (-> this on-active) (res-lump-struct (-> this entity) 'on-active pair)) - (set! (-> this on-hostile) (res-lump-struct (-> this entity) 'on-hostile pair)) - (set! (-> this on-death) (res-lump-struct (-> this entity) 'on-death pair)) - (if (-> this on-notice) - (logior! (-> this enemy-flags) (enemy-flag enable-on-notice)) - ) - (if (-> this on-active) - (logior! (-> this enemy-flags) (enemy-flag enable-on-active)) - ) - (if (-> this on-hostile) - (logior! (-> this enemy-flags) (enemy-flag enable-on-hostile)) - ) - (set! (-> this incoming attacker-handle) (the-as handle #f)) - (let ((s4-0 (-> this root))) - (set! (-> this penetrated-by-all) (-> this root penetrated-by)) - (set! (-> this root penetrated-by) (get-penetrated-by this)) - (set! (-> s4-0 event-self) 'touched) - ) - (set! (-> this penetrate-flinch) (-> arg0 penetrate-flinch)) - (set! (-> this penetrate-knocked) (-> arg0 penetrate-knocked)) - (set! (-> this reaction-time) (rnd-time-frame this (seconds 0.1) (seconds 0.8))) - (let* ((v1-132 (-> this enemy-flags)) - (a0-61 (-> this fact enemy-options)) - (v1-133 - (logior (enemy-flag vulnerable vulnerable-backup use-notice-distance attackable-backup trackable trackable-backup) - v1-132 - ) - ) - ) - (if (logtest? (enemy-option multi-focus) a0-61) - (set! v1-133 (logior (enemy-flag multi-focus) v1-133)) - ) - (if (logtest? (enemy-option has-trigger) a0-61) - (set! v1-133 (logior (enemy-flag use-trigger) v1-133)) - ) - (set! (-> this enemy-flags) v1-133) - ) - (do-navigation-to-destination (-> this nav state) (-> this root trans)) - (if (and (should-move-to-ground? this) - (not (logtest? (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) - (not (logtest? (enemy-option ambush) (-> this fact enemy-options))) - ) - (move-to-ground this (meters 10) (meters 10) #t (-> this gnd-collide-with)) - ) - (if (zero? (-> this draw light-index)) - (set! (-> this draw light-index) (the-as uint 10)) - ) - 0 + (logior! (-> this enemy-flags) (enemy-flag drawn-mirrored)) ) + (logior! (-> this mask) (process-mask enemy)) + (logior! (-> this mask) (process-mask actor-pause)) + (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (set! (-> this nav-radius-backup) (-> this root nav-radius)) + (set-enemy-info! this arg0) + (set! (-> this enemy-info callback-info) *default-nav-callback-info*) + (set! (-> this ragdoll-proc) (the-as handle #f)) + (let ((a1-2 (-> this enemy-info idle-anim-script))) + (if a1-2 + (init! (-> this idle-anim-player) a1-2) + ) + ) + (if (-> this draw shadow) + (set! (-> this draw shadow-ctrl) (new + 'process + 'shadow-control + (-> this enemy-info shadow-min-y) + (-> this enemy-info shadow-max-y) + (-> this enemy-info shadow-locus-dist) + (the-as vector #f) + (shadow-flags shdf00 shdf04) + 245760.0 + ) + ) + (set! (-> this draw shadow-ctrl) *nav-enemy-dummy-shadow-control*) + ) + (get-nav-control this (-> arg0 nav-mesh)) + (set! (-> this water-max-height) (-> this nav state mesh water-max-height)) + (let ((v1-32 this)) + (set! (-> v1-32 enemy-flags) (the-as enemy-flag (logclear (-> v1-32 enemy-flags) (enemy-flag ef37)))) + (set! (-> v1-32 nav callback-info) *null-nav-callback-info*) + ) + 0 + (let ((v1-35 this)) + (set! (-> v1-35 enemy-flags) (the-as enemy-flag (logior (enemy-flag ef38) (-> v1-35 enemy-flags)))) + ) + 0 + (logior! (-> this nav flags) (nav-control-flag display-marks limit-rotation-rate)) + (logior! (-> this nav flags) (nav-control-flag update-heading-from-facing)) + (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag ef44) (-> this enemy-flags)))) + (let ((v1-46 (-> this nav))) + (set! (-> v1-46 target-speed) 0.0) + ) + 0 + (let ((v1-48 (-> this nav))) + (set! (-> v1-48 acceleration) (-> this enemy-info walk-acceleration)) + ) + 0 + (let ((v1-50 (-> this nav))) + (set! (-> v1-50 turning-acceleration) (-> this enemy-info walk-turning-acceleration)) + ) + 0 + (let ((v1-52 (-> this nav))) + (set! (-> v1-52 max-rotation-rate) (-> this enemy-info maximum-rotation-rate)) + ) + 0 + (nav-enemy-method-175 this) + (set! (-> this path) (new 'process 'path-control this 'path 0.0 (the-as entity #f) #f)) + (when (and (zero? (-> this path curve num-cverts)) (-> this entity)) + (set! (-> this path curve num-cverts) 3) + (set! (-> this path curve cverts) (-> (new 'process 'vector-array 3) data)) + (logclear! (-> this path flags) (path-control-flag not-found)) + (vector+*! (-> this path curve cverts 0) (-> this entity trans) *x-vector* 6144.0) + (vector+*! (-> this path curve cverts 1) (-> this entity trans) *x-vector* -6144.0) + (vector+*! (-> this path curve cverts 2) (-> this entity trans) *z-vector* 6144.0) + ) + (if (and (nonzero? (-> this path)) (nonzero? (-> this path curve num-cverts))) + (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) + ) + (if (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) + (set! (-> this hit-points) (* 2.0 (-> this enemy-info default-hit-points))) + (set! (-> this hit-points) (-> this enemy-info default-hit-points)) + ) + (let* ((v1-94 *game-info*) + (a0-42 (+ (-> v1-94 attack-id) 1)) + ) + (set! (-> v1-94 attack-id) a0-42) + (set! (-> this attack-id) a0-42) + ) + (let* ((v1-95 *game-info*) + (a0-44 (+ (-> v1-95 attack-id) 1)) + ) + (set! (-> v1-95 attack-id) a0-44) + (set! (-> this persistent-attack-id) a0-44) + ) + (set! (-> this gnd-collide-with) (-> this enemy-info gnd-collide-with)) + (set! (-> this fact) (new 'process 'fact-info-enemy this (the-as (pointer float) (-> arg0 fact-defaults)))) + (let ((cspec (if (logtest? (enemy-option multi-focus) (-> this fact enemy-options)) + (the-as collide-spec (collide-spec jak bot player-list jak-vehicle)) + (the-as collide-spec (collide-spec jak player-list jak-vehicle)) + ) + ) + ) + (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)))) + (cond + ((and v1-104 (nonzero? (-> sv-16 elt-count))) + (set! (-> this actor-group) (the-as (pointer actor-group) v1-104)) + (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) + ) + (else + (set! (-> this actor-group) (the-as (pointer actor-group) #f)) + (set! (-> this actor-group-count) 0) + 0 + ) + ) + ) + (set! (-> this on-notice) (res-lump-struct (-> this entity) 'on-notice pair)) + (set! (-> this on-active) (res-lump-struct (-> this entity) 'on-active pair)) + (set! (-> this on-hostile) (res-lump-struct (-> this entity) 'on-hostile pair)) + (set! (-> this on-death) (res-lump-struct (-> this entity) 'on-death pair)) + (if (-> this on-notice) + (logior! (-> this enemy-flags) (enemy-flag enable-on-notice)) + ) + (if (-> this on-active) + (logior! (-> this enemy-flags) (enemy-flag enable-on-active)) + ) + (if (-> this on-hostile) + (logior! (-> this enemy-flags) (enemy-flag enable-on-hostile)) + ) + (set! (-> this incoming attacker-handle) (the-as handle #f)) + (let ((s4-0 (-> this root))) + (set! (-> this penetrated-by-all) (-> this root penetrated-by)) + (set! (-> this root penetrated-by) (get-penetrated-by this)) + (set! (-> s4-0 event-self) 'touched) + ) + (set! (-> this penetrate-flinch) (-> arg0 penetrate-flinch)) + (set! (-> this penetrate-knocked) (-> arg0 penetrate-knocked)) + (set! (-> this reaction-time) (rnd-time-frame this (seconds 0.1) (seconds 0.8))) + (let* ((v1-135 (-> this enemy-flags)) + (a0-61 (-> this fact enemy-options)) + (v1-136 + (logior (enemy-flag vulnerable vulnerable-backup use-notice-distance attackable-backup trackable trackable-backup) + v1-135 + ) + ) + ) + (if (logtest? (enemy-option multi-focus) a0-61) + (set! v1-136 (logior (enemy-flag multi-focus) v1-136)) + ) + (if (logtest? (enemy-option has-trigger) a0-61) + (set! v1-136 (logior (enemy-flag use-trigger) v1-136)) + ) + (set! (-> this enemy-flags) v1-136) + ) + (do-navigation-to-destination (-> this nav state) (-> this root trans)) + (if (and (should-move-to-ground? this) + (not (logtest? (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) + (not (logtest? (enemy-option ambush) (-> this fact enemy-options))) + ) + (move-to-ground this (meters 10) (meters 10) #t (-> this gnd-collide-with)) + ) + (if (zero? (-> this draw light-index)) + (set! (-> this draw light-index) (the-as uint 10)) + ) + 0 ) ;; definition for method 11 of type nav-enemy 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 74d8cb3129..ea37e579dd 100644 --- a/test/decompiler/reference/jak3/engine/nav/nav-mesh_REF.gc +++ b/test/decompiler/reference/jak3/engine/nav/nav-mesh_REF.gc @@ -1222,29 +1222,11 @@ (vf1 :class vf) (vf2 :class vf) (vf3 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (set! (-> arg0 current-poly) arg1) (vector-copy! (-> arg0 current-pos) arg2) - (let ((a1-3 (-> arg0 dest-pos))) - (let ((v1-1 (-> arg0 current-pos))) - (let ((a2-1 arg3)) - (let ((a3-1 arg4)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-1 quad)) - ) - (.lvf vf4 (&-> v1-1 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-3 quad) vf6) - ) + (vector+*! (-> arg0 dest-pos) (-> arg0 current-pos) arg3 arg4) (let ((v1-2 arg0)) (vector-! (-> v1-2 dir) (-> v1-2 dest-pos) (-> v1-2 current-pos)) (set! (-> v1-2 dir y) 0.0) @@ -1252,8 +1234,8 @@ (let ((f0-2 1.0)) (.lvf vf1 (&-> a0-2 quad)) (.mul.vf.xyz vf2 vf1 vf1) - (let ((a1-6 f0-2)) - (.mov vf3 a1-6) + (let ((a1-7 f0-2)) + (.mov vf3 a1-7) ) ) (.mul.x.vf.w acc vf0 vf2) @@ -1923,44 +1905,30 @@ ;; definition for function find-nearest-nav-mesh (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)) - (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 (the-as vector (-> 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 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) - ) + (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) ) ) ) @@ -1971,8 +1939,8 @@ ) ) ) - sv-68 ) + sv-68 ) ;; definition for method 10 of type nav-mesh 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 58b652064c..89e2590cd2 100644 --- a/test/decompiler/reference/jak3/engine/physics/chain-physics_REF.gc +++ b/test/decompiler/reference/jak3/engine/physics/chain-physics_REF.gc @@ -83,7 +83,6 @@ ;; 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) @@ -264,22 +263,14 @@ (.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))) - ) - ) + (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) diff --git a/test/decompiler/reference/jak3/engine/physics/cloth_REF.gc b/test/decompiler/reference/jak3/engine/physics/cloth_REF.gc index 60aeb564b6..4f6894872f 100644 --- a/test/decompiler/reference/jak3/engine/physics/cloth_REF.gc +++ b/test/decompiler/reference/jak3/engine/physics/cloth_REF.gc @@ -1108,8 +1108,6 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod cloth-system-method-22 ((this cloth-system)) (local-vars - (v1-25 float) - (v1-27 float) (sv-16 sphere) (sv-24 int) (sv-32 verlet-particle) @@ -1127,69 +1125,48 @@ (sv-164 float) (sv-168 vector) ) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-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)) - (.lvf vf1 (&-> sv-96 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-25 vf1) - (set! sv-104 v1-25) - (.lvf vf1 (&-> sv-100 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-27 vf1) - (set! sv-108 v1-27) - (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) + (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-24 (+ sv-24 1)) + (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) ) (set! sv-24 (+ sv-24 1)) ) + (set! sv-24 (+ sv-24 1)) ) - (none) ) + (none) ) ;; definition for method 13 of type cloth-system diff --git a/test/decompiler/reference/jak3/engine/physics/ragdoll_REF.gc b/test/decompiler/reference/jak3/engine/physics/ragdoll_REF.gc index 2dd6996dcf..6e0e2b9134 100644 --- a/test/decompiler/reference/jak3/engine/physics/ragdoll_REF.gc +++ b/test/decompiler/reference/jak3/engine/physics/ragdoll_REF.gc @@ -109,80 +109,65 @@ ;; definition for method 19 of type ragdoll ;; WARN: Return type mismatch int vs none. (defmethod ragdoll-method-19 ((this ragdoll) (arg0 vector) (arg1 int) (arg2 object) (arg3 matrix)) - (local-vars (v1-22 float)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (vector-float*! arg0 (-> this gravity) (* 122.88 (-> pp clock time-adjust-ratio))) - (if (logtest? (-> this ragdoll-joints arg1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - (vector-float*! arg0 arg0 0.15) - ) - (cond - ((logtest? (-> this ragdoll-joints arg1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) - (vector+float*! - arg0 - arg0 - (the-as vector (+ (the-as uint (-> this ragdoll-joints 0 bounce)) (* 192 arg1))) - 0.5 - ) - (vector+float*! - arg0 - arg0 - (the-as vector (+ (the-as uint (-> this ragdoll-joints 0 velocity)) (* 192 arg1))) - 0.7 - ) + (vector-float*! arg0 (-> this gravity) (* 122.88 (-> pp clock time-adjust-ratio))) + (if (logtest? (-> this ragdoll-joints arg1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + (vector-float*! arg0 arg0 0.15) + ) + (cond + ((logtest? (-> this ragdoll-joints arg1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) + (vector+float*! + arg0 + arg0 + (the-as vector (+ (the-as uint (-> this ragdoll-joints 0 bounce)) (* 192 arg1))) + 0.5 ) - (else - (vector+float*! - arg0 - arg0 - (the-as vector (+ (the-as uint (-> this ragdoll-joints 0 velocity)) (* 192 arg1))) - 1.0 - ) + (vector+float*! + arg0 + arg0 + (the-as vector (+ (the-as uint (-> this ragdoll-joints 0 velocity)) (* 192 arg1))) + 0.7 + ) + ) + (else + (vector+float*! + arg0 + arg0 + (the-as vector (+ (the-as uint (-> this ragdoll-joints 0 velocity)) (* 192 arg1))) + 1.0 ) ) - (.lvf vf1 (&-> arg0 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-22 vf1) - (let ((f0-6 v1-22) - (f1-1 16384.0) - ) - (if (and (zero? arg1) - (not (logtest? (-> this ragdoll-joints arg1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2))) - ) - (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))) - ) - ) - ) - (when (nonzero? (-> this rotate-adj-count)) - (quaternion-slerp! (-> this rotate-vel) (-> this rotate-vel) (-> this rotate-adj) 0.5) - (quaternion-identity! (-> this rotate-adj)) - (set! (-> this rotate-adj-count) 0) - 0 - ) - (if (< (-> this rotate-vel w) 0.0) - (quaternion-negate! (-> this rotate-vel) (-> this rotate-vel)) - ) - (when (< (-> this rotate-vel w) (cos 7281.778)) - (let ((a1-4 (vector-normalize! (-> this rotate-vel vec) 1.0))) - (quaternion-vector-angle! (-> this rotate-vel) a1-4 7281.778) - ) - ) - 0 - (none) ) + (let ((f0-6 (vector-length-squared arg0)) + (f1-1 16384.0) + ) + (if (and (zero? arg1) + (not (logtest? (-> this ragdoll-joints arg1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2))) + ) + (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))) + ) + ) + ) + (when (nonzero? (-> this rotate-adj-count)) + (quaternion-slerp! (-> this rotate-vel) (-> this rotate-vel) (-> this rotate-adj) 0.5) + (quaternion-identity! (-> this rotate-adj)) + (set! (-> this rotate-adj-count) 0) + 0 + ) + (if (< (-> this rotate-vel w) 0.0) + (quaternion-negate! (-> this rotate-vel) (-> this rotate-vel)) + ) + (when (< (-> this rotate-vel w) (cos 7281.778)) + (let ((a1-4 (vector-normalize! (-> this rotate-vel vec) 1.0))) + (quaternion-vector-angle! (-> this rotate-vel) a1-4 7281.778) + ) + ) + 0 + (none) ) ) @@ -273,174 +258,157 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod ragdoll-method-24 ((this ragdoll) (arg0 vector) (arg1 int)) - (local-vars (v1-85 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (when *debug-segment* - (let ((s3-0 (-> *display* frames (-> *display* on-screen) profile-array data 0)) - (v1-7 'ragdoll-collision) - (s2-0 *color-white*) - ) - (when (and *dproc* *debug-segment*) - (let ((s1-0 (-> s3-0 data (-> s3-0 count)))) - (let ((s0-0 (-> s3-0 base-time))) - (set! (-> s1-0 name) v1-7) - (set! (-> s1-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s0-0)))) - ) - (set! (-> s1-0 depth) (the-as uint (-> s3-0 depth))) - (set! (-> s1-0 color) s2-0) - (set! (-> s3-0 segment (-> s3-0 depth)) s1-0) - ) - (set! (-> s3-0 count) (min 1023 (+ (-> s3-0 count) 1))) - (+! (-> s3-0 depth) 1) - (set! (-> s3-0 max-depth) (max (-> s3-0 max-depth) (-> s3-0 depth))) + (when *debug-segment* + (let ((s3-0 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-7 'ragdoll-collision) + (s2-0 *color-white*) ) + (when (and *dproc* *debug-segment*) + (let ((s1-0 (-> s3-0 data (-> s3-0 count)))) + (let ((s0-0 (-> s3-0 base-time))) + (set! (-> s1-0 name) v1-7) + (set! (-> s1-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s0-0)))) + ) + (set! (-> s1-0 depth) (the-as uint (-> s3-0 depth))) + (set! (-> s1-0 color) s2-0) + (set! (-> s3-0 segment (-> s3-0 depth)) s1-0) + ) + (set! (-> s3-0 count) (min 1023 (+ (-> s3-0 count) 1))) + (+! (-> s3-0 depth) 1) + (set! (-> s3-0 max-depth) (max (-> s3-0 max-depth) (-> s3-0 depth))) ) - 0 - ) - (let ((s4-1 (-> this ragdoll-joints arg1))) - (when (and (logtest? (-> this ragdoll-flags) (ragdoll-flag rf0)) (!= (-> s4-1 coll-rad) 0.0)) - (when (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) - (vector-matrix*! arg0 arg0 (-> this mirror)) - (vector-matrix*! (-> s4-1 position) (-> s4-1 position) (-> this mirror)) - ) - (let ((s2-1 (new 'stack-no-clear 'collide-query)) - (s3-2 (vector-! (new 'stack-no-clear 'vector) arg0 (-> s4-1 position))) - (s1-1 0) - ) - (logclear! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1 rjf3)) - (if (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) - (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1)) - ) - (if (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf3)) - ) - (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) (begin - (.lvf vf1 (&-> s3-2 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-85 vf1) - (let ((f0-13 v1-85) - (f1-4 409.6) - ) - (< f0-13 (* f1-4 f1-4)) - ) - ) - ) - (+! s1-1 1) - (vector-copy! (-> s2-1 start-pos) arg0) - (vector-copy! (-> s2-1 move-dist) s3-2) - (let ((v1-49 s2-1)) - (set! (-> v1-49 radius) (-> s4-1 coll-rad)) - (set! (-> v1-49 collide-with) (the-as collide-spec (-> this bg-collide-with))) - (set! (-> v1-49 ignore-process0) #f) - (set! (-> v1-49 ignore-process1) #f) - (set! (-> v1-49 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-49 action-mask) (collide-action solid)) - ) - (set! (-> s2-1 best-other-prim) #f) - (let ((f30-0 (probe-using-line-sphere *collide-cache* s2-1))) - (cond - ((>= f30-0 0.0) - (cond - ((logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) - ) - ((logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1)) - (set! (-> s4-1 original-speed) (vector-length s3-2)) - (ragdoll-method-23 this (-> s4-1 position) *zero-vector* 1.0 #f) - ) - (else - (set! (-> s4-1 original-speed) (vector-length s3-2)) - (ragdoll-method-23 this (-> s4-1 position) *zero-vector* 1.0 #f) - ) - ) - (set! (-> s4-1 ground-pat) (-> s2-1 best-other-tri pat)) - (let ((f0-7 (fmin 1.0 f30-0))) - (vector+float*! arg0 arg0 s3-2 f0-7) - (vector-float*! s3-2 s3-2 (- 1.0 f0-7)) - ) - (let ((f0-10 (vector-dot s3-2 (-> s2-1 best-other-tri normal)))) - (vector--float*! s3-2 s3-2 (-> s2-1 best-other-tri normal) (* 1.2 f0-10)) - ) - (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) - (vector-float*! (-> s4-1 bounce) (-> s2-1 best-other-tri normal) (-> s4-1 original-speed)) - ) - (else - (vector+! arg0 arg0 s3-2) - (goto cfg-34) - ) - ) - ) - ) - ) - (label cfg-34) - (if (and (not (logtest? (-> this ragdoll-flags) (ragdoll-flag rf11))) - (logtest? (water-flag touch-water) (-> this water-info flags)) - (< (- (-> arg0 y) (-> s4-1 coll-rad)) (-> this water-info base-height)) - ) - (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - ) - (when (and (nonzero? (-> s4-1 hit-sound)) - (or (and (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) - (not (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1 rjf2))) - ) - (and (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - (not (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf3))) - ) - ) - ) - (let ((v1-107 (the int (lerp-scale 0.0 1024.0 (-> s4-1 original-speed) 409.6 2867.2))) - (s3-3 (new 'static 'sound-spec)) - ) - (when (nonzero? v1-107) - (set! (-> s3-3 sound-name) (-> s4-1 hit-sound)) - (set! (-> s3-3 volume) v1-107) - (set! (-> s3-3 reg 0) (the-as uint 0)) - (if (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) - (set! (-> s3-3 reg 0) (the-as uint 127)) - (set! (-> s3-3 reg 0) (the-as uint (-> s4-1 ground-pat material))) - ) - (sound-play-by-spec s3-3 (new-sound-id) (-> s4-1 position)) - ) - ) - ) - (when (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) - (vector-matrix*! arg0 arg0 (-> this mirror)) - (vector-matrix*! (-> s4-1 position) (-> s4-1 position) (-> this mirror)) - ) - ) - ) - (when *debug-segment* - (let ((gp-1 (-> *display* frames (-> *display* on-screen) profile-array data 0))) - (when (and *dproc* *debug-segment*) - (let* ((v1-129 (+ (-> gp-1 depth) -1)) - (s5-1 (-> gp-1 segment v1-129)) - (s4-2 (-> gp-1 base-time)) - ) - (when (>= v1-129 0) - (set! (-> s5-1 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-2)))) - (+! (-> gp-1 depth) -1) - ) - ) - ) - ) - 0 ) 0 - (none) ) + (let ((s4-1 (-> this ragdoll-joints arg1))) + (when (and (logtest? (-> this ragdoll-flags) (ragdoll-flag rf0)) (!= (-> s4-1 coll-rad) 0.0)) + (when (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) + (vector-matrix*! arg0 arg0 (-> this mirror)) + (vector-matrix*! (-> s4-1 position) (-> s4-1 position) (-> this mirror)) + ) + (let ((s2-1 (new 'stack-no-clear 'collide-query)) + (s3-2 (vector-! (new 'stack-no-clear 'vector) arg0 (-> s4-1 position))) + (s1-1 0) + ) + (logclear! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1 rjf3)) + (if (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) + (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1)) + ) + (if (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf3)) + ) + (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)) + ) + ) + (+! s1-1 1) + (vector-copy! (-> s2-1 start-pos) arg0) + (vector-copy! (-> s2-1 move-dist) s3-2) + (let ((v1-49 s2-1)) + (set! (-> v1-49 radius) (-> s4-1 coll-rad)) + (set! (-> v1-49 collide-with) (the-as collide-spec (-> this bg-collide-with))) + (set! (-> v1-49 ignore-process0) #f) + (set! (-> v1-49 ignore-process1) #f) + (set! (-> v1-49 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-49 action-mask) (collide-action solid)) + ) + (set! (-> s2-1 best-other-prim) #f) + (let ((f30-0 (probe-using-line-sphere *collide-cache* s2-1))) + (cond + ((>= f30-0 0.0) + (cond + ((logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) + ) + ((logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1)) + (set! (-> s4-1 original-speed) (vector-length s3-2)) + (ragdoll-method-23 this (-> s4-1 position) *zero-vector* 1.0 #f) + ) + (else + (set! (-> s4-1 original-speed) (vector-length s3-2)) + (ragdoll-method-23 this (-> s4-1 position) *zero-vector* 1.0 #f) + ) + ) + (set! (-> s4-1 ground-pat) (-> s2-1 best-other-tri pat)) + (let ((f0-7 (fmin 1.0 f30-0))) + (vector+float*! arg0 arg0 s3-2 f0-7) + (vector-float*! s3-2 s3-2 (- 1.0 f0-7)) + ) + (let ((f0-10 (vector-dot s3-2 (-> s2-1 best-other-tri normal)))) + (vector--float*! s3-2 s3-2 (-> s2-1 best-other-tri normal) (* 1.2 f0-10)) + ) + (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) + (vector-float*! (-> s4-1 bounce) (-> s2-1 best-other-tri normal) (-> s4-1 original-speed)) + ) + (else + (vector+! arg0 arg0 s3-2) + (goto cfg-34) + ) + ) + ) + ) + ) + (label cfg-34) + (if (and (not (logtest? (-> this ragdoll-flags) (ragdoll-flag rf11))) + (logtest? (water-flag touch-water) (-> this water-info flags)) + (< (- (-> arg0 y) (-> s4-1 coll-rad)) (-> this water-info base-height)) + ) + (logior! (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + ) + (when (and (nonzero? (-> s4-1 hit-sound)) + (or (and (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf0)) + (not (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf1 rjf2))) + ) + (and (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + (not (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf3))) + ) + ) + ) + (let ((v1-107 (the int (lerp-scale 0.0 1024.0 (-> s4-1 original-speed) 409.6 2867.2))) + (s3-3 (new 'static 'sound-spec)) + ) + (when (nonzero? v1-107) + (set! (-> s3-3 sound-name) (-> s4-1 hit-sound)) + (set! (-> s3-3 volume) v1-107) + (set! (-> s3-3 reg 0) (the-as uint 0)) + (if (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) + (set! (-> s3-3 reg 0) (the-as uint 127)) + (set! (-> s3-3 reg 0) (the-as uint (-> s4-1 ground-pat material))) + ) + (sound-play-by-spec s3-3 (new-sound-id) (-> s4-1 position)) + ) + ) + ) + (when (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) + (vector-matrix*! arg0 arg0 (-> this mirror)) + (vector-matrix*! (-> s4-1 position) (-> s4-1 position) (-> this mirror)) + ) + ) + ) + (when *debug-segment* + (let ((gp-1 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-129 (+ (-> gp-1 depth) -1)) + (s5-1 (-> gp-1 segment v1-129)) + (s4-2 (-> gp-1 base-time)) + ) + (when (>= v1-129 0) + (set! (-> s5-1 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-2)))) + (+! (-> gp-1 depth) -1) + ) + ) + ) + ) + 0 + ) + 0 + (none) ) ;; definition for method 25 of type ragdoll @@ -1027,7 +995,6 @@ (defmethod ragdoll-method-15 ((this ragdoll) (arg0 process-drawable) (arg1 ragdoll-edit-info)) (local-vars (at-0 int) - (v1-156 float) (f0-14 float) (sv-320 vector) (sv-336 vector) @@ -1266,22 +1233,14 @@ (t9-20 a0-72 a1-23 sv-464 a3-6) ) ) - (let ((a2-12 (vector-! (new 'stack-no-clear 'vector) (-> s2-1 trans) sv-560))) - (.lvf vf1 (&-> a2-12 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-156 vf1) - (let* ((f0-17 v1-156) - (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))) - ) - ) + (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))) + ) ) ) (else 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 e31898ca7e..09778468e1 100644 --- a/test/decompiler/reference/jak3/engine/physics/rigid-body_REF.gc +++ b/test/decompiler/reference/jak3/engine/physics/rigid-body_REF.gc @@ -168,33 +168,13 @@ ;; definition for method 24 of type rigid-body-control ;; WARN: Return type mismatch vector vs none. (defmethod rigid-body-control-method-24 ((this rigid-body-control) (arg0 vector) (arg1 vector)) - (local-vars (t0-5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((v1-0 (new 'stack-no-clear 'inline-array 'vector 2))) - (vector-! (-> v1-0 0) arg0 (-> this position)) - (vector-cross! (-> v1-0 1) (-> this torque) (-> v1-0 0)) - (let ((a1-2 (-> v1-0 1)) - (a3-3 (-> v1-0 1)) - (f0-0 1.0) - ) - (.lvf vf1 (&-> (-> v1-0 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 t0-5 vf1) - (vector-float*! a1-2 a3-3 (/ f0-0 t0-5)) - ) - (vector+! arg1 (-> v1-0 1) (-> this force)) - ) - (none) + (let ((v1-0 (new 'stack-no-clear 'inline-array 'vector 2))) + (vector-! (-> v1-0 0) arg0 (-> this position)) + (vector-cross! (-> v1-0 1) (-> this torque) (-> v1-0 0)) + (vector-float*! (-> v1-0 1) (-> v1-0 1) (/ 1.0 (vector-length-squared (-> v1-0 0)))) + (vector+! arg1 (-> v1-0 1) (-> this force)) ) + (none) ) ;; definition for function matrix-3x3-triple-transpose-product @@ -214,68 +194,20 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod rigid-body-control-method-12 ((this rigid-body-control) (arg0 float)) - (local-vars (v1-6 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (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) ) - (init-vf0-vector) - (let ((a2-0 (-> this lin-momentum))) - (let ((v1-0 (-> this lin-momentum))) - (let ((a0-1 (-> this force))) - (let ((a3-0 arg0)) - (.mov vf7 a3-0) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-0 quad)) + (if (< (* f1-1 f1-1) (vector-length-squared (-> this ang-momentum))) + (vector-normalize! (-> this ang-momentum) f0-3) ) - (.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-0 quad) vf6) - ) - (let ((a2-1 (-> this ang-momentum))) - (let ((v1-1 (-> this ang-momentum))) - (let ((a0-2 (-> this torque))) - (let ((a1-1 arg0)) - (.mov vf7 a1-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-1 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-1 quad) vf6) - ) - (let* ((f0-3 (* 500000000.0 (-> this info mass))) - (f1-1 f0-3) - (f1-3 (* f1-1 f1-1)) - ) - (.lvf vf1 (&-> (-> this ang-momentum) 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-6 vf1) - (if (< f1-3 v1-6) - (vector-normalize! (-> this ang-momentum) f0-3) - ) - ) - (set! (-> this force quad) (the-as uint128 0)) - (set! (-> this torque quad) (the-as uint128 0)) - 0 - 0 - (none) ) + (set! (-> this force quad) (the-as uint128 0)) + (set! (-> this torque quad) (the-as uint128 0)) + 0 + 0 + (none) ) ;; definition for method 13 of type rigid-body-control @@ -294,44 +226,21 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod rigid-body-control-method-14 ((this rigid-body-control) (arg0 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((a1-1 (-> this position))) - (let ((v1-0 (-> this position))) - (let ((a0-1 (-> this lin-velocity))) - (let ((a2-0 arg0)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-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 (&-> a1-1 quad) vf6) - ) - (let ((s4-0 (new 'stack-no-clear 'quaternion))) - (set! (-> (the-as vector (&-> s4-0 x)) quad) (-> this ang-velocity quad)) - (set! (-> s4-0 w) 0.0) - (quaternion*! s4-0 s4-0 (the-as quaternion (-> this rot))) - (quaternion-float*! s4-0 s4-0 0.5) - (+! (-> this rot x) (* (-> s4-0 x) arg0)) - (+! (-> this rot y) (* (-> s4-0 y) arg0)) - (+! (-> this rot z) (* (-> s4-0 z) arg0)) - (+! (-> this rot w) (* (-> s4-0 w) arg0)) - ) - (quaternion-normalize! (the-as quaternion (-> this rot))) - (rigid-body-control-method-26 this) - 0 - (none) + (vector+*! (-> this position) (-> this position) (-> this lin-velocity) arg0) + (let ((s4-0 (new 'stack-no-clear 'quaternion))) + (set! (-> (the-as vector (&-> s4-0 x)) quad) (-> this ang-velocity quad)) + (set! (-> s4-0 w) 0.0) + (quaternion*! s4-0 s4-0 (the-as quaternion (-> this rot))) + (quaternion-float*! s4-0 s4-0 0.5) + (+! (-> this rot x) (* (-> s4-0 x) arg0)) + (+! (-> this rot y) (* (-> s4-0 y) arg0)) + (+! (-> this rot z) (* (-> s4-0 z) arg0)) + (+! (-> this rot w) (* (-> s4-0 w) arg0)) ) + (quaternion-normalize! (the-as quaternion (-> this rot))) + (rigid-body-control-method-26 this) + 0 + (none) ) ;; definition for function damping-time-adjust diff --git a/test/decompiler/reference/jak3/engine/physics/trajectory_REF.gc b/test/decompiler/reference/jak3/engine/physics/trajectory_REF.gc index 2ae031f8cf..04212fe424 100644 --- a/test/decompiler/reference/jak3/engine/physics/trajectory_REF.gc +++ b/test/decompiler/reference/jak3/engine/physics/trajectory_REF.gc @@ -417,47 +417,24 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod cubic-curve-method-9 ((this cubic-curve) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (set! (-> this vec 0 quad) (-> arg0 quad)) - (vector-copy! (-> this mat uvec) arg1) - (let ((v1-2 (new 'stack-no-clear 'trajectory))) - (vector-! (-> v1-2 initial-velocity) arg2 arg0) - (vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) 3.0) - (let ((t1-7 (-> v1-2 initial-position))) - (let ((a1-3 (-> v1-2 initial-position))) - (let ((a3-2 arg1)) - (let ((t2-1 -2.0)) - (.mov vf7 t2-1) - ) - (.lvf vf5 (&-> a3-2 quad)) - ) - (.lvf vf4 (&-> a1-3 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 (&-> t1-7 quad) vf6) - ) - (vector-! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3) - (vector-copy! (-> this mat fvec) (-> v1-2 initial-position)) - (vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) -2.0) - (vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg1) - (vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3) - (vector-copy! (-> this mat trans) (-> v1-2 initial-position)) - ) - (dotimes (v1-5 4) - (set! (-> this vec v1-5 w) 0.0) - ) - 0 - (none) + (set! (-> this vec 0 quad) (-> arg0 quad)) + (vector-copy! (-> this mat uvec) arg1) + (let ((v1-2 (new 'stack-no-clear 'trajectory))) + (vector-! (-> v1-2 initial-velocity) arg2 arg0) + (vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) 3.0) + (vector+*! (-> v1-2 initial-position) (-> v1-2 initial-position) arg1 -2.0) + (vector-! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3) + (vector-copy! (-> this mat fvec) (-> v1-2 initial-position)) + (vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) -2.0) + (vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg1) + (vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3) + (vector-copy! (-> this mat trans) (-> v1-2 initial-position)) ) + (dotimes (v1-5 4) + (set! (-> this vec v1-5 w) 0.0) + ) + 0 + (none) ) ;; definition for method 10 of type cubic-curve 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 9cd8c11774..467514a4fb 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 @@ -374,7 +374,6 @@ (v1-14 uint128) (v1-15 uint128) (v1-17 number) - (v1-26 float) (a0-10 uint128) (a0-11 uint128) (a1-3 uint128) @@ -538,16 +537,7 @@ (/ 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 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 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 b6d1578374..c40bcd3e83 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 @@ -1597,7 +1597,7 @@ (set! (-> self control transv z) (-> v1-21 z)) ) (vector-xz-normalize! (-> self control transv) (the-as float (-> self control unknown-word04))) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) @@ -2456,11 +2456,11 @@ (ja-channel-push! 1 (seconds 0.04)) (ja :group! jakb-board-turn-around-ja :num! min) (quaternion-rotate-y! (-> self control dir-targ) (-> self control quat-for-control) 32768.0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (until (ja-done? 0) (suspend) (ja :num! (seek! max 1.25)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (set! (-> self control ctrl-xz-vel) (* f30-0 (* (/ (-> self clock frames-per-second) (meters 10)) (-> self align delta trans z))) 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 c49d230f5f..819493ecf8 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 @@ -503,43 +503,28 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defbehavior target-board-green-eco-attack target ((arg0 symbol)) - (local-vars (v1-14 float) (v1-25 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (cond - (arg0 - (vector-copy! gp-0 (-> self control trans)) - (set! (-> gp-0 w) 49152.0) - ) - (else - (vector-normalize! (vector-z-quaternion! gp-0 (-> self control quat)) -12288.0) - (vector+! gp-0 gp-0 (-> self control trans)) - (set! (-> gp-0 w) 24576.0) - ) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (cond + (arg0 + (vector-copy! gp-0 (-> self control trans)) + (set! (-> gp-0 w) 49152.0) ) - (let ((s5-1 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s4-0 (fill-actor-list-for-box *actor-hash* gp-0 s5-1 384)) - (let ((v1-10 (as-type (-> s5-1 s4-0) collide-shape))) - (when v1-10 - (let ((a0-11 (as-type (-> v1-10 process) process-focusable))) - (when a0-11 - (when (!= *target* a0-11) - (let ((v1-13 (vector-! (new 'stack-no-clear 'vector) (-> a0-11 root trans) gp-0))) - 0.0 - (.lvf vf1 (&-> v1-13 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-14 vf1) - (let ((f0-3 v1-14) + (else + (vector-normalize! (vector-z-quaternion! gp-0 (-> self control quat)) -12288.0) + (vector+! gp-0 gp-0 (-> self control trans)) + (set! (-> gp-0 w) 24576.0) + ) + ) + (let ((s5-1 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s4-0 (fill-actor-list-for-box *actor-hash* gp-0 s5-1 384)) + (let ((v1-10 (as-type (-> s5-1 s4-0) collide-shape))) + (when v1-10 + (let ((a0-11 (as-type (-> v1-10 process) process-focusable))) + (when a0-11 + (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) @@ -553,20 +538,13 @@ ) ) ) - (let ((s5-2 (the-as target (as-type *target* process-focusable)))) - (when (and s5-2 (< (vector-vector-distance (get-trans s5-2 0) gp-0) (-> gp-0 w))) - (when (!= *target* s5-2) - (let ((v1-24 (vector-! (new 'stack-no-clear 'vector) (-> s5-2 control trans) gp-0))) - 0.0 - (.lvf vf1 (&-> v1-24 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-25 vf1) - (let ((f0-6 v1-25) + ) + (let ((s5-2 (the-as target (as-type *target* process-focusable)))) + (when (and s5-2 (< (vector-vector-distance (get-trans s5-2 0) gp-0) (-> gp-0 w))) + (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) @@ -577,8 +555,8 @@ ) ) ) - (none) ) + (none) ) ;; definition for function target-board-green-eco-use 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 8850b80055..c0795ee333 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 @@ -528,52 +528,37 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod nav-enemy-method-187 ((this flut-racer)) - (local-vars (v1-26 float) (v1-40 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((t9-0 (method-of-type nav-enemy nav-enemy-method-187))) - (t9-0 this) + (let ((t9-0 (method-of-type nav-enemy nav-enemy-method-187))) + (t9-0 this) + ) + (let ((s5-0 (new 'stack 'traffic-danger-info))) + (set! (-> s5-0 danger-type) (the-as uint 8)) + (set! (-> s5-0 sphere quad) (-> this root trans quad)) + (set! (-> s5-0 sphere r) 122880.0) + (copy-nav-state-vel! this (-> s5-0 velocity)) + (vector-normalize! (-> s5-0 velocity) 122880.0) + (set! (-> s5-0 danger-level) 0.5) + (set! (-> s5-0 notify-radius) 491520.0) + (set! (-> s5-0 decay-rate) 0.0) + (add-danger *traffic-engine* s5-0) + ) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (vector-normalize! + (vector-z-quaternion! s5-1 (-> this root quat)) + (* (-> this nav target-speed) (seconds-per-frame) (seconds-per-frame)) ) - (let ((s5-0 (new 'stack 'traffic-danger-info))) - (set! (-> s5-0 danger-type) (the-as uint 8)) - (set! (-> s5-0 sphere quad) (-> this root trans quad)) - (set! (-> s5-0 sphere r) 122880.0) - (copy-nav-state-vel! this (-> s5-0 velocity)) - (vector-normalize! (-> s5-0 velocity) 122880.0) - (set! (-> s5-0 danger-level) 0.5) - (set! (-> s5-0 notify-radius) 491520.0) - (set! (-> s5-0 decay-rate) 0.0) - (add-danger *traffic-engine* s5-0) - ) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (vector-normalize! - (vector-z-quaternion! s5-1 (-> this root quat)) - (* (-> this nav target-speed) (seconds-per-frame) (seconds-per-frame)) - ) - (vector+! s5-1 s5-1 (-> this root trans)) - (set! (-> s5-1 w) 16384.0) - (let ((s4-1 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s3-0 (fill-actor-list-for-box *actor-hash* s5-1 s4-1 384)) - (let ((v1-21 (as-type (-> s4-1 s3-0) collide-shape))) - (when v1-21 - (let ((s2-1 (as-type (-> v1-21 process) process-focusable))) - (when s2-1 - (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 - (.lvf vf1 (&-> v1-25 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) - (let ((f0-10 v1-26) + (vector+! s5-1 s5-1 (-> this root trans)) + (set! (-> s5-1 w) 16384.0) + (let ((s4-1 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s3-0 (fill-actor-list-for-box *actor-hash* s5-1 s4-1 384)) + (let ((v1-21 (as-type (-> s4-1 s3-0) collide-shape))) + (when v1-21 + (let ((s2-1 (as-type (-> v1-21 process) process-focusable))) + (when s2-1 + (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) @@ -590,20 +575,13 @@ ) ) ) - (let ((s4-2 (the-as target (as-type *target* process-focusable)))) - (when (and s4-2 (< (vector-vector-distance (get-trans s4-2 0) s5-1) (-> s5-1 w))) - (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 - (.lvf vf1 (&-> v1-39 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-40 vf1) - (let ((f0-13 v1-40) + ) + (let ((s4-2 (the-as target (as-type *target* process-focusable)))) + (when (and s4-2 (< (vector-vector-distance (get-trans s4-2 0) s5-1) (-> s5-1 w))) + (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) @@ -617,8 +595,8 @@ ) ) ) - (none) ) + (none) ) ;; definition for method 121 of type flut-racer 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 2dd8793bd4..d397046ea9 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 @@ -362,97 +362,42 @@ ;; definition for function flut-leg-ik-callback ;; INFO: Used lq/sq (defun flut-leg-ik-callback ((arg0 joint-mod-ik) (arg1 object) (arg2 object) (arg3 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 arg3) - (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) - (if (< 6144.0 f0-1) - (set! f0-1 6144.0) - ) - (if (< f0-1 -6144.0) - (set! f0-1 -6144.0) - ) - (+! (-> arg0 user-position y) f0-1) - ) - (let ((f0-4 (- (-> arg3 y) (-> arg0 user-position y)))) - (seek! (-> arg0 user-float) f0-4 (* 40960.0 (seconds-per-frame))) - ) - (let* ((f28-0 (-> arg0 user-float)) - (f30-1 (lerp-scale 1.0 0.0 f28-0 0.0 12288.0)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-12 s5-0)) - (let ((a0-4 *up-vector*)) - (let ((a1-4 8192.0)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-4 quad)) - ) - (.lvf vf4 (&-> v1-12 quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 arg3) + (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) + (if (< 6144.0 f0-1) + (set! f0-1 6144.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 (&-> s3-0 quad) vf6) - (vector-float*! (new 'stack-no-clear 'vector) *up-vector* -16384.0) - (let ((s2-0 (new 'stack-no-clear 'vector))) - 0.0 - (let ((f0-11 (intersect-ray-plane s3-0 *up-vector* (-> arg0 user-position) *up-vector*)) - (a0-7 s2-0) - ) - (let ((v1-15 *up-vector*)) - (let ((a1-7 f0-11)) - (.mov vf7 a1-7) - ) - (.lvf vf5 (&-> v1-15 quad)) - ) - (.lvf vf4 (&-> s3-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-7 quad) vf6) - ) - (let ((a0-8 s2-0)) - (let ((v1-16 *up-vector*)) - (let ((a1-8 (- f28-0))) - (.mov vf7 a1-8) - ) - (.lvf vf5 (&-> v1-16 quad)) - ) - (.lvf vf4 (&-> arg3 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-8 quad) vf6) - ) - (let ((a1-9 s5-0)) - (let ((v1-17 s5-0)) - (let ((a0-10 (vector-! (new 'stack-no-clear 'vector) s2-0 s5-0))) - (let ((a2-6 (fmin 1.0 (* (-> arg0 user-blend) f30-1)))) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-10 quad)) - ) - (.lvf vf4 (&-> v1-17 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-9 quad) vf6) - ) + (if (< f0-1 -6144.0) + (set! f0-1 -6144.0) ) - ) - (set-ik-target! arg0 s5-0) + (+! (-> arg0 user-position y) f0-1) ) - (none) + (let ((f0-4 (- (-> arg3 y) (-> arg0 user-position y)))) + (seek! (-> arg0 user-float) f0-4 (* 40960.0 (seconds-per-frame))) + ) + (let* ((f28-0 (-> arg0 user-float)) + (f30-1 (lerp-scale 1.0 0.0 f28-0 0.0 12288.0)) + (s3-1 (vector+*! (new 'stack-no-clear 'vector) s5-0 *up-vector* 8192.0)) + ) + (vector-float*! (new 'stack-no-clear 'vector) *up-vector* -16384.0) + (let ((s2-0 (new 'stack-no-clear 'vector))) + 0.0 + (let ((f0-11 (intersect-ray-plane s3-1 *up-vector* (-> arg0 user-position) *up-vector*))) + (vector+*! s2-0 s3-1 *up-vector* f0-11) + ) + (vector+*! s2-0 arg3 *up-vector* (- f28-0)) + (vector+*! + s5-0 + s5-0 + (vector-! (new 'stack-no-clear 'vector) s2-0 s5-0) + (fmin 1.0 (* (-> arg0 user-blend) f30-1)) + ) + ) + ) + (set-ik-target! arg0 s5-0) ) + (none) ) ;; definition for function flut-update-ik @@ -460,146 +405,95 @@ ;; WARN: Return type mismatch int vs object. (defbehavior flut-update-ik target () (local-vars (sv-720 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'collide-query)) - (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) + ) + (let ((a1-0 (-> gp-0 bbox)) + (v1-2 (-> s5-0 trans)) + (a0-0 (new 'stack-no-clear 'vector)) ) - (let ((a1-0 (-> gp-0 bbox)) - (v1-2 (-> s5-0 trans)) - (a0-0 (new 'stack-no-clear 'vector)) - ) - (set! (-> a0-0 x) 10240.0) - (set! (-> a0-0 y) 10240.0) - (set! (-> a0-0 z) 10240.0) - (set! (-> a0-0 w) 1.0) - (vector-! (-> a1-0 min) v1-2 a0-0) - ) - (let ((a1-2 (-> gp-0 bbox max)) - (v1-3 (-> s5-0 trans)) - (a0-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> a0-1 x) 10240.0) - (set! (-> a0-1 y) 10240.0) - (set! (-> a0-1 z) 10240.0) - (set! (-> a0-1 w) 1.0) - (vector+! a1-2 v1-3 a0-1) - ) - (set! (-> gp-0 collide-with) (-> (the-as collide-shape s5-0) root-prim prim-core collide-with)) - (set! (-> gp-0 ignore-process0) #f) - (set! (-> gp-0 ignore-process1) #f) - (set! (-> gp-0 ignore-pat) (-> (the-as collide-shape s5-0) pat-ignore-mask)) - (fill-using-bounding-box *collide-cache* gp-0) - (dotimes (s4-0 2) - (let ((s3-0 (-> self mech-ik s4-0))) - #t - (set! (-> s3-0 callback) (the-as (function joint-mod-ik matrix matrix vector object) flut-leg-ik-callback)) - (let ((a1-6 (not (logtest? (target-flags lleg-no-ik rleg-no-ik) (-> *target* target-flags))))) - (enable-set! s3-0 a1-6) - ) - (-> s3-0 shoulder-matrix-no-ik) - (let ((v1-17 (-> s3-0 elbow-matrix-no-ik)) - (s0-0 (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) + (set! (-> a0-0 x) 10240.0) + (set! (-> a0-0 y) 10240.0) + (set! (-> a0-0 z) 10240.0) + (set! (-> a0-0 w) 1.0) + (vector-! (-> a1-0 min) v1-2 a0-0) + ) + (let ((a1-2 (-> gp-0 bbox max)) + (v1-3 (-> s5-0 trans)) + (a0-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-1 x) 10240.0) + (set! (-> a0-1 y) 10240.0) + (set! (-> a0-1 z) 10240.0) + (set! (-> a0-1 w) 1.0) + (vector+! a1-2 v1-3 a0-1) + ) + (set! (-> gp-0 collide-with) (-> (the-as collide-shape s5-0) root-prim prim-core collide-with)) + (set! (-> gp-0 ignore-process0) #f) + (set! (-> gp-0 ignore-process1) #f) + (set! (-> gp-0 ignore-pat) (-> (the-as collide-shape s5-0) pat-ignore-mask)) + (fill-using-bounding-box *collide-cache* gp-0) + (dotimes (s4-0 2) + (let ((s3-0 (-> self mech-ik s4-0))) + #t + (set! (-> s3-0 callback) (the-as (function joint-mod-ik matrix matrix vector object) flut-leg-ik-callback)) + (let ((a1-6 (not (logtest? (target-flags lleg-no-ik rleg-no-ik) (-> *target* target-flags))))) + (enable-set! s3-0 a1-6) + ) + (-> s3-0 shoulder-matrix-no-ik) + (let ((v1-17 (-> s3-0 elbow-matrix-no-ik)) + (s0-0 (new 'stack-no-clear 'vector)) ) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (new 'stack-no-clear 'vector) - (let ((s1-0 (new 'stack-no-clear 'vector))) - (let ((a1-8 s0-0)) - (let ((a0-11 (-> v1-17 trans))) - (let ((v1-18 (-> v1-17 uvec))) - (let ((a2-8 (-> s3-0 hand-dist))) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> v1-18 quad)) + (set! sv-720 (new 'stack-no-clear 'vector)) + (let ((a0-8 (-> *y-vector* quad))) + (set! (-> sv-720 quad) a0-8) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (vector+*! s0-0 (-> v1-17 trans) (-> v1-17 uvec) (-> s3-0 hand-dist)) + (let ((f0-11 + (lerp-scale 1.0 0.0 (- (-> s0-0 y) (-> (the-as collide-shape-moving s5-0) gspot-pos y)) 2048.0 12288.0) ) - (.lvf vf4 (&-> a0-11 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-8 quad) vf6) - ) - (let ((f0-11 - (lerp-scale 1.0 0.0 (- (-> s0-0 y) (-> (the-as collide-shape-moving s5-0) gspot-pos y)) 2048.0 12288.0) - ) - ) - (seek! (-> s3-0 user-blend) f0-11 (* 4.0 (seconds-per-frame))) - ) - (let ((a1-11 (-> gp-0 start-pos))) - (let ((v1-22 s0-0)) - (let ((a0-14 sv-720)) - (let ((a2-12 6144.0)) - (.mov vf7 a2-12) - ) - (.lvf vf5 (&-> a0-14 quad)) - ) - (.lvf vf4 (&-> v1-22 quad)) + (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) ) - (.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-11 quad) vf6) - ) - (let ((v1-23 (-> gp-0 move-dist)) - (f0-16 -20480.0) + (vector-float*! v1-23 sv-720 f0-16) + ) + (let ((v1-25 gp-0)) + (set! (-> v1-25 radius) 4.096) + (set! (-> v1-25 collide-with) (-> gp-0 collide-with)) + (set! (-> v1-25 ignore-process0) #f) + (set! (-> v1-25 ignore-process1) #f) + (set! (-> v1-25 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (vector-float*! v1-23 sv-720 f0-16) - ) - (let ((v1-25 gp-0)) - (set! (-> v1-25 radius) 4.096) - (set! (-> v1-25 collide-with) (-> gp-0 collide-with)) - (set! (-> v1-25 ignore-process0) #f) - (set! (-> v1-25 ignore-process1) #f) - (set! (-> v1-25 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-25 action-mask) (collide-action solid)) - ) - (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) - (cond - ((>= f30-0 0.0) - (vector-copy! s1-0 (-> gp-0 best-other-tri normal)) - (when (< 8192.0 (vector-vector-angle-safe *y-vector* s1-0)) - (let* ((a1-16 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s1-0) 1.0)) - (a2-14 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-16 8192.0)) - ) - (vector-orient-by-quat! s1-0 *y-vector* a2-14) - ) + (set! (-> v1-25 action-mask) (collide-action solid)) + ) + (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) + (cond + ((>= f30-0 0.0) + (vector-copy! s1-0 (-> gp-0 best-other-tri normal)) + (when (< 8192.0 (vector-vector-angle-safe *y-vector* s1-0)) + (let* ((a1-18 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s1-0) 1.0)) + (a2-12 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-18 8192.0)) + ) + (vector-orient-by-quat! s1-0 *y-vector* a2-12) ) - (let ((a1-18 s2-0)) - (let ((v1-32 (-> gp-0 start-pos))) - (let ((a0-29 (-> gp-0 move-dist))) - (let ((a2-15 f30-0)) - (.mov vf7 a2-15) - ) - (.lvf vf5 (&-> a0-29 quad)) - ) - (.lvf vf4 (&-> v1-32 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) - ) - (vector-copy! (-> s3-0 user-position) s2-0) - (vector-copy! (-> s3-0 user-normal) s1-0) ) - (else - (set! (-> s0-0 y) (-> (target-pos 0) y)) - (vector-copy! (-> s3-0 user-position) s0-0) - (vector-copy! (-> s3-0 user-normal) *y-vector*) - ) + (vector+*! s2-0 (-> gp-0 start-pos) (-> gp-0 move-dist) f30-0) + (vector-copy! (-> s3-0 user-position) s2-0) + (vector-copy! (-> s3-0 user-normal) s1-0) + ) + (else + (set! (-> s0-0 y) (-> (target-pos 0) y)) + (vector-copy! (-> s3-0 user-position) s0-0) + (vector-copy! (-> s3-0 user-normal) *y-vector*) ) ) ) @@ -608,8 +502,8 @@ ) ) ) - 0 ) + 0 ) ;; definition for function target-flut-get-off? @@ -842,7 +736,7 @@ (ja-channel-set! 1) (ja-no-eval :group! jakb-flut-air-attack-land-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) @@ -2437,7 +2331,7 @@ ) ) (until (or (ja-done? 0) (< f30-0 0.05)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (not (ja-min? 0)) (cond ((and (>= (ja-aframe-num 0) 20.0) @@ -2501,7 +2395,7 @@ ) (ja-no-eval :group! jakb-flut-running-attack-end-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 f30-0) (suspend) (ja :num! (seek!)) @@ -2612,14 +2506,14 @@ (ja-channel-push! 1 (seconds 0.05)) (ja-no-eval :group! jakb-flut-air-attack-ja :num! (seek! (ja-aframe 8.0 0)) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) (suspend) (ja :num! (seek! (ja-aframe 8.0 0))) ) (ja-no-eval :group! jakb-flut-air-attack-ja :num! (seek!) :frame-num (ja-aframe 8.0 0)) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) @@ -2688,7 +2582,7 @@ (ja-channel-set! 1) (ja-no-eval :group! jakb-flut-air-attack-land-ja :num! (seek! (ja-aframe 22.0 0)) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) (suspend) (ja :num! (seek! (ja-aframe 22.0 0))) @@ -2696,7 +2590,7 @@ (target-danger-set! 'harmless #f) (ja-no-eval :group! jakb-flut-air-attack-land-ja :num! (seek!) :frame-num (ja-aframe 22.0 0)) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) @@ -3106,7 +3000,7 @@ (ja-no-eval :group! a1-48 :num! (seek!) :frame-num 0.0) ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (let ((s5-13 (new 'stack-no-clear 'vector))) (when (not (logtest? (-> self align flags) (align-flags disabled))) (vector-matrix*! s5-13 (-> self align delta trans) (-> self control c-R-w)) @@ -3216,7 +3110,7 @@ (ja-no-eval :group! a1-52 :num! (seek!) :frame-num 0.0) ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (let ((s5-14 (new 'stack-no-clear 'vector))) (when (not (logtest? (-> self align flags) (align-flags disabled))) (vector-matrix*! s5-14 (-> self align delta trans) (-> self control c-R-w)) 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 31a8610f7e..6c66fd0319 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 @@ -280,12 +280,7 @@ ) (vector-cross! s2-0 (-> s3-0 vec-to-target) (-> s3-0 current-dir-vec)) (vector-normalize! s2-0 1.0) - (vector-rotate-around-axis! - (-> s3-0 current-dir-vec) - (the-as quaternion (-> s3-0 current-dir-vec)) - (* -1.0 f22-1) - s2-0 - ) + (vector-rotate-around-axis! (-> s3-0 current-dir-vec) (-> s3-0 current-dir-vec) (* -1.0 f22-1) s2-0) ) ) ) @@ -1113,7 +1108,7 @@ (.svf (&-> v1-20 quad) vf3) ) (vector-normalize! sv-80 1.0) - (vector-rotate-around-axis! sv-96 (the-as quaternion sv-96) f28-1 sv-80) + (vector-rotate-around-axis! sv-96 sv-96 f28-1 sv-80) ) ) (vector-normalize! sv-96 1.0) @@ -2351,7 +2346,7 @@ (the float (sar (shl (the int (+ (-> this sway-angle) (* 5461.3335 (the float s5-4)))) 48) 48)) (vector-rotate-around-axis! (-> s4-1 uvec) - (the-as quaternion (-> s4-1 uvec)) + (-> s4-1 uvec) f0-9 (the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-4))) ) @@ -2479,7 +2474,7 @@ 5461.3335 (vector-cross! s5-1 sv-800 sv-776) (vector-normalize! s5-1 1.0) - (vector-rotate-around-axis! sv-800 (the-as quaternion sv-776) f28-0 s5-1) + (vector-rotate-around-axis! sv-800 sv-776 f28-0 s5-1) ) ) ) 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 7239f0f91d..3d9c1b33e6 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 @@ -2625,7 +2625,7 @@ (v1-39 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-40 (the-as number (logior #x3f800000 v1-39))) ) - (s3-1 s2-2 (the-as quaternion s1-0) (+ f30-0 (* f28-0 (+ -1.0 (the-as float v1-40)))) *up-vector*) + (s3-1 s2-2 s1-0 (+ f30-0 (* f28-0 (+ -1.0 (the-as float v1-40)))) *up-vector*) ) (let ((f0-18 (/ (-> self obj-radius) (meters 4)))) 0.0 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 89a45973dc..81639115bc 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 @@ -252,67 +252,52 @@ ;; definition for method 47 of type gun-red-3-grenade ;; INFO: Used lq/sq (defmethod find-and-damage-targets ((this gun-red-3-grenade)) - (local-vars (v1-21 float) (v1-45 float)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector)) - (a1-0 (new 'stack-no-clear 'event-message-block)) - ) - (set! (-> a1-0 from) (process->ppointer pp)) - (set! (-> a1-0 num-params) 0) - (set! (-> a1-0 message) 'get-vehicle) - (let ((s4-0 (send-event-function *target* a1-0))) - (vector-copy! s5-0 (-> this root trans)) - (set! (-> s5-0 w) (-> this blast-radius)) - (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) - (countdown (s2-0 (fill-actor-list-for-box *actor-hash* s5-0 s3-0 384)) - (let ((a0-8 (as-type (-> s3-0 s2-0) collide-shape))) - (when a0-8 - (let ((s1-1 (as-type (-> a0-8 process) process-focusable))) - (when s1-1 - (when (and (!= s4-0 s1-1) - (not (focus-test? (the-as process-focusable s1-1) disable dead inactive)) - (logtest? (process-mask crate enemy guard vehicle civilian) (-> s1-1 mask)) - (nonzero? (-> (the-as process-focusable s1-1) root root-prim prim-core collide-with)) - ) - (+! (-> *game-info* shots-hit 1) 1.0) - (let ((s0-2 - (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s1-1) 3) (-> this root trans)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (a1-0 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-0 from) (process->ppointer pp)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'get-vehicle) + (let ((s4-0 (send-event-function *target* a1-0))) + (vector-copy! s5-0 (-> this root trans)) + (set! (-> s5-0 w) (-> this blast-radius)) + (let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384))) + (countdown (s2-0 (fill-actor-list-for-box *actor-hash* s5-0 s3-0 384)) + (let ((a0-8 (as-type (-> s3-0 s2-0) collide-shape))) + (when a0-8 + (let ((s1-1 (as-type (-> a0-8 process) process-focusable))) + (when s1-1 + (when (and (!= s4-0 s1-1) + (not (focus-test? (the-as process-focusable s1-1) disable dead inactive)) + (logtest? (process-mask crate enemy guard vehicle civilian) (-> s1-1 mask)) + (nonzero? (-> (the-as process-focusable s1-1) root root-prim prim-core collide-with)) + ) + (+! (-> *game-info* shots-hit 1) 1.0) + (let ((s0-2 + (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s1-1) 3) (-> this root trans)) + ) + ) + 0.0 + (let ((f0-4 (vector-length-squared s0-2)) + (f1-1 (-> this blast-radius)) + ) + (if (>= (* f1-1 f1-1) f0-4) + (send-event + s1-1 + 'attack + #f + (static-attack-info :mask (vehicle-impulse-factor) ((id (-> this attack-id)) + (damage 12.0) + (vehicle-damage-factor 3.0) + (vehicle-impulse-factor 1.0) + (mode 'explode) + (attacker-velocity s0-2) + (penetrate-using (penetrate explode)) + ) + ) ) ) - 0.0 - (.lvf vf1 (&-> s0-2 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-21 vf1) - (let ((f0-4 v1-21) - (f1-1 (-> this blast-radius)) - ) - (if (>= (* f1-1 f1-1) f0-4) - (send-event - s1-1 - 'attack - #f - (static-attack-info :mask (vehicle-impulse-factor) ((id (-> this attack-id)) - (damage 12.0) - (vehicle-damage-factor 3.0) - (vehicle-impulse-factor 1.0) - (mode 'explode) - (attacker-velocity s0-2) - (penetrate-using (penetrate explode)) - ) - ) - ) - ) - ) ) ) ) @@ -321,43 +306,36 @@ ) ) ) - (let ((s3-1 (the-as target (as-type *target* process-focusable)))) - (when (and s3-1 (< (vector-vector-distance (get-trans s3-1 0) s5-0) (-> s5-0 w))) - (when (and (!= s4-0 s3-1) - (not (focus-test? s3-1 disable dead inactive)) - (logtest? (process-mask crate enemy guard vehicle civilian) (-> s3-1 mask)) - (nonzero? (-> s3-1 control root-prim prim-core collide-with)) - ) - (+! (-> *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 - (.lvf vf1 (&-> s5-2 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-45 vf1) - (let ((f0-12 v1-45) - (f1-6 (-> this blast-radius)) + ) + (let ((s3-1 (the-as target (as-type *target* process-focusable)))) + (when (and s3-1 (< (vector-vector-distance (get-trans s3-1 0) s5-0) (-> s5-0 w))) + (when (and (!= s4-0 s3-1) + (not (focus-test? s3-1 disable dead inactive)) + (logtest? (process-mask crate enemy guard vehicle civilian) (-> s3-1 mask)) + (nonzero? (-> s3-1 control root-prim prim-core collide-with)) + ) + (+! (-> *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) + (send-event + s3-1 + 'attack + #f + (static-attack-info :mask (vehicle-impulse-factor) ((id (-> this attack-id)) + (damage 12.0) + (vehicle-damage-factor 3.0) + (vehicle-impulse-factor 1.0) + (mode 'explode) + (attacker-velocity s5-2) + (penetrate-using (penetrate explode)) + ) + ) ) - (if (>= (* f1-6 f1-6) f0-12) - (send-event - s3-1 - 'attack - #f - (static-attack-info :mask (vehicle-impulse-factor) ((id (-> this attack-id)) - (damage 12.0) - (vehicle-damage-factor 3.0) - (vehicle-impulse-factor 1.0) - (mode 'explode) - (attacker-velocity s5-2) - (penetrate-using (penetrate explode)) - ) - ) - ) - ) - ) + ) ) ) ) @@ -1145,126 +1123,98 @@ ;; 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)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (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)) - ) - ) - ) - (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 - ) + (if (>= (-> this next-computed-collision-point) (-> this num-collision-pts-to-generate)) + (return 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) - (let ((v1-33 sv-612)) - (let ((a0-17 (-> sv-560 start-pos))) - (let ((a1-7 (-> sv-560 move-dist))) - (let ((a2-0 f0-25)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a1-7 quad)) - ) - (.lvf vf4 (&-> a0-17 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-33 quad) vf6) + (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)) + ) ) - (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))) - ) + ) + (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))) ) - (-> 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) + (-> sv-560 best-other-tri normal quad) ) - (vector-normalize! s5-1 1.0) - (dotimes (s2-1 4) - (vector-rotate-around-axis! - s4-0 - (the-as quaternion 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-59 sv-560)) - (set! (-> v1-59 radius) 40.96) - (set! (-> v1-59 collide-with) (collide-spec backgnd hit-by-others-list pusher impenetrable-obj)) - (set! (-> v1-59 ignore-process0) #f) - (set! (-> v1-59 ignore-process1) #f) - (set! (-> v1-59 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-59 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) + (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) + ) + (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) ) ) ) ) - (label cfg-11) - (let ((v0-0 (+ (-> this next-computed-collision-point) 1))) - (set! (-> this next-computed-collision-point) v0-0) - v0-0 - ) + ) + (label cfg-11) + (let ((v0-0 (+ (-> this next-computed-collision-point) 1))) + (set! (-> this next-computed-collision-point) v0-0) + v0-0 ) ) @@ -2270,85 +2220,63 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch (pointer process) vs object. (defbehavior gun-fire-red-1 target () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (-> self gun))) - (let ((s5-0 (-> *part-id-table* 216))) - (get-field-spec-by-id s5-0 (sp-field-id spt-omega)) - (let ((s5-1 (get-field-spec-by-id s5-0 (sp-field-id spt-rotate-y)))) - (if s5-1 - (set! (-> s5-1 initial-valuef) (y-angle (-> self control))) - ) - ) - ) - (launch-particles (-> *part-id-table* 216) (-> gp-0 fire-point)) - (let ((s5-2 (new 'stack-no-clear 'vector))) - (let ((v1-10 (-> gp-0 fire-point))) - (let ((a0-4 (-> gp-0 fire-dir-out))) - (let ((a1-4 24576.0)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-4 quad)) + (let ((gp-0 (-> self gun))) + (let ((s5-0 (-> *part-id-table* 216))) + (get-field-spec-by-id s5-0 (sp-field-id spt-omega)) + (let ((s5-1 (get-field-spec-by-id s5-0 (sp-field-id spt-rotate-y)))) + (if s5-1 + (set! (-> s5-1 initial-valuef) (y-angle (-> self control))) ) - (.lvf vf4 (&-> v1-10 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 (&-> s5-2 quad) vf6) - (set! (-> s5-2 w) 24576.0) - (when (and (sphere-in-view-frustum? (the-as sphere s5-2)) - (< 24576.0 (vector-vector-distance s5-2 (math-camera-pos))) - ) - (let ((s5-3 - (process-spawn - manipy - :init manipy-init - (-> gp-0 fire-point) - (-> self entity) - (art-group-get-by-name *level* "skel-gun-red-cone" (the-as (pointer level) #f)) - #f - 0 - :name "manipy" - :to self - :stack-size #x20000 - ) + ) + ) + (launch-particles (-> *part-id-table* 216) (-> gp-0 fire-point)) + (let ((s5-3 (vector+*! (new 'stack-no-clear 'vector) (-> gp-0 fire-point) (-> gp-0 fire-dir-out) 24576.0))) + (set! (-> s5-3 w) 24576.0) + (when (and (sphere-in-view-frustum? (the-as sphere s5-3)) + (< 24576.0 (vector-vector-distance s5-3 (math-camera-pos))) + ) + (let ((s5-4 + (process-spawn + manipy + :init manipy-init + (-> gp-0 fire-point) + (-> self entity) + (art-group-get-by-name *level* "skel-gun-red-cone" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 ) ) - (when s5-3 - (send-event (ppointer->process s5-3) 'anim-mode 'play1) - (send-event (ppointer->process s5-3) 'anim "idle") - (forward-up->quaternion (-> (the-as manipy (-> s5-3 0)) root quat) (-> gp-0 fire-dir-out) *up-vector*) - (let ((f30-1 - (vector-dot - (-> gp-0 fire-dir-out) - (vector-! (new 'stack-no-clear 'vector) (-> gp-0 fire-point) (math-camera-pos)) - ) + ) + (when s5-4 + (send-event (ppointer->process s5-4) 'anim-mode 'play1) + (send-event (ppointer->process s5-4) 'anim "idle") + (forward-up->quaternion (-> (the-as manipy (-> s5-4 0)) root quat) (-> gp-0 fire-dir-out) *up-vector*) + (let ((f30-1 + (vector-dot + (-> gp-0 fire-dir-out) + (vector-! (new 'stack-no-clear 'vector) (-> gp-0 fire-point) (math-camera-pos)) ) - (f0-5 (vector-vector-xz-distance (-> gp-0 fire-point) (math-camera-pos))) ) - (when (and (< f30-1 0.0) (< f0-5 32768.0)) - (set! (-> (the-as manipy (-> s5-3 0)) root scale z) (lerp-scale 0.2 1.0 (fabs f0-5) 20480.0 32768.0)) - (set! (-> (the-as manipy (-> s5-3 0)) root scale x) (-> (the-as manipy (-> s5-3 0)) root scale z)) + (f0-5 (vector-vector-xz-distance (-> gp-0 fire-point) (math-camera-pos))) ) + (when (and (< f30-1 0.0) (< f0-5 32768.0)) + (set! (-> (the-as manipy (-> s5-4 0)) root scale z) (lerp-scale 0.2 1.0 (fabs f0-5) 20480.0 32768.0)) + (set! (-> (the-as manipy (-> s5-4 0)) root scale x) (-> (the-as manipy (-> s5-4 0)) root scale z)) ) ) ) ) ) - (process-spawn - gun-red-shot - (-> gp-0 fire-point) - (-> gp-0 fire-dir-out) - :name "gun-red-shot" - :to (ppointer->process (-> gp-0 gun)) - ) + ) + (process-spawn + gun-red-shot + (-> gp-0 fire-point) + (-> gp-0 fire-dir-out) + :name "gun-red-shot" + :to (ppointer->process (-> gp-0 gun)) ) ) ) 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 56059611c4..307b86b0df 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 @@ -1267,63 +1267,41 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this gun-yellow-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((s4-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (gp-1 (vector-! (new 'stack-no-clear 'vector) s4-0 a1-0)) ) - (init-vf0-vector) - (let* ((s4-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (gp-1 (vector-! (new 'stack-no-clear 'vector) s4-0 a1-0)) - ) - (let ((f30-0 (vector-length gp-1))) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 gp-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s3-0 quad) vf6) - (draw-main-shot this a1-0 gp-1) - (vector-normalize! gp-1 1.0) - (spawn-particles this s3-0) - ) - (let ((s3-1 (new 'stack-no-clear 'matrix)) - (f30-1 (fmin 1.0 (/ f30-0 (meters 16)))) - (f28-0 (-> *part-id-table* 267 init-specs 3 initial-valuef)) - ) - (forward-up->inv-matrix s3-1 gp-1 *up-vector*) - (vector-copy! (-> s3-1 trans) s4-0) - (gun-yellow-shot-method-42 this f30-1 f28-0 s3-1) - ) + (let ((f30-0 (vector-length gp-1))) + (let ((s3-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 gp-1 0.8))) + (draw-main-shot this a1-0 gp-1) + (vector-normalize! gp-1 1.0) + (spawn-particles this s3-1) ) - (let ((f0-3 (vector-dot gp-1 (-> (camera-matrix) fvec)))) - (when (< 0.0 f0-3) - (let ((f2-0 (* f0-3 f0-3)) - (f0-4 (-> *part-id-table* 266 init-specs 8 initial-valuef)) - (f1-3 (-> *part-id-table* 266 init-specs 8 random-rangef)) - ) - (set! (-> *part-id-table* 266 init-specs 8 initial-valuef) (* f0-4 f2-0)) - (set! (-> *part-id-table* 266 init-specs 8 random-rangef) (* f1-3 f2-0)) - (set! (-> *part-id-table* 266 init-specs 8 initial-valuef) f0-4) - (set! (-> *part-id-table* 266 init-specs 8 random-rangef) f1-3) + (let ((s3-2 (new 'stack-no-clear 'matrix)) + (f30-1 (fmin 1.0 (/ f30-0 (meters 16)))) + (f28-0 (-> *part-id-table* 267 init-specs 3 initial-valuef)) ) + (forward-up->inv-matrix s3-2 gp-1 *up-vector*) + (vector-copy! (-> s3-2 trans) s4-0) + (gun-yellow-shot-method-42 this f30-1 f28-0 s3-2) + ) + ) + (let ((f0-3 (vector-dot gp-1 (-> (camera-matrix) fvec)))) + (when (< 0.0 f0-3) + (let ((f2-0 (* f0-3 f0-3)) + (f0-4 (-> *part-id-table* 266 init-specs 8 initial-valuef)) + (f1-3 (-> *part-id-table* 266 init-specs 8 random-rangef)) + ) + (set! (-> *part-id-table* 266 init-specs 8 initial-valuef) (* f0-4 f2-0)) + (set! (-> *part-id-table* 266 init-specs 8 random-rangef) (* f1-3 f2-0)) + (set! (-> *part-id-table* 266 init-specs 8 initial-valuef) f0-4) + (set! (-> *part-id-table* 266 init-specs 8 random-rangef) f1-3) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 37 of type gun-yellow-shot @@ -2222,49 +2200,27 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this gun-yellow-shot-2)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((s5-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-0 a1-0)) + (f30-0 (vector-length s4-1)) ) - (init-vf0-vector) - (let* ((s5-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-0 a1-0)) - (f30-0 (vector-length s4-1)) - ) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s4-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s3-0 quad) vf6) - (draw-main-shot this a1-0 s4-1) - (vector-normalize! s4-1 1.0) - (launch-particles (-> *part-id-table* 270) s3-0) - ) - (let ((s3-1 (new 'stack-no-clear 'matrix)) - (f30-1 (fmin 1.0 (/ f30-0 (meters 16)))) - (f28-0 (-> *part-id-table* 267 init-specs 3 initial-valuef)) - ) - (forward-up->inv-matrix s3-1 s4-1 *up-vector*) - (vector-copy! (-> s3-1 trans) s5-0) - (gun-yellow-shot-method-42 this f30-1 f28-0 s3-1) - ) + (let ((s3-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s4-1 0.8))) + (draw-main-shot this a1-0 s4-1) + (vector-normalize! s4-1 1.0) + (launch-particles (-> *part-id-table* 270) s3-1) + ) + (let ((s3-2 (new 'stack-no-clear 'matrix)) + (f30-1 (fmin 1.0 (/ f30-0 (meters 16)))) + (f28-0 (-> *part-id-table* 267 init-specs 3 initial-valuef)) + ) + (forward-up->inv-matrix s3-2 s4-1 *up-vector*) + (vector-copy! (-> s3-2 trans) s5-0) + (gun-yellow-shot-method-42 this f30-1 f28-0 s3-2) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 43 of type gun-yellow-shot diff --git a/test/decompiler/reference/jak3/engine/target/indax/target-indax-hang_REF.gc b/test/decompiler/reference/jak3/engine/target/indax/target-indax-hang_REF.gc index ba770e606f..f8610f48c6 100644 --- a/test/decompiler/reference/jak3/engine/target/indax/target-indax-hang_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/indax/target-indax-hang_REF.gc @@ -306,7 +306,7 @@ (ja-channel-push! 1 (seconds 0.05)) (ja-no-eval :group! jakb-dummy-59-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) @@ -431,7 +431,7 @@ (ja-channel-push! 1 (seconds 0.05)) (ja-no-eval :group! jakb-ladder-stance-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (let ((v1-19 (and (>= (ja-aframe-num 0) 4.0) (>= 9.0 (ja-aframe-num 0))))) (if v1-19 (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) @@ -496,11 +496,11 @@ (ja-channel-push! 1 (seconds 0.04)) (ja :group! jakb-ladder-get-on-ja :num! min) (quaternion-rotate-y! (-> self control dir-targ) (-> self control dir-targ) 32768.0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (until (ja-done? 0) (suspend) (ja :num! (seek! max 2.0)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) ) (remove-exit) diff --git a/test/decompiler/reference/jak3/engine/target/indax/target-indax_REF.gc b/test/decompiler/reference/jak3/engine/target/indax/target-indax_REF.gc index 48745e9a8e..2870a1df98 100644 --- a/test/decompiler/reference/jak3/engine/target/indax/target-indax_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/indax/target-indax_REF.gc @@ -1216,7 +1216,7 @@ (ja-channel-push! 1 (seconds 0.02)) (ja-no-eval :group! daxter-indax-trip-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 2.0) (suspend) (ja :num! (seek!)) @@ -1249,7 +1249,7 @@ (ja-no-eval :group! gp-0 :num! (seek! max (-> self control current-surface align-speed)) :frame-num 0.0) ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) @@ -1294,7 +1294,7 @@ (ja-no-eval :group! gp-0 :num! (seek! max (-> self control current-surface align-speed)) :frame-num 0.0) ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) @@ -1345,7 +1345,7 @@ (f28-0 1.0) ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (not (ja-min? 0)) (cond ((and (>= (ja-aframe-num 0) 20.0) 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 7d95ca3511..480617a478 100644 --- a/test/decompiler/reference/jak3/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/logic-target_REF.gc @@ -1422,268 +1422,148 @@ ;; definition for function leg-ik-callback ;; INFO: Used lq/sq (defun leg-ik-callback ((arg0 joint-mod-ik) (arg1 object) (arg2 object) (arg3 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 arg3) - (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) - (if (< 1228.8 f0-1) - (set! f0-1 1228.8) - ) - (if (< f0-1 409.6) - (set! f0-1 409.6) - ) - (+! (-> arg0 user-position y) f0-1) - ) - (let* ((f0-4 - (vector-dot (-> arg0 user-normal) (vector-! (new 'stack-no-clear 'vector) arg3 (-> arg0 user-position))) - ) - (f30-1 (lerp-scale 1.0 0.0 f0-4 0.0 2048.0)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-13 s5-0)) - (let ((a0-4 (-> arg0 user-normal))) - (let ((a1-4 4096.0)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-4 quad)) - ) - (.lvf vf4 (&-> v1-13 quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 arg3) + (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) + (if (< 1228.8 f0-1) + (set! f0-1 1228.8) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> s3-0 quad) vf6) - (vector-float*! (new 'stack-no-clear 'vector) (-> arg0 user-normal) -8192.0) - (let ((s4-1 (new 'stack-no-clear 'vector))) - 0.0 - (let ((f0-8 (intersect-ray-plane s3-0 (-> arg0 user-normal) (-> arg0 user-position) (-> arg0 user-normal))) - (a0-7 s4-1) - ) - (let ((v1-16 (-> arg0 user-normal))) - (let ((a1-7 f0-8)) - (.mov vf7 a1-7) - ) - (.lvf vf5 (&-> v1-16 quad)) - ) - (.lvf vf4 (&-> s3-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-7 quad) vf6) - ) - (let ((a1-8 s4-1)) - (let ((v1-17 s4-1)) - (let ((a0-8 (-> arg0 user-normal))) - (let ((a2-6 - (- (vector-dot (-> arg0 user-normal) (vector-! (new 'stack-no-clear 'vector) s4-1 (-> arg0 user-position)))) - ) - ) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-8 quad)) - ) - (.lvf vf4 (&-> v1-17 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-8 quad) vf6) - ) - (let ((a1-9 s5-0)) - (let ((v1-18 s5-0)) - (let ((a0-10 (vector-! (new 'stack-no-clear 'vector) s4-1 s5-0))) - (let ((a2-9 (fmin 1.0 (* (-> arg0 user-blend) f30-1)))) - (.mov vf7 a2-9) - ) - (.lvf vf5 (&-> a0-10 quad)) - ) - (.lvf vf4 (&-> v1-18 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-9 quad) vf6) - ) + (if (< f0-1 409.6) + (set! f0-1 409.6) ) - ) - (set-ik-target! arg0 s5-0) + (+! (-> arg0 user-position y) f0-1) ) - (none) + (let* ((f0-4 + (vector-dot (-> arg0 user-normal) (vector-! (new 'stack-no-clear 'vector) arg3 (-> arg0 user-position))) + ) + (f30-1 (lerp-scale 1.0 0.0 f0-4 0.0 2048.0)) + (s3-1 (vector+*! (new 'stack-no-clear 'vector) s5-0 (-> arg0 user-normal) 4096.0)) + ) + (vector-float*! (new 'stack-no-clear 'vector) (-> arg0 user-normal) -8192.0) + (let ((s4-1 (new 'stack-no-clear 'vector))) + 0.0 + (let ((f0-8 (intersect-ray-plane s3-1 (-> arg0 user-normal) (-> arg0 user-position) (-> arg0 user-normal)))) + (vector+*! s4-1 s3-1 (-> arg0 user-normal) f0-8) + ) + (vector+*! + s4-1 + s4-1 + (-> arg0 user-normal) + (- (vector-dot (-> arg0 user-normal) (vector-! (new 'stack-no-clear 'vector) s4-1 (-> arg0 user-position)))) + ) + (vector+*! + s5-0 + s5-0 + (vector-! (new 'stack-no-clear 'vector) s4-1 s5-0) + (fmin 1.0 (* (-> arg0 user-blend) f30-1)) + ) + ) + ) + (set-ik-target! arg0 s5-0) ) + (none) ) ;; definition for function target-update-ik ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defbehavior target-update-ik target () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'collide-query))) - (let ((v1-0 (-> gp-0 bbox)) - (a0-1 (-> self control trans)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-0 x) 8192.0) - (set! (-> a1-0 y) 6144.0) - (set! (-> a1-0 z) 8192.0) - (set! (-> a1-0 w) 1.0) - (vector-! (-> v1-0 min) a0-1 a1-0) - ) - (let ((v1-2 (-> gp-0 bbox max)) - (a0-3 (-> self control trans)) - (a1-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-1 x) 8192.0) - (set! (-> a1-1 y) 6144.0) - (set! (-> a1-1 z) 8192.0) - (set! (-> a1-1 w) 1.0) - (vector+! v1-2 a0-3 a1-1) - ) - (set! (-> gp-0 collide-with) (-> self control root-prim prim-core collide-with)) - (set! (-> gp-0 ignore-process0) self) - (set! (-> gp-0 ignore-process1) #f) - (set! (-> gp-0 ignore-pat) (-> self control pat-ignore-mask)) - (fill-using-bounding-box *collide-cache* gp-0) - (dotimes (s5-0 2) - (let ((a1-4 (not (or (logtest? (target-flags lleg-no-ik rleg-no-ik) (-> self target-flags)) - (and (logtest? (-> self control mod-surface flags) (surface-flag air)) - (not (logtest? (-> self control status) (collide-status on-surface))) - ) - (focus-test? self edge-grab pole flut pilot mech) - ) - ) - ) - ) - (enable-set! (-> self leg-ik s5-0) a1-4) + (let ((gp-0 (new 'stack-no-clear 'collide-query))) + (let ((v1-0 (-> gp-0 bbox)) + (a0-1 (-> self control trans)) + (a1-0 (new 'stack-no-clear 'vector)) ) - (vector-copy! (-> self foot s5-0 twist-max) (-> self control ground-contact-normal)) - (vector-copy! (-> self foot s5-0 trans) (-> self control gspot-pos)) - (vector-y-quaternion! (-> self foot s5-0 target) (-> self control quat-for-control)) - (set! (-> self foot s5-0 flex-blend) (if (if (zero? s5-0) - (logtest? (target-flags lleg-no-ik) (-> self target-flags)) - (logtest? (target-flags rleg-no-ik) (-> self target-flags)) - ) - 0.0 - 1.0 - ) - ) - (-> self leg-ik s5-0 shoulder-matrix-no-ik) - (let ((v1-51 (-> self leg-ik s5-0 elbow-matrix-no-ik)) - (s2-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s1-0 *y-vector*) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (new 'stack-no-clear 'vector) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((a2-8 s2-0)) - (let ((a0-27 (-> v1-51 trans))) - (let ((a1-8 (-> v1-51 uvec))) - (let ((a3-3 (-> self leg-ik s5-0 hand-dist))) - (.mov vf7 a3-3) - ) - (.lvf vf5 (&-> a1-8 quad)) - ) - (.lvf vf4 (&-> a0-27 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-8 quad) vf6) - ) - (let ((a1-9 s2-0)) - (let ((a0-28 (-> v1-51 trans))) - (let ((v1-52 (-> v1-51 uvec))) - (let ((a2-12 (-> self leg-ik s5-0 hand-dist))) - (.mov vf7 a2-12) - ) - (.lvf vf5 (&-> v1-52 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 (&-> a1-9 quad) vf6) - ) - (let ((f0-13 (lerp-scale 1.0 0.0 (- (-> s2-0 y) (-> self control gspot-pos y)) 819.2 2048.0))) - (seek! (-> self leg-ik s5-0 user-blend) f0-13 (* 4.0 (seconds-per-frame))) - ) - (let ((a1-12 (-> gp-0 start-pos))) - (let ((v1-63 s2-0)) - (let ((a0-31 s1-0)) - (let ((a2-16 4096.0)) - (.mov vf7 a2-16) - ) - (.lvf vf5 (&-> a0-31 quad)) - ) - (.lvf vf4 (&-> v1-63 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) - ) - (vector-float*! (-> gp-0 move-dist) s1-0 -8192.0) - (let ((v1-66 gp-0)) - (set! (-> v1-66 radius) 4.096) - (set! (-> v1-66 collide-with) (-> gp-0 collide-with)) - (set! (-> v1-66 ignore-process0) #f) - (set! (-> v1-66 ignore-process1) #f) - (set! (-> v1-66 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-66 action-mask) (collide-action solid)) - ) - (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) - (cond - ((and (>= f30-0 0.0) (< 0.5 (-> gp-0 best-other-tri normal y))) - (vector-copy! s4-0 (-> gp-0 best-other-tri normal)) - (when (< 8192.0 (vector-vector-angle-safe *y-vector* s4-0)) - (let* ((a1-17 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s4-0) 1.0)) - (a2-18 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-17 8192.0)) - ) - (vector-orient-by-quat! s4-0 *y-vector* a2-18) - ) - ) - (let ((a1-19 s3-0)) - (let ((v1-77 (-> gp-0 start-pos))) - (let ((a0-45 (-> gp-0 move-dist))) - (let ((a2-19 f30-0)) - (.mov vf7 a2-19) + (set! (-> a1-0 x) 8192.0) + (set! (-> a1-0 y) 6144.0) + (set! (-> a1-0 z) 8192.0) + (set! (-> a1-0 w) 1.0) + (vector-! (-> v1-0 min) a0-1 a1-0) + ) + (let ((v1-2 (-> gp-0 bbox max)) + (a0-3 (-> self control trans)) + (a1-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-1 x) 8192.0) + (set! (-> a1-1 y) 6144.0) + (set! (-> a1-1 z) 8192.0) + (set! (-> a1-1 w) 1.0) + (vector+! v1-2 a0-3 a1-1) + ) + (set! (-> gp-0 collide-with) (-> self control root-prim prim-core collide-with)) + (set! (-> gp-0 ignore-process0) self) + (set! (-> gp-0 ignore-process1) #f) + (set! (-> gp-0 ignore-pat) (-> self control pat-ignore-mask)) + (fill-using-bounding-box *collide-cache* gp-0) + (dotimes (s5-0 2) + (let ((a1-4 (not (or (logtest? (target-flags lleg-no-ik rleg-no-ik) (-> self target-flags)) + (and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (not (logtest? (-> self control status) (collide-status on-surface))) + ) + (focus-test? self edge-grab pole flut pilot mech) ) - (.lvf vf5 (&-> a0-45 quad)) - ) - (.lvf vf4 (&-> v1-77 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-19 quad) vf6) - ) - (vector-copy! (-> self leg-ik s5-0 user-position) s3-0) - (vector-copy! (-> self leg-ik s5-0 user-normal) s4-0) - (vector-copy! (-> self foot s5-0 twist-max) s4-0) - ) - (else - (vector-copy! (-> self leg-ik s5-0 user-position) s2-0) - (vector-copy! (-> self leg-ik s5-0 user-normal) *y-vector*) - (vector-copy! (-> self foot s5-0 twist-max) *y-vector*) + ) + ) + (enable-set! (-> self leg-ik s5-0) a1-4) + ) + (vector-copy! (-> self foot s5-0 twist-max) (-> self control ground-contact-normal)) + (vector-copy! (-> self foot s5-0 trans) (-> self control gspot-pos)) + (vector-y-quaternion! (-> self foot s5-0 target) (-> self control quat-for-control)) + (set! (-> self foot s5-0 flex-blend) (if (if (zero? s5-0) + (logtest? (target-flags lleg-no-ik) (-> self target-flags)) + (logtest? (target-flags rleg-no-ik) (-> self target-flags)) + ) + 0.0 + 1.0 + ) + ) + (-> self leg-ik s5-0 shoulder-matrix-no-ik) + (let ((v1-51 (-> self leg-ik s5-0 elbow-matrix-no-ik)) + (s2-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s1-0 *y-vector*) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector+*! s2-0 (-> v1-51 trans) (-> v1-51 uvec) (-> self leg-ik s5-0 hand-dist)) + (vector+*! s2-0 (-> v1-51 trans) (-> v1-51 uvec) (-> self leg-ik s5-0 hand-dist)) + (let ((f0-13 (lerp-scale 1.0 0.0 (- (-> s2-0 y) (-> self control gspot-pos y)) 819.2 2048.0))) + (seek! (-> self leg-ik s5-0 user-blend) f0-13 (* 4.0 (seconds-per-frame))) + ) + (vector+*! (-> gp-0 start-pos) s2-0 s1-0 4096.0) + (vector-float*! (-> gp-0 move-dist) s1-0 -8192.0) + (let ((v1-66 gp-0)) + (set! (-> v1-66 radius) 4.096) + (set! (-> v1-66 collide-with) (-> gp-0 collide-with)) + (set! (-> v1-66 ignore-process0) #f) + (set! (-> v1-66 ignore-process1) #f) + (set! (-> v1-66 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) + (set! (-> v1-66 action-mask) (collide-action solid)) + ) + (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) + (cond + ((and (>= f30-0 0.0) (< 0.5 (-> gp-0 best-other-tri normal y))) + (vector-copy! s4-0 (-> gp-0 best-other-tri normal)) + (when (< 8192.0 (vector-vector-angle-safe *y-vector* s4-0)) + (let* ((a1-19 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s4-0) 1.0)) + (a2-17 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-19 8192.0)) + ) + (vector-orient-by-quat! s4-0 *y-vector* a2-17) + ) + ) + (vector+*! s3-0 (-> gp-0 start-pos) (-> gp-0 move-dist) f30-0) + (vector-copy! (-> self leg-ik s5-0 user-position) s3-0) + (vector-copy! (-> self leg-ik s5-0 user-normal) s4-0) + (vector-copy! (-> self foot s5-0 twist-max) s4-0) + ) + (else + (vector-copy! (-> self leg-ik s5-0 user-position) s2-0) + (vector-copy! (-> self leg-ik s5-0 user-normal) *y-vector*) + (vector-copy! (-> self foot s5-0 twist-max) *y-vector*) ) ) ) @@ -1691,9 +1571,9 @@ ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for function pre-collide-setup diff --git a/test/decompiler/reference/jak3/engine/target/mech/mech-part_REF.gc b/test/decompiler/reference/jak3/engine/target/mech/mech-part_REF.gc index 689207435b..31a07412da 100644 --- a/test/decompiler/reference/jak3/engine/target/mech/mech-part_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/mech/mech-part_REF.gc @@ -139,71 +139,50 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun mech-spawn-thruster ((arg0 mech-info) (arg1 vector) (arg2 vector) (arg3 float) (arg4 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (set! (-> arg0 part-thruster) (-> *part-id-table* 1037)) - (set! (-> arg0 part-thruster-scale-x) (-> *part-id-table* 1037 init-specs 4)) - (set! (-> arg0 part-thruster-scale-y) (-> *part-id-table* 1037 init-specs 5)) - (let ((s1-0 (new 'stack-no-clear 'quaternion)) - (s0-0 (new 'stack-no-clear 'vector)) - ) - (forward-up->quaternion s1-0 arg2 (new 'static 'vector :y 1.0 :w 1.0)) - (quaternion-rotate-local-x! s1-0 s1-0 32768.0) - (let ((a0-3 s0-0)) - (let ((v1-10 arg1)) - (let ((a1-4 (/ arg4 2))) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> arg2 quad)) - (.lvf vf4 (&-> v1-10 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-3 quad) vf6) + (set! (-> arg0 part-thruster) (-> *part-id-table* 1037)) + (set! (-> arg0 part-thruster-scale-x) (-> *part-id-table* 1037 init-specs 4)) + (set! (-> arg0 part-thruster-scale-y) (-> *part-id-table* 1037 init-specs 5)) + (let ((s1-0 (new 'stack-no-clear 'quaternion)) + (s0-0 (new 'stack-no-clear 'vector)) ) - (set! (-> arg0 part-thruster-scale-x initial-valuef) arg3) - (set! (-> arg0 part-thruster-scale-y initial-valuef) arg4) - (dotimes (s4-1 2) - (quaternion-rotate-local-z! s1-0 s1-0 16384.0) - (quaternion-copy! (-> arg0 part-quat) s1-0) - (let ((t9-4 sp-launch-particles-var) - (a0-6 (-> arg0 particle-system-3d)) - (a1-7 (-> arg0 part-thruster)) - (a2-4 *launch-matrix*) - ) - (vector-copy! (-> a2-4 trans) s0-0) - (t9-4 - (the-as sparticle-system a0-6) - a1-7 - a2-4 - (the-as sparticle-launch-state #f) - (the-as sparticle-launch-control #f) - 1.0 + (forward-up->quaternion s1-0 arg2 (new 'static 'vector :y 1.0 :w 1.0)) + (quaternion-rotate-local-x! s1-0 s1-0 32768.0) + (vector+*! s0-0 arg1 arg2 (/ arg4 2)) + (set! (-> arg0 part-thruster-scale-x initial-valuef) arg3) + (set! (-> arg0 part-thruster-scale-y initial-valuef) arg4) + (dotimes (s4-1 2) + (quaternion-rotate-local-z! s1-0 s1-0 16384.0) + (quaternion-copy! (-> arg0 part-quat) s1-0) + (let ((t9-4 sp-launch-particles-var) + (a0-7 (-> arg0 particle-system-3d)) + (a1-6 (-> arg0 part-thruster)) + (a2-4 *launch-matrix*) ) + (vector-copy! (-> a2-4 trans) s0-0) + (t9-4 + (the-as sparticle-system a0-7) + a1-6 + a2-4 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 ) ) ) - (launch-particles (-> *part-id-table* 1043) arg1) - (launch-particles (-> *part-id-table* 1038) arg1) - (cond - ((!= (-> *setting-control* user-current under-water-pitch-mod) 0.0) - (launch-particles (-> *part-id-table* 1043) arg1) - ) - (else - (launch-particles (-> *part-id-table* 1039) arg1) - (launch-particles (-> *part-id-table* 1041) arg1) - ) - ) - 0 - (none) ) + (launch-particles (-> *part-id-table* 1043) arg1) + (launch-particles (-> *part-id-table* 1038) arg1) + (cond + ((!= (-> *setting-control* user-current under-water-pitch-mod) 0.0) + (launch-particles (-> *part-id-table* 1043) arg1) + ) + (else + (launch-particles (-> *part-id-table* 1039) arg1) + (launch-particles (-> *part-id-table* 1041) arg1) + ) + ) + 0 + (none) ) ;; failed to figure out what this is: 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 fdc406b2fe..634013aad4 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 @@ -572,7 +572,7 @@ ) (target-mech-punch-pick (the-as symbol gp-0)) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (and (not (focus-test? self dangerous)) (let ((v1-10 (ja-group))) (and v1-10 (or (= v1-10 jakb-mech-punch-l-ja) 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 7020ddab40..1740198d58 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 @@ -945,95 +945,40 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch none vs object. (defbehavior mech-leg-ik-callback target ((arg0 joint-mod-ik) (arg1 matrix) (arg2 matrix) (arg3 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 arg3) - (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) - (if (< 6144.0 f0-1) - (set! f0-1 6144.0) - ) - (if (< f0-1 -6144.0) - (set! f0-1 -6144.0) - ) - (+! (-> arg0 user-position y) f0-1) - ) - (let ((f0-4 (- (-> arg3 y) (-> arg0 user-position y)))) - (seek! (-> arg0 user-float) f0-4 (* 40960.0 (seconds-per-frame))) - ) - (let* ((f28-0 (-> arg0 user-float)) - (f30-1 (lerp-scale 1.0 0.0 f28-0 0.0 12288.0)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-12 s5-0)) - (let ((a0-4 *up-vector*)) - (let ((a1-4 8192.0)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-4 quad)) - ) - (.lvf vf4 (&-> v1-12 quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 arg3) + (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) + (if (< 6144.0 f0-1) + (set! f0-1 6144.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 (&-> s3-0 quad) vf6) - (vector-float*! (new 'stack-no-clear 'vector) *up-vector* -16384.0) - (let ((s2-0 (new 'stack-no-clear 'vector))) - 0.0 - (let ((f0-11 (intersect-ray-plane s3-0 *up-vector* (-> arg0 user-position) *up-vector*)) - (a0-7 s2-0) - ) - (let ((v1-15 *up-vector*)) - (let ((a1-7 f0-11)) - (.mov vf7 a1-7) - ) - (.lvf vf5 (&-> v1-15 quad)) - ) - (.lvf vf4 (&-> s3-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-7 quad) vf6) - ) - (let ((a0-8 s2-0)) - (let ((v1-16 *up-vector*)) - (let ((a1-8 (- f28-0))) - (.mov vf7 a1-8) - ) - (.lvf vf5 (&-> v1-16 quad)) - ) - (.lvf vf4 (&-> arg3 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-8 quad) vf6) - ) - (let ((a1-9 s5-0)) - (let ((v1-17 s5-0)) - (let ((a0-10 (vector-! (new 'stack-no-clear 'vector) s2-0 s5-0))) - (let ((a2-6 (fmin 1.0 (* (-> arg0 user-blend) f30-1)))) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-10 quad)) - ) - (.lvf vf4 (&-> v1-17 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-9 quad) vf6) - ) + (if (< f0-1 -6144.0) + (set! f0-1 -6144.0) ) - ) - (set-ik-target! arg0 s5-0) + (+! (-> arg0 user-position y) f0-1) ) + (let ((f0-4 (- (-> arg3 y) (-> arg0 user-position y)))) + (seek! (-> arg0 user-float) f0-4 (* 40960.0 (seconds-per-frame))) + ) + (let* ((f28-0 (-> arg0 user-float)) + (f30-1 (lerp-scale 1.0 0.0 f28-0 0.0 12288.0)) + (s3-1 (vector+*! (new 'stack-no-clear 'vector) s5-0 *up-vector* 8192.0)) + ) + (vector-float*! (new 'stack-no-clear 'vector) *up-vector* -16384.0) + (let ((s2-0 (new 'stack-no-clear 'vector))) + 0.0 + (let ((f0-11 (intersect-ray-plane s3-1 *up-vector* (-> arg0 user-position) *up-vector*))) + (vector+*! s2-0 s3-1 *up-vector* f0-11) + ) + (vector+*! s2-0 arg3 *up-vector* (- f28-0)) + (vector+*! + s5-0 + s5-0 + (vector-! (new 'stack-no-clear 'vector) s2-0 s5-0) + (fmin 1.0 (* (-> arg0 user-blend) f30-1)) + ) + ) + ) + (set-ik-target! arg0 s5-0) ) ) @@ -1042,143 +987,92 @@ ;; WARN: Return type mismatch int vs none. (defbehavior mech-update-ik target () (local-vars (sv-720 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'collide-query)) - (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) + ) + (let ((a1-0 (-> gp-0 bbox)) + (v1-2 (-> s5-0 trans)) + (a0-0 (new 'stack-no-clear 'vector)) ) - (let ((a1-0 (-> gp-0 bbox)) - (v1-2 (-> s5-0 trans)) - (a0-0 (new 'stack-no-clear 'vector)) - ) - (set! (-> a0-0 x) 10240.0) - (set! (-> a0-0 y) 10240.0) - (set! (-> a0-0 z) 10240.0) - (set! (-> a0-0 w) 1.0) - (vector-! (-> a1-0 min) v1-2 a0-0) - ) - (let ((a1-2 (-> gp-0 bbox max)) - (v1-3 (-> s5-0 trans)) - (a0-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> a0-1 x) 10240.0) - (set! (-> a0-1 y) 10240.0) - (set! (-> a0-1 z) 10240.0) - (set! (-> a0-1 w) 1.0) - (vector+! a1-2 v1-3 a0-1) - ) - (set! (-> gp-0 collide-with) (-> (the-as collide-shape s5-0) root-prim prim-core collide-with)) - (set! (-> gp-0 ignore-process0) #f) - (set! (-> gp-0 ignore-process1) #f) - (set! (-> gp-0 ignore-pat) (-> (the-as collide-shape s5-0) pat-ignore-mask)) - (fill-using-bounding-box *collide-cache* gp-0) - (dotimes (s4-0 2) - (let ((s3-0 (-> self mech-ik s4-0))) - #t - (set! (-> s3-0 callback) mech-leg-ik-callback) - (-> s3-0 shoulder-matrix-no-ik) - (let ((v1-13 (-> s3-0 elbow-matrix-no-ik)) - (s0-0 (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) + (set! (-> a0-0 x) 10240.0) + (set! (-> a0-0 y) 10240.0) + (set! (-> a0-0 z) 10240.0) + (set! (-> a0-0 w) 1.0) + (vector-! (-> a1-0 min) v1-2 a0-0) + ) + (let ((a1-2 (-> gp-0 bbox max)) + (v1-3 (-> s5-0 trans)) + (a0-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-1 x) 10240.0) + (set! (-> a0-1 y) 10240.0) + (set! (-> a0-1 z) 10240.0) + (set! (-> a0-1 w) 1.0) + (vector+! a1-2 v1-3 a0-1) + ) + (set! (-> gp-0 collide-with) (-> (the-as collide-shape s5-0) root-prim prim-core collide-with)) + (set! (-> gp-0 ignore-process0) #f) + (set! (-> gp-0 ignore-process1) #f) + (set! (-> gp-0 ignore-pat) (-> (the-as collide-shape s5-0) pat-ignore-mask)) + (fill-using-bounding-box *collide-cache* gp-0) + (dotimes (s4-0 2) + (let ((s3-0 (-> self mech-ik s4-0))) + #t + (set! (-> s3-0 callback) mech-leg-ik-callback) + (-> s3-0 shoulder-matrix-no-ik) + (let ((v1-13 (-> s3-0 elbow-matrix-no-ik)) + (s0-0 (new 'stack-no-clear 'vector)) ) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (new 'stack-no-clear 'vector) - (let ((s1-0 (new 'stack-no-clear 'vector))) - (let ((a1-6 s0-0)) - (let ((a0-8 (-> v1-13 trans))) - (let ((v1-14 (-> v1-13 uvec))) - (let ((a2-8 (-> s3-0 hand-dist))) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> v1-14 quad)) + (set! sv-720 (new 'stack-no-clear 'vector)) + (let ((a0-5 (-> *y-vector* quad))) + (set! (-> sv-720 quad) a0-5) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (vector+*! s0-0 (-> v1-13 trans) (-> v1-13 uvec) (-> s3-0 hand-dist)) + (let ((f0-11 + (lerp-scale 1.0 0.0 (- (-> s0-0 y) (-> (the-as collide-shape-moving s5-0) gspot-pos y)) 2048.0 12288.0) ) - (.lvf vf4 (&-> a0-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 (&-> a1-6 quad) vf6) - ) - (let ((f0-11 - (lerp-scale 1.0 0.0 (- (-> s0-0 y) (-> (the-as collide-shape-moving s5-0) gspot-pos y)) 2048.0 12288.0) - ) - ) - (seek! (-> s3-0 user-blend) f0-11 (* 4.0 (seconds-per-frame))) - ) - (let ((a1-9 (-> gp-0 start-pos))) - (let ((v1-18 s0-0)) - (let ((a0-11 sv-720)) - (let ((a2-12 6144.0)) - (.mov vf7 a2-12) - ) - (.lvf vf5 (&-> a0-11 quad)) - ) - (.lvf vf4 (&-> v1-18 quad)) + (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) ) - (.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-9 quad) vf6) - ) - (let ((v1-19 (-> gp-0 move-dist)) - (f0-16 -20480.0) + (vector-float*! v1-19 sv-720 f0-16) + ) + (let ((v1-21 gp-0)) + (set! (-> v1-21 radius) 4.096) + (set! (-> v1-21 collide-with) (-> gp-0 collide-with)) + (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) ) - (vector-float*! v1-19 sv-720 f0-16) - ) - (let ((v1-21 gp-0)) - (set! (-> v1-21 radius) 4.096) - (set! (-> v1-21 collide-with) (-> gp-0 collide-with)) - (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)) - ) - (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) - (cond - ((>= f30-0 0.0) - (vector-copy! s1-0 (-> gp-0 best-other-tri normal)) - (when (< 8192.0 (vector-vector-angle-safe *y-vector* s1-0)) - (let* ((a1-14 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s1-0) 1.0)) - (a2-14 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-14 8192.0)) - ) - (vector-orient-by-quat! s1-0 *y-vector* a2-14) - ) + (set! (-> v1-21 action-mask) (collide-action solid)) + ) + (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) + (cond + ((>= f30-0 0.0) + (vector-copy! s1-0 (-> gp-0 best-other-tri normal)) + (when (< 8192.0 (vector-vector-angle-safe *y-vector* s1-0)) + (let* ((a1-16 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s1-0) 1.0)) + (a2-12 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-16 8192.0)) + ) + (vector-orient-by-quat! s1-0 *y-vector* a2-12) ) - (let ((a1-16 s2-0)) - (let ((v1-28 (-> gp-0 start-pos))) - (let ((a0-26 (-> gp-0 move-dist))) - (let ((a2-15 f30-0)) - (.mov vf7 a2-15) - ) - (.lvf vf5 (&-> a0-26 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 (&-> a1-16 quad) vf6) - ) - (vector-copy! (-> s3-0 user-position) s2-0) - (vector-copy! (-> s3-0 user-normal) s1-0) ) - (else - (set! (-> s0-0 y) (-> (target-pos 0) y)) - (vector-copy! (-> s3-0 user-position) s0-0) - (vector-copy! (-> s3-0 user-normal) *y-vector*) - ) + (vector+*! s2-0 (-> gp-0 start-pos) (-> gp-0 move-dist) f30-0) + (vector-copy! (-> s3-0 user-position) s2-0) + (vector-copy! (-> s3-0 user-normal) s1-0) + ) + (else + (set! (-> s0-0 y) (-> (target-pos 0) y)) + (vector-copy! (-> s3-0 user-position) s0-0) + (vector-copy! (-> s3-0 user-normal) *y-vector*) ) ) ) @@ -1187,9 +1081,9 @@ ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for function target-mech-init 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 54516f7667..b653d62651 100644 --- a/test/decompiler/reference/jak3/engine/target/pilot-states_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/pilot-states_REF.gc @@ -405,22 +405,11 @@ :exit target-pilot-exit :trans target-pilot-trans :code (behavior () - (local-vars (v1-1 float) (v1-196 int)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) + (local-vars (v1-196 int)) + (rlet ((vf0 :class vf)) (init-vf0-vector) (let ((gp-0 (-> self pilot))) - (.lvf vf1 (&-> (-> gp-0 local-accel) 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-1 vf1) - (let ((f0-0 v1-1) + (let ((f0-0 (vector-length-squared (-> gp-0 local-accel))) (s5-0 (new 'stack-no-clear 'vector)) ) (vector-copy! s5-0 (-> gp-0 local-accel)) 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 5c7cb7a4dd..8241f59591 100644 --- a/test/decompiler/reference/jak3/engine/target/target-anim_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-anim_REF.gc @@ -175,7 +175,7 @@ (if (and gp-0 (using-gun? self)) (goto cfg-43) ) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) @@ -1338,7 +1338,7 @@ (set! (-> s5-0 frame-num) 0.0) (joint-control-channel-group! s5-0 (the-as art-joint-anim jakb-flop-down-land-ja) num-func-seek!) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (if arg1 @@ -1774,7 +1774,7 @@ (set! (-> self control unknown-sound-id01) (sound-play "spin-kick")) (ja-no-eval :group! jakb-attack-from-jump-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) 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 d39eacc1e1..1ef7ba3046 100644 --- a/test/decompiler/reference/jak3/engine/target/target-darkjak_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-darkjak_REF.gc @@ -1426,7 +1426,7 @@ (the-as (pointer int64) (& sv-40)) ) ) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (not (ja-min? 0)) (cond ((and (>= (ja-frame-num 0) 20.0) @@ -2066,7 +2066,7 @@ (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-alignment! (-> self align)) + (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)) @@ -2415,7 +2415,7 @@ (set! (-> self neck flex-blend) 0.0) (set-setting! 'music-volume 'rel 0.0 0) (set-setting! 'ambient-volume 'rel 0.0 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (set-action! *gui-control* (gui-action play) @@ -2430,7 +2430,7 @@ (ja-no-eval :num! (seek! max f0-1)) ) (while (not (ja-done? 0)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (set! (-> self control turn-go-the-long-way) 1.0) (set! (-> self darkjak clock-vel) -4.0) (set! (-> self darkjak clock-on) #t) @@ -2551,7 +2551,7 @@ (ja-no-eval :group! (-> self draw art-group data 471) :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (ja-blend-eval) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (set! (-> self control turn-go-the-long-way) 1.0) (set! (-> self darkjak clock-vel) 4.0) (suspend) 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 f55d0a489d..b30e8333f2 100644 --- a/test/decompiler/reference/jak3/engine/target/target-death_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-death_REF.gc @@ -229,175 +229,138 @@ ;; WARN: Return type mismatch object vs none. (defbehavior apply-pos-from-entity target ((arg0 continue-point)) (local-vars (sv-1328 collide-query)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s1-0 (entity-by-name (the-as string (-> arg0 on-goto))))) - (cond - (s1-0 - (entity-birth-no-kill s1-0) - (let ((a1-0 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-0 from) (process->ppointer self)) - (set! (-> a1-0 num-params) 0) - (set! (-> a1-0 message) 'apply-pos-from-entity) - (let ((t9-2 send-event-function) - (v1-2 s1-0) - ) - (t9-2 - (if v1-2 - (-> v1-2 extra process) - ) - a1-0 + (let ((s1-0 (entity-by-name (the-as string (-> arg0 on-goto))))) + (cond + (s1-0 + (entity-birth-no-kill s1-0) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'apply-pos-from-entity) + (let ((t9-2 send-event-function) + (v1-2 s1-0) ) + (t9-2 + (if v1-2 + (-> v1-2 extra process) + ) + a1-0 ) ) - (let ((s0-0 (-> s1-0 extra perm))) - (logior! (-> s0-0 status) (entity-perm-status bit-5)) - (let ((s2-0 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - (s5-0 (new 'stack-no-clear 'matrix)) + ) + (let ((s0-0 (-> s1-0 extra perm))) + (logior! (-> s0-0 status) (entity-perm-status bit-5)) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'matrix)) + ) + (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) + ) + (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! (-> 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) + ) + ) + (set! (-> s3-0 x) (* 4096.0 (the float (-> s0-0 user-int16 2)))) + (set! (-> s3-0 y) (-> s1-0 extra trans y)) + (set! (-> s3-0 z) (* 4096.0 (the float (-> s0-0 user-int16 3)))) + (let ((s1-1 (new 'stack-no-clear 'collide-query))) + (set-vector! (-> s1-1 move-dist) 0.0 -204800.0 0.0 1.0) + (vector-copy! (-> s1-1 start-pos) s3-0) + (+! (-> s1-1 start-pos y) 102400.0) + (let ((v1-34 s1-1)) + (set! (-> v1-34 radius) 409.6) + (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-20 action-mask) (collide-action solid)) + (set! (-> v1-34 action-mask) (collide-action solid)) ) - (let ((f0-12 (fill-and-probe-using-line-sphere *collide-cache* sv-1328))) + (let ((f0-27 (fill-and-probe-using-line-sphere *collide-cache* s1-1))) (cond - ((>= f0-12 0.0) - (let ((v1-22 s2-0)) - (let ((a0-15 (-> sv-1328 start-pos))) - (let ((a1-3 (-> sv-1328 move-dist))) - (let ((a2-0 f0-12)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> a0-15 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-22 quad) vf6) - ) - (set! (-> s2-0 y) (+ 4096.0 (-> s2-0 y))) + ((>= f0-27 0.0) + (vector+*! s3-0 (-> s1-1 start-pos) (-> s1-1 move-dist) f0-27) + (set! (-> s3-0 y) (+ 4096.0 (-> s3-0 y))) ) (else - (format 0 "failed to find gem ground on pos-from-entity~%") + (format 0 "failed to find jak ground on pos-from-entity~%") ) ) ) - (set! (-> s3-0 x) (* 4096.0 (the float (-> s0-0 user-int16 2)))) - (set! (-> s3-0 y) (-> s1-0 extra trans y)) - (set! (-> s3-0 z) (* 4096.0 (the float (-> s0-0 user-int16 3)))) - (let ((s1-1 (new 'stack-no-clear 'collide-query))) - (set-vector! (-> s1-1 move-dist) 0.0 -204800.0 0.0 1.0) - (vector-copy! (-> s1-1 start-pos) s3-0) - (+! (-> s1-1 start-pos y) 102400.0) - (let ((v1-33 s1-1)) - (set! (-> v1-33 radius) 409.6) - (set! (-> v1-33 collide-with) (collide-spec backgnd)) - (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)) - ) - (let ((f0-27 (fill-and-probe-using-line-sphere *collide-cache* s1-1))) - (cond - ((>= f0-27 0.0) - (let ((a0-26 s3-0)) - (let ((v1-35 (-> s1-1 start-pos))) - (let ((a1-6 (-> s1-1 move-dist))) - (let ((a2-1 f0-27)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-6 quad)) - ) - (.lvf vf4 (&-> v1-35 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-26 quad) vf6) - ) - (set! (-> s3-0 y) (+ 4096.0 (-> s3-0 y))) - ) - (else - (format 0 "failed to find jak ground on pos-from-entity~%") - ) - ) - ) - ) - (vector-copy! (-> arg0 trans) s3-0) - (vector-! s4-0 s3-0 s2-0) - (set! (-> s4-0 y) 16384.0) - (vector+! (-> arg0 camera-trans) s4-0 s3-0) - (vector-negate! s4-0 s4-0) - (set! (-> s4-0 y) 0.0) - (vector-normalize! s4-0 1.0) - (let ((s3-1 (new 'stack-no-clear 'quaternion))) - (quaternion-from-two-vectors! s3-1 (new 'static 'vector :z 1.0) s4-0) - (quaternion->matrix s5-0 s3-1) - (set-vector! - (-> arg0 quat) - (the int (* 32767.0 (-> s3-1 x))) - (the int (* 32767.0 (-> s3-1 y))) - (the int (* 32767.0 (-> s3-1 z))) - (the int (* 32767.0 (-> s3-1 w))) - ) - ) - (set! (-> arg0 camera-rot 0) (the int (* 32767.0 (-> s5-0 rvec x)))) - (set! (-> arg0 camera-rot 1) (the int (* 32767.0 (-> s5-0 rvec y)))) - (set! (-> arg0 camera-rot 2) (the int (* 32767.0 (-> s5-0 rvec z)))) - (set! (-> arg0 camera-rot 3) (the int (* 32767.0 (-> s5-0 uvec x)))) - (set! (-> arg0 camera-rot 4) (the int (* 32767.0 (-> s5-0 uvec y)))) - (set! (-> arg0 camera-rot 5) (the int (* 32767.0 (-> s5-0 uvec z)))) - (set! (-> arg0 camera-rot 6) (the int (* 32767.0 (-> s5-0 fvec x)))) - (set! (-> arg0 camera-rot 7) (the int (* 32767.0 (-> s5-0 fvec y)))) - (set! (-> arg0 camera-rot 8) (the int (* 32767.0 (-> s5-0 fvec z)))) ) - ) - (let ((t9-11 quaternion-copy!) - (a0-46 (-> self control quat-for-control)) - (a1-12 (new 'stack-no-clear 'quaternion)) + (vector-copy! (-> arg0 trans) s3-0) + (vector-! s4-0 s3-0 s2-0) + (set! (-> s4-0 y) 16384.0) + (vector+! (-> arg0 camera-trans) s4-0 s3-0) + (vector-negate! s4-0 s4-0) + (set! (-> s4-0 y) 0.0) + (vector-normalize! s4-0 1.0) + (let ((s3-1 (new 'stack-no-clear 'quaternion))) + (quaternion-from-two-vectors! s3-1 (new 'static 'vector :z 1.0) s4-0) + (quaternion->matrix s5-0 s3-1) + (set-vector! + (-> arg0 quat) + (the int (* 32767.0 (-> s3-1 x))) + (the int (* 32767.0 (-> s3-1 y))) + (the int (* 32767.0 (-> s3-1 z))) + (the int (* 32767.0 (-> s3-1 w))) ) - (set! (-> a1-12 x) (* 0.00003051851 (the float (-> arg0 quat x)))) - (set! (-> a1-12 y) (* 0.00003051851 (the float (-> arg0 quat y)))) - (set! (-> a1-12 z) (* 0.00003051851 (the float (-> arg0 quat z)))) - (set! (-> a1-12 w) (* 0.00003051851 (the float (-> arg0 quat w)))) - (t9-11 a0-46 a1-12) + ) + (set! (-> arg0 camera-rot 0) (the int (* 32767.0 (-> s5-0 rvec x)))) + (set! (-> arg0 camera-rot 1) (the int (* 32767.0 (-> s5-0 rvec y)))) + (set! (-> arg0 camera-rot 2) (the int (* 32767.0 (-> s5-0 rvec z)))) + (set! (-> arg0 camera-rot 3) (the int (* 32767.0 (-> s5-0 uvec x)))) + (set! (-> arg0 camera-rot 4) (the int (* 32767.0 (-> s5-0 uvec y)))) + (set! (-> arg0 camera-rot 5) (the int (* 32767.0 (-> s5-0 uvec z)))) + (set! (-> arg0 camera-rot 6) (the int (* 32767.0 (-> s5-0 fvec x)))) + (set! (-> arg0 camera-rot 7) (the int (* 32767.0 (-> s5-0 fvec y)))) + (set! (-> arg0 camera-rot 8) (the int (* 32767.0 (-> s5-0 fvec z)))) ) - (move-to-point! (-> self control) (-> arg0 trans)) - (rot->dir-targ! (-> self control)) - (vector-copy! (-> self control camera-pos) (-> self control trans)) ) - (else - (format 0 "ERROR: failed to find '~S' for pos-from-entity~%" (-> arg0 on-goto)) + (let ((t9-11 quaternion-copy!) + (a0-47 (-> self control quat-for-control)) + (a1-12 (new 'stack-no-clear 'quaternion)) + ) + (set! (-> a1-12 x) (* 0.00003051851 (the float (-> arg0 quat x)))) + (set! (-> a1-12 y) (* 0.00003051851 (the float (-> arg0 quat y)))) + (set! (-> a1-12 z) (* 0.00003051851 (the float (-> arg0 quat z)))) + (set! (-> a1-12 w) (* 0.00003051851 (the float (-> arg0 quat w)))) + (t9-11 a0-47 a1-12) ) + (move-to-point! (-> self control) (-> arg0 trans)) + (rot->dir-targ! (-> self control)) + (vector-copy! (-> self control camera-pos) (-> self control trans)) + ) + (else + (format 0 "ERROR: failed to find '~S' for pos-from-entity~%" (-> arg0 on-goto)) ) ) - (none) ) + (none) ) ;; definition for function target-continue-init-art @@ -1852,7 +1815,7 @@ ;; WARN: Return type mismatch int vs none. (defbehavior target-death-anim-trans target () (send-event *camera* 'joystick 0.0 -1.0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (let ((gp-0 (new 'stack-no-clear 'vector))) (when (not (logtest? (-> self align flags) (align-flags disabled))) (vector-matrix*! gp-0 (-> self align delta trans) (-> self control c-R-w)) diff --git a/test/decompiler/reference/jak3/engine/target/target-ladder_REF.gc b/test/decompiler/reference/jak3/engine/target/target-ladder_REF.gc index ea3832e1ba..66c6583a7d 100644 --- a/test/decompiler/reference/jak3/engine/target/target-ladder_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-ladder_REF.gc @@ -595,7 +595,7 @@ (let ((f30-0 (-> self ladder flip))) (ja-no-eval :group! jakb-ladder-switch-ja :num! (seek! max 1.25) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (set! (-> self ladder flip) (the float (sar (shl (the int (lerp-scale f30-0 (+ 32768.0 f30-0) (ja-aframe-num 0) 0.0 30.0)) 48) 48)) ) @@ -618,7 +618,7 @@ (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! jakb-ladder-jump-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (suspend) (ja :num! (seek!)) diff --git a/test/decompiler/reference/jak3/engine/target/target-lightjak_REF.gc b/test/decompiler/reference/jak3/engine/target/target-lightjak_REF.gc index 9802487602..6612186f10 100644 --- a/test/decompiler/reference/jak3/engine/target/target-lightjak_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-lightjak_REF.gc @@ -1653,7 +1653,7 @@ ) (ja-no-eval :group! jakb-lightjak-get-on-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel) 1.0 f30-0 1.0) (suspend) (ja :num! (seek!)) @@ -2353,40 +2353,21 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod freeze-screen-method-24 ((this freeze-screen)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s3-0 (camera-matrix)) - (s5-0 (new 'stack-no-clear 'vector)) - (gp-0 (new 'stack-no-clear 'vector)) - (f30-0 4096.0) - ) - (let ((f0-4 (* 0.00013563369 (tan (/ (-> *math-camera* fov) 2)) f30-0))) - (set-vector! (-> this root scale) f0-4 f0-4 f0-4 1.0) - ) - (vector-copy! gp-0 (camera-pos)) - (vector-normalize-copy! s5-0 (-> s3-0 fvec) 1.0) - (matrix->quaternion (-> this root quat) s3-0) - (let ((v1-10 (-> this root trans))) - (let ((a0-5 f30-0)) - (.mov vf7 a0-5) - ) - (.lvf vf5 (&-> s5-0 quad)) - (.lvf vf4 (&-> gp-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 (&-> v1-10 quad) vf6) + (let ((s3-0 (camera-matrix)) + (s5-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + (f30-0 4096.0) ) + (let ((f0-4 (* 0.00013563369 (tan (/ (-> *math-camera* fov) 2)) f30-0))) + (set-vector! (-> this root scale) f0-4 f0-4 f0-4 1.0) ) - 0 - (none) + (vector-copy! gp-0 (camera-pos)) + (vector-normalize-copy! s5-0 (-> s3-0 fvec) 1.0) + (matrix->quaternion (-> this root quat) s3-0) + (vector+*! (-> this root trans) gp-0 s5-0 f30-0) ) + 0 + (none) ) ;; definition for function freeze-screen-init @@ -2911,7 +2892,7 @@ (ja-no-eval :group! gp-0 :num! (seek! max (-> self control current-surface align-speed)) :frame-num 0.0) ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (suspend) (ja :num! (seek! max (-> self control current-surface align-speed))) @@ -3004,7 +2985,7 @@ (show-hud 'hud-health) (ja-no-eval :group! jakb-lightjak-heal-ja :num! (seek!) :frame-num (ja-aframe f28-0 0)) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel) 1.0 2.0 1.0) (set-forward-vel (* 0.6 (-> self control ctrl-xz-vel))) (suspend) @@ -3144,42 +3125,23 @@ #f ) :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s3-0 (the-as target (as-type (ppointer->process (-> self parent)) process-focusable))) - (s4-0 (camera-matrix)) - (s5-0 (new 'stack-no-clear 'vector)) - (gp-1 (new 'stack-no-clear 'vector)) - (f30-0 4096.0) - ) - (let ((f0-0 3.0)) - (set-vector! (-> self root scale) f0-0 f0-0 f0-0 1.0) - ) - (vector-copy! gp-1 (get-trans s3-0 5)) - (vector-normalize-copy! s5-0 (-> s4-0 fvec) 0.0) - (matrix->quaternion (-> self root quat) s4-0) - (let ((v1-11 (-> self root trans))) - (let ((a0-5 f30-0)) - (.mov vf7 a0-5) - ) - (.lvf vf5 (&-> s5-0 quad)) - (.lvf vf4 (&-> gp-1 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-11 quad) vf6) + (let ((s3-0 (the-as target (as-type (ppointer->process (-> self parent)) process-focusable))) + (s4-0 (camera-matrix)) + (s5-0 (new 'stack-no-clear 'vector)) + (gp-1 (new 'stack-no-clear 'vector)) + (f30-0 4096.0) ) + (let ((f0-0 3.0)) + (set-vector! (-> self root scale) f0-0 f0-0 f0-0 1.0) ) - (set! (-> self draw force-fade) (the-as uint (the int (* 128.0 (- 1.0 (-> self fade)))))) - (sound-play "ltjak-shield" :id (the-as sound-id (-> self tone))) - (ja-post) + (vector-copy! gp-1 (get-trans s3-0 5)) + (vector-normalize-copy! s5-0 (-> s4-0 fvec) 0.0) + (matrix->quaternion (-> self root quat) s4-0) + (vector+*! (-> self root trans) gp-1 s5-0 f30-0) ) + (set! (-> self draw force-fade) (the-as uint (the int (* 128.0 (- 1.0 (-> self fade)))))) + (sound-play "ltjak-shield" :id (the-as sound-id (-> self tone))) + (ja-post) ) ) 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 51f6a5bbca..4846a4ca49 100644 --- a/test/decompiler/reference/jak3/engine/target/target-part_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-part_REF.gc @@ -3415,12 +3415,10 @@ (sv-624 int) (sv-640 vector) ) - (rlet ((acc :class vf) - (vf0 :class vf) + (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((s1-0 (-> arg0 draw lod-set lod (-> arg0 draw cur-lod) geo length))) @@ -3537,21 +3535,7 @@ (s2-1 (new 'stack-no-clear 'vector)) ) (set! (-> s4-1 state points-to-draw) 0) - (let ((a1-32 s3-1)) - (let ((v1-44 sv-432)) - (let ((a0-38 sv-448)) - (let ((a2-30 arg4)) - (.mov vf7 a2-30) - ) - (.lvf vf5 (&-> a0-38 quad)) - ) - (.lvf vf4 (&-> v1-44 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) - ) + (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) @@ -3563,26 +3547,12 @@ (quaternion-from-two-vectors! sv-480 s0-2 sv-464) (vector-orient-by-quat! s1-2 sv-448 sv-480) (vector-copy! s1-2 sv-448) - (let ((a1-40 s2-1)) - (let ((v1-56 sv-640)) - (let ((a0-47 s1-2)) - (let ((a2-34 arg4)) - (.mov vf7 a2-34) - ) - (.lvf vf5 (&-> a0-47 quad)) - ) - (.lvf vf4 (&-> v1-56 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-40 quad) vf6) - ) + (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-36 (vector-average! (new 'stack-no-clear 'vector) s2-1 s3-1))) - (sv-592 sv-608 sv-624 a2-36) + (let ((a2-34 (vector-average! (new 'stack-no-clear 'vector) s2-1 s3-1))) + (sv-592 sv-608 sv-624 a2-34) ) (+! (-> s4-1 state points-to-draw) 1) (set-point! s4-1 (-> s4-1 state points-to-draw) s2-1) diff --git a/test/decompiler/reference/jak3/engine/target/target-swim_REF.gc b/test/decompiler/reference/jak3/engine/target/target-swim_REF.gc index 9e41bf90fe..61ce69042c 100644 --- a/test/decompiler/reference/jak3/engine/target/target-swim_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-swim_REF.gc @@ -579,7 +579,7 @@ (ja-channel-push! 1 (seconds 0.15)) (ja-no-eval :group! jakb-swim-walk-ja :num! (seek!) :frame-num (ja-aframe 19.0 0)) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (if (not (logtest? (-> self align flags) (align-flags disabled))) (set! (-> self control mod-surface target-speed) (* (-> self align delta trans z) (-> self control current-surface alignv) (-> self clock frames-per-second)) @@ -597,7 +597,7 @@ (until #f (ja-no-eval :group! jakb-swim-walk-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (if (not (logtest? (-> self align flags) (align-flags disabled))) (set! (-> self control mod-surface target-speed) (* (-> self align delta trans z) (-> self control current-surface alignv) (-> self clock frames-per-second)) @@ -750,7 +750,7 @@ (let ((s4-0 #f)) (ja-no-eval :group! jakb-swim-walk-to-down-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) (when (and (>= (ja-aframe-num 0) 73.0) (not s4-0)) (set! s4-0 #t) @@ -916,7 +916,7 @@ ) (goto cfg-51) ) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (not (logtest? (-> self water flags) (water-flag under-water))) (logior! (-> self water flags) (water-flag swim-ground)) (set! s5-0 #f) @@ -945,7 +945,7 @@ (if (cpad-pressed? (-> self control cpad number) x) (set! f30-0 2.0) ) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (logtest? (-> self water flags) (water-flag under-water)) (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) (set! (-> self control transv y) (+ 8192.0 (* 8192.0 f30-0))) @@ -1001,7 +1001,7 @@ (ja-channel-push! 1 (seconds 0.05)) (ja :group! jakb-swim-jump-ja :num! min) (until (and (ja-done? 0) (= (-> self skel root-channel 0) (-> self skel channel))) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (if (not (logtest? (-> self align flags) (align-flags disabled))) (+! (-> self water align-offset) (* 0.6 (-> self align delta trans y))) ) diff --git a/test/decompiler/reference/jak3/engine/target/target-tube_REF.gc b/test/decompiler/reference/jak3/engine/target/target-tube_REF.gc index 96df5c1e67..c61e710c10 100644 --- a/test/decompiler/reference/jak3/engine/target/target-tube_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-tube_REF.gc @@ -1039,7 +1039,7 @@ (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! jakb-deatha-ja :num! (seek! (ja-aframe 134.0 0)) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (let ((gp-2 (new 'stack-no-clear 'vector))) (when (not (logtest? (-> self align flags) (align-flags disabled))) (vector-matrix*! gp-2 (-> self align delta trans) (-> self control c-R-w)) diff --git a/test/decompiler/reference/jak3/engine/target/target-turret-shot_REF.gc b/test/decompiler/reference/jak3/engine/target/target-turret-shot_REF.gc index 59b0487052..0e978b9107 100644 --- a/test/decompiler/reference/jak3/engine/target/target-turret-shot_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-turret-shot_REF.gc @@ -256,59 +256,37 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this turret-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 1013 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 1013 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 1013) a1-0 s5-1 #f) - (set! (-> *part-id-table* 1013 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 851) s4-0) - (launch-particles (-> *part-id-table* 852) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f26-0 (/ f30-0 (meters 9))) - (f30-1 (-> *part-id-table* 1021 init-specs 3 initial-valuef)) - (f28-1 (-> *part-id-table* 1021 init-specs 4 initial-valuef)) - ) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 1021 init-specs 3 initial-valuef) (* f26-0 f30-1)) - (set! (-> *part-id-table* 1021 init-specs 4 initial-valuef) (* f26-0 f28-1)) - (launch-particles (-> *part-id-table* 1021) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 1021 init-specs 3 initial-valuef) f30-1) - (set! (-> *part-id-table* 1021 init-specs 4 initial-valuef) f28-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 1013 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 1013 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 1013) a1-0 s5-1 #f) + (set! (-> *part-id-table* 1013 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 851) s4-1) + (launch-particles (-> *part-id-table* 852) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f26-0 (/ f30-0 (meters 9))) + (f30-1 (-> *part-id-table* 1021 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 1021 init-specs 4 initial-valuef)) + ) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 1021 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 1021 init-specs 4 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 1021) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 1021 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 1021 init-specs 4 initial-valuef) f28-1) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 26 of type turret-shot 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 761af5a476..c3b60e7942 100644 --- a/test/decompiler/reference/jak3/engine/target/target-turret_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-turret_REF.gc @@ -1566,48 +1566,30 @@ ;; definition for function target-turret-blend-mat ;; WARN: Return type mismatch int vs none. (defbehavior target-turret-blend-mat target ((arg0 cam-rotation-tracker) (arg1 matrix) (arg2 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (cond - ((>= arg2 1.0) - (dotimes (s4-1 3) - (vector-normalize-copy! (the-as vector (&-> arg0 inv-mat quad s4-1)) (the-as vector (&-> arg1 quad s4-1)) 1.0) - (set! (-> arg0 inv-mat vector s4-1 w) 0.0) - ) + (cond + ((>= arg2 1.0) + (dotimes (s4-1 3) + (vector-normalize-copy! (the-as vector (&-> arg0 inv-mat quad s4-1)) (the-as vector (&-> arg1 quad s4-1)) 1.0) + (set! (-> arg0 inv-mat vector s4-1 w) 0.0) ) - (else - (dotimes (s3-0 3) - (set! arg2 (fmax 0.0 (fmin 1.0 arg2))) - (vector-normalize! (the-as vector (&-> arg0 inv-mat quad s3-0)) (- 1.0 arg2)) - (let ((v1-15 (&-> arg0 inv-mat quad s3-0))) - (let ((a0-5 (&-> arg0 inv-mat quad s3-0))) - (let ((a1-5 (&-> arg1 quad s3-0))) - (let ((a2-2 arg2)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a1-5 0)) - ) - (.lvf vf4 (&-> a0-5 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 (&-> v1-15 0) vf6) - ) - (vector-normalize! (the-as vector (&-> arg0 inv-mat quad s3-0)) 1.0) - (set! (-> arg0 inv-mat vector s3-0 w) 0.0) + ) + (else + (dotimes (s3-0 3) + (set! arg2 (fmax 0.0 (fmin 1.0 arg2))) + (vector-normalize! (the-as vector (&-> arg0 inv-mat quad s3-0)) (- 1.0 arg2)) + (vector+*! + (the-as vector (&-> arg0 inv-mat quad s3-0)) + (the-as vector (&-> arg0 inv-mat quad s3-0)) + (the-as vector (&-> arg1 quad s3-0)) + arg2 ) + (vector-normalize! (the-as vector (&-> arg0 inv-mat quad s3-0)) 1.0) + (set! (-> arg0 inv-mat vector s3-0 w) 0.0) ) ) - 0 - (none) ) + 0 + (none) ) ;; failed to figure out what this is: 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 d7bdc05925..cbc99b7ef7 100644 --- a/test/decompiler/reference/jak3/engine/target/target-util_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-util_REF.gc @@ -1875,66 +1875,51 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod attack-info-method-9 ((this attack-info) (arg0 attack-info) (arg1 process-drawable) (arg2 process-drawable)) - (local-vars (v1-14 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) + (let ((s5-0 (as-type arg1 process-drawable))) + (let ((v1-0 (as-type arg2 process-drawable))) + (cond + ((logtest? (attack-mask attacker-velocity) (-> this mask)) + (vector-copy! (-> arg0 attacker-velocity) (-> this attacker-velocity)) + (vector-normalize-copy! (-> arg0 trans) (-> arg0 attacker-velocity) 1.0) ) - (init-vf0-vector) - (let ((s5-0 (as-type arg1 process-drawable))) - (let ((v1-0 (as-type arg2 process-drawable))) - (cond - ((logtest? (attack-mask attacker-velocity) (-> this mask)) - (vector-copy! (-> arg0 attacker-velocity) (-> this attacker-velocity)) - (vector-normalize-copy! (-> arg0 trans) (-> arg0 attacker-velocity) 1.0) - ) - (v1-0 - (cond - (s5-0 - (vector-! (-> arg0 trans) (-> v1-0 root trans) (-> s5-0 root trans)) - (vector-normalize! (-> arg0 trans) 1.0) - (vector-copy! (-> arg0 attacker-velocity) (-> arg0 trans)) - ) - (else - (vector-z-quaternion! (-> arg0 trans) (-> v1-0 root quat)) - (vector-negate-in-place! (-> arg0 trans)) - (vector-normalize! (-> arg0 trans) 1.0) - (vector-copy! (-> arg0 attacker-velocity) (-> arg0 trans)) - ) + (v1-0 + (cond + (s5-0 + (vector-! (-> arg0 trans) (-> v1-0 root trans) (-> s5-0 root trans)) + (vector-normalize! (-> arg0 trans) 1.0) + (vector-copy! (-> arg0 attacker-velocity) (-> arg0 trans)) + ) + (else + (vector-z-quaternion! (-> arg0 trans) (-> v1-0 root quat)) + (vector-negate-in-place! (-> arg0 trans)) + (vector-normalize! (-> arg0 trans) 1.0) + (vector-copy! (-> arg0 attacker-velocity) (-> arg0 trans)) ) ) - (else - (set! (-> arg0 trans quad) (the-as uint128 0)) - (set! (-> arg0 attacker-velocity quad) (the-as uint128 0)) - ) + ) + (else + (set! (-> arg0 trans quad) (the-as uint128 0)) + (set! (-> arg0 attacker-velocity quad) (the-as uint128 0)) ) ) - (if s5-0 - (vector-copy! (-> arg0 intersection) (-> s5-0 root trans)) - (vector-copy! (-> arg0 intersection) (target-pos 0)) - ) ) - (.lvf vf1 (&-> (-> arg0 trans) 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-14 vf1) - (cond - ((!= v1-14 0.0) - (vector-copy! (-> arg0 vector) (-> arg0 trans)) - (set! (-> arg0 vector y) 0.0) - (vector-xz-normalize! (-> arg0 vector) 1.0) - ) - (else - (set! (-> arg0 vector quad) (the-as uint128 0)) + (if s5-0 + (vector-copy! (-> arg0 intersection) (-> s5-0 root trans)) + (vector-copy! (-> arg0 intersection) (target-pos 0)) ) - ) - 0 - (none) ) + (cond + ((!= (vector-length-squared (-> arg0 trans)) 0.0) + (vector-copy! (-> arg0 vector) (-> arg0 trans)) + (set! (-> arg0 vector y) 0.0) + (vector-xz-normalize! (-> arg0 vector) 1.0) + ) + (else + (set! (-> arg0 vector quad) (the-as uint128 0)) + ) + ) + 0 + (none) ) ;; definition for method 10 of type attack-info diff --git a/test/decompiler/reference/jak3/engine/target/target2_REF.gc b/test/decompiler/reference/jak3/engine/target/target2_REF.gc index 7d14d8b430..34f98aa93c 100644 --- a/test/decompiler/reference/jak3/engine/target/target2_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target2_REF.gc @@ -28,7 +28,7 @@ (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! jakb-trip-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) (let ((a1-3 (new 'stack-no-clear 'event-message-block))) (let ((v1-22 (process->ppointer self))) @@ -1144,7 +1144,7 @@ (target-compute-edge-rider) ) ) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (not (logtest? (-> self align flags) (align-flags disabled))) (vector-matrix*! s3-0 (-> self align delta trans) (-> self control c-R-w)) (move-by-vector! (-> self control) s3-0) @@ -1195,7 +1195,7 @@ ) (ja-no-eval :group! jakb-edge-grab-off-ja :num! (seek! (ja-aframe 191.0 0)) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (not (logtest? (-> self align flags) (align-flags disabled))) (vector-matrix*! gp-0 (-> self align delta trans) (-> self control c-R-w)) (move-by-vector! (-> self control) gp-0) @@ -1319,7 +1319,7 @@ ) (until (ja-done? 0) (gp-0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel) diff --git a/test/decompiler/reference/jak3/engine/target/target_REF.gc b/test/decompiler/reference/jak3/engine/target/target_REF.gc index 3cdb41d8dc..6d8b68e521 100644 --- a/test/decompiler/reference/jak3/engine/target/target_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target_REF.gc @@ -379,11 +379,11 @@ (ja-channel-push! 1 (seconds 0.04)) (ja :group! jakb-turn-around-ja :num! min) (quaternion-rotate-y! (-> self control dir-targ) (-> self control dir-targ) 32768.0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (until (ja-done? 0) (suspend) (ja :num! (seek! max 2.0)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) ) (remove-exit) @@ -2341,7 +2341,7 @@ (ja-channel-push! 1 (seconds 0.05)) (ja-no-eval :group! s5-0 :num! (seek! max (-> self control current-surface align-speed)) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) (set! (-> self control mod-surface) *attack-mods*) (when (and gp-0 (send-event (handle->process (-> self control unknown-combo-tracker00 target)) 'combo)) @@ -2747,7 +2747,7 @@ (f28-0 1.0) ) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (when (not (ja-min? 0)) (cond ((and (>= (ja-aframe-num 0) 20.0) @@ -3431,11 +3431,11 @@ ) ) ) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (until (ja-done? 0) (suspend) (ja :num! (seek! max 0.9)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (set! (-> self control turn-go-the-long-way) 1.0) (let ((v1-27 (ja-group))) (if (and v1-27 (= v1-27 jakb-attack-uppercut-ja)) @@ -3970,7 +3970,7 @@ (if (cpad-pressed? (-> self control cpad number) square) (current-time) ) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (cond ((nonzero? s5-0) ) @@ -4098,7 +4098,7 @@ ) (let ((f30-0 1.0)) (until v1-37 - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (if (not (ja-max? 0)) (align! (-> self align) 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 a81735b486..9c55337eae 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 @@ -3054,44 +3054,30 @@ ;; definition for function kg-bombbot-find-nearest-nav-mesh (defun kg-bombbot-find-nearest-nav-mesh ((arg0 kg-bombbot) (arg1 float)) - (local-vars (v1-15 float) (sv-64 nav-poly) (sv-68 nav-mesh) (sv-72 float) (sv-76 kg-bombbot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-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) - (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))) - (.lvf vf1 (&-> (-> sv-64 vertex) 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-15 vf1) - (let ((f0-1 v1-15) - (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) - ) + (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) ) ) ) @@ -3102,8 +3088,8 @@ ) ) ) - sv-68 ) + sv-68 ) ;; definition for method 205 of type kg-bombbot @@ -3137,50 +3123,27 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod bombbot-method-196 ((this kg-bombbot) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 - (as-type - (handle->process (-> *blow-tower-targets* target-handles (logand (rand-uint31-gen *random-generator*) 1))) - process-focusable - ) + (let ((s5-0 + (as-type + (handle->process (-> *blow-tower-targets* target-handles (logand (rand-uint31-gen *random-generator*) 1))) + process-focusable ) ) - (cond - (s5-0 - (vector-copy! (-> this target-pos) (get-trans s5-0 3)) - (let ((v1-9 (-> this target-pos))) - (let ((a0-9 (-> s5-0 root trans))) - (let ((a1-5 (-> s5-0 root transv))) - (let ((a2-0 0.0)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a1-5 quad)) - ) - (.lvf vf4 (&-> a0-9 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-9 quad) vf6) - ) - (vector-copy! (-> this start-target-pos) (-> this target-pos)) - (vector-copy! (-> this start-target-vel) (-> s5-0 root transv)) - (focus-on! (-> this focus) s5-0 this) - ) - (else - (clear-focused (-> this focus)) - ) + ) + (cond + (s5-0 + (vector-copy! (-> this target-pos) (get-trans s5-0 3)) + (vector+*! (-> this target-pos) (-> s5-0 root trans) (-> s5-0 root transv) 0.0) + (vector-copy! (-> this start-target-pos) (-> this target-pos)) + (vector-copy! (-> this start-target-vel) (-> s5-0 root transv)) + (focus-on! (-> this focus) s5-0 this) + ) + (else + (clear-focused (-> this focus)) ) ) - (none) ) + (none) ) ;; failed to figure out what this is: 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 6c7513736f..f6bf1534db 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 @@ -1376,7 +1376,7 @@ ) (set! sv-176 f30-1) (let ((a3-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) arg2))) - (s4-1 s3-1 (the-as quaternion s0-1) sv-176 a3-1) + (s4-1 s3-1 s0-1 sv-176 a3-1) ) ) (vector+! s2-0 s2-0 s1-0) @@ -3461,7 +3461,7 @@ (s3-3 (-> this pitch-quat)) ) (let ((f28-1 (-> this roll-amount))) - (vector-rotate-around-axis! sv-268 (the-as quaternion sv-260) (-> v1-68 rot-y-shift) *up-vector*) + (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) 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 6545217ace..19d8caba06 100644 --- a/test/decompiler/reference/jak3/levels/city/bombbot/bombbot_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/bombbot/bombbot_REF.gc @@ -385,14 +385,9 @@ ;; WARN: Return type mismatch int vs none. (defmethod bombbot-bomb-method-32 ((this bombbot-bomb)) (local-vars (at-0 int)) - (rlet ((acc :class vf) - (vf0 :class vf) + (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((s5-0 (-> this root))) @@ -436,21 +431,7 @@ (quaternion-normalize! (-> this root quat)) (let ((a1-6 (-> this root))) (when (logtest? (-> a1-6 status) (collide-status touch-surface)) - (let ((a0-14 (-> a1-6 transv))) - (let ((v1-20 (-> a1-6 transv))) - (let ((a1-7 (-> a1-6 transv))) - (let ((a2-8 (* -15.0 (seconds-per-frame)))) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a1-7 quad)) - ) - (.lvf vf4 (&-> v1-20 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-14 quad) vf6) - ) + (vector+*! (-> a1-6 transv) (-> a1-6 transv) (-> a1-6 transv) (* -15.0 (seconds-per-frame))) (set! (-> this rot-angle) (* -4.0 (vector-length (-> this root transv)))) ) ) @@ -500,91 +481,54 @@ ;; definition for function bombbot-bomb-handler ;; INFO: Used lq/sq (defbehavior bombbot-bomb-handler bombbot-bomb ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (case arg2 - (('attack) - (cond - ((= (-> arg0 type) target) - (let ((s3-0 (as-type (ppointer->process (-> self parent)) process-focusable)) - (s5-0 (new 'stack-no-clear 'traj3d-params)) - (gp-1 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (when s3-0 - (vector-rotate-around-y! gp-1 *x-vector* (* 182.04445 (rand-vu-float-range 0.0 360.0))) - (let ((s2-1 (-> s5-0 dest))) - (let ((v1-6 (get-trans s3-0 3))) - (let ((a0-6 gp-1)) - (let ((a1-7 8192.0)) - (.mov vf7 a1-7) - ) - (.lvf vf5 (&-> a0-6 quad)) + (case arg2 + (('attack) + (cond + ((= (-> arg0 type) target) + (let ((s3-0 (as-type (ppointer->process (-> self parent)) process-focusable)) + (s5-0 (new 'stack-no-clear 'traj3d-params)) + (gp-1 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (when s3-0 + (vector-rotate-around-y! gp-1 *x-vector* (* 182.04445 (rand-vu-float-range 0.0 360.0))) + (vector+*! (-> s5-0 dest) (get-trans s3-0 3) gp-1 8192.0) + (vector+*! (-> s5-0 dest) (-> s5-0 dest) (get-transv s3-0) 2.0) + (vector-copy! (-> s5-0 src) (-> self root trans)) + (set! (-> s5-0 initial-tilt) (* 182.04445 (rand-vu-float-range 30.0 50.0))) + (set! (-> s5-0 gravity) 184320.0) + (when (traj3d-calc-initial-velocity-using-tilt s5-0) + (vector-! gp-1 (-> self root trans) (target-pos 0)) + (set! (-> gp-1 y) 0.0) + (vector-normalize! gp-1 1.0) + (vector-copy! s4-0 (-> s5-0 initial-velocity)) + (set! (-> s4-0 y) 0.0) + (vector-normalize! s4-0 1.0) + (cond + ((< 0.7 (vector-dot gp-1 s4-0)) + (vector-copy! (-> self root transv) (-> s5-0 initial-velocity)) + ) + (else + (let ((t9-10 vector-normalize!) + (a0-21 gp-1) + (v1-20 (-> s5-0 initial-velocity)) + ) + (t9-10 a0-21 (sqrtf (+ (* (-> v1-20 x) (-> v1-20 x)) (* (-> v1-20 z) (-> v1-20 z))))) ) - (.lvf vf4 (&-> v1-6 quad)) + (set! (-> gp-1 y) (-> s5-0 initial-velocity y)) + (vector-copy! (-> self root transv) gp-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 (&-> s2-1 quad) vf6) - ) - (let ((s1-1 (-> s5-0 dest))) - (let ((s2-2 (-> s5-0 dest))) - (let ((v1-8 (get-transv s3-0))) - (let ((a0-9 2.0)) - (.mov vf7 a0-9) - ) - (.lvf vf5 (&-> v1-8 quad)) - ) - (.lvf vf4 (&-> s2-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 (&-> s1-1 quad) vf6) - ) - (vector-copy! (-> s5-0 src) (-> self root trans)) - (set! (-> s5-0 initial-tilt) (* 182.04445 (rand-vu-float-range 30.0 50.0))) - (set! (-> s5-0 gravity) 184320.0) - (when (traj3d-calc-initial-velocity-using-tilt s5-0) - (vector-! gp-1 (-> self root trans) (target-pos 0)) - (set! (-> gp-1 y) 0.0) - (vector-normalize! gp-1 1.0) - (vector-copy! s4-0 (-> s5-0 initial-velocity)) - (set! (-> s4-0 y) 0.0) - (vector-normalize! s4-0 1.0) - (cond - ((< 0.7 (vector-dot gp-1 s4-0)) - (vector-copy! (-> self root transv) (-> s5-0 initial-velocity)) - ) - (else - (let ((t9-10 vector-normalize!) - (a0-22 gp-1) - (v1-20 (-> s5-0 initial-velocity)) - ) - (t9-10 a0-22 (sqrtf (+ (* (-> v1-20 x) (-> v1-20 x)) (* (-> v1-20 z) (-> v1-20 z))))) - ) - (set! (-> gp-1 y) (-> s5-0 initial-velocity y)) - (vector-copy! (-> self root transv) gp-1) - ) - ) - (go-virtual back) ) + (go-virtual back) ) ) ) - (else - #f - ) + ) + (else + #f ) ) - ) + ) ) ) @@ -1229,70 +1173,18 @@ ;; definition for function bombbot-do-spline (defun bombbot-do-spline ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((f1-1 (* arg5 arg5)) + (f0-2 (* arg5 f1-1)) ) - (init-vf0-vector) - (let* ((f1-1 (* arg5 arg5)) - (f0-2 (* arg5 f1-1)) - ) - (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) - (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) - (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) - ) - (vector-float*! arg0 arg1 f2-3) - (let ((t2-0 arg0)) - (let ((v1-10 arg0)) - (let ((t1-3 (vector+! (new 'stack-no-clear 'vector) arg1 arg2))) - (let ((a1-1 f3-7)) - (.mov vf7 a1-1) - ) - (.lvf vf5 (&-> t1-3 quad)) - ) - (.lvf vf4 (&-> v1-10 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 (&-> t2-0 quad) vf6) + (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) + (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) + (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) ) - (let ((a2-1 arg0)) - (let ((v1-11 arg0)) - (let ((a1-3 (vector+! (new 'stack-no-clear 'vector) arg3 arg4))) - (let ((t0-1 f1-3)) - (.mov vf7 t0-1) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> v1-11 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-1 quad) vf6) - ) - ) - (let ((v0-0 arg0)) - (let ((v1-12 arg0)) - (let ((a0-1 arg3)) - (let ((a1-4 f0-2)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-12 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 (&-> v0-0 quad) vf6) - v0-0 - ) + (vector-float*! arg0 arg1 f2-3) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg1 arg2) f3-7) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg3 arg4) f1-3) ) + (vector+*! arg0 arg0 arg3 f0-2) ) ) @@ -1331,86 +1223,63 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod bombbot-method-204 ((this bombbot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s1-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) - (new 'stack-no-clear 'vector) - (let ((s3-0 (new 'stack-no-clear 'collide-query)) - (s5-0 (new 'stack-no-clear 'vector)) - (gp-0 (new 'stack-no-clear 'vector)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector)) - (f30-0 (lerp-scale 1.0 0.0 (* 0.0033333334 (the float (- (-> this next-target) (current-time)))) 2.5 3.5)) - ) - (if (= (-> this focus handle) #f) - (set! f30-0 0.0) - ) - (matrix->trans s1-0 gp-0) - (let ((a1-3 gp-0)) - (let ((v1-10 gp-0)) - (let ((a0-4 (-> s1-0 fvec))) - (let ((a2-6 8192.0)) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-4 quad)) - ) - (.lvf vf4 (&-> v1-10 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-3 quad) vf6) - ) - (vector-normalize-copy! s5-0 (-> s1-0 fvec) 819200.0) - (vector-copy! (-> s3-0 start-pos) gp-0) - (vector-copy! (-> s3-0 move-dist) s5-0) - (let ((v1-13 s3-0)) - (set! (-> v1-13 radius) 40.96) - (set! (-> v1-13 collide-with) (collide-spec backgnd enemy hit-by-others-list)) - (set! (-> v1-13 ignore-process0) this) - (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-4 (fill-and-probe-using-line-sphere *collide-cache* s3-0))) - (when (>= f0-4 0.0) - (vector+float*! s4-0 (-> s3-0 start-pos) (-> s3-0 move-dist) f0-4) - (vector-float*! s5-0 s5-0 f0-4) - (let ((s2-1 (as-type (-> s3-0 best-other-tri collide-ptr) collide-shape-prim)) - (v1-22 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> s3-0 start-pos) s4-0) 1638.4)) - (s3-1 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s3-1 s4-0) - (vector+! s3-1 s3-1 v1-22) - (cond - (s2-1 - (launch-particles (-> *part-id-table* 2061) s3-1) - (launch-particles (-> *part-id-table* 2060) s3-1) - ) - (else - (launch-particles (-> *part-id-table* 2062) s3-1) - ) - ) - ) - ) - ) - (set! (-> *part-id-table* 2059 init-specs 5 initial-valuef) (* 255.0 f30-0)) - (set! (-> *part-id-table* 2059 init-specs 7 initial-valuef) (* 255.0 (- 1.0 f30-0))) + (let ((s1-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) + (new 'stack-no-clear 'vector) + (let ((s3-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) ) - (draw-beam (-> *part-id-table* 2059) gp-0 s5-0 #t) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (f30-0 (lerp-scale 1.0 0.0 (* 0.0033333334 (the float (- (-> this next-target) (current-time)))) 2.5 3.5)) + ) + (if (= (-> this focus handle) #f) + (set! f30-0 0.0) + ) + (matrix->trans s1-0 gp-0) + (vector+*! gp-0 gp-0 (-> s1-0 fvec) 8192.0) + (vector-normalize-copy! s5-0 (-> s1-0 fvec) 819200.0) + (vector-copy! (-> s3-0 start-pos) gp-0) + (vector-copy! (-> s3-0 move-dist) s5-0) + (let ((v1-13 s3-0)) + (set! (-> v1-13 radius) 40.96) + (set! (-> v1-13 collide-with) (collide-spec backgnd enemy hit-by-others-list)) + (set! (-> v1-13 ignore-process0) this) + (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-4 (fill-and-probe-using-line-sphere *collide-cache* s3-0))) + (when (>= f0-4 0.0) + (vector+float*! s4-0 (-> s3-0 start-pos) (-> s3-0 move-dist) f0-4) + (vector-float*! s5-0 s5-0 f0-4) + (let ((s2-1 (as-type (-> s3-0 best-other-tri collide-ptr) collide-shape-prim)) + (v1-22 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> s3-0 start-pos) s4-0) 1638.4)) + (s3-1 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s3-1 s4-0) + (vector+! s3-1 s3-1 v1-22) + (cond + (s2-1 + (launch-particles (-> *part-id-table* 2061) s3-1) + (launch-particles (-> *part-id-table* 2060) s3-1) + ) + (else + (launch-particles (-> *part-id-table* 2062) s3-1) + ) + ) + ) + ) + ) + (set! (-> *part-id-table* 2059 init-specs 5 initial-valuef) (* 255.0 f30-0)) + (set! (-> *part-id-table* 2059 init-specs 7 initial-valuef) (* 255.0 (- 1.0 f30-0))) ) + (draw-beam (-> *part-id-table* 2059) gp-0 s5-0 #t) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 201 of type bombbot @@ -1525,8 +1394,6 @@ ;; ERROR: Stack slot load at 912 mismatch: defined as size 4, got size 16 ;; 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 -;; 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 ;; WARN: Return type mismatch int vs none. (defmethod bombbot-method-194 ((this bombbot)) (local-vars @@ -1545,10 +1412,6 @@ (vf1 :class vf) (vf2 :class vf) (vf3 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((s5-0 (new 'stack-no-clear 'collide-query))) @@ -1626,53 +1489,16 @@ (.svf (&-> a0-12 quad) vf1) (vector+! a1-6 v1-42 a0-12) ) - (let ((a1-8 (-> s1-0 speed))) - (let ((v1-43 (-> s1-0 speed))) - (let ((a0-14 (vector-! (new 'stack-no-clear 'vector) s0-0 (-> s1-0 speed)))) - (let ((a2-15 (* 4.0 (seconds-per-frame)))) - (.mov vf7 a2-15) - ) - (.lvf vf5 (&-> a0-14 quad)) - ) - (.lvf vf4 (&-> v1-43 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-8 quad) vf6) - ) - (let ((a1-9 s3-0)) - (let ((v1-44 s3-0)) - (let ((a0-15 (-> s1-0 speed))) - (let ((a2-17 (+ 0.2 f26-0))) - (.mov vf7 a2-17) - ) - (.lvf vf5 (&-> a0-15 quad)) - ) - (.lvf vf4 (&-> v1-44 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-9 quad) vf6) + (vector+*! + (-> s1-0 speed) + (-> s1-0 speed) + (vector-! (new 'stack-no-clear 'vector) s0-0 (-> s1-0 speed)) + (* 4.0 (seconds-per-frame)) ) + (vector+*! s3-0 s3-0 (-> s1-0 speed) (+ 0.2 f26-0)) ) (vector+! s3-0 s3-0 (-> this root trans)) - (let ((a1-12 (-> s5-0 start-pos))) - (let ((v1-46 s3-0)) - (let ((a0-18 s2-0)) - (let ((a2-19 24576.0)) - (.mov vf7 a2-19) - ) - (.lvf vf5 (&-> a0-18 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-12 quad) vf6) - ) + (vector+*! (-> s5-0 start-pos) s3-0 s2-0 24576.0) (vector-float*! (-> s5-0 move-dist) s2-0 -49152.0) (let ((v1-49 s5-0)) (set! (-> v1-49 radius) 40.96) @@ -1686,55 +1512,33 @@ ) (let ((f0-25 (probe-using-line-sphere *collide-cache* s5-0))) (when (>= f0-25 0.0) - (let ((v1-51 (new 'stack-no-clear 'vector))) - (let ((a0-26 (-> s5-0 start-pos))) - (let ((a1-15 (-> s5-0 move-dist))) - (let ((a2-20 f0-25)) - (.mov vf7 a2-20) - ) - (.lvf vf5 (&-> a1-15 quad)) - ) - (.lvf vf4 (&-> a0-26 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-51 quad) vf6) - (- (-> s3-0 y) (-> v1-51 y)) - (vector-copy! s3-0 v1-51) + (let ((v1-52 (vector+*! (new 'stack-no-clear 'vector) (-> s5-0 start-pos) (-> s5-0 move-dist) f0-25))) + (- (-> s3-0 y) (-> v1-52 y)) + (vector-copy! s3-0 v1-52) ) ) ) (vector-copy! (-> s1-0 next-position) s3-0) (set! (-> s1-0 moving) #t) - (let ((a1-16 s3-0)) - (let ((v1-55 (-> s1-0 position))) - (let ((a0-31 (vector-! (new 'stack-no-clear 'vector) (-> s1-0 next-position) (-> s1-0 position)))) - (let ((a2-22 (/ f28-0 f30-0))) - (.mov vf7 a2-22) - ) - (.lvf vf5 (&-> a0-31 quad)) - ) - (.lvf vf4 (&-> v1-55 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-16 quad) vf6) + (vector+*! + s3-0 + (-> s1-0 position) + (vector-! (new 'stack-no-clear 'vector) (-> s1-0 next-position) (-> s1-0 position)) + (/ f28-0 f30-0) ) (let ((t9-6 bombbot-do-spline) (a0-32 (new 'stack-no-clear 'vector)) - (a1-17 (new 'stack-no-clear 'vector)) + (a1-21 (new 'stack-no-clear 'vector)) ) - (set! (-> a1-17 x) 0.0) - (set! (-> a1-17 y) 0.0) - (set! (-> a1-17 z) 0.0) - (set! (-> a1-17 w) 1.0) - (let ((a2-23 (new 'stack-no-clear 'vector))) - (set! (-> a2-23 x) 0.0) - (set! (-> a2-23 y) 0.0) - (set! (-> a2-23 z) 0.5) - (set! (-> a2-23 w) 1.0) + (set! (-> a1-21 x) 0.0) + (set! (-> a1-21 y) 0.0) + (set! (-> a1-21 z) 0.0) + (set! (-> a1-21 w) 1.0) + (let ((a2-18 (new 'stack-no-clear 'vector))) + (set! (-> a2-18 x) 0.0) + (set! (-> a2-18 y) 0.0) + (set! (-> a2-18 z) 0.5) + (set! (-> a2-18 w) 1.0) (let ((a3-1 (new 'stack-no-clear 'vector))) (set! (-> a3-1 x) 0.0) (set! (-> a3-1 y) 0.0) @@ -1745,7 +1549,7 @@ (set! (-> t0-0 y) 4.0) (set! (-> t0-0 z) 0.0) (set! (-> t0-0 w) 1.0) - (let ((v0-6 (t9-6 a0-32 a1-17 a2-23 a3-1 t0-0 (/ f28-0 f30-0)))) + (let ((v0-6 (t9-6 a0-32 a1-21 a2-18 a3-1 t0-0 (/ f28-0 f30-0)))) (set! (-> s1-0 delta-y) (* (/ (-> v0-6 y) 20) (vector-length (-> s1-0 speed)))) ) ) @@ -1764,11 +1568,11 @@ (set! sv-912 (the-as float 0.0)) (set! sv-928 vector-vector-distance) (let* ((a0-36 (camera-pos)) - (a1-19 (-> s1-0 position)) - (a2-25 (sv-928 a0-36 a1-19)) + (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-25 a3-2 t0-1)) + (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) @@ -1789,28 +1593,28 @@ ((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-28 (new-sound-id)) - (a2-37 1024) + (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-28 a2-37 a3-8 t0-3 (the-as sound-group t1-2) t2-1) + (s0-4 (the-as sound-name sv-944) a1-32 a2-32 a3-8 t0-3 (the-as sound-group t1-2) t2-1) ) ) ) (else (let ((s0-5 sound-play-by-name)) (set! sv-960 (make-u128 0 (the-as uint #x6b6c61772d6262))) - (let ((a1-29 (new-sound-id)) - (a2-38 1024) + (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-29 a2-38 a3-9 t0-4 (the-as sound-group t1-3) t2-2) + (s0-5 (the-as sound-name sv-960) a1-33 a2-33 a3-9 t0-4 (the-as sound-group t1-3) t2-2) ) ) ) @@ -1828,53 +1632,26 @@ ) ) ) - (let ((a1-31 (-> s5-0 start-pos))) - (let ((v1-133 s3-0)) - (let ((a0-62 s2-0)) - (let ((a2-41 12288.0)) - (.mov vf7 a2-41) - ) - (.lvf vf5 (&-> a0-62 quad)) - ) - (.lvf vf4 (&-> v1-133 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-31 quad) vf6) - ) + (vector+*! (-> s5-0 start-pos) s3-0 s2-0 12288.0) (vector-float*! (-> s5-0 move-dist) s2-0 -24576.0) - (let ((v1-136 s5-0)) - (set! (-> v1-136 radius) 40.96) - (set! (-> v1-136 collide-with) (collide-spec backgnd)) - (set! (-> v1-136 ignore-process0) #f) - (set! (-> v1-136 ignore-process1) #f) - (set! (-> v1-136 ignore-pat) + (let ((v1-137 s5-0)) + (set! (-> v1-137 radius) 40.96) + (set! (-> v1-137 collide-with) (collide-spec backgnd)) + (set! (-> v1-137 ignore-process0) #f) + (set! (-> v1-137 ignore-process1) #f) + (set! (-> v1-137 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (set! (-> v1-136 action-mask) (collide-action solid)) + (set! (-> v1-137 action-mask) (collide-action solid)) ) (let ((f0-63 (probe-using-line-sphere *collide-cache* s5-0))) (when (>= f0-63 0.0) - (let ((s0-6 (new 'stack-no-clear 'vector))) - (let ((v1-139 (-> s5-0 start-pos))) - (let ((a0-69 (-> s5-0 move-dist))) - (let ((a1-34 f0-63)) - (.mov vf7 a1-34) - ) - (.lvf vf5 (&-> a0-69 quad)) - ) - (.lvf vf4 (&-> v1-139 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 (&-> s0-6 quad) vf6) - (let ((f0-65 (- (-> s3-0 y) (-> s0-6 y)))) + (let ((s0-7 (vector+*! (new 'stack-no-clear 'vector) (-> s5-0 start-pos) (-> s5-0 move-dist) f0-63))) + (let ((f0-65 (- (-> s3-0 y) (-> s0-7 y)))) (lerp-scale 1.0 0.0 f0-65 0.0 8192.0) ) - (- (-> s0-6 y) (-> this root trans y)) - (vector-dot s2-0 (vector-! (new 'stack-no-clear 'vector) s0-6 (-> this root trans))) + (- (-> s0-7 y) (-> this root trans y)) + (vector-dot s2-0 (vector-! (new 'stack-no-clear 'vector) s0-7 (-> this root trans))) ) ) ) @@ -1999,38 +1776,10 @@ ;; definition for method 21 of type bombbot (defmethod get-trans ((this bombbot) (arg0 int)) "Get the `trans` for this process." - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (cond - ((= arg0 4) - (let ((v0-0 (new 'static 'vector))) - (let ((v1-2 (-> this root trans))) - (let ((a0-1 *y-vector*)) - (let ((a1-2 12288.0)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-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 (&-> v0-0 quad) vf6) - v0-0 - ) - ) - (else - ((method-of-type nav-enemy get-trans) this arg0) - ) + (if (= arg0 4) + (vector+*! (new 'static 'vector) (-> this root trans) *y-vector* 12288.0) + ((method-of-type nav-enemy get-trans) this arg0) ) - ) ) ;; definition for method 65 of type bombbot @@ -2158,38 +1907,29 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod bombbot-method-196 ((this bombbot) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (the-as process-drawable #f))) - (let ((f30-0 (the-as float #x7f800000)) - (s3-0 (new 'stack-no-clear 'array 'collide-shape 64)) - ) - (countdown (s2-0 (fill-actor-list-for-box *actor-hash* arg0 s3-0 64)) - (let ((a0-3 (as-type (-> s3-0 s2-0) collide-shape))) - (when a0-3 - (let ((s1-1 (as-type (-> a0-3 process) process-focusable))) - (when (and s1-1 - (!= this s1-1) - (not (focus-test? this inactive)) - (not (focus-test? this disable)) - (not (focus-test? this dead)) - (not (logtest? (process-mask guard) (-> s1-1 mask))) - (not (logtest? (process-mask crate) (-> s1-1 mask))) - (logtest? (process-mask guard vehicle) (-> s1-1 mask)) - s1-1 - (not (logtest? (-> (the-as process-focusable s1-1) focus-status) (focus-status disable dead ignore grabbed))) - ) - (let ((f0-0 (vector-vector-xz-distance (-> this root trans) (-> (the-as process-focusable s1-1) root trans)))) - (when (or (not gp-0) (< f0-0 f30-0)) - (set! gp-0 s1-1) - (set! f30-0 f0-0) - ) + (let ((gp-0 (the-as process-drawable #f))) + (let ((f30-0 (the-as float #x7f800000)) + (s3-0 (new 'stack-no-clear 'array 'collide-shape 64)) + ) + (countdown (s2-0 (fill-actor-list-for-box *actor-hash* arg0 s3-0 64)) + (let ((a0-3 (as-type (-> s3-0 s2-0) collide-shape))) + (when a0-3 + (let ((s1-1 (as-type (-> a0-3 process) process-focusable))) + (when (and s1-1 + (!= this s1-1) + (not (focus-test? this inactive)) + (not (focus-test? this disable)) + (not (focus-test? this dead)) + (not (logtest? (process-mask guard) (-> s1-1 mask))) + (not (logtest? (process-mask crate) (-> s1-1 mask))) + (logtest? (process-mask guard vehicle) (-> s1-1 mask)) + s1-1 + (not (logtest? (-> (the-as process-focusable s1-1) focus-status) (focus-status disable dead ignore grabbed))) + ) + (let ((f0-0 (vector-vector-xz-distance (-> this root trans) (-> (the-as process-focusable s1-1) root trans)))) + (when (or (not gp-0) (< f0-0 f30-0)) + (set! gp-0 s1-1) + (set! f30-0 f0-0) ) ) ) @@ -2197,39 +1937,25 @@ ) ) ) - (if (and *target* (< (vector-vector-distance (target-pos 0) arg0) (-> arg0 w))) - (set! gp-0 *target*) - ) - (cond - (gp-0 - (vector-copy! (-> this target-pos) (get-trans (the-as process-focusable gp-0) 3)) - (let ((v1-34 (-> this target-pos))) - (let ((a0-16 (-> gp-0 root trans))) - (let ((a1-8 (-> gp-0 root transv))) - (let ((a2-1 0.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-8 quad)) - ) - (.lvf vf4 (&-> a0-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 (&-> v1-34 quad) vf6) - ) - (vector-copy! (-> this start-target-pos) (-> gp-0 root trans)) - (vector-copy! (-> this start-target-vel) (-> gp-0 root transv)) - (focus-on! (-> this focus) (the-as process-focusable gp-0) this) - ) - (else - (clear-focused (-> this focus)) - ) + ) + (if (and *target* (< (vector-vector-distance (target-pos 0) arg0) (-> arg0 w))) + (set! gp-0 *target*) + ) + (cond + (gp-0 + (vector-copy! (-> this target-pos) (get-trans (the-as process-focusable gp-0) 3)) + (vector+*! (-> this target-pos) (-> gp-0 root trans) (-> gp-0 root transv) 0.0) + (vector-copy! (-> this start-target-pos) (-> gp-0 root trans)) + (vector-copy! (-> this start-target-vel) (-> gp-0 root transv)) + (focus-on! (-> this focus) (the-as process-focusable gp-0) this) + ) + (else + (clear-focused (-> this focus)) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 208 of type bombbot @@ -2243,63 +1969,40 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod bombbot-method-203 ((this bombbot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) + (let ((s4-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) + (new 'stack-no-clear 'vector) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + ) (new 'stack-no-clear 'vector) - (let ((s2-0 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (new 'stack-no-clear 'vector) - (let ((s5-0 (new 'stack-no-clear 'traj3d-params))) - (matrix->trans s4-0 s3-0) - (let ((a1-2 s3-0)) - (let ((v1-5 s3-0)) - (let ((a0-3 (-> s4-0 fvec))) - (let ((a2-3 8192.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-3 quad)) - ) - (.lvf vf4 (&-> v1-5 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-2 quad) vf6) - ) - (vector-normalize-copy! s2-0 (-> s4-0 fvec) 819200.0) - (vector-copy! (-> s5-0 dest) (bombbot-method-208 this s3-0 (new 'stack-no-clear 'vector))) - (vector-copy! (-> s5-0 src) s3-0) - (set! (-> s5-0 initial-tilt) (+ 3640.889 (-> this angle-gun))) - (set! (-> s5-0 gravity) 184320.0) - (when (traj3d-calc-initial-velocity-using-tilt s5-0) - (new 'stack-no-clear 'vector) - (sound-play "bb-fire-grenade") - (process-spawn bombbot-bomb (-> s5-0 src) (-> s5-0 initial-velocity) :name "bombbot-bomb" :to this) - (let ((s4-4 (new 'stack-no-clear 'vector))) - (vector-copy! s4-4 (-> s5-0 initial-velocity)) - (vector-normalize! s4-4 -2048000.0) - (vector-inv-orient-by-quat! s4-4 s4-4 (-> this root quat)) - (apply-impact! - (-> this rigidbody) - (rigid-body-control-method-25 (-> this rigidbody) (new 'stack-no-clear 'vector)) - s4-4 - ) + (let ((s5-0 (new 'stack-no-clear 'traj3d-params))) + (matrix->trans s4-0 s3-0) + (vector+*! s3-0 s3-0 (-> s4-0 fvec) 8192.0) + (vector-normalize-copy! s2-0 (-> s4-0 fvec) 819200.0) + (vector-copy! (-> s5-0 dest) (bombbot-method-208 this s3-0 (new 'stack-no-clear 'vector))) + (vector-copy! (-> s5-0 src) s3-0) + (set! (-> s5-0 initial-tilt) (+ 3640.889 (-> this angle-gun))) + (set! (-> s5-0 gravity) 184320.0) + (when (traj3d-calc-initial-velocity-using-tilt s5-0) + (new 'stack-no-clear 'vector) + (sound-play "bb-fire-grenade") + (process-spawn bombbot-bomb (-> s5-0 src) (-> s5-0 initial-velocity) :name "bombbot-bomb" :to this) + (let ((s4-4 (new 'stack-no-clear 'vector))) + (vector-copy! s4-4 (-> s5-0 initial-velocity)) + (vector-normalize! s4-4 -2048000.0) + (vector-inv-orient-by-quat! s4-4 s4-4 (-> this root quat)) + (apply-impact! + (-> this rigidbody) + (rigid-body-control-method-25 (-> this rigidbody) (new 'stack-no-clear 'vector)) + s4-4 ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition of type bombbot-shot @@ -2350,43 +2053,20 @@ ;; definition for method 25 of type bombbot-shot ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this bombbot-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((v1-1 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (a2-1 (vector-! (new 'stack-no-clear 'vector) v1-1 a1-0)) ) - (init-vf0-vector) - (let* ((v1-1 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (a2-1 (vector-! (new 'stack-no-clear 'vector) v1-1 a1-0)) - ) - (vector-length a2-1) - (let ((a3-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 a2-1)) - (let ((t0-1 0.8)) - (.mov vf7 t0-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> a3-0 quad) vf6) - ) - (let ((f30-0 (-> *part-id-table* 2056 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 2056 init-specs 4 initial-valuef) (* 2.0 (vector-length a2-1))) - (draw-beam (-> *part-id-table* 2056) a1-0 a2-1 #f) - (set! (-> *part-id-table* 2056 init-specs 4 initial-valuef) f30-0) - ) + (vector-length a2-1) + (vector+*! (new 'stack-no-clear 'vector) a1-0 a2-1 0.8) + (let ((f30-0 (-> *part-id-table* 2056 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 2056 init-specs 4 initial-valuef) (* 2.0 (vector-length a2-1))) + (draw-beam (-> *part-id-table* 2056) a1-0 a2-1 #f) + (set! (-> *part-id-table* 2056 init-specs 4 initial-valuef) f30-0) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 26 of type bombbot-shot @@ -2494,70 +2174,47 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod bombbot-method-197 ((this bombbot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (handle->process (-> this focus handle)) - (cond - ((nonzero? (-> this gun-type)) - (when (>= (+ (current-time) (seconds -1)) (-> this next-shoot)) - (set-time! (-> this next-shoot)) - (bombbot-method-203 this) - ) + (handle->process (-> this focus handle)) + (cond + ((nonzero? (-> this gun-type)) + (when (>= (+ (current-time) (seconds -1)) (-> this next-shoot)) + (set-time! (-> this next-shoot)) + (bombbot-method-203 this) ) - (else - (when (>= (+ (current-time) (seconds -0.2)) (-> this next-shoot)) - (set-time! (-> this next-shoot)) - (handle->process (-> this focus handle)) - (let ((s5-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) - (new 'stack-no-clear 'matrix) - (new 'stack-no-clear 'vector) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (new 'stack-no-clear 'vector) - (matrix->trans s5-0 s3-0) - (let ((a1-4 s3-0)) - (let ((v1-32 s3-0)) - (let ((a0-14 (-> s5-0 fvec))) - (let ((a2-3 8192.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-14 quad)) - ) - (.lvf vf4 (&-> v1-32 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-4 quad) vf6) - ) - (vector-normalize-copy! s4-0 (-> s5-0 fvec) 819200.0) - (fire-shot this s3-0 (vector+! (new 'stack-no-clear 'vector) s3-0 s4-0)) - ) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (vector-copy! s5-1 s4-0) - (vector-normalize! s5-1 -2048000.0) - (vector-inv-orient-by-quat! s5-1 s5-1 (-> this root quat)) - (apply-impact! - (-> this rigidbody) - (rigid-body-control-method-25 (-> this rigidbody) (new 'stack-no-clear 'vector)) - s5-1 - ) + ) + (else + (when (>= (+ (current-time) (seconds -0.2)) (-> this next-shoot)) + (set-time! (-> this next-shoot)) + (handle->process (-> this focus handle)) + (let ((s5-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) + (new 'stack-no-clear 'matrix) + (new 'stack-no-clear 'vector) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (matrix->trans s5-0 s3-0) + (vector+*! s3-0 s3-0 (-> s5-0 fvec) 8192.0) + (vector-normalize-copy! s4-0 (-> s5-0 fvec) 819200.0) + (fire-shot this s3-0 (vector+! (new 'stack-no-clear 'vector) s3-0 s4-0)) + ) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (vector-copy! s5-1 s4-0) + (vector-normalize! s5-1 -2048000.0) + (vector-inv-orient-by-quat! s5-1 s5-1 (-> this root quat)) + (apply-impact! + (-> this rigidbody) + (rigid-body-control-method-25 (-> this rigidbody) (new 'stack-no-clear 'vector)) + s5-1 ) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 160 of type bombbot @@ -2663,79 +2320,61 @@ 0 ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (if (>= (+ (current-time) (seconds -13)) (-> self stop-shoot)) - (go-virtual drop-bombs) - ) - (when (< (-> self next-target) (current-time)) - (let ((a1-0 (new 'stack-no-clear 'vector))) - (vector-copy! a1-0 (-> self root trans)) - (set! (-> a1-0 w) 204800.0) - (bombbot-method-196 self a1-0) - ) - (set! (-> self next-target) (+ (current-time) (seconds 5))) - (set! (-> self gun-type) (the-as uint 0)) - 0 + (if (>= (+ (current-time) (seconds -13)) (-> self stop-shoot)) + (go-virtual drop-bombs) ) - (let ((v1-19 (the-as process-focusable (handle->process (-> self focus handle))))) - (when v1-19 - (when (< (current-time) (+ (-> self next-target) (seconds -3.5))) - (set-time! (-> self start-target)) - (vector-copy! (-> self start-target-pos) (-> v1-19 root trans)) - (vector-copy! (-> self start-target-vel) (-> v1-19 root transv)) - (vector-! (-> self target-delta) (-> v1-19 root trans) (-> self root trans)) - ) - (let ((a2-2 (-> self target-pos))) - (let ((a0-21 (-> self start-target-pos))) - (let ((a1-12 (-> self start-target-vel))) - (let ((a3-4 (* 0.0033333334 (the float (- (current-time) (-> self start-target)))))) - (.mov vf7 a3-4) - ) - (.lvf vf5 (&-> a1-12 quad)) - ) - (.lvf vf4 (&-> a0-21 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) - ) - (if (= (-> v1-19 type) target) - (vector-copy! (-> self target-pos) (-> self start-target-pos)) - ) - (if (< (+ (-> self next-target) (seconds -1)) (current-time)) - (bombbot-method-197 self) - (bombbot-method-204 self) - ) - ) + (when (< (-> self next-target) (current-time)) + (let ((a1-0 (new 'stack-no-clear 'vector))) + (vector-copy! a1-0 (-> self root trans)) + (set! (-> a1-0 w) 204800.0) + (bombbot-method-196 self a1-0) ) - (bombbot-method-205 self) - (new 'stack-no-clear 'vector) - (let ((f0-4 (* 0.25 (+ (-> self feet 0 next-position y) - (-> self feet 1 next-position y) - (-> self feet 2 next-position y) - (-> self feet 3 next-position y) - ) - ) - ) - ) - (if (!= (-> self nav state mesh) *default-nav-mesh*) - (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-4 (-> self root trans y)))) - ) - ) - (if (= (vector-length (-> self root transv)) 0.0) - (set-time! (-> self state-time)) - ) - (bombbot-method-202 self) - (bombbot-method-195 self) + (set! (-> self next-target) (+ (current-time) (seconds 5))) + (set! (-> self gun-type) (the-as uint 0)) + 0 ) + (let ((v1-19 (the-as process-focusable (handle->process (-> self focus handle))))) + (when v1-19 + (when (< (current-time) (+ (-> self next-target) (seconds -3.5))) + (set-time! (-> self start-target)) + (vector-copy! (-> self start-target-pos) (-> v1-19 root trans)) + (vector-copy! (-> self start-target-vel) (-> v1-19 root transv)) + (vector-! (-> self target-delta) (-> v1-19 root trans) (-> self root trans)) + ) + (vector+*! + (-> self target-pos) + (-> self start-target-pos) + (-> self start-target-vel) + (* 0.0033333334 (the float (- (current-time) (-> self start-target)))) + ) + (if (= (-> v1-19 type) target) + (vector-copy! (-> self target-pos) (-> self start-target-pos)) + ) + (if (< (+ (-> self next-target) (seconds -1)) (current-time)) + (bombbot-method-197 self) + (bombbot-method-204 self) + ) + ) + ) + (bombbot-method-205 self) + (new 'stack-no-clear 'vector) + (let ((f0-4 (* 0.25 (+ (-> self feet 0 next-position y) + (-> self feet 1 next-position y) + (-> self feet 2 next-position y) + (-> self feet 3 next-position y) + ) + ) + ) + ) + (if (!= (-> self nav state mesh) *default-nav-mesh*) + (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-4 (-> self root trans y)))) + ) + ) + (if (= (vector-length (-> self root transv)) 0.0) + (set-time! (-> self state-time)) + ) + (bombbot-method-202 self) + (bombbot-method-195 self) ) :code (behavior () (until #f @@ -2810,71 +2449,51 @@ (set-time! (-> self stop-shoot)) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (and (nonzero? (-> self drop-num)) (< (-> self next-target) (current-time))) - (let ((v1-5 (rnd-int-excluding-masked self 5 (the-as int (-> self drop-mask))))) - (logior! (-> self drop-mask) (ash 1 v1-5)) - (set! (-> self next-shoot) (+ (current-time) (seconds 0.8))) - (set! (-> self next-target) (+ (current-time) (seconds 1))) - (set! (-> self gun-type) (the-as uint 1)) - (let ((gp-0 (-> self target-pos))) - (let ((s5-0 (-> self root trans))) - (let ((v1-7 (vector-rotate-around-y! - (new 'stack-no-clear 'vector) - *x-vector* - (+ 16384.0 (* 3640.889 (the float (+ v1-5 -2))) (-> self drop-angle)) - ) - ) - ) - (let ((a0-15 61440.0)) - (.mov vf7 a0-15) - ) - (.lvf vf5 (&-> v1-7 quad)) - ) - (.lvf vf4 (&-> s5-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 (&-> gp-0 quad) vf6) + (when (and (nonzero? (-> self drop-num)) (< (-> self next-target) (current-time))) + (let ((v1-5 (rnd-int-excluding-masked self 5 (the-as int (-> self drop-mask))))) + (logior! (-> self drop-mask) (ash 1 v1-5)) + (set! (-> self next-shoot) (+ (current-time) (seconds 0.8))) + (set! (-> self next-target) (+ (current-time) (seconds 1))) + (set! (-> self gun-type) (the-as uint 1)) + (vector+*! + (-> self target-pos) + (-> self root trans) + (vector-rotate-around-y! + (new 'stack-no-clear 'vector) + *x-vector* + (+ 16384.0 (* 3640.889 (the float (+ v1-5 -2))) (-> self drop-angle)) ) + 61440.0 ) - (+! (-> self drop-num) -1) ) - (when (< (-> self next-shoot) (current-time)) - (set! (-> self next-shoot) (+ (current-time) (seconds 10))) - (bombbot-method-203 self) - ) - (if (>= (+ (current-time) (seconds -12)) (-> self start-target)) - (go-virtual hostile) - ) - (bombbot-method-205 self) - (new 'stack-no-clear 'vector) - (let ((f0-5 (* 0.25 (+ (-> self feet 0 next-position y) - (-> self feet 1 next-position y) - (-> self feet 2 next-position y) - (-> self feet 3 next-position y) - ) - ) - ) - ) - (if (!= (-> self nav state mesh) *default-nav-mesh*) - (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-5 (-> self root trans y)))) - ) - ) - (if (= (vector-length (-> self root transv)) 0.0) - (set-time! (-> self state-time)) - ) - (bombbot-method-202 self) - (bombbot-method-195 self) + (+! (-> self drop-num) -1) ) + (when (< (-> self next-shoot) (current-time)) + (set! (-> self next-shoot) (+ (current-time) (seconds 10))) + (bombbot-method-203 self) + ) + (if (>= (+ (current-time) (seconds -12)) (-> self start-target)) + (go-virtual hostile) + ) + (bombbot-method-205 self) + (new 'stack-no-clear 'vector) + (let ((f0-5 (* 0.25 (+ (-> self feet 0 next-position y) + (-> self feet 1 next-position y) + (-> self feet 2 next-position y) + (-> self feet 3 next-position y) + ) + ) + ) + ) + (if (!= (-> self nav state mesh) *default-nav-mesh*) + (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-5 (-> self root trans y)))) + ) + ) + (if (= (vector-length (-> self root transv)) 0.0) + (set-time! (-> self state-time)) + ) + (bombbot-method-202 self) + (bombbot-method-195 self) ) :code (behavior () (until #f @@ -3426,16 +3045,10 @@ (sv-240 vector) ) (rlet ((acc :class vf) - (vf0 :class vf) (vf1 :class vf) (vf2 :class vf) (vf3 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) ) - (init-vf0-vector) (let ((s4-0 (the-as bombbot (-> arg0 param1)))) (let ((s1-0 (new 'stack-no-clear 'vector)) (s3-0 (quaternion-copy! (new 'stack-no-clear 'quaternion) *unity-quaternion*)) @@ -3445,21 +3058,7 @@ ) (dotimes (s0-0 4) (let ((v1-3 (-> s4-0 feet s0-0))) - (let ((a1-2 s2-0)) - (let ((a0-2 s2-0)) - (let ((a2-1 (+ (the-as uint (-> s4-0 feet 0 real-position)) (* 112 s0-0)))) - (let ((a3-3 0.25)) - (.mov vf7 a3-3) - ) - (.lvf vf5 (&-> (the-as (pointer int128) a2-1))) - ) - (.lvf vf4 (&-> a0-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 (&-> a1-2 quad) vf6) - ) + (vector+*! s2-0 s2-0 (the-as vector (+ (the-as uint (-> s4-0 feet 0 real-position)) (* 112 s0-0))) 0.25) (set! (-> v1-3 main-y) (- (-> s4-0 feet s0-0 real-position y) (-> s4-0 root trans y))) (set! (-> v1-3 main-y) (-> v1-3 delta-y)) (+! f30-0 (/ (-> v1-3 main-y) 4)) @@ -3476,14 +3075,14 @@ (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)) + (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-8 quad) vf3) - (let ((a2-5 (t9-4 a0-14 a1-8 f0-8))) + (.svf (&-> a1-9 quad) vf3) + (let ((a2-5 (t9-4 a0-14 a1-9 f0-8))) (sv-176 sv-192 sv-208 a2-5) ) ) @@ -3501,20 +3100,11 @@ (+! (-> s4-0 main-pos-y) (* (-> s4-0 main-spd-y) (seconds-per-frame))) (vector-! s2-0 s2-0 (-> s4-0 root trans)) (vector-inv-orient-by-quat! s2-0 s2-0 (-> s4-0 root quat)) - (let ((a1-13 (-> s4-0 main-pos))) - (let ((v1-19 (-> s4-0 main-pos))) - (let ((a0-20 (vector-! (new 'stack-no-clear 'vector) s2-0 (-> s4-0 main-pos)))) - (let ((a2-10 (* 4.0 (seconds-per-frame)))) - (.mov vf7 a2-10) - ) - (.lvf vf5 (&-> a0-20 quad)) - ) - (.lvf vf4 (&-> v1-19 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-13 quad) vf6) + (vector+*! + (-> s4-0 main-pos) + (-> s4-0 main-pos) + (vector-! (new 'stack-no-clear 'vector) s2-0 (-> s4-0 main-pos)) + (* 4.0 (seconds-per-frame)) ) ) (quaternion-slerp! (-> s4-0 main-quat) (-> s4-0 main-quat) s3-0 0.8) @@ -4045,38 +3635,29 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod bombbot-method-196 ((this bomb-bot) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (the-as process-focusable #f))) - (let ((f30-0 (the-as float #x7f800000)) - (s4-0 (new 'stack-no-clear 'array 'collide-shape 64)) - ) - (countdown (s3-0 (fill-actor-list-for-box *actor-hash* arg0 s4-0 64)) - (let ((a0-3 (as-type (-> s4-0 s3-0) collide-shape))) - (when a0-3 - (let ((s2-1 (as-type (-> a0-3 process) process-focusable))) - (when (and (the-as process-focusable s2-1) - (and (!= this (the-as process-focusable s2-1)) - (not (focus-test? this inactive)) - (not (focus-test? this disable)) - (not (focus-test? this dead)) - (and (as-type (the-as process-focusable s2-1) bombbot) - (the-as process-focusable s2-1) - (not (logtest? (-> (the-as process-focusable s2-1) focus-status) (focus-status disable dead ignore grabbed))) - ) - ) - ) - (let ((f0-0 (vector-vector-xz-distance (-> this root trans) (-> (the-as process-focusable s2-1) root trans)))) - (when (or (not gp-0) (< f0-0 f30-0)) - (set! gp-0 (the-as process-focusable s2-1)) - (set! f30-0 f0-0) - ) + (let ((gp-0 (the-as process-focusable #f))) + (let ((f30-0 (the-as float #x7f800000)) + (s4-0 (new 'stack-no-clear 'array 'collide-shape 64)) + ) + (countdown (s3-0 (fill-actor-list-for-box *actor-hash* arg0 s4-0 64)) + (let ((a0-3 (as-type (-> s4-0 s3-0) collide-shape))) + (when a0-3 + (let ((s2-1 (as-type (-> a0-3 process) process-focusable))) + (when (and (the-as process-focusable s2-1) + (and (!= this (the-as process-focusable s2-1)) + (not (focus-test? this inactive)) + (not (focus-test? this disable)) + (not (focus-test? this dead)) + (and (as-type (the-as process-focusable s2-1) bombbot) + (the-as process-focusable s2-1) + (not (logtest? (-> (the-as process-focusable s2-1) focus-status) (focus-status disable dead ignore grabbed))) + ) + ) + ) + (let ((f0-0 (vector-vector-xz-distance (-> this root trans) (-> (the-as process-focusable s2-1) root trans)))) + (when (or (not gp-0) (< f0-0 f30-0)) + (set! gp-0 (the-as process-focusable s2-1)) + (set! f30-0 f0-0) ) ) ) @@ -4084,36 +3665,22 @@ ) ) ) - (cond - (gp-0 - (vector-copy! (-> this target-pos) (get-trans gp-0 3)) - (let ((v1-25 (-> this target-pos))) - (let ((a0-12 (-> gp-0 root trans))) - (let ((a1-7 (-> gp-0 root transv))) - (let ((a2-1 0.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-7 quad)) - ) - (.lvf vf4 (&-> a0-12 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-25 quad) vf6) - ) - (vector-copy! (-> this start-target-pos) (-> this target-pos)) - (vector-copy! (-> this start-target-vel) (-> gp-0 root transv)) - (focus-on! (-> this focus) gp-0 this) - ) - (else - (clear-focused (-> this focus)) - ) + ) + (cond + (gp-0 + (vector-copy! (-> this target-pos) (get-trans gp-0 3)) + (vector+*! (-> this target-pos) (-> gp-0 root trans) (-> gp-0 root transv) 0.0) + (vector-copy! (-> this start-target-pos) (-> this target-pos)) + (vector-copy! (-> this start-target-vel) (-> gp-0 root transv)) + (focus-on! (-> this focus) gp-0 this) + ) + (else + (clear-focused (-> this focus)) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 122 of type bomb-bot @@ -4126,74 +3693,56 @@ (defstate hostile (bomb-bot) :virtual #t :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (< (-> self next-target) (current-time)) - (let ((a1-0 (new 'stack-no-clear 'vector))) - (vector-copy! a1-0 (-> self root trans)) - (set! (-> a1-0 w) 409600.0) - (bombbot-method-196 self a1-0) - ) - (set! (-> self next-target) (+ (current-time) (seconds 4))) - (set! (-> self gun-type) (the-as uint 0)) - 0 + (when (< (-> self next-target) (current-time)) + (let ((a1-0 (new 'stack-no-clear 'vector))) + (vector-copy! a1-0 (-> self root trans)) + (set! (-> a1-0 w) 409600.0) + (bombbot-method-196 self a1-0) ) - (let ((gp-0 (the-as process-focusable (handle->process (-> self focus handle))))) - (when gp-0 - (when (< (current-time) (+ (-> self next-target) (seconds -2))) - (set-time! (-> self start-target)) - (vector-copy! (-> self start-target-pos) (get-trans gp-0 3)) - (vector-copy! (-> self start-target-vel) (-> gp-0 root transv)) - (vector-! (-> self target-delta) (-> gp-0 root trans) (-> self root trans)) - ) - (let ((a1-5 (-> self target-pos))) - (let ((v1-26 (-> self start-target-pos))) - (let ((a0-17 (-> self start-target-vel))) - (let ((a2-4 (* 0.0033333334 (the float (- (current-time) (-> self start-target)))))) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a0-17 quad)) - ) - (.lvf vf4 (&-> v1-26 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-5 quad) vf6) - ) - (vector-copy! (-> self target-pos) (-> self start-target-pos)) - (if (< (+ (-> self next-target) (seconds -1)) (current-time)) - (bombbot-method-197 self) - (bombbot-method-204 self) - ) - ) - ) - (bombbot-method-205 self) - (new 'stack-no-clear 'vector) - (let ((f0-4 (* 0.25 (+ (-> self feet 0 next-position y) - (-> self feet 1 next-position y) - (-> self feet 2 next-position y) - (-> self feet 3 next-position y) - ) - ) - ) - ) - (if (!= (-> self nav state mesh) *default-nav-mesh*) - (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-4 (-> self root trans y)))) - ) - ) - (if (= (vector-length (-> self root transv)) 0.0) - (set-time! (-> self state-time)) - ) - (bombbot-method-202 self) - (bombbot-method-195 self) + (set! (-> self next-target) (+ (current-time) (seconds 4))) + (set! (-> self gun-type) (the-as uint 0)) + 0 ) + (let ((gp-0 (the-as process-focusable (handle->process (-> self focus handle))))) + (when gp-0 + (when (< (current-time) (+ (-> self next-target) (seconds -2))) + (set-time! (-> self start-target)) + (vector-copy! (-> self start-target-pos) (get-trans gp-0 3)) + (vector-copy! (-> self start-target-vel) (-> gp-0 root transv)) + (vector-! (-> self target-delta) (-> gp-0 root trans) (-> self root trans)) + ) + (vector+*! + (-> self target-pos) + (-> self start-target-pos) + (-> self start-target-vel) + (* 0.0033333334 (the float (- (current-time) (-> self start-target)))) + ) + (vector-copy! (-> self target-pos) (-> self start-target-pos)) + (if (< (+ (-> self next-target) (seconds -1)) (current-time)) + (bombbot-method-197 self) + (bombbot-method-204 self) + ) + ) + ) + (bombbot-method-205 self) + (new 'stack-no-clear 'vector) + (let ((f0-4 (* 0.25 (+ (-> self feet 0 next-position y) + (-> self feet 1 next-position y) + (-> self feet 2 next-position y) + (-> self feet 3 next-position y) + ) + ) + ) + ) + (if (!= (-> self nav state mesh) *default-nav-mesh*) + (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-4 (-> self root trans y)))) + ) + ) + (if (= (vector-length (-> self root transv)) 0.0) + (set-time! (-> self state-time)) + ) + (bombbot-method-202 self) + (bombbot-method-195 self) ) :post (behavior () (cond @@ -4379,53 +3928,17 @@ ;; definition for method 21 of type bombbot-player (defmethod get-trans ((this bombbot-player) (arg0 int)) "Get the `trans` for this process." - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (cond - ((= arg0 4) - (let ((gp-0 (new 'static 'vector))) - (let ((v1-2 (-> this root trans))) - (let ((a0-1 *y-vector*)) - (let ((a1-2 12288.0)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-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 (&-> gp-0 quad) vf6) - (let ((s4-0 gp-0)) - (let ((s5-0 gp-0)) - (let ((v1-3 (-> (camera-matrix) rvec))) - (let ((a0-2 0.0)) - (.mov vf7 a0-2) - ) - (.lvf vf5 (&-> v1-3 quad)) - ) - (.lvf vf4 (&-> s5-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 (&-> s4-0 quad) vf6) - ) - gp-0 - ) - ) - (else - ((method-of-type nav-enemy get-trans) this arg0) - ) + (local-vars (gp-1 vector)) + (cond + ((= arg0 4) + (set! gp-1 (vector+*! (new 'static 'vector) (-> this root trans) *y-vector* 12288.0)) + (vector+*! gp-1 gp-1 (-> (camera-matrix) rvec) 0.0) + ) + (else + (set! gp-1 ((method-of-type nav-enemy get-trans) this arg0)) ) ) + gp-1 ) ;; definition for method 196 of type bombbot-player @@ -4442,173 +3955,127 @@ (sv-888 vector) (sv-896 int) ) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (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) - (let ((s5-1 sv-876)) - (let ((v1-8 (camera-pos))) - (let ((a0-2 sv-888)) - (let ((a1-3 40960.0)) - (.mov vf7 a1-3) - ) - (.lvf vf5 (&-> a0-2 quad)) + (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) ) - (.lvf vf4 (&-> v1-8 quad)) + (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) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> s5-1 quad) vf6) - ) - (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) - ) - ) - (set! sv-896 (fill-actor-list-for-sphere *actor-hash* sv-876 sv-872 40960.0 sv-884 64 -1)) - (countdown (s5-3 sv-896) - (let ((a0-19 (as-type (-> sv-884 s5-3) 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) - ) + ) + (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)) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 197 of type bombbot-player ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod bombbot-method-197 ((this bombbot-player)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (handle->process (-> this focus handle)) - (let ((s5-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) - (new 'stack-no-clear 'matrix) - (new 'stack-no-clear 'vector) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (new 'stack-no-clear 'vector) - (matrix->trans s5-0 s3-0) - (let ((a1-3 s3-0)) - (let ((v1-12 s3-0)) - (let ((a0-7 (-> s5-0 fvec))) - (let ((a2-3 8192.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-7 quad)) - ) - (.lvf vf4 (&-> v1-12 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-3 quad) vf6) - ) - (vector-normalize-copy! s4-0 (-> s5-0 fvec) 614400.0) - (spawn-bombbot-projectile - this - s3-0 - (vector+! (new 'stack-no-clear 'vector) s3-0 s4-0) - 819200.0 - (the-as vector #f) - 3.0 - ) - (launch-particles (-> *part-id-table* 2055) s3-0) + (handle->process (-> this focus handle)) + (let ((s5-0 (matrix-copy! (new 'stack-no-clear 'matrix) (-> this node-list data 6 bone transform)))) + (new 'stack-no-clear 'matrix) + (new 'stack-no-clear 'vector) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (matrix->trans s5-0 s3-0) + (vector+*! s3-0 s3-0 (-> s5-0 fvec) 8192.0) + (vector-normalize-copy! s4-0 (-> s5-0 fvec) 614400.0) + (spawn-bombbot-projectile + this + s3-0 + (vector+! (new 'stack-no-clear 'vector) s3-0 s4-0) + 819200.0 + (the-as vector #f) + 3.0 ) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (vector-copy! s5-1 s4-0) - (vector-normalize! s5-1 -2048000.0) - (vector-inv-orient-by-quat! s5-1 s5-1 (-> this root quat)) - (apply-impact! - (-> this rigidbody) - (rigid-body-control-method-25 (-> this rigidbody) (new 'stack-no-clear 'vector)) - s5-1 - ) + (launch-particles (-> *part-id-table* 2055) s3-0) + ) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (vector-copy! s5-1 s4-0) + (vector-normalize! s5-1 -2048000.0) + (vector-inv-orient-by-quat! s5-1 s5-1 (-> this root quat)) + (apply-impact! + (-> this rigidbody) + (rigid-body-control-method-25 (-> this rigidbody) (new 'stack-no-clear 'vector)) + s5-1 ) ) ) - 0 - (none) ) + 0 + (none) ) ;; failed to figure out what this is: @@ -4641,93 +4108,70 @@ (sound-stop (-> self cannon-sound)) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((f0-1 (the float (+ (-> *cpad-list* cpads 0 righty) -128)))) - (when (< 32.0 (fabs f0-1)) - (set! (-> self camera-x-angle) (- (-> self camera-x-angle) (* 0.3 (seconds-per-frame) f0-1))) - (if (< 25.0 (-> self camera-x-angle)) - (set! (-> self camera-x-angle) 25.0) - ) - (if (< (-> self camera-x-angle) -4.0) - (set! (-> self camera-x-angle) -4.0) - ) - ) - ) - (let ((f30-0 (* 182.04445 (-> self camera-x-angle)))) - (set-setting! 'string-min-height 'abs (+ -4096.0 (* 61440.0 (sin f30-0))) 0) - (set-setting! 'string-max-height 'abs (+ 4096.0 (* 61440.0 (sin f30-0))) 0) - (set-setting! 'string-min-length 'abs (+ -4096.0 (* 61440.0 (cos f30-0))) 0) - (set-setting! 'string-max-length 'abs (+ 4096.0 (* 61440.0 (cos f30-0))) 0) - (set-setting! 'slave-options 'set 0.0 (cam-slave-options BOMBBOT)) - (if *camera* - (vector-normalize! (-> *camera* slave 0 view-flat) (+ 4096.0 (* 61440.0 (cos f30-0)))) + (let ((f0-1 (the float (+ (-> *cpad-list* cpads 0 righty) -128)))) + (when (< 32.0 (fabs f0-1)) + (set! (-> self camera-x-angle) (- (-> self camera-x-angle) (* 0.3 (seconds-per-frame) f0-1))) + (if (< 25.0 (-> self camera-x-angle)) + (set! (-> self camera-x-angle) 25.0) + ) + (if (< (-> self camera-x-angle) -4.0) + (set! (-> self camera-x-angle) -4.0) ) ) - (set-setting! 'immediate-string-min-max #f 0.0 0) - (let* ((v1-45 *game-info*) - (a0-13 (+ (-> v1-45 attack-id) 1)) - ) - (set! (-> v1-45 attack-id) a0-13) - (set! (-> self attack-id) a0-13) - ) - (let ((s5-5 (-> self target-pos))) - (let ((gp-5 (camera-pos))) - (let ((v1-46 (-> (camera-matrix) fvec))) - (let ((a0-15 204800.0)) - (.mov vf7 a0-15) - ) - (.lvf vf5 (&-> v1-46 quad)) - ) - (.lvf vf4 (&-> gp-5 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 (&-> s5-5 quad) vf6) - ) - (let ((a1-7 (new 'stack-no-clear 'vector))) - (vector-copy! a1-7 (-> self root trans)) - (set! (-> a1-7 w) 204800.0) - (bombbot-method-196 self a1-7) - ) - (set! (-> self next-target) (+ (current-time) (seconds 2))) - (set-time! (-> self start-target)) - (cond - ((and (-> self hold-fire) (>= (+ (current-time) (seconds -0.3)) (-> self hold-fire-time))) - (+! (-> self extra-angle-gun) (* -8192.0 (seconds-per-frame))) - (if (< (-> self extra-angle-gun) -3640.889) - (set! (-> self extra-angle-gun) -3640.889) - ) - ) - (else - (+! (-> self extra-angle-gun) (* 18204.445 (seconds-per-frame))) - (if (< 0.0 (-> self extra-angle-gun)) - (set! (-> self extra-angle-gun) 0.0) - ) - (bombbot-method-204 self) - ) - ) - (when (handle->process (-> self focus handle)) - ) - (when (and (cpad-pressed? 0 r1) (>= (+ (current-time) (seconds -0.02)) (-> self next-shoot))) - (set-time! (-> self next-shoot)) - (bombbot-method-197 self) - ) - (bombbot-method-205 self) - (if (= (vector-length (-> self root transv)) 0.0) - (set-time! (-> self state-time)) - ) - (bombbot-method-202 self) - (bombbot-method-195 self) - (send-event *camera* 'change-target self) ) + (let ((f30-0 (* 182.04445 (-> self camera-x-angle)))) + (set-setting! 'string-min-height 'abs (+ -4096.0 (* 61440.0 (sin f30-0))) 0) + (set-setting! 'string-max-height 'abs (+ 4096.0 (* 61440.0 (sin f30-0))) 0) + (set-setting! 'string-min-length 'abs (+ -4096.0 (* 61440.0 (cos f30-0))) 0) + (set-setting! 'string-max-length 'abs (+ 4096.0 (* 61440.0 (cos f30-0))) 0) + (set-setting! 'slave-options 'set 0.0 (cam-slave-options BOMBBOT)) + (if *camera* + (vector-normalize! (-> *camera* slave 0 view-flat) (+ 4096.0 (* 61440.0 (cos f30-0)))) + ) + ) + (set-setting! 'immediate-string-min-max #f 0.0 0) + (let* ((v1-45 *game-info*) + (a0-13 (+ (-> v1-45 attack-id) 1)) + ) + (set! (-> v1-45 attack-id) a0-13) + (set! (-> self attack-id) a0-13) + ) + (vector+*! (-> self target-pos) (camera-pos) (-> (camera-matrix) fvec) 204800.0) + (let ((a1-7 (new 'stack-no-clear 'vector))) + (vector-copy! a1-7 (-> self root trans)) + (set! (-> a1-7 w) 204800.0) + (bombbot-method-196 self a1-7) + ) + (set! (-> self next-target) (+ (current-time) (seconds 2))) + (set-time! (-> self start-target)) + (cond + ((and (-> self hold-fire) (>= (+ (current-time) (seconds -0.3)) (-> self hold-fire-time))) + (+! (-> self extra-angle-gun) (* -8192.0 (seconds-per-frame))) + (if (< (-> self extra-angle-gun) -3640.889) + (set! (-> self extra-angle-gun) -3640.889) + ) + ) + (else + (+! (-> self extra-angle-gun) (* 18204.445 (seconds-per-frame))) + (if (< 0.0 (-> self extra-angle-gun)) + (set! (-> self extra-angle-gun) 0.0) + ) + (bombbot-method-204 self) + ) + ) + (when (handle->process (-> self focus handle)) + ) + (when (and (cpad-pressed? 0 r1) (>= (+ (current-time) (seconds -0.02)) (-> self next-shoot))) + (set-time! (-> self next-shoot)) + (bombbot-method-197 self) + ) + (bombbot-method-205 self) + (if (= (vector-length (-> self root transv)) 0.0) + (set-time! (-> self state-time)) + ) + (bombbot-method-202 self) + (bombbot-method-195 self) + (send-event *camera* 'change-target self) ) :code (behavior () (local-vars (v1-1 object)) @@ -4747,70 +4191,47 @@ #f ) :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (new 'stack-no-clear 'vector) - (-> self root) - (cond - ((= (-> self nav state mesh) *default-nav-mesh*) - (enemy-common-post self) - (update-transforms (-> self root)) - ) - (else - (-> *math-camera* inv-camera-rot) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (vector-copy! gp-0 (-> *math-camera* inv-camera-rot fvec)) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (set! (-> gp-0 y) 0.0) - (vector-normalize! gp-0 1.0) - (vector-rotate90-around-y! s4-0 gp-0) - (vector-cross! gp-0 (-> self root gspot-normal) s4-0) + (new 'stack-no-clear 'vector) + (-> self root) + (cond + ((= (-> self nav state mesh) *default-nav-mesh*) + (enemy-common-post self) + (update-transforms (-> self root)) + ) + (else + (-> *math-camera* inv-camera-rot) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-copy! gp-0 (-> *math-camera* inv-camera-rot fvec)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 y) 0.0) + (vector-normalize! gp-0 1.0) + (vector-rotate90-around-y! s4-0 gp-0) + (vector-cross! gp-0 (-> self root gspot-normal) s4-0) + ) + (vector-rotate-around-y! gp-0 gp-0 (-> *cpad-list* cpads 0 stick0-dir)) + (vector+*! s5-0 (-> self root trans) gp-0 (* 12288.0 (-> *cpad-list* cpads 0 stick0-speed))) + (set! (-> self root transv y) 0.0) + (when (< 0.4 (-> *cpad-list* cpads 0 stick0-speed)) + (let ((v1-25 (-> self nav state))) + (logclear! (-> v1-25 flags) (nav-state-flag directional-mode)) + (logior! (-> v1-25 flags) (nav-state-flag target-poly-dirty)) + (vector-copy! (-> v1-25 target-pos) s5-0) ) - (vector-rotate-around-y! gp-0 gp-0 (-> *cpad-list* cpads 0 stick0-dir)) - (let ((v1-17 s5-0)) - (let ((a0-10 (-> self root trans))) - (let ((a1-3 gp-0)) - (let ((a2-4 (* 12288.0 (-> *cpad-list* cpads 0 stick0-speed)))) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> a0-10 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-17 quad) vf6) - ) - (set! (-> self root transv y) 0.0) - (when (< 0.4 (-> *cpad-list* cpads 0 stick0-speed)) - (let ((v1-24 (-> self nav state))) - (logclear! (-> v1-24 flags) (nav-state-flag directional-mode)) - (logior! (-> v1-24 flags) (nav-state-flag target-poly-dirty)) - (vector-copy! (-> v1-24 target-pos) s5-0) - ) - 0 - (when *target* - (quaternion-look-at! (-> *target* control dir-targ) gp-0 *up-vector*) - (quaternion-look-at! (-> *target* control quat) gp-0 *up-vector*) - ) + 0 + (when *target* + (quaternion-look-at! (-> *target* control dir-targ) gp-0 *up-vector*) + (quaternion-look-at! (-> *target* control quat) gp-0 *up-vector*) ) ) ) - (let ((v1-34 (-> self nav))) - (set! (-> v1-34 target-speed) (* 49152.0 (-> *cpad-list* cpads 0 stick0-speed))) - ) - 0 - (nav-enemy-method-187 self) ) + (let ((v1-35 (-> self nav))) + (set! (-> v1-35 target-speed) (* 49152.0 (-> *cpad-list* cpads 0 stick0-speed))) + ) + 0 + (nav-enemy-method-187 self) ) ) ) @@ -4855,69 +4276,43 @@ ;; definition for function bombbot-player-init-by-other ;; INFO: Used lq/sq (defbehavior bombbot-player-init-by-other bombbot-player ((arg0 bombbot-spawn-params)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (stack-size-set! (-> self main-thread) 512) - (set! (-> self city-path) (-> arg0 path)) - (set! (-> self current-node) (the-as uint 0)) - (init-enemy-collision! self) - (vector-copy! (-> self root trans) (-> arg0 position)) - (quaternion-copy! (-> self root quat) (-> arg0 quat)) - (vector-identity! (-> self root scale)) - (-> arg0 nav-mesh) - (set! (-> *bombbot-nav-enemy-info* nav-mesh) *default-nav-mesh*) - (init-enemy! self) - (set! (-> self gun-rotation-speed) 7281.778) - (set! (-> self shot-count) (the-as uint 5)) - (vector-copy! (-> self last-trans) (-> self root trans)) - (set! (-> self minimap) #f) - (logior! (-> self mask) (process-mask enemy guard)) - (send-event *camera* 'change-target self) - (let ((a1-3 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-3 from) (process->ppointer self)) - (set! (-> a1-3 num-params) 1) - (set! (-> a1-3 message) 'teleport-to-vector-start-string) - (let ((v1-25 (new 'stack-no-clear 'vector))) - (let ((a0-16 (-> arg0 position))) - (let ((a2-0 *z-vector*)) - (let ((a3-1 40960.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> a0-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 (&-> v1-25 quad) vf6) - (set! (-> a1-3 param 0) (the-as uint v1-25)) - ) - (send-event-function *camera* a1-3) - ) - (set! (-> self shoot-duration) 1.0) - (set! (-> self hold-fire) #f) - (set! (-> self draw light-index) (the-as uint 10)) - (set! (-> self max-hit-points) (the float (+ (* 50 (the int (you-suck-scale *game-info* #f 0))) 50))) - (set! (-> self hit-points) (-> self max-hit-points)) - (set! (-> self health-hud) - (ppointer->handle (process-spawn bombbot-hud :init hud-init-by-other :name "bombbot-hud" :to self)) - ) - (set! (-> self mission-squad) *cty-attack-controller*) - (when (-> self mission-squad) - (set! (-> self attacker-info) (allocate-attacker (-> self mission-squad))) - (init! (-> self attacker-info) self 13) - (set! (-> self attacker-info max-num-attackers) (the-as uint 16)) - (logior! (-> self attacker-info flags) (city-attacker-info-flag cai1 cai4)) - ) - (go-virtual hostile) + (stack-size-set! (-> self main-thread) 512) + (set! (-> self city-path) (-> arg0 path)) + (set! (-> self current-node) (the-as uint 0)) + (init-enemy-collision! self) + (vector-copy! (-> self root trans) (-> arg0 position)) + (quaternion-copy! (-> self root quat) (-> arg0 quat)) + (vector-identity! (-> self root scale)) + (-> arg0 nav-mesh) + (set! (-> *bombbot-nav-enemy-info* nav-mesh) *default-nav-mesh*) + (init-enemy! self) + (set! (-> self gun-rotation-speed) 7281.778) + (set! (-> self shot-count) (the-as uint 5)) + (vector-copy! (-> self last-trans) (-> self root trans)) + (set! (-> self minimap) #f) + (logior! (-> self mask) (process-mask enemy guard)) + (send-event *camera* 'change-target self) + (send-event + *camera* + 'teleport-to-vector-start-string + (vector+*! (new 'stack-no-clear 'vector) (-> arg0 position) *z-vector* 40960.0) ) + (set! (-> self shoot-duration) 1.0) + (set! (-> self hold-fire) #f) + (set! (-> self draw light-index) (the-as uint 10)) + (set! (-> self max-hit-points) (the float (+ (* 50 (the int (you-suck-scale *game-info* #f 0))) 50))) + (set! (-> self hit-points) (-> self max-hit-points)) + (set! (-> self health-hud) + (ppointer->handle (process-spawn bombbot-hud :init hud-init-by-other :name "bombbot-hud" :to self)) + ) + (set! (-> self mission-squad) *cty-attack-controller*) + (when (-> self mission-squad) + (set! (-> self attacker-info) (allocate-attacker (-> self mission-squad))) + (init! (-> self attacker-info) self 13) + (set! (-> self attacker-info max-num-attackers) (the-as uint 16)) + (logior! (-> self attacker-info flags) (city-attacker-info-flag cai1 cai4)) + ) + (go-virtual hostile) ) ;; definition of type task-manager-blow-barricade 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 f5d89fcd40..8b937065f2 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 @@ -504,74 +504,51 @@ ;; INFO: Used lq/sq (defmethod crimson-guard-method-254 ((this crimson-guard)) (local-vars (sv-112 vector) (sv-128 vector) (sv-144 int)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (handle->process (-> this focus handle)) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 (-> this move-position)) - (when (< 8192000.0 (-> this target-self-xz-dist)) - (let ((s3-0 (-> this root trans)) - (s2-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)) - ) - (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)) + (handle->process (-> this focus handle)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 (-> this move-position)) + (when (< 8192000.0 (-> this target-self-xz-dist)) + (let ((s3-0 (-> this root trans)) + (s2-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)) ) - (set! (-> sv-128 w) 1.0) - (let ((a1-2 s1-0)) - (let ((v1-21 s1-0)) - (let ((a0-13 s0-0)) - (let ((a2-1 12288.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-13 quad)) - ) - (.lvf vf4 (&-> v1-21 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-2 quad) vf6) - ) - (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)) - ) - (do-spline s4-0 s3-0 s2-0 s1-0 s0-0 0.9) - (vector-copy! s4-0 s5-0) + (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)) ) - ) - (let ((v1-39 (-> this nav state))) - (logclear! (-> v1-39 flags) (nav-state-flag directional-mode)) - (logior! (-> v1-39 flags) (nav-state-flag target-poly-dirty)) - (vector-copy! (-> v1-39 target-pos) s5-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)) + ) + (do-spline s4-0 s3-0 s2-0 s1-0 s0-0 0.9) + (vector-copy! s4-0 s5-0) ) ) - 0 - (nav-enemy-method-187 this) - (none) + (let ((v1-39 (-> this nav state))) + (logclear! (-> v1-39 flags) (nav-state-flag directional-mode)) + (logior! (-> v1-39 flags) (nav-state-flag target-poly-dirty)) + (vector-copy! (-> v1-39 target-pos) s5-0) + ) ) + 0 + (nav-enemy-method-187 this) + (none) ) ;; failed to figure out what this is: @@ -1065,60 +1042,39 @@ ) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (not (-> self already-shot)) - (crimson-guard-method-265 self 1.0) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (vector-copy! gp-0 (-> self root trans)) - (let ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) - (s5-0 (new 'stack 'collide-query)) - ) - (let ((a0-3 gp-0)) - (let ((v1-8 gp-0)) - (let ((a1-4 20480.0)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> s4-0 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-3 quad) vf6) + (when (not (-> self already-shot)) + (crimson-guard-method-265 self 1.0) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-copy! gp-0 (-> self root trans)) + (let ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) + (s5-0 (new 'stack 'collide-query)) + ) + (vector+*! gp-0 gp-0 s4-0 20480.0) + (if (enemy-above-ground? self s5-0 gp-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (set! (-> gp-0 y) (-> s5-0 best-other-tri intersect y)) ) - (if (enemy-above-ground? self s5-0 gp-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) - (set! (-> gp-0 y) (-> s5-0 best-other-tri intersect y)) - ) - ) ) - (when (!= (crimson-guard-method-266 self (-> self event-param-point)) 0.0) - (let* ((v1-16 (-> self nav)) - (a1-7 (-> self event-param-point)) - (f0-3 (-> v1-16 extra-nav-sphere w)) - ) - (vector-copy! (-> v1-16 extra-nav-sphere) a1-7) - (set! (-> v1-16 extra-nav-sphere w) f0-3) - ) - 0 - (let ((v1-19 (-> self nav))) - (set! (-> v1-19 extra-nav-sphere w) (-> self nav-radius-backup)) - ) - 0 - (let ((v1-21 (-> self nav))) - (logior! (-> v1-21 shape nav-flags) (nav-flags has-extra-sphere)) - ) - 0 - (set! (-> self already-shot) #t) - ) - (crimson-guard-method-265 self 0.0) ) + (when (!= (crimson-guard-method-266 self (-> self event-param-point)) 0.0) + (let* ((v1-16 (-> self nav)) + (a1-6 (-> self event-param-point)) + (f0-3 (-> v1-16 extra-nav-sphere w)) + ) + (vector-copy! (-> v1-16 extra-nav-sphere) a1-6) + (set! (-> v1-16 extra-nav-sphere w) f0-3) + ) + 0 + (let ((v1-19 (-> self nav))) + (set! (-> v1-19 extra-nav-sphere w) (-> self nav-radius-backup)) + ) + 0 + (let ((v1-21 (-> self nav))) + (logior! (-> v1-21 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (set! (-> self already-shot) #t) + ) + (crimson-guard-method-265 self 0.0) ) ) :code (behavior () 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 6d768cc264..e9cf36b9e5 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 @@ -5,149 +5,84 @@ ;; 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)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 arg1) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (vector-copy! s4-0 arg2) - (let ((s3-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'quaternion)) - ) - (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) - (while (< sv-640 6) - (let ((v1-6 s0-0)) - (set! (-> v1-6 radius) 2867.2) - (set! (-> v1-6 collide-with) - (collide-spec jak bot civilian enemy vehicle-sphere hit-by-others-list player-list) - ) - (set! (-> v1-6 ignore-process0) #f) - (set! (-> v1-6 ignore-process1) #f) - (set! (-> v1-6 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-6 action-mask) (collide-action solid)) - ) - (vector-copy! (-> s0-0 start-pos) s5-0) - (vector-copy! (-> s0-0 move-dist) s4-0) - (set-from-point-offset-pad! (-> s0-0 bbox) (-> s0-0 start-pos) (-> s0-0 move-dist) (-> s0-0 radius)) - (fill-using-bounding-box *collide-cache* s0-0) - (set! (-> s0-0 radius) 409.6) - (let ((f0-4 (probe-using-line-sphere *collide-cache* s0-0))) - (cond - ((>= f0-4 0.0) - (let ((a1-4 s3-0)) - (let ((v1-13 (-> s0-0 start-pos))) - (let ((a0-12 (-> s0-0 move-dist))) - (let ((a2-2 f0-4)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-12 quad)) - ) - (.lvf vf4 (&-> v1-13 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-4 quad) vf6) - ) - (vector-copy! s5-0 s3-0) - ) - (else - (vector+! (-> s0-0 start-pos) s5-0 s4-0) - (let ((a1-7 (-> s0-0 start-pos))) - (let ((v1-16 (-> s0-0 start-pos))) - (let ((a0-16 s1-0)) - (let ((a2-4 -2048.0)) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a0-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 (&-> a1-7 quad) vf6) - ) - (vector-negate! (-> s0-0 move-dist) s4-0) - (set! f0-4 (probe-using-line-sphere *collide-cache* s0-0)) - (when (>= f0-4 0.0) - (let ((a1-10 s3-0)) - (let ((v1-19 (-> s0-0 start-pos))) - (let ((a0-19 (-> s0-0 move-dist))) - (let ((a2-5 f0-4)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-19 quad)) - ) - (.lvf vf4 (&-> v1-19 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-10 quad) vf6) - ) - (let ((a1-11 s3-0)) - (let ((v1-20 s3-0)) - (let ((a0-20 s1-0)) - (let ((a2-7 2048.0)) - (.mov vf7 a2-7) - ) - (.lvf vf5 (&-> a0-20 quad)) - ) - (.lvf vf4 (&-> v1-20 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-11 quad) vf6) - ) - (vector-copy! s5-0 s3-0) - ) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 arg1) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-copy! s4-0 arg2) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'quaternion)) + ) + (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) + (while (< sv-640 6) + (let ((v1-6 s0-0)) + (set! (-> v1-6 radius) 2867.2) + (set! (-> v1-6 collide-with) + (collide-spec jak bot civilian enemy vehicle-sphere hit-by-others-list player-list) ) - ) - (cond - ((>= f0-4 0.0) - (+! (-> s3-0 x) (rand-vu-float-range -819.2 819.2)) - (+! (-> s3-0 y) (rand-vu-float-range -819.2 819.2)) - (+! (-> 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) - ) - (else - (vector+! s5-0 s5-0 s4-0) - (when (< sv-640 6) - (set-point! arg0 (-> arg0 state points-to-draw) s5-0) - (+! (-> arg0 state points-to-draw) 1) - ) + (set! (-> v1-6 ignore-process0) #f) + (set! (-> v1-6 ignore-process1) #f) + (set! (-> v1-6 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - ) - ) - (set! sv-640 (+ sv-640 1)) + (set! (-> v1-6 action-mask) (collide-action solid)) ) + (vector-copy! (-> s0-0 start-pos) s5-0) + (vector-copy! (-> s0-0 move-dist) s4-0) + (set-from-point-offset-pad! (-> s0-0 bbox) (-> s0-0 start-pos) (-> s0-0 move-dist) (-> s0-0 radius)) + (fill-using-bounding-box *collide-cache* s0-0) + (set! (-> s0-0 radius) 409.6) + (let ((f0-4 (probe-using-line-sphere *collide-cache* s0-0))) + (cond + ((>= f0-4 0.0) + (vector+*! s3-0 (-> s0-0 start-pos) (-> s0-0 move-dist) f0-4) + (vector-copy! s5-0 s3-0) + ) + (else + (vector+! (-> s0-0 start-pos) s5-0 s4-0) + (vector+*! (-> s0-0 start-pos) (-> s0-0 start-pos) s1-0 -2048.0) + (vector-negate! (-> s0-0 move-dist) s4-0) + (set! f0-4 (probe-using-line-sphere *collide-cache* s0-0)) + (when (>= f0-4 0.0) + (vector+*! s3-0 (-> s0-0 start-pos) (-> s0-0 move-dist) f0-4) + (vector+*! s3-0 s3-0 s1-0 2048.0) + (vector-copy! s5-0 s3-0) + ) + ) + ) + (cond + ((>= f0-4 0.0) + (+! (-> s3-0 x) (rand-vu-float-range -819.2 819.2)) + (+! (-> s3-0 y) (rand-vu-float-range -819.2 819.2)) + (+! (-> 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) + ) + (else + (vector+! s5-0 s5-0 s4-0) + (when (< sv-640 6) + (set-point! arg0 (-> arg0 state points-to-draw) s5-0) + (+! (-> arg0 state points-to-draw) 1) + ) + ) + ) + ) + (set! sv-640 (+ sv-640 1)) ) ) ) ) ) - #f ) + #f ) ;; definition for method 263 of type crimson-guard @@ -155,165 +90,144 @@ ;; WARN: Return type mismatch object vs none. (defmethod crimson-guard-method-263 ((this crimson-guard)) (local-vars (sv-832 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (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)) + (s1-0 + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> this target-pos-predict-miss) s4-0) 16384.0) + ) + (s5-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'collide-query)) ) - (init-vf0-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)) - (s1-0 - (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> this target-pos-predict-miss) s4-0) 16384.0) + (when (< 1820.4445 (vector-vector-angle-safe s2-0 s1-0)) + (let* ((a1-9 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) s2-0 s1-0) 1.0)) + (a2-1 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-9 1820.4445)) ) - (s5-0 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'collide-query)) - ) - (when (< 1820.4445 (vector-vector-angle-safe s2-0 s1-0)) - (let* ((a1-9 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) s2-0 s1-0) 1.0)) - (a2-1 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-9 1820.4445)) - ) - (vector-orient-by-quat! s1-0 s2-0 a2-1) - ) + (vector-orient-by-quat! s1-0 s2-0 a2-1) ) - (let ((a0-12 s4-0)) - (let ((v1-8 s4-0)) - (let ((a1-12 0.2)) - (.mov vf7 a1-12) + ) + (vector+*! s4-0 s4-0 s2-0 0.2) + (vector+! s5-0 s4-0 s1-0) + (let ((v1-10 s3-0)) + (set! (-> v1-10 radius) 409.6) + (set! (-> v1-10 collide-with) + (collide-spec jak bot civilian enemy vehicle-sphere hit-by-others-list player-list) ) - (.lvf vf5 (&-> s2-0 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-12 quad) vf6) - ) - (vector+! s5-0 s4-0 s1-0) - (let ((v1-10 s3-0)) - (set! (-> v1-10 radius) 409.6) - (set! (-> v1-10 collide-with) - (collide-spec jak bot civilian enemy vehicle-sphere hit-by-others-list player-list) - ) - (set! (-> v1-10 ignore-process0) #f) - (set! (-> v1-10 ignore-process1) #f) - (set! (-> v1-10 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-10 action-mask) (collide-action solid)) - ) - (vector-copy! (-> s3-0 start-pos) s4-0) - (vector-copy! (-> s3-0 move-dist) s1-0) - (set! (-> this l-control state points-to-draw) 0) - (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* s3-0)) - (s2-1 (new 'stack-no-clear 'vector)) + (set! (-> v1-10 ignore-process0) #f) + (set! (-> v1-10 ignore-process1) #f) + (set! (-> v1-10 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (cond - ((>= f0-3 0.0) - (vector-float*! s1-0 (-> s3-0 move-dist) f0-3) - (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)) - ) - (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) + (set! (-> v1-10 action-mask) (collide-action solid)) + ) + (vector-copy! (-> s3-0 start-pos) s4-0) + (vector-copy! (-> s3-0 move-dist) s1-0) + (set! (-> this l-control state points-to-draw) 0) + (let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* s3-0)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (cond + ((>= f0-3 0.0) + (vector-float*! s1-0 (-> s3-0 move-dist) f0-3) + (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)) ) - ) - (cond - ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) s4-0) - (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) s4-0) - (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) - ) - ) - (cond - ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) s5-0) - (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) s5-0) - (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) - ) - ) - (set-point! (-> this l-control) 0 s4-0) - (set-point! (-> this l-control) 1 s5-0) - (set! (-> this l-control spec) (-> *lightning-spec-id-table* 19)) - (+! (-> this l-control state points-to-draw) 2) - (let ((v1-91 (as-type (-> s3-0 best-other-tri collide-ptr) collide-shape-prim)) - (s1-7 #t) - ) - (when v1-91 - (set! s1-7 #f) - (let ((s0-1 (new 'stack-no-clear 'projectile-init-by-other-params))) - (set! (-> s0-1 ent) (-> this entity)) - (set! (-> s0-1 charge) 1.0) - (set! (-> s0-1 options) (projectile-options)) - (logclear! (-> s0-1 options) (projectile-options po14 po15 po16)) - (set! (-> s0-1 notify-handle) (process->handle this)) - (set! (-> s0-1 owner-handle) (the-as handle #f)) - (set! (-> s0-1 target-handle) (the-as handle #f)) - (set! (-> s0-1 target-pos quad) (the-as uint128 0)) - (set! (-> s0-1 ignore-handle) (process->handle this)) - (set! (-> s0-1 attack-id) (-> this attack-id)) - (set! (-> s0-1 timeout) (seconds 4)) - (vector-copy! (-> s0-1 pos) s4-0) - (vector-! (-> s0-1 vel) s5-0 s4-0) - (vector-normalize! (-> s0-1 vel) 131072.0) - (spawn-projectile guard-lazer-shot s0-1 this *default-dead-pool*) - ) - ) - ) - (spread-lightning-lazer (-> this l-control) s5-0 s2-1 (-> s3-0 best-other-tri normal)) - ) - (else - (cond - ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) s4-0) - (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) s4-0) - (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) - ) - ) - (cond - ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) s5-0) - (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) s5-0) - (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) - ) - ) - (set! (-> this l-control state points-to-draw) 9) - (set! (-> this l-control spec) (-> *lightning-spec-id-table* 20)) - (let ((v1-176 s4-0)) - (set! (-> this l-control state meet data 0 quad) (-> v1-176 quad)) - ) - (let ((a0-97 (-> this l-control)) - (v1-178 s5-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-copy! (-> a0-97 state meet data (+ (-> a0-97 state points-to-draw) -1)) v1-178) + (vector-orient-by-quat! s2-1 s2-1 a2-4) + ) + ) + (cond + ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) s4-0) + (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) s4-0) + (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) + ) + ) + (cond + ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) s5-0) + (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) s5-0) + (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) + ) + ) + (set-point! (-> this l-control) 0 s4-0) + (set-point! (-> this l-control) 1 s5-0) + (set! (-> this l-control spec) (-> *lightning-spec-id-table* 19)) + (+! (-> this l-control state points-to-draw) 2) + (let ((v1-91 (as-type (-> s3-0 best-other-tri collide-ptr) collide-shape-prim)) + (s1-7 #t) + ) + (when v1-91 + (set! s1-7 #f) + (let ((s0-1 (new 'stack-no-clear 'projectile-init-by-other-params))) + (set! (-> s0-1 ent) (-> this entity)) + (set! (-> s0-1 charge) 1.0) + (set! (-> s0-1 options) (projectile-options)) + (logclear! (-> s0-1 options) (projectile-options po14 po15 po16)) + (set! (-> s0-1 notify-handle) (process->handle this)) + (set! (-> s0-1 owner-handle) (the-as handle #f)) + (set! (-> s0-1 target-handle) (the-as handle #f)) + (set! (-> s0-1 target-pos quad) (the-as uint128 0)) + (set! (-> s0-1 ignore-handle) (process->handle this)) + (set! (-> s0-1 attack-id) (-> this attack-id)) + (set! (-> s0-1 timeout) (seconds 4)) + (vector-copy! (-> s0-1 pos) s4-0) + (vector-! (-> s0-1 vel) s5-0 s4-0) + (vector-normalize! (-> s0-1 vel) 131072.0) + (spawn-projectile guard-lazer-shot s0-1 this *default-dead-pool*) + ) + ) + ) + (spread-lightning-lazer (-> this l-control) s5-0 s2-1 (-> s3-0 best-other-tri normal)) + ) + (else + (cond + ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) s4-0) + (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) s4-0) + (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) ) ) + (cond + ((logtest? (-> *part-group-id-table* 254 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) s5-0) + (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 254)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) s5-0) + (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 254)) + ) + ) + (set! (-> this l-control state points-to-draw) 9) + (set! (-> this l-control spec) (-> *lightning-spec-id-table* 20)) + (let ((v1-176 s4-0)) + (set! (-> this l-control state meet data 0 quad) (-> v1-176 quad)) + ) + (let ((a0-98 (-> this l-control)) + (v1-178 s5-0) + ) + (vector-copy! (-> a0-98 state meet data (+ (-> a0-98 state points-to-draw) -1)) v1-178) + ) ) ) ) - (none) ) + (none) ) ;; failed to figure out what this is: 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 1af224e21f..6e14605a15 100644 --- a/test/decompiler/reference/jak3/levels/city/ctyport-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/ctyport-obs_REF.gc @@ -311,171 +311,23 @@ ;; definition for method 103 of type boat-base ;; WARN: Return type mismatch int vs none. (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-0 (-> this camera-dist2)) + (f1-0 0.000024414063) + (f0-1 (* f0-0 (* f1-0 f1-0))) + ) + (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) ) ;; definition for method 30 of type boat-base -;; INFO: Used lq/sq -;; 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) - (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~%") - ) - ) - ) - (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) - ) - 0 - ) - ) - (vehicle-method-78 this) - ) - ) +;; ERROR: function was not converted to expressions. Cannot decompile. ;; definition for method 55 of type boat-base (defmethod clear-impulse-force-flag! ((this boat-base)) 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 dcf3b3e512..6e348bd02f 100644 --- a/test/decompiler/reference/jak3/levels/city/ctywide-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/ctywide-obs_REF.gc @@ -257,145 +257,106 @@ (defstate idle-close (security-wall) :virtual #t :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (case message - (('on) - (let ((v1-2 (-> self root root-prim))) - (set! (-> v1-2 prim-core collide-as) (-> self root backup-collide-as)) - (let ((v0-0 (the-as object (-> self root backup-collide-with)))) - (set! (-> v1-2 prim-core collide-with) (the-as collide-spec v0-0)) - v0-0 - ) + (case message + (('on) + (let ((v1-2 (-> self root root-prim))) + (set! (-> v1-2 prim-core collide-as) (-> self root backup-collide-as)) + (let ((v0-0 (the-as object (-> self root backup-collide-with)))) + (set! (-> v1-2 prim-core collide-with) (the-as collide-spec v0-0)) + v0-0 ) ) - (('off) - (let ((v1-4 (-> self root root-prim))) - (set! (-> v1-4 prim-core collide-as) (collide-spec)) - (set! (-> v1-4 prim-core collide-with) (collide-spec)) - ) - 0 + ) + (('off) + (let ((v1-4 (-> self root root-prim))) + (set! (-> v1-4 prim-core collide-as) (collide-spec)) + (set! (-> v1-4 prim-core collide-with) (collide-spec)) ) - (('attack) - (let ((v1-5 (the-as attack-info (-> block param 1)))) - (when (!= (-> v1-5 id) (-> self incoming-attack-id)) - (set! (-> self incoming-attack-id) (-> v1-5 id)) - (let ((s3-0 (as-type proc process-drawable))) - (when s3-0 - (let ((s5-1 (process-spawn - manipy - :init manipy-init - (-> (the-as process-drawable s3-0) root trans) - (-> self entity) - (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer level) #f)) - #f - 0 - :name "manipy" - :to self - :stack-size #x20000 - ) + 0 + ) + (('attack) + (let ((v1-5 (the-as attack-info (-> block param 1)))) + (when (!= (-> v1-5 id) (-> self incoming-attack-id)) + (set! (-> self incoming-attack-id) (-> v1-5 id)) + (let ((s3-0 (as-type proc process-drawable))) + (when s3-0 + (let ((s5-1 (process-spawn + manipy + :init manipy-init + (-> (the-as process-drawable s3-0) root trans) + (-> self entity) + (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 ) - ) - (when s5-1 - (send-event (ppointer->process s5-1) 'anim-mode 'play1) - (send-event (ppointer->process s5-1) 'speed 1.5) - (send-event (ppointer->process s5-1) 'art-joint-anim "generic-ripples-idle" 0) - (set-vector! (-> (the-as process-drawable (-> s5-1 0)) root scale) 1.0 1.0 1.0 1.0) - (quaternion-rotate-local-x! (-> (the-as process-drawable (-> s5-1 0)) root quat) (-> self root quat) -16384.0) - (let ((v1-43 (-> (the-as process-drawable (-> s5-1 0)) root trans))) - (let ((a0-29 (-> (the-as process-drawable (-> s5-1 0)) root trans))) - (let ((a1-11 *up-vector*)) - (let ((a2-7 8192.0)) - (.mov vf7 a2-7) - ) - (.lvf vf5 (&-> a1-11 quad)) ) - (.lvf vf4 (&-> a0-29 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-43 quad) vf6) - ) - (let ((f0-6 (vector4-dot (-> (the-as process-drawable (-> s5-1 0)) root trans) (the-as vector (-> self plane))))) - (let ((v1-50 (-> (the-as process-drawable (-> s5-1 0)) root trans))) - (let ((a0-33 (-> (the-as process-drawable (-> s5-1 0)) root trans))) - (let ((a1-12 (-> self plane))) - (let ((a2-8 (- f0-6))) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a1-12 quad)) - ) - (.lvf vf4 (&-> a0-33 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-50 quad) vf6) - ) - (let ((v1-53 (-> (the-as process-drawable (-> s5-1 0)) root trans))) - (let ((a0-36 (-> (the-as process-drawable (-> s5-1 0)) root trans))) - (let ((a1-13 (-> self plane))) - (let ((a2-10 (the-as float (if (< 0.0 f0-6) - -2048.0 - 2048.0 - ) - ) - ) - ) - (.mov vf7 a2-10) - ) - (.lvf vf5 (&-> a1-13 quad)) - ) - (.lvf vf4 (&-> a0-36 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-53 quad) vf6) - ) - ) - (send-event (ppointer->process s5-1) 'trans-hook (lambda () #f)) ) + (when s5-1 + (send-event (ppointer->process s5-1) 'anim-mode 'play1) + (send-event (ppointer->process s5-1) 'speed 1.5) + (send-event (ppointer->process s5-1) 'art-joint-anim "generic-ripples-idle" 0) + (set-vector! (-> (the-as process-drawable (-> s5-1 0)) root scale) 1.0 1.0 1.0 1.0) + (quaternion-rotate-local-x! (-> (the-as process-drawable (-> s5-1 0)) root quat) (-> self root quat) -16384.0) + (vector+*! + (-> (the-as process-drawable (-> s5-1 0)) root trans) + (-> (the-as process-drawable (-> s5-1 0)) root trans) + *up-vector* + 8192.0 + ) + (let ((f0-6 (vector4-dot (-> (the-as process-drawable (-> s5-1 0)) root trans) (the-as vector (-> self plane))))) + (vector+*! + (-> (the-as process-drawable (-> s5-1 0)) root trans) + (-> (the-as process-drawable (-> s5-1 0)) root trans) + (the-as vector (-> self plane)) + (- f0-6) + ) + (vector+*! + (-> (the-as process-drawable (-> s5-1 0)) root trans) + (-> (the-as process-drawable (-> s5-1 0)) root trans) + (the-as vector (-> self plane)) + (if (< 0.0 f0-6) + -2048.0 + 2048.0 + ) + ) + ) + (send-event (ppointer->process s5-1) 'trans-hook (lambda () #f)) ) ) ) - (when (zero? (-> self touch-count)) - (+! (-> self touch-count) 1) - (set! (-> self flash) 0.375) - ) + ) + (when (zero? (-> self touch-count)) (+! (-> self touch-count) 1) - (if (and (logtest? (-> proc mask) (process-mask target)) - (not (logtest? (process-mask projectile) (-> proc mask))) - ) + (set! (-> self flash) 0.375) + ) + (+! (-> self touch-count) 1) + (if (and (logtest? (-> proc mask) (process-mask target)) + (not (logtest? (process-mask projectile) (-> proc mask))) + ) + (play-speech self) + ) + ) + ) + ) + (('touched) + (when (zero? (-> self touch-count)) + (+! (-> self touch-count) 1) + (set! (-> self flash) 0.375) + ) + (+! (-> self touch-count) 1) + (let ((v1-84 (as-type proc process-focusable))) + (when v1-84 + (let ((a0-45 (as-type (-> (the-as process-drawable v1-84) root) collide-shape))) + (if (and a0-45 (logtest? (-> (the-as collide-shape a0-45) root-prim prim-core collide-as) (collide-spec jak))) (play-speech self) ) ) ) ) - (('touched) - (when (zero? (-> self touch-count)) - (+! (-> self touch-count) 1) - (set! (-> self flash) 0.375) - ) - (+! (-> self touch-count) 1) - (let ((v1-81 (as-type proc process-focusable))) - (when v1-81 - (let ((a0-45 (as-type (-> (the-as process-drawable v1-81) root) collide-shape))) - (if (and a0-45 (logtest? (-> (the-as collide-shape a0-45) root-prim prim-core collide-as) (collide-spec jak))) - (play-speech self) - ) - ) - ) - ) - ) - ) + ) ) ) :trans (behavior () @@ -1177,96 +1138,59 @@ (defstate idle (propa) :virtual #t :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (case message - (('attack) - (get-penetrate-using-from-attack-event (the-as process-drawable proc) block) - (let ((v1-2 (the-as object (-> block param 1)))) - (when (!= (-> (the-as attack-info v1-2) id) (-> self incoming-attack-id)) - (set! (-> self incoming-attack-id) (-> (the-as attack-info v1-2) id)) - (let ((s5-1 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block))) - (if (and (not (logtest? (penetrate dark-skin) s5-1)) (zero? (propa-pu->knocked-type s5-1))) - (set! (-> self hit-points) (- (-> self hit-points) (the int (penetrate-using->damage s5-1)))) - (+! (-> self hit-points) -10) - ) - ) - (cond - ((< (-> self hit-points) 3) - (setup-masks (-> self draw) 0 -1) - (setup-masks (-> self draw) 1 0) - (let* ((a0-9 (the-as collide-shape-prim-group (-> self root root-prim))) - (v1-18 (-> a0-9 child 0)) - ) - (let ((a0-11 (-> a0-9 child 1))) - (set! (-> a0-11 prim-core collide-as) (-> v1-18 prim-core collide-as)) - (set! (-> a0-11 prim-core collide-with) (-> v1-18 prim-core collide-with)) - ) - (set! (-> v1-18 prim-core collide-as) (collide-spec)) - (set! (-> v1-18 prim-core collide-with) (collide-spec)) - ) - 0 - (cond - ((logtest? (-> *part-group-id-table* 224 flags) (sp-group-flag sp13)) - (let ((v1-25 (-> *launch-matrix* trans)) - (a0-12 (new 'stack-no-clear 'vector)) - ) - (let ((a1-9 (-> self root trans))) - (let ((a2-3 *up-vector*)) - (let ((a3-2 8192.0)) - (.mov vf7 a3-2) - ) - (.lvf vf5 (&-> a2-3 quad)) - ) - (.lvf vf4 (&-> a1-9 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-12 quad) vf6) - (vector-copy! v1-25 a0-12) + (case message + (('attack) + (get-penetrate-using-from-attack-event (the-as process-drawable proc) block) + (let ((v1-2 (the-as object (-> block param 1)))) + (when (!= (-> (the-as attack-info v1-2) id) (-> self incoming-attack-id)) + (set! (-> self incoming-attack-id) (-> (the-as attack-info v1-2) id)) + (let ((s5-1 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block))) + (if (and (not (logtest? (penetrate dark-skin) s5-1)) (zero? (propa-pu->knocked-type s5-1))) + (set! (-> self hit-points) (- (-> self hit-points) (the int (penetrate-using->damage s5-1)))) + (+! (-> self hit-points) -10) + ) + ) + (cond + ((< (-> self hit-points) 3) + (setup-masks (-> self draw) 0 -1) + (setup-masks (-> self draw) 1 0) + (let* ((a0-9 (the-as collide-shape-prim-group (-> self root root-prim))) + (v1-18 (-> a0-9 child 0)) ) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 224)) - ) - (else - (let ((v1-40 (-> *launch-matrix* trans)) - (a0-17 (new 'stack-no-clear 'vector)) - ) - (let ((a1-14 (-> self root trans))) - (let ((a2-9 *up-vector*)) - (let ((a3-6 8192.0)) - (.mov vf7 a3-6) - ) - (.lvf vf5 (&-> a2-9 quad)) - ) - (.lvf vf4 (&-> a1-14 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-17 quad) vf6) - (vector-copy! v1-40 a0-17) - ) - (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 224)) - ) + (let ((a0-11 (-> a0-9 child 1))) + (set! (-> a0-11 prim-core collide-as) (-> v1-18 prim-core collide-as)) + (set! (-> a0-11 prim-core collide-with) (-> v1-18 prim-core collide-with)) ) - (go-virtual broken) + (set! (-> v1-18 prim-core collide-as) (collide-spec)) + (set! (-> v1-18 prim-core collide-with) (collide-spec)) ) - ((< (-> self hit-points) 6) - (setup-masks (-> self draw) 0 -1) - (setup-masks (-> self draw) 2 0) + 0 + (cond + ((logtest? (-> *part-group-id-table* 224 flags) (sp-group-flag sp13)) + (vector-copy! + (-> *launch-matrix* trans) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 8192.0) + ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 224)) + ) + (else + (vector-copy! + (-> *launch-matrix* trans) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 8192.0) + ) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 224)) + ) ) - ) + (go-virtual broken) + ) + ((< (-> self hit-points) 6) + (setup-masks (-> self draw) 0 -1) + (setup-masks (-> self draw) 2 0) + ) ) ) ) - ) + ) ) ) :exit (behavior () @@ -1676,36 +1600,14 @@ ) :code sleep-code :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let* ((a0-0 (-> *target* neck)) - (t9-0 (method-of-object a0-0 look-at!)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-4 (-> self root trans))) - (let ((a2-0 *up-vector*)) - (let ((a3-1 20480.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> v1-4 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-0 quad) vf6) - (t9-0 a0-0 a1-0 #f self) + (if *target* + (look-at! + (-> *target* neck) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 20480.0) + #f + self ) ) - ) ) ) @@ -1736,79 +1638,59 @@ (sv-320 float) (sv-336 float) ) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (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)) - (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))) + (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-copy! (-> *camera* slave 0 trans) gp-0) - (let ((t9-4 forward-down->inv-matrix) - (a0-6 (-> *camera* slave 0 tracking)) - (a1-3 (new 'stack-no-clear 'vector)) - (v1-18 (new 'stack-no-clear 'vector)) - ) - (let ((a2-4 (-> self root trans))) - (let ((a3-1 *up-vector*)) - (let ((t0-2 20480.0)) - (.mov vf7 t0-2) - ) - (.lvf vf5 (&-> a3-1 quad)) - ) - (.lvf vf4 (&-> a2-4 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-18 quad) vf6) - (t9-4 (-> a0-6 inv-mat) (vector-! a1-3 v1-18 gp-0) (-> *camera* local-down)) + (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))) ) ) - ) - (let ((gp-1 (matrix-copy! (new 'stack-no-clear 'matrix) (-> self node-list data 3 bone transform)))) - (if (< (vector-dot - (-> gp-1 fvec) - (vector-! (new 'stack-no-clear 'vector) (camera-pos) (matrix->trans gp-1 (new 'stack-no-clear 'vector))) - ) - 0.0 - ) - (matrix*! gp-1 (matrix-rotate-y! (new 'stack-no-clear 'matrix) 32768.0) gp-1) + (vector-copy! (-> *camera* slave 0 trans) gp-0) + (forward-down->inv-matrix + (-> *camera* slave 0 tracking inv-mat) + (vector-! + (new 'stack-no-clear 'vector) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 20480.0) + gp-0 ) - (+! (-> self angle) (* 100.0 (rand-vu))) - (set! (-> *part-id-table* 1180 init-specs 4 initial-valuef) - (+ 14336.0 (* 1228.8 (cos (* 182.04445 (-> self angle))))) - ) - (set! (-> *part-id-table* 1181 init-specs 4 initial-valuef) - (+ 2048.0 (-> *part-id-table* 1180 init-specs 4 initial-valuef)) - ) - (spawn-from-mat (-> self part) gp-1) + (-> *camera* local-down) + ) ) ) + (let ((gp-1 (matrix-copy! (new 'stack-no-clear 'matrix) (-> self node-list data 3 bone transform)))) + (if (< (vector-dot + (-> gp-1 fvec) + (vector-! (new 'stack-no-clear 'vector) (camera-pos) (matrix->trans gp-1 (new 'stack-no-clear 'vector))) + ) + 0.0 + ) + (matrix*! gp-1 (matrix-rotate-y! (new 'stack-no-clear 'matrix) 32768.0) gp-1) + ) + (+! (-> self angle) (* 100.0 (rand-vu))) + (set! (-> *part-id-table* 1180 init-specs 4 initial-valuef) + (+ 14336.0 (* 1228.8 (cos (* 182.04445 (-> self angle))))) + ) + (set! (-> *part-id-table* 1181 init-specs 4 initial-valuef) + (+ 2048.0 (-> *part-id-table* 1180 init-specs 4 initial-valuef)) + ) + (spawn-from-mat (-> self part) gp-1) + ) ) :code (behavior () (set-setting! 'mode-name 'cam-really-fixed 0.0 0) @@ -1858,36 +1740,14 @@ (go-virtual idle) ) :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let* ((a0-0 (-> *target* neck)) - (t9-0 (method-of-object a0-0 look-at!)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-4 (-> self root trans))) - (let ((a2-0 *up-vector*)) - (let ((a3-1 20480.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> v1-4 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-0 quad) vf6) - (t9-0 a0-0 a1-0 #f self) + (if *target* + (look-at! + (-> *target* neck) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 20480.0) + #f + self ) ) - ) ) ) @@ -1906,119 +1766,99 @@ (remove-setting! 'mode-name) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (time-elapsed? (-> self state-time) (seconds 1.5)) - (let ((gp-0 0) - (s5-0 0) + (when (time-elapsed? (-> self state-time) (seconds 1.5)) + (let ((gp-0 0) + (s5-0 0) + ) + (when (cpad-pressed? 0 down l-analog-down) + (+! s5-0 1) + (if (< (+ gp-0 -1) s5-0) + (set! s5-0 (+ gp-0 -1)) + (sound-play "menu-up-down") ) - (when (cpad-pressed? 0 down l-analog-down) - (+! s5-0 1) - (if (< (+ gp-0 -1) s5-0) - (set! s5-0 (+ gp-0 -1)) - (sound-play "menu-up-down") - ) - ) - (when (cpad-pressed? 0 up l-analog-up) - (+! s5-0 -1) - (if (< s5-0 0) - (set! s5-0 0) - (sound-play "menu-up-down") - ) - ) - (let* ((s4-2 40) - (s3-2 36) - (s2-0 (- 228 (* gp-0 (/ s4-2 2)))) - (v1-19 (new - 'stack - 'font-context - *font-default-matrix* - s3-2 - s2-0 - 0.0 - (font-color default) - (font-flags shadow kerning) - ) + ) + (when (cpad-pressed? 0 up l-analog-up) + (+! s5-0 -1) + (if (< s5-0 0) + (set! s5-0 0) + (sound-play "menu-up-down") + ) + ) + (let* ((s4-2 40) + (s3-2 36) + (s2-0 (- 228 (* gp-0 (/ s4-2 2)))) + (v1-19 (new + 'stack + 'font-context + *font-default-matrix* + s3-2 + s2-0 + 0.0 + (font-color default) + (font-flags shadow kerning) ) - ) - (set! (-> v1-19 flags) (font-flags shadow kerning middle middle-vert large)) - (set-width! v1-19 440) - (set-height! v1-19 50) - (set-scale! v1-19 1.0) - (set-origin! v1-19 s3-2 40) - (let ((a1-7 v1-19)) - (set! (-> a1-7 color) (font-color progress-old-yellow)) - ) - (set-height! v1-19 s4-2) - (dotimes (a0-23 gp-0) - (set-origin! v1-19 s3-2 s2-0) - (set-scale! v1-19 (if (= a0-23 s5-0) - 0.8 - 0.6 - ) - ) - (let ((a2-6 v1-19)) - (set! (-> a2-6 color) (if (= a0-23 s5-0) - (font-color progress-old-selected) - (font-color default) - ) ) - ) - (+! s2-0 s4-2) - ) - ) - ) - ) - (when (!= (-> self time) -1.0) - (let ((gp-1 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (vector+! gp-1 (-> self root trans) (vector-orient-by-quat! - (new 'stack-no-clear 'vector) - (new 'static 'vector :y 24166.4 :z 32768.0 :w 1.0) - (-> self root quat) - ) - ) - (vector-copy! (-> *camera* slave 0 trans) gp-1) - (let ((t9-6 forward-down->inv-matrix) - (a0-27 (-> *camera* slave 0 tracking)) - (a1-13 (new 'stack-no-clear 'vector)) - (v1-35 (new 'stack-no-clear 'vector)) - ) - (let ((a2-9 (-> self root trans))) - (let ((a3-4 *up-vector*)) - (let ((t0-4 24166.4)) - (.mov vf7 t0-4) - ) - (.lvf vf5 (&-> a3-4 quad)) - ) - (.lvf vf4 (&-> a2-9 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-35 quad) vf6) - (t9-6 (-> a0-27 inv-mat) (vector-! a1-13 v1-35 gp-1) (-> *camera* local-down)) - ) - ) - ) - (let ((gp-2 (matrix-copy! (new 'stack-no-clear 'matrix) (-> self node-list data 3 bone transform)))) - (if (< (vector-dot - (-> gp-2 fvec) - (vector-! (new 'stack-no-clear 'vector) (camera-pos) (matrix->trans gp-2 (new 'stack-no-clear 'vector))) - ) - 0.0 ) - (matrix*! gp-2 (matrix-rotate-y! (new 'stack-no-clear 'matrix) 32768.0) gp-2) + (set! (-> v1-19 flags) (font-flags shadow kerning middle middle-vert large)) + (set-width! v1-19 440) + (set-height! v1-19 50) + (set-scale! v1-19 1.0) + (set-origin! v1-19 s3-2 40) + (let ((a1-7 v1-19)) + (set! (-> a1-7 color) (font-color progress-old-yellow)) ) - (spawn-from-mat (-> self part-off) gp-2) + (set-height! v1-19 s4-2) + (dotimes (a0-23 gp-0) + (set-origin! v1-19 s3-2 s2-0) + (set-scale! v1-19 (if (= a0-23 s5-0) + 0.8 + 0.6 + ) + ) + (let ((a2-6 v1-19)) + (set! (-> a2-6 color) (if (= a0-23 s5-0) + (font-color progress-old-selected) + (font-color default) + ) + ) + ) + (+! s2-0 s4-2) + ) + ) ) ) + (when (!= (-> self time) -1.0) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (vector+! gp-1 (-> self root trans) (vector-orient-by-quat! + (new 'stack-no-clear 'vector) + (new 'static 'vector :y 24166.4 :z 32768.0 :w 1.0) + (-> self root quat) + ) + ) + (vector-copy! (-> *camera* slave 0 trans) gp-1) + (forward-down->inv-matrix + (-> *camera* slave 0 tracking inv-mat) + (vector-! + (new 'stack-no-clear 'vector) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 24166.4) + gp-1 + ) + (-> *camera* local-down) + ) + ) + ) + (let ((gp-2 (matrix-copy! (new 'stack-no-clear 'matrix) (-> self node-list data 3 bone transform)))) + (if (< (vector-dot + (-> gp-2 fvec) + (vector-! (new 'stack-no-clear 'vector) (camera-pos) (matrix->trans gp-2 (new 'stack-no-clear 'vector))) + ) + 0.0 + ) + (matrix*! gp-2 (matrix-rotate-y! (new 'stack-no-clear 'matrix) 32768.0) gp-2) + ) + (spawn-from-mat (-> self part-off) gp-2) + ) ) :code (behavior () (set-setting! 'mode-name 'cam-really-fixed 0.0 0) @@ -2072,36 +1912,14 @@ (go-virtual idle) ) :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let* ((a0-0 (-> *target* neck)) - (t9-0 (method-of-object a0-0 look-at!)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-4 (-> self root trans))) - (let ((a2-0 *up-vector*)) - (let ((a3-1 20480.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> v1-4 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-0 quad) vf6) - (t9-0 a0-0 a1-0 #f self) + (if *target* + (look-at! + (-> *target* neck) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 20480.0) + #f + self ) ) - ) ) ) 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 8dceda824d..3ab7423334 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 @@ -889,33 +889,10 @@ (defstate waiting-idle (jinx) :virtual #t :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (-> self destination))) - (let ((v1-0 (target-pos 0))) - (let ((a0-1 (-> self follow-dir))) - (let ((a1-0 (-> self follow-offset))) - (.mov vf7 a1-0) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-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 (&-> gp-0 quad) vf6) + (vector+*! (-> self destination) (target-pos 0) (-> self follow-dir) (-> self follow-offset)) + (if (< 12288.0 (vector-vector-distance (-> self destination) (-> self root trans))) + (go-virtual traveling) ) - (if (< 12288.0 (vector-vector-distance (-> self destination) (-> self root trans))) - (go-virtual traveling) - ) - ) ) :code (behavior () (let ((v1-2 (ja-group))) @@ -974,37 +951,14 @@ (nav-enemy-method-177 self) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (-> self destination))) - (let ((v1-0 (target-pos 0))) - (let ((a0-1 (-> self follow-dir))) - (let ((a1-0 (-> self follow-offset))) - (.mov vf7 a1-0) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-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 (&-> gp-0 quad) vf6) - ) - (cond - ((< (vector-vector-distance (-> self destination) (-> self root trans)) 8192.0) - (go-virtual waiting-idle) - ) - ((and (time-elapsed? (-> self state-time) (seconds 0.5)) (player-blocking-travel? self)) - (go-virtual traveling-blocked) - ) - ) + (vector+*! (-> self destination) (target-pos 0) (-> self follow-dir) (-> self follow-offset)) + (cond + ((< (vector-vector-distance (-> self destination) (-> self root trans)) 8192.0) + (go-virtual waiting-idle) + ) + ((and (time-elapsed? (-> self state-time) (seconds 0.5)) (player-blocking-travel? self)) + (go-virtual traveling-blocked) + ) ) ) :code (behavior () @@ -1788,222 +1742,194 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod task-manager-method-26 ((this task-manager-city-destroy-grid)) - (local-vars (v1-180 float) (v1-201 float)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (update-jinx-speech this) - (when (nonzero? (-> this jinx)) - (let ((s5-0 (the-as jinx (handle->process (-> this jinx))))) - (when s5-0 - (when (nonzero? (-> this actor-group)) - (dotimes (s4-0 (length (-> this actor-group 0))) - (let ((s3-0 (-> this actor-group 0 data s4-0))) - (when (= (-> this next-box) s4-0) - (vector-copy! (-> this goal-pos) (-> s3-0 actor trans)) - (let ((s2-0 (-> this goal-pos-front))) - (let ((s1-0 (-> s3-0 actor trans))) - (let ((v1-17 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-0 actor quat)))) - (let ((a0-12 8192.0)) - (.mov vf7 a0-12) - ) - (.lvf vf5 (&-> v1-17 quad)) - ) - (.lvf vf4 (&-> s1-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 (&-> s2-0 quad) vf6) - ) - (when (< (vector-vector-distance (-> s3-0 actor trans) (-> s5-0 root trans)) 40960.0) - ) + (update-jinx-speech this) + (when (nonzero? (-> this jinx)) + (let ((s5-0 (the-as jinx (handle->process (-> this jinx))))) + (when s5-0 + (when (nonzero? (-> this actor-group)) + (dotimes (s4-0 (length (-> this actor-group 0))) + (let ((s3-0 (-> this actor-group 0 data s4-0))) + (when (= (-> this next-box) s4-0) + (vector-copy! (-> this goal-pos) (-> s3-0 actor trans)) + (vector+*! + (-> this goal-pos-front) + (-> s3-0 actor trans) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> s3-0 actor quat)) + 8192.0 + ) + (when (< (vector-vector-distance (-> s3-0 actor trans) (-> s5-0 root trans)) 40960.0) ) ) ) ) + ) + (cond + ((as-type (entity-nav-mesh-by-aid (-> s5-0 nav-mesh-aid)) entity-nav-mesh) + ) + (else + ) + ) + (when (= (+ (length (-> this actor-group 0)) 1) (-> this next-box)) + (+! (-> this next-box) 1) + (deactivate s5-0) + (let ((a0-19 (handle->process (-> this vehicle)))) + (if a0-19 + (deactivate a0-19) + ) + ) + (let ((a0-22 (-> this arrow-h process 0))) + (if a0-22 + (deactivate a0-22) + ) + ) + (send-event this 'complete) + ) + (let ((a1-6 *target*)) + (when (and a1-6 (focus-test? a1-6 pilot)) + (set-setting! 'music 'cityfi 0.0 0) + (when (not (-> this intro-play?)) + (set-setting! 'airlock #f 0.0 0) + (set-speech-name this "jinx102" 300 600) + (set! (-> this intro-play?) #t) + ) + ) + ) + (let ((v1-67 (handle->process (-> this vehicle)))) (cond - ((as-type (entity-nav-mesh-by-aid (-> s5-0 nav-mesh-aid)) entity-nav-mesh) - ) + (v1-67 + (logior! (-> (the-as vehicle v1-67) v-flags) (vehicle-flag persistent)) + (if (or (and (-> (the-as vehicle v1-67) next-state) (= (-> (the-as vehicle v1-67) next-state name) 'inactive)) + (focus-test? (the-as vehicle v1-67) dead) + ) + (send-event this 'fail) + ) + ) (else + (send-event this 'fail) ) ) - (when (= (+ (length (-> this actor-group 0)) 1) (-> this next-box)) - (+! (-> this next-box) 1) - (deactivate s5-0) - (let ((a0-20 (handle->process (-> this vehicle)))) - (if a0-20 - (deactivate a0-20) - ) - ) - (let ((a0-23 (-> this arrow-h process 0))) - (if a0-23 - (deactivate a0-23) - ) - ) - (send-event this 'complete) - ) - (let ((a1-6 *target*)) - (when (and a1-6 (focus-test? a1-6 pilot)) - (set-setting! 'music 'cityfi 0.0 0) - (when (not (-> this intro-play?)) - (set-setting! 'airlock #f 0.0 0) - (set-speech-name this "jinx102" 300 600) - (set! (-> this intro-play?) #t) + ) + (when (-> this arrow-h) + (let ((a0-46 (-> this arrow-h process 0)) + (v1-82 *target*) + (a2-4 (handle->process (-> this vehicle))) ) - ) - ) - (let ((v1-67 (the-as vehicle (handle->process (-> this vehicle))))) (cond - (v1-67 - (logior! (-> v1-67 v-flags) (vehicle-flag persistent)) - (if (or (and (-> v1-67 next-state) (= (-> v1-67 next-state name) 'inactive)) (focus-test? v1-67 dead)) - (send-event this 'fail) - ) - ) + ((and (-> s5-0 next-state) (= (-> s5-0 next-state name) 'wait-for-ride)) + (logclear! (-> (the-as vehicle a2-4) v-flags) (vehicle-flag persistent)) + (if (and (the-as vehicle a2-4) v1-82 (not (logtest? (focus-status pilot) (-> v1-82 focus-status)))) + (send-event a0-46 'set-position (-> (the-as vehicle a2-4) root trans)) + (send-event a0-46 'set-position (-> s5-0 root trans)) + ) + (send-event (handle->process (-> this arrow-h)) 'show) + ) + ((and (-> s5-0 next-state) (= (-> s5-0 next-state name) 'ride)) + (cond + ((and a2-4 v1-82 (not (logtest? (focus-status pilot) (-> v1-82 focus-status)))) + (send-event a0-46 'set-position (-> s5-0 root trans)) + (send-event (handle->process (-> this arrow-h)) 'show) + ) + (else + (send-event (handle->process (-> this arrow-h)) 'set-position (-> this goal-pos)) + (send-event (handle->process (-> this arrow-h)) 'show) + ) + ) + ) (else - (send-event this 'fail) + (send-event (handle->process (-> this arrow-h)) 'hide) ) ) ) - (when (-> this arrow-h) - (let ((a0-47 (-> this arrow-h process 0)) - (v1-82 *target*) - (a2-4 (handle->process (-> this vehicle))) - ) + ) + (when *target* + (if (< 819200.0 (vector-vector-distance (-> s5-0 root trans) (target-pos 0))) + (send-event this 'fail) + ) + (let ((s4-4 (handle->process (-> this vehicle)))) + (when s4-4 (cond - ((and (-> s5-0 next-state) (= (-> s5-0 next-state name) 'wait-for-ride)) - (logclear! (-> (the-as vehicle a2-4) v-flags) (vehicle-flag persistent)) - (if (and (the-as vehicle a2-4) v1-82 (not (logtest? (focus-status pilot) (-> v1-82 focus-status)))) - (send-event a0-47 'set-position (-> (the-as vehicle a2-4) root trans)) - (send-event a0-47 'set-position (-> s5-0 root trans)) - ) - (send-event (handle->process (-> this arrow-h)) 'show) - ) ((and (-> s5-0 next-state) (= (-> s5-0 next-state name) 'ride)) - (cond - ((and a2-4 v1-82 (not (logtest? (focus-status pilot) (-> v1-82 focus-status)))) - (send-event a0-47 'set-position (-> s5-0 root trans)) - (send-event (handle->process (-> this arrow-h)) 'show) - ) - (else - (send-event (handle->process (-> this arrow-h)) 'set-position (-> this goal-pos)) - (send-event (handle->process (-> this arrow-h)) 'show) + (when (= (-> this next-box) (length (-> this actor-group 0))) + (deactivate s5-0) + (let ((a0-84 (handle->process (-> this vehicle)))) + (if a0-84 + (deactivate a0-84) + ) ) + (let ((a0-87 (-> this arrow-h process 0))) + (if a0-87 + (deactivate a0-87) + ) + ) + (send-event this 'complete) ) - ) - (else - (send-event (handle->process (-> this arrow-h)) 'hide) - ) - ) - ) - ) - (when *target* - (if (< 819200.0 (vector-vector-distance (-> s5-0 root trans) (target-pos 0))) - (send-event this 'fail) - ) - (let ((s4-4 (the-as vehicle (handle->process (-> this vehicle))))) - (when s4-4 - (cond - ((and (-> s5-0 next-state) (= (-> s5-0 next-state name) 'ride)) - (when (= (-> this next-box) (length (-> this actor-group 0))) - (deactivate s5-0) - (let ((a0-85 (handle->process (-> this vehicle)))) - (if a0-85 - (deactivate a0-85) - ) - ) - (let ((a0-88 (-> this arrow-h process 0))) - (if a0-88 - (deactivate a0-88) - ) - ) - (send-event this 'complete) - ) - (if (and (< (vector-vector-distance (-> this goal-pos) (-> s5-0 root trans)) 163840.0) - (begin - (.lvf vf1 (&-> (-> s4-4 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 v1-180 vf1) - (let ((f0-4 v1-180) - (f1-2 12288.0) - ) - (< f0-4 (* f1-2 f1-2)) + (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)) ) - (send-event s5-0 'exit-vehicle (-> this goal-pos-front)) - ) - ) - ((and (-> s5-0 next-state) (= (-> s5-0 next-state name) 'wait-for-ride)) - (let ((v1-197 (get-best-seat s4-4 (-> s4-4 root trans) (the-as vehicle-seat-flag (-> s5-0 info seat-flag)) 1))) - (when (!= v1-197 -1) - (.lvf vf1 (&-> (-> s4-4 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 v1-201 vf1) - (let ((f0-5 v1-201) - (f1-5 32768.0) - ) - (when (and (< f0-5 (* f1-5 f1-5)) - (let ((f0-6 (vector-vector-distance-squared (-> s4-4 root trans) (-> s5-0 root trans))) - (f1-8 204800.0) - ) - (< f0-6 (* f1-8 f1-8)) - ) - ) - (send-event s5-0 'board-vehicle s4-4) - (when (and (nonzero? (-> this next-box)) (!= (-> 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 - ) + ) + (send-event s5-0 'exit-vehicle (-> this goal-pos-front)) + ) + ) + ((and (-> s5-0 next-state) (= (-> s5-0 next-state name) 'wait-for-ride)) + (let ((v1-197 (get-best-seat + (the-as vehicle s4-4) + (-> (the-as vehicle s4-4) root trans) + (the-as vehicle-seat-flag (-> s5-0 info seat-flag)) + 1 ) ) - (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)) + ) + (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)) ) + (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)) + ) ) ) ) ) ) - ) + ) ) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ) 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 364fb9fa00..599b70e395 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 @@ -811,7 +811,7 @@ ) (vector-normalize! s4-1 1.0) (let ((f0-12 (fmin f30-0 (* f28-0 (seconds-per-frame))))) - (vector-rotate-around-axis! gp-0 (the-as quaternion gp-0) f0-12 s4-1) + (vector-rotate-around-axis! gp-0 gp-0 f0-12 s4-1) ) ) (quaternion-look-at! (-> self root quat) gp-0 *up-vector*) diff --git a/test/decompiler/reference/jak3/levels/city/hijack/kg-vehicles_REF.gc b/test/decompiler/reference/jak3/levels/city/hijack/kg-vehicles_REF.gc index c214d7088b..b565a14277 100644 --- a/test/decompiler/reference/jak3/levels/city/hijack/kg-vehicles_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/hijack/kg-vehicles_REF.gc @@ -912,7 +912,7 @@ ) (vector-normalize! s2-1 1.0) (let ((f0-23 (fmin f28-0 (* 16384.0 arg0)))) - (vector-rotate-around-axis! s4-2 (the-as quaternion s4-2) f0-23 s2-1) + (vector-rotate-around-axis! s4-2 s4-2 f0-23 s2-1) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/city/protect/assault-enemies_REF.gc b/test/decompiler/reference/jak3/levels/city/protect/assault-enemies_REF.gc index cbde606765..d59d90ed0a 100644 --- a/test/decompiler/reference/jak3/levels/city/protect/assault-enemies_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/protect/assault-enemies_REF.gc @@ -2016,44 +2016,21 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod bombbot-method-196 ((this assault-bombbot) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (the-as target (as-type *target* process-focusable)))) - (cond - (gp-0 - (vector-copy! (-> this target-pos) (get-trans gp-0 3)) - (let ((v1-3 (-> this target-pos))) - (let ((a0-4 (-> gp-0 control trans))) - (let ((a1-4 (-> gp-0 control transv))) - (let ((a2-0 0.0)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a1-4 quad)) - ) - (.lvf vf4 (&-> a0-4 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-3 quad) vf6) - ) - (vector-copy! (-> this start-target-pos) (-> this target-pos)) - (vector-copy! (-> this start-target-vel) (-> gp-0 control transv)) - (focus-on! (-> this focus) gp-0 this) - ) - (else - (clear-focused (-> this focus)) - ) + (let ((gp-0 (the-as target (as-type *target* process-focusable)))) + (cond + (gp-0 + (vector-copy! (-> this target-pos) (get-trans gp-0 3)) + (vector+*! (-> this target-pos) (-> gp-0 control trans) (-> gp-0 control transv) 0.0) + (vector-copy! (-> this start-target-pos) (-> this target-pos)) + (vector-copy! (-> this start-target-vel) (-> gp-0 control transv)) + (focus-on! (-> this focus) gp-0 this) + ) + (else + (clear-focused (-> this focus)) ) ) - (none) ) + (none) ) ;; definition for method 209 of type assault-bombbot @@ -2158,89 +2135,71 @@ ) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (not (-> self is-final?)) - (let ((f30-0 (/ (-> self hit-points) (-> self max-hp)))) - (when (time-elapsed? (-> self stop-shoot) (seconds 6)) - (dotimes (gp-0 (-> *bombbot-bomb-hp-thresholds* length)) - (if (and (>= (-> *bombbot-bomb-hp-thresholds* gp-0) f30-0) - (>= f30-0 (+ -0.1 (-> *bombbot-bomb-hp-thresholds* gp-0))) - ) - (go-virtual drop-bombs) - ) - ) - ) - ) - ) - (when (< (-> self next-target) (current-time)) - (let ((a1-0 (new 'stack-no-clear 'vector))) - (vector-copy! a1-0 (-> self root trans)) - (set! (-> a1-0 w) 204800.0) - (bombbot-method-196 self a1-0) - ) - (set! (-> self next-target) (+ (current-time) (seconds 8))) - (set! (-> self gun-type) (the-as uint 0)) - 0 - ) - (let ((v1-33 (the-as process-focusable (handle->process (-> self focus handle))))) - (when v1-33 - (when (< (current-time) (+ (-> self next-target) (seconds -2))) - (set-time! (-> self start-target)) - (vector-copy! (-> self start-target-pos) (-> v1-33 root trans)) - (vector-copy! (-> self start-target-vel) (-> v1-33 root transv)) - (vector-! (-> self target-delta) (-> v1-33 root trans) (-> self root trans)) - ) - (let ((a2-2 (-> self target-pos))) - (let ((a0-23 (-> self start-target-pos))) - (let ((a1-12 (-> self start-target-vel))) - (let ((a3-4 (* 0.0033333334 (the float (- (current-time) (-> self start-target)))))) - (.mov vf7 a3-4) - ) - (.lvf vf5 (&-> a1-12 quad)) - ) - (.lvf vf4 (&-> a0-23 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) - ) - (if (= (-> v1-33 type) target) - (vector-copy! (-> self target-pos) (-> self start-target-pos)) - ) - (if (< (+ (-> self next-target) (seconds -1)) (current-time)) - (bombbot-method-197 self) - (bombbot-method-204 self) - ) - ) - ) - (bombbot-method-205 self) - (new 'stack-no-clear 'vector) - (let ((f0-8 (* 0.25 (+ (-> self feet 0 next-position y) - (-> self feet 1 next-position y) - (-> self feet 2 next-position y) - (-> self feet 3 next-position y) - ) + (when (not (-> self is-final?)) + (let ((f30-0 (/ (-> self hit-points) (-> self max-hp)))) + (when (time-elapsed? (-> self stop-shoot) (seconds 6)) + (dotimes (gp-0 (-> *bombbot-bomb-hp-thresholds* length)) + (if (and (>= (-> *bombbot-bomb-hp-thresholds* gp-0) f30-0) + (>= f30-0 (+ -0.1 (-> *bombbot-bomb-hp-thresholds* gp-0))) ) - ) + (go-virtual drop-bombs) + ) ) - (if (!= (-> self nav state mesh) *default-nav-mesh*) - (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-8 (-> self root trans y)))) + ) + ) + ) + (when (< (-> self next-target) (current-time)) + (let ((a1-0 (new 'stack-no-clear 'vector))) + (vector-copy! a1-0 (-> self root trans)) + (set! (-> a1-0 w) 204800.0) + (bombbot-method-196 self a1-0) + ) + (set! (-> self next-target) (+ (current-time) (seconds 8))) + (set! (-> self gun-type) (the-as uint 0)) + 0 + ) + (let ((v1-33 (the-as process-focusable (handle->process (-> self focus handle))))) + (when v1-33 + (when (< (current-time) (+ (-> self next-target) (seconds -2))) + (set-time! (-> self start-target)) + (vector-copy! (-> self start-target-pos) (-> v1-33 root trans)) + (vector-copy! (-> self start-target-vel) (-> v1-33 root transv)) + (vector-! (-> self target-delta) (-> v1-33 root trans) (-> self root trans)) + ) + (vector+*! + (-> self target-pos) + (-> self start-target-pos) + (-> self start-target-vel) + (* 0.0033333334 (the float (- (current-time) (-> self start-target)))) + ) + (if (= (the-as process-focusable (-> v1-33 type)) target) + (vector-copy! (-> self target-pos) (-> self start-target-pos)) + ) + (if (< (+ (-> self next-target) (seconds -1)) (current-time)) + (bombbot-method-197 self) + (bombbot-method-204 self) ) ) - (if (= (vector-length (-> self root transv)) 0.0) - (set-time! (-> self state-time)) - ) - (bombbot-method-202 self) - (bombbot-method-195 self) ) + (bombbot-method-205 self) + (new 'stack-no-clear 'vector) + (let ((f0-8 (* 0.25 (+ (-> self feet 0 next-position y) + (-> self feet 1 next-position y) + (-> self feet 2 next-position y) + (-> self feet 3 next-position y) + ) + ) + ) + ) + (if (!= (-> self nav state mesh) *default-nav-mesh*) + (+! (-> self root trans y) (* 4.0 (seconds-per-frame) (- f0-8 (-> self root trans y)))) + ) + ) + (if (= (vector-length (-> self root transv)) 0.0) + (set-time! (-> self state-time)) + ) + (bombbot-method-202 self) + (bombbot-method-195 self) ) :post (behavior () (let ((v1-0 1200)) 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 27450e3470..4c6d1b7ee4 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 @@ -1523,45 +1523,31 @@ ;; definition for function find-nearest-nav-mesh-protect (defun find-nearest-nav-mesh-protect ((arg0 vector) (arg1 float)) - (local-vars (v1-15 float) (sv-64 nav-poly) (sv-68 nav-mesh) (sv-72 float) (sv-76 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-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))) - (.lvf vf1 (&-> (-> sv-64 vertex) 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-15 vf1) - (let ((f0-1 v1-15) - (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) - ) + (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) ) ) ) @@ -1573,8 +1559,8 @@ ) ) ) - sv-68 ) + sv-68 ) ;; definition for function gunship-event-handler @@ -1945,7 +1931,7 @@ ) (vector-rotate-around-axis! (-> s4-0 fvec) - (the-as quaternion (-> s4-0 fvec)) + (-> s4-0 fvec) (+ 8192.0 (* 16384.0 (the float s2-0))) (-> s4-0 uvec) ) @@ -2701,7 +2687,7 @@ (let ((s5-0 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> this root quat)))) (vector-rotate-around-axis! (-> s5-0 fvec) - (the-as quaternion (-> s5-0 fvec)) + (-> s5-0 fvec) (+ 8192.0 (* 16384.0 (the float arg0))) (-> s5-0 uvec) ) @@ -3636,7 +3622,7 @@ (seek! (-> self current-laser-rotate-speed) (-> self laser-rotate-speed) (* 3640.889 (seconds-per-frame))) (vector-rotate-around-axis! (-> self base-laser-dir) - (the-as quaternion (-> self base-laser-dir)) + (-> self base-laser-dir) (* (-> self current-laser-rotate-speed) (seconds-per-frame)) *up-vector* ) @@ -3715,7 +3701,7 @@ ((time-elapsed? (-> self state-time) (seconds 3)) (dotimes (s3-1 s4-0) (fire-laser self gp-4 s5-0) - (vector-rotate-around-axis! s5-0 (the-as quaternion s5-0) (/ 65536.0 (the float s4-0)) *up-vector*) + (vector-rotate-around-axis! s5-0 s5-0 (/ 65536.0 (the float s4-0)) *up-vector*) ) ) ((time-elapsed? (-> self state-time) (seconds 1.5)) 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 854d1eb77d..73c8675eb1 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 @@ -1246,57 +1246,35 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this cty-sniper-turret-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 4844 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 4844 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 4844) a1-0 s5-1 #f) - (set! (-> *part-id-table* 4844 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 4845) s4-0) - (launch-particles (-> *part-id-table* 4846) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f28-1 (/ f30-0 (meters 16))) - (f30-1 (-> *part-id-table* 4847 init-specs 3 initial-valuef)) - ) - (-> *part-id-table* 4847 init-specs 4 initial-valuef) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 4847 init-specs 3 initial-valuef) (* f28-1 f30-1)) - (launch-particles (-> *part-id-table* 4847) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 4847 init-specs 3 initial-valuef) f30-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 4844 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 4844 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 4844) a1-0 s5-1 #f) + (set! (-> *part-id-table* 4844 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 4845) s4-1) + (launch-particles (-> *part-id-table* 4846) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f28-1 (/ f30-0 (meters 16))) + (f30-1 (-> *part-id-table* 4847 init-specs 3 initial-valuef)) + ) + (-> *part-id-table* 4847 init-specs 4 initial-valuef) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 4847 init-specs 3 initial-valuef) (* f28-1 f30-1)) + (launch-particles (-> *part-id-table* 4847) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 4847 init-specs 3 initial-valuef) f30-1) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 26 of type cty-sniper-turret-shot 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 1087463470..2dd2a5bbf8 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 @@ -641,131 +641,111 @@ ;; WARN: Return type mismatch int vs none. (defmethod move-above-ground! ((this citizen) (arg0 vector) (arg1 move-above-ground-params)) "Move the enemy. May keep the enemy snapped to the ground depending on flags." - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let ((gp-0 (-> this root))) + (set! (-> arg1 on-ground?) #f) + (set! (-> arg1 do-move?) #t) + (vector-copy! (-> arg1 old-gspot-pos) (-> gp-0 gspot-pos)) + (vector-copy! (-> arg1 old-gspot-normal) (-> gp-0 gspot-normal)) + (set! (-> gp-0 trans-old-old-old quad) (-> gp-0 trans-old-old quad)) + (set! (-> gp-0 trans-old-old quad) (-> gp-0 trans-old quad)) + (set! (-> gp-0 trans-old quad) (-> gp-0 trans quad)) + (set! (-> gp-0 prev-status) (-> gp-0 status)) + (vector-v+! (-> gp-0 trans) (-> gp-0 trans) arg0) + (vector-copy! (-> arg1 new-pos) (-> gp-0 trans)) + (when (not (logtest? (logxor (-> this traffic-id) (the-as int (-> this probe-counter))) 7)) + (let ((s2-0 (new 'stack-no-clear 'collide-query))) + (logclear! (-> gp-0 status) (collide-status on-ground)) + (when (enemy-above-ground? + this + s2-0 + (vector+*! (new 'stack-no-clear 'vector) (-> gp-0 trans) (-> gp-0 transv) 0.15) + (-> arg1 gnd-collide-with) + 16384.0 + 81920.0 + 1024.0 + ) + (vector-copy! (-> gp-0 gspot-pos) (-> gp-0 trans)) + (set! (-> gp-0 gspot-pos y) (-> s2-0 best-other-tri intersect y)) + (vector-copy! (-> gp-0 gspot-normal) (-> s2-0 best-other-tri normal)) + (logior! (-> gp-0 status) (collide-status on-ground)) + (set! (-> gp-0 ground-pat) (-> s2-0 best-other-tri pat)) + ) + ) + (set! (-> this gnd-height) (-> gp-0 gspot-pos y)) + (set! (-> gp-0 gspot-pos y) (-> arg1 old-gspot-pos y)) + ) + (let ((f0-5 (- (-> this gnd-height) (-> gp-0 gspot-pos y)))) + (cond + ((< 0.0 f0-5) + (+! (-> gp-0 gspot-pos y) (* 10.0 (seconds-per-frame) f0-5)) ) - (init-vf0-vector) - (let ((gp-0 (-> this root))) - (set! (-> arg1 on-ground?) #f) - (set! (-> arg1 do-move?) #t) - (vector-copy! (-> arg1 old-gspot-pos) (-> gp-0 gspot-pos)) - (vector-copy! (-> arg1 old-gspot-normal) (-> gp-0 gspot-normal)) - (set! (-> gp-0 trans-old-old-old quad) (-> gp-0 trans-old-old quad)) - (set! (-> gp-0 trans-old-old quad) (-> gp-0 trans-old quad)) - (set! (-> gp-0 trans-old quad) (-> gp-0 trans quad)) - (set! (-> gp-0 prev-status) (-> gp-0 status)) - (vector-v+! (-> gp-0 trans) (-> gp-0 trans) arg0) - (vector-copy! (-> arg1 new-pos) (-> gp-0 trans)) - (when (not (logtest? (logxor (-> this traffic-id) (the-as int (-> this probe-counter))) 7)) - (let ((s2-0 (new 'stack-no-clear 'collide-query))) - (logclear! (-> gp-0 status) (collide-status on-ground)) - (let* ((a0-10 this) - (t9-1 (method-of-object a0-10 enemy-above-ground?)) - (a1-2 s2-0) - (a2-2 (new 'stack-no-clear 'vector)) - ) - (let ((v1-15 (-> gp-0 trans))) - (let ((a3-0 (-> gp-0 transv))) - (let ((t0-1 0.15)) - (.mov vf7 t0-1) - ) - (.lvf vf5 (&-> a3-0 quad)) - ) - (.lvf vf4 (&-> v1-15 quad)) + (else + (+! (-> gp-0 gspot-pos y) (* 10.0 (seconds-per-frame) f0-5)) + (if (< (-> gp-0 gspot-pos y) (-> this gnd-height)) + (set! (-> gp-0 gspot-pos y) (-> this gnd-height)) ) - (.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) - (when (t9-1 a0-10 a1-2 a2-2 (-> arg1 gnd-collide-with) 16384.0 81920.0 1024.0) - (vector-copy! (-> gp-0 gspot-pos) (-> gp-0 trans)) - (set! (-> gp-0 gspot-pos y) (-> s2-0 best-other-tri intersect y)) - (vector-copy! (-> gp-0 gspot-normal) (-> s2-0 best-other-tri normal)) - (logior! (-> gp-0 status) (collide-status on-ground)) - (set! (-> gp-0 ground-pat) (-> s2-0 best-other-tri pat)) - ) - ) - ) - (set! (-> this gnd-height) (-> gp-0 gspot-pos y)) - (set! (-> gp-0 gspot-pos y) (-> arg1 old-gspot-pos y)) - ) - (let ((f0-5 (- (-> this gnd-height) (-> gp-0 gspot-pos y)))) - (cond - ((< 0.0 f0-5) - (+! (-> gp-0 gspot-pos y) (* 10.0 (seconds-per-frame) f0-5)) - ) - (else - (+! (-> gp-0 gspot-pos y) (* 10.0 (seconds-per-frame) f0-5)) - (if (< (-> gp-0 gspot-pos y) (-> this gnd-height)) - (set! (-> gp-0 gspot-pos y) (-> this gnd-height)) - ) - ) ) ) - (set! (-> arg1 on-ground?) #t) - (set! (-> arg1 pat) (-> gp-0 ground-pat)) - (when (>= (-> gp-0 gspot-pos y) (-> arg1 new-pos y)) - (set! (-> arg1 new-pos y) (-> gp-0 gspot-pos y)) - (set! (-> gp-0 ground-impact-vel) (- (vector-dot arg0 (-> gp-0 dynam gravity-normal)))) - (set! (-> arg0 y) 0.0) - ) - (vector-copy! (-> gp-0 trans) (-> arg1 new-pos)) - (when (-> arg1 do-move?) - (cond - ((-> arg1 on-ground?) - (let ((a1-3 (-> gp-0 gspot-pos)) - (a0-18 (-> gp-0 gspot-normal)) - (v1-42 (-> arg1 pat)) - ) - (vector-copy! (-> gp-0 ground-touch-point) a1-3) - (vector-copy! (-> gp-0 poly-normal) a0-18) - (vector-copy! (-> gp-0 surface-normal) a0-18) - (vector-copy! (-> gp-0 local-normal) a0-18) - (vector-copy! (-> gp-0 ground-poly-normal) a0-18) - (set! (-> gp-0 poly-pat) v1-42) - (set! (-> gp-0 cur-pat) v1-42) - (set! (-> gp-0 ground-pat) v1-42) - ) - (logior! (-> gp-0 status) (collide-status on-surface on-ground touch-surface)) + ) + (set! (-> arg1 on-ground?) #t) + (set! (-> arg1 pat) (-> gp-0 ground-pat)) + (when (>= (-> gp-0 gspot-pos y) (-> arg1 new-pos y)) + (set! (-> arg1 new-pos y) (-> gp-0 gspot-pos y)) + (set! (-> gp-0 ground-impact-vel) (- (vector-dot arg0 (-> gp-0 dynam gravity-normal)))) + (set! (-> arg0 y) 0.0) + ) + (vector-copy! (-> gp-0 trans) (-> arg1 new-pos)) + (when (-> arg1 do-move?) + (cond + ((-> arg1 on-ground?) + (let ((a1-3 (-> gp-0 gspot-pos)) + (a0-18 (-> gp-0 gspot-normal)) + (v1-42 (-> arg1 pat)) + ) + (vector-copy! (-> gp-0 ground-touch-point) a1-3) + (vector-copy! (-> gp-0 poly-normal) a0-18) + (vector-copy! (-> gp-0 surface-normal) a0-18) + (vector-copy! (-> gp-0 local-normal) a0-18) + (vector-copy! (-> gp-0 ground-poly-normal) a0-18) + (set! (-> gp-0 poly-pat) v1-42) + (set! (-> gp-0 cur-pat) v1-42) + (set! (-> gp-0 ground-pat) v1-42) ) - (else - (logclear! (-> gp-0 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 - ) - ) - (when (not (logtest? (-> gp-0 root-prim prim-core action) (collide-action no-normal-reset))) - (let ((v1-52 (-> gp-0 dynam gravity-normal))) - (vector-copy! (-> gp-0 local-normal) v1-52) - (vector-copy! (-> gp-0 surface-normal) v1-52) - (vector-copy! (-> gp-0 poly-normal) v1-52) - ) - (set! (-> gp-0 coverage) 0.0) - (set! (-> gp-0 touch-angle) 0.0) + (logior! (-> gp-0 status) (collide-status on-surface on-ground touch-surface)) + ) + (else + (logclear! (-> gp-0 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 + ) + ) + (when (not (logtest? (-> gp-0 root-prim prim-core action) (collide-action no-normal-reset))) + (let ((v1-52 (-> gp-0 dynam gravity-normal))) + (vector-copy! (-> gp-0 local-normal) v1-52) + (vector-copy! (-> gp-0 surface-normal) v1-52) + (vector-copy! (-> gp-0 poly-normal) v1-52) ) + (set! (-> gp-0 coverage) 0.0) + (set! (-> gp-0 touch-angle) 0.0) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 160 of type citizen @@ -1217,99 +1197,76 @@ ;; INFO: Used lq/sq (defun iter-seg-clear-path ((arg0 iter-seg) (arg1 nav-segment)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s2-0 (-> arg0 self)) - (a0-1 (-> arg1 branch src-node)) - (s4-0 (new 'stack-no-clear 'vector)) + (let ((s2-0 (-> arg0 self)) + (a0-1 (-> arg1 branch src-node)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s4-0 (-> a0-1 position)) + (set! (-> s4-0 w) 1.0) + (let ((a0-4 (-> arg1 branch dest-node)) + (s3-0 (new 'stack-no-clear 'vector)) ) - (vector-copy! s4-0 (-> a0-1 position)) + (vector-copy! s3-0 (-> a0-4 position)) + (set! (-> s3-0 w) 1.0) + (set! (-> s4-0 y) 0.0) + (set! (-> s3-0 y) 0.0) (set! (-> s4-0 w) 1.0) - (let ((a0-4 (-> arg1 branch dest-node)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s3-0 (-> a0-4 position)) - (set! (-> s3-0 w) 1.0) - (set! (-> s4-0 y) 0.0) - (set! (-> s3-0 y) 0.0) - (set! (-> s4-0 w) 1.0) - (set! (-> s3-0 w) 1.0) - (when *citizen-debug* - ) - (when #t - (cond - ((< 0.0 (vector4-dot (the-as vector (-> arg0 cp-plane)) s3-0)) - (let ((s0-1 (vector-! (new 'stack-no-clear 'vector) s3-0 s4-0)) - (s1-1 (vector-! (new 'stack-no-clear 'vector) (-> s2-0 root trans) s4-0)) - ) - (set! (-> s1-1 y) 0.0) - (vector-rotate90-around-y! s0-1 s0-1) - (vector-normalize! s0-1 1.0) - (let ((a1-3 s1-1)) - (let ((v1-17 s1-1)) - (let ((a0-12 s0-1)) - (let ((a2-2 (- (vector-dot s0-1 s1-1)))) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-12 quad)) - ) - (.lvf vf4 (&-> v1-17 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-3 quad) vf6) + (set! (-> s3-0 w) 1.0) + (when *citizen-debug* + ) + (when #t + (cond + ((< 0.0 (vector4-dot (the-as vector (-> arg0 cp-plane)) s3-0)) + (let ((s0-1 (vector-! (new 'stack-no-clear 'vector) s3-0 s4-0)) + (s1-1 (vector-! (new 'stack-no-clear 'vector) (-> s2-0 root trans) s4-0)) ) - (vector+! s1-1 s1-1 s4-0) - (cond - ((< 0.0 (vector-dot (the-as vector (-> arg0 cp-plane)) (vector-! (new 'stack-no-clear 'vector) s3-0 s1-1))) - (vector-vector-xz-distance s3-0 (-> s2-0 cp-sphere)) - (let ((s1-3 (vector-! (new 'stack-no-clear 'vector) s3-0 (the-as vector (-> s2-0 cp-sphere)))) - (s0-2 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s0-2 (-> s2-0 cp-vec)) - (set! (-> s0-2 y) 0.0) - (vector-normalize! s0-2 1.0) - (set! (-> s1-3 y) 0.0) - (let ((f30-0 (vector-dot s0-2 s1-3))) - (if (and *cty-faction-manager* (not (logtest? (cty-faction-manager-method-9 - *cty-faction-manager* - (the-as int (-> arg1 branch clock-type)) - (-> pp level name) - ) - 1 + (set! (-> s1-1 y) 0.0) + (vector-rotate90-around-y! s0-1 s0-1) + (vector-normalize! s0-1 1.0) + (vector+*! s1-1 s1-1 s0-1 (- (vector-dot s0-1 s1-1))) + (vector+! s1-1 s1-1 s4-0) + (cond + ((< 0.0 (vector-dot (the-as vector (-> arg0 cp-plane)) (vector-! (new 'stack-no-clear 'vector) s3-0 s1-1))) + (vector-vector-xz-distance s3-0 (-> s2-0 cp-sphere)) + (let ((s1-3 (vector-! (new 'stack-no-clear 'vector) s3-0 (the-as vector (-> s2-0 cp-sphere)))) + (s0-2 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s0-2 (-> s2-0 cp-vec)) + (set! (-> s0-2 y) 0.0) + (vector-normalize! s0-2 1.0) + (set! (-> s1-3 y) 0.0) + (let ((f30-0 (vector-dot s0-2 s1-3))) + (if (and *cty-faction-manager* (not (logtest? (cty-faction-manager-method-9 + *cty-faction-manager* + (the-as int (-> arg1 branch clock-type)) + (-> pp level name) ) - ) - ) - (set! f30-0 (+ -409600.0 f30-0)) - ) - (when (< (-> arg0 score) f30-0) - (set! (-> arg0 score) f30-0) - (set! (-> arg0 seg) arg1) + 1 + ) + ) + ) + (set! f30-0 (+ -409600.0 f30-0)) ) + (when (< (-> arg0 score) f30-0) + (set! (-> arg0 score) f30-0) + (set! (-> arg0 seg) arg1) ) ) - (if *citizen-debug* - (add-debug-line #t (bucket-id debug-no-zbuf1) s4-0 s3-0 *color-black* #f *color-white*) - ) ) - (else - (if *citizen-debug* - (add-debug-line #t (bucket-id debug-no-zbuf1) s1-1 s3-0 *color-red* #f (the-as rgba -1)) - ) - ) + (if *citizen-debug* + (add-debug-line #t (bucket-id debug-no-zbuf1) s4-0 s3-0 *color-black* #f *color-white*) + ) + ) + (else + (if *citizen-debug* + (add-debug-line #t (bucket-id debug-no-zbuf1) s1-1 s3-0 *color-red* #f (the-as rgba -1)) + ) ) ) ) - (else - #f - ) + ) + (else + #f ) ) ) 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 bd9ac81272..1edd5490c2 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 @@ -1665,70 +1665,18 @@ ;; definition for function do-spline2 (defun do-spline2 ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((f1-1 (* arg5 arg5)) + (f0-2 (* arg5 f1-1)) ) - (init-vf0-vector) - (let* ((f1-1 (* arg5 arg5)) - (f0-2 (* arg5 f1-1)) - ) - (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) - (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) - (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) - ) - (vector-float*! arg0 arg1 f2-3) - (let ((t2-0 arg0)) - (let ((v1-10 arg0)) - (let ((t1-3 (vector+! (new 'stack-no-clear 'vector) arg1 arg2))) - (let ((a1-1 f3-7)) - (.mov vf7 a1-1) - ) - (.lvf vf5 (&-> t1-3 quad)) - ) - (.lvf vf4 (&-> v1-10 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 (&-> t2-0 quad) vf6) + (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) + (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) + (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) ) - (let ((a2-1 arg0)) - (let ((v1-11 arg0)) - (let ((a1-3 (vector+! (new 'stack-no-clear 'vector) arg3 arg4))) - (let ((t0-1 f1-3)) - (.mov vf7 t0-1) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> v1-11 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-1 quad) vf6) - ) - ) - (let ((v0-0 arg0)) - (let ((v1-12 arg0)) - (let ((a0-1 arg3)) - (let ((a1-4 f0-2)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-12 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 (&-> v0-0 quad) vf6) - v0-0 - ) + (vector-float*! arg0 arg1 f2-3) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg1 arg2) f3-7) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg3 arg4) f1-3) ) + (vector+*! arg0 arg0 arg3 f0-2) ) ) 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 42a32c11c7..0887b229c6 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 @@ -239,125 +239,57 @@ (sv-304 vector) (sv-320 vector) ) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (set! sv-240 arg0) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (let ((v1-1 (-> this root trans))) - (let ((a0-1 *y-vector*)) - (let ((a1-2 8192.0)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-1 quad)) + (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)) ) - (.lvf vf4 (&-> v1-1 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 (&-> 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)) - (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-0 (-> this root trans)) - (cond - ((logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) - (let ((a1-6 s0-0)) - (let ((v1-13 s0-0)) - (let ((a0-9 s4-0)) - (let ((a2-1 4096.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-9 quad)) - ) - (.lvf vf4 (&-> v1-13 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-6 quad) vf6) + (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)) ) - ) - (else - (let ((a1-7 s0-0)) - (let ((v1-14 s0-0)) - (let ((a0-10 s4-0)) - (let ((a2-3 2048.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-10 quad)) - ) - (.lvf vf4 (&-> v1-14 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-7 quad) vf6) - ) - ) - ) - (let ((a1-8 s0-0)) - (let ((v1-15 s0-0)) - (let ((a0-11 s3-0)) - (let ((a2-5 8540.16)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-11 quad)) - ) - (.lvf vf4 (&-> v1-15 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-8 quad) vf6) - ) - (vector-normalize! (vector-! sv-320 sv-240 s0-0) 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-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) - (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+! sv-288 sv-288 v0-5) + ) + (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))) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 260 of type crimson-guard @@ -881,116 +813,81 @@ ;; definition for method 258 of type crimson-guard ;; INFO: Used lq/sq (defmethod crimson-guard-method-258 ((this crimson-guard) (arg0 vector) (arg1 vector) (arg2 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (let ((f0-0 1228.8) - (f30-0 6144.0) - ) - (vector-copy! (-> s5-0 start-pos) arg0) - (vector-! (-> s5-0 move-dist) arg1 arg0) - (let ((v1-4 s5-0)) - (set! (-> v1-4 radius) f0-0) - (set! (-> v1-4 collide-with) (collide-spec backgnd)) - (set! (-> v1-4 ignore-process0) this) - (set! (-> v1-4 ignore-process1) (handle->process (-> this focus handle))) - (set! (-> v1-4 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-4 action-mask) (collide-action solid)) + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (let ((f0-0 1228.8) + (f30-0 6144.0) ) - (let ((f0-1 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) - (cond - ((>= f0-1 0.0) - (vector-float*! (-> s5-0 move-dist) (-> s5-0 move-dist) f0-1) - (cond - ((< (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 + (vector-copy! (-> s5-0 start-pos) arg0) + (vector-! (-> s5-0 move-dist) arg1 arg0) + (let ((v1-4 s5-0)) + (set! (-> v1-4 radius) f0-0) + (set! (-> v1-4 collide-with) (collide-spec backgnd)) + (set! (-> v1-4 ignore-process0) this) + (set! (-> v1-4 ignore-process1) (handle->process (-> this focus handle))) + (set! (-> v1-4 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-4 action-mask) (collide-action solid)) + ) + (let ((f0-1 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) + (cond + ((>= f0-1 0.0) + (vector-float*! (-> s5-0 move-dist) (-> s5-0 move-dist) f0-1) + (cond + ((< (vector-dot + (-> s5-0 best-other-tri normal) + (vector-! (new 'stack-no-clear 'vector) arg2 (the-as vector (-> s5-0 best-other-tri))) ) - (return 1) - ) - (else + 0.0 ) + (return 1) + ) + (else + ) + ) + ) + (else + (vector-! (-> s5-0 move-dist) arg1 arg0) + ) + ) + ) + (vector-copy! (-> s5-0 start-pos) arg0) + (vector+*! (-> s5-0 start-pos) arg0 (-> s5-0 move-dist) -0.1) + (vector+*! (-> s5-0 move-dist) (-> s5-0 move-dist) (-> s5-0 move-dist) 0.1) + (let ((v1-17 s5-0)) + (set! (-> v1-17 radius) f30-0) + (set! (-> v1-17 collide-with) (collide-spec civilian enemy hit-by-player-list hit-by-others-list)) + (set! (-> v1-17 ignore-process0) this) + (set! (-> v1-17 ignore-process1) (handle->process (-> this focus handle))) + (set! (-> v1-17 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-17 action-mask) (collide-action solid)) + ) + ) + (cond + ((< (fill-and-probe-using-line-sphere *collide-cache* s5-0) 0.0) + 0 + ) + (else + (let ((v1-20 (as-type (-> s5-0 best-other-tri collide-ptr) collide-shape-prim))) + (cond + ((and v1-20 (< (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 + ) + ) + (let ((v1-22 (-> (the-as collide-shape-prim v1-20) cshape process))) + (if (and v1-22 (= (-> v1-22 type) target)) + 1 + 2 + ) ) ) (else - (vector-! (-> s5-0 move-dist) arg1 arg0) - ) - ) - ) - (vector-copy! (-> s5-0 start-pos) arg0) - (let ((a0-19 (-> s5-0 start-pos))) - (let ((v1-15 (-> s5-0 move-dist))) - (let ((a1-10 -0.1)) - (.mov vf7 a1-10) - ) - (.lvf vf5 (&-> v1-15 quad)) - ) - (.lvf vf4 (&-> arg0 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-19 quad) vf6) - ) - (let ((a1-11 (-> s5-0 move-dist))) - (let ((v1-16 (-> s5-0 move-dist))) - (let ((a0-20 (-> s5-0 move-dist))) - (let ((a2-4 0.1)) - (.mov vf7 a2-4) - ) - (.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 (&-> a1-11 quad) vf6) - ) - (let ((v1-17 s5-0)) - (set! (-> v1-17 radius) f30-0) - (set! (-> v1-17 collide-with) (collide-spec civilian enemy hit-by-player-list hit-by-others-list)) - (set! (-> v1-17 ignore-process0) this) - (set! (-> v1-17 ignore-process1) (handle->process (-> this focus handle))) - (set! (-> v1-17 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-17 action-mask) (collide-action solid)) - ) - ) - (cond - ((< (fill-and-probe-using-line-sphere *collide-cache* s5-0) 0.0) - 0 - ) - (else - (let ((v1-20 (as-type (-> s5-0 best-other-tri collide-ptr) collide-shape-prim))) - (cond - ((and v1-20 (< (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 - ) - ) - (let ((v1-22 (-> (the-as collide-shape-prim v1-20) cshape process))) - (if (and v1-22 (= (-> v1-22 type) target)) - 1 - 2 - ) - ) - ) - (else - 0 - ) + 0 ) ) ) @@ -1088,7 +985,7 @@ (vector-normalize-copy! s4-2 s5-2 1.0) (quaternion-vector-angle! s0-0 s4-2 (rnd-float-range this -32768.0 32768.0)) (vector-orient-by-quat! s3-1 *y-vector* s0-0) - (vector-rotate-around-axis! s5-2 (the-as quaternion s5-2) (rnd-float-range this -910.2222 910.2222) s3-1) + (vector-rotate-around-axis! s5-2 s5-2 (rnd-float-range this -910.2222 910.2222) s3-1) ) ) (vector+! (-> this target-pos-predict-miss) (-> this root trans) s5-2) @@ -1306,70 +1203,18 @@ ;; definition for function do-spline (defun do-spline ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((f1-1 (* arg5 arg5)) + (f0-2 (* arg5 f1-1)) ) - (init-vf0-vector) - (let* ((f1-1 (* arg5 arg5)) - (f0-2 (* arg5 f1-1)) - ) - (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) - (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) - (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) - ) - (vector-float*! arg0 arg1 f2-3) - (let ((t2-0 arg0)) - (let ((v1-10 arg0)) - (let ((t1-3 (vector+! (new 'stack-no-clear 'vector) arg1 arg2))) - (let ((a1-1 f3-7)) - (.mov vf7 a1-1) - ) - (.lvf vf5 (&-> t1-3 quad)) - ) - (.lvf vf4 (&-> v1-10 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 (&-> t2-0 quad) vf6) + (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) + (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) + (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) ) - (let ((a2-1 arg0)) - (let ((v1-11 arg0)) - (let ((a1-3 (vector+! (new 'stack-no-clear 'vector) arg3 arg4))) - (let ((t0-1 f1-3)) - (.mov vf7 t0-1) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> v1-11 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-1 quad) vf6) - ) - ) - (let ((v0-0 arg0)) - (let ((v1-12 arg0)) - (let ((a0-1 arg3)) - (let ((a1-4 f0-2)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-12 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 (&-> v0-0 quad) vf6) - v0-0 - ) + (vector-float*! arg0 arg1 f2-3) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg1 arg2) f3-7) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg3 arg4) f1-3) ) + (vector+*! arg0 arg0 arg3 f0-2) ) ) @@ -1477,12 +1322,10 @@ (sv-816 nav-poly) (sv-832 vector) ) - (rlet ((acc :class vf) - (vf0 :class vf) + (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) @@ -1496,41 +1339,27 @@ (s0-0 (new 'stack 'collide-query)) ) (vector-rotate-around-y! sv-768 s4-0 (* 182.04445 (the float (+ (* 23 s2-0) -70)))) - (let ((v1-10 s1-0)) - (let ((a0-6 (-> this root trans))) - (let ((a1-5 sv-768)) - (let ((a2-2 1.0)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a1-5 quad)) - ) - (.lvf vf4 (&-> a0-6 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-10 quad) vf6) - ) + (vector+*! s1-0 (-> this root trans) sv-768 1.0) (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)) ) - (let ((v1-14 (-> this nav)) + (let ((v1-15 (-> this nav)) (a0-8 s1-0) (a1-7 (new 'stack-no-clear 'nav-poly)) ) - (vector-! (-> a1-7 vertex 0) a0-8 (the-as vector (-> v1-14 state mesh bounds))) - (set! (-> a1-7 vertex1 x) (-> v1-14 nearest-y-threshold)) + (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-14 state mesh) a1-7)) + (set! sv-816 (nav-mesh-method-45 (-> v1-15 state mesh) a1-7)) ) (when sv-816 - (let* ((v1-18 s4-0) + (let* ((v1-19 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)) + (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) @@ -1548,23 +1377,23 @@ (let ((a3-3 (new 'stack-no-clear 'vector))) (set! sv-800 (-> this nav)) (set! sv-832 sv-784) - (let* ((v1-29 s1-0) + (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-29 (the-as vector (-> sv-800 state mesh bounds)))) + (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-7 a3-3 t0-2) + (t9-7 a0-18 sv-816 a2-6 a3-3 t0-2) ) ) - (let ((v1-30 sv-832)) + (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-30 quad) vf6) + (.svf (&-> v1-31 quad) vf6) ) 0 (set! (-> s1-0 y) (-> sv-784 y)) 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 c241a5462d..f39c6abc72 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 @@ -1037,53 +1037,38 @@ ;; definition for method 228 of type metalhead-grunt (defmethod metalhead-grunt-method-228 ((this metalhead-grunt) (arg0 float)) - (local-vars (v1-5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (get-focus! this))) - (when gp-0 - (let ((v1-3 (get-trans gp-0 0)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (vector-! s4-0 v1-3 (-> this 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-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 ((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)))) - (go (method-of-object this attack)) - ) - ((let ((f0-10 12288.0)) - (< f30-0 (* f0-10 f0-10)) - ) - (go (method-of-object this spin-attack)) - ) + (let ((gp-0 (get-focus! this))) + (when gp-0 + (let ((v1-3 (get-trans gp-0 0)) + (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 ((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)))) + (go (method-of-object this attack)) + ) + ((let ((f0-10 12288.0)) + (< f30-0 (* f0-10 f0-10)) + ) + (go (method-of-object this spin-attack)) + ) ) ) ) ) ) - gp-0 ) + gp-0 ) ) 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 bcaf7605f2..1f833c45f4 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 @@ -773,37 +773,23 @@ (let ((s0-0 (new 'stack-no-clear 'vector)) (s1-1 (new 'stack-no-clear 'vector)) ) - (let ((a0-20 s2-0)) - (let ((v1-34 s2-0)) - (let ((a1-6 (-> s3-0 root transv))) - (let ((a2-2 f0-6)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a1-6 quad)) - ) - (.lvf vf4 (&-> v1-34 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-20 quad) vf6) - ) + (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) (vector-normalize! sv-288 1.0) (vector-cross! s0-0 sv-272 sv-288) (vector-normalize! s0-0 1.0) - (let ((a2-5 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) sv-272 (-> this shoot-angle)))) - (vector-orient-by-quat! sv-288 sv-288 a2-5) + (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-28 (new 'stack-no-clear 'quaternion)) - (a2-6 (-> this shoot-angle)) - (a2-7 (t9-9 a0-28 sv-272 a2-6)) + (a0-29 (new 'stack-no-clear 'quaternion)) + (a2-5 (-> this shoot-angle)) + (a2-6 (t9-9 a0-29 sv-272 a2-5)) ) - (vector-orient-by-quat! s0-0 s0-0 a2-7) + (vector-orient-by-quat! s0-0 s0-0 a2-6) ) - (let ((a0-30 s1-1)) + (let ((a0-31 s1-1)) (let ((v1-36 s2-0)) (let ((a1-17 (-> this miss-amount))) (.mov vf7 a1-17) @@ -814,19 +800,9 @@ (.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-30 quad) vf6) - ) - (let ((v1-37 s2-0)) - (let ((a0-31 (* arg1 (-> this miss-amount)))) - (.mov vf7 a0-31) - ) - (.lvf vf5 (&-> s0-0 quad)) - (.lvf vf4 (&-> s1-1 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-37 quad) vf6) + (.svf (&-> a0-31 quad) vf6) ) + (vector+*! s2-0 s1-1 s0-0 (* arg1 (-> this miss-amount))) ) ) (vector-! (-> s5-0 vel) s2-0 (-> s5-0 pos)) 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 64c54061c7..0892074668 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 @@ -971,162 +971,138 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod update-danger-from-target ((this traffic-engine)) - (local-vars (v1-20 float) (v1-32 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 *target*)) - (when s5-0 - (let ((v1-1 (-> this danger-sphere-array))) - (set! (-> v1-1 0 handle) (process->handle s5-0)) - (let ((a0-4 (-> s5-0 focus-status)) - (f0-0 0.0) - (f1-0 0.0) - (f3-0 1.0) - (f2-0 0.0) - ) - (cond - ((logtest? (focus-status mech dark shooting) a0-4) - (set! f0-0 245760.0) - (set! f1-0 163840.0) - (set! f2-0 1.0) - (set! f3-0 0.0) - ) - ((logtest? (focus-status gun) a0-4) - (set! f0-0 102400.0) - (set! f1-0 61440.0) - (set! f2-0 0.5) - (set! f3-0 0.5) - ) - ((logtest? (focus-status flut board pilot) a0-4) - (set! f0-0 40960.0) - (set! f1-0 24576.0) - (set! f2-0 0.5) - ) - ((logtest? a0-4 (focus-status dangerous)) - (set! f0-0 61440.0) - (set! f1-0 40960.0) - (set! f3-0 0.0) - (set! f2-0 0.5) - ) - (else - (set! f3-0 1.5) - ) + (let ((s5-0 *target*)) + (when s5-0 + (let ((v1-1 (-> this danger-sphere-array))) + (set! (-> v1-1 0 handle) (process->handle s5-0)) + (let ((a0-4 (-> s5-0 focus-status)) + (f0-0 0.0) + (f1-0 0.0) + (f3-0 1.0) + (f2-0 0.0) ) - (set! (-> v1-1 0 decay-rate) (/ f3-0 10)) - (when (< (-> v1-1 0 danger-level) f2-0) - (set! (-> v1-1 0 danger-level) f2-0) - (set! (-> v1-1 0 sphere r) f1-0) - (set! (-> v1-1 0 notify-radius) f0-0) + (cond + ((logtest? (focus-status mech dark shooting) a0-4) + (set! f0-0 245760.0) + (set! f1-0 163840.0) + (set! f2-0 1.0) + (set! f3-0 0.0) + ) + ((logtest? (focus-status gun) a0-4) + (set! f0-0 102400.0) + (set! f1-0 61440.0) + (set! f2-0 0.5) + (set! f3-0 0.5) + ) + ((logtest? (focus-status flut board pilot) a0-4) + (set! f0-0 40960.0) + (set! f1-0 24576.0) + (set! f2-0 0.5) + ) + ((logtest? a0-4 (focus-status dangerous)) + (set! f0-0 61440.0) + (set! f1-0 40960.0) + (set! f3-0 0.0) + (set! f2-0 0.5) + ) + (else + (set! f3-0 1.5) ) ) - (let ((f0-1 (-> v1-1 0 sphere r))) - (set! (-> v1-1 0 sphere quad) (-> s5-0 control trans quad)) - (set! (-> v1-1 0 sphere r) f0-1) - ) - (vector-copy! (-> v1-1 0 velocity) (-> s5-0 control transv)) - (let ((f0-3 (- (-> v1-1 0 danger-level) (* (-> v1-1 0 decay-rate) (seconds-per-frame))))) - (set! (-> v1-1 0 danger-level) (fmax 0.0 f0-3)) + (set! (-> v1-1 0 decay-rate) (/ f3-0 10)) + (when (< (-> v1-1 0 danger-level) f2-0) + (set! (-> v1-1 0 danger-level) f2-0) + (set! (-> v1-1 0 sphere r) f1-0) + (set! (-> v1-1 0 notify-radius) f0-0) ) ) - (let ((s3-0 (-> s5-0 focus-status)) - (f30-0 0.0) - (s4-0 (new 'stack-no-clear 'inline-array 'traffic-suppression-box 2)) - ) - (vector-copy! (-> s4-0 0 bbox max) (-> s5-0 control transv)) - (vector-z-quaternion! (the-as vector (-> s4-0 1)) (get-quat s5-0 3)) - (set! (-> s4-0 1 data 16) (the-as uint 3)) - (cond - ((logtest? (focus-status shooting) s3-0) - (vector-float*! (the-as vector (-> s4-0 0)) (the-as vector (-> s4-0 1)) 409600.0) - (set! f30-0 4096.0) - (set! (-> s4-0 1 data 16) (the-as uint 0)) - 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)) - ) - (.lvf vf1 (&-> v1-19 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-20 vf1) - (< f0-8 v1-20) - ) - ) - ) - ) - (vector-float*! (the-as vector (-> s4-0 0)) (the-as vector (-> s4-0 1)) 163840.0) - (set! f30-0 8192.0) - (set! (-> s4-0 1 data 16) (the-as uint 1)) - ) - ((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) - (f0-13 (* f0-11 f0-11)) - ) - (.lvf vf1 (&-> v1-31 bbox min 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-13 v1-32) - (set! f30-0 20480.0) - ) - ) - (set! (-> s4-0 1 data 16) (the-as uint (cond - ((logtest? (focus-status pilot) s3-0) - 3 - ) - ((logtest? (focus-status flut board) s3-0) - 2 - ) - ((logtest? s3-0 (focus-status dangerous)) - 4 - ) - (else - 5 - ) - ) - ) - ) - ) + (let ((f0-1 (-> v1-1 0 sphere r))) + (set! (-> v1-1 0 sphere quad) (-> s5-0 control trans quad)) + (set! (-> v1-1 0 sphere r) f0-1) + ) + (vector-copy! (-> v1-1 0 velocity) (-> s5-0 control transv)) + (let ((f0-3 (- (-> v1-1 0 danger-level) (* (-> v1-1 0 decay-rate) (seconds-per-frame))))) + (set! (-> v1-1 0 danger-level) (fmax 0.0 f0-3)) + ) + ) + (let ((s3-0 (-> s5-0 focus-status)) + (f30-0 0.0) + (s4-0 (new 'stack-no-clear 'inline-array 'traffic-suppression-box 2)) ) - (when (< 0.0 f30-0) - (let ((s3-1 (new 'stack-no-clear 'array 'collide-shape 40)) - (s2-1 (new 'stack 'traffic-danger-info)) - ) - (set! (-> s2-1 sphere quad) (-> s5-0 control trans quad)) - (set! (-> s2-1 danger-type) (-> s4-0 1 data 16)) - (set! (-> s2-1 sphere r) f30-0) - (vector-copy! (-> s2-1 velocity) (-> s4-0 0 bbox min)) - (let ((gp-1 (fill-actor-list-for-sphere - (-> this object-hash) - (-> s2-1 sphere) - (-> s2-1 velocity) - (-> s2-1 sphere r) - s3-1 - 40 - -1 - ) + (vector-copy! (-> s4-0 0 bbox max) (-> s5-0 control transv)) + (vector-z-quaternion! (the-as vector (-> s4-0 1)) (get-quat s5-0 3)) + (set! (-> s4-0 1 data 16) (the-as uint 3)) + (cond + ((logtest? (focus-status shooting) s3-0) + (vector-float*! (the-as vector (-> s4-0 0)) (the-as vector (-> s4-0 1)) 409600.0) + (set! f30-0 4096.0) + (set! (-> s4-0 1 data 16) (the-as uint 0)) + 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)) + ) + ) + ) + ) + (vector-float*! (the-as vector (-> s4-0 0)) (the-as vector (-> s4-0 1)) 163840.0) + (set! f30-0 8192.0) + (set! (-> s4-0 1 data 16) (the-as uint 1)) + ) + ((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))) + (set! f30-0 20480.0) + ) + ) + (set! (-> s4-0 1 data 16) (the-as uint (cond + ((logtest? (focus-status pilot) s3-0) + 3 + ) + ((logtest? (focus-status flut board) s3-0) + 2 + ) + ((logtest? s3-0 (focus-status dangerous)) + 4 + ) + (else + 5 + ) + ) + ) + ) + ) + ) + (when (< 0.0 f30-0) + (let ((s3-1 (new 'stack-no-clear 'array 'collide-shape 40)) + (s2-1 (new 'stack 'traffic-danger-info)) + ) + (set! (-> s2-1 sphere quad) (-> s5-0 control trans quad)) + (set! (-> s2-1 danger-type) (-> s4-0 1 data 16)) + (set! (-> s2-1 sphere r) f30-0) + (vector-copy! (-> s2-1 velocity) (-> s4-0 0 bbox min)) + (let ((gp-1 (fill-actor-list-for-sphere + (-> this object-hash) + (-> s2-1 sphere) + (-> s2-1 velocity) + (-> s2-1 sphere r) + s3-1 + 40 + -1 ) - ) - (dotimes (s5-1 gp-1) - (let ((a0-52 (as-type (-> s3-1 s5-1) citizen))) - (if a0-52 - (send-event (the-as process-tree a0-52) 'clear-path s2-1) ) - ) + ) + (dotimes (s5-1 gp-1) + (let ((a0-52 (as-type (-> s3-1 s5-1) citizen))) + (if a0-52 + (send-event (the-as process-tree a0-52) 'clear-path s2-1) + ) ) ) ) @@ -1134,9 +1110,9 @@ ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 53 of type traffic-engine 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 574bc1b0f0..989fd19c48 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 @@ -141,61 +141,38 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod vehicle-controller-method-20 ((this vehicle-controller) (arg0 vector) (arg1 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (set! (-> this max-turn-speed) (sqrtf (* (fmax 16384.0 arg1) (-> this turn-accel)))) - (let ((v1-1 (new 'stack-no-clear 'inline-array 'vector 2))) - (vector-! (-> v1-1 1) (-> this turn-exit-point) arg0) - (vector-copy! (-> v1-1 0) (-> this turn-exit-dir)) - (set! (-> v1-1 0 x) (-> this turn-exit-dir z)) - (set! (-> v1-1 0 z) (- (-> this turn-exit-dir x))) - (logior! (-> this flags) (vehicle-controller-flag left-turn)) - (when (< 0.0 (vector-dot (-> v1-1 1) (-> v1-1 0))) - (logclear! (-> this flags) (vehicle-controller-flag left-turn)) - (vector-float*! (-> v1-1 0) (-> v1-1 0) -1.0) - ) - (let ((a1-6 (-> this dest-circle))) - (let ((a0-12 (-> this turn-exit-point))) - (let ((v1-2 (-> v1-1 0))) - (let ((a3-3 arg1)) - (.mov vf7 a3-3) - ) - (.lvf vf5 (&-> v1-2 quad)) - ) - (.lvf vf4 (&-> a0-12 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-6 quad) vf6) - ) + (set! (-> this max-turn-speed) (sqrtf (* (fmax 16384.0 arg1) (-> this turn-accel)))) + (let ((v1-1 (new 'stack-no-clear 'inline-array 'vector 2))) + (vector-! (-> v1-1 1) (-> this turn-exit-point) arg0) + (vector-copy! (-> v1-1 0) (-> this turn-exit-dir)) + (set! (-> v1-1 0 x) (-> this turn-exit-dir z)) + (set! (-> v1-1 0 z) (- (-> this turn-exit-dir x))) + (logior! (-> this flags) (vehicle-controller-flag left-turn)) + (when (< 0.0 (vector-dot (-> v1-1 1) (-> v1-1 0))) + (logclear! (-> this flags) (vehicle-controller-flag left-turn)) + (vector-float*! (-> v1-1 0) (-> v1-1 0) -1.0) ) - (set! (-> this dest-circle w) arg1) - 0 - (vehicle-controller-method-16 this (-> this path-prev-point) (-> this turn-enter-point)) - (vector-copy! (-> this target-point) (-> this turn-enter-point)) - (vector-! (-> this turn-enter-dir) (-> this turn-enter-point) (-> this path-prev-point)) - (set! (-> this turn-enter-dir y) 0.0) - (vector-normalize! (-> this turn-enter-dir) 1.0) - (let ((f0-12 (cos 8192.0)) - (f30-0 (vector-dot (-> this turn-enter-dir) (-> this turn-exit-dir))) - ) - (set! (-> this max-turn-speed) - (* (-> this max-turn-speed) (+ 1.0 (fmax 0.0 (/ (- f30-0 f0-12) (- 1.0 f0-12))))) - ) - (if (>= f30-0 (cos 1820.4445)) - (set! (-> this max-turn-speed) 409600.0) - ) - ) - 0 - (none) + (vector+*! (-> this dest-circle) (-> this turn-exit-point) (-> v1-1 0) arg1) ) + (set! (-> this dest-circle w) arg1) + 0 + (vehicle-controller-method-16 this (-> this path-prev-point) (-> this turn-enter-point)) + (vector-copy! (-> this target-point) (-> this turn-enter-point)) + (vector-! (-> this turn-enter-dir) (-> this turn-enter-point) (-> this path-prev-point)) + (set! (-> this turn-enter-dir y) 0.0) + (vector-normalize! (-> this turn-enter-dir) 1.0) + (let ((f0-12 (cos 8192.0)) + (f30-0 (vector-dot (-> this turn-enter-dir) (-> this turn-exit-dir))) + ) + (set! (-> this max-turn-speed) + (* (-> this max-turn-speed) (+ 1.0 (fmax 0.0 (/ (- f30-0 f0-12) (- 1.0 f0-12))))) + ) + (if (>= f30-0 (cos 1820.4445)) + (set! (-> this max-turn-speed) 409600.0) + ) + ) + 0 + (none) ) ;; definition for method 19 of type vehicle-controller @@ -312,74 +289,37 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod vehicle-controller-method-16 ((this vehicle-controller) (arg0 vector) (arg1 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (new 'stack-no-clear 'inline-array 'vector 2))) - (vector-! (-> s4-0 0) (-> this dest-circle) arg0) - (set! (-> s4-0 0 y) 0.0) - (let* ((v1-1 (-> s4-0 0)) - (f30-0 (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z))))) - (f28-0 (-> this dest-circle w)) - ) - (vector-xz-normalize! (-> s4-0 0) 1.0) - (set! (-> s4-0 1 x) (-> s4-0 0 z)) - (set! (-> s4-0 1 y) 0.0) - (set! (-> s4-0 1 z) (- (-> s4-0 0 x))) - (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)))) - (f0-15 (/ (* f28-0 f1-6) f30-0)) - ) - (let ((f1-9 (/ (* f1-6 f1-6) f30-0))) - (vector-copy! arg1 arg0) - (let ((a1-5 arg1)) - (let ((v1-12 arg1)) - (let ((a0-5 (-> s4-0 0))) - (let ((a2-1 f1-9)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-5 quad)) - ) - (.lvf vf4 (&-> v1-12 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-5 quad) vf6) - ) - ) - (let ((a0-6 arg1)) - (let ((v1-13 arg1)) - (let ((a1-6 (-> s4-0 1))) - (let ((a2-2 f0-15)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a1-6 quad)) - ) - (.lvf vf4 (&-> v1-13 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-6 quad) vf6) - ) + (let ((s4-0 (new 'stack-no-clear 'inline-array 'vector 2))) + (vector-! (-> s4-0 0) (-> this dest-circle) arg0) + (set! (-> s4-0 0 y) 0.0) + (let* ((v1-1 (-> s4-0 0)) + (f30-0 (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z))))) + (f28-0 (-> this dest-circle w)) + ) + (vector-xz-normalize! (-> s4-0 0) 1.0) + (set! (-> s4-0 1 x) (-> s4-0 0 z)) + (set! (-> s4-0 1 y) 0.0) + (set! (-> s4-0 1 z) (- (-> s4-0 0 x))) + (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)))) + (f0-15 (/ (* f28-0 f1-6) f30-0)) + ) + (let ((f1-9 (/ (* f1-6 f1-6) f30-0))) + (vector-copy! arg1 arg0) + (vector+*! arg1 arg1 (-> s4-0 0) f1-9) + ) + (vector+*! arg1 arg1 (-> s4-0 1) f0-15) ) ) - (set! (-> arg1 y) (-> this turn-exit-point y)) - 0 - (none) ) + (set! (-> arg1 y) (-> this turn-exit-point y)) + 0 + (none) ) ;; definition for method 10 of type vehicle-controller 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 e1536bcaac..492199a7e9 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 @@ -338,100 +338,63 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun vehicle-draw-thruster ((arg0 vehicle-particle-common-info) (arg1 vehicle-draw-thruster-params)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vehicle-thruster-work))) - (vector-copy! (-> s5-0 vec2) (-> arg1 trans)) - (quaternion-copy! (-> s5-0 quat1) (-> arg1 quat)) - (quaternion-rotate-local-x! (-> s5-0 quat1) (-> s5-0 quat1) 32768.0) - (quaternion->matrix (the-as matrix (-> s5-0 quat0)) (-> s5-0 quat1)) - (vector-copy! (-> s5-0 vec4) (-> s5-0 vec0)) - (let ((f0-0 (rand-vu-float-range 1.0 1.33))) - (set! (-> s5-0 float0) (* f0-0 (-> arg1 length) (-> arg1 thrust))) - (set! (-> s5-0 float1) (fmin (* (-> arg1 width) f0-0) (/ (-> s5-0 float0) 2))) - ) - (let ((a1-5 (-> s5-0 vec3))) - (let ((v1-4 (-> arg1 trans))) - (let ((a0-9 (-> s5-0 vec4))) - (let ((a2-2 (/ (-> s5-0 float0) 4))) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-9 quad)) - ) - (.lvf vf4 (&-> v1-4 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-5 quad) vf6) - ) - (quad-copy! (the-as pointer (-> s5-0 glow)) (the-as pointer (-> arg0 thruster-glow-template)) 4) - (let* ((v1-5 (-> s5-0 glow)) - (a1-7 (-> s5-0 vec3)) - (f0-5 (-> v1-5 position w)) - ) - (vector-copy! (-> v1-5 position) a1-7) - (set! (-> v1-5 position w) f0-5) - ) - 0 - (set! (-> s5-0 glow color y) (rand-vu-float-range 0.0 64.0)) - (set! (-> s5-0 glow color w) (* (-> arg1 fog-fade) (+ (* 16.0 (-> arg1 thrust)) (* 4.0 (rand-vu))))) - (let ((f0-13 (* 4.0 (-> s5-0 float1)))) - (set! (-> s5-0 glow position w) f0-13) - (set! (-> s5-0 glow size-y) f0-13) - (set! (-> s5-0 glow size-probe) (/ f0-13 40)) - ) - (add! *simple-sprite-system* (-> s5-0 glow)) - (let ((v1-15 (-> s5-0 vec3))) - (let ((a0-14 (-> arg1 trans))) - (let ((a1-11 (-> s5-0 vec4))) - (let ((a2-5 (/ (-> s5-0 float0) 2))) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a1-11 quad)) - ) - (.lvf vf4 (&-> a0-14 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-15 quad) vf6) - ) - (set! (-> arg0 part-thruster-x initial-valuef) (-> s5-0 float1)) - (set! (-> arg0 part-spec2 initial-valuef) (-> s5-0 float0)) - (vector-copy! (-> s5-0 vec1) (-> s5-0 vec3)) - (launch-particles - :system (-> arg0 sp-system3d) - (-> arg0 part-thruster) - (the-as matrix (-> s5-0 quat0)) - :origin-is-matrix #t - ) - (quaternion-rotate-local-z! (-> s5-0 quat1) (-> s5-0 quat1) 10922.667) - (quaternion->matrix (the-as matrix (-> s5-0 quat0)) (-> s5-0 quat1)) - (vector-copy! (-> s5-0 vec1) (-> s5-0 vec3)) - (launch-particles - :system (-> arg0 sp-system3d) - (-> arg0 part-thruster) - (the-as matrix (-> s5-0 quat0)) - :origin-is-matrix #t - ) - (quaternion-rotate-local-z! (-> s5-0 quat1) (-> s5-0 quat1) 10922.667) - (quaternion->matrix (the-as matrix (-> s5-0 quat0)) (-> s5-0 quat1)) - (vector-copy! (-> s5-0 vec1) (-> s5-0 vec3)) - (launch-particles - :system (-> arg0 sp-system3d) - (-> arg0 part-thruster) - (the-as matrix (-> s5-0 quat0)) - :origin-is-matrix #t - ) + (let ((s5-0 (new 'stack-no-clear 'vehicle-thruster-work))) + (vector-copy! (-> s5-0 vec2) (-> arg1 trans)) + (quaternion-copy! (-> s5-0 quat1) (-> arg1 quat)) + (quaternion-rotate-local-x! (-> s5-0 quat1) (-> s5-0 quat1) 32768.0) + (quaternion->matrix (the-as matrix (-> s5-0 quat0)) (-> s5-0 quat1)) + (vector-copy! (-> s5-0 vec4) (-> s5-0 vec0)) + (let ((f0-0 (rand-vu-float-range 1.0 1.33))) + (set! (-> s5-0 float0) (* f0-0 (-> arg1 length) (-> arg1 thrust))) + (set! (-> s5-0 float1) (fmin (* (-> arg1 width) f0-0) (/ (-> s5-0 float0) 2))) + ) + (vector+*! (-> s5-0 vec3) (-> arg1 trans) (-> s5-0 vec4) (/ (-> s5-0 float0) 4)) + (quad-copy! (the-as pointer (-> s5-0 glow)) (the-as pointer (-> arg0 thruster-glow-template)) 4) + (let* ((v1-5 (-> s5-0 glow)) + (a1-8 (-> s5-0 vec3)) + (f0-5 (-> v1-5 position w)) + ) + (vector-copy! (-> v1-5 position) a1-8) + (set! (-> v1-5 position w) f0-5) ) 0 - (none) + (set! (-> s5-0 glow color y) (rand-vu-float-range 0.0 64.0)) + (set! (-> s5-0 glow color w) (* (-> arg1 fog-fade) (+ (* 16.0 (-> arg1 thrust)) (* 4.0 (rand-vu))))) + (let ((f0-13 (* 4.0 (-> s5-0 float1)))) + (set! (-> s5-0 glow position w) f0-13) + (set! (-> s5-0 glow size-y) f0-13) + (set! (-> s5-0 glow size-probe) (/ f0-13 40)) + ) + (add! *simple-sprite-system* (-> s5-0 glow)) + (vector+*! (-> s5-0 vec3) (-> arg1 trans) (-> s5-0 vec4) (/ (-> s5-0 float0) 2)) + (set! (-> arg0 part-thruster-x initial-valuef) (-> s5-0 float1)) + (set! (-> arg0 part-spec2 initial-valuef) (-> s5-0 float0)) + (vector-copy! (-> s5-0 vec1) (-> s5-0 vec3)) + (launch-particles + :system (-> arg0 sp-system3d) + (-> arg0 part-thruster) + (the-as matrix (-> s5-0 quat0)) + :origin-is-matrix #t + ) + (quaternion-rotate-local-z! (-> s5-0 quat1) (-> s5-0 quat1) 10922.667) + (quaternion->matrix (the-as matrix (-> s5-0 quat0)) (-> s5-0 quat1)) + (vector-copy! (-> s5-0 vec1) (-> s5-0 vec3)) + (launch-particles + :system (-> arg0 sp-system3d) + (-> arg0 part-thruster) + (the-as matrix (-> s5-0 quat0)) + :origin-is-matrix #t + ) + (quaternion-rotate-local-z! (-> s5-0 quat1) (-> s5-0 quat1) 10922.667) + (quaternion->matrix (the-as matrix (-> s5-0 quat0)) (-> s5-0 quat1)) + (vector-copy! (-> s5-0 vec1) (-> s5-0 vec3)) + (launch-particles + :system (-> arg0 sp-system3d) + (-> arg0 part-thruster) + (the-as matrix (-> s5-0 quat0)) + :origin-is-matrix #t + ) ) + 0 + (none) ) 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 df3c5e21ee..193287a3e5 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 @@ -250,92 +250,69 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defbehavior vehicle-explode-post vehicle () - (local-vars (v1-42 float) (v1-47 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (set! (-> self camera-dist2) (vector-vector-distance-squared (-> self root trans) (camera-pos))) - (set! (-> self player-dist2) (vector-vector-distance-squared (-> self root trans) (target-pos 0))) - (cond - ((logtest? (-> self draw status) (draw-control-status on-screen)) - (set! (-> self offscreen-time) (the-as uint (current-time))) - ) - (else - (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)) + (set! (-> self camera-dist2) (vector-vector-distance-squared (-> self root trans) (camera-pos))) + (set! (-> self player-dist2) (vector-vector-distance-squared (-> self root trans) (target-pos 0))) + (cond + ((logtest? (-> self draw status) (draw-control-status on-screen)) + (set! (-> self offscreen-time) (the-as uint (current-time))) + ) + (else + (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)) + ) + ) + (go-virtual die) + ) + ) + ) + ) + (let ((f0-5 819200.0)) + (if (< (* f0-5 f0-5) (-> 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))) ) ) - (go-virtual die) - ) - ) - ) - ) - (let ((f0-5 819200.0)) - (if (< (* f0-5 f0-5) (-> 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))) - ) - (.lvf vf1 (&-> (-> self 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-42 vf1) - (if (and (< v1-42 f0-13) (begin - (.lvf vf1 (&-> (-> self rbody lin-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-47 vf1) - (let ((f1-9 v1-47) - (f2-0 614.4) - ) - (< f1-9 (* f0-13 (* f2-0 f2-0))) - ) - ) - ) - (logclear! (-> self v-flags) (vehicle-flag disturbed)) - ) - ) - ) - (when (not (vehicle-method-102 self)) - (disable-physics! self) - (let ((gp-2 (-> self rbody))) - (logclear! (-> gp-2 flags) (rigid-body-flag enable-physics active)) - (vehicle-method-142 self) - (set! (-> gp-2 force quad) (the-as uint128 0)) - (set! (-> gp-2 torque quad) (the-as uint128 0)) - ) - 0 - (logior! (-> self v-flags) (vehicle-flag nav-spheres)) - (vehicle-method-140 self) + (logclear! (-> self v-flags) (vehicle-flag disturbed)) + ) ) ) - (else - (rigid-body-object-method-30 self) - ) + (when (not (vehicle-method-102 self)) + (disable-physics! self) + (let ((gp-2 (-> self rbody))) + (logclear! (-> gp-2 flags) (rigid-body-flag enable-physics active)) + (vehicle-method-142 self) + (set! (-> gp-2 force quad) (the-as uint128 0)) + (set! (-> gp-2 torque quad) (the-as uint128 0)) + ) + 0 + (logior! (-> self v-flags) (vehicle-flag nav-spheres)) + (vehicle-method-140 self) + ) + ) + (else + (rigid-body-object-method-30 self) ) - 0 - (none) ) + 0 + (none) ) ;; failed to figure out what this is: 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 357e866d29..2adc722ae7 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 @@ -1295,48 +1295,25 @@ ;; definition for method 103 of type vehicle ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-103 ((this vehicle)) - (local-vars (v1-8 float) (v1-13 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 (and (< v1-8 f0-1) (begin - (.lvf vf1 (&-> (-> this rbody lin-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-13 vf1) - (let ((f1-4 v1-13) - (f2-0 614.4) - ) - (< f1-4 (* f0-1 (* f2-0 f2-0))) - ) - ) + (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))) + ) + (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))) ) - (logclear! (-> this v-flags) (vehicle-flag disturbed)) - (vehicle-method-142 this) - ) + ) + (logclear! (-> this v-flags) (vehicle-flag disturbed)) + (vehicle-method-142 this) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 79 of type vehicle 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 5f2fd4c528..10d87a1fce 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 @@ -41,137 +41,122 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod on-impact ((this vehicle) (arg0 rigid-body-impact)) - (local-vars (v1-79 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) + (logior! (-> this v-flags) (vehicle-flag impact)) + (vector-copy! (-> this impact-pos) (-> arg0 point)) + (let ((s4-0 (new 'stack-no-clear 'matrix))) + (matrix-inverse-of-rot-trans! (the-as matrix (-> s4-0 rvec)) (-> this rbody matrix)) + (vector-matrix*! (-> this impact-local-pos) (-> this impact-pos) (the-as matrix (-> s4-0 rvec))) + ) + (set! (-> this prev-impact-time) (-> this impact-time)) + (set! (-> this impact-time) (the-as uint (current-time))) + (set! (-> this impact-pat) (the-as uint (-> arg0 pat))) + (set! (-> this impact-proc) (the-as handle #f)) + (let ((a0-5 (-> arg0 process))) + (if a0-5 + (set! (-> this impact-proc) (process->handle a0-5)) + ) + ) + (let ((s4-1 (-> this info)) + (f0-0 1.0) + ) + (let ((v1-14 (-> arg0 prim-id))) + (if (logtest? v1-14 512) + (set! f0-0 (* 1.5 f0-0)) + ) + (if (logtest? v1-14 1024) + (set! f0-0 (* 2.0 f0-0)) + ) + (if (logtest? v1-14 2048) + (set! f0-0 (* 4.0 f0-0)) + ) + (if (logtest? v1-14 256) + (set! f0-0 (/ 1.0 f0-0)) + ) + ) + (let ((f30-0 (* (-> arg0 impulse) f0-0 (-> s4-1 info inv-mass) (-> s4-1 damage inv-toughness-factor)))) + (set! (-> this crash-impulse) (-> arg0 impulse)) + (cond + ((< f30-0 (-> s4-1 damage hit-threshold)) ) - (init-vf0-vector) - (logior! (-> this v-flags) (vehicle-flag impact)) - (vector-copy! (-> this impact-pos) (-> arg0 point)) - (let ((s4-0 (new 'stack-no-clear 'matrix))) - (matrix-inverse-of-rot-trans! (the-as matrix (-> s4-0 rvec)) (-> this rbody matrix)) - (vector-matrix*! (-> this impact-local-pos) (-> this impact-pos) (the-as matrix (-> s4-0 rvec))) - ) - (set! (-> this prev-impact-time) (-> this impact-time)) - (set! (-> this impact-time) (the-as uint (current-time))) - (set! (-> this impact-pat) (the-as uint (-> arg0 pat))) - (set! (-> this impact-proc) (the-as handle #f)) - (let ((a0-5 (-> arg0 process))) - (if a0-5 - (set! (-> this impact-proc) (process->handle a0-5)) + ((>= f30-0 (-> s4-1 damage hit-deadly)) + (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 1)) + 0 + ) + (apply-damage this (* 2.0 (-> s4-1 damage hit-points)) arg0) + (vehicle-method-74 this 2 (seconds 1)) + ) + ((>= f30-0 (-> s4-1 damage hit-big)) + (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) + 0 + ) + (apply-damage this (* 10.0 (-> s4-1 damage impact-damage-factor)) arg0) + (vehicle-method-74 this 1 (seconds 0.25)) + ) + ((>= f30-0 (-> s4-1 damage hit-small)) + (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.25)) + 0 + ) + (apply-damage this (* 5.0 (-> s4-1 damage impact-damage-factor)) arg0) + (vehicle-method-74 this 1 (seconds 0.25)) + ) + (else + (let* ((f0-14 0.0) + (f1-10 40.0) + (f2-0 16384000.0) + (f0-15 (fmax f0-14 (* f1-10 (/ 1.0 f2-0) (- f30-0 (-> s4-1 damage hit-threshold))))) + ) + (apply-damage this (* f0-15 (-> s4-1 damage impact-damage-factor)) arg0) + ) + (when (< 32768.0 f30-0) + (if (logtest? (vehicle-flag player-driving) (-> this v-flags)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.1)) + ) + ) ) - ) - (let ((s4-1 (-> this info)) - (f0-0 1.0) - ) - (let ((v1-14 (-> arg0 prim-id))) - (if (logtest? v1-14 512) - (set! f0-0 (* 1.5 f0-0)) - ) - (if (logtest? v1-14 1024) - (set! f0-0 (* 2.0 f0-0)) - ) - (if (logtest? v1-14 2048) - (set! f0-0 (* 4.0 f0-0)) - ) - (if (logtest? v1-14 256) - (set! f0-0 (/ 1.0 f0-0)) - ) ) - (let ((f30-0 (* (-> arg0 impulse) f0-0 (-> s4-1 info inv-mass) (-> s4-1 damage inv-toughness-factor)))) - (set! (-> this crash-impulse) (-> arg0 impulse)) + (let* ((f0-18 1.0) + (f1-14 61440.0) + (f28-0 (fmin f0-18 (* f30-0 (/ 1.0 f1-14)))) + ) (cond - ((< f30-0 (-> s4-1 damage hit-threshold)) - ) - ((>= f30-0 (-> s4-1 damage hit-deadly)) - (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 1)) - 0 - ) - (apply-damage this (* 2.0 (-> s4-1 damage hit-points)) arg0) - (vehicle-method-74 this 2 (seconds 1)) - ) - ((>= f30-0 (-> s4-1 damage hit-big)) - (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) - 0 - ) - (apply-damage this (* 10.0 (-> s4-1 damage impact-damage-factor)) arg0) - (vehicle-method-74 this 1 (seconds 0.25)) - ) ((>= f30-0 (-> s4-1 damage hit-small)) - (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.25)) + (sound-play-by-name + (-> this info sound impact-sound) + (new-sound-id) + (the int (* 1024.0 f28-0)) 0 + 0 + (sound-group) + #t ) - (apply-damage this (* 5.0 (-> s4-1 damage impact-damage-factor)) arg0) - (vehicle-method-74 this 1 (seconds 0.25)) + (logclear! (-> this v-flags) (vehicle-flag turbo-boost)) ) - (else - (let* ((f0-14 0.0) - (f1-10 40.0) - (f2-0 16384000.0) - (f0-15 (fmax f0-14 (* f1-10 (/ 1.0 f2-0) (- f30-0 (-> s4-1 damage hit-threshold))))) - ) - (apply-damage this (* f0-15 (-> s4-1 damage impact-damage-factor)) arg0) - ) - (when (< 32768.0 f30-0) - (if (logtest? (vehicle-flag player-driving) (-> this v-flags)) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.1)) - ) - ) - ) - ) - (let* ((f0-18 1.0) - (f1-14 61440.0) - (f28-0 (fmin f0-18 (* f30-0 (/ 1.0 f1-14)))) - ) - (cond - ((>= f30-0 (-> s4-1 damage hit-small)) - (sound-play-by-name - (-> this info sound impact-sound) - (new-sound-id) - (the int (* 1024.0 f28-0)) - 0 - 0 - (sound-group) - #t - ) - (logclear! (-> this v-flags) (vehicle-flag turbo-boost)) + ((< 0.1 f28-0) + (sound-play-by-name + (-> this info sound glance-sound) + (new-sound-id) + (the int (* 1024.0 f28-0)) + 0 + 0 + (sound-group) + #t ) - ((< 0.1 f28-0) - (sound-play-by-name - (-> this info sound glance-sound) - (new-sound-id) - (the int (* 1024.0 f28-0)) - 0 - 0 - (sound-group) - #t - ) - ) - ) + ) ) ) ) - (let ((a0-39 (new 'stack-no-clear 'vector))) - (vector+float*! - a0-39 - (-> arg0 velocity) - (-> arg0 normal) - (- (vector-dot (-> arg0 velocity) (-> arg0 normal))) - ) - (.lvf vf1 (&-> a0-39 quad)) + ) + (let ((a0-39 (new 'stack-no-clear 'vector))) + (vector+float*! + a0-39 + (-> arg0 velocity) + (-> arg0 normal) + (- (vector-dot (-> arg0 velocity) (-> arg0 normal))) ) - (.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-79 vf1) - (let ((f0-30 v1-79) + (let ((f0-30 (vector-length-squared a0-39)) (f1-18 12288.0) ) (when (< (* f1-18 f1-18) f0-30) @@ -181,12 +166,12 @@ ) ) ) - (if (>= 0.0 (-> this hit-points)) - (vehicle-method-74 this 2 (seconds 1)) - ) - 0 - (none) ) + (if (>= 0.0 (-> this hit-points)) + (vehicle-method-74 this 2 (seconds 1)) + ) + 0 + (none) ) ;; definition for method 92 of type vehicle 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 a4d3f8d5ca..03d3d3085a 100644 --- a/test/decompiler/reference/jak3/levels/comb/comb-field_REF.gc +++ b/test/decompiler/reference/jak3/levels/comb/comb-field_REF.gc @@ -102,151 +102,112 @@ :virtual #t :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (local-vars (v0-0 object)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (case message - (('on) - (let ((v1-2 (-> self root root-prim))) - (set! (-> v1-2 prim-core collide-as) (-> self root backup-collide-as)) - (set! v0-0 (-> self root backup-collide-with)) - (set! (-> v1-2 prim-core collide-with) (the-as collide-spec v0-0)) - ) - v0-0 + (case message + (('on) + (let ((v1-2 (-> self root root-prim))) + (set! (-> v1-2 prim-core collide-as) (-> self root backup-collide-as)) + (set! v0-0 (-> self root backup-collide-with)) + (set! (-> v1-2 prim-core collide-with) (the-as collide-spec v0-0)) ) - (('off) - (let ((v1-4 (-> self root root-prim))) - (set! (-> v1-4 prim-core collide-as) (collide-spec)) - (set! (-> v1-4 prim-core collide-with) (collide-spec)) - ) - 0 + v0-0 + ) + (('off) + (let ((v1-4 (-> self root root-prim))) + (set! (-> v1-4 prim-core collide-as) (collide-spec)) + (set! (-> v1-4 prim-core collide-with) (collide-spec)) ) - (('attack) - (let ((v1-5 (the-as attack-info (-> block param 1)))) - (when (!= (-> v1-5 id) (-> self incoming-attack-id)) - (set! (-> self incoming-attack-id) (-> v1-5 id)) - (let ((s4-0 (as-type proc process-drawable))) - (when s4-0 - (let ((gp-1 (process-spawn - manipy - :init manipy-init - (-> (the-as process-drawable s4-0) root trans) - (-> self entity) - (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer level) #f)) - #f - 0 - :name "manipy" - :to self - :stack-size #x20000 - ) + 0 + ) + (('attack) + (let ((v1-5 (the-as attack-info (-> block param 1)))) + (when (!= (-> v1-5 id) (-> self incoming-attack-id)) + (set! (-> self incoming-attack-id) (-> v1-5 id)) + (let ((s4-0 (as-type proc process-drawable))) + (when s4-0 + (let ((gp-1 (process-spawn + manipy + :init manipy-init + (-> (the-as process-drawable s4-0) root trans) + (-> self entity) + (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer level) #f)) + #f + 0 + :name "manipy" + :to self + :stack-size #x20000 ) - ) - (when gp-1 - (send-event (ppointer->process gp-1) 'anim-mode 'play1) - (send-event (ppointer->process gp-1) 'speed 1.5) - (send-event (ppointer->process gp-1) 'art-joint-anim "generic-ripples-idle" 0) - (set-vector! (-> (the-as process-drawable (-> gp-1 0)) root scale) 1.0 1.0 1.0 1.0) - (quaternion-rotate-local-x! (-> (the-as process-drawable (-> gp-1 0)) root quat) (-> self root quat) -16384.0) - (let ((v1-43 (-> (the-as process-drawable (-> gp-1 0)) root trans))) - (let ((a0-22 (-> (the-as process-drawable (-> gp-1 0)) root trans))) - (let ((a1-17 *up-vector*)) - (let ((a2-8 8192.0)) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a1-17 quad)) ) - (.lvf vf4 (&-> a0-22 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-43 quad) vf6) - ) - (let ((f0-6 (vector4-dot (-> (the-as process-drawable (-> gp-1 0)) root trans) (the-as vector (-> self plane))))) - (let ((v1-50 (-> (the-as process-drawable (-> gp-1 0)) root trans))) - (let ((a0-26 (-> (the-as process-drawable (-> gp-1 0)) root trans))) - (let ((a1-18 (-> self plane))) - (let ((a2-9 (- f0-6))) - (.mov vf7 a2-9) - ) - (.lvf vf5 (&-> a1-18 quad)) - ) - (.lvf vf4 (&-> a0-26 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-50 quad) vf6) - ) - (let ((v1-53 (-> (the-as process-drawable (-> gp-1 0)) root trans))) - (let ((a0-29 (-> (the-as process-drawable (-> gp-1 0)) root trans))) - (let ((a1-19 (-> self plane))) - (let ((a2-11 (the-as float (if (< 0.0 f0-6) - -2048.0 - 2048.0 - ) - ) - ) - ) - (.mov vf7 a2-11) - ) - (.lvf vf5 (&-> a1-19 quad)) - ) - (.lvf vf4 (&-> a0-29 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-53 quad) vf6) - ) - ) - (send-event (ppointer->process gp-1) 'trans-hook (lambda () #f)) ) + (when gp-1 + (send-event (ppointer->process gp-1) 'anim-mode 'play1) + (send-event (ppointer->process gp-1) 'speed 1.5) + (send-event (ppointer->process gp-1) 'art-joint-anim "generic-ripples-idle" 0) + (set-vector! (-> (the-as process-drawable (-> gp-1 0)) root scale) 1.0 1.0 1.0 1.0) + (quaternion-rotate-local-x! (-> (the-as process-drawable (-> gp-1 0)) root quat) (-> self root quat) -16384.0) + (vector+*! + (-> (the-as process-drawable (-> gp-1 0)) root trans) + (-> (the-as process-drawable (-> gp-1 0)) root trans) + *up-vector* + 8192.0 + ) + (let ((f0-6 (vector4-dot (-> (the-as process-drawable (-> gp-1 0)) root trans) (the-as vector (-> self plane))))) + (vector+*! + (-> (the-as process-drawable (-> gp-1 0)) root trans) + (-> (the-as process-drawable (-> gp-1 0)) root trans) + (the-as vector (-> self plane)) + (- f0-6) + ) + (vector+*! + (-> (the-as process-drawable (-> gp-1 0)) root trans) + (-> (the-as process-drawable (-> gp-1 0)) root trans) + (the-as vector (-> self plane)) + (if (< 0.0 f0-6) + -2048.0 + 2048.0 + ) + ) + ) + (send-event (ppointer->process gp-1) 'trans-hook (lambda () #f)) ) ) ) - (when (zero? (-> self touch-count)) - (+! (-> self touch-count) 1) - (set! (-> self flash) 0.375) - ) - (set! v0-0 (+ (-> self touch-count) 1)) - (set! (-> self touch-count) (the-as int v0-0)) - v0-0 ) + (when (zero? (-> self touch-count)) + (+! (-> self touch-count) 1) + (set! (-> self flash) 0.375) + ) + (set! v0-0 (+ (-> self touch-count) 1)) + (set! (-> self touch-count) (the-as int v0-0)) + v0-0 ) ) - (('touched) - (when (zero? (-> self touch-count)) - (+! (-> self touch-count) 1) - (set! (-> self flash) 0.375) - ) + ) + (('touched) + (when (zero? (-> self touch-count)) (+! (-> self touch-count) 1) - (let ((v1-75 (as-type proc process-focusable))) - (when v1-75 - (let ((gp-4 (as-type (-> (the-as process-drawable v1-75) root) collide-shape))) - (when gp-4 - (if (logtest? (-> (the-as collide-shape gp-4) root-prim prim-core collide-as) (collide-spec jak)) - (on-jak-touch self) - ) - (when (logtest? (-> (the-as collide-shape gp-4) root-prim prim-core collide-as) (collide-spec vehicle-sphere)) - (when (not (-> self breach)) - (sound-play "barrier-cross") - (set! v0-0 #t) - (set! (-> self breach) (the-as symbol v0-0)) - v0-0 - ) + (set! (-> self flash) 0.375) + ) + (+! (-> self touch-count) 1) + (let ((v1-78 (as-type proc process-focusable))) + (when v1-78 + (let ((gp-4 (as-type (-> (the-as process-drawable v1-78) root) collide-shape))) + (when gp-4 + (if (logtest? (-> (the-as collide-shape gp-4) root-prim prim-core collide-as) (collide-spec jak)) + (on-jak-touch self) + ) + (when (logtest? (-> (the-as collide-shape gp-4) root-prim prim-core collide-as) (collide-spec vehicle-sphere)) + (when (not (-> self breach)) + (sound-play "barrier-cross") + (set! v0-0 #t) + (set! (-> self breach) (the-as symbol v0-0)) + v0-0 ) ) ) ) ) ) - ) + ) ) ) :trans (behavior () 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 fbc0c5c329..cf83e6464b 100644 --- a/test/decompiler/reference/jak3/levels/comb/comb-sentry_REF.gc +++ b/test/decompiler/reference/jak3/levels/comb/comb-sentry_REF.gc @@ -42,59 +42,37 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this comb-sentry-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 4236 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 4236 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 4236) a1-0 s5-1 #f) - (set! (-> *part-id-table* 4236 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 4237) s4-0) - (launch-particles (-> *part-id-table* 4238) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f26-0 (/ f30-0 (meters 9))) - (f30-1 (-> *part-id-table* 4239 init-specs 3 initial-valuef)) - (f28-1 (-> *part-id-table* 4239 init-specs 4 initial-valuef)) - ) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 4239 init-specs 3 initial-valuef) (* f26-0 f30-1)) - (set! (-> *part-id-table* 4239 init-specs 4 initial-valuef) (* f26-0 f28-1)) - (launch-particles (-> *part-id-table* 4239) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 4239 init-specs 3 initial-valuef) f30-1) - (set! (-> *part-id-table* 4239 init-specs 4 initial-valuef) f28-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 4236 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 4236 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 4236) a1-0 s5-1 #f) + (set! (-> *part-id-table* 4236 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 4237) s4-1) + (launch-particles (-> *part-id-table* 4238) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f26-0 (/ f30-0 (meters 9))) + (f30-1 (-> *part-id-table* 4239 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 4239 init-specs 4 initial-valuef)) + ) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 4239 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 4239 init-specs 4 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 4239) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 4239 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 4239 init-specs 4 initial-valuef) f28-1) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 26 of type comb-sentry-shot @@ -494,123 +472,107 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod sentry-post ((this comb-sentry)) - (local-vars (v1-25 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (if (and (= (-> this player-vehicle) #f) *target* (focus-test? *target* pilot-riding)) - (set! (-> this player-vehicle) (-> *target* pilot vehicle)) - ) - (set! (-> this should-attack) #f) - (let ((s5-0 (the-as process-focusable (handle->process (-> this player-vehicle))))) - (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)) - ) + (if (and (= (-> this player-vehicle) #f) *target* (focus-test? *target* pilot-riding)) + (set! (-> this player-vehicle) (-> *target* pilot vehicle)) + ) + (set! (-> this should-attack) #f) + (let ((s5-0 (the-as process-focusable (handle->process (-> this player-vehicle))))) + (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)) ) - (set! (-> this should-attack) #t) - ) - (let ((v1-23 (new 'stack-no-clear 'matrix))) - (vector-copy! (-> v1-23 rvec) (-> s5-0 root trans)) - (vector-copy! (-> v1-23 uvec) (-> s5-0 root transv)) - (vector+float*! (-> this target-pos) (-> v1-23 rvec) (-> v1-23 uvec) 0.1) - (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) - (f0-6 (* f0-4 f0-4)) - ) - (.lvf vf1 (&-> v1-24 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-25 vf1) - (if (< f0-6 v1-25) - (set! (-> this target-dist) 4096000.0) - ) - ) + ) + (set! (-> this should-attack) #t) + ) + (let ((v1-23 (new 'stack-no-clear 'matrix))) + (vector-copy! (-> v1-23 rvec) (-> s5-0 root trans)) + (vector-copy! (-> v1-23 uvec) (-> s5-0 root transv)) + (vector+float*! (-> this target-pos) (-> v1-23 rvec) (-> v1-23 uvec) 0.1) + (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)) + (set! (-> this target-dist) 4096000.0) + ) ) ) ) - (if (not (-> this should-attack)) - (set-time! (-> this in-range-time)) - ) - (set! (-> this path-dt) (* 0.00024414062 (- 163840.0 (-> this target-dist)))) - (set! (-> this path-dt) (fmax -8.0 (fmin 8.0 (-> this path-dt)))) - (+! (-> this path-t) (* (-> this path-dt) (seconds-per-frame))) - (set! (-> this path-t) (fmax 0.0 (fmin (-> this path-t) (get-num-segments (-> this path))))) - (if (= (-> this path-t) (get-num-segments (-> this path))) - (go-explode this) - ) - (get-point-in-path! (-> this path) (-> this root trans) (-> this path-t) 'interp) - (let ((s5-1 (new 'stack-no-clear 'inline-array 'vector 5))) - (vector-! (-> s5-1 0) (-> this target-pos) (-> this root trans)) - (vector-normalize! (-> s5-1 0) 1.0) - (vector-copy! (-> s5-1 1) (-> this up-dir)) - (set! (-> s5-1 4 x) (vector-dot (-> s5-1 0) (-> s5-1 1))) - (vector+float*! (-> s5-1 1) (-> s5-1 1) (-> s5-1 0) (- (-> s5-1 4 x))) - (vector-normalize! (-> s5-1 1) 1.0) - (vector-copy! (-> this up-dir) (-> s5-1 1)) - (forward-up-nopitch->quaternion (the-as quaternion (-> s5-1 2)) (-> s5-1 0) (-> s5-1 1)) - (+! (-> this angle) (* (-> this spin) (seconds-per-frame))) - (set! (-> this angle) (the float (sar (shl (the int (-> this angle)) 48) 48))) - (quaternion-axis-angle! (the-as quaternion (-> s5-1 3)) 0.0 0.0 1.0 (-> this angle)) - (quaternion*! (the-as quaternion (-> s5-1 2)) (the-as quaternion (-> s5-1 2)) (the-as quaternion (-> s5-1 3))) - (quaternion-copy! (-> this root quat) (the-as quaternion (-> s5-1 2))) - ) - (cond - ((-> this shooting) - (seek! (-> this spin) 131072.0 (* 262144.0 (seconds-per-frame))) - (when (time-elapsed? (-> this shot-time) (seconds 0.2)) - (set-time! (-> this shot-time)) - (fire-shot this) - ) - (when (or (time-elapsed? (-> this attack-time) (seconds 1)) (not (-> this should-attack))) - (set-time! (-> this attack-time)) - (set! (-> this shooting) #f) - ) - ) - (else - (seek! (-> this spin) 32768.0 (* 65536.0 (seconds-per-frame))) - (when (and (time-elapsed? (-> this attack-time) (seconds 3)) - (time-elapsed? (-> this in-range-time) (seconds 4)) - (-> this should-attack) - ) - (set-time! (-> this attack-time)) - (set! (-> this shooting) #t) - ) - ) - ) - (cond - ((-> this should-attack) - (if (zero? (-> this hum-id)) - (set! (-> this hum-id) (new-sound-id)) - ) - (sound-play "sentry-engine" :id (-> this hum-id)) - ) - (else - (when (nonzero? (-> this hum-id)) - (sound-stop (-> this hum-id)) - (set! (-> this hum-id) (new 'static 'sound-id)) - 0 - ) - ) - ) - (transform-post) - (draw-glow-sprites this) - 0 - (none) ) + (if (not (-> this should-attack)) + (set-time! (-> this in-range-time)) + ) + (set! (-> this path-dt) (* 0.00024414062 (- 163840.0 (-> this target-dist)))) + (set! (-> this path-dt) (fmax -8.0 (fmin 8.0 (-> this path-dt)))) + (+! (-> this path-t) (* (-> this path-dt) (seconds-per-frame))) + (set! (-> this path-t) (fmax 0.0 (fmin (-> this path-t) (get-num-segments (-> this path))))) + (if (= (-> this path-t) (get-num-segments (-> this path))) + (go-explode this) + ) + (get-point-in-path! (-> this path) (-> this root trans) (-> this path-t) 'interp) + (let ((s5-1 (new 'stack-no-clear 'inline-array 'vector 5))) + (vector-! (-> s5-1 0) (-> this target-pos) (-> this root trans)) + (vector-normalize! (-> s5-1 0) 1.0) + (vector-copy! (-> s5-1 1) (-> this up-dir)) + (set! (-> s5-1 4 x) (vector-dot (-> s5-1 0) (-> s5-1 1))) + (vector+float*! (-> s5-1 1) (-> s5-1 1) (-> s5-1 0) (- (-> s5-1 4 x))) + (vector-normalize! (-> s5-1 1) 1.0) + (vector-copy! (-> this up-dir) (-> s5-1 1)) + (forward-up-nopitch->quaternion (the-as quaternion (-> s5-1 2)) (-> s5-1 0) (-> s5-1 1)) + (+! (-> this angle) (* (-> this spin) (seconds-per-frame))) + (set! (-> this angle) (the float (sar (shl (the int (-> this angle)) 48) 48))) + (quaternion-axis-angle! (the-as quaternion (-> s5-1 3)) 0.0 0.0 1.0 (-> this angle)) + (quaternion*! (the-as quaternion (-> s5-1 2)) (the-as quaternion (-> s5-1 2)) (the-as quaternion (-> s5-1 3))) + (quaternion-copy! (-> this root quat) (the-as quaternion (-> s5-1 2))) + ) + (cond + ((-> this shooting) + (seek! (-> this spin) 131072.0 (* 262144.0 (seconds-per-frame))) + (when (time-elapsed? (-> this shot-time) (seconds 0.2)) + (set-time! (-> this shot-time)) + (fire-shot this) + ) + (when (or (time-elapsed? (-> this attack-time) (seconds 1)) (not (-> this should-attack))) + (set-time! (-> this attack-time)) + (set! (-> this shooting) #f) + ) + ) + (else + (seek! (-> this spin) 32768.0 (* 65536.0 (seconds-per-frame))) + (when (and (time-elapsed? (-> this attack-time) (seconds 3)) + (time-elapsed? (-> this in-range-time) (seconds 4)) + (-> this should-attack) + ) + (set-time! (-> this attack-time)) + (set! (-> this shooting) #t) + ) + ) + ) + (cond + ((-> this should-attack) + (if (zero? (-> this hum-id)) + (set! (-> this hum-id) (new-sound-id)) + ) + (sound-play "sentry-engine" :id (-> this hum-id)) + ) + (else + (when (nonzero? (-> this hum-id)) + (sound-stop (-> this hum-id)) + (set! (-> this hum-id) (new 'static 'sound-id)) + 0 + ) + ) + ) + (transform-post) + (draw-glow-sprites this) + 0 + (none) ) ;; definition for method 34 of type comb-sentry 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 f211c5b971..08f095b667 100644 --- a/test/decompiler/reference/jak3/levels/comb/h-sled_REF.gc +++ b/test/decompiler/reference/jak3/levels/comb/h-sled_REF.gc @@ -136,55 +136,40 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun sled-find-mesh-dir ((arg0 vector) (arg1 vector) (arg2 collide-tri-result)) - (local-vars (a0-8 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (new 'stack-no-clear 'h-sled-stack-var0))) - (vector-! (-> s4-0 vec 0) (-> arg2 vertex 2) (-> arg2 vertex 1)) - (vector-! (-> s4-0 vec 1) (-> arg2 vertex 0) (-> arg2 vertex 2)) - (vector-! (-> s4-0 vec 2) (-> arg2 vertex 1) (-> arg2 vertex 0)) - (set! (-> s4-0 byte0) -1) - (set! (-> s4-0 float1) -1.0) - (dotimes (v1-5 3) - (.lvf vf1 (&-> (-> s4-0 vec v1-5) 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-8 vf1) - (set! (-> s4-0 float0) a0-8) - (when (< (-> s4-0 float1) (-> s4-0 float0)) - (set! (-> s4-0 float1) (-> s4-0 float0)) - (set! (-> s4-0 byte0) v1-5) - ) + (let ((s4-0 (new 'stack-no-clear 'h-sled-stack-var0))) + (vector-! (-> s4-0 vec 0) (-> arg2 vertex 2) (-> arg2 vertex 1)) + (vector-! (-> s4-0 vec 1) (-> arg2 vertex 0) (-> arg2 vertex 2)) + (vector-! (-> s4-0 vec 2) (-> arg2 vertex 1) (-> arg2 vertex 0)) + (set! (-> s4-0 byte0) -1) + (set! (-> s4-0 float1) -1.0) + (dotimes (v1-5 3) + (set! (-> s4-0 float0) (vector-length-squared (-> s4-0 vec v1-5))) + (when (< (-> s4-0 float1) (-> s4-0 float0)) + (set! (-> s4-0 float1) (-> s4-0 float0)) + (set! (-> s4-0 byte0) v1-5) ) - (if (< (-> s4-0 byte0) 2) - (vector-copy! (-> s4-0 vec (-> s4-0 byte0)) (-> s4-0 vec 2)) - ) - (dotimes (s3-0 2) - (let ((s2-0 (-> s4-0 vec1 s3-0))) - (vector-normalize-copy! s2-0 (-> s4-0 vec s3-0) 1.0) - (let ((f0-5 (vector-dot s2-0 arg1))) - (when (< f0-5 0.0) - (vector-float*! s2-0 s2-0 -1.0) - (set! f0-5 (* -1.0 f0-5)) - ) - (if (>= f0-5 0.866) - (vector-copy! arg0 s2-0) - ) + ) + (if (< (-> s4-0 byte0) 2) + (vector-copy! (-> s4-0 vec (-> s4-0 byte0)) (-> s4-0 vec 2)) + ) + (dotimes (s3-0 2) + (let ((s2-0 (-> s4-0 vec1 s3-0))) + (vector-normalize-copy! s2-0 (-> s4-0 vec s3-0) 1.0) + (let ((f0-5 (vector-dot s2-0 arg1))) + (when (< f0-5 0.0) + (vector-float*! s2-0 s2-0 -1.0) + (set! f0-5 (* -1.0 f0-5)) ) + (if (>= f0-5 0.866) + (vector-copy! arg0 s2-0) + ) ) ) ) - 0 - 0 - (none) ) + 0 + 0 + (none) ) ;; definition of type sled-shot @@ -230,53 +215,31 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this sled-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 4231 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 4231 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 4231) a1-0 s5-1 #f) - (set! (-> *part-id-table* 4231 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 4232) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix))) - (/ f30-0 (meters 9)) - (-> *part-id-table* 4233 init-specs 3 initial-valuef) - (-> *part-id-table* 4233 init-specs 4 initial-valuef) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (launch-particles (-> *part-id-table* 4233) s4-1 :origin-is-matrix #t) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 4231 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 4231 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 4231) a1-0 s5-1 #f) + (set! (-> *part-id-table* 4231 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 4232) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix))) + (/ f30-0 (meters 9)) + (-> *part-id-table* 4233 init-specs 3 initial-valuef) + (-> *part-id-table* 4233 init-specs 4 initial-valuef) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (launch-particles (-> *part-id-table* 4233) s4-2 :origin-is-matrix #t) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 26 of type sled-shot @@ -1460,56 +1423,41 @@ ;; definition for method 77 of type h-sled (defmethod vehicle-method-77 ((this h-sled)) - (local-vars (v1-10 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds particles) (-> this v-flags)))) - (let ((v1-3 (-> this rbody))) - (cond - ((logtest? (vehicle-flag overturned) (-> this v-flags)) - (if (and (not (logtest? (-> this v-flags) (vehicle-flag in-air))) (< 0.0 (-> v1-3 matrix uvec y))) - (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag overturned)))) - ) - ) - (else - (when (and (logtest? (-> this v-flags) (vehicle-flag in-air)) - (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (< (-> v1-3 matrix uvec y) 0.0) - (let ((v1-9 (-> v1-3 ang-velocity)) - (f1-2 4.0) - ) - (.lvf vf1 (&-> v1-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-10 vf1) - (< v1-10 (* f1-2 f1-2)) - ) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag sounds particles) (-> this v-flags)))) + (let ((v1-3 (-> this rbody))) + (cond + ((logtest? (vehicle-flag overturned) (-> this v-flags)) + (if (and (not (logtest? (-> this v-flags) (vehicle-flag in-air))) (< 0.0 (-> v1-3 matrix uvec y))) + (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag overturned)))) + ) + ) + (else + (when (and (logtest? (-> this v-flags) (vehicle-flag in-air)) + (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (< (-> v1-3 matrix uvec y) 0.0) + (let ((v1-9 (-> v1-3 ang-velocity)) + (f1-2 4.0) + ) + (< (vector-length-squared v1-9) (* f1-2 f1-2)) ) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag overturned) (-> this v-flags)))) - (set-time! (-> this overturned-time)) - ) + ) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag overturned) (-> this v-flags)))) + (set-time! (-> this overturned-time)) ) ) ) - (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) - (when (and (logtest? (-> this controls flags) (vehicle-controls-flag vcf1)) - (time-elapsed? (-> this shoot-time) (the-as time-frame (-> this shoot-delay))) - ) - (set-time! (-> this shoot-time)) - (fire-shot this) - ) - (set! (-> *game-info* health-bar-vehicle) (-> this hit-points)) - ) - ((method-of-type vehicle vehicle-method-77) this) - (none) ) + (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) + (when (and (logtest? (-> this controls flags) (vehicle-controls-flag vcf1)) + (time-elapsed? (-> this shoot-time) (the-as time-frame (-> this shoot-delay))) + ) + (set-time! (-> this shoot-time)) + (fire-shot this) + ) + (set! (-> *game-info* health-bar-vehicle) (-> this hit-points)) + ) + ((method-of-type vehicle vehicle-method-77) this) + (none) ) ;; definition for method 106 of type h-sled @@ -1632,191 +1580,165 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-97 ((this h-sled) (arg0 float) (arg1 vehicle-physics-work)) - (local-vars (v1-59 float) (v1-63 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s3-0 (-> this rbody))) - (mem-copy! (the-as pointer (-> (the-as h-sled-physics-work arg1) mat)) (the-as pointer (-> s3-0 matrix)) 64) - (logior! (-> this v-flags) (vehicle-flag in-air)) - (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) - (vector-reset! (-> this sum-ground-normal)) - (let ((f30-0 (-> this info handling ground-probe-distance)) - (s2-0 (new 'stack-no-clear 'collide-query)) + (let ((s3-0 (-> this rbody))) + (mem-copy! (the-as pointer (-> (the-as h-sled-physics-work arg1) mat)) (the-as pointer (-> s3-0 matrix)) 64) + (logior! (-> this v-flags) (vehicle-flag in-air)) + (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) + (vector-reset! (-> this sum-ground-normal)) + (let ((f30-0 (-> this info handling ground-probe-distance)) + (s2-0 (new 'stack-no-clear 'collide-query)) + ) + (set! (-> (the-as h-sled-physics-work arg1) speed-factor) + (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) ) - (set! (-> (the-as h-sled-physics-work arg1) speed-factor) - (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) + (vector-float*! + (-> (the-as h-sled-physics-work arg1) lift-dir) + (-> (the-as h-sled-physics-work arg1) mat uvec) + -1.0 + ) + (vector-float*! (-> s2-0 move-dist) (-> (the-as h-sled-physics-work arg1) lift-dir) (the-as float f30-0)) + (let ((v1-15 s2-0)) + (set! (-> v1-15 radius) 409.6) + (set! (-> v1-15 collide-with) (collide-spec + backgnd + bot + obstacle + hit-by-player-list + hit-by-others-list + player-list + water + collectable + blocking-plane + pusher + vehicle-mesh-probeable + shield + vehicle-sphere-no-probe + ) ) - (vector-float*! - (-> (the-as h-sled-physics-work arg1) lift-dir) - (-> (the-as h-sled-physics-work arg1) mat uvec) - -1.0 - ) - (vector-float*! (-> s2-0 move-dist) (-> (the-as h-sled-physics-work arg1) lift-dir) (the-as float f30-0)) - (let ((v1-15 s2-0)) - (set! (-> v1-15 radius) 409.6) - (set! (-> v1-15 collide-with) (collide-spec - backgnd - bot - obstacle - hit-by-player-list - hit-by-others-list - player-list - water - collectable - blocking-plane - pusher - vehicle-mesh-probeable - shield - vehicle-sphere-no-probe - ) - ) - (set! (-> v1-15 ignore-process0) #f) - (set! (-> v1-15 ignore-process1) #f) - (set! (-> v1-15 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) - (set! (-> v1-15 action-mask) (collide-action solid)) - ) - (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) - (let ((v1-18 (-> this info physics-model lift-thruster-array s1-0)) - (s0-0 (-> (the-as h-sled-physics-work arg1) probe-work-array s1-0)) - ) - (vector-copy! (-> s0-0 local-pos) (-> v1-18 local-pos)) - (vector-copy! (-> s0-0 local-normal) (-> v1-18 rot)) - (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> (the-as h-sled-physics-work arg1) mat)) - (vector-copy! (-> s0-0 probe-pos) (-> s0-0 world-pos)) - (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) - (vector-reset! (-> s0-0 ground-normal)) - (vector-reset! (-> s0-0 u-dir)) - (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) - (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) - (set! (-> s0-0 probe-uu) (probe-using-line-sphere *collide-cache* s2-0)) - (cond - ((and (>= (-> s0-0 probe-uu) 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) - (logclear! (-> this v-flags) (vehicle-flag in-air)) - (logior! (-> this v-flags) (vehicle-flag on-ground)) - (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) - (vector+! (-> this sum-ground-normal) (-> this sum-ground-normal) (-> s0-0 ground-normal)) - (sled-find-mesh-dir (-> s0-0 u-dir) (-> this path-dir) (-> s2-0 best-other-tri)) - ) - (else - (set! (-> s0-0 probe-uu) 1.0) - ) - ) - (vector+float*! - (-> s0-0 ground-pos) - (-> s0-0 probe-pos) - (-> (the-as h-sled-physics-work arg1) lift-dir) - (the-as float f30-0) - ) - 0 + (set! (-> v1-15 ignore-process0) #f) + (set! (-> v1-15 ignore-process1) #f) + (set! (-> v1-15 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) + (set! (-> v1-15 action-mask) (collide-action solid)) + ) + (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) + (let ((v1-18 (-> this info physics-model lift-thruster-array s1-0)) + (s0-0 (-> (the-as h-sled-physics-work arg1) probe-work-array s1-0)) ) - ) - ) - ) - (vector-copy! (-> this prev-tunnel-dir) (-> this tunnel-dir)) - (vector-reset! (-> this tunnel-dir)) - (dotimes (v1-55 (-> this info physics-model lift-thruster-count)) - (let ((a2-5 (-> (the-as h-sled-physics-work arg1) probe-work-array v1-55))) - (vector+! (-> this tunnel-dir) (-> this tunnel-dir) (-> a2-5 u-dir)) - ) - ) - (let ((f0-9 0.0)) - (.lvf vf1 (&-> (-> this tunnel-dir) 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-59 vf1) - (if (< f0-9 v1-59) - (vector-normalize! (-> this tunnel-dir) 1.0) - (vector-copy! (-> this tunnel-dir) (-> this path-dir)) - ) - ) - (let ((f0-10 0.0)) - (.lvf vf1 (&-> (-> this sum-ground-normal) 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-63 vf1) - (when (< f0-10 v1-63) - (vector-copy! (-> this normal-dir) (-> this sum-ground-normal)) - (vector-normalize! (-> this normal-dir) 1.0) - (vector-float*! (-> this gravity-dir) (-> this normal-dir) -1.0) - (vector-cross! (-> this side-dir) (-> this normal-dir) (-> this tunnel-dir)) - (vector-normalize! (-> this side-dir) 1.0) - ) - ) - (when (logtest? (-> this v-flags) (vehicle-flag on-ground)) - (let ((s2-1 (new 'stack-no-clear 'inline-array 'vector 1))) - (matrix-from-two-vectors! (the-as matrix (-> s2-1 0)) (-> this prev-tunnel-dir) (-> this tunnel-dir)) - (vector-rotate*! (-> s3-0 lin-momentum) (-> s3-0 lin-momentum) (the-as matrix (-> s2-1 0))) - ) - (init-velocities! (-> this rbody)) - ) - (dotimes (s2-2 (-> this info physics-model lift-thruster-count)) - (let ((v1-78 (-> (the-as h-sled-physics-work arg1) probe-work-array s2-2))) - (vector-copy! (-> (the-as h-sled-physics-work arg1) world-pos) (-> v1-78 world-pos)) - (vector-copy! (-> (the-as h-sled-physics-work arg1) velocity) (-> v1-78 velocity)) - (let ((s1-1 (new 'stack-no-clear 'vector))) - (when (< (-> v1-78 probe-uu) 1.0) - (set! (-> s1-1 x) (- 0.5 (-> v1-78 probe-uu))) - (let ((a0-54 (-> (the-as h-sled-physics-work arg1) force)) - (a1-26 (-> v1-78 ground-normal)) - (f0-15 0.5) - (f1-7 arg0) - ) - (vector-float*! - a0-54 - a1-26 - (* f0-15 - (/ 1.0 f1-7) - (-> this info physics-model inv-lift-thruster-count) - (-> this info info mass) - (- (vector-dot (-> (the-as h-sled-physics-work arg1) velocity) (-> v1-78 ground-normal))) - ) - ) - ) - (apply-impact! - s3-0 - (-> (the-as h-sled-physics-work arg1) world-pos) - (-> (the-as h-sled-physics-work arg1) force) - ) - (let ((f0-25 - (* 16.0 - (-> this info info mass) - (-> this info extra gravity) - (-> this info physics-model inv-lift-thruster-count) - (-> s1-1 x) - (-> this info handling spring-lift-factor) - ) - ) - ) - (vector-float*! - (-> (the-as h-sled-physics-work arg1) force) - (-> (the-as h-sled-physics-work arg1) lift-dir) - (* -1.0 f0-25) - ) - ) - (apply-impact! - s3-0 - (-> (the-as h-sled-physics-work arg1) world-pos) - (-> (the-as h-sled-physics-work arg1) force) + (vector-copy! (-> s0-0 local-pos) (-> v1-18 local-pos)) + (vector-copy! (-> s0-0 local-normal) (-> v1-18 rot)) + (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> (the-as h-sled-physics-work arg1) mat)) + (vector-copy! (-> s0-0 probe-pos) (-> s0-0 world-pos)) + (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) + (vector-reset! (-> s0-0 ground-normal)) + (vector-reset! (-> s0-0 u-dir)) + (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) + (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) + (set! (-> s0-0 probe-uu) (probe-using-line-sphere *collide-cache* s2-0)) + (cond + ((and (>= (-> s0-0 probe-uu) 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) + (logclear! (-> this v-flags) (vehicle-flag in-air)) + (logior! (-> this v-flags) (vehicle-flag on-ground)) + (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) + (vector+! (-> this sum-ground-normal) (-> this sum-ground-normal) (-> s0-0 ground-normal)) + (sled-find-mesh-dir (-> s0-0 u-dir) (-> this path-dir) (-> s2-0 best-other-tri)) + ) + (else + (set! (-> s0-0 probe-uu) 1.0) ) ) + (vector+float*! + (-> s0-0 ground-pos) + (-> s0-0 probe-pos) + (-> (the-as h-sled-physics-work arg1) lift-dir) + (the-as float f30-0) + ) + 0 ) ) - 0 ) ) - 0 - (none) + (vector-copy! (-> this prev-tunnel-dir) (-> this tunnel-dir)) + (vector-reset! (-> this tunnel-dir)) + (dotimes (v1-55 (-> this info physics-model lift-thruster-count)) + (let ((a2-5 (-> (the-as h-sled-physics-work arg1) probe-work-array v1-55))) + (vector+! (-> this tunnel-dir) (-> this tunnel-dir) (-> a2-5 u-dir)) + ) + ) + (if (< 0.0 (vector-length-squared (-> this tunnel-dir))) + (vector-normalize! (-> this tunnel-dir) 1.0) + (vector-copy! (-> this tunnel-dir) (-> this path-dir)) + ) + (when (< 0.0 (vector-length-squared (-> this sum-ground-normal))) + (vector-copy! (-> this normal-dir) (-> this sum-ground-normal)) + (vector-normalize! (-> this normal-dir) 1.0) + (vector-float*! (-> this gravity-dir) (-> this normal-dir) -1.0) + (vector-cross! (-> this side-dir) (-> this normal-dir) (-> this tunnel-dir)) + (vector-normalize! (-> this side-dir) 1.0) + ) + (when (logtest? (-> this v-flags) (vehicle-flag on-ground)) + (let ((s2-1 (new 'stack-no-clear 'inline-array 'vector 1))) + (matrix-from-two-vectors! (the-as matrix (-> s2-1 0)) (-> this prev-tunnel-dir) (-> this tunnel-dir)) + (vector-rotate*! (-> s3-0 lin-momentum) (-> s3-0 lin-momentum) (the-as matrix (-> s2-1 0))) + ) + (init-velocities! (-> this rbody)) + ) + (dotimes (s2-2 (-> this info physics-model lift-thruster-count)) + (let ((v1-78 (-> (the-as h-sled-physics-work arg1) probe-work-array s2-2))) + (vector-copy! (-> (the-as h-sled-physics-work arg1) world-pos) (-> v1-78 world-pos)) + (vector-copy! (-> (the-as h-sled-physics-work arg1) velocity) (-> v1-78 velocity)) + (let ((s1-1 (new 'stack-no-clear 'vector))) + (when (< (-> v1-78 probe-uu) 1.0) + (set! (-> s1-1 x) (- 0.5 (-> v1-78 probe-uu))) + (let ((a0-54 (-> (the-as h-sled-physics-work arg1) force)) + (a1-26 (-> v1-78 ground-normal)) + (f0-15 0.5) + (f1-7 arg0) + ) + (vector-float*! + a0-54 + a1-26 + (* f0-15 + (/ 1.0 f1-7) + (-> this info physics-model inv-lift-thruster-count) + (-> this info info mass) + (- (vector-dot (-> (the-as h-sled-physics-work arg1) velocity) (-> v1-78 ground-normal))) + ) + ) + ) + (apply-impact! + s3-0 + (-> (the-as h-sled-physics-work arg1) world-pos) + (-> (the-as h-sled-physics-work arg1) force) + ) + (let ((f0-25 + (* 16.0 + (-> this info info mass) + (-> this info extra gravity) + (-> this info physics-model inv-lift-thruster-count) + (-> s1-1 x) + (-> this info handling spring-lift-factor) + ) + ) + ) + (vector-float*! + (-> (the-as h-sled-physics-work arg1) force) + (-> (the-as h-sled-physics-work arg1) lift-dir) + (* -1.0 f0-25) + ) + ) + (apply-impact! + s3-0 + (-> (the-as h-sled-physics-work arg1) world-pos) + (-> (the-as h-sled-physics-work arg1) force) + ) + ) + ) + ) + 0 + ) ) + 0 + (none) ) ;; definition for method 31 of type h-sled @@ -2052,72 +1974,55 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defmethod vehicle-method-78 ((this h-sled)) - (local-vars (a0-13 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'h-sled-stack-var1))) - (matrix-copy! (-> s5-0 mat) (-> this node-list data 0 bone transform)) - (let ((s4-0 (new 'static 'inline-array vector 8 - (new 'static 'vector :x 6144.0 :y 4096.0 :z -20480.0 :w 1.0) - (new 'static 'vector :x -6144.0 :y 4096.0 :z -20480.0 :w 1.0) - (new 'static 'vector :x 1638.4 :y 4096.0 :z -17203.2 :w 1.0) - (new 'static 'vector :x -1638.4 :y 4096.0 :z -17203.2 :w 1.0) - (new 'static 'vector :x 7782.4 :y 7782.4 :z -12288.0 :w 1.0) - (new 'static 'vector :x -7782.4 :y 7782.4 :z -12288.0 :w 1.0) - (new 'static 'vector :x 11059.2 :y 5734.4 :z -1638.4 :w 1.0) - (new 'static 'vector :x -11059.2 :y 5734.4 :z -1638.4 :w 1.0) - ) + (let ((s5-0 (new 'stack-no-clear 'h-sled-stack-var1))) + (matrix-copy! (-> s5-0 mat) (-> this node-list data 0 bone transform)) + (let ((s4-0 (new 'static 'inline-array vector 8 + (new 'static 'vector :x 6144.0 :y 4096.0 :z -20480.0 :w 1.0) + (new 'static 'vector :x -6144.0 :y 4096.0 :z -20480.0 :w 1.0) + (new 'static 'vector :x 1638.4 :y 4096.0 :z -17203.2 :w 1.0) + (new 'static 'vector :x -1638.4 :y 4096.0 :z -17203.2 :w 1.0) + (new 'static 'vector :x 7782.4 :y 7782.4 :z -12288.0 :w 1.0) + (new 'static 'vector :x -7782.4 :y 7782.4 :z -12288.0 :w 1.0) + (new 'static 'vector :x 11059.2 :y 5734.4 :z -1638.4 :w 1.0) + (new 'static 'vector :x -11059.2 :y 5734.4 :z -1638.4 :w 1.0) ) + ) + ) + (when (logtest? (vehicle-flag ignition) (-> this v-flags)) + (dotimes (s3-0 8) + (quad-copy! + (the-as pointer (-> s5-0 glow)) + (the-as pointer (-> this info particle-common headlight-glow-template)) + 4 ) - (when (logtest? (vehicle-flag ignition) (-> this v-flags)) - (dotimes (s3-0 8) - (quad-copy! - (the-as pointer (-> s5-0 glow)) - (the-as pointer (-> this info particle-common headlight-glow-template)) - 4 - ) - (vector-matrix*! (-> s5-0 vec0) (-> s4-0 s3-0) (-> s5-0 mat)) - (let* ((v1-7 (-> s5-0 glow)) - (a1-3 (-> s5-0 vec0)) - (f0-0 (-> v1-7 position w)) - ) - (vector-copy! (-> v1-7 position) a1-3) - (set! (-> v1-7 position w) f0-0) - ) - 0 - (set! (-> s5-0 glow rot-angle) (* 182.04445 (rand-vu-float-range -17.0 -13.0))) - (set! (-> s5-0 glow color x) 0.0) - (set! (-> s5-0 glow color y) 0.0) - (set! (-> s5-0 glow color z) 255.0) - (set! (-> s5-0 glow color w) (* 2.0 (rand-vu-float-range 16.0 18.0))) - (add! *simple-sprite-system* (-> s5-0 glow)) + (vector-matrix*! (-> s5-0 vec0) (-> s4-0 s3-0) (-> s5-0 mat)) + (let* ((v1-7 (-> s5-0 glow)) + (a1-3 (-> s5-0 vec0)) + (f0-0 (-> v1-7 position w)) + ) + (vector-copy! (-> v1-7 position) a1-3) + (set! (-> v1-7 position w) f0-0) ) + 0 + (set! (-> s5-0 glow rot-angle) (* 182.04445 (rand-vu-float-range -17.0 -13.0))) + (set! (-> s5-0 glow color x) 0.0) + (set! (-> s5-0 glow color y) 0.0) + (set! (-> s5-0 glow color z) 255.0) + (set! (-> s5-0 glow color w) (* 2.0 (rand-vu-float-range 16.0 18.0))) + (add! *simple-sprite-system* (-> s5-0 glow)) ) ) - (when (logtest? (vehicle-flag ignition) (-> this v-flags)) - (dotimes (s4-1 4) - (let ((v1-21 (-> this ground-pos-array s4-1)) - (f0-8 0.0) - ) - (.lvf vf1 (&-> v1-21 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-13 vf1) - (when (< f0-8 a0-13) - (vector-copy! (-> s5-0 mat trans) v1-21) - (spawn-from-mat (-> this parts s4-1) (-> s5-0 mat)) - ) + ) + (when (logtest? (vehicle-flag ignition) (-> this v-flags)) + (dotimes (s4-1 4) + (let ((v1-21 (-> this ground-pos-array s4-1))) + (when (< 0.0 (vector-length-squared v1-21)) + (vector-copy! (-> s5-0 mat trans) v1-21) + (spawn-from-mat (-> this parts s4-1) (-> s5-0 mat)) ) ) ) ) - (none) ) + (none) ) 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 b945ea5610..19be6b4c6f 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 @@ -287,57 +287,35 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this ashelin-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((v1-1 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) v1-1 a1-0)) + (gp-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8)) ) - (init-vf0-vector) - (let* ((v1-1 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) v1-1 a1-0)) - (gp-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-2 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-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 (&-> gp-0 quad) vf6) - (let ((f30-0 (-> *part-id-table* 900 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 900 init-specs 4 initial-valuef) (fmin f30-0 (vector-length s5-1))) - (draw-beam (-> *part-id-table* 900) a1-0 s5-1 #f) - (set! (-> *part-id-table* 900 init-specs 4 initial-valuef) f30-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 901) gp-0) - (let ((f0-4 (vector-dot s5-1 (-> (camera-matrix) fvec)))) - (when (< 0.0 f0-4) - (let ((f0-5 (* f0-4 f0-4)) - (f30-1 (-> *part-id-table* 902 init-specs 8 initial-valuef)) - (f28-0 (-> *part-id-table* 902 init-specs 8 random-rangef)) - ) - (set! (-> *part-id-table* 902 init-specs 8 initial-valuef) (* f30-1 f0-5)) - (set! (-> *part-id-table* 902 init-specs 8 random-rangef) (* f28-0 f0-5)) - (launch-particles (-> *part-id-table* 902) gp-0) - (set! (-> *part-id-table* 902 init-specs 8 initial-valuef) f30-1) - (set! (-> *part-id-table* 902 init-specs 8 random-rangef) f28-0) - ) + (let ((f30-0 (-> *part-id-table* 900 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 900 init-specs 4 initial-valuef) (fmin f30-0 (vector-length s5-1))) + (draw-beam (-> *part-id-table* 900) a1-0 s5-1 #f) + (set! (-> *part-id-table* 900 init-specs 4 initial-valuef) f30-0) + ) + (vector-normalize! s5-1 1.0) + (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)) + (f30-1 (-> *part-id-table* 902 init-specs 8 initial-valuef)) + (f28-0 (-> *part-id-table* 902 init-specs 8 random-rangef)) + ) + (set! (-> *part-id-table* 902 init-specs 8 initial-valuef) (* f30-1 f0-5)) + (set! (-> *part-id-table* 902 init-specs 8 random-rangef) (* f28-0 f0-5)) + (launch-particles (-> *part-id-table* 902) gp-1) + (set! (-> *part-id-table* 902 init-specs 8 initial-valuef) f30-1) + (set! (-> *part-id-table* 902 init-specs 8 random-rangef) f28-0) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 26 of type ashelin-shot 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 0a4aa398a0..31b04e0deb 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,61 +1290,47 @@ ;; 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 (v1-23 float) (sv-272 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) + (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)) + (a2-2 (-> v1-0 state mesh bounds)) + (a3-1 (-> v1-0 root-nav-sphere)) + (t0-1 (-> v1-0 sphere-count)) ) - (init-vf0-vector) - (let* ((v1-0 (-> this nav)) - (a0-3 (-> v1-0 state mesh sphere-hash sphere-array)) - (a1-1 (-> v1-0 sphere-id-array)) - (a2-2 (-> v1-0 state mesh bounds)) - (a3-1 (-> v1-0 root-nav-sphere)) - (t0-1 (-> v1-0 sphere-count)) - ) - (dotimes (t1-1 t0-1) - (let ((t3-0 (-> a0-3 (-> a1-1 t1-1))) - (t2-4 (-> v1-0 sphere-array t1-1)) - ) - (vector-! (the-as vector t2-4) (the-as vector t3-0) (the-as vector a2-2)) - (set! (-> t2-4 r) (+ (-> t3-0 r) (-> a3-1 w))) - ) - ) - ) - 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) - (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) - (vector-copy! arg0 (-> s0-0 out-travel 0)) - ) - 0 - (when (>= arg2 (fabs (deg- arg1 (atan (-> arg0 x) (-> arg0 z))))) - (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) - ) - (.lvf vf1 (&-> arg0 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-23 vf1) - (let ((f0-11 v1-23) - (f1-1 arg4) + (dotimes (t1-1 t0-1) + (let ((t3-0 (-> a0-3 (-> a1-1 t1-1))) + (t2-4 (-> v1-0 sphere-array t1-1)) ) - (>= f0-11 (* f1-1 f1-1)) + (vector-! (the-as vector t2-4) (the-as vector t3-0) (the-as vector a2-2)) + (set! (-> t2-4 r) (+ (-> t3-0 r) (-> a3-1 w))) ) ) ) + 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) + (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) + (vector-copy! arg0 (-> s0-0 out-travel 0)) + ) + 0 + (when (>= arg2 (fabs (deg- arg1 (atan (-> arg0 x) (-> arg0 z))))) + (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)) + ) + ) ) ;; definition for method 160 of type ashelin 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 c20c18b7d9..f102553426 100644 --- a/test/decompiler/reference/jak3/levels/common/ai/bot_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/ai/bot_REF.gc @@ -1560,46 +1560,25 @@ ;; definition for method 194 of type bot ;; INFO: Used lq/sq (defmethod bot-method-194 ((this bot) (arg0 bot-turn-info) (arg1 process-focusable) (arg2 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (-> this root))) - (quaternion-copy! (-> arg0 src-quat) (-> s5-0 quat)) - (vector-z-quaternion! (-> arg0 facing-dir) (-> s5-0 quat)) - (set! (-> arg0 facing-ry) (atan (-> arg0 facing-dir x) (-> arg0 facing-dir z))) - (vector-copy! (-> arg0 targ-pos) (get-trans arg1 3)) - (set! (-> arg0 targ-ry) - (atan (- (-> arg0 targ-pos x) (-> s5-0 trans x)) (- (-> arg0 targ-pos z) (-> s5-0 trans z))) - ) - (let ((a0-7 (get-transv arg1)) - (a1-6 (-> arg0 predicted-targ-pos)) - ) - (let ((v1-4 (-> arg0 targ-pos))) - (let ((a2-1 arg2)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-7 quad)) - (.lvf vf4 (&-> v1-4 quad)) + (let ((s5-0 (-> this root))) + (quaternion-copy! (-> arg0 src-quat) (-> s5-0 quat)) + (vector-z-quaternion! (-> arg0 facing-dir) (-> s5-0 quat)) + (set! (-> arg0 facing-ry) (atan (-> arg0 facing-dir x) (-> arg0 facing-dir z))) + (vector-copy! (-> arg0 targ-pos) (get-trans arg1 3)) + (set! (-> arg0 targ-ry) + (atan (- (-> arg0 targ-pos x) (-> s5-0 trans x)) (- (-> arg0 targ-pos z) (-> s5-0 trans z))) ) - (.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-6 quad) vf6) - ) - (set! (-> arg0 predicted-targ-ry) (atan - (- (-> arg0 predicted-targ-pos x) (-> s5-0 trans x)) - (- (-> arg0 predicted-targ-pos z) (-> s5-0 trans z)) - ) - ) + (let ((a0-7 (get-transv arg1))) + (vector+*! (-> arg0 predicted-targ-pos) (-> arg0 targ-pos) a0-7 arg2) ) - (set! (-> arg0 ry-diff) (deg- (-> arg0 targ-ry) (-> arg0 facing-ry))) - (set! (-> arg0 predicted-ry-diff) (deg- (-> arg0 predicted-targ-ry) (-> arg0 facing-ry))) + (set! (-> arg0 predicted-targ-ry) (atan + (- (-> arg0 predicted-targ-pos x) (-> s5-0 trans x)) + (- (-> arg0 predicted-targ-pos z) (-> s5-0 trans z)) + ) + ) ) + (set! (-> arg0 ry-diff) (deg- (-> arg0 targ-ry) (-> arg0 facing-ry))) + (set! (-> arg0 predicted-ry-diff) (deg- (-> arg0 predicted-targ-ry) (-> arg0 facing-ry))) ) ;; definition for method 220 of type bot @@ -1894,70 +1873,19 @@ ;; definition for method 193 of type bot ;; WARN: Return type mismatch int vs none. (defmethod bot-method-193 ((this bot) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((f1-1 (* arg5 arg5)) + (f0-2 (* arg5 f1-1)) ) - (init-vf0-vector) - (let* ((f1-1 (* arg5 arg5)) - (f0-2 (* arg5 f1-1)) - ) - (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) - (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) - (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) - ) - (vector-float*! arg0 arg1 f2-3) - (let ((t2-1 arg0)) - (let ((v1-10 arg0)) - (let ((a0-3 (vector+! (new 'stack-no-clear 'vector) arg1 arg2))) - (let ((a2-1 f3-7)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-3 quad)) - ) - (.lvf vf4 (&-> v1-10 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 (&-> t2-1 quad) vf6) + (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) + (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) + (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) ) - (let ((a2-2 arg0)) - (let ((v1-11 arg0)) - (let ((a0-5 (vector+! (new 'stack-no-clear 'vector) arg3 arg4))) - (let ((a3-2 f1-3)) - (.mov vf7 a3-2) - ) - (.lvf vf5 (&-> a0-5 quad)) - ) - (.lvf vf4 (&-> v1-11 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 ((v1-12 arg0)) - (let ((a0-6 arg0)) - (let ((a1-1 arg3)) - (let ((a2-3 f0-2)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a1-1 quad)) - ) - (.lvf vf4 (&-> a0-6 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-12 quad) vf6) - ) + (vector-float*! arg0 arg1 f2-3) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg1 arg2) f3-7) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg3 arg4) f1-3) ) - 0 - (none) + (vector+*! arg0 arg0 arg3 f0-2) ) + 0 + (none) ) 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 2bab8dfee9..6b16f2f213 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/grunt_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/grunt_REF.gc @@ -1246,53 +1246,38 @@ ;; definition for method 196 of type grunt (defmethod grunt-method-196 ((this grunt) (arg0 float)) - (local-vars (v1-5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (get-focus! this))) - (when gp-0 - (let ((v1-3 (get-trans gp-0 0)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (vector-! s4-0 v1-3 (-> this 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-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 ((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)))) - (go (method-of-object this attack)) - ) - ((let ((f0-10 12288.0)) - (< f30-0 (* f0-10 f0-10)) - ) - (go (method-of-object this spin-attack)) - ) + (let ((gp-0 (get-focus! this))) + (when gp-0 + (let ((v1-3 (get-trans gp-0 0)) + (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 ((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)))) + (go (method-of-object this attack)) + ) + ((let ((f0-10 12288.0)) + (< f30-0 (* f0-10 f0-10)) + ) + (go (method-of-object this spin-attack)) + ) ) ) ) ) ) - gp-0 ) + gp-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 7e96f82992..8fd861c627 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 @@ -1129,53 +1129,38 @@ ;; definition for method 197 of type kg-grunt (defmethod go-attack ((this kg-grunt) (arg0 float)) - (local-vars (v1-5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (get-focus! this))) - (when gp-0 - (let ((v1-3 (get-trans gp-0 0)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (vector-! s4-0 v1-3 (-> this 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-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 ((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)))) - (go (method-of-object this attack)) - ) - ((let ((f0-10 12288.0)) - (< f30-0 (* f0-10 f0-10)) - ) - (go (method-of-object this spin-attack)) - ) + (let ((gp-0 (get-focus! this))) + (when gp-0 + (let ((v1-3 (get-trans gp-0 0)) + (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 ((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)))) + (go (method-of-object this attack)) + ) + ((let ((f0-10 12288.0)) + (< f30-0 (* f0-10 f0-10)) + ) + (go (method-of-object this spin-attack)) + ) ) ) ) ) ) - gp-0 ) + gp-0 ) ) 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 b5c229e0b1..af32447c7d 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/mantis_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/mantis_REF.gc @@ -951,77 +951,56 @@ (logclear! (-> self flags) (mantis-flag attack1-enabled)) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((t9-0 (-> (method-of-type nav-enemy hostile) trans))) - (if t9-0 - (t9-0) + (let ((t9-0 (-> (method-of-type nav-enemy hostile) trans))) + (if t9-0 + (t9-0) + ) + ) + (let ((gp-0 (handle->process (-> self focus handle)))) + (when gp-0 + (let* ((s4-0 (-> self focus-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) s4-0 (-> self root trans))) + ) + (let ((s2-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable gp-0) 0)))) + (vector+*! s5-1 s5-1 s2-1 (* 2.0 (vector-length (get-transv (the-as process-focusable gp-0))))) ) - ) - (let ((gp-0 (handle->process (-> self focus handle)))) - (when gp-0 - (let* ((s4-0 (-> self focus-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) s4-0 (-> self root trans))) + (let ((f30-1 (vector-length s5-1))) + (when (not (logtest? (-> self flags) (mantis-flag tracked))) + (cond + ((not (time-elapsed? (-> self attack-timer) (seconds 5))) + (if (and (< 73728.0 f30-1) (mantis-method-206 self)) + (go-virtual crawl) + ) + ) + ((< 40960.0 f30-1) + (mantis-method-202 self (the-as process-focusable gp-0) s5-1) ) - (let ((s2-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable gp-0) 0))) - (s1-0 s5-1) - ) - (let ((s3-1 s5-1)) - (let ((v1-14 (* 2.0 (vector-length (get-transv (the-as process-focusable gp-0)))))) - (.mov vf7 v1-14) - ) - (.lvf vf5 (&-> s2-1 quad)) - (.lvf vf4 (&-> s3-1 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 (&-> s1-0 quad) vf6) - ) - (let ((f30-1 (vector-length s5-1))) - (when (not (logtest? (-> self flags) (mantis-flag tracked))) - (cond - ((not (time-elapsed? (-> self attack-timer) (seconds 5))) - (if (and (< 73728.0 f30-1) (mantis-method-206 self)) - (go-virtual crawl) - ) - ) - ((< 40960.0 f30-1) - (mantis-method-202 self (the-as process-focusable gp-0) s5-1) - ) - ) - ) - (when (and (and gp-0 - (not (logtest? (-> (the-as process-focusable gp-0) focus-status) (focus-status disable dead ignore grabbed))) - ) - (and (time-elapsed? (-> self attack-timer) (seconds 5)) (pointing-toward? self s4-0 8192.0) (< f30-1 32768.0)) - ) - (cond - ((< 24576.0 f30-1) - (if (logtest? (-> self flags) (mantis-flag attack1-enabled)) - (go-virtual attack1) - ) - ) - ((< 16384.0 f30-1) - (go-virtual attack0) - ) - ) ) ) - (if (pointing-toward? self s4-0 10922.667) - (mantis-method-199 self) - ) - (if (logtest? (-> self flags) (mantis-flag tracked)) - (mantis-method-204 self (the-as process-focusable gp-0) s5-1) - (mantis-method-203 self (the-as process-focusable gp-0) s5-1) + (when (and (and gp-0 + (not (logtest? (-> (the-as process-focusable gp-0) focus-status) (focus-status disable dead ignore grabbed))) + ) + (and (time-elapsed? (-> self attack-timer) (seconds 5)) (pointing-toward? self s4-0 8192.0) (< f30-1 32768.0)) + ) + (cond + ((< 24576.0 f30-1) + (if (logtest? (-> self flags) (mantis-flag attack1-enabled)) + (go-virtual attack1) + ) + ) + ((< 16384.0 f30-1) + (go-virtual attack0) + ) ) + ) ) + (if (pointing-toward? self s4-0 10922.667) + (mantis-method-199 self) + ) + (if (logtest? (-> self flags) (mantis-flag tracked)) + (mantis-method-204 self (the-as process-focusable gp-0) s5-1) + (mantis-method-203 self (the-as process-focusable gp-0) s5-1) + ) ) ) ) @@ -1398,61 +1377,40 @@ '() ) :code (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (ja-channel-push! 1 (seconds 0.2)) - (until #f - (let ((gp-0 (handle->process (-> self focus handle)))) - (when gp-0 - (let* ((v1-5 (-> self focus-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) v1-5 (-> self root trans))) - ) - (let ((s4-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable gp-0) 0)))) - (if (and (>= (vector-length s5-1) 122880.0) (mantis-method-206 self)) - (go-virtual crawl) - ) - (let ((s2-0 s5-1)) - (let ((s3-1 s5-1)) - (let ((v1-21 (* 0.2 (vector-length (get-transv (the-as process-focusable gp-0)))))) - (.mov vf7 v1-21) - ) - (.lvf vf5 (&-> s4-1 quad)) - (.lvf vf4 (&-> s3-1 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 (&-> s2-0 quad) vf6) - ) - ) - (if (not (or (mantis-method-203 self (the-as process-focusable gp-0) s5-1) (not (mantis-method-206 self)))) + (ja-channel-push! 1 (seconds 0.2)) + (until #f + (let ((gp-0 (handle->process (-> self focus handle)))) + (when gp-0 + (let* ((v1-5 (-> self focus-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) v1-5 (-> self root trans))) + ) + (let ((s4-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable gp-0) 0)))) + (if (and (>= (vector-length s5-1) 122880.0) (mantis-method-206 self)) (go-virtual crawl) ) + (vector+*! s5-1 s5-1 s4-1 (* 0.2 (vector-length (get-transv (the-as process-focusable gp-0))))) ) - (if (and (time-elapsed? (-> self state-time) (-> self reaction-time)) - (>= (the-as int (-> self focus aware)) 3) - (get-focus! self) - ) - (go-hostile self) + (if (not (or (mantis-method-203 self (the-as process-focusable gp-0) s5-1) (not (mantis-method-206 self)))) + (go-virtual crawl) ) ) - ) - (dotimes (gp-1 (rnd-time-frame self (seconds 0.007) (seconds 0.015))) - (ja-no-eval :group! mantis-idle0-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek!)) - ) + (if (and (time-elapsed? (-> self state-time) (-> self reaction-time)) + (>= (the-as int (-> self focus aware)) 3) + (get-focus! self) + ) + (go-hostile self) + ) + ) + ) + (dotimes (gp-1 (rnd-time-frame self (seconds 0.007) (seconds 0.015))) + (ja-no-eval :group! mantis-idle0-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) ) ) - #f ) + #f ) :post nav-enemy-face-focus-post ) @@ -1765,40 +1723,19 @@ ;; definition for method 200 of type mantis (defmethod mantis-method-200 ((this mantis)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (handle->process (-> this focus handle)))) - (when s5-0 - (let* ((v1-4 (-> this focus-pos)) - (s4-1 (vector-! (new 'stack-no-clear 'vector) v1-4 (-> this root trans))) - ) - (let ((s2-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable s5-0) 0))) - (s1-0 s4-1) - ) - (let ((s3-1 s4-1)) - (let ((v1-10 (* 0.2 (vector-length (get-transv (the-as process-focusable s5-0)))))) - (.mov vf7 v1-10) - ) - (.lvf vf5 (&-> s2-1 quad)) - (.lvf vf4 (&-> s3-1 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 (&-> s1-0 quad) vf6) - ) - (mantis-method-203 this (the-as process-focusable s5-0) s4-1) + (let ((s5-0 (handle->process (-> this focus handle)))) + (when s5-0 + (let* ((v1-4 (-> this focus-pos)) + (s4-1 (vector-! (new 'stack-no-clear 'vector) v1-4 (-> this root trans))) + ) + (let ((s2-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable s5-0) 0)))) + (vector+*! s4-1 s4-1 s2-1 (* 0.2 (vector-length (get-transv (the-as process-focusable s5-0))))) ) + (mantis-method-203 this (the-as process-focusable s5-0) s4-1) ) ) - (none) ) + (none) ) ;; definition for method 75 of type mantis 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 364d3656a0..8f4442f62b 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/roboguard_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/roboguard_REF.gc @@ -1146,67 +1146,44 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (sound-play "robo-explode") - (let ((v1-2 (-> self root root-prim))) - (set! (-> v1-2 prim-core collide-as) (collide-spec)) - (set! (-> v1-2 prim-core collide-with) (collide-spec)) + (sound-play "robo-explode") + (let ((v1-2 (-> self root root-prim))) + (set! (-> v1-2 prim-core collide-as) (collide-spec)) + (set! (-> v1-2 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> self draw status) (draw-control-status no-draw)) + (set! (-> self root root-prim local-sphere w) 491520.0) + (send-event self 'death-start) + (let ((gp-1 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (vector+*! (-> gp-1 fountain-rand-transv-lo) (-> self root trans) *up-vector* 2048.0) + (vector-copy! s5-1 (-> self incoming attack-direction)) + (vector-normalize-copy! (-> gp-1 fountain-rand-transv-lo) s5-1 -20480.0) + (vector-normalize-copy! (-> gp-1 fountain-rand-transv-hi) s5-1 122880.0) ) - 0 - (logior! (-> self draw status) (draw-control-status no-draw)) - (set! (-> self root root-prim local-sphere w) 491520.0) - (send-event self 'death-start) - (let ((gp-1 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (let ((v1-14 (-> gp-1 fountain-rand-transv-lo))) - (let ((a0-8 (-> self root trans))) - (let ((a1-3 *up-vector*)) - (let ((a2-3 2048.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> a0-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 (&-> v1-14 quad) vf6) - ) - (vector-copy! s5-1 (-> self incoming attack-direction)) - (vector-normalize-copy! (-> gp-1 fountain-rand-transv-lo) s5-1 -20480.0) - (vector-normalize-copy! (-> gp-1 fountain-rand-transv-hi) s5-1 122880.0) - ) - (set! (-> gp-1 fountain-rand-transv-lo y) 40960.0) - (set! (-> gp-1 fountain-rand-transv-hi y) 81920.0) - (process-spawn - joint-exploder - (art-group-get-by-name *level* "skel-roboguard-explode" (the-as (pointer level) #f)) - 35 - gp-1 - *roboguard-exploder-params* - :name "joint-exploder" - :to self - :unk 0 - ) + (set! (-> gp-1 fountain-rand-transv-lo y) 40960.0) + (set! (-> gp-1 fountain-rand-transv-hi y) 81920.0) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-roboguard-explode" (the-as (pointer level) #f)) + 35 + gp-1 + *roboguard-exploder-params* + :name "joint-exploder" + :to self + :unk 0 ) - (let ((v1-25 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node roboguard-lod0-jg chest)))) - (cond - ((logtest? (-> *part-group-id-table* 219 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) v1-25) - (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 219)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) v1-25) - (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 219)) - ) + ) + (let ((v1-26 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node roboguard-lod0-jg chest)))) + (cond + ((logtest? (-> *part-group-id-table* 219 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) v1-26) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 219)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) v1-26) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 219)) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/common/enemy/spyder_REF.gc b/test/decompiler/reference/jak3/levels/common/enemy/spyder_REF.gc index 5c574427df..9673957236 100644 --- a/test/decompiler/reference/jak3/levels/common/enemy/spyder_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/enemy/spyder_REF.gc @@ -781,126 +781,75 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod spyder-method-197 ((this spyder)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (let ((v1-0 (-> s5-0 bbox)) - (a0-2 (-> this root trans)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-0 x) 22528.0) - (set! (-> a1-0 y) 22528.0) - (set! (-> a1-0 z) 22528.0) - (set! (-> a1-0 w) 1.0) - (vector-! (-> v1-0 min) a0-2 a1-0) - ) - (let ((v1-2 (-> s5-0 bbox max)) - (a0-4 (-> this root trans)) - (a1-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-1 x) 22528.0) - (set! (-> a1-1 y) 22528.0) - (set! (-> a1-1 z) 22528.0) - (set! (-> a1-1 w) 1.0) - (vector+! v1-2 a0-4 a1-1) - ) - (set! (-> s5-0 collide-with) (collide-spec backgnd)) - (set! (-> s5-0 ignore-process0) #f) - (set! (-> s5-0 ignore-process1) #f) - (set! (-> s5-0 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (fill-using-bounding-box *collide-cache* s5-0) - (dotimes (s4-0 4) - (-> this joint-ik s4-0 shoulder-matrix-no-ik) - (let ((a2-8 (-> this joint-ik s4-0 elbow-matrix-no-ik)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-15 (new 'stack-no-clear 'vector))) - (vector-copy! v1-15 *y-vector*) - (new 'stack-no-clear 'vector) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (let ((a1-3 s3-0)) - (let ((a0-9 (-> a2-8 trans))) - (let ((a2-9 (-> a2-8 uvec))) - (let ((a3-3 (-> this joint-ik s4-0 hand-dist))) - (.mov vf7 a3-3) - ) - (.lvf vf5 (&-> a2-9 quad)) - ) - (.lvf vf4 (&-> a0-9 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-3 quad) vf6) - ) - (vector-copy! s2-0 s3-0) - (set! (-> s2-0 y) (-> this root trans y)) - (let ((a2-10 (-> s5-0 start-pos))) - (let ((a0-12 s2-0)) - (let ((a1-6 v1-15)) - (let ((a3-5 16384.0)) - (.mov vf7 a3-5) - ) - (.lvf vf5 (&-> a1-6 quad)) - ) - (.lvf vf4 (&-> a0-12 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-10 quad) vf6) - ) - (vector-float*! (-> s5-0 move-dist) v1-15 -32768.0) - (let ((v1-16 s5-0)) - (set! (-> v1-16 radius) 40.96) - (set! (-> v1-16 collide-with) (collide-spec backgnd)) - (set! (-> v1-16 ignore-process0) #f) - (set! (-> v1-16 ignore-process1) #f) - (set! (-> v1-16 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-16 action-mask) (collide-action solid)) - ) - (let ((f0-13 (probe-using-line-sphere *collide-cache* s5-0))) - (when (>= f0-13 0.0) - (let ((a1-10 s2-0)) - (let ((v1-19 (-> s5-0 start-pos))) - (let ((a0-20 (-> s5-0 move-dist))) - (let ((a2-11 f0-13)) - (.mov vf7 a2-11) - ) - (.lvf vf5 (&-> a0-20 quad)) - ) - (.lvf vf4 (&-> v1-19 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-10 quad) vf6) - ) - ) - ) - (let ((f0-15 (fmax -8192.0 (fmin 8192.0 (- (-> s2-0 y) (-> s3-0 y)))))) - (+! (-> this delta-y-ik s4-0) (* 10.0 (seconds-per-frame) (- f0-15 (-> this delta-y-ik s4-0)))) - ) - ) - ) - (+! (-> s3-0 y) (-> this delta-y-ik s4-0)) - (set-ik-target! (-> this joint-ik s4-0) s3-0) + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (let ((v1-0 (-> s5-0 bbox)) + (a0-2 (-> this root trans)) + (a1-0 (new 'stack-no-clear 'vector)) ) + (set! (-> a1-0 x) 22528.0) + (set! (-> a1-0 y) 22528.0) + (set! (-> a1-0 z) 22528.0) + (set! (-> a1-0 w) 1.0) + (vector-! (-> v1-0 min) a0-2 a1-0) + ) + (let ((v1-2 (-> s5-0 bbox max)) + (a0-4 (-> this root trans)) + (a1-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-1 x) 22528.0) + (set! (-> a1-1 y) 22528.0) + (set! (-> a1-1 z) 22528.0) + (set! (-> a1-1 w) 1.0) + (vector+! v1-2 a0-4 a1-1) + ) + (set! (-> s5-0 collide-with) (collide-spec backgnd)) + (set! (-> s5-0 ignore-process0) #f) + (set! (-> s5-0 ignore-process1) #f) + (set! (-> s5-0 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (fill-using-bounding-box *collide-cache* s5-0) + (dotimes (s4-0 4) + (-> this joint-ik s4-0 shoulder-matrix-no-ik) + (let ((a2-8 (-> this joint-ik s4-0 elbow-matrix-no-ik)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((v1-15 (new 'stack-no-clear 'vector))) + (vector-copy! v1-15 *y-vector*) + (new 'stack-no-clear 'vector) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (vector+*! s3-0 (-> a2-8 trans) (-> a2-8 uvec) (-> this joint-ik s4-0 hand-dist)) + (vector-copy! s2-0 s3-0) + (set! (-> s2-0 y) (-> this root trans y)) + (vector+*! (-> s5-0 start-pos) s2-0 v1-15 16384.0) + (vector-float*! (-> s5-0 move-dist) v1-15 -32768.0) + (let ((v1-16 s5-0)) + (set! (-> v1-16 radius) 40.96) + (set! (-> v1-16 collide-with) (collide-spec backgnd)) + (set! (-> v1-16 ignore-process0) #f) + (set! (-> v1-16 ignore-process1) #f) + (set! (-> v1-16 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-16 action-mask) (collide-action solid)) + ) + (let ((f0-13 (probe-using-line-sphere *collide-cache* s5-0))) + (if (>= f0-13 0.0) + (vector+*! s2-0 (-> s5-0 start-pos) (-> s5-0 move-dist) f0-13) + ) + ) + (let ((f0-15 (fmax -8192.0 (fmin 8192.0 (- (-> s2-0 y) (-> s3-0 y)))))) + (+! (-> this delta-y-ik s4-0) (* 10.0 (seconds-per-frame) (- f0-15 (-> this delta-y-ik s4-0)))) + ) + ) + ) + (+! (-> s3-0 y) (-> this delta-y-ik s4-0)) + (set-ik-target! (-> this joint-ik s4-0) s3-0) ) ) - 0 - (none) ) + 0 + (none) ) ;; failed to figure out what this is: 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 9304babe47..a5574cf564 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 @@ -405,11 +405,8 @@ ;; 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 (v1-40 float) (sv-672 float) (sv-688 vector) (sv-704 int)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) + (local-vars (sv-672 float) (sv-688 vector) (sv-704 int)) + (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) @@ -483,14 +480,7 @@ (if (< 0.0 (-> s2-0 float3)) (vector-float*! (-> s2-0 vec0) (-> s2-0 vec0) (-> s2-0 float3)) ) - (.lvf vf1 (&-> (-> s2-0 vec0) 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-40 vf1) - (let ((f0-17 v1-40) + (let ((f0-17 (vector-length-squared (-> s2-0 vec0))) (f1-4 (/ arg3 2)) ) (when (< (* f1-4 f1-4) f0-17) diff --git a/test/decompiler/reference/jak3/levels/common/hvehicle/turret-control_REF.gc b/test/decompiler/reference/jak3/levels/common/hvehicle/turret-control_REF.gc index 29e264c730..5ff3210e42 100644 --- a/test/decompiler/reference/jak3/levels/common/hvehicle/turret-control_REF.gc +++ b/test/decompiler/reference/jak3/levels/common/hvehicle/turret-control_REF.gc @@ -240,54 +240,33 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun vehicle-draw-beam ((arg0 sparticle-launcher) (arg1 vector) (arg2 vector) (arg3 object) (arg4 symbol)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((a1-2 (vector+! (new 'stack-no-clear 'vector) arg1 arg2))) - (when (or (not arg4) (line-in-view-frustum? arg1 a1-2)) - (let ((s5-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'quaternion)) - ) - (if (get-field-spec-by-id arg0 (sp-field-id spt-scale-y)) - (set! (-> *beam-info* y-scale) (vector-length arg2)) - ) - (let ((a0-4 s5-0)) - (let ((v1-10 arg2)) - (let ((a1-5 0.5)) - (.mov vf7 a1-5) - ) - (.lvf vf5 (&-> v1-10 quad)) - ) - (.lvf vf4 (&-> arg1 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-4 quad) vf6) + (let ((a1-2 (vector+! (new 'stack-no-clear 'vector) arg1 arg2))) + (when (or (not arg4) (line-in-view-frustum? arg1 a1-2)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'quaternion)) ) - (forward-up->quaternion s4-0 arg2 (new 'static 'vector :y 1.0 :w 1.0)) - (dotimes (s3-1 3) - (quaternion-rotate-local-z! s4-0 s4-0 10922.667) - (quaternion-copy! *particle-quat* s4-0) - (let ((t9-5 sp-launch-particles-var) - (a0-8 *sp-particle-system-3d*) - (a1-9 arg0) - (a2-3 *launch-matrix*) - ) - (vector-copy! (-> a2-3 trans) s5-0) - (t9-5 a0-8 a1-9 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) - ) + (if (get-field-spec-by-id arg0 (sp-field-id spt-scale-y)) + (set! (-> *beam-info* y-scale) (vector-length arg2)) + ) + (vector+*! s5-0 arg1 arg2 0.5) + (forward-up->quaternion s4-0 arg2 (new 'static 'vector :y 1.0 :w 1.0)) + (dotimes (s3-1 3) + (quaternion-rotate-local-z! s4-0 s4-0 10922.667) + (quaternion-copy! *particle-quat* s4-0) + (let ((t9-5 sp-launch-particles-var) + (a0-9 *sp-particle-system-3d*) + (a1-8 arg0) + (a2-3 *launch-matrix*) + ) + (vector-copy! (-> a2-3 trans) s5-0) + (t9-5 a0-9 a1-8 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for function vehicle-draw-laser-spot 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 43bf5f634b..528fef1acc 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 @@ -4,45 +4,24 @@ ;; definition for function race-find-ground ;; INFO: Used lq/sq (defun race-find-ground ((arg0 vector) (arg1 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> s5-0 start-pos) arg1) - (vector-reset! (-> s5-0 move-dist)) - (set! (-> s5-0 move-dist y) -409600.0) - (let ((v1-3 s5-0)) - (set! (-> v1-3 radius) 2048.0) - (set! (-> v1-3 collide-with) (collide-spec backgnd)) - (set! (-> v1-3 ignore-process0) #f) - (set! (-> v1-3 ignore-process1) #f) - (set! (-> v1-3 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-3 action-mask) (collide-action solid)) - ) - (let ((f0-2 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) - (when (>= f0-2 0.0) - (let ((v1-6 (-> s5-0 start-pos))) - (let ((a0-8 (-> s5-0 move-dist))) - (let ((a1-2 f0-2)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-8 quad)) - ) - (.lvf vf4 (&-> v1-6 quad)) + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> s5-0 start-pos) arg1) + (vector-reset! (-> s5-0 move-dist)) + (set! (-> s5-0 move-dist y) -409600.0) + (let ((v1-3 s5-0)) + (set! (-> v1-3 radius) 2048.0) + (set! (-> v1-3 collide-with) (collide-spec backgnd)) + (set! (-> v1-3 ignore-process0) #f) + (set! (-> v1-3 ignore-process1) #f) + (set! (-> v1-3 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> arg0 quad) vf6) - #t - ) + (set! (-> v1-3 action-mask) (collide-action solid)) + ) + (let ((f0-2 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) + (when (>= f0-2 0.0) + (vector+*! arg0 (-> s5-0 start-pos) (-> s5-0 move-dist) f0-2) + #t ) ) ) @@ -194,118 +173,103 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod update-lap-distance ((this racer-state) (arg0 race-state)) - (local-vars (a0-29 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'matrix3))) - (-> arg0 info) - (let ((v1-2 (handle->process (-> this racer)))) - (cond - (v1-2 - (if (focus-test? (the-as process-focusable v1-2) dead inactive) - (logior! (-> this flags) (racer-state-flags rsf2)) - ) - (set! (-> s5-0 vector 0 quad) (-> (the-as process-focusable v1-2) root trans quad)) - (when (not (logtest? (-> this flags) (racer-state-flags rsf1 rsf2))) - (let ((s3-0 (new 'stack-no-clear 'race-mesh-slice-query))) - (set! (-> s3-0 search-sphere quad) (-> s5-0 vector 0 quad)) - (set! (-> s3-0 search-sphere r) 0.0) - (race-mesh-method-13 (-> arg0 info mesh) (the-as race-mesh-slice-query (&-> s3-0 slice-id))) - (set! (-> this lap-distance-prev) (-> this lap-distance)) - (cond - ((>= (-> s3-0 slice-id) 0) - (set! (-> this lap-distance) (-> s3-0 lap-dist)) - (if (not (logtest? (-> this flags) (racer-state-flags rsf6))) - (set! (-> this lap-distance-prev) (-> this lap-distance)) - ) - (logior! (-> this flags) (racer-state-flags rsf6)) - ) - (else - (logclear! (-> this flags) (racer-state-flags rsf6)) - ) + (let ((s5-0 (new 'stack-no-clear 'matrix3))) + (-> arg0 info) + (let ((v1-2 (handle->process (-> this racer)))) + (cond + (v1-2 + (if (focus-test? (the-as process-focusable v1-2) dead inactive) + (logior! (-> this flags) (racer-state-flags rsf2)) + ) + (set! (-> s5-0 vector 0 quad) (-> (the-as process-focusable v1-2) root trans quad)) + (when (not (logtest? (-> this flags) (racer-state-flags rsf1 rsf2))) + (let ((s3-0 (new 'stack-no-clear 'race-mesh-slice-query))) + (set! (-> s3-0 search-sphere quad) (-> s5-0 vector 0 quad)) + (set! (-> s3-0 search-sphere r) 0.0) + (race-mesh-method-13 (-> arg0 info mesh) (the-as race-mesh-slice-query (&-> s3-0 slice-id))) + (set! (-> this lap-distance-prev) (-> this lap-distance)) + (cond + ((>= (-> s3-0 slice-id) 0) + (set! (-> this lap-distance) (-> s3-0 lap-dist)) + (if (not (logtest? (-> this flags) (racer-state-flags rsf6))) + (set! (-> this lap-distance-prev) (-> this lap-distance)) + ) + (logior! (-> this flags) (racer-state-flags rsf6)) + ) + (else + (logclear! (-> this flags) (racer-state-flags rsf6)) ) - (cond - ((logtest? (-> arg0 info mesh flags) (race-mesh-flag rmf0)) - (when (>= (-> s3-0 slice-id) 0) - (let ((v1-29 (min 3 (the int (* 4.0 (-> s3-0 lap-dist)))))) - (when (= v1-29 (logand (+ (-> this lap-quadrant) 1) 3)) - (set! (-> this lap-quadrant) v1-29) - (when (zero? v1-29) - (if (logtest? (-> this flags) (racer-state-flags rsf0)) - (end-lap this arg0) - (begin-race arg0) - ) - (begin-lap this arg0) - ) + ) + (cond + ((logtest? (-> arg0 info mesh flags) (race-mesh-flag rmf0)) + (when (>= (-> s3-0 slice-id) 0) + (let ((v1-29 (min 3 (the int (* 4.0 (-> s3-0 lap-dist)))))) + (when (= v1-29 (logand (+ (-> this lap-quadrant) 1) 3)) + (set! (-> this lap-quadrant) v1-29) + (when (zero? v1-29) + (if (logtest? (-> this flags) (racer-state-flags rsf0)) + (end-lap this arg0) + (begin-race arg0) + ) + (begin-lap this arg0) ) ) ) ) - ((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))) - (.lvf vf1 (&-> (-> v1-39 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 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 (-> v1-39 0) (-> arg0 info finish-dir)))) - (end-lap this arg0) - ) - ) + ) + ((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) + ) ) ) - (else - (when (< 0.0 (-> this lap-distance)) - (begin-race arg0) - (begin-lap this arg0) - ) + ) + (else + (when (< 0.0 (-> this lap-distance)) + (begin-race arg0) + (begin-lap this arg0) ) ) ) - (let ((f0-10 (-> arg0 info ai-max-speed-factor))) - (if (< (+ (-> arg0 target-pos) (-> this target-pos-offset)) (-> this pos)) - (set! f0-10 (-> arg0 info ai-min-speed-factor)) - ) - (seek! (-> this speed-factor) f0-10 (* 0.2 (seconds-per-frame))) - ) - 0 ) - (if (logtest? (-> this flags) (racer-state-flags rsf1)) - (seek! (-> this speed-factor) 0.9 (* 0.2 (seconds-per-frame))) - ) - (when (logtest? (-> this flags) (racer-state-flags rsf0)) - (dotimes (s3-1 (-> arg0 info decision-point-count)) - (let ((v1-70 (-> arg0 info decision-point-array s3-1))) - (if (and (< (-> this lap-distance-prev) (-> v1-70 pos)) (>= (-> this lap-distance) (-> v1-70 pos))) - (send-event (handle->process (-> this racer)) 'race-decision-point v1-70) - ) + (let ((f0-10 (-> arg0 info ai-max-speed-factor))) + (if (< (+ (-> arg0 target-pos) (-> this target-pos-offset)) (-> this pos)) + (set! f0-10 (-> arg0 info ai-min-speed-factor)) ) - ) - (set! (-> this pos) (+ (-> this lap-distance) (the float (-> this lap-count)))) + (seek! (-> this speed-factor) f0-10 (* 0.2 (seconds-per-frame))) ) - (vector-copy! (-> this position) (-> s5-0 vector 0)) + 0 ) - (else - (logior! (-> this flags) (racer-state-flags rsf2)) + (if (logtest? (-> this flags) (racer-state-flags rsf1)) + (seek! (-> this speed-factor) 0.9 (* 0.2 (seconds-per-frame))) + ) + (when (logtest? (-> this flags) (racer-state-flags rsf0)) + (dotimes (s3-1 (-> arg0 info decision-point-count)) + (let ((v1-70 (-> arg0 info decision-point-array s3-1))) + (if (and (< (-> this lap-distance-prev) (-> v1-70 pos)) (>= (-> this lap-distance) (-> v1-70 pos))) + (send-event (handle->process (-> this racer)) 'race-decision-point v1-70) + ) + ) + ) + (set! (-> this pos) (+ (-> this lap-distance) (the float (-> this lap-count)))) ) + (vector-copy! (-> this position) (-> s5-0 vector 0)) + ) + (else + (logior! (-> this flags) (racer-state-flags rsf2)) ) ) ) - (when (logtest? (-> this flags) (racer-state-flags rsf7)) - ) - 0 - (none) ) + (when (logtest? (-> this flags) (racer-state-flags rsf7)) + ) + 0 + (none) ) ;; definition for method 12 of type racer-state @@ -770,46 +734,23 @@ ;; definition for method 15 of type race-state ;; WARN: Return type mismatch int vs none. (defmethod race-state-method-15 ((this race-state)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (= (level-status? *level* 'lracelit #f) 'active) - (let ((gp-1 (-> this info))) - (handle->process (-> this manager)) - (let ((s5-1 (new 'stack-no-clear 'matrix))) - (vector-float*! (-> s5-1 fvec) (-> gp-1 start-dir) -1.0) - (forward-up-nopitch->quaternion - (the-as quaternion (-> s5-1 uvec)) - (-> s5-1 fvec) - (new 'static 'vector :y 1.0 :w 1.0) - ) - (let ((a0-8 (-> s5-1 rvec))) - (let ((v1-9 (-> gp-1 start-sphere))) - (let ((a1-4 (-> gp-1 start-dir))) - (let ((a2-3 49152.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a1-4 quad)) - ) - (.lvf vf4 (&-> v1-9 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-8 quad) vf6) - ) - (+! (-> s5-1 rvec y) 22528.0) + (when (= (level-status? *level* 'lracelit #f) 'active) + (let ((gp-1 (-> this info))) + (handle->process (-> this manager)) + (let ((s5-1 (new 'stack-no-clear 'matrix))) + (vector-float*! (-> s5-1 fvec) (-> gp-1 start-dir) -1.0) + (forward-up-nopitch->quaternion + (the-as quaternion (-> s5-1 uvec)) + (-> s5-1 fvec) + (new 'static 'vector :y 1.0 :w 1.0) ) + (vector+*! (-> s5-1 rvec) (the-as vector (-> gp-1 start-sphere)) (-> gp-1 start-dir) 49152.0) + (+! (-> s5-1 rvec y) 22528.0) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 16 of type race-state @@ -827,129 +768,92 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod initialize ((this race-state) (arg0 process) (arg1 race-info)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s3-0 (-> this flags))) - (mem-set32! (the-as pointer this) 328 0) - (set! (-> this flags) s3-0) - ) - (set! (-> this info) arg1) - (set! (-> this manager) (process->handle arg0)) - (set! (-> this scene-player) (the-as handle #f)) - (set! (-> this hud-timer) (the-as handle #f)) - (set! (-> this hud-lap-counter) (the-as handle #f)) - (set! (-> this hud-turbo-counter) (the-as handle #f)) - (set! (-> this hud-position) (the-as handle #f)) - (set! (-> this arrow) (the-as handle #f)) - (set! (-> this race-signal) (the-as handle #f)) - (set! (-> this state) (race-state-enum rs0)) - (set! (-> this racer-count) (-> arg1 racer-count)) - (set! (-> this finished-count) 0) - (set! (-> this i-player) -1) - (set! (-> this player-win?) #f) - (set! (-> this new-score?) #f) - (dotimes (v1-5 (-> arg1 racer-count)) - (let ((a0-7 (-> arg1 racer-array v1-5 rider))) - (if (or (zero? a0-7) (= a0-7 1)) - (set! (-> this i-player) v1-5) - ) - ) - ) - (let ((v1-8 (new 'stack-no-clear 'race-manager-stack-var0))) - (set! (-> v1-8 vec1 z) 61440.0) - (set! (-> v1-8 word) 1) - (set! (-> v1-8 vec0 z) (/ (-> v1-8 vec1 z) -2)) - (set! (-> v1-8 vec0 w) -20480.0) - (set! (-> v1-8 vec1 x) (/ (-> v1-8 vec1 z) (the float (max 1 (+ (-> v1-8 word) -1))))) - (set! (-> v1-8 vec1 y) -40960.0) - (set! (-> v1-8 mat rvec quad) (-> arg1 start-sphere quad)) - (vector-copy! (-> v1-8 mat uvec) (-> arg1 start-dir)) - (set-vector! (-> v1-8 mat fvec) (-> v1-8 mat uvec z) 0.0 (- (-> v1-8 mat uvec x)) 1.0) - (dotimes (a0-22 (-> arg1 racer-count)) - (cond - (#t - (let ((a1-12 a0-22)) - (let ((a2-2 (logand a0-22 1))) - (set! (-> v1-8 vec0 x) (+ (-> v1-8 vec0 z) (* (-> v1-8 vec1 x) (the float a2-2)))) - ) - (set! (-> v1-8 vec0 y) (+ (-> v1-8 vec0 w) (* (-> v1-8 vec1 y) (the float a1-12)))) - ) - ) - (else - (let ((a1-15 (/ a0-22 (-> v1-8 word)))) - (let ((a2-5 (- a0-22 (* a1-15 (-> v1-8 word))))) - (set! (-> v1-8 vec0 x) (+ (-> v1-8 vec0 z) (* (-> v1-8 vec1 x) (the float a2-5)))) - ) - (set! (-> v1-8 vec0 y) (+ (-> v1-8 vec0 w) (* (-> v1-8 vec1 y) (the float a1-15)))) - ) - ) - ) - (let ((a1-20 (-> this racer-array a0-22))) - (-> arg1 racer-array a0-22) - (vector-copy! (-> v1-8 mat trans) (-> v1-8 mat rvec)) - (let ((t0-0 (-> v1-8 mat trans))) - (let ((a2-9 (-> v1-8 mat trans))) - (let ((a3-3 (-> v1-8 mat uvec))) - (let ((t1-0 (-> v1-8 vec0 y))) - (.mov vf7 t1-0) - ) - (.lvf vf5 (&-> a3-3 quad)) - ) - (.lvf vf4 (&-> a2-9 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 (&-> t0-0 quad) vf6) - ) - (let ((t0-1 (-> v1-8 mat trans))) - (let ((a2-10 (-> v1-8 mat trans))) - (let ((a3-4 (-> v1-8 mat fvec))) - (let ((t1-1 (-> v1-8 vec0 x))) - (.mov vf7 t1-1) - ) - (.lvf vf5 (&-> a3-4 quad)) - ) - (.lvf vf4 (&-> a2-10 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 (&-> t0-1 quad) vf6) - ) - (vector-copy! (-> a1-20 start-position) (-> v1-8 mat trans)) - (set! (-> a1-20 rank) a0-22) - (set! (-> a1-20 speed-factor) 1.0) - (set! (-> a1-20 racer) (the-as handle #f)) - ) - (set! (-> this rankings a0-22) a0-22) - ) - ) - (dotimes (v1-11 (-> this info turbo-pad-count)) - (set! (-> this info turbo-pad-array v1-11 handle) (the-as handle #f)) - ) - (let ((v1-17 (-> *game-info* sub-task-list (-> arg1 task-node)))) - (set! (-> this suck-factor) 0.0) - (if (not (logtest? (-> arg1 flags) (racer-info-flag rif3))) - (set! (-> this suck-factor) (fmax 0.0 (fmin 1.0 (* 0.3333 (+ -2.0 (the float (-> v1-17 death-count))))))) - ) - (format - #t - "race-state::initialize: death-count ~d, suck-factor ~f~%" - (-> v1-17 death-count) - (-> this suck-factor) - ) - ) - (logior! (-> this flags) (race-flag rf16)) - 0 - (none) + (let ((s3-0 (-> this flags))) + (mem-set32! (the-as pointer this) 328 0) + (set! (-> this flags) s3-0) ) + (set! (-> this info) arg1) + (set! (-> this manager) (process->handle arg0)) + (set! (-> this scene-player) (the-as handle #f)) + (set! (-> this hud-timer) (the-as handle #f)) + (set! (-> this hud-lap-counter) (the-as handle #f)) + (set! (-> this hud-turbo-counter) (the-as handle #f)) + (set! (-> this hud-position) (the-as handle #f)) + (set! (-> this arrow) (the-as handle #f)) + (set! (-> this race-signal) (the-as handle #f)) + (set! (-> this state) (race-state-enum rs0)) + (set! (-> this racer-count) (-> arg1 racer-count)) + (set! (-> this finished-count) 0) + (set! (-> this i-player) -1) + (set! (-> this player-win?) #f) + (set! (-> this new-score?) #f) + (dotimes (v1-5 (-> arg1 racer-count)) + (let ((a0-7 (-> arg1 racer-array v1-5 rider))) + (if (or (zero? a0-7) (= a0-7 1)) + (set! (-> this i-player) v1-5) + ) + ) + ) + (let ((v1-8 (new 'stack-no-clear 'race-manager-stack-var0))) + (set! (-> v1-8 vec1 z) 61440.0) + (set! (-> v1-8 word) 1) + (set! (-> v1-8 vec0 z) (/ (-> v1-8 vec1 z) -2)) + (set! (-> v1-8 vec0 w) -20480.0) + (set! (-> v1-8 vec1 x) (/ (-> v1-8 vec1 z) (the float (max 1 (+ (-> v1-8 word) -1))))) + (set! (-> v1-8 vec1 y) -40960.0) + (set! (-> v1-8 mat rvec quad) (-> arg1 start-sphere quad)) + (vector-copy! (-> v1-8 mat uvec) (-> arg1 start-dir)) + (set-vector! (-> v1-8 mat fvec) (-> v1-8 mat uvec z) 0.0 (- (-> v1-8 mat uvec x)) 1.0) + (dotimes (a0-22 (-> arg1 racer-count)) + (cond + (#t + (let ((a1-12 a0-22)) + (let ((a2-2 (logand a0-22 1))) + (set! (-> v1-8 vec0 x) (+ (-> v1-8 vec0 z) (* (-> v1-8 vec1 x) (the float a2-2)))) + ) + (set! (-> v1-8 vec0 y) (+ (-> v1-8 vec0 w) (* (-> v1-8 vec1 y) (the float a1-12)))) + ) + ) + (else + (let ((a1-15 (/ a0-22 (-> v1-8 word)))) + (let ((a2-5 (- a0-22 (* a1-15 (-> v1-8 word))))) + (set! (-> v1-8 vec0 x) (+ (-> v1-8 vec0 z) (* (-> v1-8 vec1 x) (the float a2-5)))) + ) + (set! (-> v1-8 vec0 y) (+ (-> v1-8 vec0 w) (* (-> v1-8 vec1 y) (the float a1-15)))) + ) + ) + ) + (let ((a1-20 (-> this racer-array a0-22))) + (-> arg1 racer-array a0-22) + (vector-copy! (-> v1-8 mat trans) (-> v1-8 mat rvec)) + (vector+*! (-> v1-8 mat trans) (-> v1-8 mat trans) (-> v1-8 mat uvec) (-> v1-8 vec0 y)) + (vector+*! (-> v1-8 mat trans) (-> v1-8 mat trans) (-> v1-8 mat fvec) (-> v1-8 vec0 x)) + (vector-copy! (-> a1-20 start-position) (-> v1-8 mat trans)) + (set! (-> a1-20 rank) a0-22) + (set! (-> a1-20 speed-factor) 1.0) + (set! (-> a1-20 racer) (the-as handle #f)) + ) + (set! (-> this rankings a0-22) a0-22) + ) + ) + (dotimes (v1-11 (-> this info turbo-pad-count)) + (set! (-> this info turbo-pad-array v1-11 handle) (the-as handle #f)) + ) + (let ((v1-17 (-> *game-info* sub-task-list (-> arg1 task-node)))) + (set! (-> this suck-factor) 0.0) + (if (not (logtest? (-> arg1 flags) (racer-info-flag rif3))) + (set! (-> this suck-factor) (fmax 0.0 (fmin 1.0 (* 0.3333 (+ -2.0 (the float (-> v1-17 death-count))))))) + ) + (format + #t + "race-state::initialize: death-count ~d, suck-factor ~f~%" + (-> v1-17 death-count) + (-> this suck-factor) + ) + ) + (logior! (-> this flags) (race-flag rf16)) + 0 + (none) ) ;; definition for symbol *race-state*, type race-state 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 62de3c32bb..553d4850ec 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 @@ -376,52 +376,35 @@ ;; definition for method 12 of type race-path (defmethod race-path-method-12 ((this race-path) (arg0 vector) (arg1 float) (arg2 float)) - (local-vars (v1-15 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 arg2) - (s4-0 (new 'stack-no-clear 'matrix)) - (f30-0 (the float (-> this sample-count))) - ) - (if (< f30-0 gp-0) - (set! gp-0 (- gp-0 f30-0)) - ) - (if (< arg1 0.0) - (set! arg1 (+ arg1 f30-0)) - ) - (race-path-method-10 this (-> s4-0 rvec) arg1 arg2) - (race-path-method-10 this (-> s4-0 uvec) gp-0 arg2) - (vector-! (-> s4-0 fvec) (-> s4-0 uvec) (-> s4-0 rvec)) - (vector-! (-> s4-0 trans) arg0 (-> s4-0 rvec)) - (let ((f0-7 0.0) - (f1-1 1.0) - (f2-1 (vector-dot (-> s4-0 fvec) (-> s4-0 trans))) - ) - (.lvf vf1 (&-> (-> s4-0 fvec) 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-8 (fmax f0-7 (fmin f1-1 (/ f2-1 v1-15))))) - (if (< gp-0 arg1) - (set! gp-0 (+ gp-0 f30-0)) - ) - (let ((f0-10 (+ (* arg1 (- 1.0 f0-8)) (* gp-0 f0-8)))) - (if (< f30-0 f0-10) - (set! f0-10 (- f0-10 f30-0)) - ) - (if (< f0-10 0.0) - (+! f0-10 f30-0) - ) - f0-10 + (let ((gp-0 arg2) + (s4-0 (new 'stack-no-clear 'matrix)) + (f30-0 (the float (-> this sample-count))) + ) + (if (< f30-0 gp-0) + (set! gp-0 (- gp-0 f30-0)) + ) + (if (< arg1 0.0) + (set! arg1 (+ arg1 f30-0)) + ) + (race-path-method-10 this (-> s4-0 rvec) arg1 arg2) + (race-path-method-10 this (-> s4-0 uvec) gp-0 arg2) + (vector-! (-> s4-0 fvec) (-> s4-0 uvec) (-> s4-0 rvec)) + (vector-! (-> s4-0 trans) arg0 (-> s4-0 rvec)) + (let ((f0-8 + (fmax 0.0 (fmin 1.0 (/ (vector-dot (-> s4-0 fvec) (-> s4-0 trans)) (vector-length-squared (-> s4-0 fvec))))) ) ) + (if (< gp-0 arg1) + (set! gp-0 (+ gp-0 f30-0)) + ) + (let ((f0-10 (+ (* arg1 (- 1.0 f0-8)) (* gp-0 f0-8)))) + (if (< f30-0 f0-10) + (set! f0-10 (- f0-10 f30-0)) + ) + (if (< f0-10 0.0) + (+! f0-10 f30-0) + ) + f0-10 ) ) ) 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 ea79baafa2..c8e9a2fb30 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 @@ -79,118 +79,95 @@ ;; definition for method 10 of type terraformer-foot-mark-pt-array ;; INFO: Used lq/sq (defmethod terraformer-foot-mark-pt-array-method-10 ((this terraformer-foot-mark-pt-array)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (if (>= (-> this current-point) 20) - (return 0) + (if (>= (-> this current-point) 20) + (return 0) + ) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (-> this points (-> this current-point))) ) - (let ((gp-0 (new 'stack-no-clear 'collide-query)) - (s5-0 (-> this points (-> this current-point))) - ) - (set! (-> s5-0 found?) #f) - (let* ((f0-0 3449.2632) - (f30-0 (* f0-0 (the float (-> this current-point)))) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (let ((f0-3 (+ f30-0 (rand-vu-float-range (* -0.43 f0-0) (* 0.43 f0-0))))) - (set! (-> s5-0 angle) f0-3) - (sincos! s3-0 f0-3) - ) - (set! (-> s3-0 z) (* (-> s3-0 y) (-> this radius) (rand-vu-float-range 0.7 0.9))) - (set! (-> s3-0 y) 32768.0) - (set! (-> s3-0 x) (* (-> s3-0 x) (-> this radius) (rand-vu-float-range 0.7 0.9))) - (vector+! (-> gp-0 start-pos) (-> this origin) s3-0) + (set! (-> s5-0 found?) #f) + (let* ((f0-0 3449.2632) + (f30-0 (* f0-0 (the float (-> this current-point)))) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((f0-3 (+ f30-0 (rand-vu-float-range (* -0.43 f0-0) (* 0.43 f0-0))))) + (set! (-> s5-0 angle) f0-3) + (sincos! s3-0 f0-3) ) - (set-vector! (-> gp-0 move-dist) 0.0 -65536.0 0.0 1.0) - (let ((v1-13 gp-0)) - (set! (-> v1-13 radius) 409.6) - (set! (-> v1-13 collide-with) (collide-spec backgnd pusher)) - (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)) - ) - (+! (-> this current-point) 1) - (let ((f0-16 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) - (when (>= f0-16 0.0) - (let ((a1-5 (-> s5-0 collision-pt))) - (let ((v1-19 (-> gp-0 start-pos))) - (let ((a0-15 (-> gp-0 move-dist))) - (let ((a2-0 f0-16)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a0-15 quad)) - ) - (.lvf vf4 (&-> v1-19 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-5 quad) vf6) + (set! (-> s3-0 z) (* (-> s3-0 y) (-> this radius) (rand-vu-float-range 0.7 0.9))) + (set! (-> s3-0 y) 32768.0) + (set! (-> s3-0 x) (* (-> s3-0 x) (-> this radius) (rand-vu-float-range 0.7 0.9))) + (vector+! (-> gp-0 start-pos) (-> this origin) s3-0) + ) + (set-vector! (-> gp-0 move-dist) 0.0 -65536.0 0.0 1.0) + (let ((v1-13 gp-0)) + (set! (-> v1-13 radius) 409.6) + (set! (-> v1-13 collide-with) (collide-spec backgnd pusher)) + (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) ) - (+! (-> s5-0 collision-pt y) 204.8) - (set! (-> s5-0 found?) #t) - (vector-normalize-copy! (-> s5-0 normal) (-> gp-0 best-other-tri normal) 1.0) - (let ((s3-1 (new 'stack-no-clear 'vector)) - (s4-1 (new 'stack-no-clear 'inline-array 'vector 4)) - ) - (vector-cross! s3-1 (-> s5-0 normal) (vector-get-unique! (new 'stack-no-clear 'vector) (-> s5-0 normal))) - (vector-normalize! s3-1 10240.0) - (vector-copy! (-> s4-1 0) s3-1) - (vector-cross! (-> s4-1 1) s3-1 (-> s5-0 normal)) - (vector-negate! (-> s4-1 2) s3-1) - (vector-cross! (-> s4-1 3) (-> s5-0 normal) s3-1) - (vector-float*! s3-1 (-> s5-0 normal) 3072.0) - (dotimes (v1-28 4) - (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) s3-1) - (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) (-> s5-0 collision-pt)) + (set! (-> v1-13 action-mask) (collide-action solid)) + ) + (+! (-> this current-point) 1) + (let ((f0-16 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) + (when (>= f0-16 0.0) + (vector+*! (-> s5-0 collision-pt) (-> gp-0 start-pos) (-> gp-0 move-dist) f0-16) + (+! (-> s5-0 collision-pt y) 204.8) + (set! (-> s5-0 found?) #t) + (vector-normalize-copy! (-> s5-0 normal) (-> gp-0 best-other-tri normal) 1.0) + (let ((s3-1 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack-no-clear 'inline-array 'vector 4)) ) - (vector-float*! (-> gp-0 move-dist) s3-1 -2.0) - (let ((s3-2 (new 'stack-no-clear 'collide-query))) - (let ((a1-19 (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)) - ) - (set-vector! v1-38 f0-22 f0-22 f0-22 1.0) - (vector+! (-> a1-19 max) (-> s5-0 collision-pt) v1-38) - (vector-! (-> a1-19 min) (-> s5-0 collision-pt) v1-38) - ) - (set! (-> s3-2 collide-with) (collide-spec backgnd pusher)) - (set! (-> s3-2 ignore-process0) #f) - (set! (-> s3-2 ignore-process1) #f) - (set! (-> s3-2 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> s3-2 action-mask) (collide-action solid)) - (mem-copy! (the-as pointer (-> s3-2 bbox)) (the-as pointer a1-19) 32) + (vector-cross! s3-1 (-> s5-0 normal) (vector-get-unique! (new 'stack-no-clear 'vector) (-> s5-0 normal))) + (vector-normalize! s3-1 10240.0) + (vector-copy! (-> s4-1 0) s3-1) + (vector-cross! (-> s4-1 1) s3-1 (-> s5-0 normal)) + (vector-negate! (-> s4-1 2) s3-1) + (vector-cross! (-> s4-1 3) (-> s5-0 normal) s3-1) + (vector-float*! s3-1 (-> s5-0 normal) 3072.0) + (dotimes (v1-28 4) + (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) s3-1) + (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) (-> s5-0 collision-pt)) + ) + (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)) + ) + (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) ) - (fill-using-bounding-box *collide-cache* s3-2) + (set! (-> s3-2 collide-with) (collide-spec backgnd pusher)) + (set! (-> s3-2 ignore-process0) #f) + (set! (-> s3-2 ignore-process1) #f) + (set! (-> s3-2 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> s3-2 action-mask) (collide-action solid)) + (mem-copy! (the-as pointer (-> s3-2 bbox)) (the-as pointer a1-20) 32) ) - (dotimes (s3-3 4) - (vector-copy! (-> gp-0 start-pos) (-> s4-1 s3-3)) - (when (< (probe-using-line-sphere *collide-cache* gp-0) 0.0) - (set! (-> s5-0 found?) #f) - (return 0) - ) + (fill-using-bounding-box *collide-cache* s3-2) + ) + (dotimes (s3-3 4) + (vector-copy! (-> gp-0 start-pos) (-> s4-1 s3-3)) + (when (< (probe-using-line-sphere *collide-cache* gp-0) 0.0) + (set! (-> s5-0 found?) #f) + (return 0) ) ) ) ) ) - 0 ) + 0 ) ;; definition for method 11 of type terraformer-foot-mark-pt-array @@ -985,145 +962,122 @@ (vector-copy! (-> self root trans) (-> self src-pos)) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (cond - ((zero? (-> self which-trajectory)) - (+! (-> self x-rotate) 4369.067) - (+! (-> self y-rotate) 3458.8445) - ) - (else - (+! (-> self x-rotate) 2730.6667) - (+! (-> self y-rotate) 2002.4889) - ) + (cond + ((zero? (-> self which-trajectory)) + (+! (-> self x-rotate) 4369.067) + (+! (-> self y-rotate) 3458.8445) + ) + (else + (+! (-> self x-rotate) 2730.6667) + (+! (-> self y-rotate) 2002.4889) ) - (if (< 65536.0 (-> self x-rotate)) - (+! (-> self x-rotate) -65536.0) - ) - (if (< 65536.0 (-> self y-rotate)) - (+! (-> self y-rotate) -65536.0) - ) - (let ((s5-0 (new 'stack-no-clear 'quaternion)) - (gp-0 (new 'stack-no-clear 'quaternion)) - ) - (quaternion-set! s5-0 (sin (/ (-> self x-rotate) 2)) 0.0 0.0 (cos (/ (-> self x-rotate) 2))) - (quaternion-set! gp-0 0.0 (sin (/ (-> self y-rotate) 2)) 0.0 (cos (/ (-> self y-rotate) 2))) - (quaternion-normalize! (quaternion*! (-> self root quat) gp-0 s5-0)) + ) + (if (< 65536.0 (-> self x-rotate)) + (+! (-> self x-rotate) -65536.0) ) - (cond - ((time-elapsed? (-> self state-time) (the int (-> self traj time))) - (cond - ((zero? (-> self which-trajectory)) - (set! (-> self which-trajectory) 1) - (compute-trans-at-time - (-> self traj) - (fmin (-> self traj time) (the float (- (current-time) (-> self state-time)))) - (-> self root trans) - ) - (let ((gp-1 (new 'stack-no-clear 'matrix))) - (matrix-identity! gp-1) - (vector-copy! (-> gp-1 trans) (-> self root trans)) - (if (logtest? (-> *part-group-id-table* 432 flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group (-> *part-group-id-table* 432) - :duration (seconds 1) - :mat-joint gp-1 - ) - (part-tracker-spawn - part-tracker - :to *entity-pool* - :group (-> *part-group-id-table* 432) - :duration (seconds 1) - :mat-joint gp-1 - ) - ) - ) - (set-time! (-> self state-time)) - (let ((gp-3 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) (-> self traj initial-position)))) - (set! (-> gp-3 y) 0.0) - (vector-normalize! gp-3 12288.0) - (vector+! gp-3 gp-3 (-> self root trans)) - (let ((s5-3 (new 'stack-no-clear 'collide-query))) - (set-vector! (-> s5-3 move-dist) 0.0 -122880.0 0.0 1.0) - (vector-copy! (-> s5-3 start-pos) gp-3) - (+! (-> s5-3 start-pos y) 61440.0) - (let ((v1-69 s5-3)) - (set! (-> v1-69 radius) 4096.0) - (set! (-> v1-69 collide-with) (collide-spec backgnd)) - (set! (-> v1-69 ignore-process0) #f) - (set! (-> v1-69 ignore-process1) #f) - (set! (-> v1-69 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-69 action-mask) (collide-action solid)) - ) - (let ((f0-35 (fill-and-probe-using-line-sphere *collide-cache* s5-3))) - (when (>= f0-35 0.0) - (let ((a0-35 gp-3)) - (let ((v1-72 (-> s5-3 start-pos))) - (let ((a1-15 (-> s5-3 move-dist))) - (let ((a2-14 f0-35)) - (.mov vf7 a2-14) - ) - (.lvf vf5 (&-> a1-15 quad)) - ) - (.lvf vf4 (&-> v1-72 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-35 quad) vf6) - ) - ) - ) - ) - (setup-from-to-duration-and-height! (-> self traj) (-> self root trans) gp-3 180.0 61440.0) - ) - ) - (else - (go-virtual idle) - ) - ) - ) - (else + (if (< 65536.0 (-> self y-rotate)) + (+! (-> self y-rotate) -65536.0) + ) + (let ((s5-0 (new 'stack-no-clear 'quaternion)) + (gp-0 (new 'stack-no-clear 'quaternion)) + ) + (quaternion-set! s5-0 (sin (/ (-> self x-rotate) 2)) 0.0 0.0 (cos (/ (-> self x-rotate) 2))) + (quaternion-set! gp-0 0.0 (sin (/ (-> self y-rotate) 2)) 0.0 (cos (/ (-> self y-rotate) 2))) + (quaternion-normalize! (quaternion*! (-> self root quat) gp-0 s5-0)) + ) + (cond + ((time-elapsed? (-> self state-time) (the int (-> self traj time))) + (cond + ((zero? (-> self which-trajectory)) + (set! (-> self which-trajectory) 1) (compute-trans-at-time (-> self traj) (fmin (-> self traj time) (the float (- (current-time) (-> self state-time)))) (-> self root trans) ) + (let ((gp-1 (new 'stack-no-clear 'matrix))) + (matrix-identity! gp-1) + (vector-copy! (-> gp-1 trans) (-> self root trans)) + (if (logtest? (-> *part-group-id-table* 432 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group (-> *part-group-id-table* 432) + :duration (seconds 1) + :mat-joint gp-1 + ) + (part-tracker-spawn + part-tracker + :to *entity-pool* + :group (-> *part-group-id-table* 432) + :duration (seconds 1) + :mat-joint gp-1 + ) + ) + ) + (set-time! (-> self state-time)) + (let ((gp-3 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) (-> self traj initial-position)))) + (set! (-> gp-3 y) 0.0) + (vector-normalize! gp-3 12288.0) + (vector+! gp-3 gp-3 (-> self root trans)) + (let ((s5-3 (new 'stack-no-clear 'collide-query))) + (set-vector! (-> s5-3 move-dist) 0.0 -122880.0 0.0 1.0) + (vector-copy! (-> s5-3 start-pos) gp-3) + (+! (-> s5-3 start-pos y) 61440.0) + (let ((v1-69 s5-3)) + (set! (-> v1-69 radius) 4096.0) + (set! (-> v1-69 collide-with) (collide-spec backgnd)) + (set! (-> v1-69 ignore-process0) #f) + (set! (-> v1-69 ignore-process1) #f) + (set! (-> v1-69 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-69 action-mask) (collide-action solid)) + ) + (let ((f0-35 (fill-and-probe-using-line-sphere *collide-cache* s5-3))) + (if (>= f0-35 0.0) + (vector+*! gp-3 (-> s5-3 start-pos) (-> s5-3 move-dist) f0-35) + ) + ) + ) + (setup-from-to-duration-and-height! (-> self traj) (-> self root trans) gp-3 180.0 61440.0) + ) + ) + (else + (go-virtual idle) + ) + ) + ) + (else + (compute-trans-at-time + (-> self traj) + (fmin (-> self traj time) (the float (- (current-time) (-> self state-time)))) + (-> self root trans) ) ) - (cond - ((zero? (-> self which-trajectory)) - (when (and (not (-> self incoming-sound-played)) - (time-elapsed? (-> self state-time) (the int (+ -135.0 (-> self traj time)))) - ) - (sound-play "mine-incoming" :position (-> self root trans)) - (set! (-> self incoming-sound-played) #t) - ) - (if (nonzero? (-> self trail-part)) - (push-back (-> self trail-part) (-> self root trans)) - ) + ) + (cond + ((zero? (-> self which-trajectory)) + (when (and (not (-> self incoming-sound-played)) + (time-elapsed? (-> self state-time) (the int (+ -135.0 (-> self traj time)))) + ) + (sound-play "mine-incoming" :position (-> self root trans)) + (set! (-> self incoming-sound-played) #t) ) - (else - (when (and (not (-> self expand-sound-played)) - (time-elapsed? (-> self state-time) (the int (+ -90.0 (-> self traj time)))) - ) - (sound-play "mine-expand" :position (-> self root trans)) - (set! (-> self expand-sound-played) #t) - ) - (if (time-elapsed? (-> self state-time) (the int (+ -30.0 (-> self traj time)))) - (ja :num! (seek!)) - ) + (if (nonzero? (-> self trail-part)) + (push-back (-> self trail-part) (-> self root trans)) + ) + ) + (else + (when (and (not (-> self expand-sound-played)) + (time-elapsed? (-> self state-time) (the int (+ -90.0 (-> self traj time)))) + ) + (sound-play "mine-expand" :position (-> self root trans)) + (set! (-> self expand-sound-played) #t) ) + (if (time-elapsed? (-> self state-time) (the int (+ -30.0 (-> self traj time)))) + (ja :num! (seek!)) + ) ) ) ) @@ -1796,315 +1750,277 @@ ;; WARN: Return type mismatch int vs object. (defbehavior terraformer-leg-update-ik terraformer-leg () (local-vars (sv-720 int)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (cond + ((nonzero? (-> self joint-ik)) + (let ((a1-0 (-> self joint-ik elbow-matrix-no-ik))) + (vector+*! gp-0 (-> a1-0 trans) (-> a1-0 uvec) (-> *terraformer-ik-setup* hand-dist)) ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (cond - ((nonzero? (-> self joint-ik)) - (let ((a1-0 (-> self joint-ik elbow-matrix-no-ik)) - (a0-0 gp-0) - ) - (let ((v1-2 (-> a1-0 trans))) - (let ((a1-1 (-> a1-0 uvec))) - (let ((a2-1 (-> *terraformer-ik-setup* hand-dist))) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-1 quad)) - ) - (.lvf vf4 (&-> v1-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 (&-> a0-0 quad) vf6) - ) - ) - (else - (vector<-cspace! gp-0 (-> self node-list data 6)) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-normalize-copy! - s5-0 - (-> self node-list data 6 bone transform uvec) - (-> *terraformer-ik-setup* hand-dist) - ) - (vector+! gp-0 gp-0 s5-0) + ) + (else + (vector<-cspace! gp-0 (-> self node-list data 6)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-normalize-copy! + s5-0 + (-> self node-list data 6 bone transform uvec) + (-> *terraformer-ik-setup* hand-dist) ) + (vector+! gp-0 gp-0 s5-0) ) ) - (cond - ((zero? (-> self last-effect)) - (when (< (terraformer-leg-frames-till-up) 12.0) - (set! (-> self last-effect) 1) - (sound-play "joint-servo-up" :position (-> self foot-lock old-position)) - ) + ) + (cond + ((zero? (-> self last-effect)) + (when (< (terraformer-leg-frames-till-up) 12.0) + (set! (-> self last-effect) 1) + (sound-play "joint-servo-up" :position (-> self foot-lock old-position)) ) - (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) + ) + (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) ) ) ) ) - (cond - ((not (-> self foot-lock initialized)) - ) - ((terraformer-leg-should-be-up?) - (if (nonzero? (-> self foot-marks)) - (terraformer-foot-mark-pt-array-method-11 (-> self foot-marks) self) - ) - (when (!= (-> self foot-lock lock target) 0.0) - (set! (-> self foot-lock lock target) 0.0) - (let ((s5-3 (new 'stack-no-clear 'matrix))) - (matrix-from-two-vectors! s5-3 (new 'static 'vector :y 1.0) (-> self foot-lock old-normal)) - (vector-copy! (-> s5-3 trans) (-> self foot-lock old-position)) - (cond - ((-> self stepped-in-water) - (set! (-> s5-3 trans y) 37273.6) - (if (logtest? (-> *part-group-id-table* 438 flags) (sp-group-flag sp13)) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group (-> *part-group-id-table* 438) - :duration (seconds 1) - :mat-joint s5-3 - ) - (part-tracker-spawn - part-tracker - :to *entity-pool* - :group (-> *part-group-id-table* 438) - :duration (seconds 1) - :mat-joint s5-3 - ) + ) + (cond + ((not (-> self foot-lock initialized)) + ) + ((terraformer-leg-should-be-up?) + (if (nonzero? (-> self foot-marks)) + (terraformer-foot-mark-pt-array-method-11 (-> self foot-marks) self) + ) + (when (!= (-> self foot-lock lock target) 0.0) + (set! (-> self foot-lock lock target) 0.0) + (let ((s5-3 (new 'stack-no-clear 'matrix))) + (matrix-from-two-vectors! s5-3 (new 'static 'vector :y 1.0) (-> self foot-lock old-normal)) + (vector-copy! (-> s5-3 trans) (-> self foot-lock old-position)) + (cond + ((-> self stepped-in-water) + (set! (-> s5-3 trans y) 37273.6) + (if (logtest? (-> *part-group-id-table* 438 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group (-> *part-group-id-table* 438) + :duration (seconds 1) + :mat-joint s5-3 + ) + (part-tracker-spawn + part-tracker + :to *entity-pool* + :group (-> *part-group-id-table* 438) + :duration (seconds 1) + :mat-joint s5-3 ) - ) - ((begin (+! (-> s5-3 trans y) 4096.0) (logtest? (-> *part-group-id-table* 434 flags) (sp-group-flag sp13))) - (part-tracker-spawn - part-tracker-subsampler - :to *entity-pool* - :group (-> *part-group-id-table* 434) - :duration (seconds 1) - :mat-joint s5-3 ) + ) + ((begin (+! (-> s5-3 trans y) 4096.0) (logtest? (-> *part-group-id-table* 434 flags) (sp-group-flag sp13))) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group (-> *part-group-id-table* 434) + :duration (seconds 1) + :mat-joint s5-3 ) - (else - (part-tracker-spawn - part-tracker - :to *entity-pool* - :group (-> *part-group-id-table* 434) - :duration (seconds 1) - :mat-joint s5-3 - ) + ) + (else + (part-tracker-spawn + part-tracker + :to *entity-pool* + :group (-> *part-group-id-table* 434) + :duration (seconds 1) + :mat-joint s5-3 ) ) ) ) ) - ((= (-> self foot-lock lock target) 1.0) - (if (nonzero? (-> self foot-marks)) - (terraformer-foot-mark-pt-array-method-10 (-> self foot-marks)) - ) - ) - (else - (let ((s5-4 (new 'stack-no-clear 'collide-query))) - (let ((v1-92 (new 'stack-no-clear 'vector))) - (vector-copy! - v1-92 - (-> self node-list data (+ (-> *terraformer-ik-setup* elbow-index) 1) bone transform trans) - ) - (let ((a2-30 (-> s5-4 bbox)) - (a0-30 v1-92) - (a1-26 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-26 x) 32768.0) - (set! (-> a1-26 y) 327680.0) - (set! (-> a1-26 z) 32768.0) - (set! (-> a1-26 w) 1.0) - (vector-! (-> a2-30 min) a0-30 a1-26) - ) - (let ((a1-27 (-> s5-4 bbox max)) - (a0-31 (new 'stack-no-clear 'vector)) - ) - (set! (-> a0-31 x) 32768.0) - (set! (-> a0-31 y) 163840.0) - (set! (-> a0-31 z) 32768.0) - (set! (-> a0-31 w) 1.0) - (vector+! a1-27 v1-92 a0-31) - ) + ) + ((= (-> self foot-lock lock target) 1.0) + (if (nonzero? (-> self foot-marks)) + (terraformer-foot-mark-pt-array-method-10 (-> self foot-marks)) + ) + ) + (else + (let ((s5-4 (new 'stack-no-clear 'collide-query))) + (let ((v1-92 (new 'stack-no-clear 'vector))) + (vector-copy! + v1-92 + (-> self node-list data (+ (-> *terraformer-ik-setup* elbow-index) 1) bone transform trans) ) - (set! (-> s5-4 collide-with) (collide-spec backgnd)) - (set! (-> s5-4 ignore-process0) #f) - (set! (-> s5-4 ignore-process1) #f) - (set! (-> s5-4 ignore-pat) + (let ((a2-29 (-> s5-4 bbox)) + (a0-31 v1-92) + (a1-26 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-26 x) 32768.0) + (set! (-> a1-26 y) 327680.0) + (set! (-> a1-26 z) 32768.0) + (set! (-> a1-26 w) 1.0) + (vector-! (-> a2-29 min) a0-31 a1-26) + ) + (let ((a1-27 (-> s5-4 bbox max)) + (a0-32 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-32 x) 32768.0) + (set! (-> a0-32 y) 163840.0) + (set! (-> a0-32 z) 32768.0) + (set! (-> a0-32 w) 1.0) + (vector+! a1-27 v1-92 a0-32) + ) + ) + (set! (-> s5-4 collide-with) (collide-spec backgnd)) + (set! (-> s5-4 ignore-process0) #f) + (set! (-> s5-4 ignore-process1) #f) + (set! (-> s5-4 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (fill-using-bounding-box *collide-cache* s5-4) + (vector-copy! (-> s5-4 start-pos) gp-0) + (+! (-> s5-4 start-pos y) 163840.0) + (set-vector! (-> s5-4 move-dist) 0.0 -327680.0 0.0 1.0) + (let ((v1-99 s5-4)) + (set! (-> v1-99 radius) 40.96) + (set! (-> v1-99 collide-with) (collide-spec backgnd)) + (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) ) - (fill-using-bounding-box *collide-cache* s5-4) - (vector-copy! (-> s5-4 start-pos) gp-0) - (+! (-> s5-4 start-pos y) 163840.0) - (set-vector! (-> s5-4 move-dist) 0.0 -327680.0 0.0 1.0) - (let ((v1-99 s5-4)) - (set! (-> v1-99 radius) 40.96) - (set! (-> v1-99 collide-with) (collide-spec backgnd)) - (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-27 (probe-using-line-sphere *collide-cache* s5-4))) - (when (>= f0-27 0.0) - (set! (-> self foot-lock lock target) 1.0) - (vector+float*! (-> self foot-lock old-position) (-> s5-4 start-pos) (-> s5-4 move-dist) f0-27) - (vector-copy! (-> self foot-lock old-normal) (-> s5-4 best-other-tri normal)) - (foot-impact) - (if (nonzero? (-> self foot-marks)) - (init! (-> self foot-marks) (-> self foot-lock old-position) 32768.0) - ) - ) + (set! (-> v1-99 action-mask) (collide-action solid)) + ) + (let ((f0-27 (probe-using-line-sphere *collide-cache* s5-4))) + (when (>= f0-27 0.0) + (set! (-> self foot-lock lock target) 1.0) + (vector+float*! (-> self foot-lock old-position) (-> s5-4 start-pos) (-> s5-4 move-dist) f0-27) + (vector-copy! (-> self foot-lock old-normal) (-> s5-4 best-other-tri normal)) + (foot-impact) + (if (nonzero? (-> self foot-marks)) + (init! (-> self foot-marks) (-> self foot-lock old-position) 32768.0) + ) ) ) ) ) - ((method-of-type cam-float-seeker update!) (-> self foot-lock lock) 0.0) - (if (-> self foot-lock initialized) - (vector-lerp! - gp-0 - gp-0 - (-> self foot-lock old-position) - (parameter-ease-sin-clamp (-> self foot-lock lock value)) - ) - (set! (-> self foot-lock initialized) #t) - ) - (if (nonzero? (-> self joint-ik)) - (set-ik-target! (-> self joint-ik) gp-0) - ) ) - 0 + ((method-of-type cam-float-seeker update!) (-> self foot-lock lock) 0.0) + (if (-> self foot-lock initialized) + (vector-lerp! + gp-0 + gp-0 + (-> self foot-lock old-position) + (parameter-ease-sin-clamp (-> self foot-lock lock value)) + ) + (set! (-> self foot-lock initialized) #t) + ) + (if (nonzero? (-> self joint-ik)) + (set-ik-target! (-> self joint-ik) gp-0) + ) ) + 0 ) ;; failed to figure out what this is: (defstate idle (terraformer-leg) :virtual #t :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (local-vars (v1-19 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (case message - (('touched) - (cond - ((or (not (terraformer-leg-deadly?)) (!= (-> self kind) 2)) - ) - ((type? proc process-drawable) - (let ((s5-0 proc) - (s4-0 (new 'stack-no-clear 'vector)) - (f30-0 1.0) - ) - (let ((v1-7 (-> self kind))) - (cond - ((zero? v1-7) - (vector<-cspace! s4-0 (-> self node-list data 3)) - ) - ((= v1-7 1) - (vector<-cspace! s4-0 (-> self node-list data 4)) - ) - ((= v1-7 2) - (vector<-cspace! s4-0 (-> self node-list data 6)) - ) - (else - (vector<-cspace! s4-0 (-> self node-list data 3)) - ) - ) + (case message + (('touched) + (cond + ((or (not (terraformer-leg-deadly?)) (!= (-> self kind) 2)) + ) + ((type? proc process-drawable) + (let ((s5-0 proc) + (s4-0 (new 'stack-no-clear 'vector)) + (f30-0 1.0) ) - (vector-! s4-0 (-> (the-as process-drawable s5-0) root trans) s4-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-19 vf1) - (let ((f0-1 v1-19) - (f1-0 1.0) - ) - (if (< f0-1 (* f1-0 f1-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) - (if (type? s5-0 vehicle) - (set! f30-0 (-> (the-as vehicle proc) info info mass)) - ) - (let ((a1-10 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-10 from) (process->ppointer self)) - (set! (-> a1-10 num-params) 2) - (set! (-> a1-10 message) 'attack) - (set! (-> a1-10 param 0) (the-as uint #f)) - (set! (-> a1-10 param 1) - (the-as uint (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) - (damage 8.0) - (vehicle-damage-factor 0.8325) - (vehicle-impulse-factor (* 0.625 f30-0)) - (shield-damage 5.0) - (knock (knocked-type dark-shot)) - (attacker-velocity s4-0) - (shove-back (meters 20)) - (shove-up (meters 4)) - ) - ) - ) - ) - (when (and (send-event-function s5-0 a1-10) (or (= proc *target*) (type? s5-0 vehicle))) - (dotimes (gp-1 6) - (send-event (handle->process (-> self targets gp-1)) 'disable-collision) - ) - (set-time! (-> self collision-disable-timer)) - (let ((v1-52 (-> self root root-prim))) - (set! (-> v1-52 prim-core collide-as) (collide-spec)) - (set! (-> v1-52 prim-core collide-with) (collide-spec)) - ) - 0 + (let ((v1-7 (-> self kind))) + (cond + ((zero? v1-7) + (vector<-cspace! s4-0 (-> self node-list data 3)) + ) + ((= v1-7 1) + (vector<-cspace! s4-0 (-> self node-list data 4)) + ) + ((= v1-7 2) + (vector<-cspace! s4-0 (-> self node-list data 6)) + ) + (else + (vector<-cspace! s4-0 (-> self node-list data 3)) ) ) ) + (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) + ) + ) + (vector-normalize! s4-0 1.0) + (set! (-> s4-0 y) 0.3) + (vector-float*! s4-0 s4-0 4096.0) + (if (type? s5-0 vehicle) + (set! f30-0 (-> (the-as vehicle proc) info info mass)) + ) + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) (process->ppointer self)) + (set! (-> a1-10 num-params) 2) + (set! (-> a1-10 message) 'attack) + (set! (-> a1-10 param 0) (the-as uint #f)) + (set! (-> a1-10 param 1) + (the-as uint (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 8.0) + (vehicle-damage-factor 0.8325) + (vehicle-impulse-factor (* 0.625 f30-0)) + (shield-damage 5.0) + (knock (knocked-type dark-shot)) + (attacker-velocity s4-0) + (shove-back (meters 20)) + (shove-up (meters 4)) + ) + ) + ) + ) + (when (and (send-event-function s5-0 a1-10) (or (= proc *target*) (type? s5-0 vehicle))) + (dotimes (gp-1 6) + (send-event (handle->process (-> self targets gp-1)) 'disable-collision) + ) + (set-time! (-> self collision-disable-timer)) + (let ((v1-52 (-> self root root-prim))) + (set! (-> v1-52 prim-core collide-as) (collide-spec)) + (set! (-> v1-52 prim-core collide-with) (collide-spec)) + ) + 0 + ) + ) ) - ) - #t - ) - (('change-to) - (let ((a0-34 (the-as object (-> block param 0)))) - (if (the-as uint a0-34) - (change-to (the-as nav-mesh a0-34) self) - ) - ) - ) - (else - #t ) + ) + #t + ) + (('change-to) + (let ((a0-34 (the-as object (-> block param 0)))) + (if (the-as uint a0-34) + (change-to (the-as nav-mesh a0-34) self) + ) + ) + ) + (else + #t ) ) ) @@ -2260,77 +2176,52 @@ ;; definition for function find-mine-dest ;; INFO: Used lq/sq (defbehavior find-mine-dest terraformer ((arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (if (zero? (-> self older-target-time)) - (return #f) - ) - (cond - ((-> self launch-drones) - (vector-copy! arg0 (-> self target-rot fvec)) - (set! (-> arg0 y) 0.0) - (vector-normalize! arg0 819200.0) - (vector+! arg0 arg0 (-> self old-target-pos)) - ) - (else - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-! s5-0 (-> self old-target-pos) (-> self older-target-pos)) - (vector-float*! s5-0 s5-0 (/ 1.0 (the float (- (-> self old-target-time) (-> self older-target-time))))) - (vector+float*! arg0 (-> self old-target-pos) s5-0 300.0) - (vector-normalize! s5-0 163840.0) - (vector+! arg0 arg0 s5-0) - ) + (if (zero? (-> self older-target-time)) + (return #f) + ) + (cond + ((-> self launch-drones) + (vector-copy! arg0 (-> self target-rot fvec)) + (set! (-> arg0 y) 0.0) + (vector-normalize! arg0 819200.0) + (vector+! arg0 arg0 (-> self old-target-pos)) + ) + (else + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-! s5-0 (-> self old-target-pos) (-> self older-target-pos)) + (vector-float*! s5-0 s5-0 (/ 1.0 (the float (- (-> self old-target-time) (-> self older-target-time))))) + (vector+float*! arg0 (-> self old-target-pos) s5-0 300.0) + (vector-normalize! s5-0 163840.0) + (vector+! arg0 arg0 s5-0) ) ) - (let ((f30-1 (* 65536.0 (rand-vu)))) - (+! (-> arg0 x) (* 32768.0 (sin f30-1))) - (+! (-> arg0 z) (* 32768.0 (cos f30-1))) - ) - (let ((s5-1 (new 'stack-no-clear 'collide-query))) - (set-vector! (-> s5-1 move-dist) 0.0 -245760.0 0.0 1.0) - (vector-copy! (-> s5-1 start-pos) arg0) - (+! (-> s5-1 start-pos y) 122880.0) - (let ((v1-19 s5-1)) - (set! (-> v1-19 radius) 4096.0) - (set! (-> v1-19 collide-with) (collide-spec backgnd)) - (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 ((f0-18 (fill-and-probe-using-line-sphere *collide-cache* s5-1))) - (cond - ((>= f0-18 0.0) - (let ((v1-22 (-> s5-1 start-pos))) - (let ((a0-22 (-> s5-1 move-dist))) - (let ((a1-11 f0-18)) - (.mov vf7 a1-11) - ) - (.lvf vf5 (&-> a0-22 quad)) - ) - (.lvf vf4 (&-> v1-22 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 (&-> arg0 quad) vf6) - ) - (else - (return #f) - ) - ) - ) - ) - #t ) + (let ((f30-1 (* 65536.0 (rand-vu)))) + (+! (-> arg0 x) (* 32768.0 (sin f30-1))) + (+! (-> arg0 z) (* 32768.0 (cos f30-1))) + ) + (let ((s5-1 (new 'stack-no-clear 'collide-query))) + (set-vector! (-> s5-1 move-dist) 0.0 -245760.0 0.0 1.0) + (vector-copy! (-> s5-1 start-pos) arg0) + (+! (-> s5-1 start-pos y) 122880.0) + (let ((v1-19 s5-1)) + (set! (-> v1-19 radius) 4096.0) + (set! (-> v1-19 collide-with) (collide-spec backgnd)) + (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 ((f0-18 (fill-and-probe-using-line-sphere *collide-cache* s5-1))) + (if (>= f0-18 0.0) + (vector+*! arg0 (-> s5-1 start-pos) (-> s5-1 move-dist) f0-18) + (return #f) + ) + ) + ) + #t ) ;; definition for function launch-mine diff --git a/test/decompiler/reference/jak3/levels/desert/chase/marauder_REF.gc b/test/decompiler/reference/jak3/levels/desert/chase/marauder_REF.gc index e97cbe2b27..729dea427c 100644 --- a/test/decompiler/reference/jak3/levels/desert/chase/marauder_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/chase/marauder_REF.gc @@ -1145,78 +1145,57 @@ 0 ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((t9-0 (-> (method-of-type nav-enemy hostile) trans))) - (if t9-0 - (t9-0) - ) - ) - (if (-> self save) - (go-virtual save) + (let ((t9-0 (-> (method-of-type nav-enemy hostile) trans))) + (if t9-0 + (t9-0) ) - (when (and (time-elapsed? (-> self state-time) (-> self reaction-time)) (not (-> self jump-attack))) - (let ((gp-0 (as-type (handle->process (-> self focus handle)) process-focusable))) - (when gp-0 - (los-control-method-9 - (-> self los) - (the-as process-focusable gp-0) - (get-trans (the-as process-focusable gp-0) 3) - 819.2 - 4096.0 - ) - (let* ((v1-21 (get-trans (the-as process-focusable gp-0) 0)) - (f30-0 (vector-length (vector-! (new 'stack-no-clear 'vector) v1-21 (-> self root trans)))) - ) - (when (pointing-toward-focus? self 8192.0 #t) - (should-check-los? (-> self los) 0) - (cond - ((< f30-0 32768.0) - (cond - ((rand-vu-percent? 0.5) - (let ((gp-1 (new 'stack-no-clear 'vector))) - (vector-copy! gp-1 (-> self root trans)) - (let ((a0-16 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) - (a1-10 gp-1) - ) - (let ((v1-33 gp-1)) - (let ((a2-3 16384.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-16 quad)) - (.lvf vf4 (&-> v1-33 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-10 quad) vf6) - ) - (set! (-> self jump-attack) #t) - (sound-play "marauder-attack") - (set! (-> self enemy-flags) - (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) - ) - (send-event self 'jump 0 gp-1) + ) + (if (-> self save) + (go-virtual save) + ) + (when (and (time-elapsed? (-> self state-time) (-> self reaction-time)) (not (-> self jump-attack))) + (let ((gp-0 (as-type (handle->process (-> self focus handle)) process-focusable))) + (when gp-0 + (los-control-method-9 + (-> self los) + (the-as process-focusable gp-0) + (get-trans (the-as process-focusable gp-0) 3) + 819.2 + 4096.0 + ) + (let* ((v1-21 (get-trans (the-as process-focusable gp-0) 0)) + (f30-0 (vector-length (vector-! (new 'stack-no-clear 'vector) v1-21 (-> self root trans)))) + ) + (when (pointing-toward-focus? self 8192.0 #t) + (should-check-los? (-> self los) 0) + (cond + ((< f30-0 32768.0) + (cond + ((rand-vu-percent? 0.5) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (vector-copy! gp-1 (-> self root trans)) + (let ((a0-16 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) + (vector+*! gp-1 gp-1 a0-16 16384.0) ) + (set! (-> self jump-attack) #t) + (sound-play "marauder-attack") + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) + (send-event self 'jump 0 gp-1) ) - (else - (sound-play "marauder-attack") - (go-virtual attack-run) - ) + ) + (else + (sound-play "marauder-attack") + (go-virtual attack-run) ) ) - ((and (< f30-0 122880.0) - (and (< 61440.0 f30-0) (-> self gun?) (logtest? (-> self draw status) (draw-control-status on-screen))) - ) - (go-virtual gun-shoot) - ) - ) + ) + ((and (< f30-0 122880.0) + (and (< 61440.0 f30-0) (-> self gun?) (logtest? (-> self draw status) (draw-control-status on-screen))) + ) + (go-virtual gun-shoot) + ) ) ) ) @@ -1266,72 +1245,46 @@ ;; definition for method 197 of type marauder ;; WARN: Return type mismatch int vs none. (defmethod fire-shot ((this marauder)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (as-type (handle->process (-> this focus handle)) process-focusable)) - (s5-1 (new 'stack-no-clear 'vector)) - ) - (when s4-0 - (vector-! s5-1 (-> this root trans) (get-trans (the-as process-focusable s4-0) 0)) - (set! (-> s5-1 y) 0.0) - (vector-normalize! s5-1 1.0) - (vector-rotate90-around-y! s5-1 s5-1) - (if (< 0.0 (vector-dot s5-1 (get-transv (the-as process-focusable s4-0)))) - (vector-negate-in-place! s5-1) - ) - (let ((s3-4 (-> this target-pos))) - (let ((s4-1 (get-trans (the-as process-focusable s4-0) 3))) - (let ((v1-13 (the-as float (if (rand-vu-percent? 0.66) - 8192.0 - 0.0 - ) - ) - ) - ) - (.mov vf7 v1-13) - ) - (.lvf vf5 (&-> s5-1 quad)) - (.lvf vf4 (&-> s4-1 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 (&-> s3-4 quad) vf6) + (let ((s4-0 (as-type (handle->process (-> this focus handle)) process-focusable)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (when s4-0 + (vector-! s5-1 (-> this root trans) (get-trans (the-as process-focusable s4-0) 0)) + (set! (-> s5-1 y) 0.0) + (vector-normalize! s5-1 1.0) + (vector-rotate90-around-y! s5-1 s5-1) + (if (< 0.0 (vector-dot s5-1 (get-transv (the-as process-focusable s4-0)))) + (vector-negate-in-place! s5-1) ) + (vector+*! + (-> this target-pos) + (get-trans (the-as process-focusable s4-0) 3) + s5-1 + (the-as float (if (rand-vu-percent? 0.66) + 8192.0 + 0.0 + ) + ) ) ) - (let* ((s5-2 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 13))) - (s4-2 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> this target-pos) s5-2) 1.0)) - ) - (new 'stack-no-clear 'vector) - (new 'stack-no-clear 'vector) - (vector-normalize! s4-2 1.0) - (sound-play "marauder-fire") - (let ((t9-13 spawn-guard-projectile) - (a1-11 s5-2) - (a2-1 (new 'stack-no-clear 'vector)) - ) - (let ((v1-20 122880.0)) - (.mov vf7 v1-20) - ) - (.lvf vf5 (&-> s4-2 quad)) - (.lvf vf4 (&-> s5-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 (&-> a2-1 quad) vf6) - (t9-13 this a1-11 a2-1 819200.0 (the-as vector #f)) - ) - ) - 0 - (none) ) + (let* ((s5-2 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 13))) + (s4-2 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> this target-pos) s5-2) 1.0)) + ) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (vector-normalize! s4-2 1.0) + (sound-play "marauder-fire") + (spawn-guard-projectile + this + s5-2 + (vector+*! (new 'stack-no-clear 'vector) s5-2 s4-2 122880.0) + 819200.0 + (the-as vector #f) + ) + ) + 0 + (none) ) ;; failed to figure out what this is: @@ -1654,138 +1607,68 @@ (defstate ambush (marauder) :virtual #t :code (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'sphere))) - (set! (-> gp-0 quad) (-> self root trans quad)) - (set! (-> gp-0 r) 81920.0) - (when (not (and (-> self skip-jump) (not (sphere-in-view-frustum? gp-0)))) - ) - (suspend) - (when (and (-> self skip-jump) (not (sphere-in-view-frustum? gp-0))) - (let ((gp-1 (new 'stack-no-clear 'vector))) - (vector-copy! gp-1 (-> self root trans)) - (let ((a0-6 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) - (a1-1 gp-1) - ) - (let ((v1-13 gp-1)) - (let ((a2-1 61440.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-6 quad)) - (.lvf vf4 (&-> v1-13 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-1 quad) vf6) - ) - (let ((a1-2 gp-1)) - (let ((v1-14 gp-1)) - (let ((a0-7 *y-vector*)) - (let ((a2-3 -32768.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-7 quad)) - ) - (.lvf vf4 (&-> v1-14 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-2 quad) vf6) - ) - (vector-copy! (-> self root trans) gp-1) + (let ((gp-0 (new 'stack-no-clear 'sphere))) + (set! (-> gp-0 quad) (-> self root trans quad)) + (set! (-> gp-0 r) 81920.0) + (when (not (and (-> self skip-jump) (not (sphere-in-view-frustum? gp-0)))) + ) + (suspend) + (when (and (-> self skip-jump) (not (sphere-in-view-frustum? gp-0))) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (vector-copy! gp-1 (-> self root trans)) + (let ((a0-6 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) + (vector+*! gp-1 gp-1 a0-6 61440.0) ) - (go-virtual hostile) + (vector+*! gp-1 gp-1 *y-vector* -32768.0) + (vector-copy! (-> self root trans) gp-1) ) + (go-virtual hostile) ) - (let ((v1-21 (-> self root root-prim))) - (set! (-> v1-21 prim-core collide-as) (collide-spec)) - (set! (-> v1-21 prim-core collide-with) (collide-spec)) - ) - 0 - (set! (-> self ambush?) #t) - (let ((f30-0 (rnd-float-range self 1.2 1.25)) - (f28-0 0.0) - ) - (ja-no-eval :group! marauder-male-run0-ja :num! (seek! max f30-0) :frame-num 0.0) - (until (ja-done? 0) - (let ((gp-2 (-> self root trans))) - (let ((s5-0 (-> self root trans))) - (let ((v1-43 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) - (let ((a0-14 (* 24576.0 (seconds-per-frame)))) - (.mov vf7 a0-14) - ) - (.lvf vf5 (&-> v1-43 quad)) - ) - (.lvf vf4 (&-> s5-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 (&-> gp-2 quad) vf6) - ) - (+! f28-0 (seconds-per-frame)) - (if (< 1.0 f28-0) - (set! f28-0 1.0) - ) - (suspend) - (ja :num! (seek! max f30-0)) - ) - ) - (let ((v1-58 (-> self root root-prim))) - (set! (-> v1-58 prim-core collide-as) (-> self root backup-collide-as)) - (set! (-> v1-58 prim-core collide-with) (-> self root backup-collide-with)) - ) - (let ((gp-3 (new 'stack-no-clear 'vector))) - (vector-copy! gp-3 (-> self root trans)) - (let ((a0-22 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) - (a1-8 gp-3) - ) - (let ((v1-63 gp-3)) - (let ((a2-8 61440.0)) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a0-22 quad)) - (.lvf vf4 (&-> v1-63 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-8 quad) vf6) - ) - (let ((a1-9 gp-3)) - (let ((v1-64 gp-3)) - (let ((a0-23 *y-vector*)) - (let ((a2-10 -81920.0)) - (.mov vf7 a2-10) - ) - (.lvf vf5 (&-> a0-23 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 (&-> a1-9 quad) vf6) - ) - (set! (-> self enemy-flags) - (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) - ) - (send-event self 'jump 0 gp-3) - ) - (until #f - (suspend) - ) - #f ) + (let ((v1-21 (-> self root root-prim))) + (set! (-> v1-21 prim-core collide-as) (collide-spec)) + (set! (-> v1-21 prim-core collide-with) (collide-spec)) + ) + 0 + (set! (-> self ambush?) #t) + (let ((f30-0 (rnd-float-range self 1.2 1.25)) + (f28-0 0.0) + ) + (ja-no-eval :group! marauder-male-run0-ja :num! (seek! max f30-0) :frame-num 0.0) + (until (ja-done? 0) + (vector+*! + (-> self root trans) + (-> self root trans) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) + (* 24576.0 (seconds-per-frame)) + ) + (+! f28-0 (seconds-per-frame)) + (if (< 1.0 f28-0) + (set! f28-0 1.0) + ) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + (let ((v1-58 (-> self root root-prim))) + (set! (-> v1-58 prim-core collide-as) (-> self root backup-collide-as)) + (set! (-> v1-58 prim-core collide-with) (-> self root backup-collide-with)) + ) + (let ((gp-4 (new 'stack-no-clear 'vector))) + (vector-copy! gp-4 (-> self root trans)) + (let ((a0-21 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) + (vector+*! gp-4 gp-4 a0-21 61440.0) + ) + (vector+*! gp-4 gp-4 *y-vector* -81920.0) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) + (send-event self 'jump 0 gp-4) + ) + (until #f + (suspend) + ) + #f ) :post (behavior () (enemy-common-post self) diff --git a/test/decompiler/reference/jak3/levels/desert/des-burning-bush_REF.gc b/test/decompiler/reference/jak3/levels/desert/des-burning-bush_REF.gc index c01d420716..86399299e9 100644 --- a/test/decompiler/reference/jak3/levels/desert/des-burning-bush_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/des-burning-bush_REF.gc @@ -383,37 +383,15 @@ ) :code sleep-code :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let* ((a0-0 (-> *target* neck)) - (t9-0 (method-of-object a0-0 look-at!)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-5 (-> self root trans))) - (let ((a2-0 *up-vector*)) - (let ((a3-1 12288.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> v1-5 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-0 quad) vf6) - (t9-0 a0-0 a1-0 #f self) + (if *target* + (look-at! + (-> *target* neck) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 12288.0) + #f + self ) ) - (des-burning-bush-method-35 self) - ) + (des-burning-bush-method-35 self) ) ) @@ -463,52 +441,29 @@ (remove-setting! 'mode-name) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'des-burning-bush-stack-var0))) - (when (!= (-> self time) -1.0) - (quaternion-rotate-local-y! - (-> gp-0 quat) - (-> self root quat) - (lerp-scale (-> self rotmin) (-> self rotmax) (sin (* 7281.778 (-> self time))) -1.0 1.0) - ) - (vector-orient-by-quat! (-> gp-0 vec2) (new 'static 'vector :y 16384.0 :z 40960.0 :w 1.0) (-> gp-0 quat)) - (vector+! (-> gp-0 vec1) (-> self root trans) (-> gp-0 vec2)) - (vector-copy! (-> *camera* slave 0 trans) (-> gp-0 vec1)) - (let ((v1-10 (-> gp-0 vec2))) - (let ((a0-9 (-> self root trans))) - (let ((a1-4 *up-vector*)) - (let ((a2-4 12288.0)) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a1-4 quad)) - ) - (.lvf vf4 (&-> a0-9 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-10 quad) vf6) - ) - (vector-! (-> gp-0 vec3) (-> gp-0 vec2) (-> gp-0 vec1)) - (forward-down->inv-matrix (-> *camera* slave 0 tracking inv-mat) (-> gp-0 vec3) (-> *camera* local-down)) - ) - (matrix-copy! (-> gp-0 mat) (-> self node-list data 3 bone transform)) - (matrix->trans (-> gp-0 mat) (-> gp-0 vec2)) - (vector-! (-> gp-0 vec2) (camera-pos) (-> gp-0 vec2)) - (when (< (vector-dot (-> gp-0 mat fvec) (-> gp-0 vec2)) 0.0) - (matrix-rotate-y! (the-as matrix (-> gp-0 vec0)) 32768.0) - (matrix*! (-> gp-0 mat) (the-as matrix (-> gp-0 vec0)) (-> gp-0 mat)) + (let ((gp-0 (new 'stack-no-clear 'des-burning-bush-stack-var0))) + (when (!= (-> self time) -1.0) + (quaternion-rotate-local-y! + (-> gp-0 quat) + (-> self root quat) + (lerp-scale (-> self rotmin) (-> self rotmax) (sin (* 7281.778 (-> self time))) -1.0 1.0) ) + (vector-orient-by-quat! (-> gp-0 vec2) (new 'static 'vector :y 16384.0 :z 40960.0 :w 1.0) (-> gp-0 quat)) + (vector+! (-> gp-0 vec1) (-> self root trans) (-> gp-0 vec2)) + (vector-copy! (-> *camera* slave 0 trans) (-> gp-0 vec1)) + (vector+*! (-> gp-0 vec2) (-> self root trans) *up-vector* 12288.0) + (vector-! (-> gp-0 vec3) (-> gp-0 vec2) (-> gp-0 vec1)) + (forward-down->inv-matrix (-> *camera* slave 0 tracking inv-mat) (-> gp-0 vec3) (-> *camera* local-down)) + ) + (matrix-copy! (-> gp-0 mat) (-> self node-list data 3 bone transform)) + (matrix->trans (-> gp-0 mat) (-> gp-0 vec2)) + (vector-! (-> gp-0 vec2) (camera-pos) (-> gp-0 vec2)) + (when (< (vector-dot (-> gp-0 mat fvec) (-> gp-0 vec2)) 0.0) + (matrix-rotate-y! (the-as matrix (-> gp-0 vec0)) 32768.0) + (matrix*! (-> gp-0 mat) (the-as matrix (-> gp-0 vec0)) (-> gp-0 mat)) ) - (+! (-> self angle) (* 100.0 (rand-vu))) ) + (+! (-> self angle) (* 100.0 (rand-vu))) ) :code (behavior () (set-setting! 'mode-name 'cam-really-fixed 0.0 0) @@ -558,37 +513,15 @@ (go-virtual idle) ) :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let* ((a0-0 (-> *target* neck)) - (t9-0 (method-of-object a0-0 look-at!)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-5 (-> self root trans))) - (let ((a2-0 *up-vector*)) - (let ((a3-1 12288.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> v1-5 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-0 quad) vf6) - (t9-0 a0-0 a1-0 #f self) + (if *target* + (look-at! + (-> *target* neck) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 12288.0) + #f + self ) ) - (des-burning-bush-method-35 self) - ) + (des-burning-bush-method-35 self) ) ) @@ -809,50 +742,30 @@ (remove-setting! 'mode-name) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (and (time-elapsed? (-> self state-time) (seconds 1.5)) (not (-> self menu-exit?))) - (if (-> self menu-have-req?) - (des-burning-bush-method-37 self) - (des-burning-bush-method-38 self) - ) - ) - (when (!= (-> self time) -1.0) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (vector+! gp-0 (-> self root trans) (vector-orient-by-quat! - (new 'stack-no-clear 'vector) - (new 'static 'vector :y 24166.4 :z 32768.0 :w 1.0) - (-> self root quat) - ) - ) - (vector-copy! (-> *camera* slave 0 trans) gp-0) - (let ((t9-3 forward-down->inv-matrix) - (a0-7 (-> *camera* slave 0 tracking)) - (a1-1 (new 'stack-no-clear 'vector)) - (v1-23 (new 'stack-no-clear 'vector)) - ) - (let ((a2-2 (-> self root trans))) - (let ((a3-0 *up-vector*)) - (let ((t0-1 24166.4)) - (.mov vf7 t0-1) + (when (and (time-elapsed? (-> self state-time) (seconds 1.5)) (not (-> self menu-exit?))) + (if (-> self menu-have-req?) + (des-burning-bush-method-37 self) + (des-burning-bush-method-38 self) + ) + ) + (when (!= (-> self time) -1.0) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (vector+! gp-0 (-> self root trans) (vector-orient-by-quat! + (new 'stack-no-clear 'vector) + (new 'static 'vector :y 24166.4 :z 32768.0 :w 1.0) + (-> self root quat) + ) ) - (.lvf vf5 (&-> a3-0 quad)) - ) - (.lvf vf4 (&-> a2-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 (&-> v1-23 quad) vf6) - (t9-3 (-> a0-7 inv-mat) (vector-! a1-1 v1-23 gp-0) (-> *camera* local-down)) + (vector-copy! (-> *camera* slave 0 trans) gp-0) + (forward-down->inv-matrix + (-> *camera* slave 0 tracking inv-mat) + (vector-! + (new 'stack-no-clear 'vector) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 24166.4) + gp-0 ) + (-> *camera* local-down) ) ) ) @@ -919,37 +832,15 @@ (go-virtual idle) ) :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let* ((a0-0 (-> *target* neck)) - (t9-0 (method-of-object a0-0 look-at!)) - (a1-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-5 (-> self root trans))) - (let ((a2-0 *up-vector*)) - (let ((a3-1 20480.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> v1-5 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-0 quad) vf6) - (t9-0 a0-0 a1-0 #f self) + (if *target* + (look-at! + (-> *target* neck) + (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *up-vector* 20480.0) + #f + self ) ) - (des-burning-bush-method-35 self) - ) + (des-burning-bush-method-35 self) ) ) diff --git a/test/decompiler/reference/jak3/levels/desert/des-cactus_REF.gc b/test/decompiler/reference/jak3/levels/desert/des-cactus_REF.gc index 24cb95df49..190353456c 100644 --- a/test/decompiler/reference/jak3/levels/desert/des-cactus_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/des-cactus_REF.gc @@ -54,85 +54,52 @@ ;; definition for method 30 of type des-plant ;; WARN: Return type mismatch int vs none. (defmethod des-plant-method-30 ((this des-plant)) - (local-vars (v1-2 float) (v1-16 float) (v1-21 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((v1-0 (new 'stack-no-clear 'vector))) - (set! (-> v1-0 x) (seconds-per-frame)) - (set! (-> v1-0 y) 500.0) - (set! (-> v1-0 z) 10.0) - (vector+float*! - (-> this spring-vel) - (-> this spring-vel) - (-> this spring-pos) - (* -1.0 (-> v1-0 x) (-> v1-0 y)) - ) - (vector-float*! (-> this spring-vel) (-> this spring-vel) (fmax 0.0 (+ 1.0 (* -1.0 (-> v1-0 z) (-> v1-0 x))))) - (vector+float*! (-> this spring-pos) (-> this spring-pos) (-> this spring-vel) (-> v1-0 x)) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (set! (-> v1-0 x) (seconds-per-frame)) + (set! (-> v1-0 y) 500.0) + (set! (-> v1-0 z) 10.0) + (vector+float*! + (-> this spring-vel) + (-> this spring-vel) + (-> this spring-pos) + (* -1.0 (-> v1-0 x) (-> v1-0 y)) ) - (set! (-> this spring-pos y) 0.0) - (.lvf vf1 (&-> (-> this spring-pos) 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-2 vf1) - (let ((f0-10 v1-2)) - (when (< 1.0 f0-10) - (vector-float*! (-> this spring-pos) (-> this spring-pos) (/ 1.0 (sqrtf f0-10))) - (vector-reset! (-> this spring-vel)) - ) - ) - (let ((s5-0 (new 'stack-no-clear 'inline-array 'quaternion 10))) - (quaternion-conjugate! (-> s5-0 1) (-> this root quat)) - (quaternion->matrix (the-as matrix (-> s5-0 2)) (-> s5-0 1)) - (set! (-> s5-0 7 x) 2730.6667) - (set! (-> s5-0 7 z) (sin (/ (-> s5-0 7 x) 2))) - (set! (-> s5-0 7 y) (cos (/ (-> s5-0 7 x) 2))) - (vector-rotate90-around-y! (-> s5-0 6 vec) (-> this spring-pos)) - (vector-float*! (-> s5-0 6 vec) (-> s5-0 6 vec) (* -1.0 (-> s5-0 7 z))) - (vector-rotate*! (-> s5-0 6 vec) (-> s5-0 6 vec) (the-as matrix (-> s5-0 2))) - (set! (-> s5-0 0 x) (-> s5-0 6 x)) - (set! (-> s5-0 0 y) (-> s5-0 6 y)) - (set! (-> s5-0 0 z) (-> s5-0 6 z)) - (let ((f0-25 1.0)) - (.lvf vf1 (&-> (-> s5-0 6) 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-16 vf1) - (set! (-> s5-0 0 w) (sqrtf (- f0-25 v1-16))) - ) - (quaternion-copy! (-> this jmods 0 rotation) (-> s5-0 0)) - (vector-float*! (-> s5-0 6 vec) (-> s5-0 6 vec) 1.0) - (set! (-> s5-0 0 x) (-> s5-0 6 x)) - (set! (-> s5-0 0 y) (-> s5-0 6 y)) - (set! (-> s5-0 0 z) (-> s5-0 6 z)) - (let ((f0-32 1.0)) - (.lvf vf1 (&-> (-> s5-0 6) 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-21 vf1) - (set! (-> s5-0 0 w) (sqrtf (- f0-32 v1-21))) - ) - (quaternion-copy! (-> this jmods 1 rotation) (-> s5-0 0)) - (quaternion-copy! (-> this jmods 2 rotation) (-> s5-0 0)) - (quaternion-copy! (-> this jmods 3 rotation) (-> s5-0 0)) - ) - (ja-post) - 0 - (none) + (vector-float*! (-> this spring-vel) (-> this spring-vel) (fmax 0.0 (+ 1.0 (* -1.0 (-> v1-0 z) (-> v1-0 x))))) + (vector+float*! (-> this spring-pos) (-> this spring-pos) (-> this spring-vel) (-> v1-0 x)) ) + (set! (-> this spring-pos y) 0.0) + (let ((f0-10 (vector-length-squared (-> this spring-pos)))) + (when (< 1.0 f0-10) + (vector-float*! (-> this spring-pos) (-> this spring-pos) (/ 1.0 (sqrtf f0-10))) + (vector-reset! (-> this spring-vel)) + ) + ) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'quaternion 10))) + (quaternion-conjugate! (-> s5-0 1) (-> this root quat)) + (quaternion->matrix (the-as matrix (-> s5-0 2)) (-> s5-0 1)) + (set! (-> s5-0 7 x) 2730.6667) + (set! (-> s5-0 7 z) (sin (/ (-> s5-0 7 x) 2))) + (set! (-> s5-0 7 y) (cos (/ (-> s5-0 7 x) 2))) + (vector-rotate90-around-y! (-> s5-0 6 vec) (-> this spring-pos)) + (vector-float*! (-> s5-0 6 vec) (-> s5-0 6 vec) (* -1.0 (-> s5-0 7 z))) + (vector-rotate*! (-> s5-0 6 vec) (-> s5-0 6 vec) (the-as matrix (-> s5-0 2))) + (set! (-> s5-0 0 x) (-> s5-0 6 x)) + (set! (-> s5-0 0 y) (-> s5-0 6 y)) + (set! (-> s5-0 0 z) (-> s5-0 6 z)) + (set! (-> s5-0 0 w) (sqrtf (- 1.0 (vector-length-squared (-> s5-0 6 vec))))) + (quaternion-copy! (-> this jmods 0 rotation) (-> s5-0 0)) + (vector-float*! (-> s5-0 6 vec) (-> s5-0 6 vec) 1.0) + (set! (-> s5-0 0 x) (-> s5-0 6 x)) + (set! (-> s5-0 0 y) (-> s5-0 6 y)) + (set! (-> s5-0 0 z) (-> s5-0 6 z)) + (set! (-> s5-0 0 w) (sqrtf (- 1.0 (vector-length-squared (-> s5-0 6 vec))))) + (quaternion-copy! (-> this jmods 1 rotation) (-> s5-0 0)) + (quaternion-copy! (-> this jmods 2 rotation) (-> s5-0 0)) + (quaternion-copy! (-> this jmods 3 rotation) (-> s5-0 0)) + ) + (ja-post) + 0 + (none) ) ;; definition for method 31 of type des-plant 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 fd75f94b3a..7e060b7bba 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 @@ -62,72 +62,49 @@ (defstate idle (quantum-reflector) :virtual #t :enter (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (set-time! (-> self state-time)) - (set-vector! (-> self root scale) 2.0 2.0 2.0 1.0) - (logclear! (-> self mask) (process-mask actor-pause)) - (let ((v1-8 (-> self entity extra perm))) - (set! (-> self root trans x) (* 4096.0 (the float (-> v1-8 user-int16 0)))) - (set! (-> self root trans y) (* 4096.0 (the float (-> v1-8 user-int16 1)))) - (set! (-> self root trans z) (* 4096.0 (the float (-> v1-8 user-int16 2)))) - ) - (let ((gp-0 (new 'stack-no-clear 'collide-query))) - (set-vector! (-> gp-0 move-dist) 0.0 -204800.0 0.0 1.0) - (vector-copy! (-> gp-0 start-pos) (-> self root trans)) - (+! (-> gp-0 start-pos y) 102400.0) - (let ((v1-15 gp-0)) - (set! (-> v1-15 radius) 409.6) - (set! (-> v1-15 collide-with) (collide-spec backgnd)) - (set! (-> v1-15 ignore-process0) #f) - (set! (-> v1-15 ignore-process1) #f) - (set! (-> v1-15 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-15 action-mask) (collide-action solid)) - ) - (let ((f0-17 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) - (cond - ((>= f0-17 0.0) - (let ((a0-22 (-> self root trans))) - (let ((v1-19 (-> gp-0 start-pos))) - (let ((a1-1 (-> gp-0 move-dist))) - (let ((a2-0 f0-17)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a1-1 quad)) - ) - (.lvf vf4 (&-> v1-19 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-22 quad) vf6) - ) - (+! (-> self root trans y) 10240.0) - ) - (else - (format 0 "~A failed to find ground~%" (-> self name)) + (set-time! (-> self state-time)) + (set-vector! (-> self root scale) 2.0 2.0 2.0 1.0) + (logclear! (-> self mask) (process-mask actor-pause)) + (let ((v1-8 (-> self entity extra perm))) + (set! (-> self root trans x) (* 4096.0 (the float (-> v1-8 user-int16 0)))) + (set! (-> self root trans y) (* 4096.0 (the float (-> v1-8 user-int16 1)))) + (set! (-> self root trans z) (* 4096.0 (the float (-> v1-8 user-int16 2)))) + ) + (let ((gp-0 (new 'stack-no-clear 'collide-query))) + (set-vector! (-> gp-0 move-dist) 0.0 -204800.0 0.0 1.0) + (vector-copy! (-> gp-0 start-pos) (-> self root trans)) + (+! (-> gp-0 start-pos y) 102400.0) + (let ((v1-15 gp-0)) + (set! (-> v1-15 radius) 409.6) + (set! (-> v1-15 collide-with) (collide-spec backgnd)) + (set! (-> v1-15 ignore-process0) #f) + (set! (-> v1-15 ignore-process1) #f) + (set! (-> v1-15 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) + (set! (-> v1-15 action-mask) (collide-action solid)) + ) + (let ((f0-17 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) + (cond + ((>= f0-17 0.0) + (vector+*! (-> self root trans) (-> gp-0 start-pos) (-> gp-0 move-dist) f0-17) + (+! (-> self root trans y) 10240.0) + ) + (else + (format 0 "~A failed to find ground~%" (-> self name)) ) ) ) - (set! (-> self minimap) (add-icon! *minimap* self (the-as uint 12) (the-as int #f) (the-as vector #t) 0)) - (let ((gp-1 (new 'stack-no-clear 'task-arrow-params))) - (vector-copy! (-> gp-1 pos) (-> self root trans)) - (quaternion-identity! (-> gp-1 quat)) - (set! (-> gp-1 flags) (task-arrow-flags taf3 taf5)) - (set! (-> gp-1 map-icon) (the-as uint 12)) - (set! (-> self rod) (process->handle (task-arrow-spawn gp-1 self))) - ) - (ja-no-eval :group! quantum-reflector-idle-ja :num! zero) ) + (set! (-> self minimap) (add-icon! *minimap* self (the-as uint 12) (the-as int #f) (the-as vector #t) 0)) + (let ((gp-1 (new 'stack-no-clear 'task-arrow-params))) + (vector-copy! (-> gp-1 pos) (-> self root trans)) + (quaternion-identity! (-> gp-1 quat)) + (set! (-> gp-1 flags) (task-arrow-flags taf3 taf5)) + (set! (-> gp-1 map-icon) (the-as uint 12)) + (set! (-> self rod) (process->handle (task-arrow-spawn gp-1 self))) + ) + (ja-no-eval :group! quantum-reflector-idle-ja :num! zero) ) :exit (behavior () (send-event (handle->process (-> self rod)) 'die) 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 46f987787c..61bc70f466 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 @@ -1565,54 +1565,26 @@ ;; definition for function des-beast-active-post ;; WARN: Return type mismatch int vs none. (defbehavior des-beast-active-post des-beast () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 *target*) - (s4-0 (new 'stack-no-clear 'vector)) - (gp-0 (new 'stack-no-clear 'vector)) - ) - (when s5-0 - (vector-! s4-0 (-> self root trans) (get-trans s5-0 0)) - (vector-normalize! s4-0 1.0) - (vector-rotate90-around-y! gp-0 s4-0) - (let ((s3-3 (-> self target-gun-pos))) - (let ((s2-1 (get-trans s5-0 0))) - (let ((v1-8 (* 0.5 (vector-length (get-transv s5-0))))) - (.mov vf7 v1-8) - ) - (.lvf vf5 (&-> s4-0 quad)) - (.lvf vf4 (&-> s2-1 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 (&-> s3-3 quad) vf6) - ) - (let ((s3-4 (-> self target-gun-pos))) - (let ((s4-1 (-> self target-gun-pos))) - (let ((v1-13 (* 0.2 (vector-length (get-transv s5-0)) (rand-vu-float-range -1.0 1.0)))) - (.mov vf7 v1-13) - ) - (.lvf vf5 (&-> gp-0 quad)) - (.lvf vf4 (&-> s4-1 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 (&-> s3-4 quad) vf6) - ) + (let ((s5-0 *target*) + (s4-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (when s5-0 + (vector-! s4-0 (-> self root trans) (get-trans s5-0 0)) + (vector-normalize! s4-0 1.0) + (vector-rotate90-around-y! gp-0 s4-0) + (vector+*! (-> self target-gun-pos) (get-trans s5-0 0) s4-0 (* 0.5 (vector-length (get-transv s5-0)))) + (vector+*! + (-> self target-gun-pos) + (-> self target-gun-pos) + gp-0 + (* 0.2 (vector-length (get-transv s5-0)) (rand-vu-float-range -1.0 1.0)) ) ) - (enemy-common-post self) - 0 - (none) ) + (enemy-common-post self) + 0 + (none) ) ;; failed to figure out what this is: 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 0be717c884..6c175b04d5 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 @@ -1096,18 +1096,13 @@ ) (seek! (-> self pitch-angle) f0-6 (* 32768.0 (seconds-per-frame))) ) - (vector-rotate-around-axis! - gp-0 - (the-as quaternion *y-vector*) - (-> self pitch-angle) - (-> self rotation-matrix rvec) - ) + (vector-rotate-around-axis! gp-0 *y-vector* (-> self pitch-angle) (-> self rotation-matrix rvec)) (let* ((v1-25 (vector-flatten! (new 'stack-no-clear 'vector) s5-0 *y-vector*)) (f0-12 (lerp-scale -15473.777 15473.777 (vector-dot (-> self rotation-matrix rvec) v1-25) 131072.0 -131072.0)) ) (seek! (-> self bank-angle) f0-12 (* 10922.667 (seconds-per-frame))) ) - (vector-rotate-around-axis! gp-0 (the-as quaternion gp-0) (-> self bank-angle) (-> self rotation-matrix fvec)) + (vector-rotate-around-axis! gp-0 gp-0 (-> self bank-angle) (-> self rotation-matrix fvec)) (let ((s5-1 (new 'stack-no-clear 'inline-array 'vector 2))) (vector-copy! (-> s5-1 1) (-> self root transv)) (vector-normalize! (-> s5-1 1) 1.0) 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 252384a969..18dda82e1a 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 @@ -1689,7 +1689,7 @@ (else (vector-cross! s4-0 s5-0 s3-1) (let ((f0-6 (fmin (acos f0-4) (* 5461.3335 (seconds-per-frame))))) - (vector-rotate-around-axis! s5-0 (the-as quaternion s5-0) f0-6 s4-0) + (vector-rotate-around-axis! s5-0 s5-0 f0-6 s4-0) ) ) ) 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 99058075cc..3fc3dc512c 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 @@ -130,7 +130,7 @@ ) (vector-cross! s0-0 s2-1 (-> s1-0 dir)) (vector-normalize! s0-0 1.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s0-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s0-0) ) (vector-normalize! s2-1 1.0) (if (< s5-0 (+ (-> this knot-constraints length) -1)) @@ -238,8 +238,8 @@ (.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 (the-as quaternion sv-240) f24-0 s0-0) - (vector-rotate-around-axis! sv-256 (the-as quaternion sv-256) f24-0 s0-0) + (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 diff --git a/test/decompiler/reference/jak3/levels/desert/rescue/wland-passenger_REF.gc b/test/decompiler/reference/jak3/levels/desert/rescue/wland-passenger_REF.gc index ff72e3d185..78660890c7 100644 --- a/test/decompiler/reference/jak3/levels/desert/rescue/wland-passenger_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/rescue/wland-passenger_REF.gc @@ -491,70 +491,18 @@ ;; definition for function do-spline3 (defun do-spline3 ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((f1-1 (* arg5 arg5)) + (f0-2 (* arg5 f1-1)) ) - (init-vf0-vector) - (let* ((f1-1 (* arg5 arg5)) - (f0-2 (* arg5 f1-1)) - ) - (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) - (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) - (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) - ) - (vector-float*! arg0 arg1 f2-3) - (let ((t2-0 arg0)) - (let ((v1-10 arg0)) - (let ((t1-3 (vector+! (new 'stack-no-clear 'vector) arg1 arg2))) - (let ((a1-1 f3-7)) - (.mov vf7 a1-1) - ) - (.lvf vf5 (&-> t1-3 quad)) - ) - (.lvf vf4 (&-> v1-10 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 (&-> t2-0 quad) vf6) + (let ((f2-3 (- (+ 1.0 (* -3.0 arg5) (* 3.0 f1-1)) f0-2)) + (f3-7 (+ (* 3.0 f0-2) (* -6.0 f1-1) (* 3.0 arg5))) + (f1-3 (+ (* -3.0 f0-2) (* 3.0 f1-1))) ) - (let ((a2-1 arg0)) - (let ((v1-11 arg0)) - (let ((a1-3 (vector+! (new 'stack-no-clear 'vector) arg3 arg4))) - (let ((t0-1 f1-3)) - (.mov vf7 t0-1) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> v1-11 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-1 quad) vf6) - ) - ) - (let ((v0-0 arg0)) - (let ((v1-12 arg0)) - (let ((a0-1 arg3)) - (let ((a1-4 f0-2)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-12 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 (&-> v0-0 quad) vf6) - v0-0 - ) + (vector-float*! arg0 arg1 f2-3) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg1 arg2) f3-7) + (vector+*! arg0 arg0 (vector+! (new 'stack-no-clear 'vector) arg3 arg4) f1-3) ) + (vector+*! arg0 arg0 arg3 f0-2) ) ) 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 25c085b0f0..c8499b41e2 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 @@ -314,63 +314,46 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod update ((this was-squad-control)) - (local-vars (a0-14 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (set-sync-mask this) - (set! (-> this nav-mesh) (find-nearest-nav-mesh (target-pos 0) (the-as float #x7f800000))) - (if (not (-> this nav-mesh)) - (set! (-> this nav-mesh) (get-nav-mesh (the-as actor-id #xa7d6))) + (set-sync-mask this) + (set! (-> this nav-mesh) (find-nearest-nav-mesh (target-pos 0) (the-as float #x7f800000))) + (if (not (-> this nav-mesh)) + (set! (-> this nav-mesh) (get-nav-mesh (the-as actor-id #xa7d6))) + ) + (let ((s5-1 (new 'stack-no-clear 'inline-array 'matrix 2)) + (v1-8 (as-type (handle->process (-> this alert-state target-status handle)) process-focusable)) ) - (let ((s5-1 (new 'stack-no-clear 'inline-array 'matrix 2)) - (v1-8 (as-type (handle->process (-> this alert-state target-status handle)) process-focusable)) + (when v1-8 + (vector-copy! (-> s5-1 0 uvec) (-> (the-as process-focusable v1-8) root trans)) + (vector-copy! (-> s5-1 0 fvec) (-> (the-as process-focusable v1-8) root transv)) + (if (< 8192.0 (vector-length-squared (-> s5-1 0 fvec))) + (vector-copy! (-> s5-1 0 trans) (-> s5-1 0 fvec)) + (vector-copy! (-> s5-1 0 trans) (-> (the-as process-focusable v1-8) node-list data 0 bone transform fvec)) ) - (when v1-8 - (vector-copy! (-> s5-1 0 uvec) (-> (the-as process-focusable v1-8) root trans)) - (vector-copy! (-> s5-1 0 fvec) (-> (the-as process-focusable v1-8) root transv)) - (let ((f0-0 8192.0)) - (.lvf vf1 (&-> (-> s5-1 0 fvec) 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-14 vf1) - (if (< f0-0 a0-14) - (vector-copy! (-> s5-1 0 trans) (-> s5-1 0 fvec)) - (vector-copy! (-> s5-1 0 trans) (-> (the-as process-focusable v1-8) node-list data 0 bone transform fvec)) - ) - ) - (set! (-> s5-1 0 trans y) 0.0) - (vector-normalize! (-> s5-1 0 trans) 1.0) - (vector-rotate-around-y! (-> s5-1 1 rvec) (-> s5-1 0 trans) 14563.556) - (vector-rotate-around-y! (-> s5-1 1 uvec) (-> s5-1 0 trans) -14563.556) - (set! (-> s5-1 1 rvec w) (- (vector-dot (-> s5-1 1 rvec) (-> s5-1 0 uvec)))) - (set! (-> s5-1 1 uvec w) (- (vector-dot (-> s5-1 1 uvec) (-> s5-1 0 uvec)))) - (dotimes (s4-1 10) - (let ((s3-0 (as-type (handle->process (-> this units s4-1)) process-focusable))) - (when (and s3-0 - (not (focus-test? (the-as process-focusable s3-0) dead)) - (time-elapsed? (-> (the-as process-focusable s3-0) state-time) (seconds 2)) - ) - (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)) - ) + (set! (-> s5-1 0 trans y) 0.0) + (vector-normalize! (-> s5-1 0 trans) 1.0) + (vector-rotate-around-y! (-> s5-1 1 rvec) (-> s5-1 0 trans) 14563.556) + (vector-rotate-around-y! (-> s5-1 1 uvec) (-> s5-1 0 trans) -14563.556) + (set! (-> s5-1 1 rvec w) (- (vector-dot (-> s5-1 1 rvec) (-> s5-1 0 uvec)))) + (set! (-> s5-1 1 uvec w) (- (vector-dot (-> s5-1 1 uvec) (-> s5-1 0 uvec)))) + (dotimes (s4-1 10) + (let ((s3-0 (as-type (handle->process (-> this units s4-1)) process-focusable))) + (when (and s3-0 + (not (focus-test? (the-as process-focusable s3-0) dead)) + (time-elapsed? (-> (the-as process-focusable s3-0) state-time) (seconds 2)) + ) + (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)) ) ) ) @@ -379,62 +362,62 @@ ) ) ) - (let ((s5-2 0) - (s4-2 0) - ) - (dotimes (s3-1 10) - (let ((v1-62 (as-type (handle->process (-> this units s3-1)) process-focusable))) - (when v1-62 - (+! s5-2 1) - (if (not (focus-test? (the-as process-focusable v1-62) dead)) - (+! s4-2 1) - ) - ) + ) + (let ((s5-2 0) + (s4-2 0) + ) + (dotimes (s3-1 10) + (let ((v1-62 (as-type (handle->process (-> this units s3-1)) process-focusable))) + (when v1-62 + (+! s5-2 1) + (if (not (focus-test? (the-as process-focusable v1-62) dead)) + (+! s4-2 1) + ) ) ) - (set! (-> this process-count) s5-2) - (set! (-> this active-count) s4-2) ) - 0 - (let ((a1-20 (as-type (handle->process (-> this alert-state target-status handle)) process-focusable))) - (cond - (a1-20 - (let ((v1-71 (new 'stack-no-clear 'matrix))) - (vector-copy! (-> v1-71 rvec) (-> (the-as process-focusable a1-20) root trans)) - (cond - ((and (< (-> this active-count) (-> this target-count)) - (> (-> this reserve-count) 0) - (< (-> this process-count) 10) - (-> this nav-mesh) - (not (logtest? (-> this nav-mesh flags) (nav-mesh-flag water))) - (nav-mesh-method-11 (-> this nav-mesh) (-> v1-71 rvec)) - ) - (let ((v1-73 (new 'stack-no-clear 'array 'uint32 1))) - (set! (-> v1-73 0) (the-as uint (current-time))) - (if (and (< (the-as uint 300) (- (-> v1-73 0) (-> this spawnable-time))) - (< (-> this spawn-delay) (- (-> v1-73 0) (-> this spawn-time))) - ) - (spawn-unit-offscreen this) - ) - ) + (set! (-> this process-count) s5-2) + (set! (-> this active-count) s4-2) + ) + 0 + (let ((a1-20 (as-type (handle->process (-> this alert-state target-status handle)) process-focusable))) + (cond + (a1-20 + (let ((v1-71 (new 'stack-no-clear 'matrix))) + (vector-copy! (-> v1-71 rvec) (-> (the-as process-focusable a1-20) root trans)) + (cond + ((and (< (-> this active-count) (-> this target-count)) + (> (-> this reserve-count) 0) + (< (-> this process-count) 10) + (-> this nav-mesh) + (not (logtest? (-> this nav-mesh flags) (nav-mesh-flag water))) + (nav-mesh-method-11 (-> this nav-mesh) (-> v1-71 rvec)) + ) + (let ((v1-73 (new 'stack-no-clear 'array 'uint32 1))) + (set! (-> v1-73 0) (the-as uint (current-time))) + (if (and (< (the-as uint 300) (- (-> v1-73 0) (-> this spawnable-time))) + (< (-> this spawn-delay) (- (-> v1-73 0) (-> this spawn-time))) + ) + (spawn-unit-offscreen this) + ) ) - (else - (set! (-> this spawnable-time) (the-as uint (current-time))) - ) + ) + (else + (set! (-> this spawnable-time) (the-as uint (current-time))) ) ) ) - (else - (when *target* - (format #t "was-squad-control::update: setting target~%") - (set! (-> this alert-state target-status handle) (process->handle *target*)) - ) + ) + (else + (when *target* + (format #t "was-squad-control::update: setting target~%") + (set! (-> this alert-state target-status handle) (process->handle *target*)) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for symbol *was-squad-control*, type was-squad-control diff --git a/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-projectiles_REF.gc b/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-projectiles_REF.gc index e88f6030a4..0220dd95dc 100644 --- a/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-projectiles_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-projectiles_REF.gc @@ -321,55 +321,33 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this v-rhino-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (set! (-> *part-id-table* 980 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 980) a1-0 s5-1 #f) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 981) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f26-0 (/ f30-0 (meters 30))) - (f30-1 (-> *part-id-table* 982 init-specs 3 initial-valuef)) - (f28-0 (-> *part-id-table* 982 init-specs 5 initial-valuef)) - ) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 982 init-specs 3 initial-valuef) (* f26-0 f30-1)) - (set! (-> *part-id-table* 982 init-specs 5 initial-valuef) (* f26-0 f28-0)) - (launch-particles (-> *part-id-table* 982) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 982 init-specs 3 initial-valuef) f30-1) - (set! (-> *part-id-table* 982 init-specs 5 initial-valuef) f28-0) - ) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (set! (-> *part-id-table* 980 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 980) a1-0 s5-1 #f) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 981) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f26-0 (/ f30-0 (meters 30))) + (f30-1 (-> *part-id-table* 982 init-specs 3 initial-valuef)) + (f28-0 (-> *part-id-table* 982 init-specs 5 initial-valuef)) + ) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 982 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 982 init-specs 5 initial-valuef) (* f26-0 f28-0)) + (launch-particles (-> *part-id-table* 982) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 982 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 982 init-specs 5 initial-valuef) f28-0) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 26 of type v-rhino-shot diff --git a/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-turtle_REF.gc b/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-turtle_REF.gc index 9d8d219c85..a3b0447ba8 100644 --- a/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-turtle_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-turtle_REF.gc @@ -132,121 +132,88 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-79 ((this v-turtle)) - (local-vars (v1-33 float) (v1-47 float) (v1-52 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (set-vector! (-> this root scale) 1.0 1.0 1.07 1.0) - (let ((s5-0 (new 'stack-no-clear 'inline-array 'quaternion 3))) - (set-vector! (-> s5-0 2) -3640.889 3640.889 3640.889 -3640.889) - (dotimes (s4-0 (-> this info physics-model wheel-count)) - (let ((v1-6 (-> this wheel s4-0))) - (-> v1-6 info) - (let ((s3-0 (-> this jmod-axles s4-0))) - (quaternion-set! - (-> s5-0 0) - 0.0 - 0.0 - (* (-> v1-6 sin-susp-ang) (-> v1-6 x-scale)) - (+ 1.0 (-> v1-6 cos-susp-ang)) - ) - (quaternion-normalize! (-> s5-0 0)) - (quaternion-axis-angle! (-> s5-0 1) 0.0 1.0 0.0 (-> (&-> s5-0 0 data s4-0) 8)) - (quaternion*! (-> s3-0 rotation) (-> s5-0 0) (-> s5-0 1)) + (set-vector! (-> this root scale) 1.0 1.0 1.07 1.0) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'quaternion 3))) + (set-vector! (-> s5-0 2) -3640.889 3640.889 3640.889 -3640.889) + (dotimes (s4-0 (-> this info physics-model wheel-count)) + (let ((v1-6 (-> this wheel s4-0))) + (-> v1-6 info) + (let ((s3-0 (-> this jmod-axles s4-0))) + (quaternion-set! + (-> s5-0 0) + 0.0 + 0.0 + (* (-> v1-6 sin-susp-ang) (-> v1-6 x-scale)) + (+ 1.0 (-> v1-6 cos-susp-ang)) ) + (quaternion-normalize! (-> s5-0 0)) + (quaternion-axis-angle! (-> s5-0 1) 0.0 1.0 0.0 (-> (&-> s5-0 0 data s4-0) 8)) + (quaternion*! (-> s3-0 rotation) (-> s5-0 0) (-> s5-0 1)) ) - 0 ) + 0 ) - (let ((s5-1 (new 'stack-no-clear 'wvehicle-physics-work))) - (set! (-> s5-1 mat trans x) (seconds-per-frame)) - (vector-matrix*! (-> s5-1 mat uvec) (new 'static 'vector :y 20480.0 :z -8192.0 :w 1.0) (-> this rbody matrix)) - (rigid-body-control-method-23 (-> this rbody) (-> s5-1 mat uvec) (-> s5-1 mat rvec)) - (vector-! (-> s5-1 mat fvec) (-> s5-1 mat rvec) (-> this ant-tip-vel)) - (vector-copy! (-> this ant-tip-vel) (-> s5-1 mat rvec)) - (vector-float*! (-> s5-1 mat fvec) (-> s5-1 mat fvec) (/ 1.0 (-> s5-1 mat trans x))) - (vector+float*! - (-> this spring-vel) - (-> this spring-vel) - (-> s5-1 mat fvec) - (/ (-> s5-1 mat trans x) (meters -1)) - ) - (set! (-> s5-1 mat trans y) 500.0) - (set! (-> s5-1 mat trans z) 5.0) - (vector+float*! - (-> this spring-vel) - (-> this spring-vel) - (-> this spring-pos) - (* -1.0 (-> s5-1 mat trans x) (-> s5-1 mat trans y)) - ) - (vector-float*! - (-> this spring-vel) - (-> this spring-vel) - (fmax 0.0 (+ 1.0 (* -1.0 (-> s5-1 mat trans z) (-> s5-1 mat trans x)))) - ) - (vector+float*! (-> this spring-pos) (-> this spring-pos) (-> this spring-vel) (-> s5-1 mat trans x)) - ) - (set! (-> this spring-pos y) 0.0) - (.lvf vf1 (&-> (-> this spring-pos) 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-33 vf1) - (let ((f0-27 v1-33)) - (when (< 1.0 f0-27) - (vector-float*! (-> this spring-pos) (-> this spring-pos) (/ 1.0 (sqrtf f0-27))) - (vector-reset! (-> this spring-vel)) - ) - ) - (let ((s5-2 (new 'stack-no-clear 'wvehicle-jmod-work))) - (quaternion-conjugate! (-> s5-2 quat1) (-> this root quat)) - (quaternion->matrix (-> s5-2 mat0) (-> s5-2 quat1)) - (set! (-> s5-2 float0) 8192.0) - (set! (-> s5-2 float2) (sin (/ (-> s5-2 float0) 2))) - (set! (-> s5-2 float1) (cos (/ (-> s5-2 float0) 2))) - (vector-rotate90-around-y! (-> s5-2 vec0) (-> this spring-pos)) - (vector-float*! (-> s5-2 vec0) (-> s5-2 vec0) (* -1.0 (-> s5-2 float2))) - (vector-rotate*! (-> s5-2 vec0) (-> s5-2 vec0) (-> s5-2 mat0)) - (set! (-> s5-2 quat0 x) (-> s5-2 vec0 x)) - (set! (-> s5-2 quat0 y) (-> s5-2 vec0 y)) - (set! (-> s5-2 quat0 z) (-> s5-2 vec0 z)) - (let ((f0-42 1.0)) - (.lvf vf1 (&-> (-> s5-2 vec0) 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-47 vf1) - (set! (-> s5-2 quat0 w) (sqrtf (- f0-42 v1-47))) - ) - (quaternion-copy! (-> this jmod-antenna 0 rotation) (-> s5-2 quat0)) - (vector-float*! (-> s5-2 vec0) (-> s5-2 vec0) 1.0) - (set! (-> s5-2 quat0 x) (-> s5-2 vec0 x)) - (set! (-> s5-2 quat0 y) (-> s5-2 vec0 y)) - (set! (-> s5-2 quat0 z) (-> s5-2 vec0 z)) - (let ((f0-49 1.0)) - (.lvf vf1 (&-> (-> s5-2 vec0) 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-52 vf1) - (set! (-> s5-2 quat0 w) (sqrtf (- f0-49 v1-52))) - ) - (quaternion-copy! (-> this jmod-antenna 1 rotation) (-> s5-2 quat0)) - (quaternion-copy! (-> this jmod-antenna 2 rotation) (-> s5-2 quat0)) - (quaternion-copy! (-> this jmod-antenna 3 rotation) (-> s5-2 quat0)) - ) - 0 - (none) ) + (let ((s5-1 (new 'stack-no-clear 'wvehicle-physics-work))) + (set! (-> s5-1 mat trans x) (seconds-per-frame)) + (vector-matrix*! (-> s5-1 mat uvec) (new 'static 'vector :y 20480.0 :z -8192.0 :w 1.0) (-> this rbody matrix)) + (rigid-body-control-method-23 (-> this rbody) (-> s5-1 mat uvec) (-> s5-1 mat rvec)) + (vector-! (-> s5-1 mat fvec) (-> s5-1 mat rvec) (-> this ant-tip-vel)) + (vector-copy! (-> this ant-tip-vel) (-> s5-1 mat rvec)) + (vector-float*! (-> s5-1 mat fvec) (-> s5-1 mat fvec) (/ 1.0 (-> s5-1 mat trans x))) + (vector+float*! + (-> this spring-vel) + (-> this spring-vel) + (-> s5-1 mat fvec) + (/ (-> s5-1 mat trans x) (meters -1)) + ) + (set! (-> s5-1 mat trans y) 500.0) + (set! (-> s5-1 mat trans z) 5.0) + (vector+float*! + (-> this spring-vel) + (-> this spring-vel) + (-> this spring-pos) + (* -1.0 (-> s5-1 mat trans x) (-> s5-1 mat trans y)) + ) + (vector-float*! + (-> this spring-vel) + (-> this spring-vel) + (fmax 0.0 (+ 1.0 (* -1.0 (-> s5-1 mat trans z) (-> s5-1 mat trans x)))) + ) + (vector+float*! (-> this spring-pos) (-> this spring-pos) (-> this spring-vel) (-> s5-1 mat trans x)) + ) + (set! (-> this spring-pos y) 0.0) + (let ((f0-27 (vector-length-squared (-> this spring-pos)))) + (when (< 1.0 f0-27) + (vector-float*! (-> this spring-pos) (-> this spring-pos) (/ 1.0 (sqrtf f0-27))) + (vector-reset! (-> this spring-vel)) + ) + ) + (let ((s5-2 (new 'stack-no-clear 'wvehicle-jmod-work))) + (quaternion-conjugate! (-> s5-2 quat1) (-> this root quat)) + (quaternion->matrix (-> s5-2 mat0) (-> s5-2 quat1)) + (set! (-> s5-2 float0) 8192.0) + (set! (-> s5-2 float2) (sin (/ (-> s5-2 float0) 2))) + (set! (-> s5-2 float1) (cos (/ (-> s5-2 float0) 2))) + (vector-rotate90-around-y! (-> s5-2 vec0) (-> this spring-pos)) + (vector-float*! (-> s5-2 vec0) (-> s5-2 vec0) (* -1.0 (-> s5-2 float2))) + (vector-rotate*! (-> s5-2 vec0) (-> s5-2 vec0) (-> s5-2 mat0)) + (set! (-> s5-2 quat0 x) (-> s5-2 vec0 x)) + (set! (-> s5-2 quat0 y) (-> s5-2 vec0 y)) + (set! (-> s5-2 quat0 z) (-> s5-2 vec0 z)) + (set! (-> s5-2 quat0 w) (sqrtf (- 1.0 (vector-length-squared (-> s5-2 vec0))))) + (quaternion-copy! (-> this jmod-antenna 0 rotation) (-> s5-2 quat0)) + (vector-float*! (-> s5-2 vec0) (-> s5-2 vec0) 1.0) + (set! (-> s5-2 quat0 x) (-> s5-2 vec0 x)) + (set! (-> s5-2 quat0 y) (-> s5-2 vec0 y)) + (set! (-> s5-2 quat0 z) (-> s5-2 vec0 z)) + (set! (-> s5-2 quat0 w) (sqrtf (- 1.0 (vector-length-squared (-> s5-2 vec0))))) + (quaternion-copy! (-> this jmod-antenna 1 rotation) (-> s5-2 quat0)) + (quaternion-copy! (-> this jmod-antenna 2 rotation) (-> s5-2 quat0)) + (quaternion-copy! (-> this jmod-antenna 3 rotation) (-> s5-2 quat0)) + ) + 0 + (none) ) ;; definition for method 35 of type v-turtle 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 35c42612e8..1b2c365d2d 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 @@ -60,205 +60,188 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod control-hook-ai ((this wvehicle) (arg0 vehicle-controls)) - (local-vars (v1-50 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'wvehicle-physics-work))) - (mem-set32! (the-as pointer (-> gp-0 forward-dir)) 6 0) - (set! (-> gp-0 wsphere r) (seconds-per-frame)) - (set! (-> gp-0 friction-coef) (the-as float (current-time))) - (vehicle-method-140 this) - (set! (-> gp-0 mat rvec quad) (-> this rbody position quad)) - (vector-copy! (-> gp-0 mat uvec) (-> this rbody lin-velocity)) - (vector-copy! (-> gp-0 probe-dir) (-> this rbody matrix fvec)) - (vector-copy! (-> gp-0 steering-axis) (-> this rbody matrix rvec)) - (set! (-> gp-0 steering-axis y) 0.0) - (set! (-> gp-0 side-dir z) (vector-length (-> gp-0 mat uvec))) - (set! (-> gp-0 wheel-axis z) (vector-dot (-> gp-0 mat uvec) (-> gp-0 probe-dir))) - (cond - ((logtest? (vehicle-flag rammed-target) (-> this v-flags)) - (if (or (and (< (the-as uint 600) (- (the-as uint (-> gp-0 friction-coef)) (the-as uint (-> this ram-time)))) - (< (the-as uint 150) (- (the-as uint (-> gp-0 friction-coef)) (the-as uint (-> this impact-time)))) - ) - (and (logtest? (-> this v-flags) (vehicle-flag impact)) (< (-> this impact-local-pos z) 0.0)) - ) - (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag rammed-target)))) - ) - ) - (else - (when (and (logtest? (-> this v-flags) (vehicle-flag impact)) - (< (- (the-as uint (-> gp-0 friction-coef)) (the-as uint (-> this prev-impact-time))) (the-as uint 30)) - (< (-> gp-0 wheel-axis z) 40960.0) - (< 0.0 (-> gp-0 wheel-axis z)) - (< 0.0 (-> this impact-local-pos z)) - ) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag rammed-target) (-> this v-flags)))) - (set! (-> this ram-time) (the-as uint (-> gp-0 friction-coef))) - ) - ) - ) - (set! (-> gp-0 wheel-axis x) 0.0) - (let ((v1-38 (-> this ai-state))) - (b! (!= v1-38 1) cfg-45 :delay (empty-form)) - (let ((a0-32 (as-type (handle->process (-> this target-status handle)) process-focusable))) - (b! a0-32 cfg-39 :delay (empty-form)) - (set! (-> gp-0 side-dir x) 1.0) - (b! #t cfg-64 :delay (nop!)) - (label cfg-39) - (vector-copy! (-> gp-0 force) (-> (the-as process-focusable a0-32) node-list data 0 bone transform fvec)) - ) - (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) - (f0-13 (* f0-11 f0-11)) - ) - (.lvf vf1 (&-> (-> gp-0 mat trans) 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-50 vf1) - (if (< f0-13 v1-50) - (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)) - ) - (vector-normalize! (-> gp-0 force) 1.0) - (vector+float*! (-> gp-0 velocity) (-> gp-0 mat fvec) (-> gp-0 force) 81920.0) - (vector+float*! (-> gp-0 velocity) (-> gp-0 velocity) (-> gp-0 mat trans) 0.5) - (when (logtest? (vehicle-flag vf54) (-> this v-flags)) - (vector-copy! (-> gp-0 axis) (-> gp-0 mat rvec)) - (vector-copy! (-> gp-0 dir) (-> gp-0 mat uvec)) - (vector-copy! (-> gp-0 ground-normal-sum) (-> gp-0 mat fvec)) - (vector-copy! (-> gp-0 ground-pos) (-> gp-0 mat trans)) - (set! (-> gp-0 axis y) 0.0) - (set! (-> gp-0 dir y) 0.0) - (set! (-> gp-0 ground-normal-sum y) 0.0) - (set! (-> gp-0 ground-pos y) 0.0) - (set! (-> gp-0 wsphere z) (nearest-dist2-between-moving-points - (-> gp-0 mat rvec) - (-> gp-0 mat uvec) - (-> gp-0 mat fvec) - (-> gp-0 mat trans) - 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 - ) - ) - ) - 0 - (b! #t cfg-49 :delay (nop!)) - (label cfg-45) - (cond - ((= v1-38 2) - (vector-copy! (-> gp-0 velocity) (-> this ai-target-point)) - (set! (-> gp-0 wheel-axis x) (-> this ai-max-speed)) - ) - ((zero? v1-38) - ) - ) - ) - (label cfg-49) - (cond - ((>= 0.0 (-> gp-0 wheel-axis x)) - (set! (-> gp-0 side-dir x) 1.0) - ) - ((begin - (cond - ((logtest? (vehicle-flag vf52) (-> this v-flags)) - (vector-! (-> gp-0 mat trans) (-> gp-0 velocity) (-> this root trans)) - (vector-normalize! (-> gp-0 mat trans) (-> gp-0 wheel-axis x)) - ) - (else - (when (-> this nav) - (let ((a0-69 (-> this nav state)) - (v1-92 (-> gp-0 velocity)) - ) - (logclear! (-> a0-69 flags) (nav-state-flag directional-mode)) - (logior! (-> a0-69 flags) (nav-state-flag target-poly-dirty)) - (vector-copy! (-> a0-69 target-pos) v1-92) - ) - 0 - (let ((v1-95 (-> this nav))) - (set! (-> v1-95 target-speed) (-> gp-0 wheel-axis x)) - ) - 0 - (let ((a1-22 (-> this nav state))) - (vector-copy! (-> gp-0 mat trans) (-> a1-22 velocity)) - ) - ) - ) - ) - (when (< (vector-dot (-> gp-0 mat trans) (-> gp-0 probe-dir)) 0.0) - (vector-float*! - (-> gp-0 mat trans) - (-> gp-0 steering-axis) - (vector-dot (-> gp-0 mat trans) (-> gp-0 steering-axis)) - ) - (vector-normalize! (-> gp-0 mat trans) (-> gp-0 wheel-axis x)) - ) - (vector-! (-> gp-0 local-pos) (-> gp-0 mat trans) (-> gp-0 mat uvec)) - (vector-float*! (-> gp-0 tmp) (-> gp-0 local-pos) 1.5) - (set! (-> gp-0 wheel-axis w) 0.0) - (dotimes (v1-108 2) - (let ((a0-80 (-> this wheel (+ v1-108 2)))) - (if (logtest? (-> a0-80 flags) 2) - (+! (-> gp-0 wheel-axis w) (-> a0-80 side-vel)) - ) - ) - ) - (set! (-> gp-0 wheel-axis y) - (* 60.0 - (+ (* 0.0000061035157 (- (-> gp-0 wheel-axis x) (-> gp-0 side-dir z))) - (* -0.0000061035157 (fabs (-> gp-0 wheel-axis w))) - ) - (-> this info handling ai-throttle-factor) + (let ((gp-0 (new 'stack-no-clear 'wvehicle-physics-work))) + (mem-set32! (the-as pointer (-> gp-0 forward-dir)) 6 0) + (set! (-> gp-0 wsphere r) (seconds-per-frame)) + (set! (-> gp-0 friction-coef) (the-as float (current-time))) + (vehicle-method-140 this) + (set! (-> gp-0 mat rvec quad) (-> this rbody position quad)) + (vector-copy! (-> gp-0 mat uvec) (-> this rbody lin-velocity)) + (vector-copy! (-> gp-0 probe-dir) (-> this rbody matrix fvec)) + (vector-copy! (-> gp-0 steering-axis) (-> this rbody matrix rvec)) + (set! (-> gp-0 steering-axis y) 0.0) + (set! (-> gp-0 side-dir z) (vector-length (-> gp-0 mat uvec))) + (set! (-> gp-0 wheel-axis z) (vector-dot (-> gp-0 mat uvec) (-> gp-0 probe-dir))) + (cond + ((logtest? (vehicle-flag rammed-target) (-> this v-flags)) + (if (or (and (< (the-as uint 600) (- (the-as uint (-> gp-0 friction-coef)) (the-as uint (-> this ram-time)))) + (< (the-as uint 150) (- (the-as uint (-> gp-0 friction-coef)) (the-as uint (-> this impact-time)))) ) - ) - (set! (-> gp-0 forward-dir y) - (fmax 0.0 (fmin 1.0 (+ (-> this controls throttle) (* (-> gp-0 wsphere r) (-> gp-0 wheel-axis y))))) - ) - (set! (-> gp-0 forward-dir z) - (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ (- -4096.0 (-> gp-0 wheel-axis x)) (-> gp-0 side-dir z))))) - ) - (set! (-> gp-0 wsphere x) (vector-dot (-> gp-0 steering-axis) (-> gp-0 tmp))) - (set! (-> gp-0 wsphere y) (- (-> gp-0 wheel-axis w) (fmax -12288.0 (fmin 12288.0 (-> gp-0 wheel-axis w))))) - (set! (-> gp-0 forward-dir x) (fmax -1.0 (fmin 1.0 (* 2.0 - (-> this info handling ai-steering-factor) - (/ 1.0 (+ 4096.0 (-> gp-0 side-dir z))) - (+ (-> gp-0 wsphere x) (-> gp-0 wsphere y)) - ) - ) - ) - ) - (logtest? (vehicle-flag rammed-target) (-> this v-flags)) + (and (logtest? (-> this v-flags) (vehicle-flag impact)) (< (-> this impact-local-pos z) 0.0)) + ) + (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag rammed-target)))) ) - (set! (-> gp-0 forward-dir y) 0.0) - (set! (-> gp-0 forward-dir z) 1.0) - (set! (-> gp-0 forward-dir x) (* -1.0 (-> gp-0 forward-dir x))) + ) + (else + (when (and (logtest? (-> this v-flags) (vehicle-flag impact)) + (< (- (the-as uint (-> gp-0 friction-coef)) (the-as uint (-> this prev-impact-time))) (the-as uint 30)) + (< (-> gp-0 wheel-axis z) 40960.0) + (< 0.0 (-> gp-0 wheel-axis z)) + (< 0.0 (-> this impact-local-pos z)) + ) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag rammed-target) (-> this v-flags)))) + (set! (-> this ram-time) (the-as uint (-> gp-0 friction-coef))) + ) + ) + ) + (set! (-> gp-0 wheel-axis x) 0.0) + (let ((v1-38 (-> this ai-state))) + (b! (!= v1-38 1) cfg-45 :delay (empty-form)) + (let ((a0-32 (as-type (handle->process (-> this target-status handle)) process-focusable))) + (b! a0-32 cfg-39 :delay (empty-form)) + (set! (-> gp-0 side-dir x) 1.0) + (b! #t cfg-64 :delay (nop!)) + (label cfg-39) + (vector-copy! (-> gp-0 force) (-> (the-as process-focusable a0-32) node-list data 0 bone transform fvec)) + ) + (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)) + ) + ) + (set! (-> gp-0 wheel-axis x) + (fmax (fmin (+ 20480.0 (vector-length (-> gp-0 mat trans))) (-> this ai-max-speed)) (-> this ai-min-speed)) + ) + (vector-normalize! (-> gp-0 force) 1.0) + (vector+float*! (-> gp-0 velocity) (-> gp-0 mat fvec) (-> gp-0 force) 81920.0) + (vector+float*! (-> gp-0 velocity) (-> gp-0 velocity) (-> gp-0 mat trans) 0.5) + (when (logtest? (vehicle-flag vf54) (-> this v-flags)) + (vector-copy! (-> gp-0 axis) (-> gp-0 mat rvec)) + (vector-copy! (-> gp-0 dir) (-> gp-0 mat uvec)) + (vector-copy! (-> gp-0 ground-normal-sum) (-> gp-0 mat fvec)) + (vector-copy! (-> gp-0 ground-pos) (-> gp-0 mat trans)) + (set! (-> gp-0 axis y) 0.0) + (set! (-> gp-0 dir y) 0.0) + (set! (-> gp-0 ground-normal-sum y) 0.0) + (set! (-> gp-0 ground-pos y) 0.0) + (set! (-> gp-0 wsphere z) (nearest-dist2-between-moving-points + (-> gp-0 mat rvec) + (-> gp-0 mat uvec) + (-> gp-0 mat fvec) + (-> gp-0 mat trans) + 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 + ) + ) + ) + 0 + (b! #t cfg-49 :delay (nop!)) + (label cfg-45) + (cond + ((= v1-38 2) + (vector-copy! (-> gp-0 velocity) (-> this ai-target-point)) + (set! (-> gp-0 wheel-axis x) (-> this ai-max-speed)) + ) + ((zero? v1-38) ) ) - (label cfg-64) - (vehicle-method-92 this (the-as vehicle-controls (-> gp-0 forward-dir))) ) - 0 - (none) + (label cfg-49) + (cond + ((>= 0.0 (-> gp-0 wheel-axis x)) + (set! (-> gp-0 side-dir x) 1.0) + ) + ((begin + (cond + ((logtest? (vehicle-flag vf52) (-> this v-flags)) + (vector-! (-> gp-0 mat trans) (-> gp-0 velocity) (-> this root trans)) + (vector-normalize! (-> gp-0 mat trans) (-> gp-0 wheel-axis x)) + ) + (else + (when (-> this nav) + (let ((a0-69 (-> this nav state)) + (v1-92 (-> gp-0 velocity)) + ) + (logclear! (-> a0-69 flags) (nav-state-flag directional-mode)) + (logior! (-> a0-69 flags) (nav-state-flag target-poly-dirty)) + (vector-copy! (-> a0-69 target-pos) v1-92) + ) + 0 + (let ((v1-95 (-> this nav))) + (set! (-> v1-95 target-speed) (-> gp-0 wheel-axis x)) + ) + 0 + (let ((a1-22 (-> this nav state))) + (vector-copy! (-> gp-0 mat trans) (-> a1-22 velocity)) + ) + ) + ) + ) + (when (< (vector-dot (-> gp-0 mat trans) (-> gp-0 probe-dir)) 0.0) + (vector-float*! + (-> gp-0 mat trans) + (-> gp-0 steering-axis) + (vector-dot (-> gp-0 mat trans) (-> gp-0 steering-axis)) + ) + (vector-normalize! (-> gp-0 mat trans) (-> gp-0 wheel-axis x)) + ) + (vector-! (-> gp-0 local-pos) (-> gp-0 mat trans) (-> gp-0 mat uvec)) + (vector-float*! (-> gp-0 tmp) (-> gp-0 local-pos) 1.5) + (set! (-> gp-0 wheel-axis w) 0.0) + (dotimes (v1-108 2) + (let ((a0-80 (-> this wheel (+ v1-108 2)))) + (if (logtest? (-> a0-80 flags) 2) + (+! (-> gp-0 wheel-axis w) (-> a0-80 side-vel)) + ) + ) + ) + (set! (-> gp-0 wheel-axis y) + (* 60.0 + (+ (* 0.0000061035157 (- (-> gp-0 wheel-axis x) (-> gp-0 side-dir z))) + (* -0.0000061035157 (fabs (-> gp-0 wheel-axis w))) + ) + (-> this info handling ai-throttle-factor) + ) + ) + (set! (-> gp-0 forward-dir y) + (fmax 0.0 (fmin 1.0 (+ (-> this controls throttle) (* (-> gp-0 wsphere r) (-> gp-0 wheel-axis y))))) + ) + (set! (-> gp-0 forward-dir z) + (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ (- -4096.0 (-> gp-0 wheel-axis x)) (-> gp-0 side-dir z))))) + ) + (set! (-> gp-0 wsphere x) (vector-dot (-> gp-0 steering-axis) (-> gp-0 tmp))) + (set! (-> gp-0 wsphere y) (- (-> gp-0 wheel-axis w) (fmax -12288.0 (fmin 12288.0 (-> gp-0 wheel-axis w))))) + (set! (-> gp-0 forward-dir x) (fmax -1.0 (fmin 1.0 (* 2.0 + (-> this info handling ai-steering-factor) + (/ 1.0 (+ 4096.0 (-> gp-0 side-dir z))) + (+ (-> gp-0 wsphere x) (-> gp-0 wsphere y)) + ) + ) + ) + ) + (logtest? (vehicle-flag rammed-target) (-> this v-flags)) + ) + (set! (-> gp-0 forward-dir y) 0.0) + (set! (-> gp-0 forward-dir z) 1.0) + (set! (-> gp-0 forward-dir x) (* -1.0 (-> gp-0 forward-dir x))) + ) + ) + (label cfg-64) + (vehicle-method-92 this (the-as vehicle-controls (-> gp-0 forward-dir))) ) + 0 + (none) ) 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 7ffaacfdfb..f1a649d55d 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 @@ -497,140 +497,123 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod apply-gravity! ((this wvehicle) (arg0 float)) - (local-vars (v1-51 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (wvehicle-method-162 this arg0) - (wvehicle-method-163 this) - (let ((gp-0 (new 'stack-no-clear 'wvehicle-physics-work)) - (s5-0 (-> this rbody)) - (s4-0 (-> this info)) - ) - (set! (-> gp-0 cur-time) (the-as uint (current-time))) - (cond - ((logtest? (-> this v-flags) (vehicle-flag dead)) - (vector-reset! (-> gp-0 ground-normal-sum)) - ) - (else - (wvehicle-method-160 this gp-0) - (vector-reset! (-> gp-0 force)) - (set! (-> gp-0 force y) (* 2.0 (-> s4-0 info mass) (-> s4-0 extra gravity) (-> this jump-control))) - (add-force! s5-0 (-> gp-0 force)) - (vehicle-method-97 this arg0 (the-as vehicle-physics-work gp-0)) - ) + (wvehicle-method-162 this arg0) + (wvehicle-method-163 this) + (let ((gp-0 (new 'stack-no-clear 'wvehicle-physics-work)) + (s5-0 (-> this rbody)) + (s4-0 (-> this info)) ) - (when (logtest? (vehicle-flag turbo-boost) (-> this v-flags)) - (let ((f0-6 (* (-> this turbo-boost-factor) (-> s4-0 info mass) (-> s4-0 extra gravity)))) - (vector-float*! (-> gp-0 force) (-> gp-0 mat fvec) f0-6) - ) - (add-force! s5-0 (-> gp-0 force)) - ) - (when (logtest? (-> this v-flags) (vehicle-flag in-air)) - (let* ((v1-29 (-> this rbody ang-momentum)) - (a0-10 (-> this rbody ang-momentum)) - (f3-0 (-> s4-0 handling air-angular-damping)) - (f2-0 arg0) - (f0-7 0.0) - (f1-5 1.0) - (f2-1 (* -1.0 (- 1.0 f3-0) f2-0)) - (f3-3 0.016666668) - ) - (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) - ) - (cond - ((< f0-13 (* f1-10 f1-10)) - (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)) - (vector-reset! (-> gp-0 force)) - (set! (-> gp-0 force x) (* (-> s4-0 handling hop-turn-torque) (-> this controls steering))) - (set! (-> gp-0 force y) (* -1.0 (-> this controls lean-z) (-> s4-0 handling air-pitch-torque))) - (vector-rotate*! (-> gp-0 force) (-> gp-0 force) (-> gp-0 mat)) - (rigid-body-control-method-22 s5-0 (-> gp-0 world-pos) (-> gp-0 force)) - ) - (else - (vector-copy! (-> gp-0 local-pos) (-> s4-0 info cm-offset-joint)) - (+! (-> gp-0 local-pos y) 4096.0) - (vector-matrix*! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> gp-0 mat)) - (vector-reset! (-> gp-0 force)) - (set! (-> gp-0 force x) (* (-> s4-0 handling air-roll-torque) (-> this controls steering))) - (set! (-> gp-0 force z) (* (-> s4-0 handling air-pitch-torque) (-> this controls lean-z))) - (vector-rotate*! (-> gp-0 force) (-> gp-0 force) (-> gp-0 mat)) - (rigid-body-control-method-22 s5-0 (-> gp-0 world-pos) (-> gp-0 force)) - ) - ) - ) - ) - (when (not (logtest? (vehicle-flag gun-dark-2-zero-g) (-> this v-flags))) - (let ((f0-27 0.0)) - (.lvf vf1 (&-> (-> gp-0 ground-normal-sum) 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-51 vf1) - (if (= f0-27 v1-51) - (set! (-> gp-0 ground-normal-sum y) 1.0) - ) - ) - (+! (-> gp-0 ground-normal-sum y) 6.0) - (vector-normalize! (-> gp-0 ground-normal-sum) 1.0) - (vector-float*! (-> this gravity-dir) (-> gp-0 ground-normal-sum) -1.0) - (vector-float*! (-> gp-0 force) (-> this gravity-dir) (* (-> s4-0 extra gravity) (-> s4-0 info mass))) - (add-force! s5-0 (-> gp-0 force)) - ) - (rigid-body-object-method-53 this arg0) - (vehicle-method-96 this arg0) - (countdown (s1-0 (-> s4-0 physics-model wheel-count)) - (let* ((a1-25 (-> this wheel s1-0)) - (v1-69 (-> a1-25 info)) - ) - (set! (-> gp-0 wsphere quad) (-> a1-25 trans quad)) - (set! (-> gp-0 wsphere r) (* (-> v1-69 scale) (-> v1-69 radius))) - ) - (vehicle-method-95 this (-> gp-0 wsphere) arg0) - 0 - ) - (let ((f0-38 (* -0.000012207031 (vector-length (-> s5-0 lin-velocity)) (-> s4-0 handling drag-force-factor)))) - (vector-float*! (-> gp-0 force) (-> s5-0 lin-velocity) f0-38) - ) - (add-force! s5-0 (-> gp-0 force)) - (when (or (and (logtest? (-> this v-flags) (vehicle-flag in-air)) - (and (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (and (< (-> s5-0 matrix uvec y) 0.0) (< (- (-> gp-0 cur-time) (-> this impact-time)) (the-as uint 10))) - ) - ) - (logtest? (vehicle-flag overturned) (-> this v-flags)) - ) - (vector-reset! (-> gp-0 local-pos)) - (set! (-> gp-0 local-pos y) -6144.0) - (when (logtest? (vehicle-flag overturned) (-> this v-flags)) - (let ((f0-42 (* 0.0033333334 (the float (- (current-time) (the-as int (-> this overturned-time))))))) - (set! (-> gp-0 local-pos y) (* (+ -32768.0 (* -16384.0 f0-42)) - (-> s4-0 handling roll-control-factor) - (fmax 0.1 (- (-> s5-0 matrix uvec y))) - ) - ) - ) - ) - (vector-matrix*! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> gp-0 mat)) + (set! (-> gp-0 cur-time) (the-as uint (current-time))) + (cond + ((logtest? (-> this v-flags) (vehicle-flag dead)) + (vector-reset! (-> gp-0 ground-normal-sum)) + ) + (else + (wvehicle-method-160 this gp-0) (vector-reset! (-> gp-0 force)) - (set! (-> gp-0 force y) (* (/ (-> s4-0 extra gravity) -2) (-> s4-0 info mass))) - (rigid-body-control-method-22 s5-0 (-> gp-0 world-pos) (-> gp-0 force)) + (set! (-> gp-0 force y) (* 2.0 (-> s4-0 info mass) (-> s4-0 extra gravity) (-> this jump-control))) + (add-force! s5-0 (-> gp-0 force)) + (vehicle-method-97 this arg0 (the-as vehicle-physics-work gp-0)) ) ) - 0 - (none) + (when (logtest? (vehicle-flag turbo-boost) (-> this v-flags)) + (let ((f0-6 (* (-> this turbo-boost-factor) (-> s4-0 info mass) (-> s4-0 extra gravity)))) + (vector-float*! (-> gp-0 force) (-> gp-0 mat fvec) f0-6) + ) + (add-force! s5-0 (-> gp-0 force)) + ) + (when (logtest? (-> this v-flags) (vehicle-flag in-air)) + (let* ((v1-29 (-> this rbody ang-momentum)) + (a0-10 (-> this rbody ang-momentum)) + (f3-0 (-> s4-0 handling air-angular-damping)) + (f2-0 arg0) + (f0-7 0.0) + (f1-5 1.0) + (f2-1 (* -1.0 (- 1.0 f3-0) f2-0)) + (f3-3 0.016666668) + ) + (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) + ) + (cond + ((< f0-13 (* f1-10 f1-10)) + (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)) + (vector-reset! (-> gp-0 force)) + (set! (-> gp-0 force x) (* (-> s4-0 handling hop-turn-torque) (-> this controls steering))) + (set! (-> gp-0 force y) (* -1.0 (-> this controls lean-z) (-> s4-0 handling air-pitch-torque))) + (vector-rotate*! (-> gp-0 force) (-> gp-0 force) (-> gp-0 mat)) + (rigid-body-control-method-22 s5-0 (-> gp-0 world-pos) (-> gp-0 force)) + ) + (else + (vector-copy! (-> gp-0 local-pos) (-> s4-0 info cm-offset-joint)) + (+! (-> gp-0 local-pos y) 4096.0) + (vector-matrix*! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> gp-0 mat)) + (vector-reset! (-> gp-0 force)) + (set! (-> gp-0 force x) (* (-> s4-0 handling air-roll-torque) (-> this controls steering))) + (set! (-> gp-0 force z) (* (-> s4-0 handling air-pitch-torque) (-> this controls lean-z))) + (vector-rotate*! (-> gp-0 force) (-> gp-0 force) (-> gp-0 mat)) + (rigid-body-control-method-22 s5-0 (-> gp-0 world-pos) (-> gp-0 force)) + ) + ) + ) + ) + (when (not (logtest? (vehicle-flag gun-dark-2-zero-g) (-> this v-flags))) + (if (= 0.0 (vector-length-squared (-> gp-0 ground-normal-sum))) + (set! (-> gp-0 ground-normal-sum y) 1.0) + ) + (+! (-> gp-0 ground-normal-sum y) 6.0) + (vector-normalize! (-> gp-0 ground-normal-sum) 1.0) + (vector-float*! (-> this gravity-dir) (-> gp-0 ground-normal-sum) -1.0) + (vector-float*! (-> gp-0 force) (-> this gravity-dir) (* (-> s4-0 extra gravity) (-> s4-0 info mass))) + (add-force! s5-0 (-> gp-0 force)) + ) + (rigid-body-object-method-53 this arg0) + (vehicle-method-96 this arg0) + (countdown (s1-0 (-> s4-0 physics-model wheel-count)) + (let* ((a1-25 (-> this wheel s1-0)) + (v1-69 (-> a1-25 info)) + ) + (set! (-> gp-0 wsphere quad) (-> a1-25 trans quad)) + (set! (-> gp-0 wsphere r) (* (-> v1-69 scale) (-> v1-69 radius))) + ) + (vehicle-method-95 this (-> gp-0 wsphere) arg0) + 0 + ) + (let ((f0-38 (* -0.000012207031 (vector-length (-> s5-0 lin-velocity)) (-> s4-0 handling drag-force-factor)))) + (vector-float*! (-> gp-0 force) (-> s5-0 lin-velocity) f0-38) + ) + (add-force! s5-0 (-> gp-0 force)) + (when (or (and (logtest? (-> this v-flags) (vehicle-flag in-air)) + (and (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (and (< (-> s5-0 matrix uvec y) 0.0) (< (- (-> gp-0 cur-time) (-> this impact-time)) (the-as uint 10))) + ) + ) + (logtest? (vehicle-flag overturned) (-> this v-flags)) + ) + (vector-reset! (-> gp-0 local-pos)) + (set! (-> gp-0 local-pos y) -6144.0) + (when (logtest? (vehicle-flag overturned) (-> this v-flags)) + (let ((f0-42 (* 0.0033333334 (the float (- (current-time) (the-as int (-> this overturned-time))))))) + (set! (-> gp-0 local-pos y) (* (+ -32768.0 (* -16384.0 f0-42)) + (-> s4-0 handling roll-control-factor) + (fmax 0.1 (- (-> s5-0 matrix uvec y))) + ) + ) + ) + ) + (vector-matrix*! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> gp-0 mat)) + (vector-reset! (-> gp-0 force)) + (set! (-> gp-0 force y) (* (/ (-> s4-0 extra gravity) -2) (-> s4-0 info mass))) + (rigid-body-control-method-22 s5-0 (-> gp-0 world-pos) (-> gp-0 force)) + ) ) + 0 + (none) ) ;; definition for method 120 of type wvehicle 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 4f6d07a899..ada5298fb3 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 @@ -31,341 +31,238 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod wvehicle-method-181 ((this wvehicle)) - (local-vars (v1-23 float) (v1-32 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((a1-0 (new 'stack-no-clear 'wvehicle-physics-work))) - (set! (-> a1-0 cur-time) (the-as uint (current-time))) - (wvehicle-method-160 this a1-0) - ) - (let ((s5-0 (-> this race))) - (when #t - (race-control-method-11 s5-0 0.0) - (let ((s4-0 (-> this rbody)) - (f30-0 (seconds-per-frame)) - ) - 1.0 - (let ((s3-0 (new 'stack-no-clear 'wvehicle-physics-work)) - (f28-0 - (fmin - (* (+ (vector-length (-> s4-0 lin-velocity)) (* 163840.0 f30-0)) - (/ 1.0 (fmax 1.0 (vector-length (-> s5-0 lin-velocity)))) - ) - (-> s5-0 racer-state speed-factor) - ) - ) - ) - (set! (-> s3-0 velocity x) 819200.0) - (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)) - (.lvf vf1 (&-> (-> s3-0 mat trans) 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-23 vf1) - (let ((f0-6 v1-23) - (f1-5 1.0) - (f2-2 40960.0) - ) - (set! (-> this path-deviation) (* f0-6 (/ f1-5 (* f2-2 f2-2)))) - ) - (let ((a1-5 (-> s3-0 mat fvec))) - (let ((v1-27 (-> s3-0 mat fvec))) - (let ((a0-6 (-> s3-0 mat trans))) - (let ((a2-1 1.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-6 quad)) - ) - (.lvf vf4 (&-> v1-27 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-5 quad) vf6) - ) - (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)) - (f0-12 (* f0-10 f0-10)) - ) - (.lvf vf1 (&-> v1-31 rvec 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-12 v1-32) - (vector-normalize! (-> s3-0 mat rvec) (-> s3-0 velocity x)) - ) - ) - (let ((a1-10 (-> s4-0 lin-velocity))) - (let ((v1-36 (-> s4-0 lin-velocity))) - (let ((a0-11 (-> s3-0 mat))) - (let ((a2-2 f30-0)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-11 rvec quad)) - ) - (.lvf vf4 (&-> v1-36 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-10 quad) vf6) - ) - (let ((a1-11 (-> s4-0 position))) - (let ((v1-37 (-> s4-0 position))) - (let ((a0-12 (-> s4-0 lin-velocity))) - (let ((a2-3 f30-0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-12 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-11 quad) vf6) - ) - (quaternion-pseudo-seek - (the-as quaternion (-> s4-0 rot)) - (the-as quaternion (-> s4-0 rot)) - (the-as quaternion (-> s3-0 force)) - (* 10.0 f30-0) - ) - (vector-float*! (-> s4-0 lin-momentum) (-> s4-0 lin-velocity) (-> this info info mass)) - (vector-reset! (-> s4-0 ang-momentum)) - (rigid-body-control-method-26 s4-0) - (init-velocities! s4-0) - (vector-copy! (-> this root transv) (-> s4-0 lin-velocity)) - (quaternion-copy! (-> this root quat) (the-as quaternion (-> s4-0 rot))) - (rigid-body-control-method-25 s4-0 (-> this root trans)) - (matrix-copy! (-> this node-list data 0 bone transform) (-> s4-0 matrix)) - (vector-copy! (-> this node-list data 0 bone transform trans) (-> this root trans)) - (race-control-method-11 s5-0 (* f30-0 f28-0)) + (let ((a1-0 (new 'stack-no-clear 'wvehicle-physics-work))) + (set! (-> a1-0 cur-time) (the-as uint (current-time))) + (wvehicle-method-160 this a1-0) + ) + (let ((s5-0 (-> this race))) + (when #t + (race-control-method-11 s5-0 0.0) + (let ((s4-0 (-> this rbody)) + (f30-0 (seconds-per-frame)) ) + 1.0 + (let ((s3-0 (new 'stack-no-clear 'wvehicle-physics-work)) + (f28-0 + (fmin + (* (+ (vector-length (-> s4-0 lin-velocity)) (* 163840.0 f30-0)) + (/ 1.0 (fmax 1.0 (vector-length (-> s5-0 lin-velocity)))) + ) + (-> s5-0 racer-state speed-factor) + ) + ) + ) + (set! (-> s3-0 velocity x) 819200.0) + (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)))) + ) + (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))) + (vector-normalize! (-> s3-0 mat rvec) (-> s3-0 velocity x)) + ) + ) + (vector+*! (-> s4-0 lin-velocity) (-> s4-0 lin-velocity) (-> s3-0 mat rvec) f30-0) + (vector+*! (-> s4-0 position) (-> s4-0 position) (-> s4-0 lin-velocity) f30-0) + (quaternion-pseudo-seek + (the-as quaternion (-> s4-0 rot)) + (the-as quaternion (-> s4-0 rot)) + (the-as quaternion (-> s3-0 force)) + (* 10.0 f30-0) + ) + (vector-float*! (-> s4-0 lin-momentum) (-> s4-0 lin-velocity) (-> this info info mass)) + (vector-reset! (-> s4-0 ang-momentum)) + (rigid-body-control-method-26 s4-0) + (init-velocities! s4-0) + (vector-copy! (-> this root transv) (-> s4-0 lin-velocity)) + (quaternion-copy! (-> this root quat) (the-as quaternion (-> s4-0 rot))) + (rigid-body-control-method-25 s4-0 (-> this root trans)) + (matrix-copy! (-> this node-list data 0 bone transform) (-> s4-0 matrix)) + (vector-copy! (-> this node-list data 0 bone transform trans) (-> this root trans)) + (race-control-method-11 s5-0 (* f30-0 f28-0)) ) ) ) - (vehicle-method-77 this) - (rigid-body-object-method-30 this) - (update-transforms (-> this root)) - (let ((a1-18 (new 'stack-no-clear 'overlaps-others-params))) - (set! (-> a1-18 options) (overlaps-others-options)) - (set! (-> a1-18 collide-with-filter) (collide-spec civilian enemy obstacle)) - (set! (-> a1-18 tlist) *touching-list*) - (find-overlapping-shapes (-> this root) a1-18) - ) - 0 - (none) ) + (vehicle-method-77 this) + (rigid-body-object-method-30 this) + (update-transforms (-> this root)) + (let ((a1-21 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-21 options) (overlaps-others-options)) + (set! (-> a1-21 collide-with-filter) (collide-spec civilian enemy obstacle)) + (set! (-> a1-21 tlist) *touching-list*) + (find-overlapping-shapes (-> this root) a1-21) + ) + 0 + (none) ) ;; definition for method 177 of type wvehicle ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod wvehicle-method-177 ((this wvehicle) (arg0 vehicle-controls)) - (local-vars (v1-90 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (-> this race)) - (gp-0 (new 'stack-no-clear 'wvehicle-race-stack-var0)) - ) - (mem-set32! (the-as pointer (-> gp-0 vec11)) 6 0) - (set! (-> gp-0 time) (the-as uint (current-time))) - (vector-copy! (-> gp-0 vec0) (-> this rbody position)) - (vector-copy! (-> gp-0 vec1) (-> this rbody lin-velocity)) - (set! (-> gp-0 float5) 0.0) - (vector-copy! (-> gp-0 vec8) (-> this rbody matrix rvec)) - (set! (-> gp-0 vec8 y) 0.0) - (vector-normalize! (-> gp-0 vec8) 1.0) - (vector-copy! (-> gp-0 vec9) (-> this rbody matrix fvec)) - (set! (-> gp-0 vec13 x) (* (-> this rbody ang-velocity y) (vector-length (-> this rbody lin-velocity)))) - (set! (-> gp-0 float1) (seconds-per-frame)) - (set! (-> gp-0 float8) (vector-dot (-> gp-0 vec1) (-> gp-0 vec9))) - (cond - ((logtest? (vehicle-flag rammed-target) (-> this v-flags)) - (if (or (and (< (the-as uint 600) (- (the-as uint (-> gp-0 time)) (-> this ram-time))) - (< (the-as uint 150) (- (the-as uint (-> gp-0 time)) (-> this impact-time))) - ) - (and (logtest? (-> this v-flags) (vehicle-flag impact)) (< (-> this impact-local-pos z) 0.0)) - ) - (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag rammed-target)))) - ) - ) - (else - (when (logtest? (-> this v-flags) (vehicle-flag impact)) - (when (and (< (- (-> gp-0 time) (-> this prev-impact-time)) (the-as uint 30)) - (< 0.0 (-> this impact-local-pos z)) - (< 0.0 (-> gp-0 float8)) - (< (-> gp-0 float8) 40960.0) - ) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag rammed-target) (-> this v-flags)))) - (set! (-> this ram-time) (-> gp-0 time)) - ) - ) - ) + (let ((s4-0 (-> this race)) + (gp-0 (new 'stack-no-clear 'wvehicle-race-stack-var0)) ) - (race-control-method-12 s4-0 (-> gp-0 vec0)) - (set! (-> gp-0 vec13 y) (vector-length (-> gp-0 vec1))) - (set! (-> gp-0 vec13 z) (vector-length (-> s4-0 lin-velocity))) - (set! (-> gp-0 vec13 w) - (* (-> gp-0 vec13 z) (fmax (-> s4-0 racer-state speed-factor) (-> this shortcut-speed-factor))) - ) - (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)) - ) - (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)))) - (when v1-60 - (when (!= v1-60 this) - (vector-copy! (-> gp-0 vec2) (-> (the-as process-drawable v1-60) root trans)) - (vector-copy! (-> gp-0 vec3) (-> (the-as process-drawable v1-60) root transv)) - (vector-copy! (-> gp-0 vec4) (-> (the-as process-drawable v1-60) rbody matrix fvec)) - (set! (-> gp-0 float6) - (nearest-dist2-between-moving-points (-> gp-0 vec0) (-> gp-0 vec1) (-> gp-0 vec2) (-> gp-0 vec3) 0.5) - ) - (when (< (-> gp-0 float6) (-> gp-0 float7)) - (vector-! (-> gp-0 vec6) (-> gp-0 vec2) (-> gp-0 vec0)) - (when (< 0.0 (vector-dot (-> gp-0 vec1) (-> gp-0 vec6))) - (set! (-> gp-0 vec13 w) - (fmin - (-> gp-0 vec13 w) - (* 0.95 - (fmax 0.0 (vector-dot (-> gp-0 vec9) (-> gp-0 vec4))) - (fmax 0.0 (vector-dot (-> gp-0 vec9) (-> gp-0 vec3))) - ) - ) - ) - 0 + (mem-set32! (the-as pointer (-> gp-0 vec11)) 6 0) + (set! (-> gp-0 time) (the-as uint (current-time))) + (vector-copy! (-> gp-0 vec0) (-> this rbody position)) + (vector-copy! (-> gp-0 vec1) (-> this rbody lin-velocity)) + (set! (-> gp-0 float5) 0.0) + (vector-copy! (-> gp-0 vec8) (-> this rbody matrix rvec)) + (set! (-> gp-0 vec8 y) 0.0) + (vector-normalize! (-> gp-0 vec8) 1.0) + (vector-copy! (-> gp-0 vec9) (-> this rbody matrix fvec)) + (set! (-> gp-0 vec13 x) (* (-> this rbody ang-velocity y) (vector-length (-> this rbody lin-velocity)))) + (set! (-> gp-0 float1) (seconds-per-frame)) + (set! (-> gp-0 float8) (vector-dot (-> gp-0 vec1) (-> gp-0 vec9))) + (cond + ((logtest? (vehicle-flag rammed-target) (-> this v-flags)) + (if (or (and (< (the-as uint 600) (- (the-as uint (-> gp-0 time)) (-> this ram-time))) + (< (the-as uint 150) (- (the-as uint (-> gp-0 time)) (-> this impact-time))) ) + (and (logtest? (-> this v-flags) (vehicle-flag impact)) (< (-> this impact-local-pos z) 0.0)) + ) + (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag rammed-target)))) + ) + ) + (else + (when (logtest? (-> this v-flags) (vehicle-flag impact)) + (when (and (< (- (-> gp-0 time) (-> this prev-impact-time)) (the-as uint 30)) + (< 0.0 (-> this impact-local-pos z)) + (< 0.0 (-> gp-0 float8)) + (< (-> gp-0 float8) 40960.0) + ) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag rammed-target) (-> this v-flags)))) + (set! (-> this ram-time) (-> gp-0 time)) + ) + ) + ) + ) + (race-control-method-12 s4-0 (-> gp-0 vec0)) + (set! (-> gp-0 vec13 y) (vector-length (-> gp-0 vec1))) + (set! (-> gp-0 vec13 z) (vector-length (-> s4-0 lin-velocity))) + (set! (-> gp-0 vec13 w) + (* (-> gp-0 vec13 z) (fmax (-> s4-0 racer-state speed-factor) (-> this shortcut-speed-factor))) + ) + (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)) + ) + (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)))) + (when v1-60 + (when (!= v1-60 this) + (vector-copy! (-> gp-0 vec2) (-> (the-as process-drawable v1-60) root trans)) + (vector-copy! (-> gp-0 vec3) (-> (the-as process-drawable v1-60) root transv)) + (vector-copy! (-> gp-0 vec4) (-> (the-as process-drawable v1-60) rbody matrix fvec)) + (set! (-> gp-0 float6) + (nearest-dist2-between-moving-points (-> gp-0 vec0) (-> gp-0 vec1) (-> gp-0 vec2) (-> gp-0 vec3) 0.5) + ) + (when (< (-> gp-0 float6) (-> gp-0 float7)) + (vector-! (-> gp-0 vec6) (-> gp-0 vec2) (-> gp-0 vec0)) + (when (< 0.0 (vector-dot (-> gp-0 vec1) (-> gp-0 vec6))) + (set! (-> gp-0 vec13 w) + (fmin + (-> gp-0 vec13 w) + (* 0.95 + (fmax 0.0 (vector-dot (-> gp-0 vec9) (-> gp-0 vec4))) + (fmax 0.0 (vector-dot (-> gp-0 vec9) (-> gp-0 vec3))) + ) + ) + ) + 0 ) ) ) ) ) ) - (let ((v1-76 (-> s4-0 path-sample))) - (set! (-> gp-0 vec11 x) (* 0.007874016 (the float (-> v1-76 stick-x)))) - (set! (-> gp-0 vec11 w) (* 0.007874016 (the float (-> v1-76 stick-y)))) - (set! (-> gp-0 vec11 y) (* 0.003921569 (the float (-> v1-76 throttle)))) - (set! (-> gp-0 vec11 z) (if (logtest? (-> v1-76 flags) 1) - 1.0 - 0.0 - ) - ) - ) - (set! (-> gp-0 float0) 0.0) - (let ((f0-35 (+ (-> s4-0 path-t) (* 1.875 (/ 1.0 (-> gp-0 vec13 z)) (-> gp-0 vec13 y))))) - (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) - (f1-25 (/ f1-24 (* f2-8 f2-8))) - ) - (.lvf vf1 (&-> (-> gp-0 vec6) 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-90 vf1) - (set! (-> gp-0 float5) (+ f0-36 (* f1-25 v1-90))) - ) - (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)))) - ) - ) - (set! (-> this path-deviation) (-> gp-0 float5)) - (let ((a1-20 (-> gp-0 vec5))) - (let ((v1-94 (-> gp-0 vec12))) - (let ((a0-54 (-> gp-0 vec6))) - (let ((a2-4 1.0)) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a0-54 quad)) - ) - (.lvf vf4 (&-> v1-94 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-! (-> gp-0 vec7) (-> gp-0 vec5) (-> gp-0 vec1)) - (vector-float*! (-> gp-0 vec10) (-> gp-0 vec7) 1.5) - (set! (-> gp-0 float2) 0.0) - (dotimes (v1-98 2) - (let ((a0-60 (-> this wheel (+ v1-98 2)))) - (if (logtest? (-> a0-60 flags) 2) - (+! (-> gp-0 float2) (-> a0-60 side-vel)) - ) - ) - ) - (let ((f1-36 - (+ (* 0.00036621094 (- (-> gp-0 vec13 w) (-> gp-0 vec13 y)) (-> gp-0 float1)) - (* -0.000024414063 (fabs (-> gp-0 float2))) - ) - ) - ) - (set! (-> this ai-controls throttle) (fmax 0.0 (fmin 1.0 (+ (-> this ai-controls throttle) f1-36)))) - ) - (set! (-> this ai-controls brake) - (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ (- -4096.0 (-> gp-0 vec13 w)) (-> gp-0 vec13 y))))) - ) - (+! (-> this ai-controls brake) (* (- (-> this ai-controls brake)) (fmin 1.0 (* 8.0 (-> gp-0 float1))))) - (set! (-> gp-0 float3) (* 0.00001001358 (vector-dot (-> gp-0 vec8) (-> gp-0 vec10)))) - (set! (-> gp-0 float4) (* 0.00001001358 (- (-> gp-0 float2) (fmax -12288.0 (fmin 12288.0 (-> gp-0 float2)))))) - (set! (-> this ai-controls steering) (fmax -1.0 (fmin 1.0 (+ (-> gp-0 float3) (-> gp-0 float4))))) - (set! (-> gp-0 vec11 x) (-> this ai-controls steering)) - (set! (-> gp-0 vec11 y) (-> this ai-controls throttle)) - (set! (-> gp-0 vec11 z) (-> this ai-controls brake)) - (when (logtest? (vehicle-flag rammed-target) (-> this v-flags)) - (set! (-> gp-0 vec11 y) 0.0) - (set! (-> gp-0 vec11 z) 1.0) - (set! (-> gp-0 vec11 x) (* -1.0 (-> gp-0 vec11 x))) - ) - (if (logtest? (-> s4-0 path-sample flags) 2) - (logior! (-> gp-0 byte0) 1) - ) - (vehicle-method-92 this (the-as vehicle-controls (-> gp-0 vec11))) ) - 0 - (none) + (let ((v1-76 (-> s4-0 path-sample))) + (set! (-> gp-0 vec11 x) (* 0.007874016 (the float (-> v1-76 stick-x)))) + (set! (-> gp-0 vec11 w) (* 0.007874016 (the float (-> v1-76 stick-y)))) + (set! (-> gp-0 vec11 y) (* 0.003921569 (the float (-> v1-76 throttle)))) + (set! (-> gp-0 vec11 z) (if (logtest? (-> v1-76 flags) 1) + 1.0 + 0.0 + ) + ) + ) + (set! (-> gp-0 float0) 0.0) + (let ((f0-35 (+ (-> s4-0 path-t) (* 1.875 (/ 1.0 (-> gp-0 vec13 z)) (-> gp-0 vec13 y))))) + (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)))) + ) + ) + (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)) + (vector-float*! (-> gp-0 vec10) (-> gp-0 vec7) 1.5) + (set! (-> gp-0 float2) 0.0) + (dotimes (v1-98 2) + (let ((a0-60 (-> this wheel (+ v1-98 2)))) + (if (logtest? (-> a0-60 flags) 2) + (+! (-> gp-0 float2) (-> a0-60 side-vel)) + ) + ) + ) + (let ((f1-36 + (+ (* 0.00036621094 (- (-> gp-0 vec13 w) (-> gp-0 vec13 y)) (-> gp-0 float1)) + (* -0.000024414063 (fabs (-> gp-0 float2))) + ) + ) + ) + (set! (-> this ai-controls throttle) (fmax 0.0 (fmin 1.0 (+ (-> this ai-controls throttle) f1-36)))) + ) + (set! (-> this ai-controls brake) + (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ (- -4096.0 (-> gp-0 vec13 w)) (-> gp-0 vec13 y))))) + ) + (+! (-> this ai-controls brake) (* (- (-> this ai-controls brake)) (fmin 1.0 (* 8.0 (-> gp-0 float1))))) + (set! (-> gp-0 float3) (* 0.00001001358 (vector-dot (-> gp-0 vec8) (-> gp-0 vec10)))) + (set! (-> gp-0 float4) (* 0.00001001358 (- (-> gp-0 float2) (fmax -12288.0 (fmin 12288.0 (-> gp-0 float2)))))) + (set! (-> this ai-controls steering) (fmax -1.0 (fmin 1.0 (+ (-> gp-0 float3) (-> gp-0 float4))))) + (set! (-> gp-0 vec11 x) (-> this ai-controls steering)) + (set! (-> gp-0 vec11 y) (-> this ai-controls throttle)) + (set! (-> gp-0 vec11 z) (-> this ai-controls brake)) + (when (logtest? (vehicle-flag rammed-target) (-> this v-flags)) + (set! (-> gp-0 vec11 y) 0.0) + (set! (-> gp-0 vec11 z) 1.0) + (set! (-> gp-0 vec11 x) (* -1.0 (-> gp-0 vec11 x))) + ) + (if (logtest? (-> s4-0 path-sample flags) 2) + (logior! (-> gp-0 byte0) 1) + ) + (vehicle-method-92 this (the-as vehicle-controls (-> gp-0 vec11))) ) + 0 + (none) ) ;; definition for method 183 of type wvehicle 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 fe25754963..f3ca33fff2 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 @@ -517,48 +517,25 @@ ;; definition for method 103 of type wvehicle ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-103 ((this wvehicle)) - (local-vars (v1-8 float) (v1-13 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 (and (< v1-8 f0-1) (begin - (.lvf vf1 (&-> (-> this rbody lin-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-13 vf1) - (let ((f1-4 v1-13) - (f2-0 614.4) - ) - (< f1-4 (* f0-1 (* f2-0 f2-0))) - ) - ) + (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))) + ) + (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))) ) - (logclear! (-> this v-flags) (vehicle-flag disturbed)) - (vehicle-method-142 this) - ) + ) + (logclear! (-> this v-flags) (vehicle-flag disturbed)) + (vehicle-method-142 this) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 161 of type wvehicle 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 b39606d6cb..8630a4960b 100644 --- a/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle_REF.gc @@ -212,97 +212,75 @@ ;; definition for method 77 of type wvehicle (defmethod vehicle-method-77 ((this wvehicle)) - (local-vars (a0-19 float) (a0-23 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (if (-> this nav) - (logior! (-> this nav flags) (nav-control-flag output-sphere-hash)) - ) - (if (not (logtest? (-> this rbody flags) (rigid-body-flag enable-physics))) - (vehicle-method-142 this) - ) - (if (logtest? (-> this v-flags) (vehicle-flag in-air)) - (set! (-> this ground-time) (the-as uint (current-time))) - ) - (let ((v1-16 (-> this rbody))) - (cond - ((logtest? (vehicle-flag overturned) (-> this v-flags)) - (if (and (not (logtest? (-> this v-flags) (vehicle-flag in-air))) (< 0.0 (-> v1-16 matrix uvec y))) - (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag overturned)))) - ) - ) - (else - (when (and (logtest? (-> this v-flags) (vehicle-flag in-air)) - (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (< (-> v1-16 matrix uvec y) 0.0) - (let ((a0-18 (-> v1-16 lin-velocity)) - (f1-2 16384.0) - ) - (.lvf vf1 (&-> a0-18 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-19 vf1) - (< a0-19 (* f1-2 f1-2)) - ) - (let ((a0-22 (-> v1-16 ang-velocity)) - (f1-5 4.0) - ) - (.lvf vf1 (&-> a0-22 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-23 vf1) - (< a0-23 (* f1-5 f1-5)) - ) + (if (-> this nav) + (logior! (-> this nav flags) (nav-control-flag output-sphere-hash)) + ) + (if (not (logtest? (-> this rbody flags) (rigid-body-flag enable-physics))) + (vehicle-method-142 this) + ) + (if (logtest? (-> this v-flags) (vehicle-flag in-air)) + (set! (-> this ground-time) (the-as uint (current-time))) + ) + (let ((v1-16 (-> this rbody))) + (cond + ((logtest? (vehicle-flag overturned) (-> this v-flags)) + (if (and (not (logtest? (-> this v-flags) (vehicle-flag in-air))) (< 0.0 (-> v1-16 matrix uvec y))) + (set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag overturned)))) + ) + ) + (else + (when (and (logtest? (-> this v-flags) (vehicle-flag in-air)) + (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (< (-> v1-16 matrix uvec y) 0.0) + (let ((a0-18 (-> v1-16 lin-velocity)) + (f1-2 16384.0) + ) + (< (vector-length-squared a0-18) (* f1-2 f1-2)) ) - (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag overturned) (-> this v-flags)))) - (set! (-> this overturned-time) (the-as uint (current-time))) - ) + (let ((a0-22 (-> v1-16 ang-velocity)) + (f1-5 4.0) + ) + (< (vector-length-squared a0-22) (* f1-5 f1-5)) + ) + ) + (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag overturned) (-> this v-flags)))) + (set! (-> this overturned-time) (the-as uint (current-time))) ) ) - (if (and (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (< (+ 8192.0 (-> v1-16 position y)) (-> this water-height)) - ) - (go (method-of-object this sink)) - ) ) - (when (logtest? (vehicle-flag player-driving net-player-driving) (-> this v-flags)) - (when (and (logtest? (-> this controls flags) (vehicle-controls-flag vcf1)) - (>= (the-as uint (- (current-time) (the-as int (-> this shoot-time)))) (-> this shoot-delay)) - ) - (set! (-> this shoot-time) (the-as uint (current-time))) - (wvehicle-method-169 this) + (if (and (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (< (+ 8192.0 (-> v1-16 position y)) (-> this water-height)) + ) + (go (method-of-object this sink)) ) - ) - (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) - (let ((v1-39 *game-info*)) - (set! (-> v1-39 health-bar-vehicle) (-> this hit-points)) - (set! (-> v1-39 race-number-turbos) (the int (-> this turbo-supply))) - (set! (-> v1-39 vehicle-turbo-ready) (-> this turbo-ready)) - ) - (new 'stack-no-clear 'vector) - (dotimes (s5-0 (-> this info rider attach-point-count)) - (let ((s4-0 (as-type (handle->process (-> this attached-array s5-0)) process-focusable))) - (when (and s4-0 (focus-test? (the-as process-focusable s4-0) pilot-riding)) - (wvehicle-method-171 this (-> (the-as process-focusable s4-0) root trans) s5-0) - (wvehicle-method-172 this (-> (the-as process-focusable s4-0) root quat) s5-0) - ) - ) - ) - 0 - ) - ((method-of-type vehicle vehicle-method-77) this) - (none) ) + (when (logtest? (vehicle-flag player-driving net-player-driving) (-> this v-flags)) + (when (and (logtest? (-> this controls flags) (vehicle-controls-flag vcf1)) + (>= (the-as uint (- (current-time) (the-as int (-> this shoot-time)))) (-> this shoot-delay)) + ) + (set! (-> this shoot-time) (the-as uint (current-time))) + (wvehicle-method-169 this) + ) + ) + (when (logtest? (vehicle-flag player-driving) (-> this v-flags)) + (let ((v1-39 *game-info*)) + (set! (-> v1-39 health-bar-vehicle) (-> this hit-points)) + (set! (-> v1-39 race-number-turbos) (the int (-> this turbo-supply))) + (set! (-> v1-39 vehicle-turbo-ready) (-> this turbo-ready)) + ) + (new 'stack-no-clear 'vector) + (dotimes (s5-0 (-> this info rider attach-point-count)) + (let ((s4-0 (as-type (handle->process (-> this attached-array s5-0)) process-focusable))) + (when (and s4-0 (focus-test? (the-as process-focusable s4-0) pilot-riding)) + (wvehicle-method-171 this (-> (the-as process-focusable s4-0) root trans) s5-0) + (wvehicle-method-172 this (-> (the-as process-focusable s4-0) root quat) s5-0) + ) + ) + ) + 0 + ) + ((method-of-type vehicle vehicle-method-77) this) + (none) ) ;; definition for method 30 of type wvehicle 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 8e885273ad..09e9abc91f 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 @@ -5,321 +5,285 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-97 ((this hvehicle) (arg0 float) (arg1 vehicle-physics-work)) - (local-vars (v1-78 float) (v1-177 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s3-0 (-> this rbody))) - (mem-copy! (the-as pointer (-> arg1 mat)) (the-as pointer (-> s3-0 matrix)) 64) - (let* ((f28-0 (* -1.0 (-> this controls steering) (-> this info handling tire-steering-angle))) - (f30-0 (cos f28-0)) - (f0-2 (sin f28-0)) - ) - (set! (-> arg1 steering-axis x) f30-0) - (set! (-> arg1 steering-axis y) 0.0) - (set! (-> arg1 steering-axis z) f0-2) - ) - (vector-rotate*! (-> arg1 steering-axis) (-> arg1 steering-axis) (-> arg1 mat)) - (logior! (-> this v-flags) (vehicle-flag in-air)) - (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) - (vector-reset! (-> arg1 ground-normal)) - (set! (-> arg1 ground-normal y) 1.0) - (let ((f30-1 (-> this info handling ground-probe-distance))) - (let ((s2-0 (new 'stack-no-clear 'collide-query))) - (vector-reset! (-> arg1 lift-dir)) - (set! (-> arg1 lift-dir y) -1.0) - (set! (-> arg1 speed-factor) - (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) - ) - (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)) + (let ((s3-0 (-> this rbody))) + (mem-copy! (the-as pointer (-> arg1 mat)) (the-as pointer (-> s3-0 matrix)) 64) + (let* ((f28-0 (* -1.0 (-> this controls steering) (-> this info handling tire-steering-angle))) + (f30-0 (cos f28-0)) + (f0-2 (sin f28-0)) + ) + (set! (-> arg1 steering-axis x) f30-0) + (set! (-> arg1 steering-axis y) 0.0) + (set! (-> arg1 steering-axis z) f0-2) + ) + (vector-rotate*! (-> arg1 steering-axis) (-> arg1 steering-axis) (-> arg1 mat)) + (logior! (-> this v-flags) (vehicle-flag in-air)) + (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) + (vector-reset! (-> arg1 ground-normal)) + (set! (-> arg1 ground-normal y) 1.0) + (let ((f30-1 (-> this info handling ground-probe-distance))) + (let ((s2-0 (new 'stack-no-clear 'collide-query))) + (vector-reset! (-> arg1 lift-dir)) + (set! (-> arg1 lift-dir y) -1.0) + (set! (-> arg1 speed-factor) + (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) ) - (vector-normalize! (-> arg1 lift-dir) 1.0) - ) - (vector-float*! (-> s2-0 move-dist) (-> arg1 lift-dir) (the-as float f30-1)) - (let ((v1-26 s2-0)) - (set! (-> v1-26 radius) 409.6) - (set! (-> v1-26 collide-with) (collide-spec - backgnd - bot - obstacle - hit-by-player-list - hit-by-others-list - player-list - water - collectable - blocking-plane - pusher - vehicle-mesh-probeable - shield - vehicle-sphere-no-probe - ) - ) - (set! (-> v1-26 ignore-process0) #f) - (set! (-> v1-26 ignore-process1) #f) - (set! (-> v1-26 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) - (set! (-> v1-26 action-mask) (collide-action solid)) - ) - (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) - (let ((v1-29 (-> this info physics-model lift-thruster-array s1-0)) - (s0-0 (-> arg1 probe-work-array s1-0)) - ) - (vector-reset! (-> s0-0 tire-force)) - (vector-copy! (-> s0-0 local-pos) (-> v1-29 local-pos)) - (vector-copy! (-> s0-0 local-normal) (-> v1-29 rot)) - (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> arg1 mat)) - (let ((a1-9 (-> s0-0 probe-pos))) - (let ((v1-32 (-> s0-0 world-pos))) - (let ((a0-22 (-> arg1 mat uvec))) - (let ((a2-6 (-> this info handling ground-probe-offset))) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-22 quad)) - ) - (.lvf vf4 (&-> v1-32 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-9 quad) vf6) + (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)) ) - (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) - (vector-copy! (-> s0-0 wheel-axis) (the-as vector (if (< 0.0 (-> s0-0 local-pos z)) - (-> arg1 steering-axis) - (the-as vector (-> arg1 mat)) - ) - ) - ) - (vector-copy! (-> s0-0 ground-pos) (-> s0-0 probe-pos)) - (set! (-> s0-0 ground-pos y) 0.0) - (vector-reset! (-> s0-0 ground-normal)) - (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) - (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) - (let ((f0-15 (probe-using-line-sphere *collide-cache* s2-0))) - (cond - ((and (>= f0-15 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) - (logclear! (-> this v-flags) (vehicle-flag in-air)) - (logior! (-> this v-flags) (vehicle-flag on-ground)) - (set! (-> s0-0 ground-pos y) (- (-> s0-0 probe-pos y) (* f0-15 f30-1))) - (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) - (vector-copy! (-> arg1 ground-normal) (-> s0-0 ground-normal)) - ) - (else - (set! (-> s0-0 ground-pos y) (+ -81920.0 (-> s3-0 position y))) - ) + (t9-4 a0-7 a1-4 a2-3 (* f0-8 f0-8)) + ) + (vector-normalize! (-> arg1 lift-dir) 1.0) + ) + (vector-float*! (-> s2-0 move-dist) (-> arg1 lift-dir) (the-as float f30-1)) + (let ((v1-26 s2-0)) + (set! (-> v1-26 radius) 409.6) + (set! (-> v1-26 collide-with) (collide-spec + backgnd + bot + obstacle + hit-by-player-list + hit-by-others-list + player-list + water + collectable + blocking-plane + pusher + vehicle-mesh-probeable + shield + vehicle-sphere-no-probe + ) + ) + (set! (-> v1-26 ignore-process0) #f) + (set! (-> v1-26 ignore-process1) #f) + (set! (-> v1-26 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) + (set! (-> v1-26 action-mask) (collide-action solid)) + ) + (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) + (let ((v1-29 (-> this info physics-model lift-thruster-array s1-0)) + (s0-0 (-> arg1 probe-work-array s1-0)) + ) + (vector-reset! (-> s0-0 tire-force)) + (vector-copy! (-> s0-0 local-pos) (-> v1-29 local-pos)) + (vector-copy! (-> s0-0 local-normal) (-> v1-29 rot)) + (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> arg1 mat)) + (vector+*! + (-> s0-0 probe-pos) + (-> s0-0 world-pos) + (-> arg1 mat uvec) + (the-as float (-> this info handling ground-probe-offset)) + ) + (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) + (vector-copy! (-> s0-0 wheel-axis) (the-as vector (if (< 0.0 (-> s0-0 local-pos z)) + (-> arg1 steering-axis) + (the-as vector (-> arg1 mat)) + ) + ) + ) + (vector-copy! (-> s0-0 ground-pos) (-> s0-0 probe-pos)) + (set! (-> s0-0 ground-pos y) 0.0) + (vector-reset! (-> s0-0 ground-normal)) + (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) + (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) + (let ((f0-15 (probe-using-line-sphere *collide-cache* s2-0))) + (cond + ((and (>= f0-15 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) + (logclear! (-> this v-flags) (vehicle-flag in-air)) + (logior! (-> this v-flags) (vehicle-flag on-ground)) + (set! (-> s0-0 ground-pos y) (- (-> s0-0 probe-pos y) (* f0-15 f30-1))) + (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) + (vector-copy! (-> arg1 ground-normal) (-> s0-0 ground-normal)) + ) + (else + (set! (-> s0-0 ground-pos y) (+ -81920.0 (-> s3-0 position y))) ) ) - 0 ) + 0 ) ) ) - (set! (-> this lift-thrust 0) 0.0) - (set! (-> this lift-thrust 1) 0.0) - (set! (-> this lift-thrust 2) 0.0) - (set! (-> this lift-thrust 3) 0.0) - (set! (-> this roll-thrust 0) 0.0) - (set! (-> this roll-thrust 1) 0.0) - (when (>= 1 (-> this force-level)) - (dotimes (s2-1 (-> this info physics-model lift-thruster-count)) - (let ((s1-1 (-> arg1 probe-work-array s2-1))) - (vector-copy! (-> arg1 world-pos) (-> s1-1 world-pos)) - (vector-copy! (-> arg1 velocity) (-> s1-1 velocity)) - (let ((f28-1 (-> s1-1 probe-pos y))) - (when (> (-> this flight-level-index) 0) - (set! f28-1 (- f28-1 (+ 6144.0 (-> this flight-level)))) - (when (>= 0.0 f28-1) - (logclear! (-> this v-flags) (vehicle-flag in-air)) - (logior! (-> this v-flags) (vehicle-flag on-flight-level)) - (.lvf vf1 (&-> (-> s1-1 ground-normal) 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) - (if (= v1-78 0.0) - (set! (-> s1-1 ground-normal y) 1.0) - ) - ) + ) + (set! (-> this lift-thrust 0) 0.0) + (set! (-> this lift-thrust 1) 0.0) + (set! (-> this lift-thrust 2) 0.0) + (set! (-> this lift-thrust 3) 0.0) + (set! (-> this roll-thrust 0) 0.0) + (set! (-> this roll-thrust 1) 0.0) + (when (>= 1 (-> this force-level)) + (dotimes (s2-1 (-> this info physics-model lift-thruster-count)) + (let ((s1-1 (-> arg1 probe-work-array s2-1))) + (vector-copy! (-> arg1 world-pos) (-> s1-1 world-pos)) + (vector-copy! (-> arg1 velocity) (-> s1-1 velocity)) + (let ((f28-1 (-> s1-1 probe-pos y))) + (when (> (-> this flight-level-index) 0) + (set! f28-1 (- f28-1 (+ 6144.0 (-> this flight-level)))) + (when (>= 0.0 f28-1) + (logclear! (-> this v-flags) (vehicle-flag in-air)) + (logior! (-> this v-flags) (vehicle-flag on-flight-level)) + (if (= (vector-length-squared (-> s1-1 ground-normal)) 0.0) + (set! (-> s1-1 ground-normal y) 1.0) + ) ) - (when (or (logtest? (vehicle-flag flight-level-transition) (-> this v-flags)) - (and (> (-> this flight-level-index) 0) (< f28-1 0.0)) - ) - (if (zero? (-> this flight-level-index)) - (set! f28-1 40960.0) - ) - (let* ((f0-37 (* -1.0 - (-> this force-scale) - (-> this info physics-model inv-lift-thruster-count) - (-> this info info mass) - (-> this info extra gravity) - (+ 1.0 (* 2.0 (the float (-> this flight-level-index)))) - ) - ) - (f1-17 -1.0) - (f2-4 1.0) - (f3-4 16384.0) - (f3-7 (* f28-1 (/ 1.0 f3-4))) - (f4-2 0.5) - (f5-0 81920.0) - (f0-38 (* f0-37 (fmax f1-17 (fmin f2-4 (+ f3-7 (* f4-2 (/ 1.0 f5-0) (-> arg1 velocity y))))))) - ) - (let ((f1-20 (fmax 0.0 f0-38))) - (+! (-> this lift-thrust s2-1) f1-20) - (when (logtest? (vehicle-flag flight-level-transition) (-> this v-flags)) - (+! (-> this roll-thrust 0) (/ f1-20 20)) - (+! (-> this roll-thrust 1) (/ f1-20 20)) + ) + (when (or (logtest? (vehicle-flag flight-level-transition) (-> this v-flags)) + (and (> (-> this flight-level-index) 0) (< f28-1 0.0)) ) + (if (zero? (-> this flight-level-index)) + (set! f28-1 40960.0) + ) + (let* ((f0-37 (* -1.0 + (-> this force-scale) + (-> this info physics-model inv-lift-thruster-count) + (-> this info info mass) + (-> this info extra gravity) + (+ 1.0 (* 2.0 (the float (-> this flight-level-index)))) + ) + ) + (f1-17 -1.0) + (f2-4 1.0) + (f3-4 16384.0) + (f3-7 (* f28-1 (/ 1.0 f3-4))) + (f4-2 0.5) + (f5-0 81920.0) + (f0-38 (* f0-37 (fmax f1-17 (fmin f2-4 (+ f3-7 (* f4-2 (/ 1.0 f5-0) (-> arg1 velocity y))))))) + ) + (let ((f1-20 (fmax 0.0 f0-38))) + (+! (-> this lift-thrust s2-1) f1-20) + (when (logtest? (vehicle-flag flight-level-transition) (-> this v-flags)) + (+! (-> this roll-thrust 0) (/ f1-20 20)) + (+! (-> this roll-thrust 1) (/ f1-20 20)) ) - (vector-reset! (-> arg1 force)) - (set! (-> arg1 force y) f0-38) + ) + (vector-reset! (-> arg1 force)) + (set! (-> arg1 force y) f0-38) + ) + (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) + ) + (let ((f0-40 (+ 4096.0 f28-1))) + (when (or (and (logtest? (vehicle-flag flight-level-transition) (-> this v-flags)) + (< 0.0 f0-40) + (< 0.0 (-> arg1 velocity y)) + ) + (and (> (-> this flight-level-index) 0) (< f0-40 0.0) (< (-> arg1 velocity y) 0.0)) + ) + (vector-reset! (-> arg1 force)) + (let ((f0-43 (/ (-> this info physics-model inv-lift-thruster-count) -4)) + (f1-28 arg0) + ) + (set! (-> arg1 force y) (* f0-43 (/ 1.0 f1-28) (-> this info info mass) (-> arg1 velocity y))) ) (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) ) - (let ((f0-40 (+ 4096.0 f28-1))) - (when (or (and (logtest? (vehicle-flag flight-level-transition) (-> this v-flags)) - (< 0.0 f0-40) - (< 0.0 (-> arg1 velocity y)) - ) - (and (> (-> this flight-level-index) 0) (< f0-40 0.0) (< (-> arg1 velocity y) 0.0)) - ) - (vector-reset! (-> arg1 force)) - (let ((f0-43 (/ (-> this info physics-model inv-lift-thruster-count) -4)) - (f1-28 arg0) - ) - (set! (-> arg1 force y) (* f0-43 (/ 1.0 f1-28) (-> this info info mass) (-> arg1 velocity y))) - ) - (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) - (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) - ) - ) ) - (let* ((f1-36 (fmax 4096.0 (fmin (- (-> s1-1 probe-pos y) (-> s1-1 ground-pos y)) f30-1))) - (f28-2 (- 1.0 (/ (+ -4096.0 f1-36) (+ -4096.0 f30-1)))) - ) - (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s1-1 ground-normal) (-> arg1 mat uvec))) - (set! f28-2 0.0) + ) + (let* ((f1-36 (fmax 4096.0 (fmin (- (-> s1-1 probe-pos y) (-> s1-1 ground-pos y)) f30-1))) + (f28-2 (- 1.0 (/ (+ -4096.0 f1-36) (+ -4096.0 f30-1)))) + ) + (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s1-1 ground-normal) (-> arg1 mat uvec))) + (set! f28-2 0.0) + ) + (set! (-> arg1 tmp y) 0.0) + (set! (-> arg1 tmp x) (-> arg1 velocity z)) + (set! (-> arg1 tmp z) (- (-> arg1 velocity x))) + (vector-normalize! (-> arg1 tmp) 1.0) + (vector+float*! + (-> arg1 normal) + (-> s1-1 ground-normal) + (-> arg1 tmp) + (- (vector-dot (-> s1-1 ground-normal) (-> arg1 tmp))) + ) + (let ((v1-150 (-> arg1 force)) + (a0-55 (-> arg1 normal)) + (f0-58 (* 2.0 f28-2)) + (f1-41 arg0) ) - (set! (-> arg1 tmp y) 0.0) - (set! (-> arg1 tmp x) (-> arg1 velocity z)) - (set! (-> arg1 tmp z) (- (-> arg1 velocity x))) - (vector-normalize! (-> arg1 tmp) 1.0) - (vector+float*! - (-> arg1 normal) - (-> s1-1 ground-normal) - (-> arg1 tmp) - (- (vector-dot (-> s1-1 ground-normal) (-> arg1 tmp))) - ) - (let ((v1-150 (-> arg1 force)) - (a0-55 (-> arg1 normal)) - (f0-58 (* 2.0 f28-2)) - (f1-41 arg0) - ) - (vector-float*! v1-150 a0-55 (* f0-58 - (/ 1.0 f1-41) - (-> this info physics-model inv-lift-thruster-count) - (-> this info info mass) - (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> arg1 normal)))) - ) - ) - ) - (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) - (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) - (let ((f0-72 (* 8.0 - (-> this info info mass) - (-> this info extra gravity) - (-> this info physics-model inv-lift-thruster-count) - (+ (* (-> this info handling spring-lift-factor) f28-2) - (* 0.75 (-> this jump-thrust) (-> this info handling jump-thrust-factor)) - ) - (- (+ 1.0 (* 2.0 (rand-vu) (-> this power-fluctuation-factor))) (-> this power-fluctuation-factor)) + (vector-float*! v1-150 a0-55 (* f0-58 + (/ 1.0 f1-41) + (-> this info physics-model inv-lift-thruster-count) + (-> this info info mass) + (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> arg1 normal)))) + ) ) - ) - ) - (+! (-> this lift-thrust s2-1) f0-72) - (vector-float*! (-> arg1 force) (-> arg1 lift-dir) (* -1.0 f0-72)) - ) ) (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) - (when (and (< 0.0 (-> this info handling tire-friction-factor)) (let ((f0-75 0.0)) - (.lvf vf1 (&-> (-> s1-1 ground-normal) 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-177 vf1) - (< f0-75 v1-177) - ) - ) - (vector+float*! - (-> arg1 normal) - (-> s1-1 wheel-axis) - (-> s1-1 ground-normal) - (- (vector-dot (-> s1-1 wheel-axis) (-> s1-1 ground-normal))) - ) - (vector-normalize! (-> arg1 normal) 1.0) - (vector-copy! (-> arg1 world-pos) (-> s3-0 position)) - (vector-copy! (-> arg1 velocity) (-> s3-0 lin-velocity)) - (vector-! (-> arg1 p-body) (-> arg1 world-pos) (-> s3-0 position)) - (vector-cross! (-> arg1 tmp) (-> arg1 p-body) (-> arg1 normal)) - (vector-rotate*! (-> arg1 tmp) (-> arg1 tmp) (-> s3-0 inv-i-world)) - (vector-cross! (-> arg1 tmp) (-> arg1 tmp) (-> arg1 p-body)) - (set! (-> arg1 vel-dot-norm) (vector-dot (-> arg1 velocity) (-> arg1 normal))) - (let ((f0-82 (fabs (-> arg1 vel-dot-norm)))) - (set! (-> arg1 friction-coef) - (smooth-interp - (-> this info handling tire-static-friction) - (-> this info handling tire-dynamic-friction) - f0-82 - (-> this info handling tire-static-friction-speed) - (-> this info handling tire-dynamic-friction-speed) - ) - ) - ) - (set! (-> arg1 friction-coef) - (* (-> arg1 friction-coef) (+ 1.0 (* -0.75 (fmax 0.0 (fmin 1.0 (-> this engine-thrust)))))) - ) - (let ((f0-90 (* (-> arg1 friction-coef) - (-> this info handling tire-friction-factor) - (fmax 0.0 (vector-dot (-> s1-1 ground-normal) (-> s1-1 tire-force))) - ) - ) - ) - (set! (-> arg1 impulse) (/ (/ (-> arg1 vel-dot-norm) -2) - (* arg0 (+ (-> s3-0 info inv-mass) (vector-dot (-> arg1 normal) (-> arg1 tmp)))) - ) - ) - (set! (-> arg1 impulse) (fmax (fmin (-> arg1 impulse) f0-90) (- f0-90))) - ) - (vector-float*! (-> arg1 force) (-> arg1 normal) (-> arg1 impulse)) - (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + (let ((f0-72 (* 8.0 + (-> this info info mass) + (-> this info extra gravity) + (-> this info physics-model inv-lift-thruster-count) + (+ (* (-> this info handling spring-lift-factor) f28-2) + (* 0.75 (-> this jump-thrust) (-> this info handling jump-thrust-factor)) + ) + (- (+ 1.0 (* 2.0 (rand-vu) (-> this power-fluctuation-factor))) (-> this power-fluctuation-factor)) + ) + ) + ) + (+! (-> this lift-thrust s2-1) f0-72) + (vector-float*! (-> arg1 force) (-> arg1 lift-dir) (* -1.0 f0-72)) ) ) + (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) + (when (and (< 0.0 (-> this info handling tire-friction-factor)) + (< 0.0 (vector-length-squared (-> s1-1 ground-normal))) + ) + (vector+float*! + (-> arg1 normal) + (-> s1-1 wheel-axis) + (-> s1-1 ground-normal) + (- (vector-dot (-> s1-1 wheel-axis) (-> s1-1 ground-normal))) + ) + (vector-normalize! (-> arg1 normal) 1.0) + (vector-copy! (-> arg1 world-pos) (-> s3-0 position)) + (vector-copy! (-> arg1 velocity) (-> s3-0 lin-velocity)) + (vector-! (-> arg1 p-body) (-> arg1 world-pos) (-> s3-0 position)) + (vector-cross! (-> arg1 tmp) (-> arg1 p-body) (-> arg1 normal)) + (vector-rotate*! (-> arg1 tmp) (-> arg1 tmp) (-> s3-0 inv-i-world)) + (vector-cross! (-> arg1 tmp) (-> arg1 tmp) (-> arg1 p-body)) + (set! (-> arg1 vel-dot-norm) (vector-dot (-> arg1 velocity) (-> arg1 normal))) + (let ((f0-82 (fabs (-> arg1 vel-dot-norm)))) + (set! (-> arg1 friction-coef) + (smooth-interp + (-> this info handling tire-static-friction) + (-> this info handling tire-dynamic-friction) + f0-82 + (-> this info handling tire-static-friction-speed) + (-> this info handling tire-dynamic-friction-speed) + ) + ) + ) + (set! (-> arg1 friction-coef) + (* (-> arg1 friction-coef) (+ 1.0 (* -0.75 (fmax 0.0 (fmin 1.0 (-> this engine-thrust)))))) + ) + (let ((f0-90 (* (-> arg1 friction-coef) + (-> this info handling tire-friction-factor) + (fmax 0.0 (vector-dot (-> s1-1 ground-normal) (-> s1-1 tire-force))) + ) + ) + ) + (set! (-> arg1 impulse) (/ (/ (-> arg1 vel-dot-norm) -2) + (* arg0 (+ (-> s3-0 info inv-mass) (vector-dot (-> arg1 normal) (-> arg1 tmp)))) + ) + ) + (set! (-> arg1 impulse) (fmax (fmin (-> arg1 impulse) f0-90) (- f0-90))) + ) + (vector-float*! (-> arg1 force) (-> arg1 normal) (-> arg1 impulse)) + (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 31 of type hvehicle 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 5278b76cff..4cd6b8bb0b 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,177 +5,146 @@ ;; 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 - (v1-24 float) - (v1-87 float) - (a0-35 float) - (a0-95 int) - (a0-97 int) - (sv-16 vector) - (sv-20 float) - (sv-24 float) - ) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) + (local-vars (a0-95 int) (a0-97 int) (sv-16 vector) (sv-20 float) (sv-24 float)) + (let* ((v1-1 (-> *perf-stats* data 21)) + (a0-1 (-> v1-1 ctrl)) ) - (init-vf0-vector) - (let* ((v1-1 (-> *perf-stats* data 21)) - (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) - ) + (+! (-> v1-1 count) 1) + (b! (zero? a0-1) cfg-2 :delay (nop!)) + (.mtc0 Perf 0) (.sync.l) (.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))) - (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)) - (vector-z-quaternion! (-> gp-0 mat trans) (-> arg2 root quat)) - (vector-reset! (-> gp-0 mat fvec)) - (cond - ((logtest? (-> this flags) (vehicle-controller-flag on-straightaway)) - (vector-! (-> gp-0 world-pos) (-> this turn-enter-point) (-> gp-0 mat rvec)) - (let ((f0-5 (vector-dot (-> gp-0 world-pos) (-> this turn-enter-dir)))) - (vector+float*! (-> gp-0 force) (-> this turn-enter-point) (-> this turn-enter-dir) (- f0-5)) - (vector-copy! (-> gp-0 velocity) (-> this turn-enter-dir)) - (if (>= 0.0 f0-5) - (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))))) - (.lvf vf1 (&-> arg1 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-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 dir x) (fmin (-> gp-0 dir x) (-> this max-turn-speed))) - ) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf a0-1) + ) + (.sync.l) + (.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))) + (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)) + (vector-z-quaternion! (-> gp-0 mat trans) (-> arg2 root quat)) + (vector-reset! (-> gp-0 mat fvec)) + (cond + ((logtest? (-> this flags) (vehicle-controller-flag on-straightaway)) + (vector-! (-> gp-0 world-pos) (-> this turn-enter-point) (-> gp-0 mat rvec)) + (let ((f0-5 (vector-dot (-> gp-0 world-pos) (-> this turn-enter-dir)))) + (vector+float*! (-> gp-0 force) (-> this turn-enter-point) (-> this turn-enter-dir) (- f0-5)) + (vector-copy! (-> gp-0 velocity) (-> this turn-enter-dir)) + (if (>= 0.0 f0-5) + (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))) ) - ) ) ) ) - (else - (if (not (logtest? (-> this flags) (vehicle-controller-flag no-slowing-for-turns))) - (set! (-> gp-0 dir x) (fmin (-> gp-0 dir x) (-> this max-turn-speed))) - ) - (vector-! (-> gp-0 world-pos) (-> gp-0 mat rvec) (-> this dest-circle)) - (vector-normalize! (-> gp-0 world-pos) 1.0) - (set! (-> gp-0 velocity x) (- (-> gp-0 world-pos z))) - (set! (-> gp-0 velocity y) 0.0) - (set! (-> gp-0 velocity z) (-> gp-0 world-pos x)) - (if (logtest? (-> this flags) (vehicle-controller-flag left-turn)) - (vector-float*! (-> gp-0 velocity) (-> gp-0 velocity) -1.0) - ) - (vector-float*! (-> gp-0 world-pos) (-> gp-0 world-pos) (-> this dest-circle w)) - (vector+! (-> gp-0 force) (-> this dest-circle) (-> gp-0 world-pos)) - (when (logtest? (-> this flags) (vehicle-controller-flag attached)) - (vector-! (-> gp-0 steering-axis) (-> this turn-exit-point) (-> gp-0 mat rvec)) - (when (and (< (vector-dot (-> this turn-exit-dir) (-> gp-0 steering-axis)) 0.0) - (>= (vector-dot (-> this turn-exit-dir) (-> gp-0 mat trans)) (cos 8192.0)) - ) - (if (not (vehicle-controller-method-14 this arg2)) - (set! (-> gp-0 dir x) 0.0) - ) - ) + ) + (else + (if (not (logtest? (-> this flags) (vehicle-controller-flag no-slowing-for-turns))) + (set! (-> gp-0 dir x) (fmin (-> gp-0 dir x) (-> this max-turn-speed))) + ) + (vector-! (-> gp-0 world-pos) (-> gp-0 mat rvec) (-> this dest-circle)) + (vector-normalize! (-> gp-0 world-pos) 1.0) + (set! (-> gp-0 velocity x) (- (-> gp-0 world-pos z))) + (set! (-> gp-0 velocity y) 0.0) + (set! (-> gp-0 velocity z) (-> gp-0 world-pos x)) + (if (logtest? (-> this flags) (vehicle-controller-flag left-turn)) + (vector-float*! (-> gp-0 velocity) (-> gp-0 velocity) -1.0) + ) + (vector-float*! (-> gp-0 world-pos) (-> gp-0 world-pos) (-> this dest-circle w)) + (vector+! (-> gp-0 force) (-> this dest-circle) (-> gp-0 world-pos)) + (when (logtest? (-> this flags) (vehicle-controller-flag attached)) + (vector-! (-> gp-0 steering-axis) (-> this turn-exit-point) (-> gp-0 mat rvec)) + (when (and (< (vector-dot (-> this turn-exit-dir) (-> gp-0 steering-axis)) 0.0) + (>= (vector-dot (-> this turn-exit-dir) (-> gp-0 mat trans)) (cos 8192.0)) + ) + (if (not (vehicle-controller-method-14 this arg2)) + (set! (-> gp-0 dir x) 0.0) + ) ) ) ) - (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)) - ) + ) + (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)) ) - (let ((s3-1 (new 'stack-no-clear 'array 'collide-shape 10)) - (f30-1 (-> arg2 root root-prim prim-core world-sphere w)) - ) - (countdown (s4-1 (fill-actor-list-for-sphere - (-> this traffic object-hash) - (-> gp-0 mat rvec) - (-> gp-0 mat uvec) - (* 1.5 f30-1) - s3-1 - 10 - (-> arg2 traffic-hash-id) - ) + ) + (let ((s3-1 (new 'stack-no-clear 'array 'collide-shape 10)) + (f30-1 (-> arg2 root root-prim prim-core world-sphere w)) + ) + (countdown (s4-1 (fill-actor-list-for-sphere + (-> this traffic object-hash) + (-> gp-0 mat rvec) + (-> gp-0 mat uvec) + (* 1.5 f30-1) + s3-1 + 10 + (-> arg2 traffic-hash-id) ) - (let ((v1-70 (as-type (-> s3-1 s4-1) hvehicle))) - (when (and v1-70 (not (logtest? (-> v1-70 v-flags) (vehicle-flag dead))) (nonzero? (-> v1-70 flight-level-index))) - (vector-copy! (-> gp-0 lift-dir) (-> v1-70 root trans)) - (vector-copy! (-> gp-0 normal) (-> v1-70 root transv)) - (vector-! (-> gp-0 tmp) (-> gp-0 mat rvec) (-> gp-0 lift-dir)) - (.lvf vf1 (&-> (-> gp-0 tmp) 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-35 vf1) - (let ((f1-12 a0-35)) - (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 ((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)) - (vector-! (-> gp-0 p-body) (-> gp-0 mat uvec) (-> gp-0 normal)) - (let ((f1-14 (vector-dot (-> gp-0 axis) (-> gp-0 p-body)))) - (when (< f1-14 0.0) - (vector-float*! - (-> gp-0 world-pos) - (-> gp-0 axis) - (* -0.5 (/ sv-24 (+ sv-24 (-> v1-70 info info inv-mass))) sv-20 f1-14) - ) - (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) + ) + (let ((v1-70 (as-type (-> s3-1 s4-1) hvehicle))) + (when (and v1-70 (not (logtest? (-> v1-70 v-flags) (vehicle-flag dead))) (nonzero? (-> v1-70 flight-level-index))) + (vector-copy! (-> gp-0 lift-dir) (-> v1-70 root trans)) + (vector-copy! (-> gp-0 normal) (-> v1-70 root transv)) + (vector-! (-> gp-0 tmp) (-> gp-0 mat rvec) (-> gp-0 lift-dir)) + (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 ((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)) + (vector-! (-> gp-0 p-body) (-> gp-0 mat uvec) (-> gp-0 normal)) + (let ((f1-14 (vector-dot (-> gp-0 axis) (-> gp-0 p-body)))) + (when (< f1-14 0.0) + (vector-float*! + (-> gp-0 world-pos) + (-> gp-0 axis) + (* -0.5 (/ sv-24 (+ sv-24 (-> v1-70 info info inv-mass))) sv-20 f1-14) ) + (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) ) ) - (vector-float*! (-> gp-0 world-pos) (-> gp-0 axis) (* 163840.0 f0-31)) - (set! (-> gp-0 world-pos y) 0.0) - (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) ) + (vector-float*! (-> gp-0 world-pos) (-> gp-0 axis) (* 163840.0 f0-31)) + (set! (-> gp-0 world-pos y) 0.0) + (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) ) - (when (< (cos 8192.0) (- (vector-dot (-> gp-0 mat trans) (-> gp-0 axis)))) - (when (< (nearest-dist2-between-moving-points - (-> gp-0 mat rvec) - (-> gp-0 mat uvec) - (-> gp-0 lift-dir) - (-> gp-0 normal) - 2.0 - ) - f28-0 + ) + (when (< (cos 8192.0) (- (vector-dot (-> gp-0 mat trans) (-> gp-0 axis)))) + (when (< (nearest-dist2-between-moving-points + (-> gp-0 mat rvec) + (-> gp-0 mat uvec) + (-> gp-0 lift-dir) + (-> gp-0 normal) + 2.0 ) - (let ((f0-37 (fmax 0.0 (vector-dot (-> gp-0 mat trans) (-> gp-0 normal))))) - (set! (-> gp-0 dir x) (fmin (-> gp-0 dir x) f0-37)) - ) + f28-0 + ) + (let ((f0-37 (fmax 0.0 (vector-dot (-> gp-0 mat trans) (-> gp-0 normal))))) + (set! (-> gp-0 dir x) (fmin (-> gp-0 dir x) f0-37)) ) ) ) @@ -186,101 +155,94 @@ ) ) ) - (when (not (logtest? (-> this flags) (vehicle-controller-flag ignore-others))) - (vector-! (-> gp-0 world-pos) (-> gp-0 force) (-> gp-0 mat rvec)) - (.lvf vf1 (&-> (-> gp-0 world-pos) 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-87 vf1) - (let ((f0-39 v1-87)) - (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 (not (logtest? (-> this flags) (vehicle-controller-flag ignore-others))) + (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)) ) ) - (vector+float*! - (-> gp-0 world-pos) - (-> gp-0 mat uvec) - (-> gp-0 velocity) - (- (vector-dot (-> gp-0 velocity) (-> gp-0 mat uvec))) - ) - (vector-! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) ) - (cond - ((logtest? (-> this flags) (vehicle-controller-flag direct-mode)) - (vector-! (-> gp-0 world-normal) (-> this turn-exit-point) (-> gp-0 mat rvec)) - (vector-normalize! (-> gp-0 world-normal) (-> gp-0 dir x)) - (vector-! (-> gp-0 world-pos) (-> gp-0 world-normal) (-> gp-0 mat uvec)) - (vector-float*! (-> gp-0 world-pos) (-> gp-0 world-pos) 3.0) - (let ((f0-48 (vector-dot (-> gp-0 mat trans) (-> gp-0 world-pos)))) - (if (< f0-48 0.0) - (vector+float*! (-> gp-0 world-pos) (-> gp-0 world-pos) (-> gp-0 mat trans) (* -0.875 f0-48)) + (vector+float*! + (-> gp-0 world-pos) + (-> gp-0 mat uvec) + (-> gp-0 velocity) + (- (vector-dot (-> gp-0 velocity) (-> gp-0 mat uvec))) + ) + (vector-! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) + ) + (cond + ((logtest? (-> this flags) (vehicle-controller-flag direct-mode)) + (vector-! (-> gp-0 world-normal) (-> this turn-exit-point) (-> gp-0 mat rvec)) + (vector-normalize! (-> gp-0 world-normal) (-> gp-0 dir x)) + (vector-! (-> gp-0 world-pos) (-> gp-0 world-normal) (-> gp-0 mat uvec)) + (vector-float*! (-> gp-0 world-pos) (-> gp-0 world-pos) 3.0) + (let ((f0-48 (vector-dot (-> gp-0 mat trans) (-> gp-0 world-pos)))) + (if (< f0-48 0.0) + (vector+float*! (-> gp-0 world-pos) (-> gp-0 world-pos) (-> gp-0 mat trans) (* -0.875 f0-48)) + ) + ) + ) + (else + (vector+float*! (-> gp-0 local-pos) (-> gp-0 mat rvec) (-> gp-0 mat uvec) 0.4) + (vector-! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> this turn-enter-point)) + (cond + ((< (vector-dot (-> gp-0 world-pos) (-> this turn-enter-dir)) 0.0) + (vector-! (-> gp-0 world-normal) (-> this turn-enter-point) (-> gp-0 mat rvec)) + ) + ((begin + (vector-! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> this turn-exit-point)) + (< (vector-dot (-> gp-0 world-pos) (-> this turn-exit-dir)) 0.0) + ) + (vector-! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> this dest-circle)) + (set! (-> gp-0 world-normal x) (- (-> gp-0 world-pos z))) + (set! (-> gp-0 world-normal y) 0.0) + (set! (-> gp-0 world-normal z) (-> gp-0 world-pos x)) + (if (logtest? (-> this flags) (vehicle-controller-flag left-turn)) + (vector-float*! (-> gp-0 world-normal) (-> gp-0 world-normal) -1.0) ) ) - ) - (else - (vector+float*! (-> gp-0 local-pos) (-> gp-0 mat rvec) (-> gp-0 mat uvec) 0.4) - (vector-! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> this turn-enter-point)) - (cond - ((< (vector-dot (-> gp-0 world-pos) (-> this turn-enter-dir)) 0.0) - (vector-! (-> gp-0 world-normal) (-> this turn-enter-point) (-> gp-0 mat rvec)) - ) - ((begin - (vector-! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> this turn-exit-point)) - (< (vector-dot (-> gp-0 world-pos) (-> this turn-exit-dir)) 0.0) - ) - (vector-! (-> gp-0 world-pos) (-> gp-0 local-pos) (-> this dest-circle)) - (set! (-> gp-0 world-normal x) (- (-> gp-0 world-pos z))) - (set! (-> gp-0 world-normal y) 0.0) - (set! (-> gp-0 world-normal z) (-> gp-0 world-pos x)) - (if (logtest? (-> this flags) (vehicle-controller-flag left-turn)) - (vector-float*! (-> gp-0 world-normal) (-> gp-0 world-normal) -1.0) - ) - ) - (else - (vector-copy! (-> gp-0 world-normal) (-> this turn-exit-dir)) - ) + (else + (vector-copy! (-> gp-0 world-normal) (-> this turn-exit-dir)) ) - (let ((f0-60 (vector-length (-> gp-0 world-normal)))) - (if (< 0.1 f0-60) - (vector-float*! (-> gp-0 world-normal) (-> gp-0 world-normal) (/ (-> gp-0 dir x) f0-60)) - ) - ) - (vector-! (-> gp-0 world-pos) (-> gp-0 world-normal) (-> gp-0 mat uvec)) - (vector-float*! (-> gp-0 world-pos) (-> gp-0 world-pos) 2.0) ) + (let ((f0-60 (vector-length (-> gp-0 world-normal)))) + (if (< 0.1 f0-60) + (vector-float*! (-> gp-0 world-normal) (-> gp-0 world-normal) (/ (-> gp-0 dir x) f0-60)) + ) + ) + (vector-! (-> gp-0 world-pos) (-> gp-0 world-normal) (-> gp-0 mat uvec)) + (vector-float*! (-> gp-0 world-pos) (-> gp-0 world-pos) 2.0) ) - (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) - (vector-copy! sv-16 (-> gp-0 mat fvec)) ) - (let ((v1-144 (-> *perf-stats* data 21))) - (b! (zero? (-> v1-144 ctrl)) cfg-76 :delay (nop!)) - (.mtc0 Perf 0) - (.sync.l) - (.sync.p) - (.mfpc a0-95 pcr0) - (+! (-> v1-144 accum0) a0-95) - (.mfpc a0-97 pcr1) - (+! (-> v1-144 accum1) a0-97) - ) - (label cfg-76) - 0 - 0 - (none) + (vector+! (-> gp-0 mat fvec) (-> gp-0 mat fvec) (-> gp-0 world-pos)) + (vector-copy! sv-16 (-> gp-0 mat fvec)) ) + (let ((v1-144 (-> *perf-stats* data 21))) + (b! (zero? (-> v1-144 ctrl)) cfg-76 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-95 pcr0) + (+! (-> v1-144 accum0) a0-95) + (.mfpc a0-97 pcr1) + (+! (-> v1-144 accum1) a0-97) + ) + (label cfg-76) + 0 + 0 + (none) ) ;; definition for method 12 of type vehicle-controller 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 77ca2a31ca..102b9801d8 100644 --- a/test/decompiler/reference/jak3/levels/factory/car/hvehicle_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/car/hvehicle_REF.gc @@ -129,74 +129,44 @@ ;; definition for method 103 of type hvehicle ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-103 ((this hvehicle)) - (local-vars (v1-13 float) (v1-25 float) (v1-30 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)) - (cond - ((logtest? (vehicle-flag ai-driving) (-> this v-flags)) - (when (and (not (logtest? (-> this controller flags) (vehicle-controller-flag off-path))) - (>= (-> this rbody matrix uvec y) (cos 910.2222)) - ) - (.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-13 vf1) - (let ((f0-1 v1-13) - (f1-0 0.5) - ) - (if (< f0-1 (* f1-0 f1-0)) - (logclear! (-> this v-flags) (vehicle-flag disturbed)) - ) - ) + (when (time-elapsed? (-> this disturbed-time) (seconds 2)) + (cond + ((logtest? (vehicle-flag ai-driving) (-> this v-flags)) + (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)) + ) ) ) - (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))) - ) - (.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-25 vf1) - (when (and (< v1-25 f0-4) (begin - (.lvf vf1 (&-> (-> this rbody lin-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-30 vf1) - (let ((f1-7 v1-30) - (f2-0 614.4) - ) - (< f1-7 (* f0-4 (* f2-0 f2-0))) - ) - ) + ) + (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))) + ) + (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))) ) - (logclear! (-> this v-flags) (vehicle-flag disturbed)) - (vehicle-method-142 this) - ) + ) + (logclear! (-> this v-flags) (vehicle-flag disturbed)) + (vehicle-method-142 this) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 101 of type hvehicle @@ -548,95 +518,71 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-94 ((this hvehicle)) - (local-vars (v1-14 float) (v1-24 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((f0-0 (the-as number -4096000.0))) - (dotimes (v1-1 (-> *level* length)) - (let ((a0-4 (-> *level* level v1-1))) - (when (= (-> a0-4 status) 'active) - (let ((a0-6 (-> a0-4 bsp city-level-info))) - (when (nonzero? a0-6) - (let ((f1-0 (the-as float (-> a0-6 camera-ceiling)))) - (if (= (the-as meters f1-0) 0.0) - (set! f1-0 40960000.0) - ) - (set! f0-0 (fmax (the-as float f0-0) f1-0)) - ) + (let ((f0-0 (the-as number -4096000.0))) + (dotimes (v1-1 (-> *level* length)) + (let ((a0-4 (-> *level* level v1-1))) + (when (= (-> a0-4 status) 'active) + (let ((a0-6 (-> a0-4 bsp city-level-info))) + (when (nonzero? a0-6) + (let ((f1-0 (the-as float (-> a0-6 camera-ceiling)))) + (if (= (the-as meters f1-0) 0.0) + (set! f1-0 40960000.0) + ) + (set! f0-0 (fmax (the-as float f0-0) f1-0)) ) ) ) ) ) - (if (>= -4096000.0 (the-as float f0-0)) - (set! f0-0 40960000.0) - ) - (set-setting! 'string-camera-ceiling 'abs (the-as float f0-0) 0) ) - (cond - ((logtest? (vehicle-flag camera-rapid-tracking-mode) (-> this v-flags)) - (.lvf vf1 (&-> (-> this 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 v1-14 vf1) - (let ((f0-1 v1-14) - (f1-2 122880.0) - ) - (if (< f0-1 (* f1-2 f1-2)) - (vehicle-method-87 this) - ) - ) - ) - (else - (let* ((f0-2 143360.0) - (f0-4 (* f0-2 f0-2)) - ) - (.lvf vf1 (&-> (-> this 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 v1-24 vf1) - (if (< f0-4 v1-24) - (vehicle-method-86 this) - ) - ) + (if (>= -4096000.0 (the-as float f0-0)) + (set! f0-0 40960000.0) ) - ) - (let ((t9-3 (method-of-type vehicle vehicle-method-94))) - (t9-3 this) - ) - (when *target* - (let ((v1-31 (math-camera-matrix)) - (a0-17 (new 'stack-no-clear 'matrix)) - ) - (vector-copy! (-> a0-17 uvec) (-> *target* alt-cam-pos)) - (vector-! (-> a0-17 rvec) (-> a0-17 uvec) (-> v1-31 trans)) - (let ((f0-7 (/ (vector-dot (-> a0-17 rvec) (-> v1-31 uvec)) (vector-dot (-> a0-17 rvec) (-> v1-31 fvec))))) - (cond - ((and (< f0-7 0.15) (< -0.5 f0-7)) - (set-setting! 'vertical-follow-matches-camera #f 0.0 0) - ) - (else - (if (< (fabs (-> this root transv y)) 8192.0) - (remove-setting! 'vertical-follow-matches-camera) - ) - ) - ) - ) - ) - ) - 0 - (none) + (set-setting! 'string-camera-ceiling 'abs (the-as float f0-0) 0) ) + (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) + ) + ) + ) + (else + (let ((f0-2 143360.0)) + (if (< (* f0-2 f0-2) (vector-length-squared (-> this root transv))) + (vehicle-method-86 this) + ) + ) + ) + ) + (let ((t9-3 (method-of-type vehicle vehicle-method-94))) + (t9-3 this) + ) + (when *target* + (let ((v1-31 (math-camera-matrix)) + (a0-17 (new 'stack-no-clear 'matrix)) + ) + (vector-copy! (-> a0-17 uvec) (-> *target* alt-cam-pos)) + (vector-! (-> a0-17 rvec) (-> a0-17 uvec) (-> v1-31 trans)) + (let ((f0-7 (/ (vector-dot (-> a0-17 rvec) (-> v1-31 uvec)) (vector-dot (-> a0-17 rvec) (-> v1-31 fvec))))) + (cond + ((and (< f0-7 0.15) (< -0.5 f0-7)) + (set-setting! 'vertical-follow-matches-camera #f 0.0 0) + ) + (else + (if (< (fabs (-> this root transv y)) 8192.0) + (remove-setting! 'vertical-follow-matches-camera) + ) + ) + ) + ) + ) + ) + 0 + (none) ) ;; definition for method 93 of type hvehicle diff --git a/test/decompiler/reference/jak3/levels/factory/fac-gunturret_REF.gc b/test/decompiler/reference/jak3/levels/factory/fac-gunturret_REF.gc index 73207d93a7..b497c156b8 100644 --- a/test/decompiler/reference/jak3/levels/factory/fac-gunturret_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/fac-gunturret_REF.gc @@ -813,73 +813,24 @@ ;; definition for method 160 of type fac-gunturret ;; WARN: Return type mismatch (pointer process) vs (pointer joint-exploder). (defmethod go-explode ((this fac-gunturret)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (sound-play "explosion") - (let ((v1-2 (-> s5-0 fountain-rand-transv-lo))) - (let ((a0-5 (-> this root trans))) - (let ((a1-2 *up-vector*)) - (let ((a2-3 2048.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a1-2 quad)) - ) - (.lvf vf4 (&-> a0-5 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-2 quad) vf6) - ) - (vector-float*! s4-0 *up-vector* (* 4096.0 (rand-vu-float-range 20.0 30.0))) - (let ((a1-4 (-> s5-0 fountain-rand-transv-lo))) - (let ((v1-4 s4-0)) - (let ((a0-7 *identity-vector*)) - (let ((a2-5 -204800.0)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-7 quad)) - ) - (.lvf vf4 (&-> v1-4 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-4 quad) vf6) - ) - (let ((a0-8 (-> s5-0 fountain-rand-transv-hi))) - (let ((v1-5 *identity-vector*)) - (let ((a1-6 204800.0)) - (.mov vf7 a1-6) - ) - (.lvf vf5 (&-> v1-5 quad)) - ) - (.lvf vf4 (&-> s4-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-8 quad) vf6) - ) - ) - (set! (-> s5-0 gravity) -122880.0) - (process-spawn - joint-exploder - (-> this params explode-sg) - 9 - s5-0 - *fac-gunturret-exploder-params* - :name "joint-exploder" - :to this - :unk 0 - ) + (let ((s5-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (sound-play "explosion") + (vector+*! (-> s5-0 fountain-rand-transv-lo) (-> this root trans) *up-vector* 2048.0) + (vector-float*! s4-0 *up-vector* (* 4096.0 (rand-vu-float-range 20.0 30.0))) + (vector+*! (-> s5-0 fountain-rand-transv-lo) s4-0 *identity-vector* -204800.0) + (vector+*! (-> s5-0 fountain-rand-transv-hi) s4-0 *identity-vector* 204800.0) + ) + (set! (-> s5-0 gravity) -122880.0) + (process-spawn + joint-exploder + (-> this params explode-sg) + 9 + s5-0 + *fac-gunturret-exploder-params* + :name "joint-exploder" + :to this + :unk 0 ) ) ) diff --git a/test/decompiler/reference/jak3/levels/factory/fac-robotank_REF.gc b/test/decompiler/reference/jak3/levels/factory/fac-robotank_REF.gc index 1a1e5ce3df..fd4dcc13f2 100644 --- a/test/decompiler/reference/jak3/levels/factory/fac-robotank_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/fac-robotank_REF.gc @@ -665,84 +665,35 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch (pointer process) vs (pointer joint-exploder). (defmethod go-explode ((this fac-robotank)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (sound-play "tank-explode") - (cond - ((logtest? (-> *part-group-id-table* 732 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) (-> this root trans)) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 732)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) (-> this root trans)) - (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 732)) - ) + (sound-play "tank-explode") + (cond + ((logtest? (-> *part-group-id-table* 732 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) (-> this root trans)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 732)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) (-> this root trans)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 732)) ) - (let ((s5-3 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((v1-34 (new 'stack-no-clear 'vector))) - (let ((a0-17 (-> s5-3 fountain-rand-transv-lo))) - (let ((a1-9 (-> this root trans))) - (let ((a2-12 *up-vector*)) - (let ((a3-6 2048.0)) - (.mov vf7 a3-6) - ) - (.lvf vf5 (&-> a2-12 quad)) - ) - (.lvf vf4 (&-> a1-9 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-17 quad) vf6) - ) - (vector-float*! v1-34 *up-vector* 81920.0) - (let ((a2-14 (-> s5-3 fountain-rand-transv-lo))) - (let ((a0-20 v1-34)) - (let ((a1-11 *identity-vector*)) - (let ((a3-8 -40960.0)) - (.mov vf7 a3-8) - ) - (.lvf vf5 (&-> a1-11 quad)) - ) - (.lvf vf4 (&-> a0-20 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-14 quad) vf6) - ) - (let ((a1-12 (-> s5-3 fountain-rand-transv-hi))) - (let ((a0-21 *identity-vector*)) - (let ((a2-16 40960.0)) - (.mov vf7 a2-16) - ) - (.lvf vf5 (&-> a0-21 quad)) - ) - (.lvf vf4 (&-> v1-34 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) - ) - ) - (set! (-> s5-3 gravity) -122880.0) - (set! (-> s5-3 rot-speed) 16.0) - (process-spawn - joint-exploder - (art-group-get-by-name *level* "skel-fac-robotank-explode" (the-as (pointer level) #f)) - 9 - s5-3 - *fac-robotank-exploder-params* - :name "joint-exploder" - :to this - :unk 0 - ) + ) + (let ((s5-3 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((v1-34 (new 'stack-no-clear 'vector))) + (vector+*! (-> s5-3 fountain-rand-transv-lo) (-> this root trans) *up-vector* 2048.0) + (vector-float*! v1-34 *up-vector* 81920.0) + (vector+*! (-> s5-3 fountain-rand-transv-lo) v1-34 *identity-vector* -40960.0) + (vector+*! (-> s5-3 fountain-rand-transv-hi) v1-34 *identity-vector* 40960.0) + ) + (set! (-> s5-3 gravity) -122880.0) + (set! (-> s5-3 rot-speed) 16.0) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-fac-robotank-explode" (the-as (pointer level) #f)) + 9 + s5-3 + *fac-robotank-exploder-params* + :name "joint-exploder" + :to this + :unk 0 ) ) ) diff --git a/test/decompiler/reference/jak3/levels/factory/fac-tower_REF.gc b/test/decompiler/reference/jak3/levels/factory/fac-tower_REF.gc index bd7a4b4643..3920952ca1 100644 --- a/test/decompiler/reference/jak3/levels/factory/fac-tower_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/fac-tower_REF.gc @@ -639,59 +639,38 @@ ;; INFO: Used lq/sq (defmethod fire-shot ((this fac-gun-tower)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let ((s5-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s4-0 (get-trans *target* 3)) - (let ((s2-0 (-> this node-list data 10 bone transform)) - (s3-0 (new 'stack-no-clear 'quaternion)) - ) - (let ((a2-0 (-> this node-list data (-> this gunrot) bone transform))) - (set-vector! s5-0 0.0 0.0 40960.0 1.0) - (vector-matrix*! s5-0 s5-0 a2-0) - ) - (set! (-> s3-0 quad) (-> s2-0 fvec quad)) - (set! (-> s3-0 y) 0.0) - (vector-normalize! (-> s3-0 vec) 1.0) - (vector-rotate-around-axis! (-> s3-0 vec) s3-0 (-> this pitch) (-> s2-0 rvec)) - (let ((a0-11 s4-0)) - (let ((v1-11 s5-0)) - (let ((a1-5 409600.0)) - (.mov vf7 a1-5) - ) - (.lvf vf5 (&-> s3-0 quad)) - (.lvf vf4 (&-> v1-11 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-11 quad) vf6) - ) + (when *target* + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) ) - (let ((s3-1 (new 'stack-no-clear 'vector)) - (a1-6 (new 'stack-no-clear 'event-message-block)) - ) - (set! (-> a1-6 from) (process->ppointer pp)) - (set! (-> a1-6 num-params) 0) - (set! (-> a1-6 message) 'get-vehicle) - (let ((a0-14 (the-as vehicle (send-event-function *target* a1-6)))) - (when a0-14 - (vector-float*! s3-1 (-> a0-14 rbody lin-velocity) 0.0) - (vector+! s4-0 s4-0 s3-1) - ) + (vector-copy! s4-0 (get-trans *target* 3)) + (let ((s2-0 (-> this node-list data 10 bone transform)) + (s3-0 (new 'stack-no-clear 'vector)) ) + (let ((a2-0 (-> this node-list data (-> this gunrot) bone transform))) + (set-vector! s5-0 0.0 0.0 40960.0 1.0) + (vector-matrix*! s5-0 s5-0 a2-0) ) - (spawn-fac-gun-tower-projectile this s5-0 s4-0 1638400.0) + (vector-copy! s3-0 (-> s2-0 fvec)) + (set! (-> s3-0 y) 0.0) + (vector-normalize! s3-0 1.0) + (vector-rotate-around-axis! s3-0 s3-0 (-> this pitch) (-> s2-0 rvec)) + (vector+*! s4-0 s5-0 s3-0 409600.0) ) + (let ((s3-1 (new 'stack-no-clear 'vector)) + (a1-5 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-5 from) (process->ppointer pp)) + (set! (-> a1-5 num-params) 0) + (set! (-> a1-5 message) 'get-vehicle) + (let ((a0-15 (the-as vehicle (send-event-function *target* a1-5)))) + (when a0-15 + (vector-float*! s3-1 (-> a0-15 rbody lin-velocity) 0.0) + (vector+! s4-0 s4-0 s3-1) + ) + ) + ) + (spawn-fac-gun-tower-projectile this s5-0 s4-0 1638400.0) ) ) ) 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 2c43c55215..5e7b38c2ca 100644 --- a/test/decompiler/reference/jak3/levels/factory/factory-manager_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/factory-manager_REF.gc @@ -684,69 +684,32 @@ ;; INFO: Used lq/sq (defmethod fire-shot ((this factory-fighter)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when *target* - (let ((s5-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s4-0 (get-trans *target* 3)) - (let ((v1-4 s5-0)) - (let ((a0-3 (-> this root trans))) - (let ((a1-1 (-> this forw))) - (let ((a2-1 17203.2)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-1 quad)) - ) - (.lvf vf4 (&-> a0-3 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-4 quad) vf6) + (when *target* + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) ) - (let ((a1-2 s5-0)) - (let ((v1-5 s5-0)) - (let ((a0-4 (-> this upvc))) - (let ((a2-3 2252.8)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-4 quad)) - ) - (.lvf vf4 (&-> v1-5 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-2 quad) vf6) - ) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (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) 'get-vehicle) - (let ((a0-7 (the-as vehicle (send-event-function *target* a1-3)))) - (when a0-7 - (vector-float*! s3-0 (-> a0-7 rbody lin-velocity) 0.4) - (vector+! s4-0 s4-0 s3-0) - (sound-play "fighter-fire") - ) + (vector-copy! s4-0 (get-trans *target* 3)) + (vector+*! s5-0 (-> this root trans) (-> this forw) 17203.2) + (vector+*! s5-0 s5-0 (-> this upvc) 2252.8) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (let ((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 ((a0-7 (the-as vehicle (send-event-function *target* a1-4)))) + (when a0-7 + (vector-float*! s3-0 (-> a0-7 rbody lin-velocity) 0.4) + (vector+! s4-0 s4-0 s3-0) + (sound-play "fighter-fire") ) ) - (when #t - (rand-vu-sphere-point-uniform! s3-0 (* 61440.0 (rand-vu))) - (vector+! s4-0 s4-0 s3-0) - ) ) - (spawn-ffight-projectile this s5-0 s4-0 819200.0 #f) + (when #t + (rand-vu-sphere-point-uniform! s3-0 (* 61440.0 (rand-vu))) + (vector+! s4-0 s4-0 s3-0) + ) ) + (spawn-ffight-projectile this s5-0 s4-0 819200.0 #f) ) ) ) @@ -775,104 +738,87 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod factory-fighter-method-61 ((this factory-fighter)) - (local-vars (v1-64 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((f30-0 (seconds-per-frame))) - 1.0 - (-> this path-pos) - (let* ((s5-0 (ppointer->process (-> this parent))) - (f0-2 f30-0) - (f28-0 (/ 1.0 f0-2)) - ) - (set! (-> this path-pos) - (path-control-method-26 (-> s5-0 fpath path (-> this path-idx)) (-> this path-pos) (* 143360.0 f30-0)) - ) - (when (>= (-> this path-pos) 1.0) - (set! (-> this newpath) 2) - (cond - ((logtest? (-> s5-0 fpath inout (-> this path-idx) flags) (factory-inout-flag fi0)) - (set! (-> this path-pos) 0.0) - (vector-reset! (-> this forw)) - (vector-reset! (-> this upvc)) - ) - ((>= (-> s5-0 fpath inout (-> this path-idx) lpath) 0) - (set! (-> this path-pos) (-> s5-0 fpath inout (-> this path-idx) lpos)) - (set! (-> this path-idx) (-> s5-0 fpath inout (-> this path-idx) lpath)) - (vector-reset! (-> this forw)) - (vector-reset! (-> this upvc)) - ) - (else - (set! (-> this disappear) #t) - ) + (let ((f30-0 (seconds-per-frame))) + 1.0 + (-> this path-pos) + (let* ((s5-0 (ppointer->process (-> this parent))) + (f0-2 f30-0) + (f28-0 (/ 1.0 f0-2)) + ) + (set! (-> this path-pos) + (path-control-method-26 (-> s5-0 fpath path (-> this path-idx)) (-> this path-pos) (* 143360.0 f30-0)) ) - ) - (vector-copy! (-> this ppos) (-> this root trans)) - (get-point-at-percent-along-path! - (-> s5-0 fpath path (-> this path-idx)) - (-> this root trans) - (-> this path-pos) - 'interp - ) - (let ((s4-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'vector)) - (s5-1 (new 'stack-no-clear 'vector)) - ) - (vector-! s2-0 (-> this root trans) (-> this ppos)) - (vector-float*! s2-0 s2-0 f28-0) - (vector-copy! s4-0 s2-0) - (vector-normalize! s4-0 1.0) - (vector-! s3-0 s2-0 (-> this pvel)) - (vector-copy! (-> this pvel) s2-0) - (vector-float*! s3-0 s3-0 (/ f28-0 (meters 15))) - (cond - ((< 0.0 (-> this blendpath)) - (let ((v1-52 (new 'stack-no-clear 'vector))) - (vector-float*! s3-0 s3-0 (- 1.0 (-> this blendpath))) - (vector-float*! v1-52 (-> this pacc) (-> this blendpath)) - (vector+! s3-0 s3-0 v1-52) - ) - (set! (-> this blendpath) (fmax 0.0 (- (-> this blendpath) (* 4.0 f30-0)))) - ) - ((zero? (-> this newpath)) - (vector-copy! (-> this pacc) s3-0) - ) - (else - (vector-copy! s3-0 (-> this pacc)) - (+! (-> this newpath) -1) - (if (zero? (-> this newpath)) - (set! (-> this blendpath) 1.0) - ) - ) + (when (>= (-> this path-pos) 1.0) + (set! (-> this newpath) 2) + (cond + ((logtest? (-> s5-0 fpath inout (-> this path-idx) flags) (factory-inout-flag fi0)) + (set! (-> this path-pos) 0.0) + (vector-reset! (-> this forw)) + (vector-reset! (-> this upvc)) + ) + ((>= (-> s5-0 fpath inout (-> this path-idx) lpath) 0) + (set! (-> this path-pos) (-> s5-0 fpath inout (-> this path-idx) lpos)) + (set! (-> this path-idx) (-> s5-0 fpath inout (-> this path-idx) lpath)) + (vector-reset! (-> this forw)) + (vector-reset! (-> this upvc)) + ) + (else + (set! (-> this disappear) #t) ) - (let ((f0-22 0.0)) - (.lvf vf1 (&-> s2-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-64 vf1) - (if (>= f0-22 v1-64) - (vector-reset! s3-0) - ) - ) - (vector+! s5-1 *up-vector* s3-0) - (vector-normalize! s5-1 1.0) - (forward-up->quaternion (-> this root quat) s4-0 s5-1) - (vector-copy! (-> this forw) s4-0) - (vector-copy! (-> this upvc) s5-1) ) ) + (vector-copy! (-> this ppos) (-> this root trans)) + (get-point-at-percent-along-path! + (-> s5-0 fpath path (-> this path-idx)) + (-> this root trans) + (-> this path-pos) + 'interp + ) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (vector-! s2-0 (-> this root trans) (-> this ppos)) + (vector-float*! s2-0 s2-0 f28-0) + (vector-copy! s4-0 s2-0) + (vector-normalize! s4-0 1.0) + (vector-! s3-0 s2-0 (-> this pvel)) + (vector-copy! (-> this pvel) s2-0) + (vector-float*! s3-0 s3-0 (/ f28-0 (meters 15))) + (cond + ((< 0.0 (-> this blendpath)) + (let ((v1-52 (new 'stack-no-clear 'vector))) + (vector-float*! s3-0 s3-0 (- 1.0 (-> this blendpath))) + (vector-float*! v1-52 (-> this pacc) (-> this blendpath)) + (vector+! s3-0 s3-0 v1-52) + ) + (set! (-> this blendpath) (fmax 0.0 (- (-> this blendpath) (* 4.0 f30-0)))) + ) + ((zero? (-> this newpath)) + (vector-copy! (-> this pacc) s3-0) + ) + (else + (vector-copy! s3-0 (-> this pacc)) + (+! (-> this newpath) -1) + (if (zero? (-> this newpath)) + (set! (-> this blendpath) 1.0) + ) + ) + ) + (if (>= 0.0 (vector-length-squared s2-0)) + (vector-reset! s3-0) + ) + (vector+! s5-1 *up-vector* s3-0) + (vector-normalize! s5-1 1.0) + (forward-up->quaternion (-> this root quat) s4-0 s5-1) + (vector-copy! (-> this forw) s4-0) + (vector-copy! (-> this upvc) s5-1) + ) ) - (transform-post) - (none) ) + (transform-post) + (none) ) ;; failed to figure out what this is: @@ -916,79 +862,32 @@ ) ) :code (behavior () - (local-vars (v1-12 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (until #f - (when (and *target* (time-elapsed? (-> self last-fire) (seconds 2)) (time-elapsed? *fac-fighter-fired* (seconds 1))) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (let ((s5-0 (new 'stack-no-clear 'vector))) - 0.0 - (let ((v1-9 s5-0)) - (let ((a0-4 (-> self root trans))) - (let ((a1-0 (-> self forw))) - (let ((a2-1 17203.2)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-0 quad)) - ) - (.lvf vf4 (&-> a0-4 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-9 quad) vf6) - ) - (let ((a1-1 s5-0)) - (let ((v1-10 s5-0)) - (let ((a0-5 (-> self upvc))) - (let ((a2-3 2252.8)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-5 quad)) - ) - (.lvf vf4 (&-> v1-10 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-1 quad) vf6) - ) - (.lvf vf1 (&-> gp-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-12 vf1) - v1-12 - (vector-! gp-0 (get-trans *target* 3) s5-0) - ) - (vector-normalize! gp-0 1.0) - (when (and (logtest? (-> self draw status) (draw-control-status on-screen)) - (< 0.8 (vector-dot (-> self forw) gp-0)) - (< (vector-vector-distance (-> *target* control trans) (-> self root trans)) 491520.0) - (< 163840.0 (vector-vector-distance (-> *target* control trans) (-> self root trans))) - ) - (fire-shot self) - (set-time! (-> self last-fire)) - (set! *fac-fighter-fired* (current-time)) - ) + (until #f + (when (and *target* (time-elapsed? (-> self last-fire) (seconds 2)) (time-elapsed? *fac-fighter-fired* (seconds 1))) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + 0.0 + (vector+*! s5-0 (-> self root trans) (-> self forw) 17203.2) + (vector+*! s5-0 s5-0 (-> self upvc) 2252.8) + (vector-length-squared gp-0) + (vector-! gp-0 (get-trans *target* 3) s5-0) + ) + (vector-normalize! gp-0 1.0) + (when (and (logtest? (-> self draw status) (draw-control-status on-screen)) + (< 0.8 (vector-dot (-> self forw) gp-0)) + (< (vector-vector-distance (-> *target* control trans) (-> self root trans)) 491520.0) + (< 163840.0 (vector-vector-distance (-> *target* control trans) (-> self root trans))) + ) + (fire-shot self) + (set-time! (-> self last-fire)) + (set! *fac-fighter-fired* (current-time)) ) ) - (-> self skel root-channel 0) - (suspend) ) - #f + (-> self skel root-channel 0) + (suspend) ) + #f ) :post (behavior () (factory-fighter-method-61 self) @@ -1084,96 +983,33 @@ '() ) :code (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((v1-1 (new 'stack-no-clear 'vector))) - (let ((a0-1 (-> gp-0 fountain-rand-transv-lo))) - (let ((a1-2 (-> self root trans))) - (let ((a2-1 *up-vector*)) - (let ((a3-1 2048.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-1 quad)) - ) - (.lvf vf4 (&-> a1-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 (&-> a0-1 quad) vf6) - ) - (let ((a2-2 v1-1)) - (let ((a0-2 (-> self pvel))) - (let ((a1-3 *up-vector*)) - (let ((a3-3 40960.0)) - (.mov vf7 a3-3) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> a0-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 (&-> a2-2 quad) vf6) - ) - (let ((a2-3 (-> gp-0 fountain-rand-transv-lo))) - (let ((a0-3 v1-1)) - (let ((a1-4 *identity-vector*)) - (let ((a3-5 -204800.0)) - (.mov vf7 a3-5) - ) - (.lvf vf5 (&-> a1-4 quad)) - ) - (.lvf vf4 (&-> a0-3 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-3 quad) vf6) - ) - (let ((a1-5 (-> gp-0 fountain-rand-transv-hi))) - (let ((a0-4 *identity-vector*)) - (let ((a2-5 204800.0)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-4 quad)) - ) - (.lvf vf4 (&-> v1-1 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-5 quad) vf6) - ) - ) - (set! (-> gp-0 gravity) -122880.0) - (set! (-> gp-0 rot-speed) 16.0) - (set! (-> gp-0 friction) 1.0) - (process-spawn - joint-exploder - (art-group-get-by-name *level* "skel-fac-fighter-explode" (the-as (pointer level) #f)) - 7 - gp-0 - *fac-fighter-exploder-params* - :name "joint-exploder" - :to self - :unk 0 - ) + (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((v1-1 (new 'stack-no-clear 'vector))) + (vector+*! (-> gp-0 fountain-rand-transv-lo) (-> self root trans) *up-vector* 2048.0) + (vector+*! v1-1 (-> self pvel) *up-vector* 40960.0) + (vector+*! (-> gp-0 fountain-rand-transv-lo) v1-1 *identity-vector* -204800.0) + (vector+*! (-> gp-0 fountain-rand-transv-hi) v1-1 *identity-vector* 204800.0) ) - (let ((v1-10 (ppointer->process (-> self parent)))) - (+! (-> v1-10 nfighters-spawned) -1) - ) - (while (-> self child) - (suspend) + (set! (-> gp-0 gravity) -122880.0) + (set! (-> gp-0 rot-speed) 16.0) + (set! (-> gp-0 friction) 1.0) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-fac-fighter-explode" (the-as (pointer level) #f)) + 7 + gp-0 + *fac-fighter-exploder-params* + :name "joint-exploder" + :to self + :unk 0 ) ) + (let ((v1-10 (ppointer->process (-> self parent)))) + (+! (-> v1-10 nfighters-spawned) -1) + ) + (while (-> self child) + (suspend) + ) ) :post (behavior () (let ((v1-0 (new 'stack-no-clear 'vector))) @@ -1527,98 +1363,49 @@ (defstate retract (fac-target) :virtual #t :enter (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (process-entity-status! self (entity-perm-status subtask-complete) #t) - (let ((v1-1 (-> self root root-prim))) - (set! (-> v1-1 prim-core collide-as) (collide-spec)) - (set! (-> v1-1 prim-core collide-with) (collide-spec)) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (let ((v1-1 (-> self root root-prim))) + (set! (-> v1-1 prim-core collide-as) (collide-spec)) + (set! (-> v1-1 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> self draw status) (draw-control-status no-draw)) + (fac-target-method-33 self) + (set-time! (-> self state-time)) + (when (-> self minimap) + (logior! (-> self minimap flags) (minimap-flag fade-out)) + (set! (-> self minimap) #f) + ) + (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((s4-0 (-> self node-list data 3 bone transform))) + (vector-float*! s5-0 (-> s4-0 fvec) (* 4096.0 (rand-vu-float-range 20.0 30.0))) + (vector+*! (-> gp-0 fountain-rand-transv-lo) (-> self root trans) (-> s4-0 fvec) 2048.0) + ) + (vector+*! (-> gp-0 fountain-rand-transv-lo) s5-0 *identity-vector* -204800.0) + (vector+*! (-> gp-0 fountain-rand-transv-hi) s5-0 *identity-vector* 204800.0) ) - 0 - (logior! (-> self draw status) (draw-control-status no-draw)) - (fac-target-method-33 self) - (set-time! (-> self state-time)) - (when (-> self minimap) - (logior! (-> self minimap flags) (minimap-flag fade-out)) - (set! (-> self minimap) #f) + (set! (-> gp-0 gravity) -122880.0) + (set! (-> gp-0 rot-speed) 16.0) + (cond + ((logtest? (-> *part-group-id-table* 733 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) (-> self root trans)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 733)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) (-> self root trans)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 733)) + ) ) - (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (let ((s4-0 (-> self node-list data 3 bone transform))) - (vector-float*! s5-0 (-> s4-0 fvec) (* 4096.0 (rand-vu-float-range 20.0 30.0))) - (let ((v1-20 (-> gp-0 fountain-rand-transv-lo))) - (let ((a0-7 (-> self root trans))) - (let ((a1-3 (-> s4-0 fvec))) - (let ((a2-3 2048.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a1-3 quad)) - ) - (.lvf vf4 (&-> a0-7 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-20 quad) vf6) - ) - ) - (let ((a1-4 (-> gp-0 fountain-rand-transv-lo))) - (let ((v1-21 s5-0)) - (let ((a0-8 *identity-vector*)) - (let ((a2-5 -204800.0)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-8 quad)) - ) - (.lvf vf4 (&-> v1-21 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-4 quad) vf6) - ) - (let ((a0-9 (-> gp-0 fountain-rand-transv-hi))) - (let ((v1-22 *identity-vector*)) - (let ((a1-6 204800.0)) - (.mov vf7 a1-6) - ) - (.lvf vf5 (&-> v1-22 quad)) - ) - (.lvf vf4 (&-> s5-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-9 quad) vf6) - ) - ) - (set! (-> gp-0 gravity) -122880.0) - (set! (-> gp-0 rot-speed) 16.0) - (cond - ((logtest? (-> *part-group-id-table* 733 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) (-> self root trans)) - (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 733)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) (-> self root trans)) - (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 733)) - ) - ) - (process-spawn - joint-exploder - (art-group-get-by-name *level* "skel-fac-target-explode" (the-as (pointer level) #f)) - 9 - gp-0 - *fac-target-exploder-params* - :name "joint-exploder" - :to self - :unk 0 - ) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-fac-target-explode" (the-as (pointer level) #f)) + 9 + gp-0 + *fac-target-exploder-params* + :name "joint-exploder" + :to self + :unk 0 ) ) ) diff --git a/test/decompiler/reference/jak3/levels/factory/ffight-projectile_REF.gc b/test/decompiler/reference/jak3/levels/factory/ffight-projectile_REF.gc index f0843caf57..c853bce92d 100644 --- a/test/decompiler/reference/jak3/levels/factory/ffight-projectile_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/ffight-projectile_REF.gc @@ -356,57 +356,35 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this ffight-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 2851 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 2851 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 2851) a1-0 s5-1 #f) - (set! (-> *part-id-table* 2851 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 2852) s4-0) - (launch-particles (-> *part-id-table* 2853) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f28-1 (/ f30-0 (meters 16))) - (f30-1 (-> *part-id-table* 2854 init-specs 3 initial-valuef)) - ) - (-> *part-id-table* 2854 init-specs 4 initial-valuef) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 2854 init-specs 3 initial-valuef) (* f28-1 f30-1)) - (launch-particles (-> *part-id-table* 2854) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 2854 init-specs 3 initial-valuef) f30-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 2851 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 2851 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 2851) a1-0 s5-1 #f) + (set! (-> *part-id-table* 2851 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 2852) s4-1) + (launch-particles (-> *part-id-table* 2853) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f28-1 (/ f30-0 (meters 16))) + (f30-1 (-> *part-id-table* 2854 init-specs 3 initial-valuef)) + ) + (-> *part-id-table* 2854 init-specs 4 initial-valuef) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 2854 init-specs 3 initial-valuef) (* f28-1 f30-1)) + (launch-particles (-> *part-id-table* 2854) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 2854 init-specs 3 initial-valuef) f30-1) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 26 of type ffight-shot diff --git a/test/decompiler/reference/jak3/levels/factory/ftank-projectile_REF.gc b/test/decompiler/reference/jak3/levels/factory/ftank-projectile_REF.gc index b8d80fe3d9..52bf4cd2c2 100644 --- a/test/decompiler/reference/jak3/levels/factory/ftank-projectile_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/ftank-projectile_REF.gc @@ -283,57 +283,35 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this ftank-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 2866 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 2866 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 2866) a1-0 s5-1 #f) - (set! (-> *part-id-table* 2866 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 2867) s4-0) - (launch-particles (-> *part-id-table* 2868) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f28-1 (/ f30-0 (meters 16))) - (f30-1 (-> *part-id-table* 2869 init-specs 3 initial-valuef)) - ) - (-> *part-id-table* 2869 init-specs 4 initial-valuef) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 2869 init-specs 3 initial-valuef) (* f28-1 f30-1)) - (launch-particles (-> *part-id-table* 2869) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 2869 init-specs 3 initial-valuef) f30-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 2866 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 2866 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 2866) a1-0 s5-1 #f) + (set! (-> *part-id-table* 2866 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 2867) s4-1) + (launch-particles (-> *part-id-table* 2868) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f28-1 (/ f30-0 (meters 16))) + (f30-1 (-> *part-id-table* 2869 init-specs 3 initial-valuef)) + ) + (-> *part-id-table* 2869 init-specs 4 initial-valuef) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 2869 init-specs 3 initial-valuef) (* f28-1 f30-1)) + (launch-particles (-> *part-id-table* 2869) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 2869 init-specs 3 initial-valuef) f30-1) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 26 of type ftank-shot diff --git a/test/decompiler/reference/jak3/levels/factory/fturret-projectile_REF.gc b/test/decompiler/reference/jak3/levels/factory/fturret-projectile_REF.gc index 4bc3f907af..5a0f0a54d1 100644 --- a/test/decompiler/reference/jak3/levels/factory/fturret-projectile_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/fturret-projectile_REF.gc @@ -394,59 +394,37 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this fturret-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 2878 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 2878 init-specs 4 initial-valuef) (vector-length s5-1)) - (draw-beam (-> *part-id-table* 2878) a1-0 s5-1 #f) - (set! (-> *part-id-table* 2878 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 2879) s4-0) - (launch-particles (-> *part-id-table* 2880) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f26-0 (/ f30-0 (meters 9))) - (f30-1 (-> *part-id-table* 2881 init-specs 3 initial-valuef)) - (f28-1 (-> *part-id-table* 2881 init-specs 4 initial-valuef)) - ) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 2881 init-specs 3 initial-valuef) (* f26-0 f30-1)) - (set! (-> *part-id-table* 2881 init-specs 4 initial-valuef) (* f26-0 f28-1)) - (launch-particles (-> *part-id-table* 2881) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 2881 init-specs 3 initial-valuef) f30-1) - (set! (-> *part-id-table* 2881 init-specs 4 initial-valuef) f28-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 2878 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 2878 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 2878) a1-0 s5-1 #f) + (set! (-> *part-id-table* 2878 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 2879) s4-1) + (launch-particles (-> *part-id-table* 2880) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f26-0 (/ f30-0 (meters 9))) + (f30-1 (-> *part-id-table* 2881 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 2881 init-specs 4 initial-valuef)) + ) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 2881 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 2881 init-specs 4 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 2881) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 2881 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 2881 init-specs 4 initial-valuef) f28-1) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 26 of type fturret-shot 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 e5e020ec54..30cbd199df 100644 --- a/test/decompiler/reference/jak3/levels/factory/h-warf_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/h-warf_REF.gc @@ -1000,250 +1000,221 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-97 ((this h-warf) (arg0 float) (arg1 vehicle-physics-work)) - (local-vars (v1-107 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s3-0 (-> this rbody))) - (mem-copy! (the-as pointer (-> arg1 mat)) (the-as pointer (-> s3-0 matrix)) 64) - (let* ((f28-0 (* -1.0 (-> this controls steering) (-> this info handling tire-steering-angle))) - (f30-0 (cos f28-0)) - (f0-2 (sin f28-0)) - ) - (set! (-> arg1 steering-axis x) f30-0) - (set! (-> arg1 steering-axis y) 0.0) - (set! (-> arg1 steering-axis z) f0-2) - ) - (vector-rotate*! (-> arg1 steering-axis) (-> arg1 steering-axis) (-> arg1 mat)) - (logior! (-> this v-flags) (vehicle-flag in-air)) - (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) - (vector-reset! (-> arg1 ground-normal)) - (set! (-> arg1 ground-normal y) 1.0) - (let ((f30-1 (-> this info handling ground-probe-distance))) - (let ((s2-0 (new 'stack-no-clear 'collide-query))) - (vector-reset! (-> arg1 lift-dir)) - (set! (-> arg1 lift-dir y) -1.0) - (set! (-> arg1 speed-factor) - (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) - ) - (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)) + (let ((s3-0 (-> this rbody))) + (mem-copy! (the-as pointer (-> arg1 mat)) (the-as pointer (-> s3-0 matrix)) 64) + (let* ((f28-0 (* -1.0 (-> this controls steering) (-> this info handling tire-steering-angle))) + (f30-0 (cos f28-0)) + (f0-2 (sin f28-0)) + ) + (set! (-> arg1 steering-axis x) f30-0) + (set! (-> arg1 steering-axis y) 0.0) + (set! (-> arg1 steering-axis z) f0-2) + ) + (vector-rotate*! (-> arg1 steering-axis) (-> arg1 steering-axis) (-> arg1 mat)) + (logior! (-> this v-flags) (vehicle-flag in-air)) + (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) + (vector-reset! (-> arg1 ground-normal)) + (set! (-> arg1 ground-normal y) 1.0) + (let ((f30-1 (-> this info handling ground-probe-distance))) + (let ((s2-0 (new 'stack-no-clear 'collide-query))) + (vector-reset! (-> arg1 lift-dir)) + (set! (-> arg1 lift-dir y) -1.0) + (set! (-> arg1 speed-factor) + (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) ) - (vector-normalize! (-> arg1 lift-dir) 1.0) - ) - (vector-float*! (-> s2-0 move-dist) (-> arg1 lift-dir) (the-as float f30-1)) - (let ((v1-26 s2-0)) - (set! (-> v1-26 radius) 409.6) - (set! (-> v1-26 collide-with) (collide-spec - backgnd - bot - obstacle - hit-by-player-list - hit-by-others-list - player-list - water - collectable - blocking-plane - pusher - vehicle-mesh-probeable - shield - vehicle-sphere-no-probe - ) - ) - (set! (-> v1-26 ignore-process0) #f) - (set! (-> v1-26 ignore-process1) #f) - (set! (-> v1-26 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) - (set! (-> v1-26 action-mask) (collide-action solid)) - ) - (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) - (let ((v1-29 (-> this info physics-model lift-thruster-array s1-0)) - (s0-0 (-> arg1 probe-work-array s1-0)) - ) - (vector-reset! (-> s0-0 tire-force)) - (vector-copy! (-> s0-0 local-pos) (-> v1-29 local-pos)) - (vector-copy! (-> s0-0 local-normal) (-> v1-29 rot)) - (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> arg1 mat)) - (let ((a1-9 (-> s0-0 probe-pos))) - (let ((v1-32 (-> s0-0 world-pos))) - (let ((a0-22 (-> arg1 mat uvec))) - (let ((a2-6 (-> this info handling ground-probe-offset))) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-22 quad)) - ) - (.lvf vf4 (&-> v1-32 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-9 quad) vf6) + (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)) ) - (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) - (vector-copy! (-> s0-0 wheel-axis) (the-as vector (if (< 0.0 (-> s0-0 local-pos z)) - (-> arg1 steering-axis) - (the-as vector (-> arg1 mat)) - ) - ) - ) - (vector-copy! (-> s0-0 ground-pos) (-> s0-0 probe-pos)) - (set! (-> s0-0 ground-pos y) 0.0) - (vector-reset! (-> s0-0 ground-normal)) - (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) - (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) - (let ((f0-15 (probe-using-line-sphere *collide-cache* s2-0))) - (cond - ((and (>= f0-15 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) - (logclear! (-> this v-flags) (vehicle-flag in-air)) - (logior! (-> this v-flags) (vehicle-flag on-ground)) - (set! (-> s0-0 ground-pos y) (- (-> s0-0 probe-pos y) (* f0-15 f30-1))) - (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) - (vector-copy! (-> arg1 ground-normal) (-> s0-0 ground-normal)) - ) - (else - (set! (-> s0-0 ground-pos y) (+ -81920.0 (-> s3-0 position y))) - ) + (t9-4 a0-7 a1-4 a2-3 (* f0-8 f0-8)) + ) + (vector-normalize! (-> arg1 lift-dir) 1.0) + ) + (vector-float*! (-> s2-0 move-dist) (-> arg1 lift-dir) (the-as float f30-1)) + (let ((v1-26 s2-0)) + (set! (-> v1-26 radius) 409.6) + (set! (-> v1-26 collide-with) (collide-spec + backgnd + bot + obstacle + hit-by-player-list + hit-by-others-list + player-list + water + collectable + blocking-plane + pusher + vehicle-mesh-probeable + shield + vehicle-sphere-no-probe + ) + ) + (set! (-> v1-26 ignore-process0) #f) + (set! (-> v1-26 ignore-process1) #f) + (set! (-> v1-26 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) + (set! (-> v1-26 action-mask) (collide-action solid)) + ) + (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) + (let ((v1-29 (-> this info physics-model lift-thruster-array s1-0)) + (s0-0 (-> arg1 probe-work-array s1-0)) + ) + (vector-reset! (-> s0-0 tire-force)) + (vector-copy! (-> s0-0 local-pos) (-> v1-29 local-pos)) + (vector-copy! (-> s0-0 local-normal) (-> v1-29 rot)) + (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> arg1 mat)) + (vector+*! + (-> s0-0 probe-pos) + (-> s0-0 world-pos) + (-> arg1 mat uvec) + (the-as float (-> this info handling ground-probe-offset)) + ) + (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) + (vector-copy! (-> s0-0 wheel-axis) (the-as vector (if (< 0.0 (-> s0-0 local-pos z)) + (-> arg1 steering-axis) + (the-as vector (-> arg1 mat)) + ) + ) + ) + (vector-copy! (-> s0-0 ground-pos) (-> s0-0 probe-pos)) + (set! (-> s0-0 ground-pos y) 0.0) + (vector-reset! (-> s0-0 ground-normal)) + (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) + (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) + (let ((f0-15 (probe-using-line-sphere *collide-cache* s2-0))) + (cond + ((and (>= f0-15 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) + (logclear! (-> this v-flags) (vehicle-flag in-air)) + (logior! (-> this v-flags) (vehicle-flag on-ground)) + (set! (-> s0-0 ground-pos y) (- (-> s0-0 probe-pos y) (* f0-15 f30-1))) + (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) + (vector-copy! (-> arg1 ground-normal) (-> s0-0 ground-normal)) + ) + (else + (set! (-> s0-0 ground-pos y) (+ -81920.0 (-> s3-0 position y))) ) ) - 0 ) + 0 ) ) ) - (set! (-> this lift-thrust 0) 0.0) - (set! (-> this lift-thrust 1) 0.0) - (set! (-> this lift-thrust 2) 0.0) - (set! (-> this lift-thrust 3) 0.0) - (set! (-> this roll-thrust 0) 0.0) - (set! (-> this roll-thrust 1) 0.0) - (when (>= 1 (-> this force-level)) - (dotimes (s2-1 (-> this info physics-model lift-thruster-count)) - (let ((s1-1 (-> arg1 probe-work-array s2-1))) - (vector-copy! (-> arg1 world-pos) (-> s1-1 world-pos)) - (vector-copy! (-> arg1 velocity) (-> s1-1 velocity)) - (let* ((f1-12 (fmax 4096.0 (fmin (- (-> s1-1 probe-pos y) (-> s1-1 ground-pos y)) f30-1))) - (f28-1 (- 1.0 (/ (+ -4096.0 f1-12) (+ -4096.0 f30-1)))) - ) - (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s1-1 ground-normal) (-> arg1 mat uvec))) - (set! f28-1 0.0) + ) + (set! (-> this lift-thrust 0) 0.0) + (set! (-> this lift-thrust 1) 0.0) + (set! (-> this lift-thrust 2) 0.0) + (set! (-> this lift-thrust 3) 0.0) + (set! (-> this roll-thrust 0) 0.0) + (set! (-> this roll-thrust 1) 0.0) + (when (>= 1 (-> this force-level)) + (dotimes (s2-1 (-> this info physics-model lift-thruster-count)) + (let ((s1-1 (-> arg1 probe-work-array s2-1))) + (vector-copy! (-> arg1 world-pos) (-> s1-1 world-pos)) + (vector-copy! (-> arg1 velocity) (-> s1-1 velocity)) + (let* ((f1-12 (fmax 4096.0 (fmin (- (-> s1-1 probe-pos y) (-> s1-1 ground-pos y)) f30-1))) + (f28-1 (- 1.0 (/ (+ -4096.0 f1-12) (+ -4096.0 f30-1)))) + ) + (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s1-1 ground-normal) (-> arg1 mat uvec))) + (set! f28-1 0.0) + ) + (set! (-> arg1 tmp y) 0.0) + (set! (-> arg1 tmp x) (-> arg1 velocity z)) + (set! (-> arg1 tmp z) (- (-> arg1 velocity x))) + (vector-normalize! (-> arg1 tmp) 1.0) + (vector+float*! + (-> arg1 normal) + (-> s1-1 ground-normal) + (-> arg1 tmp) + (- (vector-dot (-> s1-1 ground-normal) (-> arg1 tmp))) + ) + (let ((v1-80 (-> arg1 force)) + (a0-45 (-> arg1 normal)) + (f0-37 (* 2.0 f28-1)) + (f1-17 arg0) ) - (set! (-> arg1 tmp y) 0.0) - (set! (-> arg1 tmp x) (-> arg1 velocity z)) - (set! (-> arg1 tmp z) (- (-> arg1 velocity x))) - (vector-normalize! (-> arg1 tmp) 1.0) - (vector+float*! - (-> arg1 normal) - (-> s1-1 ground-normal) - (-> arg1 tmp) - (- (vector-dot (-> s1-1 ground-normal) (-> arg1 tmp))) - ) - (let ((v1-80 (-> arg1 force)) - (a0-45 (-> arg1 normal)) - (f0-37 (* 2.0 f28-1)) - (f1-17 arg0) - ) - (vector-float*! v1-80 a0-45 (* f0-37 - (/ 1.0 f1-17) - (-> this info physics-model inv-lift-thruster-count) - (-> this info info mass) - (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> arg1 normal)))) - ) - ) - ) - (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) - (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) - (let ((f0-51 (* 8.0 - (-> this info info mass) - (-> this info extra gravity) - (-> this info physics-model inv-lift-thruster-count) - (+ (* (-> this info handling spring-lift-factor) f28-1) - (* 0.75 (-> this jump-thrust) (-> this info handling jump-thrust-factor)) - ) - (- (+ 1.0 (* 2.0 (rand-vu) (-> this power-fluctuation-factor))) (-> this power-fluctuation-factor)) + (vector-float*! v1-80 a0-45 (* f0-37 + (/ 1.0 f1-17) + (-> this info physics-model inv-lift-thruster-count) + (-> this info info mass) + (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> arg1 normal)))) + ) ) - ) - ) - (+! (-> this lift-thrust s2-1) f0-51) - (vector-float*! (-> arg1 force) (-> arg1 lift-dir) (* -1.0 f0-51)) - ) ) (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) - (when (and (< 0.0 (-> this info handling tire-friction-factor)) (let ((f0-54 0.0)) - (.lvf vf1 (&-> (-> s1-1 ground-normal) 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-107 vf1) - (< f0-54 v1-107) - ) - ) - (vector+float*! - (-> arg1 normal) - (-> s1-1 wheel-axis) - (-> s1-1 ground-normal) - (- (vector-dot (-> s1-1 wheel-axis) (-> s1-1 ground-normal))) - ) - (vector-normalize! (-> arg1 normal) 1.0) - (vector-copy! (-> arg1 world-pos) (-> s3-0 position)) - (vector-copy! (-> arg1 velocity) (-> s3-0 lin-velocity)) - (vector-! (-> arg1 p-body) (-> arg1 world-pos) (-> s3-0 position)) - (vector-cross! (-> arg1 tmp) (-> arg1 p-body) (-> arg1 normal)) - (vector-rotate*! (-> arg1 tmp) (-> arg1 tmp) (-> s3-0 inv-i-world)) - (vector-cross! (-> arg1 tmp) (-> arg1 tmp) (-> arg1 p-body)) - (set! (-> arg1 vel-dot-norm) (vector-dot (-> arg1 velocity) (-> arg1 normal))) - (let ((f0-61 (fabs (-> arg1 vel-dot-norm)))) - (set! (-> arg1 friction-coef) - (smooth-interp - (-> this info handling tire-static-friction) - (-> this info handling tire-dynamic-friction) - f0-61 - (-> this info handling tire-static-friction-speed) - (-> this info handling tire-dynamic-friction-speed) - ) - ) - ) - (set! (-> arg1 friction-coef) - (* (-> arg1 friction-coef) (+ 1.0 (* -0.75 (fmax 0.0 (fmin 1.0 (-> this engine-thrust)))))) - ) - (let ((f0-69 (* (-> arg1 friction-coef) - (-> this info handling tire-friction-factor) - (fmax 0.0 (vector-dot (-> s1-1 ground-normal) (-> s1-1 tire-force))) - ) - ) - ) - (set! (-> arg1 impulse) (/ (* -1.0 (-> arg1 vel-dot-norm)) - (* arg0 (+ (-> s3-0 info inv-mass) (vector-dot (-> arg1 normal) (-> arg1 tmp)))) - ) - ) - (set! (-> arg1 impulse) (fmax (fmin (-> arg1 impulse) f0-69) (- f0-69))) - ) - (vector-float*! (-> arg1 force) (-> arg1 normal) (-> arg1 impulse)) - (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + (let ((f0-51 (* 8.0 + (-> this info info mass) + (-> this info extra gravity) + (-> this info physics-model inv-lift-thruster-count) + (+ (* (-> this info handling spring-lift-factor) f28-1) + (* 0.75 (-> this jump-thrust) (-> this info handling jump-thrust-factor)) + ) + (- (+ 1.0 (* 2.0 (rand-vu) (-> this power-fluctuation-factor))) (-> this power-fluctuation-factor)) + ) + ) + ) + (+! (-> this lift-thrust s2-1) f0-51) + (vector-float*! (-> arg1 force) (-> arg1 lift-dir) (* -1.0 f0-51)) ) ) + (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) + (when (and (< 0.0 (-> this info handling tire-friction-factor)) + (< 0.0 (vector-length-squared (-> s1-1 ground-normal))) + ) + (vector+float*! + (-> arg1 normal) + (-> s1-1 wheel-axis) + (-> s1-1 ground-normal) + (- (vector-dot (-> s1-1 wheel-axis) (-> s1-1 ground-normal))) + ) + (vector-normalize! (-> arg1 normal) 1.0) + (vector-copy! (-> arg1 world-pos) (-> s3-0 position)) + (vector-copy! (-> arg1 velocity) (-> s3-0 lin-velocity)) + (vector-! (-> arg1 p-body) (-> arg1 world-pos) (-> s3-0 position)) + (vector-cross! (-> arg1 tmp) (-> arg1 p-body) (-> arg1 normal)) + (vector-rotate*! (-> arg1 tmp) (-> arg1 tmp) (-> s3-0 inv-i-world)) + (vector-cross! (-> arg1 tmp) (-> arg1 tmp) (-> arg1 p-body)) + (set! (-> arg1 vel-dot-norm) (vector-dot (-> arg1 velocity) (-> arg1 normal))) + (let ((f0-61 (fabs (-> arg1 vel-dot-norm)))) + (set! (-> arg1 friction-coef) + (smooth-interp + (-> this info handling tire-static-friction) + (-> this info handling tire-dynamic-friction) + f0-61 + (-> this info handling tire-static-friction-speed) + (-> this info handling tire-dynamic-friction-speed) + ) + ) + ) + (set! (-> arg1 friction-coef) + (* (-> arg1 friction-coef) (+ 1.0 (* -0.75 (fmax 0.0 (fmin 1.0 (-> this engine-thrust)))))) + ) + (let ((f0-69 (* (-> arg1 friction-coef) + (-> this info handling tire-friction-factor) + (fmax 0.0 (vector-dot (-> s1-1 ground-normal) (-> s1-1 tire-force))) + ) + ) + ) + (set! (-> arg1 impulse) (/ (* -1.0 (-> arg1 vel-dot-norm)) + (* arg0 (+ (-> s3-0 info inv-mass) (vector-dot (-> arg1 normal) (-> arg1 tmp)))) + ) + ) + (set! (-> arg1 impulse) (fmax (fmin (-> arg1 impulse) f0-69) (- f0-69))) + ) + (vector-float*! (-> arg1 force) (-> arg1 normal) (-> arg1 impulse)) + (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 163 of type h-warf @@ -1730,94 +1701,66 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-thrusters ((this h-warf) (arg0 float) (arg1 vector) (arg2 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 arg2) - (let ((s4-0 (new 'stack-no-clear 'matrix))) - (quaternion->matrix s4-0 (-> this root quat)) - (let ((a2-1 (matrix-transpose! (new 'stack-no-clear 'matrix) s4-0))) - (vector-rotate*! (-> this langvel) (-> this rbody ang-velocity) a2-1) + (when (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 arg2) + (let ((s4-0 (new 'stack-no-clear 'matrix))) + (quaternion->matrix s4-0 (-> this root quat)) + (let ((a2-1 (matrix-transpose! (new 'stack-no-clear 'matrix) s4-0))) + (vector-rotate*! (-> this langvel) (-> this rbody ang-velocity) a2-1) + ) + (cond + ((not (-> this bounce-state?)) + (vector-rotate-around-axis! s5-0 arg2 (* -2184.5334 (-> this langvel x)) (-> s4-0 rvec)) + (vector-rotate-around-axis! s5-0 s5-0 (* -1820.4445 (-> this langvel y)) (-> s4-0 uvec)) + (vector-rotate-around-axis! s5-0 s5-0 (* 182.04445 (-> this langvel z) (* 5.0 arg0)) (-> s4-0 rvec)) + ) + (else + (vector-copy! s5-0 arg2) ) - (cond - ((not (-> this bounce-state?)) - (vector-rotate-around-axis! s5-0 (the-as quaternion arg2) (* -2184.5334 (-> this langvel x)) (-> s4-0 rvec)) - (vector-rotate-around-axis! s5-0 (the-as quaternion s5-0) (* -1820.4445 (-> this langvel y)) (-> s4-0 uvec)) - (vector-rotate-around-axis! - s5-0 - (the-as quaternion s5-0) - (* 182.04445 (-> this langvel z) (* 5.0 arg0)) - (-> s4-0 rvec) - ) - ) - (else - (vector-copy! s5-0 arg2) - ) - ) - (vector-copy! (-> s4-0 trans) arg1) - (dotimes (s3-1 15) - (let* ((f28-0 (* 0.06666667 (- 15.0 (the float s3-1)))) - (f26-0 (* f28-0 (rand-vu-float-range 8192.0 9011.2))) - (f30-0 (* f28-0 (rand-vu-float-range 8192.0 12288.0))) - ) - (let ((a1-9 (-> s4-0 trans))) - (let ((v1-18 (-> s4-0 trans))) - (let ((a0-12 s5-0)) - (let ((a2-7 (+ (* 819.2 f28-0) (* 1024.0 (-> this engine-thrust) f28-0)))) - (.mov vf7 a2-7) - ) - (.lvf vf5 (&-> a0-12 quad)) - ) - (.lvf vf4 (&-> v1-18 quad)) + ) + (vector-copy! (-> s4-0 trans) arg1) + (dotimes (s3-1 15) + (let* ((f28-0 (* 0.06666667 (- 15.0 (the float s3-1)))) + (f26-0 (* f28-0 (rand-vu-float-range 8192.0 9011.2))) + (f30-0 (* f28-0 (rand-vu-float-range 8192.0 12288.0))) + ) + (vector+*! (-> s4-0 trans) (-> s4-0 trans) s5-0 (+ (* 819.2 f28-0) (* 1024.0 (-> this engine-thrust) f28-0))) + (set! (-> *part-id-table* 2761 init-specs 11 initial-valuef) + (+ (rand-vu-float-range 0.0 5.0) (* 60.0 f28-0 (-> this engine-thrust)) (* 40.0 f28-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-9 quad) vf6) - ) - (set! (-> *part-id-table* 2761 init-specs 11 initial-valuef) - (+ (rand-vu-float-range 0.0 5.0) (* 60.0 f28-0 (-> this engine-thrust)) (* 40.0 f28-0)) - ) - (set! (-> *part-id-table* 2761 init-specs 8 initial-valuef) - (+ (* 215.0 (-> this engine-thrust)) (* 40.0 f28-0)) - ) - (set! (-> *part-id-table* 2761 init-specs 10 initial-valuef) - (the float (- 255 (the int (* 255.0 (-> this engine-thrust))))) - ) - (set! (-> *part-id-table* 2761 init-specs 3 initial-valuef) f26-0) - (set! (-> *part-id-table* 2761 init-specs 7 initial-valuef) f26-0) - (set! (-> *part-id-table* 2762 init-specs 4 initial-valuef) (* 255.0 f28-0 (-> this engine-thrust))) - (set! (-> *part-id-table* 2762 init-specs 5 initial-valuef) - (the float (- 28 (the int (* 28.0 f28-0 (-> this engine-thrust))))) - ) - (set! (-> *part-id-table* 2762 init-specs 6 initial-valuef) - (the float (- 255 (the int (* 255.0 f28-0 (-> this engine-thrust))))) - ) - (set! (-> *part-id-table* 2762 init-specs 7 initial-valuef) - (+ (rand-vu-float-range 0.0 (* 40.0 (-> this engine-thrust))) - (* 20.0 f28-0 (-> this engine-thrust)) - (the float (* 30 (the int f28-0))) - ) - ) - (set! (-> *part-id-table* 2762 init-specs 2 initial-valuef) f30-0) - (set! (-> *part-id-table* 2762 init-specs 3 initial-valuef) f30-0) - ) - (launch-particles (-> *part-id-table* 2761) s4-0 :origin-is-matrix #t) - (launch-particles (-> *part-id-table* 2762) s4-0 :origin-is-matrix #t) + (set! (-> *part-id-table* 2761 init-specs 8 initial-valuef) + (+ (* 215.0 (-> this engine-thrust)) (* 40.0 f28-0)) + ) + (set! (-> *part-id-table* 2761 init-specs 10 initial-valuef) + (the float (- 255 (the int (* 255.0 (-> this engine-thrust))))) + ) + (set! (-> *part-id-table* 2761 init-specs 3 initial-valuef) f26-0) + (set! (-> *part-id-table* 2761 init-specs 7 initial-valuef) f26-0) + (set! (-> *part-id-table* 2762 init-specs 4 initial-valuef) (* 255.0 f28-0 (-> this engine-thrust))) + (set! (-> *part-id-table* 2762 init-specs 5 initial-valuef) + (the float (- 28 (the int (* 28.0 f28-0 (-> this engine-thrust))))) + ) + (set! (-> *part-id-table* 2762 init-specs 6 initial-valuef) + (the float (- 255 (the int (* 255.0 f28-0 (-> this engine-thrust))))) + ) + (set! (-> *part-id-table* 2762 init-specs 7 initial-valuef) + (+ (rand-vu-float-range 0.0 (* 40.0 (-> this engine-thrust))) + (* 20.0 f28-0 (-> this engine-thrust)) + (the float (* 30 (the int f28-0))) + ) + ) + (set! (-> *part-id-table* 2762 init-specs 2 initial-valuef) f30-0) + (set! (-> *part-id-table* 2762 init-specs 3 initial-valuef) f30-0) ) + (launch-particles (-> *part-id-table* 2761) s4-0 :origin-is-matrix #t) + (launch-particles (-> *part-id-table* 2762) s4-0 :origin-is-matrix #t) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 78 of type h-warf 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 8f3ee1a94c..6986efa1de 100644 --- a/test/decompiler/reference/jak3/levels/factory/missile-bot_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/missile-bot_REF.gc @@ -344,79 +344,56 @@ ;; definition for function missile-bot-find-dest ;; INFO: Used lq/sq (defbehavior missile-bot-find-dest missile-bot ((arg0 vector)) - (local-vars (v1-22 float) (a2-3 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node missile-bot-lod0-jg main)))) - (vector-copy! arg0 s4-0) - (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) s4-0 (target-pos 0))) - (s3-1 (as-type (ppointer->process (-> self parent)) factory-boss)) - (s0-0 (new 'stack-no-clear 'vector)) - (s2-1 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - ) - (when s3-1 - (set! (-> s5-1 y) 0.0) - (vector-normalize! s5-1 1.0) - (vector-! s0-0 (-> s3-1 center) s4-0) - (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) - (f0-6 (* f0-4 f0-4)) - ) - (.lvf vf1 (&-> s1-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 a2-3 vf1) - (vector+float*! v1-10 a0-11 a1-7 (sqrtf (- f0-6 a2-3))) - ) - (if (< (vector-dot s5-1 arg0) 0.0) - (vector-reset! arg0) + (let ((s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node missile-bot-lod0-jg main)))) + (vector-copy! arg0 s4-0) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) s4-0 (target-pos 0))) + (s3-1 (as-type (ppointer->process (-> self parent)) factory-boss)) + (s0-0 (new 'stack-no-clear 'vector)) + (s2-1 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (when s3-1 + (set! (-> s5-1 y) 0.0) + (vector-normalize! s5-1 1.0) + (vector-! s0-0 (-> s3-1 center) s4-0) + (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+! s2-1 s2-1 s4-0) - (vector+! arg0 arg0 s4-0) - (let ((s2-3 (vector-! (new 'stack-no-clear 'vector) (-> s3-1 root trans) arg0))) - 0.0 - (let ((f0-13 (* -0.5 (vector-vector-distance arg0 s4-0)))) - (set! (-> s2-3 y) 0.0) - (.lvf vf1 (&-> s2-3 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-22 vf1) - (let ((f1-3 v1-22) - (f2-0 20480.0) - ) - (if (< (* f2-0 f2-0) f1-3) - (vector-float*! s2-3 s2-3 (/ 20480.0 (sqrtf f1-3))) - ) - ) - (let ((f1-7 (vector-dot s2-3 s5-1))) - (if (< f1-7 f0-13) - (vector-float*! s2-3 s2-3 (/ f0-13 f1-7)) - ) - ) - ) - (vector+! arg0 arg0 s2-3) + (vector+float*! v1-10 a0-11 a1-7 (sqrtf (- (* f0-4 f0-4) (vector-length-squared s1-0)))) + ) + (if (< (vector-dot s5-1 arg0) 0.0) + (vector-reset! arg0) ) + (vector+! s2-1 s2-1 s4-0) + (vector+! arg0 arg0 s4-0) + (let ((s2-3 (vector-! (new 'stack-no-clear 'vector) (-> s3-1 root trans) arg0))) + 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) + (vector-float*! s2-3 s2-3 (/ 20480.0 (sqrtf f1-3))) + ) + ) + (let ((f1-7 (vector-dot s2-3 s5-1))) + (if (< f1-7 f0-13) + (vector-float*! s2-3 s2-3 (/ f0-13 f1-7)) + ) + ) + ) + (vector+! arg0 arg0 s2-3) ) ) ) - arg0 ) + arg0 ) ;; failed to figure out what this is: 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 232159f2e1..9b46f0bccd 100644 --- a/test/decompiler/reference/jak3/levels/factory/warf-projectile_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/warf-projectile_REF.gc @@ -445,44 +445,24 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this warf-projectile)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (v1-1 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 v1-1)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (v1-1 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 v1-1)) - (f30-0 (vector-length s5-1)) - ) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (let ((a0-4 s5-1)) - (let ((a1-2 0.8)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-4 quad)) - ) - (.lvf vf4 (&-> v1-1 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 (&-> s3-0 quad) vf6) - (vector-normalize! s5-1 1.0) - (warf-projectile-method-42 this s3-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix))) - (fmin 1.0 (/ f30-0 (meters 40))) - (-> *part-id-table* 2895 init-specs 3 initial-valuef) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - ) + (let ((s3-1 (vector+*! (new 'stack-no-clear 'vector) v1-1 s5-1 0.8))) + (vector-normalize! s5-1 1.0) + (warf-projectile-method-42 this s3-1) + ) + (let ((s4-1 (new 'stack-no-clear 'matrix))) + (fmin 1.0 (/ f30-0 (meters 40))) + (-> *part-id-table* 2895 init-specs 3 initial-valuef) + (forward-up->inv-matrix s4-1 s5-1 *up-vector*) + (vector-copy! (-> s4-1 trans) gp-0) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 30 of type warf-projectile @@ -1092,49 +1072,27 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this gun-warf-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((s5-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-0 a1-0)) + (f30-0 (vector-length s4-1)) ) - (init-vf0-vector) - (let* ((s5-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-0 a1-0)) - (f30-0 (vector-length s4-1)) - ) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s4-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s3-0 quad) vf6) - (gun-warf-shot-method-41 this a1-0 s4-1) - (vector-normalize! s4-1 1.0) - (launch-part this s3-0) - ) - (let ((s3-1 (new 'stack-no-clear 'matrix)) - (f30-1 (fmin 1.0 (/ f30-0 (meters 30)))) - (f28-0 (-> *part-id-table* 2895 init-specs 3 initial-valuef)) - ) - (forward-up->inv-matrix s3-1 s4-1 *up-vector*) - (vector-copy! (-> s3-1 trans) s5-0) - (gun-warf-shot-method-42 this f30-1 f28-0 s3-1) - ) + (let ((s3-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s4-1 0.8))) + (gun-warf-shot-method-41 this a1-0 s4-1) + (vector-normalize! s4-1 1.0) + (launch-part this s3-1) + ) + (let ((s3-2 (new 'stack-no-clear 'matrix)) + (f30-1 (fmin 1.0 (/ f30-0 (meters 30)))) + (f28-0 (-> *part-id-table* 2895 init-specs 3 initial-valuef)) + ) + (forward-up->inv-matrix s3-2 s4-1 *up-vector*) + (vector-copy! (-> s3-2 trans) s5-0) + (gun-warf-shot-method-42 this f30-1 f28-0 s3-2) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 37 of type gun-warf-shot @@ -1194,33 +1152,15 @@ ;; definition for method 25 of type fac-gun-tower-projectile ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this fac-gun-tower-projectile)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((a1-0 (-> this root trans)) + (v1-1 (-> this tail-pos)) + (a2-1 (vector-! (new 'stack-no-clear 'vector) a1-0 v1-1)) + (a1-2 (vector+*! (new 'stack-no-clear 'vector) v1-1 a2-1 0.8)) ) - (init-vf0-vector) - (let* ((a1-0 (-> this root trans)) - (v1-1 (-> this tail-pos)) - (a2-1 (vector-! (new 'stack-no-clear 'vector) a1-0 v1-1)) - (a1-1 (new 'stack-no-clear 'vector)) - ) - (let ((a3-2 0.8)) - (.mov vf7 a3-2) - ) - (.lvf vf5 (&-> a2-1 quad)) - (.lvf vf4 (&-> v1-1 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-1 quad) vf6) - (spawn (-> this part) a1-1) - ) - 0 - (none) + (spawn (-> this part) a1-2) ) + 0 + (none) ) ;; definition for method 28 of type fac-gun-tower-projectile diff --git a/test/decompiler/reference/jak3/levels/forest/for-turret-shot_REF.gc b/test/decompiler/reference/jak3/levels/forest/for-turret-shot_REF.gc index f9623950a5..c2bd21d58d 100644 --- a/test/decompiler/reference/jak3/levels/forest/for-turret-shot_REF.gc +++ b/test/decompiler/reference/jak3/levels/forest/for-turret-shot_REF.gc @@ -371,58 +371,36 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this for-turret-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) ) - (init-vf0-vector) - (let* ((gp-0 (-> this root trans)) - (a1-0 (-> this tail-pos)) - (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) - (f30-0 (vector-length s5-1)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (let ((v1-4 a1-0)) - (let ((a0-2 s5-1)) - (let ((a2-1 0.8)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6) - (let ((f28-0 (-> *part-id-table* 1065 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 1065 init-specs 4 initial-valuef) (fmin f28-0 (vector-length s5-1))) - (draw-beam (-> *part-id-table* 1065) a1-0 s5-1 #f) - (set! (-> *part-id-table* 1065 init-specs 4 initial-valuef) f28-0) - ) - (vector-normalize! s5-1 1.0) - (launch-particles (-> *part-id-table* 1066) s4-0) - ) - (let ((s4-1 (new 'stack-no-clear 'matrix)) - (f26-0 (/ f30-0 (meters 30))) - (f30-1 (-> *part-id-table* 1067 init-specs 3 initial-valuef)) - (f28-1 (-> *part-id-table* 1067 init-specs 5 initial-valuef)) - ) - (forward-up->inv-matrix s4-1 s5-1 *up-vector*) - (vector-copy! (-> s4-1 trans) gp-0) - (set! (-> *part-id-table* 1067 init-specs 3 initial-valuef) (* f26-0 f30-1)) - (set! (-> *part-id-table* 1067 init-specs 5 initial-valuef) (* f26-0 f28-1)) - (launch-particles (-> *part-id-table* 1067) s4-1 :origin-is-matrix #t) - (set! (-> *part-id-table* 1067 init-specs 3 initial-valuef) f30-1) - (set! (-> *part-id-table* 1067 init-specs 5 initial-valuef) f28-1) + (let ((s4-1 (vector+*! (new 'stack-no-clear 'vector) a1-0 s5-1 0.8))) + (let ((f28-0 (-> *part-id-table* 1065 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 1065 init-specs 4 initial-valuef) (fmin f28-0 (vector-length s5-1))) + (draw-beam (-> *part-id-table* 1065) a1-0 s5-1 #f) + (set! (-> *part-id-table* 1065 init-specs 4 initial-valuef) f28-0) ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 1066) s4-1) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix)) + (f26-0 (/ f30-0 (meters 30))) + (f30-1 (-> *part-id-table* 1067 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 1067 init-specs 5 initial-valuef)) + ) + (forward-up->inv-matrix s4-2 s5-1 *up-vector*) + (vector-copy! (-> s4-2 trans) gp-0) + (set! (-> *part-id-table* 1067 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 1067 init-specs 5 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 1067) s4-2 :origin-is-matrix #t) + (set! (-> *part-id-table* 1067 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 1067 init-specs 5 initial-valuef) f28-1) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 26 of type for-turret-shot 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 9f9bceb2a9..f727188ad1 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 @@ -508,7 +508,7 @@ (vector-cross! s5-2 s3-0 s4-3) (vector-normalize! s5-2 1.0) (let ((f0-21 (deg-seek f28-1 f26-0 (* 49152.0 (seconds-per-frame))))) - (vector-rotate-around-axis! s4-3 (the-as quaternion s4-3) (* -1.0 f0-21) s5-2) + (vector-rotate-around-axis! s4-3 s4-3 (* -1.0 f0-21) s5-2) ) ) ) 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 eea09739a3..6c18bd868e 100644 --- a/test/decompiler/reference/jak3/levels/glider/glider-manager_REF.gc +++ b/test/decompiler/reference/jak3/levels/glider/glider-manager_REF.gc @@ -1046,135 +1046,112 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod task-manager-desert-glide-method-36 ((this task-manager-desert-glide)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (if (and (cpad-hold? 0 triangle) (cpad-hold? 0 up)) - (set! (-> this editing?) #t) - ) - (when (and *target* (focus-test? *target* pilot) (cpad-hold? 0 triangle) (cpad-pressed? 0 r1)) + (if (and (cpad-hold? 0 triangle) (cpad-hold? 0 up)) (set! (-> this editing?) #t) - (let ((s5-0 (new 'stack 'glider-ring-info))) - (let ((s4-0 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle))) - (b! (not s4-0) cfg-86 :delay (nop!)) - (vector-copy! (-> s5-0 pos) (-> s4-0 rbody matrix trans)) - (vector-copy! (-> s5-0 forw) (-> s4-0 rbody matrix fvec)) - (set! (-> s5-0 shootable) #f) - (set! (-> s5-0 speedmod) 1.0) - (cond - ((cpad-hold? 0 down) - (set! (-> s5-0 boost) 0.25) - ) - ((cpad-hold? 0 left) - (set! (-> s5-0 boost) 0.5) - ) - ((cpad-hold? 0 up) - (set! (-> s5-0 boost) 0.75) - ) - ((cpad-hold? 0 right) - (set! (-> s5-0 boost) 0.0) - ) - (else - (set! (-> s5-0 boost) 1.0) - ) - ) - (set! (-> s5-0 dist) 819200.0) - (glider-ring-spawn this s5-0 *ring-spawn-id* #f) - (send-event s4-0 'turbo-ring (-> s5-0 boost)) - ) - (mem-copy! (the-as pointer (-> *desert-glide-rings-tmp* *ring-spawn-id*)) (the-as pointer s5-0) 69) - ) - (set! *ring-spawn-id* (+ *ring-spawn-id* 1)) ) - (when (and *target* (focus-test? *target* pilot) (cpad-hold? 0 triangle) (cpad-pressed? 0 r2)) - (when (not (-> this creating-thermal?)) - (set! (-> this creating-thermal?) #t) - (set-time! (-> this thermal-start-time)) - ) - (set! (-> this editing?) #t) - (let ((s5-1 (new 'stack 'glider-thermal-info))) - (let ((v1-85 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle))) - (b! (not v1-85) cfg-86 :delay (nop!)) - (vector-copy! (-> s5-1 pos) (-> v1-85 rbody matrix trans)) - (set! (-> s5-1 pos w) 40960.0) - (set! (-> s5-1 thermal-time) 0) - (let ((a0-42 (new 'stack-no-clear 'vector))) - (let ((a2-2 a0-42)) - (let ((a1-13 (-> s5-1 pos))) - (let ((v1-87 (-> v1-85 rbody matrix fvec))) - (let ((a3-1 (-> s5-1 pos w))) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> v1-87 quad)) - ) - (.lvf vf4 (&-> a1-13 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) - ) - (set! (-> a0-42 w) (-> s5-1 pos w)) - (vector-copy! (-> s5-1 pos) a0-42) + (when (and *target* (focus-test? *target* pilot) (cpad-hold? 0 triangle) (cpad-pressed? 0 r1)) + (set! (-> this editing?) #t) + (let ((s5-0 (new 'stack 'glider-ring-info))) + (let ((s4-0 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle))) + (b! (not s4-0) cfg-86 :delay (nop!)) + (vector-copy! (-> s5-0 pos) (-> s4-0 rbody matrix trans)) + (vector-copy! (-> s5-0 forw) (-> s4-0 rbody matrix fvec)) + (set! (-> s5-0 shootable) #f) + (set! (-> s5-0 speedmod) 1.0) + (cond + ((cpad-hold? 0 down) + (set! (-> s5-0 boost) 0.25) + ) + ((cpad-hold? 0 left) + (set! (-> s5-0 boost) 0.5) + ) + ((cpad-hold? 0 up) + (set! (-> s5-0 boost) 0.75) + ) + ((cpad-hold? 0 right) + (set! (-> s5-0 boost) 0.0) + ) + (else + (set! (-> s5-0 boost) 1.0) ) ) - (set! (-> s5-1 hheight) 409600.0) - (set! (-> s5-1 curpos) 0.0) - (set! (-> s5-1 windspeed) 327680.0) - (mem-copy! (the-as pointer (-> *desert-glide-thermals-tmp* *thermal-spawn-id*)) (the-as pointer s5-1) 40) + (set! (-> s5-0 dist) 819200.0) + (glider-ring-spawn this s5-0 *ring-spawn-id* #f) + (send-event s4-0 'turbo-ring (-> s5-0 boost)) ) - (set! *thermal-spawn-id* (+ *thermal-spawn-id* 1)) - (set! *desert-glide-num-thermals* (+ *desert-glide-num-thermals* 1)) + (mem-copy! (the-as pointer (-> *desert-glide-rings-tmp* *ring-spawn-id*)) (the-as pointer s5-0) 69) ) - (when (-> this creating-thermal?) - (let ((s5-2 (-> *desert-glide-thermals-tmp* (+ *thermal-spawn-id* -1))) - (s3-1 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle)) - (s4-3 (new 'stack-no-clear 'vector)) - ) - 0.0 - 0.0 - (b! (not s3-1) cfg-86 :delay (nop!)) - (let ((f0-16 (vector-vector-xz-distance (-> s3-1 rbody matrix trans) (-> s5-2 pos)))) - (let ((f1-1 (- (-> s3-1 rbody matrix trans y) (-> s5-2 pos y)))) - (if (< (/ (-> s5-2 hheight) 2) f1-1) - (set! (-> s5-2 hheight) (* 2.0 f1-1)) - ) - ) - (if (< (-> s5-2 pos w) (+ 4096.0 f0-16)) - (set! (-> s5-2 pos w) (+ 4096.0 f0-16)) - ) - (when (not (cpad-hold? 0 r2)) - (vector+! s4-3 (-> s3-1 rbody matrix trans) (-> s5-2 pos)) - (vector-float*! (-> s5-2 pos) s4-3 0.5) - (set! (-> s5-2 pos w) (/ f0-16 2)) - (set! (-> s5-2 thermal-time) (- (current-time) (-> this thermal-start-time))) - (set! (-> this creating-thermal?) #f) - ) - ) - ) - ) - (when (and (cpad-pressed? 0 l1) (cpad-hold? 0 up)) - (dotimes (gp-1 (-> *desert-glide-rings* length)) - (to-static-macro (-> *desert-glide-rings* gp-1) #t) - ) - (dotimes (gp-2 *ring-spawn-id*) - (to-static-macro (-> *desert-glide-rings-tmp* gp-2) #t) - ) - ) - (when (and (cpad-pressed? 0 l2) (cpad-hold? 0 up)) - (dotimes (gp-3 *desert-glide-num-thermals*) - (to-static-macro (-> *desert-glide-thermals-tmp* gp-3) #t) - ) - ) - (label cfg-86) - 0 - (none) + (set! *ring-spawn-id* (+ *ring-spawn-id* 1)) ) + (when (and *target* (focus-test? *target* pilot) (cpad-hold? 0 triangle) (cpad-pressed? 0 r2)) + (when (not (-> this creating-thermal?)) + (set! (-> this creating-thermal?) #t) + (set-time! (-> this thermal-start-time)) + ) + (set! (-> this editing?) #t) + (let ((s5-1 (new 'stack 'glider-thermal-info))) + (let ((v1-85 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle))) + (b! (not v1-85) cfg-86 :delay (nop!)) + (vector-copy! (-> s5-1 pos) (-> v1-85 rbody matrix trans)) + (set! (-> s5-1 pos w) 40960.0) + (set! (-> s5-1 thermal-time) 0) + (let ((a0-42 (new 'stack-no-clear 'vector))) + (vector+*! a0-42 (-> s5-1 pos) (-> v1-85 rbody matrix fvec) (-> s5-1 pos w)) + (set! (-> a0-42 w) (-> s5-1 pos w)) + (vector-copy! (-> s5-1 pos) a0-42) + ) + ) + (set! (-> s5-1 hheight) 409600.0) + (set! (-> s5-1 curpos) 0.0) + (set! (-> s5-1 windspeed) 327680.0) + (mem-copy! (the-as pointer (-> *desert-glide-thermals-tmp* *thermal-spawn-id*)) (the-as pointer s5-1) 40) + ) + (set! *thermal-spawn-id* (+ *thermal-spawn-id* 1)) + (set! *desert-glide-num-thermals* (+ *desert-glide-num-thermals* 1)) + ) + (when (-> this creating-thermal?) + (let ((s5-2 (-> *desert-glide-thermals-tmp* (+ *thermal-spawn-id* -1))) + (s3-1 (as-type (handle->process (-> *target* pilot vehicle)) hvehicle)) + (s4-3 (new 'stack-no-clear 'vector)) + ) + 0.0 + 0.0 + (b! (not s3-1) cfg-86 :delay (nop!)) + (let ((f0-16 (vector-vector-xz-distance (-> (the-as hvehicle s3-1) rbody matrix trans) (-> s5-2 pos)))) + (let ((f1-1 (- (-> (the-as hvehicle s3-1) rbody matrix trans y) (-> s5-2 pos y)))) + (if (< (/ (-> s5-2 hheight) 2) f1-1) + (set! (-> s5-2 hheight) (* 2.0 f1-1)) + ) + ) + (if (< (-> s5-2 pos w) (+ 4096.0 f0-16)) + (set! (-> s5-2 pos w) (+ 4096.0 f0-16)) + ) + (when (not (cpad-hold? 0 r2)) + (vector+! s4-3 (-> (the-as hvehicle s3-1) rbody matrix trans) (-> s5-2 pos)) + (vector-float*! (-> s5-2 pos) s4-3 0.5) + (set! (-> s5-2 pos w) (/ f0-16 2)) + (set! (-> s5-2 thermal-time) (- (current-time) (-> this thermal-start-time))) + (set! (-> this creating-thermal?) #f) + ) + ) + ) + ) + (when (and (cpad-pressed? 0 l1) (cpad-hold? 0 up)) + (dotimes (gp-1 (-> *desert-glide-rings* length)) + (to-static-macro (-> *desert-glide-rings* gp-1) #t) + ) + (dotimes (gp-2 *ring-spawn-id*) + (to-static-macro (-> *desert-glide-rings-tmp* gp-2) #t) + ) + ) + (when (and (cpad-pressed? 0 l2) (cpad-hold? 0 up)) + (dotimes (gp-3 *desert-glide-num-thermals*) + (to-static-macro (-> *desert-glide-thermals-tmp* gp-3) #t) + ) + ) + (label cfg-86) + 0 + (none) ) ;; definition for method 38 of type task-manager-desert-glide @@ -1395,138 +1372,115 @@ ;; WARN: Return type mismatch int vs none. (defmethod task-manager-method-26 ((this task-manager-desert-glide)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (task-manager-desert-glide-method-35 this) - (if (glider-too-low? (target-pos 0) (the-as int (-> this reset-too-low?))) - (desert-glide-task-done) - ) - (when (and (zero? (-> this whistle-sound)) (time-elapsed? (-> this start-time) (seconds 0.2))) - (set! (-> this whistle-sound) (new-sound-id)) - (sound-play "whistling-wind" :id (-> this whistle-sound)) + (task-manager-desert-glide-method-35 this) + (if (glider-too-low? (target-pos 0) (the-as int (-> this reset-too-low?))) + (desert-glide-task-done) ) - (set! (-> this reset-too-low?) #f) - (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)) + (when (and (zero? (-> this whistle-sound)) (time-elapsed? (-> this start-time) (seconds 0.2))) + (set! (-> this whistle-sound) (new-sound-id)) + (sound-play "whistling-wind" :id (-> this whistle-sound)) + ) + (set! (-> this reset-too-low?) #f) + (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*) ) - (< f0-0 (* f1-0 f1-0)) - ) + (f1-0 (-> *desert-glide-finish-sphere* r)) + ) + (< f0-0 (* f1-0 f1-0)) ) - (if (not (-> this editing?)) - (send-event this 'complete) - ) - (when (-> this editing?) - (dotimes (s4-1 (-> *desert-glide-rings* length)) - (to-static-macro (-> *desert-glide-rings* s4-1) #t) - ) - (dotimes (s4-2 *ring-spawn-id*) - (to-static-macro (-> *desert-glide-rings-tmp* s4-2) #t) - ) - (dotimes (s4-3 *desert-glide-num-thermals*) - (to-static-macro (-> *desert-glide-thermals-tmp* s4-3) #t) - ) + ) + (if (not (-> this editing?)) (send-event this 'complete) ) + (when (-> this editing?) + (dotimes (s4-1 (-> *desert-glide-rings* length)) + (to-static-macro (-> *desert-glide-rings* s4-1) #t) + ) + (dotimes (s4-2 *ring-spawn-id*) + (to-static-macro (-> *desert-glide-rings-tmp* s4-2) #t) + ) + (dotimes (s4-3 *desert-glide-num-thermals*) + (to-static-macro (-> *desert-glide-thermals-tmp* s4-3) #t) + ) + (send-event this 'complete) ) - (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))) + ) + (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*) ) - (< f0-1 (* f1-4 f1-4)) - ) + (f1-4 (+ 1228800.0 (-> *desert-glide-finish-sphere* r))) + ) + (< f0-1 (* f1-4 f1-4)) ) - (let ((a1-13 (new 'stack-no-clear 'array 'symbol 10))) - (set! (-> a1-13 9) #f) - (set! (-> a1-13 8) #f) - (set! (-> a1-13 7) #f) - (set! (-> a1-13 6) #f) - (set! (-> a1-13 5) #f) - (set! (-> a1-13 4) #f) - (set! (-> a1-13 3) #f) - (set! (-> a1-13 2) 'volcanox) - (set! (-> a1-13 1) 'hangb) - (set! (-> a1-13 0) 'hanga) - (want-levels *load-state* a1-13) - ) - (want-display-level *load-state* 'volcanox 'display) - (set! (-> this did-want-load?) #t) + ) + (let ((a1-13 (new 'stack-no-clear 'array 'symbol 10))) + (set! (-> a1-13 9) #f) + (set! (-> a1-13 8) #f) + (set! (-> a1-13 7) #f) + (set! (-> a1-13 6) #f) + (set! (-> a1-13 5) #f) + (set! (-> a1-13 4) #f) + (set! (-> a1-13 3) #f) + (set! (-> a1-13 2) 'volcanox) + (set! (-> a1-13 1) 'hangb) + (set! (-> a1-13 0) 'hanga) + (want-levels *load-state* a1-13) ) + (want-display-level *load-state* 'volcanox 'display) + (set! (-> this did-want-load?) #t) ) - (let ((s5-2 (new 'stack-no-clear 'vector))) - (let ((s4-4 (camera-matrix))) - (vector-copy! s5-2 (camera-pos)) - (let ((a0-29 s5-2)) - (let ((v1-73 s5-2)) - (let ((a1-15 (-> s4-4 fvec))) - (let ((a2-3 1187840.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a1-15 quad)) - ) - (.lvf vf4 (&-> v1-73 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-29 quad) vf6) - ) - ) - (vector-copy! *cloud-cube* s5-2) - ) - (set! (-> *cloud-cube* w) 2457600.0) - (task-manager-desert-glide-method-34 this) ) - (task-manager-desert-glide-method-38 this) - (when (time-elapsed? (-> this check-timer) (seconds 0.1)) - (if (not (-> this desert-glide-entity)) - (task-manager-desert-glide-method-33 this) - ) - (when (< (-> this cur-group) (-> this actor-group-count)) - (let ((s5-3 (-> this actor-group (-> this cur-group)))) - (dotimes (s4-5 (-> s5-3 length)) - (let ((a1-16 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-16 from) (process->ppointer pp)) - (set! (-> a1-16 num-params) 0) - (set! (-> a1-16 message) 'trigger) - (let ((t9-21 send-event-function) - (v1-98 (-> s5-3 data s4-5 actor)) - ) - (t9-21 - (if v1-98 - (-> v1-98 extra process) - ) - a1-16 - ) - ) - ) - ) - ) + (let ((s5-2 (new 'stack-no-clear 'vector))) + (let ((s4-4 (camera-matrix))) + (vector-copy! s5-2 (camera-pos)) + (vector+*! s5-2 s5-2 (-> s4-4 fvec) 1187840.0) ) - (if (< 1.0 (-> *game-info* counter)) - (set! (-> this sound-id) - (add-process *gui-control* this (gui-channel background) (gui-action queue) "miss001" -99.0 0) - ) - ) - (set! (-> *game-info* counter) 0.0) - (set-time! (-> this check-timer)) + (vector-copy! *cloud-cube* s5-2) ) - 0 - (none) + (set! (-> *cloud-cube* w) 2457600.0) + (task-manager-desert-glide-method-34 this) ) + (task-manager-desert-glide-method-38 this) + (when (time-elapsed? (-> this check-timer) (seconds 0.1)) + (if (not (-> this desert-glide-entity)) + (task-manager-desert-glide-method-33 this) + ) + (when (< (-> this cur-group) (-> this actor-group-count)) + (let ((s5-3 (-> this actor-group (-> this cur-group)))) + (dotimes (s4-5 (-> s5-3 length)) + (let ((a1-16 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-16 from) (process->ppointer pp)) + (set! (-> a1-16 num-params) 0) + (set! (-> a1-16 message) 'trigger) + (let ((t9-21 send-event-function) + (v1-98 (-> s5-3 data s4-5 actor)) + ) + (t9-21 + (if v1-98 + (-> v1-98 extra process) + ) + a1-16 + ) + ) + ) + ) + ) + ) + (if (< 1.0 (-> *game-info* counter)) + (set! (-> this sound-id) + (add-process *gui-control* this (gui-channel background) (gui-action queue) "miss001" -99.0 0) + ) + ) + (set! (-> *game-info* counter) 0.0) + (set-time! (-> this check-timer)) + ) + 0 + (none) ) ) 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 65d09c8fed..2026f71779 100644 --- a/test/decompiler/reference/jak3/levels/glider/glider-ring_REF.gc +++ b/test/decompiler/reference/jak3/levels/glider/glider-ring_REF.gc @@ -474,145 +474,118 @@ ) ) :post (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (if (and (-> self player-got) - (time-elapsed? (-> self touch-time) (seconds 0.5)) - (or (not *target*) (or (< 81920.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) - (focus-test? *target* teleporting) - ) - ) - (not (-> self persistent)) - ) - (go-virtual die) - ) - (if (< (vector-vector-distance-squared (target-pos 0) (-> self root trans)) *near-thermal-dist-squared*) - (set-far self #f) - (set-far self #t) - ) - (vector-copy! (-> self root trans) (-> self save-pos)) - (when (< 0.0 (-> self speedmod)) - (when (!= (-> self xdist) 0.0) - (let ((gp-1 (-> self root trans))) - (let ((s5-0 (-> self root trans))) - (let ((s4-0 (-> self right))) - (let ((v1-34 (* (-> self xdist) (sin (* 75.0 (-> self speedmod) (the float (+ (current-time) (-> self toff)))))))) - (.mov vf7 v1-34) - ) - (.lvf vf5 (&-> s4-0 quad)) - ) - (.lvf vf4 (&-> s5-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 (&-> gp-1 quad) vf6) - ) - ) - (when (!= (-> self ydist) 0.0) - (let ((gp-3 (-> self root trans))) - (let ((s5-1 (-> self root trans))) - (let ((s4-1 (-> self up))) - (let ((v1-41 (* (-> self ydist) (cos (* 75.0 (-> self speedmod) (the float (+ (current-time) (-> self toff)))))))) - (.mov vf7 v1-41) - ) - (.lvf vf5 (&-> s4-1 quad)) - ) - (.lvf vf4 (&-> s5-1 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 (&-> gp-3 quad) vf6) - ) - ) - ) - (if (and (-> self shootable) (not (-> self shot))) - (quaternion-rotate-local-z! (-> self root quat) (-> self root quat) (* 32768.0 (seconds-per-frame))) - ) - (vector-copy! (-> self mat trans) (-> self root trans)) - (when (and (nonzero? (-> self distant-part)) (not (-> self shootable))) - ) - (when (logtest? (-> self draw status) (draw-control-status on-screen)) - (cond - ((-> self shootable) - (when (-> self shot) - ) - ) - (else - ) - ) - ) - (when (-> self shootable) - (if (-> self shot) - (ja :group! des-glider-ring-expand-ja :num! (seek! max 10.0)) - ) - (if (not (-> self shot)) - (ja :num! (seek!)) - ) - ) - (when (and (-> self shootable) (-> self shot) (not (-> self blinky-gone?))) - (kill-particles (-> self blinky-part)) - (set! (-> self blinky-part) (the-as sparticle-launch-control 0)) - (set! (-> self blinky-gone?) #t) - ) - (when (and (-> self shootable) (not (or (-> self shot) (-> self blinky-gone?)))) - (let ((a1-10 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 0)))) - (set! (-> *part-id-table* 2555 init-specs 10 initial-valuef) (the float (-> self center-joint))) - (spawn (-> self blinky-part) a1-10) - ) - ) - (when (-> self do-trails?) - (dotimes (gp-4 5) - (let ((v1-121 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self trail-joint gp-4))))) - (send-event (handle->process (-> self trails gp-4)) 'notice 'add-crumb-pos v1-121) - ) - ) - ) - (when (and (-> self shootable) (and (-> self shot) - (time-elapsed? (-> self state-time) (seconds 0.5)) - (not (handle->process (-> self ring-prim))) - ) + (if (and (-> self player-got) + (time-elapsed? (-> self touch-time) (seconds 0.5)) + (or (not *target*) (or (< 81920.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (focus-test? *target* teleporting) + ) ) - (let ((gp-5 (get-process *default-dead-pool* glider-prim #x4000 1))) - (set! (-> self ring-prim) - (ppointer->handle - (when gp-5 - (let ((t9-17 (method-of-type process activate))) - (t9-17 gp-5 self "prim" (the-as pointer #x70004000)) - ) - (let ((t9-18 run-function-in-process) - (a0-41 gp-5) - (a1-17 simple-prim-init-by-other) - (a2-7 (-> self root trans)) - (a3-2 (new 'stack-no-clear 'vector)) - ) - (set! (-> a3-2 x) 32768.0) - (set! (-> a3-2 y) 32768.0) - (set! (-> a3-2 z) 32768.0) - (set! (-> a3-2 w) 1.0) - ((the-as (function object object object object object none) t9-18) a0-41 a1-17 a2-7 a3-2 #x5e700200) - ) - (-> gp-5 ppointer) + (not (-> self persistent)) + ) + (go-virtual die) + ) + (if (< (vector-vector-distance-squared (target-pos 0) (-> self root trans)) *near-thermal-dist-squared*) + (set-far self #f) + (set-far self #t) + ) + (vector-copy! (-> self root trans) (-> self save-pos)) + (when (< 0.0 (-> self speedmod)) + (if (!= (-> self xdist) 0.0) + (vector+*! + (-> self root trans) + (-> self root trans) + (-> self right) + (* (-> self xdist) (sin (* 75.0 (-> self speedmod) (the float (+ (current-time) (-> self toff)))))) + ) + ) + (if (!= (-> self ydist) 0.0) + (vector+*! + (-> self root trans) + (-> self root trans) + (-> self up) + (* (-> self ydist) (cos (* 75.0 (-> self speedmod) (the float (+ (current-time) (-> self toff)))))) + ) + ) + ) + (if (and (-> self shootable) (not (-> self shot))) + (quaternion-rotate-local-z! (-> self root quat) (-> self root quat) (* 32768.0 (seconds-per-frame))) + ) + (vector-copy! (-> self mat trans) (-> self root trans)) + (when (and (nonzero? (-> self distant-part)) (not (-> self shootable))) + ) + (when (logtest? (-> self draw status) (draw-control-status on-screen)) + (cond + ((-> self shootable) + (when (-> self shot) + ) + ) + (else + ) + ) + ) + (when (-> self shootable) + (if (-> self shot) + (ja :group! des-glider-ring-expand-ja :num! (seek! max 10.0)) + ) + (if (not (-> self shot)) + (ja :num! (seek!)) + ) + ) + (when (and (-> self shootable) (-> self shot) (not (-> self blinky-gone?))) + (kill-particles (-> self blinky-part)) + (set! (-> self blinky-part) (the-as sparticle-launch-control 0)) + (set! (-> self blinky-gone?) #t) + ) + (when (and (-> self shootable) (not (or (-> self shot) (-> self blinky-gone?)))) + (let ((a1-10 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 0)))) + (set! (-> *part-id-table* 2555 init-specs 10 initial-valuef) (the float (-> self center-joint))) + (spawn (-> self blinky-part) a1-10) + ) + ) + (when (-> self do-trails?) + (dotimes (gp-6 5) + (let ((v1-119 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self trail-joint gp-6))))) + (send-event (handle->process (-> self trails gp-6)) 'notice 'add-crumb-pos v1-119) + ) + ) + ) + (when (and (-> self shootable) (and (-> self shot) + (time-elapsed? (-> self state-time) (seconds 0.5)) + (not (handle->process (-> self ring-prim))) + ) + ) + (let ((gp-7 (get-process *default-dead-pool* glider-prim #x4000 1))) + (set! (-> self ring-prim) + (ppointer->handle + (when gp-7 + (let ((t9-17 (method-of-type process activate))) + (t9-17 gp-7 self "prim" (the-as pointer #x70004000)) ) + (let ((t9-18 run-function-in-process) + (a0-41 gp-7) + (a1-17 simple-prim-init-by-other) + (a2-7 (-> self root trans)) + (a3-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-2 x) 32768.0) + (set! (-> a3-2 y) 32768.0) + (set! (-> a3-2 z) 32768.0) + (set! (-> a3-2 w) 1.0) + ((the-as (function object object object object object none) t9-18) a0-41 a1-17 a2-7 a3-2 #x5e700200) + ) + (-> gp-7 ppointer) ) ) - ) + ) ) - (let ((v1-151 (the-as glider-prim (handle->process (-> self ring-prim))))) - (when v1-151 - (vector-copy! (-> v1-151 root trans) (-> self root trans)) - (quaternion-copy! (-> v1-151 root quat) (-> self root quat)) - ) - ) - (transform-post) ) + (let ((v1-149 (handle->process (-> self ring-prim)))) + (when v1-149 + (vector-copy! (-> (the-as glider-prim v1-149) root trans) (-> self root trans)) + (quaternion-copy! (-> (the-as glider-prim v1-149) root quat) (-> self root quat)) + ) + ) + (transform-post) ) ) @@ -722,122 +695,101 @@ ;; definition for function glider-ring-init-by-other ;; INFO: Used lq/sq (defbehavior glider-ring-init-by-other glider-ring ((arg0 glider-ring-info) (arg1 int) (arg2 symbol)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (init-collision! self) - (initialize-skeleton - self - (the-as skeleton-group (art-group-get-by-name *level* "skel-glider-ring" (the-as (pointer level) #f))) - (the-as pair 0) - ) - (set! (-> self entity) #f) - (cond - ((-> arg0 shootable) - (ja :group! des-glider-ring-idle-ja :num! min) - (set! (-> self ring-prim) (the-as handle #f)) - ) - (else - (ja :group! des-glider-ring-expand-ja :num! max) - (let ((s3-3 (get-process *default-dead-pool* glider-prim #x4000 1))) - (set! (-> self ring-prim) - (ppointer->handle - (when s3-3 - (let ((t9-6 (method-of-type process activate))) - (t9-6 s3-3 self "prim" (the-as pointer #x70004000)) - ) - (let ((t9-7 run-function-in-process) - (a0-8 s3-3) - (a1-7 simple-prim-init-by-other) - (a2-7 (-> self root trans)) - (a3-2 (new 'stack-no-clear 'vector)) - ) - (set! (-> a3-2 x) 32768.0) - (set! (-> a3-2 y) 32768.0) - (set! (-> a3-2 z) 32768.0) - (set! (-> a3-2 w) 1.0) - ((the-as (function object object object object object none) t9-7) a0-8 a1-7 a2-7 a3-2 #x5e700200) - ) - (-> s3-3 ppointer) + (init-collision! self) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-glider-ring" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> self entity) #f) + (cond + ((-> arg0 shootable) + (ja :group! des-glider-ring-idle-ja :num! min) + (set! (-> self ring-prim) (the-as handle #f)) + ) + (else + (ja :group! des-glider-ring-expand-ja :num! max) + (let ((s3-3 (get-process *default-dead-pool* glider-prim #x4000 1))) + (set! (-> self ring-prim) + (ppointer->handle + (when s3-3 + (let ((t9-6 (method-of-type process activate))) + (t9-6 s3-3 self "prim" (the-as pointer #x70004000)) ) + (let ((t9-7 run-function-in-process) + (a0-8 s3-3) + (a1-7 simple-prim-init-by-other) + (a2-7 (-> self root trans)) + (a3-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-2 x) 32768.0) + (set! (-> a3-2 y) 32768.0) + (set! (-> a3-2 z) 32768.0) + (set! (-> a3-2 w) 1.0) + ((the-as (function object object object object object none) t9-7) a0-8 a1-7 a2-7 a3-2 #x5e700200) + ) + (-> s3-3 ppointer) ) ) + ) + ) + ) + ) + (vector-copy! (-> self root trans) (-> arg0 pos)) + (quaternion-from-two-vectors! (-> self root quat) *z-vector* (-> arg0 forw)) + (let ((v1-37 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) + (vector+*! (-> self root trans) (-> self root trans) v1-37 10240.0) + ) + (vector-copy! (-> self save-pos) (-> self root trans)) + (set! (-> self boost) (-> arg0 boost)) + (set! (-> self id) arg1) + (set! (-> self persistent) arg2) + (set! (-> self xdist) (-> arg0 xdist)) + (set! (-> self ydist) (-> arg0 ydist)) + (set! (-> self toff) (-> arg0 toff)) + (set! (-> self speedmod) (-> arg0 speedmod)) + (set! (-> self checkpoint) (-> arg0 checkpoint)) + (set! (-> self shootable) (-> arg0 shootable)) + (set! (-> self lastring) (-> arg0 lastring)) + (set! (-> self shot) #f) + (set! (-> self do-trails?) (or (!= (-> self xdist) 0.0) (!= (-> self ydist) 0.0))) + (set! (-> self center-joint) (the-as uint 2)) + (set! (-> self trail-joint 0) (the-as uint 3)) + (set! (-> self trail-joint 1) (the-as uint 5)) + (set! (-> self trail-joint 2) (the-as uint 7)) + (set! (-> self trail-joint 3) (the-as uint 9)) + (set! (-> self trail-joint 4) (the-as uint 11)) + (when (-> self do-trails?) + (let ((gp-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params))) + (set! (-> gp-1 tracked-obj) (process->handle self)) + (set! (-> gp-1 appearance) *glider-ring-trail*) + (set! (-> gp-1 max-num-crumbs) (the int (* 0.25 (the float (-> gp-1 appearance max-age))))) + (set! (-> gp-1 track-immediately?) #t) + (dotimes (s5-1 5) + (let* ((v1-64 + (estimate-light-trail-mem-usage + (the-as uint (-> gp-1 max-num-crumbs)) + (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) + ) + ) + (s4-1 (get-process *default-dead-pool* light-trail-tracker-glider-ring (+ v1-64 8192) 1)) + ) + (set! (-> self trails s5-1) + (ppointer->handle (when s4-1 + (let ((t9-12 (method-of-type process activate))) + (t9-12 s4-1 self "light-trail" (the-as pointer #x70004000)) + ) + (run-now-in-process s4-1 light-trail-tracker-init-by-other gp-1) + (-> s4-1 ppointer) + ) + ) + ) ) ) ) - (vector-copy! (-> self root trans) (-> arg0 pos)) - (quaternion-from-two-vectors! (-> self root quat) *z-vector* (-> arg0 forw)) - (let ((v1-37 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) - (a0-17 (-> self root trans)) - ) - (let ((a1-11 (-> self root trans))) - (let ((a2-10 10240.0)) - (.mov vf7 a2-10) - ) - (.lvf vf5 (&-> v1-37 quad)) - (.lvf vf4 (&-> a1-11 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-17 quad) vf6) - ) - (vector-copy! (-> self save-pos) (-> self root trans)) - (set! (-> self boost) (-> arg0 boost)) - (set! (-> self id) arg1) - (set! (-> self persistent) arg2) - (set! (-> self xdist) (-> arg0 xdist)) - (set! (-> self ydist) (-> arg0 ydist)) - (set! (-> self toff) (-> arg0 toff)) - (set! (-> self speedmod) (-> arg0 speedmod)) - (set! (-> self checkpoint) (-> arg0 checkpoint)) - (set! (-> self shootable) (-> arg0 shootable)) - (set! (-> self lastring) (-> arg0 lastring)) - (set! (-> self shot) #f) - (set! (-> self do-trails?) (or (!= (-> self xdist) 0.0) (!= (-> self ydist) 0.0))) - (set! (-> self center-joint) (the-as uint 2)) - (set! (-> self trail-joint 0) (the-as uint 3)) - (set! (-> self trail-joint 1) (the-as uint 5)) - (set! (-> self trail-joint 2) (the-as uint 7)) - (set! (-> self trail-joint 3) (the-as uint 9)) - (set! (-> self trail-joint 4) (the-as uint 11)) - (when (-> self do-trails?) - (let ((gp-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params))) - (set! (-> gp-1 tracked-obj) (process->handle self)) - (set! (-> gp-1 appearance) *glider-ring-trail*) - (set! (-> gp-1 max-num-crumbs) (the int (* 0.25 (the float (-> gp-1 appearance max-age))))) - (set! (-> gp-1 track-immediately?) #t) - (dotimes (s5-1 5) - (let* ((v1-64 - (estimate-light-trail-mem-usage - (the-as uint (-> gp-1 max-num-crumbs)) - (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) - ) - ) - (s4-1 (get-process *default-dead-pool* light-trail-tracker-glider-ring (+ v1-64 8192) 1)) - ) - (set! (-> self trails s5-1) - (ppointer->handle (when s4-1 - (let ((t9-12 (method-of-type process activate))) - (t9-12 s4-1 self "light-trail" (the-as pointer #x70004000)) - ) - (run-now-in-process s4-1 light-trail-tracker-init-by-other gp-1) - (-> s4-1 ppointer) - ) - ) - ) - ) - ) - ) - ) - (init-fields! self) - (go-virtual idle) ) + (init-fields! self) + (go-virtual idle) ) ;; definition for function glider-ring-spawn 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 a6096dd263..bb7d44f1a0 100644 --- a/test/decompiler/reference/jak3/levels/glider/h-glider_REF.gc +++ b/test/decompiler/reference/jak3/levels/glider/h-glider_REF.gc @@ -638,250 +638,221 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-97 ((this h-glider) (arg0 float) (arg1 vehicle-physics-work)) - (local-vars (v1-107 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s3-0 (-> this rbody))) - (mem-copy! (the-as pointer (-> arg1 mat)) (the-as pointer (-> s3-0 matrix)) 64) - (let* ((f28-0 (* -1.0 (-> this controls steering) (-> this info handling tire-steering-angle))) - (f30-0 (cos f28-0)) - (f0-2 (sin f28-0)) - ) - (set! (-> arg1 steering-axis x) f30-0) - (set! (-> arg1 steering-axis y) 0.0) - (set! (-> arg1 steering-axis z) f0-2) - ) - (vector-rotate*! (-> arg1 steering-axis) (-> arg1 steering-axis) (-> arg1 mat)) - (logior! (-> this v-flags) (vehicle-flag in-air)) - (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) - (vector-reset! (-> arg1 ground-normal)) - (set! (-> arg1 ground-normal y) 1.0) - (let ((f30-1 (-> this info handling ground-probe-distance))) - (let ((s2-0 (new 'stack-no-clear 'collide-query))) - (vector-reset! (-> arg1 lift-dir)) - (set! (-> arg1 lift-dir y) -1.0) - (set! (-> arg1 speed-factor) - (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) - ) - (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)) + (let ((s3-0 (-> this rbody))) + (mem-copy! (the-as pointer (-> arg1 mat)) (the-as pointer (-> s3-0 matrix)) 64) + (let* ((f28-0 (* -1.0 (-> this controls steering) (-> this info handling tire-steering-angle))) + (f30-0 (cos f28-0)) + (f0-2 (sin f28-0)) + ) + (set! (-> arg1 steering-axis x) f30-0) + (set! (-> arg1 steering-axis y) 0.0) + (set! (-> arg1 steering-axis z) f0-2) + ) + (vector-rotate*! (-> arg1 steering-axis) (-> arg1 steering-axis) (-> arg1 mat)) + (logior! (-> this v-flags) (vehicle-flag in-air)) + (logclear! (-> this v-flags) (vehicle-flag on-ground on-flight-level)) + (vector-reset! (-> arg1 ground-normal)) + (set! (-> arg1 ground-normal y) 1.0) + (let ((f30-1 (-> this info handling ground-probe-distance))) + (let ((s2-0 (new 'stack-no-clear 'collide-query))) + (vector-reset! (-> arg1 lift-dir)) + (set! (-> arg1 lift-dir y) -1.0) + (set! (-> arg1 speed-factor) + (fmax 0.0 (fmin 0.9 (* 0.000008138021 (+ -40960.0 (vector-length (-> s3-0 lin-velocity)))))) ) - (vector-normalize! (-> arg1 lift-dir) 1.0) - ) - (vector-float*! (-> s2-0 move-dist) (-> arg1 lift-dir) (the-as float f30-1)) - (let ((v1-26 s2-0)) - (set! (-> v1-26 radius) 409.6) - (set! (-> v1-26 collide-with) (collide-spec - backgnd - bot - obstacle - hit-by-player-list - hit-by-others-list - player-list - water - collectable - blocking-plane - pusher - vehicle-mesh-probeable - shield - vehicle-sphere-no-probe - ) - ) - (set! (-> v1-26 ignore-process0) #f) - (set! (-> v1-26 ignore-process1) #f) - (set! (-> v1-26 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) - (set! (-> v1-26 action-mask) (collide-action solid)) - ) - (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) - (let ((v1-29 (-> this info physics-model lift-thruster-array s1-0)) - (s0-0 (-> arg1 probe-work-array s1-0)) - ) - (vector-reset! (-> s0-0 tire-force)) - (vector-copy! (-> s0-0 local-pos) (-> v1-29 local-pos)) - (vector-copy! (-> s0-0 local-normal) (-> v1-29 rot)) - (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> arg1 mat)) - (let ((a1-9 (-> s0-0 probe-pos))) - (let ((v1-32 (-> s0-0 world-pos))) - (let ((a0-22 (-> arg1 mat uvec))) - (let ((a2-6 (-> this info handling ground-probe-offset))) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-22 quad)) - ) - (.lvf vf4 (&-> v1-32 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-9 quad) vf6) + (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)) ) - (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) - (vector-copy! (-> s0-0 wheel-axis) (the-as vector (if (< 0.0 (-> s0-0 local-pos z)) - (-> arg1 steering-axis) - (the-as vector (-> arg1 mat)) - ) - ) - ) - (vector-copy! (-> s0-0 ground-pos) (-> s0-0 probe-pos)) - (set! (-> s0-0 ground-pos y) 0.0) - (vector-reset! (-> s0-0 ground-normal)) - (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) - (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) - (let ((f0-15 (probe-using-line-sphere *collide-cache* s2-0))) - (cond - ((and (>= f0-15 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) - (logclear! (-> this v-flags) (vehicle-flag in-air)) - (logior! (-> this v-flags) (vehicle-flag on-ground)) - (set! (-> s0-0 ground-pos y) (- (-> s0-0 probe-pos y) (* f0-15 f30-1))) - (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) - (vector-copy! (-> arg1 ground-normal) (-> s0-0 ground-normal)) - ) - (else - (set! (-> s0-0 ground-pos y) (+ -81920.0 (-> s3-0 position y))) - ) + (t9-4 a0-7 a1-4 a2-3 (* f0-8 f0-8)) + ) + (vector-normalize! (-> arg1 lift-dir) 1.0) + ) + (vector-float*! (-> s2-0 move-dist) (-> arg1 lift-dir) (the-as float f30-1)) + (let ((v1-26 s2-0)) + (set! (-> v1-26 radius) 409.6) + (set! (-> v1-26 collide-with) (collide-spec + backgnd + bot + obstacle + hit-by-player-list + hit-by-others-list + player-list + water + collectable + blocking-plane + pusher + vehicle-mesh-probeable + shield + vehicle-sphere-no-probe + ) + ) + (set! (-> v1-26 ignore-process0) #f) + (set! (-> v1-26 ignore-process1) #f) + (set! (-> v1-26 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nopilot #x1)) + (set! (-> v1-26 action-mask) (collide-action solid)) + ) + (dotimes (s1-0 (-> this info physics-model lift-thruster-count)) + (let ((v1-29 (-> this info physics-model lift-thruster-array s1-0)) + (s0-0 (-> arg1 probe-work-array s1-0)) + ) + (vector-reset! (-> s0-0 tire-force)) + (vector-copy! (-> s0-0 local-pos) (-> v1-29 local-pos)) + (vector-copy! (-> s0-0 local-normal) (-> v1-29 rot)) + (vector-matrix*! (-> s0-0 world-pos) (-> s0-0 local-pos) (-> arg1 mat)) + (vector+*! + (-> s0-0 probe-pos) + (-> s0-0 world-pos) + (-> arg1 mat uvec) + (the-as float (-> this info handling ground-probe-offset)) + ) + (rigid-body-control-method-23 s3-0 (-> s0-0 probe-pos) (-> s0-0 velocity)) + (vector-copy! (-> s0-0 wheel-axis) (the-as vector (if (< 0.0 (-> s0-0 local-pos z)) + (-> arg1 steering-axis) + (the-as vector (-> arg1 mat)) + ) + ) + ) + (vector-copy! (-> s0-0 ground-pos) (-> s0-0 probe-pos)) + (set! (-> s0-0 ground-pos y) 0.0) + (vector-reset! (-> s0-0 ground-normal)) + (when (logtest? (-> this v-flags) (vehicle-flag enable-collision)) + (vector-copy! (-> s2-0 start-pos) (-> s0-0 probe-pos)) + (let ((f0-15 (probe-using-line-sphere *collide-cache* s2-0))) + (cond + ((and (>= f0-15 0.0) (!= (-> s2-0 best-other-tri pat mode) 1)) + (logclear! (-> this v-flags) (vehicle-flag in-air)) + (logior! (-> this v-flags) (vehicle-flag on-ground)) + (set! (-> s0-0 ground-pos y) (- (-> s0-0 probe-pos y) (* f0-15 f30-1))) + (vector-copy! (-> s0-0 ground-normal) (-> s2-0 best-other-tri normal)) + (vector-copy! (-> arg1 ground-normal) (-> s0-0 ground-normal)) + ) + (else + (set! (-> s0-0 ground-pos y) (+ -81920.0 (-> s3-0 position y))) ) ) - 0 ) + 0 ) ) ) - (set! (-> this lift-thrust 0) 0.0) - (set! (-> this lift-thrust 1) 0.0) - (set! (-> this lift-thrust 2) 0.0) - (set! (-> this lift-thrust 3) 0.0) - (set! (-> this roll-thrust 0) 0.0) - (set! (-> this roll-thrust 1) 0.0) - (when (>= 1 (-> this force-level)) - (dotimes (s2-1 (-> this info physics-model lift-thruster-count)) - (let ((s1-1 (-> arg1 probe-work-array s2-1))) - (vector-copy! (-> arg1 world-pos) (-> s1-1 world-pos)) - (vector-copy! (-> arg1 velocity) (-> s1-1 velocity)) - (let* ((f1-12 (fmax 4096.0 (fmin (- (-> s1-1 probe-pos y) (-> s1-1 ground-pos y)) f30-1))) - (f28-1 (- 1.0 (/ (+ -4096.0 f1-12) (+ -4096.0 f30-1)))) - ) - (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s1-1 ground-normal) (-> arg1 mat uvec))) - (set! f28-1 0.0) + ) + (set! (-> this lift-thrust 0) 0.0) + (set! (-> this lift-thrust 1) 0.0) + (set! (-> this lift-thrust 2) 0.0) + (set! (-> this lift-thrust 3) 0.0) + (set! (-> this roll-thrust 0) 0.0) + (set! (-> this roll-thrust 1) 0.0) + (when (>= 1 (-> this force-level)) + (dotimes (s2-1 (-> this info physics-model lift-thruster-count)) + (let ((s1-1 (-> arg1 probe-work-array s2-1))) + (vector-copy! (-> arg1 world-pos) (-> s1-1 world-pos)) + (vector-copy! (-> arg1 velocity) (-> s1-1 velocity)) + (let* ((f1-12 (fmax 4096.0 (fmin (- (-> s1-1 probe-pos y) (-> s1-1 ground-pos y)) f30-1))) + (f28-1 (- 1.0 (/ (+ -4096.0 f1-12) (+ -4096.0 f30-1)))) + ) + (if (>= (-> this info handling cos-ground-effect-angle) (vector-dot (-> s1-1 ground-normal) (-> arg1 mat uvec))) + (set! f28-1 0.0) + ) + (set! (-> arg1 tmp y) 0.0) + (set! (-> arg1 tmp x) (-> arg1 velocity z)) + (set! (-> arg1 tmp z) (- (-> arg1 velocity x))) + (vector-normalize! (-> arg1 tmp) 1.0) + (vector+float*! + (-> arg1 normal) + (-> s1-1 ground-normal) + (-> arg1 tmp) + (- (vector-dot (-> s1-1 ground-normal) (-> arg1 tmp))) + ) + (let ((v1-80 (-> arg1 force)) + (a0-45 (-> arg1 normal)) + (f0-37 (* 2.0 f28-1)) + (f1-17 arg0) ) - (set! (-> arg1 tmp y) 0.0) - (set! (-> arg1 tmp x) (-> arg1 velocity z)) - (set! (-> arg1 tmp z) (- (-> arg1 velocity x))) - (vector-normalize! (-> arg1 tmp) 1.0) - (vector+float*! - (-> arg1 normal) - (-> s1-1 ground-normal) - (-> arg1 tmp) - (- (vector-dot (-> s1-1 ground-normal) (-> arg1 tmp))) - ) - (let ((v1-80 (-> arg1 force)) - (a0-45 (-> arg1 normal)) - (f0-37 (* 2.0 f28-1)) - (f1-17 arg0) - ) - (vector-float*! v1-80 a0-45 (* f0-37 - (/ 1.0 f1-17) - (-> this info physics-model inv-lift-thruster-count) - (-> this info info mass) - (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> arg1 normal)))) - ) - ) - ) - (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) - (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) - (let ((f0-51 (* 8.0 - (-> this info info mass) - (-> this info extra gravity) - (-> this info physics-model inv-lift-thruster-count) - (+ (* (-> this info handling spring-lift-factor) f28-1) - (* 0.75 (-> this jump-thrust) (-> this info handling jump-thrust-factor)) - ) - (- (+ 1.0 (* 2.0 (rand-vu) (-> this power-fluctuation-factor))) (-> this power-fluctuation-factor)) + (vector-float*! v1-80 a0-45 (* f0-37 + (/ 1.0 f1-17) + (-> this info physics-model inv-lift-thruster-count) + (-> this info info mass) + (fmax 0.0 (- (vector-dot (-> arg1 velocity) (-> arg1 normal)))) + ) ) - ) - ) - (+! (-> this lift-thrust s2-1) f0-51) - (vector-float*! (-> arg1 force) (-> arg1 lift-dir) (* -1.0 f0-51)) - ) ) (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) - (when (and (< 0.0 (-> this info handling tire-friction-factor)) (let ((f0-54 0.0)) - (.lvf vf1 (&-> (-> s1-1 ground-normal) 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-107 vf1) - (< f0-54 v1-107) - ) - ) - (vector+float*! - (-> arg1 normal) - (-> s1-1 wheel-axis) - (-> s1-1 ground-normal) - (- (vector-dot (-> s1-1 wheel-axis) (-> s1-1 ground-normal))) - ) - (vector-normalize! (-> arg1 normal) 1.0) - (vector-copy! (-> arg1 world-pos) (-> s3-0 position)) - (vector-copy! (-> arg1 velocity) (-> s3-0 lin-velocity)) - (vector-! (-> arg1 p-body) (-> arg1 world-pos) (-> s3-0 position)) - (vector-cross! (-> arg1 tmp) (-> arg1 p-body) (-> arg1 normal)) - (vector-rotate*! (-> arg1 tmp) (-> arg1 tmp) (-> s3-0 inv-i-world)) - (vector-cross! (-> arg1 tmp) (-> arg1 tmp) (-> arg1 p-body)) - (set! (-> arg1 vel-dot-norm) (vector-dot (-> arg1 velocity) (-> arg1 normal))) - (let ((f0-61 (fabs (-> arg1 vel-dot-norm)))) - (set! (-> arg1 friction-coef) - (smooth-interp - (-> this info handling tire-static-friction) - (-> this info handling tire-dynamic-friction) - f0-61 - (-> this info handling tire-static-friction-speed) - (-> this info handling tire-dynamic-friction-speed) - ) - ) - ) - (set! (-> arg1 friction-coef) - (* (-> arg1 friction-coef) (+ 1.0 (* -0.75 (fmax 0.0 (fmin 1.0 (-> this engine-thrust)))))) - ) - (let ((f0-69 (* (-> arg1 friction-coef) - (-> this info handling tire-friction-factor) - (fmax 0.0 (vector-dot (-> s1-1 ground-normal) (-> s1-1 tire-force))) - ) - ) - ) - (set! (-> arg1 impulse) (/ (* -1.0 (-> arg1 vel-dot-norm)) - (* arg0 (+ (-> s3-0 info inv-mass) (vector-dot (-> arg1 normal) (-> arg1 tmp)))) - ) - ) - (set! (-> arg1 impulse) (fmax (fmin (-> arg1 impulse) f0-69) (- f0-69))) - ) - (vector-float*! (-> arg1 force) (-> arg1 normal) (-> arg1 impulse)) - (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + (let ((f0-51 (* 8.0 + (-> this info info mass) + (-> this info extra gravity) + (-> this info physics-model inv-lift-thruster-count) + (+ (* (-> this info handling spring-lift-factor) f28-1) + (* 0.75 (-> this jump-thrust) (-> this info handling jump-thrust-factor)) + ) + (- (+ 1.0 (* 2.0 (rand-vu) (-> this power-fluctuation-factor))) (-> this power-fluctuation-factor)) + ) + ) + ) + (+! (-> this lift-thrust s2-1) f0-51) + (vector-float*! (-> arg1 force) (-> arg1 lift-dir) (* -1.0 f0-51)) ) ) + (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + (vector+! (-> s1-1 tire-force) (-> s1-1 tire-force) (-> arg1 force)) + (when (and (< 0.0 (-> this info handling tire-friction-factor)) + (< 0.0 (vector-length-squared (-> s1-1 ground-normal))) + ) + (vector+float*! + (-> arg1 normal) + (-> s1-1 wheel-axis) + (-> s1-1 ground-normal) + (- (vector-dot (-> s1-1 wheel-axis) (-> s1-1 ground-normal))) + ) + (vector-normalize! (-> arg1 normal) 1.0) + (vector-copy! (-> arg1 world-pos) (-> s3-0 position)) + (vector-copy! (-> arg1 velocity) (-> s3-0 lin-velocity)) + (vector-! (-> arg1 p-body) (-> arg1 world-pos) (-> s3-0 position)) + (vector-cross! (-> arg1 tmp) (-> arg1 p-body) (-> arg1 normal)) + (vector-rotate*! (-> arg1 tmp) (-> arg1 tmp) (-> s3-0 inv-i-world)) + (vector-cross! (-> arg1 tmp) (-> arg1 tmp) (-> arg1 p-body)) + (set! (-> arg1 vel-dot-norm) (vector-dot (-> arg1 velocity) (-> arg1 normal))) + (let ((f0-61 (fabs (-> arg1 vel-dot-norm)))) + (set! (-> arg1 friction-coef) + (smooth-interp + (-> this info handling tire-static-friction) + (-> this info handling tire-dynamic-friction) + f0-61 + (-> this info handling tire-static-friction-speed) + (-> this info handling tire-dynamic-friction-speed) + ) + ) + ) + (set! (-> arg1 friction-coef) + (* (-> arg1 friction-coef) (+ 1.0 (* -0.75 (fmax 0.0 (fmin 1.0 (-> this engine-thrust)))))) + ) + (let ((f0-69 (* (-> arg1 friction-coef) + (-> this info handling tire-friction-factor) + (fmax 0.0 (vector-dot (-> s1-1 ground-normal) (-> s1-1 tire-force))) + ) + ) + ) + (set! (-> arg1 impulse) (/ (* -1.0 (-> arg1 vel-dot-norm)) + (* arg0 (+ (-> s3-0 info inv-mass) (vector-dot (-> arg1 normal) (-> arg1 tmp)))) + ) + ) + (set! (-> arg1 impulse) (fmax (fmin (-> arg1 impulse) f0-69) (- f0-69))) + ) + (vector-float*! (-> arg1 force) (-> arg1 normal) (-> arg1 impulse)) + (apply-impact! s3-0 (-> arg1 world-pos) (-> arg1 force)) + ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 162 of type h-glider @@ -911,408 +882,382 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod apply-gravity! ((this h-glider) (arg0 float)) - (local-vars (v1-15 float) (v1-267 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (h-glider-method-162 this) - (set! (-> *game-info* health-bar-vehicle) - (fmax 0.0 (fmin 1.0 (* 0.0000032552084 (+ -49152.0 (-> this speed))))) - ) - (if (-> this lost-lift?) - (set! (-> *game-info* health-bar-vehicle) 0.0) + (h-glider-method-162 this) + (set! (-> *game-info* health-bar-vehicle) + (fmax 0.0 (fmin 1.0 (* 0.0000032552084 (+ -49152.0 (-> this speed))))) ) - (let ((s3-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (when (and (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (begin - (.lvf vf1 (&-> (-> this rbody lin-momentum) 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) - (= v1-15 0.0) - ) - ) - (vector-copy! (-> this rbody lin-momentum) (-> this rbody matrix fvec)) - (vector-normalize! - (-> this rbody lin-momentum) - (if (task-node-closed? (game-task-node desert-glide-templetop)) - 153600.0 - 101376.01 - ) - ) - (vector-float*! (-> this rbody lin-momentum) (-> this rbody lin-momentum) (-> this rbody info mass)) + (if (-> this lost-lift?) + (set! (-> *game-info* health-bar-vehicle) 0.0) + ) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) ) - (when (and (logtest? (-> this v-flags) (vehicle-flag dead)) (not (-> this deathspin))) - (set! (-> this rbody info angular-damping) 1.0) - (set! (-> this hit-points) -1.0) - (logior! (-> this v-flags) (vehicle-flag dead)) - (set! (-> this deathspin) #t) - (set-vector! s3-0 4096.0 0.0 0.0 1.0) + (when (and (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (= (vector-length-squared (-> this rbody lin-momentum)) 0.0) + ) + (vector-copy! (-> this rbody lin-momentum) (-> this rbody matrix fvec)) + (vector-normalize! + (-> this rbody lin-momentum) + (if (task-node-closed? (game-task-node desert-glide-templetop)) + 153600.0 + 101376.01 + ) + ) + (vector-float*! (-> this rbody lin-momentum) (-> this rbody lin-momentum) (-> this rbody info mass)) + ) + (when (and (logtest? (-> this v-flags) (vehicle-flag dead)) (not (-> this deathspin))) + (set! (-> this rbody info angular-damping) 1.0) + (set! (-> this hit-points) -1.0) + (logior! (-> this v-flags) (vehicle-flag dead)) + (set! (-> this deathspin) #t) + (set-vector! s3-0 4096.0 0.0 0.0 1.0) + (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) + (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) + (vector-float*! s4-0 (-> this rbody matrix uvec) (* 4096.0 (rand-vu-float-range -40000.0 40000.0))) + (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) + ) + (let ((s2-3 (new 'stack-no-clear 'vehicle-physics-work))) + (when (and (< 0.0 (-> this rbody matrix uvec y)) (logtest? (-> this v-flags) (vehicle-flag riding))) + (matrix-transpose! (-> s2-3 mat) (-> this rbody matrix)) + (set! (-> s2-3 velocity x) (* 0.0000073242186 (-> this speed) (-> this controls steering))) + (vector-reset! s3-0) (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) - (vector-float*! s4-0 (-> this rbody matrix uvec) (* 4096.0 (rand-vu-float-range -40000.0 40000.0))) + (+! (-> s3-0 z) 4096.0) + (vector-copy! (-> s2-3 force) *x-vector*) + (let ((f0-20 (* 0.00024414062 (vector-length (-> this rbody lin-velocity))))) + (set! (-> s2-3 velocity z) (/ 1.0 f0-20)) + ) + (set! (-> s2-3 velocity z) (fmin 0.1 (-> s2-3 velocity z))) + (set! (-> s2-3 velocity z) (* 24576000.0 (-> s2-3 velocity z) (-> s2-3 velocity x))) + (vector-float*! s4-0 (-> s2-3 force) (-> s2-3 velocity z)) (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) ) - (let ((s2-3 (new 'stack-no-clear 'vehicle-physics-work))) - (when (and (< 0.0 (-> this rbody matrix uvec y)) (logtest? (-> this v-flags) (vehicle-flag riding))) - (matrix-transpose! (-> s2-3 mat) (-> this rbody matrix)) - (set! (-> s2-3 velocity x) (* 0.0000073242186 (-> this speed) (-> this controls steering))) - (vector-reset! s3-0) - (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) - (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) - (+! (-> s3-0 z) 4096.0) - (vector-copy! (-> s2-3 force) *x-vector*) - (let ((f0-20 (* 0.00024414062 (vector-length (-> this rbody lin-velocity))))) - (set! (-> s2-3 velocity z) (/ 1.0 f0-20)) - ) - (set! (-> s2-3 velocity z) (fmin 0.1 (-> s2-3 velocity z))) - (set! (-> s2-3 velocity z) (* 24576000.0 (-> s2-3 velocity z) (-> s2-3 velocity x))) - (vector-float*! s4-0 (-> s2-3 force) (-> s2-3 velocity z)) - (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) - ) - (when #f - (let ((f0-29 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 1.0))) - (set! (-> this rolling) #f) - (when (!= f0-29 0.0) - (set! (-> this rolling) #t) - (vector-float*! s4-0 (-> this rbody matrix uvec) (* 4096000.0 f0-29)) - (set-vector! s3-0 4096.0 0.0 0.0 1.0) - (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) - (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) - (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) - ) - ) - ) - 0.0 - 0.0 - (let ((f1-14 (-> this speed))) - (set! (-> s2-3 velocity z) (-> this controls steering)) - (let ((f30-1 (fmax 0.0 (fmin 1.0 (* 0.000012207031 (+ -20480.0 f1-14)))))) - (when (and (< 0.2 (fabs (* f30-1 (-> s2-3 velocity z)))) (time-elapsed? (-> this pitch-side-time) (seconds 2))) - (set-time! (-> this pitch-side-time)) - (sound-play "pitch-horizontl") - ) - (matrix-rotate-z! (-> s2-3 mat) (* 16384.0 (-> s2-3 velocity z) f30-1)) - ) - ) - (matrix*! (-> s2-3 mat) (-> s2-3 mat) (-> this rbody matrix)) - (set! (-> s2-3 velocity x) (- (-> s2-3 mat rvec y))) - (set! (-> s2-3 velocity y) (- (-> s2-3 velocity x) (-> this rollerr))) - (set! (-> this rollerr) (-> s2-3 velocity x)) - (let ((f30-2 (+ (* 24576000.0 (-> s2-3 velocity y)) (* 409600.0 (-> s2-3 velocity x))))) - (set-vector! s3-0 4096.0 0.0 0.0 1.0) - 0.0 - (let ((s1-3 (new 'stack-no-clear 'matrix))) - (let ((f0-56 (* 16384.0 (fmax -1.0 (fmin 1.0 (* (/ (-> this rbody ang-velocity y) (meters 200000)) (fabs f30-2)))))) - ) - (matrix-rotate-y! s1-3 f0-56) - ) - (vector-rotate*! s3-0 s3-0 s1-3) - ) - (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) - (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) - (vector-float*! s4-0 (-> this rbody matrix uvec) f30-2) - ) - (if (and (>= 1 (-> this force-level)) (not (-> this rolling))) + (when #f + (let ((f0-29 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 1.0))) + (set! (-> this rolling) #f) + (when (!= f0-29 0.0) + (set! (-> this rolling) #t) + (vector-float*! s4-0 (-> this rbody matrix uvec) (* 4096000.0 f0-29)) + (set-vector! s3-0 4096.0 0.0 0.0 1.0) + (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) + (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) ) - (if (>= (-> this force-level) 1) - (set! (-> this curalt) (-> this rbody matrix trans y)) - ) - (when #t - (set! (-> this speed) (vector-dot (-> this rbody lin-velocity) (-> this rbody matrix fvec))) - 0.0 - (let* ((v1-124 (-> this rbody lin-velocity)) - (f28-0 (sqrtf (+ (* (-> v1-124 x) (-> v1-124 x)) (* (-> v1-124 z) (-> v1-124 z))))) - (f30-3 (fmax 0.0 (fmin 1.0 (* 0.000030517578 (+ -4096.0 f28-0))))) - ) - (let ((t9-20 atan) - (a0-53 (-> this rbody lin-velocity y)) - (v1-131 (-> this rbody lin-velocity)) - ) - (set! (-> s2-3 velocity x) - (* f30-3 (t9-20 a0-53 (sqrtf (+ (* (-> v1-131 x) (-> v1-131 x)) (* (-> v1-131 z) (-> v1-131 z)))))) - ) - ) - (if (< 15473.777 (-> s2-3 velocity x)) - (set! (-> s2-3 velocity x) 15473.777) - ) - (if (< (-> s2-3 velocity x) -15473.777) - (set! (-> s2-3 velocity x) -15473.777) - ) - (cond - ((< (vector-dot (-> this rbody matrix fvec) (-> this rbody lin-velocity)) -16384.0) - (set! (-> s2-3 velocity x) (- (-> s2-3 velocity x))) - (set! (-> this curalt) - (- (-> this curalt) - (* (-> this controls lean-z) (+ (* -8192.0 (seconds-per-frame)) (* -0.1 (seconds-per-frame) f28-0))) - ) - ) - ) - (else - (+! (-> this curalt) - (* (-> this controls lean-z) (+ (* -8192.0 (seconds-per-frame)) (* -0.1 (seconds-per-frame) f28-0))) - ) - ) - ) - (when #f - (set-vector! - s4-0 - 0.0 - (* 40.96 (-> this info info mass) (- 1.0 f30-3) (- (-> this curalt) (-> this rbody matrix trans y))) - 0.0 - 1.0 - ) - (add-force! (-> this rbody) s4-0) - ) - ) - (if (< (-> this maxalt) (-> this curalt)) - (set! (-> this curalt) (-> this maxalt)) - ) - (if (< (-> this curalt) (-> this minalt)) - (set! (-> this curalt) (-> this minalt)) - ) - (matrix-rotate-x! (-> s2-3 mat) (-> s2-3 velocity x)) - (matrix*! (-> s2-3 mat) (-> s2-3 mat) (-> this rbody matrix)) - (set! (-> s2-3 velocity x) (-> s2-3 mat fvec y)) - (set! (-> s2-3 velocity y) (- (-> s2-3 velocity x) (-> this pitcherr))) - (set! (-> this pitcherr) (-> s2-3 velocity x)) - (set-vector! s3-0 0.0 0.0 4096.0 1.0) - (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) - (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) - (vector-float*! - s4-0 - (-> this rbody matrix uvec) - (- (+ (* 196608000.0 (-> s2-3 velocity y)) (* 1638400.0 (-> s2-3 velocity x)))) - ) - (if (and (not (-> this rolling)) - (or (logtest? (-> this v-flags) (vehicle-flag dead)) (>= 1 (-> this force-level))) - (>= (-> this speed) 0.0) - ) - (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) - ) ) ) - (when (< (-> this maxalt) (-> this rbody matrix trans y)) - (vector-float*! s4-0 *up-vector* (* -2000.0 (- (-> this rbody matrix trans y) (-> this maxalt)))) - (add-force! (-> this rbody) s4-0) - ) - (when (and (< (-> this rbody matrix trans y) (-> this minalt)) - (not (logtest? (-> this v-flags) (vehicle-flag dead))) - ) - (when (< (-> this speed) 0.0) - (set! (-> this hit-points) -1.0) - (logior! (-> this v-flags) (vehicle-flag dead)) - ) - (vector-float*! s4-0 *up-vector* (* -2000.0 (- (-> this rbody matrix trans y) (-> this minalt)))) - (add-force! (-> this rbody) s4-0) - ) - (let ((f0-118 (-> this speed))) - (-> this controls throttle) - (-> this controls brake) - 0.0 - 0.0 - (let* ((f1-66 0.0) - (f2-20 0.0) - (f4-8 (* 0.000024414063 (+ -4096.0 f0-118))) - (f4-10 (fmax 0.0 (fmin 1.0 f4-8))) - (f1-68 (* 819200.0 (- f1-66 (* 4.0 f4-10 f2-20)))) - ) - (if (and (< 307200.0 f0-118) (< 0.0 f1-68)) - (set! f1-68 0.0) - ) - (when (< f0-118 307200.0) - (if (not (time-elapsed? (-> this in-thermal-time) (seconds 1))) - (set! f1-68 (* 44.85294 (- 307200.0 f0-118))) - ) - ) - (if (and (-> this full-speed-boost?) (or (>= f0-118 307200.0) (>= f0-118 286720.0))) - (set! (-> this full-speed-boost?) #f) - ) - (if (and (-> this full-speed-boost?) (< f0-118 307200.0)) - (set! f1-68 4096000.0) - ) - (vector-float*! s4-0 (-> this rbody matrix fvec) f1-68) - ) - ) - (if (and (logtest? (-> this v-flags) (vehicle-flag riding)) - (not (logtest? (-> this v-flags) (vehicle-flag dead))) - ) - (add-force! (-> this rbody) s4-0) - ) - (vector-float*! s4-0 (-> this rbody lin-velocity) (- (-> this info handling drag-force-factor))) - (add-force! (-> this rbody) s4-0) - (let ((s3-1 (new 'stack-no-clear 'vector))) - 0.0 - (let ((f30-4 (glider-impact-reduction (the-as time-frame (-> this impact-time))))) - (vector-copy! s3-1 (-> this rbody matrix rvec)) - (set! (-> s3-1 y) 0.0000000001) - (vector-normalize! s3-1 1.0) - (vector-float*! - s4-0 - (-> this rbody matrix rvec) - (* -512.0 (vector-dot (-> this rbody lin-velocity) s3-1) f30-4) - ) - ) - ) - (set! (-> s4-0 y) 0.0) - (if (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (add-force! (-> this rbody) s4-0) - ) - (when (not (-> this amb-sound-playing)) - (set! (-> this amb-sound-playing) #t) - (sound-play "ambient-loop" :id (-> this amb-sound)) - ) - (when (time-elapsed? (-> this ambient-wind-sound-time) (the int (* 300.0 (rand-vu-float-range 3.0 5.0)))) - (set-time! (-> this ambient-wind-sound-time)) - (sound-play-by-name - (static-sound-name "windgusts") - (new-sound-id) - 1024 - (the int (* 1524.0 (rand-vu-float-range 0.8 1.2))) - 0 - (sound-group) - #t - ) - ) - (let ((f0-133 0.0)) - (.lvf vf1 (&-> (-> this progression-plane) 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-267 vf1) - (if (and (< f0-133 v1-267) - (< (vector-dot (-> this progression-plane) (-> this root trans)) (+ -4096.0 (-> this progression-plane w))) - ) - (desert-glide-task-done) - ) - ) - (vector-reset! s4-0) 0.0 - (let ((f0-137 (-> this controls lean-z))) - (when (-> this in-thermal) - (let ((f0-139 (* -1.0 (-> this thermal-strength)))) - (set! f0-137 (fmax -1.0 (fmin 1.0 f0-139))) + 0.0 + (let ((f1-14 (-> this speed))) + (set! (-> s2-3 velocity z) (-> this controls steering)) + (let ((f30-1 (fmax 0.0 (fmin 1.0 (* 0.000012207031 (+ -20480.0 f1-14)))))) + (when (and (< 0.2 (fabs (* f30-1 (-> s2-3 velocity z)))) (time-elapsed? (-> this pitch-side-time) (seconds 2))) + (set-time! (-> this pitch-side-time)) + (sound-play "pitch-horizontl") ) + (matrix-rotate-z! (-> s2-3 mat) (* 16384.0 (-> s2-3 velocity z) f30-1)) ) - (when (-> this lost-lift?) - (if (time-elapsed? (-> this lost-lift-time) (seconds 3)) - (desert-glide-task-done) - ) - (set! f0-137 1.0) + ) + (matrix*! (-> s2-3 mat) (-> s2-3 mat) (-> this rbody matrix)) + (set! (-> s2-3 velocity x) (- (-> s2-3 mat rvec y))) + (set! (-> s2-3 velocity y) (- (-> s2-3 velocity x) (-> this rollerr))) + (set! (-> this rollerr) (-> s2-3 velocity x)) + (let ((f30-2 (+ (* 24576000.0 (-> s2-3 velocity y)) (* 409600.0 (-> s2-3 velocity x))))) + (set-vector! s3-0 4096.0 0.0 0.0 1.0) + 0.0 + (let ((s1-3 (new 'stack-no-clear 'matrix))) + (let ((f0-56 (* 16384.0 (fmax -1.0 (fmin 1.0 (* (/ (-> this rbody ang-velocity y) (meters 200000)) (fabs f30-2)))))) + ) + (matrix-rotate-y! s1-3 f0-56) + ) + (vector-rotate*! s3-0 s3-0 s1-3) ) - (if (-> this in-thermal) - (set-time! (-> this in-thermal-time)) - ) - (if (and (< 32768.0 (-> this speed)) (or (-> this in-thermal) - (not (time-elapsed? (-> this in-thermal-time) (seconds 4))) - (-> this full-speed-boost?) - (logtest? (vehicle-flag turbo-boost) (-> this v-flags)) - ) - ) - (set! (-> this lost-lift?) #f) - ) - (let ((f1-80 (* -20.0 f0-137 (fabs (-> this speed))))) - (if (and (not (-> this in-thermal)) (< (-> this speed) 32768.0) (< f0-137 0.0)) - (set! f1-80 (* 0.00024414062 (+ -28672.0 (-> this speed)) f1-80)) - ) - (when (and (not (-> this lost-lift?)) (and (< (-> this speed) 49152.0) (time-elapsed? (-> this birth) (seconds 4)))) - (set! (-> this lost-lift?) #t) - (set-time! (-> this lost-lift-time)) - ) - (cond - ((< 0.0 f0-137) - (set! (-> s4-0 y) (+ (* -20.0 (-> this rbody lin-velocity y)) f1-80)) - (when (and (< 0.7 f0-137) (time-elapsed? (-> this pitch-down-time) (seconds 2))) - (set-time! (-> this pitch-down-time)) - (sound-play "pitchglider") + (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) + (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) + (vector-float*! s4-0 (-> this rbody matrix uvec) f30-2) + ) + (if (and (>= 1 (-> this force-level)) (not (-> this rolling))) + (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) + ) + (if (>= (-> this force-level) 1) + (set! (-> this curalt) (-> this rbody matrix trans y)) + ) + (when #t + (set! (-> this speed) (vector-dot (-> this rbody lin-velocity) (-> this rbody matrix fvec))) + 0.0 + (let* ((v1-124 (-> this rbody lin-velocity)) + (f28-0 (sqrtf (+ (* (-> v1-124 x) (-> v1-124 x)) (* (-> v1-124 z) (-> v1-124 z))))) + (f30-3 (fmax 0.0 (fmin 1.0 (* 0.000030517578 (+ -4096.0 f28-0))))) ) + (let ((t9-20 atan) + (a0-53 (-> this rbody lin-velocity y)) + (v1-131 (-> this rbody lin-velocity)) + ) + (set! (-> s2-3 velocity x) + (* f30-3 (t9-20 a0-53 (sqrtf (+ (* (-> v1-131 x) (-> v1-131 x)) (* (-> v1-131 z) (-> v1-131 z)))))) + ) + ) + (if (< 15473.777 (-> s2-3 velocity x)) + (set! (-> s2-3 velocity x) 15473.777) + ) + (if (< (-> s2-3 velocity x) -15473.777) + (set! (-> s2-3 velocity x) -15473.777) + ) + (cond + ((< (vector-dot (-> this rbody matrix fvec) (-> this rbody lin-velocity)) -16384.0) + (set! (-> s2-3 velocity x) (- (-> s2-3 velocity x))) + (set! (-> this curalt) + (- (-> this curalt) + (* (-> this controls lean-z) (+ (* -8192.0 (seconds-per-frame)) (* -0.1 (seconds-per-frame) f28-0))) + ) + ) ) (else - (set! (-> s4-0 y) (+ (* -20.0 (-> this rbody lin-velocity y)) f1-80)) - ) - ) - ) - ) - (when #t - (let ((s3-5 (new 'stack-no-clear 'vector)) - (s2-6 (new 'stack-no-clear 'vector)) - (f28-1 0.0) - ) - 0.0 - (let ((f30-7 (the-as float (-> this info extra gravity)))) - (when (-> this in-thermal) - (when (time-elapsed? (-> this thermal-sound-time) (seconds 3)) - (set-time! (-> this thermal-sound-time)) - (sound-play "thermal") - ) - (set! f30-7 0.0) - (when (< (-> this speed) 32768.0) - (let* ((f0-148 (* 0.00024414062 (+ -28672.0 (-> this speed)) f28-1)) - (f1-88 (* (+ -1.0 f0-148) (-> this info extra gravity))) - ) - (set! f30-7 - (+ (-> this info extra gravity) (* (-> this thermal-strength) (- f1-88 (-> this info extra gravity)))) - ) + (+! (-> this curalt) + (* (-> this controls lean-z) (+ (* -8192.0 (seconds-per-frame)) (* -0.1 (seconds-per-frame) f28-0))) ) - ) ) - (when (not (logtest? (-> this v-flags) (vehicle-flag dead))) - (vector-copy! s3-5 (-> this rbody lin-velocity)) - (vector-normalize! s3-5 1.0) - (let ((f0-152 (vector-dot s3-5 s4-0))) - (vector-float*! s2-6 s3-5 f0-152) - ) - (vector-! s4-0 s4-0 s2-6) - (add-force! (-> this rbody) s4-0) - (vector-copy! s3-5 (-> this rbody matrix fvec)) - (vector-normalize! s3-5 1.0) - (vector-float*! s4-0 *up-vector* (* -1.0 (-> this info info mass) f30-7)) - (let ((f0-157 (vector-dot s3-5 s4-0))) - (vector-float*! s4-0 s3-5 f0-157) - ) - (add-force! (-> this rbody) s4-0) - (vector-copy! s3-5 (-> this rbody matrix uvec)) - (vector-normalize! s3-5 1.0) - (vector-float*! s4-0 *up-vector* (* -0.12 (-> this info info mass) f30-7)) - (let ((f0-162 (vector-dot s3-5 s4-0))) - (vector-float*! s4-0 s3-5 f0-162) - ) - (add-force! (-> this rbody) s4-0) + ) + (when #f + (set-vector! + s4-0 + 0.0 + (* 40.96 (-> this info info mass) (- 1.0 f30-3) (- (-> this curalt) (-> this rbody matrix trans y))) + 0.0 + 1.0 ) + (add-force! (-> this rbody) s4-0) + ) + ) + (if (< (-> this maxalt) (-> this curalt)) + (set! (-> this curalt) (-> this maxalt)) + ) + (if (< (-> this curalt) (-> this minalt)) + (set! (-> this curalt) (-> this minalt)) + ) + (matrix-rotate-x! (-> s2-3 mat) (-> s2-3 velocity x)) + (matrix*! (-> s2-3 mat) (-> s2-3 mat) (-> this rbody matrix)) + (set! (-> s2-3 velocity x) (-> s2-3 mat fvec y)) + (set! (-> s2-3 velocity y) (- (-> s2-3 velocity x) (-> this pitcherr))) + (set! (-> this pitcherr) (-> s2-3 velocity x)) + (set-vector! s3-0 0.0 0.0 4096.0 1.0) + (vector+! s3-0 s3-0 (-> this info info cm-offset-joint)) + (vector-matrix*! s3-0 s3-0 (-> this rbody matrix)) + (vector-float*! + s4-0 + (-> this rbody matrix uvec) + (- (+ (* 196608000.0 (-> s2-3 velocity y)) (* 1638400.0 (-> s2-3 velocity x)))) + ) + (if (and (not (-> this rolling)) + (or (logtest? (-> this v-flags) (vehicle-flag dead)) (>= 1 (-> this force-level))) + (>= (-> this speed) 0.0) + ) + (rigid-body-control-method-22 (-> this rbody) s3-0 s4-0) + ) + ) + ) + (when (< (-> this maxalt) (-> this rbody matrix trans y)) + (vector-float*! s4-0 *up-vector* (* -2000.0 (- (-> this rbody matrix trans y) (-> this maxalt)))) + (add-force! (-> this rbody) s4-0) + ) + (when (and (< (-> this rbody matrix trans y) (-> this minalt)) + (not (logtest? (-> this v-flags) (vehicle-flag dead))) + ) + (when (< (-> this speed) 0.0) + (set! (-> this hit-points) -1.0) + (logior! (-> this v-flags) (vehicle-flag dead)) + ) + (vector-float*! s4-0 *up-vector* (* -2000.0 (- (-> this rbody matrix trans y) (-> this minalt)))) + (add-force! (-> this rbody) s4-0) + ) + (let ((f0-118 (-> this speed))) + (-> this controls throttle) + (-> this controls brake) + 0.0 + 0.0 + (let* ((f1-66 0.0) + (f2-20 0.0) + (f4-8 (* 0.000024414063 (+ -4096.0 f0-118))) + (f4-10 (fmax 0.0 (fmin 1.0 f4-8))) + (f1-68 (* 819200.0 (- f1-66 (* 4.0 f4-10 f2-20)))) + ) + (if (and (< 307200.0 f0-118) (< 0.0 f1-68)) + (set! f1-68 0.0) + ) + (when (< f0-118 307200.0) + (if (not (time-elapsed? (-> this in-thermal-time) (seconds 1))) + (set! f1-68 (* 44.85294 (- 307200.0 f0-118))) + ) + ) + (if (and (-> this full-speed-boost?) (or (>= f0-118 307200.0) (>= f0-118 286720.0))) + (set! (-> this full-speed-boost?) #f) + ) + (if (and (-> this full-speed-boost?) (< f0-118 307200.0)) + (set! f1-68 4096000.0) + ) + (vector-float*! s4-0 (-> this rbody matrix fvec) f1-68) + ) + ) + (if (and (logtest? (-> this v-flags) (vehicle-flag riding)) + (not (logtest? (-> this v-flags) (vehicle-flag dead))) + ) + (add-force! (-> this rbody) s4-0) + ) + (vector-float*! s4-0 (-> this rbody lin-velocity) (- (-> this info handling drag-force-factor))) + (add-force! (-> this rbody) s4-0) + (let ((s3-1 (new 'stack-no-clear 'vector))) + 0.0 + (let ((f30-4 (glider-impact-reduction (the-as time-frame (-> this impact-time))))) + (vector-copy! s3-1 (-> this rbody matrix rvec)) + (set! (-> s3-1 y) 0.0000000001) + (vector-normalize! s3-1 1.0) + (vector-float*! + s4-0 + (-> this rbody matrix rvec) + (* -512.0 (vector-dot (-> this rbody lin-velocity) s3-1) f30-4) + ) + ) + ) + (set! (-> s4-0 y) 0.0) + (if (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (add-force! (-> this rbody) s4-0) + ) + (when (not (-> this amb-sound-playing)) + (set! (-> this amb-sound-playing) #t) + (sound-play "ambient-loop" :id (-> this amb-sound)) + ) + (when (time-elapsed? (-> this ambient-wind-sound-time) (the int (* 300.0 (rand-vu-float-range 3.0 5.0)))) + (set-time! (-> this ambient-wind-sound-time)) + (sound-play-by-name + (static-sound-name "windgusts") + (new-sound-id) + 1024 + (the int (* 1524.0 (rand-vu-float-range 0.8 1.2))) + 0 + (sound-group) + #t + ) + ) + (if (and (< 0.0 (vector-length-squared (-> this progression-plane))) + (< (vector-dot (-> this progression-plane) (-> this root trans)) (+ -4096.0 (-> this progression-plane w))) + ) + (desert-glide-task-done) + ) + (vector-reset! s4-0) + 0.0 + (let ((f0-137 (-> this controls lean-z))) + (when (-> this in-thermal) + (let ((f0-139 (* -1.0 (-> this thermal-strength)))) + (set! f0-137 (fmax -1.0 (fmin 1.0 f0-139))) + ) + ) + (when (-> this lost-lift?) + (if (time-elapsed? (-> this lost-lift-time) (seconds 3)) + (desert-glide-task-done) + ) + (set! f0-137 1.0) + ) + (if (-> this in-thermal) + (set-time! (-> this in-thermal-time)) + ) + (if (and (< 32768.0 (-> this speed)) (or (-> this in-thermal) + (not (time-elapsed? (-> this in-thermal-time) (seconds 4))) + (-> this full-speed-boost?) + (logtest? (vehicle-flag turbo-boost) (-> this v-flags)) + ) + ) + (set! (-> this lost-lift?) #f) + ) + (let ((f1-80 (* -20.0 f0-137 (fabs (-> this speed))))) + (if (and (not (-> this in-thermal)) (< (-> this speed) 32768.0) (< f0-137 0.0)) + (set! f1-80 (* 0.00024414062 (+ -28672.0 (-> this speed)) f1-80)) + ) + (when (and (not (-> this lost-lift?)) (and (< (-> this speed) 49152.0) (time-elapsed? (-> this birth) (seconds 4)))) + (set! (-> this lost-lift?) #t) + (set-time! (-> this lost-lift-time)) + ) + (cond + ((< 0.0 f0-137) + (set! (-> s4-0 y) (+ (* -20.0 (-> this rbody lin-velocity y)) f1-80)) + (when (and (< 0.7 f0-137) (time-elapsed? (-> this pitch-down-time) (seconds 2))) + (set-time! (-> this pitch-down-time)) + (sound-play "pitchglider") + ) + ) + (else + (set! (-> s4-0 y) (+ (* -20.0 (-> this rbody lin-velocity y)) f1-80)) ) ) ) - (when (logtest? (-> this v-flags) (vehicle-flag dead)) - (let* ((f2-47 (fmax 1.0 (* 0.00024414062 (vector-length (-> this rbody lin-velocity))))) - (f0-165 (+ -1.5 (* 50.0 (/ 1.0 f2-47)))) - ) - (if (logtest? (-> this v-flags) (vehicle-flag dead)) - (set! f0-165 2.0) + ) + (when #t + (let ((s3-5 (new 'stack-no-clear 'vector)) + (s2-6 (new 'stack-no-clear 'vector)) + (f28-1 0.0) + ) + 0.0 + (let ((f30-7 (the-as float (-> this info extra gravity)))) + (when (-> this in-thermal) + (when (time-elapsed? (-> this thermal-sound-time) (seconds 3)) + (set-time! (-> this thermal-sound-time)) + (sound-play "thermal") + ) + (set! f30-7 0.0) + (when (< (-> this speed) 32768.0) + (let* ((f0-148 (* 0.00024414062 (+ -28672.0 (-> this speed)) f28-1)) + (f1-88 (* (+ -1.0 f0-148) (-> this info extra gravity))) + ) + (set! f30-7 + (+ (-> this info extra gravity) (* (-> this thermal-strength) (- f1-88 (-> this info extra gravity)))) + ) + ) + ) + ) + (when (not (logtest? (-> this v-flags) (vehicle-flag dead))) + (vector-copy! s3-5 (-> this rbody lin-velocity)) + (vector-normalize! s3-5 1.0) + (let ((f0-152 (vector-dot s3-5 s4-0))) + (vector-float*! s2-6 s3-5 f0-152) + ) + (vector-! s4-0 s4-0 s2-6) + (add-force! (-> this rbody) s4-0) + (vector-copy! s3-5 (-> this rbody matrix fvec)) + (vector-normalize! s3-5 1.0) + (vector-float*! s4-0 *up-vector* (* -1.0 (-> this info info mass) f30-7)) + (let ((f0-157 (vector-dot s3-5 s4-0))) + (vector-float*! s4-0 s3-5 f0-157) + ) + (add-force! (-> this rbody) s4-0) + (vector-copy! s3-5 (-> this rbody matrix uvec)) + (vector-normalize! s3-5 1.0) + (vector-float*! s4-0 *up-vector* (* -0.12 (-> this info info mass) f30-7)) + (let ((f0-162 (vector-dot s3-5 s4-0))) + (vector-float*! s4-0 s3-5 f0-162) ) - (when (< 0.0 f0-165) - (vector-float*! s4-0 *up-vector* (* -1.0 (-> this info info mass) (-> this info extra gravity) f0-165)) (add-force! (-> this rbody) s4-0) ) ) ) ) - (let ((a2-19 (new 'stack-no-clear 'vehicle-physics-work))) - (vehicle-method-97 this arg0 a2-19) + (when (logtest? (-> this v-flags) (vehicle-flag dead)) + (let* ((f2-47 (fmax 1.0 (* 0.00024414062 (vector-length (-> this rbody lin-velocity))))) + (f0-165 (+ -1.5 (* 50.0 (/ 1.0 f2-47)))) + ) + (if (logtest? (-> this v-flags) (vehicle-flag dead)) + (set! f0-165 2.0) + ) + (when (< 0.0 f0-165) + (vector-float*! s4-0 *up-vector* (* -1.0 (-> this info info mass) (-> this info extra gravity) f0-165)) + (add-force! (-> this rbody) s4-0) + ) + ) ) - 0 - (none) ) + (let ((a2-19 (new 'stack-no-clear 'vehicle-physics-work))) + (vehicle-method-97 this arg0 a2-19) + ) + 0 + (none) ) ;; definition for method 30 of type h-glider @@ -1336,48 +1281,24 @@ ;; definition for method 94 of type h-glider (defmethod vehicle-method-94 ((this h-glider)) - (local-vars (v1-2 float) (v1-12 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (cond - (#f - (.lvf vf1 (&-> (-> this 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 v1-2 vf1) - (let ((f0-0 v1-2) - (f1-0 122880.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (vehicle-method-87 this) - ) - ) - ) - (else - (let* ((f0-1 143360.0) - (f0-3 (* f0-1 f0-1)) - ) - (.lvf vf1 (&-> (-> this 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 v1-12 vf1) - (if (< f0-3 v1-12) - (vehicle-method-86 this) - ) - ) + (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) + ) + ) + ) + (else + (let ((f0-1 143360.0)) + (if (< (* f0-1 f0-1) (vector-length-squared (-> this root transv))) + (vehicle-method-86 this) + ) ) ) - ((method-of-type vehicle vehicle-method-94) this) - (none) ) + ((method-of-type vehicle vehicle-method-94) this) + (none) ) 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 5e1bb3ee52..3fdd2669db 100644 --- a/test/decompiler/reference/jak3/levels/gungame/gun-dummy_REF.gc +++ b/test/decompiler/reference/jak3/levels/gungame/gun-dummy_REF.gc @@ -312,14 +312,9 @@ (defmethod check-done? ((this gun-dummy)) (local-vars (at-0 int) (v0-1 symbol)) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) + (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((s5-0 (-> this current)) @@ -450,20 +445,8 @@ (let ((v1-102 (new 'stack-no-clear 'vector))) (vector-copy! v1-102 (-> this root trans)) (vector-float*! (-> this root trans) s2-4 (- 1.0 f28-2)) - (let ((a0-63 (-> this root trans))) - (let ((a1-23 (-> this root trans))) - (let ((a2-17 f28-2)) - (.mov vf7 a2-17) - ) - (.lvf vf5 (&-> s3-4 quad)) - (.lvf vf4 (&-> a1-23 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-63 quad) vf6) - ) - (let ((a0-65 (-> this root transv))) + (vector+*! (-> this root trans) (-> this root trans) s3-4 f28-2) + (let ((a0-66 (-> this root transv))) (.lvf vf1 (&-> (vector-! (new 'stack-no-clear 'vector) (-> this root trans) v1-102) quad)) (let ((f0-50 (-> pp clock frames-per-second))) (.mov at-0 f0-50) @@ -471,7 +454,7 @@ (.mov vf2 at-0) (.mov.vf.w vf1 vf0) (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> a0-65 quad) vf1) + (.svf (&-> a0-66 quad) vf1) ) ) ) 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 72f886af55..cbd237f6c6 100644 --- a/test/decompiler/reference/jak3/levels/gungame/gungame-manager_REF.gc +++ b/test/decompiler/reference/jak3/levels/gungame/gungame-manager_REF.gc @@ -1142,45 +1142,23 @@ ;; definition for method 28 of type gungame-manager ;; INFO: Used lq/sq (defmethod gungame-manager-method-28 ((this gungame-manager) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (vector-copy! (-> s5-0 start-pos) arg0) - (set-vector! (-> s5-0 move-dist) 0.0 -8192.0 0.0 1.0) - (let ((v1-2 s5-0)) - (set! (-> v1-2 radius) 40.96) - (set! (-> v1-2 collide-with) (collide-spec backgnd)) - (set! (-> v1-2 ignore-process0) #f) - (set! (-> v1-2 ignore-process1) #f) - (set! (-> v1-2 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-2 action-mask) (collide-action solid)) - ) - (let ((f0-5 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) - (when (< 0.0 f0-5) - (let ((v0-1 arg0)) - (let ((v1-5 (-> s5-0 move-dist))) - (let ((a0-10 f0-5)) - (.mov vf7 a0-10) - ) - (.lvf vf5 (&-> v1-5 quad)) - ) - (.lvf vf4 (&-> arg0 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 (&-> v0-1 quad) vf6) - v0-1 + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (vector-copy! (-> s5-0 start-pos) arg0) + (set-vector! (-> s5-0 move-dist) 0.0 -8192.0 0.0 1.0) + (let ((v1-2 s5-0)) + (set! (-> v1-2 radius) 40.96) + (set! (-> v1-2 collide-with) (collide-spec backgnd)) + (set! (-> v1-2 ignore-process0) #f) + (set! (-> v1-2 ignore-process1) #f) + (set! (-> v1-2 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) + (set! (-> v1-2 action-mask) (collide-action solid)) + ) + (let ((f0-5 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) + (if (< 0.0 f0-5) + (vector+*! arg0 arg0 (-> s5-0 move-dist) f0-5) ) - ) ) ) ) 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 b5b59201af..40657f514f 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 @@ -661,7 +661,7 @@ (f26-0 (vector-vector-distance gp-2 s5-2)) ) (dotimes (s5-3 8) - (vector-rotate-around-axis! s1-0 (the-as quaternion s4-1) f28-0 s2-0) + (vector-rotate-around-axis! s1-0 s4-1 f28-0 s2-0) (vector-float*! s1-0 s1-0 f26-0) (vector+! (-> s3-1 0 pts s5-3) gp-2 s1-0) (+! f28-0 f30-0) @@ -1468,148 +1468,55 @@ :virtual #t :trans (behavior () (local-vars (sv-48 (pointer lightning-tracker)) (sv-52 sparticle-launcher)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'vector)) - (gp-0 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s5-0 (-> self root trans)) - (vector-copy! gp-0 (-> self root trans)) - (let ((s2-0 s5-0)) - (let ((s4-0 s5-0)) - (let ((s3-0 *x-vector*)) - (let ((v1-2 (rand-vu-float-range -4096.0 4096.0))) - (.mov vf7 v1-2) - ) - (.lvf vf5 (&-> s3-0 quad)) - ) - (.lvf vf4 (&-> s4-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 (&-> s2-0 quad) vf6) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) ) - (let ((s2-1 s5-0)) - (let ((s4-1 s5-0)) - (let ((s3-1 *y-vector*)) - (let ((v1-3 (rand-vu-float-range -4096.0 4096.0))) - (.mov vf7 v1-3) - ) - (.lvf vf5 (&-> s3-1 quad)) - ) - (.lvf vf4 (&-> s4-1 quad)) + (vector-copy! s5-0 (-> self root trans)) + (vector-copy! gp-0 (-> self root trans)) + (vector+*! s5-0 s5-0 *x-vector* (rand-vu-float-range -4096.0 4096.0)) + (vector+*! s5-0 s5-0 *y-vector* (rand-vu-float-range -4096.0 4096.0)) + (vector+*! s5-0 s5-0 *z-vector* (rand-vu-float-range -4096.0 4096.0)) + (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 + ) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> s2-1 quad) vf6) - ) - (let ((s2-2 s5-0)) - (let ((s4-2 s5-0)) - (let ((s3-2 *z-vector*)) - (let ((v1-4 (rand-vu-float-range -4096.0 4096.0))) - (.mov vf7 v1-4) + (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))) ) - (.lvf vf5 (&-> s3-2 quad)) - ) - (.lvf vf4 (&-> s4-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 (&-> s2-2 quad) vf6) - ) - (let ((s2-3 gp-0)) - (let ((s4-3 gp-0)) - (let ((s3-3 *x-vector*)) - (let ((v1-5 (rand-vu-float-range -4096.0 4096.0))) - (.mov vf7 v1-5) + (let ((t9-10 sp-launch-particles-var) + (a0-20 *sp-particle-system-2d*) + (a1-10 sv-52) + (a2-3 *launch-matrix*) ) - (.lvf vf5 (&-> s3-3 quad)) - ) - (.lvf vf4 (&-> s4-3 quad)) + (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) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> s2-3 quad) vf6) - ) - (let ((s2-4 gp-0)) - (let ((s4-4 gp-0)) - (let ((s3-4 *y-vector*)) - (let ((v1-6 (rand-vu-float-range -4096.0 4096.0))) - (.mov vf7 v1-6) + (let ((t9-11 sp-launch-particles-var) + (a0-21 *sp-particle-system-2d*) + (a1-11 sv-52) + (a2-4 *launch-matrix*) ) - (.lvf vf5 (&-> s3-4 quad)) - ) - (.lvf vf4 (&-> s4-4 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 (&-> s2-4 quad) vf6) - ) - (let ((s2-5 gp-0)) - (let ((s4-5 gp-0)) - (let ((s3-5 *z-vector*)) - (let ((v1-7 (rand-vu-float-range -4096.0 4096.0))) - (.mov vf7 v1-7) - ) - (.lvf vf5 (&-> s3-5 quad)) - ) - (.lvf vf4 (&-> s4-5 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 (&-> s2-5 quad) vf6) - ) - (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 - ) - ) - (set! sv-52 (-> *part-id-table* 160)) - (when sv-48 - (set! (-> sv-48 0 user-time 0) 0) - (when sv-52 - (let ((v1-19 (get-field-spec-by-id sv-52 (sp-field-id spt-timer)))) - (if v1-19 - (set! (-> v1-19 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) - ) + (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) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/mine/gekko_REF.gc b/test/decompiler/reference/jak3/levels/mine/gekko_REF.gc index cf638af86f..0801b4e9ea 100644 --- a/test/decompiler/reference/jak3/levels/mine/gekko_REF.gc +++ b/test/decompiler/reference/jak3/levels/mine/gekko_REF.gc @@ -2652,28 +2652,13 @@ ;; INFO: Used lq/sq (defmethod get-knockback-dir! ((this gekko) (arg0 vector)) "Compute the knockback direction for an incoming attack." - (local-vars (v1-2 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (vector-copy! arg0 (-> this incoming attack-direction)) - (.lvf vf1 (&-> arg0 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-2 vf1) - (when (= v1-2 0.0) - (vector-z-quaternion! arg0 (-> this root quat)) - (vector-negate-in-place! arg0) - ) - (vector-flatten! arg0 arg0 (-> this rot-matrix uvec)) - (vector-normalize! arg0 1.0) + (vector-copy! arg0 (-> this incoming attack-direction)) + (when (= (vector-length-squared arg0) 0.0) + (vector-z-quaternion! arg0 (-> this root quat)) + (vector-negate-in-place! arg0) ) + (vector-flatten! arg0 arg0 (-> this rot-matrix uvec)) + (vector-normalize! arg0 1.0) ) ;; definition for method 56 of type gekko 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 13e51e1e27..4161fddecc 100644 --- a/test/decompiler/reference/jak3/levels/mine/prebot-states_REF.gc +++ b/test/decompiler/reference/jak3/levels/mine/prebot-states_REF.gc @@ -73,40 +73,16 @@ ;; definition for function prebot-light-flash ;; INFO: Used lq/sq (defbehavior prebot-light-flash prebot ((arg0 float) (arg1 float) (arg2 float)) - (local-vars (v1-1 float) (a3-2 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((v1-0 (new 'stack-no-clear 'vector))) - (set! (-> v1-0 x) arg0) - (set! (-> v1-0 y) arg1) - (set! (-> v1-0 z) arg2) - (set! (-> v1-0 w) 1.0) - (.lvf vf1 (&-> (-> self light-flash value) 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 a3-2 vf1) - (let ((f0-4 a3-2)) - (.lvf vf1 (&-> v1-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-1 vf1) - (when (< f0-4 v1-1) - (set-vector! (-> self light-flash value) arg0 arg1 arg2 1.0) - (let ((v0-0 (-> self light-flash vel))) - (set! (-> v0-0 quad) (the-as uint128 0)) - v0-0 - ) - ) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (set! (-> v1-0 x) arg0) + (set! (-> v1-0 y) arg1) + (set! (-> v1-0 z) arg2) + (set! (-> v1-0 w) 1.0) + (when (< (vector-length-squared (-> self light-flash value)) (vector-length-squared v1-0)) + (set-vector! (-> self light-flash value) arg0 arg1 arg2 1.0) + (let ((v0-0 (-> self light-flash vel))) + (set! (-> v0-0 quad) (the-as uint128 0)) + v0-0 ) ) ) diff --git a/test/decompiler/reference/jak3/levels/mine/rat_REF.gc b/test/decompiler/reference/jak3/levels/mine/rat_REF.gc index 9e363da092..1f578bcd22 100644 --- a/test/decompiler/reference/jak3/levels/mine/rat_REF.gc +++ b/test/decompiler/reference/jak3/levels/mine/rat_REF.gc @@ -822,7 +822,7 @@ (ja-channel-push! 1 0) (ja-no-eval :group! rat-pipe-jump0-start-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) (vector-v++! (-> self root trans) (-> self root transv)) (suspend) @@ -830,7 +830,7 @@ ) (ja-no-eval :group! rat-pipe-jump0-end-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) (cond ((>= (-> self root gspot-pos y) (-> self root trans y)) 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 4b62a1f4e8..b8c4119114 100644 --- a/test/decompiler/reference/jak3/levels/nest/egg-spider_REF.gc +++ b/test/decompiler/reference/jak3/levels/nest/egg-spider_REF.gc @@ -850,109 +850,79 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod egg-spider-method-194 ((this egg-spider)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s2-0 (as-type (handle->process (-> this focus handle)) process-focusable))) - (when s2-0 - (let ((s3-0 (vector-rotate-around-y! (new 'stack-no-clear 'vector) *z-vector* (-> this angle-spot))) - (s1-0 (get-trans (the-as process-focusable s2-0) 0)) - ) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (let ((s4-0 (get-trans (the-as process-focusable s2-0) 0))) - (let ((s0-0 (get-transv (the-as process-focusable s2-0)))) - (let ((v1-9 (rnd-float-range this 2.0 3.0))) - (.mov vf7 v1-9) - ) - (.lvf vf5 (&-> s0-0 quad)) - ) - (.lvf vf4 (&-> s4-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 (&-> s5-1 quad) vf6) + (let ((s2-0 (as-type (handle->process (-> this focus handle)) process-focusable))) + (when s2-0 + (let ((s3-0 (vector-rotate-around-y! (new 'stack-no-clear 'vector) *z-vector* (-> this angle-spot))) + (s1-0 (get-trans (the-as process-focusable s2-0) 0)) ) - (let* ((s5-2 (new 'stack-no-clear 'vector)) - (s4-2 (vector-! (new 'stack-no-clear 'vector) s1-0 (-> this root trans))) - (f30-0 (vector-length s4-2)) - ) - (let ((f28-0 (vector-vector-distance (-> this root trans) s1-0))) - (new 'stack-no-clear 'vector) - (let ((s1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable s2-0) 0)))) - (set! (-> s4-2 y) 0.0) - (vector-normalize! s4-2 1.0) - (set! (-> s1-2 y) 0.0) - (vector-normalize! s1-2 1.0) - (when (< 0.0 (vector-dot s3-0 s1-2)) - ) - ) - (let ((s1-3 s5-2)) - (let ((v1-21 (get-trans (the-as process-focusable s2-0) 0))) - (let ((a0-20 (+ 40960.0 (* 0.4 f28-0)))) - (.mov vf7 a0-20) - ) - (.lvf vf5 (&-> s3-0 quad)) - (.lvf vf4 (&-> v1-21 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 (&-> s1-3 quad) vf6) + (vector+*! + (new 'stack-no-clear 'vector) + (get-trans (the-as process-focusable s2-0) 0) + (get-transv (the-as process-focusable s2-0)) + (rnd-float-range this 2.0 3.0) + ) + (let* ((s5-3 (new 'stack-no-clear 'vector)) + (s4-2 (vector-! (new 'stack-no-clear 'vector) s1-0 (-> this root trans))) + (f30-0 (vector-length s4-2)) + ) + (let ((f28-0 (vector-vector-distance (-> this root trans) s1-0))) + (new 'stack-no-clear 'vector) + (let ((s1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable s2-0) 0)))) + (set! (-> s4-2 y) 0.0) + (vector-normalize! s4-2 1.0) + (set! (-> s1-2 y) 0.0) + (vector-normalize! s1-2 1.0) + (when (< 0.0 (vector-dot s3-0 s1-2)) ) ) - (cond - ((< f30-0 (-> this enemy-info notice-nav-radius)) - (vector-copy! (-> this target-pos) s5-2) - (let ((s3-1 (new 'stack-no-clear 'vector))) - (vector-copy! s3-1 s4-2) - (let ((s5-3 (new 'stack-no-clear 'vector))) - (vector-copy! s5-3 (-> this root transv)) - (vector-normalize! s5-3 f30-0) - (if (>= (vector-dot s3-1 s5-3) 0.98) - (go (method-of-object this attack)) - ) - ) + (vector+*! s5-3 (get-trans s2-0 0) s3-0 (+ 40960.0 (* 0.4 f28-0))) + ) + (cond + ((< f30-0 (-> this enemy-info notice-nav-radius)) + (vector-copy! (-> this target-pos) s5-3) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (vector-copy! s3-1 s4-2) + (let ((s5-4 (new 'stack-no-clear 'vector))) + (vector-copy! s5-4 (-> this root transv)) + (vector-normalize! s5-4 f30-0) + (if (>= (vector-dot s3-1 s5-4) 0.98) + (go (method-of-object this attack)) + ) ) ) - ((or (time-elapsed? (-> this last-change-dir) (-> this change-dir-time)) - (< (vector-vector-distance-squared (-> this root trans) (-> this target-pos)) 0.1) - ) - (set-time! (-> this last-change-dir)) - (set! (-> this change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) - (let ((s3-2 (new 'stack-no-clear 'vector)) - (f0-14 (* (/ f30-0 2) (tan (-> this move-angle)))) - (s2-1 (new 'stack-no-clear 'vector)) - ) - (if (-> this heading) - (set-vector! s3-2 (-> s4-2 z) (-> s4-2 y) (- (-> s4-2 x)) 1.0) - (set-vector! s3-2 (- (-> s4-2 z)) (-> s4-2 y) (-> s4-2 x) 1.0) - ) - (set! (-> this heading) (not (-> this heading))) - (let ((f28-2 (rand-vu-float-range (* 0.75 f0-14) f0-14)) - (s4-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) s4-2 (* -0.6 f30-0))) - ) - (vector-normalize! s3-2 f28-2) - (vector+! s3-2 s3-2 s4-3) - ) - (clamp-vector-to-mesh-cross-gaps (-> this nav state) s3-2) - (vector+! s2-1 s5-2 s3-2) - (vector-copy! (-> this target-pos) s2-1) + ) + ((or (time-elapsed? (-> this last-change-dir) (-> this change-dir-time)) + (< (vector-vector-distance-squared (-> this root trans) (-> this target-pos)) 0.1) ) + (set-time! (-> this last-change-dir)) + (set! (-> this change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) + (let ((s3-2 (new 'stack-no-clear 'vector)) + (f0-14 (* (/ f30-0 2) (tan (-> this move-angle)))) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (if (-> this heading) + (set-vector! s3-2 (-> s4-2 z) (-> s4-2 y) (- (-> s4-2 x)) 1.0) + (set-vector! s3-2 (- (-> s4-2 z)) (-> s4-2 y) (-> s4-2 x) 1.0) + ) + (set! (-> this heading) (not (-> this heading))) + (let ((f28-2 (rand-vu-float-range (* 0.75 f0-14) f0-14)) + (s4-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) s4-2 (* -0.6 f30-0))) + ) + (vector-normalize! s3-2 f28-2) + (vector+! s3-2 s3-2 s4-3) + ) + (clamp-vector-to-mesh-cross-gaps (-> this nav state) s3-2) + (vector+! s2-1 s5-3 s3-2) + (vector-copy! (-> this target-pos) s2-1) ) - ) + ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; failed to figure out what this is: @@ -1178,84 +1148,52 @@ ) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (handle->process (-> self wvehicle))) - (s1-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'quaternion)) - (gp-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - ) - (cond - (s5-0 - (if (focus-test? (the-as process-focusable s5-0) dead) - (go-virtual knocked) - ) - (wvehicle-method-171 (the-as wvehicle s5-0) s1-0 (-> self seat-index)) - (wvehicle-method-172 (the-as wvehicle s5-0) (the-as quaternion s4-0) (-> self seat-index)) - (rigid-body-control-method-23 (-> (the-as wvehicle s5-0) rbody) (-> self root trans) gp-0) - (vector-y-quaternion! s2-0 (the-as quaternion s4-0)) - (let ((a1-5 s2-0)) - (let ((v1-16 s2-0)) - (let ((a0-7 gp-0)) - (let ((a2-4 -0.00001)) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a0-7 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 (&-> a1-5 quad) vf6) - ) - (vector-normalize! s2-0 1.0) - (let ((a1-7 (-> self vec-up))) - (let ((v1-17 (-> self vec-up))) - (let ((a0-10 (vector-! (new 'stack-no-clear 'vector) s2-0 (-> self vec-up)))) - (let ((a2-8 (* 2.0 (seconds-per-frame)))) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a0-10 quad)) - ) - (.lvf vf4 (&-> v1-17 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-7 quad) vf6) - ) - (vector-normalize! (-> self vec-up) 1.0) - (vector-copy! (-> self root trans) s1-0) - (quaternion-from-two-vectors! s3-0 (-> self vec-up) s2-0) - (quaternion*! (-> self root quat) (the-as quaternion s4-0) s3-0) - (send-event - s5-0 - 'attack - #f - (static-attack-info - :mask (vehicle-impulse-factor) - ((id (new-attack-id)) (damage 2.0) (vehicle-damage-factor 0.00333) (vehicle-impulse-factor 0.0)) - ) - ) - (when (and (< 49152.0 (vector-length gp-0)) (< *egg-spider-next-knocked-vehicle* (current-time))) - (set! *egg-spider-next-knocked-vehicle* (+ (current-time) (rand-vu-int-range (seconds 0.1) (seconds 0.3)))) - (set! (-> self vehicle-attack?) #f) + (let ((s5-0 (handle->process (-> self wvehicle))) + (s1-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'quaternion)) + (gp-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (cond + (s5-0 + (if (focus-test? (the-as process-focusable s5-0) dead) (go-virtual knocked) ) + (wvehicle-method-171 (the-as wvehicle s5-0) s1-0 (-> self seat-index)) + (wvehicle-method-172 (the-as wvehicle s5-0) (the-as quaternion s4-0) (-> self seat-index)) + (rigid-body-control-method-23 (-> (the-as wvehicle s5-0) rbody) (-> self root trans) gp-0) + (vector-y-quaternion! s2-0 (the-as quaternion s4-0)) + (vector+*! s2-0 s2-0 gp-0 -0.00001) + (vector-normalize! s2-0 1.0) + (vector+*! + (-> self vec-up) + (-> self vec-up) + (vector-! (new 'stack-no-clear 'vector) s2-0 (-> self vec-up)) + (* 2.0 (seconds-per-frame)) ) - (else + (vector-normalize! (-> self vec-up) 1.0) + (vector-copy! (-> self root trans) s1-0) + (quaternion-from-two-vectors! s3-0 (-> self vec-up) s2-0) + (quaternion*! (-> self root quat) (the-as quaternion s4-0) s3-0) + (send-event + s5-0 + 'attack + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (new-attack-id)) (damage 2.0) (vehicle-damage-factor 0.00333) (vehicle-impulse-factor 0.0)) + ) + ) + (when (and (< 49152.0 (vector-length gp-0)) (< *egg-spider-next-knocked-vehicle* (current-time))) + (set! *egg-spider-next-knocked-vehicle* (+ (current-time) (rand-vu-int-range (seconds 0.1) (seconds 0.3)))) + (set! (-> self vehicle-attack?) #f) (go-virtual knocked) ) ) + (else + (go-virtual knocked) + ) ) ) ) @@ -1785,93 +1723,74 @@ 0 ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (check-can-rid self) - (when (< (-> self next-spot-time) (current-time)) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-copy! s5-0 (camera-pos)) - (let ((f28-0 (camera-angle)) - (s4-0 (new 'stack-no-clear 'vector)) - (gp-0 (new 'stack-no-clear 'vector)) - ) - (let ((f30-0 0.0)) - (if *target* - (+! f30-0 (vector-length (-> *target* control transv))) - ) - (vector-rotate-around-y! s4-0 *z-vector* (+ f28-0 (* 182.04445 (rand-vu-float-range -30.0 30.0)))) - (let ((s3-1 gp-0)) - (let ((v1-17 (+ (* 2.0 f30-0) (* 4096.0 (rand-vu-float-range 40.0 80.0))))) - (.mov vf7 v1-17) - ) - (.lvf vf5 (&-> s4-0 quad)) - (.lvf vf4 (&-> s5-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 (&-> s3-1 quad) vf6) - ) - ) - (when (spider-manager-method-25 self (the-as sphere gp-0)) - (vector-copy! (-> self spawn-pos) gp-0) - (set! (-> self next-spot-time) - (+ (current-time) (rand-vu-int-range (-> self min-spot-delay) (-> self max-spot-delay))) - ) + (check-can-rid self) + (when (< (-> self next-spot-time) (current-time)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 (camera-pos)) + (let ((f28-0 (camera-angle)) + (s4-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) ) + (let ((f30-0 0.0)) + (if *target* + (+! f30-0 (vector-length (-> *target* control transv))) + ) + (vector-rotate-around-y! s4-0 *z-vector* (+ f28-0 (* 182.04445 (rand-vu-float-range -30.0 30.0)))) + (vector+*! gp-0 s5-0 s4-0 (+ (* 2.0 f30-0) (* 4096.0 (rand-vu-float-range 40.0 80.0)))) + ) + (when (spider-manager-method-25 self (the-as sphere gp-0)) + (vector-copy! (-> self spawn-pos) gp-0) + (set! (-> self next-spot-time) + (+ (current-time) (rand-vu-int-range (-> self min-spot-delay) (-> self max-spot-delay))) + ) ) ) ) - (if (and (= (-> self count-alive) (-> self count-max)) (-> self can-rid)) - (send-event (handle->process (-> self can-rid)) 'die-fast) - ) - (when (and (< (-> self count-alive) (-> self count-max)) - *target* - (not (-> *setting-control* user-current nuke-active?)) - ) - (when (< (-> self next-spawn-time) (current-time)) - (set! (-> self next-spawn-time) - (+ (current-time) (rand-vu-int-range (-> self min-spawn-delay) (-> self max-spawn-delay))) - ) - (let ((gp-3 (new 'stack-no-clear 'sphere))) - (set! (-> gp-3 quad) (-> self spawn-pos quad)) - (+! (-> gp-3 x) (* 4096.0 (rand-vu-float-range -3.0 3.0))) - (+! (-> gp-3 z) (* 4096.0 (rand-vu-float-range -3.0 3.0))) - (set! (-> gp-3 r) 4096.0) - (when (and (sphere-in-view-frustum? gp-3) (spider-manager-method-25 self gp-3)) - (let ((s5-1 (new 'stack-no-clear 'enemy-init-by-other-params))) - (vector-copy! (-> s5-1 trans) gp-3) - (quaternion-copy! (-> s5-1 quat) *unity-quaternion*) - (set! (-> s5-1 entity) (-> self actor-group 0 data 0 actor)) - (set! (-> s5-1 directed?) #f) - (set! (-> s5-1 no-initial-move-to-ground?) #f) - (set! (-> s5-1 art-level) #f) - (let ((gp-5 - (as-type - (ppointer->process (process-spawn egg-spider self s5-1 (-> self max-spawn-size) :name "egg-spider" :to self)) - process-focusable - ) + ) + (if (and (= (-> self count-alive) (-> self count-max)) (-> self can-rid)) + (send-event (handle->process (-> self can-rid)) 'die-fast) + ) + (when (and (< (-> self count-alive) (-> self count-max)) + *target* + (not (-> *setting-control* user-current nuke-active?)) + ) + (when (< (-> self next-spawn-time) (current-time)) + (set! (-> self next-spawn-time) + (+ (current-time) (rand-vu-int-range (-> self min-spawn-delay) (-> self max-spawn-delay))) + ) + (let ((gp-3 (new 'stack-no-clear 'sphere))) + (set! (-> gp-3 quad) (-> self spawn-pos quad)) + (+! (-> gp-3 x) (* 4096.0 (rand-vu-float-range -3.0 3.0))) + (+! (-> gp-3 z) (* 4096.0 (rand-vu-float-range -3.0 3.0))) + (set! (-> gp-3 r) 4096.0) + (when (and (sphere-in-view-frustum? gp-3) (spider-manager-method-25 self gp-3)) + (let ((s5-1 (new 'stack-no-clear 'enemy-init-by-other-params))) + (vector-copy! (-> s5-1 trans) gp-3) + (quaternion-copy! (-> s5-1 quat) *unity-quaternion*) + (set! (-> s5-1 entity) (-> self actor-group 0 data 0 actor)) + (set! (-> s5-1 directed?) #f) + (set! (-> s5-1 no-initial-move-to-ground?) #f) + (set! (-> s5-1 art-level) #f) + (let ((gp-5 + (as-type + (ppointer->process (process-spawn egg-spider self s5-1 (-> self max-spawn-size) :name "egg-spider" :to self)) + process-focusable ) - (s5-3 (as-type (entity-nav-mesh-by-aid (the-as actor-id (-> self nav-id))) entity-nav-mesh)) ) - (when (and (task-node-closed? (game-task-node forest-kill-plants-introduction)) - (not (task-node-closed? (game-task-node forest-kill-plants-resolution))) - ) - (set! (-> (the-as process-focusable gp-5) fact pickup-type) (pickup-type none)) - (set! (-> (the-as process-focusable gp-5) fact pickup-amount) 0.0) + (s5-3 (as-type (entity-nav-mesh-by-aid (the-as actor-id (-> self nav-id))) entity-nav-mesh)) ) - (when s5-3 - (change-to (-> s5-3 nav-mesh) (the-as process-drawable gp-5)) - (let ((v1-64 (-> (the-as process-focusable gp-5) nav state))) - (set! (-> v1-64 current-poly) (the-as nav-poly #f)) - ) - 0 + (when (and (task-node-closed? (game-task-node forest-kill-plants-introduction)) + (not (task-node-closed? (game-task-node forest-kill-plants-resolution))) + ) + (set! (-> (the-as process-focusable gp-5) fact pickup-type) (pickup-type none)) + (set! (-> (the-as process-focusable gp-5) fact pickup-amount) 0.0) + ) + (when s5-3 + (change-to (-> s5-3 nav-mesh) (the-as process-drawable gp-5)) + (let ((v1-63 (-> (the-as process-focusable gp-5) nav state))) + (set! (-> v1-63 current-poly) (the-as nav-poly #f)) ) + 0 ) ) ) diff --git a/test/decompiler/reference/jak3/levels/nest/mh-bat_REF.gc b/test/decompiler/reference/jak3/levels/nest/mh-bat_REF.gc index a952b20032..2b0a787d23 100644 --- a/test/decompiler/reference/jak3/levels/nest/mh-bat_REF.gc +++ b/test/decompiler/reference/jak3/levels/nest/mh-bat_REF.gc @@ -1181,18 +1181,13 @@ ) (seek! (-> self pitch-angle) f0-3 (* 32768.0 (seconds-per-frame))) ) - (vector-rotate-around-axis! - gp-0 - (the-as quaternion *y-vector*) - (-> self pitch-angle) - (-> self rotation-matrix rvec) - ) + (vector-rotate-around-axis! gp-0 *y-vector* (-> self pitch-angle) (-> self rotation-matrix rvec)) (let* ((v1-17 (vector-flatten! (new 'stack-no-clear 'vector) s5-0 *y-vector*)) (f0-9 (lerp-scale -15473.777 15473.777 (vector-dot (-> self rotation-matrix rvec) v1-17) 163840.0 -163840.0)) ) (seek! (-> self bank-angle) f0-9 (* 10922.667 (seconds-per-frame))) ) - (vector-rotate-around-axis! gp-0 (the-as quaternion gp-0) (-> self bank-angle) (-> self rotation-matrix fvec)) + (vector-rotate-around-axis! gp-0 gp-0 (-> self bank-angle) (-> self rotation-matrix fvec)) ) ) 0 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 17aacd6d16..6d1858cd53 100644 --- a/test/decompiler/reference/jak3/levels/nest/mh-centipede_REF.gc +++ b/test/decompiler/reference/jak3/levels/nest/mh-centipede_REF.gc @@ -672,70 +672,47 @@ (defstate idle (rod-spawner) :virtual #t :enter (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (set-time! (-> self state-time)) - (set-vector! (-> self root scale) 3.0 3.0 3.0 1.0) - (logclear! (-> self mask) (process-mask actor-pause)) - (let ((v1-8 (-> self entity extra perm))) - (logior! (-> v1-8 status) (entity-perm-status bit-5)) - (set! (-> self root trans x) (* 4096.0 (the float (-> v1-8 user-int16 0)))) - (set! (-> self root trans z) (* 4096.0 (the float (-> v1-8 user-int16 1)))) - ) - (set! (-> self minimap) (add-icon! *minimap* self (the-as uint 12) (the-as int #f) (the-as vector #t) 0)) - (let ((gp-0 (new 'stack-no-clear 'collide-query))) - (set-vector! (-> gp-0 move-dist) 0.0 -204800.0 0.0 1.0) - (vector-copy! (-> gp-0 start-pos) (-> self root trans)) - (+! (-> gp-0 start-pos y) 102400.0) - (let ((v1-17 gp-0)) - (set! (-> v1-17 radius) 409.6) - (set! (-> v1-17 collide-with) (collide-spec backgnd)) - (set! (-> v1-17 ignore-process0) #f) - (set! (-> v1-17 ignore-process1) #f) - (set! (-> v1-17 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-17 action-mask) (collide-action solid)) - ) - (let ((f0-15 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) - (cond - ((>= f0-15 0.0) - (let ((a0-22 (-> self root trans))) - (let ((v1-21 (-> gp-0 start-pos))) - (let ((a1-2 (-> gp-0 move-dist))) - (let ((a2-1 f0-15)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-2 quad)) - ) - (.lvf vf4 (&-> v1-21 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-22 quad) vf6) - ) - (+! (-> self root trans y) 4096.0) - ) - (else - (format 0 "~A failed to find ground~%" (-> self name)) + (set-time! (-> self state-time)) + (set-vector! (-> self root scale) 3.0 3.0 3.0 1.0) + (logclear! (-> self mask) (process-mask actor-pause)) + (let ((v1-8 (-> self entity extra perm))) + (logior! (-> v1-8 status) (entity-perm-status bit-5)) + (set! (-> self root trans x) (* 4096.0 (the float (-> v1-8 user-int16 0)))) + (set! (-> self root trans z) (* 4096.0 (the float (-> v1-8 user-int16 1)))) + ) + (set! (-> self minimap) (add-icon! *minimap* self (the-as uint 12) (the-as int #f) (the-as vector #t) 0)) + (let ((gp-0 (new 'stack-no-clear 'collide-query))) + (set-vector! (-> gp-0 move-dist) 0.0 -204800.0 0.0 1.0) + (vector-copy! (-> gp-0 start-pos) (-> self root trans)) + (+! (-> gp-0 start-pos y) 102400.0) + (let ((v1-17 gp-0)) + (set! (-> v1-17 radius) 409.6) + (set! (-> v1-17 collide-with) (collide-spec backgnd)) + (set! (-> v1-17 ignore-process0) #f) + (set! (-> v1-17 ignore-process1) #f) + (set! (-> v1-17 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) + (set! (-> v1-17 action-mask) (collide-action solid)) + ) + (let ((f0-15 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) + (cond + ((>= f0-15 0.0) + (vector+*! (-> self root trans) (-> gp-0 start-pos) (-> gp-0 move-dist) f0-15) + (+! (-> self root trans y) 4096.0) + ) + (else + (format 0 "~A failed to find ground~%" (-> self name)) ) ) ) - (let ((gp-1 (new 'stack-no-clear 'task-arrow-params))) - (vector-copy! (-> gp-1 pos) (-> self root trans)) - (quaternion-identity! (-> gp-1 quat)) - (set! (-> gp-1 flags) (task-arrow-flags taf3 taf5)) - (set! (-> gp-1 map-icon) (the-as uint 12)) - (set! (-> self rod) (process->handle (task-arrow-spawn gp-1 self))) - ) + ) + (let ((gp-1 (new 'stack-no-clear 'task-arrow-params))) + (vector-copy! (-> gp-1 pos) (-> self root trans)) + (quaternion-identity! (-> gp-1 quat)) + (set! (-> gp-1 flags) (task-arrow-flags taf3 taf5)) + (set! (-> gp-1 map-icon) (the-as uint 12)) + (set! (-> self rod) (process->handle (task-arrow-spawn gp-1 self))) ) ) :exit (behavior () @@ -1095,119 +1072,96 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: Function (method 10 mh-centipede-crater-pt-array) has a return type of none, but the expression builder found a return statement. (defmethod mh-centipede-crater-pt-array-method-10 ((this mh-centipede-crater-pt-array)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (if (>= (-> this current-point) 20) - (return 0) + (if (>= (-> this current-point) 20) + (return 0) + ) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (-> this points (-> this current-point))) ) - (let ((gp-0 (new 'stack-no-clear 'collide-query)) - (s5-0 (-> this points (-> this current-point))) - ) - (set! (-> s5-0 found?) #f) - (let* ((f0-0 3449.2632) - (f30-0 (* f0-0 (the float (-> this current-point)))) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (let ((f0-3 (+ f30-0 (rand-vu-float-range (* -0.43 f0-0) (* 0.43 f0-0))))) - (set! (-> s5-0 angle) f0-3) - (sincos! s3-0 f0-3) - ) - (set! (-> s3-0 z) (* (-> s3-0 y) (-> this radius) (rand-vu-float-range 0.7 0.9))) - (set! (-> s3-0 y) 32768.0) - (set! (-> s3-0 x) (* (-> s3-0 x) (-> this radius) (rand-vu-float-range 0.7 0.9))) - (vector+! (-> gp-0 start-pos) (-> this origin) s3-0) + (set! (-> s5-0 found?) #f) + (let* ((f0-0 3449.2632) + (f30-0 (* f0-0 (the float (-> this current-point)))) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((f0-3 (+ f30-0 (rand-vu-float-range (* -0.43 f0-0) (* 0.43 f0-0))))) + (set! (-> s5-0 angle) f0-3) + (sincos! s3-0 f0-3) ) - (set-vector! (-> gp-0 move-dist) 0.0 -65536.0 0.0 1.0) - (let ((v1-13 gp-0)) - (set! (-> v1-13 radius) 409.6) - (set! (-> v1-13 collide-with) (collide-spec backgnd pusher)) - (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)) - ) - (+! (-> this current-point) 1) - (let ((f0-16 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) - (when (>= f0-16 0.0) - (let ((a1-5 (-> s5-0 collision-pt))) - (let ((v1-19 (-> gp-0 start-pos))) - (let ((a0-15 (-> gp-0 move-dist))) - (let ((a2-0 f0-16)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a0-15 quad)) - ) - (.lvf vf4 (&-> v1-19 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-5 quad) vf6) + (set! (-> s3-0 z) (* (-> s3-0 y) (-> this radius) (rand-vu-float-range 0.7 0.9))) + (set! (-> s3-0 y) 32768.0) + (set! (-> s3-0 x) (* (-> s3-0 x) (-> this radius) (rand-vu-float-range 0.7 0.9))) + (vector+! (-> gp-0 start-pos) (-> this origin) s3-0) + ) + (set-vector! (-> gp-0 move-dist) 0.0 -65536.0 0.0 1.0) + (let ((v1-13 gp-0)) + (set! (-> v1-13 radius) 409.6) + (set! (-> v1-13 collide-with) (collide-spec backgnd pusher)) + (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) ) - (+! (-> s5-0 collision-pt y) 204.8) - (set! (-> s5-0 found?) #t) - (vector-normalize-copy! (-> s5-0 normal) (-> gp-0 best-other-tri normal) 1.0) - (let ((s3-1 (new 'stack-no-clear 'vector)) - (s4-1 (new 'stack-no-clear 'inline-array 'vector 4)) - ) - (vector-cross! s3-1 (-> s5-0 normal) (vector-get-unique! (new 'stack-no-clear 'vector) (-> s5-0 normal))) - (vector-normalize! s3-1 10240.0) - (vector-copy! (-> s4-1 0) s3-1) - (vector-cross! (-> s4-1 1) s3-1 (-> s5-0 normal)) - (vector-negate! (-> s4-1 2) s3-1) - (vector-cross! (-> s4-1 3) (-> s5-0 normal) s3-1) - (vector-float*! s3-1 (-> s5-0 normal) 3072.0) - (dotimes (v1-28 4) - (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) s3-1) - (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) (-> s5-0 collision-pt)) + (set! (-> v1-13 action-mask) (collide-action solid)) + ) + (+! (-> this current-point) 1) + (let ((f0-16 (fill-and-probe-using-line-sphere *collide-cache* gp-0))) + (when (>= f0-16 0.0) + (vector+*! (-> s5-0 collision-pt) (-> gp-0 start-pos) (-> gp-0 move-dist) f0-16) + (+! (-> s5-0 collision-pt y) 204.8) + (set! (-> s5-0 found?) #t) + (vector-normalize-copy! (-> s5-0 normal) (-> gp-0 best-other-tri normal) 1.0) + (let ((s3-1 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack-no-clear 'inline-array 'vector 4)) ) - (vector-float*! (-> gp-0 move-dist) s3-1 -2.0) - (let ((s3-2 (new 'stack-no-clear 'collide-query))) - (let ((a1-19 (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)) - ) - (set-vector! v1-38 f0-22 f0-22 f0-22 1.0) - (vector+! (-> a1-19 max) (-> s5-0 collision-pt) v1-38) - (vector-! (-> a1-19 min) (-> s5-0 collision-pt) v1-38) - ) - (set! (-> s3-2 collide-with) (collide-spec backgnd pusher)) - (set! (-> s3-2 ignore-process0) #f) - (set! (-> s3-2 ignore-process1) #f) - (set! (-> s3-2 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> s3-2 action-mask) (collide-action solid)) - (mem-copy! (the-as pointer (-> s3-2 bbox)) (the-as pointer a1-19) 32) + (vector-cross! s3-1 (-> s5-0 normal) (vector-get-unique! (new 'stack-no-clear 'vector) (-> s5-0 normal))) + (vector-normalize! s3-1 10240.0) + (vector-copy! (-> s4-1 0) s3-1) + (vector-cross! (-> s4-1 1) s3-1 (-> s5-0 normal)) + (vector-negate! (-> s4-1 2) s3-1) + (vector-cross! (-> s4-1 3) (-> s5-0 normal) s3-1) + (vector-float*! s3-1 (-> s5-0 normal) 3072.0) + (dotimes (v1-28 4) + (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) s3-1) + (vector+! (-> s4-1 v1-28) (-> s4-1 v1-28) (-> s5-0 collision-pt)) + ) + (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)) + ) + (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) ) - (fill-using-bounding-box *collide-cache* s3-2) + (set! (-> s3-2 collide-with) (collide-spec backgnd pusher)) + (set! (-> s3-2 ignore-process0) #f) + (set! (-> s3-2 ignore-process1) #f) + (set! (-> s3-2 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> s3-2 action-mask) (collide-action solid)) + (mem-copy! (the-as pointer (-> s3-2 bbox)) (the-as pointer a1-20) 32) ) - (dotimes (s3-3 4) - (vector-copy! (-> gp-0 start-pos) (-> s4-1 s3-3)) - (when (< (probe-using-line-sphere *collide-cache* gp-0) 0.0) - (set! (-> s5-0 found?) #f) - (return 0) - ) + (fill-using-bounding-box *collide-cache* s3-2) + ) + (dotimes (s3-3 4) + (vector-copy! (-> gp-0 start-pos) (-> s4-1 s3-3)) + (when (< (probe-using-line-sphere *collide-cache* gp-0) 0.0) + (set! (-> s5-0 found?) #f) + (return 0) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 11 of type mh-centipede-crater-pt-array @@ -1527,49 +1481,28 @@ ;; definition for method 37 of type mh-centipede ;; INFO: Used lq/sq (defmethod probe-ground ((this mh-centipede) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (set-vector! (-> s5-0 move-dist) 0.0 -40960.0 0.0 1.0) - (vector-copy! (-> s5-0 start-pos) arg0) - (+! (-> s5-0 start-pos y) 20480.0) - (let ((v1-3 s5-0)) - (set! (-> v1-3 radius) 409.6) - (set! (-> v1-3 collide-with) (collide-spec backgnd)) - (set! (-> v1-3 ignore-process0) #f) - (set! (-> v1-3 ignore-process1) #f) - (set! (-> v1-3 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-3 action-mask) (collide-action solid)) - ) - (let ((f0-7 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) - (cond - ((>= f0-7 0.0) - (let ((v1-6 (-> s5-0 start-pos))) - (let ((a0-10 (-> s5-0 move-dist))) - (let ((a1-2 f0-7)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-10 quad)) - ) - (.lvf vf4 (&-> v1-6 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 (&-> arg0 quad) vf6) - #t - ) - (else - #f + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (set-vector! (-> s5-0 move-dist) 0.0 -40960.0 0.0 1.0) + (vector-copy! (-> s5-0 start-pos) arg0) + (+! (-> s5-0 start-pos y) 20480.0) + (let ((v1-3 s5-0)) + (set! (-> v1-3 radius) 409.6) + (set! (-> v1-3 collide-with) (collide-spec backgnd)) + (set! (-> v1-3 ignore-process0) #f) + (set! (-> v1-3 ignore-process1) #f) + (set! (-> v1-3 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) + (set! (-> v1-3 action-mask) (collide-action solid)) + ) + (let ((f0-7 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) + (cond + ((>= f0-7 0.0) + (vector+*! arg0 (-> s5-0 start-pos) (-> s5-0 move-dist) f0-7) + #t + ) + (else + #f ) ) ) @@ -1935,132 +1868,117 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs object. (defbehavior mh-centipede-active-handler mh-centipede ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (v1-13 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (case arg2 - (('touched) - (let ((s4-0 (the-as touching-shapes-entry (-> arg3 param 0)))) - (cond - ((not s4-0) - ) - ((type? arg0 vehicle) - (when (not (logtest? (-> self flags) (mh-centipede-flag mc6))) - (let ((s2-0 (-> s4-0 head))) - (when s2-0 - (let ((s3-0 (get-touched-prim s2-0 (-> self root) s4-0)) - (s5-1 (new 'stack-no-clear 'vector)) - ) - (when s3-0 - (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) - (.lvf vf1 (&-> s5-1 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-13 vf1) - (let ((f0-1 v1-13) - (f1-0 1.0) - ) - (if (< f0-1 (* f1-0 f1-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 - :mask (vehicle-impulse-factor) - ((id (new-attack-id)) - (damage 4.0) - (vehicle-damage-factor 0.8325) - (vehicle-impulse-factor (* 1.25 (-> (the-as vehicle arg0) info info mass))) - (shield-damage 1.0) - (knock (knocked-type dark-shot)) - (attacker-velocity s5-1) - ) - ) - ) - ) - (logior! (-> self flags) (mh-centipede-flag mc6)) - (nest-hunt-play-speech 5 (-> self effect-sphere)) + (case arg2 + (('touched) + (let ((s4-0 (the-as touching-shapes-entry (-> arg3 param 0)))) + (cond + ((not s4-0) + ) + ((type? arg0 vehicle) + (when (not (logtest? (-> self flags) (mh-centipede-flag mc6))) + (let ((s2-0 (-> s4-0 head))) + (when s2-0 + (let ((s3-0 (get-touched-prim s2-0 (-> self root) s4-0)) + (s5-1 (new 'stack-no-clear 'vector)) ) + (when s3-0 + (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) + ) + ) + (vector-normalize! s5-1 1.0) + (set! (-> s5-1 y) 0.1) + (when (send-event arg0 'attack #f (static-attack-info + :mask (vehicle-impulse-factor) + ((id (new-attack-id)) + (damage 4.0) + (vehicle-damage-factor 0.8325) + (vehicle-impulse-factor (* 1.25 (-> (the-as vehicle arg0) info info mass))) + (shield-damage 1.0) + (knock (knocked-type dark-shot)) + (attacker-velocity s5-1) + ) + ) + ) + ) + (logior! (-> self flags) (mh-centipede-flag mc6)) + (nest-hunt-play-speech 5 (-> self effect-sphere)) ) ) ) ) ) - ((prims-touching? s4-0 (-> self root) (the-as uint -1)) - (if (send-event - (as-type arg0 process-focusable) - 'attack - (-> arg3 param 0) - (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) - (damage 4.0) - (vehicle-damage-factor 1.0) - (vehicle-impulse-factor 1.0) - (knock (knocked-type dark-shot)) - ) - ) - ) - (nest-hunt-play-speech 5 (-> self effect-sphere)) + ) + ((prims-touching? s4-0 (-> self root) (the-as uint -1)) + (if (send-event + (as-type arg0 process-focusable) + 'attack + (-> arg3 param 0) + (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 4.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (knock (knocked-type dark-shot)) + ) + ) ) + (nest-hunt-play-speech 5 (-> self effect-sphere)) + ) + ) + ) + ) + #t + ) + (('attack) + (if (type? arg0 vehicle) + (return (the-as object #f)) + ) + (if (or (< (ja-aframe-num 0) (-> self current-anim vulnerable-start)) + (< (-> self current-anim vulnerable-end) (ja-aframe-num 0)) + ) + (return (the-as object #f)) + ) + (let ((f0-14 1.0) + (v1-50 (the-as attack-info (-> arg3 param 1))) + ) + (when (or (not (logtest? (-> v1-50 mask) (attack-mask id))) (!= (-> self incoming-attack-id) (-> v1-50 id))) + (if (logtest? (-> v1-50 mask) (attack-mask id)) + (set! (-> self incoming-attack-id) (-> v1-50 id)) + ) + (if (logtest? (attack-mask damage) (-> v1-50 mask)) + (set! f0-14 (-> v1-50 damage)) + ) + (if (and (-> self next-state) (= (-> self next-state name) 'shooting)) + (set! f0-14 (/ f0-14 2)) + ) + (if (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) + (set! f0-14 (* 0.6666667 f0-14)) + ) + (set! (-> self hit-points) (fmax 0.0 (- (-> self hit-points) f0-14))) + (set! (-> *game-info* health-bar) (-> self hit-points)) + (cond + ((= (-> self hit-points) 0.0) + (go-virtual die) ) - ) - ) - #t - ) - (('attack) - (if (type? arg0 vehicle) - (return (the-as object #f)) - ) - (if (or (< (ja-aframe-num 0) (-> self current-anim vulnerable-start)) - (< (-> self current-anim vulnerable-end) (ja-aframe-num 0)) - ) - (return (the-as object #f)) - ) - (let ((f0-14 1.0) - (v1-50 (the-as attack-info (-> arg3 param 1))) - ) - (when (or (not (logtest? (-> v1-50 mask) (attack-mask id))) (!= (-> self incoming-attack-id) (-> v1-50 id))) - (if (logtest? (-> v1-50 mask) (attack-mask id)) - (set! (-> self incoming-attack-id) (-> v1-50 id)) - ) - (if (logtest? (attack-mask damage) (-> v1-50 mask)) - (set! f0-14 (-> v1-50 damage)) - ) - (if (and (-> self next-state) (= (-> self next-state name) 'shooting)) - (set! f0-14 (/ f0-14 2)) - ) - (if (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) - (set! f0-14 (* 0.6666667 f0-14)) - ) - (set! (-> self hit-points) (fmax 0.0 (- (-> self hit-points) f0-14))) - (set! (-> *game-info* health-bar) (-> self hit-points)) - (cond - ((= (-> self hit-points) 0.0) - (go-virtual die) - ) - ((= f0-14 0.0) - ) - ((< (-> self hit-points) 20.0) - (nest-hunt-play-speech 3 (-> self effect-sphere)) - ) - (else - (nest-hunt-play-speech 2 (-> self effect-sphere)) - ) + ((= f0-14 0.0) + ) + ((< (-> self hit-points) 20.0) + (nest-hunt-play-speech 3 (-> self effect-sphere)) + ) + (else + (nest-hunt-play-speech 2 (-> self effect-sphere)) ) ) ) - #t ) - ) + #t + ) ) ) diff --git a/test/decompiler/reference/jak3/levels/nest/nst-part_REF.gc b/test/decompiler/reference/jak3/levels/nest/nst-part_REF.gc index 7c91f364ba..75219c515f 100644 --- a/test/decompiler/reference/jak3/levels/nest/nst-part_REF.gc +++ b/test/decompiler/reference/jak3/levels/nest/nst-part_REF.gc @@ -1293,7 +1293,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 8192.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1396,7 +1396,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 32768.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1499,7 +1499,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 20480.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1602,7 +1602,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 16384.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1705,7 +1705,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 24576.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1808,7 +1808,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 24576.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1911,7 +1911,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 8192.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -2014,7 +2014,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 32768.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -2117,7 +2117,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 28672.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -2338,7 +2338,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 8192.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) 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 c5be46ee80..50612f9f23 100644 --- a/test/decompiler/reference/jak3/levels/precursor/precura-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/precursor/precura-obs_REF.gc @@ -2405,91 +2405,28 @@ ;; definition for method 23 of type precur-door-c ;; WARN: Return type mismatch (pointer process) vs (pointer joint-exploder). (defmethod spawn-exploder ((this precur-door-c)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((s4-0 (new 'stack-no-clear 'vector)) - (f0-0 (rand-vu-float-range 0.5 1.5)) - ) - (let ((v1-1 (-> gp-0 fountain-rand-transv-lo))) - (let ((a0-4 (-> this root trans))) - (let ((a1-2 *up-vector*)) - (let ((a2-1 0.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-2 quad)) - ) - (.lvf vf4 (&-> a0-4 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-1 quad) vf6) + (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (f0-0 (rand-vu-float-range 0.5 1.5)) ) - (vector-reset! s4-0) - (let ((a1-3 s4-0)) - (let ((v1-3 s4-0)) - (let ((a0-5 *up-vector*)) - (let ((a2-3 40960.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-5 quad)) - ) - (.lvf vf4 (&-> v1-3 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-3 quad) vf6) - ) - (let ((a1-4 (-> gp-0 fountain-rand-transv-lo))) - (let ((v1-4 s4-0)) - (let ((a0-6 *identity-vector*)) - (let ((a2-5 (* -204800.0 f0-0))) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-6 quad)) - ) - (.lvf vf4 (&-> v1-4 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-4 quad) vf6) - ) - (let ((a0-7 (-> gp-0 fountain-rand-transv-hi))) - (let ((v1-5 *identity-vector*)) - (let ((a1-6 (* 204800.0 f0-0))) - (.mov vf7 a1-6) - ) - (.lvf vf5 (&-> v1-5 quad)) - ) - (.lvf vf4 (&-> s4-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-7 quad) vf6) - ) - ) - (set! (-> gp-0 gravity) -122880.0) - (set! (-> gp-0 rot-speed) 16.0) - (set! (-> gp-0 friction) 0.3) - (process-spawn - joint-exploder - (art-group-get-by-name *level* "skel-precur-door-c-explode" (the-as (pointer level) #f)) - 5 - gp-0 - *precur-door-c-exploder-params* - :name "joint-exploder" - :to this - :unk 0 - ) + (vector+*! (-> gp-0 fountain-rand-transv-lo) (-> this root trans) *up-vector* 0.0) + (vector-reset! s4-0) + (vector+*! s4-0 s4-0 *up-vector* 40960.0) + (vector+*! (-> gp-0 fountain-rand-transv-lo) s4-0 *identity-vector* (* -204800.0 f0-0)) + (vector+*! (-> gp-0 fountain-rand-transv-hi) s4-0 *identity-vector* (* 204800.0 f0-0)) + ) + (set! (-> gp-0 gravity) -122880.0) + (set! (-> gp-0 rot-speed) 16.0) + (set! (-> gp-0 friction) 0.3) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-precur-door-c-explode" (the-as (pointer level) #f)) + 5 + gp-0 + *precur-door-c-exploder-params* + :name "joint-exploder" + :to this + :unk 0 ) ) ) diff --git a/test/decompiler/reference/jak3/levels/precursor/precurc-obs_REF.gc b/test/decompiler/reference/jak3/levels/precursor/precurc-obs_REF.gc index f52bbb2bf1..5c4c163b62 100644 --- a/test/decompiler/reference/jak3/levels/precursor/precurc-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/precursor/precurc-obs_REF.gc @@ -301,106 +301,69 @@ ;; definition for method 22 of type precur-swingpole-pop ;; INFO: Used lq/sq (defmethod swingpole-method-22 ((this precur-swingpole-pop)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (-> this moving?) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (let ((s4-0 (-> this node-list data 3))) - 0.0 - (cond - ((zero? (-> this paused-time)) - (+! (-> this tt) (* 0.5 (seconds-per-frame))) - (when (< 1.0 (-> this tt)) - (let ((f0-4 (-> this tt))) - (set! (-> this tt) (- f0-4 (* (the float (the int (/ f0-4 1.0))) 1.0))) - ) - (set-time! (-> this paused-time)) + (when (-> this moving?) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((s4-0 (-> this node-list data 3))) + 0.0 + (cond + ((zero? (-> this paused-time)) + (+! (-> this tt) (* 0.5 (seconds-per-frame))) + (when (< 1.0 (-> this tt)) + (let ((f0-4 (-> this tt))) + (set! (-> this tt) (- f0-4 (* (the float (the int (/ f0-4 1.0))) 1.0))) ) + (set-time! (-> this paused-time)) ) - (else - (when (time-elapsed? (-> this paused-time) (seconds 1)) - (set! (-> this paused-time) 0) - (sound-play "spike-retract") - (set! (-> this halfway?) #f) - ) + ) + (else + (when (time-elapsed? (-> this paused-time) (seconds 1)) + (set! (-> this paused-time) 0) + (sound-play "spike-retract") + (set! (-> this halfway?) #f) ) ) - (when (and (not (-> this halfway?)) (< 0.5 (-> this tt))) - (set! (-> this halfway?) #t) - (sound-play "spike-reveal") - ) - (let ((f0-9 (cos (* 65536.0 (-> this tt))))) - (set! (-> this movedist) (* 20480.0 (+ -1.0 f0-9))) - ) - (vector-copy! s5-0 (-> this entity extra trans)) - (vector-normalize-copy! (-> this dir) (-> s4-0 bone transform fvec) 1.0) ) - (let ((a1-3 s5-0)) - (let ((v1-30 s5-0)) - (let ((a0-12 (-> this dir))) - (let ((a2-3 (-> this movedist))) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-12 quad)) - ) - (.lvf vf4 (&-> v1-30 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-3 quad) vf6) + (when (and (not (-> this halfway?)) (< 0.5 (-> this tt))) + (set! (-> this halfway?) #t) + (sound-play "spike-reveal") ) - (move-to-point! (-> this root) s5-0) - ) - (when (and (-> this moving?) - (< (fabs (-> this movedist)) 1228.8) - (< 122880.0 (vector-vector-distance (target-pos 0) (-> this entity extra trans))) - ) - (set! (-> this moving?) #f) - (set! (-> this player-grabbed?) #f) - (set-time! (-> this stopped-time)) + (let ((f0-9 (cos (* 65536.0 (-> this tt))))) + (set! (-> this movedist) (* 20480.0 (+ -1.0 f0-9))) + ) + (vector-copy! s5-0 (-> this entity extra trans)) + (vector-normalize-copy! (-> this dir) (-> s4-0 bone transform fvec) 1.0) ) + (vector+*! s5-0 s5-0 (-> this dir) (-> this movedist)) + (move-to-point! (-> this root) s5-0) ) - (when (-> this player-grabbed?) - (let ((s5-2 (new 'stack-no-clear 'vector))) - (vector-copy! s5-2 (-> this entity extra trans)) - (seek! (-> this movedist) 0.0 (* 36864.0 (seconds-per-frame))) - (let ((a1-7 s5-2)) - (let ((v1-48 s5-2)) - (let ((a0-21 (-> this dir))) - (let ((a2-5 (-> this movedist))) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-21 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-7 quad) vf6) - ) - (move-to-point! (-> this root) s5-2) - ) - ) - (when (and (not (-> this moving?)) (and (not (-> this player-grabbed?)) - (time-elapsed? (-> this stopped-time) (seconds 0.5)) - (< (vector-vector-distance (target-pos 0) (-> this root trans)) 122880.0) - ) + (when (and (-> this moving?) + (< (fabs (-> this movedist)) 1228.8) + (< 122880.0 (vector-vector-distance (target-pos 0) (-> this entity extra trans))) ) - (set! (-> this moving?) #t) + (set! (-> this moving?) #f) (set! (-> this player-grabbed?) #f) (set-time! (-> this stopped-time)) ) - (call-parent-method this) - (none) ) + (when (-> this player-grabbed?) + (let ((s5-2 (new 'stack-no-clear 'vector))) + (vector-copy! s5-2 (-> this entity extra trans)) + (seek! (-> this movedist) 0.0 (* 36864.0 (seconds-per-frame))) + (vector+*! s5-2 s5-2 (-> this dir) (-> this movedist)) + (move-to-point! (-> this root) s5-2) + ) + ) + (when (and (not (-> this moving?)) (and (not (-> this player-grabbed?)) + (time-elapsed? (-> this stopped-time) (seconds 0.5)) + (< (vector-vector-distance (target-pos 0) (-> this root trans)) 122880.0) + ) + ) + (set! (-> this moving?) #t) + (set! (-> this player-grabbed?) #f) + (set-time! (-> this stopped-time)) + ) + (call-parent-method this) + (none) ) ;; failed to figure out what this is: 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 7985563823..afcc929b44 100644 --- a/test/decompiler/reference/jak3/levels/sewer/kg-hopper_REF.gc +++ b/test/decompiler/reference/jak3/levels/sewer/kg-hopper_REF.gc @@ -662,82 +662,59 @@ ;; INFO: Used lq/sq (defmethod kg-hopper-method-191 ((this kg-hopper)) (local-vars (sv-752 collide-query)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (+! (-> this step-num) -1) + (cond + ((>= (-> this step-num) 0) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (vector-rotate-around-y! + s3-0 + (-> this direction) + (* 182.04445 (the float (+ (* (-> this step-num) 16) -135))) ) - (init-vf0-vector) - (+! (-> this step-num) -1) - (cond - ((>= (-> this step-num) 0) - (let ((s3-0 (new 'stack-no-clear 'vector)) - (s5-0 (new 'stack-no-clear 'vector)) + (vector+*! s5-0 (-> this origin) s3-0 (-> this jump-dist)) + (let ((v1-8 (-> this nav)) + (a0-3 s5-0) + (a1-3 (new 'stack-no-clear 'nav-poly)) ) - (vector-rotate-around-y! - s3-0 - (-> this direction) - (* 182.04445 (the float (+ (* (-> this step-num) 16) -135))) - ) - (let ((a1-1 s5-0)) - (let ((v1-7 (-> this origin))) - (let ((a0-2 s3-0)) - (let ((a2-1 (-> this jump-dist))) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-2 quad)) - ) - (.lvf vf4 (&-> v1-7 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-1 quad) vf6) - ) - (let ((v1-8 (-> this nav)) - (a0-3 s5-0) - (a1-2 (new 'stack-no-clear 'nav-poly)) - ) - (vector-! (-> a1-2 vertex 0) a0-3 (the-as vector (-> v1-8 state mesh bounds))) - (set! (-> a1-2 vertex1 x) (-> v1-8 nearest-y-threshold)) - (set! (-> a1-2 data 20) (the-as uint 2)) - (let ((s4-0 (nav-mesh-method-45 (-> v1-8 state mesh) a1-2))) - (when s4-0 - (let ((f30-0 (vector-dot s3-0 (-> this direction)))) - (new 'stack-no-clear 'vector) - (let ((a1-3 (new 'stack-no-clear 'vector))) - (vector-copy! a1-3 s5-0) - (set! (-> a1-3 w) 6144.0) - (when (not (check-sphere-blocked! (-> this nav) a1-3 #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-5 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-5 (the-as vector sv-752) t0-1) + (vector-! (-> a1-3 vertex 0) a0-3 (the-as vector (-> v1-8 state mesh bounds))) + (set! (-> a1-3 vertex1 x) (-> v1-8 nearest-y-threshold)) + (set! (-> a1-3 data 20) (the-as uint 2)) + (let ((s4-0 (nav-mesh-method-45 (-> v1-8 state mesh) a1-3))) + (when s4-0 + (let ((f30-0 (vector-dot s3-0 (-> this direction)))) + (new 'stack-no-clear 'vector) + (let ((a1-4 (new 'stack-no-clear 'vector))) + (vector-copy! a1-4 s5-0) + (set! (-> a1-4 w) 6144.0) + (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) ) - (vector+! s1-0 s1-0 (the-as vector (-> s0-0 state mesh bounds))) + (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) ) - 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+! 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) ) + (vector-copy! (-> this best-point) s5-0) ) ) ) @@ -745,11 +722,11 @@ ) ) ) - #t ) - (else - #f - ) + #t + ) + (else + #f ) ) ) 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 ee6ef68847..9ecc694c83 100644 --- a/test/decompiler/reference/jak3/levels/sewer/saberfish-spawner_REF.gc +++ b/test/decompiler/reference/jak3/levels/sewer/saberfish-spawner_REF.gc @@ -426,49 +426,35 @@ ;; definition for method 22 of type saberfish-spawner (defmethod saberfish-spawner-method-22 ((this saberfish-spawner) (arg0 vector) (arg1 saberfish-find-behavior)) - (local-vars (v1-16 float) (sv-64 nav-poly) (sv-72 int) (sv-80 number) (sv-84 vector) (sv-88 symbol)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (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))) - (.lvf vf1 (&-> (-> sv-64 vertex) 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-16 vf1) - (let ((f0-1 v1-16) - (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) - ) + (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) ) ) ) ) ) ) - sv-72 ) + sv-72 ) ;; definition for method 7 of type saberfish-spawner diff --git a/test/decompiler/reference/jak3/levels/sewer/saberfish_REF.gc b/test/decompiler/reference/jak3/levels/sewer/saberfish_REF.gc index 6bb4a4e3d8..db03336506 100644 --- a/test/decompiler/reference/jak3/levels/sewer/saberfish_REF.gc +++ b/test/decompiler/reference/jak3/levels/sewer/saberfish_REF.gc @@ -1056,45 +1056,28 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defbehavior saberfish-chase-post saberfish () - (local-vars (v1-10 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (let ((a0-1 (handle->process (-> self focus handle)))) - (when a0-1 - (let ((gp-0 (get-trans (the-as process-focusable a0-1) 1))) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-! s5-0 (-> self root trans) gp-0) - (let ((f0-0 16384.0)) - (.lvf vf1 (&-> s5-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-10 vf1) - (if (< f0-0 v1-10) - (vector-normalize! s5-0 16384.0) - ) + (let ((a0-1 (handle->process (-> self focus handle)))) + (when a0-1 + (let ((gp-0 (get-trans (the-as process-focusable a0-1) 1))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-! s5-0 (-> self root trans) gp-0) + (if (< 16384.0 (vector-length-squared s5-0)) + (vector-normalize! s5-0 16384.0) ) - (vector+! gp-0 gp-0 s5-0) - ) - (let ((v1-15 (-> self nav state))) - (logclear! (-> v1-15 flags) (nav-state-flag directional-mode)) - (logior! (-> v1-15 flags) (nav-state-flag target-poly-dirty)) - (vector-copy! (-> v1-15 target-pos) gp-0) - ) + (vector+! gp-0 gp-0 s5-0) + ) + (let ((v1-15 (-> self nav state))) + (logclear! (-> v1-15 flags) (nav-state-flag directional-mode)) + (logior! (-> v1-15 flags) (nav-state-flag target-poly-dirty)) + (vector-copy! (-> v1-15 target-pos) gp-0) ) - 0 ) + 0 ) - (nav-enemy-method-187 self) - 0 - (none) ) + (nav-enemy-method-187 self) + 0 + (none) ) ;; failed to figure out what this is: @@ -1568,7 +1551,7 @@ (vector-float*! (-> self post-spinflip-expected-heading) (-> self post-spinflip-expected-heading) -1.0) (let ((gp-0 #f)) (until (ja-done? 0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (set! (-> self root transv quad) (the-as uint128 0)) (vector-float*! (-> self root transv) (-> self root transv) -1.0) (vector-v++! (-> self root trans) (-> self root transv)) @@ -1809,7 +1792,7 @@ (let ((f30-1 (fmin (acos f28-0) (* 0.53333336 (seconds-per-frame) f30-0)))) (vector-cross! s4-1 gp-0 s5-0) (vector-normalize! s4-1 1.0) - (vector-rotate-around-axis! gp-0 (the-as quaternion gp-0) f30-1 s4-1) + (vector-rotate-around-axis! gp-0 gp-0 f30-1 s4-1) ) ) (set! (-> gp-0 y) 0.0) @@ -2212,7 +2195,7 @@ (ja-no-eval :group! (-> self draw art-group data (-> self jump land-anim)) :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (set! (-> self root transv quad) (the-as uint128 0)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-x-vel adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) (vector-v++! (-> self root trans) (-> self root transv)) (set! (-> self root transv quad) (the-as uint128 0)) @@ -2310,7 +2293,7 @@ (set! (-> gp-0 y) 0.0) (vector-normalize! gp-0 (-> self swim-speed)) (vector-v++! (-> self root trans) gp-0) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) (set! (-> self root transv x) 0.0) (set! (-> self root transv z) 0.0) @@ -2335,7 +2318,7 @@ ;; WARN: Return type mismatch int vs none. (defbehavior jump-from-land-dive-anim saberfish () (let ((f30-0 1.0)) - (compute-alignment! (-> self align)) + (compute-delta-align! (-> self align)) (cond ((< (ja-frame-num 0) 4.5) (align! (-> self align) (align-opts adjust-x-vel adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) @@ -3237,7 +3220,7 @@ (when (saberfish-method-243 this) (case arg0 (((jump-stage landing)) - (compute-alignment! (-> this align)) + (compute-delta-align! (-> this align)) (align! (-> this align) (align-opts adjust-x-vel adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) (vector-v++! (-> this root trans) (-> this root transv)) (when (< (ja-frame-num 0) 8.0) diff --git a/test/decompiler/reference/jak3/levels/sewer/sewer-move-turret_REF.gc b/test/decompiler/reference/jak3/levels/sewer/sewer-move-turret_REF.gc index 1fd17d95b1..ab163e8089 100644 --- a/test/decompiler/reference/jak3/levels/sewer/sewer-move-turret_REF.gc +++ b/test/decompiler/reference/jak3/levels/sewer/sewer-move-turret_REF.gc @@ -421,36 +421,18 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod projectile-method-25 ((this sew-move-turret-shot)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((a1-0 (-> this root trans)) + (v1-1 (-> this tail-pos)) + (a0-2 (vector-! (new 'stack-no-clear 'vector) a1-0 v1-1)) ) - (init-vf0-vector) - (let* ((a1-0 (-> this root trans)) - (v1-1 (-> this tail-pos)) - (a0-2 (vector-! (new 'stack-no-clear 'vector) a1-0 v1-1)) - ) - (vector-length a0-2) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (let ((a1-4 0.8)) - (.mov vf7 a1-4) - ) - (.lvf vf5 (&-> a0-2 quad)) - (.lvf vf4 (&-> v1-1 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 (&-> gp-0 quad) vf6) - (launch-particles (-> *part-id-table* 4940) gp-0) - (launch-particles (-> *part-id-table* 4941) gp-0) - ) + (vector-length a0-2) + (let ((gp-1 (vector+*! (new 'stack-no-clear 'vector) v1-1 a0-2 0.8))) + (launch-particles (-> *part-id-table* 4940) gp-1) + (launch-particles (-> *part-id-table* 4941) gp-1) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 24 of type sew-move-turret-shot 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 0483b7880a..aa5b41d620 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 @@ -813,73 +813,52 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod dm-mine-spider-method-192 ((this dm-mine-spider)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((a0-5 (as-type (handle->process (-> this focus handle)) process-focusable))) - (when a0-5 - (let* ((v1-5 (get-trans (the-as process-focusable a0-5) 0)) - (s4-1 (vector-! (new 'stack-no-clear 'vector) v1-5 (-> this root trans))) - (f30-0 (vector-length s4-1)) - (s5-1 (new 'stack-no-clear 'vector)) - ) - (let ((s3-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) - (let ((a1-4 (-> this nav state))) - (vector-copy! s5-1 (-> a1-4 target-pos)) - ) - (set! (-> s4-1 y) 0.0) - (vector-normalize! s4-1 1.0) - (cond - ((< f30-0 8192.0) - (go (method-of-object this attack)) - ) - ((time-elapsed? (-> this last-change-dir) (-> this change-dir-time)) - (if (rand-vu-percent? 0.25) - (go (method-of-object this run-stop)) - ) - (set-time! (-> this last-change-dir)) - (set! (-> this change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) - (if (< (vector-dot s4-1 s3-0) 0.0) - (vector-rotate-around-y! s4-1 s3-0 (if (rand-vu-percent? 0.5) - 24576.0 - -24576.0 - ) - ) - ) - (vector-deg-seek s4-1 s3-0 s4-1 16384.0) - (let ((v1-30 s5-1)) - (let ((a0-20 (-> this root trans))) - (let ((a1-13 (+ 40960.0 (* 0.4 f30-0)))) - (.mov vf7 a1-13) - ) - (.lvf vf5 (&-> s4-1 quad)) - (.lvf vf4 (&-> a0-20 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-30 quad) vf6) - ) - ) - ) + (let ((a0-5 (as-type (handle->process (-> this focus handle)) process-focusable))) + (when a0-5 + (let* ((v1-5 (get-trans (the-as process-focusable a0-5) 0)) + (s4-1 (vector-! (new 'stack-no-clear 'vector) v1-5 (-> this root trans))) + (f30-0 (vector-length s4-1)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (let ((s3-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) + (let ((a1-4 (-> this nav state))) + (vector-copy! s5-1 (-> a1-4 target-pos)) ) - (let ((v1-32 (-> this nav state))) - (logclear! (-> v1-32 flags) (nav-state-flag directional-mode)) - (logior! (-> v1-32 flags) (nav-state-flag target-poly-dirty)) - (vector-copy! (-> v1-32 target-pos) s5-1) + (set! (-> s4-1 y) 0.0) + (vector-normalize! s4-1 1.0) + (cond + ((< f30-0 8192.0) + (go (method-of-object this attack)) + ) + ((time-elapsed? (-> this last-change-dir) (-> this change-dir-time)) + (if (rand-vu-percent? 0.25) + (go (method-of-object this run-stop)) + ) + (set-time! (-> this last-change-dir)) + (set! (-> this change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) + (if (< (vector-dot s4-1 s3-0) 0.0) + (vector-rotate-around-y! s4-1 s3-0 (if (rand-vu-percent? 0.5) + 24576.0 + -24576.0 + ) + ) + ) + (vector-deg-seek s4-1 s3-0 s4-1 16384.0) + (vector+*! s5-1 (-> this root trans) s4-1 (+ 40960.0 (* 0.4 f30-0))) + ) ) ) - 0 + (let ((v1-33 (-> this nav state))) + (logclear! (-> v1-33 flags) (nav-state-flag directional-mode)) + (logior! (-> v1-33 flags) (nav-state-flag target-poly-dirty)) + (vector-copy! (-> v1-33 target-pos) s5-1) + ) ) + 0 ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 59 of type dm-mine-spider 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 f8b04d8aed..5f2d4b27ee 100644 --- a/test/decompiler/reference/jak3/levels/stadium/king-rider_REF.gc +++ b/test/decompiler/reference/jak3/levels/stadium/king-rider_REF.gc @@ -131,58 +131,41 @@ ) ) :trans (behavior () - (local-vars (v1-26 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (king-pilot-trans) - (cond - ((and *target* - (focus-test? *target* pilot-riding) - (nonzero? (-> *target* pilot)) - (-> self parent) - (-> self parent 0) - (= *target* (find-rider (-> self parent 0))) - ) - (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)) - ) - (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))) - ) - (set! (-> self complain-speech) (mod (+ (-> self complain-speech) (rand-vu-int-range 2 6)) 9)) - (set-time! (-> self complain-time)) - ) + (king-pilot-trans) + (cond + ((and *target* + (focus-test? *target* pilot-riding) + (nonzero? (-> *target* pilot)) + (-> self parent) + (-> self parent 0) + (= *target* (find-rider (-> self parent 0))) + ) + (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)) + ) + (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))) + ) + (set! (-> self complain-speech) (mod (+ (-> self complain-speech) (rand-vu-int-range 2 6)) 9)) + (set-time! (-> self complain-time)) ) ) ) - (let* ((f0-4 20480.0) - (f0-6 (* f0-4 f0-4)) - ) - (.lvf vf1 (&-> (-> *target* control 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 v1-26 vf1) - (if (< f0-6 v1-26) - (set-time! (-> self last-moved-time)) - ) - ) - (if (time-elapsed? (-> self last-moved-time) (seconds 8)) - (set! (-> self last-moved-time) (+ (current-time) (seconds 24))) + ) + (let ((f0-4 20480.0)) + (if (< (* f0-4 f0-4) (vector-length-squared (-> *target* control transv))) + (set-time! (-> self last-moved-time)) ) ) - (else - (set-time! (-> self last-moved-time)) - ) + (if (time-elapsed? (-> self last-moved-time) (seconds 8)) + (set! (-> self last-moved-time) (+ (current-time) (seconds 24))) + ) + ) + (else + (set-time! (-> self last-moved-time)) ) ) ) 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 2e53ac190c..fff04659e8 100644 --- a/test/decompiler/reference/jak3/levels/stadium/rubble-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/stadium/rubble-obs_REF.gc @@ -761,60 +761,37 @@ ;; definition for method 22 of type rub-elec-gate ;; WARN: Return type mismatch int vs none. (defmethod toggle-blocking-plane ((this rub-elec-gate) (arg0 symbol)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (cond - (arg0 - (when (and (nonzero? (-> this path)) (nonzero? (-> this path-r))) - (let ((gp-0 (new 'static 'inline-array vector 2 (new 'static 'vector) (new 'static 'vector)))) - (let ((s4-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (get-point-at-percent-along-path! (-> this path) (-> gp-0 0) 0.0 'interp) - (get-point-at-percent-along-path! (-> this path) (-> gp-0 1) 1.0 'interp) - (vector-! s3-0 (-> gp-0 1) (-> gp-0 0)) - (get-point-at-percent-along-path! (-> this path-r) (-> gp-0 1) 0.0 'interp) - (vector-! s2-0 (-> gp-0 1) (-> gp-0 0)) - (set! (-> this width) (vector-length s2-0)) - (set! (-> this height) (vector-length s3-0)) - (let ((a1-8 (-> this root trans))) - (let ((v1-17 (-> gp-0 0))) - (let ((a0-7 s2-0)) - (let ((a2-4 0.5)) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a0-7 quad)) - ) - (.lvf vf4 (&-> v1-17 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-8 quad) vf6) + (cond + (arg0 + (when (and (nonzero? (-> this path)) (nonzero? (-> this path-r))) + (let ((gp-0 (new 'static 'inline-array vector 2 (new 'static 'vector) (new 'static 'vector)))) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) ) - (vector-normalize! (vector-cross! s4-0 s2-0 s3-0) 1.0) - (quaternion-look-at! (-> this root quat) s4-0 s3-0) - ) - (+! (-> gp-0 0 y) -20480.0) - (+! (-> gp-0 1 y) -20480.0) - (blocking-plane-spawn (the-as curve-control #f) gp-0 122880.0) + (get-point-at-percent-along-path! (-> this path) (-> gp-0 0) 0.0 'interp) + (get-point-at-percent-along-path! (-> this path) (-> gp-0 1) 1.0 'interp) + (vector-! s3-0 (-> gp-0 1) (-> gp-0 0)) + (get-point-at-percent-along-path! (-> this path-r) (-> gp-0 1) 0.0 'interp) + (vector-! s2-0 (-> gp-0 1) (-> gp-0 0)) + (set! (-> this width) (vector-length s2-0)) + (set! (-> this height) (vector-length s3-0)) + (vector+*! (-> this root trans) (-> gp-0 0) s2-0 0.5) + (vector-normalize! (vector-cross! s4-0 s2-0 s3-0) 1.0) + (quaternion-look-at! (-> this root quat) s4-0 s3-0) ) + (+! (-> gp-0 0 y) -20480.0) + (+! (-> gp-0 1 y) -20480.0) + (blocking-plane-spawn (the-as curve-control #f) gp-0 122880.0) ) ) - (else - (blocking-plane-destroy) - ) ) - 0 - (none) + (else + (blocking-plane-destroy) + ) ) + 0 + (none) ) ;; definition for method 7 of type rub-elec-gate 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 52af418495..e878118cb0 100644 --- a/test/decompiler/reference/jak3/levels/temple/temple-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/temple/temple-obs_REF.gc @@ -1500,113 +1500,78 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod swingpole-method-22 ((this tpl-elec-swing-pole)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((t9-0 (method-of-type swingpole swingpole-method-22))) - (t9-0 this) - ) - (cond - ((-> this electrify) - (let ((f30-0 (-> *part-id-table* 2620 init-specs 4 initial-valuef))) - (set! (-> *part-id-table* 2620 init-specs 4 initial-valuef) (-> this edge-length)) - (draw-beam (-> *part-id-table* 2620) (-> this root trans) (-> this dir) #f) - (set! (-> *part-id-table* 2620 init-specs 4 initial-valuef) f30-0) - ) - (dotimes (s5-0 4) - (let ((f30-1 (rand-vu-float-range 0.0 (-> this edge-length))) - (f0-3 (rand-vu-float-range 0.0 (-> this edge-length))) - ) - (let ((a0-5 (-> this lightning s5-0)) - (v1-16 (new 'stack-no-clear 'vector)) - ) - (let ((a1-4 (-> this root trans))) - (let ((a2-1 (-> this dir))) - (let ((a3-1 f30-1)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-1 quad)) - ) - (.lvf vf4 (&-> a1-4 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-16 quad) vf6) - (set! (-> a0-5 state meet data 0 quad) (-> v1-16 quad)) - ) - (let ((a0-8 (-> this lightning s5-0)) - (v1-20 (new 'stack-no-clear 'vector)) - ) - (let ((a1-6 (-> this root trans))) - (let ((a2-2 (-> this dir))) - (let ((a3-2 f0-3)) - (.mov vf7 a3-2) - ) - (.lvf vf5 (&-> a2-2 quad)) - ) - (.lvf vf4 (&-> a1-6 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-20 quad) vf6) - (vector-copy! (-> a0-8 state meet data (+ (-> a0-8 state points-to-draw) -1)) v1-20) - ) - ) - (let ((v1-24 (-> this lightning s5-0)) - (a0-11 2) - ) - (let ((a1-12 (!= a0-11 (-> v1-24 state mode)))) - (case a0-11 - ((3) - (if a1-12 - (set! (-> v1-24 state counter) 0.0) - ) - ) - ((1) - (set! (-> v1-24 state start-color) (-> v1-24 spec start-color)) - (set! (-> v1-24 state end-color) (-> v1-24 spec end-color)) - ) - ) - ) - (set! (-> v1-24 state mode) (the-as uint a0-11)) - ) - ) - (sound-play "pole-hum-loop" :id (-> this sound-id)) + (let ((t9-0 (method-of-type swingpole swingpole-method-22))) + (t9-0 this) + ) + (cond + ((-> this electrify) + (let ((f30-0 (-> *part-id-table* 2620 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 2620 init-specs 4 initial-valuef) (-> this edge-length)) + (draw-beam (-> *part-id-table* 2620) (-> this root trans) (-> this dir) #f) + (set! (-> *part-id-table* 2620 init-specs 4 initial-valuef) f30-0) ) - (else - (sound-stop (-> this sound-id)) - (dotimes (v1-30 4) - (let ((a0-18 (-> this lightning v1-30)) - (a1-22 0) - ) - (let ((a2-6 (!= a1-22 (-> a0-18 state mode)))) - (case a1-22 - ((3) - (if a2-6 - (set! (-> a0-18 state counter) 0.0) - ) - ) - ((1) - (set! (-> a0-18 state start-color) (-> a0-18 spec start-color)) - (set! (-> a0-18 state end-color) (-> a0-18 spec end-color)) - ) - ) + (dotimes (s5-0 4) + (let ((f30-1 (rand-vu-float-range 0.0 (-> this edge-length))) + (f0-3 (rand-vu-float-range 0.0 (-> this edge-length))) + ) + (let ((a0-5 (-> this lightning s5-0)) + (v1-17 (vector+*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this dir) f30-1)) + ) + (set! (-> a0-5 state meet data 0 quad) (-> v1-17 quad)) + ) + (let ((a0-8 (-> this lightning s5-0)) + (v1-22 (vector+*! (new 'stack-no-clear 'vector) (-> this root trans) (-> this dir) f0-3)) + ) + (vector-copy! (-> a0-8 state meet data (+ (-> a0-8 state points-to-draw) -1)) v1-22) + ) + ) + (let ((v1-26 (-> this lightning s5-0)) + (a0-11 2) + ) + (let ((a1-12 (!= a0-11 (-> v1-26 state mode)))) + (case a0-11 + ((3) + (if a1-12 + (set! (-> v1-26 state counter) 0.0) + ) + ) + ((1) + (set! (-> v1-26 state start-color) (-> v1-26 spec start-color)) + (set! (-> v1-26 state end-color) (-> v1-26 spec end-color)) + ) + ) + ) + (set! (-> v1-26 state mode) (the-as uint a0-11)) + ) + ) + (sound-play "pole-hum-loop" :id (-> this sound-id)) + ) + (else + (sound-stop (-> this sound-id)) + (dotimes (v1-32 4) + (let ((a0-18 (-> this lightning v1-32)) + (a1-22 0) + ) + (let ((a2-6 (!= a1-22 (-> a0-18 state mode)))) + (case a1-22 + ((3) + (if a2-6 + (set! (-> a0-18 state counter) 0.0) + ) + ) + ((1) + (set! (-> a0-18 state start-color) (-> a0-18 spec start-color)) + (set! (-> a0-18 state end-color) (-> a0-18 spec end-color)) + ) ) - (set! (-> a0-18 state mode) (the-as uint a1-22)) ) + (set! (-> a0-18 state mode) (the-as uint a1-22)) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 7 of type tpl-elec-swing-pole @@ -1759,143 +1724,106 @@ ;; INFO: Used lq/sq (defmethod init-from-entity! ((this tpl-elec-swing-pole) (arg0 entity-actor)) "Set up a newly created process from the entity that created it." - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (stack-size-set! (-> this main-thread) 128) - (set! (-> this y-start) (res-lump-float (-> this entity) 'y-start)) - (set! (-> this y-end) (res-lump-float (-> this entity) 'y-end)) - (set! (-> this electrify) #f) - (set! (-> this sound-id) (new-sound-id)) - (init-collision! this) - (vector-copy! (-> this root trans) (-> arg0 extra trans)) - (quaternion-copy! (-> this root quat) (-> arg0 quat)) - (vector-identity! (-> this root scale)) - (vector-z-quaternion! (-> this dir) (-> this root quat)) - (set! (-> this joint-track) -1) - (set! (-> this y-disable) (+ 37888.0 (-> this root trans y))) - (initialize-skeleton - this - (the-as skeleton-group (art-group-get-by-name *level* "skel-tpl-elec-swing-pole" (the-as (pointer level) #f))) - (the-as pair 0) - ) - (set! (-> this dir y) 0.0) - (vector-normalize! (-> this dir) 1.0) - (set! (-> this edge-length) 8192.0) - (let ((s4-1 (new 'stack-no-clear 'sync-info-params))) - (let ((a0-15 (res-lump-value arg0 'options uint128 :time -1000000000.0)) - (v1-19 0) - ) - (if (not (logtest? (the-as int a0-15) 8)) - (set! v1-19 (logior v1-19 1)) - ) - (set! (-> s4-1 sync-type) 'sync-eased) - (set! (-> s4-1 sync-flags) (the-as sync-flags v1-19)) - ) - (set! (-> s4-1 period) (the-as uint 0)) - (set! (-> s4-1 entity) arg0) - (set! (-> s4-1 percent) 0.0) - (set! (-> s4-1 ease-in) 0.2) - (set! (-> s4-1 ease-out) 0.2) - (set! (-> s4-1 pause-in) 0.0) - (set! (-> s4-1 pause-out) 0.0) - (initialize! (-> this sync) s4-1) - ) - (when (nonzero? (-> this sync period)) - (set! (-> this path) (new 'process 'path-control this 'path 0.0 (the-as entity #f) #f)) - (when (and (zero? (-> this path curve num-cverts)) (-> this entity)) - (set! (-> this path curve num-cverts) 2) - (set! (-> this path curve cverts) (-> (new 'process 'vector-array 2) data)) - (logclear! (-> this path flags) (path-control-flag not-found)) - (let ((v1-39 (-> this path curve cverts 0))) - (let ((a0-30 (-> this entity trans))) - (let ((a1-13 *y-vector*)) - (let ((a2-8 (* 4096.0 (-> this y-start)))) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a1-13 quad)) - ) - (.lvf vf4 (&-> a0-30 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-39 quad) vf6) - ) - (let ((v1-42 (-> this path curve cverts 1))) - (let ((a0-32 (-> this entity trans))) - (let ((a1-14 *y-vector*)) - (let ((a2-10 (* 4096.0 (-> this y-end)))) - (.mov vf7 a2-10) - ) - (.lvf vf5 (&-> a1-14 quad)) - ) - (.lvf vf4 (&-> a0-32 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-42 quad) vf6) - ) - ) - (if (and (nonzero? (-> this path)) (nonzero? (-> this path curve num-cverts))) - (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) - ) - ) - (set! (-> this sound) (new 'process 'ambient-sound (-> this entity) (-> this root trans) 0.0)) - (set! (-> this edge-length) 65536.0) - (dotimes (s5-1 4) - (set! (-> this lightning s5-1) (new - 'process - 'lightning-control - (new 'static 'lightning-spec - :name #f - :flags (lightning-spec-flags lsf0) - :start-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) - :end-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) - :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5) - :fade-start-factor 0.2 - :fade-time 120.0 - :texture (new 'static 'texture-id :index #x3f :page #x4) - :reduction 0.42 - :num-points 10 - :box-size 8192.0 - :merge-factor 0.5 - :merge-count 2 - :radius 512.0 - :duration -1.0 - :sound #f - ) - this - 0.0 - ) - ) - (let ((v1-57 (-> this lightning s5-1)) - (a0-39 0) - ) - (let ((a1-18 (!= a0-39 (-> v1-57 state mode)))) - (case a0-39 - ((3) - (if a1-18 - (set! (-> v1-57 state counter) 0.0) - ) - ) - ((1) - (set! (-> v1-57 state start-color) (-> v1-57 spec start-color)) - (set! (-> v1-57 state end-color) (-> v1-57 spec end-color)) - ) - ) - ) - (set! (-> v1-57 state mode) (the-as uint a0-39)) - ) - ) - (go (method-of-object this idle)) + (stack-size-set! (-> this main-thread) 128) + (set! (-> this y-start) (res-lump-float (-> this entity) 'y-start)) + (set! (-> this y-end) (res-lump-float (-> this entity) 'y-end)) + (set! (-> this electrify) #f) + (set! (-> this sound-id) (new-sound-id)) + (init-collision! this) + (vector-copy! (-> this root trans) (-> arg0 extra trans)) + (quaternion-copy! (-> this root quat) (-> arg0 quat)) + (vector-identity! (-> this root scale)) + (vector-z-quaternion! (-> this dir) (-> this root quat)) + (set! (-> this joint-track) -1) + (set! (-> this y-disable) (+ 37888.0 (-> this root trans y))) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-tpl-elec-swing-pole" (the-as (pointer level) #f))) + (the-as pair 0) ) + (set! (-> this dir y) 0.0) + (vector-normalize! (-> this dir) 1.0) + (set! (-> this edge-length) 8192.0) + (let ((s4-1 (new 'stack-no-clear 'sync-info-params))) + (let ((a0-15 (res-lump-value arg0 'options uint128 :time -1000000000.0)) + (v1-19 0) + ) + (if (not (logtest? (the-as int a0-15) 8)) + (set! v1-19 (logior v1-19 1)) + ) + (set! (-> s4-1 sync-type) 'sync-eased) + (set! (-> s4-1 sync-flags) (the-as sync-flags v1-19)) + ) + (set! (-> s4-1 period) (the-as uint 0)) + (set! (-> s4-1 entity) arg0) + (set! (-> s4-1 percent) 0.0) + (set! (-> s4-1 ease-in) 0.2) + (set! (-> s4-1 ease-out) 0.2) + (set! (-> s4-1 pause-in) 0.0) + (set! (-> s4-1 pause-out) 0.0) + (initialize! (-> this sync) s4-1) + ) + (when (nonzero? (-> this sync period)) + (set! (-> this path) (new 'process 'path-control this 'path 0.0 (the-as entity #f) #f)) + (when (and (zero? (-> this path curve num-cverts)) (-> this entity)) + (set! (-> this path curve num-cverts) 2) + (set! (-> this path curve cverts) (-> (new 'process 'vector-array 2) data)) + (logclear! (-> this path flags) (path-control-flag not-found)) + (vector+*! (-> this path curve cverts 0) (-> this entity trans) *y-vector* (* 4096.0 (-> this y-start))) + (vector+*! (-> this path curve cverts 1) (-> this entity trans) *y-vector* (* 4096.0 (-> this y-end))) + ) + (if (and (nonzero? (-> this path)) (nonzero? (-> this path curve num-cverts))) + (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) + ) + ) + (set! (-> this sound) (new 'process 'ambient-sound (-> this entity) (-> this root trans) 0.0)) + (set! (-> this edge-length) 65536.0) + (dotimes (s5-1 4) + (set! (-> this lightning s5-1) (new + 'process + 'lightning-control + (new 'static 'lightning-spec + :name #f + :flags (lightning-spec-flags lsf0) + :start-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + :end-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5) + :fade-start-factor 0.2 + :fade-time 120.0 + :texture (new 'static 'texture-id :index #x3f :page #x4) + :reduction 0.42 + :num-points 10 + :box-size 8192.0 + :merge-factor 0.5 + :merge-count 2 + :radius 512.0 + :duration -1.0 + :sound #f + ) + this + 0.0 + ) + ) + (let ((v1-59 (-> this lightning s5-1)) + (a0-39 0) + ) + (let ((a1-18 (!= a0-39 (-> v1-59 state mode)))) + (case a0-39 + ((3) + (if a1-18 + (set! (-> v1-59 state counter) 0.0) + ) + ) + ((1) + (set! (-> v1-59 state start-color) (-> v1-59 spec start-color)) + (set! (-> v1-59 state end-color) (-> v1-59 spec end-color)) + ) + ) + ) + (set! (-> v1-59 state mode) (the-as uint a0-39)) + ) + ) + (go (method-of-object this idle)) ) ;; definition of type tpl-spindle 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 d56a4a6523..362b4b63ce 100644 --- a/test/decompiler/reference/jak3/levels/title/title-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/title/title-obs_REF.gc @@ -1340,137 +1340,107 @@ ) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (when (and (nonzero? (-> self id)) (zero? (get-status *gui-control* (-> self id)))) - (set! (-> self id) (new 'static 'sound-id)) - (remove-setting! 'music-volume) - ) - (let ((v1-7 (-> *cpad-list* cpads 0))) - (let ((f1-0 (the float (+ (-> v1-7 rightx) -128))) - (f0-2 (the float (+ (-> v1-7 righty) -128))) - ) - (if (< 64.0 (fabs f1-0)) - (set! (-> self angley) (- (-> self angley) (* 364.0889 (seconds-per-frame) f1-0))) - ) - (when (< 64.0 (fabs f0-2)) - (set! (-> self anglex) (- (-> self anglex) (* 364.0889 (seconds-per-frame) f0-2))) - (set! (-> self anglex) (fmax -5461.3335 (fmin 5461.3335 (-> self anglex)))) + (when (and (nonzero? (-> self id)) (zero? (get-status *gui-control* (-> self id)))) + (set! (-> self id) (new 'static 'sound-id)) + (remove-setting! 'music-volume) + ) + (let ((v1-7 (-> *cpad-list* cpads 0))) + (let ((f1-0 (the float (+ (-> v1-7 rightx) -128))) + (f0-2 (the float (+ (-> v1-7 righty) -128))) ) - ) - (the float (+ (-> v1-7 leftx) -128)) - (let ((f0-10 (the float (+ (-> v1-7 lefty) -128)))) - (when (< 64.0 (fabs f0-10)) - (+! (-> self zoom) (* 204.8 (seconds-per-frame) f0-10)) - (set! (-> self zoom) (fmax (fmin (-> self zoom) (-> self char zoom-max)) (-> self char zoom-min))) + (if (< 64.0 (fabs f1-0)) + (set! (-> self angley) (- (-> self angley) (* 364.0889 (seconds-per-frame) f1-0))) ) - ) - (let ((f1-11 (the float (-> v1-7 abutton 9))) - (f0-18 (the float (-> v1-7 abutton 8))) - ) - (+! (-> self updown) (* 50.0 (seconds-per-frame) f1-11)) - (set! (-> self updown) (- (-> self updown) (* 50.0 (seconds-per-frame) f0-18))) + (when (< 64.0 (fabs f0-2)) + (set! (-> self anglex) (- (-> self anglex) (* 364.0889 (seconds-per-frame) f0-2))) + (set! (-> self anglex) (fmax -5461.3335 (fmin 5461.3335 (-> self anglex)))) ) ) - (set! (-> self updown) (fmax (fmin (-> self updown) (-> self char height-max)) (-> self char height-min))) - (+! (-> self pos-x) (* 5.0 (seconds-per-frame) (- (-> self dest-pos-x) (-> self pos-x)))) - (if (< 520.0 (fabs (-> self pos-x))) - (deactivate self) - ) - (if (nonzero? (-> self skel)) - (set-vector! (-> self draw color-mult) (-> self alpha) (-> self alpha) (-> self alpha) 1.0) - ) - (if (< (fabs (-> self dest-pos-x)) 200.0) - (seek! (-> self alpha) 1.0 (* 2.0 (seconds-per-frame))) - (seek! (-> self alpha) 0.0 (* 2.0 (seconds-per-frame))) - ) - (cond - ((not (time-elapsed? (-> self state-time) (-> self cloth-reset-time))) - (process-drawable-cloth-command self '(reset)) - ) - ((-> self use-orient-cloth-reset?) - (process-drawable-cloth-command self '(set-flags local-space)) - ) - (else - (process-drawable-cloth-command self '(set-flags local-space-xyz)) + (the float (+ (-> v1-7 leftx) -128)) + (let ((f0-10 (the float (+ (-> v1-7 lefty) -128)))) + (when (< 64.0 (fabs f0-10)) + (+! (-> self zoom) (* 204.8 (seconds-per-frame) f0-10)) + (set! (-> self zoom) (fmax (fmin (-> self zoom) (-> self char zoom-max)) (-> self char zoom-min))) ) ) - (let ((a2-3 (new 'stack-no-clear 'vector)) - (a1-7 (new 'stack-no-clear 'vector)) - (v1-40 (new 'stack-no-clear 'vector)) - (gp-2 (new 'stack-no-clear 'vector)) + (let ((f1-11 (the float (-> v1-7 abutton 9))) + (f0-18 (the float (-> v1-7 abutton 8))) ) - (let ((a3-0 (new 'stack-no-clear 'vector))) - (vector-copy! v1-40 (-> *math-camera* trans)) - (set-vector! a3-0 (-> self pos-x) 0.0 0.0 1.0) - (vector-copy! a2-3 (-> *math-camera* inv-camera-rot fvec)) - (let ((a0-42 a1-7)) - (let ((t0-8 (-> *math-camera* inv-camera-rot fvec))) - (let ((t1-0 (-> self zoom))) - (.mov vf7 t1-0) - ) - (.lvf vf5 (&-> t0-8 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 (&-> a0-42 quad) vf6) - ) - (reverse-transform-point! gp-2 a1-7 a2-3 a3-0) + (+! (-> self updown) (* 50.0 (seconds-per-frame) f1-11)) + (set! (-> self updown) (- (-> self updown) (* 50.0 (seconds-per-frame) f0-18))) + ) + ) + (set! (-> self updown) (fmax (fmin (-> self updown) (-> self char height-max)) (-> self char height-min))) + (+! (-> self pos-x) (* 5.0 (seconds-per-frame) (- (-> self dest-pos-x) (-> self pos-x)))) + (if (< 520.0 (fabs (-> self pos-x))) + (deactivate self) + ) + (if (nonzero? (-> self skel)) + (set-vector! (-> self draw color-mult) (-> self alpha) (-> self alpha) (-> self alpha) 1.0) + ) + (if (< (fabs (-> self dest-pos-x)) 200.0) + (seek! (-> self alpha) 1.0 (* 2.0 (seconds-per-frame))) + (seek! (-> self alpha) 0.0 (* 2.0 (seconds-per-frame))) + ) + (cond + ((not (time-elapsed? (-> self state-time) (-> self cloth-reset-time))) + (process-drawable-cloth-command self '(reset)) + ) + ((-> self use-orient-cloth-reset?) + (process-drawable-cloth-command self '(set-flags local-space)) + ) + (else + (process-drawable-cloth-command self '(set-flags local-space-xyz)) + ) + ) + (let ((a2-3 (new 'stack-no-clear 'vector)) + (a1-7 (new 'stack-no-clear 'vector)) + (v1-40 (new 'stack-no-clear 'vector)) + (gp-2 (new 'stack-no-clear 'vector)) ) - (vector-copy! (-> self root trans) gp-2) + (let ((a3-0 (new 'stack-no-clear 'vector))) + (vector-copy! v1-40 (-> *math-camera* trans)) + (set-vector! a3-0 (-> self pos-x) 0.0 0.0 1.0) + (vector-copy! a2-3 (-> *math-camera* inv-camera-rot fvec)) + (vector+*! a1-7 v1-40 (-> *math-camera* inv-camera-rot fvec) (-> self zoom)) + (reverse-transform-point! gp-2 a1-7 a2-3 a3-0) ) - (matrix->quaternion (-> self root quat) (-> *math-camera* inv-camera-rot)) - (quaternion*! - (-> self root quat) - (-> self root quat) - (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *y-vector* (-> self angley)) - ) - (let ((gp-4 (-> self root trans))) - (let ((s5-1 (-> self root trans))) - (let ((v1-50 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) - (let ((a0-49 (- (-> self updown)))) - (.mov vf7 a0-49) - ) - (.lvf vf5 (&-> v1-50 quad)) - ) - (.lvf vf4 (&-> s5-1 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 (&-> gp-4 quad) vf6) - ) - (let ((gp-5 (new - 'stack - 'font-context - *font-default-matrix* - 20 - 350 - 0.0 - (font-color font-color-43) - (font-flags shadow kerning) - ) + (vector-copy! (-> self root trans) gp-2) + ) + (matrix->quaternion (-> self root quat) (-> *math-camera* inv-camera-rot)) + (quaternion*! + (-> self root quat) + (-> self root quat) + (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *y-vector* (-> self angley)) + ) + (vector+*! + (-> self root trans) + (-> self root trans) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) + (- (-> self updown)) + ) + (let ((gp-6 (new + 'stack + 'font-context + *font-default-matrix* + 20 + 350 + 0.0 + (font-color font-color-43) + (font-flags shadow kerning) ) - ) - (set-width! gp-5 300) - (set-height! gp-5 30) - (set-scale! gp-5 0.7) - (let ((v1-55 gp-5)) - (set! (-> v1-55 alpha) (-> self alpha)) - ) - (set! (-> gp-5 flags) (font-flags shadow kerning large)) - (let ((s5-2 print-game-text)) - (format (clear *temp-string*) (lookup-text! *common-text* (-> self char text-id) #f)) - (s5-2 *temp-string* gp-5 #f 44 (bucket-id hud-draw-hud-alpha)) + ) ) + (set-width! gp-6 300) + (set-height! gp-6 30) + (set-scale! gp-6 0.7) + (let ((v1-55 gp-6)) + (set! (-> v1-55 alpha) (-> self alpha)) + ) + (set! (-> gp-6 flags) (font-flags shadow kerning large)) + (let ((s5-2 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (-> self char text-id) #f)) + (s5-2 *temp-string* gp-6 #f 44 (bucket-id hud-draw-hud-alpha)) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/wascity/ctymark-obs_REF.gc b/test/decompiler/reference/jak3/levels/wascity/ctymark-obs_REF.gc index e11ac13881..2e17d2bafe 100644 --- a/test/decompiler/reference/jak3/levels/wascity/ctymark-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/ctymark-obs_REF.gc @@ -1203,74 +1203,37 @@ ;; definition for function fruit-sparticle-next-on-mode-1 (defun fruit-sparticle-next-on-mode-1 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (-> arg1 key))) - (cond - ((zero? (-> s5-0 state-mode 0)) - (set! (-> arg1 next-time) - (the-as uint (* (max 1 (the-as int (-> *display* clock (-> arg1 clock-index) sparticle-data x))) 2)) - ) - ) - (else - (let ((s4-0 (new 'stack-no-clear 'vector))) - 0.0 - 0.0 - 0.0 - (let* ((f28-0 (/ 1.0 (/ (-> arg1 omega) METER_LENGTH))) - (f26-0 (* (rand-vu-float-range -136.53334 136.53334) f28-0)) - (f30-0 (* (rand-vu-float-range 0.0 136.53334) f28-0)) - (f0-8 (* (rand-vu-float-range -13.653334 54.613335) f28-0)) - ) - (vector-float*! s4-0 (-> s5-0 origin rvec) f26-0) - (let ((a1-5 s4-0)) - (let ((v1-8 s4-0)) - (let ((a0-10 (-> s5-0 origin uvec))) - (let ((a2-1 f30-0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-10 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 (&-> a1-5 quad) vf6) - ) - (let ((a1-6 s4-0)) - (let ((v1-9 s4-0)) - (let ((a0-11 (-> s5-0 origin fvec))) - (let ((a2-2 f0-8)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-11 quad)) - ) - (.lvf vf4 (&-> v1-9 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-6 quad) vf6) - ) - ) - (set! (-> arg1 vel-sxvel x) (-> s4-0 x)) - (set! (-> arg1 vel-sxvel y) (-> s4-0 y)) - (set! (-> arg1 vel-sxvel z) (-> s4-0 z)) + (let ((s5-0 (-> arg1 key))) + (cond + ((zero? (-> s5-0 state-mode 0)) + (set! (-> arg1 next-time) + (the-as uint (* (max 1 (the-as int (-> *display* clock (-> arg1 clock-index) sparticle-data x))) 2)) + ) + ) + (else + (let ((s4-0 (new 'stack-no-clear 'vector))) + 0.0 + 0.0 + 0.0 + (let* ((f28-0 (/ 1.0 (/ (-> arg1 omega) METER_LENGTH))) + (f26-0 (* (rand-vu-float-range -136.53334 136.53334) f28-0)) + (f30-0 (* (rand-vu-float-range 0.0 136.53334) f28-0)) + (f0-8 (* (rand-vu-float-range -13.653334 54.613335) f28-0)) + ) + (vector-float*! s4-0 (-> s5-0 origin rvec) f26-0) + (vector+*! s4-0 s4-0 (-> s5-0 origin uvec) f30-0) + (vector+*! s4-0 s4-0 (-> s5-0 origin fvec) f0-8) ) - (-> arg1 vel-sxvel) - (set! (-> arg1 user-float) (+ (-> s5-0 origin trans y) (-> arg1 omega))) + (set! (-> arg1 vel-sxvel x) (-> s4-0 x)) + (set! (-> arg1 vel-sxvel y) (-> s4-0 y)) + (set! (-> arg1 vel-sxvel z) (-> s4-0 z)) ) + (-> arg1 vel-sxvel) + (set! (-> arg1 user-float) (+ (-> s5-0 origin trans y) (-> arg1 omega))) ) ) - 0.0 ) + 0.0 ) ;; failed to figure out what this is: 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 e737d3cf2b..f528a58b79 100644 --- a/test/decompiler/reference/jak3/levels/wascity/traffic-util_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/traffic-util_REF.gc @@ -616,121 +616,74 @@ ;; definition for method 12 of type city-level-info ;; INFO: Used lq/sq (defmethod city-level-info-method-12 ((this city-level-info) (arg0 vector) (arg1 nav-branch) (arg2 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s2-0 (-> arg1 dest-node)) - (s3-0 #t) - (s5-0 (new 'stack-no-clear 'inline-array 'vector 7)) + (let ((s2-0 (-> arg1 dest-node)) + (s3-0 #t) + (s5-0 (new 'stack-no-clear 'inline-array 'vector 7)) + ) + (let ((a1-1 s2-0) + (v1-0 (-> s5-0 2)) ) - (let ((a1-1 s2-0) - (v1-0 (-> s5-0 2)) - ) - (vector-copy! v1-0 (-> a1-1 position)) - (set! (-> v1-0 w) 1.0) - ) - (let ((v1-1 s2-0) - (s1-0 (-> s5-0 3)) - ) - (let ((f0-2 (the float (-> v1-1 angle))) - (s0-0 (new 'stack-no-clear 'vector)) - ) - (sincos! s0-0 f0-2) - (set! (-> s1-0 x) (-> s0-0 y)) - (set! (-> s1-0 y) 0.0) - (set! (-> s1-0 z) (- (-> s0-0 x))) - ) - (set! (-> s1-0 w) 1.0) - ) - (vector-! (-> s5-0 5) (-> s5-0 2) arg0) - (vector-copy! (-> s5-0 4) (-> s5-0 3)) - (set! (-> s5-0 4 x) (-> s5-0 3 z)) - (set! (-> s5-0 4 z) (- (-> s5-0 3 x))) - (when (< 0.0 (vector-dot (-> s5-0 5) (-> s5-0 4))) - (set! s3-0 #f) - (vector-float*! (-> s5-0 4) (-> s5-0 4) -1.0) - ) - (let ((a1-8 (-> s5-0 6))) - (let ((v1-12 (-> s5-0 2))) - (let ((a0-9 (-> s5-0 4))) - (let* ((a2-1 s2-0) - (a2-4 (* 1024.0 (the float (-> a2-1 radius)))) - ) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a0-9 quad)) - ) - (.lvf vf4 (&-> v1-12 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-8 quad) vf6) - ) - (set! (-> s5-0 6 w) (* 1024.0 (the float (-> s2-0 radius)))) - (vector-! (-> s5-0 0) (-> s5-0 6) arg0) - (set! (-> s5-0 0 y) 0.0) - (let* ((v1-17 (-> s5-0 0)) - (f30-0 (sqrtf (+ (* (-> v1-17 x) (-> v1-17 x)) (* (-> v1-17 z) (-> v1-17 z))))) - (f28-0 (-> s5-0 6 w)) - ) - (vector-xz-normalize! (-> s5-0 0) 1.0) - (set! (-> s5-0 1 x) (-> s5-0 0 z)) - (set! (-> s5-0 1 y) 0.0) - (set! (-> s5-0 1 z) (- (-> s5-0 0 x))) - (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))))) - (f0-35 (/ (* f28-0 f1-12) f30-0)) - ) - (let ((f1-15 (/ (* f1-12 f1-12) f30-0))) - (vector-copy! arg2 arg0) - (let ((a1-13 arg2)) - (let ((v1-26 arg2)) - (let ((a0-14 (-> s5-0 0))) - (let ((a2-5 f1-15)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-14 quad)) - ) - (.lvf vf4 (&-> v1-26 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-13 quad) vf6) - ) - ) - (let ((a1-14 arg2)) - (let ((v1-27 arg2)) - (let ((a0-15 (-> s5-0 1))) - (let ((a2-6 f0-35)) - (.mov vf7 a2-6) - ) - (.lvf vf5 (&-> a0-15 quad)) - ) - (.lvf vf4 (&-> v1-27 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! (-> arg2 y) (-> s5-0 2 y)) + (vector-copy! v1-0 (-> a1-1 position)) + (set! (-> v1-0 w) 1.0) ) - arg2 + (let ((v1-1 s2-0) + (s1-0 (-> s5-0 3)) + ) + (let ((f0-2 (the float (-> v1-1 angle))) + (s0-0 (new 'stack-no-clear 'vector)) + ) + (sincos! s0-0 f0-2) + (set! (-> s1-0 x) (-> s0-0 y)) + (set! (-> s1-0 y) 0.0) + (set! (-> s1-0 z) (- (-> s0-0 x))) + ) + (set! (-> s1-0 w) 1.0) + ) + (vector-! (-> s5-0 5) (-> s5-0 2) arg0) + (vector-copy! (-> s5-0 4) (-> s5-0 3)) + (set! (-> s5-0 4 x) (-> s5-0 3 z)) + (set! (-> s5-0 4 z) (- (-> s5-0 3 x))) + (when (< 0.0 (vector-dot (-> s5-0 5) (-> s5-0 4))) + (set! s3-0 #f) + (vector-float*! (-> s5-0 4) (-> s5-0 4) -1.0) + ) + (let ((a1-8 (-> s5-0 6)) + (v1-12 (-> s5-0 2)) + (a0-9 (-> s5-0 4)) + (a2-1 s2-0) + ) + (vector+*! a1-8 v1-12 a0-9 (* 1024.0 (the float (-> a2-1 radius)))) + ) + (set! (-> s5-0 6 w) (* 1024.0 (the float (-> s2-0 radius)))) + (vector-! (-> s5-0 0) (-> s5-0 6) arg0) + (set! (-> s5-0 0 y) 0.0) + (let* ((v1-17 (-> s5-0 0)) + (f30-0 (sqrtf (+ (* (-> v1-17 x) (-> v1-17 x)) (* (-> v1-17 z) (-> v1-17 z))))) + (f28-0 (-> s5-0 6 w)) + ) + (vector-xz-normalize! (-> s5-0 0) 1.0) + (set! (-> s5-0 1 x) (-> s5-0 0 z)) + (set! (-> s5-0 1 y) 0.0) + (set! (-> s5-0 1 z) (- (-> s5-0 0 x))) + (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))))) + (f0-35 (/ (* f28-0 f1-12) f30-0)) + ) + (let ((f1-15 (/ (* f1-12 f1-12) f30-0))) + (vector-copy! arg2 arg0) + (vector+*! arg2 arg2 (-> s5-0 0) f1-15) + ) + (vector+*! arg2 arg2 (-> s5-0 1) f0-35) + ) + ) + (set! (-> arg2 y) (-> s5-0 2 y)) ) + arg2 ) ;; definition for method 18 of type city-level-info 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 d9f6ce4359..b2a86a7fad 100644 --- a/test/decompiler/reference/jak3/levels/wascity/wascity-turret_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/wascity-turret_REF.gc @@ -154,93 +154,44 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod explode-turret ((this wascity-turret)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((v1-1 (new 'stack-no-clear 'vector))) - (let ((a0-2 (-> s5-0 fountain-rand-transv-lo))) - (let ((a1-2 (-> this root trans))) - (let ((a2-1 *up-vector*)) - (let ((a3-1 2048.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-1 quad)) - ) - (.lvf vf4 (&-> a1-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 (&-> a0-2 quad) vf6) - ) - (vector-float*! v1-1 *up-vector* 81920.0) - (let ((a2-3 (-> s5-0 fountain-rand-transv-lo))) - (let ((a0-5 v1-1)) - (let ((a1-4 *identity-vector*)) - (let ((a3-3 -40960.0)) - (.mov vf7 a3-3) - ) - (.lvf vf5 (&-> a1-4 quad)) - ) - (.lvf vf4 (&-> a0-5 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-3 quad) vf6) - ) - (let ((a1-5 (-> s5-0 fountain-rand-transv-hi))) - (let ((a0-6 *identity-vector*)) - (let ((a2-5 40960.0)) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-6 quad)) - ) - (.lvf vf4 (&-> v1-1 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-5 quad) vf6) - ) - ) - (set! (-> s5-0 gravity) -122880.0) - (set! (-> s5-0 rot-speed) 16.0) - (sound-play "turret-explode") - (process-spawn - joint-exploder - (art-group-get-by-name *level* "skel-wascity-turret-explode" (the-as (pointer level) #f)) - 7 - s5-0 - *wascity-turret-exploder-params* - :name "joint-exploder" - :to this - :unk 0 - ) + (let ((s5-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((v1-1 (new 'stack-no-clear 'vector))) + (vector+*! (-> s5-0 fountain-rand-transv-lo) (-> this root trans) *up-vector* 2048.0) + (vector-float*! v1-1 *up-vector* 81920.0) + (vector+*! (-> s5-0 fountain-rand-transv-lo) v1-1 *identity-vector* -40960.0) + (vector+*! (-> s5-0 fountain-rand-transv-hi) v1-1 *identity-vector* 40960.0) ) - (set! (-> *game-info* health-bar-vehicle) 0.0) - (let ((v1-12 (new 'stack-no-clear 'vector))) - (vector-copy! v1-12 (-> this root trans)) - (+! (-> v1-12 y) 8192.0) - (cond - ((logtest? (-> *part-group-id-table* 542 flags) (sp-group-flag sp13)) - (vector-copy! (-> *launch-matrix* trans) v1-12) - (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 542)) - ) - (else - (vector-copy! (-> *launch-matrix* trans) v1-12) - (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 542)) - ) - ) + (set! (-> s5-0 gravity) -122880.0) + (set! (-> s5-0 rot-speed) 16.0) + (sound-play "turret-explode") + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-wascity-turret-explode" (the-as (pointer level) #f)) + 7 + s5-0 + *wascity-turret-exploder-params* + :name "joint-exploder" + :to this + :unk 0 ) - 0 - (none) ) + (set! (-> *game-info* health-bar-vehicle) 0.0) + (let ((v1-12 (new 'stack-no-clear 'vector))) + (vector-copy! v1-12 (-> this root trans)) + (+! (-> v1-12 y) 8192.0) + (cond + ((logtest? (-> *part-group-id-table* 542 flags) (sp-group-flag sp13)) + (vector-copy! (-> *launch-matrix* trans) v1-12) + (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 542)) + ) + (else + (vector-copy! (-> *launch-matrix* trans) v1-12) + (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 542)) + ) + ) + ) + 0 + (none) ) ;; definition for method 36 of type wascity-turret @@ -321,127 +272,62 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod target-turret-method-44 ((this wascity-turret)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (wascity-turret-method-62 this) - (when (nonzero? (-> this part)) - (-> this node-list data 4 bone transform) - (let ((s4-0 (new 'stack-no-clear 'matrix)) - (s5-0 (new 'stack-no-clear 'matrix)) - ) - (quaternion->matrix s4-0 (-> this root quat)) - (vector-copy! (-> s4-0 trans) (-> this root trans)) - (matrix-identity! s5-0) - (vector-copy! (-> s5-0 trans) *wascity-display-offset*) - (matrix*! s5-0 s5-0 s4-0) - (vector-copy! (-> s4-0 trans) (-> s5-0 trans)) - (dotimes (s3-0 (the-as int (-> this radar-object-counter))) - (let* ((f0-1 (* 2867.2 (-> this radar-object s3-0 x))) - (f1-2 (* 819.2 (+ -0.12 (-> this radar-object s3-0 y)))) - (f1-3 (+ -0.12 f1-2)) - ) - (when (and (< -2867.2 f0-1) (< f0-1 2867.2) (< -819.2 f1-3) (< f1-3 819.2)) - (let ((a1-2 (-> s5-0 trans))) - (let ((v1-28 (-> s4-0 trans))) - (let ((a0-12 (-> s5-0 rvec))) - (let ((a2-1 f0-1)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a0-12 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 (&-> a1-2 quad) vf6) - ) - (let ((a1-3 (-> s5-0 trans))) - (let ((v1-29 (-> s5-0 trans))) - (let ((a0-13 (-> s5-0 uvec))) - (let ((a2-2 f1-3)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-13 quad)) - ) - (.lvf vf4 (&-> v1-29 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-3 quad) vf6) - ) - (spawn-from-mat (-> this part) s5-0) - ) + (wascity-turret-method-62 this) + (when (nonzero? (-> this part)) + (-> this node-list data 4 bone transform) + (let ((s4-0 (new 'stack-no-clear 'matrix)) + (s5-0 (new 'stack-no-clear 'matrix)) + ) + (quaternion->matrix s4-0 (-> this root quat)) + (vector-copy! (-> s4-0 trans) (-> this root trans)) + (matrix-identity! s5-0) + (vector-copy! (-> s5-0 trans) *wascity-display-offset*) + (matrix*! s5-0 s5-0 s4-0) + (vector-copy! (-> s4-0 trans) (-> s5-0 trans)) + (dotimes (s3-0 (the-as int (-> this radar-object-counter))) + (let* ((f0-1 (* 2867.2 (-> this radar-object s3-0 x))) + (f1-2 (* 819.2 (+ -0.12 (-> this radar-object s3-0 y)))) + (f1-3 (+ -0.12 f1-2)) + ) + (when (and (< -2867.2 f0-1) (< f0-1 2867.2) (< -819.2 f1-3) (< f1-3 819.2)) + (vector+*! (-> s5-0 trans) (-> s4-0 trans) (-> s5-0 rvec) f0-1) + (vector+*! (-> s5-0 trans) (-> s5-0 trans) (-> s5-0 uvec) f1-3) + (spawn-from-mat (-> this part) s5-0) ) ) - (when (nonzero? (-> this reticle-part)) - (let ((s1-0 (vector<-fire-pos! this (new 'stack-no-clear 'vector))) - (s2-0 (new 'stack-no-clear 'vector)) - (s3-1 (new 'stack-no-clear 'vector)) - ) - 0.0 - (vector-! s2-0 (target-pos 0) s1-0) - (let ((f0-6 (atan (-> s2-0 x) (fabs (-> s2-0 z))))) - (if (< (-> s2-0 z) 0.0) - (set! f0-6 (- f0-6)) - ) - (set! (-> s3-1 x) (/ f0-6 (meters 4))) + ) + (when (nonzero? (-> this reticle-part)) + (let ((s1-0 (vector<-fire-pos! this (new 'stack-no-clear 'vector))) + (s2-0 (new 'stack-no-clear 'vector)) + (s3-1 (new 'stack-no-clear 'vector)) ) - (let ((f0-13 (atan (-> s2-0 y) (sqrtf (+ (* (-> s2-0 x) (-> s2-0 x)) (* (-> s2-0 z) (-> s2-0 z))))))) - (set! (-> s3-1 y) (* -0.00014085036 f0-13)) - ) - (let ((f0-16 (* 2867.2 (-> s3-1 x))) - (f1-12 (* 819.2 (+ -0.12 (-> s3-1 y)))) - ) - (when (and (< -2867.2 f0-16) (< f0-16 2867.2) (< -819.2 f1-12) (< f1-12 819.2)) - (let ((v1-55 (-> s5-0 trans))) - (let ((a0-19 (-> s4-0 trans))) - (let ((a1-8 (-> s5-0 rvec))) - (let ((a2-3 f0-16)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a1-8 quad)) - ) - (.lvf vf4 (&-> a0-19 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-55 quad) vf6) - ) - (let ((a1-9 (-> s5-0 trans))) - (let ((v1-56 (-> s5-0 trans))) - (let ((a0-20 (-> s5-0 uvec))) - (let ((a2-4 f1-12)) - (.mov vf7 a2-4) - ) - (.lvf vf5 (&-> a0-20 quad)) - ) - (.lvf vf4 (&-> v1-56 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-9 quad) vf6) - ) - (spawn-from-mat (-> this reticle-part) s5-0) + 0.0 + (vector-! s2-0 (target-pos 0) s1-0) + (let ((f0-6 (atan (-> s2-0 x) (fabs (-> s2-0 z))))) + (if (< (-> s2-0 z) 0.0) + (set! f0-6 (- f0-6)) ) + (set! (-> s3-1 x) (/ f0-6 (meters 4))) + ) + (let ((f0-13 (atan (-> s2-0 y) (sqrtf (+ (* (-> s2-0 x) (-> s2-0 x)) (* (-> s2-0 z) (-> s2-0 z))))))) + (set! (-> s3-1 y) (* -0.00014085036 f0-13)) + ) + (let ((f0-16 (* 2867.2 (-> s3-1 x))) + (f1-12 (* 819.2 (+ -0.12 (-> s3-1 y)))) + ) + (when (and (< -2867.2 f0-16) (< f0-16 2867.2) (< -819.2 f1-12) (< f1-12 819.2)) + (vector+*! (-> s5-0 trans) (-> s4-0 trans) (-> s5-0 rvec) f0-16) + (vector+*! (-> s5-0 trans) (-> s5-0 trans) (-> s5-0 uvec) f1-12) + (spawn-from-mat (-> this reticle-part) s5-0) ) ) ) ) - 0 ) 0 - (none) ) + 0 + (none) ) ;; definition for method 35 of type wascity-turret @@ -886,83 +772,41 @@ ;; definition for method 60 of type wascity-turret (defmethod vector<-fire-pos! ((this wascity-turret) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((v0-0 arg0)) - (let ((v1-4 (-> this - node-list - data - (if (-> this left?) - 5 - 6 - ) - bone - transform - trans - ) - ) + (vector+*! + arg0 + (-> this + node-list + data + (if (-> this left?) + 5 + 6 ) - (let ((a0-1 (-> this aim-dir))) - (let ((a1-2 3276800.0)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-4 quad)) + bone + transform + trans ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> v0-0 quad) vf6) - v0-0 - ) + (-> this aim-dir) + 3276800.0 ) ) ;; definition for method 61 of type wascity-turret (defmethod vector<-reticle-fire-pos! ((this wascity-turret) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((v0-0 arg0)) - (let ((v1-4 (-> this - node-list - data - (if (-> this left?) - 5 - 6 - ) - bone - transform - trans - ) - ) + (vector+*! + arg0 + (-> this + node-list + data + (if (-> this left?) + 5 + 6 ) - (let ((a0-1 (-> this reticle-dir))) - (let ((a1-2 3276800.0)) - (.mov vf7 a1-2) - ) - (.lvf vf5 (&-> a0-1 quad)) - ) - (.lvf vf4 (&-> v1-4 quad)) + bone + transform + trans ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> v0-0 quad) vf6) - v0-0 - ) + (-> this reticle-dir) + 3276800.0 ) ) @@ -1236,12 +1080,10 @@ (sv-1040 vector) ) (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) + (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) - (vf7 :class vf) ) (init-vf0-vector) (let ((s5-0 (new 'stack-no-clear 'matrix)) @@ -1348,21 +1190,7 @@ (if #f (add-debug-sphere #t (bucket-id debug) s1-1 (meters 12) *color-red*) ) - (let ((a0-43 s0-1)) - (let ((v1-89 s1-1)) - (let ((a1-15 (-> (the-as skeet sv-960) pvel))) - (let ((a2-9 f28-1)) - (.mov vf7 a2-9) - ) - (.lvf vf5 (&-> a1-15 quad)) - ) - (.lvf vf4 (&-> v1-89 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-43 quad) vf6) - ) + (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*) 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 9684b3636c..db807430c1 100644 --- a/test/decompiler/reference/jak3/levels/wascity/wasdef-manager_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/wasdef-manager_REF.gc @@ -911,51 +911,28 @@ ;; definition for method 41 of type maker ;; INFO: Used lq/sq (defmethod maker-method-41 ((this maker) (arg0 vector)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (new 'stack-no-clear 'collide-query)) - (s5-0 (new 'stack-no-clear 'vector)) - ) - (vector-copy! (-> s4-0 start-pos) arg0) - (+! (-> s4-0 start-pos y) 81920.0) - (set-vector! (-> s4-0 move-dist) 0.0 -163840.0 0.0 1.0) - (let ((v1-3 s4-0)) - (set! (-> v1-3 radius) 40.96) - (set! (-> v1-3 collide-with) (collide-spec backgnd)) - (set! (-> v1-3 ignore-process0) #f) - (set! (-> v1-3 ignore-process1) #f) - (set! (-> v1-3 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) - ) - (set! (-> v1-3 action-mask) (collide-action solid)) + (let ((s4-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (new 'stack-no-clear 'vector)) ) - (let ((f0-7 (fill-and-probe-using-line-sphere *collide-cache* s4-0))) - (when (< 0.0 f0-7) - (let ((a0-11 s5-0)) - (let ((v1-6 (-> s4-0 start-pos))) - (let ((a1-2 (-> s4-0 move-dist))) - (let ((a2-0 f0-7)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a1-2 quad)) - ) - (.lvf vf4 (&-> v1-6 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-11 quad) vf6) + (vector-copy! (-> s4-0 start-pos) arg0) + (+! (-> s4-0 start-pos y) 81920.0) + (set-vector! (-> s4-0 move-dist) 0.0 -163840.0 0.0 1.0) + (let ((v1-3 s4-0)) + (set! (-> v1-3 radius) 40.96) + (set! (-> v1-3 collide-with) (collide-spec backgnd)) + (set! (-> v1-3 ignore-process0) #f) + (set! (-> v1-3 ignore-process1) #f) + (set! (-> v1-3 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) ) - ) - ) - (- (-> s5-0 y) (-> arg0 y)) + (set! (-> v1-3 action-mask) (collide-action solid)) ) + (let ((f0-7 (fill-and-probe-using-line-sphere *collide-cache* s4-0))) + (if (< 0.0 f0-7) + (vector+*! s5-0 (-> s4-0 start-pos) (-> s4-0 move-dist) f0-7) + ) + ) + (- (-> s5-0 y) (-> arg0 y)) ) ) @@ -1444,119 +1421,96 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod maker-method-36 ((this maker)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) + (let* ((s4-0 (-> this node-list data 50)) + (s5-0 (vector<-cspace! (new 'stack-no-clear 'vector) s4-0)) + (s4-1 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s4-0 bone transform fvec) 1.0)) + (s3-0 (new 'stack-no-clear 'vector)) ) - (init-vf0-vector) - (let* ((s4-0 (-> this node-list data 50)) - (s5-0 (vector<-cspace! (new 'stack-no-clear 'vector) s4-0)) - (s4-1 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s4-0 bone transform fvec) 1.0)) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (vector-copy! s3-0 (target-pos 0)) - (new 'stack-no-clear 'vector) - 0.0 - 0.0 - (let ((f30-0 0.0)) - (vector-! s4-1 (target-pos 0) s5-0) - (set! (-> s4-1 y) 0.0) - (vector-normalize! s4-1 1.0) - (let ((a1-3 s5-0)) - (let ((v1-6 s5-0)) - (let ((a0-7 s4-1)) - (let ((a2-2 122880.0)) - (.mov vf7 a2-2) - ) - (.lvf vf5 (&-> a0-7 quad)) - ) - (.lvf vf4 (&-> v1-6 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-3 quad) vf6) - ) - (let* ((f0-5 (* 0.18333334 (vector-vector-xz-distance s5-0 s3-0))) - (f28-1 (fmax 163840.0 (fmin 450560.0 f0-5))) - ) - (let ((f0-8 (/ (vector-vector-xz-distance s5-0 s3-0) f28-1))) - (if (< 0.0 f0-8) - (set! f30-0 (+ (/ (- (-> s3-0 y) (-> s5-0 y)) f0-8) (* 20480.0 f0-8))) - ) - ) - (cond - ((>= (-> this root trans z) -1937408.0) - (let ((s3-1 (new 'stack-no-clear 'projectile-init-by-other-params))) - (let ((s2-3 (rand-vu-sphere-point-uniform! (new 'stack-no-clear 'vector) (rand-vu-float-range 204800.0 409600.0)))) - (new 'stack-no-clear 'vector) - (vector-normalize! s4-1 f28-1) - (set! (-> s3-1 ent) (-> this entity)) - (set! (-> s3-1 charge) 1.0) - (set! (-> s3-1 options) (projectile-options)) - (logclear! (-> s3-1 options) (projectile-options po14 po15 po16)) - (vector-copy! (-> s3-1 pos) s5-0) - (vector-copy! (-> s3-1 vel) s2-3) - ) - (set! (-> s3-1 notify-handle) (the-as handle #f)) - (set! (-> s3-1 owner-handle) (the-as handle #f)) - (set! (-> s3-1 target-handle) (the-as handle #f)) - (set! (-> s3-1 target-pos quad) (the-as uint128 0)) - (set! (-> s3-1 ignore-handle) (process->handle this)) - (let* ((v1-26 *game-info*) - (a0-21 (+ (-> v1-26 attack-id) 1)) - ) - (set! (-> v1-26 attack-id) a0-21) - (set! (-> s3-1 attack-id) a0-21) - ) - (set! (-> s3-1 timeout) (seconds 4)) - (let ((s5-1 (new 'static 'vector4w))) - (+! (-> s5-1 x) 1) - (when (< 2 (-> s5-1 x)) - (sound-play "dm-throw") - (set! (-> s5-1 x) 0) - 0 - ) - ) - (spawn-projectile dm-flyer-shot s3-1 this *default-dead-pool*) - ) + (vector-copy! s3-0 (target-pos 0)) + (new 'stack-no-clear 'vector) + 0.0 + 0.0 + (let ((f30-0 0.0)) + (vector-! s4-1 (target-pos 0) s5-0) + (set! (-> s4-1 y) 0.0) + (vector-normalize! s4-1 1.0) + (vector+*! s5-0 s5-0 s4-1 122880.0) + (let* ((f0-5 (* 0.18333334 (vector-vector-xz-distance s5-0 s3-0))) + (f28-1 (fmax 163840.0 (fmin 450560.0 f0-5))) ) - (else - (vector-normalize! s4-1 f28-1) - (+! (-> s4-1 y) f30-0) - (let ((s3-2 (new 'stack-no-clear 'projectile-init-by-other-params))) - (set! (-> s3-2 ent) (-> this entity)) - (set! (-> s3-2 charge) 1.0) - (set! (-> s3-2 options) (projectile-options)) - (logclear! (-> s3-2 options) (projectile-options po14 po15 po16)) - (vector-copy! (-> s3-2 pos) s5-0) - (vector-copy! (-> s3-2 vel) s4-1) - (set! (-> s3-2 notify-handle) (the-as handle #f)) - (set! (-> s3-2 owner-handle) (process->handle this)) - (set! (-> s3-2 target-handle) (the-as handle #f)) - (vector-copy! (-> s3-2 target-pos) (target-pos 0)) - (set! (-> s3-2 ignore-handle) (process->handle this)) - (let* ((v1-50 *game-info*) - (a0-41 (+ (-> v1-50 attack-id) 1)) - ) - (set! (-> v1-50 attack-id) a0-41) - (set! (-> s3-2 attack-id) a0-41) - ) - (set! (-> s3-2 timeout) (seconds 4)) - (sound-play "ball-launch") - (spawn-projectile maker-grenade s3-2 this *default-dead-pool*) + (let ((f0-8 (/ (vector-vector-xz-distance s5-0 s3-0) f28-1))) + (if (< 0.0 f0-8) + (set! f30-0 (+ (/ (- (-> s3-0 y) (-> s5-0 y)) f0-8) (* 20480.0 f0-8))) + ) + ) + (cond + ((>= (-> this root trans z) -1937408.0) + (let ((s3-1 (new 'stack-no-clear 'projectile-init-by-other-params))) + (let ((s2-3 (rand-vu-sphere-point-uniform! (new 'stack-no-clear 'vector) (rand-vu-float-range 204800.0 409600.0)))) + (new 'stack-no-clear 'vector) + (vector-normalize! s4-1 f28-1) + (set! (-> s3-1 ent) (-> this entity)) + (set! (-> s3-1 charge) 1.0) + (set! (-> s3-1 options) (projectile-options)) + (logclear! (-> s3-1 options) (projectile-options po14 po15 po16)) + (vector-copy! (-> s3-1 pos) s5-0) + (vector-copy! (-> s3-1 vel) s2-3) + ) + (set! (-> s3-1 notify-handle) (the-as handle #f)) + (set! (-> s3-1 owner-handle) (the-as handle #f)) + (set! (-> s3-1 target-handle) (the-as handle #f)) + (set! (-> s3-1 target-pos quad) (the-as uint128 0)) + (set! (-> s3-1 ignore-handle) (process->handle this)) + (let* ((v1-26 *game-info*) + (a0-21 (+ (-> v1-26 attack-id) 1)) + ) + (set! (-> v1-26 attack-id) a0-21) + (set! (-> s3-1 attack-id) a0-21) + ) + (set! (-> s3-1 timeout) (seconds 4)) + (let ((s5-1 (new 'static 'vector4w))) + (+! (-> s5-1 x) 1) + (when (< 2 (-> s5-1 x)) + (sound-play "dm-throw") + (set! (-> s5-1 x) 0) + 0 + ) + ) + (spawn-projectile dm-flyer-shot s3-1 this *default-dead-pool*) + ) + ) + (else + (vector-normalize! s4-1 f28-1) + (+! (-> s4-1 y) f30-0) + (let ((s3-2 (new 'stack-no-clear 'projectile-init-by-other-params))) + (set! (-> s3-2 ent) (-> this entity)) + (set! (-> s3-2 charge) 1.0) + (set! (-> s3-2 options) (projectile-options)) + (logclear! (-> s3-2 options) (projectile-options po14 po15 po16)) + (vector-copy! (-> s3-2 pos) s5-0) + (vector-copy! (-> s3-2 vel) s4-1) + (set! (-> s3-2 notify-handle) (the-as handle #f)) + (set! (-> s3-2 owner-handle) (process->handle this)) + (set! (-> s3-2 target-handle) (the-as handle #f)) + (vector-copy! (-> s3-2 target-pos) (target-pos 0)) + (set! (-> s3-2 ignore-handle) (process->handle this)) + (let* ((v1-50 *game-info*) + (a0-41 (+ (-> v1-50 attack-id) 1)) + ) + (set! (-> v1-50 attack-id) a0-41) + (set! (-> s3-2 attack-id) a0-41) ) + (set! (-> s3-2 timeout) (seconds 4)) + (sound-play "ball-launch") + (spawn-projectile maker-grenade s3-2 this *default-dead-pool*) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for symbol *maker-close*, type float 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 e90427f7a8..d3452ce4a3 100644 --- a/test/decompiler/reference/jak3/levels/wascity/wasgun-manager_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/wasgun-manager_REF.gc @@ -1444,189 +1444,126 @@ ;; definition for method 62 of type skeet ;; WARN: Return type mismatch (pointer process) vs (pointer joint-exploder). (defmethod spawn-exploder ((this skeet)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (let ((s5-0 (new 'stack-no-clear 'vector)) - (f0-0 (rand-vu-float-range 0.5 1.5)) - ) - (let ((v1-1 (-> gp-0 fountain-rand-transv-lo))) - (let ((a0-4 (-> this root trans))) - (let ((a1-2 *up-vector*)) - (let ((a2-1 0.0)) - (.mov vf7 a2-1) - ) - (.lvf vf5 (&-> a1-2 quad)) - ) - (.lvf vf4 (&-> a0-4 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-1 quad) vf6) + (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (f0-0 (rand-vu-float-range 0.5 1.5)) ) - (vector-float*! s5-0 (-> this pvel) 1.0) - (let ((a1-4 s5-0)) - (let ((v1-4 s5-0)) - (let ((a0-6 *up-vector*)) - (let ((a2-3 40960.0)) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a0-6 quad)) - ) - (.lvf vf4 (&-> v1-4 quad)) + (vector+*! (-> gp-0 fountain-rand-transv-lo) (-> this root trans) *up-vector* 0.0) + (vector-float*! s5-0 (-> this pvel) 1.0) + (vector+*! s5-0 s5-0 *up-vector* 40960.0) + (vector+*! (-> gp-0 fountain-rand-transv-lo) s5-0 *identity-vector* (* -204800.0 f0-0)) + (vector+*! (-> gp-0 fountain-rand-transv-hi) s5-0 *identity-vector* (* 204800.0 f0-0)) + ) + (set! (-> gp-0 gravity) -122880.0) + (set! (-> gp-0 rot-speed) 16.0) + (set! (-> gp-0 friction) 0.3) + (let ((s5-1 (get-process *default-dead-pool* joint-exploder #x4000 0))) + (the-as + (pointer joint-exploder) + (when s5-1 + (let ((t9-3 (method-of-type joint-exploder activate))) + (t9-3 (the-as joint-exploder s5-1) this "joint-exploder" (the-as pointer #x70004000)) ) - (.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-4 quad) vf6) - ) - (let ((a1-5 (-> gp-0 fountain-rand-transv-lo))) - (let ((v1-5 s5-0)) - (let ((a0-7 *identity-vector*)) - (let ((a2-5 (* -204800.0 f0-0))) - (.mov vf7 a2-5) - ) - (.lvf vf5 (&-> a0-7 quad)) - ) - (.lvf vf4 (&-> v1-5 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-5 quad) vf6) - ) - (let ((a0-8 (-> gp-0 fountain-rand-transv-hi))) - (let ((v1-6 *identity-vector*)) - (let ((a1-7 (* 204800.0 f0-0))) - (.mov vf7 a1-7) - ) - (.lvf vf5 (&-> v1-6 quad)) - ) - (.lvf vf4 (&-> s5-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-8 quad) vf6) - ) - ) - (set! (-> gp-0 gravity) -122880.0) - (set! (-> gp-0 rot-speed) 16.0) - (set! (-> gp-0 friction) 0.3) - (let ((s5-1 (get-process *default-dead-pool* joint-exploder #x4000 0))) - (the-as - (pointer joint-exploder) - (when s5-1 - (let ((t9-3 (method-of-type joint-exploder activate))) - (t9-3 (the-as joint-exploder s5-1) this "joint-exploder" (the-as pointer #x70004000)) - ) - (let* ((s4-0 run-function-in-process) - (s3-0 s5-1) - (s2-0 joint-exploder-init-by-other) - (v1-12 (-> this skeet-type)) - (a2-9 - (cond - ((or (= v1-12 (skeet-type a)) - (= v1-12 (skeet-type a-0)) - (= v1-12 (skeet-type a-1)) - (= v1-12 (skeet-type a-2)) - (= v1-12 (skeet-type a-3)) - (= v1-12 (skeet-type a-4)) - (= v1-12 (skeet-type a-5)) - (= v1-12 (skeet-type a-6)) - (= v1-12 (skeet-type a-7)) - ) - (art-group-get-by-name *level* "skel-skeet-explode" (the-as (pointer level) #f)) - ) - ((or (= v1-12 (skeet-type b)) - (= v1-12 (skeet-type b-8)) - (= v1-12 (skeet-type b-9)) - (= v1-12 (skeet-type b-10)) - (= v1-12 (skeet-type b-11)) - (= v1-12 (skeet-type b-12)) - (= v1-12 (skeet-type b-13)) - (= v1-12 (skeet-type b-14)) - (= v1-12 (skeet-type b-15)) - ) - (art-group-get-by-name *level* "skel-skeet-b-explode" (the-as (pointer level) #f)) - ) - ((or (= v1-12 (skeet-type c)) - (= v1-12 (skeet-type c-16)) - (= v1-12 (skeet-type c-17)) - (= v1-12 (skeet-type c-18)) - (= v1-12 (skeet-type c-19)) - (= v1-12 (skeet-type c-20)) - (= v1-12 (skeet-type c-22)) - (= v1-12 (skeet-type c-22)) - (= v1-12 (skeet-type c-23)) - ) - (art-group-get-by-name *level* "skel-skeet-c-explode" (the-as (pointer level) #f)) - ) - (else - (art-group-get-by-name *level* "skel-skeet-explode" (the-as (pointer level) #f)) - ) + (let* ((s4-0 run-function-in-process) + (s3-0 s5-1) + (s2-0 joint-exploder-init-by-other) + (v1-13 (-> this skeet-type)) + (a2-6 + (cond + ((or (= v1-13 (skeet-type a)) + (= v1-13 (skeet-type a-0)) + (= v1-13 (skeet-type a-1)) + (= v1-13 (skeet-type a-2)) + (= v1-13 (skeet-type a-3)) + (= v1-13 (skeet-type a-4)) + (= v1-13 (skeet-type a-5)) + (= v1-13 (skeet-type a-6)) + (= v1-13 (skeet-type a-7)) + ) + (art-group-get-by-name *level* "skel-skeet-explode" (the-as (pointer level) #f)) + ) + ((or (= v1-13 (skeet-type b)) + (= v1-13 (skeet-type b-8)) + (= v1-13 (skeet-type b-9)) + (= v1-13 (skeet-type b-10)) + (= v1-13 (skeet-type b-11)) + (= v1-13 (skeet-type b-12)) + (= v1-13 (skeet-type b-13)) + (= v1-13 (skeet-type b-14)) + (= v1-13 (skeet-type b-15)) + ) + (art-group-get-by-name *level* "skel-skeet-b-explode" (the-as (pointer level) #f)) + ) + ((or (= v1-13 (skeet-type c)) + (= v1-13 (skeet-type c-16)) + (= v1-13 (skeet-type c-17)) + (= v1-13 (skeet-type c-18)) + (= v1-13 (skeet-type c-19)) + (= v1-13 (skeet-type c-20)) + (= v1-13 (skeet-type c-22)) + (= v1-13 (skeet-type c-22)) + (= v1-13 (skeet-type c-23)) + ) + (art-group-get-by-name *level* "skel-skeet-c-explode" (the-as (pointer level) #f)) + ) + (else + (art-group-get-by-name *level* "skel-skeet-explode" (the-as (pointer level) #f)) ) ) - (a3-2 6) - (v1-18 (-> this skeet-type)) - ) - ((the-as (function object object object object object object none) s4-0) - s3-0 - s2-0 - a2-9 - a3-2 - gp-0 - (cond - ((or (= v1-18 (skeet-type a)) (or (= v1-18 (skeet-type a-0)) - (= v1-18 (skeet-type a-1)) - (= v1-18 (skeet-type a-2)) - (= v1-18 (skeet-type a-3)) - (= v1-18 (skeet-type a-4)) - (= v1-18 (skeet-type a-5)) - (= v1-18 (skeet-type a-6)) - (= v1-18 (skeet-type a-7)) - ) - ) - *skeet-exploder-params* - ) - ((or (= v1-18 (skeet-type b)) - (= v1-18 (skeet-type b-8)) - (= v1-18 (skeet-type b-9)) - (= v1-18 (skeet-type b-10)) - (= v1-18 (skeet-type b-11)) - (= v1-18 (skeet-type b-12)) - (= v1-18 (skeet-type b-13)) - (= v1-18 (skeet-type b-14)) - (= v1-18 (skeet-type b-15)) - ) - *skeet-b-exploder-params* - ) - ((or (= v1-18 (skeet-type c)) - (= v1-18 (skeet-type c-16)) - (= v1-18 (skeet-type c-17)) - (= v1-18 (skeet-type c-18)) - (= v1-18 (skeet-type c-19)) - (= v1-18 (skeet-type c-20)) - (= v1-18 (skeet-type c-22)) - (= v1-18 (skeet-type c-22)) - (= v1-18 (skeet-type c-23)) - ) - *skeet-c-exploder-params* - ) - (else - *skeet-exploder-params* ) + (a3-2 6) + (v1-19 (-> this skeet-type)) + ) + ((the-as (function object object object object object object none) s4-0) + s3-0 + s2-0 + a2-6 + a3-2 + gp-0 + (cond + ((or (= v1-19 (skeet-type a)) (or (= v1-19 (skeet-type a-0)) + (= v1-19 (skeet-type a-1)) + (= v1-19 (skeet-type a-2)) + (= v1-19 (skeet-type a-3)) + (= v1-19 (skeet-type a-4)) + (= v1-19 (skeet-type a-5)) + (= v1-19 (skeet-type a-6)) + (= v1-19 (skeet-type a-7)) + ) + ) + *skeet-exploder-params* + ) + ((or (= v1-19 (skeet-type b)) + (= v1-19 (skeet-type b-8)) + (= v1-19 (skeet-type b-9)) + (= v1-19 (skeet-type b-10)) + (= v1-19 (skeet-type b-11)) + (= v1-19 (skeet-type b-12)) + (= v1-19 (skeet-type b-13)) + (= v1-19 (skeet-type b-14)) + (= v1-19 (skeet-type b-15)) + ) + *skeet-b-exploder-params* + ) + ((or (= v1-19 (skeet-type c)) + (= v1-19 (skeet-type c-16)) + (= v1-19 (skeet-type c-17)) + (= v1-19 (skeet-type c-18)) + (= v1-19 (skeet-type c-19)) + (= v1-19 (skeet-type c-20)) + (= v1-19 (skeet-type c-22)) + (= v1-19 (skeet-type c-22)) + (= v1-19 (skeet-type c-23)) + ) + *skeet-c-exploder-params* + ) + (else + *skeet-exploder-params* ) ) - ) - (-> s5-1 ppointer) + ) ) + (-> s5-1 ppointer) ) ) ) @@ -1853,53 +1790,30 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defun def-launch-circle () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (new 'stack-no-clear 'vector))) - 8192.0 - (let ((s5-0 (new 'stack-no-clear 'vector)) - (f30-0 1720320.0) + (let ((gp-0 (new 'stack-no-clear 'vector))) + 8192.0 + (let ((s5-0 (new 'stack-no-clear 'vector)) + (f30-0 1720320.0) + ) + (set-vector! s5-0 6583861.5 36864.0 -1960301.9 1.0) + (let ((s4-0 1) + (s3-0 6) ) - (set-vector! s5-0 6583861.5 36864.0 -1960301.9 1.0) - (let ((s4-0 1) - (s3-0 6) - ) - (while (>= s3-0 s4-0) - (let ((f28-0 (+ 8192.0 (* 2339.2712 (the float s4-0))))) - (set! (-> gp-0 y) 0.0) - (set! (-> gp-0 x) (- (cos f28-0))) - (set! (-> gp-0 z) (- (sin f28-0))) - ) - (let ((a1-0 gp-0)) - (let ((v1-5 s5-0)) - (let ((a0-6 gp-0)) - (let ((a2-0 f30-0)) - (.mov vf7 a2-0) - ) - (.lvf vf5 (&-> a0-6 quad)) - ) - (.lvf vf4 (&-> v1-5 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-0 quad) vf6) - ) - (set! (-> gp-0 w) (-> *skeet-offset-table* s4-0 w)) - (vector-copy! (-> *skeet-offset-table* s4-0) gp-0) - (+! s4-0 1) + (while (>= s3-0 s4-0) + (let ((f28-0 (+ 8192.0 (* 2339.2712 (the float s4-0))))) + (set! (-> gp-0 y) 0.0) + (set! (-> gp-0 x) (- (cos f28-0))) + (set! (-> gp-0 z) (- (sin f28-0))) ) + (vector+*! gp-0 s5-0 gp-0 f30-0) + (set! (-> gp-0 w) (-> *skeet-offset-table* s4-0 w)) + (vector-copy! (-> *skeet-offset-table* s4-0) gp-0) + (+! s4-0 1) ) ) ) - (none) ) + (none) ) ;; definition for function spawn-skeet-enum @@ -2424,60 +2338,42 @@ ;; definition for method 34 of type task-manager-wascity-gungame (defmethod task-manager-wascity-gungame-method-34 ((this task-manager-wascity-gungame)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (vector-! *skeet-launcher-pos* *skeet-launcher-pos* (target-pos 0)) - (vector-rotate-y! - *skeet-launcher-pos* - *skeet-launcher-pos* - (* 72.81778 (analog-input (the-as int (-> *cpad-list* cpads 1 leftx)) 128.0 48.0 110.0 -1.0)) - ) - (vector+! *skeet-launcher-pos* *skeet-launcher-pos* (target-pos 0)) - (let ((s5-4 (vector-! (new 'stack-no-clear 'vector) *skeet-launcher-pos* (target-pos 0)))) - (set! (-> s5-4 y) 0.0) - (vector-normalize! s5-4 1.0) - (let ((s2-0 *skeet-launcher-pos*)) - (let ((s4-6 *skeet-launcher-pos*)) - (let ((s3-1 s5-4)) - (let ((v1-9 (* 40960.0 (analog-input (the-as int (-> *cpad-list* cpads 1 lefty)) 128.0 48.0 110.0 -1.0)))) - (.mov vf7 v1-9) - ) - (.lvf vf5 (&-> s3-1 quad)) - ) - (.lvf vf4 (&-> s4-6 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 (&-> s2-0 quad) vf6) - ) - (set! (-> *skeet-launcher-pos* y) 36864.0) - (add-debug-sphere - #t - (bucket-id debug-no-zbuf1) - *skeet-launcher-pos* - (meters 10) - (new 'static 'rgba :r #xff :a #x80) - ) - (set! (-> *skeet-launcher-pos* w) (asin (/ (- (-> s5-4 x)) (vector-length s5-4)))) - ) - (if (cpad-pressed? 1 r1) - (print-and-spawn-skeet - this - (skeet-mode a-x0) - *skeet-launcher-pos* - (+ 10940.871 (* 5461.3335 (analog-input (the-as int (-> *cpad-list* cpads 1 righty)) 128.0 48.0 110.0 -1.0))) - 573440.0 - ) - ) - (none) + (vector-! *skeet-launcher-pos* *skeet-launcher-pos* (target-pos 0)) + (vector-rotate-y! + *skeet-launcher-pos* + *skeet-launcher-pos* + (* 72.81778 (analog-input (the-as int (-> *cpad-list* cpads 1 leftx)) 128.0 48.0 110.0 -1.0)) ) + (vector+! *skeet-launcher-pos* *skeet-launcher-pos* (target-pos 0)) + (let ((s5-4 (vector-! (new 'stack-no-clear 'vector) *skeet-launcher-pos* (target-pos 0)))) + (set! (-> s5-4 y) 0.0) + (vector-normalize! s5-4 1.0) + (vector+*! + *skeet-launcher-pos* + *skeet-launcher-pos* + s5-4 + (* 40960.0 (analog-input (the-as int (-> *cpad-list* cpads 1 lefty)) 128.0 48.0 110.0 -1.0)) + ) + (set! (-> *skeet-launcher-pos* y) 36864.0) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + *skeet-launcher-pos* + (meters 10) + (new 'static 'rgba :r #xff :a #x80) + ) + (set! (-> *skeet-launcher-pos* w) (asin (/ (- (-> s5-4 x)) (vector-length s5-4)))) + ) + (if (cpad-pressed? 1 r1) + (print-and-spawn-skeet + this + (skeet-mode a-x0) + *skeet-launcher-pos* + (+ 10940.871 (* 5461.3335 (analog-input (the-as int (-> *cpad-list* cpads 1 righty)) 128.0 48.0 110.0 -1.0))) + 573440.0 + ) + ) + (none) ) ;; definition for method 35 of type task-manager-wascity-gungame 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 f1b8861cc8..57593a09fa 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 @@ -132,93 +132,76 @@ ) ) :trans (behavior () - (local-vars (v1-48 float)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (sig-pilot-trans) - (cond - ((and *target* - (focus-test? *target* pilot-riding) - (nonzero? (-> *target* pilot)) - (-> self parent) - (-> self parent 0) - (= *target* (find-rider (the-as vehicle (-> self parent 0)))) - ) - (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)) + (sig-pilot-trans) + (cond + ((and *target* + (focus-test? *target* pilot-riding) + (nonzero? (-> *target* pilot)) + (-> self parent) + (-> self parent 0) + (= *target* (find-rider (the-as vehicle (-> self parent 0)))) + ) + (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)) + ) + (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))) + ) + (set! (-> self complain-speech) (mod (+ (-> self complain-speech) (rand-vu-int-range 2 6)) 9)) + (let ((v1-19 (-> self complain-speech))) + (cond + ((zero? v1-19) + (talker-spawn-func (-> *nest-eggs-speech-list* 9) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 1) + (talker-spawn-func (-> *nest-eggs-speech-list* 10) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 2) + (talker-spawn-func (-> *nest-eggs-speech-list* 11) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 3) + (talker-spawn-func (-> *nest-eggs-speech-list* 12) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 4) + (talker-spawn-func (-> *nest-eggs-speech-list* 13) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 5) + (talker-spawn-func (-> *nest-eggs-speech-list* 14) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 6) + (talker-spawn-func (-> *nest-eggs-speech-list* 15) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 7) + (talker-spawn-func (-> *nest-eggs-speech-list* 16) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 8) + (talker-spawn-func (-> *nest-eggs-speech-list* 17) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-19 9) + (talker-spawn-func (-> *nest-eggs-speech-list* 18) *entity-pool* (target-pos 0) (the-as region #f)) ) - (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))) - ) - (set! (-> self complain-speech) (mod (+ (-> self complain-speech) (rand-vu-int-range 2 6)) 9)) - (let ((v1-19 (-> self complain-speech))) - (cond - ((zero? v1-19) - (talker-spawn-func (-> *nest-eggs-speech-list* 9) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 1) - (talker-spawn-func (-> *nest-eggs-speech-list* 10) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 2) - (talker-spawn-func (-> *nest-eggs-speech-list* 11) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 3) - (talker-spawn-func (-> *nest-eggs-speech-list* 12) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 4) - (talker-spawn-func (-> *nest-eggs-speech-list* 13) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 5) - (talker-spawn-func (-> *nest-eggs-speech-list* 14) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 6) - (talker-spawn-func (-> *nest-eggs-speech-list* 15) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 7) - (talker-spawn-func (-> *nest-eggs-speech-list* 16) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 8) - (talker-spawn-func (-> *nest-eggs-speech-list* 17) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-19 9) - (talker-spawn-func (-> *nest-eggs-speech-list* 18) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) ) - (set-time! (-> self complain-time)) ) + (set-time! (-> self complain-time)) ) ) ) - (let* ((f0-4 20480.0) - (f0-6 (* f0-4 f0-4)) - ) - (.lvf vf1 (&-> (-> *target* control 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 v1-48 vf1) - (if (< f0-6 v1-48) - (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))) - ) ) - (else - (set-time! (-> self last-moved-time)) - ) + (let ((f0-4 20480.0)) + (if (< (* f0-4 f0-4) (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))) + ) + ) + (else + (set-time! (-> self last-moved-time)) ) ) ) diff --git a/test/decompiler/reference/jak3/levels/wascity/wasstadium/wasstada-part_REF.gc b/test/decompiler/reference/jak3/levels/wascity/wasstadium/wasstada-part_REF.gc index a92021e3a3..c4a6b190b3 100644 --- a/test/decompiler/reference/jak3/levels/wascity/wasstadium/wasstada-part_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/wasstadium/wasstada-part_REF.gc @@ -1196,7 +1196,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 8192.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1308,7 +1308,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 32768.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1420,7 +1420,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 20480.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1532,7 +1532,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s2-1 16384.0) - (vector-rotate-around-axis! s2-1 (the-as quaternion s2-1) f28-0 s3-0) + (vector-rotate-around-axis! s2-1 s2-1 f28-0 s3-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) @@ -1644,7 +1644,7 @@ ) (set! (-> arg1 rot-syvel quad) (the-as uint128 0)) (vector-normalize! s3-1 24576.0) - (vector-rotate-around-axis! s3-1 (the-as quaternion s3-1) f28-0 s2-0) + (vector-rotate-around-axis! s3-1 s3-1 f28-0 s2-0) (cond ((< 1.0 f30-0) (sp-kill-particle arg0 arg1) 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 73e5dc51df..722132347e 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 @@ -732,65 +732,41 @@ (sound-stop (-> self ambient-sound-id)) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (wstd-fight-plat-method-40 self) - (vector-copy! (-> self basetrans) (-> self basepos)) - (+! (-> self basetrans y) (-> self delta-y)) - (when (-> self spawn-lava?) - (activate! - *camera-smush-control* - (lerp-scale 409.6 0.0 (vector-vector-xz-distance (target-pos 0) (-> self root trans)) 114688.0 143360.0) - 37 - 600 - 1.0 - 0.2 - (-> self clock) - ) - (when (< (-> self next-lava-part) (current-time)) - 102400.0 - 102400.0 - (let ((gp-1 (new 'stack-no-clear 'vector))) - (let ((s3-1 (matrix<-transformq! (new 'stack-no-clear 'matrix) (the-as transformq (-> self root trans))))) - (vector-matrix*! gp-1 (-> *fight-plat-lava-pos* (rand-vu-int-count (-> *fight-plat-lava-pos* length))) s3-1) - ) - (set! (-> gp-1 y) 40960.0) - (vector-copy! (-> self part-lava-pos) gp-1) - ) - (set! (-> self next-lava-part) (+ (current-time) (seconds 0.01))) - ) - (spawn (-> self part) (-> self part-lava-pos)) + (wstd-fight-plat-method-40 self) + (vector-copy! (-> self basetrans) (-> self basepos)) + (+! (-> self basetrans y) (-> self delta-y)) + (when (-> self spawn-lava?) + (activate! + *camera-smush-control* + (lerp-scale 409.6 0.0 (vector-vector-xz-distance (target-pos 0) (-> self root trans)) 114688.0 143360.0) + 37 + 600 + 1.0 + 0.2 + (-> self clock) ) - (plat-trans) - (let ((v1-23 (as-type (entity-nav-mesh-by-aid (the-as actor-id #xab7e)) entity-nav-mesh))) - (when v1-23 - (let* ((a0-17 (-> v1-23 nav-mesh)) - (t9-12 (method-of-object a0-17 nav-mesh-method-38)) - (a1-7 (new 'stack-no-clear 'nav-poly)) - ) - (let ((v1-26 (-> self root trans))) - (let ((a2-3 *y-vector*)) - (let ((a3-3 4096.0)) - (.mov vf7 a3-3) - ) - (.lvf vf5 (&-> a2-3 quad)) - ) - (.lvf vf4 (&-> v1-26 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-7 vertex0 quad) vf6) - (t9-12 a0-17 a1-7) + (when (< (-> self next-lava-part) (current-time)) + 102400.0 + 102400.0 + (let ((gp-1 (new 'stack-no-clear 'vector))) + (let ((s3-1 (matrix<-transformq! (new 'stack-no-clear 'matrix) (the-as transformq (-> self root trans))))) + (vector-matrix*! gp-1 (-> *fight-plat-lava-pos* (rand-vu-int-count (-> *fight-plat-lava-pos* length))) s3-1) + ) + (set! (-> gp-1 y) 40960.0) + (vector-copy! (-> self part-lava-pos) gp-1) + ) + (set! (-> self next-lava-part) (+ (current-time) (seconds 0.01))) + ) + (spawn (-> self part) (-> self part-lava-pos)) + ) + (plat-trans) + (let ((v1-23 (as-type (entity-nav-mesh-by-aid (the-as actor-id #xab7e)) entity-nav-mesh))) + (if v1-23 + (nav-mesh-method-38 + (-> v1-23 nav-mesh) + (the-as nav-poly (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *y-vector* 4096.0)) ) ) - ) ) ) :code (behavior () @@ -1492,47 +1468,29 @@ ;; definition for method 41 of type wstd-fight-plat-large ;; WARN: Return type mismatch int vs none. (defmethod wstd-fight-plat-large-method-41 ((this wstd-fight-plat-large)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (dotimes (s5-0 (length *wstd-fight-large-house*)) - (when (-> this door s5-0) - (let ((s3-0 (-> this node-list data (-> *wstd-fight-large-house* s5-0 joint-index) bone transform)) - (s4-0 (the-as wstd-door (handle->process (-> this door s5-0)))) - ) - (matrix->trans s3-0 (-> s4-0 root trans)) - (matrix->quaternion (-> s4-0 root quat) s3-0) - (quaternion-rotate-local-y! - (-> s4-0 root quat) - (-> s4-0 root quat) - (-> *wstd-fight-large-house* s5-0 y-angle) - ) - (let ((s3-1 (-> s4-0 root trans))) - (let ((s2-0 (-> s4-0 root trans))) - (let ((v1-22 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> s4-0 root quat)))) - (let ((a0-16 (-> *wstd-fight-large-house* s5-0 x-offset))) - (.mov vf7 a0-16) - ) - (.lvf vf5 (&-> v1-22 quad)) - ) - (.lvf vf4 (&-> s2-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 (&-> s3-1 quad) vf6) + (dotimes (s5-0 (length *wstd-fight-large-house*)) + (when (-> this door s5-0) + (let ((s3-0 (-> this node-list data (-> *wstd-fight-large-house* s5-0 joint-index) bone transform)) + (s4-0 (the-as wstd-door (handle->process (-> this door s5-0)))) ) + (matrix->trans s3-0 (-> s4-0 root trans)) + (matrix->quaternion (-> s4-0 root quat) s3-0) + (quaternion-rotate-local-y! + (-> s4-0 root quat) + (-> s4-0 root quat) + (-> *wstd-fight-large-house* s5-0 y-angle) + ) + (vector+*! + (-> s4-0 root trans) + (-> s4-0 root trans) + (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> s4-0 root quat)) + (-> *wstd-fight-large-house* s5-0 x-offset) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 42 of type wstd-fight-plat-large @@ -1646,45 +1604,21 @@ (sound-stop (-> self ambient-sound-id)) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (wstd-fight-plat-large-method-41 self) - (vector-copy! (-> self basetrans) (-> self basepos)) - (+! (-> self basetrans y) (-> self delta-y)) - (when (-> self spawn-lava?) - (wstd-fight-plat-large-method-42 self) - (activate! *camera-smush-control* 409.6 37 600 1.0 0.2 (-> self clock)) - ) - (plat-trans) - (let ((v1-9 (as-type (entity-nav-mesh-by-aid (the-as actor-id #xab7e)) entity-nav-mesh))) - (when v1-9 - (let* ((a0-7 (-> v1-9 nav-mesh)) - (t9-6 (method-of-object a0-7 nav-mesh-method-38)) - (a1-2 (new 'stack-no-clear 'nav-poly)) - ) - (let ((v1-12 (-> self root trans))) - (let ((a2-1 *y-vector*)) - (let ((a3-2 4096.0)) - (.mov vf7 a3-2) - ) - (.lvf vf5 (&-> a2-1 quad)) - ) - (.lvf vf4 (&-> v1-12 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-2 vertex0 quad) vf6) - (t9-6 a0-7 a1-2) + (wstd-fight-plat-large-method-41 self) + (vector-copy! (-> self basetrans) (-> self basepos)) + (+! (-> self basetrans y) (-> self delta-y)) + (when (-> self spawn-lava?) + (wstd-fight-plat-large-method-42 self) + (activate! *camera-smush-control* 409.6 37 600 1.0 0.2 (-> self clock)) + ) + (plat-trans) + (let ((v1-9 (as-type (entity-nav-mesh-by-aid (the-as actor-id #xab7e)) entity-nav-mesh))) + (if v1-9 + (nav-mesh-method-38 + (-> v1-9 nav-mesh) + (the-as nav-poly (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *y-vector* 4096.0)) ) ) - ) ) ) :code (behavior () @@ -1771,44 +1705,20 @@ (sound-stop (-> self ambient-sound-id)) ) :trans (behavior () - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (wstd-fight-plat-large-method-41 self) - (vector-copy! (-> self basetrans) (-> self basepos)) - (+! (-> self basetrans y) (-> self delta-y)) - (if (-> self spawn-lava?) - (wstd-fight-plat-large-method-42 self) - ) - (plat-trans) - (let ((v1-7 (as-type (entity-nav-mesh-by-aid (the-as actor-id #xab7e)) entity-nav-mesh))) - (when v1-7 - (let* ((a0-6 (-> v1-7 nav-mesh)) - (t9-5 (method-of-object a0-6 nav-mesh-method-38)) - (a1-1 (new 'stack-no-clear 'nav-poly)) - ) - (let ((v1-10 (-> self root trans))) - (let ((a2-0 *y-vector*)) - (let ((a3-1 4096.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a2-0 quad)) - ) - (.lvf vf4 (&-> v1-10 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-1 vertex0 quad) vf6) - (t9-5 a0-6 a1-1) + (wstd-fight-plat-large-method-41 self) + (vector-copy! (-> self basetrans) (-> self basepos)) + (+! (-> self basetrans y) (-> self delta-y)) + (if (-> self spawn-lava?) + (wstd-fight-plat-large-method-42 self) + ) + (plat-trans) + (let ((v1-7 (as-type (entity-nav-mesh-by-aid (the-as actor-id #xab7e)) entity-nav-mesh))) + (if v1-7 + (nav-mesh-method-38 + (-> v1-7 nav-mesh) + (the-as nav-poly (vector+*! (new 'stack-no-clear 'vector) (-> self root trans) *y-vector* 4096.0)) ) ) - ) ) ) :code (behavior () diff --git a/test/decompiler/reference/jak3/levels/wascity/wlander-male_REF.gc b/test/decompiler/reference/jak3/levels/wascity/wlander-male_REF.gc index 7fd3be8d6f..366ece1a51 100644 --- a/test/decompiler/reference/jak3/levels/wascity/wlander-male_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/wlander-male_REF.gc @@ -513,129 +513,34 @@ ) ;; definition for method 239 of type wlander -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. -(defmethod fire-shot ((this wlander)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (as-type (handle->process (-> this focus handle)) process-focusable)) - (s5-1 (new 'stack-no-clear 'vector)) - ) - (when s4-0 - (vector-! s5-1 (-> this root trans) (get-trans (the-as process-focusable s4-0) 0)) - (set! (-> s5-1 y) 0.0) - (vector-normalize! s5-1 1.0) - (vector-rotate90-around-y! s5-1 s5-1) - (if (< 0.0 (vector-dot s5-1 (get-transv (the-as process-focusable s4-0)))) - (vector-negate-in-place! s5-1) - ) - (cond - ((= (-> s4-0 type) target) - (let ((s3-4 (-> this target-pos))) - (let ((s2-1 (get-trans (the-as process-focusable s4-0) 3))) - (let ((v1-17 (* 0.2 (vector-length (get-transv (the-as process-focusable s4-0)))))) - (.mov vf7 v1-17) - ) - (.lvf vf5 (&-> s5-1 quad)) - (.lvf vf4 (&-> s2-1 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 (&-> s3-4 quad) vf6) - ) - ) - (else - (vector-copy! (-> this target-pos) (get-trans (the-as process-focusable s4-0) 3)) - ) - ) - ) - ) - (let ((t0-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data (-> this gun-joint))))) - (new 'stack-no-clear 'vector) - (let ((a0-15 t0-0)) - (let ((v1-25 t0-0)) - (let ((a1-12 (&-> this node-list data (-> this gun-joint) bone transform quad (-> this gun-axis)))) - (let ((a2-3 (-> this gun-length))) - (.mov vf7 a2-3) - ) - (.lvf vf5 (&-> a1-12 0)) - ) - (.lvf vf4 (&-> v1-25 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-15 quad) vf6) - ) - (spawn-guard-projectile this t0-0 (-> this target-pos) 819200.0 t0-0) - ) - (let ((s5-2 sound-play-by-spec) - (s4-1 (static-sound-spec "wlander-fire" :group 0)) - ) - (set! (-> s4-1 volume) 1024) - (set! (-> s4-1 pitch-mod) 0) - (set! (-> s4-1 reg 0) (the-as uint (-> this shot-sound))) - (s5-2 s4-1 (new-sound-id) (-> this root trans)) - ) - 0 - (none) - ) - ) +;; ERROR: function was not converted to expressions. Cannot decompile. ;; definition for method 242 of type wlander (defmethod try-activate ((this wlander)) - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) - (new 'stack-no-clear 'vector) - (let ((gp-0 (new 'stack 'traffic-object-spawn-params))) - (set! (-> gp-0 object-type) (traffic-type wlander-male)) - (set! (-> gp-0 behavior) (the-as uint 12)) - (set! (-> gp-0 id) (the-as uint 0)) - (set! (-> gp-0 nav-mesh) (-> this nav state mesh)) - (set! (-> gp-0 nav-branch) #f) - (set! (-> gp-0 proc) #f) - (set! (-> gp-0 handle) (process->handle this)) - (set! (-> gp-0 user-data) (the-as uint 0)) - (set! (-> gp-0 flags) (traffic-spawn-flags)) - (set! (-> gp-0 guard-type) (the-as uint 11)) - (set! (-> gp-0 entity) #f) - (vector-reset! (-> gp-0 velocity)) - (let ((v1-12 (-> gp-0 position))) - (let ((a0-8 (-> this root trans))) - (let ((a1-3 16384.0)) - (.mov vf7 a1-3) - ) - (.lvf vf5 (&-> s4-0 quad)) - (.lvf vf4 (&-> a0-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 (&-> v1-12 quad) vf6) + (let ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))) + (new 'stack-no-clear 'vector) + (let ((gp-0 (new 'stack 'traffic-object-spawn-params))) + (set! (-> gp-0 object-type) (traffic-type wlander-male)) + (set! (-> gp-0 behavior) (the-as uint 12)) + (set! (-> gp-0 id) (the-as uint 0)) + (set! (-> gp-0 nav-mesh) (-> this nav state mesh)) + (set! (-> gp-0 nav-branch) #f) + (set! (-> gp-0 proc) #f) + (set! (-> gp-0 handle) (process->handle this)) + (set! (-> gp-0 user-data) (the-as uint 0)) + (set! (-> gp-0 flags) (traffic-spawn-flags)) + (set! (-> gp-0 guard-type) (the-as uint 11)) + (set! (-> gp-0 entity) #f) + (vector-reset! (-> gp-0 velocity)) + (vector+*! (-> gp-0 position) (-> this root trans) s4-0 16384.0) + (quaternion-rotate-local-y! (-> gp-0 rotation) (-> this root quat) 32768.0) + (send-event *traffic-manager* 'activate-object gp-0) + (if (-> gp-0 proc) + (return #t) ) - (quaternion-rotate-local-y! (-> gp-0 rotation) (-> this root quat) 32768.0) - (send-event *traffic-manager* 'activate-object gp-0) - (if (-> gp-0 proc) - (return #t) - ) - ) ) - #f ) + #f ) ;; failed to figure out what this is: