From c0b0f35b05e4d58ffcfecc1e67b0ed5869cd296e Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Wed, 15 Apr 2026 02:33:12 +0200 Subject: [PATCH] jak2 gsrc --- goal_src/jak2/engine/ai/enemy.gc | 42 +- goal_src/jak2/engine/anim/joint-exploder.gc | 113 +- goal_src/jak2/engine/anim/joint-mod.gc | 970 ++++----- goal_src/jak2/engine/anim/joint.gc | 454 ++--- goal_src/jak2/engine/camera/cam-combiner.gc | 39 +- goal_src/jak2/engine/camera/cam-layout.gc | 329 +-- goal_src/jak2/engine/camera/cam-master.gc | 76 +- goal_src/jak2/engine/camera/cam-states-dbg.gc | 45 +- goal_src/jak2/engine/camera/cam-states.gc | 436 ++-- goal_src/jak2/engine/camera/cam-update.gc | 30 +- goal_src/jak2/engine/camera/camera.gc | 432 ++-- goal_src/jak2/engine/collide/collide-cache.gc | 42 +- .../jak2/engine/collide/collide-edge-grab.gc | 50 +- .../engine/collide/collide-shape-rider.gc | 41 +- goal_src/jak2/engine/collide/collide-shape.gc | 535 +++-- goal_src/jak2/engine/collide/find-nearest.gc | 54 +- .../jak2/engine/common_objs/basebutton.gc | 22 +- .../jak2/engine/common_objs/blocking-plane.gc | 22 +- goal_src/jak2/engine/common_objs/conveyor.gc | 88 +- .../jak2/engine/common_objs/dark-eco-pool.gc | 3 +- goal_src/jak2/engine/common_objs/elevator.gc | 168 +- .../jak2/engine/common_objs/generic-obs.gc | 62 +- .../jak2/engine/common_objs/water-anim.gc | 59 +- .../jak2/engine/common_objs/water-flow.gc | 83 +- goal_src/jak2/engine/common_objs/water.gc | 79 +- goal_src/jak2/engine/debug/debug-sphere.gc | 57 +- goal_src/jak2/engine/debug/default-menu.gc | 170 +- goal_src/jak2/engine/debug/history.gc | 470 +++-- goal_src/jak2/engine/debug/memory-usage.gc | 439 ++-- goal_src/jak2/engine/debug/menu.gc | 157 +- .../jak2/engine/debug/nav/mysql-nav-graph.gc | 445 ++-- .../jak2/engine/debug/nav/nav-graph-editor.gc | 288 ++- goal_src/jak2/engine/debug/viewer.gc | 50 +- goal_src/jak2/engine/entity/actor-link-h.gc | 49 +- goal_src/jak2/engine/entity/res.gc | 290 +-- goal_src/jak2/engine/game/effect-control.gc | 203 +- goal_src/jak2/engine/game/fact-h.gc | 87 +- goal_src/jak2/engine/game/game-info.gc | 292 ++- goal_src/jak2/engine/game/game-save.gc | 111 +- goal_src/jak2/engine/game/task/task-arrow.gc | 28 +- goal_src/jak2/engine/geometry/cylinder.gc | 154 +- goal_src/jak2/engine/geometry/path-h.gc | 52 +- goal_src/jak2/engine/geometry/vol.gc | 235 +-- .../jak2/engine/gfx/background/tie/tie.gc | 221 +- goal_src/jak2/engine/gfx/foreground/eye.gc | 26 +- .../jak2/engine/gfx/foreground/lightning.gc | 715 ++++--- goal_src/jak2/engine/gfx/foreground/ripple.gc | 34 +- goal_src/jak2/engine/gfx/mood/mood-funcs2.gc | 91 +- goal_src/jak2/engine/gfx/mood/mood.gc | 26 +- goal_src/jak2/engine/gfx/ocean/ocean-mid.gc | 79 +- goal_src/jak2/engine/gfx/ocean/ocean-near.gc | 6 +- .../jak2/engine/gfx/ocean/ocean-texture.gc | 42 +- .../jak2/engine/gfx/ocean/ocean-transition.gc | 298 +-- goal_src/jak2/engine/gfx/ocean/ocean.gc | 550 ++--- .../jak2/engine/gfx/sprite/sprite-distort.gc | 69 +- .../jak2/engine/gfx/sprite/sprite-glow.gc | 46 +- goal_src/jak2/engine/level/region.gc | 332 +-- goal_src/jak2/engine/load/decomp.gc | 12 +- goal_src/jak2/engine/load/loader.gc | 645 +++--- goal_src/jak2/engine/math/euler.gc | 28 +- goal_src/jak2/engine/math/math.gc | 47 +- goal_src/jak2/engine/math/quaternion.gc | 250 ++- goal_src/jak2/engine/math/transformq.gc | 87 +- goal_src/jak2/engine/nav/nav-control.gc | 1794 ++++++++--------- goal_src/jak2/engine/nav/nav-enemy.gc | 44 +- goal_src/jak2/engine/nav/nav-mesh-h.gc | 199 +- goal_src/jak2/engine/physics/chain-physics.gc | 423 ++-- goal_src/jak2/engine/physics/rigid-body.gc | 135 +- goal_src/jak2/engine/physics/trajectory.gc | 80 +- .../process-drawable/process-drawable.gc | 230 +-- goal_src/jak2/engine/scene/scene.gc | 172 +- goal_src/jak2/engine/sound/gsound.gc | 184 +- goal_src/jak2/engine/sound/speech.gc | 21 +- .../jak2/engine/spatial-hash/actor-hash.gc | 77 +- .../jak2/engine/spatial-hash/spatial-hash.gc | 75 +- .../jak2/engine/target/board/board-states.gc | 47 +- .../jak2/engine/target/board/target-board.gc | 3 +- .../engine/target/collide-reaction-target.gc | 846 ++++---- .../jak2/engine/target/gun/gun-dark-shot.gc | 177 +- .../jak2/engine/target/gun/gun-red-shot.gc | 24 +- .../jak2/engine/target/gun/gun-yellow-shot.gc | 2 +- goal_src/jak2/engine/target/logic-target.gc | 220 +- .../jak2/engine/target/mech/grunt-mech.gc | 69 +- .../jak2/engine/target/mech/mech-states.gc | 38 +- goal_src/jak2/engine/target/surface-h.gc | 4 +- goal_src/jak2/engine/target/target-anim.gc | 24 +- goal_src/jak2/engine/target/target-darkjak.gc | 1484 +++++++------- goal_src/jak2/engine/target/target-death.gc | 453 ++--- goal_src/jak2/engine/target/target-handler.gc | 667 +++--- goal_src/jak2/engine/target/target-part.gc | 584 +++--- goal_src/jak2/engine/target/target-turret.gc | 75 +- goal_src/jak2/engine/target/target2.gc | 100 +- goal_src/jak2/engine/ui/bigmap.gc | 184 +- goal_src/jak2/engine/ui/hud-classes.gc | 205 +- goal_src/jak2/engine/util/profile.gc | 33 +- goal_src/jak2/engine/util/sync-info.gc | 24 +- goal_src/jak2/levels/atoll/ash1-course.gc | 14 +- goal_src/jak2/levels/atoll/atoll-obs.gc | 41 +- goal_src/jak2/levels/atoll/atoll-part.gc | 4 +- goal_src/jak2/levels/atoll/juicer.gc | 6 +- goal_src/jak2/levels/atoll/sig0-course.gc | 267 +-- goal_src/jak2/levels/atoll/sniper.gc | 5 +- goal_src/jak2/levels/castle/castle-obs.gc | 122 +- goal_src/jak2/levels/city/bombbot/bombbot.gc | 421 ++-- .../jak2/levels/city/common/height-map.gc | 71 +- goal_src/jak2/levels/city/common/nav-graph.gc | 166 +- .../jak2/levels/city/common/pilot-states.gc | 39 +- goal_src/jak2/levels/city/common/trail.gc | 116 +- goal_src/jak2/levels/city/ctywide-obs.gc | 340 +--- goal_src/jak2/levels/city/ctywide-part.gc | 2 +- goal_src/jak2/levels/city/ctywide-tasks.gc | 34 +- .../city/kiddogescort/crocesc-states.gc | 50 +- .../jak2/levels/city/kiddogescort/crocesc.gc | 47 +- .../levels/city/kiddogescort/hal4-course.gc | 422 ++-- .../levels/city/kiddogescort/kidesc-states.gc | 225 +-- .../jak2/levels/city/kiddogescort/kidesc.gc | 80 +- .../levels/city/meet-brutter/meet-brutter.gc | 187 +- .../jak2/levels/city/onintent/onin-game.gc | 50 +- .../jak2/levels/city/package/delivery-task.gc | 98 +- .../jak2/levels/city/port/race/errol-chal.gc | 76 +- .../jak2/levels/city/sack/collection-task.gc | 24 +- goal_src/jak2/levels/city/shuttle/shuttle.gc | 122 +- .../levels/city/traffic/citizen/citizen.gc | 105 +- .../levels/city/traffic/citizen/civilian.gc | 216 +- .../jak2/levels/city/traffic/citizen/guard.gc | 189 +- .../city/traffic/citizen/metalhead-grunt.gc | 43 +- .../traffic/citizen/metalhead-predator.gc | 60 +- .../levels/city/traffic/traffic-engine.gc | 806 ++++---- .../city/traffic/vehicle/vehicle-control.gc | 72 +- .../city/traffic/vehicle/vehicle-effects.gc | 153 +- .../city/traffic/vehicle/vehicle-guard.gc | 28 +- .../city/traffic/vehicle/vehicle-physics.gc | 199 +- .../city/traffic/vehicle/vehicle-states.gc | 30 +- .../city/traffic/vehicle/vehicle-util.gc | 349 ++-- .../levels/city/traffic/vehicle/vehicle.gc | 146 +- .../jak2/levels/city/vinroom/vinroom-part.gc | 2 +- .../jak2/levels/common/ai/ashelin/ash-shot.gc | 2 +- goal_src/jak2/levels/common/ai/ashelin/ash.gc | 46 +- goal_src/jak2/levels/common/ai/bot-h.gc | 72 +- goal_src/jak2/levels/common/ai/bot.gc | 177 +- .../jak2/levels/common/ai/sig/sig-shot.gc | 2 +- goal_src/jak2/levels/common/ai/sig/sig.gc | 24 +- goal_src/jak2/levels/common/battle.gc | 134 +- goal_src/jak2/levels/common/elec-gate.gc | 144 +- .../jak2/levels/common/enemy/centurion.gc | 61 +- .../jak2/levels/common/enemy/fodder/fodder.gc | 107 +- goal_src/jak2/levels/common/enemy/grunt.gc | 38 +- .../enemy/guards/crimson-guard-level.gc | 277 ++- .../common/enemy/guards/guard-conversation.gc | 16 +- goal_src/jak2/levels/common/enemy/hopper.gc | 42 +- .../common/enemy/hover/crimson-guard-hover.gc | 183 +- .../common/enemy/hover/hover-enemy-battle.gc | 12 +- .../levels/common/enemy/hover/hover-enemy.gc | 42 +- .../common/enemy/hover/hover-formation.gc | 131 +- .../common/enemy/hover/hover-nav-control.gc | 255 ++- .../common/enemy/hover/hover-nav-edit.gc | 35 +- .../jak2/levels/common/enemy/hover/wasp.gc | 183 +- .../jak2/levels/common/enemy/metalmonk.gc | 62 +- .../common/entities/fort-floor-spike.gc | 145 +- .../jak2/levels/common/entities/gun-buoy.gc | 118 +- .../jak2/levels/common/entities/spydroid.gc | 154 +- goal_src/jak2/levels/common/race/race-hud.gc | 160 +- .../jak2/levels/common/race/race-manager.gc | 157 +- .../jak2/levels/common/race/vehicle-racer.gc | 88 +- .../jak2/levels/consite/consite-scenes.gc | 47 +- goal_src/jak2/levels/demo/demo-obs.gc | 47 +- goal_src/jak2/levels/dig/dig-digger.gc | 111 +- goal_src/jak2/levels/dig/dig-obs.gc | 6 +- goal_src/jak2/levels/dig/dig3-obs.gc | 6 +- goal_src/jak2/levels/drill/drill-obs.gc | 77 +- goal_src/jak2/levels/drill/drill-obs2.gc | 6 +- goal_src/jak2/levels/drill/drill-spool.gc | 64 +- goal_src/jak2/levels/forest/fish.gc | 552 +++-- goal_src/jak2/levels/forest/pegasus.gc | 57 +- goal_src/jak2/levels/forest/predator.gc | 94 +- .../jak2/levels/fortress/dump/fordumpa-obs.gc | 6 +- .../jak2/levels/fortress/dump/fordumpb-obs.gc | 28 +- .../fortress/dump/fort-robotank-turret.gc | 74 +- .../levels/fortress/dump/fort-robotank.gc | 22 +- .../jak2/levels/fortress/prison/prison-obs.gc | 164 +- .../levels/fortress/rescue/forresca-obs.gc | 17 +- .../levels/fortress/rescue/forrescb-obs.gc | 66 +- goal_src/jak2/levels/gungame/gun-dummy.gc | 2 +- goal_src/jak2/levels/gungame/gungame-obs.gc | 81 +- goal_src/jak2/levels/hiphog/whack.gc | 71 +- goal_src/jak2/levels/intro/intro-scenes.gc | 47 +- goal_src/jak2/levels/mountain/mountain-obs.gc | 476 +++-- .../jak2/levels/mountain/mountain-scenes.gc | 74 +- goal_src/jak2/levels/mountain/rhino.gc | 100 +- .../jak2/levels/nest/boss/metalkor-extras.gc | 175 +- .../jak2/levels/nest/boss/metalkor-setup.gc | 125 +- .../jak2/levels/nest/boss/metalkor-states.gc | 311 ++- .../jak2/levels/nest/boss/nestb-scenes.gc | 47 +- goal_src/jak2/levels/nest/flying-spider.gc | 22 +- goal_src/jak2/levels/nest/mammoth.gc | 98 +- goal_src/jak2/levels/nest/mantis.gc | 6 +- .../jak2/levels/palace/boss/squid-extras.gc | 8 +- .../jak2/levels/palace/boss/squid-setup.gc | 1043 +++++----- .../jak2/levels/palace/boss/squid-states.gc | 150 +- .../jak2/levels/palace/cable/palcab-obs.gc | 25 +- goal_src/jak2/levels/ruins/pillar-collapse.gc | 48 +- goal_src/jak2/levels/ruins/rapid-gunner.gc | 13 +- goal_src/jak2/levels/ruins/ruins-obs.gc | 48 +- goal_src/jak2/levels/sewer/hosehead-fake.gc | 8 +- goal_src/jak2/levels/sewer/hosehead.gc | 146 +- goal_src/jak2/levels/sewer/sewer-obs.gc | 132 +- goal_src/jak2/levels/sewer/sewer-obs2.gc | 41 +- goal_src/jak2/levels/sewer/sewer-scenes.gc | 80 +- .../jak2/levels/stadium/skate/skatea-obs.gc | 12 +- goal_src/jak2/levels/stadium/stadium-obs.gc | 306 ++- goal_src/jak2/levels/strip/chaincrate.gc | 6 +- goal_src/jak2/levels/strip/strip-obs.gc | 142 +- goal_src/jak2/levels/title/title-obs.gc | 123 +- goal_src/jak2/levels/tomb/tomb-obs.gc | 120 +- goal_src/jak2/levels/tomb/tomb-water.gc | 121 +- goal_src/jak2/levels/tomb/widow-baron.gc | 46 +- goal_src/jak2/levels/tomb/widow-extras.gc | 34 +- .../jak2/levels/tomb/widow-more-extras.gc | 7 +- goal_src/jak2/levels/under/centipede.gc | 44 +- goal_src/jak2/levels/under/jellyfish.gc | 11 +- goal_src/jak2/levels/under/sig5-course.gc | 57 +- goal_src/jak2/levels/under/under-laser.gc | 29 +- goal_src/jak2/levels/under/under-obs.gc | 16 +- .../jak2/levels/under/under-shoot-block.gc | 103 +- goal_src/jak2/levels/under/under-sig-obs.gc | 50 +- goal_src/jak2/levels/under/underb-master.gc | 6 +- 226 files changed, 15133 insertions(+), 19367 deletions(-) diff --git a/goal_src/jak2/engine/ai/enemy.gc b/goal_src/jak2/engine/ai/enemy.gc index 73ff61f130..9286c6cd66 100644 --- a/goal_src/jak2/engine/ai/enemy.gc +++ b/goal_src/jak2/engine/ai/enemy.gc @@ -952,7 +952,6 @@ (defmethod init-enemy-behaviour-and-stats! ((this enemy) (arg0 enemy-info)) "Initializes a bunch of enemy fields related to how they should react, how many hitpoints they should have, etc" - (local-vars (sv-16 res-tag)) (when (coin-flip? this) (let ((a0-2 (-> this node-list data 2))) (set! (-> a0-2 param0) (the-as (function cspace transformq none) cspace<-parented-matrix-joint-flip-z!)) @@ -1019,8 +1018,9 @@ ) (reset-to-collide-spec (-> this focus) (the-as collide-spec a1-5)) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-49 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-49 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-49 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-49)) @@ -1515,7 +1515,7 @@ (defmethod general-event-handler ((this enemy) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy @TODO - unsure if there is a pattern for the events and this should have a more specific name" - (local-vars (s5-5 rgbaf) (sv-432 process) (sv-448 event-message-block)) + (local-vars (s5-5 rgbaf)) (cond ((= arg2 'track) (and (nonzero? (-> this hit-points)) @@ -1578,14 +1578,12 @@ ((and (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) (not (logtest? (-> this focus-status) (focus-status grabbed))) ) - (let* ((s1-0 this) - (s0-0 (method-of-object s1-0 set-incoming-attack-info)) - ) - (set! sv-432 arg0) - (set! sv-448 arg3) - (let ((a3-3 (get-penetrate-using-from-attack-event (the-as process-drawable arg0) arg3))) - (s0-0 s1-0 sv-432 sv-448 a3-3 (the-as attack-info s2-0)) - ) + (set-incoming-attack-info + this + arg0 + arg3 + (get-penetrate-using-from-attack-event (the-as process-drawable arg0) arg3) + (the-as attack-info s2-0) ) (send-event (ppointer->process (-> this parent)) 'child-hit) 0 @@ -2941,11 +2939,7 @@ ) (((knocked-type knocked-type-5)) (let* ((f1-2 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) - (f0-26 1.0) - (f2-0 61440.0) - (f1-3 (fmin f1-2 (* f2-0 f2-0))) - (f2-3 61440.0) - (f30-5 (* (- f0-26 (/ f1-3 (* f2-3 f2-3))) (rnd-float-range this 0.8 1.0))) + (f30-5 (* (- 1.0 (/ (fmin f1-2 (square 61440.0)) (square 61440.0))) (rnd-float-range this 0.8 1.0))) ) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-red-vxz-lo) (-> s5-0 knocked-red-vxz-hi) f30-5)) (set! (-> arg0 y) (lerp (-> s5-0 knocked-red-vy-lo) (-> s5-0 knocked-red-vy-hi) f30-5)) @@ -2953,11 +2947,7 @@ ) (((knocked-type knocked-type-6)) (let* ((f1-5 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) - (f0-34 1.0) - (f2-6 122880.0) - (f1-6 (fmin f1-5 (* f2-6 f2-6))) - (f2-9 122880.0) - (f30-7 (* (- f0-34 (/ f1-6 (* f2-9 f2-9))) (rnd-float-range this 0.8 1.0))) + (f30-7 (* (- 1.0 (/ (fmin f1-5 (square 122880.0)) (square 122880.0))) (rnd-float-range this 0.8 1.0))) ) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-blue-vxz-lo) (-> s5-0 knocked-blue-vxz-hi) f30-7)) (cond @@ -3066,12 +3056,8 @@ (or (>= (-> arg0 on-surface-count) 3) (and (logtest? (-> gp-0 status) (collide-status on-ground)) (>= 16384.0 (-> gp-0 transv y))) (and (>= (-> arg0 move-count) 3) - (let ((f0-1 40.96)) - (>= (* f0-1 f0-1) (vector-vector-distance-squared (-> gp-0 trans-old) (-> gp-0 trans-old-old))) - ) - (let ((f0-4 40.96)) - (>= (* f0-4 f0-4) (vector-vector-distance-squared (-> gp-0 trans-old-old) (-> gp-0 trans-old-old-old))) - ) + (>= (square 40.96) (vector-vector-distance-squared (-> gp-0 trans-old) (-> gp-0 trans-old-old))) + (>= (square 40.96) (vector-vector-distance-squared (-> gp-0 trans-old-old) (-> gp-0 trans-old-old-old))) ) ) ) diff --git a/goal_src/jak2/engine/anim/joint-exploder.gc b/goal_src/jak2/engine/anim/joint-exploder.gc index d09e512e7b..331cec3abe 100644 --- a/goal_src/jak2/engine/anim/joint-exploder.gc +++ b/goal_src/jak2/engine/anim/joint-exploder.gc @@ -232,15 +232,6 @@ ) (defmethod adjust-bbox-for-limits-along-axis ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) - (local-vars - (sv-16 int) - (sv-32 int) - (sv-48 joint-exploder-joint) - (sv-64 int) - (sv-80 joint-exploder-joint) - (sv-96 int) - (sv-112 joint-exploder-joint) - ) (let ((s5-0 (the-as joint-exploder-list #f))) (let ((v1-0 1)) (until (= v1-0 5) @@ -264,22 +255,23 @@ ) ) (set! (-> arg0 bbox-valid?) #f) - (let ((s2-0 (-> this joints))) - (set! sv-32 (-> arg0 head)) - (let ((s1-0 0) - (s0-0 0) - ) - (let ((v1-7 arg1)) - (cond - ((zero? v1-7) - (let ((f30-0 (* 0.5 (+ (-> arg0 bbox min x) (-> arg0 bbox max x))))) - (while (>= sv-32 0) - (set! sv-48 (-> s2-0 joint sv-32)) + (let ((s2-0 (-> this joints)) + (sv-32 (-> arg0 head)) + (s1-0 0) + (s0-0 0) + ) + (let ((v1-7 arg1)) + (cond + ((zero? v1-7) + (let ((f30-0 (* 0.5 (+ (-> arg0 bbox min x) (-> arg0 bbox max x))))) + (while (>= sv-32 0) + (let ((sv-48 (-> s2-0 joint sv-32))) (cond ((>= (-> sv-48 mat trans x) f30-0) - (set! sv-16 (remove-joint-from-list this arg0 sv-32)) - (add-joint-to-list this s5-0 sv-32) - (set! sv-32 sv-16) + (let ((sv-16 (remove-joint-from-list this arg0 sv-32))) + (add-joint-to-list this s5-0 sv-32) + (set! sv-32 sv-16) + ) (update-bbox-for-joint this s5-0 sv-48) (+! s0-0 1) ) @@ -292,15 +284,17 @@ ) ) ) - ((= v1-7 1) - (let ((f30-1 (* 0.5 (+ (-> arg0 bbox min y) (-> arg0 bbox max y))))) - (while (>= sv-32 0) - (set! sv-80 (-> s2-0 joint sv-32)) + ) + ((= v1-7 1) + (let ((f30-1 (* 0.5 (+ (-> arg0 bbox min y) (-> arg0 bbox max y))))) + (while (>= sv-32 0) + (let ((sv-80 (-> s2-0 joint sv-32))) (cond ((>= (-> sv-80 mat trans y) f30-1) - (set! sv-64 (remove-joint-from-list this arg0 sv-32)) - (add-joint-to-list this s5-0 sv-32) - (set! sv-32 sv-64) + (let ((sv-64 (remove-joint-from-list this arg0 sv-32))) + (add-joint-to-list this s5-0 sv-32) + (set! sv-32 sv-64) + ) (update-bbox-for-joint this s5-0 sv-80) (+! s0-0 1) ) @@ -313,15 +307,17 @@ ) ) ) - ((= v1-7 2) - (let ((f30-2 (* 0.5 (+ (-> arg0 bbox min z) (-> arg0 bbox max z))))) - (while (>= sv-32 0) - (set! sv-112 (-> s2-0 joint sv-32)) + ) + ((= v1-7 2) + (let ((f30-2 (* 0.5 (+ (-> arg0 bbox min z) (-> arg0 bbox max z))))) + (while (>= sv-32 0) + (let ((sv-112 (-> s2-0 joint sv-32))) (cond ((>= (-> sv-112 mat trans z) f30-2) - (set! sv-96 (remove-joint-from-list this arg0 sv-32)) - (add-joint-to-list this s5-0 sv-32) - (set! sv-32 sv-96) + (let ((sv-96 (remove-joint-from-list this arg0 sv-32))) + (add-joint-to-list this s5-0 sv-32) + (set! sv-32 sv-96) + ) (update-bbox-for-joint this s5-0 sv-112) (+! s0-0 1) ) @@ -334,19 +330,19 @@ ) ) ) - ) - ) - (cond - ((zero? s0-0) - (final-adjust this arg0 arg1) - ) - ((zero? s1-0) - (if (not (-> s5-0 probeless?)) - (final-adjust this s5-0 arg1) - ) ) ) ) + (cond + ((zero? s0-0) + (final-adjust this arg0 arg1) + ) + ((zero? s1-0) + (if (not (-> s5-0 probeless?)) + (final-adjust this s5-0 arg1) + ) + ) + ) ) s5-0 ) @@ -354,14 +350,13 @@ ;; WARN: Return type mismatch symbol vs int. (defmethod final-adjust ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) - (local-vars (sv-48 int) (sv-64 (inline-array joint-exploder-list)) (sv-80 joint-exploder-joint)) (set! (-> arg0 bbox-valid?) #f) (let ((s3-0 (-> this joints)) (s2-0 (-> arg0 head)) ) (while (>= s2-0 0) - (set! sv-80 (-> s3-0 joint s2-0)) - (let ((s1-0 (new 'stack-no-clear 'bounding-box)) + (let ((sv-80 (-> s3-0 joint s2-0)) + (s1-0 (new 'stack-no-clear 'bounding-box)) (s0-0 (-> arg0 bbox-valid?)) ) (set! (-> s1-0 min quad) (-> arg0 bbox min quad)) @@ -382,11 +377,13 @@ ) ) (when v1-8 - (set! sv-48 (remove-joint-from-list this arg0 s2-0)) - (set! sv-64 (-> this lists)) - (add-joint-to-list this (the-as joint-exploder-list sv-64) s2-0) - (set! s2-0 sv-48) - (update-bbox-for-joint this (the-as joint-exploder-list sv-64) sv-80) + (let ((sv-48 (remove-joint-from-list this arg0 s2-0)) + (sv-64 (-> this lists)) + ) + (add-joint-to-list this (-> sv-64 0) s2-0) + (set! s2-0 sv-48) + (update-bbox-for-joint this (-> sv-64 0) sv-80) + ) (set! (-> arg0 bbox-valid?) s0-0) (set! (-> arg0 bbox min quad) (-> s1-0 min quad)) (set! (-> arg0 bbox max quad) (-> s1-0 max quad)) @@ -678,11 +675,11 @@ ) ;; WARN: Return type mismatch process-drawable vs joint-exploder. -(defmethod relocate ((this joint-exploder) (arg0 int)) +(defmethod relocate ((this joint-exploder) (offset int)) (if (nonzero? (-> this joints)) - (&+! (-> this joints) arg0) + (&+! (-> this joints) offset) ) - (the-as joint-exploder ((method-of-type process-drawable relocate) this arg0)) + (the-as joint-exploder ((method-of-type process-drawable relocate) this offset)) ) ;; WARN: Return type mismatch object vs none. diff --git a/goal_src/jak2/engine/anim/joint-mod.gc b/goal_src/jak2/engine/anim/joint-mod.gc index 464ba76cfd..8beb7c26cb 100644 --- a/goal_src/jak2/engine/anim/joint-mod.gc +++ b/goal_src/jak2/engine/anim/joint-mod.gc @@ -26,22 +26,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defbehavior joint-mod-ik-callback process ((arg0 cspace) (arg1 transformq)) - (local-vars - (f0-24 float) - (sv-736 vector) - (sv-752 vector) - (sv-768 vector) - (sv-784 vector) - (sv-800 (function quaternion vector vector quaternion)) - (sv-816 quaternion) - (sv-832 vector) - (sv-848 vector) - (sv-864 vector) - (sv-880 vector) - (sv-896 vector) - (sv-912 quaternion) - (sv-928 quaternion) - ) + (local-vars (f0-24 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -105,9 +90,9 @@ (set! (-> a2-1 quad 2) a1-4) (set! (-> a2-1 trans quad) a3-3) ) - (set! sv-752 (new 'stack-no-clear 'vector)) - (set! sv-736 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) + (let ((sv-752 (new 'stack-no-clear 'vector)) + (sv-736 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) (s3-1 (new 'stack-no-clear 'vector)) ) @@ -153,144 +138,124 @@ ) ) ) - (let ((s2-3 (vector-! (new 'stack-no-clear 'vector) sv-736 sv-752))) - (set! sv-784 (new 'stack-no-clear 'vector)) + (let ((s2-3 (vector-! (new 'stack-no-clear 'vector) sv-736 sv-752)) + (sv-784 (new 'stack-no-clear 'vector)) + ) (.lvf vf4 (&-> s0-0 quad)) (.lvf vf5 (&-> sv-736 quad)) (.mov.vf.w vf6 vf0) (.sub.vf.xyz vf6 vf4 vf5) (.svf (&-> sv-784 quad) vf6) - (set! sv-832 (new 'stack-no-clear 'vector)) - (let ((v1-49 sv-752)) - (.lvf vf4 (&-> s0-0 quad)) - (.lvf vf5 (&-> v1-49 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-832 quad) vf6) - (let ((s0-1 (new 'stack-no-clear 'vector))) - (.lvf vf4 (&-> s1-0 quad)) - (.lvf vf5 (&-> sv-752 quad)) + (let ((sv-832 (new 'stack-no-clear 'vector))) + (let ((v1-49 sv-752)) + (.lvf vf4 (&-> s0-0 quad)) + (.lvf vf5 (&-> v1-49 quad)) + ) (.mov.vf.w vf6 vf0) (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> s0-1 quad) vf6) - (set! sv-928 (new 'stack-no-clear 'quaternion)) - (let ((s1-1 (new 'stack-no-clear 'quaternion))) - (let ((f26-0 (vector-length s2-3)) - (f24-0 (vector-length sv-784)) - (f30-1 (vector-length s0-1)) + (.svf (&-> sv-832 quad) vf6) + (let ((s0-1 (new 'stack-no-clear 'vector))) + (.lvf vf4 (&-> s1-0 quad)) + (.lvf vf5 (&-> sv-752 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> s0-1 quad) vf6) + (let ((sv-928 (new 'stack-no-clear 'quaternion)) + (s1-1 (new 'stack-no-clear 'quaternion)) ) - (set! sv-768 (new 'stack-no-clear 'vector)) - (let* ((f28-0 (vector-vector-angle-safe s2-3 sv-784)) - (f0-17 (fmax -1.0 (fmin 1.0 (/ (- (- (* f30-1 f30-1) (* f26-0 f26-0)) (* f24-0 f24-0)) (* 2.0 f24-0 f26-0))))) - (f26-1 (acos f0-17)) - ) - (cond - ((= f28-0 0.0) - (set! (-> sv-768 quad) (-> s4-1 vector (-> gp-0 elbow-rotation-axis) quad)) - (when (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-rot-neg)) - (vector-negate! sv-768 sv-768) - (set! f26-1 (- f26-1)) - ) - (set! (-> s3-1 quad) (-> s4-1 vector (-> gp-0 elbow-pole-vector-axis) quad)) - (if (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-trans-neg)) - (vector-negate! s3-1 s3-1) + (let ((f26-0 (vector-length s2-3)) + (f24-0 (vector-length sv-784)) + (f30-1 (vector-length s0-1)) + ) + (let* ((sv-768 (new 'stack-no-clear 'vector)) + (f28-0 (vector-vector-angle-safe s2-3 sv-784)) + (f0-17 (fmax -1.0 (fmin 1.0 (/ (- (- (square f30-1) (square f26-0)) (square f24-0)) (* 2.0 f24-0 f26-0))))) + (f26-1 (acos f0-17)) ) - ) - (else - (vector-cross! sv-768 s2-3 sv-784) - (vector-! - s3-1 - s2-3 - (vector-float*! (new 'stack-no-clear 'vector) sv-832 (/ (vector-dot sv-832 s2-3) (vector-dot sv-832 sv-832))) - ) - ) - ) - (vector-normalize! s3-1 1.0) - (vector-normalize! sv-768 1.0) - (let ((t9-14 quaternion-vector-angle!) - (a0-44 sv-928) - (a2-5 (- f26-1 f28-0)) - ) - (t9-14 a0-44 sv-768 a2-5) - ) - ) - (vector-orient-by-quat! sv-784 sv-784 sv-928) - (let ((v1-74 sv-832)) - (let ((a0-46 s2-3)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-46 quad)) - ) - (.lvf vf5 (&-> sv-784 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-74 quad) vf6) - ) - (set! sv-800 quaternion-from-two-vectors!) - (set! sv-816 s1-1) - (let ((t9-16 vector-normalize-copy!) - (a0-48 (new 'stack-no-clear 'vector)) - (a2-7 1.0) - ) - (set! sv-848 (t9-16 a0-48 sv-832 a2-7)) - ) - (let ((a2-9 (vector-normalize-copy! (new 'stack-no-clear 'vector) s0-1 1.0))) - (sv-800 sv-816 sv-848 a2-9) - ) - (vector-orient-by-quat! s2-3 s2-3 s1-1) - (set! sv-864 (vector-normalize-copy! (new 'stack-no-clear 'vector) s2-3 1.0)) - (let* ((v1-76 (vector-normalize-copy! (new 'stack-no-clear 'vector) s0-1 1.0)) - (f0-23 (-> sv-864 x)) - (f1-16 (-> sv-864 y)) - (f2-6 (-> sv-864 z)) - (f3-5 (-> v1-76 x)) - (f4-0 (-> v1-76 y)) - (f5-0 (-> v1-76 z)) + (cond + ((= f28-0 0.0) + (set! (-> sv-768 quad) (-> s4-1 vector (-> gp-0 elbow-rotation-axis) quad)) + (when (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-rot-neg)) + (vector-negate! sv-768 sv-768) + (set! f26-1 (- f26-1)) + ) + (set! (-> s3-1 quad) (-> s4-1 vector (-> gp-0 elbow-pole-vector-axis) quad)) + (if (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-trans-neg)) + (vector-negate! s3-1 s3-1) + ) ) - ;; og:preserve-this inlined vector-dot - ; (.mula.s f0-23 f3-5) - ; (.madda.s f1-16 f4-0) - ; (.madd.s f0-24 f2-6 f5-0) - (set! f0-24 (+ (* f0-23 f3-5) (* f1-16 f4-0) (* f2-6 f5-0))) - ) - (let ((f0-26 (fabs f0-24))) - (if (< 0.98 f0-26) - (vector-orient-by-quat! s2-3 s3-1 s1-1) + (else + (vector-cross! sv-768 s2-3 sv-784) + (vector-! + s3-1 + s2-3 + (vector-float*! (new 'stack-no-clear 'vector) sv-832 (/ (vector-dot sv-832 s2-3) (vector-dot sv-832 sv-832))) + ) + ) ) + (vector-normalize! s3-1 1.0) + (vector-normalize! sv-768 1.0) + (quaternion-vector-angle! sv-928 sv-768 (- f26-1 f28-0)) + ) + (vector-orient-by-quat! sv-784 sv-784 sv-928) + (let ((v1-74 sv-832)) + (let ((a0-46 s2-3)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-46 quad)) + ) + (.lvf vf5 (&-> sv-784 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-74 quad) vf6) + ) + (quaternion-from-two-vectors! + s1-1 + (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-832 1.0) + (vector-normalize-copy! (new 'stack-no-clear 'vector) s0-1 1.0) + ) + (vector-orient-by-quat! s2-3 s2-3 s1-1) + (let* ((sv-864 (vector-normalize-copy! (new 'stack-no-clear 'vector) s2-3 1.0)) + (v1-76 (vector-normalize-copy! (new 'stack-no-clear 'vector) s0-1 1.0)) + ) + (set! f0-24 (vector-dot sv-864 v1-76)) + ) + (let ((f0-26 (fabs f0-24))) + (if (< 0.98 f0-26) + (vector-orient-by-quat! s2-3 s3-1 s1-1) + ) + ) + (let ((sv-880 (new 'stack-no-clear 'vector)) + (sv-896 (new 'stack-no-clear 'vector)) + ) + (new 'stack-no-clear 'vector) + (square f30-1) + (let ((sv-912 (new 'stack-no-clear 'quaternion))) + (vector-flatten! sv-880 s2-3 s0-1) + (vector-flatten! sv-896 s3-1 s0-1) + (vector-normalize! sv-880 1.0) + (vector-normalize! sv-896 1.0) + (quaternion-from-two-vectors! sv-912 sv-880 sv-896) + (quaternion*! s1-1 sv-912 s1-1) + ) + ) + ) + (quaternion-pseudo-slerp! sv-928 *unity-quaternion* sv-928 (-> gp-0 blend)) + (quaternion-pseudo-slerp! s1-1 *unity-quaternion* s1-1 (-> gp-0 blend)) + (let ((a2-20 (quaternion->matrix (new 'stack-no-clear 'matrix) sv-928)) + (gp-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> gp-1 quad) (-> s4-1 trans quad)) + (matrix*! s4-1 s4-1 a2-20) + (set! (-> s4-1 trans quad) (-> gp-1 quad)) + ) + (let ((s3-2 (quaternion->matrix (new 'stack-no-clear 'matrix) s1-1)) + (a2-21 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) s5-0)) + (gp-2 (new 'stack-no-clear 'matrix)) + ) + (set! (-> gp-2 quad 0) (-> s5-0 trans quad)) + (matrix*! s4-1 s4-1 a2-21) + (matrix*! s5-0 s5-0 s3-2) + (set! (-> s5-0 trans quad) (-> gp-2 quad 0)) ) - (set! sv-880 (new 'stack-no-clear 'vector)) - (set! sv-896 (new 'stack-no-clear 'vector)) - (new 'stack-no-clear 'vector) - (* f30-1 f30-1) - ) - (set! sv-912 (new 'stack-no-clear 'quaternion)) - (vector-flatten! sv-880 s2-3 s0-1) - (vector-flatten! sv-896 s3-1 s0-1) - (vector-normalize! sv-880 1.0) - (vector-normalize! sv-896 1.0) - (quaternion-from-two-vectors! sv-912 sv-880 sv-896) - (let ((t9-28 quaternion*!) - (a0-63 s1-1) - (a2-17 s1-1) - ) - (t9-28 a0-63 sv-912 a2-17) - ) - (quaternion-pseudo-slerp! sv-928 *unity-quaternion* sv-928 (-> gp-0 blend)) - (quaternion-pseudo-slerp! s1-1 *unity-quaternion* s1-1 (-> gp-0 blend)) - (let ((a2-20 (quaternion->matrix (new 'stack-no-clear 'matrix) sv-928)) - (gp-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> gp-1 quad) (-> s4-1 trans quad)) - (matrix*! s4-1 s4-1 a2-20) - (set! (-> s4-1 trans quad) (-> gp-1 quad)) - ) - (let ((s3-2 (quaternion->matrix (new 'stack-no-clear 'matrix) s1-1)) - (a2-21 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) s5-0)) - (gp-2 (new 'stack-no-clear 'matrix)) - ) - (set! (-> gp-2 quad 0) (-> s5-0 trans quad)) - (matrix*! s4-1 s4-1 a2-21) - (matrix*! s5-0 s5-0 s3-2) - (set! (-> s5-0 trans quad) (-> gp-2 quad 0)) ) ) ) @@ -339,149 +304,145 @@ ) (defbehavior real-joint-mod-gun-look-at-handler process ((arg0 cspace) (arg1 transformq)) - (local-vars - (sv-16 joint-mod) - (sv-64 vector) - (sv-96 quaternion) - (sv-160 vector) - (sv-164 vector) - (sv-168 vector) - (sv-172 symbol) - ) - (set! sv-16 (the-as joint-mod (-> arg0 param1))) - (vector*! (-> arg1 scale) (-> arg1 scale) (-> sv-16 scale)) - (cspace<-parented-transformq-joint! arg0 arg1) - (let ((s5-0 (-> arg0 bone transform))) - (let ((s4-0 (matrix->quat s5-0 (new 'stack-no-clear 'quaternion)))) - (set! sv-64 (matrix->trans s5-0 (new 'stack-no-clear 'vector))) - (quaternion-rotate-y! s4-0 s4-0 (-> sv-16 twist z)) - (set! sv-96 (quaternion-copy! (new 'stack-no-clear 'quaternion) s4-0)) - (when (!= (-> sv-16 flex-blend) 0.0) - (set! sv-160 (vector-y-quaternion! (new 'stack-no-clear 'vector) sv-96)) - (set! sv-164 (vector-z-quaternion! (new 'stack-no-clear 'vector) sv-96)) - (set! sv-168 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> sv-16 target) sv-64) 1.0)) - (set! sv-172 (the-as symbol #f)) - (let* ((f30-0 (vector-y-angle sv-164)) - (a0-14 (vector-flatten! (new 'stack-no-clear 'vector) sv-168 sv-160)) - (f0-2 (vector-y-angle a0-14)) - (f0-3 (deg-diff f30-0 f0-2)) - (f30-1 (* f0-3 (-> sv-16 blend))) - ) - (let ((f28-0 (fmax (fmin f30-1 (-> sv-16 twist-max y)) (- (-> sv-16 twist-max y))))) - (if (or (!= f30-1 f28-0) (= (-> sv-16 blend) 0.0)) - (logclear! (-> sv-16 track-mode) (track-mode lock-on)) - ) - (cond - ((or (< (-> sv-16 ignore-angle) (fabs f0-3)) - (< (-> sv-16 twist-max w) (vector-vector-distance (-> sv-16 target) sv-64)) - ) - (set! f30-1 0.0) - (set! f28-0 0.0) - (set! sv-172 #t) - ) - ((< 5461.3335 (fabs (deg-diff f30-1 f28-0))) - (set! (-> sv-16 blend) 0.0001) - ) - ((< 182.04445 (fabs (deg-diff f30-1 f28-0))) - (logclear! (-> sv-16 track-mode) (track-mode track-x)) - ) - ) - (if (or (and (logtest? (-> sv-16 track-mode) (track-mode track-y)) (= f30-1 f28-0)) - (< (-> sv-16 twist-max y) (fabs (-> sv-16 twist y))) - ) - (set! (-> sv-16 twist y) - (deg-seek (-> sv-16 twist y) f28-0 (* (fabs (deg-diff f28-0 (-> sv-16 twist y))) - (if (logtest? (-> sv-16 track-mode) (track-mode lock-on)) - 1.0 - (-> sv-16 twist-speed-y) - ) - (-> self clock time-adjust-ratio) - ) - ) - ) - ) + (let ((sv-16 (the-as joint-mod (-> arg0 param1)))) + (vector*! (-> arg1 scale) (-> arg1 scale) (-> sv-16 scale)) + (cspace<-parented-transformq-joint! arg0 arg1) + (let ((s5-0 (-> arg0 bone transform))) + (let ((s4-0 (matrix->quat s5-0 (new 'stack-no-clear 'quaternion))) + (sv-64 (matrix->trans s5-0 (new 'stack-no-clear 'vector))) ) - (if (and (< (fabs (deg-diff f30-1 (-> sv-16 twist y))) 728.1778) (and (not sv-172) (!= (-> sv-16 blend) 0.0))) - (logior! (-> sv-16 track-mode) (track-mode lock-on)) - ) - ) - (quaternion-rotate-local-y! sv-96 sv-96 (-> sv-16 twist y)) - (let* ((s3-1 (vector-x-quaternion! (new 'stack-no-clear 'vector) sv-96)) - (f30-2 (vector-x-angle sv-164)) - (s3-2 (vector-flatten! (new 'stack-no-clear 'vector) sv-168 s3-1)) - (f0-24 (vector-x-angle s3-2)) - (f30-3 (fmax - (fmin (* (- (deg-diff f30-2 f0-24)) (-> sv-16 blend)) (-> sv-16 twist-max x)) - (- (-> sv-16 twist-max x)) - ) + (quaternion-rotate-y! s4-0 s4-0 (-> sv-16 twist z)) + (let ((sv-96 (quaternion-copy! (new 'stack-no-clear 'quaternion) s4-0))) + (when (!= (-> sv-16 flex-blend) 0.0) + (let ((sv-160 (vector-y-quaternion! (new 'stack-no-clear 'vector) sv-96)) + (sv-164 (vector-z-quaternion! (new 'stack-no-clear 'vector) sv-96)) + (sv-168 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> sv-16 target) sv-64) 1.0)) + ) + (let* ((sv-172 (the-as symbol #f)) + (f30-0 (vector-y-angle sv-164)) + (a0-14 (vector-flatten! (new 'stack-no-clear 'vector) sv-168 sv-160)) + (f0-2 (vector-y-angle a0-14)) + (f0-3 (deg-diff f30-0 f0-2)) + (f30-1 (* f0-3 (-> sv-16 blend))) + ) + (let ((f28-0 (fmax (fmin f30-1 (-> sv-16 twist-max y)) (- (-> sv-16 twist-max y))))) + (if (or (!= f30-1 f28-0) (= (-> sv-16 blend) 0.0)) + (logclear! (-> sv-16 track-mode) (track-mode lock-on)) + ) + (cond + ((or (< (-> sv-16 ignore-angle) (fabs f0-3)) + (< (-> sv-16 twist-max w) (vector-vector-distance (-> sv-16 target) sv-64)) + ) + (set! f30-1 0.0) + (set! f28-0 0.0) + (set! sv-172 #t) + ) + ((< 5461.3335 (fabs (deg-diff f30-1 f28-0))) + (set! (-> sv-16 blend) 0.0001) + ) + ((< 182.04445 (fabs (deg-diff f30-1 f28-0))) + (logclear! (-> sv-16 track-mode) (track-mode track-x)) + ) + ) + (if (or (and (logtest? (-> sv-16 track-mode) (track-mode track-y)) (= f30-1 f28-0)) + (< (-> sv-16 twist-max y) (fabs (-> sv-16 twist y))) + ) + (set! (-> sv-16 twist y) + (deg-seek (-> sv-16 twist y) f28-0 (* (fabs (deg-diff f28-0 (-> sv-16 twist y))) + (if (logtest? (-> sv-16 track-mode) (track-mode lock-on)) + 1.0 + (-> sv-16 twist-speed-y) + ) + (-> self clock time-adjust-ratio) + ) + ) + ) ) - ) - (if (or (< (vector-dot s3-2 sv-164) 0.1) - (< (-> sv-16 twist-max z) (vector-vector-distance (-> sv-16 target) sv-64)) ) - (set! f30-3 0.0) - ) - (if (or (logtest? (-> sv-16 track-mode) (track-mode track-x)) - (< (-> sv-16 twist-max x) (fabs (-> sv-16 twist x))) - ) - (set! (-> sv-16 twist x) - (deg-seek (-> sv-16 twist x) f30-3 (* (fabs (deg-diff f30-3 (-> sv-16 twist x))) - (if (logtest? (-> sv-16 track-mode) (track-mode lock-on)) - 1.0 - (-> sv-16 twist-speed-x) - ) - (-> self clock time-adjust-ratio) - ) + (if (and (< (fabs (deg-diff f30-1 (-> sv-16 twist y))) 728.1778) (and (not sv-172) (!= (-> sv-16 blend) 0.0))) + (logior! (-> sv-16 track-mode) (track-mode lock-on)) + ) + ) + (quaternion-rotate-local-y! sv-96 sv-96 (-> sv-16 twist y)) + (let* ((s3-1 (vector-x-quaternion! (new 'stack-no-clear 'vector) sv-96)) + (f30-2 (vector-x-angle sv-164)) + (s3-2 (vector-flatten! (new 'stack-no-clear 'vector) sv-168 s3-1)) + (f0-24 (vector-x-angle s3-2)) + (f30-3 (fmax + (fmin (* (- (deg-diff f30-2 f0-24)) (-> sv-16 blend)) (-> sv-16 twist-max x)) + (- (-> sv-16 twist-max x)) ) + ) + ) + (if (or (< (vector-dot s3-2 sv-164) 0.1) + (< (-> sv-16 twist-max z) (vector-vector-distance (-> sv-16 target) sv-64)) + ) + (set! f30-3 0.0) ) + (if (or (logtest? (-> sv-16 track-mode) (track-mode track-x)) + (< (-> sv-16 twist-max x) (fabs (-> sv-16 twist x))) + ) + (set! (-> sv-16 twist x) + (deg-seek (-> sv-16 twist x) f30-3 (* (fabs (deg-diff f30-3 (-> sv-16 twist x))) + (if (logtest? (-> sv-16 track-mode) (track-mode lock-on)) + 1.0 + (-> sv-16 twist-speed-x) + ) + (-> self clock time-adjust-ratio) + ) + ) + ) + ) + ) + ) + (quaternion-rotate-x! sv-96 sv-96 (-> sv-16 twist x)) + (quaternion-normalize! (quaternion*! sv-96 sv-96 (-> sv-16 quat))) + ) + (let ((a1-27 (quaternion-slerp! (new 'stack-no-clear 'quaternion) s4-0 sv-96 (-> sv-16 flex-blend)))) + (matrix<-quat s5-0 a1-27) + ) + ) + ) + (let ((f30-4 (-> sv-16 trans x)) + (s4-1 (-> s5-0 vector 1)) + (v1-97 (vector<-matrix! (new 'stack-no-clear 'vector) s5-0)) + ) + (let ((f0-43 (- f30-4 (-> v1-97 y)))) + (if (< 614.4 (fabs f0-43)) + (+! (-> sv-16 trans z) (* 8.0 f0-43)) ) ) - (quaternion-rotate-x! sv-96 sv-96 (-> sv-16 twist x)) - (quaternion-normalize! (quaternion*! sv-96 sv-96 (-> sv-16 quat))) - ) - (let ((a1-27 (quaternion-slerp! (new 'stack-no-clear 'quaternion) s4-0 sv-96 (-> sv-16 flex-blend)))) - (matrix<-quat s5-0 a1-27) - ) - ) - (let ((f30-4 (-> sv-16 trans x)) - (s4-1 (-> s5-0 vector 1)) - (v1-97 (vector<-matrix! (new 'stack-no-clear 'vector) s5-0)) - ) - (let ((f0-43 (- f30-4 (-> v1-97 y)))) - (if (< 614.4 (fabs f0-43)) - (+! (-> sv-16 trans z) (* 8.0 f0-43)) + (+! (-> sv-16 trans z) (* -260.0 (seconds-per-frame) (-> sv-16 trans y))) + (let ((f0-48 (-> sv-16 trans y))) + (+! (-> sv-16 trans y) (* (-> sv-16 trans z) (seconds-per-frame))) + (set! (-> sv-16 trans y) (* 0.95 (-> sv-16 trans y))) + (when (< (* f0-48 (-> sv-16 trans y)) 0.0) + (set! (-> sv-16 trans y) 0.0) + (set! (-> sv-16 trans z) 0.0) ) - ) - (+! (-> sv-16 trans z) (* -260.0 (seconds-per-frame) (-> sv-16 trans y))) - (let ((f0-48 (-> sv-16 trans y))) - (+! (-> sv-16 trans y) (* (-> sv-16 trans z) (seconds-per-frame))) - (set! (-> sv-16 trans y) (* 0.95 (-> sv-16 trans y))) - (when (< (* f0-48 (-> sv-16 trans y)) 0.0) - (set! (-> sv-16 trans y) 0.0) - (set! (-> sv-16 trans z) 0.0) + ) + (cond + ((< 409.6 (-> sv-16 trans y)) + (set! (-> sv-16 trans y) 409.6) + (set! (-> sv-16 trans z) 0.0) + ) + ((< (-> sv-16 trans y) -409.6) + (set! (-> sv-16 trans y) -409.6) + (set! (-> sv-16 trans z) 0.0) + ) + ) + (set! (-> sv-16 trans x) (-> v1-97 y)) + (let ((f0-60 (* (-> sv-16 trans y) (-> sv-16 flex-blend)))) + (if (!= f0-60 0.0) + (vector+float*! (-> s5-0 trans) v1-97 s4-1 f0-60) + ) ) ) - (cond - ((< 409.6 (-> sv-16 trans y)) - (set! (-> sv-16 trans y) 409.6) - (set! (-> sv-16 trans z) 0.0) - ) - ((< (-> sv-16 trans y) -409.6) - (set! (-> sv-16 trans y) -409.6) - (set! (-> sv-16 trans z) 0.0) - ) - ) - (set! (-> sv-16 trans x) (-> v1-97 y)) - (let ((f0-60 (* (-> sv-16 trans y) (-> sv-16 flex-blend)))) - (if (!= f0-60 0.0) - (vector+float*! (-> s5-0 trans) v1-97 s4-1 f0-60) - ) - ) ) + (if (-> sv-16 parented-scale?) + (set-vector! (-> arg0 bone scale) 1.0 1.0 1.0 1.0) + ) ) - (if (-> sv-16 parented-scale?) - (set-vector! (-> arg0 bone scale) 1.0 1.0 1.0 1.0) - ) 0 (none) ) @@ -521,8 +482,8 @@ (s0-0 (matrix->trans gp-0 (new 'stack-no-clear 'vector))) ) (set! (-> gp-0 vector 1 quad) (-> s5-0 twist-max quad)) - (vector-cross! (-> gp-0 vector 2) (the-as vector (-> gp-0 vector)) (-> gp-0 vector 1)) - (vector-cross! (the-as vector (-> gp-0 vector)) (-> gp-0 vector 1) (-> gp-0 vector 2)) + (vector-cross! (-> gp-0 vector 2) (-> gp-0 vector 0) (-> gp-0 vector 1)) + (vector-cross! (-> gp-0 vector 0) (-> gp-0 vector 1) (-> gp-0 vector 2)) (set! (-> gp-0 vector 0 w) 0.0) (set! (-> gp-0 vector 1 w) 0.0) (set! (-> gp-0 vector 2 w) 0.0) @@ -733,19 +694,9 @@ (defmethod look-at! ((this joint-mod) (arg0 vector) (arg1 symbol) (arg2 process)) (when (= arg1 'attacking) - (let* ((s2-0 arg2) - (s1-0 (if (type? s2-0 process-drawable) - (the-as process-drawable s2-0) - ) - ) - ) + (let ((s1-0 (as-type arg2 process-drawable))) (when s1-0 - (let* ((s0-0 (-> s1-0 fact)) - (s2-1 (if (type? s0-0 fact-info-enemy) - (the-as fact-info-enemy s0-0) - ) - ) - ) + (let ((s2-1 (as-type (-> s1-0 fact) fact-info-enemy))) (when s2-1 (when (< (vector-vector-distance (-> this process root trans) (-> s1-0 root trans)) (-> s2-1 cam-notice-dist)) (set-time! (-> this notice-time)) @@ -791,184 +742,154 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defbehavior joint-mod-look-at-handler process ((arg0 cspace) (arg1 transformq)) - (local-vars (f0-1 float) (sv-80 symbol) (sv-144 vector) (sv-160 vector) (sv-176 float)) - (rlet ((vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - ) - (init-vf0-vector) - (let ((gp-0 (the-as joint-mod (-> arg0 param1)))) - (cspace<-parented-transformq-joint! arg0 arg1) - (let ((s1-0 (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (-> gp-0 process node-list data 0 bone transform vector 1) - 1.0 - ) - ) - (s2-0 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector))) - (s3-0 (vector-normalize! (-> arg0 bone transform vector (-> gp-0 nose)) 1.0)) - (s0-0 (vector-normalize! (-> arg0 bone transform vector (-> gp-0 ear)) 1.0)) - ) - (set! sv-144 (vector-normalize! - (vector-cross! - (new 'stack-no-clear 'vector) - (-> arg0 bone transform vector (-> gp-0 up)) - (-> arg0 bone transform vector (-> gp-0 nose)) - ) - 1.0 - ) - ) - (let ((s2-1 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) s2-0) 1.0))) - (set! sv-160 (-> gp-0 process node-list data (-> gp-0 base-joint) bone transform vector (-> gp-0 base-nose))) - (set! sv-80 (the-as symbol #f)) - (let ((f0-0 (-> sv-144 x)) - (f1-0 (-> sv-144 y)) - (f2-0 (-> sv-144 z)) - (f3-0 (-> s0-0 x)) - (f4-0 (-> s0-0 y)) - (f5-0 (-> s0-0 z)) - ) - ;; og:preserve-this inlined vector-dot - ; (.mula.s f0-0 f3-0) - ; (.madda.s f1-0 f4-0) - ; (.madd.s f0-1 f2-0 f5-0) - (set! f0-1 (+ (* f0-0 f3-0) (* f1-0 f4-0) (* f2-0 f5-0))) - ) - (if (< f0-1 0.0) - (set! sv-80 #t) - ) - (let* ((f30-0 (vector-y-angle s3-0)) - (a0-18 (vector-flatten! (new-stack-vector0) s2-1 s1-0)) - (f0-3 (vector-y-angle a0-18)) - (f30-1 (deg-diff f30-0 f0-3)) - (f0-4 (if (= (-> gp-0 base-joint) (+ (-> arg0 joint number) 1)) - 0.0 - (deg-diff (vector-y-angle s3-0) (vector-y-angle sv-160)) - ) - ) + (local-vars (f0-1 float)) + (let ((gp-0 (the-as joint-mod (-> arg0 param1)))) + (cspace<-parented-transformq-joint! arg0 arg1) + (let* ((s1-0 (vector-normalize-copy! + (new 'stack-no-clear 'vector) + (-> gp-0 process node-list data 0 bone transform vector 1) + 1.0 + ) ) - (if (< (-> gp-0 ignore-angle) (fabs f30-1)) - (set! f30-1 0.0) - ) - (let ((f30-2 - (fmax - (fmin (* f30-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (+ (-> gp-0 twist-max y) (* f0-4 (-> gp-0 flex-blend)))) - (+ (- (-> gp-0 twist-max y)) (* f0-4 (-> gp-0 flex-blend))) - ) - ) - ) - (when (and (-> gp-0 shutting-down?) (< (fabs (- (-> gp-0 twist y) f30-2)) 18.204445)) - (if (and (= (-> gp-0 scale x) 1.0) (= (-> gp-0 scale y) 1.0) (= (-> gp-0 scale z) 1.0)) - (mode-set! gp-0 (joint-mod-mode reset)) - (mode-set! gp-0 (joint-mod-mode rotate2)) - ) - ) - (let ((s1-2 deg-seek) - (s0-2 (-> gp-0 twist y)) - ) - (set! sv-176 f30-2) - (let ((a2-3 (* (fabs (deg-diff f30-2 (-> gp-0 twist y))) (-> gp-0 twist-speed-y) (-> self clock time-adjust-ratio))) - ) - (set! (-> gp-0 twist y) (s1-2 s0-2 sv-176 a2-3)) - ) - ) - ) - ) - 0.0 - (let ((f0-25 (if sv-80 - (- (-> gp-0 twist y)) - (-> gp-0 twist y) - ) + (s2-0 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector))) + (s3-0 (vector-normalize! (-> arg0 bone transform vector (-> gp-0 nose)) 1.0)) + (s0-0 (vector-normalize! (-> arg0 bone transform vector (-> gp-0 ear)) 1.0)) + (sv-144 (vector-normalize! + (vector-cross! + (new 'stack-no-clear 'vector) + (-> arg0 bone transform vector (-> gp-0 up)) + (-> arg0 bone transform vector (-> gp-0 nose)) ) - (v1-49 (-> gp-0 up)) - ) - (cond - ((zero? v1-49) - (quaternion-rotate-x! (-> arg1 quat) (-> arg1 quat) f0-25) - ) - ((= v1-49 1) - (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) f0-25) - ) - (else - (quaternion-rotate-z! (-> arg1 quat) (-> arg1 quat) f0-25) - ) - ) - ) - (let* ((s1-3 - (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (the-as vector (-> gp-0 process node-list data 0 bone transform)) 1.0 ) ) - (f30-3 (vector-x-angle s3-0)) - (s2-2 (vector-flatten! (new-stack-vector0) s2-1 s1-3)) - (f0-26 (vector-x-angle s2-2)) - (f0-32 - (fmax - (fmin (* (- (deg-diff f30-3 f0-26)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) - (- (-> gp-0 twist-max x)) + (s2-1 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) s2-0) 1.0)) + ) + (let ((sv-160 (-> gp-0 process node-list data (-> gp-0 base-joint) bone transform vector (-> gp-0 base-nose))) + (sv-80 (the-as symbol #f)) + ) + (set! f0-1 (vector-dot sv-144 s0-0)) + (if (< f0-1 0.0) + (set! sv-80 #t) + ) + (let* ((f30-0 (vector-y-angle s3-0)) + (a0-18 (vector-flatten! (new-stack-vector0) s2-1 s1-0)) + (f0-3 (vector-y-angle a0-18)) + (f30-1 (deg-diff f30-0 f0-3)) + (f0-4 (if (= (-> gp-0 base-joint) (+ (-> arg0 joint number) 1)) + 0.0 + (deg-diff (vector-y-angle s3-0) (vector-y-angle sv-160)) + ) ) - ) - ) - (if (< (vector-dot s2-2 s3-0) 0.1) - (set! f0-32 0.0) + ) + (if (< (-> gp-0 ignore-angle) (fabs f30-1)) + (set! f30-1 0.0) + ) + (let ((f30-2 + (fmax + (fmin (* f30-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (+ (-> gp-0 twist-max y) (* f0-4 (-> gp-0 flex-blend)))) + (+ (- (-> gp-0 twist-max y)) (* f0-4 (-> gp-0 flex-blend))) + ) + ) ) - (set! (-> gp-0 twist x) + (when (and (-> gp-0 shutting-down?) (< (fabs (- (-> gp-0 twist y) f30-2)) 18.204445)) + (if (and (= (-> gp-0 scale x) 1.0) (= (-> gp-0 scale y) 1.0) (= (-> gp-0 scale z) 1.0)) + (mode-set! gp-0 (joint-mod-mode reset)) + (mode-set! gp-0 (joint-mod-mode rotate2)) + ) + ) + (set! (-> gp-0 twist y) (deg-seek - (-> gp-0 twist x) - f0-32 - (* (fabs (deg-diff f0-32 (-> gp-0 twist x))) (-> gp-0 twist-speed-x) (-> self clock time-adjust-ratio)) + (-> gp-0 twist y) + f30-2 + (* (fabs (deg-diff f30-2 (-> gp-0 twist y))) (-> gp-0 twist-speed-y) (-> self clock time-adjust-ratio)) ) ) ) ) - ) - (let ((v1-60 (-> gp-0 ear))) - (cond - ((zero? v1-60) - (quaternion-rotate-x! (-> arg1 quat) (-> arg1 quat) (-> gp-0 twist x)) - ) - ((= v1-60 1) - (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> gp-0 twist x)) - ) - (else - (quaternion-rotate-z! (-> arg1 quat) (-> arg1 quat) (-> gp-0 twist x)) - ) - ) - ) - (vector+! (-> arg1 trans) (-> arg1 trans) (-> gp-0 trans)) - (quaternion-normalize! (quaternion*! (-> arg1 quat) (-> arg1 quat) (-> gp-0 quat))) - (let ((a1-36 (-> arg1 scale))) - (let ((v1-63 (-> arg1 scale)) - (a0-46 (-> gp-0 scale)) + 0.0 + (let ((f0-25 (if sv-80 + (- (-> gp-0 twist y)) + (-> gp-0 twist y) + ) + ) + (v1-49 (-> gp-0 up)) + ) + (cond + ((zero? v1-49) + (quaternion-rotate-x! (-> arg1 quat) (-> arg1 quat) f0-25) + ) + ((= v1-49 1) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) f0-25) + ) + (else + (quaternion-rotate-z! (-> arg1 quat) (-> arg1 quat) f0-25) ) - (.lvf vf4 (&-> v1-63 quad)) - (.lvf vf5 (&-> a0-46 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.vf.xyz vf6 vf4 vf5) - (.svf (&-> a1-36 quad) vf6) - ) - (cspace<-parented-transformq-joint! arg0 arg1) - (if (-> gp-0 parented-scale?) - (set-vector! (-> arg0 bone scale) 1.0 1.0 1.0 1.0) - ) - (if (and (= (-> gp-0 process type) target) (!= (-> gp-0 blend) 0.0)) - (add-debug-text-sphere - *display-target-marks* - (bucket-id debug-no-zbuf1) - (-> gp-0 target) - (meters 0.2) - "look" - (new 'static 'rgba :r #xff :g #xff :a #x80) ) ) + ) + (let* ((s1-3 + (vector-normalize-copy! + (new 'stack-no-clear 'vector) + (the-as vector (-> gp-0 process node-list data 0 bone transform)) + 1.0 + ) + ) + (f30-3 (vector-x-angle s3-0)) + (s2-2 (vector-flatten! (new-stack-vector0) s2-1 s1-3)) + (f0-26 (vector-x-angle s2-2)) + (f0-32 + (fmax + (fmin (* (- (deg-diff f30-3 f0-26)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) + (- (-> gp-0 twist-max x)) + ) + ) + ) + (if (< (vector-dot s2-2 s3-0) 0.1) + (set! f0-32 0.0) + ) + (set! (-> gp-0 twist x) + (deg-seek + (-> gp-0 twist x) + f0-32 + (* (fabs (deg-diff f0-32 (-> gp-0 twist x))) (-> gp-0 twist-speed-x) (-> self clock time-adjust-ratio)) + ) + ) + ) ) - 0 - (none) + (let ((v1-60 (-> gp-0 ear))) + (cond + ((zero? v1-60) + (quaternion-rotate-x! (-> arg1 quat) (-> arg1 quat) (-> gp-0 twist x)) + ) + ((= v1-60 1) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> gp-0 twist x)) + ) + (else + (quaternion-rotate-z! (-> arg1 quat) (-> arg1 quat) (-> gp-0 twist x)) + ) + ) + ) + (vector+! (-> arg1 trans) (-> arg1 trans) (-> gp-0 trans)) + (quaternion-normalize! (quaternion*! (-> arg1 quat) (-> arg1 quat) (-> gp-0 quat))) + (vector*! (-> arg1 scale) (-> arg1 scale) (-> gp-0 scale)) + (cspace<-parented-transformq-joint! arg0 arg1) + (if (-> gp-0 parented-scale?) + (set-vector! (-> arg0 bone scale) 1.0 1.0 1.0 1.0) + ) + (if (and (= (-> gp-0 process type) target) (!= (-> gp-0 blend) 0.0)) + (add-debug-text-sphere + *display-target-marks* + (bucket-id debug-no-zbuf1) + (-> gp-0 target) + (meters 0.2) + "look" + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + ) ) + 0 + (none) ) ;; WARN: Return type mismatch symbol vs none. @@ -984,20 +905,16 @@ (s4-0 (new 'stack-no-clear 'matrix)) ) (let ((s2-0 (new 'stack-no-clear 'vector))) - (vector-normalize-copy! (the-as vector (-> s4-0 vector)) (the-as vector (-> arg0 bone transform)) 1.0) + (vector-normalize-copy! (-> s4-0 vector 0) (the-as vector (-> arg0 bone transform)) 1.0) (vector-normalize-copy! (-> s4-0 vector 1) (-> arg0 bone transform vector 1) 1.0) (vector-normalize-copy! (-> s4-0 vector 2) (-> arg0 bone transform vector 2) 1.0) (set-vector! (-> s4-0 trans) 0.0 0.0 0.0 1.0) (matrix-transpose! s4-0 s4-0) (set-vector! (-> s4-0 trans) 0.0 0.0 0.0 1.0) (vector-matrix*! s2-0 s1-0 s4-0) - (let* ((t9-8 asin) - (f0-8 (-> s2-0 x)) - (f0-10 (* f0-8 f0-8)) - (f1-0 (-> s2-0 y)) - (f28-0 (t9-8 (sqrtf (+ f0-10 (* f1-0 f1-0))))) - (f30-0 (atan (-> s2-0 y) (-> s2-0 x))) - ) + (let ((f28-0 (asin (sqrtf (+ (square (-> s2-0 x)) (square (-> s2-0 y)))))) + (f30-0 (atan (-> s2-0 y) (-> s2-0 x))) + ) (if (< (-> s2-0 z) 0.0) (set! f28-0 (- 32768.0 f28-0)) ) @@ -1028,11 +945,9 @@ ) ) ) - (let* ((f0-38 (sin f30-0)) - (f26-0 (* f0-38 f0-38)) - (f0-40 (cos f30-0)) - (f0-42 (* f0-40 f0-40)) - ) + (let ((f26-0 (square (sin f30-0))) + (f0-42 (square (cos f30-0))) + ) 32768.0 (let ((f0-44 (cond ((< 16384.0 f30-0) @@ -1057,13 +972,7 @@ ) (let ((f28-1 (cos f28-0))) (set-vector! s2-0 (cos f30-0) (sin f30-0) 0.0 1.0) - (let ((t9-15 vector-normalize!) - (a0-19 s2-0) - (f0-52 1.0) - (f1-22 f28-1) - ) - (t9-15 a0-19 (sqrtf (- f0-52 (* f1-22 f1-22)))) - ) + (vector-normalize! s2-0 (sqrtf (- 1.0 (square f28-1)))) (set! (-> s2-0 z) f28-1) ) ) @@ -1101,75 +1010,76 @@ ) (defbehavior joint-mod-world-look-at-handler process ((arg0 cspace) (arg1 transformq)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 vector)) (let ((gp-0 (the-as joint-mod (-> arg0 param1)))) (let ((s5-0 (-> arg0 bone transform))) (cspace<-parented-transformq-joint! arg0 arg1) - (set! sv-48 (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (-> gp-0 process node-list data 0 bone transform vector 1) - 1.0 - ) + (let ((sv-48 (vector-normalize-copy! + (new 'stack-no-clear 'vector) + (-> gp-0 process node-list data 0 bone transform vector 1) + 1.0 + ) + ) + (sv-52 (vector-normalize! (-> s5-0 vector (-> gp-0 nose)) 1.0)) + (sv-56 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> s5-0 trans)) 1.0)) ) - (set! sv-52 (vector-normalize! (-> s5-0 vector (-> gp-0 nose)) 1.0)) - (set! sv-56 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> s5-0 trans)) 1.0)) - (let* ((f30-0 (vector-y-angle sv-52)) - (a0-7 (vector-flatten! (new-stack-vector0) sv-56 sv-48)) - (f0-0 (vector-y-angle a0-7)) - (f0-1 (deg-diff f30-0 f0-0)) - ) - (if (< (-> gp-0 ignore-angle) (fabs f0-1)) - (set! f0-1 0.0) - ) - (let ((f0-5 - (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))) - ) + (let* ((f30-0 (vector-y-angle sv-52)) + (a0-7 (vector-flatten! (new-stack-vector0) sv-56 sv-48)) + (f0-0 (vector-y-angle a0-7)) + (f0-1 (deg-diff f30-0 f0-0)) + ) + (if (< (-> gp-0 ignore-angle) (fabs f0-1)) + (set! f0-1 0.0) ) - (set! (-> gp-0 twist y) (deg-seek - (-> gp-0 twist y) - f0-5 - (* (fmax 1.0 (* (fabs (deg-diff f0-5 (-> gp-0 twist y))) (-> gp-0 twist-speed-y))) + (let ((f0-5 + (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))) + ) + ) + (set! (-> gp-0 twist y) (deg-seek + (-> gp-0 twist y) + f0-5 + (* (fmax 1.0 (* (fabs (deg-diff f0-5 (-> gp-0 twist y))) (-> gp-0 twist-speed-y))) + (-> self clock time-adjust-ratio) + ) + ) + ) + ) + ) + (when (!= (-> gp-0 twist y) 0.0) + (let ((a2-3 (matrix-rotate-y! (new 'stack-no-clear 'matrix) (-> gp-0 twist y))) + (s4-2 (-> s5-0 trans quad)) + ) + (matrix*! s5-0 s5-0 a2-3) + (set! (-> s5-0 trans quad) s4-2) + ) + ) + (let* ((s4-3 (vector-normalize-copy! + (new 'stack-no-clear 'vector) + (the-as vector (-> gp-0 process node-list data 0 bone transform)) + 1.0 + ) + ) + (f30-2 (vector-x-angle sv-52)) + (s4-4 (vector-flatten! (new-stack-vector0) sv-56 s4-3)) + (f0-15 (vector-x-angle s4-4)) + (f0-21 (fmax + (fmin (* (- (deg-diff f30-2 f0-15)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) + (- (-> gp-0 twist-max x)) + ) + ) + ) + (if (< (vector-dot s4-4 sv-52) 0.1) + (set! f0-21 0.0) + ) + (set! (-> gp-0 twist x) (deg-seek + (-> gp-0 twist x) + f0-21 + (* (fmax 1.0 (* (fabs (deg-diff f0-21 (-> gp-0 twist x))) (-> gp-0 twist-speed-x))) (-> self clock time-adjust-ratio) ) ) ) ) ) - (when (!= (-> gp-0 twist y) 0.0) - (let ((a2-3 (matrix-rotate-y! (new 'stack-no-clear 'matrix) (-> gp-0 twist y))) - (s4-2 (-> s5-0 trans quad)) - ) - (matrix*! s5-0 s5-0 a2-3) - (set! (-> s5-0 trans quad) s4-2) - ) - ) - (let* ((s4-3 (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (the-as vector (-> gp-0 process node-list data 0 bone transform)) - 1.0 - ) - ) - (f30-2 (vector-x-angle sv-52)) - (s4-4 (vector-flatten! (new-stack-vector0) sv-56 s4-3)) - (f0-15 (vector-x-angle s4-4)) - (f0-21 (fmax - (fmin (* (- (deg-diff f30-2 f0-15)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) - (- (-> gp-0 twist-max x)) - ) - ) - ) - (if (< (vector-dot s4-4 sv-52) 0.1) - (set! f0-21 0.0) - ) - (set! (-> gp-0 twist x) (deg-seek - (-> gp-0 twist x) - f0-21 - (* (fmax 1.0 (* (fabs (deg-diff f0-21 (-> gp-0 twist x))) (-> gp-0 twist-speed-x))) - (-> self clock time-adjust-ratio) - ) - ) - ) - ) (when (!= (-> gp-0 twist x) 0.0) (let* ((v1-25 (-> gp-0 ear)) (a1-17 ((cond @@ -1410,7 +1320,7 @@ ) (vector-reset! (-> arg0 bone transform trans)) (set! (-> arg0 bone transform trans w) 1.0) - (vector-float*! (the-as vector (-> s3-0 vector)) (the-as vector (-> s3-0 vector)) (-> s5-0 scale x)) + (vector-float*! (-> s3-0 vector 0) (-> s3-0 vector 0) (-> s5-0 scale x)) (vector-float*! (-> s3-0 vector 1) (-> s3-0 vector 1) (-> s5-0 scale y)) (vector-float*! (-> s3-0 vector 2) (-> s3-0 vector 2) (-> s5-0 scale z)) (set! (-> s3-0 vector 0 w) 0.0) diff --git a/goal_src/jak2/engine/anim/joint.gc b/goal_src/jak2/engine/anim/joint.gc index db5a31cfc5..0bd22b57c7 100644 --- a/goal_src/jak2/engine/anim/joint.gc +++ b/goal_src/jak2/engine/anim/joint.gc @@ -527,13 +527,13 @@ this ) -(defmethod mem-usage ((this joint) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 68 (-> arg0 length))) - (set! (-> arg0 data 67 name) "joint") - (+! (-> arg0 data 67 count) 1) +(defmethod mem-usage ((this joint) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 68 (-> usage length))) + (set! (-> usage data 67 name) "joint") + (+! (-> usage data 67 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 67 used) v1-6) - (+! (-> arg0 data 67 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 67 used) v1-6) + (+! (-> usage data 67 total) (logand -16 (+ v1-6 15))) ) this ) @@ -562,13 +562,13 @@ (the-as int (+ (-> joint-anim-drawable size) (* (-> this length) 4))) ) -(defun joint-anim-login ((arg0 joint-anim-drawable)) - (dotimes (s5-0 (-> arg0 length)) - (if (-> arg0 data s5-0) - (login (-> arg0 data s5-0)) +(defun joint-anim-login ((jad joint-anim-drawable)) + (dotimes (s5-0 (-> jad length)) + (if (-> jad data s5-0) + (login (-> jad data s5-0)) ) ) - arg0 + jad ) (defun joint-anim-inspect-elt ((arg0 joint-anim) (arg1 float)) @@ -583,16 +583,16 @@ arg0 ) -(defmethod mem-usage ((this joint-anim-drawable) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 80 (-> arg0 length))) - (set! (-> arg0 data 79 name) "joint-anim-drawable") - (+! (-> arg0 data 79 count) 1) +(defmethod mem-usage ((this joint-anim-drawable) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 80 (-> usage length))) + (set! (-> usage data 79 name) "joint-anim-drawable") + (+! (-> usage data 79 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 79 used) v1-6) - (+! (-> arg0 data 79 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 79 used) v1-6) + (+! (-> usage data 79 total) (logand -16 (+ v1-6 15))) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) this ) @@ -812,42 +812,42 @@ this ) -(defmethod mem-usage ((this art-mesh-anim) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 75 (-> arg0 length))) - (set! (-> arg0 data 74 name) "art-mesh-anim") - (+! (-> arg0 data 74 count) 1) +(defmethod mem-usage ((this art-mesh-anim) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 75 (-> usage length))) + (set! (-> usage data 74 name) "art-mesh-anim") + (+! (-> usage data 74 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 74 used) v1-6) - (+! (-> arg0 data 74 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 74 used) v1-6) + (+! (-> usage data 74 total) (logand -16 (+ v1-6 15))) ) (if (-> this extra) - (mem-usage (-> this extra) arg0 (logior arg1 512)) + (mem-usage (-> this extra) usage (logior flags 512)) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) this ) -(defmethod mem-usage ((this art-joint-anim) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 78 (-> arg0 length))) - (set! (-> arg0 data 77 name) "art-joint-anim") - (+! (-> arg0 data 77 count) 1) +(defmethod mem-usage ((this art-joint-anim) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 78 (-> usage length))) + (set! (-> usage data 77 name) "art-joint-anim") + (+! (-> usage data 77 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 77 used) v1-6) - (+! (-> arg0 data 77 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 77 used) v1-6) + (+! (-> usage data 77 total) (logand -16 (+ v1-6 15))) ) (if (-> this extra) - (mem-usage (-> this extra) arg0 (logior arg1 512)) + (mem-usage (-> this extra) usage (logior flags 512)) ) - (jacc-mem-usage (-> this frames) arg0 arg1) + (jacc-mem-usage (-> this frames) usage flags) (when (and (nonzero? (-> this eye-anim)) (-> this eye-anim)) - (set! (-> arg0 length) (max 112 (-> arg0 length))) - (set! (-> arg0 data 111 name) "eye-anim") - (+! (-> arg0 data 111 count) 1) + (set! (-> usage length) (max 112 (-> usage length))) + (set! (-> usage data 111 name) "eye-anim") + (+! (-> usage data 111 count) 1) (let ((v1-26 (* (* (+ (-> this eye-anim max-frame) 1) 2) 8))) - (+! (-> arg0 data 111 used) v1-26) - (+! (-> arg0 data 111 total) (logand -16 (+ v1-26 15))) + (+! (-> usage data 111 used) v1-26) + (+! (-> usage data 111 total) (logand -16 (+ v1-26 15))) ) ) this @@ -889,7 +889,7 @@ (dotimes (s2-0 (-> this length)) (if (and (-> this data s2-0) (= (-> this data s2-0 type) arg1) - (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> (-> this data s2-0 name) data s3-0))) + (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> this data s2-0 name data s3-0))) ) (return (the-as basic (-> this data s2-0))) ) @@ -915,7 +915,7 @@ (dotimes (s2-0 (-> this length)) (if (and (-> this data s2-0) (= (-> this data s2-0 type) arg1) - (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> (-> this data s2-0 name) data s3-0))) + (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> this data s2-0 name data s3-0))) ) (return s2-0) ) @@ -943,29 +943,29 @@ this ) -(defmethod mem-usage ((this art-group) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 74 (-> arg0 length))) - (set! (-> arg0 data 73 name) "art-group") - (+! (-> arg0 data 73 count) 1) +(defmethod mem-usage ((this art-group) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 74 (-> usage length))) + (set! (-> usage data 73 name) "art-group") + (+! (-> usage data 73 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 73 used) v1-6) - (+! (-> arg0 data 73 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 73 used) v1-6) + (+! (-> usage data 73 total) (logand -16 (+ v1-6 15))) ) (if (-> this extra) - (mem-usage (-> this extra) arg0 (logior arg1 512)) + (mem-usage (-> this extra) usage (logior flags 512)) ) (dotimes (s3-0 (-> this length)) (if (-> this data s3-0) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) ) this ) ;; WARN: Return type mismatch art-group vs none. -(defmethod relocate ((this art-group) (arg0 kheap) (arg1 (pointer uint8))) +(defmethod relocate ((this art-group) (heap kheap) (name (pointer uint8))) (let ((s4-0 (clear *temp-string*))) - (string<-charp s4-0 arg1) + (string<-charp s4-0 name) (set! this (cond ((not this) @@ -1033,19 +1033,19 @@ (the-as int (+ (-> art size) (* (-> this length) 4))) ) -(defmethod mem-usage ((this art-mesh-geo) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 76 (-> arg0 length))) - (set! (-> arg0 data 75 name) "art-mesh-geo") - (+! (-> arg0 data 75 count) 1) +(defmethod mem-usage ((this art-mesh-geo) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 76 (-> usage length))) + (set! (-> usage data 75 name) "art-mesh-geo") + (+! (-> usage data 75 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 75 used) v1-6) - (+! (-> arg0 data 75 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 75 used) v1-6) + (+! (-> usage data 75 total) (logand -16 (+ v1-6 15))) ) (if (-> this extra) - (mem-usage (-> this extra) arg0 (logior arg1 512)) + (mem-usage (-> this extra) usage (logior flags 512)) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) this ) @@ -1118,52 +1118,52 @@ ) ) -(defmethod mem-usage ((this art-joint-geo) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 77 (-> arg0 length))) - (set! (-> arg0 data 76 name) "art-joint-geo") - (+! (-> arg0 data 76 count) 1) +(defmethod mem-usage ((this art-joint-geo) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 77 (-> usage length))) + (set! (-> usage data 76 name) "art-joint-geo") + (+! (-> usage data 76 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 76 used) v1-6) - (+! (-> arg0 data 76 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 76 used) v1-6) + (+! (-> usage data 76 total) (logand -16 (+ v1-6 15))) ) (if (-> this extra) - (mem-usage (-> this extra) arg0 (logior arg1 512)) + (mem-usage (-> this extra) usage (logior flags 512)) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) this ) -(defbehavior joint-control-channel-eval process ((arg0 joint-control-channel)) - (let ((f0-3 ((-> arg0 num-func) arg0 (-> arg0 param 0) (-> arg0 param 1) (-> arg0 param 2)))) - (set! (-> arg0 eval-time) (the-as uint (current-time))) +(defbehavior joint-control-channel-eval process ((jcc joint-control-channel)) + (let ((f0-3 ((-> jcc num-func) jcc (-> jcc param 0) (-> jcc param 1) (-> jcc param 2)))) + (set! (-> jcc eval-time) (the-as uint (current-time))) f0-3 ) ) -(defbehavior joint-control-channel-eval! process ((arg0 joint-control-channel) (arg1 (function joint-control-channel float float float float))) - (set! (-> arg0 num-func) arg1) - (let ((f0-3 (arg1 arg0 (-> arg0 param 0) (-> arg0 param 1) (-> arg0 param 2)))) - (set! (-> arg0 eval-time) (the-as uint (current-time))) +(defbehavior joint-control-channel-eval! process ((jcc joint-control-channel) (num-func (function joint-control-channel float float float float))) + (set! (-> jcc num-func) num-func) + (let ((f0-3 (num-func jcc (-> jcc param 0) (-> jcc param 1) (-> jcc param 2)))) + (set! (-> jcc eval-time) (the-as uint (current-time))) f0-3 ) ) -(defun joint-control-channel-group-eval! ((arg0 joint-control-channel) - (arg1 art-joint-anim) - (arg2 (function joint-control-channel float float float float)) +(defun joint-control-channel-group-eval! ((jcc joint-control-channel) + (ja art-joint-anim) + (num-func (function joint-control-channel float float float float)) ) - (set! (-> arg0 num-func) arg2) + (set! (-> jcc num-func) num-func) (cond - ((= (-> arg0 command) (joint-control-command stack)) + ((= (-> jcc command) (joint-control-command stack)) ) (else - (if arg1 - (set! (-> arg0 frame-group) arg1) + (if ja + (set! (-> jcc frame-group) ja) ) - (arg2 arg0 (-> arg0 param 0) (-> arg0 param 1) (-> arg0 param 2)) - (set! (-> arg0 eval-time) (the-as uint (current-time))) + (num-func jcc (-> jcc param 0) (-> jcc param 1) (-> jcc param 2)) + (set! (-> jcc eval-time) (the-as uint (current-time))) ) ) 0 @@ -1184,106 +1184,106 @@ 0 ) -(defun joint-control-copy! ((arg0 joint-control) (arg1 joint-control)) - (set! (-> arg0 blend-index) (-> arg1 blend-index)) - (set! (-> arg0 active-channels) (-> arg1 active-channels)) - (set! (-> arg0 float-channels) (the-as uint 0)) - (set! (-> arg0 root-channel) +(defun joint-control-copy! ((dst joint-control) (src joint-control)) + (set! (-> dst blend-index) (-> src blend-index)) + (set! (-> dst active-channels) (-> src active-channels)) + (set! (-> dst float-channels) (the-as uint 0)) + (set! (-> dst root-channel) (the-as (inline-array joint-control-channel) - (-> arg0 + (-> dst channel - (/ (the-as int (- (the-as uint (-> arg1 root-channel)) (the-as uint (the-as uint (-> arg1 channel))))) 64) + (/ (the-as int (- (the-as uint (-> src root-channel)) (the-as uint (the-as uint (-> src channel))))) 64) ) ) ) - (let ((v1-10 (min (the-as int (-> arg0 allocated-length)) (the-as int (-> arg1 active-channels))))) - (mem-copy! (the-as pointer (-> arg0 channel)) (the-as pointer (-> arg1 channel)) (* v1-10 64)) + (let ((v1-10 (min (the-as int (-> dst allocated-length)) (the-as int (-> src active-channels))))) + (mem-copy! (the-as pointer (-> dst channel)) (the-as pointer (-> src channel)) (* v1-10 64)) ) - (dotimes (v1-12 (the-as int (-> arg0 allocated-length))) - (set! (-> arg0 channel v1-12 parent) arg0) + (dotimes (v1-12 (the-as int (-> dst allocated-length))) + (set! (-> dst channel v1-12 parent) dst) ) - arg0 + dst ) ;; WARN: Using new Jak 2 rtype-of -(defun joint-control-remap! ((arg0 joint-control) (arg1 art-group) (arg2 art-group) (arg3 pair) (arg4 int) (arg5 string)) - (local-vars - (sv-16 int) - (sv-24 symbol) - (sv-32 int) - (sv-40 int) - (sv-48 joint-control-channel) - (sv-52 basic) - (sv-56 object) - (sv-60 basic) - (sv-64 art-joint-anim) - (sv-80 string) - ) - (set! sv-16 (+ (length (-> arg2 name)) 1)) - (set! sv-24 #t) - (set! sv-32 arg4) - (set! sv-40 2) - (while (and (< sv-40 (-> arg1 length)) (or (not (-> arg1 data sv-40)) (!= (-> arg1 data sv-40 type) art-joint-anim))) - (set! sv-40 (+ sv-40 1)) - ) - (dotimes (s2-1 (the-as int (+ (-> arg0 active-channels) (-> arg0 float-channels)))) - (set! sv-48 (-> arg0 channel s2-1)) - (set! sv-52 (the-as basic #f)) - (when (-> sv-48 frame-group) - (format (clear *temp-string*) "~S~G" arg5 (&+ (-> sv-48 frame-group name data) sv-16)) - (when (not (null? arg3)) - (set! sv-56 (nassoc *temp-string* arg3)) - (when sv-56 - (let* ((s1-1 sv-32) - (a0-8 sv-56) - (v1-36 (mod s1-1 (+ ((method-of-type (rtype-of a0-8) length) a0-8) -1))) - ) - (set! sv-60 (the-as basic (ref sv-56 (+ v1-36 1)))) - ) - (cond - ((= (-> sv-60 type) string) - (format (clear *temp-string*) "~S" sv-60) - ) - ((= (-> sv-60 type) function) - (set! sv-52 sv-60) - (let ((s1-3 format) - (s0-0 (clear *temp-string*)) - ) - (set! sv-80 "~S") - (let ((a2-4 ((the-as (function joint-control joint-control-channel int object) sv-52) arg0 sv-48 0))) - (s1-3 s0-0 sv-80 a2-4) - ) - ) - ) - ) - ) +(defun joint-control-remap! ((jc joint-control) + (dst-art-group art-group) + (parent-art-group art-group) + (remap-list pair) + (seed int) + (prefix string) + ) + (let ((sv-16 (+ (length (-> parent-art-group name)) 1)) + (sv-24 #t) ) - (set! sv-64 (get-art-by-name arg1 *temp-string* art-joint-anim)) - (cond - (sv-64 - (let* ((v1-46 (-> sv-48 frame-group)) - (f0-2 (+ (* (-> sv-48 frame-num) (-> v1-46 artist-step)) (-> v1-46 artist-base))) - ) - (set! (-> sv-48 frame-group) sv-64) - (set! (-> sv-48 frame-num) (/ (- f0-2 (-> sv-64 artist-base)) (-> sv-64 artist-step))) - ) - (set! (-> sv-48 frame-num) - (fmax 0.0 (fmin (-> sv-48 frame-num) (the float (+ (-> sv-64 frames num-frames) -1)))) - ) - (if sv-52 - ((the-as (function joint-control joint-control-channel int object) sv-52) arg0 sv-48 1) - ) + (let ((sv-32 seed) + (sv-40 2) ) - (else - (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> arg1 data sv-40))) - (set! (-> sv-48 frame-num) 0.0) - (set! sv-24 (the-as symbol #f)) + (while (and (< sv-40 (-> dst-art-group length)) + (or (not (-> dst-art-group data sv-40)) (!= (-> dst-art-group data sv-40 type) art-joint-anim)) + ) + (+! sv-40 1) + ) + (dotimes (s2-1 (the-as int (+ (-> jc active-channels) (-> jc float-channels)))) + (let ((sv-48 (-> jc channel s2-1)) + (sv-52 (the-as basic #f)) + ) + (when (-> sv-48 frame-group) + (format (clear *temp-string*) "~S~G" prefix (&+ (-> sv-48 frame-group name data) sv-16)) + (when (not (null? remap-list)) + (let ((sv-56 (nassoc *temp-string* remap-list))) + (when sv-56 + (let* ((a0-8 sv-56) + (v1-36 (mod sv-32 (+ ((method-of-type (rtype-of a0-8) length) a0-8) -1))) + (sv-60 (the-as basic (ref sv-56 (+ v1-36 1)))) + ) + (cond + ((= (-> sv-60 type) string) + (format (clear *temp-string*) "~S" sv-60) + ) + ((= (-> sv-60 type) function) + (set! sv-52 sv-60) + (format + (clear *temp-string*) + "~S" + ((the-as (function joint-control joint-control-channel int object) sv-52) jc sv-48 0) + ) + ) + ) + ) + ) + ) + ) + (let ((sv-64 (get-art-by-name dst-art-group *temp-string* art-joint-anim))) + (cond + (sv-64 + (let* ((v1-46 (-> sv-48 frame-group)) + (f0-2 (+ (* (-> sv-48 frame-num) (-> v1-46 artist-step)) (-> v1-46 artist-base))) + ) + (set! (-> sv-48 frame-group) sv-64) + (set! (-> sv-48 frame-num) (/ (- f0-2 (-> sv-64 artist-base)) (-> sv-64 artist-step))) + ) + (set! (-> sv-48 frame-num) + (fmax 0.0 (fmin (-> sv-48 frame-num) (the float (+ (-> sv-64 frames num-frames) -1)))) + ) + (if sv-52 + ((the-as (function joint-control joint-control-channel int object) sv-52) jc sv-48 1) + ) + ) + (else + (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> dst-art-group data sv-40))) + (set! (-> sv-48 frame-num) 0.0) + (set! sv-24 (the-as symbol #f)) + ) + ) + ) + ) ) ) ) + sv-24 ) - sv-24 ) ;; ERROR: Failed load: (set! vf2 (l.vf (the-as int a2-1))) at op 46 @@ -1464,34 +1464,34 @@ ) ;; WARN: Return type mismatch object vs matrix. -(defun matrix-from-joint-anim-frame ((arg0 joint-anim-compressed-control) (arg1 int) (arg2 int)) - (let ((v1-1 (the-as object (-> arg0 fixed data))) - (v0-0 (the-as object (-> arg0 data arg2 data))) +(defun matrix-from-joint-anim-frame ((jacc joint-anim-compressed-control) (joint-idx int) (frame-idx int)) + (let ((fixed-matrix (the-as object (-> jacc fixed data))) + (frame-matrix (the-as object (-> jacc data frame-idx data))) ) (cond - ((not (logtest? (-> arg0 fixed hdr matrix-bits) 1)) - (set! v1-1 (cond - ((zero? arg1) - (return (the-as matrix v1-1)) - v1-1 - ) - (else - (-> (the-as (inline-array vector) v1-1) 4) - ) - ) + ((not (logtest? (-> jacc fixed hdr matrix-bits) 1)) + (set! fixed-matrix (cond + ((zero? joint-idx) + (return (the-as matrix fixed-matrix)) + fixed-matrix + ) + (else + (-> (the-as (inline-array vector) fixed-matrix) 4) + ) + ) ) ) - ((zero? arg1) - (return (the-as matrix v0-0)) + ((zero? joint-idx) + (return (the-as matrix frame-matrix)) ) (else - (set! v0-0 (-> (the-as (inline-array vector) v0-0) 4)) + (set! frame-matrix (-> (the-as (inline-array vector) frame-matrix) 4)) ) ) - (if (not (logtest? (-> arg0 fixed hdr matrix-bits) 2)) - (return (the-as matrix v1-1)) + (if (not (logtest? (-> jacc fixed hdr matrix-bits) 2)) + (return (the-as matrix fixed-matrix)) ) - (the-as matrix v0-0) + (the-as matrix frame-matrix) ) ) @@ -1664,7 +1664,7 @@ (set! (-> gp-0 quad 2) a1-1) (set! (-> gp-0 trans quad) a2-1) ) - (vector-normalize! (the-as vector (-> gp-0 vector)) 1.0) + (vector-normalize! (-> gp-0 vector 0) 1.0) (vector-normalize! (-> gp-0 vector 1) 1.0) (vector-normalize! (-> gp-0 vector 2) 1.0) gp-0 @@ -1688,44 +1688,44 @@ ) ) -(defun cspace<-rot-yxy! ((arg0 cspace) (arg1 transform)) - (let ((s5-0 (-> arg0 bone transform))) - (matrix-rotate-yxy! s5-0 (-> arg1 rot)) - (scale-matrix! s5-0 (-> arg1 scale) s5-0) +(defun cspace<-rot-yxy! ((dst cspace) (src transform)) + (let ((s5-0 (-> dst bone transform))) + (matrix-rotate-yxy! s5-0 (-> src rot)) + (scale-matrix! s5-0 (-> src scale) s5-0) ) ) -(defun cspace<-transform-yxy! ((arg0 cspace) (arg1 transform)) - (let ((s4-0 (-> arg0 bone transform)) +(defun cspace<-transform-yxy! ((dst cspace) (src transform)) + (let ((s4-0 (-> dst bone transform)) (s5-0 (new 'stack-no-clear 'matrix)) (s3-0 (new 'stack-no-clear 'matrix)) ) (matrix-identity! s4-0) - (matrix-translate! s4-0 (-> arg1 trans)) - (matrix-rotate-yxy! s5-0 (-> arg1 rot)) + (matrix-translate! s4-0 (-> src trans)) + (matrix-rotate-yxy! s5-0 (-> src rot)) (matrix*! s3-0 s5-0 s4-0) - (scale-matrix! s4-0 (-> arg1 scale) s3-0) + (scale-matrix! s4-0 (-> src scale) s3-0) ) ) -(defun cspace<-transformq! ((arg0 cspace) (arg1 transformq)) - (matrix<-transformq! (-> arg0 bone transform) arg1) +(defun cspace<-transformq! ((dst cspace) (src transformq)) + (matrix<-transformq! (-> dst bone transform) src) ) -(defun cspace<-transformq+trans! ((arg0 cspace) (arg1 transformq) (arg2 vector)) - (matrix<-transformq+trans! (-> arg0 bone transform) arg1 arg2) +(defun cspace<-transformq+trans! ((dst cspace) (src transformq) (extra-trans vector)) + (matrix<-transformq+trans! (-> dst bone transform) src extra-trans) ) -(defun cspace<-transformq+world-trans! ((arg0 cspace) (arg1 transformq) (arg2 vector)) - (matrix<-transformq+world-trans! (-> arg0 bone transform) arg1 arg2) +(defun cspace<-transformq+world-trans! ((dst cspace) (src transformq) (extra-trans vector)) + (matrix<-transformq+world-trans! (-> dst bone transform) src extra-trans) ) -(defun cspace<-transformq+rot-offset! ((arg0 cspace) (arg1 transformq) (arg2 vector)) - (matrix<-transformq+rot-offset! (-> arg0 bone transform) arg1 arg2) +(defun cspace<-transformq+rot-offset! ((dst cspace) (src transformq) (extra-rot vector)) + (matrix<-transformq+rot-offset! (-> dst bone transform) src extra-rot) ) -(defun cspace-calc-total-matrix! ((arg0 cspace) (arg1 matrix)) - (matrix*! arg1 (-> arg0 bone transform) (-> *math-camera* camera-temp)) +(defun cspace-calc-total-matrix! ((csp cspace) (dst matrix)) + (matrix*! dst (-> csp bone transform) (-> *math-camera* camera-temp)) ) (defun cspace<-matrix-no-push-joint! ((arg0 cspace) (arg1 joint-control)) @@ -1816,16 +1816,13 @@ ) ) -(defun cspace<-parented-matrix-mirror! ((arg0 cspace) (arg1 matrix)) - (let ((gp-0 (matrix-mirror! - (new 'stack-no-clear 'matrix) - (the-as vector (-> arg0 param1)) - (the-as vector (-> arg0 param2)) - ) - ) +(defun cspace<-parented-matrix-mirror! ((dst cspace) (joint-mat matrix)) + (let ((gp-0 + (matrix-mirror! (new 'stack-no-clear 'matrix) (the-as vector (-> dst param1)) (the-as vector (-> dst param2))) + ) ) - (cspace<-parented-matrix-joint! arg0 arg1) - (matrix*! (-> arg0 bone transform) (-> arg0 bone transform) gp-0) + (cspace<-parented-matrix-joint! dst joint-mat) + (matrix*! (-> dst bone transform) (-> dst bone transform) gp-0) ) ) @@ -1908,9 +1905,9 @@ (def-mips2c cspace<-parented-transformq-joint! (function cspace transformq none)) -(defun cspace<-parented-transformq-joint-flip-z! ((arg0 cspace) (arg1 transformq)) - (cspace<-parented-transformq-joint! arg0 arg1) - (cspace<-matrix-joint-flip-z! arg0 (-> arg0 bone transform)) +(defun cspace<-parented-transformq-joint-flip-z! ((dst cspace) (joint-transformq transformq)) + (cspace<-parented-transformq-joint! dst joint-transformq) + (cspace<-matrix-joint-flip-z! dst (-> dst bone transform)) 0 (none) ) @@ -2049,25 +2046,10 @@ (def-mips2c calc-animation-from-spr (function joint-anim-frame int none)) - -(defun create-interpolated-joint-animation-frame ((output-frame joint-anim-frame) (arg1 int) (arg2 joint-control)) - (let ((start (get-cpu-clock))) - (cond - (*use-new-decompressor* - - (new-joint-decompressor output-frame arg1 arg2) - - ) - (else - (flatten-joint-control-to-spr arg2) - (make-joint-jump-tables) - (calc-animation-from-spr output-frame arg1) - ) - ) - (+! (-> *new-joint-decompressor-stats* total-time) - (the int (* 1000000. (cpu-ticks-to-seconds (- (get-cpu-clock) start)))) - ) - ) +(defun create-interpolated-joint-animation-frame ((dst joint-anim-frame) (num-joints int) (jc joint-control)) + (flatten-joint-control-to-spr jc) + (make-joint-jump-tables) + (calc-animation-from-spr dst num-joints) 0 ) diff --git a/goal_src/jak2/engine/camera/cam-combiner.gc b/goal_src/jak2/engine/camera/cam-combiner.gc index be765f0979..92464b63a0 100644 --- a/goal_src/jak2/engine/camera/cam-combiner.gc +++ b/goal_src/jak2/engine/camera/cam-combiner.gc @@ -8,9 +8,8 @@ ;; DECOMP BEGINS (defbehavior cam-helper-temp camera-combiner ((arg0 (pointer camera-slave)) (arg1 (pointer camera-slave)) (arg2 float)) - (local-vars (sv-144 cam-rotation-tracker)) - (set! sv-144 (-> arg0 0 tracking)) - (let ((s1-0 (-> arg0 0 trans)) + (let ((sv-144 (-> arg0 0 tracking)) + (s1-0 (-> arg0 0 trans)) (gp-0 (-> arg1 0 tracking)) (s0-0 (-> arg1 0 trans)) ) @@ -50,14 +49,10 @@ (let ((s4-0 (new-stack-vector0))) 0.0 (let ((s3-0 (new-stack-matrix0))) - (vector-! - (the-as vector (-> s2-0 vector)) - (the-as vector (-> sv-144 inv-mat)) - (the-as vector (-> gp-0 inv-mat)) - ) + (vector-! (-> s2-0 vector 0) (the-as vector (-> sv-144 inv-mat)) (the-as vector (-> gp-0 inv-mat))) (vector-! (-> s2-0 vector 1) (-> sv-144 inv-mat vector 1) (-> gp-0 inv-mat vector 1)) (vector-! (-> s2-0 vector 2) (-> sv-144 inv-mat vector 2) (-> gp-0 inv-mat vector 2)) - (let ((f0-6 (vector-length (the-as vector (-> s2-0 vector)))) + (let ((f0-6 (vector-length (-> s2-0 vector 0))) (f1-0 (vector-length (-> s2-0 vector 1))) (f2-0 (vector-length (-> s2-0 vector 2))) ) @@ -66,10 +61,10 @@ (vector-cross! s4-0 (-> s2-0 vector 1) (-> s2-0 vector 2)) ) ((and (< f1-0 f0-6) (< f1-0 f2-0)) - (vector-cross! s4-0 (the-as vector (-> s2-0 vector)) (-> s2-0 vector 2)) + (vector-cross! s4-0 (-> s2-0 vector 0) (-> s2-0 vector 2)) ) (else - (vector-cross! s4-0 (the-as vector (-> s2-0 vector)) (-> s2-0 vector 1)) + (vector-cross! s4-0 (-> s2-0 vector 0) (-> s2-0 vector 1)) ) ) ) @@ -80,38 +75,38 @@ ) (cond ((and (< f0-9 f1-3) (< f0-9 f2-3)) - (vector-flatten! (the-as vector (-> s2-0 vector)) (the-as vector (-> sv-144 inv-mat)) s4-0) + (vector-flatten! (-> s2-0 vector 0) (the-as vector (-> sv-144 inv-mat)) s4-0) (vector-flatten! (-> s2-0 vector 1) (the-as vector (-> gp-0 inv-mat)) s4-0) ) ((< f1-3 f2-3) - (vector-flatten! (the-as vector (-> s2-0 vector)) (-> sv-144 inv-mat vector 1) s4-0) + (vector-flatten! (-> s2-0 vector 0) (-> sv-144 inv-mat vector 1) s4-0) (vector-flatten! (-> s2-0 vector 1) (-> gp-0 inv-mat vector 1) s4-0) ) (else - (vector-flatten! (the-as vector (-> s2-0 vector)) (-> sv-144 inv-mat vector 2) s4-0) + (vector-flatten! (-> s2-0 vector 0) (-> sv-144 inv-mat vector 2) s4-0) (vector-flatten! (-> s2-0 vector 1) (-> gp-0 inv-mat vector 2) s4-0) ) ) ) - (vector-normalize! (the-as vector (-> s2-0 vector)) 1.0) + (vector-normalize! (-> s2-0 vector 0) 1.0) (vector-normalize! (-> s2-0 vector 1) 1.0) - (vector-cross! (-> s2-0 vector 2) (the-as vector (-> s2-0 vector)) (-> s2-0 vector 1)) + (vector-cross! (-> s2-0 vector 2) (-> s2-0 vector 0) (-> s2-0 vector 1)) (if (< (vector-dot (-> s2-0 vector 2) s4-0) 0.0) (vector-negate! s4-0 s4-0) ) - (let ((f30-0 (acos (vector-dot (the-as vector (-> s2-0 vector)) (-> s2-0 vector 1))))) + (let ((f30-0 (acos (vector-dot (-> s2-0 vector 0) (-> s2-0 vector 1))))) (cond ((logtest? (-> *camera* master-options) (cam-master-options-u32 SET_COMBINER_AXIS)) (logclear! (-> *camera* master-options) (cam-master-options-u32 SET_COMBINER_AXIS FLIP_COMBINER)) (when (and (< 8192.0 f30-0) (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) - (vector-! (the-as vector (-> s2-0 vector)) (-> *camera* tpos-curr) s1-0) + (vector-! (-> s2-0 vector 0) (-> *camera* tpos-curr) s1-0) (vector-! (-> s2-0 vector 1) s0-0 s1-0) - (vector-flatten! (the-as vector (-> s2-0 vector)) (the-as vector (-> s2-0 vector)) (-> *camera* local-down)) + (vector-flatten! (-> s2-0 vector 0) (-> s2-0 vector 0) (-> *camera* local-down)) (vector-flatten! (-> s2-0 vector 1) (-> s2-0 vector 1) (-> *camera* local-down)) - (when (and (< 4096.0 (vector-normalize-ret-len! (the-as vector (-> s2-0 vector)) 1.0)) + (when (and (< 4096.0 (vector-normalize-ret-len! (-> s2-0 vector 0) 1.0)) (< 4096.0 (vector-normalize-ret-len! (-> s2-0 vector 1) 1.0)) ) - (vector-cross! (-> s2-0 vector 2) (-> s2-0 vector 1) (the-as vector (-> s2-0 vector))) + (vector-cross! (-> s2-0 vector 2) (-> s2-0 vector 1) (-> s2-0 vector 0)) (when (< (vector-dot (-> s2-0 vector 2) s4-0) -0.01) ) ) @@ -130,7 +125,7 @@ (matrix-axis-sin-cos! s3-0 s4-0 (sin f30-1) (cos f30-1)) ) ) - (matrix*! (-> self inv-camera-rot) (the-as matrix gp-0) s3-0) + (matrix*! (-> self inv-camera-rot) (-> gp-0 inv-mat) s3-0) ) ) ) diff --git a/goal_src/jak2/engine/camera/cam-layout.gc b/goal_src/jak2/engine/camera/cam-layout.gc index c8d572f5a8..e6ea1a9c8c 100644 --- a/goal_src/jak2/engine/camera/cam-layout.gc +++ b/goal_src/jak2/engine/camera/cam-layout.gc @@ -157,35 +157,21 @@ ;; WARN: new jak 2 until loop case, check carefully (defbehavior cam-layout-entity-volume-info-create cam-layout ((arg0 entity-camera) (arg1 symbol)) - (local-vars - (sv-16 res-tag) - (sv-160 vector) - (sv-164 number) - (sv-168 int) - (sv-176 vector) - (sv-192 vector) - (sv-208 vector) - (sv-224 vector) - (sv-240 vector) - (sv-256 int) - (sv-272 int) - (sv-288 int) - ) (let ((s4-0 0)) (until #f - (set! sv-16 (new 'static 'res-tag)) - (let ((s3-0 (the-as (inline-array vector) ((method-of-type res-lump get-property-data) - arg0 - arg1 - 'exact - (the float s4-0) - (the-as pointer #f) - (& sv-16) - *res-static-buf* - ) - ) - ) - ) + (let* ((sv-16 (new 'static 'res-tag)) + (s3-0 (the-as (inline-array vector) ((method-of-type res-lump get-property-data) + arg0 + arg1 + 'exact + (the float s4-0) + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) (cond (s3-0 (when (>= *volume-descriptor-current* 100) @@ -201,121 +187,137 @@ (set! *volume-descriptor-current* (+ *volume-descriptor-current* 1)) (+! (-> self num-volumes) 1) (dotimes (s1-0 (the-as int (-> sv-16 elt-count))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (set! (-> sv-192 quad) (the-as uint128 0)) - (set! sv-208 (new 'stack-no-clear 'vector)) - (set! (-> sv-208 quad) (the-as uint128 0)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (set! (-> sv-224 quad) (the-as uint128 0)) - (set! sv-240 (new 'stack-no-clear 'vector)) - (set! (-> sv-240 quad) (the-as uint128 0)) - 0.0 - 0.0 - 0.0 - (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) - (let ((s0-0 (new-stack-vector0))) - (set! sv-256 0) - (set! sv-272 0) - (while (< sv-272 (the-as int (-> sv-16 elt-count))) - (when (!= s1-0 sv-272) - (vector-float*! sv-192 (-> s3-0 sv-272) (-> s3-0 sv-272 w)) - (vector-cross! sv-208 (-> s3-0 sv-272) (-> s3-0 s1-0)) - (vector-normalize! sv-208 1.0) - (vector-cross! sv-224 sv-208 (-> s3-0 sv-272)) - (vector-normalize! sv-224 1.0) - (let ((f0-6 (cam-layout-intersect-dist (-> s3-0 s1-0) sv-192 sv-224))) - (when (!= f0-6 409600000.0) - (vector+float*! sv-240 sv-192 sv-224 f0-6) - (set! sv-160 (new-stack-vector0)) - (set! sv-164 0.0) - (set! sv-168 0) - (set! sv-176 (new-stack-vector0)) - (set! (-> sv-160 quad) (-> sv-240 quad)) - (set! sv-288 0) - (while (< sv-288 (the-as int (-> sv-16 elt-count))) - (when (and (!= sv-288 s1-0) (!= sv-288 sv-272)) - (let ((f0-8 (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208))) - (cond - ((= f0-8 409600000.0) - ) - ((zero? sv-168) - (vector+float*! sv-160 sv-160 sv-208 f0-8) - (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) - (set! sv-164 8192000.0) - (set! sv-168 1) - ) - ((begin (vector-float*! sv-240 sv-208 f0-8) (>= (vector-dot sv-240 sv-176) 0.0)) - ) - ((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0) - (when (< (fabs f0-8) (fabs (the-as float sv-164))) - (set! sv-164 f0-8) - (set! sv-168 (+ sv-168 1)) - ) - ) - (else - (vector+float*! sv-160 sv-160 sv-208 f0-8) - (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) - (set! sv-168 (+ sv-168 1)) - (if (< (fabs f0-8) (fabs (the-as float sv-164))) - (set! sv-164 (- (the-as float sv-164) f0-8)) - (set! sv-164 0.0) + (let ((sv-192 (new 'stack-no-clear 'vector))) + (set! (-> sv-192 quad) (the-as uint128 0)) + (let ((sv-208 (new 'stack-no-clear 'vector))) + (set! (-> sv-208 quad) (the-as uint128 0)) + (let ((sv-224 (new 'stack-no-clear 'vector))) + (set! (-> sv-224 quad) (the-as uint128 0)) + (let ((sv-240 (new 'stack-no-clear 'vector))) + (set! (-> sv-240 quad) (the-as uint128 0)) + 0.0 + 0.0 + 0.0 + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (let ((s0-0 (new-stack-vector0)) + (sv-256 0) + ) + (let ((sv-272 0)) + (while (< sv-272 (the-as int (-> sv-16 elt-count))) + (when (!= s1-0 sv-272) + (vector-float*! sv-192 (-> s3-0 sv-272) (-> s3-0 sv-272 w)) + (vector-cross! sv-208 (-> s3-0 sv-272) (-> s3-0 s1-0)) + (vector-normalize! sv-208 1.0) + (vector-cross! sv-224 sv-208 (-> s3-0 sv-272)) + (vector-normalize! sv-224 1.0) + (let ((f0-6 (cam-layout-intersect-dist (-> s3-0 s1-0) sv-192 sv-224))) + (when (!= f0-6 409600000.0) + (vector+float*! sv-240 sv-192 sv-224 f0-6) + (let ((sv-160 (new-stack-vector0)) + (sv-164 0.0) + (sv-168 0) + ) + (let ((sv-176 (new-stack-vector0))) + (set! (-> sv-160 quad) (-> sv-240 quad)) + (let ((sv-288 0)) + (while (< sv-288 (the-as int (-> sv-16 elt-count))) + (when (and (!= sv-288 s1-0) (!= sv-288 sv-272)) + (let ((f0-8 (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208))) + (cond + ((= f0-8 409600000.0) + ) + ((zero? sv-168) + (vector+float*! sv-160 sv-160 sv-208 f0-8) + (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) + (set! sv-164 8192000.0) + (set! sv-168 1) + ) + ((begin (vector-float*! sv-240 sv-208 f0-8) (>= (vector-dot sv-240 sv-176) 0.0)) + ) + ((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0) + (when (< (fabs f0-8) (fabs (the-as float sv-164))) + (set! sv-164 f0-8) + (+! sv-168 1) + ) + ) + (else + (vector+float*! sv-160 sv-160 sv-208 f0-8) + (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) + (+! sv-168 1) + (set! sv-164 (cond + ((< (fabs f0-8) (fabs (the-as float sv-164))) + (set! sv-164 (- (the-as float sv-164) f0-8)) + sv-164 + ) + (else + 0.0 + ) + ) + ) + ) + ) + ) + ) + (+! sv-288 1) + ) + ) ) + (cond + ((zero? sv-168) + ) + ((= (the-as float sv-164) 0.0) + ) + (else + (dotimes (v1-91 (the-as int (-> sv-16 elt-count))) + (when (and (!= v1-91 s1-0) (!= v1-91 sv-272)) + (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-91)) (-> s3-0 v1-91 w))) + (goto cfg-47) + ) + ) + ) + (vector+float*! sv-240 sv-160 sv-208 (the-as float sv-164)) + (cond + ((>= *volume-point-current* 999) + (format 0 "ERROR : camera editing out of volume points~%") + ) + (else + (set! (-> *volume-point* data *volume-point-current* quad) (-> sv-160 quad)) + (set! (-> *volume-point* data (+ *volume-point-current* 1) quad) (-> sv-240 quad)) + (set! *volume-point-current* (+ *volume-point-current* 2)) + (+! (-> s2-0 point-count) 2) + ) + ) + (vector+! s0-0 s0-0 sv-160) + (vector+! s0-0 s0-0 sv-240) + (+! sv-256 2) + sv-256 + ) + ) + ) ) ) ) + (label cfg-47) + (+! sv-272 1) ) - (set! sv-288 (+ sv-288 1)) ) - (cond - ((zero? sv-168) - ) - ((= (the-as float sv-164) 0.0) - ) - (else - (dotimes (v1-91 (the-as int (-> sv-16 elt-count))) - (when (and (!= v1-91 s1-0) (!= v1-91 sv-272)) - (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-91)) (-> s3-0 v1-91 w))) - (goto cfg-47) - ) - ) + (when (nonzero? sv-256) + (vector-float*! s0-0 s0-0 (/ 1.0 (the float sv-256))) + (cond + ((>= *volume-normal-current* 599) + (format 0 "ERROR : camera editing out of volume normals~%") + ) + (else + (set! (-> *volume-normal* data *volume-normal-current* quad) (-> s0-0 quad)) + (set! (-> *volume-normal* data (+ *volume-normal-current* 1) quad) (-> s3-0 s1-0 quad)) + (set! *volume-normal-current* (+ *volume-normal-current* 2)) + (set! (-> s2-0 normal-count) (+ (-> s2-0 normal-count) 2)) ) - (vector+float*! sv-240 sv-160 sv-208 (the-as float sv-164)) - (cond - ((>= *volume-point-current* 999) - (format 0 "ERROR : camera editing out of volume points~%") - ) - (else - (set! (-> *volume-point* data *volume-point-current* quad) (-> sv-160 quad)) - (set! (-> *volume-point* data (+ *volume-point-current* 1) quad) (-> sv-240 quad)) - (set! *volume-point-current* (+ *volume-point-current* 2)) - (+! (-> s2-0 point-count) 2) - ) - ) - (vector+! s0-0 s0-0 sv-160) - (vector+! s0-0 s0-0 sv-240) - (set! sv-256 (+ sv-256 2)) - sv-256 ) ) ) ) ) - (label cfg-47) - (set! sv-272 (+ sv-272 1)) - ) - (when (nonzero? sv-256) - (vector-float*! s0-0 s0-0 (/ 1.0 (the float sv-256))) - (cond - ((>= *volume-normal-current* 599) - (format 0 "ERROR : camera editing out of volume normals~%") - ) - (else - (set! (-> *volume-normal* data *volume-normal-current* quad) (-> s0-0 quad)) - (set! (-> *volume-normal* data (+ *volume-normal-current* 1) quad) (-> s3-0 s1-0 quad)) - (set! *volume-normal-current* (+ *volume-normal-current* 2)) - (set! (-> s2-0 normal-count) (+ (-> s2-0 normal-count) 2)) - ) - ) ) ) ) @@ -791,7 +793,7 @@ ) (defbehavior clmf-pos-rot cam-layout ((arg0 symbol) (arg1 symbol)) - (local-vars (s2-0 structure) (s3-1 vector) (sv-192 matrix)) + (local-vars (s2-0 structure) (s3-1 vector)) (cam-layout-print 16 *camera-layout-message-ypos* "x/z pos: left stick, down: l1, up: r1") (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 14)) (when (and arg1 (nonzero? arg1)) @@ -861,35 +863,35 @@ ) ) ) - (let ((s1-1 (new 'stack-no-clear 'matrix))) - (set! sv-192 (new 'stack-no-clear 'matrix)) - (let ((s0-1 (new 'stack-no-clear 'vector))) - (if (not s3-1) - (return #f) - ) - (clmf-input s5-0 s4-0 0) - (vector+float*! s3-1 s3-1 s4-0 409.6) - (cond - ((not arg1) - (the-as quaternion #f) - ) - ((zero? arg1) - (the-as quaternion #f) - ) - (else - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) sv-192) - (vector-float*! s5-0 s5-0 100.0) - (matrix-rotate-x! s1-1 (- (-> s5-0 x))) - (matrix*! sv-192 s1-1 sv-192) - (matrix-rotate-y! s1-1 (-> s5-0 y)) - (matrix*! sv-192 sv-192 s1-1) - (matrix-rotate-z! s1-1 (- (-> s5-0 z))) - (matrix*! sv-192 s1-1 sv-192) - (matrix->quaternion (the-as quaternion s0-1) sv-192) - (quaternion-inverse! (the-as quaternion s2-0) (the-as quaternion (-> self cam-entity connect))) - (quaternion*! (the-as quaternion s2-0) (the-as quaternion s0-1) (the-as quaternion s2-0)) - (quaternion-normalize! (the-as quaternion s2-0)) - ) + (let ((s1-1 (new 'stack-no-clear 'matrix)) + (sv-192 (new 'stack-no-clear 'matrix)) + (s0-1 (new 'stack-no-clear 'vector)) + ) + (if (not s3-1) + (return #f) + ) + (clmf-input s5-0 s4-0 0) + (vector+float*! s3-1 s3-1 s4-0 409.6) + (cond + ((not arg1) + (the-as quaternion #f) + ) + ((zero? arg1) + (the-as quaternion #f) + ) + (else + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) sv-192) + (vector-float*! s5-0 s5-0 100.0) + (matrix-rotate-x! s1-1 (- (-> s5-0 x))) + (matrix*! sv-192 s1-1 sv-192) + (matrix-rotate-y! s1-1 (-> s5-0 y)) + (matrix*! sv-192 sv-192 s1-1) + (matrix-rotate-z! s1-1 (- (-> s5-0 z))) + (matrix*! sv-192 s1-1 sv-192) + (matrix->quaternion (the-as quaternion s0-1) sv-192) + (quaternion-inverse! (the-as quaternion s2-0) (the-as quaternion (-> self cam-entity connect))) + (quaternion*! (the-as quaternion s2-0) (the-as quaternion s0-1) (the-as quaternion s2-0)) + (quaternion-normalize! (the-as quaternion s2-0)) ) ) ) @@ -2253,10 +2255,11 @@ ) (defbehavior clmf-cam-string cam-layout ((arg0 string) (arg1 symbol)) - (local-vars (r0-0 uint128) (v1-5 uint128) (sv-16 int)) + (local-vars (r0-0 uint128) (v1-5 uint128)) (format arg0 ":") - (set! sv-16 0) - (let ((s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (the-as (pointer res-tag) (& sv-16))))) + (let* ((sv-16 0) + (s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (the-as (pointer res-tag) (& sv-16)))) + ) (when s5-1 (let ((s4-0 0)) (while (begin diff --git a/goal_src/jak2/engine/camera/cam-master.gc b/goal_src/jak2/engine/camera/cam-master.gc index 63edb3655c..2312e4b097 100644 --- a/goal_src/jak2/engine/camera/cam-master.gc +++ b/goal_src/jak2/engine/camera/cam-master.gc @@ -343,16 +343,7 @@ ) (defbehavior master-choose-entity camera-master ((arg0 cam-setting-data)) - (local-vars - (v1-22 symbol) - (sv-96 res-tag) - (sv-112 process) - (sv-128 (pointer process)) - (sv-144 int) - (sv-160 string) - (sv-176 string) - (sv-192 uint) - ) + (local-vars (v1-22 symbol) (sv-128 (pointer process))) (let ((s5-0 (entity-by-name (-> arg0 entity-name)))) (set! (-> arg0 real-entity-name) #f) (when s5-0 @@ -369,8 +360,9 @@ (format 0 "ERROR : camera entity '~S' didn't produce a state~%" (res-lump-struct s5-0 'name structure)) ) ) - (set! sv-96 (new 'static 'res-tag)) - (let ((s4-1 (res-lump-data s5-0 'alternates pointer :tag-ptr (& sv-96)))) + (let* ((sv-96 (new 'static 'res-tag)) + (s4-1 (res-lump-data s5-0 'alternates pointer :tag-ptr (& sv-96))) + ) (when s4-1 (let* ((s1-1 (get-process *camera-dead-pool* camera-slave #x4000)) (s3-1 (when s1-1 @@ -398,22 +390,21 @@ (let ((s1-2 (cam-state-from-entity s0-0))) (cond (s1-2 - (set! sv-112 (get-process *camera-dead-pool* camera-slave #x4000)) - (set! v1-22 (when sv-112 - (set! sv-128 (the-as (pointer process) v1-22)) - (let ((t9-14 (method-of-type camera-slave activate))) - (t9-14 - (the-as camera-slave sv-112) - *camera* - (symbol->string (-> camera-slave symbol)) - (the-as pointer #x70004000) - ) + (let ((sv-112 (get-process *camera-dead-pool* camera-slave #x4000))) + (set! v1-22 (when sv-112 + (set! sv-128 (the-as (pointer process) v1-22)) + ((method-of-type camera-slave activate) + (the-as camera-slave sv-112) + *camera* + (symbol->string (-> camera-slave symbol)) + (the-as pointer #x70004000) + ) + (run-now-in-process sv-112 cam-slave-init s1-2 s0-0) + (set! sv-128 (-> sv-112 ppointer)) + v1-22 ) - (run-now-in-process sv-112 cam-slave-init s1-2 s0-0) - (set! sv-128 (-> sv-112 ppointer)) - v1-22 - ) - ) + ) + ) (cond (sv-128 (setup-slave-for-hopefull (the-as camera-slave (ppointer->process sv-128))) @@ -440,26 +431,21 @@ ) ) (else - (let ((s1-5 format)) - (set! sv-144 0) - (set! sv-160 "ERROR : alternate camera region '~S' didn't produce a state~%") - (let ((a2-14 (res-lump-struct s0-0 'name structure))) - (s1-5 sv-144 sv-160 a2-14) - ) + (format + 0 + "ERROR : alternate camera region '~S' didn't produce a state~%" + (res-lump-struct s0-0 'name structure) ) ) ) ) ) (else - (let ((s1-7 format) - (s0-1 0) - ) - (set! sv-176 "ERROR : alternate '~S' not found for '~S'~%") - (set! sv-192 (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))) - (let ((a3-8 (res-lump-struct s5-0 'name structure))) - (s1-7 s0-1 sv-176 sv-192 a3-8) - ) + (format + 0 + "ERROR : alternate '~S' not found for '~S'~%" + (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4)))) + (res-lump-struct s5-0 'name structure) ) ) ) @@ -479,13 +465,7 @@ #f ) ((-> arg0 mode-name) - (let ((s5-1 (-> arg0 mode-name value))) - (set! (-> arg0 cam-mode) (the-as symbol (if (type? s5-1 state) - s5-1 - ) - ) - ) - ) + (set! (-> arg0 cam-mode) (the-as symbol (the-as object (as-type (-> arg0 mode-name value) state)))) (set! (-> arg0 real-entity-name) #f) #f ) diff --git a/goal_src/jak2/engine/camera/cam-states-dbg.gc b/goal_src/jak2/engine/camera/cam-states-dbg.gc index 9d741277e9..058a784f5b 100644 --- a/goal_src/jak2/engine/camera/cam-states-dbg.gc +++ b/goal_src/jak2/engine/camera/cam-states-dbg.gc @@ -67,14 +67,14 @@ (matrix-axis-angle! s3-0 (-> *camera* local-down) (- (-> s5-0 y))) (vector-matrix*! s4-0 s4-0 s3-0) ) - (forward-down->inv-matrix (the-as matrix (-> self tracking)) s4-0 (-> *camera* local-down)) + (forward-down->inv-matrix (-> self tracking inv-mat) s4-0 (-> *camera* local-down)) ) (set! (-> self pivot-rad) (- (-> self pivot-rad) (-> gp-0 z))) (if (< (-> self pivot-rad) 4096.0) (set! (-> self pivot-rad) 4096.0) ) (set-vector! gp-0 0.0 0.0 (- (-> self pivot-rad)) 1.0) - (vector-matrix*! (-> self trans) gp-0 (the-as matrix (-> self tracking))) + (vector-matrix*! (-> self trans) gp-0 (-> self tracking inv-mat)) ) ) (suspend) @@ -95,7 +95,7 @@ (defun cam-mouse-input ((arg0 vector) (arg1 vector)) (let ((v1-0 (new 'stack-no-clear 'vector))) - (vector-! v1-0 (the-as vector (-> *mouse* pos)) (-> *mouse* pos 1)) + (vector-! v1-0 (-> *mouse* pos 0) (-> *mouse* pos 1)) (cond ((mouse-hold? left) (let ((a0-7 (new 'stack-no-clear 'vector))) @@ -106,12 +106,7 @@ (#f (let* ((f28-0 (* (/ f30-0 100) (-> v1-0 x))) (f26-0 (* (/ f30-0 100) (-> v1-0 y))) - (f0-5 f28-0) - (f0-7 (* f0-5 f0-5)) - (f1-2 f26-0) - (f0-8 (+ f0-7 (* f1-2 f1-2))) - (f1-5 f30-0) - (f22-0 (- (sqrtf (+ f0-8 (* f1-5 f1-5))) f30-0)) + (f22-0 (- (sqrtf (+ (square f28-0) (square f26-0) (square f30-0))) f30-0)) (f24-0 (atan f26-0 f30-0)) (f0-12 (atan (- f28-0) f30-0)) ) @@ -287,13 +282,13 @@ ((cpad-hold? arg3 r2) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 r1) - (+! (-> arg1 y) (+ (* 0.2 (-> *CAM_FREE-bank* speed)) (analog-input - (the-as int (-> *cpad-list* cpads arg3 abutton (abutton-idx r1))) ;; og:preserve-this abutton indexing - 0.0 - 32.0 - 230.0 - (* 0.2 (-> *CAM_FREE-bank* speed)) - ) + (+! (-> arg1 y) (+ (/ (-> *CAM_FREE-bank* speed) 5) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton (abutton-idx r1))) ;; og:preserve-this abutton indexing + 0.0 + 32.0 + 230.0 + (/ (-> *CAM_FREE-bank* speed) 5) + ) ) ) ) @@ -301,13 +296,13 @@ (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 l1) (set! (-> arg1 y) - (- (-> arg1 y) (+ (* 0.2 (-> *CAM_FREE-bank* speed)) (analog-input - (the-as int (-> *cpad-list* cpads arg3 abutton (abutton-idx l1))) ;; og:preserve-this abutton indexing - 0.0 - 32.0 - 230.0 - (* 0.2 (-> *CAM_FREE-bank* speed)) - ) + (- (-> arg1 y) (+ (/ (-> *CAM_FREE-bank* speed) 5) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton (abutton-idx l1))) ;; og:preserve-this abutton indexing + 0.0 + 32.0 + 230.0 + (/ (-> *CAM_FREE-bank* speed) 5) + ) ) ) ) @@ -417,7 +412,7 @@ (matrix*! arg0 arg0 (-> s3-0 tm)) ) ) - (matrix-axis-angle! (-> s3-0 tm) (the-as vector (-> arg0 vector)) (- (-> s3-0 rv x))) + (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 0) (- (-> s3-0 rv x))) (matrix*! arg0 arg0 (-> s3-0 tm)) (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 2) (- (-> s3-0 rv z))) (matrix*! arg0 arg0 (-> s3-0 tm)) @@ -451,7 +446,7 @@ (set! a2-0 (the-as vector #f)) ) (cam-free-floating-move - (the-as matrix (-> self tracking)) + (-> self tracking inv-mat) (-> self trans) a2-0 (the-as int (-> *CAMERA-bank* joypad)) diff --git a/goal_src/jak2/engine/camera/cam-states.gc b/goal_src/jak2/engine/camera/cam-states.gc index 9b5ab1dbd8..972f325b04 100644 --- a/goal_src/jak2/engine/camera/cam-states.gc +++ b/goal_src/jak2/engine/camera/cam-states.gc @@ -63,7 +63,7 @@ (cam-curve-pos (-> self trans) gp-0 (the-as curve #f) #f) (when (!= (-> gp-0 w) 0.0) (vector-normalize! gp-0 1.0) - (forward-down->inv-matrix (the-as matrix (-> self tracking)) gp-0 (-> *camera* local-down)) + (forward-down->inv-matrix (-> self tracking inv-mat) gp-0 (-> *camera* local-down)) ) ) ) @@ -90,7 +90,7 @@ ) ((-> self cam-entity) (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) (-> self trans) 'trans) - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (-> self tracking inv-mat)) (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) (cam-curve-setup (-> self trans)) ((-> cam-fixed enter)) @@ -163,7 +163,7 @@ ) (vector-reset! (-> self tracking inv-mat trans)) (let ((gp-0 (new 'stack-no-clear 'vector))) - (vector-matrix*! gp-0 (-> *camera* settings pov-offset) (the-as matrix (-> self tracking))) + (vector-matrix*! gp-0 (-> *camera* settings pov-offset) (-> self tracking inv-mat)) (vector+! (-> self trans) (-> self trans) gp-0) ) ) @@ -252,7 +252,7 @@ (cond ((and (< (vector-vector-distance s2-0 gp-0) 40960.0) (< (cos 3640.889) (vector-dot s5-0 s3-0))) (set! (-> self trans quad) (-> s2-0 quad)) - (vector-negate! (the-as vector (-> self tracking)) (the-as vector (-> s0-0 vector))) + (vector-negate! (the-as vector (-> self tracking)) (-> s0-0 vector 0)) (set! (-> (the-as vector (-> self tracking inv-mat vector 1)) quad) (-> s0-0 vector 1 quad)) (vector-negate! (-> self tracking inv-mat vector 2) (-> s0-0 vector 2)) (set! (-> self fov) (* 2.0 (atan (/ 12.700255 (* 20.3 (-> s1-0 x))) 1.0))) @@ -419,7 +419,7 @@ (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) (if (logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (-> self tracking inv-mat)) (set! (-> self tracking tilt-adjust target) (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) ) @@ -509,6 +509,7 @@ -1.0 ) ) + ;; og:preserve-this (f0-0 (analog-input-vertical-first (the-as int (+ (-> *cpad-list* cpads 0 righty) -256 (-> *cpad-list* cpads 0 lefty))) 0.0 @@ -552,23 +553,23 @@ ) ) (matrix-axis-angle! s5-0 (-> *camera* local-down) (-> s4-0 y)) - (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) + (matrix*! (-> self tracking inv-mat) (-> self tracking inv-mat) s5-0) (when (not (logtest? (-> self options) (cam-slave-options-u32 ALLOW_Z_ROT))) (if (< (vector-dot (-> self tracking inv-mat vector 1) (-> *camera* local-down)) 0.0) (forward-down->inv-matrix - (the-as matrix (-> self tracking)) + (-> self tracking inv-mat) (-> self tracking inv-mat vector 2) (-> *camera* local-down) ) (forward-down->inv-matrix - (the-as matrix (-> self tracking)) + (-> self tracking inv-mat) (-> self tracking inv-mat vector 2) (vector-negate! (new-stack-vector0) (-> *camera* local-down)) ) ) ) (matrix-axis-angle! s5-0 (the-as vector (-> self tracking)) (- (-> s4-0 x))) - (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) + (matrix*! (-> self tracking inv-mat) (-> self tracking inv-mat) s5-0) ) (when (not (logtest? (-> self options) (cam-slave-options-u32 ALLOW_Z_ROT))) (let ((f30-1 (vector-dot (-> *camera* local-down) (-> self tracking inv-mat vector 2)))) @@ -629,7 +630,7 @@ (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) (if (logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (-> self tracking inv-mat)) (set! (-> self tracking tilt-adjust target) (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) ) @@ -1117,7 +1118,7 @@ ((logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) (set! (-> self blend-from-type) (the-as uint 0)) (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (-> self tracking inv-mat)) ) (else (set! (-> self blend-from-type) (the-as uint 2)) @@ -1401,86 +1402,83 @@ (arg5 vector) (arg6 float) ) - (local-vars (sv-128 float) (sv-144 vector) (sv-160 vector) (sv-176 vector) (sv-192 vector) (sv-208 int)) - (set! sv-128 arg3) - (let ((gp-0 arg4)) - (set! sv-144 arg5) - (let ((s4-0 arg6)) - (set! sv-160 (new 'stack-no-clear 'vector)) - (set! sv-176 (new 'stack-no-clear 'vector)) - (let ((s5-0 (new 'stack-no-clear 'matrix))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((f30-0 0.0) - (s0-0 #f) - ) - (set! sv-208 0) - (while (< sv-208 4) - (cond - ((= sv-208 3) - (vector-! sv-160 sv-144 (-> self string-trans)) - (set! (-> s5-0 vector sv-208 z) 0.0) - ) - (else - (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) - (set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down))) - (vector-! sv-160 (-> arg0 0 vertex sv-208) (-> self string-trans)) - ) - ) - (vector-flatten! sv-160 sv-160 (-> *camera* local-down)) - (vector-cross! sv-176 sv-160 arg2) - (let ((f28-0 (vector-dot sv-176 (-> *camera* local-down)))) - (cond - ((< (* f28-0 f30-0) 0.0) - (set! s0-0 #t) - ) - ((!= f28-0 0.0) - (set! f30-0 f28-0) - ) - ) - (set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2)) - (cond - ((= sv-208 3) - (vector-! sv-192 sv-144 (-> self string-trans)) - (vector-flatten! sv-192 sv-192 arg1) - ) - (else - (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)) - ) - ) - (if (< f28-0 0.0) - (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) - (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)) - ) - ) - (set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x))) - (set! sv-208 (+ sv-208 1)) - ) - (cond - ((and s0-0 (!= (the-as int s4-0) -859915232)) - (dotimes (s4-1 4) - (dist-info-append (-> gp-0 straddle) (the-as vector (+ (the-as uint s5-0) (* s4-1 16)))) - ) - #f - ) - ((< (-> s5-0 trans y) 0.0) - (dotimes (s4-2 4) - (when (>= (-> s5-0 trans y) (-> s5-0 vector s4-2 y)) - (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) - (dist-info-append (-> gp-0 ccw) (the-as vector (+ (the-as uint s5-0) (* s4-2 16)))) - ) - ) - #f - ) - (else - (dotimes (s4-3 4) - (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 trans y)) - (dist-info-append (-> gp-0 cw) (the-as vector (+ (the-as uint s5-0) (* s4-3 16)))) - ) - ) - #f - ) + (let ((sv-128 arg3) + (gp-0 arg4) + (sv-144 arg5) + (s4-0 arg6) + (sv-160 (new 'stack-no-clear 'vector)) + (sv-176 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'matrix)) + (sv-192 (new 'stack-no-clear 'vector)) + (f30-0 0.0) + (s0-0 #f) + ) + (let ((sv-208 0)) + (while (< sv-208 4) + (cond + ((= sv-208 3) + (vector-! sv-160 sv-144 (-> self string-trans)) + (set! (-> s5-0 vector sv-208 z) 0.0) + ) + (else + (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) + (set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down))) + (vector-! sv-160 (-> arg0 0 vertex sv-208) (-> self string-trans)) ) ) + (vector-flatten! sv-160 sv-160 (-> *camera* local-down)) + (vector-cross! sv-176 sv-160 arg2) + (let ((f28-0 (vector-dot sv-176 (-> *camera* local-down)))) + (cond + ((< (* f28-0 f30-0) 0.0) + (set! s0-0 #t) + ) + ((!= f28-0 0.0) + (set! f30-0 f28-0) + ) + ) + (set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2)) + (cond + ((= sv-208 3) + (vector-! sv-192 sv-144 (-> self string-trans)) + (vector-flatten! sv-192 sv-192 arg1) + ) + (else + (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)) + ) + ) + (if (< f28-0 0.0) + (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) + (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)) + ) + ) + (set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x))) + (+! sv-208 1) + ) + ) + (cond + ((and s0-0 (!= (the-as int s4-0) -859915232)) + (dotimes (s4-1 4) + (dist-info-append (-> gp-0 straddle) (the-as vector (+ (the-as uint s5-0) (* s4-1 16)))) + ) + #f + ) + ((< (-> s5-0 trans y) 0.0) + (dotimes (s4-2 4) + (when (>= (-> s5-0 trans y) (-> s5-0 vector s4-2 y)) + (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) + (dist-info-append (-> gp-0 ccw) (the-as vector (+ (the-as uint s5-0) (* s4-2 16)))) + ) + ) + #f + ) + (else + (dotimes (s4-3 4) + (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 trans y)) + (dist-info-append (-> gp-0 cw) (the-as vector (+ (the-as uint s5-0) (* s4-3 16)))) + ) + ) + #f ) ) ) @@ -1691,153 +1689,129 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f3, f6] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f2, f4, f7] (defbehavior cam-los-collide camera-slave ((arg0 vector) (arg1 vector) (arg2 collide-los-result) (arg3 pat-surface)) - (local-vars - (s1-3 int) - (s2-2 int) - (f2-1 float) - (sv-768 pat-surface) - (sv-784 vector) - (sv-800 vector) - (sv-816 tracking-point) - (sv-832 vector) - ) - (set! sv-768 arg3) - (dist-info-init (-> arg2 cw)) - (dist-info-init (-> arg2 ccw)) - (dist-info-init (-> arg2 straddle)) - (let ((s1-0 (new 'stack-no-clear 'collide-query)) - (s4-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - ) - (vector-normalize-copy! s2-0 arg1 1.0) - (vector-flatten! s4-0 arg1 (-> *camera* local-down)) - (let ((s0-0 *collide-cache*) - (f26-0 (vector-length arg1)) - (f30-0 (vector-normalize-ret-len! s4-0 1.0)) + (local-vars (s1-3 int) (s2-2 int) (f2-1 float)) + (let ((sv-768 arg3)) + (dist-info-init (-> arg2 cw)) + (dist-info-init (-> arg2 ccw)) + (dist-info-init (-> arg2 straddle)) + (let ((s1-0 (new 'stack-no-clear 'collide-query)) + (s4-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) ) - (set! (-> s1-0 start-pos quad) (-> arg0 quad)) - (set! (-> s1-0 move-dist quad) (-> arg1 quad)) - (let ((v1-5 s1-0)) - (set! (-> v1-5 radius) (-> *CAM_STRING-bank* los-coll-rad)) - (set! (-> v1-5 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) - (set! (-> v1-5 ignore-process0) #f) - (set! (-> v1-5 ignore-process1) #f) - (set! (-> v1-5 ignore-pat) sv-768) - (set! (-> v1-5 action-mask) (collide-action solid)) - ) - (fill-using-line-sphere s0-0 s1-0) - (let ((s1-1 (the-as object (-> s0-0 tris))) - (f28-0 (/ 2048.0 f26-0)) - (f26-1 (/ (+ -8192.0 f26-0) f26-0)) + (vector-normalize-copy! s2-0 arg1 1.0) + (vector-flatten! s4-0 arg1 (-> *camera* local-down)) + (let ((s0-0 *collide-cache*) + (f26-0 (vector-length arg1)) + (f30-0 (vector-normalize-ret-len! s4-0 1.0)) ) - (if (< f26-1 0.0) - (set! f26-1 0.0) - ) - (if (< 1.0 f28-0) - (set! f28-0 1.0) - ) - (countdown (s0-1 (-> s0-0 num-tris)) - (set! sv-800 (new 'stack-no-clear 'vector)) - (set! sv-784 (new 'stack-no-clear 'vector)) - (let ((f0-7 (moving-sphere-triangle-intersect - arg0 - arg1 - (-> *CAM_STRING-bank* los-coll-rad) - (-> (the-as (inline-array collide-cache-tri) s1-1) 0) - sv-800 - sv-784 - ) - ) - ) - (cond - ((or (< f0-7 0.0) (< 1.0 f0-7)) - ) - ((let ((f1-2 0.0)) - ;; og:preserve-this inlined vector-dot - ;; (let* ((v1-23 arg1) - ;; (f2-0 (-> v1-23 x)) - ;; (f3-0 (-> v1-23 y)) - ;; (f4-0 (-> v1-23 z)) - ;; (f5-0 (-> sv-784 x)) - ;; (f6-0 (-> sv-784 y)) - ;; (f7-0 (-> sv-784 z)) - ;; ) - ;; (.mula.s f2-0 f5-0) - ;; (.madda.s f3-0 f6-0) - ;; (.madd.s f2-1 f4-0 f7-0) - ;; ) - (set! f2-1 (vector-dot arg1 sv-784)) - (< f1-2 f2-1) - ) - (when (< f28-0 f0-7) - (let* ((t1-1 (new 'stack-no-clear 'vector)) - (t0-1 (new 'stack-no-clear 'vector)) - (f24-0 (moving-sphere-triangle-intersect - arg0 - arg1 - (-> *CAM_STRING-bank* los-coll-rad2) - (-> (the-as (inline-array collide-cache-tri) s1-1) 0) - t0-1 - t1-1 - ) - ) - ) - (los-cw-ccw (the-as (inline-array collide-cache-tri) s1-1) s2-0 s4-0 f30-0 arg2 sv-800 f24-0) - (when *debug-segment* - (cond - ((= (the-as int f24-0) -859915232) - (let ((t9-10 cam-debug-add-los-tri) - (a0-20 s1-1) - (a2-6 (new 'static 'vector :x (the-as float #x80) :w (the-as float #x80))) - ) - (t9-10 (the-as (inline-array collide-cache-tri) a0-20) sv-800 a2-6) - ) - ) - (else - (cam-debug-add-los-tri - (the-as (inline-array collide-cache-tri) s1-1) + (set! (-> s1-0 start-pos quad) (-> arg0 quad)) + (set! (-> s1-0 move-dist quad) (-> arg1 quad)) + (let ((v1-5 s1-0)) + (set! (-> v1-5 radius) (-> *CAM_STRING-bank* los-coll-rad)) + (set! (-> v1-5 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) + (set! (-> v1-5 ignore-process0) #f) + (set! (-> v1-5 ignore-process1) #f) + (set! (-> v1-5 ignore-pat) sv-768) + (set! (-> v1-5 action-mask) (collide-action solid)) + ) + (fill-using-line-sphere s0-0 s1-0) + (let ((s1-1 (the-as object (-> s0-0 tris))) + (f28-0 (/ 2048.0 f26-0)) + (f26-1 (/ (+ -8192.0 f26-0) f26-0)) + ) + (if (< f26-1 0.0) + (set! f26-1 0.0) + ) + (if (< 1.0 f28-0) + (set! f28-0 1.0) + ) + (countdown (s0-1 (-> s0-0 num-tris)) + (let* ((sv-800 (new 'stack-no-clear 'vector)) + (sv-784 (new 'stack-no-clear 'vector)) + (f0-7 (moving-sphere-triangle-intersect + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad) + (-> (the-as (inline-array collide-cache-tri) s1-1) 0) sv-800 - (new 'static 'vector :x (the-as float #x80) :y (the-as float #x80) :w (the-as float #x80)) + sv-784 ) ) + ) + (cond + ((or (< f0-7 0.0) (< 1.0 f0-7)) + ) + ((let ((f1-2 0.0)) + (let* ((v1-23 arg1)) + (set! f2-1 (vector-dot v1-23 sv-784)) + ) + (< f1-2 f2-1) + ) + (when (< f28-0 f0-7) + (let* ((t1-1 (new 'stack-no-clear 'vector)) + (t0-1 (new 'stack-no-clear 'vector)) + (f24-0 (moving-sphere-triangle-intersect + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad2) + (-> (the-as (inline-array collide-cache-tri) s1-1) 0) + t0-1 + t1-1 + ) + ) + ) + (los-cw-ccw (the-as (inline-array collide-cache-tri) s1-1) s2-0 s4-0 f30-0 arg2 sv-800 f24-0) + (when *debug-segment* + (if (= (the-as int f24-0) -859915232) + (cam-debug-add-los-tri + (the-as (inline-array collide-cache-tri) s1-1) + sv-800 + (new 'static 'vector :x (the-as float #x80) :w (the-as float #x80)) + ) + (cam-debug-add-los-tri + (the-as (inline-array collide-cache-tri) s1-1) + sv-800 + (new 'static 'vector :x (the-as float #x80) :y (the-as float #x80) :w (the-as float #x80)) + ) + ) ) ) ) ) - ) - ((< f0-7 f26-1) - (let* ((t1-3 (new 'stack-no-clear 'vector)) - (t0-3 (new 'stack-no-clear 'vector)) - (f24-1 (moving-sphere-triangle-intersect - arg0 - arg1 - (-> *CAM_STRING-bank* los-coll-rad2) - (-> (the-as (inline-array collide-cache-tri) s1-1) 0) - t0-3 - t1-3 + ((< f0-7 f26-1) + (let* ((t1-3 (new 'stack-no-clear 'vector)) + (t0-3 (new 'stack-no-clear 'vector)) + (f24-1 (moving-sphere-triangle-intersect + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad2) + (-> (the-as (inline-array collide-cache-tri) s1-1) 0) + t0-3 + t1-3 + ) ) - ) - ) - (los-cw-ccw (the-as (inline-array collide-cache-tri) s1-1) s2-0 s4-0 f30-0 arg2 sv-800 f24-1) - (when *debug-segment* - (if (= (the-as int f24-1) -859915232) - (cam-debug-add-los-tri - (the-as (inline-array collide-cache-tri) s1-1) - sv-800 - (new 'static 'vector :y (the-as float #x80) :w (the-as float #x80)) + ) + (los-cw-ccw (the-as (inline-array collide-cache-tri) s1-1) s2-0 s4-0 f30-0 arg2 sv-800 f24-1) + (when *debug-segment* + (if (= (the-as int f24-1) -859915232) + (cam-debug-add-los-tri + (the-as (inline-array collide-cache-tri) s1-1) + sv-800 + (new 'static 'vector :y (the-as float #x80) :w (the-as float #x80)) + ) + (cam-debug-add-los-tri + (the-as (inline-array collide-cache-tri) s1-1) + sv-800 + (new 'static 'vector :z (the-as float #x80) :w (the-as float #x80)) + ) ) - (cam-debug-add-los-tri - (the-as (inline-array collide-cache-tri) s1-1) - sv-800 - (new 'static 'vector :z (the-as float #x80) :w (the-as float #x80)) - ) - ) + ) ) ) - ) + ) ) + (set! s1-1 (-> (the-as (inline-array collide-cache-tri) s1-1) 1)) ) - (set! s1-1 (-> (the-as (inline-array collide-cache-tri) s1-1) 1)) ) ) ) @@ -1913,13 +1887,13 @@ (set! s1-3 -134250495) (while (and (!= s2-2 -134250495) (begin - (let ((s0-3 cam-los-spline-collide)) - (set! sv-816 (-> (the-as (inline-array tracking-spline) (-> *camera* target-spline)) 0 point s2-2)) - (set! sv-832 arg0) - (let ((a2-21 (camera-master-method-16 *camera* #t))) - (set! f30-1 (s0-3 (the-as vector sv-816) sv-832 (the-as pat-surface a2-21))) - ) - ) + (set! f30-1 + (cam-los-spline-collide + (-> (the-as (inline-array tracking-spline) (-> *camera* target-spline)) 0 point s2-2 position) + arg0 + (the-as pat-surface (camera-master-method-16 *camera* #t)) + ) + ) (< f30-1 0.0) ) ) @@ -2507,11 +2481,7 @@ ) ) ((or (logtest? (-> self options) (cam-slave-options-u32 BUTT_CAM)) - (let ((s3-0 (handle->process (-> *camera* settings butt-handle)))) - (if (type? s3-0 process-drawable) - s3-0 - ) - ) + (the-as object (as-type (handle->process (-> *camera* settings butt-handle)) process-drawable)) ) (vector-normalize-copy! gp-3 (-> self view-flat) 1.0) (let ((v1-283 (handle->process (-> *camera* settings butt-handle)))) diff --git a/goal_src/jak2/engine/camera/cam-update.gc b/goal_src/jak2/engine/camera/cam-update.gc index ffbf1a91dd..cb5d9b4e5f 100644 --- a/goal_src/jak2/engine/camera/cam-update.gc +++ b/goal_src/jak2/engine/camera/cam-update.gc @@ -27,7 +27,6 @@ ) (defun update-view-planes ((arg0 math-camera) (arg1 (inline-array plane)) (arg2 float) (arg3 matrix)) - (local-vars (sv-240 vector)) (when (not *artist-fix-frustum*) (let ((s5-0 (new 'stack 'view-frustum))) (let ((f30-0 (* arg2 (-> arg0 x-ratio) (-> arg0 d))) @@ -53,7 +52,7 @@ (vector-matrix*! (-> s5-0 yon-bottom-left) (-> s5-0 yon-bottom-left) arg3) (vector-matrix*! (-> s5-0 yon-bottom-right) (-> s5-0 yon-bottom-right) arg3) (when (= arg2 1.0) - (vector-! (the-as vector (-> *fog-texture-work* corner)) (-> s5-0 yon-top-left) (-> arg3 trans)) + (vector-! (-> *fog-texture-work* corner 0) (-> s5-0 yon-top-left) (-> arg3 trans)) (vector-! (-> *fog-texture-work* corner 1) (-> s5-0 yon-top-right) (-> arg3 trans)) (vector-! (-> *fog-texture-work* corner 2) (-> s5-0 yon-bottom-left) (-> arg3 trans)) (vector-! (-> *fog-texture-work* corner 3) (-> s5-0 yon-bottom-right) (-> arg3 trans)) @@ -64,22 +63,17 @@ (s0-0 (new-stack-vector0)) ) (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) - (set! sv-240 (new 'stack-no-clear 'vector)) - (set! (-> sv-240 quad) (the-as uint128 0)) - (let ((v1-15 (-> arg3 trans quad))) - (set! (-> sv-240 quad) v1-15) - ) - (vector-! s2-1 (-> s5-0 yon-top-left) sv-240) - (vector-! s3-1 (-> s5-0 yon-top-right) sv-240) - (vector-! s1-0 (-> s5-0 yon-bottom-left) sv-240) - (vector-! s0-0 (-> s5-0 yon-bottom-right) sv-240) - (plane-from-points arg1 s2-1 s1-0 sv-240 0) - (plane-from-points arg1 s0-0 s3-1 sv-240 1) - (plane-from-points arg1 s3-1 s2-1 sv-240 2) - (let ((t9-20 plane-from-points) - (t0-3 3) - ) - (t9-20 arg1 s1-0 s0-0 sv-240 t0-3) + (let ((sv-240 (new 'stack-no-clear 'vector))) + (set! (-> sv-240 quad) (the-as uint128 0)) + (set! (-> sv-240 quad) (-> arg3 trans quad)) + (vector-! s2-1 (-> s5-0 yon-top-left) sv-240) + (vector-! s3-1 (-> s5-0 yon-top-right) sv-240) + (vector-! s1-0 (-> s5-0 yon-bottom-left) sv-240) + (vector-! s0-0 (-> s5-0 yon-bottom-right) sv-240) + (plane-from-points arg1 s2-1 s1-0 sv-240 0) + (plane-from-points arg1 s0-0 s3-1 sv-240 1) + (plane-from-points arg1 s3-1 s2-1 sv-240 2) + (plane-from-points arg1 s1-0 s0-0 sv-240 3) ) ) ) diff --git a/goal_src/jak2/engine/camera/camera.gc b/goal_src/jak2/engine/camera/camera.gc index e6c6ea9e16..5bf064b01d 100644 --- a/goal_src/jak2/engine/camera/camera.gc +++ b/goal_src/jak2/engine/camera/camera.gc @@ -294,9 +294,7 @@ ) (defun fourth-power ((arg0 float)) - (let ((f0-2 (* arg0 arg0))) - (* f0-2 f0-2) - ) + (square (square arg0)) ) (defun third-power ((arg0 float)) @@ -312,19 +310,10 @@ 0.0 ) ((>= 0.5 arg0) - (let ((f0-3 0.5) - (f1-4 (* 2.0 arg0)) - ) - (* f0-3 (* f1-4 f1-4)) - ) + (* 0.5 (square (* 2.0 arg0))) ) (else - (let ((f0-5 1.0) - (f1-7 0.5) - (f2-2 (* 2.0 (- 1.0 arg0))) - ) - (- f0-5 (* f1-7 (* f2-2 f2-2))) - ) + (- 1.0 (* 0.5 (square (* 2.0 (- 1.0 arg0))))) ) ) ) @@ -361,19 +350,12 @@ ) (defmethod cam-index-method-9 ((this cam-index) (arg0 symbol) (arg1 entity) (arg2 vector) (arg3 curve)) - (local-vars (sv-32 (function _varargs_ object))) (format (clear *cam-res-string*) "~S-flags" arg0) (set! (-> this flags) (the-as cam-index-options (cam-slave-get-flags arg1 (string->symbol *cam-res-string*)))) (let ((s3-2 (res-lump-data arg1 arg0 pointer)) (s0-1 (method-of-type res-lump get-property-struct)) ) - (set! sv-32 format) - (let ((a0-7 (clear *res-key-string*)) - (a1-4 "~S~S") - (a3-2 '-offset) - ) - (sv-32 a0-7 a1-4 arg0 a3-2) - ) + (format (clear *res-key-string*) "~S~S" arg0 '-offset) (let ((v0-8 (s0-1 arg1 (string->symbol *res-key-string*) @@ -389,7 +371,7 @@ (s3-2 (cond (v0-8 - (vector+! (the-as vector (-> this vec)) (the-as vector (&+ s3-2 0)) (the-as vector v0-8)) + (vector+! (-> this vec 0) (the-as vector (&+ s3-2 0)) (the-as vector v0-8)) (vector+! (-> this vec 1) (the-as vector (&+ s3-2 16)) (the-as vector v0-8)) ) (else @@ -414,7 +396,7 @@ ((logtest? (-> this flags) (cam-index-options SPHERICAL)) (vector-! v1-11 (-> this vec 1) arg2) (set! (-> this vec 1 w) (vector-length v1-11)) - (vector-! v1-11 (the-as vector (-> this vec)) arg2) + (vector-! v1-11 (-> this vec 0) arg2) (set! (-> this vec 1 x) (vector-length v1-11)) (set! (-> this vec 1 w) (- (-> this vec 1 w) (-> this vec 1 x))) (set! (-> this vec 0 quad) (-> arg2 quad)) @@ -422,13 +404,13 @@ ((logtest? (-> this flags) (cam-index-options RADIAL)) (vector-! v1-11 (-> this vec 1) arg2) (set! (-> this vec 1 w) (vector-length v1-11)) - (vector-! v1-11 (the-as vector (-> this vec)) arg2) + (vector-! v1-11 (-> this vec 0) arg2) (set! (-> this vec 1 x) (vector-length v1-11)) (set! (-> this vec 1 w) (- (-> this vec 1 w) (-> this vec 1 x))) (set! (-> this vec 0 quad) (-> arg2 quad)) ) (else - (vector-! (-> this vec 1) (-> this vec 1) (the-as vector (-> this vec))) + (vector-! (-> this vec 1) (-> this vec 1) (-> this vec 0)) (set! (-> this vec 1 w) (vector-normalize-ret-len! (-> this vec 1) 1.0)) ) ) @@ -439,7 +421,7 @@ (defmethod cam-index-method-10 ((this cam-index) (arg0 vector)) (let ((s5-0 (new-stack-vector0))) 0.0 - (vector-! s5-0 arg0 (the-as vector (-> this vec))) + (vector-! s5-0 arg0 (-> this vec 0)) (cond ((logtest? (-> this flags) (cam-index-options SPHERICAL)) (vector-flatten! s5-0 s5-0 (-> *camera* local-down)) @@ -496,8 +478,8 @@ (set! (-> this summed-len) (- (-> this summed-len) (-> this point arg0 tp-length))) (vector-! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 arg0))) - (the-as vector (-> this point v1-11)) - (the-as vector (-> this point arg0)) + (-> this point v1-11 position) + (-> this point arg0 position) ) ) (set! (-> this point arg0 tp-length) @@ -642,7 +624,7 @@ (vector-! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s2-0))) arg0 - (the-as vector (-> this point s2-0)) + (-> this point s2-0 position) ) (set! (-> this point s2-0 tp-length) (vector-normalize-ret-len! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s2-0))) 1.0) @@ -689,7 +671,7 @@ (cond ((= (-> arg2 cur-pt) (-> this end-point)) (set! (-> arg2 partial-pt) 0.0) - (vector+! arg1 arg1 (the-as vector (-> this point (-> arg2 cur-pt)))) + (vector+! arg1 arg1 (-> this point (-> arg2 cur-pt) position)) (return arg1) ) ((begin (set! f0-4 (+ (-> arg2 partial-pt) (/ arg0 (-> this point (-> arg2 cur-pt) tp-length)))) (< f0-4 1.0)) @@ -698,8 +680,8 @@ (let ((a2-5 (-> this point (-> arg2 cur-pt) next))) (vector-lerp! (the-as vector s5-0) - (the-as vector (-> this point (-> arg2 cur-pt))) - (the-as vector (-> this point a2-5)) + (-> this point (-> arg2 cur-pt) position) + (-> this point a2-5 position) f0-4 ) ) @@ -728,11 +710,7 @@ (defmethod tracking-spline-method-20 ((this tracking-spline) (arg0 vector) (arg1 int)) (let ((s3-0 (new 'stack-no-clear 'vector))) - (vector-! - s3-0 - (the-as vector (-> this point (-> this used-point))) - (the-as vector (-> this point (-> this end-point))) - ) + (vector-! s3-0 (-> this point (-> this used-point) position) (-> this point (-> this end-point) position)) (let* ((f0-0 (vector-length s3-0)) (f1-1 (* 0.33333334 (- 1.5 (/ f0-0 METER_LENGTH)))) ) @@ -780,7 +758,7 @@ ((< f26-0 0.0) (if (and *debug-segment* *display-camera-marks*) (camera-line-rel-len - (the-as vector (-> this point s1-0)) + (-> this point s1-0 position) s2-0 (* -40.96 f26-0) (new 'static 'vector4w :x #xff :y #xff :w #x80) @@ -790,7 +768,7 @@ ) ((and *debug-segment* *display-camera-marks*) (camera-line-rel-len - (the-as vector (-> this point s1-0)) + (-> this point s1-0 position) s2-0 (* 40.96 f26-0) (new 'static 'vector4w :x #x80 :y #x80 :w #x80) @@ -958,7 +936,7 @@ ) (else (vector-reset! (-> self trans)) - (matrix-identity! (the-as matrix (-> self tracking))) + (matrix-identity! (-> self tracking inv-mat)) (set! (-> self fov) 11650.845) (vector-reset! (-> self velocity)) ) @@ -1153,7 +1131,6 @@ ;; ERROR: Stack slot load at 144 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 (defun cam-calc-follow! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 symbol)) - (local-vars (sv-128 (function float float float float)) (sv-144 float) (sv-160 float)) (with-pp (cond (arg2 @@ -1184,11 +1161,13 @@ (vector-flatten! s0-0 s0-0 (-> *camera* local-down)) (vector-normalize! s0-0 1.0) (vector-float*! s2-0 (-> *camera* tgt-face-mat vector 2) 32768.0) - (set! sv-128 lerp-clamp) - (set! sv-144 (the-as float 0.7)) - (set! sv-160 (the-as float 0.4)) - (let* ((a2-3 (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0)))) - (f30-1 (sv-128 sv-144 sv-160 a2-3)) + (let* ((f30-1 + (lerp-clamp + (the-as float 0.7) + (the-as float 0.4) + (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0))) + ) + ) (f0-7 (acos (vector-dot s0-0 s1-0))) (f28-0 (fmax 1820.4445 f0-7)) ) @@ -1206,10 +1185,7 @@ ((< (-> *camera* ease-t) 1.0) ) ((< (-> arg0 follow-blend) 1.0) - (let* ((f0-21 (-> arg0 follow-blend)) - (f0-22 (* f0-21 f0-21)) - (f0-23 (* f0-22 f0-22)) - ) + (let ((f0-23 (square (square (-> arg0 follow-blend))))) (vector-! s2-0 s2-0 (-> arg0 follow-off)) (vector-float*! s2-0 s2-0 f0-23) ) @@ -1257,10 +1233,10 @@ 1.0 ) (else - (let* ((f0-33 (* f0-32 f0-32)) + (let* ((f0-33 (square f0-32)) (f0-34 (- 1.0 f0-33)) ) - (* f0-34 (* f0-34 f0-34)) + (* f0-34 (square f0-34)) ) ) ) @@ -1416,7 +1392,6 @@ ) (defun vector-into-frustum-nosmooth! ((arg0 matrix) (arg1 vector) (arg2 float)) - (local-vars (sv-112 (inline-array vector)) (sv-128 vector) (sv-144 vector) (sv-160 vector) (sv-176 vector)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) @@ -1436,30 +1411,32 @@ (let ((f26-0 (vector-length s3-0))) (vector-flatten! s3-0 s3-0 (-> arg0 vector 1)) (vector-normalize! s3-0 1.0) - (let ((f28-0 (vector-dot s3-0 (the-as vector (-> arg0 vector))))) - (set! sv-128 s2-0) - (set! sv-112 (-> arg0 vector)) - (let ((f0-7 (* 0.8 (tan (/ arg2 2))))) - (.lvf vf1 (&-> sv-112 0 quad)) - (let ((v1-11 f0-7)) - (.mov vf2 v1-11) + (let ((f28-0 (vector-dot s3-0 (-> arg0 vector 0)))) + (let ((sv-128 s2-0)) + (let ((sv-112 (-> arg0 vector)) + (f0-7 (* 0.8 (tan (/ arg2 2)))) + ) + (.lvf vf1 (&-> sv-112 0 quad)) + (let ((v1-11 f0-7)) + (.mov vf2 v1-11) + ) ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-128 quad) vf1) ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-128 quad) vf1) (vector+! s2-0 s2-0 (-> arg0 vector 2)) (vector-normalize! s2-0 f26-0) - (vector--float*! s2-0 s2-0 (the-as vector (-> arg0 vector)) 6144.0) + (vector--float*! s2-0 s2-0 (-> arg0 vector 0) 6144.0) (vector-normalize! s2-0 1.0) - (let ((f0-9 (fmax 0.0 (vector-dot s2-0 (the-as vector (-> arg0 vector)))))) + (let ((f0-9 (fmax 0.0 (vector-dot s2-0 (-> arg0 vector 0))))) (when (< f0-9 (fabs f28-0)) (if (< f28-0 0.0) - (vector--float*! s2-0 s2-0 (the-as vector (-> arg0 vector)) (* 2.0 f0-9)) + (vector--float*! s2-0 s2-0 (-> arg0 vector 0) (* 2.0 f0-9)) ) (matrix-from-two-vectors! s5-0 s2-0 s3-0) (vector-matrix*! (-> arg0 vector 2) (-> arg0 vector 2) s5-0) - (vector-cross! (the-as vector (-> arg0 vector)) (-> arg0 vector 1) (-> arg0 vector 2)) + (vector-cross! (-> arg0 vector 0) (-> arg0 vector 1) (-> arg0 vector 2)) ) ) ) @@ -1467,20 +1444,22 @@ (vector-! s3-0 (-> *camera* tpos-curr) (-> *camera* pitch-off)) (vector-! s3-0 s3-0 arg1) (vector--float*! s3-0 s3-0 (-> *camera* local-down) (-> *camera* settings foot-offset)) - (vector-flatten! s3-0 s3-0 (the-as vector (-> arg0 vector))) + (vector-flatten! s3-0 s3-0 (-> arg0 vector 0)) (vector-normalize! s3-0 1.0) (let ((f28-1 (vector-dot s3-0 (-> arg0 vector 1)))) - (set! sv-160 s2-0) - (set! sv-144 (-> arg0 vector 1)) - (let ((f0-16 (* 0.525 (tan (/ arg2 2))))) - (.lvf vf1 (&-> sv-144 quad)) - (let ((v1-32 f0-16)) - (.mov vf2 v1-32) + (let ((sv-160 s2-0)) + (let ((sv-144 (-> arg0 vector 1)) + (f0-16 (* 0.525 (tan (/ arg2 2)))) + ) + (.lvf vf1 (&-> sv-144 quad)) + (let ((v1-32 f0-16)) + (.mov vf2 v1-32) + ) ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-160 quad) vf1) ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-160 quad) vf1) (vector+! s2-0 s2-0 (-> arg0 vector 2)) (vector-normalize! s2-0 1.0) (let ((f0-18 (vector-dot s2-0 (-> arg0 vector 1)))) @@ -1493,15 +1472,10 @@ (vector-! s3-0 (-> *camera* tpos-curr) (-> *camera* pitch-off)) (vector-! s3-0 s3-0 arg1) (vector--float*! s3-0 s3-0 (-> *camera* local-down) (-> *camera* settings head-offset)) - (vector-flatten! s3-0 s3-0 (the-as vector (-> arg0 vector))) + (vector-flatten! s3-0 s3-0 (-> arg0 vector 0)) (vector-normalize! s3-0 1.0) (let ((f28-2 (vector-dot s3-0 (-> arg0 vector 1)))) - (let ((s0-1 s2-0)) - (set! sv-176 (-> arg0 vector 1)) - (let ((f0-26 (* 0.525 (tan (/ arg2 2))))) - (vector-float*! s0-1 sv-176 f0-26) - ) - ) + (vector-float*! s2-0 (-> arg0 vector 1) (* 0.525 (tan (/ arg2 2)))) (vector+! s2-0 s2-0 (-> arg0 vector 2)) (vector-normalize! s2-0 1.0) (let ((f0-28 (vector-dot s2-0 (-> arg0 vector 1)))) @@ -1526,13 +1500,13 @@ ) ) ) - (matrix-axis-angle! s5-0 (the-as vector (-> arg0 vector)) f0-35) + (matrix-axis-angle! s5-0 (-> arg0 vector 0) f0-35) ) ) ) (vector-matrix*! (-> arg0 vector 2) (-> arg0 vector 2) s5-0) ) - (vector-cross! (-> arg0 vector 1) (-> arg0 vector 2) (the-as vector (-> arg0 vector))) + (vector-cross! (-> arg0 vector 1) (-> arg0 vector 2) (-> arg0 vector 0)) ) ) @@ -1540,15 +1514,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defun slave-set-rotation! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 cam-slave-options-u32) (arg3 float) (arg4 symbol)) - (local-vars - (f0-9 float) - (sv-208 vector) - (sv-224 vector) - (sv-240 matrix) - (sv-256 (function matrix vector float vector)) - (sv-272 matrix) - (sv-288 vector) - ) + (local-vars (f0-9 float)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1564,22 +1530,23 @@ (let ((f30-0 (-> arg0 tilt-adjust value))) (cond ((< 0.0001 (-> arg0 point-of-interest-blend value)) - (set! sv-208 (new 'stack-no-clear 'vector)) - 0.0 - (vector-! s0-0 (-> arg0 follow-pt) arg1) - (let ((f28-0 (vector-length s0-0))) - (vector-! sv-208 (-> *camera* settings point-of-interest) arg1) - (vector-normalize! sv-208 (* f28-0 (-> arg0 point-of-interest-blend value))) - (let ((v1-12 s0-0)) - (let ((a0-10 s0-0)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-10 quad)) + (let ((sv-208 (new 'stack-no-clear 'vector))) + 0.0 + (vector-! s0-0 (-> arg0 follow-pt) arg1) + (let ((f28-0 (vector-length s0-0))) + (vector-! sv-208 (-> *camera* settings point-of-interest) arg1) + (vector-normalize! sv-208 (* f28-0 (-> arg0 point-of-interest-blend value))) + (let ((v1-12 s0-0)) + (let ((a0-10 s0-0)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-10 quad)) + ) + (.lvf vf5 (&-> sv-208 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-12 quad) vf6) ) - (.lvf vf5 (&-> sv-208 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-12 quad) vf6) + (vector-normalize! s0-0 f28-0) ) - (vector-normalize! s0-0 f28-0) ) (vector-! (-> arg0 looking-interesting) (-> *camera* settings point-of-interest) (-> arg0 follow-pt)) (vector+float*! @@ -1599,49 +1566,35 @@ (when (!= f30-0 0.0) 0.0 0.0 - (set! sv-240 (new 'stack-no-clear 'matrix)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (vector-normalize-copy! sv-224 s0-0 1.0) - ;; og:preserve-this inlined vector-dot - ;; (let* ((v1-25 (-> *camera* local-down)) - ;; (f0-8 (-> sv-224 x)) - ;; (f1-1 (-> sv-224 y)) - ;; (f2-0 (-> sv-224 z)) - ;; (f3-0 (-> v1-25 x)) - ;; (f4-0 (-> v1-25 y)) - ;; (f5-0 (-> v1-25 z)) - ;; ) - ;; (.mula.s f0-8 f3-0) - ;; (.madda.s f1-1 f4-0) - ;; (.madd.s f0-9 f2-0 f5-0) - ;; ) - (set! f0-9 (vector-dot (-> *camera* local-down) sv-224)) - (let* ((f28-1 f0-9) - (f0-11 (acos (fabs f28-1))) - ) - (cond - ((< 0.0 f30-0) - (set! f30-0 (if (< 0.0 f28-1) - (fmin f30-0 (fmax 0.0 (+ -2730.6667 f0-11))) - (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-11)))) - ) - ) - ) - ((< f30-0 0.0) - (set! f30-0 (if (< 0.0 f28-1) - (fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-11))))) - (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-11)))) - ) - ) - ) - ) - ) - (matrix-rotate-x! sv-240 f30-0) - (let ((t9-6 matrix*!) - (a0-28 s1-0) - (a2-3 s1-0) + (let ((sv-240 (new 'stack-no-clear 'matrix))) + (let ((sv-224 (new 'stack-no-clear 'vector))) + (vector-normalize-copy! sv-224 s0-0 1.0) + (let* ((v1-25 (-> *camera* local-down))) + (set! f0-9 (vector-dot sv-224 v1-25)) ) - (t9-6 a0-28 sv-240 a2-3) + ) + (let* ((f28-1 f0-9) + (f0-11 (acos (fabs f28-1))) + ) + (cond + ((< 0.0 f30-0) + (set! f30-0 (if (< 0.0 f28-1) + (fmin f30-0 (fmax 0.0 (+ -2730.6667 f0-11))) + (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-11)))) + ) + ) + ) + ((< f30-0 0.0) + (set! f30-0 (if (< 0.0 f28-1) + (fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-11))))) + (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-11)))) + ) + ) + ) + ) + ) + (matrix-rotate-x! sv-240 f30-0) + (matrix*! s1-0 sv-240 s1-0) ) ) ) @@ -1654,12 +1607,7 @@ (set! (-> arg0 underwater-blend target) 0.0) ) ) - (set! sv-256 vector-into-frustum-nosmooth!) - (set! sv-272 s1-0) - (set! sv-288 arg1) - (let ((a2-5 (lerp-clamp arg3 (/ arg3 4) (-> arg0 underwater-blend value)))) - (sv-256 sv-272 sv-288 a2-5) - ) + (vector-into-frustum-nosmooth! s1-0 arg1 (lerp-clamp arg3 (/ arg3 4) (-> arg0 underwater-blend value))) (cond (arg4 (slave-matrix-blend-2 (-> arg0 inv-mat) arg2 s0-0 s1-0) @@ -1715,99 +1663,71 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defun v-slrp2! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float) (arg4 vector) (arg5 float)) - (local-vars - (f0-10 float) - (f28-0 float) - (f30-0 float) - (sv-144 float) - (sv-160 vector) - (sv-176 matrix) - (sv-192 vector) - ) - (set! sv-144 arg5) - (let ((s0-0 (new-stack-vector0))) - (set! sv-160 (new 'stack-no-clear 'vector)) + (local-vars (f0-10 float) (f28-0 float) (f30-0 float)) + (let ((sv-144 arg5) + (s0-0 (new-stack-vector0)) + (sv-160 (new 'stack-no-clear 'vector)) + ) (set! (-> sv-160 quad) (the-as uint128 0)) 1.0 1.0 (let ((s3-0 (new-stack-vector0))) 0.0 1.0 - (set! sv-176 (new 'stack-no-clear 'matrix)) - (set! (-> sv-176 quad 0) (the-as uint128 0)) - (set! (-> sv-176 quad 1) (the-as uint128 0)) - (set! (-> sv-176 quad 2) (the-as uint128 0)) - (set! (-> sv-176 trans quad) (the-as uint128 0)) - (cond - ((< 1.0 arg3) - (set! arg3 1.0) - ) - ((< arg3 0.0) - (set! arg3 0.0) - ) - ) - (cond - (arg4 - (vector-flatten! s0-0 arg1 arg4) - (vector-flatten! sv-160 arg2 arg4) - (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) - (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) - (vector-normalize! (vector-cross! s3-0 sv-160 s0-0) 1.0) - (let ((f26-0 (vector-dot arg4 s3-0))) - (vector-normalize-copy! s3-0 arg4 1.0) - (if (< f26-0 0.0) - (vector-negate! s3-0 s3-0) - ) + (let ((sv-176 (new 'stack-no-clear 'matrix))) + (set! (-> sv-176 quad 0) (the-as uint128 0)) + (set! (-> sv-176 quad 1) (the-as uint128 0)) + (set! (-> sv-176 quad 2) (the-as uint128 0)) + (set! (-> sv-176 trans quad) (the-as uint128 0)) + (cond + ((< 1.0 arg3) + (set! arg3 1.0) + ) + ((< arg3 0.0) + (set! arg3 0.0) + ) + ) + (cond + (arg4 + (vector-flatten! s0-0 arg1 arg4) + (vector-flatten! sv-160 arg2 arg4) + (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) + (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 sv-160 s0-0) 1.0) + (let ((f26-0 (vector-dot arg4 s3-0))) + (vector-normalize-copy! s3-0 arg4 1.0) + (if (< f26-0 0.0) + (vector-negate! s3-0 s3-0) + ) + ) + ) + (else + (set! (-> s0-0 quad) (-> arg1 quad)) + (set! (-> sv-160 quad) (-> arg2 quad)) + (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) + (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0) ) ) - (else - (set! (-> s0-0 quad) (-> arg1 quad)) - (set! (-> sv-160 quad) (-> arg2 quad)) - (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) - (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) - (vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0) - ) - ) - (let ((t9-10 acos)) - ;; og:preserve-this inlined vector-dot - ;; (let* ((v1-22 s0-0) - ;; (f0-9 (-> v1-22 x)) - ;; (f1-2 (-> v1-22 y)) - ;; (f2-0 (-> v1-22 z)) - ;; (f3-0 (-> sv-160 x)) - ;; (f4-0 (-> sv-160 y)) - ;; (f5-0 (-> sv-160 z)) - ;; ) - ;; (.mula.s f0-9 f3-0) - ;; (.madda.s f1-2 f4-0) - ;; (.madd.s f0-10 f2-0 f5-0) - ;; ) - (set! f0-10 (vector-dot s0-0 sv-160)) - (let* ((f1-3 (t9-10 f0-10)) - (f0-12 (* arg3 f1-3)) - ) - (when (< sv-144 f0-12) - (set! f0-12 sv-144) - (set! arg3 (/ sv-144 f1-3)) + (let ((t9-10 acos)) + (let* ((v1-22 s0-0)) + (set! f0-10 (vector-dot v1-22 sv-160)) ) - (let* ((f0-13 (cos f0-12)) - (t9-12 matrix-axis-sin-cos!) - (a0-20 sv-176) - (a1-13 s3-0) - (f1-5 1.0) - (f2-3 f0-13) + (let* ((f1-3 (t9-10 f0-10)) + (f0-12 (* arg3 f1-3)) ) - (t9-12 a0-20 a1-13 (sqrtf (- f1-5 (* f2-3 f2-3))) f0-13) + (when (< sv-144 f0-12) + (set! f0-12 sv-144) + (set! arg3 (/ sv-144 f1-3)) + ) + (let ((f0-13 (cos f0-12))) + (matrix-axis-sin-cos! sv-176 s3-0 (sqrtf (- 1.0 (square f0-13))) f0-13) + ) ) ) + (vector-matrix*! arg0 s0-0 sv-176) ) - (vector-matrix*! arg0 s0-0 sv-176) - (let ((s0-1 vector-normalize!)) - (set! sv-192 arg0) - (let ((a1-16 (lerp f30-0 f28-0 arg3))) - (s0-1 sv-192 a1-16) - ) - ) + (vector-normalize! arg0 (lerp f30-0 f28-0 arg3)) (when arg4 (vector+float*! arg0 arg0 s3-0 (vector-dot arg1 s3-0)) (vector+float*! arg0 arg0 s3-0 (* arg3 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0))) @@ -1821,10 +1741,11 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defun v-slrp3! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float)) - (local-vars (f0-7 float) (f26-0 float) (f28-0 float) (sv-144 float) (sv-160 vector)) - (set! sv-144 arg4) - (let ((s1-0 (new-stack-vector0))) - (set! sv-160 (new 'stack-no-clear 'vector)) + (local-vars (f0-7 float) (f26-0 float) (f28-0 float)) + (let ((sv-144 arg4) + (s1-0 (new-stack-vector0)) + (sv-160 (new 'stack-no-clear 'vector)) + ) (set! (-> sv-160 quad) (the-as uint128 0)) 0.0 0.0 @@ -1856,33 +1777,16 @@ ) ) (let ((t9-10 acos)) - ;; og:preserve-this inlined vector-dot - ;; (let* ((v1-10 s1-0) - ;; (f0-6 (-> v1-10 x)) - ;; (f1-0 (-> v1-10 y)) - ;; (f2-0 (-> v1-10 z)) - ;; (f3-0 (-> sv-160 x)) - ;; (f4-0 (-> sv-160 y)) - ;; (f5-0 (-> sv-160 z)) - ;; ) - ;; (.mula.s f0-6 f3-0) - ;; (.madda.s f1-0 f4-0) - ;; (.madd.s f0-7 f2-0 f5-0) - ;; ) - (set! f0-7 (vector-dot s1-0 sv-160)) + (let* ((v1-10 s1-0)) + (set! f0-7 (vector-dot v1-10 sv-160)) + ) (let ((f0-8 (t9-10 f0-7))) (when (< sv-144 f0-8) (set! f30-0 (/ sv-144 f0-8)) (set! f0-8 sv-144) ) - (let* ((f0-9 (cos f0-8)) - (t9-12 matrix-axis-sin-cos!) - (a0-20 s0-0) - (a1-13 s3-0) - (f1-3 1.0) - (f2-1 f0-9) - ) - (t9-12 a0-20 a1-13 (sqrtf (- f1-3 (* f2-1 f2-1))) f0-9) + (let ((f0-9 (cos f0-8))) + (matrix-axis-sin-cos! s0-0 s3-0 (sqrtf (- 1.0 (square f0-9))) f0-9) ) ) ) diff --git a/goal_src/jak2/engine/collide/collide-cache.gc b/goal_src/jak2/engine/collide/collide-cache.gc index a910b970d5..5bc3fb3cdf 100644 --- a/goal_src/jak2/engine/collide/collide-cache.gc +++ b/goal_src/jak2/engine/collide/collide-cache.gc @@ -28,7 +28,7 @@ (add-debug-box #t (bucket-id debug2) - (the-as vector (-> arg2 bbox)) + (-> arg2 bbox min) (-> arg2 bbox max) (new 'static 'rgba :g #xff :b #xff :a #x80) ) @@ -631,20 +631,18 @@ ) (when (logtest? s4-0 (-> v1-18 prim-core collide-as)) (let ((s0-0 (-> v1-18 prim-core))) - (vector-! (-> s3-0 vector 1) (the-as vector s0-0) (-> arg0 start-pos)) + (vector-! (-> s3-0 vector 1) (-> s0-0 world-sphere) (-> arg0 start-pos)) (let* ((f1-2 (* (vector-dot (-> arg0 move-dist) (-> s3-0 vector 1)) f30-0)) (f0-6 (fmax 0.0 (fmin 1.0 f1-2))) ) - (vector+float*! (the-as vector (-> s3-0 vector)) (-> arg0 start-pos) (-> arg0 move-dist) f0-6) + (vector+float*! (-> s3-0 vector 0) (-> arg0 start-pos) (-> arg0 move-dist) f0-6) ) - (let ((f0-7 (vector-vector-distance-squared (the-as vector (-> s3-0 vector)) (the-as vector s0-0))) - (f1-5 (+ (-> arg0 radius) (-> s0-0 world-sphere w))) - ) - (when (< f0-7 (* f1-5 f1-5)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape s1-0)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< (vector-vector-distance-squared (-> s3-0 vector 0) (-> s0-0 world-sphere)) + (square (+ (-> arg0 radius) (-> s0-0 world-sphere w))) + ) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape s1-0)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -667,20 +665,18 @@ ) (when (logtest? s4-0 (-> v1-39 prim-core collide-as)) (let ((s0-1 (-> v1-39 prim-core))) - (vector-! (-> s3-0 vector 1) (the-as vector s0-1) (-> arg0 start-pos)) + (vector-! (-> s3-0 vector 1) (-> s0-1 world-sphere) (-> arg0 start-pos)) (let* ((f1-8 (* (vector-dot (-> arg0 move-dist) (-> s3-0 vector 1)) f30-0)) (f0-11 (fmax 0.0 (fmin 1.0 f1-8))) ) - (vector+float*! (the-as vector (-> s3-0 vector)) (-> arg0 start-pos) (-> arg0 move-dist) f0-11) + (vector+float*! (-> s3-0 vector 0) (-> arg0 start-pos) (-> arg0 move-dist) f0-11) ) - (let ((f0-12 (vector-vector-distance-squared (the-as vector (-> s3-0 vector)) (the-as vector s0-1))) - (f1-11 (+ (-> arg0 radius) (-> s0-1 world-sphere w))) - ) - (when (< f0-12 (* f1-11 f1-11)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape s1-1)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< (vector-vector-distance-squared (-> s3-0 vector 0) (-> s0-1 world-sphere)) + (square (+ (-> arg0 radius) (-> s0-1 world-sphere w))) + ) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape s1-1)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -765,7 +761,7 @@ ((>= (the-as int (-> (the-as collide-cache-prim s4-0) prim-core prim-type)) 0) (let ((f0-0 ((method-of-type collide-cache-prim resolve-moving-sphere-tri) (the-as collide-cache-prim s4-0) - (the-as collide-tri-result arg0) + (-> arg0 best-other-tri) (the-as collide-prim-core (-> s5-0 vertex 1)) (-> s5-0 vertex 2) f30-0 @@ -785,7 +781,7 @@ ) (let ((f0-1 ((method-of-type collide-cache-prim resolve-moving-sphere-sphere) (the-as collide-cache-prim s4-0) - (the-as collide-tri-result arg0) + (-> arg0 best-other-tri) (the-as collide-prim-core (-> s5-0 vertex 1)) (-> s5-0 vertex 2) f30-0 diff --git a/goal_src/jak2/engine/collide/collide-edge-grab.gc b/goal_src/jak2/engine/collide/collide-edge-grab.gc index 6996d25764..a8e40eed52 100644 --- a/goal_src/jak2/engine/collide/collide-edge-grab.gc +++ b/goal_src/jak2/engine/collide/collide-edge-grab.gc @@ -130,7 +130,6 @@ ;; WARN: Return type mismatch int vs symbol. (defmethod check-grab-for-collisions ((this collide-edge-work) (arg0 collide-edge-hold-item) (arg1 edge-grab-info)) - (local-vars (sv-656 vector) (sv-672 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -164,19 +163,21 @@ (return (the-as symbol #f)) ) ) - (set! sv-672 s0-0) - (set! sv-656 (-> arg0 center-pt)) - (let ((v0-2 (vector-negate! (new 'stack-no-clear 'vector) (-> s2-0 edge-vec-norm)))) - (let ((v1-8 1105.92)) - (.mov vf7 v1-8) + (let ((sv-672 s0-0)) + (let ((sv-656 (-> arg0 center-pt))) + (let ((v0-2 (vector-negate! (new 'stack-no-clear 'vector) (-> s2-0 edge-vec-norm)))) + (let ((v1-8 1105.92)) + (.mov vf7 v1-8) + ) + (.lvf vf5 (&-> v0-2 quad)) + ) + (.lvf vf4 (&-> sv-656 quad)) ) - (.lvf vf5 (&-> v0-2 quad)) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> sv-672 quad) vf6) ) - (.lvf vf4 (&-> sv-656 quad)) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> sv-672 quad) vf6) (let ((f0-3 (get-best-hand-point this (-> arg1 left-hand-hold) s0-0 (the-as int s4-0)))) (if (< 491.52 f0-3) (return (the-as symbol #f)) @@ -194,7 +195,7 @@ (-> (the-as collide-shape-moving (-> this process 0 root)) dynam gravity-normal quad) ) (vector-normalize! - (vector-! (-> arg1 hanging-matrix vector 2) (-> arg1 world-vertex 1) (the-as vector (-> arg1 world-vertex))) + (vector-! (-> arg1 hanging-matrix vector 2) (-> arg1 world-vertex 1) (-> arg1 world-vertex 0)) 1.0 ) (vector-normalize! @@ -287,8 +288,8 @@ (-> (the-as collide-shape-moving (-> arg0 process 0 root)) dynam gravity-normal quad) ) (vector-normalize! (vector-! (-> s4-0 vector 2) (-> this vertex-ptr 1 0) (-> this vertex-ptr 0 0)) 1.0) - (vector-normalize! (vector-cross! (the-as vector (-> s4-0 vector)) (-> s4-0 vector 2) (-> s4-0 vector 1)) 1.0) - (vector-cross! (-> s4-0 vector 2) (the-as vector (-> s4-0 vector)) (-> s4-0 vector 1)) + (vector-normalize! (vector-cross! (-> s4-0 vector 0) (-> s4-0 vector 2) (-> s4-0 vector 1)) 1.0) + (vector-cross! (-> s4-0 vector 2) (-> s4-0 vector 0) (-> s4-0 vector 1)) (vector-average! (-> s4-0 trans) (-> this vertex-ptr 1 0) (-> this vertex-ptr 0 0)) (transform-vectors! s4-0 s5-0 (-> arg0 spec local-player-spheres) 6) (let ((a1-11 (new 'stack-no-clear 'collide-query))) @@ -472,7 +473,7 @@ (add-debug-line #t (bucket-id debug-no-zbuf1) - (the-as vector (-> this world-vertex)) + (-> this world-vertex 0) (-> this world-vertex 1) (new 'static 'rgba :r #xff :a #x60) #f @@ -504,7 +505,7 @@ #t (bucket-id debug-no-zbuf1) (-> this adjacent-edge-left-vertex) - (the-as vector (-> this world-vertex)) + (-> this world-vertex 0) (new 'static 'rgba :r #x80 :a #x60) #f (the-as rgba -1) @@ -524,7 +525,7 @@ (add-debug-outline-triangle #t (bucket-id debug-no-zbuf1) - (the-as vector (-> this tri-vertex)) + (-> this tri-vertex 0) (-> this world-vertex 4) (-> this world-vertex 5) (new 'static 'rgba :r #xff :a #x30) @@ -544,7 +545,6 @@ ) (defmethod debug-draw-edges ((this collide-edge-work)) - (local-vars (sv-32 (function _varargs_ object))) (let ((gp-0 0)) (dotimes (s4-0 (the-as int (-> this num-edges))) (let* ((v1-3 (-> this edges s4-0)) @@ -581,13 +581,7 @@ (s1-0 #t) (s0-0 318) ) - (set! sv-32 format) - (let ((a0-10 (clear *temp-string*)) - (a1-4 "~D") - (a2-2 s4-0) - ) - (sv-32 a0-10 a1-4 a2-2) - ) + (format (clear *temp-string*) "~D" s4-0) (s2-0 s1-0 (the-as bucket-id s0-0) *temp-string* s3-0 (font-color white) (the-as vector2h #f)) ) ) @@ -664,7 +658,7 @@ (add-debug-sphere #t (bucket-id debug-no-zbuf1) - (the-as vector (-> this attempts s5-1)) + (-> this attempts s5-1 vector) (meters 0.1) (new 'static 'rgba :a #x40) ) @@ -680,7 +674,7 @@ (add-debug-outline-triangle #t (bucket-id debug-no-zbuf1) - (the-as vector (-> v1-3 vertex)) + (-> v1-3 vertex 0) (-> v1-3 vertex 1) (-> v1-3 vertex 2) t1-0 diff --git a/goal_src/jak2/engine/collide/collide-shape-rider.gc b/goal_src/jak2/engine/collide/collide-shape-rider.gc index ce05b6ec11..f88e3a914f 100644 --- a/goal_src/jak2/engine/collide/collide-shape-rider.gc +++ b/goal_src/jak2/engine/collide/collide-shape-rider.gc @@ -21,7 +21,7 @@ (logtest? (-> s5-0 prim-core action) (collide-action rideable)) (logtest? (-> s4-0 prim-core action) (collide-action can-ride)) ) - (let ((f0-4 (- (- (vector-vector-distance (the-as vector (-> s5-0 prim-core)) (the-as vector (-> s4-0 prim-core))) + (let ((f0-4 (- (- (vector-vector-distance (-> s5-0 prim-core world-sphere) (-> s4-0 prim-core world-sphere)) (-> s5-0 prim-core world-sphere w) ) (-> s4-0 prim-core world-sphere w) @@ -51,7 +51,7 @@ (when (and (logtest? (-> s3-0 prim-core collide-with) s4-0) (logtest? (-> s3-0 prim-core action) (collide-action rideable)) ) - (let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> s3-0 prim-core)) (the-as vector (-> arg0 prim-core))) + (let ((f0-2 (- (- (vector-vector-distance (-> s3-0 prim-core world-sphere) (-> arg0 prim-core world-sphere)) (-> s3-0 prim-core world-sphere w) ) (-> arg0 prim-core world-sphere w) @@ -83,7 +83,7 @@ (when (and (logtest? s4-0 (-> s3-0 prim-core collide-as)) (logtest? (-> s3-0 prim-core action) (collide-action can-ride)) ) - (let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> this prim-core)) (the-as vector (-> s3-0 prim-core))) + (let ((f0-2 (- (- (vector-vector-distance (-> this prim-core world-sphere) (-> s3-0 prim-core world-sphere)) (-> this prim-core world-sphere w) ) (-> s3-0 prim-core world-sphere w) @@ -105,14 +105,9 @@ (let ((v1-13 (populate-for-prim-mesh *collide-mesh-cache* this))) (when v1-13 (let* ((s4-1 (new 'stack-no-clear 'collide-tri-result)) - (f0-4 (sphere-on-platform-test - s3-1 - (the-as collide-mesh-cache-tri (-> v1-13 tris)) - s4-1 - (the-as vector (-> arg0 prim-core)) - (-> arg1 best-dist) - ) - ) + (f0-4 + (sphere-on-platform-test s3-1 (-> v1-13 tris 0) s4-1 (-> arg0 prim-core world-sphere) (-> arg1 best-dist)) + ) ) (when (< f0-4 (-> arg1 best-dist)) (set! (-> arg1 best-dist) f0-4) @@ -193,14 +188,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-0 a2-5) - (f1-1 (+ (-> a1-2 world-sphere w) (-> s4-0 prim-core world-sphere w))) - ) - (when (< f0-0 (* f1-1 f1-1)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-2 world-sphere w) (-> s4-0 prim-core world-sphere w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -234,14 +225,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-1 a2-12) - (f1-5 (+ (-> a1-14 world-sphere w) (-> s4-0 prim-core world-sphere w))) - ) - (when (< f0-1 (* f1-5 f1-5)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-14 world-sphere w) (-> s4-0 prim-core world-sphere w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) diff --git a/goal_src/jak2/engine/collide/collide-shape.gc b/goal_src/jak2/engine/collide/collide-shape.gc index f454c0d007..c51b475e64 100644 --- a/goal_src/jak2/engine/collide/collide-shape.gc +++ b/goal_src/jak2/engine/collide/collide-shape.gc @@ -934,103 +934,94 @@ it returns a triangle and normal direction to push in. (defun cshape-reaction-update-state ((arg0 control-info) (arg1 collide-query) (arg2 vector)) "Common update for cshape reaction." - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 collide-status) (sv-96 symbol)) - (set! sv-48 (new-stack-vector0)) - (set! sv-52 (new-stack-vector0)) - (set! sv-56 (collide-status)) - - ;; do the move! - (let ((a1-1 (new 'stack-no-clear 'vector))) - (vector-float*! a1-1 (-> arg1 move-dist) (-> arg1 best-dist)) - (move-by-vector! arg0 a1-1) - ) - - ;; do reactions - (react-to-pat! arg0 (-> arg1 best-other-tri pat)) - - ;; direction to the collision point - (vector-! sv-48 (the-as vector (-> arg1 best-my-prim prim-core)) (-> arg1 best-other-tri intersect)) - - ;; compute "coverage". this is a measure of how much the triangle below us "supports" us. - (cond - ((and (= (-> arg1 best-dist) 0.0) ;; can't move - (< (vector-length sv-48) (+ -40.96 (-> arg1 best-my-prim prim-core world-sphere w))) ;; 1m in collision! - ) - - ;; hack: things have gone very wrong. - ;; added print - ;; (format 0 "very far in collision hack running~%") - (set! (-> sv-48 quad) (-> arg1 best-other-tri normal quad)) ;; just use the triangle's normal, things are bad. - (set! (-> arg0 coverage) 0.0) - ) - (else - (set! (-> sv-48 w) 1.0) - (vector-normalize! sv-48 1.0) - ;; dot with normal is the coverage - (set! (-> arg0 coverage) (vector-dot sv-48 (-> arg1 best-other-tri normal))) - ;; hack - (when (< (-> arg0 coverage) 0.0) - ;; no idea how this can happen, but cheat things to project to the plane of the triangle. - (set! (-> arg0 coverage) 0.0) ;; would be 0 - ;; projects to plane - (vector-flatten! sv-48 sv-48 (-> arg1 best-other-tri normal)) + (let ((sv-48 (new-stack-vector0)) + (sv-52 (new-stack-vector0)) + (sv-56 (collide-status)) + ) + ;; do the move! + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-float*! a1-1 (-> arg1 move-dist) (-> arg1 best-dist)) + (move-by-vector! arg0 a1-1) + ) + ;; do reactions + (react-to-pat! arg0 (-> arg1 best-other-tri pat)) + ;; direction to the collision point + (vector-! sv-48 (-> arg1 best-my-prim prim-core world-sphere) (-> arg1 best-other-tri intersect)) + ;; compute "coverage". this is a measure of how much the triangle below us "supports" us. + (cond + ((and (= (-> arg1 best-dist) 0.0) ;; can't move + (< (vector-length sv-48) (+ -40.96 (-> arg1 best-my-prim prim-core world-sphere w))) ;; 1m in collision! + ) + ;; hack: things have gone very wrong. + ;; added print + ;; (format 0 "very far in collision hack running~%") + (set! (-> sv-48 quad) (-> arg1 best-other-tri normal quad)) ;; just use the triangle's normal, things are bad. + (set! (-> arg0 coverage) 0.0) + ) + (else + (set! (-> sv-48 w) 1.0) (vector-normalize! sv-48 1.0) + ;; dot with normal is the coverage + (set! (-> arg0 coverage) (vector-dot sv-48 (-> arg1 best-other-tri normal))) + ;; hack + (when (< (-> arg0 coverage) 0.0) + ;; no idea how this can happen, but cheat things to project to the plane of the triangle. + (set! (-> arg0 coverage) 0.0) ;; would be 0 + ;; projects to plane + (vector-flatten! sv-48 sv-48 (-> arg1 best-other-tri normal)) + (vector-normalize! sv-48 1.0) + ) ) ) + ;; ?? + (set! (-> sv-52 quad) (-> sv-48 quad)) + ;; hack: if we can't move, move out, but only a very small amount. + (if (= (-> arg1 best-dist) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-52 6.0)) + ) + ;; fill out normals/angles + (set! (-> arg0 poly-normal quad) (-> arg1 best-other-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-52 arg2) + ;; flags! + (if (< (-> arg0 poly-angle) -0.2) + (logior! sv-56 (collide-status touch-ceiling)) + ) + (let ((sv-96 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) + ;; if we hit this function, we hit some surface + (logior! sv-56 (collide-status touch-surface)) + ;; if the thing we hit is spheres, it's not water or background. + (if (-> arg1 num-spheres) + (logior! sv-56 (collide-status touch-actor)) + ) + (cond + (sv-96 + ;; on a wall + (logior! sv-56 (collide-status touch-wall)) + (set! (-> arg0 cur-pat mode) 1) + ) + (else + ;; on the ground + (logior! sv-56 (collide-status on-surface)) + (set! (-> arg0 local-normal quad) (-> sv-52 quad)) + ) + ) + (when (and (not sv-96) (>= (-> arg0 coverage) 0.9)) + ;; on the ground, and not slipping off an edge. + (logior! sv-56 (collide-status on-ground)) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (when (!= (-> arg0 poly-pat mode) (pat-mode wall)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 grount-touch-point quad) (-> arg1 best-other-tri intersect quad)) + ) + ) + ) + ;; catch transition to ground. + (when (not (logtest? (-> arg0 prev-status) (collide-status on-surface))) + (logior! sv-56 (collide-status impact-surface)) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + ) + (logior! (-> arg0 status) sv-56) ) - ;; ?? - (let ((v1-25 (-> sv-48 quad))) - (set! (-> sv-52 quad) v1-25) - ) - ;; hack: if we can't move, move out, but only a very small amount. - (if (= (-> arg1 best-dist) 0.0) - (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-52 6.0)) - ) - - ;; fill out normals/angles - (set! (-> arg0 poly-normal quad) (-> arg1 best-other-tri normal quad)) - (collide-shape-moving-angle-set! arg0 sv-52 arg2) - - ;; flags! - (if (< (-> arg0 poly-angle) -0.2) - (set! sv-56 (logior sv-56 (collide-status touch-ceiling))) - ) - (set! sv-96 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) - - ;; if we hit this function, we hit some surface - (set! sv-56 (logior sv-56 (collide-status touch-surface))) - - ;; if the thing we hit is spheres, it's not water or background. - (if (-> arg1 num-spheres) - (set! sv-56 (logior sv-56 (collide-status touch-actor))) - ) - (cond - (sv-96 - ;; on a wall - (set! sv-56 (logior sv-56 (collide-status touch-wall))) - (set! (-> arg0 cur-pat mode) 1) - ) - (else - ;; on the ground - (set! sv-56 (logior sv-56 (collide-status on-surface))) - (set! (-> arg0 local-normal quad) (-> sv-52 quad)) - ) - ) - (when (and (not sv-96) (>= (-> arg0 coverage) 0.9)) - ;; on the ground, and not slipping off an edge. - (set! sv-56 (logior sv-56 (collide-status on-ground))) - (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) - (when (!= (-> arg0 poly-pat mode) (pat-mode wall)) - (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) - (set! (-> arg0 grount-touch-point quad) (-> arg1 best-other-tri intersect quad)) - ) - ) - ;; catch transition to ground. - (when (not (logtest? (-> arg0 prev-status) (collide-status on-surface))) - (set! sv-56 (logior sv-56 (collide-status impact-surface))) - (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) - ) - (logior! (-> arg0 status) sv-56) 0 (none) ) @@ -1101,108 +1092,100 @@ it returns a triangle and normal direction to push in. (defmethod step-collison! ((this collide-shape-moving) (arg0 vector) (arg1 vector) (arg2 float) (arg3 int)) "Main function to move forward until we hit a single thing, then react." - (local-vars (sv-592 int)) - (with-pp - (let ((s5-0 (new 'stack 'collide-query)) - (s2-0 (new 'stack-no-clear 'vector)) - ) - ;; figure out how far we want to move - (vector-float*! s2-0 arg1 (* arg2 (seconds-per-frame))) - ;; setup collision query - (set! (-> s5-0 move-dist quad) (-> s2-0 quad)) - (set! (-> s5-0 best-dist) -100000000.0) - (set! (-> s5-0 best-my-prim) #f) - (set! (-> s5-0 num-spheres) (the-as uint #f)) - (let* ((s1-1 (-> this root-prim)) - (v1-5 *collide-cache*) - (s0-0 (the-as collide-cache-prim (-> v1-5 prims))) - ) - (set! sv-592 (-> v1-5 num-prims)) - - ;; collide against everything in the collide cache - (while (nonzero? sv-592) - (set! sv-592 (+ sv-592 -1)) - (when (logtest? (-> s1-1 prim-core collide-with) (-> s0-0 prim-core collide-as)) - (if (>= (the-as int (-> s0-0 prim-core prim-type)) 0) - (collide-with-collide-cache-prim-mesh s1-1 s5-0 s0-0) - (collide-with-collide-cache-prim-sphere s1-1 s5-0 s0-0) - ) - ) - (&+! s0-0 48) - ) + (let ((s5-0 (new 'stack 'collide-query)) + (s2-0 (new 'stack-no-clear 'vector)) ) - - ;; see how far we can move - (let ((f30-0 (-> s5-0 best-dist))) - (set! f30-0 (cond - ((>= f30-0 0.0) ;; set a positive value, means we can't move all the way! - - ;; remember velocity before reaction - (let ((s2-1 (new 'stack-no-clear 'vector))) - (if *display-collision-marks* - (set! (-> s2-1 quad) (-> arg1 quad)) + ;; figure out how far we want to move + (vector-float*! s2-0 arg1 (* arg2 (seconds-per-frame))) + ;; setup collision query + (set! (-> s5-0 move-dist quad) (-> s2-0 quad)) + (set! (-> s5-0 best-dist) -100000000.0) + (set! (-> s5-0 best-my-prim) #f) + (set! (-> s5-0 num-spheres) (the-as uint #f)) + (let* ((s1-1 (-> this root-prim)) + (v1-5 *collide-cache*) + (s0-0 (the-as collide-cache-prim (-> v1-5 prims))) + (sv-592 (-> v1-5 num-prims)) + ) + ;; collide against everything in the collide cache + (while (nonzero? sv-592) + (+! sv-592 -1) + (when (logtest? (-> s1-1 prim-core collide-with) (-> s0-0 prim-core collide-as)) + (if (>= (the-as int (-> s0-0 prim-core prim-type)) 0) + (collide-with-collide-cache-prim-mesh s1-1 s5-0 s0-0) + (collide-with-collide-cache-prim-sphere s1-1 s5-0 s0-0) + ) + ) + (&+! s0-0 48) + ) + ) + ;; see how far we can move + (let ((f30-0 (-> s5-0 best-dist))) + (set! f30-0 (cond + ((>= f30-0 0.0) ;; set a positive value, means we can't move all the way! + ;; remember velocity before reaction + (let ((s2-1 (new 'stack-no-clear 'vector))) + (if *display-collision-marks* + (set! (-> s2-1 quad) (-> arg1 quad)) + ) + ;; handle collision. will move us. + (set! (-> this prev-status) ((-> this reaction) (the-as control-info this) s5-0 arg0 arg1)) + ;; debug draw + (when *display-collision-marks* + (let ((t1-0 (-> *pat-mode-info* (-> s5-0 best-other-tri pat mode) hilite-color))) + (add-debug-outline-triangle + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> s5-0 best-other-tri)) + (-> s5-0 best-other-tri vertex 1) + (-> s5-0 best-other-tri vertex 2) + t1-0 ) - - ;; handle collision. will move us. - (set! (-> this prev-status) ((-> this reaction) (the-as control-info this) s5-0 arg0 arg1)) - - ;; debug draw - (when *display-collision-marks* - (let ((t1-0 (-> *pat-mode-info* (-> s5-0 best-other-tri pat mode) hilite-color))) - (add-debug-outline-triangle + ) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 best-other-tri intersect) + s2-1 + (meters 0.00007324219) + (new 'static 'rgba :r #xff :g #xa0 :a #x80) + ) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 best-other-tri intersect) + arg0 + (meters 0.00007324219) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + ) + (if (= (-> this process type) target) + (add-debug-vector #t (bucket-id debug-no-zbuf1) - (the-as vector (-> s5-0 best-other-tri)) - (-> s5-0 best-other-tri vertex 1) - (-> s5-0 best-other-tri vertex 2) - t1-0 + (-> s5-0 best-other-tri intersect) + (-> this surface-normal) + (meters 0.5) + (-> *pat-mode-info* (-> this cur-pat mode) hilite-color) ) ) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (-> s5-0 best-other-tri intersect) - s2-1 - (meters 0.00007324219) - (new 'static 'rgba :r #xff :g #xa0 :a #x80) - ) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (-> s5-0 best-other-tri intersect) - arg0 - (meters 0.00007324219) - (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) - ) - (if (= (-> this process type) target) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (-> s5-0 best-other-tri intersect) - (-> this surface-normal) - (meters 0.5) - (-> *pat-mode-info* (-> this cur-pat mode) hilite-color) - ) - ) - ) ) - ;; return how far we went. - f30-0 ) - (else - ;; didn't collide. call no reaction and clear stuff - (set! (-> this reaction-flag) (cshape-reaction-flags)) - ((-> this no-reaction) this s5-0 arg0 arg1) - (set! (-> this prev-status) (collide-status)) - ;; move all the way - (move-by-vector! this s2-0) - (set! (-> arg0 quad) (-> arg1 quad)) - 1.0 ;; return 1 to indicate that we did the whole thing. - ) + ;; return how far we went. + f30-0 + ) + (else + ;; didn't collide. call no reaction and clear stuff + (set! (-> this reaction-flag) (cshape-reaction-flags)) + ((-> this no-reaction) this s5-0 arg0 arg1) + (set! (-> this prev-status) (collide-status)) + ;; move all the way + (move-by-vector! this s2-0) + (set! (-> arg0 quad) (-> arg1 quad)) + 1.0 ;; return 1 to indicate that we did the whole thing. ) - ) - f30-0 - ) + ) + ) + f30-0 ) ) ) @@ -1870,51 +1853,50 @@ it returns a triangle and normal direction to push in. ) (defmethod move-to-ground ((this collide-shape-moving) (arg0 float) (arg1 float) (arg2 symbol) (arg3 collide-spec)) - "Find the ground a move to it." - (local-vars (sv-576 profile-segment) (sv-592 int)) + "Find the ground and move to it." (with-profiler 'collide *profile-collide-color* (let ((s1-1 (new 'stack-no-clear 'collide-query))) (cond ((find-ground this s1-1 arg3 arg0 arg1 1024.0) - (let ((a1-4 (new 'stack-no-clear 'vector))) - (set! (-> a1-4 quad) (-> this trans quad)) - (set! (-> a1-4 y) (-> s1-1 best-other-tri intersect y)) - (move-to-point! this a1-4) - ) - (let ((a1-5 (-> s1-1 best-other-tri intersect)) - (a0-19 (-> s1-1 best-other-tri normal)) - (v1-25 (-> s1-1 best-other-tri pat)) - ) - (set! (-> this grount-touch-point quad) (-> a1-5 quad)) - (set! (-> this poly-normal quad) (-> a0-19 quad)) - (set! (-> this surface-normal quad) (-> a0-19 quad)) - (set! (-> this local-normal quad) (-> a0-19 quad)) - (set! (-> this ground-poly-normal quad) (-> a0-19 quad)) - (set! (-> this poly-pat) v1-25) - (set! (-> this cur-pat) v1-25) - (set! (-> this ground-pat) v1-25) - ) - (logior! (-> this status) (collide-status on-surface on-ground touch-surface)) - #t - ) + (let ((a1-4 (new 'stack-no-clear 'vector))) + (set! (-> a1-4 quad) (-> this trans quad)) + (set! (-> a1-4 y) (-> s1-1 best-other-tri intersect y)) + (move-to-point! this a1-4) + ) + (let ((a1-5 (-> s1-1 best-other-tri intersect)) + (a0-19 (-> s1-1 best-other-tri normal)) + (v1-25 (-> s1-1 best-other-tri pat)) + ) + (set! (-> this grount-touch-point quad) (-> a1-5 quad)) + (set! (-> this poly-normal quad) (-> a0-19 quad)) + (set! (-> this surface-normal quad) (-> a0-19 quad)) + (set! (-> this local-normal quad) (-> a0-19 quad)) + (set! (-> this ground-poly-normal quad) (-> a0-19 quad)) + (set! (-> this poly-pat) v1-25) + (set! (-> this cur-pat) v1-25) + (set! (-> this ground-pat) v1-25) + ) + (logior! (-> this status) (collide-status on-surface on-ground touch-surface)) + #t + ) (else (logclear! (-> this status) (collide-status - on-surface - on-ground - touch-surface - touch-wall - touch-ceiling - touch-actor - on-special-surface - touch-edge - blocked - on-water - impact-surface - touch-background - stuck - glance - ) - ) + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) (when (not (logtest? (-> this root-prim prim-core action) (collide-action no-normal-reset))) (let ((v1-36 (-> this dynam gravity-normal))) (set! (-> this local-normal quad) (-> v1-36 quad)) @@ -2474,6 +2456,7 @@ it returns a triangle and normal direction to push in. (defmethod do-push-aways ((this collide-shape)) "Push away things." + ;; og:preserve-this float -> int (local-vars (at-0 int) (v1-55 int) (a2-5 float) (a2-12 float)) (with-pp (rlet ((vf0 :class vf) @@ -2518,14 +2501,10 @@ it returns a triangle and normal direction to push in. (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-0 a2-5) - (f1-1 (+ (-> a1-2 world-sphere w) (-> this root-prim prim-core world-sphere w))) - ) - (when (< f0-0 (* f1-1 f1-1)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-2 world-sphere w) (-> this root-prim prim-core world-sphere w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -2561,14 +2540,10 @@ it returns a triangle and normal direction to push in. (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-1 a2-12) - (f1-5 (+ (-> a1-15 world-sphere w) (-> this root-prim prim-core world-sphere w))) - ) - (when (< f0-1 (* f1-5 f1-5)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-15 world-sphere w) (-> this root-prim prim-core world-sphere w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -2706,11 +2681,7 @@ it returns a triangle and normal direction to push in. (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-0 a2-5) - (f1-1 (+ (-> a1-3 world-sphere w) (-> s3-0 prim-core world-sphere w))) - ) - (b! (>= f0-0 (* f1-1 f1-1)) cfg-8 :delay #f) - ) + (b! (>= a2-5 (square (+ (-> a1-3 world-sphere w) (-> s3-0 prim-core world-sphere w)))) cfg-8 :delay #f) ) ) (b! (>= *actor-list-length* 256) cfg-8 :delay #f) @@ -2747,11 +2718,7 @@ it returns a triangle and normal direction to push in. (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-1 a2-12) - (f1-5 (+ (-> a1-15 world-sphere w) (-> s3-0 prim-core world-sphere w))) - ) - (b! (>= f0-1 (* f1-5 f1-5)) cfg-17 :delay #f) - ) + (b! (>= a2-12 (square (+ (-> a1-15 world-sphere w) (-> s3-0 prim-core world-sphere w)))) cfg-17 :delay #f) ) ) (b! (>= *actor-list-length* 256) cfg-17 :delay #f) @@ -3065,7 +3032,6 @@ it returns a triangle and normal direction to push in. ) (defmethod send-shoves ((this collide-shape) (arg0 process) (arg1 touching-shapes-entry) (arg2 float) (arg3 float) (arg4 float)) - (local-vars (sv-144 process) (sv-160 collide-shape-prim) (sv-176 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -3073,51 +3039,48 @@ it returns a triangle and normal direction to push in. ) (init-vf0-vector) (when arg1 - (let ((s0-0 (-> arg1 head))) - (set! sv-144 arg0) - (let ((gp-0 (if (type? sv-144 process-focusable) - sv-144 - ) - ) - ) - (when (and s0-0 gp-0) - (while s0-0 - (set! sv-160 (get-touched-prim s0-0 this arg1)) + (let ((s0-0 (-> arg1 head)) + (gp-0 (the-as process (as-type arg0 process-focusable))) + ) + (when (and s0-0 gp-0) + (while s0-0 + (let ((sv-160 (get-touched-prim s0-0 this arg1))) (get-touched-prim s0-0 (-> (the-as process-focusable gp-0) root) arg1) (when (logtest? (-> sv-160 prim-core action) (collide-action no-standon)) - (let ((v1-12 (get-middle-of-bsphere-overlap s0-0 (new 'stack-no-clear 'vector)))) - (set! sv-176 (new 'stack-no-clear 'vector)) + (let ((v1-12 (get-middle-of-bsphere-overlap s0-0 (new 'stack-no-clear 'vector))) + (sv-176 (new 'stack-no-clear 'vector)) + ) (let ((a0-7 (-> sv-160 prim-core))) (.lvf vf4 (&-> v1-12 quad)) (.lvf vf5 (&-> a0-7 world-sphere quad)) ) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-176 quad) vf6) - (vector-normalize! sv-176 1.0) - (when (and (< arg2 (-> sv-176 y)) (and (not (focus-test? (the-as process-focusable gp-0) dead hit board mech)) - (< (-> (the-as process-focusable gp-0) root transv y) 4.096) - ) - ) - (let ((s2-1 (new 'stack-no-clear 'vector))) - (set! (-> s2-1 quad) (-> (the-as process-focusable gp-0) root transv quad)) - (let* ((v1-26 (-> (the-as process-focusable gp-0) root transv)) - (f30-0 (sqrtf (+ (* (-> v1-26 x) (-> v1-26 x)) (* (-> v1-26 z) (-> v1-26 z))))) - ) - (if (= f30-0 0.0) - (set! (-> s2-1 quad) (-> (vector-z-quaternion! s2-1 (-> (the-as process-focusable gp-0) root quat)) quad)) - ) - (vector-xz-normalize! s2-1 (fmax f30-0 arg4)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-176 quad) vf6) + (vector-normalize! sv-176 1.0) + (when (and (< arg2 (-> sv-176 y)) (and (not (focus-test? (the-as process-focusable gp-0) dead hit board mech)) + (< (-> (the-as process-focusable gp-0) root transv y) 4.096) + ) + ) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (set! (-> s2-1 quad) (-> (the-as process-focusable gp-0) root transv quad)) + (let* ((v1-26 (-> (the-as process-focusable gp-0) root transv)) + (f30-0 (sqrtf (+ (* (-> v1-26 x) (-> v1-26 x)) (* (-> v1-26 z) (-> v1-26 z))))) + ) + (if (= f30-0 0.0) + (set! (-> s2-1 quad) (-> (vector-z-quaternion! s2-1 (-> (the-as process-focusable gp-0) root quat)) quad)) + ) + (vector-xz-normalize! s2-1 (fmax f30-0 arg4)) + ) + (set! (-> s2-1 y) arg3) + (send-event gp-0 'shove arg1 (static-attack-info ((id (new-attack-id)) (vector s2-1) (angle 'jump)))) ) - (set! (-> s2-1 y) arg3) - (send-event gp-0 'shove arg1 (static-attack-info ((id (new-attack-id)) (vector s2-1) (angle 'jump)))) + (return #t) ) - (return #t) ) ) - (set! s0-0 (-> s0-0 next)) ) + (set! s0-0 (-> s0-0 next)) ) ) ) diff --git a/goal_src/jak2/engine/collide/find-nearest.gc b/goal_src/jak2/engine/collide/find-nearest.gc index d9863cf72c..59a6f714da 100644 --- a/goal_src/jak2/engine/collide/find-nearest.gc +++ b/goal_src/jak2/engine/collide/find-nearest.gc @@ -52,33 +52,19 @@ (when (and (logtest? (process-mask crate enemy collectable guard) (-> arg0 mask)) (not (logtest? (process-mask no-track) (-> arg0 mask))) ) - (let* ((gp-0 *search-info*) - (s4-0 arg0) - (s5-0 (if (type? s4-0 process-drawable) - s4-0 - ) - ) - ) + (let ((gp-0 *search-info*) + (s5-0 (as-type arg0 process-drawable)) + ) (when s5-0 - (let* ((s4-1 (-> s5-0 root)) - (s3-0 (if (type? s4-1 collide-shape) - s4-1 - ) - ) - ) + (let ((s3-0 (the-as trsqv (as-type (-> s5-0 root) collide-shape)))) (when s3-0 (let* ((s4-2 (the-as structure (-> (the-as collide-shape s3-0) root-prim prim-core))) - (f30-0 (- (vector-vector-distance (-> gp-0 point) (the-as vector s4-2)) + (f30-0 (- (vector-vector-distance (-> gp-0 point) (-> (the-as collide-prim-core s4-2) world-sphere)) (-> (the-as collide-prim-core s4-2) world-sphere w) ) ) ) - (let* ((s1-0 s5-0) - (s2-0 (if (type? s1-0 process-focusable) - s1-0 - ) - ) - ) + (let ((s2-0 (the-as process-drawable (as-type s5-0 process-focusable)))) (if (and (type? s2-0 process-focusable) s2-0 s2-0 @@ -215,12 +201,6 @@ (arg6 vector) (arg7 float) ) - (local-vars - (sv-704 (function float float float)) - (sv-720 float) - (sv-736 (function float float float)) - (sv-752 float) - ) (with-pp (let ((gp-0 *search-info*)) (set! (-> gp-0 match) #f) @@ -250,11 +230,7 @@ (while (begin (label cfg-89) (nonzero? s4-0)) (+! s4-0 -1) (let* ((s1-0 (-> arg0 s4-0)) - (s2-0 (-> s1-0 process)) - (s3-0 (if (type? s2-0 process-focusable) - s2-0 - ) - ) + (s3-0 (the-as process-drawable (as-type (-> s1-0 process) process-focusable))) ) (when (and (and s3-0 (not (logtest? (-> (the-as process-focusable s3-0) focus-status) (focus-status disable dead)))) (and (logtest? (process-mask crate enemy collectable guard) (-> s3-0 mask)) @@ -270,11 +246,7 @@ (let* ((s0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) s2-1 (-> gp-0 point)) 1.0)) (f28-0 (cond ((logtest? (-> gp-0 mask) (search-info-flag prefer-xz)) - (set! sv-704 deg-diff) - (set! sv-720 (vector-y-angle (-> gp-0 rot-base))) - (let ((a1-7 (vector-y-angle s0-0))) - (fabs (sv-704 sv-720 a1-7)) - ) + (fabs (deg-diff (vector-y-angle (-> gp-0 rot-base)) (vector-y-angle s0-0))) ) ((logtest? (-> gp-0 mask) (search-info-flag prefer-angle)) (- -9999.0 (vector-dot s0-0 (-> gp-0 rot-base))) @@ -308,15 +280,9 @@ ) ) ((logtest? (-> gp-0 mask) (search-info-flag cull-xz)) - (let ((f26-3 (-> gp-0 rot-range))) - (set! sv-736 deg-diff) - (set! sv-752 (vector-y-angle (-> gp-0 rot-base))) - (let ((a1-10 (vector-y-angle s0-0))) - (if (< f26-3 (fabs (sv-736 sv-752 a1-10))) - (goto cfg-89) - ) + (if (< (-> gp-0 rot-range) (fabs (deg-diff (vector-y-angle (-> gp-0 rot-base)) (vector-y-angle s0-0)))) + (goto cfg-89) ) - ) ) ) (when (logtest? (-> gp-0 mask) (search-info-flag back-point)) diff --git a/goal_src/jak2/engine/common_objs/basebutton.gc b/goal_src/jak2/engine/common_objs/basebutton.gc index 2024104168..a0436fe9bc 100644 --- a/goal_src/jak2/engine/common_objs/basebutton.gc +++ b/goal_src/jak2/engine/common_objs/basebutton.gc @@ -268,9 +268,9 @@ (defmethod send-event! ((this basebutton) (event-type symbol)) "Prepares an [[event-message-block]] using the provided type to send an event to: -- the `notify-actor` -- every [[entity-actor]] in the `actor-group` array -@see [[entity-actor]]" + - the `notify-actor` + - every [[entity-actor]] in the `actor-group` array + @see [[entity-actor]]" (when event-type (let ((event (new 'stack-no-clear 'event-message-block))) (set! (-> event from) (process->ppointer self)) @@ -394,12 +394,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this basebutton) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" - (local-vars (sv-16 res-tag)) + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (reset! this) (set! (-> this button-id) -1) (let ((v1-4 (res-lump-value (-> this entity) 'extra-id uint128 :default (the-as uint128 -1) :time -1000000000.0))) @@ -414,8 +413,9 @@ This commonly includes things such as: (logclear! (-> this button-status) (button-status pressed)) ) (set! (-> this notify-actor) (entity-actor-lookup arg0 'alt-actor 0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-15 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-15 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-15 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-15)) diff --git a/goal_src/jak2/engine/common_objs/blocking-plane.gc b/goal_src/jak2/engine/common_objs/blocking-plane.gc index c010c0f01f..e52798ef9f 100644 --- a/goal_src/jak2/engine/common_objs/blocking-plane.gc +++ b/goal_src/jak2/engine/common_objs/blocking-plane.gc @@ -113,25 +113,21 @@ (vector+! (-> s2-1 trans) s3-0 s4-0) (vector-float*! (-> s2-1 trans) (-> s2-1 trans) 0.5) (+! (-> s2-1 trans y) (/ height 2)) - (vector-! (the-as vector (-> s1-0 vector)) s4-0 s3-0) - (let ((f30-1 (vector-normalize-ret-len! (the-as vector (-> s1-0 vector)) 1.0))) + (vector-! (-> s1-0 vector 0) s4-0 s3-0) + (let ((f30-1 (vector-normalize-ret-len! (-> s1-0 vector 0) 1.0))) (set! (-> s2-1 scale x) (/ f30-1 METER_LENGTH)) (set! (-> s2-1 scale y) (/ height METER_LENGTH)) (set! (-> s2-1 scale z) 0.0) (set! (-> s1-0 vector 1 quad) (-> (new 'static 'vector :y 1.0 :w 1.0) quad)) - (vector-cross! (-> s1-0 vector 2) (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1)) + (vector-cross! (-> s1-0 vector 2) (-> s1-0 vector 0) (-> s1-0 vector 1)) (vector-normalize! (-> s1-0 vector 2) 1.0) (matrix->quaternion (-> s2-1 quat) s1-0) - (let ((v1-20 (-> this root root-prim local-sphere))) - (set! (-> v1-20 x) 0.0) - (set! (-> v1-20 y) (* 0.00024414062 (/ height 2))) - (set! (-> v1-20 z) 0.0) - (let ((f0-17 0.5) - (f1-7 (* f30-1 f30-1)) - (f2-2 height) - ) - (set! (-> v1-20 w) (* f0-17 (sqrtf (+ f1-7 (* f2-2 f2-2))))) - ) + (set-vector! + (-> this root root-prim local-sphere) + 0.0 + (* 0.00024414062 (/ height 2)) + 0.0 + (* 0.5 (sqrtf (+ (square f30-1) (square height)))) ) ) ) diff --git a/goal_src/jak2/engine/common_objs/conveyor.gc b/goal_src/jak2/engine/common_objs/conveyor.gc index 35c947e00f..6fef041336 100644 --- a/goal_src/jak2/engine/common_objs/conveyor.gc +++ b/goal_src/jak2/engine/common_objs/conveyor.gc @@ -70,19 +70,18 @@ (defmethod init! ((this conveyor)) "Initializes defaults for things like the `speed` and `belt-radius`" - (local-vars (tag res-tag)) (set! (-> this speed) 24576.0) (set! (-> this belt-radius) 11878.4) (set! (-> this pull-y-threshold) 10240.0) (set! (-> this speed-mult-array) #f) (set! (-> this speed-mult-array-len) 0) - (let ((entity (-> this entity))) - (set! tag (new 'static 'res-tag)) - (let ((scale-factor (res-lump-data entity 'scale-factor pointer :tag-ptr (& tag)))) - (when scale-factor - (set! (-> this speed-mult-array) (the-as (array float) scale-factor)) - (set! (-> this speed-mult-array-len) (the-as int (-> tag elt-count))) - ) + (let* ((entity (-> this entity)) + (tag (new 'static 'res-tag)) + (scale-factor (res-lump-data entity 'scale-factor pointer :tag-ptr (& tag))) + ) + (when scale-factor + (set! (-> this speed-mult-array) (the-as (array float) scale-factor)) + (set! (-> this speed-mult-array-len) (the-as int (-> tag elt-count))) ) ) 0 @@ -92,7 +91,7 @@ ;; WARN: Return type mismatch object vs ambient-sound. (defmethod set-and-get-ambient-sound! ((this conveyor)) "So long as [[actor-option::16]] is not set, fetch the [[ambient-sound]] for the [[conveyor]] -and return it as well. Otherwise, set it to `0`" + and return it as well. Otherwise, set it to `0`" (let ((actor-options (res-lump-value (-> this entity) 'options actor-option :time -1000000000.0))) (the-as ambient-sound @@ -195,11 +194,7 @@ and return it as well. Otherwise, set it to `0`" (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-0 a2-5) - (f1-1 (+ (-> a1-2 world-sphere w) (-> this collide-bounds r))) - ) - (b! (>= f0-0 (* f1-1 f1-1)) cfg-8 :delay #f) - ) + (b! (>= a2-5 (square (+ (-> a1-2 world-sphere w) (-> this collide-bounds r)))) cfg-8 :delay #f) ) (when (< *actor-list-length* 256) (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) @@ -236,11 +231,7 @@ and return it as well. Otherwise, set it to `0`" (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-1 a2-12) - (f1-5 (+ (-> a1-14 world-sphere w) (-> this collide-bounds r))) - ) - (b! (>= f0-1 (* f1-5 f1-5)) cfg-17 :delay #f) - ) + (b! (>= a2-12 (square (+ (-> a1-14 world-sphere w) (-> this collide-bounds r)))) cfg-17 :delay #f) ) (when (< *actor-list-length* 256) (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) @@ -276,11 +267,7 @@ and return it as well. Otherwise, set it to `0`" (.mov a0-10 vf3) (let ((s4-0 (-> v1-23 process))) (b! (< f0-2 a0-10) cfg-27) - (let ((a1-29 (if (type? s4-0 process-focusable) - (the-as process-focusable s4-0) - ) - ) - ) + (let ((a1-29 (as-type s4-0 process-focusable))) (if a1-29 (conveyor-method-26 this a1-29) ) @@ -298,7 +285,6 @@ and return it as well. Otherwise, set it to `0`" (defmethod conveyor-method-21 ((this conveyor)) "TODO - quite dense, has to do with the conveyor sections and the path they are associated with" - (local-vars (sv-32 conveyor-section) (sv-48 conveyor-section)) (let* ((s5-0 (-> this path)) (s4-0 (-> s5-0 curve num-cverts)) (s3-0 (new 'stack-no-clear 'vector)) @@ -308,26 +294,28 @@ and return it as well. Otherwise, set it to `0`" (set! (-> this collide-bounds quad) (the-as uint128 0)) (get-point-in-path! s5-0 s3-0 0.0 'exact) (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) - (let ((s1-0 (+ s4-0 -1))) - (set! sv-32 (the-as conveyor-section #f)) - (dotimes (s0-0 s1-0) - (set! sv-48 (-> s2-0 data s0-0)) - (set! (-> sv-48 start quad) (-> s3-0 quad)) - (get-point-in-path! s5-0 s3-0 (the float (+ s0-0 1)) 'exact) - (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) - (vector-! (-> sv-48 pull-dir) s3-0 (-> sv-48 start)) - (vector-normalize! (-> sv-48 pull-dir) 1.0) - (set! (-> sv-48 trailing quad) (-> sv-48 pull-dir quad)) - (set! (-> sv-48 trailing y) 0.0) - (vector-normalize! (-> sv-48 trailing) 1.0) - (set-vector! (-> sv-48 radial-dir) (- (-> sv-48 trailing z)) 0.0 (-> sv-48 trailing x) 1.0) - (set! (-> sv-48 trailing w) (- (vector-dot s3-0 (the-as vector (-> sv-48 trailing))))) - (when (the-as vector sv-32) - (vector+! (&+ (the-as vector sv-32) 16) (&+ (the-as vector sv-32) 16) (the-as vector (-> sv-48 trailing))) - (vector-normalize! (&+ (the-as vector sv-32) 16) 1.0) - (set! (-> sv-32 trailing w) (- (vector-dot (-> sv-48 start) (&+ (the-as vector sv-32) 16)))) + (let ((s1-0 (+ s4-0 -1)) + (sv-32 (the-as conveyor-section #f)) + ) + (dotimes (s0-0 s1-0) + (let ((sv-48 (-> s2-0 data s0-0))) + (set! (-> sv-48 start quad) (-> s3-0 quad)) + (get-point-in-path! s5-0 s3-0 (the float (+ s0-0 1)) 'exact) + (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) + (vector-! (-> sv-48 pull-dir) s3-0 (-> sv-48 start)) + (vector-normalize! (-> sv-48 pull-dir) 1.0) + (set! (-> sv-48 trailing quad) (-> sv-48 pull-dir quad)) + (set! (-> sv-48 trailing y) 0.0) + (vector-normalize! (-> sv-48 trailing) 1.0) + (set-vector! (-> sv-48 radial-dir) (- (-> sv-48 trailing z)) 0.0 (-> sv-48 trailing x) 1.0) + (set! (-> sv-48 trailing w) (- (vector-dot s3-0 (the-as vector (-> sv-48 trailing))))) + (when (the-as vector sv-32) + (vector+! (&+ (the-as vector sv-32) 16) (&+ (the-as vector sv-32) 16) (the-as vector (-> sv-48 trailing))) + (vector-normalize! (&+ (the-as vector sv-32) 16) 1.0) + (set! (-> sv-32 trailing w) (- (vector-dot (-> sv-48 start) (&+ (the-as vector sv-32) 16)))) + ) + (set! sv-32 sv-48) ) - (set! sv-32 sv-48) sv-32 ) ) @@ -336,7 +324,7 @@ and return it as well. Otherwise, set it to `0`" (set! (-> this leading quad) (-> s2-1 0 pull-dir quad)) (set! (-> this leading y) 0.0) (vector-normalize! (-> this leading) 1.0) - (set! (-> this leading w) (- (vector-dot (the-as vector (-> s2-1 0)) (the-as vector (-> this leading))))) + (set! (-> this leading w) (- (vector-dot (-> s2-1 0 start) (the-as vector (-> this leading))))) ) (let ((f0-19 (/ 1.0 (the float s4-0))) (f30-0 0.0) @@ -369,11 +357,11 @@ and return it as well. Otherwise, set it to `0`" ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this conveyor) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (reset-root! this) (process-drawable-from-entity! this arg0) (initialize-skeleton this (the-as skeleton-group (get-art-group this)) (the-as pair 0)) diff --git a/goal_src/jak2/engine/common_objs/dark-eco-pool.gc b/goal_src/jak2/engine/common_objs/dark-eco-pool.gc index 5f099e83f1..074b82d48b 100644 --- a/goal_src/jak2/engine/common_objs/dark-eco-pool.gc +++ b/goal_src/jak2/engine/common_objs/dark-eco-pool.gc @@ -296,8 +296,7 @@ ) (let* ((gp-0 (-> self draw ripple)) (f0-1 (the float (logand (current-time) #xffff))) - (f0-6 (cos (the float (sar (shl (the int (* 5.0 f0-1)) 48) 48)))) - (f0-7 (* f0-6 f0-6)) + (f0-7 (square (cos (the float (sar (shl (the int (* 5.0 f0-1)) 48) 48))))) (f0-9 (fmax -1.0 (fmin 1.0 f0-7))) ) (set! (-> gp-0 global-scale) (* 4096.0 (* 3.0 (+ 1.0 f0-9)))) diff --git a/goal_src/jak2/engine/common_objs/elevator.gc b/goal_src/jak2/engine/common_objs/elevator.gc index 623d65bd90..f948348944 100644 --- a/goal_src/jak2/engine/common_objs/elevator.gc +++ b/goal_src/jak2/engine/common_objs/elevator.gc @@ -115,10 +115,10 @@ (defmethod move-between-points ((this elevator) (arg0 vector) (arg1 float) (arg2 float)) "Move between two points on the elevator's path -@param vec TODO not sure -@param point-a The first point fetched from the elevator's path -@param point-b The second point fetched from the path -@see [[path-control]] and [[elevator]]" + @param vec TODO not sure + @param point-a The first point fetched from the elevator's path + @param point-b The second point fetched from the path + @see [[path-control]] and [[elevator]]" #f ) @@ -146,7 +146,7 @@ (when (< 0.0 f0-5) (vector-float*! (-> s5-0 move-dist) (-> s5-0 move-dist) f0-5) (vector+! (-> s5-0 move-dist) (-> s5-0 move-dist) (-> s5-0 start-pos)) - (vector-! (-> s5-0 move-dist) (-> s5-0 move-dist) (the-as vector (-> s4-0 prim-core))) + (vector-! (-> s5-0 move-dist) (-> s5-0 move-dist) (-> s4-0 prim-core world-sphere)) (move-by-vector! (-> target control) (-> s5-0 move-dist)) ) ) @@ -158,11 +158,11 @@ (defmethod init-defaults! ((this elevator)) "Initializes default settings related to the [[elevator]]: -- `elevator-xz-threshold` -- `elevator-y-threshold` -- `elevator-start-pos` -- `elevator-move-rate` -- `elevator-flags`" + - `elevator-xz-threshold` + - `elevator-y-threshold` + - `elevator-start-pos` + - `elevator-move-rate` + - `elevator-flags`" (let ((entity (-> this entity))) (set! (-> this params xz-threshold) ((method-of-object entity get-property-value-float) entity @@ -226,12 +226,12 @@ (defun ease-value-in-out ((value float) (step-amount float)) "TODO - the math in this function is full of duplication and isn't totally clear -but if the name is to be believed, it's to slow a values grow at the beginning and end of it's range -which is obviously useful for an elevator." + but if the name is to be believed, it's to slow a values grow at the beginning and end of it's range + which is obviously useful for an elevator." (let* ((step step-amount) (f4-0 (- 1.0 step-amount)) (f3-0 (/ step (- 1.0 f4-0))) - (f2-1 (* step step)) + (f2-1 (square step)) (f1-6 (+ (* 2.0 step (- f4-0 step)) f2-1)) (f1-7 (+ (* (- 1.0 f4-0) (- 1.0 f4-0) f3-0) f1-6)) ) @@ -243,9 +243,7 @@ which is obviously useful for an elevator." (+ (* 2.0 step (- value step)) f2-1) ) (else - (let ((f0-7 (- 1.0 value))) - (- f1-7 (* f0-7 f0-7 f3-0)) - ) + (- f1-7 (* (square (- 1.0 value)) f3-0)) ) ) f1-7 @@ -283,12 +281,7 @@ which is obviously useful for an elevator." (set! (-> self move-pos 0) (-> self move-pos 1)) (cond ((not (logtest? (-> event param 0) 7)) - (let ((gp-0 (the-as number (-> event param 0)))) - (set! (-> self move-pos 1) (if (type? (the-as uint gp-0) float) - (the-as float gp-0) - ) - ) - ) + (set! (-> self move-pos 1) (as-type (-> event param 0) float)) ) (else (case (-> event param 0) @@ -307,12 +300,7 @@ which is obviously useful for an elevator." (('jump-to) (cond ((not (logtest? (-> event param 0) 7)) - (let ((gp-1 (the-as number (-> event param 0)))) - (set! (-> self move-pos 1) (if (type? (the-as uint gp-1) float) - (the-as float gp-1) - ) - ) - ) + (set! (-> self move-pos 1) (as-type (-> event param 0) float)) ) (else (case (-> event param 0) @@ -392,36 +380,34 @@ which is obviously useful for an elevator." (defmethod find-closest-point-in-path! ((this elevator) (arg0 vector) (arg1 (pointer float)) (arg2 symbol) (arg3 symbol)) "Finds and sets the provided [[path-step]]'s `next-pos` field to the vertex index in the path which is closest to -the provided [[vector]] - -@param vec The point at which distance calculations are based off -@param! next-step If a point is found, `next-pos` will be set to the correct point -@param arg2 TODO -@param arg3 TODO -@returns [[#t]] if a point in the path was found" - (local-vars (path-point vector)) + the provided [[vector]] + + @param vec The point at which distance calculations are based off + @param! next-step If a point is found, `next-pos` will be set to the correct point + @param arg2 TODO + @param arg3 TODO + @returns [[#t]] if a point in the path was found" (let ((elev-params (-> this params)) (smallest-dist 0.0) (point-idx-tracker -1.0) ) (dotimes (path-vertex-idx (-> this path curve num-cverts)) - (set! path-point - (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float path-vertex-idx) 'interp) + (let ((path-point + (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float path-vertex-idx) 'interp) + ) ) - (when (and (or (not arg2) (< (vector-vector-xz-distance path-point arg0) (-> elev-params xz-threshold))) - (or (not arg3) - (< (fabs (- (-> path-point y) (-> arg0 y))) (-> elev-params y-threshold)) - (and (= path-vertex-idx (the int (-> this bottom-top 0))) (< (-> arg0 y) (-> path-point y))) - (and (= path-vertex-idx (the int (-> this bottom-top 1))) (< (-> path-point y) (-> arg0 y))) - ) - ) - (let* ((t9-2 vector-vector-distance) - (a1-3 arg0) - (dist (t9-2 path-point a1-3)) - ) - (when (or (= point-idx-tracker -1.0) (< dist smallest-dist)) - (set! smallest-dist dist) - (set! point-idx-tracker (the float path-vertex-idx)) + (when (and (or (not arg2) (< (vector-vector-xz-distance path-point arg0) (-> elev-params xz-threshold))) + (or (not arg3) + (< (fabs (- (-> path-point y) (-> arg0 y))) (-> elev-params y-threshold)) + (and (= path-vertex-idx (the int (-> this bottom-top 0))) (< (-> arg0 y) (-> path-point y))) + (and (= path-vertex-idx (the int (-> this bottom-top 1))) (< (-> path-point y) (-> arg0 y))) + ) + ) + (let ((dist (vector-vector-distance path-point arg0))) + (when (or (= point-idx-tracker -1.0) (< dist smallest-dist)) + (set! smallest-dist dist) + (set! point-idx-tracker (the float path-vertex-idx)) + ) ) ) ) @@ -435,12 +421,7 @@ the provided [[vector]] ;; WARN: Return type mismatch object vs symbol. (defmethod elevator-method-44 ((this elevator)) - (let* ((target-temp *target*) - (target (if (type? target-temp process-focusable) - target-temp - ) - ) - ) + (let ((target (the-as target (as-type *target* process-focusable)))) (the-as symbol (and target (move-between-points this (get-trans target 0) (-> this move-pos 0) (-> this move-pos 1))) @@ -455,9 +436,8 @@ the provided [[vector]] (defmethod move-to-next-point! ((this elevator)) "If the [[*target*]] is in a valid state and there is a point to transition to in the elevator's path -do so. -@see [[elevator::47]]" - (local-vars (zero float)) + do so. + @see [[elevator::47]]" (let ((target *target*)) (when (and target (not (logtest? (focus-status dead inactive in-air grabbed edge-grab pole pilot-riding pilot teleporting) @@ -465,12 +445,13 @@ do so. ) ) ) - (set! zero (the-as float 0.0)) - (when (and (find-closest-point-in-path! this (get-trans target 0) (& zero) #t #t) (!= (-> this move-pos 1) zero)) - (set! (-> this move-pos 0) (-> this move-pos 1)) - (set! (-> this move-pos 1) zero) - (logior! (-> this elevator-status) (elevator-status moving)) - (go (method-of-object this running)) + (let ((zero (the-as float 0.0))) + (when (and (find-closest-point-in-path! this (get-trans target 0) (& zero) #t #t) (!= (-> this move-pos 1) zero)) + (set! (-> this move-pos 0) (-> this move-pos 1)) + (set! (-> this move-pos 1) zero) + (logior! (-> this elevator-status) (elevator-status moving)) + (go (method-of-object this running)) + ) ) ) ) @@ -722,9 +703,9 @@ do so. (defmethod calc-dist-between-points! ((this elevator) (path-point-x int) (path-point-y int)) "Calculates the distance between two points in the elevator's path. - -@param path-point-x The index of the first point in the distance calculation, and where `next-pos` and `dist` are stored in the `path-seq` array -@param path-point-y The second point in the distance calculation" + + @param path-point-x The index of the first point in the distance calculation, and where `next-pos` and `dist` are stored in the `path-seq` array + @param path-point-y The second point in the distance calculation" (set! (-> this path-seq data path-point-x next-pos) (the float path-point-y)) (let ((point-x (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float path-point-x) 'interp)) (point-y (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float path-point-y) 'interp)) @@ -744,16 +725,16 @@ do so. (defmethod init-plat! ((this elevator)) "Does any necessary initial platform setup. -For example for an elevator pre-compute the distance between the first and last points (both ways) and clear the sound." + For example for an elevator pre-compute the distance between the first and last points (both ways) and clear the sound." 0 (none) ) -(defmethod relocate ((this elevator) (arg0 int)) +(defmethod relocate ((this elevator) (offset int)) (if (nonzero? (-> this path-seq)) - (&+! (-> this path-seq) arg0) + (&+! (-> this path-seq) offset) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defmethod activate-elevator ((this elevator)) @@ -767,12 +748,11 @@ For example for an elevator pre-compute the distance between the first and last ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this elevator) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" - (local-vars (sv-32 float) (sv-36 path-control) (sv-40 target)) + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (init-plat-collision! this) (process-drawable-from-entity! this entity) (initialize-skeleton this (the-as skeleton-group (get-art-group this)) (the-as pair 0)) @@ -810,24 +790,22 @@ This commonly includes things such as: ) ) ) - (set! sv-32 (the-as float 0.0)) - (set! sv-36 (-> this path)) - (let ((s5-2 *target*)) - (set! sv-40 (if (type? s5-2 process-focusable) - s5-2 + (let ((sv-32 (the-as float 0.0)) + (sv-36 (-> this path)) + ) + (let ((sv-40 (the-as target (as-type *target* process-focusable)))) + (if (not (and sv-40 + (logtest? (-> this params flags) (elevator-flags elevator-flags-4)) + (find-closest-point-in-path! this (get-trans sv-40 0) (& sv-32) #f #t) ) + ) + (set! sv-32 (-> this params start-pos)) ) - ) - (if (not (and sv-40 - (logtest? (-> this params flags) (elevator-flags elevator-flags-4)) - (find-closest-point-in-path! this (get-trans sv-40 0) (& sv-32) #f #t) - ) - ) - (set! sv-32 (-> this params start-pos)) ) - (set! (-> this move-pos 0) sv-32) - (set! (-> this move-pos 1) sv-32) - (get-point-in-path! sv-36 (-> this basetrans) sv-32 'interp) + (set! (-> this move-pos 0) sv-32) + (set! (-> this move-pos 1) sv-32) + (get-point-in-path! sv-36 (-> this basetrans) sv-32 'interp) + ) (set! (-> this root pause-adjust-distance) (+ 122880.0 (-> this params xz-threshold) (total-distance (-> this path))) ) diff --git a/goal_src/jak2/engine/common_objs/generic-obs.gc b/goal_src/jak2/engine/common_objs/generic-obs.gc index d232285e44..fa4d8658ae 100644 --- a/goal_src/jak2/engine/common_objs/generic-obs.gc +++ b/goal_src/jak2/engine/common_objs/generic-obs.gc @@ -55,10 +55,10 @@ ;; WARN: Return type mismatch object vs (pointer sparticle-launch-group). (defun entity-lookup-part-group ((arg0 entity-actor) (arg1 (pointer string)) (arg2 symbol)) - (local-vars (sv-16 res-tag)) (let ((gp-0 (the-as object #f))) - (set! sv-16 (new 'static 'res-tag)) - (let ((s4-0 (res-lump-data arg0 arg2 pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s4-0 (res-lump-data arg0 arg2 pointer :tag-ptr (& sv-16))) + ) (if (not s4-0) (go process-drawable-art-error (the-as string #f)) ) @@ -1762,7 +1762,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 string)) (stack-size-set! (-> this main-thread) 128) (logior! (-> this mask) (process-mask ambient)) (set! (-> this clock) (-> *display* part-clock)) @@ -1776,44 +1775,45 @@ ) ) (set! (-> this sound) (new 'process 'ambient-sound (-> this entity) (-> this root trans))) - (set! sv-16 "#f") - (set! (-> this mode) (entity-lookup-part-group arg0 (& sv-16) 'art-name)) - (when (-> this mode) - (let ((a0-15 (-> this mode 0))) - (when (and (nonzero? a0-15) (= (-> a0-15 type) sparticle-launch-group)) - (cond - ((logtest? (-> a0-15 flags) (sp-group-flag unk-8)) - (countdown (v1-27 (-> a0-15 length)) - (let* ((a1-8 (-> a0-15 launcher v1-27)) - (a3-2 (-> *part-id-table* (-> a1-8 launcher))) - ) - (when (nonzero? a3-2) - (let ((a2-7 (-> this level part-engine))) - (when (and a2-7 (< (-> a2-7 length) (-> a2-7 allocated-length))) - (let ((t0-7 (-> a2-7 data (-> a2-7 length)))) - (set! (-> t0-7 next1) (the-as connectable a3-2)) - (set! (-> t0-7 prev1) (the-as connectable (-> a1-8 hour-mask))) - (set! (-> (the-as vector (&-> t0-7 param0)) quad) (-> this root trans quad)) - (set! (-> t0-7 param3) (the-as int (-> a1-8 fade-after))) + (let ((sv-16 "#f")) + (set! (-> this mode) (entity-lookup-part-group arg0 (& sv-16) 'art-name)) + (when (-> this mode) + (let ((a0-15 (-> this mode 0))) + (when (and (nonzero? a0-15) (= (-> a0-15 type) sparticle-launch-group)) + (cond + ((logtest? (-> a0-15 flags) (sp-group-flag unk-8)) + (countdown (v1-27 (-> a0-15 length)) + (let* ((a1-8 (-> a0-15 launcher v1-27)) + (a3-2 (-> *part-id-table* (-> a1-8 launcher))) + ) + (when (nonzero? a3-2) + (let ((a2-7 (-> this level part-engine))) + (when (and a2-7 (< (-> a2-7 length) (-> a2-7 allocated-length))) + (let ((t0-7 (-> a2-7 data (-> a2-7 length)))) + (set! (-> t0-7 next1) (the-as connectable a3-2)) + (set! (-> t0-7 prev1) (the-as connectable (-> a1-8 hour-mask))) + (set! (-> (the-as vector (&-> t0-7 param0)) quad) (-> this root trans quad)) + (set! (-> t0-7 param3) (the-as int (-> a1-8 fade-after))) + ) + (+! (-> a2-7 length) 1) ) - (+! (-> a2-7 length) 1) ) ) ) ) + (process-entity-status! this (entity-perm-status dead) #t) + (deactivate this) ) - (process-entity-status! this (entity-perm-status dead) #t) - (deactivate this) - ) - (else - (set! (-> this part) (create-launch-control a0-15 this)) - (go (method-of-object this active)) + (else + (set! (-> this part) (create-launch-control a0-15 this)) + (go (method-of-object this active)) + ) ) ) ) ) + (go process-drawable-art-error sv-16) ) - (go process-drawable-art-error sv-16) (none) ) diff --git a/goal_src/jak2/engine/common_objs/water-anim.gc b/goal_src/jak2/engine/common_objs/water-anim.gc index 23db141d42..b17b430d8e 100644 --- a/goal_src/jak2/engine/common_objs/water-anim.gc +++ b/goal_src/jak2/engine/common_objs/water-anim.gc @@ -39,11 +39,11 @@ ) -(defmethod relocate ((this water-anim) (arg0 int)) +(defmethod relocate ((this water-anim) (offset int)) (if (nonzero? (-> this flow)) - (&+! (-> this flow) arg0) + (&+! (-> this flow) offset) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defskelgroup skel-water-anim-nest-dark-eco-largepool water-anim-nest-dark-eco water-anim-nest-dark-eco-largepool-lod0-jg -1 @@ -326,13 +326,9 @@ v0-1 ) (('water) - (let* ((s5-0 (the-as object (-> arg3 param 0))) - (s4-0 (the-as object (-> arg3 param 1))) - (gp-0 (if (type? (the-as process s4-0) process-focusable) - (the-as uint s4-0) - ) - ) - ) + (let ((s5-0 (the-as object (-> arg3 param 0))) + (gp-0 (the-as object (as-type (-> arg3 param 1) process-focusable))) + ) (when (and (logtest? (-> self flags) (water-flags deadly)) (logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags)) (the-as uint gp-0) @@ -453,14 +449,14 @@ ;; WARN: Return type mismatch quaternion vs none. (defmethod offset! ((this water-anim)) "Offset a [[water-anim]]'s `trans` and `quat` by the lump data in `entity`." - (local-vars (sv-16 res-tag)) (set! (-> this play-ambient-sound?) #t) (set! (-> this visible) #t) (set! (-> this look) (res-lump-value (-> this entity) 'look int :default (the-as uint128 -1) :time -1000000000.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-4 (res-lump-data (-> this entity) 'trans-offset vector :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-4 (res-lump-data (-> this entity) 'trans-offset vector :tag-ptr (& sv-16))) + ) (when v1-4 (+! (-> this root trans x) (-> v1-4 x)) (+! (-> this root trans y) (-> v1-4 y)) @@ -517,7 +513,6 @@ ;; WARN: Return type mismatch water-flags vs none. (defmethod water-anim-init! ((this water-anim)) "Initialize a [[water-anim]]." - (local-vars (sv-16 res-tag)) (set! (-> this attack-event) (the-as symbol ((method-of-type res-lump get-property-struct) (-> this entity) 'attack-event @@ -541,19 +536,19 @@ (set! (-> this attack-id) a0-7) ) (set! (-> this target) (the-as handle #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-10 (the-as (pointer float) ((method-of-type res-lump get-property-data) - (-> this entity) - 'water-height - 'exact - -1000000000.0 - (the-as pointer #f) - (& sv-16) - *res-static-buf* - ) - ) - ) - ) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-10 (the-as (pointer float) ((method-of-type res-lump get-property-data) + (-> this entity) + 'water-height + 'exact + -1000000000.0 + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) (when v1-10 (set! (-> this water-height) (-> v1-10 0)) (set! (-> this wade-height) (-> v1-10 1)) @@ -600,11 +595,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this water-anim) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (water-anim-method-27 this) (reset-root! this) (water-anim-init! this) diff --git a/goal_src/jak2/engine/common_objs/water-flow.gc b/goal_src/jak2/engine/common_objs/water-flow.gc index 03fce89283..54b8f4204e 100644 --- a/goal_src/jak2/engine/common_objs/water-flow.gc +++ b/goal_src/jak2/engine/common_objs/water-flow.gc @@ -52,14 +52,14 @@ ) -(defmethod relocate ((this flow-control) (arg0 int)) +(defmethod relocate ((this flow-control) (offset int)) (if (nonzero? (-> this sections)) - (&+! (-> this sections) arg0) + (&+! (-> this sections) offset) ) (if (nonzero? (-> this path)) - (&+! (-> this path) arg0) + (&+! (-> this path) offset) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defmethod draw-path ((this flow-control)) @@ -197,14 +197,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-0 a2-5) - (f1-1 (+ (-> a1-2 world-sphere w) (-> this collide-bounds r))) - ) - (when (< f0-0 (* f1-1 f1-1)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-2 world-sphere w) (-> this collide-bounds r)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -242,11 +238,7 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-1 a2-12) - (f1-5 (+ (-> a1-14 world-sphere w) (-> this collide-bounds r))) - ) - (b! (>= f0-1 (* f1-5 f1-5)) cfg-17 :delay #f) - ) + (b! (>= a2-12 (square (+ (-> a1-14 world-sphere w) (-> this collide-bounds r)))) cfg-17 :delay #f) ) ) (b! (>= *actor-list-length* 256) cfg-17 :delay #f) @@ -284,11 +276,7 @@ (.mov a0-10 vf3) (let ((s4-0 (-> v1-23 process))) (b! (< f0-2 a0-10) cfg-27) - (let ((a1-29 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (let ((a1-29 (the-as process-drawable (as-type s4-0 process-focusable)))) (if a1-29 (push-process this (the-as process-focusable a1-29)) ) @@ -309,7 +297,6 @@ ) (defmethod setup ((this flow-control)) - (local-vars (sv-32 flow-section) (sv-48 flow-section)) (let* ((s5-0 (-> this path)) (s4-0 (-> s5-0 curve num-cverts)) (s3-0 (new 'stack-no-clear 'vector)) @@ -319,30 +306,32 @@ (set! (-> this collide-bounds quad) (the-as uint128 0)) (get-point-in-path! s5-0 s3-0 0.0 'interp) (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) - (let ((s1-0 (+ s4-0 -1))) - (set! sv-32 (the-as flow-section #f)) - (dotimes (s0-0 s1-0) - (set! sv-48 (-> s2-0 data s0-0)) - (set! (-> sv-48 start quad) (-> s3-0 quad)) - (get-point-in-path! s5-0 s3-0 (the float (+ s0-0 1)) 'interp) - (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) - (vector-! (-> sv-48 pull-dir) s3-0 (-> sv-48 start)) - (vector-normalize! (-> sv-48 pull-dir) 1.0) - (set! (-> sv-48 trailing quad) (-> sv-48 pull-dir quad)) - (set! (-> sv-48 trailing y) 0.0) - (vector-normalize! (-> sv-48 trailing) 1.0) - (set-vector! (-> sv-48 radial-dir) (- (-> sv-48 trailing z)) 0.0 (-> sv-48 trailing x) 1.0) - (set! (-> sv-48 trailing w) (- (vector-dot s3-0 (the-as vector (-> sv-48 trailing))))) - (when sv-32 - (vector+! - (the-as vector (-> sv-32 trailing)) - (the-as vector (-> sv-32 trailing)) - (the-as vector (-> sv-48 trailing)) - ) - (vector-normalize! (-> sv-32 trailing) 1.0) - (set! (-> sv-32 trailing w) (- (vector-dot (-> sv-48 start) (the-as vector (-> sv-32 trailing))))) + (let ((s1-0 (+ s4-0 -1)) + (sv-32 (the-as flow-section #f)) + ) + (dotimes (s0-0 s1-0) + (let ((sv-48 (-> s2-0 data s0-0))) + (set! (-> sv-48 start quad) (-> s3-0 quad)) + (get-point-in-path! s5-0 s3-0 (the float (+ s0-0 1)) 'interp) + (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) + (vector-! (-> sv-48 pull-dir) s3-0 (-> sv-48 start)) + (vector-normalize! (-> sv-48 pull-dir) 1.0) + (set! (-> sv-48 trailing quad) (-> sv-48 pull-dir quad)) + (set! (-> sv-48 trailing y) 0.0) + (vector-normalize! (-> sv-48 trailing) 1.0) + (set-vector! (-> sv-48 radial-dir) (- (-> sv-48 trailing z)) 0.0 (-> sv-48 trailing x) 1.0) + (set! (-> sv-48 trailing w) (- (vector-dot s3-0 (the-as vector (-> sv-48 trailing))))) + (when sv-32 + (vector+! + (the-as vector (-> sv-32 trailing)) + (the-as vector (-> sv-32 trailing)) + (the-as vector (-> sv-48 trailing)) + ) + (vector-normalize! (-> sv-32 trailing) 1.0) + (set! (-> sv-32 trailing w) (- (vector-dot (-> sv-48 start) (the-as vector (-> sv-32 trailing))))) + ) + (set! sv-32 sv-48) ) - (set! sv-32 sv-48) sv-32 ) ) @@ -351,7 +340,7 @@ (set! (-> this leading quad) (-> s2-1 0 pull-dir quad)) (set! (-> this leading y) 0.0) (vector-normalize! (-> this leading) 1.0) - (set! (-> this leading w) (- (vector-dot (the-as vector (-> s2-1 0)) (the-as vector (-> this leading))))) + (set! (-> this leading w) (- (vector-dot (-> s2-1 0 start) (the-as vector (-> this leading))))) ) (let ((f0-19 (/ 1.0 (the float s4-0))) (f30-0 0.0) diff --git a/goal_src/jak2/engine/common_objs/water.gc b/goal_src/jak2/engine/common_objs/water.gc index 1b682c71b4..6f5ba3a2b1 100644 --- a/goal_src/jak2/engine/common_objs/water.gc +++ b/goal_src/jak2/engine/common_objs/water.gc @@ -654,11 +654,6 @@ ) (defmethod water-control-method-10 ((this water-control)) - (local-vars - (sv-272 (function vector entity-actor skeleton-group vector object none :behavior manipy)) - (sv-288 vector) - (sv-304 entity-actor) - ) (with-pp (let ((s4-0 (-> this flags)) (s5-0 (new 'stack-no-clear 'water-info)) @@ -760,37 +755,18 @@ (when (and (not (handle->process (-> this ripple))) (>= (+ (current-time) (seconds -1.5)) (-> this enter-water-time)) ) - (let* ((s1-0 (get-process *default-dead-pool* manipy #x4000)) - (s2-0 - (when s1-0 - (let ((t9-6 (method-of-type manipy activate))) - (t9-6 (the-as manipy s1-0) (-> this process) (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s2-1 run-function-in-process) - (s0-0 s1-0) - ) - (set! sv-272 manipy-init) - (set! sv-288 s3-0) - (set! sv-304 (-> this process entity)) - (let ((t0-0 (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f))) - (t1-0 #f) - (t2-0 0) - ) - ((the-as (function object object object object object object object none) s2-1) - s0-0 - sv-272 - sv-288 - sv-304 - t0-0 - t1-0 - t2-0 - ) - ) - ) - (-> s1-0 ppointer) - ) - ) - ) + (let ((s2-0 (process-spawn + manipy + :init manipy-init + s3-0 + (-> this process entity) + (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f)) + #f + 0 + :to (-> this process) + ) + ) + ) (set! (-> this ripple) (ppointer->handle s2-0)) (when s2-0 (send-event (ppointer->process s2-0) 'anim-mode 'loop) @@ -1484,7 +1460,6 @@ (defmethod water-info-init! ((this collide-shape) (arg0 water-info) (arg1 collide-action)) "Initialize a [[water-info]] with the currently loaded regions." - (local-vars (sv-80 int)) (let ((s3-0 (new 'stack 'water-info))) (set! (-> s3-0 flags) (water-flags)) (set! (-> s3-0 handle) (the-as handle #f)) @@ -1500,22 +1475,22 @@ (when (= (-> v1-8 status) 'active) (let ((s1-0 (-> v1-8 bsp region-trees))) (when (nonzero? s1-0) - (let ((s0-0 (-> s1-0 length))) - (set! sv-80 0) - (let ((a0-10 (-> s1-0 sv-80))) - (while (< sv-80 s0-0) - (if (= (-> a0-10 name) 'water) - ;; og:preserve-this scratchpad - (collect-regions - a0-10 - (the-as sphere (-> (scratchpad-object region-prim-area) pos)) - 0 - (-> (scratchpad-object region-prim-area) region-prim-list) - ) + (let* ((s0-0 (-> s1-0 length)) + (sv-80 0) + (a0-10 (-> s1-0 sv-80)) + ) + (while (< sv-80 s0-0) + (if (= (-> a0-10 name) 'water) + ;; og:preserve-this scratchpad + (collect-regions + a0-10 + (the-as sphere (-> (scratchpad-object region-prim-area) pos)) + 0 + (-> (scratchpad-object region-prim-area) region-prim-list) ) - (set! sv-80 (+ sv-80 1)) - (set! a0-10 (-> s1-0 sv-80)) - ) + ) + (+! sv-80 1) + (set! a0-10 (-> s1-0 sv-80)) ) ) ) diff --git a/goal_src/jak2/engine/debug/debug-sphere.gc b/goal_src/jak2/engine/debug/debug-sphere.gc index a21cdccaaf..f095a9d912 100644 --- a/goal_src/jak2/engine/debug/debug-sphere.gc +++ b/goal_src/jak2/engine/debug/debug-sphere.gc @@ -16,7 +16,6 @@ Do not call these functions unless *debug-segment* is set. "Fills points with positions that make a wireframe sphere made of the given number of horizontal and vertical lines. The points array is expected to have a capacity of at least (h-lines * v-lines * 3). Both h-lines and v-lines should be whole numbers." - (local-vars (next-hz vector) (next-vt vector) (h-line int)) (let ((offset (new-stack-vector0)) (scale 1.0) (num-points 0) @@ -26,27 +25,29 @@ Do not call these functions unless *debug-segment* is set. (let ((f28-0 (* scale (sin (* (the float v-line) (/ 32768.0 v-lines))))) (f26-0 (* scale (sin (* (the float (+ v-line 1)) (/ 32768.0 v-lines))))) (current (new-stack-vector0)) + (next-hz (new 'stack-no-clear 'vector)) ) - (set! next-hz (new 'stack-no-clear 'vector)) (set! (-> next-hz quad) (the-as uint128 0)) - (set! next-vt (new 'stack-no-clear 'vector)) - (set! (-> next-vt quad) (the-as uint128 0)) - (set! (-> current y) (+ (-> offset y) (* (cos (* (the float v-line) (/ 32768.0 v-lines))) scale))) - (set! (-> next-hz y) (-> current y)) - (set! (-> next-vt y) (+ (-> offset y) (* (cos (* (the float (+ v-line 1)) (/ 32768.0 v-lines))) scale))) - (set! h-line 0) - (while (< h-line (the int h-lines)) - (set! (-> current x) (+ (-> offset x) (* (cos (* (the float h-line) (/ 65536.0 h-lines))) f28-0))) - (set! (-> current z) (+ (-> offset z) (* (sin (* (the float h-line) (/ 65536.0 h-lines))) f28-0))) - (set! (-> next-hz x) (+ (-> offset x) (* (cos (* (the float (+ h-line 1)) (/ 65536.0 h-lines))) f28-0))) - (set! (-> next-hz z) (+ (-> offset z) (* (sin (* (the float (+ h-line 1)) (/ 65536.0 h-lines))) f28-0))) - (set! (-> next-vt x) (+ (-> offset x) (* (cos (* (the float h-line) (/ 65536.0 h-lines))) f26-0))) - (set! (-> next-vt z) (+ (-> offset z) (* (sin (* (the float h-line) (/ 65536.0 h-lines))) f26-0))) - (set! (-> points data num-points quad) (-> current quad)) - (set! (-> points data (+ num-points 1) quad) (-> next-hz quad)) - (set! (-> points data (+ num-points 2) quad) (-> next-vt quad)) - (+! num-points 3) - (set! h-line (+ h-line 1)) + (let ((next-vt (new 'stack-no-clear 'vector))) + (set! (-> next-vt quad) (the-as uint128 0)) + (set! (-> current y) (+ (-> offset y) (* (cos (* (the float v-line) (/ 32768.0 v-lines))) scale))) + (set! (-> next-hz y) (-> current y)) + (set! (-> next-vt y) (+ (-> offset y) (* (cos (* (the float (+ v-line 1)) (/ 32768.0 v-lines))) scale))) + (let ((h-line 0)) + (while (< h-line (the int h-lines)) + (set! (-> current x) (+ (-> offset x) (* (cos (* (the float h-line) (/ 65536.0 h-lines))) f28-0))) + (set! (-> current z) (+ (-> offset z) (* (sin (* (the float h-line) (/ 65536.0 h-lines))) f28-0))) + (set! (-> next-hz x) (+ (-> offset x) (* (cos (* (the float (+ h-line 1)) (/ 65536.0 h-lines))) f28-0))) + (set! (-> next-hz z) (+ (-> offset z) (* (sin (* (the float (+ h-line 1)) (/ 65536.0 h-lines))) f28-0))) + (set! (-> next-vt x) (+ (-> offset x) (* (cos (* (the float h-line) (/ 65536.0 h-lines))) f26-0))) + (set! (-> next-vt z) (+ (-> offset z) (* (sin (* (the float h-line) (/ 65536.0 h-lines))) f26-0))) + (set! (-> points data num-points quad) (-> current quad)) + (set! (-> points data (+ num-points 1) quad) (-> next-hz quad)) + (set! (-> points data (+ num-points 2) quad) (-> next-vt quad)) + (+! num-points 3) + (+! h-line 1) + ) + ) ) ) ) @@ -68,7 +69,6 @@ Do not call these functions unless *debug-segment* is set. "Adds a debug sphere to a bucket. The table-idx specifies the resolution of the sphere and must be >= 0 and <= 9, where 9 would specify the highest resolution available and 0 would draw nothing." - (local-vars (sphere-points vector-array) (point-3 vector)) (rlet ((vf1 :class vf) (vf2 :class vf) (vf3 :class vf) @@ -83,12 +83,12 @@ Do not call these functions unless *debug-segment* is set. ) ) ) - (set! sphere-points (-> *debug-sphere-table* table-idx)) - (set! point-3 (the-as vector (new-stack-vector0))) - (let ((point-1 (new-stack-vector0)) - (point-2 (new-stack-vector0)) - (points (-> sphere-points data)) - ) + (let* ((sphere-points (-> *debug-sphere-table* table-idx)) + (point-3 (the-as vector (new-stack-vector0))) + (point-1 (new-stack-vector0)) + (point-2 (new-stack-vector0)) + (points (-> sphere-points data)) + ) (.lvf vf1 (&-> position quad)) (.mov vf2 radius) (countdown (s4-1 (/ (-> sphere-points length) 3)) @@ -109,6 +109,7 @@ Do not call these functions unless *debug-segment* is set. (add-debug-line #t bucket point-1 point-3 color #f (the-as rgba -1)) ) ) + 0 + (none) ) - (none) ) diff --git a/goal_src/jak2/engine/debug/default-menu.gc b/goal_src/jak2/engine/debug/default-menu.gc index be9a791186..dfb0b20194 100644 --- a/goal_src/jak2/engine/debug/default-menu.gc +++ b/goal_src/jak2/engine/debug/default-menu.gc @@ -1145,6 +1145,7 @@ (let ((s3-0 (-> (the-as drawable-tree-instance-shrub v1-7) info prototype-inline-array-shrub))) (dotimes (s2-0 (-> s3-0 length)) (let ((a1-4 + ;; og:preserve-this allocate on debug heap (new 'debug 'debug-menu-item-flag (-> s3-0 data s2-0 name) (-> s3-0 data s2-0 name) dm-instance-pick-func) ) ) @@ -2666,20 +2667,6 @@ ) (defun debug-menu-make-continue-sub-menu ((arg0 game-info) (arg1 symbol)) - (local-vars - (sv-16 (function symbol type object object pair)) - (sv-32 symbol) - (sv-48 type) - (sv-64 symbol) - (sv-80 (function symbol type object object pair)) - (sv-96 symbol) - (sv-112 type) - (sv-128 string) - (sv-144 (function symbol type object object pair)) - (sv-160 symbol) - (sv-176 type) - (sv-192 string) - ) (let ((s4-0 *level-load-list*) (s5-0 '()) ) @@ -2691,34 +2678,20 @@ (let ((v1-2 (car s3-0)) (a0-5 arg1) ) - (when (if (= a0-5 'test) - (logtest? (continue-flags test) (-> (the-as continue-point v1-2) flags)) - #t - ) - (let ((s2-0 (method-of-type pair new)) - (s1-0 'debug) - (s0-0 pair) + (if (if (= a0-5 'test) + (logtest? (continue-flags test) (-> (the-as continue-point v1-2) flags)) + #t ) - (set! sv-16 (method-of-type pair new)) - (set! sv-32 'debug) - (set! sv-48 pair) - (set! sv-64 'flag) - (set! sv-80 (method-of-type pair new)) - (set! sv-96 'debug) - (set! sv-112 pair) - (set! sv-128 (-> (the-as continue-point v1-2) name)) - (set! sv-144 (method-of-type pair new)) - (set! sv-160 'debug) - (set! sv-176 pair) - (set! sv-192 (-> (the-as continue-point v1-2) name)) - (let* ((a3-1 (dcons 'dm-current-continue '())) - (a3-2 (sv-144 sv-160 sv-176 sv-192 a3-1)) - (a3-3 (sv-80 sv-96 sv-112 sv-128 a3-2)) - ) - (set! s5-0 (s2-0 s1-0 s0-0 (sv-16 sv-32 sv-48 sv-64 a3-3) s5-0)) - ) + (set! s5-0 (cons + (cons 'flag (cons + (-> (the-as continue-point v1-2) name) + (cons (-> (the-as continue-point v1-2) name) (cons 'dm-current-continue '())) + ) + ) + s5-0 + ) + ) ) - ) ) (set! s3-0 (cdr s3-0)) ) @@ -2730,72 +2703,41 @@ (let ((a3-5 '())) (let ((a2-6 (car s5-0))) (while (not (null? s5-0)) + ;; og:preserve-this cons -> dcons (set! a3-5 (dcons a2-6 a3-5)) (set! s5-0 (cdr s5-0)) (set! a2-6 (car s5-0)) ) ) - (dcons 'menu (dcons (symbol->string arg1) a3-5)) + ;; og:preserve-this cons -> dcons + (dcons 'menu (cons (symbol->string arg1) a3-5)) ) ) ) (defun debug-menu-make-task-sub-menu ((arg0 symbol)) "TODO - need to know more about game-info" - (local-vars - (sv-16 (function symbol type object object pair)) - (sv-32 symbol) - (sv-48 type) - (sv-64 symbol) - (sv-80 (function symbol type object object pair)) - (sv-96 symbol) - (sv-112 type) - (sv-128 string) - (sv-144 (function symbol type object object pair)) - (sv-160 symbol) - (sv-176 type) - (sv-192 int) - ) (let ((gp-0 '())) (let ((s4-0 (-> *game-info* sub-task-list))) (countdown (s3-0 (-> s4-0 length)) (when (nonzero? s3-0) (let ((v1-4 (-> s4-0 s3-0))) - (when (= (-> v1-4 level) arg0) - (let ((s2-0 (method-of-type pair new)) - (s1-0 'debug) - (s0-0 pair) - ) - (set! sv-16 (method-of-type pair new)) - (set! sv-32 'debug) - (set! sv-48 pair) - (set! sv-64 'flag) - (set! sv-80 (method-of-type pair new)) - (set! sv-96 'debug) - (set! sv-112 pair) - (set! sv-128 (-> v1-4 name)) - (set! sv-144 (method-of-type pair new)) - (set! sv-160 'debug) - (set! sv-176 pair) - (set! sv-192 (* s3-0 8)) - (let* ((a3-1 (dcons 'dm-task-menu-pick-func '())) - (a3-2 (sv-144 sv-160 sv-176 sv-192 a3-1)) - (a3-3 (sv-80 sv-96 sv-112 sv-128 a3-2)) - ) - (set! gp-0 (s2-0 s1-0 s0-0 (sv-16 sv-32 sv-48 sv-64 a3-3) gp-0)) - ) + (if (= (-> v1-4 level) arg0) + (set! gp-0 + ;; og:preserve-this cons -> dcons + (dcons (dcons 'flag (dcons (-> v1-4 name) (dcons (* s3-0 8) (dcons 'dm-task-menu-pick-func '())))) gp-0) + ) ) - ) ) ) ) ) + ;; og:preserve-this cons -> dcons (dcons 'menu (dcons (symbol->string arg0) gp-0)) ) ) (defun debug-menu-make-task-menu ((arg0 debug-menu-context)) - (local-vars (sv-16 debug-menu-context)) (let* ((s5-0 (new 'debug 'debug-menu arg0 "Task menu")) (s4-0 (new 'debug 'debug-menu-item-submenu "Task" s5-0)) ) @@ -2824,14 +2766,9 @@ (a0-3 (car s3-0)) ) (while (not (null? s3-0)) - (let ((s2-0 debug-menu-append-item) - (s1-0 s5-0) - (s0-0 debug-menu-make-from-template) - ) - (set! sv-16 arg0) - (let ((a1-2 (debug-menu-make-task-sub-menu (the-as symbol a0-3)))) - (s2-0 s1-0 (s0-0 sv-16 a1-2)) - ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template arg0 (debug-menu-make-task-sub-menu (the-as symbol a0-3))) ) (set! s3-0 (cdr s3-0)) (set! a0-3 (car s3-0)) @@ -2936,51 +2873,16 @@ ) (defun debug-menu-make-play-menu ((arg0 debug-menu-context)) - (local-vars - (sv-16 symbol) - (sv-32 type) - (sv-48 symbol) - (sv-64 (function symbol type object object pair)) - (sv-80 symbol) - (sv-96 type) - (sv-112 string) - (sv-128 (function symbol type object object pair)) - (sv-144 symbol) - (sv-160 type) - (sv-176 int) - ) (let ((gp-0 '())) (countdown (s4-0 (-> *game-info* play-list length)) (let ((v1-4 (-> *game-info* play-list s4-0))) - (when (-> v1-4 play-continue) - (let ((s3-0 (method-of-type pair new)) - ;; og:preserve-this allocate on debug heap - (s2-0 'debug) - (s1-0 pair) - (s0-0 (method-of-type pair new)) - ) - (set! sv-16 'debug) - (set! sv-32 pair) - (set! sv-48 'function) - (set! sv-64 (method-of-type pair new)) - (set! sv-80 'debug) - (set! sv-96 pair) - (set! sv-112 (-> v1-4 name)) - (set! sv-128 (method-of-type pair new)) - (set! sv-144 'debug) - (set! sv-160 pair) - (set! sv-176 (* s4-0 8)) - (let* ((a3-1 (dcons 'dm-play-task '())) - (a3-2 (sv-128 sv-144 sv-160 sv-176 a3-1)) - (a3-3 (sv-64 sv-80 sv-96 sv-112 a3-2)) - ) - (set! gp-0 (s3-0 s2-0 s1-0 (s0-0 sv-16 sv-32 sv-48 a3-3) gp-0)) - ) + (if (-> v1-4 play-continue) + ;; og:preserve-this cons -> dcons + (set! gp-0 (dcons (dcons 'function (dcons (-> v1-4 name) (dcons (* s4-0 8) (dcons 'dm-play-task '())))) gp-0)) ) - ) ) ) - ;; og:preserve-this + ;; og:preserve-this cons -> dcons (debug-menu-make-from-template arg0 (dcons 'menu (dcons "Play" gp-0))) ) ) @@ -3055,6 +2957,7 @@ #f ) +;; og:preserve-this added (defun dm-game-opengoal-cheat-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg)) (if (= arg1 (debug-menu-msg press)) (logxor! (-> *pc-settings* cheats) (the-as uint (/ arg0 8))) @@ -3542,14 +3445,9 @@ (a1-7 (car s3-2)) ) (while (not (null? s3-2)) - (let ((s2-0 debug-menu-append-item) - (s1-0 s4-2) - (s0-0 debug-menu-make-from-template) - ) - (set! sv-16 arg0) - (let ((a1-8 (debug-menu-make-continue-sub-menu *game-info* (the-as symbol a1-7)))) - (s2-0 s1-0 (s0-0 sv-16 a1-8)) - ) + (debug-menu-append-item + s4-2 + (debug-menu-make-from-template arg0 (debug-menu-make-continue-sub-menu *game-info* (the-as symbol a1-7))) ) (set! s3-2 (cdr s3-2)) (set! a1-7 (car s3-2)) @@ -3569,6 +3467,7 @@ (flag "Blerc" *stats-blerc* dm-boolean-toggle-pick-func) (flag "Profile bars" *stats-profile-bars* dm-boolean-toggle-pick-func) (flag "Perf" *stats-perf* dm-boolean-toggle-pick-func) + ;; og:preserve-this (flag "Joint" *stats-joint* dm-boolean-toggle-pick-func) (menu "Memory Stats" @@ -4092,6 +3991,7 @@ ) (menu "Gun" + ;; og:preserve-this (flag "yellow" (the binteger (game-feature gun-yellow)) dm-game-feature-toggle-pick-func) (flag "red" (the binteger (game-feature gun-red)) dm-game-feature-toggle-pick-func) (flag "blue" (the binteger (game-feature gun-blue)) dm-game-feature-toggle-pick-func) diff --git a/goal_src/jak2/engine/debug/history.gc b/goal_src/jak2/engine/debug/history.gc index 875f82a46f..ddfe8e0bc9 100644 --- a/goal_src/jak2/engine/debug/history.gc +++ b/goal_src/jak2/engine/debug/history.gc @@ -154,9 +154,9 @@ (defmethod clear-history-entries! ((this history)) "Iterates through each [[history-elt]] in the `elt` dynamic array -For each entry: -- clear `timestamp` -- clear `record-tag`" + For each entry: + - clear `timestamp` + - clear `record-tag`" (set! (-> this alloc-index) 0) (countdown (v1-0 (-> this allocated-length)) (let ((a1-3 (-> this elts v1-0))) @@ -176,10 +176,10 @@ For each entry: ;; WARN: new jak 2 until loop case, check carefully (defmethod clear-record-tags! ((this history) (arg0 history-channel) (arg1 uint) (arg2 uint)) "First grab the latest [[history-elt]] at `alloc-index` -1. update it's `channel`, `record-id` and `owner` from the provided args -2. - if it's `record-tag` is zero -- return it -- otherwise, iterate through all `elts` until one is found that does not match it's `timestamp` -- if not `0` out the `record-tag` for that elt and continue iteration" + 1. update it's `channel`, `record-id` and `owner` from the provided args + 2. - if it's `record-tag` is zero -- return it + - otherwise, iterate through all `elts` until one is found that does not match it's `timestamp` + - if not `0` out the `record-tag` for that elt and continue iteration" (let* ((t1-0 (-> this alloc-index)) (v1-0 (-> this elts)) (v0-0 (-> v1-0 t1-0)) @@ -228,9 +228,9 @@ For each entry: (defmethod update-entries! ((this history-iterator)) "Iterate through each [[history-elt]] in [[*history*]] -- If we hit the end set `done?` to true -- If the `timestamp` on the elt, minus the current framecounter exceeds `max-age`, we are also done, return #f -- However if we find an elt who's `owner` matches the iterator's, break out early returning that `elt`" + - If we hit the end set `done?` to true + - If the `timestamp` on the elt, minus the current framecounter exceeds `max-age`, we are also done, return #f + - However if we find an elt who's `owner` matches the iterator's, break out early returning that `elt`" (let ((v1-0 *history*) (a1-2 (-> *display* base-clock frame-counter)) ) @@ -276,150 +276,143 @@ For each entry: ;; WARN: new jak 2 until loop case, check carefully (defun history-print ((arg0 history-iterator)) - (local-vars - (sv-16 object) - (sv-24 int) - (sv-32 int) - (sv-40 history-elt) - (sv-48 time-frame) - (sv-56 uint) - (sv-64 collide-status) - (sv-72 float) - (sv-80 string) - (sv-96 string) - ) - (set! sv-16 (-> arg0 out)) - (set! sv-24 -1) - (set! sv-32 0) - (until #f - (set! sv-40 (update-entries! arg0)) - (if (not sv-40) - (goto cfg-71) + (let ((sv-16 (-> arg0 out)) + (sv-24 -1) + (sv-32 0) ) - (when (logtest? (-> arg0 channel-mask) (ash 1 (-> sv-40 channel))) - (set! sv-48 (frame-counter-delta arg0 sv-40)) - (set! sv-56 (-> sv-40 record-id)) - (cond - ((!= sv-24 sv-48) - (set! sv-24 (the-as int sv-48)) - (set! sv-32 (the-as int sv-56)) - (format sv-16 "~3D ~4X " sv-48 (-> sv-40 record-id)) - ) - ((!= sv-32 sv-56) - (set! sv-32 (the-as int sv-56)) - (format sv-16 " ~4X " (-> sv-40 record-id)) - ) - (else - (format sv-16 " ") - ) - ) - (let ((v1-22 (-> sv-40 channel))) - (cond - ((or (= v1-22 (history-channel trans)) - (or (= v1-22 (history-channel transv)) - (= v1-22 (history-channel transv-in)) - (= v1-22 (history-channel transv-out)) - (= v1-22 (history-channel intersect)) + (until #f + (let ((sv-40 (update-entries! arg0))) + (if (not sv-40) + (goto cfg-71) + ) + (when (logtest? (-> arg0 channel-mask) (ash 1 (-> sv-40 channel))) + (let ((sv-48 (frame-counter-delta arg0 sv-40)) + (sv-56 (-> sv-40 record-id)) + ) + (cond + ((!= sv-24 sv-48) + (set! sv-24 (the-as int sv-48)) + (set! sv-32 (the-as int sv-56)) + (format sv-16 "~3D ~4X " sv-48 (-> sv-40 record-id)) + ) + ((!= sv-32 sv-56) + (set! sv-32 (the-as int sv-56)) + (format sv-16 " ~4X " (-> sv-40 record-id)) + ) + (else + (format sv-16 " ") + ) + ) + ) + (let ((v1-22 (-> sv-40 channel))) + (cond + ((or (= v1-22 (history-channel trans)) + (or (= v1-22 (history-channel transv)) + (= v1-22 (history-channel transv-in)) + (= v1-22 (history-channel transv-out)) + (= v1-22 (history-channel intersect)) + ) ) + (format + sv-16 + "~-15S: ~14Mm ~14Mm ~14Mm~%" + (history-channel->string (-> sv-40 channel)) + (-> sv-40 vector x) + (-> sv-40 vector y) + (-> sv-40 vector z) + ) ) - (format - sv-16 - "~-15S: ~14Mm ~14Mm ~14Mm~%" - (history-channel->string (-> sv-40 channel)) - (-> sv-40 vector x) - (-> sv-40 vector y) - (-> sv-40 vector z) - ) - ) - ((or (= v1-22 (history-channel local-normal)) (= v1-22 (history-channel surface-normal))) - (format - sv-16 - "~-15S: ~14f ~14f ~14f~%" - (history-channel->string (-> sv-40 channel)) - (-> sv-40 vector x) - (-> sv-40 vector y) - (-> sv-40 vector z) - ) - ) - ((= v1-22 (history-channel pat)) - (let* ((s2-0 (-> sv-40 vector x)) - (s5-2 format) - (s4-2 sv-16) - (s3-2 "~-15S: #x~6X mode:~-8S material:~-10S event:~S~%") - (s1-0 (history-channel->string (-> sv-40 channel))) - (s0-0 s2-0) - ) - (set! sv-80 (pat-mode->string (the-as pat-surface s2-0))) - (set! sv-96 (pat-material->string (the-as pat-surface s2-0))) - (let ((t2-0 (pat-event->string (the-as pat-surface s2-0)))) - (s5-2 s4-2 s3-2 s1-0 s0-0 sv-80 sv-96 t2-0) + ((or (= v1-22 (history-channel local-normal)) (= v1-22 (history-channel surface-normal))) + (format + sv-16 + "~-15S: ~14f ~14f ~14f~%" + (history-channel->string (-> sv-40 channel)) + (-> sv-40 vector x) + (-> sv-40 vector y) + (-> sv-40 vector z) + ) ) - ) - ) - ((= v1-22 (history-channel collide-status)) - (set! sv-64 (-> sv-40 collide-status)) - (set! sv-72 (-> sv-40 vector z)) - (format sv-16 "~-15S: #x~6X " (history-channel->string (-> sv-40 channel)) sv-64) - (let ((s5-4 sv-64)) - (if (= (logand s5-4 (collide-status touch-background)) (collide-status touch-background)) - (format sv-16 "touch-background ") + ((= v1-22 (history-channel pat)) + (let ((s2-0 (-> sv-40 vector x))) + (format + sv-16 + "~-15S: #x~6X mode:~-8S material:~-10S event:~S~%" + (history-channel->string (-> sv-40 channel)) + s2-0 + (pat-mode->string (the-as pat-surface s2-0)) + (pat-material->string (the-as pat-surface s2-0)) + (pat-event->string (the-as pat-surface s2-0)) + ) ) - (if (= (logand s5-4 (collide-status on-special-surface)) (collide-status on-special-surface)) - (format sv-16 "on-special-surface ") + ) + ((= v1-22 (history-channel collide-status)) + (let ((sv-64 (-> sv-40 collide-status)) + (sv-72 (-> sv-40 vector z)) + ) + (format sv-16 "~-15S: #x~6X " (history-channel->string (-> sv-40 channel)) sv-64) + (let ((s5-4 sv-64)) + (if (= (logand s5-4 (collide-status touch-background)) (collide-status touch-background)) + (format sv-16 "touch-background ") + ) + (if (= (logand s5-4 (collide-status on-special-surface)) (collide-status on-special-surface)) + (format sv-16 "on-special-surface ") + ) + (if (= (logand s5-4 (collide-status touch-wall)) (collide-status touch-wall)) + (format sv-16 "touch-wall ") + ) + (if (= (logand s5-4 (collide-status on-surface)) (collide-status on-surface)) + (format sv-16 "on-surface ") + ) + (if (= (logand s5-4 (collide-status impact-surface)) (collide-status impact-surface)) + (format sv-16 "impact-surface ") + ) + (if (= (logand s5-4 (collide-status touch-ceiling)) (collide-status touch-ceiling)) + (format sv-16 "touch-ceiling ") + ) + (if (= (logand s5-4 (collide-status on-ground)) (collide-status on-ground)) + (format sv-16 "on-ground ") + ) + (if (= (logand s5-4 (collide-status glance)) (collide-status glance)) + (format sv-16 "glance ") + ) + (if (= (logand s5-4 (collide-status blocked)) (collide-status blocked)) + (format sv-16 "blocked ") + ) + (if (= (logand s5-4 (collide-status touch-edge)) (collide-status touch-edge)) + (format sv-16 "touch-edge ") + ) + (if (= (logand s5-4 (collide-status touch-ceiling-sticky)) (collide-status touch-ceiling-sticky)) + (format sv-16 "touch-ceiling-sticky ") + ) + (if (= (logand s5-4 (collide-status on-water)) (collide-status on-water)) + (format sv-16 "on-water ") + ) + (if (= (logand s5-4 (collide-status touch-actor)) (collide-status touch-actor)) + (format sv-16 "touch-actor ") + ) + (if (= (logand (collide-status probe-hit) s5-4) (collide-status probe-hit)) + (format sv-16 "probe-hit ") + ) + (if (= (logand s5-4 (collide-status stuck)) (collide-status stuck)) + (format sv-16 "stuck ") + ) + (if (= (logand s5-4 (collide-status no-touch)) (collide-status no-touch)) + (format sv-16 "no-touch ") + ) + (if (= (logand s5-4 (collide-status touch-surface)) (collide-status touch-surface)) + (format sv-16 "touch-surface ") + ) + ) + (format sv-16 " #x~6X~%" sv-72) ) - (if (= (logand s5-4 (collide-status touch-wall)) (collide-status touch-wall)) - (format sv-16 "touch-wall ") + ) + ((= v1-22 (history-channel friction)) + (let ((f30-0 (-> sv-40 vector x))) + (format sv-16 "~-15S: ~f~%" (history-channel->string (-> sv-40 channel)) f30-0) ) - (if (= (logand s5-4 (collide-status on-surface)) (collide-status on-surface)) - (format sv-16 "on-surface ") - ) - (if (= (logand s5-4 (collide-status impact-surface)) (collide-status impact-surface)) - (format sv-16 "impact-surface ") - ) - (if (= (logand s5-4 (collide-status touch-ceiling)) (collide-status touch-ceiling)) - (format sv-16 "touch-ceiling ") - ) - (if (= (logand s5-4 (collide-status on-ground)) (collide-status on-ground)) - (format sv-16 "on-ground ") - ) - (if (= (logand s5-4 (collide-status glance)) (collide-status glance)) - (format sv-16 "glance ") - ) - (if (= (logand s5-4 (collide-status blocked)) (collide-status blocked)) - (format sv-16 "blocked ") - ) - (if (= (logand s5-4 (collide-status touch-edge)) (collide-status touch-edge)) - (format sv-16 "touch-edge ") - ) - (if (= (logand s5-4 (collide-status touch-ceiling-sticky)) (collide-status touch-ceiling-sticky)) - (format sv-16 "touch-ceiling-sticky ") - ) - (if (= (logand s5-4 (collide-status on-water)) (collide-status on-water)) - (format sv-16 "on-water ") - ) - (if (= (logand s5-4 (collide-status touch-actor)) (collide-status touch-actor)) - (format sv-16 "touch-actor ") - ) - (if (= (logand (collide-status probe-hit) s5-4) (collide-status probe-hit)) - (format sv-16 "probe-hit ") - ) - (if (= (logand s5-4 (collide-status stuck)) (collide-status stuck)) - (format sv-16 "stuck ") - ) - (if (= (logand s5-4 (collide-status no-touch)) (collide-status no-touch)) - (format sv-16 "no-touch ") - ) - (if (= (logand s5-4 (collide-status touch-surface)) (collide-status touch-surface)) - (format sv-16 "touch-surface ") - ) - ) - (format sv-16 " #x~6X~%" sv-72) - ) - ((= v1-22 (history-channel friction)) - (let ((f30-0 (-> sv-40 vector x))) - (format sv-16 "~-15S: ~f~%" (history-channel->string (-> sv-40 channel)) f30-0) - ) - ) + ) + ) + ) ) ) ) @@ -432,113 +425,114 @@ For each entry: ;; WARN: new jak 2 until loop case, check carefully (defun history-draw ((arg0 history-iterator)) - (local-vars (sv-16 vector) (sv-20 vector) (sv-24 pat-surface)) - (set! sv-16 (the-as vector #f)) - (set! sv-20 (the-as vector #f)) - (set! sv-24 (new 'static 'pat-surface)) - (until #f - (let ((s5-0 (update-entries! arg0))) - (if (not s5-0) - (goto cfg-34) - ) - (when (logtest? (-> arg0 channel-mask) (ash 1 (-> s5-0 channel))) - (let* ((f0-0 (get-age arg0 s5-0)) - (v1-8 (the int (lerp 4.0 128.0 f0-0))) - ) - (case (-> s5-0 channel) - (((history-channel trans)) - (if sv-16 - (add-debug-line - #t - (bucket-id debug-no-zbuf1) - sv-16 - (-> s5-0 vector) - (the-as rgba (logior #xffff00 (shl v1-8 24))) - #f - (the-as rgba -1) - ) - (add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 vector) (the-as rgba (logior #xffff00 (shl v1-8 24)))) + (let ((sv-16 (the-as vector #f)) + (sv-20 (the-as vector #f)) + (sv-24 (new 'static 'pat-surface)) + ) + (until #f + (let ((s5-0 (update-entries! arg0))) + (if (not s5-0) + (goto cfg-34) + ) + (when (logtest? (-> arg0 channel-mask) (ash 1 (-> s5-0 channel))) + (let* ((f0-0 (get-age arg0 s5-0)) + (v1-8 (the int (lerp 4.0 128.0 f0-0))) ) - (set! sv-16 (-> s5-0 vector)) - ) - (((history-channel intersect)) - (if sv-20 - (add-debug-line - #t - (bucket-id debug-no-zbuf1) - sv-20 - (-> s5-0 vector) - (the-as rgba (logior #xffffff (shl v1-8 24))) - #f - (the-as rgba -1) - ) - (add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 vector) (the-as rgba (logior #xffffff (shl v1-8 24)))) - ) - (set! sv-20 (-> s5-0 vector)) - ) - (((history-channel transv)) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (-> s5-0 origin) - (-> s5-0 vector) - (meters 0.000024414063) - (the-as rgba (logior (shl v1-8 24) #xff00)) - ) - ) - (((history-channel transv-in)) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (-> s5-0 origin) - (-> s5-0 vector) - (meters 0.000024414063) - (the-as rgba (logior #x408040 (shl v1-8 24))) - ) - ) - (((history-channel transv-out)) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (-> s5-0 origin) - (-> s5-0 vector) - (meters 0.000024414063) - (the-as rgba (logior #x404080 (shl v1-8 24))) - ) - ) - (((history-channel local-normal) (history-channel surface-normal)) - (let ((t1-7 - (logand (the-as uint (-> *pat-mode-info* (-> sv-24 mode) hilite-color)) (the-as uint #xffffffff00ffffff)) + (case (-> s5-0 channel) + (((history-channel trans)) + (if sv-16 + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + sv-16 + (-> s5-0 vector) + (the-as rgba (logior #xffff00 (shl v1-8 24))) + #f + (the-as rgba -1) ) + (add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 vector) (the-as rgba (logior #xffff00 (shl v1-8 24)))) ) + (set! sv-16 (-> s5-0 vector)) + ) + (((history-channel intersect)) + (if sv-20 + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + sv-20 + (-> s5-0 vector) + (the-as rgba (logior #xffffff (shl v1-8 24))) + #f + (the-as rgba -1) + ) + (add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 vector) (the-as rgba (logior #xffffff (shl v1-8 24)))) + ) + (set! sv-20 (-> s5-0 vector)) + ) + (((history-channel transv)) (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> s5-0 origin) (-> s5-0 vector) - (meters 1) - (the-as rgba (logior t1-7 (shl v1-8 24))) + (meters 0.000024414063) + (the-as rgba (logior (shl v1-8 24) #xff00)) ) ) - ) - (((history-channel pat)) - (set! sv-24 (the-as pat-surface (-> s5-0 vector x))) - ) - (((history-channel friction)) - (let ((f0-3 (-> s5-0 vector x)) - (a3-10 (new 'stack-no-clear 'vector)) - ) - (set-vector! a3-10 0.0 (* -8192.0 f0-3) 0.0 1.0) + (((history-channel transv-in)) (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> s5-0 origin) - a3-10 - (meters 0.00024414062) - (the-as rgba (logior #xffffff (shl v1-8 24))) + (-> s5-0 vector) + (meters 0.000024414063) + (the-as rgba (logior #x408040 (shl v1-8 24))) ) ) - ) + (((history-channel transv-out)) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 origin) + (-> s5-0 vector) + (meters 0.000024414063) + (the-as rgba (logior #x404080 (shl v1-8 24))) + ) + ) + (((history-channel local-normal) (history-channel surface-normal)) + (let ((t1-7 + (logand (the-as uint (-> *pat-mode-info* (-> sv-24 mode) hilite-color)) (the-as uint #xffffffff00ffffff)) + ) + ) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 origin) + (-> s5-0 vector) + (meters 1) + (the-as rgba (logior t1-7 (shl v1-8 24))) + ) + ) + ) + (((history-channel pat)) + (set! sv-24 (the-as pat-surface (-> s5-0 vector x))) + ) + (((history-channel friction)) + (let ((f0-3 (-> s5-0 vector x)) + (a3-10 (new 'stack-no-clear 'vector)) + ) + (set-vector! a3-10 0.0 (* -8192.0 f0-3) 0.0 1.0) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 origin) + a3-10 + (meters 0.00024414062) + (the-as rgba (logior #xffffff (shl v1-8 24))) + ) + ) + ) + ) ) ) ) diff --git a/goal_src/jak2/engine/debug/memory-usage.gc b/goal_src/jak2/engine/debug/memory-usage.gc index 3b3cf5b239..c8e562c623 100644 --- a/goal_src/jak2/engine/debug/memory-usage.gc +++ b/goal_src/jak2/engine/debug/memory-usage.gc @@ -39,7 +39,7 @@ obj ) -(defmethod mem-usage ((this object) (arg0 memory-usage-block) (arg1 int)) +(defmethod mem-usage ((this object) (usage memory-usage-block) (flags int)) this ) @@ -66,9 +66,9 @@ (defun mem-size ((data basic) (inspect-usage? symbol) (arg2 int)) "@param data The [[basic]] to call `mem-usage` on -@param inspect-usage? Set to [[#t]] if `inspect` should be called on the resulting [[memory-usage-block]] -@param arg2 TODO - unsure, some sort of bitfield -@returns The total memory footprint of the provided [[basic]]" + @param inspect-usage? Set to [[#t]] if `inspect` should be called on the resulting [[memory-usage-block]] + @param arg2 TODO - unsure, some sort of bitfield + @returns The total memory footprint of the provided [[basic]]" (let ((block (new 'stack 'memory-usage-block))) (mem-usage data block arg2) (if inspect-usage? @@ -80,11 +80,11 @@ (defmethod compute-memory-usage! ((this level) (force? symbol)) "Calculates the memory usage of the level, returns and stores the [[memory-usage-block]] -in `mem-usage-block` as well as the total size in `mem-usage` - -@param force? - Will re-compute the usage if set to [[#t]], even if `mem-usage` has been set to a non-zero value -@returns The [[memory-usage-block]] representing the footprint of the level -@see [[memory-usage-block::10]]" + in `mem-usage-block` as well as the total size in `mem-usage` + + @param force? - Will re-compute the usage if set to [[#t]], even if `mem-usage` has been set to a non-zero value + @returns The [[memory-usage-block]] representing the footprint of the level + @see [[memory-usage-block::10]]" (if (zero? (-> this mem-usage-block)) (set! (-> this mem-usage-block) (new 'debug 'memory-usage-block)) ) @@ -97,23 +97,23 @@ in `mem-usage-block` as well as the total size in `mem-usage` (-> this mem-usage-block) ) -(defmethod mem-usage ((this process-tree) (arg0 memory-usage-block) (arg1 int)) +(defmethod mem-usage ((this process-tree) (usage memory-usage-block) (flags int)) (let ((v1-0 90)) (let* ((a0-1 *dead-pool-list*) (a3-0 (car a0-1)) ) (while (not (null? a0-1)) - (set! (-> arg0 data v1-0 name) (symbol->string (the-as symbol a3-0))) + (set! (-> usage data v1-0 name) (symbol->string (the-as symbol a3-0))) (+! v1-0 1) (set! a0-1 (cdr a0-1)) (set! a3-0 (car a0-1)) ) ) - (set! (-> arg0 length) (max (-> arg0 length) v1-0)) + (set! (-> usage length) (max (-> usage length) v1-0)) ) - (set! (-> arg0 data 96 name) "*debug-dead-pool*") - (set! *temp-mem-usage* arg0) - (when (logtest? arg1 32) + (set! (-> usage data 96 name) "*debug-dead-pool*") + (set! *temp-mem-usage* usage) + (when (logtest? flags 32) (let* ((s5-0 90) (s4-0 *dead-pool-list*) (v1-4 (car s4-0)) @@ -311,7 +311,6 @@ in `mem-usage-block` as well as the total size in `mem-usage` (define *max-dma* 0) (defmethod print-mem-usage ((this memory-usage-block) (level level) (fmt-dest object)) - (local-vars (sv-16 object) (sv-32 string) (sv-48 int)) (let ((s3-0 (&- (-> level heap current) (the-as uint (-> level heap base))))) (let ((v1-2 (+ (-> this data 61 total) (-> this data 62 total)))) (< #x10000 v1-2) @@ -348,218 +347,210 @@ in `mem-usage-block` as well as the total size in `mem-usage` (if (< (the-as int s2-0) s3-0) (format fmt-dest "~3L") ) - (let ((s0-0 format)) - (set! sv-16 fmt-dest) - (set! sv-32 "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--") - (let ((s4-1 (-> level name)) - (s3-1 (sar s3-0 10)) - (s2-1 (shr s2-0 10)) - ) - (set! sv-48 (sar (memory-used *nk-dead-pool*) 10)) - (let ((t2-0 (sar (memory-total *nk-dead-pool*) 10)) - (t9-4 s0-0) - (a0-22 sv-16) - (a1-8 sv-32) - (a2-1 s4-1) - (a3-0 s3-1) - (t0-0 s2-1) - (t1-0 sv-48) - ) - (t9-4 a0-22 a1-8 a2-1 a3-0 t0-0 t1-0 t2-0) - (format fmt-dest "~5,'-DK/~5,'-DK--~%" (shr s1-0 10) (sar *max-dma* 10)) - (when *stats-memory-short* - (let ((s3-2 (if (cpad-hold? 1 l3) - #t - fmt-dest - ) + (let* ((s0-0 format) + (sv-16 fmt-dest) + (sv-32 "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--") + (s4-1 (-> level name)) + (s3-1 (sar s3-0 10)) + (s2-1 (shr s2-0 10)) + (sv-48 (sar (memory-used *nk-dead-pool*) 10)) + (t2-0 (sar (memory-total *nk-dead-pool*) 10)) + (t0-0 s2-1) + (t1-0 sv-48) + ) + (s0-0 sv-16 sv-32 s4-1 s3-1 t0-0 t1-0 t2-0) + (format fmt-dest "~5,'-DK/~5,'-DK--~%" (shr s1-0 10) (sar *max-dma* 10)) + (when *stats-memory-short* + (let ((s3-2 (if (cpad-hold? 1 l3) + #t + fmt-dest ) - (s4-2 format) - (s2-2 "heap-~5,'-DK/~5,'-DK----~D---~D/~D~%") - (s1-1 (sar (memory-used *nk-dead-pool*) 10)) - (s0-1 (sar (memory-total *nk-dead-pool*) 10)) - ) - (set! t0-0 (the-as int (compact-time *nk-dead-pool*))) - (set! t1-0 (the-as int (-> *nk-dead-pool* compact-count))) - (set! t2-0 (the-as int (-> *nk-dead-pool* compact-count-targ))) - (s4-2 s3-2 s2-2 s1-1 s0-1 t0-0 (the-as uint t1-0) (the-as uint t2-0)) - ) - ) - (when (not *stats-memory-short*) - (set! (-> *dma-mem-usage* data 87 total) - (* (dma-buffer-length (-> *display* frames (-> *display* last-screen) debug-buf)) 16) - ) - (let ((t9-11 format) - (a0-31 fmt-dest) - (a1-11 " bsp ~192H~5DK ~280Hdebug~456H~5DK~%") - (a2-6 (sar (+ (-> this data 58 total) (-> this data 59 total) (-> this data 60 total)) 10)) - (a3-3 (sar (-> *dma-mem-usage* data 87 total) 10)) - ) - (t9-11 a0-31 a1-11 a2-6 a3-3 (the-as none t0-0) (the-as none t1-0) (the-as none t2-0)) - (format - fmt-dest - " bsp-leaf-vis ~192H~5DK~%" - (sar (+ (-> this data 61 total) (-> this data 62 total)) 10) - (the-as none a3-3) - ) - (format fmt-dest " level-code ~192H~5DK~%" (sar (-> this data 65 total) 10) (the-as none a3-3)) - ) - (format - fmt-dest - " tfrag ~192H~5DK ~280Htfragment~456H~5DK~%" - (sar - (+ (-> this data 1 total) - (-> this data 2 total) - (-> this data 3 total) - (-> this data 4 total) - (-> this data 5 total) - (-> this data 6 total) - (-> this data 7 total) - (-> this data 8 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 1 total) 10) - ) - (format - fmt-dest - " tie-proto ~192H~5DK ~280Hsky~456H~5DK~%" - (sar - (+ (-> this data 9 total) - (-> this data 10 total) - (-> this data 11 total) - (-> this data 12 total) - (-> this data 13 total) - (-> this data 14 total) - (-> this data 16 total) - (-> this data 17 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 88 total) 10) - ) - (format - fmt-dest - " tie-instance ~192H~5DK ~280Htie-fragment~456H~5DK~%" - (sar (+ (-> this data 18 total) (-> this data 20 total) (-> this data 21 total) (-> this data 22 total)) 10) - (sar (-> *dma-mem-usage* data 9 total) 10) - ) - (format - fmt-dest - " shrub-proto ~192H~5DK ~280Htie-scissor~456H~5DK~%" - (sar - (+ (-> this data 25 total) - (-> this data 26 total) - (-> this data 27 total) - (-> this data 28 total) - (-> this data 29 total) - (-> this data 30 total) - (-> this data 31 total) - (-> this data 32 total) - (-> this data 33 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 15 total) 10) - ) - (format - fmt-dest - " shrub-instance ~192H~5DK ~280Hshrubbery~456H~5DK~%" - (sar (-> this data 34 total) 10) - (sar (-> *dma-mem-usage* data 27 total) 10) - ) - (format - fmt-dest - " collision ~192H~5DK ~280Htie-generic~456H~5DK~%" - (sar - (+ (-> this data 50 total) - (-> this data 51 total) - (-> this data 52 total) - (-> this data 53 total) - (-> this data 54 total) - (-> this data 55 total) - (-> this data 56 total) - (-> this data 57 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 17 total) 10) - ) - (format - fmt-dest - " pris-geo ~192H~5DK ~280Hpris-fragment~456H~5DK~%" - (sar - (+ (-> this data 35 total) - (-> this data 36 total) - (-> this data 37 total) - (-> this data 38 total) - (-> this data 39 total) - (-> this data 40 total) - (-> this data 41 total) - (-> this data 42 total) - (-> this data 73 total) - (-> this data 74 total) - (-> this data 75 total) - (-> this data 76 total) - (-> this data 78 total) - (-> this data 81 total) - (-> this data 80 total) - (-> this data 111 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 35 total) 10) - ) - (format - fmt-dest - " pris-anim ~192H~5DK ~280Hpris-generic~456H~5DK~%" - (sar - (+ (-> this data 67 total) - (-> this data 68 total) - (-> this data 69 total) - (-> this data 70 total) - (-> this data 71 total) - (-> this data 77 total) - (-> this data 79 total) - (-> this data 72 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 89 total) 10) - ) - (format - fmt-dest - " textures ~192H~5DK ~280Htextures~456H~5DK~%" - (sar (-> this data 82 total) 10) - (sar (-> *dma-mem-usage* data 82 total) 10) - ) - (format fmt-dest " entity ~192H~5DK~%" (sar - (+ (-> this data 66 total) - (-> this data 43 total) - (-> this data 44 total) - (-> this data 45 total) - (-> this data 49 total) - (-> this data 48 total) - (-> this data 46 total) - (-> this data 47 total) - ) - 10 - ) ) - (format - fmt-dest - " misc ~192H~5DK ~280Hsprite~456H~5DK~%" - (sar - (+ (-> this data 0 total) - (-> this data 63 total) - (-> this data 64 total) - (-> this data 83 total) - (-> this data 84 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 85 total) 10) + (s4-2 format) + (s2-2 "heap-~5,'-DK/~5,'-DK----~D---~D/~D~%") + (s1-1 (sar (memory-used *nk-dead-pool*) 10)) + (s0-1 (sar (memory-total *nk-dead-pool*) 10)) ) + (set! t0-0 (the-as int (compact-time *nk-dead-pool*))) + (set! t1-0 (the-as int (-> *nk-dead-pool* compact-count))) + (set! t2-0 (the-as int (-> *nk-dead-pool* compact-count-targ))) + (s4-2 s3-2 s2-2 s1-1 s0-1 t0-0 (the-as uint t1-0) (the-as uint t2-0)) + ) + ) + (when (not *stats-memory-short*) + (set! (-> *dma-mem-usage* data 87 total) + (* (dma-buffer-length (-> *display* frames (-> *display* last-screen) debug-buf)) 16) + ) + (let ((t9-11 format) + (a0-31 fmt-dest) + (a1-11 " bsp ~192H~5DK ~280Hdebug~456H~5DK~%") + (a2-6 (sar (+ (-> this data 58 total) (-> this data 59 total) (-> this data 60 total)) 10)) + (a3-3 (sar (-> *dma-mem-usage* data 87 total) 10)) + ) + (t9-11 a0-31 a1-11 a2-6 a3-3 (the-as none t0-0) (the-as none t1-0) (the-as none t2-0)) + (format + fmt-dest + " bsp-leaf-vis ~192H~5DK~%" + (sar (+ (-> this data 61 total) (-> this data 62 total)) 10) + (the-as none a3-3) ) + (format fmt-dest " level-code ~192H~5DK~%" (sar (-> this data 65 total) 10) (the-as none a3-3)) + ) + (format + fmt-dest + " tfrag ~192H~5DK ~280Htfragment~456H~5DK~%" + (sar + (+ (-> this data 1 total) + (-> this data 2 total) + (-> this data 3 total) + (-> this data 4 total) + (-> this data 5 total) + (-> this data 6 total) + (-> this data 7 total) + (-> this data 8 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 1 total) 10) + ) + (format + fmt-dest + " tie-proto ~192H~5DK ~280Hsky~456H~5DK~%" + (sar + (+ (-> this data 9 total) + (-> this data 10 total) + (-> this data 11 total) + (-> this data 12 total) + (-> this data 13 total) + (-> this data 14 total) + (-> this data 16 total) + (-> this data 17 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 88 total) 10) + ) + (format + fmt-dest + " tie-instance ~192H~5DK ~280Htie-fragment~456H~5DK~%" + (sar (+ (-> this data 18 total) (-> this data 20 total) (-> this data 21 total) (-> this data 22 total)) 10) + (sar (-> *dma-mem-usage* data 9 total) 10) + ) + (format + fmt-dest + " shrub-proto ~192H~5DK ~280Htie-scissor~456H~5DK~%" + (sar + (+ (-> this data 25 total) + (-> this data 26 total) + (-> this data 27 total) + (-> this data 28 total) + (-> this data 29 total) + (-> this data 30 total) + (-> this data 31 total) + (-> this data 32 total) + (-> this data 33 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 15 total) 10) + ) + (format + fmt-dest + " shrub-instance ~192H~5DK ~280Hshrubbery~456H~5DK~%" + (sar (-> this data 34 total) 10) + (sar (-> *dma-mem-usage* data 27 total) 10) + ) + (format + fmt-dest + " collision ~192H~5DK ~280Htie-generic~456H~5DK~%" + (sar + (+ (-> this data 50 total) + (-> this data 51 total) + (-> this data 52 total) + (-> this data 53 total) + (-> this data 54 total) + (-> this data 55 total) + (-> this data 56 total) + (-> this data 57 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 17 total) 10) + ) + (format + fmt-dest + " pris-geo ~192H~5DK ~280Hpris-fragment~456H~5DK~%" + (sar + (+ (-> this data 35 total) + (-> this data 36 total) + (-> this data 37 total) + (-> this data 38 total) + (-> this data 39 total) + (-> this data 40 total) + (-> this data 41 total) + (-> this data 42 total) + (-> this data 73 total) + (-> this data 74 total) + (-> this data 75 total) + (-> this data 76 total) + (-> this data 78 total) + (-> this data 81 total) + (-> this data 80 total) + (-> this data 111 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 35 total) 10) + ) + (format + fmt-dest + " pris-anim ~192H~5DK ~280Hpris-generic~456H~5DK~%" + (sar + (+ (-> this data 67 total) + (-> this data 68 total) + (-> this data 69 total) + (-> this data 70 total) + (-> this data 71 total) + (-> this data 77 total) + (-> this data 79 total) + (-> this data 72 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 89 total) 10) + ) + (format + fmt-dest + " textures ~192H~5DK ~280Htextures~456H~5DK~%" + (sar (-> this data 82 total) 10) + (sar (-> *dma-mem-usage* data 82 total) 10) + ) + (format fmt-dest " entity ~192H~5DK~%" (sar + (+ (-> this data 66 total) + (-> this data 43 total) + (-> this data 44 total) + (-> this data 45 total) + (-> this data 49 total) + (-> this data 48 total) + (-> this data 46 total) + (-> this data 47 total) + ) + 10 + ) + ) + (format + fmt-dest + " misc ~192H~5DK ~280Hsprite~456H~5DK~%" + (sar + (+ (-> this data 0 total) + (-> this data 63 total) + (-> this data 64 total) + (-> this data 83 total) + (-> this data 84 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 85 total) 10) ) ) ) diff --git a/goal_src/jak2/engine/debug/menu.gc b/goal_src/jak2/engine/debug/menu.gc index d513a60d48..09066915fc 100644 --- a/goal_src/jak2/engine/debug/menu.gc +++ b/goal_src/jak2/engine/debug/menu.gc @@ -505,18 +505,7 @@ ;; ERROR: Stack slot load at 96 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 128 mismatch: defined as size 4, got size 16 (defun debug-menu-make-from-template ((arg0 debug-menu-context) (arg1 pair)) - (local-vars - (s4-0 debug-menu-node) - (sv-16 object) - (sv-32 (function object int int)) - (sv-48 int) - (sv-64 (function object int int)) - (sv-80 (function object float float)) - (sv-96 float) - (sv-112 (function object float float)) - (sv-128 float) - (sv-144 (function object int int)) - ) + (local-vars (s4-0 debug-menu-node)) (when (or (not arg1) (null? arg1)) (set! s4-0 (the-as debug-menu-node #f)) (goto cfg-39) @@ -591,79 +580,44 @@ ) ) ((or (= s5-0 'int-var) (= s5-0 'int-var-gat1) (= s5-0 'hex-var)) - (set! s4-0 (new - 'debug - 'debug-menu-item-var - (the-as string s4-1) - (the-as int (car (cdr (cdr arg1)))) - (the-as int (ref arg1 4)) - ) - ) - (let ((s3-4 debug-menu-item-var-make-int) - (s2-3 (the-as debug-menu-item-var s4-0)) - (s1-3 (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) - (s0-2 (command-get-int (ref arg1 5) 0)) - ) - (set! sv-16 (ref arg1 6)) - (set! sv-32 command-get-int) - (let ((a0-24 (ref arg1 7)) - (a1-18 0) + (set! s4-0 + (new + 'debug + 'debug-menu-item-var + (the-as string s4-1) + (the-as int (car (cdr (cdr arg1)))) + (the-as int (ref arg1 4)) ) - (set! sv-48 (sv-32 a0-24 a1-18)) - ) - (set! sv-64 command-get-int) - (let* ((a0-26 (ref arg1 8)) - (a1-20 0) - (t1-0 (sv-64 a0-26 a1-20)) - (t2-0 (= s5-0 'hex-var)) - ) - (s3-4 s2-3 (the-as (function int debug-menu-msg int int int) s1-3) s0-2 (the-as symbol sv-16) sv-48 t1-0 t2-0) - ) + ) + (debug-menu-item-var-make-int + (the-as debug-menu-item-var s4-0) + (the-as (function int debug-menu-msg int int int) (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) + (command-get-int (ref arg1 5) 0) + (the-as symbol (ref arg1 6)) + (command-get-int (ref arg1 7) 0) + (command-get-int (ref arg1 8) 0) + (= s5-0 'hex-var) ) s4-0 ) ((= s5-0 'float-var) - (set! s4-0 (new - 'debug - 'debug-menu-item-var - (the-as string s4-1) - (the-as int (car (cdr (cdr arg1)))) - (the-as int (ref arg1 4)) - ) - ) - (let ((s5-5 debug-menu-item-var-make-float) - (s3-6 (the-as debug-menu-item-var s4-0)) - (s2-5 (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) - (s1-6 (command-get-float (ref arg1 5) 0.0)) - (s0-3 (ref arg1 6)) - ) - (set! sv-80 command-get-float) - (let ((a0-35 (ref arg1 7)) - (a1-28 0.0) + (set! s4-0 + (new + 'debug + 'debug-menu-item-var + (the-as string s4-1) + (the-as int (car (cdr (cdr arg1)))) + (the-as int (ref arg1 4)) ) - (set! sv-96 (sv-80 a0-35 a1-28)) - ) - (set! sv-112 command-get-float) - (let ((a0-37 (ref arg1 8)) - (a1-30 0.0) - ) - (set! sv-128 (sv-112 a0-37 a1-30)) - ) - (set! sv-144 command-get-int) - (let* ((a0-39 (ref arg1 9)) - (a1-32 0) - (t2-1 (sv-144 a0-39 a1-32)) - ) - (s5-5 - s3-6 - (the-as (function int debug-menu-msg float float float) s2-5) - s1-6 - (the-as symbol s0-3) - sv-96 - sv-128 - t2-1 ) - ) + (debug-menu-item-var-make-float + (the-as debug-menu-item-var s4-0) + (the-as (function int debug-menu-msg float float float) (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) + (command-get-float (ref arg1 5) 0.0) + (the-as symbol (ref arg1 6)) + (command-get-float (ref arg1 7) 0.0) + (command-get-float (ref arg1 8) 0.0) + (command-get-int (ref arg1 9) 0) ) s4-0 ) @@ -845,13 +799,7 @@ (draw-string "..." s1-0 s5-0) (set! arg4 (and (zero? arg3) arg4)) (when arg4 - (let ((v1-14 s5-0) - (a1-5 20) - (a0-8 379) - ) - (set! (-> v1-14 origin x) (the float a1-5)) - (set! (-> v1-14 origin y) (the float a0-8)) - ) + (set-origin! s5-0 20 379) (draw-string-adv (-> arg0 name) s1-0 s5-0) (draw-string-adv ":" s1-0 s5-0) (draw-string (-> arg0 display-str) s1-0 s5-0) @@ -892,7 +840,6 @@ ) (defun debug-menu-render ((arg0 debug-menu) (arg1 int) (arg2 int) (arg3 debug-menu-node) (arg4 int)) - (local-vars (sv-16 dma-buffer) (sv-32 pointer)) (let ((v1-0 0)) (let* ((a0-1 (-> arg0 items)) (a1-1 (car a0-1)) @@ -929,28 +876,24 @@ (font-color menu) ) ) - (let ((v1-20 (-> arg0 context font)) - (a1-5 s3-1) - (a0-15 s2-1) + (set-origin! (-> arg0 context font) s3-1 s2-1) + (let* ((sv-16 (-> *display* frames (-> *display* on-screen) debug-buf)) + (sv-32 (-> sv-16 base)) + ) + (draw-string ">" sv-16 (-> arg0 context font)) + (let ((a3-3 (-> sv-16 base))) + (let ((v1-32 (the-as object (-> sv-16 base)))) + (set! (-> (the-as dma-packet v1-32) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-32) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-32) vif1) (new 'static 'vif-tag)) + (set! (-> sv-16 base) (&+ (the-as pointer v1-32) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (bucket-id debug3) + sv-32 + (the-as (pointer dma-tag) a3-3) ) - (set! (-> v1-20 origin x) (the float a1-5)) - (set! (-> v1-20 origin y) (the float a0-15)) - ) - (set! sv-16 (-> *display* frames (-> *display* on-screen) debug-buf)) - (set! sv-32 (-> sv-16 base)) - (draw-string ">" sv-16 (-> arg0 context font)) - (let ((a3-3 (-> sv-16 base))) - (let ((v1-32 (the-as object (-> sv-16 base)))) - (set! (-> (the-as dma-packet v1-32) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-32) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-32) vif1) (new 'static 'vif-tag)) - (set! (-> sv-16 base) (&+ (the-as pointer v1-32) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id debug3) - sv-32 - (the-as (pointer dma-tag) a3-3) ) ) ) diff --git a/goal_src/jak2/engine/debug/nav/mysql-nav-graph.gc b/goal_src/jak2/engine/debug/nav/mysql-nav-graph.gc index f1c3a6b4d9..510e387d4e 100644 --- a/goal_src/jak2/engine/debug/nav/mysql-nav-graph.gc +++ b/goal_src/jak2/engine/debug/nav/mysql-nav-graph.gc @@ -238,7 +238,7 @@ (defmethod alloc-new-node! ((this mysql-nav-graph)) "Allocates a new `[[mysql-nav-node]]`, if `node-array`'s `length` exceeds `3000` return `-1` -otherwise, return the new size of the array" + otherwise, return the new size of the array" (cond ((>= (-> this node-array length) 3000) (format #t "mysql-nav-graph : nodes buffer too small, increase NAV_GRAPH_EDITOR_NODE_COUNT~%") @@ -262,7 +262,7 @@ otherwise, return the new size of the array" (defmethod alloc-new-edge! ((this mysql-nav-graph)) "Allocates a new `[[mysql-nav-edge]]`, if `edge-array`'s `length` exceeds `5000` return `-1` -otherwise, return the new size of the array" + otherwise, return the new size of the array" (cond ((>= (-> this edge-array length) 5000) (format #t "mysql-nav-graph : edges buffer too small, increase NAV_GRAPH_EDITOR_EDGE_COUNT~%") @@ -286,7 +286,7 @@ otherwise, return the new size of the array" (defmethod indexof-visnode ((this mysql-nav-graph) (edge-id int) (node-id int)) "Returns the index in the `visnode-array` whom's [[mysql-nav-visnode]] has the provided `runtime-edge-id` and `runtime-node-id` -if none exist, return `-1`" + if none exist, return `-1`" (dotimes (v1-0 (-> this visnode-array length)) (let ((a3-2 (-> this visnode-array data v1-0))) (if (and (= (-> a3-2 runtime-edge-id) edge-id) (= (-> a3-2 runtime-node-id) node-id)) @@ -299,9 +299,9 @@ if none exist, return `-1`" (defmethod alloc-new-visnode! ((this mysql-nav-graph) (edge-id int) (node-id int)) "Potentially allocates a new `[[mysql-nav-visnode]]`: -- if `visnode-array`'s `length` exceeds `3000` return `-1` -- otherwise, if the node already exists, TODO -- if the node does not already exist, create it!" + - if `visnode-array`'s `length` exceeds `3000` return `-1` + - otherwise, if the node already exists, TODO + - if the node does not already exist, create it!" (cond ((>= (-> this visnode-array length) 3000) (format #t "mysql-nav-graph : visnodes buffer too small, increase NAV_GRAPH_EDITOR_VISNODE_COUNT~%") @@ -697,7 +697,7 @@ if none exist, return `-1`" (defmethod indexof-nav-node ((this mysql-nav-graph) (node-id int)) "Iterate through the `node-array` and return the index for the first [[mysql-nav-node]] whom's `nav_node_id` matches the provided id -returns `-1` if none is found" + returns `-1` if none is found" (dotimes (v1-0 (-> this node-array length)) (if (= node-id (-> (the-as mysql-nav-node (-> this node-array data v1-0)) nav_node_id)) (return v1-0) @@ -708,7 +708,7 @@ returns `-1` if none is found" (defmethod indexof-nav-edge ((this mysql-nav-graph) (edge-id int)) "Iterate through the `edge-array` and return the index for the first [[mysql-nav-edge]] whom's `nav_edge_id` matches the provided id -returns `-1` if none is found" + returns `-1` if none is found" (dotimes (v1-0 (-> this edge-array length)) (if (= edge-id (-> (the-as mysql-nav-edge (-> this edge-array data v1-0)) nav_edge_id)) (return v1-0) @@ -726,7 +726,6 @@ returns `-1` if none is found" ;; WARN: new jak 2 until loop case, check carefully (defmethod init-from-sql! ((this mysql-nav-graph) (arg0 string) (arg1 string)) "Query the database and initialize the [[mysql-nav-graph]] and all it's related components" - (local-vars (sv-16 string) (sv-32 int) (sv-48 int) (sv-64 int)) (set! (-> this node-array length) 0) (set! (-> this edge-array length) 0) (set! (-> this visnode-array length) 0) @@ -774,35 +773,36 @@ returns `-1` if none is found" (set! (-> nav-node angle) (* 182.04445 (string->float (-> s2-1 data (+ s1-0 5))))) (set! (-> nav-node radius) (* 4096.0 (string->float (-> s2-1 data (+ s1-0 6))))) (set! (-> nav-node nav_node_flag) (nav-node-flag)) - (set! sv-16 (new 'global 'string 0 (-> s2-1 data (+ s1-0 7)))) - (copy-string<-string sv-16 (-> s2-1 data (+ s1-0 7))) - (until #f - (cond - ((string-prefix= "visited" sv-16) - (logior! (-> nav-node nav_node_flag) (nav-node-flag visited)) - ) - ((string-prefix= "blocked" sv-16) - (logior! (-> nav-node nav_node_flag) (nav-node-flag blocked)) - ) - ((string-prefix= "pedestrian" sv-16) - (logior! (-> nav-node nav_node_flag) (nav-node-flag pedestrian)) - ) - ((string-prefix= "selected" sv-16) - (logior! (-> nav-node nav_node_flag) (nav-node-flag selected)) - ) - ((string-prefix= "hidden" sv-16) - (logior! (-> nav-node nav_node_flag) (nav-node-flag hidden)) - ) - (else - #t - (goto cfg-27) - ) - ) - (let ((a1-16 (string-skip-to-char (-> sv-16 data) (the-as uint 44)))) - (if (= (-> a1-16 0) 44) - (set! a1-16 (&-> a1-16 1)) + (let ((sv-16 (new 'global 'string 0 (-> s2-1 data (+ s1-0 7))))) + (copy-string<-string sv-16 (-> s2-1 data (+ s1-0 7))) + (until #f + (cond + ((string-prefix= "visited" sv-16) + (logior! (-> nav-node nav_node_flag) (nav-node-flag visited)) + ) + ((string-prefix= "blocked" sv-16) + (logior! (-> nav-node nav_node_flag) (nav-node-flag blocked)) + ) + ((string-prefix= "pedestrian" sv-16) + (logior! (-> nav-node nav_node_flag) (nav-node-flag pedestrian)) + ) + ((string-prefix= "selected" sv-16) + (logior! (-> nav-node nav_node_flag) (nav-node-flag selected)) + ) + ((string-prefix= "hidden" sv-16) + (logior! (-> nav-node nav_node_flag) (nav-node-flag hidden)) + ) + (else + #t + (goto cfg-27) ) - (string-suck-up! sv-16 a1-16) + ) + (let ((a1-16 (string-skip-to-char (-> sv-16 data) (the-as uint 44)))) + (if (= (-> a1-16 0) 44) + (set! a1-16 (&-> a1-16 1)) + ) + (string-suck-up! sv-16 a1-16) + ) ) ) #f @@ -846,155 +846,155 @@ returns `-1` if none is found" (let ((s2-2 0)) (while (< s2-2 (-> s3-3 len)) (when (= (string->int (-> s3-3 data (+ s2-2 11))) (-> this nav_graph_id)) - (let ((s0-2 (string->int (-> s3-3 data (+ s2-2 1))))) - (set! sv-32 (string->int (-> s3-3 data (+ s2-2 2)))) - (set! sv-48 (indexof-nav-node this s0-2)) - (set! sv-64 (indexof-nav-node this sv-32)) - (let ((nav-edge (-> this edge-array data (-> this edge-array length)))) - (when (and (!= sv-48 -1) (!= sv-64 -1)) - (set! (-> nav-edge nav_graph_id) (-> this nav_graph_id)) - (set! (-> nav-edge nav_edge_id) (the-as uint (string->int (-> s3-3 data s2-2)))) - (set! (-> nav-edge nav_node_id_1) (the-as uint s0-2)) - (set! (-> nav-edge nav_node_id_2) (the-as uint sv-32)) - (set! (-> nav-edge mysql-save-flag) (mysql-save-flag)) - (set! (-> nav-edge runtime-id) (the-as uint (-> this edge-array length))) - (set! (-> nav-edge runtime-node-id-1) sv-48) - (set! (-> nav-edge runtime-node-id-2) sv-64) - (let ((s0-3 (-> s3-3 data (+ s2-2 3)))) - (cond - ((string= "default" s0-3) - (set! (-> nav-edge directionality) (nav-directionality default)) - 0 - ) - ((string= "directed" s0-3) - (set! (-> nav-edge directionality) (nav-directionality directed)) - ) - ((string= "bi_directional" s0-3) - (set! (-> nav-edge directionality) (nav-directionality bi_directional)) - ) - ) + (let* ((s0-2 (string->int (-> s3-3 data (+ s2-2 1)))) + (sv-32 (string->int (-> s3-3 data (+ s2-2 2)))) + (sv-48 (indexof-nav-node this s0-2)) + (sv-64 (indexof-nav-node this sv-32)) + (nav-edge (-> this edge-array data (-> this edge-array length))) + ) + (when (and (!= sv-48 -1) (!= sv-64 -1)) + (set! (-> nav-edge nav_graph_id) (-> this nav_graph_id)) + (set! (-> nav-edge nav_edge_id) (the-as uint (string->int (-> s3-3 data s2-2)))) + (set! (-> nav-edge nav_node_id_1) (the-as uint s0-2)) + (set! (-> nav-edge nav_node_id_2) (the-as uint sv-32)) + (set! (-> nav-edge mysql-save-flag) (mysql-save-flag)) + (set! (-> nav-edge runtime-id) (the-as uint (-> this edge-array length))) + (set! (-> nav-edge runtime-node-id-1) sv-48) + (set! (-> nav-edge runtime-node-id-2) sv-64) + (let ((s0-3 (-> s3-3 data (+ s2-2 3)))) + (cond + ((string= "default" s0-3) + (set! (-> nav-edge directionality) (nav-directionality default)) + 0 + ) + ((string= "directed" s0-3) + (set! (-> nav-edge directionality) (nav-directionality directed)) + ) + ((string= "bi_directional" s0-3) + (set! (-> nav-edge directionality) (nav-directionality bi_directional)) + ) ) - (set! (-> nav-edge speed_limit) (* 4096.0 (string->float (-> s3-3 data (+ s2-2 4))))) - (set! (-> nav-edge density) (string->float (-> s3-3 data (+ s2-2 5)))) - (set! (-> nav-edge traffic_edge_flag) 0) - (let ((s0-4 (new 'global 'string 0 (-> s3-3 data (+ s2-2 6))))) - (copy-string<-string s0-4 (-> s3-3 data (+ s2-2 6))) - (until #f - (cond - ((string-prefix= "pedestrian" s0-4) - (logior! (-> nav-edge traffic_edge_flag) 1) - ) - (else - #t - (goto cfg-58) - ) - ) - (let ((a1-30 (string-skip-to-char (-> s0-4 data) (the-as uint 44)))) - (if (= (-> a1-30 0) 44) - (set! a1-30 (&-> a1-30 1)) - ) - (string-suck-up! s0-4 a1-30) - ) - ) - ) - #f - (label cfg-58) - (set! (-> nav-edge nav_clock_mask) (nav-clock-mask)) - (let ((s0-5 (new 'global 'string 0 (-> s3-3 data (+ s2-2 7))))) - (copy-string<-string s0-5 (-> s3-3 data (+ s2-2 7))) - (until #f - (cond - ((string-prefix= "phase-1a" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-1a)) - ) - ((string-prefix= "phase-1" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-1)) - ) - ((string-prefix= "phase-2a" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-2a)) - ) - ((string-prefix= "phase-2" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-2)) - ) - ((string-prefix= "phase-3a" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-3a)) - ) - ((string-prefix= "phase-3" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-3)) - ) - ((string-prefix= "phase-4a" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-4a)) - ) - ((string-prefix= "phase-4" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-4)) - ) - (else - #t - (goto cfg-80) - ) - ) - (let ((a1-42 (string-skip-to-char (-> s0-5 data) (the-as uint 44)))) - (if (= (-> a1-42 0) 44) - (set! a1-42 (&-> a1-42 1)) - ) - (string-suck-up! s0-5 a1-42) - ) - ) - ) - #f - (label cfg-80) - (let ((s0-6 (-> s3-3 data (+ s2-2 8)))) - (cond - ((string= "no-clock" s0-6) - (set! (-> nav-edge nav_clock_type) (nav-clock-type no-clock)) - 0 - ) - ((string= "clock2" s0-6) - (set! (-> nav-edge nav_clock_type) (nav-clock-type clock2)) - ) - ((string= "clock3" s0-6) - (set! (-> nav-edge nav_clock_type) (nav-clock-type clock3)) - ) - ((string= "clock4" s0-6) - (set! (-> nav-edge nav_clock_type) (nav-clock-type clock4)) - ) - ) - ) - (set! (-> nav-edge width) (* 4096.0 (string->float (-> s3-3 data (+ s2-2 9))))) - (set! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag)) - (let ((s0-7 (new 'global 'string 0 (-> s3-3 data (+ s2-2 10))))) - (copy-string<-string s0-7 (-> s3-3 data (+ s2-2 10))) - (until #f - (cond - ((string-prefix= "pass-red" s0-7) - (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-red)) - ) - ((string-prefix= "pass-green" s0-7) - (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-green)) - ) - ((string-prefix= "pass-yellow" s0-7) - (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-yellow)) - ) - ((string-prefix= "pass-blue" s0-7) - (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-blue)) - ) - (else - #t - (goto cfg-102) - ) - ) - (let ((a1-54 (string-skip-to-char (-> s0-7 data) (the-as uint 44)))) - (if (= (-> a1-54 0) 44) - (set! a1-54 (&-> a1-54 1)) - ) - (string-suck-up! s0-7 a1-54) - ) - ) - ) - #f - (label cfg-102) - (+! (-> this edge-array length) 1) ) + (set! (-> nav-edge speed_limit) (* 4096.0 (string->float (-> s3-3 data (+ s2-2 4))))) + (set! (-> nav-edge density) (string->float (-> s3-3 data (+ s2-2 5)))) + (set! (-> nav-edge traffic_edge_flag) 0) + (let ((s0-4 (new 'global 'string 0 (-> s3-3 data (+ s2-2 6))))) + (copy-string<-string s0-4 (-> s3-3 data (+ s2-2 6))) + (until #f + (cond + ((string-prefix= "pedestrian" s0-4) + (logior! (-> nav-edge traffic_edge_flag) 1) + ) + (else + #t + (goto cfg-58) + ) + ) + (let ((a1-30 (string-skip-to-char (-> s0-4 data) (the-as uint 44)))) + (if (= (-> a1-30 0) 44) + (set! a1-30 (&-> a1-30 1)) + ) + (string-suck-up! s0-4 a1-30) + ) + ) + ) + #f + (label cfg-58) + (set! (-> nav-edge nav_clock_mask) (nav-clock-mask)) + (let ((s0-5 (new 'global 'string 0 (-> s3-3 data (+ s2-2 7))))) + (copy-string<-string s0-5 (-> s3-3 data (+ s2-2 7))) + (until #f + (cond + ((string-prefix= "phase-1a" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-1a)) + ) + ((string-prefix= "phase-1" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-1)) + ) + ((string-prefix= "phase-2a" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-2a)) + ) + ((string-prefix= "phase-2" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-2)) + ) + ((string-prefix= "phase-3a" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-3a)) + ) + ((string-prefix= "phase-3" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-3)) + ) + ((string-prefix= "phase-4a" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-4a)) + ) + ((string-prefix= "phase-4" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-4)) + ) + (else + #t + (goto cfg-80) + ) + ) + (let ((a1-42 (string-skip-to-char (-> s0-5 data) (the-as uint 44)))) + (if (= (-> a1-42 0) 44) + (set! a1-42 (&-> a1-42 1)) + ) + (string-suck-up! s0-5 a1-42) + ) + ) + ) + #f + (label cfg-80) + (let ((s0-6 (-> s3-3 data (+ s2-2 8)))) + (cond + ((string= "no-clock" s0-6) + (set! (-> nav-edge nav_clock_type) (nav-clock-type no-clock)) + 0 + ) + ((string= "clock2" s0-6) + (set! (-> nav-edge nav_clock_type) (nav-clock-type clock2)) + ) + ((string= "clock3" s0-6) + (set! (-> nav-edge nav_clock_type) (nav-clock-type clock3)) + ) + ((string= "clock4" s0-6) + (set! (-> nav-edge nav_clock_type) (nav-clock-type clock4)) + ) + ) + ) + (set! (-> nav-edge width) (* 4096.0 (string->float (-> s3-3 data (+ s2-2 9))))) + (set! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag)) + (let ((s0-7 (new 'global 'string 0 (-> s3-3 data (+ s2-2 10))))) + (copy-string<-string s0-7 (-> s3-3 data (+ s2-2 10))) + (until #f + (cond + ((string-prefix= "pass-red" s0-7) + (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-red)) + ) + ((string-prefix= "pass-green" s0-7) + (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-green)) + ) + ((string-prefix= "pass-yellow" s0-7) + (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-yellow)) + ) + ((string-prefix= "pass-blue" s0-7) + (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-blue)) + ) + (else + #t + (goto cfg-102) + ) + ) + (let ((a1-54 (string-skip-to-char (-> s0-7 data) (the-as uint 44)))) + (if (= (-> a1-54 0) 44) + (set! a1-54 (&-> a1-54 1)) + ) + (string-suck-up! s0-7 a1-54) + ) + ) + ) + #f + (label cfg-102) + (+! (-> this edge-array length) 1) ) ) ) @@ -1168,6 +1168,43 @@ returns `-1` if none is found" ) ) +(defmethod mysql-nav-graph-method-19 ((this mysql-nav-graph)) + (set! (-> this level-info-array-length) 0) + (set! (-> this level-info-last-lookup) 0) + (dotimes (v1-0 32) + (let ((a0-3 (-> this level-info-array v1-0))) + (set! (-> a0-3 level) #f) + (set! (-> a0-3 level-id) (the-as uint v1-0)) + (set! (-> a0-3 node-count) 0) + (set! (-> a0-3 branch-count) 0) + (set! (-> a0-3 to-link-count) 0) + ) + 0 + ) + (dotimes (s5-0 (-> this node-array length)) + (let ((s4-0 (-> this node-array data s5-0))) + (when (not (logtest? (-> s4-0 mysql-save-flag) (mysql-save-flag delete))) + (let ((v1-10 (lookup-level-info2 this s4-0 #t))) + (set! (-> s4-0 level-node-index) (-> v1-10 node-count)) + (+! (-> v1-10 node-count) 1) + (let ((a0-10 (the-as mysql-nav-edge (-> s4-0 temp-edge-list)))) + (while a0-10 + (when (not (logtest? (-> a0-10 mysql-save-flag) (mysql-save-flag delete))) + (if (!= (-> v1-10 level) (-> this node-array data (-> a0-10 runtime-node-id-2) level_name)) + (+! (-> v1-10 to-link-count) 1) + ) + (+! (-> v1-10 branch-count) 1) + ) + (set! a0-10 (-> a0-10 temp-next-edge)) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) (defmethod mysql-nav-graph-method-20 ((this mysql-nav-graph)) (mysql-nav-graph-method-17 this) @@ -1175,3 +1212,43 @@ returns `-1` if none is found" 0 (none) ) + +(defmethod exec-sql! ((this mysql-nav-graph)) + (format #t "Saving nodes ...~%") + (dotimes (s5-0 (-> this node-array length)) + (let ((a0-3 (-> this node-array data s5-0))) + (set! (-> a0-3 nav_graph_id) (-> this nav_graph_id)) + (if (not (exec-sql! a0-3)) + (return #f) + ) + ) + ) + (format #t "Done.~%") + (format #t "Saving edges ...~%") + (dotimes (s5-1 (-> this edge-array length)) + (let ((a0-7 (-> this edge-array data s5-1))) + (set! (-> a0-7 nav_graph_id) (-> this nav_graph_id)) + (set! (-> a0-7 nav_node_id_1) (-> this node-array data (-> a0-7 runtime-node-id-1) nav_node_id)) + (set! (-> a0-7 nav_node_id_2) (-> this node-array data (-> a0-7 runtime-node-id-2) nav_node_id)) + (exec-sql! a0-7) + ) + ) + (format #t "Done.~%") + (format #t "Saving visible nodes ...~%") + (dotimes (s5-2 (-> this visnode-array length)) + (let ((a0-11 (-> this visnode-array data s5-2))) + (set! (-> a0-11 nav_graph_id) (-> this nav_graph_id)) + (set! (-> a0-11 nav_node_id) (-> this node-array data (-> a0-11 runtime-node-id) nav_node_id)) + (set! (-> a0-11 nav_edge_id) + (-> (the-as mysql-nav-edge (+ (the-as uint (-> this edge-array)) (* 80 (-> a0-11 runtime-edge-id)))) + nav_node_id_2 + ) + ) + (if (not (exec-sql! a0-11)) + (return #f) + ) + ) + ) + (format #t "Done.~%") + #t + ) diff --git a/goal_src/jak2/engine/debug/nav/nav-graph-editor.gc b/goal_src/jak2/engine/debug/nav/nav-graph-editor.gc index 1bb6f5d495..965e96f388 100644 --- a/goal_src/jak2/engine/debug/nav/nav-graph-editor.gc +++ b/goal_src/jak2/engine/debug/nav/nav-graph-editor.gc @@ -191,12 +191,7 @@ (dotimes (s2-0 (-> s3-0 length)) (let ((s1-0 (-> s3-0 s2-0))) (-> s1-0 aid) - (let* ((s0-0 s1-0) - (v1-14 (if (type? s0-0 entity-nav-mesh) - s0-0 - ) - ) - ) + (let ((v1-14 (as-type s1-0 entity-nav-mesh))) (when v1-14 (let ((a0-7 (-> v1-14 nav-mesh)) (a1-2 (new 'stack-no-clear 'nav-find-poly-parms)) @@ -261,28 +256,25 @@ (let ((v1-23 (-> this nav-graph visnode-array data s3-1))) (when (and (= (-> v1-23 runtime-edge-id) arg0) (not (logtest? (-> v1-23 mysql-save-flag) (mysql-save-flag delete)))) (vector-! - (the-as vector (-> s4-0 vector)) + (-> s4-0 vector 0) (the-as vector (+ (the-as uint (-> this nav-graph node-array data 0 position)) (* 80 (-> v1-23 runtime-node-id))) ) (-> s4-0 trans) ) - (vector-normalize! - (the-as vector (-> s4-0 vector)) - (fmax 15360.0 (+ -15360.0 (vector-length (the-as vector (-> s4-0 vector))))) - ) - (vector-rotate-around-y! (-> s4-0 vector 1) (the-as vector (-> s4-0 vector)) 24576.0) + (vector-normalize! (-> s4-0 vector 0) (fmax 15360.0 (+ -15360.0 (vector-length (-> s4-0 vector 0))))) + (vector-rotate-around-y! (-> s4-0 vector 1) (-> s4-0 vector 0) 24576.0) (vector-normalize! (-> s4-0 vector 1) 16384.0) - (vector-rotate-around-y! (-> s4-0 vector 2) (the-as vector (-> s4-0 vector)) -24576.0) + (vector-rotate-around-y! (-> s4-0 vector 2) (-> s4-0 vector 0) -24576.0) (vector-normalize! (-> s4-0 vector 2) 16384.0) - (vector+! (the-as vector (-> s4-0 vector)) (the-as vector (-> s4-0 vector)) (-> s4-0 trans)) - (vector+! (-> s4-0 vector 2) (-> s4-0 vector 2) (the-as vector (-> s4-0 vector))) - (vector+! (-> s4-0 vector 1) (-> s4-0 vector 1) (the-as vector (-> s4-0 vector))) + (vector+! (-> s4-0 vector 0) (-> s4-0 vector 0) (-> s4-0 trans)) + (vector+! (-> s4-0 vector 2) (-> s4-0 vector 2) (-> s4-0 vector 0)) + (vector+! (-> s4-0 vector 1) (-> s4-0 vector 1) (-> s4-0 vector 0)) (add-debug-line #t (bucket-id debug2) - (the-as vector (-> s4-0 vector)) + (-> s4-0 vector 0) (-> s4-0 vector 1) *color-light-yellow* #f @@ -291,7 +283,7 @@ (add-debug-line #t (bucket-id debug2) - (the-as vector (-> s4-0 vector)) + (-> s4-0 vector 0) (-> s4-0 vector 2) *color-light-yellow* #f @@ -306,12 +298,12 @@ #f (the-as rgba -1) ) - (vector-lerp! (the-as vector (-> s4-0 vector)) (-> s4-0 vector 1) (-> s4-0 vector 2) 0.5) + (vector-lerp! (-> s4-0 vector 0) (-> s4-0 vector 1) (-> s4-0 vector 2) 0.5) (add-debug-line #t (bucket-id debug2) (-> s4-0 trans) - (the-as vector (-> s4-0 vector)) + (-> s4-0 vector 0) *color-light-yellow* #f (the-as rgba -1) @@ -434,7 +426,6 @@ ) (defmethod nav-graph-editor-method-28 ((this nav-graph-editor)) - (local-vars (sv-144 int) (sv-160 (function _varargs_ object))) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -455,11 +446,7 @@ (set! (-> v1-8 w) (-> s2-0 radius)) ) (set! (-> s2-0 cam-dist) (vector-vector-distance-squared s3-0 (camera-pos))) - (let ((f0-6 (-> s2-0 cam-dist)) - (f1-0 (-> this clipping-dist)) - ) - (set! (-> s2-0 visible) (< f0-6 (* f1-0 f1-0))) - ) + (set! (-> s2-0 visible) (< (-> s2-0 cam-dist) (square (-> this clipping-dist)))) (if (or (and (-> this vehicle-edit-mode) (logtest? (-> s2-0 nav_node_flag) (nav-node-flag pedestrian))) (and (not (-> this vehicle-edit-mode)) (not (logtest? (-> s2-0 nav_node_flag) (nav-node-flag pedestrian)))) ) @@ -494,48 +481,46 @@ (add-debug-x #t (bucket-id debug2) s3-0 *color-red*) (let ((s1-1 add-debug-text-3d) (s0-1 #t) + (sv-144 324) ) - (set! sv-144 324) - (set! sv-160 format) - (let ((a0-16 (clear *temp-string*)) - (a1-8 "~D") - (a2-6 (-> s2-0 nav_mesh_id)) + (format (clear *temp-string*) "~D" (-> s2-0 nav_mesh_id)) + (let ((a2-7 *temp-string*) + (a3-2 s3-0) + (v1-24 (-> s2-0 level_name)) ) - (sv-160 a0-16 a1-8 a2-6) - ) - (let* ((a2-7 *temp-string*) - (a3-2 s3-0) - (v1-24 (-> s2-0 level_name)) - (t0-1 (cond - ((= v1-24 'ctyport) - 3 - ) - ((= v1-24 'ctyinda) - 4 - ) - ((= v1-24 'ctyindb) - 5 - ) - ((= v1-24 'ctypal) - 6 - ) - ((= v1-24 'ctysluma) - 7 - ) - ((= v1-24 'ctyslumb) - 8 - ) - ((= v1-24 'ctyslumc) - 9 - ) - (else - 1 - ) - ) - ) - (t1-0 #f) + (s1-1 + s0-1 + (the-as bucket-id sv-144) + a2-7 + a3-2 + (cond + ((= v1-24 'ctyport) + (font-color red) ) - (s1-1 s0-1 (the-as bucket-id sv-144) a2-7 a3-2 (the-as font-color t0-1) (the-as vector2h t1-0)) + ((= v1-24 'ctyinda) + (font-color orange) + ) + ((= v1-24 'ctyindb) + (font-color yellow) + ) + ((= v1-24 'ctypal) + (font-color green) + ) + ((= v1-24 'ctysluma) + (font-color blue) + ) + ((= v1-24 'ctyslumb) + (font-color cyan) + ) + ((= v1-24 'ctyslumc) + (font-color pink) + ) + (else + (font-color white) + ) + ) + (the-as vector2h #f) + ) ) ) (let ((s1-2 (new 'stack-no-clear 'vector))) @@ -681,10 +666,7 @@ (dotimes (s2-1 (-> s3-3 length)) (let* ((s0-1 (-> s3-3 s2-1)) (s1-1 (-> s0-1 aid)) - (v1-28 (if (type? s0-1 entity-nav-mesh) - s0-1 - ) - ) + (v1-28 (as-type s0-1 entity-nav-mesh)) ) (when v1-28 (let ((a0-24 (-> v1-28 nav-mesh)) @@ -755,7 +737,7 @@ ) ) ((and (-> this next-state) (= (-> this next-state name) 'move-plane)) - (vector-cross! s3-0 *up-vector* (the-as vector (-> (camera-matrix) vector))) + (vector-cross! s3-0 *up-vector* (-> (camera-matrix) vector 0)) (vector-normalize! s3-0 1.0) (set! (-> s2-0 quad) (-> this mouse-hit quad)) (reverse-transform-point! s5-1 s2-0 s3-0 s1-0) @@ -832,7 +814,7 @@ (dotimes (a0-64 4) (set! (-> v1-57 quad a0-64) (the-as uint128 0)) ) - (vector+! (the-as vector (-> v1-57 vector)) s5-1 (new 'static 'vector :x 8192.0 :z 8192.0 :w 1.0)) + (vector+! (-> v1-57 vector 0) s5-1 (new 'static 'vector :x 8192.0 :z 8192.0 :w 1.0)) (vector+! (-> v1-57 vector 1) s5-1 (new 'static 'vector :x 8192.0 :z -8192.0 :w 1.0)) (vector+! (-> v1-57 vector 2) s5-1 (new 'static 'vector :x -8192.0 :z -8192.0 :w 1.0)) (vector+! (-> v1-57 trans) s5-1 (new 'static 'vector :x -8192.0 :z 8192.0 :w 1.0)) @@ -1005,7 +987,6 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod nav-graph-editor-method-43 ((this nav-graph-editor)) - (local-vars (sv-128 vector) (sv-144 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1039,9 +1020,9 @@ ) (let ((f30-0 0.0) (s0-1 ray-cylinder-intersect) + (sv-128 (-> this mouse-pos)) + (sv-144 (new 'stack-no-clear 'vector)) ) - (set! sv-128 (-> this mouse-pos)) - (set! sv-144 (new 'stack-no-clear 'vector)) (let ((v1-18 (-> this mouse-hit-pick)) (a0-13 (-> this mouse-pos)) ) @@ -1051,18 +1032,21 @@ (.mov.vf.w vf6 vf0) (.sub.vf.xyz vf6 vf4 vf5) (.svf (&-> sv-144 quad) vf6) - (let ((a3-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) s2-0 1.0)) - (t0-0 1024.0) - (t1-0 (vector-length s2-0)) - (t2-0 s3-0) - ) - (when (< f30-0 (s0-1 sv-128 sv-144 s1-0 a3-3 t0-0 t1-0 t2-0)) - (let ((f0-1 (vector-vector-distance s3-0 (-> this mouse-pos)))) - (when (or (= (-> this selected-index) -1) (< f0-1 (-> this selected-dist))) - (set! (-> this selected-index) s4-0) - (set! (-> this selected-dist) f0-1) - (set! (-> this selected-node-edge?) #f) - ) + (when (< f30-0 (s0-1 + sv-128 + sv-144 + s1-0 + (vector-normalize-copy! (new 'stack-no-clear 'vector) s2-0 1.0) + 1024.0 + (vector-length s2-0) + s3-0 + ) + ) + (let ((f0-1 (vector-vector-distance s3-0 (-> this mouse-pos)))) + (when (or (= (-> this selected-index) -1) (< f0-1 (-> this selected-dist))) + (set! (-> this selected-index) s4-0) + (set! (-> this selected-dist) f0-1) + (set! (-> this selected-node-edge?) #f) ) ) ) @@ -2110,16 +2094,6 @@ ) (defun smooth-nav-graph ((arg0 string)) - (local-vars - (sv-96 int) - (sv-112 int) - (sv-128 int) - (sv-144 mysql-nav-edge) - (sv-160 vector) - (sv-176 vector) - (sv-192 vector) - (sv-208 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -2132,52 +2106,54 @@ (s2-0 (new-stack-vector0)) (s0-0 (new-stack-vector0)) (s1-0 (new-stack-vector0)) + (sv-96 0) + (sv-112 0) ) - (set! sv-96 0) - (set! sv-112 0) (when (and (not (logtest? (-> s3-0 mysql-save-flag) (mysql-save-flag delete))) (= (-> s3-0 level_name) arg0)) - (set! sv-128 0) - (while (< sv-128 (-> s5-0 edge-array length)) - (set! sv-144 (-> s5-0 edge-array data sv-128)) - (when (not (logtest? (-> sv-144 mysql-save-flag) (mysql-save-flag delete))) - (when (= (-> sv-144 runtime-node-id-1) s4-0) - (let ((v1-27 (-> s5-0 node-array data (-> sv-144 runtime-node-id-1))) - (a1-3 (-> s5-0 node-array data (-> sv-144 runtime-node-id-2))) - ) - (set! sv-176 s1-0) - (set! sv-160 s1-0) - (let ((v0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> a1-3 position) (-> v1-27 position)) 1.0)) + (let ((sv-128 0)) + (while (< sv-128 (-> s5-0 edge-array length)) + (let ((sv-144 (-> s5-0 edge-array data sv-128))) + (when (not (logtest? (-> sv-144 mysql-save-flag) (mysql-save-flag delete))) + (when (= (-> sv-144 runtime-node-id-1) s4-0) + (let ((v1-27 (-> s5-0 node-array data (-> sv-144 runtime-node-id-1))) + (a1-3 (-> s5-0 node-array data (-> sv-144 runtime-node-id-2))) + (sv-176 s1-0) + ) + (let ((sv-160 s1-0) + (v0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> a1-3 position) (-> v1-27 position)) 1.0)) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-160 quad)) + (.lvf vf5 (&-> v0-0 quad)) ) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-160 quad)) - (.lvf vf5 (&-> v0-0 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-176 quad) vf6) + ) + (+! sv-112 1) + sv-112 + ) + (when (= (-> sv-144 runtime-node-id-2) s4-0) + (let ((v1-40 (-> s5-0 node-array data (-> sv-144 runtime-node-id-1))) + (a1-9 (-> s5-0 node-array data (-> sv-144 runtime-node-id-2))) + (sv-208 s0-0) + ) + (let ((sv-192 s0-0) + (v0-1 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> a1-9 position) (-> v1-40 position)) 1.0)) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-192 quad)) + (.lvf vf5 (&-> v0-1 quad)) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-208 quad) vf6) + ) + (+! sv-96 1) + sv-96 ) ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-176 quad) vf6) - (set! sv-112 (+ sv-112 1)) - sv-112 - ) - (when (= (-> sv-144 runtime-node-id-2) s4-0) - (let ((v1-40 (-> s5-0 node-array data (-> sv-144 runtime-node-id-1))) - (a1-9 (-> s5-0 node-array data (-> sv-144 runtime-node-id-2))) - ) - (set! sv-208 s0-0) - (set! sv-192 s0-0) - (let ((v0-1 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> a1-9 position) (-> v1-40 position)) 1.0)) - ) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-192 quad)) - (.lvf vf5 (&-> v0-1 quad)) - ) - ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-208 quad) vf6) - (set! sv-96 (+ sv-96 1)) - sv-96 ) + (+! sv-128 1) ) - (set! sv-128 (+ sv-128 1)) ) (cond ((and (>= sv-112 2) (= sv-96 1)) @@ -2221,7 +2197,6 @@ ) (defun update-width ((arg0 string)) - (local-vars (sv-16 (array entity-nav-mesh)) (sv-32 int) (sv-48 uint) (sv-64 entity-nav-mesh)) (let ((s5-0 (-> (ppointer->process *nav-graph-editor*) nav-graph))) (dotimes (s4-0 (-> s5-0 edge-array length)) (let ((s3-0 (-> s5-0 edge-array data s4-0))) @@ -2239,32 +2214,31 @@ (dotimes (s0-0 (-> *level* length)) (let ((v1-25 (-> *level* level s0-0))) (when (= (-> v1-25 status) 'active) - (set! sv-16 (-> v1-25 bsp nav-meshes)) - (when (nonzero? sv-16) - (set! sv-32 0) - (while (< sv-32 (-> sv-16 length)) - (set! sv-64 (-> sv-16 sv-32)) - (set! sv-48 (-> sv-64 aid)) - (let ((v1-36 (if (type? sv-64 entity-nav-mesh) - sv-64 - ) - ) - ) - (when (and v1-36 (= sv-48 (-> s2-0 nav_mesh_id))) - (let* ((f0-0 (nav-mesh-method-35 (-> v1-36 nav-mesh) (-> s2-0 position) (-> s1-0 position) 16384.0)) - (f0-1 (+ -409.6 f0-0)) + (let ((sv-16 (-> v1-25 bsp nav-meshes))) + (when (nonzero? sv-16) + (let ((sv-32 0)) + (while (< sv-32 (-> sv-16 length)) + (let* ((sv-64 (-> sv-16 sv-32)) + (sv-48 (-> sv-64 aid)) + (v1-36 (as-type sv-64 entity-nav-mesh)) ) - (when (and (< 0.0 f0-1) (!= f0-1 (-> s3-0 width))) - (set! (-> s3-0 width) f0-1) - (logior! (-> s3-0 mysql-save-flag) (mysql-save-flag update)) - ) - (if (>= 0.0 f0-1) - (format #t "!!!! edge ~D ~D outside nav-mesh~%" (-> s2-0 nav_node_id) (-> s1-0 nav_node_id)) + (when (and v1-36 (= sv-48 (-> s2-0 nav_mesh_id))) + (let* ((f0-0 (nav-mesh-method-35 (-> v1-36 nav-mesh) (-> s2-0 position) (-> s1-0 position) 16384.0)) + (f0-1 (+ -409.6 f0-0)) + ) + (when (and (< 0.0 f0-1) (!= f0-1 (-> s3-0 width))) + (set! (-> s3-0 width) f0-1) + (logior! (-> s3-0 mysql-save-flag) (mysql-save-flag update)) + ) + (if (>= 0.0 f0-1) + (format #t "!!!! edge ~D ~D outside nav-mesh~%" (-> s2-0 nav_node_id) (-> s1-0 nav_node_id)) + ) ) + ) ) + (+! sv-32 1) ) ) - (set! sv-32 (+ sv-32 1)) ) ) ) diff --git a/goal_src/jak2/engine/debug/viewer.gc b/goal_src/jak2/engine/debug/viewer.gc index c304e160c4..87bf272644 100644 --- a/goal_src/jak2/engine/debug/viewer.gc +++ b/goal_src/jak2/engine/debug/viewer.gc @@ -204,11 +204,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this viewer) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (set! *viewer* this) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) @@ -233,31 +233,29 @@ This commonly includes things such as: ) (defun add-a-bunch ((arg0 string) (arg1 int) (arg2 int) (arg3 float) (arg4 process-tree) (arg5 entity-actor)) - (local-vars (sv-32 int) (sv-48 process) (sv-64 vector)) (dotimes (s0-0 arg1) - (set! sv-32 0) - (while (< sv-32 arg2) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! (-> sv-64 quad) (the-as uint128 0)) - (position-in-front-of-camera! sv-64 40960.0 4096.0) - (+! (-> sv-64 x) (the float (* (- s0-0 (/ arg1 2)) (the int arg3)))) - (+! (-> sv-64 z) (the float (* (- sv-32 (/ arg2 2)) (the int arg3)))) - (set! sv-48 (get-process *default-dead-pool* viewer #x4000)) - (when sv-48 - (let ((t9-2 (method-of-type viewer activate))) - (t9-2 (the-as viewer sv-48) arg4 (symbol->string (-> viewer symbol)) (the-as pointer #x70004000)) - ) - (let ((t9-3 run-function-in-process) - (a0-7 sv-48) - (a1-4 init-viewer-for-other) - (a2-6 arg0) - (t0-1 arg5) + (let ((sv-32 0)) + (while (< sv-32 arg2) + (let ((sv-64 (new 'stack-no-clear 'vector))) + (set! (-> sv-64 quad) (the-as uint128 0)) + (position-in-front-of-camera! sv-64 40960.0 4096.0) + (+! (-> sv-64 x) (the float (* (- s0-0 (/ arg1 2)) (the int arg3)))) + (+! (-> sv-64 z) (the float (* (- sv-32 (/ arg2 2)) (the int arg3)))) + (let ((sv-48 (get-process *default-dead-pool* viewer #x4000))) + (when sv-48 + ((method-of-type viewer activate) + (the-as viewer sv-48) + arg4 + (symbol->string (-> viewer symbol)) + (the-as pointer #x70004000) + ) + (run-now-in-process sv-48 init-viewer-for-other arg0 sv-64 arg5) + (-> sv-48 ppointer) ) - ((the-as (function object object object object object none) t9-3) a0-7 a1-4 a2-6 sv-64 t0-1) + ) ) - (-> sv-48 ppointer) + (+! sv-32 1) ) - (set! sv-32 (+ sv-32 1)) ) ) #f diff --git a/goal_src/jak2/engine/entity/actor-link-h.gc b/goal_src/jak2/engine/entity/actor-link-h.gc index 0eb153a904..131a14362f 100644 --- a/goal_src/jak2/engine/entity/actor-link-h.gc +++ b/goal_src/jak2/engine/entity/actor-link-h.gc @@ -13,9 +13,10 @@ ;; WARN: Return type mismatch entity vs entity-actor. (defun entity-actor-lookup ((arg0 res-lump) (arg1 symbol) (arg2 int)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data arg0 arg1 pointer :tag-ptr (& sv-16)))) + "Given an entity (the res-lump), look up a reference to another entity and return that entity." + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data arg0 arg1 pointer :tag-ptr (& sv-16))) + ) (the-as entity-actor (when (and v1-1 (< arg2 (the-as int (-> sv-16 elt-count)))) @@ -30,15 +31,22 @@ ;; WARN: Check prologue - tricky store of r0 (defun entity-actor-count ((arg0 res-lump) (arg1 symbol)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (if (res-lump-data arg0 arg1 pointer :tag-ptr (& sv-16)) - (the-as int (-> sv-16 elt-count)) - 0 - ) + "Get the number of entities that this res references under the name. + This works on more than just next/prev." + (let ((sv-16 (new 'static 'res-tag))) + (if (res-lump-data arg0 arg1 pointer :tag-ptr (& sv-16)) + (the-as int (-> sv-16 elt-count)) + 0 + ) + ) ) (deftype actor-link-info (basic) + "A linked list of actors. + +Actors allocate this on their process heap if they have a +`next-actor` or `prev-actor` defined in their lump +and use it for entity lookups." ((process process) (next entity-actor) (prev entity-actor) @@ -75,6 +83,9 @@ ) (defmethod new actor-link-info ((allocation symbol) (type-to-make type) (arg0 process) (arg1 symbol)) + "Set up an actor-link-info for the given process. + The entity of this process should be the entity-actor + that will get this actor-link-info." (let* ((a0-1 (-> arg0 entity)) (s4-0 (entity-actor-lookup a0-1 'next-actor 0)) (a0-2 (-> arg0 entity)) @@ -101,15 +112,18 @@ ;; WARN: Return type mismatch basic vs process. (defmethod get-next-process ((this actor-link-info)) + "Get the process for the next, if it exists." (the-as process (and (-> this next) (-> this next extra process))) ) ;; WARN: Return type mismatch basic vs process. (defmethod get-prev-process ((this actor-link-info)) + "Get the process for the prev, if it exists." (the-as process (and (-> this prev) (-> this prev extra process))) ) (defmethod link-to-next-and-prev-actor ((this actor-link-info)) + "Redo the linking in the constructor by looking up the next/prev actor." (let ((a0-1 (-> this process entity))) (set! (-> this next) (entity-actor-lookup a0-1 'next-actor 0)) ) @@ -120,6 +134,8 @@ ) (defmethod apply-function-forward ((this actor-link-info) (arg0 (function entity-actor object object)) (arg1 object)) + "Iterate forward through actors, and apply this function. Starts at (-> this next) + If the function returns truthy, stop iterating." (let ((s3-0 (-> this next))) (while s3-0 (if (arg0 s3-0 arg1) @@ -132,6 +148,8 @@ ) (defmethod apply-function-reverse ((this actor-link-info) (arg0 (function entity-actor object object)) (arg1 object)) + "Iterate backward through actors and apply function. + If the function returns truth, stop iterating." (let ((s3-0 (-> this prev))) (while s3-0 (if (arg0 s3-0 arg1) @@ -144,6 +162,7 @@ ) (defmethod apply-all ((this actor-link-info) (arg0 (function entity-actor object object)) (arg1 object)) + "Apply to all entities. Starts at the back and hits everyone, including this object." (let ((s4-0 (-> this process entity))) (while (let ((a0-2 s4-0)) (entity-actor-lookup a0-2 'prev-actor 0) @@ -163,6 +182,7 @@ ) (defmethod send-to-all-after ((this actor-link-info) (arg0 symbol)) + "Send an event to all processes after this link with no parameters." (with-pp (let ((s4-0 (-> this next)) (s5-0 (the-as object #f)) @@ -186,6 +206,7 @@ ) (defmethod send-to-all-before ((this actor-link-info) (arg0 symbol)) + "Send an event to all processes before this link with no parameters." (with-pp (let ((s4-0 (-> this prev)) (s5-0 (the-as object #f)) @@ -210,6 +231,7 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod send-to-next ((this actor-link-info) (arg0 symbol)) + "Send event arg0 to the next actor's process." (let ((a0-1 (-> this next))) (when a0-1 (let ((a0-2 (-> a0-1 extra process))) @@ -224,6 +246,7 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod send-to-prev ((this actor-link-info) (arg0 symbol)) + "Send event arg1 to the next actor's process." (let ((a0-1 (-> this prev))) (when a0-1 (let ((a0-2 (-> a0-1 extra process))) @@ -238,6 +261,7 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod send-to-next-and-prev ((this actor-link-info) (arg0 symbol)) + "Send an event to both next and prev with no params." (send-to-next this arg0) (send-to-prev this arg0) (none) @@ -251,6 +275,7 @@ ) (defmethod actor-count ((this actor-link-info)) + "Count the number of actors in the entire list." (let ((s5-0 (-> this process entity)) (gp-0 0) ) @@ -270,6 +295,8 @@ ) (defmethod get-matching-actor-type-mask ((this actor-link-info) (arg0 type)) + "Iterate through _all_ actors that are part of this actor list. + If the nth actor is type matching-type, then set the nth bit of the result." (let ((s3-0 (-> this process entity)) (s5-0 0) ) @@ -294,6 +321,7 @@ ) (defmethod actor-count-before ((this actor-link-info)) + "Get the number of actors before this actor in the list." (let* ((s5-0 (-> this process entity)) (s4-0 s5-0) (gp-0 0) @@ -314,6 +342,7 @@ ) (defun actor-link-subtask-complete-hook ((arg0 entity-actor) (arg1 (pointer symbol))) + "Sets arg1 if the thing is complete. Does not continue the apply if the complete perm is set." (cond ((logtest? (-> arg0 extra perm status) (entity-perm-status subtask-complete)) (set! (-> arg1 0) #t) @@ -339,6 +368,7 @@ ) (defun actor-link-dead-hook ((arg0 entity-actor) (arg1 (pointer symbol))) + "Sets arg1 if the thing is dead. Does not continue the apply if the dead perm is set." (cond ((logtest? (-> arg0 extra perm status) (entity-perm-status dead)) (set! (-> arg1 0) #t) @@ -352,6 +382,7 @@ ) (defun alt-actor-list-subtask-incomplete-count ((arg0 process-drawable)) + "Get the number of alt-actors which do not have the complete bit set in their perm." (let ((s4-0 (entity-actor-count (-> arg0 entity) 'alt-actor)) (gp-0 0) ) diff --git a/goal_src/jak2/engine/entity/res.gc b/goal_src/jak2/engine/entity/res.gc index 435bceb5da..e0b9a0f4a1 100644 --- a/goal_src/jak2/engine/entity/res.gc +++ b/goal_src/jak2/engine/entity/res.gc @@ -74,12 +74,12 @@ This is updated from the entity system used in Crash 2, which had most of these ) (defmethod get-tag-index-data ((this res-lump) (arg0 int)) - "get the data address of the n'th tag." + "Get the data address of the n'th tag." (&+ (-> this data-base) (-> this tag arg0 data-offset)) ) (defmethod get-tag-data ((this res-lump) (arg0 res-tag)) - "get the data address of the specified tag." + "Get the data address of the specified tag." (&+ (-> this data-base) (-> arg0 data-offset)) ) @@ -89,8 +89,8 @@ This is updated from the entity system used in Crash 2, which had most of these (set! (-> v0-0 allocated-length) arg0) (set! (-> v0-0 data-size) arg1) (set! (-> v0-0 length) 0) - (set! (-> v0-0 data-base) (&-> (-> v0-0 tag) arg0)) - (set! (-> v0-0 data-top) (&-> (-> v0-0 tag) arg0)) + (set! (-> v0-0 data-base) (&-> v0-0 tag arg0)) + (set! (-> v0-0 data-top) (&-> v0-0 tag arg0)) v0-0 ) ) @@ -100,6 +100,7 @@ This is updated from the entity system used in Crash 2, which had most of these (-> this length) ) +;; WARN: Return type mismatch uint vs int. (defmethod asize-of ((this res-lump)) "get the allocated size of a res-lump." (the-as int (+ (-> this type psize) (* (-> this allocated-length) 16) (-> this data-size))) @@ -130,18 +131,19 @@ This is updated from the entity system used in Crash 2, which had most of these this ) +;; WARN: Return type mismatch int vs res-tag-pair. (defmethod lookup-tag-idx ((this res-lump) (arg0 symbol) (arg1 symbol) (arg2 float)) "Look up the index of the tag containing with the given name and timestamp. Correct lookups return a res-tag-pair, which contains one tag index in the lower 32 bits and one in the upper 32 bits. Depending on the mode, they may be the same, or they may be two tags that you should interpolate between, if the exact time was not found. - - name-sym should be the name of the thing you want. - time is for the timestamp you want. + + @param name-sym should be the name of the thing you want. + @param time is for the timestamp you want. If mode = 'base, then both the indices are the same and the timestamp is ignored. - If mode = 'interp, then it tries to get closest below/closest above (or both the same, if exact match found) + If mode = 'interp, then it tries to get closest below/closest above (or both the same, if exact match found). If mode = 'exact, then it requires an exact timestamp match and both indices are the same. - If things go wrong, returns a negative number" + If things go wrong, returns a negative number." (local-vars (t4-1 int)) (when (or (= arg0 'id) (= arg0 'aid) @@ -201,7 +203,7 @@ This is updated from the entity system used in Crash 2, which had most of these (goto cfg-73) ) (let ((t3-13 t4-1) - (t4-4 (&-> (-> this tag) t4-1)) + (t4-4 (&-> this tag t4-1)) ) (while (not (or (>= t3-13 (-> this length)) (< t2-4 (-> (&+ (the-as (pointer uint64) (symbol->string (-> t4-4 0 name))) 4) 0)) @@ -239,8 +241,8 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) -(defmethod make-property-data ((this res-lump) (arg0 float) (arg1 res-tag-pair) (arg2 pointer)) - "Returns (a pointer to) the value data of a property with the tag-pair. +(defmethod make-property-data ((this res-lump) (arg1 float) (tag-pair res-tag-pair) (arg3 pointer)) + "Returns (a pointer to) the value data of a property with the tag-pair. If tag-pair does not represent an exact point in the timeline, then the data is interpolated based on time with the result written into buf. buf must have enough space to copy all of the data. Otherwise, simply returns an address to the resource binary." @@ -249,16 +251,16 @@ This is updated from the entity system used in Crash 2, which had most of these (vf3 :class vf) (vf4 :class vf) ) - (let* ((t0-2 (-> this tag (-> arg1 lo))) - (t1-2 (-> this tag (-> arg1 hi))) + (let* ((t0-2 (-> this tag (-> tag-pair lo))) + (t1-2 (-> this tag (-> tag-pair hi))) (v1-6 (-> t0-2 elt-count)) ) (cond ((zero? (-> t0-2 inlined?)) (&+ (-> this data-base) (-> t0-2 data-offset)) ) - ((or (not arg2) - (= (-> arg1 lo) (-> arg1 hi)) + ((or (not arg3) + (= (-> tag-pair lo) (-> tag-pair hi)) (!= v1-6 (-> t1-2 elt-count)) (!= (-> t0-2 elt-type) (-> t1-2 elt-type)) ) @@ -267,7 +269,7 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) (else - (let* ((f0-2 (/ (- arg0 (-> t0-2 key-frame)) (- (-> t1-2 key-frame) (-> t0-2 key-frame)))) + (let* ((f0-2 (/ (- arg1 (-> t0-2 key-frame)) (- (-> t1-2 key-frame) (-> t0-2 key-frame)))) (a1-4 this) (a2-7 t0-2) (a1-6 (&+ (-> a1-4 data-base) (-> a2-7 data-offset))) @@ -276,18 +278,18 @@ This is updated from the entity system used in Crash 2, which had most of these (case (-> t0-2 elt-type symbol) (('float) (dotimes (a0-8 (the-as int v1-6)) - (set! (-> (the-as (pointer float) (&+ arg2 (* a0-8 4)))) + (set! (-> (the-as (pointer float) (&+ arg3 (* a0-8 4)))) (+ (* (-> (the-as (pointer float) (&+ a1-6 (* a0-8 4)))) (- 1.0 f0-2)) (* (-> (the-as (pointer float) (&+ a2-13 (* a0-8 4)))) f0-2) ) ) ) - arg2 + arg3 ) (('integer 'sinteger 'uinteger 'int64 'uint64) (let ((a0-10 (the int (* 4096.0 f0-2)))) (dotimes (t0-10 (the-as int v1-6)) - (set! (-> (the-as (pointer int64) (&+ arg2 (* t0-10 8)))) + (set! (-> (the-as (pointer int64) (&+ arg3 (* t0-10 8)))) (sar (+ (* (the-as int (-> (the-as (pointer uint64) (&+ a1-6 (* t0-10 8))))) (- 4096 a0-10)) (* (the-as int (-> (the-as (pointer uint64) (&+ a2-13 (* t0-10 8))))) a0-10) @@ -297,12 +299,12 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) ) - arg2 + arg3 ) (('int8) (let ((a0-12 (the int (* 4096.0 f0-2)))) (dotimes (t0-11 (the-as int v1-6)) - (set! (-> (the-as (pointer int8) (&+ arg2 t0-11))) + (set! (-> (the-as (pointer int8) (&+ arg3 t0-11))) (sar (+ (* (-> (the-as (pointer int8) (&+ a1-6 t0-11))) (- 4096 a0-12)) (* (-> (the-as (pointer int8) (&+ a2-13 t0-11))) a0-12) @@ -312,12 +314,12 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) ) - arg2 + arg3 ) (('uint8) (let ((a0-14 (the int (* 4096.0 f0-2)))) (dotimes (t0-12 (the-as int v1-6)) - (set! (-> (the-as (pointer uint8) (&+ arg2 t0-12))) + (set! (-> (the-as (pointer uint8) (&+ arg3 t0-12))) (shr (+ (* (-> (the-as (pointer uint8) (&+ a1-6 t0-12))) (the-as uint (- 4096 a0-14))) (* (-> (the-as (pointer uint8) (&+ a2-13 t0-12))) (the-as uint a0-14)) @@ -327,12 +329,12 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) ) - arg2 + arg3 ) (('int16) (let ((a0-16 (the int (* 4096.0 f0-2)))) (dotimes (t0-13 (the-as int v1-6)) - (set! (-> (the-as (pointer int16) (&+ arg2 (* t0-13 2)))) + (set! (-> (the-as (pointer int16) (&+ arg3 (* t0-13 2)))) (sar (+ (* (-> (the-as (pointer int16) (&+ a1-6 (* t0-13 2)))) (- 4096 a0-16)) (* (-> (the-as (pointer int16) (&+ a2-13 (* t0-13 2)))) a0-16) @@ -342,12 +344,12 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) ) - arg2 + arg3 ) (('uint16) (let ((a0-18 (the int (* 4096.0 f0-2)))) (dotimes (t0-14 (the-as int v1-6)) - (set! (-> (the-as (pointer uint16) (&+ arg2 (* t0-14 2)))) + (set! (-> (the-as (pointer uint16) (&+ arg3 (* t0-14 2)))) (shr (+ (* (-> (the-as (pointer uint16) (&+ a1-6 (* t0-14 2)))) (the-as uint (- 4096 a0-18))) (* (-> (the-as (pointer uint16) (&+ a2-13 (* t0-14 2)))) (the-as uint a0-18)) @@ -357,12 +359,12 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) ) - arg2 + arg3 ) (('int32) (let ((a0-20 (the int (* 4096.0 f0-2)))) (dotimes (t0-15 (the-as int v1-6)) - (set! (-> (the-as (pointer int32) (&+ arg2 (* t0-15 4)))) + (set! (-> (the-as (pointer int32) (&+ arg3 (* t0-15 4)))) (sar (+ (* (-> (the-as (pointer int32) (&+ a1-6 (* t0-15 4)))) (- 4096 a0-20)) (* (-> (the-as (pointer int32) (&+ a2-13 (* t0-15 4)))) a0-20) @@ -372,12 +374,12 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) ) - arg2 + arg3 ) (('uint32) (let ((a0-22 (the int (* 4096.0 f0-2)))) (dotimes (t0-16 (the-as int v1-6)) - (set! (-> (the-as (pointer uint32) (&+ arg2 (* t0-16 4)))) + (set! (-> (the-as (pointer uint32) (&+ arg3 (* t0-16 4)))) (shr (+ (* (-> (the-as (pointer uint32) (&+ a1-6 (* t0-16 4)))) (the-as uint (- 4096 a0-22))) (* (-> (the-as (pointer uint32) (&+ a2-13 (* t0-16 4)))) (the-as uint a0-22)) @@ -387,7 +389,7 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) ) - arg2 + arg3 ) (('vector) (let ((a0-23 f0-2)) @@ -406,9 +408,9 @@ This is updated from the entity system used in Crash 2, which had most of these (.mul.x.vf vf1 vf1 vf4) (.mul.x.vf vf2 vf2 vf3) (.add.vf vf1 vf1 vf2) - (.svf (&-> (the-as (pointer uint128) (+ (* a0-26 16) (the-as int arg2))) 0) vf1) + (.svf (&-> (the-as (pointer uint128) (+ (* a0-26 16) (the-as int arg3))) 0) vf1) ) - arg2 + arg3 ) (else (let ((a0-27 t0-2)) @@ -424,19 +426,18 @@ This is updated from the entity system used in Crash 2, which had most of these ) (defmethod get-property-data ((this res-lump) - (arg0 symbol) - (arg1 symbol) - (arg2 float) - (arg3 pointer) - (arg4 (pointer res-tag)) - (arg5 pointer) - ) + (arg0 symbol) + (arg1 symbol) + (arg2 float) + (arg3 pointer) + (arg4 (pointer res-tag)) + (arg5 pointer) + ) "Returns an address to a given property's data at a specific time stamp, or default on error. - name is the name of the property you want, mode is its lookup mode ('interp 'base 'exact), time is the timestamp. - default is the default result returned in the case of an error. - tag-addr is an address to a res-tag. The current base tag is written to this. Ignored if tag-addr is #f - buf-addr is an address to the data buffer used to write interpolated data to. It must have enough space! Only necessary for 'interp mode." - + @param name is the name of the property you want, mode is its lookup mode ('interp 'base 'exact), time is the timestamp. + @param default is the default result returned in the case of an error. + @param tag-addr is an address to a res-tag. The current base tag is written to this. Ignored if tag-addr is #f + @param buf-addr is an address to the data buffer used to write interpolated data to. It must have enough space! Only necessary for 'interp mode." (let ((s3-0 (lookup-tag-idx this arg0 arg1 arg2))) (cond ((< (the-as int s3-0) 0) @@ -453,19 +454,21 @@ This is updated from the entity system used in Crash 2, which had most of these arg3 ) +;; WARN: Return type mismatch object vs structure. (defmethod get-property-struct ((this res-lump) - (arg0 symbol) - (arg1 symbol) - (arg2 float) - (arg3 structure) - (arg4 (pointer res-tag)) - (arg5 pointer) - ) + (arg0 symbol) + (arg1 symbol) + (arg2 float) + (arg3 structure) + (arg4 (pointer res-tag)) + (arg5 pointer) + ) "Returns a given struct property's value at a specific time stamp, or default on error. - name is the name of the property you want, mode is its lookup mode ('interp 'base 'exact), time is the timestamp. - default is the default result returned in the case of an error. - tag-addr is an address to a res-tag. The current base tag is written to this. Ignored if tag-addr is #f - buf-addr is an address to the data buffer used to write interpolated data to. It must have enough space! Only necessary for 'interp mode." + @param name is the name of the property you want, `mode` is its lookup mode ('interp 'base 'exact), `time` is the timestamp. + @param default is the default result returned in the case of an error. + @param tag-addr is an address to a [[res-tag]]. The current base tag is written to this. Ignored if tag-addr is #f. + @param buf-addr is an address to the data buffer used to write interpolated data to. + It must have enough space! Only necessary for 'interp mode." (let ((s3-0 (lookup-tag-idx this arg0 arg1 arg2))) (cond ((< (the-as int s3-0) 0) @@ -488,19 +491,21 @@ This is updated from the entity system used in Crash 2, which had most of these (the-as structure arg3) ) +;; WARN: Return type mismatch int vs uint128. (defmethod get-property-value ((this res-lump) - (arg0 symbol) - (arg1 symbol) - (arg2 float) - (arg3 uint128) - (arg4 (pointer res-tag)) - (arg5 pointer) - ) + (arg0 symbol) + (arg1 symbol) + (arg2 float) + (arg3 uint128) + (arg4 (pointer res-tag)) + (arg5 pointer) + ) "Returns a given value property's value at a specific time stamp, or default on error. - name is the name of the property you want, mode is its lookup mode ('interp 'base 'exact), time is the timestamp. - default is the default result returned in the case of an error. - tag-addr is an address to a res-tag. The current base tag is written to this. Ignored if tag-addr is #f - buf-addr is an address to the data buffer used to write interpolated data to. It must have enough space! Only necessary for 'interp mode." + @param name is the name of the property you want, `mode` is its lookup mode ('interp 'base 'exact), `time` is the timestamp. + @param default is the default result returned in the case of an error. + @param tag-addr is an address to a res-tag. The current base tag is written to this. Ignored if `tag-addr` is #f. + @param buf-addr is an address to the data buffer used to write interpolated data to. + It must have enough space! Only necessary for 'interp mode." (let ((a2-1 (lookup-tag-idx this arg0 arg1 arg2))) (cond ((< (the-as int a2-1) 0) @@ -568,8 +573,14 @@ This is updated from the entity system used in Crash 2, which had most of these (the-as uint128 arg3) ) -(defmethod get-property-value-float ((this res-lump) (arg0 symbol) (arg1 symbol) (arg2 float) (arg3 float) (arg4 (pointer res-tag)) (arg5 pointer)) - "same as get-property-value but float type is checked first?" +(defmethod get-property-value-float ((this res-lump) + (arg0 symbol) + (arg1 symbol) + (arg2 float) + (arg3 float) + (arg4 (pointer res-tag)) + (arg5 pointer) + ) (local-vars (v1-8 uint) (v1-11 int)) (let ((a2-1 (lookup-tag-idx this arg0 arg1 arg2))) (cond @@ -672,7 +683,7 @@ This is updated from the entity system used in Crash 2, which had most of these "Find space for the data described by arg0 in this. Returns a tag with data-offset set correctly for this res-lump. If the lump already contains memory for the given tag, and it is big enough, - it will be reused. Alignment will be at least 8 bytes. + it will be reused. Alignment will be at least 8 bytes. If the input tag has elt-count = 0, it will return a tag for elt-count = 1." (local-vars (resource-mem pointer)) (let* ((tag-pair (lookup-tag-idx this (-> arg0 name) 'exact (-> arg0 key-frame))) @@ -736,11 +747,11 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) -(defmethod add-data! ((this res-lump) (arg0 res-tag) (arg1 pointer)) +(defmethod add-data! ((this res-lump) (tag res-tag) (arg2 pointer)) "Given a tag and a pointer to its data, copy it to this res-lump. This doesn't seem to do the right thing if the given tag is a non-inline tag with > 1 element." - (let ((a0-2 (allocate-data-memory-for-tag! this arg0))) + (let ((a0-2 (allocate-data-memory-for-tag! this tag))) (when a0-2 (let* ((v1-2 this) (a1-1 a0-2) @@ -749,11 +760,11 @@ This is updated from the entity system used in Crash 2, which had most of these (cond ((zero? (-> a0-2 inlined?)) (length a0-2) - (set! (-> (the-as (pointer pointer) s4-0) 0) arg1) + (set! (-> (the-as (pointer pointer) s4-0) 0) arg2) ) (else (let ((a2-1 (length a0-2))) - (mem-copy! s4-0 arg1 a2-1) + (mem-copy! s4-0 arg2 a2-1) ) ) ) @@ -764,30 +775,31 @@ This is updated from the entity system used in Crash 2, which had most of these ) (defmethod add-32bit-data! ((this res-lump) (arg0 res-tag) (arg1 object)) - "Add a single 32-bit value using add-data." - (set! (-> arg0 inlined?) 1) - (add-data! this arg0 (& arg1)) ;; note, only 32-bits are spilled to the stack here. - ;; og:preserve-this - #| - (local-vars (sv-16 object)) - (set! sv-16 arg1) - (let* ((v1-0 arg0) - (a1-4 (copy-and-set-bf v1-0 :inlined? 1)) + "Add a single 32-bit value using [[add-data!]]." + (let* ((sv-16 arg1) + (v1-0 arg0) + (a1-4 (copy-and-set-field v1-0 inlined? 1)) ) - (add-data! this a1-4 (& sv-16)) - ) - |# + (add-data! this a1-4 (& sv-16)) + ) ) (defmethod get-curve-data! ((this res-lump) (arg0 curve) (arg1 symbol) (arg2 symbol) (arg3 float)) - "Read curve data and write it to curve-target. Return #t if both control points and knots data was succesfully read, #f otherwise." - (local-vars (sv-16 res-tag) (sv-32 res-tag)) + "Read curve data and write it to curve-target. Return #t if both + control points and knots data was succesfully read, #f otherwise." (let ((s5-0 #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((a0-2 - ((method-of-object this get-property-data) this arg1 'exact arg3 (the-as pointer #f) (& sv-16) *res-static-buf*) - ) - ) + (let* ((sv-16 (new 'static 'res-tag)) + (a0-2 ((method-of-object this get-property-data) + this + arg1 + 'exact + arg3 + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) (when a0-2 (set! (-> arg0 cverts) (the-as (inline-array vector) a0-2)) (set! (-> arg0 num-cverts) (the-as int (-> sv-16 elt-count))) @@ -800,11 +812,18 @@ This is updated from the entity system used in Crash 2, which had most of these ) (set! (-> arg0 num-cverts) 256) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((a0-6 - ((method-of-object this get-property-data) this arg2 'exact arg3 (the-as pointer #f) (& sv-32) *res-static-buf*) - ) - ) + (let* ((sv-32 (new 'static 'res-tag)) + (a0-6 ((method-of-object this get-property-data) + this + arg2 + 'exact + arg3 + (the-as pointer #f) + (& sv-32) + *res-static-buf* + ) + ) + ) (when a0-6 (set! (-> arg0 knots) (the-as (pointer float) a0-6)) (set! (-> arg0 num-knots) (the-as int (-> sv-32 elt-count))) @@ -817,32 +836,37 @@ This is updated from the entity system used in Crash 2, which had most of these ) ) -(defmethod mem-usage ((this res-lump) (arg0 memory-usage-block) (arg1 int)) - "Get the memory usage of this lump and its data" - (local-vars (sv-16 int)) +;; WARN: Return type mismatch int vs res-lump. +;; WARN: Using new Jak 2 rtype-of +;; WARN: Using new Jak 2 rtype-of +;; WARN: Using new Jak 2 rtype-of +;; WARN: Using new Jak 2 rtype-of +;; WARN: Using new Jak 2 rtype-of +;; WARN: Using new Jak 2 rtype-of +(defmethod mem-usage ((this res-lump) (usage memory-usage-block) (flags int)) (let ((s3-0 48) (s2-0 "res") ) (cond - ((logtest? arg1 256) + ((logtest? flags 256) (set! s3-0 44) (set! s2-0 "camera") ) - ((logtest? arg1 64) + ((logtest? flags 64) (set! s3-0 43) (set! s2-0 "entity") ) - ((logtest? arg1 512) + ((logtest? flags 512) (set! s3-0 76) (set! s2-0 "art-joint-geo") ) ) - (set! (-> arg0 length) (max (-> arg0 length) (+ s3-0 1))) - (set! (-> arg0 data s3-0 name) s2-0) - (+! (-> arg0 data s3-0 count) 1) + (set! (-> usage length) (max (-> usage length) (+ s3-0 1))) + (set! (-> usage data s3-0 name) s2-0) + (+! (-> usage data s3-0 count) 1) (let ((v1-19 (asize-of this))) - (+! (-> arg0 data s3-0 used) v1-19) - (+! (-> arg0 data s3-0 total) (logand -16 (+ v1-19 15))) + (+! (-> usage data s3-0 used) v1-19) + (+! (-> usage data s3-0 total) (logand -16 (+ v1-19 15))) ) (dotimes (s1-0 (-> this length)) (when (zero? (-> this tag s1-0 inlined?)) @@ -856,46 +880,47 @@ This is updated from the entity system used in Crash 2, which had most of these ((or (= v1-34 symbol) (or (= v1-34 type) (= v1-34 pair))) ) ((= v1-34 string) - (set! (-> arg0 length) (max (-> arg0 length) (+ s3-0 1))) - (set! (-> arg0 data s3-0 name) s2-0) - (+! (-> arg0 data s3-0 count) 1) + (set! (-> usage length) (max (-> usage length) (+ s3-0 1))) + (set! (-> usage data s3-0 name) s2-0) + (+! (-> usage data s3-0 count) 1) (let ((v1-48 ((method-of-type (rtype-of (the-as int s0-0)) asize-of) (the-as int s0-0)))) - (+! (-> arg0 data s3-0 used) v1-48) - (+! (-> arg0 data s3-0 total) (logand -16 (+ v1-48 15))) + (+! (-> usage data s3-0 used) v1-48) + (+! (-> usage data s3-0 total) (logand -16 (+ v1-48 15))) ) ) ((or (= v1-34 nav-mesh) (= v1-34 collide-mesh)) (let ((a0-48 (the-as (array object) s0-0))) - ((method-of-type (rtype-of a0-48) mem-usage) a0-48 arg0 arg1) + ((method-of-type (rtype-of a0-48) mem-usage) a0-48 usage flags) ) ) ((= v1-34 array) - (set! (-> arg0 length) (max (-> arg0 length) (+ s3-0 1))) - (set! (-> arg0 data s3-0 name) s2-0) - (+! (-> arg0 data s3-0 count) 1) + (set! (-> usage length) (max (-> usage length) (+ s3-0 1))) + (set! (-> usage data s3-0 name) s2-0) + (+! (-> usage data s3-0 count) 1) (let* ((a0-53 (the-as (array object) s0-0)) (v1-68 ((method-of-type (rtype-of a0-53) asize-of) a0-53)) ) - (+! (-> arg0 data s3-0 used) v1-68) - (+! (-> arg0 data s3-0 total) (logand -16 (+ v1-68 15))) + (+! (-> usage data s3-0 used) v1-68) + (+! (-> usage data s3-0 total) (logand -16 (+ v1-68 15))) ) - (set! sv-16 0) - (while (< sv-16 (-> (the-as array s0-0) length)) - (let ((a0-63 (-> (the-as (array object) s0-0) sv-16))) - ((method-of-type (rtype-of a0-63) mem-usage) a0-63 arg0 arg1) + (let ((sv-16 0)) + (while (< sv-16 (-> (the-as array s0-0) length)) + (let ((a0-63 (-> (the-as (array object) s0-0) sv-16))) + ((method-of-type (rtype-of a0-63) mem-usage) a0-63 usage flags) + ) + (+! sv-16 1) ) - (set! sv-16 (+ sv-16 1)) ) ) (else - (set! (-> arg0 length) (max (-> arg0 length) (+ s3-0 1))) - (set! (-> arg0 data s3-0 name) s2-0) - (+! (-> arg0 data s3-0 count) 1) + (set! (-> usage length) (max (-> usage length) (+ s3-0 1))) + (set! (-> usage data s3-0 name) s2-0) + (+! (-> usage data s3-0 count) 1) (let* ((a0-68 (the-as int s0-0)) (v1-96 ((method-of-type (rtype-of a0-68) asize-of) a0-68)) ) - (+! (-> arg0 data s3-0 used) v1-96) - (+! (-> arg0 data s3-0 total) (logand -16 (+ v1-96 15))) + (+! (-> usage data s3-0 used) v1-96) + (+! (-> usage data s3-0 total) (logand -16 (+ v1-96 15))) ) ) ) @@ -908,7 +933,6 @@ This is updated from the entity system used in Crash 2, which had most of these (the-as res-lump 0) ) -;; definition for symbol *res-static-buf*, type pointer (define *res-static-buf* (malloc 'global 128)) diff --git a/goal_src/jak2/engine/game/effect-control.gc b/goal_src/jak2/engine/game/effect-control.gc index d40b1d13d3..001e5359c0 100644 --- a/goal_src/jak2/engine/game/effect-control.gc +++ b/goal_src/jak2/engine/game/effect-control.gc @@ -95,12 +95,7 @@ ((25) (logior! (-> arg0 mask) (sound-mask reg0)) (set! (-> arg0 reg 0) (the-as uint (-> *footstep-surface* material))) - (let* ((s2-3 arg3) - (v1-33 (if (type? s2-3 process-focusable) - s2-3 - ) - ) - ) + (let ((v1-33 (as-type arg3 process-focusable))) (when v1-33 (cond ((focus-test? v1-33 in-air) @@ -110,12 +105,7 @@ (set! (-> arg0 reg 0) (the-as uint 127)) ) (else - (let* ((s2-4 (-> v1-33 root)) - (v1-34 (if (type? s2-4 collide-shape-moving) - s2-4 - ) - ) - ) + (let ((v1-34 (the-as collide-shape (as-type (-> v1-33 root) collide-shape-moving)))) (if v1-34 (set! (-> arg0 reg 0) (the-as uint (-> (the-as collide-shape-moving v1-34) ground-pat material))) ) @@ -163,13 +153,13 @@ (set! (-> this res) (-> s5-0 extra)) (let ((v1-6 (-> (lookup-tag-idx (-> s5-0 extra) 'effect-name 'base -1000000000.0) lo))) (set! (-> this name) (if (>= (the-as int v1-6) 0) - (&-> (-> s5-0 extra tag) v1-6) + (&-> s5-0 extra tag v1-6) (the-as (pointer res-tag) #f) ) ) ) (if (and (-> this name) (= (-> this name 0 key-frame) -1000000000.0)) - (set! (-> this name) (&-> (-> this name) 1)) + (set! (-> this name) (&-> this name 1)) ) (play-effects-from-res-lump this f30-0 f30-0 f30-0) ) @@ -280,21 +270,6 @@ ;; WARN: Function (method 10 effect-control) has a return type of none, but the expression builder found a return statement. (defmethod do-effect ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int)) - (local-vars - (sv-320 int) - (sv-336 symbol) - (sv-352 symbol) - (sv-368 symbol) - (sv-384 vector) - (sv-400 matrix) - (sv-416 int) - (sv-432 symbol) - (sv-448 symbol) - (sv-464 symbol) - (sv-480 vector) - (sv-496 matrix) - (sv-512 res-lump) - ) (cond ((logtest? (-> this flags) (effect-control-flag ecf2)) (return #f) @@ -358,11 +333,7 @@ (= (-> v1-23 data 5) 116) (= (-> v1-23 data 6) 45) ) - (let* ((s3-1 (-> this process root)) - (v1-27 (if (type? s3-1 collide-shape-moving) - s3-1 - ) - ) + (let* ((v1-27 (the-as trsqv (as-type (-> this process root) collide-shape-moving))) (t1-2 (if v1-27 (-> (the-as collide-shape-moving v1-27) ground-pat) *footstep-surface* @@ -421,16 +392,15 @@ (let ((s2-1 run-function-in-process) (s1-0 s4-1) (s0-0 part-tracker-init) + (sv-320 0) + (sv-336 (the-as symbol #f)) + (sv-352 (the-as symbol #f)) + (sv-368 (the-as symbol #f)) + (sv-400 *launch-matrix*) ) - (set! sv-320 0) - (set! sv-336 (the-as symbol #f)) - (set! sv-352 (the-as symbol #f)) - (set! sv-368 (the-as symbol #f)) - (set! sv-400 *launch-matrix*) - (set! sv-384 (-> sv-400 trans)) - (let ((v1-55 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)) quad))) - (set! (-> sv-384 quad) v1-55) - ) + (set! (-> sv-400 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)) quad) + ) ((the-as (function object object object object object object object object none) s2-1) s1-0 s0-0 @@ -527,16 +497,15 @@ (let ((s2-3 run-function-in-process) (s1-3 s4-3) (s0-3 part-tracker-init) + (sv-416 0) + (sv-432 (the-as symbol #f)) + (sv-448 (the-as symbol #f)) + (sv-464 (the-as symbol #f)) + (sv-496 *launch-matrix*) ) - (set! sv-416 0) - (set! sv-432 (the-as symbol #f)) - (set! sv-448 (the-as symbol #f)) - (set! sv-464 (the-as symbol #f)) - (set! sv-496 *launch-matrix*) - (set! sv-480 (-> sv-496 trans)) - (let ((v1-95 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)) quad))) - (set! (-> sv-480 quad) v1-95) - ) + (set! (-> sv-496 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)) quad) + ) ((the-as (function object object object object object object object object none) s2-3) s1-3 s0-3 @@ -592,17 +561,16 @@ (set! (-> v1-106 death-timer-org) (-> v1-106 death-timer)) (set! (-> v1-106 death-draw-overlap) (-> (the-as death-info s3-0) overlap)) ) - (when (-> (the-as death-info s3-0) sound) - (let* ((s2-5 this) - (s1-4 (method-of-object s2-5 play-effect-sound)) - (s0-4 (-> (the-as death-info s3-0) sound)) - ) - (set! sv-512 (-> this res)) - (let ((t1-12 (string->sound-name (symbol->string (-> (the-as death-info s3-0) sound))))) - (s1-4 s2-5 s0-4 arg1 s5-0 sv-512 t1-12) + (if (-> (the-as death-info s3-0) sound) + (play-effect-sound + this + (-> (the-as death-info s3-0) sound) + arg1 + s5-0 + (-> this res) + (string->sound-name (symbol->string (-> (the-as death-info s3-0) sound))) ) ) - ) (send-event (-> this process) 'death-start (the-as death-info s3-0)) ) ) @@ -617,26 +585,6 @@ ) (defmethod do-effect-for-surface ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 pat-surface)) - (local-vars - (sv-64 - (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) - ) - (sv-80 sparticle-system) - (sv-96 vector) - (sv-112 matrix) - (sv-128 - (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) - ) - (sv-144 sparticle-system) - (sv-160 vector) - (sv-176 matrix) - (sv-192 - (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) - ) - (sv-208 sparticle-system) - (sv-224 vector) - (sv-240 matrix) - ) (let ((s1-0 (the-as sound-name #f))) (-> *display* frames (-> *display* last-screen) run-time) (case arg0 @@ -914,18 +862,14 @@ ) ) (when (nonzero? s0-0) - (set! sv-64 sp-launch-particles-var) - (set! sv-80 *sp-particle-system-2d*) - (set! sv-112 *launch-matrix*) - (set! sv-96 (-> sv-112 trans)) - (let ((v1-63 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad))) - (set! (-> sv-96 quad) v1-63) - ) - (let ((a3-6 #f) - (t0-1 #f) - (t1-1 1.0) + (let ((sv-64 sp-launch-particles-var) + (sv-80 *sp-particle-system-2d*) + (sv-112 *launch-matrix*) ) - (sv-64 sv-80 s0-0 sv-112 (the-as sparticle-launch-state a3-6) (the-as sparticle-launch-control t0-1) t1-1) + (set! (-> sv-112 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad) + ) + (sv-64 sv-80 s0-0 sv-112 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) ) @@ -968,18 +912,14 @@ ) ) (when (nonzero? s0-1) - (set! sv-128 sp-launch-particles-var) - (set! sv-144 *sp-particle-system-2d*) - (set! sv-176 *launch-matrix*) - (set! sv-160 (-> sv-176 trans)) - (let ((v1-79 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad))) - (set! (-> sv-160 quad) v1-79) - ) - (let ((a3-7 #f) - (t0-2 #f) - (t1-2 1.0) + (let ((sv-128 sp-launch-particles-var) + (sv-144 *sp-particle-system-2d*) + (sv-176 *launch-matrix*) ) - (sv-128 sv-144 s0-1 sv-176 (the-as sparticle-launch-state a3-7) (the-as sparticle-launch-control t0-2) t1-2) + (set! (-> sv-176 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad) + ) + (sv-128 sv-144 s0-1 sv-176 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) ) @@ -1022,18 +962,14 @@ ) ) (when (nonzero? s0-2) - (set! sv-192 sp-launch-particles-var) - (set! sv-208 *sp-particle-system-2d*) - (set! sv-240 *launch-matrix*) - (set! sv-224 (-> sv-240 trans)) - (let ((v1-96 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad))) - (set! (-> sv-224 quad) v1-96) - ) - (let ((a3-8 #f) - (t0-3 #f) - (t1-3 1.0) + (let ((sv-192 sp-launch-particles-var) + (sv-208 *sp-particle-system-2d*) + (sv-240 *launch-matrix*) ) - (sv-192 sv-208 s0-2 sv-240 (the-as sparticle-launch-state a3-8) (the-as sparticle-launch-control t0-3) t1-3) + (set! (-> sv-240 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad) + ) + (sv-192 sv-208 s0-2 sv-240 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) ) @@ -1048,9 +984,8 @@ ) (defmethod play-effect-sound ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 sound-name)) - (local-vars (sv-112 res-tag) (sv-128 sound-name) (sv-144 basic) (sv-160 (function vector vector float))) - (set! sv-144 arg3) - (let ((s0-0 arg4) + (let ((sv-144 arg3) + (s0-0 arg4) (gp-0 (the-as object (new 'stack 'sound-spec))) (s5-0 (if (< arg2 0) (the-as vector #f) @@ -1062,15 +997,17 @@ (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask volume)) (set! (-> (the-as sound-spec gp-0) pitch-mod) 0) (set! (-> (the-as sound-spec gp-0) volume) 1024) - (set! sv-112 (new 'static 'res-tag)) - (let* ((t9-2 (method-of-type res-lump get-property-data)) - (a1-5 'effect-param) - (a2-1 'exact) - (a3-1 arg1) - (t0-1 #f) - (t1-1 (the-as (pointer res-tag) (& sv-112))) - (t2-0 *res-static-buf*) - (a1-6 (t9-2 (the-as res-lump sv-144) a1-5 a2-1 a3-1 (the-as pointer t0-1) t1-1 t2-0)) + (let* ((sv-112 (new 'static 'res-tag)) + (a1-6 ((method-of-type res-lump get-property-data) + (the-as res-lump sv-144) + 'effect-param + 'exact + arg1 + (the-as pointer #f) + (& sv-112) + *res-static-buf* + ) + ) ) (when a1-6 (effect-param->sound-spec @@ -1095,22 +1032,16 @@ ) ) (if (or (and (nonzero? (-> (the-as sound-spec gp-0) fo-max)) - (let ((f30-0 (* 4096.0 (the float (-> (the-as sound-spec gp-0) fo-max))))) - (set! sv-160 vector-vector-distance) - (let ((a0-8 (ear-trans 0)) - (a1-7 s5-0) - ) - (< f30-0 (sv-160 a0-8 a1-7)) - ) - ) + (< (* 4096.0 (the float (-> (the-as sound-spec gp-0) fo-max))) (vector-vector-distance (ear-trans 0) s5-0)) ) (= (-> (the-as (pointer int8) gp-0) 9) 126) ) (return 0) ) (when *debug-effect-control* - (set! sv-128 s0-0) - (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128))) + (let ((sv-128 s0-0)) + (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128))) + ) (format #t "(~5D) effect sound ~A ~A (~S) frame ~F joint ~D " diff --git a/goal_src/jak2/engine/game/fact-h.gc b/goal_src/jak2/engine/game/fact-h.gc index c899ea2fe9..f749f81495 100644 --- a/goal_src/jak2/engine/game/fact-h.gc +++ b/goal_src/jak2/engine/game/fact-h.gc @@ -357,51 +357,53 @@ ;; WARN: Return type mismatch object vs fact-info. (defmethod new fact-info ((allocation symbol) (type-to-make type) (arg0 process) (arg1 pickup-type) (arg2 float)) - (local-vars (sv-16 fact-info) (sv-20 res-lump) (sv-24 task-mask)) - (set! sv-16 (object-new allocation type-to-make (the-as int (-> type-to-make size)))) - (set! sv-20 (the-as res-lump (-> arg0 entity))) - (set! sv-24 (process-task-mask arg0)) - (when (zero? sv-16) - (go process-drawable-art-error "memory") - (return (the-as fact-info 0)) - ) - (set! (-> sv-16 process) arg0) - (set! (-> sv-16 pickup-type) arg1) - (set! (-> sv-16 pickup-amount) arg2) - (let ((s4-1 (-> (lookup-tag-idx sv-20 'eco-info 'base -1000000000.0) lo))) - (when (>= (the-as int s4-1) 0) - (let ((s3-0 (the-as int s4-1)) - (s2-0 (-> sv-20 tag s4-1)) - ) - 0 - (while (= (-> s2-0 name) (-> sv-20 tag s4-1 name)) - (let ((v1-17 (make-property-data sv-20 0.0 (the-as res-tag-pair s3-0) (the-as pointer #f))) - (a0-7 (the int (-> s2-0 key-frame))) - ) - (when (or (< a0-7 0) (and (-> arg0 entity) (logtest? sv-24 (ash 1 a0-7)))) - (when v1-17 - (let ((a0-15 (-> s2-0 elt-count))) - (set! (-> sv-16 pickup-type) (the-as pickup-type (-> (the-as (pointer int32) v1-17)))) - (set! (-> sv-16 pickup-amount) (if (< (the-as uint 1) a0-15) - (the float (-> (the-as (pointer int32) v1-17) 1)) - arg2 - ) - ) + (let ((sv-16 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (let ((sv-20 (the-as res-lump (-> arg0 entity)))) + (let ((sv-24 (process-task-mask arg0))) + (when (zero? sv-16) + (go process-drawable-art-error "memory") + (return (the-as fact-info 0)) + ) + (set! (-> sv-16 process) arg0) + (set! (-> sv-16 pickup-type) arg1) + (set! (-> sv-16 pickup-amount) arg2) + (let ((s4-1 (-> (lookup-tag-idx sv-20 'eco-info 'base -1000000000.0) lo))) + (when (>= (the-as int s4-1) 0) + (let ((s3-0 (the-as int s4-1)) + (s2-0 (-> sv-20 tag s4-1)) ) + 0 + (while (= (-> s2-0 name) (-> sv-20 tag s4-1 name)) + (let ((v1-17 (make-property-data sv-20 0.0 (the-as res-tag-pair s3-0) (the-as pointer #f))) + (a0-7 (the int (-> s2-0 key-frame))) + ) + (when (or (< a0-7 0) (and (-> arg0 entity) (logtest? sv-24 (ash 1 a0-7)))) + (when v1-17 + (let ((a0-15 (-> s2-0 elt-count))) + (set! (-> sv-16 pickup-type) (the-as pickup-type (-> (the-as (pointer int32) v1-17)))) + (set! (-> sv-16 pickup-amount) (if (< (the-as uint 1) a0-15) + (the float (-> (the-as (pointer int32) v1-17) 1)) + arg2 + ) + ) + ) + ) + ) + ) + (+! s3-0 1) + (set! s2-0 (-> sv-20 tag s3-0)) ) ) ) - (+! s3-0 1) - (set! s2-0 (-> sv-20 tag s3-0)) ) ) + (set! (-> sv-16 options) (res-lump-value sv-20 'options actor-option :time -1000000000.0)) + (if (logtest? (-> sv-16 options) (actor-option fade-out respawn-delay)) + (set! (-> sv-16 fade-time) (the-as time-frame (the int (* 300.0 (res-lump-float sv-20 'timeout))))) + ) ) + (the-as fact-info sv-16) ) - (set! (-> sv-16 options) (res-lump-value sv-20 'options actor-option :time -1000000000.0)) - (if (logtest? (-> sv-16 options) (actor-option fade-out respawn-delay)) - (set! (-> sv-16 fade-time) (the-as time-frame (the int (* 300.0 (res-lump-float sv-20 'timeout))))) - ) - (the-as fact-info sv-16) ) (defmethod pickup-collectable! ((this fact-info) (arg0 pickup-type) (arg1 float) (arg2 handle)) @@ -423,7 +425,6 @@ (arg2 pickup-type) (arg3 float) ) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((gp-0 (the-as fact-info-enemy ((method-of-type fact-info new) allocation type-to-make arg0 arg2 arg3)))) (let ((s5-0 (the-as res-lump (-> gp-0 process entity)))) (set! (-> gp-0 speed) (res-lump-float s5-0 'speed :default 1.0)) @@ -435,8 +436,9 @@ (set! (-> gp-0 cam-notice-dist) (res-lump-float s5-0 'cam-notice-dist :default -4096.0)) (set! (-> gp-0 enemy-options) (res-lump-value s5-0 'enemy-options enemy-option :time -1000000000.0)) (let ((s4-1 0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-11 (res-lump-data s5-0 'trigger pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-11 (res-lump-data s5-0 'trigger pointer :tag-ptr (& sv-16))) + ) (when v1-11 (logior! (-> gp-0 enemy-options) (enemy-option has-trigger)) (let ((a0-13 0)) @@ -459,8 +461,9 @@ ) ) (when (logtest? s4-1 2) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-20 (res-lump-data s5-0 'trig-ag pointer :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-20 (res-lump-data s5-0 'trig-ag pointer :tag-ptr (& sv-32))) + ) (if (and v1-20 (nonzero? (-> sv-32 elt-count))) (set! (-> gp-0 trig-actor-group) (the-as (pointer actor-group) v1-20)) (clear-mask-bits gp-0 2) diff --git a/goal_src/jak2/engine/game/game-info.gc b/goal_src/jak2/engine/game/game-info.gc index 2dbae61776..5478c50e12 100644 --- a/goal_src/jak2/engine/game/game-info.gc +++ b/goal_src/jak2/engine/game/game-info.gc @@ -47,8 +47,8 @@ (>= (vector-dot (vector-! (new 'stack-no-clear 'vector) arg0 (-> this trans)) (-> this normal)) 0.0) ) -(defmethod task-complete? ((this game-info) (arg0 game-task)) - (logtest? (-> this task-perm-list data arg0 status) (entity-perm-status complete)) +(defmethod task-complete? ((this game-info) (task game-task)) + (logtest? (-> this task-perm-list data task status) (entity-perm-status complete)) ) (defmethod subtask-index-by-name ((this game-info) (arg0 string)) @@ -100,8 +100,8 @@ (defmethod continue-point-method-10 ((this continue-point) (arg0 load-state)) (let ((v1-0 (lookup-level-info (-> this vis-nick)))) (set! (-> this vis-nick) (if v1-0 - (-> v1-0 name) - ) + (-> v1-0 name) + ) ) ) (dotimes (s4-0 6) @@ -294,7 +294,7 @@ ) (defmethod initialize! ((this game-info) (arg0 symbol) (arg1 game-save) (arg2 string)) - (local-vars (v0-3 int) (sv-96 game-task-node-info) (sv-112 symbol)) + (local-vars (v0-3 int)) (case arg0 (('dead 'life) (+! (-> this total-deaths) 1) @@ -328,20 +328,21 @@ (let ((s1-0 (-> *game-info* sub-task-list))) (dotimes (s0-0 (-> s1-0 length)) (when (nonzero? s0-0) - (set! sv-96 (-> s1-0 s0-0)) - (if (open? sv-96) - (set! v0-3 (when (and (= (-> s2-0 info taskname) (-> sv-96 level)) - (and (or (not (-> sv-96 info)) (handle->process (-> sv-96 info manager))) - (>= (- (-> *display* game-clock frame-counter) (-> this death-time)) (seconds 2)) - ) - ) - (format #t "death count inc for ~S~%" (-> sv-96 name)) - (set! v0-3 (seekl (the-as int (-> sv-96 death-count)) #xffff 1)) - (set! (-> sv-96 death-count) (the-as uint v0-3)) - v0-3 - ) - ) - ) + (let ((sv-96 (-> s1-0 s0-0))) + (if (open? sv-96) + (set! v0-3 (when (and (= (-> s2-0 info taskname) (-> sv-96 level)) + (and (or (not (-> sv-96 info)) (handle->process (-> sv-96 info manager))) + (>= (- (-> *display* game-clock frame-counter) (-> this death-time)) (seconds 2)) + ) + ) + (format #t "death count inc for ~S~%" (-> sv-96 name)) + (set! v0-3 (seekl (the-as int (-> sv-96 death-count)) #xffff 1)) + (set! (-> sv-96 death-count) (the-as uint v0-3)) + v0-3 + ) + ) + ) + ) ) ) ) @@ -520,43 +521,33 @@ (set! *spawn-actors* #f) (set-blackout-frames (seconds 0.1)) (send-event *target* 'reset) - (let* ((s3-2 (get-process *4k-dead-pool* process #x4000)) - (v1-157 (when s3-2 - (let ((t9-29 (method-of-type process activate))) - (t9-29 s3-2 *default-pool* (symbol->string (-> process symbol)) (the-as pointer #x70004000)) - ) - set-to-run - (let ((s1-2 (-> s3-2 main-thread)) - (s0-1 (lambda :behavior process - ((arg0 symbol) (arg1 symbol) (arg2 continue-point) (arg3 game-save)) - (set! (-> self mask) (process-mask)) - (stop arg0) - (reset-actors arg1) - (close! (-> *game-info* sub-task-list (game-task-node fortress-escape-start)) 'event) - (set-continue! *game-info* arg2 #f) - (when arg3 - (load-game *game-info* arg3) - (set! arg2 (get-current-continue-forced *game-info*)) - (reset-actors 'life) - (send-event (handle->process (-> *game-info* auto-save-proc)) 'done) - ) - (suspend) - (start arg0 arg2) - (none) - ) - ) - ) - (set! sv-112 (-> this mode)) - (let ((t0-3 (get-current-continue-forced this)) - (t1-3 arg1) - ) - (run-next-time-in-process s3-2 s0-1 sv-112 arg0 t0-3 t1-3) - ) - ) - (-> s3-2 ppointer) - ) - ) - ) + (let ((v1-157 (process-spawn-function + process + (lambda :behavior process + ((arg0 symbol) (arg1 symbol) (arg2 continue-point) (arg3 game-save)) + (set! (-> self mask) (process-mask)) + (stop arg0) + (reset-actors arg1) + (close! (-> *game-info* sub-task-list (game-task-node fortress-escape-start)) 'event) + (set-continue! *game-info* arg2 #f) + (when arg3 + (load-game *game-info* arg3) + (set! arg2 (get-current-continue-forced *game-info*)) + (reset-actors 'life) + (send-event (handle->process (-> *game-info* auto-save-proc)) 'done) + ) + (suspend) + (start arg0 arg2) + (none) + ) + (-> this mode) + arg0 + (get-current-continue-forced this) + arg1 + :from *4k-dead-pool* + ) + ) + ) (when v1-157 (set! (-> v1-157 0 mask) (process-mask)) 0 @@ -909,25 +900,19 @@ (set! (-> v1-9 origin z) (the float (/ (-> s3-0 z) 16))) ) (set! (-> s5-0 flags) (font-flags shadow kerning large)) - (let ((s3-1 (current-time))) - (until (>= (- (current-time) s3-1) (+ arg2 -75)) - (+! (-> s5-0 origin y) (* -120.0 (seconds-per-frame))) - (let ((s2-0 print-game-text)) - (format (clear *temp-string*) "~4,,0f" arg1) - (s2-0 *temp-string* s5-0 #f 44 (bucket-id debug-no-zbuf1)) - ) - (suspend) + (suspend-for (+ arg2 -75) + (+! (-> s5-0 origin y) (* -120.0 (seconds-per-frame))) + (let ((s2-0 print-game-text)) + (format (clear *temp-string*) "~4,,0f" arg1) + (s2-0 *temp-string* s5-0 #f 44 (bucket-id debug-no-zbuf1)) ) ) - (let ((s4-1 (current-time))) - (until (>= (- (current-time) s4-1) (seconds 0.25)) - (set! (-> s5-0 alpha) (lerp-scale 1.0 0.0 (the float (- (current-time) s4-1)) 0.0 150.0)) - (+! (-> s5-0 origin y) (* -120.0 (seconds-per-frame))) - (let ((s3-2 print-game-text)) - (format (clear *temp-string*) "~4,,0f" arg1) - (s3-2 *temp-string* s5-0 #f 44 (bucket-id debug-no-zbuf1)) - ) - (suspend) + (suspend-for (seconds 0.25) + (set! (-> s5-0 alpha) (lerp-scale 1.0 0.0 (the float (- (current-time) time)) 0.0 150.0)) + (+! (-> s5-0 origin y) (* -120.0 (seconds-per-frame))) + (let ((s3-2 print-game-text)) + (format (clear *temp-string*) "~4,,0f" arg1) + (s3-2 *temp-string* s5-0 #f 44 (bucket-id debug-no-zbuf1)) ) ) ) @@ -1347,11 +1332,8 @@ process (lambda :behavior process ((arg0 string)) - (let ((s5-0 (current-time))) - (until (>= (- (current-time) s5-0) (seconds 10)) - (format *stdcon* "~S~%" arg0) - (suspend) - ) + (suspend-for (seconds 10) + (format *stdcon* "~S~%" arg0) ) (none) ) @@ -1378,14 +1360,14 @@ (defun-debug print-continues () (let ((levels *level-load-list*)) (while (not (null? levels)) - (let ((conts (-> (the-as level-load-info (-> (the-as symbol (car levels)) value)) continues))) - (while (not (null? conts)) - (let ((cont (the-as continue-point (car conts)))) - (if (not (logtest? (-> cont flags) (continue-flags change-continue))) - (format #t "~S~%" (-> cont name)) + (let ((continues (-> (the-as level-load-info (-> (the-as symbol (car levels)) value)) continues))) + (while (not (null? continues)) + (let ((continue (the-as continue-point (car continues)))) + (if (not (logtest? (-> continue flags) (continue-flags change-continue))) + (format #t "~S~%" (-> continue name)) ) ) - (set! conts (cdr conts)) + (set! continues (cdr continues)) ) ) (set! levels (cdr levels)) @@ -1400,18 +1382,7 @@ ) (defmethod debug-inspect ((this game-info) (arg0 symbol)) - (local-vars - (sv-16 int) - (sv-24 int) - (sv-32 int) - (sv-40 int) - (sv-48 int) - (sv-56 int) - (sv-64 string) - (sv-80 string) - (sv-96 string) - (sv-112 string) - ) + (local-vars (sv-96 string) (sv-112 string)) (inspect this) (when (or (not arg0) (= arg0 'game-task)) (format #t "~Tgame-task:~%") @@ -1422,48 +1393,50 @@ ) (while (>= (the-as uint s3-0) (the-as uint s4-0)) (when (task-complete? this (the-as game-task s4-0)) - (set! sv-16 0) - (set! sv-24 0) - (set! sv-32 0) - (set! sv-40 0) - (set! sv-48 0) - (set! sv-56 0) - (let ((game-subtasks (-> *game-info* sub-task-list))) - (dotimes (i (-> game-subtasks length)) - (when (nonzero? i) - (let ((subtasks (-> game-subtasks i))) - (when (= (-> subtasks task) s4-0) - (when (zero? sv-24) - (set! sv-24 (the-as int (-> subtasks close-time))) - (set! sv-16 (the-as int (-> subtasks close-time))) - ) - (when (logtest? (-> subtasks flags) (game-task-node-flag closed)) - (set! sv-32 (the-as int (-> subtasks close-time))) - (set! sv-40 (the-as int (-> subtasks gem-count))) - (set! sv-48 (the-as int (-> subtasks skill-count))) - ) - (set! sv-56 (+ sv-56 (-> subtasks death-count))) - (if (logtest? (-> subtasks flags) (game-task-node-flag close-task)) - (goto cfg-19) + (let ((sv-16 0) + (sv-24 0) + (sv-32 0) + (sv-40 0) + (sv-48 0) + (sv-56 0) + ) + (let ((game-subtasks (-> *game-info* sub-task-list))) + (dotimes (i (-> game-subtasks length)) + (when (nonzero? i) + (let ((subtasks (-> game-subtasks i))) + (when (= (-> subtasks task) s4-0) + (when (zero? sv-24) + (set! sv-24 (the-as int (-> subtasks close-time))) + (set! sv-16 (the-as int (-> subtasks close-time))) ) + (when (logtest? (-> subtasks flags) (game-task-node-flag closed)) + (set! sv-32 (the-as int (-> subtasks close-time))) + (set! sv-40 (the-as int (-> subtasks gem-count))) + (set! sv-48 (the-as int (-> subtasks skill-count))) + ) + (+! sv-56 (-> subtasks death-count)) + (if (logtest? (-> subtasks flags) (game-task-node-flag close-task)) + (goto cfg-19) + ) + ) ) ) ) ) - ) - (label cfg-19) - (if (nonzero? (-> this task-close-times s4-0)) - (set! sv-24 (max sv-24 (-> this task-close-times s4-0))) + (label cfg-19) + (if (nonzero? (-> this task-close-times s4-0)) + (set! sv-24 (max sv-24 (-> this task-close-times s4-0))) + ) + (format + #t + "~T~T~-32S ~6,,1f min ~6,,1f min ~3d ~3d ~3d~%" + (game-task->string (the-as game-task s4-0)) + (* 0.000055555556 (the float (- sv-24 sv-16))) + (* 0.000055555556 (the float (- sv-32 sv-24))) + sv-56 + sv-40 + sv-48 ) - (format - #t - "~T~T~-32S ~6,,1f min ~6,,1f min ~3d ~3d ~3d~%" - (game-task->string (the-as game-task s4-0)) - (* 0.000055555556 (the float (- sv-24 sv-16))) - (* 0.000055555556 (the float (- sv-32 sv-24))) - sv-56 - sv-40 - sv-48 ) ) (+! s4-0 1) @@ -1474,30 +1447,37 @@ (let ((s4-1 (-> *game-info* sub-task-list))) (dotimes (s3-1 (-> s4-1 length)) (when (nonzero? s3-1) - (let ((s2-1 (-> s4-1 s3-1)) - (s1-1 format) - (s0-1 #t) - ) - (set! sv-64 "~-55S ~-16S ~S ~A~%") - (set! sv-80 (-> s2-1 name)) - (cond - ((logtest? (-> s2-1 flags) (game-task-node-flag closed)) - (set! sv-96 "closed") - ) - ((open? s2-1) - (set! sv-96 "open") - ) - (else - (set! sv-96 "inactive") - ) - ) - (if (task-complete? *game-info* (-> s2-1 task)) - (set! sv-112 "res") - (set! sv-112 " ") - ) - (let ((t1-1 (lookup-text! *common-text* (-> s2-1 description) #f))) - (s1-1 s0-1 sv-64 sv-80 sv-96 sv-112 t1-1) - ) + (let* ((s2-1 (-> s4-1 s3-1)) + (s1-1 format) + (s0-1 #t) + (sv-64 "~-55S ~-16S ~S ~A~%") + (sv-80 (-> s2-1 name)) + ) + (set! sv-96 (cond + ((logtest? (-> s2-1 flags) (game-task-node-flag closed)) + (set! sv-96 "closed") + sv-96 + ) + ((open? s2-1) + (set! sv-96 "open") + sv-96 + ) + (else + "inactive" + ) + ) + ) + (set! sv-112 (cond + ((task-complete? *game-info* (-> s2-1 task)) + (set! sv-112 "res") + sv-112 + ) + (else + " " + ) + ) + ) + (s1-1 s0-1 sv-64 sv-80 sv-96 sv-112 (lookup-text! *common-text* (-> s2-1 description) #f)) ) ) ) diff --git a/goal_src/jak2/engine/game/game-save.gc b/goal_src/jak2/engine/game/game-save.gc index 756fc623a0..40d490fc4c 100644 --- a/goal_src/jak2/engine/game/game-save.gc +++ b/goal_src/jak2/engine/game/game-save.gc @@ -160,7 +160,6 @@ ) (defmethod debug-inspect ((this game-save) (arg0 symbol)) - (local-vars (sv-16 int) (sv-32 string) (sv-48 string)) (format #t "[~8x] ~A~%" this (-> this type)) (format #t "~Tversion: ~D~%" (-> this version)) (format #t "~Tallocated-length: ~D~%" (-> this allocated-length)) @@ -186,19 +185,15 @@ (s3-0 0) ) (while (< (the-as int s4-0) (the-as int (&-> this tag 0 user-int8 (-> this length)))) - (let ((s2-0 format) - (s1-0 #t) - (s0-0 "~T [~3D] ~-32S [~3D/~3D] ~12D ~8f ") - ) - (set! sv-16 s3-0) - (let ((a3-2 (game-save-elt->string (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-type))) - (t0-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) - (t1-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-size)) - (t2-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)) - (t3-0 (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) - ) - (s2-0 s1-0 s0-0 sv-16 a3-2 t0-1 t1-1 t2-1 t3-0) - ) + (format + #t + "~T [~3D] ~-32S [~3D/~3D] ~12D ~8f " + s3-0 + (game-save-elt->string (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-type)) + (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count) + (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-size) + (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64) + (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0) ) (let ((v1-0 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-type))) (if (or (= v1-0 (game-save-elt name)) (= v1-0 (game-save-elt continue))) @@ -210,31 +205,21 @@ (case (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-type) (((game-save-elt node-death-count) (game-save-elt node-skill-count) (game-save-elt node-gem-count)) (dotimes (s2-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) - (let ((s1-1 format) - (s0-1 #t) - ) - (set! sv-32 " ~-32S: ~D~%") - (let ((a2-15 (game-task-node->string (the-as game-task-node s2-1))) - (a3-3 (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 s2-1)) - ) - (s1-1 s0-1 sv-32 a2-15 a3-3) - ) + (format + #t + " ~-32S: ~D~%" + (game-task-node->string (the-as game-task-node s2-1)) + (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 s2-1) ) ) ) (((game-save-elt node-close-time)) (dotimes (s2-2 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) - (let ((s1-2 format) - (s0-2 #t) - ) - (set! sv-48 " ~-32S: ~D~%") - (let ((a2-16 (game-task-node->string (the-as game-task-node s2-2))) - (a3-4 - (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s2-2 8)))) - ) - ) - (s1-2 s0-2 sv-48 a2-16 a3-4) - ) + (format + #t + " ~-32S: ~D~%" + (game-task-node->string (the-as game-task-node s2-2)) + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s2-2 8)))) ) ) ) @@ -391,7 +376,7 @@ (set! (-> s1-0 elt-count) (+ (length arg1) 1)) (set! (-> s1-0 elt-size) (the-as uint 1)) ) - (copy-charp<-charp (the-as (pointer uint8) (-> (the-as (inline-array game-save-tag) s2-2) 1)) (-> arg1 data)) + (copy-charp<-charp (-> (the-as (inline-array game-save-tag) s2-2) 1 user-uint8) (-> arg1 data)) (let ((v1-59 (the-as (inline-array game-save-tag) @@ -410,7 +395,7 @@ (set! (-> a0-31 elt-size) (the-as uint 8)) ) (let ((s3-1 (-> v1-59 1))) - (save! (-> *display* base-clock) (the-as (pointer uint64) s3-1)) + (save! (-> *display* base-clock) (&-> s3-1 user-uint64)) (let ((v1-63 (the-as object (&+ s3-1 16)))) (let ((a0-33 (-> (the-as (inline-array game-save-tag) v1-63) 0))) (set! (-> a0-33 elt-type) (game-save-elt game-time)) @@ -418,7 +403,7 @@ (set! (-> a0-33 elt-size) (the-as uint 8)) ) (let ((s3-2 (&+ (the-as game-save-tag v1-63) 16))) - (save! (-> *display* game-clock) (the-as (pointer uint64) s3-2)) + (save! (-> *display* game-clock) (&-> s3-2 user-uint64)) (let ((v1-67 (the-as object (&+ s3-2 16)))) (let ((a0-35 (-> (the-as (inline-array game-save-tag) v1-67) 0))) (set! (-> a0-35 elt-type) (game-save-elt total-game-time)) @@ -426,7 +411,7 @@ (set! (-> a0-35 elt-size) (the-as uint 8)) ) (let ((s3-3 (&+ (the-as game-save-tag v1-67) 16))) - (save! (-> *display* total-game-clock) (the-as (pointer uint64) s3-3)) + (save! (-> *display* total-game-clock) (&-> s3-3 user-uint64)) (let ((v1-71 (the-as object (&+ s3-3 16)))) (let ((a0-37 (-> (the-as (inline-array game-save-tag) v1-71) 0))) (set! (-> a0-37 elt-type) (game-save-elt real-time)) @@ -434,7 +419,7 @@ (set! (-> a0-37 elt-size) (the-as uint 8)) ) (let ((s3-4 (&+ (the-as game-save-tag v1-71) 16))) - (save! (-> *display* real-clock) (the-as (pointer uint64) s3-4)) + (save! (-> *display* real-clock) (&-> s3-4 user-uint64)) (let ((v1-75 (the-as object (&+ s3-4 16)))) (let ((a0-39 (-> (the-as (inline-array game-save-tag) v1-75) 0))) (set! (-> a0-39 elt-type) (game-save-elt frame-time)) @@ -442,7 +427,7 @@ (set! (-> a0-39 elt-size) (the-as uint 8)) ) (let ((s3-5 (&+ (the-as game-save-tag v1-75) 16))) - (save! (-> *display* frame-clock) (the-as (pointer uint64) s3-5)) + (save! (-> *display* frame-clock) (&-> s3-5 user-uint64)) (let ((v1-79 (the-as object (&+ s3-5 16)))) (let ((a0-41 (-> (the-as (inline-array game-save-tag) v1-79) 0))) (set! (-> a0-41 elt-type) (game-save-elt real-frame-time)) @@ -450,7 +435,7 @@ (set! (-> a0-41 elt-size) (the-as uint 8)) ) (let ((s3-6 (&+ (the-as game-save-tag v1-79) 16))) - (save! (-> *display* real-frame-clock) (the-as (pointer uint64) s3-6)) + (save! (-> *display* real-frame-clock) (&-> s3-6 user-uint64)) (let ((v1-83 (the-as object (&+ s3-6 16)))) (let ((a0-43 (-> (the-as (inline-array game-save-tag) v1-83) 0))) (set! (-> a0-43 elt-type) (game-save-elt session-time)) @@ -458,7 +443,7 @@ (set! (-> a0-43 elt-size) (the-as uint 8)) ) (let ((s3-7 (&+ (the-as game-save-tag v1-83) 16))) - (save! (-> *display* session-clock) (the-as (pointer uint64) s3-7)) + (save! (-> *display* session-clock) (&-> s3-7 user-uint64)) (let ((v1-87 (the-as object (&+ s3-7 16)))) (let ((a0-45 (-> (the-as (inline-array game-save-tag) v1-87) 0))) (set! (-> a0-45 elt-type) (game-save-elt bg-time)) @@ -466,7 +451,7 @@ (set! (-> a0-45 elt-size) (the-as uint 8)) ) (let ((s3-8 (&+ (the-as game-save-tag v1-87) 16))) - (save! (-> *display* bg-clock) (the-as (pointer uint64) s3-8)) + (save! (-> *display* bg-clock) (&-> s3-8 user-uint64)) (let ((s3-9 (the-as object (&+ s3-8 16)))) (let ((s4-2 (-> s4-1 name))) (let ((s2-3 (-> (the-as (inline-array game-save-tag) s3-9) 0))) @@ -474,7 +459,7 @@ (set! (-> s2-3 elt-count) (+ (length s4-2) 1)) (set! (-> s2-3 elt-size) (the-as uint 1)) ) - (copy-charp<-charp (the-as (pointer uint8) (&+ (the-as game-save-tag s3-9) 16)) (-> s4-2 data)) + (copy-charp<-charp (-> (&+ (the-as game-save-tag s3-9) 16) user-uint8) (-> s4-2 data)) ) (let ((v1-99 (the-as object @@ -1166,7 +1151,6 @@ (the int (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0)) ) ) - (else (format 0 "PC PORT: Skipping setting from game save, its stored in the pc-settings now~%")) ) (set! v1-0 (&+ (the-as pointer v1-0) @@ -1218,14 +1202,11 @@ (((game-save-elt base-time)) ) (((game-save-elt game-time)) - (load! (-> *display* game-clock) (the-as (pointer uint64) (-> (the-as (inline-array game-save-tag) s4-0) 1))) + (load! (-> *display* game-clock) (&-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint64)) (set! (-> *game-info* kiosk-timeout) (the-as uint (-> *display* game-clock frame-counter))) ) (((game-save-elt total-game-time)) - (load! - (-> *display* total-game-clock) - (the-as (pointer uint64) (-> (the-as (inline-array game-save-tag) s4-0) 1)) - ) + (load! (-> *display* total-game-clock) (&-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint64)) (set! (-> *game-info* kiosk-timeout) (the-as uint (-> *display* game-clock frame-counter))) ) (((game-save-elt continue)) @@ -1654,12 +1635,8 @@ (new 'stack 'font-context *font-default-matrix* 32 320 0.0 (font-color default) (font-flags shadow kerning)) ) ) - (let ((v1-5 gp-0)) - (set! (-> v1-5 width) (the float 440)) - ) - (let ((v1-6 gp-0)) - (set! (-> v1-6 height) (the float 80)) - ) + (set-width! gp-0 440) + (set-height! gp-0 80) (set! (-> gp-0 flags) (font-flags shadow kerning)) (format (clear *temp-string*) "~S / ~S ~D~%" (-> self mode) (-> self state name) (-> self which)) (print-game-text *temp-string* gp-0 #f 44 (bucket-id progress)) @@ -1670,15 +1647,9 @@ (new 'stack 'font-context *font-default-matrix* 20 80 0.0 (font-color default) (font-flags shadow kerning)) ) ) - (let ((v1-17 gp-1)) - (set! (-> v1-17 scale) 0.8) - ) - (let ((v1-18 gp-1)) - (set! (-> v1-18 width) (the float 432)) - ) - (let ((v1-19 gp-1)) - (set! (-> v1-19 height) (the float 20)) - ) + (set-scale! gp-1 0.8) + (set-width! gp-1 432) + (set-height! gp-1 20) (set! (-> gp-1 flags) (font-flags shadow kerning middle middle-vert large)) (when (and (>= 1 (-> *game-info* auto-save-count)) (-> self next-state) (= (-> self next-state name) 'save)) (print-game-text @@ -1690,12 +1661,8 @@ ) (set! (-> gp-1 origin x) 20.0) (set! (-> gp-1 origin y) 130.0) - (let ((v1-30 gp-1)) - (set! (-> v1-30 scale) 0.7) - ) - (let ((v1-31 gp-1)) - (set! (-> v1-31 height) (the float 200)) - ) + (set-scale! gp-1 0.7) + (set-height! gp-1 200) (let ((s5-2 print-game-text)) (format (clear *temp-string*) (lookup-text! *common-text* (text-id progress-memcard-dont-remove) #f) 1) (s5-2 *temp-string* gp-1 #f 44 (bucket-id progress)) @@ -2025,7 +1992,7 @@ auto-save-post 0 (label cfg-5) (set! (-> self result) - (mc-save (-> self card) (-> self which) (&-> (-> self save) type) (the-as int (-> self save info-int32))) + (mc-save (-> self card) (-> self which) (&-> self save type) (the-as int (-> self save info-int32))) ) (when (!= (-> self result) (mc-status-code ok)) (suspend) diff --git a/goal_src/jak2/engine/game/task/task-arrow.gc b/goal_src/jak2/engine/game/task/task-arrow.gc index 18c3fa68ad..256eccdf0d 100644 --- a/goal_src/jak2/engine/game/task/task-arrow.gc +++ b/goal_src/jak2/engine/game/task/task-arrow.gc @@ -136,16 +136,14 @@ or collectable items on the ground (jetboard / weapon upgrades / etc)" (when (< (-> this rod-of-god-scale) 0.0) (set! (-> this rod-of-god-scale) 0.0) (set! (-> this moving) #f) - (let ((f0-15 81920.0)) - (cond - ((< (* f0-15 f0-15) (vector-vector-xz-distance-squared (-> this pos) (-> this root trans))) - (kill-callback (-> *minimap* engine) (-> this minimap)) - (set! (-> this root trans quad) (-> this pos quad)) - (set! (-> this minimap) (add-icon! *minimap* this (-> this map-icon) (the-as int #f) (the-as vector #t) 0)) - ) - (else - (set! (-> this root trans quad) (-> this pos quad)) - ) + (cond + ((< (square 81920.0) (vector-vector-xz-distance-squared (-> this pos) (-> this root trans))) + (kill-callback (-> *minimap* engine) (-> this minimap)) + (set! (-> this root trans quad) (-> this pos quad)) + (set! (-> this minimap) (add-icon! *minimap* this (-> this map-icon) (the-as int #f) (the-as vector #t) 0)) + ) + (else + (set! (-> this root trans quad) (-> this pos quad)) ) ) ) @@ -193,12 +191,10 @@ or collectable items on the ground (jetboard / weapon upgrades / etc)" (if (logtest? (-> self flags) (task-arrow-flags task-arrow-flag-03)) (task-arrow-method-23 self (-> self pos)) ) - (let ((f0-0 4096.0)) - (when (< (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> self pos) (-> self root trans))) - (set! v0-2 #t) - (set! (-> self moving) (the-as symbol v0-2)) - v0-2 - ) + (when (< (square 4096.0) (vector-vector-xz-distance-squared (-> self pos) (-> self root trans))) + (set! v0-2 #t) + (set! (-> self moving) (the-as symbol v0-2)) + v0-2 ) ) (('leave) diff --git a/goal_src/jak2/engine/geometry/cylinder.gc b/goal_src/jak2/engine/geometry/cylinder.gc index 3938559bd0..4ef9faff11 100644 --- a/goal_src/jak2/engine/geometry/cylinder.gc +++ b/goal_src/jak2/engine/geometry/cylinder.gc @@ -40,21 +40,6 @@ (defmethod debug-draw ((this cylinder) (arg0 vector4w)) - (local-vars - (sv-896 matrix) - (sv-912 vector) - (sv-928 vector) - (sv-944 vector) - (sv-960 vector) - (sv-976 vector) - (sv-992 vector) - (sv-1008 vector) - (sv-1024 vector) - (sv-1040 vector) - (sv-1056 vector) - (sv-1072 vector) - (sv-1088 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -79,76 +64,85 @@ (s3-0 (new 'stack-no-clear 'matrix)) ) (matrix-axis-angle! s3-0 (-> this axis) 4096.0) - (set! sv-896 (new 'stack-no-clear 'matrix)) - (vector-matrix*! (the-as vector sv-896) (-> this origin) s3-0) - (let ((v1-6 (-> s3-0 trans))) - (.lvf vf4 (&-> (-> this origin) quad)) - (.lvf vf5 (&-> sv-896 quad 0)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-6 quad) vf6) + (let ((sv-896 (new 'stack-no-clear 'matrix))) + (vector-matrix*! (the-as vector sv-896) (-> this origin) s3-0) + (let ((v1-6 (-> s3-0 trans))) + (.lvf vf4 (&-> (-> this origin) quad)) + (.lvf vf5 (&-> sv-896 quad 0)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-6 quad) vf6) + ) ) (dotimes (v1-7 8) (vector+! (-> s5-0 vert (+ v1-7 8)) (-> this origin) s1-0) (vector+float*! (-> s5-0 vert (+ v1-7 8)) (-> s5-0 vert (+ v1-7 8)) s0-0 (the float v1-7)) ) (dotimes (s0-1 8) - (set! sv-944 (-> s5-0 vert s0-1)) - (set! sv-912 (-> this origin)) - (set! sv-928 s1-0) - (let ((f0-8 (cos (* 2048.0 (the float (- 7 s0-1)))))) - (.lvf vf2 (&-> sv-928 quad)) - (.lvf vf1 (&-> sv-912 quad)) - (let ((v1-19 f0-8)) - (.mov vf3 v1-19) + (let ((sv-944 (-> s5-0 vert s0-1))) + (let ((sv-912 (-> this origin)) + (sv-928 s1-0) + (f0-8 (cos (* 2048.0 (the float (- 7 s0-1))))) + ) + (.lvf vf2 (&-> sv-928 quad)) + (.lvf vf1 (&-> sv-912 quad)) + (let ((v1-19 f0-8)) + (.mov vf3 v1-19) + ) ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-944 quad) vf4) ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-944 quad) vf4) - (set! sv-992 (-> s5-0 vert s0-1)) - (set! sv-960 (-> s5-0 vert s0-1)) - (set! sv-976 (-> this axis)) - (let ((f0-13 (* (- (-> this radius)) (sin (* 2048.0 (the float (- 7 s0-1))))))) - (.lvf vf2 (&-> sv-976 quad)) - (.lvf vf1 (&-> sv-960 quad)) - (let ((v1-33 f0-13)) - (.mov vf3 v1-33) + (let ((sv-992 (-> s5-0 vert s0-1))) + (let ((sv-960 (-> s5-0 vert s0-1)) + (sv-976 (-> this axis)) + (f0-13 (* (- (-> this radius)) (sin (* 2048.0 (the float (- 7 s0-1)))))) + ) + (.lvf vf2 (&-> sv-976 quad)) + (.lvf vf1 (&-> sv-960 quad)) + (let ((v1-33 f0-13)) + (.mov vf3 v1-33) + ) ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-992 quad) vf4) ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-992 quad) vf4) - (set! sv-1040 (-> s5-0 vert (+ s0-1 16))) - (set! sv-1008 (-> this origin)) - (set! sv-1024 s1-0) - (let ((f0-16 (cos (* 2048.0 (the float s0-1))))) - (.lvf vf2 (&-> sv-1024 quad)) - (.lvf vf1 (&-> sv-1008 quad)) - (let ((v1-43 f0-16)) - (.mov vf3 v1-43) + (let ((sv-1040 (-> s5-0 vert (+ s0-1 16)))) + (let ((sv-1008 (-> this origin)) + (sv-1024 s1-0) + (f0-16 (cos (* 2048.0 (the float s0-1)))) + ) + (.lvf vf2 (&-> sv-1024 quad)) + (.lvf vf1 (&-> sv-1008 quad)) + (let ((v1-43 f0-16)) + (.mov vf3 v1-43) + ) ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-1040 quad) vf4) ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-1040 quad) vf4) - (set! sv-1088 (-> s5-0 vert (+ s0-1 16))) - (set! sv-1056 (-> s5-0 vert (+ s0-1 16))) - (set! sv-1072 (-> this axis)) - (let ((f0-21 (+ (-> this length) (* (-> this radius) (sin (* 2048.0 (the float s0-1))))))) - (.lvf vf2 (&-> sv-1072 quad)) - (.lvf vf1 (&-> sv-1056 quad)) - (let ((v1-57 f0-21)) - (.mov vf3 v1-57) + (let ((sv-1088 (-> s5-0 vert (+ s0-1 16)))) + (let ((sv-1056 (-> s5-0 vert (+ s0-1 16))) + (sv-1072 (-> this axis)) + (f0-21 (+ (-> this length) (* (-> this radius) (sin (* 2048.0 (the float s0-1)))))) + ) + (.lvf vf2 (&-> sv-1072 quad)) + (.lvf vf1 (&-> sv-1056 quad)) + (let ((v1-57 f0-21)) + (.mov vf3 v1-57) + ) ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-1088 quad) vf4) ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-1088 quad) vf4) ) (dotimes (s2-1 16) (dotimes (s1-1 24) @@ -227,7 +221,6 @@ (defmethod debug-draw ((this cylinder-flat) (arg0 vector4w)) - (local-vars (sv-448 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -248,14 +241,15 @@ (s3-0 (new 'stack-no-clear 'matrix)) ) (matrix-axis-angle! s3-0 (-> this axis) 4096.0) - (set! sv-448 (new 'stack-no-clear 'vector)) - (vector-matrix*! sv-448 (-> this origin) s3-0) - (let ((v1-6 (-> s3-0 trans))) - (.lvf vf4 (&-> (-> this origin) quad)) - (.lvf vf5 (&-> sv-448 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-6 quad) vf6) + (let ((sv-448 (new 'stack-no-clear 'vector))) + (vector-matrix*! sv-448 (-> this origin) s3-0) + (let ((v1-6 (-> s3-0 trans))) + (.lvf vf4 (&-> (-> this origin) quad)) + (.lvf vf5 (&-> sv-448 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-6 quad) vf6) + ) ) (dotimes (v1-7 8) (vector+! (-> s5-0 vert (+ v1-7 1)) (-> this origin) s1-0) diff --git a/goal_src/jak2/engine/geometry/path-h.gc b/goal_src/jak2/engine/geometry/path-h.gc index 25008bc30e..260cf8e723 100644 --- a/goal_src/jak2/engine/geometry/path-h.gc +++ b/goal_src/jak2/engine/geometry/path-h.gc @@ -19,10 +19,11 @@ ;; DECOMP BEGINS (deftype path-control (basic) - "An abstraction around a [[curve]], providing tools such as: -- debug drawing -- conveniant vertex accessing -- vertex finding/searching algorithms" + "The path-control is a reference a path data, which is just a list of points. +Although it contains a `curve`, the knot part is not populated, so it's just treated as +a bunch of line segments from the control points. +The child class curve-control does fill out the knot data and is a proper b-spline. +These path-controls are typically allocated on a process heap." ((flags path-control-flag) (name symbol) (process process-drawable) @@ -55,7 +56,7 @@ (set! (-> path-control method-table 9) nothing) (deftype curve-control (path-control) - "Identical in terms of data to a [[path-control]] but has different implementation" + "A curve-control is like a path control, but it has both control points and knot points." () (:methods (new (symbol type process symbol float) _type_) @@ -68,21 +69,22 @@ ;; WARN: Return type mismatch object vs path-control. (defmethod new path-control ((allocation symbol) (type-to-make type) - (arg0 process) - (arg1 symbol) - (arg2 float) - (arg3 entity) - (arg4 symbol) + (proc process) + (lump-name symbol) + (lump-time float) + (lump-actor entity) + (must-exist symbol) ) - (local-vars (v0-3 object) (sv-16 res-tag) (sv-32 float)) - (set! sv-32 arg2) - (let ((s0-0 arg3) - (s1-0 arg4) + "Allocate a new path-control, set up the curve to point to the specified lump data." + (local-vars (v0-3 object)) + (let ((sv-32 lump-time) + (s0-0 lump-actor) + (s1-0 must-exist) ) (if (not s0-0) - (set! s0-0 (-> arg0 entity)) + (set! s0-0 (-> proc entity)) ) - (when (= arg1 'path) + (when (= lump-name 'path) (let ((v0-0 (entity-actor-lookup s0-0 'path-actor 0))) (if v0-0 (set! s0-0 v0-0) @@ -90,22 +92,16 @@ ) ) (let ((s2-0 (the-as object 0))) - (set! sv-16 (new 'static 'res-tag)) - (let* ((t9-1 (method-of-type res-lump get-property-data)) - (a1-2 arg1) - (a2-2 'interp) - (t0-1 #f) - (t1-1 (the-as (pointer res-tag) (& sv-16))) - (t2-1 *res-static-buf*) - (s0-1 (t9-1 s0-0 a1-2 a2-2 sv-32 (the-as pointer t0-1) t1-1 t2-1)) + (let* ((sv-16 (new 'static 'res-tag)) + (s0-1 (res-lump-data s0-0 lump-name pointer :tag-ptr (& sv-16) :time sv-32)) ) (cond (s0-1 (set! s2-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))) (set! v0-3 (cond ((nonzero? (the-as path-control s2-0)) - (set! (-> (the-as path-control s2-0) process) (the-as process-drawable arg0)) - (set! (-> (the-as path-control s2-0) name) arg1) + (set! (-> (the-as path-control s2-0) process) (the-as process-drawable proc)) + (set! (-> (the-as path-control s2-0) name) lump-name) (set! (-> (the-as path-control s2-0) curve cverts) (the-as (inline-array vector) s0-1)) (set! v0-3 (-> sv-16 elt-count)) (set! (-> (the-as path-control s2-0) curve num-cverts) (the-as int v0-3)) @@ -123,8 +119,8 @@ (cond ((nonzero? (the-as path-control s2-0)) (logior! (-> (the-as path-control s2-0) flags) (path-control-flag not-found)) - (set! (-> (the-as path-control s2-0) process) (the-as process-drawable arg0)) - (set! (-> (the-as path-control s2-0) name) arg1) + (set! (-> (the-as path-control s2-0) process) (the-as process-drawable proc)) + (set! (-> (the-as path-control s2-0) name) lump-name) (set! (-> (the-as path-control s2-0) curve cverts) (the-as (inline-array vector) #f)) (set! (-> (the-as path-control s2-0) curve num-cverts) 0) 0 diff --git a/goal_src/jak2/engine/geometry/vol.gc b/goal_src/jak2/engine/geometry/vol.gc index dd291a7a77..55680e3c58 100644 --- a/goal_src/jak2/engine/geometry/vol.gc +++ b/goal_src/jak2/engine/geometry/vol.gc @@ -19,140 +19,143 @@ ) (defmethod plane-volume-method-9 ((this plane-volume) (arg0 symbol) (arg1 vector-array) (arg2 vector-array)) - (local-vars - (sv-144 vector) - (sv-148 number) - (sv-152 int) - (sv-160 vector) - (sv-176 vector) - (sv-192 vector) - (sv-208 vector) - (sv-224 vector) - (sv-240 int) - (sv-256 int) - ) (set! (-> this volume-type) arg0) (set! (-> this point-count) 0) (set! (-> this first-point) (the-as (pointer vector) (-> arg1 data (-> arg1 length)))) (set! (-> this normal-count) 0) (set! (-> this first-normal) (the-as (pointer vector) (-> arg2 data (-> arg2 length)))) (dotimes (s3-0 (-> this num-planes)) - (set! sv-176 (new 'stack-no-clear 'vector)) - (set! (-> sv-176 quad) (the-as uint128 0)) - (set! sv-192 (new 'stack-no-clear 'vector)) - (set! (-> sv-192 quad) (the-as uint128 0)) - (set! sv-208 (new 'stack-no-clear 'vector)) - (set! (-> sv-208 quad) (the-as uint128 0)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (set! (-> sv-224 quad) (the-as uint128 0)) - 0.0 - 0.0 - 0.0 - (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) - (let ((s1-0 (new-stack-vector0)) - (s0-0 0) - (s2-0 (-> this plane)) - ) - (set! sv-240 0) - (while (< sv-240 (-> this num-planes)) - (when (!= s3-0 sv-240) - (vector-float*! sv-176 (the-as vector (-> s2-0 sv-240)) (-> s2-0 sv-240 w)) - (vector-cross! sv-192 (the-as vector (-> s2-0 sv-240)) (the-as vector (-> s2-0 s3-0))) - (vector-normalize! sv-192 1.0) - (vector-cross! sv-208 sv-192 (the-as vector (-> s2-0 sv-240))) - (vector-normalize! sv-208 1.0) - (let ((f0-4 (plane-volume-intersect-dist (-> s2-0 s3-0) sv-176 sv-208))) - (when (!= f0-4 409600000.0) - (vector+float*! sv-224 sv-176 sv-208 f0-4) - (set! sv-144 (new-stack-vector0)) - (set! sv-148 0.0) - (set! sv-152 0) - (set! sv-160 (new-stack-vector0)) - (set! (-> sv-144 quad) (-> sv-224 quad)) - (set! sv-256 0) - (while (< sv-256 (-> this num-planes)) - (when (and (!= sv-256 s3-0) (!= sv-256 sv-240)) - (let ((f0-6 (plane-volume-intersect-dist (-> s2-0 sv-256) sv-144 sv-192))) - (cond - ((= f0-6 409600000.0) - ) - ((zero? sv-152) - (vector+float*! sv-144 sv-144 sv-192 f0-6) - (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) - (set! sv-148 8192000.0) - (set! sv-152 1) - ) - ((begin (vector-float*! sv-224 sv-192 f0-6) (>= (vector-dot sv-224 sv-160) 0.0)) - ) - ((>= (vector-dot sv-224 (the-as vector (-> s2-0 sv-256))) 0.0) - (when (< (fabs f0-6) (fabs (the-as float sv-148))) - (set! sv-148 f0-6) - (set! sv-152 (+ sv-152 1)) - ) - ) - (else - (vector+float*! sv-144 sv-144 sv-192 f0-6) - (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) - (set! sv-152 (+ sv-152 1)) - (if (< (fabs f0-6) (fabs (the-as float sv-148))) - (set! sv-148 (- (the-as float sv-148) f0-6)) - (set! sv-148 0.0) + (let ((sv-176 (new 'stack-no-clear 'vector))) + (set! (-> sv-176 quad) (the-as uint128 0)) + (let ((sv-192 (new 'stack-no-clear 'vector))) + (set! (-> sv-192 quad) (the-as uint128 0)) + (let ((sv-208 (new 'stack-no-clear 'vector))) + (set! (-> sv-208 quad) (the-as uint128 0)) + (let ((sv-224 (new 'stack-no-clear 'vector))) + (set! (-> sv-224 quad) (the-as uint128 0)) + 0.0 + 0.0 + 0.0 + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (let ((s1-0 (new-stack-vector0)) + (s0-0 0) + (s2-0 (-> this plane)) + ) + (let ((sv-240 0)) + (while (< sv-240 (-> this num-planes)) + (when (!= s3-0 sv-240) + (vector-float*! sv-176 (the-as vector (-> s2-0 sv-240)) (-> s2-0 sv-240 w)) + (vector-cross! sv-192 (the-as vector (-> s2-0 sv-240)) (the-as vector (-> s2-0 s3-0))) + (vector-normalize! sv-192 1.0) + (vector-cross! sv-208 sv-192 (the-as vector (-> s2-0 sv-240))) + (vector-normalize! sv-208 1.0) + (let ((f0-4 (plane-volume-intersect-dist (-> s2-0 s3-0) sv-176 sv-208))) + (when (!= f0-4 409600000.0) + (vector+float*! sv-224 sv-176 sv-208 f0-4) + (let ((sv-144 (new-stack-vector0)) + (sv-148 0.0) + (sv-152 0) + ) + (let ((sv-160 (new-stack-vector0))) + (set! (-> sv-144 quad) (-> sv-224 quad)) + (let ((sv-256 0)) + (while (< sv-256 (-> this num-planes)) + (when (and (!= sv-256 s3-0) (!= sv-256 sv-240)) + (let ((f0-6 (plane-volume-intersect-dist (-> s2-0 sv-256) sv-144 sv-192))) + (cond + ((= f0-6 409600000.0) + ) + ((zero? sv-152) + (vector+float*! sv-144 sv-144 sv-192 f0-6) + (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) + (set! sv-148 8192000.0) + (set! sv-152 1) + ) + ((begin (vector-float*! sv-224 sv-192 f0-6) (>= (vector-dot sv-224 sv-160) 0.0)) + ) + ((>= (vector-dot sv-224 (the-as vector (-> s2-0 sv-256))) 0.0) + (when (< (fabs f0-6) (fabs (the-as float sv-148))) + (set! sv-148 f0-6) + (+! sv-152 1) + ) + ) + (else + (vector+float*! sv-144 sv-144 sv-192 f0-6) + (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) + (+! sv-152 1) + (set! sv-148 (cond + ((< (fabs f0-6) (fabs (the-as float sv-148))) + (set! sv-148 (- (the-as float sv-148) f0-6)) + sv-148 + ) + (else + 0.0 + ) + ) + ) + ) + ) + ) + ) + (+! sv-256 1) + ) + ) ) + (cond + ((zero? sv-152) + ) + ((= (the-as float sv-148) 0.0) + ) + (else + (dotimes (v1-79 (-> this num-planes)) + (when (and (!= v1-79 s3-0) (!= v1-79 sv-240)) + (if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-79))) (-> s2-0 v1-79 w))) + (goto cfg-42) + ) + ) + ) + (vector+float*! sv-224 sv-144 sv-192 (the-as float sv-148)) + (cond + ((< (-> arg1 allocated-length) (+ (-> arg1 length) 2)) + (format 0 "ERROR : vol-control #x~X out of volume points~%" this) + ) + (else + (set! (-> arg1 data (-> arg1 length) quad) (-> sv-144 quad)) + (set! (-> arg1 data (+ (-> arg1 length) 1) quad) (-> sv-224 quad)) + (+! (-> arg1 length) 2) + (+! (-> this point-count) 2) + ) + ) + (vector+! s1-0 s1-0 sv-144) + (vector+! s1-0 s1-0 sv-224) + (+! s0-0 2) + ) + ) + ) ) ) ) + (label cfg-42) + (+! sv-240 1) ) - (set! sv-256 (+ sv-256 1)) ) - (cond - ((zero? sv-152) - ) - ((= (the-as float sv-148) 0.0) - ) - (else - (dotimes (v1-79 (-> this num-planes)) - (when (and (!= v1-79 s3-0) (!= v1-79 sv-240)) - (if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-79))) (-> s2-0 v1-79 w))) - (goto cfg-42) - ) - ) + (when (nonzero? s0-0) + (vector-float*! s1-0 s1-0 (/ 1.0 (the float s0-0))) + (cond + ((< (-> arg2 allocated-length) (+ (-> arg2 length) 2)) + (format 0 "ERROR : vol-control #x~X out of volume normals~%" this) + ) + (else + (set! (-> arg2 data (-> arg2 length) quad) (-> s1-0 quad)) + (set! (-> arg2 data (+ (-> arg2 length) 1) quad) (-> s2-0 s3-0 quad)) + (+! (-> arg2 length) 2) + (set! (-> this normal-count) (+ (-> this normal-count) 2)) ) - (vector+float*! sv-224 sv-144 sv-192 (the-as float sv-148)) - (cond - ((< (-> arg1 allocated-length) (+ (-> arg1 length) 2)) - (format 0 "ERROR : vol-control #x~X out of volume points~%" this) - ) - (else - (set! (-> arg1 data (-> arg1 length) quad) (-> sv-144 quad)) - (set! (-> arg1 data (+ (-> arg1 length) 1) quad) (-> sv-224 quad)) - (+! (-> arg1 length) 2) - (+! (-> this point-count) 2) - ) - ) - (vector+! s1-0 s1-0 sv-144) - (vector+! s1-0 s1-0 sv-224) - (+! s0-0 2) ) ) ) ) ) - (label cfg-42) - (set! sv-240 (+ sv-240 1)) - ) - (when (nonzero? s0-0) - (vector-float*! s1-0 s1-0 (/ 1.0 (the float s0-0))) - (cond - ((< (-> arg2 allocated-length) (+ (-> arg2 length) 2)) - (format 0 "ERROR : vol-control #x~X out of volume normals~%" this) - ) - (else - (set! (-> arg2 data (-> arg2 length) quad) (-> s1-0 quad)) - (set! (-> arg2 data (+ (-> arg2 length) 1) quad) (-> s2-0 s3-0 quad)) - (+! (-> arg2 length) 2) - (set! (-> this normal-count) (+ (-> this normal-count) 2)) - ) - ) ) ) ) diff --git a/goal_src/jak2/engine/gfx/background/tie/tie.gc b/goal_src/jak2/engine/gfx/background/tie/tie.gc index 86a692792c..7fbd744b09 100644 --- a/goal_src/jak2/engine/gfx/background/tie/tie.gc +++ b/goal_src/jak2/engine/gfx/background/tie/tie.gc @@ -8,6 +8,7 @@ ;; DECOMP BEGINS (defmethod login ((this tie-fragment)) + "Initialize the object after it is loaded." (let ((s5-0 (the-as adgif-shader (-> this gif-ref))) (s4-0 (/ (-> this tex-count) (the-as uint 5))) ) @@ -49,6 +50,7 @@ this ) +;; WARN: Return type mismatch uint vs int. (defmethod asize-of ((this drawable-inline-array-instance-tie)) (the-as int (+ (-> drawable-inline-array-instance-tie size) (* (+ (-> this length) -1) 64))) ) @@ -74,36 +76,38 @@ this ) + (defmethod login ((this prototype-tie)) + "Initialize the object after it is loaded." (dotimes (s5-0 (-> this length)) (login (-> this data s5-0)) ) this ) -(defmethod mem-usage ((this drawable-tree-instance-tie) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 1 (-> arg0 length))) - (set! (-> arg0 data 0 name) (symbol->string 'drawable-group)) - (+! (-> arg0 data 0 count) 1) +(defmethod mem-usage ((this drawable-tree-instance-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) (symbol->string 'drawable-group)) + (+! (-> usage data 0 count) 1) (let ((v1-7 32)) - (+! (-> arg0 data 0 used) v1-7) - (+! (-> arg0 data 0 total) (logand -16 (+ v1-7 15))) + (+! (-> usage data 0 used) v1-7) + (+! (-> usage data 0 total) (logand -16 (+ v1-7 15))) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) - (mem-usage (-> this prototypes prototype-array-tie) arg0 (logior arg1 1)) + (mem-usage (-> this prototypes prototype-array-tie) usage (logior flags 1)) this ) -(defmethod mem-usage ((this tie-fragment) (arg0 memory-usage-block) (arg1 int)) - (when (logtest? arg1 2) +(defmethod mem-usage ((this tie-fragment) (usage memory-usage-block) (flags int)) + (when (logtest? flags 2) (let ((v1-3 (* (-> this color-count) 4)) (a0-2 (cond - ((logtest? arg1 4) + ((logtest? flags 4) 20 ) - ((logtest? arg1 8) + ((logtest? flags 8) 21 ) (else @@ -112,54 +116,54 @@ ) ) ) - (+! (-> arg0 data a0-2 count) 1) - (+! (-> arg0 data a0-2 used) v1-3) - (+! (-> arg0 data a0-2 total) (logand -4 (+ v1-3 3))) + (+! (-> usage data a0-2 count) 1) + (+! (-> usage data a0-2 used) v1-3) + (+! (-> usage data a0-2 total) (logand -4 (+ v1-3 3))) ) - (set! (-> arg0 length) (max 23 (-> arg0 length))) + (set! (-> usage length) (max 23 (-> usage length))) (set! this this) (goto cfg-13) ) - (set! (-> arg0 length) (max 18 (-> arg0 length))) - (set! (-> arg0 data 9 name) "tie-fragment") - (set! (-> arg0 data 10 name) "tie-gif") - (set! (-> arg0 data 11 name) "tie-points") - (set! (-> arg0 data 12 name) "tie-colors") - (set! (-> arg0 data 14 name) "tie-debug") - (set! (-> arg0 data 13 name) "tie-draw-points") - (set! (-> arg0 data 17 name) "tie-generic") - (+! (-> arg0 data 9 count) 1) + (set! (-> usage length) (max 18 (-> usage length))) + (set! (-> usage data 9 name) "tie-fragment") + (set! (-> usage data 10 name) "tie-gif") + (set! (-> usage data 11 name) "tie-points") + (set! (-> usage data 12 name) "tie-colors") + (set! (-> usage data 14 name) "tie-debug") + (set! (-> usage data 13 name) "tie-draw-points") + (set! (-> usage data 17 name) "tie-generic") + (+! (-> usage data 9 count) 1) (let ((v1-21 (asize-of this))) - (+! (-> arg0 data 9 used) v1-21) - (+! (-> arg0 data 9 total) (logand -16 (+ v1-21 15))) + (+! (-> usage data 9 used) v1-21) + (+! (-> usage data 9 total) (logand -16 (+ v1-21 15))) ) (let ((v1-26 (* (-> this gif-count) 16))) - (+! (-> arg0 data 10 count) (-> this tex-count)) - (+! (-> arg0 data 10 used) v1-26) - (+! (-> arg0 data 10 total) (logand -16 (+ v1-26 15))) + (+! (-> usage data 10 count) (-> this tex-count)) + (+! (-> usage data 10 used) v1-26) + (+! (-> usage data 10 total) (logand -16 (+ v1-26 15))) ) (let ((v1-31 (* (-> this vertex-count) 16))) - (+! (-> arg0 data 11 count) (-> this vertex-count)) - (+! (-> arg0 data 11 used) v1-31) - (+! (-> arg0 data 11 total) (logand -16 (+ v1-31 15))) + (+! (-> usage data 11 count) (-> this vertex-count)) + (+! (-> usage data 11 used) v1-31) + (+! (-> usage data 11 total) (logand -16 (+ v1-31 15))) ) (let ((v1-36 (* (-> this dp-qwc) 16))) - (+! (-> arg0 data 13 count) (* (-> this dp-qwc) 16)) - (+! (-> arg0 data 13 used) v1-36) - (+! (-> arg0 data 13 total) (logand -16 (+ v1-36 15))) + (+! (-> usage data 13 count) (* (-> this dp-qwc) 16)) + (+! (-> usage data 13 used) v1-36) + (+! (-> usage data 13 total) (logand -16 (+ v1-36 15))) ) (let ((v1-41 (* (-> this generic-count) 16))) - (+! (-> arg0 data 17 count) 1) - (+! (-> arg0 data 17 used) v1-41) - (+! (-> arg0 data 17 total) (logand -16 (+ v1-41 15))) + (+! (-> usage data 17 count) 1) + (+! (-> usage data 17 used) v1-41) + (+! (-> usage data 17 total) (logand -16 (+ v1-41 15))) ) (let ((s4-0 (-> this debug debug-lines))) (when (nonzero? s4-0) (dotimes (s3-0 (-> s4-0 length)) - (+! (-> arg0 data 14 count) (-> s4-0 s3-0 length)) + (+! (-> usage data 14 count) (-> s4-0 s3-0 length)) (let ((v1-52 (asize-of (-> s4-0 s3-0)))) - (+! (-> arg0 data 12 used) v1-52) - (+! (-> arg0 data 12 total) (logand -16 (+ v1-52 15))) + (+! (-> usage data 12 used) v1-52) + (+! (-> usage data 12 total) (logand -16 (+ v1-52 15))) ) ) ) @@ -168,29 +172,29 @@ this ) -(defmethod mem-usage ((this instance-tie) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 19 (-> arg0 length))) - (set! (-> arg0 data 18 name) "instance-tie") - (+! (-> arg0 data 18 count) 1) +(defmethod mem-usage ((this instance-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 19 (-> usage length))) + (set! (-> usage data 18 name) "instance-tie") + (+! (-> usage data 18 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 18 used) v1-6) - (+! (-> arg0 data 18 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 18 used) v1-6) + (+! (-> usage data 18 total) (logand -16 (+ v1-6 15))) ) (when (nonzero? (-> this color-indices)) - (set! (-> arg0 length) (max 24 (-> arg0 length))) - (set! (-> arg0 data 23 name) "instance-tie-colors*") - (set! (-> arg0 data 19 name) "instance-tie-colors0") - (set! (-> arg0 data 20 name) "instance-tie-colors1") - (set! (-> arg0 data 21 name) "instance-tie-colors2") - (set! (-> arg0 data 22 name) "instance-tie-colors3") - (+! (-> arg0 data 23 count) 1) + (set! (-> usage length) (max 24 (-> usage length))) + (set! (-> usage data 23 name) "instance-tie-colors*") + (set! (-> usage data 19 name) "instance-tie-colors0") + (set! (-> usage data 20 name) "instance-tie-colors1") + (set! (-> usage data 21 name) "instance-tie-colors2") + (set! (-> usage data 22 name) "instance-tie-colors3") + (+! (-> usage data 23 count) 1) (let ((s3-0 (-> this bucket-ptr))) - (+ (-> arg0 data 19 used) (-> arg0 data 20 used) (-> arg0 data 21 used) (-> arg0 data 22 used)) + (+ (-> usage data 19 used) (-> usage data 20 used) (-> usage data 21 used) (-> usage data 22 used)) (dotimes (s2-0 4) (let ((a0-10 (-> s3-0 tie-geom s2-0))) (when (nonzero? a0-10) (let ((t9-1 (method-of-object a0-10 mem-usage)) - (a1-2 arg0) + (a1-2 usage) (v1-29 s2-0) ) (t9-1 a0-10 a1-2 (logior (logior (cond @@ -209,7 +213,7 @@ ) 2 ) - arg1 + flags ) ) ) @@ -221,53 +225,54 @@ this ) -(defmethod mem-usage ((this drawable-inline-array-instance-tie) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 1 (-> arg0 length))) - (set! (-> arg0 data 0 name) (symbol->string 'drawable-group)) - (+! (-> arg0 data 0 count) 1) +(defmethod mem-usage ((this drawable-inline-array-instance-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) (symbol->string 'drawable-group)) + (+! (-> usage data 0 count) 1) (let ((v1-7 32)) - (+! (-> arg0 data 0 used) v1-7) - (+! (-> arg0 data 0 total) (logand -16 (+ v1-7 15))) + (+! (-> usage data 0 used) v1-7) + (+! (-> usage data 0 total) (logand -16 (+ v1-7 15))) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) this ) -(defmethod mem-usage ((this prototype-tie) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 1 (-> arg0 length))) - (set! (-> arg0 data 0 name) (symbol->string 'drawable-group)) - (+! (-> arg0 data 0 count) 1) +(defmethod mem-usage ((this prototype-tie) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) (symbol->string 'drawable-group)) + (+! (-> usage data 0 count) 1) (let ((v1-7 32)) - (+! (-> arg0 data 0 used) v1-7) - (+! (-> arg0 data 0 total) (logand -16 (+ v1-7 15))) + (+! (-> usage data 0 used) v1-7) + (+! (-> usage data 0 total) (logand -16 (+ v1-7 15))) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) this ) +;; WARN: Return type mismatch uint vs int. (defmethod asize-of ((this prototype-tie)) (the-as int (+ (-> prototype-tie size) (* (+ (-> this length) -1) 64))) ) (deftype tie-consts (structure) - ((data uint32 40 :offset 0) - (vector vector 10 :offset 0) - (quads uint128 10 :offset 0) - (adgif gs-gif-tag :inline :offset 0) - (strgif gs-gif-tag :inline :offset 16) - (extra vector :inline :offset 32) - (gifbufs vector :inline :offset 48) - (clrbufs qword :inline :offset 64) - (misc qword :inline :offset 80) - (atestgif gs-gif-tag :inline :offset 96) - (alpha gs-adcmd :inline :offset 112) - (atest gs-adcmd 2 :inline :offset 128) - (atest-tra gs-adcmd :inline :offset 128) - (atest-def gs-adcmd :inline :offset 144) + ((data uint32 40 :offset 0) + (vector vector 10 :overlay-at (-> data 0)) + (quads uint128 10 :overlay-at (-> data 0)) + (adgif gs-gif-tag :inline :overlay-at (-> vector 0)) + (strgif gs-gif-tag :inline :overlay-at (-> vector 4)) + (extra vector :inline :overlay-at (-> vector 8)) + (gifbufs vector :inline :overlay-at (-> data 12)) + (clrbufs qword :inline :overlay-at (-> data 16)) + (misc qword :inline :overlay-at (-> data 20)) + (atestgif gs-gif-tag :inline :overlay-at (-> data 24)) + (alpha gs-adcmd :inline :overlay-at (-> data 28)) + (atest gs-adcmd 2 :inline :overlay-at (-> data 32)) + (atest-tra gs-adcmd :inline :overlay-at (-> atest 0)) + (atest-def gs-adcmd :inline :overlay-at (-> atest 1)) ) ) @@ -576,31 +581,28 @@ ) ) +;; WARN: Return type mismatch symbol vs none. (defun-debug tie-ints () - (local-vars (sv-16 uint)) (let ((gp-0 (+ #x3da0 #x1100c000))) (dotimes (s5-0 16) (if (< s5-0 10) (format 0 " ") ) - (let ((s4-0 format) - (s3-0 0) - (s2-0 "vi~d: ~6d #x~4,'0X ~s~%") - (s1-0 s5-0) - (s0-0 (-> (the-as (pointer uint32) (+ gp-0 (* (* s5-0 4) 4))) 0)) - ) - (set! sv-16 (-> (the-as (pointer uint32) (+ gp-0 (* (* s5-0 4) 4))) 0)) - (let ((t1-0 (tie-int-reg s5-0))) - (s4-0 s3-0 s2-0 s1-0 s0-0 sv-16 t1-0) - ) + (format + 0 + "vi~d: ~6d #x~4,'0X ~s~%" + s5-0 + (-> (the-as (pointer uint32) (+ gp-0 (* (* s5-0 4) 4))) 0) + (-> (the-as (pointer uint32) (+ gp-0 (* (* s5-0 4) 4))) 0) + (tie-int-reg s5-0) ) ) ) (none) ) +;; WARN: Return type mismatch symbol vs none. (defun-debug tie-floats () - (local-vars (sv-16 uint) (sv-32 uint)) (let ((gp-0 (the-as (pointer uint32) (+ #x3da0 #x1100c000)))) (dotimes (s5-0 32) (if (< s5-0 10) @@ -615,23 +617,16 @@ (-> gp-0 (+ (* s5-0 4) 2)) (-> gp-0 (+ (* s5-0 4) 3)) ) - (let ((s4-0 format) - (s3-0 0) - (s2-0 "~F ~F ~F ~F ~s~%") - (s1-0 (-> gp-0 (* s5-0 4))) - (s0-0 (-> gp-0 (+ (* s5-0 4) 1))) - ) - (set! sv-16 (-> gp-0 (+ (* s5-0 4) 2))) - (set! sv-32 (-> gp-0 (+ (* s5-0 4) 3))) - (let ((t2-1 (tie-float-reg s5-0))) - (s4-0 s3-0 s2-0 s1-0 s0-0 sv-16 sv-32 t2-1) - ) + (format + 0 + "~F ~F ~F ~F ~s~%" + (-> gp-0 (* s5-0 4)) + (-> gp-0 (+ (* s5-0 4) 1)) + (-> gp-0 (+ (* s5-0 4) 2)) + (-> gp-0 (+ (* s5-0 4) 3)) + (tie-float-reg s5-0) ) ) ) (none) ) - - - - diff --git a/goal_src/jak2/engine/gfx/foreground/eye.gc b/goal_src/jak2/engine/gfx/foreground/eye.gc index 4444597f9f..d1a22a5b5d 100644 --- a/goal_src/jak2/engine/gfx/foreground/eye.gc +++ b/goal_src/jak2/engine/gfx/foreground/eye.gc @@ -63,7 +63,6 @@ ) (defun render-eyes-32 ((arg0 dma-buffer) (arg1 eye-control) (arg2 int)) - (local-vars (sv-16 float)) (let ((s4-0 32) (s3-0 (+ (* arg2 32) 32)) (s2-0 (* arg2 32)) @@ -71,8 +70,8 @@ (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 16)) (* 32.0 (-> arg1 left x))))) (f26-0 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 left y))))) (f30-0 (* 16.0 (+ (the float (+ s4-0 48)) (* 32.0 (-> arg1 right x))))) + (sv-16 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 right y))))) ) - (set! sv-16 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 right y))))) (let ((s1-0 (-> arg1 shaders 0))) (let ((v1-14 (the-as object (-> arg0 base)))) (set! (-> (the-as dma-gif-packet v1-14) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) @@ -273,7 +272,6 @@ ) (defun render-eyes-32-different ((arg0 dma-buffer) (arg1 eye-control) (arg2 int)) - (local-vars (sv-16 float)) (let ((s4-0 32) (s3-0 (+ (* arg2 32) 32)) (s2-0 (* arg2 32)) @@ -281,8 +279,8 @@ (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 16)) (* 32.0 (-> arg1 left x))))) (f26-0 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 left y))))) (f30-0 (* 16.0 (+ (the float (+ s4-0 48)) (* 32.0 (-> arg1 right x))))) + (sv-16 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 right y))))) ) - (set! sv-16 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 right y))))) (let ((s1-0 (-> arg1 shaders 0))) (let ((v1-14 (the-as object (-> arg0 base)))) (set! (-> (the-as dma-gif-packet v1-14) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) @@ -540,7 +538,6 @@ ) (defun render-eyes-64 ((arg0 dma-buffer) (arg1 eye-control) (arg2 int)) - (local-vars (sv-16 float)) (let ((s4-0 64) (s3-0 (+ (* arg2 64) 64)) (s2-0 (* arg2 64)) @@ -548,8 +545,8 @@ (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 32)) (* 64.0 (-> arg1 left x))))) (f26-0 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 left y))))) (f30-0 (* 16.0 (+ (the float (+ s4-0 96)) (* 64.0 (-> arg1 right x))))) + (sv-16 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 right y))))) ) - (set! sv-16 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 right y))))) (let ((s1-0 (-> arg1 shaders 0))) (let ((v1-14 (the-as object (-> arg0 base)))) (set! (-> (the-as dma-gif-packet v1-14) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) @@ -750,7 +747,6 @@ ) (defun render-eyes-64-different ((arg0 dma-buffer) (arg1 eye-control) (arg2 int)) - (local-vars (sv-16 float)) (let ((s4-0 64) (s3-0 (+ (* arg2 64) 64)) (s2-0 (* arg2 64)) @@ -758,8 +754,8 @@ (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 32)) (* 64.0 (-> arg1 left x))))) (f26-0 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 left y))))) (f30-0 (* 16.0 (+ (the float (+ s4-0 96)) (* 64.0 (-> arg1 right x))))) + (sv-16 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 right y))))) ) - (set! sv-16 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 right y))))) (let ((s1-0 (-> arg1 shaders 0))) (let ((v1-14 (the-as object (-> arg0 base)))) (set! (-> (the-as dma-gif-packet v1-14) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) @@ -1260,12 +1256,7 @@ ) (convert-eye-data s2-0 (-> s5-0 eye-anim data (* s0-1 2) dword)) (convert-eye-data s1-0 (-> s5-0 eye-anim data (* s3-2 2) dword)) - (vector4-lerp! - (the-as vector (-> s4-0 left)) - (the-as vector (-> s2-0 data)) - (the-as vector (-> s1-0 data)) - f30-0 - ) + (vector4-lerp! (the-as vector (-> s4-0 left)) (-> s2-0 data 0) (-> s1-0 data 0) f30-0) (vector4-lerp! (the-as vector (&-> s4-0 left iris-scale)) (the-as vector (&-> s2-0 iris-scale)) @@ -1275,12 +1266,7 @@ (convert-eye-data s2-0 (-> s5-0 eye-anim data (+ (* s0-1 2) 1) dword)) (convert-eye-data s1-0 (-> s5-0 eye-anim data (+ (* s3-2 2) 1) dword)) ) - (vector4-lerp! - (the-as vector (-> s4-0 right)) - (the-as vector (-> s2-0 data)) - (the-as vector (-> s1-0 data)) - f30-0 - ) + (vector4-lerp! (the-as vector (-> s4-0 right)) (-> s2-0 data 0) (-> s1-0 data 0) f30-0) (vector4-lerp! (the-as vector (&-> s4-0 right iris-scale)) (the-as vector (&-> s2-0 iris-scale)) diff --git a/goal_src/jak2/engine/gfx/foreground/lightning.gc b/goal_src/jak2/engine/gfx/foreground/lightning.gc index 11b08e5ff3..c9201f266c 100644 --- a/goal_src/jak2/engine/gfx/foreground/lightning.gc +++ b/goal_src/jak2/engine/gfx/foreground/lightning.gc @@ -39,12 +39,12 @@ ) (defun lightning-fractal-gen ((arg0 (inline-array vector)) (arg1 int) (arg2 int) (arg3 float) (arg4 lightning-spec)) - (local-vars (sv-16 vector) (sv-32 vector)) (when (< 1 (- arg2 arg1)) (let ((s1-0 (/ (+ arg1 arg2) 2))) - (set! sv-16 (-> arg0 arg1)) - (set! sv-32 (-> arg0 arg2)) - (let ((s0-0 (-> arg0 s1-0))) + (let ((sv-16 (-> arg0 arg1)) + (sv-32 (-> arg0 arg2)) + (s0-0 (-> arg0 s1-0)) + ) (let* ((f30-0 (* 0.5 (+ (-> sv-16 x) (-> sv-32 x)))) (f28-0 arg3) (f26-0 -0.5) @@ -79,7 +79,6 @@ ) (defun lightning-uniform-gen ((arg0 (inline-array vector)) (arg1 int) (arg2 int) (arg3 float) (arg4 lightning-spec)) - (local-vars (sv-32 vector)) (let ((s4-0 (-> arg0 arg1)) (s3-0 (-> arg0 arg2)) (f30-0 (/ 1.0 (the float (- arg2 arg1)))) @@ -90,29 +89,30 @@ ) (while (>= s0-0 s1-0) (vector-lerp! (-> arg0 s1-0) s4-0 s3-0 f28-0) - (set! sv-32 s2-0) - (let* ((f26-0 0.4) - (f24-0 -0.5) - (v1-7 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-8 (the-as number (logior #x3f800000 v1-7))) - ) - (set! (-> sv-32 x) (* f26-0 (+ f24-0 (+ -1.0 (the-as float v1-8))) arg3)) + (let ((sv-32 s2-0)) + (let* ((f26-0 0.4) + (f24-0 -0.5) + (v1-7 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-8 (the-as number (logior #x3f800000 v1-7))) + ) + (set! (-> sv-32 x) (* f26-0 (+ f24-0 (+ -1.0 (the-as float v1-8))) arg3)) + ) + (let* ((f26-1 0.4) + (f24-1 -0.5) + (v1-13 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-14 (the-as number (logior #x3f800000 v1-13))) + ) + (set! (-> sv-32 y) (* f26-1 (+ f24-1 (+ -1.0 (the-as float v1-14))) arg3)) + ) + (let* ((f26-2 0.4) + (f24-2 -0.5) + (v1-19 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-20 (the-as number (logior #x3f800000 v1-19))) + ) + (set! (-> sv-32 z) (* f26-2 (+ f24-2 (+ -1.0 (the-as float v1-20))) arg3)) + ) + (set! (-> sv-32 w) 1.0) ) - (let* ((f26-1 0.4) - (f24-1 -0.5) - (v1-13 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-14 (the-as number (logior #x3f800000 v1-13))) - ) - (set! (-> sv-32 y) (* f26-1 (+ f24-1 (+ -1.0 (the-as float v1-14))) arg3)) - ) - (let* ((f26-2 0.4) - (f24-2 -0.5) - (v1-19 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-20 (the-as number (logior #x3f800000 v1-19))) - ) - (set! (-> sv-32 z) (* f26-2 (+ f24-2 (+ -1.0 (the-as float v1-20))) arg3)) - ) - (set! (-> sv-32 w) 1.0) (vector+! (-> arg0 s1-0) (-> arg0 s1-0) s2-0) (+! f28-0 f30-0) (+! s1-0 1) @@ -162,7 +162,6 @@ (arg4 float) (arg5 lightning-spec) ) - (local-vars (sv-80 vector) (sv-96 vector) (sv-112 vector) (sv-128 vector) (sv-144 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -171,78 +170,83 @@ (init-vf0-vector) (when (< 1 (- arg3 arg2)) (let ((s0-0 (/ (+ arg2 arg3) 2))) - (set! sv-96 (new 'stack-no-clear 'vector)) - (let ((v1-5 (-> arg0 arg2)) - (a0-3 (-> arg1 arg2)) - ) - (.lvf vf4 (&-> v1-5 quad)) - (.lvf vf5 (&-> a0-3 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-96 quad) vf6) - (set! sv-112 (new 'stack-no-clear 'vector)) - (let ((v1-9 (-> arg0 arg3)) - (a0-5 (-> arg1 arg3)) - ) - (.lvf vf4 (&-> v1-9 quad)) - (.lvf vf5 (&-> a0-5 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-112 quad) vf6) - (set! sv-144 (new 'stack-no-clear 'vector)) - (set! sv-128 (new 'stack-no-clear 'vector)) - (set! sv-80 sv-144) - (let* ((f30-0 arg4) - (f28-0 -0.5) - (v1-15 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-16 (the-as number (logior #x3f800000 v1-15))) - ) - (set! (-> sv-80 x) (* f30-0 (+ f28-0 (+ -1.0 (the-as float v1-16))))) - ) - (let* ((f30-1 arg4) - (f28-1 -0.5) - (v1-20 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-21 (the-as number (logior #x3f800000 v1-20))) - ) - (set! (-> sv-80 y) (* f30-1 (+ f28-1 (+ -1.0 (the-as float v1-21))))) - ) - (let* ((f30-2 arg4) - (f28-2 -0.5) - (v1-25 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-26 (the-as number (logior #x3f800000 v1-25))) - ) - (set! (-> sv-80 z) (* f30-2 (+ f28-2 (+ -1.0 (the-as float v1-26))))) - ) - (set! (-> sv-80 w) 1.0) - (let ((v1-31 sv-128) - (a0-15 sv-128) - ) + (let ((sv-96 (new 'stack-no-clear 'vector))) + (let ((v1-5 (-> arg0 arg2)) + (a0-3 (-> arg1 arg2)) + ) + (.lvf vf4 (&-> v1-5 quad)) + (.lvf vf5 (&-> a0-3 quad)) + ) (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-96 quad)) - (.lvf vf5 (&-> sv-112 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> a0-15 quad) vf6) - (vector-float*! v1-31 a0-15 0.5) - ) - (let ((v1-33 sv-144)) - (let ((a0-16 sv-144)) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-96 quad) vf6) + (let ((sv-112 (new 'stack-no-clear 'vector))) + (let ((v1-9 (-> arg0 arg3)) + (a0-5 (-> arg1 arg3)) + ) + (.lvf vf4 (&-> v1-9 quad)) + (.lvf vf5 (&-> a0-5 quad)) + ) (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-16 quad)) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-112 quad) vf6) + (let ((sv-144 (new 'stack-no-clear 'vector))) + (let ((sv-128 (new 'stack-no-clear 'vector))) + (let ((sv-80 sv-144)) + (let* ((f30-0 arg4) + (f28-0 -0.5) + (v1-15 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-16 (the-as number (logior #x3f800000 v1-15))) + ) + (set! (-> sv-80 x) (* f30-0 (+ f28-0 (+ -1.0 (the-as float v1-16))))) + ) + (let* ((f30-1 arg4) + (f28-1 -0.5) + (v1-20 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-21 (the-as number (logior #x3f800000 v1-20))) + ) + (set! (-> sv-80 y) (* f30-1 (+ f28-1 (+ -1.0 (the-as float v1-21))))) + ) + (let* ((f30-2 arg4) + (f28-2 -0.5) + (v1-25 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-26 (the-as number (logior #x3f800000 v1-25))) + ) + (set! (-> sv-80 z) (* f30-2 (+ f28-2 (+ -1.0 (the-as float v1-26))))) + ) + (set! (-> sv-80 w) 1.0) + ) + (let ((v1-31 sv-128) + (a0-15 sv-128) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-96 quad)) + (.lvf vf5 (&-> sv-112 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> a0-15 quad) vf6) + (vector-float*! v1-31 a0-15 0.5) + ) + (let ((v1-33 sv-144)) + (let ((a0-16 sv-144)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-16 quad)) + ) + (.lvf vf5 (&-> sv-128 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-33 quad) vf6) + ) + ) + (let ((v1-35 (-> arg0 s0-0))) + (let ((a0-19 (-> arg1 s0-0))) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-19 quad)) + ) + (.lvf vf5 (&-> sv-144 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-35 quad) vf6) + ) + ) ) - (.lvf vf5 (&-> sv-128 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-33 quad) vf6) - ) - (let ((v1-35 (-> arg0 s0-0))) - (let ((a0-19 (-> arg1 s0-0))) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-19 quad)) - ) - (.lvf vf5 (&-> sv-144 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-35 quad) vf6) ) (lightning-trail-fractal-gen arg0 arg1 arg2 s0-0 (* arg4 (-> arg5 reduction)) arg5) (lightning-trail-fractal-gen arg0 arg1 s0-0 arg3 (* arg4 (-> arg5 reduction)) arg5) @@ -326,7 +330,7 @@ ) (defbehavior lightning-fade process ((arg0 lightning-control)) - (local-vars (v0-1 int) (sv-16 rgba)) + (local-vars (v0-1 int)) (let ((f0-0 (-> arg0 spec fade-time))) (-> arg0 process 0 clock) (cond @@ -335,8 +339,8 @@ (let ((gp-0 (-> arg0 state))) (let* ((s5-0 (-> arg0 spec)) (f30-0 (fmax 0.0 (fmin 1.0 (* (- 1.0 (/ (-> gp-0 counter) f0-0)) (-> s5-0 fade-start-factor))))) + (sv-16 (-> s5-0 fade-to-color)) ) - (set! sv-16 (-> s5-0 fade-to-color)) (set! (-> gp-0 start-color) (rgba-lerp sv-16 (-> s5-0 start-color) (the-as rgba f30-0))) (set! v0-1 (the-as int (rgba-lerp sv-16 (-> s5-0 end-color) (the-as rgba f30-0)))) ) @@ -368,27 +372,19 @@ ) (defun lightning-update ((arg0 lightning-control)) - (local-vars - (sv-16 lightning-spec) - (sv-20 vector-array) - (sv-24 vector-array) - (sv-28 vector-array) - (sv-32 symbol) - (sv-36 clock) - ) (let* ((gp-0 (-> arg0 state points-to-draw)) (s4-0 (+ gp-0 -1)) (s5-0 (-> arg0 state)) + (sv-16 (-> arg0 spec)) + (sv-20 (-> s5-0 line)) + (sv-24 (-> s5-0 meet)) + (sv-28 (-> s5-0 path)) + (sv-32 (= (-> s5-0 mode) (lightning-mode lm1))) + (sv-36 (-> arg0 process 0 clock)) ) - (set! sv-16 (-> arg0 spec)) - (set! sv-20 (-> s5-0 line)) - (set! sv-24 (-> s5-0 meet)) - (set! sv-28 (-> s5-0 path)) - (set! sv-32 (= (-> s5-0 mode) (lightning-mode lm1))) - (set! sv-36 (-> arg0 process 0 clock)) (when (not (or (= (-> sv-36 time-adjust-ratio) 0.0) (< gp-0 2))) (when (logtest? (-> sv-16 flags) (lightning-spec-flags size-from-adjust-dist)) - (let ((f1-1 (vector-vector-distance (the-as vector (-> sv-24 data)) (-> sv-24 data s4-0)))) + (let ((f1-1 (vector-vector-distance (-> sv-24 data 0) (-> sv-24 data s4-0)))) (set! (-> s5-0 box-size) (* (-> sv-16 box-size) (fmax 1.0 (fmin 5.0 (/ f1-1 (* 4096.0 (the float (-> sv-16 adjust-distance))))))) ) @@ -458,22 +454,7 @@ ) (defun lightning-draw ((arg0 dma-buffer) (arg1 lightning-control) (arg2 lightning-globals)) - (local-vars - (sv-16 math-camera) - (sv-20 (inline-array gcf-vertex)) - (sv-24 lightning-spec) - (sv-28 float) - (sv-32 texture) - (sv-48 vector-array) - (sv-64 int) - (sv-80 int) - (sv-96 int) - (sv-112 int) - (sv-128 int) - (sv-144 int) - (sv-160 int) - (sv-176 gcf-control) - ) + (local-vars (sv-128 int)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -487,255 +468,269 @@ (vf9 :class vf) ) (init-vf0-vector) - (set! sv-16 *math-camera*) - (set! sv-20 (the-as (inline-array gcf-vertex) *gsf-buffer*)) - (let* ((s3-0 (-> arg1 state points-to-draw)) + (let* ((sv-16 *math-camera*) + (sv-20 (the-as (inline-array gcf-vertex) *gsf-buffer*)) + (s3-0 (-> arg1 state points-to-draw)) (s2-0 (+ s3-0 -1)) (s1-0 *lightning-gcf*) (s0-0 (-> sv-16 camera-rot)) + (sv-32 (lookup-texture-by-id (-> arg1 spec texture))) + (sv-48 (-> arg1 state line)) + (sv-24 (-> arg1 spec)) ) - (set! sv-32 (lookup-texture-by-id (-> arg1 spec texture))) - (set! sv-48 (-> arg1 state line)) - (set! sv-24 (-> arg1 spec)) (when (< 1 s3-0) - (set! sv-64 0) - (while (< sv-64 2) - (set! sv-28 (/ 1.0 (the float s2-0))) - (cond - ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf0)) - (set! sv-80 0) - (while (< sv-80 (* s3-0 2)) - (cond - ((not (logtest? sv-80 1)) - (gs-packed-rgba-lerp! - (-> sv-20 sv-80 clr) - (-> arg1 state start-color) - (-> arg1 state end-color) - (* (the float (/ sv-80 2)) sv-28) - ) - (let ((v1-25 (-> sv-20 sv-80))) - (set! (-> v1-25 tex x) 0) - (set! (-> v1-25 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) - (set! (-> v1-25 tex z) 4096) - (set! (-> v1-25 tex w) 0) - ) - ) - (else - (gs-packed-rgba-lerp! - (-> sv-20 sv-80 clr) - (-> arg1 state start-color) - (-> arg1 state end-color) - (* (the float (/ sv-80 2)) sv-28) - ) - (let ((v1-35 (-> sv-20 sv-80))) - (set! (-> v1-35 tex x) 4096) - (set! (-> v1-35 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) - (set! (-> v1-35 tex z) 4096) - (set! (-> v1-35 tex w) 0) + (let ((sv-64 0)) + (while (< sv-64 2) + (let ((sv-28 (/ 1.0 (the float s2-0)))) + (cond + ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf0)) + (let ((sv-80 0)) + (while (< sv-80 (* s3-0 2)) + (cond + ((not (logtest? sv-80 1)) + (gs-packed-rgba-lerp! + (-> sv-20 sv-80 clr) + (-> arg1 state start-color) + (-> arg1 state end-color) + (* (the float (/ sv-80 2)) sv-28) + ) + (let ((v1-25 (-> sv-20 sv-80))) + (set! (-> v1-25 tex x) 0) + (set! (-> v1-25 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) + (set! (-> v1-25 tex z) 4096) + (set! (-> v1-25 tex w) 0) + ) + ) + (else + (gs-packed-rgba-lerp! + (-> sv-20 sv-80 clr) + (-> arg1 state start-color) + (-> arg1 state end-color) + (* (the float (/ sv-80 2)) sv-28) + ) + (let ((v1-35 (-> sv-20 sv-80))) + (set! (-> v1-35 tex x) 4096) + (set! (-> v1-35 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) + (set! (-> v1-35 tex z) 4096) + (set! (-> v1-35 tex w) 0) + ) + ) + ) + (+! sv-80 1) ) ) ) - (set! sv-80 (+ sv-80 1)) - ) - ) - ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf1)) - (dotimes (v1-45 (* s3-0 2)) - (cond - ((not (logtest? v1-45 1)) - (let ((a0-26 (-> sv-20 v1-45))) - (set! (-> a0-26 tex x) 0) - (set! (-> a0-26 tex y) (* (/ 4096 s3-0) (/ v1-45 2))) - (set! (-> a0-26 tex z) 4096) - (set! (-> a0-26 tex w) 0) - ) - ) - (else - (let ((a0-30 (-> sv-20 v1-45))) - (set! (-> a0-30 tex x) 4096) - (set! (-> a0-30 tex y) (* (/ 4096 s3-0) (/ v1-45 2))) - (set! (-> a0-30 tex z) 4096) - (set! (-> a0-30 tex w) 0) + ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf1)) + (dotimes (v1-45 (* s3-0 2)) + (cond + ((not (logtest? v1-45 1)) + (let ((a0-26 (-> sv-20 v1-45))) + (set! (-> a0-26 tex x) 0) + (set! (-> a0-26 tex y) (* (/ 4096 s3-0) (/ v1-45 2))) + (set! (-> a0-26 tex z) 4096) + (set! (-> a0-26 tex w) 0) + ) + ) + (else + (let ((a0-30 (-> sv-20 v1-45))) + (set! (-> a0-30 tex x) 4096) + (set! (-> a0-30 tex y) (* (/ 4096 s3-0) (/ v1-45 2))) + (set! (-> a0-30 tex z) 4096) + (set! (-> a0-30 tex w) 0) + ) + ) + ) + ) + (dotimes (v1-48 (* s2-0 2)) + (set! (-> sv-20 v1-48 clr x) (the-as int (-> arg1 state start-color r))) + (set! (-> sv-20 v1-48 clr y) (the-as int (-> arg1 state start-color g))) + (set! (-> sv-20 v1-48 clr z) (the-as int (-> arg1 state start-color b))) + (set! (-> sv-20 v1-48 clr w) (the-as int (-> arg1 state start-color a))) + ) + (dotimes (v1-51 2) + (let ((a0-45 (+ v1-51 (* s2-0 2)))) + (set! (-> sv-20 a0-45 clr x) (the-as int (-> arg1 state end-color r))) + (set! (-> sv-20 a0-45 clr y) (the-as int (-> arg1 state end-color g))) + (set! (-> sv-20 a0-45 clr z) (the-as int (-> arg1 state end-color b))) + (set! (-> sv-20 a0-45 clr w) (the-as int (-> arg1 state end-color a))) ) ) ) - ) - (dotimes (v1-48 (* s2-0 2)) - (set! (-> sv-20 v1-48 clr x) (the-as int (-> arg1 state start-color r))) - (set! (-> sv-20 v1-48 clr y) (the-as int (-> arg1 state start-color g))) - (set! (-> sv-20 v1-48 clr z) (the-as int (-> arg1 state start-color b))) - (set! (-> sv-20 v1-48 clr w) (the-as int (-> arg1 state start-color a))) - ) - (dotimes (v1-51 2) - (let ((a0-45 (+ v1-51 (* s2-0 2)))) - (set! (-> sv-20 a0-45 clr x) (the-as int (-> arg1 state end-color r))) - (set! (-> sv-20 a0-45 clr y) (the-as int (-> arg1 state end-color g))) - (set! (-> sv-20 a0-45 clr z) (the-as int (-> arg1 state end-color b))) - (set! (-> sv-20 a0-45 clr w) (the-as int (-> arg1 state end-color a))) - ) - ) - ) - ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf2)) - (dotimes (v1-58 (* s3-0 2)) - (cond - ((not (logtest? v1-58 1)) - (let ((a0-52 (-> sv-20 v1-58))) - (set! (-> a0-52 tex x) 0) - (set! (-> a0-52 tex y) (* (/ 4096 s3-0) (/ v1-58 2))) - (set! (-> a0-52 tex z) 4096) - (set! (-> a0-52 tex w) 0) - ) - ) - (else - (let ((a0-56 (-> sv-20 v1-58))) - (set! (-> a0-56 tex x) 4096) - (set! (-> a0-56 tex y) (* (/ 4096 s3-0) (/ v1-58 2))) - (set! (-> a0-56 tex z) 4096) - (set! (-> a0-56 tex w) 0) + ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf2)) + (dotimes (v1-58 (* s3-0 2)) + (cond + ((not (logtest? v1-58 1)) + (let ((a0-52 (-> sv-20 v1-58))) + (set! (-> a0-52 tex x) 0) + (set! (-> a0-52 tex y) (* (/ 4096 s3-0) (/ v1-58 2))) + (set! (-> a0-52 tex z) 4096) + (set! (-> a0-52 tex w) 0) + ) + ) + (else + (let ((a0-56 (-> sv-20 v1-58))) + (set! (-> a0-56 tex x) 4096) + (set! (-> a0-56 tex y) (* (/ 4096 s3-0) (/ v1-58 2))) + (set! (-> a0-56 tex z) 4096) + (set! (-> a0-56 tex w) 0) + ) + ) + ) + ) + (dotimes (v1-61 (* (+ s3-0 -2) 2)) + (let ((a0-58 (+ v1-61 2))) + (set! (-> sv-20 a0-58 clr x) (the-as int (-> arg1 state start-color r))) + (set! (-> sv-20 a0-58 clr y) (the-as int (-> arg1 state start-color g))) + (set! (-> sv-20 a0-58 clr z) (the-as int (-> arg1 state start-color b))) + (set! (-> sv-20 a0-58 clr w) (the-as int (-> arg1 state start-color a))) + ) + ) + (dotimes (v1-64 2) + (let ((a0-63 v1-64)) + (set! (-> sv-20 a0-63 clr x) (the-as int (-> arg1 state end-color r))) + (set! (-> sv-20 a0-63 clr y) (the-as int (-> arg1 state end-color g))) + (set! (-> sv-20 a0-63 clr z) (the-as int (-> arg1 state end-color b))) + (set! (-> sv-20 a0-63 clr w) (the-as int (-> arg1 state end-color a))) + ) + ) + (dotimes (v1-67 2) + (let ((a0-67 (+ v1-67 (* s2-0 2)))) + (set! (-> sv-20 a0-67 clr x) (the-as int (-> arg1 state end-color r))) + (set! (-> sv-20 a0-67 clr y) (the-as int (-> arg1 state end-color g))) + (set! (-> sv-20 a0-67 clr z) (the-as int (-> arg1 state end-color b))) + (set! (-> sv-20 a0-67 clr w) (the-as int (-> arg1 state end-color a))) ) ) ) - ) - (dotimes (v1-61 (* (+ s3-0 -2) 2)) - (let ((a0-58 (+ v1-61 2))) - (set! (-> sv-20 a0-58 clr x) (the-as int (-> arg1 state start-color r))) - (set! (-> sv-20 a0-58 clr y) (the-as int (-> arg1 state start-color g))) - (set! (-> sv-20 a0-58 clr z) (the-as int (-> arg1 state start-color b))) - (set! (-> sv-20 a0-58 clr w) (the-as int (-> arg1 state start-color a))) - ) - ) - (dotimes (v1-64 2) - (let ((a0-63 v1-64)) - (set! (-> sv-20 a0-63 clr x) (the-as int (-> arg1 state end-color r))) - (set! (-> sv-20 a0-63 clr y) (the-as int (-> arg1 state end-color g))) - (set! (-> sv-20 a0-63 clr z) (the-as int (-> arg1 state end-color b))) - (set! (-> sv-20 a0-63 clr w) (the-as int (-> arg1 state end-color a))) - ) - ) - (dotimes (v1-67 2) - (let ((a0-67 (+ v1-67 (* s2-0 2)))) - (set! (-> sv-20 a0-67 clr x) (the-as int (-> arg1 state end-color r))) - (set! (-> sv-20 a0-67 clr y) (the-as int (-> arg1 state end-color g))) - (set! (-> sv-20 a0-67 clr z) (the-as int (-> arg1 state end-color b))) - (set! (-> sv-20 a0-67 clr w) (the-as int (-> arg1 state end-color a))) - ) - ) - ) - ) - (let ((f0-8 (-> sv-24 radius)) - (f1-4 0.5) - (v1-73 (the-as object (&-> (the-as (inline-array vector) sv-48) 0 w))) - (a0-71 (the-as object (-> sv-20 0))) - (a1-82 (the-as object (-> sv-20 1))) ) - 1 - (.lvf vf1 (&-> s0-0 quad 0)) - (.lvf vf2 (&-> s0-0 quad 1)) - (.lvf vf3 (&-> s0-0 quad 2)) - (.lvf vf4 (&-> s0-0 trans quad)) - (let ((a2-44 f0-8)) - (.mov vf8 a2-44) ) - (let ((a2-45 f1-4)) - (.mov vf17 a2-45) - ) - (.add.x.vf.y vf17 vf0 vf8) - (.add.w.vf.z vf17 vf0 vf0) - (.add.w.vf.z vf17 vf17 vf0) - (dotimes (a2-46 s3-0) - (.lvf vf8 (&-> (the-as (inline-array vector) v1-73) 0 quad)) - (.mul.w.vf.xyz acc vf4 vf0) - (.add.mul.x.vf.xyz acc vf1 vf8 acc) - (.add.mul.y.vf.xyz acc vf2 vf8 acc) - (.add.mul.z.vf.xyz vf8 vf3 vf8 acc) - (.add.x.vf vf6 vf8 vf0) - (b! (zero? sv-64) cfg-44 :delay (.add.x.vf vf7 vf8 vf0)) - (.add.y.vf.y vf6 vf6 vf17) - (b! #t cfg-45 :delay (.sub.y.vf.y vf7 vf7 vf17)) - (label cfg-44) - (.add.y.vf.x vf6 vf6 vf17) - (.sub.y.vf.x vf7 vf7 vf17) - (label cfg-45) - (.svf (&-> (the-as (pointer uint128) a1-82) 2) vf6) - (.svf (&-> (the-as (pointer uint128) a0-71) 2) vf7) - (set! a1-82 (&+ (the-as pointer a1-82) 96)) - (set! a0-71 (&+ (the-as pointer a0-71) 96)) - (.add.x.vf vf9 vf8 vf0) - (set! v1-73 (-> (the-as (inline-array vector) v1-73) 1)) - ) - ) - (set! sv-96 s2-0) - (set! sv-112 0) - (while (> sv-96 0) - (if (< 40 sv-96) - (set! sv-128 40) - (set! sv-128 sv-96) + (let ((f0-8 (-> sv-24 radius)) + (f1-4 0.5) + (v1-73 (the-as object (&-> (the-as (inline-array vector) sv-48) 0 w))) + (a0-71 (the-as object (-> sv-20 0))) + (a1-82 (the-as object (-> sv-20 1))) + ) + 1 + (.lvf vf1 (&-> s0-0 quad 0)) + (.lvf vf2 (&-> s0-0 quad 1)) + (.lvf vf3 (&-> s0-0 quad 2)) + (.lvf vf4 (&-> s0-0 trans quad)) + (let ((a2-44 f0-8)) + (.mov vf8 a2-44) ) - (set! sv-144 (+ sv-128 1)) - (set! sv-160 12) - (let* ((v1-83 arg0) - (a0-73 (the-as object (-> v1-83 base))) - ) - (set! (-> (the-as dma-packet a0-73) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc sv-160)) - (set! (-> (the-as dma-packet a0-73) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet a0-73) vif1) - (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32) :imm (shr (shl (-> arg2 gcf-buf) 54) 54) :num sv-160) - ) - (set! (-> v1-83 base) (the-as pointer (&+ (the-as dma-packet a0-73) 16))) - ) - (set! sv-176 (the-as gcf-control (-> arg0 base))) - (let* ((v1-86 (-> sv-176 matrix)) - (a3-31 (-> sv-16 perspective)) - (a0-76 (-> a3-31 quad 0)) - (a1-88 (-> a3-31 quad 1)) - (a2-58 (-> a3-31 quad 2)) - (a3-32 (-> a3-31 trans quad)) - ) - (set! (-> v1-86 quad 0) a0-76) - (set! (-> v1-86 quad 1) a1-88) - (set! (-> v1-86 quad 2) a2-58) - (set! (-> v1-86 trans quad) a3-32) - ) - (quad-copy! (the-as pointer (-> sv-176 giftag)) (the-as pointer (-> s1-0 giftag)) 3) - (set! (-> sv-176 giftag num-strips) (the-as uint 1)) - (set! (-> sv-176 num-dps) (the-as uint (* sv-144 2))) - (set! (-> sv-176 kick-offset) (the-as uint 0)) - (adgif-shader<-texture-simple! (the-as adgif-shader (-> sv-176 shader)) sv-32) - (adgif-shader-update! (the-as adgif-shader (-> sv-176 shader)) sv-32) - (set! (-> sv-176 shader 0 shader alpha) (new 'static 'gs-alpha :b #x2 :d #x1 :fix #x80)) - (set! (-> sv-176 shader 0 shader tex0 tfx) 0) - (set! (-> sv-176 shader 0 pos) (the-as uint 0)) - (set! (-> sv-176 shader 0 num) (the-as uint (+ #x8000 (* sv-144 2)))) - (&+! (-> arg0 base) (* sv-160 16)) - (let* ((v1-104 arg0) - (a0-90 (the-as object (-> v1-104 base))) - ) - (set! (-> (the-as dma-packet a0-90) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc (* 6 sv-144))) - (set! (-> (the-as dma-packet a0-90) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet a0-90) vif1) - (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32) :imm (shr (shl (-> arg2 vtx-buf) 54) 54) :num (* 6 sv-144)) - ) - (set! (-> v1-104 base) (the-as pointer (&+ (the-as dma-packet a0-90) 16))) - ) - (quad-copy! (-> arg0 base) (the-as pointer (-> sv-20 sv-112)) (* 6 sv-144)) - (&+! (-> arg0 base) (* 96 sv-144)) - (let* ((v1-109 arg0) - (a0-95 (the-as object (-> v1-109 base))) - ) - (set! (-> (the-as dma-packet a0-95) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) - (set! (-> (the-as dma-packet a0-95) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet a0-95) vif1) (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd mscal) :msk #x1)) - (set! (-> v1-109 base) (the-as pointer (&+ (the-as dma-packet a0-95) 16))) - ) - (set! (-> arg2 gcf-buf) (- 1704 (the-as int (-> arg2 gcf-buf)))) - (+! (-> arg2 vtx-buf) 279) - (if (< (the-as uint 567) (-> arg2 vtx-buf)) - (set! (-> arg2 vtx-buf) (the-as uint 9)) + (let ((a2-45 f1-4)) + (.mov vf17 a2-45) ) - (set! sv-96 (- sv-96 sv-128)) - (set! sv-112 (+ sv-112 (* sv-128 2))) - sv-112 + (.add.x.vf.y vf17 vf0 vf8) + (.add.w.vf.z vf17 vf0 vf0) + (.add.w.vf.z vf17 vf17 vf0) + (dotimes (a2-46 s3-0) + (.lvf vf8 (&-> (the-as (inline-array vector) v1-73) 0 quad)) + (.mul.w.vf.xyz acc vf4 vf0) + (.add.mul.x.vf.xyz acc vf1 vf8 acc) + (.add.mul.y.vf.xyz acc vf2 vf8 acc) + (.add.mul.z.vf.xyz vf8 vf3 vf8 acc) + (.add.x.vf vf6 vf8 vf0) + (b! (zero? sv-64) cfg-44 :delay (.add.x.vf vf7 vf8 vf0)) + (.add.y.vf.y vf6 vf6 vf17) + (b! #t cfg-45 :delay (.sub.y.vf.y vf7 vf7 vf17)) + (label cfg-44) + (.add.y.vf.x vf6 vf6 vf17) + (.sub.y.vf.x vf7 vf7 vf17) + (label cfg-45) + (.svf (&-> (the-as (pointer uint128) a1-82) 2) vf6) + (.svf (&-> (the-as (pointer uint128) a0-71) 2) vf7) + (set! a1-82 (&+ (the-as pointer a1-82) 96)) + (set! a0-71 (&+ (the-as pointer a0-71) 96)) + (.add.x.vf vf9 vf8 vf0) + (set! v1-73 (-> (the-as (inline-array vector) v1-73) 1)) + ) + ) + (let ((sv-96 s2-0) + (sv-112 0) + ) + (while (> sv-96 0) + (set! sv-128 (cond + ((< 40 sv-96) + (set! sv-128 40) + sv-128 + ) + (else + sv-96 + ) + ) + ) + (let ((sv-144 (+ sv-128 1))) + (let ((sv-160 12)) + (let* ((v1-83 arg0) + (a0-73 (the-as object (-> v1-83 base))) + ) + (set! (-> (the-as dma-packet a0-73) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc sv-160)) + (set! (-> (the-as dma-packet a0-73) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-73) vif1) + (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32) :imm (shr (shl (-> arg2 gcf-buf) 54) 54) :num sv-160) + ) + (set! (-> v1-83 base) (the-as pointer (&+ (the-as dma-packet a0-73) 16))) + ) + (let ((sv-176 (the-as gcf-control (-> arg0 base)))) + (let* ((v1-86 (-> sv-176 matrix)) + (a3-31 (-> sv-16 perspective)) + (a0-76 (-> a3-31 quad 0)) + (a1-88 (-> a3-31 quad 1)) + (a2-58 (-> a3-31 quad 2)) + (a3-32 (-> a3-31 trans quad)) + ) + (set! (-> v1-86 quad 0) a0-76) + (set! (-> v1-86 quad 1) a1-88) + (set! (-> v1-86 quad 2) a2-58) + (set! (-> v1-86 trans quad) a3-32) + ) + (quad-copy! (the-as pointer (-> sv-176 giftag)) (the-as pointer (-> s1-0 giftag)) 3) + (set! (-> sv-176 giftag num-strips) (the-as uint 1)) + (set! (-> sv-176 num-dps) (the-as uint (* sv-144 2))) + (set! (-> sv-176 kick-offset) (the-as uint 0)) + (adgif-shader<-texture-simple! (-> sv-176 shader 0 shader) sv-32) + (adgif-shader-update! (-> sv-176 shader 0 shader) sv-32) + (set! (-> sv-176 shader 0 shader alpha) (new 'static 'gs-alpha :b #x2 :d #x1 :fix #x80)) + (set! (-> sv-176 shader 0 shader tex0 tfx) 0) + (set! (-> sv-176 shader 0 pos) (the-as uint 0)) + (set! (-> sv-176 shader 0 num) (the-as uint (+ #x8000 (* sv-144 2)))) + ) + (&+! (-> arg0 base) (* sv-160 16)) + ) + (let* ((v1-104 arg0) + (a0-90 (the-as object (-> v1-104 base))) + ) + (set! (-> (the-as dma-packet a0-90) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc (* 6 sv-144))) + (set! (-> (the-as dma-packet a0-90) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-90) vif1) + (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32) :imm (shr (shl (-> arg2 vtx-buf) 54) 54) :num (* 6 sv-144)) + ) + (set! (-> v1-104 base) (the-as pointer (&+ (the-as dma-packet a0-90) 16))) + ) + (quad-copy! (-> arg0 base) (the-as pointer (-> sv-20 sv-112)) (* 6 sv-144)) + (&+! (-> arg0 base) (* 96 sv-144)) + ) + (let* ((v1-109 arg0) + (a0-95 (the-as object (-> v1-109 base))) + ) + (set! (-> (the-as dma-packet a0-95) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-95) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-95) vif1) (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd mscal) :msk #x1)) + (set! (-> v1-109 base) (the-as pointer (&+ (the-as dma-packet a0-95) 16))) + ) + (set! (-> arg2 gcf-buf) (- 1704 (the-as int (-> arg2 gcf-buf)))) + (+! (-> arg2 vtx-buf) 279) + (if (< (the-as uint 567) (-> arg2 vtx-buf)) + (set! (-> arg2 vtx-buf) (the-as uint 9)) + ) + (set! sv-96 (- sv-96 sv-128)) + (+! sv-112 (* sv-128 2)) + sv-112 + ) + ) + (+! sv-64 1) ) - (set! sv-64 (+ sv-64 1)) ) #f ) diff --git a/goal_src/jak2/engine/gfx/foreground/ripple.gc b/goal_src/jak2/engine/gfx/foreground/ripple.gc index 394c317f53..f47b9627fd 100644 --- a/goal_src/jak2/engine/gfx/foreground/ripple.gc +++ b/goal_src/jak2/engine/gfx/foreground/ripple.gc @@ -27,7 +27,7 @@ (defun ripple-make-request ((waveform ripple-wave) (effect merc-effect)) "Iterate through [[*ripple-globals*]] `requests` looking for the one that matches the provided `effect` If NOT found, append a new [[ripple-request]] with the providded `effect` and `waveform` to the end of the `requests`. - + NOTE: There can only be 16 effects at a given time, NOOP if already at that limit!" (let ((v1-1 (-> *ripple-globals* count)) (a2-1 (-> *ripple-globals* requests)) @@ -76,7 +76,7 @@ "Iterate through [[*ripple-globals*]] requests, from the end to index `0` For each request, if it has a `waveform` create the wave-table via `ripple-create-wave-table` Then for each `waveform` apply the `effect` using `ripple-apply-wave-table` - + Once completed, all `requests` have been processed and the `count` is reset to `0`" (when (-> *ripple-globals* count) (ripple-execute-init) @@ -144,9 +144,9 @@ ) (defun ripple-find-height ((arg0 process-drawable) (arg1 int) (arg2 vector)) - (local-vars (sv-16 draw-control) (sv-32 float) (sv-48 float)) - (let ((f30-0 (-> arg0 root trans y))) - (set! sv-16 (-> arg0 draw)) + (let ((f30-0 (-> arg0 root trans y)) + (sv-16 (-> arg0 draw)) + ) (if (or (zero? sv-16) (not (-> sv-16 ripple))) (return f30-0) ) @@ -180,20 +180,18 @@ (let* ((f22-1 (the float (the int f28-1))) (f24-1 (the float (the int f26-1))) (f20-0 (ripple-slow-add-sine-waves s5-0 f22-1 f24-1)) + (sv-32 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1)) + (sv-48 (ripple-slow-add-sine-waves s5-0 f22-1 (+ 1.0 f24-1))) + (f1-6 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) (+ 1.0 f24-1))) + (f0-22 (+ f20-0 (* (- f28-1 f22-1) (- sv-32 f20-0)))) + (f1-9 (+ sv-48 (* (- f28-1 f22-1) (- f1-6 sv-48)))) + (f1-12 (+ f0-22 (* (- f26-1 f24-1) (- f1-9 f0-22)))) + (f0-23 (-> gp-0 faded-scale)) ) - (set! sv-32 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1)) - (set! sv-48 (ripple-slow-add-sine-waves s5-0 f22-1 (+ 1.0 f24-1))) - (let* ((f1-6 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) (+ 1.0 f24-1))) - (f0-22 (+ f20-0 (* (- f28-1 f22-1) (- sv-32 f20-0)))) - (f1-9 (+ sv-48 (* (- f28-1 f22-1) (- f1-6 sv-48)))) - (f1-12 (+ f0-22 (* (- f26-1 f24-1) (- f1-9 f0-22)))) - (f0-23 (-> gp-0 faded-scale)) - ) - (if (< f0-23 0.0) - (set! f0-23 (-> gp-0 global-scale)) - ) - (+ f30-0 (* (/ f1-12 128) f0-23)) - ) + (if (< f0-23 0.0) + (set! f0-23 (-> gp-0 global-scale)) + ) + (+ f30-0 (* (/ f1-12 128) f0-23)) ) ) ) diff --git a/goal_src/jak2/engine/gfx/mood/mood-funcs2.gc b/goal_src/jak2/engine/gfx/mood/mood-funcs2.gc index 91847ce638..cd8fb2d8f3 100644 --- a/goal_src/jak2/engine/gfx/mood/mood-funcs2.gc +++ b/goal_src/jak2/engine/gfx/mood/mood-funcs2.gc @@ -194,12 +194,7 @@ ) (let ((f0-5 (get-sphere-interp a0-10 a1-4 61440.0 69632.0))) (set-vector! (-> arg0 times 0) 1.0 1.0 1.0 1.0) - (vector-lerp! - (the-as vector (-> arg0 times)) - (the-as vector (-> arg0 times)) - (the-as vector (-> *level* default-level mood-context times)) - f0-5 - ) + (vector-lerp! (-> arg0 times 0) (-> arg0 times 0) (-> *level* default-level mood-context times 0) f0-5) ) ) ) @@ -699,12 +694,7 @@ ) (set-vector! a0-121 -364544.0 0.0 5324800.0 1.0) (let ((f0-76 (get-sphere-interp a0-121 a1-40 139264.0 24576.0))) - (vector-lerp! - (the-as vector (-> arg0 times)) - (the-as vector (-> arg0 times)) - (the-as vector (-> *level* default-level mood-context times)) - f0-76 - ) + (vector-lerp! (-> arg0 times 0) (-> arg0 times 0) (-> *level* default-level mood-context times 0) f0-76) ) ) ) @@ -1891,7 +1881,6 @@ (defun update-under-lights ((arg0 mood-context)) - (local-vars (sv-80 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1924,28 +1913,27 @@ (s5-0 (-> arg0 light-group 3)) (gp-1 (-> arg0 light-group 4)) ) - (let ((s1-0 (new 'static 'vector :x 0.8645 :z -0.5294))) - (set! sv-80 (new 'static 'vector :x -2.0 :z 1950.0)) - (let ((v0-1 (target-pos 0)) - (s0-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-10 s0-0)) - (.lvf vf4 (&-> v0-1 quad)) - (.lvf vf5 (&-> sv-80 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-10 quad) vf6) + (let ((s1-0 (new 'static 'vector :x 0.8645 :z -0.5294)) + (sv-80 (new 'static 'vector :x -2.0 :z 1950.0)) + (v0-1 (target-pos 0)) + (s0-0 (new 'stack-no-clear 'vector)) ) - (vector-normalize! s0-0 1.0) - (cond - ((>= (vector-dot s1-0 s0-0) 0.0) - (set-vector! (-> s2-0 0 dir0 color) 0.6 0.5 0.7 1.0) - (set-vector! (-> s2-0 0 ambi color) 0.3 0.3 0.3 1.0) - ) - (else - (set-vector! (-> s2-0 0 dir0 color) 0.2 0.2 0.4 1.0) - (set-vector! (-> s2-0 0 ambi color) 0.2 0.2 0.2 1.0) - ) + (let ((v1-10 s0-0)) + (.lvf vf4 (&-> v0-1 quad)) + (.lvf vf5 (&-> sv-80 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-10 quad) vf6) + ) + (vector-normalize! s0-0 1.0) + (cond + ((>= (vector-dot s1-0 s0-0) 0.0) + (set-vector! (-> s2-0 0 dir0 color) 0.6 0.5 0.7 1.0) + (set-vector! (-> s2-0 0 ambi color) 0.3 0.3 0.3 1.0) + ) + (else + (set-vector! (-> s2-0 0 dir0 color) 0.2 0.2 0.4 1.0) + (set-vector! (-> s2-0 0 ambi color) 0.2 0.2 0.2 1.0) ) ) ) @@ -2285,7 +2273,6 @@ ;; ERROR: Stack slot load at 16 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 32 mismatch: defined as size 4, got size 16 (defbehavior update-mood-dig1 time-of-day-proc ((arg0 mood-context)) - (local-vars (sv-16 float) (sv-32 float)) (update-mood-interior arg0) (update-dig1-lights arg0) (cond @@ -2296,31 +2283,15 @@ (let ((gp-0 (the-as dig1-states (-> arg0 state)))) (set! (-> arg0 times 0 w) 1.0) (set! (-> arg0 times 1 w) 1.0) - (let ((s4-0 update-mood-pulse) - (s3-0 arg0) - (s2-0 2) - (s1-0 0) - (s0-0 0.85) - ) - (set! sv-16 0.15) - (let ((t1-0 (* 182.04445 (seconds-per-frame) (rand-vu-float-range 60.0 200.0))) - (t2-0 0.0) - ) - (s4-0 s3-0 s2-0 s1-0 s0-0 sv-16 t1-0 t2-0) - ) - ) - (let ((s4-1 update-mood-pulse) - (s3-1 arg0) - (s2-1 3) - (s1-1 4) - (s0-1 0.85) - ) - (set! sv-32 0.15) - (let ((t1-1 (* 182.04445 (seconds-per-frame) (rand-vu-float-range 120.0 180.0))) - (t2-1 16384.0) - ) - (s4-1 s3-1 s2-1 s1-1 s0-1 sv-32 t1-1 t2-1) - ) + (update-mood-pulse arg0 2 0 0.85 0.15 (* 182.04445 (seconds-per-frame) (rand-vu-float-range 60.0 200.0)) 0.0) + (update-mood-pulse + arg0 + 3 + 4 + 0.85 + 0.15 + (* 182.04445 (seconds-per-frame) (rand-vu-float-range 120.0 180.0)) + 16384.0 ) (set! (-> arg0 times 6 w) 1.0) (if (not (task-node-closed? (game-task-node dig-knock-down-resolution))) diff --git a/goal_src/jak2/engine/gfx/mood/mood.gc b/goal_src/jak2/engine/gfx/mood/mood.gc index 1e227377f3..c73bc49bf9 100644 --- a/goal_src/jak2/engine/gfx/mood/mood.gc +++ b/goal_src/jak2/engine/gfx/mood/mood.gc @@ -197,7 +197,7 @@ ) ) (defun update-mood-exterior ((arg0 mood-context-core3) (arg1 mood-table) (arg2 float) (arg3 int)) - (local-vars (v0-1 object) (sv-32 mood-color) (sv-48 mood-color) (sv-64 vector)) + (local-vars (v0-1 object)) (cond ((< (the-as uint 8) (the-as uint (-> *time-of-day-context* mode))) (palette-select-special arg0) @@ -245,18 +245,18 @@ (mem-copy! (the-as pointer (-> arg0 current-fog)) (the-as pointer (-> arg1 mood-fog-table data s3-0)) 48) ) (else - (set! sv-32 (-> arg1 mood-color-table data s3-0)) - (set! sv-48 (-> arg1 mood-color-table data s2-0)) - (let ((s1-0 (-> arg0 times))) - (set! sv-64 (-> arg0 times 1)) - (let ((s0-0 (-> arg0 light-group))) - (vector4-lerp! (the-as vector s1-0) (-> sv-32 amb-color) (-> sv-48 amb-color) f30-0) - (vector4-lerp! sv-64 (-> sv-32 lgt-color) (-> sv-48 lgt-color) f30-0) - (set! (-> arg0 times 2 quad) (-> sv-64 quad)) - (set! (-> arg0 times 3 quad) (-> sv-64 quad)) - (set! (-> arg0 times 4 quad) (-> sv-64 quad)) - (set! (-> s0-0 0 ambi color quad) (-> s1-0 0 quad)) - ) + (let ((sv-32 (-> arg1 mood-color-table data s3-0)) + (sv-48 (-> arg1 mood-color-table data s2-0)) + (s1-0 (-> arg0 times)) + (sv-64 (-> arg0 times 1)) + (s0-0 (-> arg0 light-group)) + ) + (vector4-lerp! (-> s1-0 0) (-> sv-32 amb-color) (-> sv-48 amb-color) f30-0) + (vector4-lerp! sv-64 (-> sv-32 lgt-color) (-> sv-48 lgt-color) f30-0) + (set! (-> arg0 times 2 quad) (-> sv-64 quad)) + (set! (-> arg0 times 3 quad) (-> sv-64 quad)) + (set! (-> arg0 times 4 quad) (-> sv-64 quad)) + (set! (-> s0-0 0 ambi color quad) (-> s1-0 0 quad)) ) (vector4-lerp! (-> arg0 current-sky-color) diff --git a/goal_src/jak2/engine/gfx/ocean/ocean-mid.gc b/goal_src/jak2/engine/gfx/ocean/ocean-mid.gc index 6cd7e1d7a6..d86c0d7638 100644 --- a/goal_src/jak2/engine/gfx/ocean/ocean-mid.gc +++ b/goal_src/jak2/engine/gfx/ocean/ocean-mid.gc @@ -532,9 +532,8 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod ocean-mid-add-upload ((this ocean) (arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 float)) - (local-vars (sv-32 int)) - (set! sv-32 arg1) - (let ((s0-0 arg2) + (let ((sv-32 arg1) + (s0-0 arg2) (s1-0 arg3) (s4-0 arg4) (s2-0 arg5) @@ -994,43 +993,43 @@ ) (defmethod draw-ocean-mid-seams ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere)) (ocean-seams-add-constants this arg0) - (set! sv-32 (-> this mid-minx)) - (set! sv-33 (-> this mid-maxx)) - (set! sv-34 (-> this mid-minz)) - (set! sv-35 (-> this mid-maxz)) - (set! sv-36 (new 'stack 'sphere)) - (set! (-> sv-36 y) (-> this start-corner y)) - (set! (-> sv-36 r) 278045.7) - (let ((s4-0 sv-34) - (s3-0 sv-35) + (let ((sv-32 (-> this mid-minx)) + (sv-33 (-> this mid-maxx)) + (sv-34 (-> this mid-minz)) + (sv-35 (-> this mid-maxz)) + (sv-36 (new 'stack 'sphere)) ) - (while (>= s3-0 s4-0) - (let ((s2-0 sv-32) - (s1-0 sv-33) - ) - (while (>= s1-0 s2-0) - (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s2-0)) (-> this start-corner x))) - (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s4-0)) (-> this start-corner z))) - ;; og:preserve-this - (when (sphere-cull-for-ocean sv-36) - (cond - ((= s4-0 sv-34) - (ocean-mid-add-upload-top this arg0 s4-0 s2-0) - ) - ((= s4-0 sv-35) - (ocean-mid-add-upload-bottom this arg0 s4-0 s2-0) - ) - (else - (ocean-mid-add-upload-middle this arg0 s4-0 s2-0) + (set! (-> sv-36 y) (-> this start-corner y)) + (set! (-> sv-36 r) 278045.7) + (let ((s4-0 sv-34) + (s3-0 sv-35) + ) + (while (>= s3-0 s4-0) + (let ((s2-0 sv-32) + (s1-0 sv-33) + ) + (while (>= s1-0 s2-0) + (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s2-0)) (-> this start-corner x))) + (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s4-0)) (-> this start-corner z))) + (when (sphere-cull sv-36) + (cond + ((= s4-0 sv-34) + (ocean-mid-add-upload-top this arg0 s4-0 s2-0) + ) + ((= s4-0 sv-35) + (ocean-mid-add-upload-bottom this arg0 s4-0 s2-0) + ) + (else + (ocean-mid-add-upload-middle this arg0 s4-0 s2-0) + ) ) ) + (+! s2-0 1) ) - (+! s2-0 1) ) + (+! s4-0 1) ) - (+! s4-0 1) ) ) (dotimes (v1-29 36) @@ -1043,7 +1042,7 @@ ) (defmethod draw-ocean-mid ((this ocean) (arg0 dma-buffer)) - (local-vars (v1-8 float) (v1-9 float) (sv-32 int)) + (local-vars (v1-8 float) (v1-9 float)) (rlet ((vf16 :class vf) (vf17 :class vf) (vf18 :class vf) @@ -1100,23 +1099,15 @@ (dotimes (s2-0 6) (let* ((s1-0 (+ (* 6 s3-0) s2-0)) (s0-0 (-> this ocean-spheres spheres s1-0)) + (sv-32 (-> (the-as (pointer int16) (+ (* s1-0 2) (the-as int (-> this ocean-mid-indices)))))) ) - (set! sv-32 (-> (the-as (pointer int16) (+ (* s1-0 2) (the-as int (-> this ocean-mid-indices)))))) ;; og:preserve-this (when (sphere-cull-for-ocean s0-0) (cond ((< sv-32 0) ) ((let ((f30-0 (- (vector-vector-distance s0-0 s4-0) (-> s0-0 r)))) - (let ((a0-16 this) - (t9-5 (method-of-type ocean ocean-mid-add-upload)) - (a1-8 arg0) - (a2-2 s3-0) - (a3-0 s2-0) - (t2-0 f30-0) - ) - (t9-5 a0-16 a1-8 a2-2 a3-0 sv-32 s1-0 t2-0) - ) + (ocean-mid-add-upload this arg0 s3-0 s2-0 sv-32 s1-0 f30-0) (< f30-0 786432.0) ) (ocean-mid-add-call this arg0 73) diff --git a/goal_src/jak2/engine/gfx/ocean/ocean-near.gc b/goal_src/jak2/engine/gfx/ocean/ocean-near.gc index 013c9463f8..e02f0b5043 100644 --- a/goal_src/jak2/engine/gfx/ocean/ocean-near.gc +++ b/goal_src/jak2/engine/gfx/ocean/ocean-near.gc @@ -651,7 +651,6 @@ ) (defmethod draw-ocean-near ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-16 uint)) (dma-buffer-add-gs-set arg0 (test-1 (new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal))) ) @@ -674,8 +673,9 @@ ) (when (and (< s4-0 s3-0) (< s2-0 s1-0)) (while (>= s1-0 s2-0) - (let ((s0-0 s4-0)) - (set! sv-16 s3-0) + (let ((s0-0 s4-0) + (sv-16 s3-0) + ) (while (>= sv-16 s0-0) (when (ocean-trans-camera-masks-bit? this s2-0 s0-0) (let* ((a1-16 (- (shr s0-0 2) (-> this mid-minx))) diff --git a/goal_src/jak2/engine/gfx/ocean/ocean-texture.gc b/goal_src/jak2/engine/gfx/ocean/ocean-texture.gc index b6c44ba387..5619087e27 100644 --- a/goal_src/jak2/engine/gfx/ocean/ocean-texture.gc +++ b/goal_src/jak2/engine/gfx/ocean/ocean-texture.gc @@ -603,7 +603,6 @@ ) (defmethod ocean-method-85 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 vector4w) (sv-64 vector4w)) (dma-buffer-add-gs-set arg0 (alpha-1 (new 'static 'gs-alpha :b #x2 :d #x1))) (let ((v1-3 (-> arg0 base))) (set! (-> (the-as (pointer uint128) v1-3)) (-> this haze-tmpl dma-vif quad)) @@ -617,9 +616,10 @@ (s4-0 (-> arg0 base)) ) (dotimes (s1-0 16) - (let ((s0-0 (the-as object (-> arg0 base)))) - (set! sv-48 (-> this haze-verts (* s1-0 2))) - (set! sv-64 (-> this haze-verts (+ (* s1-0 2) 1))) + (let ((s0-0 (the-as object (-> arg0 base))) + (sv-48 (-> this haze-verts (* s1-0 2))) + (sv-64 (-> this haze-verts (+ (* s1-0 2) 1))) + ) (let ((f0-1 (+ -1024.0 (the float (-> sv-48 x)))) (f1-3 (+ -1024.0 (the float (-> sv-48 y)))) (v1-22 s2-0) @@ -748,7 +748,6 @@ ) (defmethod ocean-method-88 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 vector) (sv-64 uint) (sv-80 vector) (sv-96 vector) (sv-112 vector)) (dma-buffer-add-gs-set arg0 (test-1 (new 'static 'gs-test :ate #x1 @@ -802,34 +801,23 @@ (vector-float*! (-> s2-2 ambi-color) (-> s2-2 ambi-color) 0.25) (vector-float*! (-> s2-2 ambi-color-lower) (-> s2-2 ambi-color-lower) 0.25) (dotimes (s1-0 36) - (let ((v1-36 (-> this cloud-verts s1-0))) - (set! sv-80 (-> this cloud-nrms s1-0)) - (let ((s0-0 (-> this cloud-col0 s1-0))) - (set! sv-48 (-> this cloud-col1 s1-0)) - (set! sv-112 (-> this cloud-st0 s1-0)) - (set! sv-96 (-> this cloud-st1 s1-0)) - (set! sv-64 (-> this cloud-alpha s1-0)) + (let ((v1-36 (-> this cloud-verts s1-0)) + (sv-80 (-> this cloud-nrms s1-0)) + (s0-0 (-> this cloud-col0 s1-0)) + (sv-48 (-> this cloud-col1 s1-0)) + (sv-112 (-> this cloud-st0 s1-0)) + (sv-96 (-> this cloud-st1 s1-0)) + ) + (let ((sv-64 (-> this cloud-alpha s1-0))) (set! (-> s4-1 x) (* 0.140625 (+ -1024.0 (the float (-> v1-36 x))))) (set! (-> s4-1 z) (* 0.140625 (+ -1024.0 (the float (-> v1-36 z))))) (vector-negate! s3-1 sv-80) - (let ((a0-41 this) - (t9-3 (method-of-type ocean ocean-method-86)) - (a1-19 s0-0) - (a3-0 (-> s2-2 sun0-color)) - (t0-0 (-> s2-2 ambi-color)) - ) - (t9-3 a0-41 a1-19 sv-80 a3-0 t0-0) - ) + (ocean-method-86 this s0-0 sv-80 (-> s2-2 sun0-color) (-> s2-2 ambi-color)) (ocean-method-86 this sv-48 s3-1 (-> s2-2 sun0-color-lower) (-> s2-2 ambi-color-lower)) (set! (-> s0-0 w) (the-as float sv-64)) + (set! (-> sv-48 w) (the-as float sv-64)) ) - ) - (set! (-> sv-48 w) (the-as float sv-64)) - (let ((a0-44 this) - (t9-5 (method-of-type ocean ocean-method-87)) - (a3-2 s4-1) - ) - (t9-5 a0-44 sv-96 sv-112 a3-2) + (ocean-method-87 this sv-96 sv-112 s4-1) ) ) ) diff --git a/goal_src/jak2/engine/gfx/ocean/ocean-transition.gc b/goal_src/jak2/engine/gfx/ocean/ocean-transition.gc index a2d1cd8341..a69d72cc3e 100644 --- a/goal_src/jak2/engine/gfx/ocean/ocean-transition.gc +++ b/goal_src/jak2/engine/gfx/ocean/ocean-transition.gc @@ -486,21 +486,22 @@ ) (defmethod ocean-make-trans-camera-masks ((this ocean) (arg0 uint) (arg1 uint) (arg2 uint) (arg3 uint)) - (local-vars (sv-48 ocean-trans-mask) (sv-52 vector) (sv-56 vector) (sv-60 vector)) - (set! sv-48 (the-as ocean-trans-mask (&-> this trans-camera-masks (+ (* arg2 4) arg3)))) - (set! sv-52 (-> *math-camera* trans)) - (set! sv-56 (new-stack-vector0)) - (set! sv-60 (new-stack-vector0)) - (set! (-> sv-56 x) (+ (-> this start-corner x) (* 393216.0 (the float arg1)))) - (set! (-> sv-56 y) (-> this start-corner y)) - (set! (-> sv-56 z) (+ (-> this start-corner z) (* 393216.0 (the float arg0)))) - (set! (-> sv-56 w) 1.0) - (dotimes (s5-0 4) - (dotimes (s4-0 4) - (set! (-> sv-60 x) (- (+ (-> sv-56 x) (* 98304.0 (the float s4-0))) (-> sv-52 x))) - (set! (-> sv-60 y) (- (-> sv-56 y) (-> sv-52 y))) - (set! (-> sv-60 z) (- (+ (-> sv-56 z) (* 98304.0 (the float s5-0))) (-> sv-52 z))) - (ocean-transition-check this sv-48 s4-0 s5-0 sv-56) + (let ((sv-48 (the-as ocean-trans-mask (&-> this trans-camera-masks (+ (* arg2 4) arg3)))) + (sv-52 (-> *math-camera* trans)) + (sv-56 (new-stack-vector0)) + (sv-60 (new-stack-vector0)) + ) + (set! (-> sv-56 x) (+ (-> this start-corner x) (* 393216.0 (the float arg1)))) + (set! (-> sv-56 y) (-> this start-corner y)) + (set! (-> sv-56 z) (+ (-> this start-corner z) (* 393216.0 (the float arg0)))) + (set! (-> sv-56 w) 1.0) + (dotimes (s5-0 4) + (dotimes (s4-0 4) + (set! (-> sv-60 x) (- (+ (-> sv-56 x) (* 98304.0 (the float s4-0))) (-> sv-52 x))) + (set! (-> sv-60 y) (- (-> sv-56 y) (-> sv-52 y))) + (set! (-> sv-60 z) (- (+ (-> sv-56 z) (* 98304.0 (the float s5-0))) (-> sv-52 z))) + (ocean-transition-check this sv-48 s4-0 s5-0 sv-56) + ) ) ) 0 @@ -632,34 +633,36 @@ ) (defmethod draw-ocean-transition-seams ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere)) - (set! sv-32 (-> this near-minx)) - (set! sv-33 (-> this near-maxx)) - (set! sv-34 (-> this near-minz)) - (set! sv-35 (-> this near-maxz)) - (set! sv-36 (new 'stack 'sphere)) - (set! (-> sv-36 y) (-> this start-corner y)) - (set! (-> sv-36 r) 69511.42) - (when (and (< sv-32 sv-33) (< sv-34 sv-35)) - (let ((s4-0 sv-34) - (s3-0 sv-35) - ) - (while (>= s3-0 s4-0) - (let ((s2-0 sv-32) - (s1-0 sv-33) - ) - (while (>= s1-0 s2-0) - (set! (-> sv-36 x) (+ 49152.0 (* 98304.0 (the float s2-0)) (-> this start-corner x))) - (set! (-> sv-36 z) (+ 49152.0 (* 98304.0 (the float s4-0)) (-> this start-corner z))) - (when (sphere-cull-for-ocean sv-36) ;; modified - (if (not (ocean-trans-camera-masks-bit? this s4-0 s2-0)) - (ocean-trans-add-upload this arg0 s4-0 s2-0) - ) - ) - (+! s2-0 1) + (let ((sv-32 (-> this near-minx)) + (sv-33 (-> this near-maxx)) + (sv-34 (-> this near-minz)) + (sv-35 (-> this near-maxz)) + (sv-36 (new 'stack 'sphere)) + ) + (set! (-> sv-36 y) (-> this start-corner y)) + (set! (-> sv-36 r) 69511.42) + (when (and (< sv-32 sv-33) (< sv-34 sv-35)) + (let ((s4-0 sv-34) + (s3-0 sv-35) ) + (while (>= s3-0 s4-0) + (let ((s2-0 sv-32) + (s1-0 sv-33) + ) + (while (>= s1-0 s2-0) + (set! (-> sv-36 x) (+ 49152.0 (* 98304.0 (the float s2-0)) (-> this start-corner x))) + (set! (-> sv-36 z) (+ 49152.0 (* 98304.0 (the float s4-0)) (-> this start-corner z))) + ;; og:preserve-this + (when (sphere-cull-for-ocean sv-36) + (if (not (ocean-trans-camera-masks-bit? this s4-0 s2-0)) + (ocean-trans-add-upload this arg0 s4-0 s2-0) + ) + ) + (+! s2-0 1) + ) + ) + (+! s4-0 1) ) - (+! s4-0 1) ) ) ) @@ -705,16 +708,6 @@ ) (defmethod draw-ocean-transition ((this ocean) (arg0 dma-buffer)) - (local-vars - (sv-32 uint) - (sv-33 uint) - (sv-34 uint) - (sv-35 uint) - (sv-36 sphere) - (sv-40 ocean-trans-mask) - (sv-44 uint) - (sv-48 int) - ) (dotimes (v1-0 16) (set! (-> this trans-camera-masks v1-0) (the-as ocean-trans-mask 0)) (set! (-> this near-mask-indices v1-0) (the-as uint -1)) @@ -722,125 +715,132 @@ (dotimes (v1-3 64) (set! (-> this trans-mask-ptrs v1-3) (the-as pointer #f)) ) - (set! sv-32 (-> this mid-minx)) - (set! sv-33 (-> this mid-maxx)) - (set! sv-34 (-> this mid-minz)) - (set! sv-35 (-> this mid-maxz)) - (set! sv-36 (new 'stack 'sphere)) - (set! (-> sv-36 y) (-> this start-corner y)) - (set! (-> sv-36 r) 278045.7) - (let ((s4-0 sv-34) - (s3-0 sv-35) + (let ((sv-32 (-> this mid-minx)) + (sv-33 (-> this mid-maxx)) + (sv-34 (-> this mid-minz)) + (sv-35 (-> this mid-maxz)) ) - (while (>= s3-0 s4-0) - (let ((s2-0 sv-32) - (s1-0 sv-33) + (let ((sv-36 (new 'stack 'sphere))) + (set! (-> sv-36 y) (-> this start-corner y)) + (set! (-> sv-36 r) 278045.7) + (let ((s4-0 sv-34) + (s3-0 sv-35) ) - (while (>= s1-0 s2-0) - (when (not (ocean-mid-mask-ptrs-bit? this s4-0 s2-0)) - (when (ocean-mid-camera-masks-bit? this s4-0 s2-0) - (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s2-0)) (-> this start-corner x))) - (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s4-0)) (-> this start-corner z))) - (if (sphere-cull-for-ocean sv-36) ;; modified - (ocean-make-trans-camera-masks this s4-0 s2-0 (- s4-0 sv-34) (- s2-0 sv-32)) - ) - ) - ) - (+! s2-0 1) - ) - ) - (+! s4-0 1) - ) - ) - (let ((a2-3 192) - (a1-7 0) - (a0-11 192) - (v1-33 0) - ) - (let ((a3-1 sv-34) - (t0-1 sv-35) - ) - (while (>= t0-1 a3-1) - (let ((t1-0 sv-32) - (t2-0 sv-33) - ) - (while (>= t2-0 t1-0) - (set! sv-40 (the-as ocean-trans-mask (&-> this trans-camera-masks (+ (* (- a3-1 sv-34) 4) (- t1-0 sv-32))))) - (when (nonzero? (-> sv-40 word)) - (dotimes (t3-10 4) - (let ((t4-4 (-> sv-40 mask t3-10))) - (when (nonzero? t4-4) - (let ((t5-2 (+ (* a3-1 4) t3-10))) - (if (< t5-2 (the-as uint a0-11)) - (set! a0-11 (the-as int t5-2)) - ) - (if (< (the-as uint v1-33) t5-2) - (set! v1-33 (the-as int t5-2)) - ) + (while (>= s3-0 s4-0) + (let ((s2-0 sv-32) + (s1-0 sv-33) + ) + (while (>= s1-0 s2-0) + (when (not (ocean-mid-mask-ptrs-bit? this s4-0 s2-0)) + (when (ocean-mid-camera-masks-bit? this s4-0 s2-0) + (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s2-0)) (-> this start-corner x))) + (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s4-0)) (-> this start-corner z))) + ;; og:preserve-this + (if (sphere-cull-for-ocean sv-36) + (ocean-make-trans-camera-masks this s4-0 s2-0 (- s4-0 sv-34) (- s2-0 sv-32)) ) - (dotimes (t5-3 4) - (when (logtest? t4-4 (ash 1 t5-3)) - (let ((t6-9 (+ (* t1-0 4) t5-3))) - (if (< t6-9 (the-as uint a2-3)) - (set! a2-3 (the-as int t6-9)) - ) - (if (< (the-as uint a1-7) t6-9) - (set! a1-7 (the-as int t6-9)) - ) - ) - ) - ) - ) ) ) + (+! s2-0 1) ) - (+! t1-0 1) ) + (+! s4-0 1) ) - (+! a3-1 1) ) ) - (set! (-> this near-minx) (the-as uint (+ a2-3 -1))) - (set! (-> this near-maxx) (the-as uint (+ a1-7 1))) - (set! (-> this near-minz) (the-as uint (+ a0-11 -1))) - (set! (-> this near-maxz) (the-as uint (+ v1-33 1))) - ) - (dotimes (v1-35 16) - (set! (-> this trans-temp-masks v1-35) (the-as uint (-> this trans-camera-masks v1-35))) - ) - (let ((s4-1 sv-34) - (s3-1 sv-35) - ) - (while (>= s3-1 s4-1) - (let ((s2-1 sv-32) - (s1-1 sv-33) + (let ((a2-3 192) + (a1-7 0) + (a0-11 192) + (v1-33 0) + ) + (let ((a3-1 sv-34) + (t0-1 sv-35) ) - (while (>= s1-1 s2-1) - (when (not (ocean-mid-mask-ptrs-bit? this s4-1 s2-1)) - (when (ocean-mid-camera-masks-bit? this s4-1 s2-1) - (let ((v1-46 (-> this ocean-trans-indices data (+ (* (the-as uint 48) s4-1) s2-1)))) - (when (>= (-> v1-46 parent) 0) - (set! sv-44 (+ (* (- s4-1 sv-34) 4) (- s2-1 sv-32))) - (set! (-> this near-mask-indices sv-44) (the-as uint (-> v1-46 child))) - (let ((s0-0 (-> this ocean-mid-masks data (-> v1-46 parent)))) - (set! sv-48 0) - (while (< sv-48 4) - (let ((t0-2 (-> s0-0 mask sv-48))) - (if (!= t0-2 255) - (ocean-trans-add-upload-strip this arg0 s4-1 s2-1 (the-as int t0-2) (the-as int sv-44) sv-48) + (while (>= t0-1 a3-1) + (let ((t1-0 sv-32) + (t2-0 sv-33) + ) + (while (>= t2-0 t1-0) + (let ((sv-40 (the-as ocean-trans-mask (&-> this trans-camera-masks (+ (* (- a3-1 sv-34) 4) (- t1-0 sv-32)))))) + (when (nonzero? (-> sv-40 word)) + (dotimes (t3-10 4) + (let ((t4-4 (-> sv-40 mask t3-10))) + (when (nonzero? t4-4) + (let ((t5-2 (+ (* a3-1 4) t3-10))) + (if (< t5-2 (the-as uint a0-11)) + (set! a0-11 (the-as int t5-2)) + ) + (if (< (the-as uint v1-33) t5-2) + (set! v1-33 (the-as int t5-2)) + ) + ) + (dotimes (t5-3 4) + (when (logtest? t4-4 (ash 1 t5-3)) + (let ((t6-9 (+ (* t1-0 4) t5-3))) + (if (< t6-9 (the-as uint a2-3)) + (set! a2-3 (the-as int t6-9)) + ) + (if (< (the-as uint a1-7) t6-9) + (set! a1-7 (the-as int t6-9)) + ) + ) ) + ) + ) + ) + ) + ) + ) + (+! t1-0 1) + ) + ) + (+! a3-1 1) + ) + ) + (set! (-> this near-minx) (the-as uint (+ a2-3 -1))) + (set! (-> this near-maxx) (the-as uint (+ a1-7 1))) + (set! (-> this near-minz) (the-as uint (+ a0-11 -1))) + (set! (-> this near-maxz) (the-as uint (+ v1-33 1))) + ) + (dotimes (v1-35 16) + (set! (-> this trans-temp-masks v1-35) (the-as uint (-> this trans-camera-masks v1-35))) + ) + (let ((s4-1 sv-34) + (s3-1 sv-35) + ) + (while (>= s3-1 s4-1) + (let ((s2-1 sv-32) + (s1-1 sv-33) + ) + (while (>= s1-1 s2-1) + (when (not (ocean-mid-mask-ptrs-bit? this s4-1 s2-1)) + (when (ocean-mid-camera-masks-bit? this s4-1 s2-1) + (let ((v1-46 (-> this ocean-trans-indices data (+ (* (the-as uint 48) s4-1) s2-1)))) + (when (>= (-> v1-46 parent) 0) + (let ((sv-44 (+ (* (- s4-1 sv-34) 4) (- s2-1 sv-32)))) + (set! (-> this near-mask-indices sv-44) (the-as uint (-> v1-46 child))) + (let ((s0-0 (-> this ocean-mid-masks data (-> v1-46 parent))) + (sv-48 0) + ) + (while (< sv-48 4) + (let ((t0-2 (-> s0-0 mask sv-48))) + (if (!= t0-2 255) + (ocean-trans-add-upload-strip this arg0 s4-1 s2-1 (the-as int t0-2) (the-as int sv-44) sv-48) + ) + ) + (+! sv-48 1) + ) ) - (set! sv-48 (+ sv-48 1)) ) ) ) ) ) + (+! s2-1 1) ) - (+! s2-1 1) ) + (+! s4-1 1) ) - (+! s4-1 1) ) ) (ocean-mid-add-call-flush this arg0 (the-as uint 41)) diff --git a/goal_src/jak2/engine/gfx/ocean/ocean.gc b/goal_src/jak2/engine/gfx/ocean/ocean.gc index 7b5f45ef3d..dcdbfcf4a0 100644 --- a/goal_src/jak2/engine/gfx/ocean/ocean.gc +++ b/goal_src/jak2/engine/gfx/ocean/ocean.gc @@ -140,7 +140,6 @@ ) (defmethod ocean-method-60 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) ;; og:preserve-this scratchpad (let ((vertices (scratchpad-object (inline-array ocean-vertex)))) (let ((f0-0 (-> this start-corner z))) @@ -155,79 +154,81 @@ (set! (-> vertices 1 pos w) 0.5) (set! (-> vertices 2 pos w) 1.0) (set! (-> vertices 3 pos w) 1.0) - (set! sv-48 (-> this start-corner x)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 (new 'stack-no-clear 'vector)) - (let ((s3-0 (-> this ocean-colors))) - (let ((s2-0 #f)) - (rgba-to-vector! this sv-52 (-> s3-0 colors)) - (dotimes (s1-0 48) - (let ((f0-8 (+ (* 393216.0 (the float s1-0)) sv-48))) - (let ((f1-6 (+ 393216.0 f0-8))) - (set! (-> vertices 0 pos x) f0-8) - (set! (-> vertices 1 pos x) f1-6) - (set! (-> vertices 2 pos x) f1-6) + (let ((sv-48 (-> this start-corner x)) + (sv-52 (new 'stack-no-clear 'vector)) + (sv-56 (new 'stack-no-clear 'vector)) + ) + (let ((s3-0 (-> this ocean-colors))) + (let ((s2-0 #f)) + (rgba-to-vector! this sv-52 (-> s3-0 colors)) + (dotimes (s1-0 48) + (let ((f0-8 (+ (* 393216.0 (the float s1-0)) sv-48))) + (let ((f1-6 (+ 393216.0 f0-8))) + (set! (-> vertices 0 pos x) f0-8) + (set! (-> vertices 1 pos x) f1-6) + (set! (-> vertices 2 pos x) f1-6) + ) + (set! (-> vertices 3 pos x) f0-8) ) - (set! (-> vertices 3 pos x) f0-8) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* (+ s1-0 1) 4))) - (set! (-> vertices 0 col quad) (-> sv-52 quad)) - (set! (-> vertices 1 col quad) (-> sv-56 quad)) - (set! (-> vertices 2 col quad) (-> sv-56 quad)) - (set! (-> vertices 3 col quad) (-> sv-52 quad)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-0 #t) - ) - (else - (if s2-0 - (goto cfg-9) - ) + (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* (+ s1-0 1) 4))) + (set! (-> vertices 0 col quad) (-> sv-52 quad)) + (set! (-> vertices 1 col quad) (-> sv-56 quad)) + (set! (-> vertices 2 col quad) (-> sv-56 quad)) + (set! (-> vertices 3 col quad) (-> sv-52 quad)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-0 #t) + ) + (else + (if s2-0 + (goto cfg-9) + ) + ) ) ) ) ) - ) - (label cfg-9) - (let ((f0-10 (+ -5898240.0 (-> this start-corner z)))) - (let ((f1-9 (+ -5898240.0 f0-10))) - (set! (-> vertices 0 pos z) f1-9) - (set! (-> vertices 1 pos z) f1-9) + (label cfg-9) + (let ((f0-10 (+ -5898240.0 (-> this start-corner z)))) + (let ((f1-9 (+ -5898240.0 f0-10))) + (set! (-> vertices 0 pos z) f1-9) + (set! (-> vertices 1 pos z) f1-9) + ) + (set! (-> vertices 2 pos z) f0-10) + (set! (-> vertices 3 pos z) f0-10) ) - (set! (-> vertices 2 pos z) f0-10) - (set! (-> vertices 3 pos z) f0-10) - ) - (set! (-> vertices 0 pos w) 0.0) - (set! (-> vertices 1 pos w) 0.0) - (set! (-> vertices 2 pos w) 0.5) - (set! (-> vertices 3 pos w) 0.5) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (-> s3-1 colors)) - (dotimes (s1-1 48) - (let ((f0-17 (+ (* 393216.0 (the float s1-1)) sv-48))) - (let ((f1-14 (+ 393216.0 f0-17))) - (set! (-> vertices 0 pos x) f0-17) - (set! (-> vertices 1 pos x) f1-14) - (set! (-> vertices 2 pos x) f1-14) + (set! (-> vertices 0 pos w) 0.0) + (set! (-> vertices 1 pos w) 0.0) + (set! (-> vertices 2 pos w) 0.5) + (set! (-> vertices 3 pos w) 0.5) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (-> s3-1 colors)) + (dotimes (s1-1 48) + (let ((f0-17 (+ (* 393216.0 (the float s1-1)) sv-48))) + (let ((f1-14 (+ 393216.0 f0-17))) + (set! (-> vertices 0 pos x) f0-17) + (set! (-> vertices 1 pos x) f1-14) + (set! (-> vertices 2 pos x) f1-14) + ) + (set! (-> vertices 3 pos x) f0-17) ) - (set! (-> vertices 3 pos x) f0-17) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* (+ s1-1 1) 4))) - (add-colors! this (-> vertices 0 col) (-> vertices 0)) - (add-colors! this (-> vertices 1 col) (-> vertices 1)) - (set! (-> vertices 2 col quad) (-> sv-56 quad)) - (set! (-> vertices 3 col quad) (-> sv-52 quad)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-1 #t) - ) - (else - (if s2-1 - (goto cfg-18) - ) + (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* (+ s1-1 1) 4))) + (add-colors! this (-> vertices 0 col) (-> vertices 0)) + (add-colors! this (-> vertices 1 col) (-> vertices 1)) + (set! (-> vertices 2 col quad) (-> sv-56 quad)) + (set! (-> vertices 3 col quad) (-> sv-52 quad)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) @@ -240,7 +241,6 @@ ) (defmethod ocean-method-61 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) ;; og:preserve-this scratchpad (let ((vertices (scratchpad-object (inline-array ocean-vertex)))) (let* ((f0-1 (+ 18874368.0 (-> this start-corner z))) @@ -255,79 +255,81 @@ (set! (-> vertices 1 pos w) 1.0) (set! (-> vertices 2 pos w) 0.5) (set! (-> vertices 3 pos w) 0.5) - (set! sv-48 (-> this start-corner x)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 (new 'stack-no-clear 'vector)) - (let ((s3-0 (-> this ocean-colors))) - (let ((s2-0 #f)) - (rgba-to-vector! this sv-52 (&-> s3-0 colors 2444)) - (dotimes (s1-0 48) - (let ((f0-9 (+ (* 393216.0 (the float s1-0)) sv-48))) - (let ((f1-7 (+ 393216.0 f0-9))) - (set! (-> vertices 0 pos x) f0-9) - (set! (-> vertices 1 pos x) f1-7) - (set! (-> vertices 2 pos x) f1-7) + (let ((sv-48 (-> this start-corner x)) + (sv-52 (new 'stack-no-clear 'vector)) + (sv-56 (new 'stack-no-clear 'vector)) + ) + (let ((s3-0 (-> this ocean-colors))) + (let ((s2-0 #f)) + (rgba-to-vector! this sv-52 (&-> s3-0 colors 2444)) + (dotimes (s1-0 48) + (let ((f0-9 (+ (* 393216.0 (the float s1-0)) sv-48))) + (let ((f1-7 (+ 393216.0 f0-9))) + (set! (-> vertices 0 pos x) f0-9) + (set! (-> vertices 1 pos x) f1-7) + (set! (-> vertices 2 pos x) f1-7) + ) + (set! (-> vertices 3 pos x) f0-9) ) - (set! (-> vertices 3 pos x) f0-9) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* (+ s1-0 2445) 4))) - (set! (-> vertices 0 col quad) (-> sv-52 quad)) - (set! (-> vertices 1 col quad) (-> sv-56 quad)) - (set! (-> vertices 2 col quad) (-> sv-56 quad)) - (set! (-> vertices 3 col quad) (-> sv-52 quad)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-0 #t) - ) - (else - (if s2-0 - (goto cfg-9) - ) + (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* (+ s1-0 2445) 4))) + (set! (-> vertices 0 col quad) (-> sv-52 quad)) + (set! (-> vertices 1 col quad) (-> sv-56 quad)) + (set! (-> vertices 2 col quad) (-> sv-56 quad)) + (set! (-> vertices 3 col quad) (-> sv-52 quad)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-0 #t) + ) + (else + (if s2-0 + (goto cfg-9) + ) + ) ) ) ) ) - ) - (label cfg-9) - (let* ((f0-11 (+ 24772608.0 (-> this start-corner z))) - (f1-10 (+ 5898240.0 f0-11)) - ) - (set! (-> vertices 0 pos z) f0-11) - (set! (-> vertices 1 pos z) f0-11) - (set! (-> vertices 2 pos z) f1-10) - (set! (-> vertices 3 pos z) f1-10) - ) - (set! (-> vertices 0 pos w) 0.5) - (set! (-> vertices 1 pos w) 0.5) - (set! (-> vertices 2 pos w) 0.0) - (set! (-> vertices 3 pos w) 0.0) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (&-> s3-1 colors 2444)) - (dotimes (s1-1 48) - (let ((f0-18 (+ (* 393216.0 (the float s1-1)) sv-48))) - (let ((f1-15 (+ 393216.0 f0-18))) - (set! (-> vertices 0 pos x) f0-18) - (set! (-> vertices 1 pos x) f1-15) - (set! (-> vertices 2 pos x) f1-15) - ) - (set! (-> vertices 3 pos x) f0-18) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* (+ s1-1 2445) 4))) - (set! (-> vertices 0 col quad) (-> sv-52 quad)) - (set! (-> vertices 1 col quad) (-> sv-56 quad)) - (add-colors! this (-> vertices 2 col) (-> vertices 2)) - (add-colors! this (-> vertices 3 col) (-> vertices 3)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-1 #t) + (label cfg-9) + (let* ((f0-11 (+ 24772608.0 (-> this start-corner z))) + (f1-10 (+ 5898240.0 f0-11)) ) - (else - (if s2-1 - (goto cfg-18) - ) + (set! (-> vertices 0 pos z) f0-11) + (set! (-> vertices 1 pos z) f0-11) + (set! (-> vertices 2 pos z) f1-10) + (set! (-> vertices 3 pos z) f1-10) + ) + (set! (-> vertices 0 pos w) 0.5) + (set! (-> vertices 1 pos w) 0.5) + (set! (-> vertices 2 pos w) 0.0) + (set! (-> vertices 3 pos w) 0.0) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (&-> s3-1 colors 2444)) + (dotimes (s1-1 48) + (let ((f0-18 (+ (* 393216.0 (the float s1-1)) sv-48))) + (let ((f1-15 (+ 393216.0 f0-18))) + (set! (-> vertices 0 pos x) f0-18) + (set! (-> vertices 1 pos x) f1-15) + (set! (-> vertices 2 pos x) f1-15) + ) + (set! (-> vertices 3 pos x) f0-18) + ) + (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* (+ s1-1 2445) 4))) + (set! (-> vertices 0 col quad) (-> sv-52 quad)) + (set! (-> vertices 1 col quad) (-> sv-56 quad)) + (add-colors! this (-> vertices 2 col) (-> vertices 2)) + (add-colors! this (-> vertices 3 col) (-> vertices 3)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) @@ -340,7 +342,6 @@ ) (defmethod ocean-method-62 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) ;; og:preserve-this scratchpad (let ((vertices (scratchpad-object (inline-array ocean-vertex)))) (let* ((f0-0 (-> this start-corner x)) @@ -355,79 +356,81 @@ (set! (-> vertices 1 pos w) 1.0) (set! (-> vertices 2 pos w) 1.0) (set! (-> vertices 3 pos w) 0.5) - (set! sv-48 (-> this start-corner z)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 (new 'stack-no-clear 'vector)) - (let ((s3-0 (-> this ocean-colors))) - (let ((s2-0 #f)) - (rgba-to-vector! this sv-52 (-> s3-0 colors)) - (dotimes (s1-0 48) - (let* ((f0-8 (+ (* 393216.0 (the float s1-0)) sv-48)) - (f1-6 (+ 393216.0 f0-8)) - ) - (set! (-> vertices 0 pos z) f0-8) - (set! (-> vertices 1 pos z) f0-8) - (set! (-> vertices 2 pos z) f1-6) - (set! (-> vertices 3 pos z) f1-6) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* 208 (+ s1-0 1)))) - (set! (-> vertices 0 col quad) (-> sv-52 quad)) - (set! (-> vertices 1 col quad) (-> sv-52 quad)) - (set! (-> vertices 2 col quad) (-> sv-56 quad)) - (set! (-> vertices 3 col quad) (-> sv-56 quad)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-0 #t) - ) - (else - (if s2-0 - (goto cfg-9) - ) + (let ((sv-48 (-> this start-corner z)) + (sv-52 (new 'stack-no-clear 'vector)) + (sv-56 (new 'stack-no-clear 'vector)) + ) + (let ((s3-0 (-> this ocean-colors))) + (let ((s2-0 #f)) + (rgba-to-vector! this sv-52 (-> s3-0 colors)) + (dotimes (s1-0 48) + (let* ((f0-8 (+ (* 393216.0 (the float s1-0)) sv-48)) + (f1-6 (+ 393216.0 f0-8)) + ) + (set! (-> vertices 0 pos z) f0-8) + (set! (-> vertices 1 pos z) f0-8) + (set! (-> vertices 2 pos z) f1-6) + (set! (-> vertices 3 pos z) f1-6) + ) + (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* 208 (+ s1-0 1)))) + (set! (-> vertices 0 col quad) (-> sv-52 quad)) + (set! (-> vertices 1 col quad) (-> sv-52 quad)) + (set! (-> vertices 2 col quad) (-> sv-56 quad)) + (set! (-> vertices 3 col quad) (-> sv-56 quad)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-0 #t) + ) + (else + (if s2-0 + (goto cfg-9) + ) + ) ) ) ) ) - ) - (label cfg-9) - (let* ((f0-10 (+ -5898240.0 (-> this start-corner x))) - (f1-9 (+ -5898240.0 f0-10)) - ) - (set! (-> vertices 0 pos x) f1-9) - (set! (-> vertices 1 pos x) f0-10) - (set! (-> vertices 2 pos x) f0-10) - (set! (-> vertices 3 pos x) f1-9) - ) - (set! (-> vertices 0 pos w) 0.0) - (set! (-> vertices 1 pos w) 0.5) - (set! (-> vertices 2 pos w) 0.5) - (set! (-> vertices 3 pos w) 0.0) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (-> s3-1 colors)) - (dotimes (s1-1 48) - (let* ((f0-17 (+ (* 393216.0 (the float s1-1)) sv-48)) - (f1-14 (+ 393216.0 f0-17)) - ) - (set! (-> vertices 0 pos z) f0-17) - (set! (-> vertices 1 pos z) f0-17) - (set! (-> vertices 2 pos z) f1-14) - (set! (-> vertices 3 pos z) f1-14) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* 208 (+ s1-1 1)))) - (add-colors! this (-> vertices 0 col) (-> vertices 0)) - (set! (-> vertices 1 col quad) (-> sv-52 quad)) - (set! (-> vertices 2 col quad) (-> sv-56 quad)) - (add-colors! this (-> vertices 3 col) (-> vertices 3)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-1 #t) + (label cfg-9) + (let* ((f0-10 (+ -5898240.0 (-> this start-corner x))) + (f1-9 (+ -5898240.0 f0-10)) ) - (else - (if s2-1 - (goto cfg-18) - ) + (set! (-> vertices 0 pos x) f1-9) + (set! (-> vertices 1 pos x) f0-10) + (set! (-> vertices 2 pos x) f0-10) + (set! (-> vertices 3 pos x) f1-9) + ) + (set! (-> vertices 0 pos w) 0.0) + (set! (-> vertices 1 pos w) 0.5) + (set! (-> vertices 2 pos w) 0.5) + (set! (-> vertices 3 pos w) 0.0) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (-> s3-1 colors)) + (dotimes (s1-1 48) + (let* ((f0-17 (+ (* 393216.0 (the float s1-1)) sv-48)) + (f1-14 (+ 393216.0 f0-17)) + ) + (set! (-> vertices 0 pos z) f0-17) + (set! (-> vertices 1 pos z) f0-17) + (set! (-> vertices 2 pos z) f1-14) + (set! (-> vertices 3 pos z) f1-14) + ) + (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* 208 (+ s1-1 1)))) + (add-colors! this (-> vertices 0 col) (-> vertices 0)) + (set! (-> vertices 1 col quad) (-> sv-52 quad)) + (set! (-> vertices 2 col quad) (-> sv-56 quad)) + (add-colors! this (-> vertices 3 col) (-> vertices 3)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) @@ -440,7 +443,6 @@ ) (defmethod ocean-method-63 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) ;; og:preserve-this scratchpad (let ((vertices (scratchpad-object (inline-array ocean-vertex)))) (let ((f0-1 (+ 18874368.0 (-> this start-corner x)))) @@ -455,79 +457,81 @@ (set! (-> vertices 1 pos w) 0.5) (set! (-> vertices 2 pos w) 0.5) (set! (-> vertices 3 pos w) 1.0) - (set! sv-48 (-> this start-corner z)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 (new 'stack-no-clear 'vector)) - (let ((s3-0 (-> this ocean-colors))) - (let ((s2-0 #f)) - (rgba-to-vector! this sv-52 (&-> s3-0 colors 47)) - (dotimes (s1-0 48) - (let* ((f0-9 (+ (* 393216.0 (the float s1-0)) sv-48)) - (f1-7 (+ 393216.0 f0-9)) - ) - (set! (-> vertices 0 pos z) f0-9) - (set! (-> vertices 1 pos z) f0-9) - (set! (-> vertices 2 pos z) f1-7) - (set! (-> vertices 3 pos z) f1-7) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* (+ (* 52 (+ s1-0 1)) 47) 4))) - (set! (-> vertices 0 col quad) (-> sv-52 quad)) - (set! (-> vertices 1 col quad) (-> sv-52 quad)) - (set! (-> vertices 2 col quad) (-> sv-56 quad)) - (set! (-> vertices 3 col quad) (-> sv-56 quad)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-0 #t) - ) - (else - (if s2-0 - (goto cfg-9) - ) + (let ((sv-48 (-> this start-corner z)) + (sv-52 (new 'stack-no-clear 'vector)) + (sv-56 (new 'stack-no-clear 'vector)) + ) + (let ((s3-0 (-> this ocean-colors))) + (let ((s2-0 #f)) + (rgba-to-vector! this sv-52 (&-> s3-0 colors 47)) + (dotimes (s1-0 48) + (let* ((f0-9 (+ (* 393216.0 (the float s1-0)) sv-48)) + (f1-7 (+ 393216.0 f0-9)) + ) + (set! (-> vertices 0 pos z) f0-9) + (set! (-> vertices 1 pos z) f0-9) + (set! (-> vertices 2 pos z) f1-7) + (set! (-> vertices 3 pos z) f1-7) + ) + (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* (+ (* 52 (+ s1-0 1)) 47) 4))) + (set! (-> vertices 0 col quad) (-> sv-52 quad)) + (set! (-> vertices 1 col quad) (-> sv-52 quad)) + (set! (-> vertices 2 col quad) (-> sv-56 quad)) + (set! (-> vertices 3 col quad) (-> sv-56 quad)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-0 #t) + ) + (else + (if s2-0 + (goto cfg-9) + ) + ) ) ) ) ) - ) - (label cfg-9) - (let ((f0-11 (+ 24772608.0 (-> this start-corner x)))) - (let ((f1-10 (+ 5898240.0 f0-11))) - (set! (-> vertices 0 pos x) f0-11) - (set! (-> vertices 1 pos x) f1-10) - (set! (-> vertices 2 pos x) f1-10) + (label cfg-9) + (let ((f0-11 (+ 24772608.0 (-> this start-corner x)))) + (let ((f1-10 (+ 5898240.0 f0-11))) + (set! (-> vertices 0 pos x) f0-11) + (set! (-> vertices 1 pos x) f1-10) + (set! (-> vertices 2 pos x) f1-10) + ) + (set! (-> vertices 3 pos x) f0-11) ) - (set! (-> vertices 3 pos x) f0-11) - ) - (set! (-> vertices 0 pos w) 0.5) - (set! (-> vertices 1 pos w) 0.0) - (set! (-> vertices 2 pos w) 0.0) - (set! (-> vertices 3 pos w) 0.5) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (&-> s3-1 colors 47)) - (dotimes (s1-1 48) - (let* ((f0-18 (+ (* 393216.0 (the float s1-1)) sv-48)) - (f1-15 (+ 393216.0 f0-18)) - ) - (set! (-> vertices 0 pos z) f0-18) - (set! (-> vertices 1 pos z) f0-18) - (set! (-> vertices 2 pos z) f1-15) - (set! (-> vertices 3 pos z) f1-15) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* (+ (* 52 (+ s1-1 1)) 47) 4))) - (set! (-> vertices 0 col quad) (-> sv-52 quad)) - (add-colors! this (-> vertices 1 col) (-> vertices 1)) - (add-colors! this (-> vertices 2 col) (-> vertices 2)) - (set! (-> vertices 3 col quad) (-> sv-56 quad)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-1 #t) - ) - (else - (if s2-1 - (goto cfg-18) - ) + (set! (-> vertices 0 pos w) 0.5) + (set! (-> vertices 1 pos w) 0.0) + (set! (-> vertices 2 pos w) 0.0) + (set! (-> vertices 3 pos w) 0.5) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (&-> s3-1 colors 47)) + (dotimes (s1-1 48) + (let* ((f0-18 (+ (* 393216.0 (the float s1-1)) sv-48)) + (f1-15 (+ 393216.0 f0-18)) + ) + (set! (-> vertices 0 pos z) f0-18) + (set! (-> vertices 1 pos z) f0-18) + (set! (-> vertices 2 pos z) f1-15) + (set! (-> vertices 3 pos z) f1-15) + ) + (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* (+ (* 52 (+ s1-1 1)) 47) 4))) + (set! (-> vertices 0 col quad) (-> sv-52 quad)) + (add-colors! this (-> vertices 1 col) (-> vertices 1)) + (add-colors! this (-> vertices 2 col) (-> vertices 2)) + (set! (-> vertices 3 col quad) (-> sv-56 quad)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) diff --git a/goal_src/jak2/engine/gfx/sprite/sprite-distort.gc b/goal_src/jak2/engine/gfx/sprite/sprite-distort.gc index 97c8002a9f..c2d480e409 100644 --- a/goal_src/jak2/engine/gfx/sprite/sprite-distort.gc +++ b/goal_src/jak2/engine/gfx/sprite/sprite-distort.gc @@ -194,15 +194,7 @@ across the screen. The resolution of the circle is defined by the number of "tur ;; - Sprites are uploaded in chunks of 85. ;; - For every 2 chunks, a call into the VU program is added. (defun sprite-draw-distorters ((dma-buff dma-buffer)) - (local-vars - (v1-15 float) - (v1-21 float) - (clip-result int) - (v1-63 float) - (sprite sprite-vec-data-2d) - (dma-st-flag pointer) - (dma-color pointer) - ) + (local-vars (v1-15 float) (v1-21 float) (clip-result int) (v1-63 float)) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -229,10 +221,11 @@ across the screen. The resolution of the circle is defined by the number of "tur (dotimes (i num-entries) (let ((aux-elem (-> s3-0 data i))) (when (= (-> aux-elem aux-type) (sprite-aux-type distort)) - (set! sprite (-> aux-elem vec-data)) - (let ((dma-position (the-as object (-> dma-buff base)))) - (set! dma-st-flag (&+ (the-as pointer dma-position) 16)) - (set! dma-color (&+ (the-as pointer dma-position) 32)) + (let* ((sprite (-> aux-elem vec-data)) + (dma-position (the-as object (-> dma-buff base))) + (dma-st-flag (&+ (the-as pointer dma-position) 16)) + (dma-color (&+ (the-as pointer dma-position) 32)) + ) (cond ((= (the-as int (-> sprite flag-rot-sy y)) 1) (.lvf vf3 (&-> *math-camera* sprite-2d quad 0)) @@ -273,32 +266,32 @@ across the screen. The resolution of the circle is defined by the number of "tur (set! (-> (the-as vector dma-position) w) 255.0) (set! (-> (the-as vector dma-st-flag) x) (* 0.001953125 (+ -1792.0 (-> (the-as vector dma-position) x)))) (set! (-> (the-as vector dma-st-flag) y) (* 0.001953125 (+ -1840.0 (-> (the-as vector dma-position) y)))) - ) - (set! (-> (the-as vector dma-st-flag) z) 1.0) - (when (or (< (the-as int (-> sprite flag-rot-sy x)) 3) (< 11 (the-as int (-> sprite flag-rot-sy x)))) - (format 0 "Turns = ~D!!!~%" (-> sprite flag-rot-sy x)) - (set! (-> sprite flag-rot-sy x) (the-as float #xb)) - ) - (set! (-> (the-as (pointer int32) dma-st-flag) 3) (the-as int (-> sprite flag-rot-sy x))) - (let* ((f1-4 (- (-> *math-camera* perspective vector 1 y))) - (f2-2 (-> (the-as vector dma-st-flag) y)) - (f4-0 (+ f2-2 (* (-> (the-as vector dma-color) x) f1-4))) - (f3-0 256.0) - (f0-9 (-> (the-as vector dma-color) x)) - ) - (if (< 416.0 f4-0) - (set! f3-0 (/ (- 416.0 f2-2) f1-4)) + (set! (-> (the-as vector dma-st-flag) z) 1.0) + (when (or (< (the-as int (-> sprite flag-rot-sy x)) 3) (< 11 (the-as int (-> sprite flag-rot-sy x)))) + (format 0 "Turns = ~D!!!~%" (-> sprite flag-rot-sy x)) + (set! (-> sprite flag-rot-sy x) (the-as float #xb)) + ) + (set! (-> (the-as (pointer int32) dma-st-flag) 3) (the-as int (-> sprite flag-rot-sy x))) + (let* ((f1-4 (- (-> *math-camera* perspective vector 1 y))) + (f2-2 (-> (the-as vector dma-st-flag) y)) + (f4-0 (+ f2-2 (* (-> (the-as vector dma-color) x) f1-4))) + (f3-0 256.0) + (f0-9 (-> (the-as vector dma-color) x)) + ) + (if (< 416.0 f4-0) + (set! f3-0 (/ (- 416.0 f2-2) f1-4)) + ) + (if (< 128.0 f3-0) + (set! f3-0 128.0) + ) + (when (< f3-0 f0-9) + (let ((v1-61 (/ f3-0 f0-9))) + (.mov vf1 v1-61) + ) + (.mul.x.vf vf2 vf2 vf1) + (.svf (&-> (the-as vector dma-color) quad) vf2) + (.mov v1-63 vf2) ) - (if (< 128.0 f3-0) - (set! f3-0 128.0) - ) - (when (< f3-0 f0-9) - (let ((v1-61 (/ f3-0 f0-9))) - (.mov vf1 v1-61) - ) - (.mul.x.vf vf2 vf2 vf1) - (.svf (&-> (the-as vector dma-color) quad) vf2) - (.mov v1-63 vf2) ) ) (&+! (-> dma-buff base) 48) diff --git a/goal_src/jak2/engine/gfx/sprite/sprite-glow.gc b/goal_src/jak2/engine/gfx/sprite/sprite-glow.gc index cdeb2581d8..de9cda8e5d 100644 --- a/goal_src/jak2/engine/gfx/sprite/sprite-glow.gc +++ b/goal_src/jak2/engine/gfx/sprite/sprite-glow.gc @@ -601,29 +601,31 @@ ) (defmethod draw-all-sprites! ((this simple-sprite-system) (arg0 dma-buffer)) - (local-vars (sv-528 sprite-glow-dma-packet-data) (sv-532 (pointer texture-id)) (sv-536 pointer)) (b! (zero? (-> this count)) cfg-13 :delay (nop!)) - (set! sv-528 *sprite-glow-dma-packet-data*) - (set! sv-532 (new 'stack-no-clear 'array 'texture-id 128)) - (set! sv-536 (-> arg0 base)) - ;; og:preserve-this - (when (> (-> this count) 128) - (format 0 "TOO MANY SPRITES (~D)~%" (-> this count)) - (break!) - ) - (dotimes (v1-5 (-> this count)) - (set! (-> sv-532 v1-5) (-> this data v1-5 tex-id)) - ) - (countdown (s4-0 (-> this count)) - (let ((s3-0 (-> sv-532 s4-0))) - (when (nonzero? s3-0) - (let ((s2-0 (add-shader-to-dma arg0))) - (adgif-shader<-texture-simple! s2-0 (lookup-texture-by-id s3-0)) - (countdown (s1-1 (+ s4-0 1)) - (when (= s3-0 (-> sv-532 s1-1)) - (set! (-> sv-532 s1-1) (new 'static 'texture-id)) - (let ((a2-1 (-> this data s1-1))) - (sprite-glow-add-simple-sprite arg0 sv-528 a2-1 (the-as pointer s2-0)) + (let ((sv-528 *sprite-glow-dma-packet-data*) + (sv-532 (new 'stack-no-clear 'array 'texture-id 128)) + ) + (let ((sv-536 (-> arg0 base))) + ) + ;; og:preserve-this + (when (> (-> this count) 128) + (format 0 "simple-sprite-system::draw-all-sprites!: TOO MANY SPRITES (~D)~%" (-> this count)) + (break!) + ) + (dotimes (v1-5 (-> this count)) + (set! (-> sv-532 v1-5) (-> this data v1-5 tex-id)) + ) + (countdown (s4-0 (-> this count)) + (let ((s3-0 (-> sv-532 s4-0))) + (when (nonzero? s3-0) + (let ((s2-0 (add-shader-to-dma arg0))) + (adgif-shader<-texture-simple! s2-0 (lookup-texture-by-id s3-0)) + (countdown (s1-1 (+ s4-0 1)) + (when (= s3-0 (-> sv-532 s1-1)) + (set! (-> sv-532 s1-1) (new 'static 'texture-id)) + (let ((a2-1 (-> this data s1-1))) + (sprite-glow-add-simple-sprite arg0 sv-528 a2-1 (the-as pointer s2-0)) + ) ) ) ) diff --git a/goal_src/jak2/engine/level/region.gc b/goal_src/jak2/engine/level/region.gc index 578ed7b95e..ba1d70b9df 100644 --- a/goal_src/jak2/engine/level/region.gc +++ b/goal_src/jak2/engine/level/region.gc @@ -8,29 +8,29 @@ ;; DECOMP BEGINS ;; WARN: Return type mismatch int vs drawable-region-prim. -(defmethod mem-usage ((this drawable-region-prim) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 50 (-> arg0 length))) - (set! (-> arg0 data 49 name) "region") - (+! (-> arg0 data 49 count) 1) +(defmethod mem-usage ((this drawable-region-prim) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 50 (-> usage length))) + (set! (-> usage data 49 name) "region") + (+! (-> usage data 49 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 49 used) v1-6) - (+! (-> arg0 data 49 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 49 used) v1-6) + (+! (-> usage data 49 total) (logand -16 (+ v1-6 15))) ) - (mem-usage (-> this region) arg0 (logior arg1 128)) + (mem-usage (-> this region) usage (logior flags 128)) (the-as drawable-region-prim 0) ) ;; WARN: Return type mismatch int vs drawable-inline-array-region-prim. -(defmethod mem-usage ((this drawable-inline-array-region-prim) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 1 (-> arg0 length))) - (set! (-> arg0 data 0 name) (symbol->string 'drawable-group)) - (+! (-> arg0 data 0 count) 1) +(defmethod mem-usage ((this drawable-inline-array-region-prim) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 1 (-> usage length))) + (set! (-> usage data 0 name) (symbol->string 'drawable-group)) + (+! (-> usage data 0 count) 1) (let ((v1-7 32)) - (+! (-> arg0 data 0 used) v1-7) - (+! (-> arg0 data 0 total) (logand -16 (+ v1-7 15))) + (+! (-> usage data 0 used) v1-7) + (+! (-> usage data 0 total) (logand -16 (+ v1-7 15))) ) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) + (mem-usage (-> this data s3-0) usage flags) ) (the-as drawable-inline-array-region-prim 0) ) @@ -45,11 +45,11 @@ ) (defmethod collect-regions ((this drawable-region-prim) (area-of-interest sphere) (_count int) (region-list region-prim-list)) - "Determines the number of [[drawable]]s in the `this` that overlap the given `area-of-interest` this number is stored in the `region-list`'s item count -@param area-of-interest The area defined by a sphere that we care about overlaps -@param _count The amount of [[drawable]]s in the object to enumerate through -@param! region-list Stores the overlapping regions and a count for how many were found -@returns none" + "Determines the number of [[drawable]]s in the `obj` that overlap the given `area-of-interest` this number is stored in the `region-list`'s item count + @param area-of-interest The area defined by a sphere that we care about overlaps + @param _count The amount of [[drawable]]s in the object to enumerate through + @param! region-list Stores the overlapping regions and a count for how many were found + @returns none" (dotimes (count _count) (when (spheres-overlap? area-of-interest (the-as sphere (-> this bsphere))) (set! (-> region-list items (-> region-list num-items)) this) @@ -62,80 +62,83 @@ ) (defmethod collect-regions ((this drawable-inline-array-region-prim) (arg0 sphere) (arg1 int) (arg2 region-prim-list)) - "Determines the number of [[drawable]]s in the `this` that overlap the given `area-of-interest` this number is stored in the `region-list`'s item count -@param area-of-interest The area defined by a sphere that we care about overlaps -@param _count The amount of [[drawable]]s in the object to enumerate through -@param! region-list Stores the overlapping regions and a count for how many were found -@returns none" + "Determines the number of [[drawable]]s in the `obj` that overlap the given `area-of-interest` this number is stored in the `region-list`'s item count + @param area-of-interest The area defined by a sphere that we care about overlaps + @param _count The amount of [[drawable]]s in the object to enumerate through + @param! region-list Stores the overlapping regions and a count for how many were found + @returns none" (collect-regions (the-as drawable-region-prim (-> this data)) arg0 (-> this length) arg2) 0 (none) ) (defmethod collect-regions ((this drawable-tree-region-prim) (arg0 sphere) (arg1 int) (arg2 region-prim-list)) - "Determines the number of [[drawable]]s in the `this` that overlap the given `area-of-interest` this number is stored in the `region-list`'s item count -@param area-of-interest The area defined by a sphere that we care about overlaps -@param _count The amount of [[drawable]]s in the object to enumerate through -@param! region-list Stores the overlapping regions and a count for how many were found -@returns none" + "Determines the number of [[drawable]]s in the `obj` that overlap the given `area-of-interest` this number is stored in the `region-list`'s item count + @param area-of-interest The area defined by a sphere that we care about overlaps + @param _count The amount of [[drawable]]s in the object to enumerate through + @param! region-list Stores the overlapping regions and a count for how many were found + @returns none" (collect-regions (-> this data2 0) arg0 (-> this length) arg2) 0 (none) ) (defmethod debug-draw-region ((this drawable-region-prim) (arg0 int)) + ;; og:preserve-this (#when PC_PORT (when (and *debug-region-hide-empty* (nonzero? (-> this region)) (not (or (-> this region on-enter) (-> this region on-exit) (-> this region on-inside)))) ;; no scripts to run means the region is "empty" so do not render (unless enabled) (return 0))) - (local-vars (sv-32 vector2h) (sv-36 vector)) - (set! sv-32 (new 'stack 'vector2h)) - (set! sv-36 (-> this bsphere)) - (add-debug-x #t (bucket-id debug-no-zbuf1) sv-36 (#if PC_PORT (if *debug-region-color-alt* (static-rgba #x00 #xff #x00 #x80) (new 'static 'rgba :r #xff :g #xff :a #x80)) - (new 'static 'rgba :r #xff :g #xff :a #x80))) - (when (nonzero? (-> this region)) - (let ((s5-0 add-debug-text-3d) - (s4-0 #t) - (s3-0 (bucket-id debug-no-zbuf1)) - ) - (format (clear *temp-string*) "region-~D~%" (-> this region id)) - (s5-0 s4-0 (the-as bucket-id s3-0) *temp-string* sv-36 (font-color white) sv-32) - ) - (+! (-> sv-32 y) 8) - (let ((s5-1 (-> this region on-enter))) - (when s5-1 - (let ((s4-1 add-debug-text-3d) - (s3-1 #t) - (s2-1 (bucket-id debug-no-zbuf1)) - ) - (format (clear *temp-string*) "(on-enter ~S)" s5-1) - (s4-1 s3-1 (the-as bucket-id s2-1) *temp-string* sv-36 (font-color white) sv-32) - ) - (+! (-> sv-32 y) 8) + (let ((sv-32 (new 'stack 'vector2h)) + (sv-36 (-> this bsphere)) ) - ) - (let ((s5-2 (-> this region on-inside))) - (when s5-2 - (let ((s4-2 add-debug-text-3d) - (s3-2 #t) - (s2-2 (bucket-id debug-no-zbuf1)) - ) - (format (clear *temp-string*) "(on-inside ~S)" s5-2) - (s4-2 s3-2 (the-as bucket-id s2-2) *temp-string* sv-36 (font-color white) sv-32) - ) - (+! (-> sv-32 y) 8) + ;; og:preserve-this + (add-debug-x #t (bucket-id debug-no-zbuf1) sv-36 (#if PC_PORT (if *debug-region-color-alt* (static-rgba #x00 #xff #x00 #x80) (new 'static 'rgba :r #xff :g #xff :a #x80)) + (new 'static 'rgba :r #xff :g #xff :a #x80))) + (when (nonzero? (-> this region)) + (let ((s5-0 add-debug-text-3d) + (s4-0 #t) + (s3-0 (bucket-id debug-no-zbuf1)) + ) + (format (clear *temp-string*) "region-~D~%" (-> this region id)) + (s5-0 s4-0 (the-as bucket-id s3-0) *temp-string* sv-36 (font-color white) sv-32) ) - ) - (let ((gp-1 (-> this region on-exit))) - (when gp-1 - (let ((s5-3 add-debug-text-3d) - (s4-3 #t) - (s3-3 (bucket-id debug-no-zbuf1)) - ) - (format (clear *temp-string*) "(on-exit ~S)" gp-1) - (s5-3 s4-3 (the-as bucket-id s3-3) *temp-string* sv-36 (font-color white) sv-32) + (+! (-> sv-32 y) 8) + (let ((s5-1 (-> this region on-enter))) + (when s5-1 + (let ((s4-1 add-debug-text-3d) + (s3-1 #t) + (s2-1 (bucket-id debug-no-zbuf1)) + ) + (format (clear *temp-string*) "(on-enter ~S)" s5-1) + (s4-1 s3-1 (the-as bucket-id s2-1) *temp-string* sv-36 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) + ) + ) + (let ((s5-2 (-> this region on-inside))) + (when s5-2 + (let ((s4-2 add-debug-text-3d) + (s3-2 #t) + (s2-2 (bucket-id debug-no-zbuf1)) + ) + (format (clear *temp-string*) "(on-inside ~S)" s5-2) + (s4-2 s3-2 (the-as bucket-id s2-2) *temp-string* sv-36 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) + ) + ) + (let ((gp-1 (-> this region on-exit))) + (when gp-1 + (let ((s5-3 add-debug-text-3d) + (s4-3 #t) + (s3-3 (bucket-id debug-no-zbuf1)) + ) + (format (clear *temp-string*) "(on-exit ~S)" gp-1) + (s5-3 s4-3 (the-as bucket-id s3-3) *temp-string* sv-36 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) ) - (+! (-> sv-32 y) 8) ) ) ) @@ -156,10 +159,10 @@ ;; WARN: Function (method 9 region-prim-area) has a return type of none, but the expression builder found a return statement. (defmethod track-entered-region! ((this region-prim-area) (region-sphere drawable-region-sphere)) "Enumerates through the objects `region-enter-list`, if we find the provided `region`, do nothing and exit -otherwise, add the [[drawable-region-sphere]] to `region-enter-prim-list` and increment `region-enter-count` - -@param region-sphere Defines the region in question -@returns nothing" + otherwise, add the [[drawable-region-sphere]] to `region-enter-prim-list` and increment `region-enter-count` + + @param region-sphere Defines the region in question + @returns nothing" (let ((regions-entered (-> this region-enter-count))) (let ((region (-> region-sphere region))) (countdown (idx regions-entered) @@ -179,10 +182,10 @@ otherwise, add the [[drawable-region-sphere]] to `region-enter-prim-list` and in ;; WARN: Function (method 10 region-prim-area) has a return type of none, but the expression builder found a return statement. (defmethod track-exited-region! ((this region-prim-area) (arg0 drawable-region-sphere)) "Enumerates through the objects `region-exit-list`, if we find the provided `region`, do nothing and exit -otherwise, add the [[drawable-region-sphere]] to `region-exit-prim-list` and increment `region-exit-count` - -@param region-sphere Defines the region in question -@returns nothing" + otherwise, add the [[drawable-region-sphere]] to `region-exit-prim-list` and increment `region-exit-count` + + @param region-sphere Defines the region in question + @returns nothing" (let ((regions-exited (-> this region-exit-count))) (let ((region (-> arg0 region))) (countdown (idx regions-exited) @@ -202,10 +205,10 @@ otherwise, add the [[drawable-region-sphere]] to `region-exit-prim-list` and inc ;; WARN: Function (method 11 region-prim-area) has a return type of none, but the expression builder found a return statement. (defmethod track-inside-region! ((this region-prim-area) (arg0 drawable-region-sphere)) "Enumerates through the objects `region-inside-list`, if we find the provided `region`, do nothing and exit -otherwise, add the [[drawable-region-sphere]] to `region-inside-prim-list` and increment `region-inside-count` - -@param region-sphere Defines the region in question -@returns nothing" + otherwise, add the [[drawable-region-sphere]] to `region-inside-prim-list` and increment `region-inside-count` + + @param region-sphere Defines the region in question + @returns nothing" (let ((regions-inside (-> this region-inside-count))) (let ((region (-> arg0 region))) (countdown (idx regions-inside) @@ -225,10 +228,10 @@ otherwise, add the [[drawable-region-sphere]] to `region-inside-prim-list` and i ;; WARN: Function (method 12 region-prim-area) has a return type of none, but the expression builder found a return statement. (defmethod track-start-region! ((this region-prim-area) (arg0 drawable-region-sphere)) "Enumerates through the objects `region-start-list`, if we find the provided `region`, do nothing and exit -otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and increment `region-start-count` - -@param region-sphere Defines the region in question -@returns nothing" + otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and increment `region-start-count` + + @param region-sphere Defines the region in question + @returns nothing" (let ((regions-started (-> this region-start-count))) (let ((region (-> arg0 region))) (countdown (idx regions-started) @@ -246,6 +249,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) (defmethod debug-draw-region ((this drawable-region-sphere) (arg0 int)) + ;; og:preserve-this (#when PC_PORT (when (and *debug-region-hide-empty* (nonzero? (-> this region)) (not (or (-> this region on-enter) (-> this region on-exit) (-> this region on-inside)))) ;; no scripts to run means the region is "empty" so do not render (unless enabled) @@ -254,6 +258,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (t9-0 this arg0) ) (let ((a2-0 (-> this bsphere))) + ;; og:preserve-this (add-debug-sphere #t (bucket-id debug2) a2-0 (-> this bsphere w) (#if PC_PORT (if *debug-region-color-alt* (static-rgba #xff #x00 #xff #x80) (new 'static 'rgba :r #xff :a #x80)) (new 'static 'rgba :r #xff :a #x80))) ) @@ -293,6 +298,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) (defmethod debug-draw-region ((this drawable-region-face) (arg0 int)) + ;; og:preserve-this (#when PC_PORT (when (and *debug-region-hide-empty* (nonzero? (-> this region)) (not (or (-> this region on-enter) (-> this region on-exit) (-> this region on-inside)))) ;; no scripts to run means the region is "empty" so do not render (unless enabled) @@ -302,6 +308,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (t9-0 this arg0) ) ) + ;; og:preserve-this (#cond (PC_PORT (when *debug-region-show-bsphere* @@ -335,7 +342,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (bucket-id debug2) (-> this data points) (the-as int (-> this data num-points)) - ;; tone down the opacity of the boundary so you aren't blinded / can actually stand a chance at reading the text + ;; og:preserve-this tone down the opacity of the boundary so you aren't blinded / can actually stand a chance at reading the text (#if PC_PORT (if *debug-region-color-alt* (static-rgba #x00 #xff #x00 #x30) @@ -354,7 +361,6 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (defmethod track-region ((this drawable-region-face) (arg0 region-prim-area)) "TODO" - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 object)) (-> this region) (let* ((s4-0 (-> this data)) (v1-1 (-> s4-0 normal)) @@ -363,46 +369,24 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) (when (!= a0-3 s3-0) (when (nonzero? (-> s4-0 num-points)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 (the-as (inline-array vector) (-> s4-0 points))) - (ray-plane-intersect - sv-48 - sv-52 - (-> arg0 pos) - (-> arg0 ray) - (-> (the-as (inline-array vector) sv-56) 0) - (-> (the-as (inline-array vector) sv-56) 1) - (-> (the-as (inline-array vector) sv-56) 2) - ) - (let ((s4-1 (-> s4-0 num-points)) - (s2-0 0) - (s1-0 (vector-negate! (new 'stack-no-clear 'vector) sv-52)) + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-52 (new 'stack-no-clear 'vector)) + (sv-56 (-> s4-0 points)) ) - (while (< (+ s2-0 2) (the-as int s4-1)) - (if (the-as - (inline-array vector) - (or (point-in-triangle-cross - sv-48 - sv-52 - (-> (the-as (inline-array vector) sv-56) 0) - (-> (the-as (inline-array vector) sv-56) 1) - (-> (the-as (inline-array vector) sv-56) 2) - ) - (the-as (inline-array vector) (point-in-triangle-cross - sv-48 - s1-0 - (-> (the-as (inline-array vector) sv-56) 0) - (-> (the-as (inline-array vector) sv-56) 1) - (-> (the-as (inline-array vector) sv-56) 2) - ) - ) - ) - ) - (goto cfg-17) + (ray-plane-intersect sv-48 sv-52 (-> arg0 pos) (-> arg0 ray) (-> sv-56 0) (-> sv-56 1) (-> sv-56 2)) + (let ((s4-1 (-> s4-0 num-points)) + (s2-0 0) + (s1-0 (vector-negate! (new 'stack-no-clear 'vector) sv-52)) ) - (+! s2-0 1) - (set! sv-56 (-> (the-as (inline-array vector) sv-56) 1)) + (while (< (+ s2-0 2) (the-as int s4-1)) + (if (or (point-in-triangle-cross sv-48 sv-52 (-> sv-56 0) (-> sv-56 1) (-> sv-56 2)) + (point-in-triangle-cross sv-48 s1-0 (-> sv-56 0) (-> sv-56 1) (-> sv-56 2)) + ) + (goto cfg-17) + ) + (+! s2-0 1) + (set! sv-56 (the-as (inline-array vector) (-> sv-56 1))) + ) ) ) (set! s3-0 s3-0) @@ -420,6 +404,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) (defmethod debug-draw-region ((this drawable-region-volume) (arg0 int)) + ;; og:preserve-this (#when PC_PORT (when (and *debug-region-hide-empty* (nonzero? (-> this region)) (not (or (-> this region on-enter) (-> this region on-exit) (-> this region on-inside)))) ;; no scripts to run means the region is "empty" so do not render (unless enabled) @@ -482,12 +467,14 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) (defmethod drawable-tree-region-prim-method-17 ((this drawable-tree-region-prim) (arg0 vector)) + ;; og:preserve-this (sphere<-vector+r! (the-as sphere (-> (the-as region-prim-area (scratchpad-object region-prim-area)) pos)) arg0 0.0) (let* ((s5-0 (-> this data2 (+ (-> this length) -1) length)) (s4-0 0) (a0-8 (the-as object (+ (+ (* s4-0 32) 32) (the-as int (-> this data2 (+ (-> this length) -1)))))) ) (while (< s4-0 s5-0) + ;; og:preserve-this (if (within-area? (the-as drawable-region-prim a0-8) (scratchpad-object region-prim-area)) (return #t) ) @@ -500,7 +487,8 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ;; WARN: Return type mismatch int vs symbol. (defmethod point-in-region-debug! ((this region) (arg0 vector)) - (local-vars (sv-16 int) (sv-32 int)) + "Debug check to see if point is in region. This is not efficient, since it has to find the parent geometry of this region." + ;; og:preserve-this (sphere<-vector+r! (the-as sphere (-> (the-as region-prim-area (scratchpad-object region-prim-area)) pos)) arg0 0.0) (dotimes (s5-0 (-> *level* length)) (let ((s4-0 (-> *level* level s5-0))) @@ -511,19 +499,21 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (s1-0 (-> s4-0 bsp region-trees s2-0)) ) (while (< s2-0 s3-0) - (let ((s0-0 (-> s1-0 data2 (+ (-> s1-0 length) -1) length))) - (set! sv-16 0) - (set! sv-32 (+ (+ (* sv-16 32) 32) (the-as int (-> s1-0 data2 (+ (-> s1-0 length) -1))))) + (let* ((s0-0 (-> s1-0 data2 (+ (-> s1-0 length) -1) length)) + (sv-16 0) + (sv-32 (+ (+ (* sv-16 32) 32) (the-as int (-> s1-0 data2 (+ (-> s1-0 length) -1))))) + ) (while (< sv-16 s0-0) (if (and (= (-> (the-as drawable-region-prim sv-32) region) this) (within-area? (the-as drawable-region-prim sv-32) + ;; og:preserve-this (the-as region-prim-area (-> (the-as region-prim-area (scratchpad-object region-prim-area)) region-prim-list)) ) ) (return (the-as symbol sv-32)) ) - (set! sv-16 (+ sv-16 1)) + (+! sv-16 1) (set! sv-32 (+ (+ (* sv-16 32) 32) (the-as int (-> s1-0 data2 (+ (-> s1-0 length) -1))))) ) ) @@ -539,12 +529,14 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) (defmethod debug-print ((this drawable-tree-region-prim) (arg0 vector) (arg1 object)) + ;; og:preserve-this (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) pos)) arg0 0.0) (let* ((s4-0 (-> this data2 (+ (-> this length) -1) length)) (s3-0 0) (s2-0 (the-as object (+ (+ (* s3-0 32) 32) (the-as int (-> this data2 (+ (-> this length) -1)))))) ) (while (< s3-0 s4-0) + ;; og:preserve-this (if (within-area? (the-as drawable-region-prim s2-0) (scratchpad-object region-prim-area)) (format arg1 @@ -562,33 +554,34 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) (defun region-tree-execute ((arg0 symbol) (arg1 vector) (arg2 vector)) - (local-vars (sv-32 vector)) - (set! sv-32 (vector-average! (new 'stack-no-clear 'vector) arg1 arg2)) - (set! (-> sv-32 w) (* 0.5 (vector-vector-distance arg1 arg2))) - (set! (-> (scratchpad-object region-prim-area) region-prim-list num-items) 0) - (set! (-> (scratchpad-object region-prim-area) region-enter-count) 0) - (set! (-> (scratchpad-object region-prim-area) region-exit-count) 0) - (set! (-> (scratchpad-object region-prim-area) region-inside-count) 0) - (set! (-> (scratchpad-object region-prim-area) region-start-count) 0) - (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) pos)) arg1 0.0) - (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) unknown-vector-uiyb1)) arg2 0.0) - (vector-! (the-as vector (-> (scratchpad-object region-prim-area) ray)) arg2 arg1) - (vector-! (the-as vector (-> (scratchpad-object region-prim-area) unknown-vector-t3edh)) arg1 arg2) - (dotimes (s5-1 (-> *level* length)) - (let ((v1-17 (-> *level* level s5-1))) - (when (= (-> v1-17 status) 'active) - (let ((s4-1 (-> v1-17 bsp region-trees))) - (when (nonzero? s4-1) - (let* ((s3-0 (-> s4-1 length)) - (s2-0 0) - (a0-14 (-> s4-1 s2-0)) - ) - (while (< s2-0 s3-0) - (if (= (-> a0-14 name) arg0) - (collect-regions a0-14 (the-as sphere sv-32) 0 (-> (scratchpad-object region-prim-area) region-prim-list)) - ) - (+! s2-0 1) - (set! a0-14 (-> s4-1 s2-0)) + (let ((sv-32 (vector-average! (new 'stack-no-clear 'vector) arg1 arg2))) + (set! (-> sv-32 w) (* 0.5 (vector-vector-distance arg1 arg2))) + ;; og:preserve-this + (set! (-> (scratchpad-object region-prim-area) region-prim-list num-items) 0) + (set! (-> (scratchpad-object region-prim-area) region-enter-count) 0) + (set! (-> (scratchpad-object region-prim-area) region-exit-count) 0) + (set! (-> (scratchpad-object region-prim-area) region-inside-count) 0) + (set! (-> (scratchpad-object region-prim-area) region-start-count) 0) + (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) pos)) arg1 0.0) + (sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) unknown-vector-uiyb1)) arg2 0.0) + (vector-! (the-as vector (-> (scratchpad-object region-prim-area) ray)) arg2 arg1) + (vector-! (the-as vector (-> (scratchpad-object region-prim-area) unknown-vector-t3edh)) arg1 arg2) + (dotimes (s5-1 (-> *level* length)) + (let ((v1-17 (-> *level* level s5-1))) + (when (= (-> v1-17 status) 'active) + (let ((s4-1 (-> v1-17 bsp region-trees))) + (when (nonzero? s4-1) + (let* ((s3-0 (-> s4-1 length)) + (s2-0 0) + (a0-14 (-> s4-1 s2-0)) + ) + (while (< s2-0 s3-0) + (if (= (-> a0-14 name) arg0) + (collect-regions a0-14 (the-as sphere sv-32) 0 (-> (scratchpad-object region-prim-area) region-prim-list)) + ) + (+! s2-0 1) + (set! a0-14 (-> s4-1 s2-0)) + ) ) ) ) @@ -596,12 +589,14 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in ) ) ) + ;; og:preserve-this (countdown (gp-1 (-> (scratchpad-object region-prim-area) region-prim-list num-items)) (track-region (-> (scratchpad-object region-prim-area) region-prim-list items gp-1) - (the-as region-prim-area (-> (scratchpad-object region-prim-area) region-prim-list)) + (the-as region-prim-area (-> (scratchpad-object region-prim-area) region-prim-list)) ) ) + ;; og:preserve-this (let ((gp-2 (-> (scratchpad-object region-prim-area) region-enter-count))) (while (begin (label cfg-22) (nonzero? gp-2)) (+! gp-2 -1) @@ -609,6 +604,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (s5-2 (-> a2-5 on-enter)) ) (when s5-2 + ;; og:preserve-this (countdown (v1-47 (-> (scratchpad-object region-prim-area) region-start-count)) (if (= a2-5 (-> (scratchpad-object region-prim-area) region-start-list v1-47)) (goto cfg-22) @@ -617,12 +613,14 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (script-eval s5-2 :key a2-5 + ;; og:preserve-this :vector (-> (scratchpad-object region-prim-area) region-enter-prim-list gp-2 bsphere) ) ) ) ) ) + ;; og:preserve-this (let ((gp-3 (-> (scratchpad-object region-prim-area) region-exit-count))) (while (begin (label cfg-31) (nonzero? gp-3)) (+! gp-3 -1) @@ -630,6 +628,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (s5-3 (-> a2-6 on-exit)) ) (when s5-3 + ;; og:preserve-this (countdown (v1-64 (-> (scratchpad-object region-prim-area) region-inside-count)) (if (= a2-6 (-> (scratchpad-object region-prim-area) region-inside-list v1-64)) (goto cfg-31) @@ -638,12 +637,14 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (script-eval s5-3 :key a2-6 + ;; og:preserve-this :vector (-> (scratchpad-object region-prim-area) region-exit-prim-list gp-3 bsphere) ) ) ) ) ) + ;; og:preserve-this (countdown (gp-4 (-> (scratchpad-object region-prim-area) region-inside-count)) (let* ((a2-7 (-> (scratchpad-object region-prim-area) region-inside-list gp-4)) (s5-4 (-> a2-7 on-inside)) @@ -652,6 +653,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (script-eval s5-4 :key a2-7 + ;; og:preserve-this :vector (-> (scratchpad-object region-prim-area) region-inside-prim-list gp-4 bsphere) ) ) @@ -667,8 +669,8 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in (set! (-> *level* target-pos 1 quad) (-> *level* target-pos 0 quad)) (set! (-> *level* target-pos 0 quad) (-> (target-pos 0) quad)) (when (and *execute-regions* (-> *setting-control* user-current region-mode) (not (paused?))) - (region-tree-execute 'camera (-> *level* camera-pos 1) (the-as vector (-> *level* camera-pos))) - (region-tree-execute 'target (-> *level* target-pos 1) (the-as vector (-> *level* target-pos))) + (region-tree-execute 'camera (-> *level* camera-pos 1) (-> *level* camera-pos 0)) + (region-tree-execute 'target (-> *level* target-pos 1) (-> *level* target-pos 0)) ) 0 (none) diff --git a/goal_src/jak2/engine/load/decomp.gc b/goal_src/jak2/engine/load/decomp.gc index bc5a14cd45..10f392845f 100644 --- a/goal_src/jak2/engine/load/decomp.gc +++ b/goal_src/jak2/engine/load/decomp.gc @@ -253,7 +253,7 @@ It's not super clear to me why they ditched this system. Maybe the visibility da ) (defmethod update-vis! ((this level) (vis-info level-vis-info) (unused uint) (in-bsp-vis-string (pointer uint8))) - (local-vars (t0-3 uint128) (extra-vis-length int) (extra-vis-dest (pointer int8))) + (local-vars (t0-3 uint128)) (let* ((cam-leaf-idx (-> vis-info from-bsp current-leaf-idx)) (curr-vis-string-offset (-> vis-info current-vis-string)) (desired-vis-string-offset (-> vis-info vis-string cam-leaf-idx)) @@ -322,6 +322,7 @@ It's not super clear to me why they ditched this system. Maybe the visibility da ) ) ) + ;; og:preserve-this (spad-start (&-> (the-as (pointer int8) *fake-scratchpad-data*) 0)) (spad-end (the-as (pointer int8) (&+ *fake-scratchpad-data* 2048))) (list-len (-> this bsp visible-list-length)) @@ -329,6 +330,7 @@ It's not super clear to me why they ditched this system. Maybe the visibility da (when (zero? (the-as vis-info-flag lower-flag-bits)) (let ((qwc (/ (+ list-len 15) 16))) (dotimes (a0-19 qwc) + ;; og:preserve-this (set! (-> (the-as (pointer int128) (&+ spad-start (* a0-19 16)))) (the int128 0)) ) ) @@ -340,12 +342,14 @@ It's not super clear to me why they ditched this system. Maybe the visibility da ((= comp-mode 1) (let ((qwc2 (/ (+ list-len 15) 16))) (dotimes (a0-23 qwc2) + ;; og:preserve-this (set! (-> (the-as (pointer int128) (&+ spad-start (* a0-23 16)))) (the int128 0)) ) ) - (set! extra-vis-length (-> this bsp extra-vis-list-length)) - (set! extra-vis-dest (&+ spad-start (- list-len extra-vis-length))) - (let ((extra-vis-in (unpack-vis (-> this bsp drawable-trees) spad-start (the-as (pointer int8) vis-buf)))) + (let* ((extra-vis-length (-> this bsp extra-vis-list-length)) + (extra-vis-dest (&+ spad-start (- list-len extra-vis-length))) + (extra-vis-in (unpack-vis (-> this bsp drawable-trees) spad-start (the-as (pointer int8) vis-buf))) + ) (dotimes (extra-vis-idx extra-vis-length) (let ((vis-byte (-> extra-vis-in 0))) (set! extra-vis-in (&-> extra-vis-in 1)) diff --git a/goal_src/jak2/engine/load/loader.gc b/goal_src/jak2/engine/load/loader.gc index c1d7ed8fcc..a3924a7a09 100644 --- a/goal_src/jak2/engine/load/loader.gc +++ b/goal_src/jak2/engine/load/loader.gc @@ -9,43 +9,43 @@ ;; DECOMP BEGINS -(defmethod mem-usage ((this subtitle-range) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 73 (-> arg0 length))) - (set! (-> arg0 data 72 name) "subtitle") - (+! (-> arg0 data 72 count) 1) +(defmethod mem-usage ((this subtitle-range) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 73 (-> usage length))) + (set! (-> usage data 72 name) "subtitle") + (+! (-> usage data 72 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 72 used) v1-6) - (+! (-> arg0 data 72 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 72 used) v1-6) + (+! (-> usage data 72 total) (logand -16 (+ v1-6 15))) ) this ) ;; WARN: Return type mismatch symbol vs load-dir. -(defmethod mem-usage ((this load-dir) (arg0 memory-usage-block) (arg1 int)) - (set! (-> arg0 length) (max 85 (-> arg0 length))) - (set! (-> arg0 data 84 name) "array") - (+! (-> arg0 data 84 count) 1) +(defmethod mem-usage ((this load-dir) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 85 (-> usage length))) + (set! (-> usage data 84 name) "array") + (+! (-> usage data 84 count) 1) (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 84 used) v1-6) - (+! (-> arg0 data 84 total) (logand -16 (+ v1-6 15))) + (+! (-> usage data 84 used) v1-6) + (+! (-> usage data 84 total) (logand -16 (+ v1-6 15))) ) - (set! (-> arg0 length) (max 85 (-> arg0 length))) - (set! (-> arg0 data 84 name) "array") - (set! (-> arg0 data 84 count) (-> arg0 data 84 count)) + (set! (-> usage length) (max 85 (-> usage length))) + (set! (-> usage data 84 name) "array") + (set! (-> usage data 84 count) (-> usage data 84 count)) (let ((v1-15 (asize-of (-> this string-array)))) - (+! (-> arg0 data 84 used) v1-15) - (+! (-> arg0 data 84 total) (logand -16 (+ v1-15 15))) + (+! (-> usage data 84 used) v1-15) + (+! (-> usage data 84 total) (logand -16 (+ v1-15 15))) ) - (set! (-> arg0 length) (max 85 (-> arg0 length))) - (set! (-> arg0 data 84 name) "array") - (set! (-> arg0 data 84 count) (-> arg0 data 84 count)) + (set! (-> usage length) (max 85 (-> usage length))) + (set! (-> usage data 84 name) "array") + (set! (-> usage data 84 count) (-> usage data 84 count)) (let ((v1-24 (asize-of (-> this data-array)))) - (+! (-> arg0 data 84 used) v1-24) - (+! (-> arg0 data 84 total) (logand -16 (+ v1-24 15))) + (+! (-> usage data 84 used) v1-24) + (+! (-> usage data 84 total) (logand -16 (+ v1-24 15))) ) (dotimes (s3-0 (-> this data-array length)) - (mem-usage (-> this data-array s3-0) arg0 arg1) + (mem-usage (-> this data-array s3-0) usage flags) ) (the-as load-dir #f) ) @@ -208,13 +208,9 @@ (defmethod link-art! ((this art-group)) (when this (countdown (s5-0 (-> this length)) - (let* ((s3-0 (-> this data s5-0)) - (s4-0 (if (type? s3-0 art-joint-anim) - (the-as art-joint-anim s3-0) - ) - ) - (s2-0 #f) - ) + (let ((s4-0 (as-type (-> this data s5-0) art-joint-anim)) + (s2-0 #f) + ) (when s4-0 (let ((s3-1 LEVEL_TOTAL)) (while (begin (label cfg-24) (nonzero? s3-1)) @@ -260,13 +256,9 @@ (defmethod unlink-art! ((this art-group)) (when this (countdown (s5-0 (-> this length)) - (let* ((s3-0 (-> this data s5-0)) - (s4-0 (if (type? s3-0 art-joint-anim) - (the-as art-joint-anim s3-0) - ) - ) - (s3-1 #f) - ) + (let ((s4-0 (as-type (-> this data s5-0) art-joint-anim)) + (s3-1 #f) + ) (when s4-0 (let ((s2-0 LEVEL_TOTAL)) (while (begin (label cfg-13) (nonzero? s2-0)) @@ -405,7 +397,9 @@ (let ((a0-34 (-> this buf))) (cond ((-> this login?) - (set! (-> this art-group) (the-as art-group (link a0-34 (-> this load-file data) (-> this len) (-> this heap) 0))) + (set! (-> this art-group) + (the-as art-group (link a0-34 (-> this load-file data) (-> this len) (-> this heap) 0)) + ) (let ((s4-0 (-> this art-group)) (s3-0 (-> this load-file)) ) @@ -507,9 +501,9 @@ (defmethod update ((this external-art-control) (arg0 symbol)) (if (nonzero? (-> this reserve-buffer-count)) (spool-push this "reserved" 0 *dproc* (if (-> this reserve-buffer) - -110.0 - -0.5 - ) + -110.0 + -0.5 + ) ) ) (dotimes (v1-5 2) @@ -522,7 +516,9 @@ (let ((s3-0 (-> this rec s4-0))) (when (-> s3-0 name) (dotimes (s2-0 2) - (when (and (file-status (-> this buffer s2-0) (-> s3-0 name) (-> s3-0 parts)) (not (-> this buffer s2-0 frame-lock))) + (when (and (file-status (-> this buffer s2-0) (-> s3-0 name) (-> s3-0 parts)) + (not (-> this buffer s2-0 frame-lock)) + ) (set! (-> this buffer s2-0 frame-lock) #t) (set! (-> s3-0 anim-name) (-> this buffer s2-0)) (set! (-> this buffer s2-0 pending-load-file-owner) (-> s3-0 owner)) @@ -578,7 +574,7 @@ (set! (-> s4-4 length) 0) (dotimes (s3-2 3) (when (-> this rec s3-2 name) - (mem-copy! (&-> (-> s4-4 (-> s4-4 length)) type) (&-> (-> this rec s3-2) type) 44) + (mem-copy! (&-> s4-4 (-> s4-4 length) type) (&-> this rec s3-2 type) 44) (+! (-> s4-4 length) 1) ) ) @@ -704,8 +700,8 @@ (if (>= arg3 (-> this rec 0 priority)) (return (the-as int #f)) ) - (mem-copy! (&-> (-> this rec) 0 type) (&-> (-> this rec 1) type) 44) - (mem-copy! (&-> (-> this rec 1) type) (&-> (-> this rec 2) type) 44) + (mem-copy! (&-> this rec 0 type) (&-> this rec 1 type) 44) + (mem-copy! (&-> this rec 1 type) (&-> this rec 2 type) 44) (set! (-> this rec 2 name) #f) (set! (-> this rec 2 owner) (the-as handle #f)) ) @@ -713,7 +709,7 @@ (if (>= arg3 (-> this rec 1 priority)) (return (the-as int #f)) ) - (mem-copy! (&-> (-> this rec 1) type) (&-> (-> this rec 2) type) 44) + (mem-copy! (&-> this rec 1 type) (&-> this rec 2 type) 44) (set! (-> this rec 2 name) #f) (set! (-> this rec 2 owner) (the-as handle #f)) ) @@ -727,15 +723,15 @@ ) (cond ((< arg3 (-> this rec 0 priority)) - (mem-copy! (&-> (-> this rec 2) type) (&-> (-> this rec 1) type) 44) - (mem-copy! (&-> (-> this rec 1) type) (&-> (-> this rec) 0 type) 44) + (mem-copy! (&-> this rec 2 type) (&-> this rec 1 type) 44) + (mem-copy! (&-> this rec 1 type) (&-> this rec 0 type) 44) (set! (-> this rec 0 name) arg0) (set! (-> this rec 0 parts) arg1) (set! (-> this rec 0 priority) arg3) (set! (-> this rec 0 owner) (process->handle arg2)) ) ((< arg3 (-> this rec 1 priority)) - (mem-copy! (&-> (-> this rec 2) type) (&-> (-> this rec 1) type) 44) + (mem-copy! (&-> this rec 2 type) (&-> this rec 1 type) 44) (set! (-> this rec 1 name) arg0) (set! (-> this rec 1 parts) arg1) (set! (-> this rec 1 priority) arg3) @@ -774,7 +770,7 @@ (defbehavior ja-play-spooled-anim process-drawable ((arg0 spool-anim) (arg1 art-joint-anim) (arg2 art-joint-anim) (arg3 (function process-drawable symbol))) - (local-vars (v0-59 int) (sv-176 int)) + (local-vars (v0-59 int)) (let ((s2-0 arg2) (s1-0 arg3) (gp-0 (new 'stack 'spooler-block arg2 arg3)) @@ -855,7 +851,7 @@ (set-setting! 'spooling (process->ppointer self) 0.0 0) (set-setting! 'spool-anim (-> gp-0 anim) 0.0 0) (apply-settings *setting-control*) - (set! (-> gp-0 old-time) (current-time)) + (set-time! (-> gp-0 old-time)) (while (< (-> gp-0 part) (-> gp-0 anim parts)) (when (> (-> gp-0 part) 0) (while (let ((v1-99 (file-status *art-control* (-> gp-0 anim name) (-> gp-0 part)))) @@ -1000,65 +996,66 @@ (let* ((f30-0 (* 0.05859375 (-> s5-8 speed))) (f28-0 (+ (-> gp-0 part-audio-start) (/ (the float (+ (-> s5-8 frames num-frames) -1)) f30-0))) ) - (set! sv-176 (current-str-pos (-> gp-0 sid))) - (set! (-> gp-0 good-time) (current-time)) - (until (>= (the float v0-59) f28-0) - (if (= (-> self skel root-channel 0) (-> self skel channel)) - (logior! (-> self skel status) (joint-control-status valid-spooled-frame)) - ) - (if (or ((-> gp-0 break-func) self) - (and (<= sv-176 0) (>= (- (current-time) (-> gp-0 good-time)) (seconds 4))) - (and (< 300 (-> gp-0 good-count)) (<= sv-176 0)) - ) - (goto cfg-130) - ) - (gui-control-method-12 - *gui-control* - self - (gui-channel art-load) - (gui-action queue) - (-> gp-0 anim name) - (-> gp-0 part) - -20.0 - (-> gp-0 sid) - ) - (if (< (+ (-> gp-0 part) 1) (-> gp-0 anim parts)) - (gui-control-method-12 - *gui-control* - self - (gui-channel art-load) - (gui-action queue) - (-> gp-0 anim name) - (+ (-> gp-0 part) 1) - -10.0 - (-> gp-0 sid) + (let ((sv-176 (current-str-pos (-> gp-0 sid)))) + (set-time! (-> gp-0 good-time)) + (until (>= (the float v0-59) f28-0) + (if (= (-> self skel root-channel 0) (-> self skel channel)) + (logior! (-> self skel status) (joint-control-status valid-spooled-frame)) ) - (logclear! (-> self skel status) (joint-control-status spooling-not-last-block)) + (if (or ((-> gp-0 break-func) self) + (and (<= sv-176 0) (time-elapsed? (-> gp-0 good-time) (seconds 4))) + (and (< 300 (-> gp-0 good-count)) (<= sv-176 0)) + ) + (goto cfg-130) + ) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (-> gp-0 anim name) + (-> gp-0 part) + -20.0 + (-> gp-0 sid) ) - (execute-commands-up-to *load-state* (ja-aframe-num 0)) - (cond - ((and (< (-> gp-0 old-pos) sv-176) (< -1 sv-176)) - (+! (-> gp-0 good-count) (- (current-time) (-> self clock old-frame-counter))) - (set! (-> gp-0 good-time) (current-time)) - ) - (else - 0 + (if (< (+ (-> gp-0 part) 1) (-> gp-0 anim parts)) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (-> gp-0 anim name) + (+ (-> gp-0 part) 1) + -10.0 + (-> gp-0 sid) + ) + (logclear! (-> self skel status) (joint-control-status spooling-not-last-block)) + ) + (execute-commands-up-to *load-state* (ja-aframe-num 0)) + (cond + ((and (< (-> gp-0 old-pos) sv-176) (< -1 sv-176)) + (+! (-> gp-0 good-count) (- (current-time) (-> self clock old-frame-counter))) + (set-time! (-> gp-0 good-time)) + ) + (else + 0 + ) ) + (set! (-> gp-0 old-pos) sv-176) + (set-time! (-> gp-0 old-time)) + (suspend) + (let* ((f26-0 (* (- (the float (current-str-pos (-> gp-0 sid))) (-> gp-0 part-audio-start)) f30-0)) + (f0-16 (if (str-id-is-playing? (the-as int (-> gp-0 sid))) + (fmax 0.0 (fmin f26-0 (the float (+ (-> (ja-group) frames num-frames) -1)))) + (fmax 0.0 (fmin (ja-frame-num 0) (the float (+ (-> (ja-group) frames num-frames) -1)))) + ) + ) + ) + (ja-no-eval :num! (seek!) :frame-num f0-16) + ) + (set! v0-59 (current-str-pos (-> gp-0 sid))) + (set! sv-176 v0-59) ) - (set! (-> gp-0 old-pos) sv-176) - (set! (-> gp-0 old-time) (current-time)) - (suspend) - (let* ((f26-0 (* (- (the float (current-str-pos (-> gp-0 sid))) (-> gp-0 part-audio-start)) f30-0)) - (f0-16 (if (str-id-is-playing? (the-as int (-> gp-0 sid))) - (fmax 0.0 (fmin f26-0 (the float (+ (-> (ja-group) frames num-frames) -1)))) - (fmax 0.0 (fmin (ja-frame-num 0) (the float (+ (-> (ja-group) frames num-frames) -1)))) - ) - ) - ) - (ja-no-eval :num! (seek!) :frame-num f0-16) - ) - (set! v0-59 (current-str-pos (-> gp-0 sid))) - (set! sv-176 v0-59) ) (set! (-> gp-0 part-audio-start) f28-0) ) @@ -1067,7 +1064,8 @@ (else (format 0 - "ERROR: ~A in spool anim loop for ~A ~D, but not loaded.~%" ;; fixed missing %. + ;; og:preserve-this fixed missing % + "ERROR: ~A in spool anim loop for ~A ~D, but not loaded.~%" self (-> gp-0 anim name) (-> gp-0 part) @@ -1196,7 +1194,7 @@ (or (= arg2 (gui-action none)) (= arg2 (-> s2-0 action))) (or (not arg0) (string= arg0 (-> s2-0 name))) ) - (return (-> s2-0 id)) + (return (the-as sound-id (-> s2-0 id))) ) (set! s2-0 (the-as gui-connection s1-0)) (-> this engine) @@ -1211,7 +1209,7 @@ (or (= arg2 (gui-action none)) (= arg2 (-> s1-1 action))) (or (not arg0) (string= arg0 (-> s1-1 name))) ) - (return (-> s1-1 id)) + (return (the-as sound-id (-> s1-1 id))) ) ) ) @@ -1337,7 +1335,6 @@ ) (defmethod handle-command-list ((this gui-control) (arg0 gui-channel) (arg1 gui-connection)) - (local-vars (sv-16 int) (sv-32 int) (sv-48 int)) (let ((gp-0 #t)) (cond ((or (not (gui-control-method-18 this arg0)) (< (-> *display* base-clock frame-counter) (-> this times arg0))) @@ -1353,8 +1350,9 @@ ) (case a2-1 (((gui-channel hud)) - (let ((s0-0 80)) - (set! sv-16 90) + (let ((s0-0 80) + (sv-16 90) + ) (while (>= (the-as uint sv-16) (the-as uint s0-0)) (if (not (handle-command this arg0 (the-as gui-channel s0-0) (the-as symbol s1-0) arg1)) (set! gp-0 #f) @@ -1364,8 +1362,9 @@ ) ) (((gui-channel screen)) - (let ((s0-1 66)) - (set! sv-32 70) + (let ((s0-1 66) + (sv-32 70) + ) (while (>= (the-as uint sv-32) (the-as uint s0-1)) (if (not (handle-command this arg0 (the-as gui-channel s0-1) (the-as symbol s1-0) arg1)) (set! gp-0 #f) @@ -1375,8 +1374,9 @@ ) ) (((gui-channel voice)) - (let ((s0-2 18)) - (set! sv-48 32) + (let ((s0-2 18) + (sv-48 32) + ) (while (>= (the-as uint sv-48) (the-as uint s0-2)) (if (not (handle-command this arg0 (the-as gui-channel s0-2) (the-as symbol s1-0) arg1)) (set! gp-0 #f) @@ -1456,7 +1456,7 @@ (cond (gp-0 (dotimes (s4-0 4) - (when (and (string-charp= (-> gp-0 name) (the-as (pointer uint8) (-> *sound-iop-info* stream-name s4-0))) + (when (and (string-charp= (-> gp-0 name) (-> *sound-iop-info* stream-name s4-0 name)) (or (= (-> gp-0 id) (-> *sound-iop-info* stream-id s4-0)) (zero? (-> *sound-iop-info* stream-id s4-0))) (logtest? (-> *sound-iop-info* stream-status s4-0) (stream-status ststatus-one ststatus-six)) (if (and (>= (the-as uint (-> gp-0 channel)) (the-as uint 16)) @@ -1537,48 +1537,50 @@ ) (defmethod set-action! ((this gui-control) - (arg0 gui-action) - (arg1 sound-id) - (arg2 gui-channel) - (arg3 gui-action) - (arg4 string) - (arg5 (function gui-connection symbol)) - (arg6 process) - ) - (local-vars (sv-16 gui-action) (sv-17 gui-action) (sv-20 string) (sv-24 (function gui-connection symbol))) - (set! sv-16 arg0) - (set! sv-17 arg3) - (set! sv-20 arg4) - (set! sv-24 arg5) - (let ((s1-0 (the-as gui-connection (-> this engine alive-list next0)))) - (-> this engine) - (let ((s0-0 (-> s1-0 next0))) - (while (!= s1-0 (-> this engine alive-list-end)) - (when (and (or (= arg1 1) (= arg1 (-> s1-0 id))) - (or (= arg2 (gui-channel none)) (= arg2 (-> s1-0 channel))) - (or (= sv-17 (gui-action none)) (= sv-17 (-> s1-0 action))) - (or (not sv-20) (string= sv-20 (-> s1-0 name))) - (or (not arg5) (arg5 s1-0)) - (or (not arg6) (= arg6 (get-process s1-0))) - ) - (cond - ((and (= sv-16 (gui-action hide)) (!= (-> this ids (-> s1-0 channel)) (-> s1-0 id))) - (set! (-> s1-0 action) (gui-action hidden)) - ) - ((and (= sv-16 (gui-action play)) (= (-> s1-0 action) (gui-action playing))) - ) - (else - (set! (-> s1-0 action) sv-16) - ;; og:preserve-this fixed naughty dog bug here. was 'play instead of (gui-action play) - (if (and (= sv-16 (gui-action play)) (handle-command-list this (-> s1-0 channel) s1-0)) - (channel-id-set! this s1-0 (-> s1-0 id)) - ) + (arg0 gui-action) + (arg1 sound-id) + (arg2 gui-channel) + (arg3 gui-action) + (arg4 string) + (arg5 (function gui-connection symbol)) + (arg6 process) + ) + (let ((sv-16 arg0) + (sv-17 arg3) + (sv-20 arg4) + ) + (let ((sv-24 arg5)) + ) + (let ((s1-0 (the-as gui-connection (-> this engine alive-list next0)))) + (-> this engine) + (let ((s0-0 (-> s1-0 next0))) + (while (!= s1-0 (-> this engine alive-list-end)) + (when (and (or (= arg1 1) (= arg1 (-> s1-0 id))) + (or (= arg2 (gui-channel none)) (= arg2 (-> s1-0 channel))) + (or (= sv-17 (gui-action none)) (= sv-17 (-> s1-0 action))) + (or (not sv-20) (string= sv-20 (-> s1-0 name))) + (or (not arg5) (arg5 s1-0)) + (or (not arg6) (= arg6 (get-process s1-0))) + ) + (cond + ((and (= sv-16 (gui-action hide)) (!= (-> this ids (-> s1-0 channel)) (-> s1-0 id))) + (set! (-> s1-0 action) (gui-action hidden)) + ) + ((and (= sv-16 (gui-action play)) (= (-> s1-0 action) (gui-action playing))) + ) + (else + (set! (-> s1-0 action) sv-16) + ;; og:preserve-this fixed naughty dog bug here. was 'play instead of (gui-action play) + (if (and (= sv-16 (gui-action play)) (handle-command-list this (-> s1-0 channel) s1-0)) + (channel-id-set! this s1-0 (-> s1-0 id)) + ) + ) ) ) + (set! s1-0 (the-as gui-connection s0-0)) + (-> this engine) + (set! s0-0 (-> s0-0 next0)) ) - (set! s1-0 (the-as gui-connection s0-0)) - (-> this engine) - (set! s0-0 (-> s0-0 next0)) ) ) ) @@ -1587,75 +1589,73 @@ ;; WARN: Return type mismatch int vs sound-id. (defmethod add-process ((this gui-control) - (arg0 process) - (arg1 gui-channel) - (arg2 gui-action) - (arg3 string) - (arg4 float) - (arg5 time-frame) - ) - (local-vars - (sv-16 int) - (sv-20 gui-connection) - (sv-32 gui-connection) - (sv-48 gui-connection) - (sv-64 gui-connection) - (sv-80 int) - ) - (set! sv-32 (the-as gui-connection #f)) - (set! sv-48 (the-as gui-connection (-> this engine alive-list next0))) - (-> this engine) - (set! sv-64 (the-as gui-connection (-> sv-48 next0))) - (while (!= sv-48 (-> this engine alive-list-end)) - (when (and (= arg1 (-> (the-as gui-connection sv-48) channel)) - (string= arg3 (-> (the-as gui-connection sv-48) name)) - (= (get-process sv-48) arg0) - ) - (set! sv-32 (the-as gui-connection sv-48)) - (goto cfg-12) - ) - (set! sv-48 (the-as gui-connection sv-64)) - (-> this engine) - (set! sv-64 (the-as gui-connection (-> sv-64 next0))) - ) - (label cfg-12) - (when (not sv-32) - (set! sv-16 0) - (set! sv-80 32) - (while (nonzero? sv-80) - (set! sv-80 (+ sv-80 -1)) - (set! sv-20 (-> this connections sv-80)) - (if (and (nonzero? (-> sv-20 id)) - (= arg1 (-> sv-20 channel)) - (string= arg3 (-> sv-20 name)) - (>= (-> sv-20 priority) -1.0) - ) - (set! sv-16 (the-as int (-> sv-20 id))) - ) - ) - (if (zero? sv-16) - (set! sv-16 (the-as int (new-sound-id))) - ) - (set! sv-32 (the-as gui-connection (add-connection (-> this engine) arg0 arg4 0 arg3 sv-16))) - sv-32 - ) - (the-as sound-id (cond - (sv-32 - (set! (-> sv-32 priority) arg4) - (set! (-> sv-32 channel) arg1) - (set! (-> sv-32 action) arg2) - (set! (-> sv-32 param2) (the-as int arg3)) - (set! (-> sv-32 hold-time) arg5) - (set! (-> sv-32 flags) (gui-connection-flags gcf0)) - (set! (-> sv-32 fade) (the-as uint 0)) - (the-as int (-> (the-as gui-connection sv-32) id)) - ) - (else - (format 0 "ERROR: could not connection ~A to gui engine.~%" arg0) - 0 + (arg0 process) + (arg1 gui-channel) + (arg2 gui-action) + (arg3 string) + (arg4 float) + (arg5 time-frame) ) + (let ((sv-32 (the-as gui-connection #f))) + (let ((sv-48 (the-as gui-connection (-> this engine alive-list next0)))) + (-> this engine) + (let ((sv-64 (the-as gui-connection (-> sv-48 next0)))) + (while (!= sv-48 (-> this engine alive-list-end)) + (when (and (= arg1 (-> (the-as gui-connection sv-48) channel)) + (string= arg3 (-> (the-as gui-connection sv-48) name)) + (= (get-process sv-48) arg0) ) + (set! sv-32 (the-as gui-connection sv-48)) + (goto cfg-12) + ) + (set! sv-48 (the-as gui-connection sv-64)) + (-> this engine) + (set! sv-64 (the-as gui-connection (-> sv-64 next0))) ) + ) + ) + (label cfg-12) + (when (not sv-32) + (let ((sv-16 0)) + (let ((sv-80 32)) + (while (nonzero? sv-80) + (+! sv-80 -1) + (let ((sv-20 (-> this connections sv-80))) + (if (and (nonzero? (-> sv-20 id)) + (= arg1 (-> sv-20 channel)) + (string= arg3 (-> sv-20 name)) + (>= (-> sv-20 priority) -1.0) + ) + (set! sv-16 (the-as int (-> sv-20 id))) + ) + ) + ) + ) + (if (zero? sv-16) + (set! sv-16 (the-as int (new-sound-id))) + ) + (set! sv-32 (the-as gui-connection (add-connection (-> this engine) arg0 arg4 0 arg3 sv-16))) + ) + sv-32 + ) + (the-as sound-id (cond + (sv-32 + (set! (-> sv-32 priority) arg4) + (set! (-> sv-32 channel) arg1) + (set! (-> sv-32 action) arg2) + (set! (-> sv-32 param2) (the-as int arg3)) + (set! (-> sv-32 hold-time) arg5) + (set! (-> sv-32 flags) (gui-connection-flags gcf0)) + (set! (-> sv-32 fade) (the-as uint 0)) + (the-as int (-> (the-as gui-connection sv-32) id)) + ) + (else + (format 0 "ERROR: could not connection ~A to gui engine.~%" arg0) + 0 + ) + ) + ) + ) ) (defmethod remove-process ((this gui-control) (arg0 process) (arg1 gui-channel)) @@ -1678,103 +1678,95 @@ ;; WARN: Return type mismatch int vs sound-id. (defmethod gui-control-method-12 ((this gui-control) - (arg0 process) - (arg1 gui-channel) - (arg2 gui-action) - (arg3 string) - (arg4 int) - (arg5 float) - (arg6 sound-id) - ) - (local-vars - (sv-16 gui-connection) - (sv-20 int) - (sv-24 gui-connection) - (sv-28 process-drawable) - (sv-32 int) - (sv-48 sound-id) - ) - (set! sv-48 arg6) - (set! sv-16 (the-as gui-connection #f)) - (set! sv-20 0) - (set! sv-32 32) - (while (nonzero? sv-32) - (set! sv-32 (+ sv-32 -1)) - (set! sv-24 (-> this connections sv-32)) - (when (and (nonzero? (-> sv-24 id)) - (= arg1 (-> sv-24 channel)) - (let ((v1-14 (handle->process (-> sv-24 handle)))) - (and (or (= v1-14 arg0) (= (-> arg0 type) scene-player) (and v1-14 (= (-> v1-14 type) scene-player))) - (and (string= arg3 (-> sv-24 name)) (= arg4 (-> sv-24 anim-part))) - ) - ) - ) - (when (< (-> sv-24 priority) arg5) - (set! (-> sv-24 time-stamp) (-> this update-time)) - (return (-> sv-24 id)) - ) - (set! sv-16 sv-24) - (goto cfg-44) - ) - ) - (countdown (v1-33 32) - (let ((a0-15 (-> this connections v1-33))) - (when (or (zero? (-> a0-15 id)) (not (handle->process (-> a0-15 handle)))) - (set! sv-16 a0-15) - (set! (-> sv-16 param3) 0) - (set! (-> sv-16 flags) (gui-connection-flags)) - (goto cfg-44) - ) - ) - ) - (label cfg-44) - (the-as sound-id (cond - (sv-16 - (when (zero? (-> (the-as gui-connection sv-16) id)) - (when (zero? sv-20) - (let ((v1-46 (lookup-gui-connection this arg0 arg1 arg3 (new 'static 'sound-id)))) - (if v1-46 - (set! sv-20 (the-as int (-> v1-46 id))) + (arg0 process) + (arg1 gui-channel) + (arg2 gui-action) + (arg3 string) + (arg4 int) + (arg5 float) + (arg6 sound-id) ) - ) - ) - (if (zero? sv-20) - (set! sv-20 (the-as int sv-48)) - ) - (set! (-> sv-16 param3) (if (nonzero? sv-20) - sv-20 - (the-as int (new-sound-id)) - ) - ) - ) - (when (= arg5 -99.0) - (let ((s2-1 arg0)) - (set! sv-28 (if (type? s2-1 process-drawable) - (the-as process-drawable s2-1) - ) - ) - ) - (set! arg5 (if sv-28 - (vector-vector-distance (target-pos 0) (-> sv-28 root trans)) - -1.0 - ) - ) - ) - (set! (-> sv-16 time-stamp) (-> this update-time)) - (set! (-> sv-16 handle) (process->handle arg0)) - (set! (-> sv-16 priority) arg5) - (set! (-> sv-16 channel) arg1) - (set! (-> sv-16 action) arg2) - (set! (-> sv-16 anim-part) (the-as uint arg4)) - (set! (-> sv-16 param2) (the-as int arg3)) - (set! (-> sv-16 fade) (the-as uint 0)) - (the-as int (-> (the-as gui-connection sv-16) id)) - ) - (else - 0 + (let ((sv-48 arg6) + (sv-16 (the-as gui-connection #f)) + (sv-20 0) + ) + (let ((sv-32 32)) + (while (nonzero? sv-32) + (+! sv-32 -1) + (let ((sv-24 (-> this connections sv-32))) + (when (and (nonzero? (-> sv-24 id)) + (= arg1 (-> sv-24 channel)) + (let ((v1-14 (handle->process (-> sv-24 handle)))) + (and (or (= v1-14 arg0) (= (-> arg0 type) scene-player) (and v1-14 (= (-> v1-14 type) scene-player))) + (and (string= arg3 (-> sv-24 name)) (= arg4 (-> sv-24 anim-part))) + ) ) ) + (when (< (-> sv-24 priority) arg5) + (set! (-> sv-24 time-stamp) (-> this update-time)) + (return (the-as sound-id (-> sv-24 id))) + ) + (set! sv-16 sv-24) + (goto cfg-44) + ) ) + ) + ) + (countdown (v1-33 32) + (let ((a0-15 (-> this connections v1-33))) + (when (or (zero? (-> a0-15 id)) (not (handle->process (-> a0-15 handle)))) + (set! sv-16 a0-15) + (set! (-> sv-16 param3) 0) + (set! (-> sv-16 flags) (gui-connection-flags)) + (goto cfg-44) + ) + ) + ) + (label cfg-44) + (the-as sound-id (cond + (sv-16 + (when (zero? (-> (the-as gui-connection sv-16) id)) + (when (zero? sv-20) + (let ((v1-46 (lookup-gui-connection this arg0 arg1 arg3 (new 'static 'sound-id)))) + (if v1-46 + (set! sv-20 (the-as int (-> v1-46 id))) + ) + ) + ) + (if (zero? sv-20) + (set! sv-20 (the-as int sv-48)) + ) + (set! (-> sv-16 param3) (if (nonzero? sv-20) + sv-20 + (the-as int (new-sound-id)) + ) + ) + ) + (when (= arg5 -99.0) + (let ((sv-28 (as-type arg0 process-drawable))) + (set! arg5 (if sv-28 + (vector-vector-distance (target-pos 0) (-> sv-28 root trans)) + -1.0 + ) + ) + ) + ) + (set! (-> sv-16 time-stamp) (-> this update-time)) + (set! (-> sv-16 handle) (process->handle arg0)) + (set! (-> sv-16 priority) arg5) + (set! (-> sv-16 channel) arg1) + (set! (-> sv-16 action) arg2) + (set! (-> sv-16 anim-part) (the-as uint arg4)) + (set! (-> sv-16 param2) (the-as int arg3)) + (set! (-> sv-16 fade) (the-as uint 0)) + (the-as int (-> (the-as gui-connection sv-16) id)) + ) + (else + 0 + ) + ) + ) + ) ) (defmethod gui-control-method-21 ((this gui-control) (arg0 gui-connection) (arg1 vector)) @@ -1785,12 +1777,7 @@ (((gui-action queue) (gui-action play) (gui-action playing) (gui-action fade)) (let ((f30-0 (-> arg0 priority))) (when (= f30-0 -99.0) - (let* ((s2-0 (get-process arg0)) - (v1-10 (if (type? s2-0 process-drawable) - (the-as process-drawable s2-0) - ) - ) - ) + (let ((v1-10 (as-type (get-process arg0) process-drawable))) (set! f30-0 (cond ((= (-> arg0 id) (-> this ids (-> arg0 channel))) -1.0 @@ -1912,6 +1899,7 @@ (b! (!= v1-43 (gui-status ready)) cfg-36 :delay (empty-form)) (case (shr (the-as int (-> arg0 channel)) 4) ((1 2) + ;; og:preserve-this (if (#if PC_PORT (or *gui-kick-str* (not (paused?))) (not (paused?))) (str-play-async (-> arg0 name) (-> arg0 id)) @@ -1947,7 +1935,7 @@ ) (begin (dotimes (s3-0 4) - (when (and (string-charp= (-> arg0 name) (the-as (pointer uint8) (-> *sound-iop-info* stream-name s3-0))) + (when (and (string-charp= (-> arg0 name) (-> *sound-iop-info* stream-name s3-0 name)) (= (-> arg0 id) (-> *sound-iop-info* stream-id s3-0)) (logtest? (-> *sound-iop-info* stream-status s3-0) (stream-status ststatus-six)) ) @@ -1966,12 +1954,7 @@ (when (and (logtest? (-> arg0 flags) (gui-connection-flags gcf1 fo-curve fo-min fo-max)) (logtest? (-> arg0 flags) (gui-connection-flags gcf0)) ) - (let* ((s5-1 (get-process arg0)) - (s4-1 (if (type? s5-1 process-drawable) - s5-1 - ) - ) - ) + (let ((s4-1 (the-as process (as-type (get-process arg0) process-drawable)))) (when (and s4-1 (nonzero? (-> (the-as process-drawable s4-1) root))) (when *sound-player-enable* (let ((s5-2 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) @@ -2146,10 +2129,10 @@ (dotimes (s1-1 4) (set! (-> s4-1 s1-1) (-> this spool-connections s1-1 id)) (when (and (-> this spool-connections s1-1 name) (case (-> this spool-connections s1-1 channel) - (((gui-channel art-load) (gui-channel art-load-next)) - #t + (((gui-channel art-load) (gui-channel art-load-next)) + #t + ) ) - ) ) (set! s3-2 (logior s3-2 (ash 1 s1-1))) (if (and s2-2 (string= (-> this spool-connections s1-1 name) (the-as string s2-2))) diff --git a/goal_src/jak2/engine/math/euler.gc b/goal_src/jak2/engine/math/euler.gc index b2b805dbca..17d1243b0a 100644 --- a/goal_src/jak2/engine/math/euler.gc +++ b/goal_src/jak2/engine/math/euler.gc @@ -110,11 +110,12 @@ ) (cond ((= (logand (/ arg2 2) 1) 1) - (let* ((f0-0 (-> (the-as (pointer float) (+ (+ (* s2-0 4) (* s3-0 16)) (the-as int arg1))))) - (f0-2 (* f0-0 f0-0)) - (f1-0 (-> (the-as (pointer float) (+ (+ (* s1-0 4) (* s3-0 16)) (the-as int arg1))))) - (f30-0 (sqrtf (+ f0-2 (* f1-0 f1-0)))) - ) + (let ((f30-0 (sqrtf (+ (square (-> (the-as (pointer float) (+ (+ (* s2-0 4) (* s3-0 16)) (the-as int arg1))))) + (square (-> (the-as (pointer float) (+ (+ (* s1-0 4) (* s3-0 16)) (the-as int arg1))))) + ) + ) + ) + ) (cond ((< 0.00000000001 f30-0) (set! (-> arg0 x) (atan @@ -142,11 +143,12 @@ ) ) (else - (let* ((f0-21 (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s3-0 16)) (the-as int arg1))))) - (f0-23 (* f0-21 f0-21)) - (f1-3 (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s2-0 16)) (the-as int arg1))))) - (f30-1 (sqrtf (+ f0-23 (* f1-3 f1-3)))) - ) + (let ((f30-1 (sqrtf (+ (square (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s3-0 16)) (the-as int arg1))))) + (square (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s2-0 16)) (the-as int arg1))))) + ) + ) + ) + ) (cond ((< 0.00000000001 f30-1) (set! (-> arg0 x) @@ -206,14 +208,10 @@ ) (defun quat->eul ((arg0 euler-angles) (arg1 quaternion) (arg2 int)) - "Conver quaternion to euler angles with given order, not very efficient." + "Convert quaternion to euler angles with given order, not very efficient." (let ((s5-0 (new 'stack-no-clear 'matrix))) (quaternion->matrix s5-0 arg1) (matrix->eul arg0 s5-0 arg2) ) arg0 ) - - - - diff --git a/goal_src/jak2/engine/math/math.gc b/goal_src/jak2/engine/math/math.gc index b3e77dd799..e3b4c2958f 100644 --- a/goal_src/jak2/engine/math/math.gc +++ b/goal_src/jak2/engine/math/math.gc @@ -9,6 +9,8 @@ ;; - lerp-scale rewritten to not use accumulator ;; - logf, log2f, cube-root manually fixed due to float hacks +(defmacro square (x) + `(* ,x ,x)) ;; DECOMP BEGINS @@ -87,9 +89,7 @@ (* arg0 (+ 0.33333334 (* arg0 - (+ -0.25 - (* arg0 (+ 0.2 (* arg0 (+ -0.16666666 (* arg0 (+ 0.14285715 (* arg0 (+ -0.125 (* 0.11111111 arg0))))))))) - ) + (+ -0.25 (* arg0 (+ 0.2 (* arg0 (+ -0.16666666 (* arg0 (+ 0.14285715 (* arg0 (+ -0.125 (/ arg0 9)))))))))) ) ) ) @@ -99,8 +99,6 @@ ) ) - - (defun logf ((arg0 float)) "Natural log." (let ((v1-1 (the-as int (+ (shr (the-as int arg0) 23) -126))) @@ -118,9 +116,7 @@ (* f0-5 (+ 0.33333334 (* f0-5 - (+ -0.25 - (* f0-5 (+ 0.2 (* f0-5 (+ -0.16666666 (* f0-5 (+ 0.14285715 (* f0-5 (+ -0.125 (* 0.11111111 f0-5))))))))) - ) + (+ -0.25 (* f0-5 (+ 0.2 (* f0-5 (+ -0.16666666 (* f0-5 (+ 0.14285715 (* f0-5 (+ -0.125 (/ f0-5 9)))))))))) ) ) ) @@ -152,9 +148,7 @@ (* f0-5 (+ 0.33333334 (* f0-5 - (+ -0.25 - (* f0-5 (+ 0.2 (* f0-5 (+ -0.16666666 (* f0-5 (+ 0.14285715 (* f0-5 (+ -0.125 (* 0.11111111 f0-5))))))))) - ) + (+ -0.25 (* f0-5 (+ 0.2 (* f0-5 (+ -0.16666666 (* f0-5 (+ 0.14285715 (* f0-5 (+ -0.125 (/ f0-5 9)))))))))) ) ) ) @@ -169,7 +163,6 @@ ) ) - (deftype float-type (uint32) () ) @@ -397,7 +390,6 @@ (exp (* arg1 (logf arg0))) ) - (defun print-exp ((arg0 float)) "Print in the format AeB where A is in the range (1, 10)" (let* ((f30-1 (floor (/ (logf (fabs arg0)) (logf 10.0)))) @@ -443,7 +435,7 @@ (defun print-time ((arg0 object) (arg1 time-frame)) "Print a time-frame as minutes:seconds:milliseconds" (let* ((f0-1 (* 0.0033333334 (the float arg1))) - (a2-0 (the int (* 0.016666668 f0-1))) + (a2-0 (the int (/ f0-1 60))) (f0-2 (- f0-1 (* 60.0 (the float a2-0)))) (a3-0 (the int f0-2)) (f0-3 (- f0-2 (the float a3-0))) @@ -455,8 +447,8 @@ (none) ) +;; WARN: Return type mismatch uint vs int. (defun log2 ((arg0 int)) - "Log base 2." (the-as int (+ (sar (the-as int (the float arg0)) 23) -127)) ) @@ -590,7 +582,9 @@ (defun seekl ((arg0 int) (arg1 int) (arg2 int)) "Move arg0 toward arg1, by at most arg2." - (let* ((v1-0 (- arg1 arg0)) (a3-0 (abs v1-0))) + (let* ((v1-0 (- arg1 arg0)) + (a3-0 (abs v1-0)) + ) (cond ((>= arg2 a3-0) arg1 @@ -678,17 +672,17 @@ ) (defun rand-vu-float-range ((arg0 float) (arg1 float)) - "Get a random float in between arg0 and arg1" + "Get a random float in between arg0 and arg1." (+ arg0 (* (rand-vu) (- arg1 arg0))) ) (defun rand-vu-percent? ((arg0 float)) - "Get a boolean that's true with the given probability (in 0, 1)" + "Get a boolean that's true with the given probability (in 0, 1)." (>= arg0 (rand-vu)) ) (defun rand-vu-int-range ((arg0 int) (arg1 int)) - "Get an integer in the given range (inclusive)" + "Get an integer in the given range (inclusive)." (if (< arg0 arg1) (set! arg1 (+ arg1 1)) (set! arg0 (+ arg0 1)) @@ -706,6 +700,7 @@ (the int (* (rand-vu) (the float arg0))) ) +;; WARN: new jak 2 until loop case, check carefully (defun rand-vu-int-count-excluding ((arg0 int) (arg1 int)) "Get an integer in the range [0, arg0). If bit n is set in arg1, exclude this value from being returned." @@ -715,7 +710,7 @@ (let ((v1-0 1)) (while (nonzero? arg0) (+! arg0 -1) - (if (zero? (logand arg1 v1-0)) + (if (not (logtest? arg1 v1-0)) (+! s4-0 1) ) (set! v1-0 (* v1-0 2)) @@ -747,6 +742,7 @@ ) ) +;; WARN: new jak 2 until loop case, check carefully (defun rand-vu-int-range-exclude ((arg0 int) (arg1 int) (arg2 int)) "Get an integer in the range [0, arg0), excluding arg2. Note that this doesn't use bits like rand-vu-int-count-excluding." @@ -761,12 +757,13 @@ ) (deftype random-generator (basic) - ((seed uint32) + ((seed uint32) ) ) (define *random-generator* (new 'global 'random-generator)) + (set! (-> *random-generator* seed) (the-as uint #x666edd1e)) (defmacro sext32-64 (x) @@ -830,7 +827,6 @@ ) ) - (defun int-noise ((arg0 int)) "Generate random-ish floats in range -1, 1." (let ((v1-1 (logxor (shl arg0 13) arg0))) @@ -860,9 +856,8 @@ (defun smooth-interp ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) "Remap arg2 from (arg3, arg4) to (arg0, arg1), using cubic interpolation. Satisfies: - - f(arg3) = arg0 - - f(arg4) = arg1 - - f'(arg3) = f'(arg4) = 0" + - f(arg3) = arg0 + - f(arg4) = arg1 + - f'(arg3) = f'(arg4) = 0" (+ arg0 (* (- arg1 arg0) (smooth-step (/ (- arg2 arg3) (- arg4 arg3))))) ) - diff --git a/goal_src/jak2/engine/math/quaternion.gc b/goal_src/jak2/engine/math/quaternion.gc index 06dddb7b2d..6de9368db7 100644 --- a/goal_src/jak2/engine/math/quaternion.gc +++ b/goal_src/jak2/engine/math/quaternion.gc @@ -23,7 +23,7 @@ (defun quaternion-axis-angle! ((arg0 quaternion) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) "Construct a quaternion from an axis and angle. The axis should be normalized." (let ((s5-0 (new 'stack-no-clear 'vector))) - (sincos! s5-0 (* 0.5 arg4)) + (sincos! s5-0 (/ arg4 2)) (let ((f0-2 (-> s5-0 x))) (set! (-> arg0 x) (* arg1 f0-2)) (set! (-> arg0 y) (* arg2 f0-2)) @@ -37,7 +37,7 @@ (defun quaternion-vector-angle! ((arg0 quaternion) (arg1 vector) (arg2 float)) "Construct a quaternion from an axis and angle. The axis should be normalized." (let ((s5-0 (new 'stack-no-clear 'vector))) - (sincos! s5-0 (* 0.5 arg2)) + (sincos! s5-0 (/ arg2 2)) (let ((f0-2 (-> s5-0 x))) (set! (-> arg0 x) (* (-> arg1 x) f0-2)) (set! (-> arg0 y) (* (-> arg1 y) f0-2)) @@ -50,12 +50,9 @@ (defun vector-angle<-quaternion! ((arg0 vector) (arg1 quaternion)) "Convert the quaternion arg1 to axis-angle form and store in arg0 (angle goes in w)" - (let* ((f0-0 1.0) - (f1-0 1.0) - (f2-0 (-> arg1 w)) - (f30-0 (/ f0-0 (sqrtf (- f1-0 (* f2-0 f2-0))))) - (f0-3 (* 2.0 (acos-rad (-> arg1 w)))) - ) + (let ((f30-0 (/ 1.0 (sqrtf (- 1.0 (square (-> arg1 w)))))) + (f0-3 (* 2.0 (acos-rad (-> arg1 w)))) + ) (set! (-> arg0 x) (* (-> arg1 x) f30-0)) (set! (-> arg0 y) (* (-> arg1 y) f30-0)) (set! (-> arg0 z) (* (-> arg1 z) f30-0)) @@ -67,55 +64,55 @@ (defun quaternion-look-at! ((arg0 quaternion) (arg1 vector) (arg2 vector)) "Look along arg1, with arg2 as up." (let ((s5-0 (new 'stack-no-clear 'matrix))) - (vector-cross! (the-as vector (-> s5-0 data)) arg2 arg1) - (vector-cross! (the-as vector (&-> s5-0 data 4)) arg1 (the-as vector (-> s5-0 data))) - (set! (-> (the-as vector (&-> s5-0 data 8)) quad) (-> arg1 quad)) + (vector-cross! (-> s5-0 vector 0) arg2 arg1) + (vector-cross! (-> s5-0 vector 1) arg1 (-> s5-0 vector 0)) + (set! (-> (the-as vector (-> s5-0 vector 2)) quad) (-> arg1 quad)) (quaternion-normalize! (matrix->quaternion arg0 s5-0)) ) ) (defun quaternion-zero! ((arg0 quaternion)) - "Set quaternion to all 0's" - (set! (-> arg0 vec quad) (the-as uint128 0)) + "Set quaternion to all 0's." + (set! (-> arg0 quad) (the-as uint128 0)) arg0 ) (defun quaternion-identity! ((arg0 quaternion)) - "Set quaternion to 0,0,0,1 (identity)" - (set! (-> arg0 vec quad) (the-as uint128 0)) + "Set quaternion to 0,0,0,1 (identity)." + (set! (-> arg0 quad) (the-as uint128 0)) (set! (-> arg0 w) 1.0) arg0 ) (defun quaternion-i! ((arg0 quaternion)) - "Create unit i quaternion" - (set! (-> arg0 vec quad) (the-as uint128 0)) + "Create unit i quaternion." + (set! (-> arg0 quad) (the-as uint128 0)) (set! (-> arg0 x) 1.0) arg0 ) (defun quaternion-j! ((arg0 quaternion)) "Create unit j quaternion." - (set! (-> arg0 vec quad) (the-as uint128 0)) + (set! (-> arg0 quad) (the-as uint128 0)) (set! (-> arg0 y) 1.0) arg0 ) (defun quaternion-k! ((arg0 quaternion)) - "Create unit k quaternion" - (set! (-> arg0 vec quad) (the-as uint128 0)) + "Create unit k quaternion." + (set! (-> arg0 quad) (the-as uint128 0)) (set! (-> arg0 z) 1.0) arg0 ) (defun quaternion-copy! ((arg0 quaternion) (arg1 quaternion)) - "Set arg0 = arg1" - (set! (-> arg0 vec quad) (-> arg1 vec quad)) + "Set arg0 = arg1." + (set! (-> arg0 quad) (-> arg1 quad)) arg0 ) (defun quaternion-set! ((arg0 quaternion) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) - "Set arg0 = [arg1, arg2, arg3, arg4]" + "Set arg0 = [arg1, arg2, arg3, arg4]." (set! (-> arg0 x) arg1) (set! (-> arg0 y) arg2) (set! (-> arg0 z) arg3) @@ -128,10 +125,10 @@ (rlet ((vf1 :class vf) (vf2 :class vf) ) - (.lvf vf1 (&-> arg1 vec quad)) - (.lvf vf2 (&-> arg2 vec quad)) + (.lvf vf1 (&-> arg1 quad)) + (.lvf vf2 (&-> arg2 quad)) (.add.vf vf1 vf1 vf2) - (.svf (&-> arg0 vec quad) vf1) + (.svf (&-> arg0 quad) vf1) arg0 ) ) @@ -141,24 +138,25 @@ (rlet ((vf1 :class vf) (vf2 :class vf) ) - (.lvf vf1 (&-> arg1 vec quad)) - (.lvf vf2 (&-> arg2 vec quad)) + (.lvf vf1 (&-> arg1 quad)) + (.lvf vf2 (&-> arg2 quad)) (.sub.vf vf1 vf1 vf2) - (.svf (&-> arg0 vec quad) vf1) + (.svf (&-> arg0 quad) vf1) arg0 ) ) +;; ERROR: Bad vector register dependency: vf2 (defun quaternion-negate! ((arg0 quaternion) (arg1 quaternion)) "Set arg0 = -arg1." (rlet ((vf1 :class vf) (vf2 :class vf) ) - (.lvf vf1 (&-> arg1 vec quad)) + (.lvf vf1 (&-> arg1 quad)) ;;(.sub.vf vf2 vf2 vf2) (.xor.vf vf2 vf2 vf2) (.sub.vf vf1 vf2 vf1) - (.svf (&-> arg0 vec quad) vf1) + (.svf (&-> arg0 quad) vf1) arg0 ) ) @@ -170,31 +168,31 @@ (rlet ((vf1 :class vf) (vf2 :class vf) ) - (.lvf vf1 (&-> arg1 vec quad)) + (.lvf vf1 (&-> arg1 quad)) ;; (.sub.vf vf2 vf2 vf2) (.xor.vf vf2 vf2 vf2) (.sub.vf.xyz vf2 vf2 vf1) (.add.vf.w vf2 vf2 vf1) - (.svf (&-> arg0 vec quad) vf2) + (.svf (&-> arg0 quad) vf2) arg0 ) ) (defun quaternion-float*! ((arg0 quaternion) (arg1 quaternion) (arg2 float)) - "Multiply each element" + "Multiply each element." (rlet ((vf1 :class vf) (vf2 :class vf) ) - (.lvf vf1 (&-> arg1 vec quad)) + (.lvf vf1 (&-> arg1 quad)) (.mov vf2 arg2) (.mul.x.vf vf1 vf1 vf2) - (.svf (&-> arg0 vec quad) vf1) + (.svf (&-> arg0 quad) vf1) arg0 ) ) (defun quaternion-float/! ((arg0 quaternion) (arg1 quaternion) (arg2 float)) - "Divide each element" + "Divide each element." (let ((f0-1 (/ 1.0 arg2))) (quaternion-float*! arg0 arg1 f0-1) ) @@ -202,14 +200,14 @@ ) (defun quaternion-norm2 ((arg0 quaternion)) - "Get the squared norm of a quaternion" + "Get the squared norm of a quaternion." (local-vars (v0-0 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) ) (init-vf0-vector) - (.lvf vf1 (&-> arg0 vec quad)) + (.lvf vf1 (&-> arg0 quad)) (.mul.vf vf1 vf1 vf1) (.add.z.vf.w acc vf1 vf1) (.add.mul.y.vf.w acc vf0 vf1 acc) @@ -228,7 +226,7 @@ (vf1 :class vf) ) (init-vf0-vector) - (.lvf vf1 (&-> arg0 vec quad)) + (.lvf vf1 (&-> arg0 quad)) (.mul.vf vf1 vf1 vf1) (.add.z.vf.w acc vf1 vf1) (.add.mul.y.vf.w acc vf0 vf1 acc) @@ -240,7 +238,7 @@ ) (defun quaternion-normalize! ((arg0 quaternion)) - "Normalize a quaternion" + "Normalize a quaternion." (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -248,7 +246,7 @@ (vf2 :class vf) ) (init-vf0-vector) - (.lvf vf1 (&-> arg0 vec quad)) + (.lvf vf1 (&-> arg0 quad)) (.mul.vf vf2 vf1 vf1) (.add.z.vf.w acc vf2 vf2) (.add.mul.y.vf.w acc vf0 vf2 acc) @@ -258,7 +256,7 @@ (.mul.vf vf2 vf1 Q) ;; (.nop.vf) ;; (.nop.vf) - (.svf (&-> arg0 vec quad) vf2) + (.svf (&-> arg0 quad) vf2) arg0 ) ) @@ -274,7 +272,7 @@ (vf3 :class vf) ) (init-vf0-vector) - (.lvf vf1 (&-> arg1 vec quad)) + (.lvf vf1 (&-> arg1 quad)) (.mul.vf vf2 vf1 vf1) ;; (.sub.vf vf3 vf3 vf3) (.xor.vf vf3 vf3 vf3) @@ -288,7 +286,7 @@ (.mul.vf vf3 vf3 Q) (.nop.vf) (.nop.vf) - (.svf (&-> arg0 vec quad) vf3) + (.svf (&-> arg0 quad) vf3) arg0 ) ) @@ -302,8 +300,8 @@ (vf2 :class vf) ) (init-vf0-vector) - (.lvf vf1 (&-> arg0 vec quad)) - (.lvf vf2 (&-> arg1 vec quad)) + (.lvf vf1 (&-> arg0 quad)) + (.lvf vf2 (&-> arg1 quad)) (.mul.vf vf1 vf1 vf2) (.add.z.vf.w acc vf1 vf1) (.add.mul.y.vf.w acc vf0 vf1 acc) @@ -315,7 +313,7 @@ ) (defun quaternion*! ((arg0 quaternion) (arg1 quaternion) (arg2 quaternion)) - "Real quaternion multiplication" + "Real quaternion multiplication." (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -324,8 +322,8 @@ (vf4 :class vf) ) (init-vf0-vector) - (.lvf vf1 (&-> arg1 vec quad)) - (.lvf vf2 (&-> arg2 vec quad)) + (.lvf vf1 (&-> arg1 quad)) + (.lvf vf2 (&-> arg2 quad)) (.sub.vf.w vf4 vf0 vf0) (.mul.vf vf3 vf1 vf2) (.outer.product.a.vf acc vf1 vf2) @@ -337,7 +335,7 @@ (.sub.mul.y.vf.w acc vf0 vf3 acc) (.sub.mul.x.vf.w acc vf0 vf3 acc) (.add.mul.w.vf vf1 vf4 vf0 acc) - (.svf (&-> arg0 vec quad) vf1) + (.svf (&-> arg0 quad) vf1) arg0 ) ) @@ -352,18 +350,18 @@ (f1-0 (-> arg1 z)) (f0-0 (-> arg1 w)) ) - (set! (-> arg0 data 0) f0-0) - (set! (-> arg0 data 1) f1-0) - (set! (-> arg0 data 2) (- f2-0)) - (set! (-> arg0 data 3) f3-0) - (set! (-> arg0 data 4) (- f1-0)) - (set! (-> arg0 data 5) f0-0) - (set! (-> arg0 data 6) f3-0) - (set! (-> arg0 data 7) f2-0) - (set! (-> arg0 data 8) f2-0) - (set! (-> arg0 data 9) (- f3-0)) - (set! (-> arg0 data 10) f0-0) - (set! (-> arg0 data 11) f1-0) + (set! (-> arg0 vector 0 x) f0-0) + (set! (-> arg0 vector 0 y) f1-0) + (set! (-> arg0 vector 0 z) (- f2-0)) + (set! (-> arg0 vector 0 w) f3-0) + (set! (-> arg0 vector 1 x) (- f1-0)) + (set! (-> arg0 vector 1 y) f0-0) + (set! (-> arg0 vector 1 z) f3-0) + (set! (-> arg0 vector 1 w) f2-0) + (set! (-> arg0 vector 2 x) f2-0) + (set! (-> arg0 vector 2 y) (- f3-0)) + (set! (-> arg0 vector 2 z) f0-0) + (set! (-> arg0 vector 2 w) f1-0) (set! (-> arg0 trans x) (- f3-0)) (set! (-> arg0 trans y) (- f2-0)) (set! (-> arg0 trans z) (- f1-0)) @@ -379,18 +377,18 @@ (f0-0 (-> arg1 z)) ) (let ((f3-0 (-> arg1 w))) - (set! (-> arg0 data 0) f2-0) - (set! (-> arg0 data 1) f3-0) - (set! (-> arg0 data 2) (- f0-0)) - (set! (-> arg0 data 3) f1-0) - (set! (-> arg0 data 4) f1-0) - (set! (-> arg0 data 5) f0-0) - (set! (-> arg0 data 6) f3-0) - (set! (-> arg0 data 7) (- f3-0)) - (set! (-> arg0 data 8) f0-0) - (set! (-> arg0 data 9) (- f1-0)) - (set! (-> arg0 data 10) f2-0) - (set! (-> arg0 data 11) f3-0) + (set! (-> arg0 vector 0 x) f2-0) + (set! (-> arg0 vector 0 y) f3-0) + (set! (-> arg0 vector 0 z) (- f0-0)) + (set! (-> arg0 vector 0 w) f1-0) + (set! (-> arg0 vector 1 x) f1-0) + (set! (-> arg0 vector 1 y) f0-0) + (set! (-> arg0 vector 1 z) f3-0) + (set! (-> arg0 vector 1 w) (- f3-0)) + (set! (-> arg0 vector 2 x) f0-0) + (set! (-> arg0 vector 2 y) (- f1-0)) + (set! (-> arg0 vector 2 z) f2-0) + (set! (-> arg0 vector 2 w) f3-0) (set! (-> arg0 trans x) f3-0) ) (set! (-> arg0 trans y) (- f2-0)) @@ -402,7 +400,6 @@ (defun quaternion->matrix ((arg0 matrix) (arg1 quaternion)) "Convert quaternion to matrix." - (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -412,7 +409,7 @@ (vf5 :class vf) ) (init-vf0-vector) - (.lvf vf1 (&-> arg1 vec quad)) + (.lvf vf1 (&-> arg1 quad)) (.add.vf vf5 vf1 vf1) (.add.w.vf.x vf2 vf0 vf1) (.add.z.vf.y vf2 vf0 vf1) @@ -500,15 +497,15 @@ (defun matrix->quaternion ((arg0 quaternion) (arg1 matrix)) "Convert a rotation matrix to a quaternion." - (let ((f0-2 (+ (-> arg1 data 0) (-> arg1 data 5) (-> arg1 data 10)))) + (let ((f0-2 (+ (-> arg1 vector 0 x) (-> arg1 vector 1 y) (-> arg1 vector 2 z)))) (cond ((< 0.0 f0-2) (let ((f0-4 (sqrtf (+ 1.0 f0-2)))) - (set! (-> arg0 w) (* 0.5 f0-4)) + (set! (-> arg0 w) (/ f0-4 2)) (let ((f0-5 (/ 0.5 f0-4))) - (set! (-> arg0 x) (* f0-5 (- (-> arg1 data 6) (-> arg1 data 9)))) - (set! (-> arg0 y) (* f0-5 (- (-> arg1 data 8) (-> arg1 data 2)))) - (set! (-> arg0 z) (* f0-5 (- (-> arg1 data 1) (-> arg1 data 4)))) + (set! (-> arg0 x) (* f0-5 (- (-> arg1 vector 1 z) (-> arg1 vector 2 y)))) + (set! (-> arg0 y) (* f0-5 (- (-> arg1 vector 2 x) (-> arg1 vector 0 z)))) + (set! (-> arg0 z) (* f0-5 (- (-> arg1 vector 0 y) (-> arg1 vector 1 x)))) ) ) ) @@ -517,12 +514,12 @@ (a3-0 1) (v1-4 2) ) - (when (< (-> arg1 data 0) (-> arg1 data 5)) + (when (< (-> arg1 vector 0 x) (-> arg1 vector 1 y)) (set! a2-0 1) (set! a3-0 2) (set! v1-4 0) ) - (when (< (-> (the-as (pointer float) (+ (+ (* a2-0 4) (* a2-0 16)) (the-as int arg1)))) (-> arg1 data 10)) + (when (< (-> (the-as (pointer float) (+ (+ (* a2-0 4) (* a2-0 16)) (the-as int arg1)))) (-> arg1 vector 2 z)) (set! a2-0 2) (set! a3-0 0) (set! v1-4 1) @@ -539,7 +536,7 @@ ) ) ) - (set! (-> arg0 data a2-0) (* 0.5 f0-12)) + (set! (-> arg0 data a2-0) (/ f0-12 2)) (if (!= f0-12 0.0) (set! f0-12 (/ 0.5 f0-12)) ) @@ -573,7 +570,7 @@ ) (defun matrix-with-scale->quaternion ((arg0 quaternion) (arg1 matrix)) - "Convert a matrix with a rotation and scale into a quaternion (just the rotation)" + "Convert a matrix with a rotation and scale into a quaternion (just the rotation)." (local-vars (a1-4 float)) (rlet ((vf1 :class vf) (vf2 :class vf) @@ -584,9 +581,9 @@ (vf7 :class vf) ) (let ((v1-0 (new-stack-matrix0))) - (let* ((f0-1 (vector-dot (the-as vector (-> arg1 data)) (the-as vector (-> arg1 data)))) - (f1-1 (vector-dot (the-as vector (&-> arg1 data 4)) (the-as vector (&-> arg1 data 4)))) - (f2-1 (vector-dot (the-as vector (&-> arg1 data 8)) (the-as vector (&-> arg1 data 8)))) + (let* ((f0-1 (vector-dot (-> arg1 vector 0) (-> arg1 vector 0))) + (f1-1 (vector-dot (-> arg1 vector 1) (-> arg1 vector 1))) + (f2-1 (vector-dot (-> arg1 vector 2) (-> arg1 vector 2))) (f0-3 (/ 1.0 (sqrtf f0-1))) (f1-3 (/ 1.0 (sqrtf f1-1))) (f2-3 (/ 1.0 (sqrtf f2-1))) @@ -620,11 +617,7 @@ (defun quaternion-vector-len ((arg0 quaternion)) "Assuming quaternion is normalized, get the length of the xyz part." - (let ((f0-0 1.0) - (f1-0 (-> arg0 w)) - ) - (sqrtf (- f0-0 (* f1-0 f1-0))) - ) + (sqrtf (- 1.0 (square (-> arg0 w)))) ) (defun quaternion-log! ((arg0 quaternion) (arg1 quaternion)) @@ -649,8 +642,8 @@ ) (defun quaternion-exp! ((arg0 quaternion) (arg1 quaternion)) - "Quaternion exponentiation. Unused" - (let ((f30-0 (vector-length (the-as vector arg1)))) + "Quaternion exponentiation. Unused." + (let ((f30-0 (vector-length (-> arg1 vec)))) (cond ((= f30-0 0.0) (set! (-> arg0 x) 0.0) @@ -699,17 +692,15 @@ (let ((v1-8 (* arg3 f30-0))) (.mov vf2 v1-8) ) - (.lvf vf3 (&-> arg1 vec quad)) - (.lvf vf4 (&-> arg2 vec quad)) + (.lvf vf3 (&-> arg1 quad)) + (.lvf vf4 (&-> arg2 quad)) (.mul.x.vf acc vf3 vf1) (.add.mul.x.vf vf3 vf4 vf2 acc) - (.svf (&-> arg0 vec quad) vf3) + (.svf (&-> arg0 quad) vf3) (quaternion-normalize! arg0) ) (else - (let* ((f1-4 1.0) - (f2-1 f0-0) - (f1-6 (sqrtf (- f1-4 (* f2-1 f2-1)))) + (let* ((f1-6 (sqrtf (- 1.0 (square f0-0)))) (f0-6 (/ (- f1-6 f0-0) (+ f1-6 f0-0))) (f28-0 (/ 1.0 f1-6)) ) @@ -726,11 +717,11 @@ ) ) (.mul.x.vf vf1 vf1 vf2) - (.lvf vf3 (&-> arg1 vec quad)) - (.lvf vf4 (&-> arg2 vec quad)) + (.lvf vf3 (&-> arg1 quad)) + (.lvf vf4 (&-> arg2 quad)) (.mul.x.vf acc vf3 vf1) (.add.mul.y.vf vf3 vf4 vf1 acc) - (.svf (&-> arg0 vec quad) vf3) + (.svf (&-> arg0 quad) vf3) (.mov v1-15 vf3) ) ) @@ -763,11 +754,11 @@ (.mov vf2 v1-6) ) ) - (.lvf vf3 (&-> arg1 vec quad)) - (.lvf vf4 (&-> arg2 vec quad)) + (.lvf vf3 (&-> arg1 quad)) + (.lvf vf4 (&-> arg2 quad)) (.mul.x.vf acc vf3 vf1) (.add.mul.x.vf vf3 vf4 vf2 acc) - (.svf (&-> arg0 vec quad) vf3) + (.svf (&-> arg0 quad) vf3) (quaternion-normalize! arg0) arg0 ) @@ -783,10 +774,8 @@ (quaternion-negate! s3-0 s3-0) ) (quaternion-! s5-0 s3-0 arg1) - (let ((f0-1 (quaternion-norm2 s5-0)) - (f1-1 arg3) - ) - (if (< (* f1-1 f1-1) f0-1) + (let ((f0-1 (quaternion-norm2 s5-0))) + (if (< (square arg3) f0-1) (quaternion-float*! s5-0 s5-0 (/ arg3 (sqrtf f0-1))) ) ) @@ -847,54 +836,54 @@ (.mul.x.vf.w vf5 vf0 vf5) (.mul.vf acc vf6 vf4) (.add.mul.vf vf7 vf5 vf3 acc) - (.svf (&-> arg0 vec quad) vf7) + (.svf (&-> arg0 quad) vf7) arg0 ) ) (defun vector-x-quaternion! ((arg0 vector) (arg1 quaternion)) - "Get the first row of the rotation matrix for this quaternion" + "Get the first row of the rotation matrix for this quaternion." (let ((s5-0 (new-stack-matrix0))) (quaternion->matrix s5-0 arg1) - (set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 data)) 0)) + (set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 vector)) 0)) ) arg0 ) (defun vector-y-quaternion! ((arg0 vector) (arg1 quaternion)) - "Get the second row of the rotation matrix for this quaternion" + "Get the second row of the rotation matrix for this quaternion." (let ((s5-0 (new-stack-matrix0))) (quaternion->matrix s5-0 arg1) - (set! (-> arg0 quad) (-> (the-as (pointer uint128) (&-> s5-0 data 4)) 0)) + (set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 vector 1)) 0)) ) arg0 ) (defun vector-z-quaternion! ((arg0 vector) (arg1 quaternion)) - "Get the third row of the rotation matrix for this quaternion" + "Get the third row of the rotation matrix for this quaternion." (let ((s5-0 (new-stack-matrix0))) (quaternion->matrix s5-0 arg1) - (set! (-> arg0 quad) (-> (the-as (pointer uint128) (&-> s5-0 data 8)) 0)) + (set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 vector 2)) 0)) ) arg0 ) (defun quaternion-x-angle ((arg0 quaternion)) - "Get the x rotation angle. Not very efficient" + "Get the x rotation angle. Not very efficient." (let ((v1-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) arg0))) (atan (-> v1-1 z) (-> v1-1 y)) ) ) (defun quaternion-y-angle ((arg0 quaternion)) - "Get the y rotation angle. Not very efficient" + "Get the y rotation angle. Not very efficient." (let ((v1-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg0))) (atan (-> v1-1 x) (-> v1-1 z)) ) ) (defun quaternion-z-angle ((arg0 quaternion)) - "Get the z rotation angle. Not very efficient" + "Get the z rotation angle. Not very efficient." (let ((v1-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) arg0))) (atan (-> v1-1 x) (-> v1-1 y)) ) @@ -931,14 +920,14 @@ ) (defun quaternion-rotate-y! ((arg0 quaternion) (arg1 quaternion) (arg2 float)) - "Rotate existing quaternion along y axis (right multiply)" + "Rotate existing quaternion along y axis (right multiply)." (let ((a1-2 (quaternion-vector-angle! (new-stack-quaternion0) (new 'static 'vector :y 1.0 :w 1.0) arg2))) (quaternion-normalize! (quaternion*! arg0 a1-2 arg1)) ) ) (defun quaternion-rotate-x! ((arg0 quaternion) (arg1 quaternion) (arg2 float)) - "Rotate existing quaternion along x axis (right multiply)" + "Rotate existing quaternion along x axis (right multiply)." (let ((a1-3 (quaternion-vector-angle! (new-stack-quaternion0) (vector-x-quaternion! (new-stack-vector0) arg1) arg2)) ) (quaternion-normalize! (quaternion*! arg0 a1-3 arg1)) @@ -946,7 +935,7 @@ ) (defun quaternion-rotate-z! ((arg0 quaternion) (arg1 quaternion) (arg2 float)) - "Rotate existing quaternion along z axis (right multiply)" + "Rotate existing quaternion along z axis (right multiply)." (let ((a1-3 (quaternion-vector-angle! (new-stack-quaternion0) (vector-z-quaternion! (new-stack-vector0) arg1) arg2)) ) (quaternion-normalize! (quaternion*! arg0 a1-3 arg1)) @@ -954,7 +943,7 @@ ) (defun quaternion-delta-y ((arg0 quaternion) (arg1 quaternion)) - "Difference in yaw between two quaternions" + "Difference in yaw between two quaternions." (acos (vector-dot (vector-z-quaternion! (new 'stack-no-clear 'vector) arg0) (vector-z-quaternion! (new 'stack-no-clear 'vector) arg1) @@ -963,7 +952,6 @@ ) (defun quaternion-rotate-y-to-vector! ((arg0 quaternion) (arg1 quaternion) (arg2 quaternion) (arg3 float)) - "Rotate along y so z-axis points to match another. Use arg3 as the max rotation amount." (let ((s5-0 (new 'stack-no-clear 'quaternion))) (let ((t9-0 vector-xz-normalize!) (a0-1 (new 'stack-no-clear 'vector)) @@ -1029,7 +1017,7 @@ ) (defun quaternion<-rotate-y-vector ((arg0 quaternion) (arg1 vector)) - "Create a quaternion representing only the yaw of the given vector" + "Create a quaternion representing only the yaw of the given vector." (quaternion-vector-angle! arg0 (new 'static 'vector :y 1.0 :w 1.0) (vector-y-angle arg1)) ) @@ -1051,7 +1039,7 @@ ) (defun quaternion-xz-angle ((arg0 quaternion)) - "yet another function to compute the yaw of a quaternion. This is a particularly inefficient version." + "Yet another function to compute the yaw of a quaternion. This is a particularly inefficient version." (let ((gp-0 (new 'stack-no-clear 'matrix)) (s5-0 (new 'stack-no-clear 'vector)) ) @@ -1061,7 +1049,3 @@ (vector-y-angle s5-0) ) ) - - - - diff --git a/goal_src/jak2/engine/math/transformq.gc b/goal_src/jak2/engine/math/transformq.gc index 8faa9f2ba1..16bae4c0df 100644 --- a/goal_src/jak2/engine/math/transformq.gc +++ b/goal_src/jak2/engine/math/transformq.gc @@ -129,7 +129,7 @@ ) (let ((s4-0 (-> s3-0 vector 2))) (vector-normalize! (vector-flatten! (-> s3-0 vector 1) s1-0 s4-0) 1.0) - (vector-cross! (the-as vector (-> s3-0 vector)) (-> s3-0 vector 1) s4-0) + (vector-cross! (-> s3-0 vector 0) (-> s3-0 vector 1) s4-0) ) (let ((a1-5 (matrix-rotate-z! (new 'stack-no-clear 'matrix) arg0))) (matrix*! s3-0 a1-5 s3-0) @@ -138,7 +138,7 @@ ) ) -(defmethod roll-relative-to-gravity trsqv ((this trsqv)) +(defmethod roll-relative-to-gravity ((this trsqv)) "Get our roll, relative to 'down' from gravity" (let* ((s5-0 (get-quaternion this)) (gp-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-0)) @@ -154,6 +154,9 @@ ) ) +;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] +;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] +;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defmethod rotate-toward-orientation! ((this trsqv) (arg0 quaternion) (arg1 float) (arg2 float) (arg3 int) (arg4 int) (arg5 float)) "Adjust our orientation toward target, subject to some rate limits. For jak 1, I said: @@ -161,65 +164,47 @@ where an axis flips by 180 degrees. But now they use matrix-from-two-vectors-the-long-way-smooth to fix it! Good job. This additionally uses the fancy logic of matrix-from-two-vectors-smooth." - (local-vars - (f0-4 float) - (sv-192 (function quaternion vector vector float int quaternion)) - (sv-208 quaternion) - (sv-224 vector) - (sv-240 int) - (sv-256 vector) - (sv-272 vector) - ) - (set! sv-240 arg4) - (let ((s2-0 arg5) + (local-vars (f0-4 float)) + (let ((sv-240 arg4) + (s2-0 arg5) (s5-0 (get-quaternion this)) ) (let ((gp-0 (new 'stack-no-clear 'quaternion))) (when (< 0.0 arg2) - (set! sv-192 quaternion-from-two-vectors-smooth!) - (set! sv-208 gp-0) - (set! sv-224 (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0)) - (let ((a2-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) arg0))) - (sv-192 sv-208 sv-224 a2-1 arg2 sv-240) + (quaternion-from-two-vectors-smooth! + gp-0 + (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0) + (vector-y-quaternion! (new 'stack-no-clear 'vector) arg0) + arg2 + sv-240 ) (quaternion-normalize! (quaternion*! s5-0 gp-0 s5-0)) ) (when (< 0.0 arg1) - (set! sv-256 (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0)) - (let ((s1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-0))) - (set! sv-272 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg0)) - (let ((s0-1 (new 'stack-no-clear 'matrix))) - (vector-flatten! s1-2 s1-2 sv-256) - (vector-flatten! sv-272 sv-272 sv-256) - (vector-normalize! s1-2 1.0) - (vector-normalize! sv-272 1.0) - (cond - ((!= s2-0 0.0) - (let* ((v1-5 (vector-cross! (new 'stack-no-clear 'vector) s1-2 sv-272)) - ;; og:preserve-this inlined vector-dot - ; (f0-3 (-> sv-256 x)) - ; (f1-3 (-> sv-256 y)) - ; (f2-0 (-> sv-256 z)) - ; (f3-0 (-> v1-5 x)) - ; (f4-0 (-> v1-5 y)) - ; (f5-0 (-> v1-5 z)) - ) - (set! f0-4 (vector-dot sv-256 v1-5)) - ; (.mula.s f0-3 f3-0) - ; (.madda.s f1-3 f4-0) - ; (.madd.s f0-4 f2-0 f5-0) - ) - (if (< (* f0-4 s2-0) 0.0) - (matrix-from-two-vectors-the-long-way-smooth! s0-1 s1-2 sv-272 arg1 arg3) - (matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3) - ) - ) - (else - (matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3) - ) + (let ((sv-256 (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0)) + (s1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-0)) + (sv-272 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg0)) + (s0-1 (new 'stack-no-clear 'matrix)) + ) + (vector-flatten! s1-2 s1-2 sv-256) + (vector-flatten! sv-272 sv-272 sv-256) + (vector-normalize! s1-2 1.0) + (vector-normalize! sv-272 1.0) + (cond + ((!= s2-0 0.0) + (let* ((v1-5 (vector-cross! (new 'stack-no-clear 'vector) s1-2 sv-272))) + (set! f0-4 (vector-dot sv-256 v1-5)) + ) + (if (< (* f0-4 s2-0) 0.0) + (matrix-from-two-vectors-the-long-way-smooth! s0-1 s1-2 sv-272 arg1 arg3) + (matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3) + ) + ) + (else + (matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3) ) - (matrix->quaternion gp-0 s0-1) ) + (matrix->quaternion gp-0 s0-1) ) (quaternion-normalize! (quaternion*! s5-0 gp-0 s5-0)) ) diff --git a/goal_src/jak2/engine/nav/nav-control.gc b/goal_src/jak2/engine/nav/nav-control.gc index 7cf3ea264d..e0af77746a 100644 --- a/goal_src/jak2/engine/nav/nav-control.gc +++ b/goal_src/jak2/engine/nav/nav-control.gc @@ -12,11 +12,12 @@ (define *nav-last-triangle-test-count* 0) (defun debug-nav-validate-current-poly ((arg0 nav-mesh) (arg1 nav-poly) (arg2 vector)) - (local-vars (sv-32 vector) (sv-36 float)) (when (not (point-in-poly? arg0 arg1 arg2)) - (set! sv-32 (new 'stack-no-clear 'vector)) - (project-point-into-poly-2d arg0 arg1 sv-32 arg2) - (set! sv-36 (vector-vector-xz-distance arg2 sv-32)) + (let ((sv-32 (new 'stack-no-clear 'vector))) + (project-point-into-poly-2d arg0 arg1 sv-32 arg2) + (let ((sv-36 (vector-vector-xz-distance arg2 sv-32))) + ) + ) #f ) ) @@ -27,9 +28,9 @@ (none) ) -(defmethod relocate ((this nav-control) (arg0 int)) - (&+! (-> this process) arg0) - (&+! (-> this shape) arg0) +(defmethod relocate ((this nav-control) (offset int)) + (&+! (-> this process) offset) + (&+! (-> this shape) offset) this ) @@ -185,10 +186,10 @@ ;; WARN: Function get-nav-control has a return type of none, but the expression builder found a return statement. (defun get-nav-control ((arg0 process-drawable) (arg1 nav-mesh)) "Given a [[process-drawable]] get the associated [[nav-control]] using either: -- the provided `nav-mesh` arg -- the `nav-mesh` associated with the [[process-drawable]]'s [[entity]] -If no [[nav-mesh]] is set or found, set the [[entity]]'s [[entity-perm-status]] to TODO and return an error. -Note that this doesn't actually return the nav-control, but instead adds this process-drawable to the nav-mesh." + - the provided `nav-mesh` arg + - the `nav-mesh` associated with the [[process-drawable]]'s [[entity]] + If no [[nav-mesh]] is set or found, set the [[entity]]'s [[entity-perm-status]] to TODO and return an error. + Note that this doesn't actually return the nav-control, but instead adds this process-drawable to the nav-mesh." (if (not arg1) (set! arg1 (nav-mesh-from-res-tag (-> arg0 entity) 'nav-mesh-actor 0)) ) @@ -239,50 +240,51 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (defmethod debug-draw ((this nav-control)) - (local-vars (sv-32 nav-mesh) (sv-36 vector)) (when (display-marks? this) (debug-draw (-> this state mesh)) - (set! sv-32 (-> this state mesh)) - (set! sv-36 (new 'stack-no-clear 'vector)) - (if (logtest? (-> this shape nav-flags) (nav-flags has-root-sphere)) - (add-debug-sphere - #t - (bucket-id debug-no-zbuf1) - (-> this root-nav-sphere) - (-> this root-nav-sphere w) - (new 'static 'rgba :g #xff :b #xff :a #x20) - ) - ) - (if (logtest? (-> this shape nav-flags) (nav-flags has-extra-sphere)) - (add-debug-sphere - #t - (bucket-id debug-no-zbuf1) - (-> this extra-nav-sphere) - (-> this extra-nav-sphere w) - (new 'static 'rgba :g #xff :b #xff :a #x20) - ) - ) - (dotimes (s5-0 (-> this sphere-count)) - (let ((v1-19 (-> this state mesh work debug sphere-array s5-0))) - (vector+! sv-36 (-> sv-32 bounds) (the-as vector v1-19)) - (add-debug-sphere - #t - (bucket-id debug-no-zbuf1) - sv-36 - (- (-> v1-19 r) (-> this shape nav-radius)) - (new 'static 'rgba :g #xff :b #xff :a #x20) - ) - ) - ) - (dotimes (s5-1 (the-as int (-> sv-32 static-sphere-count))) - (let ((s4-0 (-> sv-32 static-sphere s5-1))) - (add-debug-sphere #t (bucket-id debug2) s4-0 (-> s4-0 r) *color-blue*) - (let ((s3-0 add-debug-text-3d) - (s2-0 #t) - (s1-0 318) + (let ((sv-32 (-> this state mesh))) + (let ((sv-36 (new 'stack-no-clear 'vector))) + (if (logtest? (-> this shape nav-flags) (nav-flags has-root-sphere)) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (-> this root-nav-sphere) + (-> this root-nav-sphere w) + (new 'static 'rgba :g #xff :b #xff :a #x20) ) - (format (clear *temp-string*) "~D" s5-1) - (s3-0 s2-0 (the-as bucket-id s1-0) *temp-string* s4-0 (font-color cyan) (the-as vector2h #f)) + ) + (if (logtest? (-> this shape nav-flags) (nav-flags has-extra-sphere)) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (-> this extra-nav-sphere) + (-> this extra-nav-sphere w) + (new 'static 'rgba :g #xff :b #xff :a #x20) + ) + ) + (dotimes (s5-0 (-> this sphere-count)) + (let ((v1-19 (-> this state mesh work debug sphere-array s5-0))) + (vector+! sv-36 (-> sv-32 bounds) (the-as vector v1-19)) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + sv-36 + (- (-> v1-19 r) (-> this shape nav-radius)) + (new 'static 'rgba :g #xff :b #xff :a #x20) + ) + ) + ) + ) + (dotimes (s5-1 (the-as int (-> sv-32 static-sphere-count))) + (let ((s4-0 (-> sv-32 static-sphere s5-1))) + (add-debug-sphere #t (bucket-id debug2) s4-0 (-> s4-0 r) *color-blue*) + (let ((s3-0 add-debug-text-3d) + (s2-0 #t) + (s1-0 318) + ) + (format (clear *temp-string*) "~D" s5-1) + (s3-0 s2-0 (the-as bucket-id s1-0) *temp-string* s4-0 (font-color cyan) (the-as vector2h #f)) + ) ) ) ) @@ -348,7 +350,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (defun add-nav-sphere ((nav nav-control) (sphere sphere) (max-spheres int)) "Adds the given [[sphere]] to the [[nav-control]]'s `sphere-array` so long as -`max-spheres` is less than [[nav-control]]'s `sphere-count`" + `max-spheres` is less than [[nav-control]]'s `sphere-count`" (local-vars (a2-4 float)) (rlet ((vf1 :class vf) (vf2 :class vf) @@ -369,10 +371,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (let ((f1-0 a2-4) (f0-1 (+ (-> sphere r) (-> nav shape nav-radius))) ) - (when (and (< 0.0 f1-0) (let ((f2-3 (+ f0-1 (-> nav nav-cull-radius)))) - (< f1-0 (* f2-3 f2-3)) - ) - ) + (when (and (< 0.0 f1-0) (< f1-0 (square (+ f0-1 (-> nav nav-cull-radius))))) (vector-! (the-as vector v1-3) (the-as vector sphere) (-> nav state mesh bounds)) (set! (-> v1-3 r) f0-1) (+! (-> nav sphere-count) 1) @@ -412,10 +411,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (let ((f1-0 t0-4) (f0-2 (+ (-> arg2 r) (-> v1-4 shape nav-radius))) ) - (when (and (< 0.0 f1-0) (let ((f2-3 (+ f0-2 (-> v1-4 nav-cull-radius)))) - (< f1-0 (* f2-3 f2-3)) - ) - ) + (when (and (< 0.0 f1-0) (< f1-0 (square (+ f0-2 (-> v1-4 nav-cull-radius))))) (vector-! (the-as vector a3-5) (the-as vector arg2) (-> v1-4 state mesh bounds)) (set! (-> a3-5 r) f0-2) (+! (-> v1-4 sphere-count) 1) @@ -446,10 +442,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (let ((f1-1 a2-6) (f0-4 (+ (-> a0-1 w) (-> v1-9 shape nav-radius))) ) - (when (and (< 0.0 f1-1) (let ((f2-9 (+ f0-4 (-> v1-9 nav-cull-radius)))) - (< f1-1 (* f2-9 f2-9)) - ) - ) + (when (and (< 0.0 f1-1) (< f1-1 (square (+ f0-4 (-> v1-9 nav-cull-radius))))) (vector-! (the-as vector a1-5) a0-1 (-> v1-9 state mesh bounds)) (set! (-> a1-5 r) f0-4) (+! (-> v1-9 sphere-count) 1) @@ -572,10 +565,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (let* ((f0-5 (-> arg1 w)) (f1-1 (vector-dot t0-0 t1-0)) (f0-6 (fmin f0-5 f1-1)) - (f2-0 f1-1) - (f2-2 (* f2-0 f2-0)) - (f3-0 f0-6) - (f2-4 (sqrtf (- f2-2 (* f3-0 f3-0)))) + (f2-4 (sqrtf (- (square f1-1) (square f0-6)))) (f3-4 (/ 1.0 f1-1)) (f1-3 (* f2-4 f3-4)) (f0-7 (* f0-6 f3-4)) @@ -622,19 +612,13 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (let ((f2-7 (+ (* (-> arg1 x) f1-1) (* (-> arg1 z) f0-2)))) (cond ((< f2-7 0.0) - (let ((f0-5 (+ (* f1-1 f1-1) (* f0-2 f0-2))) - (f1-4 (-> arg3 w)) - ) - (< f0-5 (* f1-4 f1-4)) - ) + (< (+ (square f1-1) (square f0-2)) (square (-> arg3 w))) ) ((< arg2 f2-7) - (let* ((f0-8 (- (-> arg3 x) (+ (-> arg0 x) (* (-> arg1 x) arg2)))) - (f1-10 (- (-> arg3 z) (+ (-> arg0 z) (* (-> arg1 z) arg2)))) - (f0-11 (+ (* f0-8 f0-8) (* f1-10 f1-10))) - (f1-13 (-> arg3 w)) - ) - (< f0-11 (* f1-13 f1-13)) + (let ((f0-8 (- (-> arg3 x) (+ (-> arg0 x) (* (-> arg1 x) arg2)))) + (f1-10 (- (-> arg3 z) (+ (-> arg0 z) (* (-> arg1 z) arg2)))) + ) + (< (+ (square f0-8) (square f1-10)) (square (-> arg3 w))) ) ) (else @@ -666,19 +650,13 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (let ((f3-7 (+ (* (-> t3-1 x) f2-1) (* (-> t3-1 z) f1-2)))) (cond ((< f3-7 0.0) - (let ((f0-5 (+ (* f2-1 f2-1) (* f1-2 f1-2))) - (f1-5 (-> t2-6 w)) - ) - (< f0-5 (* f1-5 f1-5)) - ) + (< (+ (square f2-1) (square f1-2)) (square (-> t2-6 w))) ) ((< f0-2 f3-7) - (let* ((f1-9 (- (-> t2-6 x) (+ (-> t4-0 x) (* (-> t3-1 x) f0-2)))) - (f2-5 (- (-> t2-6 z) (+ (-> t4-0 z) (* (-> t3-1 z) f0-2)))) - (f0-10 (+ (* f1-9 f1-9) (* f2-5 f2-5))) - (f1-12 (-> t2-6 w)) - ) - (< f0-10 (* f1-12 f1-12)) + (let ((f1-9 (- (-> t2-6 x) (+ (-> t4-0 x) (* (-> t3-1 x) f0-2)))) + (f2-5 (- (-> t2-6 z) (+ (-> t4-0 z) (* (-> t3-1 z) f0-2)))) + ) + (< (+ (square f1-9) (square f2-5)) (square (-> t2-6 w))) ) ) (else @@ -757,9 +735,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (set! (-> s5-0 initial-ignore-mask) (the-as uint 0)) (set! (-> s5-0 i-inside-sphere) -1) (set! (-> s5-0 inside-sphere-dist) 0.0) - (let ((f0-10 65536.0)) - (set! (-> arg0 closest-sphere-dist2) (* f0-10 f0-10)) - ) + (set! (-> arg0 closest-sphere-dist2) (square 65536.0)) (dotimes (v1-10 (-> this sphere-count)) (let ((a0-13 (-> this sphere-array v1-10))) (let ((a1-2 (-> arg0 current-pos)) @@ -773,16 +749,13 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (.add.z.vf.x vf1 vf1 vf1) (.mov a1-3 vf1) (set! (-> s5-0 dist2) a1-3) - (let ((f0-14 (-> arg0 closest-sphere-dist2)) - (f1-0 (-> s5-0 dist2)) - (f2-0 (-> a0-13 r)) + (set! (-> arg0 closest-sphere-dist2) + (fmin (-> arg0 closest-sphere-dist2) (- (-> s5-0 dist2) (square (-> a0-13 r)))) ) - (set! (-> arg0 closest-sphere-dist2) (fmin f0-14 (- f1-0 (* f2-0 f2-0)))) - ) (when (< (-> arg0 closest-sphere-dist2) 0.0) - (vector-! (the-as vector (-> s5-0 temp-dir)) (-> arg0 current-pos) (the-as vector a0-13)) + (vector-! (-> s5-0 temp-dir 0) (-> arg0 current-pos) (the-as vector a0-13)) (set! (-> s5-0 temp-dir 0 y) 0.0) - (if (< 0.0 (vector-dot (the-as vector (-> s5-0 temp-dir)) (-> s5-0 in-dir))) + (if (< 0.0 (vector-dot (-> s5-0 temp-dir 0) (-> s5-0 in-dir))) (+! (-> s5-0 initial-ignore-mask) (ash 1 v1-10)) ) (set! (-> s5-0 inside-dist) (- (-> a0-13 r) (sqrtf (-> s5-0 dist2)))) @@ -812,12 +785,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (label cfg-13) (+! (-> s5-0 initial-ignore-mask) (ash 1 (-> s5-0 i-first-sphere))) (let ((a1-17 (-> this sphere-array (-> s5-0 i-first-sphere)))) - (circle-tangent-directions - (-> arg0 current-pos) - a1-17 - (the-as vector (-> s5-0 temp-dir)) - (-> s5-0 temp-dir 1) - ) + (circle-tangent-directions (-> arg0 current-pos) a1-17 (-> s5-0 temp-dir 0) (-> s5-0 temp-dir 1)) ) (dotimes (v1-20 2) (let ((a0-28 (vector-dot (-> s5-0 right-dir) (-> s5-0 temp-dir v1-20)))) @@ -844,7 +812,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (circle-tangent-directions (-> arg0 current-pos) (-> this sphere-array v1-28) - (the-as vector (-> s5-0 temp-dir)) + (-> s5-0 temp-dir 0) (-> s5-0 temp-dir 1) ) (set! (-> s5-0 dir-update) #f) @@ -990,9 +958,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (.svf (&-> v1-55 quad) vf1) ) ) - (vector-dot (-> s5-0 in-dir) (the-as vector (-> s5-0 best-dir))) + (vector-dot (-> s5-0 in-dir) (-> s5-0 best-dir 0)) (vector-dot (-> s5-0 in-dir) (-> s5-0 best-dir 1)) - (let* ((f0-52 (vector-dot (-> arg0 pref-dir) (the-as vector (-> s5-0 best-dir)))) + (let* ((f0-52 (vector-dot (-> arg0 pref-dir) (-> s5-0 best-dir 0))) (a1-41 (if (< (vector-dot (-> arg0 pref-dir) (-> s5-0 best-dir 1)) f0-52) 0 1 @@ -1000,7 +968,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (v1-65 (- 1 a1-41)) ) - (vector-float*! (the-as vector (-> arg0 out-travel)) (-> s5-0 best-dir a1-41) (-> s5-0 travel-len)) + (vector-float*! (-> arg0 out-travel 0) (-> s5-0 best-dir a1-41) (-> s5-0 travel-len)) (vector-float*! (-> arg0 out-travel 1) (-> s5-0 best-dir v1-65) (-> s5-0 travel-len)) ) ) @@ -1052,9 +1020,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (set! (-> s5-0 best-dir-angle 0) 0.0) (set! (-> s5-0 best-dir-angle 1) 0.0) (set! (-> s5-0 initial-ignore-mask) (the-as uint 0)) - (let ((f0-9 65536.0)) - (set! (-> arg0 closest-sphere-dist2) (* f0-9 f0-9)) - ) + (set! (-> arg0 closest-sphere-dist2) (square 65536.0)) (dotimes (v1-9 (-> this sphere-count)) (let ((a0-13 (-> this sphere-array v1-9))) (let ((a1-2 (-> arg0 current-pos)) @@ -1068,16 +1034,13 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (.add.z.vf.x vf1 vf1 vf1) (.mov a1-3 vf1) (set! (-> s5-0 dist2) a1-3) - (let ((f0-13 (-> arg0 closest-sphere-dist2)) - (f1-0 (-> s5-0 dist2)) - (f2-0 (-> a0-13 r)) + (set! (-> arg0 closest-sphere-dist2) + (fmin (-> arg0 closest-sphere-dist2) (- (-> s5-0 dist2) (square (-> a0-13 r)))) ) - (set! (-> arg0 closest-sphere-dist2) (fmin f0-13 (- f1-0 (* f2-0 f2-0)))) - ) (when (< (-> arg0 closest-sphere-dist2) 0.0) - (vector-! (the-as vector (-> s5-0 temp-dir)) (-> arg0 current-pos) (the-as vector a0-13)) + (vector-! (-> s5-0 temp-dir 0) (-> arg0 current-pos) (the-as vector a0-13)) (set! (-> s5-0 temp-dir 0 y) 0.0) - (if (< 0.0 (vector-dot (the-as vector (-> s5-0 temp-dir)) (-> s5-0 in-dir))) + (if (< 0.0 (vector-dot (-> s5-0 temp-dir 0) (-> s5-0 in-dir))) (+! (-> s5-0 initial-ignore-mask) (ash 1 v1-9)) ) ) @@ -1102,12 +1065,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (label cfg-11) (+! (-> s5-0 initial-ignore-mask) (ash 1 (-> s5-0 i-first-sphere))) (let ((a1-15 (-> this sphere-array (-> s5-0 i-first-sphere)))) - (circle-tangent-directions - (-> arg0 current-pos) - a1-15 - (the-as vector (-> s5-0 temp-dir)) - (-> s5-0 temp-dir 1) - ) + (circle-tangent-directions (-> arg0 current-pos) a1-15 (-> s5-0 temp-dir 0) (-> s5-0 temp-dir 1)) ) (dotimes (v1-19 2) (let ((a0-31 (vector-dot (-> s5-0 right-dir) (-> s5-0 temp-dir v1-19)))) @@ -1121,9 +1079,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) ) 0 - (vector-dot (-> s5-0 in-dir) (the-as vector (-> s5-0 best-dir))) + (vector-dot (-> s5-0 in-dir) (-> s5-0 best-dir 0)) (vector-dot (-> s5-0 in-dir) (-> s5-0 best-dir 1)) - (let* ((f0-28 (vector-dot (-> arg0 pref-dir) (the-as vector (-> s5-0 best-dir)))) + (let* ((f0-28 (vector-dot (-> arg0 pref-dir) (-> s5-0 best-dir 0))) (a1-25 (if (< (vector-dot (-> arg0 pref-dir) (-> s5-0 best-dir 1)) f0-28) 0 1 @@ -1131,7 +1089,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (v1-32 (- 1 a1-25)) ) - (vector-float*! (the-as vector (-> arg0 out-travel)) (-> s5-0 best-dir a1-25) (-> s5-0 travel-len)) + (vector-float*! (-> arg0 out-travel 0) (-> s5-0 best-dir a1-25) (-> s5-0 travel-len)) (vector-float*! (-> arg0 out-travel 1) (-> s5-0 best-dir v1-32) (-> s5-0 travel-len)) ) ) @@ -1154,33 +1112,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (defmethod clamp-vector-to-mesh-no-gaps ((this nav-mesh) (arg0 vector) (arg1 nav-poly) (arg2 vector) (arg3 clamp-travel-vector-to-mesh-return-info)) - (local-vars - (v1-12 symbol) - (sv-112 nav-ray) - (sv-116 vector) - (sv-120 symbol) - (sv-124 nav-mesh-work) - (sv-128 int) - (sv-136 int) - (sv-144 nav-mesh-work) - (sv-148 nav-poly) - (sv-152 uint) - (sv-156 (pointer int8)) - (sv-160 (pointer int8)) - (sv-164 float) - (sv-168 float) - (sv-172 vector) - (sv-176 vector) - (sv-180 float) - (sv-184 float) - (sv-188 uint) - (sv-192 vector) - (sv-196 vector) - (sv-200 float) - (sv-204 float) - (sv-208 float) - (sv-212 float) - ) + (local-vars (v1-12 symbol)) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -1191,180 +1123,193 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (init-vf0-vector) (set! (-> arg3 found-boundary) #f) (set! (-> arg3 gap-poly) #f) - (set! sv-112 (new 'stack-no-clear 'nav-ray)) - (set! sv-116 (new 'stack-no-clear 'vector)) - (set! sv-120 (the-as symbol #f)) - (set! sv-124 (-> this work)) - (vector-! sv-116 arg0 (-> this bounds)) - (set! (-> sv-112 current-poly) arg1) - (set! (-> sv-112 current-pos quad) (-> sv-116 quad)) - (vector+! (-> sv-112 dest-pos) sv-116 arg2) - (let* ((t2-0 this) - (v1-11 (-> sv-112 dest-pos)) - (a1-4 (-> arg1 vertex-count)) - (a2-1 (-> arg1 vertex)) - (t1-4 (-> t2-0 work vert0-table)) - (t2-2 (-> t2-0 work vert1-table)) - ) - (dotimes (t3-0 (the-as int a1-4)) - (let* ((t4-3 (-> a2-1 (-> t1-4 t3-0))) - (t5-3 (-> a2-1 (-> t2-2 t3-0))) - (f0-1 (- (-> t4-3 z) (-> t5-3 z))) - (f1-2 (- (-> t5-3 x) (-> t4-3 x))) - (f2-2 (- (-> v1-11 x) (-> t4-3 x))) - (f3-2 (- (-> v1-11 z) (-> t4-3 z))) - (f0-3 (+ (* f2-2 f0-1) (* f3-2 f1-2))) + (let ((sv-112 (new 'stack-no-clear 'nav-ray)) + (sv-116 (new 'stack-no-clear 'vector)) + ) + (let ((sv-120 (the-as symbol #f))) + ) + (let ((sv-124 (-> this work))) + (vector-! sv-116 arg0 (-> this bounds)) + (set! (-> sv-112 current-poly) arg1) + (set! (-> sv-112 current-pos quad) (-> sv-116 quad)) + (vector+! (-> sv-112 dest-pos) sv-116 arg2) + (let* ((t2-0 this) + (v1-11 (-> sv-112 dest-pos)) + (a1-4 (-> arg1 vertex-count)) + (a2-1 (-> arg1 vertex)) + (t1-4 (-> t2-0 work vert0-table)) + (t2-2 (-> t2-0 work vert1-table)) ) - (when (< 0.0 f0-3) - (set! v1-12 #f) - (goto cfg-7) + (dotimes (t3-0 (the-as int a1-4)) + (let* ((t4-3 (-> a2-1 (-> t1-4 t3-0))) + (t5-3 (-> a2-1 (-> t2-2 t3-0))) + (f0-1 (- (-> t4-3 z) (-> t5-3 z))) + (f1-2 (- (-> t5-3 x) (-> t4-3 x))) + (f2-2 (- (-> v1-11 x) (-> t4-3 x))) + (f3-2 (- (-> v1-11 z) (-> t4-3 z))) + (f0-3 (+ (* f2-2 f0-1) (* f3-2 f1-2))) + ) + (when (< 0.0 f0-3) + (set! v1-12 #f) + (goto cfg-7) + ) + ) ) ) - ) - ) - (set! v1-12 #t) - (label cfg-7) - (b! v1-12 cfg-41 :delay (nop!)) - (set! sv-128 0) - (let ((v1-16 sv-112)) - (vector-! (-> v1-16 dir) (-> v1-16 dest-pos) (-> v1-16 current-pos)) - (set! (-> v1-16 dir y) 0.0) - (let ((a1-6 (-> v1-16 dir))) - (let ((f0-5 1.0)) - (.lvf vf1 (&-> a1-6 quad)) - (.mul.vf.xyz vf2 vf1 vf1) - (let ((a2-4 f0-5)) - (.mov vf3 a2-4) + (set! v1-12 #t) + (label cfg-7) + (b! v1-12 cfg-41 :delay (nop!)) + (let ((sv-128 0)) + (let ((v1-16 sv-112)) + (vector-! (-> v1-16 dir) (-> v1-16 dest-pos) (-> v1-16 current-pos)) + (set! (-> v1-16 dir y) 0.0) + (let ((a1-6 (-> v1-16 dir))) + (let ((f0-5 1.0)) + (.lvf vf1 (&-> a1-6 quad)) + (.mul.vf.xyz vf2 vf1 vf1) + (let ((a2-4 f0-5)) + (.mov vf3 a2-4) + ) + ) + (.mul.x.vf.w acc vf0 vf2) + (.add.mul.y.vf.w acc vf0 vf2 acc) + (.add.mul.z.vf.w vf2 vf0 vf2 acc) + (.isqrt.vf Q vf3 vf2 :fsf #b0 :ftf #b11) + (.wait.vf) + (.mul.vf.xyz vf1 vf1 Q) + (.nop.vf) + (.nop.vf) + (.nop.vf) + (.svf (&-> a1-6 quad) vf1) + ) + (set! (-> v1-16 next-poly) #f) + (set! (-> v1-16 len) 0.0) + (set! (-> v1-16 last-edge) -1) + (set! (-> v1-16 terminated) #f) + (set! (-> v1-16 reached-dest) #f) + (set! (-> v1-16 hit-boundary) #f) + (set! (-> v1-16 hit-gap) #f) + (set! (-> v1-16 ignore) (the-as uint 3)) ) - ) - (.mul.x.vf.w acc vf0 vf2) - (.add.mul.y.vf.w acc vf0 vf2 acc) - (.add.mul.z.vf.w vf2 vf0 vf2 acc) - (.isqrt.vf Q vf3 vf2 :fsf #b0 :ftf #b11) - (.wait.vf) - (.mul.vf.xyz vf1 vf1 Q) - (.nop.vf) - (.nop.vf) - (.nop.vf) - (.svf (&-> a1-6 quad) vf1) - ) - (set! (-> v1-16 next-poly) #f) - (set! (-> v1-16 len) 0.0) - (set! (-> v1-16 last-edge) -1) - (set! (-> v1-16 terminated) #f) - (set! (-> v1-16 reached-dest) #f) - (set! (-> v1-16 hit-boundary) #f) - (set! (-> v1-16 hit-gap) #f) - (set! (-> v1-16 ignore) (the-as uint 3)) - ) - 0 - (until (or (>= sv-128 15) (-> sv-112 terminated)) - (set! sv-128 (+ sv-128 1)) - (let ((a1-9 this) - (v1-20 sv-112) - ) - (set! sv-136 -1) - (set! sv-144 (-> a1-9 work)) - (set! sv-148 (-> v1-20 current-poly)) - (set! sv-152 (-> v1-20 current-poly vertex-count)) - (set! sv-156 (-> a1-9 work vert0-table)) - (set! sv-160 (-> a1-9 work vert1-table)) - (set! sv-164 (- (-> v1-20 dest-pos x) (-> v1-20 current-pos x))) - (set! sv-168 (- (-> v1-20 dest-pos z) (-> v1-20 current-pos z))) - (dotimes (a2-14 (the-as int sv-152)) - (set! sv-172 (-> sv-148 vertex (-> sv-156 a2-14))) - (set! sv-176 (-> sv-148 vertex (-> sv-160 a2-14))) - (set! sv-180 (- (-> sv-172 z) (-> sv-176 z))) - (set! sv-184 (- (-> sv-176 x) (-> sv-172 x))) - (let ((f0-17 (+ (* sv-164 sv-180) (* sv-168 sv-184)))) - (when (< 0.0 f0-17) - (let ((f1-15 (+ (* sv-180 (- (-> sv-172 x) (-> v1-20 current-pos x))) - (* sv-184 (- (-> sv-172 z) (-> v1-20 current-pos z))) - ) - ) + 0 + (until (or (>= sv-128 15) (-> sv-112 terminated)) + (+! sv-128 1) + (let ((a1-9 this) + (v1-20 sv-112) + (sv-136 -1) + ) + (let ((sv-144 (-> a1-9 work))) + ) + (let ((sv-148 (-> v1-20 current-poly)) + (sv-152 (-> v1-20 current-poly vertex-count)) + (sv-156 (-> a1-9 work vert0-table)) + (sv-160 (-> a1-9 work vert1-table)) + (sv-164 (- (-> v1-20 dest-pos x) (-> v1-20 current-pos x))) + (sv-168 (- (-> v1-20 dest-pos z) (-> v1-20 current-pos z))) ) - (when (< f1-15 f0-17) - (set! sv-136 a2-14) - (let ((f0-19 (fmax 0.0 (/ f1-15 f0-17)))) - (set! sv-164 (* sv-164 f0-19)) - (set! sv-168 (* sv-168 f0-19)) + (dotimes (a2-14 (the-as int sv-152)) + (let* ((sv-172 (-> sv-148 vertex (-> sv-156 a2-14))) + (sv-176 (-> sv-148 vertex (-> sv-160 a2-14))) + (sv-180 (- (-> sv-172 z) (-> sv-176 z))) + (sv-184 (- (-> sv-176 x) (-> sv-172 x))) + (f0-17 (+ (* sv-164 sv-180) (* sv-168 sv-184))) + ) + (when (< 0.0 f0-17) + (let ((f1-15 (+ (* sv-180 (- (-> sv-172 x) (-> v1-20 current-pos x))) + (* sv-184 (- (-> sv-172 z) (-> v1-20 current-pos z))) + ) + ) + ) + (when (< f1-15 f0-17) + (set! sv-136 a2-14) + (let ((f0-19 (fmax 0.0 (/ f1-15 f0-17)))) + (set! sv-164 (* sv-164 f0-19)) + (set! sv-168 (* sv-168 f0-19)) + ) + ) + ) + ) + ) + ) + (let ((f0-23 (+ (* sv-164 (-> v1-20 dir x)) (* sv-168 (-> v1-20 dir z))))) + (+! (-> v1-20 len) f0-23) + ) + 0 + (set! (-> v1-20 next-poly) #f) + (cond + ((= sv-136 -1) + (set! (-> v1-20 current-pos quad) (-> v1-20 dest-pos quad)) + (set! (-> v1-20 reached-dest) #t) + (set! (-> v1-20 terminated) #t) + ) + (else + (+! (-> v1-20 current-pos x) sv-164) + (+! (-> v1-20 current-pos z) sv-168) + (let ((sv-188 (-> sv-148 adj-poly sv-136))) + (if (!= sv-188 255) + (set! (-> v1-20 next-poly) (-> a1-9 poly-array sv-188)) + ) + ) + (cond + ((and (-> v1-20 next-poly) (not (logtest? (-> v1-20 next-poly pat) (-> v1-20 ignore)))) + (set! (-> v1-20 current-poly) (-> v1-20 next-poly)) + ) + (else + (set! (-> v1-20 last-edge) sv-136) + (if (-> v1-20 next-poly) + (set! (-> v1-20 hit-gap) #t) + (set! (-> v1-20 hit-boundary) #t) + ) + (set! (-> v1-20 terminated) #t) + ) + ) ) ) ) ) + 0 ) ) - (let ((f0-23 (+ (* sv-164 (-> v1-20 dir x)) (* sv-168 (-> v1-20 dir z))))) - (+! (-> v1-20 len) f0-23) - ) - 0 - (set! (-> v1-20 next-poly) #f) (cond - ((= sv-136 -1) - (set! (-> v1-20 current-pos quad) (-> v1-20 dest-pos quad)) - (set! (-> v1-20 reached-dest) #t) - (set! (-> v1-20 terminated) #t) + ((or (-> sv-112 hit-boundary) (-> sv-112 hit-gap)) + (let ((sv-192 (-> sv-112 current-poly vertex (-> sv-124 vert0-table (-> sv-112 last-edge)))) + (sv-196 (-> sv-112 current-poly vertex (-> sv-124 vert1-table (-> sv-112 last-edge)))) + ) + (let ((sv-200 (- (-> sv-192 z) (-> sv-196 z))) + (sv-204 (- (-> sv-196 x) (-> sv-192 x))) + ) + (let ((sv-208 (-> arg2 x))) + ) + (let ((sv-212 (-> arg2 z))) + ) + (let* ((f0-39 (sqrtf (+ (square sv-200) (square sv-204)))) + (f0-41 (/ 1.0 f0-39)) + ) + (set! sv-200 (* sv-200 f0-41)) + (set! sv-204 (* sv-204 f0-41)) + ) + (set! (-> arg3 found-boundary) #t) + (vector+! (-> arg3 intersection) (-> sv-112 current-pos) (-> this bounds)) + (set! (-> arg3 boundary-normal x) sv-200) + (set! (-> arg3 boundary-normal y) 0.0) + (set! (-> arg3 boundary-normal z) sv-204) + ) + (set! (-> arg3 poly) (-> sv-112 current-poly)) + (set! (-> arg3 edge) (-> sv-112 last-edge)) + (vector+! (-> arg3 vert-0) sv-192 (-> this bounds)) + (vector+! (-> arg3 vert-1) sv-196 (-> this bounds)) + ) + (set! (-> sv-112 dest-pos quad) (-> sv-112 current-pos quad)) + (if (-> sv-112 hit-gap) + (set! (-> arg3 gap-poly) (-> sv-112 next-poly)) + ) ) (else - (+! (-> v1-20 current-pos x) sv-164) - (+! (-> v1-20 current-pos z) sv-168) - (set! sv-188 (-> sv-148 adj-poly sv-136)) - (if (!= sv-188 255) - (set! (-> v1-20 next-poly) (-> a1-9 poly-array sv-188)) - ) - (cond - ((and (-> v1-20 next-poly) (not (logtest? (-> v1-20 next-poly pat) (-> v1-20 ignore)))) - (set! (-> v1-20 current-poly) (-> v1-20 next-poly)) - ) - (else - (set! (-> v1-20 last-edge) sv-136) - (if (-> v1-20 next-poly) - (set! (-> v1-20 hit-gap) #t) - (set! (-> v1-20 hit-boundary) #t) - ) - (set! (-> v1-20 terminated) #t) - ) - ) ) ) ) - 0 + (vector-! arg2 (-> sv-112 current-pos) sv-116) ) - (cond - ((or (-> sv-112 hit-boundary) (-> sv-112 hit-gap)) - (set! sv-192 (-> sv-112 current-poly vertex (-> sv-124 vert0-table (-> sv-112 last-edge)))) - (set! sv-196 (-> sv-112 current-poly vertex (-> sv-124 vert1-table (-> sv-112 last-edge)))) - (set! sv-200 (- (-> sv-192 z) (-> sv-196 z))) - (set! sv-204 (- (-> sv-196 x) (-> sv-192 x))) - (set! sv-208 (-> arg2 x)) - (set! sv-212 (-> arg2 z)) - (let* ((f0-35 sv-200) - (f0-37 (* f0-35 f0-35)) - (f1-27 sv-204) - (f0-39 (sqrtf (+ f0-37 (* f1-27 f1-27)))) - (f0-41 (/ 1.0 f0-39)) - ) - (set! sv-200 (* sv-200 f0-41)) - (set! sv-204 (* sv-204 f0-41)) - ) - (set! (-> arg3 found-boundary) #t) - (vector+! (-> arg3 intersection) (-> sv-112 current-pos) (-> this bounds)) - (set! (-> arg3 boundary-normal x) sv-200) - (set! (-> arg3 boundary-normal y) 0.0) - (set! (-> arg3 boundary-normal z) sv-204) - (set! (-> arg3 poly) (-> sv-112 current-poly)) - (set! (-> arg3 edge) (-> sv-112 last-edge)) - (vector+! (-> arg3 vert-0) sv-192 (-> this bounds)) - (vector+! (-> arg3 vert-1) sv-196 (-> this bounds)) - (set! (-> sv-112 dest-pos quad) (-> sv-112 current-pos quad)) - (if (-> sv-112 hit-gap) - (set! (-> arg3 gap-poly) (-> sv-112 next-poly)) - ) - ) - (else - ) - ) - (vector-! arg2 (-> sv-112 current-pos) sv-116) 0 (label cfg-41) 0 @@ -1375,15 +1320,14 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ;; WARN: Return type mismatch object vs none. ;; WARN: Function (method 21 nav-mesh) has a return type of none, but the expression builder found a return statement. (defmethod find-adjacent-bounds-one ((this nav-mesh) (arg0 vector) (arg1 nav-poly) (arg2 int) (arg3 int)) - (local-vars (sv-16 nav-poly)) (if (zero? arg3) (set! arg2 (the-as int (mod (the-as uint (+ arg2 1)) (-> arg1 vertex-count)))) ) - (set! sv-16 arg1) - (let ((s2-0 (-> sv-16 vertex arg2)) - (s3-0 sv-16) - (s1-0 100) - ) + (let* ((sv-16 arg1) + (s2-0 (-> sv-16 vertex arg2)) + (s3-0 sv-16) + (s1-0 100) + ) (while (begin (label cfg-21) (nonzero? s1-0)) (+! s1-0 -1) (if (nonzero? arg3) @@ -1450,34 +1394,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (arg4 symbol) (arg5 clamp-travel-vector-to-mesh-return-info) ) - (local-vars - (v1-11 symbol) - (v1-22 symbol) - (sv-96 nav-ray) - (sv-100 symbol) - (sv-104 int) - (sv-112 nav-mesh-work) - (sv-120 int) - (sv-128 int) - (sv-136 nav-mesh-work) - (sv-140 nav-poly) - (sv-144 uint) - (sv-148 (pointer int8)) - (sv-152 (pointer int8)) - (sv-156 float) - (sv-160 float) - (sv-164 vector) - (sv-168 vector) - (sv-172 float) - (sv-176 float) - (sv-180 uint) - (sv-184 vector) - (sv-188 vector) - (sv-192 float) - (sv-196 float) - (sv-200 float) - (sv-204 float) - ) + (local-vars (v1-11 symbol) (v1-22 symbol)) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -1490,203 +1407,218 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (set! (-> arg5 found-boundary) #f) (set! (-> arg5 gap-poly) #f) ) - (set! sv-96 (new 'stack-no-clear 'nav-ray)) - (set! sv-100 (the-as symbol #f)) - (set! sv-104 0) - (set! sv-112 (-> this work)) - (set! (-> sv-96 current-poly) arg1) - (set! (-> sv-96 current-pos quad) (-> arg0 quad)) - (vector+! (-> sv-96 dest-pos) arg0 arg2) - (let* ((t6-0 this) - (t4-2 arg1) - (v1-10 (-> sv-96 dest-pos)) - (t3-3 (-> t4-2 vertex-count)) - (t4-3 (-> t4-2 vertex)) - (t5-1 (-> t6-0 work vert0-table)) - (t6-2 (-> t6-0 work vert1-table)) - ) - (dotimes (t7-0 (the-as int t3-3)) - (let* ((t8-3 (-> t4-3 (-> t5-1 t7-0))) - (t9-3 (-> t4-3 (-> t6-2 t7-0))) - (f0-1 (- (-> t8-3 z) (-> t9-3 z))) - (f1-2 (- (-> t9-3 x) (-> t8-3 x))) - (f2-2 (- (-> v1-10 x) (-> t8-3 x))) - (f3-2 (- (-> v1-10 z) (-> t8-3 z))) - (f0-3 (+ (* f2-2 f0-1) (* f3-2 f1-2))) + (let ((sv-96 (new 'stack-no-clear 'nav-ray))) + (let ((sv-100 (the-as symbol #f)) + (sv-104 0) + (sv-112 (-> this work)) + ) + (set! (-> sv-96 current-poly) arg1) + (set! (-> sv-96 current-pos quad) (-> arg0 quad)) + (vector+! (-> sv-96 dest-pos) arg0 arg2) + (let* ((t6-0 this) + (t4-2 arg1) + (v1-10 (-> sv-96 dest-pos)) + (t3-3 (-> t4-2 vertex-count)) + (t4-3 (-> t4-2 vertex)) + (t5-1 (-> t6-0 work vert0-table)) + (t6-2 (-> t6-0 work vert1-table)) ) - (when (< 0.0 f0-3) - (set! v1-11 #f) - (goto cfg-9) - ) - ) - ) - ) - (set! v1-11 #t) - (label cfg-9) - (b! v1-11 cfg-62 :delay (nop!)) - (until sv-100 - (set! sv-120 0) - (let ((v1-15 sv-96)) - (vector-! (-> v1-15 dir) (-> v1-15 dest-pos) (-> v1-15 current-pos)) - (set! (-> v1-15 dir y) 0.0) - (let ((t3-5 (-> v1-15 dir))) - (let ((f0-5 1.0)) - (.lvf vf1 (&-> t3-5 quad)) - (.mul.vf.xyz vf2 vf1 vf1) - (let ((t4-6 f0-5)) - (.mov vf3 t4-6) + (dotimes (t7-0 (the-as int t3-3)) + (let* ((t8-3 (-> t4-3 (-> t5-1 t7-0))) + (t9-3 (-> t4-3 (-> t6-2 t7-0))) + (f0-1 (- (-> t8-3 z) (-> t9-3 z))) + (f1-2 (- (-> t9-3 x) (-> t8-3 x))) + (f2-2 (- (-> v1-10 x) (-> t8-3 x))) + (f3-2 (- (-> v1-10 z) (-> t8-3 z))) + (f0-3 (+ (* f2-2 f0-1) (* f3-2 f1-2))) + ) + (when (< 0.0 f0-3) + (set! v1-11 #f) + (goto cfg-9) + ) ) ) - (.mul.x.vf.w acc vf0 vf2) - (.add.mul.y.vf.w acc vf0 vf2 acc) - (.add.mul.z.vf.w vf2 vf0 vf2 acc) - (.isqrt.vf Q vf3 vf2 :fsf #b0 :ftf #b11) - (.wait.vf) - (.mul.vf.xyz vf1 vf1 Q) - (.nop.vf) - (.nop.vf) - (.nop.vf) - (.svf (&-> t3-5 quad) vf1) ) - (set! (-> v1-15 next-poly) #f) - (set! (-> v1-15 len) 0.0) - (set! (-> v1-15 last-edge) -1) - (set! (-> v1-15 terminated) #f) - (set! (-> v1-15 reached-dest) #f) - (set! (-> v1-15 hit-boundary) #f) - (set! (-> v1-15 hit-gap) #f) - (set! (-> v1-15 ignore) (the-as uint 3)) - ) - 0 - (until v1-22 - (set! sv-120 (+ sv-120 1)) - (let ((t3-8 this) - (v1-19 sv-96) + (set! v1-11 #t) + (label cfg-9) + (b! v1-11 cfg-62 :delay (nop!)) + (until sv-100 + (let ((sv-120 0)) + (let ((v1-15 sv-96)) + (vector-! (-> v1-15 dir) (-> v1-15 dest-pos) (-> v1-15 current-pos)) + (set! (-> v1-15 dir y) 0.0) + (let ((t3-5 (-> v1-15 dir))) + (let ((f0-5 1.0)) + (.lvf vf1 (&-> t3-5 quad)) + (.mul.vf.xyz vf2 vf1 vf1) + (let ((t4-6 f0-5)) + (.mov vf3 t4-6) + ) + ) + (.mul.x.vf.w acc vf0 vf2) + (.add.mul.y.vf.w acc vf0 vf2 acc) + (.add.mul.z.vf.w vf2 vf0 vf2 acc) + (.isqrt.vf Q vf3 vf2 :fsf #b0 :ftf #b11) + (.wait.vf) + (.mul.vf.xyz vf1 vf1 Q) + (.nop.vf) + (.nop.vf) + (.nop.vf) + (.svf (&-> t3-5 quad) vf1) + ) + (set! (-> v1-15 next-poly) #f) + (set! (-> v1-15 len) 0.0) + (set! (-> v1-15 last-edge) -1) + (set! (-> v1-15 terminated) #f) + (set! (-> v1-15 reached-dest) #f) + (set! (-> v1-15 hit-boundary) #f) + (set! (-> v1-15 hit-gap) #f) + (set! (-> v1-15 ignore) (the-as uint 3)) ) - (set! sv-128 -1) - (set! sv-136 (-> t3-8 work)) - (set! sv-140 (-> v1-19 current-poly)) - (set! sv-144 (-> v1-19 current-poly vertex-count)) - (set! sv-148 (-> t3-8 work vert0-table)) - (set! sv-152 (-> t3-8 work vert1-table)) - (set! sv-156 (- (-> v1-19 dest-pos x) (-> v1-19 current-pos x))) - (set! sv-160 (- (-> v1-19 dest-pos z) (-> v1-19 current-pos z))) - (dotimes (t4-16 (the-as int sv-144)) - (set! sv-164 (-> sv-140 vertex (-> sv-148 t4-16))) - (set! sv-168 (-> sv-140 vertex (-> sv-152 t4-16))) - (set! sv-172 (- (-> sv-164 z) (-> sv-168 z))) - (set! sv-176 (- (-> sv-168 x) (-> sv-164 x))) - (let ((f0-17 (+ (* sv-156 sv-172) (* sv-160 sv-176)))) - (when (< 0.0 f0-17) - (let ((f1-15 (+ (* sv-172 (- (-> sv-164 x) (-> v1-19 current-pos x))) - (* sv-176 (- (-> sv-164 z) (-> v1-19 current-pos z))) - ) - ) + 0 + (until v1-22 + (+! sv-120 1) + (let ((t3-8 this) + (v1-19 sv-96) + (sv-128 -1) + ) + (let ((sv-136 (-> t3-8 work))) + ) + (let ((sv-140 (-> v1-19 current-poly)) + (sv-144 (-> v1-19 current-poly vertex-count)) + (sv-148 (-> t3-8 work vert0-table)) + (sv-152 (-> t3-8 work vert1-table)) + (sv-156 (- (-> v1-19 dest-pos x) (-> v1-19 current-pos x))) + (sv-160 (- (-> v1-19 dest-pos z) (-> v1-19 current-pos z))) ) - (when (< f1-15 f0-17) - (set! sv-128 t4-16) - (let ((f0-19 (fmax 0.0 (/ f1-15 f0-17)))) - (set! sv-156 (* sv-156 f0-19)) - (set! sv-160 (* sv-160 f0-19)) + (dotimes (t4-16 (the-as int sv-144)) + (let* ((sv-164 (-> sv-140 vertex (-> sv-148 t4-16))) + (sv-168 (-> sv-140 vertex (-> sv-152 t4-16))) + (sv-172 (- (-> sv-164 z) (-> sv-168 z))) + (sv-176 (- (-> sv-168 x) (-> sv-164 x))) + (f0-17 (+ (* sv-156 sv-172) (* sv-160 sv-176))) + ) + (when (< 0.0 f0-17) + (let ((f1-15 + (+ (* sv-172 (- (-> sv-164 x) (-> v1-19 current-pos x))) + (* sv-176 (- (-> sv-164 z) (-> v1-19 current-pos z))) + ) + ) + ) + (when (< f1-15 f0-17) + (set! sv-128 t4-16) + (let ((f0-19 (fmax 0.0 (/ f1-15 f0-17)))) + (set! sv-156 (* sv-156 f0-19)) + (set! sv-160 (* sv-160 f0-19)) + ) + ) + ) + ) + ) + ) + (let ((f0-23 (+ (* sv-156 (-> v1-19 dir x)) (* sv-160 (-> v1-19 dir z))))) + (+! (-> v1-19 len) f0-23) + ) + 0 + (set! (-> v1-19 next-poly) #f) + (cond + ((= sv-128 -1) + (set! (-> v1-19 current-pos quad) (-> v1-19 dest-pos quad)) + (set! (-> v1-19 reached-dest) #t) + (set! (-> v1-19 terminated) #t) + ) + (else + (+! (-> v1-19 current-pos x) sv-156) + (+! (-> v1-19 current-pos z) sv-160) + (let ((sv-180 (-> sv-140 adj-poly sv-128))) + (if (!= sv-180 255) + (set! (-> v1-19 next-poly) (-> t3-8 poly-array sv-180)) + ) + ) + (cond + ((and (-> v1-19 next-poly) (not (logtest? (-> v1-19 next-poly pat) (-> v1-19 ignore)))) + (set! (-> v1-19 current-poly) (-> v1-19 next-poly)) + ) + (else + (set! (-> v1-19 last-edge) sv-128) + (if (-> v1-19 next-poly) + (set! (-> v1-19 hit-gap) #t) + (set! (-> v1-19 hit-boundary) #t) + ) + (set! (-> v1-19 terminated) #t) + ) + ) ) ) ) ) + 0 + (set! v1-22 (or (>= sv-120 15) (or (>= (-> sv-96 len) (fmax 20480.0 arg3)) (-> sv-96 terminated)))) ) ) - (let ((f0-23 (+ (* sv-156 (-> v1-19 dir x)) (* sv-160 (-> v1-19 dir z))))) - (+! (-> v1-19 len) f0-23) - ) - 0 - (set! (-> v1-19 next-poly) #f) - (cond - ((= sv-128 -1) - (set! (-> v1-19 current-pos quad) (-> v1-19 dest-pos quad)) - (set! (-> v1-19 reached-dest) #t) - (set! (-> v1-19 terminated) #t) - ) - (else - (+! (-> v1-19 current-pos x) sv-156) - (+! (-> v1-19 current-pos z) sv-160) - (set! sv-180 (-> sv-140 adj-poly sv-128)) - (if (!= sv-180 255) - (set! (-> v1-19 next-poly) (-> t3-8 poly-array sv-180)) - ) - (cond - ((and (-> v1-19 next-poly) (not (logtest? (-> v1-19 next-poly pat) (-> v1-19 ignore)))) - (set! (-> v1-19 current-poly) (-> v1-19 next-poly)) - ) - (else - (set! (-> v1-19 last-edge) sv-128) - (if (-> v1-19 next-poly) - (set! (-> v1-19 hit-gap) #t) - (set! (-> v1-19 hit-boundary) #t) - ) - (set! (-> v1-19 terminated) #t) + (set! sv-100 + (cond + ((and (-> sv-96 hit-boundary) (and (< (-> sv-96 len) arg3) (!= (-> sv-96 last-edge) -1) (< sv-104 1))) + (+! sv-104 1) + (let* ((sv-184 (-> arg1 vertex (-> sv-112 vert0-table (-> sv-96 last-edge)))) + (sv-188 (-> arg1 vertex (-> sv-112 vert1-table (-> sv-96 last-edge)))) + (sv-192 (- (-> sv-184 z) (-> sv-188 z))) + (sv-196 (- (-> sv-188 x) (-> sv-184 x))) + (sv-200 (-> arg2 x)) + (sv-204 (-> arg2 z)) + ) + (let* ((f0-41 (sqrtf (+ (square sv-192) (square sv-196)))) + (f0-43 (/ 1.0 f0-41)) + ) + (set! sv-192 (* sv-192 f0-43)) + (set! sv-196 (* sv-196 f0-43)) + ) + (when arg5 + (set! (-> arg5 found-boundary) #t) + (vector+! (-> arg5 intersection) (-> sv-96 current-pos) (-> this bounds)) + (set! (-> arg5 boundary-normal x) sv-192) + (set! (-> arg5 boundary-normal y) 0.0) + (set! (-> arg5 boundary-normal z) sv-196) + (set! (-> arg5 poly) (-> sv-96 current-poly)) + (set! (-> arg5 edge) (-> sv-96 last-edge)) + (vector+! (-> arg5 vert-0) sv-184 (-> this bounds)) + (vector+! (-> arg5 vert-1) sv-188 (-> this bounds)) + ) + (set! (-> sv-96 dest-pos quad) (-> sv-96 current-pos quad)) + (set! sv-100 (cond + (arg4 + (let ((f0-49 (* 1.01 (+ (* sv-192 sv-200) (* sv-196 sv-204))))) + (set! sv-200 (- sv-200 (* sv-192 f0-49))) + (set! sv-204 (- sv-204 (* sv-196 f0-49))) + ) + (+! (-> sv-96 dest-pos x) sv-200) + (+! (-> sv-96 dest-pos z) sv-204) + sv-100 + ) + (else + #t + ) + ) + ) + ) + sv-100 + ) + ((-> sv-96 hit-gap) + (if arg5 + (set! (-> arg5 gap-poly) (-> sv-96 next-poly)) + ) + (set! sv-100 #t) + sv-100 + ) + (else + #t + ) ) ) - ) - ) - ) - 0 - (set! v1-22 (or (>= sv-120 15) (or (>= (-> sv-96 len) (fmax 20480.0 arg3)) (-> sv-96 terminated)))) - ) - (cond - ((and (-> sv-96 hit-boundary) (and (< (-> sv-96 len) arg3) (!= (-> sv-96 last-edge) -1) (< sv-104 1))) - (set! sv-104 (+ sv-104 1)) - (set! sv-184 (-> arg1 vertex (-> sv-112 vert0-table (-> sv-96 last-edge)))) - (set! sv-188 (-> arg1 vertex (-> sv-112 vert1-table (-> sv-96 last-edge)))) - (set! sv-192 (- (-> sv-184 z) (-> sv-188 z))) - (set! sv-196 (- (-> sv-188 x) (-> sv-184 x))) - (set! sv-200 (-> arg2 x)) - (set! sv-204 (-> arg2 z)) - (let* ((f0-37 sv-192) - (f0-39 (* f0-37 f0-37)) - (f1-30 sv-196) - (f0-41 (sqrtf (+ f0-39 (* f1-30 f1-30)))) - (f0-43 (/ 1.0 f0-41)) - ) - (set! sv-192 (* sv-192 f0-43)) - (set! sv-196 (* sv-196 f0-43)) - ) - (when arg5 - (set! (-> arg5 found-boundary) #t) - (vector+! (-> arg5 intersection) (-> sv-96 current-pos) (-> this bounds)) - (set! (-> arg5 boundary-normal x) sv-192) - (set! (-> arg5 boundary-normal y) 0.0) - (set! (-> arg5 boundary-normal z) sv-196) - (set! (-> arg5 poly) (-> sv-96 current-poly)) - (set! (-> arg5 edge) (-> sv-96 last-edge)) - (vector+! (-> arg5 vert-0) sv-184 (-> this bounds)) - (vector+! (-> arg5 vert-1) sv-188 (-> this bounds)) - ) - (set! (-> sv-96 dest-pos quad) (-> sv-96 current-pos quad)) - (cond - (arg4 - (let ((f0-49 (* 1.01 (+ (* sv-192 sv-200) (* sv-196 sv-204))))) - (set! sv-200 (- sv-200 (* sv-192 f0-49))) - (set! sv-204 (- sv-204 (* sv-196 f0-49))) - ) - (+! (-> sv-96 dest-pos x) sv-200) - (+! (-> sv-96 dest-pos z) sv-204) - ) - (else - (set! sv-100 #t) - ) - ) - ) - ((-> sv-96 hit-gap) - (if arg5 - (set! (-> arg5 gap-poly) (-> sv-96 next-poly)) - ) - (set! sv-100 #t) - ) - (else - (set! sv-100 #t) ) ) + (vector-! arg2 (-> sv-96 current-pos) arg0) ) - (vector-! arg2 (-> sv-96 current-pos) arg0) 0 (label cfg-62) 0 @@ -1785,9 +1717,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (none) ) -(defmethod relocate ((this nav-state) (arg0 int)) +(defmethod relocate ((this nav-state) (offset int)) (break!) - (&+! (-> this nav) arg0) + (&+! (-> this nav) offset) this ) @@ -2090,9 +2022,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (defmethod cloest-point-on-mesh ((this nav-control) (arg0 vector) (arg1 vector) (arg2 nav-poly)) - (local-vars (sv-16 vector)) - (set! sv-16 arg0) - (let ((gp-0 (new 'stack-no-clear 'nav-find-poly-parms))) + (let ((sv-16 arg0) + (gp-0 (new 'stack-no-clear 'nav-find-poly-parms)) + ) (set! (-> gp-0 poly) arg2) (vector-! (-> gp-0 point) arg1 (-> this state mesh bounds)) (when (or (not (-> gp-0 poly)) (not (point-in-poly? (-> this state mesh) (-> gp-0 poly) (-> gp-0 point)))) @@ -2131,9 +2063,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (vf2 :class vf) (vf3 :class vf) ) - (let* ((f0-0 arg3) - (f0-2 (* f0-0 f0-0)) - ) + (let ((f0-2 (square arg3))) (let ((v1-1 arg0) (t0-0 arg1) ) @@ -2159,10 +2089,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (when (not v0-0) (let* ((f0-4 (- (-> arg2 x) (-> arg1 x))) (f1-4 (- (-> arg2 z) (-> arg1 z))) - (f2-2 f0-4) - (f2-4 (* f2-2 f2-2)) - (f3-0 f1-4) - (f2-6 (sqrtf (+ f2-4 (* f3-0 f3-0)))) + (f2-6 (sqrtf (+ (square f0-4) (square f1-4)))) (f3-3 f2-6) (f3-5 (/ 1.0 f3-3)) (f5-0 (* f3-5 (- f1-4))) @@ -2172,7 +2099,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (when (>= arg3 (fabs (+ (* f3-7 f5-0) (* f4-4 f6-0)))) (let ((f0-6 (+ (* f3-7 f0-4) (* f4-4 f1-4)))) - (set! v0-0 (and (>= f0-6 0.0) (>= (* f2-6 f2-6) f0-6))) + (set! v0-0 (and (>= f0-6 0.0) (>= (square f2-6) f0-6))) ) ) ) @@ -2185,13 +2112,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (defmethod navigate-using-route-portals ((this nav-state)) - (local-vars - (v1-117 float) - (sv-112 vector) - (sv-116 nav-route-portal) - (sv-120 (inline-array vector)) - (sv-124 symbol) - ) + (local-vars (v1-117 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -2199,159 +2120,157 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (init-vf0-vector) (set! (-> this virtual-current-poly) (-> this current-poly)) - (set! sv-112 (new 'stack-no-clear 'vector)) - (set! sv-116 (new 'stack-no-clear 'nav-route-portal)) - (set! sv-120 (new 'stack-no-clear 'inline-array 'vector 2)) - (set! sv-124 (the-as symbol #f)) - (vector-! (-> this current-pos-local) (-> this current-pos) (-> this mesh bounds)) - (set! (-> this virtual-current-pos-local quad) (-> this current-pos-local quad)) - (set! (-> sv-116 next-poly) #f) - (when (not (logtest? (-> this flags) (nav-state-flag directional-mode))) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (let ((s4-0 (new 'stack-no-clear 'nav-find-poly-parms))) - (vector-! s5-0 (-> this target-post) (-> this mesh bounds)) - (when (or (logtest? (-> this flags) (nav-state-flag target-poly-dirty)) (not (-> this target-poly))) - (set! (-> s4-0 point quad) (-> s5-0 quad)) - (set! (-> s4-0 y-threshold) (-> this nav nearest-y-threshold)) - (set! (-> s4-0 ignore) (the-as uint 3)) - (find-nearest-poly-to-point-local (-> this mesh) s4-0) - (set! (-> this target-poly) (-> s4-0 poly)) - (if (not (-> this target-poly)) - (set! (-> this target-poly) (-> this current-poly)) + (let ((sv-112 (new 'stack-no-clear 'vector)) + (sv-116 (new 'stack-no-clear 'nav-route-portal)) + (sv-120 (new 'stack-no-clear 'inline-array 'vector 2)) + (sv-124 (the-as symbol #f)) + ) + (vector-! (-> this current-pos-local) (-> this current-pos) (-> this mesh bounds)) + (set! (-> this virtual-current-pos-local quad) (-> this current-pos-local quad)) + (set! (-> sv-116 next-poly) #f) + (when (not (logtest? (-> this flags) (nav-state-flag directional-mode))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((s4-0 (new 'stack-no-clear 'nav-find-poly-parms))) + (vector-! s5-0 (-> this target-post) (-> this mesh bounds)) + (when (or (logtest? (-> this flags) (nav-state-flag target-poly-dirty)) (not (-> this target-poly))) + (set! (-> s4-0 point quad) (-> s5-0 quad)) + (set! (-> s4-0 y-threshold) (-> this nav nearest-y-threshold)) + (set! (-> s4-0 ignore) (the-as uint 3)) + (find-nearest-poly-to-point-local (-> this mesh) s4-0) + (set! (-> this target-poly) (-> s4-0 poly)) + (if (not (-> this target-poly)) + (set! (-> this target-poly) (-> this current-poly)) + ) + (logclear! (-> this flags) (nav-state-flag target-poly-dirty)) + ) + ) + (project-point-into-poly-2d (-> this mesh) (-> this target-poly) sv-112 s5-0) + ) + (set! (-> sv-112 y) (-> this current-pos-local y)) + (vector-! (-> this travel) sv-112 (-> this current-pos-local)) + (set! (-> this travel y) 0.0) + (let ((v1-32 (-> this travel))) + (if (< (+ (* (-> v1-32 x) (-> v1-32 x)) (* (-> v1-32 z) (-> v1-32 z))) (square 4096.0)) + (logior! (-> this flags) (nav-state-flag at-target)) + ) + ) + (get-route-portal (-> this mesh) (-> this current-poly) (-> this target-poly) sv-116) + ) + (cond + ((not (-> sv-116 next-poly)) + (set! (-> this next-poly) #f) + ) + (else + (set! (-> this next-poly) (-> sv-116 next-poly)) + (set! (-> sv-120 0 quad) (-> sv-116 vertex 0 quad)) + (set! (-> sv-120 1 quad) (-> sv-116 vertex 1 quad)) + (set! sv-124 #t) + (while (and sv-124 (-> sv-116 next-poly) (test-xz-point-on-line-segment? + (-> this current-pos-local) + (the-as vector (-> sv-116 vertex)) + (-> sv-116 vertex 1) + 409.59998 + ) + ) + (when #t + #t + (vector-segment-distance-point! + (-> this current-pos-local) + (the-as vector (-> sv-116 vertex)) + (-> sv-116 vertex 1) + (-> this virtual-current-pos-local) ) - (logclear! (-> this flags) (nav-state-flag target-poly-dirty)) - ) - ) - (project-point-into-poly-2d (-> this mesh) (-> this target-poly) sv-112 s5-0) - ) - (set! (-> sv-112 y) (-> this current-pos-local y)) - (vector-! (-> this travel) sv-112 (-> this current-pos-local)) - (set! (-> this travel y) 0.0) - (let* ((v1-32 (-> this travel)) - (f0-6 (+ (* (-> v1-32 x) (-> v1-32 x)) (* (-> v1-32 z) (-> v1-32 z)))) - (f1-3 4096.0) - ) - (if (< f0-6 (* f1-3 f1-3)) - (logior! (-> this flags) (nav-state-flag at-target)) - ) - ) - (get-route-portal (-> this mesh) (-> this current-poly) (-> this target-poly) sv-116) - ) - (cond - ((not (-> sv-116 next-poly)) - (set! (-> this next-poly) #f) - ) - (else - (set! (-> this next-poly) (-> sv-116 next-poly)) - (set! (-> sv-120 0 quad) (-> sv-116 vertex 0 quad)) - (set! (-> sv-120 1 quad) (-> sv-116 vertex 1 quad)) - (set! sv-124 #t) - (while (and sv-124 (-> sv-116 next-poly) (test-xz-point-on-line-segment? - (-> this current-pos-local) - (the-as vector (-> sv-116 vertex)) - (-> sv-116 vertex 1) - 409.59998 - ) - ) - (when #t - #t - (vector-segment-distance-point! - (-> this current-pos-local) - (the-as vector (-> sv-116 vertex)) - (-> sv-116 vertex 1) - (-> this virtual-current-pos-local) + (vector-! (-> this travel) sv-112 (-> this virtual-current-pos-local)) + (set! (-> this travel y) 0.0) + 0 ) - (vector-! (-> this travel) sv-112 (-> this virtual-current-pos-local)) - (set! (-> this travel y) 0.0) - 0 - ) - (set! (-> this virtual-current-poly) (-> sv-116 next-poly)) - (cond - ((get-route-portal (-> this mesh) (-> sv-116 next-poly) (-> this target-poly) sv-116) - (set! (-> this next-poly) (-> sv-116 next-poly)) - (set! (-> sv-120 0 quad) (-> sv-116 vertex 0 quad)) - (set! (-> sv-120 1 quad) (-> sv-116 vertex 1 quad)) - 0 - ) - (else - (set! (-> this next-poly) #f) - (set! sv-124 (the-as symbol #f)) + (set! (-> this virtual-current-poly) (-> sv-116 next-poly)) + (cond + ((get-route-portal (-> this mesh) (-> sv-116 next-poly) (-> this target-poly) sv-116) + (set! (-> this next-poly) (-> sv-116 next-poly)) + (set! (-> sv-120 0 quad) (-> sv-116 vertex 0 quad)) + (set! (-> sv-120 1 quad) (-> sv-116 vertex 1 quad)) + 0 + ) + (else + (set! (-> this next-poly) #f) + (set! sv-124 (the-as symbol #f)) + ) ) ) ) ) - ) - (when sv-124 - (let ((s5-1 (new 'stack-no-clear 'matrix))) - (vector-! (the-as vector (-> s5-1 vector)) (-> sv-120 1) (-> sv-120 0)) - (vector-normalize! (the-as vector (-> s5-1 vector)) 409.6) - (vector+! (-> sv-120 0) (-> sv-120 0) (the-as vector (-> s5-1 vector))) - (vector-! (-> sv-120 1) (-> sv-120 1) (the-as vector (-> s5-1 vector))) - ) - (when (not (ray-ccw-line-segment-intersection? - (-> this virtual-current-pos-local) - (-> this travel) - (-> sv-120 0) - (-> sv-120 1) + (when sv-124 + (let ((s5-1 (new 'stack-no-clear 'matrix))) + (vector-! (-> s5-1 vector 0) (-> sv-120 1) (-> sv-120 0)) + (vector-normalize! (-> s5-1 vector 0) 409.6) + (vector+! (-> sv-120 0) (-> sv-120 0) (-> s5-1 vector 0)) + (vector-! (-> sv-120 1) (-> sv-120 1) (-> s5-1 vector 0)) + ) + (when (not (ray-ccw-line-segment-intersection? + (-> this virtual-current-pos-local) + (-> this travel) + (-> sv-120 0) + (-> sv-120 1) + ) ) - ) - (let ((s5-2 -1)) - (let* ((f0-8 (cos 8192.0)) - (f0-10 (* f0-8 f0-8)) - (v1-93 (new 'stack-no-clear 'vector)) - (a0-39 (-> this travel)) - (f1-9 (+ (* (-> a0-39 x) (-> a0-39 x)) (* (-> a0-39 z) (-> a0-39 z)))) - ) - (countdown (a0-41 2) - (vector-! v1-93 (-> sv-120 a0-41) (-> this virtual-current-pos-local)) - (let ((f2-5 (vector-dot (-> this travel) v1-93))) - (when (< 0.0 f2-5) - (let* ((f2-7 (* f2-5 f2-5)) - (a1-26 v1-93) - (f2-8 (/ f2-7 (* f1-9 (+ (* (-> a1-26 x) (-> a1-26 x)) (* (-> a1-26 z) (-> a1-26 z)))))) - ) - (when (< f0-10 f2-8) - (set! f0-10 f2-8) - (set! s5-2 a0-41) + (let ((s5-2 -1)) + (let* ((f0-10 (square (cos 8192.0))) + (v1-93 (new 'stack-no-clear 'vector)) + (a0-39 (-> this travel)) + (f1-9 (+ (* (-> a0-39 x) (-> a0-39 x)) (* (-> a0-39 z) (-> a0-39 z)))) + ) + (countdown (a0-41 2) + (vector-! v1-93 (-> sv-120 a0-41) (-> this virtual-current-pos-local)) + (let ((f2-5 (vector-dot (-> this travel) v1-93))) + (when (< 0.0 f2-5) + (let* ((f2-7 (square f2-5)) + (a1-26 v1-93) + (f2-8 (/ f2-7 (* f1-9 (+ (* (-> a1-26 x) (-> a1-26 x)) (* (-> a1-26 z) (-> a1-26 z)))))) + ) + (when (< f0-10 f2-8) + (set! f0-10 f2-8) + (set! s5-2 a0-41) + ) ) ) ) ) ) - ) - (when (= s5-2 -1) - (let ((f30-0 (the-as float #x7f800000)) - (s3-0 (new 'stack-no-clear 'nav-route-portal)) - (s4-1 (new 'stack-no-clear 'vector)) + (when (= s5-2 -1) + (let ((f30-0 (the-as float #x7f800000)) + (s3-0 (new 'stack-no-clear 'nav-route-portal)) + (s4-1 (new 'stack-no-clear 'vector)) + ) + (get-route-portal (-> this mesh) (-> sv-116 next-poly) (-> this target-poly) s3-0) + (cond + ((-> s3-0 next-poly) + (vector+! s4-1 (the-as vector (-> s3-0 vertex)) (the-as vector (-> s3-0 vertex 1))) + (vector-float*! s4-1 s4-1 0.5) + ) + (else + (set! (-> s4-1 quad) (-> sv-112 quad)) + ) ) - (get-route-portal (-> this mesh) (-> sv-116 next-poly) (-> this target-poly) s3-0) - (cond - ((-> s3-0 next-poly) - (vector+! s4-1 (the-as vector (-> s3-0 vertex)) (the-as vector (-> s3-0 vertex 1))) - (vector-float*! s4-1 s4-1 0.5) - ) - (else - (set! (-> s4-1 quad) (-> sv-112 quad)) - ) - ) - (countdown (s3-1 2) - (let* ((s2-0 (-> sv-120 s3-1)) - (f0-13 (+ (vector-vector-xz-distance-squared (-> this virtual-current-pos-local) s2-0) - (vector-vector-xz-distance-squared s4-1 s2-0) - ) - ) - ) - (when (< f0-13 f30-0) - (set! f30-0 f0-13) - (set! s5-2 s3-1) + (countdown (s3-1 2) + (let* ((s2-0 (-> sv-120 s3-1)) + (f0-13 (+ (vector-vector-xz-distance-squared (-> this virtual-current-pos-local) s2-0) + (vector-vector-xz-distance-squared s4-1 s2-0) + ) + ) + ) + (when (< f0-13 f30-0) + (set! f30-0 f0-13) + (set! s5-2 s3-1) + ) ) ) ) ) + (vector-! (-> this travel) (-> sv-120 s5-2) (-> this virtual-current-pos-local)) ) - (vector-! (-> this travel) (-> sv-120 s5-2) (-> this virtual-current-pos-local)) + (set! (-> this travel y) 0.0) ) - (set! (-> this travel y) 0.0) ) ) (.lvf vf1 (&-> (-> this travel) quad)) @@ -2361,10 +2280,8 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-117 vf1) - (let ((f0-15 v1-117) - (f1-10 (-> this nav nav-cull-radius)) - ) - (if (< (* f1-10 f1-10) f0-15) + (let ((f0-15 v1-117)) + (if (< (square (-> this nav nav-cull-radius)) f0-15) (vector-float*! (-> this travel) (-> this travel) (/ (-> this nav nav-cull-radius) (sqrtf f0-15))) ) ) @@ -2374,21 +2291,6 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (defmethod navigate-using-best-dir-use-existing-avoid-spheres ((this nav-state) (arg0 nav-avoid-spheres-params)) - (local-vars - (sv-96 int) - (sv-104 nav-mesh-work) - (sv-108 nav-poly) - (sv-112 uint) - (sv-116 (pointer int8)) - (sv-120 (pointer int8)) - (sv-124 float) - (sv-128 float) - (sv-132 vector) - (sv-136 vector) - (sv-140 float) - (sv-144 float) - (sv-148 uint) - ) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -2399,13 +2301,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (init-vf0-vector) (when (-> arg0 avoiding-sphere?) (logior! (-> this flags) (nav-state-flag avoiding-sphere)) - (let ((f0-0 (-> arg0 closest-sphere-dist2)) - (f1-0 512.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (logior! (-> this flags) (nav-state-flag touching-sphere)) - ) - ) + (if (< (-> arg0 closest-sphere-dist2) (square 512.0)) + (logior! (-> this flags) (nav-state-flag touching-sphere)) + ) (set! (-> this travel quad) (-> arg0 out-travel 0 quad)) (let ((v1-10 (new 'stack-no-clear 'nav-ray))) (set! (-> v1-10 current-pos quad) (-> this virtual-current-pos-local quad)) @@ -2448,66 +2346,71 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (+! a2-5 1) (let ((t0-6 (-> this mesh)) (a3-5 v1-10) + (sv-96 -1) ) - (set! sv-96 -1) - (set! sv-104 (-> t0-6 work)) - (set! sv-108 (-> a3-5 current-poly)) - (set! sv-112 (-> a3-5 current-poly vertex-count)) - (set! sv-116 (-> t0-6 work vert0-table)) - (set! sv-120 (-> t0-6 work vert1-table)) - (set! sv-124 (- (-> a3-5 dest-pos x) (-> a3-5 current-pos x))) - (set! sv-128 (- (-> a3-5 dest-pos z) (-> a3-5 current-pos z))) - (dotimes (t1-12 (the-as int sv-112)) - (set! sv-132 (-> sv-108 vertex (-> sv-116 t1-12))) - (set! sv-136 (-> sv-108 vertex (-> sv-120 t1-12))) - (set! sv-140 (- (-> sv-132 z) (-> sv-136 z))) - (set! sv-144 (- (-> sv-136 x) (-> sv-132 x))) - (let ((f0-14 (+ (* sv-124 sv-140) (* sv-128 sv-144)))) - (when (< 0.0 f0-14) - (let ((f1-13 - (+ (* sv-140 (- (-> sv-132 x) (-> a3-5 current-pos x))) (* sv-144 (- (-> sv-132 z) (-> a3-5 current-pos z)))) + (let ((sv-104 (-> t0-6 work))) + ) + (let ((sv-108 (-> a3-5 current-poly)) + (sv-112 (-> a3-5 current-poly vertex-count)) + (sv-116 (-> t0-6 work vert0-table)) + (sv-120 (-> t0-6 work vert1-table)) + (sv-124 (- (-> a3-5 dest-pos x) (-> a3-5 current-pos x))) + (sv-128 (- (-> a3-5 dest-pos z) (-> a3-5 current-pos z))) + ) + (dotimes (t1-12 (the-as int sv-112)) + (let* ((sv-132 (-> sv-108 vertex (-> sv-116 t1-12))) + (sv-136 (-> sv-108 vertex (-> sv-120 t1-12))) + (sv-140 (- (-> sv-132 z) (-> sv-136 z))) + (sv-144 (- (-> sv-136 x) (-> sv-132 x))) + (f0-14 (+ (* sv-124 sv-140) (* sv-128 sv-144))) + ) + (when (< 0.0 f0-14) + (let ((f1-13 + (+ (* sv-140 (- (-> sv-132 x) (-> a3-5 current-pos x))) (* sv-144 (- (-> sv-132 z) (-> a3-5 current-pos z)))) + ) + ) + (when (< f1-13 f0-14) + (set! sv-96 t1-12) + (let ((f0-16 (fmax 0.0 (/ f1-13 f0-14)))) + (set! sv-124 (* sv-124 f0-16)) + (set! sv-128 (* sv-128 f0-16)) ) - ) - (when (< f1-13 f0-14) - (set! sv-96 t1-12) - (let ((f0-16 (fmax 0.0 (/ f1-13 f0-14)))) - (set! sv-124 (* sv-124 f0-16)) - (set! sv-128 (* sv-128 f0-16)) ) ) ) ) ) - ) - (let ((f0-20 (+ (* sv-124 (-> a3-5 dir x)) (* sv-128 (-> a3-5 dir z))))) - (+! (-> a3-5 len) f0-20) - ) - 0 - (set! (-> a3-5 next-poly) #f) - (cond - ((= sv-96 -1) - (set! (-> a3-5 current-pos quad) (-> a3-5 dest-pos quad)) - (set! (-> a3-5 reached-dest) #t) - (set! (-> a3-5 terminated) #t) - ) - (else - (+! (-> a3-5 current-pos x) sv-124) - (+! (-> a3-5 current-pos z) sv-128) - (set! sv-148 (-> sv-108 adj-poly sv-96)) - (if (!= sv-148 255) - (set! (-> a3-5 next-poly) (-> t0-6 poly-array sv-148)) - ) - (cond - ((and (-> a3-5 next-poly) (not (logtest? (-> a3-5 next-poly pat) (-> a3-5 ignore)))) - (set! (-> a3-5 current-poly) (-> a3-5 next-poly)) - ) - (else - (set! (-> a3-5 last-edge) sv-96) - (if (-> a3-5 next-poly) - (set! (-> a3-5 hit-gap) #t) - (set! (-> a3-5 hit-boundary) #t) + (let ((f0-20 (+ (* sv-124 (-> a3-5 dir x)) (* sv-128 (-> a3-5 dir z))))) + (+! (-> a3-5 len) f0-20) + ) + 0 + (set! (-> a3-5 next-poly) #f) + (cond + ((= sv-96 -1) + (set! (-> a3-5 current-pos quad) (-> a3-5 dest-pos quad)) + (set! (-> a3-5 reached-dest) #t) + (set! (-> a3-5 terminated) #t) + ) + (else + (+! (-> a3-5 current-pos x) sv-124) + (+! (-> a3-5 current-pos z) sv-128) + (let ((sv-148 (-> sv-108 adj-poly sv-96))) + (if (!= sv-148 255) + (set! (-> a3-5 next-poly) (-> t0-6 poly-array sv-148)) ) - (set! (-> a3-5 terminated) #t) + ) + (cond + ((and (-> a3-5 next-poly) (not (logtest? (-> a3-5 next-poly pat) (-> a3-5 ignore)))) + (set! (-> a3-5 current-poly) (-> a3-5 next-poly)) + ) + (else + (set! (-> a3-5 last-edge) sv-96) + (if (-> a3-5 next-poly) + (set! (-> a3-5 hit-gap) #t) + (set! (-> a3-5 hit-boundary) #t) + ) + (set! (-> a3-5 terminated) #t) + ) ) ) ) @@ -2533,21 +2436,6 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (defmethod navigate-using-best-dir-recompute-avoid-spheres-1 ((this nav-state)) - (local-vars - (sv-192 int) - (sv-200 nav-mesh-work) - (sv-204 nav-poly) - (sv-208 uint) - (sv-212 (pointer int8)) - (sv-216 (pointer int8)) - (sv-220 float) - (sv-224 float) - (sv-228 vector) - (sv-232 vector) - (sv-236 float) - (sv-240 float) - (sv-244 uint) - ) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -2569,13 +2457,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (avoid-spheres-1! (-> this nav) s5-0) (when (-> s5-0 avoiding-sphere?) (logior! (-> this flags) (nav-state-flag avoiding-sphere)) - (let ((f0-0 (-> s5-0 closest-sphere-dist2)) - (f1-0 512.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (logior! (-> this flags) (nav-state-flag touching-sphere)) - ) - ) + (if (< (-> s5-0 closest-sphere-dist2) (square 512.0)) + (logior! (-> this flags) (nav-state-flag touching-sphere)) + ) (set! (-> this travel quad) (-> s5-0 out-travel 0 quad)) (let ((v1-15 (new 'stack-no-clear 'nav-ray))) (set! (-> v1-15 current-pos quad) (-> this virtual-current-pos-local quad)) @@ -2618,66 +2502,71 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (+! a0-15 1) (let ((a2-6 (-> this mesh)) (a1-6 v1-15) + (sv-192 -1) ) - (set! sv-192 -1) - (set! sv-200 (-> a2-6 work)) - (set! sv-204 (-> a1-6 current-poly)) - (set! sv-208 (-> a1-6 current-poly vertex-count)) - (set! sv-212 (-> a2-6 work vert0-table)) - (set! sv-216 (-> a2-6 work vert1-table)) - (set! sv-220 (- (-> a1-6 dest-pos x) (-> a1-6 current-pos x))) - (set! sv-224 (- (-> a1-6 dest-pos z) (-> a1-6 current-pos z))) - (dotimes (a3-12 (the-as int sv-208)) - (set! sv-228 (-> sv-204 vertex (-> sv-212 a3-12))) - (set! sv-232 (-> sv-204 vertex (-> sv-216 a3-12))) - (set! sv-236 (- (-> sv-228 z) (-> sv-232 z))) - (set! sv-240 (- (-> sv-232 x) (-> sv-228 x))) - (let ((f0-14 (+ (* sv-220 sv-236) (* sv-224 sv-240)))) - (when (< 0.0 f0-14) - (let ((f1-13 - (+ (* sv-236 (- (-> sv-228 x) (-> a1-6 current-pos x))) (* sv-240 (- (-> sv-228 z) (-> a1-6 current-pos z)))) + (let ((sv-200 (-> a2-6 work))) + ) + (let ((sv-204 (-> a1-6 current-poly)) + (sv-208 (-> a1-6 current-poly vertex-count)) + (sv-212 (-> a2-6 work vert0-table)) + (sv-216 (-> a2-6 work vert1-table)) + (sv-220 (- (-> a1-6 dest-pos x) (-> a1-6 current-pos x))) + (sv-224 (- (-> a1-6 dest-pos z) (-> a1-6 current-pos z))) + ) + (dotimes (a3-12 (the-as int sv-208)) + (let* ((sv-228 (-> sv-204 vertex (-> sv-212 a3-12))) + (sv-232 (-> sv-204 vertex (-> sv-216 a3-12))) + (sv-236 (- (-> sv-228 z) (-> sv-232 z))) + (sv-240 (- (-> sv-232 x) (-> sv-228 x))) + (f0-14 (+ (* sv-220 sv-236) (* sv-224 sv-240))) + ) + (when (< 0.0 f0-14) + (let ((f1-13 + (+ (* sv-236 (- (-> sv-228 x) (-> a1-6 current-pos x))) (* sv-240 (- (-> sv-228 z) (-> a1-6 current-pos z)))) + ) + ) + (when (< f1-13 f0-14) + (set! sv-192 a3-12) + (let ((f0-16 (fmax 0.0 (/ f1-13 f0-14)))) + (set! sv-220 (* sv-220 f0-16)) + (set! sv-224 (* sv-224 f0-16)) ) - ) - (when (< f1-13 f0-14) - (set! sv-192 a3-12) - (let ((f0-16 (fmax 0.0 (/ f1-13 f0-14)))) - (set! sv-220 (* sv-220 f0-16)) - (set! sv-224 (* sv-224 f0-16)) ) ) ) ) ) - ) - (let ((f0-20 (+ (* sv-220 (-> a1-6 dir x)) (* sv-224 (-> a1-6 dir z))))) - (+! (-> a1-6 len) f0-20) - ) - 0 - (set! (-> a1-6 next-poly) #f) - (cond - ((= sv-192 -1) - (set! (-> a1-6 current-pos quad) (-> a1-6 dest-pos quad)) - (set! (-> a1-6 reached-dest) #t) - (set! (-> a1-6 terminated) #t) - ) - (else - (+! (-> a1-6 current-pos x) sv-220) - (+! (-> a1-6 current-pos z) sv-224) - (set! sv-244 (-> sv-204 adj-poly sv-192)) - (if (!= sv-244 255) - (set! (-> a1-6 next-poly) (-> a2-6 poly-array sv-244)) - ) - (cond - ((and (-> a1-6 next-poly) (not (logtest? (-> a1-6 next-poly pat) (-> a1-6 ignore)))) - (set! (-> a1-6 current-poly) (-> a1-6 next-poly)) - ) - (else - (set! (-> a1-6 last-edge) sv-192) - (if (-> a1-6 next-poly) - (set! (-> a1-6 hit-gap) #t) - (set! (-> a1-6 hit-boundary) #t) + (let ((f0-20 (+ (* sv-220 (-> a1-6 dir x)) (* sv-224 (-> a1-6 dir z))))) + (+! (-> a1-6 len) f0-20) + ) + 0 + (set! (-> a1-6 next-poly) #f) + (cond + ((= sv-192 -1) + (set! (-> a1-6 current-pos quad) (-> a1-6 dest-pos quad)) + (set! (-> a1-6 reached-dest) #t) + (set! (-> a1-6 terminated) #t) + ) + (else + (+! (-> a1-6 current-pos x) sv-220) + (+! (-> a1-6 current-pos z) sv-224) + (let ((sv-244 (-> sv-204 adj-poly sv-192))) + (if (!= sv-244 255) + (set! (-> a1-6 next-poly) (-> a2-6 poly-array sv-244)) ) - (set! (-> a1-6 terminated) #t) + ) + (cond + ((and (-> a1-6 next-poly) (not (logtest? (-> a1-6 next-poly pat) (-> a1-6 ignore)))) + (set! (-> a1-6 current-poly) (-> a1-6 next-poly)) + ) + (else + (set! (-> a1-6 last-edge) sv-192) + (if (-> a1-6 next-poly) + (set! (-> a1-6 hit-gap) #t) + (set! (-> a1-6 hit-boundary) #t) + ) + (set! (-> a1-6 terminated) #t) + ) ) ) ) @@ -2736,10 +2625,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (cond ((logtest? (-> this nav flags) (nav-control-flag limit-rotation-rate)) (let ((s5-0 (nav-state-method-39 this))) - (let* ((f0-1 40.96) - (f0-3 (* f0-1 f0-1)) - (v1-8 (-> this travel)) - ) + (let ((f0-3 (square 40.96)) + (v1-8 (-> this travel)) + ) (when (< f0-3 (+ (* (-> v1-8 x) (-> v1-8 x)) (* (-> v1-8 z) (-> v1-8 z)))) (set! (-> this heading quad) (-> this travel quad)) (set! (-> this heading y) 0.0) @@ -2783,10 +2671,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) ) (else - (let* ((f0-8 40.96) - (f0-10 (* f0-8 f0-8)) - (v1-26 (-> this travel)) - ) + (let ((f0-10 (square 40.96)) + (v1-26 (-> this travel)) + ) (when (< f0-10 (+ (* (-> v1-26 x) (-> v1-26 x)) (* (-> v1-26 z) (-> v1-26 z)))) (set! (-> this heading quad) (-> this travel quad)) (set! (-> this heading y) 0.0) @@ -2837,11 +2724,8 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (when (-> s5-0 gap-poly) (set! (-> this next-poly) (-> s5-0 gap-poly)) - (let* ((v1-12 (-> this travel)) - (f0-4 (+ (* (-> v1-12 x) (-> v1-12 x)) (* (-> v1-12 z) (-> v1-12 z)))) - (f1-3 1024.0) - ) - (if (< f0-4 (* f1-3 f1-3)) + (let ((v1-12 (-> this travel))) + (if (< (+ (* (-> v1-12 x) (-> v1-12 x)) (* (-> v1-12 z) (-> v1-12 z))) (square 1024.0)) (logior! (-> this flags) (nav-state-flag at-gap)) ) ) @@ -2857,7 +2741,6 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (defmethod plan-over-pat1-polys-using-route ((this nav-state) (arg0 nav-gap-info)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 float)) (let ((a1-1 (-> this next-poly))) (when (logtest? (-> a1-1 pat) 1) (while (and a1-1 (logtest? (-> a1-1 pat) 1)) @@ -2868,23 +2751,22 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (-> this mesh) (let ((s3-0 (-> arg0 poly)) (s4-0 (-> arg0 dest)) + (s2-0 (-> this current-pos-local)) + (sv-48 (new 'stack-no-clear 'vector)) + (sv-52 (new 'stack-no-clear 'vector)) ) - (let ((s2-0 (-> this current-pos-local))) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 10000000000000000000000000000000000000.0) - (let* ((s1-0 (-> s3-0 vertex-count)) - (v1-13 (the-as int (+ s1-0 -1))) - ) - (dotimes (s0-0 (the-as int s1-0)) - (let ((f0-1 (vector-segment-distance-point! s2-0 (-> s3-0 vertex v1-13) (-> s3-0 vertex s0-0) sv-48))) - (when (< f0-1 sv-56) - (set! sv-56 f0-1) - (set! (-> sv-52 quad) (-> sv-48 quad)) - ) + (let* ((sv-56 10000000000000000000000000000000000000.0) + (s1-0 (-> s3-0 vertex-count)) + (v1-13 (the-as int (+ s1-0 -1))) + ) + (dotimes (s0-0 (the-as int s1-0)) + (let ((f0-1 (vector-segment-distance-point! s2-0 (-> s3-0 vertex v1-13) (-> s3-0 vertex s0-0) sv-48))) + (when (< f0-1 sv-56) + (set! sv-56 f0-1) + (set! (-> sv-52 quad) (-> sv-48 quad)) ) - (set! v1-13 s0-0) ) + (set! v1-13 s0-0) ) ) (set! (-> s4-0 quad) (-> sv-52 quad)) @@ -2974,7 +2856,6 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (defmethod compute-travel-speed ((this nav-state)) - (local-vars (sv-192 float) (sv-196 float) (sv-200 float) (sv-204 float) (sv-224 vector)) (let ((s5-0 this)) (let ((s4-0 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info))) (clamp-vector-to-mesh-cross-gaps @@ -2991,11 +2872,8 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (when (-> s4-0 gap-poly) (set! (-> s5-0 next-poly) (-> s4-0 gap-poly)) - (let* ((v1-12 (-> s5-0 travel)) - (f0-4 (+ (* (-> v1-12 x) (-> v1-12 x)) (* (-> v1-12 z) (-> v1-12 z)))) - (f1-3 1024.0) - ) - (if (< f0-4 (* f1-3 f1-3)) + (let ((v1-12 (-> s5-0 travel))) + (if (< (+ (* (-> v1-12 x) (-> v1-12 x)) (* (-> v1-12 z) (-> v1-12 z))) (square 1024.0)) (logior! (-> s5-0 flags) (nav-state-flag at-gap)) ) ) @@ -3010,17 +2888,19 @@ Note that this doesn't actually return the nav-control, but instead adds this pr 0 (cond ((logtest? (-> this nav flags) (nav-control-flag use-momentum)) - (set! sv-192 (-> this nav target-speed)) - (if (not (logtest? (-> this nav flags) (nav-control-flag momentum-ignore-heading))) - (set! sv-192 (* sv-192 (fmax 0.0 (vector-dot (-> this heading) (-> this target-dir))))) - ) - (set! sv-196 (- sv-192 (-> this speed))) - (set! sv-200 (* (-> this nav sec-per-frame) (-> this nav acceleration))) - (set! sv-204 (fmin sv-200 (fabs sv-196))) - (if (< sv-196 0.0) - (set! (-> this speed) (- (-> this speed) sv-204)) - (+! (-> this speed) sv-204) + (let ((sv-192 (-> this nav target-speed))) + (if (not (logtest? (-> this nav flags) (nav-control-flag momentum-ignore-heading))) + (set! sv-192 (* (the-as meters sv-192) (fmax 0.0 (vector-dot (-> this heading) (-> this target-dir))))) + ) + (let* ((sv-196 (- sv-192 (-> this speed))) + (sv-204 (fmin (* (-> this nav sec-per-frame) (-> this nav acceleration)) (fabs sv-196))) + ) + (if (< sv-196 0.0) + (set! (-> this speed) (- (-> this speed) sv-204)) + (+! (-> this speed) sv-204) + ) ) + ) ) (else (set! (-> this speed) (-> this nav target-speed)) @@ -3028,16 +2908,16 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (let* ((f0-22 (/ (vector-length (-> this travel)) (-> this nav sec-per-frame))) (f1-18 (fmin (* (-> this nav speed-scale) (-> this speed)) f0-22)) + (sv-224 (new 'stack-no-clear 'vector)) ) - (set! sv-224 (new 'stack-no-clear 'vector)) (when (< f0-22 (-> this speed)) (set! (-> this prev-speed) (-> this speed)) (set! (-> this speed) (/ f0-22 (-> this nav speed-scale))) ) (vector-normalize-copy! sv-224 (-> this travel) f1-18) + (set! (-> this velocity x) (-> sv-224 x)) + (set! (-> this velocity z) (-> sv-224 z)) ) - (set! (-> this velocity x) (-> sv-224 x)) - (set! (-> this velocity z) (-> sv-224 z)) 0 (none) ) @@ -3151,21 +3031,6 @@ Note that this doesn't actually return the nav-control, but instead adds this pr ) (defmethod navigate-using-best-dir-recompute-avoid-spheres-2 ((this nav-state)) - (local-vars - (sv-192 int) - (sv-200 nav-mesh-work) - (sv-204 nav-poly) - (sv-208 uint) - (sv-212 (pointer int8)) - (sv-216 (pointer int8)) - (sv-220 float) - (sv-224 float) - (sv-228 vector) - (sv-232 vector) - (sv-236 float) - (sv-240 float) - (sv-244 uint) - ) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -3188,13 +3053,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (let ((v1-5 this)) (when (-> s5-0 avoiding-sphere?) (logior! (-> v1-5 flags) (nav-state-flag avoiding-sphere)) - (let ((f0-0 (-> s5-0 closest-sphere-dist2)) - (f1-0 512.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (logior! (-> v1-5 flags) (nav-state-flag touching-sphere)) - ) - ) + (if (< (-> s5-0 closest-sphere-dist2) (square 512.0)) + (logior! (-> v1-5 flags) (nav-state-flag touching-sphere)) + ) (set! (-> v1-5 travel quad) (-> s5-0 out-travel 0 quad)) (let ((a0-20 (new 'stack-no-clear 'nav-ray))) (set! (-> a0-20 current-pos quad) (-> v1-5 virtual-current-pos-local quad)) @@ -3237,66 +3098,71 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (+! a1-6 1) (let ((a3-6 (-> v1-5 mesh)) (a2-5 a0-20) + (sv-192 -1) ) - (set! sv-192 -1) - (set! sv-200 (-> a3-6 work)) - (set! sv-204 (-> a2-5 current-poly)) - (set! sv-208 (-> a2-5 current-poly vertex-count)) - (set! sv-212 (-> a3-6 work vert0-table)) - (set! sv-216 (-> a3-6 work vert1-table)) - (set! sv-220 (- (-> a2-5 dest-pos x) (-> a2-5 current-pos x))) - (set! sv-224 (- (-> a2-5 dest-pos z) (-> a2-5 current-pos z))) - (dotimes (t0-12 (the-as int sv-208)) - (set! sv-228 (-> sv-204 vertex (-> sv-212 t0-12))) - (set! sv-232 (-> sv-204 vertex (-> sv-216 t0-12))) - (set! sv-236 (- (-> sv-228 z) (-> sv-232 z))) - (set! sv-240 (- (-> sv-232 x) (-> sv-228 x))) - (let ((f0-14 (+ (* sv-220 sv-236) (* sv-224 sv-240)))) - (when (< 0.0 f0-14) - (let ((f1-13 - (+ (* sv-236 (- (-> sv-228 x) (-> a2-5 current-pos x))) (* sv-240 (- (-> sv-228 z) (-> a2-5 current-pos z)))) + (let ((sv-200 (-> a3-6 work))) + ) + (let ((sv-204 (-> a2-5 current-poly)) + (sv-208 (-> a2-5 current-poly vertex-count)) + (sv-212 (-> a3-6 work vert0-table)) + (sv-216 (-> a3-6 work vert1-table)) + (sv-220 (- (-> a2-5 dest-pos x) (-> a2-5 current-pos x))) + (sv-224 (- (-> a2-5 dest-pos z) (-> a2-5 current-pos z))) + ) + (dotimes (t0-12 (the-as int sv-208)) + (let* ((sv-228 (-> sv-204 vertex (-> sv-212 t0-12))) + (sv-232 (-> sv-204 vertex (-> sv-216 t0-12))) + (sv-236 (- (-> sv-228 z) (-> sv-232 z))) + (sv-240 (- (-> sv-232 x) (-> sv-228 x))) + (f0-14 (+ (* sv-220 sv-236) (* sv-224 sv-240))) + ) + (when (< 0.0 f0-14) + (let ((f1-13 + (+ (* sv-236 (- (-> sv-228 x) (-> a2-5 current-pos x))) (* sv-240 (- (-> sv-228 z) (-> a2-5 current-pos z)))) + ) + ) + (when (< f1-13 f0-14) + (set! sv-192 t0-12) + (let ((f0-16 (fmax 0.0 (/ f1-13 f0-14)))) + (set! sv-220 (* sv-220 f0-16)) + (set! sv-224 (* sv-224 f0-16)) ) - ) - (when (< f1-13 f0-14) - (set! sv-192 t0-12) - (let ((f0-16 (fmax 0.0 (/ f1-13 f0-14)))) - (set! sv-220 (* sv-220 f0-16)) - (set! sv-224 (* sv-224 f0-16)) ) ) ) ) ) - ) - (let ((f0-20 (+ (* sv-220 (-> a2-5 dir x)) (* sv-224 (-> a2-5 dir z))))) - (+! (-> a2-5 len) f0-20) - ) - 0 - (set! (-> a2-5 next-poly) #f) - (cond - ((= sv-192 -1) - (set! (-> a2-5 current-pos quad) (-> a2-5 dest-pos quad)) - (set! (-> a2-5 reached-dest) #t) - (set! (-> a2-5 terminated) #t) - ) - (else - (+! (-> a2-5 current-pos x) sv-220) - (+! (-> a2-5 current-pos z) sv-224) - (set! sv-244 (-> sv-204 adj-poly sv-192)) - (if (!= sv-244 255) - (set! (-> a2-5 next-poly) (-> a3-6 poly-array sv-244)) - ) - (cond - ((and (-> a2-5 next-poly) (not (logtest? (-> a2-5 next-poly pat) (-> a2-5 ignore)))) - (set! (-> a2-5 current-poly) (-> a2-5 next-poly)) - ) - (else - (set! (-> a2-5 last-edge) sv-192) - (if (-> a2-5 next-poly) - (set! (-> a2-5 hit-gap) #t) - (set! (-> a2-5 hit-boundary) #t) + (let ((f0-20 (+ (* sv-220 (-> a2-5 dir x)) (* sv-224 (-> a2-5 dir z))))) + (+! (-> a2-5 len) f0-20) + ) + 0 + (set! (-> a2-5 next-poly) #f) + (cond + ((= sv-192 -1) + (set! (-> a2-5 current-pos quad) (-> a2-5 dest-pos quad)) + (set! (-> a2-5 reached-dest) #t) + (set! (-> a2-5 terminated) #t) + ) + (else + (+! (-> a2-5 current-pos x) sv-220) + (+! (-> a2-5 current-pos z) sv-224) + (let ((sv-244 (-> sv-204 adj-poly sv-192))) + (if (!= sv-244 255) + (set! (-> a2-5 next-poly) (-> a3-6 poly-array sv-244)) ) - (set! (-> a2-5 terminated) #t) + ) + (cond + ((and (-> a2-5 next-poly) (not (logtest? (-> a2-5 next-poly pat) (-> a2-5 ignore)))) + (set! (-> a2-5 current-poly) (-> a2-5 next-poly)) + ) + (else + (set! (-> a2-5 last-edge) sv-192) + (if (-> a2-5 next-poly) + (set! (-> a2-5 hit-gap) #t) + (set! (-> a2-5 hit-boundary) #t) + ) + (set! (-> a2-5 terminated) #t) + ) ) ) ) @@ -3339,8 +3205,8 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (vector-reset! (-> s5-0 in-dir)) (set! (-> s5-0 best-dir 0 quad) (-> this travel quad)) (set! (-> s5-0 best-dir 0 y) 0.0) - (vector-normalize! (the-as vector (-> s5-0 best-dir)) (-> this nav target-speed)) - (vector-! (-> s5-0 right-dir) (the-as vector (-> s5-0 best-dir)) (-> this velocity)) + (vector-normalize! (-> s5-0 best-dir 0) (-> this nav target-speed)) + (vector-! (-> s5-0 right-dir) (-> s5-0 best-dir 0) (-> this velocity)) (vector-float*! (-> s5-0 right-dir) (-> s5-0 right-dir) 4.0) (vector+! (-> s5-0 in-dir) (-> s5-0 in-dir) (-> s5-0 right-dir)) (dotimes (s4-0 (-> this nav sphere-count)) @@ -3355,8 +3221,7 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (.mov v1-11 vf1) (let ((f30-0 v1-11)) (vector-normalize! (-> s5-0 right-dir) 2.0) - (let* ((f0-4 (+ (-> this nav root-nav-sphere w) (-> s3-0 r))) - (f1-1 (* f0-4 f0-4)) + (let* ((f1-1 (square (+ (-> this nav root-nav-sphere w) (-> s3-0 r)))) (f0-7 (fmax 0.0 (/ (- f1-1 f30-0) f1-1))) ) (vector-float*! (-> s5-0 right-dir) (-> s5-0 right-dir) (* 81920.0 f0-7)) @@ -3376,10 +3241,8 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-25 vf1) - (let ((f0-11 v1-25) - (f1-4 (-> this nav target-speed)) - ) - (if (< (* f1-4 f1-4) f0-11) + (let ((f0-11 v1-25)) + (if (< (square (-> this nav target-speed)) f0-11) (vector-float*! (-> this velocity) (-> this velocity) (/ (-> this nav target-speed) (sqrtf f0-11))) ) ) @@ -3412,10 +3275,9 @@ Note that this doesn't actually return the nav-control, but instead adds this pr (set! (-> this next-poly) (-> s5-0 gap-poly)) ) ) - (let* ((f0-1 40.96) - (f0-3 (* f0-1 f0-1)) - (v1-9 (-> this travel)) - ) + (let ((f0-3 (square 40.96)) + (v1-9 (-> this travel)) + ) (when (< f0-3 (+ (* (-> v1-9 x) (-> v1-9 x)) (* (-> v1-9 z) (-> v1-9 z)))) (set! (-> this heading quad) (-> this travel quad)) (set! (-> this heading y) 0.0) diff --git a/goal_src/jak2/engine/nav/nav-enemy.gc b/goal_src/jak2/engine/nav/nav-enemy.gc index ae804edada..a9e735ea72 100644 --- a/goal_src/jak2/engine/nav/nav-enemy.gc +++ b/goal_src/jak2/engine/nav/nav-enemy.gc @@ -27,7 +27,7 @@ (defmethod general-event-handler ((this nav-enemy) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy -@TODO - unsure if there is a pattern for the events and this should have a more specific name" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('nav-mesh-kill) (deactivate this) @@ -106,9 +106,7 @@ ) (else (if (or (not (cloest-point-on-mesh (-> s3-0 nav) s4-0 (-> gp-0 trans) (the-as nav-poly #f))) - (let ((f0-0 32768.0)) - (< (* f0-0 f0-0) (vector-vector-xz-distance-squared s4-0 (-> gp-0 trans))) - ) + (< (square 32768.0) (vector-vector-xz-distance-squared s4-0 (-> gp-0 trans))) ) (return #t) ) @@ -199,9 +197,9 @@ (defmethod common-post ((self nav-enemy)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) (set-time! (-> self last-draw-time)) ) @@ -906,10 +904,10 @@ (defmethod in-aggro-range? ((this nav-enemy) (arg0 process-focusable) (arg1 vector)) "Should the enemy activate. -- if `activate-distance` is `0.0`, always true -- otherwise, check if the provided process is close enough -@param proc The process used to distance check -@returns true/false" + - if `activate-distance` is `0.0`, always true + - otherwise, check if the provided process is close enough + @param proc The process used to distance check + @returns true/false" (if (and arg0 (not arg1)) (set! arg1 (get-trans arg0 1)) ) @@ -920,10 +918,8 @@ (a0-2 (-> this fact)) ) (when (and (< f0-0 (+ f1-0 (-> a0-2 notice-top))) (< (- f1-0 (-> a0-2 notice-bottom)) f0-0)) - (let* ((f30-0 (-> this enemy-info notice-nav-radius)) - (f0-1 f30-0) - ) - (or (>= (* f0-1 f0-1) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) + (let ((f30-0 (-> this enemy-info notice-nav-radius))) + (or (>= (square f30-0) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) (is-in-mesh? (-> this nav) arg1 f30-0) ) ) @@ -1042,7 +1038,7 @@ ;; WARN: Return type mismatch float vs none. (defmethod set-enemy-info! ((this nav-enemy) (arg0 nav-enemy-info)) "In addition to setting the `enemy-info`, also init the `neck-joint` if applicable from it -@param info Set `enemy-info` accordingly" + @param info Set `enemy-info` accordingly" (set! (-> this enemy-info) arg0) (set! (-> arg0 callback-info) *nav-enemy-callback-info*) (when (and (!= (-> this enemy-info neck-joint) -1) (zero? (-> this neck))) @@ -1061,7 +1057,6 @@ (defmethod init-enemy-behaviour-and-stats! ((this nav-enemy) (arg0 nav-enemy-info)) "Initializes a bunch of enemy fields related to how they should react, how many hitpoints they should have, etc" - (local-vars (sv-16 res-tag)) (when (coin-flip? this) (let ((a0-2 (-> this node-list data 2))) (set! (-> a0-2 param0) (the-as (function cspace transformq none) cspace<-parented-matrix-joint-flip-z!)) @@ -1163,8 +1158,9 @@ ) (reset-to-collide-spec (-> this focus) (the-as collide-spec a1-9)) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-82 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-82 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-82 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-82)) @@ -1232,11 +1228,11 @@ (defmethod init-from-entity! ((this nav-enemy) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (init-enemy-collision! this) (process-drawable-from-entity! this arg0) (init-enemy! this) diff --git a/goal_src/jak2/engine/nav/nav-mesh-h.gc b/goal_src/jak2/engine/nav/nav-mesh-h.gc index 5db13770f6..0819294382 100644 --- a/goal_src/jak2/engine/nav/nav-mesh-h.gc +++ b/goal_src/jak2/engine/nav/nav-mesh-h.gc @@ -20,6 +20,7 @@ ;; DECOMP BEGINS (deftype nav-mesh-work-debug (structure) + "Debug outputs for the nav-mesh assembly functions" ((debug-vec1 vector :inline) (debug-vec2 vector :inline) (debug-vec3 vector :inline) @@ -38,6 +39,7 @@ (deftype nav-mesh-work (structure) + "Workspace for nav-mesh processing functions." ((vert0-table int8 4) (vert1-table int8 4) (edge-mask-table uint8 3) @@ -61,6 +63,7 @@ (deftype nav-mesh-link (structure) + "Link between two different meshes" ((id uint32) (dest-mesh-id uint32) (src-link-poly-id uint8) @@ -73,6 +76,8 @@ (deftype nav-poly (structure) + "Polygon within a nav-mesh. Can be a tri or quad. +Based on the implementation of point-poly-intersection?, these should likely be convex." ((data uint8 64) (vertex vector 4 :inline :overlay-at (-> data 0)) (vertex0 vector :inline :overlay-at (-> data 0)) @@ -162,6 +167,7 @@ and declared out of order (cannot use forward declared structures in inline arra (deftype nav-mesh (basic) + "Mesh used for creature/enemy navigation." ((work nav-mesh-work) (poly-array (inline-array nav-poly)) (static-sphere-count uint8) @@ -231,6 +237,7 @@ and declared out of order (cannot use forward declared structures in inline arra (defun vector-normalize-unity! ((arg0 vector)) + "Normalize a vector (xyz only) in place." (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -263,6 +270,7 @@ and declared out of order (cannot use forward declared structures in inline arra ) (defun vector-normalize-unity-copy! ((arg0 vector) (arg1 vector)) + "Normalize a vector (xyz only)" (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -296,10 +304,12 @@ and declared out of order (cannot use forward declared structures in inline arra ) (defun-debug debug-validate-current-poly () + "Not implemented." #f ) (defun init-ray ((arg0 nav-ray)) + "Set up a nav-ray. Assumes that dest-pos and current-pos are set." (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -342,17 +352,18 @@ and declared out of order (cannot use forward declared structures in inline arra ) ) -(defun point-poly-intersection? ((arg0 nav-mesh) (arg1 vector) (arg2 int) (arg3 (inline-array vector))) - (let ((v1-1 (-> arg0 work vert0-table)) - (a0-2 (-> arg0 work vert1-table)) +(defun point-poly-intersection? ((mesh nav-mesh) (pt vector) (num-verts int) (verts (inline-array vector))) + "Check if a point is inside a poly." + (let ((v1-1 (-> mesh work vert0-table)) + (a0-2 (-> mesh work vert1-table)) ) - (dotimes (t0-0 arg2) - (let* ((t1-3 (-> arg3 (-> v1-1 t0-0))) - (t2-3 (-> arg3 (-> a0-2 t0-0))) + (dotimes (t0-0 num-verts) + (let* ((t1-3 (-> verts (-> v1-1 t0-0))) + (t2-3 (-> verts (-> a0-2 t0-0))) (f0-1 (- (-> t1-3 z) (-> t2-3 z))) (f1-2 (- (-> t2-3 x) (-> t1-3 x))) - (f2-2 (- (-> arg1 x) (-> t1-3 x))) - (f3-2 (- (-> arg1 z) (-> t1-3 z))) + (f2-2 (- (-> pt x) (-> t1-3 x))) + (f3-2 (- (-> pt z) (-> t1-3 z))) (f0-3 (+ (* f2-2 f0-1) (* f3-2 f1-2))) ) (if (< 0.0 f0-3) @@ -365,6 +376,7 @@ and declared out of order (cannot use forward declared structures in inline arra ) (defmethod point-in-poly? ((this nav-mesh) (arg0 nav-poly) (arg1 vector)) + "Check if a point is inside a poly of this mesh" (let* ((a3-0 this) (v1-0 arg1) (a0-1 (-> arg0 vertex-count)) @@ -392,40 +404,43 @@ and declared out of order (cannot use forward declared structures in inline arra ;; WARN: Return type mismatch vector vs none. (defmethod closest-point-on-boundary ((this nav-mesh) (arg0 nav-poly) (arg1 vector) (arg2 vector)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 float)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 (the-as float 10000000000000000000000000000000000000.0)) - (let* ((s3-0 (-> arg0 vertex-count)) - (v1-3 (the-as int (+ s3-0 -1))) - ) - (dotimes (s2-0 (the-as int s3-0)) - (let ((f0-1 (vector-segment-distance-point! arg2 (-> arg0 vertex v1-3) (-> arg0 vertex s2-0) sv-48))) - (when (< f0-1 sv-56) - (set! sv-56 f0-1) - (set! (-> sv-52 quad) (-> sv-48 quad)) - ) + "Find the point on the polygon edge that is closest to the query point." + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-52 (new 'stack-no-clear 'vector)) + ) + (let* ((sv-56 (the-as float 10000000000000000000000000000000000000.0)) + (s3-0 (-> arg0 vertex-count)) + (v1-3 (the-as int (+ s3-0 -1))) + ) + (dotimes (s2-0 (the-as int s3-0)) + (let ((f0-1 (vector-segment-distance-point! arg2 (-> arg0 vertex v1-3) (-> arg0 vertex s2-0) sv-48))) + (when (< f0-1 sv-56) + (set! sv-56 f0-1) + (set! (-> sv-52 quad) (-> sv-48 quad)) + ) + ) + (set! v1-3 s2-0) ) - (set! v1-3 s2-0) ) + (set! (-> arg1 quad) (-> sv-52 quad)) ) - (set! (-> arg1 quad) (-> sv-52 quad)) (none) ) ;; WARN: Return type mismatch vector vs none. (defmethod project-point-into-poly-2d ((this nav-mesh) (arg0 nav-poly) (arg1 vector) (arg2 vector)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 float)) + "Find the point in the polygon closest to the query point." (cond ((point-in-poly? this arg0 arg2) (set! (-> arg1 quad) (-> arg2 quad)) ) (else - (let ((s5-1 arg1)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 (the-as float 10000000000000000000000000000000000000.0)) - (let* ((s2-0 (-> arg0 vertex-count)) + (let ((s5-1 arg1) + (sv-48 (new 'stack-no-clear 'vector)) + (sv-52 (new 'stack-no-clear 'vector)) + ) + (let* ((sv-56 (the-as float 10000000000000000000000000000000000000.0)) + (s2-0 (-> arg0 vertex-count)) (v1-6 (the-as int (+ s2-0 -1))) ) (dotimes (s1-0 (the-as int s2-0)) @@ -446,81 +461,72 @@ and declared out of order (cannot use forward declared structures in inline arra ) (defmethod move-along-nav-ray! ((this nav-mesh) (ray nav-ray)) - (local-vars - (next-poly-idx int) - (work nav-mesh-work) - (current-poly nav-poly) - (current-poly-vtx-count uint) - (v0-table (pointer int8)) - (v1-table (pointer int8)) - (delta-x float) - (delta-z float) - (adj-vtx-0 vector) - (adj-vtx-1 vector) - (adj-edge-dz float) - (adj-edge-minus-dx float) - (sv-68 uint) - ) - (set! next-poly-idx -1) - (set! work (-> this work)) - (set! current-poly (-> ray current-poly)) - (set! current-poly-vtx-count (-> ray current-poly vertex-count)) - (set! v0-table (-> this work vert0-table)) - (set! v1-table (-> this work vert1-table)) - (set! delta-x (- (-> ray dest-pos x) (-> ray current-pos x))) - (set! delta-z (- (-> ray dest-pos z) (-> ray current-pos z))) - (dotimes (i (the-as int current-poly-vtx-count)) - (set! adj-vtx-0 (-> current-poly vertex (-> v0-table i))) - (set! adj-vtx-1 (-> current-poly vertex (-> v1-table i))) - (set! adj-edge-dz (- (-> adj-vtx-0 z) (-> adj-vtx-1 z))) - (set! adj-edge-minus-dx (- (-> adj-vtx-1 x) (-> adj-vtx-0 x))) - (let ((heading-dot (+ (* delta-x adj-edge-dz) (* delta-z adj-edge-minus-dx)))) - (when (< 0.0 heading-dot) - (let ((f1-10 (+ (* adj-edge-dz (- (-> adj-vtx-0 x) (-> ray current-pos x))) - (* adj-edge-minus-dx (- (-> adj-vtx-0 z) (-> ray current-pos z))) - ) - ) - ) - (when (< f1-10 heading-dot) - (set! next-poly-idx i) - (let ((f0-12 (fmax 0.0 (/ f1-10 heading-dot)))) - (set! delta-x (* delta-x f0-12)) - (set! delta-z (* delta-z f0-12)) + (let ((next-poly-idx -1)) + (let ((work (-> this work))) + ) + (let ((current-poly (-> ray current-poly)) + (current-poly-vtx-count (-> ray current-poly vertex-count)) + (v0-table (-> this work vert0-table)) + (v1-table (-> this work vert1-table)) + (delta-x (- (-> ray dest-pos x) (-> ray current-pos x))) + (delta-z (- (-> ray dest-pos z) (-> ray current-pos z))) + ) + (dotimes (i (the-as int current-poly-vtx-count)) + (let* ((adj-vtx-0 (-> current-poly vertex (-> v0-table i))) + (adj-vtx-1 (-> current-poly vertex (-> v1-table i))) + (adj-edge-dz (- (-> adj-vtx-0 z) (-> adj-vtx-1 z))) + (adj-edge-minus-dx (- (-> adj-vtx-1 x) (-> adj-vtx-0 x))) + (heading-dot (+ (* delta-x adj-edge-dz) (* delta-z adj-edge-minus-dx))) + ) + (when (< 0.0 heading-dot) + (let ((f1-10 (+ (* adj-edge-dz (- (-> adj-vtx-0 x) (-> ray current-pos x))) + (* adj-edge-minus-dx (- (-> adj-vtx-0 z) (-> ray current-pos z))) + ) + ) + ) + (when (< f1-10 heading-dot) + (set! next-poly-idx i) + (let ((f0-12 (fmax 0.0 (/ f1-10 heading-dot)))) + (set! delta-x (* delta-x f0-12)) + (set! delta-z (* delta-z f0-12)) + ) + ) ) ) ) ) - ) - ) - (let ((f0-16 (+ (* delta-x (-> ray dir x)) (* delta-z (-> ray dir z))))) - (+! (-> ray len) f0-16) - ) - 0 - (set! (-> ray next-poly) #f) - (cond - ((= next-poly-idx -1) - (set! (-> ray current-pos quad) (-> ray dest-pos quad)) - (set! (-> ray reached-dest) #t) - (set! (-> ray terminated) #t) - ) - (else - (+! (-> ray current-pos x) delta-x) - (+! (-> ray current-pos z) delta-z) - (set! sv-68 (-> current-poly adj-poly next-poly-idx)) - (if (!= sv-68 255) - (set! (-> ray next-poly) (-> this poly-array sv-68)) - ) + (let ((f0-16 (+ (* delta-x (-> ray dir x)) (* delta-z (-> ray dir z))))) + (+! (-> ray len) f0-16) + ) + 0 + (set! (-> ray next-poly) #f) (cond - ((and (-> ray next-poly) (not (logtest? (-> ray next-poly pat) (-> ray ignore)))) - (set! (-> ray current-poly) (-> ray next-poly)) + ((= next-poly-idx -1) + (set! (-> ray current-pos quad) (-> ray dest-pos quad)) + (set! (-> ray reached-dest) #t) + (set! (-> ray terminated) #t) ) (else - (set! (-> ray last-edge) next-poly-idx) - (if (-> ray next-poly) - (set! (-> ray hit-gap) #t) - (set! (-> ray hit-boundary) #t) + (+! (-> ray current-pos x) delta-x) + (+! (-> ray current-pos z) delta-z) + (let ((sv-68 (-> current-poly adj-poly next-poly-idx))) + (if (!= sv-68 255) + (set! (-> ray next-poly) (-> this poly-array sv-68)) + ) + ) + (cond + ((and (-> ray next-poly) (not (logtest? (-> ray next-poly pat) (-> ray ignore)))) + (set! (-> ray current-poly) (-> ray next-poly)) + ) + (else + (set! (-> ray last-edge) next-poly-idx) + (if (-> ray next-poly) + (set! (-> ray hit-gap) #t) + (set! (-> ray hit-boundary) #t) + ) + (set! (-> ray terminated) #t) ) - (set! (-> ray terminated) #t) + ) ) ) ) @@ -530,6 +536,7 @@ and declared out of order (cannot use forward declared structures in inline arra ) (defun-debug nav-sphere-from-cam () + "Print out a SPHEREM from the current camera position, possibly used by their level-building tool." (let ((v1-0 (camera-pos))) (format #t "SPHEREM(~4,,1M, ~4,,1M, ~4,,1M, 1.0)~%" (-> v1-0 x) (-> v1-0 y) (-> v1-0 z)) ) diff --git a/goal_src/jak2/engine/physics/chain-physics.gc b/goal_src/jak2/engine/physics/chain-physics.gc index 81d11dccaf..dbed76fa43 100644 --- a/goal_src/jak2/engine/physics/chain-physics.gc +++ b/goal_src/jak2/engine/physics/chain-physics.gc @@ -70,27 +70,7 @@ ) (defmethod update ((this chain-physics) (arg0 process-drawable)) - (local-vars - (v1-78 float) - (f0-11 float) - (sv-272 chain-physics-joint) - (sv-288 vector) - (sv-304 vector) - (sv-320 (function vector float vector)) - (sv-336 vector) - (sv-352 vector) - (sv-368 vector) - (sv-384 vector) - (sv-400 vector) - (sv-416 vector) - (sv-432 vector) - (sv-448 (inline-array vector)) - (sv-464 (inline-array vector)) - (sv-480 (inline-array vector)) - (sv-496 vector) - (sv-512 (inline-array vector)) - (sv-528 vector) - ) + (local-vars (v1-78 float) (f0-11 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -133,209 +113,214 @@ ) ) (dotimes (s0-0 (the-as int (-> this num-joints))) - (set! sv-272 (-> this chain-joints s0-0)) - (set! sv-528 (new 'stack-no-clear 'vector)) - (let ((v1-27 (-> sv-272 position quad))) - (set! (-> sv-528 quad) v1-27) - ) - (set! (-> sv-272 joint-mod flex-blend) f30-0) - (if (-> this negate-y) - (vector-negate! s1-0 s1-0) - ) - (set! sv-288 (new 'stack-no-clear 'vector)) - (apply-gravity this sv-288 s0-0 arg0) - (let ((v1-34 sv-528)) - (let ((a0-10 sv-528)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-10 quad)) - ) - (.lvf vf5 (&-> sv-288 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-34 quad) vf6) - ) - (when (< s0-0 (the-as int (+ (-> this root-joint-index) -1))) - (set! sv-304 (new 'stack-no-clear 'vector)) - (chain-physics-method-14 this sv-304 s0-0) - (let ((v1-40 sv-528)) - (let ((a0-13 sv-528)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-13 quad)) + (let ((sv-272 (-> this chain-joints s0-0)) + (sv-528 (new 'stack-no-clear 'vector)) ) - (.lvf vf5 (&-> sv-304 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-40 quad) vf6) - ) - ) - (clamp-length this sv-528 s3-0 s0-0 arg0) - (set! sv-400 (new 'stack-no-clear 'vector)) - (let ((v1-43 sv-528) - (a0-16 s3-0) - ) - (.lvf vf4 (&-> v1-43 quad)) - (.lvf vf5 (&-> a0-16 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-400 quad) vf6) - (let ((f28-1 (vector-normalize-ret-len! sv-400 1.0)) - (f24-0 (vector-dot sv-400 s1-0)) - (f26-0 (chain-physics-method-16 this s0-0)) - ) - (when (< f24-0 (cos f26-0)) - (vector--float*! sv-400 sv-400 s1-0 f24-0) - (set! sv-320 vector-normalize!) - (set! sv-336 sv-400) - (let ((a1-17 (sin f26-0))) - (sv-320 sv-336 a1-17) - ) - (set! sv-384 sv-400) - (set! sv-352 sv-400) - (set! sv-368 s1-0) - (let ((f0-6 (cos f26-0))) - (.lvf vf2 (&-> sv-368 quad)) - (.lvf vf1 (&-> sv-352 quad)) - (let ((v1-55 f0-6)) - (.mov vf3 v1-55) - ) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-384 quad) vf4) - (vector+float*! sv-528 s3-0 sv-400 f28-1) - ) - ) - (chain-physics-method-17 this sv-528 s0-0) - (set! sv-432 (new 'stack-no-clear 'vector)) - (let ((v1-61 s3-0) - (a0-27 sv-528) - ) - (.lvf vf4 (&-> v1-61 quad)) - (.lvf vf5 (&-> a0-27 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-432 quad) vf6) - (vector-normalize-ret-len! sv-432 1.0) - (set! sv-416 (new 'stack-no-clear 'vector)) - (let ((v1-64 sv-528) - (a0-30 (-> sv-272 position)) - ) - (.lvf vf4 (&-> v1-64 quad)) - (.lvf vf5 (&-> a0-30 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-416 quad) vf6) - (let ((f28-2 (vector-dot sv-432 sv-416))) - (vector--float*! sv-416 sv-416 sv-432 f28-2) - (cond - ((< f28-2 0.0) - (set! f0-11 (* f28-2 (-> this compress-vel-parallel))) - (vector-float*! sv-416 sv-416 (-> this compress-vel)) - ) - (else - (set! f0-11 (* f28-2 (-> this stretch-vel-parallel))) - (vector-float*! sv-416 sv-416 (-> this stretch-vel)) - ) - ) - ) - (let ((v1-73 (-> sv-272 velocity))) - (.lvf vf2 (&-> sv-432 quad)) - (.lvf vf1 (&-> sv-416 quad)) - (let ((a0-37 f0-11)) - (.mov vf3 a0-37) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> v1-73 quad) vf4) - ) - (vector+! sv-528 (-> sv-272 position) (-> sv-272 velocity)) - (let ((a2-9 (vector-! (new 'stack-no-clear 'vector) s3-0 sv-528))) - (.lvf vf1 (&-> a2-9 quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-78 vf1) - (let* ((f0-13 v1-78) - (f1-6 (* (-> this maximum-stretch) (-> this joint-length))) - (f2-3 f1-6) - ) - (if (< (* f2-3 f2-3) f0-13) - (vector--float*! sv-528 s3-0 a2-9 (/ f1-6 (sqrtf f0-13))) - ) - ) - ) - (set! (-> sv-272 position quad) (-> sv-528 quad)) - (if (-> sv-272 joint-mod) - (set! (-> sv-272 joint-mod trans quad) (-> sv-528 quad)) - ) - (when (< s0-0 (the-as int (-> this num-joints))) - (vector-! (-> s4-0 vector 1) sv-528 s3-0) - (vector-normalize! (-> s4-0 vector 1) 1.0) + (set! (-> sv-528 quad) (-> sv-272 position quad)) + (set! (-> sv-272 joint-mod flex-blend) f30-0) (if (-> this negate-y) - (vector-negate! (-> s4-0 vector 1) (-> s4-0 vector 1)) + (vector-negate! s1-0 s1-0) ) - (vector-cross! (the-as vector (-> s4-0 vector)) (-> s4-0 vector 1) s2-0) - (vector-normalize! (the-as vector (-> s4-0 vector)) 1.0) - (set! sv-496 (new 'stack-no-clear 'vector)) - (let ((v1-97 (-> sv-272 old-x)) - (a0-51 (-> s4-0 vector)) + (let ((sv-288 (new 'stack-no-clear 'vector))) + (apply-gravity this sv-288 s0-0 arg0) + (let ((v1-34 sv-528)) + (let ((a0-10 sv-528)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-10 quad)) ) - (.lvf vf1 (&-> v1-97 quad)) - (.lvf vf2 (&-> a0-51 0 quad)) - ) - (.outer.product.a.vf acc vf1 vf2) - (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> sv-496 quad) vf3) - (vector-flatten! sv-496 (-> sv-272 old-x) (-> s4-0 vector 1)) - (vector-normalize! sv-496 1.0) - (cond - ((< (vector-dot (the-as vector (-> s4-0 vector)) sv-496) (cos (-> this axial-slop))) - (vector-cross! sv-496 sv-496 (the-as vector (-> s4-0 vector))) - (vector-cross! sv-496 (the-as vector (-> s4-0 vector)) sv-496) - (vector-normalize! sv-496 1.0) - (set! sv-464 (-> s4-0 vector)) - (set! sv-448 (-> s4-0 vector)) - (let ((f0-20 (cos (-> this axial-slop)))) - (.lvf vf1 (&-> sv-448 0 quad)) - (let ((v1-107 f0-20)) - (.mov vf2 v1-107) - ) - ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-464 0 quad) vf1) - (set! sv-512 (-> s4-0 vector)) - (set! sv-480 (-> s4-0 vector)) - (let ((f0-22 (sin (-> this axial-slop)))) - (.lvf vf2 (&-> sv-496 quad)) - (.lvf vf1 (&-> sv-480 0 quad)) - (let ((v1-113 f0-22)) - (.mov vf3 v1-113) - ) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-512 0 quad) vf4) - (set! (-> sv-272 old-x quad) (-> s4-0 vector 0 quad)) - ) - (else - (set! (-> s4-0 vector 0 quad) (-> sv-496 quad)) - (set! (-> sv-272 old-x quad) (-> s4-0 vector 0 quad)) + (.lvf vf5 (&-> sv-288 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-34 quad) vf6) ) ) - (vector-cross! (-> s4-0 vector 2) (the-as vector (-> s4-0 vector)) (-> s4-0 vector 1)) - (matrix->quaternion (-> sv-272 joint-mod quat) s4-0) - (set! (-> s1-0 quad) (-> s4-0 vector 1 quad)) - (set! (-> s2-0 quad) (-> s4-0 vector 2 quad)) - 0 + (when (< s0-0 (the-as int (+ (-> this root-joint-index) -1))) + (let ((sv-304 (new 'stack-no-clear 'vector))) + (chain-physics-method-14 this sv-304 s0-0) + (let ((v1-40 sv-528)) + (let ((a0-13 sv-528)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-13 quad)) + ) + (.lvf vf5 (&-> sv-304 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-40 quad) vf6) + ) + ) + ) + (clamp-length this sv-528 s3-0 s0-0 arg0) + (let ((sv-400 (new 'stack-no-clear 'vector))) + (let ((v1-43 sv-528) + (a0-16 s3-0) + ) + (.lvf vf4 (&-> v1-43 quad)) + (.lvf vf5 (&-> a0-16 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-400 quad) vf6) + (let ((f28-1 (vector-normalize-ret-len! sv-400 1.0)) + (f24-0 (vector-dot sv-400 s1-0)) + (f26-0 (chain-physics-method-16 this s0-0)) + ) + (when (< f24-0 (cos f26-0)) + (vector--float*! sv-400 sv-400 s1-0 f24-0) + (vector-normalize! sv-400 (sin f26-0)) + (let ((sv-384 sv-400)) + (let ((sv-352 sv-400) + (sv-368 s1-0) + (f0-6 (cos f26-0)) + ) + (.lvf vf2 (&-> sv-368 quad)) + (.lvf vf1 (&-> sv-352 quad)) + (let ((v1-55 f0-6)) + (.mov vf3 v1-55) + ) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-384 quad) vf4) + ) + (vector+float*! sv-528 s3-0 sv-400 f28-1) + ) + ) + ) + (chain-physics-method-17 this sv-528 s0-0) + (let ((sv-432 (new 'stack-no-clear 'vector))) + (let ((a0-27 sv-528)) + (.lvf vf4 (&-> s3-0 quad)) + (.lvf vf5 (&-> a0-27 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-432 quad) vf6) + (vector-normalize-ret-len! sv-432 1.0) + (let ((sv-416 (new 'stack-no-clear 'vector))) + (let ((v1-64 sv-528) + (a0-30 (-> sv-272 position)) + ) + (.lvf vf4 (&-> v1-64 quad)) + (.lvf vf5 (&-> a0-30 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-416 quad) vf6) + (let ((f28-2 (vector-dot sv-432 sv-416))) + (vector--float*! sv-416 sv-416 sv-432 f28-2) + (cond + ((< f28-2 0.0) + (set! f0-11 (* f28-2 (-> this compress-vel-parallel))) + (vector-float*! sv-416 sv-416 (-> this compress-vel)) + ) + (else + (set! f0-11 (* f28-2 (-> this stretch-vel-parallel))) + (vector-float*! sv-416 sv-416 (-> this stretch-vel)) + ) + ) + ) + (let ((v1-73 (-> sv-272 velocity))) + (.lvf vf2 (&-> sv-432 quad)) + (.lvf vf1 (&-> sv-416 quad)) + (let ((a0-37 f0-11)) + (.mov vf3 a0-37) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> v1-73 quad) vf4) + ) + ) + ) + (vector+! sv-528 (-> sv-272 position) (-> sv-272 velocity)) + (let ((a2-9 (vector-! (new 'stack-no-clear 'vector) s3-0 sv-528))) + (.lvf vf1 (&-> a2-9 quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov v1-78 vf1) + (let ((f0-13 v1-78) + (f1-6 (* (-> this maximum-stretch) (-> this joint-length))) + ) + (if (< (square f1-6) f0-13) + (vector--float*! sv-528 s3-0 a2-9 (/ f1-6 (sqrtf f0-13))) + ) + ) + ) + (set! (-> sv-272 position quad) (-> sv-528 quad)) + (if (-> sv-272 joint-mod) + (set! (-> sv-272 joint-mod trans quad) (-> sv-528 quad)) + ) + (when (< s0-0 (the-as int (-> this num-joints))) + (vector-! (-> s4-0 vector 1) sv-528 s3-0) + (vector-normalize! (-> s4-0 vector 1) 1.0) + (if (-> this negate-y) + (vector-negate! (-> s4-0 vector 1) (-> s4-0 vector 1)) + ) + (vector-cross! (-> s4-0 vector 0) (-> s4-0 vector 1) s2-0) + (vector-normalize! (-> s4-0 vector 0) 1.0) + (let ((sv-496 (new 'stack-no-clear 'vector))) + (let ((v1-97 (-> sv-272 old-x)) + (a0-51 (-> s4-0 vector)) + ) + (.lvf vf1 (&-> v1-97 quad)) + (.lvf vf2 (&-> a0-51 0 quad)) + ) + (.outer.product.a.vf acc vf1 vf2) + (.outer.product.b.vf vf3 vf2 vf1 acc) + (.svf (&-> sv-496 quad) vf3) + (vector-flatten! sv-496 (-> sv-272 old-x) (-> s4-0 vector 1)) + (vector-normalize! sv-496 1.0) + (cond + ((< (vector-dot (-> s4-0 vector 0) sv-496) (cos (-> this axial-slop))) + (vector-cross! sv-496 sv-496 (-> s4-0 vector 0)) + (vector-cross! sv-496 (-> s4-0 vector 0) sv-496) + (vector-normalize! sv-496 1.0) + (let ((sv-464 (-> s4-0 vector))) + (let ((sv-448 (-> s4-0 vector)) + (f0-20 (cos (-> this axial-slop))) + ) + (.lvf vf1 (&-> sv-448 0 quad)) + (let ((v1-107 f0-20)) + (.mov vf2 v1-107) + ) + ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-464 0 quad) vf1) + ) + (let ((sv-512 (-> s4-0 vector))) + (let ((sv-480 (-> s4-0 vector)) + (f0-22 (sin (-> this axial-slop))) + ) + (.lvf vf2 (&-> sv-496 quad)) + (.lvf vf1 (&-> sv-480 0 quad)) + (let ((v1-113 f0-22)) + (.mov vf3 v1-113) + ) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-512 0 quad) vf4) + ) + (set! (-> sv-272 old-x quad) (-> s4-0 vector 0 quad)) + ) + (else + (set! (-> s4-0 vector 0 quad) (-> sv-496 quad)) + (set! (-> sv-272 old-x quad) (-> s4-0 vector 0 quad)) + ) + ) + ) + (vector-cross! (-> s4-0 vector 2) (-> s4-0 vector 0) (-> s4-0 vector 1)) + (matrix->quaternion (-> sv-272 joint-mod quat) s4-0) + (set! (-> s1-0 quad) (-> s4-0 vector 1 quad)) + (set! (-> s2-0 quad) (-> s4-0 vector 2 quad)) + 0 + ) + (set! (-> s3-0 quad) (-> sv-528 quad)) ) - (set! (-> s3-0 quad) (-> sv-528 quad)) 0 ) ) @@ -345,10 +330,10 @@ ) ) -(defmethod relocate ((this chain-physics) (arg0 int)) +(defmethod relocate ((this chain-physics) (offset int)) (dotimes (v1-0 (the-as int (-> this num-joints))) (if (nonzero? (-> this chain-joints v1-0 joint-mod)) - (&+! (-> this chain-joints v1-0 joint-mod) arg0) + (&+! (-> this chain-joints v1-0 joint-mod) offset) ) ) this diff --git a/goal_src/jak2/engine/physics/rigid-body.gc b/goal_src/jak2/engine/physics/rigid-body.gc index 8f109b41fe..23e4168c9a 100644 --- a/goal_src/jak2/engine/physics/rigid-body.gc +++ b/goal_src/jak2/engine/physics/rigid-body.gc @@ -65,16 +65,9 @@ (matrix-identity! (-> this inertial-tensor)) (matrix-identity! (-> this inv-inertial-tensor)) (let ((f0-4 (/ f24-0 12))) - (let* ((f1-1 f30-0) - (f1-3 (* f1-1 f1-1)) - (f2-0 f26-0) - ) - (set! (-> this inertial-tensor vector 0 x) (* f0-4 (+ f1-3 (* f2-0 f2-0)))) - ) - (let ((f1-6 f28-0)) - (set! (-> this inertial-tensor vector 1 y) (* f0-4 (+ (* f1-6 f1-6) (* f26-0 f26-0)))) - ) - (set! (-> this inertial-tensor vector 2 z) (* f0-4 (+ (* f28-0 f28-0) (* f30-0 f30-0)))) + (set! (-> this inertial-tensor vector 0 x) (* f0-4 (+ (square f30-0) (square f26-0)))) + (set! (-> this inertial-tensor vector 1 y) (* f0-4 (+ (square f28-0) (square f26-0)))) + (set! (-> this inertial-tensor vector 2 z) (* f0-4 (+ (square f28-0) (square f30-0)))) ) ) (let ((f0-6 (-> this inertial-tensor vector 0 x))) @@ -219,8 +212,7 @@ (.svf (&-> a2-1 quad) vf6) ) (let* ((f0-3 (* 500000000.0 (-> this info mass))) - (f1-1 f0-3) - (f1-3 (* f1-1 f1-1)) + (f1-3 (square f0-3)) ) (.lvf vf1 (&-> (-> this ang-momentum) quad)) (.add.w.vf.x vf2 vf0 vf0) @@ -634,16 +626,6 @@ ) (defmethod rigid-body-method-15 ((this rigid-body) (arg0 collide-shape-moving) (arg1 float)) - (local-vars - (sv-576 vector) - (sv-624 vector) - (sv-628 vector) - (sv-632 float) - (sv-704 vector) - (sv-708 vector) - (sv-712 vector) - (sv-716 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -675,46 +657,52 @@ (b! #t cfg-9 :delay (nop!)) (label cfg-3) (rigid-body-method-14 this (* f30-0 arg1 f28-0)) - (set! sv-576 (new 'stack-no-clear 'vector)) - (set! sv-624 (new 'stack-no-clear 'vector)) - (set! sv-628 (new 'stack-no-clear 'vector)) - (vector-! sv-576 (-> this position) (-> s3-0 best-other-tri intersect)) - (vector-normalize! sv-576 1.0) - (set! sv-632 (vector-dot sv-576 (-> this lin-momentum))) - (when (< sv-632 0.0) - (vector-float*! sv-624 sv-576 sv-632) - (vector-! sv-628 (-> this lin-momentum) sv-624) - (vector-float*! sv-628 sv-628 (- 1.0 (-> s4-0 friction-factor))) - (vector-float*! sv-624 sv-624 (- (-> s4-0 bounce-factor))) - (vector+! (-> this lin-momentum) sv-628 sv-624) - (vector-float*! (-> this lin-velocity) (-> this lin-momentum) (-> s4-0 inv-mass)) - ) - (b! (>= f28-0 0.0001) cfg-7 :delay #f) - (vector+float*! (-> this position) (-> this position) sv-576 409.6) - (label cfg-7) - (set! sv-704 (new 'stack-no-clear 'vector)) - (set! sv-708 (new 'stack-no-clear 'vector)) - (set! sv-712 (new 'stack-no-clear 'vector)) - (set! sv-716 (new 'stack-no-clear 'vector)) - (vector-! sv-704 (-> s3-0 best-other-tri intersect) (-> this position)) - (rigid-body-method-22 this (-> s3-0 best-other-tri intersect) sv-708) - (vector+float*! sv-708 sv-708 sv-576 (- (vector-dot sv-708 sv-576))) - (vector-float*! sv-712 sv-708 (* -1.0 (-> s4-0 mass) (-> s4-0 friction-factor))) - (vector-cross! sv-716 sv-704 sv-712) - (let ((a1-20 (-> this ang-momentum))) - (let ((v1-46 (-> this ang-momentum))) - (let ((a0-27 sv-716)) - (let ((a2-6 1.0)) - (.mov vf7 a2-6) + (let ((sv-576 (new 'stack-no-clear 'vector))) + (let ((sv-624 (new 'stack-no-clear 'vector)) + (sv-628 (new 'stack-no-clear 'vector)) + ) + (vector-! sv-576 (-> this position) (-> s3-0 best-other-tri intersect)) + (vector-normalize! sv-576 1.0) + (let ((sv-632 (vector-dot sv-576 (-> this lin-momentum)))) + (when (< sv-632 0.0) + (vector-float*! sv-624 sv-576 sv-632) + (vector-! sv-628 (-> this lin-momentum) sv-624) + (vector-float*! sv-628 sv-628 (- 1.0 (-> s4-0 friction-factor))) + (vector-float*! sv-624 sv-624 (- (-> s4-0 bounce-factor))) + (vector+! (-> this lin-momentum) sv-628 sv-624) + (vector-float*! (-> this lin-velocity) (-> this lin-momentum) (-> s4-0 inv-mass)) ) - (.lvf vf5 (&-> a0-27 quad)) ) - (.lvf vf4 (&-> v1-46 quad)) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-20 quad) vf6) + (b! (>= f28-0 0.0001) cfg-7 :delay #f) + (vector+float*! (-> this position) (-> this position) sv-576 409.6) + (label cfg-7) + (let ((sv-704 (new 'stack-no-clear 'vector)) + (sv-708 (new 'stack-no-clear 'vector)) + (sv-712 (new 'stack-no-clear 'vector)) + (sv-716 (new 'stack-no-clear 'vector)) + ) + (vector-! sv-704 (-> s3-0 best-other-tri intersect) (-> this position)) + (rigid-body-method-22 this (-> s3-0 best-other-tri intersect) sv-708) + (vector+float*! sv-708 sv-708 sv-576 (- (vector-dot sv-708 sv-576))) + (vector-float*! sv-712 sv-708 (* -1.0 (-> s4-0 mass) (-> s4-0 friction-factor))) + (vector-cross! sv-716 sv-704 sv-712) + (let ((a1-20 (-> this ang-momentum))) + (let ((v1-46 (-> this ang-momentum))) + (let ((a0-27 sv-716)) + (let ((a2-6 1.0)) + (.mov vf7 a2-6) + ) + (.lvf vf5 (&-> a0-27 quad)) + ) + (.lvf vf4 (&-> v1-46 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-20 quad) vf6) + ) + ) ) (vector-rotate*! (-> this ang-velocity) (-> this ang-momentum) (-> this inv-i-world)) (set! f30-0 (* f30-0 (- 1.0 f28-0))) @@ -1131,11 +1119,11 @@ (let ((s5-1 (get-touched-prim s3-0 (-> this root) arg1))) (when s5-1 (set! (-> arg0 prim-id) (-> s5-1 prim-id)) - (vector-! (-> arg0 normal) (-> arg0 point) (the-as vector (-> s5-1 prim-core))) + (vector-! (-> arg0 normal) (-> arg0 point) (-> s5-1 prim-core world-sphere)) (vector-normalize! (-> arg0 normal) 1.0) (vector+float*! (-> arg0 point) - (the-as vector (-> s5-1 prim-core)) + (-> s5-1 prim-core world-sphere) (-> arg0 normal) (-> s5-1 prim-core world-sphere w) ) @@ -1319,11 +1307,7 @@ (format *stdcon* "rigid-body-object got touched~%") ) (when (zero? (-> arg0 rbody)) - (let ((s3-0 (if (type? arg0 process-focusable) - (the-as process-focusable arg0) - ) - ) - ) + (let ((s3-0 (as-type arg0 process-focusable))) (when s3-0 (when (logtest? (-> s3-0 mask) (process-mask target)) (logior! (-> this flags) (rigid-body-object-flag player-touching)) @@ -1350,11 +1334,7 @@ (('edge-grabbed 'pilot-edge-grab) (let ((s5-2 (the-as object (-> arg3 param 0)))) (when (not (logtest? (-> this flags) (rigid-body-object-flag player-impulse-force))) - (let ((a0-25 (if (type? arg0 process-focusable) - (the-as process-focusable arg0) - ) - ) - ) + (let ((a0-25 (as-type arg0 process-focusable))) (when a0-25 (let ((f0-1 (/ 163840.0 (get-inv-mass a0-25)))) (logior! (-> this flags) (rigid-body-object-flag player-touching player-edge-grabbing player-contact-force)) @@ -1371,12 +1351,7 @@ (('ridden) (let ((v1-45 (the-as object (-> arg3 param 0)))) (when (the-as uint v1-45) - (let* ((s5-3 (handle->process (-> (the-as focus v1-45) handle))) - (a0-34 (if (type? s5-3 process-focusable) - (the-as process-focusable s5-3) - ) - ) - ) + (let ((a0-34 (as-type (handle->process (-> (the-as focus v1-45) handle)) process-focusable))) (when (and a0-34 (logtest? (-> a0-34 mask) (process-mask target)) (not (logtest? (-> a0-34 focus-status) (focus-status on-water under-water))) @@ -1398,11 +1373,7 @@ ) (('bonk) (when #t - (let ((a0-38 (if (type? arg0 process-focusable) - (the-as process-focusable arg0) - ) - ) - ) + (let ((a0-38 (as-type arg0 process-focusable))) (when a0-38 (logior! (-> this flags) (rigid-body-object-flag player-touching player-impulse-force)) (set! (-> this player-force-position quad) (-> a0-38 root trans quad)) diff --git a/goal_src/jak2/engine/physics/trajectory.gc b/goal_src/jak2/engine/physics/trajectory.gc index 20f4d92032..a3da6df602 100644 --- a/goal_src/jak2/engine/physics/trajectory.gc +++ b/goal_src/jak2/engine/physics/trajectory.gc @@ -45,10 +45,9 @@ ) (defmethod setup-from-to-y-vel! ((this trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) - (let* ((f0-0 arg2) - (f1-3 (- (* f0-0 f0-0) (* 2.0 (- (-> arg0 y) (-> arg1 y)) arg3))) - (f0-3 900.0) - ) + (let ((f1-3 (- (square arg2) (* 2.0 (- (-> arg0 y) (-> arg1 y)) arg3))) + (f0-3 900.0) + ) (when (>= f1-3 0.0) (let ((f0-4 (sqrtf f1-3))) (set! f0-3 (fmax (/ (- (- arg2) f0-4) arg3) (/ (+ (- arg2) f0-4) arg3))) @@ -79,13 +78,7 @@ (let ((f0-1 (- (-> arg1 y) (-> arg0 y)))) (cond ((= f0-1 0.0) - (let ((t9-0 (method-of-type trajectory setup-from-to-duration!)) - (v1-2 arg2) - (f0-3 (* -8.0 arg3)) - (f1-3 arg2) - ) - (t9-0 this arg0 arg1 v1-2 (/ f0-3 (* f1-3 f1-3))) - ) + (setup-from-to-duration! this arg0 arg1 arg2 (/ (* -8.0 arg3) (square arg2))) (return 0) ) ((and (< 0.0 f0-1) (< 0.0 arg3) (< arg3 f0-1)) @@ -96,9 +89,7 @@ ) ) (let* ((f1-14 (/ (- arg3 f0-1) arg3)) - (f0-6 -2.0) - (f1-18 (/ (- 1.0 f1-14) (- arg2 (* arg2 (sqrtf f1-14))))) - (f0-8 (* f0-6 (* f1-18 f1-18) arg3)) + (f0-8 (* -2.0 (square (/ (- 1.0 f1-14) (- arg2 (* arg2 (sqrtf f1-14))))) arg3)) ) (setup-from-to-duration! this arg0 arg1 arg2 f0-8) ) @@ -147,8 +138,8 @@ (defmethod update-from-cspace ((this impact-control)) (when (>= (-> this joint) 0) (set! (-> this trans 1 quad) (-> this trans 0 quad)) - (vector<-cspace! (the-as vector (-> this trans)) (-> this process 0 node-list data (-> this joint))) - (vector-! (-> this dir) (the-as vector (-> this trans)) (-> this trans 1)) + (vector<-cspace! (-> this trans 0) (-> this process 0 node-list data (-> this joint))) + (vector-! (-> this dir) (-> this trans 0) (-> this trans 1)) ) 0 (none) @@ -169,13 +160,9 @@ ) (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* arg0))) (when (and arg1 (>= f30-0 0.0) (>= 0.0 (vector-dot (-> arg0 best-other-tri normal) (-> this dir)))) - (let* ((s3-0 (new 'stack-no-clear 'touching-shapes-entry)) - (s2-0 (-> arg0 best-other-tri collide-ptr)) - (v1-12 (if (type? s2-0 collide-shape-prim) - (the-as collide-shape-prim s2-0) - ) - ) - ) + (let ((s3-0 (new 'stack-no-clear 'touching-shapes-entry)) + (v1-12 (as-type (-> arg0 best-other-tri collide-ptr) collide-shape-prim)) + ) (set! (-> s3-0 cshape1) #f) (set! (-> s3-0 cshape2) (if v1-12 (-> v1-12 cshape) @@ -237,11 +224,7 @@ (defmethod combo-tracker-method-13 ((this combo-tracker) (arg0 handle) (arg1 vector) (arg2 float) (arg3 vector) (arg4 float)) (cond ((send-event (handle->process arg0) 'combo) - (let ((gp-1 (handle->process arg0))) - (if (type? gp-1 process-focusable) - gp-1 - ) - ) + (the-as basic (as-type (handle->process arg0) process-focusable)) ) (else (let ((s1-0 (new 'stack-no-clear 'sphere)) @@ -261,25 +244,23 @@ (-> s2-1 allocated-length) ) ) - (let ((gp-2 (find-nearest-focusable - (the-as (array collide-shape) s2-1) - arg1 - arg2 - (if (= arg4 65536.0) - (search-info-flag crate enemy combo) - (search-info-flag crate enemy prefer-angle cull-angle combo) + (the-as basic (as-type + (find-nearest-focusable + (the-as (array collide-shape) s2-1) + arg1 + arg2 + (if (= arg4 65536.0) + (search-info-flag crate enemy combo) + (search-info-flag crate enemy prefer-angle cull-angle combo) + ) + (search-info-flag) + arg3 + (the-as vector #f) + arg4 ) - (search-info-flag) - arg3 - (the-as vector #f) - arg4 - ) - ) - ) - (if (type? gp-2 process-focusable) - gp-2 - ) - ) + process-focusable + ) + ) ) ) ) @@ -307,12 +288,7 @@ (set! (-> a1-4 from) (process->ppointer pp)) (set! (-> a1-4 num-params) 0) (set! (-> a1-4 message) 'nav-control) - (let* ((s3-0 (send-event-function (handle->process (-> this target)) a1-4)) - (s4-1 (if (type? s3-0 nav-control) - s3-0 - ) - ) - ) + (let ((s4-1 (the-as object (as-type (send-event-function (handle->process (-> this target)) a1-4) nav-control)))) (when s4-1 (let ((a2-3 ((method-of-type nav-control find-poly-containing-point-1) (the-as nav-control s4-1) arg1))) (if a2-3 diff --git a/goal_src/jak2/engine/process-drawable/process-drawable.gc b/goal_src/jak2/engine/process-drawable/process-drawable.gc index be37ce4637..9e99aa159e 100644 --- a/goal_src/jak2/engine/process-drawable/process-drawable.gc +++ b/goal_src/jak2/engine/process-drawable/process-drawable.gc @@ -148,7 +148,6 @@ ;; WARN: Using new Jak 2 rtype-of (defun-debug cspace-inspect-tree ((arg0 process-drawable) (arg1 cspace) (arg2 int) (arg3 int) (arg4 object)) - (local-vars (sv-16 string) (sv-32 int) (sv-48 int)) (if (and (= arg4 'mesh) (zero? *debug-vertex-stats*)) (set! *debug-vertex-stats* (new 'debug 'debug-vertex-stats)) ) @@ -174,15 +173,12 @@ #f ) ((= v1-11 'mesh) - (let ((s1-0 format) - (s0-0 #t) - ) - (set! sv-16 " ~D/~D/~F") - (set! sv-32 (drawable-frag-count (-> arg1 geo))) - (set! sv-48 (drawable-tri-count (-> arg1 geo))) - (let ((t0-2 (drawable-vertex-ratio (-> arg1 geo) *debug-vertex-stats*))) - (s1-0 s0-0 sv-16 sv-32 sv-48 t0-2) - ) + (format + #t + " ~D/~D/~F" + (drawable-frag-count (-> arg1 geo)) + (drawable-tri-count (-> arg1 geo)) + (drawable-vertex-ratio (-> arg1 geo) *debug-vertex-stats*) ) ) ) @@ -234,8 +230,8 @@ ) ) -(defmethod lod-set! ((this draw-control) (arg0 int)) - (let ((v1-1 (max 0 (min arg0 (-> this lod-set max-lod))))) +(defmethod lod-set! ((this draw-control) (lod int)) + (let ((v1-1 (max 0 (min lod (-> this lod-set max-lod))))) (set! (-> this desired-lod) v1-1) (when (!= (-> this cur-lod) v1-1) (set! (-> this mgeo) (-> this lod-set lod v1-1 geo)) @@ -249,11 +245,11 @@ (none) ) -(defmethod lods-assign! ((this draw-control) (arg0 lod-set)) - (mem-copy! (the-as pointer (-> this lod-set)) (the-as pointer arg0) 49) - (let ((a1-2 (min (-> this cur-lod) (-> this lod-set max-lod)))) +(defmethod lods-assign! ((this draw-control) (lods lod-set)) + (mem-copy! (the-as pointer (-> this lod-set)) (the-as pointer lods) 49) + (let ((lod (min (-> this cur-lod) (-> this lod-set max-lod)))) (set! (-> this cur-lod) -1) - (lod-set! this a1-2) + (lod-set! this lod) ) 0 (none) @@ -288,7 +284,6 @@ ) (defmethod setup-lods! ((this lod-set) (arg0 skeleton-group) (arg1 art-group) (arg2 entity)) - (local-vars (sv-16 res-tag)) (let ((v1-0 (-> arg1 length)) (s3-0 (-> arg0 max-lod)) ) @@ -311,13 +306,13 @@ (set! (-> this lod s3-0 dist) (res-lump-float arg2 'vis-dist :default 4095996000.0)) ) ) - (let ((v1-14 (-> arg1 data (-> arg0 jgeo)))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-15 (res-lump-data (-> v1-14 extra) 'lod-dist pointer :tag-ptr (& sv-16)))) - (when v1-15 - (dotimes (a0-6 (the-as int (-> sv-16 elt-count))) - (set! (-> this lod a0-6 dist) (-> (the-as (pointer float) (&+ v1-15 (* a0-6 4))))) - ) + (let* ((v1-14 (-> arg1 data (-> arg0 jgeo))) + (sv-16 (new 'static 'res-tag)) + (v1-15 (res-lump-data (-> v1-14 extra) 'lod-dist pointer :tag-ptr (& sv-16))) + ) + (when v1-15 + (dotimes (a0-6 (the-as int (-> sv-16 elt-count))) + (set! (-> this lod a0-6 dist) (-> (the-as (pointer float) (&+ v1-15 (* a0-6 4))))) ) ) ) @@ -335,7 +330,7 @@ (set! s5-0 (the-as cspace-array #f)) (goto cfg-13) ) - (let ((v1-9 ((method-of-type cspace reset-and-assign-geo!) (the-as cspace (-> s5-0 data)) (the-as drawable #f)))) + (let ((v1-9 ((method-of-type cspace reset-and-assign-geo!) (-> s5-0 data 0) (the-as drawable #f)))) (set! (-> v1-9 bone) (the-as bone (-> s3-1 bones))) ) (let ((v1-10 (-> s5-0 data))) @@ -403,7 +398,7 @@ ) ((zero? arg1) (matrix<-transformq+trans! - (the-as matrix (-> this skeleton bones 3)) + (-> this skeleton bones 3 transform) (the-as transformq (-> (the-as process-drawable (-> this process)) root trans)) (-> this skeleton bones 0 transform trans) ) @@ -462,7 +457,7 @@ (let ((a1-11 (new 'stack-no-clear 'vector))) (set! (-> a1-11 quad) (-> this bounds quad)) (set! (-> a1-11 w) 1.0) - (vector-matrix*! (-> this origin) a1-11 (the-as matrix (-> this skeleton bones (-> this origin-joint-index)))) + (vector-matrix*! (-> this origin) a1-11 (-> this skeleton bones (-> this origin-joint-index) transform)) ) (let ((f0-2 (-> this bounds w))) (set! (-> this origin w) f0-2) @@ -509,12 +504,6 @@ ;; WARN: Return type mismatch symbol vs none. (defun draw-joint-axes ((arg0 process-drawable)) - (local-vars - (sv-64 (function symbol bucket-id vector vector meters rgba symbol)) - (sv-80 symbol) - (sv-96 int) - (sv-112 vector) - ) (let ((s5-0 (new 'stack-no-clear 'vector2h)) (s4-0 (shl #x8000 16)) (s3-0 (new 'stack-no-clear 'vector)) @@ -527,17 +516,19 @@ (let ((s1-0 (-> arg0 node-list data s2-0 bone transform))) (vector<-cspace! s3-0 (-> arg0 node-list data s2-0)) (dotimes (s0-0 3) - (set! sv-64 add-debug-vector) - (set! sv-80 #t) - (set! sv-96 (the-as int (bucket-id debug-no-zbuf1))) - (set! sv-112 s3-0) - (let ((a3-0 - (vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (+ (the-as uint s1-0) (* s0-0 16))) 1.0) - ) - (t0-0 #x444ccccd) - (t1-0 (logior (ash 255 (* s0-0 8)) s4-0)) + (let ((sv-64 add-debug-vector) + (sv-80 #t) + (sv-96 318) + (sv-112 s3-0) ) - (sv-64 sv-80 (the-as bucket-id sv-96) sv-112 a3-0 (the-as meters t0-0) (the-as rgba t1-0)) + (sv-64 + sv-80 + (the-as bucket-id sv-96) + sv-112 + (vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (+ (the-as uint s1-0) (* s0-0 16))) 1.0) + (meters 0.2) + (the-as rgba (logior (ash 255 (* s0-0 8)) s4-0)) + ) ) ) ) @@ -551,12 +542,13 @@ (none) ) -(defun draw-root ((arg0 process-drawable)) - (add-debug-quaternion #t (bucket-id debug-no-zbuf1) (-> arg0 root trans) (-> arg0 root quat)) +(defun draw-root ((proc process-drawable)) + (add-debug-quaternion #t (bucket-id debug-no-zbuf1) (-> proc root trans) (-> proc root quat)) (none) ) (defmethod deactivate ((this process-drawable)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (if (nonzero? (-> this part)) (kill-and-free-particles (-> this part)) ) @@ -568,12 +560,7 @@ (remove! a0-3) ) ) - (let* ((s5-0 (-> this root)) - (a0-5 (if (type? s5-0 collide-shape) - s5-0 - ) - ) - ) + (let ((a0-5 (the-as trsqv (as-type (-> this root) collide-shape)))) (when a0-5 (let ((a2-0 (-> (the-as collide-shape a0-5) actor-hash-index)) (v1-12 *actor-hash*) @@ -606,12 +593,7 @@ (if (-> self entity) (logior! (-> self entity extra perm status) (entity-perm-status error)) ) - (let* ((s5-0 (-> self root)) - (v1-6 (if (type? s5-0 collide-shape) - s5-0 - ) - ) - ) + (let ((v1-6 (the-as trsqv (as-type (-> self root) collide-shape)))) (when v1-6 (let ((a0-5 (-> (the-as collide-shape v1-6) root-prim))) (set! (-> a0-5 prim-core collide-as) (collide-spec)) @@ -660,7 +642,7 @@ ) (defun skeleton-group->draw-control ((arg0 process-drawable) (arg1 skeleton-group) (arg2 (pointer cspace-array))) - (local-vars (s2-0 draw-control) (sv-16 art-element) (sv-20 int)) + (local-vars (s2-0 draw-control)) (let ((s3-0 (if (= (-> arg1 texture-level) 6) (-> *level* default-level) (-> arg0 level) @@ -673,61 +655,63 @@ (set! s2-0 (the-as draw-control #f)) (goto cfg-50) ) - (set! sv-16 (-> s1-0 data (-> arg1 jgeo))) - (set! sv-20 (-> s1-0 length)) - (when (or (< (-> arg1 jgeo) 0) (>= (-> arg1 jgeo) sv-20) (not sv-16) (!= (-> sv-16 type) art-joint-geo)) - (go process-drawable-art-error "joint-geo") - (set! s2-0 (the-as draw-control #f)) - (goto cfg-50) - ) - (set! s2-0 (new 'process 'draw-control arg0 (the-as symbol sv-16))) - (let ((v1-24 s2-0)) - (set! (-> v1-24 status) (draw-control-status uninited)) - (set! (-> v1-24 art-group) s1-0) - (set! (-> v1-24 jgeo) (the-as art-joint-geo sv-16)) - (set! (-> v1-24 force-lod) -1) - (set! (-> v1-24 cur-lod) -1) - (set! (-> v1-24 shadow) #f) - (set! (-> v1-24 shadow-ctrl) #f) - (set! (-> v1-24 data-format) (draw-control-data-format merc)) - (set! (-> v1-24 color-mult quad) (-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)) - (set! (-> v1-24 color-emissive quad) (-> (new 'static 'vector) quad)) - (set! (-> v1-24 longest-edge) (-> arg1 longest-edge)) - (set! (-> v1-24 origin-joint-index) (the-as uint (-> arg1 origin-joint-index))) - (set! (-> v1-24 shadow-joint-index) (the-as uint (-> arg1 shadow-joint-index))) - ) - (set! (-> s2-0 bounds quad) (-> arg1 bounds quad)) - (let ((v1-26 (-> arg1 shadow))) - (when (and (> v1-26 0) (< v1-26 sv-20)) - (let ((s0-0 (-> s1-0 data v1-26))) - (if (and (not (logtest? (the-as int (res-lump-value (-> arg0 entity) 'options uint128 :time -1000000000.0)) 8192)) - (= (-> s0-0 type) shadow-geo) - ) - (set! (-> s2-0 shadow) (the-as shadow-geo s0-0)) + (let ((sv-16 (-> s1-0 data (-> arg1 jgeo)))) + (let ((sv-20 (-> s1-0 length))) + (when (or (< (-> arg1 jgeo) 0) (>= (-> arg1 jgeo) sv-20) (not sv-16) (!= (-> sv-16 type) art-joint-geo)) + (go process-drawable-art-error "joint-geo") + (set! s2-0 (the-as draw-control #f)) + (goto cfg-50) + ) + (set! s2-0 (new 'process 'draw-control arg0 (the-as symbol sv-16))) + (let ((v1-24 s2-0)) + (set! (-> v1-24 status) (draw-control-status uninited)) + (set! (-> v1-24 art-group) s1-0) + (set! (-> v1-24 jgeo) (the-as art-joint-geo sv-16)) + (set! (-> v1-24 force-lod) -1) + (set! (-> v1-24 cur-lod) -1) + (set! (-> v1-24 shadow) #f) + (set! (-> v1-24 shadow-ctrl) #f) + (set! (-> v1-24 data-format) (draw-control-data-format merc)) + (set! (-> v1-24 color-mult quad) (-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)) + (set! (-> v1-24 color-emissive quad) (-> (new 'static 'vector) quad)) + (set! (-> v1-24 longest-edge) (-> arg1 longest-edge)) + (set! (-> v1-24 origin-joint-index) (the-as uint (-> arg1 origin-joint-index))) + (set! (-> v1-24 shadow-joint-index) (the-as uint (-> arg1 shadow-joint-index))) + ) + (set! (-> s2-0 bounds quad) (-> arg1 bounds quad)) + (let ((v1-26 (-> arg1 shadow))) + (when (and (> v1-26 0) (< v1-26 sv-20)) + (let ((s0-0 (-> s1-0 data v1-26))) + (if (and (not (logtest? (the-as int (res-lump-value (-> arg0 entity) 'options uint128 :time -1000000000.0)) 8192)) + (= (-> s0-0 type) shadow-geo) + ) + (set! (-> s2-0 shadow) (the-as shadow-geo s0-0)) + ) ) + ) ) ) - ) - (if (not (setup-lods! (-> s2-0 lod-set) arg1 s1-0 (-> arg0 entity))) - (go process-drawable-art-error "mesh") + (if (not (setup-lods! (-> s2-0 lod-set) arg1 s1-0 (-> arg0 entity))) + (go process-drawable-art-error "mesh") + ) + (let ((v1-41 (res-lump-value (-> sv-16 extra) 'texture-bucket int :default (the-as uint128 1) :time -1000000000.0)) + ) + (case (if (= (-> arg1 texture-level) 6) + 6 + (-> s3-0 index) + ) + ((6) + (set! v1-41 (-> arg1 sort)) + ) + ) + (set! (-> s2-0 default-texture-page) (the-as uint v1-41)) ) - ) - (let ((v1-41 (res-lump-value (-> sv-16 extra) 'texture-bucket int :default (the-as uint128 1) :time -1000000000.0)) - ) - (case (if (= (-> arg1 texture-level) 6) - 6 - (-> s3-0 index) - ) - ((6) - (set! v1-41 (-> arg1 sort)) - ) + (set! (-> s2-0 level-index) (the-as uint (-> s3-0 index))) + (set! (-> s2-0 dma-add-func) (the-as (function process-drawable draw-control symbol object none) nothing)) + (set! (-> arg2 0) (setup-cspace-and-add s2-0 (the-as art-joint-geo sv-16) 'process)) ) - (set! (-> s2-0 default-texture-page) (the-as uint v1-41)) ) - (set! (-> s2-0 level-index) (the-as uint (-> s3-0 index))) ) - (set! (-> s2-0 dma-add-func) (the-as (function process-drawable draw-control symbol object none) nothing)) - (set! (-> arg2 0) (setup-cspace-and-add s2-0 (the-as art-joint-geo sv-16) 'process)) (set! (-> s2-0 dma-add-func) dma-add-process-drawable) (set! (-> s2-0 shadow-mask) (res-lump-value (-> arg0 entity) 'shadow-mask uint :time -1000000000.0)) (set! (-> s2-0 shadow-values) (res-lump-value (-> arg0 entity) 'shadow-values uint :time -1000000000.0)) @@ -736,12 +720,7 @@ (-> arg1 light-index) ) ) - (let* ((gp-1 (ppointer->process (-> arg0 parent))) - (v1-54 (if (type? gp-1 process-drawable) - gp-1 - ) - ) - ) + (let ((v1-54 (the-as process-tree (as-type (ppointer->process (-> arg0 parent)) process-drawable)))) (when (and v1-54 (nonzero? (-> (the-as process-drawable v1-54) draw))) (set! (-> s2-0 light-index) (-> (the-as process-drawable v1-54) draw light-index)) (set! (-> s2-0 shadow-mask) (-> (the-as process-drawable v1-54) draw shadow-mask)) @@ -1758,10 +1737,10 @@ (defbehavior rider-post process-drawable () (ja-post) - (let ((gp-0 (the-as collide-shape (-> self root)))) - (update-transforms gp-0) - (pull-riders! gp-0) - (do-push-aways gp-0) + (let ((cshape (the-as collide-shape (-> self root)))) + (update-transforms cshape) + (pull-riders! cshape) + (do-push-aways cshape) ) 0 (none) @@ -1769,14 +1748,14 @@ (defbehavior pusher-post process-drawable () (ja-post) - (let ((gp-0 (the-as collide-shape (-> self root)))) - (update-transforms gp-0) - (do-push-aways gp-0) + (let ((cshape (the-as collide-shape (-> self root)))) + (update-transforms cshape) + (do-push-aways cshape) ) 0 ) -(defbehavior process-drawable-delay-player process-drawable ((arg0 time-frame)) +(defbehavior process-drawable-delay-player process-drawable ((delay time-frame)) (while (and *target* (focus-test? *target* in-air)) (suspend) ) @@ -1789,7 +1768,7 @@ ) (suspend) ) - (while (not (time-elapsed? (-> self state-time) arg0)) + (while (not (time-elapsed? (-> self state-time) delay)) (suspend) ) (process-release? *target*) @@ -1850,14 +1829,9 @@ ;; WARN: Return type mismatch object vs process-focusable. (defbehavior find-offending-process-focusable process-drawable ((arg0 process-tree) (arg1 attack-info)) (let ((s5-0 (the-as object #f))) - (when (and arg1 (logtest? (-> arg1 mask) (attack-mask attacker))) - (let ((s4-0 (handle->process (-> arg1 attacker)))) - (set! s5-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) + (if (and arg1 (logtest? (-> arg1 mask) (attack-mask attacker))) + (set! s5-0 (the-as object (as-type (handle->process (-> arg1 attacker)) process-focusable))) ) - ) (when (not (the-as process s5-0)) (let ((a1-3 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-3 from) (process->ppointer self)) diff --git a/goal_src/jak2/engine/scene/scene.gc b/goal_src/jak2/engine/scene/scene.gc index 875e6ce39d..cc25b1393f 100644 --- a/goal_src/jak2/engine/scene/scene.gc +++ b/goal_src/jak2/engine/scene/scene.gc @@ -46,7 +46,7 @@ ) (defmethod scene-actor-method-9 ((this scene-actor) (arg0 scene-player)) - (local-vars (s4-0 (pointer process)) (sv-96 process) (sv-112 process)) + (local-vars (s4-0 (pointer process))) (let ((s1-0 (if (-> this level) (level-get *level* (-> this level)) (-> *level* default-level) @@ -66,19 +66,17 @@ (goto cfg-211) ) ) - (let* ((s4-1 (art-group-get-by-name *level* (-> this art-group) (the-as (pointer uint32) #f))) - (s2-0 (if (type? s4-1 skeleton-group) - (the-as skeleton-group s4-1) - ) - ) - (s0-0 (-> arg0 level)) - (s3-0 - (or (string= (-> this name) "jak-highres") - (string= (-> this name) "jak-highres-prison") - (string= (-> this name) "darkjak-highres") - ) - ) - ) + (let ((s2-0 + (as-type (art-group-get-by-name *level* (-> this art-group) (the-as (pointer uint32) #f)) skeleton-group) + ) + (s0-0 (-> arg0 level)) + (s3-0 + (or (string= (-> this name) "jak-highres") + (string= (-> this name) "jak-highres-prison") + (string= (-> this name) "darkjak-highres") + ) + ) + ) (set! (-> arg0 level) #f) (set! s4-0 (when s2-0 @@ -88,26 +86,26 @@ ) ) ) - (set! sv-96 (get-process *default-dead-pool* manipy #x4000)) - (set! s4-0 (when sv-96 - (let ((t9-7 (method-of-type manipy activate))) - (t9-7 (the-as manipy sv-96) arg0 (-> this name) (the-as pointer #x70004000)) - ) - (run-now-in-process - sv-96 - manipy-init - (-> arg0 root trans) - s1-1 - s2-0 - #f - (if (and s3-0 (logtest? (game-secrets big-head little-head) (-> *game-info* secrets))) - 1 - 0 - ) - ) - (-> sv-96 ppointer) - ) - ) + (let ((sv-96 (get-process *default-dead-pool* manipy #x4000))) + (set! s4-0 + (when sv-96 + ((method-of-type manipy activate) (the-as manipy sv-96) arg0 (-> this name) (the-as pointer #x70004000)) + (run-now-in-process + sv-96 + manipy-init + (-> arg0 root trans) + s1-1 + s2-0 + #f + (if (and s3-0 (logtest? (game-secrets big-head little-head) (-> *game-info* secrets))) + 1 + 0 + ) + ) + (-> sv-96 ppointer) + ) + ) + ) (set! (-> arg0 level) s0-0) (send-event (ppointer->process s4-0) 'anim-mode 'clone-anim) (send-event (ppointer->process s4-0) 'blend-shape #t) @@ -165,16 +163,19 @@ ) ) (when (and s4-0 (logtest? (-> this flags) 2)) - (set! sv-112 (get-process *default-dead-pool* manipy #x4000)) - (let ((s0-1 (when sv-112 - (let ((t9-24 (method-of-type manipy activate))) - (t9-24 (the-as manipy sv-112) (ppointer->process s4-0) (-> this name) (the-as pointer #x70004000)) + (let* ((sv-112 (get-process *default-dead-pool* manipy #x4000)) + (s0-1 (when sv-112 + ((method-of-type manipy activate) + (the-as manipy sv-112) + (ppointer->process s4-0) + (-> this name) + (the-as pointer #x70004000) ) - (run-now-in-process sv-112 manipy-init (-> arg0 root trans) s1-1 s2-0 #f 0) - (-> sv-112 ppointer) - ) - ) - ) + (run-now-in-process sv-112 manipy-init (-> arg0 root trans) s1-1 s2-0 #f 0) + (-> sv-112 ppointer) + ) + ) + ) (send-event (ppointer->process s0-1) 'mirror #t) (send-event (ppointer->process s0-1) 'anim-mode 'mirror) (if (nonzero? (-> this light-index)) @@ -466,14 +467,14 @@ (-> *level* default-level) ) ) - (v1-55 (when level - (let ((s0-0 (art-group-get-by-name *level* (-> s2-0 art-group) (the-as (pointer uint32) #f)))) - (if (type? s0-0 skeleton-group) - s0-0 - ) - ) - ) - ) + (v1-55 + (if level + (the-as + art-group + (as-type (art-group-get-by-name *level* (-> s2-0 art-group) (the-as (pointer uint32) #f)) skeleton-group) + ) + ) + ) ) (cond ((or (not s1-0) (not (or (= (-> s1-0 status) 'active) (= (-> s1-0 status) 'reserved)))) @@ -609,15 +610,13 @@ ;; WARN: Return type mismatch pointer vs none. (defun draw-subtitle-image ((arg0 subtitle-image) (arg1 font-context)) - (local-vars (sv-16 pointer) (sv-32 int)) - (let ((gp-0 (-> arg0 width)) - (s5-0 (-> arg0 height)) - ) - (let ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf))) - (set! sv-16 (-> s4-0 base)) - (unpack-comp-rle (the-as (pointer int8) sv-16) (the-as (pointer int8) (-> arg0 data))) - (&+! (-> s4-0 base) (logand -16 (+ (shr (* gp-0 s5-0) 1) 15))) - ) + (let* ((gp-0 (-> arg0 width)) + (s5-0 (-> arg0 height)) + (s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (sv-16 (-> s4-0 base)) + ) + (unpack-comp-rle (the-as (pointer int8) sv-16) (the-as (pointer int8) (-> arg0 data))) + (&+! (-> s4-0 base) (logand -16 (+ (shr (* gp-0 s5-0) 1) 15))) (with-dma-buffer-add-bucket ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id subtitle) ) @@ -647,8 +646,8 @@ ; ) ; (t9-2 a0-13 sv-16 (the-as int a2-8) (the-as int a3-1) (the-as gs-psm t0-1)) ; ) - (set! sv-32 (+ (log2 (the-as int (+ gp-0 -1))) 1)) - (let ((v1-17 (+ (log2 (the-as int (+ s5-0 -1))) 1))) + (let ((sv-32 (+ (log2 (the-as int (+ s5-0 -1))) 1)) + (v1-17 (+ (log2 (the-as int (+ s5-0 -1))) 1))) (dma-buffer-add-gs-set s3-0 (test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always))) (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)) @@ -751,15 +750,9 @@ (new 'stack 'font-context *font-default-matrix* 20 290 0.0 (font-color default) (font-flags shadow kerning)) ) ) - (let ((v1-20 s2-0)) - (set! (-> v1-20 width) (the float 465)) - ) - (let ((v1-21 s2-0)) - (set! (-> v1-21 height) (the float 70)) - ) - (let ((v1-22 s2-0)) - (set! (-> v1-22 scale) 0.5) - ) + (set-width! s2-0 465) + (set-height! s2-0 70) + (set-scale! s2-0 0.5) (set! (-> s2-0 flags) (font-flags shadow kerning middle large)) (case (-> s3-0 type) ((string) @@ -775,9 +768,7 @@ ;; (log-string-bytes (the-as string s3-0) file) ;; (file-stream-close file))) (set! s3-0 (convert-korean-text (the-as string s3-0))) - (let ((v1-27 s2-0)) - (set! (-> v1-27 scale) 0.6) - ) + (set-scale! s2-0 0.6) ) (set! (-> s2-0 flags) (font-flags kerning middle middle-vert large)) (+! (-> s2-0 origin x) -1.0) @@ -1330,12 +1321,7 @@ ) (when (logtest? gp-4 (scene-controls special-fma-spheres)) (dotimes (s5-3 (-> self scene actor length)) - (let* ((s4-1 (handle->process (-> self scene actor s5-3 process))) - (v1-63 (if (type? s4-1 process-drawable) - (the-as process-drawable s4-1) - ) - ) - ) + (let ((v1-63 (as-type (handle->process (-> self scene actor s5-3 process)) process-drawable))) (if (and v1-63 (nonzero? (-> v1-63 draw))) (add-debug-sphere #t @@ -1350,12 +1336,7 @@ ) (when (logtest? gp-4 (scene-controls scene-controls-7)) (dotimes (s5-4 (-> self scene actor length)) - (let* ((s4-2 (handle->process (-> self scene actor s5-4 process))) - (v1-79 (if (type? s4-2 process-drawable) - (the-as process-drawable s4-2) - ) - ) - ) + (let ((v1-79 (as-type (handle->process (-> self scene actor s5-4 process)) process-drawable))) (if (and v1-79 (nonzero? (-> v1-79 draw))) (format *stdcon* @@ -1374,12 +1355,7 @@ ) (when (logtest? gp-4 (scene-controls scene-controls-8)) (dotimes (gp-5 (-> self scene actor length)) - (let* ((s5-5 (handle->process (-> self scene actor gp-5 process))) - (v1-94 (if (type? s5-5 process-drawable) - (the-as process-drawable s5-5) - ) - ) - ) + (let ((v1-94 (as-type (handle->process (-> self scene actor gp-5 process)) process-drawable))) (if (and v1-94 (nonzero? (-> v1-94 draw))) (add-debug-text-3d #t @@ -1407,15 +1383,9 @@ (new 'stack 'font-context *font-default-matrix* 36 60 0.0 (font-color default) (font-flags shadow kerning)) ) ) - (let ((v1-121 gp-6)) - (set! (-> v1-121 width) (the float 440)) - ) - (let ((v1-122 gp-6)) - (set! (-> v1-122 height) (the float 48)) - ) - (let ((v1-123 gp-6)) - (set! (-> v1-123 scale) 0.5) - ) + (set-width! gp-6 440) + (set-height! gp-6 48) + (set-scale! gp-6 0.5) (set! (-> gp-6 flags) (font-flags shadow kerning middle large)) (print-game-text (lookup-text! diff --git a/goal_src/jak2/engine/sound/gsound.gc b/goal_src/jak2/engine/sound/gsound.gc index 2ef2122797..232b824607 100644 --- a/goal_src/jak2/engine/sound/gsound.gc +++ b/goal_src/jak2/engine/sound/gsound.gc @@ -458,9 +458,9 @@ "Send play rpc to play a sound! Last arg can by a symbol with value [[#t]], in which case it will pull `trans` [[vector]] off the current [[process-drawable]] otherwise, an explicit [[vector]] can be provided" - (local-vars (sv-16 sound-group)) - (set! sv-16 arg5) - (let ((s4-0 arg6)) + (let ((sv-16 arg5) + (s4-0 arg6) + ) (when *sound-player-enable* (let ((s5-0 (the-as sound-rpc-play (get-sound-buffer-entry)))) (set! (-> s5-0 command) (sound-command play)) @@ -618,105 +618,99 @@ ;; WARN: Return type mismatch object vs ambient-sound. (defmethod new ambient-sound ((allocation symbol) (type-to-make type) (arg0 basic) (arg1 vector)) "Set up ambient-sound. Can use an entity-actor (grabs from lump), sound-spec, or name as a string." - (local-vars - (sv-16 sound-spec) - (sv-32 sound-name) - (sv-48 (pointer float)) - (sv-52 pointer) - (sv-56 int) - (sv-64 res-tag) - ) - (set! sv-16 (the-as sound-spec #f)) - (set! sv-32 (the-as sound-name 0)) - (set! sv-48 (the-as (pointer float) #f)) - (set! sv-52 (the-as pointer #f)) - (set! sv-56 0) - (case (-> arg0 type) - ((entity-actor) - (let ((v1-2 - ((method-of-type res-lump get-property-struct) - (the-as res-lump arg0) - 'effect-name - 'exact - 0.0 - (the-as structure #f) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (when v1-2 - (set! sv-32 (string->sound-name (symbol->string v1-2))) - (set! sv-48 (res-lump-data (the-as res-lump arg0) 'cycle-speed (pointer float))) - (set! sv-16 *ambient-spec*) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-7 - ((method-of-type res-lump get-property-data) - (the-as res-lump arg0) - 'effect-param - 'exact - 0.0 - (the-as pointer #f) - (& sv-64) - *res-static-buf* - ) - ) + (let ((sv-16 (the-as sound-spec #f)) + (sv-32 (the-as sound-name 0)) + (sv-48 (the-as (pointer float) #f)) + (sv-52 (the-as pointer #f)) + (sv-56 0) + ) + (case (-> arg0 type) + ((entity-actor) + (let ((v1-2 + ((method-of-type res-lump get-property-struct) + (the-as res-lump arg0) + 'effect-name + 'exact + 0.0 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (when v1-2 + (set! sv-32 (string->sound-name (symbol->string v1-2))) + (set! sv-48 (res-lump-data (the-as res-lump arg0) 'cycle-speed (pointer float))) + (set! sv-16 *ambient-spec*) + (let* ((sv-64 (new 'static 'res-tag)) + (v1-7 + ((method-of-type res-lump get-property-data) + (the-as res-lump arg0) + 'effect-param + 'exact + 0.0 + (the-as pointer #f) + (& sv-64) + *res-static-buf* + ) + ) + ) + (when v1-7 + (set! sv-52 v1-7) + (set! sv-56 (the-as int (-> sv-64 elt-count))) ) - (when v1-7 - (set! sv-52 v1-7) - (set! sv-56 (the-as int (-> sv-64 elt-count))) ) ) ) ) - ) - ((sound-spec) - (set! sv-16 (the-as sound-spec arg0)) - ) - ((string) - (set! sv-32 (string->sound-name (the-as string arg0))) - ) - (else - (format 0 "ERROR: ambient sound was told to play an unknown ~A.~%" arg0) - ) - ) - (the-as - ambient-sound - (cond - ((or sv-16 (nonzero? sv-32)) - (let ((s5-1 (the-as object (object-new allocation type-to-make (the-as int (-> type-to-make size)))))) - (set! (-> (the-as ambient-sound s5-1) spec) sv-16) - (set! (-> (the-as ambient-sound s5-1) name) sv-32) - (set! (-> (the-as ambient-sound s5-1) playing-id) (new-sound-id)) - (set! (-> (the-as ambient-sound s5-1) params) (the-as (pointer float) sv-52)) - (set! (-> (the-as ambient-sound s5-1) param-count) sv-56) - (set! (-> (the-as ambient-sound s5-1) entity) #f) - (set! (-> (the-as ambient-sound s5-1) sound-count) 1) - (set! (-> (the-as ambient-sound s5-1) volume) 1024) - (set! (-> (the-as ambient-sound s5-1) pitch) 0) - (when (and sv-16 (!= sv-16 *ambient-spec*)) - (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask volume)) - (set! (-> (the-as ambient-sound s5-1) volume) (-> (the-as sound-spec sv-16) volume)) - ) - (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask pitch)) - (set! (-> (the-as ambient-sound s5-1) pitch) (-> (the-as sound-spec sv-16) pitch-mod)) - ) - ) - (cond - (sv-48 - (set! (-> (the-as ambient-sound s5-1) time-base) (the-as time-frame (the int (* 300.0 (-> sv-48 0))))) - (set! (-> (the-as ambient-sound s5-1) time-random) (the-as time-frame (the int (* 300.0 (-> sv-48 1))))) - ) - (else - (set! (-> (the-as ambient-sound s5-1) time-base) -1) - ) - ) - (set! (-> (the-as ambient-sound s5-1) trans quad) (-> arg1 quad)) - s5-1 - ) + ((sound-spec) + (set! sv-16 (the-as sound-spec arg0)) + ) + ((string) + (set! sv-32 (string->sound-name (the-as string arg0))) ) (else - 0 + (format 0 "ERROR: ambient sound was told to play an unknown ~A.~%" arg0) + ) + ) + (the-as + ambient-sound + (cond + ((or sv-16 (nonzero? sv-32)) + (let ((s5-1 (the-as object (object-new allocation type-to-make (the-as int (-> type-to-make size)))))) + (set! (-> (the-as ambient-sound s5-1) spec) sv-16) + (set! (-> (the-as ambient-sound s5-1) name) sv-32) + (set! (-> (the-as ambient-sound s5-1) playing-id) (new-sound-id)) + (set! (-> (the-as ambient-sound s5-1) params) (the-as (pointer float) sv-52)) + (set! (-> (the-as ambient-sound s5-1) param-count) sv-56) + (set! (-> (the-as ambient-sound s5-1) entity) #f) + (set! (-> (the-as ambient-sound s5-1) sound-count) 1) + (set! (-> (the-as ambient-sound s5-1) volume) 1024) + (set! (-> (the-as ambient-sound s5-1) pitch) 0) + (when (and sv-16 (!= sv-16 *ambient-spec*)) + (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask volume)) + (set! (-> (the-as ambient-sound s5-1) volume) (-> (the-as sound-spec sv-16) volume)) + ) + (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask pitch)) + (set! (-> (the-as ambient-sound s5-1) pitch) (-> (the-as sound-spec sv-16) pitch-mod)) + ) + ) + (cond + (sv-48 + (set! (-> (the-as ambient-sound s5-1) time-base) (the-as time-frame (the int (* 300.0 (-> sv-48 0))))) + (set! (-> (the-as ambient-sound s5-1) time-random) (the-as time-frame (the int (* 300.0 (-> sv-48 1))))) + ) + (else + (set! (-> (the-as ambient-sound s5-1) time-base) -1) + ) + ) + (set! (-> (the-as ambient-sound s5-1) trans quad) (-> arg1 quad)) + s5-1 + ) + ) + (else + 0 + ) ) ) ) diff --git a/goal_src/jak2/engine/sound/speech.gc b/goal_src/jak2/engine/sound/speech.gc index 8810fa5c7f..e2c7be6ae7 100644 --- a/goal_src/jak2/engine/sound/speech.gc +++ b/goal_src/jak2/engine/sound/speech.gc @@ -42,11 +42,9 @@ ) (if (or (< (the-as time-frame (-> s5-1 request-timeout)) a0-8) (or (not v1-20) - (let ((f0-0 245760.0)) - (< (* f0-0 f0-0) - (vector-vector-distance-squared (-> this target-pos) (-> (the-as process-drawable v1-20) root trans)) - ) - ) + (< (square 245760.0) + (vector-vector-distance-squared (-> this target-pos) (-> (the-as process-drawable v1-20) root trans)) + ) ) ) (speech-channel-method-12 this) @@ -180,14 +178,9 @@ ) (defmethod speech-channel-method-9 ((this speech-channel) (arg0 process-drawable) (arg1 speech-type)) - (let ((f0-0 (vector-vector-distance-squared (-> arg0 root trans) (-> this target-pos))) - (f1-0 245760.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (let* ((f1-3 -1.0) - (f2-0 409600.0) - (f0-2 (+ (* f0-0 (/ f1-3 (* f2-0 f2-0))) (the float (-> this speech-table arg1 priority)))) - ) + (let ((f0-0 (vector-vector-distance-squared (-> arg0 root trans) (-> this target-pos)))) + (when (< f0-0 (square 245760.0)) + (let ((f0-2 (+ (* f0-0 (/ -1.0 (square 409600.0))) (the float (-> this speech-table arg1 priority))))) (when (< (-> this request priority) f0-2) (set! (-> this request priority) f0-2) (set! (-> this request handle) (process->handle arg0)) @@ -259,7 +252,7 @@ (defmethod speech-control-method-14 ((this speech-control)) (speech-control-method-9 this) (let ((s5-0 (-> this channel-array))) - ((method-of-type speech-channel speech-channel-method-13) (the-as speech-channel s5-0)) + ((method-of-type speech-channel speech-channel-method-13) (-> s5-0 0)) (set! (-> s5-0 0 speech-table) (-> this speech-table)) (set! (-> s5-0 0 gui-channel) (gui-channel guard)) ) diff --git a/goal_src/jak2/engine/spatial-hash/actor-hash.gc b/goal_src/jak2/engine/spatial-hash/actor-hash.gc index 9846d1139a..4c589caa71 100644 --- a/goal_src/jak2/engine/spatial-hash/actor-hash.gc +++ b/goal_src/jak2/engine/spatial-hash/actor-hash.gc @@ -55,7 +55,6 @@ (defmethod hash-actors ((this actor-hash-buckets)) - (local-vars (sv-16 hash-object-info) (sv-32 collide-prim-core) (sv-48 collide-shape) (sv-64 hash-object-info)) (set! (-> this hash) *actor-hash*) (set! (-> this list) *collide-hit-by-others-list*) (clear-objects! (-> this hash)) @@ -74,11 +73,12 @@ (set! s2-0 (cond ((< s2-0 (-> s3-0 max-object-count)) - (let ((a0-7 (-> s3-0 sphere-array s2-0))) - (set! sv-16 (-> s3-0 object-array s2-0)) + (let ((a0-7 (-> s3-0 sphere-array s2-0)) + (sv-16 (-> s3-0 object-array s2-0)) + ) (mem-copy! (the-as pointer a0-7) (the-as pointer s1-0) 16) + (set! (-> sv-16 object) s0-0) ) - (set! (-> sv-16 object) s0-0) (dotimes (v1-12 3) (set! (-> s3-0 box-min v1-12) (fmin (-> s3-0 box-min v1-12) (- (-> s1-0 world-sphere data v1-12) (-> s1-0 world-sphere w))) @@ -115,20 +115,15 @@ (while (!= v1-25 (-> this list alive-list-end)) (let* ((s4-1 (the-as collide-shape (-> (the-as connection v1-25) param1))) (f0-4 (vector-vector-distance-squared (-> this tpos) (-> s4-1 trans))) - (f1-4 102400.0) ) (cond - ((< f0-4 (* f1-4 f1-4)) - ((method-of-type actor-hash-bucket add-actor-cshape) (the-as actor-hash-bucket (-> this data)) s4-1) + ((< f0-4 (square 102400.0)) + ((method-of-type actor-hash-bucket add-actor-cshape) (-> this data 0) s4-1) ) - ((let ((f1-7 204800.0)) - (< f0-4 (* f1-7 f1-7)) - ) + ((< f0-4 (square 204800.0)) (add-actor-cshape (-> this data 1) s4-1) ) - ((let ((f1-10 307200.0)) - (< f0-4 (* f1-10 f1-10)) - ) + ((< f0-4 (square 307200.0)) (add-actor-cshape (-> this data 2) s4-1) ) (else @@ -145,38 +140,38 @@ (dotimes (s5-3 4) (let ((s4-2 (-> this data s5-3))) (countdown (s3-1 (-> s4-2 length)) - (let ((s2-1 (-> s4-2 data s3-1 cshape)) - (s1-1 (-> this hash)) - ) - (set! sv-32 (-> s2-1 root-prim prim-core)) - (set! sv-48 s2-1) - (let ((s0-1 (-> s1-1 object-count))) - (set! s0-1 - (cond - ((< s0-1 (-> s1-1 max-object-count)) - (let ((a0-40 (-> s1-1 sphere-array s0-1))) - (set! sv-64 (-> s1-1 object-array s0-1)) - (mem-copy! (the-as pointer a0-40) (the-as pointer sv-32) 16) - ) + (let* ((s2-1 (-> s4-2 data s3-1 cshape)) + (s1-1 (-> this hash)) + (sv-32 (-> s2-1 root-prim prim-core)) + (sv-48 s2-1) + (s0-1 (-> s1-1 object-count)) + ) + (set! s0-1 + (cond + ((< s0-1 (-> s1-1 max-object-count)) + (let ((a0-40 (-> s1-1 sphere-array s0-1)) + (sv-64 (-> s1-1 object-array s0-1)) + ) + (mem-copy! (the-as pointer a0-40) (the-as pointer sv-32) 16) (set! (-> sv-64 object) sv-48) - (dotimes (v1-53 3) - (set! (-> s1-1 box-min v1-53) - (fmin (-> s1-1 box-min v1-53) (- (-> sv-32 world-sphere data v1-53) (-> sv-32 world-sphere w))) - ) - (set! (-> s1-1 box-max v1-53) - (fmax (-> s1-1 box-max v1-53) (+ (-> sv-32 world-sphere data v1-53) (-> sv-32 world-sphere w))) - ) - ) - (+! (-> s1-1 object-count) 1) - s0-1 ) - (else - -1 - ) + (dotimes (v1-53 3) + (set! (-> s1-1 box-min v1-53) + (fmin (-> s1-1 box-min v1-53) (- (-> sv-32 world-sphere data v1-53) (-> sv-32 world-sphere w))) + ) + (set! (-> s1-1 box-max v1-53) + (fmax (-> s1-1 box-max v1-53) (+ (-> sv-32 world-sphere data v1-53) (-> sv-32 world-sphere w))) + ) + ) + (+! (-> s1-1 object-count) 1) + s0-1 + ) + (else + -1 ) ) - (set! (-> s2-1 actor-hash-index) s0-1) - ) + ) + (set! (-> s2-1 actor-hash-index) s0-1) ) ) ) diff --git a/goal_src/jak2/engine/spatial-hash/spatial-hash.gc b/goal_src/jak2/engine/spatial-hash/spatial-hash.gc index 60691fe014..f74b834fe8 100644 --- a/goal_src/jak2/engine/spatial-hash/spatial-hash.gc +++ b/goal_src/jak2/engine/spatial-hash/spatial-hash.gc @@ -88,7 +88,7 @@ (t1-0 (-> this dimension-array 0)) (t2-0 (-> this dimension-array 2)) (t3-0 (-> this dimension-array 1)) - (a0-2 (&-> (-> this bucket-array) (/ (the-as int arg0) 8))) + (a0-2 (&-> this bucket-array (/ (the-as int arg0) 8))) (a1-2 (ash 1 (logand (the-as int arg0) 7))) ) (dotimes (t4-3 t3-0) @@ -520,44 +520,45 @@ ) (defun-debug draw-grid ((arg0 vector) (arg1 vector) (arg2 (pointer int8)) (arg3 rgba)) - (local-vars (sv-64 vector) (sv-68 vector) (sv-72 vector)) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! sv-68 (new 'stack-no-clear 'vector)) - (set! sv-72 (new 'stack-no-clear 'vector)) - (dotimes (v1-3 3) - (set! (-> sv-64 data v1-3) (/ (- (-> arg1 data v1-3) (-> arg0 data v1-3)) (the float (-> arg2 v1-3)))) - ) - (set! (-> sv-68 x) (-> arg0 x)) - (set! (-> sv-72 x) (-> arg1 x)) - (dotimes (s2-0 (+ (-> arg2 1) 1)) - (set! (-> sv-68 y) (+ (-> arg0 y) (* (the float s2-0) (-> sv-64 y)))) - (set! (-> sv-72 y) (-> sv-68 y)) - (dotimes (s1-0 (+ (-> arg2 2) 1)) - (set! (-> sv-68 z) (+ (-> arg0 z) (* (the float s1-0) (-> sv-64 z)))) - (set! (-> sv-72 z) (-> sv-68 z)) - (add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1)) + (let ((sv-64 (new 'stack-no-clear 'vector)) + (sv-68 (new 'stack-no-clear 'vector)) + (sv-72 (new 'stack-no-clear 'vector)) + ) + (dotimes (v1-3 3) + (set! (-> sv-64 data v1-3) (/ (- (-> arg1 data v1-3) (-> arg0 data v1-3)) (the float (-> arg2 v1-3)))) ) - ) - (set! (-> sv-68 z) (-> arg0 z)) - (set! (-> sv-72 z) (-> arg1 z)) - (dotimes (s2-1 (+ (-> arg2 1) 1)) - (set! (-> sv-68 y) (+ (-> arg0 y) (* (the float s2-1) (-> sv-64 y)))) - (set! (-> sv-72 y) (-> sv-68 y)) - (dotimes (s1-1 (+ (-> arg2 0) 1)) - (set! (-> sv-68 x) (+ (-> arg0 x) (* (the float s1-1) (-> sv-64 x)))) + (set! (-> sv-68 x) (-> arg0 x)) + (set! (-> sv-72 x) (-> arg1 x)) + (dotimes (s2-0 (+ (-> arg2 1) 1)) + (set! (-> sv-68 y) (+ (-> arg0 y) (* (the float s2-0) (-> sv-64 y)))) + (set! (-> sv-72 y) (-> sv-68 y)) + (dotimes (s1-0 (+ (-> arg2 2) 1)) + (set! (-> sv-68 z) (+ (-> arg0 z) (* (the float s1-0) (-> sv-64 z)))) + (set! (-> sv-72 z) (-> sv-68 z)) + (add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1)) + ) + ) + (set! (-> sv-68 z) (-> arg0 z)) + (set! (-> sv-72 z) (-> arg1 z)) + (dotimes (s2-1 (+ (-> arg2 1) 1)) + (set! (-> sv-68 y) (+ (-> arg0 y) (* (the float s2-1) (-> sv-64 y)))) + (set! (-> sv-72 y) (-> sv-68 y)) + (dotimes (s1-1 (+ (-> arg2 0) 1)) + (set! (-> sv-68 x) (+ (-> arg0 x) (* (the float s1-1) (-> sv-64 x)))) + (set! (-> sv-72 x) (-> sv-68 x)) + (add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1)) + ) + ) + (set! (-> sv-68 y) (-> arg0 y)) + (set! (-> sv-72 y) (-> arg1 y)) + (dotimes (s3-1 (+ (-> arg2 0) 1)) + (set! (-> sv-68 x) (+ (-> arg0 x) (* (the float s3-1) (-> sv-64 x)))) (set! (-> sv-72 x) (-> sv-68 x)) - (add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1)) - ) - ) - (set! (-> sv-68 y) (-> arg0 y)) - (set! (-> sv-72 y) (-> arg1 y)) - (dotimes (s3-1 (+ (-> arg2 0) 1)) - (set! (-> sv-68 x) (+ (-> arg0 x) (* (the float s3-1) (-> sv-64 x)))) - (set! (-> sv-72 x) (-> sv-68 x)) - (dotimes (s2-2 (+ (-> arg2 2) 1)) - (set! (-> sv-68 z) (+ (-> arg0 z) (* (the float s2-2) (-> sv-64 z)))) - (set! (-> sv-72 z) (-> sv-68 z)) - (add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1)) + (dotimes (s2-2 (+ (-> arg2 2) 1)) + (set! (-> sv-68 z) (+ (-> arg0 z) (* (the float s2-2) (-> sv-64 z)))) + (set! (-> sv-72 z) (-> sv-68 z)) + (add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1)) + ) ) ) 0 diff --git a/goal_src/jak2/engine/target/board/board-states.gc b/goal_src/jak2/engine/target/board/board-states.gc index a7c5397f60..2314ceff1b 100644 --- a/goal_src/jak2/engine/target/board/board-states.gc +++ b/goal_src/jak2/engine/target/board/board-states.gc @@ -813,10 +813,6 @@ (target-board-handler proc argc message block) ) :enter (behavior ((arg0 meters) (arg1 meters) (arg2 symbol)) - (local-vars - (sv-144 (function vector entity-actor skeleton-group vector object none :behavior manipy)) - (sv-160 entity-actor) - ) (if (= arg2 'hit) (set! arg2 #f) ) @@ -847,36 +843,19 @@ (set! (-> s3-2 quad) (-> self control trans quad)) (+! (-> s3-2 y) 2048.0) (part-tracker-spawn :to self :group group-board-quick-jump :mat-joint s3-2) - (let* ((s1-1 (get-process *default-dead-pool* manipy #x4000)) - (s2-2 - (when s1-1 - (let ((t9-8 (method-of-type manipy activate))) - (t9-8 (the-as manipy s1-1) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s2-3 run-function-in-process) - (s0-1 s1-1) - ) - (set! sv-144 manipy-init) - (set! sv-160 (-> self entity)) - (let ((t0-2 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) - (t1-1 #f) - (t2-1 0) - ) - ((the-as (function object object object object object object object none) s2-3) - s0-1 - sv-144 - s3-2 - sv-160 - t0-2 - t1-1 - t2-1 - ) - ) - ) - (-> s1-1 ppointer) - ) - ) - ) + (let ((s2-2 + (process-spawn + manipy + :init manipy-init + s3-2 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) + ) (when s2-2 (quaternion-copy! (-> (the-as board (-> s2-2 0)) root quat) (-> self control quat-for-control)) (send-event (ppointer->process s2-2) 'anim-mode 'play1) diff --git a/goal_src/jak2/engine/target/board/target-board.gc b/goal_src/jak2/engine/target/board/target-board.gc index f9eaa9e3e7..2bcefe3c03 100644 --- a/goal_src/jak2/engine/target/board/target-board.gc +++ b/goal_src/jak2/engine/target/board/target-board.gc @@ -2054,7 +2054,6 @@ ;; WARN: Found some very strange gotos. Check result carefully, this is not well tested. (defbehavior target-board-compute-edge target () - (local-vars (sv-768 int)) (let ((s4-0 *edge-grab-info*) (gp-0 (new 'stack-no-clear 'vector)) ) @@ -2268,8 +2267,8 @@ ) (s3-8 (new 'stack-no-clear 'collide-query)) (f26-1 81920.0) + (sv-768 8) ) - (set! sv-768 8) (let ((v1-234 s3-8)) (set! (-> v1-234 radius) 1228.8) (set! (-> v1-234 collide-with) diff --git a/goal_src/jak2/engine/target/collide-reaction-target.gc b/goal_src/jak2/engine/target/collide-reaction-target.gc index 61f3a50b39..f708c27884 100644 --- a/goal_src/jak2/engine/target/collide-reaction-target.gc +++ b/goal_src/jak2/engine/target/collide-reaction-target.gc @@ -9,31 +9,32 @@ (defun poly-find-nearest-edge ((arg0 nav-poly) (arg1 (inline-array vector)) (arg2 vector) (arg3 vector)) "TODO- Not 100% sure here, but unused" - (local-vars (sv-32 vector) (sv-36 float) (sv-40 int) (sv-48 float) (sv-80 vector)) - (set! sv-32 (new 'stack-no-clear 'vector)) - (set! sv-36 (the-as float 4095996000.0)) - (set! sv-40 -1) - (set! sv-48 (the-as float 0.0)) - (dotimes (s2-0 3) - (let ((s0-0 (-> arg1 s2-0))) - (set! sv-80 (-> arg1 (mod (+ s2-0 1) 3))) - (let ((f30-0 (vector-line-distance-point! arg2 s0-0 sv-80 sv-32)) - (s1-1 (vector-! (new 'stack-no-clear 'vector) sv-80 s0-0)) - ) - 0.0 - (vector-normalize! s1-1 1.0) - (let ((f0-5 (fabs (vector-dot arg3 s1-1)))) - (when (or (< f30-0 sv-36) (and (= f30-0 sv-36) (< sv-48 f0-5))) - (set! sv-36 f30-0) - (set! sv-40 s2-0) - (set! sv-48 f0-5) + (let ((sv-32 (new 'stack-no-clear 'vector)) + (sv-36 (the-as float 4095996000.0)) + (sv-40 -1) + ) + (let ((sv-48 (the-as float 0.0))) + (dotimes (s2-0 3) + (let* ((s0-0 (-> arg1 s2-0)) + (sv-80 (-> arg1 (mod (+ s2-0 1) 3))) + (f30-0 (vector-line-distance-point! arg2 s0-0 sv-80 sv-32)) + (s1-1 (vector-! (new 'stack-no-clear 'vector) sv-80 s0-0)) + ) + 0.0 + (vector-normalize! s1-1 1.0) + (let ((f0-5 (fabs (vector-dot arg3 s1-1)))) + (when (or (< f30-0 sv-36) (and (= f30-0 sv-36) (< sv-48 f0-5))) + (set! sv-36 f30-0) + (set! sv-40 s2-0) + (set! sv-48 f0-5) + ) ) ) ) ) + (set! (-> arg0 vertex 0 quad) (-> arg1 sv-40 quad)) + (set! (-> arg0 vertex1 quad) (-> arg1 (mod (+ sv-40 1) 3) quad)) ) - (set! (-> arg0 vertex 0 quad) (-> arg1 sv-40 quad)) - (set! (-> arg0 vertex1 quad) (-> arg1 (mod (+ sv-40 1) 3) quad)) arg0 ) @@ -44,456 +45,437 @@ (arg4 (pointer collide-status)) (arg5 (pointer symbol)) ) - (local-vars - (contact-normal vector) - (sv-20 (pointer cshape-reaction-flags)) - (sv-24 (pointer collide-status)) - (sv-28 (pointer symbol)) - (sv-32 cshape-reaction-flags) - (sv-40 collide-status) - (sv-48 symbol) - (tangent vector) - (overhang-nrm vector) - ) - (set! contact-normal arg2) - (set! sv-20 arg3) - (set! sv-24 arg4) - (set! sv-28 arg5) - (set! sv-32 (-> arg3 0)) - (set! sv-40 (-> arg4 0)) - (set! sv-48 (-> arg5 0)) - (set! tangent (-> arg0 low-coverage-tangent)) - (set! overhang-nrm - (vector-cross! (-> arg0 low-coverage-overhang-plane-normal) (-> arg0 poly-normal) contact-normal) + (let ((contact-normal arg2) + (sv-20 arg3) + (sv-24 arg4) + (sv-28 arg5) + (sv-32 (-> arg3 0)) + (sv-40 (-> arg4 0)) + (sv-48 (-> arg5 0)) ) - (vector-normalize! overhang-nrm 1.0) - (if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) overhang-nrm)) 0.866) - (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf09))) - ) - (vector-cross! tangent contact-normal overhang-nrm) - (if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) tangent)) - (vector-negate! tangent tangent) - ) - (vector-normalize! tangent 1.0) - (let ((s4-0 (new 'stack-no-clear 'collide-query))) - (let ((s3-0 (vector-flatten! (-> arg0 low-coverage-tangent-xz) tangent (-> arg0 dynam gravity-normal)))) - (let ((v1-19 s4-0)) - (set! (-> v1-19 radius) 409.6) - (set! (-> v1-19 collide-with) (-> arg1 best-my-prim prim-core collide-with)) - (set! (-> v1-19 ignore-process0) #f) - (set! (-> v1-19 ignore-process1) #f) - (set! (-> v1-19 ignore-pat) (-> arg0 pat-ignore-mask)) - (set! (-> v1-19 action-mask) (collide-action solid)) - ) - (vector-normalize! s3-0 1.0) - (if (< (vector-dot s3-0 contact-normal) 0.0) - (vector-negate! s3-0 s3-0) - ) - (set! (-> arg0 low-coverage-slope-to-next1) 4095996000.0) - (set! (-> arg0 low-coverage-dist-to-next2) 4095996000.0) - (vector+float*! (-> s4-0 start-pos) (-> arg1 best-other-tri intersect) s3-0 2867.2) - (vector-normalize-copy! (-> s4-0 move-dist) (-> arg0 dynam gravity-normal) -20480.0) - (vector+float*! (-> s4-0 move-dist) (-> s4-0 move-dist) s3-0 4096.0) - (when (>= (probe-using-line-sphere *collide-cache* s4-0) 0.0) - (set! (-> arg0 low-coverage-slope-to-next1) - (vector-dot - (-> arg0 dynam gravity-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> s4-0 best-other-tri intersect)) - ) + (let ((tangent (-> arg0 low-coverage-tangent))) + (let ((overhang-nrm + (vector-cross! (-> arg0 low-coverage-overhang-plane-normal) (-> arg0 poly-normal) contact-normal) ) - (set! (-> arg0 low-coverage-pat-next1) (-> s4-0 best-other-tri pat)) - (set! (-> arg0 low-coverage-norm-of-next1 quad) (-> s4-0 best-other-tri normal quad)) - 0 - ) - (vector+float*! (-> s4-0 start-pos) (-> arg1 best-other-tri intersect) (-> arg0 dynam gravity-normal) 819.2) - (vector-normalize-copy! (-> s4-0 move-dist) (-> arg0 dynam gravity-normal) -20480.0) - (vector+float*! (-> s4-0 start-pos) (-> s4-0 start-pos) s3-0 -819.2) - (vector+float*! (-> s4-0 move-dist) (-> s4-0 move-dist) s3-0 -4096.0) - ) - (when (>= (probe-using-line-sphere *collide-cache* s4-0) 0.0) - (set! (-> arg0 low-coverage-dist-to-next2) - (vector-vector-distance (-> s4-0 start-pos) (-> s4-0 best-other-tri intersect)) ) - (set! (-> arg0 low-coverage-pat-next2) (-> s4-0 best-other-tri pat)) - (set! (-> arg0 low-coverage-norm-of-next2 quad) (-> s4-0 best-other-tri normal quad)) - 0 - ) - ) - (when (and (not (logtest? sv-32 (cshape-reaction-flags csrf09))) - (and (or (< (* 1.25 (-> arg1 best-my-prim local-sphere w)) (-> arg0 low-coverage-slope-to-next1)) - (= (-> arg0 low-coverage-pat-next1 mode) (pat-mode wall)) - ) - (and (< (-> arg0 low-coverage-dist-to-next2) (* 2.0 (-> arg1 best-my-prim local-sphere w))) - (or (= (-> arg0 low-coverage-pat-next2 mode) (pat-mode ground)) - (= (-> arg0 low-coverage-pat-next2 mode) (pat-mode halfpipe)) + (vector-normalize! overhang-nrm 1.0) + (if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) overhang-nrm)) 0.866) + (logior! sv-32 (cshape-reaction-flags csrf09)) + ) + (vector-cross! tangent contact-normal overhang-nrm) + ) + (if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) tangent)) + (vector-negate! tangent tangent) + ) + (vector-normalize! tangent 1.0) + (let ((s4-0 (new 'stack-no-clear 'collide-query))) + (let ((s3-0 (vector-flatten! (-> arg0 low-coverage-tangent-xz) tangent (-> arg0 dynam gravity-normal)))) + (let ((v1-19 s4-0)) + (set! (-> v1-19 radius) 409.6) + (set! (-> v1-19 collide-with) (-> arg1 best-my-prim prim-core collide-with)) + (set! (-> v1-19 ignore-process0) #f) + (set! (-> v1-19 ignore-process1) #f) + (set! (-> v1-19 ignore-pat) (-> arg0 pat-ignore-mask)) + (set! (-> v1-19 action-mask) (collide-action solid)) + ) + (vector-normalize! s3-0 1.0) + (if (< (vector-dot s3-0 contact-normal) 0.0) + (vector-negate! s3-0 s3-0) + ) + (set! (-> arg0 low-coverage-slope-to-next1) 4095996000.0) + (set! (-> arg0 low-coverage-dist-to-next2) 4095996000.0) + (vector+float*! (-> s4-0 start-pos) (-> arg1 best-other-tri intersect) s3-0 2867.2) + (vector-normalize-copy! (-> s4-0 move-dist) (-> arg0 dynam gravity-normal) -20480.0) + (vector+float*! (-> s4-0 move-dist) (-> s4-0 move-dist) s3-0 4096.0) + (when (>= (probe-using-line-sphere *collide-cache* s4-0) 0.0) + (set! (-> arg0 low-coverage-slope-to-next1) + (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> s4-0 best-other-tri intersect)) + ) + ) + (set! (-> arg0 low-coverage-pat-next1) (-> s4-0 best-other-tri pat)) + (set! (-> arg0 low-coverage-norm-of-next1 quad) (-> s4-0 best-other-tri normal quad)) + 0 + ) + (vector+float*! (-> s4-0 start-pos) (-> arg1 best-other-tri intersect) (-> arg0 dynam gravity-normal) 819.2) + (vector-normalize-copy! (-> s4-0 move-dist) (-> arg0 dynam gravity-normal) -20480.0) + (vector+float*! (-> s4-0 start-pos) (-> s4-0 start-pos) s3-0 -819.2) + (vector+float*! (-> s4-0 move-dist) (-> s4-0 move-dist) s3-0 -4096.0) + ) + (when (>= (probe-using-line-sphere *collide-cache* s4-0) 0.0) + (set! (-> arg0 low-coverage-dist-to-next2) + (vector-vector-distance (-> s4-0 start-pos) (-> s4-0 best-other-tri intersect)) + ) + (set! (-> arg0 low-coverage-pat-next2) (-> s4-0 best-other-tri pat)) + (set! (-> arg0 low-coverage-norm-of-next2 quad) (-> s4-0 best-other-tri normal quad)) + 0 + ) + ) + (when (and (not (logtest? sv-32 (cshape-reaction-flags csrf09))) + (and (or (< (* 1.25 (-> arg1 best-my-prim local-sphere w)) (-> arg0 low-coverage-slope-to-next1)) + (= (-> arg0 low-coverage-pat-next1 mode) (pat-mode wall)) + ) + (and (< (-> arg0 low-coverage-dist-to-next2) (* 2.0 (-> arg1 best-my-prim local-sphere w))) + (or (= (-> arg0 low-coverage-pat-next2 mode) (pat-mode ground)) + (= (-> arg0 low-coverage-pat-next2 mode) (pat-mode halfpipe)) + ) ) + ) + ) + (logior! sv-32 (cshape-reaction-flags csrf07)) + (set-time! (-> arg0 time-of-last-lc-touch-edge)) + (logior! sv-40 (collide-status touch-edge)) + (set-time! (-> arg0 time-of-last-lc)) + (let ((f30-0 (vector-dot tangent (-> arg0 turn-to-target))) + (f0-27 (if (logtest? sv-32 (cshape-reaction-flags csrf01)) + (cos (- 16384.0 (acos (-> arg0 coverage)))) + (-> arg0 coverage) + ) + ) + (f1-11 (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-other-tri intersect)) + ) + ) + ) + (if (or (not (logtest? sv-32 (cshape-reaction-flags csrf05))) (< 0.5 f0-27)) + (set! sv-48 (the-as symbol #f)) + ) + (when (and (or (and (< f0-27 0.95) (>= f30-0 0.0)) + (and (logtest? sv-32 (cshape-reaction-flags csrf05)) (< f0-27 0.3)) + (< f1-11 (/ (-> arg1 best-my-prim local-sphere w) -4)) + ) + (>= (vector-dot tangent contact-normal) -0.000001) + ) + (set! (-> arg0 surf) *edge-surface*) + (logior! sv-32 (cshape-reaction-flags csrf10)) + (set! sv-48 (the-as symbol #f)) + (when (logtest? sv-32 (cshape-reaction-flags csrf05)) + (set! sv-48 #t) + (logior! sv-32 (cshape-reaction-flags csrf12)) + ) + ) + ) + ) + ) + (if (< (-> arg0 surface-angle) 0.0) + (set! sv-48 #t) + ) + (when sv-48 + (cond + ((and (or (or (= (-> arg0 poly-pat mode) (pat-mode ground)) (= (-> arg0 poly-pat mode) (pat-mode halfpipe))) + (and (logtest? sv-32 (cshape-reaction-flags csrf03)) + (>= (* 1.25 (-> arg1 best-my-prim local-sphere w)) (-> arg0 low-coverage-slope-to-next1)) + (or (= (-> arg0 low-coverage-pat-next1 mode) (pat-mode ground)) + (= (-> arg0 low-coverage-pat-next1 mode) (pat-mode halfpipe)) + ) + (< 0.3 (fabs (-> arg0 surface-angle))) ) ) - ) - (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf07))) - (set-time! (-> arg0 time-of-last-lc-touch-edge)) - (set! sv-40 (logior sv-40 (collide-status touch-edge))) - (set-time! (-> arg0 time-of-last-lc)) - (let ((f30-0 (vector-dot tangent (-> arg0 turn-to-target))) - (f0-27 (if (logtest? sv-32 (cshape-reaction-flags csrf01)) - (cos (- 16384.0 (acos (-> arg0 coverage)))) - (-> arg0 coverage) - ) - ) - (f1-11 (vector-dot - (-> arg0 dynam gravity-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-other-tri intersect)) - ) - ) - ) - (if (or (not (logtest? sv-32 (cshape-reaction-flags csrf05))) (< 0.5 f0-27)) - (set! sv-48 (the-as symbol #f)) - ) - (when (and (or (and (< f0-27 0.95) (>= f30-0 0.0)) - (and (logtest? sv-32 (cshape-reaction-flags csrf05)) (< f0-27 0.3)) - (< f1-11 (/ (-> arg1 best-my-prim local-sphere w) -4)) - ) - (>= (vector-dot tangent contact-normal) -0.000001) - ) - (set! (-> arg0 surf) *edge-surface*) - (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf10))) - (set! sv-48 (the-as symbol #f)) - (when (logtest? sv-32 (cshape-reaction-flags csrf05)) - (set! sv-48 #t) - (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf12))) + (not (logtest? sv-32 (cshape-reaction-flags csrf07))) + ) + (logior! sv-32 (cshape-reaction-flags csrf06)) + (logior! sv-40 (collide-status touch-edge)) + (set-time! (-> arg0 time-of-last-lc)) + (set! sv-48 (the-as symbol #f)) + ) + (#t + (logior! sv-32 (cshape-reaction-flags csrf06)) + (logior! sv-40 (collide-status touch-edge)) + (set-time! (-> arg0 time-of-last-lc)) ) ) ) + (set! (-> sv-24 0) sv-40) + (set! (-> sv-20 0) sv-32) + (set! (-> sv-28 0) sv-48) ) - (if (< (-> arg0 surface-angle) 0.0) - (set! sv-48 #t) - ) - (when sv-48 - (cond - ((and (or (or (= (-> arg0 poly-pat mode) (pat-mode ground)) (= (-> arg0 poly-pat mode) (pat-mode halfpipe))) - (and (logtest? sv-32 (cshape-reaction-flags csrf03)) - (>= (* 1.25 (-> arg1 best-my-prim local-sphere w)) (-> arg0 low-coverage-slope-to-next1)) - (or (= (-> arg0 low-coverage-pat-next1 mode) (pat-mode ground)) - (= (-> arg0 low-coverage-pat-next1 mode) (pat-mode halfpipe)) - ) - (< 0.3 (fabs (-> arg0 surface-angle))) - ) - ) - (not (logtest? sv-32 (cshape-reaction-flags csrf07))) - ) - (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf06))) - (set! sv-40 (logior sv-40 (collide-status touch-edge))) - (set-time! (-> arg0 time-of-last-lc)) - (set! sv-48 (the-as symbol #f)) - ) - (#t - (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf06))) - (set! sv-40 (logior sv-40 (collide-status touch-edge))) - (set-time! (-> arg0 time-of-last-lc)) - ) - ) - ) - (set! (-> sv-24 0) sv-40) - (set! (-> sv-20 0) sv-32) - (set! (-> sv-28 0) sv-48) 0 (none) ) (defbehavior target-collision-reaction target ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) - (local-vars - (sv-80 vector) - (sv-84 vector) - (sv-88 matrix) - (sv-96 collide-status) - (sv-104 cshape-reaction-flags) - (sv-240 symbol) - ) - (set! sv-80 (new-stack-vector0)) - (set! sv-84 (new-stack-vector0)) - (let ((v1-2 (new 'stack-no-clear 'matrix))) + (let ((sv-80 (new-stack-vector0)) + (sv-84 (new-stack-vector0)) + (v1-2 (new 'stack-no-clear 'matrix)) + ) (dotimes (a0-1 2) (set! (-> v1-2 quad a0-1) (the-as uint128 0)) ) - (set! sv-88 v1-2) - ) - (set! sv-96 (collide-status)) - (set! sv-104 (cshape-reaction-flags)) - (set! (-> sv-88 vector 0 quad) (-> arg3 quad)) - (set! (-> sv-88 vector 1 quad) (-> arg3 quad)) - (let ((a1-3 (new 'stack-no-clear 'vector))) - (vector-float*! a1-3 (-> arg1 move-dist) (-> arg1 best-dist)) - (move-by-vector! arg0 a1-3) - ) - (set! sv-104 (logior sv-104 (react-to-pat! arg0 (-> arg1 best-other-tri pat)))) - (if (= (-> arg0 poly-pat mode) (pat-mode wall)) - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf00))) - ) - (if (logtest? (-> arg0 mod-surface flags) (surface-flag air)) - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf05))) - ) - (let ((v1-24 (new 'stack-no-clear 'vector))) - (set! (-> v1-24 quad) (-> arg1 best-my-prim prim-core world-sphere quad)) - (vector-! sv-80 v1-24 (-> arg1 best-other-tri intersect)) - ) - (vector-normalize! sv-80 1.0) - (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-other-tri normal))) - (when (< (-> arg0 coverage) 0.0) - (set! (-> arg0 coverage) 0.0) - (vector-flatten! sv-80 sv-80 (-> arg1 best-other-tri normal)) - (vector-normalize! sv-80 1.0) - ) - (if (< (-> arg0 coverage) 0.9999) - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf03 csrf04))) - ) - (let ((v1-35 (-> sv-80 quad))) - (set! (-> sv-84 quad) v1-35) - ) - (if (= (-> arg1 best-dist) 0.0) - (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) - ) - (set! (-> arg0 poly-normal quad) (-> arg1 best-other-tri normal quad)) - (collide-shape-moving-angle-set! arg0 sv-84 (the-as vector (-> sv-88 vector))) - (if (< (-> arg0 poly-angle) -0.2) - (set! sv-96 (logior sv-96 (collide-status touch-ceiling))) - ) - (if (< (-> arg0 poly-angle) 0.0) - (set! sv-96 (logior sv-96 (collide-status touch-ceiling-sticky))) - ) - (if (!= (-> arg1 best-my-prim prim-id) 6) - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf15))) - ) - (if (and (= (-> arg0 cur-pat mode) (pat-mode halfpipe)) (< (-> arg0 poly-angle) 0.75)) - (send-event (-> arg0 process) 'slide) - ) - (set! sv-240 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) - (if (and sv-240 (and (= (-> arg0 mod-surface mode) 'dive) (< 0.4 (fabs (-> arg0 surface-angle))))) - (set! sv-240 (the-as symbol #f)) - ) - (if (and (logtest? sv-104 (cshape-reaction-flags csrf15)) - (logtest? sv-104 (cshape-reaction-flags csrf05)) - (>= (-> arg0 poly-angle) 0.0) - (not sv-240) - ) - (set! sv-240 #t) - ) - (if sv-240 - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf01))) - ) - (if (logtest? sv-104 (cshape-reaction-flags csrf03)) - (target-collision-low-coverage arg0 arg1 sv-84 (& sv-104) (& sv-96) (& sv-240)) - ) - (when (not (logtest? (-> arg0 prev-status) (collide-status on-surface))) - (set! (-> arg0 transv-on-last-impact quad) (-> arg0 transv quad)) - (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) - (set! (-> arg0 normal-impact-vel) (- (vector-dot (-> arg0 transv) sv-84))) - (set! sv-96 (logior sv-96 (collide-status impact-surface))) - (if (nonzero? (-> arg0 current-surface impact-hook)) - ((-> arg0 current-surface impact-hook) arg0 (the-as (pointer float) (-> sv-88 vector)) sv-84) - ) - (when (not sv-240) - (let ((f0-21 (- 1.0 (-> arg0 current-surface impact-fric)))) - (when (< f0-21 1.0) - (let ((v1-113 (new-stack-vector0)) - (f1-13 (vector-dot (-> arg0 dynam gravity-normal) (the-as vector (-> sv-88 vector)))) - ) - 0.0 - (vector-! - v1-113 - (the-as vector (-> sv-88 vector)) - (vector-float*! v1-113 (-> arg0 dynam gravity-normal) f1-13) - ) - (let* ((f2-2 (vector-length v1-113)) - (f3-0 f2-2) - ) - (if (< f1-13 0.0) - (set! f1-13 (* f1-13 f0-21)) - ) - (vector+! - (the-as vector (-> sv-88 vector)) - (vector-float*! (the-as vector (-> sv-88 vector)) (-> arg0 dynam gravity-normal) f1-13) - (vector-float*! v1-113 v1-113 (/ f2-2 f3-0)) - ) - ) + (let ((sv-88 v1-2) + (sv-96 (collide-status)) + ) + (let ((sv-104 (cshape-reaction-flags))) + (set! (-> sv-88 vector 0 quad) (-> arg3 quad)) + (set! (-> sv-88 vector 1 quad) (-> arg3 quad)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (vector-float*! a1-3 (-> arg1 move-dist) (-> arg1 best-dist)) + (move-by-vector! arg0 a1-3) + ) + (logior! sv-104 (react-to-pat! arg0 (-> arg1 best-other-tri pat))) + (if (= (-> arg0 poly-pat mode) (pat-mode wall)) + (logior! sv-104 (cshape-reaction-flags csrf00)) ) + (if (logtest? (-> arg0 mod-surface flags) (surface-flag air)) + (logior! sv-104 (cshape-reaction-flags csrf05)) + ) + (let ((v1-24 (new 'stack-no-clear 'vector))) + (set! (-> v1-24 quad) (-> arg1 best-my-prim prim-core world-sphere quad)) + (vector-! sv-80 v1-24 (-> arg1 best-other-tri intersect)) ) - ) - ) - ) - (set! sv-96 (logior sv-96 (collide-status touch-surface))) - (cond - ((-> arg1 num-spheres) - (set! sv-96 (logior sv-96 (collide-status touch-actor))) - (set! (-> arg0 actor-contact-pt quad) (-> arg1 best-other-tri intersect quad)) - (set! (-> arg0 actor-contact-normal quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 actor-contact-handle) - (process->handle (-> (the-as collide-shape-prim (-> arg1 num-spheres)) cshape process)) - ) - ) - ((= (-> arg0 poly-pat material) (pat-material waterbottom)) - ) - (else - (set! sv-96 (logior sv-96 (collide-status touch-background))) - ) - ) - (cond - (sv-240 - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf02))) - (set! sv-96 (logior sv-96 (collide-status touch-wall))) - (set! (-> arg0 cur-pat mode) 1) - (set! (-> arg0 wall-contact-pt quad) (-> arg1 best-other-tri intersect quad)) - (set! (-> arg0 wall-contact-poly-normal quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 wall-contact-normal quad) (-> sv-84 quad)) - (set! (-> arg0 wall-contact-pat) (-> arg1 best-other-tri pat)) - (cond - ((and (focus-test? (the-as process-focusable (-> arg0 process)) mech) - (logtest? sv-104 (cshape-reaction-flags csrf15)) - (logtest? sv-104 (cshape-reaction-flags csrf05)) - (< 0.0 (vector-dot sv-84 (-> arg0 dynam gravity-normal))) - (< 0.0 (vector-dot (the-as vector (-> sv-88 vector)) (-> arg0 dynam gravity-normal))) + (vector-normalize! sv-80 1.0) + (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-other-tri normal))) + (when (< (-> arg0 coverage) 0.0) + (set! (-> arg0 coverage) 0.0) + (vector-flatten! sv-80 sv-80 (-> arg1 best-other-tri normal)) + (vector-normalize! sv-80 1.0) + ) + (if (< (-> arg0 coverage) 0.9999) + (logior! sv-104 (cshape-reaction-flags csrf03 csrf04)) + ) + (set! (-> sv-84 quad) (-> sv-80 quad)) + (if (= (-> arg1 best-dist) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) + ) + (set! (-> arg0 poly-normal quad) (-> arg1 best-other-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 vector 0)) + (if (< (-> arg0 poly-angle) -0.2) + (logior! sv-96 (collide-status touch-ceiling)) + ) + (if (< (-> arg0 poly-angle) 0.0) + (logior! sv-96 (collide-status touch-ceiling-sticky)) + ) + (if (!= (-> arg1 best-my-prim prim-id) 6) + (logior! sv-104 (cshape-reaction-flags csrf15)) + ) + (if (and (= (-> arg0 cur-pat mode) (pat-mode halfpipe)) (< (-> arg0 poly-angle) 0.75)) + (send-event (-> arg0 process) 'slide) + ) + (let ((sv-240 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) + (if (and sv-240 (and (= (-> arg0 mod-surface mode) 'dive) (< 0.4 (fabs (-> arg0 surface-angle))))) + (set! sv-240 (the-as symbol #f)) ) - (set! (-> arg0 surf) *edge-surface*) - (set! sv-104 (logior (cshape-reaction-flags csrf16) sv-104)) - (vector-flatten! arg2 (vector-negate! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal)) sv-84) - (vector-normalize! arg2 (vector-dot arg2 (the-as vector (-> sv-88 vector)))) - ) - (else - (vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84) - ) - ) - (cond - ((and (or (and (>= (-> arg1 best-my-prim local-sphere w) - (vector-dot - (-> arg0 ground-poly-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> arg0 grount-touch-point)) - ) + (if (and (logtest? sv-104 (cshape-reaction-flags csrf15)) + (logtest? sv-104 (cshape-reaction-flags csrf05)) + (>= (-> arg0 poly-angle) 0.0) + (not sv-240) + ) + (set! sv-240 #t) + ) + (if sv-240 + (logior! sv-104 (cshape-reaction-flags csrf01)) + ) + (if (logtest? sv-104 (cshape-reaction-flags csrf03)) + (target-collision-low-coverage arg0 arg1 sv-84 (& sv-104) (& sv-96) (& sv-240)) + ) + (when (not (logtest? (-> arg0 prev-status) (collide-status on-surface))) + (set! (-> arg0 transv-on-last-impact quad) (-> arg0 transv quad)) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + (set! (-> arg0 normal-impact-vel) (- (vector-dot (-> arg0 transv) sv-84))) + (logior! sv-96 (collide-status impact-surface)) + (if (nonzero? (-> arg0 current-surface impact-hook)) + ((-> arg0 current-surface impact-hook) arg0 (&-> sv-88 vector 0 x) sv-84) + ) + (when (not sv-240) + (let ((f0-21 (- 1.0 (-> arg0 current-surface impact-fric)))) + (when (< f0-21 1.0) + (let ((v1-113 (new-stack-vector0)) + (f1-13 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 vector 0))) + ) + 0.0 + (vector-! v1-113 (-> sv-88 vector 0) (vector-float*! v1-113 (-> arg0 dynam gravity-normal) f1-13)) + (let* ((f2-2 (vector-length v1-113)) + (f3-0 f2-2) ) - (not (time-elapsed? (-> arg0 list-time-on-ground) (seconds 0.3))) - ) - (logtest? sv-104 (cshape-reaction-flags csrf15)) - ) - (>= (vector-dot - (-> arg0 dynam gravity-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> arg0 grount-touch-point)) + (if (< f1-13 0.0) + (set! f1-13 (* f1-13 f0-21)) + ) + (vector+! + (-> sv-88 vector 0) + (vector-float*! (-> sv-88 vector 0) (-> arg0 dynam gravity-normal) f1-13) + (vector-float*! v1-113 v1-113 (/ f2-2 f3-0)) + ) + ) ) - 0.0 ) - (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) - (not (logtest? sv-104 (cshape-reaction-flags csrf05))) + ) + ) + ) + (logior! sv-96 (collide-status touch-surface)) + (cond + ((-> arg1 num-spheres) + (logior! sv-96 (collide-status touch-actor)) + (set! (-> arg0 actor-contact-pt quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> arg0 actor-contact-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 actor-contact-handle) + (process->handle (-> (the-as collide-shape-prim (-> arg1 num-spheres)) cshape process)) ) + ) + ((= (-> arg0 poly-pat material) (pat-material waterbottom)) + ) + (else + (logior! sv-96 (collide-status touch-background)) ) - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf08))) - (set! sv-104 (logclear sv-104 (cshape-reaction-flags csrf06))) - (let ((s3-4 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) - (vector-normalize! s3-4 1.0) - (vector-float*! arg2 s3-4 (vector-dot (the-as vector (-> sv-88 vector)) s3-4)) - ) - (vector+! arg2 arg2 (-> arg0 poly-normal)) - ) - (else - ) - ) - ) - (else - (set! sv-96 (logior sv-96 (collide-status on-surface))) - (set! (-> arg0 cur-pat mode) 0) - (if (= (-> arg1 best-my-prim prim-id) 6) - (set! (-> arg0 local-normal quad) (-> sv-84 quad)) - ) - (if (and (focus-test? (the-as process-focusable (-> arg0 process)) board) - (not (focus-test? (the-as process-focusable (-> arg0 process)) halfpipe)) - (!= (-> arg0 cur-pat mode) 3) - (!= (-> arg0 ground-pat mode) 3) - ) - (vector-reflect-flat-gravity! arg2 (the-as vector (-> sv-88 vector)) sv-84 (-> arg0 dynam gravity-normal)) - (vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84) - ) - (vector+! arg2 arg2 sv-84) - (let ((f0-32 (-> arg0 current-surface slope-change-preserve))) - (when (< 0.0 f0-32) - (let ((v1-223 (new-stack-vector0))) - (let ((f1-25 (vector-dot (-> arg0 pre-collide-local-normal) (the-as vector (-> sv-88 vector))))) - 0.0 - (vector-! - v1-223 - (the-as vector (-> sv-88 vector)) - (vector-float*! v1-223 (-> arg0 pre-collide-local-normal) f1-25) + ) + (cond + (sv-240 + (logior! sv-104 (cshape-reaction-flags csrf02)) + (logior! sv-96 (collide-status touch-wall)) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 wall-contact-pt quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> arg0 wall-contact-poly-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 wall-contact-normal quad) (-> sv-84 quad)) + (set! (-> arg0 wall-contact-pat) (-> arg1 best-other-tri pat)) + (cond + ((and (focus-test? (the-as process-focusable (-> arg0 process)) mech) + (logtest? sv-104 (cshape-reaction-flags csrf15)) + (logtest? sv-104 (cshape-reaction-flags csrf05)) + (< 0.0 (vector-dot sv-84 (-> arg0 dynam gravity-normal))) + (< 0.0 (vector-dot (-> sv-88 vector 0) (-> arg0 dynam gravity-normal))) + ) + (set! (-> arg0 surf) *edge-surface*) + (logior! sv-104 (cshape-reaction-flags csrf16)) + (vector-flatten! arg2 (vector-negate! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal)) sv-84) + (vector-normalize! arg2 (vector-dot arg2 (-> sv-88 vector 0))) + ) + (else + (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84) + ) + ) + (cond + ((and (or (and (>= (-> arg1 best-my-prim local-sphere w) + (vector-dot + (-> arg0 ground-poly-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> arg0 grount-touch-point)) + ) + ) + (not (time-elapsed? (-> arg0 list-time-on-ground) (seconds 0.3))) + ) + (logtest? sv-104 (cshape-reaction-flags csrf15)) + ) + (>= (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> arg0 grount-touch-point)) + ) + 0.0 + ) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (not (logtest? sv-104 (cshape-reaction-flags csrf05))) + ) + ) + (logior! sv-104 (cshape-reaction-flags csrf08)) + (logclear! sv-104 (cshape-reaction-flags csrf06)) + (let ((s3-4 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) + (vector-normalize! s3-4 1.0) + (vector-float*! arg2 s3-4 (vector-dot (-> sv-88 vector 0) s3-4)) + ) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + (else + ) ) ) - (let ((f1-26 (vector-length v1-223))) - f1-26 - (let ((f1-27 f1-26) - (f2-5 (vector-length arg2)) + (else + (logior! sv-96 (collide-status on-surface)) + (set! (-> arg0 cur-pat mode) 0) + (if (= (-> arg1 best-my-prim prim-id) 6) + (set! (-> arg0 local-normal quad) (-> sv-84 quad)) + ) + (if (and (focus-test? (the-as process-focusable (-> arg0 process)) board) + (not (focus-test? (the-as process-focusable (-> arg0 process)) halfpipe)) + (!= (-> arg0 cur-pat mode) 3) + (!= (-> arg0 ground-pat mode) 3) + ) + (vector-reflect-flat-gravity! arg2 (-> sv-88 vector 0) sv-84 (-> arg0 dynam gravity-normal)) + (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84) + ) + (vector+! arg2 arg2 sv-84) + (let ((f0-32 (-> arg0 current-surface slope-change-preserve))) + (when (< 0.0 f0-32) + (let ((v1-223 (new-stack-vector0))) + (let ((f1-25 (vector-dot (-> arg0 pre-collide-local-normal) (-> sv-88 vector 0)))) + 0.0 + (vector-! v1-223 (-> sv-88 vector 0) (vector-float*! v1-223 (-> arg0 pre-collide-local-normal) f1-25)) + ) + (let ((f1-26 (vector-length v1-223))) + f1-26 + (let ((f1-27 f1-26) + (f2-5 (vector-length arg2)) + ) + (if (and (< 409.6 (fabs (- f2-5 f1-27))) (< f2-5 f1-27)) + (vector-normalize! arg2 (lerp-scale f2-5 f1-27 f0-32 0.0 1.0)) + ) + ) + ) ) - (if (and (< 409.6 (fabs (- f2-5 f1-27))) (< f2-5 f1-27)) - (vector-normalize! arg2 (lerp-scale f2-5 f1-27 f0-32 0.0 1.0)) + ) + ) + (set! (-> arg0 grount-touch-point w) 0.0) + (when (not (logtest? sv-104 (cshape-reaction-flags csrf00 csrf01 csrf02 csrf03 csrf14))) + (logior! sv-96 (collide-status on-ground)) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 ground-contact-normal quad) (-> sv-84 quad)) + (set! (-> arg0 ground-local-norm-dot-grav) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) + (set-time! (-> arg0 list-time-on-ground)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 grount-touch-point quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> arg0 ground-contact-sphere-center quad) (-> arg1 best-my-prim prim-core world-sphere quad)) + (logior! sv-104 (cshape-reaction-flags csrf11)) + (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) + (logior! sv-96 (collide-status on-water)) ) ) ) ) ) + (logior! (-> arg0 status) sv-96) + (set! (-> arg0 reaction-flag) sv-104) ) - (set! (-> arg0 grount-touch-point w) 0.0) - (when (not (logtest? sv-104 (cshape-reaction-flags csrf00 csrf01 csrf02 csrf03 csrf14))) - (set! sv-96 (logior sv-96 (collide-status on-ground))) - (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 ground-contact-normal quad) (-> sv-84 quad)) - (set! (-> arg0 ground-local-norm-dot-grav) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) - (set-time! (-> arg0 list-time-on-ground)) - (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) - (set! (-> arg0 grount-touch-point quad) (-> arg1 best-other-tri intersect quad)) - (set! (-> arg0 ground-contact-sphere-center quad) (-> arg1 best-my-prim prim-core world-sphere quad)) - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf11))) - (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) - (set! sv-96 (logior sv-96 (collide-status on-water))) - ) - ) - ) - ) - (logior! (-> arg0 status) sv-96) - (set! (-> arg0 reaction-flag) sv-104) - (when *debug-segment* - (+! (-> arg0 history-idx) 1) - (let ((v1-260 (clear-record-tags! *history* (history-channel surface-normal) (-> arg0 history-idx) (the-as uint 2))) - ) - (set! (-> v1-260 origin quad) (-> arg1 best-other-tri intersect quad)) - (set! (-> v1-260 vector quad) (-> arg0 surface-normal quad)) - ) - (let ((v1-263 (clear-record-tags! *history* (history-channel local-normal) (-> arg0 history-idx) (the-as uint 2)))) - (set! (-> v1-263 origin quad) (-> arg1 best-other-tri intersect quad)) - (set! (-> v1-263 vector quad) (-> arg0 local-normal quad)) - ) - (set! (-> (clear-record-tags! *history* (history-channel intersect) (-> arg0 history-idx) (the-as uint 2)) - vector - quad + (when *debug-segment* + (+! (-> arg0 history-idx) 1) + (let ((v1-260 (clear-record-tags! *history* (history-channel surface-normal) (-> arg0 history-idx) (the-as uint 2))) ) - (-> arg1 best-other-tri intersect quad) + (set! (-> v1-260 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-260 vector quad) (-> arg0 surface-normal quad)) ) - (let ((v1-269 (clear-record-tags! *history* (history-channel transv-out) (-> arg0 history-idx) (the-as uint 2)))) - (set! (-> v1-269 origin quad) (-> arg1 best-other-tri intersect quad)) - (set! (-> v1-269 vector quad) (-> arg2 quad)) - ) - (let ((v1-272 (clear-record-tags! *history* (history-channel transv-in) (-> arg0 history-idx) (the-as uint 2)))) - (set! (-> v1-272 origin quad) (-> arg1 best-other-tri intersect quad)) - (set! (-> v1-272 vector quad) (-> sv-88 vector 1 quad)) - ) - (let ((v1-275 (clear-record-tags! *history* (history-channel transv) (-> arg0 history-idx) (the-as uint 2)))) - (set! (-> v1-275 origin quad) (-> arg0 trans quad)) - (set! (-> v1-275 vector quad) (-> arg0 transv quad)) - ) - (set! (-> (clear-record-tags! *history* (history-channel trans) (-> arg0 history-idx) (the-as uint 2)) vector quad) - (-> arg0 trans quad) + (let ((v1-263 (clear-record-tags! *history* (history-channel local-normal) (-> arg0 history-idx) (the-as uint 2)))) + (set! (-> v1-263 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-263 vector quad) (-> arg0 local-normal quad)) ) - (let ((v1-281 (clear-record-tags! *history* (history-channel pat) (-> arg0 history-idx) (the-as uint 2)))) - (set! (-> v1-281 vector x) (the-as float (-> arg0 cur-pat))) - ) - (let ((v1-283 (clear-record-tags! *history* (history-channel collide-status) (-> arg0 history-idx) (the-as uint 2))) + (set! (-> (clear-record-tags! *history* (history-channel intersect) (-> arg0 history-idx) (the-as uint 2)) + vector + quad + ) + (-> arg1 best-other-tri intersect quad) + ) + (let ((v1-269 (clear-record-tags! *history* (history-channel transv-out) (-> arg0 history-idx) (the-as uint 2)))) + (set! (-> v1-269 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-269 vector quad) (-> arg2 quad)) ) - (set! (-> v1-283 collide-status) (-> arg0 status)) - (set! (-> v1-283 vector z) (the-as float (-> arg0 reaction-flag))) + (let ((v1-272 (clear-record-tags! *history* (history-channel transv-in) (-> arg0 history-idx) (the-as uint 2)))) + (set! (-> v1-272 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-272 vector quad) (-> sv-88 vector 1 quad)) + ) + (let ((v1-275 (clear-record-tags! *history* (history-channel transv) (-> arg0 history-idx) (the-as uint 2)))) + (set! (-> v1-275 origin quad) (-> arg0 trans quad)) + (set! (-> v1-275 vector quad) (-> arg0 transv quad)) + ) + (set! (-> (clear-record-tags! *history* (history-channel trans) (-> arg0 history-idx) (the-as uint 2)) vector quad) + (-> arg0 trans quad) + ) + (let ((v1-281 (clear-record-tags! *history* (history-channel pat) (-> arg0 history-idx) (the-as uint 2)))) + (set! (-> v1-281 vector x) (the-as float (-> arg0 cur-pat))) + ) + (let ((v1-283 (clear-record-tags! *history* (history-channel collide-status) (-> arg0 history-idx) (the-as uint 2))) + ) + (set! (-> v1-283 collide-status) (-> arg0 status)) + (set! (-> v1-283 vector z) (the-as float (-> arg0 reaction-flag))) + ) + ) + sv-96 ) ) - sv-96 ) (defun target-collision-no-reaction ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) @@ -570,11 +552,7 @@ (let ((gp-0 *edge-grab-info*)) (when (-> gp-0 found-edge?) (vector-normalize! - (vector-! - (-> self control edge-grab-edge-dir) - (the-as vector (-> gp-0 world-vertex)) - (-> gp-0 world-vertex 1) - ) + (vector-! (-> self control edge-grab-edge-dir) (-> gp-0 world-vertex 0) (-> gp-0 world-vertex 1)) 1.0 ) (set! (-> self control edge-grab-across-edge-dir quad) (-> gp-0 hanging-matrix quad 0)) diff --git a/goal_src/jak2/engine/target/gun/gun-dark-shot.gc b/goal_src/jak2/engine/target/gun/gun-dark-shot.gc index fee72495cb..1faed003a0 100644 --- a/goal_src/jak2/engine/target/gun/gun-dark-shot.gc +++ b/goal_src/jak2/engine/target/gun/gun-dark-shot.gc @@ -5,9 +5,9 @@ ;; name in dgo: gun-dark-shot ;; dgos: ENGINE, GAME -(define-extern market-object type) -(define-extern fruit-stand type) -(define-extern crate type) +(declare-type market-object process-focusable) +(declare-type fruit-stand process-focusable) +(declare-type crate process-focusable) ;; DECOMP BEGINS @@ -379,89 +379,65 @@ (arg5 sparticle-launcher) (arg6 sparticle-launcher) ) - (local-vars (sv-16 process) (sv-32 matrix) (sv-48 process-focusable)) - (set! sv-48 arg0) - (let ((s0-0 arg1)) - (set! sv-32 arg2) - (let ((gp-0 arg4) - (s2-0 arg5) - (s3-0 arg6) - (s4-0 (get-trans sv-48 3)) - (s5-0 (get-trans s0-0 3)) - ) - (set! sv-16 (get-process *default-dead-pool* lightning-tracker #x4000)) - (let ((s1-0 (when sv-16 - (let ((t9-3 (method-of-type lightning-tracker activate))) - (t9-3 - (the-as lightning-tracker sv-16) - s0-0 - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((t9-4 run-function-in-process) - (a0-5 sv-16) - (a1-7 lightning-tracker-init) - (a3-2 0) - (t0-1 lightning-probe-callback) - (t2-1 256) - (t3-0 256) - ) - ((the-as (function object object object object object object object object none) t9-4) - a0-5 - a1-7 - sv-32 - a3-2 - t0-1 - sv-48 - t2-1 - t3-0 - ) - ) - (-> sv-16 ppointer) - ) + (let* ((sv-48 arg0) + (s0-0 arg1) + (sv-32 arg2) + (gp-0 arg4) + (s2-0 arg5) + (s3-0 arg6) + (s4-0 (get-trans sv-48 3)) + (s5-0 (get-trans s0-0 3)) + (sv-16 (get-process *default-dead-pool* lightning-tracker #x4000)) + (s1-0 (when sv-16 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-16) + s0-0 + (symbol->string (-> lightning-tracker symbol)) + (the-as pointer #x70004000) ) + (run-now-in-process sv-16 lightning-tracker-init sv-32 0 lightning-probe-callback sv-48 256 256) + (-> sv-16 ppointer) + ) + ) + ) + (when s2-0 + (let ((t9-5 sp-launch-particles-var) + (a0-6 *sp-particle-system-2d*) + (a2-4 *launch-matrix*) ) - (when s2-0 - (let ((t9-5 sp-launch-particles-var) - (a0-6 *sp-particle-system-2d*) - (a2-4 *launch-matrix*) - ) - (set! (-> a2-4 trans quad) (-> s4-0 quad)) - (t9-5 a0-6 s2-0 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (set! (-> a2-4 trans quad) (-> s4-0 quad)) + (t9-5 a0-6 s2-0 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (when s3-0 + (let ((t9-6 sp-launch-particles-var) + (a0-7 *sp-particle-system-2d*) + (a2-5 *launch-matrix*) ) - ) - (when s3-0 - (let ((t9-6 sp-launch-particles-var) - (a0-7 *sp-particle-system-2d*) - (a2-5 *launch-matrix*) - ) - (set! (-> a2-5 trans quad) (-> s4-0 quad)) - (t9-6 a0-7 s3-0 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (set! (-> a2-5 trans quad) (-> s4-0 quad)) + (t9-6 a0-7 s3-0 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (when (and gp-0 s1-0) + (let ((v1-15 (get-field-spec-by-id gp-0 (sp-field-id spt-timer)))) + (if v1-15 + (set! (-> v1-15 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> s1-0 0)) duration))) ) - ) - (when (and gp-0 s1-0) - (let ((v1-15 (get-field-spec-by-id gp-0 (sp-field-id spt-timer)))) - (if v1-15 - (set! (-> v1-15 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> s1-0 0)) duration))) - ) + ) + (let ((t9-8 sp-launch-particles-var) + (a0-12 *sp-particle-system-2d*) + (a1-15 gp-0) + (a2-6 *launch-matrix*) ) - (let ((t9-8 sp-launch-particles-var) - (a0-12 *sp-particle-system-2d*) - (a1-15 gp-0) - (a2-6 *launch-matrix*) - ) - (set! (-> a2-6 trans quad) (-> s4-0 quad)) - (t9-8 a0-12 a1-15 a2-6 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (set! (-> a2-6 trans quad) (-> s4-0 quad)) + (t9-8 a0-12 a1-15 a2-6 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-9 sp-launch-particles-var) + (a0-13 *sp-particle-system-2d*) + (a2-7 *launch-matrix*) ) - (let ((t9-9 sp-launch-particles-var) - (a0-13 *sp-particle-system-2d*) - (a2-7 *launch-matrix*) - ) - (set! (-> a2-7 trans quad) (-> s5-0 quad)) - (t9-9 a0-13 gp-0 a2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) - ) - ) + (set! (-> a2-7 trans quad) (-> s5-0 quad)) + (t9-9 a0-13 gp-0 a2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) ) @@ -550,14 +526,6 @@ (defstate impact (gun-dark-shot) :virtual #t :code (behavior () - (local-vars - (sv-256 collide-shape) - (sv-272 process-drawable) - (sv-288 vector) - (sv-304 process-drawable) - (sv-320 process-drawable) - (sv-336 process-drawable) - ) (if (not (time-elapsed? (-> self spawn-time) (seconds 0.1))) (send-event (ppointer->process (-> self parent)) 'release) ) @@ -626,13 +594,9 @@ (s5-1 #t) ) (countdown (s2-0 gp-2) - (set! sv-256 (-> s3-0 s2-0)) - (set! sv-272 (-> sv-256 process)) - (let ((s0-0 (if (type? sv-272 process-focusable) - sv-272 - ) - ) - ) + (let* ((sv-256 (-> s3-0 s2-0)) + (s0-0 (the-as process-drawable (as-type (-> sv-256 process) process-focusable))) + ) (cond ((and (nonzero? (-> sv-256 root-prim prim-core collide-as)) s0-0 @@ -640,23 +604,12 @@ (not (focus-test? (the-as process-focusable s0-0) disable dead ignore)) (not (logtest? (process-mask no-track) (-> s0-0 mask))) ) - (set! sv-288 (get-trans (the-as process-focusable s0-0) 3)) - (let ((f28-0 (- (vector-vector-distance (-> self root trans) sv-288) (-> sv-288 w)))) - (set! sv-304 s0-0) - (if (and (not (if (type? sv-304 crate) - sv-304 - ) - ) - (begin (set! sv-320 s0-0) (not (if (type? sv-320 market-object) - sv-320 - ) - ) - ) - (begin (set! sv-336 s0-0) (not (if (type? sv-336 fruit-stand) - sv-336 - ) - ) - ) + (let* ((sv-288 (get-trans (the-as process-focusable s0-0) 3)) + (f28-0 (- (vector-vector-distance (-> self root trans) sv-288) (-> sv-288 w))) + ) + (if (and (not (the-as process-drawable (as-type s0-0 crate))) + (not (the-as process-drawable (as-type s0-0 market-object))) + (not (the-as process-drawable (as-type s0-0 fruit-stand))) ) (set! s5-1 #f) ) diff --git a/goal_src/jak2/engine/target/gun/gun-red-shot.gc b/goal_src/jak2/engine/target/gun/gun-red-shot.gc index 9e7cc08005..18de17f50b 100644 --- a/goal_src/jak2/engine/target/gun/gun-red-shot.gc +++ b/goal_src/jak2/engine/target/gun/gun-red-shot.gc @@ -255,14 +255,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-2 a2-5) - (f1-1 (+ (-> a1-5 world-sphere w) (-> s5-0 w))) - ) - (when (< f0-2 (* f1-1 f1-1)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-7)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-5 world-sphere w) (-> s5-0 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-7)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -296,14 +292,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-3 a2-12) - (f1-5 (+ (-> a1-17 world-sphere w) (-> s5-0 w))) - ) - (when (< f0-3 (* f1-5 f1-5)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-10)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-17 world-sphere w) (-> s5-0 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-10)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) diff --git a/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc b/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc index 6cea8b0916..59c6282b12 100644 --- a/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc +++ b/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc @@ -114,7 +114,7 @@ ) (let ((f0-6 (vector-dot s5-1 (-> (camera-matrix) vector 2)))) (when (< 0.0 f0-6) - (let ((f0-7 (* f0-6 f0-6)) + (let ((f0-7 (square f0-6)) (f30-2 (-> *part-id-table* 225 init-specs 8 initial-valuef)) (f28-2 (-> *part-id-table* 225 init-specs 8 random-rangef)) ) diff --git a/goal_src/jak2/engine/target/logic-target.gc b/goal_src/jak2/engine/target/logic-target.gc index ef5f2845a1..82bdd984a0 100644 --- a/goal_src/jak2/engine/target/logic-target.gc +++ b/goal_src/jak2/engine/target/logic-target.gc @@ -144,72 +144,41 @@ ;; ERROR: function was not converted to expressions. Cannot decompile. (defun-debug target-print-stats ((arg0 target) (arg1 symbol)) - (local-vars - (sv-64 int) - (sv-72 int) - (sv-80 art-joint-anim-manager) - (sv-96 string) - (sv-112 string) - (sv-128 string) - (sv-144 string) - (sv-160 string) - (sv-176 string) - (sv-192 string) - (sv-208 string) - (sv-224 string) - (sv-240 string) - (sv-256 string) - (sv-272 string) - (sv-288 string) - (sv-304 string) - ) (with-pp (let ((s5-0 pp)) (set! pp arg0) (when (and *display-ground-stats* arg0) - (let ((s3-0 format) - (s2-0 arg1) - (s1-0 "~0kpoly:~6X mode:~-8S material:~-10S event:~S~%") - (s0-0 (-> arg0 control poly-pat)) - ) - (set! sv-96 (pat-mode->string (-> arg0 control poly-pat))) - (set! sv-112 (pat-material->string (-> arg0 control poly-pat))) - (let ((t1-0 (pat-event->string (-> arg0 control poly-pat)))) - (s3-0 s2-0 s1-0 s0-0 sv-96 sv-112 t1-0) - ) + (format + arg1 + "~0kpoly:~6X mode:~-8S material:~-10S event:~S~%" + (-> arg0 control poly-pat) + (pat-mode->string (-> arg0 control poly-pat)) + (pat-material->string (-> arg0 control poly-pat)) + (pat-event->string (-> arg0 control poly-pat)) ) - (let ((s3-1 format) - (s2-1 arg1) - (s1-1 "~0kgrnd:~6X mode:~-8S material:~-10S event:~S~%") - (s0-1 (-> arg0 control ground-pat)) - ) - (set! sv-128 (pat-mode->string (-> arg0 control ground-pat))) - (set! sv-144 (pat-material->string (-> arg0 control ground-pat))) - (let ((t1-1 (pat-event->string (-> arg0 control ground-pat)))) - (s3-1 s2-1 s1-1 s0-1 sv-128 sv-144 t1-1) - ) + (format + arg1 + "~0kgrnd:~6X mode:~-8S material:~-10S event:~S~%" + (-> arg0 control ground-pat) + (pat-mode->string (-> arg0 control ground-pat)) + (pat-material->string (-> arg0 control ground-pat)) + (pat-event->string (-> arg0 control ground-pat)) ) - (let ((s3-2 format) - (s2-2 arg1) - (s1-2 "~0kwall:~6X mode:~-8S material:~-10S event:~S~%") - (s0-2 (-> arg0 control wall-contact-pat)) - ) - (set! sv-160 (pat-mode->string (-> arg0 control wall-contact-pat))) - (set! sv-176 (pat-material->string (-> arg0 control wall-contact-pat))) - (let ((t1-2 (pat-event->string (-> arg0 control wall-contact-pat)))) - (s3-2 s2-2 s1-2 s0-2 sv-160 sv-176 t1-2) - ) + (format + arg1 + "~0kwall:~6X mode:~-8S material:~-10S event:~S~%" + (-> arg0 control wall-contact-pat) + (pat-mode->string (-> arg0 control wall-contact-pat)) + (pat-material->string (-> arg0 control wall-contact-pat)) + (pat-event->string (-> arg0 control wall-contact-pat)) ) - (let ((s3-3 format) - (s2-3 arg1) - (s1-3 "~0kgspt:~6X mode:~-8S material:~-10S event:~S~%") - (s0-3 (-> arg0 control gspot-pat-surfce)) - ) - (set! sv-192 (pat-mode->string (-> arg0 control gspot-pat-surfce))) - (set! sv-208 (pat-material->string (-> arg0 control gspot-pat-surfce))) - (let ((t1-3 (pat-event->string (-> arg0 control gspot-pat-surfce)))) - (s3-3 s2-3 s1-3 s0-3 sv-192 sv-208 t1-3) - ) + (format + arg1 + "~0kgspt:~6X mode:~-8S material:~-10S event:~S~%" + (-> arg0 control gspot-pat-surfce) + (pat-mode->string (-> arg0 control gspot-pat-surfce)) + (pat-material->string (-> arg0 control gspot-pat-surfce)) + (pat-event->string (-> arg0 control gspot-pat-surfce)) ) ) (when (and *stats-target* arg0) @@ -420,38 +389,29 @@ (let ((v1-160 (-> arg0 control trans))) (format arg1 "pos: ~6,,2m ~6,,2m ~6,,2m " (-> v1-160 x) (-> v1-160 y) (-> v1-160 z)) ) - (let ((s3-5 format) - (s2-4 arg1) - (s1-4 "~0kpol:~X/~S/~S/~S~%") - (s0-4 (-> arg0 control poly-pat)) - ) - (set! sv-224 (pat-mode->string (-> arg0 control poly-pat))) - (set! sv-240 (pat-material->string (-> arg0 control poly-pat))) - (let ((t1-10 (pat-event->string (-> arg0 control poly-pat)))) - (s3-5 s2-4 s1-4 s0-4 sv-224 sv-240 t1-10) - ) + (format + arg1 + "~0kpol:~X/~S/~S/~S~%" + (-> arg0 control poly-pat) + (pat-mode->string (-> arg0 control poly-pat)) + (pat-material->string (-> arg0 control poly-pat)) + (pat-event->string (-> arg0 control poly-pat)) ) - (let ((s3-6 format) - (s2-5 arg1) - (s1-5 "~0kcur:~X/~S/~S/~S ") - (s0-5 (-> arg0 control cur-pat)) - ) - (set! sv-256 (pat-mode->string (-> arg0 control cur-pat))) - (set! sv-272 (pat-material->string (-> arg0 control cur-pat))) - (let ((t1-11 (pat-event->string (-> arg0 control cur-pat)))) - (s3-6 s2-5 s1-5 s0-5 sv-256 sv-272 t1-11) - ) + (format + arg1 + "~0kcur:~X/~S/~S/~S " + (-> arg0 control cur-pat) + (pat-mode->string (-> arg0 control cur-pat)) + (pat-material->string (-> arg0 control cur-pat)) + (pat-event->string (-> arg0 control cur-pat)) ) - (let ((s3-7 format) - (s2-6 arg1) - (s1-6 "~0kgnd:~X/~S/~S/~S~%") - (s0-6 (-> arg0 control ground-pat)) - ) - (set! sv-288 (pat-mode->string (-> arg0 control ground-pat))) - (set! sv-304 (pat-material->string (-> arg0 control ground-pat))) - (let ((t1-12 (pat-event->string (-> arg0 control ground-pat)))) - (s3-7 s2-6 s1-6 s0-6 sv-288 sv-304 t1-12) - ) + (format + arg1 + "~0kgnd:~X/~S/~S/~S~%" + (-> arg0 control ground-pat) + (pat-mode->string (-> arg0 control ground-pat)) + (pat-material->string (-> arg0 control ground-pat)) + (pat-event->string (-> arg0 control ground-pat)) ) (let ((t9-74 format) (a0-129 arg1) @@ -502,22 +462,24 @@ (-> arg0 control bend-target) (-> arg0 control bend-speed) ) - (set! sv-64 0) - (set! sv-72 0) - (set! sv-80 *anim-manager*) - (countdown (s3-8 (-> sv-80 free-index)) - (when (= (-> sv-80 slot s3-8 time-stamp) (-> *display* base-clock frame-counter)) - (set! sv-72 (+ sv-72 1)) - (set! sv-64 (+ sv-64 (used-bytes-for-slot sv-80 s3-8))) + (let ((sv-64 0) + (sv-72 0) + (sv-80 *anim-manager*) + ) + (countdown (s3-8 (-> sv-80 free-index)) + (when (= (-> sv-80 slot s3-8 time-stamp) (-> *display* base-clock frame-counter)) + (+! sv-72 1) + (+! sv-64 (used-bytes-for-slot sv-80 s3-8)) + ) + ) + (format + arg1 + "anim cache ~d anims ~dK total, ~d ~dK active~%" + (-> sv-80 free-index) + (sar (&- (-> sv-80 kheap current) (the-as uint (-> sv-80 kheap base))) 10) + sv-72 + (sar sv-64 10) ) - ) - (format - arg1 - "anim cache ~d anims ~dK total, ~d ~dK active~%" - (-> sv-80 free-index) - (sar (&- (-> sv-80 kheap current) (the-as uint (-> sv-80 kheap base))) 10) - sv-72 - (sar sv-64 10) ) (debug-print-channels (-> arg0 skel) arg1) ) @@ -682,7 +644,7 @@ (set! (-> a1-0 y) 10240.0) (set! (-> a1-0 z) 8192.0) (set! (-> a1-0 w) 1.0) - (vector-! (the-as vector v1-34) a0-13 a1-0) + (vector-! (-> v1-34 min) a0-13 a1-0) ) (let ((v1-36 (-> gp-0 bbox max)) (a0-15 (-> self control trans)) @@ -981,7 +943,7 @@ (-> self control dynam gravity-normal) (vector-! (new 'stack-no-clear 'vector) - (the-as vector (-> self control collision-spheres 1 prim-core)) + (-> self control collision-spheres 1 prim-core world-sphere) (-> self control wall-contact-pt) ) ) @@ -1349,7 +1311,7 @@ (set! (-> a1-0 y) 6144.0) (set! (-> a1-0 z) 8192.0) (set! (-> a1-0 w) 1.0) - (vector-! (the-as vector v1-0) a0-1 a1-0) + (vector-! (-> v1-0 min) a0-1 a1-0) ) (let ((v1-2 (-> gp-0 bbox max)) (a0-3 (-> self control trans)) @@ -1983,7 +1945,7 @@ (set! (-> v1-13 quad 2) a2-1) (set! (-> v1-13 trans quad) a3-1) ) - (vector-matrix*! (-> gp-0 scale) (the-as vector (-> s5-0 pilot-edge-grab)) (-> gp-0 transform)) + (vector-matrix*! (-> gp-0 scale) (-> s5-0 pilot-edge-grab local-pos) (-> gp-0 transform)) (vector-rotate*! (the-as vector (&+ gp-0 80)) (-> s5-0 pilot-edge-grab local-dir) (-> gp-0 transform)) (set! (-> s5-0 center-hold quad) (-> gp-0 scale quad)) (set! (-> self control edge-grab-edge-dir quad) (-> (&+ gp-0 80) transform quad 0)) @@ -2004,11 +1966,7 @@ ) (set! (-> self control ground-pat) (the-as pat-surface (-> s5-0 edge-tri-pat))) (vector-normalize! - (vector-! - (-> self control edge-grab-edge-dir) - (the-as vector (-> s5-0 world-vertex)) - (-> s5-0 world-vertex 1) - ) + (vector-! (-> self control edge-grab-edge-dir) (-> s5-0 world-vertex 0) (-> s5-0 world-vertex 1)) 1.0 ) ) @@ -2137,7 +2095,7 @@ (set! (-> v1-13 quad 2) a2-1) (set! (-> v1-13 trans quad) a3-1) ) - (vector-matrix*! (-> s5-0 scale) (the-as vector (-> gp-0 pilot-edge-grab)) (-> s5-0 transform)) + (vector-matrix*! (-> s5-0 scale) (-> gp-0 pilot-edge-grab local-pos) (-> s5-0 transform)) (vector-rotate*! (the-as vector (&+ s5-0 80)) (-> gp-0 pilot-edge-grab local-dir) (-> s5-0 transform)) (set! (-> gp-0 center-hold quad) (-> s5-0 scale quad)) (set! (-> self control edge-grab-edge-dir quad) (-> (&+ s5-0 80) transform quad 0)) @@ -2157,11 +2115,7 @@ (debug-draw gp-0) ) (vector-normalize! - (vector-! - (-> self control edge-grab-edge-dir) - (the-as vector (-> gp-0 world-vertex)) - (-> gp-0 world-vertex 1) - ) + (vector-! (-> self control edge-grab-edge-dir) (-> gp-0 world-vertex 0) (-> gp-0 world-vertex 1)) 1.0 ) ) @@ -2298,7 +2252,7 @@ ) ) ) - (vector<-cspace! s5-0 (the-as cspace (-> self node-list data))) + (vector<-cspace! s5-0 (-> self node-list data 0)) (if (not (and (logtest? (-> self water flags) (water-flags under-water)) (not (logtest? (-> self water flags) (water-flags swim-ground))) ) @@ -2337,7 +2291,7 @@ ) (logtest? (-> self water flags) (water-flags mud)) ) - (vector<-cspace! (-> self control camera-pos) (the-as cspace (-> self node-list data))) + (vector<-cspace! (-> self control camera-pos) (-> self node-list data 0)) (set! (-> self control camera-pos y) (-> self water base-height)) ) ((focus-test? self tube) @@ -2347,7 +2301,7 @@ (set! (-> self control camera-pos quad) (-> self control trans quad)) ) (else - (vector<-cspace! (-> self control camera-pos) (the-as cspace (-> self node-list data))) + (vector<-cspace! (-> self control camera-pos) (-> self node-list data 0)) ) ) ) @@ -2417,10 +2371,7 @@ ) (vector-matrix*! (-> self control ctrl-to-head-offset) (-> *TARGET-bank* head-offset) a2-5) ) - (vector<-cspace! - (the-as vector (&-> (-> self control) sidekick-root bone)) - (-> self control sidekick-root parent) - ) + (vector<-cspace! (the-as vector (&-> self control sidekick-root bone)) (-> self control sidekick-root parent)) (let ((gp-0 (new-stack-vector0)) (s5-0 (new-stack-vector0)) ) @@ -3048,7 +2999,7 @@ ) (defmethod init-target ((this target) (arg0 continue-point) (arg1 symbol)) - (local-vars (s1-0 int) (s2-0 int) (s3-0 int) (s4-0 int) (sv-16 collide-shape-prim-group)) + (local-vars (s1-0 int) (s2-0 int) (s3-0 int) (s4-0 int)) (set! (-> this tobot?) arg1) (set! (-> this tobot-recorder) #f) (set! (-> this mode-cache) #f) @@ -3083,13 +3034,14 @@ (set! (-> s0-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s0-0 reaction) target-collision-reaction) (set! (-> s0-0 no-reaction) target-collision-no-reaction) - (set! sv-16 (new 'process 'collide-shape-prim-group s0-0 (the-as uint 9) 1)) - (set! (-> s0-0 total-prims) (the-as uint 10)) - (set! (-> sv-16 prim-core action) (collide-action solid can-ride)) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 4096.0) - (set! (-> s0-0 root-prim) sv-16) - (set! (-> sv-16 prim-core collide-as) (the-as collide-spec s4-0)) - (set! (-> sv-16 prim-core collide-with) (the-as collide-spec s3-0)) + (let ((sv-16 (new 'process 'collide-shape-prim-group s0-0 (the-as uint 9) 1))) + (set! (-> s0-0 total-prims) (the-as uint 10)) + (set! (-> sv-16 prim-core action) (collide-action solid can-ride)) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 4096.0) + (set! (-> s0-0 root-prim) sv-16) + (set! (-> sv-16 prim-core collide-as) (the-as collide-spec s4-0)) + (set! (-> sv-16 prim-core collide-with) (the-as collide-spec s3-0)) + ) (let ((v0-9 (new 'process 'collide-shape-prim-sphere s0-0 (the-as uint 6)))) (set! (-> v0-9 prim-core action) (collide-action solid can-ride)) (set-vector! (-> v0-9 local-sphere) 0.0 0.0 0.0 4096.0) diff --git a/goal_src/jak2/engine/target/mech/grunt-mech.gc b/goal_src/jak2/engine/target/mech/grunt-mech.gc index b543219333..7c1f118246 100644 --- a/goal_src/jak2/engine/target/mech/grunt-mech.gc +++ b/goal_src/jak2/engine/target/mech/grunt-mech.gc @@ -181,9 +181,9 @@ (defmethod common-post ((this grunt-mech)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" ((method-of-type grunt common-post) this) 0 (none) @@ -193,7 +193,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defmethod grunt-mech-method-193 ((this grunt-mech)) - (local-vars (f0-3 float) (sv-592 vector)) + (local-vars (f0-3 float)) (let ((s4-0 *grunt-mech-info*)) (grunt-mech-info-method-10 s4-0) (let ((gp-0 -1)) @@ -203,27 +203,16 @@ (countdown (s2-0 4) (let ((s1-0 (-> s4-0 holds s2-0))) (when (grunt-mech-info-method-9 s4-0 s2-0 this #t) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (set! sv-592 (new 'stack-no-clear 'vector)) + (let ((s0-0 (new 'stack-no-clear 'vector)) + (sv-592 (new 'stack-no-clear 'vector)) + ) (set! (-> s0-0 quad) (-> s1-0 world-mat vector 2 quad)) (set! (-> s0-0 y) 0.0) (vector-normalize! s0-0 1.0) (vector-! sv-592 (-> s1-0 world-mat trans) (-> this root trans)) (set! (-> sv-592 y) 0.0) (vector-normalize! sv-592 1.0) - (let ((f0-2 (-> sv-592 x)) - (f1-0 (-> sv-592 y)) - (f2-0 (-> sv-592 z)) - (f3-0 (-> s0-0 x)) - (f4-0 (-> s0-0 y)) - (f5-0 (-> s0-0 z)) - ) - ;; og:preserve-this inlined vector-dot - ;; (.mula.s f0-2 f3-0) - ;; (.madda.s f1-0 f4-0) - ;; (.madd.s f0-3 f2-0 f5-0) - (set! f0-3 (vector-dot sv-592 s0-0)) - ) + (set! f0-3 (vector-dot sv-592 s0-0)) ) (when (>= f0-3 0.0) (let ((f0-5 (vector-vector-distance-squared (-> s1-0 world-mat trans) s3-0))) @@ -299,10 +288,8 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-5 vf1) - (let ((f0-0 v1-5) - (f1-0 28672.0) - ) - (when (>= (* f1-0 f1-0) f0-0) + (let ((f0-0 v1-5)) + (when (>= (square 28672.0) f0-0) (let ((a1-3 (grunt-mech-method-193 this))) (cond ((= a1-3 -1) @@ -411,13 +398,13 @@ (vector-normalize-copy! (-> s5-0 travel) arg0 (the-as float arg1)) (set! (-> s5-0 pref-dir quad) (-> s5-0 travel quad)) (avoid-spheres-1! (-> this nav) s5-0) - (when (>= (fabs (vector-dot (the-as vector (-> s5-0 out-travel)) arg2)) 0.0) + (when (>= (fabs (vector-dot (-> s5-0 out-travel 0) arg2)) 0.0) (let ((t0-0 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info))) (clamp-vector-to-mesh-no-gaps (-> this nav) (-> this root trans) (-> this nav state current-poly) - (the-as vector (-> s5-0 out-travel)) + (-> s5-0 out-travel 0) t0-0 ) ) @@ -428,22 +415,18 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-13 vf1) - (let ((f0-3 v1-13) - (f1-1 14336.0) - ) - (when (>= f0-3 (* f1-1 f1-1)) - (let ((a1-3 (new 'stack-no-clear 'vector))) - (set! (-> a1-3 quad) (-> s5-0 out-travel 0 quad)) - (set! (-> a1-3 w) (-> this nav-radius-backup)) - (when (not (add-root-sphere-to-hash! (-> this nav) a1-3 #x80068)) - (let ((s4-1 (new 'stack-no-clear 'vector))) - (vector+! s4-1 (-> this root trans) (the-as vector (-> s5-0 out-travel))) - (let ((s5-1 (new 'stack-no-clear 'collide-query))) - (when (enemy-above-ground? this s5-1 s4-1 (the-as collide-spec (-> this gnd-collide)) 4096.0 122880.0 1024.0) - (set! (-> s4-1 y) (-> s5-1 best-other-tri intersect y)) - (set! (-> this dismount-dest quad) (-> s4-1 quad)) - #t - ) + (when (>= v1-13 (square 14336.0)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (set! (-> a1-3 quad) (-> s5-0 out-travel 0 quad)) + (set! (-> a1-3 w) (-> this nav-radius-backup)) + (when (not (add-root-sphere-to-hash! (-> this nav) a1-3 #x80068)) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (vector+! s4-1 (-> this root trans) (-> s5-0 out-travel 0)) + (let ((s5-1 (new 'stack-no-clear 'collide-query))) + (when (enemy-above-ground? this s5-1 s4-1 (the-as collide-spec (-> this gnd-collide)) 4096.0 122880.0 1024.0) + (set! (-> s4-1 y) (-> s5-1 best-other-tri intersect y)) + (set! (-> this dismount-dest quad) (-> s4-1 quad)) + #t ) ) ) @@ -503,9 +486,7 @@ (label cfg-16) (let ((a0-15 (-> this root trans))) (if (or (>= 0.0 (- (-> a0-15 y) (-> this dismount-dest y))) - (let ((f0-4 40960.0)) - (< (* f0-4 f0-4) (vector-vector-xz-distance-squared a0-15 (-> this dismount-dest))) - ) + (< (square 40960.0) (vector-vector-xz-distance-squared a0-15 (-> this dismount-dest))) ) (return #t) ) diff --git a/goal_src/jak2/engine/target/mech/mech-states.gc b/goal_src/jak2/engine/target/mech/mech-states.gc index 2474d80d11..75a7e45a6e 100644 --- a/goal_src/jak2/engine/target/mech/mech-states.gc +++ b/goal_src/jak2/engine/target/mech/mech-states.gc @@ -297,7 +297,6 @@ ) (defbehavior target-mech-punch-pick target ((arg0 symbol)) - (local-vars (sv-64 float)) (combo-tracker-method-12 (-> self control unknown-combo-tracker00) *null-vector* @@ -320,28 +319,25 @@ ) (when a0-4 (let ((s3-0 (get-trans a0-4 3))) - (let ((s0-0 (-> self control)) - (s1-0 s3-0) - (s2-0 deg-diff) - ) - (set! sv-64 (y-angle s0-0)) - (let* ((a1-4 (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s1-0 (-> s0-0 trans)))) - (f0-0 (s2-0 sv-64 a1-4)) + (let* ((s0-0 (-> self control)) + (s1-0 s3-0) + (f0-0 + (deg-diff (y-angle s0-0) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s1-0 (-> s0-0 trans)))) ) - (cond - ((< (+ 12288.0 (-> s4-0 y)) (-> s3-0 y)) - (set! (-> self mech walk-anim-leg) 3) ) - ((>= f0-0 5461.3335) - (set! (-> self mech walk-anim-leg) 0) - 0 - ) - ((>= -5461.3335 f0-0) - (set! (-> self mech walk-anim-leg) 1) - ) - (else - (set! (-> self mech walk-anim-leg) 2) - ) + (cond + ((< (+ 12288.0 (-> s4-0 y)) (-> s3-0 y)) + (set! (-> self mech walk-anim-leg) 3) + ) + ((>= f0-0 5461.3335) + (set! (-> self mech walk-anim-leg) 0) + 0 + ) + ((>= -5461.3335 f0-0) + (set! (-> self mech walk-anim-leg) 1) + ) + (else + (set! (-> self mech walk-anim-leg) 2) ) ) ) diff --git a/goal_src/jak2/engine/target/surface-h.gc b/goal_src/jak2/engine/target/surface-h.gc index c45d9f6acf..14f1d06547 100644 --- a/goal_src/jak2/engine/target/surface-h.gc +++ b/goal_src/jak2/engine/target/surface-h.gc @@ -119,13 +119,13 @@ on impact, during touch, on exit, etc." (defun calc-terminal2-vel ((arg0 float) (arg1 float) (arg2 float) (arg3 float)) (let ((f0-4 (sqrtf (/ (- (/ arg0 60) arg1) arg2)))) - (- f0-4 (+ arg1 (* arg2 (* f0-4 f0-4)))) + (- f0-4 (+ arg1 (* arg2 (square f0-4)))) ) ) (defun calc-terminal4-vel ((arg0 float) (arg1 float) (arg2 float)) (let ((f0-5 (sqrtf (sqrtf (/ (- (/ arg0 60) arg1) arg2))))) - (- f0-5 (+ arg1 (* arg2 (* f0-5 f0-5 f0-5 f0-5)))) + (- f0-5 (+ arg1 (* arg2 (* (square f0-5) f0-5 f0-5)))) ) ) diff --git a/goal_src/jak2/engine/target/target-anim.gc b/goal_src/jak2/engine/target/target-anim.gc index 415289f71e..0a81180aaa 100644 --- a/goal_src/jak2/engine/target/target-anim.gc +++ b/goal_src/jak2/engine/target/target-anim.gc @@ -638,7 +638,6 @@ ;; WARN: Return type mismatch symbol vs none. (defbehavior target-walk-anim target ((arg0 int)) - (local-vars (sv-16 float)) (let ((f24-0 0.0) (f26-0 (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -16384.0 (-> self control ctrl-xz-vel)))))) (f30-0 0.0) @@ -991,18 +990,19 @@ (let ((f20-0 (fmax -1.0 (fmin 1.0 (* 2.0 (-> self control local-slope-z))))) (f22-1 (fmax -1.0 (fmin 1.0 (* 1.6 (-> self control local-slope-x))))) ) - (set! sv-16 (fabs (deg-diff (quaternion-y-angle (-> self control dir-targ)) (y-angle (-> self control))))) - (set! f26-0 (seek - f26-0 - (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -16384.0 (-> self control ctrl-xz-vel))))) - (* 2.0 (seconds-per-frame)) - ) + (let ((sv-16 (fabs (deg-diff (quaternion-y-angle (-> self control dir-targ)) (y-angle (-> self control)))))) + (set! f26-0 (seek + f26-0 + (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -16384.0 (-> self control ctrl-xz-vel))))) + (* 2.0 (seconds-per-frame)) + ) + ) + (if (and (focus-test? self dark) (nonzero? (-> self darkjak))) + (set! f26-0 + (seek f26-0 (lerp-scale f26-0 (* 0.7 f26-0) sv-16 1820.4445 3640.889) (* 2.0 (seconds-per-frame))) + ) ) - (if (and (focus-test? self dark) (nonzero? (-> self darkjak))) - (set! f26-0 - (seek f26-0 (lerp-scale f26-0 (* 0.7 f26-0) sv-16 1820.4445 3640.889) (* 2.0 (seconds-per-frame))) - ) - ) + ) (cond ((< 0.5 f26-0) (let ((v1-206 (-> self skel effect))) diff --git a/goal_src/jak2/engine/target/target-darkjak.gc b/goal_src/jak2/engine/target/target-darkjak.gc index 3c9e4a0be7..85aa41c0a1 100644 --- a/goal_src/jak2/engine/target/target-darkjak.gc +++ b/goal_src/jak2/engine/target/target-darkjak.gc @@ -592,16 +592,6 @@ ) :trans (-> target-running-attack trans) :code (behavior () - (local-vars - (sv-16 float) - (sv-20 float) - (sv-24 int) - (sv-32 int) - (sv-40 int) - (sv-48 float) - (sv-56 handle) - (sv-64 int) - ) (set-setting! 'rapid-tracking #f 0.0 0) ((lambda :behavior target () @@ -646,276 +636,278 @@ ) ) ) - (set! sv-16 (the-as float 0.0)) - (set! sv-20 1.0) - (set! sv-24 0) - (set! sv-32 0) - (set! sv-40 0) - (set! sv-48 1.0) - (set! sv-56 (the-as handle #f)) - (set! sv-64 0) - (until (ja-done? 0) - (if (and (cpad-pressed? (-> self control cpad number) square) - (not (logtest? (-> self state-flags) (state-flags prevent-jump prevent-attack))) - (not (logtest? (-> self control current-surface flags) (surface-flag no-attack))) - (and (focus-test? self dark) - (nonzero? (-> self darkjak)) - (logtest? (-> self darkjak stage) (darkjak-stage active)) - ) - (< sv-32 2) - ) - (set! sv-40 (the-as int (current-time))) + (let ((sv-16 (the-as float 0.0)) + (sv-20 1.0) + (sv-24 0) + (sv-32 0) + (sv-40 0) + (sv-48 1.0) + (sv-56 (the-as handle #f)) + (sv-64 0) ) - (when (time-elapsed? (the-as time-frame sv-40) (seconds 0.5)) - (set! sv-40 0) - 0 - ) - (if (and (nonzero? sv-40) - (< (- (the float (+ (-> (ja-group) frames num-frames) -1)) (/ 2.0 (-> (ja-group) artist-step))) - (ja-frame-num 0) - ) - ) - ((lambda :behavior target - ((arg0 (pointer float)) (arg1 (pointer uint64)) (arg2 (pointer uint64))) - (let ((s4-0 (the-as process-focusable (combo-tracker-method-13 - (-> self control unknown-combo-tracker00) - (-> self control send-attack-dest) - (-> self control trans) - 24576.0 - (-> self control c-R-w vector 2) - 65536.0 - ) - ) - ) - ) - (when #t - (+! (-> arg1 0) 1) - (if s4-0 - (combo-tracker-method-12 - (-> self control unknown-combo-tracker00) - (-> self control trans) - (get-trans s4-0 3) - s4-0 - (current-time) - ) - ) - (target-start-attack) - (target-danger-set! 'punch #f) - (let ((v1-18 (ja-group))) - (cond - ((and v1-18 (or (= v1-18 jakb-darkjak-attack-combo1-ja) (= v1-18 jakb-darkjak-attack-combo1b-ja))) - (ja-channel-push! 1 (seconds 0.1)) - (ja-no-eval :group! jakb-darkjak-attack-combo2-ja :num! (seek!)) + (until (ja-done? 0) + (if (and (cpad-pressed? (-> self control cpad number) square) + (not (logtest? (-> self state-flags) (state-flags prevent-jump prevent-attack))) + (not (logtest? (-> self control current-surface flags) (surface-flag no-attack))) + (and (focus-test? self dark) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) (darkjak-stage active)) ) - (else - (ja-channel-push! 1 (seconds 0.1)) - (ja-no-eval :group! jakb-darkjak-attack-combo3c-ja :num! (seek!)) - ) - ) - ) - (initialize (-> self control impact-ctrl) self 22 3276.8 (-> self control root-prim prim-core collide-with)) - (set! (-> arg0 0) (fmax 0.0 (-> arg0 0))) + (< sv-32 2) ) - ) - (set! (-> arg2 0) (the-as uint 0)) - 0 - (none) - ) - (& sv-16) - (the-as (pointer uint64) (& sv-32)) - (the-as (pointer uint64) (& sv-40)) - ) - ) - (compute-alignment! (-> self align)) - (when (not (ja-min? 0)) - (cond - ((and (>= (ja-frame-num 0) 20.0) - (and (and (not (logtest? (-> self control status) (collide-status on-surface))) - (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *TARGET-bank* ground-timeout))) - (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) - ) - (time-elapsed? (-> self control sliding-start-time) (seconds 0.04)) - ) - ) - (go target-falling #f) - ) - ((and (nonzero? sv-32) - (>= sv-16 -40960.0) - (let ((v1-84 (ja-group))) - (not (and (and v1-84 (= v1-84 jakb-darkjak-attack-combo3-ja)) (>= (ja-aframe-num 0) 77.0))) - ) - (send-event (handle->process (-> self control unknown-combo-tracker00 target)) 'combo) - ) - (let ((gp-0 (the-as - process - (as-type (handle->process (-> self control unknown-combo-tracker00 target)) process-focusable) - ) - ) - ) - (let ((s5-1 (get-trans (the-as process-focusable gp-0) 3))) - (when (and (< 2048.0 (vector-vector-distance (-> self control trans) s5-1)) - (or (and (= gp-0 (handle->process sv-56)) (not (time-elapsed? (the-as time-frame sv-64) (seconds 0.1)))) - (time-elapsed? (the-as time-frame sv-64) (seconds 1)) - ) - ) - (forward-up-nopitch->quaternion - (-> self control dir-targ) - (vector-! (new 'stack-no-clear 'vector) s5-1 (-> self control trans)) - (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control quat)) - ) - (let ((v1-125 - (point-tracker-method-11 - (-> self control unknown-combo-tracker00) - (new 'stack-no-clear 'vector) - (-> self control trans) - s5-1 - (* 0.009107469 (the float (- (current-time) (-> self control unknown-combo-tracker00 move-start-time)))) - ) - ) - ) - (set! sv-16 (fmin 163840.0 (sqrtf (+ (* (-> v1-125 x) (-> v1-125 x)) (* (-> v1-125 z) (-> v1-125 z)))))) - ) - (set-forward-vel sv-16) - ) - ) - (when (!= gp-0 (handle->process sv-56)) - (set! sv-56 (process->handle gp-0)) - (set! sv-64 (the-as int (current-time))) - ) - ) - ) - ((< sv-16 0.0) - (set! sv-16 (seek sv-16 -0.04096 (* 491520.0 (seconds-per-frame)))) - (set-forward-vel sv-16) - ) - ((and (nonzero? (-> self control unknown-time-frame18)) - (time-elapsed? (-> self control unknown-time-frame18) (seconds 0.04)) - ) - (set-forward-vel 0.0) - ) - ((and (not (cpad-hold? (-> self control cpad number) square)) - (zero? sv-32) - (time-elapsed? (-> self control unknown-combo-tracker00 move-start-time) (seconds 0.2)) - ) - (if (= (-> self control ground-pat material) (pat-material ice)) - (set-forward-vel (fmax 32768.0 (* 0.8 (-> self control ctrl-xz-vel)))) - (set-forward-vel (* 0.8 (-> self control ctrl-xz-vel))) - ) - ) - ((ja-done? 0) - (set-forward-vel sv-16) - ) - (else - (set! sv-16 - (* (target-align-vel-z-adjust (-> self align delta trans z)) (-> self clock frames-per-second) sv-20) - ) - (set-forward-vel sv-16) + (set! sv-40 (the-as int (current-time))) ) + (when (time-elapsed? (the-as time-frame sv-40) (seconds 0.5)) + (set! sv-40 0) + 0 ) - ) - (let ((gp-1 (new-stack-vector0))) - (vector-matrix*! gp-1 (-> self control transv) (-> self control w-R-c)) - (set! (-> gp-1 y) 0.0) - (vector-matrix*! (-> self control align-xz-vel) gp-1 (-> self control c-R-w)) - ) - (when (!= (the-as float (-> self control unknown-word04)) 0.0) - (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) - (set! sv-16 (the-as float (-> self control unknown-word04))) - (set! (-> self control unknown-word04) (the-as uint 0.0)) - ) - (when (and (>= sv-16 0.0) - (let ((gp-2 (ja-group)) - (f30-2 (ja-aframe-num 0)) - ) - (if (or (and (= gp-2 jakb-darkjak-attack-combo1-ja) - (>= f30-2 11.0) - (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo1-ja) frames num-frames) -1)) - (ja-frame-num 0) - ) - ) - (and (= gp-2 jakb-darkjak-attack-combo1b-ja) - (>= f30-2 11.0) - (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo1b-ja) frames num-frames) -1)) - (ja-frame-num 0) - ) - ) - (and (= gp-2 jakb-darkjak-attack-combo2-ja) - (>= f30-2 49.0) - (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo2-ja) frames num-frames) -1)) - (ja-frame-num 0) - ) - ) - (and (= gp-2 jakb-darkjak-attack-combo3-ja) - (or (and (>= f30-2 62.0) (>= 77.0 f30-2)) - (and (>= f30-2 82.0) - (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo3-ja) frames num-frames) -1)) - (ja-frame-num 0) - ) - ) - ) - ) - (and (= gp-2 jakb-darkjak-attack-combo3c-ja) - (>= f30-2 62.0) - (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo3c-ja) frames num-frames) -1)) - (ja-frame-num 0) - ) - ) + (if (and (nonzero? sv-40) + (< (- (the float (+ (-> (ja-group) frames num-frames) -1)) (/ 2.0 (-> (ja-group) artist-step))) + (ja-frame-num 0) + ) + ) + ((lambda :behavior target + ((arg0 (pointer float)) (arg1 (pointer uint64)) (arg2 (pointer uint64))) + (let ((s4-0 (the-as process-focusable (combo-tracker-method-13 + (-> self control unknown-combo-tracker00) + (-> self control send-attack-dest) + (-> self control trans) + 24576.0 + (-> self control c-R-w vector 2) + 65536.0 + ) + ) ) - #t + ) + (when #t + (+! (-> arg1 0) 1) + (if s4-0 + (combo-tracker-method-12 + (-> self control unknown-combo-tracker00) + (-> self control trans) + (get-trans s4-0 3) + s4-0 + (current-time) + ) ) + (target-start-attack) + (target-danger-set! 'punch #f) + (let ((v1-18 (ja-group))) + (cond + ((and v1-18 (or (= v1-18 jakb-darkjak-attack-combo1-ja) (= v1-18 jakb-darkjak-attack-combo1b-ja))) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-darkjak-attack-combo2-ja :num! (seek!)) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-darkjak-attack-combo3c-ja :num! (seek!)) + ) + ) + ) + (initialize (-> self control impact-ctrl) self 22 3276.8 (-> self control root-prim prim-core collide-with)) + (set! (-> arg0 0) (fmax 0.0 (-> arg0 0))) ) ) - (let ((gp-3 (new 'stack-no-clear 'collide-query))) - (when (and (>= (impact-control-method-11 - (-> self control impact-ctrl) - gp-3 - (the-as process #f) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) - ) - 0.0 - ) - (>= 0.0 (vector-dot (-> gp-3 best-other-tri normal) (-> self control impact-ctrl dir))) - ) - (when (= (-> gp-3 best-other-tri pat mode) (pat-mode wall)) - (part-tracker-spawn :to self :group group-punch-hit :mat-joint (-> gp-3 best-other-tri intersect)) - (let ((imp-sound (static-sound-name "djak-punch-hit"))) - (play-effect-sound - (-> self skel effect) - 'punch - -1.0 - (-> self control impact-ctrl joint) - (the-as basic #f) - imp-sound + (set! (-> arg2 0) (the-as uint 0)) + 0 + (none) + ) + (& sv-16) + (the-as (pointer uint64) (& sv-32)) + (the-as (pointer uint64) (& sv-40)) + ) + ) + (compute-alignment! (-> self align)) + (when (not (ja-min? 0)) + (cond + ((and (>= (ja-frame-num 0) 20.0) + (and (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *TARGET-bank* ground-timeout))) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (time-elapsed? (-> self control sliding-start-time) (seconds 0.04)) + ) ) - ) - (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) - (set! sv-16 (the-as float -61440.0)) + (go target-falling #f) + ) + ((and (nonzero? sv-32) + (>= sv-16 -40960.0) + (let ((v1-84 (ja-group))) + (not (and (and v1-84 (= v1-84 jakb-darkjak-attack-combo3-ja)) (>= (ja-aframe-num 0) 77.0))) + ) + (send-event (handle->process (-> self control unknown-combo-tracker00 target)) 'combo) + ) + (let ((gp-0 (the-as + process + (as-type (handle->process (-> self control unknown-combo-tracker00 target)) process-focusable) + ) + ) + ) + (let ((s5-1 (get-trans (the-as process-focusable gp-0) 3))) + (when (and (< 2048.0 (vector-vector-distance (-> self control trans) s5-1)) + (or (and (= gp-0 (handle->process sv-56)) (not (time-elapsed? (the-as time-frame sv-64) (seconds 0.1)))) + (time-elapsed? (the-as time-frame sv-64) (seconds 1)) + ) + ) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-! (new 'stack-no-clear 'vector) s5-1 (-> self control trans)) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control quat)) + ) + (let ((v1-125 + (point-tracker-method-11 + (-> self control unknown-combo-tracker00) + (new 'stack-no-clear 'vector) + (-> self control trans) + s5-1 + (* 0.009107469 (the float (- (current-time) (-> self control unknown-combo-tracker00 move-start-time)))) + ) + ) + ) + (set! sv-16 (fmin 163840.0 (sqrtf (+ (* (-> v1-125 x) (-> v1-125 x)) (* (-> v1-125 z) (-> v1-125 z)))))) + ) + (set-forward-vel sv-16) + ) + ) + (when (!= gp-0 (handle->process sv-56)) + (set! sv-56 (process->handle gp-0)) + (set! sv-64 (the-as int (current-time))) + ) + ) + ) + ((< sv-16 0.0) + (set! sv-16 (seek sv-16 -0.04096 (* 491520.0 (seconds-per-frame)))) + (set-forward-vel sv-16) + ) + ((and (nonzero? (-> self control unknown-time-frame18)) + (time-elapsed? (-> self control unknown-time-frame18) (seconds 0.04)) + ) + (set-forward-vel 0.0) + ) + ((and (not (cpad-hold? (-> self control cpad number) square)) + (zero? sv-32) + (time-elapsed? (-> self control unknown-combo-tracker00 move-start-time) (seconds 0.2)) + ) + (if (= (-> self control ground-pat material) (pat-material ice)) + (set-forward-vel (fmax 32768.0 (* 0.8 (-> self control ctrl-xz-vel)))) + (set-forward-vel (* 0.8 (-> self control ctrl-xz-vel))) + ) + ) + ((ja-done? 0) + (set-forward-vel sv-16) + ) + (else + (set! sv-16 + (* (target-align-vel-z-adjust (-> self align delta trans z)) (-> self clock frames-per-second) sv-20) + ) + (set-forward-vel sv-16) ) ) ) - ) - (let ((gp-4 (ja-group)) - (f0-53 (ja-aframe-num 0)) - ) - (if (and (= gp-4 jakb-darkjak-attack-combo3-ja) - (>= f0-53 80.0) - (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo3-ja) frames num-frames) -1)) - (ja-frame-num 0) + (let ((gp-1 (new-stack-vector0))) + (vector-matrix*! gp-1 (-> self control transv) (-> self control w-R-c)) + (set! (-> gp-1 y) 0.0) + (vector-matrix*! (-> self control align-xz-vel) gp-1 (-> self control c-R-w)) + ) + (when (!= (the-as float (-> self control unknown-word04)) 0.0) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + (set! sv-16 (the-as float (-> self control unknown-word04))) + (set! (-> self control unknown-word04) (the-as uint 0.0)) + ) + (when (and (>= sv-16 0.0) + (let ((gp-2 (ja-group)) + (f30-2 (ja-aframe-num 0)) + ) + (if (or (and (= gp-2 jakb-darkjak-attack-combo1-ja) + (>= f30-2 11.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo1-ja) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 jakb-darkjak-attack-combo1b-ja) + (>= f30-2 11.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo1b-ja) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 jakb-darkjak-attack-combo2-ja) + (>= f30-2 49.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo2-ja) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 jakb-darkjak-attack-combo3-ja) + (or (and (>= f30-2 62.0) (>= 77.0 f30-2)) + (and (>= f30-2 82.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo3-ja) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + ) + ) + (and (= gp-2 jakb-darkjak-attack-combo3c-ja) + (>= f30-2 62.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo3c-ja) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + ) + #t + ) ) - ) - (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.6 1.0) + ) + (let ((gp-3 (new 'stack-no-clear 'collide-query))) + (when (and (>= (impact-control-method-11 + (-> self control impact-ctrl) + gp-3 + (the-as process #f) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) + ) + 0.0 + ) + (>= 0.0 (vector-dot (-> gp-3 best-other-tri normal) (-> self control impact-ctrl dir))) + ) + (when (= (-> gp-3 best-other-tri pat mode) (pat-mode wall)) + (part-tracker-spawn :to self :group group-punch-hit :mat-joint (-> gp-3 best-other-tri intersect)) + (let ((imp-sound (static-sound-name "djak-punch-hit"))) + (play-effect-sound + (-> self skel effect) + 'punch + -1.0 + (-> self control impact-ctrl joint) + (the-as basic #f) + imp-sound + ) + ) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + (set! sv-16 (the-as float -61440.0)) + ) + ) ) + ) + (let ((gp-4 (ja-group)) + (f0-53 (ja-aframe-num 0)) + ) + (if (and (= gp-4 jakb-darkjak-attack-combo3-ja) + (>= f0-53 80.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo3-ja) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.6 1.0) + ) + ) + (suspend) + (ja :num! (seek! max (* (-> self control current-surface align-speed) (the-as float sv-48)))) + (if (time-elapsed? (-> self state-time) (seconds 0.1)) + (set! (-> *run-attack-mods* turnvv) 0.0) + ) + (if (< 2 sv-24) + (set! sv-20 (* sv-20 (fmin 1.0 (-> self control zx-vel-frac)))) + ) + (+! sv-24 1) ) - (suspend) - (ja :num! (seek! max (* (-> self control current-surface align-speed) (the-as float sv-48)))) - (if (time-elapsed? (-> self state-time) (seconds 0.1)) - (set! (-> *run-attack-mods* turnvv) 0.0) - ) - (if (< 2 sv-24) - (set! sv-20 (* sv-20 (fmin 1.0 (-> self control zx-vel-frac)))) - ) - (set! sv-24 (+ sv-24 1)) ) (if (and (not (logtest? (-> self control status) (collide-status on-surface))) (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *TARGET-bank* ground-timeout))) @@ -1051,124 +1043,227 @@ (update-clock! (-> self darkjak) 4) ) :code (behavior () - (local-vars - (v1-100 symbol) - (sv-16 float) - (sv-20 float) - (sv-80 vector) - (sv-84 (function vector :behavior target)) - ) + (local-vars (v1-100 symbol)) (set! (-> self darkjak stage) (-> self darkjak want-stage)) (set! (-> self neck flex-blend) 0.0) (set! (-> self control mod-surface) *roll-flip-mods*) (set! (-> self alt-cam-pos quad) (-> self control trans quad)) - (set! sv-16 (the-as float 0.0)) - (set! sv-20 1.0) - (ja-channel-push! 1 (seconds 0.15)) - (when (jump-hit-ground-stuck?) - (ja-no-eval :group! jakb-darkjak-bomb-pre-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (set! (-> self alt-cam-pos x) (-> self control trans x)) - (set! (-> self alt-cam-pos z) (-> self control trans z)) - (set-forward-vel (* 0.85 (-> self control ctrl-xz-vel))) - (suspend) - (ja :num! (seek!)) + (let ((sv-16 (the-as float 0.0)) + (sv-20 1.0) + ) + (ja-channel-push! 1 (seconds 0.15)) + (when (jump-hit-ground-stuck?) + (ja-no-eval :group! jakb-darkjak-bomb-pre-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (set! (-> self alt-cam-pos x) (-> self control trans x)) + (set! (-> self alt-cam-pos z) (-> self control trans z)) + (set-forward-vel (* 0.85 (-> self control ctrl-xz-vel))) + (suspend) + (ja :num! (seek!)) + ) ) - ) - (set-setting! 'music-volume 'rel 0.0 0) - (set-setting! 'sfx-volume 'rel 0.0 0) - (set-setting! 'ambient-volume 'rel 0.0 0) - (ja-no-eval :group! jakb-darkjak-bomb-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (compute-alignment! (-> self align)) - (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) - (set! (-> self alt-cam-pos x) (-> self control trans x)) - (set! (-> self alt-cam-pos z) (-> self control trans z)) - (set-forward-vel (* 0.98 (-> self control ctrl-xz-vel))) - (suspend) - (ja :num! (seek!)) - ) - (ja-no-eval :group! jakb-darkjak-bomb-loop-ja :num! (seek!) :frame-num 0.0) - (let ((f30-0 (the float (target-time-to-ground)))) - (until v1-100 + (set-setting! 'music-volume 'rel 0.0 0) + (set-setting! 'sfx-volume 'rel 0.0 0) + (set-setting! 'ambient-volume 'rel 0.0 0) + (ja-no-eval :group! jakb-darkjak-bomb-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) (set! (-> self alt-cam-pos x) (-> self control trans x)) (set! (-> self alt-cam-pos z) (-> self control trans z)) (set-forward-vel (* 0.98 (-> self control ctrl-xz-vel))) - (let ((v1-92 (new-stack-vector0)) - (f0-35 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (suspend) + (ja :num! (seek!)) + ) + (ja-no-eval :group! jakb-darkjak-bomb-loop-ja :num! (seek!) :frame-num 0.0) + (let ((f30-0 (the float (target-time-to-ground)))) + (until v1-100 + (set! (-> self alt-cam-pos x) (-> self control trans x)) + (set! (-> self alt-cam-pos z) (-> self control trans z)) + (set-forward-vel (* 0.98 (-> self control ctrl-xz-vel))) + (let ((v1-92 (new-stack-vector0)) + (f0-35 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! v1-92 (-> self control transv) (vector-float*! v1-92 (-> self control dynam gravity-normal) f0-35)) + (let* ((f1-5 (vector-length v1-92)) + (f2-0 f1-5) + (f0-36 (+ f0-35 (* -491520.0 (seconds-per-frame)))) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-36) + (vector-float*! v1-92 v1-92 (/ f1-5 f2-0)) + ) + ) + ) + (suspend) + (ja :num! (seek! max (lerp-scale 1.5 0.3 f30-0 30.0 210.0))) + (set! v1-100 (or (ja-done? 0) (logtest? (-> self control status) (collide-status on-surface)))) + ) + ) + (logclear! (-> self state-flags) (state-flags sf6)) + (while (not (jump-hit-ground-stuck?)) + (let ((v1-105 (new-stack-vector0)) + (f0-42 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) ) 0.0 - (vector-! v1-92 (-> self control transv) (vector-float*! v1-92 (-> self control dynam gravity-normal) f0-35)) - (let* ((f1-5 (vector-length v1-92)) - (f2-0 f1-5) - (f0-36 (+ f0-35 (* -491520.0 (seconds-per-frame)))) + (vector-! + v1-105 + (-> self control transv) + (vector-float*! v1-105 (-> self control dynam gravity-normal) f0-42) + ) + (let* ((f1-8 (vector-length v1-105)) + (f2-1 f1-8) + (f0-43 (+ f0-42 (* -491520.0 (seconds-per-frame)))) ) (vector+! (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-36) - (vector-float*! v1-92 v1-92 (/ f1-5 f2-0)) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-43) + (vector-float*! v1-105 v1-105 (/ f1-8 f2-1)) ) ) ) + (ja :num! (seek! (ja-aframe 33.0 0))) (suspend) - (ja :num! (seek! max (lerp-scale 1.5 0.3 f30-0 30.0 210.0))) - (set! v1-100 (or (ja-done? 0) (logtest? (-> self control status) (collide-status on-surface)))) ) - ) - (logclear! (-> self state-flags) (state-flags sf6)) - (while (not (jump-hit-ground-stuck?)) - (let ((v1-105 (new-stack-vector0)) - (f0-42 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - ) - 0.0 - (vector-! - v1-105 - (-> self control transv) - (vector-float*! v1-105 (-> self control dynam gravity-normal) f0-42) - ) - (let* ((f1-8 (vector-length v1-105)) - (f2-1 f1-8) - (f0-43 (+ f0-42 (* -491520.0 (seconds-per-frame)))) - ) - (vector+! - (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-43) - (vector-float*! v1-105 v1-105 (/ f1-8 f2-1)) + (set-forward-vel 0.0) + (ja-no-eval :group! jakb-darkjak-bomb-land-ja :num! (seek! (ja-aframe 35.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 35.0 0))) + ) + (set-action! + *gui-control* + (gui-action play) + (-> self control unknown-sound-id00) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + (target-start-attack) + (target-danger-set! 'bomb #f) + (let ((sv-80 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg sk_lhand)))) + (let ((sv-84 (lambda :behavior target + () + (set-vector! (-> self draw color-mult) 0.0 0.0 0.0 1.0) + (cond + ((>= 10.0 (ja-aframe-num 0)) + (let ((v0-1 (the-as vector (-> self draw color-emissive)))) + (set! (-> (the-as rgbaf v0-1) x) 1.0) + (set! (-> (the-as rgbaf v0-1) y) 1.0) + (set! (-> (the-as rgbaf v0-1) z) 1.0) + (set! (-> (the-as rgbaf v0-1) w) 1.0) + v0-1 + ) + ) + ((>= 20.0 (ja-aframe-num 0)) + (vector-lerp! + (-> self draw color-emissive) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) + (lerp-scale 0.0 1.0 (ja-aframe-num 0) 10.0 20.0) + ) + ) + (else + (vector-lerp! + (-> self draw color-emissive) + (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) + (new 'static 'vector :w 1.0) + (lerp-scale 0.0 1.0 (ja-aframe-num 0) 20.0 30.0) + ) + ) + ) + ) + ) + ) + (if (and (focus-test? self dark) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) (darkjak-stage giant)) + ) + (set! (-> sv-80 y) (* 0.5 (+ (-> self control trans y) (-> self control root-prim prim-core world-sphere y)))) + (set! (-> sv-80 y) (-> self control root-prim prim-core world-sphere y)) + ) + (part-tracker-spawn :to *entity-pool* :group group-darkjak-bomb :mat-joint sv-80) + (let ((gp-5 (process-spawn + manipy + :init manipy-init + sv-80 + (-> self entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) + ) + (when gp-5 + (send-event (ppointer->process gp-5) 'anim-mode 'play1) + (send-event (ppointer->process gp-5) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-5 0)) root scale) sv-20 1.0 sv-20 1.0) + (send-event (ppointer->process gp-5) 'trans-hook sv-84) + ) ) ) - ) - (ja :num! (seek! (ja-aframe 33.0 0))) - (suspend) - ) - (set-forward-vel 0.0) - (ja-no-eval :group! jakb-darkjak-bomb-land-ja :num! (seek! (ja-aframe 35.0 0)) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek! (ja-aframe 35.0 0))) - ) - (set-action! - *gui-control* - (gui-action play) - (-> self control unknown-sound-id00) - (gui-channel none) - (gui-action none) - (the-as string #f) - (the-as (function gui-connection symbol) #f) - (the-as process #f) - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) - (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) - (target-start-attack) - (target-danger-set! 'bomb #f) - (set! sv-80 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg sk_lhand))) - (set! sv-84 (lambda :behavior target + (let ((gp-7 (process-spawn + manipy + :init manipy-init + sv-80 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) + ) + (when gp-7 + (send-event (ppointer->process gp-7) 'anim-mode 'play1) + (send-event (ppointer->process gp-7) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-7 0)) root scale) sv-20 1.0 sv-20 1.0) + ) + ) + (ja-no-eval :num! (seek! (ja-aframe 38.0 0))) + (while (not (ja-done? 0)) + (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) + (set-forward-vel 0.0) + (suspend) + (ja-eval) + ) + (when (and (focus-test? self dark) + (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) (darkjak-stage giant))) + ) + (let ((gp-10 (process-spawn + manipy + :init manipy-init + sv-80 + (-> self entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) + ) + (when gp-10 + (send-event (ppointer->process gp-10) 'anim-mode 'play1) + (send-event (ppointer->process gp-10) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-10 0)) root scale) sv-20 1.0 sv-20 1.0) + (send-event + (ppointer->process gp-10) + 'trans-hook + (lambda :behavior target () (set-vector! (-> self draw color-mult) 0.0 0.0 0.0 1.0) (cond ((>= 10.0 (ja-aframe-num 0)) (let ((v0-1 (the-as vector (-> self draw color-emissive)))) - (set! (-> (the-as rgbaf v0-1) x) 1.0) - (set! (-> (the-as rgbaf v0-1) y) 1.0) + (set! (-> (the-as rgbaf v0-1) x) 0.5) + (set! (-> (the-as rgbaf v0-1) y) 0.25) (set! (-> (the-as rgbaf v0-1) z) 1.0) (set! (-> (the-as rgbaf v0-1) w) 1.0) v0-1 @@ -1177,164 +1272,60 @@ ((>= 20.0 (ja-aframe-num 0)) (vector-lerp! (-> self draw color-emissive) - (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.5 :y 0.25 :z 1.0 :w 1.0) (lerp-scale 0.0 1.0 (ja-aframe-num 0) 10.0 20.0) ) ) (else (vector-lerp! (-> self draw color-emissive) - (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.25 :z 1.0 :w 1.0) (new 'static 'vector :w 1.0) (lerp-scale 0.0 1.0 (ja-aframe-num 0) 20.0 30.0) ) ) ) ) - ) - (if (and (focus-test? self dark) - (nonzero? (-> self darkjak)) - (logtest? (-> self darkjak stage) (darkjak-stage giant)) - ) - (set! (-> sv-80 y) (* 0.5 (+ (-> self control trans y) (-> self control root-prim prim-core world-sphere y)))) - (set! (-> sv-80 y) (-> self control root-prim prim-core world-sphere y)) - ) - (part-tracker-spawn :to *entity-pool* :group group-darkjak-bomb :mat-joint sv-80) - (let ((gp-5 (process-spawn - manipy - :init manipy-init - sv-80 - (-> self entity) - (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) - #f - 0 - :to self - ) ) - ) - (when gp-5 - (send-event (ppointer->process gp-5) 'anim-mode 'play1) - (send-event (ppointer->process gp-5) 'anim "idle") - (set-vector! (-> (the-as process-drawable (-> gp-5 0)) root scale) sv-20 1.0 sv-20 1.0) - (send-event (ppointer->process gp-5) 'trans-hook sv-84) - ) - ) - (let ((gp-7 (process-spawn - manipy - :init manipy-init - sv-80 - (-> self entity) - (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f)) - #f - 0 - :to self - ) - ) - ) - (when gp-7 - (send-event (ppointer->process gp-7) 'anim-mode 'play1) - (send-event (ppointer->process gp-7) 'anim "idle") - (set-vector! (-> (the-as process-drawable (-> gp-7 0)) root scale) sv-20 1.0 sv-20 1.0) - ) - ) - (ja-no-eval :num! (seek! (ja-aframe 38.0 0))) - (while (not (ja-done? 0)) - (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) - (set-forward-vel 0.0) - (suspend) - (ja-eval) - ) - (when (and (focus-test? self dark) - (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) (darkjak-stage giant))) - ) - (let ((gp-10 (process-spawn - manipy - :init manipy-init - sv-80 - (-> self entity) - (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) - #f - 0 - :to self - ) - ) + ) ) - (when gp-10 - (send-event (ppointer->process gp-10) 'anim-mode 'play1) - (send-event (ppointer->process gp-10) 'anim "idle") - (set-vector! (-> (the-as process-drawable (-> gp-10 0)) root scale) sv-20 1.0 sv-20 1.0) - (send-event - (ppointer->process gp-10) - 'trans-hook - (lambda :behavior target - () - (set-vector! (-> self draw color-mult) 0.0 0.0 0.0 1.0) - (cond - ((>= 10.0 (ja-aframe-num 0)) - (let ((v0-1 (the-as vector (-> self draw color-emissive)))) - (set! (-> (the-as rgbaf v0-1) x) 0.5) - (set! (-> (the-as rgbaf v0-1) y) 0.25) - (set! (-> (the-as rgbaf v0-1) z) 1.0) - (set! (-> (the-as rgbaf v0-1) w) 1.0) - v0-1 - ) - ) - ((>= 20.0 (ja-aframe-num 0)) - (vector-lerp! - (-> self draw color-emissive) - (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) - (new 'static 'vector :x 0.5 :y 0.25 :z 1.0 :w 1.0) - (lerp-scale 0.0 1.0 (ja-aframe-num 0) 10.0 20.0) - ) - ) - (else - (vector-lerp! - (-> self draw color-emissive) - (new 'static 'vector :x 0.25 :z 1.0 :w 1.0) - (new 'static 'vector :w 1.0) - (lerp-scale 0.0 1.0 (ja-aframe-num 0) 20.0 30.0) - ) - ) + (let ((gp-12 (process-spawn + manipy + :init manipy-init + sv-80 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) ) + (when gp-12 + (send-event (ppointer->process gp-12) 'anim-mode 'play1) + (send-event (ppointer->process gp-12) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-12 0)) root scale) sv-20 0.5 sv-20 1.0) ) ) ) ) - (let ((gp-12 (process-spawn - manipy - :init manipy-init - sv-80 - (-> self entity) - (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f)) - #f - 0 - :to self - ) - ) - ) - (when gp-12 - (send-event (ppointer->process gp-12) 'anim-mode 'play1) - (send-event (ppointer->process gp-12) 'anim "idle") - (set-vector! (-> (the-as process-drawable (-> gp-12 0)) root scale) sv-20 0.5 sv-20 1.0) - ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) + (set-forward-vel 0.0) + (suspend) + (ja-eval) + ) + (remove-setting! 'music-volume) + (remove-setting! 'sfx-volume) + (remove-setting! 'ambient-volume) + (ja-no-eval :group! jakb-darkjak-bomb-end-ja :num! (seek! (ja-aframe 90.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) + (suspend) + (ja :num! (seek! (ja-aframe 90.0 0))) ) - ) - (ja-no-eval :num! (seek!)) - (while (not (ja-done? 0)) - (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) - (set-forward-vel 0.0) - (suspend) - (ja-eval) - ) - (remove-setting! 'music-volume) - (remove-setting! 'sfx-volume) - (remove-setting! 'ambient-volume) - (ja-no-eval :group! jakb-darkjak-bomb-end-ja :num! (seek! (ja-aframe 90.0 0)) :frame-num 0.0) - (until (ja-done? 0) - (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) - (suspend) - (ja :num! (seek! (ja-aframe 90.0 0))) ) (logior! (-> self control status) (collide-status on-surface on-ground touch-surface)) (send-event (handle->process (-> self notify)) 'notify 'attack 16) @@ -1366,7 +1357,6 @@ ;; WARN: Return type mismatch object vs none. (defbehavior target-bomb1-fire-shot target ((arg0 (pointer handle)) (arg1 int) (arg2 int) (arg3 int)) - (local-vars (sv-128 target) (sv-144 int) (sv-160 vector) (sv-176 vector) (sv-192 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1427,19 +1417,21 @@ (s2-0 (-> *lightning-spec-id-table* 10)) (s1-0 0) (s0-0 lightning-probe-callback) + (sv-128 self) + (sv-144 3) + (sv-192 (new 'stack-no-clear 'vector)) ) - (set! sv-128 self) - (set! sv-144 3) - (set! sv-192 (new 'stack-no-clear 'vector)) - (set! sv-160 (-> self control trans)) - (set! sv-176 (new 'stack-no-clear 'vector)) - (set! (-> sv-176 x) (rand-vu-float-range -40960.0 40960.0)) - (set! (-> sv-176 y) (rand-vu-float-range -8192.0 8192.0)) - (set! (-> sv-176 z) (rand-vu-float-range -40960.0 40960.0)) - (set! (-> sv-176 w) 1.0) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-160 quad)) - (.lvf vf5 (&-> sv-176 quad)) + (let ((sv-160 (-> self control trans)) + (sv-176 (new 'stack-no-clear 'vector)) + ) + (set! (-> sv-176 x) (rand-vu-float-range -40960.0 40960.0)) + (set! (-> sv-176 y) (rand-vu-float-range -8192.0 8192.0)) + (set! (-> sv-176 z) (rand-vu-float-range -40960.0 40960.0)) + (set! (-> sv-176 w) 1.0) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-160 quad)) + (.lvf vf5 (&-> sv-176 quad)) + ) (.add.vf.xyz vf6 vf4 vf5) (.svf (&-> sv-192 quad) vf6) ((the-as (function object object object object object object object object none) s5-1) @@ -1480,20 +1472,6 @@ (update-clock! (-> self darkjak) 8) ) :code (behavior ((arg0 float) (arg1 float)) - (local-vars - (sv-32 (array collide-shape)) - (sv-40 int) - (sv-48 int) - (sv-56 sphere) - (sv-60 (pointer handle)) - (sv-64 int) - (sv-72 time-frame) - (sv-80 time-frame) - (sv-88 float) - (sv-92 number) - (sv-96 time-frame) - (sv-104 uint) - ) (logior! (-> self state-flags) (state-flags sf4)) (set! (-> self neck flex-blend) 0.0) (set-setting! 'music-volume 'rel 0.0 0) @@ -1525,244 +1503,250 @@ (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) (let ((gp-0 (-> self post-hook))) (set! (-> self post-hook) target-no-move-post) - (set! sv-32 (-> self focus-search)) - (set! sv-40 0) - (set! sv-48 0) - (set! sv-56 (the-as sphere (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg main)))) - (set! sv-60 - (new 'static 'array handle 128 - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) + (let ((sv-32 (-> self focus-search)) + (sv-40 0) + (sv-48 0) + (sv-56 (the-as sphere (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg main)))) + (sv-60 + (new 'static 'array handle 128 + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + ) ) ) - (set! (-> sv-56 r) - (if (and (focus-test? self dark) - (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) (darkjak-stage giant))) - ) - 614400.0 - 327680.0 - ) - ) - (set! sv-40 (fill-actor-list-for-sphere *actor-hash* sv-56 (-> sv-32 data) (-> sv-32 allocated-length))) - (set! (-> sv-32 length) sv-40) - (countdown (s5-0 sv-40) - (let ((v1-53 (the-as process-drawable (as-type (-> sv-32 s5-0 process) process-focusable)))) - (when (and v1-53 (logtest? (process-mask enemy guard vehicle) (-> v1-53 mask))) - (set! (-> sv-60 sv-48) (process->handle v1-53)) - (set! sv-48 (+ sv-48 1)) - (if (< 128 sv-48) - (set! sv-48 128) - ) + (set! (-> sv-56 r) + (if (and (focus-test? self dark) + (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) (darkjak-stage giant))) + ) + 614400.0 + 327680.0 + ) + ) + (set! sv-40 (fill-actor-list-for-sphere *actor-hash* sv-56 (-> sv-32 data) (-> sv-32 allocated-length))) + (set! (-> sv-32 length) sv-40) + (countdown (s5-0 sv-40) + (let ((v1-53 (the-as process-drawable (as-type (-> sv-32 s5-0 process) process-focusable)))) + (when (and v1-53 (logtest? (process-mask enemy guard vehicle) (-> v1-53 mask))) + (set! (-> sv-60 sv-48) (process->handle v1-53)) + (+! sv-48 1) + (if (< 128 sv-48) + (set! sv-48 128) + ) + ) ) ) - ) - (set! (-> self control mod-surface) (new 'static 'surface - :name 'uppercut - :turnv 524288.0 - :tiltv 32768.0 - :tiltvv 262144.0 - :transv-max 32768.0 - :target-speed 32768.0 - :fric 0.2 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :turnvf 15.0 - :tiltvf 150.0 - :tiltvvf 15.0 - :mode 'air - :flags (surface-flag air attack spin gun-off laser-hide) - ) + (set! (-> self control mod-surface) (new 'static 'surface + :name 'uppercut + :turnv 524288.0 + :tiltv 32768.0 + :tiltvv 262144.0 + :transv-max 32768.0 + :target-speed 32768.0 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :turnvf 15.0 + :tiltvf 150.0 + :tiltvvf 15.0 + :mode 'air + :flags (surface-flag air attack spin gun-off laser-hide) + ) + ) + (let ((sv-64 0) + (sv-72 (current-time)) + (sv-80 (current-time)) + (sv-88 (the-as float 0.0)) + (sv-92 0.0) + ) + (let ((sv-96 (current-time))) ) - (set! sv-64 0) - (set! sv-72 (current-time)) - (set! sv-80 (current-time)) - (set! sv-88 (the-as float 0.0)) - (set! sv-92 0.0) - (set! sv-96 (current-time)) - (let* ((v1-70 (-> self game)) - (a0-33 (+ (-> v1-70 attack-id) 1)) - ) - (set! (-> v1-70 attack-id) a0-33) - (set! sv-104 a0-33) - ) - (ja-channel-push! 2 (seconds 0.05)) - (ja :group! jakb-darkjak-attack-ice-loop-ja) - (ja :chan 1 :group! jakb-darkjak-attack-ice-loop2-ja) - (while (or (< sv-64 sv-48) (not (time-elapsed? sv-80 (seconds 1.5)))) - (let ((v1-77 (new-stack-vector0))) - (let ((f0-8 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) - 0.0 - (vector-! v1-77 (-> self control transv) (vector-float*! v1-77 (-> self control dynam gravity-normal) f0-8)) - ) - (let* ((f0-9 (vector-length v1-77)) - (f1-3 f0-9) - (f2-0 0.0) + (let* ((v1-70 (-> self game)) + (a0-33 (+ (-> v1-70 attack-id) 1)) ) - (vector+! - (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) - (vector-float*! v1-77 v1-77 (/ f0-9 f1-3)) + (set! (-> v1-70 attack-id) a0-33) + (let ((sv-104 a0-33)) + (ja-channel-push! 2 (seconds 0.05)) + (ja :group! jakb-darkjak-attack-ice-loop-ja) + (ja :chan 1 :group! jakb-darkjak-attack-ice-loop2-ja) + (while (or (< sv-64 sv-48) (not (time-elapsed? sv-80 (seconds 1.5)))) + (let ((v1-77 (new-stack-vector0))) + (let ((f0-8 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-77 (-> self control transv) (vector-float*! v1-77 (-> self control dynam gravity-normal) f0-8)) + ) + (let* ((f0-9 (vector-length v1-77)) + (f1-3 f0-9) + (f2-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-77 v1-77 (/ f0-9 f1-3)) + ) + ) + ) + (set! (-> self darkjak clock-vel) -4.0) + (set! (-> self darkjak clock-on) #t) + (send-event *camera* 'joystick -0.25 1.0) + (when (time-elapsed? sv-72 (seconds 0.1)) + (set! sv-72 (current-time)) + (target-bomb1-fire-shot sv-60 sv-64 sv-48 (the-as int sv-104)) + (+! sv-64 1) + (if (time-elapsed? (-> self state-time) (seconds 1)) + (set! sv-92 1.0) + ) + ) + (set! sv-88 (seek sv-88 (the-as float sv-92) (* 6.0 (seconds-per-frame)))) + (ja :num! (loop!)) + (let ((a0-60 (-> self skel root-channel 1))) + (let ((f0-17 sv-88)) + (set! (-> a0-60 frame-interp 1) f0-17) + (set! (-> a0-60 frame-interp 0) f0-17) + ) + (set! (-> a0-60 param 0) 0.0) + (joint-control-channel-group-eval! a0-60 (the-as art-joint-anim #f) num-func-chan) + ) + (suspend) + ) ) ) ) - (set! (-> self darkjak clock-vel) -4.0) - (set! (-> self darkjak clock-on) #t) - (send-event *camera* 'joystick -0.25 1.0) - (when (time-elapsed? sv-72 (seconds 0.1)) - (set! sv-72 (current-time)) - (target-bomb1-fire-shot sv-60 sv-64 sv-48 (the-as int sv-104)) - (set! sv-64 (+ sv-64 1)) - (if (time-elapsed? (-> self state-time) (seconds 1)) - (set! sv-92 1.0) - ) - ) - (set! sv-88 (seek sv-88 (the-as float sv-92) (* 6.0 (seconds-per-frame)))) - (ja :num! (loop!)) - (let ((a0-60 (-> self skel root-channel 1))) - (let ((f0-17 sv-88)) - (set! (-> a0-60 frame-interp 1) f0-17) - (set! (-> a0-60 frame-interp 0) f0-17) - ) - (set! (-> a0-60 param 0) 0.0) - (joint-control-channel-group-eval! a0-60 (the-as art-joint-anim #f) num-func-chan) - ) - (suspend) ) 0 (set! (-> self post-hook) gp-0) diff --git a/goal_src/jak2/engine/target/target-death.gc b/goal_src/jak2/engine/target/target-death.gc index 70d6de02b2..a683b2e678 100644 --- a/goal_src/jak2/engine/target/target-death.gc +++ b/goal_src/jak2/engine/target/target-death.gc @@ -923,258 +923,259 @@ ) ) :code (behavior ((arg0 symbol) (arg1 attack-info)) - (local-vars (sv-32 attack-info) (sv-36 vector)) (logclear! (-> self water flags) (water-flags jump-out)) (set-time! (-> self state-time)) (set! (-> self neck flex-blend) 0.0) - (set! sv-32 (-> self attack-info)) - (set! sv-36 (new 'stack-no-clear 'vector)) - (let ((v1-7 sv-32)) - (set! (-> v1-7 attacker) (the-as handle #f)) - (set! (-> v1-7 mode) 'generic) - (set! (-> v1-7 shove-back) 6144.0) - (set! (-> v1-7 shove-up) 4915.2) - (set! (-> v1-7 angle) #f) - (set! (-> v1-7 trans quad) (-> self control trans quad)) - (set! (-> v1-7 control) 0.0) - (set! (-> v1-7 invinc-time) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout))) - (set! (-> v1-7 damage) (-> *FACT-bank* health-default-inc)) - ) - (case arg0 - (('shove) - (let ((v1-10 sv-32)) - (set! (-> v1-10 shove-back) (-> *TARGET-bank* smack-surface-dist)) - (set! (-> v1-10 shove-up) (-> *TARGET-bank* smack-surface-height)) - (set! (-> v1-10 angle) 'shove) - ) - ) - ) - (combine! sv-32 arg1 self) - (when (not (logtest? (-> sv-32 mask) (attack-mask vector))) - (vector-z-quaternion! (-> sv-32 vector) (-> self control quat-for-control)) - (vector-xz-normalize! (-> sv-32 vector) (- (fabs (-> sv-32 shove-back)))) - (set! (-> sv-32 vector y) (-> sv-32 shove-up)) - ) - (when (and (focus-test? self dark) (nonzero? (-> self darkjak))) - (set! (-> sv-32 damage) (fmax 1.0 (ceil (/ (-> sv-32 damage) 2)))) - (if (< (- (-> self fact health) (-> sv-32 damage)) 1.0) - (set! (-> sv-32 damage) (+ -1.0 (-> self fact health))) + (let ((sv-32 (-> self attack-info))) + (let ((sv-36 (new 'stack-no-clear 'vector))) + (let ((v1-7 sv-32)) + (set! (-> v1-7 attacker) (the-as handle #f)) + (set! (-> v1-7 mode) 'generic) + (set! (-> v1-7 shove-back) 6144.0) + (set! (-> v1-7 shove-up) 4915.2) + (set! (-> v1-7 angle) #f) + (set! (-> v1-7 trans quad) (-> self control trans quad)) + (set! (-> v1-7 control) 0.0) + (set! (-> v1-7 invinc-time) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout))) + (set! (-> v1-7 damage) (-> *FACT-bank* health-default-inc)) ) - ) - (set! (-> sv-36 quad) (-> sv-32 vector quad)) - (let ((f0-20 (vector-dot - (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-36 1.0) - (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control quat-for-control)) - ) - ) - ) - (if (not (-> self attack-info angle)) - (set! (-> self attack-info angle) (if (>= 0.0 f0-20) - 'front - 'back - ) - ) - ) - ) - (cond - ((= arg0 'attack) - (send-event (handle->process (-> self notify)) 'notify 'hit (-> sv-32 mode)) - (logior! (-> self focus-status) (focus-status hit)) - (set-time! (-> self game hit-time)) - (case (-> sv-32 mode) - (('endlessfall) - (cond - ((= (-> self game mode) 'debug) - (let ((gp-1 (new-stack-vector0))) - (set! (-> gp-1 quad) (-> self control last-trans-on-ground quad)) - (ja-channel-set! 0) - (suspend-for (seconds 1) - ) - (move-to-point! (-> self control) gp-1) - ) - (set! (-> self control camera-pos quad) (-> self control trans quad)) - (send-event *camera* 'teleport) - (go target-stance) + (case arg0 + (('shove) + (let ((v1-10 sv-32)) + (set! (-> v1-10 shove-back) (-> *TARGET-bank* smack-surface-dist)) + (set! (-> v1-10 shove-up) (-> *TARGET-bank* smack-surface-height)) + (set! (-> v1-10 angle) 'shove) ) - (else - (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) - (go target-death (-> sv-32 mode)) - ) - ) + ) ) - (('lava 'melt) - (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) - (part-tracker-spawn :to *entity-pool* :group group-lava-death :mat-joint (-> self control trans)) - (set! (-> sv-32 angle) 'lava) - (set! (-> sv-32 shove-up) 20480.0) + (combine! sv-32 arg1 self) + (when (not (logtest? (-> sv-32 mask) (attack-mask vector))) + (vector-z-quaternion! (-> sv-32 vector) (-> self control quat-for-control)) + (vector-xz-normalize! (-> sv-32 vector) (- (fabs (-> sv-32 shove-back)))) + (set! (-> sv-32 vector y) (-> sv-32 shove-up)) ) - (('drown-death - 'sharkey - 'dark-eco-pool - 'instant-death - 'crush - 'death - 'grenade - 'bot - 'turret - 'centipede - 'big-explosion - ) - (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) - (if (= (-> self game mode) 'play) - (go target-death (-> sv-32 mode)) + (when (and (focus-test? self dark) (nonzero? (-> self darkjak))) + (set! (-> sv-32 damage) (fmax 1.0 (ceil (/ (-> sv-32 damage) 2)))) + (if (< (- (-> self fact health) (-> sv-32 damage)) 1.0) + (set! (-> sv-32 damage) (+ -1.0 (-> self fact health))) ) ) - (('explode) - (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) - (if (and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) - (go target-death (-> sv-32 mode)) - ) - ) - (('smush) - (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) - (go target-hit-ground-hard (-> *TARGET-bank* fall-far)) - ) - (('shock 'shock-red 'shock-green) - (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) - (let* ((v1-123 (-> sv-32 mode)) - (gp-3 (cond - ((= v1-123 'shock-red) - group-lightning-red-glow - ) - ((= v1-123 'shock-green) - group-lightning-green-glow - ) - (else - group-lightning-glow - ) - ) + (set! (-> sv-36 quad) (-> sv-32 vector quad)) + (let ((f0-20 (vector-dot + (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-36 1.0) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control quat-for-control)) ) + ) + ) + (if (not (-> self attack-info angle)) + (set! (-> self attack-info angle) (if (>= 0.0 f0-20) + 'front + 'back + ) + ) + ) + ) + (cond + ((= arg0 'attack) + (send-event (handle->process (-> self notify)) 'notify 'hit (-> sv-32 mode)) + (logior! (-> self focus-status) (focus-status hit)) + (set-time! (-> self game hit-time)) + (case (-> sv-32 mode) + (('endlessfall) + (cond + ((= (-> self game mode) 'debug) + (let ((gp-1 (new-stack-vector0))) + (set! (-> gp-1 quad) (-> self control last-trans-on-ground quad)) + (ja-channel-set! 0) + (suspend-for (seconds 1) + ) + (move-to-point! (-> self control) gp-1) + ) + (set! (-> self control camera-pos quad) (-> self control trans quad)) + (send-event *camera* 'teleport) + (go target-stance) ) - (process-spawn part-tracker :init part-tracker-init gp-3 300 #f #f self 6 :to self) - ) - (let ((gp-4 (-> self post-hook))) - (set! (-> self control mod-surface) *turn-around-mods*) - (set! (-> self post-hook) target-no-stick-post) - (if (using-gun? self) - (push-anim-to-targ (-> self skel top-anim) (the-as art-joint-anim jakb-gun-hit-elec-ja) 0.0 30 0 1.0 0.0 #f) - ) - (let ((v1-141 (new-stack-vector0))) - (let ((f0-31 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) - 0.0 - (vector-! - v1-141 - (-> self control transv) - (vector-float*! v1-141 (-> self control dynam gravity-normal) f0-31) - ) - ) - (let* ((f0-32 (vector-length v1-141)) - (f1-7 f0-32) - (f2-0 0.0) - ) - (vector+! - (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) - (vector-float*! v1-141 v1-141 (/ f0-32 f1-7)) + (else + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (go target-death (-> sv-32 mode)) ) ) ) - (ja-channel-push! 1 (seconds 0.1)) - (ja-no-eval :group! jakb-hit-elec-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (let ((v1-157 (new-stack-vector0)) - (f0-39 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - ) - 0.0 - (vector-! - v1-157 - (-> self control transv) - (vector-float*! v1-157 (-> self control dynam gravity-normal) f0-39) - ) - (let* ((f1-10 (vector-length v1-157)) - (f2-1 f1-10) - (f0-40 (+ f0-39 (* 286720.0 (seconds-per-frame)))) - ) - (vector+! - (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-40) - (vector-float*! v1-157 v1-157 (/ f1-10 f2-1)) - ) - ) + (('lava 'melt) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (part-tracker-spawn :to *entity-pool* :group group-lava-death :mat-joint (-> self control trans)) + (set! (-> sv-32 angle) 'lava) + (set! (-> sv-32 shove-up) 20480.0) + ) + (('drown-death + 'sharkey + 'dark-eco-pool + 'instant-death + 'crush + 'death + 'grenade + 'bot + 'turret + 'centipede + 'big-explosion ) - (when (>= (- (-> *display* game-clock frame-counter) (-> self shock-effect-time)) (seconds 0.03)) - (set! (-> self shock-effect-time) (-> *display* game-clock frame-counter)) - (send-event self 'color-effect 'shock (seconds 0.2)) - (case (-> sv-32 mode) - (('shock-red) - (process-drawable-shock-effect - self - (-> *lightning-spec-id-table* 3) - lightning-probe-callback - (the-as sparticle-launcher #f) - 0 - 0 - 40960.0 + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (if (= (-> self game mode) 'play) + (go target-death (-> sv-32 mode)) + ) + ) + (('explode) + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) + (if (and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) + (go target-death (-> sv-32 mode)) + ) + ) + (('smush) + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) + (go target-hit-ground-hard (-> *TARGET-bank* fall-far)) + ) + (('shock 'shock-red 'shock-green) + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) + (let* ((v1-123 (-> sv-32 mode)) + (gp-3 (cond + ((= v1-123 'shock-red) + group-lightning-red-glow + ) + ((= v1-123 'shock-green) + group-lightning-green-glow + ) + (else + group-lightning-glow + ) + ) + ) ) - ) - (('shock-green) - (process-drawable-shock-effect - self - (-> *lightning-spec-id-table* 4) - lightning-probe-callback - (the-as sparticle-launcher #f) - 0 - 0 - 40960.0 - ) - ) - (else - (process-drawable-shock-effect - self - (-> *lightning-spec-id-table* 1) - lightning-probe-callback - (-> *part-id-table* 166) - 0 - 0 - 40960.0 + (process-spawn part-tracker :init part-tracker-init gp-3 300 #f #f self 6 :to self) + ) + (let ((gp-4 (-> self post-hook))) + (set! (-> self control mod-surface) *turn-around-mods*) + (set! (-> self post-hook) target-no-stick-post) + (if (using-gun? self) + (push-anim-to-targ (-> self skel top-anim) (the-as art-joint-anim jakb-gun-hit-elec-ja) 0.0 30 0 1.0 0.0 #f) + ) + (let ((v1-141 (new-stack-vector0))) + (let ((f0-31 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! + v1-141 + (-> self control transv) + (vector-float*! v1-141 (-> self control dynam gravity-normal) f0-31) + ) + ) + (let* ((f0-32 (vector-length v1-141)) + (f1-7 f0-32) + (f2-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-141 v1-141 (/ f0-32 f1-7)) ) ) ) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-hit-elec-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (let ((v1-157 (new-stack-vector0)) + (f0-39 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! + v1-157 + (-> self control transv) + (vector-float*! v1-157 (-> self control dynam gravity-normal) f0-39) + ) + (let* ((f1-10 (vector-length v1-157)) + (f2-1 f1-10) + (f0-40 (+ f0-39 (* 286720.0 (seconds-per-frame)))) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-40) + (vector-float*! v1-157 v1-157 (/ f1-10 f2-1)) + ) + ) + ) + (when (>= (- (-> *display* game-clock frame-counter) (-> self shock-effect-time)) (seconds 0.03)) + (set! (-> self shock-effect-time) (-> *display* game-clock frame-counter)) + (send-event self 'color-effect 'shock (seconds 0.2)) + (case (-> sv-32 mode) + (('shock-red) + (process-drawable-shock-effect + self + (-> *lightning-spec-id-table* 3) + lightning-probe-callback + (the-as sparticle-launcher #f) + 0 + 0 + 40960.0 + ) + ) + (('shock-green) + (process-drawable-shock-effect + self + (-> *lightning-spec-id-table* 4) + lightning-probe-callback + (the-as sparticle-launcher #f) + 0 + 0 + 40960.0 + ) + ) + (else + (process-drawable-shock-effect + self + (-> *lightning-spec-id-table* 1) + lightning-probe-callback + (-> *part-id-table* 166) + 0 + 0 + 40960.0 + ) + ) + ) + ) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> sv-32 angle) 'back) + (set! (-> self post-hook) gp-4) ) - (suspend) - (ja :num! (seek!)) ) - (set! (-> sv-32 angle) 'back) - (set! (-> self post-hook) gp-4) + (else + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) + ) + ) + (target-hit-effect sv-32) + ) + (else + (case (-> sv-32 mode) + (('burn 'burnup) + (sound-play "get-burned") + ) + ) ) ) - (else - (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) - ) - ) - (target-hit-effect sv-32) - ) - (else - (case (-> sv-32 mode) - (('burn 'burnup) - (sound-play "get-burned") - ) + (when (and (= (-> self game mode) 'play) (and (>= 0.0 (-> self fact health)) (using-gun? self))) + (send-event (ppointer->process (-> self gun gun)) 'die) + (target-gun-end-mode #f) ) + (set! (-> self control mod-surface) *smack-mods*) + (target-hit-setup-anim sv-32) + (target-hit-move sv-32 (target-hit-orient sv-32 sv-36) target-falling-anim-trans 1.0) ) + (if (and (and (focus-test? self dark) (nonzero? (-> self darkjak))) (>= 1.0 (-> self fact health))) + (go target-darkjak-get-off) + ) + (if (and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) + (go target-death (-> sv-32 mode)) + ) ) - (when (and (= (-> self game mode) 'play) (and (>= 0.0 (-> self fact health)) (using-gun? self))) - (send-event (ppointer->process (-> self gun gun)) 'die) - (target-gun-end-mode #f) - ) - (set! (-> self control mod-surface) *smack-mods*) - (target-hit-setup-anim sv-32) - (target-hit-move sv-32 (target-hit-orient sv-32 sv-36) target-falling-anim-trans 1.0) - (if (and (and (focus-test? self dark) (nonzero? (-> self darkjak))) (>= 1.0 (-> self fact health))) - (go target-darkjak-get-off) - ) - (if (and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) - (go target-death (-> sv-32 mode)) - ) (go target-hit-ground #f) ) :post target-post diff --git a/goal_src/jak2/engine/target/target-handler.gc b/goal_src/jak2/engine/target/target-handler.gc index ce4a4a9ddf..f16a45fabb 100644 --- a/goal_src/jak2/engine/target/target-handler.gc +++ b/goal_src/jak2/engine/target/target-handler.gc @@ -181,447 +181,278 @@ ) (defbehavior target-send-attack target ((arg0 process) (arg1 symbol) (arg2 touching-shapes-entry) (arg3 int) (arg4 int) (arg5 penetrate)) - (local-vars - (sv-96 symbol) - (sv-100 touching-prims-entry) - (sv-128 touching-prims-entry) - (sv-176 touching-prims-entry) - (sv-224 penetrate) - (sv-240 int) - (sv-256 symbol) - (sv-272 symbol) - (sv-288 symbol) - (sv-304 vector) - (sv-320 matrix) - (sv-336 int) - (sv-352 symbol) - (sv-368 symbol) - (sv-384 symbol) - (sv-400 vector) - (sv-416 matrix) - (sv-432 int) - (sv-448 symbol) - (sv-464 symbol) - (sv-480 symbol) - (sv-496 vector) - (sv-512 matrix) - (sv-528 int) - (sv-544 symbol) - (sv-560 symbol) - (sv-576 symbol) - (sv-592 vector) - (sv-608 matrix) - (sv-624 int) - (sv-640 symbol) - (sv-656 symbol) - (sv-672 symbol) - (sv-688 vector) - (sv-704 matrix) - ) - (set! sv-224 arg5) - (let* ((s4-0 (the-as process (as-type arg0 process-focusable))) + (let* ((sv-224 arg5) + (s4-0 (the-as process (as-type arg0 process-focusable))) (s3-1 (and s4-0 (focus-test? (the-as process-focusable s4-0) dead hit))) + (a1-2 (new 'stack-no-clear 'event-message-block)) ) - (set! sv-96 + (set! (-> a1-2 from) (process->ppointer self)) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'attack) + (set! (-> a1-2 param 0) (the-as uint arg2)) + (set! (-> a1-2 param 1) (the-as - symbol - (send-event - arg0 - 'attack - arg2 - (static-attack-info ((id (the-as uint arg3)) (mode arg1) (count (the-as uint arg4)) (penetrate-using sv-224))) - ) + uint + (static-attack-info ((id (the-as uint arg3)) (mode arg1) (count (the-as uint arg4)) (penetrate-using sv-224))) ) ) - (when sv-96 - (set! (-> self control send-attack-dest) (process->handle arg0)) - (set-time! (-> self control send-attack-time)) - (send-event self 'hit arg1 arg0 arg2) - ;; og:preserve-this process cast - (set! arg0 (the process (and (and (focus-test? self dark) - (nonzero? (-> self darkjak)) - (logtest? (-> self darkjak stage) (darkjak-stage active)) - ) - arg0 - )) - ) - (when (the-as object arg0) - (when (and s4-0 (not s3-1) (-> self control danger-mode) (not (logtest? (-> s4-0 mask) (process-mask dark-effect)))) - (logior! (-> s4-0 mask) (process-mask dark-effect)) - (process-spawn-function - process - (lambda :behavior target - ((arg0 handle)) - (local-vars (sv-112 vector) (sv-128 matrix)) - ;; og:preserve-this added - (stack-size-set! (-> self main-thread) 512) - (let ((gp-0 (-> self parent))) - (let ((s4-0 0) - (s3-0 (current-time)) - ) - (set! (-> self clock) (-> gp-0 0 clock)) - (while (let ((v1-48 gp-0)) - (and (or (focus-test? - (the-as process-focusable (if v1-48 - (the-as process-focusable (-> v1-48 0 self)) - ) - ) - dead - hit - ) - (let ((v1-53 gp-0)) - (and (-> (the-as process-focusable (if v1-53 - (the-as process-focusable (-> v1-53 0 self)) - ) - ) - next-state - ) - (let ((v1-56 gp-0)) - (= (-> (the-as process-focusable (if v1-56 - (the-as process-focusable (-> v1-56 0 self)) - ) - ) - next-state - name - ) - 'knocked + (let ((sv-96 (the-as symbol (send-event-function arg0 a1-2)))) + (when sv-96 + (set! (-> self control send-attack-dest) (process->handle arg0)) + (set-time! (-> self control send-attack-time)) + (send-event self 'hit arg1 arg0 arg2) + ;; og:preserve-this process cast + (set! arg0 (the process (and (and (focus-test? self dark) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) (darkjak-stage active)) + ) + arg0 + )) + ) + (when (the-as object arg0) + (when (and s4-0 (not s3-1) (-> self control danger-mode) (not (logtest? (-> s4-0 mask) (process-mask dark-effect)))) + (logior! (-> s4-0 mask) (process-mask dark-effect)) + (process-spawn-function + process + (lambda :behavior target + ((arg0 handle)) + ;; og:preserve-this added + (stack-size-set! (-> self main-thread) 512) + (let ((gp-0 (-> self parent))) + (let ((s4-0 0) + (s3-0 (current-time)) + ) + (set! (-> self clock) (-> gp-0 0 clock)) + (while (let ((v1-48 gp-0)) + (and (or (focus-test? + (the-as process-focusable (if v1-48 + (the-as process-focusable (-> v1-48 0 self)) + ) ) - ) - ) - ) - ) - (not (time-elapsed? s3-0 (seconds 15))) - (not (logtest? (-> (the-as process-focusable (-> gp-0 0)) draw status) (draw-control-status no-draw no-draw-temp)) - ) - ) - ) - (let ((s2-0 sp-launch-particles-var) - (s1-0 *sp-particle-system-2d*) - (s0-0 (-> *part-id-table* 178)) - ) - (set! sv-128 *launch-matrix*) - (set! sv-112 (-> sv-128 trans)) - (let ((v1-9 (-> (process-drawable-random-point! - (the-as process-drawable (ppointer->process gp-0)) - (new 'stack-no-clear 'vector) + dead + hit + ) + (let ((v1-53 gp-0)) + (and (-> (the-as process-focusable (if v1-53 + (the-as process-focusable (-> v1-53 0 self)) + ) + ) + next-state + ) + (let ((v1-56 gp-0)) + (= (-> (the-as process-focusable (if v1-56 + (the-as process-focusable (-> v1-56 0 self)) + ) + ) + next-state + name + ) + 'knocked + ) + ) + ) ) - quad ) + (not (time-elapsed? s3-0 (seconds 15))) + (not (logtest? (-> (the-as process-focusable (-> gp-0 0)) draw status) (draw-control-status no-draw no-draw-temp)) + ) ) + ) + (let ((s2-0 sp-launch-particles-var) + (s1-0 *sp-particle-system-2d*) + (s0-0 (-> *part-id-table* 178)) + (sv-128 *launch-matrix*) ) - (set! (-> sv-112 quad) v1-9) + (let ((sv-112 (-> sv-128 trans))) + (set! (-> sv-112 quad) (-> (process-drawable-random-point! + (the-as process-drawable (ppointer->process gp-0)) + (new 'stack-no-clear 'vector) + ) + quad + ) + ) + ) + (s2-0 s1-0 s0-0 sv-128 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) - (let ((a3-0 #f) - (t0-0 #f) - (t1-0 1.0) - ) - (s2-0 s1-0 s0-0 sv-128 (the-as sparticle-launch-state a3-0) (the-as sparticle-launch-control t0-0) t1-0) - ) - ) - (send-event (ppointer->process gp-0) 'color-effect 'dark (seconds 0.2)) - (when (time-elapsed? (the-as time-frame s4-0) (seconds 0.05)) - (set! s4-0 (the-as int (current-time))) - (cond - ((and (not (time-elapsed? s3-0 (seconds 0.5))) (handle->process arg0)) - (process-drawable2-shock-effect - (the-as process-drawable (handle->process arg0)) - (the-as process-drawable (ppointer->process gp-0)) - (-> *lightning-spec-id-table* 9) - lightning-probe-callback - (-> *part-id-table* 179) + (send-event (ppointer->process gp-0) 'color-effect 'dark (seconds 0.2)) + (when (time-elapsed? (the-as time-frame s4-0) (seconds 0.05)) + (set! s4-0 (the-as int (current-time))) + (cond + ((and (not (time-elapsed? s3-0 (seconds 0.5))) (handle->process arg0)) + (process-drawable2-shock-effect + (the-as process-drawable (handle->process arg0)) + (the-as process-drawable (ppointer->process gp-0)) + (-> *lightning-spec-id-table* 9) + lightning-probe-callback + (-> *part-id-table* 179) + ) ) - ) - (else - (send-event (handle->process arg0) 'color-effect 'shock (seconds 0.2)) - (process-drawable-shock-effect - (the-as process-drawable (ppointer->process gp-0)) - (-> *lightning-spec-id-table* 9) - lightning-probe-callback - (-> *part-id-table* 179) - 0 - 0 - 40960.0 + (else + (send-event (handle->process arg0) 'color-effect 'shock (seconds 0.2)) + (process-drawable-shock-effect + (the-as process-drawable (ppointer->process gp-0)) + (-> *lightning-spec-id-table* 9) + lightning-probe-callback + (-> *part-id-table* 179) + 0 + 0 + 40960.0 + ) ) ) ) + (suspend) ) - (suspend) + ) + (logclear! (-> gp-0 0 mask) (process-mask dark-effect)) + (send-event (ppointer->process gp-0) 'color-effect #f 0) + ) + (none) + ) + (process->handle self) + :to s4-0 + ) + ) + ) + (let ((v1-37 arg1)) + (cond + ((or (= v1-37 'spin) (= v1-37 'spin-air) (= v1-37 'board-spin)) + (let ((sv-100 (prims-touching? arg2 (-> self control) (the-as uint 256)))) + (if sv-100 + (part-tracker-spawn + :to self + :group group-spin-hit + :callback (the-as symbol #f) + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (get-intersect-point (new 'stack-no-clear 'vector) sv-100 (-> self control) arg2) + ) + (do-effect (-> self skel effect) 'group-spin-hit -1.0 38) + ) + ) + (play-effect-sound (-> self skel effect) arg1 -1.0 38 (the-as basic #f) (cond + ((= arg1 'board-spin) + (static-sound-name "board-impact") + ) + ((using-gun? self) + (static-sound-name "gun-spin-hit") + ) + (else + (static-sound-name "spin-hit") + ) + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.2)) + ) + ((or (= v1-37 'punch) (= v1-37 'mech-punch)) + (when arg2 + (let ((sv-128 (prims-touching? arg2 (-> self control) (the-as uint 256)))) + (cond + (sv-128 + (part-tracker-spawn + :to self + :group group-punch-hit + :callback (the-as symbol #f) + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) + ) + ) + ((let ((v0-20 (prims-touching? arg2 (-> self control) (the-as uint 128)))) + (set! sv-128 v0-20) + v0-20 + ) + (part-tracker-spawn + :to self + :group group-punch-hit + :callback (the-as symbol #f) + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) + ) + ) + ) + ) + ) + (case arg1 + (('mech-punch) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "mech-punch-hit")) + ) + (else + (let ((t1-6 (if (using-gun? self) + (static-sound-name "gun-punch-hit") + (static-sound-name "punch-hit") + ) + ) + ) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) t1-6) + ) + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((= v1-37 'flip) + (play-effect-sound (-> self skel effect) arg1 -1.0 38 (the-as basic #f) (static-sound-name "punch-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.1)) + ) + ((= v1-37 'uppercut) + (let ((sv-176 (prims-touching? arg2 (-> self control) (the-as uint 256)))) + (cond + (sv-176 + (part-tracker-spawn + :to self + :group group-punch-hit + :callback (the-as symbol #f) + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) + ) + ) + ((let ((v0-34 (prims-touching? arg2 (-> self control) (the-as uint 128)))) + (set! sv-176 v0-34) + v0-34 + ) + (part-tracker-spawn + :to self + :group group-punch-hit + :callback (the-as symbol #f) + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) ) ) - (logclear! (-> gp-0 0 mask) (process-mask dark-effect)) - (send-event (ppointer->process gp-0) 'color-effect #f 0) - ) - (none) - ) - (process->handle self) - :to s4-0 + ) + ) + (do-effect (-> self skel effect) 'group-uppercut-hit -1.0 22) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "uppercut-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((or (= v1-37 'flop) (= v1-37 'flop-down)) + (do-effect (-> self skel effect) 'group-flop-hit -1.0 22) + (do-effect (-> self skel effect) 'group-flop-hit -1.0 18) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "flop-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((= v1-37 'flut-attack) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "punch-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) + ) + ((= v1-37 'darkjak) + (set-time! (-> self darkjak attack-time)) + (let* ((v1-160 *game-info*) + (a0-102 (+ (-> v1-160 attack-id) 1)) + ) + (set! (-> v1-160 attack-id) a0-102) + (set! (-> self darkjak attack-id) a0-102) + a0-102 + ) + ) ) ) ) - (let ((v1-37 arg1)) - (cond - ((or (= v1-37 'spin) (= v1-37 'spin-air) (= v1-37 'board-spin)) - (set! sv-100 (prims-touching? arg2 (-> self control) (the-as uint 256))) - (cond - (sv-100 - (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-1 - (let ((t9-8 (method-of-type part-tracker activate))) - (t9-8 (the-as part-tracker s4-1) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-4 run-function-in-process) - (s2-1 s4-1) - (s1-1 part-tracker-init) - (s0-1 group-spin-hit) - ) - (set! sv-240 0) - (set! sv-256 (the-as symbol #f)) - (set! sv-272 (the-as symbol #f)) - (set! sv-288 (the-as symbol #f)) - (set! sv-320 *launch-matrix*) - (set! sv-304 (-> sv-320 trans)) - (let ((v1-50 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-100 (-> self control) arg2) quad))) - (set! (-> sv-304 quad) v1-50) - ) - ((the-as (function object object object object object object object object none) s3-4) - s2-1 - s1-1 - s0-1 - sv-240 - sv-256 - sv-272 - sv-288 - sv-320 - ) - ) - (-> s4-1 ppointer) - ) - ) - ) - (else - (do-effect (-> self skel effect) 'group-spin-hit -1.0 38) - ) - ) - (play-effect-sound (-> self skel effect) arg1 -1.0 38 (the-as basic #f) (cond - ((= arg1 'board-spin) - (static-sound-name "board-impact") - ) - ((using-gun? self) - (static-sound-name "gun-spin-hit") - ) - (else - (static-sound-name "spin-hit") - ) - ) - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.2)) - ) - ((or (= v1-37 'punch) (= v1-37 'mech-punch)) - (when arg2 - (set! sv-128 (prims-touching? arg2 (-> self control) (the-as uint 256))) - (cond - (sv-128 - (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-3 - (let ((t9-17 (method-of-type part-tracker activate))) - (t9-17 (the-as part-tracker s4-3) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-6 run-function-in-process) - (s2-3 s4-3) - (s1-3 part-tracker-init) - (s0-3 group-punch-hit) - ) - (set! sv-336 0) - (set! sv-352 (the-as symbol #f)) - (set! sv-368 (the-as symbol #f)) - (set! sv-384 (the-as symbol #f)) - (set! sv-416 *launch-matrix*) - (set! sv-400 (-> sv-416 trans)) - (let ((v1-77 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) quad))) - (set! (-> sv-400 quad) v1-77) - ) - ((the-as (function object object object object object object object object none) s3-6) - s2-3 - s1-3 - s0-3 - sv-336 - sv-352 - sv-368 - sv-384 - sv-416 - ) - ) - (-> s4-3 ppointer) - ) - ) - ) - ((let ((v0-20 (prims-touching? arg2 (-> self control) (the-as uint 128)))) - (set! sv-128 v0-20) - v0-20 - ) - (let ((s4-4 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-4 - (let ((t9-22 (method-of-type part-tracker activate))) - (t9-22 (the-as part-tracker s4-4) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-7 run-function-in-process) - (s2-4 s4-4) - (s1-4 part-tracker-init) - (s0-4 group-punch-hit) - ) - (set! sv-432 0) - (set! sv-448 (the-as symbol #f)) - (set! sv-464 (the-as symbol #f)) - (set! sv-480 (the-as symbol #f)) - (set! sv-512 *launch-matrix*) - (set! sv-496 (-> sv-512 trans)) - (let ((v1-91 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) quad))) - (set! (-> sv-496 quad) v1-91) - ) - ((the-as (function object object object object object object object object none) s3-7) - s2-4 - s1-4 - s0-4 - sv-432 - sv-448 - sv-464 - sv-480 - sv-512 - ) - ) - (-> s4-4 ppointer) - ) - ) - ) - ) - ) - (case arg1 - (('mech-punch) - (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "mech-punch-hit")) - ) - (else - (let ((t1-6 (if (using-gun? self) - (static-sound-name "gun-punch-hit") - (static-sound-name "punch-hit") - ) - ) - ) - (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) t1-6) - ) - ) - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) - ) - ((= v1-37 'flip) - (play-effect-sound (-> self skel effect) arg1 -1.0 38 (the-as basic #f) (static-sound-name "punch-hit")) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.1)) - ) - ((= v1-37 'uppercut) - (set! sv-176 (prims-touching? arg2 (-> self control) (the-as uint 256))) - (cond - (sv-176 - (let ((s4-5 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-5 - (let ((t9-33 (method-of-type part-tracker activate))) - (t9-33 (the-as part-tracker s4-5) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-8 run-function-in-process) - (s2-5 s4-5) - (s1-5 part-tracker-init) - (s0-5 group-punch-hit) - ) - (set! sv-528 0) - (set! sv-544 (the-as symbol #f)) - (set! sv-560 (the-as symbol #f)) - (set! sv-576 (the-as symbol #f)) - (set! sv-608 *launch-matrix*) - (set! sv-592 (-> sv-608 trans)) - (let ((v1-123 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) quad))) - (set! (-> sv-592 quad) v1-123) - ) - ((the-as (function object object object object object object object object none) s3-8) - s2-5 - s1-5 - s0-5 - sv-528 - sv-544 - sv-560 - sv-576 - sv-608 - ) - ) - (-> s4-5 ppointer) - ) - ) - ) - ((let ((v0-34 (prims-touching? arg2 (-> self control) (the-as uint 128)))) - (set! sv-176 v0-34) - v0-34 - ) - (let ((s4-6 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-6 - (let ((t9-38 (method-of-type part-tracker activate))) - (t9-38 (the-as part-tracker s4-6) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-9 run-function-in-process) - (s2-6 s4-6) - (s1-6 part-tracker-init) - (s0-6 group-punch-hit) - ) - (set! sv-624 0) - (set! sv-640 (the-as symbol #f)) - (set! sv-656 (the-as symbol #f)) - (set! sv-672 (the-as symbol #f)) - (set! sv-704 *launch-matrix*) - (set! sv-688 (-> sv-704 trans)) - (let ((v1-137 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) quad))) - (set! (-> sv-688 quad) v1-137) - ) - ((the-as (function object object object object object object object object none) s3-9) - s2-6 - s1-6 - s0-6 - sv-624 - sv-640 - sv-656 - sv-672 - sv-704 - ) - ) - (-> s4-6 ppointer) - ) - ) - ) - ) - (do-effect (-> self skel effect) 'group-uppercut-hit -1.0 22) - (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "uppercut-hit")) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) - ) - ((or (= v1-37 'flop) (= v1-37 'flop-down)) - (do-effect (-> self skel effect) 'group-flop-hit -1.0 22) - (do-effect (-> self skel effect) 'group-flop-hit -1.0 18) - (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "flop-hit")) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) - ) - ((= v1-37 'flut-attack) - (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "punch-hit")) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) - ) - ((= v1-37 'darkjak) - (set-time! (-> self darkjak attack-time)) - (let* ((v1-160 *game-info*) - (a0-102 (+ (-> v1-160 attack-id) 1)) - ) - (set! (-> v1-160 attack-id) a0-102) - (set! (-> self darkjak attack-id) a0-102) - a0-102 - ) - ) - ) - ) + sv-96 ) ) - sv-96 ) (defbehavior target-generic-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) diff --git a/goal_src/jak2/engine/target/target-part.gc b/goal_src/jak2/engine/target/target-part.gc index e4d585b0a5..ab40c46da3 100644 --- a/goal_src/jak2/engine/target/target-part.gc +++ b/goal_src/jak2/engine/target/target-part.gc @@ -100,47 +100,48 @@ ) (defun birth-func-target-orient ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) - (local-vars (v1-10 float) (v1-11 float) (sv-16 target)) + (local-vars (v1-10 float) (v1-11 float)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) ) (init-vf0-vector) - (set! sv-16 *target*) - (when sv-16 - (let ((s3-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (let ((s5-0 (new 'stack-no-clear 'quaternion))) - (let ((s2-0 (-> sv-16 control local-normal))) - (set! (-> s3-0 x) (-> s2-0 z)) - (set! (-> s3-0 y) 0.0) - (set! (-> s3-0 z) (- (-> s2-0 x))) - (vector-normalize! s3-0 1.0) - (quaternion-vector-angle! s5-0 s3-0 (acos (-> s2-0 y))) - ) - (let ((s3-1 (new 'stack-no-clear 'quaternion))) - (quaternion-vector-angle! s3-1 *up-vector* (+ 32768.0 (-> arg1 user-float) (y-angle (-> sv-16 control)))) - (quaternion-normalize! (quaternion*! s5-0 s5-0 s3-1)) - ) - (cond - ((< (-> s5-0 w) 0.0) - (.lvf vf1 (&-> arg2 conerot quad)) - (.lvf vf2 (&-> s5-0 quad)) - (.sub.vf.xyz vf1 vf0 vf2) - (.svf (&-> arg2 conerot quad) vf1) - (.mov v1-10 vf1) - ) - (else - (.lvf vf1 (&-> arg2 conerot quad)) - (.lvf vf2 (&-> s5-0 quad)) - (.add.vf.xyz vf1 vf0 vf2) - (.svf (&-> arg2 conerot quad) vf1) - (.mov v1-11 vf1) + (let ((sv-16 *target*)) + (when sv-16 + (let ((s3-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (let ((s5-0 (new 'stack-no-clear 'quaternion))) + (let ((s2-0 (-> sv-16 control local-normal))) + (set! (-> s3-0 x) (-> s2-0 z)) + (set! (-> s3-0 y) 0.0) + (set! (-> s3-0 z) (- (-> s2-0 x))) + (vector-normalize! s3-0 1.0) + (quaternion-vector-angle! s5-0 s3-0 (acos (-> s2-0 y))) + ) + (let ((s3-1 (new 'stack-no-clear 'quaternion))) + (quaternion-vector-angle! s3-1 *up-vector* (+ 32768.0 (-> arg1 user-float) (y-angle (-> sv-16 control)))) + (quaternion-normalize! (quaternion*! s5-0 s5-0 s3-1)) + ) + (cond + ((< (-> s5-0 w) 0.0) + (.lvf vf1 (&-> arg2 conerot quad)) + (.lvf vf2 (&-> s5-0 quad)) + (.sub.vf.xyz vf1 vf0 vf2) + (.svf (&-> arg2 conerot quad) vf1) + (.mov v1-10 vf1) + ) + (else + (.lvf vf1 (&-> arg2 conerot quad)) + (.lvf vf2 (&-> s5-0 quad)) + (.add.vf.xyz vf1 vf0 vf2) + (.svf (&-> arg2 conerot quad) vf1) + (.mov v1-11 vf1) + ) ) ) ) + 0 ) - 0 ) (none) ) @@ -2448,101 +2449,107 @@ (arg5 int) (arg6 float) ) - (local-vars - (sv-624 (pointer lightning-tracker)) - (sv-640 float) - (sv-656 int) - (sv-672 matrix) - (sv-688 collide-query) - (sv-704 symbol) - (sv-720 vector) - (sv-736 int) - (sv-752 lightning-tracker) - ) - (set! sv-640 arg6) - (let ((s5-0 *lightning-probe-vars*)) - (if (= arg4 256) - (set! sv-656 arg4) - (set! sv-656 (rand-vu-int-range 3 (/ (+ (-> arg0 node-list length) -1) 2))) + (local-vars (sv-656 int)) + (let ((sv-640 arg6) + (s5-0 *lightning-probe-vars*) ) - (set! sv-672 (new 'stack-no-clear 'matrix)) - (set! sv-688 (new 'stack-no-clear 'collide-query)) - (set! sv-704 (the-as symbol #f)) - (when (nonzero? arg4) - (set! sv-656 arg4) - sv-656 - ) - (if (= arg4 256) - (set! (-> sv-688 start-pos quad) (-> arg0 root trans quad)) - (vector<-cspace! (-> sv-688 start-pos) (-> arg0 node-list data sv-656)) - ) - (set! sv-720 (-> sv-688 move-dist)) - (set! (-> sv-720 x) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-720 y) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-720 z) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-720 w) 1.0) - (matrix-rotate-zyx! sv-672 (-> sv-688 move-dist)) - (set! sv-736 6) - (while (nonzero? sv-736) - (set! sv-736 (+ sv-736 -1)) - (vector-rotate*! (-> sv-688 move-dist) (-> s5-0 probe-dirs sv-736) sv-672) - (vector-normalize! (-> sv-688 move-dist) sv-640) - (let ((v1-29 sv-688)) - (set! (-> v1-29 radius) 409.6) - (set! (-> v1-29 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) - (set! (-> v1-29 ignore-process0) arg0) - (set! (-> v1-29 ignore-process1) #f) - (set! (-> v1-29 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-29 action-mask) (collide-action solid)) - ) - (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-688) 0.0) - (set-time! (-> s5-0 last-valid-time)) - (set! (-> s5-0 src-joint-index) (the-as uint sv-656)) - (set! (-> s5-0 end-pos quad) (-> sv-688 best-other-tri intersect quad)) - (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-688 start-pos))) - (set! sv-704 #t) - (goto cfg-15) - ) - ) - ) - (label cfg-15) - (when sv-704 - (set! sv-752 (the-as lightning-tracker (get-process *default-dead-pool* lightning-tracker #x4000))) - (set! sv-624 - (when sv-752 - (let ((t9-11 (method-of-type lightning-tracker activate))) - (t9-11 sv-752 arg0 (symbol->string (-> lightning-tracker symbol)) (the-as pointer #x70004000)) - ) - (run-now-in-process - sv-752 - lightning-tracker-init - arg1 - arg5 - arg2 - arg0 - (if (= arg4 256) - (-> arg0 root trans) - (-> s5-0 src-joint-index) + (set! sv-656 (cond + ((= arg4 256) + (set! sv-656 arg4) + sv-656 ) - (-> s5-0 end-pos) - ) - (-> sv-752 ppointer) + (else + (rand-vu-int-range 3 (/ (+ (-> arg0 node-list length) -1) 2)) + ) + ) + ) + (let ((sv-672 (new 'stack-no-clear 'matrix)) + (sv-688 (new 'stack-no-clear 'collide-query)) + (sv-704 (the-as symbol #f)) + ) + (when (nonzero? arg4) + (set! sv-656 arg4) + sv-656 + ) + (if (= arg4 256) + (set! (-> sv-688 start-pos quad) (-> arg0 root trans quad)) + (vector<-cspace! (-> sv-688 start-pos) (-> arg0 node-list data sv-656)) + ) + (let ((sv-720 (-> sv-688 move-dist))) + (set! (-> sv-720 x) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-720 y) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-720 z) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-720 w) 1.0) + ) + (matrix-rotate-zyx! sv-672 (-> sv-688 move-dist)) + (let ((sv-736 6)) + (while (nonzero? sv-736) + (+! sv-736 -1) + (vector-rotate*! (-> sv-688 move-dist) (-> s5-0 probe-dirs sv-736) sv-672) + (vector-normalize! (-> sv-688 move-dist) sv-640) + (let ((v1-29 sv-688)) + (set! (-> v1-29 radius) 409.6) + (set! (-> v1-29 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) + (set! (-> v1-29 ignore-process0) arg0) + (set! (-> v1-29 ignore-process1) #f) + (set! (-> v1-29 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-29 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-688) 0.0) + (set-time! (-> s5-0 last-valid-time)) + (set! (-> s5-0 src-joint-index) (the-as uint sv-656)) + (set! (-> s5-0 end-pos quad) (-> sv-688 best-other-tri intersect quad)) + (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-688 start-pos))) + (set! sv-704 #t) + (goto cfg-15) ) ) - (when sv-624 - (set! (-> sv-624 0 user-time 0) 0) - (when arg3 - (let ((v1-62 (get-field-spec-by-id arg3 (sp-field-id spt-timer)))) - (if v1-62 - (set! (-> v1-62 initial-valuef) (the-as float (-> sv-624 0 duration))) + ) + ) + (label cfg-15) + (when sv-704 + (let* ((sv-752 (get-process *default-dead-pool* lightning-tracker #x4000)) + (sv-624 (the-as (pointer lightning-tracker) (when sv-752 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-752) + arg0 + (symbol->string (-> lightning-tracker symbol)) + (the-as pointer #x70004000) + ) + (run-now-in-process + sv-752 + lightning-tracker-init + arg1 + arg5 + arg2 + arg0 + (if (= arg4 256) + (-> arg0 root trans) + (-> s5-0 src-joint-index) + ) + (-> s5-0 end-pos) + ) + (-> sv-752 ppointer) + ) + ) + ) + ) + (when sv-624 + (set! (-> sv-624 0 user-time 0) 0) + (when arg3 + (let ((v1-62 (get-field-spec-by-id arg3 (sp-field-id spt-timer)))) + (if v1-62 + (set! (-> v1-62 initial-valuef) (the-as float (-> sv-624 0 duration))) + ) ) - ) - (let ((t9-14 sp-launch-particles-var) - (a0-29 *sp-particle-system-2d*) - (a2-7 *launch-matrix*) + (let ((t9-14 sp-launch-particles-var) + (a0-29 *sp-particle-system-2d*) + (a2-7 *launch-matrix*) + ) + (set! (-> a2-7 trans quad) (-> s5-0 end-pos quad)) + (t9-14 a0-29 arg3 a2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) - (set! (-> a2-7 trans quad) (-> s5-0 end-pos quad)) - (t9-14 a0-29 arg3 a2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -2565,46 +2572,44 @@ (arg3 (function lightning-tracker none)) (arg4 sparticle-launcher) ) - (local-vars (sv-16 int) (sv-64 vector) (sv-68 vector) (sv-72 (pointer lightning-tracker))) (when (and (nonzero? (-> arg0 skel)) (nonzero? (-> arg1 skel))) (let* ((v1-7 (-> arg0 draw lod-set lod (-> arg0 draw lod-set max-lod) geo num-joints)) (s0-0 (-> arg1 draw lod-set lod (-> arg1 draw lod-set max-lod) geo num-joints)) (s1-0 (rand-vu-int-range 3 (+ v1-7 -1))) - ) - (set! sv-16 (rand-vu-int-range 3 (+ s0-0 -1))) - (set! sv-64 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data s1-0))) - (set! sv-68 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg1 node-list data sv-16))) - (let ((s0-1 (the-as lightning-tracker (get-process *default-dead-pool* lightning-tracker #x4000)))) - (set! sv-72 (when s0-1 - (let ((t9-5 (method-of-type lightning-tracker activate))) - (t9-5 s0-1 arg1 (symbol->string (-> lightning-tracker symbol)) (the-as pointer #x70004000)) - ) - (run-now-in-process s0-1 lightning-tracker-init arg2 0 arg3 arg0 s1-0 sv-16) - (-> s0-1 ppointer) + (sv-16 (rand-vu-int-range 3 (+ s0-0 -1))) + (sv-64 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data s1-0))) + (sv-68 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg1 node-list data sv-16))) + (s0-1 (the-as lightning-tracker (get-process *default-dead-pool* lightning-tracker #x4000))) + (sv-72 (when s0-1 + (let ((t9-5 (method-of-type lightning-tracker activate))) + (t9-5 s0-1 arg1 (symbol->string (-> lightning-tracker symbol)) (the-as pointer #x70004000)) ) + (run-now-in-process s0-1 lightning-tracker-init arg2 0 arg3 arg0 s1-0 sv-16) + (-> s0-1 ppointer) + ) + ) + ) + (when (and arg4 sv-72) + (let ((v1-21 (get-field-spec-by-id arg4 (sp-field-id spt-timer)))) + (if v1-21 + (set! (-> v1-21 initial-valuef) (the-as float (-> sv-72 0 duration))) ) - ) - ) - (when (and arg4 sv-72) - (let ((v1-21 (get-field-spec-by-id arg4 (sp-field-id spt-timer)))) - (if v1-21 - (set! (-> v1-21 initial-valuef) (the-as float (-> sv-72 0 duration))) - ) - ) - (let ((t9-8 sp-launch-particles-var) - (a0-20 *sp-particle-system-2d*) - (a1-16 arg4) - (a2-4 *launch-matrix*) - ) - (set! (-> a2-4 trans quad) (-> sv-64 quad)) - (t9-8 a0-20 a1-16 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) - ) - (let ((t9-9 sp-launch-particles-var) - (a0-21 *sp-particle-system-2d*) - (a2-5 *launch-matrix*) - ) - (set! (-> a2-5 trans quad) (-> sv-68 quad)) - (t9-9 a0-21 arg4 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-8 sp-launch-particles-var) + (a0-20 *sp-particle-system-2d*) + (a1-16 arg4) + (a2-4 *launch-matrix*) + ) + (set! (-> a2-4 trans quad) (-> sv-64 quad)) + (t9-8 a0-20 a1-16 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-9 sp-launch-particles-var) + (a0-21 *sp-particle-system-2d*) + (a2-5 *launch-matrix*) + ) + (set! (-> a2-5 trans quad) (-> sv-68 quad)) + (t9-9 a0-21 arg4 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -2643,23 +2648,6 @@ (arg5 int) (arg6 int) ) - (local-vars - (sv-416 int) - (sv-432 vector) - (sv-448 vector) - (sv-464 vector) - (sv-480 quaternion) - (sv-496 vector) - (sv-512 matrix) - (sv-528 vector) - (sv-544 vector) - (sv-560 process) - (sv-576 int) - (sv-592 (function lightning-control int vector none)) - (sv-608 lightning-control) - (sv-624 int) - (sv-640 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -2668,145 +2656,148 @@ (vf7 :class vf) ) (init-vf0-vector) - (let ((s1-0 (-> arg0 draw lod-set lod (-> arg0 draw cur-lod) geo num-joints))) - (set! sv-416 (rand-vu-int-range 4 (+ s1-0 -1))) - (let ((s1-1 (rand-vu-int-range 4 (+ s1-0 -1)))) - (when (!= arg5 -1) - (set! sv-416 arg5) - sv-416 + (let* ((s1-0 (-> arg0 draw lod-set lod (-> arg0 draw cur-lod) geo num-joints)) + (sv-416 (rand-vu-int-range 4 (+ s1-0 -1))) + (s1-1 (rand-vu-int-range 4 (+ s1-0 -1))) + ) + (when (!= arg5 -1) + (set! sv-416 arg5) + sv-416 + ) + (if (!= arg6 -1) + (set! s1-1 arg6) ) - (if (!= arg6 -1) - (set! s1-1 arg6) + (-> arg0 node-list data sv-416) + (let ((s0-1 (-> arg0 node-list data sv-416)) + (a0-9 (-> arg0 node-list data s1-1)) + (v1-18 #t) ) - (-> arg0 node-list data sv-416) - (let ((s0-1 (-> arg0 node-list data sv-416)) - (a0-9 (-> arg0 node-list data s1-1)) - (v1-18 #t) - ) - (until #f - (let ((a1-3 a0-9)) - (until #f - (cond - ((and (-> a1-3 joint) (>= (-> a1-3 joint number) 2)) - (when (= s0-1 a1-3) - #t - (goto cfg-24) - ) - (set! a1-3 (-> a1-3 parent)) + (until #f + (let ((a1-3 a0-9)) + (until #f + (cond + ((and (-> a1-3 joint) (>= (-> a1-3 joint number) 2)) + (when (= s0-1 a1-3) + #t + (goto cfg-24) ) - (else - (set! s0-1 (-> s0-1 parent)) - (when (or (not (-> s0-1 joint)) (< (-> s0-1 joint number) 2)) - (set! v1-18 #f) - (goto cfg-24) - ) - (goto cfg-23) + (set! a1-3 (-> a1-3 parent)) + ) + (else + (set! s0-1 (-> s0-1 parent)) + (when (or (not (-> s0-1 joint)) (< (-> s0-1 joint number) 2)) + (set! v1-18 #f) + (goto cfg-24) ) + (goto cfg-23) ) ) ) - #f - (label cfg-23) ) #f - (label cfg-24) - (when v1-18 - (let ((s5-1 (the-as (array cspace) (new 'stack 'boxed-array cspace 32)))) - (let ((v1-21 0)) - (set! (-> s5-1 length) 0) - (let ((a1-12 (-> arg0 node-list data sv-416)) - (a0-19 (-> arg0 node-list data s1-1)) - ) + (label cfg-23) + ) + #f + (label cfg-24) + (when v1-18 + (let ((s5-1 (the-as (array cspace) (new 'stack 'boxed-array cspace 32)))) + (let ((v1-21 0)) + (set! (-> s5-1 length) 0) + (let ((a1-12 (-> arg0 node-list data sv-416)) + (a0-19 (-> arg0 node-list data s1-1)) + ) + (set! (-> s5-1 (-> s5-1 length)) a1-12) + (+! (-> s5-1 length) 1) + (while (!= a1-12 s0-1) + (set! a1-12 (-> a1-12 parent)) (set! (-> s5-1 (-> s5-1 length)) a1-12) (+! (-> s5-1 length) 1) - (while (!= a1-12 s0-1) - (set! a1-12 (-> a1-12 parent)) - (set! (-> s5-1 (-> s5-1 length)) a1-12) - (+! (-> s5-1 length) 1) - ) - (while (!= a0-19 s0-1) - (set! a0-19 (-> a0-19 parent)) - (+! (-> s5-1 length) 1) - ) ) - (let ((a0-23 (-> arg0 node-list data s1-1))) - (while (!= a0-23 s0-1) - (let ((a1-18 (-> a0-23 parent))) - (+! v1-21 1) - (set! (-> s5-1 (- (-> s5-1 length) v1-21)) a0-23) - (set! a0-23 a1-18) - ) + (while (!= a0-19 s0-1) + (set! a0-19 (-> a0-19 parent)) + (+! (-> s5-1 length) 1) + ) + ) + (let ((a0-23 (-> arg0 node-list data s1-1))) + (while (!= a0-23 s0-1) + (let ((a1-18 (-> a0-23 parent))) + (+! v1-21 1) + (set! (-> s5-1 (- (-> s5-1 length) v1-21)) a0-23) + (set! a0-23 a1-18) ) ) ) - (when (< 2 (-> s5-1 length)) - (let ((s1-2 (new 'stack-no-clear 'vector))) - (set! sv-512 (new 'stack-no-clear 'matrix)) - (let ((s0-2 (new 'stack-no-clear 'vector))) - (set! sv-432 (new 'stack-no-clear 'vector)) - (set! sv-448 (new 'stack-no-clear 'vector)) - (set! sv-464 (new 'stack-no-clear 'vector)) - (set! sv-480 (new 'stack-no-clear 'quaternion)) - (set! sv-496 s1-2) - (set! (-> sv-496 x) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-496 y) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-496 z) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-496 w) 1.0) - (matrix-rotate-zyx! sv-512 s1-2) - (vector-rotate*! sv-448 *up-vector* sv-512) - (vector<-cspace! sv-432 (-> s5-1 0)) - (set! sv-544 s0-2) - (set! sv-528 (vector<-cspace! (new 'stack-no-clear 'vector) (-> s5-1 0))) - (let ((v0-10 (vector<-cspace! (new 'stack-no-clear 'vector) (-> s5-1 1)))) - (.lvf vf4 (&-> sv-528 quad)) - (.lvf vf5 (&-> v0-10 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-544 quad) vf6) - (vector-normalize! s0-2 1.0) - (set! sv-560 (get-process *default-dead-pool* lightning-tracker #x4000)) - (let ((a0-35 (when sv-560 - (let ((t9-13 (method-of-type lightning-tracker activate))) - (t9-13 - (the-as lightning-tracker sv-560) - arg0 - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (run-now-in-process sv-560 lightning-tracker-init arg1 0 arg2 arg0 #f #f) - (-> sv-560 ppointer) - ) + ) + (when (< 2 (-> s5-1 length)) + (let ((s1-2 (new 'stack-no-clear 'vector)) + (sv-512 (new 'stack-no-clear 'matrix)) + (s0-2 (new 'stack-no-clear 'vector)) + (sv-432 (new 'stack-no-clear 'vector)) + (sv-448 (new 'stack-no-clear 'vector)) + (sv-464 (new 'stack-no-clear 'vector)) + (sv-480 (new 'stack-no-clear 'quaternion)) + ) + (let ((sv-496 s1-2)) + (set! (-> sv-496 x) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-496 y) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-496 z) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-496 w) 1.0) + ) + (matrix-rotate-zyx! sv-512 s1-2) + (vector-rotate*! sv-448 *up-vector* sv-512) + (vector<-cspace! sv-432 (-> s5-1 0)) + (let ((sv-544 s0-2)) + (let ((sv-528 (vector<-cspace! (new 'stack-no-clear 'vector) (-> s5-1 0))) + (v0-10 (vector<-cspace! (new 'stack-no-clear 'vector) (-> s5-1 1))) + ) + (.lvf vf4 (&-> sv-528 quad)) + (.lvf vf5 (&-> v0-10 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-544 quad) vf6) + ) + (vector-normalize! s0-2 1.0) + (let* ((sv-560 (get-process *default-dead-pool* lightning-tracker #x4000)) + (a0-35 (when sv-560 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-560) + arg0 + (symbol->string (-> lightning-tracker symbol)) + (the-as pointer #x70004000) ) - ) - (when a0-35 - (set! (-> (the-as lightning-tracker (-> a0-35 0)) user-time 0) 0) - (let ((s4-1 (-> (the-as lightning-tracker (-> a0-35 0)) lightning)) - (s3-1 (new 'stack-no-clear 'vector)) - (s2-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> s4-1 state points-to-draw) 0) - (let ((a1-32 s3-1)) - (let ((v1-46 sv-432)) - (let ((a0-38 sv-448)) - (let ((a2-32 arg4)) - (.mov vf7 a2-32) - ) - (.lvf vf5 (&-> a0-38 quad)) + (run-now-in-process sv-560 lightning-tracker-init arg1 0 arg2 arg0 #f #f) + (-> sv-560 ppointer) ) - (.lvf vf4 (&-> v1-46 quad)) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-32 quad) vf6) + ) + (when a0-35 + (set! (-> (the-as lightning-tracker (-> a0-35 0)) user-time 0) 0) + (let ((s4-1 (-> (the-as lightning-tracker (-> a0-35 0)) lightning)) + (s3-1 (new 'stack-no-clear 'vector)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> s4-1 state points-to-draw) 0) + (let ((a1-32 s3-1)) + (let ((v1-46 sv-432)) + (let ((a0-38 sv-448)) + (let ((a2-32 arg4)) + (.mov vf7 a2-32) + ) + (.lvf vf5 (&-> a0-38 quad)) ) - (set-point! s4-1 (-> s4-1 state points-to-draw) s3-1) - (+! (-> s4-1 state points-to-draw) 1) - (set! sv-576 0) - (while (< sv-576 (+ (-> s5-1 length) -1)) - (set! sv-640 (new 'stack-no-clear 'vector)) + (.lvf vf4 (&-> v1-46 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-32 quad) vf6) + ) + (set-point! s4-1 (-> s4-1 state points-to-draw) s3-1) + (+! (-> s4-1 state points-to-draw) 1) + (let ((sv-576 0)) + (while (< sv-576 (+ (-> s5-1 length) -1)) + (let ((sv-640 (new 'stack-no-clear 'vector))) (vector<-cspace! sv-640 (-> s5-1 (+ sv-576 1))) (vector-! sv-464 sv-640 sv-432) (vector-normalize! sv-464 1.0) @@ -2828,12 +2819,7 @@ (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) (.svf (&-> a1-40 quad) vf6) ) - (set! sv-608 s4-1) - (set! sv-592 (method-of-object sv-608 set-point!)) - (set! sv-624 (-> s4-1 state points-to-draw)) - (let ((a2-38 (vector-average! (new 'stack-no-clear 'vector) s2-1 s3-1))) - (sv-592 sv-608 sv-624 a2-38) - ) + (set-point! s4-1 (-> s4-1 state points-to-draw) (vector-average! (new 'stack-no-clear 'vector) s2-1 s3-1)) (+! (-> s4-1 state points-to-draw) 1) (set-point! s4-1 (-> s4-1 state points-to-draw) s2-1) (+! (-> s4-1 state points-to-draw) 1) @@ -2841,8 +2827,8 @@ (set! (-> s0-2 quad) (-> (the-as (pointer uint128) sv-464) 0)) (set! (-> sv-448 quad) (-> s1-2 quad)) (set! (-> sv-432 quad) (-> sv-640 quad)) - (set! sv-576 (+ sv-576 1)) ) + (+! sv-576 1) ) ) ) diff --git a/goal_src/jak2/engine/target/target-turret.gc b/goal_src/jak2/engine/target/target-turret.gc index 670b4291b0..1b0d9fdefc 100644 --- a/goal_src/jak2/engine/target/target-turret.gc +++ b/goal_src/jak2/engine/target/target-turret.gc @@ -1589,7 +1589,6 @@ ) (defmethod turret-init! ((this base-turret) (arg0 entity-actor) (arg1 matrix)) - (local-vars (sv-16 res-tag)) ;; og:preserve-this changed from 512 (stack-size-set! (-> this main-thread) 1024) (let ((s3-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-others)))) @@ -1649,8 +1648,9 @@ (set! (-> this hud) (the-as handle #f)) (base-turret-method-43 this) (set! (-> this alt-actor) (the-as symbol (entity-actor-lookup (-> this entity) 'alt-actor 0))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-49 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-49 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-49 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-49)) @@ -1721,7 +1721,6 @@ ) (defmethod base-turret-method-41 ((this base-turret) (arg0 vector)) - (local-vars (sv-592 int)) (let* ((s3-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this init-quat))) (s1-0 (-> this root trans)) (s5-0 (new 'stack-no-clear 'vector)) @@ -1731,27 +1730,28 @@ ) (set! (-> s3-0 y) 0.0) (vector-xz-normalize! s3-0 -18432.0) - (set! sv-592 0) - (while (< sv-592 s0-0) - (vector+! s5-0 s1-0 s3-0) - (vector-rotate-y! s3-0 s3-0 f30-0) - (set! (-> s2-0 start-pos quad) (-> s5-0 quad)) - (set-vector! (-> s2-0 move-dist) 0.0 -24576.0 0.0 0.0) - (+! (-> s2-0 start-pos y) 2048.0) - (let ((v1-9 s2-0)) - (set! (-> v1-9 radius) 409.6) - (set! (-> v1-9 collide-with) (collide-spec backgnd)) - (set! (-> v1-9 ignore-process0) this) - (set! (-> v1-9 ignore-process1) #f) - (set! (-> v1-9 ignore-pat) (-> this root pat-ignore-mask)) - (set! (-> v1-9 action-mask) (collide-action solid)) + (let ((sv-592 0)) + (while (< sv-592 s0-0) + (vector+! s5-0 s1-0 s3-0) + (vector-rotate-y! s3-0 s3-0 f30-0) + (set! (-> s2-0 start-pos quad) (-> s5-0 quad)) + (set-vector! (-> s2-0 move-dist) 0.0 -24576.0 0.0 0.0) + (+! (-> s2-0 start-pos y) 2048.0) + (let ((v1-9 s2-0)) + (set! (-> v1-9 radius) 409.6) + (set! (-> v1-9 collide-with) (collide-spec backgnd)) + (set! (-> v1-9 ignore-process0) this) + (set! (-> v1-9 ignore-process1) #f) + (set! (-> v1-9 ignore-pat) (-> this root pat-ignore-mask)) + (set! (-> v1-9 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* s2-0) 0.0) + (set! (-> s5-0 y) (+ 4096.0 (-> s2-0 best-other-tri intersect y))) + (set! (-> arg0 quad) (-> s5-0 quad)) + (return #t) + ) + (+! sv-592 1) ) - (when (>= (fill-and-probe-using-line-sphere *collide-cache* s2-0) 0.0) - (set! (-> s5-0 y) (+ 4096.0 (-> s2-0 best-other-tri intersect y))) - (set! (-> arg0 quad) (-> s5-0 quad)) - (return #t) - ) - (set! sv-592 (+ sv-592 1)) ) ) #f @@ -1807,7 +1807,6 @@ ) (defmethod base-turret-method-45 ((this base-turret) (arg0 object) (arg1 symbol)) - (local-vars (sv-112 vector) (sv-128 vector) (sv-144 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -1830,20 +1829,22 @@ (s1-0 (new 'stack-no-clear 'vector)) (s2-1 (new 'stack-no-clear 'vector)) ) - (set! sv-144 s0-0) - (set! sv-112 s0-0) - (set! sv-128 s5-0) - (let ((f0-2 (+ 20480.0 (base-turret-method-42 this s0-0 s5-0 819200.0)))) - (.lvf vf2 (&-> sv-128 quad)) - (.lvf vf1 (&-> sv-112 quad)) - (let ((v1-25 f0-2)) - (.mov vf3 v1-25) + (let ((sv-144 s0-0)) + (let ((sv-112 s0-0) + (sv-128 s5-0) + (f0-2 (+ 20480.0 (base-turret-method-42 this s0-0 s5-0 819200.0))) + ) + (.lvf vf2 (&-> sv-128 quad)) + (.lvf vf1 (&-> sv-112 quad)) + (let ((v1-25 f0-2)) + (.mov vf3 v1-25) + ) ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-144 quad) vf4) ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-144 quad) vf4) (vector-! s1-0 s0-0 s4-1) (vector-! s2-1 s0-0 s3-1) (vector-normalize! s1-0 1.0) diff --git a/goal_src/jak2/engine/target/target2.gc b/goal_src/jak2/engine/target/target2.gc index bc55bcfa46..7c50b5013c 100644 --- a/goal_src/jak2/engine/target/target2.gc +++ b/goal_src/jak2/engine/target/target2.gc @@ -929,7 +929,7 @@ (target-compute-edge-rider) (compute-alignment! (-> self align)) (when (not (logtest? (-> self align flags) (align-flags disabled))) - (vector-matrix*! s4-0 (the-as vector (-> self align delta)) (-> self control c-R-w)) + (vector-matrix*! s4-0 (-> self align delta trans) (-> self control c-R-w)) (move-by-vector! (-> self control) s4-0) ) (suspend) @@ -970,7 +970,7 @@ (until (ja-done? 0) (compute-alignment! (-> self align)) (when (not (logtest? (-> self align flags) (align-flags disabled))) - (vector-matrix*! gp-0 (the-as vector (-> self align delta)) (-> self control c-R-w)) + (vector-matrix*! gp-0 (-> self align delta trans) (-> self control c-R-w)) (move-by-vector! (-> self control) gp-0) ) (suspend) @@ -1303,63 +1303,65 @@ process (lambda :behavior target ((arg0 vector) (arg1 time-frame) (arg2 float)) - (local-vars (sv-32 time-frame) (sv-40 vector) (sv-44 symbol)) - (set! sv-32 (current-time)) - (let ((v1-2 (new-stack-vector0))) + (let ((sv-32 (current-time)) + (v1-2 (new-stack-vector0)) + ) (set! (-> v1-2 quad) (-> arg0 quad)) - (set! sv-40 v1-2) - ) - (set! sv-44 #t) - (until (time-elapsed? sv-32 arg1) - (let ((s4-0 (ppointer->process (-> self parent)))) - (cond - ((and sv-44 - (< (- (-> (the-as target s4-0) control trans y) (-> (the-as target s4-0) control last-trans-any-surf y)) arg2) - ) - (vector-xz-normalize! (-> (the-as target s4-0) control transv) 0.0) - (when (< (vector-vector-xz-distance (-> (the-as target s4-0) control trans) sv-40) 20480.0) - (let ((v1-15 (vector-! (new-stack-vector0) (-> (the-as target s4-0) control trans) sv-40))) - (set! (-> (the-as target s4-0) control trans x) (+ (-> sv-40 x) (fmax -2867.2 (fmin 2867.2 (-> v1-15 x))))) - (set! (-> (the-as target s4-0) control trans z) (+ (-> sv-40 z) (fmax -2867.2 (fmin 2867.2 (-> v1-15 z))))) - ) - ) - ) - (else - (if sv-44 - (set! sv-32 (current-time)) - ) - (set! sv-44 (the-as symbol #f)) - (when (and (-> (the-as target s4-0) next-state) - (let ((v1-25 (-> (the-as target s4-0) next-state name))) - (or (= v1-25 'target-duck-high-jump-jump) (= v1-25 'target-falling)) - ) - ) - (let ((v1-28 (-> (the-as target s4-0) control trans)) - (s3-0 (-> (the-as target s4-0) control transv)) + (let ((sv-40 v1-2) + (sv-44 #t) + ) + (until (time-elapsed? sv-32 arg1) + (let ((s4-0 (ppointer->process (-> self parent)))) + (cond + ((and sv-44 + (< (- (-> (the-as target s4-0) control trans y) (-> (the-as target s4-0) control last-trans-any-surf y)) arg2) ) - (set! (-> s3-0 x) (- (-> sv-40 x) (-> v1-28 x))) - (set! (-> s3-0 z) (- (-> sv-40 z) (-> v1-28 z))) - (let* ((v1-29 s3-0) - (f30-0 (sqrtf (+ (* (-> v1-29 x) (-> v1-29 x)) (* (-> v1-29 z) (-> v1-29 z))))) - ) - (if (< 122880.0 f30-0) - (vector-xz-normalize! s3-0 122880.0) - ) - (if (< 4096.0 f30-0) - (forward-up-nopitch->quaternion - (-> (the-as target s4-0) control dir-targ) - (vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 1.0) - (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> (the-as target s4-0) control quat)) + (vector-xz-normalize! (-> (the-as target s4-0) control transv) 0.0) + (when (< (vector-vector-xz-distance (-> (the-as target s4-0) control trans) sv-40) 20480.0) + (let ((v1-15 (vector-! (new-stack-vector0) (-> (the-as target s4-0) control trans) sv-40))) + (set! (-> (the-as target s4-0) control trans x) (+ (-> sv-40 x) (fmax -2867.2 (fmin 2867.2 (-> v1-15 x))))) + (set! (-> (the-as target s4-0) control trans z) (+ (-> sv-40 z) (fmax -2867.2 (fmin 2867.2 (-> v1-15 z))))) + ) + ) + ) + (else + (if sv-44 + (set! sv-32 (current-time)) + ) + (set! sv-44 (the-as symbol #f)) + (when (and (-> (the-as target s4-0) next-state) + (let ((v1-25 (-> (the-as target s4-0) next-state name))) + (or (= v1-25 'target-duck-high-jump-jump) (= v1-25 'target-falling)) + ) + ) + (let ((v1-28 (-> (the-as target s4-0) control trans)) + (s3-0 (-> (the-as target s4-0) control transv)) ) + (set! (-> s3-0 x) (- (-> sv-40 x) (-> v1-28 x))) + (set! (-> s3-0 z) (- (-> sv-40 z) (-> v1-28 z))) + (let* ((v1-29 s3-0) + (f30-0 (sqrtf (+ (* (-> v1-29 x) (-> v1-29 x)) (* (-> v1-29 z) (-> v1-29 z))))) + ) + (if (< 122880.0 f30-0) + (vector-xz-normalize! s3-0 122880.0) + ) + (if (< 4096.0 f30-0) + (forward-up-nopitch->quaternion + (-> (the-as target s4-0) control dir-targ) + (vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 1.0) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> (the-as target s4-0) control quat)) + ) + ) ) + ) ) ) ) ) + (suspend) + 0 ) ) - (suspend) - 0 ) (none) ) diff --git a/goal_src/jak2/engine/ui/bigmap.gc b/goal_src/jak2/engine/ui/bigmap.gc index 6d37a50d51..bfe34cb051 100644 --- a/goal_src/jak2/engine/ui/bigmap.gc +++ b/goal_src/jak2/engine/ui/bigmap.gc @@ -306,14 +306,14 @@ (defmethod texture-upload-dma ((this bigmap) (arg0 dma-buffer) (arg1 (pointer uint32)) (arg2 int) (arg3 int) (arg4 int) (arg5 gs-psm)) "Add a texture upload to the DMA buffer." - (local-vars (sv-16 int)) - (set! sv-16 arg2) - (dma-buffer-add-gs-set arg0 - (bitbltbuf (new 'static 'gs-bitbltbuf :dpsm (the-as int arg5) :dbp sv-16 :dbw (/ arg3 64))) - (trxpos (new 'static 'gs-trxpos)) - (trxreg (new 'static 'gs-trxreg :rrw arg3 :rrh arg4)) - (trxdir (new 'static 'gs-trxdir)) - ) + (let ((sv-16 arg2)) + (dma-buffer-add-gs-set arg0 + (bitbltbuf (new 'static 'gs-bitbltbuf :dpsm (the-as int arg5) :dbp sv-16 :dbw (/ arg3 64))) + (trxpos (new 'static 'gs-trxpos)) + (trxreg (new 'static 'gs-trxreg :rrw arg3 :rrh arg4)) + (trxdir (new 'static 'gs-trxdir)) + ) + ) (dma-buffer-add-ref-texture arg0 arg1 arg3 arg4 arg5) 0 (none) @@ -443,12 +443,7 @@ (init-vf0-vector) (cond ((= (-> arg1 position) #t) - (let* ((s3-0 (handle->process (-> arg1 handle))) - (v1-4 (if (type? s3-0 process-drawable) - (the-as process-drawable s3-0) - ) - ) - ) + (let ((v1-4 (as-type (handle->process (-> arg1 handle)) process-drawable))) (if (and v1-4 (nonzero? (-> v1-4 root))) (set! (-> arg1 last-world-pos quad) (-> v1-4 root trans quad)) ) @@ -458,13 +453,12 @@ (= (-> (the-as basic (-> arg1 position)) type) entity-actor) ) (let* ((v1-14 (the-as entity-actor (-> arg1 position))) - (s3-1 (if v1-14 - (-> v1-14 extra process) - ) - ) - (a0-13 (if (type? s3-1 process-drawable) - (the-as process-drawable s3-1) - ) + (a0-13 (as-type + (if v1-14 + (-> v1-14 extra process) + ) + process-drawable + ) ) ) (if a0-13 @@ -504,8 +498,8 @@ (let ((f1-2 (* 20.0 f1-0 f0-0)) (f0-1 (* 20.0 f0-0)) ) - (set! (-> a0-23 x) (the float (the int (- (-> a2-1 x) (* 0.5 f1-2))))) - (set! (-> a0-23 y) (the float (the int (- (-> a2-1 y) (* 0.5 f0-1))))) + (set! (-> a0-23 x) (the float (the int (- (-> a2-1 x) (/ f1-2 2))))) + (set! (-> a0-23 y) (the float (the int (- (-> a2-1 y) (/ f0-1 2))))) (set! (-> v1-21 x) (+ (-> a0-23 x) f1-2)) (set! (-> v1-21 y) (+ (-> a0-23 y) f0-1)) ) @@ -648,14 +642,12 @@ ) ) (else - (let* ((f0-1 (* 131072.0 (-> this offset w))) - (f30-0 (* f0-1 f0-1)) + (let* ((f30-0 (square (* 131072.0 (-> this offset w)))) (s4-2 (the int (* 131072.0 (-> this offset w)))) (s5-2 (- s4-2)) ) (while (>= s4-2 s5-2) - (let* ((f0-7 (the float s5-2)) - (s2-0 (the int (sqrtf (- f30-0 (* f0-7 f0-7))))) + (let* ((s2-0 (the int (sqrtf (- f30-0 (square (the float s5-2)))))) (s3-1 (- s2-0)) ) (while (>= s2-0 s3-1) @@ -684,7 +676,6 @@ ) (defmethod draw ((this bigmap) (arg0 int) (arg1 int) (arg2 int) (arg3 int)) - (local-vars (sv-96 pointer) (sv-100 texture) (sv-104 matrix) (sv-112 int)) (when (and (= (file-status (-> this bigmap-image) "world-map" (the-as int (-> this load-index))) 'active) (not (-> this loading-flag)) ) @@ -759,80 +750,75 @@ (vector-xz-normalize! s3-3 -1.0) (set! (-> s3-3 y) 0.0) (set! (-> s3-3 w) 0.0) - (set! sv-96 (-> s4-2 base)) - (set! sv-100 (get-texture map-target-marker common)) - (set! sv-104 (new 'stack-no-clear 'matrix)) - (set! sv-112 (the int (* 56.0 f30-0))) - (when sv-100 - (set-pos! this (target-pos 0)) - (if (-> *blit-displays-work* horizontal-flip-flag) - (set! f30-0 (- f30-0)) + (let ((sv-96 (-> s4-2 base)) + (sv-100 (get-texture map-target-marker common)) + (sv-104 (new 'stack-no-clear 'matrix)) ) - (set-vector! (-> (the-as matrix sv-104) vector 0) (* (-> s3-3 z) f30-0) 0.0 (- (-> s3-3 x)) 0.0) - (set-vector! (-> (the-as matrix sv-104) vector 1) 0.0 1.0 0.0 0.0) - (set-vector! (-> (the-as matrix sv-104) vector 2) (* (-> s3-3 x) f30-0) 0.0 (-> s3-3 z) 1.0) - (set-vector! - (-> (the-as matrix sv-104) trans) - (+ (the float (-> this x0)) (* 2.0 f30-0 (the float (-> this pos x)))) - 0.0 - (- (the float (+ (* (-> this pos y) 2) 1840)) (-> this scroll y)) - 1.0 + (let ((sv-112 (the int (* 56.0 f30-0)))) ) - (set-vector! (-> this corner 0) 0.0 0.0 -7.0 1.0) - (set-vector! (-> this corner 1) 7.0 0.0 0.0 1.0) - (set-vector! (-> this corner 2) -7.0 0.0 0.0 1.0) - (set-vector! (-> this corner 3) 0.0 0.0 7.0 1.0) - (vector-matrix*! (the-as vector (-> this corner)) (the-as vector (-> this corner)) sv-104) - (vector-matrix*! (-> this corner 1) (-> this corner 1) sv-104) - (vector-matrix*! (-> this corner 2) (-> this corner 2) sv-104) - (vector-matrix*! (-> this corner 3) (-> this corner 3) sv-104) - (let ((v1-101 (-> this adgif-tmpl dma-vif quad))) - (set! (-> (the-as (pointer uint128) sv-96)) v1-101) + (when sv-100 + (set-pos! this (target-pos 0)) + (if (-> *blit-displays-work* horizontal-flip-flag) + (set! f30-0 (- f30-0)) + ) + (set-vector! (-> (the-as matrix sv-104) vector 0) (* (-> s3-3 z) f30-0) 0.0 (- (-> s3-3 x)) 0.0) + (set-vector! (-> (the-as matrix sv-104) vector 1) 0.0 1.0 0.0 0.0) + (set-vector! (-> (the-as matrix sv-104) vector 2) (* (-> s3-3 x) f30-0) 0.0 (-> s3-3 z) 1.0) + (set-vector! + (-> (the-as matrix sv-104) trans) + (+ (the float (-> this x0)) (* 2.0 f30-0 (the float (-> this pos x)))) + 0.0 + (- (the float (+ (* (-> this pos y) 2) 1840)) (-> this scroll y)) + 1.0 + ) + (set-vector! (-> this corner 0) 0.0 0.0 -7.0 1.0) + (set-vector! (-> this corner 1) 7.0 0.0 0.0 1.0) + (set-vector! (-> this corner 2) -7.0 0.0 0.0 1.0) + (set-vector! (-> this corner 3) 0.0 0.0 7.0 1.0) + (vector-matrix*! (-> this corner 0) (-> this corner 0) sv-104) + (vector-matrix*! (-> this corner 1) (-> this corner 1) sv-104) + (vector-matrix*! (-> this corner 2) (-> this corner 2) sv-104) + (vector-matrix*! (-> this corner 3) (-> this corner 3) sv-104) + (set! (-> (the-as (pointer uint128) sv-96)) (-> this adgif-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) sv-96) 1) (-> this adgif-tmpl quad 1)) + (adgif-shader<-texture-simple! (the-as adgif-shader (&+ sv-96 32)) sv-100) + (set! (-> (the-as (pointer uint128) sv-96) 7) (-> this draw-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) sv-96) 8) (-> this draw-tmpl quad 1)) + (set-vector! (the-as vector4w (&+ sv-96 144)) 0 255 255 128) + (set-vector! (the-as vector4w (&+ sv-96 160)) 0 0 0 0) + (set-vector! + (the-as vector4w (&+ sv-96 176)) + (the int (* 16.0 (-> this corner 0 x))) + (the int (* 16.0 (-> this corner 0 z))) + #xffffff + 0 + ) + (set-vector! (the-as vector4w (&+ sv-96 192)) 256 0 0 0) + (set-vector! + (the-as vector4w (&+ sv-96 208)) + (the int (* 16.0 (-> this corner 1 x))) + (the int (* 16.0 (-> this corner 1 z))) + #xffffff + 0 + ) + (set-vector! (the-as vector4w (&+ sv-96 224)) 0 256 0 0) + (set-vector! + (the-as vector4w (&+ sv-96 240)) + (the int (* 16.0 (-> this corner 2 x))) + (the int (* 16.0 (-> this corner 2 z))) + #xffffff + 0 + ) + (set-vector! (the-as vector4w (&+ sv-96 256)) 256 256 0 0) + (set-vector! + (the-as vector4w (&+ sv-96 272)) + (the int (* 16.0 (-> this corner 3 x))) + (the int (* 16.0 (-> this corner 3 z))) + #xffffff + 0 + ) + (&+! (-> s4-2 base) 288) ) - (let ((v1-102 (-> this adgif-tmpl quad 1))) - (set! (-> (the-as (pointer uint128) sv-96) 1) v1-102) - ) - (adgif-shader<-texture-simple! (the-as adgif-shader (&+ sv-96 32)) sv-100) - (let ((v1-104 (-> this draw-tmpl dma-vif quad))) - (set! (-> (the-as (pointer uint128) sv-96) 7) v1-104) - ) - (let ((v1-105 (-> this draw-tmpl quad 1))) - (set! (-> (the-as (pointer uint128) sv-96) 8) v1-105) - ) - (set-vector! (the-as vector4w (&+ sv-96 144)) 0 255 255 128) - (set-vector! (the-as vector4w (&+ sv-96 160)) 0 0 0 0) - (set-vector! - (the-as vector4w (&+ sv-96 176)) - (the int (* 16.0 (-> this corner 0 x))) - (the int (* 16.0 (-> this corner 0 z))) - #xffffff - 0 - ) - (set-vector! (the-as vector4w (&+ sv-96 192)) 256 0 0 0) - (set-vector! - (the-as vector4w (&+ sv-96 208)) - (the int (* 16.0 (-> this corner 1 x))) - (the int (* 16.0 (-> this corner 1 z))) - #xffffff - 0 - ) - (set-vector! (the-as vector4w (&+ sv-96 224)) 0 256 0 0) - (set-vector! - (the-as vector4w (&+ sv-96 240)) - (the int (* 16.0 (-> this corner 2 x))) - (the int (* 16.0 (-> this corner 2 z))) - #xffffff - 0 - ) - (set-vector! (the-as vector4w (&+ sv-96 256)) 256 256 0 0) - (set-vector! - (the-as vector4w (&+ sv-96 272)) - (the int (* 16.0 (-> this corner 3 x))) - (the int (* 16.0 (-> this corner 3 z))) - #xffffff - 0 - ) - (&+! (-> s4-2 base) 288) ) ) ) diff --git a/goal_src/jak2/engine/ui/hud-classes.gc b/goal_src/jak2/engine/ui/hud-classes.gc index 80e683fb81..bc37eb2e7e 100644 --- a/goal_src/jak2/engine/ui/hud-classes.gc +++ b/goal_src/jak2/engine/ui/hud-classes.gc @@ -13,7 +13,7 @@ (the int (+ 492.0 (* 140.0 (-> this offset)))) (the int (+ 281.0 (* 140.0 (-> this offset)))) ) - (set-as-offset-from! (the-as hud-sprite (-> this sprites)) (the-as vector4w (-> this sprites 1)) 11 -11) + (set-as-offset-from! (-> this sprites 0) (-> this sprites 1 pos) 11 -11) (set! (-> this sprites 0 color w) (the int (+ 70.0 (* 70.0 (sin (* 182.04445 (the float (-> this values 1 current))))))) ) @@ -39,8 +39,8 @@ (with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id progress) ) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites 1)) 2 -3) - (draw-1 *minimap* s4-0 (the-as vector4w (-> this sprites 2)) #t) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 1 pos) 2 -3) + (draw-1 *minimap* s4-0 (-> this sprites 2 pos) #t) ) ) ((zero? (-> *setting-control* user-current race-minimap)) @@ -56,8 +56,8 @@ (with-dma-buffer-add-bucket ((s4-2 (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id progress) ) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites 1)) 10 -15) - (draw-sprite2 *minimap* s4-2 (the-as vector4w (-> this sprites 2)) #t) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 1 pos) 10 -15) + (draw-sprite2 *minimap* s4-2 (-> this sprites 2 pos) #t) ) ) ) @@ -75,8 +75,8 @@ (with-dma-buffer-add-bucket ((s4-4 (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id progress) ) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites 1)) 20 -8) - (draw-sprite2 *minimap* s4-4 (the-as vector4w (-> this sprites 2)) #t) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 1 pos) 20 -8) + (draw-sprite2 *minimap* s4-4 (-> this sprites 2 pos) #t) ) ) ) @@ -94,8 +94,8 @@ (with-dma-buffer-add-bucket ((s4-6 (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id progress) ) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites 1)) 10 -8) - (draw-sprite2 *minimap* s4-6 (the-as vector4w (-> this sprites 2)) #t) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 1 pos) 10 -8) + (draw-sprite2 *minimap* s4-6 (-> this sprites 2 pos) #t) ) ) ) @@ -166,26 +166,26 @@ ) (the int (+ 306.0 (* 130.0 (-> this offset)))) ) - (set-as-offset-from! (-> this sprites 9) (the-as vector4w (-> this sprites 8)) 40 0) - (set-as-offset-from! (-> this sprites 10) (the-as vector4w (-> this sprites 8)) 0 40) - (set-as-offset-from! (-> this sprites 11) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 12) (the-as vector4w (-> this sprites 8)) 2 32) - (set-as-offset-from! (-> this sprites 13) (the-as vector4w (-> this sprites 8)) 7 60) - (set-as-offset-from! (-> this sprites 14) (the-as vector4w (-> this sprites 8)) 40 60) - (set-as-offset-from! (-> this sprites 15) (the-as vector4w (-> this sprites 8)) 63 32) - (set-as-offset-from! (-> this sprites 16) (the-as vector4w (-> this sprites 8)) 63 16) - (set-as-offset-from! (-> this sprites 17) (the-as vector4w (-> this sprites 8)) 41 4) - (set-as-offset-from! (-> this sprites 18) (the-as vector4w (-> this sprites 8)) 6 4) - (set-as-offset-from! (-> this sprites 19) (the-as vector4w (-> this sprites 8)) 2 17) - (set-as-offset-from! (the-as hud-sprite (-> this sprites)) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 3) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 4) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 5) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 6) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 7) (the-as vector4w (-> this sprites 8)) 40 40) - (set-as-offset-from! (-> this sprites 21) (the-as vector4w (-> this sprites 8)) 25 25) + (set-as-offset-from! (-> this sprites 9) (-> this sprites 8 pos) 40 0) + (set-as-offset-from! (-> this sprites 10) (-> this sprites 8 pos) 0 40) + (set-as-offset-from! (-> this sprites 11) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 12) (-> this sprites 8 pos) 2 32) + (set-as-offset-from! (-> this sprites 13) (-> this sprites 8 pos) 7 60) + (set-as-offset-from! (-> this sprites 14) (-> this sprites 8 pos) 40 60) + (set-as-offset-from! (-> this sprites 15) (-> this sprites 8 pos) 63 32) + (set-as-offset-from! (-> this sprites 16) (-> this sprites 8 pos) 63 16) + (set-as-offset-from! (-> this sprites 17) (-> this sprites 8 pos) 41 4) + (set-as-offset-from! (-> this sprites 18) (-> this sprites 8 pos) 6 4) + (set-as-offset-from! (-> this sprites 19) (-> this sprites 8 pos) 2 17) + (set-as-offset-from! (-> this sprites 0) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 3) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 4) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 5) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 6) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 7) (-> this sprites 8 pos) 40 40) + (set-as-offset-from! (-> this sprites 21) (-> this sprites 8 pos) 25 25) (let ((v1-12 (+ (the int (* 127.0 (sin (* 182.04445 (the float (* (-> *display* game-clock frame-counter) 2)))))) 127) ) @@ -345,7 +345,7 @@ (set! f30-0 (-> (the-as hud-health v1-0) offset)) ) (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) + (-> this sprites 0) (if (= (-> *setting-control* user-default aspect-ratio) 'aspect4x3) (the int (+ 13.0 (* -130.0 f30-0))) (the int (+ 25.0 (* -130.0 f30-0))) @@ -356,7 +356,7 @@ ((or (= (-> this values 2 target) 100) (= (-> *target* game eco-pill-dark) 100.0)) (set! (-> this sprites 0 tex) (get-texture hud-darkjak-head-01 level-default-minimap)) (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) + (-> this sprites 0) (if (= (-> *setting-control* user-default aspect-ratio) 'aspect4x3) (the int (+ 13.0 (* -130.0 f30-0))) (the int (+ 25.0 (* -130.0 f30-0))) @@ -377,7 +377,7 @@ (else (set! (-> this sprites 0 tex) (get-texture hud-jak-head-01 level-default-minimap)) (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) + (-> this sprites 0) (if (= (-> *setting-control* user-default aspect-ratio) 'aspect4x3) (the int (+ 29.0 (* -130.0 f30-0))) (the int (+ 36.0 (* -130.0 f30-0))) @@ -437,7 +437,7 @@ 150 ) (set-as-offset-from! - (the-as hud-sprite (-> this sprites)) + (-> this sprites 0) (the-as vector4w (-> this icons 0 pos)) (if (= (-> *setting-control* user-default aspect-ratio) 'aspect4x3) -27 @@ -489,7 +489,7 @@ 270 ) (set-as-offset-from! - (the-as hud-sprite (-> this sprites)) + (-> this sprites 0) (the-as vector4w (-> this icons 0 pos)) (if (= (-> *setting-control* user-default aspect-ratio) 'aspect4x3) -19 @@ -555,13 +555,9 @@ ) (defmethod draw ((this hud-score)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 480.0 (* 130.0 (-> this offset)))) - 140 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 480.0 (* 130.0 (-> this offset)))) 140) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -12 8) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -12 8) ((method-of-type hud draw) this) 0 (none) @@ -591,11 +587,7 @@ ) (defmethod draw ((this hud-timer)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - 264 - (the int (+ 50.0 (* -100.0 (-> this offset)))) - ) + (set-hud-piece-position! (-> this sprites 0) 264 (the int (+ 50.0 (* -100.0 (-> this offset))))) (format (clear (-> this strings 0 text)) "~1,'0D" (/ (-> this values 0 current) 10)) (format (clear (-> this strings 1 text)) "~1,'0D" (mod (-> this values 0 current) 10)) (format (clear (-> this strings 2 text)) ":") @@ -604,20 +596,15 @@ (let ((s5-5 20) (s4-0 -42) ) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) s4-0 -24) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) s4-0 -24) (let ((s4-1 (+ s4-0 s5-5))) - (set-as-offset-from! (the-as hud-sprite (-> this strings 1 pos)) (the-as vector4w (-> this sprites)) s4-1 -24) + (set-as-offset-from! (the-as hud-sprite (-> this strings 1 pos)) (-> this sprites 0 pos) s4-1 -24) (let ((s4-2 (+ s4-1 16))) - (set-as-offset-from! (the-as hud-sprite (-> this strings 2 pos)) (the-as vector4w (-> this sprites)) s4-2 -24) + (set-as-offset-from! (the-as hud-sprite (-> this strings 2 pos)) (-> this sprites 0 pos) s4-2 -24) (let ((s4-3 (+ s4-2 16))) - (set-as-offset-from! (the-as hud-sprite (-> this strings 3 pos)) (the-as vector4w (-> this sprites)) s4-3 -24) + (set-as-offset-from! (the-as hud-sprite (-> this strings 3 pos)) (-> this sprites 0 pos) s4-3 -24) (let ((a2-13 (+ s4-3 s5-5))) - (set-as-offset-from! - (the-as hud-sprite (-> this strings 4 pos)) - (the-as vector4w (-> this sprites)) - a2-13 - -24 - ) + (set-as-offset-from! (the-as hud-sprite (-> this strings 4 pos)) (-> this sprites 0 pos) a2-13 -24) ) ) ) @@ -667,13 +654,9 @@ ) (defmethod draw ((this hud-big-score)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - 264 - (the int (+ 50.0 (* -100.0 (-> this offset)))) - ) + (set-hud-piece-position! (-> this sprites 0) 264 (the int (+ 50.0 (* -100.0 (-> this offset))))) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -7 -24) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -7 -24) ((method-of-type hud draw) this) 0 (none) @@ -704,14 +687,10 @@ ) (defmethod draw ((this hud-goal)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 65.0 (* -130.0 (-> this offset)))) - 70 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 65.0 (* -130.0 (-> this offset)))) 70) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) 0 -8) - (set-as-offset-from! (the-as hud-sprite (-> this strings 1 pos)) (the-as vector4w (-> this sprites)) 0 -40) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) 0 -8) + (set-as-offset-from! (the-as hud-sprite (-> this strings 1 pos)) (-> this sprites 0 pos) 0 -40) ((method-of-type hud draw) this) 0 (none) @@ -752,11 +731,7 @@ ) (defmethod draw ((this hud-miss)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 448.0 (* 130.0 (-> this offset)))) - 70 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 448.0 (* 130.0 (-> this offset)))) 70) (format (clear (-> this strings 0 text)) "~D/~D" (-> this values 0 current) (-> this values 1 current)) (let ((s5-1 format) (s4-0 (clear (-> this strings 1 text))) @@ -765,8 +740,8 @@ (format (clear *temp-string*) (lookup-text! *common-text* (text-id miss) #f)) (s5-1 s4-0 s3-0 *temp-string*) ) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) 0 -8) - (set-as-offset-from! (the-as hud-sprite (-> this strings 1 pos)) (the-as vector4w (-> this sprites)) 0 -40) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) 0 -8) + (set-as-offset-from! (the-as hud-sprite (-> this strings 1 pos)) (-> this sprites 0 pos) 0 -40) ((method-of-type hud draw) this) 0 (none) @@ -811,13 +786,13 @@ (seek! (-> this sprites 2 scale-y) f0-0 (* 2.0 (-> pp clock time-adjust-ratio))) ) (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) + (-> this sprites 0) 256 (the int (+ (* -100.0 (-> this offset)) (-> this sprites 2 scale-y))) ) (set-as-offset-from! (-> this sprites 1) - (the-as vector4w (-> this sprites)) + (-> this sprites 0 pos) (+ (the int (* 0.09 (the float (-> this values 0 current)))) -42) 0 ) @@ -858,7 +833,7 @@ ) (defmethod draw ((this hud-gun)) - (local-vars (s3-0 int) (sv-16 int) (sv-32 dma-buffer)) + (local-vars (s3-0 int)) (let ((s4-0 0) (s5-0 0) ) @@ -912,7 +887,7 @@ (set! s3-0 (* s3-0 2)) ) (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) + (-> this sprites 0) (- (the int (+ 507.0 (* 130.0 (-> this offset)))) s4-0) (the int (+ (- 25.0 (the float s5-0)) (* -100.0 (-> this offset)))) ) @@ -921,47 +896,49 @@ ((zero? (-> this values 0 current)) (set! f30-0 0.0) (set! (-> this strings 0 pos 0) 0) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites)) -3 0) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) -3 0) ) (else - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites)) -4 11) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) -4 11) (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) - (the-as vector4w (-> this sprites)) + (-> this sprites 0 pos) (+ s4-0 -70) (+ s5-0 18) ) - (set-as-offset-from! (-> this sprites 6) (the-as vector4w (-> this sprites)) (+ s4-0 -68) (+ (if (= s2-0 20) - 98 - 73 - ) - s5-0 - ) + (set-as-offset-from! (-> this sprites 6) (-> this sprites 0 pos) (+ s4-0 -68) (+ (if (= s2-0 20) + 98 + 73 + ) + s5-0 + ) ) (set! (-> this sprites 6 scale-x) 1.0) (let ((s0-0 (mod (-> this values 1 current) s2-0))) (if (and (zero? s0-0) (nonzero? (-> this values 1 current))) (set! s0-0 s2-0) ) - (set! sv-32 (-> *display* frames (-> *display* on-screen) global-buf)) - (let ((s1-0 (-> sv-32 base))) - (set! sv-16 0) - (while (< sv-16 s2-0) - (if (= sv-16 s0-0) - (set! (-> this sprites 6 tex) (get-texture hud-gun-empty-shell-01 level-default-minimap)) - ) - (draw (-> this sprites 6) sv-32 (-> this level)) - (+! (-> this sprites 6 pos y) -5) - (if (= sv-16 (+ (/ s2-0 2) -1)) - (set-as-offset-from! (-> this sprites 6) (the-as vector4w (-> this sprites)) (+ s4-0 -83) (+ (if (= s2-0 20) - 98 - 73 - ) - s5-0 - ) - ) - ) - (set! sv-16 (+ sv-16 1)) + (let* ((sv-32 (-> *display* frames (-> *display* on-screen) global-buf)) + (s1-0 (-> sv-32 base)) + ) + (let ((sv-16 0)) + (while (< sv-16 s2-0) + (if (= sv-16 s0-0) + (set! (-> this sprites 6 tex) (get-texture hud-gun-empty-shell-01 level-default-minimap)) + ) + (draw (-> this sprites 6) sv-32 (-> this level)) + (+! (-> this sprites 6 pos y) -5) + (if (= sv-16 (+ (/ s2-0 2) -1)) + (set-as-offset-from! (-> this sprites 6) (-> this sprites 0 pos) (+ s4-0 -83) (+ (if (= s2-0 20) + 98 + 73 + ) + s5-0 + ) + ) + ) + (+! sv-16 1) + ) ) (let ((a3-5 (-> sv-32 base))) (let ((v1-67 (the-as dma-packet (-> sv-32 base)))) @@ -1032,10 +1009,10 @@ ) ) (format (clear (-> this strings 0 text)) "~D/~D" (-> this values 1 current) s3-0) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites)) (+ s4-0 -110) (+ s5-0 18)) - (set-as-offset-from! (-> this sprites 3) (the-as vector4w (-> this sprites)) (+ s4-0 -36) (+ s5-0 19)) - (set-as-offset-from! (-> this sprites 4) (the-as vector4w (-> this sprites)) (+ s4-0 -78) (+ s5-0 7)) - (set-as-offset-from! (-> this sprites 5) (the-as vector4w (-> this sprites)) (+ s4-0 -78) (+ s5-0 37)) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 0 pos) (+ s4-0 -110) (+ s5-0 18)) + (set-as-offset-from! (-> this sprites 3) (-> this sprites 0 pos) (+ s4-0 -36) (+ s5-0 19)) + (set-as-offset-from! (-> this sprites 4) (-> this sprites 0 pos) (+ s4-0 -78) (+ s5-0 7)) + (set-as-offset-from! (-> this sprites 5) (-> this sprites 0 pos) (+ s4-0 -78) (+ s5-0 37)) ) ((method-of-type hud draw) this) 0 @@ -1085,9 +1062,9 @@ (the int (+ 30.0 (* -100.0 (-> this offset)))) ) (set! (-> this sprites 0 angle) (* 182.04445 (the float (- 270 (/ (* 90 (-> this values 0 current)) 100))))) - (set-as-offset-from! (the-as hud-sprite (-> this sprites)) (the-as vector4w (-> this sprites 2)) 40 16) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites 2)) 1 16) - (set-as-offset-from! (-> this sprites 3) (the-as vector4w (-> this sprites 2)) 7 5) + (set-as-offset-from! (-> this sprites 0) (-> this sprites 2 pos) 40 16) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 2 pos) 1 16) + (set-as-offset-from! (-> this sprites 3) (-> this sprites 2 pos) 7 5) ((method-of-type hud draw) this) 0 (none) diff --git a/goal_src/jak2/engine/util/profile.gc b/goal_src/jak2/engine/util/profile.gc index a6e30e40bc..6815e5e8b7 100644 --- a/goal_src/jak2/engine/util/profile.gc +++ b/goal_src/jak2/engine/util/profile.gc @@ -10,6 +10,7 @@ ;; DMA templates for profile drawing (deftype profile-work (structure) + "DMA templates for profile drawing." ((sprite-tmpl dma-gif-packet :inline) (line-tmpl dma-gif-packet :inline) (last-index int32) @@ -62,7 +63,7 @@ (define *profile-ticks* #f) (defmethod start-frame! ((this profile-segment-array)) - "Start a frame." + "Restart the profiler for the start of a frame." (set! (-> this count) 0) (set! (-> this depth) 0) (set! (-> this max-depth) 0) @@ -73,7 +74,7 @@ ) (defmethod start-segment! ((this profile-segment-array) (arg0 symbol) (arg1 rgba)) - "Push a new segment onto the profiling stack." + "Start an event." (when (and *dproc* *debug-segment*) (let ((s4-0 (-> this data (-> this count)))) (let ((s3-0 (-> this base-time))) @@ -93,7 +94,7 @@ ) (defmethod end-segment! ((this profile-segment-array)) - "Pop the last pushed segment." + "Stop the most recently started event." (when (and *dproc* *debug-segment*) (let* ((v1-4 (+ (-> this depth) -1)) (s5-0 (-> this segment v1-4)) @@ -383,8 +384,7 @@ ) (defmethod postprocess-data! ((this profile-array)) - "Summarize data collected." - + "Create the collapsed summary of the collected data." ;; loop over both EE and VU profilers (dotimes (s5-0 2) ;; each of the two display-frames has its own profile-array @@ -393,8 +393,7 @@ (let ((s3-0 (-> *profile-array* data s5-0)) (s4-0 *profile-collapse*) ) - (mem-copy! (&-> s3-0 type) (&-> (-> this data s5-0) type) 8240) - + (mem-copy! (&-> s3-0 type) (&-> this data s5-0 type) 8240) (cond ((zero? s5-0) ;; we're the EE profiler. @@ -552,8 +551,7 @@ ) (defmethod draw-bars! ((this profile-array) (arg0 dma-buffer) (arg1 int)) - "Draw the two bars at the top." - (local-vars (sv-16 (function _varargs_ object)) (sv-32 (function _varargs_ object))) + "Generate DMA data for drawing the profile bars." (dma-buffer-add-gs-set arg0 (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)) (zbuf-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24) :zmsk #x1)) @@ -631,12 +629,7 @@ (cond (*profile-ticks* (let ((s0-0 draw-string-xy)) - (set! sv-16 format) - (let ((a0-16 (clear *temp-string*)) - (a1-37 "~5D") - ) - (sv-16 a0-16 a1-37 s1-0) - ) + (format (clear *temp-string*) "~5D" s1-0) (s0-0 *temp-string* arg0 @@ -682,12 +675,7 @@ (cond (*profile-ticks* (let ((s0-2 draw-string-xy)) - (set! sv-32 format) - (let ((a0-26 (clear *temp-string*)) - (a1-45 "~5D") - ) - (sv-32 a0-26 a1-45 s1-2) - ) + (format (clear *temp-string*) "~5D" s1-2) (s0-2 *temp-string* arg0 @@ -728,9 +716,8 @@ (none) ) - (defmethod draw-text! ((this profile-array)) - "Draw the table of times." + "Generate DMA data for drawing the profile information screen." (let ((gp-0 *profile-collapse*)) (dotimes (s5-0 (-> gp-0 count)) (when (or (nonzero? (-> gp-0 data s5-0 count)) (nonzero? (-> gp-0 data s5-0 vu-count))) diff --git a/goal_src/jak2/engine/util/sync-info.gc b/goal_src/jak2/engine/util/sync-info.gc index 25acfcc1bc..6378da041f 100644 --- a/goal_src/jak2/engine/util/sync-info.gc +++ b/goal_src/jak2/engine/util/sync-info.gc @@ -71,7 +71,6 @@ ;; WARN: Return type mismatch float vs none. (defmethod initialize! ((this sync-linear) (arg0 sync-info-params)) "Set up a sync-info from params." - (local-vars (sv-16 res-tag)) (if (!= (-> arg0 sync-type) 'sync-linear) (format 0 @@ -85,8 +84,9 @@ ) (let ((a0-3 (-> arg0 entity))) (when a0-3 - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data (the-as res-lump a0-3) 'sync pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data (the-as res-lump a0-3) 'sync pointer :tag-ptr (& sv-16))) + ) (when v1-6 (set! s4-0 (the int (* 300.0 (-> (the-as (pointer float) v1-6))))) (set! f30-0 (-> (the-as (pointer float) v1-6) 1)) @@ -141,7 +141,6 @@ ;; WARN: Return type mismatch float vs none. (defmethod initialize! ((this sync-eased) (arg0 sync-info-params)) "Set up a sync-info from params." - (local-vars (sv-16 res-tag)) (if (!= (-> arg0 sync-type) 'sync-eased) (format 0 @@ -159,8 +158,9 @@ ) (let ((a0-3 (-> arg0 entity))) (when a0-3 - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data (the-as res-lump a0-3) 'sync (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data (the-as res-lump a0-3) 'sync (pointer float) :tag-ptr (& sv-16))) + ) (when v1-6 (set! s5-0 (the int (* 300.0 (-> v1-6 0)))) (set! f22-0 (-> v1-6 1)) @@ -222,7 +222,7 @@ (let* ((f1-6 (- 1.0 f0-20)) (f0-21 f30-0) (f1-7 (+ f30-0 f1-6)) - (f2-3 (* f0-21 f0-21)) + (f2-3 (square f0-21)) (f3-3 (+ (* 2.0 f0-21 (- f1-7 f0-21)) f2-3)) (f4-3 (/ f0-21 (- 1.0 f1-7))) (f3-4 (+ (* (- 1.0 f1-7) (- 1.0 f1-7) f4-3) f3-3)) @@ -274,14 +274,14 @@ (f1-2 (-> this tlo)) (f0-8 (/ (cond ((< f0-3 f1-2) - (* f0-3 f0-3) + (square f0-3) ) ((< f0-3 (-> this thi)) (+ (* 2.0 f1-2 (- f0-3 f1-2)) (-> this ylo)) ) (else (let ((f1-5 (- 1.0 f0-3))) - (- (-> this yend) (* f1-5 f1-5 (-> this m2))) + (- (-> this yend) (* (square f1-5) (-> this m2))) ) ) ) @@ -312,7 +312,6 @@ ;; WARN: Return type mismatch float vs none. (defmethod initialize! ((this sync-paused) (arg0 sync-info-params)) "Set up a sync-info from params." - (local-vars (sv-16 res-tag)) (if (!= (-> arg0 sync-type) 'sync-paused) (format 0 @@ -328,8 +327,9 @@ ) (let ((a0-3 (-> arg0 entity))) (when a0-3 - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data (the-as res-lump a0-3) 'sync (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data (the-as res-lump a0-3) 'sync (pointer float) :tag-ptr (& sv-16))) + ) (when v1-6 (set! s5-0 (the int (* 300.0 (-> v1-6 0)))) (set! f26-0 (-> v1-6 1)) diff --git a/goal_src/jak2/levels/atoll/ash1-course.gc b/goal_src/jak2/levels/atoll/ash1-course.gc index 59fc178bb1..39b66bb337 100644 --- a/goal_src/jak2/levels/atoll/ash1-course.gc +++ b/goal_src/jak2/levels/atoll/ash1-course.gc @@ -45,7 +45,7 @@ :skip-to -1 :on-set (lambda ((arg0 ashelin-battle)) (clear-speech-flags! arg0) - (move-to-point! (-> arg0 root) (the-as vector (-> arg0 ash-course spots 0))) + (move-to-point! (-> arg0 root) (-> arg0 ash-course spots 0 center)) (let ((v1-7 (get-current-task-event (-> arg0 task)))) (if (= (-> v1-7 action) (game-task-action say)) (add-process @@ -94,11 +94,9 @@ (cond ((and (nonzero? (-> arg1 waypoint-time0)) (and (time-elapsed? (-> arg1 waypoint-time0) (seconds 1)) - (let ((f0-0 143360.0)) - (and (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) - (= (-> s5-0 action) (game-task-action say)) - ) - ) + (and (>= (square 143360.0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) + (= (-> s5-0 action) (game-task-action say)) + ) ) ) (process-entity-status! arg1 (entity-perm-status no-kill) #t) @@ -137,9 +135,9 @@ (when (scene-release? arg1) (logior! (-> arg1 bot-flags) (bot-flags bf20)) (let ((s5-0 (-> arg1 ash-course spots))) - (vector-! (the-as vector (-> arg1 frontline)) (the-as vector (-> s5-0 2)) (the-as vector (-> s5-0 1))) + (vector-! (the-as vector (-> arg1 frontline)) (-> s5-0 2 center) (-> s5-0 1 center)) (vector-normalize! (-> arg1 frontline) 1.0) - (set! (-> arg1 frontline w) (- (vector-dot (the-as vector (-> arg1 frontline)) (the-as vector (-> s5-0 1))))) + (set! (-> arg1 frontline w) (- (vector-dot (the-as vector (-> arg1 frontline)) (-> s5-0 1 center)))) ) (set-frontline-dist! arg1) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) diff --git a/goal_src/jak2/levels/atoll/atoll-obs.gc b/goal_src/jak2/levels/atoll/atoll-obs.gc index a7ad37cf0f..dedac627d1 100644 --- a/goal_src/jak2/levels/atoll/atoll-obs.gc +++ b/goal_src/jak2/levels/atoll/atoll-obs.gc @@ -126,7 +126,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-64 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle pusher)) @@ -181,8 +180,9 @@ (let ((f28-0 -3.0) (f30-0 3.0) ) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-40 (res-lump-data arg0 'move-range (pointer float) :tag-ptr (& sv-64)))) + (let* ((sv-64 (new 'static 'res-tag)) + (v1-40 (res-lump-data arg0 'move-range (pointer float) :tag-ptr (& sv-64))) + ) (when v1-40 (set! f28-0 (-> v1-40 0)) (set! f30-0 (-> v1-40 1)) @@ -287,7 +287,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) @@ -319,14 +318,16 @@ (let ((f30-0 8192.0) (f28-0 0.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-25 (res-lump-data arg0 'rotspeed pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-25 (res-lump-data arg0 'rotspeed pointer :tag-ptr (& sv-16))) + ) (if v1-25 (set! f30-0 (-> (the-as (pointer float) v1-25))) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-27 (res-lump-data arg0 'rise-height pointer :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-27 (res-lump-data arg0 'rise-height pointer :tag-ptr (& sv-32))) + ) (if v1-27 (set! f28-0 (-> (the-as (pointer float) v1-27))) ) @@ -439,7 +440,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) @@ -460,16 +460,18 @@ ) (process-drawable-from-entity! this arg0) (let ((s4-1 (-> this root))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-15 (res-lump-data arg0 'trans-offset vector :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-15 (res-lump-data arg0 'trans-offset vector :tag-ptr (& sv-16))) + ) (when v1-15 (+! (-> s4-1 trans x) (-> v1-15 x)) (+! (-> s4-1 trans y) (-> v1-15 y)) (+! (-> s4-1 trans z) (-> v1-15 z)) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-17 (res-lump-data arg0 'scale-mult vector :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-17 (res-lump-data arg0 'scale-mult vector :tag-ptr (& sv-32))) + ) (when v1-17 (set! (-> s4-1 scale x) (* (-> s4-1 scale x) (-> v1-17 x))) (set! (-> s4-1 scale y) (* (-> s4-1 scale y) (-> v1-17 y))) @@ -607,7 +609,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) @@ -650,8 +651,9 @@ (let ((f28-0 4.0) (f30-0 0.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-29 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-29 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16))) + ) (when v1-29 (set! f28-0 (-> v1-29 0)) (set! f30-0 (-> v1-29 1)) @@ -691,12 +693,7 @@ (case message (('touch 'attack) (when (time-elapsed? (the-as int (-> self collide-off-timer)) (seconds 2)) - (let* ((s4-0 proc) - (s3-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (let ((s3-0 (the-as process (as-type proc process-focusable)))) (when s3-0 (let ((s4-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) (let* ((v1-7 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable s3-0) 0))) diff --git a/goal_src/jak2/levels/atoll/atoll-part.gc b/goal_src/jak2/levels/atoll/atoll-part.gc index ab7a590df5..cacbebf4dc 100644 --- a/goal_src/jak2/levels/atoll/atoll-part.gc +++ b/goal_src/jak2/levels/atoll/atoll-part.gc @@ -301,7 +301,7 @@ (set! (-> s4-0 x) f0-0) (set! (-> s4-0 y) f1-0) (set! (-> s4-0 z) f2-0) - (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-0)) (square f0-0)))) ) (let ((a1-1 (new-stack-vector0))) (set! (-> a1-1 y) (-> v1-0 flag-rot-sy y)) @@ -545,7 +545,7 @@ (defun check-drop-level-atoll-drop ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) "Ensure water drop particle effects don't go below the ocean level, render the splash" - (let ((f30-0 (get-height *ocean* (the-as vector (-> arg2 vector)) #t))) + (let ((f30-0 (get-height *ocean* (-> arg2 vector 0) #t))) (when (and (!= f30-0 4095996000.0) (< (-> arg2 vector 0 y) f30-0)) (let ((s3-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) diff --git a/goal_src/jak2/levels/atoll/juicer.gc b/goal_src/jak2/levels/atoll/juicer.gc index d77b0967ee..5cb32c9111 100644 --- a/goal_src/jak2/levels/atoll/juicer.gc +++ b/goal_src/jak2/levels/atoll/juicer.gc @@ -661,11 +661,7 @@ ) ) (zero? (rnd-int-count this 3)) - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-0 32768.0) - ) - (>= f0-0 (* f1-0 f1-0)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (kill-prefer-falling this) (go (method-of-object this knocked)) diff --git a/goal_src/jak2/levels/atoll/sig0-course.gc b/goal_src/jak2/levels/atoll/sig0-course.gc index 5383f830ec..249dce6089 100644 --- a/goal_src/jak2/levels/atoll/sig0-course.gc +++ b/goal_src/jak2/levels/atoll/sig0-course.gc @@ -94,13 +94,9 @@ (let ((gp-0 (bot-simple-check-too-far arg0))) (when (nonzero? gp-0) (let* ((s5-1 (-> arg0 sig-course spots)) - (f0-0 (vector-segment-distance-point! - (target-pos 0) - (the-as vector (-> s5-1 18)) - (the-as vector (-> s5-1 19)) - (the-as vector #f) - ) - ) + (f0-0 + (vector-segment-distance-point! (target-pos 0) (-> s5-1 18 center) (-> s5-1 19 center) (the-as vector #f)) + ) ) (cond ((< f0-0 45056.0) @@ -139,11 +135,7 @@ (when (not (logtest? (-> arg0 bot-task-bits) (bot-task-bits botbits-4))) (let ((s5-0 (handle->process (-> arg0 focus handle)))) (when s5-0 - (let ((v1-9 (if (type? s5-0 nav-enemy) - s5-0 - ) - ) - ) + (let ((v1-9 (the-as process (as-type s5-0 nav-enemy)))) (when v1-9 (if (>= 20480.0 (- (-> (the-as process-focusable v1-9) root trans y) (-> arg0 root trans y))) (logior! (-> arg0 bot-task-bits) (bot-task-bits botbits-4)) @@ -682,9 +674,7 @@ (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) (if (and (not (speech-playing? arg1 5)) (not (channel-active? arg1 (gui-channel none))) - (let ((f0-1 73728.0)) - (>= (* f0-1 f0-1) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) - ) + (>= (square 73728.0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) ) (play-speech arg1 5) ) @@ -728,13 +718,9 @@ :skip-to 15 :on-set (lambda ((arg0 sig-atoll)) (set! (-> arg0 sig-course liftcat-speech-index) 0) - (let ((f0-0 (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans))) - (f1-0 98304.0) - ) - (if (>= f0-0 (* f1-0 f1-0)) - (logior! (-> arg0 waypoint-bits) (waypoint-bits wabits-1)) - ) - ) + (if (>= (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans)) (square 98304.0)) + (logior! (-> arg0 waypoint-bits) (waypoint-bits wabits-1)) + ) (play-speech arg0 6) (let ((v1-10 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) (set! (-> v1-10 bytes 5) 1) @@ -841,16 +827,12 @@ (outside-spot-radius? arg0 (the-as bot-spot #f) (the-as vector #f) #f) ) (logclear! (-> arg0 waypoint-bits) (waypoint-bits wabits-1)) - (let ((f0-0 98304.0)) - (if (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans))) - (play-speech arg0 34) - ) - ) + (if (>= (square 98304.0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans))) + (play-speech arg0 34) + ) ) ((and (logtest? (-> arg0 waypoint-bits) (waypoint-bits wabits-1)) - (let ((f0-3 49152.0)) - (>= (* f0-3 f0-3) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans))) - ) + (>= (square 49152.0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans))) ) (logclear! (-> arg0 waypoint-bits) (waypoint-bits wabits-1)) (play-speech arg0 34) @@ -873,9 +855,7 @@ a1-7 ) ) - (let ((f0-6 98304.0)) - (>= (* f0-6 f0-6) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans))) - ) + (>= (square 98304.0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans))) ) (when (and (demo?) (time-elapsed? (-> arg0 waypoint-time0) (seconds 1)) @@ -945,27 +925,23 @@ (cond ((not (logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-0))) (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (let ((f0-2 (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - (f1-0 81920.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (gui-channel none))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set-time! (-> arg1 waypoint-time0)) - (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) - (process-grab? arg1 #f) - (process-grab? *target* #f) - (reset-warn-time! arg1) - (play-speech arg1 10) - (set-setting! 'entity-name "camera-68" 0.0 0) - ) - (else - (set! (-> arg1 too-far-warn-dist) 81920.0) - (set! (-> arg1 too-far-fail-dist-delta) 225280.0) - ) + (cond + ((and (< (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0)) (square 81920.0)) + (not (channel-active? arg1 (gui-channel none))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set-time! (-> arg1 waypoint-time0)) + (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) + (process-grab? arg1 #f) + (process-grab? *target* #f) + (reset-warn-time! arg1) + (play-speech arg1 10) + (set-setting! 'entity-name "camera-68" 0.0 0) + ) + (else + (set! (-> arg1 too-far-warn-dist) 81920.0) + (set! (-> arg1 too-far-fail-dist-delta) 225280.0) ) ) ) @@ -1138,7 +1114,7 @@ ) (let ((s5-0 (new 'stack-no-clear 'vector))) (let ((v1-6 (-> arg1 sig-course spots))) - (vector-lerp! s5-0 (the-as vector (-> v1-6 21)) (the-as vector (-> v1-6 22)) 0.5) + (vector-lerp! s5-0 (-> v1-6 21 center) (-> v1-6 22 center) 0.5) ) (move-to-point! (-> arg1 root) s5-0) ) @@ -1373,26 +1349,22 @@ (cond ((zero? (-> arg1 waypoint-time0)) (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (let ((f0-2 (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - (f1-0 73728.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (gui-channel none))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set-time! (-> arg1 waypoint-time0)) - (process-grab? arg1 #f) - (process-grab? *target* #f) - (play-speech arg1 15) - (reset-warn-time! arg1) - (set-setting! 'entity-name "camera-69" 0.0 0) - ) - (else - (set! (-> arg1 too-far-warn-dist) 73728.0) - (set! (-> arg1 too-far-fail-dist-delta) 233472.0) - ) + (cond + ((and (< (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0)) (square 73728.0)) + (not (channel-active? arg1 (gui-channel none))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set-time! (-> arg1 waypoint-time0)) + (process-grab? arg1 #f) + (process-grab? *target* #f) + (play-speech arg1 15) + (reset-warn-time! arg1) + (set-setting! 'entity-name "camera-69" 0.0 0) + ) + (else + (set! (-> arg1 too-far-warn-dist) 73728.0) + (set! (-> arg1 too-far-fail-dist-delta) 233472.0) ) ) ) @@ -1495,9 +1467,7 @@ a1-2 ) (not (channel-active? arg1 (gui-channel none))) - (let ((f0-0 102400.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - ) + (>= (square 102400.0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) ) ) @@ -1655,16 +1625,11 @@ (when (not (channel-active? arg1 (gui-channel none))) (let ((s5-0 (-> arg1 root trans)) (s4-0 (-> arg1 sig-course spots)) - (f0-0 163840.0) ) - (when (and (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared s5-0 (target-pos 0))) - (let ((f0-3 86016.0)) - (or (>= (* f0-3 f0-3) (vector-vector-xz-distance-squared s5-0 (the-as vector (-> s4-0 28)))) - (let ((f0-6 102400.0)) - (>= (* f0-6 f0-6) (vector-vector-xz-distance-squared s5-0 (the-as vector (-> s4-0 29)))) - ) - ) - ) + (when (and (>= (square 163840.0) (vector-vector-xz-distance-squared s5-0 (target-pos 0))) + (or (>= (square 86016.0) (vector-vector-xz-distance-squared s5-0 (-> s4-0 28 center))) + (>= (square 102400.0) (vector-vector-xz-distance-squared s5-0 (-> s4-0 29 center))) + ) ) (when (or (not (logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-1))) (time-elapsed? (-> arg1 waypoint-time0) (seconds 8)) @@ -1777,26 +1742,22 @@ (cond ((zero? (-> arg1 waypoint-time0)) (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (let ((f0-2 (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - (f1-0 61440.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (gui-channel none))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set-time! (-> arg1 waypoint-time0)) - (process-grab? arg1 #f) - (process-grab? *target* #f) - (reset-warn-time! arg1) - (play-speech arg1 21) - (set-setting! 'entity-name "camera-70" 0.0 0) - ) - (else - (set! (-> arg1 too-far-warn-dist) 61440.0) - (set! (-> arg1 too-far-fail-dist-delta) 245760.0) - ) + (cond + ((and (< (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0)) (square 61440.0)) + (not (channel-active? arg1 (gui-channel none))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set-time! (-> arg1 waypoint-time0)) + (process-grab? arg1 #f) + (process-grab? *target* #f) + (reset-warn-time! arg1) + (play-speech arg1 21) + (set-setting! 'entity-name "camera-70" 0.0 0) + ) + (else + (set! (-> arg1 too-far-warn-dist) 61440.0) + (set! (-> arg1 too-far-fail-dist-delta) 245760.0) ) ) ) @@ -1897,9 +1858,7 @@ a1-2 ) (not (channel-active? arg1 (gui-channel none))) - (let ((f0-0 102400.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - ) + (>= (square 102400.0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) ) ) @@ -2124,26 +2083,22 @@ (cond ((zero? (-> arg1 waypoint-time0)) (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (let ((f0-2 (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - (f1-0 73728.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (gui-channel none))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set-time! (-> arg1 waypoint-time0)) - (process-grab? arg1 #f) - (process-grab? *target* #f) - (reset-warn-time! arg1) - (play-speech arg1 23) - (set-setting! 'entity-name "camera-71" 0.0 0) - ) - (else - (set! (-> arg1 too-far-warn-dist) 73728.0) - (set! (-> arg1 too-far-fail-dist-delta) 233472.0) - ) + (cond + ((and (< (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0)) (square 73728.0)) + (not (channel-active? arg1 (gui-channel none))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set-time! (-> arg1 waypoint-time0)) + (process-grab? arg1 #f) + (process-grab? *target* #f) + (reset-warn-time! arg1) + (play-speech arg1 23) + (set-setting! 'entity-name "camera-71" 0.0 0) + ) + (else + (set! (-> arg1 too-far-warn-dist) 73728.0) + (set! (-> arg1 too-far-fail-dist-delta) 233472.0) ) ) ) @@ -2251,9 +2206,7 @@ a1-2 ) (not (channel-active? arg1 (gui-channel none))) - (let ((f0-0 102400.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - ) + (>= (square 102400.0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) ) ) @@ -2703,11 +2656,9 @@ (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) (not (channel-active? arg1 (gui-channel none))) ) - (let ((f0-0 122880.0)) - (if (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - (play-speech arg1 30) - ) - ) + (if (>= (square 122880.0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) + (play-speech arg1 30) + ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) (go-to-waypoint! arg1 37 #f) (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) @@ -2750,26 +2701,22 @@ (cond ((zero? (-> arg1 waypoint-time0)) (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (let ((f0-0 (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - (f1-0 61440.0) - ) - (cond - ((and (< f0-0 (* f1-0 f1-0)) - (not (channel-active? arg1 (gui-channel none))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set-time! (-> arg1 waypoint-time0)) - (process-grab? arg1 #f) - (process-grab? *target* #f) - (reset-warn-time! arg1) - (play-speech arg1 31) - (set-setting! 'entity-name "camera-72" 0.0 0) - ) - (else - (set! (-> arg1 too-far-warn-dist) 61440.0) - (set! (-> arg1 too-far-fail-dist-delta) 430080.0) - ) + (cond + ((and (< (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0)) (square 61440.0)) + (not (channel-active? arg1 (gui-channel none))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set-time! (-> arg1 waypoint-time0)) + (process-grab? arg1 #f) + (process-grab? *target* #f) + (reset-warn-time! arg1) + (play-speech arg1 31) + (set-setting! 'entity-name "camera-72" 0.0 0) + ) + (else + (set! (-> arg1 too-far-warn-dist) 61440.0) + (set! (-> arg1 too-far-fail-dist-delta) 430080.0) ) ) ) @@ -2886,9 +2833,7 @@ a1-2 ) (not (channel-active? arg1 (gui-channel none))) - (let ((f0-0 102400.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - ) + (>= (square 102400.0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) ) ) diff --git a/goal_src/jak2/levels/atoll/sniper.gc b/goal_src/jak2/levels/atoll/sniper.gc index 98bdd601f4..53ceb56a02 100644 --- a/goal_src/jak2/levels/atoll/sniper.gc +++ b/goal_src/jak2/levels/atoll/sniper.gc @@ -189,9 +189,8 @@ (set! (-> *sniper-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) (defmethod run-logic? ((this sniper)) - (let ((f0-0 573440.0)) - (>= (* f0-0 f0-0) (vector-vector-distance-squared (-> this root trans) (camera-pos))) - ) + "Should this process be run? Checked by execute-process-tree." + (>= (square 573440.0) (vector-vector-distance-squared (-> this root trans) (camera-pos))) ) (defmethod enemy-method-129 ((this sniper)) diff --git a/goal_src/jak2/levels/castle/castle-obs.gc b/goal_src/jak2/levels/castle/castle-obs.gc index 1a6e6a8b28..1f6bce3c55 100644 --- a/goal_src/jak2/levels/castle/castle-obs.gc +++ b/goal_src/jak2/levels/castle/castle-obs.gc @@ -44,7 +44,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (reset-root! this) (set! (-> this path) (new 'process 'path-control this 'path 0.0 (the-as entity #f) #f)) (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) @@ -55,8 +54,9 @@ (set! (-> this sound-id) (new-sound-id)) (set! (-> this target-speed) (-> this speed)) (conveyor-method-21 this) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-16 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-16 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-16 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-16)) @@ -270,7 +270,6 @@ ) :code sleep-code :post (behavior () - (local-vars (sv-608 symbol) (sv-624 symbol) (sv-640 (function vector cspace vector)) (sv-656 vector)) (when (and (logtest? (actor-option user17) (-> self fact options)) (not (-> self track-flag)) (< (-> self lightning-timer) (current-time)) @@ -294,42 +293,17 @@ (when (< 0.0 f0-5) (let ((s5-2 (vector+float*! (new 'stack-no-clear 'vector) (-> gp-0 start-pos) (-> gp-0 move-dist) f0-5)) (gp-1 45) - (s4-2 (get-process *default-dead-pool* lightning-tracker #x4000)) ) - (when s4-2 - (let ((t9-7 (method-of-type lightning-tracker activate))) - (t9-7 - (the-as lightning-tracker s4-2) - *entity-pool* - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s3-2 run-function-in-process) - (s2-2 s4-2) - (s1-0 lightning-tracker-init) - (s0-0 (-> *lightning-spec-id-table* 27)) - ) - (set! sv-608 (the-as symbol #f)) - (set! sv-624 (the-as symbol #f)) - (set! sv-640 vector<-cspace!) - (set! sv-656 (new 'stack-no-clear 'vector)) - (let* ((a1-8 (-> self node-list data (+ (rand-vu-int-count 3) 4))) - (t2-0 (sv-640 sv-656 a1-8)) - ) - ((the-as (function object object object object object object object object none) s3-2) - s2-2 - s1-0 - s0-0 - gp-1 - sv-608 - sv-624 - t2-0 - s5-2 - ) - ) - ) - (-> s4-2 ppointer) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 27) + gp-1 + (the-as symbol #f) + (the-as symbol #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (+ (rand-vu-int-count 3) 4))) + s5-2 + :to *entity-pool* ) ) (set! (-> self lightning-timer) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.04 0.1))))) @@ -350,7 +324,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> v1-2 prim-core collide-as) (collide-spec enemy)) @@ -389,8 +362,9 @@ (get-point-in-path! (-> this path) (-> this red-pos) 0.0 'exact) (get-point-in-path! (-> this path) (-> this blue-pos) 1.0 'exact) (set! (-> this lightning-timer) 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-27 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-27 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-27 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-27)) @@ -480,7 +454,8 @@ (sound-play "lightning-node") (suspend) (logior! (-> self entity extra perm status) (entity-perm-status dead)) - (suspend-for (seconds 4)) + (suspend-for (seconds 4) + ) (cleanup-for-death self) ) ) @@ -818,12 +793,7 @@ (defmethod commited-to-ride? ((this cas-elevator)) "@returns if the target is considered within the elevator area enough to begin descending/ascending" - (let* ((s5-0 *target*) - (a0-2 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((a0-2 (the-as target (as-type *target* process-focusable)))) (when a0-2 (let* ((a0-3 (get-trans a0-2 0)) (v1-2 (vector-! (new 'stack-no-clear 'vector) a0-3 (-> this root trans))) @@ -1459,7 +1429,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) (set! (-> s4-0 total-prims) (the-as uint 3)) @@ -1498,8 +1467,9 @@ (the-as pair 0) ) (logclear! (-> this mask) (process-mask actor-pause)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-22 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-22 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-22 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-22)) @@ -1618,12 +1588,7 @@ 0 (sound-play "trapdoor") (let ((gp-1 (new 'stack 'joint-exploder-tuning (the-as uint 1)))) - (let* ((s5-1 *target*) - (a0-3 (if (type? s5-1 process-focusable) - s5-1 - ) - ) - ) + (let ((a0-3 (the-as target (as-type *target* process-focusable)))) (when a0-3 (set! (-> gp-1 fountain-rand-transv-lo quad) (-> (get-trans a0-3 0) quad)) (+! (-> gp-1 fountain-rand-transv-lo y) -16384.0) @@ -1647,7 +1612,8 @@ (sound-play "trapdoor") (suspend) (ja-channel-set! 0) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (send-event self 'death-end) (while (-> self child) (suspend) @@ -2131,7 +2097,8 @@ (suspend) (ja :num! (seek!)) ) - (suspend-for (seconds 0.5)) + (suspend-for (seconds 0.5) + ) (while (or (= (-> self spawn-total) -1) (< (-> self spawn-count-total) (-> self spawn-total))) (when (and (< (-> self player-dist) (+ 81920.0 (-> self notice-dist))) (and (< (-> self spawn-count) (-> self spawn-max)) @@ -2167,10 +2134,12 @@ ) ) ) - (suspend-for (the int (* 300.0 (rand-vu-float-range 0.5 1.0)))) + (suspend-for (the int (* 300.0 (rand-vu-float-range 0.5 1.0))) + ) ) (while (> (-> self spawn-count) 0) - (suspend-for (seconds 0.43)) + (suspend-for (seconds 0.43) + ) ) (process-entity-status! self (entity-perm-status subtask-complete) #t) (cond @@ -2188,7 +2157,8 @@ (set-setting! 'entity-name a3-4 0.0 0) ) ) - (suspend-for (seconds 2)) + (suspend-for (seconds 2) + ) (dotimes (gp-6 (-> self actor-group 1 length)) (let ((a1-17 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-17 from) (process->ppointer self)) @@ -2218,7 +2188,8 @@ (set-setting! 'entity-name a3-6 0.0 0) ) ) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (let ((gp-8 (-> self actor-group 0))) (dotimes (s5-3 (-> gp-8 length)) (let ((a1-21 (new 'stack-no-clear 'event-message-block))) @@ -2248,7 +2219,8 @@ (suspend) (ja :num! (seek! 0.0)) ) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (remove-setting! 'entity-name) (until (process-release? *target*) (suspend) @@ -2284,7 +2256,8 @@ (label cfg-14) (not v1-28) ) - (suspend-for (seconds 0.51)) + (suspend-for (seconds 0.51) + ) ) (until (process-grab? *target* #f) (suspend) @@ -2294,7 +2267,8 @@ (set-setting! 'entity-name a3-2 0.0 0) ) ) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (task-node-close! (game-task-node castle-break-in-resolution)) (let ((a1-7 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-7 from) (process->ppointer self)) @@ -2330,7 +2304,8 @@ ) ) ) - (suspend-for (seconds 2.5)) + (suspend-for (seconds 2.5) + ) (remove-setting! 'entity-name) (until (process-release? *target*) (suspend) @@ -2349,7 +2324,6 @@ - sounds" ;; og:preserve-this added (stack-size-set! (-> this main-thread) 512) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) @@ -2379,8 +2353,9 @@ (set! (-> this spawn-max) 5) (set! (-> this spawn-total) -1) (set! (-> this last-guard) (the-as handle #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-13 (res-lump-data arg0 'extra-id (pointer int32) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-13 (res-lump-data arg0 'extra-id (pointer int32) :tag-ptr (& sv-16))) + ) (when v1-13 (set! (-> this spawn-max) (-> v1-13 0)) (if (< (the-as uint 1) (-> sv-16 elt-count)) @@ -2392,8 +2367,9 @@ (set! (-> this anim-index) (res-lump-value (-> this entity) 'index int :default (the-as uint128 -1) :time -1000000000.0) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-17 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-17 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32))) + ) (cond ((and v1-17 (nonzero? (-> sv-32 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-17)) diff --git a/goal_src/jak2/levels/city/bombbot/bombbot.gc b/goal_src/jak2/levels/city/bombbot/bombbot.gc index 562dbab2ff..28e7bffd56 100644 --- a/goal_src/jak2/levels/city/bombbot/bombbot.gc +++ b/goal_src/jak2/levels/city/bombbot/bombbot.gc @@ -789,15 +789,7 @@ ;; ERROR: Stack slot load at 896 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 912 mismatch: defined as size 4, got size 16 (defmethod bombbot-method-179 ((this bombbot)) - (local-vars - (at-0 int) - (sv-864 vector) - (sv-880 vector) - (sv-896 float) - (sv-912 float) - (sv-928 (function vector vector float)) - (sv-944 uint) - ) + (local-vars (at-0 int)) (with-pp (rlet ((acc :class vf) (vf0 :class vf) @@ -855,19 +847,21 @@ ((>= f30-0 f28-0) (vector-orient-by-quat! s3-0 (-> s1-0 pos-offset) (-> this root quat)) (let ((f26-0 (- f30-0 f28-0))) - (set! sv-880 s0-0) - (set! sv-864 (new 'stack-no-clear 'vector)) - (set! (-> sv-864 x) 0.0) - (set! (-> sv-864 y) (sin (* (-> this y-angular-velocity) (-> pp clock frames-per-second)))) - (set! (-> sv-864 z) 0.0) - (set! (-> sv-864 w) 1.0) - (let ((v1-39 s3-0)) - (.lvf vf1 (&-> sv-864 quad)) - (.lvf vf2 (&-> v1-39 quad)) + (let ((sv-880 s0-0)) + (let ((sv-864 (new 'stack-no-clear 'vector))) + (set! (-> sv-864 x) 0.0) + (set! (-> sv-864 y) (sin (* (-> this y-angular-velocity) (-> pp clock frames-per-second)))) + (set! (-> sv-864 z) 0.0) + (set! (-> sv-864 w) 1.0) + (let ((v1-39 s3-0)) + (.lvf vf1 (&-> sv-864 quad)) + (.lvf vf2 (&-> v1-39 quad)) + ) + ) + (.outer.product.a.vf acc vf1 vf2) + (.outer.product.b.vf vf3 vf2 vf1 acc) + (.svf (&-> sv-880 quad) vf3) ) - (.outer.product.a.vf acc vf1 vf2) - (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> sv-880 quad) vf3) (let ((a1-5 s0-0) (v1-41 s0-0) (a0-11 (new 'stack-no-clear 'vector)) @@ -1012,35 +1006,21 @@ (when (-> s1-0 moving) (set! (-> s1-0 position quad) (-> s1-0 next-position quad)) (set! (-> s1-0 moving) #f) - (let ((s0-1 lerp-scale)) - (set! sv-896 (the-as float 819.2)) - (set! sv-912 (the-as float 0.0)) - (set! sv-928 vector-vector-distance) - (let* ((a0-34 (camera-pos)) - (a1-17 (-> s1-0 position)) - (a2-23 (sv-928 a0-34 a1-17)) - (a3-2 40960.0) - (t0-1 409600.0) - (f30-1 (s0-1 sv-896 sv-912 a2-23 a3-2 t0-1)) - ) - (when (and (!= f30-1 0.0) (< 16384.0 (vector-length (-> s1-0 speed)))) - (activate! *camera-smush-control* f30-1 37 600 1.0 0.1 (-> pp clock)) - (part-tracker-spawn :to this :group group-land-poof-stn :mat-joint (-> s1-0 position)) - (when (or (zero? s4-0) (= s4-0 1)) - (let ((s0-3 sound-play-by-name)) - (set! sv-944 (make-u128 0 (the-as uint #x6b6c61772d6262))) - (let ((a1-23 (new-sound-id)) - (a2-30 1024) - (a3-6 0) - (t0-4 0) - (t1-3 1) - (t2-2 (-> s1-0 position)) - ) - (s0-3 (the-as sound-name sv-944) a1-23 a2-30 a3-6 t0-4 (the-as sound-group t1-3) t2-2) - ) - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 (* 0.0012207031 f30-1))) (seconds 0.2)) - ) + (let ((f30-1 (lerp-scale + (the-as float 819.2) + (the-as float 0.0) + (vector-vector-distance (camera-pos) (-> s1-0 position)) + 40960.0 + 409600.0 + ) + ) + ) + (when (and (!= f30-1 0.0) (< 16384.0 (vector-length (-> s1-0 speed)))) + (activate! *camera-smush-control* f30-1 37 600 1.0 0.1 (-> pp clock)) + (part-tracker-spawn :to this :group group-land-poof-stn :mat-joint (-> s1-0 position)) + (when (or (zero? s4-0) (= s4-0 1)) + (sound-play "bb-walk" :position (-> s1-0 position)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 (* 0.0012207031 f30-1))) (seconds 0.2)) ) ) ) @@ -1117,7 +1097,6 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (local-vars (sv-16 sparticle-launcher) (sv-20 sparticle-launcher)) (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) @@ -1144,56 +1123,61 @@ (the-as (function object float none) (method-of-object this bombbot-method-183)) ) (bombbot-method-184 this) - (set! sv-16 (the-as sparticle-launcher #f)) - (set! sv-20 (the-as sparticle-launcher #f)) - (cond - ((< (-> this hit-points) 30) - (set! sv-16 (-> *part-id-table* 778)) - (set! sv-20 (-> *part-id-table* 774)) - ) - ((< (-> this hit-points) 60) - (set! sv-16 (-> *part-id-table* 781)) - ) - (else - (if (< (rand-vu) 0.05) - (set! sv-16 (-> *part-id-table* 783)) + (let ((sv-16 (the-as sparticle-launcher #f)) + (sv-20 (the-as sparticle-launcher #f)) + ) + (set! sv-16 (cond + ((< (-> this hit-points) 30) + (set! sv-16 (-> *part-id-table* 778)) + (set! sv-20 (-> *part-id-table* 774)) + sv-16 + ) + ((< (-> this hit-points) 60) + (-> *part-id-table* 781) + ) + (else + (if (< (rand-vu) 0.05) + (set! sv-16 (-> *part-id-table* 783)) + ) + sv-16 + ) + ) ) - ) - ) - (when sv-16 - (let ((gp-1 (-> this node-list data 4 bone transform)) - (s5-3 (new 'stack-no-clear 'vector)) - ) - (dotimes (s4-1 2) - (vector-matrix*! - s5-3 - (vector-rotate-around-y! (new 'stack-no-clear 'vector) (new 'static 'vector :z 6144.0 :w 1.0) (if (< s4-1 1) - 5461.3335 - 38229.332 - ) - ) - gp-1 - ) - (vector-! *particle-vel* s5-3 (matrix->trans gp-1 (new 'stack-no-clear 'vector))) - (+! (-> *particle-vel* y) 4096.0) - (vector-float*! *particle-vel* *particle-vel* 0.0033333334) - (when (and sv-20 (< (rand-vu) 0.005)) - (let ((t9-14 sp-launch-particles-var) - (a0-22 *sp-particle-system-2d*) - (a1-9 sv-16) - (a2-2 *launch-matrix*) - ) - (set! (-> a2-2 trans quad) (-> s5-3 quad)) - (t9-14 a0-22 a1-9 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (when sv-16 + (let ((gp-1 (-> this node-list data 4 bone transform)) + (s5-3 (new 'stack-no-clear 'vector)) ) - ) - (let ((t9-15 sp-launch-particles-var) - (a0-23 *sp-particle-system-2d*) - (a1-10 sv-16) - (a2-3 *launch-matrix*) + (dotimes (s4-1 2) + (vector-matrix*! + s5-3 + (vector-rotate-around-y! (new 'stack-no-clear 'vector) (new 'static 'vector :z 6144.0 :w 1.0) (if (< s4-1 1) + 5461.3335 + 38229.332 + ) + ) + gp-1 + ) + (vector-! *particle-vel* s5-3 (matrix->trans gp-1 (new 'stack-no-clear 'vector))) + (+! (-> *particle-vel* y) 4096.0) + (vector-float*! *particle-vel* *particle-vel* 0.0033333334) + (when (and sv-20 (< (rand-vu) 0.005)) + (let ((t9-14 sp-launch-particles-var) + (a0-22 *sp-particle-system-2d*) + (a1-9 sv-16) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> s5-3 quad)) + (t9-14 a0-22 a1-9 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) - (set! (-> a2-3 trans quad) (-> s5-3 quad)) - (t9-15 a0-23 a1-10 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-15 sp-launch-particles-var) + (a0-23 *sp-particle-system-2d*) + (a1-10 sv-16) + (a2-3 *launch-matrix*) + ) + (set! (-> a2-3 trans quad) (-> s5-3 quad)) + (t9-15 a0-23 a1-10 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -1390,7 +1374,6 @@ ;; WARN: Return type mismatch symbol vs none. (defun bombbot-spread-lightning-lazer ((arg0 lightning-control) (arg1 vector) (arg2 vector) (arg3 vector)) - (local-vars (sv-656 vector) (sv-672 vector) (sv-688 int) (sv-704 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1399,25 +1382,25 @@ (vf7 :class vf) ) (init-vf0-vector) - (set! sv-656 arg1) - (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((sv-656 arg1) + (s5-0 (new 'stack-no-clear 'vector)) + ) (set! (-> s5-0 quad) (-> sv-656 quad)) (let ((s4-0 (new 'stack-no-clear 'vector))) (set! (-> s4-0 quad) (-> arg2 quad)) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (set! sv-672 (new 'stack-no-clear 'vector)) - (let ((s2-0 (new 'stack-no-clear 'quaternion))) - (vector-length arg2) - (let ((s1-0 (new 'stack-no-clear 'vector))) - (set! (-> s1-0 quad) (-> arg3 quad)) - (let ((s0-0 (new 'stack-no-clear 'collide-query)) - (f30-0 6144.0) - ) - (vector-normalize! s4-0 f30-0) - (let ((v1-9 (-> sv-656 quad))) - (set! (-> sv-672 quad) v1-9) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (sv-672 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'quaternion)) + ) + (vector-length arg2) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (set! (-> s1-0 quad) (-> arg3 quad)) + (let ((s0-0 (new 'stack-no-clear 'collide-query)) + (f30-0 6144.0) ) - (set! sv-688 0) + (vector-normalize! s4-0 f30-0) + (set! (-> sv-672 quad) (-> sv-656 quad)) + (let ((sv-688 0)) (while (< sv-688 15) (let ((v1-11 s0-0)) (set! (-> v1-11 radius) 6144.0) @@ -1513,11 +1496,12 @@ (+! (-> s3-0 z) (rand-vu-float-range -409.6 409.6)) (set-point! arg0 (-> arg0 state points-to-draw) s3-0) (+! (-> arg0 state points-to-draw) 1) - (set! sv-704 (-> s0-0 best-other-tri normal)) - (quaternion-from-two-vectors! s2-0 s1-0 sv-704) - (vector-orient-by-quat! s4-0 s4-0 s2-0) - (set! (-> s1-0 quad) (-> sv-704 quad)) - (vector-flatten! s4-0 s4-0 sv-704) + (let ((sv-704 (-> s0-0 best-other-tri normal))) + (quaternion-from-two-vectors! s2-0 s1-0 sv-704) + (vector-orient-by-quat! s4-0 s4-0 s2-0) + (set! (-> s1-0 quad) (-> sv-704 quad)) + (vector-flatten! s4-0 s4-0 sv-704) + ) (vector-normalize! s4-0 f30-0) ) (else @@ -1529,7 +1513,7 @@ ) ) ) - (set! sv-688 (+ sv-688 1)) + (+! sv-688 1) ) ) ) @@ -1542,19 +1526,7 @@ ) (defmethod bombbot-method-182 ((this bombbot)) - (local-vars - (v1-28 symbol) - (sv-880 matrix) - (sv-896 (function vector vector quaternion vector)) - (sv-912 vector) - (sv-928 vector) - (sv-944 (function quaternion vector float quaternion)) - (sv-960 quaternion) - (sv-976 vector) - (sv-992 basic) - (sv-1008 process) - (sv-1024 (pointer process)) - ) + (local-vars (v1-28 symbol) (sv-1024 (pointer process))) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1563,8 +1535,9 @@ (vf7 :class vf) ) (init-vf0-vector) - (let ((s2-0 (handle->process (-> this focus handle)))) - (set! sv-880 (new 'stack-no-clear 'matrix)) + (let ((s2-0 (handle->process (-> this focus handle))) + (sv-880 (new 'stack-no-clear 'matrix)) + ) (let* ((a0-4 (-> this node-list data 6 bone transform)) (a2-0 (-> a0-4 quad 0)) (a1-1 (-> a0-4 quad 1)) @@ -1627,43 +1600,32 @@ (vector+! s1-0 (-> s3-0 start-pos) s5-0) (point-in-plane-<-point+normal! s0-0 s1-0 (-> s3-0 best-other-tri normal)) (vector-! s0-0 s0-0 s1-0) - (set! sv-896 vector-orient-by-quat!) - (set! sv-912 s0-0) - (set! sv-928 s0-0) - (set! sv-944 quaternion-vector-angle!) - (set! sv-960 (new 'stack-no-clear 'quaternion)) - (set! sv-976 (-> s3-0 best-other-tri normal)) - (let* ((a2-6 (rand-vu-float-range 0.0 65536.0)) - (a2-7 (sv-944 sv-960 sv-976 a2-6)) - ) - (sv-896 sv-912 sv-928 a2-7) - ) - (set! sv-992 (-> s3-0 best-other-tri collide-ptr)) - (let ((v1-25 (if (type? sv-992 collide-shape-prim) - sv-992 - ) - ) - ) + (vector-orient-by-quat! s0-0 s0-0 (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (-> s3-0 best-other-tri normal) + (rand-vu-float-range 0.0 65536.0) + ) + ) + (let ((v1-25 (the-as basic (as-type (-> s3-0 best-other-tri collide-ptr) collide-shape-prim)))) (when v1-25 (cond ((logtest? (-> (the-as collide-shape-prim v1-25) prim-core collide-as) (collide-spec vehicle-sphere)) - (set! sv-1008 (get-process *default-dead-pool* lightning-tracker #x4000)) - (set! v1-28 - (when sv-1008 - (set! sv-1024 (the-as (pointer process) v1-28)) - (let ((t9-9 (method-of-type lightning-tracker activate))) - (t9-9 - (the-as lightning-tracker sv-1008) - *entity-pool* - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) + (let ((sv-1008 (get-process *default-dead-pool* lightning-tracker #x4000))) + (set! v1-28 + (when sv-1008 + (set! sv-1024 (the-as (pointer process) v1-28)) + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-1008) + *entity-pool* + (symbol->string (-> lightning-tracker symbol)) + (the-as pointer #x70004000) + ) + (run-now-in-process sv-1008 lightning-tracker-init (-> *lightning-spec-id-table* 13) 30 #f #f #f #f) + (set! sv-1024 (-> sv-1008 ppointer)) + v1-28 ) - (run-now-in-process sv-1008 lightning-tracker-init (-> *lightning-spec-id-table* 13) 30 #f #f #f #f) - (set! sv-1024 (-> sv-1008 ppointer)) - v1-28 ) - ) + ) (set-point! (-> (the-as lightning-tracker (-> sv-1024 0)) lightning) 0 s1-0) (set! (-> (the-as lightning-tracker (-> sv-1024 0)) offset0 quad) (-> s1-0 quad)) (set! (-> (the-as lightning-tracker (-> sv-1024 0)) lightning state points-to-draw) 1) @@ -2388,13 +2350,6 @@ ) (defun bombbot-callback ((arg0 cspace) (arg1 transformq)) - (local-vars - (sv-176 (function quaternion quaternion quaternion quaternion)) - (sv-192 quaternion) - (sv-208 quaternion) - (sv-224 vector) - (sv-240 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -2436,25 +2391,24 @@ (set! (-> s1-0 quad) (-> v1-3 pos-offset quad)) (set! (-> s1-0 y) (* -2.0 (-> v1-3 main-y))) (new 'stack-no-clear 'vector) - (set! sv-224 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> v1-3 pos-offset) 1.0)) - ) - (set! sv-240 (vector-normalize-copy! (new 'stack-no-clear 'vector) s1-0 1.0)) - (let ((f0-8 (vector-vector-angle-safe sv-224 sv-240))) - (when (!= f0-8 0.0) - (set! sv-176 quaternion*!) - (set! sv-192 s3-0) - (set! sv-208 s3-0) - (let ((t9-4 quaternion-vector-angle!) - (a0-14 (new 'stack-no-clear 'quaternion)) - (a1-8 (new 'stack-no-clear 'vector)) - ) - (.lvf vf1 (&-> sv-224 quad)) - (.lvf vf2 (&-> sv-240 quad)) - (.outer.product.a.vf acc vf1 vf2) - (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> a1-8 quad) vf3) - (let ((a2-5 (t9-4 a0-14 a1-8 f0-8))) - (sv-176 sv-192 sv-208 a2-5) + (let* ((sv-224 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> v1-3 pos-offset) 1.0)) + (sv-240 (vector-normalize-copy! (new 'stack-no-clear 'vector) s1-0 1.0)) + (f0-8 (vector-vector-angle-safe sv-224 sv-240)) + ) + (when (!= f0-8 0.0) + (let ((sv-176 quaternion*!) + (sv-192 s3-0) + (sv-208 s3-0) + (t9-4 quaternion-vector-angle!) + (a0-14 (new 'stack-no-clear 'quaternion)) + (a1-8 (new 'stack-no-clear 'vector)) + ) + (.lvf vf1 (&-> sv-224 quad)) + (.lvf vf2 (&-> sv-240 quad)) + (.outer.product.a.vf acc vf1 vf2) + (.outer.product.b.vf vf3 vf2 vf1 acc) + (.svf (&-> a1-8 quad) vf3) + (sv-176 sv-192 sv-208 (t9-4 a0-14 a1-8 f0-8)) ) ) ) @@ -2532,7 +2486,6 @@ ) (defun bombbot-gun-swivel-callback ((arg0 cspace) (arg1 transformq)) - (local-vars (sv-128 vector) (sv-144 vector) (sv-160 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -2540,34 +2493,35 @@ ) (init-vf0-vector) (cspace<-parented-transformq-joint! arg0 arg1) - (let ((s3-0 (the-as bombbot (-> arg0 param1)))) - (set! sv-160 (new 'stack-no-clear 'vector)) - (let ((s4-0 (new 'stack-no-clear 'quaternion)) - (s0-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - (s5-0 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector))) - ) - (set! sv-144 sv-160) - (set! sv-128 (-> s3-0 target-pos)) - (let ((v0-2 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector)))) + (let ((s3-0 (the-as bombbot (-> arg0 param1))) + (sv-160 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'quaternion)) + (s0-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s5-0 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector))) + ) + (let ((sv-144 sv-160)) + (let ((sv-128 (-> s3-0 target-pos)) + (v0-2 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector))) + ) (.lvf vf4 (&-> sv-128 quad)) (.lvf vf5 (&-> v0-2 quad)) ) (.mov.vf.w vf6 vf0) (.sub.vf.xyz vf6 vf4 vf5) (.svf (&-> sv-144 quad) vf6) - (rot-zxy-from-vector! s0-0 (-> arg0 bone transform vector 2)) - (rot-zxy-from-vector! s0-0 *z-vector*) - (rot-zxy-from-vector! s1-0 sv-160) - (set! (-> s2-0 x) (deg- (-> s1-0 x) (-> s0-0 x))) - (set! (-> s2-0 y) (deg- (-> s1-0 y) (-> s0-0 y))) - (set! (-> s2-0 y) (deg- (-> s1-0 y) 0.0)) - (set! (-> s3-0 angle-turret) (deg-seek (-> s3-0 angle-turret) (-> s2-0 y) (* 36408.89 (seconds-per-frame)))) - (quaternion-vector-angle! s4-0 *up-vector* (-> s3-0 angle-turret)) - (quaternion->matrix (-> arg0 bone transform) s4-0) - (set! (-> arg0 bone transform trans quad) (-> s5-0 quad)) ) + (rot-zxy-from-vector! s0-0 (-> arg0 bone transform vector 2)) + (rot-zxy-from-vector! s0-0 *z-vector*) + (rot-zxy-from-vector! s1-0 sv-160) + (set! (-> s2-0 x) (deg- (-> s1-0 x) (-> s0-0 x))) + (set! (-> s2-0 y) (deg- (-> s1-0 y) (-> s0-0 y))) + (set! (-> s2-0 y) (deg- (-> s1-0 y) 0.0)) + (set! (-> s3-0 angle-turret) (deg-seek (-> s3-0 angle-turret) (-> s2-0 y) (* 36408.89 (seconds-per-frame)))) + (quaternion-vector-angle! s4-0 *up-vector* (-> s3-0 angle-turret)) + (quaternion->matrix (-> arg0 bone transform) s4-0) + (set! (-> arg0 bone transform trans quad) (-> s5-0 quad)) ) 0 (none) @@ -2575,7 +2529,6 @@ ) (defun bombbot-gun-callback ((arg0 cspace) (arg1 transformq)) - (local-vars (sv-112 vector) (sv-128 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -2590,15 +2543,17 @@ (s1-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) ) - (set! sv-128 s0-0) - (set! sv-112 (-> s4-0 target-pos)) - (let ((v0-1 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector)))) - (.lvf vf4 (&-> sv-112 quad)) - (.lvf vf5 (&-> v0-1 quad)) + (let ((sv-128 s0-0)) + (let ((sv-112 (-> s4-0 target-pos)) + (v0-1 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector))) + ) + (.lvf vf4 (&-> sv-112 quad)) + (.lvf vf5 (&-> v0-1 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-128 quad) vf6) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-128 quad) vf6) (rot-zxy-from-vector! s2-0 (-> arg0 bone transform vector 2)) (rot-zxy-from-vector! s1-0 s0-0) (set! (-> s3-0 x) (fmax -2730.6667 (fmin 2730.6667 (deg- (-> s1-0 x) (-> s2-0 x))))) @@ -2642,7 +2597,7 @@ ) (defmethod bombbot-method-183 ((this bombbot)) - (local-vars (at-0 int) (sv-160 vector) (sv-176 vector)) + (local-vars (at-0 int)) (with-pp (rlet ((vf0 :class vf) (vf1 :class vf) @@ -2666,13 +2621,11 @@ (-> this rigidbody state matrix) ) ) + (sv-160 (new 'stack-no-clear 'vector)) ) - (set! sv-160 (new 'stack-no-clear 'vector)) - (let ((v1-22 (-> *bombbot-spring-setup* s5-0 wpos2 quad))) - (set! (-> sv-160 quad) v1-22) - ) - (set! sv-176 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) + (set! (-> sv-160 quad) (-> *bombbot-spring-setup* s5-0 wpos2 quad)) + (let ((sv-176 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) @@ -2695,11 +2648,7 @@ (.sub.vf.xyz vf6 vf4 vf5) (.svf (&-> v1-36 quad) vf6) ) - (let ((a1-4 s1-0) - (v1-37 *null-vector*) - ) - (vector-! a1-4 sv-176 v1-37) - ) + (vector-! s1-0 sv-176 *null-vector*) (let ((f0-10 (vector-length s0-0))) (vector-float*! s2-0 s0-0 (/ 1.0 f0-10)) (let ((f0-12 (* 60.0 (+ -40.96 f0-10))) diff --git a/goal_src/jak2/levels/city/common/height-map.gc b/goal_src/jak2/levels/city/common/height-map.gc index 2dfa6089ca..d1842f0047 100644 --- a/goal_src/jak2/levels/city/common/height-map.gc +++ b/goal_src/jak2/levels/city/common/height-map.gc @@ -129,7 +129,6 @@ ) (defmethod debug-draw-mesh ((this xz-height-map) (arg0 vector)) - (local-vars (sv-80 int) (sv-96 int)) (rlet ((vf0 :class vf)) (init-vf0-vector) (let ((s5-0 (new 'stack-no-clear 'matrix))) @@ -140,39 +139,32 @@ (s4-0 (-> this x-dim)) (s3-0 (-> this z-dim)) ) - (let ((s2-0 (&-> (-> this data) 0))) + (let ((s2-0 (&-> this data 0))) (set! (-> s5-0 vector 0 z) (-> this z-offset)) (countdown (s1-0 s3-0) (let ((s0-0 s2-0)) (set! (-> s5-0 vector 0 x) (-> this x-offset)) (set! (-> s5-0 vector 0 y) (+ (-> this y-offset) (* (the float (-> s0-0 0)) (-> this y-scale)))) - (set! sv-80 (+ s4-0 -1)) - (while (nonzero? sv-80) - (set! sv-80 (+ sv-80 -1)) - (set! (-> s5-0 vector 1 quad) (-> s5-0 vector 0 quad)) - (+! (-> s5-0 vector 0 x) f28-0) - (set! s0-0 (&-> s0-0 1)) - (set! (-> s5-0 vector 0 y) (+ (-> this y-offset) (* (the float (-> s0-0 0)) (-> this y-scale)))) - (if (and (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (the-as vector (-> s5-0 vector))) - (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 1)) - ) - (add-debug-line - #t - (bucket-id debug2) - (the-as vector (-> s5-0 vector)) - (-> s5-0 vector 1) - *color-red* - #f - (the-as rgba -1) + (let ((sv-80 (+ s4-0 -1))) + (while (nonzero? sv-80) + (+! sv-80 -1) + (set! (-> s5-0 vector 1 quad) (-> s5-0 vector 0 quad)) + (+! (-> s5-0 vector 0 x) f28-0) + (set! s0-0 (&-> s0-0 1)) + (set! (-> s5-0 vector 0 y) (+ (-> this y-offset) (* (the float (-> s0-0 0)) (-> this y-scale)))) + (if (and (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 0)) + (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 1)) + ) + (add-debug-line #t (bucket-id debug2) (-> s5-0 vector 0) (-> s5-0 vector 1) *color-red* #f (the-as rgba -1)) ) - ) + ) ) ) (+! (-> s5-0 vector 0 z) f30-0) (&+! s2-0 s4-0) ) ) - (let ((s2-1 (&-> (-> this data) 0))) + (let ((s2-1 (&-> this data 0))) (set! (-> s5-0 vector 0 x) (-> this x-offset)) (countdown (s1-1 s4-0) (let ((s0-1 (the-as pointer s2-1))) @@ -180,28 +172,21 @@ (set! (-> s5-0 vector 0 y) (+ (-> this y-offset) (* (the float (-> (the-as (pointer int8) s0-1) 0)) (-> this y-scale))) ) - (set! sv-96 (+ s3-0 -1)) - (while (nonzero? sv-96) - (set! sv-96 (+ sv-96 -1)) - (set! (-> s5-0 vector 1 quad) (-> s5-0 vector 0 quad)) - (+! (-> s5-0 vector 0 z) f30-0) - (&+! s0-1 s4-0) - (set! (-> s5-0 vector 0 y) - (+ (-> this y-offset) (* (the float (-> (the-as (pointer int8) s0-1))) (-> this y-scale))) + (let ((sv-96 (+ s3-0 -1))) + (while (nonzero? sv-96) + (+! sv-96 -1) + (set! (-> s5-0 vector 1 quad) (-> s5-0 vector 0 quad)) + (+! (-> s5-0 vector 0 z) f30-0) + (&+! s0-1 s4-0) + (set! (-> s5-0 vector 0 y) + (+ (-> this y-offset) (* (the float (-> (the-as (pointer int8) s0-1))) (-> this y-scale))) + ) + (if (and (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 0)) + (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 1)) + ) + (add-debug-line #t (bucket-id debug2) (-> s5-0 vector 0) (-> s5-0 vector 1) *color-blue* #f (the-as rgba -1)) ) - (if (and (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (the-as vector (-> s5-0 vector))) - (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 1)) - ) - (add-debug-line - #t - (bucket-id debug2) - (the-as vector (-> s5-0 vector)) - (-> s5-0 vector 1) - *color-blue* - #f - (the-as rgba -1) - ) - ) + ) ) ) (+! (-> s5-0 vector 0 x) f28-0) diff --git a/goal_src/jak2/levels/city/common/nav-graph.gc b/goal_src/jak2/levels/city/common/nav-graph.gc index c0329a9d06..05fc8c2938 100644 --- a/goal_src/jak2/levels/city/common/nav-graph.gc +++ b/goal_src/jak2/levels/city/common/nav-graph.gc @@ -93,17 +93,13 @@ #t (bucket-id debug2) (the-as vector (&-> v1-8 id)) - (the-as vector (-> v1-8 dummy-node)) + (-> v1-8 dummy-node position) *color-yellow* ) ) ) (when (and (not (logtest? (-> this flags) (nav-node-flag-byte hidden))) - (let ((f0-6 (vector-vector-distance-squared gp-0 (camera-pos))) - (f1-2 327680.0) - ) - (and (< f0-6 (* f1-2 f1-2)) (sphere-in-view-frustum? s4-0)) - ) + (and (< (vector-vector-distance-squared gp-0 (camera-pos)) (square 327680.0)) (sphere-in-view-frustum? s4-0)) ) (add-debug-x #t (bucket-id debug2) gp-0 *color-red*) (let ((s4-1 add-debug-text-3d) @@ -894,17 +890,17 @@ (set! (-> a0-7 quad) (-> a2-0 position quad)) (set! (-> a0-7 w) 1.0) ) - (vector-! (-> s5-0 vector 2) (-> s5-0 vector 1) (the-as vector (-> s5-0 vector))) + (vector-! (-> s5-0 vector 2) (-> s5-0 vector 1) (-> s5-0 vector 0)) (let* ((f0-2 (vector-length (-> s5-0 vector 2))) (f1-2 (fmax (* 0.75 f0-2) (+ -8192.0 f0-2))) ) (vector-float*! (-> s5-0 vector 2) (-> s5-0 vector 2) (/ f1-2 f0-2)) ) - (vector+! (-> s5-0 trans) (the-as vector (-> s5-0 vector)) (-> s5-0 vector 2)) + (vector+! (-> s5-0 trans) (-> s5-0 vector 0) (-> s5-0 vector 2)) (add-debug-line #t (bucket-id debug2) - (the-as vector (-> s5-0 vector)) + (-> s5-0 vector 0) (-> s5-0 trans) (cond ((= (-> v1-9 id) #xffff) @@ -933,10 +929,9 @@ ;; WARN: Return type mismatch nav-node vs none. (defmethod nav-graph-method-10 ((this nav-graph) (arg0 vector) (arg1 int)) - (let* ((gp-0 (the-as nav-node #f)) - (f0-0 409600000.0) - (f30-0 (* f0-0 f0-0)) - ) + (let ((gp-0 (the-as nav-node #f)) + (f30-0 (square 409600000.0)) + ) (dotimes (s2-0 (-> this node-count)) (let ((s1-0 (-> this node-array s2-0)) (a1-1 (new 'stack-no-clear 'vector)) @@ -990,7 +985,6 @@ ) (defmethod nav-graph-method-39 ((this nav-graph)) - (local-vars (sv-80 entity-nav-mesh) (sv-96 entity-nav-mesh)) (dotimes (s5-0 (-> this node-count)) (let ((s4-0 (-> this node-array s5-0)) (s3-0 (new 'stack-no-clear 'vector)) @@ -1008,24 +1002,20 @@ (let ((s1-0 (-> v1-8 bsp nav-meshes))) (when (nonzero? s1-0) (dotimes (s0-0 (-> s1-0 length)) - (set! sv-80 (-> s1-0 s0-0)) - (-> sv-80 aid) - (set! sv-96 sv-80) - (let ((v1-16 (if (type? sv-96 entity-nav-mesh) - sv-96 - ) - ) - ) - (when v1-16 - (let ((a0-10 (-> v1-16 nav-mesh)) - (a1-5 (new 'stack-no-clear 'nav-find-poly-parms)) - ) - (vector-! (-> a1-5 point) s3-0 (-> a0-10 bounds)) - (set! (-> a1-5 y-threshold) 40960.0) - (set! (-> a1-5 ignore) (the-as uint 2)) - (if (find-poly-containing-point-local a0-10 a1-5) - (set! (-> s4-0 nav-mesh-id) (-> sv-80 aid)) - ) + (let ((sv-80 (-> s1-0 s0-0))) + (-> sv-80 aid) + (let ((v1-16 (as-type sv-80 entity-nav-mesh))) + (when v1-16 + (let ((a0-10 (-> v1-16 nav-mesh)) + (a1-5 (new 'stack-no-clear 'nav-find-poly-parms)) + ) + (vector-! (-> a1-5 point) s3-0 (-> a0-10 bounds)) + (set! (-> a1-5 y-threshold) 40960.0) + (set! (-> a1-5 ignore) (the-as uint 2)) + (if (find-poly-containing-point-local a0-10 a1-5) + (set! (-> s4-0 nav-mesh-id) (-> sv-80 aid)) + ) + ) ) ) ) @@ -1212,18 +1202,7 @@ ) (defmethod from-editor ((this nav-graph) (arg0 mysql-nav-graph) (arg1 symbol)) - (local-vars - (v1-4 symbol) - (v1-6 symbol) - (v1-37 symbol) - (sv-16 int) - (sv-32 int) - (sv-48 mysql-nav-node) - (sv-64 nav-branch) - (sv-80 nav-graph-link) - (sv-96 nav-node) - (sv-112 int) - ) + (local-vars (v1-4 symbol) (v1-6 symbol) (v1-37 symbol)) (set! (-> this node-count) 0) (set! (-> this branch-count) 0) (set! (-> this link-count) 0) @@ -1242,8 +1221,9 @@ (set! v1-6 (not (logtest? (-> s0-0 mysql-save-flag) (mysql-save-flag delete)))) (label cfg-7) (b! (not v1-6) cfg-27 :delay (nop!)) - (set! sv-16 (temp-edge-size s0-0)) - (let ((s1-0 (debug-add-node this sv-16))) + (let* ((sv-16 (temp-edge-size s0-0)) + (s1-0 (debug-add-node this sv-16)) + ) (b! (not s1-0) cfg-36 :delay (nop!)) (set! (-> s1-0 id) (the-as uint (if arg1 (-> s0-0 level-node-index) @@ -1262,62 +1242,64 @@ (break!) 0 ) - (let ((s0-1 (the-as object (-> s0-0 temp-edge-list)))) - (set! sv-32 sv-16) + (let ((s0-1 (the-as object (-> s0-0 temp-edge-list))) + (sv-32 sv-16) + ) (b! #t cfg-25 :delay (nop!)) (label cfg-15) - (set! sv-32 (+ sv-32 -1)) - (set! sv-64 (-> this branch-array s5-0)) - (set-src-node sv-64 s1-0) - (set-speed-limit sv-64 (-> (the-as mysql-nav-edge s0-1) speed_limit)) - (set-density sv-64 (-> (the-as mysql-nav-edge s0-1) density)) - (set-width sv-64 (-> (the-as mysql-nav-edge s0-1) width)) - (set! (-> sv-64 clock-type) (the-as nav-branch-clock-type (-> (the-as mysql-nav-edge s0-1) nav_clock_type))) - (set! (-> sv-64 clock-mask) (the-as nav-branch-clock-mask (-> (the-as mysql-nav-edge s0-1) nav_clock_mask))) - (set! sv-48 (-> arg0 node-array data (-> (the-as mysql-nav-edge s0-1) runtime-node-id-2))) - (let ((a0-23 (= arg1 #f))) - (b! a0-23 cfg-18 :likely-delay (set! v1-37 a0-23)) - ) - (set! v1-37 (= arg1 (-> sv-48 level_name))) - (label cfg-18) - (b! (not v1-37) cfg-23 :delay (nop!)) - (let ((t9-11 (method-of-type nav-branch set-dst-node)) - (a1-11 (-> this node-array (if arg1 - (-> sv-48 level-node-index) - (-> (the-as mysql-nav-edge s0-1) runtime-node-id-2) - ) - ) - ) + (+! sv-32 -1) + (let ((sv-64 (-> this branch-array s5-0))) + (set-src-node sv-64 s1-0) + (set-speed-limit sv-64 (-> (the-as mysql-nav-edge s0-1) speed_limit)) + (set-density sv-64 (-> (the-as mysql-nav-edge s0-1) density)) + (set-width sv-64 (-> (the-as mysql-nav-edge s0-1) width)) + (set! (-> sv-64 clock-type) (the-as nav-branch-clock-type (-> (the-as mysql-nav-edge s0-1) nav_clock_type))) + (set! (-> sv-64 clock-mask) (the-as nav-branch-clock-mask (-> (the-as mysql-nav-edge s0-1) nav_clock_mask))) + (let ((sv-48 (-> arg0 node-array data (-> (the-as mysql-nav-edge s0-1) runtime-node-id-2)))) + (let ((a0-23 (= arg1 #f))) + (b! a0-23 cfg-18 :likely-delay (set! v1-37 a0-23)) ) - (t9-11 sv-64 a1-11) + (set! v1-37 (= arg1 (-> sv-48 level_name))) + (label cfg-18) + (b! (not v1-37) cfg-23 :delay (nop!)) + (set-dst-node sv-64 (-> this node-array (if arg1 + (-> sv-48 level-node-index) + (-> (the-as mysql-nav-edge s0-1) runtime-node-id-2) + ) + ) + ) + (b! #t cfg-24 :delay (nop!)) + (label cfg-23) + (set-dst-node sv-64 (the-as nav-node #f)) + (let ((sv-112 (-> this link-count))) + (let ((sv-80 (-> this link-array sv-112))) + (set! (-> sv-80 dest-graph-id) (-> (lookup-level-info2 arg0 sv-48 #f) level-id)) + (set! (-> sv-80 src-branch-id) (the-as uint s5-0)) + (set! (-> sv-80 dest-node-id) (the-as uint (-> sv-48 level-node-index))) + (set! (-> sv-80 dest-graph) #f) + (let ((sv-96 (-> sv-80 dummy-node))) + (set! (-> sv-96 id) (the-as uint #xffff)) + (set! (-> sv-96 flags) (the-as nav-node-flag-byte (-> sv-48 nav_node_flag))) + (set-pos-xyz sv-96 (-> sv-48 position)) + (set-angle sv-96 (-> sv-48 angle)) + (set-radius sv-96 (-> sv-48 radius)) + (set! (-> sv-96 level) (-> sv-48 level_name)) + (set! (-> sv-96 nav-mesh-id) (-> sv-48 nav_mesh_id)) + ) + (set-dst-node sv-64 (-> sv-80 dummy-node)) + ) + (format #t "outputting link ~d~%" sv-112) + ) + ) ) - (b! #t cfg-24 :delay (nop!)) - (label cfg-23) - (set-dst-node sv-64 (the-as nav-node #f)) - (set! sv-112 (-> this link-count)) - (set! sv-80 (-> this link-array sv-112)) - (set! (-> sv-80 dest-graph-id) (-> (lookup-level-info2 arg0 sv-48 #f) level-id)) - (set! (-> sv-80 src-branch-id) (the-as uint s5-0)) - (set! (-> sv-80 dest-node-id) (the-as uint (-> sv-48 level-node-index))) - (set! (-> sv-80 dest-graph) #f) - (set! sv-96 (-> sv-80 dummy-node)) - (set! (-> sv-96 id) (the-as uint #xffff)) - (set! (-> sv-96 flags) (the-as nav-node-flag-byte (-> sv-48 nav_node_flag))) - (set-pos-xyz sv-96 (-> sv-48 position)) - (set-angle sv-96 (-> sv-48 angle)) - (set-radius sv-96 (-> sv-48 radius)) - (set! (-> sv-96 level) (-> sv-48 level_name)) - (set! (-> sv-96 nav-mesh-id) (-> sv-48 nav_mesh_id)) - (set-dst-node sv-64 (-> sv-80 dummy-node)) - (format #t "outputting link ~d~%" sv-112) (+! (-> this link-count) 1) (label cfg-24) (+! s5-0 1) (set! s0-1 (-> (the-as mysql-nav-edge s0-1) temp-next-edge)) + (label cfg-25) + (b! (nonzero? sv-32) cfg-15 :delay (nop!)) ) ) - (label cfg-25) - (b! (nonzero? sv-32) cfg-15 :delay (nop!)) (b! #t cfg-33 :delay (nop!)) (label cfg-27) (let ((v1-78 (the-as object (-> s0-0 temp-edge-list)))) diff --git a/goal_src/jak2/levels/city/common/pilot-states.gc b/goal_src/jak2/levels/city/common/pilot-states.gc index c4144d7bdb..17440536d6 100644 --- a/goal_src/jak2/levels/city/common/pilot-states.gc +++ b/goal_src/jak2/levels/city/common/pilot-states.gc @@ -208,14 +208,7 @@ (let* ((v1-67 (-> gp-0 accel-array)) (f0-27 (+ (* (-> v1-67 0 x) (-> v1-67 0 x)) (* (-> v1-67 0 z) (-> v1-67 0 z)))) ) - (if (or (and (-> self pilot as-daxter?) (let ((f1-20 1024000.0)) - (< (* f1-20 f1-20) f0-27) - ) - ) - (let ((f1-23 2048000.0)) - (< (* f1-23 f1-23) f0-27) - ) - ) + (if (or (and (-> self pilot as-daxter?) (< (square 1024000.0) f0-27)) (< (square 2048000.0) f0-27)) (go target-pilot-impact) ) ) @@ -751,24 +744,24 @@ ((-> target-pilot-start exit)) ) :code (behavior ((arg0 symbol) (arg1 attack-info)) - (local-vars (sv-16 attack-info)) (set-time! (-> self state-time)) (set! (-> self neck flex-blend) 0.0) - (set! sv-16 (-> self attack-info)) - (let ((v1-4 sv-16)) - (set! (-> v1-4 attacker) (the-as handle #f)) - (set! (-> v1-4 mode) 'generic) - (set! (-> v1-4 shove-back) 6144.0) - (set! (-> v1-4 shove-up) 4915.2) - (set! (-> v1-4 angle) #f) - (set! (-> v1-4 trans quad) (-> self control trans quad)) - (set! (-> v1-4 control) 0.0) - (set! (-> v1-4 invinc-time) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout))) - (set! (-> v1-4 damage) (-> *FACT-bank* health-default-inc)) + (let ((sv-16 (-> self attack-info))) + (let ((v1-4 sv-16)) + (set! (-> v1-4 attacker) (the-as handle #f)) + (set! (-> v1-4 mode) 'generic) + (set! (-> v1-4 shove-back) 6144.0) + (set! (-> v1-4 shove-up) 4915.2) + (set! (-> v1-4 angle) #f) + (set! (-> v1-4 trans quad) (-> self control trans quad)) + (set! (-> v1-4 control) 0.0) + (set! (-> v1-4 invinc-time) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout))) + (set! (-> v1-4 damage) (-> *FACT-bank* health-default-inc)) + ) + (combine! sv-16 arg1 self) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (go target-pilot-death (-> sv-16 mode)) ) - (combine! sv-16 arg1 self) - (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) - (go target-pilot-death (-> sv-16 mode)) ) :post target-no-stick-post ) diff --git a/goal_src/jak2/levels/city/common/trail.gc b/goal_src/jak2/levels/city/common/trail.gc index bea6207c88..d9eb437e3a 100644 --- a/goal_src/jak2/levels/city/common/trail.gc +++ b/goal_src/jak2/levels/city/common/trail.gc @@ -18,21 +18,10 @@ (set-vector! s4-0 (* 4096.0 (the float (-> a2-3 x))) 53248.0 (* 4096.0 (the float (-> a2-3 z))) 1.0) (set-vector! s3-0 (* 4096.0 (the float (-> v1-2 x))) 53248.0 (* 4096.0 (the float (-> v1-2 z))) 1.0) (vector-lerp! s5-0 s4-0 s3-0 0.5) - (let* ((s2-0 (math-camera-pos)) - (f0-12 (vector-vector-distance-squared s4-0 s2-0)) - (f1-8 819200.0) - ) - (when (or (< f0-12 (* f1-8 f1-8)) - (let ((f0-13 (vector-vector-distance-squared s3-0 s2-0)) - (f1-11 819200.0) - ) - (< f0-13 (* f1-11 f1-11)) - ) - (let ((f0-14 (vector-vector-distance-squared s5-0 s2-0)) - (f1-14 819200.0) - ) - (< f0-14 (* f1-14 f1-14)) - ) + (let ((s2-0 (math-camera-pos))) + (when (or (< (vector-vector-distance-squared s4-0 s2-0) (square 819200.0)) + (< (vector-vector-distance-squared s3-0 s2-0) (square 819200.0)) + (< (vector-vector-distance-squared s5-0 s2-0) (square 819200.0)) ) (add-debug-line #t (bucket-id debug2) s4-0 s3-0 *color-orange* #f (the-as rgba -1)) (let ((s4-1 add-debug-text-3d) @@ -56,18 +45,16 @@ (set-vector! s5-0 (* 4096.0 (the float (-> this x))) 53248.0 (* 4096.0 (the float (-> this z))) 1.0) (set! (-> s4-0 quad) (-> s5-0 quad)) (set! (-> s4-0 r) 4096.0) - (let ((f0-7 (vector-vector-distance-squared s5-0 (math-camera-pos))) - (f1-4 819200.0) - ) - (when (and (< f0-7 (* f1-4 f1-4)) (sphere-in-view-frustum? s4-0)) - (add-debug-x #t (bucket-id debug2) s5-0 *color-red*) - (let ((s4-1 add-debug-text-3d) - (s3-1 #t) - (s2-1 324) - ) - (format (clear *temp-string*) "~D" arg0) - (s4-1 s3-1 (the-as bucket-id s2-1) *temp-string* s5-0 (font-color cyan) (the-as vector2h #f)) - ) + (when (and (< (vector-vector-distance-squared s5-0 (math-camera-pos)) (square 819200.0)) + (sphere-in-view-frustum? s4-0) + ) + (add-debug-x #t (bucket-id debug2) s5-0 *color-red*) + (let ((s4-1 add-debug-text-3d) + (s3-1 #t) + (s2-1 324) + ) + (format (clear *temp-string*) "~D" arg0) + (s4-1 s3-1 (the-as bucket-id s2-1) *temp-string* s5-0 (font-color cyan) (the-as vector2h #f)) ) ) ) @@ -76,7 +63,6 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod debug-draw-cell ((this trail-graph) (arg0 int)) - (local-vars (sv-80 int) (sv-96 (function _varargs_ object))) (let* ((s5-0 (-> this conn-hash)) (s4-0 (-> s5-0 cell arg0)) (s3-0 (new 'stack-no-clear 'inline-array 'vector 2)) @@ -107,24 +93,10 @@ ) (let ((s1-0 add-debug-text-3d) (s0-0 #t) + (sv-80 324) ) - (set! sv-80 324) - (set! sv-96 format) - (let ((a0-20 (clear *temp-string*)) - (a1-5 "cell ~D (~D,~D)") - (a2-4 arg0) - (a3-4 (logand arg0 15)) - (t0-4 (/ arg0 16)) - ) - (sv-96 a0-20 a1-5 a2-4 a3-4 t0-4) - ) - (let ((a2-5 *temp-string*) - (a3-5 (-> s3-0 3)) - (t0-5 1) - (t1-4 #f) - ) - (s1-0 s0-0 (the-as bucket-id sv-80) a2-5 a3-5 (the-as font-color t0-5) (the-as vector2h t1-4)) - ) + (format (clear *temp-string*) "cell ~D (~D,~D)" arg0 (logand arg0 15) (/ arg0 16)) + (s1-0 s0-0 (the-as bucket-id sv-80) *temp-string* (-> s3-0 3) (font-color white) (the-as vector2h #f)) ) (countdown (s2-1 (-> s4-0 conn-count)) (let ((s1-1 (-> this conn (-> s5-0 conn-ids (+ s2-1 (-> s4-0 first-conn)))))) @@ -145,33 +117,33 @@ ;; WARN: new jak 2 until loop case, check carefully (defmethod debug-draw-path ((this trail-graph) (arg0 int) (arg1 (pointer uint16)) (arg2 vector) (arg3 vector) (arg4 rgba) (arg5 float)) - (local-vars (sv-48 int)) (let ((s0-0 (new 'stack-no-clear 'inline-array 'vector 2))) (set-vector! (-> s0-0 1) (+ (-> arg2 x) arg5) 53248.0 (+ (-> arg2 z) arg5) 1.0) - (set! sv-48 0) - (until #f - (set! (-> s0-0 0 quad) (-> s0-0 1 quad)) - (cond - ((< sv-48 arg0) - (let ((a0-7 (-> this node (-> arg1 sv-48)))) - (set-vector! - (-> s0-0 1) - (+ (* 4096.0 (the float (-> a0-7 x))) arg5) - 53248.0 - (+ (* 4096.0 (the float (-> a0-7 z))) arg5) - 1.0 + (let ((sv-48 0)) + (until #f + (set! (-> s0-0 0 quad) (-> s0-0 1 quad)) + (cond + ((< sv-48 arg0) + (let ((a0-7 (-> this node (-> arg1 sv-48)))) + (set-vector! + (-> s0-0 1) + (+ (* 4096.0 (the float (-> a0-7 x))) arg5) + 53248.0 + (+ (* 4096.0 (the float (-> a0-7 z))) arg5) + 1.0 + ) ) ) - ) - ((= sv-48 arg0) - (set-vector! (-> s0-0 1) (+ (-> arg3 x) arg5) 53248.0 (+ (-> arg3 z) arg5) 1.0) - ) - (else - (return #f) + ((= sv-48 arg0) + (set-vector! (-> s0-0 1) (+ (-> arg3 x) arg5) 53248.0 (+ (-> arg3 z) arg5) 1.0) + ) + (else + (return #f) + ) ) + (add-debug-line #t (bucket-id debug2) (-> s0-0 0) (-> s0-0 1) arg4 #f (the-as rgba -1)) + (+! sv-48 1) ) - (add-debug-line #t (bucket-id debug2) (-> s0-0 0) (-> s0-0 1) arg4 #f (the-as rgba -1)) - (set! sv-48 (+ sv-48 1)) ) ) #f @@ -382,7 +354,7 @@ (cond ((> t0-0 0) (let* ((a3-4 (-> this visgroup (+ t0-0 -1))) - (a0-2 (&-> (-> this visnode-ids) (-> a3-4 first-conn))) + (a0-2 (&-> this visnode-ids (-> a3-4 first-conn))) ) (countdown (a3-5 (-> a3-4 conn-count)) (let ((t0-8 (-> a1-2 (-> a0-2 0)))) @@ -415,7 +387,7 @@ (when (not (logtest? a2-4 a1-2)) (set! (-> arg0 cell-quads 0 byte a0-1) (logior a2-4 a1-2)) (let* ((v1-3 (-> this conn-hash cell v1-1)) - (s4-0 (&-> (-> this conn-hash conn-ids) (-> v1-3 first-conn))) + (s4-0 (&-> this conn-hash conn-ids (-> v1-3 first-conn))) ) (countdown (s3-0 (-> v1-3 conn-count)) (let* ((s2-0 (-> s4-0 0)) @@ -562,7 +534,7 @@ (cond ((> v1-1 0) (let* ((v1-4 (-> this visgroup (+ v1-1 -1))) - (s5-1 (&-> (-> this visnode-ids) (-> v1-4 first-conn))) + (s5-1 (&-> this visnode-ids (-> v1-4 first-conn))) (s4-0 (-> v1-4 conn-count)) ) (-> this visnode-ids) @@ -683,7 +655,7 @@ (defmethod get-dist-score ((this trail-node) (arg0 vector)) (let* ((f0-1 (- (-> arg0 x) (* 4096.0 (the float (-> this x))))) (f1-3 (- (-> arg0 z) (* 4096.0 (the float (-> this z))))) - (f0-4 (sqrtf (+ (* f0-1 f0-1) (* f1-3 f1-3)))) + (f0-4 (sqrtf (+ (square f0-1) (square f1-3)))) ) (the uint (fmin 65535.0 (* 0.00024414062 (* 8.0 f0-4)))) ) @@ -699,7 +671,7 @@ (set! (-> this goal-node-id) s5-0) (return 3) ) - (let ((s3-0 (&-> (-> this conn-ids) (-> s4-0 first-conn)))) + (let ((s3-0 (&-> this conn-ids (-> s4-0 first-conn)))) (countdown (s2-0 (-> s4-0 conn-count)) (let* ((a0-7 (-> this conn (-> s3-0 0))) (v1-12 (-> a0-7 flags)) @@ -793,7 +765,7 @@ (set! (-> s5-0 p1 quad) (-> s5-0 p0 quad)) (set! (-> s5-0 best-count) (the-as uint 0)) (set! (-> s5-0 best-dist) -1.0) - (let ((s2-0 (&-> (-> this conn-ids) (-> v1-2 first-conn)))) + (let ((s2-0 (&-> this conn-ids (-> v1-2 first-conn)))) (countdown (s1-0 (-> v1-2 conn-count)) (let* ((v1-4 (-> this conn (-> s2-0 0))) (s0-0 (-> v1-4 tail-id)) diff --git a/goal_src/jak2/levels/city/ctywide-obs.gc b/goal_src/jak2/levels/city/ctywide-obs.gc index f9f4884e08..c6273e922a 100644 --- a/goal_src/jak2/levels/city/ctywide-obs.gc +++ b/goal_src/jak2/levels/city/ctywide-obs.gc @@ -190,14 +190,13 @@ (defmethod security-wall-method-24 ((this security-wall)) (let ((s4-0 *target*)) (when s4-0 - (let* ((f0-0 (vector-vector-distance-squared (-> this root trans) (-> s4-0 control trans))) - (f30-0 (+ 40960.0 (-> this root root-prim local-sphere w))) - (f1-1 f30-0) - ) - (when (< f0-0 (* f1-1 f1-1)) + (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (-> s4-0 control trans))) + (f30-0 (+ 40960.0 (-> this root root-prim local-sphere w))) + ) + (when (< f0-0 (square f30-0)) (let ((s5-0 (new 'stack-no-clear 'inline-array 'vector 1))) (set! (-> s5-0 0 quad) (-> s4-0 control trans quad)) - (when (< (vector-vector-distance-squared (-> this root trans) (-> this target-pos)) (* f30-0 f30-0)) + (when (< (vector-vector-distance-squared (-> this root trans) (-> this target-pos)) (square f30-0)) (let ((f0-3 (vector4-dot (-> this target-pos) (the-as vector (-> this plane)))) (f1-7 (vector4-dot (-> s5-0 0) (the-as vector (-> this plane)))) ) @@ -500,12 +499,7 @@ (set! (-> v0-8 x) 0.0) (set! (-> v0-8 y) (* 0.00024414062 (/ arg1 2))) (set! (-> v0-8 z) 0.0) - (let ((f0-20 0.5) - (f1-7 (* f30-1 f30-1)) - (f2-2 arg1) - ) - (set! (-> v0-8 w) (* f0-20 (sqrtf (+ f1-7 (* f2-2 f2-2))))) - ) + (set! (-> v0-8 w) (* 0.5 (sqrtf (+ (square f30-1) (square arg1))))) v0-8 ) ) @@ -1409,11 +1403,9 @@ (let ((gp-2 (handle->process (-> self focus handle)))) (when (and gp-2 (and *traffic-engine* - (let ((f0-0 (vector-vector-xz-distance-squared (get-trans (the-as process-focusable gp-2) 0) (-> self root trans))) - (f1-0 409600.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared (get-trans (the-as process-focusable gp-2) 0) (-> self root trans)) + (square 409600.0) + ) (not (-> self destroyed)) ) ) @@ -1783,7 +1775,6 @@ ) (defmethod cty-guard-turret-method-35 ((this cty-guard-turret)) - (local-vars (sv-192 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1830,69 +1821,67 @@ ) (let ((s3-1 (vector-! (new 'stack-no-clear 'vector) s4-0 s0-0)) (s1-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (sv-192 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) ) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (-> this node-list data 6 bone transform) - (-> this node-list data 7 bone transform) - (-> this node-list data 8 bone transform) - (vector-rotate90-around-y! sv-192 s3-1) - (set! (-> sv-192 y) 0.0) - (vector-normalize! sv-192 1.0) - (let* ((f26-0 (vector-vector-xz-distance-squared s0-0 s4-0)) - (f0-4 7389.184) - (f28-0 (* f0-4 f0-4)) - (t9-6 vector-vector-xz-distance-squared) - (a0-13 (new 'stack-no-clear 'vector)) - ) - (let ((v1-27 7389.184)) - (.mov vf7 v1-27) + (-> this node-list data 6 bone transform) + (-> this node-list data 7 bone transform) + (-> this node-list data 8 bone transform) + (vector-rotate90-around-y! sv-192 s3-1) + (set! (-> sv-192 y) 0.0) + (vector-normalize! sv-192 1.0) + (let ((f26-0 (vector-vector-xz-distance-squared s0-0 s4-0)) + (f28-0 (square 7389.184)) + (t9-6 vector-vector-xz-distance-squared) + (a0-13 (new 'stack-no-clear 'vector)) ) - (.lvf vf5 (&-> sv-192 quad)) - (.lvf vf4 (&-> s0-0 quad)) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-13 quad) vf6) - (let* ((f2-0 (t9-6 a0-13 s4-0)) - (f28-1 (acos (fmax -1.0 (fmin 1.0 (/ (- (- f26-0 f28-0) f2-0) (* -2.0 (sqrtf f2-0) (sqrtf f28-0))))))) - ) - (let ((s0-1 (new 'stack-no-clear 'vector)) - (s4-1 (new 'stack-no-clear 'vector)) - ) - (if (< f28-1 11832.889) - (set! f28-1 11832.889) - ) - (rot-zxy-from-vector! s0-1 s1-0) - (rot-zxy-from-vector! s2-0 s3-1) - (set! (-> s4-1 x) (deg- (-> s2-0 x) (-> s0-1 x))) - (set! (-> s4-1 y) (deg- (-> s2-0 y) (-> s0-1 y))) - (cond - ((focus-test? (the-as process-focusable s5-0) pilot) - (set! (-> this angle-turret) (deg-seek (-> this angle-turret) (-> s4-1 y) (* 36408.89 (seconds-per-frame)))) - (set! (-> this angle-guns) (deg-seek (-> this angle-guns) (-> s4-1 x) (* 7281.778 (seconds-per-frame)))) - ) - (else - (set! (-> this angle-turret) (deg-seek (-> this angle-turret) (-> s4-1 y) (* 18204.445 (seconds-per-frame)))) - (set! (-> this angle-guns) (deg-seek (-> this angle-guns) (-> s4-1 x) (* 7281.778 (seconds-per-frame)))) - ) + (let ((v1-27 7389.184)) + (.mov vf7 v1-27) + ) + (.lvf vf5 (&-> sv-192 quad)) + (.lvf vf4 (&-> s0-0 quad)) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a0-13 quad) vf6) + (let* ((f2-0 (t9-6 a0-13 s4-0)) + (f28-1 (acos (fmax -1.0 (fmin 1.0 (/ (- (- f26-0 f28-0) f2-0) (* -2.0 (sqrtf f2-0) (sqrtf f28-0))))))) + ) + (let ((s0-1 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack-no-clear 'vector)) ) - (quaternion-axis-angle! (-> this jm-turret quat) 0.0 1.0 0.0 (-> this angle-turret)) - (when (= (+ (fabs (- (-> this angle-turret) (-> s4-1 y))) (fabs (- (-> this angle-guns) (-> s4-1 x)))) 0.0) - (set! (-> this next-time-shot) (+ (current-time) (seconds 1))) - (set! (-> this num-shots) (the-as uint 0)) - 0 + (if (< f28-1 11832.889) + (set! f28-1 11832.889) + ) + (rot-zxy-from-vector! s0-1 s1-0) + (rot-zxy-from-vector! s2-0 s3-1) + (set! (-> s4-1 x) (deg- (-> s2-0 x) (-> s0-1 x))) + (set! (-> s4-1 y) (deg- (-> s2-0 y) (-> s0-1 y))) + (cond + ((focus-test? (the-as process-focusable s5-0) pilot) + (set! (-> this angle-turret) (deg-seek (-> this angle-turret) (-> s4-1 y) (* 36408.89 (seconds-per-frame)))) + (set! (-> this angle-guns) (deg-seek (-> this angle-guns) (-> s4-1 x) (* 7281.778 (seconds-per-frame)))) + ) + (else + (set! (-> this angle-turret) (deg-seek (-> this angle-turret) (-> s4-1 y) (* 18204.445 (seconds-per-frame)))) + (set! (-> this angle-guns) (deg-seek (-> this angle-guns) (-> s4-1 x) (* 7281.778 (seconds-per-frame)))) ) ) - (let ((s5-1 (new 'stack-no-clear 'quaternion))) - (let ((f0-42 (/ 45511.11 (/ f30-0 METER_LENGTH)))) - (quaternion-axis-angle! s5-1 1.0 0.0 0.0 (fmax (fmin (-> this angle-guns) f0-42) (- f0-42))) - ) - (quaternion*! - (-> this jm-gunsL quat) - (quaternion-axis-angle! (new 'stack-no-clear 'quaternion) 0.0 1.0 0.0 (+ -16384.0 f28-1)) - s5-1 - ) + (quaternion-axis-angle! (-> this jm-turret quat) 0.0 1.0 0.0 (-> this angle-turret)) + (when (= (+ (fabs (- (-> this angle-turret) (-> s4-1 y))) (fabs (- (-> this angle-guns) (-> s4-1 x)))) 0.0) + (set! (-> this next-time-shot) (+ (current-time) (seconds 1))) + (set! (-> this num-shots) (the-as uint 0)) + 0 + ) + ) + (let ((s5-1 (new 'stack-no-clear 'quaternion))) + (let ((f0-42 (/ 45511.11 (/ f30-0 METER_LENGTH)))) + (quaternion-axis-angle! s5-1 1.0 0.0 0.0 (fmax (fmin (-> this angle-guns) f0-42) (- f0-42))) + ) + (quaternion*! + (-> this jm-gunsL quat) + (quaternion-axis-angle! (new 'stack-no-clear 'quaternion) 0.0 1.0 0.0 (+ -16384.0 f28-1)) + s5-1 ) ) ) @@ -1947,11 +1936,9 @@ (let ((gp-0 (handle->process (-> self focus handle)))) (cond ((and gp-0 - (let ((f0-5 (vector-vector-xz-distance-squared (get-trans (the-as process-focusable gp-0) 0) (-> self root trans))) - (f1-0 491520.0) - ) - (< f0-5 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared (get-trans (the-as process-focusable gp-0) 0) (-> self root trans)) + (square 491520.0) + ) ) (cond ((and (>= (-> self id) 0) (task-node-open? (game-task-node city-power-resolution))) @@ -2224,9 +2211,9 @@ (cond ((or (focus-test? (the-as vehicle s5-0) dead inactive) (not (logtest? (-> (the-as vehicle s5-0) flags) (rigid-body-object-flag waiting-for-player))) - (let ((f0-0 (-> this test-sphere r))) - (< (* f0-0 f0-0) (vector-vector-distance-squared (-> (the-as vehicle s5-0) root trans) (-> this test-sphere))) - ) + (< (square (-> this test-sphere r)) + (vector-vector-distance-squared (-> (the-as vehicle s5-0) root trans) (-> this test-sphere)) + ) ) (logclear! (-> (the-as vehicle s5-0) flags) (rigid-body-object-flag persistent)) (set! (-> this vehicle) (the-as handle #f)) @@ -2333,17 +2320,13 @@ (set-time! (-> self state-time)) (parking-spot-method-21 self) (when (not (-> self spawned)) - (let ((f0-0 (vector-vector-distance-squared (camera-pos) (-> self test-sphere))) - (f1-0 327680.0) - ) - (when (< (* f1-0 f1-0) f0-0) - (let ((f1-3 614400.0)) - (when (or (< (* f1-3 f1-3) f0-0) (not (sphere-in-view-frustum? (-> self test-sphere)))) - (let ((a1-1 (get-random-parking-spot-type *traffic-engine*))) - (if (!= a1-1 (traffic-type traffic-type-21)) - (parking-spot-method-23 self (the-as uint a1-1)) - ) - ) + (let ((f0-0 (vector-vector-distance-squared (camera-pos) (-> self test-sphere)))) + (when (< (square 327680.0) f0-0) + (when (or (< (square 614400.0) f0-0) (not (sphere-in-view-frustum? (-> self test-sphere)))) + (let ((a1-1 (get-random-parking-spot-type *traffic-engine*))) + (if (!= a1-1 (traffic-type traffic-type-21)) + (parking-spot-method-23 self (the-as uint a1-1)) + ) ) ) ) @@ -3028,7 +3011,6 @@ (remove-setting! 'mode-name) ) :trans (behavior () - (local-vars (sv-272 vector) (sv-288 quaternion)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -3040,19 +3022,16 @@ (when (!= (-> self time) -1.0) (let ((gp-0 (new 'stack-no-clear 'vector))) (new 'stack-no-clear 'vector) - (let ((s5-0 gp-0) - (s4-0 (-> self root trans)) - (s3-0 vector-orient-by-quat!) - (s2-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'static 'vector :y 16384.0 :z 40960.0 :w 1.0)) - (s0-0 quaternion-rotate-local-y!) - ) - (set! sv-272 (new 'stack-no-clear 'vector)) - (set! sv-288 (-> self root quat)) - (let ((a2-0 (* 182.04445 (* 30.0 (sin (* 7281.778 (-> self time))))))) - (vector+! s5-0 s4-0 (s3-0 s2-0 s1-0 (s0-0 (the-as quaternion sv-272) sv-288 a2-0))) - ) - ) + (vector+! gp-0 (-> self root trans) (vector-orient-by-quat! + (new 'stack-no-clear 'vector) + (new 'static 'vector :y 16384.0 :z 40960.0 :w 1.0) + (quaternion-rotate-local-y! + (the-as quaternion (new 'stack-no-clear 'vector)) + (-> self root quat) + (* 182.04445 (* 30.0 (sin (* 7281.778 (-> self time))))) + ) + ) + ) (set! (-> *camera* slave 0 trans quad) (-> gp-0 quad)) (let ((t9-3 forward-down->inv-matrix) (a0-5 (-> *camera* slave 0 tracking)) @@ -3207,31 +3186,6 @@ (remove-setting! 'mode-name) ) :trans (behavior () - (local-vars - (sv-352 (function _varargs_ object)) - (sv-368 string) - (sv-384 (function string font-context symbol int bucket-id float)) - (sv-400 (function _varargs_ object)) - (sv-416 string) - (sv-432 (function string font-context symbol int bucket-id float)) - (sv-448 (function _varargs_ object)) - (sv-464 string) - (sv-480 (function string font-context symbol int bucket-id float)) - (sv-496 (function _varargs_ object)) - (sv-512 string) - (sv-528 (function string font-context symbol int bucket-id float)) - (sv-544 (function _varargs_ object)) - (sv-560 string) - (sv-576 (function string font-context symbol int bucket-id float)) - (sv-592 (function _varargs_ object)) - (sv-608 string) - (sv-624 (function string font-context symbol int bucket-id float)) - (sv-640 (function _varargs_ object)) - (sv-656 string) - (sv-672 (function string font-context symbol int bucket-id float)) - (sv-688 (function _varargs_ object)) - (sv-704 string) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -3373,11 +3327,7 @@ (set! (-> a0-60 color) (font-color progress-old-yellow)) ) (let ((s0-0 print-game-text)) - (set! sv-352 format) - (set! sv-368 (clear *temp-string*)) - (let ((a1-5 (lookup-text! *common-text* (text-id select-event) #f))) - (sv-352 sv-368 a1-5) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id select-event) #f)) (s0-0 *temp-string* s1-0 #f 44 (bucket-id progress)) ) (set-height! s1-0 s4-9) @@ -3398,115 +3348,45 @@ (let ((v1-59 s0-1)) (cond ((zero? v1-59) - (set! sv-384 print-game-text) - (set! sv-400 format) - (set! sv-416 (clear *temp-string*)) - (let ((a1-9 (lookup-text! *common-text* (text-id board-name) #f))) - (sv-400 sv-416 a1-9) - ) - (let ((a0-73 *temp-string*) - (a1-10 s1-0) - (a2-6 #f) - (a3-4 44) - (t0-4 320) - ) - (sv-384 a0-73 a1-10 a2-6 a3-4 (the-as bucket-id t0-4)) + (let ((sv-384 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id board-name) #f)) + (sv-384 *temp-string* s1-0 #f 44 (bucket-id progress)) ) ) ((= v1-59 1) - (set! sv-432 print-game-text) - (set! sv-448 format) - (set! sv-464 (clear *temp-string*)) - (let ((a1-12 (lookup-text! *common-text* (text-id race-class3) #f))) - (sv-448 sv-464 a1-12) - ) - (let ((a0-79 *temp-string*) - (a1-13 s1-0) - (a2-8 #f) - (a3-5 44) - (t0-5 320) - ) - (sv-432 a0-79 a1-13 a2-8 a3-5 (the-as bucket-id t0-5)) + (let ((sv-432 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id race-class3) #f)) + (sv-432 *temp-string* s1-0 #f 44 (bucket-id progress)) ) ) ((= v1-59 2) - (set! sv-480 print-game-text) - (set! sv-496 format) - (set! sv-512 (clear *temp-string*)) - (let ((a1-15 (lookup-text! *common-text* (text-id race-class2) #f))) - (sv-496 sv-512 a1-15) - ) - (let ((a0-85 *temp-string*) - (a1-16 s1-0) - (a2-10 #f) - (a3-6 44) - (t0-6 320) - ) - (sv-480 a0-85 a1-16 a2-10 a3-6 (the-as bucket-id t0-6)) + (let ((sv-480 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id race-class2) #f)) + (sv-480 *temp-string* s1-0 #f 44 (bucket-id progress)) ) ) ((= v1-59 3) - (set! sv-528 print-game-text) - (set! sv-544 format) - (set! sv-560 (clear *temp-string*)) - (let ((a1-18 (lookup-text! *common-text* (text-id race-class1) #f))) - (sv-544 sv-560 a1-18) - ) - (let ((a0-91 *temp-string*) - (a1-19 s1-0) - (a2-12 #f) - (a3-7 44) - (t0-7 320) - ) - (sv-528 a0-91 a1-19 a2-12 a3-7 (the-as bucket-id t0-7)) + (let ((sv-528 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id race-class1) #f)) + (sv-528 *temp-string* s1-0 #f 44 (bucket-id progress)) ) ) ((= v1-59 4) - (set! sv-576 print-game-text) - (set! sv-592 format) - (set! sv-608 (clear *temp-string*)) - (let ((a1-21 (lookup-text! *common-text* (text-id reverse-race-class3) #f))) - (sv-592 sv-608 a1-21) - ) - (let ((a0-97 *temp-string*) - (a1-22 s1-0) - (a2-14 #f) - (a3-8 44) - (t0-8 320) - ) - (sv-576 a0-97 a1-22 a2-14 a3-8 (the-as bucket-id t0-8)) + (let ((sv-576 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id reverse-race-class3) #f)) + (sv-576 *temp-string* s1-0 #f 44 (bucket-id progress)) ) ) ((= v1-59 5) - (set! sv-624 print-game-text) - (set! sv-640 format) - (set! sv-656 (clear *temp-string*)) - (let ((a1-24 (lookup-text! *common-text* (text-id reverse-race-class2) #f))) - (sv-640 sv-656 a1-24) - ) - (let ((a0-103 *temp-string*) - (a1-25 s1-0) - (a2-16 #f) - (a3-9 44) - (t0-9 320) - ) - (sv-624 a0-103 a1-25 a2-16 a3-9 (the-as bucket-id t0-9)) + (let ((sv-624 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id reverse-race-class2) #f)) + (sv-624 *temp-string* s1-0 #f 44 (bucket-id progress)) ) ) ((= v1-59 6) - (set! sv-672 print-game-text) - (set! sv-688 format) - (set! sv-704 (clear *temp-string*)) - (let ((a1-27 (lookup-text! *common-text* (text-id reverse-race-class1) #f))) - (sv-688 sv-704 a1-27) - ) - (let ((a0-108 *temp-string*) - (a1-28 s1-0) - (a2-18 #f) - (a3-10 44) - (t0-10 320) - ) - (sv-672 a0-108 a1-28 a2-18 a3-10 (the-as bucket-id t0-10)) + (let ((sv-672 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id reverse-race-class1) #f)) + (sv-672 *temp-string* s1-0 #f 44 (bucket-id progress)) ) ) ) diff --git a/goal_src/jak2/levels/city/ctywide-part.gc b/goal_src/jak2/levels/city/ctywide-part.gc index b45252dfbd..bdd1b94d10 100644 --- a/goal_src/jak2/levels/city/ctywide-part.gc +++ b/goal_src/jak2/levels/city/ctywide-part.gc @@ -298,7 +298,7 @@ (set! (-> s4-0 x) f0-0) (set! (-> s4-0 y) f1-0) (set! (-> s4-0 z) f2-0) - (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-0)) (square f0-0)))) ) (quaternion-rotate-y! s4-0 s4-0 (+ 8192.0 (-> s5-0 sprite flag-rot-sy z))) (let ((v1-5 arg2)) diff --git a/goal_src/jak2/levels/city/ctywide-tasks.gc b/goal_src/jak2/levels/city/ctywide-tasks.gc index e54ebf22f1..23a78a4824 100644 --- a/goal_src/jak2/levels/city/ctywide-tasks.gc +++ b/goal_src/jak2/levels/city/ctywide-tasks.gc @@ -181,7 +181,8 @@ (talker-spawn-func (-> *talker-speech* 38) *entity-pool* (target-pos 0) (the-as region #f)) ) (wait-for-speech-end (-> self sound-id 0)) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (while (or (not *target*) (focus-test? *target* dead teleporting)) (suspend) ) @@ -230,7 +231,8 @@ (talker-spawn-func (-> *talker-speech* 31) *entity-pool* (target-pos 0) (the-as region #f)) ) (wait-for-speech-end (-> self sound-id 0)) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (while (or (not *target*) (focus-test? *target* dead teleporting)) (suspend) ) @@ -238,7 +240,8 @@ (talker-spawn-func (-> *talker-speech* 35) *entity-pool* (target-pos 0) (the-as region #f)) ) (wait-for-speech-end (-> self sound-id 0)) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (while (or (not *target*) (focus-test? *target* dead teleporting)) (suspend) ) @@ -259,7 +262,8 @@ ) (wait-for-speech-end (-> self sound-id 0)) (set! (-> self sub-state) (the-as uint 2)) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (go-virtual complete) (none) ) @@ -332,7 +336,8 @@ (talker-spawn-func (-> *talker-speech* 35) *entity-pool* (target-pos 0) (the-as region #f)) ) (wait-for-speech-end (-> self sound-id 0)) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (set! (-> self sound-id 0) (talker-spawn-func (-> *talker-speech* 36) *entity-pool* (target-pos 0) (the-as region #f)) ) @@ -346,7 +351,8 @@ (talker-spawn-func (-> *talker-speech* 37) *entity-pool* (target-pos 0) (the-as region #f)) ) (wait-for-speech-end (-> self sound-id 0)) - (suspend-for (seconds 3)) + (suspend-for (seconds 3) + ) (go-virtual complete) (none) ) @@ -410,10 +416,8 @@ (lambda :behavior task-manager () (check-time self) - (let ((f0-0 (vector-vector-distance-squared (target-pos 0) (-> self end-pos))) - (f1-0 49152.0) - ) - (if (>= (* f1-0 f1-0) f0-0) + (let ((f0-0 (vector-vector-distance-squared (target-pos 0) (-> self end-pos)))) + (if (>= (square 49152.0) f0-0) (go-virtual complete) ) ) @@ -431,9 +435,7 @@ (send-event *traffic-manager* 'set-target-level 1.0) (until (or v1-7 (and *target* (focus-test? *target* pilot))) (suspend) - (let ((f0-0 122880.0)) - (set! v1-7 (< (* f0-0 f0-0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0)))) - ) + (set! v1-7 (< (square 122880.0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0)))) ) (set-setting! 'airlock #f 0.0 0) (set-time! (-> self start-time)) @@ -758,10 +760,8 @@ (lambda :behavior task-manager () (check-time self) - (let ((f0-0 (vector-vector-distance-squared (target-pos 0) (-> self end-pos))) - (f1-0 49152.0) - ) - (if (>= (* f1-0 f1-0) f0-0) + (let ((f0-0 (vector-vector-distance-squared (target-pos 0) (-> self end-pos)))) + (if (>= (square 49152.0) f0-0) (go-virtual complete) ) ) diff --git a/goal_src/jak2/levels/city/kiddogescort/crocesc-states.gc b/goal_src/jak2/levels/city/kiddogescort/crocesc-states.gc index c19fef59cb..96c8bb819b 100644 --- a/goal_src/jak2/levels/city/kiddogescort/crocesc-states.gc +++ b/goal_src/jak2/levels/city/kiddogescort/crocesc-states.gc @@ -356,12 +356,7 @@ (logclear! (-> self bot-flags) (bot-flags bf15)) (go-idle-or-move self) ) - (let* ((s5-0 (handle->process (-> self kid-handle))) - (a2-0 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((a2-0 (the-as process (as-type (handle->process (-> self kid-handle)) process-focusable)))) (if a2-0 (put-rider-in-seat (the-as vehicle gp-0) (-> self vehicle-seat-index) (the-as process-focusable a2-0)) ) @@ -390,7 +385,6 @@ (check-vehicle-exit self) ) :code (behavior () - (local-vars (sv-128 float)) (ja-channel-push! 1 (seconds 0.1)) (let ((gp-0 (new 'stack-no-clear 'matrix))) (ja-no-eval :group! crocadog-escort-jump-in-vehicle-ja @@ -411,30 +405,21 @@ (until (ja-done? 0) (let ((s3-1 (handle->process (-> self vehicle-handle)))) (quaternion-copy! (the-as quaternion (-> gp-0 vector 2)) (-> (the-as vehicle s3-1) root quat)) - (compute-seat-position (the-as vehicle s3-1) (the-as vector (-> gp-0 vector)) (-> self vehicle-seat-index)) + (compute-seat-position (the-as vehicle s3-1) (-> gp-0 vector 0) (-> self vehicle-seat-index)) ) - (vector-! (-> gp-0 vector 1) (the-as vector (-> gp-0 vector)) s5-2) - (let ((s3-2 lerp-scale) - (s2-0 0.0) - (s1-0 1.0) - (s0-0 (ja-aframe-num 0)) - ) - (set! sv-128 (ja-aframe 1.0 0)) - (let* ((t0-0 (ja-aframe 4.0 0)) - (f30-0 (s3-2 s2-0 s1-0 s0-0 sv-128 t0-0)) - ) - (quaternion-rotate-local-y! - (the-as quaternion (-> gp-0 vector 2)) - (the-as quaternion (-> gp-0 vector 2)) - (* f30-0 (if (zero? (-> self vehicle-seat-index)) - -16384.0 - 16384.0 - ) - ) - ) - (quaternion-slerp! (-> self root quat) s4-0 (the-as quaternion (-> gp-0 vector 2)) f30-0) - (vector+float*! (-> self root trans) s5-2 (-> gp-0 vector 1) f30-0) + (vector-! (-> gp-0 vector 1) (-> gp-0 vector 0) s5-2) + (let ((f30-0 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 1.0 0) (ja-aframe 4.0 0)))) + (quaternion-rotate-local-y! + (the-as quaternion (-> gp-0 vector 2)) + (the-as quaternion (-> gp-0 vector 2)) + (* f30-0 (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) ) + (quaternion-slerp! (-> self root quat) s4-0 (the-as quaternion (-> gp-0 vector 2)) f30-0) + (vector+float*! (-> self root trans) s5-2 (-> gp-0 vector 1) f30-0) ) (suspend) (ja :num! (seek! (ja-aframe 5.0 0) 0.5)) @@ -456,12 +441,12 @@ ) ) (vector-matrix*! - (the-as vector (-> gp-0 vector)) + (-> gp-0 vector 0) (-> self local-seat-pos) (-> (the-as vehicle s4-2) node-list data 0 bone transform) ) ) - (vector-! (-> gp-0 vector 1) (the-as vector (-> gp-0 vector)) s5-3) + (vector-! (-> gp-0 vector 1) (-> gp-0 vector 0) s5-3) (let ((f0-16 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 5.0 0) (ja-aframe 7.0 0)))) (vector+float*! (-> self root trans) s5-3 (-> gp-0 vector 1) f0-16) ) @@ -600,7 +585,8 @@ (set! (-> self vehicle-seat-index) -1) (set! (-> self vehicle-handle) (the-as handle #f)) (logclear! (-> self bot-flags) (bot-flags bf16)) - (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) ;; og:preserve-this fix potential use-after-free bug + (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) + ;; og:preserve-this fix potential use-after-free bug (if (-> self nav) (let ((v1-5 (-> self nav))) (logclear! (-> v1-5 shape nav-flags) (nav-flags has-extra-sphere)) diff --git a/goal_src/jak2/levels/city/kiddogescort/crocesc.gc b/goal_src/jak2/levels/city/kiddogescort/crocesc.gc index f96819081f..a0c2edefce 100644 --- a/goal_src/jak2/levels/city/kiddogescort/crocesc.gc +++ b/goal_src/jak2/levels/city/kiddogescort/crocesc.gc @@ -182,7 +182,7 @@ (defmethod general-event-handler ((this crocadog-escort) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy -@TODO - unsure if there is a pattern for the events and this should have a more specific name" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('attack) ((method-of-type bot general-event-handler) this arg0 arg1 arg2 arg3) @@ -200,7 +200,7 @@ (defmethod get-penetrate-info ((this crocadog-escort)) "@returns the allowed way(s) this enemy can take damage -@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" + @see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" (let ((v1-1 ((method-of-type bot get-penetrate-info) this))) (logior (penetrate jak-yellow-shot jak-red-shot jak-blue-shot) v1-1) ) @@ -259,11 +259,9 @@ (let ((s3-2 (new 'stack-no-clear 'vector))) (do-navigation-to-destination (-> this nav state) (-> this root trans)) (when (cloest-point-on-mesh (-> this nav) s3-2 s4-0 (the-as nav-poly #f)) - (let ((f0-4 2048.0)) - (when (>= (* f0-4 f0-4) (vector-vector-xz-distance-squared s3-2 s4-0)) - (set! (-> arg0 quad) (-> s3-2 quad)) - #t - ) + (when (>= (square 2048.0) (vector-vector-xz-distance-squared s3-2 s4-0)) + (set! (-> arg0 quad) (-> s3-2 quad)) + #t ) ) ) @@ -274,18 +272,14 @@ ) (defmethod run-logic? ((this crocadog-escort)) + "Should this process be run? Checked by execute-process-tree." (or (not (logtest? (process-mask enemy) (-> *setting-control* user-current process-mask))) (logtest? (-> this bot-flags) (bot-flags bf09)) ) ) (defmethod enemy-method-97 ((this crocadog-escort)) - (let* ((s4-0 (handle->process (-> this attacker-handle))) - (s5-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (let ((s5-0 (the-as process (as-type (handle->process (-> this attacker-handle)) process-focusable)))) (when s5-0 (when (time-elapsed? (-> this attacker-time) (seconds 3)) (set! s5-0 (the-as process #f)) @@ -297,15 +291,7 @@ (s5-0 (empty) ) - ((begin - (let ((s4-1 (handle->process (-> this poi-handle)))) - (set! s5-0 (if (type? s4-1 process-focusable) - s4-1 - ) - ) - ) - s5-0 - ) + ((begin (set! s5-0 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable))) s5-0) (empty) ) (else @@ -315,12 +301,7 @@ (empty) ) (else - (let ((s4-2 (handle->process (-> this kid-handle)))) - (set! s5-0 (if (type? s4-2 process-focusable) - s4-2 - ) - ) - ) + (set! s5-0 (the-as process (as-type (handle->process (-> this kid-handle)) process-focusable))) *target* (let ((f30-0 -1.0) (f28-0 (vector-vector-distance (target-pos 0) (-> this root trans))) @@ -366,11 +347,11 @@ (defmethod init-from-entity! ((this crocadog-escort) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (stack-size-set! (-> this main-thread) 512) ((method-of-type bot init-from-entity!) this arg0) (none) diff --git a/goal_src/jak2/levels/city/kiddogescort/hal4-course.gc b/goal_src/jak2/levels/city/kiddogescort/hal4-course.gc index db0f0c18c6..024a038184 100644 --- a/goal_src/jak2/levels/city/kiddogescort/hal4-course.gc +++ b/goal_src/jak2/levels/city/kiddogescort/hal4-course.gc @@ -72,7 +72,7 @@ (defmethod general-event-handler ((this hal-escort) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy -@TODO - unsure if there is a pattern for the events and this should have a more specific name" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('notify) (case (-> arg3 param 0) @@ -105,12 +105,7 @@ ) (defmethod hal-escort-method-235 ((this hal-escort)) - (let* ((s5-0 (handle->process (-> this arrestor-handle))) - (v1-3 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((v1-3 (the-as process (as-type (handle->process (-> this arrestor-handle)) process-focusable)))) (when v1-3 (cond ((time-elapsed? (-> this arrestor-time) (seconds 4)) @@ -157,35 +152,25 @@ (let ((s5-0 *target*)) (when (focus-test? s5-0 pilot-riding pilot) (let* ((a0-2 (-> this actor-group 0 data 1 actor)) - (v1-5 (when a0-2 - (let ((s4-0 (-> a0-2 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (v1-5 (if a0-2 + (the-as process (as-type (-> a0-2 extra process) process-focusable)) ) - ) ) ) (when (focus-test? (the-as process-focusable v1-5) pilot-riding pilot) (let* ((v1-12 (-> this actor-group 0 data 2 actor)) - (a0-5 (when v1-12 - (let ((s4-1 (-> v1-12 extra process))) - (if (type? s4-1 process-focusable) - s4-1 - ) + (a0-5 (if v1-12 + (the-as process (as-type (-> v1-12 extra process) process-focusable)) ) - ) ) ) - (when (not (focus-test? (the-as process-focusable a0-5) pilot-riding pilot)) - (let ((f0-0 245760.0)) - (and (< (* f0-0 f0-0) + (if (not (focus-test? (the-as process-focusable a0-5) pilot-riding pilot)) + (and (< (square 245760.0) (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-5) 0) (get-trans s5-0 0)) ) (>= (current-time) (-> this dont-fail-until)) ) ) - ) ) ) ) @@ -196,13 +181,9 @@ ;; WARN: Return type mismatch object vs symbol. (defmethod hal-escort-method-228 ((this hal-escort)) (let* ((v1-3 (-> this actor-group 0 data 1 actor)) - (a0-1 (when v1-3 - (let ((s5-0 (-> v1-3 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (a0-1 (if v1-3 + (the-as process (as-type (-> v1-3 extra process) process-focusable)) ) - ) ) (s5-1 *target*) ) @@ -210,13 +191,11 @@ symbol (and a0-1 (and s5-1 - (let ((f0-0 409600.0)) - (and (< (* f0-0 f0-0) - (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (get-trans s5-1 0)) - ) - (>= (current-time) (-> this dont-fail-until)) - ) - ) + (and (< (square 409600.0) + (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (get-trans s5-1 0)) + ) + (>= (current-time) (-> this dont-fail-until)) + ) ) ) ) @@ -226,13 +205,9 @@ (defmethod hal-escort-method-234 ((this hal-escort) (arg0 nav-mesh)) (let ((s2-0 (the-as process #f))) (let* ((v1-3 (-> this actor-group 0 data 1 actor)) - (gp-0 (when v1-3 - (let ((s5-0 (-> v1-3 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (gp-0 (if v1-3 + (the-as process (as-type (-> v1-3 extra process) process-focusable)) ) - ) ) (s5-1 (new 'stack-no-clear 'vector)) ) @@ -263,14 +238,11 @@ (set! (-> s2-2 nav-branch) #f) (set! (-> s2-2 proc) #f) (let ((v1-25 (-> this actor-group 0 data 1 actor))) - (set! (-> s2-2 handle) (process->handle (when v1-25 - (let ((s4-1 (-> v1-25 extra process))) - (if (type? s4-1 process-focusable) - s4-1 - ) - ) - ) - ) + (set! (-> s2-2 handle) + (process->handle (if v1-25 + (the-as process (as-type (-> v1-25 extra process) process-focusable)) + ) + ) ) ) (set! (-> s2-2 user-data) (the-as uint 0)) @@ -295,13 +267,9 @@ "Returns seat index" (let* ((gp-0 (handle->process (-> this vehicle-handle))) (v1-6 (-> this actor-group 0 data 1 actor)) - (s5-0 (when v1-6 - (let ((s4-0 (-> v1-6 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (s5-0 (if v1-6 + (the-as process (as-type (-> v1-6 extra process) process-focusable)) ) - ) ) (s4-1 -1) ) @@ -325,22 +293,14 @@ (defmethod hal-escort-method-232 ((this hal-escort)) (let* ((target *target*) (v1-3 (-> this actor-group 0 data 1 actor)) - (s5-0 (when v1-3 - (let ((s3-0 (-> v1-3 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s5-0 (if v1-3 + (the-as process (as-type (-> v1-3 extra process) process-focusable)) ) - ) ) (a0-2 (-> this actor-group 0 data 2 actor)) - (v1-8 (when a0-2 - (let ((s3-1 (-> a0-2 extra process))) - (if (type? s3-1 process-focusable) - s3-1 - ) + (v1-8 (if a0-2 + (the-as process (as-type (-> a0-2 extra process) process-focusable)) ) - ) ) ) (when target @@ -474,14 +434,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-2 a2-5) - (f1-2 (+ (-> a1-4 world-sphere w) (-> gp-0 vector 1 w))) - ) - (when (< f0-2 (* f1-2 f1-2)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-5)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-4 world-sphere w) (-> gp-0 vector 1 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-5)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -515,14 +471,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-3 a2-12) - (f1-6 (+ (-> a1-16 world-sphere w) (-> gp-0 vector 1 w))) - ) - (when (< f0-3 (* f1-6 f1-6)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-8)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-16 world-sphere w) (-> gp-0 vector 1 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-8)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -538,12 +490,7 @@ (dotimes (s4-0 *actor-list-length*) (let ((v1-27 (-> *actor-list* s4-0))) (when (logtest? (the-as collide-spec s5-0) (-> v1-27 root-prim prim-core collide-as)) - (let* ((s3-0 (-> v1-27 process)) - (a0-16 (if (type? s3-0 process-focusable) - s3-0 - ) - ) - ) + (let ((a0-16 (the-as process-drawable (as-type (-> v1-27 process) process-focusable)))) (when (and a0-16 (= (-> a0-16 type) crimson-guard)) (let ((s3-1 (get-trans (the-as process-focusable a0-16) 0))) (if (and (>= (-> gp-0 vector 1 w) (vector-vector-xz-distance (-> gp-0 vector 1) s3-1)) @@ -566,23 +513,15 @@ (when (not (channel-active? this (gui-channel none))) (let ((s5-0 0)) (let* ((v1-5 (-> this actor-group 0 data 1 actor)) - (s4-0 (when v1-5 - (let ((s3-0 (-> v1-5 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s4-0 (if v1-5 + (the-as process (as-type (-> v1-5 extra process) process-focusable)) ) - ) ) ) (let* ((a0-3 (-> this actor-group 0 data 2 actor)) - (v1-10 (when a0-3 - (let ((s3-1 (-> a0-3 extra process))) - (if (type? s3-1 process-focusable) - s3-1 - ) + (v1-10 (if a0-3 + (the-as process (as-type (-> a0-3 extra process) process-focusable)) ) - ) ) ) (if (or (logtest? (-> (the-as process-focusable s4-0) draw status) (draw-control-status on-screen)) @@ -640,13 +579,9 @@ (defun hal4-walking-too-far ((arg0 hal-escort)) (let ((gp-0 0)) (let* ((v1-3 (-> arg0 actor-group 0 data 1 actor)) - (a0-1 (when v1-3 - (let ((s4-0 (-> v1-3 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (a0-1 (if v1-3 + (the-as process (as-type (-> v1-3 extra process) process-focusable)) ) - ) ) ) (if (and a0-1 (>= (vector-vector-xz-distance (get-trans (the-as process-focusable a0-1) 0) (target-pos 0)) @@ -762,22 +697,14 @@ (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-escort)) (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (s4-0 (when v1-3 - (let ((s5-0 (-> v1-3 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (s4-0 (if v1-3 + (the-as process (as-type (-> v1-3 extra process) process-focusable)) ) - ) ) (v1-8 (-> arg1 actor-group 0 data 2 actor)) - (s5-1 (when v1-8 - (let ((s3-0 (-> v1-8 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s5-1 (if v1-8 + (the-as process (as-type (-> v1-8 extra process) process-focusable)) ) - ) ) (v1-10 (the-as process *traffic-manager*)) ) @@ -857,11 +784,9 @@ :on-set (lambda ((arg0 hal-escort)) (set-setting! 'sound-mode #f 0.0 2) (let ((s5-0 (-> arg0 hal4-course spots))) - (vector-! (the-as vector (-> arg0 notice-plane)) (the-as vector (-> s5-0 4)) (the-as vector (-> s5-0 3))) + (vector-! (the-as vector (-> arg0 notice-plane)) (-> s5-0 4 center) (-> s5-0 3 center)) (vector-normalize! (-> arg0 notice-plane) 1.0) - (set! (-> arg0 notice-plane w) - (- (vector-dot (the-as vector (-> s5-0 3)) (the-as vector (-> arg0 notice-plane)))) - ) + (set! (-> arg0 notice-plane w) (- (vector-dot (-> s5-0 3 center) (the-as vector (-> arg0 notice-plane))))) ) (play-speech arg0 0) (let ((v1-10 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) @@ -875,13 +800,9 @@ (local-vars (v1-14 symbol)) (let ((s5-0 (new 'stack-no-clear 'vector))) (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (a0-1 (when v1-3 - (let ((s4-0 (-> v1-3 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (a0-1 (if v1-3 + (the-as process (as-type (-> v1-3 extra process) process-focusable)) ) - ) ) ) (when a0-1 @@ -953,13 +874,9 @@ ) (when (speech-playing? arg1 3) (let* ((v1-27 (-> arg1 actor-group 0 data 2 actor)) - (a0-11 (when v1-27 - (let ((s5-0 (-> v1-27 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (a0-11 (if v1-27 + (the-as process (as-type (-> v1-27 extra process) process-focusable)) ) - ) ) ) (when (and a0-11 (>= (the-as int (send-event a0-11 'query 'waypoint)) 6)) @@ -1007,13 +924,9 @@ (return #t) ) (let* ((v1-25 (-> arg1 actor-group 0 data 2 actor)) - (a0-9 (when v1-25 - (let ((s5-0 (-> v1-25 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (a0-9 (if v1-25 + (the-as process (as-type (-> v1-25 extra process) process-focusable)) ) - ) ) ) (when (and a0-9 (>= (the-as int (send-event a0-9 'query 'waypoint)) 15)) @@ -1067,22 +980,14 @@ (return #t) ) (let* ((v1-38 (-> arg1 actor-group 0 data 1 actor)) - (s4-0 (when v1-38 - (let ((s5-0 (-> v1-38 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (s4-0 (if v1-38 + (the-as process (as-type (-> v1-38 extra process) process-focusable)) ) - ) ) (v1-43 (-> arg1 actor-group 0 data 2 actor)) - (s5-1 (when v1-43 - (let ((s3-0 (-> v1-43 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s5-1 (if v1-43 + (the-as process (as-type (-> v1-43 extra process) process-focusable)) ) - ) ) (a0-16 s4-0) ) @@ -1137,22 +1042,14 @@ (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) (send-event *target* 'continue (get-continue-by-name *game-info* "lkiddoge-skip0")) (let* ((v1-16 (-> arg0 actor-group 0 data 2 actor)) - (s5-1 (when v1-16 - (let ((s4-0 (-> v1-16 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (s5-1 (if v1-16 + (the-as process (as-type (-> v1-16 extra process) process-focusable)) ) - ) ) (v1-21 (-> arg0 actor-group 0 data 1 actor)) - (s4-1 (when v1-21 - (let ((s3-0 (-> v1-21 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s4-1 (if v1-21 + (the-as process (as-type (-> v1-21 extra process) process-focusable)) ) - ) ) ) (send-event s5-1 'skip) @@ -1202,36 +1099,23 @@ (return #t) ) (let* ((v1-45 (-> arg1 actor-group 0 data 1 actor)) - (s5-0 (when v1-45 - (let ((s4-0 (-> v1-45 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (s5-0 (if v1-45 + (the-as process (as-type (-> v1-45 extra process) process-focusable)) ) - ) ) (v1-50 (-> arg1 actor-group 0 data 2 actor)) - (s4-1 (when v1-50 - (let ((s3-0 (-> v1-50 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s4-1 (if v1-50 + (the-as process (as-type (-> v1-50 extra process) process-focusable)) ) - ) ) ) (let ((s3-1 #f)) - (let* ((s1-0 (handle->process (-> arg1 vehicle-handle))) - (s2-0 (if (type? s1-0 process-focusable) - s1-0 - ) - ) - ) + (let ((s2-0 (the-as process (as-type (handle->process (-> arg1 vehicle-handle)) process-focusable)))) (when s2-0 (let ((s1-1 (get-trans (the-as process-focusable s2-0) 0)) (s0-0 (-> arg1 hal4-course spots 7)) ) - (if (and (>= (-> arg1 hal4-course spots 7 center w) (vector-vector-xz-distance s1-1 (the-as vector s0-0))) + (if (and (>= (-> arg1 hal4-course spots 7 center w) (vector-vector-xz-distance s1-1 (-> s0-0 center))) (>= 16384.0 (- (-> s1-1 y) (-> s0-0 center y))) (>= 61440.0 (vector-length (-> (the-as process-focusable s2-0) root transv))) (>= 1.0 (vector-length (-> (the-as process-focusable s2-0) rbody state ang-velocity))) @@ -1326,42 +1210,36 @@ (set! (-> v1-1 bytes 6) 7) (set! (-> v1-1 bytes 4) 0) (set! (-> (the-as halt-wait-spot v1-1) check-done) - (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-escort)) - (if (!= (level-status *level* 'ctyinda) 'active) - (set-time! (-> arg1 waypoint-time0)) - ) - (when (time-elapsed? (-> arg1 waypoint-time0) (seconds 0.25)) - (let* ((v1-11 (-> arg1 actor-group 0 data 2 actor)) - (s5-1 (when v1-11 - (let ((s4-0 (-> v1-11 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) - ) - (v1-16 (-> arg1 actor-group 0 data 1 actor)) - (s4-1 (when v1-16 - (let ((s3-0 (-> v1-16 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) - ) - ) - ) - ) - (send-event s5-1 'hide #f) - (send-event s4-1 'hide #f) - (send-event s5-1 'skip) - (send-event s4-1 'skip) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 19 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - ) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (if (!= (level-status *level* 'ctyinda) 'active) + (set-time! (-> arg1 waypoint-time0)) ) + (when (time-elapsed? (-> arg1 waypoint-time0) (seconds 0.25)) + (let* ((v1-11 (-> arg1 actor-group 0 data 2 actor)) + (s5-1 (if v1-11 + (the-as process (as-type (-> v1-11 extra process) process-focusable)) + ) + ) + (v1-16 (-> arg1 actor-group 0 data 1 actor)) + (s4-1 (if v1-16 + (the-as process (as-type (-> v1-16 extra process) process-focusable)) + ) + ) + ) + (send-event s5-1 'hide #f) + (send-event s4-1 'hide #f) + (send-event s5-1 'skip) + (send-event s4-1 'skip) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 19 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) ) ) (none) @@ -1372,22 +1250,14 @@ (reset-warn-time! arg0) (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) (let* ((v1-10 (-> arg0 actor-group 0 data 2 actor)) - (s5-0 (when v1-10 - (let ((s4-0 (-> v1-10 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (s5-0 (if v1-10 + (the-as process (as-type (-> v1-10 extra process) process-focusable)) ) - ) ) (v1-15 (-> arg0 actor-group 0 data 1 actor)) - (s4-1 (when v1-15 - (let ((s3-0 (-> v1-15 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s4-1 (if v1-15 + (the-as process (as-type (-> v1-15 extra process) process-focusable)) ) - ) ) ) (vector-reset! (-> (the-as process-focusable s5-0) root transv)) @@ -1438,22 +1308,14 @@ (return #t) ) (let* ((v1-27 (-> arg1 actor-group 0 data 2 actor)) - (s4-0 (when v1-27 - (let ((s5-0 (-> v1-27 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (s4-0 (if v1-27 + (the-as process (as-type (-> v1-27 extra process) process-focusable)) ) - ) ) (v1-32 (-> arg1 actor-group 0 data 1 actor)) - (s5-1 (when v1-32 - (let ((s3-0 (-> v1-32 extra process))) - (if (type? s3-0 process-focusable) - s3-0 - ) + (s5-1 (if v1-32 + (the-as process (as-type (-> v1-32 extra process) process-focusable)) ) - ) ) ) (when (and (and s4-0 (>= (the-as int (send-event s4-0 'query 'waypoint)) 25)) @@ -1484,22 +1346,14 @@ (send-event arg0 'move-trans (-> arg0 hal4-course spots 7)) (send-event *target* 'continue (get-continue-by-name *game-info* "lkiddoge-skip1")) (let* ((v1-23 (-> arg0 actor-group 0 data 2 actor)) - (s5-1 (when v1-23 - (let ((s4-0 (-> v1-23 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (s5-1 (if v1-23 + (the-as process (as-type (-> v1-23 extra process) process-focusable)) ) - ) ) (v1-28 (-> arg0 actor-group 0 data 1 actor)) - (gp-1 (when v1-28 - (let ((s4-1 (-> v1-28 extra process))) - (if (type? s4-1 process-focusable) - s4-1 - ) + (gp-1 (if v1-28 + (the-as process (as-type (-> v1-28 extra process) process-focusable)) ) - ) ) ) (send-event s5-1 'skip) @@ -1545,22 +1399,14 @@ ) (when (not (hal-escort-method-230 arg1)) (let* ((v1-34 (-> arg1 actor-group 0 data 2 actor)) - (s4-1 (when v1-34 - (let ((s3-1 (-> v1-34 extra process))) - (if (type? s3-1 process-focusable) - s3-1 - ) + (s4-1 (if v1-34 + (the-as process (as-type (-> v1-34 extra process) process-focusable)) ) - ) ) (v1-39 (-> arg1 actor-group 0 data 1 actor)) - (s3-2 (when v1-39 - (let ((s2-0 (-> v1-39 extra process))) - (if (type? s2-0 process-focusable) - s2-0 - ) + (s3-2 (if v1-39 + (the-as process (as-type (-> v1-39 extra process) process-focusable)) ) - ) ) ) (when (and (process-grab? s4-1 #t) @@ -1677,23 +1523,15 @@ (time-elapsed? (-> arg1 waypoint-time0) (seconds 1.2)) ) (let* ((v1-55 (-> arg1 actor-group 0 data 2 actor)) - (s5-1 (when v1-55 - (let ((s4-0 (-> v1-55 extra process))) - (if (type? s4-0 process-focusable) - s4-0 - ) + (s5-1 (if v1-55 + (the-as process (as-type (-> v1-55 extra process) process-focusable)) ) - ) ) ) (let* ((v1-60 (-> arg1 actor-group 0 data 1 actor)) - (a0-16 (when v1-60 - (let ((s4-1 (-> v1-60 extra process))) - (if (type? s4-1 process-focusable) - s4-1 - ) + (a0-16 (if v1-60 + (the-as process (as-type (-> v1-60 extra process) process-focusable)) ) - ) ) ) (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) @@ -1768,13 +1606,9 @@ (when gp-0 (logior! (-> arg0 waypoint-bits) (waypoint-bits wabits-0)) (let* ((v1-8 (-> arg0 actor-group 0 data 1 actor)) - (a0-3 (when v1-8 - (let ((s5-1 (-> v1-8 extra process))) - (if (type? s5-1 process-focusable) - s5-1 - ) + (a0-3 (if v1-8 + (the-as process (as-type (-> v1-8 extra process) process-focusable)) ) - ) ) ) (send-event a0-3 'instant-arrest gp-0) @@ -1843,13 +1677,9 @@ (remove-setting! 'music) (remove-setting! 'sound-mode) (let* ((v1-7 (-> arg0 actor-group 0 data 2 actor)) - (a0-3 (when v1-7 - (let ((s5-0 (-> v1-7 extra process))) - (if (type? s5-0 process-focusable) - s5-0 - ) + (a0-3 (if v1-7 + (the-as process (as-type (-> v1-7 extra process) process-focusable)) ) - ) ) ) (send-event a0-3 'request 'too-far-fail) @@ -1906,13 +1736,9 @@ (when gp-0 (logior! (-> arg0 waypoint-bits) (waypoint-bits wabits-0)) (let* ((v1-8 (-> arg0 actor-group 0 data 1 actor)) - (a0-3 (when v1-8 - (let ((s5-1 (-> v1-8 extra process))) - (if (type? s5-1 process-focusable) - s5-1 - ) + (a0-3 (if v1-8 + (the-as process (as-type (-> v1-8 extra process) process-focusable)) ) - ) ) ) (send-event a0-3 'instant-arrest gp-0) diff --git a/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc b/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc index 28654b128a..d98a8e8e4a 100644 --- a/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc +++ b/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc @@ -36,13 +36,9 @@ (go-waiting-turn self) (b! #t cfg-15 :delay (nop!)) (label cfg-6) - (let ((gp-0 (handle->process (-> self arrestor-handle)))) - (if (if (type? gp-0 process-focusable) - gp-0 - ) - (go-virtual arrested) - ) - ) + (if (the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable)) + (go-virtual arrested) + ) (label cfg-15) (when (not (focus-test? self grabbed)) (cond @@ -104,14 +100,9 @@ (bot-method-223 self #f) (when (not (focus-test? self grabbed)) (if (and (not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f)) - (let ((gp-0 (handle->process (-> self arrestor-handle)))) - (and (not (if (type? gp-0 process-focusable) - gp-0 - ) - ) - (not (logtest? (-> self bot-flags) (bot-flags bf15))) - ) - ) + (and (not (the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable))) + (not (logtest? (-> self bot-flags) (bot-flags bf15))) + ) ) (go-virtual traveling) ) @@ -155,26 +146,22 @@ ) :trans (behavior () (bot-method-223 self #f) - (let ((gp-0 (handle->process (-> self arrestor-handle)))) - (cond - ((if (type? gp-0 process-focusable) - gp-0 - ) - (go-virtual arrested) - ) - ((logtest? (-> self bot-flags) (bot-flags bf15)) - (go-virtual move-to-vehicle) - ) - ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) - (check-arrest self) - ) - ((and (time-elapsed? (-> self state-time) (seconds 0.5)) (bot-method-208 self)) - (go-virtual traveling-blocked) - ) - ((and (nav-enemy-method-163 self) (time-elapsed? (-> self state-time) (-> self reaction-time))) - (go-stare2 self) - ) - ) + (cond + ((the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable)) + (go-virtual arrested) + ) + ((logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + ) + ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) + (check-arrest self) + ) + ((and (time-elapsed? (-> self state-time) (seconds 0.5)) (bot-method-208 self)) + (go-virtual traveling-blocked) + ) + ((and (nav-enemy-method-163 self) (time-elapsed? (-> self state-time) (-> self reaction-time))) + (go-stare2 self) + ) ) 0 ) @@ -223,28 +210,24 @@ :trans (behavior () (bot-method-223 self #f) (let ((gp-0 (handle->process (-> self vehicle-handle)))) - (let ((s5-0 (handle->process (-> self arrestor-handle)))) - (cond - ((if (type? s5-0 process-focusable) - s5-0 - ) - (go-virtual arrested) - ) - ((or (not gp-0) - (logtest? (-> (the-as vehicle gp-0) flags) (rigid-body-object-flag dead)) - (not (logtest? (-> self bot-flags) (bot-flags bf15))) - (< (-> self vehicle-seat-index) 0) - ) - (logclear! (-> self bot-flags) (bot-flags bf15)) - (check-arrest self) - ) - ((and (time-elapsed? (-> self state-time) (seconds 0.5)) (bot-method-208 self)) - (go-virtual traveling-blocked) - ) - ((and (nav-enemy-method-163 self) (time-elapsed? (-> self state-time) (-> self reaction-time))) - (go-stare2 self) - ) - ) + (cond + ((the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable)) + (go-virtual arrested) + ) + ((or (not gp-0) + (logtest? (-> (the-as vehicle gp-0) flags) (rigid-body-object-flag dead)) + (not (logtest? (-> self bot-flags) (bot-flags bf15))) + (< (-> self vehicle-seat-index) 0) + ) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (check-arrest self) + ) + ((and (time-elapsed? (-> self state-time) (seconds 0.5)) (bot-method-208 self)) + (go-virtual traveling-blocked) + ) + ((and (nav-enemy-method-163 self) (time-elapsed? (-> self state-time) (-> self reaction-time))) + (go-stare2 self) + ) ) (let ((s5-1 (new 'stack-no-clear 'inline-array 'matrix 2))) (compute-seat-position (the-as vehicle gp-0) (the-as vector (-> s5-1 0)) (-> self vehicle-seat-index)) @@ -335,7 +318,6 @@ (check-vehicle-exit self) ) :code (behavior () - (local-vars (sv-112 float)) (ja-channel-push! 1 (seconds 0.1)) (let ((gp-0 (new 'stack-no-clear 'matrix))) (quaternion-copy! (the-as quaternion (-> gp-0 vector)) (-> self root quat)) @@ -371,32 +353,23 @@ (let ((s4-2 (handle->process (-> self vehicle-handle)))) (compute-seat-position (the-as vehicle s4-2) (-> gp-0 vector 2) (-> self vehicle-seat-index)) (vector-! (-> gp-0 trans) (-> gp-0 vector 2) s5-3) - (let ((s3-1 lerp-scale) - (s2-1 0.0) - (s1-1 1.0) - (s0-1 (ja-aframe-num 0)) - ) - (set! sv-112 (ja-aframe 1.0 0)) - (let* ((t0-1 (ja-aframe 8.0 0)) - (f30-1 (s3-1 s2-1 s1-1 s0-1 sv-112 t0-1)) - ) - (quaternion-rotate-local-y! - (the-as quaternion (-> gp-0 vector 1)) - (-> (the-as vehicle s4-2) root quat) - (* f30-1 (if (zero? (-> self vehicle-seat-index)) - -16384.0 - 16384.0 - ) - ) - ) - (quaternion-slerp! - (-> self root quat) - (the-as quaternion (-> gp-0 vector)) - (the-as quaternion (-> gp-0 vector 1)) - f30-1 - ) - (vector+float*! (-> self root trans) s5-3 (-> gp-0 trans) f30-1) + (let ((f30-1 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 1.0 0) (ja-aframe 8.0 0)))) + (quaternion-rotate-local-y! + (the-as quaternion (-> gp-0 vector 1)) + (-> (the-as vehicle s4-2) root quat) + (* f30-1 (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) ) + (quaternion-slerp! + (-> self root quat) + (the-as quaternion (-> gp-0 vector)) + (the-as quaternion (-> gp-0 vector 1)) + f30-1 + ) + (vector+float*! (-> self root trans) s5-3 (-> gp-0 trans) f30-1) ) ) (suspend) @@ -571,7 +544,6 @@ (check-vehicle-exit self) ) :code (behavior () - (local-vars (sv-80 float) (sv-96 float)) (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! kid-escort-jump-in-vehicle-ja :num! (seek! (ja-aframe 8.0 0) 0.25) @@ -622,17 +594,8 @@ (quaternion-identity! s4-3) (quaternion-rotate-y! s4-3 s4-3 f30-0) ) - (let ((s3-1 lerp-scale) - (s2-1 0.0) - (s1-0 1.0) - (s0-0 (ja-aframe-num 0)) - ) - (set! sv-80 (ja-aframe 8.0 0)) - (let* ((t0-1 (ja-aframe 1.0 0)) - (f0-11 (s3-1 s2-1 s1-0 s0-0 sv-80 t0-1)) - ) - (quaternion-slerp! s4-3 s5-1 s4-3 f0-11) - ) + (let ((f0-11 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 8.0 0) (ja-aframe 1.0 0)))) + (quaternion-slerp! s4-3 s5-1 s4-3 f0-11) ) ) (want-exit-vehicle? self (-> self exit-vehicle-dest)) @@ -655,17 +618,8 @@ (new 'stack-no-clear 'vector) (let ((s4-4 (new 'stack-no-clear 'vector))) (vector-! s4-4 gp-4 (-> self exit-vehicle-dest)) - (let ((s3-2 lerp-scale) - (s2-2 0.0) - (s1-1 1.0) - (s0-1 (ja-aframe-num 0)) - ) - (set! sv-96 (ja-aframe 1.0 0)) - (let* ((t0-2 (ja-aframe 8.0 0)) - (f0-15 (s3-2 s2-2 s1-1 s0-1 sv-96 t0-2)) - ) - (vector+float*! (-> self root trans) (-> self exit-vehicle-dest) s4-4 f0-15) - ) + (let ((f0-15 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 1.0 0) (ja-aframe 8.0 0)))) + (vector+float*! (-> self root trans) (-> self exit-vehicle-dest) s4-4 f0-15) ) ) (suspend) @@ -698,20 +652,16 @@ ) :trans (behavior () (bot-method-223 self #f) - (let ((gp-0 (handle->process (-> self arrestor-handle)))) - (cond - ((if (type? gp-0 process-focusable) - gp-0 - ) - (go-virtual arrested) - ) - ((and (time-elapsed? (-> self state-time) (seconds 1)) (not (bot-method-208 self))) - (if (logtest? (-> self bot-flags) (bot-flags bf15)) - (go-virtual move-to-vehicle) - (go-virtual traveling) - ) - ) - ) + (cond + ((the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable)) + (go-virtual arrested) + ) + ((and (time-elapsed? (-> self state-time) (seconds 1)) (not (bot-method-208 self))) + (if (logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + (go-virtual traveling) + ) + ) ) ) :code (-> (method-of-type kid-escort waiting-idle) code) @@ -734,13 +684,9 @@ ) :trans (behavior () (bot-method-223 self #f) - (let ((gp-0 (handle->process (-> self arrestor-handle)))) - (if (if (type? gp-0 process-focusable) - gp-0 - ) - (go-virtual arrested) - ) - ) + (if (the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable)) + (go-virtual arrested) + ) (when (time-elapsed? (-> self state-time) (seconds 0.1)) (when (not (nav-enemy-method-163 self)) (if (logtest? (-> self bot-flags) (bot-flags bf15)) @@ -841,14 +787,9 @@ (go-waiting-turn self) ) (when (not (focus-test? self grabbed)) - (let ((gp-0 (handle->process (-> self arrestor-handle)))) - (if (not (if (type? gp-0 process-focusable) - gp-0 - ) - ) - (react-to-focus self) - ) - ) + (if (not (the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable))) + (react-to-focus self) + ) ) ) ) @@ -858,12 +799,7 @@ (cond ((logtest? (bot-flags bf19) (-> self bot-flags)) (fail-mission! self) - (let* ((gp-0 (handle->process (-> self arrestor-handle))) - (v1-7 (if (type? gp-0 process-focusable) - gp-0 - ) - ) - ) + (let ((v1-7 (the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable)))) (if v1-7 (logclear! (-> (the-as crimson-guard v1-7) enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) @@ -898,12 +834,7 @@ #f (label cfg-27) (fail-mission! self) - (let* ((gp-1 (handle->process (-> self arrestor-handle))) - (v1-93 (if (type? gp-1 process-focusable) - gp-1 - ) - ) - ) + (let ((v1-93 (the-as process (as-type (handle->process (-> self arrestor-handle)) process-focusable)))) (if v1-93 (logclear! (-> (the-as crimson-guard v1-93) enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) diff --git a/goal_src/jak2/levels/city/kiddogescort/kidesc.gc b/goal_src/jak2/levels/city/kiddogescort/kidesc.gc index 809d1559fc..ce256ab638 100644 --- a/goal_src/jak2/levels/city/kiddogescort/kidesc.gc +++ b/goal_src/jak2/levels/city/kiddogescort/kidesc.gc @@ -182,15 +182,10 @@ (defmethod general-event-handler ((this kid-escort) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy -@TODO - unsure if there is a pattern for the events and this should have a more specific name" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('arrest) - (let* ((s4-0 (handle->process (-> this arrestor-handle))) - (v1-4 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (let ((v1-4 (the-as process (as-type (handle->process (-> this arrestor-handle)) process-focusable)))) (when (or (not v1-4) (= v1-4 arg0) (and (!= v1-4 arg0) (time-elapsed? (-> this arrest-attempt-time) (seconds 0.1)))) (set! (-> this arrestor-handle) (process->handle arg0)) (set-time! (-> this arrest-attempt-time)) @@ -235,23 +230,16 @@ ) (defmethod run-logic? ((this kid-escort)) + "Should this process be run? Checked by execute-process-tree." (or (not (logtest? (process-mask enemy) (-> *setting-control* user-current process-mask))) (logtest? (-> this bot-flags) (bot-flags bf09)) ) ) (defmethod enemy-method-97 ((this kid-escort)) - (let* ((s4-0 (handle->process (-> this attacker-handle))) - (s5-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - (s3-0 (handle->process (-> this arrestor-handle))) - (s4-1 (if (type? s3-0 process-focusable) - s3-0 - ) - ) - ) + (let ((s5-0 (the-as process (as-type (handle->process (-> this attacker-handle)) process-focusable))) + (s4-1 (the-as process (as-type (handle->process (-> this arrestor-handle)) process-focusable))) + ) (when s5-0 (cond ((= (-> s5-0 type) target) @@ -297,12 +285,7 @@ (empty) ) (else - (let ((s5-1 (handle->process (-> this poi-handle)))) - (set! s3-1 (if (type? s5-1 process-focusable) - s5-1 - ) - ) - ) + (set! s3-1 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable))) (if s3-1 (empty) (set! s3-1 *target*) @@ -319,12 +302,7 @@ (set! s3-1 s5-0) ) (else - (let ((s5-2 (handle->process (-> this poi-handle)))) - (set! s3-1 (if (type? s5-2 process-focusable) - s5-2 - ) - ) - ) + (set! s3-1 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable))) (cond (s3-1 (empty) @@ -370,11 +348,11 @@ (defmethod init-from-entity! ((this kid-escort) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (stack-size-set! (-> this main-thread) 512) ((method-of-type bot init-from-entity!) this arg0) (none) @@ -519,19 +497,15 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod check-arrest ((this kid-escort)) - (let ((s5-0 (handle->process (-> this arrestor-handle)))) - (cond - ((if (type? s5-0 process-focusable) - s5-0 - ) - (go (method-of-object this arrested)) - ) - ((logtest? (-> this bot-flags) (bot-flags bf15)) - (go (method-of-object this move-to-vehicle)) - ) - (else - (go (method-of-object this waiting-idle)) - ) + (cond + ((the-as process (as-type (handle->process (-> this arrestor-handle)) process-focusable)) + (go (method-of-object this arrested)) + ) + ((logtest? (-> this bot-flags) (bot-flags bf15)) + (go (method-of-object this move-to-vehicle)) + ) + (else + (go (method-of-object this waiting-idle)) ) ) (none) @@ -617,7 +591,7 @@ This commonly includes things such as: (defmethod get-penetrate-info ((this kid-escort)) "@returns the allowed way(s) this enemy can take damage -@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" + @see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" (let ((v1-1 ((method-of-type bot get-penetrate-info) this))) (logior (penetrate jak-yellow-shot jak-red-shot jak-blue-shot) v1-1) ) @@ -676,11 +650,9 @@ This commonly includes things such as: (let ((s3-2 (new 'stack-no-clear 'vector))) (do-navigation-to-destination (-> this nav state) (-> this root trans)) (when (cloest-point-on-mesh (-> this nav) s3-2 s4-0 (the-as nav-poly #f)) - (let ((f0-4 2048.0)) - (when (>= (* f0-4 f0-4) (vector-vector-xz-distance-squared s3-2 s4-0)) - (set! (-> arg0 quad) (-> s3-2 quad)) - #t - ) + (when (>= (square 2048.0) (vector-vector-xz-distance-squared s3-2 s4-0)) + (set! (-> arg0 quad) (-> s3-2 quad)) + #t ) ) ) diff --git a/goal_src/jak2/levels/city/meet-brutter/meet-brutter.gc b/goal_src/jak2/levels/city/meet-brutter/meet-brutter.gc index 9eb64f217a..df821d47e5 100644 --- a/goal_src/jak2/levels/city/meet-brutter/meet-brutter.gc +++ b/goal_src/jak2/levels/city/meet-brutter/meet-brutter.gc @@ -16,13 +16,9 @@ ;; DECOMP BEGINS (defmethod draw ((this hud-lurker)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 457.0 (* 130.0 (-> this offset)))) - 205 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 457.0 (* 130.0 (-> this offset)))) 205) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -19 27) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -19 27) ((method-of-type hud draw) this) 0 (none) @@ -879,7 +875,6 @@ (defstate board-vehicle (city-lurker) :virtual #t :code (behavior () - (local-vars (sv-128 float) (sv-144 float) (sv-160 float)) (let ((gp-0 0)) (case (-> (the-as vehicle (handle->process (-> self vehicle))) info object-type) ((11 12 13) @@ -919,18 +914,9 @@ (quaternion-copy! s2-0 (-> (the-as vehicle s1-0) root quat)) (compute-seat-position (the-as vehicle s1-0) s0-0 (-> self seat)) (vector-! s3-1 s0-0 s5-2) - (let ((s1-1 lerp-scale) - (s0-1 0.0) - ) - (set! sv-128 (the-as float 1.0)) - (set! sv-144 (ja-aframe-num 0)) - (set! sv-160 (ja-aframe 2.0 0)) - (let* ((t0-1 (ja-aframe 8.0 0)) - (f30-1 (s1-1 s0-1 sv-128 sv-144 sv-160 t0-1)) - ) - (quaternion-slerp! (-> self root quat) s4-0 s2-0 f30-1) - (vector+float*! (-> self root trans) s5-2 s3-1 f30-1) - ) + (let ((f30-1 (lerp-scale 0.0 (the-as float 1.0) (ja-aframe-num 0) (ja-aframe 2.0 0) (ja-aframe 8.0 0)))) + (quaternion-slerp! (-> self root quat) s4-0 s2-0 f30-1) + (vector+float*! (-> self root trans) s5-2 s3-1 f30-1) ) ) (suspend) @@ -1198,7 +1184,6 @@ ) ) :code (behavior () - (local-vars (sv-128 float)) (let ((gp-0 0)) (case (-> (the-as vehicle (handle->process (-> self vehicle))) info object-type) ((11 12 13) @@ -1253,19 +1238,11 @@ (quaternion-copy! s4-2 (-> (the-as vehicle s3-1) root quat)) (compute-seat-position (the-as vehicle s3-1) s2-0 (-> self seat)) (vector-! gp-1 s2-0 s5-3) - (let ((s3-2 lerp-scale) - (s2-1 0.0) - (s1-0 1.0) - (s0-0 (ja-aframe-num 0)) - ) - (set! sv-128 (ja-aframe 8.0 0)) - (let* ((t0-0 (ja-aframe 2.0 0)) - (f0-9 (s3-2 s2-1 s1-0 s0-0 sv-128 t0-0)) - (f30-0 (- 1.0 f0-9)) - ) - (quaternion-copy! (-> self root quat) s4-2) - (vector+float*! (-> self root trans) s5-3 gp-1 f30-0) - ) + (let* ((f0-9 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 8.0 0) (ja-aframe 2.0 0))) + (f30-0 (- 1.0 f0-9)) + ) + (quaternion-copy! (-> self root quat) s4-2) + (vector+float*! (-> self root trans) s5-3 gp-1 f30-0) ) ) (suspend) @@ -2187,12 +2164,7 @@ (set! (-> gp-1 params 0 id) (the-as uint (+ s5-1 120))) (set! (-> gp-1 params 0 position quad) (-> s2-0 pos quad)) (set! (-> gp-1 params 1 position quad) (-> s2-0 pos quad)) - (let ((s4-0 (the-as - paddywagon - (vehicle-spawn *traffic-manager* paddywagon (the-as traffic-object-spawn-params (-> gp-1 params))) - ) - ) - ) + (let ((s4-0 (the-as paddywagon (vehicle-spawn *traffic-manager* paddywagon (-> gp-1 params 0))))) (when s4-0 (set! (-> s4-0 current-level) (-> s2-0 level)) (set! (-> self slave (+ s5-1 (-> self max-count))) (process->handle s4-0)) @@ -2439,12 +2411,12 @@ ) ((zero? (-> self data-int32 s5-2)) (when (the-as city-lurker s4-2) - (let* ((s2-0 (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid)))) - (s3-2 (if (type? s2-0 entity-nav-mesh) - s2-0 - ) - ) - ) + (let ((s3-2 (as-type + (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid))) + entity-nav-mesh + ) + ) + ) (when (and s3-2 (!= (-> (the-as city-lurker s4-2) nav state mesh) (-> s3-2 nav-mesh))) (when (nonzero? (-> (the-as city-lurker s4-2) nav state mesh)) (remove-process-drawable (-> (the-as city-lurker s4-2) nav state mesh) (the-as city-lurker s4-2)) @@ -2469,24 +2441,17 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-163 vf1) - (let ((f0-2 v1-163) - (f1-0 32768.0) - ) - (when (and (< f0-2 (* f1-0 f1-0)) - (let ((f0-3 (vector-vector-distance-squared - (-> (the-as vehicle s3-3) root trans) - (-> (the-as city-lurker s4-2) root trans) - ) - ) - (f1-3 65536.0) - ) - (< f0-3 (* f1-3 f1-3)) - ) - (not gp-2) - ) - (set! gp-2 #t) - (send-event (the-as city-lurker s4-2) 'board-vehicle (the-as vehicle s3-3)) - ) + (when (and (< v1-163 (square 32768.0)) + (< (vector-vector-distance-squared + (-> (the-as vehicle s3-3) root trans) + (-> (the-as city-lurker s4-2) root trans) + ) + (square 65536.0) + ) + (not gp-2) + ) + (set! gp-2 #t) + (send-event (the-as city-lurker s4-2) 'board-vehicle (the-as vehicle s3-3)) ) ) ) @@ -2507,11 +2472,7 @@ (cond ((focus-test? (the-as city-lurker s4-2) pilot) (when (and s2-1 - (let ((f0-4 (vector-vector-distance-squared s3-4 (-> (the-as vehicle s2-1) root trans))) - (f1-6 114688.0) - ) - (< f0-4 (* f1-6 f1-6)) - ) + (< (vector-vector-distance-squared s3-4 (-> (the-as vehicle s2-1) root trans)) (square 114688.0)) (begin (.lvf vf1 (&-> (-> (the-as vehicle s2-1) root transv) quad)) (.add.w.vf.x vf2 vf0 vf0) @@ -2520,11 +2481,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-205 vf1) - (let ((f0-5 v1-205) - (f1-9 421888.0) - ) - (< f0-5 (* f1-9 f1-9)) - ) + (< v1-205 (square 421888.0)) ) ) (set! (-> (the-as city-lurker s4-2) task-done?) #t) @@ -2554,12 +2511,12 @@ ) ) ((= (-> self data-int32 s5-2) 2) - (let* ((s3-8 (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid)))) - (a0-116 (if (type? s3-8 entity-nav-mesh) - s3-8 - ) - ) - ) + (let ((a0-116 (as-type + (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid))) + entity-nav-mesh + ) + ) + ) (if a0-116 (change-to (-> a0-116 nav-mesh) (the-as city-lurker s4-2)) ) @@ -2751,12 +2708,7 @@ (set! (-> gp-0 params 0 id) (the-as uint (+ s5-0 120))) (set! (-> gp-0 params 0 position quad) (-> s2-0 pos quad)) (set! (-> gp-0 params 1 position quad) (-> s2-0 pos quad)) - (let ((s4-0 (the-as - paddywagon - (vehicle-spawn *traffic-manager* paddywagon (the-as traffic-object-spawn-params (-> gp-0 params))) - ) - ) - ) + (let ((s4-0 (the-as paddywagon (vehicle-spawn *traffic-manager* paddywagon (-> gp-0 params 0))))) (when s4-0 (set! (-> s4-0 current-level) (-> s2-0 level)) (set! (-> self slave (+ s5-0 (-> self max-count))) (process->handle s4-0)) @@ -2999,12 +2951,12 @@ ) ((zero? (-> self data-int32 s5-3)) (when (the-as city-lurker s4-2) - (let* ((s2-0 (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid)))) - (s3-2 (if (type? s2-0 entity-nav-mesh) - s2-0 - ) - ) - ) + (let ((s3-2 (as-type + (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid))) + entity-nav-mesh + ) + ) + ) (when (and s3-2 (!= (-> (the-as city-lurker s4-2) nav state mesh) (-> s3-2 nav-mesh))) (when (nonzero? (-> (the-as city-lurker s4-2) nav state mesh)) (remove-process-drawable (-> (the-as city-lurker s4-2) nav state mesh) (the-as city-lurker s4-2)) @@ -3031,24 +2983,17 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-178 vf1) - (let ((f0-2 v1-178) - (f1-0 32768.0) - ) - (when (and (< f0-2 (* f1-0 f1-0)) - (let ((f0-3 (vector-vector-distance-squared - (-> (the-as vehicle s3-3) root trans) - (-> (the-as city-lurker s4-2) root trans) - ) - ) - (f1-3 65536.0) - ) - (< f0-3 (* f1-3 f1-3)) - ) - (not gp-2) - ) - (set! gp-2 #t) - (send-event (the-as city-lurker s4-2) 'board-vehicle (the-as vehicle s3-3)) - ) + (when (and (< v1-178 (square 32768.0)) + (< (vector-vector-distance-squared + (-> (the-as vehicle s3-3) root trans) + (-> (the-as city-lurker s4-2) root trans) + ) + (square 65536.0) + ) + (not gp-2) + ) + (set! gp-2 #t) + (send-event (the-as city-lurker s4-2) 'board-vehicle (the-as vehicle s3-3)) ) ) ) @@ -3084,11 +3029,7 @@ (cond ((focus-test? (the-as city-lurker s4-2) pilot) (when (and s2-2 - (let ((f0-5 (vector-vector-distance-squared s3-5 (-> (the-as vehicle s2-2) root trans))) - (f1-6 114688.0) - ) - (< f0-5 (* f1-6 f1-6)) - ) + (< (vector-vector-distance-squared s3-5 (-> (the-as vehicle s2-2) root trans)) (square 114688.0)) (begin (.lvf vf1 (&-> (-> (the-as vehicle s2-2) root transv) quad)) (.add.w.vf.x vf2 vf0 vf0) @@ -3097,11 +3038,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-231 vf1) - (let ((f0-6 v1-231) - (f1-9 40960.0) - ) - (< f0-6 (* f1-9 f1-9)) - ) + (< v1-231 (square 40960.0)) ) ) (set! (-> (the-as city-lurker s4-2) task-done?) #t) @@ -3117,12 +3054,12 @@ ) ) ((= (-> self data-int32 s5-3) 2) - (let* ((s3-6 (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid)))) - (a0-134 (if (type? s3-6 entity-nav-mesh) - s3-6 - ) - ) - ) + (let ((a0-134 (as-type + (entity-nav-mesh-by-aid (the-as actor-id (-> (the-as city-lurker s4-2) nav-mesh-aid))) + entity-nav-mesh + ) + ) + ) (if a0-134 (change-to (-> a0-134 nav-mesh) (the-as city-lurker s4-2)) ) diff --git a/goal_src/jak2/levels/city/onintent/onin-game.gc b/goal_src/jak2/levels/city/onintent/onin-game.gc index 552612d8fe..e6b65e11d4 100644 --- a/goal_src/jak2/levels/city/onintent/onin-game.gc +++ b/goal_src/jak2/levels/city/onintent/onin-game.gc @@ -2069,15 +2069,7 @@ ;; ERROR: Stack slot load at 96 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 112 mismatch: defined as size 4, got size 16 (defmethod onin-game-method-25 ((this onin-game)) - (local-vars - (v0-18 int) - (sv-32 process) - (sv-48 (function vector int meters float float none :behavior onin-game-bubble)) - (sv-64 vector) - (sv-80 int) - (sv-96 meters) - (sv-112 float) - ) + (local-vars (v0-18 int)) (when (time-elapsed? (-> this game-start-time) (seconds 2)) (let ((s5-0 (-> this game (-> this wave)))) (when (time-elapsed? (the-as int (-> this wave-length)) (-> this wave-time)) @@ -2174,37 +2166,15 @@ ) (set! (-> this last-angle) f0-0) ) - (let ((s1-0 (get-process *default-dead-pool* onin-game-bubble #x4000))) - (when s1-0 - (let ((t9-31 (method-of-type onin-game-bubble activate))) - (t9-31 - (the-as onin-game-bubble s1-0) - this - (symbol->string (-> onin-game-bubble symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s0-0 run-function-in-process)) - (set! sv-32 s1-0) - (set! sv-48 onin-game-bubble-init) - (set! sv-64 s4-14) - (set! sv-80 (rand-vu-int-range 0 3)) - (set! sv-96 (-> s5-0 gravity)) - (set! sv-112 (-> this last-angle)) - (let ((t2-0 (rand-vu-float-range 4096.0 7372.8))) - ((the-as (function object object object object object object object none) s0-0) - sv-32 - sv-48 - sv-64 - sv-80 - sv-96 - sv-112 - t2-0 - ) - ) - ) - (-> s1-0 ppointer) - ) + (process-spawn + onin-game-bubble + :init onin-game-bubble-init + s4-14 + (rand-vu-int-range 0 3) + (-> s5-0 gravity) + (-> this last-angle) + (rand-vu-float-range 4096.0 7372.8) + :to this ) ) ) diff --git a/goal_src/jak2/levels/city/package/delivery-task.gc b/goal_src/jak2/levels/city/package/delivery-task.gc index 36e5186ca8..af2307ddde 100644 --- a/goal_src/jak2/levels/city/package/delivery-task.gc +++ b/goal_src/jak2/levels/city/package/delivery-task.gc @@ -89,11 +89,11 @@ ;; WARN: Return type mismatch entity-perm-status vs none. (defmethod init-from-entity! ((this krew-package) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (process-entity-status! this (entity-perm-status dead) #t) (none) ) @@ -376,49 +376,49 @@ This commonly includes things such as: ) ) ) - (let ((f0-0 (vector-vector-distance-squared (-> (the-as process-drawable gp-0) root trans) (target-pos 0))) - (f1-0 12288.0) - ) - (cond - ((and (< f0-0 (* f1-0 f1-0)) *target* (focus-test? *target* pilot)) - (when (nonzero? (-> self sub-state)) - (send-event (handle->process (-> self arrow)) 'set-position (-> self end-pos)) - (send-event (handle->process (-> self arrow)) 'modify-flags 1 0) - (send-event (handle->process (-> self arrow)) 'map-icon 8) - (set! (-> self sub-state) (the-as uint 0)) - 0 - ) + (cond + ((and (< (vector-vector-distance-squared (-> (the-as process-drawable gp-0) root trans) (target-pos 0)) + (square 12288.0) + ) + *target* + (focus-test? *target* pilot) + ) + (when (nonzero? (-> self sub-state)) + (send-event (handle->process (-> self arrow)) 'set-position (-> self end-pos)) + (send-event (handle->process (-> self arrow)) 'modify-flags 1 0) + (send-event (handle->process (-> self arrow)) 'map-icon 8) + (set! (-> self sub-state) (the-as uint 0)) + 0 ) - (else - (let* ((v1-59 (new 'stack-no-clear 'inline-array 'vector 1)) - (f0-1 409.6) - (f0-3 (* f0-1 f0-1)) - ) - (.lvf vf1 (&-> (-> (the-as process-drawable gp-0) root transv) quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov a0-32 vf1) - (when (>= f0-3 a0-32) - (set! (-> v1-59 0 quad) (-> (the-as process-drawable gp-0) root trans quad)) - (+! (-> v1-59 0 y) -14336.0) - (send-event (handle->process (-> self arrow)) 'set-position (-> v1-59 0)) + ) + (else + (let ((v1-59 (new 'stack-no-clear 'inline-array 'vector 1)) + (f0-3 (square 409.6)) ) + (.lvf vf1 (&-> (-> (the-as process-drawable gp-0) root transv) quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov a0-32 vf1) + (when (>= f0-3 a0-32) + (set! (-> v1-59 0 quad) (-> (the-as process-drawable gp-0) root trans quad)) + (+! (-> v1-59 0 y) -14336.0) + (send-event (handle->process (-> self arrow)) 'set-position (-> v1-59 0)) ) - (when (!= (-> self sub-state) 1) - (send-event (handle->process (-> self arrow)) 'modify-flags 0 1) - (send-event (handle->process (-> self arrow)) 'map-icon 15) - (set! (-> self sub-state) (the-as uint 1)) - ) + ) + (when (!= (-> self sub-state) 1) + (send-event (handle->process (-> self arrow)) 'modify-flags 0 1) + (send-event (handle->process (-> self arrow)) 'map-icon 15) + (set! (-> self sub-state) (the-as uint 1)) ) ) ) (let ((f30-0 49152.0) (f0-6 (vector-vector-distance-squared (-> (the-as process-drawable gp-0) root trans) (-> self end-pos))) ) - (if (>= (* f30-0 f30-0) f0-6) + (if (>= (square f30-0) f0-6) (go-virtual complete) ) ) @@ -444,13 +444,11 @@ This commonly includes things such as: ) (while (not s5-0) (let ((v1-1 (handle->process (-> self slave 0)))) - (when v1-1 - (let ((f0-0 (vector-vector-distance-squared (-> (the-as process-drawable v1-1) root trans) gp-0)) - (f1-0 (-> gp-0 w)) - ) - (set! s5-0 (< f0-0 (* f1-0 f1-0))) + (if v1-1 + (set! s5-0 + (< (vector-vector-distance-squared (-> (the-as process-drawable v1-1) root trans) gp-0) (square (-> gp-0 w))) + ) ) - ) ) (suspend) ) @@ -489,13 +487,11 @@ This commonly includes things such as: ) (while (not s5-2) (let ((v1-48 (handle->process (-> self slave 0)))) - (when v1-48 - (let ((f0-1 (vector-vector-distance-squared (-> (the-as process-drawable v1-48) root trans) gp-2)) - (f1-3 (-> gp-2 w)) - ) - (set! s5-2 (< f0-1 (* f1-3 f1-3))) + (if v1-48 + (set! s5-2 + (< (vector-vector-distance-squared (-> (the-as process-drawable v1-48) root trans) gp-2) (square (-> gp-2 w))) + ) ) - ) ) (suspend) ) diff --git a/goal_src/jak2/levels/city/port/race/errol-chal.gc b/goal_src/jak2/levels/city/port/race/errol-chal.gc index e3ae31c08d..15e1278d0c 100644 --- a/goal_src/jak2/levels/city/port/race/errol-chal.gc +++ b/goal_src/jak2/levels/city/port/race/errol-chal.gc @@ -504,32 +504,22 @@ (defmethod vehicle-racer-method-154 ((this vehicle-city-racer)) (cond ((logtest? (-> this rbody state flags) (rigid-body-flag enable-physics)) - (let ((f0-0 368640.0)) - (if (or (< (* f0-0 f0-0) (-> this player-dist2)) - (let ((f0-3 102400.0)) - (and (< (* f0-3 f0-3) (-> this player-dist2)) - (not (logtest? (-> this draw status) (draw-control-status on-screen))) - ) - ) - ) - (rigid-body-object-method-39 this) - ) - ) + (if (or (< (square 368640.0) (-> this player-dist2)) + (and (< (square 102400.0) (-> this player-dist2)) + (not (logtest? (-> this draw status) (draw-control-status on-screen))) + ) + ) + (rigid-body-object-method-39 this) + ) ) (else - (let ((f0-6 (-> this player-dist2)) - (f1-2 348160.0) - ) - (if (and (< f0-6 (* f1-2 f1-2)) - (let ((f0-7 (-> this player-dist2)) - (f1-5 81920.0) - ) - (or (< f0-7 (* f1-5 f1-5)) (logtest? (-> this draw status) (draw-control-status on-screen))) + (if (and (< (-> this player-dist2) (square 348160.0)) + (or (< (-> this player-dist2) (square 81920.0)) + (logtest? (-> this draw status) (draw-control-status on-screen)) ) - ) - (rigid-body-object-method-38 this) - ) - ) + ) + (rigid-body-object-method-38 this) + ) ) ) 0 @@ -726,14 +716,13 @@ (set! (-> s4-1 normal w) 1.0) (let ((f30-0 (vector4-dot (-> self plane) (-> s4-1 local-pos))) (f28-0 (vector4-dot (-> self plane) (-> s4-1 normal))) - (f0-5 (fmax - (vector-vector-distance-squared (-> self root trans) (-> s4-1 local-pos)) - (vector-vector-distance-squared (-> self root trans) (-> s4-1 normal)) - ) - ) - (f1-0 40960.0) ) - (when (< f0-5 (* f1-0 f1-0)) + (when (< (fmax + (vector-vector-distance-squared (-> self root trans) (-> s4-1 local-pos)) + (vector-vector-distance-squared (-> self root trans) (-> s4-1 normal)) + ) + (square 40960.0) + ) (when (or (and (< f30-0 0.0) (>= f28-0 0.0)) (and (< f28-0 0.0) (>= f30-0 0.0))) (send-event proc 'turbo-ring (-> self boost)) (set-time! (-> self touch-time)) @@ -1172,11 +1161,8 @@ (set! (-> self max-count) (-> s5-0 length)) ) (set! (-> gp-0 0 quad) (-> (target-pos 0) quad)) - (let* ((s4-1 (new 'static 'vector :x 1305804.8 :y 102400.0 :z 3180544.0 :w 163840.0)) - (f0-0 (vector-vector-distance-squared s4-1 (-> gp-0 0))) - (f1-0 (-> s4-1 w)) - ) - (when (< f0-0 (* f1-0 f1-0)) + (let ((s4-1 (new 'static 'vector :x 1305804.8 :y 102400.0 :z 3180544.0 :w 163840.0))) + (when (< (vector-vector-distance-squared s4-1 (-> gp-0 0)) (square (-> s4-1 w))) (if (< (-> self count) 18) (go-virtual fail) ) @@ -1184,9 +1170,7 @@ ) (while (< (-> self count) (-> self max-count)) (let ((s4-2 (-> s5-0 (-> self count)))) - (let ((f0-1 (-> s4-2 dist))) - (b! (< (* f0-1 f0-1) (vector-vector-distance-squared (-> gp-0 0) (-> s4-2 pos))) cfg-11) - ) + (b! (< (square (-> s4-2 dist)) (vector-vector-distance-squared (-> gp-0 0) (-> s4-2 pos))) cfg-11) (if (turbo-ring-spawn self s4-2 (-> self count) #f) (+! (-> self count) 1) ) @@ -1207,11 +1191,9 @@ () (set-time! (-> self state-time)) (while (not (logtest? (-> *race-state* flags) (race-flags begun))) - (let ((f0-0 (-> self begin-pos w))) - (if (< (* f0-0 f0-0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0))) - (go-virtual fail) - ) - ) + (if (< (square (-> self begin-pos w)) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0))) + (go-virtual fail) + ) (suspend) ) (set-setting! 'exclusive-load 'lerlchal 0.0 0) @@ -1407,11 +1389,9 @@ () (set-time! (-> self state-time)) (while (not (logtest? (-> *race-state* flags) (race-flags begun))) - (let ((f0-0 (-> self begin-pos w))) - (if (< (* f0-0 f0-0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0))) - (go-virtual fail) - ) - ) + (if (< (square (-> self begin-pos w)) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0))) + (go-virtual fail) + ) (suspend) ) (none) diff --git a/goal_src/jak2/levels/city/sack/collection-task.gc b/goal_src/jak2/levels/city/sack/collection-task.gc index 2456d54747..ae7f49420f 100644 --- a/goal_src/jak2/levels/city/sack/collection-task.gc +++ b/goal_src/jak2/levels/city/sack/collection-task.gc @@ -8,13 +8,9 @@ ;; DECOMP BEGINS (defmethod draw ((this hud-moneybag)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 462.0 (* 130.0 (-> this offset)))) - 210 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 462.0 (* 130.0 (-> this offset)))) 210) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -25 25) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -25 25) ((method-of-type hud draw) this) 0 (none) @@ -112,10 +108,8 @@ (set! (-> vec quad) (-> (the-as vehicle vehicle) root root-prim prim-core world-sphere quad)) ) ) - (let ((dist-from-target (vector-vector-distance-squared (-> self root trans) vec)) - (pickup-dist (+ 12288.0 (-> vec w))) - ) - (when (>= (* pickup-dist pickup-dist) dist-from-target) + (let ((dist-from-target (vector-vector-distance-squared (-> self root trans) vec))) + (when (>= (square (+ 12288.0 (-> vec w))) dist-from-target) (sound-play "skill-pickup") (+! (-> *game-info* counter) -1.0) (go-virtual die) @@ -331,13 +325,9 @@ (local-vars (moved-beyond-start? symbol)) (until (or moved-beyond-start? (and *target* (focus-test? *target* pilot))) (suspend) - (let ((min-start-distance 122880.0)) - (set! moved-beyond-start? - (< (* min-start-distance min-start-distance) - (vector-vector-distance-squared (-> self begin-pos) (target-pos 0)) - ) - ) - ) + (set! moved-beyond-start? + (< (square 122880.0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0))) + ) ) (set-setting! 'airlock #f 0.0 0) (set! (-> self count) 0) diff --git a/goal_src/jak2/levels/city/shuttle/shuttle.gc b/goal_src/jak2/levels/city/shuttle/shuttle.gc index 633bf9b893..e2867ca17e 100644 --- a/goal_src/jak2/levels/city/shuttle/shuttle.gc +++ b/goal_src/jak2/levels/city/shuttle/shuttle.gc @@ -8,13 +8,9 @@ ;; DECOMP BEGINS (defmethod draw ((this hud-citizen)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 452.0 (* 130.0 (-> this offset)))) - 195 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 452.0 (* 130.0 (-> this offset)))) 195) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -15 47) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -15 47) ((method-of-type hud draw) this) 0 (none) @@ -411,7 +407,6 @@ ) ) :code (behavior () - (local-vars (sv-176 float) (sv-192 float) (sv-208 float)) (remove-rider (the-as vehicle (handle->process (-> self vehicle))) self) (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) (let ((gp-0 (new 'stack-no-clear 'vector)) @@ -443,22 +438,13 @@ ) (quaternion-copy! s4-2 (-> (the-as vehicle s3-1) root quat)) (compute-seat-position (the-as vehicle s3-1) (-> self root trans) (-> self seat)) - (let ((s3-2 lerp-scale) - (s2-0 0.0) - (s1-0 1.0) - (s0-0 (ja-aframe-num 0)) - ) - (set! sv-176 (ja-aframe 10.0 0)) - (let* ((t0-0 (ja-aframe 7.0 0)) - (f0-4 (s3-2 s2-0 s1-0 s0-0 sv-176 t0-0)) - ) - (quaternion-rotate-local-y! (-> self root quat) s4-2 (* f0-4 (if (zero? (-> self seat)) - -16384.0 - 16384.0 - ) - ) - ) - ) + (let ((f0-4 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 10.0 0) (ja-aframe 7.0 0)))) + (quaternion-rotate-local-y! (-> self root quat) s4-2 (* f0-4 (if (zero? (-> self seat)) + -16384.0 + 16384.0 + ) + ) + ) ) ) (suspend) @@ -492,30 +478,22 @@ ) (compute-seat-position (the-as vehicle a0-59) s2-1 (-> self seat)) (vector-! s4-6 s2-1 gp-0) - (let ((s2-2 lerp-scale) - (s1-1 0.0) - (s0-1 1.0) - ) - (set! sv-192 (ja-aframe-num 0)) - (set! sv-208 (ja-aframe 5.0 0)) - (let* ((t0-1 (ja-aframe 1.0 0)) - (f0-13 (s2-2 s1-1 s0-1 sv-192 sv-208 t0-1)) - (f30-0 (- 1.0 f0-13)) - ) - (quaternion-rotate-local-y! s3-4 s5-0 (if (zero? (-> self seat)) - -16384.0 - 16384.0 - ) - ) - (let ((a1-39 (vector-y-quaternion! (new 'stack-no-clear 'vector) s3-4)) - (s2-3 (new 'stack-no-clear 'quaternion)) - ) - (quaternion-from-two-vectors! s2-3 a1-39 *up-vector*) - (quaternion*! s3-4 s2-3 s3-4) - ) - (quaternion-copy! (-> self root quat) s3-4) - (vector+float*! (-> self root trans) gp-0 s4-6 f30-0) + (let* ((f0-13 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 5.0 0) (ja-aframe 1.0 0))) + (f30-0 (- 1.0 f0-13)) + ) + (quaternion-rotate-local-y! s3-4 s5-0 (if (zero? (-> self seat)) + -16384.0 + 16384.0 + ) + ) + (let ((a1-39 (vector-y-quaternion! (new 'stack-no-clear 'vector) s3-4)) + (s2-3 (new 'stack-no-clear 'quaternion)) + ) + (quaternion-from-two-vectors! s2-3 a1-39 *up-vector*) + (quaternion*! s3-4 s2-3 s3-4) ) + (quaternion-copy! (-> self root quat) s3-4) + (vector+float*! (-> self root trans) gp-0 s4-6 f30-0) ) ) (suspend) @@ -1021,7 +999,7 @@ ;; WARN: Return type mismatch object vs none. (defun shuttle-update ((arg0 task-manager) (arg1 (array city-shuttle-info)) (arg2 uint)) - (local-vars (v1-263 float) (v1-377 float) (sv-336 quaternion)) + (local-vars (v1-263 float) (v1-377 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -1189,12 +1167,7 @@ (let ((s2-0 (handle->process (-> arg0 slave s3-2)))) (cond (s2-0 - (let* ((s1-0 (entity-nav-mesh-by-aid (-> (the-as citizen-rebel s2-0) nav-mesh-aid))) - (s4-1 (if (type? s1-0 entity-nav-mesh) - s1-0 - ) - ) - ) + (let ((s4-1 (as-type (entity-nav-mesh-by-aid (-> (the-as citizen-rebel s2-0) nav-mesh-aid)) entity-nav-mesh))) (cond (s4-1 (when (focus-test? (the-as citizen-rebel s2-0) inactive) @@ -1245,22 +1218,15 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-263 vf1) - (let ((f0-1 v1-263) - (f1-1 32768.0) - ) - (if (and (< f0-1 (* f1-1 f1-1)) (let ((f0-2 (vector-vector-distance-squared - (-> (the-as vehicle s4-2) root trans) - (-> (the-as citizen-rebel s2-0) root trans) - ) - ) - (f1-4 65536.0) + (if (and (< v1-263 (square 32768.0)) (< (vector-vector-distance-squared + (-> (the-as vehicle s4-2) root trans) + (-> (the-as citizen-rebel s2-0) root trans) + ) + (square 65536.0) ) - (< f0-2 (* f1-4 f1-4)) - ) - ) - (send-event s2-0 'board-vehicle s4-2) - ) - ) + ) + (send-event s2-0 'board-vehicle s4-2) + ) ) ) ) @@ -1303,11 +1269,9 @@ (set! (-> s2-1 guard-type) (the-as uint 7)) (vector-reset! (-> s2-1 velocity)) (set! (-> s2-1 position quad) (-> arg1 s3-2 pos quad)) - (let ((s0-0 quaternion-copy!)) - (set! sv-336 (-> s2-1 rotation)) - (let ((a1-50 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *up-vector* 0.0))) - (s0-0 sv-336 a1-50) - ) + (quaternion-copy! + (-> s2-1 rotation) + (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *up-vector* 0.0) ) (logior! (-> s2-1 flags) (traffic-spawn-flags trsflags-00)) (set! (-> s2-1 id) (the-as uint 122)) @@ -1350,11 +1314,7 @@ (cond ((focus-test? (the-as process-focusable s4-3) pilot) (if (and s2-2 - (let ((f0-3 (vector-vector-distance-squared s5-1 (-> (the-as process-drawable s2-2) root trans))) - (f1-7 65536.0) - ) - (< f0-3 (* f1-7 f1-7)) - ) + (< (vector-vector-distance-squared s5-1 (-> (the-as process-drawable s2-2) root trans)) (square 65536.0)) (begin (.lvf vf1 (&-> (-> (the-as process-drawable s2-2) root transv) quad)) (.add.w.vf.x vf2 vf0 vf0) @@ -1363,11 +1323,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-377 vf1) - (let ((f0-4 v1-377) - (f1-10 12288.0) - ) - (< f0-4 (* f1-10 f1-10)) - ) + (< v1-377 (square 12288.0)) ) ) (send-event s4-3 'exit-vehicle s5-1) diff --git a/goal_src/jak2/levels/city/traffic/citizen/citizen.gc b/goal_src/jak2/levels/city/traffic/citizen/citizen.gc index b4b95bdf38..2fcc50931c 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/citizen.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/citizen.gc @@ -199,7 +199,7 @@ (defmethod citizen-method-186 ((this citizen) (arg0 nav-segment)) (vehicle-controller-method-11 (-> this controller)) - (vehicle-controller-method-13 (-> this controller) (-> arg0 branch) (the-as vector (-> arg0 vertex))) + (vehicle-controller-method-13 (-> this controller) (-> arg0 branch) (-> arg0 vertex 0)) 0 (none) ) @@ -257,12 +257,7 @@ ) ) (when v1-1 - (let* ((s5-0 (handle->process (-> this incoming attacker-handle))) - (a2-5 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((a2-5 (the-as process (as-type (handle->process (-> this incoming attacker-handle)) process-focusable)))) (if a2-5 (trigger-alert this 1 (the-as target a2-5)) ) @@ -888,7 +883,6 @@ ) (defmethod citizen-method-190 ((this citizen) (arg0 vector)) - (local-vars (sv-288 nav-poly) (sv-304 clamp-travel-vector-to-mesh-return-info) (sv-320 vector)) (let ((s3-1 (vector-! (new 'stack-no-clear 'vector) (-> this root trans) (the-as vector (-> this cp-sphere)))) (s4-0 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack-no-clear 'vector)) @@ -905,54 +899,47 @@ (vector-*! s4-0 s3-1 s2-0 (vector-dot s3-1 s2-0)) (let ((f30-0 (- 1.0 (/ (vector-length s4-0) (vector-length (-> this cp-vec)))))) (vector+! s4-0 s4-0 (the-as vector (-> this cp-sphere))) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (set! sv-320 (new 'stack-no-clear 'vector)) - (let ((s1-0 (new 'stack-no-clear 'vector))) - (set! sv-304 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) - (set! sv-288 (-> this nav state current-poly)) - (let ((f28-0 (+ (-> this cp-sphere r) (-> this nav-radius-backup)))) - (when sv-288 - (vector-normalize-copy! s0-0 s2-0 f28-0) - (vector-normalize-copy! sv-320 s2-0 (- f28-0)) - (clamp-vector-to-mesh-no-gaps (-> this nav) s4-0 sv-288 s0-0 sv-304) - (let ((a0-12 (-> this nav)) - (t9-7 (method-of-type nav-control clamp-vector-to-mesh-no-gaps)) - (a1-10 s4-0) - (a3-3 sv-320) - ) - (t9-7 a0-12 a1-10 sv-288 a3-3 sv-304) - ) - (let* ((v1-22 s0-0) - (f0-11 (sqrtf (+ (* (-> v1-22 x) (-> v1-22 x)) (* (-> v1-22 z) (-> v1-22 z))))) - (v1-24 sv-320) - (f1-10 (sqrtf (+ (* (-> v1-24 x) (-> v1-24 x)) (* (-> v1-24 z) (-> v1-24 z))))) - ) - (cond - ((< 0.0 (vector-dot s2-0 s3-1)) - (if (< 4096.0 f0-11) - (set! (-> s1-0 quad) (-> s0-0 quad)) - (set! (-> s1-0 quad) (-> sv-320 quad)) - ) - ) - ((< 4096.0 f1-10) + (let ((s0-0 (new 'stack-no-clear 'vector)) + (sv-320 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + (sv-304 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) + (sv-288 (-> this nav state current-poly)) + (f28-0 (+ (-> this cp-sphere r) (-> this nav-radius-backup))) + ) + (when sv-288 + (vector-normalize-copy! s0-0 s2-0 f28-0) + (vector-normalize-copy! sv-320 s2-0 (- f28-0)) + (clamp-vector-to-mesh-no-gaps (-> this nav) s4-0 sv-288 s0-0 sv-304) + (clamp-vector-to-mesh-no-gaps (-> this nav) s4-0 sv-288 sv-320 sv-304) + (let* ((v1-22 s0-0) + (f0-11 (sqrtf (+ (* (-> v1-22 x) (-> v1-22 x)) (* (-> v1-22 z) (-> v1-22 z))))) + (v1-24 sv-320) + (f1-10 (sqrtf (+ (* (-> v1-24 x) (-> v1-24 x)) (* (-> v1-24 z) (-> v1-24 z))))) + ) + (cond + ((< 0.0 (vector-dot s2-0 s3-1)) + (if (< 4096.0 f0-11) + (set! (-> s1-0 quad) (-> s0-0 quad)) (set! (-> s1-0 quad) (-> sv-320 quad)) ) - (else - (set! (-> s1-0 quad) (-> s0-0 quad)) - ) - ) + ) + ((< 4096.0 f1-10) + (set! (-> s1-0 quad) (-> sv-320 quad)) + ) + (else + (set! (-> s1-0 quad) (-> s0-0 quad)) ) - (set! (-> arg0 quad) (-> s1-0 quad)) - (let ((a1-11 (new 'stack-no-clear 'vector))) - (set! (-> a1-11 quad) (-> this root trans quad)) - (set! (-> a1-11 y) 0.0) - (let ((f0-15 (- f28-0 (vector-vector-xz-distance s4-0 a1-11)))) - (if (< f0-15 0.0) - (set! f0-15 0.0) - ) - (vector-normalize! arg0 (* (-> this cp-factor) f0-15 f30-0)) + ) + ) + (set! (-> arg0 quad) (-> s1-0 quad)) + (let ((a1-11 (new 'stack-no-clear 'vector))) + (set! (-> a1-11 quad) (-> this root trans quad)) + (set! (-> a1-11 y) 0.0) + (let ((f0-15 (- f28-0 (vector-vector-xz-distance s4-0 a1-11)))) + (if (< f0-15 0.0) + (set! f0-15 0.0) ) - ) + (vector-normalize! arg0 (* (-> this cp-factor) f0-15 f30-0)) ) ) ) @@ -1096,7 +1083,7 @@ (add-debug-line #t (bucket-id debug-no-zbuf1) - (the-as vector (-> gp-0 seg vertex)) + (-> gp-0 seg vertex 0) (-> gp-0 seg vertex 1) *color-blue* #f @@ -1189,7 +1176,7 @@ (add-debug-line #t (bucket-id debug-no-zbuf1) - (the-as vector (-> gp-0 seg vertex)) + (-> gp-0 seg vertex 0) (-> gp-0 seg vertex 1) *color-blue* #f @@ -1447,11 +1434,11 @@ ) :post (behavior () (if (and (nonzero? (-> self controller branch)) - (let ((f0-0 (vector-vector-xz-distance-squared (-> self root trans) (-> self controller turn-exit-point))) - (f1-0 16384.0) - ) - (or (< f0-0 (* f1-0 f1-0)) (logtest? (-> self nav state flags) (nav-state-flag at-target))) - ) + (or (< (vector-vector-xz-distance-squared (-> self root trans) (-> self controller turn-exit-point)) + (square 16384.0) + ) + (logtest? (-> self nav state flags) (nav-state-flag at-target)) + ) ) (vehicle-controller-method-14 (-> self controller) (the-as vehicle self)) ) diff --git a/goal_src/jak2/levels/city/traffic/citizen/civilian.gc b/goal_src/jak2/levels/city/traffic/citizen/civilian.gc index 90c7c1b79e..969cf6ce39 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/civilian.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/civilian.gc @@ -554,7 +554,6 @@ ) (defbehavior civilian-avoid-danger-post civilian () - (local-vars (sv-352 nav-poly)) (let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) (the-as vector (-> self danger-pos))))) (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> self controller turn-exit-point) (-> self root trans)))) (vector-! @@ -577,67 +576,60 @@ (s2-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) (s0-0 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) + (v1-6 (-> self nav)) + (a0-8 (-> self danger-pos)) + (a1-5 (new 'stack-no-clear 'nav-find-poly-parms)) ) - (let ((v1-6 (-> self nav)) - (a0-8 (-> self danger-pos)) - (a1-5 (new 'stack-no-clear 'nav-find-poly-parms)) - ) - (vector-! (-> a1-5 point) (the-as vector a0-8) (-> v1-6 state mesh bounds)) - (set! (-> a1-5 y-threshold) (-> v1-6 nearest-y-threshold)) - (set! (-> a1-5 ignore) (the-as uint 2)) - (set! sv-352 (find-poly-containing-point-local (-> v1-6 state mesh) a1-5)) - ) - (when sv-352 - (vector-normalize-copy! s3-0 s1-1 40960.0) - (clamp-vector-to-mesh-no-gaps (-> self nav) (-> self danger-pos) sv-352 s3-0 s0-0) - (vector-normalize-copy! s2-0 s1-1 -40960.0) - (let ((a0-14 (-> self nav)) - (t9-7 (method-of-type nav-control clamp-vector-to-mesh-no-gaps)) - (a1-9 (-> self danger-pos)) - (a3-3 s2-0) - ) - (t9-7 a0-14 a1-9 sv-352 a3-3 s0-0) - ) - (let* ((v1-12 s3-0) - (f0-7 (sqrtf (+ (* (-> v1-12 x) (-> v1-12 x)) (* (-> v1-12 z) (-> v1-12 z))))) - (v1-14 s2-0) - (f1-7 (sqrtf (+ (* (-> v1-14 x) (-> v1-14 x)) (* (-> v1-14 z) (-> v1-14 z))))) - ) - (cond - ((< 0.0 (vector-dot s1-1 gp-1)) - (if (< 8192.0 f0-7) - (set! (-> s4-0 quad) (-> s3-0 quad)) - (set! (-> s4-0 quad) (-> s2-0 quad)) + (vector-! (-> a1-5 point) (the-as vector a0-8) (-> v1-6 state mesh bounds)) + (set! (-> a1-5 y-threshold) (-> v1-6 nearest-y-threshold)) + (set! (-> a1-5 ignore) (the-as uint 2)) + (let ((sv-352 (find-poly-containing-point-local (-> v1-6 state mesh) a1-5))) + (when sv-352 + (vector-normalize-copy! s3-0 s1-1 40960.0) + (clamp-vector-to-mesh-no-gaps (-> self nav) (-> self danger-pos) sv-352 s3-0 s0-0) + (vector-normalize-copy! s2-0 s1-1 -40960.0) + (clamp-vector-to-mesh-no-gaps (-> self nav) (-> self danger-pos) sv-352 s2-0 s0-0) + (let* ((v1-12 s3-0) + (f0-7 (sqrtf (+ (* (-> v1-12 x) (-> v1-12 x)) (* (-> v1-12 z) (-> v1-12 z))))) + (v1-14 s2-0) + (f1-7 (sqrtf (+ (* (-> v1-14 x) (-> v1-14 x)) (* (-> v1-14 z) (-> v1-14 z))))) ) - ) - ((< 8192.0 f1-7) - (set! (-> s4-0 quad) (-> s2-0 quad)) - ) - (else - (set! (-> s4-0 quad) (-> s3-0 quad)) + (cond + ((< 0.0 (vector-dot s1-1 gp-1)) + (if (< 8192.0 f0-7) + (set! (-> s4-0 quad) (-> s3-0 quad)) + (set! (-> s4-0 quad) (-> s2-0 quad)) + ) + ) + ((< 8192.0 f1-7) + (set! (-> s4-0 quad) (-> s2-0 quad)) + ) + (else + (set! (-> s4-0 quad) (-> s3-0 quad)) + ) ) ) - ) - (let* ((v1-24 gp-1) - (f0-13 (sqrtf (+ (* (-> v1-24 x) (-> v1-24 x)) (* (-> v1-24 z) (-> v1-24 z))))) - ) - (let ((f1-12 0.8) - (v1-27 s5-1) - ) - (* f1-12 (sqrtf (+ (* (-> v1-27 x) (-> v1-27 x)) (* (-> v1-27 z) (-> v1-27 z))))) - ) - (let ((f0-15 (/ (- (-> self danger-pos r) f0-13) (-> self danger-pos r)))) - (if (< f0-15 0.0) - (set! f0-15 0.0) - ) - (if (< 0.8 f0-15) - (set! f0-15 0.8) - ) - (set! (-> gp-1 quad) (-> s4-0 quad)) - (vector-xz-normalize! gp-1 (* 16384.0 f0-15)) + (let* ((v1-24 gp-1) + (f0-13 (sqrtf (+ (* (-> v1-24 x) (-> v1-24 x)) (* (-> v1-24 z) (-> v1-24 z))))) + ) + (let ((f1-12 0.8) + (v1-27 s5-1) + ) + (* f1-12 (sqrtf (+ (* (-> v1-27 x) (-> v1-27 x)) (* (-> v1-27 z) (-> v1-27 z))))) + ) + (let ((f0-15 (/ (- (-> self danger-pos r) f0-13) (-> self danger-pos r)))) + (if (< f0-15 0.0) + (set! f0-15 0.0) + ) + (if (< 0.8 f0-15) + (set! f0-15 0.8) + ) + (set! (-> gp-1 quad) (-> s4-0 quad)) + (vector-xz-normalize! gp-1 (* 16384.0 f0-15)) + ) ) + (vector-xz-normalize! s5-1 16384.0) ) - (vector-xz-normalize! s5-1 16384.0) ) ) ) @@ -765,7 +757,6 @@ ) (defbehavior civilian-clear-path-post civilian () - (local-vars (sv-304 nav-poly)) (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) (the-as vector (-> self cp-sphere)))) (s1-0 (new 'stack-no-clear 'vector)) (gp-0 (new 'stack-no-clear 'vector)) @@ -782,41 +773,35 @@ (s2-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) (s0-0 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) + (sv-304 (-> self nav state current-poly)) + (f30-0 (+ 4096.0 (-> self cp-sphere r))) ) - (set! sv-304 (-> self nav state current-poly)) - (let ((f30-0 (+ 4096.0 (-> self cp-sphere r)))) - (when sv-304 - (vector-normalize-copy! s3-0 gp-0 f30-0) - (vector-normalize-copy! s2-0 gp-0 (- f30-0)) - (clamp-vector-to-mesh-no-gaps (-> self nav) s1-0 sv-304 s3-0 s0-0) - (let ((a0-12 (-> self nav)) - (t9-8 (method-of-type nav-control clamp-vector-to-mesh-no-gaps)) - (a3-3 s2-0) - ) - (t9-8 a0-12 s1-0 sv-304 a3-3 s0-0) - ) - (let* ((v1-14 s3-0) - (f0-9 (sqrtf (+ (* (-> v1-14 x) (-> v1-14 x)) (* (-> v1-14 z) (-> v1-14 z))))) - (v1-16 s2-0) - (f1-8 (sqrtf (+ (* (-> v1-16 x) (-> v1-16 x)) (* (-> v1-16 z) (-> v1-16 z))))) + (when sv-304 + (vector-normalize-copy! s3-0 gp-0 f30-0) + (vector-normalize-copy! s2-0 gp-0 (- f30-0)) + (clamp-vector-to-mesh-no-gaps (-> self nav) s1-0 sv-304 s3-0 s0-0) + (clamp-vector-to-mesh-no-gaps (-> self nav) s1-0 sv-304 s2-0 s0-0) + (let* ((v1-14 s3-0) + (f0-9 (sqrtf (+ (* (-> v1-14 x) (-> v1-14 x)) (* (-> v1-14 z) (-> v1-14 z))))) + (v1-16 s2-0) + (f1-8 (sqrtf (+ (* (-> v1-16 x) (-> v1-16 x)) (* (-> v1-16 z) (-> v1-16 z))))) + ) + (cond + ((< 0.0 (vector-dot gp-0 s5-1)) + (if (< 4096.0 f0-9) + (set! (-> s4-0 quad) (-> s3-0 quad)) + (set! (-> s4-0 quad) (-> s2-0 quad)) ) - (cond - ((< 0.0 (vector-dot gp-0 s5-1)) - (if (< 4096.0 f0-9) - (set! (-> s4-0 quad) (-> s3-0 quad)) - (set! (-> s4-0 quad) (-> s2-0 quad)) - ) - ) - ((< 4096.0 f1-8) - (set! (-> s4-0 quad) (-> s2-0 quad)) - ) - (else - (set! (-> s4-0 quad) (-> s3-0 quad)) - ) + ) + ((< 4096.0 f1-8) + (set! (-> s4-0 quad) (-> s2-0 quad)) + ) + (else + (set! (-> s4-0 quad) (-> s3-0 quad)) ) ) - (set! (-> gp-0 quad) (-> s4-0 quad)) ) + (set! (-> gp-0 quad) (-> s4-0 quad)) ) ) (if *citizen-debug* @@ -1717,7 +1702,6 @@ ) ) :code (behavior () - (local-vars (sv-128 float) (sv-144 float)) (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! (-> self draw art-group data (-> self info get-in-car-anim)) :num! min) (let ((f30-0 0.0)) @@ -1748,24 +1732,15 @@ (quaternion-copy! s3-0 (-> (the-as vehicle s2-0) root quat)) (compute-seat-position (the-as vehicle s2-0) s1-0 (-> self seat)) (vector-! s4-1 s1-0 gp-2) - (let ((s2-1 lerp-scale) - (s1-1 0.0) - (s0-0 1.0) - ) - (set! sv-128 (ja-aframe-num 0)) - (set! sv-144 (ja-aframe 1.0 0)) - (let* ((t0-1 (ja-aframe 5.0 0)) - (f30-1 (s2-1 s1-1 s0-0 sv-128 sv-144 t0-1)) - ) - (quaternion-rotate-local-y! s3-0 s3-0 (* f30-1 (if (zero? (-> self seat)) - -16384.0 - 16384.0 - ) - ) - ) - (quaternion-slerp! (-> self root quat) s5-0 s3-0 f30-1) - (vector+float*! (-> self root trans) gp-2 s4-1 f30-1) - ) + (let ((f30-1 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 1.0 0) (ja-aframe 5.0 0)))) + (quaternion-rotate-local-y! s3-0 s3-0 (* f30-1 (if (zero? (-> self seat)) + -16384.0 + 16384.0 + ) + ) + ) + (quaternion-slerp! (-> self root quat) s5-0 s3-0 f30-1) + (vector+float*! (-> self root trans) gp-2 s4-1 f30-1) ) ) (suspend) @@ -1933,7 +1908,6 @@ ) ) :code (behavior () - (local-vars (sv-128 float) (sv-144 float)) (ja-channel-push! 1 (seconds 0.1)) (remove-rider (the-as vehicle (handle->process (-> self vehicle))) self) (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) @@ -1991,24 +1965,16 @@ ) (compute-seat-position (the-as vehicle a0-46) s2-1 (-> self seat)) (vector-! s4-3 s2-1 gp-3) - (let ((s2-2 lerp-scale) - (s1-1 0.0) - (s0-0 1.0) - ) - (set! sv-128 (ja-aframe-num 0)) - (set! sv-144 (ja-aframe 5.0 0)) - (let* ((t0-1 (ja-aframe 1.0 0)) - (f0-12 (s2-2 s1-1 s0-0 sv-128 sv-144 t0-1)) - (f30-0 (- 1.0 f0-12)) - ) - (quaternion-rotate-local-y! s3-2 s5-2 (if (zero? (-> self seat)) - -16384.0 - 16384.0 - ) - ) - (quaternion-copy! (-> self root quat) s3-2) - (vector+float*! (-> self root trans) gp-3 s4-3 f30-0) - ) + (let* ((f0-12 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 5.0 0) (ja-aframe 1.0 0))) + (f30-0 (- 1.0 f0-12)) + ) + (quaternion-rotate-local-y! s3-2 s5-2 (if (zero? (-> self seat)) + -16384.0 + 16384.0 + ) + ) + (quaternion-copy! (-> self root quat) s3-2) + (vector+float*! (-> self root trans) gp-3 s4-3 f30-0) ) ) (suspend) diff --git a/goal_src/jak2/levels/city/traffic/citizen/guard.gc b/goal_src/jak2/levels/city/traffic/citizen/guard.gc index 08430020a2..19251e0692 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/guard.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/guard.gc @@ -314,14 +314,6 @@ (defmethod crimson-guard-method-218 ((this crimson-guard) (arg0 vector)) - (local-vars - (sv-240 vector) - (sv-256 (function vector vector vector)) - (sv-272 vector) - (sv-288 vector) - (sv-304 vector) - (sv-320 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -330,8 +322,9 @@ (vf7 :class vf) ) (init-vf0-vector) - (set! sv-240 arg0) - (let ((s0-0 (new 'stack-no-clear 'vector))) + (let ((sv-240 arg0) + (s0-0 (new 'stack-no-clear 'vector)) + ) (let ((v1-1 (-> this root trans))) (let ((a0-1 *y-vector*)) (let ((a1-2 8192.0)) @@ -345,9 +338,9 @@ (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) (.svf (&-> s0-0 quad) vf6) - (set! sv-320 (new 'stack-no-clear 'vector)) - (set! sv-304 (new 'stack-no-clear 'vector)) - (let ((s1-0 (new 'stack-no-clear 'vector)) + (let ((sv-320 (new 'stack-no-clear 'vector)) + (sv-304 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack-no-clear 'vector)) (s5-0 (new 'stack-no-clear 'vector)) ) @@ -409,18 +402,15 @@ (.svf (&-> a1-8 quad) vf6) ) (vector-normalize! (vector-! sv-320 sv-240 s0-0) 1.0) - (set! sv-288 (new 'stack-no-clear 'vector)) - (let ((v1-20 (-> sv-240 quad))) - (set! (-> sv-288 quad) v1-20) + (let ((sv-288 (new 'stack-no-clear 'vector))) + (set! (-> sv-288 quad) (-> sv-240 quad)) + (vector+! sv-288 sv-288 (vector-rotate90-around-y! + (new 'stack-no-clear 'vector) + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) sv-288 s0-0) -2998.272) + ) + ) + (vector-normalize! (vector-! sv-320 sv-288 s0-0) 1.0) ) - (set! sv-256 vector-rotate90-around-y!) - (set! sv-272 (new 'stack-no-clear 'vector)) - (let* ((a1-13 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) sv-288 s0-0) -2998.272)) - (v0-5 (sv-256 sv-272 a1-13)) - ) - (vector+! sv-288 sv-288 v0-5) - ) - (vector-normalize! (vector-! sv-320 sv-288 s0-0) 1.0) (vector-z-quaternion! sv-304 (-> this root quat)) (rot-zxy-from-vector! s2-0 sv-304) (rot-zxy-from-vector! s1-0 sv-320) @@ -1643,11 +1633,9 @@ ) :post (behavior () (if (and (nonzero? (-> self controller branch)) - (let ((f0-0 (vector-vector-xz-distance-squared (-> self root trans) (-> self controller turn-exit-point))) - (f1-0 16384.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared (-> self root trans) (-> self controller turn-exit-point)) + (square 16384.0) + ) ) (vehicle-controller-method-14 (-> self controller) (the-as vehicle self)) ) @@ -2554,7 +2542,6 @@ ;; WARN: Return type mismatch symbol vs none. (defun spread-lightning-lazer ((arg0 lightning-control) (arg1 vector) (arg2 vector) (arg3 vector)) - (local-vars (sv-640 int) (sv-656 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -2573,8 +2560,9 @@ (vector-length arg2) (let ((s1-0 (new 'stack-no-clear 'vector))) (set! (-> s1-0 quad) (-> arg3 quad)) - (let ((s0-0 (new 'stack-no-clear 'collide-query))) - (set! sv-640 0) + (let ((s0-0 (new 'stack-no-clear 'collide-query)) + (sv-640 0) + ) (while (< sv-640 6) (let ((v1-6 s0-0)) (set! (-> v1-6 radius) 2867.2) @@ -2672,11 +2660,12 @@ (+! (-> s3-0 z) (rand-vu-float-range -819.2 819.2)) (set-point! arg0 (-> arg0 state points-to-draw) s3-0) (+! (-> arg0 state points-to-draw) 1) - (set! sv-656 (-> s0-0 best-other-tri normal)) - (quaternion-from-two-vectors! s2-0 s1-0 sv-656) - (vector-orient-by-quat! s4-0 s4-0 s2-0) - (set! (-> s1-0 quad) (-> sv-656 quad)) - (vector-flatten! s4-0 s4-0 sv-656) + (let ((sv-656 (-> s0-0 best-other-tri normal))) + (quaternion-from-two-vectors! s2-0 s1-0 sv-656) + (vector-orient-by-quat! s4-0 s4-0 s2-0) + (set! (-> s1-0 quad) (-> sv-656 quad)) + (vector-flatten! s4-0 s4-0 sv-656) + ) ) (else (vector+! s5-0 s5-0 s4-0) @@ -2687,7 +2676,7 @@ ) ) ) - (set! sv-640 (+ sv-640 1)) + (+! sv-640 1) ) ) ) @@ -2700,7 +2689,6 @@ ;; WARN: Return type mismatch object vs none. (defmethod crimson-guard-method-222 ((this crimson-guard)) - (local-vars (sv-800 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -2761,15 +2749,14 @@ (vector+! s5-0 s4-0 s1-0) (point-in-plane-<-point+normal! s2-1 s5-0 (-> s3-0 best-other-tri normal)) (vector-! s2-1 s2-1 s5-0) - (let ((s1-1 quaternion-vector-angle!) - (s0-0 (new 'stack-no-clear 'quaternion)) + (let ((a2-4 (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (-> s3-0 best-other-tri normal) + (rand-vu-float-range 0.0 65536.0) + ) + ) ) - (set! sv-800 (-> s3-0 best-other-tri normal)) - (let* ((a2-3 (rand-vu-float-range 0.0 65536.0)) - (a2-4 (s1-1 s0-0 sv-800 a2-3)) - ) - (vector-orient-by-quat! s2-1 s2-1 a2-4) - ) + (vector-orient-by-quat! s2-1 s2-1 a2-4) ) (part-tracker-spawn :to this :group part-crimson-lightning-glow :mat-joint s4-0) (part-tracker-spawn :to this :group part-crimson-lightning-glow :mat-joint s5-0) @@ -3102,14 +3089,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defmethod crimson-guard-method-224 ((this crimson-guard) (arg0 vector)) - (local-vars - (f0-8 float) - (sv-768 vector) - (sv-784 vector) - (sv-800 nav-control) - (sv-816 nav-poly) - (sv-832 vector) - ) + (local-vars (f0-8 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -3124,8 +3104,8 @@ (dotimes (s3-0 2) (vector-normalize! s4-0 (* 4096.0 (+ 4.0 (* 2.0 (the float s3-0))))) (dotimes (s2-0 6) - (set! sv-768 (new 'stack-no-clear 'vector)) - (let ((s1-0 (new 'stack-no-clear 'vector)) + (let ((sv-768 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) (s0-0 (new 'stack 'collide-query)) ) (vector-rotate-around-y! sv-768 s4-0 (* 182.04445 (the float (+ (* 23 s2-0) -70)))) @@ -3154,59 +3134,52 @@ (vector-! (-> a1-7 point) a0-8 (-> v1-14 state mesh bounds)) (set! (-> a1-7 y-threshold) (-> v1-14 nearest-y-threshold)) (set! (-> a1-7 ignore) (the-as uint 2)) - (set! sv-816 (find-poly-containing-point-local (-> v1-14 state mesh) a1-7)) - ) - (when sv-816 - (let* ((v1-18 s4-0) - (f0-7 (-> sv-768 x)) - (f1-4 (-> sv-768 y)) - (f2-2 (-> sv-768 z)) - (f3-2 (-> v1-18 x)) - (f4-0 (-> v1-18 y)) - (f5-0 (-> v1-18 z)) - ) - ;; og:preserve-this inlined vector-dot - ; (.mula.s f0-7 f3-2) - ; (.madda.s f1-4 f4-0) - ; (.madd.s f0-8 f2-2 f5-0) - (set! f0-8 (+ (* f0-7 f3-2) (* f1-4 f4-0) (* f2-2 f5-0))) - ) - (let ((f28-0 f0-8)) - (new 'stack-no-clear 'vector) - (let ((a1-8 (new 'stack-no-clear 'vector))) - (set! (-> a1-8 quad) (-> s1-0 quad)) - (set! (-> a1-8 w) 8192.0) - (when (not (add-root-sphere-to-hash! (-> this nav) a1-8 32)) - (when (< f30-0 f28-0) - (set! f30-0 f28-0) - (set! sv-784 (new 'stack-no-clear 'vector)) - (let ((a3-3 (new 'stack-no-clear 'vector))) - (set! sv-800 (-> this nav)) - (set! sv-832 sv-784) - (let* ((v1-29 s1-0) - (a0-18 (-> sv-800 state mesh)) - (t9-7 (method-of-object a0-18 project-point-onto-plane-of-poly-local)) - (a2-7 sv-832) - (t0-2 (vector-! (new 'stack-no-clear 'vector) v1-29 (-> sv-800 state mesh bounds))) - ) - (t9-7 a0-18 sv-816 a2-7 a3-3 t0-2) + (let ((sv-816 (find-poly-containing-point-local (-> v1-14 state mesh) a1-7))) + (when sv-816 + (let* ((v1-18 s4-0)) + (set! f0-8 (vector-dot sv-768 v1-18)) + ) + (let ((f28-0 f0-8)) + (new 'stack-no-clear 'vector) + (let ((a1-8 (new 'stack-no-clear 'vector))) + (set! (-> a1-8 quad) (-> s1-0 quad)) + (set! (-> a1-8 w) 8192.0) + (when (not (add-root-sphere-to-hash! (-> this nav) a1-8 32)) + (when (< f30-0 f28-0) + (set! f30-0 f28-0) + (let ((sv-784 (new 'stack-no-clear 'vector))) + (let ((a3-3 (new 'stack-no-clear 'vector)) + (sv-800 (-> this nav)) + (sv-832 sv-784) + ) + (let ((v1-29 s1-0)) + (project-point-onto-plane-of-poly-local + (-> sv-800 state mesh) + sv-816 + sv-832 + a3-3 + (vector-! (new 'stack-no-clear 'vector) v1-29 (-> sv-800 state mesh bounds)) + ) + ) + (let ((v1-30 sv-832)) + (let ((a0-21 (-> sv-800 state mesh bounds))) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-832 quad)) + (.lvf vf5 (&-> a0-21 quad)) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-30 quad) vf6) + ) + ) + 0 + (set! (-> s1-0 y) (-> sv-784 y)) + ) + (if (enemy-above-ground? this s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (set! (-> s1-0 y) (-> s0-0 best-other-tri intersect y)) + ) + (set! (-> arg0 quad) (-> s1-0 quad)) ) ) - (let ((v1-30 sv-832)) - (let ((a0-21 (-> sv-800 state mesh bounds))) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-832 quad)) - (.lvf vf5 (&-> a0-21 quad)) - ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-30 quad) vf6) - ) - 0 - (set! (-> s1-0 y) (-> sv-784 y)) - (if (enemy-above-ground? this s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) - (set! (-> s1-0 y) (-> s0-0 best-other-tri intersect y)) - ) - (set! (-> arg0 quad) (-> s1-0 quad)) ) ) ) diff --git a/goal_src/jak2/levels/city/traffic/citizen/metalhead-grunt.gc b/goal_src/jak2/levels/city/traffic/citizen/metalhead-grunt.gc index 829b143b2d..7e3ea4c703 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/metalhead-grunt.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/metalhead-grunt.gc @@ -254,7 +254,7 @@ (defmethod general-event-handler ((this metalhead-grunt) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy -@TODO - unsure if there is a pattern for the events and this should have a more specific name" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) @@ -281,11 +281,7 @@ ) ) (zero? (rnd-int-count this 3)) - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-0 32768.0) - ) - (>= f0-0 (* f1-0 f1-0)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (kill-prefer-falling this) ) @@ -338,12 +334,7 @@ ) ) ) - (let* ((gp-1 *target*) - (a0-4 (if (type? gp-1 process-focusable) - gp-1 - ) - ) - ) + (let ((a0-4 (the-as target (as-type *target* process-focusable)))) (when a0-4 (let* ((gp-2 (-> self root)) (s3-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (get-trans a0-4 0) (-> gp-2 trans)) 1.0)) @@ -591,23 +582,18 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-5 vf1) - (let* ((f30-0 v1-5) - (f0-0 arg0) - (f28-0 (* f0-0 f0-0)) - (f0-2 12288.0) - ) - (when (or (>= (* f0-2 f0-2) f30-0) (>= f28-0 f30-0)) + (let ((f30-0 v1-5) + (f28-0 (square arg0)) + ) + (when (or (>= (square 12288.0) f30-0) (>= f28-0 f30-0)) (let ((f26-0 (quaternion-y-angle (-> this root quat))) (f0-7 (atan (-> s4-0 x) (-> s4-0 z))) - (f1-0 1228.8) ) (cond - ((and (< (* f1-0 f1-0) f30-0) (>= f28-0 f30-0) (>= 8192.0 (fabs (deg- f26-0 f0-7)))) + ((and (< (square 1228.8) f30-0) (>= f28-0 f30-0) (>= 8192.0 (fabs (deg- f26-0 f0-7)))) (go (method-of-object this attack)) ) - ((let ((f0-10 12288.0)) - (< f30-0 (* f0-10 f0-10)) - ) + ((< f30-0 (square 12288.0)) (go (method-of-object this spin-attack)) ) ) @@ -635,10 +621,7 @@ (when (and (>= gp-0 (-> self next-warn-time)) (not (logtest? (-> self draw status) (draw-control-status on-screen))) ) - (when (and a0-1 (let ((f0-0 65536.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (get-trans a0-1 0) (-> self root trans))) - ) - ) + (when (and a0-1 (>= (square 65536.0) (vector-vector-xz-distance-squared (get-trans a0-1 0) (-> self root trans)))) (sound-play "grunt-warn") (set! (-> self next-warn-time) (+ gp-0 (rnd-int-range self 300 360))) ) @@ -1169,11 +1152,11 @@ ) ;; WARN: Return type mismatch citizen-enemy vs metalhead-grunt. -(defmethod relocate ((this metalhead-grunt) (arg0 int)) +(defmethod relocate ((this metalhead-grunt) (offset int)) (if (nonzero? (-> this intro-path)) - (&+! (-> this intro-path) arg0) + (&+! (-> this intro-path) offset) ) - (the-as metalhead-grunt ((method-of-type citizen-enemy relocate) this arg0)) + (the-as metalhead-grunt ((method-of-type citizen-enemy relocate) this offset)) ) (defmethod init-enemy-collision! ((this metalhead-grunt)) diff --git a/goal_src/jak2/levels/city/traffic/citizen/metalhead-predator.gc b/goal_src/jak2/levels/city/traffic/citizen/metalhead-predator.gc index 6ea6a9fa0b..d78d172067 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/metalhead-predator.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/metalhead-predator.gc @@ -634,27 +634,22 @@ #t ) (else - (let ((s4-1 (-> s5-0 best-other-tri collide-ptr))) - (if (and (if (type? s4-1 collide-shape-prim) - s4-1 - ) - (< (vector-dot - (-> s5-0 best-other-tri normal) - (vector-! (new 'stack-no-clear 'vector) arg2 (the-as vector (-> s5-0 best-other-tri))) - ) - 0.0 + (if (and (the-as basic (as-type (-> s5-0 best-other-tri collide-ptr) collide-shape-prim)) + (< (vector-dot + (-> s5-0 best-other-tri normal) + (vector-! (new 'stack-no-clear 'vector) arg2 (the-as vector (-> s5-0 best-other-tri))) ) - ) - #f - ) - ) + 0.0 + ) + ) + #f + ) ) ) ) ) (defmethod metalhead-predator-method-206 ((this metalhead-predator) (arg0 int) (arg1 float)) - (local-vars (sv-240 vector) (sv-256 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -686,23 +681,22 @@ (when s3-0 (seek! (-> this miss-amount) (* 0.2 (vector-length (-> (the-as process-drawable s3-0) root transv))) 4096.0) (set! (-> s2-0 quad) (-> (get-trans (the-as process-focusable s3-0) 3) quad)) - (set! sv-240 (new 'stack-no-clear 'vector)) - (let ((v1-25 (-> s5-0 pos)) - (a0-18 s2-0) - ) - (.lvf vf4 (&-> v1-25 quad)) - (.lvf vf5 (&-> a0-18 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-240 quad) vf6) - (let* ((f0-5 (vector-length sv-240)) - (f0-6 (/ f0-5 (meters 130))) - ) - (set! sv-256 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) - (s1-1 (new 'stack-no-clear 'vector)) + (let ((sv-240 (new 'stack-no-clear 'vector))) + (let ((v1-25 (-> s5-0 pos)) + (a0-18 s2-0) ) + (.lvf vf4 (&-> v1-25 quad)) + (.lvf vf5 (&-> a0-18 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-240 quad) vf6) + (let* ((f0-5 (vector-length sv-240)) + (f0-6 (/ f0-5 (meters 130))) + (sv-256 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack-no-clear 'vector)) + ) (let ((a0-19 s2-0)) (let ((v1-31 s2-0)) (let ((a1-6 (-> (the-as process-focusable s3-0) root transv))) @@ -726,11 +720,7 @@ (let ((a2-5 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) sv-240 (-> this shoot-angle)))) (vector-orient-by-quat! sv-256 sv-256 a2-5) ) - (let* ((t9-9 quaternion-vector-angle!) - (a0-27 (new 'stack-no-clear 'quaternion)) - (a2-6 (-> this shoot-angle)) - (a2-7 (t9-9 a0-27 sv-240 a2-6)) - ) + (let ((a2-7 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) sv-240 (-> this shoot-angle)))) (vector-orient-by-quat! s0-0 s0-0 a2-7) ) (let ((a0-29 s1-1)) diff --git a/goal_src/jak2/levels/city/traffic/traffic-engine.gc b/goal_src/jak2/levels/city/traffic/traffic-engine.gc index fc9d421ef4..0747609d2f 100644 --- a/goal_src/jak2/levels/city/traffic/traffic-engine.gc +++ b/goal_src/jak2/levels/city/traffic/traffic-engine.gc @@ -40,15 +40,7 @@ (defmethod debug-draw ((this vis-cell)) (dotimes (s5-0 (-> this segment-count)) (let ((s4-0 (-> this segment-array s5-0))) - (add-debug-line - #t - (bucket-id debug2) - (the-as vector (-> s4-0 vertex)) - (-> s4-0 vertex 1) - *color-gray* - #f - (the-as rgba -1) - ) + (add-debug-line #t (bucket-id debug2) (-> s4-0 vertex 0) (-> s4-0 vertex 1) *color-gray* #f (the-as rgba -1)) (add-debug-x #t (bucket-id debug2) (-> s4-0 vertex 1) *color-red*) ) ) @@ -181,7 +173,7 @@ ) (defmethod debug-draw-grid ((this grid-info) (arg0 rgba)) - (draw-grid (the-as vector (-> this box)) (-> this box max) (-> this dimension-array) arg0) + (draw-grid (-> this box min) (-> this box max) (-> this dimension-array) arg0) 0 (none) ) @@ -550,13 +542,13 @@ (defmethod activate-from-params ((this traffic-tracker) (arg0 traffic-object-spawn-params)) "Get a reserved process, and activate with the given params." - (local-vars (sv-16 handle)) (let ((gp-0 (-> arg0 object-type))) (set! (-> arg0 proc) #f) (let ((v1-2 (-> this traffic object-type-info-array gp-0))) (when (and (> (-> v1-2 inactive-count) 0) (> (-> v1-2 reserve-count) 0)) - (set! sv-16 (get-from-inactive-by-type this gp-0)) - (let ((s3-0 (handle->process sv-16))) + (let* ((sv-16 (get-from-inactive-by-type this gp-0)) + (s3-0 (handle->process sv-16)) + ) (when s3-0 (cond ((send-event s3-0 'traffic-activate arg0 (-> this traffic)) @@ -598,14 +590,9 @@ (let ((v1-4 s2-0)) (set! (-> s4-0 vector 2 x) (* 1024.0 (the float (-> v1-4 speed-limit)))) ) - (vector-! (the-as vector (-> s4-0 vector)) (-> arg1 vertex 1) (the-as vector (-> arg1 vertex))) - (vector-normalize! (the-as vector (-> s4-0 vector)) 1.0) - (vector+float*! - (-> s4-0 params position) - (the-as vector (-> arg1 vertex)) - (the-as vector (-> s4-0 vector)) - arg2 - ) + (vector-! (-> s4-0 vector 0) (-> arg1 vertex 1) (-> arg1 vertex 0)) + (vector-normalize! (-> s4-0 vector 0) 1.0) + (vector+float*! (-> s4-0 params position) (-> arg1 vertex 0) (-> s4-0 vector 0) arg2) (let ((f0-6 (* (+ -0.5 (rand-vu)) (* 256.0 (the float (-> s2-0 width)))))) (+! (-> s4-0 params position x) (* -1.0 (-> s4-0 vector 0 z) f0-6)) (+! (-> s4-0 params position z) (* (-> s4-0 vector 0 x) f0-6)) @@ -614,8 +601,8 @@ (set! (-> s4-0 vector 2 y) (+ (/ (-> s4-0 vector 2 x) 2) (* (-> this rand) (-> this traffic inv-density-factor) (-> arg1 spawn-spacing))) ) - (vector-float*! (-> s4-0 params velocity) (the-as vector (-> s4-0 vector)) (-> s4-0 vector 2 x)) - (vector-float*! (-> s4-0 vector 1) (the-as vector (-> s4-0 vector)) (-> s4-0 vector 2 y)) + (vector-float*! (-> s4-0 params velocity) (-> s4-0 vector 0) (-> s4-0 vector 2 x)) + (vector-float*! (-> s4-0 vector 1) (-> s4-0 vector 0) (-> s4-0 vector 2 y)) (when (not (sphere-hash-method-32 (-> this object-hash) (-> s4-0 params position) (-> s4-0 vector 1) 20480.0 -1)) (set! (-> s4-0 params behavior) (the-as uint 2)) (set! (-> s4-0 params nav-mesh) #f) @@ -625,7 +612,7 @@ ) (forward-up-nopitch->quaternion (-> s4-0 params rotation) - (the-as vector (-> s4-0 vector)) + (-> s4-0 vector 0) (new 'static 'vector :y 1.0 :w 1.0) ) (set! (-> this rand) (rand-vu)) @@ -640,12 +627,12 @@ (defmethod activate-by-handle ((this traffic-tracker) (arg0 traffic-object-spawn-params)) "Activate, using the handle in the params." - (local-vars (sv-16 handle)) (let ((gp-0 (-> arg0 object-type))) (set! (-> arg0 proc) #f) (when (> (-> this traffic object-type-info-array gp-0 inactive-count) 0) - (set! sv-16 (get-from-inactive-by-handle this gp-0 (-> arg0 handle))) - (let ((s3-0 (handle->process sv-16))) + (let* ((sv-16 (get-from-inactive-by-handle this gp-0 (-> arg0 handle))) + (s3-0 (handle->process sv-16)) + ) (when s3-0 (cond ((send-event s3-0 'traffic-activate arg0 (-> this traffic)) @@ -862,7 +849,7 @@ (let ((s3-0 0)) (dotimes (s2-0 (-> s4-0 segment-count)) (let ((s1-0 (-> s4-0 segment-array s2-0))) - (vector-vector-distance (the-as vector (-> s1-0 vertex)) (-> s1-0 vertex 1)) + (vector-vector-distance (-> s1-0 vertex 0) (-> s1-0 vertex 1)) (when (< (-> s1-0 spawn-spacing) 0.0) (inspect s1-0) #t @@ -1084,7 +1071,6 @@ ) (defmethod debug-draw ((this traffic-level-data)) - (local-vars (sv-16 nav-node) (sv-20 nav-branch) (sv-80 nav-node) (sv-84 vector) (sv-88 vector) (sv-92 vector)) (when (and (nonzero? (-> this city-info)) (nonzero? (-> this city-info nav-graph))) (let ((s5-0 (-> this city-info nav-graph))) (let ((v1-6 (-> s5-0 node-array 0))) @@ -1103,51 +1089,56 @@ (debug-draw a0-4) ) ) - (set! sv-16 (-> s5-0 node-array 0)) - (countdown (gp-1 (-> s5-0 node-count)) - (when (logtest? (-> sv-16 flags) (nav-node-flag-byte visited)) - (debug-draw sv-16) - (dotimes (s5-1 (-> sv-16 branch-count)) - (set! sv-20 (-> sv-16 branch-array s5-1)) - (set! sv-80 (-> sv-20 dest-node)) - (set! sv-84 (new 'stack-no-clear 'vector)) - (set! sv-88 (new 'stack-no-clear 'vector)) - (set! sv-92 (new 'stack-no-clear 'vector)) - (let ((a1-7 sv-16) - (v1-35 sv-88) - ) - (set! (-> v1-35 quad) (-> a1-7 position quad)) - (set! (-> v1-35 w) 1.0) - ) - (let ((a1-10 sv-80) - (v1-36 sv-92) - ) - (set! (-> v1-36 quad) (-> a1-10 position quad)) - (set! (-> v1-36 w) 1.0) - ) - (vector-! sv-84 sv-92 sv-88) - (add-debug-vector #t (bucket-id debug2) sv-88 sv-84 (meters 0.00023193359) *color-light-green*) - (vector+float*! sv-84 sv-88 sv-84 0.5) - (let ((s4-1 add-debug-text-3d) - (s3-0 #t) - (s2-0 324) - ) - (format (clear *temp-string*) "~D" (-> sv-20 user-count)) - (s4-1 - s3-0 - (the-as bucket-id s2-0) - *temp-string* - sv-84 - (if (< (-> sv-20 user-count) (-> sv-20 max-user-count)) - (font-color yellow) - (font-color red) + (let ((sv-16 (-> s5-0 node-array 0))) + (countdown (gp-1 (-> s5-0 node-count)) + (when (logtest? (-> sv-16 flags) (nav-node-flag-byte visited)) + (debug-draw sv-16) + (dotimes (s5-1 (-> sv-16 branch-count)) + (let* ((sv-20 (-> sv-16 branch-array s5-1)) + (sv-80 (-> sv-20 dest-node)) + (sv-84 (new 'stack-no-clear 'vector)) + ) + (let ((sv-88 (new 'stack-no-clear 'vector))) + (let ((sv-92 (new 'stack-no-clear 'vector))) + (let ((a1-7 sv-16) + (v1-35 sv-88) + ) + (set! (-> v1-35 quad) (-> a1-7 position quad)) + (set! (-> v1-35 w) 1.0) + ) + (let ((a1-10 sv-80) + (v1-36 sv-92) + ) + (set! (-> v1-36 quad) (-> a1-10 position quad)) + (set! (-> v1-36 w) 1.0) + ) + (vector-! sv-84 sv-92 sv-88) ) - (the-as vector2h #f) + (add-debug-vector #t (bucket-id debug2) sv-88 sv-84 (meters 0.00023193359) *color-light-green*) + (vector+float*! sv-84 sv-88 sv-84 0.5) + ) + (let ((s4-1 add-debug-text-3d) + (s3-0 #t) + (s2-0 324) + ) + (format (clear *temp-string*) "~D" (-> sv-20 user-count)) + (s4-1 + s3-0 + (the-as bucket-id s2-0) + *temp-string* + sv-84 + (if (< (-> sv-20 user-count) (-> sv-20 max-user-count)) + (font-color yellow) + (font-color red) + ) + (the-as vector2h #f) + ) + ) ) ) ) + (&+! sv-16 32) ) - (set! sv-16 (&+ sv-16 32)) ) ) ) @@ -1355,10 +1346,9 @@ 0 ) ((and (logtest? (focus-status gun) s3-0) - (not (and (logtest? (focus-status pilot) s3-0) (let* ((v1-19 (-> s4-0 0 bbox max)) - (f0-6 40960.0) - (f0-8 (* f0-6 f0-6)) - ) + (not (and (logtest? (focus-status pilot) s3-0) (let ((v1-19 (-> s4-0 0 bbox max)) + (f0-8 (square 40960.0)) + ) (.lvf vf1 (&-> v1-19 quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -1377,10 +1367,9 @@ ) ((logtest? (focus-status dangerous board pilot) s3-0) (vector-float*! (the-as vector (-> s4-0 0)) (-> s4-0 0 bbox max) 2.0) - (let* ((v1-31 (-> s4-0 0)) - (f0-11 20480.0) - (f0-13 (* f0-11 f0-11)) - ) + (let ((v1-31 (-> s4-0 0)) + (f0-13 (square 20480.0)) + ) (.lvf vf1 (&-> v1-31 bbox min quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -1430,12 +1419,7 @@ ) ) (dotimes (s5-1 gp-1) - (let* ((s4-1 (-> s3-1 s5-1)) - (a0-52 (if (type? s4-1 citizen) - s4-1 - ) - ) - ) + (let ((a0-52 (the-as collide-shape (as-type (-> s3-1 s5-1) citizen)))) (if a0-52 (send-event (the-as process-tree a0-52) 'clear-path s2-1) ) @@ -1465,12 +1449,7 @@ (set! (-> a1-0 r) (-> s4-0 notify-radius)) (let ((s2-0 (fill-actor-list-for-sphere (-> this object-hash) a1-0 s3-0 40))) (dotimes (s1-0 s2-0) - (let* ((s0-0 (-> s3-0 s1-0)) - (a0-6 (if (type? s0-0 citizen) - s0-0 - ) - ) - ) + (let ((a0-6 (the-as collide-shape (as-type (-> s3-0 s1-0) citizen)))) (if a0-6 (send-event (the-as process-tree a0-6) @@ -1544,12 +1523,7 @@ "Kill everything in the sphere with a traffic-off-force." (let ((gp-0 (new 'stack-no-clear 'array 'collide-shape 64))) (countdown (s5-0 (fill-actor-list-for-sphere *actor-hash* arg0 gp-0 64)) - (let* ((s4-0 (-> gp-0 s5-0)) - (v1-3 (if (type? s4-0 collide-shape) - s4-0 - ) - ) - ) + (let ((v1-3 (as-type (-> gp-0 s5-0) collide-shape))) (if v1-3 (send-event (-> v1-3 process) 'traffic-off-force) ) @@ -1562,7 +1536,6 @@ (defmethod update-traffic-amount ((this traffic-engine)) "kills inactive traffic and spawns more if needed." - (local-vars (sv-48 int) (sv-64 nav-segment)) (set! (-> this object-hash object-count) 0) (let* ((v1-1 (-> this object-hash)) (a0-6 (/ (+ (* (* (* (-> v1-1 dimension-array 0) (-> v1-1 dimension-array 1)) (-> v1-1 dimension-array 2)) @@ -1679,20 +1652,22 @@ (dotimes (s1-0 (the-as int (-> s4-2 active-cell-count))) (let ((s0-0 (-> s4-2 active-cell-list s1-0))) (when (and (logtest? (-> s0-0 flags) (ash 1 s3-3)) (not (logtest? (-> s0-0 flags) (vis-cell-flag suppress)))) - (set! sv-48 0) - (while (< sv-48 (-> s0-0 incoming-segment-count)) - (set! sv-64 (-> s0-0 segment-array sv-48)) - (when (= (-> sv-64 tracker-id) s3-3) - (when (not (logtest? (-> s4-2 city-info cell-array (-> sv-64 from-cell-id) flags) (ash 1 s3-3))) - (let ((f0-3 (rand-vu))) - (when (< f0-3 f30-0) - (set! f30-0 f0-3) - (set! s2-0 sv-64) + (let ((sv-48 0)) + (while (< sv-48 (-> s0-0 incoming-segment-count)) + (let ((sv-64 (-> s0-0 segment-array sv-48))) + (when (= (-> sv-64 tracker-id) s3-3) + (when (not (logtest? (-> s4-2 city-info cell-array (-> sv-64 from-cell-id) flags) (ash 1 s3-3))) + (let ((f0-3 (rand-vu))) + (when (< f0-3 f30-0) + (set! f30-0 f0-3) + (set! s2-0 sv-64) + ) + ) ) ) ) + (+! sv-48 1) ) - (set! sv-48 (+ sv-48 1)) ) ) ) @@ -1799,7 +1774,7 @@ gp-0 (lambda ((arg0 traffic-find-segment-struct) (arg1 nav-segment)) (let ((v1-0 (new 'stack-no-clear 'vector))) - (vector-! v1-0 (-> arg1 vertex 1) (the-as vector (-> arg1 vertex))) + (vector-! v1-0 (-> arg1 vertex 1) (-> arg1 vertex 0)) (let ((a2-1 v1-0) (a3-1 v1-0) (f0-0 (-> arg1 length)) @@ -2035,12 +2010,7 @@ (while (!= v1-4 (-> *collide-player-list* alive-list-end)) (let ((v1-5 (the-as collide-shape (-> (the-as connection v1-4) param1)))) (when (logtest? arg1 (-> v1-5 root-prim prim-core collide-as)) - (let* ((s1-0 (-> v1-5 process)) - (s2-0 (if (type? s1-0 process-focusable) - (the-as process-focusable s1-0) - ) - ) - ) + (let ((s2-0 (as-type (-> v1-5 process) process-focusable))) (when (and s2-0 (not (focus-test? s2-0 disable dead inactive)) (!= arg0 s2-0)) (let ((f0-0 (vector-vector-xz-distance (-> arg0 root trans) (-> s2-0 root trans)))) (when (or (not gp-0) (< f0-0 f30-0)) @@ -2067,12 +2037,7 @@ (while (!= v1-22 (-> *collide-hit-by-player-list* alive-list-end)) (let ((v1-23 (the-as collide-shape (-> (the-as connection v1-22) param1)))) (when (logtest? arg1 (-> v1-23 root-prim prim-core collide-as)) - (let* ((s1-1 (-> v1-23 process)) - (s2-1 (if (type? s1-1 process-focusable) - (the-as process-focusable s1-1) - ) - ) - ) + (let ((s2-1 (as-type (-> v1-23 process) process-focusable))) (when (and s2-1 (not (focus-test? s2-1 disable dead inactive)) (!= arg0 s2-1)) (let ((f0-1 (vector-vector-xz-distance (-> arg0 root trans) (-> s2-1 root trans)))) (when (or (not gp-0) (< f0-1 f30-0)) @@ -2098,12 +2063,7 @@ (while (!= v1-38 (-> *collide-hit-by-others-list* alive-list-end)) (let ((v1-39 (the-as collide-shape (-> (the-as connection v1-38) param1)))) (when (logtest? arg1 (-> v1-39 root-prim prim-core collide-as)) - (let* ((s1-2 (-> v1-39 process)) - (s2-2 (if (type? s1-2 process-focusable) - (the-as process-focusable s1-2) - ) - ) - ) + (let ((s2-2 (as-type (-> v1-39 process) process-focusable))) (when (and s2-2 (not (focus-test? s2-2 disable dead inactive)) (!= arg0 s2-2)) (let ((f0-2 (vector-vector-xz-distance (-> arg0 root trans) (-> s2-2 root trans)))) (when (or (not gp-0) (< f0-2 f30-0)) @@ -2129,13 +2089,6 @@ ) (defmethod traffic-engine-method-49 ((this traffic-engine) (los vector) (arg2 int) (target-status traffic-target-status)) - (local-vars - (guards (array crimson-guard)) - (guard-target-dists (array float)) - (guard-idx int) - (sv-208 int) - (sv-216 float) - ) (logclear! (-> target-status flags) (traffic-target-flag visible-now updated)) (cond ((= (-> this sync-mask-16) (ash 1 (logand arg2 15))) @@ -2178,71 +2131,75 @@ (when (not (update-guard-status-spots target-pos)) ) (when (update-guard-status-spots target-pos) - (set! guards (the-as (array crimson-guard) (new 'stack 'boxed-array crimson-guard 16))) - (set! guard-target-dists (the-as (array float) (new 'stack 'boxed-array float 16))) - (set! guard-idx 0) - (dotimes (guard-count (the-as int (-> this vehicle-tracker-array active-object-count))) - (case (-> this vehicle-tracker-array active-object-type-list guard-count) - (((traffic-type crimson-guard-1)) - (let ((guard (handle->process (-> this vehicle-tracker-array active-object-list guard-count)))) - (when (and guard - (not (focus-test? (the-as process-focusable guard) dead inactive)) - (= (-> (the-as crimson-guard guard) traffic-target-status handle) (-> target-status handle)) - ) - (set! (-> guards guard-idx) (the-as crimson-guard guard)) - (set! (-> guard-target-dists guard-idx) - (vector-vector-distance (-> (the-as crimson-guard guard) root trans) target-pos) - ) - (set! guard-idx (+ guard-idx 1)) - (set! (-> (the-as crimson-guard guard) move-index) -1) + (let ((guards (the-as (array crimson-guard) (new 'stack 'boxed-array crimson-guard 16))) + (guard-target-dists (the-as (array float) (new 'stack 'boxed-array float 16))) + (guard-idx 0) + ) + (dotimes (guard-count (the-as int (-> this vehicle-tracker-array active-object-count))) + (case (-> this vehicle-tracker-array active-object-type-list guard-count) + (((traffic-type crimson-guard-1)) + (let ((guard (handle->process (-> this vehicle-tracker-array active-object-list guard-count)))) + (when (and guard + (not (focus-test? (the-as process-focusable guard) dead inactive)) + (= (-> (the-as crimson-guard guard) traffic-target-status handle) (-> target-status handle)) + ) + (set! (-> guards guard-idx) (the-as crimson-guard guard)) + (set! (-> guard-target-dists guard-idx) + (vector-vector-distance (-> (the-as crimson-guard guard) root trans) target-pos) + ) + (+! guard-idx 1) + (set! (-> (the-as crimson-guard guard) move-index) -1) + ) ) ) - ) + ) ) - ) - (let ((a0-35 #t)) - (while a0-35 - (set! a0-35 #f) - (dotimes (v1-77 (+ guard-idx -1)) - (when (< (-> guard-target-dists (+ v1-77 1)) (-> guard-target-dists v1-77)) - (let ((a0-38 (-> guards v1-77)) - (f0-2 (-> guard-target-dists v1-77)) - ) - (set! (-> guards v1-77) (-> guards (+ v1-77 1))) - (set! (-> guards (+ v1-77 1)) a0-38) - (set! (-> guard-target-dists v1-77) (-> guard-target-dists (+ v1-77 1))) - (set! (-> guard-target-dists (+ v1-77 1)) f0-2) + (let ((a0-35 #t)) + (while a0-35 + (set! a0-35 #f) + (dotimes (v1-77 (+ guard-idx -1)) + (when (< (-> guard-target-dists (+ v1-77 1)) (-> guard-target-dists v1-77)) + (let ((a0-38 (-> guards v1-77)) + (f0-2 (-> guard-target-dists v1-77)) + ) + (set! (-> guards v1-77) (-> guards (+ v1-77 1))) + (set! (-> guards (+ v1-77 1)) a0-38) + (set! (-> guard-target-dists v1-77) (-> guard-target-dists (+ v1-77 1))) + (set! (-> guard-target-dists (+ v1-77 1)) f0-2) + ) + (set! a0-35 #t) ) - (set! a0-35 #t) ) ) ) - ) - (dotimes (s4-1 guard-idx) - (let ((crimson-guard (-> (the-as (array crimson-guard) guards) s4-1))) - (when (= (-> crimson-guard move-index) -1) - (set! sv-208 -1) - ;; og:preserve-this kinda hacky, was ps2 weird infinity. - (set! sv-216 100000000000000000.0) - (dotimes (s2-4 (-> *guard-target-spots* length)) - (when (= (-> *guard-status-spots* s2-4) 1) - (let* ((a0-53 (vector+! (new 'stack-no-clear 'vector) target-pos (-> *guard-target-spots* s2-4))) - (f0-4 (vector-vector-distance a0-53 (-> crimson-guard root trans))) - ) - (when (or (= sv-208 -1) (< f0-4 sv-216)) - (set! sv-208 s2-4) - (set! sv-216 f0-4) + (dotimes (s4-1 guard-idx) + (let ((crimson-guard (-> (the-as (array crimson-guard) guards) s4-1))) + (when (= (-> crimson-guard move-index) -1) + (let ((sv-208 -1)) + ;; og:preserve-this kinda hacky, was ps2 weird infinity. + (let ((sv-216 100000000000000000.0)) + (dotimes (s2-4 (-> *guard-target-spots* length)) + (when (= (-> *guard-status-spots* s2-4) 1) + (let* ((a0-53 (vector+! (new 'stack-no-clear 'vector) target-pos (-> *guard-target-spots* s2-4))) + (f0-4 (vector-vector-distance a0-53 (-> crimson-guard root trans))) + ) + (when (or (= sv-208 -1) (< f0-4 sv-216)) + (set! sv-208 s2-4) + (set! sv-216 f0-4) + ) + ) + ) + ) + ) + (cond + ((!= sv-208 -1) + (set! (-> *guard-status-spots* sv-208) 0) + (vector+! (-> crimson-guard move-position) target-pos (-> *guard-target-spots* sv-208)) + ) + (else + (set! (-> crimson-guard move-position quad) (-> target-pos quad)) ) ) - ) - ) - (cond - ((!= sv-208 -1) - (set! (-> *guard-status-spots* sv-208) 0) - (vector+! (-> crimson-guard move-position) target-pos (-> *guard-target-spots* sv-208)) - ) - (else - (set! (-> crimson-guard move-position quad) (-> target-pos quad)) ) ) ) @@ -2591,11 +2548,10 @@ (dotimes (v1-0 6) (set! (-> this alert-state guard-type-info-array v1-0 count) 0) ) - (let* ((f0-0 122880.0) - (f0-2 (* f0-0 f0-0)) - (a0-3 (the-as vehicle #f)) - (v1-5 0) - ) + (let ((f0-2 (square 122880.0)) + (a0-3 (the-as vehicle #f)) + (v1-5 0) + ) (let ((a1-0 0)) (dotimes (a2-0 (the-as int (-> this citizen-tracker-array active-object-count))) (case (-> this citizen-tracker-array active-object-type-list a2-0) @@ -3275,56 +3231,47 @@ (arg2 traffic-find-segment-struct) (arg3 (function traffic-find-segment-struct nav-segment none)) ) - (local-vars - (sv-16 city-level-info) - (sv-20 vector) - (sv-24 int) - (sv-28 traffic-find-segment-struct) - (sv-32 (function traffic-find-segment-struct nav-segment none)) - (sv-80 vis-grid-box) - (sv-84 vis-grid-box) - ) - (set! sv-16 this) - (set! sv-20 arg0) - (set! sv-24 arg1) - (set! sv-28 arg2) - (set! sv-32 arg3) - (set! sv-80 (new 'stack-no-clear 'vis-grid-box)) - (set! sv-84 (new 'stack-no-clear 'vis-grid-box)) - (lookup-box-for-sphere (-> sv-16 grid-info) sv-80 sv-20) - (set! (-> sv-84 min y) (-> sv-80 min y)) - (countdown (gp-0 (+ (- 1 (-> sv-80 min y)) (-> sv-80 max y))) - (set! (-> sv-84 min z) (-> sv-80 min z)) - (countdown (s5-0 (+ (- 1 (-> sv-80 min z)) (-> sv-80 max z))) - (set! (-> sv-84 min x) (-> sv-80 min x)) - (countdown (s4-0 (+ (- 1 (-> sv-80 min x)) (-> sv-80 max x))) - (let* ((a0-17 sv-16) - (a2-2 sv-84) - (v1-18 - (-> a0-17 - cell-array - (+ (-> a2-2 min x) - (* (-> a2-2 min z) (-> a0-17 grid-info dimension-array 0)) - (* (* (-> a2-2 min y) (-> a0-17 grid-info dimension-array 0)) (-> a0-17 grid-info dimension-array 2)) - ) - ) - ) - (s3-0 (-> v1-18 segment-array 0)) - ) - (countdown (s2-0 (-> v1-18 segment-count)) - (if (and (= (-> s3-0 tracker-id) sv-24) - (line-sphere-intersection? sv-20 (the-as vector (-> s3-0 vertex)) (-> s3-0 vertex 1)) - ) - (sv-32 sv-28 s3-0) - ) - (&+! s3-0 48) - ) - ) - (+! (-> sv-84 min x) 1) + (let ((sv-16 this) + (sv-20 arg0) + (sv-24 arg1) + (sv-28 arg2) + (sv-32 arg3) + (sv-80 (new 'stack-no-clear 'vis-grid-box)) + (sv-84 (new 'stack-no-clear 'vis-grid-box)) ) - (+! (-> sv-84 min z) 1) + (lookup-box-for-sphere (-> sv-16 grid-info) sv-80 sv-20) + (set! (-> sv-84 min y) (-> sv-80 min y)) + (countdown (gp-0 (+ (- 1 (-> sv-80 min y)) (-> sv-80 max y))) + (set! (-> sv-84 min z) (-> sv-80 min z)) + (countdown (s5-0 (+ (- 1 (-> sv-80 min z)) (-> sv-80 max z))) + (set! (-> sv-84 min x) (-> sv-80 min x)) + (countdown (s4-0 (+ (- 1 (-> sv-80 min x)) (-> sv-80 max x))) + (let* ((a0-17 sv-16) + (a2-2 sv-84) + (v1-18 + (-> a0-17 + cell-array + (+ (-> a2-2 min x) + (* (-> a2-2 min z) (-> a0-17 grid-info dimension-array 0)) + (* (* (-> a2-2 min y) (-> a0-17 grid-info dimension-array 0)) (-> a0-17 grid-info dimension-array 2)) + ) + ) + ) + (s3-0 (-> v1-18 segment-array 0)) + ) + (countdown (s2-0 (-> v1-18 segment-count)) + (if (and (= (-> s3-0 tracker-id) sv-24) (line-sphere-intersection? sv-20 (-> s3-0 vertex 0) (-> s3-0 vertex 1))) + (sv-32 sv-28 s3-0) + ) + (&+! s3-0 48) + ) + ) + (+! (-> sv-84 min x) 1) + ) + (+! (-> sv-84 min z) 1) + ) + (+! (-> sv-84 min y) 1) ) - (+! (-> sv-84 min y) 1) ) 0 (none) @@ -3342,7 +3289,7 @@ (dotimes (s3-0 16) (let ((s2-0 (-> arg0 suppressor array s3-0))) (when (logtest? (-> s2-0 flags) (traffic-suppression-box-flags in-use)) - (lookup-cell-for-point (-> this grid-info) (-> s4-0 1) (the-as vector (-> s2-0 bbox))) + (lookup-cell-for-point (-> this grid-info) (-> s4-0 1) (-> s2-0 bbox min)) (lookup-cell-for-point (-> this grid-info) (-> s4-0 2) (-> s2-0 bbox max)) (set! (-> s4-0 0 y) (-> s4-0 1 y)) (countdown (v1-15 (+ (- 1 (-> s4-0 1 y)) (-> s4-0 2 y))) @@ -3418,25 +3365,20 @@ ) ) (let ((s5-0 (math-camera-pos)) - (f30-0 (meters 20)) - (f28-0 (meters 200)) - (f26-0 (meters 120)) + (f30-0 81920.0) + (f28-0 819200.0) + (f26-0 491520.0) ) (dotimes (s4-0 (the-as int (-> this city-info cell-count))) (let ((s3-0 (-> this city-info cell-array s4-0))) - (let ((f24-0 (vector-vector-distance-squared (-> s3-0 sphere) s5-0)) - (f0-1 (+ (-> s3-0 sphere r) f28-0)) - ) + (let ((f24-0 (vector-vector-distance-squared (-> s3-0 sphere) s5-0))) (cond - ((or (< (* f0-1 f0-1) f24-0) (let ((f0-5 (+ (-> s3-0 sphere r) f30-0))) - (and (< (* f0-5 f0-5) f24-0) (not (sphere-in-view-frustum? (-> s3-0 sphere)))) - ) + ((or (< (square (+ (-> s3-0 sphere r) f28-0)) f24-0) + (and (< (square (+ (-> s3-0 sphere r) f30-0)) f24-0) (not (sphere-in-view-frustum? (-> s3-0 sphere)))) ) (logclear! (-> s3-0 flags) (vis-cell-flag active-vehicle active-pedestrian)) ) - ((let ((f0-9 (+ (-> s3-0 sphere r) f26-0))) - (< (* f0-9 f0-9) f24-0) - ) + ((< (square (+ (-> s3-0 sphere r) f26-0)) f24-0) (let ((v1-17 (logior (-> s3-0 flags) (vis-cell-flag active-vehicle)))) (set! (-> s3-0 flags) (logclear v1-17 (vis-cell-flag active-pedestrian))) ) @@ -3666,13 +3608,10 @@ (if s3-0 (vector-float*! (-> s5-0 1) (-> s5-0 1) -1.0) ) - (let* ((f0-29 f30-0) - (f0-31 (* f0-29 f0-29)) - (f1-9 f28-0) - (f1-12 (sqrtf (fabs (- f0-31 (* f1-9 f1-9))))) + (let* ((f1-12 (sqrtf (fabs (- (square f30-0) (square f28-0))))) (f0-35 (/ (* f28-0 f1-12) f30-0)) ) - (let ((f1-15 (/ (* f1-12 f1-12) f30-0))) + (let ((f1-15 (/ (square f1-12) f30-0))) (set! (-> arg2 quad) (-> arg0 quad)) (let ((a1-13 arg2)) (let ((v1-26 arg2)) @@ -3714,11 +3653,10 @@ ) (defmethod city-level-info-method-18 ((this city-level-info)) - (local-vars (sv-48 int)) - (let ((gp-0 (new 'stack-no-clear 'bounding-box)) - (s5-0 (-> this nav-graph)) - ) - (set! sv-48 (-> s5-0 node-count)) + (let* ((gp-0 (new 'stack-no-clear 'bounding-box)) + (s5-0 (-> this nav-graph)) + (sv-48 (-> s5-0 node-count)) + ) (dotimes (s4-0 sv-48) (let ((s3-0 (-> s5-0 node-array s4-0))) (set-id-and-link-branches-back s3-0 (the-as uint s4-0)) @@ -3758,25 +3696,6 @@ ;; WARN: Return type mismatch object vs symbol. (defmethod city-level-info-method-9 ((this city-level-info)) - (local-vars - (sv-96 (inline-array nav-node)) - (sv-100 int) - (sv-104 vis-ray) - (sv-112 int) - (sv-160 nav-node) - (sv-164 vector) - (sv-168 vector) - (sv-172 vis-cell) - (sv-176 int) - (sv-184 nav-branch) - (sv-240 nav-node) - (sv-244 vector) - (sv-248 vector) - (sv-252 vector) - (sv-256 nav-segment) - (sv-260 vis-cell) - (sv-264 int) - ) (set! (-> this cell-count) (the-as uint (* (* (-> this grid-info dimension-array 0) (-> this grid-info dimension-array 1)) (-> this grid-info dimension-array 2) @@ -3791,173 +3710,180 @@ (format 0 "segments not generates~%") (return (the-as symbol #t)) ) - (set! sv-96 (-> this nav-graph node-array)) - (set! sv-100 (-> this nav-graph node-count)) - (set! sv-104 (new 'stack-no-clear 'vis-ray)) - (set! sv-112 0) - (dotimes (s4-1 sv-100) - (let ((s3-0 (-> sv-96 s4-1))) - (dotimes (s2-0 (-> s3-0 branch-count)) - (let* ((a2-0 (-> s3-0 branch-array s2-0)) - (f0-1 0.0) - (v1-19 a2-0) - ) - (when (< f0-1 (* 0.0078125 (the float (-> v1-19 density)))) - (set! sv-160 (-> a2-0 dest-node)) - (set! sv-164 (new 'stack-no-clear 'vector)) - (set! sv-168 (new 'stack-no-clear 'vector)) - (set! sv-172 (the-as vis-cell #f)) - (set! sv-176 0) - (let ((a1-1 s3-0) - (v1-26 sv-168) - ) - (set! (-> v1-26 quad) (-> a1-1 position quad)) - (set! (-> v1-26 w) 1.0) - ) - (cond - ((logtest? (-> s3-0 flags) (nav-node-flag-byte pedestrian)) - (let ((a1-4 (-> a2-0 dest-node)) - (v1-29 sv-164) - ) - (set! (-> v1-29 quad) (-> a1-4 position quad)) - (set! (-> v1-29 w) 1.0) - ) - ) - (else - (city-level-info-method-12 this sv-168 a2-0 sv-164) - ) - ) - (init-vis-ray this sv-104 sv-168 sv-164) - (while (< 0.0 (-> sv-104 len)) - (set! sv-172 (-> sv-104 cell)) - (city-level-info-method-11 this sv-104) - (+! (-> sv-172 segment-count) 1) - (set! sv-112 (+ sv-112 1)) - (if (> sv-176 0) - (+! (-> sv-172 incoming-segment-count) 1) - ) - (set! sv-176 (+ sv-176 1)) - ) - ) - ) + (let ((sv-96 (-> this nav-graph node-array)) + (sv-100 (-> this nav-graph node-count)) + (sv-104 (new 'stack-no-clear 'vis-ray)) ) - ) - ) - (format 0 "~d segments were generated~%" sv-112) - (set! (-> this segment-array) (the-as (inline-array nav-segment) (malloc 'debug (* 48 sv-112)))) - (let ((v1-59 0)) - (dotimes (a0-20 (the-as int s5-0)) - (let ((a1-14 (-> this cell-array a0-20))) - (set! (-> a1-14 id) (the-as uint a0-20)) - (set! (-> a1-14 segment-array) (the-as (inline-array nav-segment) #f)) - (when (> (-> a1-14 segment-count) 0) - (set! (-> a1-14 segment-array) (the-as (inline-array nav-segment) (-> this segment-array v1-59))) - (dotimes (a2-8 (-> a1-14 segment-count)) - (let ((a3-5 (-> a1-14 segment-array a2-8))) - (set! (-> a3-5 id) (the-as uint v1-59)) - (set! (-> a3-5 cell-id) (the-as uint #xffff)) - ) - (+! v1-59 1) - ) - ) - (set! (-> a1-14 flags) (the-as vis-cell-flag (-> a1-14 segment-count))) - (set! (-> a1-14 segment-count) 0) - (set! (-> a1-14 incoming-segment-count) 0) - ) - 0 - ) - (set! (-> this segment-count) v1-59) - ) - ) - (dotimes (s5-1 sv-100) - (let ((s4-2 (-> sv-96 s5-1))) - (dotimes (s3-1 (-> s4-2 branch-count)) - (set! sv-184 (-> s4-2 branch-array s3-1)) - (let ((f0-5 0.0) - (v1-63 sv-184) - ) - (when (< f0-5 (* 0.0078125 (the float (-> v1-63 density)))) - (set! sv-240 (-> sv-184 dest-node)) - (set! sv-244 (new 'stack-no-clear 'vector)) - (set! sv-248 (new 'stack-no-clear 'vector)) - (set! sv-252 (new 'stack-no-clear 'vector)) - (set! sv-256 (the-as nav-segment #f)) - (set! sv-260 (the-as vis-cell #f)) - (set! sv-264 0) - (let ((a1-16 s4-2) - (v1-72 sv-244) - ) - (set! (-> v1-72 quad) (-> a1-16 position quad)) - (set! (-> v1-72 w) 1.0) - ) - (cond - ((logtest? (-> s4-2 flags) (nav-node-flag-byte pedestrian)) - (let ((a1-19 (-> sv-184 dest-node)) - (v1-76 sv-252) + (let ((sv-112 0)) + (dotimes (s4-1 sv-100) + (let ((s3-0 (-> sv-96 s4-1))) + (dotimes (s2-0 (-> s3-0 branch-count)) + (let* ((a2-0 (-> s3-0 branch-array s2-0)) + (f0-1 0.0) + (v1-19 a2-0) ) - (set! (-> v1-76 quad) (-> a1-19 position quad)) - (set! (-> v1-76 w) 1.0) - ) - ) - (else - (city-level-info-method-12 this sv-244 sv-184 sv-252) + (when (< f0-1 (* 0.0078125 (the float (-> v1-19 density)))) + (let ((sv-160 (-> a2-0 dest-node))) + ) + (let ((sv-164 (new 'stack-no-clear 'vector)) + (sv-168 (new 'stack-no-clear 'vector)) + (sv-172 (the-as vis-cell #f)) + (sv-176 0) + ) + (let ((a1-1 s3-0) + (v1-26 sv-168) + ) + (set! (-> v1-26 quad) (-> a1-1 position quad)) + (set! (-> v1-26 w) 1.0) + ) + (cond + ((logtest? (-> s3-0 flags) (nav-node-flag-byte pedestrian)) + (let ((a1-4 (-> a2-0 dest-node)) + (v1-29 sv-164) + ) + (set! (-> v1-29 quad) (-> a1-4 position quad)) + (set! (-> v1-29 w) 1.0) + ) + ) + (else + (city-level-info-method-12 this sv-168 a2-0 sv-164) + ) + ) + (init-vis-ray this sv-104 sv-168 sv-164) + (while (< 0.0 (-> sv-104 len)) + (set! sv-172 (-> sv-104 cell)) + (city-level-info-method-11 this sv-104) + (+! (-> sv-172 segment-count) 1) + (+! sv-112 1) + (if (> sv-176 0) + (+! (-> sv-172 incoming-segment-count) 1) + ) + (+! sv-176 1) + ) + ) + ) ) ) - (init-vis-ray this sv-104 sv-244 sv-252) - (while (< 0.0 (-> sv-104 len)) - (set! (-> sv-248 quad) (-> sv-104 pos quad)) - (set! sv-260 (-> sv-104 cell)) - (city-level-info-method-11 this sv-104) - (let ((a2-14 (-> sv-260 incoming-segment-count))) - (if (zero? sv-264) - (set! a2-14 - (+ (- -1 (-> sv-260 segment-count)) (-> sv-260 incoming-segment-count) (-> sv-260 alloc-segment-count)) - ) - ) - (when (or (< a2-14 0) (>= a2-14 (-> sv-260 alloc-segment-count))) - (format - 0 - "******************************************************** bad i-seg ~d ************************************************~%" - a2-14 - ) - (return (the-as symbol #f)) + ) + ) + (format 0 "~d segments were generated~%" sv-112) + (set! (-> this segment-array) (the-as (inline-array nav-segment) (malloc 'debug (* 48 sv-112)))) + ) + (let ((v1-59 0)) + (dotimes (a0-20 (the-as int s5-0)) + (let ((a1-14 (-> this cell-array a0-20))) + (set! (-> a1-14 id) (the-as uint a0-20)) + (set! (-> a1-14 segment-array) (the-as (inline-array nav-segment) #f)) + (when (> (-> a1-14 segment-count) 0) + (set! (-> a1-14 segment-array) (the-as (inline-array nav-segment) (-> this segment-array v1-59))) + (dotimes (a2-8 (-> a1-14 segment-count)) + (let ((a3-5 (-> a1-14 segment-array a2-8))) + (set! (-> a3-5 id) (the-as uint v1-59)) + (set! (-> a3-5 cell-id) (the-as uint #xffff)) ) - (let ((s2-1 (-> sv-260 segment-array a2-14))) - (set! (-> s2-1 vertex 0 quad) (-> sv-248 quad)) - (set! (-> s2-1 vertex 1 quad) (-> sv-104 pos quad)) - (set! (-> s2-1 length) (vector-vector-distance (the-as vector (-> s2-1 vertex)) (-> s2-1 vertex 1))) - (let* ((f0-9 (if (logtest? (-> s4-2 flags) (nav-node-flag-byte pedestrian)) - 24576.0 - 49152.0 - ) - ) - (f1-8 -1.0) - (f2-4 0.0001) - (v1-107 sv-184) - (f2-5 (fmax f2-4 (* 0.0078125 (the float (-> v1-107 density))))) - ) - (set! (-> s2-1 spawn-spacing) (* f0-9 (+ f1-8 (/ 1.0 f2-5)))) + (+! v1-59 1) + ) + ) + (set! (-> a1-14 flags) (the-as vis-cell-flag (-> a1-14 segment-count))) + (set! (-> a1-14 segment-count) 0) + (set! (-> a1-14 incoming-segment-count) 0) + ) + 0 + ) + (set! (-> this segment-count) v1-59) + ) + (dotimes (s5-1 sv-100) + (let ((s4-2 (-> sv-96 s5-1))) + (dotimes (s3-1 (-> s4-2 branch-count)) + (let* ((sv-184 (-> s4-2 branch-array s3-1)) + (v1-63 sv-184) + ) + (when (< 0.0 (* 0.0078125 (the float (-> v1-63 density)))) + (let ((sv-240 (-> sv-184 dest-node))) + ) + (let ((sv-244 (new 'stack-no-clear 'vector)) + (sv-248 (new 'stack-no-clear 'vector)) + (sv-252 (new 'stack-no-clear 'vector)) + (sv-256 (the-as nav-segment #f)) + (sv-260 (the-as vis-cell #f)) + (sv-264 0) + ) + (let ((a1-16 s4-2) + (v1-72 sv-244) + ) + (set! (-> v1-72 quad) (-> a1-16 position quad)) + (set! (-> v1-72 w) 1.0) ) - (set! (-> s2-1 cell-id) (-> sv-260 id)) - (set! (-> s2-1 branch) sv-184) - (set! (-> s2-1 from-cell-id) (the-as uint #xffff)) - (set! (-> s2-1 nav-mesh-id) (-> s4-2 nav-mesh-id)) - (set! (-> s2-1 tracker-id) 0) - (if (logtest? (-> s4-2 flags) (nav-node-flag-byte pedestrian)) - (set! (-> s2-1 tracker-id) 1) + (cond + ((logtest? (-> s4-2 flags) (nav-node-flag-byte pedestrian)) + (let ((a1-19 (-> sv-184 dest-node)) + (v1-76 sv-252) + ) + (set! (-> v1-76 quad) (-> a1-19 position quad)) + (set! (-> v1-76 w) 1.0) + ) + ) + (else + (city-level-info-method-12 this sv-244 sv-184 sv-252) ) - (if sv-256 - (set! (-> s2-1 from-cell-id) (-> (the-as nav-segment sv-256) cell-id)) + ) + (init-vis-ray this sv-104 sv-244 sv-252) + (while (< 0.0 (-> sv-104 len)) + (set! (-> sv-248 quad) (-> sv-104 pos quad)) + (set! sv-260 (-> sv-104 cell)) + (city-level-info-method-11 this sv-104) + (let ((a2-14 (-> sv-260 incoming-segment-count))) + (if (zero? sv-264) + (set! a2-14 + (+ (- -1 (-> sv-260 segment-count)) (-> sv-260 incoming-segment-count) (-> sv-260 alloc-segment-count)) + ) + ) + (when (or (< a2-14 0) (>= a2-14 (-> sv-260 alloc-segment-count))) + (format + 0 + "******************************************************** bad i-seg ~d ************************************************~%" + a2-14 + ) + (return (the-as symbol #f)) + ) + (let ((s2-1 (-> sv-260 segment-array a2-14))) + (set! (-> s2-1 vertex 0 quad) (-> sv-248 quad)) + (set! (-> s2-1 vertex 1 quad) (-> sv-104 pos quad)) + (set! (-> s2-1 length) (vector-vector-distance (-> s2-1 vertex 0) (-> s2-1 vertex 1))) + (let* ((f0-9 (if (logtest? (-> s4-2 flags) (nav-node-flag-byte pedestrian)) + 24576.0 + 49152.0 + ) + ) + (f1-8 -1.0) + (v1-107 sv-184) + (f2-5 (fmax 0.0001 (* 0.0078125 (the float (-> v1-107 density))))) + ) + (set! (-> s2-1 spawn-spacing) (* f0-9 (+ f1-8 (/ 1.0 f2-5)))) + ) + (set! (-> s2-1 cell-id) (-> sv-260 id)) + (set! (-> s2-1 branch) sv-184) + (set! (-> s2-1 from-cell-id) (the-as uint #xffff)) + (set! (-> s2-1 nav-mesh-id) (-> s4-2 nav-mesh-id)) + (set! (-> s2-1 tracker-id) 0) + (if (logtest? (-> s4-2 flags) (nav-node-flag-byte pedestrian)) + (set! (-> s2-1 tracker-id) 1) + ) + (if sv-256 + (set! (-> s2-1 from-cell-id) (-> (the-as nav-segment sv-256) cell-id)) + ) + (set! sv-256 s2-1) + ) ) - (set! sv-256 s2-1) + 0 + (+! (-> sv-260 segment-count) 1) + (if (> sv-264 0) + (+! (-> sv-260 incoming-segment-count) 1) + ) + (+! sv-264 1) + ) ) ) - 0 - (+! (-> sv-260 segment-count) 1) - (if (> sv-264 0) - (+! (-> sv-260 incoming-segment-count) 1) - ) - (set! sv-264 (+ sv-264 1)) ) ) ) diff --git a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-control.gc b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-control.gc index c4a9cd2ddd..4643b8dc86 100644 --- a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-control.gc +++ b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-control.gc @@ -218,13 +218,10 @@ (if (logtest? (-> this flags) (vehicle-controller-flag left-turn)) (vector-float*! (-> s4-0 normal) (-> s4-0 normal) -1.0) ) - (let* ((f0-10 f30-0) - (f0-12 (* f0-10 f0-10)) - (f1-3 f28-0) - (f1-6 (sqrtf (- f0-12 (* f1-3 f1-3)))) + (let* ((f1-6 (sqrtf (- (square f30-0) (square f28-0)))) (f0-15 (/ (* f28-0 f1-6) f30-0)) ) - (let ((f1-9 (/ (* f1-6 f1-6) f30-0))) + (let ((f1-9 (/ (square f1-6) f30-0))) (set! (-> arg1 quad) (-> arg0 quad)) (let ((a1-5 arg1)) (let ((v1-12 arg1)) @@ -280,22 +277,13 @@ (if (< 0.0 f1-1) (set! f3-0 (fmax 0.0 (fmin (/ (- f2-1) f1-1) arg4))) ) - (+ f0-1 (* 2.0 f2-1 f3-0) (* f3-0 f3-0 f1-1)) + (+ f0-1 (* 2.0 f2-1 f3-0) (* (square f3-0) f1-1)) ) ) ) (defmethod vehicle-controller-method-18 ((this vehicle-controller) (arg0 vector) (arg1 vector) (arg2 vehicle) (arg3 float)) - (local-vars - (v1-24 float) - (v1-88 float) - (a0-35 float) - (a0-96 int) - (a0-98 int) - (sv-16 vector) - (sv-20 float) - (sv-24 float) - ) + (local-vars (v1-24 float) (v1-88 float) (a0-35 float) (a0-96 int) (a0-98 int)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -320,10 +308,11 @@ (.sync.p) (label cfg-2) 0 - (set! sv-16 arg0) - (set! sv-20 arg3) - (set! sv-24 (-> arg2 info info inv-mass)) - (let ((gp-0 (new 'stack-no-clear 'inline-array 'vector 16))) + (let ((sv-16 arg0) + (sv-20 arg3) + (sv-24 (-> arg2 info info inv-mass)) + (gp-0 (new 'stack-no-clear 'inline-array 'vector 16)) + ) (set! (-> gp-0 15 x) (+ (-> this target-speed) (-> this target-speed-offset))) (set! (-> gp-0 1 quad) (-> arg1 quad)) (set! (-> gp-0 0 quad) (-> arg2 root trans quad)) @@ -347,13 +336,9 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-24 vf1) - (let ((f2-2 v1-24) - (f3-1 (-> this max-turn-speed)) - ) - (if (>= (* f1-4 (- f2-2 (* f3-1 f3-1))) f0-5) - (set! (-> gp-0 15 x) (fmin (-> gp-0 15 x) (-> this max-turn-speed))) - ) - ) + (if (>= (* f1-4 (- v1-24 (square (-> this max-turn-speed)))) f0-5) + (set! (-> gp-0 15 x) (fmin (-> gp-0 15 x) (-> this max-turn-speed))) + ) ) ) ) @@ -387,11 +372,7 @@ (set! (-> gp-0 4 y) (-> gp-0 0 y)) (when (and (nonzero? (-> this traffic)) (not (logtest? (-> this flags) (vehicle-controller-flag ignore-others))) - (let ((f0-22 (-> arg2 camera-dist2)) - (f1-9 1228800.0) - ) - (< f0-22 (* f1-9 f1-9)) - ) + (< (-> arg2 camera-dist2) (square 1228800.0)) ) (let ((s3-1 (new 'stack-no-clear 'array 'collide-shape 12)) (f30-1 (-> arg2 root root-prim prim-core world-sphere w)) @@ -406,12 +387,7 @@ (-> arg2 traffic-hash-id) ) ) - (let* ((s2-0 (the-as basic (-> s3-1 s4-1))) - (v1-70 (if (type? (the-as collide-shape s2-0) vehicle) - (the-as vehicle s2-0) - ) - ) - ) + (let ((v1-70 (as-type (-> s3-1 s4-1) vehicle))) (when (and v1-70 (not (logtest? (-> v1-70 flags) (rigid-body-object-flag dead))) (nonzero? (-> v1-70 flight-level-index)) @@ -429,9 +405,7 @@ (let ((f1-12 a0-35)) (vector-float*! (-> gp-0 14) (-> gp-0 12) (/ 1.0 (sqrtf f1-12))) (when #t - (let* ((f0-28 (+ f30-1 (-> v1-70 root root-prim prim-core world-sphere w))) - (f28-0 (* f0-28 f0-28)) - ) + (let ((f28-0 (square (+ f30-1 (-> v1-70 root root-prim prim-core world-sphere w))))) (let ((f0-31 (fmax 0.0 (/ (- f28-0 f1-12) f28-0)))) (when (not (logtest? (-> v1-70 flags) (rigid-body-object-flag player-driving))) (when (and (< 0.0 sv-20) (< f1-12 f28-0)) @@ -478,18 +452,10 @@ (.mov v1-88 vf1) (let ((f0-39 v1-88)) (logclear! (-> this flags) (vehicle-controller-flag off-path)) - (let ((f1-23 4096.0)) - (when (< (* f1-23 f1-23) f0-39) - (logior! (-> this flags) (vehicle-controller-flag off-path)) - (let ((t9-8 vector-normalize!) - (a0-69 (-> gp-0 6)) - (f1-26 12288.0) - (f2-12 4096.0) - ) - (t9-8 a0-69 (fmin f1-26 (- f0-39 (* f2-12 f2-12)))) - ) - (vector+! (-> gp-0 2) (-> gp-0 2) (-> gp-0 6)) - ) + (when (< (square 4096.0) f0-39) + (logior! (-> this flags) (vehicle-controller-flag off-path)) + (vector-normalize! (-> gp-0 6) (fmin 12288.0 (- f0-39 (square 4096.0)))) + (vector+! (-> gp-0 2) (-> gp-0 2) (-> gp-0 6)) ) ) (vector+float*! (-> gp-0 6) (-> gp-0 1) (-> gp-0 5) (- (vector-dot (-> gp-0 5) (-> gp-0 1)))) diff --git a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-effects.gc b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-effects.gc index a25f1de5c9..e38fb7fab0 100644 --- a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-effects.gc +++ b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-effects.gc @@ -65,9 +65,7 @@ (set! (-> this engine-sound-factor) f30-0) (cond (#f - (let* ((f0-23 40960.0) - (f0-25 (* f0-23 f0-23)) - ) + (let ((f0-25 (square 40960.0))) (.lvf vf1 (&-> (-> this rbody state lin-velocity) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -309,7 +307,6 @@ ) (defmethod draw-thrusters ((this vehicle)) - (local-vars (sv-272 sparticle-launcher) (sv-276 sparticle-launcher)) (when (= (-> this controller traffic sync-mask-32) (ash 1 (logand (-> this traffic-priority-id) 31))) (let ((f0-1 (+ (-> *time-of-day-context* time) (* 0.048387095 (the float (logand (-> this traffic-priority-id) 31)))) @@ -381,20 +378,16 @@ (set! (-> s4-0 color y) (rand-vu-float-range 192.0 255.0)) (set! (-> s4-0 color w) (* f30-1 (rand-vu-float-range 16.0 18.0))) (add! *simple-sprite-system* s4-0) - (let ((f0-21 (-> this camera-dist2)) - (f1-6 245760.0) - ) - (when (< f0-21 (* f1-6 f1-6)) - (let ((f0-22 3276.8)) - (set! (-> s4-0 position w) f0-22) - (set! (-> s4-0 size-y) f0-22) - ) - (set! (-> s4-0 fade-a) -0.00001356) - (set! (-> s4-0 fade-b) 2.3332994) - (set! (-> s4-0 color z) (rand-vu-float-range 128.0 160.0)) - (set! (-> s4-0 color w) (* f30-1 (rand-vu-float-range 32.0 36.0))) - (add! *simple-sprite-system* s4-0) + (when (< (-> this camera-dist2) (square 245760.0)) + (let ((f0-22 3276.8)) + (set! (-> s4-0 position w) f0-22) + (set! (-> s4-0 size-y) f0-22) ) + (set! (-> s4-0 fade-a) -0.00001356) + (set! (-> s4-0 fade-b) 2.3332994) + (set! (-> s4-0 color z) (rand-vu-float-range 128.0 160.0)) + (set! (-> s4-0 color w) (* f30-1 (rand-vu-float-range 32.0 36.0))) + (add! *simple-sprite-system* s4-0) ) ) ) @@ -436,10 +429,7 @@ (set! (-> *part-id-table* 776 init-specs 2 initial-valuef) (* 6.0 (+ 0.25 (-> this engine-power-factor)) (rand-vu)) ) - (let* ((f0-40 1.0) - (f1-15 (-> this engine-power-factor)) - (f0-41 (- f0-40 (* f1-15 f1-15))) - ) + (let ((f0-41 (- 1.0 (square (-> this engine-power-factor))))) (set! (-> *part-id-table* 776 init-specs 9 initial-valuef) (* 16.0 f0-41)) (set! (-> *part-id-table* 776 init-specs 9 random-rangef) (* 48.0 f0-41)) ) @@ -490,74 +480,79 @@ (set! (-> s5-0 0 trans y) f28-6) (set! (-> s5-0 0 trans z) (* f30-6 f26-0)) ) - (set! sv-272 (the-as sparticle-launcher #f)) - (set! sv-276 (the-as sparticle-launcher #f)) - (cond - ((< (-> this hit-points) 0.25) - (set! sv-272 (-> *part-id-table* 778)) - (set! sv-276 (-> *part-id-table* 774)) - ) - ((< (-> this hit-points) 0.5) - (set! sv-272 (-> *part-id-table* 781)) - ) - (else - (if (< (rand-vu) 0.05) - (set! sv-272 (-> *part-id-table* 783)) + (let ((sv-272 (the-as sparticle-launcher #f)) + (sv-276 (the-as sparticle-launcher #f)) + ) + (set! sv-272 (cond + ((< (-> this hit-points) 0.25) + (set! sv-272 (-> *part-id-table* 778)) + (set! sv-276 (-> *part-id-table* 774)) + sv-272 + ) + ((< (-> this hit-points) 0.5) + (-> *part-id-table* 781) + ) + (else + (if (< (rand-vu) 0.05) + (set! sv-272 (-> *part-id-table* 783)) + ) + sv-272 + ) + ) ) - ) - ) - (when sv-272 - (let ((s3-3 #f)) - (dotimes (s4-4 2) - (vector-rotate*! (-> s5-0 0 vector 2) (-> this info smoke-local-vel s4-4) (-> s5-0 1)) - (vector+! (-> s5-0 0 vector 2) (-> s5-0 0 vector 2) (-> this rbody state lin-velocity)) - (vector+float*! (-> s5-0 0 vector 2) (-> s5-0 0 vector 2) (-> s5-0 0 trans) (* 24576.0 (rand-vu))) - (let ((v1-152 (-> this info part-vel)) - (a0-54 (-> s5-0 0 vector 2)) - (f0-63 300.0) - ) - (vector-float*! v1-152 a0-54 (/ 1.0 f0-63)) - ) - (vector-matrix*! (the-as vector (-> s5-0 0)) (-> this info smoke-local-pos s4-4) (-> s5-0 1)) - (when (and sv-276 (< (rand-vu) 0.005)) - (let ((t9-37 sp-launch-particles-var) - (a0-56 (-> this info particle-system-2d)) - (a1-44 sv-276) - (a2-17 *launch-matrix*) + (when sv-272 + (let ((s3-3 #f)) + (dotimes (s4-4 2) + (vector-rotate*! (-> s5-0 0 vector 2) (-> this info smoke-local-vel s4-4) (-> s5-0 1)) + (vector+! (-> s5-0 0 vector 2) (-> s5-0 0 vector 2) (-> this rbody state lin-velocity)) + (vector+float*! (-> s5-0 0 vector 2) (-> s5-0 0 vector 2) (-> s5-0 0 trans) (* 24576.0 (rand-vu))) + (let ((v1-152 (-> this info part-vel)) + (a0-54 (-> s5-0 0 vector 2)) + (f0-63 300.0) ) - (set! (-> a2-17 trans quad) (-> s5-0 0 quad 0)) - (t9-37 - (the-as sparticle-system a0-56) - a1-44 - a2-17 + (vector-float*! v1-152 a0-54 (/ 1.0 f0-63)) + ) + (vector-matrix*! (the-as vector (-> s5-0 0)) (-> this info smoke-local-pos s4-4) (-> s5-0 1)) + (when (and sv-276 (< (rand-vu) 0.005)) + (let ((t9-37 sp-launch-particles-var) + (a0-56 (-> this info particle-system-2d)) + (a1-44 sv-276) + (a2-17 *launch-matrix*) + ) + (set! (-> a2-17 trans quad) (-> s5-0 0 quad 0)) + (t9-37 + (the-as sparticle-system a0-56) + a1-44 + a2-17 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + (set! s3-3 #t) + ) + (set! (-> sv-272 birthaccum) (the-as float (-> this smoke-part-accum s4-4))) + (let ((t9-38 sp-launch-particles-var) + (a0-57 (-> this info particle-system-2d)) + (a1-45 sv-272) + (a2-18 *launch-matrix*) + ) + (set! (-> a2-18 trans quad) (-> s5-0 0 quad 0)) + (t9-38 + (the-as sparticle-system a0-57) + a1-45 + a2-18 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0 ) ) - (set! s3-3 #t) + (set! (-> this smoke-part-accum s4-4) (the-as basic (-> sv-272 birthaccum))) ) - (set! (-> sv-272 birthaccum) (the-as float (-> this smoke-part-accum s4-4))) - (let ((t9-38 sp-launch-particles-var) - (a0-57 (-> this info particle-system-2d)) - (a1-45 sv-272) - (a2-18 *launch-matrix*) - ) - (set! (-> a2-18 trans quad) (-> s5-0 0 quad 0)) - (t9-38 - (the-as sparticle-system a0-57) - a1-45 - a2-18 - (the-as sparticle-launch-state #f) - (the-as sparticle-launch-control #f) - 1.0 + (if s3-3 + (sound-play "damage-zaps" :id (-> this damage-zap-sound-id)) ) - ) - (set! (-> this smoke-part-accum s4-4) (the-as basic (-> sv-272 birthaccum))) ) - (if s3-3 - (sound-play "damage-zaps" :id (-> this damage-zap-sound-id)) - ) ) ) ) diff --git a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-guard.gc b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-guard.gc index 8f79fd0dc8..4c327e7712 100644 --- a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-guard.gc +++ b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-guard.gc @@ -381,12 +381,7 @@ (vector+! (-> gp-0 vec-2) (-> s3-2 start-pos) (-> s3-2 move-dist)) ) (else - (let* ((s4-1 (-> s3-2 best-other-tri collide-ptr)) - (a0-43 (if (type? s4-1 collide-shape-prim) - s4-1 - ) - ) - ) + (let ((a0-43 (the-as basic (as-type (-> s3-2 best-other-tri collide-ptr) collide-shape-prim)))) (if (and a0-43 (logtest? (-> (the-as collide-shape-prim a0-43) prim-core collide-as) (collide-spec jak))) (set! s5-1 #t) ) @@ -490,7 +485,7 @@ (set! (-> v1-16 trans quad) a3-1) ) (dotimes (s3-0 (-> this info barrel-count)) - (vector-matrix*! (-> s4-0 vec-1) (the-as vector (-> this info barrel-array s3-0)) (-> s4-0 mat-1)) + (vector-matrix*! (-> s4-0 vec-1) (-> this info barrel-array s3-0 local-pos) (-> s4-0 mat-1)) (set! (-> s4-0 vec-2 quad) (-> s4-0 mat-1 vector 2 quad)) (set! (-> s4-0 proj-params pos quad) (-> s4-0 vec-1 quad)) (vector-float*! (-> s4-0 proj-params vel) (-> s4-0 vec-2) (-> this info shot-speed)) @@ -651,10 +646,10 @@ (cond ((< -12288.0 (- (-> arg0 tpos y) (-> arg0 spos y))) (logior! (-> this controller flags) (vehicle-controller-flag ignore-others no-slowing-for-turns)) - (let* ((f0-9 (* 2.0 (-> this info max-xz-speed))) - (f1-8 (fmax 0.0 (vector-dot (-> arg0 sdir) (-> arg0 to-target-dir)))) - (f0-10 (* f0-9 (* f1-8 f1-8))) - ) + (let ((f0-10 + (* 2.0 (-> this info max-xz-speed) (square (fmax 0.0 (vector-dot (-> arg0 sdir) (-> arg0 to-target-dir))))) + ) + ) (+! (-> this controller target-speed) f0-10) ) ) @@ -1021,11 +1016,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-11 vf1) - (let ((f0-2 v1-11) - (f1-3 61440.0) - ) - (< f0-2 (* f1-3 f1-3)) - ) + (< v1-11 (square 61440.0)) ) (< (-> arg0 dist) 122880.0) ) @@ -1211,10 +1202,7 @@ (go-virtual hostile) ) (speech-control-method-12 *speech-control* self (speech-type speech-type-4)) - (if (or (time-elapsed? (-> self state-time) (seconds 8)) (let ((f0-0 409600.0)) - (< (* f0-0 f0-0) (-> self player-dist2)) - ) - ) + (if (or (time-elapsed? (-> self state-time) (seconds 8)) (< (square 409600.0) (-> self player-dist2))) (logclear! (-> self flags) (rigid-body-object-flag persistent alert)) ) ) diff --git a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-physics.gc b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-physics.gc index dcfa43d156..496df98dc2 100644 --- a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-physics.gc +++ b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-physics.gc @@ -36,13 +36,10 @@ (a1-1 (-> s4-0 local-pos)) (a2-0 (-> s4-0 normal)) ) - (rigid-body-method-22 (-> v1-18 state) (the-as vector a1-1) a2-0) + (rigid-body-method-22 (-> v1-18 state) (-> a1-1 0) a2-0) ) - (let* ((f0-7 (* 0.062831804 (fmin 200.0 (vector-length (-> s4-0 normal))) f30-0)) - (f1-8 (-> s0-0 world-sphere w)) - (f0-8 (* f0-7 (* f1-8 f1-8))) - (f1-11 4096.0) - (f1-13 (* f1-11 f1-11)) + (let* ((f0-8 (* 0.062831804 (fmin 200.0 (vector-length (-> s4-0 normal))) f30-0 (square (-> s0-0 world-sphere w)))) + (f1-13 (square 4096.0)) (f0-10 (fmin (* f0-8 (/ 1.0 f1-13)) (/ (-> this info info mass) (* 2.0 arg0 (the float s2-0))))) ) (vector-float*! (-> s4-0 local-pos 1) (-> s4-0 normal) (* -1.0 f0-10)) @@ -51,17 +48,20 @@ (a1-3 (-> s4-0 local-pos)) (a2-1 (-> s4-0 local-pos 1)) ) - (rigid-body-method-18 (-> v1-34 state) (the-as vector a1-3) a2-1) + (rigid-body-method-18 (-> v1-34 state) (-> a1-3 0) a2-1) ) (vector-reset! (-> s4-0 local-pos 1)) - (let* ((f0-12 549018.94) - (f1-19 4096.0) - (f2-13 4096.0) - (f1-20 (* f1-19 (* f2-13 f2-13))) - (f0-16 (* f0-12 (/ 1.0 f1-20) (-> this info buoyancy-factor) f30-0 (-> s0-0 world-sphere w))) - (f1-25 (-> s0-0 world-sphere w)) - ) - (set! (-> s4-0 local-pos 1 y) (* f0-16 (* f1-25 f1-25))) + (let ((f0-12 549018.94) + (f1-20 (* 4096.0 (square 4096.0))) + ) + (set! (-> s4-0 local-pos 1 y) (* f0-12 + (/ 1.0 f1-20) + (-> this info buoyancy-factor) + f30-0 + (-> s0-0 world-sphere w) + (square (-> s0-0 world-sphere w)) + ) + ) ) ) ) @@ -69,7 +69,7 @@ (a1-4 (-> s4-0 local-pos)) (a2-2 (-> s4-0 local-pos 1)) ) - (rigid-body-method-18 (-> v1-46 state) (the-as vector a1-4) a2-2) + (rigid-body-method-18 (-> v1-46 state) (-> a1-4 0) a2-2) ) ) ) @@ -158,14 +158,7 @@ ) (when (logtest? (-> this info flags) 1) (vector-float*! (-> arg1 tmp) (-> arg1 mat vector 1) -1.0) - (let ((t9-4 vector-lerp!) - (a0-7 (-> arg1 lift-dir)) - (a1-4 (-> arg1 lift-dir)) - (a2-3 (-> arg1 tmp)) - (f0-8 (-> arg1 speed-factor)) - ) - (t9-4 a0-7 a1-4 a2-3 (* f0-8 f0-8)) - ) + (vector-lerp! (-> arg1 lift-dir) (-> arg1 lift-dir) (-> arg1 tmp) (square (-> arg1 speed-factor))) (vector-normalize! (-> arg1 lift-dir) 1.0) ) (vector-float*! (-> s2-0 move-dist) (-> arg1 lift-dir) (the-as float f30-1)) @@ -471,7 +464,6 @@ ) (defmethod rigid-body-object-method-29 ((this vehicle) (arg0 float)) - (local-vars (sv-624 float) (sv-720 float) (sv-724 float)) (rlet ((vf0 :class vf)) (init-vf0-vector) (let ((gp-0 (new 'stack-no-clear 'inline-array 'matrix 9)) @@ -482,41 +474,42 @@ (when (not (logtest? (-> this flags) (rigid-body-object-flag dead))) (vehicle-method-100 this arg0 (the-as vehicle-physics-work gp-0)) (when (>= 1 (-> this force-level)) - (set! sv-624 (* (-> s4-0 info mass) (-> s4-0 extra gravity))) - (when (!= (-> s4-0 pitch-control-factor) 0.0) - (set! (-> gp-0 3 vector 2 quad) (-> gp-0 0 quad 0)) - (set! (-> gp-0 3 vector 2 y) 0.0) - (let ((f30-0 (vector-dot (-> gp-0 3 vector 2) (-> s5-0 state ang-velocity)))) - (dotimes (s1-0 (-> s4-0 lift-thruster-count)) - (let ((s0-0 (-> s4-0 lift-thruster-array s1-0))) - (vector-matrix*! (-> gp-0 1 vector 2) (-> s0-0 local-pos) (-> gp-0 0)) - (vector-rotate*! (-> gp-0 1 trans) (-> s0-0 normal) (-> gp-0 0)) - (let* ((f0-5 -1.0) - (f1-2 1.0) - (f2-0 0.2) - (a0-9 (the-as number (-> s0-0 local-pos z))) - (a1-5 #xffffffff80000000) - (v1-16 #x3f800000) - (f0-7 - (* (fmax - f0-5 - (fmin - f1-2 - (* f2-0 (the-as float (logior (logand (the-as uint a0-9) a1-5) v1-16)) (-> s4-0 pitch-control-factor) f30-0) + (let ((sv-624 (* (-> s4-0 info mass) (-> s4-0 extra gravity)))) + (when (!= (-> s4-0 pitch-control-factor) 0.0) + (set! (-> gp-0 3 vector 2 quad) (-> gp-0 0 quad 0)) + (set! (-> gp-0 3 vector 2 y) 0.0) + (let ((f30-0 (vector-dot (-> gp-0 3 vector 2) (-> s5-0 state ang-velocity)))) + (dotimes (s1-0 (-> s4-0 lift-thruster-count)) + (let ((s0-0 (-> s4-0 lift-thruster-array s1-0))) + (vector-matrix*! (-> gp-0 1 vector 2) (-> s0-0 local-pos) (-> gp-0 0)) + (vector-rotate*! (-> gp-0 1 trans) (-> s0-0 normal) (-> gp-0 0)) + (let* ((f0-5 -1.0) + (f1-2 1.0) + (f2-0 0.2) + (a0-9 (the-as number (-> s0-0 local-pos z))) + (a1-5 #xffffffff80000000) + (v1-16 #x3f800000) + (f0-7 + (* (fmax + f0-5 + (fmin + f1-2 + (* f2-0 (the-as float (logior (logand (the-as uint a0-9) a1-5) v1-16)) (-> s4-0 pitch-control-factor) f30-0) + ) ) + sv-624 ) - sv-624 - ) + ) ) - ) - (vector-float*! (the-as vector (-> gp-0 1)) (-> gp-0 1 trans) (* -1.0 f0-7)) - ) - ) - (let ((v1-21 s5-0) - (a1-7 (-> gp-0 1 vector 2)) - (a2-4 (-> gp-0 1)) + (vector-float*! (the-as vector (-> gp-0 1)) (-> gp-0 1 trans) (* -1.0 f0-7)) ) - (rigid-body-method-18 (-> v1-21 state) a1-7 (the-as vector a2-4)) + ) + (let ((v1-21 s5-0) + (a1-7 (-> gp-0 1 vector 2)) + (a2-4 (-> gp-0 1)) + ) + (rigid-body-method-18 (-> v1-21 state) a1-7 (the-as vector a2-4)) + ) ) ) ) @@ -531,46 +524,43 @@ (quaternion->matrix (the-as matrix (-> s1-1 1)) (the-as quaternion (-> s1-1 0))) (set! (-> gp-0 3 trans quad) (-> s1-1 2 quad)) ) - (let ((f0-14 (vector-dot (the-as vector (-> gp-0 0)) (-> gp-0 3 trans)))) - (set! sv-720 (* (-> s4-0 info mass) (-> s4-0 extra gravity))) - (let ((f1-11 f0-14)) - (set! sv-724 - (+ (* f1-11 f1-11 f0-14) (* 0.075 (vector-dot (-> gp-0 0 vector 2) (-> s5-0 state ang-velocity)))) - ) - ) - ) - (dotimes (s1-2 (-> s4-0 roll-thruster-count)) - (let* ((s0-1 (-> s4-0 roll-thruster-array s1-2)) - (f0-17 0.0) - (f1-16 1.0) - (f2-7 -1.0) - (a0-19 (the-as number (-> s0-1 local-pos x))) - (a1-10 #xffffffff80000000) - (v1-44 #x3f800000) - (f30-1 - (fmax f0-17 (fmin f1-16 (* f2-7 (the-as float (logior (logand (the-as uint a0-19) a1-10) v1-44)) sv-724))) + (let* ((f0-14 (vector-dot (the-as vector (-> gp-0 0)) (-> gp-0 3 trans))) + (sv-720 (* (-> s4-0 info mass) (-> s4-0 extra gravity))) + (sv-724 (+ (* (square f0-14) f0-14) (* 0.075 (vector-dot (-> gp-0 0 vector 2) (-> s5-0 state ang-velocity))))) + ) + (dotimes (s1-2 (-> s4-0 roll-thruster-count)) + (let* ((s0-1 (-> s4-0 roll-thruster-array s1-2)) + (f0-17 0.0) + (f1-16 1.0) + (f2-7 -1.0) + (a0-19 (the-as number (-> s0-1 local-pos x))) + (a1-10 #xffffffff80000000) + (v1-44 #x3f800000) + (f30-1 + (fmax f0-17 (fmin f1-16 (* f2-7 (the-as float (logior (logand (the-as uint a0-19) a1-10) v1-44)) sv-724))) + ) ) - ) - (when (< 0.0 f30-1) - (let ((f30-2 - (* (+ f30-1 (+ (- (-> this power-fluctuation-factor)) (* 2.0 (rand-vu) (-> this power-fluctuation-factor)))) - (-> s4-0 roll-control-factor) - sv-720 - ) + (when (< 0.0 f30-1) + (let ((f30-2 + (* (+ f30-1 (+ (- (-> this power-fluctuation-factor)) (* 2.0 (rand-vu) (-> this power-fluctuation-factor)))) + (-> s4-0 roll-control-factor) + sv-720 + ) + ) ) - ) - (+! (-> this roll-thrust s1-2) (fmax 0.0 f30-2)) - (vector-matrix*! (-> gp-0 1 vector 2) (-> s0-1 local-pos) (-> gp-0 0)) - (vector-rotate*! (-> gp-0 1 trans) (-> s0-1 normal) (-> gp-0 0)) - (vector-float*! (the-as vector (-> gp-0 1)) (-> gp-0 1 trans) (* -1.0 f30-2)) + (+! (-> this roll-thrust s1-2) (fmax 0.0 f30-2)) + (vector-matrix*! (-> gp-0 1 vector 2) (-> s0-1 local-pos) (-> gp-0 0)) + (vector-rotate*! (-> gp-0 1 trans) (-> s0-1 normal) (-> gp-0 0)) + (vector-float*! (the-as vector (-> gp-0 1)) (-> gp-0 1 trans) (* -1.0 f30-2)) + ) + (let ((v1-56 s5-0) + (a1-14 (-> gp-0 1 vector 2)) + (a2-8 (-> gp-0 1)) + ) + (rigid-body-method-18 (-> v1-56 state) a1-14 (the-as vector a2-8)) + ) + 0 ) - (let ((v1-56 s5-0) - (a1-14 (-> gp-0 1 vector 2)) - (a2-8 (-> gp-0 1)) - ) - (rigid-body-method-18 (-> v1-56 state) a1-14 (the-as vector a2-8)) - ) - 0 ) ) ) @@ -779,16 +769,21 @@ (vector-normalize! (-> gp-0 1 trans) 1.0) (let* ((v1-174 (-> s5-0 state lin-velocity)) (f0-90 (/ (sqrtf (+ (* (-> v1-174 x) (-> v1-174 x)) (* (-> v1-174 z) (-> v1-174 z)))) (-> s4-0 max-xz-speed))) - (v1-176 (-> gp-0 1)) - (a0-65 (-> gp-0 1 trans)) - (f1-67 -1.0) - (f2-29 (* (-> s4-0 speed-limiting-drag) (vector-dot (-> s5-0 state force) (-> gp-0 1 trans)))) - (f3-19 - (* (fabs (-> this engine-thrust)) (-> s4-0 speed-scrubbing-drag) (vector-length (-> s5-0 state lin-momentum))) - ) - (f4-6 (- 1.0 (fabs (vector-dot (-> s5-0 state matrix vector 2) (-> gp-0 1 trans))))) ) - (vector-float*! (the-as vector v1-176) a0-65 (* f1-67 (+ f2-29 (* f3-19 (* f4-6 f4-6))) (sqrtf f0-90))) + (vector-float*! + (the-as vector (-> gp-0 1)) + (-> gp-0 1 trans) + (* -1.0 + (+ (* (-> s4-0 speed-limiting-drag) (vector-dot (-> s5-0 state force) (-> gp-0 1 trans))) + (* (fabs (-> this engine-thrust)) + (-> s4-0 speed-scrubbing-drag) + (vector-length (-> s5-0 state lin-momentum)) + (square (- 1.0 (fabs (vector-dot (-> s5-0 state matrix vector 2) (-> gp-0 1 trans))))) + ) + ) + (sqrtf f0-90) + ) + ) ) (let ((a1-51 (-> gp-0 1))) (rigid-body-method-20 (-> s5-0 state) (the-as vector a1-51)) diff --git a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-states.gc b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-states.gc index 593b059fce..c7f9f4dd56 100644 --- a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-states.gc +++ b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-states.gc @@ -273,19 +273,14 @@ (set-time! (-> self state-time)) ) (else - (if (or (time-elapsed? (-> self state-time) (seconds 5)) (let ((f0-2 409600.0)) - (< (* f0-2 f0-2) (-> self camera-dist2)) - ) - ) + (if (or (time-elapsed? (-> self state-time) (seconds 5)) (< (square 409600.0) (-> self camera-dist2))) (go-virtual die) ) ) ) - (let ((f0-5 819200.0)) - (if (< (* f0-5 f0-5) (-> self camera-dist2)) - (go-virtual die) - ) - ) + (if (< (square 819200.0) (-> self camera-dist2)) + (go-virtual die) + ) (cond ((logtest? (-> self rbody state flags) (rigid-body-flag enable-physics)) (let ((gp-2 (new 'stack-no-clear 'rigid-body-info))) @@ -300,11 +295,12 @@ (vehicle-method-121 self) (set! (-> self rbody state info) (-> self info info)) (when (logtest? (-> self flags) (rigid-body-object-flag disturbed)) - (let* ((f0-14 (* 0.0033333334 (the float (- (current-time) (-> self disturbed-time))))) - (f0-17 (* f0-14 f0-14 (-> self camera-dist2))) - (f1-5 0.000016276043) - (f0-18 (* f0-17 (* f1-5 f1-5))) - ) + (let ((f0-18 (* (square (* 0.0033333334 (the float (- (current-time) (-> self disturbed-time))))) + (-> self camera-dist2) + (square 0.000016276043) + ) + ) + ) (.lvf vf1 (&-> (-> self rbody state ang-velocity) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -320,11 +316,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-53 vf1) - (let ((f1-9 v1-53) - (f2-0 614.4) - ) - (< f1-9 (* f0-18 (* f2-0 f2-0))) - ) + (< v1-53 (* f0-18 (square 614.4))) ) ) (logclear! (-> self flags) (rigid-body-object-flag disturbed)) diff --git a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-util.gc b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-util.gc index 448196025f..e7e2ef81dc 100644 --- a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-util.gc +++ b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-util.gc @@ -178,187 +178,177 @@ (defmethod check-player-get-on ((this vehicle)) (with-pp - (let ((f0-0 (-> this player-dist2)) - (f1-0 102400.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (let ((s5-0 (new 'stack-no-clear 'mystery-vehicle-type))) - (set! (-> s5-0 floats 4) (+ 8192.0 (-> this root root-prim local-sphere w))) - (if (logtest? (rigid-body-object-flag ai-driving) (-> this flags)) - (set! (-> s5-0 floats 4) (* 1.5 (-> s5-0 floats 4))) - ) - (set! (-> s5-0 matrices 0 vector 1 quad) (-> (target-pos 0) quad)) - (+! (-> s5-0 matrices 0 vector 1 y) 8192.0) - (let* ((v1-14 (-> s5-0 matrices 1)) - (a3-0 (-> this node-list data 0 bone transform)) - (a0-5 (-> a3-0 quad 0)) - (a1-0 (-> a3-0 quad 1)) - (a2-0 (-> a3-0 quad 2)) - (a3-1 (-> a3-0 trans quad)) - ) - (set! (-> v1-14 quad 0) a0-5) - (set! (-> v1-14 quad 1) a1-0) - (set! (-> v1-14 quad 2) a2-0) - (set! (-> v1-14 trans quad) a3-1) + (when (< (-> this player-dist2) (square 102400.0)) + (let ((s5-0 (new 'stack-no-clear 'mystery-vehicle-type))) + (set! (-> s5-0 floats 4) (+ 8192.0 (-> this root root-prim local-sphere w))) + (if (logtest? (rigid-body-object-flag ai-driving) (-> this flags)) + (set! (-> s5-0 floats 4) (* 1.5 (-> s5-0 floats 4))) ) - (set! (-> s5-0 matrices 0 vector 2 quad) (-> s5-0 matrices 1 trans quad)) - (set! (-> s5-0 floats 2) (- (-> s5-0 matrices 0 vector 1 y) (-> s5-0 matrices 0 vector 2 y))) - (let ((f0-9 (vector-vector-xz-distance-squared (-> s5-0 matrices 0 vector 1) (-> s5-0 matrices 0 vector 2))) - (f1-7 (-> s5-0 floats 4)) - ) - (when (and (< f0-9 (* f1-7 f1-7)) - (< -81920.0 (-> s5-0 floats 2)) - (< (-> s5-0 floats 2) 20480.0) - *target* - (not (focus-test? *target* dead grabbed in-head under-water pole flut tube pilot dark)) - (or (not (focus-test? *target* edge-grab)) - (logtest? (-> this flags) (rigid-body-object-flag player-edge-grabbing)) - ) - (-> *setting-control* user-current pilot) - (let ((a1-2 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-2 from) (process->ppointer pp)) - (set! (-> a1-2 num-params) 1) - (set! (-> a1-2 message) 'query) - (set! (-> a1-2 param 0) (the-as uint 'mode)) - (let ((v1-37 (send-event-function *target* a1-2))) - (and (or (= v1-37 #f) (= v1-37 'board)) - (or (logtest? (-> this flags) (rigid-body-object-flag waiting-for-player)) - (-> *setting-control* user-current vehicle-hijacking) - ) - ) - ) - ) + (set! (-> s5-0 matrices 0 vector 1 quad) (-> (target-pos 0) quad)) + (+! (-> s5-0 matrices 0 vector 1 y) 8192.0) + (let* ((v1-14 (-> s5-0 matrices 1)) + (a3-0 (-> this node-list data 0 bone transform)) + (a0-5 (-> a3-0 quad 0)) + (a1-0 (-> a3-0 quad 1)) + (a2-0 (-> a3-0 quad 2)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-14 quad 0) a0-5) + (set! (-> v1-14 quad 1) a1-0) + (set! (-> v1-14 quad 2) a2-0) + (set! (-> v1-14 trans quad) a3-1) + ) + (set! (-> s5-0 matrices 0 vector 2 quad) (-> s5-0 matrices 1 trans quad)) + (set! (-> s5-0 floats 2) (- (-> s5-0 matrices 0 vector 1 y) (-> s5-0 matrices 0 vector 2 y))) + (when (and (< (vector-vector-xz-distance-squared (-> s5-0 matrices 0 vector 1) (-> s5-0 matrices 0 vector 2)) + (square (-> s5-0 floats 4)) + ) + (< -81920.0 (-> s5-0 floats 2)) + (< (-> s5-0 floats 2) 20480.0) + *target* + (not (focus-test? *target* dead grabbed in-head under-water pole flut tube pilot dark)) + (or (not (focus-test? *target* edge-grab)) + (logtest? (-> this flags) (rigid-body-object-flag player-edge-grabbing)) ) - (let ((s2-0 #f) - (s4-1 #f) - (s3-0 #f) - ) - (let ((a2-2 (get-best-seat-for-vehicle this (-> s5-0 matrices 0 vector 1) 1 0))) - (when (!= a2-2 -1) - (compute-seat-position this (-> s5-0 matrices 0 vector 2) a2-2) - (vector+float*! - (-> s5-0 matrices 0 vector 2) - (-> s5-0 matrices 0 vector 2) - (-> s5-0 matrices 1 vector 1) - 4096.0 - ) - ) - ) - (set! (-> s5-0 floats 1) - (vector-vector-distance-squared (-> s5-0 matrices 0 vector 2) (-> s5-0 matrices 0 vector 1)) - ) - (let ((f0-14 (-> s5-0 floats 1)) - (f1-12 81920.0) - ) - (when (< f0-14 (* f1-12 f1-12)) - (set! (-> s5-0 cquery start-pos quad) (-> s5-0 matrices 0 vector 1 quad)) - (vector-! (-> s5-0 cquery move-dist) (-> s5-0 matrices 0 vector 2) (-> s5-0 matrices 0 vector 1)) - (let ((v1-54 (-> s5-0 cquery))) - (set! (-> v1-54 radius) 4096.0) - (set! (-> v1-54 collide-with) (collide-spec - backgnd - crate - civilian - enemy - obstacle - hit-by-player-list - hit-by-others-list - player-list - collectable - blocking-plane - tobot - pusher - vehicle-mesh - obstacle-for-jak - ) - ) - (set! (-> v1-54 ignore-process0) this) - (set! (-> v1-54 ignore-process1) #f) - (set! (-> v1-54 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-54 action-mask) (collide-action solid)) - ) - (set! s2-0 (< (fill-and-probe-using-line-sphere *collide-cache* (-> s5-0 cquery)) 0.0)) - 0 - ) - ) - (when s2-0 - (when (and (or (< -14336.0 (-> s5-0 floats 2)) (logtest? (-> this flags) (rigid-body-object-flag player-edge-grabbing))) - (not (logtest? (rigid-body-object-flag no-hijack) (-> this flags))) - ) - (set! s4-1 #t) - (set! (-> s5-0 floats 3) (* (-> this hit-points) (/ 40960.0 (sqrtf (-> s5-0 floats 1))))) - ) - (when (and (not s4-1) - (and (< (-> s5-0 floats 2) -8192.0) (not (logtest? (-> *target* focus-status) (focus-status edge-grab)))) - ) - (matrix-4x4-inverse! (-> s5-0 matrices 2) (-> s5-0 matrices 1)) - (vector-matrix*! (the-as vector (-> s5-0 matrices)) (-> s5-0 matrices 0 vector 1) (-> s5-0 matrices 2)) - (set! (-> s5-0 floats 0) 81920.0) - (dotimes (s2-1 (-> this info grab-rail-count)) - (let ((s1-0 (-> this info grab-rail-array s2-1))) - (vector-! (-> s5-0 matrices 0 trans) (the-as vector (-> s5-0 matrices)) (-> s1-0 local-pos 0)) - (when #t - (let ((f30-0 (vector-segment-distance-point! - (the-as vector (-> s5-0 matrices)) - (-> s1-0 local-pos 0) - (-> s1-0 local-pos 1) - (-> s5-0 matrices 0 trans) - ) - ) + (-> *setting-control* user-current pilot) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer pp)) + (set! (-> a1-2 num-params) 1) + (set! (-> a1-2 message) 'query) + (set! (-> a1-2 param 0) (the-as uint 'mode)) + (let ((v1-37 (send-event-function *target* a1-2))) + (and (or (= v1-37 #f) (= v1-37 'board)) + (or (logtest? (-> this flags) (rigid-body-object-flag waiting-for-player)) + (-> *setting-control* user-current vehicle-hijacking) ) - (when (< f30-0 (-> s5-0 floats 0)) - (set! (-> s5-0 floats 0) f30-0) - (set! (-> s5-0 vectors 0 quad) (-> s5-0 matrices 0 trans quad)) - (vector-! (-> s5-0 vectors 1) (-> s1-0 local-pos 1) (-> s1-0 local-pos 0)) - (vector-normalize! (-> s5-0 vectors 1) 1.0) - (set! s3-0 #t) - (set! (-> s5-0 floats 3) (* (-> this hit-points) (/ 40960.0 f30-0))) - ) ) + ) + ) + ) + (let ((s2-0 #f) + (s4-1 #f) + (s3-0 #f) + ) + (let ((a2-2 (get-best-seat-for-vehicle this (-> s5-0 matrices 0 vector 1) 1 0))) + (when (!= a2-2 -1) + (compute-seat-position this (-> s5-0 matrices 0 vector 2) a2-2) + (vector+float*! + (-> s5-0 matrices 0 vector 2) + (-> s5-0 matrices 0 vector 2) + (-> s5-0 matrices 1 vector 1) + 4096.0 + ) + ) + ) + (set! (-> s5-0 floats 1) + (vector-vector-distance-squared (-> s5-0 matrices 0 vector 2) (-> s5-0 matrices 0 vector 1)) + ) + (when (< (-> s5-0 floats 1) (square 81920.0)) + (set! (-> s5-0 cquery start-pos quad) (-> s5-0 matrices 0 vector 1 quad)) + (vector-! (-> s5-0 cquery move-dist) (-> s5-0 matrices 0 vector 2) (-> s5-0 matrices 0 vector 1)) + (let ((v1-54 (-> s5-0 cquery))) + (set! (-> v1-54 radius) 4096.0) + (set! (-> v1-54 collide-with) (collide-spec + backgnd + crate + civilian + enemy + obstacle + hit-by-player-list + hit-by-others-list + player-list + collectable + blocking-plane + tobot + pusher + vehicle-mesh + obstacle-for-jak + ) + ) + (set! (-> v1-54 ignore-process0) this) + (set! (-> v1-54 ignore-process1) #f) + (set! (-> v1-54 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-54 action-mask) (collide-action solid)) + ) + (set! s2-0 (< (fill-and-probe-using-line-sphere *collide-cache* (-> s5-0 cquery)) 0.0)) + 0 + ) + (when s2-0 + (when (and (or (< -14336.0 (-> s5-0 floats 2)) (logtest? (-> this flags) (rigid-body-object-flag player-edge-grabbing))) + (not (logtest? (rigid-body-object-flag no-hijack) (-> this flags))) + ) + (set! s4-1 #t) + (set! (-> s5-0 floats 3) (* (-> this hit-points) (/ 40960.0 (sqrtf (-> s5-0 floats 1))))) + ) + (when (and (not s4-1) + (and (< (-> s5-0 floats 2) -8192.0) (not (logtest? (-> *target* focus-status) (focus-status edge-grab)))) + ) + (matrix-4x4-inverse! (-> s5-0 matrices 2) (-> s5-0 matrices 1)) + (vector-matrix*! (the-as vector (-> s5-0 matrices)) (-> s5-0 matrices 0 vector 1) (-> s5-0 matrices 2)) + (set! (-> s5-0 floats 0) 81920.0) + (dotimes (s2-1 (-> this info grab-rail-count)) + (let ((s1-0 (-> this info grab-rail-array s2-1))) + (vector-! (-> s5-0 matrices 0 trans) (the-as vector (-> s5-0 matrices)) (-> s1-0 local-pos 0)) + (when #t + (let ((f30-0 (vector-segment-distance-point! + (the-as vector (-> s5-0 matrices)) + (-> s1-0 local-pos 0) + (-> s1-0 local-pos 1) + (-> s5-0 matrices 0 trans) + ) + ) + ) + (when (< f30-0 (-> s5-0 floats 0)) + (set! (-> s5-0 floats 0) f30-0) + (set! (-> s5-0 vectors 0 quad) (-> s5-0 matrices 0 trans quad)) + (vector-! (-> s5-0 vectors 1) (-> s1-0 local-pos 1) (-> s1-0 local-pos 0)) + (vector-normalize! (-> s5-0 vectors 1) 1.0) + (set! s3-0 #t) + (set! (-> s5-0 floats 3) (* (-> this hit-points) (/ 40960.0 f30-0))) ) ) - 0 ) ) - (set! s3-0 (or s4-1 s3-0)) - (when (and s3-0 (and (vehicle-hud-chooser-method-9 *vehicle-hud-chooser* (process->handle this) (-> s5-0 floats 3)) - (can-display-query? this (the-as string #f) (/ 1.0 (-> s5-0 floats 3))) - ) - ) - (let ((s3-1 - (new 'stack 'font-context *font-default-matrix* 32 320 0.0 (font-color default) (font-flags shadow kerning)) - ) - ) - (set-width! s3-1 340) - (set-height! s3-1 80) - (set-scale! s3-1 0.9) - (set! (-> s3-1 flags) (font-flags shadow kerning large)) - (print-game-text - (lookup-text! *common-text* (text-id press-triangle-to-use) #f) - s3-1 - #f - 44 - (bucket-id progress) + 0 + ) + ) + (set! s3-0 (or s4-1 s3-0)) + (when (and s3-0 (and (vehicle-hud-chooser-method-9 *vehicle-hud-chooser* (process->handle this) (-> s5-0 floats 3)) + (can-display-query? this (the-as string #f) (/ 1.0 (-> s5-0 floats 3))) + ) + ) + (let ((s3-1 + (new 'stack 'font-context *font-default-matrix* 32 320 0.0 (font-color default) (font-flags shadow kerning)) ) ) - (when (cpad-pressed? 0 triangle) - (cond - (s4-1 - (when (send-event *target* 'change-mode 'pilot this 0 #f) - (logior! (-> this flags) (rigid-body-object-flag player-driving)) - (logclear! (-> this flags) (rigid-body-object-flag ai-driving)) - (vehicle-method-87 this) - ) - ) - (else - (set! (-> s5-0 handles 0) (process->handle this)) - (mem-copy! (the-as pointer *pilot-edge-grab-info*) (the-as pointer (-> s5-0 vectors)) 40) - (if (send-event *target* 'pilot-edge-grab *pilot-edge-grab-info*) - (format 0 "vehicle::check-player-get-on: (send-event *target* 'pilot-edge-grab self)~%") - ) - ) + (set-width! s3-1 340) + (set-height! s3-1 80) + (set-scale! s3-1 0.9) + (set! (-> s3-1 flags) (font-flags shadow kerning large)) + (print-game-text + (lookup-text! *common-text* (text-id press-triangle-to-use) #f) + s3-1 + #f + 44 + (bucket-id progress) + ) + ) + (when (cpad-pressed? 0 triangle) + (cond + (s4-1 + (when (send-event *target* 'change-mode 'pilot this 0 #f) + (logior! (-> this flags) (rigid-body-object-flag player-driving)) + (logclear! (-> this flags) (rigid-body-object-flag ai-driving)) + (vehicle-method-87 this) ) ) + (else + (set! (-> s5-0 handles 0) (process->handle this)) + (mem-copy! (the-as pointer *pilot-edge-grab-info*) (the-as pointer (-> s5-0 vectors)) 40) + (if (send-event *target* 'pilot-edge-grab *pilot-edge-grab-info*) + (format 0 "vehicle::check-player-get-on: (send-event *target* 'pilot-edge-grab self)~%") + ) + ) ) ) ) @@ -1295,21 +1285,14 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-13 vf1) - (let ((f0-1 v1-13) - (f1-0 0.5) - ) - (if (< f0-1 (* f1-0 f1-0)) - (logclear! (-> this flags) (rigid-body-object-flag disturbed)) - ) - ) + (if (< v1-13 (square 0.5)) + (logclear! (-> this flags) (rigid-body-object-flag disturbed)) + ) ) ) (else (when (>= (-> this rbody state matrix vector 1 y) (cos 910.2222)) - (let* ((f0-3 (-> this camera-dist2)) - (f1-3 0.000024414063) - (f0-4 (* f0-3 (* f1-3 f1-3))) - ) + (let ((f0-4 (* (-> this camera-dist2) (square 0.000024414063)))) (.lvf vf1 (&-> (-> this rbody state ang-velocity) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -1325,11 +1308,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-30 vf1) - (let ((f1-7 v1-30) - (f2-0 614.4) - ) - (< f1-7 (* f0-4 (* f2-0 f2-0))) - ) + (< v1-30 (* f0-4 (square 614.4))) ) ) (logclear! (-> this flags) (rigid-body-object-flag disturbed)) diff --git a/goal_src/jak2/levels/city/traffic/vehicle/vehicle.gc b/goal_src/jak2/levels/city/traffic/vehicle/vehicle.gc index 1002017951..b1c86d41e4 100644 --- a/goal_src/jak2/levels/city/traffic/vehicle/vehicle.gc +++ b/goal_src/jak2/levels/city/traffic/vehicle/vehicle.gc @@ -167,10 +167,8 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-63 vf1) - (let ((f0-25 v1-63) - (f1-11 12288.0) - ) - (when (< (* f1-11 f1-11) f0-25) + (let ((f0-25 v1-63)) + (when (< (square 12288.0) f0-25) (set! (-> this scrape-sound-envelope) 1.0) (if (logtest? (-> this flags) (rigid-body-object-flag player-driving)) (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 255 (seconds 0.05)) @@ -269,7 +267,7 @@ ) ) (set! (-> s5-0 vector 0 w) 0.0) - (vehicle-method-95 this (the-as vector (-> s5-0 vector))) + (vehicle-method-95 this (-> s5-0 vector 0)) (when (= this *debug-actor*) (let ((v1-43 (-> s5-0 vector))) (format *stdcon* "steer ~f, throttle ~f, brake ~f~%" (-> v1-43 0 x) (-> v1-43 0 y) (-> v1-43 0 z)) @@ -323,11 +321,8 @@ 0.0 ) (else - (let* ((v1-25 (-> this rbody state lin-velocity)) - (f1-10 (+ (* (-> v1-25 x) (-> v1-25 x)) (* (-> v1-25 z) (-> v1-25 z)))) - (f2-8 8192.0) - ) - (if (< f1-10 (* f2-8 f2-8)) + (let ((v1-25 (-> this rbody state lin-velocity))) + (if (< (+ (* (-> v1-25 x) (-> v1-25 x)) (* (-> v1-25 z) (-> v1-25 z))) (square 8192.0)) (logior! (-> this flags) (rigid-body-object-flag reverse-gear)) ) ) @@ -449,9 +444,7 @@ ) (let ((f1-6 0.0)) (when (logtest? (rigid-body-object-flag ignition) (-> this flags)) - (let ((f0-23 (- 1.0 (* (rand-vu) (-> this power-fluctuation-factor))))) - (set! f1-6 (* f0-23 f0-23)) - ) + (set! f1-6 (square (- 1.0 (* (rand-vu) (-> this power-fluctuation-factor))))) (if (not (logtest? (-> this flags) (rigid-body-object-flag riding))) (set! f1-6 (/ f1-6 2)) ) @@ -647,18 +640,12 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-88 vf1) - (let ((f0-20 v1-88) - (f1-13 122880.0) - ) - (if (< f0-20 (* f1-13 f1-13)) - (disable-rapid-camera-tracking this) - ) - ) + (if (< v1-88 (square 122880.0)) + (disable-rapid-camera-tracking this) + ) ) (else - (let* ((f0-21 143360.0) - (f0-23 (* f0-21 f0-21)) - ) + (let ((f0-23 (square 143360.0))) (.lvf vf1 (&-> (-> this root transv) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -876,24 +863,16 @@ ) (set! (-> this node-list data 0 bone transform trans quad) (-> this root trans quad)) (vehicle-method-119 this) - (let ((f0-1 (-> this player-dist2)) - (f1-0 245760.0) - ) - (if (< f0-1 (* f1-0 f1-0)) - (do-engine-sounds this) - ) - ) + (if (< (-> this player-dist2) (square 245760.0)) + (do-engine-sounds this) + ) (when (logtest? (-> this draw status) (draw-control-status on-screen)) (if #t (draw-thrusters this) ) - (let ((f0-2 (-> this camera-dist2)) - (f1-3 245760.0) - ) - (if (< f0-2 (* f1-3 f1-3)) - (update-joint-mods this) - ) - ) + (if (< (-> this camera-dist2) (square 245760.0)) + (update-joint-mods this) + ) ) (vehicle-method-120 this) (let ((s5-0 (-> this root))) @@ -1062,27 +1041,18 @@ (label cfg-3) (b! (not v1-4) cfg-20 :delay (empty-form)) (let ((f0-3 (fmin (-> this player-dist2) (-> this camera-dist2)))) - (let ((f1-1 819200.0)) - (b! (>= (* f1-1 f1-1) f0-3) cfg-8) - ) - (let ((f1-4 819200.0)) - (if (< (* f1-4 f1-4) f0-3) - (vehicle-method-113 this) - ) - ) + (b! (>= (square 819200.0) f0-3) cfg-8) + (if (< (square 819200.0) f0-3) + (vehicle-method-113 this) + ) (b! #t cfg-19 :delay (nop!)) (label cfg-8) - (let ((f1-7 81920.0)) - (b! (>= (* f1-7 f1-7) f0-3) cfg-18) - ) + (b! (>= (square 81920.0) f0-3) cfg-18) (b! (not (logtest? (-> this draw status) (draw-control-status on-screen))) cfg-11 :delay (nop!)) (set-time! (-> this state-time)) (b! #t cfg-17 :delay (nop!)) (label cfg-11) - (if (or (time-elapsed? (-> this state-time) (seconds 10)) (let ((f1-10 409600.0)) - (< (* f1-10 f1-10) f0-3) - ) - ) + (if (or (time-elapsed? (-> this state-time) (seconds 10)) (< (square 409600.0) f0-3)) (vehicle-method-113 this) ) ) @@ -1226,15 +1196,11 @@ (label cfg-12) 0 (vehicle-method-104 this) - (let ((f0-9 (-> this player-dist2)) - (f1-8 245760.0) - ) - (when (< f0-9 (* f1-8 f1-8)) - (let ((f0-10 (vector-length (-> this root transv)))) - (seek! (-> this engine-power-factor) (/ f0-10 (meters 15)) (* 6.0 (seconds-per-frame))) - ) - (do-engine-sounds this) + (when (< (-> this player-dist2) (square 245760.0)) + (let ((f0-10 (vector-length (-> this root transv)))) + (seek! (-> this engine-power-factor) (/ f0-10 (meters 15)) (* 6.0 (seconds-per-frame))) ) + (do-engine-sounds this) ) (when (logtest? (-> this draw status) (draw-control-status on-screen)) (when #t @@ -1471,7 +1437,7 @@ ) (defmethod rigid-body-object-method-47 ((this vehicle) (arg0 process-drawable) (arg1 attack-info) (arg2 touching-shapes-entry) (arg3 penetrate)) - (local-vars (f0-2 float) (sv-96 vector)) + (local-vars (f0-2 float)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1484,28 +1450,21 @@ ((logtest? (attack-mask attacker-velocity) (-> arg1 mask)) (set! (-> s5-0 vector 2 quad) (-> arg1 attacker-velocity quad)) ) - (else - (let ((s0-0 arg0)) - (cond - ((if (type? s0-0 process-focusable) - (the-as process-focusable s0-0) - ) - (set! sv-96 (-> s5-0 vector 2)) - (let ((s0-1 (-> s5-0 vector)) - (v1-7 (get-trans (the-as process-focusable arg0) 3)) - ) - (.lvf vf4 (&-> s0-1 0 quad)) - (.lvf vf5 (&-> v1-7 quad)) + ((as-type arg0 process-focusable) + (let ((sv-96 (-> s5-0 vector 2))) + (let ((s0-1 (-> s5-0 vector)) + (v1-7 (get-trans (the-as process-focusable arg0) 3)) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-96 quad) vf6) - ) - (else - (vector-! (-> s5-0 vector 2) (the-as vector (-> s5-0 vector)) (-> arg0 root trans)) - ) - ) - ) + (.lvf vf4 (&-> s0-1 0 quad)) + (.lvf vf5 (&-> v1-7 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-96 quad) vf6) + ) + ) + (else + (vector-! (-> s5-0 vector 2) (-> s5-0 vector 0) (-> arg0 root trans)) ) ) 0.0 @@ -1586,7 +1545,7 @@ (a1-11 (-> s5-0 vector)) (a2-3 s3-1) ) - (rigid-body-method-18 (-> v1-90 state) (the-as vector a1-11) a2-3) + (rigid-body-method-18 (-> v1-90 state) (-> a1-11 0) a2-3) ) (let ((v1-93 (-> this rbody)) (f0-10 1.0) @@ -1601,15 +1560,8 @@ (set! (-> *debug-vehicle-work* prim-sphere1 quad) (-> v1-103 prim1 cprim prim-core world-sphere quad)) (set! (-> *debug-vehicle-work* prim-sphere2 quad) (-> v1-103 prim2 cprim prim-core world-sphere quad)) ) - (add-debug-x #t (bucket-id debug-no-zbuf1) (the-as vector (-> s5-0 vector)) *color-blue*) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (the-as vector (-> s5-0 vector)) - s3-1 - (meters 0.00024414062) - *color-blue* - ) + (add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 vector 0) *color-blue*) + (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> s5-0 vector 0) s3-1 (meters 0.00024414062) *color-blue*) ) ) (rigid-body-object-method-45 this (the-as rigid-body-impact s5-0)) @@ -1824,13 +1776,9 @@ ) ) (('pilot-on) - (let* ((s3-2 (-> arg3 param 0)) - (s2-2 arg0) - (s5-3 (if (type? s2-2 process-focusable) - s2-2 - ) - ) - ) + (let ((s3-2 (-> arg3 param 0)) + (s5-3 (the-as process-drawable (as-type arg0 process-focusable))) + ) (when s5-3 (format #t "vehicle::event-handler: pilot-on (pid ~d) from pid ~d~%" (-> this pid) (-> arg0 pid)) (logior! (-> this flags) (rigid-body-object-flag riding)) diff --git a/goal_src/jak2/levels/city/vinroom/vinroom-part.gc b/goal_src/jak2/levels/city/vinroom/vinroom-part.gc index d93637a319..dad44c78aa 100644 --- a/goal_src/jak2/levels/city/vinroom/vinroom-part.gc +++ b/goal_src/jak2/levels/city/vinroom/vinroom-part.gc @@ -2081,7 +2081,7 @@ (let ((v1-1 (-> arg4 sprite key))) (when (nonzero? v1-1) (let ((f0-2 (+ (- 24576.0 (-> arg2 x-y-z-sx y)) (-> v1-1 origin trans y)))) - (set! (-> arg1 radius) (sqrtf (- (* (-> arg1 radius) (-> arg1 radius)) (* f0-2 f0-2)))) + (set! (-> arg1 radius) (sqrtf (- (* (-> arg1 radius) (-> arg1 radius)) (square f0-2)))) ) ) ) diff --git a/goal_src/jak2/levels/common/ai/ashelin/ash-shot.gc b/goal_src/jak2/levels/common/ai/ashelin/ash-shot.gc index f50d0c1e2c..44e91a1204 100644 --- a/goal_src/jak2/levels/common/ai/ashelin/ash-shot.gc +++ b/goal_src/jak2/levels/common/ai/ashelin/ash-shot.gc @@ -295,7 +295,7 @@ (launch-particles (-> *part-id-table* 673) gp-0) (let ((f0-4 (vector-dot s5-1 (-> (camera-matrix) vector 2)))) (when (< 0.0 f0-4) - (let ((f0-5 (* f0-4 f0-4)) + (let ((f0-5 (square f0-4)) (f30-1 (-> *part-id-table* 674 init-specs 8 initial-valuef)) (f28-0 (-> *part-id-table* 674 init-specs 8 random-rangef)) ) diff --git a/goal_src/jak2/levels/common/ai/ashelin/ash.gc b/goal_src/jak2/levels/common/ai/ashelin/ash.gc index f0e1c83036..3b993c5660 100644 --- a/goal_src/jak2/levels/common/ai/ashelin/ash.gc +++ b/goal_src/jak2/levels/common/ai/ashelin/ash.gc @@ -263,12 +263,7 @@ ) (defmethod enemy-method-97 ((this ashelin)) - (let* ((s5-0 (handle->process (-> this attacker-handle))) - (v1-3 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((v1-3 (the-as process (as-type (handle->process (-> this attacker-handle)) process-focusable)))) (when v1-3 (cond ((= (-> v1-3 type) target) @@ -303,12 +298,7 @@ (empty) ) (else - (let ((s4-0 (handle->process (-> this poi-handle)))) - (set! s5-1 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (set! s5-1 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable))) (if s5-1 (empty) (set! s5-1 *target*) @@ -322,12 +312,7 @@ (set! s5-1 v1-3) ) (else - (let ((s4-1 (handle->process (-> this poi-handle)))) - (set! s5-1 (if (type? s4-1 process-focusable) - s4-1 - ) - ) - ) + (set! s5-1 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable))) (cond (s5-1 (empty) @@ -1202,7 +1187,7 @@ ) (defmethod ashelin-method-236 ((this ashelin) (arg0 vector) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) - (local-vars (v1-23 float) (sv-272 vector)) + (local-vars (v1-23 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -1228,11 +1213,12 @@ 0 (let ((s0-0 (new 'stack-no-clear 'nav-avoid-spheres-params))) (vector-! (-> s0-0 current-pos) (-> this root trans) (-> this nav state mesh bounds)) - (set! sv-272 (-> s0-0 travel)) - (set! (-> sv-272 x) (sin arg1)) - (set! (-> sv-272 y) 0.0) - (set! (-> sv-272 z) (cos arg1)) - (set! (-> sv-272 w) 1.0) + (let ((sv-272 (-> s0-0 travel))) + (set! (-> sv-272 x) (sin arg1)) + (set! (-> sv-272 y) 0.0) + (set! (-> sv-272 z) (cos arg1)) + (set! (-> sv-272 w) 1.0) + ) (vector-float*! (-> s0-0 travel) (-> s0-0 travel) arg3) (set! (-> s0-0 pref-dir quad) (-> s0-0 travel quad)) (avoid-spheres-1! (-> this nav) s0-0) @@ -1250,11 +1236,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-23 vf1) - (let ((f0-11 v1-23) - (f1-1 arg4) - ) - (>= f0-11 (* f1-1 f1-1)) - ) + (>= v1-23 (square arg4)) ) ) ) @@ -1369,9 +1351,9 @@ (the int (+ 30.0 (* -100.0 (-> this offset)))) ) (set! (-> this sprites 0 angle) (* 182.04445 (the float (- 270 (/ (* 90 (-> this values 0 current)) 100))))) - (set-as-offset-from! (the-as hud-sprite (-> this sprites)) (the-as vector4w (-> this sprites 2)) 40 16) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites 2)) 1 16) - (set-as-offset-from! (-> this sprites 3) (the-as vector4w (-> this sprites 2)) 8 2) + (set-as-offset-from! (-> this sprites 0) (-> this sprites 2 pos) 40 16) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 2 pos) 1 16) + (set-as-offset-from! (-> this sprites 3) (-> this sprites 2 pos) 8 2) ((method-of-type hud draw) this) 0 (none) diff --git a/goal_src/jak2/levels/common/ai/bot-h.gc b/goal_src/jak2/levels/common/ai/bot-h.gc index f4731fe963..465ed296f0 100644 --- a/goal_src/jak2/levels/common/ai/bot-h.gc +++ b/goal_src/jak2/levels/common/ai/bot-h.gc @@ -646,50 +646,50 @@ ;; WARN: new jak 2 until loop case, check carefully (defmethod bot-speech-list-method-9 ((this bot-speech-list-shuffle) (bot bot) (sp-info (inline-array bot-speech-info)) (sp-flags speech-flags)) - (local-vars (sv-16 int)) (let ((course-cookie (-> bot course retry-cookie))) (when (!= course-cookie (-> this retry-cookie)) (set! (-> this retry-cookie) (-> bot course retry-cookie)) (reset-index this #t) ) ) - (set! sv-16 (-> this last-local-index)) - (when (< sv-16 0) - (when (not (logtest? (-> this flags) 1)) - (logior! (-> this flags) 1) - (set! sp-flags (logior sp-flags (speech-flags sf02))) + (let ((sv-16 (-> this last-local-index))) + (when (< sv-16 0) + (when (not (logtest? (-> this flags) 1)) + (logior! (-> this flags) 1) + (set! sp-flags (logior sp-flags (speech-flags sf02))) + ) + (reset-index this #f) ) - (reset-index this #f) - ) - (let ((history-mask 0)) - (if (>= sv-16 0) - (set! history-mask (ash 1 sv-16)) - ) - (if (logtest? (-> this flags) 8) - (set! history-mask (logior history-mask (-> this history-mask))) - ) - (until #f - (when (and (= history-mask (-> this history-mask-full)) (logtest? (-> this flags) 8)) - (if (not (logtest? (-> this flags) 2)) - (return -1) + (let ((history-mask 0)) + (if (>= sv-16 0) + (set! history-mask (ash 1 sv-16)) + ) + (if (logtest? (-> this flags) 8) + (set! history-mask (logior history-mask (-> this history-mask))) + ) + (until #f + (when (and (= history-mask (-> this history-mask-full)) (logtest? (-> this flags) 8)) + (if (not (logtest? (-> this flags) 2)) + (return -1) + ) + (reset-index this #f) + (if (>= sv-16 0) + (set! history-mask (ash 1 sv-16)) + (set! history-mask 0) + ) + ) + (let* ((last-idx (rnd-bit bot (-> this speech-indexes length) history-mask)) + (speech-idx (-> this speech-indexes last-idx)) + (v1-47 (-> sp-info speech-idx flags)) + ) + (set! history-mask (logior history-mask (ash 1 last-idx))) + (when (and (not (logtest? sp-flags v1-47)) + (or (not (logtest? v1-47 (speech-flags sf11))) (not (speech-playing? bot speech-idx))) + ) + (set! (-> this last-local-index) last-idx) + (logior! (-> this history-mask) (ash 1 last-idx)) + (return speech-idx) ) - (reset-index this #f) - (if (>= sv-16 0) - (set! history-mask (ash 1 sv-16)) - (set! history-mask 0) - ) - ) - (let* ((last-idx (rnd-bit bot (-> this speech-indexes length) history-mask)) - (speech-idx (-> this speech-indexes last-idx)) - (v1-47 (-> sp-info speech-idx flags)) - ) - (set! history-mask (logior history-mask (ash 1 last-idx))) - (when (and (not (logtest? sp-flags v1-47)) - (or (not (logtest? v1-47 (speech-flags sf11))) (not (speech-playing? bot speech-idx))) - ) - (set! (-> this last-local-index) last-idx) - (logior! (-> this history-mask) (ash 1 last-idx)) - (return speech-idx) ) ) ) diff --git a/goal_src/jak2/levels/common/ai/bot.gc b/goal_src/jak2/levels/common/ai/bot.gc index 7eff8fe3ac..cf34930bf2 100644 --- a/goal_src/jak2/levels/common/ai/bot.gc +++ b/goal_src/jak2/levels/common/ai/bot.gc @@ -8,6 +8,7 @@ ;; DECOMP BEGINS (defmethod run-logic? ((this bot)) + "Should this process be run? Checked by execute-process-tree." #t ) @@ -32,10 +33,10 @@ (let* ((v1-5 (-> (the-as (pointer uint8) (&+ arg1 s0-0)))) (a1-2 (-> this course spots v1-5)) ) - (bot-debug-draw-sphere this (the-as vector a1-2) (if (= v1-5 arg2) - (the-as rgba s2-0) - (the-as rgba s1-0) - ) + (bot-debug-draw-sphere this (-> a1-2 center) (if (= v1-5 arg2) + (the-as rgba s2-0) + (the-as rgba s1-0) + ) ) ) ) @@ -48,7 +49,7 @@ (let ((course (-> this course))) (countdown (i (-> course spot-count)) (let ((spot (-> course spots i))) - (bot-debug-draw-sphere this (the-as vector spot) (the-as rgba (-> this spot-color))) + (bot-debug-draw-sphere this (-> spot center) (the-as rgba (-> this spot-color))) (format (clear *temp-string*) "~d" i) (let ((spot-id *temp-string*)) (add-debug-text-3d @@ -84,7 +85,7 @@ (defmethod player-blocking-spot? ((this bot) (spot bot-spot)) (let ((f0-0 (-> spot blocked-xz-dist))) - (and (!= f0-0 0.0) (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> spot center)))) + (and (!= f0-0 0.0) (>= (square f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> spot center)))) ) ) @@ -118,12 +119,7 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod reset-attacker! ((this bot)) (logclear! (-> this bot-flags) (bot-flags attacked)) - (let* ((s5-0 (handle->process (-> this attacker-handle))) - (v1-5 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((v1-5 (the-as process (as-type (handle->process (-> this attacker-handle)) process-focusable)))) (if (and v1-5 (= (-> v1-5 type) target)) (set! (-> this attacker-handle) (the-as handle #f)) ) @@ -205,14 +201,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-3 a2-5) - (f1-2 (+ (-> a1-2 world-sphere w) (the-as float (-> s5-0 param 3)))) - ) - (when (< f0-3 (* f1-2 f1-2)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-2 world-sphere w) (the-as float (-> s5-0 param 3))))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -246,14 +238,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-4 a2-12) - (f1-6 (+ (-> a1-14 world-sphere w) (the-as float (-> s5-0 param 3)))) - ) - (when (< f0-4 (* f1-6 f1-6)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-14 world-sphere w) (the-as float (-> s5-0 param 3))))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -269,12 +257,7 @@ (dotimes (s3-0 *actor-list-length*) (let ((v1-26 (-> *actor-list* s3-0))) (when (logtest? (the-as collide-spec s4-0) (-> v1-26 root-prim prim-core collide-as)) - (let* ((s2-0 (-> v1-26 process)) - (a1-26 (if (type? s2-0 process-focusable) - s2-0 - ) - ) - ) + (let ((a1-26 (the-as process-drawable (as-type (-> v1-26 process) process-focusable)))) (when a1-26 (set-next-focus! this (the-as enemy a1-26) (the-as enemy-best-focus (&-> s5-0 next))) (if (-> s5-0 next) @@ -300,12 +283,7 @@ (t9-0 this arg0 arg1 arg2 arg3) ) (logclear! (-> this bot-flags) (bot-flags bf03 bf04)) - (let* ((s3-0 (handle->process (-> this incoming attacker-handle))) - (s5-0 (if (type? s3-0 process-focusable) - s3-0 - ) - ) - ) + (let ((s5-0 (the-as process (as-type (handle->process (-> this incoming attacker-handle)) process-focusable)))) (when s5-0 (cond ((= (-> s5-0 type) target) @@ -386,23 +364,12 @@ (defmethod clear-poi-and-focus! ((this bot)) "Clear our point of interest and focus handles." - (let* ((s4-0 (handle->process (-> this poi-handle))) - (s5-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (let ((s5-0 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable)))) (when s5-0 (set! (-> this poi-handle) (the-as handle #f)) - (let ((s4-1 (handle->process (-> this focus handle)))) - (if (= (if (type? s4-1 process-focusable) - s4-1 - ) - s5-0 - ) - (clear-focused (-> this focus)) - ) - ) + (if (= (the-as process (as-type (handle->process (-> this focus handle)) process-focusable)) s5-0) + (clear-focused (-> this focus)) + ) ) ) (none) @@ -424,8 +391,8 @@ ;; WARN: Return type mismatch int vs enemy-aware. (defmethod update-target-awareness! ((this bot) (arg0 process-focusable) (arg1 enemy-best-focus)) "Checks a variety of criteria to determine the level of awareness the enemy is of the target. Sets `aware` and related fields as well! -@TODO - flesh out docs -@returns the value that sets `aware`" + @TODO - flesh out docs + @returns the value that sets `aware`" (the-as enemy-aware 3) ) @@ -465,12 +432,7 @@ ) (defmethod enemy-method-97 ((this bot)) - (let* ((s5-0 (handle->process (-> this attacker-handle))) - (v1-3 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((v1-3 (the-as process (as-type (handle->process (-> this attacker-handle)) process-focusable)))) (when v1-3 (cond ((= (-> v1-3 type) target) @@ -505,12 +467,7 @@ (empty) ) (else - (let ((s4-0 (handle->process (-> this poi-handle)))) - (set! s5-1 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (set! s5-1 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable))) (if s5-1 (empty) (set! s5-1 *target*) @@ -524,12 +481,7 @@ (set! s5-1 v1-3) ) (else - (let ((s4-1 (handle->process (-> this poi-handle)))) - (set! s5-1 (if (type? s4-1 process-focusable) - s4-1 - ) - ) - ) + (set! s5-1 (the-as process (as-type (handle->process (-> this poi-handle)) process-focusable))) (cond (s5-1 (empty) @@ -608,14 +560,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-2 a2-5) - (f1-3 (+ (-> ccore world-sphere w) (-> sphere r))) - ) - (when (< f0-2 (* f1-3 f1-3)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> ccore world-sphere w) (-> sphere r)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -649,14 +597,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-3 a2-12) - (f1-7 (+ (-> a1-14 world-sphere w) (-> sphere r))) - ) - (when (< f0-3 (* f1-7 f1-7)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-14 world-sphere w) (-> sphere r)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -672,12 +616,7 @@ (dotimes (i *actor-list-length*) (let ((actor (-> *actor-list* i))) (when (logtest? (the-as int coll-spec) (-> actor root-prim prim-core collide-as)) - (let* ((proc (-> actor process)) - (enemy (if (type? proc process-focusable) - proc - ) - ) - ) + (let ((enemy (the-as process-drawable (as-type (-> actor process) process-focusable)))) (if (and enemy enemy (not (logtest? (-> (the-as process-focusable enemy) focus-status) (focus-status disable dead))) @@ -719,7 +658,7 @@ ;; WARN: disable def twice: 280. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. (defmethod general-event-handler ((this bot) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy -@TODO - unsure if there is a pattern for the events and this should have a more specific name" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (local-vars (v0-0 object)) (case arg2 (('track) @@ -834,13 +773,9 @@ (('notify) (case (-> arg3 param 0) (('attack) - (let ((s5-2 (-> arg3 param 1))) - (when (if (type? s5-2 process-focusable) - s5-2 - ) - (logior! (-> this enemy-flags) (enemy-flag victory)) - (set-time! (-> this hit-focus-time)) - ) + (when (the-as uint (as-type (-> arg3 param 1) process-focusable)) + (logior! (-> this enemy-flags) (enemy-flag victory)) + (set-time! (-> this hit-focus-time)) ) #t ) @@ -961,13 +896,9 @@ ) (else (when (!= (-> arg0 type) target) - (let* ((touch-entry (-> arg1 param 0)) - (s2-0 arg0) - (v1-6 (if (type? s2-0 process-focusable) - s2-0 - ) - ) - ) + (let ((touch-entry (-> arg1 param 0)) + (v1-6 (the-as process (as-type arg0 process-focusable))) + ) (cond ((and (focus-test? this dangerous) (logtest? (process-mask enemy) (-> arg0 mask)) @@ -1048,7 +979,7 @@ ;; WARN: Using new Jak 2 rtype-of (defmethod bot-check-too-far ((this bot)) "Call the current [[bot-waypoint]]'s `check-too-far` function if available, otherwise use the default `course` one. -If the player is too far, play a warning speech." + If the player is too far, play a warning speech." (let ((result 0)) (let ((too-far-check (-> this delay-too-far-check))) (cond @@ -1115,9 +1046,9 @@ If the player is too far, play a warning speech." (defmethod common-post ((this bot)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" (set! (-> this travel-prev-ry) (-> this travel-prev-ry1)) (set! (-> this travel-prev-ry1) (quaternion-y-angle (-> this root quat))) (let ((f0-4 (/ (the float (-> this hit-points)) (the float (-> this enemy-info default-hit-points))))) @@ -1370,20 +1301,21 @@ If the player is too far, play a warning speech." ) ;; WARN: Return type mismatch nav-enemy vs bot. -(defmethod relocate ((this bot) (arg0 int)) +(defmethod relocate ((this bot) (offset int)) (if (nonzero? (-> this ai-ctrl)) - (&+! (-> this ai-ctrl) arg0) + (&+! (-> this ai-ctrl) offset) ) (if (nonzero? (-> this task)) - (&+! (-> this task) arg0) + (&+! (-> this task) offset) ) (if (nonzero? (-> this swivel-joint-mod)) - (&+! (-> this swivel-joint-mod) arg0) + (&+! (-> this swivel-joint-mod) offset) ) - (the-as bot ((method-of-type nav-enemy relocate) this arg0)) + (the-as bot ((method-of-type nav-enemy relocate) this offset)) ) (defmethod deactivate ((this bot)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (send-event (handle->process (-> this health-handle)) 'hide-and-die) (if (nonzero? (-> this ai-ctrl)) (ai-task-control-method-9 (-> this ai-ctrl)) @@ -1609,9 +1541,8 @@ If the player is too far, play a warning speech." (when *target* (let ((target-trans (-> *target* control trans)) (bot-root (-> this root)) - (f0-0 14336.0) ) - (when (>= (* f0-0 f0-0) (vector-vector-distance-squared (-> bot-root trans) target-trans)) + (when (>= (square 14336.0) (vector-vector-distance-squared (-> bot-root trans) target-trans)) (let ((v1-8 (-> *target* control transv))) (when (>= (sqrtf (+ (* (-> v1-8 x) (-> v1-8 x)) (* (-> v1-8 z) (-> v1-8 z)))) 2048.0) (if (logtest? (-> this nav state flags) (nav-state-flag avoiding-sphere)) diff --git a/goal_src/jak2/levels/common/ai/sig/sig-shot.gc b/goal_src/jak2/levels/common/ai/sig/sig-shot.gc index 57719da59d..7daa86d028 100644 --- a/goal_src/jak2/levels/common/ai/sig/sig-shot.gc +++ b/goal_src/jak2/levels/common/ai/sig/sig-shot.gc @@ -295,7 +295,7 @@ (launch-particles (-> *part-id-table* 653) gp-0) (let ((f0-4 (vector-dot s5-1 (-> (camera-matrix) vector 2)))) (when (< 0.0 f0-4) - (let ((f0-5 (* f0-4 f0-4)) + (let ((f0-5 (square f0-4)) (f30-1 (-> *part-id-table* 654 init-specs 8 initial-valuef)) (f28-0 (-> *part-id-table* 654 init-specs 8 random-rangef)) ) diff --git a/goal_src/jak2/levels/common/ai/sig/sig.gc b/goal_src/jak2/levels/common/ai/sig/sig.gc index cebd263fa4..68fa3276b1 100644 --- a/goal_src/jak2/levels/common/ai/sig/sig.gc +++ b/goal_src/jak2/levels/common/ai/sig/sig.gc @@ -1280,14 +1280,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-7 vf1) - (let ((f0-4 a2-7) - (f1-3 (+ (-> a1-4 world-sphere w) (-> s5-0 r))) - ) - (when (< f0-4 (* f1-3 f1-3)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-8)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-7 (square (+ (-> a1-4 world-sphere w) (-> s5-0 r)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-8)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -1321,14 +1317,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-14 vf1) - (let ((f0-5 a2-14) - (f1-7 (+ (-> a1-16 world-sphere w) (-> s5-0 r))) - ) - (when (< f0-5 (* f1-7 f1-7)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-11)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-14 (square (+ (-> a1-16 world-sphere w) (-> s5-0 r)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-11)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) diff --git a/goal_src/jak2/levels/common/battle.gc b/goal_src/jak2/levels/common/battle.gc index f1dc08e912..37af4b8bd9 100644 --- a/goal_src/jak2/levels/common/battle.gc +++ b/goal_src/jak2/levels/common/battle.gc @@ -791,7 +791,6 @@ ) (defmethod draw-battle-marks ((this battle)) - (local-vars (sv-16 string) (sv-32 string)) (let ((s4-0 (-> this root trans)) (s5-0 (the-as int (-> this max-count))) ) @@ -837,13 +836,7 @@ (s2-1 #t) (s1-1 318) ) - (let ((s0-1 format)) - (set! sv-16 (clear *temp-string*)) - (set! sv-32 "~%spawner~%~S") - (let ((a2-5 (res-lump-struct (-> s4-1 entity) 'name structure))) - (s0-1 sv-16 sv-32 a2-5) - ) - ) + (format (clear *temp-string*) "~%spawner~%~S" (res-lump-struct (-> s4-1 entity) 'name structure)) (s3-1 s2-1 (the-as bucket-id s1-1) @@ -872,7 +865,7 @@ (set! (-> gp-0 quad) (-> arg0 attack-pos quad)) (set! (-> gp-0 w) f0-0) (let ((s5-0 (-> this info spawner-collide-with)) - (f30-0 (* f0-0 f0-0)) + (f30-0 (square f0-0)) ) (set! *actor-list-length* 0) (if (logtest? s5-0 (collide-spec hit-by-others-list)) @@ -899,14 +892,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-2 a2-5) - (f1-1 (+ (-> a1-5 world-sphere w) (-> gp-0 w))) - ) - (when (< f0-2 (* f1-1 f1-1)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-5 world-sphere w) (-> gp-0 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -940,14 +929,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-3 a2-12) - (f1-5 (+ (-> a1-17 world-sphere w) (-> gp-0 w))) - ) - (when (< f0-3 (* f1-5 f1-5)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-17 world-sphere w) (-> gp-0 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -978,7 +963,7 @@ (defmethod spawner-blocked? ((this battle) (arg0 battle-spawner)) (when (not (logtest? (-> this flags) (battle-flags no-spawner-block))) (let ((f0-0 (-> this info spawner-blocked-by-player-xz))) - (if (and (< 0.0 f0-0) (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 attack-pos)))) + (if (and (< 0.0 f0-0) (>= (square f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 attack-pos)))) (return #t) ) ) @@ -1145,11 +1130,7 @@ ) (defmethod get-spawner-for-enemy ((this battle) (arg0 process)) - (let ((v1-0 (if (type? arg0 nav-enemy) - (the-as nav-enemy arg0) - ) - ) - ) + (let ((v1-0 (as-type arg0 nav-enemy))) (when v1-0 (dotimes (a0-3 (-> this spawners length)) (let* ((a1-5 (-> this spawners data a0-3)) @@ -1561,32 +1542,32 @@ (none) ) -(defmethod relocate ((this battle-spawner-array) (arg0 int)) +(defmethod relocate ((this battle-spawner-array) (offset int)) (dotimes (v1-0 (-> this length)) (let ((a2-3 (-> this data v1-0))) - (&+! (-> a2-3 breeds) arg0) + (&+! (-> a2-3 breeds) offset) (if (-> a2-3 intro-path) - (&+! (-> a2-3 intro-path) arg0) + (&+! (-> a2-3 intro-path) offset) ) ) ) this ) -(defmethod relocate ((this battle) (arg0 int)) - (&+! (-> this spawners) arg0) - (&+! (-> this allies) arg0) - (call-parent-method this arg0) +(defmethod relocate ((this battle) (offset int)) + (&+! (-> this spawners) offset) + (&+! (-> this allies) offset) + (call-parent-method this offset) ) (defmethod initialize-spawner-breeds ((this battle) (arg0 battle-spawner) (arg1 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((s2-0 0) (s5-0 0) (s4-0 0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((s1-0 (res-lump-data arg1 'spawn-types (pointer type) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s1-0 (res-lump-data arg1 'spawn-types (pointer type) :tag-ptr (& sv-16))) + ) (dotimes (s0-0 2) (set! s2-0 0) (when s1-0 @@ -1619,8 +1600,9 @@ ) ) (else - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-18 (res-lump-data arg1 'spawn-percs (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-18 (res-lump-data arg1 'spawn-percs (pointer float) :tag-ptr (& sv-32))) + ) (when v1-18 (let ((a0-16 (min (the-as int (-> sv-32 elt-count)) s4-0)) (a1-14 0) @@ -1715,9 +1697,10 @@ ) (defmethod initialize-enemy-lists ((this battle)) - (local-vars (v0-4 battle-ally-array) (sv-16 res-tag) (sv-32 entity)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v0-0 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (local-vars (v0-4 battle-ally-array)) + (let* ((sv-16 (new 'static 'res-tag)) + (v0-0 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (when (and v0-0 (nonzero? (-> sv-16 elt-count))) (let* ((s5-0 (-> (the-as (pointer actor-group) v0-0) 0)) (s4-0 (-> s5-0 length)) @@ -1727,33 +1710,34 @@ (s2-0 0) ) (dotimes (s0-0 s4-0) - (set! sv-32 (-> s5-0 data s0-0 actor)) - (when sv-32 - (let ((enm-option (res-lump-value sv-32 'enemy-options enemy-option :time -1000000000.0))) - (cond - ((logtest? (enemy-option spawner) enm-option) - (+! s1-0 1) - (cond - ((zero? s3-0) - 0 - ) - (else - (let ((a1-2 (-> this spawners data (+ s1-0 -1)))) - (initialize-spawner this a1-2 (the-as entity-actor sv-32)) + (let ((sv-32 (-> s5-0 data s0-0 actor))) + (when sv-32 + (let ((enm-option (res-lump-value sv-32 'enemy-options enemy-option :time -1000000000.0))) + (cond + ((logtest? (enemy-option spawner) enm-option) + (+! s1-0 1) + (cond + ((zero? s3-0) + 0 + ) + (else + (let ((a1-2 (-> this spawners data (+ s1-0 -1)))) + (initialize-spawner this a1-2 (the-as entity-actor sv-32)) + ) ) ) ) - ) - (else - (when (not (logtest? (-> sv-32 extra perm status) (entity-perm-status dead))) - (+! s2-0 1) - (cond - ((zero? s3-0) - 0 - ) - (else - (let ((a1-3 (-> this allies data (+ s2-0 -1)))) - (initialize-ally this a1-3 (the-as entity-actor sv-32)) + (else + (when (not (logtest? (-> sv-32 extra perm status) (entity-perm-status dead))) + (+! s2-0 1) + (cond + ((zero? s3-0) + 0 + ) + (else + (let ((a1-3 (-> this allies data (+ s2-0 -1)))) + (initialize-ally this a1-3 (the-as entity-actor sv-32)) + ) ) ) ) @@ -1828,11 +1812,11 @@ (defmethod init-from-entity! ((this battle) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (logior! (-> this mask) (process-mask enemy)) (let ((s4-0 (new 'process 'trsqv))) (set! (-> this root) s4-0) diff --git a/goal_src/jak2/levels/common/elec-gate.gc b/goal_src/jak2/levels/common/elec-gate.gc index 1c6cfb993c..a8afce3086 100644 --- a/goal_src/jak2/levels/common/elec-gate.gc +++ b/goal_src/jak2/levels/common/elec-gate.gc @@ -112,17 +112,16 @@ ) (defbehavior elec-gate-post elec-gate () - (local-vars (curr-bolt elec-gate-bolt) (curr-point int)) (let ((num-points (-> self params ring-spec num-points))) (dotimes (bolt-idx 5) - (set! curr-bolt (-> self l-bolt bolt-idx)) - (let ((s4-0 - (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) (-> curr-bolt pos) 'interp) - ) - (s3-0 - (get-point-at-percent-along-path! (-> self path-r) (new 'stack-no-clear 'vector) (-> curr-bolt pos) 'interp) - ) - ) + (let* ((curr-bolt (-> self l-bolt bolt-idx)) + (s4-0 + (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) (-> curr-bolt pos) 'interp) + ) + (s3-0 + (get-point-at-percent-along-path! (-> self path-r) (new 'stack-no-clear 'vector) (-> curr-bolt pos) 'interp) + ) + ) (let ((a0-2 (-> curr-bolt bolt)) (v1-10 s4-0) ) @@ -141,13 +140,14 @@ (set! (-> s0-0 y) 0.0) (set! (-> s0-0 z) (-> curr-bolt ring-radius)) (set! (-> s0-0 w) 0.0) - (let ((f30-0 (* 65536.0 (/ 1.0 (the float (+ num-points -1)))))) - (set! curr-point 0) + (let ((f30-0 (* 65536.0 (/ 1.0 (the float (+ num-points -1))))) + (curr-point 0) + ) (while (< curr-point num-points) (set-point! s2-0 curr-point (vector+! (new 'stack-no-clear 'vector) s4-0 s0-0)) (set-point! s1-0 curr-point (vector+! (new 'stack-no-clear 'vector) s3-0 s0-0)) (vector-rotate-y! s0-0 s0-0 f30-0) - (set! curr-point (+ curr-point 1)) + (+! curr-point 1) ) ) ) @@ -326,28 +326,10 @@ ) ) :trans (behavior () - (local-vars - (sv-176 - (function lightning-spec time-frame symbol process-drawable vector vector none :behavior lightning-tracker) - ) - (sv-192 lightning-spec) - (sv-208 int) - (sv-224 symbol) - (sv-240 symbol) - (sv-256 lightning-spec) - (sv-272 int) - (sv-288 symbol) - (sv-304 symbol) - ) - (let* ((target *target*) - (proc-focus (if (type? target process-focusable) - target - ) - ) - ) + (let ((proc-focus (the-as target (as-type *target* process-focusable)))) (when proc-focus (let ((focus-trans (get-trans proc-focus 0))) - (let* ((a0-3 (vector-! (new 'stack-no-clear 'vector) focus-trans (the-as vector (-> self dividing-wall)))) + (let* ((a0-3 (vector-! (new 'stack-no-clear 'vector) focus-trans (-> self dividing-wall pos))) (s4-0 (-> self plane (if (< 0.0 (vector-dot a0-3 (-> self dividing-wall dir))) 0 1 @@ -385,73 +367,27 @@ (get-point-at-percent-along-path! (-> self path-r) (new 'stack-no-clear 'vector) (-> s4-1 0 pos) 'interp) ) ) - (let ((s2-0 (get-process *default-dead-pool* lightning-tracker #x4000))) - (when s2-0 - (let ((t9-7 (method-of-type lightning-tracker activate))) - (t9-7 - (the-as lightning-tracker s2-0) - *entity-pool* - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s1-0 run-function-in-process) - (s0-0 s2-0) - ) - (set! sv-176 lightning-tracker-init) - (set! sv-192 (-> self params bolt-spec)) - (set! sv-208 15) - (set! sv-224 (the-as symbol #f)) - (set! sv-240 (the-as symbol #f)) - (let ((t3-0 (get-trans proc-focus 3))) - ((the-as (function object object object object object object object object none) s1-0) - s0-0 - sv-176 - sv-192 - sv-208 - sv-224 - sv-240 - s3-2 - t3-0 - ) - ) - ) - (-> s2-0 ppointer) - ) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> self params bolt-spec) + 15 + (the-as symbol #f) + (the-as symbol #f) + s3-2 + (get-trans proc-focus 3) + :to *entity-pool* ) - (let ((s3-3 (get-process *default-dead-pool* lightning-tracker #x4000))) - (when s3-3 - (let ((t9-11 (method-of-type lightning-tracker activate))) - (t9-11 - (the-as lightning-tracker s3-3) - *entity-pool* - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s2-1 run-function-in-process) - (s1-1 s3-3) - (s0-1 lightning-tracker-init) - ) - (set! sv-256 (-> self params bolt-spec)) - (set! sv-272 15) - (set! sv-288 (the-as symbol #f)) - (set! sv-304 (the-as symbol #f)) - (let ((t3-1 (get-trans proc-focus 3))) - ((the-as (function object object object object object object object object none) s2-1) - s1-1 - s0-1 - sv-256 - sv-272 - sv-288 - sv-304 - s4-2 - t3-1 - ) - ) - ) - (-> s3-3 ppointer) - ) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> self params bolt-spec) + 15 + (the-as symbol #f) + (the-as symbol #f) + s4-2 + (get-trans proc-focus 3) + :to *entity-pool* ) ) ) @@ -701,7 +637,7 @@ (defmethod set-elec-scale-if-close! ((this elec-gate) (arg0 float)) "If [[target]]'s position is within `80` [[meters]], set the scale to the value provided -@see [[elec-gate::29]]" + @see [[elec-gate::29]]" ;; og:preserve-this changed for PC port so we can render it at any distance (if (#if PC_PORT (or (not (-> *pc-settings* ps2-lod-dist?)) (< (vector-vector-distance (-> this root trans) (target-pos 0)) (meters 80))) (< (vector-vector-distance (-> this root trans) (target-pos 0)) (meters 80))) @@ -714,10 +650,10 @@ (defmethod spawn-particles ((this elec-gate) (sparticle-lc sparticle-launch-control)) "TODO - Calls [[sparticle-launch-control::11]] on `part-spawner-left` and `part-spawner-right` if they are defined" (if (-> this part-spawner-left) - (spawn sparticle-lc (the-as vector (&-> (-> this part-spawner-left child) 8))) + (spawn sparticle-lc (the-as vector (&-> this part-spawner-left child 8))) ) (if (-> this part-spawner-right) - (spawn sparticle-lc (the-as vector (&-> (-> this part-spawner-right child) 8))) + (spawn sparticle-lc (the-as vector (&-> this part-spawner-right child 8))) ) 0 (none) @@ -775,7 +711,7 @@ (defmethod set-state! ((this elec-gate)) "If either [[actor-option::17]] is set on the [[elec-gate]] or the related subtask is completed make the gate `idle`. - + Otherwise, the gate will be `active`." (if (or (logtest? (actor-option user17) (-> this fact options)) (and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status subtask-complete))) @@ -830,10 +766,10 @@ (vector-cross! v1-28 v1-28 *up-vector*) (set! (-> this dividing-wall pos quad) (-> s5-3 quad)) (set! (-> this dividing-wall dir quad) (-> v1-28 quad)) - (vector+float*! (the-as vector (-> this plane)) s5-3 v1-28 12288.0) + (vector+float*! (-> this plane 0 pos) s5-3 v1-28 12288.0) (set! (-> (the-as vector (-> this plane 0 dir)) quad) (-> v1-28 quad)) (vector-float*! v1-28 v1-28 -1.0) - (vector+float*! (the-as vector (-> this plane 1)) s5-3 v1-28 12288.0) + (vector+float*! (-> this plane 1 pos) s5-3 v1-28 12288.0) (set! (-> (the-as vector (-> this plane 1 dir)) quad) (-> v1-28 quad)) ) (set! (-> this wall-xz) diff --git a/goal_src/jak2/levels/common/enemy/centurion.gc b/goal_src/jak2/levels/common/enemy/centurion.gc index 1a4a39f36c..ef0401c007 100644 --- a/goal_src/jak2/levels/common/enemy/centurion.gc +++ b/goal_src/jak2/levels/common/enemy/centurion.gc @@ -516,7 +516,6 @@ ) (defmethod centurion-method-181 ((this centurion) (arg0 vector)) - (local-vars (sv-224 vector) (sv-240 vector) (sv-256 vector)) (if (not (-> this joint-enable)) (return (the-as int #f)) ) @@ -539,21 +538,8 @@ (new 'stack-no-clear 'vector) (new 'stack-no-clear 'vector) (let ((s2-2 (new 'stack-no-clear 'vector))) - (let ((s0-1 vector-rotate-around-y!)) - (set! sv-224 s4-1) - (set! sv-240 s1-0) - (let ((a2-1 (- (vector-y-angle s1-0)))) - (s0-1 sv-224 sv-240 a2-1) - ) - ) - (let ((s1-1 vector-rotate-around-y!) - (s0-2 s2-2) - ) - (set! sv-256 s3-0) - (let ((a2-2 (- (vector-y-angle s3-0)))) - (s1-1 s0-2 sv-256 a2-2) - ) - ) + (vector-rotate-around-y! s4-1 s1-0 (- (vector-y-angle s1-0))) + (vector-rotate-around-y! s2-2 s3-0 (- (vector-y-angle s3-0))) (let ((f0-9 (deg-diff (atan (-> s4-1 y) (-> s4-1 z)) (atan (-> s2-2 y) (-> s2-2 z))))) (set-vector! s4-1 f0-9 f30-0 0.0 1.0) ) @@ -1037,7 +1023,6 @@ ) (defmethod centurion-method-182 ((this centurion) (arg0 vector)) - (local-vars (sv-96 int) (sv-112 int)) (when (nonzero? (-> this path)) (let ((s5-0 (-> this path)) (s4-0 (new 'stack-no-clear 'vector)) @@ -1047,27 +1032,29 @@ (s0-0 (new 'stack-no-clear 'vector)) ) (set! (-> s0-0 quad) (-> arg0 quad)) - (set! sv-96 0) - (let ((gp-0 0)) - (set! (-> s0-0 y) 0.0) - (set! sv-112 0) - (while (< sv-112 4) - (get-point-in-path! s5-0 s3-0 (the float sv-112) 'interp) - (get-point-in-path! s5-0 s2-0 (the float (+ sv-112 1)) 'interp) - (vector-! s1-0 s0-0 s3-0) - (vector-! s4-0 s2-0 s3-0) - (set! (-> s4-0 y) 0.0) - (vector-rotate90-around-y! s4-0 s4-0) - (cond - ((>= (vector-dot s1-0 s4-0) 0.0) - (+! gp-0 1) - ) - (else - (set! sv-96 (+ sv-96 1)) - sv-96 - ) + (let ((sv-96 0) + (gp-0 0) + ) + (set! (-> s0-0 y) 0.0) + (let ((sv-112 0)) + (while (< sv-112 4) + (get-point-in-path! s5-0 s3-0 (the float sv-112) 'interp) + (get-point-in-path! s5-0 s2-0 (the float (+ sv-112 1)) 'interp) + (vector-! s1-0 s0-0 s3-0) + (vector-! s4-0 s2-0 s3-0) + (set! (-> s4-0 y) 0.0) + (vector-rotate90-around-y! s4-0 s4-0) + (cond + ((>= (vector-dot s1-0 s4-0) 0.0) + (+! gp-0 1) + ) + (else + (+! sv-96 1) + sv-96 + ) + ) + (+! sv-112 1) ) - (set! sv-112 (+ sv-112 1)) ) (if (or (= sv-96 4) (= gp-0 4)) (return #t) diff --git a/goal_src/jak2/levels/common/enemy/fodder/fodder.gc b/goal_src/jak2/levels/common/enemy/fodder/fodder.gc index 65d3a8e7aa..25897fb373 100644 --- a/goal_src/jak2/levels/common/enemy/fodder/fodder.gc +++ b/goal_src/jak2/levels/common/enemy/fodder/fodder.gc @@ -201,7 +201,7 @@ (defmethod look-at-target! ((this fodder) (arg0 enemy-flag)) "Logic for looking at the target that is locked on, sets some flags and adjusts the neck to look at the target if available -@param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" + @param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" (let ((parent-method (method-of-type nav-enemy look-at-target!))) (parent-method this arg0) ) @@ -232,8 +232,8 @@ (defmethod look-at-position! ((this fodder) (position vector)) "Adjusts the eyes to look at particular position, or the focused target -@param position If this is provided, it will be used with [[joint-mod::target-set!]] to adjust the eyes, otherwise the `focus` position is used -@return TODO - unsure what the return value is, but it seems to make the eyes more lazy" + @param position If this is provided, it will be used with [[joint-mod::target-set!]] to adjust the eyes, otherwise the `focus` position is used + @return TODO - unsure what the return value is, but it seems to make the eyes more lazy" (when (not position) (let ((focus-proc (handle->process (-> this focus handle)))) (if focus-proc @@ -264,12 +264,7 @@ (dotimes (group-idx (-> this actor-group-count)) (let ((group (-> this actor-group group-idx))) (dotimes (actor-idx (-> group length)) - (let* ((actor-proc (-> group data actor-idx actor extra process)) - (fodder-proc (if (type? actor-proc fodder) - (the-as fodder actor-proc) - ) - ) - ) + (let ((fodder-proc (as-type (-> group data actor-idx actor extra process) fodder))) (when (and fodder-proc (!= fodder-proc this) (time-elapsed? (-> fodder-proc look-at-other-time) (seconds 0.25))) (let* ((dir-to-other-fodder (vector-! (new 'stack-no-clear 'vector) (-> fodder-proc root trans) (-> this root trans)) @@ -317,24 +312,16 @@ ;; WARN: Return type mismatch object vs none. (defmethod common-post ((this fodder)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" (let ((parent-method (method-of-type nav-enemy common-post))) (parent-method this) ) (let ((proc (the-as process-drawable #f))) (cond ((and (not (time-elapsed? (-> this look-at-other-time) (seconds 0.5))) - (begin - (let ((other-proc (handle->process (-> this look-at-other)))) - (set! proc (if (type? other-proc process-drawable) - (the-as process-drawable other-proc) - ) - ) - ) - proc - ) + (begin (set! proc (as-type (handle->process (-> this look-at-other)) process-drawable)) proc) ) (let ((s5-1 (vector<-cspace! (new 'static 'vector) (-> proc node-list data 5)))) (look-at-position! this s5-1) @@ -496,7 +483,7 @@ (if s4-0 (set! v1-59 (- v1-59)) ) - (vector+float*! gp-0 (-> s3-2 vector 2) (the-as vector (-> s3-2 vector)) v1-59) + (vector+float*! gp-0 (-> s3-2 vector 2) (-> s3-2 vector 0) v1-59) ) (vector-normalize! gp-0 16384.0) (vector+float*! gp-0 gp-0 (-> s3-2 vector 1) (rand-vu-float-range 5079.04 7168.0)) @@ -609,32 +596,30 @@ (when a0-2 (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable a0-2) 0) quad)) (let ((f30-0 (vector-vector-xz-distance-squared (-> self focus-pos) (-> self root trans)))) - (let ((f0-0 24576.0)) - (when (and (< f30-0 (* f0-0 f0-0)) (zero? (-> self slow-timer))) - (let ((v1-20 (-> self nav))) - (set! (-> v1-20 target-speed) 0.0) + (when (and (< f30-0 (square 24576.0)) (zero? (-> self slow-timer))) + (let ((v1-20 (-> self nav))) + (set! (-> v1-20 target-speed) 0.0) + ) + 0 + (let ((v1-22 (-> self nav))) + (set! (-> v1-22 turning-acceleration) 0.0) + ) + 0 + (set-time! (-> self slow-timer)) + (ja-channel-push! 1 (seconds 0.08)) + (ja :group! (-> self draw art-group data (-> self enemy-info idle-anim))) + (ja :num-func num-func-identity :frame-num 0.0) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self focus-status) (focus-status dangerous)) ) - 0 - (let ((v1-22 (-> self nav))) - (set! (-> v1-22 turning-acceleration) 0.0) - ) - 0 - (set-time! (-> self slow-timer)) - (ja-channel-push! 1 (seconds 0.08)) - (ja :group! (-> self draw art-group data (-> self enemy-info idle-anim))) - (ja :num-func num-func-identity :frame-num 0.0) - (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) - (logior! (-> self focus-status) (focus-status dangerous)) - (logclear! (-> self focus-status) (focus-status dangerous)) + (let* ((v1-40 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-41 (the-as number (logior #x3f800000 v1-40))) + ) + (if (< (+ -1.0 (the-as float v1-41)) 0.5) + (set! (-> self attack-type) (the-as uint 1)) + (set! (-> self attack-type) (the-as uint 2)) ) - (let* ((v1-40 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-41 (the-as number (logior #x3f800000 v1-40))) - ) - (if (< (+ -1.0 (the-as float v1-41)) 0.5) - (set! (-> self attack-type) (the-as uint 1)) - (set! (-> self attack-type) (the-as uint 2)) - ) - ) ) ) (when (and (nonzero? (-> self slow-timer)) @@ -740,20 +725,18 @@ ) ) (when (zero? (-> self attack-type)) - (let ((f0-20 20480.0)) - (when (and (< f30-0 (* f0-20 f0-20)) (time-elapsed? (-> self look-at-other-time) (seconds 0.125))) - (let ((v1-117 (ja-channel-float! (the-as art-joint-anim fodder-snap-ja) 0.0 0.0 0.0))) - (when v1-117 - (set! (-> self skel interp-select 0) #xe00010) - (set! (-> self skel interp-select 1) 0) - (set! (-> v1-117 param 0) 1.0) - (set! (-> v1-117 param 1) 1.0) - (set! (-> v1-117 param 2) 1.0) - (set! (-> v1-117 num-func) num-func-interp1-play!) - ) + (when (and (< f30-0 (square 20480.0)) (time-elapsed? (-> self look-at-other-time) (seconds 0.125))) + (let ((v1-117 (ja-channel-float! (the-as art-joint-anim fodder-snap-ja) 0.0 0.0 0.0))) + (when v1-117 + (set! (-> self skel interp-select 0) #xe00010) + (set! (-> self skel interp-select 1) 0) + (set! (-> v1-117 param 0) 1.0) + (set! (-> v1-117 param 1) 1.0) + (set! (-> v1-117 param 2) 1.0) + (set! (-> v1-117 num-func) num-func-interp1-play!) ) - (set-time! (-> self look-at-other-time)) ) + (set-time! (-> self look-at-other-time)) ) ) ) @@ -1026,14 +1009,14 @@ (none) ) -(defmethod relocate ((this fodder) (arg0 int)) +(defmethod relocate ((this fodder) (offset int)) (if (nonzero? (-> this left-eye)) - (&+! (-> this left-eye) arg0) + (&+! (-> this left-eye) offset) ) (if (nonzero? (-> this right-eye)) - (&+! (-> this right-eye) arg0) + (&+! (-> this right-eye) offset) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defun fodder-setup-eye-control ((arg0 joint-mod)) diff --git a/goal_src/jak2/levels/common/enemy/grunt.gc b/goal_src/jak2/levels/common/enemy/grunt.gc index 50c785cc14..e5e185b2e2 100644 --- a/goal_src/jak2/levels/common/enemy/grunt.gc +++ b/goal_src/jak2/levels/common/enemy/grunt.gc @@ -358,11 +358,7 @@ ) ) (zero? (rnd-int-count this 3)) - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-0 32768.0) - ) - (>= f0-0 (* f1-0 f1-0)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (kill-prefer-falling this) ) @@ -415,12 +411,7 @@ ) ) ) - (let* ((gp-1 *target*) - (a0-4 (if (type? gp-1 process-focusable) - gp-1 - ) - ) - ) + (let ((a0-4 (the-as target (as-type *target* process-focusable)))) (when a0-4 (let* ((gp-2 (-> self root)) (s3-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (get-trans a0-4 0) (-> gp-2 trans)) 1.0)) @@ -450,7 +441,8 @@ ) ) :code (behavior () - (suspend-for (seconds 0.2)) + (suspend-for (seconds 0.2) + ) (let ((v1-6 (-> self root root-prim))) (set! (-> v1-6 prim-core collide-as) (-> self root backup-collide-as)) (set! (-> v1-6 prim-core collide-with) (-> self root backup-collide-with)) @@ -688,23 +680,18 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-5 vf1) - (let* ((f30-0 v1-5) - (f0-0 arg0) - (f28-0 (* f0-0 f0-0)) - (f0-2 12288.0) - ) - (when (or (>= (* f0-2 f0-2) f30-0) (>= f28-0 f30-0)) + (let ((f30-0 v1-5) + (f28-0 (square arg0)) + ) + (when (or (>= (square 12288.0) f30-0) (>= f28-0 f30-0)) (let ((f26-0 (quaternion-y-angle (-> this root quat))) (f0-7 (atan (-> s4-0 x) (-> s4-0 z))) - (f1-0 1228.8) ) (cond - ((and (< (* f1-0 f1-0) f30-0) (>= f28-0 f30-0) (>= 8192.0 (fabs (deg- f26-0 f0-7)))) + ((and (< (square 1228.8) f30-0) (>= f28-0 f30-0) (>= 8192.0 (fabs (deg- f26-0 f0-7)))) (go (method-of-object this attack)) ) - ((let ((f0-10 12288.0)) - (< f30-0 (* f0-10 f0-10)) - ) + ((< f30-0 (square 12288.0)) (go (method-of-object this spin-attack)) ) ) @@ -732,10 +719,7 @@ (when (and (>= gp-0 (-> self next-warn-time)) (not (logtest? (-> self draw status) (draw-control-status on-screen))) ) - (when (and a0-1 (let ((f0-0 65536.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (get-trans a0-1 0) (-> self root trans))) - ) - ) + (when (and a0-1 (>= (square 65536.0) (vector-vector-xz-distance-squared (get-trans a0-1 0) (-> self root trans)))) (sound-play "grunt-warn") (set! (-> self next-warn-time) (+ gp-0 (rnd-int-range self 300 360))) ) diff --git a/goal_src/jak2/levels/common/enemy/guards/crimson-guard-level.gc b/goal_src/jak2/levels/common/enemy/guards/crimson-guard-level.gc index 4989fc1ccd..cc45c934a3 100644 --- a/goal_src/jak2/levels/common/enemy/guards/crimson-guard-level.gc +++ b/goal_src/jak2/levels/common/enemy/guards/crimson-guard-level.gc @@ -1314,14 +1314,6 @@ ) (defmethod crimson-guard-level-method-196 ((this crimson-guard-level) (arg0 vector)) - (local-vars - (sv-240 vector) - (sv-256 (function vector vector vector)) - (sv-272 vector) - (sv-288 vector) - (sv-304 vector) - (sv-320 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1330,8 +1322,9 @@ (vf7 :class vf) ) (init-vf0-vector) - (set! sv-240 arg0) - (let ((s0-0 (new 'stack-no-clear 'vector))) + (let ((sv-240 arg0) + (s0-0 (new 'stack-no-clear 'vector)) + ) (let ((v1-1 (-> this root trans))) (let ((a0-1 *y-vector*)) (let ((a1-2 8192.0)) @@ -1345,9 +1338,9 @@ (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) (.svf (&-> s0-0 quad) vf6) - (set! sv-320 (new 'stack-no-clear 'vector)) - (set! sv-304 (new 'stack-no-clear 'vector)) - (let ((s1-0 (new 'stack-no-clear 'vector)) + (let ((sv-320 (new 'stack-no-clear 'vector)) + (sv-304 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack-no-clear 'vector)) (s5-0 (new 'stack-no-clear 'vector)) ) @@ -1409,18 +1402,15 @@ (.svf (&-> a1-8 quad) vf6) ) (vector-normalize! (vector-! sv-320 sv-240 s0-0) 1.0) - (set! sv-288 (new 'stack-no-clear 'vector)) - (let ((v1-20 (-> sv-240 quad))) - (set! (-> sv-288 quad) v1-20) + (let ((sv-288 (new 'stack-no-clear 'vector))) + (set! (-> sv-288 quad) (-> sv-240 quad)) + (vector+! sv-288 sv-288 (vector-rotate90-around-y! + (new 'stack-no-clear 'vector) + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) sv-288 s0-0) -2998.272) + ) + ) + (vector-normalize! (vector-! sv-320 sv-288 s0-0) 1.0) ) - (set! sv-256 vector-rotate90-around-y!) - (set! sv-272 (new 'stack-no-clear 'vector)) - (let* ((a1-13 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) sv-288 s0-0) -2998.272)) - (v0-5 (sv-256 sv-272 a1-13)) - ) - (vector+! sv-288 sv-288 v0-5) - ) - (vector-normalize! (vector-! sv-320 sv-288 s0-0) 1.0) (vector-z-quaternion! sv-304 (-> this root quat)) (rot-zxy-from-vector! s2-0 sv-304) (rot-zxy-from-vector! s1-0 sv-320) @@ -2160,7 +2150,6 @@ ) (defmethod crimson-guard-level-method-199 ((this crimson-guard-level) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float)) - (local-vars (sv-672 vector) (sv-688 vector) (sv-704 vector) (sv-720 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -2210,29 +2199,31 @@ (let ((f0-5 (probe-using-line-sphere *collide-cache* s1-0))) (cond ((>= f0-5 0.0) - (set! sv-672 (new 'stack-no-clear 'vector)) - (let ((v1-16 (-> s1-0 start-pos))) - (let ((a0-20 (-> s1-0 move-dist))) - (let ((a1-4 f0-5)) - (.mov vf7 a1-4) + (let ((sv-672 (new 'stack-no-clear 'vector))) + (let ((v1-16 (-> s1-0 start-pos))) + (let ((a0-20 (-> s1-0 move-dist))) + (let ((a1-4 f0-5)) + (.mov vf7 a1-4) + ) + (.lvf vf5 (&-> a0-20 quad)) ) - (.lvf vf5 (&-> a0-20 quad)) + (.lvf vf4 (&-> v1-16 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> sv-672 quad) vf6) + (let ((sv-688 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 quad) (-> sv-672 quad)) + (+! (-> sv-672 x) (rand-vu-float-range -819.2 819.2)) + (+! (-> sv-672 y) (rand-vu-float-range -819.2 819.2)) + (+! (-> sv-672 z) (rand-vu-float-range -819.2 819.2)) + (set-point! (-> this l-control) (-> this l-control state points-to-draw) sv-672) + (+! (-> this l-control state points-to-draw) 1) + (quaternion-from-two-vectors! (the-as quaternion sv-688) s2-0 (-> s1-0 best-other-tri normal)) + (vector-orient-by-quat! s3-0 s3-0 (the-as quaternion sv-688)) ) - (.lvf vf4 (&-> v1-16 quad)) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> sv-672 quad) vf6) - (set! sv-688 (new 'stack-no-clear 'vector)) - (set! (-> s4-0 quad) (-> sv-672 quad)) - (+! (-> sv-672 x) (rand-vu-float-range -819.2 819.2)) - (+! (-> sv-672 y) (rand-vu-float-range -819.2 819.2)) - (+! (-> sv-672 z) (rand-vu-float-range -819.2 819.2)) - (set-point! (-> this l-control) (-> this l-control state points-to-draw) sv-672) - (+! (-> this l-control state points-to-draw) 1) - (quaternion-from-two-vectors! (the-as quaternion sv-688) s2-0 (-> s1-0 best-other-tri normal)) - (vector-orient-by-quat! s3-0 s3-0 (the-as quaternion sv-688)) (set! (-> s2-0 quad) (-> s1-0 best-other-tri normal quad)) (vector-flatten! s3-0 s3-0 (-> s1-0 best-other-tri normal)) ) @@ -2258,44 +2249,46 @@ (let ((f0-14 (probe-using-line-sphere *collide-cache* s1-0))) (cond ((>= f0-14 0.0) - (set! sv-704 (new 'stack-no-clear 'vector)) - (let ((v1-37 (-> s1-0 start-pos))) - (let ((a0-38 (-> s1-0 move-dist))) - (let ((a1-17 f0-14)) - (.mov vf7 a1-17) - ) - (.lvf vf5 (&-> a0-38 quad)) - ) - (.lvf vf4 (&-> v1-37 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> sv-704 quad) vf6) - (set! sv-720 (new 'stack-no-clear 'vector)) - (let ((a1-18 sv-704)) - (let ((v1-40 sv-704)) - (let ((a0-39 s2-0)) - (let ((a2-9 2048.0)) - (.mov vf7 a2-9) + (let ((sv-704 (new 'stack-no-clear 'vector))) + (let ((v1-37 (-> s1-0 start-pos))) + (let ((a0-38 (-> s1-0 move-dist))) + (let ((a1-17 f0-14)) + (.mov vf7 a1-17) ) - (.lvf vf5 (&-> a0-39 quad)) + (.lvf vf5 (&-> a0-38 quad)) ) - (.lvf vf4 (&-> v1-40 quad)) + (.lvf vf4 (&-> v1-37 quad)) ) (.add.x.vf.w vf6 vf0 vf0) (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-18 quad) vf6) + (.svf (&-> sv-704 quad) vf6) + (let ((sv-720 (new 'stack-no-clear 'vector))) + (let ((a1-18 sv-704)) + (let ((v1-40 sv-704)) + (let ((a0-39 s2-0)) + (let ((a2-9 2048.0)) + (.mov vf7 a2-9) + ) + (.lvf vf5 (&-> a0-39 quad)) + ) + (.lvf vf4 (&-> v1-40 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-18 quad) vf6) + ) + (set! (-> s4-0 quad) (-> sv-704 quad)) + (+! (-> sv-704 x) (rand-vu-float-range -819.2 819.2)) + (+! (-> sv-704 y) (rand-vu-float-range -819.2 819.2)) + (+! (-> sv-704 z) (rand-vu-float-range -819.2 819.2)) + (set-point! (-> this l-control) (-> this l-control state points-to-draw) sv-704) + (+! (-> this l-control state points-to-draw) 1) + (quaternion-from-two-vectors! (the-as quaternion sv-720) s2-0 (-> s1-0 best-other-tri normal)) + (vector-orient-by-quat! s3-0 s3-0 (the-as quaternion sv-720)) + ) ) - (set! (-> s4-0 quad) (-> sv-704 quad)) - (+! (-> sv-704 x) (rand-vu-float-range -819.2 819.2)) - (+! (-> sv-704 y) (rand-vu-float-range -819.2 819.2)) - (+! (-> sv-704 z) (rand-vu-float-range -819.2 819.2)) - (set-point! (-> this l-control) (-> this l-control state points-to-draw) sv-704) - (+! (-> this l-control state points-to-draw) 1) - (quaternion-from-two-vectors! (the-as quaternion sv-720) s2-0 (-> s1-0 best-other-tri normal)) - (vector-orient-by-quat! s3-0 s3-0 (the-as quaternion sv-720)) (set! (-> s2-0 quad) (-> s1-0 best-other-tri normal quad)) (vector-flatten! s3-0 s3-0 (-> s1-0 best-other-tri normal)) ) @@ -2322,7 +2315,6 @@ ;; WARN: Return type mismatch object vs none. (defmethod crimson-guard-level-method-198 ((this crimson-guard-level)) - (local-vars (sv-784 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -2385,15 +2377,14 @@ (vector+! s5-0 s4-0 s1-0) (point-in-plane-<-point+normal! s2-1 s5-0 (-> s3-0 best-other-tri normal)) (vector-! s2-1 s2-1 s5-0) - (let ((s1-1 quaternion-vector-angle!) - (s0-0 (new 'stack-no-clear 'quaternion)) + (let ((a2-4 (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (-> s3-0 best-other-tri normal) + (rand-vu-float-range 0.0 65536.0) + ) + ) ) - (set! sv-784 (-> s3-0 best-other-tri normal)) - (let* ((a2-3 (rand-vu-float-range 0.0 65536.0)) - (a2-4 (s1-1 s0-0 sv-784 a2-3)) - ) - (vector-orient-by-quat! s2-1 s2-1 a2-4) - ) + (vector-orient-by-quat! s2-1 s2-1 a2-4) ) (part-tracker-spawn :to this :group part-crimson-lightning-glow :mat-joint s4-0) (part-tracker-spawn :to this :group part-crimson-lightning-glow :mat-joint s5-0) @@ -3568,14 +3559,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defmethod crimson-guard-level-method-202 ((this crimson-guard-level) (arg0 vector)) - (local-vars - (f0-8 float) - (sv-768 vector) - (sv-784 vector) - (sv-800 nav-control) - (sv-816 nav-poly) - (sv-832 vector) - ) + (local-vars (f0-8 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -3590,8 +3574,8 @@ (dotimes (s3-0 2) (vector-normalize! s4-0 (* 4096.0 (+ 4.0 (* 2.0 (the float s3-0))))) (dotimes (s2-0 6) - (set! sv-768 (new 'stack-no-clear 'vector)) - (let ((s1-0 (new 'stack-no-clear 'vector)) + (let ((sv-768 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) (s0-0 (new 'stack 'collide-query)) ) (vector-rotate-around-y! sv-768 s4-0 (* 182.04445 (the float (+ (* 23 s2-0) -70)))) @@ -3620,60 +3604,53 @@ (vector-! (-> a1-7 point) a0-8 (-> v1-14 state mesh bounds)) (set! (-> a1-7 y-threshold) (-> v1-14 nearest-y-threshold)) (set! (-> a1-7 ignore) (the-as uint 2)) - (set! sv-816 (find-poly-containing-point-local (-> v1-14 state mesh) a1-7)) - ) - (when sv-816 - (let* ((v1-18 s4-0) - (f0-7 (-> sv-768 x)) - (f1-4 (-> sv-768 y)) - (f2-2 (-> sv-768 z)) - (f3-2 (-> v1-18 x)) - (f4-0 (-> v1-18 y)) - (f5-0 (-> v1-18 z)) - ) - ;; og:preserve-this inlined vector-dot - ;; (.mula.s f0-7 f3-2) - ;; (.madda.s f1-4 f4-0) - ;; (.madd.s f0-8 f2-2 f5-0) - (set! f0-8 (+ (* f0-7 f3-2) (* f1-4 f4-0) (* f2-2 f5-0))) - ) - (let ((f28-0 f0-8)) - #t - (new 'stack-no-clear 'vector) - (let ((a1-8 (new 'stack-no-clear 'vector))) - (set! (-> a1-8 quad) (-> s1-0 quad)) - (set! (-> a1-8 w) 8192.0) - (when (not (add-root-sphere-to-hash! (-> this nav) a1-8 32)) - (when (< f30-0 f28-0) - (set! f30-0 f28-0) - (set! sv-784 (new 'stack-no-clear 'vector)) - (let ((a3-3 (new 'stack-no-clear 'vector))) - (set! sv-800 (-> this nav)) - (set! sv-832 sv-784) - (let* ((v1-30 s1-0) - (a0-18 (-> sv-800 state mesh)) - (t9-7 (method-of-object a0-18 project-point-onto-plane-of-poly-local)) - (a2-7 sv-832) - (t0-2 (vector-! (new 'stack-no-clear 'vector) v1-30 (-> sv-800 state mesh bounds))) - ) - (t9-7 a0-18 sv-816 a2-7 a3-3 t0-2) + (let ((sv-816 (find-poly-containing-point-local (-> v1-14 state mesh) a1-7))) + (when sv-816 + (let* ((v1-18 s4-0)) + (set! f0-8 (vector-dot sv-768 v1-18)) + ) + (let ((f28-0 f0-8)) + #t + (new 'stack-no-clear 'vector) + (let ((a1-8 (new 'stack-no-clear 'vector))) + (set! (-> a1-8 quad) (-> s1-0 quad)) + (set! (-> a1-8 w) 8192.0) + (when (not (add-root-sphere-to-hash! (-> this nav) a1-8 32)) + (when (< f30-0 f28-0) + (set! f30-0 f28-0) + (let ((sv-784 (new 'stack-no-clear 'vector))) + (let ((a3-3 (new 'stack-no-clear 'vector)) + (sv-800 (-> this nav)) + (sv-832 sv-784) + ) + (let ((v1-30 s1-0)) + (project-point-onto-plane-of-poly-local + (-> sv-800 state mesh) + sv-816 + sv-832 + a3-3 + (vector-! (new 'stack-no-clear 'vector) v1-30 (-> sv-800 state mesh bounds)) + ) + ) + (let ((v1-31 sv-832)) + (let ((a0-21 (-> sv-800 state mesh bounds))) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-832 quad)) + (.lvf vf5 (&-> a0-21 quad)) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-31 quad) vf6) + ) + ) + 0 + (set! (-> s1-0 y) (-> sv-784 y)) + ) + (if (enemy-above-ground? this s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (set! (-> s1-0 y) (-> s0-0 best-other-tri intersect y)) + ) + (set! (-> arg0 quad) (-> s1-0 quad)) ) ) - (let ((v1-31 sv-832)) - (let ((a0-21 (-> sv-800 state mesh bounds))) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-832 quad)) - (.lvf vf5 (&-> a0-21 quad)) - ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-31 quad) vf6) - ) - 0 - (set! (-> s1-0 y) (-> sv-784 y)) - (if (enemy-above-ground? this s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) - (set! (-> s1-0 y) (-> s0-0 best-other-tri intersect y)) - ) - (set! (-> arg0 quad) (-> s1-0 quad)) ) ) ) @@ -4034,14 +4011,14 @@ (defmethod init-enemy! ((this crimson-guard-level)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (local-vars (sv-16 int)) (let ((f0-0 (res-lump-float (-> this entity) 'rotoffset))) (if (!= f0-0 0.0) (quaternion-rotate-y! (-> this root quat) (-> this root quat) f0-0) ) ) - (set! sv-16 0) - (let ((v1-6 (res-lump-data (-> this entity) 'trans-offset vector :tag-ptr (the-as (pointer res-tag) (& sv-16))))) + (let* ((sv-16 0) + (v1-6 (res-lump-data (-> this entity) 'trans-offset vector :tag-ptr (the-as (pointer res-tag) (& sv-16)))) + ) (when v1-6 (+! (-> this root trans x) (-> v1-6 x)) (+! (-> this root trans y) (-> v1-6 y)) diff --git a/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc b/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc index 70d917e82a..7c656cdfcc 100644 --- a/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc +++ b/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc @@ -355,12 +355,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this guard-conversation) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" - (local-vars (sv-16 res-tag)) + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (set! (-> this triggered?) #f) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) @@ -381,8 +380,9 @@ This commonly includes things such as: (set! (-> this skip-mask) (the-as uint (lognot v1-2))) ) (let ((s5-1 (and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status bit-12))))) - (set! sv-16 (new 'static 'res-tag)) - (let ((s4-0 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s4-0 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (if (or (not s4-0) (zero? (-> sv-16 elt-count))) (go process-drawable-art-error "missing actors") ) diff --git a/goal_src/jak2/levels/common/enemy/hopper.gc b/goal_src/jak2/levels/common/enemy/hopper.gc index 9ebd2e90df..d25a136e52 100644 --- a/goal_src/jak2/levels/common/enemy/hopper.gc +++ b/goal_src/jak2/levels/common/enemy/hopper.gc @@ -478,7 +478,6 @@ ) (defmethod hopper-method-178 ((this hopper)) - (local-vars (sv-752 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -530,28 +529,29 @@ (when (not (add-root-sphere-to-hash! (-> this nav) a1-3 #x8006c)) (when (< (-> this best-score) f30-0) (set! (-> this best-score) f30-0) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (set! sv-752 (new 'stack-no-clear 'vector)) - (let ((s3-1 (new 'stack 'collide-query))) - (let ((s0-0 (-> this nav)) - (s1-0 s2-0) - ) - (let* ((v1-21 s5-0) - (a0-10 (-> s0-0 state mesh)) - (t9-4 (method-of-object a0-10 project-point-onto-plane-of-poly-local)) - (a2-5 s1-0) - (t0-1 (vector-! (new 'stack-no-clear 'vector) v1-21 (-> s0-0 state mesh bounds))) - ) - (t9-4 a0-10 s4-0 a2-5 sv-752 t0-1) - ) - (vector+! s1-0 s1-0 (-> s0-0 state mesh bounds)) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (sv-752 (new 'stack-no-clear 'vector)) + (s3-1 (new 'stack 'collide-query)) ) - 0 - (set! (-> s5-0 y) (-> s2-0 y)) - (if (enemy-above-ground? this s3-1 s5-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) - (set! (-> s5-0 y) (-> s3-1 best-other-tri intersect y)) + (let ((s0-0 (-> this nav)) + (s1-0 s2-0) ) + (let ((v1-21 s5-0)) + (project-point-onto-plane-of-poly-local + (-> s0-0 state mesh) + s4-0 + s1-0 + sv-752 + (vector-! (new 'stack-no-clear 'vector) v1-21 (-> s0-0 state mesh bounds)) + ) + ) + (vector+! s1-0 s1-0 (-> s0-0 state mesh bounds)) ) + 0 + (set! (-> s5-0 y) (-> s2-0 y)) + (if (enemy-above-ground? this s3-1 s5-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (set! (-> s5-0 y) (-> s3-1 best-other-tri intersect y)) + ) ) (set! (-> this best-point quad) (-> s5-0 quad)) ) @@ -660,6 +660,8 @@ ) (set! (-> self best-score) -2.0) (set! (-> self origin quad) (-> self root trans quad)) + ;; og:preserve-this + ; (b! #t cfg-17) (until (not (hopper-method-178 self)) (empty) ) diff --git a/goal_src/jak2/levels/common/enemy/hover/crimson-guard-hover.gc b/goal_src/jak2/levels/common/enemy/hover/crimson-guard-hover.gc index c457c9b1c0..2ba6dcef38 100644 --- a/goal_src/jak2/levels/common/enemy/hover/crimson-guard-hover.gc +++ b/goal_src/jak2/levels/common/enemy/hover/crimson-guard-hover.gc @@ -675,13 +675,9 @@ :enter (behavior () (set-time! (-> self state-time)) (set! (-> self attack-miss-dist-curr) (-> self attack-miss-dist-min)) - (let ((f0-1 (vector-vector-distance-squared (-> self root trans) (-> self focus-pos))) - (f1-0 122880.0) - ) - (if (< f0-1 (* f1-0 f1-0)) - (speech-control-method-12 *speech-control* self (speech-type speech-type-9)) - ) - ) + (if (< (vector-vector-distance-squared (-> self root trans) (-> self focus-pos)) (square 122880.0)) + (speech-control-method-12 *speech-control* self (speech-type speech-type-9)) + ) (set! (-> self shots-fired) 0) 0 ) @@ -858,13 +854,9 @@ ) :code (behavior () (sound-play "hover-warn") - (let ((f0-0 (vector-vector-distance-squared (-> self root trans) (-> self focus-pos))) - (f1-0 122880.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (speech-control-method-12 *speech-control* self (speech-type speech-type-9)) - ) - ) + (if (< (vector-vector-distance-squared (-> self root trans) (-> self focus-pos)) (square 122880.0)) + (speech-control-method-12 *speech-control* self (speech-type speech-type-9)) + ) (ja-channel-push! 1 (seconds 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self hover-info shoot-anim)) :num! (seek!) @@ -1045,11 +1037,9 @@ ) (when (> (-> this hit-points) 0) (let ((v1-23 (the-as process (as-type (handle->process (-> this incoming attacker-handle)) process-focusable)))) - (if (and *target* v1-23 (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (-> this focus-pos))) - (f1-0 122880.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (if (and *target* + v1-23 + (< (vector-vector-distance-squared (-> this root trans) (-> this focus-pos)) (square 122880.0)) ) (speech-control-method-12 *speech-control* this (speech-type speech-type-11)) ) @@ -1064,11 +1054,7 @@ (when (= (the-as symbol a0-27) 'attack) (when (logtest? (-> (the-as process-focusable v1-31) mask) (process-mask target)) (if (and (focus-test? (the-as process-focusable v1-31) dead) - (let ((f0-1 (vector-vector-distance-squared (-> this root trans) (-> this focus-pos))) - (f1-3 122880.0) - ) - (< f0-1 (* f1-3 f1-3)) - ) + (< (vector-vector-distance-squared (-> this root trans) (-> this focus-pos)) (square 122880.0)) ) (speech-control-method-12 *speech-control* this (speech-type speech-type-10)) ) @@ -1127,7 +1113,7 @@ (set! v1-1 arg3) ) (let* ((f0-2 (- 1.0 arg1)) - (a2-2 (- 1.0 (* f0-2 f0-2 f0-2))) + (a2-2 (- 1.0 (* (square f0-2) f0-2))) (a3-7 (-> this skel root-channel arg0)) ) (let ((f0-6 (fabs a2-2))) @@ -1276,78 +1262,72 @@ (s4-0 (-> this main-joint-vel)) (gp-0 (lambda ((arg0 crimson-guard-hover) (arg1 cspace) (arg2 float) (arg3 float) (arg4 vector) (arg5 vector) (arg6 int)) - (local-vars (sv-192 float) (sv-208 quaternion) (sv-224 vector)) - (set! sv-192 arg2) - (let ((s0-0 arg3)) - (set! sv-224 arg4) - (let ((s1-0 arg5) - (s3-0 arg6) - (s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) arg1)) - (s5-0 (new 'stack-no-clear 'matrix)) - (a1-3 (matrix-with-scale->quaternion (new 'stack-no-clear 'quaternion) (-> arg1 bone transform))) - ) - (set! sv-208 (new 'stack-no-clear 'quaternion)) - (let ((s2-1 (new 'stack-no-clear 'vector))) - (-> arg0 scale) - (quaternion-rotate-local-z! sv-208 a1-3 sv-192) - (quaternion->matrix s5-0 sv-208) - (set! (-> s2-1 quad) (-> arg0 root scale quad)) - (scale-matrix! s5-0 s2-1 s5-0) - (let* ((s1-1 (vector-inv-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 (-> arg0 root quat))) - (t9-6 vector-inv-orient-by-quat!) - (a0-10 (new 'stack-no-clear 'vector)) - (a2-4 (-> arg0 root quat)) - (v0-6 (t9-6 a0-10 sv-224 a2-4)) - (f30-0 (* 2867200.0 (seconds-per-frame))) - (f28-0 - (seek - (-> arg0 thrust s3-0) - (+ (* 0.4 (fmax 0.0 (* (-> v0-6 x) s0-0))) - (fmax 0.0 (-> v0-6 y)) - (fabs (/ (-> v0-6 z) 5)) - (fmax 0.0 (-> s1-1 y)) - ) - (/ f30-0 5) - ) - ) - ) - (let ((f20-0 (lerp-scale 819.2 4096.0 f28-0 1638.4 f30-0)) - (f26-0 (lerp-scale 4915.2 11468.8 f28-0 1638.4 f30-0)) - (f22-0 (lerp-scale 0.5 1.5 f28-0 1638.4 f30-0)) - (f24-0 (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0)) - ) - (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0) - (let ((f1-10 (lerp-scale 0.02 0.6 f28-0 1638.4 f30-0)) - (f2-6 (fmin 1.0 (-> s2-1 x))) - (f0-14 (fmin 1.0 (-> s2-1 y))) + (let ((sv-192 arg2) + (s0-0 arg3) + (sv-224 arg4) + (s1-0 arg5) + (s3-0 arg6) + (s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) arg1)) + (s5-0 (new 'stack-no-clear 'matrix)) + (a1-3 (matrix-with-scale->quaternion (new 'stack-no-clear 'quaternion) (-> arg1 bone transform))) + (sv-208 (new 'stack-no-clear 'quaternion)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (-> arg0 scale) + (quaternion-rotate-local-z! sv-208 a1-3 sv-192) + (quaternion->matrix s5-0 sv-208) + (set! (-> s2-1 quad) (-> arg0 root scale quad)) + (scale-matrix! s5-0 s2-1 s5-0) + (let* ((s1-1 (vector-inv-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 (-> arg0 root quat))) + (v0-6 (vector-inv-orient-by-quat! (new 'stack-no-clear 'vector) sv-224 (-> arg0 root quat))) + (f30-0 (* 2867200.0 (seconds-per-frame))) + (f28-0 + (seek + (-> arg0 thrust s3-0) + (+ (* 0.4 (fmax 0.0 (* (-> v0-6 x) s0-0))) + (fmax 0.0 (-> v0-6 y)) + (fabs (/ (-> v0-6 z) 5)) + (fmax 0.0 (-> s1-1 y)) ) - (set! (-> *part-id-table* 718 init-specs 4 initial-valuef) (* f20-0 f2-6)) - (set! (-> *part-id-table* 718 init-specs 5 initial-valuef) (* f26-0 f0-14)) - (set! (-> *part-id-table* 722 init-specs 3 initial-valuef) (* f22-0 f2-6)) - (set! (-> *part-id-table* 719 init-specs 1 initial-valuef) (* f24-0 f0-14)) - (set! (-> *part-id-table* 720 init-specs 1 initial-valuef) (* f1-10 f0-14)) - (set! (-> *part-id-table* 721 init-specs 0 initial-valuef) (* f24-0 f0-14)) - (set! (-> arg0 thrust s3-0) f28-0) - (let ((f0-15 (* f26-0 f0-14))) - (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-0 vector 1) (/ f0-15 -2)) - ) - ) + (/ f30-0 5) + ) + ) + ) + (let ((f20-0 (lerp-scale 819.2 4096.0 f28-0 1638.4 f30-0)) + (f26-0 (lerp-scale 4915.2 11468.8 f28-0 1638.4 f30-0)) + (f22-0 (lerp-scale 0.5 1.5 f28-0 1638.4 f30-0)) + (f24-0 (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0)) ) - (set! (-> s5-0 trans quad) (-> s4-0 quad)) - (spawn-with-matrix (-> arg0 engine-part) s5-0) - (let ((f0-17 (lerp-scale 0.4 1.0 f28-0 1638.4 f30-0))) - (sound-play-by-name - (static-sound-name "hover-jets") - (-> arg0 sound-id) - (the int (* 1024.0 f0-17)) - 0 - 0 - (sound-group sfx) - #t + (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0) + (let ((f1-10 (lerp-scale 0.02 0.6 f28-0 1638.4 f30-0)) + (f2-6 (fmin 1.0 (-> s2-1 x))) + (f0-14 (fmin 1.0 (-> s2-1 y))) ) + (set! (-> *part-id-table* 718 init-specs 4 initial-valuef) (* f20-0 f2-6)) + (set! (-> *part-id-table* 718 init-specs 5 initial-valuef) (* f26-0 f0-14)) + (set! (-> *part-id-table* 722 init-specs 3 initial-valuef) (* f22-0 f2-6)) + (set! (-> *part-id-table* 719 init-specs 1 initial-valuef) (* f24-0 f0-14)) + (set! (-> *part-id-table* 720 init-specs 1 initial-valuef) (* f1-10 f0-14)) + (set! (-> *part-id-table* 721 init-specs 0 initial-valuef) (* f24-0 f0-14)) + (set! (-> arg0 thrust s3-0) f28-0) + (let ((f0-15 (* f26-0 f0-14))) + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-0 vector 1) (/ f0-15 -2)) ) ) ) + (set! (-> s5-0 trans quad) (-> s4-0 quad)) + (spawn-with-matrix (-> arg0 engine-part) s5-0) + (let ((f0-17 (lerp-scale 0.4 1.0 f28-0 1638.4 f30-0))) + (sound-play-by-name + (static-sound-name "hover-jets") + (-> arg0 sound-id) + (the int (* 1024.0 f0-17)) + 0 + 0 + (sound-group sfx) + #t + ) + ) ) ) 0 @@ -1641,7 +1621,6 @@ (defmethod init-enemy! ((this crimson-guard-hover)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag) (sv-64 res-tag)) (hover-enemy-method-149 this) (init-enemy-behaviour-and-stats! this (hover-enemy-method-150 this)) (hover-enemy-method-155 this) @@ -1662,15 +1641,17 @@ (set! (-> this hips-jmod) (the-as joint-mod (new 'process 'joint-mod-rotate-local this 18 #t))) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-30 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-30 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (if (and v1-30 (= (-> sv-16 elt-count) 1)) (set! (-> this entity-group) (-> v1-30 0)) (set! (-> this entity-group) #f) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-34 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-34 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32))) + ) (cond ((and v1-34 (= (-> sv-32 elt-count) 2)) (set! (-> this attack-wait-min) (-> v1-34 0)) @@ -1682,16 +1663,18 @@ ) ) ) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-40 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-48)))) + (let* ((sv-48 (new 'static 'res-tag)) + (v1-40 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-48))) + ) (set! (-> this attack-miss-dist-min) (if (and v1-40 (> (the-as int (-> sv-48 elt-count)) 0)) (-> v1-40 0) -40960.0 ) ) ) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-43 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64)))) + (let* ((sv-64 (new 'static 'res-tag)) + (v1-43 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64))) + ) (set! (-> this attack-miss-dist-max) (if (and v1-43 (< 1 (the-as int (-> sv-64 elt-count)))) (-> v1-43 1) 40960.0 diff --git a/goal_src/jak2/levels/common/enemy/hover/hover-enemy-battle.gc b/goal_src/jak2/levels/common/enemy/hover/hover-enemy-battle.gc index f442d600b3..b97579d83a 100644 --- a/goal_src/jak2/levels/common/enemy/hover/hover-enemy-battle.gc +++ b/goal_src/jak2/levels/common/enemy/hover/hover-enemy-battle.gc @@ -180,13 +180,15 @@ (('wait) ) ) - (suspend-for (-> gp-0 s5-0 time)) + (suspend-for (-> gp-0 s5-0 time) + ) (while (< (-> gp-0 s5-0 alive-count) (-> self alive-count)) (suspend) ) ) ) - (suspend-for (seconds 2)) + (suspend-for (seconds 2) + ) (go-virtual die) ) :post hover-enemy-manager-post @@ -248,12 +250,12 @@ (defmethod hover-enemy-manager-init! ((this hover-enemy-manager) (arg0 (array hover-enemy-battle-command))) "Initialize this [[hover-enemy-manager]]." - (local-vars (sv-16 res-tag)) (set! (-> this command-table) arg0) (set! (-> this path) (new 'process 'path-control this 'path 0.0 (-> this entity) #f)) (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-5 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-5 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-5 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-5)) diff --git a/goal_src/jak2/levels/common/enemy/hover/hover-enemy.gc b/goal_src/jak2/levels/common/enemy/hover/hover-enemy.gc index 880ebf36d7..a2279de128 100644 --- a/goal_src/jak2/levels/common/enemy/hover/hover-enemy.gc +++ b/goal_src/jak2/levels/common/enemy/hover/hover-enemy.gc @@ -9,7 +9,7 @@ (defmethod general-event-handler ((this hover-enemy) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy -@TODO - unsure if there is a pattern for the events and this should have a more specific name" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (local-vars (v1-41 float)) (rlet ((acc :class vf) (vf0 :class vf) @@ -47,9 +47,7 @@ ) (('update-formation) (let ((s5-1 (the-as object (-> arg3 param 0)))) - (let* ((f0-0 409.6) - (f0-2 (* f0-0 f0-0)) - ) + (let ((f0-2 (square 409.6))) (.lvf vf1 (&-> (vector-! (new 'stack-no-clear 'vector) (the-as vector s5-1) (-> this offset)) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -175,12 +173,7 @@ (hover-formation-method-15 a0-2 gp-0 (-> self offset)) ) (else - (let* ((s5-0 (handle->process (-> self focus handle))) - (a0-7 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((a0-7 (the-as process (as-type (handle->process (-> self focus handle)) process-focusable)))) (cond (a0-7 (let* ((s5-1 (get-trans (the-as process-focusable a0-7) 3)) @@ -292,9 +285,9 @@ (defmethod common-post ((this hover-enemy)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" (hover-enemy-method-148 this) (enemy-method-129 this) (let ((t9-2 (method-of-type enemy common-post))) @@ -456,16 +449,12 @@ (hover-enemy-method-141 self 1.0) ) ) - (let* ((gp-0 *target*) - (s1-0 (if (type? gp-0 process-focusable) - gp-0 - ) - ) - (gp-1 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - (s4-0 (-> self root)) - (s5-0 (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) 0.0 'interp)) - ) + (let ((s1-0 (the-as target (as-type *target* process-focusable))) + (gp-1 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s4-0 (-> self root)) + (s5-0 (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) 0.0 'interp)) + ) (let ((s0-0 (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) 1.0 'interp)) (s3-1 (-> (the-as collide-shape-prim-group (-> self root root-prim)) @@ -893,17 +882,18 @@ ) (defmethod deactivate ((this hover-enemy)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (hover-nav-control-method-9 (-> this hover)) ((method-of-type enemy deactivate) this) (none) ) ;; WARN: Return type mismatch enemy vs hover-enemy. -(defmethod relocate ((this hover-enemy) (arg0 int)) +(defmethod relocate ((this hover-enemy) (offset int)) (if (nonzero? (-> this hover)) - (&+! (-> this hover) arg0) + (&+! (-> this hover) offset) ) - (the-as hover-enemy ((method-of-type enemy relocate) this arg0)) + (the-as hover-enemy ((method-of-type enemy relocate) this offset)) ) (defmethod hover-enemy-method-155 ((this hover-enemy)) diff --git a/goal_src/jak2/levels/common/enemy/hover/hover-formation.gc b/goal_src/jak2/levels/common/enemy/hover/hover-formation.gc index e6780002cc..d621cc2a12 100644 --- a/goal_src/jak2/levels/common/enemy/hover/hover-formation.gc +++ b/goal_src/jak2/levels/common/enemy/hover/hover-formation.gc @@ -20,18 +20,10 @@ (defmethod hover-formation-control-method-16 ((this hover-formation-control)) (let ((gp-0 (hover-formation-control-method-13 this (new 'stack-no-clear 'vector))) - (s4-0 (cond - ((-> this anchor-proc) - (let ((s3-0 (handle->process (-> this anchor-proc)))) - (if (type? s3-0 process-focusable) - (the-as process-focusable s3-0) - ) - ) - ) - (else + (s4-0 (if (-> this anchor-proc) + (as-type (handle->process (-> this anchor-proc)) process-focusable) *target* ) - ) ) ) (and s4-0 @@ -62,18 +54,10 @@ ) ) ) - (s3-0 (cond - ((-> this anchor-proc) - (let ((s2-0 (handle->process (-> this anchor-proc)))) - (if (type? s2-0 process-focusable) - (the-as process-focusable s2-0) - ) - ) - ) - (else + (s3-0 (if (-> this anchor-proc) + (as-type (handle->process (-> this anchor-proc)) process-focusable) *target* ) - ) ) ) (cond @@ -114,18 +98,10 @@ ) ) ) - (a0-7 (cond - ((-> this anchor-proc) - (let ((s4-0 (handle->process (-> this anchor-proc)))) - (if (type? s4-0 process-focusable) - (the-as process-focusable s4-0) - ) - ) - ) - (else + (a0-7 (if (-> this anchor-proc) + (as-type (handle->process (-> this anchor-proc)) process-focusable) *target* ) - ) ) ) (cond @@ -205,7 +181,6 @@ (arg2 (function form-search-info float)) (arg3 form-search-info) ) - (local-vars (sv-80 int)) (let ((s2-0 (new 'stack-no-clear 'array 'int32 32))) (dotimes (v1-0 arg0) (set! (-> s2-0 v1-0) 0) @@ -219,16 +194,16 @@ 0 ) (else - (let ((s0-0 arg1)) - (set! sv-80 s1-0) - (let ((a1-1 (if (odd? s1-0) - (-> s2-0 s1-0) - 0 - ) - ) - (a2-1 arg3) + (let ((s0-0 arg1) + (sv-80 s1-0) + ) + (s0-0 + sv-80 + (if (odd? s1-0) + (-> s2-0 s1-0) + 0 ) - (s0-0 sv-80 a1-1 a2-1) + arg3 ) ) (+! (-> s2-0 s1-0) 1) @@ -288,18 +263,10 @@ (vector-rotate-y! arg0 arg1 arg2) (cond ((logtest? (-> this flags) 2) - (let ((s2-0 (cond - ((-> this anchor-proc) - (let ((s4-0 (handle->process (-> this anchor-proc)))) - (if (type? s4-0 process-focusable) - (the-as process-focusable s4-0) - ) - ) - ) - (else + (let ((s2-0 (if (-> this anchor-proc) + (as-type (handle->process (-> this anchor-proc)) process-focusable) *target* ) - ) ) (s4-1 (hover-formation-control-method-15 this (new 'stack-no-clear 'vector) arg0)) (s3-0 (new 'stack-no-clear 'vector)) @@ -376,12 +343,7 @@ (set! (-> s5-0 best-cost) -1.0) (set! (-> s5-0 count) 0) (dotimes (s4-0 16) - (let* ((s3-0 (handle->process (-> this actor-table s4-0))) - (a0-8 (if (type? s3-0 process-focusable) - (the-as process-focusable s3-0) - ) - ) - ) + (let ((a0-8 (as-type (handle->process (-> this actor-table s4-0)) process-focusable))) (cond (a0-8 (set! (-> s5-0 actor-position s4-0 quad) (-> (get-trans a0-8 3) quad)) @@ -645,14 +607,14 @@ ) ) -(defmethod relocate ((this hover-formation) (arg0 int)) +(defmethod relocate ((this hover-formation) (offset int)) (if (nonzero? (-> this formation)) - (&+! (-> this formation) arg0) + (&+! (-> this formation) offset) ) (if (nonzero? (-> this path)) - (&+! (-> this path) arg0) + (&+! (-> this path) offset) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defmethod hover-formation-method-15 ((this hover-formation) (arg0 vector) (arg1 vector)) @@ -662,12 +624,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this hover-formation) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" - (local-vars (sv-32 structure)) + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (set! (-> this path) (new 'process 'path-control this 'path 0.0 (-> this entity) #f)) (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) (let* ((s5-0 (method-of-type hover-formation-control new)) @@ -681,25 +642,29 @@ This commonly includes things such as: ) ) (s0-0 (res-lump-float (-> this entity) 'notice-dist :default 225280.0)) + (t9-3 (method-of-type res-lump get-property-struct)) + (a0-5 (-> this entity)) + (a1-4 'trans-offset) + (a2-3 'interp) + (a3-2 -1000000000.0) + (t0-2 (new 'stack-no-clear 'vector)) ) - (let ((t9-3 (method-of-type res-lump get-property-struct)) - (a0-5 (-> this entity)) - (a1-4 'trans-offset) - (a2-3 'interp) - (a3-2 -1000000000.0) - (t0-2 (new 'stack-no-clear 'vector)) + (set! (-> t0-2 x) 0.0) + (set! (-> t0-2 y) 20480.0) + (set! (-> t0-2 z) 61440.0) + (set! (-> t0-2 w) 1.0) + (set! (-> this formation) + (s5-0 + s4-0 + s3-0 + s2-0 + s1-0 + s0-0 + (the-as vector (t9-3 a0-5 a1-4 a2-3 a3-2 t0-2 (the-as (pointer res-tag) #f) *res-static-buf*)) + (res-lump-float (-> this entity) 'rotoffset :default 5461.3335) + (the-as handle #f) + ) ) - (set! (-> t0-2 x) 0.0) - (set! (-> t0-2 y) 20480.0) - (set! (-> t0-2 z) 61440.0) - (set! (-> t0-2 w) 1.0) - (set! sv-32 (t9-3 a0-5 a1-4 a2-3 a3-2 t0-2 (the-as (pointer res-tag) #f) *res-static-buf*)) - ) - (let ((t2-4 (res-lump-float (-> this entity) 'rotoffset :default 5461.3335)) - (t3-0 #f) - ) - (set! (-> this formation) (s5-0 s4-0 s3-0 s2-0 s1-0 s0-0 (the-as vector sv-32) t2-4 (the-as handle t3-0))) - ) ) (set! (-> this formation-timer) (the-as uint (current-time))) (logclear! (-> this mask) (process-mask actor-pause)) diff --git a/goal_src/jak2/levels/common/enemy/hover/hover-nav-control.gc b/goal_src/jak2/levels/common/enemy/hover/hover-nav-control.gc index 5d926be0c0..17e3c5febe 100644 --- a/goal_src/jak2/levels/common/enemy/hover/hover-nav-control.gc +++ b/goal_src/jak2/levels/common/enemy/hover/hover-nav-control.gc @@ -788,7 +788,6 @@ ) (defmethod nav-network-method-26 ((this nav-network) (arg0 vector) (arg1 process) (arg2 vector) (arg3 vector) (arg4 float)) - (local-vars (sv-48 vector) (sv-64 sphere)) (vector-reset! arg0) (let ((s1-0 (process->handle arg1)) (s2-0 0) @@ -797,17 +796,16 @@ (while v1-3 (let ((s0-0 (-> v1-3 next))) (when (!= (-> (the-as hover-nav-sphere v1-3) handle) s1-0) - (set! sv-64 (-> (the-as hover-nav-sphere v1-3) sphere)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (vector-segment-distance-point! sv-64 arg2 arg3 sv-48) - (when (>= (+ arg4 (-> sv-64 r)) (vector-vector-distance sv-64 sv-48)) - (let* ((v1-8 (new 'stack-no-clear 'vector)) - (a0-6 arg2) - (v1-9 (vector-! v1-8 (the-as vector sv-64) a0-6)) - ) - (vector+! arg0 arg0 v1-9) + (let ((sv-64 (-> (the-as hover-nav-sphere v1-3) sphere)) + (sv-48 (new 'stack-no-clear 'vector)) + ) + (vector-segment-distance-point! sv-64 arg2 arg3 sv-48) + (when (>= (+ arg4 (-> sv-64 r)) (vector-vector-distance sv-64 sv-48)) + (let ((v1-9 (vector-! (new 'stack-no-clear 'vector) (the-as vector sv-64) arg2))) + (vector+! arg0 arg0 v1-9) + ) + (+! s2-0 1) ) - (+! s2-0 1) ) ) (set! v1-3 s0-0) @@ -879,12 +877,7 @@ (let ((v1-2 (the-as list-node (-> this sphere-list)))) (while v1-2 (let ((s5-0 (-> v1-2 next))) - (let* ((s3-0 (handle->process (-> (the-as hover-nav-sphere v1-2) handle))) - (s4-0 (if (type? s3-0 hover-enemy) - s3-0 - ) - ) - ) + (let ((s4-0 (the-as process (as-type (handle->process (-> (the-as hover-nav-sphere v1-2) handle)) hover-enemy)))) (when s4-0 (let ((a1-9 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-9 from) (process->ppointer pp)) @@ -1012,67 +1005,62 @@ ) (defmethod hover-nav-control-method-28 ((this hover-nav-control) (arg0 vector) (arg1 vector)) - (local-vars (v0-15 symbol) (sv-32 int) (sv-48 (function hover-nav-control vector vector int))) - (let ((s4-0 (-> this nav network)) - (s5-0 (-> this path-info)) - (s1-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) arg0 arg1) 1.0)) - ) - (set! sv-32 (hover-nav-control-method-27 this arg1 s1-0)) + (local-vars (v0-15 symbol)) + (let* ((s4-0 (-> this nav network)) + (s5-0 (-> this path-info)) + (s1-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) arg0 arg1) 1.0)) + (sv-32 (hover-nav-control-method-27 this arg1 s1-0)) + ) (set! v0-15 (cond (sv-32 (when (or (!= sv-32 (-> this curr-dest-pt)) (not (-> this path-info segment-list))) - (let ((s0-0 this)) - (set! sv-48 (method-of-object s0-0 hover-nav-control-method-27)) - (let* ((a2-2 (vector-negate! s1-0 s1-0)) - (s2-1 (sv-48 s0-0 arg0 a2-2)) - ) - (when s2-1 - (cond - ((= s2-1 sv-32) - (if *debug-hover* - (add-debug-sphere #t (bucket-id debug-no-zbuf1) (-> s4-0 sv-32 pos) (meters 1) *color-dark-blue*) - ) - (nav-network-method-22 (-> this nav) s5-0 (-> s4-0 sv-32 pos) arg1 -1 -1) - (nav-network-method-22 - (-> this nav) - s5-0 - (the-as vector (hover-nav-control-method-17 this)) - (-> s4-0 s2-1 pos) - -1 - -1 + (let ((s2-1 (hover-nav-control-method-27 this arg0 (vector-negate! s1-0 s1-0)))) + (when s2-1 + (cond + ((= s2-1 sv-32) + (if *debug-hover* + (add-debug-sphere #t (bucket-id debug-no-zbuf1) (-> s4-0 sv-32 pos) (meters 1) *color-dark-blue*) ) + (nav-network-method-22 (-> this nav) s5-0 (-> s4-0 sv-32 pos) arg1 -1 -1) + (nav-network-method-22 + (-> this nav) + s5-0 + (-> (hover-nav-control-method-17 this) world-sphere) + (-> s4-0 s2-1 pos) + -1 + -1 ) - (else - (when *debug-hover* - (add-debug-sphere #t (bucket-id debug-no-zbuf1) (-> s4-0 s2-1 pos) (meters 1) *color-green*) - (add-debug-sphere #t (bucket-id debug-no-zbuf1) (-> s4-0 sv-32 pos) (meters 1) *color-cyan*) - ) - (let* ((a0-14 (-> this nav)) - (t9-10 (method-of-object a0-14 nav-network-method-22)) - (a1-11 s5-0) - (a2-8 (-> s4-0 sv-32 pos)) - (a3-5 arg1) - (t0-5 -1) - ) - (t9-10 a0-14 a1-11 a2-8 a3-5 t0-5 -1) - (nav-network-method-24 (-> this nav) s5-0 s2-1 sv-32 t0-5) - ) - (nav-network-method-22 - (-> this nav) - s5-0 - (the-as vector (hover-nav-control-method-17 this)) - (-> s4-0 s2-1 pos) - -1 - -1 - ) + ) + (else + (when *debug-hover* + (add-debug-sphere #t (bucket-id debug-no-zbuf1) (-> s4-0 s2-1 pos) (meters 1) *color-green*) + (add-debug-sphere #t (bucket-id debug-no-zbuf1) (-> s4-0 sv-32 pos) (meters 1) *color-cyan*) + ) + (let* ((a0-14 (-> this nav)) + (t9-10 (method-of-object a0-14 nav-network-method-22)) + (a1-11 s5-0) + (a2-8 (-> s4-0 sv-32 pos)) + (a3-5 arg1) + (t0-5 -1) + ) + (t9-10 a0-14 a1-11 a2-8 a3-5 t0-5 -1) + (nav-network-method-24 (-> this nav) s5-0 s2-1 sv-32 t0-5) + ) + (nav-network-method-22 + (-> this nav) + s5-0 + (-> (hover-nav-control-method-17 this) world-sphere) + (-> s4-0 s2-1 pos) + -1 + -1 ) ) - (hover-nav-control-method-29 this (-> this root transv)) - (set! (-> s5-0 curr-segment) (-> s5-0 segment-list)) - (set! (-> s5-0 curr-u) (/ 16384.0 (-> s5-0 curr-segment dist))) - (set! (-> this curr-dest-pt) sv-32) ) + (hover-nav-control-method-29 this (-> this root transv)) + (set! (-> s5-0 curr-segment) (-> s5-0 segment-list)) + (set! (-> s5-0 curr-u) (/ 16384.0 (-> s5-0 curr-segment dist))) + (set! (-> this curr-dest-pt) sv-32) ) ) ) @@ -1226,19 +1214,20 @@ ;; WARN: Return type mismatch vector vs none. (defmethod hover-nav-control-method-15 ((this hover-nav-control) (arg0 vector)) - (local-vars (sv-32 vector) (sv-36 collide-shape-moving)) - (set! sv-32 (new 'stack-no-clear 'vector)) - (set! sv-36 (-> this root)) - (vector-inv-orient-by-quat! sv-32 (-> sv-36 transv) (-> sv-36 quat)) - (vector-float*! arg0 sv-32 (/ 1.0 (hover-nav-control-method-30 this))) + (let ((sv-32 (new 'stack-no-clear 'vector))) + (let ((sv-36 (-> this root))) + (vector-inv-orient-by-quat! sv-32 (-> sv-36 transv) (-> sv-36 quat)) + ) + (vector-float*! arg0 sv-32 (/ 1.0 (hover-nav-control-method-30 this))) + ) (none) ) (defmethod hover-nav-control-method-16 ((this hover-nav-control) (arg0 vector)) - (local-vars (sv-32 vector)) - (set! sv-32 (new 'stack-no-clear 'vector)) - (vector-inv-orient-by-quat! sv-32 (-> this transvv) (-> this root quat)) - (vector-float*! arg0 sv-32 (/ 1.0 (hover-nav-control-method-31 this))) + (let ((sv-32 (new 'stack-no-clear 'vector))) + (vector-inv-orient-by-quat! sv-32 (-> this transvv) (-> this root quat)) + (vector-float*! arg0 sv-32 (/ 1.0 (hover-nav-control-method-31 this))) + ) ) (defmethod hover-nav-control-method-10 ((this hover-nav-control) (arg0 vector) (arg1 vector) (arg2 vector)) @@ -1303,7 +1292,6 @@ ) (defmethod hover-nav-control-method-11 ((this hover-nav-control) (arg0 vector)) - (local-vars (sv-288 vector) (sv-304 vector) (sv-320 vector) (sv-336 vector) (sv-352 int)) (with-pp (when *debug-hover* (if arg0 @@ -1339,7 +1327,7 @@ ) (hover-nav-control-method-28 this - (vector+! (new 'stack-no-clear 'vector) (the-as vector (hover-nav-control-method-17 this)) s4-0) + (vector+! (new 'stack-no-clear 'vector) (-> (hover-nav-control-method-17 this) world-sphere) s4-0) arg0 ) ) @@ -1362,33 +1350,32 @@ (the-as vector (+ (the-as uint s1-2) 16)) (new 'static 'rgba :r #xff :g #xff :b #xff :a #x40) ) - (let ((s0-0 (matrix*! (new 'stack-no-clear 'matrix) *hermite-matrix* (the-as matrix (+ (the-as uint s1-2) 16))))) - (set! sv-288 (new 'stack-no-clear 'vector)) - (set! sv-304 (new 'stack-no-clear 'vector)) - (set! sv-320 (new 'stack-no-clear 'vector)) - (set! sv-336 (new 'stack-no-clear 'vector)) - (let ((f30-0 0.0) - (f28-0 0.1) - ) - (set! sv-352 0) - (while (< sv-352 10) - (set-vector! sv-288 (* f30-0 f30-0 f30-0) (* f30-0 f30-0) f30-0 1.0) - (set-vector! sv-304 (* f28-0 f28-0 f28-0) (* f28-0 f28-0) f28-0 1.0) - (vector-matrix*! sv-320 sv-288 s0-0) - (vector-matrix*! sv-336 sv-304 s0-0) - (add-debug-line - #t - (bucket-id debug-no-zbuf1) - sv-320 - sv-336 - (new 'static 'rgba :r #xff :g #xff :b #xff :a #x40) - #f - (the-as rgba -1) - ) - (set! f30-0 (+ 0.1 f30-0)) - (set! f28-0 (+ 0.1 f28-0)) - (set! sv-352 (+ sv-352 1)) + (let ((s0-0 (matrix*! (new 'stack-no-clear 'matrix) *hermite-matrix* (the-as matrix (+ (the-as uint s1-2) 16)))) + (sv-288 (new 'stack-no-clear 'vector)) + (sv-304 (new 'stack-no-clear 'vector)) + (sv-320 (new 'stack-no-clear 'vector)) + (sv-336 (new 'stack-no-clear 'vector)) + (f30-0 0.0) + (f28-0 0.1) + (sv-352 0) ) + (while (< sv-352 10) + (set-vector! sv-288 (* (square f30-0) f30-0) (square f30-0) f30-0 1.0) + (set-vector! sv-304 (* (square f28-0) f28-0) (square f28-0) f28-0 1.0) + (vector-matrix*! sv-320 sv-288 s0-0) + (vector-matrix*! sv-336 sv-304 s0-0) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + sv-320 + sv-336 + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x40) + #f + (the-as rgba -1) + ) + (set! f30-0 (+ 0.1 f30-0)) + (set! f28-0 (+ 0.1 f28-0)) + (+! sv-352 1) ) ) (set! s1-2 (-> s1-2 next)) @@ -1402,7 +1389,7 @@ (a2-11 (matrix*! (new 'stack-no-clear 'matrix) *hermite-matrix* (-> s2-1 curve-matrix))) (a1-12 (new 'stack-no-clear 'vector)) ) - (set-vector! a1-12 (* f30-1 f30-1 f30-1) (* f30-1 f30-1) f30-1 1.0) + (set-vector! a1-12 (* (square f30-1) f30-1) (square f30-1) f30-1 1.0) (vector-matrix*! s4-1 a1-12 a2-11) ) (if *debug-hover* @@ -1573,51 +1560,43 @@ ;; ERROR: Stack slot load at 144 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 (defmethod hover-nav-control-method-13 ((this hover-nav-control)) - (local-vars (sv-112 float) (sv-128 float) (sv-144 float) (sv-160 float)) (let* ((s5-0 (-> this root)) (s3-0 (hover-nav-control-method-17 this)) - (v1-2 (vector-! (new 'stack-no-clear 'vector) (the-as vector s3-0) (-> s5-0 trans))) + (v1-2 (vector-! (new 'stack-no-clear 'vector) (-> s3-0 world-sphere) (-> s5-0 trans))) (s4-1 (vector-! (new 'stack-no-clear 'vector) (-> this dest-pos) v1-2)) ) (when (not (logtest? (-> this flags) (hover-nav-flags honflags-0))) (let* ((s2-0 (-> this root transv)) (f30-0 (vector-length s2-0)) - (s1-0 lerp-scale) - (s0-0 0.0) - ) - (set! sv-112 (hover-nav-control-method-30 this)) - (set! sv-128 (* 2.0 f30-0)) - (set! sv-144 (the-as float 0.0)) - (let* ((t0-0 (hover-nav-control-method-30 this)) - (f0-4 (s1-0 s0-0 sv-112 sv-128 sv-144 t0-0)) - (t0-2 (vector+float*! (new 'stack-no-clear 'vector) (the-as vector s3-0) s2-0 (/ f0-4 f30-0))) - (s2-1 (nav-network-method-26 - (-> this nav) - (new 'stack-no-clear 'vector) - (-> this root process) - (the-as vector s3-0) - t0-2 - (-> s3-0 world-sphere w) - ) + (f0-4 (lerp-scale + 0.0 + (hover-nav-control-method-30 this) + (* 2.0 f30-0) + (the-as float 0.0) + (hover-nav-control-method-30 this) ) - ) - (let ((f0-7 (vector-length s2-1)) - (s1-1 seek) - (s0-1 (-> this nav-collide-impulse-len)) - ) - (set! sv-160 f0-7) - (let ((a2-2 (* (hover-nav-control-method-31 this) (seconds-per-frame)))) - (set! (-> this nav-collide-impulse-len) (s1-1 s0-1 sv-160 a2-2)) - ) - ) - (vector-normalize-copy! (-> this nav-collide-impulse) s2-1 (- (-> this nav-collide-impulse-len))) + ) + (t0-2 (vector+float*! (new 'stack-no-clear 'vector) (-> s3-0 world-sphere) s2-0 (/ f0-4 f30-0))) + (s2-1 (nav-network-method-26 + (-> this nav) + (new 'stack-no-clear 'vector) + (-> this root process) + (-> s3-0 world-sphere) + t0-2 + (-> s3-0 world-sphere w) + ) + ) + ) + (let ((f0-7 (vector-length s2-1))) + (seek! (-> this nav-collide-impulse-len) f0-7 (* (hover-nav-control-method-31 this) (seconds-per-frame))) ) + (vector-normalize-copy! (-> this nav-collide-impulse) s2-1 (- (-> this nav-collide-impulse-len))) ) (if *debug-hover* (add-debug-vector #t (bucket-id debug-no-zbuf1) - (the-as vector s3-0) + (-> s3-0 world-sphere) (-> this nav-collide-impulse) (meters 0.00024414062) *color-red* diff --git a/goal_src/jak2/levels/common/enemy/hover/hover-nav-edit.gc b/goal_src/jak2/levels/common/enemy/hover/hover-nav-edit.gc index af89de6d11..3bce1dc862 100644 --- a/goal_src/jak2/levels/common/enemy/hover/hover-nav-edit.gc +++ b/goal_src/jak2/levels/common/enemy/hover/hover-nav-edit.gc @@ -120,16 +120,6 @@ ) (defun hover-nav-graph-output () - (local-vars - (sv-16 int) - (sv-32 (function _varargs_ object)) - (sv-48 symbol) - (sv-64 string) - (sv-80 int) - (sv-96 (function _varargs_ object)) - (sv-112 symbol) - (sv-128 string) - ) (let ((v1-0 (get-nav-graph-editor))) (when v1-0 (let* ((gp-0 (-> v1-0 nav-graph)) @@ -150,27 +140,16 @@ (dotimes (s1-0 (-> gp-0 edge-array length)) (let* ((v1-11 (-> gp-0 edge-array data s1-0)) (s0-0 (-> v1-11 runtime-node-id-1)) + (sv-16 (-> v1-11 runtime-node-id-2)) ) - (set! sv-16 (-> v1-11 runtime-node-id-2)) (when (= s3-0 s0-0) (let ((a1-2 (+ (the-as uint (-> gp-0 node-array data 0 position)) (* 80 sv-16)))) - (set! sv-32 format) - (set! sv-48 #t) - (set! sv-64 "(~d ~m) ") - (set! sv-80 sv-16) - (let ((a3-1 (vector-vector-distance (the-as vector s2-0) (the-as vector a1-2)))) - (sv-32 sv-48 sv-64 sv-80 a3-1) - ) + (format #t "(~d ~m) " sv-16 (vector-vector-distance (the-as vector s2-0) (the-as vector a1-2))) ) ) (when (= s3-0 sv-16) (let ((a1-4 (+ (the-as uint (-> gp-0 node-array data 0 position)) (* 80 s0-0)))) - (set! sv-96 format) - (set! sv-112 #t) - (set! sv-128 "(~d ~m) ") - (let ((a3-2 (vector-vector-distance (the-as vector s2-0) (the-as vector a1-4)))) - (sv-96 sv-112 sv-128 s0-0 a3-2) - ) + (format #t "(~d ~m) " s0-0 (vector-vector-distance (the-as vector s2-0) (the-as vector a1-4))) ) ) ) @@ -336,7 +315,7 @@ (set! (-> v1-21 next) #f) ) (let ((a0-19 (-> this left point-list)) - (v1-25 (&-> (-> this left) point-list)) + (v1-25 (&-> this left point-list)) ) (when (zero? s3-1) (break!) @@ -386,7 +365,7 @@ ) (let ((v1-32 s3-1) (a1-40 (-> this right point-list)) - (a0-31 (&-> (-> this right) point-list)) + (a0-31 (&-> this right point-list)) ) (when (zero? v1-32) (break!) @@ -454,7 +433,7 @@ (-> (the-as (pointer uint128) (+ (the-as uint (-> s5-0 node-array data 0 position)) (* 80 s2-0)))) ) (let ((a1-7 (-> gp-0 root point-list)) - (a0-8 (&-> (-> gp-0 root) point-list)) + (a0-8 (&-> gp-0 root point-list)) ) (when (zero? v1-9) (break!) @@ -506,7 +485,7 @@ (set! (-> v1-3 index) (the-as int (-> arg0 s2-0 next))) (set! (-> v1-3 pos quad) (-> arg0 s2-0 pos quad)) (let ((a1-8 (-> gp-0 root point-list)) - (a0-11 (&-> (-> gp-0 root) point-list)) + (a0-11 (&-> gp-0 root point-list)) ) (when (zero? v1-3) (break!) diff --git a/goal_src/jak2/levels/common/enemy/hover/wasp.gc b/goal_src/jak2/levels/common/enemy/hover/wasp.gc index 732271cece..5da1b7ff58 100644 --- a/goal_src/jak2/levels/common/enemy/hover/wasp.gc +++ b/goal_src/jak2/levels/common/enemy/hover/wasp.gc @@ -1153,79 +1153,73 @@ (s4-0 (-> this main-joint-vel)) (gp-0 (lambda ((arg0 wasp) (arg1 cspace) (arg2 float) (arg3 float) (arg4 vector) (arg5 vector) (arg6 int)) - (local-vars (sv-192 float) (sv-208 quaternion) (sv-224 vector)) - (set! sv-192 arg2) - (let ((s0-0 arg3)) - (set! sv-224 arg4) - (let ((s1-0 arg5) - (s3-0 arg6) - (s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) arg1)) - (s5-0 (new 'stack-no-clear 'matrix)) - (a1-3 (matrix-with-scale->quaternion (new 'stack-no-clear 'quaternion) (-> arg1 bone transform))) - ) - (set! sv-208 (new 'stack-no-clear 'quaternion)) - (let ((s2-1 (new 'stack-no-clear 'vector))) - (-> arg0 scale) - (quaternion-rotate-local-z! sv-208 a1-3 sv-192) - (quaternion->matrix s5-0 sv-208) - (set! (-> s2-1 quad) (-> arg0 root scale quad)) - (scale-matrix! s5-0 s2-1 s5-0) - (let* ((s1-1 (vector-inv-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 (-> arg0 root quat))) - (t9-6 vector-inv-orient-by-quat!) - (a0-10 (new 'stack-no-clear 'vector)) - (a2-4 (-> arg0 root quat)) - (v0-6 (t9-6 a0-10 sv-224 a2-4)) - (f30-0 (* 2457600.0 (seconds-per-frame))) - (f28-0 - (seek - (-> arg0 thrust s3-0) - (+ (* 0.4 (fmax 0.0 (* (-> v0-6 x) s0-0))) - (fmax 0.0 (-> v0-6 y)) - (fabs (/ (-> v0-6 z) 5)) - (fmax 0.0 (-> s1-1 y)) - ) - (/ f30-0 5) - ) - ) + (let ((sv-192 arg2) + (s0-0 arg3) + (sv-224 arg4) + (s1-0 arg5) + (s3-0 arg6) + (s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) arg1)) + (s5-0 (new 'stack-no-clear 'matrix)) + (a1-3 (matrix-with-scale->quaternion (new 'stack-no-clear 'quaternion) (-> arg1 bone transform))) + (sv-208 (new 'stack-no-clear 'quaternion)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (-> arg0 scale) + (quaternion-rotate-local-z! sv-208 a1-3 sv-192) + (quaternion->matrix s5-0 sv-208) + (set! (-> s2-1 quad) (-> arg0 root scale quad)) + (scale-matrix! s5-0 s2-1 s5-0) + (let* ((s1-1 (vector-inv-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 (-> arg0 root quat))) + (v0-6 (vector-inv-orient-by-quat! (new 'stack-no-clear 'vector) sv-224 (-> arg0 root quat))) + (f30-0 (* 2457600.0 (seconds-per-frame))) + (f28-0 + (seek + (-> arg0 thrust s3-0) + (+ (* 0.4 (fmax 0.0 (* (-> v0-6 x) s0-0))) + (fmax 0.0 (-> v0-6 y)) + (fabs (/ (-> v0-6 z) 5)) + (fmax 0.0 (-> s1-1 y)) + ) + (/ f30-0 5) ) - (let ((f20-0 (lerp-scale 819.2 4096.0 f28-0 1638.4 f30-0)) - (f26-0 (lerp-scale 4915.2 11468.8 f28-0 1638.4 f30-0)) - ) - (lerp-scale 0.0 -4915.2 f28-0 1638.4 f30-0) - (let ((f22-0 (lerp-scale 0.5 1.5 f28-0 1638.4 f30-0)) - (f24-0 (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0)) - ) - (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0) - (let ((f1-10 (lerp-scale 0.02 0.6 f28-0 1638.4 f30-0)) - (f2-6 (fmin 1.0 (-> s2-1 x))) - (f0-15 (fmin 1.0 (-> s2-1 y))) - ) - (set! (-> *part-id-table* 718 init-specs 4 initial-valuef) (* f20-0 f2-6)) - (set! (-> *part-id-table* 718 init-specs 5 initial-valuef) (* f26-0 f0-15)) - (set! (-> *part-id-table* 722 init-specs 3 initial-valuef) (* f22-0 f2-6)) - (set! (-> *part-id-table* 719 init-specs 1 initial-valuef) (* f24-0 f0-15)) - (set! (-> *part-id-table* 720 init-specs 1 initial-valuef) (* f1-10 f0-15)) - (set! (-> *part-id-table* 721 init-specs 0 initial-valuef) (* f24-0 f0-15)) - (set! (-> arg0 thrust s3-0) f28-0) - (let ((f0-16 (* f26-0 f0-15))) - (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-0 vector 1) (/ f0-16 -2)) - ) + ) + ) + (let ((f20-0 (lerp-scale 819.2 4096.0 f28-0 1638.4 f30-0)) + (f26-0 (lerp-scale 4915.2 11468.8 f28-0 1638.4 f30-0)) + ) + (lerp-scale 0.0 -4915.2 f28-0 1638.4 f30-0) + (let ((f22-0 (lerp-scale 0.5 1.5 f28-0 1638.4 f30-0)) + (f24-0 (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0)) + ) + (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0) + (let ((f1-10 (lerp-scale 0.02 0.6 f28-0 1638.4 f30-0)) + (f2-6 (fmin 1.0 (-> s2-1 x))) + (f0-15 (fmin 1.0 (-> s2-1 y))) ) + (set! (-> *part-id-table* 718 init-specs 4 initial-valuef) (* f20-0 f2-6)) + (set! (-> *part-id-table* 718 init-specs 5 initial-valuef) (* f26-0 f0-15)) + (set! (-> *part-id-table* 722 init-specs 3 initial-valuef) (* f22-0 f2-6)) + (set! (-> *part-id-table* 719 init-specs 1 initial-valuef) (* f24-0 f0-15)) + (set! (-> *part-id-table* 720 init-specs 1 initial-valuef) (* f1-10 f0-15)) + (set! (-> *part-id-table* 721 init-specs 0 initial-valuef) (* f24-0 f0-15)) + (set! (-> arg0 thrust s3-0) f28-0) + (let ((f0-16 (* f26-0 f0-15))) + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-0 vector 1) (/ f0-16 -2)) ) ) - (set! (-> s5-0 trans quad) (-> s4-0 quad)) - (spawn-with-matrix (-> arg0 engine-part) s5-0) - (let ((f0-18 (lerp-scale 0.75 1.0 f28-0 1638.4 f30-0))) - (sound-play-by-name - (static-sound-name "wasp-jets") - (-> arg0 sound-id) - (the int (* 1024.0 f0-18)) - 0 - 0 - (sound-group sfx) - (-> arg0 root trans) - ) - ) + ) + ) + (set! (-> s5-0 trans quad) (-> s4-0 quad)) + (spawn-with-matrix (-> arg0 engine-part) s5-0) + (let ((f0-18 (lerp-scale 0.75 1.0 f28-0 1638.4 f30-0))) + (sound-play-by-name + (static-sound-name "wasp-jets") + (-> arg0 sound-id) + (the int (* 1024.0 f0-18)) + 0 + 0 + (sound-group sfx) + (-> arg0 root trans) ) ) ) @@ -1431,7 +1425,6 @@ (defmethod init-enemy! ((this wasp)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag) (sv-64 res-tag)) (hover-enemy-method-149 this) (init-enemy-behaviour-and-stats! this (hover-enemy-method-150 this)) (hover-enemy-method-155 this) @@ -1450,15 +1443,17 @@ (set! (-> this gun-x-angle-final) 0.0) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-28 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-28 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (if (and v1-28 (= (-> sv-16 elt-count) 1)) (set! (-> this entity-group) (-> v1-28 0)) (set! (-> this entity-group) #f) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-32 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-32 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32))) + ) (cond ((and v1-32 (= (-> sv-32 elt-count) 2)) (set! (-> this attack-wait-min) (-> v1-32 0)) @@ -1470,27 +1465,27 @@ ) ) ) - (let ((f30-0 4096.0)) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-39 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-48)))) - (set! (-> this attack-miss-dist-min) (* f30-0 (if (and v1-39 (> (the-as int (-> sv-48 elt-count)) 0)) - (-> v1-39 0) - -1.0 - ) - ) - ) - ) + (let* ((f30-0 4096.0) + (sv-48 (new 'static 'res-tag)) + (v1-39 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-48))) + ) + (set! (-> this attack-miss-dist-min) (* f30-0 (if (and v1-39 (> (the-as int (-> sv-48 elt-count)) 0)) + (-> v1-39 0) + -1.0 + ) + ) + ) ) - (let ((f30-1 4096.0)) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-43 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64)))) - (set! (-> this attack-miss-dist-max) (* f30-1 (if (and v1-43 (< 1 (the-as int (-> sv-64 elt-count)))) - (-> v1-43 1) - 1.0 - ) - ) - ) - ) + (let* ((f30-1 4096.0) + (sv-64 (new 'static 'res-tag)) + (v1-43 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64))) + ) + (set! (-> this attack-miss-dist-max) (* f30-1 (if (and v1-43 (< 1 (the-as int (-> sv-64 elt-count)))) + (-> v1-43 1) + 1.0 + ) + ) + ) ) (set! (-> this path) (new 'process 'path-control this 'intro 0.0 (-> this entity) #f)) (set! (-> this path-u) 0.0) diff --git a/goal_src/jak2/levels/common/enemy/metalmonk.gc b/goal_src/jak2/levels/common/enemy/metalmonk.gc index 09016ee870..981d33e37b 100644 --- a/goal_src/jak2/levels/common/enemy/metalmonk.gc +++ b/goal_src/jak2/levels/common/enemy/metalmonk.gc @@ -362,9 +362,9 @@ (defmethod common-post ((this metalmonk)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) @@ -376,7 +376,7 @@ (defmethod general-event-handler ((this metalmonk) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy -@TODO - unsure if there is a pattern for the events and this should have a more specific name" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit 'hit-knocked 'hit-flinch) (logclear! (-> this mask) (process-mask actor-pause)) @@ -403,11 +403,7 @@ ) ) (zero? (rnd-int-count this 3)) - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-0 32768.0) - ) - (>= f0-0 (* f1-0 f1-0)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (kill-prefer-falling this) ) @@ -434,13 +430,9 @@ ) (defmethod enemy-method-104 ((this metalmonk) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) - (let* ((s3-0 arg0) - (a0-2 (if (type? s3-0 process-focusable) - s3-0 - ) - ) - (s3-1 (new 'stack-no-clear 'vector)) - ) + (let ((a0-2 (the-as process (as-type arg0 process-focusable))) + (s3-1 (new 'stack-no-clear 'vector)) + ) (let ((s1-0 (new 'stack-no-clear 'vector))) (vector-! s3-1 (get-trans (the-as process-focusable a0-2) 0) (-> this root trans)) (set! (-> s3-1 y) 0.0) @@ -553,17 +545,13 @@ (t9-0) ) ) - ;; og:preserve-this fix potential use-after-free bug - (if (-> self nav) - (let ((v1-4 (-> self nav))) - (set! (-> v1-4 max-rotation-rate) (-> self enemy-info maximum-rotation-rate)) - )) + (let ((v1-4 (-> self nav))) + (set! (-> v1-4 max-rotation-rate) (-> self enemy-info maximum-rotation-rate)) + ) 0 - ;; og:preserve-this fix potential use-after-free bug - (if (-> self nav) - (let ((v1-6 (-> self nav))) - (set! (-> v1-6 turning-acceleration) (-> self enemy-info run-turning-acceleration)) - )) + (let ((v1-6 (-> self nav))) + (set! (-> v1-6 turning-acceleration) (-> self enemy-info run-turning-acceleration)) + ) 0 ) :code (behavior () @@ -729,11 +717,9 @@ (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (metalmonk-method-180 self #f) (nav-enemy-method-168 self) - ;; og:preserve-this fix potential use-after-free bug - (if (-> self nav) - (let ((v1-6 (-> self nav))) - (set! (-> v1-6 target-speed) (-> self enemy-info run-travel-speed)) - )) + (let ((v1-6 (-> self nav))) + (set! (-> v1-6 target-speed) (-> self enemy-info run-travel-speed)) + ) 0 (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) @@ -790,11 +776,9 @@ (let ((a0-1 (handle->process (-> self focus handle)))) (if (and a0-1 (and (time-elapsed? (-> self state-time) (seconds 0.05)) - (let ((f0-0 (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (-> self root trans))) - (f1-0 14336.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (-> self root trans)) + (square 14336.0) + ) ) ) (react-to-focus self) @@ -1150,11 +1134,11 @@ #f ) -(defmethod relocate ((this metalmonk) (arg0 int)) +(defmethod relocate ((this metalmonk) (offset int)) (if (nonzero? (-> this intro-path)) - (&+! (-> this intro-path) arg0) + (&+! (-> this intro-path) offset) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defmethod init-enemy! ((this metalmonk)) diff --git a/goal_src/jak2/levels/common/entities/fort-floor-spike.gc b/goal_src/jak2/levels/common/entities/fort-floor-spike.gc index 5f1f7096e5..94af8deda5 100644 --- a/goal_src/jak2/levels/common/entities/fort-floor-spike.gc +++ b/goal_src/jak2/levels/common/entities/fort-floor-spike.gc @@ -81,12 +81,7 @@ (case message (('touched) (when (+ (current-time) (seconds -2)) - (let* ((s3-0 proc) - (proc-draw (if (type? s3-0 process-drawable) - (the-as process-drawable s3-0) - ) - ) - ) + (let ((proc-draw (as-type proc process-drawable))) (when proc-draw (let ((spike-quat (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) (touched-from-dir (vector-normalize! @@ -160,21 +155,21 @@ ) ;; WARN: Return type mismatch process-drawable vs fort-floor-spike. -(defmethod relocate ((this fort-floor-spike) (arg0 int)) +(defmethod relocate ((this fort-floor-spike) (offset int)) (if (nonzero? (-> this spike-row)) - (&+! (-> this spike-row) arg0) + (&+! (-> this spike-row) offset) ) - (the-as fort-floor-spike ((method-of-type process-drawable relocate) this arg0)) + (the-as fort-floor-spike ((method-of-type process-drawable relocate) this offset)) ) ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this fort-floor-spike) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (init-spike-collision! this) (process-drawable-from-entity! this arg0) (init-spike-joints! this) @@ -237,7 +232,6 @@ This commonly includes things such as: (defmethod init-spike-collision! ((this fort-floor-spike-a)) "Initializes the collision for the particular spike" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 type) (sv-48 collide-shape-moving)) (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -255,24 +249,18 @@ This commonly includes things such as: (s2-0 (car s3-0)) ) (while (not (null? s3-0)) - (let ((s1-0 (method-of-type collide-shape-prim-mesh new)) - (s0-0 'process) - ) - (set! sv-32 collide-shape-prim-mesh) - (set! sv-48 s5-0) - (let ((a3-2 (command-get-int (car s2-0) 0)) - (t0-1 0) + (let ((sv-16 + (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint (command-get-int (car s2-0) 0)) (the-as uint 0)) ) - (set! sv-16 (s1-0 s0-0 sv-32 sv-48 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((s1-1 sv-16)) + (set! (-> s1-1 prim-core collide-as) (-> s4-0 prim-core collide-as)) + (set! (-> s1-1 prim-core collide-with) (-> s4-0 prim-core collide-with)) + (set! (-> s1-1 prim-core action) (-> s4-0 prim-core action)) + (set! (-> s1-1 transform-index) (command-get-int (car (cdr s2-0)) 0)) ) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s2-0))) 0.0)) ) - (let ((s1-1 sv-16)) - (set! (-> s1-1 prim-core collide-as) (-> s4-0 prim-core collide-as)) - (set! (-> s1-1 prim-core collide-with) (-> s4-0 prim-core collide-with)) - (set! (-> s1-1 prim-core action) (-> s4-0 prim-core action)) - (set! (-> s1-1 transform-index) (command-get-int (car (cdr s2-0)) 0)) - ) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s2-0))) 0.0)) (set! s3-0 (cdr s3-0)) (set! s2-0 (car s3-0)) ) @@ -291,7 +279,6 @@ This commonly includes things such as: (defmethod init-periodic-animation! ((this fort-floor-spike-a)) "Initialzes the periodic animation of the spikes (exit and re-entry)" - (local-vars (sv-64 cspace)) (let ((s5-0 2) (s4-0 4) ) @@ -314,12 +301,13 @@ This commonly includes things such as: (s1-0 11) ) (dotimes (s0-0 (+ (- 1 s2-0) s1-0)) - (set! sv-64 (-> this node-list data (+ s2-0 s0-0))) - (vector<-cspace! (-> s3-0 s0-0) sv-64) - (set! (-> s3-0 s0-0 y) 0.0) - (set! (-> sv-64 param0) joint-mod-set-y-callback) - (set! (-> sv-64 param1) (the-as basic s3-0)) - (set! (-> sv-64 param2) (the-as basic s0-0)) + (let ((sv-64 (-> this node-list data (+ s2-0 s0-0)))) + (vector<-cspace! (-> s3-0 s0-0) sv-64) + (set! (-> s3-0 s0-0 y) 0.0) + (set! (-> sv-64 param0) joint-mod-set-y-callback) + (set! (-> sv-64 param1) (the-as basic s3-0)) + (set! (-> sv-64 param2) (the-as basic s0-0)) + ) ) ) (dotimes (s3-1 s5-0) @@ -375,7 +363,6 @@ This commonly includes things such as: (defmethod init-spike-collision! ((this fort-floor-spike-b)) "Initializes the collision for the particular spike" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 type) (sv-48 collide-shape-moving)) (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -404,24 +391,18 @@ This commonly includes things such as: (s2-0 (car s3-0)) ) (while (not (null? s3-0)) - (let ((s1-0 (method-of-type collide-shape-prim-mesh new)) - (s0-0 'process) - ) - (set! sv-32 collide-shape-prim-mesh) - (set! sv-48 s5-0) - (let ((a3-2 (command-get-int (car s2-0) 0)) - (t0-1 0) + (let ((sv-16 + (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint (command-get-int (car s2-0) 0)) (the-as uint 0)) ) - (set! sv-16 (s1-0 s0-0 sv-32 sv-48 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((s1-1 sv-16)) + (set! (-> s1-1 prim-core collide-as) (-> s4-0 prim-core collide-as)) + (set! (-> s1-1 prim-core collide-with) (-> s4-0 prim-core collide-with)) + (set! (-> s1-1 prim-core action) (-> s4-0 prim-core action)) + (set! (-> s1-1 transform-index) (command-get-int (car (cdr s2-0)) 0)) ) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s2-0))) 0.0)) ) - (let ((s1-1 sv-16)) - (set! (-> s1-1 prim-core collide-as) (-> s4-0 prim-core collide-as)) - (set! (-> s1-1 prim-core collide-with) (-> s4-0 prim-core collide-with)) - (set! (-> s1-1 prim-core action) (-> s4-0 prim-core action)) - (set! (-> s1-1 transform-index) (command-get-int (car (cdr s2-0)) 0)) - ) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s2-0))) 0.0)) (set! s3-0 (cdr s3-0)) (set! s2-0 (car s3-0)) ) @@ -440,7 +421,6 @@ This commonly includes things such as: (defmethod init-periodic-animation! ((this fort-floor-spike-b)) "Initialzes the periodic animation of the spikes (exit and re-entry)" - (local-vars (sv-64 cspace)) (let ((s5-0 2) (s4-0 5) ) @@ -465,12 +445,13 @@ This commonly includes things such as: (s1-0 13) ) (dotimes (s0-0 (+ (- 1 s2-0) s1-0)) - (set! sv-64 (-> this node-list data (+ s2-0 s0-0))) - (vector<-cspace! (-> s3-0 s0-0) sv-64) - (set! (-> s3-0 s0-0 y) 0.0) - (set! (-> sv-64 param0) joint-mod-set-y-callback) - (set! (-> sv-64 param1) (the-as basic s3-0)) - (set! (-> sv-64 param2) (the-as basic s0-0)) + (let ((sv-64 (-> this node-list data (+ s2-0 s0-0)))) + (vector<-cspace! (-> s3-0 s0-0) sv-64) + (set! (-> s3-0 s0-0 y) 0.0) + (set! (-> sv-64 param0) joint-mod-set-y-callback) + (set! (-> sv-64 param1) (the-as basic s3-0)) + (set! (-> sv-64 param2) (the-as basic s0-0)) + ) ) ) (dotimes (s3-1 s5-0) @@ -526,7 +507,6 @@ This commonly includes things such as: (defmethod init-spike-collision! ((this fort-floor-spike-c)) "Initializes the collision for the particular spike" - (local-vars (prim-mesh collide-shape-prim-mesh) (sv-32 type) (sv-48 collide-shape-moving)) (let ((cshape-moving (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape-moving dynam) (copy *standard-dynamics* 'process)) (set! (-> cshape-moving reaction) cshape-reaction-default) @@ -560,24 +540,23 @@ This commonly includes things such as: (s2-0 (car s3-0)) ) (while (not (null? s3-0)) - (let ((s1-0 (method-of-type collide-shape-prim-mesh new)) - (s0-0 'process) + (let ((prim-mesh (new + 'process + 'collide-shape-prim-mesh + cshape-moving + (the-as uint (command-get-int (car s2-0) 0)) + (the-as uint 0) + ) + ) ) - (set! sv-32 collide-shape-prim-mesh) - (set! sv-48 cshape-moving) - (let ((a3-2 (command-get-int (car s2-0) 0)) - (t0-1 0) - ) - (set! prim-mesh (s1-0 s0-0 sv-32 sv-48 (the-as uint a3-2) (the-as uint t0-1))) + (let ((s1-1 prim-mesh)) + (set! (-> s1-1 prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> s1-1 prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> s1-1 prim-core action) (-> prim-group prim-core action)) + (set! (-> s1-1 transform-index) (command-get-int (car (cdr s2-0)) 0)) ) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s2-0))) 0.0)) ) - (let ((s1-1 prim-mesh)) - (set! (-> s1-1 prim-core collide-as) (-> prim-group prim-core collide-as)) - (set! (-> s1-1 prim-core collide-with) (-> prim-group prim-core collide-with)) - (set! (-> s1-1 prim-core action) (-> prim-group prim-core action)) - (set! (-> s1-1 transform-index) (command-get-int (car (cdr s2-0)) 0)) - ) - (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s2-0))) 0.0)) (set! s3-0 (cdr s3-0)) (set! s2-0 (car s3-0)) ) @@ -596,7 +575,6 @@ This commonly includes things such as: (defmethod init-periodic-animation! ((this fort-floor-spike-c)) "Initialzes the periodic animation of the spikes (exit and re-entry)" - (local-vars (sv-64 cspace)) (let ((s5-0 3) (s4-0 5) ) @@ -626,12 +604,13 @@ This commonly includes things such as: (s1-0 18) ) (dotimes (s0-0 (+ (- 1 s2-0) s1-0)) - (set! sv-64 (-> this node-list data (+ s2-0 s0-0))) - (vector<-cspace! (-> s3-0 s0-0) sv-64) - (set! (-> s3-0 s0-0 y) 0.0) - (set! (-> sv-64 param0) joint-mod-set-y-callback) - (set! (-> sv-64 param1) (the-as basic s3-0)) - (set! (-> sv-64 param2) (the-as basic s0-0)) + (let ((sv-64 (-> this node-list data (+ s2-0 s0-0)))) + (vector<-cspace! (-> s3-0 s0-0) sv-64) + (set! (-> s3-0 s0-0 y) 0.0) + (set! (-> sv-64 param0) joint-mod-set-y-callback) + (set! (-> sv-64 param1) (the-as basic s3-0)) + (set! (-> sv-64 param2) (the-as basic s0-0)) + ) ) ) (dotimes (s3-1 s5-0) diff --git a/goal_src/jak2/levels/common/entities/gun-buoy.gc b/goal_src/jak2/levels/common/entities/gun-buoy.gc index 228a91be97..72027cce7e 100644 --- a/goal_src/jak2/levels/common/entities/gun-buoy.gc +++ b/goal_src/jak2/levels/common/entities/gun-buoy.gc @@ -51,13 +51,9 @@ (s4-0 (new 'stack-no-clear 'vector)) ) (set! (-> s4-0 quad) (-> s5-0 transv quad)) - (let* ((f30-0 (vector-length s4-0)) - (s1-0 *target*) - (a0-2 (if (type? s1-0 process-focusable) - s1-0 - ) - ) - ) + (let ((f30-0 (vector-length s4-0)) + (a0-2 (the-as target (as-type *target* process-focusable))) + ) (when a0-2 (let ((s1-1 (new 'stack-no-clear 'vector))) (set! (-> s1-1 quad) (-> (get-trans a0-2 0) quad)) @@ -423,7 +419,6 @@ (defstate ambush (gun-buoy) :virtual #t :enter (behavior () - (local-vars (sv-80 vector)) (let ((v1-0 self)) (set! (-> v1-0 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-0 enemy-flags)))) ) @@ -439,12 +434,7 @@ (nav-enemy-method-166 self) (logior! (-> self flags) (gun-buoy-flags gubflags-0)) (logior! (-> self water flags) (water-flags touch-water)) - (let* ((gp-0 *target*) - (s3-0 (if (type? gp-0 process-focusable) - gp-0 - ) - ) - ) + (let ((s3-0 (the-as target (as-type *target* process-focusable)))) (cond (s3-0 (let ((s4-0 (new 'stack-no-clear 'vector))) @@ -453,14 +443,10 @@ (s5-0 (-> self offset-from-player)) ) (set! (-> s4-0 y) (fmax (-> s4-0 y) (-> s3-0 water height))) - (let ((s2-0 vector-xz-normalize-copy!) - (s1-0 s5-0) - (s0-0 vector-z-quaternion!) - ) - (set! sv-80 (new 'stack-no-clear 'vector)) - (let ((a1-7 (get-quat s3-0 2))) - (s2-0 s1-0 (s0-0 sv-80 a1-7) 81920.0) - ) + (vector-xz-normalize-copy! + s5-0 + (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat s3-0 2)) + 81920.0 ) (set! (-> s5-0 y) -819.2) (let ((s3-2 (vector+! (new 'stack-no-clear 'vector) s4-0 s5-0))) @@ -517,7 +503,7 @@ ) ) (let ((f30-0 (- 1.0 (fabs (/ (-> self y-offset) (meters 20)))))) - (let ((f0-7 (* f30-0 f30-0))) + (let ((f0-7 (square f30-0))) (set-vector! (-> self root scale) f30-0 f30-0 f30-0 1.0) (let ((t9-1 vector-lerp!) (a0-2 (-> self draw color-mult)) @@ -553,7 +539,7 @@ :post (behavior () (seek! (-> self y-offset) -81920.0 (* 49152.0 (seconds-per-frame))) (let ((f30-0 (- 1.0 (fabs (/ (-> self y-offset) (meters 20)))))) - (let ((f0-5 (* f30-0 f30-0))) + (let ((f0-5 (square f30-0))) (set-vector! (-> self root scale) f30-0 f30-0 f30-0 1.0) (let ((t9-1 vector-lerp!) (a0-2 (-> self draw color-mult)) @@ -586,12 +572,7 @@ (ja-channel-push! 1 (seconds 0.075)) (let ((f30-0 (rnd-float-range self 0.8 1.2))) (new 'stack-no-clear 'vector) - (let* ((gp-0 (handle->process (-> self focus handle))) - (a0-6 (if (type? gp-0 process-focusable) - gp-0 - ) - ) - ) + (let ((a0-6 (the-as process (as-type (handle->process (-> self focus handle)) process-focusable)))) (if (and a0-6 (focus-test? (the-as process-focusable a0-6) board)) (set! f30-0 (* 2.0 f30-0)) ) @@ -676,12 +657,7 @@ (set! (-> self warning-interval) (seconds 0.1)) ) (else - (let* ((gp-0 (handle->process (-> self focus handle))) - (v1-6 (if (type? gp-0 process-focusable) - gp-0 - ) - ) - ) + (let ((v1-6 (the-as process (as-type (handle->process (-> self focus handle)) process-focusable)))) (cond ((focus-test? (the-as process-focusable v1-6) board) (set! (-> self warning-interval) (seconds 0.5)) @@ -777,13 +753,9 @@ ) ) ) - (let ((gp-0 *target*)) - (if (if (type? gp-0 process-focusable) - gp-0 - ) - (go-virtual attack) - ) - ) + (if (the-as target (as-type *target* process-focusable)) + (go-virtual attack) + ) ) ) :code sleep-code @@ -800,12 +772,7 @@ ) ) ) - (let* ((s5-0 (handle->process (-> self focus handle))) - (gp-0 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((gp-0 (the-as process (as-type (handle->process (-> self focus handle)) process-focusable)))) (if (and gp-0 (focus-test? (the-as process-focusable gp-0) dead)) (go-virtual victory) ) @@ -816,12 +783,7 @@ ) :code (behavior () (dotimes (gp-0 4) - (let* ((s5-0 *target*) - (a1-1 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((a1-1 (the-as target (as-type *target* process-focusable)))) (if a1-1 (gun-buoy-method-183 self a1-1) ) @@ -886,12 +848,7 @@ - looks at the target and handles attacking @TODO Not extremely well understood yet" (-> this root) - (let* ((s4-0 *target*) - (s5-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (let ((s5-0 (the-as target (as-type *target* process-focusable)))) (cond (s5-0 (let* ((s2-1 (vector-normalize-copy! @@ -985,22 +942,18 @@ (-> this fact) (let ((v1-10 (or (not (and (-> this next-state) (= (-> this next-state name) 'dormant-aware))) - (let ((s2-0 arg0)) - (cond - ((if (type? s2-0 target) - s2-0 - ) - (let ((v1-12 arg0)) - (and v1-12 - (or (focus-test? v1-12 on-water under-water) - (= (-> (the-as collide-shape-moving (-> v1-12 root)) ground-pat material) (pat-material waterbottom)) - ) - ) - ) + (cond + ((the-as process-focusable (as-type arg0 target)) + (let ((v1-12 arg0)) + (and v1-12 + (or (focus-test? v1-12 on-water under-water) + (= (-> (the-as collide-shape-moving (-> v1-12 root)) ground-pat material) (pat-material waterbottom)) + ) + ) ) - (else - (< f30-0 (+ 16384.0 f28-0)) - ) + ) + (else + (< f30-0 (+ 16384.0 f28-0)) ) ) ) @@ -1009,10 +962,7 @@ (and v1-10 (begin (set! f30-1 (-> this enemy-info notice-nav-radius)) - (set! v1-19 (if (type? arg0 target) - arg0 - ) - ) + (set! v1-19 (the-as process-focusable (as-type arg0 target))) v1-19 ) (and (and v1-19 @@ -1020,11 +970,9 @@ (= (-> (the-as collide-shape-moving (-> v1-19 root)) ground-pat material) (pat-material waterbottom)) ) ) - (let ((f0-2 f30-1)) - (or (>= (* f0-2 f0-2) (vector-vector-xz-distance-squared (-> s4-0 trans) arg1)) - (is-in-mesh? (-> this nav) arg1 f30-1) - ) - ) + (or (>= (square f30-1) (vector-vector-xz-distance-squared (-> s4-0 trans) arg1)) + (is-in-mesh? (-> this nav) arg1 f30-1) + ) ) ) ) diff --git a/goal_src/jak2/levels/common/entities/spydroid.gc b/goal_src/jak2/levels/common/entities/spydroid.gc index 587970db7e..862ba681f9 100644 --- a/goal_src/jak2/levels/common/entities/spydroid.gc +++ b/goal_src/jak2/levels/common/entities/spydroid.gc @@ -721,86 +721,94 @@ (defmethod general-event-handler ((this spydroid) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy @TODO - unsure if there is a pattern for the events and this should have a more specific name" - (local-vars (v1-6 vector) (sv-144 vector)) - (rlet ((vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - ) - (init-vf0-vector) - (case arg2 - (('touch 'bonk 'attack) - (set! sv-144 (the-as vector (send-event (ppointer->process (-> this parent)) 'widow-get-center))) - (let ((s0-0 (the-as process (as-type arg0 process-drawable)))) - (let ((v1-5 sv-144)) - (b! (not v1-5) cfg-15 :likely-delay (set! v1-6 sv-144)) + (local-vars (v1-6 vector)) + (with-pp + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) ) - (set! v1-6 (the-as vector s0-0)) - (label cfg-15) - (cond - (v1-6 - (let ((v1-9 (vector-! (new 'stack-no-clear 'vector) (-> this root trans) sv-144)) - (s1-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> s1-1 x) (- (-> v1-9 z))) - (set! (-> s1-1 y) 0.0) - (set! (-> s1-1 z) (-> v1-9 x)) - (set! (-> s1-1 w) 1.0) - (let ((v1-12 - (vector-! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s0-0) root trans) (-> this root trans)) + (init-vf0-vector) + (case arg2 + (('touch 'bonk 'attack) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer pp)) + (set! (-> a1-3 num-params) 0) + (set! (-> a1-3 message) 'widow-get-center) + (let ((sv-144 (the-as vector (send-event-function (ppointer->process (-> this parent)) a1-3))) + (s0-0 (the-as process (as-type arg0 process-drawable))) + ) + (let ((v1-5 sv-144)) + (b! (not v1-5) cfg-15 :likely-delay (set! v1-6 sv-144)) + ) + (set! v1-6 (the-as vector s0-0)) + (label cfg-15) + (cond + (v1-6 + (let ((v1-9 (vector-! (new 'stack-no-clear 'vector) (-> this root trans) sv-144)) + (s1-1 (new 'stack-no-clear 'vector)) ) + (set! (-> s1-1 x) (- (-> v1-9 z))) + (set! (-> s1-1 y) 0.0) + (set! (-> s1-1 z) (-> v1-9 x)) + (set! (-> s1-1 w) 1.0) + (let ((v1-12 + (vector-! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s0-0) root trans) (-> this root trans)) + ) + ) + (set! (-> s1-1 y) 0.0) + (set! (-> v1-12 y) 0.0) + (if (< (vector-dot v1-12 s1-1) 0.0) + (vector-negate! s1-1 s1-1) + ) ) - (set! (-> s1-1 y) 0.0) - (set! (-> v1-12 y) 0.0) - (if (< (vector-dot v1-12 s1-1) 0.0) - (vector-negate! s1-1 s1-1) + (vector-normalize! s1-1 16384.0) + (vector+! s1-1 s1-1 (-> (the-as process-drawable s0-0) root trans)) + (vector-! s1-1 s1-1 sv-144) + (set! (-> s1-1 y) 0.0) + (vector-normalize! s1-1 204800.0) + (let ((v1-17 s1-1)) + (let ((a0-19 s1-1)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-19 quad)) + ) + (.lvf vf5 (&-> (the-as vector sv-144) quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-17 quad) vf6) ) - ) - (vector-normalize! s1-1 16384.0) - (vector+! s1-1 s1-1 (-> (the-as process-drawable s0-0) root trans)) - (vector-! s1-1 s1-1 sv-144) - (set! (-> s1-1 y) 0.0) - (vector-normalize! s1-1 204800.0) - (let ((v1-17 s1-1)) - (let ((a0-19 s1-1)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-19 quad)) + (vector-! s1-1 s1-1 (-> (the-as process-drawable s0-0) root trans)) + (set! (-> s1-1 y) 8192.0) + (send-event arg0 'attack #f (static-attack-info ((id (new-attack-id)) (mode 'shock) (vector s1-1)))) + ) + ) + (else + (send-event + arg0 + 'attack + #f + (static-attack-info ((id (new-attack-id)) (mode 'shock) (shove-up (meters 2)) (shove-back (meters 4)))) ) - (.lvf vf5 (&-> (the-as vector sv-144) quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-17 quad) vf6) ) - (vector-! s1-1 s1-1 (-> (the-as process-drawable s0-0) root trans)) - (set! (-> s1-1 y) 8192.0) - (send-event arg0 'attack #f (static-attack-info ((id (new-attack-id)) (mode 'shock) (vector s1-1)))) - ) - ) - (else - (send-event - arg0 - 'attack - #f - (static-attack-info ((id (new-attack-id)) (mode 'shock) (shove-up (meters 2)) (shove-back (meters 4)))) ) ) ) + (let ((v1-30 (the-as object (-> arg3 param 1)))) + (if (or (!= arg0 *target*) (and (= arg2 'attack) + (logtest? (attack-mask penetrate-using) (-> (the-as attack-info v1-30) mask)) + (logtest? (penetrate dark-bomb) (-> (the-as attack-info v1-30) penetrate-using)) + ) + ) + ((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3) + ) + ) ) - (let ((v1-30 (the-as object (-> arg3 param 1)))) - (if (or (!= arg0 *target*) (and (= arg2 'attack) - (logtest? (attack-mask penetrate-using) (-> (the-as attack-info v1-30) mask)) - (logtest? (penetrate dark-bomb) (-> (the-as attack-info v1-30) penetrate-using)) - ) - ) - ((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3) - ) + (('jump) + (set! (-> this floor) (-> (the-as vector (-> arg3 param 1)) y)) + ((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3) ) - ) - (('jump) - (set! (-> this floor) (-> (the-as vector (-> arg3 param 1)) y)) - ((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3) - ) - (else - ((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3) + (else + ((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3) + ) ) ) ) @@ -1016,11 +1024,9 @@ (let ((a0-1 (handle->process (-> self focus handle)))) (if (and (time-elapsed? (-> self state-time) (-> self reaction-time)) (and a0-1 - (let ((f0-0 (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (-> self root trans))) - (f1-0 16384.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (-> self root trans)) + (square 16384.0) + ) ) ) (go-virtual attack) diff --git a/goal_src/jak2/levels/common/race/race-hud.gc b/goal_src/jak2/levels/common/race/race-hud.gc index db869f81a8..cfa1f742ad 100644 --- a/goal_src/jak2/levels/common/race/race-hud.gc +++ b/goal_src/jak2/levels/common/race/race-hud.gc @@ -8,13 +8,9 @@ ;; DECOMP BEGINS (defmethod draw ((this hud-race-timer)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - 0 - (the int (+ 20.0 (* -100.0 (-> this offset)))) - ) + (set-hud-piece-position! (-> this sprites 0) 0 (the int (+ 20.0 (* -100.0 (-> this offset))))) (format (clear (-> this strings 0 text)) "~2,'0D:" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) 60 5) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) 60 5) (format (clear (-> this strings 1 text)) "~2,'0D:" (-> this values 1 current)) (set-as-offset-from! (the-as hud-sprite (-> this strings 1 pos)) @@ -29,18 +25,16 @@ 28 0 ) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites)) 128 0) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) 128 0) ((method-of-type hud draw) this) 0 (none) ) (defmethod update-values ((this hud-race-timer)) - (set! (-> this values 0 target) (/ (the-as int (-> *game-info* race-timer)) (seconds 60))) - (set! (-> this values 1 target) (/ (mod (the-as int (-> *game-info* race-timer)) (seconds 60)) (seconds 1))) - ;(set! (-> this values 2 target) (/ (mod (mod (the-as int (-> *game-info* race-timer)) (seconds 60)) (seconds 1)) (/ (seconds 1) 60))) - ;; og:preserve-this fix wrong hundredths counter... - (set! (-> this values 2 target) (/ (mod (mod (the-as int (-> *game-info* race-timer)) (seconds 60)) (seconds 1)) (seconds 0.01))) + (set! (-> this values 0 target) (/ (the-as int (-> *game-info* race-timer)) #x4650)) + (set! (-> this values 1 target) (/ (mod (the-as int (-> *game-info* race-timer)) #x4650) 300)) + (set! (-> this values 2 target) (/ (mod (mod (the-as int (-> *game-info* race-timer)) #x4650) 300) 5)) (logclear! (-> this flags) (hud-flags disable)) ((method-of-type hud update-values) this) 0 @@ -72,16 +66,12 @@ ) (defmethod draw ((this hud-race-lap-counter)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - 504 - (the int (+ 20.0 (* -100.0 (-> this offset)))) - ) + (set-hud-piece-position! (-> this sprites 0) 504 (the int (+ 20.0 (* -100.0 (-> this offset))))) (set! (-> this strings 0 scale) 0.55) (format (clear (-> this strings 0 text)) "~D/~D" (-> this values 0 current) (-> this values 1 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -40 5) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites)) -20 0) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites 1)) -50 0) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -40 5) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) -20 0) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 1 pos) -50 0) ((method-of-type hud draw) this) 0 (none) @@ -113,16 +103,12 @@ ) (defmethod draw ((this hud-race-turbo-counter)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - 224 - (the int (+ 25.0 (* -100.0 (-> this offset)))) - ) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites)) 0 0) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites 1)) 32 0) - (set-as-offset-from! (-> this sprites 3) (the-as vector4w (-> this sprites 1)) 32 0) - (set-as-offset-from! (-> this sprites 4) (the-as vector4w (-> this sprites 2)) 32 0) - (set-as-offset-from! (-> this sprites 5) (the-as vector4w (-> this sprites 2)) 32 0) + (set-hud-piece-position! (-> this sprites 0) 224 (the int (+ 25.0 (* -100.0 (-> this offset))))) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) 0 0) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 1 pos) 32 0) + (set-as-offset-from! (-> this sprites 3) (-> this sprites 1 pos) 32 0) + (set-as-offset-from! (-> this sprites 4) (-> this sprites 2 pos) 32 0) + (set-as-offset-from! (-> this sprites 5) (-> this sprites 2 pos) 32 0) (let* ((v1-2 (-> this values 0 current)) (f0-3 (if (> v1-2 0) 1.0 @@ -178,18 +164,14 @@ (defmethod draw ((this hud-race-position)) (local-vars (s5-0 int)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - 24 - (the int (+ 324.0 (* 100.0 (-> this offset)))) - ) - (set-as-offset-from! (-> this sprites 1) (the-as vector4w (-> this sprites)) 0 0) - (set-as-offset-from! (-> this sprites 2) (the-as vector4w (-> this sprites)) 0 0) - (set-as-offset-from! (-> this sprites 3) (the-as vector4w (-> this sprites)) 0 0) - (set-as-offset-from! (-> this sprites 4) (the-as vector4w (-> this sprites)) 0 0) - (set-as-offset-from! (-> this sprites 5) (the-as vector4w (-> this sprites)) 0 0) - (set-as-offset-from! (-> this sprites 6) (the-as vector4w (-> this sprites)) 0 0) - (set-as-offset-from! (-> this sprites 7) (the-as vector4w (-> this sprites)) 0 0) + (set-hud-piece-position! (-> this sprites 0) 24 (the int (+ 324.0 (* 100.0 (-> this offset))))) + (set-as-offset-from! (-> this sprites 1) (-> this sprites 0 pos) 0 0) + (set-as-offset-from! (-> this sprites 2) (-> this sprites 0 pos) 0 0) + (set-as-offset-from! (-> this sprites 3) (-> this sprites 0 pos) 0 0) + (set-as-offset-from! (-> this sprites 4) (-> this sprites 0 pos) 0 0) + (set-as-offset-from! (-> this sprites 5) (-> this sprites 0 pos) 0 0) + (set-as-offset-from! (-> this sprites 6) (-> this sprites 0 pos) 0 0) + (set-as-offset-from! (-> this sprites 7) (-> this sprites 0 pos) 0 0) (let ((v1-2 (-> this values 0 current))) (dotimes (a0-9 16) (set! (-> this sprites a0-9 scale-x) (if (= a0-9 v1-2) @@ -223,7 +205,7 @@ ) (set-as-offset-from! (-> this sprites s5-0) - (the-as vector4w (-> this sprites v1-2)) + (-> this sprites v1-2 pos) (if (zero? v1-2) 28 52 @@ -285,13 +267,7 @@ ) (defmethod draw ((this hud-race-final-stats)) - (local-vars - (s0-0 int) - (sv-112 (function string font-context symbol int bucket-id float)) - (sv-128 (function string font-context symbol int bucket-id float)) - (sv-144 string) - (sv-160 string) - ) + (local-vars (s0-0 int)) (let* ((v1-0 *race-state*) (s5-0 (-> v1-0 racer-array (-> v1-0 i-player))) ) @@ -311,60 +287,32 @@ (set! (-> this strings 0 scale) 0.0) (set! (-> s1-0 origin x) 45.0) (set! (-> s1-0 origin y) 20.0) - (let ((v1-15 s1-0)) - (set! (-> v1-15 width) (the float 422)) - ) - (let ((v1-16 s1-0)) - (set! (-> v1-16 height) (the float 80)) - ) + (set-width! s1-0 422) + (set-height! s1-0 80) (let ((a0-12 s1-0)) (set! (-> a0-12 color) (font-color red)) ) (let ((a0-13 s1-0)) (set! (-> a0-13 flags) (font-flags kerning middle middle-vert large)) ) - (let ((v1-19 s1-0)) - (set! (-> v1-19 scale) 1.0) - ) + (set-scale! s1-0 1.0) (cond ((zero? (-> s5-0 finish-count)) (set! s0-0 80) - (let ((v1-21 s1-0)) - (set! (-> v1-21 scale) 1.6) - ) - (when (text-language? german) ;; og:preserve-this text-language patch - (let ((v1-24 s1-0)) - (set! (-> v1-24 scale) 1.0) + (set-scale! s1-0 1.6) + (if (= (-> *setting-control* user-default language) (language-enum german)) + (set-scale! s1-0 1.0) ) - ) - (set! sv-112 print-game-text) - (let ((a0-20 (lookup-text! *common-text* (text-id race-you-win) #f)) - (a2-2 #f) - (a3-1 44) - (t0-1 320) - ) - (sv-112 a0-20 s1-0 a2-2 a3-1 (the-as bucket-id t0-1)) - ) + (print-game-text (lookup-text! *common-text* (text-id race-you-win) #f) s1-0 #f 44 (bucket-id progress)) ) (else (set! s0-0 80) - (let ((v1-27 s1-0)) - (set! (-> v1-27 scale) 1.6) - ) - (when (text-language? german) ;; og:preserve-this text-language patch - (let ((v1-30 s1-0)) - (set! (-> v1-30 scale) 1.0) + (set-scale! s1-0 1.6) + ;; og:preserve-this + (if (text-language? german) + (set-scale! s1-0 1.0) ) - ) - (set! sv-128 print-game-text) - (let ((a0-26 (lookup-text! *common-text* (text-id race-you-lose) #f)) - (a1-5 s1-0) - (a2-4 #f) - (a3-2 44) - (t0-2 320) - ) - (sv-128 a0-26 a1-5 a2-4 a3-2 (the-as bucket-id t0-2)) - ) + (print-game-text (lookup-text! *common-text* (text-id race-you-lose) #f) s1-0 #f 44 (bucket-id progress)) ) ) ) @@ -374,16 +322,14 @@ 128 (the int (+ (- 188.0 (the float s0-0)) (* -100.0 (-> this offset)))) ) - (let ((s1-1 format)) - (set! sv-144 (clear (-> this strings 1 text))) - (let* ((a0-29 *common-text*) - (t9-7 (method-of-object a0-29 lookup-text!)) - (a1-7 375) - (a2-6 #f) - (a1-8 (t9-7 a0-29 (the-as text-id a1-7) a2-6)) - ) - (s1-1 sv-144 a1-8 (the-as none a2-6)) - ) + (let* ((s1-1 format) + (sv-144 (clear (-> this strings 1 text))) + (a0-29 *common-text*) + (t9-7 (method-of-object a0-29 lookup-text!)) + (a1-7 375) + (a2-6 #f) + ) + (s1-1 sv-144 (t9-7 a0-29 (the-as text-id a1-7) a2-6) (the-as none a2-6)) ) (set-hud-piece-position! (the-as hud-sprite (-> this strings 2 pos)) @@ -404,15 +350,11 @@ 5 (+ (* 28 s4-0) 40) ) - (let ((s1-3 format) - (s0-1 (clear (-> this strings s3-0 text))) - ) - (set! sv-160 "~S~D") - (let ((a2-10 (lookup-text! *common-text* (text-id race-lap) #f)) - (a3-4 (+ s4-0 1)) - ) - (s1-3 s0-1 sv-160 a2-10 a3-4) - ) + (format + (clear (-> this strings s3-0 text)) + "~S~D" + (lookup-text! *common-text* (text-id race-lap) #f) + (+ s4-0 1) ) (let ((s3-1 (+ s3-0 1))) (set! (-> this strings s3-1 scale) 0.5) diff --git a/goal_src/jak2/levels/common/race/race-manager.gc b/goal_src/jak2/levels/common/race/race-manager.gc index 85a7713ed5..52bbf57a27 100644 --- a/goal_src/jak2/levels/common/race/race-manager.gc +++ b/goal_src/jak2/levels/common/race/race-manager.gc @@ -90,13 +90,9 @@ ) ) (vector-normalize! (-> this finish-dir) 1.0) - (let ((f0-18 (vector-vector-distance-squared (-> this start-sphere) (-> this finish-sphere))) - (f1-2 163840.0) - ) - (if (< f0-18 (* f1-2 f1-2)) - (logior! (-> gp-0 flags) (race-mesh-flags racemeshflag-0)) - ) - ) + (if (< (vector-vector-distance-squared (-> this start-sphere) (-> this finish-sphere)) (square 163840.0)) + (logior! (-> gp-0 flags) (race-mesh-flags racemeshflag-0)) + ) ) ) ) @@ -256,13 +252,11 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov a0-29 vf1) - (let ((f0-7 a0-29) - (f1-1 (-> arg0 info finish-sphere r)) - ) - (if (and (< f0-7 (* f1-1 f1-1)) (< 0.0 (vector-dot (the-as vector (&-> v1-39 x)) (-> arg0 info finish-dir)))) - (end-lap this arg0) - ) - ) + (if (and (< a0-29 (square (-> arg0 info finish-sphere r))) + (< 0.0 (vector-dot (the-as vector (&-> v1-39 x)) (-> arg0 info finish-dir))) + ) + (end-lap this arg0) + ) ) ) (else @@ -540,7 +534,7 @@ ) (cubic-curve-method-9 (-> this player-intro-curve) - (the-as vector (-> v1-27 vector)) + (-> v1-27 vector 0) (-> v1-27 vector 2) (-> v1-27 vector 1) (-> v1-27 trans) @@ -586,13 +580,11 @@ ) ) (((race-state-enum player-get-on)) - (let* ((f30-0 (* 0.0033333334 (the float (- (-> this current-time) (-> this countdown-start-time))))) - (s4-0 (handle->process (-> this racer-array (-> this i-player) racer))) - (s5-1 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) + (let ((f30-0 (* 0.0033333334 (the float (- (-> this current-time) (-> this countdown-start-time))))) + (s5-1 + (the-as process (as-type (handle->process (-> this racer-array (-> this i-player) racer)) process-focusable)) + ) + ) (cond ((< f30-0 1.0) (when s5-1 @@ -615,12 +607,10 @@ ) ) (((race-state-enum player-set-pos)) - (let* ((s4-2 (handle->process (-> this racer-array (-> this i-player) racer))) - (s5-3 (if (type? s4-2 process-focusable) - s4-2 - ) - ) - ) + (let ((s5-3 + (the-as process (as-type (handle->process (-> this racer-array (-> this i-player) racer)) process-focusable)) + ) + ) (when s5-3 (cubic-curve-method-10 (-> this player-intro-curve) (-> (the-as process-focusable s5-3) root trans) 1.0) (vector-reset! (-> (the-as process-focusable s5-3) root transv)) @@ -777,9 +767,7 @@ ) (+! (-> s4-0 vector 0 y) 22528.0) (set! (-> this race-signal) - (process->handle - (race-signal-spawn s5-1 (the-as vector (-> s4-0 vector)) (the-as quaternion (-> s4-0 vector 1))) - ) + (process->handle (race-signal-spawn s5-1 (-> s4-0 vector 0) (the-as quaternion (-> s4-0 vector 1)))) ) ) ) @@ -955,14 +943,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count] (defmethod initialize-state ((this race-manager)) - (local-vars - (v1-0 int) - (sv-352 task-arrow-params) - (sv-368 (function process type traffic-object-spawn-params process-drawable)) - (sv-384 race-manager) - (sv-400 process-drawable) - (sv-416 int) - ) + (local-vars (v1-0 int) (sv-416 int)) (.mfc0 v1-0 Count) (rigid-body-queue-manager-spawn *race-rigid-body-queue* this) (let* ((gp-0 (-> this race-state)) @@ -1050,15 +1031,12 @@ (logtest? (-> s3-0 flags) (race-info-flags city-race)) ) ) - (set! sv-352 (new 'stack-no-clear 'task-arrow-params)) - (set! (-> sv-352 pos quad) (-> gp-0 info player-intro-pos quad)) - (quaternion-identity! (-> sv-352 quat)) - (set! (-> sv-352 flags) (task-arrow-flags)) - (set! (-> sv-352 map-icon) (the-as uint 15)) - (let ((t9-11 task-arrow-spawn) - (a1-17 this) - ) - (set! (-> gp-0 arrow) (process->handle (t9-11 sv-352 a1-17))) + (let ((sv-352 (new 'stack-no-clear 'task-arrow-params))) + (set! (-> sv-352 pos quad) (-> gp-0 info player-intro-pos quad)) + (quaternion-identity! (-> sv-352 quat)) + (set! (-> sv-352 flags) (task-arrow-flags)) + (set! (-> sv-352 map-icon) (the-as uint 15)) + (set! (-> gp-0 arrow) (process->handle (task-arrow-spawn sv-352 this))) ) (set! (-> s4-0 params position quad) (-> gp-0 info player-intro-pos quad)) (+! (-> s4-0 params position y) 12288.0) @@ -1081,40 +1059,27 @@ (logtest? (-> s1-0 flags) (racer-info-flags hide-in-scene)) ) ) - (set! sv-368 vehicle-spawn) - (set! sv-384 this) - (let ((a1-18 (type-from-race-vehicle-type (-> s1-0 vehicle))) - (a2-3 (-> s4-0 params)) - ) - (set! sv-400 (sv-368 sv-384 a1-18 a2-3)) - ) - (when sv-400 - (let ((a0-52 *minimap*) - (t9-14 (method-of-type minimap add-icon!)) - (a1-19 sv-400) - (a3-0 #f) - (t0-0 #t) - (t1-0 0) - ) - (t9-14 a0-52 a1-19 (the-as uint sv-416) (the-as int a3-0) (the-as vector t0-0) t1-0) - ) - (init-racer! s0-0 sv-400) - (set! (-> s0-0 rider) (-> s1-0 rider)) - (set! (-> s0-0 target-pos-offset) - (* (-> s3-0 ai-spread-factor) (+ (the float (-> s1-0 seek-offset)) (* -3.33 (-> gp-0 suck-factor)))) - ) - (when (and (= s2-1 (-> gp-0 i-player)) (logtest? (-> gp-0 flags) (race-flags pidax))) - (let ((v1-91 'pilot)) - (if (= (-> s1-0 rider) 1) - (set! v1-91 'pilot-daxter) + (let ((sv-400 (vehicle-spawn this (type-from-race-vehicle-type (-> s1-0 vehicle)) (-> s4-0 params)))) + (when sv-400 + (add-icon! *minimap* sv-400 (the-as uint sv-416) (the-as int #f) (the-as vector #t) 0) + (init-racer! s0-0 sv-400) + (set! (-> s0-0 rider) (-> s1-0 rider)) + (set! (-> s0-0 target-pos-offset) + (* (-> s3-0 ai-spread-factor) (+ (the float (-> s1-0 seek-offset)) (* -3.33 (-> gp-0 suck-factor)))) ) - (send-event *target* 'change-mode v1-91 sv-400 0 #t) + (when (and (= s2-1 (-> gp-0 i-player)) (logtest? (-> gp-0 flags) (race-flags pidax))) + (let ((v1-91 'pilot)) + (if (= (-> s1-0 rider) 1) + (set! v1-91 'pilot-daxter) + ) + (send-event *target* 'change-mode v1-91 sv-400 0 #t) + ) ) ) + (if (not sv-400) + (format 0 "failed to spawn racebike~%") + ) ) - (if (not sv-400) - (format 0 "failed to spawn racebike~%") - ) ) ) ) @@ -1128,7 +1093,6 @@ ) (defmethod save-score ((this race-manager) (arg0 float)) - (local-vars (sv-32 int)) (let* ((s5-0 (-> this race-state info score)) (s3-0 0) (s2-0 (-> *highscore-info-array* s5-0)) @@ -1139,12 +1103,13 @@ (dotimes (v1-5 4) (set! (-> s1-0 v1-5) 0) ) - (set! sv-32 0) - (while (< sv-32 8) - (let ((v1-13 (get-rank s2-0 (-> s0-0 sv-32)))) - (+! (-> s1-0 v1-13) 1) + (let ((sv-32 0)) + (while (< sv-32 8) + (let ((v1-13 (get-rank s2-0 (-> s0-0 sv-32)))) + (+! (-> s1-0 v1-13) 1) + ) + (+! sv-32 1) ) - (set! sv-32 (+ sv-32 1)) ) (dotimes (v1-20 4) (if (< 1 (-> s1-0 v1-20)) @@ -1226,15 +1191,9 @@ (new 'stack 'font-context *font-default-matrix* 70 20 0.0 (font-color orange) (font-flags shadow kerning)) ) ) - (let ((v1-4 gp-1)) - (set! (-> v1-4 scale) 0.7) - ) - (let ((v1-5 gp-1)) - (set! (-> v1-5 width) (the float 225)) - ) - (let ((v1-6 gp-1)) - (set! (-> v1-6 height) (the float 70)) - ) + (set-scale! gp-1 0.7) + (set-width! gp-1 225) + (set-height! gp-1 70) (set! (-> gp-1 origin x) (the float (- 256 (the int (/ (-> gp-1 width) 2))))) (set! (-> gp-1 origin y) 320.0) (set! (-> gp-1 flags) (font-flags shadow kerning middle middle-vert large)) @@ -1254,15 +1213,9 @@ (new 'stack 'font-context *font-default-matrix* 70 20 0.0 (font-color orange) (font-flags shadow kerning)) ) ) - (let ((v1-4 gp-1)) - (set! (-> v1-4 scale) 0.7) - ) - (let ((v1-5 gp-1)) - (set! (-> v1-5 width) (the float 240)) - ) - (let ((v1-6 gp-1)) - (set! (-> v1-6 height) (the float 35)) - ) + (set-scale! gp-1 0.7) + (set-width! gp-1 240) + (set-height! gp-1 35) (set! (-> gp-1 origin x) (the float (- 256 (the int (/ (-> gp-1 width) 2))))) (set! (-> gp-1 origin y) 320.0) (set! (-> gp-1 flags) (font-flags shadow kerning middle middle-vert large)) diff --git a/goal_src/jak2/levels/common/race/vehicle-racer.gc b/goal_src/jak2/levels/common/race/vehicle-racer.gc index 9ae11b540d..6eebfbc185 100644 --- a/goal_src/jak2/levels/common/race/vehicle-racer.gc +++ b/goal_src/jak2/levels/common/race/vehicle-racer.gc @@ -194,12 +194,7 @@ ) (t9-2 a0-4 (the-as race-path-sample a1-11) a2-2 a3-1) (let* ((f1-0 (vector-vector-distance-squared (-> gp-0 steering-axis) (-> gp-0 mat trans))) - (f0-3 0.0) - (f2-0 32768.0) - (f1-1 (- (* f2-0 f2-0) f1-0)) - (f2-3 1.0) - (f3-0 32768.0) - (f26-2 (* f26-1 (fmax f0-3 (* f1-1 (/ f2-3 (* f3-0 f3-0)))))) + (f26-2 (* f26-1 (fmax 0.0 (* (- (square 32768.0) f1-0) (/ 1.0 (square 32768.0)))))) ) 0 (let* ((f0-5 (vector-vector-distance (-> gp-0 mat vector 2) (-> gp-0 velocity))) @@ -530,7 +525,7 @@ (set! (-> s3-0 1 vector 1 x) 819200.0) (quaternion-copy! (the-as quaternion (-> s3-0 1)) (-> s5-0 path-sample quat)) (vector-float*! (-> s3-0 0 vector 2) (-> s5-0 lin-velocity) f28-0) - (vector-! (-> s3-0 0 trans) (the-as vector (-> s5-0 path-sample)) (-> s4-0 state position)) + (vector-! (-> s3-0 0 trans) (-> s5-0 path-sample pos) (-> s4-0 state position)) (.lvf vf1 (&-> (-> s3-0 0 trans) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -538,12 +533,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-18 vf1) - (let ((f0-6 v1-18) - (f1-5 1.0) - (f2-2 40960.0) - ) - (set! (-> this path-deviation) (* f0-6 (/ f1-5 (* f2-2 f2-2)))) - ) + (set! (-> this path-deviation) (* v1-18 (/ 1.0 (square 40960.0)))) (let ((a1-4 (-> s3-0 0 vector 2))) (let ((v1-22 (-> s3-0 0 vector 2))) (let ((a0-5 (-> s3-0 0 trans))) @@ -561,9 +551,7 @@ ) (vector-! (the-as vector (-> s3-0 0)) (-> s3-0 0 vector 2) (-> s4-0 state lin-velocity)) (vector-float*! (the-as vector (-> s3-0 0)) (the-as vector (-> s3-0 0)) 16.0) - (let* ((f0-10 (-> s3-0 1 vector 1 x)) - (f0-12 (* f0-10 f0-10)) - ) + (let ((f0-12 (square (-> s3-0 1 vector 1 x)))) (.lvf vf1 (&-> (-> s3-0 0) quad 0)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -701,12 +689,10 @@ (let ((f0-19 (+ (-> s5-0 path-t) (* 1.875 (/ 1.0 (-> s4-0 3 vector 0 z)) (-> s4-0 3 vector 0 y))))) (race-path-method-11 (-> s5-0 path) (the-as race-path-sample (-> s4-0 2 vector 1)) (-> s4-0 2 trans) f0-19) ) - (vector-! (-> s4-0 0 trans) (the-as vector (-> s5-0 path-sample)) (the-as vector (-> s4-0 0))) - (let* ((f0-20 (-> s4-0 3 vector 1 y)) - (f1-13 1.0) - (f2-4 40960.0) - (f1-14 (/ f1-13 (* f2-4 f2-4))) - ) + (vector-! (-> s4-0 0 trans) (-> s5-0 path-sample pos) (the-as vector (-> s4-0 0))) + (let ((f0-20 (-> s4-0 3 vector 1 y)) + (f1-14 (/ 1.0 (square 40960.0))) + ) (.lvf vf1 (&-> (-> s4-0 0 trans) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -716,16 +702,9 @@ (.mov v1-35 vf1) (set! (-> s4-0 3 vector 1 y) (+ f0-20 (* f1-14 v1-35))) ) - (let ((f30-0 (-> s4-0 3 vector 1 y)) - (f0-22 1.0) - (f1-16 40960.0) - ) - (set! (-> s4-0 3 vector 1 y) - (+ f30-0 - (* (/ f0-22 (* f1-16 f1-16)) (vector-vector-distance-squared (-> s5-0 lin-velocity) (-> s4-0 0 vector 1))) - ) - ) - ) + (+! (-> s4-0 3 vector 1 y) + (* (/ 1.0 (square 40960.0)) (vector-vector-distance-squared (-> s5-0 lin-velocity) (-> s4-0 0 vector 1))) + ) (set! (-> this path-deviation) (-> s4-0 3 vector 1 y)) (let ((a1-6 (-> s4-0 0 vector 2))) (let ((v1-39 (-> s4-0 2 trans))) @@ -793,35 +772,24 @@ ((logtest? (-> this rbody state flags) (rigid-body-flag enable-physics)) (if (and (logtest? (-> this flags) (rigid-body-object-flag on-ground)) (not (logtest? (rigid-body-object-flag turbo-boost) (-> this flags))) - (let ((f0-0 368640.0)) - (or (< (* f0-0 f0-0) (-> this player-dist2)) - (let ((f0-3 102400.0)) - (and (< (* f0-3 f0-3) (-> this player-dist2)) - (not (logtest? (-> this draw status) (draw-control-status on-screen))) - ) - ) - ) - ) + (or (< (square 368640.0) (-> this player-dist2)) + (and (< (square 102400.0) (-> this player-dist2)) + (not (logtest? (-> this draw status) (draw-control-status on-screen))) + ) + ) ) (rigid-body-object-method-39 this) ) ) (else - (let ((f0-6 (-> this player-dist2)) - (f1-2 348160.0) - ) - (if (and (< f0-6 (* f1-2 f1-2)) (let ((f0-7 (-> this player-dist2)) - (f1-5 81920.0) - ) - (or (< f0-7 (* f1-5 f1-5)) - (logtest? (-> this draw status) (draw-control-status on-screen)) - (logtest? (rigid-body-object-flag turbo-boost) (-> this flags)) - ) - ) - ) - (rigid-body-object-method-38 this) - ) - ) + (if (and (< (-> this player-dist2) (square 348160.0)) + (or (< (-> this player-dist2) (square 81920.0)) + (logtest? (-> this draw status) (draw-control-status on-screen)) + (logtest? (rigid-body-object-flag turbo-boost) (-> this flags)) + ) + ) + (rigid-body-object-method-38 this) + ) ) ) 0 @@ -831,8 +799,8 @@ (defmethod vehicle-racer-method-152 ((this vehicle-racer)) (let ((s5-0 (new 'stack-no-clear 'matrix3))) (set! (-> s5-0 vector 0 quad) (-> this rbody state position quad)) - (set! (-> this camera-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (camera-pos))) - (set! (-> this player-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (target-pos 0))) + (set! (-> this camera-dist2) (vector-vector-distance-squared (-> s5-0 vector 0) (camera-pos))) + (set! (-> this player-dist2) (vector-vector-distance-squared (-> s5-0 vector 0) (target-pos 0))) ) (if (time-elapsed? (-> this shortcut-time) (seconds 5)) (set! (-> this shortcut-speed-factor) 0.0) @@ -849,8 +817,8 @@ (defmethod vehicle-racer-method-155 ((this vehicle-racer)) (let ((s5-0 (new 'stack-no-clear 'matrix3))) (set! (-> s5-0 vector 0 quad) (-> this rbody state position quad)) - (set! (-> this camera-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (camera-pos))) - (set! (-> this player-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (target-pos 0))) + (set! (-> this camera-dist2) (vector-vector-distance-squared (-> s5-0 vector 0) (camera-pos))) + (set! (-> this player-dist2) (vector-vector-distance-squared (-> s5-0 vector 0) (target-pos 0))) ) (set! (-> this shortcut-speed-factor) 0.0) (vehicle-racer-method-154 this) diff --git a/goal_src/jak2/levels/consite/consite-scenes.gc b/goal_src/jak2/levels/consite/consite-scenes.gc index a6498f1b09..3f759e4b65 100644 --- a/goal_src/jak2/levels/consite/consite-scenes.gc +++ b/goal_src/jak2/levels/consite/consite-scenes.gc @@ -635,11 +635,6 @@ (defun movie-consite-metalkor-shot-draw-impact ((arg0 scene-player) (arg1 vector) (arg2 vector)) "TODO - cutscenes/docs" - (local-vars - (sv-240 (function vector entity-actor skeleton-group vector object none :behavior manipy)) - (sv-256 vector) - (sv-272 entity-actor) - ) (let ((v0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) arg2 arg1) 2048.0)) (gp-0 (new 'stack-no-clear 'vector)) ) @@ -703,36 +698,18 @@ (matrix->quaternion gp-1 s2-0) ) (sound-play "nboss-shoot-hit") - (let* ((s1-2 (get-process *default-dead-pool* manipy #x4000)) - (s2-2 (when s1-2 - (let ((t9-10 (method-of-type manipy activate))) - (t9-10 (the-as manipy s1-2) arg0 (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s2-3 run-function-in-process) - (s0-1 s1-2) - ) - (set! sv-240 manipy-init) - (set! sv-256 s4-1) - (set! sv-272 (-> arg0 entity)) - (let ((t0-2 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f))) - (t1-2 #f) - (t2-2 0) - ) - ((the-as (function object object object object object object object none) s2-3) - s0-1 - sv-240 - sv-256 - sv-272 - t0-2 - t1-2 - t2-2 - ) - ) - ) - (-> s1-2 ppointer) - ) - ) - ) + (let ((s2-2 (process-spawn + manipy + :init manipy-init + s4-1 + (-> arg0 entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to arg0 + ) + ) + ) (when s2-2 (send-event (ppointer->process s2-2) 'anim-mode 'play1) (send-event (ppointer->process s2-2) 'anim "idle") diff --git a/goal_src/jak2/levels/demo/demo-obs.gc b/goal_src/jak2/levels/demo/demo-obs.gc index 3a9ed12df5..b9225daa56 100644 --- a/goal_src/jak2/levels/demo/demo-obs.gc +++ b/goal_src/jak2/levels/demo/demo-obs.gc @@ -65,9 +65,9 @@ ;; WARN: Return type mismatch time-frame vs none. (defun demo-plug-lightning ((arg0 process-drawable) (arg1 vector) (arg2 cspace)) - (local-vars (sv-32 cspace) (sv-48 int) (sv-64 symbol) (sv-80 int) (sv-96 vector)) - (set! sv-32 arg2) - (let ((s5-0 (get-process *default-dead-pool* lightning-tracker #x4000))) + (let ((sv-32 arg2) + (s5-0 (get-process *default-dead-pool* lightning-tracker #x4000)) + ) (when s5-0 (let ((t9-1 (method-of-type lightning-tracker activate))) (t9-1 @@ -81,11 +81,11 @@ (s2-0 s5-0) (s1-0 lightning-tracker-init) (s0-0 (-> *lightning-spec-id-table* 1)) + (sv-48 30) + (sv-64 (the-as symbol #f)) + (sv-80 (+ (-> sv-32 joint number) 1)) + (sv-96 (new 'stack-no-clear 'vector)) ) - (set! sv-48 30) - (set! sv-64 (the-as symbol #f)) - (set! sv-80 (+ (-> sv-32 joint number) 1)) - (set! sv-96 (new 'stack-no-clear 'vector)) (set! (-> sv-96 x) (+ (-> arg1 x) (rand-vu-float-range -4096.0 4096.0))) (set! (-> sv-96 y) (+ (-> arg1 y) (rand-vu-float-range -4096.0 4096.0))) (set! (-> sv-96 z) (+ (-> arg1 z) (rand-vu-float-range -4096.0 4096.0))) @@ -483,7 +483,6 @@ ;; WARN: Return type mismatch int vs object. ;; WARN: new jak 2 until loop case, check carefully (defbehavior demo-menu demo-control () - (local-vars (sv-112 font-context)) (sound-play "dmenu-hit") (let ((gp-1 (cond ((= *kernel-boot-message* 'demo-shared) @@ -523,24 +522,22 @@ (return (the-as object (-> self selected))) ) ) - (set! sv-112 - (new 'stack 'font-context *font-default-matrix* 64 312 0.0 (font-color default) (font-flags shadow kerning)) + (let ((sv-112 + (new 'stack 'font-context *font-default-matrix* 64 312 0.0 (font-color default) (font-flags shadow kerning)) + ) ) - (let ((v1-25 sv-112)) - (set! (-> v1-25 width) (the float 384)) - ) - (let ((v1-26 sv-112)) - (set! (-> v1-26 height) (the float 50)) - ) - (set! (-> sv-112 flags) (font-flags shadow kerning middle middle-vert large)) - (set! (-> sv-112 scale) 0.7) - (dotimes (s5-4 (-> gp-1 length)) - (if (= (-> self selected) s5-4) - (set! (-> sv-112 color) (font-color progress-old-selected)) - (set! (-> sv-112 color) (font-color white)) - ) - (print-game-text (lookup-text! *common-text* (-> gp-1 s5-4) #f) sv-112 #f 44 (bucket-id progress)) - (+! (-> sv-112 origin y) 22.0) + (set-width! sv-112 384) + (set-height! sv-112 50) + (set! (-> sv-112 flags) (font-flags shadow kerning middle middle-vert large)) + (set! (-> sv-112 scale) 0.7) + (dotimes (s5-4 (-> gp-1 length)) + (if (= (-> self selected) s5-4) + (set! (-> sv-112 color) (font-color progress-old-selected)) + (set! (-> sv-112 color) (font-color white)) + ) + (print-game-text (lookup-text! *common-text* (-> gp-1 s5-4) #f) sv-112 #f 44 (bucket-id progress)) + (+! (-> sv-112 origin y) 22.0) + ) ) ) (suspend) diff --git a/goal_src/jak2/levels/dig/dig-digger.gc b/goal_src/jak2/levels/dig/dig-digger.gc index e47eb3222a..0f17b463db 100644 --- a/goal_src/jak2/levels/dig/dig-digger.gc +++ b/goal_src/jak2/levels/dig/dig-digger.gc @@ -864,7 +864,6 @@ ) (defmethod dig-tether-method-24 ((this dig-tether)) - (local-vars (sv-144 dig-tether-chain) (sv-160 vector)) (update-with-delay! (-> this chain-offset-rand)) (update! (-> this chain-offset) (-> this chain-offset-rand value)) (let ((s5-0 (new 'stack-no-clear 'matrix)) @@ -887,55 +886,55 @@ (quaternion-copy! (-> this joint-one quat) (-> this root quat)) (set! (-> s3-0 quad) (-> s5-0 vector 1 quad)) (dotimes (s0-0 8) - (set! sv-144 (-> this chain-joints s0-0)) - (set! sv-160 (new 'stack-no-clear 'vector)) - (let ((v1-23 (-> sv-144 position quad))) - (set! (-> sv-160 quad) v1-23) - ) - (+! (-> sv-160 y) -2048.0) - (vector+float*! sv-160 sv-160 (-> s2-0 value) f28-0) - (set! f28-0 (fmin 1.0 (+ 0.2 f28-0))) - (when (< s0-0 7) - (vector+float*! - sv-160 - sv-160 - (the-as vector (+ (the-as uint (-> this chain-joints 0 velocity)) (* 48 (+ s0-0 1)))) - f30-0 - ) - (set! f30-0 (fmin 0.9 (+ 0.2 f30-0))) - ) - (vector-! s1-0 sv-160 s4-0) - (vector-normalize! s1-0 12288.0) - (vector+! sv-160 s1-0 s4-0) - (vector-! s1-0 sv-160 (-> this digger-pos)) - (vector-flatten! s1-0 s1-0 (-> this digger-vertical)) - (let ((f0-6 (vector-normalize-ret-len! s1-0 1.0))) - (if (< f0-6 73728.0) - (vector+float*! sv-160 sv-160 s1-0 (- 73728.0 f0-6)) + (let ((sv-144 (-> this chain-joints s0-0)) + (sv-160 (new 'stack-no-clear 'vector)) ) - ) - (vector-! (-> sv-144 velocity) sv-160 (-> sv-144 position)) - (vector-float*! (-> sv-144 velocity) (-> sv-144 velocity) 0.75) - (let ((f0-9 (vector-length (-> sv-144 velocity)))) - (if (< 6144.0 f0-9) - (vector-float*! (-> sv-144 velocity) (-> sv-144 velocity) (/ 2048.0 f0-9)) + (set! (-> sv-160 quad) (-> sv-144 position quad)) + (+! (-> sv-160 y) -2048.0) + (vector+float*! sv-160 sv-160 (-> s2-0 value) f28-0) + (set! f28-0 (fmin 1.0 (+ 0.2 f28-0))) + (when (< s0-0 7) + (vector+float*! + sv-160 + sv-160 + (the-as vector (+ (the-as uint (-> this chain-joints 0 velocity)) (* 48 (+ s0-0 1)))) + f30-0 ) - ) - (vector+! sv-160 (-> sv-144 position) (-> sv-144 velocity)) - (set! (-> sv-144 position quad) (-> sv-160 quad)) - (if (-> sv-144 joint-mod) - (set! (-> sv-144 joint-mod trans quad) (-> sv-160 quad)) + (set! f30-0 (fmin 0.9 (+ 0.2 f30-0))) ) - (when (< s0-0 7) - (vector-! (-> s5-0 vector 2) (-> this chain-joints (+ s0-0 1) position) sv-160) - (vector-normalize! (-> s5-0 vector 2) 1.0) - (vector-cross! (-> s5-0 vector 0) s3-0 (-> s5-0 vector 2)) - (vector-normalize! (-> s5-0 vector 0) 1.0) - (vector-cross! (-> s5-0 vector 1) (-> s5-0 vector 2) (-> s5-0 vector 0)) - (matrix->quaternion (-> sv-144 joint-mod quat) s5-0) - (set! (-> s3-0 quad) (-> s5-0 vector 1 quad)) + (vector-! s1-0 sv-160 s4-0) + (vector-normalize! s1-0 12288.0) + (vector+! sv-160 s1-0 s4-0) + (vector-! s1-0 sv-160 (-> this digger-pos)) + (vector-flatten! s1-0 s1-0 (-> this digger-vertical)) + (let ((f0-6 (vector-normalize-ret-len! s1-0 1.0))) + (if (< f0-6 73728.0) + (vector+float*! sv-160 sv-160 s1-0 (- 73728.0 f0-6)) + ) + ) + (vector-! (-> sv-144 velocity) sv-160 (-> sv-144 position)) + (vector-float*! (-> sv-144 velocity) (-> sv-144 velocity) 0.75) + (let ((f0-9 (vector-length (-> sv-144 velocity)))) + (if (< 6144.0 f0-9) + (vector-float*! (-> sv-144 velocity) (-> sv-144 velocity) (/ 2048.0 f0-9)) + ) + ) + (vector+! sv-160 (-> sv-144 position) (-> sv-144 velocity)) + (set! (-> sv-144 position quad) (-> sv-160 quad)) + (if (-> sv-144 joint-mod) + (set! (-> sv-144 joint-mod trans quad) (-> sv-160 quad)) + ) + (when (< s0-0 7) + (vector-! (-> s5-0 vector 2) (-> this chain-joints (+ s0-0 1) position) sv-160) + (vector-normalize! (-> s5-0 vector 2) 1.0) + (vector-cross! (-> s5-0 vector 0) s3-0 (-> s5-0 vector 2)) + (vector-normalize! (-> s5-0 vector 0) 1.0) + (vector-cross! (-> s5-0 vector 1) (-> s5-0 vector 2) (-> s5-0 vector 0)) + (matrix->quaternion (-> sv-144 joint-mod quat) s5-0) + (set! (-> s3-0 quad) (-> s5-0 vector 1 quad)) + ) + (set! (-> s4-0 quad) (-> sv-160 quad)) ) - (set! (-> s4-0 quad) (-> sv-160 quad)) ) ) ) @@ -1254,16 +1253,12 @@ (set! (-> self hud-counter) (the-as handle #f)) ) :trans (behavior () - (let ((f0-0 (vector-vector-distance-squared (ear-trans 0) (-> self root trans))) - (f1-0 1228800.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (let ((gp-1 (new 'stack-no-clear 'vector))) - (vector<-cspace! gp-1 (joint-node dig-digger-lod0-jg smoke1)) - (sound-play "digger-motor" :id (-> self motor-sound) :position gp-1) - ) - (sound-play "digger-bit" :id (-> self bit-sound) :position (-> self root trans)) + (when (< (vector-vector-distance-squared (ear-trans 0) (-> self root trans)) (square 1228800.0)) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (vector<-cspace! gp-1 (joint-node dig-digger-lod0-jg smoke1)) + (sound-play "digger-motor" :id (-> self motor-sound) :position gp-1) ) + (sound-play "digger-bit" :id (-> self bit-sound) :position (-> self root trans)) ) (ja :num! (loop!)) (update-with-delay! (-> self vertical-rand)) @@ -1358,7 +1353,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s4-0 reaction) cshape-reaction-default) @@ -1461,8 +1455,9 @@ ) (set! (-> this draw light-index) (the-as uint 1)) (logior! (-> this skel status) (joint-control-status sync-math)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-46 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-46 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-46 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-46)) diff --git a/goal_src/jak2/levels/dig/dig-obs.gc b/goal_src/jak2/levels/dig/dig-obs.gc index 7155ee3e32..cfd87ac604 100644 --- a/goal_src/jak2/levels/dig/dig-obs.gc +++ b/goal_src/jak2/levels/dig/dig-obs.gc @@ -656,7 +656,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (set! (-> this hud-handle) (the-as handle #f)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) @@ -685,8 +684,9 @@ ) (set! (-> this pressed-count) 0) (set! (-> this total-buttons) 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-19 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-19 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-19 (nonzero? (-> sv-16 elt-count))) (let ((s5-2 (-> v1-19 0))) (countdown (s4-2 (-> s5-2 length)) diff --git a/goal_src/jak2/levels/dig/dig3-obs.gc b/goal_src/jak2/levels/dig/dig3-obs.gc index 30bd584c6d..9ca5ce4091 100644 --- a/goal_src/jak2/levels/dig/dig3-obs.gc +++ b/goal_src/jak2/levels/dig/dig3-obs.gc @@ -320,7 +320,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 int)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle pusher)) @@ -349,8 +348,9 @@ (let ((f28-0 4.0) (f30-0 0.0) ) - (set! sv-16 0) - (let ((v1-20 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-16))))) + (let* ((sv-16 0) + (v1-20 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-16)))) + ) (when v1-20 (set! f28-0 (-> v1-20 0)) (set! f30-0 (-> v1-20 1)) diff --git a/goal_src/jak2/levels/drill/drill-obs.gc b/goal_src/jak2/levels/drill/drill-obs.gc index 1c0ae96ca2..8cbe385d84 100644 --- a/goal_src/jak2/levels/drill/drill-obs.gc +++ b/goal_src/jak2/levels/drill/drill-obs.gc @@ -355,7 +355,6 @@ ;; WARN: Return type mismatch object vs none. (defbehavior drill-elevator-shaft-init-by-other drill-elevator-shaft ((arg0 vector) (arg1 vector)) - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) (let ((s4-0 (new 'process 'collide-shape self (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 7) 0))) (set! (-> s4-0 total-prims) (the-as uint 8)) @@ -367,28 +366,29 @@ (s1-0 (-> (the-as pair s2-0) car)) ) (while (not (null? s2-0)) - (let ((s0-0 (method-of-type collide-shape-prim-mesh new))) - (set! sv-32 'process) - (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 s4-0) - (let ((a3-2 (command-get-int (-> (the-as pair s1-0) car) 0)) - (t0-1 0) + (let ((sv-16 + (new + 'process + 'collide-shape-prim-mesh + s4-0 + (the-as uint (command-get-int (-> (the-as pair s1-0) car) 0)) + (the-as uint 0) + ) ) - (set! sv-16 (s0-0 sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((s0-1 sv-16)) + (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) + (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) + (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) + (set! (-> s0-1 transform-index) (command-get-int (-> (the-as pair (-> (the-as pair s1-0) cdr)) car) 0)) + ) + (set-vector! + (-> sv-16 local-sphere) + 0.0 + 0.0 + 0.0 + (command-get-float (-> (the-as pair (-> (the-as pair (-> (the-as pair s1-0) cdr)) cdr)) car) 0.0) ) - ) - (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) - (set! (-> s0-1 transform-index) (command-get-int (-> (the-as pair (-> (the-as pair s1-0) cdr)) car) 0)) - ) - (set-vector! - (-> sv-16 local-sphere) - 0.0 - 0.0 - 0.0 - (command-get-float (-> (the-as pair (-> (the-as pair (-> (the-as pair s1-0) cdr)) cdr)) car) 0.0) ) (set! s2-0 (-> (the-as pair s2-0) cdr)) (set! s1-0 (-> (the-as pair s2-0) car)) @@ -546,7 +546,6 @@ "If the [[*target*]] is in a valid state and there is a point to transition to in the elevator's path do so. @see [[elevator::47]]" - (local-vars (sv-16 float)) (let ((a0-1 *target*)) (when (and a0-1 (not (logtest? (focus-status dead inactive in-air grabbed edge-grab pole pilot-riding pilot teleporting) @@ -554,15 +553,16 @@ ) ) ) - (set! sv-16 (the-as float 0.0)) - (when (and (find-closest-point-in-path! this (get-trans a0-1 0) (& sv-16) #t #t) - (!= (-> this move-pos 1) sv-16) - (= sv-16 (-> this bottom-top 0)) - ) - (set! (-> this move-pos 0) (-> this move-pos 1)) - (set! (-> this move-pos 1) sv-16) - (logior! (-> this elevator-status) (elevator-status moving)) - (go (method-of-object this running)) + (let ((sv-16 (the-as float 0.0))) + (when (and (find-closest-point-in-path! this (get-trans a0-1 0) (& sv-16) #t #t) + (!= (-> this move-pos 1) sv-16) + (= sv-16 (-> this bottom-top 0)) + ) + (set! (-> this move-pos 0) (-> this move-pos 1)) + (set! (-> this move-pos 1) sv-16) + (logior! (-> this elevator-status) (elevator-status moving)) + (go (method-of-object this running)) + ) ) ) ) @@ -865,12 +865,9 @@ (set! (-> this deadly-length) (vector-vector-distance (-> s4-1 vector 2) (-> s4-1 vector 0))) (let ((v1-39 (-> this root root-prim))) (vector-reset! (-> v1-39 local-sphere)) - (let* ((f0-14 (/ (-> this deadly-width) 2)) - (f0-16 (* f0-14 f0-14)) - (f1-7 (/ (-> this deadly-length) 2)) - ) - (set! (-> v1-39 local-sphere w) (sqrtf (+ f0-16 (* f1-7 f1-7)))) - ) + (set! (-> v1-39 local-sphere w) + (sqrtf (+ (square (/ (-> this deadly-width) 2)) (square (/ (-> this deadly-length) 2)))) + ) ) (set! (-> s5-1 0) (vector-length (vector-! (new 'stack-no-clear 'vector) (-> s4-1 vector 1) (-> s4-1 vector 0))) @@ -1440,7 +1437,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (set! (-> this firing?) #f) (set! (-> this hit-sound-id) (new 'static 'sound-id)) (set! (-> this root) (new 'process 'trsqv)) @@ -1452,8 +1448,9 @@ (f28-0 0.0) (f26-0 3.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-8 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-8 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16))) + ) (when v1-8 (set! f30-0 (-> v1-8 0)) (set! f28-0 (-> v1-8 1)) diff --git a/goal_src/jak2/levels/drill/drill-obs2.gc b/goal_src/jak2/levels/drill/drill-obs2.gc index 2fb422262c..ef84fc43ad 100644 --- a/goal_src/jak2/levels/drill/drill-obs2.gc +++ b/goal_src/jak2/levels/drill/drill-obs2.gc @@ -775,14 +775,14 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (init-collision! this) (process-drawable-from-entity! this arg0) (skel-init! this) (set! (-> this entity extra perm task) (game-task drill-eggs)) (set! (-> this notify-actor) (entity-actor-lookup (-> this entity) 'alt-actor 0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (if (and v1-6 (= (-> sv-16 elt-count) 1)) (set! (-> this actor-group) (the-as actor-group (-> (the-as (pointer uint32) v1-6)))) (set! (-> this actor-group) #f) diff --git a/goal_src/jak2/levels/drill/drill-spool.gc b/goal_src/jak2/levels/drill/drill-spool.gc index e50b7b9bb6..ca885f379f 100644 --- a/goal_src/jak2/levels/drill/drill-spool.gc +++ b/goal_src/jak2/levels/drill/drill-spool.gc @@ -803,41 +803,7 @@ (format (clear *temp-string*) "~S-end" (-> self art-name)) (let ((gp-1 (s4-0 gp-0 *temp-string* art-joint-anim))) (when (not arg0) - (let ((s5-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when s5-1 - (let ((t9-5 (method-of-type part-tracker activate))) - (t9-5 - (the-as part-tracker s5-1) - *entity-pool* - (symbol->string (-> part-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((t9-6 run-function-in-process) - (a0-7 s5-1) - (a1-5 part-tracker-init) - (a2-7 (-> *part-group-id-table* 421)) - (a3-1 0) - (t0-0 #f) - (t1-0 #f) - (t2-0 #f) - (t3-0 *launch-matrix*) - ) - (set! (-> t3-0 trans quad) (-> self root trans quad)) - ((the-as (function object object object object object object object object none) t9-6) - a0-7 - a1-5 - a2-7 - a3-1 - t0-0 - t1-0 - t2-0 - t3-0 - ) - ) - (-> s5-1 ppointer) - ) - ) + (part-tracker-spawn :to *entity-pool* :group group-drill-wall-explode :mat-joint (-> self root trans)) (sound-play "egg-wall-break" :position (-> self root trans)) ;; og:preserve-this added cast (ja-play-spooled-anim (-> self anim) (ja-group) (the-as art-joint-anim gp-1) (the-as (function process-drawable symbol) false-func)) @@ -863,7 +829,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (stack-size-set! (-> this main-thread) 512) (logior! (-> this mask) (process-mask collectable)) (let ((s3-0 ((method-of-type res-lump get-property-struct) @@ -919,8 +884,9 @@ (format (clear *temp-string*) "~S-idle" (-> this art-name)) (set! (-> s5-1 frame-group) (the-as art-joint-anim (s3-1 s4-1 *temp-string* (the-as type #f)))) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-35 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-35 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-35 (nonzero? (-> sv-16 elt-count))) (set! (-> this egg-group) (-> v1-35 0)) @@ -1135,7 +1101,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag) (sv-32 res-tag)) ;; og:preserve-this increased from 512 (stack-size-set! (-> this main-thread) 2048) (logior! (-> this mask) (process-mask collectable)) @@ -1173,18 +1138,19 @@ (initialize-skeleton this (the-as skeleton-group s4-0) (the-as pair 0)) ) (set! (-> this draw force-lod) 1) - (let ((s4-1 (-> this root))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-28 (res-lump-data arg0 'scale-mult (pointer float) :tag-ptr (& sv-16)))) - (when v1-28 - (set! (-> s4-1 scale x) (* (-> s4-1 scale x) (-> v1-28 0))) - (set! (-> s4-1 scale y) (* (-> s4-1 scale y) (-> v1-28 1))) - (set! (-> s4-1 scale z) (* (-> s4-1 scale z) (-> v1-28 2))) - ) + (let* ((s4-1 (-> this root)) + (sv-16 (new 'static 'res-tag)) + (v1-28 (res-lump-data arg0 'scale-mult (pointer float) :tag-ptr (& sv-16))) + ) + (when v1-28 + (set! (-> s4-1 scale x) (* (-> s4-1 scale x) (-> v1-28 0))) + (set! (-> s4-1 scale y) (* (-> s4-1 scale y) (-> v1-28 1))) + (set! (-> s4-1 scale z) (* (-> s4-1 scale z) (-> v1-28 2))) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-30 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-30 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32))) + ) (cond ((and v1-30 (nonzero? (-> sv-32 elt-count))) (set! (-> this egg-group) (the-as actor-group (-> (the-as (pointer uint32) v1-30)))) diff --git a/goal_src/jak2/levels/forest/fish.gc b/goal_src/jak2/levels/forest/fish.gc index 5cc98f6183..cde1d49e98 100644 --- a/goal_src/jak2/levels/forest/fish.gc +++ b/goal_src/jak2/levels/forest/fish.gc @@ -107,26 +107,6 @@ ) :code sleep-code :post (behavior () - (local-vars - (sv-448 (function vector vector float vector)) - (sv-464 vector) - (sv-480 vector) - (sv-496 vector) - (sv-512 vector) - (sv-528 vector) - (sv-544 vector) - (sv-560 vector) - (sv-576 vector) - (sv-592 vector) - (sv-608 vector) - (sv-624 int) - (sv-640 int) - (sv-656 fish) - (sv-672 vector) - (sv-688 vector) - (sv-704 vector) - (sv-720 nav-poly) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -145,290 +125,288 @@ ) (new 'stack-no-clear 'vector) (new 'stack-no-clear 'vector) - (set! sv-544 (new 'stack-no-clear 'vector)) - (new 'stack-no-clear 'vector) - (let ((s0-0 (new-stack-vector0))) - (set! (-> sv-544 quad) (-> s3-0 quad)) - (set! sv-448 vector-rotate-around-y!) - (set! sv-464 sv-544) - (set! sv-480 sv-544) - (let ((a2-0 (rand-vu-float-range 0.0 65536.0))) - (sv-448 sv-464 sv-480 a2-0) - ) - (vector-float*! sv-544 sv-544 0.5) - (cond - ((and *target* (< (-> (target-pos 0) y) 0.0)) - (set! sv-512 (new 'stack-no-clear 'vector)) - (set! sv-496 s2-0) - (let ((v0-4 (target-pos 0))) - (.lvf vf4 (&-> sv-496 quad)) - (.lvf vf5 (&-> v0-4 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-512 quad) vf6) - (let* ((v1-21 sv-512) - (f0-5 (+ (* (-> v1-21 x) (-> v1-21 x)) (* (-> v1-21 z) (-> v1-21 z)))) - (f1-4 16384.0) - ) - (cond - ((< f0-5 (* f1-4 f1-4)) - (set! (-> s1-0 max-speed) 40960.0) - (vector-normalize! sv-512 (* 4096.0 (/ 4096.0 f0-5))) - (let ((a0-9 (-> s1-0 avoid-d))) - (let ((v1-28 (-> s1-0 avoid-d))) - (let ((a1-6 100000.0)) - (.mov vf7 a1-6) - ) - (.lvf vf5 (&-> sv-512 quad)) - (.lvf vf4 (&-> v1-28 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-9 quad) vf6) - ) - #t - ) - ((let ((f1-9 81920.0)) - (< f0-5 (* f1-9 f1-9)) - ) - (set! (-> s1-0 max-speed) 16384.0) - ) - (else - (set! (-> s1-0 max-speed) 4096.0) - ) - ) - ) - ) - (else - (set! (-> s1-0 max-speed) 4096.0) - ) - ) - (set! sv-528 (new 'stack-no-clear 'vector)) - (let ((v1-39 s2-0)) - (let ((a0-10 sv-544)) - (let ((a1-9 -0.1)) - (.mov vf7 a1-9) - ) - (.lvf vf5 (&-> a0-10 quad)) - ) - (.lvf vf4 (&-> v1-39 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> sv-528 quad) vf6) - (let ((v1-41 gp-0) - (a0-11 sv-528) - (a1-10 (new 'stack-no-clear 'nav-find-poly-parms)) - ) - (vector-! (-> a1-10 point) a0-11 (-> v1-41 state mesh bounds)) - (set! (-> a1-10 y-threshold) (-> v1-41 nearest-y-threshold)) - (set! (-> a1-10 ignore) (the-as uint 2)) - (set! sv-720 (find-poly-containing-point-local (-> v1-41 state mesh) a1-10)) - ) + (let ((sv-544 (new 'stack-no-clear 'vector))) (new 'stack-no-clear 'vector) - (when sv-720 - (let ((a0-14 gp-0) - (t9-7 (method-of-type nav-control clamp-vector-to-mesh-no-gaps)) - (a2-3 sv-720) - (t0-0 s5-0) - ) - (t9-7 a0-14 sv-528 a2-3 sv-544 t0-0) - ) + (let ((s0-0 (new-stack-vector0))) + (set! (-> sv-544 quad) (-> s3-0 quad)) + (vector-rotate-around-y! sv-544 sv-544 (rand-vu-float-range 0.0 65536.0)) + (vector-float*! sv-544 sv-544 0.5) (cond - ((-> s5-0 found-boundary) - (let ((a1-12 (-> s1-0 border-f))) - (let ((v1-48 (-> s1-0 border-f))) - (let ((a0-15 (-> s5-0 boundary-normal))) - (let ((a2-5 -10000.0)) - (.mov vf7 a2-5) + ((and *target* (< (-> (target-pos 0) y) 0.0)) + (let ((sv-512 (new 'stack-no-clear 'vector))) + (let ((sv-496 s2-0) + (v0-4 (target-pos 0)) ) - (.lvf vf5 (&-> a0-15 quad)) - ) - (.lvf vf4 (&-> v1-48 quad)) + (.lvf vf4 (&-> sv-496 quad)) + (.lvf vf5 (&-> v0-4 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-512 quad) vf6) + (let* ((v1-21 sv-512) + (f0-5 (+ (* (-> v1-21 x) (-> v1-21 x)) (* (-> v1-21 z) (-> v1-21 z)))) + ) + (cond + ((< f0-5 (square 16384.0)) + (set! (-> s1-0 max-speed) 40960.0) + (vector-normalize! sv-512 (* 4096.0 (/ 4096.0 f0-5))) + (let ((a0-9 (-> s1-0 avoid-d))) + (let ((v1-28 (-> s1-0 avoid-d))) + (let ((a1-6 100000.0)) + (.mov vf7 a1-6) + ) + (.lvf vf5 (&-> sv-512 quad)) + (.lvf vf4 (&-> v1-28 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a0-9 quad) vf6) + ) + #t + ) + ((< f0-5 (square 81920.0)) + (set! (-> s1-0 max-speed) 16384.0) + ) + (else + (set! (-> s1-0 max-speed) 4096.0) + ) + ) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-12 quad) vf6) ) ) (else - (set! sv-608 (vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 1.0)) - (let ((a1-14 sv-608)) - (let ((v1-49 s2-0)) - (let ((a0-17 sv-608)) - (let ((a2-8 4096.0)) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a0-17 quad)) - ) - (.lvf vf4 (&-> v1-49 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-14 quad) vf6) - ) - (set! sv-592 sv-608) - (set! sv-560 sv-608) - (set! sv-576 (new 'stack-no-clear 'vector)) - (set! (-> sv-576 x) (cos (-> s1-0 wander))) - (set! (-> sv-576 y) 0.0) - (set! (-> sv-576 z) (sin (-> s1-0 wander))) - (set! (-> sv-576 w) 1.0) - (let ((v1-59 3276.8)) - (.mov vf7 v1-59) - ) - (.lvf vf5 (&-> sv-576 quad)) - (.lvf vf4 (&-> sv-560 quad)) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> sv-592 quad) vf6) - (vector-! sv-608 sv-608 s2-0) - (let ((a0-21 s0-0)) - (let ((v1-64 s0-0)) - (let ((a1-18 10.0)) - (.mov vf7 a1-18) - ) - (.lvf vf5 (&-> sv-608 quad)) - (.lvf vf4 (&-> v1-64 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-21 quad) vf6) - ) - (+! (-> s1-0 wander) (rand-vu-float-range -1820.4445 1820.4445)) + (set! (-> s1-0 max-speed) 4096.0) ) ) - ) - (set! sv-624 0) - (set! sv-688 (new 'stack-no-clear 'vector)) - (set! (-> sv-688 quad) (the-as uint128 0)) - (set! sv-704 (new 'stack-no-clear 'vector)) - (set! (-> sv-704 quad) (the-as uint128 0)) - (set! sv-640 0) - (while (< sv-640 12) - (when (!= sv-640 s4-0) - (set! sv-656 (-> self fishes sv-640)) - (set! sv-672 (new 'stack-no-clear 'vector)) - (let ((v1-78 s2-0) - (a0-25 (-> sv-656 pos)) + (let ((sv-528 (new 'stack-no-clear 'vector))) + (let ((v1-39 s2-0)) + (let ((a0-10 sv-544)) + (let ((a1-9 -0.1)) + (.mov vf7 a1-9) ) - (.lvf vf4 (&-> v1-78 quad)) - (.lvf vf5 (&-> a0-25 quad)) + (.lvf vf5 (&-> a0-10 quad)) + ) + (.lvf vf4 (&-> v1-39 quad)) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-672 quad) vf6) - (let* ((v1-80 sv-672) - (f0-29 (+ (* (-> v1-80 x) (-> v1-80 x)) (* (-> v1-80 z) (-> v1-80 z)))) - (f1-15 4096.0) - ) - (when (< f0-29 (* f1-15 f1-15)) - (vector-normalize! sv-672 (* 4096.0 (/ 4096.0 f0-29))) - (let ((a0-27 s0-0)) - (let ((v1-87 s0-0)) - (let ((a1-24 100.0)) - (.mov vf7 a1-24) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> sv-528 quad) vf6) + (let ((v1-41 gp-0) + (a0-11 sv-528) + (a1-10 (new 'stack-no-clear 'nav-find-poly-parms)) + ) + (vector-! (-> a1-10 point) a0-11 (-> v1-41 state mesh bounds)) + (set! (-> a1-10 y-threshold) (-> v1-41 nearest-y-threshold)) + (set! (-> a1-10 ignore) (the-as uint 2)) + (let ((sv-720 (find-poly-containing-point-local (-> v1-41 state mesh) a1-10))) + (new 'stack-no-clear 'vector) + (when sv-720 + (clamp-vector-to-mesh-no-gaps gp-0 sv-528 sv-720 sv-544 s5-0) + (cond + ((-> s5-0 found-boundary) + (let ((a1-12 (-> s1-0 border-f))) + (let ((v1-48 (-> s1-0 border-f))) + (let ((a0-15 (-> s5-0 boundary-normal))) + (let ((a2-5 -10000.0)) + (.mov vf7 a2-5) + ) + (.lvf vf5 (&-> a0-15 quad)) + ) + (.lvf vf4 (&-> v1-48 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-12 quad) vf6) + ) + ) + (else + (let ((sv-608 (vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 1.0))) + (let ((a1-14 sv-608)) + (let ((v1-49 s2-0)) + (let ((a0-17 sv-608)) + (let ((a2-8 4096.0)) + (.mov vf7 a2-8) + ) + (.lvf vf5 (&-> a0-17 quad)) + ) + (.lvf vf4 (&-> v1-49 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-14 quad) vf6) + ) + (let ((sv-592 sv-608)) + (let ((sv-560 sv-608)) + (let ((sv-576 (new 'stack-no-clear 'vector))) + (set! (-> sv-576 x) (cos (-> s1-0 wander))) + (set! (-> sv-576 y) 0.0) + (set! (-> sv-576 z) (sin (-> s1-0 wander))) + (set! (-> sv-576 w) 1.0) + (let ((v1-59 3276.8)) + (.mov vf7 v1-59) + ) + (.lvf vf5 (&-> sv-576 quad)) + ) + (.lvf vf4 (&-> sv-560 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> sv-592 quad) vf6) + ) + (vector-! sv-608 sv-608 s2-0) + (let ((a0-21 s0-0)) + (let ((v1-64 s0-0)) + (let ((a1-18 10.0)) + (.mov vf7 a1-18) + ) + (.lvf vf5 (&-> sv-608 quad)) + (.lvf vf4 (&-> v1-64 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a0-21 quad) vf6) + ) + ) + (+! (-> s1-0 wander) (rand-vu-float-range -1820.4445 1820.4445)) ) - (.lvf vf5 (&-> sv-672 quad)) - (.lvf vf4 (&-> v1-87 quad)) + ) + ) + (let ((sv-624 0) + (sv-688 (new 'stack-no-clear 'vector)) + ) + (set! (-> sv-688 quad) (the-as uint128 0)) + (let ((sv-704 (new 'stack-no-clear 'vector))) + (set! (-> sv-704 quad) (the-as uint128 0)) + (let ((sv-640 0)) + (while (< sv-640 12) + (when (!= sv-640 s4-0) + (let ((sv-656 (-> self fishes sv-640)) + (sv-672 (new 'stack-no-clear 'vector)) + ) + (let ((v1-78 s2-0) + (a0-25 (-> sv-656 pos)) + ) + (.lvf vf4 (&-> v1-78 quad)) + (.lvf vf5 (&-> a0-25 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-672 quad) vf6) + (let* ((v1-80 sv-672) + (f0-29 (+ (* (-> v1-80 x) (-> v1-80 x)) (* (-> v1-80 z) (-> v1-80 z)))) + ) + (when (< f0-29 (square 4096.0)) + (vector-normalize! sv-672 (* 4096.0 (/ 4096.0 f0-29))) + (let ((a0-27 s0-0)) + (let ((v1-87 s0-0)) + (let ((a1-24 100.0)) + (.mov vf7 a1-24) + ) + (.lvf vf5 (&-> sv-672 quad)) + (.lvf vf4 (&-> v1-87 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a0-27 quad) vf6) + ) + (vector+! sv-688 sv-688 (-> sv-656 pos)) + (vector+! sv-704 sv-704 (-> sv-656 vel)) + (+! sv-624 1) + sv-624 + ) + ) + ) + ) + (+! sv-640 1) + ) + ) + (when (nonzero? sv-624) + (vector-float*! sv-688 sv-688 (/ 1.0 (the float sv-624))) + (vector-! sv-688 sv-688 s2-0) + (let ((v1-104 sv-688)) + (vector-normalize! + sv-688 + (* 4096.0 (/ 4096.0 (+ (* (-> v1-104 x) (-> v1-104 x)) (* (-> v1-104 z) (-> v1-104 z))))) + ) + ) + (let ((a0-36 s0-0)) + (let ((v1-106 s0-0)) + (let ((a1-36 100.0)) + (.mov vf7 a1-36) + ) + (.lvf vf5 (&-> sv-688 quad)) + (.lvf vf4 (&-> v1-106 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a0-36 quad) vf6) + ) + (vector-float*! sv-704 sv-704 (/ 1.0 (the float sv-624))) + (vector-! sv-704 sv-704 s3-0) + (let ((a0-39 s0-0)) + (let ((v1-110 s0-0)) + (let ((a1-43 5.0)) + (.mov vf7 a1-43) + ) + (.lvf vf5 (&-> sv-704 quad)) + (.lvf vf4 (&-> v1-110 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a0-39 quad) vf6) + ) + ) + ) + ) + (vector-float*! (-> s1-0 avoid-d) (-> s1-0 avoid-d) 0.95) + (vector-float*! (-> s1-0 border-f) (-> s1-0 border-f) 0.99) + (vector+! s0-0 s0-0 (-> s1-0 border-f)) + (vector+! s0-0 s0-0 (-> s1-0 avoid-d)) + (set! (-> s0-0 y) 0.0) + (let ((a0-44 s3-0)) + (let ((v1-117 s3-0)) + (let ((a1-52 (seconds-per-frame))) + (.mov vf7 a1-52) + ) + (.lvf vf5 (&-> s0-0 quad)) + (.lvf vf4 (&-> v1-117 quad)) ) (.add.x.vf.w vf6 vf0 vf0) (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-27 quad) vf6) + (.svf (&-> a0-44 quad) vf6) ) - (vector+! sv-688 sv-688 (-> sv-656 pos)) - (vector+! sv-704 sv-704 (-> sv-656 vel)) - (set! sv-624 (+ sv-624 1)) - sv-624 + (vector-float*! s3-0 s3-0 0.8) + (let ((a1-54 s2-0)) + (let ((v1-120 s2-0)) + (let ((a0-46 s3-0)) + (let ((a2-10 (seconds-per-frame))) + (.mov vf7 a2-10) + ) + (.lvf vf5 (&-> a0-46 quad)) + ) + (.lvf vf4 (&-> v1-120 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-54 quad) vf6) + ) + (cloest-point-on-mesh (-> self nav) s2-0 s2-0 sv-720) ) ) ) - (set! sv-640 (+ sv-640 1)) - ) - (when (nonzero? sv-624) - (vector-float*! sv-688 sv-688 (/ 1.0 (the float sv-624))) - (vector-! sv-688 sv-688 s2-0) - (let ((t9-13 vector-normalize!) - (a0-35 sv-688) - (f0-35 4096.0) - (f1-21 4096.0) - (v1-104 sv-688) - ) - (t9-13 a0-35 (* f0-35 (/ f1-21 (+ (* (-> v1-104 x) (-> v1-104 x)) (* (-> v1-104 z) (-> v1-104 z)))))) - ) - (let ((a0-36 s0-0)) - (let ((v1-106 s0-0)) - (let ((a1-36 100.0)) - (.mov vf7 a1-36) - ) - (.lvf vf5 (&-> sv-688 quad)) - (.lvf vf4 (&-> v1-106 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-36 quad) vf6) - ) - (vector-float*! sv-704 sv-704 (/ 1.0 (the float sv-624))) - (vector-! sv-704 sv-704 s3-0) - (let ((a0-39 s0-0)) - (let ((v1-110 s0-0)) - (let ((a1-43 5.0)) - (.mov vf7 a1-43) - ) - (.lvf vf5 (&-> sv-704 quad)) - (.lvf vf4 (&-> v1-110 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-39 quad) vf6) - ) - ) - (vector-float*! (-> s1-0 avoid-d) (-> s1-0 avoid-d) 0.95) - (vector-float*! (-> s1-0 border-f) (-> s1-0 border-f) 0.99) - (vector+! s0-0 s0-0 (-> s1-0 border-f)) - (vector+! s0-0 s0-0 (-> s1-0 avoid-d)) - (set! (-> s0-0 y) 0.0) - (let ((a0-44 s3-0)) - (let ((v1-117 s3-0)) - (let ((a1-52 (seconds-per-frame))) - (.mov vf7 a1-52) - ) - (.lvf vf5 (&-> s0-0 quad)) - (.lvf vf4 (&-> v1-117 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-44 quad) vf6) ) ) - (vector-float*! s3-0 s3-0 0.8) - (let ((a1-54 s2-0)) - (let ((v1-120 s2-0)) - (let ((a0-46 s3-0)) - (let ((a2-10 (seconds-per-frame))) - (.mov vf7 a2-10) - ) - (.lvf vf5 (&-> a0-46 quad)) - ) - (.lvf vf4 (&-> v1-120 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-54 quad) vf6) - ) - (cloest-point-on-mesh (-> self nav) s2-0 s2-0 sv-720) (set! (-> s2-0 y) -1638.4) (let ((v1-124 (handle->process (-> s1-0 handle)))) (when v1-124 @@ -450,11 +428,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this fish-manager) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s4-0 reaction) cshape-reaction-default) diff --git a/goal_src/jak2/levels/forest/pegasus.gc b/goal_src/jak2/levels/forest/pegasus.gc index 53547336a5..0f54c2b367 100644 --- a/goal_src/jak2/levels/forest/pegasus.gc +++ b/goal_src/jak2/levels/forest/pegasus.gc @@ -148,12 +148,10 @@ (defmethod run-logic? ((this pegasus)) "Calls [[process-tree::12]] if we are considered in-range of the [[pegasus]], otherwise returns [[#t]]" - (let ((min-distance 491520.0)) - (if (< (* min-distance min-distance) (vector-vector-distance-squared (-> this root trans) (camera-pos))) - ((method-of-type enemy run-logic?) this) - #t - ) - ) + (if (< (square 491520.0) (vector-vector-distance-squared (-> this root trans) (camera-pos))) + ((method-of-type enemy run-logic?) this) + #t + ) ) (defmethod track-how-long-aimed-at! ((this pegasus)) @@ -170,13 +168,9 @@ (-> target gun fire-dir-out) (vector-length inaccuracy-dir) ) - (let ((inaccuracy-mag (vector-vector-distance-squared inaccuracy-vec (-> this root trans))) - (threshold 20480.0) - ) - (if (< inaccuracy-mag (* threshold threshold)) - (set-time! (-> this targetted-timer)) - ) - ) + (if (< (vector-vector-distance-squared inaccuracy-vec (-> this root trans)) (square 20480.0)) + (set-time! (-> this targetted-timer)) + ) ) ) ) @@ -369,7 +363,7 @@ (matrix->quaternion (-> self root quat) rotation-matrix) (set! (-> self run-blend-interp) (acos (vector-dot flee-direction-vec (-> self facing)))) (set! (-> self run-blend-interp) (* 0.0002746582 (-> self run-blend-interp))) - (if (< (vector-dot (-> self facing) (the-as vector (-> rotation-matrix vector))) 0.0) + (if (< (vector-dot (-> self facing) (-> rotation-matrix vector 0)) 0.0) (set! (-> self run-blend-interp) (- (-> self run-blend-interp))) ) (set! (-> self facing quad) (-> flee-direction-vec quad)) @@ -1264,7 +1258,6 @@ (defmethod init-enemy! ((this pegasus)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (local-vars (tag res-tag)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-pegasus" (the-as (pointer uint32) #f))) @@ -1291,11 +1284,11 @@ (set! (-> this path-info path-info-idx path-data) curve) (logior! (-> curve flags) (path-control-flag display draw-line draw-point)) ) - (set! tag (new 'static 'res-tag)) - (let ((data - (res-lump-data (-> this entity) 'path-connection pointer :tag-ptr (& tag) :time (the float path-info-idx)) - ) - ) + (let* ((tag (new 'static 'res-tag)) + (data + (res-lump-data (-> this entity) 'path-connection pointer :tag-ptr (& tag) :time (the float path-info-idx)) + ) + ) (cond (data (set! (-> this path-info path-info-idx num-data) (the-as int (-> tag elt-count))) @@ -1379,23 +1372,23 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (local-vars (data int)) (set-time! (-> self start-time)) (set! (-> self hud-timer) (ppointer->handle (process-spawn hud-pegasus :init hud-init-by-other :to self))) (while (> (-> self data-int32 0) 0) - (set! data (-> self data-int32 1)) - (when (-> self actor-group 0) - (dotimes (actor-group (the-as int (-> self actor-group 0 0))) - (let ((actor (-> (&+ (-> self actor-group 0) (* actor-group 8)) 3))) - (if (and actor (logtest? (-> actor extra perm status) (entity-perm-status subtask-complete))) - (set! data (+ data -1)) - ) + (let ((data (-> self data-int32 1))) + (when (-> self actor-group 0) + (dotimes (actor-group (the-as int (-> self actor-group 0 0))) + (let ((actor (-> (&+ (-> self actor-group 0) (* actor-group 8)) 3))) + (if (and actor (logtest? (-> actor extra perm status) (entity-perm-status subtask-complete))) + (+! data -1) + ) + ) ) ) - ) - (let ((_data data)) - (set! (-> self data-int32 0) _data) - (set! (-> *game-info* counter) (the float _data)) + (let ((_data data)) + (set! (-> self data-int32 0) _data) + (set! (-> *game-info* counter) (the float _data)) + ) ) (suspend) ) diff --git a/goal_src/jak2/levels/forest/predator.gc b/goal_src/jak2/levels/forest/predator.gc index 5f8aa359d7..77e93e8969 100644 --- a/goal_src/jak2/levels/forest/predator.gc +++ b/goal_src/jak2/levels/forest/predator.gc @@ -9,9 +9,9 @@ (defmethod draw ((this hud-predator)) (set-hud-piece-position! (-> this sprites 1) (the int (+ 480.0 (* 130.0 (-> this offset)))) 205) - (set-as-offset-from! (the-as hud-sprite (-> this sprites)) (the-as vector4w (-> this sprites 1)) -44 0) + (set-as-offset-from! (-> this sprites 0) (-> this sprites 1 pos) -44 0) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites 1)) -45 45) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 1 pos) -45 45) ((method-of-type hud draw) this) 0 (none) @@ -46,14 +46,10 @@ ) (defmethod draw ((this hud-pegasus)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 472.0 (* 130.0 (-> this offset)))) - 190 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 472.0 (* 130.0 (-> this offset)))) 190) (set! (-> this sprites 0 flags) (the-as uint 4)) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -26 35) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -26 35) ((method-of-type hud draw) this) 0 (none) @@ -644,18 +640,14 @@ #t ) (else - (let ((s4-1 (-> s5-0 best-other-tri collide-ptr))) - (when (and (if (type? s4-1 collide-shape-prim) - s4-1 - ) - (< (vector-dot - (-> s5-0 best-other-tri normal) - (vector-! (new 'stack-no-clear 'vector) arg2 (the-as vector (-> s5-0 best-other-tri))) - ) - 0.0 + (when (and (the-as basic (as-type (-> s5-0 best-other-tri collide-ptr) collide-shape-prim)) + (< (vector-dot + (-> s5-0 best-other-tri normal) + (vector-! (new 'stack-no-clear 'vector) arg2 (the-as vector (-> s5-0 best-other-tri))) ) - ) - ) + 0.0 + ) + ) ) ) ) @@ -664,7 +656,6 @@ ) (defmethod predator-method-184 ((this predator) (arg0 int) (arg1 float)) - (local-vars (sv-224 vector) (sv-240 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -696,23 +687,22 @@ (when s2-0 (seek! (-> this miss-amount) (* 0.5 (vector-length (-> (the-as process-focusable s2-0) root transv))) 4096.0) (set! (-> s3-0 quad) (-> (get-trans (the-as process-focusable s2-0) 3) quad)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (let ((v1-24 (-> s5-0 pos)) - (a0-18 s3-0) - ) - (.lvf vf4 (&-> v1-24 quad)) - (.lvf vf5 (&-> a0-18 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-224 quad) vf6) - (let* ((f0-5 (vector-length sv-224)) - (f0-6 (/ f0-5 (meters 130))) - ) - (set! sv-240 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) - (s1-1 (new 'stack-no-clear 'vector)) + (let ((sv-224 (new 'stack-no-clear 'vector))) + (let ((v1-24 (-> s5-0 pos)) + (a0-18 s3-0) ) + (.lvf vf4 (&-> v1-24 quad)) + (.lvf vf5 (&-> a0-18 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-224 quad) vf6) + (let* ((f0-5 (vector-length sv-224)) + (f0-6 (/ f0-5 (meters 130))) + (sv-240 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack-no-clear 'vector)) + ) (let ((a0-19 s3-0)) (let ((v1-30 s3-0)) (let ((a1-6 (-> (the-as process-focusable s2-0) root transv))) @@ -736,11 +726,7 @@ (let ((a2-5 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) sv-224 (-> this shoot-angle)))) (vector-orient-by-quat! sv-240 sv-240 a2-5) ) - (let* ((t9-9 quaternion-vector-angle!) - (a0-27 (new 'stack-no-clear 'quaternion)) - (a2-6 (-> this shoot-angle)) - (a2-7 (t9-9 a0-27 sv-224 a2-6)) - ) + (let ((a2-7 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) sv-224 (-> this shoot-angle)))) (vector-orient-by-quat! s0-0 s0-0 a2-7) ) (let ((a0-29 s1-1)) @@ -1600,7 +1586,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1620,8 +1605,9 @@ (logclear! (-> a0-4 flags) (predator-node-flag taken)) ) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-6 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-6)) @@ -1695,17 +1681,15 @@ (set! (-> s2-1 entity) (-> this actor-group 1 data s5-2 actor)) (set! (-> s2-1 directed?) #f) (set! (-> s2-1 no-initial-move-to-ground?) #f) - (let* ((s1-2 (ppointer->process (process-spawn predator :init enemy-init-by-other this s2-1 :to this))) - (s2-2 (if (type? s1-2 process-focusable) - s1-2 - ) - ) - (s3-2 (entity-nav-mesh-by-aid (the-as actor-id (-> s3-1 nav-mesh-id)))) - (v1-66 (if (type? s3-2 entity-nav-mesh) - s3-2 - ) - ) - ) + (let ((s2-2 + (the-as process (as-type + (ppointer->process (process-spawn predator :init enemy-init-by-other this s2-1 :to this)) + process-focusable + ) + ) + ) + (v1-66 (as-type (entity-nav-mesh-by-aid (the-as actor-id (-> s3-1 nav-mesh-id))) entity-nav-mesh)) + ) (set! (-> this predator-h (-> this predator-count)) (process->handle s2-2)) (+! (-> this predator-count) 1) (when v1-66 diff --git a/goal_src/jak2/levels/fortress/dump/fordumpa-obs.gc b/goal_src/jak2/levels/fortress/dump/fordumpa-obs.gc index d8c85a80ef..4cd5bc4f23 100644 --- a/goal_src/jak2/levels/fortress/dump/fordumpa-obs.gc +++ b/goal_src/jak2/levels/fortress/dump/fordumpa-obs.gc @@ -189,7 +189,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) ;; og:preserve-this added (stack-size-set! (-> this top-thread) 512) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) @@ -217,8 +216,9 @@ ) (set! (-> this notify-actor) (entity-actor-lookup arg0 'alt-actor 0)) (set! (-> this tank-actor) (entity-actor-lookup arg0 'alt-actor 1)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-11 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-11 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-11 (nonzero? (-> sv-16 elt-count))) (set! (-> this switch-group) (the-as (pointer actor-group) v1-11)) diff --git a/goal_src/jak2/levels/fortress/dump/fordumpb-obs.gc b/goal_src/jak2/levels/fortress/dump/fordumpb-obs.gc index d5b7de92e4..014afc9309 100644 --- a/goal_src/jak2/levels/fortress/dump/fordumpb-obs.gc +++ b/goal_src/jak2/levels/fortress/dump/fordumpb-obs.gc @@ -52,11 +52,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this fort-plat-orbit) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s4-0 reaction) cshape-reaction-default) @@ -305,12 +305,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this fort-plat-shuttle) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" - (local-vars (sv-64 int)) + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -324,8 +323,9 @@ This commonly includes things such as: (let ((s4-1 (new 'stack-no-clear 'sync-info-params))) (let ((s3-1 1200)) 0.0 - (set! sv-64 0) - (let ((v1-7 (res-lump-data arg0 'sync (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-64))))) + (let* ((sv-64 0) + (v1-7 (res-lump-data arg0 'sync (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-64)))) + ) (when v1-7 (set! s3-1 (the int (* 300.0 (-> v1-7 0)))) (-> v1-7 1) @@ -419,7 +419,7 @@ This commonly includes things such as: (defmethod set-and-get-ambient-sound! ((this fort-conveyor)) "So long as [[actor-option::16]] is not set, fetch the [[ambient-sound]] for the [[conveyor]] -and return it as well. Otherwise, set it to `0`" + and return it as well. Otherwise, set it to `0`" (let* ((s5-0 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) 0.0 'interp)) (v1-2 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) 1.0 'interp)) (a3-3 (vector+! (new 'stack-no-clear 'vector) s5-0 v1-2)) diff --git a/goal_src/jak2/levels/fortress/dump/fort-robotank-turret.gc b/goal_src/jak2/levels/fortress/dump/fort-robotank-turret.gc index be8604ab9b..1a112e8173 100644 --- a/goal_src/jak2/levels/fortress/dump/fort-robotank-turret.gc +++ b/goal_src/jak2/levels/fortress/dump/fort-robotank-turret.gc @@ -735,7 +735,6 @@ ;; WARN: Return type mismatch (pointer process) vs none. (defmethod fort-robotank-turret-method-33 ((this fort-robotank-turret)) - (local-vars (sv-144 vector) (sv-160 vector)) (let ((s3-0 (new 'stack-no-clear 'inline-array 'vector 2)) (s5-0 (new 'stack-no-clear 'inline-array 'vector 4)) ) @@ -751,13 +750,7 @@ (let ((f30-0 (* 0.5 (vector-length (vector-! (new 'stack-no-clear 'vector) (-> s3-0 1) (-> s3-0 0)))))) (let ((f28-0 (fmax 81920.0 (+ 12288.0 (vector-length (vector-! (new 'stack-no-clear 'vector) s1-0 (-> s3-0 0))))))) (vector-normalize-copy! s4-0 (-> this node-list data (-> this gun-joint-l s2-0) bone transform vector 2) 1.0) - (let ((s0-0 vector-rotate-y!)) - (set! sv-144 s4-0) - (set! sv-160 s4-0) - (let ((a2-1 (- 16384.0 (acos (/ f30-0 f28-0))))) - (s0-0 sv-144 sv-160 a2-1) - ) - ) + (vector-rotate-y! s4-0 s4-0 (- 16384.0 (acos (/ f30-0 f28-0)))) (set! (-> s5-0 0 quad) (-> s3-0 0 quad)) (vector+float*! (-> s5-0 1) (-> s5-0 0) s4-0 512000.0) (set! (-> this shot-range) (fmin 204800.0 f28-0)) @@ -803,13 +796,9 @@ ) ) (vector+float*! s4-0 (-> s3-0 start-pos) (-> s3-0 move-dist) f28-0) - (let* ((s3-1 (-> s3-0 best-other-tri collide-ptr)) - (s2-0 (if (type? s3-1 collide-shape-prim) - (the-as collide-shape-prim s3-1) - ) - ) - (s3-2 (new 'stack-no-clear 'vector)) - ) + (let ((s2-0 (as-type (-> s3-0 best-other-tri collide-ptr) collide-shape-prim)) + (s3-2 (new 'stack-no-clear 'vector)) + ) (set! (-> s3-2 quad) (-> s4-0 quad)) (vector+float*! s3-2 s3-2 (-> (math-camera-matrix) vector 2) -2048.0) (cond @@ -842,12 +831,7 @@ ) (defbehavior turret-post fort-robotank-turret () - (let* ((s5-0 *target*) - (gp-0 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((gp-0 (the-as target (as-type *target* process-focusable)))) (cond ((and (logtest? (-> self flags) (robotank-turret-flags rotflags-0)) gp-0) (send-event (handle->process (-> self reticle)) 'on) @@ -862,7 +846,7 @@ (s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self gun-joint-l 0)))) ) (let ((v1-31 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self gun-joint-r 0))))) - (vector-! s5-2 (-> self aim-pos-2) (the-as vector (-> self aim-pos))) + (vector-! s5-2 (-> self aim-pos-2) (-> self aim-pos 0)) (vector-float*! s5-2 s5-2 (* 0.8 (-> self clock frames-per-second))) (set! (-> s5-2 y) 0.0) (vector+! s5-2 (-> self aim-pos-2) s5-2) @@ -1116,16 +1100,12 @@ (if (logtest? (-> self flags) (robotank-turret-flags rotflags-4)) (set-time! (-> self gun-timer)) ) - (let ((gp-0 *target*)) - (if (and (if (type? gp-0 process-focusable) - gp-0 - ) - (or (not (logtest? (-> self flags) (robotank-turret-flags rotflags-9))) (check-los? (-> self los) 0)) - (time-elapsed? (-> self gun-timer) (seconds 1)) - ) - (go-virtual fire) - ) - ) + (if (and (the-as target (as-type *target* process-focusable)) + (or (not (logtest? (-> self flags) (robotank-turret-flags rotflags-9))) (check-los? (-> self los) 0)) + (time-elapsed? (-> self gun-timer) (seconds 1)) + ) + (go-virtual fire) + ) ) :code (behavior () (until #f @@ -1145,12 +1125,7 @@ :event robotank-turret-handler :enter (behavior () (logior! (-> self flags) (robotank-turret-flags rotflags-8)) - (let* ((gp-0 *target*) - (a0-1 (if (type? gp-0 process-focusable) - gp-0 - ) - ) - ) + (let ((a0-1 (the-as target (as-type *target* process-focusable)))) (when a0-1 (set! (-> self aim-pos 0 quad) (-> (get-trans a0-1 0) quad)) (set! (-> self aim-pos-2 quad) (-> self aim-pos 0 quad)) @@ -1159,20 +1134,15 @@ ) ) :trans (behavior () - (let ((gp-0 *target*)) - (when (or (not (if (type? gp-0 process-focusable) - gp-0 - ) - ) - (and (logtest? (-> self flags) (robotank-turret-flags rotflags-9)) - (not (logtest? (-> self flags) (robotank-turret-flags rotflags-3))) - (skip-check-los? (-> self los) 0) - ) - (logtest? (-> self flags) (robotank-turret-flags rotflags-4)) - ) - (logclear! (-> self flags) (robotank-turret-flags rotflags-8)) - (go-virtual ready) - ) + (when (or (not (the-as target (as-type *target* process-focusable))) + (and (logtest? (-> self flags) (robotank-turret-flags rotflags-9)) + (not (logtest? (-> self flags) (robotank-turret-flags rotflags-3))) + (skip-check-los? (-> self los) 0) + ) + (logtest? (-> self flags) (robotank-turret-flags rotflags-4)) + ) + (logclear! (-> self flags) (robotank-turret-flags rotflags-8)) + (go-virtual ready) ) ) :code (behavior () diff --git a/goal_src/jak2/levels/fortress/dump/fort-robotank.gc b/goal_src/jak2/levels/fortress/dump/fort-robotank.gc index 45ed8f6dc6..b30dd41820 100644 --- a/goal_src/jak2/levels/fortress/dump/fort-robotank.gc +++ b/goal_src/jak2/levels/fortress/dump/fort-robotank.gc @@ -527,11 +527,6 @@ ) (defmethod fort-robotank-method-26 ((this fort-robotank) (arg0 int) (arg1 float) (arg2 float)) - (local-vars - (sv-96 fort-robotank-segment-event) - (sv-112 (function process-tree event-message-block object)) - (sv-128 event-message-block) - ) (with-pp (let* ((s4-0 (* 0.00001 (the float (the int (+ 0.5 (* 100000.0 arg1)))))) (s3-0 (* 0.00001 (the float (the int (+ 0.5 (* 100000.0 arg2)))))) @@ -539,18 +534,17 @@ (s1-0 (-> s2-0 event-tbl)) ) (dotimes (s0-0 (-> s2-0 event-count)) - (set! sv-96 (-> s1-0 s0-0)) - (let ((f0-4 (-> sv-96 pos-norm))) + (let* ((sv-96 (-> s1-0 s0-0)) + (f0-4 (-> sv-96 pos-norm)) + ) (when (and (= (-> sv-96 source) arg0) (>= s4-0 f0-4) (< s3-0 f0-4)) (case (-> sv-96 event-type) (('send-event) - (set! sv-128 (new 'stack-no-clear 'event-message-block)) - (set! (-> sv-128 from) (process->ppointer pp)) - (set! (-> sv-128 num-params) 0) - (set! (-> sv-128 message) (the-as symbol (-> sv-96 param-obj))) - (set! sv-112 send-event-function) - (let ((a0-11 (process-by-ename (-> sv-96 actor)))) - (sv-112 a0-11 sv-128) + (let ((sv-128 (new 'stack-no-clear 'event-message-block))) + (set! (-> sv-128 from) (process->ppointer pp)) + (set! (-> sv-128 num-params) 0) + (set! (-> sv-128 message) (the-as symbol (-> sv-96 param-obj))) + (send-event-function (process-by-ename (-> sv-96 actor)) sv-128) ) ) (('code) diff --git a/goal_src/jak2/levels/fortress/prison/prison-obs.gc b/goal_src/jak2/levels/fortress/prison/prison-obs.gc index e3adf0bcd5..beae308715 100644 --- a/goal_src/jak2/levels/fortress/prison/prison-obs.gc +++ b/goal_src/jak2/levels/fortress/prison/prison-obs.gc @@ -55,7 +55,6 @@ (define *prsn-chair-shackle-lightning-joints* (new 'static 'boxed-array :type int32 4 5 6 7)) (defbehavior dark-lightning-handler process-drawable ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (sv-112 sparticle-launcher) (sv-160 vector) (sv-164 vector) (sv-176 lightning-spec)) (let ((s3-0 (new 'static 'vector4w :x -1)) (s4-0 (new 'static 'vector4w :x -1)) (s5-0 (command-get-process "jak-highres-prison" *target*)) @@ -71,7 +70,7 @@ (let ((v1-7 (rand-vu-int-range-exclude 0 (+ (-> *prsn-chair-shackle-lightning-joints* length) -1) (-> s4-0 x)))) (when s1-0 (set! (-> s4-0 x) v1-7) - (vector<-cspace! (the-as vector (-> gp-1 vector)) (-> self node-list data 13)) + (vector<-cspace! (-> gp-1 vector 0) (-> self node-list data 13)) (vector<-cspace! (-> gp-1 vector 1) (-> self node-list data (-> s2-0 s3-1))) (vector<-cspace! (-> gp-1 vector 2) (-> self node-list data (+ (-> s2-0 s3-1) 1))) (vector<-cspace! (-> gp-1 trans) (-> (the-as process-drawable s5-0) node-list data 8)) @@ -101,38 +100,17 @@ (set! (-> s4-0 x) v1-38) (let ((s4-2 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 8))) (s5-2 (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s5-0) node-list data 5))) - (s3-3 (get-process *default-dead-pool* lightning-tracker #x4000)) ) - (when s3-3 - (let ((t9-17 (method-of-type lightning-tracker activate))) - (t9-17 - (the-as lightning-tracker s3-3) - self - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s2-2 run-function-in-process) - (s1-2 s3-3) - (s0-1 lightning-tracker-init) - ) - (set! sv-176 (-> *lightning-spec-id-table* 19)) - (let ((a3-4 (the int (* 300.0 (rand-vu-float-range 1.0 2.0)))) - (t0-1 lightning-probe-callback) - ) - ((the-as (function object object object object object object object object none) s2-2) - s1-2 - s0-1 - sv-176 - a3-4 - t0-1 - gp-2 - s4-2 - s5-2 - ) - ) - ) - (-> s3-3 ppointer) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 19) + (the int (* 300.0 (rand-vu-float-range 1.0 2.0))) + lightning-probe-callback + gp-2 + s4-2 + s5-2 + :to self ) ) ) @@ -150,51 +128,51 @@ (s1-3 (-> s5-3 length)) (s0-2 (rand-vu-int-range-exclude 0 (+ v1-52 -1) (-> s3-0 x))) (s1-4 (rand-vu-int-range-exclude 0 (+ s1-3 -1) (-> s4-0 x))) + (sv-112 (-> *part-id-table* 179)) ) - (set! sv-112 (-> *part-id-table* 179)) (set! (-> s3-0 x) s0-2) (set! (-> s4-0 x) s1-4) - (set! sv-160 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> s2-3 s0-2)))) - (set! sv-164 (vector<-cspace! - (new 'stack-no-clear 'vector) - (-> (the-as process-drawable gp-3) node-list data (-> s5-3 s1-4)) + (let* ((sv-160 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> s2-3 s0-2)))) + (sv-164 (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> (the-as process-drawable gp-3) node-list data (-> s5-3 s1-4)) + ) ) - ) - ) - (let ((s4-3 (process-spawn - lightning-tracker - :init lightning-tracker-init - (-> *lightning-spec-id-table* 19) - (the int (* 300.0 (rand-vu-float-range 1.0 2.0))) - lightning-probe-callback - self - sv-160 - sv-164 - :to gp-3 - ) + (s4-3 (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 19) + (the int (* 300.0 (rand-vu-float-range 1.0 2.0))) + lightning-probe-callback + self + sv-160 + sv-164 + :to gp-3 + ) + ) + ) + (when (and sv-112 s4-3) + (let ((v1-74 (get-field-spec-by-id sv-112 (sp-field-id spt-timer)))) + (if v1-74 + (set! (-> v1-74 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> s4-3 0)) duration))) ) - ) - (when (and sv-112 s4-3) - (let ((v1-74 (get-field-spec-by-id sv-112 (sp-field-id spt-timer)))) - (if v1-74 - (set! (-> v1-74 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> s4-3 0)) duration))) - ) - ) - (let ((t9-30 sp-launch-particles-var) - (a0-35 *sp-particle-system-2d*) - (a1-37 sv-112) - (a2-19 *launch-matrix*) - ) - (set! (-> a2-19 trans quad) (-> sv-160 quad)) - (t9-30 a0-35 a1-37 a2-19 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) - ) - (let ((t9-31 sp-launch-particles-var) - (a0-36 *sp-particle-system-2d*) - (a1-38 sv-112) - (a2-20 *launch-matrix*) - ) - (set! (-> a2-20 trans quad) (-> sv-164 quad)) - (t9-31 a0-36 a1-38 a2-20 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-30 sp-launch-particles-var) + (a0-35 *sp-particle-system-2d*) + (a1-37 sv-112) + (a2-19 *launch-matrix*) + ) + (set! (-> a2-19 trans quad) (-> sv-160 quad)) + (t9-30 a0-35 a1-37 a2-19 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-31 sp-launch-particles-var) + (a0-36 *sp-particle-system-2d*) + (a1-38 sv-112) + (a2-20 *launch-matrix*) + ) + (set! (-> a2-20 trans quad) (-> sv-164 quad)) + (t9-31 a0-36 a1-38 a2-20 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -250,11 +228,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this prsn-hang-cell) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -399,11 +377,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this prsn-cell-door) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) @@ -466,11 +444,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this prsn-vent-fan) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -512,11 +490,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this prsn-torture) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 penetrated-by) (penetrate)) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 9) 0))) diff --git a/goal_src/jak2/levels/fortress/rescue/forresca-obs.gc b/goal_src/jak2/levels/fortress/rescue/forresca-obs.gc index c077453825..6178a8f071 100644 --- a/goal_src/jak2/levels/fortress/rescue/forresca-obs.gc +++ b/goal_src/jak2/levels/fortress/rescue/forresca-obs.gc @@ -220,12 +220,14 @@ (let ((a0-0 *target*)) (when (and a0-0 (< 81920.0 (vector-vector-distance (get-trans a0-0 0) (-> self root trans)))) (set! (-> self quality-enabled?) #f) - (suspend-for (seconds 0.5)) + (suspend-for (seconds 0.5) + ) (hide-hud-quick #f) (set-setting! 'entity-name "camera-243" 0.0 0) (set-setting! 'process-mask 'set 0.0 (process-mask movie enemy)) (process-grab? *target* #f) - (suspend-for (seconds 2)) + (suspend-for (seconds 2) + ) ) ) (go-virtual shutdown) @@ -318,7 +320,8 @@ ) :code (behavior () (until (-> self all-gone?) - (suspend-for (seconds 0.5)) + (suspend-for (seconds 0.5) + ) ) (set-setting! 'interp-time 'abs 0.0 0) (remove-setting! 'entity-name) @@ -357,7 +360,7 @@ (defmethod set-state! ((this elec-lock-gate)) "If either [[actor-option::17]] is set on the [[elec-gate]] or the related subtask is completed make the gate `idle`. - + Otherwise, the gate will be `active`." (if (elec-lock-gate-method-31 this #f) (go (method-of-object this shutdown)) @@ -368,13 +371,13 @@ (defmethod set-palette! ((this elec-lock-gate)) "Sets the [[elec-gate]]'s `palette-id` appropriately" - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type fort-elec-gate set-palette!))) (t9-0 this) ) (logclear! (-> this mask) (process-mask actor-pause)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-4 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-4 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-4 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-4)) diff --git a/goal_src/jak2/levels/fortress/rescue/forrescb-obs.gc b/goal_src/jak2/levels/fortress/rescue/forrescb-obs.gc index 02972ffff4..f8b91eee54 100644 --- a/goal_src/jak2/levels/fortress/rescue/forrescb-obs.gc +++ b/goal_src/jak2/levels/fortress/rescue/forrescb-obs.gc @@ -187,12 +187,6 @@ ) :code sleep-code :post (behavior () - (local-vars - (sv-1696 - (function lightning-spec time-frame symbol process-drawable vector vector none :behavior lightning-tracker) - ) - (sv-1712 lightning-spec) - ) (let ((a1-0 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-0 from) (process->ppointer self)) (set! (-> a1-0 num-params) 2) @@ -217,11 +211,11 @@ (gp-1 (vector-cross! (new 'stack-no-clear 'vector) v0-4 *up-vector*)) (s5-0 (-> self l-bolt)) (f30-0 90112.0) - (f0-6 (* f30-0 f30-0)) + (f0-6 (square f30-0)) (s4-1 (vector-! (new 'stack-no-clear 'vector) s2-0 s3-0)) (f1-4 (* 0.5 (vector-length s4-1))) ) - (let ((f2-2 (* f1-4 f1-4))) + (let ((f2-2 (square f1-4))) (vector-float*! s4-1 s4-1 0.5) (vector+! s4-1 s3-0 s4-1) (+! (-> s4-1 y) (sqrtf (- f0-6 f2-2))) @@ -286,47 +280,19 @@ (set! (-> v1-54 action-mask) (collide-action solid semi-solid)) ) (when (>= (probe-using-line-sphere *collide-cache* s3-2) 0.0) - (let* ((s2-2 (-> s3-2 best-other-tri collide-ptr)) - (s3-3 (if (type? s2-2 collide-shape-prim-sphere) - (the-as collide-shape-prim-sphere s2-2) - ) - ) - ) + (let ((s3-3 (as-type (-> s3-2 best-other-tri collide-ptr) collide-shape-prim-sphere))) (when s3-3 (sound-play "laser-hit") - (let ((s2-4 (get-process *default-dead-pool* lightning-tracker #x4000))) - (when s2-4 - (let ((t9-19 (method-of-type lightning-tracker activate))) - (t9-19 - (the-as lightning-tracker s2-4) - *entity-pool* - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s1-3 run-function-in-process) - (s0-0 s2-4) - ) - (set! sv-1696 lightning-tracker-init) - (set! sv-1712 (-> self l-spec)) - (let ((a3-3 (the int (* 3.0 (rand-vu-float-range 5.0 11.0)))) - (t0-2 #f) - (t1-2 #f) - ) - ((the-as (function object object object object object object object object none) s1-3) - s0-0 - sv-1696 - sv-1712 - a3-3 - t0-2 - t1-2 - s5-2 - s4-2 - ) - ) - ) - (-> s2-4 ppointer) - ) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> self l-spec) + (the int (* 3.0 (rand-vu-float-range 5.0 11.0))) + #f + #f + s5-2 + s4-2 + :to *entity-pool* ) (let ((v1-68 (vector-reset! (new 'stack-no-clear 'vector)))) (send-event @@ -525,13 +491,13 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-64 int)) (quaternion-copy! (-> this init-quat) (-> arg0 quat)) (let ((s5-0 (new 'stack-no-clear 'sync-info-params))) (let ((s3-0 1200)) 0.0 - (set! sv-64 0) - (let ((v1-1 (res-lump-data arg0 'sync (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-64))))) + (let* ((sv-64 0) + (v1-1 (res-lump-data arg0 'sync (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-64)))) + ) (when v1-1 (set! s3-0 (the int (* 300.0 (-> v1-1 0)))) (-> v1-1 1) diff --git a/goal_src/jak2/levels/gungame/gun-dummy.gc b/goal_src/jak2/levels/gungame/gun-dummy.gc index 299305e8a1..ec78036b79 100644 --- a/goal_src/jak2/levels/gungame/gun-dummy.gc +++ b/goal_src/jak2/levels/gungame/gun-dummy.gc @@ -2061,7 +2061,7 @@ (set! f28-2 (+ (* -2.0 f28-2 f28-2 f28-2) (* 3.0 f28-2 f28-2))) ) ((= v1-87 2) - (set! f28-2 (* f28-2 f28-2 f28-2)) + (set! f28-2 (* (square f28-2) f28-2)) ) ((= v1-87 3) (sin (* 16384.0 f28-2)) diff --git a/goal_src/jak2/levels/gungame/gungame-obs.gc b/goal_src/jak2/levels/gungame/gungame-obs.gc index b685547588..d43b1da1cb 100644 --- a/goal_src/jak2/levels/gungame/gungame-obs.gc +++ b/goal_src/jak2/levels/gungame/gungame-obs.gc @@ -221,15 +221,9 @@ ) ) (set! (-> s5-1 flags) (font-flags shadow kerning middle-vert large)) - (let ((v1-4 s5-1)) - (set! (-> v1-4 width) (the float 440)) - ) - (let ((v1-5 s5-1)) - (set! (-> v1-5 height) (the float 80)) - ) - (let ((v1-6 s5-1)) - (set! (-> v1-6 scale) 0.7) - ) + (set-width! s5-1 440) + (set-height! s5-1 80) + (set-scale! s5-1 0.7) (let ((s4-0 print-game-text)) (format (clear *temp-string*) (lookup-text! *common-text* arg0 #f)) (s4-0 *temp-string* s5-1 #f 44 (bucket-id progress)) @@ -1885,27 +1879,13 @@ ) (defmethod training-manager-method-26 ((this training-manager)) - (local-vars (s3-0 object)) (let ((gp-0 0)) (dotimes (s4-0 (-> *entrance-gungame-crates-pos* length)) (if (and (handle->process (-> this entrance-crates s4-0)) - (begin - (let* ((s3-1 #t) - (s2-0 (-> this entrance-crates s4-0 process 0)) - (v1-11 (the-as focus-status (logand (-> (if (type? s2-0 process-focusable) - (the-as process-focusable s2-0) - ) - focus-status - ) - (focus-status dead) - ) - ) - ) - ) - (cmove-#f-nonzero s3-0 v1-11 s3-1) - ) - s3-0 - ) + (not (logtest? (-> (as-type (-> this entrance-crates s4-0 process 0) process-focusable) focus-status) + (focus-status dead) + ) + ) ) (+! gp-0 1) ) @@ -1957,7 +1937,7 @@ ) (defmethod training-manager-method-22 ((this training-manager) (arg0 symbol)) - (local-vars (v1-28 symbol) (a0-18 symbol) (sv-48 process) (sv-64 process) (sv-80 process)) + (local-vars (v1-28 symbol) (a0-18 symbol) (sv-64 process) (sv-80 process)) (let ((s4-0 (new 'static 'fact-info :pickup-type (pickup-type ammo-red) :pickup-spawn-amount 20.0)) (s3-0 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack-no-clear 'sphere)) @@ -1980,17 +1960,20 @@ ) ) (when (and s1-0 (not (handle->process (-> this entrance-crates s0-0)))) - (set! sv-48 (get-process *default-dead-pool* crate #x4000)) - (let ((v1-21 - (when sv-48 - (let ((t9-4 (method-of-type crate activate))) - (t9-4 (the-as crate sv-48) *entity-pool* (symbol->string (-> crate symbol)) (the-as pointer #x70004000)) + (let* ((sv-48 (get-process *default-dead-pool* crate #x4000)) + (v1-21 + (when sv-48 + ((method-of-type crate activate) + (the-as crate sv-48) + *entity-pool* + (symbol->string (-> crate symbol)) + (the-as pointer #x70004000) ) - (run-now-in-process sv-48 crate-init-by-other #f s3-0 'wood s4-0) - (-> sv-48 ppointer) - ) - ) - ) + (run-now-in-process sv-48 crate-init-by-other #f s3-0 'wood s4-0) + (-> sv-48 ppointer) + ) + ) + ) (set! a0-18 (when v1-21 (set! sv-64 (the-as process a0-18)) (set! sv-64 (-> v1-21 0 self)) @@ -2009,11 +1992,7 @@ *up-vector* (+ -4551.1113 (-> *entrance-gungame-crates-pos* s0-0 pos w)) ) - (set! (-> this entrance-crates s0-0) (ppointer->handle (if sv-80 - (-> sv-80 ppointer) - ) - ) - ) + (set! (-> this entrance-crates s0-0) (process->handle sv-80)) ) ) ) @@ -2055,12 +2034,10 @@ (training-manager-method-29 this s4-0) (set! (-> s3-0 pickup-type) (-> arg0 s2-0 ammo)) (set! (-> s3-0 pickup-spawn-amount) (the float (-> arg0 s2-0 num))) - (let* ((s0-0 (ppointer->process (process-spawn crate #f s4-0 'wood s3-0 :to *entity-pool*))) - (s1-1 (if (type? s0-0 process-focusable) - (the-as process-focusable s0-0) - ) - ) - ) + (let ((s1-1 + (as-type (ppointer->process (process-spawn crate #f s4-0 'wood s3-0 :to *entity-pool*)) process-focusable) + ) + ) (quaternion-vector-angle! (-> s1-1 root quat) *up-vector* (+ -4551.1113 (-> arg0 s2-0 pos w))) (set! (-> this course-crates s2-0) (process->handle s1-1)) ) @@ -2145,10 +2122,10 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (set-setting! 'darkjak #f 0.0 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-3 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-3)) diff --git a/goal_src/jak2/levels/hiphog/whack.gc b/goal_src/jak2/levels/hiphog/whack.gc index a84eea36a5..f019b6fdcb 100644 --- a/goal_src/jak2/levels/hiphog/whack.gc +++ b/goal_src/jak2/levels/hiphog/whack.gc @@ -2139,14 +2139,6 @@ ) ) :code (behavior ((arg0 symbol)) - (local-vars - (sv-48 whack-a-metal) - (sv-64 (function vector cspace vector)) - (sv-80 vector) - (sv-96 vector) - (sv-112 (function vector cspace vector)) - (sv-128 vector) - ) (let ((gp-0 (cond ((>= (-> self air-attack-count) 10) daxter-highres-mole-idle-tired-ja @@ -2167,50 +2159,25 @@ (ja-no-eval :group! daxter-highres-mole-shock-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (when (rand-vu-percent? 0.2) - (let* ((gp-2 (get-process *default-dead-pool* lightning-tracker #x4000)) - (v1-26 (when gp-2 - (let ((t9-6 (method-of-type lightning-tracker activate))) - (t9-6 - (the-as lightning-tracker gp-2) - self - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s5-1 run-function-in-process) - (s4-0 gp-2) - (s3-0 lightning-tracker-init) - (s2-0 (-> *lightning-spec-id-table* 21)) - (s1-0 0) - (s0-0 lightning-probe-callback) - ) - (set! sv-48 self) - (set! sv-64 vector<-cspace!) - (set! sv-80 (new 'stack-no-clear 'vector)) - (let ((a1-8 (-> self node-list data (rand-vu-int-range 3 (+ (-> self node-list length) -1))))) - (set! sv-96 (sv-64 sv-80 a1-8)) - ) - (set! sv-112 vector<-cspace!) - (set! sv-128 (new 'stack-no-clear 'vector)) - (let* ((a1-10 (-> self node-list data (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) - (t3-0 (sv-112 sv-128 a1-10)) - ) - ((the-as (function object object object object object object object object none) s5-1) - s4-0 - s3-0 - s2-0 - s1-0 - s0-0 - sv-48 - sv-96 - t3-0 - ) - ) - ) - (-> gp-2 ppointer) - ) - ) - ) + (let ((v1-26 (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 21) + 0 + lightning-probe-callback + self + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> self node-list data (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + ) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> self node-list data (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + ) + :to self + ) + ) + ) (when v1-26 (set! (-> (the-as lightning-tracker (-> v1-26 0)) user-time 0) 0) 0 diff --git a/goal_src/jak2/levels/intro/intro-scenes.gc b/goal_src/jak2/levels/intro/intro-scenes.gc index 28623c942a..fba2c6ce9e 100644 --- a/goal_src/jak2/levels/intro/intro-scenes.gc +++ b/goal_src/jak2/levels/intro/intro-scenes.gc @@ -3480,43 +3480,18 @@ "particleman" 'eval ,(lambda () - (local-vars (sv-48 symbol) (sv-64 symbol) (sv-80 vector)) (with-pp - (let ((gp-0 (the-as target (command-get-process "particleman" *target*))) - (s5-0 (get-process *default-dead-pool* lightning-tracker #x4000)) - ) - (when s5-0 - (let ((t9-2 (method-of-type lightning-tracker activate))) - (t9-2 - (the-as lightning-tracker s5-0) - pp - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s4-0 run-function-in-process) - (s3-0 s5-0) - (s2-0 lightning-tracker-init) - (s1-0 (-> *lightning-spec-id-table* 1)) - (s0-0 30) - ) - (set! sv-48 (the-as symbol #f)) - (set! sv-64 (the-as symbol #f)) - (set! sv-80 (vector<-cspace! (new 'stack-no-clear 'vector) (-> gp-0 node-list data 5))) - (let ((t3-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> gp-0 node-list data 6)))) - ((the-as (function object object object object object object object object none) s4-0) - s3-0 - s2-0 - s1-0 - s0-0 - sv-48 - sv-64 - sv-80 - t3-0 - ) - ) - ) - (-> s5-0 ppointer) + (let ((gp-0 (the-as target (command-get-process "particleman" *target*)))) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 1) + 30 + (the-as symbol #f) + (the-as symbol #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> gp-0 node-list data 5)) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> gp-0 node-list data 6)) + :to pp ) ) ) diff --git a/goal_src/jak2/levels/mountain/mountain-obs.gc b/goal_src/jak2/levels/mountain/mountain-obs.gc index 7b7b2d6c31..721b279614 100644 --- a/goal_src/jak2/levels/mountain/mountain-obs.gc +++ b/goal_src/jak2/levels/mountain/mountain-obs.gc @@ -409,7 +409,6 @@ ) (defmethod mtn-dice-method-26 ((this mtn-dice) (arg0 process-focusable) (arg1 touching-shapes-entry)) - (local-vars (sv-96 vector) (sv-112 vector) (sv-128 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -424,92 +423,89 @@ (f30-0 -0.71) (s2-0 (the-as touching-prims-entry #f)) ) - (let ((s0-0 vector-z-quaternion!)) - (set! sv-96 s3-1) - (let ((a1-3 (get-quat arg0 2))) - (s0-0 sv-96 a1-3) - ) - ) + (vector-z-quaternion! s3-1 (get-quat arg0 2)) (let ((s1-1 (-> arg1 head))) (while s1-1 (let ((v1-4 (get-touched-prim s1-1 (-> this root) arg1))) (-> v1-4 cshape) - (set! sv-128 (new 'stack-no-clear 'vector)) - (set! (-> sv-128 quad) (the-as uint128 0)) - (set! sv-112 (new 'stack-no-clear 'vector)) - (let ((s0-1 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (when (>= (-> this face-status (-> v1-4 prim-id)) 0) - (set! (-> sv-128 quad) (-> this face-matrix (-> v1-4 prim-id) quad 0)) - (set! (-> sv-128 w) (- (vector-dot (-> this face-matrix (-> v1-4 prim-id) trans) sv-128))) - (set! (-> sv-112 quad) (-> this face-matrix (-> v1-4 prim-id) trans quad)) - (let ((f0-4 (vector4-dot sv-128 (-> s4-0 trans))) - (f28-0 (vector-dot sv-128 s3-1)) - ) - (when (< f0-4 0.0) - (let ((a2-2 s0-1)) - (let ((a0-28 sv-112)) - (let ((a1-18 sv-128)) - (let ((a3-1 -8192.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a1-18 quad)) - ) - (.lvf vf4 (&-> a0-28 quad)) + (let ((sv-128 (new 'stack-no-clear 'vector))) + (set! (-> sv-128 quad) (the-as uint128 0)) + (let ((sv-112 (new 'stack-no-clear 'vector)) + (s0-1 (new 'stack-no-clear 'vector)) + ) + (new 'stack-no-clear 'vector) + (when (>= (-> this face-status (-> v1-4 prim-id)) 0) + (set! (-> sv-128 quad) (-> this face-matrix (-> v1-4 prim-id) quad 0)) + (set! (-> sv-128 w) (- (vector-dot (-> this face-matrix (-> v1-4 prim-id) trans) sv-128))) + (set! (-> sv-112 quad) (-> this face-matrix (-> v1-4 prim-id) trans quad)) + (let ((f0-4 (vector4-dot sv-128 (-> s4-0 trans))) + (f28-0 (vector-dot sv-128 s3-1)) ) + (when (< f0-4 0.0) + (let ((a2-2 s0-1)) + (let ((a0-28 sv-112)) + (let ((a1-18 sv-128)) + (let ((a3-1 -8192.0)) + (.mov vf7 a3-1) + ) + (.lvf vf5 (&-> a1-18 quad)) + ) + (.lvf vf4 (&-> a0-28 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a2-2 quad) vf6) + ) + (let* ((a0-30 (the int (/ (-> s0-1 x) METER_LENGTH))) + (a1-20 (the int (/ (-> s0-1 z) METER_LENGTH))) + (a0-32 (/ (- *dice-offset-x* a0-30) -4)) + ) + (if (not (logtest? (-> *dice-blocked-array* (/ (- *dice-offset-z* a1-20) -4)) (ash 1 (- 15 a0-32)))) + (set! f28-0 -2.0) + ) + ) + (let ((a0-40 sv-112)) + (let ((v1-8 (-> this face-matrix (-> v1-4 prim-id) trans))) + (let ((a1-26 sv-128)) + (let ((a2-10 16384.0)) + (.mov vf7 a2-10) + ) + (.lvf vf5 (&-> a1-26 quad)) + ) + (.lvf vf4 (&-> v1-8 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a0-40 quad) vf6) + ) + (vector-negate-in-place! sv-128) + (set! f28-0 (- f28-0)) + (if (!= (-> this free-face) 5) + (set! f28-0 1.0) + ) + ) + (let ((v1-13 s0-1)) + (let ((a0-44 -8192.0)) + (.mov vf7 a0-44) + ) + (.lvf vf5 (&-> sv-128 quad)) + (.lvf vf4 (&-> sv-112 quad)) (.add.x.vf.w vf6 vf0 vf0) (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a2-2 quad) vf6) + (.svf (&-> v1-13 quad) vf6) ) - (let* ((a0-30 (the int (/ (-> s0-1 x) METER_LENGTH))) - (a1-20 (the int (/ (-> s0-1 z) METER_LENGTH))) - (a0-32 (/ (- *dice-offset-x* a0-30) -4)) + (let* ((v1-15 (the int (/ (-> s0-1 x) METER_LENGTH))) + (a0-48 (the int (/ (-> s0-1 z) METER_LENGTH))) + (v1-17 (/ (- *dice-offset-x* v1-15) -4)) + (a1-31 (/ (- *dice-offset-z* a0-48) -4)) ) - (if (not (logtest? (-> *dice-blocked-array* (/ (- *dice-offset-z* a1-20) -4)) (ash 1 (- 15 a0-32)))) - (set! f28-0 -2.0) - ) - ) - (let ((a0-40 sv-112)) - (let ((v1-8 (-> this face-matrix (-> v1-4 prim-id) trans))) - (let ((a1-26 sv-128)) - (let ((a2-10 16384.0)) - (.mov vf7 a2-10) - ) - (.lvf vf5 (&-> a1-26 quad)) - ) - (.lvf vf4 (&-> v1-8 quad)) + (when (and (< f28-0 f30-0) (not (logtest? (-> *dice-world-array* a1-31) (ash 1 (- 15 v1-17))))) + (set! f30-0 f28-0) + (set! s2-0 s1-1) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-40 quad) vf6) - ) - (vector-negate-in-place! sv-128) - (set! f28-0 (- f28-0)) - (if (!= (-> this free-face) 5) - (set! f28-0 1.0) - ) - ) - (let ((v1-13 s0-1)) - (let ((a0-44 -8192.0)) - (.mov vf7 a0-44) - ) - (.lvf vf5 (&-> sv-128 quad)) - (.lvf vf4 (&-> sv-112 quad)) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> v1-13 quad) vf6) - ) - (let* ((v1-15 (the int (/ (-> s0-1 x) METER_LENGTH))) - (a0-48 (the int (/ (-> s0-1 z) METER_LENGTH))) - (v1-17 (/ (- *dice-offset-x* v1-15) -4)) - (a1-31 (/ (- *dice-offset-z* a0-48) -4)) - ) - (when (and (< f28-0 f30-0) (not (logtest? (-> *dice-world-array* a1-31) (ash 1 (- 15 v1-17))))) - (set! f30-0 f28-0) - (set! s2-0 s1-1) ) ) ) @@ -694,7 +690,6 @@ (defstate idle (mtn-dice) :virtual #t :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (local-vars (sv-192 vector)) (cond ((= message 'print-info) (dotimes (gp-1 6) @@ -760,14 +755,9 @@ 409.6 ) (when s4-1 - (let ((s0-1 (new 'stack-no-clear 'vector))) - (set! sv-192 *dice-last-safe-position*) - (let* ((v1-42 (get-trans s4-1 0)) - (s0-2 (vector-! s0-1 sv-192 v1-42)) - ) - (vector-float*! s0-2 s0-2 0.5) - (send-event proc 'shove (-> block param 0) (static-attack-info ((id (new-attack-id)) (vector s0-2)))) - ) + (let ((s0-2 (vector-! (new 'stack-no-clear 'vector) *dice-last-safe-position* (get-trans s4-1 0)))) + (vector-float*! s0-2 s0-2 0.5) + (send-event proc 'shove (-> block param 0) (static-attack-info ((id (new-attack-id)) (vector s0-2)))) ) ) ) @@ -998,19 +988,6 @@ ) (defun dice-joint-callback ((arg0 draw-control) (arg1 cspace-array) (arg2 joint-control)) - (local-vars - (sv-544 int) - (sv-560 vector) - (sv-576 vector) - (sv-592 vector) - (sv-608 vector) - (sv-624 vector) - (sv-640 vector) - (sv-656 matrix) - (sv-672 matrix) - (sv-688 vector) - (sv-704 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1041,25 +1018,24 @@ (set! (-> v1-9 quad 2) a2-1) (set! (-> v1-9 trans quad) a3-1) ) - (let ((v1-12 (the int (+ 2.0 (/ (-> s1-0 trans x) METER_LENGTH)))) - (a0-14 (the int (+ 2.0 (/ (-> s1-0 trans z) METER_LENGTH)))) - ) - (set! sv-544 (/ (- *dice-offset-x* v1-12) -4)) - (let ((s0-0 (/ (- *dice-offset-z* a0-14) -4))) - (when (and (= (-> gp-0 face-status s2-0) -1) (= (-> gp-0 active) 1)) - (when (and (= (-> gp-0 active) 1) (not (logtest? (-> *dice-blocked-array* s0-0) (ash 1 (- 15 sv-544))))) - (when (> *dice-back-way-num* 0) - (set! (-> *dice-last-safe-position* quad) (-> *dice-back-way* (+ *dice-back-way-num* -1) quad)) - (+! (-> *dice-last-safe-position* y) 8192.0) - ) - (when (not (dice-wrong-way?)) - (set! (-> *dice-back-way* *dice-back-way-num* quad) (-> s1-0 trans quad)) - (set! *dice-back-way-num* (+ *dice-back-way-num* 1)) - ) - (set! (-> *dice-blocked-array* s0-0) - (the-as uint (logior (ash 1 (- 15 sv-544)) (-> *dice-blocked-array* s0-0))) - ) + (let* ((v1-12 (the int (+ 2.0 (/ (-> s1-0 trans x) METER_LENGTH)))) + (a0-14 (the int (+ 2.0 (/ (-> s1-0 trans z) METER_LENGTH)))) + (sv-544 (/ (- *dice-offset-x* v1-12) -4)) + (s0-0 (/ (- *dice-offset-z* a0-14) -4)) + ) + (when (and (= (-> gp-0 face-status s2-0) -1) (= (-> gp-0 active) 1)) + (when (and (= (-> gp-0 active) 1) (not (logtest? (-> *dice-blocked-array* s0-0) (ash 1 (- 15 sv-544))))) + (when (> *dice-back-way-num* 0) + (set! (-> *dice-last-safe-position* quad) (-> *dice-back-way* (+ *dice-back-way-num* -1) quad)) + (+! (-> *dice-last-safe-position* y) 8192.0) ) + (when (not (dice-wrong-way?)) + (set! (-> *dice-back-way* *dice-back-way-num* quad) (-> s1-0 trans quad)) + (set! *dice-back-way-num* (+ *dice-back-way-num* 1)) + ) + (set! (-> *dice-blocked-array* s0-0) + (the-as uint (logior (ash 1 (- 15 sv-544)) (-> *dice-blocked-array* s0-0))) + ) ) ) ) @@ -1098,61 +1074,66 @@ ) ) (when s0-1 - (set! sv-560 (new 'stack-no-clear 'vector)) - (set! sv-576 (new 'stack-no-clear 'vector)) - (set! sv-608 (new 'stack-no-clear 'vector)) - (set! sv-592 (new 'stack-no-clear 'vector)) - (set! sv-672 (new 'stack-no-clear 'matrix)) - (set! sv-640 (new 'stack-no-clear 'vector)) - (let ((a1-15 sv-560)) - (let ((v1-79 (-> s1-0 trans))) - (let ((a0-50 (-> s1-0 vector))) - (let ((a2-7 8192.0)) - (.mov vf7 a2-7) + (let ((sv-560 (new 'stack-no-clear 'vector))) + (let ((sv-576 (new 'stack-no-clear 'vector)) + (sv-608 (new 'stack-no-clear 'vector)) + (sv-592 (new 'stack-no-clear 'vector)) + (sv-672 (new 'stack-no-clear 'matrix)) + (sv-640 (new 'stack-no-clear 'vector)) ) - (.lvf vf5 (&-> a0-50 0 quad)) + (let ((a1-15 sv-560)) + (let ((v1-79 (-> s1-0 trans))) + (let ((a0-50 (-> s1-0 vector))) + (let ((a2-7 8192.0)) + (.mov vf7 a2-7) + ) + (.lvf vf5 (&-> a0-50 0 quad)) + ) + (.lvf vf4 (&-> v1-79 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-15 quad) vf6) + ) + (set! (-> sv-640 quad) (-> sv-560 quad)) + (set! (-> sv-576 quad) (-> sv-560 quad)) + (+! (-> sv-576 x) 8192.0) + (set! (-> sv-608 quad) (-> sv-560 quad)) + (+! (-> sv-608 z) 8192.0) + (set! (-> sv-560 y) (get-ripple-height s0-1 sv-560)) + (set! (-> sv-576 y) (get-ripple-height s0-1 sv-576)) + (set! (-> sv-608 y) (get-ripple-height s0-1 sv-608)) + (vector-! sv-576 sv-576 sv-560) + (vector-! sv-608 sv-608 sv-560) + (set! (-> sv-576 y) (/ (-> sv-576 y) 2)) + (set! (-> sv-608 y) (/ (-> sv-608 y) 2)) + (set! (-> sv-576 w) 0.0) + (set! (-> sv-592 w) 0.0) + (set! (-> sv-608 w) 0.0) + (vector-normalize! sv-576 1.0) + (vector-normalize! sv-608 1.0) + (vector-cross! sv-592 sv-608 sv-576) + (vector-normalize! sv-592 1.0) + (vector-cross! sv-608 sv-576 sv-592) + (vector-normalize! sv-608 1.0) + (matrix-identity! sv-672) + (set! (-> sv-672 vector 0 quad) (-> sv-576 quad)) + (set! (-> sv-672 vector 1 quad) (-> sv-592 quad)) + (set! (-> sv-672 vector 2 quad) (-> sv-608 quad)) + (let ((sv-624 (new 'stack-no-clear 'vector)) + (sv-656 (new 'stack-no-clear 'matrix)) + (sv-688 (new 'stack-no-clear 'vector)) + ) + (vector-negate! sv-624 sv-640) + (matrix-translate! sv-656 sv-624) + (matrix<-trans sv-672 sv-640) + (matrix*! (the-as matrix sv-688) sv-656 sv-672) + (matrix*! s1-0 s1-0 (the-as matrix sv-688)) ) - (.lvf vf4 (&-> v1-79 quad)) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-15 quad) vf6) + (+! (-> s1-0 trans y) (* 0.5 (- (-> sv-560 y) (-> s0-1 water-height)))) ) - (set! (-> sv-640 quad) (-> sv-560 quad)) - (set! (-> sv-576 quad) (-> sv-560 quad)) - (+! (-> sv-576 x) 8192.0) - (set! (-> sv-608 quad) (-> sv-560 quad)) - (+! (-> sv-608 z) 8192.0) - (set! (-> sv-560 y) (get-ripple-height s0-1 sv-560)) - (set! (-> sv-576 y) (get-ripple-height s0-1 sv-576)) - (set! (-> sv-608 y) (get-ripple-height s0-1 sv-608)) - (vector-! sv-576 sv-576 sv-560) - (vector-! sv-608 sv-608 sv-560) - (set! (-> sv-576 y) (/ (-> sv-576 y) 2)) - (set! (-> sv-608 y) (/ (-> sv-608 y) 2)) - (set! (-> sv-576 w) 0.0) - (set! (-> sv-592 w) 0.0) - (set! (-> sv-608 w) 0.0) - (vector-normalize! sv-576 1.0) - (vector-normalize! sv-608 1.0) - (vector-cross! sv-592 sv-608 sv-576) - (vector-normalize! sv-592 1.0) - (vector-cross! sv-608 sv-576 sv-592) - (vector-normalize! sv-608 1.0) - (matrix-identity! sv-672) - (set! (-> sv-672 vector 0 quad) (-> sv-576 quad)) - (set! (-> sv-672 vector 1 quad) (-> sv-592 quad)) - (set! (-> sv-672 vector 2 quad) (-> sv-608 quad)) - (set! sv-624 (new 'stack-no-clear 'vector)) - (set! sv-656 (new 'stack-no-clear 'matrix)) - (set! sv-688 (new 'stack-no-clear 'vector)) - (vector-negate! sv-624 sv-640) - (matrix-translate! sv-656 sv-624) - (matrix<-trans sv-672 sv-640) - (matrix*! (the-as matrix sv-688) sv-656 sv-672) - (matrix*! s1-0 s1-0 (the-as matrix sv-688)) - (+! (-> s1-0 trans y) (* 0.5 (- (-> sv-560 y) (-> s0-1 water-height)))) (+! (-> s1-0 trans y) 8192.0) (set! (-> s4-0 x) (fmin (-> s4-0 x) (-> s1-0 trans x))) (set! (-> s4-0 y) (fmin (-> s4-0 y) (-> s1-0 trans y))) @@ -1165,31 +1146,25 @@ ) (let ((s0-2 (new 'stack-no-clear 'vector))) (set! (-> s0-2 quad) (-> s1-0 vector 0 quad)) - (set! sv-704 (new 'stack-no-clear 'vector)) - (let ((v1-125 (-> s1-0 trans quad))) - (set! (-> sv-704 quad) v1-125) - ) - (let ((a1-36 sv-704)) - (let ((v1-126 sv-704)) - (let ((a0-81 s0-2)) - (let ((a2-11 8192.0)) - (.mov vf7 a2-11) + (let ((sv-704 (new 'stack-no-clear 'vector))) + (set! (-> sv-704 quad) (-> s1-0 trans quad)) + (let ((a1-36 sv-704)) + (let ((v1-126 sv-704)) + (let ((a0-81 s0-2)) + (let ((a2-11 8192.0)) + (.mov vf7 a2-11) + ) + (.lvf vf5 (&-> a0-81 quad)) ) - (.lvf vf5 (&-> a0-81 quad)) + (.lvf vf4 (&-> v1-126 quad)) ) - (.lvf vf4 (&-> v1-126 quad)) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-36 quad) vf6) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-36 quad) vf6) - ) - (let ((f30-0 0.0) - (s1-1 (new 'stack-no-clear 'vector)) - (v0-14 (camera-pos)) - ) (cond - ((< f30-0 (vector-dot s0-2 (vector-! s1-1 sv-704 v0-14))) + ((< 0.0 (vector-dot s0-2 (vector-! (new 'stack-no-clear 'vector) sv-704 (camera-pos)))) (let ((v1-129 s2-0)) (cond ((zero? v1-129) @@ -2206,7 +2181,6 @@ #f ) :post (behavior () - (local-vars (sv-16 vector-array) (sv-20 vector) (sv-48 float) (sv-52 symbol)) (transform-post) (if (= (-> *setting-control* user-current music) 'mountain) (seek! (-> self volume) 0.6 (* 0.2 (seconds-per-frame))) @@ -2221,53 +2195,57 @@ (sound-group sfx) (-> self draw origin) ) - (set! sv-16 (-> self rock-data)) - (set! sv-20 (target-pos 0)) - (dotimes (gp-0 (-> self node-list length)) - (let* ((a1-3 (-> self node-list data gp-0)) - (s5-0 (vector<-cspace! (new 'stack-no-clear 'vector) a1-3)) - ) - (+! (-> s5-0 y) -4096.0) - (set! sv-48 (* (- (-> s5-0 y) (-> sv-16 data gp-0 x)) (-> self clock frames-per-second))) - (set! sv-52 (the-as symbol #f)) - (when (and (< (-> sv-16 data gp-0 y) -24576.0) (< (* 0.45 (-> sv-16 data gp-0 y)) sv-48)) - (set! sv-52 #t) - (let ((f30-0 (vector-vector-distance sv-20 s5-0))) - (when (< f30-0 204800.0) - (part-tracker-spawn :to *entity-pool* :group group-aval-rock-hit :mat-joint s5-0) - (when (= (-> sv-16 data gp-0 w) 0.0) - (sound-play-by-name - (static-sound-name "mtn-boulder") - (new-sound-id) - (the int - (* 1024.0 (* (lerp-scale 0.3 1.0 (fabs (- (-> sv-16 data gp-0 y) sv-48)) 0.0 40960.0) (-> self volume))) - ) - 0 - 0 - (sound-group sfx) - s5-0 - ) - (set! (-> sv-16 data gp-0 w) 20.0) - ) - ) - (when (< f30-0 122880.0) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 (- 1.0 (/ f30-0 (meters 30))))) (seconds 0.2)) - (activate! - *camera-smush-control* - (lerp-scale 1638.4 0.0 f30-0 0.0 122880.0) - 15 - 75 - 1.0 - 0.9 - (-> *display* camera-clock) - ) - ) - ) + (let ((sv-16 (-> self rock-data)) + (sv-20 (target-pos 0)) ) - (set! (-> sv-16 data gp-0 y) sv-48) - (set! (-> sv-16 data gp-0 x) (-> s5-0 y)) + (dotimes (gp-0 (-> self node-list length)) + (let* ((a1-3 (-> self node-list data gp-0)) + (s5-0 (vector<-cspace! (new 'stack-no-clear 'vector) a1-3)) + ) + (+! (-> s5-0 y) -4096.0) + (let ((sv-48 (* (- (-> s5-0 y) (-> sv-16 data gp-0 x)) (-> self clock frames-per-second)))) + (let ((sv-52 (the-as symbol #f))) + (when (and (< (-> sv-16 data gp-0 y) -24576.0) (< (* 0.45 (-> sv-16 data gp-0 y)) sv-48)) + (set! sv-52 #t) + (let ((f30-0 (vector-vector-distance sv-20 s5-0))) + (when (< f30-0 204800.0) + (part-tracker-spawn :to *entity-pool* :group group-aval-rock-hit :mat-joint s5-0) + (when (= (-> sv-16 data gp-0 w) 0.0) + (sound-play-by-name + (static-sound-name "mtn-boulder") + (new-sound-id) + (the int + (* 1024.0 (* (lerp-scale 0.3 1.0 (fabs (- (-> sv-16 data gp-0 y) sv-48)) 0.0 40960.0) (-> self volume))) + ) + 0 + 0 + (sound-group sfx) + s5-0 + ) + (set! (-> sv-16 data gp-0 w) 20.0) + ) + ) + (when (< f30-0 122880.0) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 (- 1.0 (/ f30-0 (meters 30))))) (seconds 0.2)) + (activate! + *camera-smush-control* + (lerp-scale 1638.4 0.0 f30-0 0.0 122880.0) + 15 + 75 + 1.0 + 0.9 + (-> *display* camera-clock) + ) + ) + ) + ) + ) + (set! (-> sv-16 data gp-0 y) sv-48) + ) + (set! (-> sv-16 data gp-0 x) (-> s5-0 y)) + ) + (seek! (-> sv-16 data gp-0 w) 0.0 1.0) ) - (seek! (-> sv-16 data gp-0 w) 0.0 1.0) ) ) ) @@ -2280,7 +2258,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 collide-shape-prim-sphere) (sv-48 collide-shape-prim-sphere) (sv-64 vector)) (stack-size-set! (-> this main-thread) 512) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (set! (-> s4-0 penetrated-by) (penetrate)) @@ -2348,19 +2325,22 @@ (s0-0 (car s1-0)) ) (while (not (null? s1-0)) - (set! sv-16 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0))) - (set! sv-48 sv-16) - (set! (-> sv-48 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> sv-48 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> sv-48 prim-core action) (-> s3-0 prim-core action)) - (set! (-> sv-48 transform-index) (command-get-int (car s0-0) 0)) - (set! (-> sv-48 prim-id) (the-as uint s2-0)) - (+! s2-0 1) - (set! sv-64 (-> sv-16 local-sphere)) - (set! (-> sv-64 x) 0.0) - (set! (-> sv-64 y) 0.0) - (set! (-> sv-64 z) 0.0) - (set! (-> sv-64 w) (command-get-float (car (cdr s0-0)) 0.0)) + (let ((sv-16 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (let ((sv-48 sv-16)) + (set! (-> sv-48 prim-core collide-as) (-> s3-0 prim-core collide-as)) + (set! (-> sv-48 prim-core collide-with) (-> s3-0 prim-core collide-with)) + (set! (-> sv-48 prim-core action) (-> s3-0 prim-core action)) + (set! (-> sv-48 transform-index) (command-get-int (car s0-0) 0)) + (set! (-> sv-48 prim-id) (the-as uint s2-0)) + ) + (+! s2-0 1) + (let ((sv-64 (-> sv-16 local-sphere))) + (set! (-> sv-64 x) 0.0) + (set! (-> sv-64 y) 0.0) + (set! (-> sv-64 z) 0.0) + (set! (-> sv-64 w) (command-get-float (car (cdr s0-0)) 0.0)) + ) + ) (set! s1-0 (cdr s1-0)) (set! s0-0 (car s1-0)) ) diff --git a/goal_src/jak2/levels/mountain/mountain-scenes.gc b/goal_src/jak2/levels/mountain/mountain-scenes.gc index e6f8111b0a..7b16f64307 100644 --- a/goal_src/jak2/levels/mountain/mountain-scenes.gc +++ b/goal_src/jak2/levels/mountain/mountain-scenes.gc @@ -1788,7 +1788,7 @@ (defmethod plat-path-sync ((this mtn-plat-buried)) "If the `sync` period is greater than `0` then transition the state to [[plat::35]] otherwise, [[plat::34]] - + @see [[sync-eased]]" (cond ((or (logtest? (-> this path flags) (path-control-flag not-found)) @@ -3071,7 +3071,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) (let ((cshape (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 3) 0))) (set! (-> cshape total-prims) (the-as uint 4)) @@ -3086,23 +3085,18 @@ (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((prim-mesh (method-of-type collide-shape-prim-mesh new))) - (set! sv-32 'process) - (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 cshape) - (let ((a3-2 (command-get-int (car s1-0) 0)) - (t0-1 0) + (let ((sv-16 + (new 'process 'collide-shape-prim-mesh cshape (the-as uint (command-get-int (car s1-0) 0)) (the-as uint 0)) ) - (set! sv-16 (prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((_prim-mesh sv-16)) + (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) + (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) ) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) ) - (let ((_prim-mesh sv-16)) - (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) - (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) - (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) - (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) - ) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) (set! s1-0 (car s2-0)) ) @@ -3151,7 +3145,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) (let ((cshape (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 17) 0))) (set! (-> cshape total-prims) (the-as uint 18)) @@ -3184,23 +3177,18 @@ (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((prim-mesh (method-of-type collide-shape-prim-mesh new))) - (set! sv-32 'process) - (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 cshape) - (let ((a3-2 (command-get-int (car s1-0) 0)) - (t0-1 0) + (let ((sv-16 + (new 'process 'collide-shape-prim-mesh cshape (the-as uint (command-get-int (car s1-0) 0)) (the-as uint 0)) ) - (set! sv-16 (prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((_prim-mesh sv-16)) + (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) + (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) ) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) ) - (let ((_prim-mesh sv-16)) - (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) - (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) - (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) - (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) - ) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) (set! s1-0 (car s2-0)) ) @@ -3249,7 +3237,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) (let ((cshape (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 24) 0))) (set! (-> cshape total-prims) (the-as uint 25)) @@ -3289,23 +3276,18 @@ (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((prim-mesh (method-of-type collide-shape-prim-mesh new))) - (set! sv-32 'process) - (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 cshape) - (let ((a3-2 (command-get-int (car s1-0) 0)) - (t0-1 0) + (let ((sv-16 + (new 'process 'collide-shape-prim-mesh cshape (the-as uint (command-get-int (car s1-0) 0)) (the-as uint 0)) ) - (set! sv-16 (prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((_prim-mesh sv-16)) + (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) + (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) ) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) ) - (let ((_prim-mesh sv-16)) - (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) - (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) - (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) - (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) - ) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) (set! s1-0 (car s2-0)) ) diff --git a/goal_src/jak2/levels/mountain/rhino.gc b/goal_src/jak2/levels/mountain/rhino.gc index db1fbc8853..ac749c568b 100644 --- a/goal_src/jak2/levels/mountain/rhino.gc +++ b/goal_src/jak2/levels/mountain/rhino.gc @@ -364,20 +364,6 @@ (defmethod general-event-handler ((this rhino) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy @TODO - unsure if there is a pattern for the events and this should have a more specific name" - (local-vars - (sv-96 int) - (sv-112 symbol) - (sv-128 symbol) - (sv-144 symbol) - (sv-160 vector) - (sv-176 matrix) - (sv-192 int) - (sv-208 symbol) - (sv-224 symbol) - (sv-240 symbol) - (sv-256 vector) - (sv-272 matrix) - ) (case arg2 (('charge) (if (-> this wall) @@ -453,78 +439,24 @@ ) (('event-slide-poof) (let ((s5-2 (-> arg3 param 1))) - (cond - ((= (-> this root ground-pat material) (pat-material grass)) - (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-1 - (let ((t9-14 (method-of-type part-tracker activate))) - (t9-14 (the-as part-tracker s4-1) this (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-1 run-function-in-process) - (s2-1 s4-1) - (s1-0 part-tracker-init) - (s0-0 group-rhino-slide-poof-grs) - ) - (set! sv-96 0) - (set! sv-112 (the-as symbol #f)) - (set! sv-128 (the-as symbol #f)) - (set! sv-144 (the-as symbol #f)) - (set! sv-176 *launch-matrix*) - (set! sv-160 (-> sv-176 trans)) - (let ((v1-52 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data s5-2)) quad))) - (set! (-> sv-160 quad) v1-52) - ) - ((the-as (function object object object object object object object object none) s3-1) - s2-1 - s1-0 - s0-0 - sv-96 - sv-112 - sv-128 - sv-144 - sv-176 - ) - ) - (-> s4-1 ppointer) - ) - ) - ) - (else - (let ((s4-2 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-2 - (let ((t9-18 (method-of-type part-tracker activate))) - (t9-18 (the-as part-tracker s4-2) this (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-2 run-function-in-process) - (s2-2 s4-2) - (s1-1 part-tracker-init) - (s0-1 group-rhino-slide-poof-pmt) - ) - (set! sv-192 0) - (set! sv-208 (the-as symbol #f)) - (set! sv-224 (the-as symbol #f)) - (set! sv-240 (the-as symbol #f)) - (set! sv-272 *launch-matrix*) - (set! sv-256 (-> sv-272 trans)) - (let ((v1-64 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data s5-2)) quad))) - (set! (-> sv-256 quad) v1-64) - ) - ((the-as (function object object object object object object object object none) s3-2) - s2-2 - s1-1 - s0-1 - sv-192 - sv-208 - sv-224 - sv-240 - sv-272 - ) - ) - (-> s4-2 ppointer) - ) + (if (= (-> this root ground-pat material) (pat-material grass)) + (part-tracker-spawn + :to this + :group group-rhino-slide-poof-grs + :callback (the-as symbol #f) + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data s5-2)) + ) + (part-tracker-spawn + :to this + :group group-rhino-slide-poof-pmt + :callback (the-as symbol #f) + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data s5-2)) ) ) - ) ) ) (('interesting) diff --git a/goal_src/jak2/levels/nest/boss/metalkor-extras.gc b/goal_src/jak2/levels/nest/boss/metalkor-extras.gc index 7192813e06..141c16d577 100644 --- a/goal_src/jak2/levels/nest/boss/metalkor-extras.gc +++ b/goal_src/jak2/levels/nest/boss/metalkor-extras.gc @@ -129,40 +129,34 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-5 vf1) - (let ((f0-0 v1-5) - (f1-0 409.6) + (cond + ((< v1-5 (square 409.6)) + (go-virtual idle) + ) + ((time-elapsed? (-> self state-time) (seconds 4)) + (go-virtual hatch) + ) + (else + (vector-v++! + (-> self root transv) + (compute-acc-due-to-gravity (the-as collide-shape-moving (-> self root)) (new-stack-vector0) 1.0) ) - (cond - ((< f0-0 (* f1-0 f1-0)) - (go-virtual idle) - ) - ((time-elapsed? (-> self state-time) (seconds 4)) - (go-virtual hatch) - ) - (else - (vector-v++! - (-> self root transv) - (compute-acc-due-to-gravity (the-as collide-shape-moving (-> self root)) (new-stack-vector0) 1.0) - ) - (let ((a2-1 (new 'stack-no-clear 'collide-query))) - (set! (-> a2-1 collide-with) (collide-spec backgnd enemy obstacle hit-by-others-list pusher)) - (set! (-> a2-1 ignore-process0) self) - (set! (-> a2-1 ignore-process1) #f) - (set! (-> a2-1 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> a2-1 action-mask) (collide-action solid)) - (fill-cache-integrate-and-collide - (the-as collide-shape-moving (-> self root)) - (-> (the-as collide-shape-moving (-> self root)) transv) - a2-1 - (meters 0) - ) + (let ((a2-1 (new 'stack-no-clear 'collide-query))) + (set! (-> a2-1 collide-with) (collide-spec backgnd enemy obstacle hit-by-others-list pusher)) + (set! (-> a2-1 ignore-process0) self) + (set! (-> a2-1 ignore-process1) #f) + (set! (-> a2-1 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> a2-1 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide + (the-as collide-shape-moving (-> self root)) + (-> (the-as collide-shape-moving (-> self root)) transv) + a2-1 + (meters 0) ) ) ) ) - (let* ((f0-1 81920.0) - (f0-3 (* f0-1 f0-1)) - ) + (let ((f0-3 (square 81920.0))) (.lvf vf1 (&-> gp-0 quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -171,9 +165,7 @@ (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-27 vf1) (cond - ((and (< f0-3 v1-27) (let* ((f0-4 81920.0) - (f0-6 (* f0-4 f0-4)) - ) + ((and (< f0-3 v1-27) (let ((f0-6 (square 81920.0))) (.lvf vf1 (&-> (-> self root transv) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -289,11 +281,6 @@ (defmethod spawn-shell-particles ((this metalkor-shot)) "TODO - confirm" - (local-vars - (sv-224 (function vector entity-actor skeleton-group vector object none :behavior manipy)) - (sv-240 vector) - (sv-256 entity-actor) - ) (let* ((s4-0 (-> this root)) (v0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> this tail-pos) (-> s4-0 trans)) 2048.0)) (gp-0 (new 'stack-no-clear 'vector)) @@ -358,37 +345,17 @@ (matrix->quaternion gp-1 s2-0) ) (sound-play "nboss-shoot-hit") - (let* ((s1-1 (get-process *default-dead-pool* manipy #x4000)) - (s2-2 - (when s1-1 - (let ((t9-10 (method-of-type manipy activate))) - (t9-10 (the-as manipy s1-1) *default-pool* (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s2-3 run-function-in-process) - (s0-0 s1-1) - ) - (set! sv-224 manipy-init) - (set! sv-240 s4-2) - (set! sv-256 (-> this entity)) - (let ((t0-2 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f))) - (t1-2 #f) - (t2-2 0) - ) - ((the-as (function object object object object object object object none) s2-3) - s0-0 - sv-224 - sv-240 - sv-256 - t0-2 - t1-2 - t2-2 - ) - ) - ) - (-> s1-1 ppointer) - ) - ) - ) + (let ((s2-2 (process-spawn + manipy + :init manipy-init + s4-2 + (-> this entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) + #f + 0 + ) + ) + ) (when s2-2 (send-event (ppointer->process s2-2) 'anim-mode 'play1) (send-event (ppointer->process s2-2) 'anim "idle") @@ -509,7 +476,6 @@ ) (defbehavior metalkor-update-ik metalkor-legs () - (local-vars (sv-736 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -612,22 +578,15 @@ ) ) ((method-of-type cam-float-seeker update!) (-> self foot-locks s4-0 lock) 0.0) - (cond - ((-> self foot-locks s4-0 initialized) - (let ((s2-1 vector-lerp!) - (s1-0 s3-0) - (s0-0 s3-0) - ) - (set! sv-736 (the-as vector (+ (the-as uint (-> self foot-locks 0 old-position)) (* s4-0 64)))) - (let ((a3-6 (parameter-ease-sin-clamp (-> self foot-locks s4-0 lock value)))) - (s2-1 s1-0 s0-0 sv-736 a3-6) - ) - ) - ) - (else + (if (-> self foot-locks s4-0 initialized) + (vector-lerp! + s3-0 + s3-0 + (the-as vector (+ (the-as uint (-> self foot-locks 0 old-position)) (* s4-0 64))) + (parameter-ease-sin-clamp (-> self foot-locks s4-0 lock value)) + ) (set! (-> self foot-locks s4-0 initialized) #t) ) - ) (handle-copy! (-> self joint-ik s4-0) s3-0) (set! (-> (the-as (pointer uint128) (+ (the-as uint (-> self foot-locks 0 old-position)) (* s4-0 64)))) (-> s3-0 quad) @@ -1156,11 +1115,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-26 vf1) - (let ((f0-7 v1-26) - (f1-5 409.6) - ) - (< f0-7 (* f1-5 f1-5)) - ) + (< v1-26 (square 409.6)) ) ) (+! s3-0 1) @@ -2091,49 +2046,17 @@ (process-spawn metalkor-rays (-> self root trans) (-> self root quat) :to self) ) :trans (behavior () - (local-vars (sv-384 symbol) (sv-400 symbol) (sv-416 vector) (sv-432 matrix)) (let ((f30-0 (ja-aframe-num 0))) (ja :num! (seek!)) (when (and (< f30-0 40.0) (>= (ja-aframe-num 0) 40.0)) (send-event (ppointer->process (-> self parent)) 'exploding) (activate! *camera-smush-control* 1638.4 37 210 1.0 0.995 (-> self clock)) - (let ((gp-0 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-0 - (let ((t9-6 (method-of-type part-tracker activate))) - (t9-6 - (the-as part-tracker gp-0) - *entity-pool* - (symbol->string (-> part-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s5-0 run-function-in-process) - (s4-0 gp-0) - (s3-0 part-tracker-init) - (s2-0 group-metalkor-explode) - (s1-0 0) - (s0-0 #f) - ) - (set! sv-384 (the-as symbol #f)) - (set! sv-400 (the-as symbol #f)) - (set! sv-432 *launch-matrix*) - (set! sv-416 (-> sv-432 trans)) - (let ((v1-27 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node metalkor-explode-lod0-jg head)) quad))) - (set! (-> sv-416 quad) v1-27) - ) - ((the-as (function object object object object object object object object none) s5-0) - s4-0 - s3-0 - s2-0 - s1-0 - s0-0 - sv-384 - sv-400 - sv-432 - ) - ) - (-> gp-0 ppointer) - ) + (part-tracker-spawn + :to *entity-pool* + :group group-metalkor-explode + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node metalkor-explode-lod0-jg head)) ) ) ) diff --git a/goal_src/jak2/levels/nest/boss/metalkor-setup.gc b/goal_src/jak2/levels/nest/boss/metalkor-setup.gc index 476ac0ba28..59cb003782 100644 --- a/goal_src/jak2/levels/nest/boss/metalkor-setup.gc +++ b/goal_src/jak2/levels/nest/boss/metalkor-setup.gc @@ -837,87 +837,66 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f2, f5] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f1, f3, f6] (defbehavior metalkor-egg-reaction metalkor-egg ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) - (local-vars (v1-11 float) (f1-1 float) (sv-16 vector) (sv-32 float) (sv-48 float) (sv-64 float)) + (local-vars (v1-11 float) (f1-1 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) (vf2 :class vf) ) (init-vf0-vector) - (set! sv-16 arg3) - (cshape-reaction-update-state arg0 arg1 sv-16) - (let ((s5-0 (-> arg0 process))) - (cond - ((time-elapsed? (-> (the-as metalkor-egg s5-0) sticky-time) (seconds 0.05)) - (let ((t9-1 vector--float*!) - (a0-3 arg2) - (a1-1 sv-16) - (a2-2 (-> arg0 surface-normal)) - (f0-0 1.01) - ) - (let* ((v1-4 (-> arg0 surface-normal)) - (f1-0 (-> sv-16 x)) - (f2-0 (-> sv-16 y)) - (f3-0 (-> sv-16 z)) - (f4-0 (-> v1-4 x)) - (f5-0 (-> v1-4 y)) - (f6-0 (-> v1-4 z)) - ) - ;; og:preserve-this inlined vector-dot - ; (.mula.s f1-0 f4-0) - ; (.madda.s f2-0 f5-0) - ; (.madd.s f1-1 f3-0 f6-0) - (set! f1-1 (+ (* f1-0 f4-0) (* f2-0 f5-0) (* f3-0 f6-0))) - ) - (t9-1 a0-3 a1-1 a2-2 (* f0-0 f1-1)) - ) - (let ((s3-0 arg2) - (s2-0 arg2) - (s1-0 lerp-scale) - (s0-0 0.94) - ) - (set! sv-32 (the-as float 1.0)) - (set! sv-48 (-> arg0 surface-normal y)) - (set! sv-64 (cos 5461.3335)) - (let ((t0-0 (cos 16384.0))) - (vector-float*! s3-0 s2-0 (s1-0 s0-0 sv-32 sv-48 sv-64 t0-0)) - ) - ) - ) - (else - (vector--float*! - arg2 - sv-16 - (-> arg0 surface-normal) - (* (vector-dot sv-16 (-> arg0 surface-normal)) (rand-vu-float-range 1.2 1.4)) - ) - ) - ) - (.lvf vf1 (&-> arg2 quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-11 vf1) - (let ((f0-10 v1-11) - (f1-3 409.6) - ) + (let ((sv-16 arg3)) + (cshape-reaction-update-state arg0 arg1 sv-16) + (let ((s5-0 (-> arg0 process))) (cond - ((< f0-10 (* f1-3 f1-3)) - (set! (-> arg2 quad) (the-as uint128 0)) - 0 - ) - ((let ((f1-6 4096.0)) - (and (< (* f1-6 f1-6) f0-10) (time-elapsed? (-> (the-as metalkor-egg s5-0) sticky-time) (seconds 0.2))) + ((time-elapsed? (-> (the-as metalkor-egg s5-0) sticky-time) (seconds 0.05)) + (let ((t9-1 vector--float*!) + (a0-3 arg2) + (a1-1 sv-16) + (a2-2 (-> arg0 surface-normal)) + (f0-0 1.01) + ) + (let* ((v1-4 (-> arg0 surface-normal))) + (set! f1-1 (vector-dot sv-16 v1-4)) + ) + (t9-1 a0-3 a1-1 a2-2 (* f0-0 f1-1)) + ) + (vector-float*! + arg2 + arg2 + (lerp-scale 0.94 (the-as float 1.0) (-> arg0 surface-normal y) (cos 5461.3335) (cos 16384.0)) ) - (vector-float*! arg2 arg2 (/ 4096.0 (sqrtf f0-10))) ) + (else + (vector--float*! + arg2 + sv-16 + (-> arg0 surface-normal) + (* (vector-dot sv-16 (-> arg0 surface-normal)) (rand-vu-float-range 1.2 1.4)) + ) + ) ) + (.lvf vf1 (&-> arg2 quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov v1-11 vf1) + (let ((f0-10 v1-11)) + (cond + ((< f0-10 (square 409.6)) + (set! (-> arg2 quad) (the-as uint128 0)) + 0 + ) + ((and (< (square 4096.0) f0-10) (time-elapsed? (-> (the-as metalkor-egg s5-0) sticky-time) (seconds 0.2))) + (vector-float*! arg2 arg2 (/ 4096.0 (sqrtf f0-10))) + ) + ) + ) + (if (< (-> arg0 surface-normal y) 1.0) + (set! (-> (the-as metalkor-egg s5-0) last-hit-normal quad) (-> arg0 surface-normal quad)) + ) ) - (if (< (-> arg0 surface-normal y) 1.0) - (set! (-> (the-as metalkor-egg s5-0) last-hit-normal quad) (-> arg0 surface-normal quad)) - ) ) (-> arg0 status) ) @@ -1467,7 +1446,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s4-0 reaction) cshape-reaction-default) @@ -1557,8 +1535,9 @@ (set! (-> this live-wasps) 0) (set! (-> this flitter-gem-tracker) (the-as handle #f)) (set! (-> this wasp-gem-tracker) (the-as handle #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-47 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-47 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-47 (> (-> sv-16 elt-count) 0)) (let ((v1-48 (-> v1-47 0))) (when (>= (-> v1-48 length) 1) diff --git a/goal_src/jak2/levels/nest/boss/metalkor-states.gc b/goal_src/jak2/levels/nest/boss/metalkor-states.gc index 98558437a5..67bf739ed0 100644 --- a/goal_src/jak2/levels/nest/boss/metalkor-states.gc +++ b/goal_src/jak2/levels/nest/boss/metalkor-states.gc @@ -203,9 +203,9 @@ ;; WARN: Check prologue - tricky store of r0 (defun metalkor-get-ring ((arg0 metalkor)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> arg0 entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> arg0 entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-1 (< (the-as uint 2) (-> sv-16 elt-count))) (let ((v1-2 (-> v1-1 2))) (if (>= (-> v1-2 length) 1) @@ -256,12 +256,7 @@ ) ) (when (nonzero? (-> self neck)) - (let* ((gp-0 *target*) - (a0-20 (if (type? gp-0 process-focusable) - gp-0 - ) - ) - ) + (let ((a0-20 (the-as target (as-type *target* process-focusable)))) (if a0-20 (target-set! (-> self neck) (get-trans a0-20 2)) ) @@ -503,7 +498,7 @@ ) (attack-info-method-9 arg0 s1-1 arg1 self) (vector-flatten! (-> s1-1 trans) (-> s1-1 trans) (-> s2-1 vector 1)) - (let ((f30-2 (fmax -1.0 (fmin 1.0 (+ f30-1 (vector-dot (-> s1-1 trans) (the-as vector (-> s2-1 vector)))))))) + (let ((f30-2 (fmax -1.0 (fmin 1.0 (+ f30-1 (vector-dot (-> s1-1 trans) (-> s2-1 vector 0))))))) (set! f30-2 (cond ((>= f30-2 0.0) (ja :chan 1 :group! arg3 :num! min) @@ -663,39 +658,28 @@ (if (logtest? (attack-mask damage) (-> (the-as attack-info s5-2) mask)) (set! f28-0 (-> (the-as attack-info s5-2) damage)) ) - (let* ((s4-1 arg0) - (f0-4 (cond - ((if (type? s4-1 gun-blue-shot) - s4-1 - ) - (if (= (-> self stage) 3) - (* 0.0012 f28-0) - (* 0.0024 f28-0) - ) - ) - (else - (let ((s4-2 arg0)) - (cond - ((if (type? s4-2 gun-dark-shot) - s4-2 - ) - (if (= (-> self stage) 3) - (* 0.003 f28-0) - (* 0.006 f28-0) - ) - ) - ((= (-> self stage) 3) - (/ f28-0 250) - ) - (else - (/ f28-0 125) - ) - ) + (let ((f0-4 (cond + ((the-as process (as-type arg0 gun-blue-shot)) + (if (= (-> self stage) 3) + (* 0.0012 f28-0) + (* 0.0024 f28-0) ) - ) ) - ) - ) + ((the-as process (as-type arg0 gun-dark-shot)) + (if (= (-> self stage) 3) + (* 0.003 f28-0) + (* 0.006 f28-0) + ) + ) + ((= (-> self stage) 3) + (/ f28-0 250) + ) + (else + (/ f28-0 125) + ) + ) + ) + ) (if (and (logtest? (attack-mask penetrate-using) (-> (the-as attack-info s5-2) mask)) (logtest? (penetrate dark-bomb) (-> (the-as attack-info s5-2) penetrate-using)) ) @@ -794,19 +778,14 @@ (-> self root) (the-as uint 1) ) - (let* ((s4-3 arg0) - (gp-5 (if (type? s4-3 process-focusable) - s4-3 - ) - ) - ) + (let ((gp-5 (the-as process (as-type arg0 process-focusable)))) (when gp-5 (let ((s3-0 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> self root quat))) (s4-4 (new 'stack-no-clear 'vector)) ) (if (>= (metalkor-ja-float-group? (the-as art-joint-anim metalkor-attack-sweep-left-ja)) 0) - (vector+! s4-4 (-> s3-0 vector 2) (the-as vector (-> s3-0 vector))) - (vector-! s4-4 (-> s3-0 vector 2) (the-as vector (-> s3-0 vector))) + (vector+! s4-4 (-> s3-0 vector 2) (-> s3-0 vector 0)) + (vector-! s4-4 (-> s3-0 vector 2) (-> s3-0 vector 0)) ) (set! (-> s4-4 y) 0.0) (vector-normalize! s4-4 32768.0) @@ -938,7 +917,7 @@ (matrix*! gp-0 s5-0 s4-0) (matrix-remove-z-rot gp-0 (new 'static 'vector :y -1.0)) (set! (-> self last-rotation) (acos (vector-dot (-> s5-0 vector 2) (-> gp-0 vector 2)))) - (if (< (vector-dot (-> gp-0 vector 2) (the-as vector (-> s5-0 vector))) 0.0) + (if (< (vector-dot (-> gp-0 vector 2) (-> s5-0 vector 0)) 0.0) (set! (-> self last-rotation) (- (-> self last-rotation))) ) (cond @@ -1198,7 +1177,7 @@ ) (let ((f28-0 (ja-aframe-num 0))) (set! (-> self target-angle) f26-0) - (if (< 0.0 (vector-dot s4-0 (the-as vector (-> gp-0 vector)))) + (if (< 0.0 (vector-dot s4-0 (-> gp-0 vector 0))) (set! f26-0 (- f26-0)) ) (let ((v1-12 (ja-group))) @@ -1515,10 +1494,7 @@ (matrix->quaternion (-> self root quat) gp-0) (quaternion-normalize! (-> self root quat)) (let ((f0-1 (vector-dot (-> gp-0 vector 1) (new 'static 'vector :y 1.0)))) - (let* ((f1-0 1.0) - (f2-0 f0-1) - (f1-2 (sqrtf (- f1-0 (* f2-0 f2-0)))) - ) + (let ((f1-2 (sqrtf (- 1.0 (square f0-1))))) (vector+float*! (-> self root trans) (-> self hit-ring-trans) (-> self hit-ring-offset) (* 73728.0 f1-2)) ) (+! (-> self root trans y) (* 73728.0 (- 1.0 f0-1))) @@ -1662,16 +1638,12 @@ (* 3072.0 (-> self flying-speed value)) 0.5 ) - (let ((f0-4 (vector-vector-distance-squared (-> self root trans) (-> self hit-ring-trans))) - (f1-1 4096.0) - ) + (let ((f0-4 (vector-vector-distance-squared (-> self root trans) (-> self hit-ring-trans)))) (cond - ((< f0-4 (* f1-1 f1-1)) + ((< f0-4 (square 4096.0)) (go-virtual explode) ) - ((let ((f1-4 40960.0)) - (< f0-4 (* f1-4 f1-4)) - ) + ((< f0-4 (square 40960.0)) (set! (-> self ring-cam-pos target) 1.0) ) ) @@ -1682,13 +1654,9 @@ (set! (-> gp-1 quad) (-> self entity trans quad)) (+! (-> gp-1 y) -61440.0) (vector-seek-3d-smooth! (-> self root trans) gp-1 (* 3072.0 (-> self flying-speed value)) 0.5) - (let ((f0-10 (vector-vector-distance-squared (-> self root trans) gp-1)) - (f1-9 12288.0) - ) - (when (< f0-10 (* f1-9 f1-9)) - (set! (-> self been-to-entity) #t) - (set-setting! 'entity-name "camera-271" 0.0 0) - ) + (when (< (vector-vector-distance-squared (-> self root trans) gp-1) (square 12288.0)) + (set! (-> self been-to-entity) #t) + (set-setting! 'entity-name "camera-271" 0.0 0) ) ) ) @@ -1937,7 +1905,7 @@ ;; WARN: Return type mismatch object vs none. ;; WARN: Function metalkor-walk-the-walk has a return type of none, but the expression builder found a return statement. (defbehavior metalkor-walk-the-walk metalkor ((arg0 float) (arg1 symbol)) - (local-vars (v1-32 float) (v1-38 float) (v1-80 float) (sv-864 vector)) + (local-vars (v1-32 float) (v1-38 float) (v1-80 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -1954,120 +1922,113 @@ ) (let ((s5-0 (new 'stack-no-clear 'vector))) (set! (-> s5-0 quad) (-> self root trans quad)) - (set! sv-864 (target-pos 0)) - (metalkor-face-to-vector sv-864 546.13336 0.005) - (when (and (nonzero? (-> self previous-flat-travel-long-timer)) - (>= (+ (current-time) (seconds -1.2)) (-> self previous-flat-travel-long-timer)) - ) - (set! (-> self previous-flat-travel-long-timer) 0) - (set! (-> self previous-flat-travel-timer) 0) - 0 - ) - (let ((s2-0 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (let ((f30-0 (* 4096.0 (/ (-> self clock time-adjust-ratio) 4))) - (s1-0 #f) - ) - (set! (-> s3-0 quad) (-> self root trans quad)) - (vector-! s4-0 s3-0 sv-864) - (set! (-> s4-0 y) 0.0) - (let* ((f0-5 arg0) - (f0-7 (* f0-5 f0-5)) + (let ((sv-864 (target-pos 0))) + (metalkor-face-to-vector sv-864 546.13336 0.005) + (when (and (nonzero? (-> self previous-flat-travel-long-timer)) + (>= (+ (current-time) (seconds -1.2)) (-> self previous-flat-travel-long-timer)) ) + (set! (-> self previous-flat-travel-long-timer) 0) + (set! (-> self previous-flat-travel-timer) 0) + 0 + ) + (let ((s2-0 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (let ((f30-0 (* 4096.0 (/ (-> self clock time-adjust-ratio) 4))) + (s1-0 #f) + ) + (set! (-> s3-0 quad) (-> self root trans quad)) + (vector-! s4-0 s3-0 sv-864) + (set! (-> s4-0 y) 0.0) + (let ((f0-7 (square arg0))) + (.lvf vf1 (&-> s4-0 quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov v1-32 vf1) + (if (< f0-7 v1-32) + (set! s1-0 #t) + ) + ) + (vector-normalize! s4-0 arg0) + (let ((v1-35 s4-0)) + (let ((a0-15 s4-0)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-15 quad)) + ) + (.lvf vf5 (&-> sv-864 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-35 quad) vf6) + ) + (vector-! s4-0 s4-0 s3-0) + (set! (-> s4-0 y) 0.0) (.lvf vf1 (&-> s4-0 quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) (.mul.x.vf.x acc vf2 vf1) (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-32 vf1) - (if (< f0-7 v1-32) - (set! s1-0 #t) - ) - ) - (vector-normalize! s4-0 arg0) - (let ((v1-35 s4-0)) - (let ((a0-15 s4-0)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-15 quad)) + (.mov v1-38 vf1) + (let ((f0-9 v1-38)) + (if (< (square f30-0) f0-9) + (vector-float*! s4-0 s4-0 (/ f30-0 (sqrtf f0-9))) + ) ) - (.lvf vf5 (&-> sv-864 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-35 quad) vf6) - ) - (vector-! s4-0 s4-0 s3-0) - (set! (-> s4-0 y) 0.0) - (.lvf vf1 (&-> s4-0 quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-38 vf1) - (let ((f0-9 v1-38) - (f1-3 f30-0) - ) - (if (< (* f1-3 f1-3) f0-9) - (vector-float*! s4-0 s4-0 (/ f30-0 (sqrtf f0-9))) - ) - ) - (set! (-> s2-0 poly) (-> self current-nav-poly)) - (dotimes (s0-1 5) - (let ((f30-1 (vector-length s4-0))) - (clamp-vector-to-mesh-no-gaps (-> self nav state mesh) s3-0 (-> s2-0 poly) s4-0 s2-0) - (cond - ((-> s2-0 found-boundary) - (set-normals-from-adjacent-bounds (-> self nav state mesh) s2-0) - (let ((f28-0 (vector-length s4-0))) - (vector-flatten! s4-0 s4-0 (-> s2-0 boundary-normal)) - (let ((f0-12 (- f30-1 f28-0))) - (vector-normalize! s4-0 f0-12) - ) - ) - (if (and (< (+ (current-time) (seconds -0.1)) (-> self previous-flat-travel-timer)) - (< (vector-dot s4-0 (-> self previous-flat-travel)) 0.0) - ) - (vector-negate! s4-0 s4-0) - ) - (set! (-> s3-0 x) (-> s2-0 intersection x)) - (set! (-> s3-0 z) (-> s2-0 intersection z)) - (vector-! s3-0 s3-0 (-> s2-0 boundary-normal)) - (when (or s1-0 (> s0-1 0) (< (+ (current-time) (seconds -0.1)) (-> self previous-flat-travel-timer))) - (set! (-> self previous-flat-travel quad) (-> s4-0 quad)) - (set-time! (-> self previous-flat-travel-timer)) - (if (zero? (-> self previous-flat-travel-long-timer)) - (set-time! (-> self previous-flat-travel-long-timer)) + (set! (-> s2-0 poly) (-> self current-nav-poly)) + (dotimes (s0-1 5) + (let ((f30-1 (vector-length s4-0))) + (clamp-vector-to-mesh-no-gaps (-> self nav state mesh) s3-0 (-> s2-0 poly) s4-0 s2-0) + (cond + ((-> s2-0 found-boundary) + (set-normals-from-adjacent-bounds (-> self nav state mesh) s2-0) + (let ((f28-0 (vector-length s4-0))) + (vector-flatten! s4-0 s4-0 (-> s2-0 boundary-normal)) + (let ((f0-12 (- f30-1 f28-0))) + (vector-normalize! s4-0 f0-12) ) + ) + (if (and (< (+ (current-time) (seconds -0.1)) (-> self previous-flat-travel-timer)) + (< (vector-dot s4-0 (-> self previous-flat-travel)) 0.0) + ) + (vector-negate! s4-0 s4-0) + ) + (set! (-> s3-0 x) (-> s2-0 intersection x)) + (set! (-> s3-0 z) (-> s2-0 intersection z)) + (vector-! s3-0 s3-0 (-> s2-0 boundary-normal)) + (when (or s1-0 (> s0-1 0) (< (+ (current-time) (seconds -0.1)) (-> self previous-flat-travel-timer))) + (set! (-> self previous-flat-travel quad) (-> s4-0 quad)) + (set-time! (-> self previous-flat-travel-timer)) + (if (zero? (-> self previous-flat-travel-long-timer)) + (set-time! (-> self previous-flat-travel-long-timer)) + ) + ) ) - ) - (else - (goto cfg-43) + (else + (goto cfg-43) + ) ) ) ) ) + (label cfg-43) + (vector+! s4-0 s3-0 s4-0) ) - (label cfg-43) - (vector+! s4-0 s3-0 s4-0) - ) - (vector-! s4-0 s4-0 (-> self root trans)) - (.lvf vf1 (&-> s4-0 quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-80 vf1) - (let ((f0-17 v1-80) - (f1-7 40.96) - ) - (if (< f0-17 (* f1-7 f1-7)) + (vector-! s4-0 s4-0 (-> self root trans)) + (.lvf vf1 (&-> s4-0 quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov v1-80 vf1) + (if (< v1-80 (square 40.96)) (vector-reset! s4-0) ) + (vector+! (-> self root trans) (-> self root trans) s4-0) ) - (vector+! (-> self root trans) (-> self root trans) s4-0) ) (set! (-> self current-nav-poly) (cloest-point-on-mesh (-> self nav) (-> self root trans) (-> self root trans) (-> self current-nav-poly)) @@ -2141,7 +2102,7 @@ ) (vector-flatten! gp-1 gp-1 (-> s5-0 vector 1)) (cond - ((< (vector-dot gp-1 (the-as vector (-> s5-0 vector))) 0.0) + ((< (vector-dot gp-1 (-> s5-0 vector 0)) 0.0) (metalkor-ja-float (the-as art-joint-anim metalkor-attack-sweep-right-ja) 1.0 1.0 4.0) (metalkor-set-deadly self #t 2) ) @@ -2222,9 +2183,7 @@ ((time-elapsed? (-> self state-time) (seconds 4)) (go-virtual chase-target) ) - ((let ((f0-0 57344.0)) - (< (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> self root trans) (target-pos 0))) - ) + ((< (square 57344.0) (vector-vector-xz-distance-squared (-> self root trans) (target-pos 0))) ) ((or (< (-> self last-close-attack) -1) (and (< (-> self last-close-attack) 2) @@ -2439,7 +2398,6 @@ (metalkor-ja-float-stop (the-as art-joint-anim metalkor-hang-pre-shot-ja)) ) :trans (behavior () - (local-vars (sv-16 res-tag)) (let ((v1-0 7500)) (if (and (-> self in-wave) (= (-> self stage) 1)) (set! v1-0 3000) @@ -2461,8 +2419,9 @@ (set-time! (-> self wasp-timer)) (dotimes (gp-0 3) (when (not (handle->process (-> self wasps gp-0))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-31 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-31 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-31 (< (the-as uint 1) (-> sv-16 elt-count))) (let ((v1-32 (-> v1-31 1))) (+! (-> self last-wasp-launched) 1) @@ -2719,10 +2678,8 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-72 vf1) - (let ((f0-14 v1-72) - (f1-2 1024.0) - ) - (if (< (* f1-2 f1-2) f0-14) + (let ((f0-14 v1-72)) + (if (< (square 1024.0) f0-14) (vector-float*! s5-1 s5-1 (/ 1024.0 (sqrtf f0-14))) ) ) diff --git a/goal_src/jak2/levels/nest/boss/nestb-scenes.gc b/goal_src/jak2/levels/nest/boss/nestb-scenes.gc index f164c091e0..354764242f 100644 --- a/goal_src/jak2/levels/nest/boss/nestb-scenes.gc +++ b/goal_src/jak2/levels/nest/boss/nestb-scenes.gc @@ -431,11 +431,6 @@ ) (defun movie-nest-metalkor-shot-draw-impact ((arg0 scene-player) (arg1 vector) (arg2 vector)) - (local-vars - (sv-240 (function vector entity-actor skeleton-group vector object none :behavior manipy)) - (sv-256 vector) - (sv-272 entity-actor) - ) (let ((v0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) arg2 arg1) 2048.0)) (gp-0 (new 'stack-no-clear 'vector)) ) @@ -499,36 +494,18 @@ (matrix->quaternion gp-1 s2-0) ) (sound-play "nboss-shoot-hit") - (let* ((s1-2 (get-process *default-dead-pool* manipy #x4000)) - (s2-2 (when s1-2 - (let ((t9-10 (method-of-type manipy activate))) - (t9-10 (the-as manipy s1-2) arg0 (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s2-3 run-function-in-process) - (s0-1 s1-2) - ) - (set! sv-240 manipy-init) - (set! sv-256 s4-1) - (set! sv-272 (-> arg0 entity)) - (let ((t0-2 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f))) - (t1-2 #f) - (t2-2 0) - ) - ((the-as (function object object object object object object object none) s2-3) - s0-1 - sv-240 - sv-256 - sv-272 - t0-2 - t1-2 - t2-2 - ) - ) - ) - (-> s1-2 ppointer) - ) - ) - ) + (let ((s2-2 (process-spawn + manipy + :init manipy-init + s4-1 + (-> arg0 entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to arg0 + ) + ) + ) (when s2-2 (send-event (ppointer->process s2-2) 'anim-mode 'play1) (send-event (ppointer->process s2-2) 'anim "idle") diff --git a/goal_src/jak2/levels/nest/flying-spider.gc b/goal_src/jak2/levels/nest/flying-spider.gc index e590ee2fe6..c2d8e3de49 100644 --- a/goal_src/jak2/levels/nest/flying-spider.gc +++ b/goal_src/jak2/levels/nest/flying-spider.gc @@ -530,7 +530,7 @@ (defmethod general-event-handler ((this flying-spider) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy -@TODO - unsure if there is a pattern for the events and this should have a more specific name" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) @@ -557,11 +557,7 @@ ) ) (zero? (rnd-int-count this 3)) - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-0 32768.0) - ) - (>= f0-0 (* f1-0 f1-0)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (kill-prefer-falling this) ) @@ -597,9 +593,9 @@ (defmethod common-post ((this flying-spider)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" ((method-of-type nav-enemy common-post) this) (none) ) @@ -629,8 +625,8 @@ (vector-reset! s5-1) (dotimes (s4-1 (-> *collide-cache* num-tris)) (let* ((v1-16 (-> *collide-cache* tris s4-1)) - (s2-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-16 vertex 1) (the-as vector (-> v1-16 vertex)))) - (s1-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-16 vertex 2) (the-as vector (-> v1-16 vertex)))) + (s2-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-16 vertex 1) (-> v1-16 vertex 0))) + (s1-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-16 vertex 2) (-> v1-16 vertex 0))) (s3-0 (new 'stack-no-clear 'vector)) ) (vector-normalize! s2-1 1.0) @@ -694,7 +690,7 @@ (defmethod look-at-target! ((this flying-spider) (arg0 enemy-flag)) "Logic for looking at the target that is locked on, sets some flags and adjusts the neck to look at the target if available -@param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" + @param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" 0 (none) ) @@ -702,7 +698,7 @@ ;; WARN: Return type mismatch int vs penetrate. (defmethod get-penetrate-info ((this flying-spider)) "@returns the allowed way(s) this enemy can take damage -@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" + @see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" (the-as penetrate 0) ) diff --git a/goal_src/jak2/levels/nest/mammoth.gc b/goal_src/jak2/levels/nest/mammoth.gc index ab1c0a00b6..be444c2764 100644 --- a/goal_src/jak2/levels/nest/mammoth.gc +++ b/goal_src/jak2/levels/nest/mammoth.gc @@ -229,8 +229,8 @@ ;; WARN: Return type mismatch object vs none. (defbehavior mammoth-walk-check-end mammoth () - (let ((a1-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-pos 1) (the-as vector (-> self move-pos)))) - (gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) (the-as vector (-> self move-pos)))) + (let ((a1-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-pos 1) (-> self move-pos 0))) + (gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) (-> self move-pos 0))) ) (if (< (vector-length a1-1) (vector-dot gp-1 (vector-normalize-copy! (new 'stack-no-clear 'vector) a1-1 1.0))) (go-virtual turning) @@ -267,17 +267,12 @@ ) (defbehavior set-nav-destination mammoth () - (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-pos 1) (the-as vector (-> self move-pos)))) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-pos 1) (-> self move-pos 0))) (s4-0 (new 'stack-no-clear 'vector)) (gp-0 (new 'stack-no-clear 'vector)) ) (vector-normalize! s5-1 65536.0) - (vector-line-distance-point! - (-> self root trans) - (the-as vector (-> self move-pos)) - (-> self move-pos 1) - s4-0 - ) + (vector-line-distance-point! (-> self root trans) (-> self move-pos 0) (-> self move-pos 1) s4-0) (vector+! gp-0 s4-0 s5-1) (cloest-point-on-mesh (-> self nav) gp-0 gp-0 (the-as nav-poly #f)) (set! (-> self travel-dest quad) (-> gp-0 quad)) @@ -683,7 +678,7 @@ (defmethod general-event-handler ((this mammoth) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy -@TODO - unsure if there is a pattern for the events and this should have a more specific name" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit) (logclear! (-> this mask) (process-mask actor-pause)) @@ -816,8 +811,8 @@ (vector-reset! s4-1) (dotimes (s3-1 (-> *collide-cache* num-tris)) (let* ((v1-15 (-> *collide-cache* tris s3-1)) - (s1-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-15 vertex 1) (the-as vector (-> v1-15 vertex)))) - (s0-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-15 vertex 2) (the-as vector (-> v1-15 vertex)))) + (s1-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-15 vertex 1) (-> v1-15 vertex 0))) + (s0-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-15 vertex 2) (-> v1-15 vertex 0))) (s2-2 (new 'stack-no-clear 'vector)) ) (vector-normalize! s1-1 1.0) @@ -871,7 +866,7 @@ ) ) (if (and (logtest? (-> this foot-flags) 1) (logtest? (-> this foot-flags) 2)) - (s0-0 s5-0 s1-0 (the-as vector (-> this foot-pos)) (-> this foot-pos 1)) + (s0-0 s5-0 s1-0 (-> this foot-pos 0) (-> this foot-pos 1)) ) (if (and (logtest? (-> this foot-flags) 2) (logtest? (-> this foot-flags) 4)) (s0-0 s4-0 s1-0 (-> this foot-pos 1) (-> this foot-pos 2)) @@ -880,7 +875,7 @@ (s0-0 s4-0 s1-0 (-> this foot-pos 2) (-> this foot-pos 3)) ) (if (and (logtest? (-> this foot-flags) 8) (logtest? (-> this foot-flags) 1)) - (s0-0 s4-0 s1-0 (-> this foot-pos 3) (the-as vector (-> this foot-pos))) + (s0-0 s4-0 s1-0 (-> this foot-pos 3) (-> this foot-pos 0)) ) ) (vector+! s5-0 s5-0 s4-0) @@ -1072,7 +1067,6 @@ ) (defbehavior mammoth-update-ik mammoth () - (local-vars (sv-688 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1091,11 +1085,9 @@ (-> s3-0 shoulder-matrix-no-ik) (let ((v1-5 (-> s3-0 elbow-matrix-no-ik)) (s0-0 (new 'stack-no-clear 'vector)) + (sv-688 (new 'stack-no-clear 'vector)) ) - (set! sv-688 (new 'stack-no-clear 'vector)) - (let ((a0-2 (-> *y-vector* quad))) - (set! (-> sv-688 quad) a0-2) - ) + (set! (-> sv-688 quad) (-> *y-vector* quad)) (let ((s2-0 (new 'stack-no-clear 'vector))) (new 'stack-no-clear 'vector) (new 'stack-no-clear 'vector) @@ -1123,7 +1115,7 @@ (set! (-> a0-6 y) 14336.0) (set! (-> a0-6 z) 10240.0) (set! (-> a0-6 w) 1.0) - (vector-! (the-as vector a1-2) v1-7 a0-6) + (vector-! (-> a1-2 min) v1-7 a0-6) ) (let ((a1-4 (-> gp-0 bbox max)) (v1-8 s0-0) @@ -1157,11 +1149,7 @@ (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) (.svf (&-> a1-9 quad) vf6) ) - (let ((v1-15 (-> gp-0 move-dist)) - (f0-16 -40960.0) - ) - (vector-float*! v1-15 sv-688 f0-16) - ) + (vector-float*! (-> gp-0 move-dist) sv-688 -40960.0) (let ((v1-17 gp-0)) (set! (-> v1-17 radius) 4.096) (set! (-> v1-17 collide-with) (-> gp-0 collide-with)) @@ -1257,7 +1245,7 @@ (set! (-> a0-4 y) 16384.0) (set! (-> a0-4 z) 16384.0) (set! (-> a0-4 w) 1.0) - (vector-! (the-as vector a1-5) v1-13 a0-4) + (vector-! (-> a1-5 min) v1-13 a0-4) ) (let ((a1-7 (-> s2-0 bbox max)) (v1-14 s4-0) @@ -1333,10 +1321,9 @@ (defmethod common-post ((this mammoth)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" - (local-vars (sv-752 lightning-spec) (sv-768 int) (sv-784 symbol) (sv-800 mammoth)) + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) @@ -1430,41 +1417,16 @@ ) ) (label cfg-60) - (let ((s2-2 (get-process *default-dead-pool* lightning-tracker #x4000))) - (when s2-2 - (let ((t9-11 (method-of-type lightning-tracker activate))) - (t9-11 - (the-as lightning-tracker s2-2) - s5-2 - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s5-3 run-function-in-process) - (s1-1 s2-2) - (s0-3 lightning-tracker-init) - ) - (set! sv-752 (-> *lightning-spec-id-table* 1)) - (set! sv-768 600) - (set! sv-784 (the-as symbol #f)) - (set! sv-800 this) - (let ((t2-0 (-> (the-as (pointer int32) (&+ s4-2 (* (rnd-int-count this s3-2) 4))))) - (t3-0 6) - ) - ((the-as (function object object object object object object object object none) s5-3) - s1-1 - s0-3 - sv-752 - sv-768 - sv-784 - sv-800 - t2-0 - t3-0 - ) - ) - ) - (-> s2-2 ppointer) - ) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 1) + 600 + (the-as symbol #f) + this + (-> (the-as (pointer int32) (&+ s4-2 (* (rnd-int-count this s3-2) 4)))) + 6 + :to s5-2 ) ) (set! (-> this lightning-attack-timer) @@ -1485,13 +1447,13 @@ #f ) -(defmethod relocate ((this mammoth) (arg0 int)) +(defmethod relocate ((this mammoth) (offset int)) (dotimes (v1-0 4) (if (nonzero? (-> this joint-ik v1-0)) - (&+! (-> this joint-ik v1-0) arg0) + (&+! (-> this joint-ik v1-0) offset) ) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defmethod init-enemy-collision! ((this mammoth)) diff --git a/goal_src/jak2/levels/nest/mantis.gc b/goal_src/jak2/levels/nest/mantis.gc index 319d093ad9..b43462c232 100644 --- a/goal_src/jak2/levels/nest/mantis.gc +++ b/goal_src/jak2/levels/nest/mantis.gc @@ -1180,11 +1180,7 @@ ) ) (zero? (rnd-int-count this 3)) - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-0 32768.0) - ) - (>= f0-0 (* f1-0 f1-0)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (kill-prefer-falling this) ) diff --git a/goal_src/jak2/levels/palace/boss/squid-extras.gc b/goal_src/jak2/levels/palace/boss/squid-extras.gc index 66ebb67987..110bbadd1c 100644 --- a/goal_src/jak2/levels/palace/boss/squid-extras.gc +++ b/goal_src/jak2/levels/palace/boss/squid-extras.gc @@ -153,7 +153,7 @@ s5-0 (* (lerp-scale 1.0 0.0 f28-0 (* 1.5 f30-0) 1.0) (lerp-scale 0.0 20480.0 f28-0 0.0 0.06)) ) - (let ((f28-1 (* f28-0 f28-0))) + (let ((f28-1 (square f28-0))) (let ((s4-1 (new 'stack-no-clear 'vector))) (compute-trans-at-time (-> arg0 traj) f28-1 s4-1) (vector+! s5-0 s5-0 s4-1) @@ -389,11 +389,7 @@ (spawn (-> self part) a1-2) ) (when (or (time-elapsed? (-> self state-time) (-> self duration)) - (let ((f0-3 (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans))) - (f1-1 12288.0) - ) - (< f0-3 (* f1-1 f1-1)) - ) + (< (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans)) (square 12288.0)) ) (let ((gp-1 (new 'stack-no-clear 'explosion-init-params))) (set! (-> gp-1 spawn-point quad) (-> self root trans quad)) diff --git a/goal_src/jak2/levels/palace/boss/squid-setup.gc b/goal_src/jak2/levels/palace/boss/squid-setup.gc index 26ffa2b94d..8ab5b552a2 100644 --- a/goal_src/jak2/levels/palace/boss/squid-setup.gc +++ b/goal_src/jak2/levels/palace/boss/squid-setup.gc @@ -615,40 +615,7 @@ ) (defmethod squid-tentacle-method-23 ((this squid-tentacle)) - (local-vars - (v1-134 float) - (v1-162 float) - (f0-51 float) - (sv-1456 squid-tentacle-chain) - (sv-1472 vector) - (sv-1488 vector) - (sv-1504 vector) - (sv-1520 vector) - (sv-1536 (function vector float vector)) - (sv-1552 vector) - (sv-1568 vector) - (sv-1584 vector) - (sv-1600 vector) - (sv-1616 vector) - (sv-1632 vector) - (sv-1648 (function vector float vector)) - (sv-1664 vector) - (sv-1680 vector) - (sv-1696 vector) - (sv-1712 vector) - (sv-1728 vector) - (sv-1744 collide-query) - (sv-1760 int) - (sv-1776 vector) - (sv-1792 vector) - (sv-1808 vector) - (sv-1824 (inline-array vector)) - (sv-1840 (inline-array vector)) - (sv-1856 (inline-array vector)) - (sv-1872 vector) - (sv-1888 (inline-array vector)) - (sv-1904 vector) - ) + (local-vars (v1-134 float) (v1-162 float) (f0-51 float)) (with-pp (rlet ((acc :class vf) (vf0 :class vf) @@ -690,368 +657,370 @@ (set! (-> this num-bg-collisions) 0) (set! (-> this max-movement) 0.0) (dotimes (s0-0 11) - (set! sv-1456 (-> this chain-joints s0-0)) - (set! sv-1904 (new 'stack-no-clear 'vector)) - (let ((v1-19 (-> sv-1456 position quad))) - (set! (-> sv-1904 quad) v1-19) - ) - (cond - ((-> this wrap) - (+! (-> sv-1904 y) -409.6) - (set! sv-1472 (new 'stack-no-clear 'vector)) - (let ((v1-25 sv-1904) - (a0-10 (-> this center)) + (let ((sv-1456 (-> this chain-joints s0-0)) + (sv-1904 (new 'stack-no-clear 'vector)) + ) + (set! (-> sv-1904 quad) (-> sv-1456 position quad)) + (cond + ((-> this wrap) + (+! (-> sv-1904 y) -409.6) + (let ((sv-1472 (new 'stack-no-clear 'vector))) + (let ((v1-25 sv-1904) + (a0-10 (-> this center)) + ) + (.lvf vf4 (&-> v1-25 quad)) + (.lvf vf5 (&-> a0-10 quad)) ) - (.lvf vf4 (&-> v1-25 quad)) - (.lvf vf5 (&-> a0-10 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-1472 quad) vf6) + (set! (-> sv-1472 y) 0.0) + (vector-normalize! sv-1472 409.6) + (+! (-> sv-1904 x) (-> sv-1472 z)) + (set! (-> sv-1904 z) (- (-> sv-1904 z) (-> sv-1472 x))) + ) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-1472 quad) vf6) - (set! (-> sv-1472 y) 0.0) - (vector-normalize! sv-1472 409.6) - (+! (-> sv-1904 x) (-> sv-1472 z)) - (set! (-> sv-1904 z) (- (-> sv-1904 z) (-> sv-1472 x))) - ) - (else - (set! sv-1520 sv-1904) - (set! sv-1488 sv-1904) - (set! sv-1504 (-> this gravity)) - (let ((f0-14 (* 4096.0 (-> pp clock time-adjust-ratio) (fmax 0.2 (lerp-scale 0.38 0.18 (the float s0-0) 0.0 5.0)))) + (else + (let ((sv-1520 sv-1904)) + (let ((sv-1488 sv-1904) + (sv-1504 (-> this gravity)) + (f0-14 (* 4096.0 (-> pp clock time-adjust-ratio) (fmax 0.2 (lerp-scale 0.38 0.18 (the float s0-0) 0.0 5.0)))) + ) + (.lvf vf2 (&-> sv-1504 quad)) + (.lvf vf1 (&-> sv-1488 quad)) + (let ((v1-43 f0-14)) + (.mov vf3 v1-43) + ) ) - (.lvf vf2 (&-> sv-1504 quad)) - (.lvf vf1 (&-> sv-1488 quad)) - (let ((v1-43 f0-14)) - (.mov vf3 v1-43) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-1520 quad) vf4) ) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-1520 quad) vf4) - (when (-> this avoid-center) - (vector-! s1-0 (-> sv-1456 position) (-> this center)) - (set! sv-1536 vector-normalize!) - (set! sv-1552 s1-0) - (let ((a1-13 (* 4096.0 (-> pp clock time-adjust-ratio) (fmax 0.0 (lerp-scale 0.4 0.6 (the float s0-0) 0.0 8.0))))) - (sv-1536 sv-1552 a1-13) - ) - (vector+! sv-1904 sv-1904 s1-0) - ) - ) - ) - (when (< s0-0 10) - (set! sv-1600 sv-1904) - (set! sv-1568 sv-1904) - (set! sv-1584 (the-as vector (+ (the-as uint (-> this chain-joints 0 velocity)) (* (+ s0-0 1) 64)))) - (let ((f0-24 (fmin 0.9 (lerp-scale 0.2 1.0 (the float s0-0) 0.0 4.0)))) - (.lvf vf2 (&-> sv-1584 quad)) - (.lvf vf1 (&-> sv-1568 quad)) - (let ((v1-60 f0-24)) - (.mov vf3 v1-60) - ) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-1600 quad) vf4) - ) - (vector-! s1-0 sv-1904 s4-1) - (if (= s0-0 10) - (vector-normalize! s1-0 7102.464) - (vector-normalize! s1-0 4096.0) - ) - (vector+! sv-1904 s1-0 s4-1) - (let ((v0-15 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 3)))) - (set! sv-1616 (new 'stack-no-clear 'vector)) - (+! (-> v0-15 y) 31744.0) - (vector-! sv-1616 sv-1904 v0-15) - ) - (let ((f0-27 (vector-normalize-ret-len! sv-1616 1.0))) - (when (< f0-27 32768.0) - (vector+float*! sv-1904 sv-1904 sv-1616 (- 32768.0 f0-27)) - (vector-normalize-copy! - sv-1616 - (-> this node-list data 3 bone transform vector 2) - (* 2048.0 (-> pp clock time-adjust-ratio)) - ) - (let ((v1-77 sv-1904)) - (let ((a0-31 sv-1904)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-31 quad)) - ) - (.lvf vf5 (&-> sv-1616 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-77 quad) vf6) - ) - ) - ) - (set! sv-1632 (new 'stack-no-clear 'vector)) - (let ((v1-79 sv-1904) - (a0-33 (-> this center)) - ) - (.lvf vf4 (&-> v1-79 quad)) - (.lvf vf5 (&-> a0-33 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-1632 quad) vf6) - (set! (-> sv-1632 y) 0.0) - (let ((f0-32 (vector-normalize-ret-len! sv-1632 1.0))) - (when (< f0-32 4096.0) - (let ((v1-84 sv-1904) - (a0-35 sv-1904) - (f0-33 (- 4096.0 f0-32)) + (when (-> this avoid-center) + (vector-! s1-0 (-> sv-1456 position) (-> this center)) + (vector-normalize! + s1-0 + (* 4096.0 (-> pp clock time-adjust-ratio) (fmax 0.0 (lerp-scale 0.4 0.6 (the float s0-0) 0.0 8.0))) ) - (vector+float*! v1-84 a0-35 sv-1632 f0-33) - ) - ) - ) - (set! sv-1728 (new 'stack-no-clear 'vector)) - (let ((v1-87 sv-1904) - (a0-36 s4-1) - ) - (.lvf vf4 (&-> v1-87 quad)) - (.lvf vf5 (&-> a0-36 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-1728 quad) vf6) - (let ((f30-3 (vector-normalize-ret-len! sv-1728 1.0)) - (f28-2 (vector-dot sv-1728 s2-0)) - (f26-0 (lerp-scale 5461.3335 10922.667 (the float s0-0) 0.0 8.0)) - ) - (when (< f28-2 (cos f26-0)) - (vector--float*! sv-1728 sv-1728 s2-0 f28-2) - (set! sv-1648 vector-normalize!) - (set! sv-1664 sv-1728) - (let ((a1-34 (sin f26-0))) - (sv-1648 sv-1664 a1-34) - ) - (set! sv-1712 sv-1728) - (set! sv-1680 sv-1728) - (set! sv-1696 s2-0) - (let ((f0-38 (cos f26-0))) - (.lvf vf2 (&-> sv-1696 quad)) - (.lvf vf1 (&-> sv-1680 quad)) - (let ((v1-98 f0-38)) - (.mov vf3 v1-98) + (vector+! sv-1904 sv-1904 s1-0) ) ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-1712 quad) vf4) - (vector+float*! sv-1904 s4-1 sv-1728 f30-3) ) - ) - (set! sv-1744 (new 'stack-no-clear 'collide-query)) - (set! sv-1776 (new 'stack-no-clear 'vector)) - (let ((v1-104 sv-1904) - (a0-47 (-> sv-1456 position)) + (when (< s0-0 10) + (let ((sv-1600 sv-1904)) + (let ((sv-1568 sv-1904) + (sv-1584 (the-as vector (+ (the-as uint (-> this chain-joints 0 velocity)) (* (+ s0-0 1) 64)))) + (f0-24 (fmin 0.9 (lerp-scale 0.2 1.0 (the float s0-0) 0.0 4.0))) + ) + (.lvf vf2 (&-> sv-1584 quad)) + (.lvf vf1 (&-> sv-1568 quad)) + (let ((v1-60 f0-24)) + (.mov vf3 v1-60) + ) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-1600 quad) vf4) ) - (.lvf vf4 (&-> v1-104 quad)) - (.lvf vf5 (&-> a0-47 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-1776 quad) vf6) - (set! sv-1760 0) - (set! (-> sv-1904 quad) (-> sv-1456 position quad)) - (until (or (< 6 sv-1760) - (begin - (.lvf vf1 (&-> sv-1776 quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-134 vf1) - (let ((f0-46 v1-134) - (f1-16 409.6) + ) + (vector-! s1-0 sv-1904 s4-1) + (if (= s0-0 10) + (vector-normalize! s1-0 7102.464) + (vector-normalize! s1-0 4096.0) + ) + (vector+! sv-1904 s1-0 s4-1) + (let ((v0-15 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 3))) + (sv-1616 (new 'stack-no-clear 'vector)) + ) + (+! (-> v0-15 y) 31744.0) + (vector-! sv-1616 sv-1904 v0-15) + (let ((f0-27 (vector-normalize-ret-len! sv-1616 1.0))) + (when (< f0-27 32768.0) + (vector+float*! sv-1904 sv-1904 sv-1616 (- 32768.0 f0-27)) + (vector-normalize-copy! + sv-1616 + (-> this node-list data 3 bone transform vector 2) + (* 2048.0 (-> pp clock time-adjust-ratio)) + ) + (let ((v1-77 sv-1904)) + (let ((a0-31 sv-1904)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-31 quad)) + ) + (.lvf vf5 (&-> sv-1616 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-77 quad) vf6) + ) + ) + ) + ) + (let ((sv-1632 (new 'stack-no-clear 'vector))) + (let ((v1-79 sv-1904) + (a0-33 (-> this center)) + ) + (.lvf vf4 (&-> v1-79 quad)) + (.lvf vf5 (&-> a0-33 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-1632 quad) vf6) + (set! (-> sv-1632 y) 0.0) + (let ((f0-32 (vector-normalize-ret-len! sv-1632 1.0))) + (if (< f0-32 4096.0) + (vector+float*! sv-1904 sv-1904 sv-1632 (- 4096.0 f0-32)) + ) + ) + ) + (let ((sv-1728 (new 'stack-no-clear 'vector))) + (let ((v1-87 sv-1904) + (a0-36 s4-1) + ) + (.lvf vf4 (&-> v1-87 quad)) + (.lvf vf5 (&-> a0-36 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-1728 quad) vf6) + (let ((f30-3 (vector-normalize-ret-len! sv-1728 1.0)) + (f28-2 (vector-dot sv-1728 s2-0)) + (f26-0 (lerp-scale 5461.3335 10922.667 (the float s0-0) 0.0 8.0)) + ) + (when (< f28-2 (cos f26-0)) + (vector--float*! sv-1728 sv-1728 s2-0 f28-2) + (vector-normalize! sv-1728 (sin f26-0)) + (let ((sv-1712 sv-1728)) + (let ((sv-1680 sv-1728) + (sv-1696 s2-0) + (f0-38 (cos f26-0)) + ) + (.lvf vf2 (&-> sv-1696 quad)) + (.lvf vf1 (&-> sv-1680 quad)) + (let ((v1-98 f0-38)) + (.mov vf3 v1-98) + ) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-1712 quad) vf4) + ) + (vector+float*! sv-1904 s4-1 sv-1728 f30-3) + ) + ) + ) + (let ((sv-1744 (new 'stack-no-clear 'collide-query)) + (sv-1776 (new 'stack-no-clear 'vector)) + ) + (let ((v1-104 sv-1904) + (a0-47 (-> sv-1456 position)) + ) + (.lvf vf4 (&-> v1-104 quad)) + (.lvf vf5 (&-> a0-47 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-1776 quad) vf6) + (let ((sv-1760 0)) + (set! (-> sv-1904 quad) (-> sv-1456 position quad)) + (until (or (< 6 sv-1760) + (begin + (.lvf vf1 (&-> sv-1776 quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov v1-134 vf1) + (< v1-134 (square 409.6)) ) - (< f0-46 (* f1-16 f1-16)) + ) + (+! sv-1760 1) + (set! (-> sv-1744 start-pos quad) (-> sv-1904 quad)) + (set! (-> sv-1744 move-dist quad) (-> sv-1776 quad)) + (let ((v1-114 sv-1744)) + (set! (-> v1-114 radius) 4096.0) + (set! (-> v1-114 collide-with) (collide-spec player-list special-obstacle)) + (set! (-> v1-114 ignore-process0) this) + (set! (-> v1-114 ignore-process1) #f) + (set! (-> v1-114 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) + ) + (set! (-> v1-114 action-mask) (collide-action solid)) + ) + (set! (-> sv-1744 num-spheres) (the-as uint #f)) + (let ((f0-40 (probe-using-line-sphere *collide-cache* sv-1744))) + (cond + ((>= f0-40 0.0) + (let ((f0-41 (fmin 1.0 f0-40))) + (vector+float*! sv-1904 sv-1904 sv-1776 f0-41) + (vector-float*! sv-1776 sv-1776 (- 1.0 f0-41)) + ) + (let ((f0-44 (vector-dot sv-1776 (-> sv-1744 best-other-tri normal)))) + (vector--float*! sv-1776 sv-1776 (-> sv-1744 best-other-tri normal) (* 1.2 f0-44)) ) ) - ) - (set! sv-1760 (+ sv-1760 1)) - (set! (-> sv-1744 start-pos quad) (-> sv-1904 quad)) - (set! (-> sv-1744 move-dist quad) (-> sv-1776 quad)) - (let ((v1-114 sv-1744)) - (set! (-> v1-114 radius) 4096.0) - (set! (-> v1-114 collide-with) (collide-spec player-list special-obstacle)) - (set! (-> v1-114 ignore-process0) this) - (set! (-> v1-114 ignore-process1) #f) - (set! (-> v1-114 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) - ) - (set! (-> v1-114 action-mask) (collide-action solid)) - ) - (set! (-> sv-1744 num-spheres) (the-as uint #f)) - (let ((f0-40 (probe-using-line-sphere *collide-cache* sv-1744))) - (cond - ((>= f0-40 0.0) - (let ((f0-41 (fmin 1.0 f0-40))) - (vector+float*! sv-1904 sv-1904 sv-1776 f0-41) - (vector-float*! sv-1776 sv-1776 (- 1.0 f0-41)) - ) - (let ((f0-44 (vector-dot sv-1776 (-> sv-1744 best-other-tri normal)))) - (vector--float*! sv-1776 sv-1776 (-> sv-1744 best-other-tri normal) (* 1.2 f0-44)) - ) - ) - (else - (let ((v1-128 sv-1904)) - (let ((a0-64 sv-1904)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-64 quad)) - ) - (.lvf vf5 (&-> sv-1776 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-128 quad) vf6) - ) - (goto cfg-27) - ) - ) - ) - ) - (label cfg-27) - (if (< 1 sv-1760) - (+! (-> this num-bg-collisions) 1) - ) - (set! sv-1808 (new 'stack-no-clear 'vector)) - (let ((v1-143 s4-1) - (a0-69 sv-1904) - ) - (.lvf vf4 (&-> v1-143 quad)) - (.lvf vf5 (&-> a0-69 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-1808 quad) vf6) - (vector-normalize-ret-len! sv-1808 1.0) - (set! sv-1792 (new 'stack-no-clear 'vector)) - (let ((v1-146 sv-1904) - (a0-72 (-> sv-1456 position)) - ) - (.lvf vf4 (&-> v1-146 quad)) - (.lvf vf5 (&-> a0-72 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-1792 quad) vf6) - (let ((f30-4 (vector-dot sv-1808 sv-1792))) - (vector--float*! sv-1792 sv-1792 sv-1808 f30-4) - (cond - ((< f30-4 0.0) - (set! f0-51 (* 0.75 f30-4)) - (vector-float*! sv-1792 sv-1792 0.85) - ) - (else - (set! f0-51 (* 0.8 f30-4)) - (vector-float*! sv-1792 sv-1792 (-> this stretch-vel)) - ) - ) - ) - (let ((v1-157 (-> sv-1456 velocity))) - (.lvf vf2 (&-> sv-1808 quad)) - (.lvf vf1 (&-> sv-1792 quad)) - (let ((a0-79 f0-51)) - (.mov vf3 a0-79) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> v1-157 quad) vf4) - ) - (vector+! sv-1904 (-> sv-1456 position) (-> sv-1456 velocity)) - (let ((a2-14 (vector-! (new 'stack-no-clear 'vector) s4-1 sv-1904))) - (.lvf vf1 (&-> a2-14 quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-162 vf1) - (let* ((f0-53 v1-162) - (f1-21 (if (= s0-0 10) - 9830.4 - 6144.0 - ) + (else + (let ((v1-128 sv-1904)) + (let ((a0-64 sv-1904)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-64 quad)) + ) + (.lvf vf5 (&-> sv-1776 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-128 quad) vf6) ) - (f2-0 f1-21) - ) - (if (< (* f2-0 f2-0) f0-53) - (vector--float*! sv-1904 s4-1 a2-14 (/ f1-21 (sqrtf f0-53))) + (goto cfg-27) + ) + ) + ) ) - ) - ) - (set! (-> this max-movement) - (fmax (vector-vector-distance (-> sv-1456 position) sv-1904) (-> this max-movement)) - ) - (set! (-> sv-1456 position quad) (-> sv-1904 quad)) - (if (-> sv-1456 joint-mod) - (set! (-> sv-1456 joint-mod trans quad) (-> sv-1904 quad)) - ) - (when (< s0-0 11) - (vector-! (-> s5-1 vector 1) sv-1904 s4-1) - (vector-normalize! (-> s5-1 vector 1) 1.0) - (vector-cross! (-> s5-1 vector 0) (-> s5-1 vector 1) s3-1) - (vector-normalize! (-> s5-1 vector 0) 1.0) - (set! sv-1872 (new 'stack-no-clear 'vector)) - (let ((v1-182 (-> sv-1456 old-x)) - (a0-93 (-> s5-1 vector)) - ) - (.lvf vf1 (&-> v1-182 quad)) - (.lvf vf2 (&-> a0-93 0 quad)) - ) - (.outer.product.a.vf acc vf1 vf2) - (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> sv-1872 quad) vf3) - (vector-flatten! sv-1872 (-> sv-1456 old-x) (-> s5-1 vector 1)) - (vector-normalize! sv-1872 1.0) - (cond - ((< (vector-dot (-> s5-1 vector 0) sv-1872) (cos 3640.889)) - (vector-cross! sv-1872 sv-1872 (-> s5-1 vector 0)) - (vector-cross! sv-1872 (-> s5-1 vector 0) sv-1872) - (vector-normalize! sv-1872 1.0) - (set! sv-1840 (-> s5-1 vector)) - (set! sv-1824 (-> s5-1 vector)) - (let ((f0-60 (cos 3640.889))) - (.lvf vf1 (&-> sv-1824 0 quad)) - (let ((v1-192 f0-60)) - (.mov vf2 v1-192) - ) - ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-1840 0 quad) vf1) - (set! sv-1888 (-> s5-1 vector)) - (set! sv-1856 (-> s5-1 vector)) - (let ((f0-61 (sin 3640.889))) - (.lvf vf2 (&-> sv-1872 quad)) - (.lvf vf1 (&-> sv-1856 0 quad)) - (let ((v1-198 f0-61)) - (.mov vf3 v1-198) - ) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-1888 0 quad) vf4) - (set! (-> sv-1456 old-x quad) (-> s5-1 vector 0 quad)) - ) - (else - (set! (-> s5-1 vector 0 quad) (-> sv-1872 quad)) - (set! (-> sv-1456 old-x quad) (-> s5-1 vector 0 quad)) + (label cfg-27) + (if (< 1 sv-1760) + (+! (-> this num-bg-collisions) 1) + ) ) ) - (vector-cross! (-> s5-1 vector 2) (-> s5-1 vector 0) (-> s5-1 vector 1)) - (matrix->quaternion (-> sv-1456 joint-mod quat) s5-1) - (set! (-> s2-0 quad) (-> s5-1 vector 1 quad)) - (set! (-> s3-1 quad) (-> s5-1 vector 2 quad)) - 0 + (let ((sv-1808 (new 'stack-no-clear 'vector))) + (let ((a0-69 sv-1904)) + (.lvf vf4 (&-> s4-1 quad)) + (.lvf vf5 (&-> a0-69 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-1808 quad) vf6) + (vector-normalize-ret-len! sv-1808 1.0) + (let ((sv-1792 (new 'stack-no-clear 'vector))) + (let ((v1-146 sv-1904) + (a0-72 (-> sv-1456 position)) + ) + (.lvf vf4 (&-> v1-146 quad)) + (.lvf vf5 (&-> a0-72 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-1792 quad) vf6) + (let ((f30-4 (vector-dot sv-1808 sv-1792))) + (vector--float*! sv-1792 sv-1792 sv-1808 f30-4) + (cond + ((< f30-4 0.0) + (set! f0-51 (* 0.75 f30-4)) + (vector-float*! sv-1792 sv-1792 0.85) + ) + (else + (set! f0-51 (* 0.8 f30-4)) + (vector-float*! sv-1792 sv-1792 (-> this stretch-vel)) + ) + ) + ) + (let ((v1-157 (-> sv-1456 velocity))) + (.lvf vf2 (&-> sv-1808 quad)) + (.lvf vf1 (&-> sv-1792 quad)) + (let ((a0-79 f0-51)) + (.mov vf3 a0-79) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> v1-157 quad) vf4) + ) + ) + ) + (vector+! sv-1904 (-> sv-1456 position) (-> sv-1456 velocity)) + (let ((a2-14 (vector-! (new 'stack-no-clear 'vector) s4-1 sv-1904))) + (.lvf vf1 (&-> a2-14 quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov v1-162 vf1) + (let ((f0-53 v1-162) + (f1-21 (if (= s0-0 10) + 9830.4 + 6144.0 + ) + ) + ) + (if (< (square f1-21) f0-53) + (vector--float*! sv-1904 s4-1 a2-14 (/ f1-21 (sqrtf f0-53))) + ) + ) + ) + (set! (-> this max-movement) + (fmax (vector-vector-distance (-> sv-1456 position) sv-1904) (-> this max-movement)) + ) + (set! (-> sv-1456 position quad) (-> sv-1904 quad)) + (if (-> sv-1456 joint-mod) + (set! (-> sv-1456 joint-mod trans quad) (-> sv-1904 quad)) + ) + (when (< s0-0 11) + (vector-! (-> s5-1 vector 1) sv-1904 s4-1) + (vector-normalize! (-> s5-1 vector 1) 1.0) + (vector-cross! (-> s5-1 vector 0) (-> s5-1 vector 1) s3-1) + (vector-normalize! (-> s5-1 vector 0) 1.0) + (let ((sv-1872 (new 'stack-no-clear 'vector))) + (let ((v1-182 (-> sv-1456 old-x)) + (a0-93 (-> s5-1 vector)) + ) + (.lvf vf1 (&-> v1-182 quad)) + (.lvf vf2 (&-> a0-93 0 quad)) + ) + (.outer.product.a.vf acc vf1 vf2) + (.outer.product.b.vf vf3 vf2 vf1 acc) + (.svf (&-> sv-1872 quad) vf3) + (vector-flatten! sv-1872 (-> sv-1456 old-x) (-> s5-1 vector 1)) + (vector-normalize! sv-1872 1.0) + (cond + ((< (vector-dot (-> s5-1 vector 0) sv-1872) (cos 3640.889)) + (vector-cross! sv-1872 sv-1872 (-> s5-1 vector 0)) + (vector-cross! sv-1872 (-> s5-1 vector 0) sv-1872) + (vector-normalize! sv-1872 1.0) + (let ((sv-1840 (-> s5-1 vector))) + (let ((sv-1824 (-> s5-1 vector)) + (f0-60 (cos 3640.889)) + ) + (.lvf vf1 (&-> sv-1824 0 quad)) + (let ((v1-192 f0-60)) + (.mov vf2 v1-192) + ) + ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-1840 0 quad) vf1) + ) + (let ((sv-1888 (-> s5-1 vector))) + (let ((sv-1856 (-> s5-1 vector)) + (f0-61 (sin 3640.889)) + ) + (.lvf vf2 (&-> sv-1872 quad)) + (.lvf vf1 (&-> sv-1856 0 quad)) + (let ((v1-198 f0-61)) + (.mov vf3 v1-198) + ) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-1888 0 quad) vf4) + ) + (set! (-> sv-1456 old-x quad) (-> s5-1 vector 0 quad)) + ) + (else + (set! (-> s5-1 vector 0 quad) (-> sv-1872 quad)) + (set! (-> sv-1456 old-x quad) (-> s5-1 vector 0 quad)) + ) + ) + ) + (vector-cross! (-> s5-1 vector 2) (-> s5-1 vector 0) (-> s5-1 vector 1)) + (matrix->quaternion (-> sv-1456 joint-mod quat) s5-1) + (set! (-> s2-0 quad) (-> s5-1 vector 1 quad)) + (set! (-> s3-1 quad) (-> s5-1 vector 2 quad)) + 0 + ) + (set! (-> s4-1 quad) (-> sv-1904 quad)) ) - (set! (-> s4-1 quad) (-> sv-1904 quad)) 0 ) ) @@ -1238,89 +1207,27 @@ ;; WARN: Return type mismatch (pointer process) vs none. (defbehavior squid-check-hit-points squid () - (local-vars - (sv-48 symbol) - (sv-64 symbol) - (sv-80 vector) - (sv-96 matrix) - (sv-112 symbol) - (sv-128 symbol) - (sv-144 vector) - (sv-160 matrix) - ) (when (zero? (-> self hit-points)) (set! (-> self shield-hit-points) 0.0) (cond ((zero? (-> self stage)) (setup-masks (-> self draw) 320 160) - (let ((gp-0 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-0 - (let ((t9-2 (method-of-type part-tracker activate))) - (t9-2 (the-as part-tracker gp-0) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s5-0 run-function-in-process) - (s4-0 gp-0) - (s3-0 part-tracker-init) - (s2-0 group-squid-grenade-explode) - (s1-0 0) - (s0-0 #f) - ) - (set! sv-48 (the-as symbol #f)) - (set! sv-64 (the-as symbol #f)) - (set! sv-96 *launch-matrix*) - (set! sv-80 (-> sv-96 trans)) - (let ((v1-13 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg gunL)) quad))) - (set! (-> sv-80 quad) v1-13) - ) - ((the-as (function object object object object object object object object none) s5-0) - s4-0 - s3-0 - s2-0 - s1-0 - s0-0 - sv-48 - sv-64 - sv-96 - ) - ) - (-> gp-0 ppointer) - ) + (part-tracker-spawn + :to self + :group group-squid-grenade-explode + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg gunL)) ) ) ((= (-> self stage) 1) (setup-masks (-> self draw) 5120 2590) - (let ((gp-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-1 - (let ((t9-7 (method-of-type part-tracker activate))) - (t9-7 (the-as part-tracker gp-1) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s5-1 run-function-in-process) - (s4-1 gp-1) - (s3-1 part-tracker-init) - (s2-1 group-squid-grenade-explode) - (s1-1 0) - (s0-1 #f) - ) - (set! sv-112 (the-as symbol #f)) - (set! sv-128 (the-as symbol #f)) - (set! sv-160 *launch-matrix*) - (set! sv-144 (-> sv-160 trans)) - (let ((v1-25 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg podL)) quad))) - (set! (-> sv-144 quad) v1-25) - ) - ((the-as (function object object object object object object object object none) s5-1) - s4-1 - s3-1 - s2-1 - s1-1 - s0-1 - sv-112 - sv-128 - sv-160 - ) - ) - (-> gp-1 ppointer) - ) + (part-tracker-spawn + :to self + :group group-squid-grenade-explode + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg podL)) ) ) ) @@ -1329,7 +1236,6 @@ ) (defbehavior squid-handler squid ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (sv-16 res-tag)) (case arg2 (('plane) (set! (-> self max-plane) (max (-> self max-plane) (the-as int (-> arg3 param 0)))) @@ -1343,8 +1249,9 @@ ) ) (when (nonzero? s5-1) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-9 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-9 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-9 (< (the-as uint s5-1) (-> sv-16 elt-count))) (let ((gp-1 (-> v1-9 s5-1))) (dotimes (s5-2 (-> gp-1 length)) @@ -1883,17 +1790,6 @@ ) (defmethod move-to-spot ((this squid) (arg0 vector) (arg1 symbol)) - (local-vars - (sv-656 vector) - (sv-672 vector) - (sv-688 matrix) - (sv-704 clamp-travel-vector-to-mesh-return-info) - (sv-720 int) - (sv-736 nav-control) - (sv-752 vector) - (sv-768 nav-control) - (sv-784 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1906,27 +1802,27 @@ ) (let ((s1-0 (new 'stack-no-clear 'vector)) (f30-0 0.0) + (sv-656 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + (s0-0 0) + (sv-672 (squid-method-42 this (new 'stack-no-clear 'vector))) ) - (set! sv-656 (new 'stack-no-clear 'vector)) - (let ((s3-0 (new 'stack-no-clear 'vector)) - (s0-0 0) - ) - (set! sv-672 (squid-method-42 this (new 'stack-no-clear 'vector))) - (+! (-> sv-672 y) 8192.0) - (set! (-> s3-0 quad) (-> arg0 quad)) - (set! (-> s3-0 y) (-> this nav state mesh bounds y)) - (set! (-> this current-nav-poly) (cloest-point-on-mesh (-> this nav) s3-0 s3-0 (-> this current-nav-poly))) - (cond - ((-> this current-nav-poly) - (vector-! sv-656 (-> this nav state mesh bounds) s3-0) - (set! (-> sv-656 y) 0.0) - (vector-normalize! sv-656 614400.0) - (let ((a2-2 (matrix-rotate-y! (new 'stack-no-clear 'matrix) -19114.668))) - (vector-matrix*! sv-656 sv-656 a2-2) - ) - (set! sv-688 (matrix-rotate-y! (new 'stack-no-clear 'matrix) 2730.6667)) - (set! sv-704 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) - (set! sv-720 0) + (+! (-> sv-672 y) 8192.0) + (set! (-> s3-0 quad) (-> arg0 quad)) + (set! (-> s3-0 y) (-> this nav state mesh bounds y)) + (set! (-> this current-nav-poly) (cloest-point-on-mesh (-> this nav) s3-0 s3-0 (-> this current-nav-poly))) + (cond + ((-> this current-nav-poly) + (vector-! sv-656 (-> this nav state mesh bounds) s3-0) + (set! (-> sv-656 y) 0.0) + (vector-normalize! sv-656 614400.0) + (let ((a2-2 (matrix-rotate-y! (new 'stack-no-clear 'matrix) -19114.668))) + (vector-matrix*! sv-656 sv-656 a2-2) + ) + (let ((sv-688 (matrix-rotate-y! (new 'stack-no-clear 'matrix) 2730.6667)) + (sv-704 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) + (sv-720 0) + ) (while (< sv-720 13) (vector-matrix*! sv-656 sv-656 sv-688) (set! (-> s5-0 s0-0 quad) (-> sv-656 quad)) @@ -1945,47 +1841,39 @@ (cond ((not (-> sv-704 found-boundary)) ) - ((let ((f0-6 (vector-vector-distance-squared sv-672 (-> s5-0 s0-0))) - (f1-2 102400.0) - ) - (< f0-6 (* f1-2 f1-2)) - ) + ((< (vector-vector-distance-squared sv-672 (-> s5-0 s0-0)) (square 102400.0)) ) ((not (squid-method-44 this (-> s5-0 s0-0) sv-672)) ) - ((let ((f0-7 (vector-vector-distance-squared s3-0 (-> s5-0 s0-0))) - (f1-5 81920.0) - ) - (< f0-7 (* f1-5 f1-5)) - ) + ((< (vector-vector-distance-squared s3-0 (-> s5-0 s0-0)) (square 81920.0)) (let ((f28-0 (vector-vector-distance-squared s3-0 (-> s5-0 s0-0)))) (new 'stack-no-clear 'vector) (when (< f30-0 f28-0) (set! (-> s1-0 quad) (-> s5-0 s0-0 quad)) (when (-> sv-704 poly) - (let ((a3-2 (new 'stack-no-clear 'vector))) - (set! sv-736 (-> this nav)) - (let ((a1-15 (-> sv-704 poly))) - (set! sv-752 s1-0) - (let ((v1-53 (-> s5-0 s0-0))) - (project-point-onto-plane-of-poly-local - (-> sv-736 state mesh) - a1-15 - sv-752 - a3-2 - (vector-! (new 'stack-no-clear 'vector) v1-53 (-> sv-736 state mesh bounds)) - ) + (let ((a3-2 (new 'stack-no-clear 'vector)) + (sv-736 (-> this nav)) + (a1-15 (-> sv-704 poly)) + (sv-752 s1-0) + ) + (let ((v1-53 (-> s5-0 s0-0))) + (project-point-onto-plane-of-poly-local + (-> sv-736 state mesh) + a1-15 + sv-752 + a3-2 + (vector-! (new 'stack-no-clear 'vector) v1-53 (-> sv-736 state mesh bounds)) ) ) - ) - (let ((v1-54 sv-752)) - (let ((a0-33 (-> sv-736 state mesh bounds))) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-752 quad)) - (.lvf vf5 (&-> a0-33 quad)) + (let ((v1-54 sv-752)) + (let ((a0-33 (-> sv-736 state mesh bounds))) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-752 quad)) + (.lvf vf5 (&-> a0-33 quad)) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-54 quad) vf6) ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-54 quad) vf6) ) 0 (+! (-> s1-0 y) 32768.0) @@ -1996,29 +1884,29 @@ ) (else (when (-> sv-704 poly) - (let ((a3-3 (new 'stack-no-clear 'vector))) - (set! sv-768 (-> this nav)) - (let ((a1-17 (-> sv-704 poly))) - (set! sv-784 (-> s5-0 s0-0)) - (let ((v1-67 (-> s5-0 s0-0))) - (project-point-onto-plane-of-poly-local - (-> sv-768 state mesh) - a1-17 - sv-784 - a3-3 - (vector-! (new 'stack-no-clear 'vector) v1-67 (-> sv-768 state mesh bounds)) - ) + (let ((a3-3 (new 'stack-no-clear 'vector)) + (sv-768 (-> this nav)) + (a1-17 (-> sv-704 poly)) + (sv-784 (-> s5-0 s0-0)) + ) + (let ((v1-67 (-> s5-0 s0-0))) + (project-point-onto-plane-of-poly-local + (-> sv-768 state mesh) + a1-17 + sv-784 + a3-3 + (vector-! (new 'stack-no-clear 'vector) v1-67 (-> sv-768 state mesh bounds)) ) ) - ) - (let ((v1-68 sv-784)) - (let ((a0-38 (-> sv-768 state mesh bounds))) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-784 quad)) - (.lvf vf5 (&-> a0-38 quad)) + (let ((v1-68 sv-784)) + (let ((a0-38 (-> sv-768 state mesh bounds))) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-784 quad)) + (.lvf vf5 (&-> a0-38 quad)) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-68 quad) vf6) ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-68 quad) vf6) ) 0 (+! (-> s5-0 s0-0 y) 32768.0) @@ -2026,26 +1914,26 @@ (+! s0-0 1) ) ) - (set! sv-720 (+ sv-720 1)) - ) - (when arg1 - (cond - ((and (zero? s0-0) (!= f30-0 0.0)) - (set! (-> s5-0 0 quad) (-> s1-0 quad)) - ) - ((zero? s0-0) - ) - (else - (set! (-> s5-0 0 quad) (-> s5-0 (rand-vu-int-count s0-0) quad)) - ) - ) - (set! (-> s3-0 y) (-> arg0 y)) - (set-traj-towards-vec this arg0 s3-0 (-> s5-0 0)) + (+! sv-720 1) ) ) - (else - (format 0 "~A bad current poly~%" (-> this name)) - ) + (when arg1 + (cond + ((and (zero? s0-0) (!= f30-0 0.0)) + (set! (-> s5-0 0 quad) (-> s1-0 quad)) + ) + ((zero? s0-0) + ) + (else + (set! (-> s5-0 0 quad) (-> s5-0 (rand-vu-int-count s0-0) quad)) + ) + ) + (set! (-> s3-0 y) (-> arg0 y)) + (set-traj-towards-vec this arg0 s3-0 (-> s5-0 0)) + ) + ) + (else + (format 0 "~A bad current poly~%" (-> this name)) ) ) ) @@ -2296,13 +2184,7 @@ ;; WARN: Return type mismatch float vs none. (defmethod squid-post ((this squid)) - (local-vars - (v0-33 object) - (s5-9 int) - (sv-496 - (function skeleton-group int joint-exploder-tuning joint-exploder-static-params none :behavior joint-exploder) - ) - ) + (local-vars (v0-33 object) (s5-9 int)) (with-pp (if (= (-> this stage) 2) (script-eval '(want-anim "palace-boss-res")) @@ -2315,9 +2197,7 @@ (cloest-point-on-mesh (-> this nav) (-> this trans) (-> this trans) (-> this current-nav-poly)) ) (set! (-> this trans y) (-> s5-0 y)) - (let ((f0-2 409.6)) - (set! (-> this mesh-forced) (< (* f0-2 f0-2) (vector-vector-distance-squared (-> this trans) s5-0))) - ) + (set! (-> this mesh-forced) (< (square 409.6) (vector-vector-distance-squared (-> this trans) s5-0))) ) ) (setup-part-engine this #f) @@ -2561,33 +2441,16 @@ ) (dotimes (s3-4 6) (let ((s1-2 (handle->process (-> this tentacles s3-4)))) - (when s1-2 - (let ((s2-2 (get-process *default-dead-pool* joint-exploder #x4000))) - (when s2-2 - (let ((t9-67 (method-of-type joint-exploder activate))) - (t9-67 - (the-as joint-exploder s2-2) - s1-2 - (symbol->string (-> joint-exploder symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s1-3 run-function-in-process) - (s0-1 s2-2) - ) - (set! sv-496 joint-exploder-init-by-other) - (let ((a2-30 (art-group-get-by-name *level* "skel-squid-tentacle-shield" (the-as (pointer uint32) #f))) - (a3-14 67) - (t0-11 s4-10) - (t1-8 *squid-tentacle-shield-exploder-params*) - ) - ((the-as (function object object object object object object none) s1-3) s0-1 sv-496 a2-30 a3-14 t0-11 t1-8) - ) - ) - (-> s2-2 ppointer) + (if s1-2 + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-squid-tentacle-shield" (the-as (pointer uint32) #f)) + 67 + s4-10 + *squid-tentacle-shield-exploder-params* + :to s1-2 ) ) - ) ) ) ) diff --git a/goal_src/jak2/levels/palace/boss/squid-states.gc b/goal_src/jak2/levels/palace/boss/squid-states.gc index 50848822d9..570865517c 100644 --- a/goal_src/jak2/levels/palace/boss/squid-states.gc +++ b/goal_src/jak2/levels/palace/boss/squid-states.gc @@ -251,9 +251,9 @@ ;; WARN: Check prologue - tricky store of r0 ;; WARN: Return type mismatch symbol vs none. (defbehavior go-through-wall squid () - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-1 (< (the-as uint (-> self stage)) (-> sv-16 elt-count))) (let ((gp-0 (-> v1-1 (-> self stage)))) (dotimes (s5-0 (-> gp-0 length)) @@ -527,20 +527,6 @@ ) ) :trans (behavior () - (local-vars - (sv-80 symbol) - (sv-96 symbol) - (sv-112 vector) - (sv-128 matrix) - (sv-144 symbol) - (sv-160 symbol) - (sv-176 vector) - (sv-192 matrix) - (sv-208 symbol) - (sv-224 symbol) - (sv-240 vector) - (sv-256 matrix) - ) (quaternion-rotate-y! (-> self quat) (-> self quat) 5461.3335) (vector-lerp! (-> self trans) @@ -558,109 +544,31 @@ (cond ((zero? (-> self stage)) (setup-masks (-> self draw) 320 160) - (let ((gp-4 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-4 - (let ((t9-11 (method-of-type part-tracker activate))) - (t9-11 (the-as part-tracker gp-4) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s5-3 run-function-in-process) - (s4-1 gp-4) - (s3-1 part-tracker-init) - (s2-0 group-squid-whirlwind-explode) - (s1-0 0) - (s0-0 #f) - ) - (set! sv-80 (the-as symbol #f)) - (set! sv-96 (the-as symbol #f)) - (set! sv-128 *launch-matrix*) - (set! sv-112 (-> sv-128 trans)) - (let ((v1-33 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg gunR)) quad))) - (set! (-> sv-112 quad) v1-33) - ) - ((the-as (function object object object object object object object object none) s5-3) - s4-1 - s3-1 - s2-0 - s1-0 - s0-0 - sv-80 - sv-96 - sv-128 - ) - ) - (-> gp-4 ppointer) - ) + (part-tracker-spawn + :to self + :group group-squid-whirlwind-explode + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg gunR)) ) ) ((= (-> self stage) 1) (setup-masks (-> self draw) 5120 2590) - (let ((gp-5 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-5 - (let ((t9-16 (method-of-type part-tracker activate))) - (t9-16 (the-as part-tracker gp-5) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s5-4 run-function-in-process) - (s4-2 gp-5) - (s3-2 part-tracker-init) - (s2-1 group-squid-whirlwind-explode) - (s1-1 0) - (s0-1 #f) - ) - (set! sv-144 (the-as symbol #f)) - (set! sv-160 (the-as symbol #f)) - (set! sv-192 *launch-matrix*) - (set! sv-176 (-> sv-192 trans)) - (let ((v1-47 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg podR)) quad))) - (set! (-> sv-176 quad) v1-47) - ) - ((the-as (function object object object object object object object object none) s5-4) - s4-2 - s3-2 - s2-1 - s1-1 - s0-1 - sv-144 - sv-160 - sv-192 - ) - ) - (-> gp-5 ppointer) - ) + (part-tracker-spawn + :to self + :group group-squid-whirlwind-explode + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg podR)) ) ) (else - (let ((gp-6 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-6 - (let ((t9-20 (method-of-type part-tracker activate))) - (t9-20 (the-as part-tracker gp-6) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s5-5 run-function-in-process) - (s4-3 gp-6) - (s3-3 part-tracker-init) - (s2-2 group-squid-whirlwind-explode) - (s1-2 0) - (s0-2 #f) - ) - (set! sv-208 (the-as symbol #f)) - (set! sv-224 (the-as symbol #f)) - (set! sv-256 *launch-matrix*) - (set! sv-240 (-> sv-256 trans)) - (let ((v1-59 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg podR)) quad))) - (set! (-> sv-240 quad) v1-59) - ) - ((the-as (function object object object object object object object object none) s5-5) - s4-3 - s3-3 - s2-2 - s1-2 - s0-2 - sv-208 - sv-224 - sv-256 - ) - ) - (-> gp-6 ppointer) - ) + (part-tracker-spawn + :to self + :group group-squid-whirlwind-explode + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg podR)) ) ) ) @@ -980,11 +888,7 @@ (s2-0 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) ) (if (and (time-elapsed? (-> self state-time) (seconds 0.017)) - (let ((f0-8 (vector-vector-xz-distance-squared (-> self traj-dest) (-> self trans))) - (f1-1 8192.0) - ) - (< f0-8 (* f1-1 f1-1)) - ) + (< (vector-vector-xz-distance-squared (-> self traj-dest) (-> self trans)) (square 8192.0)) ) (go-virtual fly-to-shoot-spot) ) @@ -1656,18 +1560,14 @@ ) (else (when (task-node-closed? (game-task-node palace-boss-introduction)) - (let ((f0-2 (vector-vector-xz-distance-squared (-> self trans) (target-pos 0))) - (f1-1 217088.0) - ) + (let ((f0-2 (vector-vector-xz-distance-squared (-> self trans) (target-pos 0)))) (cond - ((< f0-2 (* f1-1 f1-1)) + ((< f0-2 (square 217088.0)) (set! (-> self allowed-rotate-to-vector-angle) 32768.0) (squid-method-43 self (squid-method-42 self (new 'stack-no-clear 'vector)) 32585.955 0.999) (go-virtual idle) ) - ((let ((f1-4 286720.0)) - (< f0-2 (* f1-4 f1-4)) - ) + ((< f0-2 (square 286720.0)) ) ) ) diff --git a/goal_src/jak2/levels/palace/cable/palcab-obs.gc b/goal_src/jak2/levels/palace/cable/palcab-obs.gc index c40ce6c1b3..792c9164aa 100644 --- a/goal_src/jak2/levels/palace/cable/palcab-obs.gc +++ b/goal_src/jak2/levels/palace/cable/palcab-obs.gc @@ -110,7 +110,6 @@ ) :code sleep-code :post (behavior () - (local-vars (sv-112 vector) (sv-128 vector) (sv-144 lightning-control)) (let ((v1-0 (-> self root)) (f30-0 4369.067) (f28-0 (* (-> self rotate-speed) (seconds-per-frame))) @@ -136,16 +135,18 @@ (set-vector! s2-0 0.0 (-> s0-0 dist) 0.0 1.0) (vector-orient-by-quat! s2-0 s2-0 s1-0) (vector+! s2-0 s2-0 (-> self root trans)) - (set! sv-112 (new 'stack-no-clear 'vector)) - (set! sv-128 (new 'stack-no-clear 'vector)) - (set! sv-144 (-> s0-0 lightning)) - (set-vector! sv-112 (-> s0-0 radius) 0.0 0.0 0.0) - (quaternion-rotate-local-z! s1-0 s1-0 (-> s0-0 local-z-rotate)) - (dotimes (s0-1 16) - (vector-orient-by-quat! sv-128 sv-112 s1-0) - (vector*! sv-128 sv-128 gp-0) - (set-point! sv-144 s0-1 (vector+! (new 'stack-no-clear 'vector) s2-0 sv-128)) - (quaternion-rotate-local-y! s1-0 s1-0 f30-0) + (let ((sv-112 (new 'stack-no-clear 'vector)) + (sv-128 (new 'stack-no-clear 'vector)) + (sv-144 (-> s0-0 lightning)) + ) + (set-vector! sv-112 (-> s0-0 radius) 0.0 0.0 0.0) + (quaternion-rotate-local-z! s1-0 s1-0 (-> s0-0 local-z-rotate)) + (dotimes (s0-1 16) + (vector-orient-by-quat! sv-128 sv-112 s1-0) + (vector*! sv-128 sv-128 gp-0) + (set-point! sv-144 s0-1 (vector+! (new 'stack-no-clear 'vector) s2-0 sv-128)) + (quaternion-rotate-local-y! s1-0 s1-0 f30-0) + ) ) ) ) @@ -736,7 +737,7 @@ (let* ((f0-10 (the float (sar (shl (the int (quaternion-z-angle (-> self root quat))) 48) 48))) (f0-12 (fabs (cos f0-10))) ) - (set-palcab-turret-flash! (* f30-0 (* f0-12 f0-12 f0-12))) + (set-palcab-turret-flash! (* f30-0 (* (square f0-12) f0-12))) ) ) (let ((f30-2 (+ 32768.0 (the float (sar (shl (the int (quaternion-z-angle (-> self root quat))) 48) 48))))) diff --git a/goal_src/jak2/levels/ruins/pillar-collapse.gc b/goal_src/jak2/levels/ruins/pillar-collapse.gc index e812934e45..3d12bf707c 100644 --- a/goal_src/jak2/levels/ruins/pillar-collapse.gc +++ b/goal_src/jak2/levels/ruins/pillar-collapse.gc @@ -161,11 +161,7 @@ (case message (('touch 'attack) (let* ((s5-0 (-> block param 0)) - (s4-0 proc) - (gp-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) + (gp-0 (the-as process (as-type proc process-focusable))) (a1-4 (if s5-0 ((method-of-type touching-shapes-entry prims-touching?) (the-as touching-shapes-entry s5-0) @@ -235,7 +231,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape-moving)) (stack-size-set! (-> this main-thread) 512) (logior! (-> this mask) (process-mask collectable)) (dotimes (v1-3 3) @@ -294,28 +289,29 @@ (s1-0 (-> (the-as pair s2-0) car)) ) (while (not (null? s2-0)) - (let ((s0-0 (method-of-type collide-shape-prim-mesh new))) - (set! sv-32 'process) - (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 s4-0) - (let ((a3-2 (command-get-int (-> (the-as pair s1-0) car) 0)) - (t0-1 0) + (let ((sv-16 + (new + 'process + 'collide-shape-prim-mesh + s4-0 + (the-as uint (command-get-int (-> (the-as pair s1-0) car) 0)) + (the-as uint 0) + ) ) - (set! sv-16 (s0-0 sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((s0-1 sv-16)) + (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) + (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) + (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) + (set! (-> s0-1 transform-index) (command-get-int (-> (the-as pair (-> (the-as pair s1-0) cdr)) car) 0)) + ) + (set-vector! + (-> sv-16 local-sphere) + 0.0 + 0.0 + 0.0 + (command-get-float (-> (the-as pair (-> (the-as pair (-> (the-as pair s1-0) cdr)) cdr)) car) 0.0) ) - ) - (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) - (set! (-> s0-1 transform-index) (command-get-int (-> (the-as pair (-> (the-as pair s1-0) cdr)) car) 0)) - ) - (set-vector! - (-> sv-16 local-sphere) - 0.0 - 0.0 - 0.0 - (command-get-float (-> (the-as pair (-> (the-as pair (-> (the-as pair s1-0) cdr)) cdr)) car) 0.0) ) (set! s2-0 (-> (the-as pair s2-0) cdr)) (set! s1-0 (-> (the-as pair s2-0) car)) diff --git a/goal_src/jak2/levels/ruins/rapid-gunner.gc b/goal_src/jak2/levels/ruins/rapid-gunner.gc index f6472df568..b120b7b806 100644 --- a/goal_src/jak2/levels/ruins/rapid-gunner.gc +++ b/goal_src/jak2/levels/ruins/rapid-gunner.gc @@ -630,12 +630,7 @@ (set! (-> v1-28 target-speed) 0.0) ) 0 - (let* ((gp-1 (handle->process (-> self focus handle))) - (a0-14 (if (type? gp-1 process-focusable) - gp-1 - ) - ) - ) + (let ((a0-14 (the-as process (as-type (handle->process (-> self focus handle)) process-focusable)))) (when a0-14 (let ((v1-34 (get-trans (the-as process-focusable a0-14) 3))) (set! (-> self target-next-pos quad) (-> v1-34 quad)) @@ -1420,7 +1415,6 @@ (defmethod init-enemy! ((this rapid-gunner)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (local-vars (sv-48 int)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1463,8 +1457,9 @@ (logclear! (-> this status-flags) (rapid-gunner-flags ragflags-0)) (logior! (-> this status-flags) (rapid-gunner-flags ragflags-1)) (let ((f30-0 3640.889)) - (set! sv-48 0) - (let ((v1-22 (res-lump-data (-> this entity) 'spinup-angle pointer :tag-ptr (the-as (pointer res-tag) (& sv-48))))) + (let* ((sv-48 0) + (v1-22 (res-lump-data (-> this entity) 'spinup-angle pointer :tag-ptr (the-as (pointer res-tag) (& sv-48)))) + ) (if v1-22 (set! f30-0 (-> (the-as (pointer float) v1-22))) ) diff --git a/goal_src/jak2/levels/ruins/ruins-obs.gc b/goal_src/jak2/levels/ruins/ruins-obs.gc index a7ac681771..fa10dd95a2 100644 --- a/goal_src/jak2/levels/ruins/ruins-obs.gc +++ b/goal_src/jak2/levels/ruins/ruins-obs.gc @@ -148,13 +148,9 @@ (defstate idle (beam) :virtual #t :trans (behavior () - (let ((f0-0 (vector-vector-distance-squared (-> self root trans) (camera-pos))) - (f1-0 102400.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (go-virtual collapse) - ) - ) + (if (< (vector-vector-distance-squared (-> self root trans) (camera-pos)) (square 102400.0)) + (go-virtual collapse) + ) ) :code sleep-code ) @@ -178,11 +174,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this beam) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -216,8 +212,8 @@ This commonly includes things such as: (defmethod start-bouncing! ((this ruins-bridge)) "Sets `bouncing` to [[#t]] and sets up the clock to periodically bounce -and translate the platform via the `smush` -@see [[smush-control]]" + and translate the platform via the `smush` + @see [[smush-control]]" (logclear! (-> this mask) (process-mask sleep)) (logclear! (-> this mask) (process-mask sleep-code)) 0 @@ -277,11 +273,11 @@ and translate the platform via the `smush` ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this ruins-bridge) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (stack-size-set! (-> this main-thread) 512) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) @@ -406,8 +402,8 @@ This commonly includes things such as: (defmethod start-bouncing! ((this ruins-drop-plat)) "Sets `bouncing` to [[#t]] and sets up the clock to periodically bounce -and translate the platform via the `smush` -@see [[smush-control]]" + and translate the platform via the `smush` + @see [[smush-control]]" (activate! (-> this smush) -1.0 60 150 1.0 1.0 (-> self clock)) (set-time! (-> this bounce-time)) (set! (-> this bouncing) #t) @@ -498,11 +494,11 @@ and translate the platform via the `smush` ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this ruins-drop-plat) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (stack-size-set! (-> this main-thread) 512) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/goal_src/jak2/levels/sewer/hosehead-fake.gc b/goal_src/jak2/levels/sewer/hosehead-fake.gc index 568452f7b3..151d5d10a9 100644 --- a/goal_src/jak2/levels/sewer/hosehead-fake.gc +++ b/goal_src/jak2/levels/sewer/hosehead-fake.gc @@ -250,11 +250,9 @@ :event hosehead-fake-event-handler :trans (behavior () (vector-seek-3d-smooth! (-> self root trans) (-> self walk-dest) (* 24576.0 (seconds-per-frame)) 0.8) - (let ((f0-2 409.6)) - (if (>= (* f0-2 f0-2) (vector-vector-distance-squared (-> self root trans) (-> self walk-dest))) - (go-virtual idle) - ) - ) + (if (>= (square 409.6) (vector-vector-distance-squared (-> self root trans) (-> self walk-dest))) + (go-virtual idle) + ) ) :code (behavior () (ja-channel-push! 1 (seconds 0.1)) diff --git a/goal_src/jak2/levels/sewer/hosehead.gc b/goal_src/jak2/levels/sewer/hosehead.gc index 298796deac..e084574660 100644 --- a/goal_src/jak2/levels/sewer/hosehead.gc +++ b/goal_src/jak2/levels/sewer/hosehead.gc @@ -698,12 +698,7 @@ (let ((f0-7 (fill-and-probe-using-line-sphere *collide-cache* s3-0))) (when (>= f0-7 0.0) (vector-float*! s5-0 s5-0 f0-7) - (let* ((s2-2 (-> s3-0 best-other-tri collide-ptr)) - (s3-1 (if (type? s2-2 collide-shape-prim) - s2-2 - ) - ) - ) + (let ((s3-1 (the-as basic (as-type (-> s3-0 best-other-tri collide-ptr) collide-shape-prim)))) (when s3-1 (if (logtest? (-> (the-as collide-shape-prim s3-1) prim-core collide-as) (collide-spec enemy)) (go-hostile this) @@ -1115,14 +1110,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-7 vf1) - (let ((f0-4 a2-7) - (f1-1 (+ (-> a1-5 world-sphere w) (-> gp-1 w))) - ) - (when (< f0-4 (* f1-1 f1-1)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-7 (square (+ (-> a1-5 world-sphere w) (-> gp-1 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -1156,14 +1147,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-14 vf1) - (let ((f0-5 a2-14) - (f1-5 (+ (-> a1-17 world-sphere w) (-> gp-1 w))) - ) - (when (< f0-5 (* f1-5 f1-5)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-14 (square (+ (-> a1-17 world-sphere w) (-> gp-1 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -1181,16 +1168,15 @@ (when (logtest? (-> v1-30 root-prim prim-core collide-as) (collide-spec jak bot enemy hit-by-others-list player-list) ) - (let ((f0-6 (if (= (-> v1-30 process type) target) - 28672.0 - 20480.0 + (if (>= (square (if (= (-> v1-30 process type) target) + 28672.0 + 20480.0 + ) ) - ) - ) - (if (>= (* f0-6 f0-6) (vector-vector-xz-distance-squared gp-1 (-> v1-30 trans))) - (return #f) - ) - ) + (vector-vector-xz-distance-squared gp-1 (-> v1-30 trans)) + ) + (return #f) + ) ) ) ) @@ -1393,7 +1379,6 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod hosehead-method-196 ((this hosehead)) - (local-vars (sv-768 nav-control) (sv-784 vector) (sv-800 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1443,18 +1428,21 @@ (when (not (add-root-sphere-to-hash! (-> this nav) a1-5 32)) (when (< f30-0 f28-0) (set! f30-0 f28-0) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (set! sv-784 (new 'stack-no-clear 'vector)) - (let ((s1-1 (new 'stack 'collide-query))) - (set! sv-768 (-> this nav)) - (set! sv-800 s0-0) - (let* ((v1-22 s3-0) - (a0-14 (-> sv-768 state mesh)) - (t9-5 (method-of-object a0-14 project-point-onto-plane-of-poly-local)) - (a2-6 sv-800) - (t0-1 (vector-! (new 'stack-no-clear 'vector) v1-22 (-> sv-768 state mesh bounds))) - ) - (t9-5 a0-14 s2-0 a2-6 sv-784 t0-1) + (let ((s0-0 (new 'stack-no-clear 'vector)) + (sv-784 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack 'collide-query)) + ) + (let ((sv-768 (-> this nav)) + (sv-800 s0-0) + ) + (let ((v1-22 s3-0)) + (project-point-onto-plane-of-poly-local + (-> sv-768 state mesh) + s2-0 + sv-800 + sv-784 + (vector-! (new 'stack-no-clear 'vector) v1-22 (-> sv-768 state mesh bounds)) + ) ) (let ((v1-23 sv-800)) (let ((a0-17 (-> sv-768 state mesh bounds))) @@ -1465,12 +1453,12 @@ (.add.vf.xyz vf6 vf4 vf5) (.svf (&-> v1-23 quad) vf6) ) - 0 - (set! (-> s3-0 y) (-> s0-0 y)) - (if (enemy-above-ground? this s1-1 s3-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) - (set! (-> s3-0 y) (-> s1-1 best-other-tri intersect y)) - ) ) + 0 + (set! (-> s3-0 y) (-> s0-0 y)) + (if (enemy-above-ground? this s1-1 s3-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (set! (-> s3-0 y) (-> s1-1 best-other-tri intersect y)) + ) ) (set! (-> this jump-point quad) (-> s3-0 quad)) ) @@ -1491,7 +1479,6 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (local-vars (sv-688 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1545,28 +1532,29 @@ (let ((s2-0 (find-poly-containing-point-local (-> v1-16 state mesh) a1-4))) (set! (-> self jump-point quad) (-> s5-0 quad)) (when s2-0 - (let ((s3-0 (new 'stack-no-clear 'vector))) - (set! sv-688 (new 'stack-no-clear 'vector)) - (let ((s4-1 (new 'stack 'collide-query))) - (let ((s0-0 (-> self nav)) - (s1-0 s3-0) - ) - (let* ((v1-22 s5-0) - (a0-15 (-> s0-0 state mesh)) - (t9-5 (method-of-object a0-15 project-point-onto-plane-of-poly-local)) - (a2-2 s1-0) - (t0-1 (vector-! (new 'stack-no-clear 'vector) v1-22 (-> s0-0 state mesh bounds))) - ) - (t9-5 a0-15 s2-0 a2-2 sv-688 t0-1) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (sv-688 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack 'collide-query)) + ) + (let ((s0-0 (-> self nav)) + (s1-0 s3-0) + ) + (let ((v1-22 s5-0)) + (project-point-onto-plane-of-poly-local + (-> s0-0 state mesh) + s2-0 + s1-0 + sv-688 + (vector-! (new 'stack-no-clear 'vector) v1-22 (-> s0-0 state mesh bounds)) ) - (vector+! s1-0 s1-0 (-> s0-0 state mesh bounds)) - ) - 0 - (set! (-> s5-0 y) (-> s3-0 y)) - (when (enemy-above-ground? self s4-1 s5-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) - (set! (-> s5-0 y) (-> s4-1 best-other-tri intersect y)) - (set! gp-0 #t) ) + (vector+! s1-0 s1-0 (-> s0-0 state mesh bounds)) + ) + 0 + (set! (-> s5-0 y) (-> s3-0 y)) + (when (enemy-above-ground? self s4-1 s5-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (set! (-> s5-0 y) (-> s4-1 best-other-tri intersect y)) + (set! gp-0 #t) ) ) (set! (-> self jump-point quad) (-> s5-0 quad)) @@ -1950,9 +1938,8 @@ ) (defmethod hosehead-method-187 ((this hosehead) (arg0 vector)) - (local-vars (sv-128 vector)) - (set! sv-128 (new 'stack-no-clear 'vector)) - (let ((s3-0 (new 'stack-no-clear 'vector)) + (let ((sv-128 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) (s0-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) @@ -2030,7 +2017,7 @@ (set! (-> a1-0 y) 14336.0) (set! (-> a1-0 z) 14336.0) (set! (-> a1-0 w) 1.0) - (vector-! (the-as vector v1-0) a0-2 a1-0) + (vector-! (-> v1-0 min) a0-2 a1-0) ) (let ((v1-2 (-> s5-0 bbox max)) (a0-4 (-> this root trans)) @@ -2196,7 +2183,6 @@ (defmethod init-enemy! ((this hosehead)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (stack-size-set! (-> this main-thread) 256) (set! (-> this on-stop-sentry) #f) (initialize-skeleton @@ -2204,8 +2190,9 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-hosehead" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((a0-5 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (a0-5 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when a0-5 (let ((v1-7 (-> this root))) (+! (-> v1-7 trans x) (-> a0-5 0)) @@ -2260,8 +2247,9 @@ (idle-control-method-9 (-> this idle-anim-player) *hosehead-idle-wall*) (idle-control-method-9 (-> this idle-anim-player) *hosehead-idle-ground*) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-49 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-49 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32))) + ) (cond ((and v1-49 (nonzero? (-> sv-32 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-49)) diff --git a/goal_src/jak2/levels/sewer/sewer-obs.gc b/goal_src/jak2/levels/sewer/sewer-obs.gc index 1431a2da6e..818a563bf4 100644 --- a/goal_src/jak2/levels/sewer/sewer-obs.gc +++ b/goal_src/jak2/levels/sewer/sewer-obs.gc @@ -72,12 +72,7 @@ :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (case message (('touch 'attack) - (let* ((_proc proc) - (hit-proc (if (type? _proc process-focusable) - (the-as process-focusable _proc) - ) - ) - ) + (let ((hit-proc (as-type proc process-focusable))) (when hit-proc (let ((hit-direction (vector-! (new 'stack-no-clear 'vector) (-> hit-proc root trans) (-> self root trans))) (v1-5 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) @@ -116,11 +111,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this sew-single-blade) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (logior! (-> this mask) (process-mask ambient)) (let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) @@ -216,12 +211,7 @@ This commonly includes things such as: :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (case message (('touch 'attack) - (let* ((_proc proc) - (hit-proc (if (type? _proc process-focusable) - _proc - ) - ) - ) + (let ((hit-proc (the-as process (as-type proc process-focusable)))) (if hit-proc (send-event hit-proc @@ -299,11 +289,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this sew-tri-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (logior! (-> this mask) (process-mask ambient)) (let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) @@ -397,12 +387,7 @@ This commonly includes things such as: :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (case message (('touch 'attack) - (let* ((s5-0 proc) - (a0-2 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) + (let ((a0-2 (the-as process (as-type proc process-focusable)))) (if a0-2 (send-event a0-2 @@ -434,11 +419,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this sew-arm-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (logior! (-> this mask) (process-mask ambient)) (let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) @@ -505,12 +490,7 @@ This commonly includes things such as: :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (case message (('touch 'attack) - (let* ((_proc proc) - (hit-proc (if (type? _proc process-focusable) - (the-as process-focusable _proc) - ) - ) - ) + (let ((hit-proc (as-type proc process-focusable))) (when hit-proc (let ((hit-direction (vector-! (new 'stack-no-clear 'vector) (-> hit-proc root trans) (-> self root trans))) (v1-5 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) @@ -549,11 +529,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this sew-multi-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (logior! (-> this mask) (process-mask ambient)) (let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) @@ -622,12 +602,7 @@ This commonly includes things such as: :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (case message (('touch 'attack) - (let* ((_proc proc) - (hit-proc (if (type? _proc process-focusable) - (the-as process-focusable _proc) - ) - ) - ) + (let ((hit-proc (as-type proc process-focusable))) (when hit-proc (let ((hit-direction (vector-! (new 'stack-no-clear 'vector) (-> hit-proc root trans) (-> self root-overide trans))) (v1-5 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root-overide quat))) @@ -693,11 +668,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this sew-twist-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (logior! (-> this mask) (process-mask ambient)) (let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) @@ -792,13 +767,9 @@ This commonly includes things such as: (go-virtual pressed) ) (('touch 'attack) - (let* ((gp-0 (-> block param 0)) - (_proc proc) - (target-proc (if (type? _proc target) - _proc - ) - ) - ) + (let ((gp-0 (-> block param 0)) + (target-proc (the-as object (as-type proc target))) + ) (when (and gp-0 target-proc) (broadcast-to-actors self 'cue-chase) (go-virtual pressed) @@ -877,7 +848,7 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod broadcast-to-actors ((this sew-light-switch) (event-type symbol)) "Broadcast event to all associated [[entity]]s via the `actor-group`s -@param `event-type` the symbol to broadcast" + @param `event-type` the symbol to broadcast" (with-pp (dotimes (group-idx (-> this actor-group-count)) (let ((group (-> this actor-group group-idx))) @@ -910,12 +881,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this sew-light-switch) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" - (local-vars (tag res-tag)) + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (init-switch-collision! this) (process-drawable-from-entity! this entity) (initialize-skeleton @@ -924,8 +894,9 @@ This commonly includes things such as: (the-as pair 0) ) (process-entity-status! this (entity-perm-status no-kill) #t) - (set! tag (new 'static 'res-tag)) - (let ((data (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& tag)))) + (let* ((tag (new 'static 'res-tag)) + (data (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& tag))) + ) (cond ((and data (nonzero? (-> tag elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) data)) @@ -974,12 +945,7 @@ This commonly includes things such as: #f ) :post (behavior () - (let* ((target *target*) - (target-proc (if (type? target process-focusable) - target - ) - ) - ) + (let ((target-proc (the-as target (as-type *target* process-focusable)))) (when target-proc (get-trans target-proc 0) (let ((switch-pressed? #f) @@ -1019,8 +985,8 @@ This commonly includes things such as: (defmethod press! ((this sew-light-control) (switched-on? symbol) (should-turret-flash? symbol)) "Turns the lights on (or off) -@param switched-on? Should the sewer lights be turned on or off? -@param should-turret-flash? Should the turret have it's `flash` set as well" + @param switched-on? Should the sewer lights be turned on or off? + @param should-turret-flash? Should the turret have it's `flash` set as well" (set-sewer-lights-flag! switched-on?) (if should-turret-flash? (set-sewer-turret-flash!) @@ -1030,8 +996,8 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defbehavior sew-light-control-init-by-other sew-light-control ((switch entity-actor) (turret entity-actor)) "Creates a [[sew-light-control]] given two entities for the turret and switch itself -@param switch The entity for the switch -@param turret The entity for the turret" + @param switch The entity for the switch + @param turret The entity for the turret" (process-entity-set! self switch) (set! (-> *game-info* controller 0) (process->handle self)) (set! (-> self switch-ent) switch) @@ -1043,8 +1009,8 @@ This commonly includes things such as: (defun sewer-startup () "Basic house-keeping for starting the sewer area: -- sets up the bigmap -- spawns the first switch and turret" + - sets up the bigmap + - spawns the first switch and turret" (cond ((task-node-closed? (game-task-node sewer-board-introduction)) (set! (-> sewer bigmap-id) (bigmap-id sewer-with-board-area)) diff --git a/goal_src/jak2/levels/sewer/sewer-obs2.gc b/goal_src/jak2/levels/sewer/sewer-obs2.gc index 63d77162ec..61a6b00167 100644 --- a/goal_src/jak2/levels/sewer/sewer-obs2.gc +++ b/goal_src/jak2/levels/sewer/sewer-obs2.gc @@ -316,7 +316,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (tag-1 res-tag) (tag-2 res-tag)) (let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) (set! (-> cshape reaction) cshape-reaction-default) @@ -348,13 +347,15 @@ (set! (-> this spin) 0.0) (set! (-> this spin-rate) 0.0) (set! (-> this joint) (new 'process 'joint-mod-rotate-local this 4 #f)) - (set! tag-1 (new 'static 'res-tag)) - (set! (-> this actor-group) - (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& tag-1)) - ) - (set! (-> this actor-group-count) (the-as int (-> tag-1 elt-count))) - (set! tag-2 (new 'static 'res-tag)) - (let ((data (res-lump-data (-> this entity) 'extra-float-param pointer :tag-ptr (& tag-2)))) + (let ((tag-1 (new 'static 'res-tag))) + (set! (-> this actor-group) + (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& tag-1)) + ) + (set! (-> this actor-group-count) (the-as int (-> tag-1 elt-count))) + ) + (let* ((tag-2 (new 'static 'res-tag)) + (data (res-lump-data (-> this entity) 'extra-float-param pointer :tag-ptr (& tag-2))) + ) (if (and data (nonzero? (-> tag-2 elt-count))) (set! (-> this water-height) (-> (the-as (pointer float) data))) (set! (-> this water-height) 0.0) @@ -662,7 +663,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape-moving)) (stack-size-set! (-> this main-thread) 512) (let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) @@ -699,23 +699,18 @@ (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((_prim-mesh (method-of-type collide-shape-prim-mesh new))) - (set! sv-32 'process) - (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 cshape) - (let ((a3-2 (command-get-int (car s1-0) 0)) - (t0-1 0) + (let ((sv-16 + (new 'process 'collide-shape-prim-mesh cshape (the-as uint (command-get-int (car s1-0) 0)) (the-as uint 0)) ) - (set! sv-16 (_prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((s0-1 sv-16)) + (set! (-> s0-1 prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> s0-1 prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> s0-1 prim-core action) (-> prim-group prim-core action)) + (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) ) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) ) - (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> prim-group prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> prim-group prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> prim-group prim-core action)) - (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) - ) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) (set! s1-0 (car s2-0)) ) diff --git a/goal_src/jak2/levels/sewer/sewer-scenes.gc b/goal_src/jak2/levels/sewer/sewer-scenes.gc index d0fa48170a..df20e3eabe 100644 --- a/goal_src/jak2/levels/sewer/sewer-scenes.gc +++ b/goal_src/jak2/levels/sewer/sewer-scenes.gc @@ -1206,13 +1206,9 @@ ) (defmethod draw ((this hud-gunturret)) - (set-hud-piece-position! - (the-as hud-sprite (-> this sprites)) - (the int (+ 457.0 (* 130.0 (-> this offset)))) - 205 - ) + (set-hud-piece-position! (-> this sprites 0) (the int (+ 457.0 (* 130.0 (-> this offset)))) 205) (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current)) - (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (the-as vector4w (-> this sprites)) -20 24) + (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -20 24) ((method-of-type hud draw) this) 0 (none) @@ -1278,7 +1274,6 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (local-vars (sv-96 int) (sv-100 float) (sv-104 vector)) (set-time! (-> self start-time)) (set! (-> self hud-timer) (ppointer->handle (process-spawn hud-gunturret :init hud-init-by-other :to self))) (while (> (-> self data-int32 0) 0) @@ -1289,45 +1284,48 @@ ) (deactivate self) ) - (set! sv-96 (-> self data-int32 1)) - (set! sv-100 4095996000.0) - (set! sv-104 (target-pos 0)) - (when (-> self actor-group 0) - (dotimes (gp-2 (the-as int (-> self actor-group 0 0))) - (let ((s5-0 (-> (&+ (-> self actor-group 0) (* gp-2 8)) 3))) - (let ((f0-1 (vector-vector-distance sv-104 (-> s5-0 extra trans)))) - (if (< f0-1 sv-100) - (set! sv-100 f0-1) + (let ((sv-96 (-> self data-int32 1)) + (sv-100 4095996000.0) + ) + (let ((sv-104 (target-pos 0))) + (when (-> self actor-group 0) + (dotimes (gp-2 (the-as int (-> self actor-group 0 0))) + (let ((s5-0 (-> (&+ (-> self actor-group 0) (* gp-2 8)) 3))) + (let ((f0-1 (vector-vector-distance sv-104 (-> s5-0 extra trans)))) + (if (< f0-1 sv-100) + (set! sv-100 f0-1) + ) ) - ) - (if (and s5-0 (logtest? (-> s5-0 extra perm status) (entity-perm-status dead))) - (set! sv-96 (+ sv-96 -1)) + (if (and s5-0 (logtest? (-> s5-0 extra perm status) (entity-perm-status dead))) + (+! sv-96 -1) + ) ) + ) ) ) - ) - (when (< sv-96 (-> self data-int32 0)) - (case sv-96 - ((3) - (talker-spawn-func (-> *talker-speech* 462) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((2) - (talker-spawn-func (-> *talker-speech* 463) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((1) - (talker-spawn-func (-> *talker-speech* 464) *entity-pool* (target-pos 0) (the-as region #f)) - ) + (when (< sv-96 (-> self data-int32 0)) + (case sv-96 + ((3) + (talker-spawn-func (-> *talker-speech* 462) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((2) + (talker-spawn-func (-> *talker-speech* 463) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((1) + (talker-spawn-func (-> *talker-speech* 464) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + ) + (let ((v1-51 sv-96)) + (set! (-> self data-int32 0) v1-51) + (set! (-> *game-info* counter) (the float v1-51)) + ) + (when (and (= (-> self data-int32 1) sv-96) + (and (< sv-100 122880.0) (time-elapsed? (-> self beep-time) (seconds 40))) + ) + (talker-spawn-func (-> *talker-speech* 53) *entity-pool* (target-pos 0) (the-as region #f)) + (set-time! (-> self beep-time)) ) - ) - (let ((v1-51 sv-96)) - (set! (-> self data-int32 0) v1-51) - (set! (-> *game-info* counter) (the float v1-51)) - ) - (when (and (= (-> self data-int32 1) sv-96) - (and (< sv-100 122880.0) (time-elapsed? (-> self beep-time) (seconds 40))) - ) - (talker-spawn-func (-> *talker-speech* 53) *entity-pool* (target-pos 0) (the-as region #f)) - (set-time! (-> self beep-time)) ) (suspend) ) diff --git a/goal_src/jak2/levels/stadium/skate/skatea-obs.gc b/goal_src/jak2/levels/stadium/skate/skatea-obs.gc index b639293024..c4107bc0f3 100644 --- a/goal_src/jak2/levels/stadium/skate/skatea-obs.gc +++ b/goal_src/jak2/levels/stadium/skate/skatea-obs.gc @@ -1057,7 +1057,8 @@ ) ) ) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (send-event (handle->process gp-3) 'die) ) ) @@ -1261,7 +1262,8 @@ ) ) ) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (send-event (handle->process gp-2) 'die) ) ) @@ -1294,9 +1296,9 @@ - sounds" ;; og:preserve-this added (stack-size-set! (-> this main-thread) 1024) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) diff --git a/goal_src/jak2/levels/stadium/stadium-obs.gc b/goal_src/jak2/levels/stadium/stadium-obs.gc index f44a9dce1d..d184af7f4f 100644 --- a/goal_src/jak2/levels/stadium/stadium-obs.gc +++ b/goal_src/jak2/levels/stadium/stadium-obs.gc @@ -179,7 +179,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 8) 0))) (set! (-> s4-0 total-prims) (the-as uint 9)) @@ -194,23 +193,18 @@ (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((s0-0 (method-of-type collide-shape-prim-mesh new))) - (set! sv-32 'process) - (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 s4-0) - (let ((a3-2 (command-get-int (car s1-0) 0)) - (t0-1 0) + (let ((sv-16 + (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint (command-get-int (car s1-0) 0)) (the-as uint 0)) ) - (set! sv-16 (s0-0 sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((s0-1 sv-16)) + (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) + (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) + (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) + (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) ) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) ) - (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) - (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) - ) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) (set! s1-0 (car s2-0)) ) @@ -392,7 +386,6 @@ ) (defbehavior rift-rider-travel-post rift-rider () - (local-vars (sv-736 rift-rider) (sv-752 rift-rider) (sv-768 vector)) (if (not (-> self escort-actor 0)) (set! (-> self escort-actor 0) (entity-actor-lookup (-> self entity) 'alt-actor 0)) ) @@ -436,15 +429,16 @@ (target-pos 0) (let ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> gp-0 quat))) (f30-0 0.0) - (s3-0 (lambda ((arg0 rift-rider) (arg1 vector) (arg2 vector) (arg3 vector)) - (let ((f0-1 (vector-dot (vector-! (new 'stack-no-clear 'vector) arg2 arg1) arg3))) - (if (< f0-1 0.0) - (- f0-1) - 0.0 - ) + (s3-0 + (lambda ((arg0 rift-rider) (arg1 vector) (arg2 vector) (arg3 vector)) + (let ((f0-1 (vector-dot (vector-! (new 'stack-no-clear 'vector) arg2 arg1) arg3))) + (if (< f0-1 0.0) + (- f0-1) + 0.0 ) - ) ) + ) + ) ) (let ((s0-0 (new 'stack-no-clear 'vector)) (v1-13 0) @@ -466,48 +460,40 @@ ) ) (when s1-0 - (let ((s0-1 s3-0)) - (set! sv-736 self) - (let ((a1-11 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-11 from) (process->ppointer self)) - (set! (-> a1-11 num-params) 2) - (set! (-> a1-11 message) 'get-position) - (set! (-> a1-11 param 0) (the-as uint 'left)) - (set! (-> a1-11 param 1) (the-as uint (new 'stack-no-clear 'vector))) - (let ((a1-12 (send-event-function self a1-11)) - (a3-0 s4-0) - ) - (+! f30-0 (s0-1 sv-736 (the-as vector a1-12) (the-as vector s1-0) a3-0)) + (let ((s0-1 s3-0) + (sv-736 self) + ) + (+! f30-0 + (s0-1 + sv-736 + (the-as vector (send-event self 'get-position 'left (new 'stack-no-clear 'vector))) + (the-as vector s1-0) + s4-0 + ) ) - ) ) ) (when s2-0 (let ((s1-1 s3-0) (s0-2 self) ) - (+! f30-0 (s1-1 - s0-2 - (the-as vector (send-event self 'get-position 'right (new 'stack-no-clear 'vector))) - (the-as vector s2-0) - s4-0 - ) + (+! f30-0 + (s1-1 + s0-2 + (the-as vector (send-event self 'get-position 'right (new 'stack-no-clear 'vector))) + (the-as vector s2-0) + s4-0 + ) ) ) ) (seek! (-> self speed) (fmin 12288.0 (+ 2048.0 (vector-length s5-0))) (* 4096.0 (seconds-per-frame))) (set! (-> self speed) (* (-> self speed) (lerp-scale 1.0 0.0 f30-0 24576.0 49152.0))) - (let ((f30-1 (-> self speed)) - (s2-1 lerp-scale) - (s1-2 1.0) - (s0-3 0.0) + (set! (-> self speed) + (* (-> self speed) + (lerp-scale 1.0 0.0 (s3-0 self (-> self root trans) (target-pos 0) s4-0) 143360.0 245760.0) + ) ) - (set! sv-752 self) - (set! sv-768 (-> self root trans)) - (let ((a2-11 (target-pos 0))) - (set! (-> self speed) (* f30-1 (s2-1 s1-2 s0-3 (s3-0 sv-752 sv-768 a2-11 s4-0) 143360.0 245760.0))) - ) - ) ) ) ) @@ -2246,14 +2232,6 @@ (defmethod stad-force-field-method-29 ((this stad-force-field) (arg0 touching-shapes-entry)) - (local-vars - (sv-256 entity-actor) - (sv-272 collide-tri-result) - (sv-288 (function vector vector vector vector)) - (sv-304 vector) - (sv-320 vector) - (sv-336 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -2269,36 +2247,18 @@ (if (handle->process (-> this ripple)) (deactivate (-> this ripple process 0)) ) - (let* ((s3-0 (get-process *default-dead-pool* manipy #x4000)) - (s4-0 (when s3-0 - (let ((t9-3 (method-of-type manipy activate))) - (t9-3 (the-as manipy s3-0) this (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s4-1 run-function-in-process) - (s2-0 s3-0) - (s1-0 manipy-init) - (s0-0 (-> this root trans)) - ) - (set! sv-256 (-> this entity)) - (let ((t0-0 (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f))) - (t1-0 #f) - (t2-0 0) - ) - ((the-as (function object object object object object object object none) s4-1) - s2-0 - s1-0 - s0-0 - sv-256 - t0-0 - t1-0 - t2-0 - ) - ) - ) - (-> s3-0 ppointer) - ) - ) - ) + (let ((s4-0 (process-spawn + manipy + :init manipy-init + (-> this root trans) + (-> this entity) + (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f)) + #f + 0 + :to this + ) + ) + ) 0.0 0.0 0.0 @@ -2312,94 +2272,94 @@ (let ((s2-1 (-> arg0 head))) (while s2-1 (get-touched-prim s2-1 (-> this root) arg0) - (set! sv-272 (get-touched-tri s2-1 (-> this root) arg0)) - (when sv-272 - (quaternion-look-at! (-> (the-as process-drawable (-> s4-0 0)) root quat) (-> sv-272 normal) *up-vector*) - (set! (-> this plane quad) (-> sv-272 normal quad)) - (set! (-> this plane w) (- (vector-dot (-> sv-272 normal) (-> sv-272 vertex 0)))) - (let ((f30-0 (the-as float #x7f800000)) - (f28-0 (the-as float #xff800000)) - (s0-1 (new 'stack-no-clear 'vector)) - (s1-1 (new 'stack-no-clear 'vector)) - ) - (set! sv-336 (new 'stack-no-clear 'vector)) - (set! (-> s1-1 quad) (-> sv-272 vertex 0 quad)) - (vector+! s1-1 s1-1 (-> sv-272 vertex 1)) - (vector+! s1-1 s1-1 (-> sv-272 vertex 2)) - (vector-float*! s1-1 s1-1 0.33333334) - (set! sv-288 vector-flatten!) - (set! sv-304 sv-336) - (set! sv-320 (new 'stack-no-clear 'vector)) - (let ((v0-14 (target-pos 0)) - (v1-75 s1-1) + (let ((sv-272 (get-touched-tri s2-1 (-> this root) arg0))) + (when sv-272 + (quaternion-look-at! (-> (the-as process-drawable (-> s4-0 0)) root quat) (-> sv-272 normal) *up-vector*) + (set! (-> this plane quad) (-> sv-272 normal quad)) + (set! (-> this plane w) (- (vector-dot (-> sv-272 normal) (-> sv-272 vertex 0)))) + (let ((f30-0 (the-as float #x7f800000)) + (f28-0 (the-as float #xff800000)) + (s0-1 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack-no-clear 'vector)) ) - (.lvf vf4 (&-> v0-14 quad)) - (.lvf vf5 (&-> v1-75 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-320 quad) vf6) - (let ((a2-9 (-> sv-272 normal))) - (sv-288 sv-304 sv-320 a2-9) - ) - (vector+! sv-336 s1-1 sv-336) - (vector-inv-orient-by-quat! - s0-1 - (vector-! (new 'stack-no-clear 'vector) (-> sv-272 vertex 0) s1-1) - (-> (the-as process-drawable (-> s4-0 0)) root quat) - ) - (if (< (-> s0-1 x) f30-0) - (set! f30-0 (-> s0-1 x)) - ) - (if (< f28-0 (-> s0-1 x)) - (set! f28-0 (-> s0-1 x)) - ) - (vector-inv-orient-by-quat! - s0-1 - (vector-! (new 'stack-no-clear 'vector) (-> sv-272 vertex 1) s1-1) - (-> (the-as process-drawable (-> s4-0 0)) root quat) - ) - (if (< (-> s0-1 x) f30-0) - (set! f30-0 (-> s0-1 x)) - ) - (if (< f28-0 (-> s0-1 x)) - (set! f28-0 (-> s0-1 x)) - ) - (vector-inv-orient-by-quat! - s0-1 - (vector-! (new 'stack-no-clear 'vector) (-> sv-272 vertex 2) s1-1) - (-> (the-as process-drawable (-> s4-0 0)) root quat) - ) - (if (< (-> s0-1 x) f30-0) - (set! f30-0 (-> s0-1 x)) - ) - (if (< f28-0 (-> s0-1 x)) - (set! f28-0 (-> s0-1 x)) - ) - (let ((t9-17 vector-inv-orient-by-quat!) - (a0-49 s0-1) - (a1-27 (new 'stack-no-clear 'vector)) - (v1-103 s1-1) + (let ((sv-336 (new 'stack-no-clear 'vector))) + (set! (-> s1-1 quad) (-> sv-272 vertex 0 quad)) + (vector+! s1-1 s1-1 (-> sv-272 vertex 1)) + (vector+! s1-1 s1-1 (-> sv-272 vertex 2)) + (vector-float*! s1-1 s1-1 0.33333334) + (let ((sv-288 vector-flatten!) + (sv-304 sv-336) + (sv-320 (new 'stack-no-clear 'vector)) + ) + (let ((v0-14 (target-pos 0)) + (v1-75 s1-1) + ) + (.lvf vf4 (&-> v0-14 quad)) + (.lvf vf5 (&-> v1-75 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-320 quad) vf6) + (sv-288 sv-304 sv-320 (-> sv-272 normal)) ) - (t9-17 a0-49 (vector-! a1-27 sv-336 v1-103) (-> (the-as process-drawable (-> s4-0 0)) root quat)) + (vector+! sv-336 s1-1 sv-336) + (vector-inv-orient-by-quat! + s0-1 + (vector-! (new 'stack-no-clear 'vector) (-> sv-272 vertex 0) s1-1) + (-> (the-as process-drawable (-> s4-0 0)) root quat) + ) + (if (< (-> s0-1 x) f30-0) + (set! f30-0 (-> s0-1 x)) + ) + (if (< f28-0 (-> s0-1 x)) + (set! f28-0 (-> s0-1 x)) + ) + (vector-inv-orient-by-quat! + s0-1 + (vector-! (new 'stack-no-clear 'vector) (-> sv-272 vertex 1) s1-1) + (-> (the-as process-drawable (-> s4-0 0)) root quat) + ) + (if (< (-> s0-1 x) f30-0) + (set! f30-0 (-> s0-1 x)) + ) + (if (< f28-0 (-> s0-1 x)) + (set! f28-0 (-> s0-1 x)) + ) + (vector-inv-orient-by-quat! + s0-1 + (vector-! (new 'stack-no-clear 'vector) (-> sv-272 vertex 2) s1-1) + (-> (the-as process-drawable (-> s4-0 0)) root quat) + ) + (if (< (-> s0-1 x) f30-0) + (set! f30-0 (-> s0-1 x)) + ) + (if (< f28-0 (-> s0-1 x)) + (set! f28-0 (-> s0-1 x)) + ) + (vector-inv-orient-by-quat! + s0-1 + (vector-! (new 'stack-no-clear 'vector) sv-336 s1-1) + (-> (the-as process-drawable (-> s4-0 0)) root quat) + ) + ) + (let* ((f0-17 (-> s0-1 x)) + (f28-1 (fmin f28-0 (+ 16384.0 f0-17))) + (f30-1 (fmax f30-0 (+ -16384.0 f0-17))) + ) + (set! (-> s0-1 x) (* 0.5 (+ f30-1 f28-1))) + (vector-orient-by-quat! s0-1 s0-1 (-> (the-as process-drawable (-> s4-0 0)) root quat)) + (vector+! s1-1 s1-1 s0-1) + (set! (-> (the-as process-drawable (-> s4-0 0)) root trans quad) (-> s1-1 quad)) + (set! (-> (the-as process-drawable (-> s4-0 0)) root trans y) (-> (target-pos 0) y)) + (set-vector! s3-1 (* 0.000061035156 (- f28-1 f30-1)) 4.0 4.0 1.0) + ) ) - (let* ((f0-17 (-> s0-1 x)) - (f28-1 (fmin f28-0 (+ 16384.0 f0-17))) - (f30-1 (fmax f30-0 (+ -16384.0 f0-17))) - ) - (set! (-> s0-1 x) (* 0.5 (+ f30-1 f28-1))) - (vector-orient-by-quat! s0-1 s0-1 (-> (the-as process-drawable (-> s4-0 0)) root quat)) - (vector+! s1-1 s1-1 s0-1) - (set! (-> (the-as process-drawable (-> s4-0 0)) root trans quad) (-> s1-1 quad)) - (set! (-> (the-as process-drawable (-> s4-0 0)) root trans y) (-> (target-pos 0) y)) - (set-vector! s3-1 (* 0.000061035156 (- f28-1 f30-1)) 4.0 4.0 1.0) + (quaternion-rotate-local-x! + (-> (the-as process-drawable (-> s4-0 0)) root quat) + (-> (the-as process-drawable (-> s4-0 0)) root quat) + -16384.0 ) ) - (quaternion-rotate-local-x! - (-> (the-as process-drawable (-> s4-0 0)) root quat) - (-> (the-as process-drawable (-> s4-0 0)) root quat) - -16384.0 - ) ) (set! s2-1 (-> s2-1 next)) ) diff --git a/goal_src/jak2/levels/strip/chaincrate.gc b/goal_src/jak2/levels/strip/chaincrate.gc index 6f5d924322..394fb27b6a 100644 --- a/goal_src/jak2/levels/strip/chaincrate.gc +++ b/goal_src/jak2/levels/strip/chaincrate.gc @@ -322,7 +322,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 int)) (set! (-> this root) (new 'process 'trsqv)) (set! (-> this path) (new 'process 'curve-control this 'path -1000000000.0)) (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) @@ -330,8 +329,9 @@ (f26-0 131072.0) (f30-0 0.0) ) - (set! sv-16 0) - (let ((v1-8 (res-lump-data arg0 'speed (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-16))))) + (let* ((sv-16 0) + (v1-8 (res-lump-data arg0 'speed (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-16)))) + ) (when v1-8 (set! f28-0 (-> v1-8 0)) (set! f26-0 (-> v1-8 1)) diff --git a/goal_src/jak2/levels/strip/strip-obs.gc b/goal_src/jak2/levels/strip/strip-obs.gc index 9347a2051a..dac3d728f9 100644 --- a/goal_src/jak2/levels/strip/strip-obs.gc +++ b/goal_src/jak2/levels/strip/strip-obs.gc @@ -144,7 +144,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-64 res-tag)) (set-vector! (-> this shove-vec) 0.0 12288.0 24576.0 1.0) (set! (-> this no-collision-timer) (the-as uint 0)) (let* ((v1-1 *game-info*) @@ -157,8 +156,9 @@ (s3-0 1200) (f30-0 0.0) ) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data arg0 'sync (pointer float) :tag-ptr (& sv-64)))) + (let* ((sv-64 (new 'static 'res-tag)) + (v1-3 (res-lump-data arg0 'sync (pointer float) :tag-ptr (& sv-64))) + ) (when v1-3 (set! s3-0 (the int (* 300.0 (-> v1-3 0)))) (set! f30-0 (-> v1-3 1)) @@ -225,7 +225,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 string)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s4-0 reaction) cshape-reaction-default) @@ -270,8 +269,9 @@ (t9-9 this arg0) ) (quaternion-copy! (-> this start-quat) (-> this root quat)) - (set! sv-16 "#f") - (let ((a0-24 (entity-lookup-part-group arg0 (& sv-16) 'art-name))) + (let* ((sv-16 "#f") + (a0-24 (entity-lookup-part-group arg0 (& sv-16) 'art-name)) + ) (when a0-24 (let ((a0-25 (-> a0-24 0))) (if (and (nonzero? a0-25) (= (-> a0-25 type) sparticle-launch-group)) @@ -1333,7 +1333,6 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (local-vars (sv-16 object)) (set-time! (-> self start-time)) (set! (-> self total-time) (seconds 120)) (set! (-> self hud-timer) (ppointer->handle (process-spawn hud-timer :init hud-init-by-other :to *target*))) @@ -1347,73 +1346,74 @@ ) (set! (-> *game-info* timer) (the-as time-frame v1-18)) ) - (set! sv-16 (-> self actor-group 0 0)) - (when (-> self actor-group 0) - (dotimes (v1-23 (the-as int (-> self actor-group 0 0))) - (let ((a1-8 (-> (&+ (-> self actor-group 0) (* v1-23 8)) 3))) - (if (and a1-8 (logtest? (-> a1-8 extra perm status) (entity-perm-status subtask-complete))) - (set! sv-16 (&+ (the-as (pointer entity-actor) sv-16) -1)) + (let ((sv-16 (the-as (pointer entity-actor) (-> self actor-group 0 0)))) + (when (-> self actor-group 0) + (dotimes (v1-23 (the-as int (-> self actor-group 0 0))) + (let ((a1-8 (-> (&+ (-> self actor-group 0) (* v1-23 8)) 3))) + (if (and a1-8 (logtest? (-> a1-8 extra perm status) (entity-perm-status subtask-complete))) + (&+! sv-16 -1) + ) + ) + ) + ) + (when (!= sv-16 (-> self count)) + (case sv-16 + ((5) + (talker-spawn-func (-> *talker-speech* 198) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((4) + (talker-spawn-func (-> *talker-speech* 199) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((3) + (talker-spawn-func (-> *talker-speech* 200) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((2) + (talker-spawn-func (-> *talker-speech* 201) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((1) + (talker-spawn-func (-> *talker-speech* 202) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + (set! (-> self count) (the-as int sv-16)) + ) + (cond + ((and (>= (current-time) (+ #x80e8 (-> self start-time))) + (< (-> self state-time) (+ #x80e8 (-> self start-time))) ) + (talker-spawn-func (-> *talker-speech* 197) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((and (>= (current-time) (+ (-> self start-time) (seconds 90))) + (< (-> self state-time) (+ (-> self start-time) (seconds 90))) + ) + (talker-spawn-func (-> *talker-speech* 196) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((and (>= (current-time) (+ (-> self start-time) (seconds 60))) + (< (-> self state-time) (+ (-> self start-time) (seconds 60))) + ) + (talker-spawn-func (-> *talker-speech* 195) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + (set-time! (-> self state-time)) + (set! (-> *game-info* counter) (the float (the-as int sv-16))) + (if (>= 1 (the-as int sv-16)) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + "ecowells-victory" + 0 + -1.0 + (new 'static 'sound-id) + ) ) - ) - ) - (when (!= sv-16 (-> self count)) - (case sv-16 - ((5) - (talker-spawn-func (-> *talker-speech* 198) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((4) - (talker-spawn-func (-> *talker-speech* 199) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((3) - (talker-spawn-func (-> *talker-speech* 200) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((2) - (talker-spawn-func (-> *talker-speech* 201) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((1) - (talker-spawn-func (-> *talker-speech* 202) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) - (set! (-> self count) (the-as int sv-16)) - ) - (cond - ((and (>= (current-time) (+ #x80e8 (-> self start-time))) - (< (-> self state-time) (+ #x80e8 (-> self start-time))) - ) - (talker-spawn-func (-> *talker-speech* 197) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((and (>= (current-time) (+ (-> self start-time) (seconds 90))) - (< (-> self state-time) (+ (-> self start-time) (seconds 90))) - ) - (talker-spawn-func (-> *talker-speech* 196) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((and (>= (current-time) (+ (-> self start-time) (seconds 60))) - (< (-> self state-time) (+ (-> self start-time) (seconds 60))) - ) - (talker-spawn-func (-> *talker-speech* 195) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) - (set-time! (-> self state-time)) - (set! (-> *game-info* counter) (the float (the-as int sv-16))) - (if (>= 1 (the-as int sv-16)) - (gui-control-method-12 - *gui-control* - self - (gui-channel art-load) - (gui-action queue) - "ecowells-victory" - 0 - -1.0 - (new 'static 'sound-id) + (if (not *target*) + (go-virtual fail) ) - ) - (if (not *target*) - (go-virtual fail) - ) - (if (zero? sv-16) - (go-virtual complete) - ) + (if (zero? sv-16) + (go-virtual complete) + ) + ) (suspend) ) (the-as entity-actor (go-virtual fail)) diff --git a/goal_src/jak2/levels/title/title-obs.gc b/goal_src/jak2/levels/title/title-obs.gc index 2dab189256..8aea4ec291 100644 --- a/goal_src/jak2/levels/title/title-obs.gc +++ b/goal_src/jak2/levels/title/title-obs.gc @@ -70,50 +70,50 @@ ;; WARN: Return type mismatch time-frame vs none. (defun title-plug-lightning ((arg0 process-drawable) (arg1 vector) (arg2 cspace)) - (local-vars (sv-32 cspace) (sv-48 int) (sv-64 symbol) (sv-80 int) (sv-96 vector)) - (set! sv-32 arg2) - (when (< (-> *setting-control* user-current movie-skip-frame) 0.0) - (let ((s5-0 (get-process *default-dead-pool* lightning-tracker #x4000))) - (when s5-0 - (let ((t9-1 (method-of-type lightning-tracker activate))) - (t9-1 - (the-as lightning-tracker s5-0) - *entity-pool* - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s3-0 run-function-in-process) - (s2-0 s5-0) - (s1-0 lightning-tracker-init) - (s0-0 (-> *lightning-spec-id-table* 1)) + (let ((sv-32 arg2)) + (when (< (-> *setting-control* user-current movie-skip-frame) 0.0) + (let ((s5-0 (get-process *default-dead-pool* lightning-tracker #x4000))) + (when s5-0 + (let ((t9-1 (method-of-type lightning-tracker activate))) + (t9-1 + (the-as lightning-tracker s5-0) + *entity-pool* + (symbol->string (-> lightning-tracker symbol)) + (the-as pointer #x70004000) ) - (set! sv-48 30) - (set! sv-64 (the-as symbol #f)) - (set! sv-80 (+ (-> sv-32 joint number) 1)) - (set! sv-96 (new 'stack-no-clear 'vector)) - (set! (-> sv-96 x) (+ (-> arg1 x) (rand-vu-float-range -4096.0 4096.0))) - (set! (-> sv-96 y) (+ (-> arg1 y) (rand-vu-float-range -4096.0 4096.0))) - (set! (-> sv-96 z) (+ (-> arg1 z) (rand-vu-float-range -4096.0 4096.0))) - (set! (-> sv-96 w) 1.0) - ((the-as (function object object object object object object object object none) s3-0) - s2-0 - s1-0 - s0-0 - sv-48 - sv-64 - arg0 - sv-80 - sv-96 - ) + ) + (let ((s3-0 run-function-in-process) + (s2-0 s5-0) + (s1-0 lightning-tracker-init) + (s0-0 (-> *lightning-spec-id-table* 1)) + (sv-48 30) + (sv-64 (the-as symbol #f)) + (sv-80 (+ (-> sv-32 joint number) 1)) + (sv-96 (new 'stack-no-clear 'vector)) + ) + (set! (-> sv-96 x) (+ (-> arg1 x) (rand-vu-float-range -4096.0 4096.0))) + (set! (-> sv-96 y) (+ (-> arg1 y) (rand-vu-float-range -4096.0 4096.0))) + (set! (-> sv-96 z) (+ (-> arg1 z) (rand-vu-float-range -4096.0 4096.0))) + (set! (-> sv-96 w) 1.0) + ((the-as (function object object object object object object object object none) s3-0) + s2-0 + s1-0 + s0-0 + sv-48 + sv-64 + arg0 + sv-80 + sv-96 + ) + ) + (-> s5-0 ppointer) ) - (-> s5-0 ppointer) ) - ) - (let ((v1-21 (handle->process (-> *game-info* controller 0)))) - (if v1-21 - (set! (-> (the-as title-control v1-21) spark-time) (-> *display* base-clock frame-counter)) - ) + (let ((v1-21 (handle->process (-> *game-info* controller 0)))) + (if v1-21 + (set! (-> (the-as title-control v1-21) spark-time) (-> *display* base-clock frame-counter)) + ) + ) ) ) (none) @@ -496,7 +496,6 @@ ;; WARN: Return type mismatch int vs object. ;; WARN: new jak 2 until loop case, check carefully (defbehavior title-menu title-control () - (local-vars (sv-112 font-context)) (sound-play "dmenu-hit") (let ((gp-1 (new 'static 'boxed-array :type uint32 #x132))) (until #f @@ -520,30 +519,28 @@ ) ) (when (< (mod (current-time) 300) 210) - (set! sv-112 - (new 'stack 'font-context *font-default-matrix* 64 312 0.0 (font-color default) (font-flags shadow kerning)) + (let ((sv-112 + (new 'stack 'font-context *font-default-matrix* 64 312 0.0 (font-color default) (font-flags shadow kerning)) + ) ) - (let ((v1-35 sv-112)) - (set! (-> v1-35 width) (the float 384)) - ) - (let ((v1-36 sv-112)) - (set! (-> v1-36 height) (the float 50)) - ) - (set! (-> sv-112 flags) (font-flags shadow kerning middle middle-vert large)) - (set! (-> sv-112 scale) 0.7) - (dotimes (s5-4 (-> gp-1 length)) - (if (= (-> self selected) s5-4) - (set! (-> sv-112 color) (font-color progress-old-selected)) - (set! (-> sv-112 color) (font-color white)) + (set-width! sv-112 384) + (set-height! sv-112 50) + (set! (-> sv-112 flags) (font-flags shadow kerning middle middle-vert large)) + (set! (-> sv-112 scale) 0.7) + (dotimes (s5-4 (-> gp-1 length)) + (if (= (-> self selected) s5-4) + (set! (-> sv-112 color) (font-color progress-old-selected)) + (set! (-> sv-112 color) (font-color white)) + ) + (print-game-text + (lookup-text! *common-text* (the-as text-id (-> gp-1 s5-4)) #f) + sv-112 + #f + 44 + (bucket-id progress) ) - (print-game-text - (lookup-text! *common-text* (the-as text-id (-> gp-1 s5-4)) #f) - sv-112 - #f - 44 - (bucket-id progress) + (+! (-> sv-112 origin y) 22.0) ) - (+! (-> sv-112 origin y) 22.0) ) ) ) diff --git a/goal_src/jak2/levels/tomb/tomb-obs.gc b/goal_src/jak2/levels/tomb/tomb-obs.gc index 96e1a52b93..11b869544d 100644 --- a/goal_src/jak2/levels/tomb/tomb-obs.gc +++ b/goal_src/jak2/levels/tomb/tomb-obs.gc @@ -245,7 +245,6 @@ ;; WARN: Return type mismatch object vs none. (defbehavior tomb-stair-block-spikes-init-by-other tomb-stair-block-spikes ((arg0 vector)) - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 type) (sv-48 collide-shape)) (let ((s5-0 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 1) 0))) (set! (-> s5-0 total-prims) (the-as uint 2)) @@ -260,29 +259,29 @@ (s2-0 (-> (the-as pair s3-0) car)) ) (while (not (null? s3-0)) - (let ((s1-0 (method-of-type collide-shape-prim-mesh new)) - (s0-0 'process) - ) - (set! sv-32 collide-shape-prim-mesh) - (set! sv-48 s5-0) - (let ((a3-2 (command-get-int (-> (the-as pair s2-0) car) 0)) - (t0-1 0) + (let ((sv-16 + (new + 'process + 'collide-shape-prim-mesh + s5-0 + (the-as uint (command-get-int (-> (the-as pair s2-0) car) 0)) + (the-as uint 0) + ) ) - (set! sv-16 (s1-0 s0-0 sv-32 sv-48 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((s1-1 sv-16)) + (set! (-> s1-1 prim-core collide-as) (-> s4-0 prim-core collide-as)) + (set! (-> s1-1 prim-core collide-with) (-> s4-0 prim-core collide-with)) + (set! (-> s1-1 prim-core action) (-> s4-0 prim-core action)) + (set! (-> s1-1 transform-index) (command-get-int (-> (the-as pair (-> (the-as pair s2-0) cdr)) car) 0)) + ) + (set-vector! + (-> sv-16 local-sphere) + 0.0 + 0.0 + 0.0 + (command-get-float (-> (the-as pair (-> (the-as pair (-> (the-as pair s2-0) cdr)) cdr)) car) 0.0) ) - ) - (let ((s1-1 sv-16)) - (set! (-> s1-1 prim-core collide-as) (-> s4-0 prim-core collide-as)) - (set! (-> s1-1 prim-core collide-with) (-> s4-0 prim-core collide-with)) - (set! (-> s1-1 prim-core action) (-> s4-0 prim-core action)) - (set! (-> s1-1 transform-index) (command-get-int (-> (the-as pair (-> (the-as pair s2-0) cdr)) car) 0)) - ) - (set-vector! - (-> sv-16 local-sphere) - 0.0 - 0.0 - 0.0 - (command-get-float (-> (the-as pair (-> (the-as pair (-> (the-as pair s2-0) cdr)) cdr)) car) 0.0) ) (set! s3-0 (-> (the-as pair s3-0) cdr)) (set! s2-0 (-> (the-as pair s3-0) car)) @@ -345,9 +344,9 @@ ) (defbehavior lift-pool tomb-stair-block ((arg0 int)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-1 (< (the-as uint arg0) (-> sv-16 elt-count)) (-> v1-1 arg0) (> (-> v1-1 0 length) 0)) (let ((a1-2 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-2 from) (process->ppointer self)) @@ -370,9 +369,9 @@ ) (defbehavior drop-pool tomb-stair-block ((arg0 int)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-1 (< (the-as uint arg0) (-> sv-16 elt-count)) (-> v1-1 arg0) (> (-> v1-1 0 length) 0)) (let ((a0-12 (new 'stack-no-clear 'vector))) (set! (-> a0-12 quad) (-> v1-1 arg0 data 0 actor trans quad)) @@ -651,14 +650,14 @@ ) ) :enter (behavior () - (local-vars (sv-16 res-tag)) (ja-channel-push! 1 (seconds 2)) (ja :group! tomb-stair-block-straight-ja :num! min) (set! (-> self rise-sound) (add-process *gui-control* self (gui-channel jak) (gui-action queue) "tombplta" -99.0 0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((gp-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (gp-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and gp-1 (< (the-as uint 2) (-> sv-16 elt-count)) (-> gp-1 2)) (dotimes (s5-0 (-> gp-1 2 length)) (let ((a1-4 (new 'stack-no-clear 'event-message-block))) @@ -696,10 +695,10 @@ (defstate wait-for-pools (tomb-stair-block) :virtual #t :trans (behavior () - (local-vars (sv-16 res-tag)) (let ((gp-0 #t)) - (set! sv-16 (new 'static 'res-tag)) - (let ((s5-0 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-0 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when s5-0 (dotimes (s4-0 (min 2 (the-as int (-> sv-16 elt-count)))) (dotimes (s3-0 (-> s5-0 s4-0 length)) @@ -1088,11 +1087,11 @@ ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this tomb-boss-door) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" ;; og:preserve-this added (stack-size-set! (-> this main-thread) 1024) (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) @@ -1185,11 +1184,11 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this tomb-wing-door) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" ;; og:preserve-this added (stack-size-set! (-> this main-thread) 1024) (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) @@ -1721,7 +1720,6 @@ This commonly includes things such as: (set-time! (-> self state-time)) ) :code (behavior () - (local-vars (sv-96 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1745,8 +1743,8 @@ This commonly includes things such as: (until #f (let ((s3-0 tomb-sphinx-draw-beam) (s2-0 s5-1) + (sv-96 s4-0) ) - (set! sv-96 s4-0) (let ((s1-0 s5-1)) (let ((s0-1 (vector-! (new 'stack-no-clear 'vector) gp-2 s5-1))) (let ((v1-13 (lerp-scale 0.0 1.0 (the float (- (current-time) (-> self state-time))) 0.0 300.0))) @@ -1783,7 +1781,6 @@ This commonly includes things such as: (set-time! (-> self state-time)) ) :code (behavior () - (local-vars (sv-96 vector) (sv-112 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1823,23 +1820,24 @@ This commonly includes things such as: (until #f (let ((s2-0 tomb-sphinx-draw-beam) (s1-0 s5-0) + (sv-112 s3-0) ) - (set! sv-112 s3-0) (let ((s0-0 gp-1)) - (set! sv-96 (new 'stack-no-clear 'vector)) - (let ((v1-10 gp-1) - (a0-3 s4-0) - ) - (.lvf vf4 (&-> v1-10 quad)) - (.lvf vf5 (&-> a0-3 quad)) + (let ((sv-96 (new 'stack-no-clear 'vector))) + (let ((v1-10 gp-1) + (a0-3 s4-0) + ) + (.lvf vf4 (&-> v1-10 quad)) + (.lvf vf5 (&-> a0-3 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-96 quad) vf6) + (let ((v1-15 (lerp-scale 0.0 1.0 (the float (- (current-time) (-> self state-time))) 0.0 930.0))) + (.mov vf7 v1-15) + ) + (.lvf vf5 (&-> sv-96 quad)) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-96 quad) vf6) - (let ((v1-15 (lerp-scale 0.0 1.0 (the float (- (current-time) (-> self state-time))) 0.0 930.0))) - (.mov vf7 v1-15) - ) - (.lvf vf5 (&-> sv-96 quad)) (.lvf vf4 (&-> s0-0 quad)) ) (.add.x.vf.w vf6 vf0 vf0) diff --git a/goal_src/jak2/levels/tomb/tomb-water.gc b/goal_src/jak2/levels/tomb/tomb-water.gc index 6b40af5525..eb0f168528 100644 --- a/goal_src/jak2/levels/tomb/tomb-water.gc +++ b/goal_src/jak2/levels/tomb/tomb-water.gc @@ -309,7 +309,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) (set! (-> s4-0 total-prims) (the-as uint 3)) @@ -355,8 +354,9 @@ ) (set! (-> this offset-index) 0) (set! (-> this key-index) 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-33 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-33 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-33 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-33)) @@ -855,14 +855,6 @@ :virtual #t :event tomb-plat-simon-handler :enter (behavior () - (local-vars - (sv-96 target) - (sv-128 vector) - (sv-136 int) - (sv-144 int) - (sv-160 int) - (sv-176 (function vector vector float)) - ) (set-time! (-> self state-time)) (set! (-> self plat-idx) 0) (dotimes (gp-0 (-> self plat-count)) @@ -870,62 +862,46 @@ (send-event (handle->process (-> self plat gp-0)) 'die-unmaskable) ) ) - (set! sv-96 (the-as target (as-type *target* process-focusable))) - (dotimes (gp-2 (-> self plat-count)) - (set! sv-128 (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (the float gp-2) 'exact)) - (set! sv-136 -1) - (dotimes (v1-20 (+ (-> self plat-seq-count) -1)) - (if (= gp-2 (-> self plat-seq v1-20)) - (set! sv-136 (the-as int (-> self plat-seq (+ v1-20 1)))) + (let ((sv-96 (the-as target (as-type *target* process-focusable)))) + (dotimes (gp-2 (-> self plat-count)) + (let ((sv-128 (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (the float gp-2) 'exact)) + (sv-136 -1) + ) + (dotimes (v1-20 (+ (-> self plat-seq-count) -1)) + (if (= gp-2 (-> self plat-seq v1-20)) + (set! sv-136 (the-as int (-> self plat-seq (+ v1-20 1)))) + ) ) - ) - (let ((v1-26 (the int (* 0.000061035156 (+ 40960000.0 (-> sv-128 x))))) - (a0-21 (the int (* 0.000061035156 (+ 40960000.0 (-> sv-128 z))))) - ) - (set! sv-144 (logand (logior (logand v1-26 1) (* a0-21 2)) 3)) - ) - (let* ((s5-0 (get-process *default-dead-pool* tomb-simon-block #x4000)) - (s4-0 (when s5-0 - (let ((t9-4 (method-of-type tomb-simon-block activate))) - (t9-4 - (the-as tomb-simon-block s5-0) - self - (symbol->string (-> tomb-simon-block symbol)) - (the-as pointer #x70004000) + (let* ((v1-26 (the int (* 0.000061035156 (+ 40960000.0 (-> sv-128 x))))) + (a0-21 (the int (* 0.000061035156 (+ 40960000.0 (-> sv-128 z))))) + (sv-144 (logand (logior (logand v1-26 1) (* a0-21 2)) 3)) + (s5-0 (get-process *default-dead-pool* tomb-simon-block #x4000)) + (s4-0 (when s5-0 + (let ((t9-4 (method-of-type tomb-simon-block activate))) + (t9-4 + (the-as tomb-simon-block s5-0) + self + (symbol->string (-> tomb-simon-block symbol)) + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + s5-0 + tomb-simon-block-init-by-other + sv-128 + gp-2 + sv-136 + (the int (* 0.00012207031 (vector-vector-xz-distance (get-trans sv-96 0) sv-128))) + sv-144 + ) + (-> s5-0 ppointer) ) ) - (let ((s4-1 run-function-in-process) - (s3-0 s5-0) - (s2-0 tomb-simon-block-init-by-other) - (s1-0 sv-128) - (s0-0 gp-2) - ) - (set! sv-160 sv-136) - (let ((f30-0 0.00012207031)) - (set! sv-176 vector-vector-xz-distance) - (let* ((a0-26 (get-trans sv-96 0)) - (a1-9 sv-128) - (t1-0 (the int (* f30-0 (sv-176 a0-26 a1-9)))) - (t2-0 sv-144) - ) - ((the-as (function object object object object object object object none) s4-1) - s3-0 - s2-0 - s1-0 - s0-0 - sv-160 - t1-0 - t2-0 - ) - ) - ) - ) - (-> s5-0 ppointer) - ) - ) - ) - (send-event (ppointer->process s4-0) 'reparent) - (set! (-> self plat gp-2) (ppointer->handle s4-0)) + ) + (send-event (ppointer->process s4-0) 'reparent) + (set! (-> self plat gp-2) (ppointer->handle s4-0)) + ) + ) ) ) ) @@ -1012,13 +988,13 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (change-parent this *pusher-pool*) (set! (-> this notify-actor) (entity-actor-lookup arg0 'alt-actor 0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-2 (res-lump-data (-> this entity) 'plat-seq pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data (-> this entity) 'plat-seq pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this plat-seq-count) (the-as int (-> sv-16 elt-count))) @@ -1979,7 +1955,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (with-pp (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) @@ -2025,8 +2000,9 @@ (set! (-> this fact) (new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc)) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-26 (res-lump-data (-> this entity) 'vibe-pattern pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-26 (res-lump-data (-> this entity) 'vibe-pattern pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-26 (nonzero? (-> sv-16 elt-count))) (set! (-> this pat-tbl) (the-as (pointer int32) v1-26)) @@ -2039,8 +2015,9 @@ ) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-33 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-33 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32))) + ) (cond ((and v1-33 (nonzero? (-> sv-32 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-33)) diff --git a/goal_src/jak2/levels/tomb/widow-baron.gc b/goal_src/jak2/levels/tomb/widow-baron.gc index 8b6fafd4de..8cb5b4501c 100644 --- a/goal_src/jak2/levels/tomb/widow-baron.gc +++ b/goal_src/jak2/levels/tomb/widow-baron.gc @@ -921,7 +921,7 @@ ) (defbehavior widow-handler widow ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (v0-0 object) (sv-224 symbol) (sv-240 symbol) (sv-256 vector) (sv-272 matrix)) + (local-vars (v0-0 object)) (case arg2 (('attack) (let ((v1-1 (the-as object (-> arg3 param 1)))) @@ -931,43 +931,13 @@ ) (set! (-> self last-attack-id) (-> (the-as attack-info v1-1) id)) (send-event self 'bomb-hit (target-pos 0) 4) - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-2 - (let ((t9-3 (method-of-type part-tracker activate))) - (t9-3 - (the-as part-tracker gp-2) - *entity-pool* - (symbol->string (-> part-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s5-0 run-function-in-process) - (s4-0 gp-2) - (s3-0 part-tracker-init) - (s2-0 group-spydroid-explode) - (s1-0 600) - (s0-0 #f) - ) - (set! sv-224 (the-as symbol #f)) - (set! sv-240 (the-as symbol #f)) - (set! sv-272 *launch-matrix*) - (set! sv-256 (-> sv-272 trans)) - (let ((v1-16 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node widow-lod0-jg Lwrist)) quad))) - (set! (-> sv-256 quad) v1-16) - ) - ((the-as (function object object object object object object object object none) s5-0) - s4-0 - s3-0 - s2-0 - s1-0 - s0-0 - sv-224 - sv-240 - sv-272 - ) - ) - (-> gp-2 ppointer) - ) + (part-tracker-spawn + :to *entity-pool* + :group group-spydroid-explode + :duration 600 + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node widow-lod0-jg Lwrist)) ) ) ) diff --git a/goal_src/jak2/levels/tomb/widow-extras.gc b/goal_src/jak2/levels/tomb/widow-extras.gc index 0a640bb9cf..b4c31dd9dc 100644 --- a/goal_src/jak2/levels/tomb/widow-extras.gc +++ b/goal_src/jak2/levels/tomb/widow-extras.gc @@ -551,30 +551,11 @@ ;; ERROR: Stack slot load at 48 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 64 mismatch: defined as size 4, got size 16 (defmethod widow-bomb-method-34 ((this widow-bomb)) - (local-vars (sv-48 float) (sv-64 float)) (let ((s5-0 (new 'stack-no-clear 'quaternion)) (gp-0 (new 'stack-no-clear 'quaternion)) ) - (let ((s3-0 quaternion-set!) - (s2-0 s5-0) - (s1-0 (sin (/ (-> this x-rotate) 2))) - (s0-0 0.0) - ) - (set! sv-48 (the-as float 0.0)) - (let ((t0-0 (cos (/ (-> this x-rotate) 2)))) - (s3-0 s2-0 s1-0 s0-0 sv-48 t0-0) - ) - ) - (let ((s3-1 quaternion-set!) - (s2-1 gp-0) - (s1-1 0.0) - (s0-1 (sin (/ (-> this y-rotate) 2))) - ) - (set! sv-64 (the-as float 0.0)) - (let ((t0-1 (cos (/ (-> this y-rotate) 2)))) - (s3-1 s2-1 s1-1 s0-1 sv-64 t0-1) - ) - ) + (quaternion-set! s5-0 (sin (/ (-> this x-rotate) 2)) 0.0 (the-as float 0.0) (cos (/ (-> this x-rotate) 2))) + (quaternion-set! gp-0 0.0 (sin (/ (-> this y-rotate) 2)) (the-as float 0.0) (cos (/ (-> this y-rotate) 2))) (quaternion-normalize! (quaternion*! (-> this spin-jm quat) gp-0 s5-0)) ) 0 @@ -617,9 +598,7 @@ ) (set! (-> gp-0 y) (-> s4-1 y)) (vector-! s5-1 s4-1 gp-0) - (let* ((f0-6 f28-0) - (f0-8 (* f0-6 f0-6)) - ) + (let ((f0-8 (square f28-0))) (.lvf vf1 (&-> s5-1 quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -808,11 +787,8 @@ (defstate explode (widow-bomb) :virtual #t :enter (behavior () - (let* ((a0-1 (target-pos 0)) - (f0-0 (vector-vector-distance-squared a0-1 (-> self root trans))) - (f1-0 16384.0) - ) - (if (< f0-0 (* f1-0 f1-0)) + (let ((a0-1 (target-pos 0))) + (if (< (vector-vector-distance-squared a0-1 (-> self root trans)) (square 16384.0)) (send-event *target* 'attack diff --git a/goal_src/jak2/levels/tomb/widow-more-extras.gc b/goal_src/jak2/levels/tomb/widow-more-extras.gc index 64ddffbb68..19e32bbf62 100644 --- a/goal_src/jak2/levels/tomb/widow-more-extras.gc +++ b/goal_src/jak2/levels/tomb/widow-more-extras.gc @@ -128,7 +128,6 @@ (set! (-> self sound-floor) 81920.0) ) :trans (behavior () - (local-vars (sv-16 float)) (+! (-> self root trans y) (* (-> self y-velocity) (-> self clock time-adjust-ratio))) (set! (-> self y-velocity) (fmax -3686.4 (- (-> self y-velocity) (* 204.8 (-> self clock time-adjust-ratio)))) @@ -150,8 +149,8 @@ (f24-0 (-> *part-id-table* 3266 init-specs 7 initial-valuef)) (f22-0 (-> *part-id-table* 3266 init-specs 7 random-rangef)) (f20-0 (-> *part-id-table* 3266 init-specs 8 initial-valuef)) + (sv-16 (-> *part-id-table* 3266 init-specs 8 random-rangef)) ) - (set! sv-16 (-> *part-id-table* 3266 init-specs 8 random-rangef)) (set! (-> *part-id-table* 3266 init-specs 6 initial-valuef) (* (-> *part-id-table* 3266 init-specs 6 initial-valuef) f30-1) ) @@ -176,9 +175,9 @@ (set! (-> *part-id-table* 3266 init-specs 7 initial-valuef) f24-0) (set! (-> *part-id-table* 3266 init-specs 7 random-rangef) f22-0) (set! (-> *part-id-table* 3266 init-specs 8 initial-valuef) f20-0) + (set! (-> *part-id-table* 3266 init-specs 8 random-rangef) sv-16) + sv-16 ) - (set! (-> *part-id-table* 3266 init-specs 8 random-rangef) sv-16) - sv-16 ) (set-vector! (-> self draw color-mult) f30-1 f30-1 f30-1 1.0) ) diff --git a/goal_src/jak2/levels/under/centipede.gc b/goal_src/jak2/levels/under/centipede.gc index 14efdf2719..ccfed8e86a 100644 --- a/goal_src/jak2/levels/under/centipede.gc +++ b/goal_src/jak2/levels/under/centipede.gc @@ -173,7 +173,7 @@ (defmethod general-event-handler ((this centipede) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy -@TODO - unsure if there is a pattern for the events and this should have a more specific name" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('under-break-floor) (go (method-of-object this thru-grating)) @@ -185,17 +185,18 @@ ) ;; WARN: Return type mismatch nav-enemy vs centipede. -(defmethod relocate ((this centipede) (arg0 int)) +(defmethod relocate ((this centipede) (offset int)) (if (nonzero? (-> this bobbing)) - (&+! (-> this bobbing) arg0) + (&+! (-> this bobbing) offset) ) (if (nonzero? (-> this legs-sound)) - (&+! (-> this legs-sound) arg0) + (&+! (-> this legs-sound) offset) ) - (the-as centipede ((method-of-type nav-enemy relocate) this arg0)) + (the-as centipede ((method-of-type nav-enemy relocate) this offset)) ) (defmethod deactivate ((this centipede)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (when (-> this set-camera-mode?) (set! (-> this set-camera-mode?) #f) (remove-setting-by-arg0 *setting-control* 'mode-name) @@ -509,10 +510,10 @@ (defmethod in-aggro-range? ((this centipede) (arg0 process-focusable) (arg1 vector)) "Should the enemy activate. -- if `activate-distance` is `0.0`, always true -- otherwise, check if the provided process is close enough -@param proc The process used to distance check -@returns true/false" + - if `activate-distance` is `0.0`, always true + - otherwise, check if the provided process is close enough + @param proc The process used to distance check + @returns true/false" (when arg0 (if (not arg1) (set! arg1 (get-trans arg0 0)) @@ -524,10 +525,8 @@ (a0-2 (-> this fact)) ) (when (and (< f0-0 (+ f1-0 (-> a0-2 notice-top))) (< (- f1-0 (-> a0-2 notice-bottom)) f0-0)) - (let* ((f30-0 (-> this enemy-info notice-nav-radius)) - (f0-1 f30-0) - ) - (or (>= (* f0-1 f0-1) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) + (let ((f30-0 (-> this enemy-info notice-nav-radius))) + (or (>= (square f30-0) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) (is-in-mesh? (-> this nav) arg1 f30-0) ) ) @@ -554,9 +553,8 @@ (when targ (let* ((targ-pos (get-trans targ 0)) (y-off (- (-> targ-pos y) (-> this root trans y))) - (dist 28672.0) ) - (and (>= (* dist dist) (vector-vector-xz-distance-squared (-> this root trans) targ-pos)) + (and (>= (square 28672.0) (vector-vector-xz-distance-squared (-> this root trans) targ-pos)) (or (>= y-off -12288.0) (or (>= 24576.0 y-off) (focus-test? targ edge-grab))) ) ) @@ -611,9 +609,9 @@ (defmethod common-post ((this centipede)) "Does a lot of various things relating to interacting with the target -- tracks when the enemy was last drawn -- looks at the target and handles attacking -@TODO Not extremely well understood yet" + - tracks when the enemy was last drawn + - looks at the target and handles attacking + @TODO Not extremely well understood yet" (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) @@ -656,11 +654,9 @@ (vector+! s3-0 s3-0 (-> s2-0 state mesh bounds)) ) 0 - (let ((f0-2 1024.0)) - (if (>= (* f0-2 f0-2) (vector-vector-xz-distance-squared (-> s4-0 best-other-tri intersect) (-> s5-0 trans))) - (set! (-> s5-0 gspot-pos y) (-> s4-0 best-other-tri intersect y)) - ) - ) + (if (>= (square 1024.0) (vector-vector-xz-distance-squared (-> s4-0 best-other-tri intersect) (-> s5-0 trans))) + (set! (-> s5-0 gspot-pos y) (-> s4-0 best-other-tri intersect y)) + ) ) ) ) @@ -1109,7 +1105,7 @@ (let* ((v1-5 (- (current-time) (-> self state-time))) (f1-2 (* 0.00952381 (the float v1-5))) ) - (quaternion-slerp! (-> self root quat) (-> self src-quat) (-> self dest-quat) (- 1.0 (* f1-2 f1-2))) + (quaternion-slerp! (-> self root quat) (-> self src-quat) (-> self dest-quat) (- 1.0 (square f1-2))) ) (centipede-method-188 self) (suspend) diff --git a/goal_src/jak2/levels/under/jellyfish.gc b/goal_src/jak2/levels/under/jellyfish.gc index 6d3858e5c7..984680e253 100644 --- a/goal_src/jak2/levels/under/jellyfish.gc +++ b/goal_src/jak2/levels/under/jellyfish.gc @@ -100,11 +100,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-26 vf1) - (let ((f0-7 v1-26) - (f1-5 409.6) - ) - (< f0-7 (* f1-5 f1-5)) - ) + (< v1-26 (square 409.6)) ) ) (+! s3-0 1) @@ -913,7 +909,6 @@ ) (defmethod jellyfish-method-162 ((this jellyfish)) - (local-vars (sv-624 int)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -937,8 +932,8 @@ (s1-0 (new 'stack-no-clear 'vector)) (s0-0 (new 'stack-no-clear 'collide-query)) (f26-0 40960.0) + (sv-624 0) ) - (set! sv-624 0) (while (< sv-624 (the int f28-1)) (let ((a2-1 s2-0)) (let ((v1-9 s5-0) @@ -975,7 +970,7 @@ (set! f30-0 (fmax 0.0 (+ -40960.0 f30-0))) (+! s3-2 (the int (fmin 40960.0 f30-0))) (set! f26-0 (+ -4915.2 f26-0)) - (set! sv-624 (+ sv-624 1)) + (+! sv-624 1) ) ) ) diff --git a/goal_src/jak2/levels/under/sig5-course.gc b/goal_src/jak2/levels/under/sig5-course.gc index b73d4b7f44..e6a3b023aa 100644 --- a/goal_src/jak2/levels/under/sig5-course.gc +++ b/goal_src/jak2/levels/under/sig5-course.gc @@ -102,7 +102,7 @@ (defmethod general-event-handler ((this sig-under) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy -@TODO - unsure if there is a pattern for the events and this should have a more specific name" + @TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('set-task) @@ -158,10 +158,7 @@ ;; WARN: disable def twice: 39. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. (defmethod sig-under-method-262 ((this sig-under) (arg0 symbol)) (when (or (logtest? (-> this bot-task-bits) (bot-task-bits botbits-1)) - (and arg0 (let ((f0-0 81920.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) - ) - ) + (and arg0 (>= (square 81920.0) (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans)))) ) (cond ((speech-playing? this 7) @@ -217,14 +214,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-1 a2-5) - (f1-1 (+ (-> a1-2 world-sphere w) (-> gp-0 r))) - ) - (when (< f0-1 (* f1-1 f1-1)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-2 world-sphere w) (-> gp-0 r)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -258,14 +251,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-2 a2-12) - (f1-5 (+ (-> a1-14 world-sphere w) (-> gp-0 r))) - ) - (when (< f0-2 (* f1-5 f1-5)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-14 world-sphere w) (-> gp-0 r)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -308,7 +297,7 @@ (set! f2-1 (+ 2048.0 f2-1)) ) (if (and (>= f0-6 -2048.0) (>= f1-3 f0-6)) - (>= (* f2-1 f2-1) (vector-vector-xz-distance-squared arg1 (-> this root trans))) + (>= (square f2-1) (vector-vector-xz-distance-squared arg1 (-> this root trans))) ) ) ) @@ -318,10 +307,10 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (move-to-point! (-> self root) (the-as vector (-> self sig5-course spots 0))) + (move-to-point! (-> self root) (-> self sig5-course spots 0 center)) (quaternion-identity! (-> self root quat)) (let ((gp-0 (new 'stack-no-clear 'vector))) - (vector-! gp-0 (the-as vector (-> self sig5-course spots 1)) (-> self root trans)) + (vector-! gp-0 (-> self sig5-course spots 1 center) (-> self root trans)) (vector-normalize! gp-0 1.0) (set-heading-vec! (-> self root) gp-0) ) @@ -823,7 +812,7 @@ (s5-1 (-> v1-7 8)) ) (let ((v1-8 (-> v1-7 9))) - (vector-! (the-as vector (-> arg0 test-plane)) (the-as vector v1-8) (the-as vector s5-1)) + (vector-! (the-as vector (-> arg0 test-plane)) (-> v1-8 center) (-> s5-1 center)) ) (set! (-> arg0 test-plane y) 0.0) (vector-normalize! (-> arg0 test-plane) 1.0) @@ -898,7 +887,7 @@ :on-set (lambda ((arg0 sig-under)) (logior! (-> arg0 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (reset-warn-time! arg0) - (move-to-point! (-> arg0 root) (the-as vector (-> arg0 sig5-course spots 10))) + (move-to-point! (-> arg0 root) (-> arg0 sig5-course spots 10 center)) (set-vector! (-> arg0 root quat) 0.0 0.5874 0.0 0.8092) (play-speech arg0 8) (play-speech arg0 9) @@ -960,7 +949,7 @@ :skip-to -1 :on-set (lambda ((arg0 sig-under)) (let ((a1-0 (-> arg0 sig5-course spots))) - (vector-! (the-as vector (-> arg0 test-plane)) (the-as vector (-> a1-0 13)) (the-as vector (-> a1-0 12))) + (vector-! (the-as vector (-> arg0 test-plane)) (-> a1-0 13 center) (-> a1-0 12 center)) ) (vector-normalize! (-> arg0 test-plane) 1.0) (let ((v1-4 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) @@ -1306,7 +1295,7 @@ (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) (process-release? arg1) (sig-under-method-260 arg1) - (move-to-point! (-> arg1 root) (the-as vector (-> arg1 sig5-course spots 20))) + (move-to-point! (-> arg1 root) (-> arg1 sig5-course spots 20 center)) #f ) ((not (logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-1))) @@ -1347,7 +1336,7 @@ (s5-0 (-> v1-1 24)) ) (let ((v1-2 (-> v1-1 25))) - (vector-! (the-as vector (-> arg0 test-plane)) (the-as vector v1-2) (the-as vector s5-0)) + (vector-! (the-as vector (-> arg0 test-plane)) (-> v1-2 center) (-> s5-0 center)) ) (set! (-> arg0 test-plane y) 0.0) (vector-normalize! (-> arg0 test-plane) 1.0) @@ -1393,11 +1382,7 @@ (set! (-> s5-0 y) 0.0) (set! (-> s5-0 w) 1.0) (when (and (>= (vector4-dot (the-as vector (-> arg1 test-plane)) s5-0) 0.0) - (let ((f0-4 81920.0)) - (>= (* f0-4 f0-4) - (vector-vector-xz-distance-squared (target-pos 0) (the-as vector (-> arg1 sig5-course spots 24))) - ) - ) + (>= (square 81920.0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 sig5-course spots 24 center))) ) (set! v1-14 #t) (goto cfg-21) @@ -1517,9 +1502,7 @@ (sig-under-method-263 arg1) (when (and (time-elapsed? (-> arg1 waypoint-time0) (seconds 4)) (sig-method-257 arg1) - (let ((f0-0 61440.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) - ) + (>= (square 61440.0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) ) (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag jump-check-blocked))) diff --git a/goal_src/jak2/levels/under/under-laser.gc b/goal_src/jak2/levels/under/under-laser.gc index 24a5779422..54b28a4677 100644 --- a/goal_src/jak2/levels/under/under-laser.gc +++ b/goal_src/jak2/levels/under/under-laser.gc @@ -238,12 +238,7 @@ (set! (-> v1-2 action-mask) (collide-action solid)) ) (when (>= (fill-and-probe-using-line-sphere *collide-cache* s5-0) 0.0) - (let* ((s4-0 (-> s5-0 best-other-tri collide-ptr)) - (s5-1 (if (type? s4-0 collide-shape-prim-sphere) - s4-0 - ) - ) - ) + (let ((s5-1 (the-as basic (as-type (-> s5-0 best-other-tri collide-ptr) collide-shape-prim-sphere)))) (when s5-1 (let ((s4-1 (new 'stack-no-clear 'vector))) (vector-rotate-around-y! s4-1 (-> this slave-trans-offset) (if (logtest? (-> this info options) 1) @@ -350,22 +345,21 @@ ) ;; WARN: Return type mismatch process-drawable vs under-laser. -(defmethod relocate ((this under-laser) (arg0 int)) +(defmethod relocate ((this under-laser) (offset int)) (if (nonzero? (-> this lightning)) - (&+! (-> this lightning) arg0) + (&+! (-> this lightning) offset) ) - (the-as under-laser ((method-of-type process-drawable relocate) this arg0)) + (the-as under-laser ((method-of-type process-drawable relocate) this offset)) ) ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! ((this under-laser) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. -This commonly includes things such as: -- stack size -- collision information -- loading the skeleton group / bones -- sounds" - (local-vars (sv-64 res-tag)) + This commonly includes things such as: + - stack size + - collision information + - loading the skeleton group / bones + - sounds" (set! (-> this root) (the-as collide-shape-moving (new 'process 'trsqv))) (process-drawable-from-entity! this arg0) (logclear! (-> this mask) (process-mask actor-pause)) @@ -398,8 +392,9 @@ This commonly includes things such as: (set! (-> this clock) (-> *display* user0-clock)) (let ((s5-1 (-> this root))) (set-vector! (-> s5-1 scale) 1.25 1.25 1.25 1.0) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-22 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-64)))) + (let* ((sv-64 (new 'static 'res-tag)) + (v1-22 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-64))) + ) (when v1-22 (+! (-> s5-1 trans x) (-> v1-22 0)) (+! (-> s5-1 trans y) (-> v1-22 1)) diff --git a/goal_src/jak2/levels/under/under-obs.gc b/goal_src/jak2/levels/under/under-obs.gc index 1b70c29f25..e7d13b1beb 100644 --- a/goal_src/jak2/levels/under/under-obs.gc +++ b/goal_src/jak2/levels/under/under-obs.gc @@ -337,9 +337,7 @@ (when a0-4 (let ((a0-5 (get-trans a0-4 0))) (when (and (>= (- (-> a0-5 y) (-> self root trans y)) -6144.0) - (let ((f0-18 11264.0)) - (>= (* f0-18 f0-18) (vector-vector-xz-distance-squared a0-5 (-> self root trans))) - ) + (>= (square 11264.0) (vector-vector-xz-distance-squared a0-5 (-> self root trans))) ) (if (time-elapsed? (-> self last-recharge-time) (seconds 1)) (sound-play "oxygen-recharge") @@ -590,7 +588,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) @@ -611,8 +608,9 @@ ) (process-drawable-from-entity! this arg0) (-> this root) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-16 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-16 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-16 (+! (-> this root trans x) (-> v1-16 0)) (+! (-> this root trans y) (-> v1-16 1)) @@ -1293,10 +1291,8 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov a0-8 vf1) - (let ((f0-9 a0-8) - (f1-4 28672.0) - ) - (if (< (* f1-4 f1-4) f0-9) + (let ((f0-9 a0-8)) + (if (< (square 28672.0) f0-9) (vector-float*! v1-21 v1-21 (/ 28672.0 (sqrtf f0-9))) ) ) diff --git a/goal_src/jak2/levels/under/under-shoot-block.gc b/goal_src/jak2/levels/under/under-shoot-block.gc index 4240f8eacf..3e9a330c6b 100644 --- a/goal_src/jak2/levels/under/under-shoot-block.gc +++ b/goal_src/jak2/levels/under/under-shoot-block.gc @@ -1905,17 +1905,6 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod under-shoot-block-method-27 ((this under-shoot-block) (arg0 symbol)) - (local-vars - (sv-16 process) - (sv-32 (function int int symbol (pointer process) none :behavior under-block)) - (sv-48 int) - (sv-64 process) - (sv-80 (function int int symbol (pointer process) none :behavior under-block)) - (sv-96 int) - (sv-112 process) - (sv-128 (function int int symbol (pointer process) none :behavior under-block)) - (sv-144 int) - ) (let ((s4-0 (-> this puzzle))) (set! (-> s4-0 prev-special-attack-id) (the-as uint 0)) (set! (-> s4-0 slot-mask) (the-as uint 0)) @@ -1951,16 +1940,19 @@ (let ((t9-2 (method-of-type under-block activate))) (t9-2 (the-as under-block s1-0) this (symbol->string (-> under-block symbol)) (the-as pointer #x70004000)) ) - (let ((s0-0 run-function-in-process)) - (set! sv-16 s1-0) - (set! sv-32 under-block-init-by-other) - (set! sv-48 s3-0) - (let ((a3-1 (under-shoot-block-method-28 this)) - (t0-0 'beaten) - (t1-0 (process->ppointer this)) - ) - ((the-as (function object object object object object object none) s0-0) sv-16 sv-32 sv-48 a3-1 t0-0 t1-0) - ) + (let ((s0-0 run-function-in-process) + (sv-16 s1-0) + (sv-32 under-block-init-by-other) + (sv-48 s3-0) + ) + ((the-as (function object object object object object object none) s0-0) + sv-16 + sv-32 + sv-48 + (under-shoot-block-method-28 this) + 'beaten + (process->ppointer this) + ) ) (-> s1-0 ppointer) ) @@ -1977,16 +1969,19 @@ (let ((t9-6 (method-of-type under-block activate))) (t9-6 (the-as under-block s1-1) this (symbol->string (-> under-block symbol)) (the-as pointer #x70004000)) ) - (let ((s0-1 run-function-in-process)) - (set! sv-64 s1-1) - (set! sv-80 under-block-init-by-other) - (set! sv-96 s3-0) - (let ((a3-3 (under-shoot-block-method-28 this)) - (t0-1 'idle) - (t1-1 (process->ppointer this)) - ) - ((the-as (function object object object object object object none) s0-1) sv-64 sv-80 sv-96 a3-3 t0-1 t1-1) - ) + (let ((s0-1 run-function-in-process) + (sv-64 s1-1) + (sv-80 under-block-init-by-other) + (sv-96 s3-0) + ) + ((the-as (function object object object object object object none) s0-1) + sv-64 + sv-80 + sv-96 + (under-shoot-block-method-28 this) + 'idle + (process->ppointer this) + ) ) (-> s1-1 ppointer) ) @@ -2000,16 +1995,19 @@ (let ((t9-10 (method-of-type under-block activate))) (t9-10 (the-as under-block s1-2) this (symbol->string (-> under-block symbol)) (the-as pointer #x70004000)) ) - (let ((s0-2 run-function-in-process)) - (set! sv-112 s1-2) - (set! sv-128 under-block-init-by-other) - (set! sv-144 s3-0) - (let ((a3-5 (under-shoot-block-method-28 this)) - (t0-2 'waiting) - (t1-2 (process->ppointer this)) - ) - ((the-as (function object object object object object object none) s0-2) sv-112 sv-128 sv-144 a3-5 t0-2 t1-2) - ) + (let ((s0-2 run-function-in-process) + (sv-112 s1-2) + (sv-128 under-block-init-by-other) + (sv-144 s3-0) + ) + ((the-as (function object object object object object object none) s0-2) + sv-112 + sv-128 + sv-144 + (under-shoot-block-method-28 this) + 'waiting + (process->ppointer this) + ) ) (-> s1-2 ppointer) ) @@ -2057,7 +2055,6 @@ :virtual #t :event under-shoot-block-event-handler :trans (behavior () - (local-vars (sv-96 int)) (let ((gp-0 (-> self puzzle))) (if (= (-> gp-0 slot-mask) (-> gp-0 slot-mask-full)) (go-virtual victory-locked) @@ -2077,14 +2074,16 @@ (let ((s2-0 run-function-in-process) (s1-0 s3-0) (s0-0 under-block-init-by-other) + (sv-96 s5-0) ) - (set! sv-96 s5-0) - (let ((a3-1 (under-shoot-block-method-28 self)) - (t0-0 'follow) - (t1-0 (process->ppointer self)) - ) - ((the-as (function object object object object object object none) s2-0) s1-0 s0-0 sv-96 a3-1 t0-0 t1-0) - ) + ((the-as (function object object object object object object none) s2-0) + s1-0 + s0-0 + sv-96 + (under-shoot-block-method-28 self) + 'follow + (process->ppointer self) + ) ) (-> s3-0 ppointer) ) @@ -2196,15 +2195,15 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (let ((s5-1 (res-lump-value (-> this entity) 'extra-id uint128 :default (the-as uint128 -1) :time -1000000000.0))) (if (or (< (the-as int s5-1) 0) (>= (the-as int s5-1) (-> *under-block-puzzles* length))) (go process-drawable-art-error "bad puzzle id") ) - (set! sv-16 (new 'static 'res-tag)) - (let ((a0-7 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (a0-7 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (if (and a0-7 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) a0-7)) (set! (-> this actor-group) (the-as (pointer actor-group) #f)) diff --git a/goal_src/jak2/levels/under/under-sig-obs.gc b/goal_src/jak2/levels/under/under-sig-obs.gc index 9170f834b2..e65e8b87dd 100644 --- a/goal_src/jak2/levels/under/under-sig-obs.gc +++ b/goal_src/jak2/levels/under/under-sig-obs.gc @@ -165,19 +165,9 @@ (let ((s5-0 (the-as object (-> block param 1)))) (when (!= (-> (the-as attack-info s5-0) id) (-> self incoming-attack-id)) (set! (-> self incoming-attack-id) (-> (the-as attack-info s5-0) id)) - (let* ((gp-0 proc) - (s4-0 (if (type? gp-0 process-drawable) - gp-0 - ) - ) - ) + (let ((s4-0 (the-as process (as-type proc process-drawable)))) (when s4-0 - (let* ((s3-0 (-> (the-as process-drawable s4-0) root)) - (gp-1 (if (type? (the-as collide-shape s3-0) collide-shape) - s3-0 - ) - ) - ) + (let ((gp-1 (the-as trsqv (as-type (-> (the-as process-drawable s4-0) root) collide-shape)))) (when gp-1 (when (logtest? (-> (the-as collide-shape gp-1) root-prim prim-core collide-as) (collide-spec projectile)) (when (zero? (-> self state-flip)) @@ -239,12 +229,7 @@ ) ) (vector-reset! (-> self root transv)) - (let* ((gp-2 proc) - (a0-11 (if (type? (the-as process-focusable gp-2) process-focusable) - gp-2 - ) - ) - ) + (let ((a0-11 (the-as process (as-type proc process-focusable)))) (when a0-11 (vector-! (-> self root transv) (-> self root trans) (get-trans (the-as process-focusable a0-11) 0)) (set! (-> self root transv y) 0.0) @@ -404,7 +389,7 @@ (defmethod plat-path-sync ((this under-plat-shoot)) "If the `sync` period is greater than `0` then transition the state to [[plat::35]] otherwise, [[plat::34]] - + @see [[sync-eased]]" (cond ((and (script-eval (the-as pair (-> this draw-test-script))) (= *bot-record-path* -1)) @@ -505,7 +490,8 @@ ) (suspend) (ja-channel-set! 0) - (suspend-for (seconds 1)) + (suspend-for (seconds 1) + ) (send-event self 'death-end) (while (-> self child) (suspend) @@ -621,7 +607,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) @@ -652,8 +637,9 @@ ) ) (let ((s4-4 (-> this root))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-15 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-15 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-15 (+! (-> this root trans x) (-> v1-15 0)) (+! (-> this root trans y) (-> v1-15 1)) @@ -739,7 +725,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (set! (-> this bridge-id) (res-lump-value (-> this entity) 'extra-id int :time -1000000000.0)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) @@ -782,8 +767,9 @@ ) ) (let ((s4-4 (-> this root))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-24 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-24 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-24 (+! (-> this root trans x) (-> v1-24 0)) (+! (-> this root trans y) (-> v1-24 1)) @@ -868,7 +854,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) (set! (-> s4-0 total-prims) (the-as uint 3)) @@ -904,8 +889,9 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-under-int-door" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-18 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-18 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-18 (nonzero? (-> sv-16 elt-count))) (let ((a0-25 (-> v1-18 0 data 0 actor))) (if (and a0-25 (logtest? (-> a0-25 extra perm status) (entity-perm-status subtask-complete))) @@ -1015,7 +1001,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (init-plat-collision! this) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -1025,8 +1010,9 @@ ) (stop-bouncing! this) (let ((s5-1 (-> this root))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-8 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-8 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-8 (+! (-> s5-1 trans x) (-> v1-8 0)) (+! (-> s5-1 trans y) (-> v1-8 1)) diff --git a/goal_src/jak2/levels/under/underb-master.gc b/goal_src/jak2/levels/under/underb-master.gc index bc4ea597ad..f1ebebdce1 100644 --- a/goal_src/jak2/levels/under/underb-master.gc +++ b/goal_src/jak2/levels/under/underb-master.gc @@ -1046,7 +1046,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (set! (-> this which-reminder?) #f) (set! (-> this spooled-sound-id) (new 'static 'sound-id)) (set! (-> this root) (new 'process 'trsqv)) @@ -1061,8 +1060,9 @@ ) ) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((a0-6 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (a0-6 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (if (and a0-6 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) a0-6)) (set! (-> this actor-group) (the-as (pointer actor-group) #f))