From 8d28bb34804b53ab9cd4ca3ce08b952b78c9f165 Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Thu, 18 May 2023 22:33:46 +0200 Subject: [PATCH] jak2: add `current-time` macro for process clocks (#2662) Closes #1872 --------- Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com> --- decompiler/IR2/Form.h | 1 + decompiler/IR2/FormExpressionAnalysis.cpp | 20 + .../jak2/characters/ashelin/ash-states.gc | 40 +- goal_src/jak2/characters/ashelin/ash.gc | 262 ++--- goal_src/jak2/characters/sig/sig-states.gc | 78 +- goal_src/jak2/characters/sig/sig-task.gc | 4 +- goal_src/jak2/characters/sig/sig.gc | 320 +++--- .../underground_fighters/shuttle.gc | 646 ++++++----- goal_src/jak2/engine/ai/enemy.gc | 890 +++++++------- goal_src/jak2/engine/ambient/ambient.gc | 20 +- goal_src/jak2/engine/anim/fma-sphere.gc | 5 +- goal_src/jak2/engine/anim/joint-exploder.gc | 8 +- goal_src/jak2/engine/anim/joint-mod.gc | 2 +- goal_src/jak2/engine/anim/joint.gc | 200 ++-- goal_src/jak2/engine/camera/cam-debug.gc | 62 +- goal_src/jak2/engine/camera/cam-master.gc | 14 +- goal_src/jak2/engine/camera/cam-states.gc | 18 +- goal_src/jak2/engine/collide/collide-debug.gc | 224 ++-- goal_src/jak2/engine/collide/los-control.gc | 16 +- goal_src/jak2/engine/common_objs/base-plat.gc | 4 +- .../jak2/engine/common_objs/basebutton.gc | 4 +- .../jak2/engine/common_objs/collectables.gc | 245 ++-- goal_src/jak2/engine/common_objs/crates.gc | 12 +- .../jak2/engine/common_objs/dark-eco-pool.gc | 2 +- goal_src/jak2/engine/common_objs/elevator.gc | 18 +- .../jak2/engine/common_objs/generic-obs.gc | 101 +- goal_src/jak2/engine/common_objs/plat.gc | 8 +- goal_src/jak2/engine/common_objs/powerups.gc | 50 +- .../jak2/engine/common_objs/projectile.gc | 10 +- .../engine/common_objs/rigid-body-plat.gc | 50 +- goal_src/jak2/engine/common_objs/voicebox.gc | 17 +- goal_src/jak2/engine/common_objs/water.gc | 82 +- goal_src/jak2/engine/debug/default-menu.gc | 52 +- goal_src/jak2/engine/debug/editable-player.gc | 36 +- goal_src/jak2/engine/entity/entity.gc | 678 ++++++----- goal_src/jak2/engine/game/effect-control.gc | 698 ++++++----- goal_src/jak2/engine/game/game-info.gc | 14 +- goal_src/jak2/engine/game/main.gc | 4 +- .../jak2/engine/game/task/task-control.gc | 92 +- goal_src/jak2/engine/gfx/hw/display-h.gc | 4 - goal_src/jak2/engine/gfx/mood/weather-part.gc | 2 +- .../sprite/particles/sparticle-launcher.gc | 225 ++-- goal_src/jak2/engine/load/load-state.gc | 2 +- goal_src/jak2/engine/load/loader.gc | 12 +- goal_src/jak2/engine/math/transformq.gc | 109 +- goal_src/jak2/engine/nav/nav-enemy.gc | 281 +++-- goal_src/jak2/engine/physics/chain-physics.gc | 10 +- goal_src/jak2/engine/physics/rigid-body.gc | 4 +- goal_src/jak2/engine/physics/trajectory.gc | 2 +- .../process-drawable/process-drawable.gc | 621 +++++----- .../process-drawable/process-taskable.gc | 22 +- goal_src/jak2/engine/scene/scene.gc | 49 +- goal_src/jak2/engine/sound/gsound.gc | 59 +- goal_src/jak2/engine/sound/speech.gc | 44 +- goal_src/jak2/engine/target/board/board-h.gc | 9 +- .../jak2/engine/target/board/board-states.gc | 193 ++-- .../jak2/engine/target/board/target-board.gc | 251 ++-- .../engine/target/collide-reaction-target.gc | 260 +++-- .../jak2/engine/target/gun/gun-dark-shot.gc | 36 +- goal_src/jak2/engine/target/gun/gun-h.gc | 4 +- .../jak2/engine/target/gun/gun-red-shot.gc | 4 +- goal_src/jak2/engine/target/gun/gun-states.gc | 6 +- goal_src/jak2/engine/target/gun/gun-util.gc | 4 +- goal_src/jak2/engine/target/logic-target.gc | 112 +- .../jak2/engine/target/mech_suit/carry-h.gc | 4 +- .../engine/target/mech_suit/grunt-mech.gc | 122 +- .../engine/target/mech_suit/mech-states.gc | 91 +- goal_src/jak2/engine/target/mech_suit/mech.gc | 14 +- .../engine/target/mech_suit/target-mech.gc | 12 +- goal_src/jak2/engine/target/sidekick.gc | 4 +- goal_src/jak2/engine/target/target-anim.gc | 21 +- goal_src/jak2/engine/target/target-carry.gc | 16 +- goal_src/jak2/engine/target/target-darkjak.gc | 62 +- goal_src/jak2/engine/target/target-death.gc | 64 +- goal_src/jak2/engine/target/target-gun.gc | 134 +-- goal_src/jak2/engine/target/target-handler.gc | 38 +- goal_src/jak2/engine/target/target-part.gc | 166 ++- goal_src/jak2/engine/target/target-swim.gc | 60 +- goal_src/jak2/engine/target/target-tube.gc | 16 +- goal_src/jak2/engine/target/target-turret.gc | 208 ++-- goal_src/jak2/engine/target/target-util.gc | 68 +- goal_src/jak2/engine/target/target.gc | 223 ++-- goal_src/jak2/engine/target/target2.gc | 68 +- goal_src/jak2/engine/ui/credits.gc | 4 +- goal_src/jak2/engine/ui/minimap.gc | 260 +++-- .../jak2/engine/ui/progress/progress-draw.gc | 102 +- goal_src/jak2/engine/ui/progress/progress.gc | 180 ++- goal_src/jak2/engine/util/smush-control-h.gc | 66 +- goal_src/jak2/engine/util/sync-info.gc | 344 +++--- goal_src/jak2/kernel/gkernel-h.gc | 4 + goal_src/jak2/levels/atoll/ash1-course.gc | 66 +- goal_src/jak2/levels/atoll/atoll-obs.gc | 38 +- goal_src/jak2/levels/atoll/juicer.gc | 54 +- goal_src/jak2/levels/atoll/sig0-course.gc | 503 ++++---- goal_src/jak2/levels/atoll/sniper.gc | 6 +- .../jak2/levels/castle/boss/castle-baron.gc | 110 +- goal_src/jak2/levels/castle/pad/caspad-obs.gc | 4 +- .../jak2/levels/castle/pad/castle-tasks.gc | 4 +- .../jak2/levels/city/common/citizen-enemy.gc | 36 +- goal_src/jak2/levels/city/common/citizen.gc | 166 ++- goal_src/jak2/levels/city/common/civilian.gc | 268 +++-- .../jak2/levels/city/common/ctyport-obs.gc | 2 +- .../jak2/levels/city/common/ctywide-obs.gc | 364 +++--- .../jak2/levels/city/common/ctywide-tasks.gc | 48 +- goal_src/jak2/levels/city/common/guard.gc | 409 ++++--- .../levels/city/common/metalhead-flitter.gc | 164 ++- .../levels/city/common/metalhead-grunt.gc | 2 +- .../jak2/levels/city/common/pilot-states.gc | 16 +- .../jak2/levels/city/common/traffic-engine.gc | 731 ++++++------ goal_src/jak2/levels/city/common/transport.gc | 78 +- .../levels/city/common/vehicle-control.gc | 4 +- .../levels/city/common/vehicle-effects.gc | 2 +- .../jak2/levels/city/common/vehicle-guard.gc | 379 +++--- .../jak2/levels/city/common/vehicle-states.gc | 27 +- .../jak2/levels/city/common/vehicle-util.gc | 226 ++-- goal_src/jak2/levels/city/common/vehicle.gc | 514 ++++----- goal_src/jak2/levels/city/farm/ctyfarm-obs.gc | 232 ++-- goal_src/jak2/levels/city/farm/yakow.gc | 6 +- .../levels/city/kid_escort/crocesc-states.gc | 40 +- .../levels/city/kid_escort/hal4-course.gc | 848 +++++++------- .../levels/city/kid_escort/kidesc-states.gc | 44 +- .../levels/city/kid_escort/kidesc4-course.gc | 12 +- .../jak2/levels/city/market/ctymark-obs.gc | 4 +- .../city/market/east/ashelin/ash4-course.gc | 74 +- .../city/market/east/ashelin/ctyasha-obs.gc | 4 +- .../market/west/brutter_kiosk/meet-brutter.gc | 36 +- .../misc/collection_task/collection-task.gc | 10 +- .../city/misc/delivery/delivery-task.gc | 4 +- .../jak2/levels/city/onin_tent/onin-game.gc | 306 +++-- .../levels/city/oracle/oracle-training.gc | 2 +- .../jak2/levels/city/port/mines/portrun.gc | 89 +- .../jak2/levels/city/port/race/errol-chal.gc | 46 +- .../city/side_missions/ctywide-bbush.gc | 18 +- .../jak2/levels/city/slums/kor/kid-states.gc | 26 +- goal_src/jak2/levels/city/slums/kor/kid.gc | 296 +++-- .../jak2/levels/city/slums/kor/kor-states.gc | 28 +- goal_src/jak2/levels/city/slums/kor/kor.gc | 286 +++-- .../jak2/levels/city/slums/neon-baron-part.gc | 52 +- goal_src/jak2/levels/common/ai/bot-states.gc | 8 +- goal_src/jak2/levels/common/ai/bot.gc | 1018 ++++++++--------- goal_src/jak2/levels/common/airlock.gc | 40 +- goal_src/jak2/levels/common/battle.gc | 218 ++-- .../common/enemy/amphibian/amphibian.gc | 10 +- .../enemy/baby_spider/tomb-baby-spider.gc | 4 +- .../levels/common/enemy/bombots/bombbot.gc | 48 +- goal_src/jak2/levels/common/enemy/bouncer.gc | 6 +- .../jak2/levels/common/enemy/fodder/fodder.gc | 172 ++- .../enemy/guards/crimson-guard-level.gc | 91 +- .../common/enemy/guards/guard-conversation.gc | 4 +- .../common/enemy/guards/transport-level.gc | 84 +- goal_src/jak2/levels/common/enemy/hopper.gc | 8 +- .../common/enemy/hover/crimson-guard-hover.gc | 78 +- .../jak2/levels/common/enemy/hover/flamer.gc | 34 +- .../common/enemy/hover/hover-enemy-battle.gc | 76 +- .../levels/common/enemy/hover/hover-enemy.gc | 16 +- .../common/enemy/hover/hover-formation.gc | 90 +- .../common/enemy/hover/hover-nav-control.gc | 136 ++- .../jak2/levels/common/enemy/hover/wasp.gc | 22 +- .../enemy/metalhead_bearer/centurion.gc | 10 +- .../common/enemy/metalhead_brown/metalmonk.gc | 184 ++- .../enemy/metalhead_slinger/grenadier.gc | 78 +- goal_src/jak2/levels/common/enemy/spyder.gc | 148 ++- .../levels/common/entities/com-elevator.gc | 8 +- .../common/entities/fort-floor-spike.gc | 4 +- .../jak2/levels/common/entities/gun-buoy.gc | 22 +- .../levels/common/entities/sew-gunturret.gc | 32 +- .../jak2/levels/common/entities/spydroid.gc | 10 +- goal_src/jak2/levels/common/flitter.gc | 164 ++- goal_src/jak2/levels/common/grunt.gc | 6 +- .../jak2/levels/common/guard-projectile.gc | 4 +- .../jak2/levels/common/races/race-manager.gc | 356 +++--- goal_src/jak2/levels/common/races/race-obs.gc | 32 +- .../jak2/levels/common/races/vehicle-racer.gc | 78 +- goal_src/jak2/levels/common/warp-gate.gc | 37 +- goal_src/jak2/levels/demo/demo-obs.gc | 115 +- goal_src/jak2/levels/dig/dig-digger.gc | 136 ++- goal_src/jak2/levels/dig/dig-obs.gc | 200 ++-- goal_src/jak2/levels/dig/dig1-obs.gc | 32 +- goal_src/jak2/levels/dig/dig3-obs.gc | 86 +- .../jak2/levels/drill_platform/drill-baron.gc | 130 +-- .../drill_platform/drill-mech-master.gc | 40 +- .../jak2/levels/drill_platform/drill-obs.gc | 36 +- .../jak2/levels/drill_platform/drill-obs2.gc | 20 +- .../jak2/levels/drill_platform/drill-panel.gc | 150 ++- goal_src/jak2/levels/drill_platform/ginsu.gc | 120 +- goal_src/jak2/levels/forest/forest-obs.gc | 62 +- .../jak2/levels/forest/lifeseed/protect.gc | 10 +- goal_src/jak2/levels/forest/pegasus.gc | 179 ++- goal_src/jak2/levels/forest/predator.gc | 56 +- goal_src/jak2/levels/forest/wren.gc | 26 +- .../levels/fortress/ammo_dump/fordumpa-obs.gc | 22 +- .../levels/fortress/ammo_dump/fordumpb-obs.gc | 32 +- .../levels/fortress/ammo_dump/fordumpc-obs.gc | 60 +- .../ammo_dump/fort-robotank-turret.gc | 38 +- .../fortress/ammo_dump/fort-robotank.gc | 20 +- .../jak2/levels/fortress/exit/forexita-obs.gc | 12 +- goal_src/jak2/levels/fortress/fort-turret.gc | 194 ++-- goal_src/jak2/levels/fortress/fortress-obs.gc | 4 +- .../jak2/levels/fortress/prison/prison-obs.gc | 68 +- .../levels/fortress/rescue/forresca-obs.gc | 12 +- .../levels/fortress/rescue/forrescb-obs.gc | 46 +- goal_src/jak2/levels/gungame/gun-dummy.gc | 24 +- goal_src/jak2/levels/gungame/gungame-obs.gc | 30 +- goal_src/jak2/levels/hiphog/whack.gc | 430 ++++--- goal_src/jak2/levels/intro/intro-obs.gc | 12 +- goal_src/jak2/levels/intro/intro-scenes.gc | 12 +- .../jak2/levels/landing_pad/castle-obs.gc | 126 +- .../jak2/levels/landing_pad/castle-part.gc | 20 +- .../levels/landing_pad/roboguard-level.gc | 175 ++- .../mars_tomb/left/chase/target-indax.gc | 42 +- .../jak2/levels/mars_tomb/monster-frog.gc | 4 +- goal_src/jak2/levels/mars_tomb/tomb-beetle.gc | 84 +- goal_src/jak2/levels/mars_tomb/tomb-obs.gc | 38 +- goal_src/jak2/levels/mars_tomb/tomb-scenes.gc | 10 +- goal_src/jak2/levels/mars_tomb/tomb-water.gc | 152 ++- goal_src/jak2/levels/mars_tomb/widow-baron.gc | 154 ++- .../jak2/levels/mars_tomb/widow-extras.gc | 148 ++- .../levels/mars_tomb/widow-more-extras.gc | 8 +- .../jak2/levels/nest/boss/metalkor-extras.gc | 22 +- .../jak2/levels/nest/boss/metalkor-setup.gc | 4 +- .../jak2/levels/nest/boss/metalkor-states.gc | 108 +- .../jak2/levels/nest/boss/nestb-scenes.gc | 8 +- goal_src/jak2/levels/nest/flying-spider.gc | 78 +- goal_src/jak2/levels/nest/mammoth.gc | 196 ++-- goal_src/jak2/levels/nest/mantis.gc | 260 ++--- goal_src/jak2/levels/nest/nest-obs.gc | 16 +- goal_src/jak2/levels/nest/nest-scenes.gc | 4 +- .../jak2/levels/palace/boss/squid-extras.gc | 54 +- .../jak2/levels/palace/boss/squid-setup.gc | 453 ++++---- .../jak2/levels/palace/boss/squid-states.gc | 111 +- .../jak2/levels/palace/cable/palcab-obs.gc | 16 +- .../jak2/levels/palace/cable/palcab-part.gc | 4 +- goal_src/jak2/levels/palace/pal-obs.gc | 12 +- .../jak2/levels/palace/roof/palboss-scenes.gc | 8 +- .../power_station/power_switches/ctypower.gc | 10 +- .../jak2/levels/power_station/vinroom-obs.gc | 6 +- goal_src/jak2/levels/ruins/mechtest-obs.gc | 8 +- goal_src/jak2/levels/ruins/rapid-gunner.gc | 32 +- goal_src/jak2/levels/ruins/ruins-obs.gc | 42 +- goal_src/jak2/levels/ruins/ruins-part.gc | 14 +- .../jak2/levels/sewer/escort/jinx-bomb.gc | 6 +- .../jak2/levels/sewer/escort/jinx-states.gc | 6 +- goal_src/jak2/levels/sewer/gator.gc | 170 ++- goal_src/jak2/levels/sewer/grim2-course.gc | 49 +- goal_src/jak2/levels/sewer/hal2-course.gc | 1010 ++++++++-------- goal_src/jak2/levels/sewer/hosehead.gc | 22 +- goal_src/jak2/levels/sewer/mog2-course.gc | 49 +- goal_src/jak2/levels/sewer/sewer-obs.gc | 196 ++-- goal_src/jak2/levels/sewer/sewer-obs2.gc | 8 +- goal_src/jak2/levels/sewer/sewer-scenes.gc | 6 +- .../levels/stadium/jetboard/skatea-obs.gc | 50 +- goal_src/jak2/levels/stadium/stadium-obs.gc | 188 ++- goal_src/jak2/levels/strip/chaincrate.gc | 103 +- goal_src/jak2/levels/strip/strip-drop.gc | 8 +- goal_src/jak2/levels/strip/strip-obs.gc | 32 +- goal_src/jak2/levels/temple/mountain-obs.gc | 42 +- goal_src/jak2/levels/temple/mountain-obs2.gc | 8 +- goal_src/jak2/levels/temple/rhino.gc | 16 +- goal_src/jak2/levels/title/title-obs.gc | 67 +- goal_src/jak2/levels/undefined/ruf-states.gc | 30 +- goal_src/jak2/levels/underport/centipede.gc | 35 +- goal_src/jak2/levels/underport/jellyfish.gc | 344 +++--- goal_src/jak2/levels/underport/pipe-grunt.gc | 2 +- goal_src/jak2/levels/underport/sig5-course.gc | 525 ++++----- goal_src/jak2/levels/underport/under-laser.gc | 2 +- goal_src/jak2/levels/underport/under-obs.gc | 10 +- .../levels/underport/under-shoot-block.gc | 142 ++- .../jak2/levels/underport/under-sig-obs.gc | 50 +- .../jak2/levels/underport/underb-master.gc | 38 +- .../jak2/characters/ashelin/ash-states_REF.gc | 40 +- .../jak2/characters/ashelin/ash_REF.gc | 266 ++--- .../jak2/characters/sig/sig-states_REF.gc | 78 +- .../jak2/characters/sig/sig-task_REF.gc | 4 +- .../reference/jak2/characters/sig/sig_REF.gc | 320 +++--- .../underground_fighters/shuttle_REF.gc | 646 ++++++----- .../reference/jak2/decompiler-macros.gc | 4 +- .../reference/jak2/engine/ai/enemy_REF.gc | 898 +++++++-------- .../jak2/engine/ambient/ambient_REF.gc | 20 +- .../jak2/engine/anim/fma-sphere_REF.gc | 4 +- .../jak2/engine/anim/joint-exploder_REF.gc | 8 +- .../jak2/engine/anim/joint-mod_REF.gc | 2 +- .../reference/jak2/engine/anim/joint_REF.gc | 143 +-- .../jak2/engine/camera/cam-debug_REF.gc | 63 +- .../jak2/engine/camera/cam-master_REF.gc | 14 +- .../jak2/engine/camera/cam-states_REF.gc | 18 +- .../jak2/engine/collide/collide-debug_REF.gc | 224 ++-- .../jak2/engine/collide/los-control_REF.gc | 27 +- .../jak2/engine/common_objs/base-plat_REF.gc | 4 +- .../jak2/engine/common_objs/basebutton_REF.gc | 4 +- .../engine/common_objs/collectables_REF.gc | 245 ++-- .../jak2/engine/common_objs/crates_REF.gc | 12 +- .../engine/common_objs/dark-eco-pool_REF.gc | 2 +- .../jak2/engine/common_objs/elevator_REF.gc | 18 +- .../engine/common_objs/generic-obs_REF.gc | 101 +- .../jak2/engine/common_objs/plat_REF.gc | 8 +- .../jak2/engine/common_objs/powerups_REF.gc | 50 +- .../jak2/engine/common_objs/projectile_REF.gc | 10 +- .../engine/common_objs/rigid-body-plat_REF.gc | 50 +- .../jak2/engine/common_objs/voicebox_REF.gc | 17 +- .../jak2/engine/common_objs/water_REF.gc | 82 +- .../jak2/engine/debug/default-menu_REF.gc | 52 +- .../jak2/engine/debug/editable-player_REF.gc | 7 +- .../jak2/engine/entity/entity_REF.gc | 680 ++++++----- .../jak2/engine/game/effect-control_REF.gc | 698 ++++++----- .../jak2/engine/game/game-info_REF.gc | 14 +- .../reference/jak2/engine/game/main_REF.gc | 40 +- .../jak2/engine/game/task/task-control_REF.gc | 92 +- .../jak2/engine/gfx/mood/weather-part_REF.gc | 2 +- .../particles/sparticle-launcher_REF.gc | 156 ++- .../jak2/engine/load/load-state_REF.gc | 4 +- .../reference/jak2/engine/load/loader_REF.gc | 12 +- .../jak2/engine/math/transformq_REF.gc | 27 +- .../jak2/engine/nav/nav-enemy_REF.gc | 293 +++-- .../jak2/engine/physics/chain-physics_REF.gc | 10 +- .../jak2/engine/physics/rigid-body_REF.gc | 5 +- .../jak2/engine/physics/trajectory_REF.gc | 2 +- .../process-drawable/process-drawable_REF.gc | 614 +++++----- .../process-drawable/process-taskable_REF.gc | 20 +- .../reference/jak2/engine/scene/scene_REF.gc | 49 +- .../reference/jak2/engine/sound/gsound_REF.gc | 59 +- .../reference/jak2/engine/sound/speech_REF.gc | 44 +- .../jak2/engine/target/board/board-h_REF.gc | 9 +- .../engine/target/board/board-states_REF.gc | 193 ++-- .../engine/target/board/target-board_REF.gc | 251 ++-- .../target/collide-reaction-target_REF.gc | 260 +++-- .../engine/target/gun/gun-dark-shot_REF.gc | 36 +- .../jak2/engine/target/gun/gun-h_REF.gc | 4 +- .../engine/target/gun/gun-red-shot_REF.gc | 4 +- .../jak2/engine/target/gun/gun-states_REF.gc | 4 +- .../jak2/engine/target/gun/gun-util_REF.gc | 4 +- .../jak2/engine/target/logic-target_REF.gc | 112 +- .../engine/target/mech_suit/carry-h_REF.gc | 4 +- .../engine/target/mech_suit/grunt-mech_REF.gc | 122 +- .../target/mech_suit/mech-states_REF.gc | 91 +- .../jak2/engine/target/mech_suit/mech_REF.gc | 14 +- .../target/mech_suit/target-mech_REF.gc | 16 +- .../jak2/engine/target/sidekick_REF.gc | 4 +- .../jak2/engine/target/target-anim_REF.gc | 21 +- .../jak2/engine/target/target-carry_REF.gc | 16 +- .../jak2/engine/target/target-darkjak_REF.gc | 60 +- .../jak2/engine/target/target-death_REF.gc | 64 +- .../jak2/engine/target/target-gun_REF.gc | 134 +-- .../jak2/engine/target/target-handler_REF.gc | 38 +- .../jak2/engine/target/target-part_REF.gc | 166 ++- .../jak2/engine/target/target-swim_REF.gc | 60 +- .../jak2/engine/target/target-tube_REF.gc | 16 +- .../jak2/engine/target/target-turret_REF.gc | 208 ++-- .../jak2/engine/target/target-util_REF.gc | 68 +- .../jak2/engine/target/target2_REF.gc | 68 +- .../jak2/engine/target/target_REF.gc | 217 ++-- .../reference/jak2/engine/ui/credits_REF.gc | 4 +- .../reference/jak2/engine/ui/minimap_REF.gc | 263 +++-- .../engine/ui/progress/progress-draw_REF.gc | 106 +- .../jak2/engine/ui/progress/progress_REF.gc | 180 ++- .../jak2/engine/util/smush-control-h_REF.gc | 66 +- .../jak2/engine/util/sync-info_REF.gc | 342 +++--- .../jak2/levels/atoll/ash1-course_REF.gc | 66 +- .../jak2/levels/atoll/atoll-obs_REF.gc | 38 +- .../reference/jak2/levels/atoll/juicer_REF.gc | 54 +- .../jak2/levels/atoll/sig0-course_REF.gc | 503 ++++---- .../reference/jak2/levels/atoll/sniper_REF.gc | 6 +- .../levels/castle/boss/castle-baron_REF.gc | 104 +- .../jak2/levels/castle/pad/caspad-obs_REF.gc | 4 +- .../levels/castle/pad/castle-tasks_REF.gc | 4 +- .../levels/city/common/citizen-enemy_REF.gc | 40 +- .../jak2/levels/city/common/citizen_REF.gc | 166 ++- .../jak2/levels/city/common/civilian_REF.gc | 268 +++-- .../levels/city/common/ctyport-obs_REF.gc | 2 +- .../levels/city/common/ctywide-obs_REF.gc | 356 +++--- .../levels/city/common/ctywide-tasks_REF.gc | 48 +- .../jak2/levels/city/common/guard_REF.gc | 409 ++++--- .../city/common/metalhead-flitter_REF.gc | 164 ++- .../levels/city/common/metalhead-grunt_REF.gc | 2 +- .../levels/city/common/pilot-states_REF.gc | 16 +- .../levels/city/common/traffic-engine_REF.gc | 731 ++++++------ .../jak2/levels/city/common/transport_REF.gc | 82 +- .../levels/city/common/vehicle-control_REF.gc | 8 +- .../levels/city/common/vehicle-effects_REF.gc | 2 +- .../levels/city/common/vehicle-guard_REF.gc | 379 +++--- .../levels/city/common/vehicle-states_REF.gc | 27 +- .../levels/city/common/vehicle-util_REF.gc | 226 ++-- .../jak2/levels/city/common/vehicle_REF.gc | 514 ++++----- .../jak2/levels/city/farm/ctyfarm-obs_REF.gc | 232 ++-- .../jak2/levels/city/farm/yakow_REF.gc | 6 +- .../city/kid_escort/crocesc-states_REF.gc | 40 +- .../levels/city/kid_escort/hal4-course_REF.gc | 848 +++++++------- .../city/kid_escort/kidesc-states_REF.gc | 44 +- .../city/kid_escort/kidesc4-course_REF.gc | 12 +- .../levels/city/market/ctymark-obs_REF.gc | 4 +- .../market/east/ashelin/ash4-course_REF.gc | 74 +- .../market/east/ashelin/ctyasha-obs_REF.gc | 4 +- .../west/brutter_kiosk/meet-brutter_REF.gc | 36 +- .../collection_task/collection-task_REF.gc | 10 +- .../city/misc/delivery/delivery-task_REF.gc | 4 +- .../levels/city/onin_tent/onin-game_REF.gc | 306 +++-- .../levels/city/oracle/oracle-training_REF.gc | 2 +- .../levels/city/port/mines/portrun_REF.gc | 89 +- .../levels/city/port/race/errol-chal_REF.gc | 46 +- .../city/side_missions/ctywide-bbush_REF.gc | 18 +- .../levels/city/slums/kor/kid-states_REF.gc | 26 +- .../jak2/levels/city/slums/kor/kid_REF.gc | 296 +++-- .../levels/city/slums/kor/kor-states_REF.gc | 28 +- .../jak2/levels/city/slums/kor/kor_REF.gc | 286 +++-- .../levels/city/slums/neon-baron-part_REF.gc | 52 +- .../jak2/levels/common/ai/bot-states_REF.gc | 8 +- .../jak2/levels/common/ai/bot_REF.gc | 1018 ++++++++--------- .../jak2/levels/common/airlock_REF.gc | 28 +- .../jak2/levels/common/battle_REF.gc | 218 ++-- .../common/enemy/amphibian/amphibian_REF.gc | 10 +- .../enemy/baby_spider/tomb-baby-spider_REF.gc | 8 +- .../common/enemy/bombots/bombbot_REF.gc | 49 +- .../jak2/levels/common/enemy/bouncer_REF.gc | 6 +- .../levels/common/enemy/fodder/fodder_REF.gc | 172 ++- .../enemy/guards/crimson-guard-level_REF.gc | 91 +- .../enemy/guards/guard-conversation_REF.gc | 4 +- .../enemy/guards/transport-level_REF.gc | 84 +- .../jak2/levels/common/enemy/hopper_REF.gc | 2 +- .../enemy/hover/crimson-guard-hover_REF.gc | 78 +- .../levels/common/enemy/hover/flamer_REF.gc | 38 +- .../enemy/hover/hover-enemy-battle_REF.gc | 80 +- .../common/enemy/hover/hover-enemy_REF.gc | 20 +- .../common/enemy/hover/hover-formation_REF.gc | 90 +- .../enemy/hover/hover-nav-control_REF.gc | 140 ++- .../levels/common/enemy/hover/wasp_REF.gc | 22 +- .../enemy/metalhead_bearer/centurion_REF.gc | 10 +- .../enemy/metalhead_brown/metalmonk_REF.gc | 188 ++- .../enemy/metalhead_slinger/grenadier_REF.gc | 78 +- .../jak2/levels/common/enemy/spyder_REF.gc | 148 ++- .../common/entities/com-elevator_REF.gc | 8 +- .../common/entities/fort-floor-spike_REF.gc | 4 +- .../levels/common/entities/gun-buoy_REF.gc | 22 +- .../common/entities/sew-gunturret_REF.gc | 32 +- .../levels/common/entities/spydroid_REF.gc | 10 +- .../jak2/levels/common/flitter_REF.gc | 164 ++- .../reference/jak2/levels/common/grunt_REF.gc | 6 +- .../levels/common/guard-projectile_REF.gc | 4 +- .../levels/common/races/race-manager_REF.gc | 356 +++--- .../jak2/levels/common/races/race-obs_REF.gc | 36 +- .../levels/common/races/vehicle-racer_REF.gc | 64 +- .../jak2/levels/common/warp-gate_REF.gc | 37 +- .../jak2/levels/demo/demo-obs_REF.gc | 115 +- .../jak2/levels/dig/dig-digger_REF.gc | 136 ++- .../reference/jak2/levels/dig/dig-obs_REF.gc | 200 ++-- .../reference/jak2/levels/dig/dig1-obs_REF.gc | 32 +- .../reference/jak2/levels/dig/dig3-obs_REF.gc | 86 +- .../levels/drill_platform/drill-baron_REF.gc | 130 +-- .../drill_platform/drill-mech-master_REF.gc | 40 +- .../levels/drill_platform/drill-obs2_REF.gc | 20 +- .../levels/drill_platform/drill-obs_REF.gc | 36 +- .../levels/drill_platform/drill-panel_REF.gc | 150 ++- .../jak2/levels/drill_platform/ginsu_REF.gc | 120 +- .../jak2/levels/forest/forest-obs_REF.gc | 62 +- .../levels/forest/lifeseed/protect_REF.gc | 10 +- .../jak2/levels/forest/pegasus_REF.gc | 178 ++- .../jak2/levels/forest/predator_REF.gc | 56 +- .../reference/jak2/levels/forest/wren_REF.gc | 26 +- .../fortress/ammo_dump/fordumpa-obs_REF.gc | 20 +- .../fortress/ammo_dump/fordumpb-obs_REF.gc | 32 +- .../fortress/ammo_dump/fordumpc-obs_REF.gc | 60 +- .../ammo_dump/fort-robotank-turret_REF.gc | 38 +- .../fortress/ammo_dump/fort-robotank_REF.gc | 20 +- .../levels/fortress/exit/forexita-obs_REF.gc | 12 +- .../jak2/levels/fortress/fort-turret_REF.gc | 194 ++-- .../jak2/levels/fortress/fortress-obs_REF.gc | 4 +- .../levels/fortress/prison/prison-obs_REF.gc | 68 +- .../fortress/rescue/forresca-obs_REF.gc | 12 +- .../fortress/rescue/forrescb-obs_REF.gc | 51 +- .../jak2/levels/gungame/gun-dummy_REF.gc | 24 +- .../jak2/levels/gungame/gungame-obs_REF.gc | 34 +- .../reference/jak2/levels/hiphog/whack_REF.gc | 430 ++++--- .../jak2/levels/intro/intro-obs_REF.gc | 16 +- .../jak2/levels/intro/intro-scenes_REF.gc | 12 +- .../jak2/levels/landing_pad/castle-obs_REF.gc | 124 +- .../levels/landing_pad/castle-part_REF.gc | 20 +- .../levels/landing_pad/roboguard-level_REF.gc | 175 ++- .../mars_tomb/left/chase/target-indax_REF.gc | 42 +- .../jak2/levels/mars_tomb/monster-frog_REF.gc | 4 +- .../jak2/levels/mars_tomb/tomb-beetle_REF.gc | 88 +- .../jak2/levels/mars_tomb/tomb-obs_REF.gc | 34 +- .../jak2/levels/mars_tomb/tomb-scenes_REF.gc | 10 +- .../jak2/levels/mars_tomb/tomb-water_REF.gc | 152 ++- .../jak2/levels/mars_tomb/widow-baron_REF.gc | 154 ++- .../jak2/levels/mars_tomb/widow-extras_REF.gc | 148 ++- .../levels/mars_tomb/widow-more-extras_REF.gc | 8 +- .../levels/nest/boss/metalkor-extras_REF.gc | 26 +- .../levels/nest/boss/metalkor-setup_REF.gc | 8 +- .../levels/nest/boss/metalkor-states_REF.gc | 108 +- .../jak2/levels/nest/boss/nestb-scenes_REF.gc | 8 +- .../jak2/levels/nest/flying-spider_REF.gc | 78 +- .../reference/jak2/levels/nest/mammoth_REF.gc | 196 ++-- .../reference/jak2/levels/nest/mantis_REF.gc | 260 ++--- .../jak2/levels/nest/nest-obs_REF.gc | 16 +- .../jak2/levels/nest/nest-scenes_REF.gc | 4 +- .../levels/palace/boss/squid-extras_REF.gc | 58 +- .../levels/palace/boss/squid-setup_REF.gc | 453 ++++---- .../levels/palace/boss/squid-states_REF.gc | 111 +- .../levels/palace/cable/palcab-obs_REF.gc | 16 +- .../levels/palace/cable/palcab-part_REF.gc | 4 +- .../jak2/levels/palace/pal-obs_REF.gc | 10 +- .../levels/palace/roof/palboss-scenes_REF.gc | 8 +- .../power_switches/ctypower_REF.gc | 10 +- .../levels/power_station/vinroom-obs_REF.gc | 4 +- .../jak2/levels/ruins/mechtest-obs_REF.gc | 8 +- .../jak2/levels/ruins/rapid-gunner_REF.gc | 32 +- .../jak2/levels/ruins/ruins-obs_REF.gc | 42 +- .../jak2/levels/ruins/ruins-part_REF.gc | 14 +- .../jak2/levels/sewer/escort/jinx-bomb_REF.gc | 10 +- .../levels/sewer/escort/jinx-states_REF.gc | 10 +- .../reference/jak2/levels/sewer/gator_REF.gc | 170 ++- .../jak2/levels/sewer/grim2-course_REF.gc | 53 +- .../jak2/levels/sewer/hal2-course_REF.gc | 1010 ++++++++-------- .../jak2/levels/sewer/hosehead_REF.gc | 23 +- .../jak2/levels/sewer/mog2-course_REF.gc | 53 +- .../jak2/levels/sewer/sewer-obs2_REF.gc | 8 +- .../jak2/levels/sewer/sewer-obs_REF.gc | 182 ++- .../jak2/levels/sewer/sewer-scenes_REF.gc | 6 +- .../levels/stadium/jetboard/skatea-obs_REF.gc | 50 +- .../jak2/levels/stadium/stadium-obs_REF.gc | 186 ++- .../jak2/levels/strip/chaincrate_REF.gc | 103 +- .../jak2/levels/strip/strip-drop_REF.gc | 8 +- .../jak2/levels/strip/strip-obs_REF.gc | 32 +- .../jak2/levels/temple/mountain-obs2_REF.gc | 8 +- .../jak2/levels/temple/mountain-obs_REF.gc | 42 +- .../reference/jak2/levels/temple/rhino_REF.gc | 16 +- .../jak2/levels/title/title-obs_REF.gc | 67 +- .../jak2/levels/undefined/ruf-states_REF.gc | 30 +- .../jak2/levels/underport/centipede_REF.gc | 35 +- .../jak2/levels/underport/jellyfish_REF.gc | 344 +++--- .../jak2/levels/underport/pipe-grunt_REF.gc | 6 +- .../jak2/levels/underport/sig5-course_REF.gc | 525 ++++----- .../jak2/levels/underport/under-laser_REF.gc | 2 +- .../jak2/levels/underport/under-obs_REF.gc | 10 +- .../levels/underport/under-shoot-block_REF.gc | 142 ++- .../levels/underport/under-sig-obs_REF.gc | 50 +- .../levels/underport/underb-master_REF.gc | 38 +- 535 files changed, 26686 insertions(+), 28650 deletions(-) diff --git a/decompiler/IR2/Form.h b/decompiler/IR2/Form.h index 1338926512..47ada03075 100644 --- a/decompiler/IR2/Form.h +++ b/decompiler/IR2/Form.h @@ -1294,6 +1294,7 @@ class DerefElement : public FormElement { private: ConstantTokenElement* try_as_art_const(const Env& env, FormPool& pool); + GenericElement* try_as_curtime(FormPool& pool); Form* m_base = nullptr; bool m_is_addr_of = false; diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index cf07c6be50..fef5482094 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -3876,6 +3876,19 @@ ConstantTokenElement* DerefElement::try_as_art_const(const Env& env, FormPool& p return nullptr; } +GenericElement* DerefElement::try_as_curtime(FormPool& pool) { + auto mr = match(Matcher::deref(Matcher::s6(), false, + {DerefTokenMatcher::string("clock"), + DerefTokenMatcher::string("frame-counter")}), + this); + if (mr.matched) { + return pool.alloc_element( + GenericOperator::make_function(pool.form("current-time"))); + } + + return nullptr; +} + void DerefElement::update_from_stack(const Env& env, FormPool& pool, FormStack& stack, @@ -3911,6 +3924,13 @@ void DerefElement::update_from_stack(const Env& env, env.dts->ts.try_enum_lookup("game-task-node"), pool, env, m_tokens.at(1).int_constant())); } + // current-time macro + auto as_curtime = try_as_curtime(pool); + if (as_curtime) { + result->push_back(as_curtime); + return; + } + result->push_back(this); } diff --git a/goal_src/jak2/characters/ashelin/ash-states.gc b/goal_src/jak2/characters/ashelin/ash-states.gc index 3f2ce458d3..70ea6a090a 100644 --- a/goal_src/jak2/characters/ashelin/ash-states.gc +++ b/goal_src/jak2/characters/ashelin/ash-states.gc @@ -11,7 +11,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -109,7 +109,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -169,9 +169,7 @@ (ashelin-method-240 self a1-6) ) (else - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - (ashelin-method-247 self) - ) + (if (and (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (ashelin-method-247 self)) (go-virtual chase) ) ) @@ -189,7 +187,7 @@ ) ) (else - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (if (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (ashelin-method-239 self) ) ) @@ -259,7 +257,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -349,7 +347,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -379,12 +377,10 @@ ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) (ashelin-method-239 self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -417,7 +413,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -438,7 +434,7 @@ ((bot-method-214 self) (go-hostile self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + ((and (>= (- (current-time) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) (go-virtual traveling) ) ) @@ -465,7 +461,7 @@ ) :trans (behavior () (bot-method-223 self #f) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (when (bot-method-214 self) (if (ashelin-method-238 self #t #f) (go-virtual standing-idle) @@ -553,16 +549,14 @@ :trans (behavior () (bot-method-223 self #t) (cond - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ((not (bot-method-214 self)) (go-virtual traveling) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (or (ashelin-method-238 self #t #f) (ashelin-method-248 self)) (go-virtual standing-idle) ) @@ -606,7 +600,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -748,7 +742,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -883,7 +877,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1083,7 +1077,7 @@ (t9-0) ) ) - (when (and (logtest? (bot-flags bf23) (-> self bot-flags)) (!= (-> self state-time) (-> self clock frame-counter))) + (when (and (logtest? (bot-flags bf23) (-> self bot-flags)) (!= (-> self state-time) (current-time))) (logclear! (-> self bot-flags) (bot-flags bf23)) (ashelin-method-244 self) ) diff --git a/goal_src/jak2/characters/ashelin/ash.gc b/goal_src/jak2/characters/ashelin/ash.gc index 5c745266b4..91377ca56e 100644 --- a/goal_src/jak2/characters/ashelin/ash.gc +++ b/goal_src/jak2/characters/ashelin/ash.gc @@ -269,101 +269,99 @@ ) (defmethod enemy-method-97 ashelin ((obj ashelin)) - (with-pp - (let* ((s5-0 (handle->process (-> obj attacker-handle))) - (v1-3 (if (type? s5-0 process-focusable) - s5-0 - ) - ) + (let* ((s5-0 (handle->process (-> obj attacker-handle))) + (v1-3 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when v1-3 + (cond + ((= (-> v1-3 type) target) + (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) + (>= (- (current-time) (-> obj attacker-time)) (seconds 5)) + ) + (if (logtest? (-> obj bot-flags) (bot-flags attacked)) + (reset-attacker! obj) + ) + (set! v1-3 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) - (when v1-3 - (cond - ((= (-> v1-3 type) target) - (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) - (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 5)) - ) - (if (logtest? (-> obj bot-flags) (bot-flags attacked)) - (reset-attacker! obj) - ) - (set! v1-3 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 2.5)) - (set! v1-3 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) + ) + (else + (when (>= (- (current-time) (-> obj attacker-time)) (seconds 2.5)) + (set! v1-3 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) ) ) - (let ((a0-21 (-> obj focus-mode)) - (s5-1 (the-as process #f)) - ) - (cond - ((zero? a0-21) - (cond - (v1-3 - (set! s5-1 v1-3) - ) - ((begin (set! s5-1 (select-focus! obj)) s5-1) - (empty) - ) - (else - (let ((s4-0 (handle->process (-> obj poi-handle)))) - (set! s5-1 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) - (if s5-1 - (empty) - (set! s5-1 *target*) - ) - ) - ) - ) - ((= a0-21 1) - (cond - (v1-3 - (set! s5-1 v1-3) - ) - (else - (let ((s4-1 (handle->process (-> obj poi-handle)))) - (set! s5-1 (if (type? s4-1 process-focusable) - s4-1 - ) - ) - ) - (cond - (s5-1 - (empty) - ) - ((begin (set! s5-1 (select-focus! obj)) s5-1) - (empty) - ) - (else - (set! s5-1 *target*) - ) - ) - ) - ) - ) + ) + (let ((a0-21 (-> obj focus-mode)) + (s5-1 (the-as process #f)) ) - (cond - (s5-1 - (try-update-focus (-> obj focus) (the-as process-focusable s5-1) obj) - (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> s5-1 type) target)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) + (cond + ((zero? a0-21) + (cond + (v1-3 + (set! s5-1 v1-3) + ) + ((begin (set! s5-1 (select-focus! obj)) s5-1) + (empty) + ) + (else + (let ((s4-0 (handle->process (-> obj poi-handle)))) + (set! s5-1 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (if s5-1 + (empty) + (set! s5-1 *target*) + ) + ) + ) + ) + ((= a0-21 1) + (cond + (v1-3 + (set! s5-1 v1-3) + ) + (else + (let ((s4-1 (handle->process (-> obj poi-handle)))) + (set! s5-1 (if (type? s4-1 process-focusable) + s4-1 + ) + ) + ) + (cond + (s5-1 + (empty) + ) + ((begin (set! s5-1 (select-focus! obj)) s5-1) + (empty) ) - ) - (else - (clear-focused (-> obj focus)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) - ) - ) - s5-1 + (else + (set! s5-1 *target*) + ) + ) + ) + ) + ) ) + (cond + (s5-1 + (try-update-focus (-> obj focus) (the-as process-focusable s5-1) obj) + (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> s5-1 type) target)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + (else + (clear-focused (-> obj focus)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + s5-1 ) ) ) @@ -490,11 +488,9 @@ ) (defmethod ashelin-method-235 ashelin ((obj ashelin) (arg0 symbol)) - (with-pp - (and (>= (- (-> pp clock frame-counter) (-> obj last-fire-time)) (seconds 1)) - (and (>= 8556.089 (fabs (-> obj focus-info ry-diff))) (ashelin-method-238 obj arg0 #t)) - ) - ) + (and (>= (- (current-time) (-> obj last-fire-time)) (seconds 1)) + (and (>= 8556.089 (fabs (-> obj focus-info ry-diff))) (ashelin-method-238 obj arg0 #t)) + ) ) (defmethod ashelin-method-243 ashelin ((obj ashelin) (arg0 float)) @@ -735,31 +731,29 @@ ;; WARN: Return type mismatch (pointer process) vs none. (defmethod fire-projectile ashelin ((obj ashelin) (arg0 vector)) - (with-pp - (set! (-> obj last-fire-time) (-> pp clock frame-counter)) - (+! (-> obj fired-gun-count) 1) - (let ((s4-0 (new 'stack-no-clear 'projectile-init-by-other-params))) - (set! (-> s4-0 ent) (-> obj entity)) - (set! (-> s4-0 charge) 1.0) - (set! (-> s4-0 options) (projectile-options account-for-target-velocity proj-options-8000)) - (set! (-> s4-0 notify-handle) (process->handle obj)) - (set! (-> s4-0 owner-handle) (the-as handle #f)) - (set! (-> s4-0 ignore-handle) (process->handle obj)) - (let* ((v1-13 *game-info*) - (a0-10 (+ (-> v1-13 attack-id) 1)) - ) - (set! (-> v1-13 attack-id) a0-10) - (set! (-> s4-0 attack-id) a0-10) - ) - (set! (-> s4-0 timeout) (seconds 4)) - (vector<-cspace! (-> s4-0 pos) (-> obj node-list data 22)) - (set! (-> s4-0 vel quad) (-> arg0 quad)) - (vector-! (-> s4-0 vel) (-> s4-0 vel) (-> s4-0 pos)) - (vector-normalize! (-> s4-0 vel) 307200.0) - (spawn-projectile ashelin-shot s4-0 obj *default-dead-pool*) + (set! (-> obj last-fire-time) (current-time)) + (+! (-> obj fired-gun-count) 1) + (let ((s4-0 (new 'stack-no-clear 'projectile-init-by-other-params))) + (set! (-> s4-0 ent) (-> obj entity)) + (set! (-> s4-0 charge) 1.0) + (set! (-> s4-0 options) (projectile-options account-for-target-velocity proj-options-8000)) + (set! (-> s4-0 notify-handle) (process->handle obj)) + (set! (-> s4-0 owner-handle) (the-as handle #f)) + (set! (-> s4-0 ignore-handle) (process->handle obj)) + (let* ((v1-13 *game-info*) + (a0-10 (+ (-> v1-13 attack-id) 1)) + ) + (set! (-> v1-13 attack-id) a0-10) + (set! (-> s4-0 attack-id) a0-10) ) - (none) + (set! (-> s4-0 timeout) (seconds 4)) + (vector<-cspace! (-> s4-0 pos) (-> obj node-list data 22)) + (set! (-> s4-0 vel quad) (-> arg0 quad)) + (vector-! (-> s4-0 vel) (-> s4-0 vel) (-> s4-0 pos)) + (vector-normalize! (-> s4-0 vel) 307200.0) + (spawn-projectile ashelin-shot s4-0 obj *default-dead-pool*) ) + (none) ) (defmethod ashelin-method-249 ashelin ((obj ashelin)) @@ -1343,37 +1337,29 @@ ) (defmethod ashelin-method-245 ashelin ((obj ashelin)) - (with-pp - (when (and (not (channel-active? obj (the-as uint 0))) - (>= (-> pp clock frame-counter) (-> obj victory-speech-time)) - ) - (let ((s5-0 (bot-speech-list-method-9 - (-> obj ash-course victory-speeches) - obj - (-> obj ash-course speeches) - (speech-flags) - ) + (when (and (not (channel-active? obj (the-as uint 0))) (>= (current-time) (-> obj victory-speech-time))) + (let ((s5-0 (bot-speech-list-method-9 + (-> obj ash-course victory-speeches) + obj + (-> obj ash-course speeches) + (speech-flags) ) - ) - (when (>= s5-0 0) - (set! (-> obj victory-speech-time) - (the-as time-frame (+ (get-rand-int-range obj 1200 2100) (-> pp clock frame-counter))) ) - (play-speech obj s5-0) ) + (when (>= s5-0 0) + (set! (-> obj victory-speech-time) (the-as time-frame (+ (get-rand-int-range obj 1200 2100) (current-time)))) + (play-speech obj s5-0) ) ) - (none) ) + (none) ) (defmethod enemy-method-136 ashelin ((obj ashelin)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> obj hit-focus-time)) (seconds 2)) - (let ((v0-0 (logclear (-> obj enemy-flags) (enemy-flag look-at-focus)))) - (set! (-> obj enemy-flags) v0-0) - v0-0 - ) + (when (>= (- (current-time) (-> obj hit-focus-time)) (seconds 2)) + (let ((v0-0 (logclear (-> obj enemy-flags) (enemy-flag look-at-focus)))) + (set! (-> obj enemy-flags) v0-0) + v0-0 ) ) ) diff --git a/goal_src/jak2/characters/sig/sig-states.gc b/goal_src/jak2/characters/sig/sig-states.gc index 4676a44289..7777cd6405 100644 --- a/goal_src/jak2/characters/sig/sig-states.gc +++ b/goal_src/jak2/characters/sig/sig-states.gc @@ -11,7 +11,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -71,7 +71,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -174,7 +174,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -217,7 +217,7 @@ ) ) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (or (not (-> self focus-info fproc)) (>= (-> self focus-info bullseye-xz-dist) 102400.0)) ) (go-virtual waiting-far) @@ -305,7 +305,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -496,7 +496,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -648,7 +648,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -680,7 +680,7 @@ ) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) (zero? (-> self played-unjam-time))) - (set! (-> self played-unjam-time) (-> self clock frame-counter)) + (set! (-> self played-unjam-time) (current-time)) (sound-play "sig-gun-unjam") ) (none) @@ -707,7 +707,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -723,7 +723,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -738,7 +738,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -753,7 +753,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -768,7 +768,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -783,7 +783,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -799,7 +799,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -815,7 +815,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -831,7 +831,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -939,7 +939,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -973,12 +973,10 @@ ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) (go-virtual waiting-close) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -1011,7 +1009,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1039,7 +1037,7 @@ ((sig-method-255 self) (go-virtual repair-gun) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + ((and (>= (- (current-time) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) (go-virtual traveling) ) ) @@ -1081,7 +1079,7 @@ ) :trans (behavior () (bot-method-223 self #f) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (when (bot-method-214 self) (cond ((sig-method-246 self) @@ -1322,7 +1320,7 @@ (seconds 0.05) ) (bot-method-223 self #t) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (or (not (bot-method-214 self)) (not (sig-method-245 self))) ) (react-to-focus self) @@ -1365,9 +1363,7 @@ :trans (behavior () (bot-method-223 self #t) (cond - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ((not (bot-method-214 self)) @@ -1439,7 +1435,7 @@ 0.0 #f ) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.167)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.167)) (sig-method-258 self) (suspend) ) @@ -1469,7 +1465,7 @@ ) ) ) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.8)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.8)) (sig-method-258 self) (suspend) ) @@ -1616,7 +1612,7 @@ (ja :num! (seek!)) ) (ja-channel-push! 1 (seconds 0.2)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (ja-no-eval :group! (-> self draw art-group data 4) :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) frames num-frames) -1))) @@ -1624,7 +1620,7 @@ ) (until (ja-done? 0) (if (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (reset? *fail-mission-control*) ) (reset! *fail-mission-control*) @@ -1642,7 +1638,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1704,7 +1700,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1734,7 +1730,7 @@ (if (logtest? s5-0 2) (go-virtual sig-path-shoot-jump) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) (not (logtest? s5-0 4))) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.05)) (not (logtest? s5-0 4))) (go-virtual sig-path-jump-land) ) ) @@ -1776,7 +1772,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1845,7 +1841,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1876,7 +1872,7 @@ (if (and (logtest? s5-0 1) (logtest? (bot-flags bf25) (-> self bot-flags))) (go-virtual sig-path-jump) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) (not (logtest? s5-0 4))) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.05)) (not (logtest? s5-0 4))) (go-virtual sig-path-shoot-jump-land) ) ) @@ -1923,7 +1919,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1992,7 +1988,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) diff --git a/goal_src/jak2/characters/sig/sig-task.gc b/goal_src/jak2/characters/sig/sig-task.gc index eae6216837..31bc17e4f5 100644 --- a/goal_src/jak2/characters/sig/sig-task.gc +++ b/goal_src/jak2/characters/sig/sig-task.gc @@ -173,7 +173,7 @@ (set! (-> a1-3 message) 'sync) (let ((v1-19 (- ((method-of-type sync-info get-timeframe-offset!) (the-as sync-info (send-event-function s5-1 a1-3)) 0) - (-> pp clock frame-counter) + (current-time) ) ) ) @@ -268,7 +268,7 @@ (set! (-> a1-6 message) 'sync) (let ((v1-16 (- ((method-of-type sync-info get-timeframe-offset!) (the-as sync-info (send-event-function a0-4 a1-6)) 0) - (-> pp clock frame-counter) + (current-time) ) ) ) diff --git a/goal_src/jak2/characters/sig/sig.gc b/goal_src/jak2/characters/sig/sig.gc index 4cb8e93155..4a1ef486e0 100644 --- a/goal_src/jak2/characters/sig/sig.gc +++ b/goal_src/jak2/characters/sig/sig.gc @@ -235,122 +235,120 @@ ) (defmethod enemy-method-97 sig ((obj sig)) - (with-pp - (let* ((s5-0 (handle->process (-> obj attacker-handle))) - (s4-0 (if (type? s5-0 process-focusable) - s5-0 - ) - ) + (let* ((s5-0 (handle->process (-> obj attacker-handle))) + (s4-0 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when s4-0 + (cond + ((= (-> s4-0 type) target) + (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) + (>= (- (current-time) (-> obj attacker-time)) (seconds 1.5)) + ) + (if (logtest? (-> obj bot-flags) (bot-flags attacked)) + (reset-attacker! obj) + ) + (set! s4-0 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) - (when s4-0 - (cond - ((= (-> s4-0 type) target) - (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) - (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 1.5)) + ) + (else + (when (>= (- (current-time) (-> obj attacker-time)) (seconds 6)) + (set! s4-0 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) + ) + ) + ) + ) + (let ((v1-23 (-> obj focus-mode)) + (s5-1 (the-as process #f)) + ) + (cond + ((zero? v1-23) + (cond + (s4-0 + (if (or (not (logtest? (bot-flags bf19) (-> obj bot-flags))) + (>= 16384.0 + (vector-vector-xz-distance (-> obj root-override2 trans) (get-trans (the-as process-focusable s4-0) 3)) + ) ) - (if (logtest? (-> obj bot-flags) (bot-flags attacked)) - (reset-attacker! obj) + (set! s5-1 s4-0) ) - (set! s4-0 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) + ) + (else + (when (not (logtest? (bot-flags bf19) (-> obj bot-flags))) + (set! s5-1 (select-focus! obj)) + (cond + (s5-1 + (empty) + ) + (else + (let ((s4-1 (handle->process (-> obj poi-handle)))) + (set! s5-1 (if (type? s4-1 process-focusable) + s4-1 + ) + ) + ) + (if s5-1 + (empty) + (set! s5-1 *target*) + ) + ) + ) + ) ) ) - (else - (when (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 6)) - (set! s4-0 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) + ) + ((= v1-23 1) + (cond + (s4-0 + (if (or (not (logtest? (bot-flags bf19) (-> obj bot-flags))) + (>= 16384.0 + (vector-vector-xz-distance (-> obj root-override2 trans) (get-trans (the-as process-focusable s4-0) 3)) + ) + ) + (set! s5-1 s4-0) + ) + ) + (else + (when (not (logtest? (bot-flags bf19) (-> obj bot-flags))) + (let ((s4-2 (handle->process (-> obj poi-handle)))) + (set! s5-1 (if (type? s4-2 process-focusable) + s4-2 + ) + ) + ) + (cond + (s5-1 + (empty) + ) + ((begin (set! s5-1 (select-focus! obj)) s5-1) + (empty) + ) + (else + (set! s5-1 *target*) + ) + ) + ) + ) + ) + ) + ) + (cond + (s5-1 + (try-update-focus (-> obj focus) (the-as process-focusable s5-1) obj) + (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> (the-as process-focusable s5-1) type) target)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) ) - ) + ) + (else + (clear-focused (-> obj focus)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) ) ) - (let ((v1-23 (-> obj focus-mode)) - (s5-1 (the-as process #f)) - ) - (cond - ((zero? v1-23) - (cond - (s4-0 - (if (or (not (logtest? (bot-flags bf19) (-> obj bot-flags))) - (>= 16384.0 - (vector-vector-xz-distance (-> obj root-override2 trans) (get-trans (the-as process-focusable s4-0) 3)) - ) - ) - (set! s5-1 s4-0) - ) - ) - (else - (when (not (logtest? (bot-flags bf19) (-> obj bot-flags))) - (set! s5-1 (select-focus! obj)) - (cond - (s5-1 - (empty) - ) - (else - (let ((s4-1 (handle->process (-> obj poi-handle)))) - (set! s5-1 (if (type? s4-1 process-focusable) - s4-1 - ) - ) - ) - (if s5-1 - (empty) - (set! s5-1 *target*) - ) - ) - ) - ) - ) - ) - ) - ((= v1-23 1) - (cond - (s4-0 - (if (or (not (logtest? (bot-flags bf19) (-> obj bot-flags))) - (>= 16384.0 - (vector-vector-xz-distance (-> obj root-override2 trans) (get-trans (the-as process-focusable s4-0) 3)) - ) - ) - (set! s5-1 s4-0) - ) - ) - (else - (when (not (logtest? (bot-flags bf19) (-> obj bot-flags))) - (let ((s4-2 (handle->process (-> obj poi-handle)))) - (set! s5-1 (if (type? s4-2 process-focusable) - s4-2 - ) - ) - ) - (cond - (s5-1 - (empty) - ) - ((begin (set! s5-1 (select-focus! obj)) s5-1) - (empty) - ) - (else - (set! s5-1 *target*) - ) - ) - ) - ) - ) - ) - ) - (cond - (s5-1 - (try-update-focus (-> obj focus) (the-as process-focusable s5-1) obj) - (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> (the-as process-focusable s5-1) type) target)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) - ) - ) - (else - (clear-focused (-> obj focus)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) - ) - ) - s5-1 - ) + s5-1 ) ) ) @@ -389,68 +387,64 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (with-pp - (let ((v1-2 (-> obj skel top-anim frame-group))) - (cond - ((>= (- (-> pp clock frame-counter) (-> obj danger-time)) (seconds 2)) - (cond - ((not v1-2) - (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 42)) + (let ((v1-2 (-> obj skel top-anim frame-group))) + (cond + ((>= (- (current-time) (-> obj danger-time)) (seconds 2)) + (cond + ((not v1-2) + (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 42)) + ) + ((= v1-2 (-> obj draw art-group data 44)) + (push-anim-to-targ + (-> obj skel top-anim) + (the-as art-joint-anim (-> obj draw art-group data 46)) + 0.0 + 0 + 0 + 1.0 + 0.0 + #f ) - ((= v1-2 (-> obj draw art-group data 44)) - (push-anim-to-targ - (-> obj skel top-anim) - (the-as art-joint-anim (-> obj draw art-group data 46)) - 0.0 - 0 - 0 - 1.0 - 0.0 - #f - ) - (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 42)) - ) - ) + (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 42)) + ) ) - (else - (cond - ((not v1-2) - (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 44)) + ) + (else + (cond + ((not v1-2) + (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 44)) + ) + ((= v1-2 (-> obj draw art-group data 42)) + (push-anim-to-targ + (-> obj skel top-anim) + (the-as art-joint-anim (-> obj draw art-group data 43)) + 0.0 + 0 + 0 + 1.0 + 0.0 + #f ) - ((= v1-2 (-> obj draw art-group data 42)) - (push-anim-to-targ - (-> obj skel top-anim) - (the-as art-joint-anim (-> obj draw art-group data 43)) - 0.0 - 0 - 0 - 1.0 - 0.0 - #f - ) - (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 44)) - ) - ) + (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 44)) + ) ) ) ) - (let ((t9-2 (method-of-type bot track-target!))) - (t9-2 obj) - ) - (when (logtest? (-> obj bot-flags) (bot-flags too-far-fail)) - (let ((f0-0 (vector-vector-distance (-> obj root-override2 trans) (target-pos 0)))) - (when (or (>= f0-0 491520.0) - (and (>= f0-0 102400.0) (>= (- (-> pp clock frame-counter) (-> obj last-draw-time)) (seconds 10))) - ) - (process-entity-status! obj (entity-perm-status no-kill) #f) - (cleanup-for-death obj) - (go (method-of-object obj die-fast)) - ) - ) - ) - (sig-plasma-method-14 (-> obj plasma) obj) - (none) ) + (let ((t9-2 (method-of-type bot track-target!))) + (t9-2 obj) + ) + (when (logtest? (-> obj bot-flags) (bot-flags too-far-fail)) + (let ((f0-0 (vector-vector-distance (-> obj root-override2 trans) (target-pos 0)))) + (when (or (>= f0-0 491520.0) (and (>= f0-0 102400.0) (>= (- (current-time) (-> obj last-draw-time)) (seconds 10)))) + (process-entity-status! obj (entity-perm-status no-kill) #f) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + ) + ) + (sig-plasma-method-14 (-> obj plasma) obj) + (none) ) (defmethod go-to-waypoint! sig ((obj sig) (arg0 int) (arg1 symbol)) diff --git a/goal_src/jak2/characters/underground_fighters/shuttle.gc b/goal_src/jak2/characters/underground_fighters/shuttle.gc index ffc992ef1d..d8b5fc8d90 100644 --- a/goal_src/jak2/characters/underground_fighters/shuttle.gc +++ b/goal_src/jak2/characters/underground_fighters/shuttle.gc @@ -406,7 +406,7 @@ (set! (-> self gnd-height) (-> self root-override2 gspot-pos y)) (logior! (-> self flags) (citizen-flag persistent)) (set! (-> self focus-status) (logior (focus-status pilot-riding pilot) (-> self focus-status))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-31 (-> self root-override2 root-prim))) (set! (-> v1-31 prim-core collide-as) (collide-spec)) (set! (-> v1-31 prim-core collide-with) (collide-spec)) @@ -438,7 +438,7 @@ (let ((gp-0 (new 'stack-no-clear 'vector)) (s5-0 (new 'stack-no-clear 'quaternion)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (while (not (civilian-method-217 self gp-0)) (let ((s4-0 (handle->process (-> self vehicle))) (s3-0 (new 'stack-no-clear 'quaternion)) @@ -447,7 +447,7 @@ (compute-seat-position (the-as vehicle s4-0) (-> self root-override2 trans) (-> self seat)) (quaternion-copy! (-> self root-override2 quat) s3-0) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (when (>= (- (current-time) (-> self state-time)) (seconds 2)) (put-rider-in-seat (the-as vehicle (handle->process (-> self vehicle))) (-> self seat) self) (go-virtual ride) ) @@ -1076,246 +1076,244 @@ ;; 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)) - (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (cond - ((nonzero? (-> arg0 data-int32 9)) - (check-time arg0) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) ) - (else - (set! (-> arg0 start-time) (-> pp clock frame-counter)) - (when (< (vector-vector-xz-distance (target-pos 0) (-> arg0 begin-pos)) 102400.0) - (set-setting! 'airlock #f 0.0 0) - (set! (-> arg0 data-int32 9) 1) - ) + (init-vf0-vector) + (cond + ((nonzero? (-> arg0 data-int32 9)) + (check-time arg0) + ) + (else + (set! (-> arg0 start-time) (current-time)) + (when (< (vector-vector-xz-distance (target-pos 0) (-> arg0 begin-pos)) 102400.0) + (set-setting! 'airlock #f 0.0 0) + (set! (-> arg0 data-int32 9) 1) ) ) - (when (= (-> arg0 data-int32 10) (+ (-> arg0 sub-state) -1)) - (let ((s3-1 (handle->process (-> arg0 slave (logand -2 (-> arg0 data-int32 10)))))) - (when s3-1 - (let ((v1-20 (-> arg0 data-int32 10))) - (cond - ((zero? v1-20) - (let ((v0-4 (rand-vu-int-count 3))) - (cond - ((zero? v0-4) - (send-event s3-1 'play-speech "agnt038") - ) - ((= v0-4 1) - (send-event s3-1 'play-speech "agnt039") - ) - ((= v0-4 2) - (send-event s3-1 'play-speech "agnt040") - ) - ) + ) + (when (= (-> arg0 data-int32 10) (+ (-> arg0 sub-state) -1)) + (let ((s3-1 (handle->process (-> arg0 slave (logand -2 (-> arg0 data-int32 10)))))) + (when s3-1 + (let ((v1-20 (-> arg0 data-int32 10))) + (cond + ((zero? v1-20) + (let ((v0-4 (rand-vu-int-count 3))) + (cond + ((zero? v0-4) + (send-event s3-1 'play-speech "agnt038") + ) + ((= v0-4 1) + (send-event s3-1 'play-speech "agnt039") + ) + ((= v0-4 2) + (send-event s3-1 'play-speech "agnt040") + ) ) ) - ((= v1-20 1) - (let ((v0-8 (rand-vu-int-count 4))) - (cond - ((zero? v0-8) - (send-event s3-1 'play-speech "agnt045") - ) - ((= v0-8 1) - (send-event s3-1 'play-speech "agnt046") - ) - ((= v0-8 2) - (send-event s3-1 'play-speech "agnt047") - ) - ((= v0-8 3) - (send-event s3-1 'play-speech "agnt048") - ) - ) + ) + ((= v1-20 1) + (let ((v0-8 (rand-vu-int-count 4))) + (cond + ((zero? v0-8) + (send-event s3-1 'play-speech "agnt045") + ) + ((= v0-8 1) + (send-event s3-1 'play-speech "agnt046") + ) + ((= v0-8 2) + (send-event s3-1 'play-speech "agnt047") + ) + ((= v0-8 3) + (send-event s3-1 'play-speech "agnt048") + ) ) ) - ((= v1-20 2) - (let ((v0-13 (rand-vu-int-count 4))) - (cond - ((zero? v0-13) - (send-event s3-1 'play-speech "agnt092") - ) - ((= v0-13 1) - (send-event s3-1 'play-speech "agnt093") - ) - ((= v0-13 2) - (send-event s3-1 'play-speech "agnt094") - ) - ((= v0-13 3) - (send-event s3-1 'play-speech "agnt095") - ) - ) + ) + ((= v1-20 2) + (let ((v0-13 (rand-vu-int-count 4))) + (cond + ((zero? v0-13) + (send-event s3-1 'play-speech "agnt092") + ) + ((= v0-13 1) + (send-event s3-1 'play-speech "agnt093") + ) + ((= v0-13 2) + (send-event s3-1 'play-speech "agnt094") + ) + ((= v0-13 3) + (send-event s3-1 'play-speech "agnt095") + ) ) ) - ((= v1-20 3) - (let ((v0-18 (rand-vu-int-count 3))) - (cond - ((zero? v0-18) - (send-event s3-1 'play-speech "agnt100") - ) - ((= v0-18 1) - (send-event s3-1 'play-speech "agnt101") - ) - ((= v0-18 2) - (send-event s3-1 'play-speech "agnt102") - ) - ) + ) + ((= v1-20 3) + (let ((v0-18 (rand-vu-int-count 3))) + (cond + ((zero? v0-18) + (send-event s3-1 'play-speech "agnt100") + ) + ((= v0-18 1) + (send-event s3-1 'play-speech "agnt101") + ) + ((= v0-18 2) + (send-event s3-1 'play-speech "agnt102") + ) ) ) - ((= v1-20 4) - (let ((v0-22 (rand-vu-int-count 3))) - (cond - ((zero? v0-22) - (send-event s3-1 'play-speech "agnt115") - ) - ((= v0-22 1) - (send-event s3-1 'play-speech "agnt121") - ) - ((= v0-22 2) - (send-event s3-1 'play-speech "agnt122") - ) - ) + ) + ((= v1-20 4) + (let ((v0-22 (rand-vu-int-count 3))) + (cond + ((zero? v0-22) + (send-event s3-1 'play-speech "agnt115") + ) + ((= v0-22 1) + (send-event s3-1 'play-speech "agnt121") + ) + ((= v0-22 2) + (send-event s3-1 'play-speech "agnt122") + ) ) ) - ((= v1-20 5) - (let ((v0-26 (rand-vu-int-count 3))) - (cond - ((zero? v0-26) - (send-event s3-1 'play-speech "agnt119") - ) - ((= v0-26 1) - (send-event s3-1 'play-speech "agnt120") - ) - ((= v0-26 2) - (send-event s3-1 'play-speech "agnt125") - ) - ) + ) + ((= v1-20 5) + (let ((v0-26 (rand-vu-int-count 3))) + (cond + ((zero? v0-26) + (send-event s3-1 'play-speech "agnt119") + ) + ((= v0-26 1) + (send-event s3-1 'play-speech "agnt120") + ) + ((= v0-26 2) + (send-event s3-1 'play-speech "agnt125") + ) ) ) - ((= v1-20 6) - (let ((v0-30 (rand-vu-int-count 5))) - (cond - ((zero? v0-30) - (send-event s3-1 'play-speech "agnt131") - ) - ((= v0-30 1) - (send-event s3-1 'play-speech "agnt132") - ) - ((= v0-30 2) - (send-event s3-1 'play-speech "agnt133") - ) - ((= v0-30 3) - (send-event s3-1 'play-speech "agnt126") - ) - ((= v0-30 4) - (send-event s3-1 'play-speech "agnt127") - ) - ) + ) + ((= v1-20 6) + (let ((v0-30 (rand-vu-int-count 5))) + (cond + ((zero? v0-30) + (send-event s3-1 'play-speech "agnt131") + ) + ((= v0-30 1) + (send-event s3-1 'play-speech "agnt132") + ) + ((= v0-30 2) + (send-event s3-1 'play-speech "agnt133") + ) + ((= v0-30 3) + (send-event s3-1 'play-speech "agnt126") + ) + ((= v0-30 4) + (send-event s3-1 'play-speech "agnt127") + ) ) ) - ((= v1-20 7) - (let ((v0-36 (rand-vu-int-count 2))) - (cond - ((zero? v0-36) - (send-event s3-1 'play-speech "agnt135") - ) - ((= v0-36 1) - (send-event s3-1 'play-speech "agnt130") - ) - ) + ) + ((= v1-20 7) + (let ((v0-36 (rand-vu-int-count 2))) + (cond + ((zero? v0-36) + (send-event s3-1 'play-speech "agnt135") + ) + ((= v0-36 1) + (send-event s3-1 'play-speech "agnt130") + ) ) ) - ) + ) ) - (+! (-> arg0 data-int32 10) 1) ) + (+! (-> arg0 data-int32 10) 1) ) ) - (let ((s3-2 (-> arg0 sub-state))) - (cond - ((>= s3-2 (the-as uint (-> arg0 count))) - (go (method-of-object arg0 complete)) - ) - ((not (logtest? s3-2 1)) - (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 - ) - ) - ) - (cond - (s4-1 - (when (focus-test? (the-as citizen-rebel s2-0) inactive) - (let ((s1-1 (new 'stack 'traffic-object-spawn-params))) - (set! (-> s1-1 object-type) (traffic-type tt5)) - (set! (-> s1-1 behavior) (the-as uint 7)) - (set! (-> s1-1 id) (the-as uint 0)) - (set! (-> s1-1 nav-mesh) #f) - (set! (-> s1-1 nav-branch) #f) - (set! (-> s1-1 proc) #f) - (set! (-> s1-1 handle) (-> arg0 slave s3-2)) - (set! (-> s1-1 user-data) (the-as uint 0)) - (set! (-> s1-1 flags) (traffic-spawn-flags)) - (set! (-> s1-1 guard-type) (the-as uint 7)) - (vector-reset! (-> s1-1 velocity)) - (set! (-> s1-1 position quad) (-> (the-as citizen-rebel s2-0) root-override2 trans quad)) - (quaternion-copy! (-> s1-1 rotation) (-> (the-as citizen-rebel s2-0) root-override2 quat)) - (set! (-> s1-1 nav-mesh) (-> s4-1 nav-mesh)) - (activate-by-handle *traffic-engine* s1-1) - ) + ) + (let ((s3-2 (-> arg0 sub-state))) + (cond + ((>= s3-2 (the-as uint (-> arg0 count))) + (go (method-of-object arg0 complete)) + ) + ((not (logtest? s3-2 1)) + (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 + ) + ) + ) + (cond + (s4-1 + (when (focus-test? (the-as citizen-rebel s2-0) inactive) + (let ((s1-1 (new 'stack 'traffic-object-spawn-params))) + (set! (-> s1-1 object-type) (traffic-type tt5)) + (set! (-> s1-1 behavior) (the-as uint 7)) + (set! (-> s1-1 id) (the-as uint 0)) + (set! (-> s1-1 nav-mesh) #f) + (set! (-> s1-1 nav-branch) #f) + (set! (-> s1-1 proc) #f) + (set! (-> s1-1 handle) (-> arg0 slave s3-2)) + (set! (-> s1-1 user-data) (the-as uint 0)) + (set! (-> s1-1 flags) (traffic-spawn-flags)) + (set! (-> s1-1 guard-type) (the-as uint 7)) + (vector-reset! (-> s1-1 velocity)) + (set! (-> s1-1 position quad) (-> (the-as citizen-rebel s2-0) root-override2 trans quad)) + (quaternion-copy! (-> s1-1 rotation) (-> (the-as citizen-rebel s2-0) root-override2 quat)) + (set! (-> s1-1 nav-mesh) (-> s4-1 nav-mesh)) + (activate-by-handle *traffic-engine* s1-1) ) - (let ((v1-230 *target*)) - (when (and v1-230 (focus-test? v1-230 pilot)) - (let ((s4-2 (handle->process (-> v1-230 pilot vehicle)))) - (when s4-2 - (cond - ((and (focus-test? (the-as citizen-rebel s2-0) pilot) - (handle->process (-> (the-as citizen-rebel s2-0) vehicle)) - ) - (send-event (handle->process (-> arg0 arrow)) 'set-position (-> arg1 (+ s3-2 1) pos)) - (+! (-> arg0 sub-state) 1) - (set! (-> arg0 time-limit) (+ (-> arg1 s3-2 time) (-> arg1 (+ s3-2 1) time))) - ) - (else - (let ((v1-260 (get-best-seat-for-vehicle - (the-as vehicle s4-2) - (-> (the-as vehicle s4-2) root-override-2 trans) - (the-as int (-> (the-as citizen-rebel s2-0) info seat-flag)) - 1 - ) + ) + (let ((v1-230 *target*)) + (when (and v1-230 (focus-test? v1-230 pilot)) + (let ((s4-2 (handle->process (-> v1-230 pilot vehicle)))) + (when s4-2 + (cond + ((and (focus-test? (the-as citizen-rebel s2-0) pilot) + (handle->process (-> (the-as citizen-rebel s2-0) vehicle)) + ) + (send-event (handle->process (-> arg0 arrow)) 'set-position (-> arg1 (+ s3-2 1) pos)) + (+! (-> arg0 sub-state) 1) + (set! (-> arg0 time-limit) (+ (-> arg1 s3-2 time) (-> arg1 (+ s3-2 1) time))) + ) + (else + (let ((v1-260 (get-best-seat-for-vehicle + (the-as vehicle s4-2) + (-> (the-as vehicle s4-2) root-override-2 trans) + (the-as int (-> (the-as citizen-rebel s2-0) info seat-flag)) + 1 ) - ) - (when (!= v1-260 -1) - (.lvf vf1 (&-> (-> (the-as vehicle s4-2) root-override-2 transv) quad)) - (.add.w.vf vf2 vf0 vf0 :mask #b1) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf acc vf2 vf1 :mask #b1) - (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) - (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) - (.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-override-2 trans) - (-> (the-as citizen-rebel s2-0) root-override2 trans) - ) + ) + ) + (when (!= v1-260 -1) + (.lvf vf1 (&-> (-> (the-as vehicle s4-2) root-override-2 transv) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.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-override-2 trans) + (-> (the-as citizen-rebel s2-0) root-override2 trans) ) - (f1-4 65536.0) - ) - (< f0-2 (* f1-4 f1-4)) - ) - ) - (send-event s2-0 'board-vehicle s4-2) - ) - ) + ) + (f1-4 65536.0) + ) + (< f0-2 (* f1-4 f1-4)) + ) + ) + (send-event s2-0 'board-vehicle s4-2) + ) ) ) ) @@ -1325,66 +1323,66 @@ ) ) ) - (else - (if (not (focus-test? (the-as citizen-rebel s2-0) inactive)) - (send-event s2-0 'traffic-off-force) - ) - ) ) - ) - (if (and (-> s2-0 next-state) (= (-> s2-0 next-state name) 'wait-for-ride)) - (send-event - (handle->process (-> arg0 arrow)) - 'set-position - (-> (the-as citizen-rebel s2-0) root-override2 trans) - ) - ) - ) - (else - (when (zero? (-> arg0 data-int32 s3-2)) - (send-event (handle->process (-> arg0 arrow)) 'set-position (-> arg1 s3-2 pos)) - (set! (-> arg0 time-limit) (-> arg1 s3-2 time)) - (set! (-> arg0 start-time) (-> pp clock frame-counter)) - (set! (-> arg0 data-int32 s3-2) 1) - ) - (let ((s1-2 (find-nearest-nav-mesh (-> arg1 s3-2 pos) (the-as float #x7f800000)))) - (when (and s1-2 (nonzero? s1-2)) - (let ((s2-1 (new 'stack 'traffic-object-spawn-params))) - (set! (-> s2-1 object-type) (traffic-type tt5)) - (set! (-> s2-1 behavior) (the-as uint 7)) - (set! (-> s2-1 id) (the-as uint 0)) - (set! (-> s2-1 nav-mesh) #f) - (set! (-> s2-1 nav-branch) #f) - (set! (-> s2-1 proc) #f) - (set! (-> s2-1 handle) (the-as handle #f)) - (set! (-> s2-1 user-data) (the-as uint 0)) - (set! (-> s2-1 flags) (traffic-spawn-flags)) - (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) - ) + (else + (if (not (focus-test? (the-as citizen-rebel s2-0) inactive)) + (send-event s2-0 'traffic-off-force) ) - (logior! (-> s2-1 flags) (traffic-spawn-flags trsflags-00)) - (set! (-> s2-1 id) (the-as uint 122)) - (set! (-> s2-1 proc) #f) - (let ((v0-58 (citizen-spawn arg0 citizen-rebel s2-1))) - (cond - (v0-58 - (set! (-> (the-as citizen-rebel v0-58) end-pos quad) (-> arg1 (+ s3-2 1) pos quad)) - (set! (-> arg0 slave s3-2) (process->handle (the-as citizen-rebel v0-58))) - (logior! (-> (the-as citizen-rebel v0-58) flags) (citizen-flag persistent)) - (set! (-> (the-as citizen-rebel v0-58) task-node) arg2) - (set! (-> (the-as citizen-rebel v0-58) nav-mesh-aid) (the-as actor-id (-> s1-2 entity aid))) - (set! (-> (the-as citizen-rebel v0-58) done?) #f) - (set! (-> (the-as citizen-rebel v0-58) index) s3-2) - (send-event *traffic-manager* 'add-object (-> s2-1 object-type) (the-as citizen-rebel v0-58)) - ) - (else - ) + ) + ) + ) + (if (and (-> s2-0 next-state) (= (-> s2-0 next-state name) 'wait-for-ride)) + (send-event + (handle->process (-> arg0 arrow)) + 'set-position + (-> (the-as citizen-rebel s2-0) root-override2 trans) + ) + ) + ) + (else + (when (zero? (-> arg0 data-int32 s3-2)) + (send-event (handle->process (-> arg0 arrow)) 'set-position (-> arg1 s3-2 pos)) + (set! (-> arg0 time-limit) (-> arg1 s3-2 time)) + (set! (-> arg0 start-time) (current-time)) + (set! (-> arg0 data-int32 s3-2) 1) + ) + (let ((s1-2 (find-nearest-nav-mesh (-> arg1 s3-2 pos) (the-as float #x7f800000)))) + (when (and s1-2 (nonzero? s1-2)) + (let ((s2-1 (new 'stack 'traffic-object-spawn-params))) + (set! (-> s2-1 object-type) (traffic-type tt5)) + (set! (-> s2-1 behavior) (the-as uint 7)) + (set! (-> s2-1 id) (the-as uint 0)) + (set! (-> s2-1 nav-mesh) #f) + (set! (-> s2-1 nav-branch) #f) + (set! (-> s2-1 proc) #f) + (set! (-> s2-1 handle) (the-as handle #f)) + (set! (-> s2-1 user-data) (the-as uint 0)) + (set! (-> s2-1 flags) (traffic-spawn-flags)) + (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) + ) + ) + (logior! (-> s2-1 flags) (traffic-spawn-flags trsflags-00)) + (set! (-> s2-1 id) (the-as uint 122)) + (set! (-> s2-1 proc) #f) + (let ((v0-58 (citizen-spawn arg0 citizen-rebel s2-1))) + (cond + (v0-58 + (set! (-> (the-as citizen-rebel v0-58) end-pos quad) (-> arg1 (+ s3-2 1) pos quad)) + (set! (-> arg0 slave s3-2) (process->handle (the-as citizen-rebel v0-58))) + (logior! (-> (the-as citizen-rebel v0-58) flags) (citizen-flag persistent)) + (set! (-> (the-as citizen-rebel v0-58) task-node) arg2) + (set! (-> (the-as citizen-rebel v0-58) nav-mesh-aid) (the-as actor-id (-> s1-2 entity aid))) + (set! (-> (the-as citizen-rebel v0-58) done?) #f) + (set! (-> (the-as citizen-rebel v0-58) index) s3-2) + (send-event *traffic-manager* 'add-object (-> s2-1 object-type) (the-as citizen-rebel v0-58)) + ) + (else ) ) ) @@ -1394,57 +1392,57 @@ ) ) ) - (else - (let ((s4-3 (handle->process (-> arg0 slave (+ s3-2 -1))))) - (if (not s4-3) - (go (method-of-object arg0 fail)) - ) - (if (or (not *target*) (not (logtest? (focus-status pilot) (-> *target* focus-status)))) - (send-event s4-3 'exit-vehicle (-> (the-as process-drawable s4-3) root trans)) - ) - (when (-> *target* pilot) - (let ((s5-1 (-> arg1 s3-2 pos)) - (s2-2 (handle->process (-> *target* pilot vehicle))) - ) - (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)) - ) - (begin - (.lvf vf1 (&-> (-> (the-as process-drawable s2-2) root transv) quad)) - (.add.w.vf vf2 vf0 vf0 :mask #b1) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf acc vf2 vf1 :mask #b1) - (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) - (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) - (.mov v1-377 vf1) - (let ((f0-4 v1-377) - (f1-10 12288.0) - ) - (< f0-4 (* f1-10 f1-10)) + ) + (else + (let ((s4-3 (handle->process (-> arg0 slave (+ s3-2 -1))))) + (if (not s4-3) + (go (method-of-object arg0 fail)) + ) + (if (or (not *target*) (not (logtest? (focus-status pilot) (-> *target* focus-status)))) + (send-event s4-3 'exit-vehicle (-> (the-as process-drawable s4-3) root trans)) + ) + (when (-> *target* pilot) + (let ((s5-1 (-> arg1 s3-2 pos)) + (s2-2 (handle->process (-> *target* pilot vehicle))) + ) + (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)) + ) + (begin + (.lvf vf1 (&-> (-> (the-as process-drawable s2-2) root transv) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-377 vf1) + (let ((f0-4 v1-377) + (f1-10 12288.0) + ) + (< f0-4 (* f1-10 f1-10)) ) ) - (send-event s4-3 'exit-vehicle s5-1) - ) - ) - ((not (-> (the-as citizen-rebel s4-3) done?)) - (set! (-> arg0 data-int32 s3-2) 0) - (+! (-> arg0 sub-state) -1) - ) - ) + ) + (send-event s4-3 'exit-vehicle s5-1) + ) + ) + ((not (-> (the-as citizen-rebel s4-3) done?)) + (set! (-> arg0 data-int32 s3-2) 0) + (+! (-> arg0 sub-state) -1) + ) ) ) ) ) ) ) - (none) ) + (none) ) ) @@ -1574,8 +1572,8 @@ (while (zero? (-> self sub-state)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (send-event *traffic-manager* 'set-alert-level 2) @@ -1597,9 +1595,9 @@ TASK_MANAGER_COMPLETE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (talker-spawn-func (-> *talker-speech* 97) *entity-pool* (target-pos 0) (the-as region #f)) - (let ((gp-1 (-> self clock frame-counter))) + (let ((gp-1 (current-time))) (until #f (let ((v1-4 0)) (dotimes (a0-2 4) @@ -1609,7 +1607,7 @@ ) ) ) - (if (or (>= v1-4 4) (>= (- (-> self clock frame-counter) gp-1) (seconds 10))) + (if (or (>= v1-4 4) (>= (- (current-time) gp-1) (seconds 10))) (goto cfg-23) ) ) @@ -1750,8 +1748,8 @@ (while (zero? (-> self sub-state)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (send-event *traffic-manager* 'set-alert-level 2) @@ -1773,7 +1771,7 @@ TASK_MANAGER_COMPLETE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (let ((v1-2 0)) (dotimes (a0-0 4) diff --git a/goal_src/jak2/engine/ai/enemy.gc b/goal_src/jak2/engine/ai/enemy.gc index 8d506763ac..dcf2e3f6bd 100644 --- a/goal_src/jak2/engine/ai/enemy.gc +++ b/goal_src/jak2/engine/ai/enemy.gc @@ -294,70 +294,66 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (with-pp - (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (-> pp clock frame-counter)) - ) - (enemy-method-129 self) - (if (logtest? (enemy-flag use-trigger) (-> self enemy-flags)) - (enemy-method-100 self) - ) - (when *target* - (target-look-at-me! :trans (the-as vector (-> self root-override2 root-prim prim-core)) - :message (if (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance)) - 'attacking - )) + (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) + (set! (-> self last-draw-time) (current-time)) ) - (when (nonzero? (-> self neck)) - (when (logtest? (-> self enemy-flags) (enemy-flag lock-focus)) - (let ((a0-9 (handle->process (-> self focus handle)))) - (if a0-9 - (target-set! (-> self neck) (get-trans (the-as process-focusable a0-9) 2)) - ) - ) - ) + (enemy-method-129 self) + (if (logtest? (enemy-flag use-trigger) (-> self enemy-flags)) + (enemy-method-100 self) ) - (when (and (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) - (>= (- (-> pp clock frame-counter) (-> self auto-reset-penetrate-time)) (seconds 0.1)) - ) - (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) - (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) - (let ((v1-48 0)) - (if (logtest? (penetrate knocked) (-> self root-override2 penetrate-using)) - (set! v1-48 (logior (shl 1 32) v1-48)) - ) - (set! (-> self root-override2 penetrate-using) (the-as penetrate v1-48)) - ) - ) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (enemy-method-136 self) - ) - (if (logtest? (enemy-flag trackable-backup directed-ready) (-> self enemy-flags)) - (enemy-method-54 self) - ) - (if (and *debug-segment* (-> self enemy-info debug-draw-neck) (nonzero? (-> self neck))) - (joint-mod-debug-draw (-> self neck)) - ) - (ja-post) - 0 - (none) + (when *target* + (target-look-at-me! :trans (the-as vector (-> self root-override2 root-prim prim-core)) + :message (if (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance)) + 'attacking + )) ) + (when (nonzero? (-> self neck)) + (when (logtest? (-> self enemy-flags) (enemy-flag lock-focus)) + (let ((a0-9 (handle->process (-> self focus handle)))) + (if a0-9 + (target-set! (-> self neck) (get-trans (the-as process-focusable a0-9) 2)) + ) + ) + ) + ) + (when (and (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) + (>= (- (current-time) (-> self auto-reset-penetrate-time)) (seconds 0.1)) + ) + (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) + (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) + (let ((v1-48 0)) + (if (logtest? (penetrate knocked) (-> self root-override2 penetrate-using)) + (set! v1-48 (logior (shl 1 32) v1-48)) + ) + (set! (-> self root-override2 penetrate-using) (the-as penetrate v1-48)) + ) + ) + (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (enemy-method-136 self) + ) + (if (logtest? (enemy-flag trackable-backup directed-ready) (-> self enemy-flags)) + (enemy-method-54 self) + ) + (if (and *debug-segment* (-> self enemy-info debug-draw-neck) (nonzero? (-> self neck))) + (joint-mod-debug-draw (-> self neck)) + ) + (ja-post) + 0 + (none) ) (defmethod enemy-method-136 enemy ((obj enemy)) - (with-pp - (when (or (>= (- (-> pp clock frame-counter) (-> obj hit-focus-time)) (seconds 2)) - (and (handle->process (-> obj focus handle)) - (not (logtest? (-> (the-as process-focusable (handle->process (-> obj focus handle))) focus-status) - (focus-status disable dead ignore grabbed) - ) - ) - ) - ) - (let ((v0-0 (logclear (-> obj enemy-flags) (enemy-flag look-at-focus)))) - (set! (-> obj enemy-flags) v0-0) - v0-0 - ) + (when (or (>= (- (current-time) (-> obj hit-focus-time)) (seconds 2)) + (and (handle->process (-> obj focus handle)) + (not (logtest? (-> (the-as process-focusable (handle->process (-> obj focus handle))) focus-status) + (focus-status disable dead ignore grabbed) + ) + ) + ) + ) + (let ((v0-0 (logclear (-> obj enemy-flags) (enemy-flag look-at-focus)))) + (set! (-> obj enemy-flags) v0-0) + v0-0 ) ) ) @@ -655,28 +651,26 @@ ) (defmethod enemy-method-105 enemy ((obj enemy) (arg0 process)) - (with-pp - (when (logtest? (process-mask target bot) (-> arg0 mask)) - (set! (-> obj root-override2 penetrated-by) (the-as penetrate -1)) - (enemy-method-49 obj) - ) - (let ((s5-0 (if (type? arg0 process-focusable) - arg0 - ) - ) - ) - (when (enemy-method-53 obj (the-as process-focusable s5-0)) - (let ((v1-10 (handle->process (-> obj focus handle)))) - (when (or (= s5-0 v1-10) (and (not (logtest? (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (or (not v1-10) (not (logtest? (-> obj focus flags) (enemy-flag lock-focus)))) - ) - ) - (enemy-method-63 obj (the-as process-focusable s5-0) (the-as enemy-aware #f)) - (set! (-> obj hit-focus-time) (-> pp clock frame-counter)) - (let ((v0-3 (logior (-> obj enemy-flags) (enemy-flag look-at-focus)))) - (set! (-> obj enemy-flags) v0-3) - v0-3 + (when (logtest? (process-mask target bot) (-> arg0 mask)) + (set! (-> obj root-override2 penetrated-by) (the-as penetrate -1)) + (enemy-method-49 obj) + ) + (let ((s5-0 (if (type? arg0 process-focusable) + arg0 + ) ) + ) + (when (enemy-method-53 obj (the-as process-focusable s5-0)) + (let ((v1-10 (handle->process (-> obj focus handle)))) + (when (or (= s5-0 v1-10) (and (not (logtest? (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (or (not v1-10) (not (logtest? (-> obj focus flags) (enemy-flag lock-focus)))) + ) + ) + (enemy-method-63 obj (the-as process-focusable s5-0) (the-as enemy-aware #f)) + (set! (-> obj hit-focus-time) (current-time)) + (let ((v0-3 (logior (-> obj enemy-flags) (enemy-flag look-at-focus)))) + (set! (-> obj enemy-flags) v0-3) + v0-3 ) ) ) @@ -686,7 +680,7 @@ (defmethod enemy-method-49 enemy ((obj enemy)) (logior! (-> obj enemy-flags) (enemy-flag attackable-backup)) - (let ((v0-0 (-> self clock frame-counter))) + (let ((v0-0 (current-time))) (set! (-> obj auto-reset-penetrate-time) v0-0) v0-0 ) @@ -745,13 +739,13 @@ ) ) (set! (-> obj incoming knocked-type) (the-as knocked-type v1-3)) - (let ((a0-4 (-> self clock frame-counter))) + (let ((a0-4 (current-time))) (cond ((!= v1-3 6) (set! (-> obj incoming blue-juggle-count) (the-as uint 0)) 0 ) - ((>= (- (-> self clock frame-counter) (-> obj incoming attack-time)) (seconds 1)) + ((>= (- (current-time) (-> obj incoming attack-time)) (seconds 1)) (set! (-> obj incoming blue-juggle-count) (the-as uint 1)) ) (else @@ -1586,10 +1580,10 @@ This commonly includes things such as: (v1-1 (when (not (logtest? (-> obj enemy-flags) (enemy-flag spawn-gem))) (logior! (-> obj enemy-flags) (enemy-flag spawn-gem)) - (set! (-> obj notice-time) (-> self clock frame-counter)) + (set! (-> obj notice-time) (current-time)) ) (if (and (not (logtest? (-> obj enemy-flags) (enemy-flag chase-startup))) - (< (- (-> self clock frame-counter) (-> obj notice-time)) (-> obj reaction-time)) + (< (- (current-time) (-> obj notice-time)) (-> obj reaction-time)) ) (set! v1-1 #f) ) @@ -1602,7 +1596,7 @@ This commonly includes things such as: (v1-1 arg0 ) - ((or (zero? arg0) (>= (- (-> self clock frame-counter) (-> obj last-draw-time)) (seconds 2))) + ((or (zero? arg0) (>= (- (current-time) (-> obj last-draw-time)) (seconds 2))) 0 ) (else @@ -1640,350 +1634,348 @@ This commonly includes things such as: "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)) - (with-pp - (the-as - object - (cond - ((= arg2 'track) - (and (nonzero? (-> obj hit-points)) - (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) - (logtest? (enemy-flag check-water-backup) (-> obj enemy-flags)) - ) - ) - ((= arg2 'combo) - (and (not (logtest? (enemy-flag multi-focus) (-> obj enemy-flags))) (nonzero? (-> obj hit-points))) - ) - ((= arg2 'touch) - (enemy-method-75 obj arg0 arg3) - ) - ((= arg2 'touched) - (when (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup)) - (let* ((s3-1 arg0) - (v1-20 (if (type? s3-1 process-drawable) - (the-as process-drawable s3-1) - ) - ) - ) - (when v1-20 - (let* ((s3-2 (-> v1-20 root)) - (a1-4 (if (type? s3-2 collide-shape) - s3-2 - ) - ) - (s3-3 (-> arg3 param 0)) - ) - (if (and a1-4 - s3-3 - ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s3-3) - (the-as collide-shape a1-4) - (collide-action solid) - (collide-action) - ) - ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s3-3) - (-> obj root-override2) - (collide-action solid) - (collide-action) + (the-as + object + (cond + ((= arg2 'track) + (and (nonzero? (-> obj hit-points)) + (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) + (logtest? (enemy-flag check-water-backup) (-> obj enemy-flags)) + ) + ) + ((= arg2 'combo) + (and (not (logtest? (enemy-flag multi-focus) (-> obj enemy-flags))) (nonzero? (-> obj hit-points))) + ) + ((= arg2 'touch) + (enemy-method-75 obj arg0 arg3) + ) + ((= arg2 'touched) + (when (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup)) + (let* ((s3-1 arg0) + (v1-20 (if (type? s3-1 process-drawable) + (the-as process-drawable s3-1) ) + ) + ) + (when v1-20 + (let* ((s3-2 (-> v1-20 root)) + (a1-4 (if (type? s3-2 collide-shape) + s3-2 + ) ) - (set! (-> obj auto-reset-penetrate-time) (-> pp clock frame-counter)) - ) - ) + (s3-3 (-> arg3 param 0)) + ) + (if (and a1-4 + s3-3 + ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s3-3) + (the-as collide-shape a1-4) + (collide-action solid) + (collide-action) + ) + ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s3-3) + (-> obj root-override2) + (collide-action solid) + (collide-action) + ) + ) + (set! (-> obj auto-reset-penetrate-time) (current-time)) + ) ) ) ) - (enemy-method-76 obj arg0 arg3) ) - ((= arg2 'attack-invinc) - (case (-> (the-as attack-info (-> arg3 param 1)) mode) - (('endlessfall) - (let ((v1-31 (-> obj root-override2 root-prim))) - (set! (-> v1-31 prim-core collide-as) (collide-spec)) - (set! (-> v1-31 prim-core collide-with) (collide-spec)) + (enemy-method-76 obj arg0 arg3) + ) + ((= arg2 'attack-invinc) + (case (-> (the-as attack-info (-> arg3 param 1)) mode) + (('endlessfall) + (let ((v1-31 (-> obj root-override2 root-prim))) + (set! (-> v1-31 prim-core collide-as) (collide-spec)) + (set! (-> v1-31 prim-core collide-with) (collide-spec)) + ) + 0 + (kill-prefer-falling obj) + ) + ) + ) + ((= arg2 'attack) + (let ((s2-0 (the-as object (-> arg3 param 1)))) + (when (!= (-> (the-as attack-info s2-0) id) (-> obj incoming attack-id)) + (cond + ((and (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) + (not (logtest? (-> obj focus-status) (focus-status grabbed))) + ) + (let* ((s1-0 obj) + (s0-0 (method-of-object s1-0 enemy-method-106)) + ) + (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 (the-as int a3-3) (the-as attack-info s2-0)) + ) + ) + (send-event (ppointer->process (-> obj parent)) 'child-hit) + 0 + (if (not *debug-unkillable*) + (enemy-method-48 obj arg0 arg3) + ) + (let ((s2-1 (the-as attack-info (enemy-method-58 obj arg0 arg3)))) + (when s2-1 + (logclear! (-> obj enemy-flags) (enemy-flag called-dying)) + (enemy-method-108 obj (the-as enemy arg0) arg3) + (let ((a1-13 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-13 from) (process->ppointer arg0)) + (set! (-> a1-13 num-params) arg1) + (set! (-> a1-13 message) (the-as symbol s2-1)) + (set! (-> a1-13 param 0) (-> arg3 param 0)) + (set! (-> a1-13 param 1) (-> arg3 param 1)) + (set! (-> a1-13 param 2) (-> arg3 param 2)) + (set! (-> a1-13 param 3) (-> arg3 param 3)) + (set! (-> a1-13 param 4) (-> arg3 param 4)) + (set! (-> a1-13 param 5) (-> arg3 param 5)) + (send-event-function obj a1-13) + ) + ) + ) ) + (else + (set! (-> obj incoming attack-id) (-> (the-as attack-info s2-0) id)) + (enemy-method-75 obj arg0 arg3) + ) + ) + ) + ) + ) + ((= arg2 'hit-flinch) + (when (zero? (-> obj hit-points)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) + ) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (process-contact-action arg0) + (send-event arg0 'get-attack-count 1) + (kill-prefer-falling obj) + ) + #t + ) + ((= arg2 'hit-knocked) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) + ) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (process-contact-action arg0) + (send-event arg0 'get-attack-count 1) + (when (zero? (-> obj hit-points)) + (case (-> obj incoming knocked-type) + (((knocked-type knocked-type-4) (knocked-type knocked-type-6)) + (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) 0 - (kill-prefer-falling obj) ) ) ) - ((= arg2 'attack) - (let ((s2-0 (the-as object (-> arg3 param 1)))) - (when (!= (-> (the-as attack-info s2-0) id) (-> obj incoming attack-id)) - (cond - ((and (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) - (not (logtest? (-> obj focus-status) (focus-status grabbed))) - ) - (let* ((s1-0 obj) - (s0-0 (method-of-object s1-0 enemy-method-106)) - ) - (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 (the-as int a3-3) (the-as attack-info s2-0)) - ) - ) - (send-event (ppointer->process (-> obj parent)) 'child-hit) - 0 - (if (not *debug-unkillable*) - (enemy-method-48 obj arg0 arg3) - ) - (let ((s2-1 (the-as attack-info (enemy-method-58 obj arg0 arg3)))) - (when s2-1 - (logclear! (-> obj enemy-flags) (enemy-flag called-dying)) - (enemy-method-108 obj (the-as enemy arg0) arg3) - (let ((a1-13 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-13 from) (process->ppointer arg0)) - (set! (-> a1-13 num-params) arg1) - (set! (-> a1-13 message) (the-as symbol s2-1)) - (set! (-> a1-13 param 0) (-> arg3 param 0)) - (set! (-> a1-13 param 1) (-> arg3 param 1)) - (set! (-> a1-13 param 2) (-> arg3 param 2)) - (set! (-> a1-13 param 3) (-> arg3 param 3)) - (set! (-> a1-13 param 4) (-> arg3 param 4)) - (set! (-> a1-13 param 5) (-> arg3 param 5)) - (send-event-function obj a1-13) - ) - ) - ) - ) - (else - (set! (-> obj incoming attack-id) (-> (the-as attack-info s2-0) id)) - (enemy-method-75 obj arg0 arg3) - ) - ) - ) + (go (method-of-object obj knocked)) + ) + ((= arg2 'hit) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) ) - ) - ((= arg2 'hit-flinch) - (when (zero? (-> obj hit-points)) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) - (logior! (-> obj focus-status) (focus-status hit)) - (if (zero? (-> obj hit-points)) - (logior! (-> obj focus-status) (focus-status dead)) - ) - (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) - (enemy-method-62 obj) - (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (process-contact-action arg0) - (send-event arg0 'get-attack-count 1) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (process-contact-action arg0) + (send-event arg0 'get-attack-count 1) + (if (zero? (-> obj hit-points)) (kill-prefer-falling obj) + (go (method-of-object obj hit)) ) - #t - ) - ((= arg2 'hit-knocked) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) - (logior! (-> obj focus-status) (focus-status hit)) - (if (zero? (-> obj hit-points)) - (logior! (-> obj focus-status) (focus-status dead)) - ) - (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) - (enemy-method-62 obj) - (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (process-contact-action arg0) - (send-event arg0 'get-attack-count 1) - (when (zero? (-> obj hit-points)) - (case (-> obj incoming knocked-type) - (((knocked-type knocked-type-4) (knocked-type knocked-type-6)) - (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) - 0 - ) - ) - ) - (go (method-of-object obj knocked)) - ) - ((= arg2 'hit) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) - (logior! (-> obj focus-status) (focus-status hit)) - (if (zero? (-> obj hit-points)) - (logior! (-> obj focus-status) (focus-status dead)) - ) - (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) - (enemy-method-62 obj) - (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (process-contact-action arg0) - (send-event arg0 'get-attack-count 1) - (if (zero? (-> obj hit-points)) - (kill-prefer-falling obj) - (go (method-of-object obj hit)) - ) - ) - ((= arg2 'cue-chase) - (when (and (> (-> obj hit-points) 0) - (zero? (-> obj fated-time)) - (not (logtest? (-> obj focus-status) (focus-status grabbed))) - ) - (let ((v1-162 (logtest? (enemy-flag alert) (-> obj enemy-flags)))) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) - (set! (-> obj enemy-flags) (logior (enemy-flag dangerous-backup) (-> obj enemy-flags))) - (logclear! (-> obj mask) (process-mask actor-pause)) - (cond - (v1-162 - (if (logtest? (enemy-option ambush) (-> obj fact-info-override enemy-options)) - (go-ambush obj) - (go-hostile obj) - ) - ) - ((and (-> obj next-state) (let ((v1-173 (-> obj next-state name))) - (or (= v1-173 'dormant) (= v1-173 'dormant-aware)) - ) - ) - (if (logtest? (enemy-option ambush) (-> obj fact-info-override enemy-options)) - (go-ambush obj) - (go (method-of-object obj notice)) - ) - ) - ) - ) - #t - ) - ) - ((= arg2 'cue-wake) - (when (and (> (-> obj hit-points) 0) - (zero? (-> obj fated-time)) - (not (logtest? (-> obj focus-status) (focus-status grabbed))) - ) - (logclear! (-> obj enemy-flags) (enemy-flag alert victory called-dying)) - (if (logtest? (enemy-option ambush) (-> obj fact-info-override enemy-options)) - (go-ambush obj) - (react-to-focus obj) - ) - #t - ) - ) - ((= arg2 'jump) - (when (and (> (-> obj hit-points) 0) - (zero? (-> obj fated-time)) - (not (logtest? (-> obj focus-status) (focus-status grabbed))) - ) - (logclear! (-> obj mask) (process-mask actor-pause)) - (set! (-> obj jump-why) (-> arg3 param 0)) - (set! (-> obj event-param-point quad) (-> (the-as vector (-> arg3 param 1)) quad)) - (go (method-of-object obj jump)) - ) - ) - ((= arg2 'death-start) - (set! (-> obj enemy-flags) (the-as enemy-flag (logior (enemy-flag recover) (-> obj enemy-flags)))) - (send-event (ppointer->process (-> obj parent)) 'child-die) - (drop-pickup (-> obj fact-info-override) #t *entity-pool* (-> obj fact-info-override) 0) - (let ((s5-1 (-> obj on-death))) - (if s5-1 - (script-eval (the-as pair s5-1) :vector (-> obj root-override2 trans)) - ) - ) - ) - ((= arg2 'death-end) - (if (-> obj skel effect) - (logior! (-> obj skel effect flags) (effect-control-flag ecf2)) - ) - (logior! (-> obj draw status) (draw-control-status no-draw)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (set! (-> obj enemy-flags) (logclear (-> obj enemy-flags) (enemy-flag check-water))) - ) - ((= arg2 'instant-death) - (when (and (> (-> obj hit-points) 0) (zero? (-> obj fated-time))) - (set! (-> obj hit-points) 0) - (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) - (let ((s5-2 (enemy-method-50 obj (new 'stack-no-clear 'vector)))) - (vector-z-quaternion! s5-2 (-> obj root-override2 quat)) - (vector-float*! s5-2 s5-2 -1.0) - (vector-normalize! s5-2 1.0) - ) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) - (logior! (-> obj focus-status) (focus-status hit)) - (if (zero? (-> obj hit-points)) - (logior! (-> obj focus-status) (focus-status dead)) - ) - (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) - (enemy-method-62 obj) - (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (kill-prefer-falling obj) - ) - ) - ((= arg2 'die-fast) - (logior! (-> obj draw status) (draw-control-status no-draw)) - (dispose! obj) - (send-event (ppointer->process (-> obj parent)) 'child-die) - (let ((s5-3 (-> obj on-death))) - (if s5-3 - (script-eval (the-as pair s5-3) :vector (-> obj root-override2 trans)) - ) - ) - (cleanup-for-death obj) - (go (method-of-object obj die-fast)) - ) - ((= arg2 'victory) - (if (and (-> obj enemy-info use-victory) - (not (and (-> obj next-state) (= (-> obj next-state name) 'victory))) - (> (-> obj hit-points) 0) + ) + ((= arg2 'cue-chase) + (when (and (> (-> obj hit-points) 0) (zero? (-> obj fated-time)) (not (logtest? (-> obj focus-status) (focus-status grabbed))) ) - (go (method-of-object obj victory)) - ) - ) - ((= arg2 'nav-control) - (if (nonzero? (-> obj nav)) - (-> obj nav) - ) - ) - ((= arg2 'push-trans) - (move-by-vector! (-> obj root-override2) (the-as vector (-> arg3 param 0))) - ) - ((= arg2 'move-trans) - (move-to-point! (-> obj root-override2) (the-as vector (-> arg3 param 0))) - ) - ((= arg2 'shadow) - (cond - ((-> arg3 param 0) - (let ((v1-320 (-> obj draw shadow-ctrl))) - (logclear! (-> v1-320 settings flags) (shadow-flags disable-draw)) - ) - 0 - ) - (else - (let ((v1-323 (-> obj draw shadow-ctrl))) - (logior! (-> v1-323 settings flags) (shadow-flags disable-draw)) + (let ((v1-162 (logtest? (enemy-flag alert) (-> obj enemy-flags)))) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) + (set! (-> obj enemy-flags) (logior (enemy-flag dangerous-backup) (-> obj enemy-flags))) + (logclear! (-> obj mask) (process-mask actor-pause)) + (cond + (v1-162 + (if (logtest? (enemy-option ambush) (-> obj fact-info-override enemy-options)) + (go-ambush obj) + (go-hostile obj) + ) ) - 0 + ((and (-> obj next-state) (let ((v1-173 (-> obj next-state name))) + (or (= v1-173 'dormant) (= v1-173 'dormant-aware)) + ) + ) + (if (logtest? (enemy-option ambush) (-> obj fact-info-override enemy-options)) + (go-ambush obj) + (go (method-of-object obj notice)) + ) + ) ) ) + #t ) - ((= arg2 'color-effect) - (case (-> arg3 param 0) - (('dark) - (let ((f30-0 (rand-vu-float-range 0.2 1.0))) - (set-vector! (-> obj draw color-mult) (lerp 1.0 1.0 f30-0) (lerp 1.0 0.0 f30-0) (lerp 1.0 1.0 f30-0) 1.0) - (set! s5-5 (-> obj draw color-emissive)) - (set! (-> s5-5 x) (lerp 0.0 0.3 f30-0)) - (set! (-> s5-5 y) (lerp 0.0 0.0 f30-0)) - (set! (-> s5-5 z) (lerp 0.0 0.3 f30-0)) - ) - (set! (-> s5-5 w) 1.0) - s5-5 - ) - ((#f) - (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) - (set! s5-5 (-> obj draw color-emissive)) - (set! (-> s5-5 quad) (the-as uint128 0)) - s5-5 + ) + ((= arg2 'cue-wake) + (when (and (> (-> obj hit-points) 0) + (zero? (-> obj fated-time)) + (not (logtest? (-> obj focus-status) (focus-status grabbed))) + ) + (logclear! (-> obj enemy-flags) (enemy-flag alert victory called-dying)) + (if (logtest? (enemy-option ambush) (-> obj fact-info-override enemy-options)) + (go-ambush obj) + (react-to-focus obj) + ) + #t + ) + ) + ((= arg2 'jump) + (when (and (> (-> obj hit-points) 0) + (zero? (-> obj fated-time)) + (not (logtest? (-> obj focus-status) (focus-status grabbed))) + ) + (logclear! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj jump-why) (-> arg3 param 0)) + (set! (-> obj event-param-point quad) (-> (the-as vector (-> arg3 param 1)) quad)) + (go (method-of-object obj jump)) + ) + ) + ((= arg2 'death-start) + (set! (-> obj enemy-flags) (the-as enemy-flag (logior (enemy-flag recover) (-> obj enemy-flags)))) + (send-event (ppointer->process (-> obj parent)) 'child-die) + (drop-pickup (-> obj fact-info-override) #t *entity-pool* (-> obj fact-info-override) 0) + (let ((s5-1 (-> obj on-death))) + (if s5-1 + (script-eval (the-as pair s5-1) :vector (-> obj root-override2 trans)) + ) + ) + ) + ((= arg2 'death-end) + (if (-> obj skel effect) + (logior! (-> obj skel effect flags) (effect-control-flag ecf2)) + ) + (logior! (-> obj draw status) (draw-control-status no-draw)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (set! (-> obj enemy-flags) (logclear (-> obj enemy-flags) (enemy-flag check-water))) + ) + ((= arg2 'instant-death) + (when (and (> (-> obj hit-points) 0) (zero? (-> obj fated-time))) + (set! (-> obj hit-points) 0) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) + (let ((s5-2 (enemy-method-50 obj (new 'stack-no-clear 'vector)))) + (vector-z-quaternion! s5-2 (-> obj root-override2 quat)) + (vector-float*! s5-2 s5-2 -1.0) + (vector-normalize! s5-2 1.0) + ) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) + ) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (kill-prefer-falling obj) + ) + ) + ((= arg2 'die-fast) + (logior! (-> obj draw status) (draw-control-status no-draw)) + (dispose! obj) + (send-event (ppointer->process (-> obj parent)) 'child-die) + (let ((s5-3 (-> obj on-death))) + (if s5-3 + (script-eval (the-as pair s5-3) :vector (-> obj root-override2 trans)) + ) + ) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + ((= arg2 'victory) + (if (and (-> obj enemy-info use-victory) + (not (and (-> obj next-state) (= (-> obj next-state name) 'victory))) + (> (-> obj hit-points) 0) + (zero? (-> obj fated-time)) + (not (logtest? (-> obj focus-status) (focus-status grabbed))) + ) + (go (method-of-object obj victory)) + ) + ) + ((= arg2 'nav-control) + (if (nonzero? (-> obj nav)) + (-> obj nav) + ) + ) + ((= arg2 'push-trans) + (move-by-vector! (-> obj root-override2) (the-as vector (-> arg3 param 0))) + ) + ((= arg2 'move-trans) + (move-to-point! (-> obj root-override2) (the-as vector (-> arg3 param 0))) + ) + ((= arg2 'shadow) + (cond + ((-> arg3 param 0) + (let ((v1-320 (-> obj draw shadow-ctrl))) + (logclear! (-> v1-320 settings flags) (shadow-flags disable-draw)) ) + 0 + ) + (else + (let ((v1-323 (-> obj draw shadow-ctrl))) + (logior! (-> v1-323 settings flags) (shadow-flags disable-draw)) + ) + 0 ) ) - ) + ) + ((= arg2 'color-effect) + (case (-> arg3 param 0) + (('dark) + (let ((f30-0 (rand-vu-float-range 0.2 1.0))) + (set-vector! (-> obj draw color-mult) (lerp 1.0 1.0 f30-0) (lerp 1.0 0.0 f30-0) (lerp 1.0 1.0 f30-0) 1.0) + (set! s5-5 (-> obj draw color-emissive)) + (set! (-> s5-5 x) (lerp 0.0 0.3 f30-0)) + (set! (-> s5-5 y) (lerp 0.0 0.0 f30-0)) + (set! (-> s5-5 z) (lerp 0.0 0.3 f30-0)) + ) + (set! (-> s5-5 w) 1.0) + s5-5 + ) + ((#f) + (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) + (set! s5-5 (-> obj draw color-emissive)) + (set! (-> s5-5 quad) (the-as uint128 0)) + s5-5 + ) + ) + ) ) ) ) @@ -2015,30 +2007,28 @@ This commonly includes things such as: ) (defmethod enemy-method-48 enemy ((obj enemy) (arg0 process) (arg1 event-message-block)) - (with-pp - (let* ((v1-1 (damage-amount-from-attack obj arg0 arg1)) - (s5-0 (-> obj hit-points)) - (s4-1 (max 0 (- s5-0 v1-1))) - ) - (when (and (zero? s4-1) (nonzero? s5-0) (= (-> obj incoming knocked-type) (knocked-type knocked-type-6))) - (cond - ((zero? (-> obj fated-time)) - (set! (-> obj fated-time) (-> pp clock frame-counter)) - (set! s4-1 1) - ) - (else - (if (< (- (-> pp clock frame-counter) (-> obj fated-time)) (seconds 1)) - (set! s4-1 1) - ) - ) + (let* ((v1-1 (damage-amount-from-attack obj arg0 arg1)) + (s5-0 (-> obj hit-points)) + (s4-1 (max 0 (- s5-0 v1-1))) + ) + (when (and (zero? s4-1) (nonzero? s5-0) (= (-> obj incoming knocked-type) (knocked-type knocked-type-6))) + (cond + ((zero? (-> obj fated-time)) + (set! (-> obj fated-time) (current-time)) + (set! s4-1 1) + ) + (else + (if (< (- (current-time) (-> obj fated-time)) (seconds 1)) + (set! s4-1 1) + ) ) ) - (set! (-> obj hit-points) s4-1) - (if (not (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup))) - (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) - ) - (- s5-0 s4-1) ) + (set! (-> obj hit-points) s4-1) + (if (not (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup))) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) + ) + (- s5-0 s4-1) ) ) @@ -2210,7 +2200,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (stop-looking-at-target! self) (logclear! (-> self enemy-flags) (enemy-flag spawn-gem chase-startup use-notice-distance)) (logior! (-> self enemy-flags) (enemy-flag enable-on-notice)) @@ -2233,7 +2223,7 @@ This commonly includes things such as: (none) ) :trans (behavior () - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (if (and (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (> (the-as int (-> self focus aware)) 0) ) (go-virtual active) @@ -2248,7 +2238,7 @@ This commonly includes things such as: :post (behavior () (idle-control-method-10 (-> self idle-anim-player) self) (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (-> self clock frame-counter)) + (set! (-> self last-draw-time) (current-time)) ) (enemy-method-129 self) (ja-post) @@ -2295,7 +2285,7 @@ This commonly includes things such as: :enter (-> (method-of-type enemy dormant) enter) :exit (-> (method-of-type enemy dormant) exit) :trans (behavior () - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (when (and (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (> (the-as int (-> self focus aware)) 0) ) (if (logtest? (enemy-option ambush) (-> self fact-info-override enemy-options)) @@ -2308,7 +2298,7 @@ This commonly includes things such as: :code (the-as (function none :behavior enemy) sleep-code) :post (behavior () (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (-> self clock frame-counter)) + (set! (-> self last-draw-time) (current-time)) ) (enemy-method-129 self) (none) @@ -2332,7 +2322,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self enemy-flags) (enemy-flag use-notice-distance)) (when (logtest? (-> self enemy-flags) (enemy-flag jump-check-blocked)) (logclear! (-> self enemy-flags) (enemy-flag jump-check-blocked)) @@ -2351,7 +2341,7 @@ This commonly includes things such as: (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((v1-3 (-> self focus aware))) (cond ((< (the-as int v1-3) 1) @@ -2381,7 +2371,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-3 (logior (-> self enemy-flags) (enemy-flag use-notice-distance)))) (set! (-> self enemy-flags) (logclear v1-3 (enemy-flag called-dying))) ) @@ -2446,7 +2436,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (look-at-target! self (enemy-flag lock-focus)) (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) @@ -2466,7 +2456,7 @@ This commonly includes things such as: (go-virtual victory) ) (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (cond ((or (>= 2 (the-as int gp-0)) (not (get-enemy-target self))) (go-stare self) @@ -2499,13 +2489,13 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self mask) (process-mask actor-pause)) (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((gp-0 (-> self focus aware))) (cond ((>= 1 (the-as int gp-0)) @@ -2581,14 +2571,14 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (look-at-target! self (enemy-flag lock-focus)) (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> self mask) (process-mask actor-pause)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (!= (-> self focus aware) (enemy-aware unaware)) (go-stare self) ) @@ -2818,7 +2808,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self mask) (process-mask actor-pause)) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-6 *game-info*) @@ -2865,7 +2855,7 @@ This commonly includes things such as: (let ((s5-1 2)) (logior! (-> self focus-status) (focus-status in-air)) (until (enemy-method-86 self) - (+! (-> gp-0 hang-time) (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! (-> gp-0 hang-time) (- (current-time) (-> self clock old-frame-counter))) (enemy-method-90 self s5-1 gp-0) (enemy-method-91 self s5-1 gp-0) (enemy-method-92 self s5-1 (the-as nav-poly gp-0)) @@ -2917,12 +2907,12 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self mask) (process-mask actor-pause)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (if (logtest? (enemy-flag alert) (-> self enemy-flags)) (go-virtual jump) (enemy-method-93 self) @@ -3336,7 +3326,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (stop-looking-at-target! self) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) (logclear! (-> self mask) (process-mask actor-pause)) @@ -3449,7 +3439,7 @@ This commonly includes things such as: (set! (-> gp-0 on-surface-count) 0) (set! (-> gp-0 move-count) 0) (until (enemy-method-80 self gp-0) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2)) (kill-prefer-falling self) ) (if (logtest? (-> self root-override2 status) (collide-status on-surface)) @@ -3462,7 +3452,7 @@ This commonly includes things such as: ) ) (let ((s5-1 2)) - (set! (-> gp-0 land-can-land-time) (-> self clock frame-counter)) + (set! (-> gp-0 land-can-land-time) (current-time)) (until #f (if (logtest? (-> self root-override2 status) (collide-status on-surface)) (+! (-> gp-0 on-surface-count) 1) @@ -3474,14 +3464,14 @@ This commonly includes things such as: (+! (-> gp-0 move-count) 1) (set! s5-1 3) (if (enemy-method-80 self gp-0) - (set! (-> gp-0 land-can-land-time) (-> self clock frame-counter)) + (set! (-> gp-0 land-can-land-time) (current-time)) ) ) ) #f (label cfg-15) (if (and (not (logtest? (enemy-flag recover) (-> self enemy-flags))) - (or (>= (- (-> self clock frame-counter) (-> gp-0 land-can-land-time)) (seconds 0.1)) + (or (>= (- (current-time) (-> gp-0 land-can-land-time)) (seconds 0.1)) (enemy-method-81 self) (enemy-method-102 self) ) @@ -3578,7 +3568,7 @@ This commonly includes things such as: (set! (-> v1-3 prim-core collide-with) (collide-spec)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self hit-points) 0) (enemy-method-103 self) (none) diff --git a/goal_src/jak2/engine/ambient/ambient.gc b/goal_src/jak2/engine/ambient/ambient.gc index 41f53dc497..88f00882bc 100644 --- a/goal_src/jak2/engine/ambient/ambient.gc +++ b/goal_src/jak2/engine/ambient/ambient.gc @@ -242,7 +242,7 @@ (set! (-> self region) arg2) (set! (-> self total-time) 0) (set! (-> self total-off-time) 0) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (set! (-> self voicebox) (the-as handle #f)) (set! (-> self save?) #f) (if (logtest? (-> self message flags) 96) @@ -343,8 +343,8 @@ (defstate idle (talker) :virtual #t :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (the-as time-frame (-> self message delay))) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (the-as time-frame (-> self message delay))) (suspend) ) ) @@ -355,7 +355,7 @@ ) ) ) - (while (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (+ (-> self message delay) 300))) + (while (< (- (current-time) (-> self start-time)) (the-as time-frame (+ (-> self message delay) 300))) (if (and (or (zero? (-> self voice-id)) (= (get-status *gui-control* (-> self voice-id)) (gui-status ready))) (or (zero? (-> self message-id)) (= (get-status *gui-control* (-> self message-id)) (gui-status active))) ) @@ -371,7 +371,7 @@ (defstate active (talker) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (if (logtest? (-> self message flags) 1) (play-communicator-speech! (-> self message)) ) @@ -471,16 +471,16 @@ ) (set! v1-43 #t) (label cfg-39) - (and v1-43 (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 120))) + (and v1-43 (< (- (current-time) (-> self state-time)) (seconds 120))) ) ) (and (nonzero? (-> self message-id)) (= (get-status *gui-control* (-> self message-id)) (gui-status active)) - (or (< (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self message text-duration))) + (or (< (- (current-time) (-> self state-time)) (the-as time-frame (-> self message text-duration))) (and (logtest? (-> self message flags) 16) (-> self region) (region-method-9 (-> self region) (target-pos 0))) ) ) - (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (< (- (current-time) (-> self state-time)) (seconds 0.05)) ) (when (and (nonzero? (-> self voice-id)) (not gp-1) (zero? (get-status *gui-control* (-> self voice-id)))) (remove-setting! 'music-volume) @@ -512,8 +512,8 @@ ) ) (when (and (logtest? (-> self message flags) 8) (not (-> self save?))) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 1)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 1)) (suspend) ) ) diff --git a/goal_src/jak2/engine/anim/fma-sphere.gc b/goal_src/jak2/engine/anim/fma-sphere.gc index 8c773e2251..913f7c5e1a 100644 --- a/goal_src/jak2/engine/anim/fma-sphere.gc +++ b/goal_src/jak2/engine/anim/fma-sphere.gc @@ -77,7 +77,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self first-time?) #f) (if (logtest? (-> self mode) (fma-sphere-mode kill-once)) (send-event *traffic-manager* 'kill-traffic-sphere (-> self sphere)) @@ -92,7 +92,7 @@ ) (init-vf0-vector) (let ((v1-0 (-> self duration))) - (if (and (nonzero? v1-0) (>= (- (-> self clock frame-counter) (-> self state-time)) v1-0)) + (if (and (nonzero? v1-0) (>= (- (current-time) (-> self state-time)) v1-0)) (go empty-state) ) ) @@ -154,6 +154,7 @@ :code (the-as (function none :behavior fma-sphere) sleep-code) ) +;; WARN: Return type mismatch object vs none. (defbehavior fma-sphere-init-by-other fma-sphere ((arg0 fma-sphere-mode) (arg1 process-drawable) (arg2 int) (arg3 time-frame) (arg4 vector) (arg5 vector)) (set! (-> self mode) arg0) (set! (-> self first-time?) #t) diff --git a/goal_src/jak2/engine/anim/joint-exploder.gc b/goal_src/jak2/engine/anim/joint-exploder.gc index a064d7d382..ad652b0d1f 100644 --- a/goal_src/jak2/engine/anim/joint-exploder.gc +++ b/goal_src/jak2/engine/anim/joint-exploder.gc @@ -538,11 +538,11 @@ (defstate joint-exploder-shatter (joint-exploder) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (let* ((f0-1 (the float (- (-> self clock frame-counter) (-> self state-time)))) + (let* ((f0-1 (the float (- (current-time) (-> self state-time)))) (f1-1 (- 1.0 (/ f0-1 (the float (-> self tuning duration))))) (f0-3 (- 1.0 (/ f0-1 (* 0.75 (the float (-> self tuning duration)))))) ) @@ -590,8 +590,8 @@ (none) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self tuning duration)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (-> self tuning duration)) (suspend) (ja :num! (loop!)) ) diff --git a/goal_src/jak2/engine/anim/joint-mod.gc b/goal_src/jak2/engine/anim/joint-mod.gc index 4ff63659b5..b875c06395 100644 --- a/goal_src/jak2/engine/anim/joint-mod.gc +++ b/goal_src/jak2/engine/anim/joint-mod.gc @@ -768,7 +768,7 @@ ) (when s2-1 (when (< (vector-vector-distance (-> obj process root trans) (-> s1-0 root trans)) (-> s2-1 cam-notice-dist)) - (set! (-> obj notice-time) (-> self clock frame-counter)) + (set! (-> obj notice-time) (current-time)) (set! (-> last-try-to-look-at-data who) (process->handle arg2)) (if (< (-> last-try-to-look-at-data vert) (-> s2-1 cam-vert)) (set! (-> last-try-to-look-at-data vert) (-> s2-1 cam-vert)) diff --git a/goal_src/jak2/engine/anim/joint.gc b/goal_src/jak2/engine/anim/joint.gc index da3988a11a..43bc9b3905 100644 --- a/goal_src/jak2/engine/anim/joint.gc +++ b/goal_src/jak2/engine/anim/joint.gc @@ -35,14 +35,17 @@ (-> obj length) ) +;; WARN: Return type mismatch uint vs int. (defmethod asize-of joint-anim-matrix ((obj joint-anim-matrix)) (the-as int (+ (-> joint-anim-matrix size) (* (-> obj length) 64))) ) +;; WARN: Return type mismatch uint vs int. (defmethod asize-of joint-anim-transformq ((obj joint-anim-transformq)) (the-as int (+ (-> joint-anim-transformq size) (* 48 (-> obj length)))) ) +;; WARN: Return type mismatch uint vs int. (defmethod asize-of joint-anim-drawable ((obj joint-anim-drawable)) (the-as int (+ (-> joint-anim-drawable size) (* (-> obj length) 4))) ) @@ -149,6 +152,7 @@ obj ) +;; WARN: Return type mismatch uint vs int. (defmethod asize-of joint-control ((obj joint-control)) (the-as int (+ (-> obj type size) (* (-> obj allocated-length) 64))) ) @@ -264,6 +268,7 @@ #f ) +;; WARN: Return type mismatch symbol vs basic. (defmethod get-art-by-name-method art ((obj art) (arg0 string) (arg1 type)) (the-as basic #f) ) @@ -273,6 +278,7 @@ `(the-as ,type (get-art-by-name-method ,obj ,name ,type)) ) +;; WARN: Return type mismatch symbol vs int. (defmethod get-art-idx-by-name-method art ((obj art) (arg0 string) (arg1 type)) (the-as int #f) ) @@ -334,6 +340,7 @@ obj ) +;; WARN: Return type mismatch uint vs int. (defmethod asize-of art-joint-anim ((obj art-joint-anim)) (the-as int (+ (-> art size) (* (-> obj length) 4))) ) @@ -361,6 +368,7 @@ ) ) +;; WARN: Return type mismatch art-element vs basic. (defmethod get-art-by-name-method art-group ((obj art-group) (arg0 string) (arg1 type)) (cond (arg1 @@ -441,6 +449,7 @@ obj ) +;; WARN: Return type mismatch art-group vs none. (defmethod relocate art-group ((obj art-group) (arg0 kheap) (arg1 (pointer uint8))) (let ((s4-0 (clear *temp-string*))) (string<-charp s4-0 arg1) @@ -506,6 +515,7 @@ (none) ) +;; WARN: Return type mismatch uint vs int. (defmethod asize-of art-mesh-geo ((obj art-mesh-geo)) (the-as int (+ (-> art size) (* (-> obj length) 4))) ) @@ -547,10 +557,12 @@ obj ) +;; WARN: Return type mismatch uint vs int. (defmethod asize-of art-joint-geo ((obj art-joint-geo)) (the-as int (+ (-> art size) (* (-> obj length) 4))) ) +;; WARN: Return type mismatch joint vs basic. (defmethod get-art-by-name-method art-joint-geo ((obj art-joint-geo) (arg0 string) (arg1 type)) (cond (arg1 @@ -612,7 +624,7 @@ (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 (-> self clock frame-counter))) + (set! (-> arg0 eval-time) (the-as uint (current-time))) f0-3 ) ) @@ -620,7 +632,7 @@ (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 (-> self clock frame-counter))) + (set! (-> arg0 eval-time) (the-as uint (current-time))) f0-3 ) ) @@ -629,21 +641,19 @@ (arg1 art-joint-anim) (arg2 (function joint-control-channel float float float float)) ) - (with-pp - (set! (-> arg0 num-func) arg2) - (cond - ((= (-> arg0 command) (joint-control-command stack)) - ) - (else - (if arg1 - (set! (-> arg0 frame-group) arg1) - ) - (arg2 arg0 (-> arg0 param 0) (-> arg0 param 1) (-> arg0 param 2)) - (set! (-> arg0 eval-time) (the-as uint (-> pp clock frame-counter))) - ) + (set! (-> arg0 num-func) arg2) + (cond + ((= (-> arg0 command) (joint-control-command stack)) + ) + (else + (if arg1 + (set! (-> arg0 frame-group) arg1) + ) + (arg2 arg0 (-> arg0 param 0) (-> arg0 param 1) (-> arg0 param 2)) + (set! (-> arg0 eval-time) (the-as uint (current-time))) ) - 0 ) + 0 ) (defun joint-control-channel-group! ((arg0 joint-control-channel) @@ -683,6 +693,8 @@ arg0 ) +;; WARN: Return type mismatch symbol vs object. +;; 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) @@ -762,6 +774,7 @@ (the-as object sv-24) ) +;; ERROR: Failed load: (set! vf2 (l.vf (the-as int a2-1))) at op 46 (defun flatten-joint-control-to-spr ((arg0 joint-control)) (rlet ((vf1 :class vf) (vf10 :class vf) @@ -938,12 +951,13 @@ ) ) +;; 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))) ) (cond - ((zero? (logand (-> arg0 fixed hdr matrix-bits) 1)) + ((not (logtest? (-> arg0 fixed hdr matrix-bits) 1)) (set! v1-1 (cond ((zero? arg1) (return (the-as matrix v1-1)) @@ -962,7 +976,7 @@ (set! v0-0 (-> (the-as (inline-array vector) v0-0) 4)) ) ) - (if (zero? (logand (-> arg0 fixed hdr matrix-bits) 2)) + (if (not (logtest? (-> arg0 fixed hdr matrix-bits) 2)) (return (the-as matrix v1-1)) ) (the-as matrix v0-0) @@ -982,14 +996,14 @@ (cond ((= (the float (the int f0-1)) f0-1) (let* ((a2-3 (matrix-from-joint-anim-frame (-> s4-0 frames) s5-0 (the int f30-0))) - (v1-7 (-> a2-3 vector 0 quad)) - (a0-3 (-> a2-3 vector 1 quad)) - (a1-3 (-> a2-3 vector 2 quad)) + (v1-7 (-> a2-3 quad 0)) + (a0-3 (-> a2-3 quad 1)) + (a1-3 (-> a2-3 quad 2)) (a2-4 (-> a2-3 trans quad)) ) - (set! (-> arg0 vector 0 quad) v1-7) - (set! (-> arg0 vector 1 quad) a0-3) - (set! (-> arg0 vector 2 quad) a1-3) + (set! (-> arg0 quad 0) v1-7) + (set! (-> arg0 quad 1) a0-3) + (set! (-> arg0 quad 2) a1-3) (set! (-> arg0 trans quad) a2-4) ) arg0 @@ -1029,6 +1043,7 @@ ) ) +;; WARN: Return type mismatch (inline-array matrix) vs matrix. (defun matrix-from-control! ((arg0 matrix-stack) (arg1 joint) (arg2 joint-control) (arg3 symbol)) (set! (-> arg0 top) (the-as matrix (-> arg0 data))) (dotimes (s2-0 (the-as int (+ (-> arg2 active-channels) (-> arg2 float-channels)))) @@ -1048,14 +1063,14 @@ (set! (-> arg0 top) (the-as matrix (&- (the-as pointer (-> arg0 top)) (the-as uint s1-0)))) (let* ((v1-9 (the-as object (&- (the-as pointer (-> arg0 top)) (the-as uint s1-0)))) (a3-1 (-> arg0 top)) - (a0-8 (-> a3-1 vector 0 quad)) - (a1-6 (-> a3-1 vector 1 quad)) - (a2-2 (-> a3-1 vector 2 quad)) + (a0-8 (-> a3-1 quad 0)) + (a1-6 (-> a3-1 quad 1)) + (a2-2 (-> a3-1 quad 2)) (a3-2 (-> a3-1 trans quad)) ) - (set! (-> (the-as matrix v1-9) vector 0 quad) a0-8) - (set! (-> (the-as matrix v1-9) vector 1 quad) a1-6) - (set! (-> (the-as matrix v1-9) vector 2 quad) a2-2) + (set! (-> (the-as matrix v1-9) quad 0) a0-8) + (set! (-> (the-as matrix v1-9) quad 1) a1-6) + (set! (-> (the-as matrix v1-9) quad 2) a2-2) (set! (-> (the-as matrix v1-9) trans quad) a3-2) ) ) @@ -1088,11 +1103,10 @@ (the-as matrix (-> arg0 data)) ) - (defmethod reset-and-assign-geo! cspace ((obj cspace) (arg0 drawable)) (set! (-> obj parent) #f) (set! (-> obj joint) #f) - (set! (-> obj geo) (the-as drawable arg0)) + (set! (-> obj geo) arg0) (set! (-> obj param0) #f) (set! (-> obj param1) #f) (set! (-> obj param2) #f) @@ -1111,14 +1125,14 @@ (defun cspace<-cspace! ((arg0 cspace) (arg1 cspace)) (let ((v0-0 (-> arg0 bone transform))) (let* ((a2-0 (-> arg1 bone transform)) - (v1-2 (-> a2-0 vector 0 quad)) - (a0-1 (-> a2-0 vector 1 quad)) - (a1-1 (-> a2-0 vector 2 quad)) + (v1-2 (-> a2-0 quad 0)) + (a0-1 (-> a2-0 quad 1)) + (a1-1 (-> a2-0 quad 2)) (a2-1 (-> a2-0 trans quad)) ) - (set! (-> v0-0 vector 0 quad) v1-2) - (set! (-> v0-0 vector 1 quad) a0-1) - (set! (-> v0-0 vector 2 quad) a1-1) + (set! (-> v0-0 quad 0) v1-2) + (set! (-> v0-0 quad 1) a0-1) + (set! (-> v0-0 quad 2) a1-1) (set! (-> v0-0 trans quad) a2-1) ) v0-0 @@ -1128,14 +1142,14 @@ (defun cspace<-cspace-normalized! ((arg0 cspace) (arg1 cspace)) (let ((gp-0 (-> arg0 bone transform))) (let* ((a2-0 (-> arg1 bone transform)) - (v1-2 (-> a2-0 vector 0 quad)) - (a0-1 (-> a2-0 vector 1 quad)) - (a1-1 (-> a2-0 vector 2 quad)) + (v1-2 (-> a2-0 quad 0)) + (a0-1 (-> a2-0 quad 1)) + (a1-1 (-> a2-0 quad 2)) (a2-1 (-> a2-0 trans quad)) ) - (set! (-> gp-0 vector 0 quad) v1-2) - (set! (-> gp-0 vector 1 quad) a0-1) - (set! (-> gp-0 vector 2 quad) a1-1) + (set! (-> gp-0 quad 0) v1-2) + (set! (-> gp-0 quad 1) a0-1) + (set! (-> gp-0 quad 2) a1-1) (set! (-> gp-0 trans quad) a2-1) ) (vector-normalize! (the-as vector (-> gp-0 vector)) 1.0) @@ -1148,14 +1162,14 @@ (defun cspace<-parent-joint! ((arg0 cspace) (arg1 (pointer process-drawable)) (arg2 int)) (let ((v0-0 (-> arg0 bone transform))) (let* ((a2-1 (-> arg1 0 node-list data arg2 bone transform)) - (v1-5 (-> a2-1 vector 0 quad)) - (a0-2 (-> a2-1 vector 1 quad)) - (a1-1 (-> a2-1 vector 2 quad)) + (v1-5 (-> a2-1 quad 0)) + (a0-2 (-> a2-1 quad 1)) + (a1-1 (-> a2-1 quad 2)) (a2-2 (-> a2-1 trans quad)) ) - (set! (-> v0-0 vector 0 quad) v1-5) - (set! (-> v0-0 vector 1 quad) a0-2) - (set! (-> v0-0 vector 2 quad) a1-1) + (set! (-> v0-0 quad 0) v1-5) + (set! (-> v0-0 quad 1) a0-2) + (set! (-> v0-0 quad 2) a1-1) (set! (-> v0-0 trans quad) a2-2) ) v0-0 @@ -1206,14 +1220,14 @@ (let ((v1-2 (matrix-from-control! (scratchpad-object matrix-stack :offset 64) (-> arg0 joint) arg1 'no-push)) (v0-1 (-> arg0 bone transform)) ) - (let ((a0-4 (-> v1-2 vector 0 quad)) - (a1-2 (-> v1-2 vector 1 quad)) - (a2-1 (-> v1-2 vector 2 quad)) + (let ((a0-4 (-> v1-2 quad 0)) + (a1-2 (-> v1-2 quad 1)) + (a2-1 (-> v1-2 quad 2)) (v1-3 (-> v1-2 trans quad)) ) - (set! (-> v0-1 vector 0 quad) a0-4) - (set! (-> v0-1 vector 1 quad) a1-2) - (set! (-> v0-1 vector 2 quad) a2-1) + (set! (-> v0-1 quad 0) a0-4) + (set! (-> v0-1 quad 1) a1-2) + (set! (-> v0-1 quad 2) a2-1) (set! (-> v0-1 trans quad) v1-3) ) v0-1 @@ -1223,14 +1237,14 @@ (defun cspace<-matrix-joint! ((arg0 cspace) (arg1 matrix)) (let ((v0-0 (-> arg0 bone transform))) (let* ((a2-0 arg1) - (v1-1 (-> a2-0 vector 0 quad)) - (a0-1 (-> a2-0 vector 1 quad)) - (a1-1 (-> a2-0 vector 2 quad)) + (v1-1 (-> a2-0 quad 0)) + (a0-1 (-> a2-0 quad 1)) + (a1-1 (-> a2-0 quad 2)) (a2-1 (-> a2-0 trans quad)) ) - (set! (-> v0-0 vector 0 quad) v1-1) - (set! (-> v0-0 vector 1 quad) a0-1) - (set! (-> v0-0 vector 2 quad) a1-1) + (set! (-> v0-0 quad 0) v1-1) + (set! (-> v0-0 quad 1) a0-1) + (set! (-> v0-0 quad 2) a1-1) (set! (-> v0-0 trans quad) a2-1) ) v0-0 @@ -1255,14 +1269,14 @@ (let ((v0-0 (-> arg0 bone transform))) (let ((v1-1 arg1)) (let ((a0-3 (-> arg0 parent bone transform))) - (.lvf vf10 (&-> v1-1 vector 0 quad)) - (.lvf vf14 (&-> a0-3 vector 0 quad)) - (.lvf vf15 (&-> a0-3 vector 1 quad)) - (.lvf vf16 (&-> a0-3 vector 2 quad)) + (.lvf vf10 (&-> v1-1 quad 0)) + (.lvf vf14 (&-> a0-3 quad 0)) + (.lvf vf15 (&-> a0-3 quad 1)) + (.lvf vf16 (&-> a0-3 quad 2)) (.lvf vf17 (&-> a0-3 trans quad)) ) - (.lvf vf11 (&-> v1-1 vector 1 quad)) - (.lvf vf12 (&-> v1-1 vector 2 quad)) + (.lvf vf11 (&-> v1-1 quad 1)) + (.lvf vf12 (&-> v1-1 quad 2)) (.lvf vf13 (&-> v1-1 trans quad)) ) (.mul.x.vf acc vf14 vf10) @@ -1281,9 +1295,9 @@ (.add.mul.y.vf acc vf15 vf13 acc) (.add.mul.z.vf acc vf16 vf13 acc) (.add.mul.w.vf vf21 vf17 vf13 acc) - (.svf (&-> v0-0 vector 0 quad) vf18) - (.svf (&-> v0-0 vector 1 quad) vf19) - (.svf (&-> v0-0 vector 2 quad) vf20) + (.svf (&-> v0-0 quad 0) vf18) + (.svf (&-> v0-0 quad 1) vf19) + (.svf (&-> v0-0 quad 2) vf20) (.svf (&-> v0-0 trans quad) vf21) v0-0 ) @@ -1324,14 +1338,14 @@ (let ((v0-0 (-> arg0 bone transform))) (let ((v1-1 arg1)) (let ((a0-3 (-> arg0 parent bone transform))) - (.lvf vf10 (&-> v1-1 vector 0 quad)) - (.lvf vf14 (&-> a0-3 vector 0 quad)) - (.lvf vf15 (&-> a0-3 vector 1 quad)) - (.lvf vf16 (&-> a0-3 vector 2 quad)) + (.lvf vf10 (&-> v1-1 quad 0)) + (.lvf vf14 (&-> a0-3 quad 0)) + (.lvf vf15 (&-> a0-3 quad 1)) + (.lvf vf16 (&-> a0-3 quad 2)) (.lvf vf17 (&-> a0-3 trans quad)) ) - (.lvf vf11 (&-> v1-1 vector 1 quad)) - (.lvf vf12 (&-> v1-1 vector 2 quad)) + (.lvf vf11 (&-> v1-1 quad 1)) + (.lvf vf12 (&-> v1-1 quad 2)) (.lvf vf13 (&-> v1-1 trans quad)) ) (.sub.vf vf31 vf0 vf0) @@ -1352,9 +1366,9 @@ (.add.mul.y.vf acc vf15 vf13 acc) (.add.mul.z.vf acc vf16 vf13 acc) (.add.mul.w.vf vf21 vf17 vf13 acc) - (.svf (&-> v0-0 vector 0 quad) vf18) - (.svf (&-> v0-0 vector 1 quad) vf19) - (.svf (&-> v0-0 vector 2 quad) vf20) + (.svf (&-> v0-0 quad 0) vf18) + (.svf (&-> v0-0 quad 1) vf19) + (.svf (&-> v0-0 quad 2) vf20) (.svf (&-> v0-0 trans quad) vf21) v0-0 ) @@ -1370,9 +1384,9 @@ (init-vf0-vector) (let ((v1-1 (-> arg0 bone transform))) (.sub.vf vf31 vf0 vf0) - (.lvf vf30 (&-> v1-1 vector 0 quad)) + (.lvf vf30 (&-> v1-1 quad 0)) (.sub.vf vf30 vf31 vf30) - (.svf (&-> v1-1 vector 0 quad) vf30) + (.svf (&-> v1-1 quad 0) vf30) ) (.mov v1-2 vf30) 0 @@ -1557,14 +1571,14 @@ (when (logtest? a0-8 1) (let* ((a2-7 (-> arg0 matrices a1-5)) (t2-0 (-> v1-9 matrices a1-5)) - (a3-3 (-> t2-0 vector 0 quad)) - (t0-0 (-> t2-0 vector 1 quad)) - (t1-0 (-> t2-0 vector 2 quad)) + (a3-3 (-> t2-0 quad 0)) + (t0-0 (-> t2-0 quad 1)) + (t1-0 (-> t2-0 quad 2)) (t2-1 (-> t2-0 trans quad)) ) - (set! (-> a2-7 vector 0 quad) a3-3) - (set! (-> a2-7 vector 1 quad) t0-0) - (set! (-> a2-7 vector 2 quad) t1-0) + (set! (-> a2-7 quad 0) a3-3) + (set! (-> a2-7 quad 1) t0-0) + (set! (-> a2-7 quad 2) t1-0) (set! (-> a2-7 trans quad) t2-1) ) ) @@ -1576,11 +1590,11 @@ (let* ((a3-9 (-> arg0 data a2-9)) (t2-2 (-> v1-9 data a2-9)) (t0-4 (-> t2-2 trans quad)) - (t1-1 (-> t2-2 quat vec quad)) + (t1-1 (-> t2-2 quat quad)) (t2-3 (-> t2-2 scale quad)) ) (set! (-> a3-9 trans quad) t0-4) - (set! (-> a3-9 quat vec quad) t1-1) + (set! (-> a3-9 quat quad) t1-1) (set! (-> a3-9 scale quad) t2-3) ) ) @@ -1596,11 +1610,11 @@ (let* ((a3-15 (-> arg0 data (+ a2-10 62))) (t2-4 (-> v1-9 data (+ a2-10 62))) (t0-9 (-> t2-4 trans quad)) - (t1-3 (-> t2-4 quat vec quad)) + (t1-3 (-> t2-4 quat quad)) (t2-5 (-> t2-4 scale quad)) ) (set! (-> a3-15 trans quad) t0-9) - (set! (-> a3-15 quat vec quad) t1-3) + (set! (-> a3-15 quat quad) t1-3) (set! (-> a3-15 scale quad) t2-5) ) ) @@ -1757,7 +1771,7 @@ (set! (-> v1-15 comp-data) (the-as uint (-> s5-0 fixed))) ) (let ((s4-1 (kmalloc (-> obj kheap) (the-as int s3-0) (kmalloc-flags) "malloc"))) - (unpack-comp-lzo (the (pointer uint8) s4-1) (the (pointer uint8) (-> s5-0 fixed))) + (unpack-comp-lzo (the-as (pointer uint8) s4-1) (the-as (pointer uint8) (-> s5-0 fixed))) (set! (-> s5-0 flags) (logand -2 (-> s5-0 flags))) (logior! (-> s5-0 flags) 2) (set! (-> s5-0 fixed) (the-as joint-anim-compressed-fixed s4-1)) @@ -1792,5 +1806,7 @@ ) (kmemopen global "anim-manager") + (define *anim-manager* (new 'global 'art-joint-anim-manager #x30000)) + (kmemclose) diff --git a/goal_src/jak2/engine/camera/cam-debug.gc b/goal_src/jak2/engine/camera/cam-debug.gc index 69133a24f2..a76dc2d41e 100644 --- a/goal_src/jak2/engine/camera/cam-debug.gc +++ b/goal_src/jak2/engine/camera/cam-debug.gc @@ -1331,41 +1331,39 @@ (define *cam-collision-record* (new 'debug 'cam-collision-record-array 600)) (defun cam-collision-record-save ((arg0 vector) (arg1 vector) (arg2 int) (arg3 symbol) (arg4 camera-slave)) - (with-pp - (when *record-cam-collide-history* - (let ((v1-5 (the-as - cam-collision-record - (+ (+ (* 176 *cam-collision-record-last*) 12) (the-as int *cam-collision-record*)) - ) + (when *record-cam-collide-history* + (let ((v1-5 (the-as + cam-collision-record + (+ (+ (* 176 *cam-collision-record-last*) 12) (the-as int *cam-collision-record*)) ) - ) - (set! (-> v1-5 pos quad) (-> arg0 quad)) - (set! (-> v1-5 vel quad) (-> arg1 quad)) - (set! (-> v1-5 view-flat quad) (-> arg4 view-flat quad)) - (set! (-> v1-5 desired-pos quad) (-> arg4 desired-pos quad)) - (set! (-> v1-5 cam-tpos-cur quad) (-> *camera* tpos-curr-adj quad)) - (set! (-> v1-5 cam-tpos-old quad) (-> *camera* tpos-old-adj quad)) - (set! (-> v1-5 string-min-val quad) (-> arg4 string-min-val quad)) - (set! (-> v1-5 string-max-val quad) (-> arg4 string-max-val quad)) - (set! (-> v1-5 view-off quad) (-> arg4 view-off quad)) - (set! (-> v1-5 frame) (the-as int (-> pp clock frame-counter))) - (set! (-> v1-5 iteration) arg2) - (set! (-> v1-5 move-type) arg3) - (set! (-> v1-5 min-z-override) (-> arg4 min-z-override)) - (set! (-> v1-5 string-push-z) (-> *camera* string-push-z)) - (set! (-> v1-5 view-off-param) (-> arg4 view-off-param)) - ) - (set! *cam-collision-record-show* *cam-collision-record-last*) - (set! *cam-collision-record-last* (+ *cam-collision-record-last* 1)) - (set! *cam-collision-record-last* (mod *cam-collision-record-last* 600)) - (when (= *cam-collision-record-last* *cam-collision-record-first*) - (set! *cam-collision-record-first* (+ *cam-collision-record-first* 1)) - (set! *cam-collision-record-first* (mod *cam-collision-record-first* 600)) - ) + ) + ) + (set! (-> v1-5 pos quad) (-> arg0 quad)) + (set! (-> v1-5 vel quad) (-> arg1 quad)) + (set! (-> v1-5 view-flat quad) (-> arg4 view-flat quad)) + (set! (-> v1-5 desired-pos quad) (-> arg4 desired-pos quad)) + (set! (-> v1-5 cam-tpos-cur quad) (-> *camera* tpos-curr-adj quad)) + (set! (-> v1-5 cam-tpos-old quad) (-> *camera* tpos-old-adj quad)) + (set! (-> v1-5 string-min-val quad) (-> arg4 string-min-val quad)) + (set! (-> v1-5 string-max-val quad) (-> arg4 string-max-val quad)) + (set! (-> v1-5 view-off quad) (-> arg4 view-off quad)) + (set! (-> v1-5 frame) (the-as int (current-time))) + (set! (-> v1-5 iteration) arg2) + (set! (-> v1-5 move-type) arg3) + (set! (-> v1-5 min-z-override) (-> arg4 min-z-override)) + (set! (-> v1-5 string-push-z) (-> *camera* string-push-z)) + (set! (-> v1-5 view-off-param) (-> arg4 view-off-param)) + ) + (set! *cam-collision-record-show* *cam-collision-record-last*) + (set! *cam-collision-record-last* (+ *cam-collision-record-last* 1)) + (set! *cam-collision-record-last* (mod *cam-collision-record-last* 600)) + (when (= *cam-collision-record-last* *cam-collision-record-first*) + (set! *cam-collision-record-first* (+ *cam-collision-record-first* 1)) + (set! *cam-collision-record-first* (mod *cam-collision-record-first* 600)) ) - 0 - (none) ) + 0 + (none) ) (defun cam-collision-record-step ((arg0 int)) diff --git a/goal_src/jak2/engine/camera/cam-master.gc b/goal_src/jak2/engine/camera/cam-master.gc index e3a1611fd2..b2cae74802 100644 --- a/goal_src/jak2/engine/camera/cam-master.gc +++ b/goal_src/jak2/engine/camera/cam-master.gc @@ -61,13 +61,11 @@ (set! (-> self string-max target z) (-> self settings string-max-length)) (set! (-> self string-push-z) (fmax (-> self string-min value z) (-> *CAMERA-bank* default-string-push-z))) (cond - ((>= (- (-> self clock frame-counter) (get-notice-time (the-as process-focusable gp-0))) - (-> *CAMERA-bank* attack-timeout) - ) + ((>= (- (current-time) (get-notice-time (the-as process-focusable gp-0))) (-> *CAMERA-bank* attack-timeout)) (set! (-> self being-attacked) #f) ) (else - (set! (-> self attack-start) (-> self clock frame-counter)) + (set! (-> self attack-start) (current-time)) (set! (-> self being-attacked) #t) (when (or (!= (-> last-try-to-look-at-data horz) 0.0) (!= (-> last-try-to-look-at-data vert) 0.0)) (set! (-> self string-max target y) (fmax (-> self string-max target y) (-> last-try-to-look-at-data vert))) @@ -117,14 +115,12 @@ (gp-0 (logior! (-> self master-options) (cam-master-options-u32 HAVE_TARGET)) (cond - ((>= (- (-> self clock frame-counter) (get-notice-time (the-as target gp-0))) - (-> *CAMERA-bank* attack-timeout) - ) + ((>= (- (current-time) (get-notice-time (the-as target gp-0))) (-> *CAMERA-bank* attack-timeout)) (set! (-> self being-attacked) #f) ) (else (if (not (-> self being-attacked)) - (set! (-> self attack-start) (-> self clock frame-counter)) + (set! (-> self attack-start) (current-time)) ) (set! (-> self being-attacked) #t) (when (or (!= (-> last-try-to-look-at-data horz) 0.0) (!= (-> last-try-to-look-at-data vert) 0.0)) @@ -927,7 +923,7 @@ ) ) ((= v1-0 'part-water-drip) - (set! (-> self water-drip-time) (-> self clock frame-counter)) + (set! (-> self water-drip-time) (current-time)) (set! (-> self water-drip-mult) (the-as float (-> event param 0))) (set! (-> self water-drip-speed) (the-as float (-> event param 1))) ) diff --git a/goal_src/jak2/engine/camera/cam-states.gc b/goal_src/jak2/engine/camera/cam-states.gc index 94eb2f478f..f217814e00 100644 --- a/goal_src/jak2/engine/camera/cam-states.gc +++ b/goal_src/jak2/engine/camera/cam-states.gc @@ -522,7 +522,7 @@ (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) + (let ((gp-0 (current-time))) (until #f (when (not (paused?)) (let ((s4-0 (vector-reset! (new-stack-vector0))) @@ -568,10 +568,10 @@ ) (cond ((and (= (-> s4-0 x) 0.0) (= (-> s4-0 y) 0.0)) - (set! gp-0 (-> self clock frame-counter)) + (set! gp-0 (current-time)) ) (else - (let ((v1-39 (min 10 (max 1 (- (-> self clock frame-counter) gp-0))))) + (let ((v1-39 (min 10 (max 1 (- (current-time) gp-0))))) (vector-float*! s4-0 s4-0 (* 0.1 (the float v1-39))) ) ) @@ -2104,8 +2104,8 @@ ) (set! (-> self los-last-pos quad) (-> self good-point quad)) (when *display-cam-los-debug* - (format 0 "going because u(~f) > 0 frame ~D~%" f30-2 (-> self clock frame-counter)) - (format *stdcon* " going because u(~f) > 0 frame ~D~%" f30-2 (-> self clock frame-counter)) + (format 0 "going because u(~f) > 0 frame ~D~%" f30-2 (current-time)) + (format *stdcon* " going because u(~f) > 0 frame ~D~%" f30-2 (current-time)) ) (logior! (-> self options) (cam-slave-options-u32 GOTO_GOOD_POINT)) ) @@ -2352,9 +2352,7 @@ (if (-> self have-phony-joystick) (set! f28-0 (* 0.05 (-> self phony-joystick-y))) ) - (if (and (-> *camera* being-attacked) - (< (- (-> self clock frame-counter) (-> *camera* attack-start)) (seconds 0.25)) - ) + (if (and (-> *camera* being-attacked) (< (- (current-time) (-> *camera* attack-start)) (seconds 0.25))) (set! f28-0 0.05) ) (when (logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)) @@ -2598,7 +2596,7 @@ ) (vector-flatten! s5-3 s5-3 (-> *camera* local-down)) ) - ((< (- (-> self clock frame-counter) (the-as int (-> self butt-timer))) 0) + ((< (- (current-time) (the-as int (-> self butt-timer))) 0) (vector-flatten! s5-3 (-> self butt-vector) (-> *camera* local-down)) ) (else @@ -2968,7 +2966,7 @@ object (cond ((= v1-0 'get-behind) - (set! (-> self butt-timer) (the-as uint (+ (-> self clock frame-counter) (seconds 0.25)))) + (set! (-> self butt-timer) (the-as uint (+ (current-time) (seconds 0.25)))) (set! (-> self butt-seek) (the-as basic #t)) (set! v0-0 (-> self butt-vector)) (set! (-> (the-as vector v0-0) quad) (-> (the-as vector (-> event param 0)) quad)) diff --git a/goal_src/jak2/engine/collide/collide-debug.gc b/goal_src/jak2/engine/collide/collide-debug.gc index 41e85967a7..19a995013b 100644 --- a/goal_src/jak2/engine/collide/collide-debug.gc +++ b/goal_src/jak2/engine/collide/collide-debug.gc @@ -172,124 +172,122 @@ ) (defmethod col-rend-method-9 col-rend ((obj col-rend)) - (with-pp - (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (let ((f30-0 (-> obj bbox-radius))) - (let ((v1-0 (-> obj track))) - (cond - ((zero? v1-0) - (set! (-> obj bbox-center quad) (-> (target-pos 0) quad)) - (+! (-> obj bbox-center y) (* 0.7 f30-0)) - ) - ((= v1-0 1) - (position-in-front-of-camera! (-> obj bbox-center) (+ (-> obj camera-to-bbox-dist) (-> obj bbox-radius)) 0.0) - ) - ) - ) - (set! (-> s5-0 bbox min quad) (-> obj bbox-center quad)) - (set! (-> s5-0 bbox min x) (- (-> s5-0 bbox min x) f30-0)) - (set! (-> s5-0 bbox min y) (- (-> s5-0 bbox min y) f30-0)) - (set! (-> s5-0 bbox min z) (- (-> s5-0 bbox min z) f30-0)) - (set! (-> s5-0 bbox max quad) (-> obj bbox-center quad)) - (+! (-> s5-0 bbox max x) f30-0) - (+! (-> s5-0 bbox max y) f30-0) - (+! (-> s5-0 bbox max z) f30-0) - ) - (let ((v1-9 -1)) - (let ((a0-9 (-> obj cspec))) - (if (not (logtest? a0-9 (collide-spec crate))) - (set! v1-9 (logxor v1-9 1)) - ) - (if (not (logtest? a0-9 (collide-spec civilian))) - (set! v1-9 (logxor v1-9 64)) - ) - (if (not (logtest? a0-9 (collide-spec enemy))) - (set! v1-9 (logxor #x80000 v1-9)) - ) - (if (not (logtest? a0-9 (collide-spec obstacle))) - (set! v1-9 (logxor v1-9 2)) - ) - (if (not (logtest? a0-9 (collide-spec vehicle-sphere))) - (set! v1-9 (logand #x80743 v1-9)) - ) - ) - (set! (-> s5-0 collide-with) (the-as collide-spec v1-9)) - ) - (set! (-> s5-0 ignore-pat) (new 'static 'pat-surface)) - (set! (-> s5-0 ignore-process0) #f) - (set! (-> s5-0 ignore-process1) #f) - (add-debug-box - #t - (bucket-id debug2) - (the-as vector (-> s5-0 bbox)) - (-> s5-0 bbox max) - (if (logtest? (-> pp clock frame-counter) 128) - (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x20) - (new 'static 'rgba :a #x20) - ) - ) - (fill-using-bounding-box *collide-cache* s5-0) - ) - (let ((s5-1 (-> obj show-only)) - (a1-17 (new 'stack 'col-rend-filter)) - ) - (when (nonzero? s5-1) + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (let ((f30-0 (-> obj bbox-radius))) + (let ((v1-0 (-> obj track))) (cond - ((logtest? s5-1 8) - (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :noboard #x1)) + ((zero? v1-0) + (set! (-> obj bbox-center quad) (-> (target-pos 0) quad)) + (+! (-> obj bbox-center y) (* 0.7 f30-0)) ) - ((logtest? s5-1 16) - (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :nogrind #x1)) + ((= v1-0 1) + (position-in-front-of-camera! (-> obj bbox-center) (+ (-> obj camera-to-bbox-dist) (-> obj bbox-radius)) 0.0) ) - ((logtest? s5-1 32) - (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :nogrind #x1)) - (set! (-> a1-17 show-pat-set) (new 'static 'pat-surface :nojak #x1)) - ) - (else - (if (logtest? s5-1 8192) - (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :nolineofsight #x1) (-> a1-17 show-pat-set))) - ) - (if (logtest? s5-1 1024) - (set! (-> a1-17 show-pat-set noentity) 1) - ) - (if (logtest? s5-1 64) - (set! (-> a1-17 show-pat-set noboard) 1) - ) - (if (logtest? s5-1 2048) - (set! (-> a1-17 show-pat-set nogrind) 1) - ) - (if (logtest? s5-1 128) - (set! (-> a1-17 show-pat-set nocamera) 1) - ) - (if (logtest? s5-1 4096) - (set! (-> a1-17 show-pat-set nojak) 1) - ) - (if (logtest? s5-1 256) - (set! (-> a1-17 show-pat-set noedge) 1) - ) - (if (logtest? s5-1 #x8000) - (set! (-> a1-17 show-pat-set nopilot) 1) - ) - (if (logtest? s5-1 512) - (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :noendlessfall #x1) (-> a1-17 show-pat-set))) - ) - (if (logtest? s5-1 #x4000) - (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :nomech #x1) (-> a1-17 show-pat-set))) - ) - (if (logtest? #x10000 s5-1) - (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :noproj #x1) (-> a1-17 show-pat-set))) - ) - (if (logtest? #x40000 s5-1) - (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :probe #x1) (-> a1-17 show-pat-set))) - ) - (if (logtest? #x20000 s5-1) - (logior! (-> a1-17 event-mask) 64) - ) - ) ) ) - (col-rend-draw obj a1-17) + (set! (-> s5-0 bbox min quad) (-> obj bbox-center quad)) + (set! (-> s5-0 bbox min x) (- (-> s5-0 bbox min x) f30-0)) + (set! (-> s5-0 bbox min y) (- (-> s5-0 bbox min y) f30-0)) + (set! (-> s5-0 bbox min z) (- (-> s5-0 bbox min z) f30-0)) + (set! (-> s5-0 bbox max quad) (-> obj bbox-center quad)) + (+! (-> s5-0 bbox max x) f30-0) + (+! (-> s5-0 bbox max y) f30-0) + (+! (-> s5-0 bbox max z) f30-0) ) - (none) + (let ((v1-9 -1)) + (let ((a0-9 (-> obj cspec))) + (if (not (logtest? a0-9 (collide-spec crate))) + (set! v1-9 (logxor v1-9 1)) + ) + (if (not (logtest? a0-9 (collide-spec civilian))) + (set! v1-9 (logxor v1-9 64)) + ) + (if (not (logtest? a0-9 (collide-spec enemy))) + (set! v1-9 (logxor #x80000 v1-9)) + ) + (if (not (logtest? a0-9 (collide-spec obstacle))) + (set! v1-9 (logxor v1-9 2)) + ) + (if (not (logtest? a0-9 (collide-spec vehicle-sphere))) + (set! v1-9 (logand #x80743 v1-9)) + ) + ) + (set! (-> s5-0 collide-with) (the-as collide-spec v1-9)) + ) + (set! (-> s5-0 ignore-pat) (new 'static 'pat-surface)) + (set! (-> s5-0 ignore-process0) #f) + (set! (-> s5-0 ignore-process1) #f) + (add-debug-box + #t + (bucket-id debug2) + (the-as vector (-> s5-0 bbox)) + (-> s5-0 bbox max) + (if (logtest? (current-time) 128) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x20) + (new 'static 'rgba :a #x20) + ) + ) + (fill-using-bounding-box *collide-cache* s5-0) ) + (let ((s5-1 (-> obj show-only)) + (a1-17 (new 'stack 'col-rend-filter)) + ) + (when (nonzero? s5-1) + (cond + ((logtest? s5-1 8) + (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :noboard #x1)) + ) + ((logtest? s5-1 16) + (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :nogrind #x1)) + ) + ((logtest? s5-1 32) + (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :nogrind #x1)) + (set! (-> a1-17 show-pat-set) (new 'static 'pat-surface :nojak #x1)) + ) + (else + (if (logtest? s5-1 8192) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :nolineofsight #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? s5-1 1024) + (set! (-> a1-17 show-pat-set noentity) 1) + ) + (if (logtest? s5-1 64) + (set! (-> a1-17 show-pat-set noboard) 1) + ) + (if (logtest? s5-1 2048) + (set! (-> a1-17 show-pat-set nogrind) 1) + ) + (if (logtest? s5-1 128) + (set! (-> a1-17 show-pat-set nocamera) 1) + ) + (if (logtest? s5-1 4096) + (set! (-> a1-17 show-pat-set nojak) 1) + ) + (if (logtest? s5-1 256) + (set! (-> a1-17 show-pat-set noedge) 1) + ) + (if (logtest? s5-1 #x8000) + (set! (-> a1-17 show-pat-set nopilot) 1) + ) + (if (logtest? s5-1 512) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :noendlessfall #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? s5-1 #x4000) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :nomech #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? #x10000 s5-1) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :noproj #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? #x40000 s5-1) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :probe #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? #x20000 s5-1) + (logior! (-> a1-17 event-mask) 64) + ) + ) + ) + ) + (col-rend-draw obj a1-17) + ) + (none) ) diff --git a/goal_src/jak2/engine/collide/los-control.gc b/goal_src/jak2/engine/collide/los-control.gc index 2bcdcfe05e..bb61a73985 100644 --- a/goal_src/jak2/engine/collide/los-control.gc +++ b/goal_src/jak2/engine/collide/los-control.gc @@ -11,7 +11,7 @@ ;; WARN: Return type mismatch time-frame vs none. (defmethod los-control-method-9 los-control ((obj los-control) (process process-focusable) (trans-vec vector) (radius float)) - (when (and (>= (- (-> self clock frame-counter) (-> obj last-check-time)) (-> obj check-interval)) + (when (and (>= (- (current-time) (-> obj last-check-time)) (-> obj check-interval)) (-> obj src-proc) (or process (-> obj dst-proc)) ) @@ -53,13 +53,13 @@ (let ((f30-0 (probe-using-line-sphere *collide-cache* cquery))) (quad-copy! (the-as pointer (-> obj last-collide-result)) (the-as pointer (-> cquery best-other-tri)) 6) (if (>= 0.0 f30-0) - (set! (-> obj have-no-los) (-> self clock frame-counter)) - (set! (-> obj have-los) (-> self clock frame-counter)) + (set! (-> obj have-no-los) (current-time)) + (set! (-> obj have-los) (current-time)) ) ) ) ) - (set! (-> obj last-check-time) (-> self clock frame-counter)) + (set! (-> obj last-check-time) (current-time)) ) ) ) @@ -68,14 +68,14 @@ ) (defmethod check-los? los-control ((obj los-control) (arg0 time-frame)) - (and (>= (- (-> self clock frame-counter) (-> obj have-los)) (+ (-> obj check-interval) arg0)) - (< (- (-> self clock frame-counter) (-> obj have-no-los)) (-> obj check-interval)) + (and (>= (- (current-time) (-> obj have-los)) (+ (-> obj check-interval) arg0)) + (< (- (current-time) (-> obj have-no-los)) (-> obj check-interval)) ) ) (defmethod skip-check-los? los-control ((obj los-control) (arg0 int)) - (and (>= (- (-> self clock frame-counter) (-> obj have-no-los)) (+ (-> obj check-interval) arg0)) - (< (- (-> self clock frame-counter) (-> obj have-los)) (-> obj check-interval)) + (and (>= (- (current-time) (-> obj have-no-los)) (+ (-> obj check-interval) arg0)) + (< (- (current-time) (-> obj have-los)) (-> obj check-interval)) ) ) diff --git a/goal_src/jak2/engine/common_objs/base-plat.gc b/goal_src/jak2/engine/common_objs/base-plat.gc index 7fc3ebdd2e..146bf7c0ae 100644 --- a/goal_src/jak2/engine/common_objs/base-plat.gc +++ b/goal_src/jak2/engine/common_objs/base-plat.gc @@ -64,7 +64,7 @@ For example for an elevator pre-compute the distance between the first and last and translate the platform via the `smush` @see [[smush-control]]" (activate! (-> obj smush) -1.0 60 150 1.0 1.0 (-> self clock)) - (set! (-> obj bounce-time) (-> self clock frame-counter)) + (set! (-> obj bounce-time) (current-time)) (set! (-> obj bouncing) #t) (sound-play "plat-bounce" :position (-> obj root-override trans)) (logclear! (-> obj mask) (process-mask sleep)) @@ -276,7 +276,7 @@ eco-door-event-handler :virtual #t :event eco-door-event-handler :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (process-entity-status! self (entity-perm-status subtask-complete) #t) (let ((prim (-> self root-override root-prim))) (set! (-> prim prim-core collide-as) (collide-spec)) diff --git a/goal_src/jak2/engine/common_objs/basebutton.gc b/goal_src/jak2/engine/common_objs/basebutton.gc index c3f1fe5ed3..e7f99ee920 100644 --- a/goal_src/jak2/engine/common_objs/basebutton.gc +++ b/goal_src/jak2/engine/common_objs/basebutton.gc @@ -203,7 +203,7 @@ ) :enter (behavior () (press! self #t) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -218,7 +218,7 @@ (sleep-code) ) (else - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (the int (* 300.0 (-> self timeout)))) + (until (>= (- (current-time) (-> self state-time)) (the int (* 300.0 (-> self timeout)))) (suspend) ) (send-event! self (-> self event-going-up)) diff --git a/goal_src/jak2/engine/common_objs/collectables.gc b/goal_src/jak2/engine/common_objs/collectables.gc index 6c35fb1f2d..1ac46f7ae0 100644 --- a/goal_src/jak2/engine/common_objs/collectables.gc +++ b/goal_src/jak2/engine/common_objs/collectables.gc @@ -126,75 +126,73 @@ ) (defmethod initialize-options collectable ((obj collectable) (arg0 int) (arg1 float) (arg2 fact-info)) - (with-pp - (logclear! (-> obj mask) (process-mask crate enemy platform ambient)) - (set! (-> obj mask) (logior (process-mask bit18) (-> obj mask))) - (set! (-> obj flags) (collectable-flag pickup no-eco-blue)) - (set! (-> obj bob-amount) arg1) - (set! (-> obj bob-offset) (the-as seconds (+ (the-as int (-> obj root-override2 trans x)) - (the-as int (-> obj root-override2 trans y)) - (the-as int (-> obj root-override2 trans z)) - ) - ) - ) - (cond - ((or (= (vector-length (-> obj root-override2 transv)) 0.0) - (logtest? (-> obj fact options) (actor-option auto-pickup)) - ) - (vector-reset! (-> obj root-override2 transv)) - ) - (else - (logior! (-> obj flags) (collectable-flag bounce)) - (logclear! (-> obj flags) (collectable-flag pickup)) - (logclear! (-> obj mask) (process-mask actor-pause)) - (set! (-> obj bob-amount) 0.0) + (logclear! (-> obj mask) (process-mask crate enemy platform ambient)) + (set! (-> obj mask) (logior (process-mask bit18) (-> obj mask))) + (set! (-> obj flags) (collectable-flag pickup no-eco-blue)) + (set! (-> obj bob-amount) arg1) + (set! (-> obj bob-offset) (the-as seconds (+ (the-as int (-> obj root-override2 trans x)) + (the-as int (-> obj root-override2 trans y)) + (the-as int (-> obj root-override2 trans z)) + ) + ) ) + (cond + ((or (= (vector-length (-> obj root-override2 transv)) 0.0) + (logtest? (-> obj fact options) (actor-option auto-pickup)) + ) + (vector-reset! (-> obj root-override2 transv)) + ) + (else + (logior! (-> obj flags) (collectable-flag bounce)) + (logclear! (-> obj flags) (collectable-flag pickup)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj bob-amount) 0.0) ) - (when (> arg0 0) - (logior! (-> obj flags) (collectable-flag fadeout)) - (set! (-> obj fadeout-timeout) (the-as seconds arg0)) - (if (logtest? (actor-option no-distance-check-fadeout) (-> arg2 options)) - (logior! (-> obj flags) (collectable-flag no-distance-check-fadeout)) - ) - ) - (set! (-> obj collect-timeout) (the-as seconds 99)) - (set! (-> obj birth-time) (-> pp clock frame-counter)) - (set! (-> obj base quad) (-> obj root-override2 trans quad)) - (set! (-> obj old-base quad) (-> obj root-override2 trans quad)) - (set! (-> obj pickup-handle) (the-as handle #f)) - (case (-> obj fact pickup-type) - (((pickup-type eco-pill-green) - (pickup-type eco-pill-dark) - (pickup-type eco-green) - (pickup-type money) - (pickup-type gem) - (pickup-type skill) - (pickup-type eco-blue) - (pickup-type health) - (pickup-type trick-point) - ) - (logclear! (-> obj flags) (collectable-flag no-eco-blue)) - ) - ) - (if (logtest? (-> obj fact options) (actor-option big-collision)) - (set! (-> obj root-override2 root-prim local-sphere w) - (* 2.5 (-> obj root-override2 root-prim local-sphere w)) - ) - ) - (when (and arg2 (nonzero? (-> obj draw))) - (let* ((s5-0 (-> arg2 process)) - (v1-56 (if (type? s5-0 process-drawable) - s5-0 - ) - ) - ) - (if v1-56 - (set! (-> obj draw light-index) (-> (the-as process-drawable v1-56) draw light-index)) - ) - ) - ) - obj ) + (when (> arg0 0) + (logior! (-> obj flags) (collectable-flag fadeout)) + (set! (-> obj fadeout-timeout) (the-as seconds arg0)) + (if (logtest? (actor-option no-distance-check-fadeout) (-> arg2 options)) + (logior! (-> obj flags) (collectable-flag no-distance-check-fadeout)) + ) + ) + (set! (-> obj collect-timeout) (the-as seconds 99)) + (set! (-> obj birth-time) (current-time)) + (set! (-> obj base quad) (-> obj root-override2 trans quad)) + (set! (-> obj old-base quad) (-> obj root-override2 trans quad)) + (set! (-> obj pickup-handle) (the-as handle #f)) + (case (-> obj fact pickup-type) + (((pickup-type eco-pill-green) + (pickup-type eco-pill-dark) + (pickup-type eco-green) + (pickup-type money) + (pickup-type gem) + (pickup-type skill) + (pickup-type eco-blue) + (pickup-type health) + (pickup-type trick-point) + ) + (logclear! (-> obj flags) (collectable-flag no-eco-blue)) + ) + ) + (if (logtest? (-> obj fact options) (actor-option big-collision)) + (set! (-> obj root-override2 root-prim local-sphere w) + (* 2.5 (-> obj root-override2 root-prim local-sphere w)) + ) + ) + (when (and arg2 (nonzero? (-> obj draw))) + (let* ((s5-0 (-> arg2 process)) + (v1-56 (if (type? s5-0 process-drawable) + s5-0 + ) + ) + ) + (if v1-56 + (set! (-> obj draw light-index) (-> (the-as process-drawable v1-56) draw light-index)) + ) + ) + ) + obj ) (defmethod initialize-allocations collectable ((obj collectable)) @@ -488,26 +486,24 @@ (a3-12 0) (t0-9 (lambda ((arg0 part-tracker)) - (with-pp - (let ((v1-1 (handle->process (-> arg0 userdata)))) - (when (the-as process v1-1) - (let* ((s5-0 (handle->process (-> (the-as collectable v1-1) pickup-handle))) - (a0-9 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - (a2-0 (if (not a0-9) - (-> arg0 root trans) - (get-trans (the-as process-focusable a0-9) 3) - ) - ) - ) - (vector-lerp! - (-> arg0 root trans) - (-> arg0 offset) - a2-0 - (/ (the float (- (-> pp clock frame-counter) (-> arg0 start-time))) (the float (-> arg0 part group duration))) - ) + (let ((v1-1 (handle->process (-> arg0 userdata)))) + (when (the-as process v1-1) + (let* ((s5-0 (handle->process (-> (the-as collectable v1-1) pickup-handle))) + (a0-9 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + (a2-0 (if (not a0-9) + (-> arg0 root trans) + (get-trans (the-as process-focusable a0-9) 3) + ) + ) + ) + (vector-lerp! + (-> arg0 root trans) + (-> arg0 offset) + a2-0 + (/ (the float (- (current-time) (-> arg0 start-time))) (the float (-> arg0 part group duration))) ) ) ) @@ -615,13 +611,13 @@ ) (logior! (-> self flags) (collectable-flag suck-in)) (when (= (-> self speed w) 0.0) - (set! (-> self suck-time) (-> self clock frame-counter)) + (set! (-> self suck-time) (current-time)) (set! (-> self speed x) (rand-vu-float-range 327680.0 819200.0)) ) (+! (-> self speed w) (* (lerp-scale 40960.0 (-> self speed x) - (the float (- (-> self clock frame-counter) (the-as int (-> self suck-time)))) + (the float (- (current-time) (the-as int (-> self suck-time)))) 45.0 60.0 ) @@ -639,9 +635,7 @@ (vector-rotate-y! s5-2 s5-2 (* (-> self speed y) (-> self speed z) (-> self clock seconds-per-frame))) ) (set! (-> self suck-y-offset) - (* 2048.0 - (sin (* 873.81335 (the float (mod (- (-> self clock frame-counter) (the-as int (-> self suck-time))) 75)))) - ) + (* 2048.0 (sin (* 873.81335 (the float (mod (- (current-time) (the-as int (-> self suck-time))) 75))))) ) (vector+! (-> self base) gp-1 s5-2) ) @@ -679,9 +673,7 @@ (local-vars (v0-4 none)) (when (and (or (= arg2 'touch) (= arg2 'attack)) (and (logtest? (-> self flags) (collectable-flag pickup)) - (>= (- (-> self clock frame-counter) (the-as int (-> self birth-time))) - (the-as time-frame (-> self collect-timeout)) - ) + (>= (- (current-time) (the-as int (-> self birth-time))) (the-as time-frame (-> self collect-timeout))) (not (and (-> self next-state) (= (-> self next-state name) 'pickup))) (send-event arg0 'get-pickup (-> self fact pickup-type) (-> self fact pickup-amount)) ) @@ -748,7 +740,7 @@ ((= arg2 'fade) (logior! (-> self flags) (collectable-flag fadeout)) (set! (-> self fadeout-timeout) (the-as seconds 30)) - (set! v0-4 (the-as none (-> self clock frame-counter))) + (set! v0-4 (the-as none (current-time))) (set! (-> self birth-time) (the-as time-frame v0-4)) v0-4 ) @@ -841,9 +833,9 @@ (let ((gp-0 (new 'stack 'trajectory))) (set! (-> self base y) (-> self jump-pos y)) (setup-from-to-duration! gp-0 (-> self root-override2 trans) (-> self jump-pos) 300.0 -2.2755556) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) - (let ((f0-2 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) + (let ((f0-2 (the float (- (current-time) (-> self state-time))))) (compute-trans-at-time gp-0 f0-2 (-> self root-override2 trans)) ) (transform-post) @@ -872,7 +864,7 @@ :virtual #t :event collectable-standard-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (case (-> self pickup-type) (((pickup-type gem)) (sound-play "gem-spawn") @@ -987,9 +979,7 @@ (go-virtual suck (process->handle proc)) ) (logtest? (-> self flags) (collectable-flag pickup)) - (>= (- (-> self clock frame-counter) (the-as int (-> self birth-time))) - (the-as time-frame (-> self collect-timeout)) - ) + (>= (- (current-time) (the-as int (-> self birth-time))) (the-as time-frame (-> self collect-timeout))) ) ) (logclear! (-> self mask) (process-mask actor-pause)) @@ -1017,11 +1007,9 @@ (if (and (logtest? (-> self flags) (collectable-flag fadeout)) (begin (if (movie?) - (set! (-> self birth-time) (-> self clock frame-counter)) - ) - (>= (- (-> self clock frame-counter) (the-as int (-> self birth-time))) - (the-as time-frame (-> self fadeout-timeout)) + (set! (-> self birth-time) (current-time)) ) + (>= (- (current-time) (the-as int (-> self birth-time))) (the-as time-frame (-> self fadeout-timeout))) ) (or (or (not *target*) (or (< 204800.0 (vector-vector-distance (-> self root-override2 trans) (-> *target* control trans))) @@ -1049,9 +1037,9 @@ (set! (-> self actor-pause) #f) (logior! (-> self flags) (collectable-flag do-fadeout)) (logior! (-> self state-flags) (state-flags sf0)) - (let ((gp-0 (-> self clock frame-counter))) + (let ((gp-0 (current-time))) (until #f - (let ((f0-1 (- 300.0 (the float (- (-> self clock frame-counter) gp-0))))) + (let ((f0-1 (- 300.0 (the float (- (current-time) gp-0))))) (cond ((< f0-1 0.0) (process-entity-status! self (entity-perm-status dead) #t) @@ -1083,9 +1071,7 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (when (and (or (= event-type 'touch) (= event-type 'attack)) (and (logtest? (-> self flags) (collectable-flag pickup)) - (>= (- (-> self clock frame-counter) (the-as int (-> self birth-time))) - (the-as time-frame (-> self collect-timeout)) - ) + (>= (- (current-time) (the-as int (-> self birth-time))) (the-as time-frame (-> self collect-timeout))) (not (and (-> self next-state) (= (-> self next-state name) 'pickup))) (send-event proc 'get-pickup (-> self fact pickup-type) (-> self fact pickup-amount)) ) @@ -1254,8 +1240,8 @@ ) (cond ((nonzero? (-> self respan-delay)) - (let ((gp-0 (-> self clock frame-counter))) - (while (< (- (-> self clock frame-counter) gp-0) (the-as time-frame (-> self respan-delay))) + (let ((gp-0 (current-time))) + (while (< (- (current-time) gp-0) (the-as time-frame (-> self respan-delay))) (suspend) ) ) @@ -1539,10 +1525,7 @@ This commonly includes things such as: (sin (* 109.22667 (the float - (mod - (+ (- (-> pp clock frame-counter) (the-as int (-> obj birth-time))) (the-as time-frame (-> obj bob-offset))) - 600 - ) + (mod (+ (- (current-time) (the-as int (-> obj birth-time))) (the-as time-frame (-> obj bob-offset))) 600) ) ) ) @@ -1574,15 +1557,13 @@ This commonly includes things such as: (+ (-> self base y) (-> self suck-y-offset) (* f30-0 - (sin (* 109.22667 (the float (mod - (+ (- (-> self clock frame-counter) (the-as int (-> self birth-time))) - (the-as time-frame (-> self bob-offset)) - ) - 600 - ) - ) - ) + (sin + (* 109.22667 + (the float + (mod (+ (- (current-time) (the-as int (-> self birth-time))) (the-as time-frame (-> self bob-offset))) 600) + ) ) + ) ) ) ) @@ -1885,12 +1866,12 @@ This commonly includes things such as: ) ) (if (or (and (logtest? s5-2 (collide-status on-surface)) (< (vector-length (-> gp-1 transv)) 1228.8)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 10)) + (>= (- (current-time) (-> self state-time)) (seconds 10)) ) (go-virtual wait) ) - (when (>= (- (-> self clock frame-counter) (the-as int (-> self bounce-time))) (seconds 0.1)) - (set! (-> self bounce-time) (-> self clock frame-counter)) + (when (>= (- (current-time) (the-as int (-> self bounce-time))) (seconds 0.1)) + (set! (-> self bounce-time) (current-time)) (sound-play-by-name (static-sound-name "gem-bounce") (new-sound-id) @@ -1902,7 +1883,7 @@ This commonly includes things such as: ) ) ) - ((>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 15)) + ((>= (- (current-time) (-> self state-time)) (seconds 15)) (go-virtual wait) ) ) @@ -1998,11 +1979,9 @@ This commonly includes things such as: (if (and (logtest? (-> self flags) (collectable-flag fadeout)) (begin (if (movie?) - (set! (-> self birth-time) (-> self clock frame-counter)) - ) - (>= (- (-> self clock frame-counter) (the-as int (-> self birth-time))) - (the-as time-frame (-> self fadeout-timeout)) + (set! (-> self birth-time) (current-time)) ) + (>= (- (current-time) (the-as int (-> self birth-time))) (the-as time-frame (-> self fadeout-timeout))) ) ) (go-virtual fade) diff --git a/goal_src/jak2/engine/common_objs/crates.gc b/goal_src/jak2/engine/common_objs/crates.gc index c36f4ab3a4..6a736633c8 100644 --- a/goal_src/jak2/engine/common_objs/crates.gc +++ b/goal_src/jak2/engine/common_objs/crates.gc @@ -919,8 +919,8 @@ ) ) (when (not arg0) - (let ((s5-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-1) (seconds 0.04)) + (let ((s5-1 (current-time))) + (until (>= (- (current-time) s5-1) (seconds 0.04)) (suspend) ) ) @@ -1077,14 +1077,14 @@ (drop-pickup (-> self fact) #t *entity-pool* (the-as fact-info #f) arg1) (process-entity-status! self (entity-perm-status dead) #t) (process-entity-status! self (entity-perm-status subtask-complete) #t) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 5)) (suspend) ) ) (when (logtest? (actor-option cond-respawn) (-> self fact options)) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 15)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 15)) (suspend) ) ) 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 65a3ce55ee..2fddcbe6c5 100644 --- a/goal_src/jak2/engine/common_objs/dark-eco-pool.gc +++ b/goal_src/jak2/engine/common_objs/dark-eco-pool.gc @@ -299,7 +299,7 @@ ) ) (let* ((gp-0 (-> self draw ripple)) - (f0-1 (the float (logand (-> self clock frame-counter) #xffff))) + (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-9 (fmax -1.0 (fmin 1.0 f0-7))) diff --git a/goal_src/jak2/engine/common_objs/elevator.gc b/goal_src/jak2/engine/common_objs/elevator.gc index 59b6057c03..67ed14e89e 100644 --- a/goal_src/jak2/engine/common_objs/elevator.gc +++ b/goal_src/jak2/engine/common_objs/elevator.gc @@ -294,7 +294,7 @@ which is obviously useful for an elevator." ((= evt-type 'ridden) (let ((proc-focus (handle->process (-> (the-as focus (-> event param 0)) handle)))) (if (= (-> proc-focus type) target) - (set! (-> self sticky-player-last-ride-time) (-> self clock frame-counter)) + (set! (-> self sticky-player-last-ride-time) (current-time)) ) ) #t @@ -394,7 +394,7 @@ which is obviously useful for an elevator." (+ (-> self move-pos 0) (* (-> self path-pos) (- (-> self move-pos 1) (-> self move-pos 0)))) ) (('player-standing-on?) - (= (-> self sticky-player-last-ride-time) (-> self clock frame-counter)) + (= (-> self sticky-player-last-ride-time) (current-time)) ) (('point-inside-shaft?) (move-between-points self (the-as vector (-> event param 1)) (-> self bottom-top 1) (-> self bottom-top 0)) @@ -558,7 +558,7 @@ do so. ) ) :enter (behavior () - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (logclear! (-> self elevator-status) (elevator-status waiting-to-descend moving)) (logior! (-> self mask) (process-mask actor-pause)) (if (nonzero? (-> self sound)) @@ -569,7 +569,7 @@ do so. :trans (behavior () (plat-trans) (when (not (logtest? (-> self elevator-status) (elevator-status waiting-to-descend))) - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (-> self params) (if (and (logtest? (-> self params flags) (elevator-flags elevator-flags-0)) (not (logtest? (-> self params flags) (elevator-flags elevator-flags-3))) @@ -578,7 +578,7 @@ do so. ) ) (when (and (not (logtest? (-> self params flags) (elevator-flags elevator-flags-3))) - (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 1)) + (>= (- (current-time) (-> self ride-timer)) (seconds 1)) ) (set! (-> self move-pos 0) (-> self move-pos 1)) (set! (-> self move-pos 1) (-> self path-seq data (the int (-> self move-pos 1)) next-pos)) @@ -711,7 +711,7 @@ do so. :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('ridden) - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (elevator-event proc arg1 event-type event) ) (else @@ -720,7 +720,7 @@ do so. ) ) :enter (behavior () - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (if (not (-> *setting-control* user-current jump)) (remove-setting! 'jump) ) @@ -736,10 +736,10 @@ do so. (begin *target* *target*) (focus-test? *target* in-air) ) - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) ) (when (or (logtest? (-> self elevator-status) (elevator-status moving)) - (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 0.5)) + (>= (- (current-time) (-> self ride-timer)) (seconds 0.5)) ) (cond ((and (logtest? (-> self params flags) (elevator-flags elevator-flags-1)) diff --git a/goal_src/jak2/engine/common_objs/generic-obs.gc b/goal_src/jak2/engine/common_objs/generic-obs.gc index 364fad2a98..59e25ac423 100644 --- a/goal_src/jak2/engine/common_objs/generic-obs.gc +++ b/goal_src/jak2/engine/common_objs/generic-obs.gc @@ -233,8 +233,8 @@ (move-along-path self) (suspend) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.5)) (move-along-path self) (suspend) ) @@ -1083,9 +1083,9 @@ This commonly includes things such as: ) ) :code (behavior () - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (while (or (zero? (-> self duration)) - (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self duration))) + (< (- (current-time) (-> self start-time)) (the-as time-frame (-> self duration))) ) (if (-> self callback) ((-> self callback) self) @@ -1114,8 +1114,8 @@ This commonly includes things such as: ) (suspend) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (the-as time-frame (-> self linger-duration))) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (the-as time-frame (-> self linger-duration))) (if (-> self linger-callback) ((-> self linger-callback) self) ) @@ -1236,20 +1236,18 @@ This commonly includes things such as: ) (defun part-tracker-move-to-target ((arg0 part-tracker)) - (with-pp - (let* ((a0-1 *target*) - (a2-0 (if (not a0-1) - (-> arg0 root trans) - (get-trans a0-1 3) - ) - ) - ) - (vector-lerp! - (-> arg0 root trans) - (-> arg0 offset) - a2-0 - (* 0.006666667 (the float (- (-> pp clock frame-counter) (-> arg0 start-time)))) - ) + (let* ((a0-1 *target*) + (a2-0 (if (not a0-1) + (-> arg0 root trans) + (get-trans a0-1 3) + ) + ) + ) + (vector-lerp! + (-> arg0 root trans) + (-> arg0 offset) + a2-0 + (* 0.006666667 (the float (- (current-time) (-> arg0 start-time)))) ) ) ) @@ -1421,7 +1419,7 @@ This commonly includes things such as: :code (behavior () (set! (-> self sound) (the-as uint 0)) (when (!= (+ (-> self lightning spec delay) (-> self lightning spec delay-rand)) 0.0) - (let ((gp-0 (-> self clock frame-counter)) + (let ((gp-0 (current-time)) (s5-0 (the int (rand-vu-float-range (-> self lightning spec delay) (+ (-> self lightning spec delay) (-> self lightning spec delay-rand)) @@ -1429,7 +1427,7 @@ This commonly includes things such as: ) ) ) - (while (< (- (-> self clock frame-counter) gp-0) s5-0) + (while (< (- (current-time) gp-0) s5-0) (suspend) ) ) @@ -1478,9 +1476,9 @@ This commonly includes things such as: ) (set! (-> v1-33 state mode) (the-as lightning-mode a0-10)) ) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (while (or (zero? (-> self duration)) - (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self duration))) + (< (- (current-time) (-> self start-time)) (the-as time-frame (-> self duration))) ) (update self) (suspend) @@ -1505,8 +1503,8 @@ This commonly includes things such as: ) (set! (-> v1-47 state mode) (the-as lightning-mode a0-14)) ) - (set! (-> self start-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self start-time)) (the int f30-0)) + (set! (-> self start-time) (current-time)) + (while (< (- (current-time) (-> self start-time)) (the int f30-0)) (suspend) ) ) @@ -2227,12 +2225,12 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) + (let ((gp-0 (current-time))) (until #f (when (not (paused?)) (vector--float*! (-> self trans) (-> *camera* tpos-curr) (-> *camera* local-down) 28672.0) (send-event *camera* 'teleport) - (if (and (-> *camera* on-ground) (>= (- (-> self clock frame-counter) gp-0) (seconds 1))) + (if (and (-> *camera* on-ground) (>= (- (current-time) gp-0) (seconds 1))) (send-event *camera* 'change-state cam-string (seconds 0.5)) ) ) @@ -2291,7 +2289,7 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) + (let ((gp-0 (current-time))) (until #f (when (not (paused?)) (let ((s4-0 (new 'stack-no-clear 'vector)) @@ -2333,7 +2331,7 @@ This commonly includes things such as: (set! (-> self trans x) (-> *camera* tpos-curr x)) (set! (-> self trans z) (-> *camera* tpos-curr z)) (vector+! (-> self trans) (-> self trans) (-> self view-flat)) - (if (and (-> *camera* on-ground) (>= (- (-> self clock frame-counter) gp-0) (seconds 1))) + (if (and (-> *camera* on-ground) (>= (- (current-time) gp-0) (seconds 1))) (send-event *camera* 'change-state cam-string (seconds 0.5)) ) ) @@ -2406,7 +2404,7 @@ This commonly includes things such as: :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (when (or (= event-type 'touch) (= event-type 'attack)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (send-event proc 'launch (-> self spring-height) (-> self camera) (-> self dest) (-> self seek-time)) ) (the-as object (cond @@ -2451,7 +2449,7 @@ This commonly includes things such as: (not (logtest? (focus-status teleporting) (-> *target* focus-status))) ) ) - (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (< (- (current-time) (-> self state-time)) (seconds 0.5)) ) (send-event *target* 'launch (-> self spring-height) (-> self camera) (-> self dest) (-> self seek-time)) ) @@ -2680,7 +2678,7 @@ This commonly includes things such as: ) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (while ((-> self run-function)) (let* ((gp-0 (handle->process (-> self target))) (a0-4 (if (type? gp-0 process-drawable) @@ -2736,17 +2734,18 @@ This commonly includes things such as: ) (let ((v1-6 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) (set! (-> v1-6 prim-core collide-as) (collide-spec jak enemy)) - (set! (-> v1-6 prim-core collide-with) (collide-spec - crate - civilian - enemy - obstacle - vehicle-sphere - hit-by-player-list - hit-by-others-list - collectable - pusher - ) + (set! (-> v1-6 prim-core collide-with) + (collide-spec + crate + civilian + enemy + obstacle + vehicle-sphere + hit-by-player-list + hit-by-others-list + collectable + pusher + ) ) (set-vector! (-> v1-6 local-sphere) 0.0 0.0 0.0 arg1) (set! (-> s4-0 total-prims) (the-as uint 1)) @@ -2765,10 +2764,8 @@ This commonly includes things such as: (set! (-> self target) (the-as handle #f)) (set! (-> self event) #f) (set! (-> self callback) #f) - (set! (-> self run-function) (lambda :behavior touch-tracker - () - (< (- (-> self clock frame-counter) (-> self state-time)) (-> self duration)) - ) + (set! (-> self run-function) + (lambda :behavior touch-tracker () (< (- (current-time) (-> self state-time)) (-> self duration))) ) (set! (-> self event-hook) (-> (method-of-object self active) event)) (go-virtual active) @@ -2905,7 +2902,7 @@ This commonly includes things such as: ) ) :code (behavior () - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (update-transforms (-> self root-override)) (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) (set! (-> a1-0 options) (overlaps-others-options)) @@ -2918,14 +2915,14 @@ This commonly includes things such as: (set! (-> v1-9 prim-core collide-with) (collide-spec)) ) 0 - (while (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self duration))) + (while (< (- (current-time) (-> self start-time)) (the-as time-frame (-> self duration))) (let ((a1-1 (-> self root-override trans))) (spawn (-> self part) a1-1) ) (suspend) ) - (set! (-> self start-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self linger-duration))) + (set! (-> self start-time) (current-time)) + (while (< (- (current-time) (-> self start-time)) (the-as time-frame (-> self linger-duration))) (suspend) ) (none) diff --git a/goal_src/jak2/engine/common_objs/plat.gc b/goal_src/jak2/engine/common_objs/plat.gc index 73d348a2ae..4b55f73375 100644 --- a/goal_src/jak2/engine/common_objs/plat.gc +++ b/goal_src/jak2/engine/common_objs/plat.gc @@ -257,10 +257,10 @@ This commonly includes things such as: ) (cond ((and proc-focus (focus-test? proc-focus edge-grab)) - (set! (-> self safe-time) (+ (-> self clock frame-counter) (seconds 0.2))) + (set! (-> self safe-time) (+ (current-time) (seconds 0.2))) (return (the-as object #f)) ) - ((< (- (-> self clock frame-counter) (-> self safe-time)) (seconds 0.05)) + ((< (- (current-time) (-> self safe-time)) (seconds 0.05)) (return (the-as object #f)) ) ) @@ -303,7 +303,7 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('edge-grabbed) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (send-event proc 'end-mode) ) ) @@ -313,7 +313,7 @@ This commonly includes things such as: ) ) :enter (behavior ((arg0 symbol)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () diff --git a/goal_src/jak2/engine/common_objs/powerups.gc b/goal_src/jak2/engine/common_objs/powerups.gc index 8fd5758b16..543bf853af 100644 --- a/goal_src/jak2/engine/common_objs/powerups.gc +++ b/goal_src/jak2/engine/common_objs/powerups.gc @@ -20,19 +20,14 @@ (let ((s1-1 (process->handle arg0)) (s2-1 (process->handle arg1)) ) - (let ((s0-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s0-0) (+ arg3 arg4)) + (let ((s0-0 (current-time))) + (until (>= (- (current-time) s0-0) (+ arg3 arg4)) (let ((v1-8 (or (not (handle->process s1-1)) (not (handle->process s2-1))))) (if v1-8 (deactivate self) ) ) - (let* ((f0-1 - (fmax - 0.0 - (fmin 1.0 (/ (- (the float (- (-> self clock frame-counter) s0-0)) (the float arg3)) (the float arg4))) - ) - ) + (let* ((f0-1 (fmax 0.0 (fmin 1.0 (/ (- (the float (- (current-time) s0-0)) (the float arg3)) (the float arg4))))) (a0-18 (process-drawable-pair-random-point! (the-as process-drawable (-> s1-1 process 0)) (the-as process-drawable (-> s2-1 process 0)) @@ -54,8 +49,8 @@ #f ) (else - (let ((s4-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-1) arg5) + (let ((s4-1 (current-time))) + (until (>= (- (current-time) s4-1) arg5) (let ((a0-21 (process-drawable-random-point! (the-as process-drawable (-> s2-1 process 0)) (new-stack-vector0)))) (arg2 a0-21) ) @@ -743,9 +738,8 @@ ) (defbehavior target-color-effect-process target () - (when (and (-> self color-effect) (>= (- (-> self clock frame-counter) (-> self color-effect-start-time)) - (the-as time-frame (-> self color-effect-duration)) - ) + (when (and (-> self color-effect) + (>= (- (current-time) (-> self color-effect-start-time)) (the-as time-frame (-> self color-effect-duration))) ) (set! (-> self color-effect) #f) (set-vector! (-> self draw color-mult) 1.0 1.0 1.0 1.0) @@ -761,7 +755,7 @@ (let ((f30-0 (lerp-scale 1.0 0.0 - (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (the float (- (current-time) (-> self color-effect-start-time))) (* 0.25 (the float (-> self color-effect-duration))) (the float (-> self color-effect-duration)) ) @@ -775,7 +769,7 @@ (let ((f30-1 (lerp-scale 1.0 0.0 - (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (the float (- (current-time) (-> self color-effect-start-time))) (* 0.25 (the float (-> self color-effect-duration))) (the float (-> self color-effect-duration)) ) @@ -789,7 +783,7 @@ (let ((f30-2 (lerp-scale 1.0 0.0 - (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (the float (- (current-time) (-> self color-effect-start-time))) (* 0.25 (the float (-> self color-effect-duration))) (the float (-> self color-effect-duration)) ) @@ -803,7 +797,7 @@ (let ((f30-3 (lerp-scale 1.0 0.0 - (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (the float (- (current-time) (-> self color-effect-start-time))) (* 0.25 (the float (-> self color-effect-duration))) (the float (-> self color-effect-duration)) ) @@ -817,7 +811,7 @@ (let ((f30-4 (lerp-scale 1.0 0.0 - (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (the float (- (current-time) (-> self color-effect-start-time))) (* 0.25 (the float (-> self color-effect-duration))) (the float (-> self color-effect-duration)) ) @@ -831,7 +825,7 @@ (let ((f30-5 (lerp-scale 1.0 0.0 - (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (the float (- (current-time) (-> self color-effect-start-time))) (* 0.25 (the float (-> self color-effect-duration))) (the float (-> self color-effect-duration)) ) @@ -859,13 +853,13 @@ (if (and (logtest? (-> self water flags) (water-flags under-water)) (not (logtest? (-> self water flags) (water-flags swim-ground))) ) - (set! (-> self control unknown-time-frame26) (-> self clock frame-counter)) - (set! (-> self control unknown-time-frame27) (-> self clock frame-counter)) + (set! (-> self control unknown-time-frame26) (current-time)) + (set! (-> self control unknown-time-frame27) (current-time)) ) (cond ((and (= (-> self control ground-pat material) (pat-material ice)) (and (>= (-> self control ctrl-xz-vel) 204.8) - (< (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.05)) + (< (- (current-time) (-> self control last-time-on-surface)) (seconds 0.05)) ) ) (let ((gp-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 38)))) @@ -967,7 +961,7 @@ (cond ((logtest? (-> self game features) (game-feature unk-game-feature-01)) (cond - ((< (-> self clock frame-counter) (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout)) + ((< (current-time) (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout)) (set-setting! 'bg-a 'abs 0.3 0) (set-setting! 'bg-r 'abs 1.0 0) (update-rates! (-> *display* entity-clock) 0.0) @@ -983,9 +977,7 @@ 0 ) ((cpad-pressed? (-> self control cpad number) r1) - (set! (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout) - (+ (-> self clock frame-counter) (seconds 5)) - ) + (set! (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout) (+ (current-time) (seconds 5))) ) ) ) @@ -1100,9 +1092,7 @@ ((or (and (logtest? (-> self control mod-surface flags) (surface-flag air)) (not (logtest? (-> self control status) (collide-status on-surface))) ) - (and (focus-test? self board) - (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) - ) + (and (focus-test? self board) (< (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1))) ) (logior! (-> self focus-status) (focus-status in-air)) (if (logtest? (surface-flag super) (-> self control current-surface flags)) @@ -1137,7 +1127,7 @@ (set! (-> self focus-status) (logior (focus-status ice) (-> self focus-status))) (logclear! (-> self focus-status) (focus-status ice)) ) - (if (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 0.1)) + (if (< (- (current-time) (-> self gun fire-time)) (seconds 0.1)) (set! (-> self focus-status) (logior (focus-status shooting) (-> self focus-status))) (logclear! (-> self focus-status) (focus-status shooting)) ) diff --git a/goal_src/jak2/engine/common_objs/projectile.gc b/goal_src/jak2/engine/common_objs/projectile.gc index 9c8892bc0b..32e2f6de61 100644 --- a/goal_src/jak2/engine/common_objs/projectile.gc +++ b/goal_src/jak2/engine/common_objs/projectile.gc @@ -290,7 +290,7 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self spawn-time)) (-> self timeout)) + (if (>= (- (current-time) (-> self spawn-time)) (-> self timeout)) (go-virtual dissipate) ) (let ((t9-1 (-> self pick-target))) @@ -469,7 +469,7 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p (set! (-> self last-target) (the-as handle #f)) (set! (-> self timeout) (-> arg0 timeout)) (set! (-> self max-hits) 1) - (set! (-> self spawn-time) (-> self clock frame-counter)) + (set! (-> self spawn-time) (current-time)) (set! (-> self update-velocity) #f) (set! (-> self move) projectile-move-fill-line-sphere) (set! (-> self pick-target) #f) @@ -551,7 +551,7 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p ) :trans (behavior () (noop self) - (if (>= (- (-> self clock frame-counter) (-> self spawn-time)) (-> self timeout)) + (if (>= (- (current-time) (-> self spawn-time)) (-> self timeout)) (go-virtual impact) ) (none) @@ -614,9 +614,9 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p (vector-float*! (-> a2-0 transv) (-> a2-0 transv) 0.6) ) (when (and (logtest? v1-0 (collide-status impact-surface)) - (>= (- (-> self clock frame-counter) (-> obj played-bounce-time)) (seconds 0.3)) + (>= (- (current-time) (-> obj played-bounce-time)) (seconds 0.3)) ) - (set! (-> obj played-bounce-time) (-> self clock frame-counter)) + (set! (-> obj played-bounce-time) (current-time)) (sound-play "dark-shot-bounc") ) ) diff --git a/goal_src/jak2/engine/common_objs/rigid-body-plat.gc b/goal_src/jak2/engine/common_objs/rigid-body-plat.gc index cae9118e7e..2c22a5e687 100644 --- a/goal_src/jak2/engine/common_objs/rigid-body-plat.gc +++ b/goal_src/jak2/engine/common_objs/rigid-body-plat.gc @@ -286,10 +286,10 @@ ) ) (('bonk) - (when (>= (- (-> self clock frame-counter) (the-as int (-> obj player-bonk-timeout))) + (when (>= (- (current-time) (the-as int (-> obj player-bonk-timeout))) (the-as time-frame (-> obj info-override player-force-timeout)) ) - (set! (-> obj player-bonk-timeout) (the-as uint (-> self clock frame-counter))) + (set! (-> obj player-bonk-timeout) (the-as uint (current-time))) (let* ((s4-0 arg0) (v1-31 (if (type? s4-0 process-drawable) s4-0 @@ -346,31 +346,29 @@ ) (defmethod alloc-and-init-rigid-body-control rigid-body-platform ((obj rigid-body-platform) (arg0 rigid-body-object-constants)) - (with-pp - (set! (-> obj info-override) (the-as rigid-body-platform-constants arg0)) - (set! (-> obj rbody) (new 'process 'rigid-body-control obj)) - (set! (-> obj control-point-array) - (new 'process 'rigid-body-control-point-inline-array (-> obj info-override control-point-count)) - ) - (update-transforms (-> obj root-override-2)) - (let ((v1-5 (-> obj rbody)) - (a1-3 (-> obj info-override info)) - (a2-2 (-> obj root-override-2 trans)) - (a3-0 (-> obj root-override-2 quat)) - (t0-0 (method-of-object obj rigid-body-object-method-29)) - ) - (rigid-body-method-25 (-> v1-5 state) a1-3 a2-2 a3-0 t0-0) - ) - (set! (-> obj player-bonk-timeout) (the-as uint (-> pp clock frame-counter))) - (set! (-> obj player-force quad) (-> *null-vector* quad)) - (set! (-> obj player-velocity quad) (-> *null-vector* quad)) - (set! (-> obj player-velocity-prev quad) (-> *null-vector* quad)) - (set! (-> obj root-override-2 max-iteration-count) (the-as uint 4)) - (set! (-> obj max-time-step) (-> arg0 extra max-time-step)) - (set! (-> obj water-anim) (the-as water-anim (entity-actor-lookup (-> obj entity) 'water-actor 0))) - 0 - (none) + (set! (-> obj info-override) (the-as rigid-body-platform-constants arg0)) + (set! (-> obj rbody) (new 'process 'rigid-body-control obj)) + (set! (-> obj control-point-array) + (new 'process 'rigid-body-control-point-inline-array (-> obj info-override control-point-count)) + ) + (update-transforms (-> obj root-override-2)) + (let ((v1-5 (-> obj rbody)) + (a1-3 (-> obj info-override info)) + (a2-2 (-> obj root-override-2 trans)) + (a3-0 (-> obj root-override-2 quat)) + (t0-0 (method-of-object obj rigid-body-object-method-29)) + ) + (rigid-body-method-25 (-> v1-5 state) a1-3 a2-2 a3-0 t0-0) ) + (set! (-> obj player-bonk-timeout) (the-as uint (current-time))) + (set! (-> obj player-force quad) (-> *null-vector* quad)) + (set! (-> obj player-velocity quad) (-> *null-vector* quad)) + (set! (-> obj player-velocity-prev quad) (-> *null-vector* quad)) + (set! (-> obj root-override-2 max-iteration-count) (the-as uint 4)) + (set! (-> obj max-time-step) (-> arg0 extra max-time-step)) + (set! (-> obj water-anim) (the-as water-anim (entity-actor-lookup (-> obj entity) 'water-actor 0))) + 0 + (none) ) (defmethod allocate-and-init-cshape rigid-body-platform ((obj rigid-body-platform)) diff --git a/goal_src/jak2/engine/common_objs/voicebox.gc b/goal_src/jak2/engine/common_objs/voicebox.gc index a41c33a41f..b9ec8d6d44 100644 --- a/goal_src/jak2/engine/common_objs/voicebox.gc +++ b/goal_src/jak2/engine/common_objs/voicebox.gc @@ -165,9 +165,7 @@ (set! (-> a1-2 quad) (-> self parent-override 0 trans quad)) (vector-lerp! (-> self root trans) a1-2 s5-0 (-> self blend)) ) - (+! (-> self root trans y) - (* 1638.4 (sin (* 54.613335 (the float (mod (-> self clock frame-counter) 1200))))) - ) + (+! (-> self root trans y) (* 1638.4 (sin (* 54.613335 (the float (mod (current-time) 1200)))))) (let ((s5-1 (new 'stack-no-clear 'quaternion))) (forward-up->quaternion s5-1 @@ -364,14 +362,13 @@ :virtual #t :code (behavior () (remove-setting! 'sound-flava) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self seeker target) 1.0) - (while (and (< (-> self blend) 0.9999) - (not (and (not (handle->process (-> self hint))) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) - (-> *setting-control* user-current hint) - ) - ) + (while (and (< (-> self blend) 0.9999) (not (and (not (handle->process (-> self hint))) + (>= (- (current-time) (-> self state-time)) (seconds 0.05)) + (-> *setting-control* user-current hint) + ) + ) ) (update! (-> self seeker) 0.0) (set! (-> self blend) (-> self seeker value)) diff --git a/goal_src/jak2/engine/common_objs/water.gc b/goal_src/jak2/engine/common_objs/water.gc index c0b25ee0d2..5974c86512 100644 --- a/goal_src/jak2/engine/common_objs/water.gc +++ b/goal_src/jak2/engine/common_objs/water.gc @@ -754,7 +754,7 @@ (and (>= (-> obj height) (-> obj bottom 0 y)) (logtest? (water-flags touch-water) (-> s5-0 flags))) ) (if (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (collide-status on-water)) - (set! (-> obj on-water-time) (-> pp clock frame-counter)) + (set! (-> obj on-water-time) (current-time)) ) (when (not (logtest? (-> obj flags) (water-flags dark-eco lava))) (set! (-> obj drip-wetness) 1.0) @@ -776,9 +776,7 @@ ) (set! (-> obj flags) (logior (water-flags break-surface) (-> obj flags))) (set! (-> s3-0 y) (+ 40.96 (-> obj surface-height))) - (when (and (not (handle->process (-> obj ripple))) - (>= (+ (-> pp clock frame-counter) (seconds -1.5)) (-> obj enter-water-time)) - ) + (when (and (not (handle->process (-> obj ripple))) (>= (+ (current-time) (seconds -1.5)) (-> obj enter-water-time))) (let* ((s1-0 (get-process *default-dead-pool* manipy #x4000)) (s2-0 (when s1-0 @@ -907,7 +905,7 @@ ) (when (< (-> s3-1 y) (-> obj surface-height)) (set! (-> *part-id-table* 502 init-specs 16 initial-valuef) (-> obj surface-height)) - (let ((f0-72 (lerp-scale 12.0 0.4 (the float (- (-> pp clock frame-counter) (-> obj enter-water-time))) 0.0 600.0)) + (let ((f0-72 (lerp-scale 12.0 0.4 (the float (- (current-time) (-> obj enter-water-time))) 0.0 600.0)) (f1-26 0.00012207031) (v1-222 (-> obj process control transv)) ) @@ -947,7 +945,7 @@ s3-2 ) ) - (v1-237 (and v1-236 (< (- (-> pp clock frame-counter) (-> v1-236 last-time-on-surface)) (seconds 0.5)))) + (v1-237 (and v1-236 (< (- (current-time) (-> v1-236 last-time-on-surface)) (seconds 0.5)))) ) (if (and (logtest? (-> obj flags) (water-flags swim-ground)) (and v1-237 @@ -973,7 +971,7 @@ ) (< f0-84 (sqrtf (+ (* (-> a0-112 x) (-> a0-112 x)) (* (-> a0-112 z) (-> a0-112 z))))) ) - (< (+ (-> pp clock frame-counter) (seconds -0.2)) (-> obj enter-water-time)) + (< (+ (current-time) (seconds -0.2)) (-> obj enter-water-time)) (or (>= (+ (- 204.8 (fmin 6144.0 (+ (-> obj ocean-offset) (-> obj bob-offset) (-> obj align-offset)))) f30-1) (-> obj bottom 0 y) ) @@ -981,11 +979,11 @@ ) ) ) - (set! (-> obj swim-time) (-> pp clock frame-counter)) + (set! (-> obj swim-time) (current-time)) (send-event (-> obj process) 'swim) (set! (-> obj flags) (logior (water-flags swimming) (-> obj flags))) (if (not (logtest? (water-flags swimming) s4-0)) - (set! (-> obj enter-swim-time) (-> pp clock frame-counter)) + (set! (-> obj enter-swim-time) (current-time)) ) (cond ((and (logtest? (-> obj flags) (water-flags swim-ground)) @@ -1019,13 +1017,13 @@ ((begin (set! v1-237 (and (logtest? (-> obj flags) (water-flags can-wade)) - (or (not (!= (-> obj bob amp) 0.0)) (>= (- (-> pp clock frame-counter) (-> obj swim-time)) (seconds 0.05))) + (or (not (!= (-> obj bob amp) 0.0)) (>= (- (current-time) (-> obj swim-time)) (seconds 0.05))) (and (>= (- (-> obj height) (-> obj wade-height)) (-> obj bottom 0 y)) v1-237) ) ) v1-237 ) - (set! (-> obj wade-time) (-> pp clock frame-counter)) + (set! (-> obj wade-time) (current-time)) (send-event (-> obj process) 'wade) (set! (-> obj flags) (logior (water-flags wading) (-> obj flags))) ) @@ -1158,7 +1156,7 @@ (t9-35 a0-208 a1-61 a2-22 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) - (set! (-> obj drip-time) (-> pp clock frame-counter)) + (set! (-> obj drip-time) (current-time)) (logclear! (-> obj flags) (water-flags spawn-drip)) (seek! (-> obj drip-wetness) 0.0 (* 0.001 (-> obj drip-speed))) (set! (-> obj drip-speed) (* 1.05 (-> obj drip-speed))) @@ -1166,9 +1164,7 @@ (set! (-> obj drip-height) 0.0) ) ) - ((>= (- (-> pp clock frame-counter) - (the-as time-frame (the int (/ (the float (-> obj drip-time)) (-> obj drip-mult)))) - ) + ((>= (- (current-time) (the-as time-frame (the int (/ (the float (-> obj drip-time)) (-> obj drip-mult))))) (the int (-> obj drip-speed)) ) (let* ((s5-1 (rand-vu-int-range 3 (+ (-> obj process node-list length) -1))) @@ -1286,7 +1282,7 @@ (with-pp (set! (-> obj flags) (logior (water-flags touch-water) (-> obj flags))) (logclear! (-> obj flags) (water-flags jump-out)) - (set! (-> obj enter-water-time) (-> pp clock frame-counter)) + (set! (-> obj enter-water-time) (current-time)) (set-vector! (-> obj enter-water-pos) (-> obj bottom 0 x) (-> obj surface-height) (-> obj bottom 0 z) 1.0) (when (and (logtest? (water-flags part-splash) (-> obj flags)) (logtest? (water-flags part-water) (-> obj flags))) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) @@ -1413,41 +1409,39 @@ ) (defmethod spawn-ripples water-control ((obj water-control) (arg0 float) (arg1 vector) (arg2 int) (arg3 vector) (arg4 symbol)) - (with-pp - (when (and (logtest? (water-flags part-splash) (-> obj flags)) (logtest? (water-flags part-water) (-> obj flags))) - (let ((s4-1 (vector+float*! (new 'stack-no-clear 'vector) arg1 arg3 0.05))) - (set! (-> s4-1 y) (+ 40.96 (-> obj surface-height))) - (if (>= (- (-> pp clock frame-counter) (-> obj distort-time)) (seconds 0.1)) - (splash-spawn arg0 s4-1 arg2) - ) - (when (and arg4 (>= (- (-> pp clock frame-counter) (-> obj distort-time)) (seconds 0.3))) - (set! (-> obj distort-time) (-> pp clock frame-counter)) - (let ((s3-1 (process-spawn - manipy - :init manipy-init - s4-1 - (-> obj process entity) - (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f)) - #f - 0 - :to (-> obj process) - ) + (when (and (logtest? (water-flags part-splash) (-> obj flags)) (logtest? (water-flags part-water) (-> obj flags))) + (let ((s4-1 (vector+float*! (new 'stack-no-clear 'vector) arg1 arg3 0.05))) + (set! (-> s4-1 y) (+ 40.96 (-> obj surface-height))) + (if (>= (- (current-time) (-> obj distort-time)) (seconds 0.1)) + (splash-spawn arg0 s4-1 arg2) + ) + (when (and arg4 (>= (- (current-time) (-> obj distort-time)) (seconds 0.3))) + (set! (-> obj distort-time) (current-time)) + (let ((s3-1 (process-spawn + manipy + :init manipy-init + s4-1 + (-> obj process entity) + (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f)) + #f + 0 + :to (-> obj process) ) - ) - (when s3-1 - (send-event (ppointer->process s3-1) 'anim-mode 'play1) - (send-event (ppointer->process s3-1) 'anim "idle") - (let ((f0-4 (fmax 0.6 (fmin 1.0 (* 2.0 arg0))))) - (set-vector! (-> (the-as process-drawable (-> s3-1 0)) root scale) f0-4 0.5 f0-4 1.0) - ) + ) + ) + (when s3-1 + (send-event (ppointer->process s3-1) 'anim-mode 'play1) + (send-event (ppointer->process s3-1) 'anim "idle") + (let ((f0-4 (fmax 0.6 (fmin 1.0 (* 2.0 arg0))))) + (set-vector! (-> (the-as process-drawable (-> s3-1 0)) root scale) f0-4 0.5 f0-4 1.0) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) (defun water-info<-region ((arg0 water-info) (arg1 drawable-region-prim) (arg2 collide-shape) (arg3 collide-action)) diff --git a/goal_src/jak2/engine/debug/default-menu.gc b/goal_src/jak2/engine/debug/default-menu.gc index 2a9eb91114..71e3fcad16 100644 --- a/goal_src/jak2/engine/debug/default-menu.gc +++ b/goal_src/jak2/engine/debug/default-menu.gc @@ -4280,34 +4280,30 @@ "Clear map" #f ,(lambda () - (let ((v1-1 - (process-spawn-function - process - (lambda () (with-pp - (set-master-mode 'game) - (let ((gp-0 (-> pp clock frame-counter))) - (until (>= (- (-> pp clock frame-counter) gp-0) (seconds 0.3)) - (suspend) - ) - ) - (until #f - (format *stdcon* "press x clear map, press circle cancel~%") - (cond - ((cpad-pressed? 0 x) - (initialize *bigmap*) - (return #f) - ) - ((cpad-pressed? 0 circle) - (return #f) - ) - ) - (suspend) - ) - #f - ) - ) - ) - ) + (let ((v1-1 (process-spawn-function process (lambda () + (set-master-mode 'game) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.3)) + (suspend) + ) + ) + (until #f + (format *stdcon* "press x clear map, press circle cancel~%") + (cond + ((cpad-pressed? 0 x) + (initialize *bigmap*) + (return #f) + ) + ((cpad-pressed? 0 circle) + (return #f) + ) + ) + (suspend) + ) + #f + ) + ) + ) ) (when v1-1 (let ((v0-3 (logclear (-> v1-1 0 mask) (process-mask menu)))) diff --git a/goal_src/jak2/engine/debug/editable-player.gc b/goal_src/jak2/engine/debug/editable-player.gc index abd92e9e15..e41e6edc5d 100644 --- a/goal_src/jak2/engine/debug/editable-player.gc +++ b/goal_src/jak2/engine/debug/editable-player.gc @@ -1370,21 +1370,20 @@ (editable-array-method-9 obj (editable-command update-game) (the-as editable-array #f)) ) ((= arg0 (editable-command update-game)) - ;; TODO - waiting for lights/light-hash to be done - ;; (reset-light-hash *light-hash*) - ;; (let* ((s5-19 (-> obj length)) - ;; (s4-23 0) - ;; (a0-76 (-> obj data s4-23)) - ;; ) - ;; (while (< s4-23 s5-19) - ;; (if a0-76 - ;; (editable-method-23 a0-76) - ;; ) - ;; (+! s4-23 1) - ;; (set! a0-76 (-> obj data s4-23)) - ;; ) - ;; ) - ;; (update-light-hash *light-hash*) + (reset-light-hash *light-hash*) + (let* ((s5-19 (-> obj length)) + (s4-23 0) + (a0-76 (-> obj data s4-23)) + ) + (while (< s4-23 s5-19) + (if a0-76 + (editable-method-23 a0-76) + ) + (+! s4-23 1) + (set! a0-76 (-> obj data s4-23)) + ) + ) + (update-light-hash *light-hash*) ) ((or (= arg0 (editable-command exit)) (= arg0 (editable-command kill))) (deactivate self) @@ -1614,7 +1613,7 @@ (the-as object (deactivate self)) ) (('menu) - (set! v0-0 (+ (-> self clock frame-counter) (the-as time-frame (-> event param 0)))) + (set! v0-0 (+ (current-time) (the-as time-frame (-> event param 0)))) (set! (-> self close-menu-time) (the-as time-frame v0-0)) v0-0 ) @@ -1850,10 +1849,7 @@ (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons start)) ) ) - (when (or (and (= *master-mode* 'menu) - (> (-> self close-menu-time) 0) - (>= (-> self clock frame-counter) (-> self close-menu-time)) - ) + (when (or (and (= *master-mode* 'menu) (> (-> self close-menu-time) 0) (>= (current-time) (-> self close-menu-time))) (cpad-pressed? 1 start) ) (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) diff --git a/goal_src/jak2/engine/entity/entity.gc b/goal_src/jak2/engine/entity/entity.gc index 2e6441fb89..15e4e0a759 100644 --- a/goal_src/jak2/engine/entity/entity.gc +++ b/goal_src/jak2/engine/entity/entity.gc @@ -1204,117 +1204,115 @@ (sv-112 pointer) (sv-128 int) ) - (with-pp - (let ((s4-0 *debug-actor-info*)) - (set! (-> s4-0 process) #f) - (if (zero? (-> s4-0 handle pid)) - (set! (-> s4-0 handle) - (logior (logand (-> s4-0 handle) (shl (the-as uint #xffffffff) 32)) (shr (shl (the-as int #f) 32) 32)) - ) - ) - (let ((v0-0 (handle->process (-> s4-0 handle)))) - (when (not v0-0) - (if (-> s4-0 name) - (set! v0-0 (process-by-name (the-as string (-> s4-0 name)) *active-pool*)) + (let ((s4-0 *debug-actor-info*)) + (set! (-> s4-0 process) #f) + (if (zero? (-> s4-0 handle pid)) + (set! (-> s4-0 handle) + (logior (logand (-> s4-0 handle) (shl (the-as uint #xffffffff) 32)) (shr (shl (the-as int #f) 32) 32)) ) - ) - (set! (-> s4-0 process) v0-0) ) - (set! *debug-actor* (-> s4-0 process)) - ) - (set! sv-16 arg0) - (when (and sv-16 (not (or (= *master-mode* 'menu) (= *master-mode* 'progress)))) - (cond - ((= sv-16 'process) - (let ((s5-1 draw-actor-marks)) - (iterate-process-tree *pusher-pool* (the-as (function object object) s5-1) *null-kernel-context*) - (iterate-process-tree *entity-pool* (the-as (function object object) s5-1) *null-kernel-context*) - ) - ) - (else - (dotimes (s5-2 (-> obj length)) - (let ((v1-25 (-> obj level s5-2))) - (when (= (-> v1-25 status) 'active) - (let ((s4-1 (-> v1-25 bsp level entity))) - (dotimes (s3-0 (-> s4-1 length)) - (let ((s2-0 (-> s4-1 data s3-0 entity))) - (set! sv-20 (-> s2-0 extra trans)) - (when (or (= sv-16 'full) (-> s2-0 extra process)) - (add-debug-x #t (bucket-id debug-no-zbuf1) sv-20 (if (-> s2-0 extra process) - (new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80) - (new 'static 'rgba :r #xff :a #x80) - ) - ) - (let ((s1-0 add-debug-text-3d) - (s0-0 #t) - ) - (set! sv-32 (the-as int (bucket-id debug-no-zbuf1))) - (let ((a2-4 (res-lump-struct s2-0 'name structure)) - (a3-2 sv-20) - (t0-1 (if (logtest? (-> s2-0 extra perm status) (entity-perm-status bit-0 bit-1)) - 1 - 5 - ) - ) - (t1-1 (new 'static 'vector2h :data (new 'static 'array int16 2 0 8))) - ) - (s1-0 s0-0 (the-as bucket-id sv-32) (the-as string a2-4) a3-2 (the-as font-color t0-1) t1-1) - ) - ) - ) - ) - ) - ) - ) - ) + (let ((v0-0 (handle->process (-> s4-0 handle)))) + (when (not v0-0) + (if (-> s4-0 name) + (set! v0-0 (process-by-name (the-as string (-> s4-0 name)) *active-pool*)) ) - ) ) + (set! (-> s4-0 process) v0-0) ) - (when (and *display-actor-vis* (not *debug-actor*)) - (let ((s5-3 *display-actor-vis*)) - (dotimes (s4-2 (-> obj length)) - (let ((s3-1 (-> obj level s4-2))) - (when (= (-> s3-1 status) 'active) - (let ((s2-1 (-> s3-1 bsp level entity))) - (dotimes (s1-1 (-> s2-1 length)) - (let ((s0-1 (-> s2-1 data s1-1 entity))) - (let ((v0-6 (res-lump-data s0-1 'visvol pointer)) - (a1-10 (-> s0-1 extra vis-id)) - ) - (when (and v0-6 (or (= s5-3 #t) (= s5-3 'box))) - (set! sv-48 add-debug-box) - (set! sv-64 #t) - (set! sv-80 (the-as int (bucket-id debug-no-zbuf1))) - (set! sv-96 (&+ v0-6 0)) - (set! sv-112 (&+ v0-6 16)) - (let ((t0-3 (if (is-object-visible? s3-1 a1-10) - (the-as uint #x80808000) - (the-as uint #x80800080) + (set! *debug-actor* (-> s4-0 process)) + ) + (set! sv-16 arg0) + (when (and sv-16 (not (or (= *master-mode* 'menu) (= *master-mode* 'progress)))) + (cond + ((= sv-16 'process) + (let ((s5-1 draw-actor-marks)) + (iterate-process-tree *pusher-pool* (the-as (function object object) s5-1) *null-kernel-context*) + (iterate-process-tree *entity-pool* (the-as (function object object) s5-1) *null-kernel-context*) + ) + ) + (else + (dotimes (s5-2 (-> obj length)) + (let ((v1-25 (-> obj level s5-2))) + (when (= (-> v1-25 status) 'active) + (let ((s4-1 (-> v1-25 bsp level entity))) + (dotimes (s3-0 (-> s4-1 length)) + (let ((s2-0 (-> s4-1 data s3-0 entity))) + (set! sv-20 (-> s2-0 extra trans)) + (when (or (= sv-16 'full) (-> s2-0 extra process)) + (add-debug-x #t (bucket-id debug-no-zbuf1) sv-20 (if (-> s2-0 extra process) + (new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80) + (new 'static 'rgba :r #xff :a #x80) + ) + ) + (let ((s1-0 add-debug-text-3d) + (s0-0 #t) + ) + (set! sv-32 (the-as int (bucket-id debug-no-zbuf1))) + (let ((a2-4 (res-lump-struct s2-0 'name structure)) + (a3-2 sv-20) + (t0-1 (if (logtest? (-> s2-0 extra perm status) (entity-perm-status bit-0 bit-1)) + 1 + 5 ) ) + (t1-1 (new 'static 'vector2h :data (new 'static 'array int16 2 0 8))) ) - (sv-48 sv-64 (the-as bucket-id sv-80) (the-as vector sv-96) (the-as vector sv-112) (the-as rgba t0-3)) + (s1-0 s0-0 (the-as bucket-id sv-32) (the-as string a2-4) a3-2 (the-as font-color t0-1) t1-1) ) ) ) - (when (or (= s5-3 #t) (= s5-3 'sphere)) - (let ((s0-2 (-> s0-1 extra process))) - (when s0-2 - (when (and (type? s0-2 process-drawable) (nonzero? (-> (the-as process-drawable s0-2) draw))) - (add-debug-x - #t - (bucket-id debug-no-zbuf1) - (-> (the-as process-drawable s0-2) root trans) - (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) - ) - (add-debug-sphere - #t - (bucket-id debug2) - (-> (the-as process-drawable s0-2) draw origin) - (-> (the-as process-drawable s0-2) draw bounds w) - (new 'static 'rgba :r #x80 :a #x80) - ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (when (and *display-actor-vis* (not *debug-actor*)) + (let ((s5-3 *display-actor-vis*)) + (dotimes (s4-2 (-> obj length)) + (let ((s3-1 (-> obj level s4-2))) + (when (= (-> s3-1 status) 'active) + (let ((s2-1 (-> s3-1 bsp level entity))) + (dotimes (s1-1 (-> s2-1 length)) + (let ((s0-1 (-> s2-1 data s1-1 entity))) + (let ((v0-6 (res-lump-data s0-1 'visvol pointer)) + (a1-10 (-> s0-1 extra vis-id)) + ) + (when (and v0-6 (or (= s5-3 #t) (= s5-3 'box))) + (set! sv-48 add-debug-box) + (set! sv-64 #t) + (set! sv-80 (the-as int (bucket-id debug-no-zbuf1))) + (set! sv-96 (&+ v0-6 0)) + (set! sv-112 (&+ v0-6 16)) + (let ((t0-3 (if (is-object-visible? s3-1 a1-10) + (the-as uint #x80808000) + (the-as uint #x80800080) + ) + ) + ) + (sv-48 sv-64 (the-as bucket-id sv-80) (the-as vector sv-96) (the-as vector sv-112) (the-as rgba t0-3)) + ) + ) + ) + (when (or (= s5-3 #t) (= s5-3 'sphere)) + (let ((s0-2 (-> s0-1 extra process))) + (when s0-2 + (when (and (type? s0-2 process-drawable) (nonzero? (-> (the-as process-drawable s0-2) draw))) + (add-debug-x + #t + (bucket-id debug-no-zbuf1) + (-> (the-as process-drawable s0-2) root trans) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + ) + (add-debug-sphere + #t + (bucket-id debug2) + (-> (the-as process-drawable s0-2) draw origin) + (-> (the-as process-drawable s0-2) draw bounds w) + (new 'static 'rgba :r #x80 :a #x80) ) ) ) @@ -1327,247 +1325,247 @@ ) ) ) - (if *generate-actor-vis* - (update-vis-volumes obj) - ) - (cond - (*debug-actor* - (let* ((s4-3 *debug-actor*) - (s5-4 (if (type? s4-3 process-drawable) - s4-3 - ) - ) - ) - (when s5-4 - (if (nonzero? (-> (the-as process-drawable s5-4) skel)) - (debug-print-channels (-> (the-as process-drawable s5-4) skel) (the-as symbol *stdcon*)) - ) - (when (and (nonzero? (-> (the-as process-drawable s5-4) nav)) - (-> (the-as process-drawable s5-4) nav) - *display-nav-marks* - ) - (let ((s4-4 (-> (the-as process-drawable s5-4) nav state flags))) - (if (= (logand s4-4 (nav-state-flag in-target-poly)) (nav-state-flag in-target-poly)) - (format *stdcon* "in-target-poly ") - ) - (if (= (logand s4-4 (nav-state-flag directional-mode)) (nav-state-flag directional-mode)) - (format *stdcon* "directional-mode ") - ) - (if (= (logand s4-4 (nav-state-flag initialized)) (nav-state-flag initialized)) - (format *stdcon* "initialized ") - ) - (if (= (logand s4-4 (nav-state-flag display-marks)) (nav-state-flag display-marks)) - (format *stdcon* "display-marks ") - ) - (if (= (logand s4-4 (nav-state-flag recovery-mode)) (nav-state-flag recovery-mode)) - (format *stdcon* "recovery-mode ") - ) - (if (= (logand s4-4 (nav-state-flag touching-sphere)) (nav-state-flag touching-sphere)) - (format *stdcon* "touching-sphere ") - ) - (if (= (logand s4-4 (nav-state-flag trapped-by-sphere)) (nav-state-flag trapped-by-sphere)) - (format *stdcon* "trapped-by-sphere ") - ) - (if (= (logand s4-4 (nav-state-flag blocked)) (nav-state-flag blocked)) - (format *stdcon* "blocked ") - ) - (if (= (logand s4-4 (nav-state-flag avoiding-sphere)) (nav-state-flag avoiding-sphere)) - (format *stdcon* "avoiding-sphere ") - ) - (if (= (logand s4-4 (nav-state-flag target-inside)) (nav-state-flag target-inside)) - (format *stdcon* "target-inside ") - ) - (if (= (logand s4-4 (nav-state-flag debug)) (nav-state-flag debug)) - (format *stdcon* "debug ") - ) - (if (= (logand s4-4 (nav-state-flag at-gap)) (nav-state-flag at-gap)) - (format *stdcon* "at-gap ") - ) - (if (= (logand s4-4 (nav-state-flag in-mesh)) (nav-state-flag in-mesh)) - (format *stdcon* "in-mesh ") - ) - (if (= (logand s4-4 (nav-state-flag at-target)) (nav-state-flag at-target)) - (format *stdcon* "at-target ") - ) - (if (= (logand s4-4 (nav-state-flag target-poly-dirty)) (nav-state-flag target-poly-dirty)) - (format *stdcon* "target-poly-dirty ") - ) - ) - (format *stdcon* "~%") - ) - (when *display-joint-axes* - (if (and (type? (the-as process-drawable s5-4) process-drawable) - (nonzero? (-> (the-as process-drawable s5-4) draw)) - ) - (draw-joint-axes (the-as process-drawable s5-4)) - ) - ) - (draw-actor-marks (the-as process-drawable s5-4)) - ) - ) - ) - (*display-nav-mesh* - (dotimes (s5-5 (-> obj length)) - (let ((v1-145 (-> obj level s5-5))) - (when (= (-> v1-145 status) 'active) - (let ((s4-5 (-> v1-145 bsp nav-meshes))) - (when (nonzero? s4-5) - (dotimes (s3-2 (-> s4-5 length)) - (let ((s2-2 (-> s4-5 s3-2))) - (if (name= *display-nav-mesh* (res-lump-struct s2-2 'name structure)) - (debug-draw s2-2) - ) - ) - ) - ) - ) - ) - ) - ) - ) - (else - (when *display-nav-marks* - (dotimes (s5-6 (-> obj length)) - (let ((v1-163 (-> obj level s5-6))) - (when (= (-> v1-163 status) 'active) - (let ((s4-6 (-> v1-163 bsp nav-meshes))) - (when (nonzero? s4-6) - (dotimes (s3-3 (-> s4-6 length)) - (debug-draw (-> s4-6 s3-3)) - ) - ) - ) - ) - ) - ) - ) - (if (or *display-path-marks* *display-vol-marks*) - (iterate-process-tree - *active-pool* - (the-as (function object object) (lambda ((arg0 process-drawable)) - (when (type? arg0 process-drawable) - (if (nonzero? (-> arg0 path)) - (debug-draw (-> arg0 path)) - ) - (if (nonzero? (-> arg0 vol)) - (debug-draw (-> arg0 vol)) - ) - ) - (none) - ) - ) - *null-kernel-context* - ) - ) - ) - ) - (when (and *display-actor-graph* (not (or (= *master-mode* 'menu) (= *master-mode* 'progress)))) - (if (not (paused?)) - (float-save-timeplot (if (< (the int (the float (mod (-> pp clock frame-counter) 600))) 300) - 1.0 - 0.0 - ) - ) - ) - (camera-plot-float-func - 0.0 - 399.0 - -81920.0 - 81920.0 - float-lookup-redline - (new 'static 'vector4w :x #xff :w #x80) - ) - (camera-plot-float-func - 0.0 - 399.0 - -81920.0 - 81920.0 - float-lookup-blueline - (new 'static 'vector4w :z #xff :w #x80) - ) - (camera-plot-float-func - 0.0 - 399.0 - -81920.0 - 81920.0 - float-lookup-greenline - (new 'static 'vector4w :y #xff :w #x80) - ) - (camera-plot-float-func - 0.0 - 399.0 - 0.0 - 409600.0 - float-lookup-yellowline - (new 'static 'vector4w :x #xff :y #xff :w #x80) - ) - (camera-plot-float-func - 0.0 - 399.0 - 0.0 - 1.0 - float-lookup-timeplot - (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w #x80) - ) - ) - (when *display-split-boxes* - (dotimes (s5-7 (-> obj length)) - (let ((v1-193 (-> obj level s5-7))) - (when (= (-> v1-193 status) 'active) - (let ((s4-7 (-> v1-193 bsp region-tree))) - (when (nonzero? s4-7) - (let* ((s3-4 (-> s4-7 data2 (+ (-> s4-7 length) -1) length)) - (s2-3 0) - (a0-102 (-> (the-as drawable-inline-array-region-prim (-> s4-7 data2 (+ (-> s4-7 length) -1))) data s2-3)) - ) - (while (< s2-3 s3-4) - (debug-draw-region a0-102 0) - (+! s2-3 1) - (set! a0-102 - (-> (the-as drawable-inline-array-region-prim (-> s4-7 data2 (+ (-> s4-7 length) -1))) data s2-3) - ) - ) - ) - ) - ) - ) - ) - ) - ) - (when *display-region-marks* - (dotimes (s5-8 (-> obj length)) - (let ((s4-8 (-> obj level s5-8))) - (when (= (-> s4-8 status) 'active) - (when (nonzero? (-> s4-8 bsp region-trees)) - (let* ((s3-5 (-> s4-8 bsp region-trees length)) - (s2-4 0) - (s1-3 (-> s4-8 bsp region-trees s2-4)) - ) - (while (< s2-4 s3-5) - (let ((s0-4 (-> s1-3 data2 (+ (-> s1-3 length) -1) length))) - (set! sv-128 0) - (let ((a0-117 (-> (the-as drawable-inline-array-region-prim (-> s1-3 data2 (+ (-> s1-3 length) -1))) data sv-128))) - (while (< sv-128 s0-4) - (debug-draw-region a0-117 0) - (set! sv-128 (+ sv-128 1)) - (set! a0-117 - (-> (the-as drawable-inline-array-region-prim (-> s1-3 data2 (+ (-> s1-3 length) -1))) data sv-128) - ) - ) - ) - ) - (+! s2-4 1) - (set! s1-3 (-> s4-8 bsp region-trees s2-4)) - ) - ) - ) - ) - ) - ) - ) - 0 - (none) ) + (if *generate-actor-vis* + (update-vis-volumes obj) + ) + (cond + (*debug-actor* + (let* ((s4-3 *debug-actor*) + (s5-4 (if (type? s4-3 process-drawable) + s4-3 + ) + ) + ) + (when s5-4 + (if (nonzero? (-> (the-as process-drawable s5-4) skel)) + (debug-print-channels (-> (the-as process-drawable s5-4) skel) (the-as symbol *stdcon*)) + ) + (when (and (nonzero? (-> (the-as process-drawable s5-4) nav)) + (-> (the-as process-drawable s5-4) nav) + *display-nav-marks* + ) + (let ((s4-4 (-> (the-as process-drawable s5-4) nav state flags))) + (if (= (logand s4-4 (nav-state-flag in-target-poly)) (nav-state-flag in-target-poly)) + (format *stdcon* "in-target-poly ") + ) + (if (= (logand s4-4 (nav-state-flag directional-mode)) (nav-state-flag directional-mode)) + (format *stdcon* "directional-mode ") + ) + (if (= (logand s4-4 (nav-state-flag initialized)) (nav-state-flag initialized)) + (format *stdcon* "initialized ") + ) + (if (= (logand s4-4 (nav-state-flag display-marks)) (nav-state-flag display-marks)) + (format *stdcon* "display-marks ") + ) + (if (= (logand s4-4 (nav-state-flag recovery-mode)) (nav-state-flag recovery-mode)) + (format *stdcon* "recovery-mode ") + ) + (if (= (logand s4-4 (nav-state-flag touching-sphere)) (nav-state-flag touching-sphere)) + (format *stdcon* "touching-sphere ") + ) + (if (= (logand s4-4 (nav-state-flag trapped-by-sphere)) (nav-state-flag trapped-by-sphere)) + (format *stdcon* "trapped-by-sphere ") + ) + (if (= (logand s4-4 (nav-state-flag blocked)) (nav-state-flag blocked)) + (format *stdcon* "blocked ") + ) + (if (= (logand s4-4 (nav-state-flag avoiding-sphere)) (nav-state-flag avoiding-sphere)) + (format *stdcon* "avoiding-sphere ") + ) + (if (= (logand s4-4 (nav-state-flag target-inside)) (nav-state-flag target-inside)) + (format *stdcon* "target-inside ") + ) + (if (= (logand s4-4 (nav-state-flag debug)) (nav-state-flag debug)) + (format *stdcon* "debug ") + ) + (if (= (logand s4-4 (nav-state-flag at-gap)) (nav-state-flag at-gap)) + (format *stdcon* "at-gap ") + ) + (if (= (logand s4-4 (nav-state-flag in-mesh)) (nav-state-flag in-mesh)) + (format *stdcon* "in-mesh ") + ) + (if (= (logand s4-4 (nav-state-flag at-target)) (nav-state-flag at-target)) + (format *stdcon* "at-target ") + ) + (if (= (logand s4-4 (nav-state-flag target-poly-dirty)) (nav-state-flag target-poly-dirty)) + (format *stdcon* "target-poly-dirty ") + ) + ) + (format *stdcon* "~%") + ) + (when *display-joint-axes* + (if (and (type? (the-as process-drawable s5-4) process-drawable) + (nonzero? (-> (the-as process-drawable s5-4) draw)) + ) + (draw-joint-axes (the-as process-drawable s5-4)) + ) + ) + (draw-actor-marks (the-as process-drawable s5-4)) + ) + ) + ) + (*display-nav-mesh* + (dotimes (s5-5 (-> obj length)) + (let ((v1-145 (-> obj level s5-5))) + (when (= (-> v1-145 status) 'active) + (let ((s4-5 (-> v1-145 bsp nav-meshes))) + (when (nonzero? s4-5) + (dotimes (s3-2 (-> s4-5 length)) + (let ((s2-2 (-> s4-5 s3-2))) + (if (name= *display-nav-mesh* (res-lump-struct s2-2 'name structure)) + (debug-draw s2-2) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (else + (when *display-nav-marks* + (dotimes (s5-6 (-> obj length)) + (let ((v1-163 (-> obj level s5-6))) + (when (= (-> v1-163 status) 'active) + (let ((s4-6 (-> v1-163 bsp nav-meshes))) + (when (nonzero? s4-6) + (dotimes (s3-3 (-> s4-6 length)) + (debug-draw (-> s4-6 s3-3)) + ) + ) + ) + ) + ) + ) + ) + (if (or *display-path-marks* *display-vol-marks*) + (iterate-process-tree + *active-pool* + (the-as (function object object) (lambda ((arg0 process-drawable)) + (when (type? arg0 process-drawable) + (if (nonzero? (-> arg0 path)) + (debug-draw (-> arg0 path)) + ) + (if (nonzero? (-> arg0 vol)) + (debug-draw (-> arg0 vol)) + ) + ) + (none) + ) + ) + *null-kernel-context* + ) + ) + ) + ) + (when (and *display-actor-graph* (not (or (= *master-mode* 'menu) (= *master-mode* 'progress)))) + (if (not (paused?)) + (float-save-timeplot (if (< (the int (the float (mod (current-time) 600))) 300) + 1.0 + 0.0 + ) + ) + ) + (camera-plot-float-func + 0.0 + 399.0 + -81920.0 + 81920.0 + float-lookup-redline + (new 'static 'vector4w :x #xff :w #x80) + ) + (camera-plot-float-func + 0.0 + 399.0 + -81920.0 + 81920.0 + float-lookup-blueline + (new 'static 'vector4w :z #xff :w #x80) + ) + (camera-plot-float-func + 0.0 + 399.0 + -81920.0 + 81920.0 + float-lookup-greenline + (new 'static 'vector4w :y #xff :w #x80) + ) + (camera-plot-float-func + 0.0 + 399.0 + 0.0 + 409600.0 + float-lookup-yellowline + (new 'static 'vector4w :x #xff :y #xff :w #x80) + ) + (camera-plot-float-func + 0.0 + 399.0 + 0.0 + 1.0 + float-lookup-timeplot + (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w #x80) + ) + ) + (when *display-split-boxes* + (dotimes (s5-7 (-> obj length)) + (let ((v1-193 (-> obj level s5-7))) + (when (= (-> v1-193 status) 'active) + (let ((s4-7 (-> v1-193 bsp region-tree))) + (when (nonzero? s4-7) + (let* ((s3-4 (-> s4-7 data2 (+ (-> s4-7 length) -1) length)) + (s2-3 0) + (a0-102 (-> (the-as drawable-inline-array-region-prim (-> s4-7 data2 (+ (-> s4-7 length) -1))) data s2-3)) + ) + (while (< s2-3 s3-4) + (debug-draw-region a0-102 0) + (+! s2-3 1) + (set! a0-102 + (-> (the-as drawable-inline-array-region-prim (-> s4-7 data2 (+ (-> s4-7 length) -1))) data s2-3) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (when *display-region-marks* + (dotimes (s5-8 (-> obj length)) + (let ((s4-8 (-> obj level s5-8))) + (when (= (-> s4-8 status) 'active) + (when (nonzero? (-> s4-8 bsp region-trees)) + (let* ((s3-5 (-> s4-8 bsp region-trees length)) + (s2-4 0) + (s1-3 (-> s4-8 bsp region-trees s2-4)) + ) + (while (< s2-4 s3-5) + (let ((s0-4 (-> s1-3 data2 (+ (-> s1-3 length) -1) length))) + (set! sv-128 0) + (let ((a0-117 (-> (the-as drawable-inline-array-region-prim (-> s1-3 data2 (+ (-> s1-3 length) -1))) data sv-128))) + (while (< sv-128 s0-4) + (debug-draw-region a0-117 0) + (set! sv-128 (+ sv-128 1)) + (set! a0-117 + (-> (the-as drawable-inline-array-region-prim (-> s1-3 data2 (+ (-> s1-3 length) -1))) data sv-128) + ) + ) + ) + ) + (+! s2-4 1) + (set! s1-3 (-> s4-8 bsp region-trees s2-4)) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) ) (defmethod birth! entity-camera ((obj entity-camera)) diff --git a/goal_src/jak2/engine/game/effect-control.gc b/goal_src/jak2/engine/game/effect-control.gc index 9c0702f4c7..7bd7bc48cd 100644 --- a/goal_src/jak2/engine/game/effect-control.gc +++ b/goal_src/jak2/engine/game/effect-control.gc @@ -302,327 +302,301 @@ (sv-496 matrix) (sv-512 res-lump) ) - (with-pp - (cond - ((logtest? (-> obj flags) (effect-control-flag ecf2)) - (return #f) - ) - ((= arg0 'script) - (let ((gp-1 (get-property-struct - (-> obj res) - 'effect-script - 'exact - arg1 - (the-as structure #f) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (script-eval (the-as pair gp-1)) - ) - (return #f) - ) - ) - (let ((s3-0 (-> arg0 value)) - (s5-0 (cond - ((< arg2 0) - (let ((v0-5 (get-property-value - (-> obj res) - 'effect-joint - 'exact - arg1 - (the-as uint128 0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (if (zero? v0-5) - 0 - (the-as int (+ v0-5 1)) - ) - ) - ) - (else - (empty) - arg2 - ) - ) - ) - ) - (when (logtest? (-> obj flags) (effect-control-flag ecf0)) - (if (send-event (-> obj process) 'effect-control arg0 arg1 s5-0) - (return 0) - ) - ) - (let ((v1-23 (symbol->string arg0))) - (cond - ((and (= (-> v1-23 data 0) 101) - (= (-> v1-23 data 1) 102) - (= (-> v1-23 data 2) 102) - (= (-> v1-23 data 3) 101) - (= (-> v1-23 data 4) 99) - (= (-> v1-23 data 5) 116) - (= (-> v1-23 data 6) 45) - ) - (let* ((s3-1 (-> obj process root)) - (v1-27 (if (type? s3-1 collide-shape-moving) - s3-1 - ) - ) - (t1-2 (if v1-27 - (-> (the-as collide-shape-moving v1-27) ground-pat) - *footstep-surface* - ) - ) - ) - (do-effect-for-surface obj arg0 arg1 s5-0 (-> obj res) t1-2) - ) - ) - ((let ((v1-31 (symbol->string arg0))) - (and (= (-> v1-31 data 0) 103) - (= (-> v1-31 data 1) 114) - (= (-> v1-31 data 2) 111) - (= (-> v1-31 data 3) 117) - (= (-> v1-31 data 4) 112) - (= (-> v1-31 data 5) 45) - ) - ) - (set! s3-0 (cond - ((zero? s3-0) - (let ((v0-10 (lookup-part-group-pointer-by-name (symbol->string arg0)))) - (when v0-10 - (set! (-> arg0 value) v0-10) - (set! s3-0 (-> v0-10 0)) - ) - ) - s3-0 - ) - (else - (-> (the-as (pointer object) s3-0) 0) - ) - ) - ) - (when (and (nonzero? s3-0) (= (-> (the-as basic s3-0) type) sparticle-launch-group)) - (if *debug-effect-control* - (format - #t - "(~5D) effect group ~A ~A frame ~F joint ~D~%" - (-> pp clock frame-counter) - (-> obj process name) - arg0 + (cond + ((logtest? (-> obj flags) (effect-control-flag ecf2)) + (return #f) + ) + ((= arg0 'script) + (let ((gp-1 (get-property-struct + (-> obj res) + 'effect-script + 'exact arg1 - s5-0 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* ) ) - (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-1 - (let ((t9-10 (method-of-type part-tracker activate))) - (t9-10 - (the-as part-tracker s4-1) - (-> obj process) - (symbol->string (-> part-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s2-1 run-function-in-process) - (s1-0 s4-1) - (s0-0 part-tracker-init) + ) + (script-eval (the-as pair gp-1)) + ) + (return #f) + ) + ) + (let ((s3-0 (-> arg0 value)) + (s5-0 (cond + ((< arg2 0) + (let ((v0-5 (get-property-value + (-> obj res) + 'effect-joint + 'exact + arg1 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if (zero? v0-5) + 0 + (the-as int (+ v0-5 1)) ) - (set! sv-320 0) - (set! sv-336 (the-as symbol #f)) - (set! sv-352 (the-as symbol #f)) - (set! sv-368 (the-as symbol #f)) - (set! sv-400 *launch-matrix*) - (set! sv-384 (-> sv-400 trans)) - (let ((v1-55 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad))) - (set! (-> sv-384 quad) v1-55) - ) - ((the-as (function object object object object object object object object none) s2-1) - s1-0 - s0-0 - s3-0 - sv-320 - sv-336 - sv-352 - sv-368 - sv-400 - ) ) - (-> s4-1 ppointer) ) - ) - ) - ) - ((let ((v1-58 (symbol->string arg0))) - (and (= (-> v1-58 data 0) 101) - (= (-> v1-58 data 1) 118) - (= (-> v1-58 data 2) 101) - (= (-> v1-58 data 3) 110) - (= (-> v1-58 data 4) 116) - (= (-> v1-58 data 5) 45) + (else + (empty) + arg2 ) - ) - (send-event (-> obj process) arg0 arg1 s5-0) + ) + ) + ) + (when (logtest? (-> obj flags) (effect-control-flag ecf0)) + (if (send-event (-> obj process) 'effect-control arg0 arg1 s5-0) + (return 0) + ) + ) + (let ((v1-23 (symbol->string arg0))) + (cond + ((and (= (-> v1-23 data 0) 101) + (= (-> v1-23 data 1) 102) + (= (-> v1-23 data 2) 102) + (= (-> v1-23 data 3) 101) + (= (-> v1-23 data 4) 99) + (= (-> v1-23 data 5) 116) + (= (-> v1-23 data 6) 45) + ) + (let* ((s3-1 (-> obj process root)) + (v1-27 (if (type? s3-1 collide-shape-moving) + s3-1 + ) + ) + (t1-2 (if v1-27 + (-> (the-as collide-shape-moving v1-27) ground-pat) + *footstep-surface* + ) + ) + ) + (do-effect-for-surface obj arg0 arg1 s5-0 (-> obj res) t1-2) ) - ((= arg0 'camera-shake) - (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + ) + ((let ((v1-31 (symbol->string arg0))) + (and (= (-> v1-31 data 0) 103) + (= (-> v1-31 data 1) 114) + (= (-> v1-31 data 2) 111) + (= (-> v1-31 data 3) 117) + (= (-> v1-31 data 4) 112) + (= (-> v1-31 data 5) 45) + ) ) - ((zero? s3-0) - (play-effect-sound obj arg0 arg1 s5-0 (-> obj res) (string->sound-name (symbol->string arg0))) - ) - ((= (-> (the-as basic s3-0) type) sparticle-launcher) + (set! s3-0 (cond + ((zero? s3-0) + (let ((v0-10 (lookup-part-group-pointer-by-name (symbol->string arg0)))) + (when v0-10 + (set! (-> arg0 value) v0-10) + (set! s3-0 (-> v0-10 0)) + ) + ) + s3-0 + ) + (else + (-> (the-as (pointer object) s3-0) 0) + ) + ) + ) + (when (and (nonzero? s3-0) (= (-> (the-as basic s3-0) type) sparticle-launch-group)) (if *debug-effect-control* - (format - #t - "(~5D) effect part ~A ~A frame ~F joint ~D~%" - (-> pp clock frame-counter) - (-> obj process name) - arg0 - arg1 - s5-0 - ) + (format #t "(~5D) effect group ~A ~A frame ~F joint ~D~%" (current-time) (-> obj process name) arg0 arg1 s5-0) ) - (format - #t - "-----> (~5D) effect part ~A ~A frame ~F joint ~D~%" - (-> pp clock frame-counter) - (-> obj process name) - arg0 - arg1 - s5-0 - ) - (let ((s4-2 sp-launch-particles-var) - (s2-2 *sp-particle-system-2d*) - (s0-2 *launch-matrix*) - ) - (set! (-> s0-2 trans quad) - (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad) - ) - (s4-2 - s2-2 - (the-as sparticle-launcher s3-0) - s0-2 - (the-as sparticle-launch-state #f) - (the-as sparticle-launch-control #f) - 1.0 - ) - ) - ) - ((= (-> (the-as basic s3-0) type) sparticle-launch-group) - (if *debug-effect-control* - (format - #t - "(~5D) effect group ~A ~A frame ~F joint ~D~%" - (-> pp clock frame-counter) - (-> obj process name) - arg0 - arg1 - s5-0 - ) - ) - (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-3 - (let ((t9-23 (method-of-type part-tracker activate))) - (t9-23 - (the-as part-tracker s4-3) + (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-1 + (let ((t9-10 (method-of-type part-tracker activate))) + (t9-10 + (the-as part-tracker s4-1) (-> obj process) (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000) ) ) - (let ((s2-3 run-function-in-process) - (s1-3 s4-3) - (s0-3 part-tracker-init) + (let ((s2-1 run-function-in-process) + (s1-0 s4-1) + (s0-0 part-tracker-init) ) - (set! sv-416 0) - (set! sv-432 (the-as symbol #f)) - (set! sv-448 (the-as symbol #f)) - (set! sv-464 (the-as symbol #f)) - (set! sv-496 *launch-matrix*) - (set! sv-480 (-> sv-496 trans)) - (let ((v1-95 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad))) - (set! (-> sv-480 quad) v1-95) + (set! sv-320 0) + (set! sv-336 (the-as symbol #f)) + (set! sv-352 (the-as symbol #f)) + (set! sv-368 (the-as symbol #f)) + (set! sv-400 *launch-matrix*) + (set! sv-384 (-> sv-400 trans)) + (let ((v1-55 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad))) + (set! (-> sv-384 quad) v1-55) ) - ((the-as (function object object object object object object object object none) s2-3) - s1-3 - s0-3 + ((the-as (function object object object object object object object object none) s2-1) + s1-0 + s0-0 s3-0 - sv-416 - sv-432 - sv-448 - sv-464 - sv-496 + sv-320 + sv-336 + sv-352 + sv-368 + sv-400 ) ) - (-> s4-3 ppointer) + (-> s4-1 ppointer) ) ) ) - ((= (-> (the-as basic s3-0) type) sound-spec) - (sound-play-by-spec - (the-as sound-spec s3-0) - (new-sound-id) - (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) - ) + ) + ((let ((v1-58 (symbol->string arg0))) + (and (= (-> v1-58 data 0) 101) + (= (-> v1-58 data 1) 118) + (= (-> v1-58 data 2) 101) + (= (-> v1-58 data 3) 110) + (= (-> v1-58 data 4) 116) + (= (-> v1-58 data 5) 45) + ) ) - ((= (-> (the-as basic s3-0) type) death-info) - (when (and (logtest? (-> obj flags) (effect-control-flag ecf1)) (zero? (-> obj process draw death-timer))) - (let ((v1-106 (-> obj process draw))) - (let ((a1-51 (-> (the-as death-info s3-0) vertex-skip)) - (a0-77 - (max - 2 - (the-as int (/ (-> (the-as death-info s3-0) timer) (the-as uint (the int (-> *display* time-factor))))) - ) - ) - ) - (when (= (-> *setting-control* user-current video-mode) 'pal) - (if (< (the-as uint 1) a1-51) - (set! a1-51 (/ (the-as uint (* (the-as uint 50) a1-51)) (the-as uint 60))) - ) - ) - (let ((a2-37 (-> *display* frames (-> *display* last-screen) run-time))) - (cond - ((< 9000 a2-37) - (set! a1-51 (* a1-51 4)) - ) - ((< 7000 a2-37) - (set! a1-51 (* a1-51 2)) - ) - ) - ) - (set! (-> v1-106 death-vertex-skip) a1-51) - (set! (-> v1-106 death-effect) (-> (the-as death-info s3-0) effect)) - (set! (-> v1-106 death-timer) (the-as uint (+ a0-77 1))) + (send-event (-> obj process) arg0 arg1 s5-0) + ) + ((= arg0 'camera-shake) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + ) + ((zero? s3-0) + (play-effect-sound obj arg0 arg1 s5-0 (-> obj res) (string->sound-name (symbol->string arg0))) + ) + ((= (-> (the-as basic s3-0) type) sparticle-launcher) + (if *debug-effect-control* + (format #t "(~5D) effect part ~A ~A frame ~F joint ~D~%" (current-time) (-> obj process name) arg0 arg1 s5-0) + ) + (format + #t + "-----> (~5D) effect part ~A ~A frame ~F joint ~D~%" + (current-time) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + (let ((s4-2 sp-launch-particles-var) + (s2-2 *sp-particle-system-2d*) + (s0-2 *launch-matrix*) + ) + (set! (-> s0-2 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad) ) - (set! (-> v1-106 death-timer-org) (-> v1-106 death-timer)) - (set! (-> v1-106 death-draw-overlap) (-> (the-as death-info s3-0) overlap)) - ) - (when (-> (the-as death-info s3-0) sound) - (let* ((s2-5 obj) - (s1-4 (method-of-object s2-5 play-effect-sound)) - (s0-4 (-> (the-as death-info s3-0) sound)) - ) - (set! sv-512 (-> obj res)) - (let ((t1-12 (string->sound-name (symbol->string (-> (the-as death-info s3-0) sound))))) - (s1-4 s2-5 s0-4 arg1 s5-0 sv-512 t1-12) - ) + (s4-2 + s2-2 + (the-as sparticle-launcher s3-0) + s0-2 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + ((= (-> (the-as basic s3-0) type) sparticle-launch-group) + (if *debug-effect-control* + (format #t "(~5D) effect group ~A ~A frame ~F joint ~D~%" (current-time) (-> obj process name) arg0 arg1 s5-0) + ) + (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-3 + (let ((t9-23 (method-of-type part-tracker activate))) + (t9-23 + (the-as part-tracker s4-3) + (-> obj process) + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) ) ) - (send-event (-> obj process) 'death-start (the-as death-info s3-0)) + (let ((s2-3 run-function-in-process) + (s1-3 s4-3) + (s0-3 part-tracker-init) + ) + (set! sv-416 0) + (set! sv-432 (the-as symbol #f)) + (set! sv-448 (the-as symbol #f)) + (set! sv-464 (the-as symbol #f)) + (set! sv-496 *launch-matrix*) + (set! sv-480 (-> sv-496 trans)) + (let ((v1-95 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad))) + (set! (-> sv-480 quad) v1-95) + ) + ((the-as (function object object object object object object object object none) s2-3) + s1-3 + s0-3 + s3-0 + sv-416 + sv-432 + sv-448 + sv-464 + sv-496 + ) + ) + (-> s4-3 ppointer) ) ) - (else - (play-effect-sound obj arg0 arg1 s5-0 (-> obj res) (string->sound-name (symbol->string arg0))) - ) + ) + ((= (-> (the-as basic s3-0) type) sound-spec) + (sound-play-by-spec + (the-as sound-spec s3-0) + (new-sound-id) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) + ) + ) + ((= (-> (the-as basic s3-0) type) death-info) + (when (and (logtest? (-> obj flags) (effect-control-flag ecf1)) (zero? (-> obj process draw death-timer))) + (let ((v1-106 (-> obj process draw))) + (let ((a1-51 (-> (the-as death-info s3-0) vertex-skip)) + (a0-77 + (max + 2 + (the-as int (/ (-> (the-as death-info s3-0) timer) (the-as uint (the int (-> *display* time-factor))))) + ) + ) + ) + (when (= (-> *setting-control* user-current video-mode) 'pal) + (if (< (the-as uint 1) a1-51) + (set! a1-51 (/ (the-as uint (* (the-as uint 50) a1-51)) (the-as uint 60))) + ) + ) + (let ((a2-37 (-> *display* frames (-> *display* last-screen) run-time))) + (cond + ((< 9000 a2-37) + (set! a1-51 (* a1-51 4)) + ) + ((< 7000 a2-37) + (set! a1-51 (* a1-51 2)) + ) + ) + ) + (set! (-> v1-106 death-vertex-skip) a1-51) + (set! (-> v1-106 death-effect) (-> (the-as death-info s3-0) effect)) + (set! (-> v1-106 death-timer) (the-as uint (+ a0-77 1))) + ) + (set! (-> v1-106 death-timer-org) (-> v1-106 death-timer)) + (set! (-> v1-106 death-draw-overlap) (-> (the-as death-info s3-0) overlap)) + ) + (when (-> (the-as death-info s3-0) sound) + (let* ((s2-5 obj) + (s1-4 (method-of-object s2-5 play-effect-sound)) + (s0-4 (-> (the-as death-info s3-0) sound)) + ) + (set! sv-512 (-> obj res)) + (let ((t1-12 (string->sound-name (symbol->string (-> (the-as death-info s3-0) sound))))) + (s1-4 s2-5 s0-4 arg1 s5-0 sv-512 t1-12) + ) + ) + ) + (send-event (-> obj process) 'death-start (the-as death-info s3-0)) + ) + ) + (else + (play-effect-sound obj arg0 arg1 s5-0 (-> obj res) (string->sound-name (symbol->string arg0))) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod do-effect-for-surface effect-control ((obj effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 pat-surface)) @@ -1058,90 +1032,88 @@ (defmethod play-effect-sound effect-control ((obj effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 sound-name)) (local-vars (sv-112 res-tag) (sv-128 sound-name) (sv-144 basic) (sv-160 (function vector vector float))) - (with-pp - (set! sv-144 arg3) - (let ((s0-0 arg4) - (gp-0 (the-as object (new 'stack 'sound-spec))) - (s5-0 (if (< arg2 0) - (the-as vector #f) - (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data arg2)) - ) + (set! sv-144 arg3) + (let ((s0-0 arg4) + (gp-0 (the-as object (new 'stack 'sound-spec))) + (s5-0 (if (< arg2 0) + (the-as vector #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data arg2)) + ) + ) + ) + (set! (-> (the-as sound-spec gp-0) sound-name) s0-0) + (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask volume)) + (set! (-> (the-as sound-spec gp-0) pitch-mod) 0) + (set! (-> (the-as sound-spec gp-0) volume) 1024) + (set! sv-112 (new 'static 'res-tag)) + (let* ((t9-2 (method-of-type res-lump get-property-data)) + (a1-5 'effect-param) + (a2-1 'exact) + (a3-1 arg1) + (t0-1 #f) + (t1-1 (the-as (pointer res-tag) (& sv-112))) + (t2-0 *res-static-buf*) + (a1-6 (t9-2 (the-as res-lump sv-144) a1-5 a2-1 a3-1 (the-as pointer t0-1) t1-1 t2-0)) + ) + (when a1-6 + (effect-param->sound-spec + (the-as sound-spec gp-0) + (the-as (pointer float) a1-6) + (the-as int (-> sv-112 elt-count)) + (the-as process-focusable (-> obj process)) + ) + (if (logtest? (-> (the-as sound-spec gp-0) mask) (sound-mask unk)) + (return 0) + ) + ) + ) + (let ((f0-0 (-> *setting-control* user-current under-water-pitch-mod))) + (when (!= f0-0 0.0) + (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask pitch)) + (let ((f0-1 (* 2.0 f0-0))) + (set! (-> (the-as sound-spec gp-0) pitch-mod) + (- (-> (the-as sound-spec gp-0) pitch-mod) (the int (* 1524.0 f0-1))) ) ) - (set! (-> (the-as sound-spec gp-0) sound-name) s0-0) - (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask volume)) - (set! (-> (the-as sound-spec gp-0) pitch-mod) 0) - (set! (-> (the-as sound-spec gp-0) volume) 1024) - (set! sv-112 (new 'static 'res-tag)) - (let* ((t9-2 (method-of-type res-lump get-property-data)) - (a1-5 'effect-param) - (a2-1 'exact) - (a3-1 arg1) - (t0-1 #f) - (t1-1 (the-as (pointer res-tag) (& sv-112))) - (t2-0 *res-static-buf*) - (a1-6 (t9-2 (the-as res-lump sv-144) a1-5 a2-1 a3-1 (the-as pointer t0-1) t1-1 t2-0)) - ) - (when a1-6 - (effect-param->sound-spec - (the-as sound-spec gp-0) - (the-as (pointer float) a1-6) - (the-as int (-> sv-112 elt-count)) - (the-as process-focusable (-> obj process)) - ) - (if (logtest? (-> (the-as sound-spec gp-0) mask) (sound-mask unk)) - (return 0) - ) - ) ) - (let ((f0-0 (-> *setting-control* user-current under-water-pitch-mod))) - (when (!= f0-0 0.0) - (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask pitch)) - (let ((f0-1 (* 2.0 f0-0))) - (set! (-> (the-as sound-spec gp-0) pitch-mod) - (- (-> (the-as sound-spec gp-0) pitch-mod) (the int (* 1524.0 f0-1))) - ) - ) - ) - ) - (if (or (and (nonzero? (-> (the-as sound-spec gp-0) fo-max)) - (let ((f30-0 (* 4096.0 (the float (-> (the-as sound-spec gp-0) fo-max))))) - (set! sv-160 vector-vector-distance) - (let ((a0-8 (ear-trans 0)) - (a1-7 s5-0) - ) - (< f30-0 (sv-160 a0-8 a1-7)) - ) + ) + (if (or (and (nonzero? (-> (the-as sound-spec gp-0) fo-max)) + (let ((f30-0 (* 4096.0 (the float (-> (the-as sound-spec gp-0) fo-max))))) + (set! sv-160 vector-vector-distance) + (let ((a0-8 (ear-trans 0)) + (a1-7 s5-0) + ) + (< f30-0 (sv-160 a0-8 a1-7)) ) ) - (= (-> (the-as (pointer int8) gp-0) 9) 126) - ) - (return 0) - ) - (when *debug-effect-control* - (set! sv-128 s0-0) - (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128))) - (format - #t - "(~5D) effect sound ~A ~A (~S) frame ~F joint ~D " - (-> pp clock frame-counter) - (-> obj process name) - arg0 - *temp-string* - arg1 - arg2 - ) - (format - #t - "volume: ~f pitch-mod: ~f~%" - (* 0.09765625 (the float (-> (the-as sound-spec gp-0) volume))) - (* 0.000656168 (the float (-> (the-as sound-spec gp-0) pitch-mod))) - ) + ) + (= (-> (the-as (pointer int8) gp-0) 9) 126) + ) + (return 0) + ) + (when *debug-effect-control* + (set! sv-128 s0-0) + (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128))) + (format + #t + "(~5D) effect sound ~A ~A (~S) frame ~F joint ~D " + (current-time) + (-> obj process name) + arg0 + *temp-string* + arg1 + arg2 + ) + (format + #t + "volume: ~f pitch-mod: ~f~%" + (* 0.09765625 (the float (-> (the-as sound-spec gp-0) volume))) + (* 0.000656168 (the float (-> (the-as sound-spec gp-0) pitch-mod))) ) - (sound-play-by-spec (the-as sound-spec gp-0) (new-sound-id) s5-0) ) - 0 + (sound-play-by-spec (the-as sound-spec gp-0) (new-sound-id) s5-0) ) + 0 ) (defbehavior target-land-effect target () diff --git a/goal_src/jak2/engine/game/game-info.gc b/goal_src/jak2/engine/game/game-info.gc index e5298b78ed..0e04bd76ed 100644 --- a/goal_src/jak2/engine/game/game-info.gc +++ b/goal_src/jak2/engine/game/game-info.gc @@ -902,8 +902,8 @@ (set! (-> v1-9 origin z) (the float (/ (-> s3-0 z) 16))) ) (set! (-> s5-0 flags) (font-flags shadow kerning large)) - (let ((s3-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-1) (+ arg2 -75)) + (let ((s3-1 (current-time))) + (until (>= (- (current-time) s3-1) (+ arg2 -75)) (+! (-> s5-0 origin y) (* -120.0 (-> self clock seconds-per-frame))) (let ((s2-0 print-game-text)) (format (clear *temp-string*) "~4,,0f" arg1) @@ -912,9 +912,9 @@ (suspend) ) ) - (let ((s4-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-1) (seconds 0.25)) - (set! (-> s5-0 alpha) (lerp-scale 1.0 0.0 (the float (- (-> self clock frame-counter) s4-1)) 0.0 150.0)) + (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 (-> self clock seconds-per-frame))) (let ((s3-2 print-game-text)) (format (clear *temp-string*) "~4,,0f" arg1) @@ -1339,8 +1339,8 @@ process (lambda :behavior process ((arg0 string)) - (let ((s5-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-0) (seconds 10)) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) (seconds 10)) (format *stdcon* "~S~%" arg0) (suspend) ) diff --git a/goal_src/jak2/engine/game/main.gc b/goal_src/jak2/engine/game/main.gc index eba2313641..b48b332328 100644 --- a/goal_src/jak2/engine/game/main.gc +++ b/goal_src/jak2/engine/game/main.gc @@ -1230,8 +1230,8 @@ (set! (-> *setting-control* user-default music-volume) 0.0) (set! (-> *setting-control* user-default dialog-volume) 0.0) (set! (-> *setting-control* user-default ambient-volume) 0.0) - (let ((s5-0 (-> pp clock frame-counter))) - (until (>= (- (-> pp clock frame-counter) s5-0) (seconds 0.1)) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) (seconds 0.1)) (suspend) ) ) diff --git a/goal_src/jak2/engine/game/task/task-control.gc b/goal_src/jak2/engine/game/task/task-control.gc index 701b833d15..07730fd042 100644 --- a/goal_src/jak2/engine/game/task/task-control.gc +++ b/goal_src/jak2/engine/game/task/task-control.gc @@ -1538,11 +1538,11 @@ ) ) (logior! (-> self flags) (fail-mission-flags famflags-1)) - (set! (-> self grabbed-time) (-> self clock frame-counter)) + (set! (-> self grabbed-time) (current-time)) (when (not (logtest? (-> self flags) (fail-mission-flags famflags-3))) (when (not (logtest? (-> self flags) (fail-mission-flags famflags-5))) - (while (< (- (-> self clock frame-counter) (-> self grabbed-time)) (seconds 1.5)) - (let ((f30-0 (lerp-scale 0.0 1.0 (the float (- (-> self clock frame-counter) (-> self grabbed-time))) 0.0 450.0))) + (while (< (- (current-time) (-> self grabbed-time)) (seconds 1.5)) + (let ((f30-0 (lerp-scale 0.0 1.0 (the float (- (current-time) (-> self grabbed-time))) 0.0 450.0))) (set-filter-color! (lerp-scale 1.0 1.25 f30-0 0.0 1.0) (lerp-scale 1.0 0.875 f30-0 0.0 1.0) @@ -1565,7 +1565,7 @@ (((fail-mission-message fammsg-0)) (until #f (when (or (and (logtest? (-> self flags) (fail-mission-flags famflags-0)) - (>= (- (-> self clock frame-counter) (-> self grabbed-time)) (the-as time-frame (-> self reset-delay))) + (>= (- (current-time) (-> self grabbed-time)) (the-as time-frame (-> self reset-delay))) ) (or (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) (logtest? (-> self flags) (fail-mission-flags famflags-3)) @@ -1658,9 +1658,9 @@ ) :code (behavior () (local-vars (a1-10 basic)) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) - (let ((f30-0 (lerp-scale 1.0 0.0 (the float (- (-> self clock frame-counter) gp-0)) 0.0 270.0))) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) + (let ((f30-0 (lerp-scale 1.0 0.0 (the float (- (current-time) gp-0)) 0.0 270.0))) (when *sound-player-enable* (let ((v1-6 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) (set! (-> v1-6 command) (sound-command set-param)) @@ -1671,7 +1671,7 @@ ) ) ) - (let ((f30-1 (lerp-scale 1.0 0.0 (the float (- (-> self clock frame-counter) gp-0)) 0.0 300.0))) + (let ((f30-1 (lerp-scale 1.0 0.0 (the float (- (current-time) gp-0)) 0.0 300.0))) (set-filter-color! (lerp-scale 1.0 1.25 f30-1 0.0 1.0) (lerp-scale 1.0 0.875 f30-1 0.0 1.0) @@ -1826,7 +1826,7 @@ (set! (-> self lev-name) arg1) (add-setting! 'task arg0 0.0 0) (add-setting! 'task-manager (process->ppointer self) 0.0 0) - (set! (-> self intro-time) (-> self clock frame-counter)) + (set! (-> self intro-time) (current-time)) (set! (-> self fail-on-death?) (not (logtest? (-> arg0 flags) (game-task-node-flag no-fail-on-death)))) (when arg1 (let* ((v1-15 (level-get *level* arg1)) @@ -1852,29 +1852,27 @@ ) (defmethod check-time task-manager ((obj task-manager)) - (with-pp - (when (nonzero? (-> obj start-time)) - (let ((v1-3 (handle->process (-> obj hud-timer)))) - (if (and *target* (not v1-3)) - (set! (-> obj hud-timer) (ppointer->handle (process-spawn hud-timer :init hud-init-by-other :to *target*))) - ) + (when (nonzero? (-> obj start-time)) + (let ((v1-3 (handle->process (-> obj hud-timer)))) + (if (and *target* (not v1-3)) + (set! (-> obj hud-timer) (ppointer->handle (process-spawn hud-timer :init hud-init-by-other :to *target*))) + ) + ) + (let ((v1-15 (- (-> obj time-limit) (- (current-time) (-> obj start-time))))) + (let ((a0-15 *game-info*)) + (set! (-> a0-15 timer) v1-15) + (set! (-> a0-15 timer-flash) (< v1-15 (seconds 10))) ) - (let ((v1-15 (- (-> obj time-limit) (- (-> pp clock frame-counter) (-> obj start-time))))) - (let ((a0-15 *game-info*)) - (set! (-> a0-15 timer) v1-15) - (set! (-> a0-15 timer-flash) (< v1-15 (seconds 10))) - ) - (when (< v1-15 0) - (if *debug-segment* - (format #t "task failed: ran out of time~%") - ) - (send-event (handle->process (-> obj hud-timer)) 'hide-and-die) - (go (method-of-object obj fail)) - ) + (when (< v1-15 0) + (if *debug-segment* + (format #t "task failed: ran out of time~%") + ) + (send-event (handle->process (-> obj hud-timer)) 'hide-and-die) + (go (method-of-object obj fail)) ) ) - 0 ) + 0 ) (defmethod initialize! task-manager ((obj task-manager)) @@ -2033,28 +2031,26 @@ ;; WARN: Return type mismatch object vs symbol. (defmethod task-manager-method-22 task-manager ((obj task-manager)) - (with-pp - (the-as - symbol - (and (or (not (logtest? (-> obj node-info flags) (game-task-node-flag city-wait))) - (let ((a0-2 (level-get-target-inside *level*))) - (cond - ((not (and a0-2 (logtest? (-> a0-2 info level-flags) 1))) - (set! (-> obj intro-time) (-> pp clock frame-counter)) - #f - ) - (else - #t - ) + (the-as + symbol + (and (or (not (logtest? (-> obj node-info flags) (game-task-node-flag city-wait))) + (let ((a0-2 (level-get-target-inside *level*))) + (cond + ((not (and a0-2 (logtest? (-> a0-2 info level-flags) 1))) + (set! (-> obj intro-time) (current-time)) + #f + ) + (else + #t ) ) ) - (or (zero? (-> obj info intro-delay)) - (>= (- (-> pp clock frame-counter) (-> obj intro-time)) (the-as time-frame (-> obj info intro-delay))) - ) - (and *target* (not (logtest? (focus-status dead teleporting) (-> *target* focus-status)))) - ) - ) + ) + (or (zero? (-> obj info intro-delay)) + (>= (- (current-time) (-> obj intro-time)) (the-as time-frame (-> obj info intro-delay))) + ) + (and *target* (not (logtest? (focus-status dead teleporting) (-> *target* focus-status)))) + ) ) ) @@ -2153,7 +2149,7 @@ (t9-3) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (when (logtest? (-> self info mask) (task-manager-mask resolution-scene)) (let ((gp-2 (ppointer->handle (process-spawn scene-player diff --git a/goal_src/jak2/engine/gfx/hw/display-h.gc b/goal_src/jak2/engine/gfx/hw/display-h.gc index d5d83391c3..802fe7ad76 100644 --- a/goal_src/jak2/engine/gfx/hw/display-h.gc +++ b/goal_src/jak2/engine/gfx/hw/display-h.gc @@ -132,10 +132,6 @@ At any point in time, there are 3 frames in progress: `(-> *display* frames (-> *display* on-screen)) ) -(defmacro current-time () - `(-> *display* base-frame-counter) - ) - (defmacro integral-current-time () `(-> *display* integral-frame-counter) ) diff --git a/goal_src/jak2/engine/gfx/mood/weather-part.gc b/goal_src/jak2/engine/gfx/mood/weather-part.gc index ef08540a65..80552e970c 100644 --- a/goal_src/jak2/engine/gfx/mood/weather-part.gc +++ b/goal_src/jak2/engine/gfx/mood/weather-part.gc @@ -748,7 +748,7 @@ ) (defbehavior cam-master-effect camera-master () - (when (not (or (movie?) (>= (+ (-> self clock frame-counter) (seconds -10)) (-> self water-drip-time)))) + (when (not (or (movie?) (>= (+ (current-time) (seconds -10)) (-> self water-drip-time)))) (set! (-> *part-id-table* 46 init-specs 1 initial-valuef) (-> self water-drip-mult)) (set! (-> *part-id-table* 45 init-specs 1 initial-valuef) (* 0.9 (-> self water-drip-mult))) (set! (-> *part-id-table* 43 init-specs 11 initial-valuef) (* -2.7306666 (-> self water-drip-speed))) diff --git a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher.gc b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher.gc index a85d2926b6..de6f2b65ee 100644 --- a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher.gc +++ b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher.gc @@ -247,7 +247,11 @@ (def-mips2c particle-adgif (function adgif-shader texture-id none)) - +;; ERROR: Bad vector register dependency: vf16 +;; ERROR: Bad vector register dependency: vf17 +;; ERROR: Bad vector register dependency: vf18 +;; ERROR: Bad vector register dependency: vf19 +;; ERROR: Bad vector register dependency: vf20 (defun particle-adgif-callback ((arg0 adgif-shader) (arg1 texture-id)) "Callback to update the adgif of a particle, keeping only alpha and clamp. This is new for jak 2. @@ -374,14 +378,14 @@ (cond ((< (-> s5-0 w) 0.0) (.lvf vf1 (&-> arg0 conerot quad)) - (.lvf vf2 (&-> s5-0 vec quad)) + (.lvf vf2 (&-> s5-0 quad)) (.sub.vf vf1 vf0 vf2 :mask #b111) (.svf (&-> arg0 conerot quad) vf1) (.mov v1-1 vf1) ) (else (.lvf vf1 (&-> arg0 conerot quad)) - (.lvf vf2 (&-> s5-0 vec quad)) + (.lvf vf2 (&-> s5-0 quad)) (.add.vf vf1 vf0 vf2 :mask #b111) (.svf (&-> arg0 conerot quad) vf1) (.mov v1-2 vf1) @@ -498,12 +502,12 @@ ) (set! (-> s5-0 vector 1 y) 0.0) (set! (-> s5-0 vector 1 z) (the float (sar (shl (the int (-> s5-0 vector 1 z)) 48) 48))) - (.lvf vf4 (&-> s5-0 vector 2 quad)) - (.lvf vf5 (&-> s5-0 vector 0 quad)) + (.lvf vf4 (&-> s5-0 quad 2)) + (.lvf vf5 (&-> s5-0 quad 0)) (.min.x.vf vf4 vf4 vf31 :mask #b111) (.add.vf vf5 vf5 vf30 :mask #b111) - (.svf (&-> s5-0 vector 2 quad) vf4) - (.svf (&-> s5-0 vector 0 quad) vf5) + (.svf (&-> s5-0 quad 2) vf4) + (.svf (&-> s5-0 quad 0) vf5) (when (not *death-adgif*) (set! *death-adgif* (new 'static 'adgif-shader)) (particle-adgif *death-adgif* (new 'static 'texture-id :index #xc9 :page #xc)) @@ -526,19 +530,19 @@ ) (set! (-> gp-0 clock-index) (the-as uint 8)) (.lvf vf4 (&-> (-> *time-of-day-context* current-prt-color) quad)) - (.lvf vf5 (&-> s5-0 vector 2 quad)) + (.lvf vf5 (&-> s5-0 quad 2)) (.lvf vf6 (&-> gp-0 fade quad)) (.mul.vf vf5 vf5 vf4 :mask #b111) (.mul.vf vf6 vf6 vf4 :mask #b111) - (.svf (&-> s5-0 vector 2 quad) vf5) + (.svf (&-> s5-0 quad 2) vf5) (.svf (&-> gp-0 fade quad) vf6) (.mov v1-26 vf6) (set! (-> gp-0 key) (the-as sparticle-launch-control 0)) (set! (-> gp-0 binding) #f) (let ((v1-27 (-> gp-0 sprite))) - (.lvf vf1 (&-> s5-0 vector 0 quad)) - (.lvf vf2 (&-> s5-0 vector 1 quad)) - (.lvf vf3 (&-> s5-0 vector 2 quad)) + (.lvf vf1 (&-> s5-0 quad 0)) + (.lvf vf2 (&-> s5-0 quad 1)) + (.lvf vf3 (&-> s5-0 quad 2)) (.svf (&-> v1-27 x-y-z-sx quad) vf1) (.svf (&-> v1-27 flag-rot-sy quad) vf2) (.sub.w.vf vf3 vf0 vf0 :mask #b1000) @@ -755,87 +759,85 @@ ) (defmethod initialize sparticle-launch-control ((obj sparticle-launch-control) (arg0 sparticle-launch-group) (arg1 process)) - (with-pp - (let ((s5-0 0)) - (set! (-> obj group) arg0) - (set! (-> obj proc) (the-as process-drawable arg1)) - (set! (-> obj local-clock) 0) - (set! (-> obj fade) 1.0) - (set! (-> obj matrix) 0) - (set! (-> obj last-spawn-frame) (the-as int (+ (-> *display* real-frame-clock integral-frame-counter) -2))) - (set! (-> obj last-spawn-time) 0) - (if (logtest? (-> obj group flags) (sp-group-flag unk-4)) - (quaternion->matrix (-> obj origin) (-> (the-as process-drawable arg1) root quat)) - (matrix-identity! (-> obj origin)) - ) - (when (logtest? (-> arg0 flags) (sp-group-flag unk-6)) - (let ((f0-1 (-> arg0 rotate-x)) - (f1-0 (-> arg0 rotate-y)) - (f2-0 (-> arg0 rotate-z)) - (t9-2 matrix-rotate-xyz!) - (a0-3 (new 'stack-no-clear 'matrix)) - (a1-2 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-2 x) f0-1) - (set! (-> a1-2 y) f1-0) - (set! (-> a1-2 z) f2-0) - (set! (-> a1-2 w) 1.0) - (let ((a1-3 (t9-2 a0-3 a1-2))) - (matrix*! (-> obj origin) a1-3 (-> obj origin)) + (let ((s5-0 0)) + (set! (-> obj group) arg0) + (set! (-> obj proc) (the-as process-drawable arg1)) + (set! (-> obj local-clock) 0) + (set! (-> obj fade) 1.0) + (set! (-> obj matrix) 0) + (set! (-> obj last-spawn-frame) (the-as int (+ (-> *display* real-frame-clock integral-frame-counter) -2))) + (set! (-> obj last-spawn-time) 0) + (if (logtest? (-> obj group flags) (sp-group-flag unk-4)) + (quaternion->matrix (-> obj origin) (-> (the-as process-drawable arg1) root quat)) + (matrix-identity! (-> obj origin)) + ) + (when (logtest? (-> arg0 flags) (sp-group-flag unk-6)) + (let ((f0-1 (-> arg0 rotate-x)) + (f1-0 (-> arg0 rotate-y)) + (f2-0 (-> arg0 rotate-z)) + (t9-2 matrix-rotate-xyz!) + (a0-3 (new 'stack-no-clear 'matrix)) + (a1-2 (new 'stack-no-clear 'vector)) ) + (set! (-> a1-2 x) f0-1) + (set! (-> a1-2 y) f1-0) + (set! (-> a1-2 z) f2-0) + (set! (-> a1-2 w) 1.0) + (let ((a1-3 (t9-2 a0-3 a1-2))) + (matrix*! (-> obj origin) a1-3 (-> obj origin)) ) ) - (when (logtest? (-> arg0 flags) (sp-group-flag unk-7)) - (let ((a1-4 (new 'stack-no-clear 'vector))) - (set! (-> a1-4 x) (-> arg0 scale-x)) - (set! (-> a1-4 y) (-> arg0 scale-y)) - (set! (-> a1-4 z) (-> arg0 scale-z)) - (set! (-> a1-4 w) 1.0) - (set! (-> a1-4 w) 1.0) - (scale-matrix! (-> obj origin) a1-4 (-> obj origin)) - ) - ) - (dotimes (s3-0 (-> arg0 length)) - (let* ((a0-7 (-> arg0 launcher s3-0)) - (a1-6 (-> *part-id-table* (-> a0-7 launcher))) - (v1-29 (-> obj data s5-0)) - ) - (when (nonzero? a1-6) - (set! (-> v1-29 group-item) a0-7) - (cond - ((= (-> a1-6 type) sparticle-launcher) - (set! (-> v1-29 accum) 0.0) - (set! (-> v1-29 spawn-time) (the-as uint (+ (-> pp clock frame-counter) (seconds -100)))) - (set! (-> v1-29 offset) (the-as uint (-> a0-7 offset))) - (set! (-> v1-29 randomize) (the-as uint 0)) - (cond - ((logtest? (-> a0-7 flags) (sp-group-item-flag start-dead)) - (logclear! (-> v1-29 flags) (sp-launch-state-flags launcher-active)) - (set! (-> v1-29 center) #f) - (set! (-> v1-29 sprite3d) #f) - (set! (-> v1-29 sprite) #f) - ) - (else - (logior! (-> v1-29 flags) (sp-launch-state-flags launcher-active)) - (set! (-> v1-29 center) (-> obj origin trans)) - (set! (-> v1-29 sprite3d) #f) - (set! (-> v1-29 sprite) #f) - ) - ) - (+! s5-0 1) - ) - (else - (format 0 "initialize called with non-particle-launcher~%") - ) - ) - ) - ) - ) - (set! (-> obj length) s5-0) ) - 0 - (none) + (when (logtest? (-> arg0 flags) (sp-group-flag unk-7)) + (let ((a1-4 (new 'stack-no-clear 'vector))) + (set! (-> a1-4 x) (-> arg0 scale-x)) + (set! (-> a1-4 y) (-> arg0 scale-y)) + (set! (-> a1-4 z) (-> arg0 scale-z)) + (set! (-> a1-4 w) 1.0) + (set! (-> a1-4 w) 1.0) + (scale-matrix! (-> obj origin) a1-4 (-> obj origin)) + ) + ) + (dotimes (s3-0 (-> arg0 length)) + (let* ((a0-7 (-> arg0 launcher s3-0)) + (a1-6 (-> *part-id-table* (-> a0-7 launcher))) + (v1-29 (-> obj data s5-0)) + ) + (when (nonzero? a1-6) + (set! (-> v1-29 group-item) a0-7) + (cond + ((= (-> a1-6 type) sparticle-launcher) + (set! (-> v1-29 accum) 0.0) + (set! (-> v1-29 spawn-time) (the-as uint (+ (current-time) (seconds -100)))) + (set! (-> v1-29 offset) (the-as uint (-> a0-7 offset))) + (set! (-> v1-29 randomize) (the-as uint 0)) + (cond + ((logtest? (-> a0-7 flags) (sp-group-item-flag start-dead)) + (logclear! (-> v1-29 flags) (sp-launch-state-flags launcher-active)) + (set! (-> v1-29 center) #f) + (set! (-> v1-29 sprite3d) #f) + (set! (-> v1-29 sprite) #f) + ) + (else + (logior! (-> v1-29 flags) (sp-launch-state-flags launcher-active)) + (set! (-> v1-29 center) (-> obj origin trans)) + (set! (-> v1-29 sprite3d) #f) + (set! (-> v1-29 sprite) #f) + ) + ) + (+! s5-0 1) + ) + (else + (format 0 "initialize called with non-particle-launcher~%") + ) + ) + ) + ) + ) + (set! (-> obj length) s5-0) ) + 0 + (none) ) ;; WARN: Return type mismatch object vs sparticle-launch-control. @@ -916,14 +918,14 @@ (defmethod spawn-with-matrix sparticle-launch-control ((obj sparticle-launch-control) (arg0 matrix)) (let* ((a2-0 (-> obj origin)) (a3-0 arg0) - (v1-0 (-> a3-0 vector 0 quad)) - (a0-1 (-> a3-0 vector 1 quad)) - (a1-1 (-> a3-0 vector 2 quad)) + (v1-0 (-> a3-0 quad 0)) + (a0-1 (-> a3-0 quad 1)) + (a1-1 (-> a3-0 quad 2)) (a3-1 (-> a3-0 trans quad)) ) - (set! (-> a2-0 vector 0 quad) v1-0) - (set! (-> a2-0 vector 1 quad) a0-1) - (set! (-> a2-0 vector 2 quad) a1-1) + (set! (-> a2-0 quad 0) v1-0) + (set! (-> a2-0 quad 1) a0-1) + (set! (-> a2-0 quad 2) a1-1) (set! (-> a2-0 trans quad) a3-1) ) (let ((s4-0 (-> obj group))) @@ -962,14 +964,14 @@ (defmethod spawn-with-cspace sparticle-launch-control ((obj sparticle-launch-control) (arg0 cspace)) (let* ((v1-0 (-> obj origin)) (a3-0 (-> arg0 bone transform)) - (a0-2 (-> a3-0 vector 0 quad)) - (a1-1 (-> a3-0 vector 1 quad)) - (a2-0 (-> a3-0 vector 2 quad)) + (a0-2 (-> a3-0 quad 0)) + (a1-1 (-> a3-0 quad 1)) + (a2-0 (-> a3-0 quad 2)) (a3-1 (-> a3-0 trans quad)) ) - (set! (-> v1-0 vector 0 quad) a0-2) - (set! (-> v1-0 vector 1 quad) a1-1) - (set! (-> v1-0 vector 2 quad) a2-0) + (set! (-> v1-0 quad 0) a0-2) + (set! (-> v1-0 quad 1) a1-1) + (set! (-> v1-0 quad 2) a2-0) (set! (-> v1-0 trans quad) a3-1) ) (let ((s4-0 (-> obj group))) @@ -1005,13 +1007,14 @@ (none) ) +;; WARN: Function (method 11 sparticle-launch-control) has a return type of none, but the expression builder found a return statement. (defmethod spawn sparticle-launch-control ((obj sparticle-launch-control) (arg0 vector)) (with-pp (set! (-> obj origin trans quad) (-> arg0 quad)) (if (not (or (is-visible? obj arg0) (logtest? (-> obj group flags) (sp-group-flag always-draw screen-space)))) (return 0) ) - (let ((s4-0 (the-as int (-> pp clock frame-counter))) + (let ((s4-0 (the-as int (current-time))) (s5-0 (-> obj last-spawn-time)) ) (let ((v1-10 (-> *display* real-frame-clock integral-frame-counter))) @@ -1348,14 +1351,14 @@ (cond ((< (-> gp-0 w) 0.0) (.lvf vf1 (&-> arg2 qx-qy-qz-sy quad)) - (.lvf vf2 (&-> gp-0 vec quad)) + (.lvf vf2 (&-> gp-0 quad)) (.sub.vf vf1 vf0 vf2 :mask #b111) (.svf (&-> arg2 qx-qy-qz-sy quad) vf1) (.mov v1-1 vf1) ) (else (.lvf vf1 (&-> arg2 qx-qy-qz-sy quad)) - (.lvf vf2 (&-> gp-0 vec quad)) + (.lvf vf2 (&-> gp-0 quad)) (.add.vf vf1 vf0 vf2 :mask #b111) (.svf (&-> arg2 qx-qy-qz-sy quad) vf1) (.mov v1-2 vf1) @@ -1396,14 +1399,14 @@ (cond ((< (-> s4-0 w) 0.0) (.lvf vf1 (&-> v1-4 qx-qy-qz-sy quad)) - (.lvf vf2 (&-> s4-0 vec quad)) + (.lvf vf2 (&-> s4-0 quad)) (.sub.vf vf1 vf0 vf2 :mask #b111) (.svf (&-> v1-4 qx-qy-qz-sy quad) vf1) (.mov v1-5 vf1) ) (else (.lvf vf1 (&-> v1-4 qx-qy-qz-sy quad)) - (.lvf vf2 (&-> s4-0 vec quad)) + (.lvf vf2 (&-> s4-0 quad)) (.add.vf vf1 vf0 vf2 :mask #b111) (.svf (&-> v1-4 qx-qy-qz-sy quad) vf1) (.mov v1-6 vf1) @@ -1459,14 +1462,14 @@ (cond ((< (-> s4-0 w) 0.0) (.lvf vf1 (&-> v1-17 qx-qy-qz-sy quad)) - (.lvf vf2 (&-> s4-0 vec quad)) + (.lvf vf2 (&-> s4-0 quad)) (.sub.vf vf1 vf0 vf2 :mask #b111) (.svf (&-> v1-17 qx-qy-qz-sy quad) vf1) (.mov v1-18 vf1) ) (else (.lvf vf1 (&-> v1-17 qx-qy-qz-sy quad)) - (.lvf vf2 (&-> s4-0 vec quad)) + (.lvf vf2 (&-> s4-0 quad)) (.add.vf vf1 vf0 vf2 :mask #b111) (.svf (&-> v1-17 qx-qy-qz-sy quad) vf1) (.mov v1-19 vf1) @@ -1909,14 +1912,14 @@ (cond ((< (-> s5-1 w) 0.0) (.lvf vf1 (&-> arg2 conerot quad)) - (.lvf vf2 (&-> s5-1 vec quad)) + (.lvf vf2 (&-> s5-1 quad)) (.sub.vf vf1 vf0 vf2 :mask #b111) (.svf (&-> arg2 conerot quad) vf1) (.mov v1-0 vf1) ) (else (.lvf vf1 (&-> arg2 conerot quad)) - (.lvf vf2 (&-> s5-1 vec quad)) + (.lvf vf2 (&-> s5-1 quad)) (.add.vf vf1 vf0 vf2 :mask #b111) (.svf (&-> arg2 conerot quad) vf1) (.mov v1-1 vf1) @@ -1943,14 +1946,14 @@ (cond ((< (-> v1-0 w) 0.0) (.lvf vf1 (&-> a0-1 conerot quad)) - (.lvf vf2 (&-> v1-0 vec quad)) + (.lvf vf2 (&-> v1-0 quad)) (.sub.vf vf1 vf0 vf2 :mask #b111) (.svf (&-> a0-1 conerot quad) vf1) (.mov a0-2 vf1) ) (else (.lvf vf1 (&-> a0-1 conerot quad)) - (.lvf vf2 (&-> v1-0 vec quad)) + (.lvf vf2 (&-> v1-0 quad)) (.add.vf vf1 vf0 vf2 :mask #b111) (.svf (&-> a0-1 conerot quad) vf1) (.mov a0-3 vf1) diff --git a/goal_src/jak2/engine/load/load-state.gc b/goal_src/jak2/engine/load/load-state.gc index f6144e774a..cac9fe8310 100644 --- a/goal_src/jak2/engine/load/load-state.gc +++ b/goal_src/jak2/engine/load/load-state.gc @@ -290,7 +290,7 @@ (return #f) ) (if *display-load-commands* - (format 0 "NOTICE: ~D: ~f: execute command ~A~%" (-> pp clock frame-counter) f0-0 s3-0) + (format 0 "NOTICE: ~D: ~f: execute command ~A~%" (current-time) f0-0 s3-0) ) (cond ((pair? (car s3-0)) diff --git a/goal_src/jak2/engine/load/loader.gc b/goal_src/jak2/engine/load/loader.gc index bdf3bd3fb2..4c9eca87a5 100644 --- a/goal_src/jak2/engine/load/loader.gc +++ b/goal_src/jak2/engine/load/loader.gc @@ -858,7 +858,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) (-> self clock frame-counter)) + (set! (-> gp-0 old-time) (current-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)))) @@ -1004,13 +1004,13 @@ (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) (-> self clock frame-counter)) + (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) (>= (- (-> self clock frame-counter) (-> gp-0 good-time)) (seconds 4))) + (and (<= sv-176 0) (>= (- (current-time) (-> gp-0 good-time)) (seconds 4))) (and (< 300 (-> gp-0 good-count)) (<= sv-176 0)) ) (goto cfg-130) @@ -1041,15 +1041,15 @@ (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) (- (-> self clock frame-counter) (-> self clock old-frame-counter))) - (set! (-> gp-0 good-time) (-> self clock frame-counter)) + (+! (-> gp-0 good-count) (- (current-time) (-> self clock old-frame-counter))) + (set! (-> gp-0 good-time) (current-time)) ) (else 0 ) ) (set! (-> gp-0 old-pos) sv-176) - (set! (-> gp-0 old-time) (-> self clock frame-counter)) + (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))) diff --git a/goal_src/jak2/engine/math/transformq.gc b/goal_src/jak2/engine/math/transformq.gc index 8615a8f5e5..0755599719 100644 --- a/goal_src/jak2/engine/math/transformq.gc +++ b/goal_src/jak2/engine/math/transformq.gc @@ -47,20 +47,19 @@ (f30-0 (fmax (fmin f0-0 f1-2) (- f1-2))) ) (let ((f0-2 (-> obj old-y-angle-diff))) - (set! f30-0 (cond - ((or (= f0-2 0.0) - (and (< 0.0 f30-0) (< 0.0 f0-2)) - (or (and (< f30-0 0.0) (< f0-2 0.0)) - (>= (- (-> pp clock frame-counter) (-> obj angle-change-time)) (seconds 0.2)) - ) - ) - (set! (-> obj angle-change-time) (-> pp clock frame-counter)) - f30-0 - ) - (else - (* 0.000000001 f30-0) - ) - ) + (set! f30-0 + (cond + ((or (= f0-2 0.0) + (and (< 0.0 f30-0) (< 0.0 f0-2)) + (or (and (< f30-0 0.0) (< f0-2 0.0)) (>= (- (current-time) (-> obj angle-change-time)) (seconds 0.2))) + ) + (set! (-> obj angle-change-time) (current-time)) + f30-0 + ) + (else + (* 0.000000001 f30-0) + ) + ) ) ) (set! (-> obj old-y-angle-diff) f30-0) @@ -256,11 +255,11 @@ (defun transformq-copy! ((arg0 transformq) (arg1 transformq)) "Set arg0 = arg1" (let ((v1-0 (-> arg1 trans quad)) - (a2-0 (-> arg1 quat vec quad)) + (a2-0 (-> arg1 quat quad)) (a1-1 (-> arg1 scale quad)) ) (set! (-> arg0 trans quad) v1-0) - (set! (-> arg0 quat vec quad) a2-0) + (set! (-> arg0 quat quad) a2-0) (set! (-> arg0 scale quad) a1-1) ) arg0 @@ -285,17 +284,17 @@ (else (.lvf vf1 (&-> arg1 scale quad)) (.lvf vf2 (&-> arg1 trans quad)) - (.lvf vf3 (&-> arg0 vector 0 quad)) - (.lvf vf4 (&-> arg0 vector 1 quad)) - (.lvf vf5 (&-> arg0 vector 2 quad)) + (.lvf vf3 (&-> arg0 quad 0)) + (.lvf vf4 (&-> arg0 quad 1)) + (.lvf vf5 (&-> arg0 quad 2)) (.mov.vf vf2 vf0 :mask #b1000) (.mul.x.vf vf3 vf3 vf1) (.mul.y.vf vf4 vf4 vf1) (.mul.z.vf vf5 vf5 vf1) (.svf (&-> arg0 trans quad) vf2) - (.svf (&-> arg0 vector 0 quad) vf3) - (.svf (&-> arg0 vector 1 quad) vf4) - (.svf (&-> arg0 vector 2 quad) vf5) + (.svf (&-> arg0 quad 0) vf3) + (.svf (&-> arg0 quad 1) vf4) + (.svf (&-> arg0 quad 2) vf5) (.mov v1-1 vf5) ) ) @@ -315,17 +314,17 @@ (init-vf0-vector) (quaternion->matrix arg0 (-> arg1 quat)) (.lvf vf1 (&-> arg1 scale quad)) - (.lvf vf3 (&-> arg0 vector 0 quad)) - (.lvf vf4 (&-> arg0 vector 1 quad)) - (.lvf vf5 (&-> arg0 vector 2 quad)) + (.lvf vf3 (&-> arg0 quad 0)) + (.lvf vf4 (&-> arg0 quad 1)) + (.lvf vf5 (&-> arg0 quad 2)) (.mov.vf vf2 vf0) (.mul.x.vf vf3 vf3 vf1) (.mul.y.vf vf4 vf4 vf1) (.mul.z.vf vf5 vf5 vf1) (.svf (&-> arg0 trans quad) vf2) - (.svf (&-> arg0 vector 0 quad) vf3) - (.svf (&-> arg0 vector 1 quad) vf4) - (.svf (&-> arg0 vector 2 quad) vf5) + (.svf (&-> arg0 quad 0) vf3) + (.svf (&-> arg0 quad 1) vf4) + (.svf (&-> arg0 quad 2) vf5) arg0 ) ) @@ -346,9 +345,9 @@ (.lvf vf1 (&-> arg1 scale quad)) (.lvf vf2 (&-> arg1 trans quad)) (.lvf vf6 (&-> arg2 quad)) - (.lvf vf3 (&-> arg0 vector 0 quad)) - (.lvf vf4 (&-> arg0 vector 1 quad)) - (.lvf vf5 (&-> arg0 vector 2 quad)) + (.lvf vf3 (&-> arg0 quad 0)) + (.lvf vf4 (&-> arg0 quad 1)) + (.lvf vf5 (&-> arg0 quad 2)) (.mov.vf vf2 vf0 :mask #b1000) (.mul.x.vf vf3 vf3 vf1) (.mul.y.vf vf4 vf4 vf1) @@ -358,9 +357,9 @@ (.add.mul.z.vf acc vf5 vf6 acc) (.add.mul.w.vf vf2 vf2 vf0 acc :mask #b111) (.svf (&-> arg0 trans quad) vf2) - (.svf (&-> arg0 vector 0 quad) vf3) - (.svf (&-> arg0 vector 1 quad) vf4) - (.svf (&-> arg0 vector 2 quad) vf5) + (.svf (&-> arg0 quad 0) vf3) + (.svf (&-> arg0 quad 1) vf4) + (.svf (&-> arg0 quad 2) vf5) arg0 ) ) @@ -380,18 +379,18 @@ (.lvf vf1 (&-> arg1 scale quad)) (.lvf vf2 (&-> arg1 trans quad)) (.lvf vf6 (&-> arg2 quad)) - (.lvf vf3 (&-> arg0 vector 0 quad)) - (.lvf vf4 (&-> arg0 vector 1 quad)) - (.lvf vf5 (&-> arg0 vector 2 quad)) + (.lvf vf3 (&-> arg0 quad 0)) + (.lvf vf4 (&-> arg0 quad 1)) + (.lvf vf5 (&-> arg0 quad 2)) (.mov.vf vf2 vf0 :mask #b1000) (.mul.x.vf vf3 vf3 vf1) (.mul.y.vf vf4 vf4 vf1) (.mul.z.vf vf5 vf5 vf1) (.add.vf vf2 vf2 vf6 :mask #b111) (.svf (&-> arg0 trans quad) vf2) - (.svf (&-> arg0 vector 0 quad) vf3) - (.svf (&-> arg0 vector 1 quad) vf4) - (.svf (&-> arg0 vector 2 quad) vf5) + (.svf (&-> arg0 quad 0) vf3) + (.svf (&-> arg0 quad 1) vf4) + (.svf (&-> arg0 quad 2) vf5) arg0 ) ) @@ -416,9 +415,9 @@ (.lvf vf1 (&-> arg1 scale quad)) (.lvf vf2 (&-> arg1 trans quad)) (.mov.vf vf2 vf0 :mask #b1000) - (.lvf vf4 (&-> arg0 vector 0 quad)) - (.lvf vf5 (&-> arg0 vector 1 quad)) - (.lvf vf6 (&-> arg0 vector 2 quad)) + (.lvf vf4 (&-> arg0 quad 0)) + (.lvf vf5 (&-> arg0 quad 1)) + (.lvf vf6 (&-> arg0 quad 2)) (.mul.x.vf vf4 vf4 vf1) (.mul.y.vf vf5 vf5 vf1) (.mul.z.vf vf6 vf6 vf1) @@ -428,9 +427,9 @@ (.mul.vf vf5 vf5 vf3) (.mul.vf vf6 vf6 vf3) (.svf (&-> arg0 trans quad) vf2) - (.svf (&-> arg0 vector 0 quad) vf4) - (.svf (&-> arg0 vector 1 quad) vf5) - (.svf (&-> arg0 vector 2 quad) vf6) + (.svf (&-> arg0 quad 0) vf4) + (.svf (&-> arg0 quad 1) vf5) + (.svf (&-> arg0 quad 2) vf6) (.mov v1-1 vf6) arg0 ) @@ -453,9 +452,9 @@ (.lvf vf1 (&-> arg1 scale quad)) (.lvf vf2 (&-> arg1 trans quad)) (.lvf vf6 (&-> arg2 quad)) - (.lvf vf3 (&-> arg0 vector 0 quad)) - (.lvf vf4 (&-> arg0 vector 1 quad)) - (.lvf vf5 (&-> arg0 vector 2 quad)) + (.lvf vf3 (&-> arg0 quad 0)) + (.lvf vf4 (&-> arg0 quad 1)) + (.lvf vf5 (&-> arg0 quad 2)) (.mov.vf vf2 vf0 :mask #b1000) (.mul.x.vf vf3 vf3 vf1) (.mul.y.vf vf4 vf4 vf1) @@ -463,16 +462,12 @@ (.mul.x.vf acc vf3 vf6) (.add.mul.y.vf acc vf4 vf6 acc) (.add.mul.z.vf acc vf5 vf6 acc) - (.sub.mul.w.vf acc vf6 vf0 acc) ;; this line is added compared to the +trans! one + (.sub.mul.w.vf acc vf6 vf0 acc) (.add.mul.w.vf vf2 vf2 vf0 acc :mask #b111) (.svf (&-> arg0 trans quad) vf2) - (.svf (&-> arg0 vector 0 quad) vf3) - (.svf (&-> arg0 vector 1 quad) vf4) - (.svf (&-> arg0 vector 2 quad) vf5) + (.svf (&-> arg0 quad 0) vf3) + (.svf (&-> arg0 quad 1) vf4) + (.svf (&-> arg0 quad 2) vf5) arg0 ) ) - - - - diff --git a/goal_src/jak2/engine/nav/nav-enemy.gc b/goal_src/jak2/engine/nav/nav-enemy.gc index 32ee0e0701..d4e0dc08d3 100644 --- a/goal_src/jak2/engine/nav/nav-enemy.gc +++ b/goal_src/jak2/engine/nav/nav-enemy.gc @@ -222,83 +222,81 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (with-pp - (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (-> pp clock frame-counter)) - ) - (enemy-method-129 self) - (when (logtest? (enemy-flag use-trigger) (-> self enemy-flags)) - (if (-> self nav) - (enemy-method-100 self) - (enemy-method-103 self) - ) + (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) + (set! (-> self last-draw-time) (current-time)) ) - (when *target* - (target-look-at-me! :trans (the-as vector (-> self root-override2 root-prim prim-core)) - :message (if (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance)) - 'attacking - )) - ) - (when (nonzero? (-> self neck)) - (cond - ((logtest? (-> self enemy-flags) (enemy-flag lock-focus)) - (let ((a0-10 (handle->process (-> self focus handle)))) - (if a0-10 - (target-set! (-> self neck) (get-trans (the-as process-focusable a0-10) 2)) - ) - ) - ) - ((logtest? (-> self enemy-flags) (enemy-flag death-start)) - (let ((s5-1 (-> self move-dest)) - (v1-47 (vector<-cspace! - (new 'stack-no-clear 'vector) - (-> self node-list data (-> self enemy-info-override neck-joint)) - ) - ) - (a1-6 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-6 x) (-> s5-1 x)) - (set! (-> a1-6 y) (-> v1-47 y)) - (set! (-> a1-6 z) (-> s5-1 z)) - (set! (-> a1-6 w) 1.0) - (target-set! (-> self neck) a1-6) - ) - ) + (enemy-method-129 self) + (when (logtest? (enemy-flag use-trigger) (-> self enemy-flags)) + (if (-> self nav) + (enemy-method-100 self) + (enemy-method-103 self) ) - ) - (when (and (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) - (>= (- (-> pp clock frame-counter) (-> self auto-reset-penetrate-time)) (seconds 0.1)) - ) - (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) - (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) - (let ((v1-62 0)) - (if (logtest? (penetrate knocked) (-> self root-override2 penetrate-using)) - (set! v1-62 (logior (shl 1 32) v1-62)) - ) - (set! (-> self root-override2 penetrate-using) (the-as penetrate v1-62)) - ) - ) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (enemy-method-136 self) - ) - (if (logtest? (enemy-flag trackable-backup directed-ready) (-> self enemy-flags)) - (enemy-method-54 self) - ) - (let ((v1-73 (-> self restore-nav-radius-time))) - (when (nonzero? v1-73) - (when (>= (-> pp clock frame-counter) v1-73) - (set! (-> self restore-nav-radius-time) 0) - (set! (-> self root-override2 nav-radius) (-> self nav-radius-backup)) - ) - ) - ) - (if (and *debug-segment* (-> self enemy-info-override debug-draw-neck) (nonzero? (-> self neck))) - (joint-mod-debug-draw (-> self neck)) - ) - (ja-post) - 0 - (none) ) + (when *target* + (target-look-at-me! :trans (the-as vector (-> self root-override2 root-prim prim-core)) + :message (if (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance)) + 'attacking + )) + ) + (when (nonzero? (-> self neck)) + (cond + ((logtest? (-> self enemy-flags) (enemy-flag lock-focus)) + (let ((a0-10 (handle->process (-> self focus handle)))) + (if a0-10 + (target-set! (-> self neck) (get-trans (the-as process-focusable a0-10) 2)) + ) + ) + ) + ((logtest? (-> self enemy-flags) (enemy-flag death-start)) + (let ((s5-1 (-> self move-dest)) + (v1-47 (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> self node-list data (-> self enemy-info-override neck-joint)) + ) + ) + (a1-6 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-6 x) (-> s5-1 x)) + (set! (-> a1-6 y) (-> v1-47 y)) + (set! (-> a1-6 z) (-> s5-1 z)) + (set! (-> a1-6 w) 1.0) + (target-set! (-> self neck) a1-6) + ) + ) + ) + ) + (when (and (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) + (>= (- (current-time) (-> self auto-reset-penetrate-time)) (seconds 0.1)) + ) + (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) + (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) + (let ((v1-62 0)) + (if (logtest? (penetrate knocked) (-> self root-override2 penetrate-using)) + (set! v1-62 (logior (shl 1 32) v1-62)) + ) + (set! (-> self root-override2 penetrate-using) (the-as penetrate v1-62)) + ) + ) + (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (enemy-method-136 self) + ) + (if (logtest? (enemy-flag trackable-backup directed-ready) (-> self enemy-flags)) + (enemy-method-54 self) + ) + (let ((v1-73 (-> self restore-nav-radius-time))) + (when (nonzero? v1-73) + (when (>= (current-time) v1-73) + (set! (-> self restore-nav-radius-time) 0) + (set! (-> self root-override2 nav-radius) (-> self nav-radius-backup)) + ) + ) + ) + (if (and *debug-segment* (-> self enemy-info-override debug-draw-neck) (nonzero? (-> self neck))) + (joint-mod-debug-draw (-> self neck)) + ) + (ja-post) + 0 + (none) ) (defmethod nav-enemy-method-177 nav-enemy ((obj nav-enemy)) @@ -343,7 +341,7 @@ (cond ((logtest? (-> s5-0 state flags) (nav-state-flag blocked)) (if (zero? (-> obj blocked-start-time)) - (set! (-> obj blocked-start-time) (-> self clock frame-counter)) + (set! (-> obj blocked-start-time) (current-time)) ) ) (else @@ -958,43 +956,39 @@ ) (defmethod nav-enemy-method-161 nav-enemy ((obj nav-enemy)) - (with-pp - (set! (-> obj enemy-flags) (the-as enemy-flag (logclear (-> obj enemy-flags) (enemy-flag enemy-flag39)))) - (set! (-> obj frustration-time) (-> pp clock frame-counter)) - (let ((v1-7 (handle->process (-> obj focus handle)))) - (if v1-7 - (set! (-> obj frustration-point quad) (-> (get-trans (the-as process-focusable v1-7) 1) quad)) - ) - ) - 0 - (none) + (set! (-> obj enemy-flags) (the-as enemy-flag (logclear (-> obj enemy-flags) (enemy-flag enemy-flag39)))) + (set! (-> obj frustration-time) (current-time)) + (let ((v1-7 (handle->process (-> obj focus handle)))) + (if v1-7 + (set! (-> obj frustration-point quad) (-> (get-trans (the-as process-focusable v1-7) 1) quad)) + ) ) + 0 + (none) ) (defmethod nav-enemy-method-160 nav-enemy ((obj nav-enemy)) - (with-pp - (let ((s5-0 (handle->process (-> obj focus handle)))) - (cond - ((or (not s5-0) - (< 6144.0 (vector-vector-distance (get-trans (the-as process-focusable s5-0) 1) (-> obj frustration-point))) - (< (-> obj enemy-info-override frustration-distance) - (vector-vector-xz-distance (get-trans (the-as process-focusable s5-0) 0) (-> obj root-override2 trans)) - ) - ) - (nav-enemy-method-161 obj) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> obj frustration-time)) - (+ (-> obj reaction-time) (-> obj enemy-info-override frustration-time)) - ) - (set! (-> obj enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag39) (-> obj enemy-flags)))) - 0 - ) + (let ((s5-0 (handle->process (-> obj focus handle)))) + (cond + ((or (not s5-0) + (< 6144.0 (vector-vector-distance (get-trans (the-as process-focusable s5-0) 1) (-> obj frustration-point))) + (< (-> obj enemy-info-override frustration-distance) + (vector-vector-xz-distance (get-trans (the-as process-focusable s5-0) 0) (-> obj root-override2 trans)) + ) + ) + (nav-enemy-method-161 obj) + ) + (else + (when (>= (- (current-time) (-> obj frustration-time)) + (+ (-> obj reaction-time) (-> obj enemy-info-override frustration-time)) + ) + (set! (-> obj enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag39) (-> obj enemy-flags)))) + 0 ) ) ) - (none) ) + (none) ) (defmethod nav-enemy-method-162 nav-enemy ((obj nav-enemy)) @@ -1004,10 +998,8 @@ ) (defmethod nav-enemy-method-163 nav-enemy ((obj nav-enemy)) - (with-pp - (let ((v1-0 (-> obj blocked-start-time))) - (and (nonzero? v1-0) (>= (- (-> pp clock frame-counter) v1-0) (-> obj enemy-info-override blocked-time))) - ) + (let ((v1-0 (-> obj blocked-start-time))) + (and (nonzero? v1-0) (>= (- (current-time) v1-0) (-> obj enemy-info-override blocked-time))) ) ) @@ -1452,10 +1444,7 @@ This commonly includes things such as: ;; WARN: Return type mismatch int vs time-frame. (defmethod nav-enemy-method-144 nav-enemy ((obj nav-enemy)) (set! (-> obj root-override2 nav-radius) 4.096) - (let ((s5-1 - (max (-> obj restore-nav-radius-time) (+ (-> self clock frame-counter) (get-rand-int-range obj 1500 2400))) - ) - ) + (let ((s5-1 (max (-> obj restore-nav-radius-time) (+ (current-time) (get-rand-int-range obj 1500 2400))))) (set! (-> obj restore-nav-radius-time) (the-as time-frame s5-1)) (the-as time-frame s5-1) ) @@ -1479,7 +1468,7 @@ This commonly includes things such as: (nav-enemy-method-176 self) (if (and (nav-enemy-method-163 self) (zero? (-> self restore-nav-radius-time)) - (>= (- (-> self clock frame-counter) (-> self blocked-start-time)) (seconds 4)) + (>= (- (current-time) (-> self blocked-start-time)) (seconds 4)) ) (nav-enemy-method-144 self) ) @@ -1494,14 +1483,14 @@ This commonly includes things such as: (defbehavior nav-enemy-turn-to-face-dir nav-enemy ((arg0 vector) (arg1 float)) (local-vars (v1-18 symbol)) - (let ((s4-0 (-> self clock frame-counter))) + (let ((s4-0 (current-time))) (ja :group! (-> self draw art-group data (-> self enemy-info-override turn-anim))) (ja :num-func num-func-identity :frame-num 0.0) (until v1-18 (seek-toward-heading-vec! (-> self root-override2) arg0 (-> self nav max-rotation-rate) (seconds 0.02)) (suspend) (ja :num! (loop! 0.75)) - (set! v1-18 (or (>= (- (-> self clock frame-counter) s4-0) (seconds 10)) (enemy-method-94 self arg0 arg1))) + (set! v1-18 (or (>= (- (current-time) s4-0) (seconds 10)) (enemy-method-94 self arg0 arg1))) ) ) (forward-up->quaternion (-> self root-override2 quat) arg0 *y-vector*) @@ -1896,7 +1885,7 @@ This commonly includes things such as: (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info-override use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (nav-enemy-method-163 self) (go-stare2 self) ) @@ -1932,7 +1921,7 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior nav-enemy) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((a1-0 (new 'stack-no-clear 'vector))) (let ((a2-0 (-> self nav state))) (set! (-> a1-0 quad) (-> a2-0 target-post quad)) @@ -1967,14 +1956,14 @@ This commonly includes things such as: (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info-override use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (nav-enemy-method-163 self) (go-stare2 self) ) (let ((gp-0 (-> self focus aware))) (cond ((>= 1 (the-as int gp-0)) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (if (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (go-virtual active) ) ) @@ -1985,7 +1974,7 @@ This commonly includes things such as: (go-flee self) ) (else - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (if (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (go-stare self) ) ) @@ -2035,7 +2024,7 @@ This commonly includes things such as: 0 (nav-enemy-method-167 self) (vector-reset! (-> self root-override2 transv)) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) (none) ) :exit (behavior () @@ -2096,11 +2085,9 @@ This commonly includes things such as: ) (let ((gp-0 (-> self focus aware))) (if (< (the-as int gp-0) 2) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) ) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - (not (nav-enemy-method-163 self)) - ) + (when (and (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (not (nav-enemy-method-163 self))) (cond ((>= 1 (the-as int gp-0)) (go-virtual active) @@ -2109,7 +2096,7 @@ This commonly includes things such as: (if (and (get-enemy-target self) (not (and (-> self enemy-info-override use-frustration) (logtest? (enemy-flag enemy-flag39) (-> self enemy-flags))) ) - (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) + (>= (- (current-time) (-> self starting-time)) (-> self reaction-time)) ) (go-hostile self) ) @@ -2122,7 +2109,7 @@ This commonly includes things such as: ) ((and (= gp-0 (enemy-aware enemy-aware-2)) (-> self enemy-info-override use-pacing) - (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) + (>= (- (current-time) (-> self starting-time)) (-> self reaction-time)) ) (go-virtual pacing) ) @@ -2171,9 +2158,7 @@ This commonly includes things such as: ) :exit (-> (method-of-type nav-enemy stare) exit) :trans (behavior () - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - (not (nav-enemy-method-163 self)) - ) + (when (and (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (not (nav-enemy-method-163 self))) (let ((v1-6 (-> self focus aware))) (cond ((>= 1 (the-as int v1-6)) @@ -2191,14 +2176,14 @@ This commonly includes things such as: (ja-channel-push! 1 (seconds 0.2)) (let ((f30-0 (get-rand-float-range self 0.8 1.2))) (let ((gp-0 (get-rand-int-range self 60 210)) - (s5-0 (-> self clock frame-counter)) + (s5-0 (current-time)) (f28-0 f30-0) ) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info-override idle-anim)) :num! (loop! f28-0) :frame-num 0.0 ) - (until (>= (- (-> self clock frame-counter) s5-0) gp-0) + (until (>= (- (current-time) s5-0) gp-0) (suspend) (ja :num! (loop! f28-0)) ) @@ -2233,7 +2218,7 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior nav-enemy) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (look-at-target! self (enemy-flag lock-focus)) (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (let ((v1-6 self)) @@ -2252,7 +2237,7 @@ This commonly includes things such as: (logclear! (-> self mask) (process-mask actor-pause)) (set! (-> self move-dest quad) (-> self root-override2 trans quad)) (set! (-> self state-timeout) (the-as time-frame (get-rand-int-range self 2100 3300))) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) (if (zero? (get-rand-int self 2)) (set! (-> self enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag40) (-> self enemy-flags)))) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag enemy-flag40)))) @@ -2273,16 +2258,14 @@ This commonly includes things such as: ) (let ((gp-1 (-> self focus aware))) (if (or (!= gp-1 3) (not (get-enemy-target self))) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (>= 1 (the-as int gp-1)) (go-virtual active) ) (when (= gp-1 (enemy-aware enemy-aware-3)) - (when (and (get-enemy-target self) - (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) - ) + (when (and (get-enemy-target self) (>= (- (current-time) (-> self starting-time)) (-> self reaction-time))) (nav-enemy-method-161 self) (go-virtual hostile) ) @@ -2293,16 +2276,14 @@ This commonly includes things such as: (if (nav-enemy-method-163 self) (go-stare2 self) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (when (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (nav-enemy-method-161 self) (go-stare2 self) ) ) ) (when (>= 1024.0 (vector-vector-xz-distance (-> self root-override2 trans) (-> self move-dest))) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - (zero? (get-rand-int self 3)) - ) + (when (and (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (zero? (get-rand-int self 3))) (nav-enemy-method-161 self) (go-stare2 self) ) @@ -2376,7 +2357,7 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior nav-enemy) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (look-at-target! self (enemy-flag lock-focus)) (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (let ((v1-6 self)) @@ -2411,7 +2392,7 @@ This commonly includes things such as: ) (set! (-> self enemy-flags) (the-as enemy-flag (logxor (shl 256 32) (the-as int (-> self enemy-flags))))) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag enemy-flag41)))) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) (none) ) :trans (behavior () @@ -2422,9 +2403,9 @@ This commonly includes things such as: ) (let ((gp-1 (-> self focus aware))) (if (or (!= gp-1 3) (not (get-enemy-target self))) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (when (>= 1 (the-as int gp-1)) (nav-enemy-method-161 self) (if (-> self enemy-info-override use-stop-chase) @@ -2434,7 +2415,7 @@ This commonly includes things such as: ) (when (and (= gp-1 (enemy-aware enemy-aware-3)) (get-enemy-target self) - (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) + (>= (- (current-time) (-> self starting-time)) (-> self reaction-time)) ) (nav-enemy-method-161 self) (go-hostile self) @@ -2538,7 +2519,7 @@ This commonly includes things such as: (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (let ((v1-3 (-> self focus aware))) (if (!= v1-3 (enemy-aware unaware)) (go-stare self) @@ -2829,7 +2810,7 @@ This commonly includes things such as: (let ((s5-1 2)) (logior! (-> self focus-status) (focus-status in-air)) (until (enemy-method-86 self) - (+! (-> gp-0 hang-time) (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! (-> gp-0 hang-time) (- (current-time) (-> self clock old-frame-counter))) (enemy-method-90 self s5-1 gp-0) (enemy-method-91 self s5-1 gp-0) (enemy-method-92 self s5-1 (the-as nav-poly gp-0)) diff --git a/goal_src/jak2/engine/physics/chain-physics.gc b/goal_src/jak2/engine/physics/chain-physics.gc index de6651f779..d1c321471d 100644 --- a/goal_src/jak2/engine/physics/chain-physics.gc +++ b/goal_src/jak2/engine/physics/chain-physics.gc @@ -63,7 +63,7 @@ ) (defmethod turn-off chain-physics ((obj chain-physics) (arg0 time-frame)) - (set! (-> obj turn-off-start) (-> self clock frame-counter)) + (set! (-> obj turn-off-start) (current-time)) (set! (-> obj turn-off-duration) arg0) 0 (none) @@ -125,11 +125,9 @@ 0.0 (fmin 1.0 - (parameter-ease-sin-clamp (- 1.0 (/ (the float (- (-> self clock frame-counter) (-> obj turn-off-start))) - (the float (-> obj turn-off-duration)) - ) - ) - ) + (parameter-ease-sin-clamp + (- 1.0 (/ (the float (- (current-time) (-> obj turn-off-start))) (the float (-> obj turn-off-duration)))) + ) ) ) ) diff --git a/goal_src/jak2/engine/physics/rigid-body.gc b/goal_src/jak2/engine/physics/rigid-body.gc index 098be253cb..ebe203f6a8 100644 --- a/goal_src/jak2/engine/physics/rigid-body.gc +++ b/goal_src/jak2/engine/physics/rigid-body.gc @@ -1082,7 +1082,7 @@ This commonly includes things such as: (defmethod rigid-body-object-method-42 rigid-body-object ((obj rigid-body-object)) (logior! (-> obj flags) (rigid-body-object-flag disturbed)) - (set! (-> obj disturbed-time) (-> self clock frame-counter)) + (set! (-> obj disturbed-time) (current-time)) (if (not (logtest? (-> obj rbody state flags) (rigid-body-flag enable-physics))) (rigid-body-object-method-38 obj) ) @@ -1323,7 +1323,7 @@ This commonly includes things such as: (when s3-0 (when (logtest? (-> s3-0 mask) (process-mask target)) (logior! (-> obj flags) (rigid-body-object-flag player-touching)) - (set! (-> obj player-touch-time) (-> self clock frame-counter)) + (set! (-> obj player-touch-time) (current-time)) (rigid-body-object-method-42 obj) ) (if (not (logtest? (-> s3-0 mask) (process-mask target))) diff --git a/goal_src/jak2/engine/physics/trajectory.gc b/goal_src/jak2/engine/physics/trajectory.gc index 651f96f091..6953a853c6 100644 --- a/goal_src/jak2/engine/physics/trajectory.gc +++ b/goal_src/jak2/engine/physics/trajectory.gc @@ -134,7 +134,7 @@ ) (defmethod initialize impact-control ((obj impact-control) (arg0 process-drawable) (arg1 int) (arg2 float) (arg3 collide-spec)) - (set! (-> obj start-time) (-> self clock frame-counter)) + (set! (-> obj start-time) (current-time)) (set! (-> obj process) (the-as (pointer process-drawable) (process->ppointer arg0))) (set! (-> obj joint) arg1) (set! (-> obj radius) arg2) diff --git a/goal_src/jak2/engine/process-drawable/process-drawable.gc b/goal_src/jak2/engine/process-drawable/process-drawable.gc index 9e09500053..50a3b1221b 100644 --- a/goal_src/jak2/engine/process-drawable/process-drawable.gc +++ b/goal_src/jak2/engine/process-drawable/process-drawable.gc @@ -639,14 +639,7 @@ (s2-0 (bucket-id debug-no-zbuf1)) ) (format (clear *temp-string*) "~2j~s error for ~s" arg0 (-> self name)) - (s4-0 - s3-0 - (the-as bucket-id s2-0) - *temp-string* - (the-as vector s5-1) - (font-color red) - (the-as vector2h #f) - ) + (s4-0 s3-0 (the-as bucket-id s2-0) *temp-string* (the-as vector s5-1) (font-color red) (the-as vector2h #f)) ) ) ) @@ -980,7 +973,7 @@ (set! (-> s5-0 root-channel) (-> s5-0 channel)) (set! (-> s5-0 blend-index) (the-as uint -1)) (dotimes (v1-19 arg0) - (set! (-> s5-0 root-channel v1-19 eval-time) (the-as uint (-> self clock frame-counter))) + (set! (-> s5-0 root-channel v1-19 eval-time) (the-as uint (current-time))) (set! (-> s5-0 root-channel v1-19 group-sub-index) v1-19) (set! (-> s5-0 root-channel v1-19 command) (if (zero? v1-19) (joint-control-command push) @@ -1045,7 +1038,7 @@ ) (set! (-> s5-0 active-channels) (the-as uint (+ arg0 1 (-> s5-0 active-channels)))) (dotimes (v1-38 arg0) - (set! (-> s5-0 root-channel v1-38 eval-time) (the-as uint (-> self clock frame-counter))) + (set! (-> s5-0 root-channel v1-38 eval-time) (the-as uint (current-time))) (set! (-> s5-0 root-channel v1-38 group-sub-index) v1-38) (set! (-> s5-0 root-channel v1-38 command) (if (zero? v1-38) (joint-control-command push) @@ -1102,7 +1095,7 @@ (else (let ((v0-1 (-> self skel channel (+ (-> self skel active-channels) (-> self skel float-channels))))) (+! (-> self skel float-channels) 1) - (set! (-> v0-1 eval-time) (the-as uint (-> self clock frame-counter))) + (set! (-> v0-1 eval-time) (the-as uint (current-time))) (set! (-> v0-1 group-sub-index) 0) (set! (-> v0-1 command) (joint-control-command float)) (set! (-> v0-1 frame-interp 0) arg2) @@ -1162,7 +1155,7 @@ (defbehavior ja-eval process-drawable () (let ((gp-0 (-> self skel root-channel 0)) (s5-0 (-> self skel channel (+ (-> self skel active-channels) (-> self skel float-channels)))) - (s4-0 (-> self clock frame-counter)) + (s4-0 (current-time)) ) (while (< (the-as int gp-0) (the-as int s5-0)) (cond @@ -1183,7 +1176,7 @@ (defbehavior ja-blend-eval process-drawable () (let ((gp-0 (-> self skel root-channel)) (s5-0 (the-as joint-control-channel (-> self skel channel))) - (s4-0 (-> self clock frame-counter)) + (s4-0 (current-time)) ) (when (and (nonzero? (-> self skel active-channels)) (!= gp-0 s5-0)) (while (< (the-as int s5-0) (the-as int gp-0)) @@ -1241,92 +1234,92 @@ (none) ) +;; ERROR: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)] +;; ERROR: Unsupported inline assembly instruction kind - [jr ra] (defmethod evaluate-joint-control process-drawable ((obj process-drawable)) (local-vars (s1-0 joint-control-channel) (s2-0 int) (s4-0 uint) (s7-0 none) (ra-0 int)) - (with-pp - (let ((gp-0 (-> obj skel))) - (let ((a0-1 (-> gp-0 top-anim))) - (b! (not a0-1) cfg-2 :delay (empty-form)) - (update a0-1) - ) - (until (= s4-0 (+ (-> gp-0 active-channels) (-> gp-0 float-channels))) - (label cfg-2) - (set! s4-0 (+ (-> gp-0 active-channels) (-> gp-0 float-channels))) - (let ((s3-0 (-> pp clock frame-counter))) - (b! (logtest? (-> obj draw status) (draw-control-status no-draw)) cfg-45 :delay (empty-form)) - (set! s2-0 0) - (b! #t cfg-30 :delay (nop!)) - (label cfg-4) - (set! s1-0 (-> gp-0 channel s2-0)) - (b! - (not (and (logtest? (-> s1-0 command) (joint-control-command thirty-two)) (!= (-> s1-0 eval-time) s3-0))) - cfg-10 - :delay (empty-form) - ) + (let ((gp-0 (-> obj skel))) + (let ((a0-1 (-> gp-0 top-anim))) + (b! (not a0-1) cfg-2 :delay (empty-form)) + (update a0-1) + ) + (until (= s4-0 (+ (-> gp-0 active-channels) (-> gp-0 float-channels))) + (label cfg-2) + (set! s4-0 (+ (-> gp-0 active-channels) (-> gp-0 float-channels))) + (let ((s3-0 (current-time))) + (b! (logtest? (-> obj draw status) (draw-control-status no-draw)) cfg-45 :delay (empty-form)) + (set! s2-0 0) + (b! #t cfg-30 :delay (nop!)) + (label cfg-4) + (set! s1-0 (-> gp-0 channel s2-0)) + (b! + (not (and (logtest? (-> s1-0 command) (joint-control-command thirty-two)) (!= (-> s1-0 eval-time) s3-0))) + cfg-10 + :delay (empty-form) ) - (joint-control-channel-eval s1-0) ) - (label cfg-10) - (let ((v1-19 (-> s1-0 command))) - (b! (!= v1-19 (joint-control-command stack)) cfg-12 :delay (nop!)) - (b! #t cfg-29 :delay (nop!)) - (label cfg-12) - (cond - ((= v1-19 (joint-control-command stack1)) - (set! (-> gp-0 channel (+ s2-0 -1) frame-interp 0) (-> s1-0 frame-interp 0)) - (set! (-> gp-0 channel (+ s2-0 -1) frame-interp 1) (-> s1-0 frame-interp 1)) - ) - (else - (let ((s0-0 (-> s1-0 frame-group))) - (when (not (and s0-0 (nonzero? s0-0) (= (logand (the-as int s0-0) 7) 4) (= (-> s0-0 type) art-joint-anim))) - (go process-drawable-art-error "joint-anim") - (abandon-thread) - 0 - ) - (when (nonzero? (-> s0-0 frames flags)) - (cond - ((logtest? (-> s0-0 frames flags) 2) - (update-time-stamp *anim-manager* s0-0) - ) - ((logtest? (-> s0-0 frames flags) 1) - (decompress *anim-manager* s0-0) - ) - ) - ) - (set! (-> s1-0 frame-num) - (fmax 0.0 (fmin (-> s1-0 frame-num) (the float (+ (-> s0-0 frames num-frames) -1)))) - ) + (joint-control-channel-eval s1-0) + ) + (label cfg-10) + (let ((v1-19 (-> s1-0 command))) + (b! (!= v1-19 (joint-control-command stack)) cfg-12 :delay (nop!)) + (b! #t cfg-29 :delay (nop!)) + (label cfg-12) + (cond + ((= v1-19 (joint-control-command stack1)) + (set! (-> gp-0 channel (+ s2-0 -1) frame-interp 0) (-> s1-0 frame-interp 0)) + (set! (-> gp-0 channel (+ s2-0 -1) frame-interp 1) (-> s1-0 frame-interp 1)) + ) + (else + (let ((s0-0 (-> s1-0 frame-group))) + (when (not (and s0-0 (nonzero? s0-0) (= (logand (the-as int s0-0) 7) 4) (= (-> s0-0 type) art-joint-anim))) + (go process-drawable-art-error "joint-anim") + (abandon-thread) + 0 ) + (when (nonzero? (-> s0-0 frames flags)) + (cond + ((logtest? (-> s0-0 frames flags) 2) + (update-time-stamp *anim-manager* s0-0) + ) + ((logtest? (-> s0-0 frames flags) 1) + (decompress *anim-manager* s0-0) + ) + ) + ) + (set! (-> s1-0 frame-num) + (fmax 0.0 (fmin (-> s1-0 frame-num) (the float (+ (-> s0-0 frames num-frames) -1)))) + ) ) ) ) - (label cfg-29) - (+! s2-0 1) - (label cfg-30) - (b! (< s2-0 (the-as int s4-0)) cfg-4) - (dotimes (v1-56 (the-as int s4-0)) - (set! (-> gp-0 channel v1-56 frame-interp 0) (fmax 0.0 (fmin 1.0 (-> gp-0 channel v1-56 frame-interp 0)))) - (set! (-> gp-0 channel v1-56 frame-interp 1) (fmax 0.0 (fmin 1.0 (-> gp-0 channel v1-56 frame-interp 1)))) - ) - (if (or (zero? s4-0) (or (not (-> gp-0 root-channel 0 frame-group)) (zero? (-> gp-0 active-channels)))) - (logior! (-> obj draw status) (draw-control-status no-draw-temp)) - ) - (if (logtest? (-> obj skel status) (joint-control-status blend-shape blend-shape-valid)) - (merc-blend-shape obj) - ) - (if (logtest? (-> obj skel status) (joint-control-status eye-anim-valid eye-anim)) - (merc-eye-anim obj) - ) - (label cfg-45) - (let ((a0-26 (-> gp-0 effect))) - (if a0-26 - (update-effects a0-26) - ) - ) ) - 0 - (none) + (label cfg-29) + (+! s2-0 1) + (label cfg-30) + (b! (< s2-0 (the-as int s4-0)) cfg-4) + (dotimes (v1-56 (the-as int s4-0)) + (set! (-> gp-0 channel v1-56 frame-interp 0) (fmax 0.0 (fmin 1.0 (-> gp-0 channel v1-56 frame-interp 0)))) + (set! (-> gp-0 channel v1-56 frame-interp 1) (fmax 0.0 (fmin 1.0 (-> gp-0 channel v1-56 frame-interp 1)))) + ) + (if (or (zero? s4-0) (or (not (-> gp-0 root-channel 0 frame-group)) (zero? (-> gp-0 active-channels)))) + (logior! (-> obj draw status) (draw-control-status no-draw-temp)) + ) + (if (logtest? (-> obj skel status) (joint-control-status blend-shape blend-shape-valid)) + (merc-blend-shape obj) + ) + (if (logtest? (-> obj skel status) (joint-control-status eye-anim-valid eye-anim)) + (merc-eye-anim obj) + ) + (label cfg-45) + (let ((a0-26 (-> gp-0 effect))) + (if a0-26 + (update-effects a0-26) + ) + ) ) + 0 + (none) ) ;; WARN: Function ja-post has a return type of none, but the expression builder found a return statement. @@ -1455,33 +1448,31 @@ (arg5 float) (arg6 symbol) ) - (with-pp - (when (!= (-> obj interp) 0.0) - (let ((v1-1 obj)) - (set! (-> v1-1 frame-targ) arg0) - (set! (-> v1-1 frame-speed) arg4) - (set! (-> v1-1 frame-start) (/ arg1 (-> arg0 artist-step))) - (set! (-> v1-1 frame-blend) (if (zero? arg2) - 0.0 - (/ 5.0 (+ 5.0 (the float arg2))) - ) - ) - (set! (-> v1-1 frame-post-blend) (if (zero? arg3) - 0.0 - (/ 5.0 (+ 5.0 (the float arg3))) - ) - ) - (set! (-> v1-1 frame-post-end) (/ arg5 (-> arg0 artist-step))) - (set! (-> v1-1 frame-push-time) (-> pp clock frame-counter)) - (set! (-> v1-1 frame-post-put-away) #f) - ) - (if arg6 - (sound-play-by-spec (the-as sound-spec arg6) (new-sound-id) (the-as vector #t)) - ) + (when (!= (-> obj interp) 0.0) + (let ((v1-1 obj)) + (set! (-> v1-1 frame-targ) arg0) + (set! (-> v1-1 frame-speed) arg4) + (set! (-> v1-1 frame-start) (/ arg1 (-> arg0 artist-step))) + (set! (-> v1-1 frame-blend) (if (zero? arg2) + 0.0 + (/ 5.0 (+ 5.0 (the float arg2))) + ) + ) + (set! (-> v1-1 frame-post-blend) (if (zero? arg3) + 0.0 + (/ 5.0 (+ 5.0 (the float arg3))) + ) + ) + (set! (-> v1-1 frame-post-end) (/ arg5 (-> arg0 artist-step))) + (set! (-> v1-1 frame-push-time) (current-time)) + (set! (-> v1-1 frame-post-put-away) #f) ) - 0 - (none) + (if arg6 + (sound-play-by-spec (the-as sound-spec arg6) (new-sound-id) (the-as vector #t)) + ) ) + 0 + (none) ) (defmethod update top-anim-joint-control ((obj top-anim-joint-control)) @@ -1491,230 +1482,228 @@ (the-as process-drawable (-> v1-0 0 self)) ) ) + (s3-0 (get-channel obj 1)) + (s5-0 (get-channel obj 0)) + (s4-0 (-> obj base-anim)) ) - (let ((s3-0 (get-channel obj 1)) - (s5-0 (get-channel obj 0)) - (s4-0 (-> obj base-anim)) - ) - (set! (-> obj frame-group-push) #f) - (cond - ((= (-> obj interp) 0.0) - (when s5-0 - (seek! (-> s5-0 frame-interp 1) 0.0 (* 8.0 (-> pp clock seconds-per-frame))) - (if s3-0 - (set! (-> s3-0 frame-interp 1) (fmin (-> s3-0 frame-interp 1) (-> s5-0 frame-interp 1))) - ) - (when (= (-> s5-0 frame-interp 1) 0.0) - (set! (-> obj frame-post-put-away) #f) - (when (= (-> obj interp) 0.0) - (joint-channel-float-delete! s5-0) - (set! (-> obj frame-group) #f) - (set! (-> obj frame-num) 0.0) - (set! (-> pp skel generate-frame-function) create-interpolated-joint-animation-frame) - ) - (when s3-0 - (joint-channel-float-delete! s3-0) - (set! (-> obj frame-group-push) #f) - ) + (set! (-> obj frame-group-push) #f) + (cond + ((= (-> obj interp) 0.0) + (when s5-0 + (seek! (-> s5-0 frame-interp 1) 0.0 (* 8.0 (-> pp clock seconds-per-frame))) + (if s3-0 + (set! (-> s3-0 frame-interp 1) (fmin (-> s3-0 frame-interp 1) (-> s5-0 frame-interp 1))) + ) + (when (= (-> s5-0 frame-interp 1) 0.0) + (set! (-> obj frame-post-put-away) #f) + (when (= (-> obj interp) 0.0) + (joint-channel-float-delete! s5-0) + (set! (-> obj frame-group) #f) + (set! (-> obj frame-num) 0.0) + (set! (-> pp skel generate-frame-function) create-interpolated-joint-animation-frame) + ) + (when s3-0 + (joint-channel-float-delete! s3-0) + (set! (-> obj frame-group-push) #f) ) ) ) - (else - (when (or (not s5-0) - (or (and (-> obj frame-targ) - (and (!= (-> obj frame-blend) 0.0) - (or (!= (-> s5-0 frame-group) (-> obj frame-targ)) (< (-> obj update-time) (-> obj frame-push-time))) - ) - ) - (and (not (-> obj frame-targ)) - (!= (-> s5-0 frame-group) s4-0) - (set! (-> obj frame-blend) (-> obj frame-post-blend)) - ) - ) + ) + (else + (when (or (not s5-0) + (or (and (-> obj frame-targ) + (and (!= (-> obj frame-blend) 0.0) + (or (!= (-> s5-0 frame-group) (-> obj frame-targ)) (< (-> obj update-time) (-> obj frame-push-time))) + ) + ) + (and (not (-> obj frame-targ)) + (!= (-> s5-0 frame-group) s4-0) + (set! (-> obj frame-blend) (-> obj frame-post-blend)) + ) + ) + ) + (when s3-0 + (joint-channel-float-delete! s3-0) + (set! (-> obj frame-group-push) #f) + (set! s5-0 (get-channel obj 0)) + (set! (-> s5-0 frame-interp 1) (-> obj interp)) + ) + (set! (-> pp skel generate-frame-function) create-interpolated2-joint-animation-frame) + (let ((s2-0 (the-as basic (-> obj frame-targ)))) + (set! s2-0 (cond + ((the-as art-joint-anim s2-0) + (empty) + s2-0 + ) + (else + s4-0 + ) + ) + ) + (set! s3-0 s5-0) + (if s3-0 + (set! (-> obj frame-group-push) (-> s3-0 frame-group)) + ) + (cond + ((= s4-0 s2-0) + (let ((v1-30 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) + (set! s5-0 (when v1-30 + (set! (-> v1-30 param 0) 1.0) + (set! (-> v1-30 num-func) num-func-loop!) + v1-30 + ) + ) + ) + (when s5-0 + (set! (-> s5-0 frame-num) (-> obj frame-start)) + (set! (-> obj base-anim-speed) 1.0) + (set! (-> obj base-anim-blend) 0.1333333) + ) + ) + ((>= (-> obj frame-speed) 0.0) + (let ((v1-35 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) + (set! s5-0 + (when v1-35 + (set! (-> v1-35 param 0) + (- (the float (+ (-> (the-as art-joint-anim s2-0) frames num-frames) -1)) (-> obj frame-post-end)) + ) + (set! (-> v1-35 param 1) (-> obj frame-speed)) + (set! (-> v1-35 num-func) num-func-seek!) + v1-35 + ) + ) + ) + (if s5-0 + (set! (-> s5-0 frame-num) (-> obj frame-start)) + ) + ) + (else + (when s5-0 + (let ((v1-39 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) + (set! s5-0 (when v1-39 + (set! (-> v1-39 param 0) 0.0) + (set! (-> v1-39 param 1) (fabs (-> obj frame-speed))) + (set! (-> v1-39 num-func) num-func-seek!) + v1-39 + ) + ) ) - (when s3-0 + (when s5-0 + (set! (-> s5-0 frame-num) (- (the float (+ (-> s5-0 frame-group frames num-frames) -1)) (-> obj frame-start))) + (set! (-> obj base-anim-speed) 1.0) + (set! (-> obj base-anim-blend) 0.1333333) + ) + ) + ) + ) + ) + (when s5-0 + (set! (-> obj frame-group) (-> s5-0 frame-group)) + (set! (-> obj frame-num) (-> s5-0 frame-num)) + (set! (-> obj frame-cur-blend) (-> obj frame-blend)) + ) + ) + (when s5-0 + (set! (-> pp skel interp-select 0) (the-as int (-> obj interp-select 0))) + (set! (-> pp skel interp-select 1) (the-as int (-> obj interp-select 1))) + (let ((f0-35 (cond + ((not (-> obj frame-targ)) + (-> obj base-anim-blend) + ) + (s3-0 + (-> obj frame-cur-blend) + ) + (else + 0.1333333 + ) + ) + ) + ) + (if (= f0-35 0.0) + (set! (-> s5-0 frame-interp 1) (-> obj interp)) + (seek! (-> s5-0 frame-interp 1) (-> obj interp) (* f0-35 (-> pp clock time-adjust-ratio))) + ) + ) + (when s3-0 + (set! (-> obj frame-group-push) (-> s3-0 frame-group)) + (set! (-> s3-0 frame-interp 1) (-> obj interp)) + (if (!= (-> s3-0 eval-time) (current-time)) + (joint-control-channel-eval s3-0) + ) + (when (= (-> s5-0 frame-interp 1) (-> obj interp)) (joint-channel-float-delete! s3-0) (set! (-> obj frame-group-push) #f) (set! s5-0 (get-channel obj 0)) (set! (-> s5-0 frame-interp 1) (-> obj interp)) ) - (set! (-> pp skel generate-frame-function) create-interpolated2-joint-animation-frame) - (let ((s2-0 (the-as basic (-> obj frame-targ)))) - (set! s2-0 (cond - ((the-as art-joint-anim s2-0) - (empty) - s2-0 - ) - (else - s4-0 - ) - ) - ) - (set! s3-0 s5-0) - (if s3-0 - (set! (-> obj frame-group-push) (-> s3-0 frame-group)) - ) - (cond - ((= s4-0 s2-0) - (let ((v1-30 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) - (set! s5-0 (when v1-30 - (set! (-> v1-30 param 0) 1.0) - (set! (-> v1-30 num-func) num-func-loop!) - v1-30 - ) - ) - ) - (when s5-0 - (set! (-> s5-0 frame-num) (-> obj frame-start)) - (set! (-> obj base-anim-speed) 1.0) - (set! (-> obj base-anim-blend) 0.1333333) - ) - ) - ((>= (-> obj frame-speed) 0.0) - (let ((v1-35 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) - (set! s5-0 - (when v1-35 - (set! (-> v1-35 param 0) - (- (the float (+ (-> (the-as art-joint-anim s2-0) frames num-frames) -1)) (-> obj frame-post-end)) - ) - (set! (-> v1-35 param 1) (-> obj frame-speed)) - (set! (-> v1-35 num-func) num-func-seek!) - v1-35 - ) - ) - ) - (if s5-0 - (set! (-> s5-0 frame-num) (-> obj frame-start)) - ) - ) - (else - (when s5-0 - (let ((v1-39 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) - (set! s5-0 (when v1-39 - (set! (-> v1-39 param 0) 0.0) - (set! (-> v1-39 param 1) (fabs (-> obj frame-speed))) - (set! (-> v1-39 num-func) num-func-seek!) - v1-39 - ) - ) - ) - (when s5-0 - (set! (-> s5-0 frame-num) (- (the float (+ (-> s5-0 frame-group frames num-frames) -1)) (-> obj frame-start))) - (set! (-> obj base-anim-speed) 1.0) - (set! (-> obj base-anim-blend) 0.1333333) - ) - ) - ) - ) - ) - (when s5-0 - (set! (-> obj frame-group) (-> s5-0 frame-group)) - (set! (-> obj frame-num) (-> s5-0 frame-num)) - (set! (-> obj frame-cur-blend) (-> obj frame-blend)) - ) ) - (when s5-0 - (set! (-> pp skel interp-select 0) (the-as int (-> obj interp-select 0))) - (set! (-> pp skel interp-select 1) (the-as int (-> obj interp-select 1))) - (let ((f0-35 (cond - ((not (-> obj frame-targ)) - (-> obj base-anim-blend) - ) - (s3-0 - (-> obj frame-cur-blend) - ) - (else - 0.1333333 - ) - ) - ) - ) - (if (= f0-35 0.0) - (set! (-> s5-0 frame-interp 1) (-> obj interp)) - (seek! (-> s5-0 frame-interp 1) (-> obj interp) (* f0-35 (-> pp clock time-adjust-ratio))) - ) - ) - (when s3-0 - (set! (-> obj frame-group-push) (-> s3-0 frame-group)) - (set! (-> s3-0 frame-interp 1) (-> obj interp)) - (if (!= (-> s3-0 eval-time) (-> pp clock frame-counter)) - (joint-control-channel-eval s3-0) - ) - (when (= (-> s5-0 frame-interp 1) (-> obj interp)) - (joint-channel-float-delete! s3-0) - (set! (-> obj frame-group-push) #f) - (set! s5-0 (get-channel obj 0)) - (set! (-> s5-0 frame-interp 1) (-> obj interp)) - ) - ) - (let ((v1-70 (-> obj frame-targ))) - (cond - (v1-70 - (cond - ((= (-> s5-0 frame-group) v1-70) - (if (!= (-> s5-0 eval-time) (-> pp clock frame-counter)) - (joint-control-channel-eval s5-0) - ) - (when (= (-> s5-0 frame-num) (-> s5-0 param 0)) - (set! (-> obj frame-targ) #f) - (set! (-> obj frame-start) 0.0) - (cond - ((-> obj frame-post-put-away) - (set! (-> obj interp) 0.0) - (set! (-> obj frame-post-put-away) #f) - ) - ((!= (-> obj frame-post-blend) 0.0) - (set! (-> s5-0 param 0) (the float (+ (-> s5-0 frame-group frames num-frames) -1))) - ) - (else - (set! (-> s5-0 frame-num) 0.0) - (set! (-> s5-0 frame-group) (the-as art-joint-anim s4-0)) - (set! (-> s5-0 num-func) num-func-loop!) - (set! (-> s5-0 param 0) 1.0) - ) + (let ((v1-70 (-> obj frame-targ))) + (cond + (v1-70 + (cond + ((= (-> s5-0 frame-group) v1-70) + (if (!= (-> s5-0 eval-time) (current-time)) + (joint-control-channel-eval s5-0) + ) + (when (= (-> s5-0 frame-num) (-> s5-0 param 0)) + (set! (-> obj frame-targ) #f) + (set! (-> obj frame-start) 0.0) + (cond + ((-> obj frame-post-put-away) + (set! (-> obj interp) 0.0) + (set! (-> obj frame-post-put-away) #f) + ) + ((!= (-> obj frame-post-blend) 0.0) + (set! (-> s5-0 param 0) (the float (+ (-> s5-0 frame-group frames num-frames) -1))) + ) + (else + (set! (-> s5-0 frame-num) 0.0) + (set! (-> s5-0 frame-group) (the-as art-joint-anim s4-0)) + (set! (-> s5-0 num-func) num-func-loop!) + (set! (-> s5-0 param 0) 1.0) ) ) ) - (else - (set! (-> s5-0 eval-time) (the-as uint (-> pp clock frame-counter))) - (set! (-> s5-0 frame-group) v1-70) - (set! (-> s5-0 frame-num) (if (< (-> obj frame-speed) 0.0) - (- (the float (+ (-> v1-70 frames num-frames) -1)) (-> obj frame-start)) - (set! (-> s5-0 frame-num) (-> obj frame-start)) - ) - ) - (set! (-> s5-0 num-func) num-func-seek!) - (if (>= (-> obj frame-speed) 0.0) - (set! (-> s5-0 param 0) - (- (the float (+ (-> s5-0 frame-group frames num-frames) -1)) (-> obj frame-post-end)) - ) - (set! (-> s5-0 param 0) 0.0) + ) + (else + (set! (-> s5-0 eval-time) (the-as uint (current-time))) + (set! (-> s5-0 frame-group) v1-70) + (set! (-> s5-0 frame-num) (if (< (-> obj frame-speed) 0.0) + (- (the float (+ (-> v1-70 frames num-frames) -1)) (-> obj frame-start)) + (set! (-> s5-0 frame-num) (-> obj frame-start)) + ) ) - (set! (-> s5-0 param 1) (fabs (-> obj frame-speed))) - ) + (set! (-> s5-0 num-func) num-func-seek!) + (if (>= (-> obj frame-speed) 0.0) + (set! (-> s5-0 param 0) + (- (the float (+ (-> s5-0 frame-group frames num-frames) -1)) (-> obj frame-post-end)) + ) + (set! (-> s5-0 param 0) 0.0) + ) + (set! (-> s5-0 param 1) (fabs (-> obj frame-speed))) ) ) - (else - (when (!= (-> s5-0 frame-group) s4-0) - (set! (-> s5-0 frame-num) 0.0) - (set! (-> obj base-anim-speed) 1.0) - (set! (-> obj base-anim-blend) 0.1333333) - ) - (set! (-> s5-0 frame-group) (the-as art-joint-anim s4-0)) - (set! (-> s5-0 num-func) num-func-loop!) - (set! (-> s5-0 param 0) (-> obj base-anim-speed)) - (set! (-> obj frame-post-blend) 0.1333333) - ) + ) + (else + (when (!= (-> s5-0 frame-group) s4-0) + (set! (-> s5-0 frame-num) 0.0) + (set! (-> obj base-anim-speed) 1.0) + (set! (-> obj base-anim-blend) 0.1333333) + ) + (set! (-> s5-0 frame-group) (the-as art-joint-anim s4-0)) + (set! (-> s5-0 num-func) num-func-loop!) + (set! (-> s5-0 param 0) (-> obj base-anim-speed)) + (set! (-> obj frame-post-blend) 0.1333333) ) ) - (set! (-> obj frame-group) (-> s5-0 frame-group)) - (set! (-> obj frame-num) (-> s5-0 frame-num)) ) + (set! (-> obj frame-group) (-> s5-0 frame-group)) + (set! (-> obj frame-num) (-> s5-0 frame-num)) ) ) ) - (set! (-> obj update-time) (-> pp clock frame-counter)) ) + (set! (-> obj update-time) (current-time)) 0 (none) ) @@ -1791,7 +1780,7 @@ (while (and *target* (focus-test? *target* in-air)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (process-grab? *target* #f) (while (or (-> *setting-control* user-current talking) (-> *setting-control* user-current spooling) @@ -1800,7 +1789,7 @@ ) (suspend) ) - (while (< (- (-> self clock frame-counter) (-> self state-time)) arg0) + (while (< (- (current-time) (-> self state-time)) arg0) (suspend) ) (process-release? *target*) diff --git a/goal_src/jak2/engine/process-drawable/process-taskable.gc b/goal_src/jak2/engine/process-drawable/process-taskable.gc index f974b8a40d..9176520a54 100644 --- a/goal_src/jak2/engine/process-drawable/process-taskable.gc +++ b/goal_src/jak2/engine/process-drawable/process-taskable.gc @@ -78,7 +78,7 @@ Seen take in - `true-func` which takes no args TODO - seems fishy :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (the-as object (case event-type (('say) - (let ((v0-0 (-> self clock frame-counter))) + (let ((v0-0 (current-time))) (set! (-> self want-to-say) v0-0) v0-0 ) @@ -87,7 +87,7 @@ Seen take in - `true-func` which takes no args TODO - seems fishy ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self draw status) (draw-control-status no-draw-bounds)) (let ((v1-6 (-> self root-override root-prim))) (set! (-> v1-6 prim-core collide-as) (collide-spec)) @@ -108,7 +108,7 @@ Seen take in - `true-func` which takes no args TODO - seems fishy (let ((v1-1 (get-current-task-event (-> self task)))) (if (and (nonzero? (-> v1-1 action)) (or (not (logtest? (-> self draw status) (draw-control-status on-screen))) (logtest? (-> v1-1 flags) (game-task-flags gatflag-01)) - (< (- (-> self clock frame-counter) (-> self birth-time)) (seconds 0.1)) + (< (- (current-time) (-> self birth-time)) (seconds 0.1)) ) ) (go-virtual idle) @@ -156,7 +156,7 @@ Seen take in - `true-func` which takes no args TODO - seems fishy ) ) (('say) - (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (let ((v0-0 (the-as object (current-time)))) (set! (-> self want-to-say) (the-as time-frame v0-0)) v0-0 ) @@ -164,7 +164,7 @@ Seen take in - `true-func` which takes no args TODO - seems fishy ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -221,7 +221,7 @@ Seen take in - `true-func` which takes no args TODO - seems fishy (< (vector-vector-distance (target-pos 0) s5-0) f30-0)) ) ) - (< (- (-> self clock frame-counter) (-> self want-to-say)) (seconds 4)) + (< (- (current-time) (-> self want-to-say)) (seconds 4)) ) (or (not (load-in-progress? *level*)) (= (-> gp-0 action) (game-task-action say))) (and (not (movie?)) @@ -241,9 +241,7 @@ Seen take in - `true-func` which takes no args TODO - seems fishy ) (process-taskable-method-34 self) ) - (when (or (= (-> gp-0 action) (game-task-action say)) - (< (- (-> self clock frame-counter) (-> self want-to-say)) (seconds 4)) - ) + (when (or (= (-> gp-0 action) (game-task-action say)) (< (- (current-time) (-> self want-to-say)) (seconds 4))) (case (-> gp-0 action) (((game-task-action play)) (go-virtual play-game gp-0) @@ -320,7 +318,7 @@ Seen take in - `true-func` which takes no args TODO - seems fishy ) :exit (behavior () (set! (-> self last-talk) (-> *display* game-clock frame-counter)) - (if (< (- (-> self clock frame-counter) (-> self want-to-say)) (seconds 4)) + (if (< (- (current-time) (-> self want-to-say)) (seconds 4)) (set! (-> self will-talk) #t) (set! (-> self will-talk) #f) ) @@ -360,8 +358,8 @@ Seen take in - `true-func` which takes no args TODO - seems fishy :enter (-> (method-of-type process-taskable active) enter) :exit (-> (method-of-type process-taskable active) exit) :code (behavior ((arg0 game-task-event)) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.5)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.5)) (suspend) ) ) diff --git a/goal_src/jak2/engine/scene/scene.gc b/goal_src/jak2/engine/scene/scene.gc index a13372c9e7..caa7cd124a 100644 --- a/goal_src/jak2/engine/scene/scene.gc +++ b/goal_src/jak2/engine/scene/scene.gc @@ -756,7 +756,7 @@ (defstate wait (scene-player) :virtual #t :enter (behavior ((arg0 symbol)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (when (or (-> self scene) (-> self preload-continue)) (let ((gp-0 (scene-decode-continue (the-as basic (if (-> self scene) (-> self scene load-point-obj) @@ -847,12 +847,12 @@ (and (-> *target* next-state) (= (-> *target* next-state name) 'target-flop-hit-ground)) ) (-> self scene) - (< (- (-> self clock frame-counter) (-> self state-time)) (-> self scene wait-air-time)) + (< (- (current-time) (-> self state-time)) (-> self scene wait-air-time)) ) (suspend) ) (suspend) - (let ((s5-0 (-> self clock frame-counter))) + (let ((s5-0 (current-time))) (when (and *target* (not (logtest? (-> *target* focus-status) (focus-status grabbed)))) (label cfg-44) (when (not (process-grab? *target* #f)) @@ -885,11 +885,10 @@ ) ) (when arg0 - (while (and (-> self scene) - (not (or (>= (- (-> self clock frame-counter) s5-0) (-> self scene wait-ground-time)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self scene wait-max-time)) - ) - ) + (while (and (-> self scene) (not (or (>= (- (current-time) s5-0) (-> self scene wait-ground-time)) + (>= (- (current-time) (-> self state-time)) (-> self scene wait-max-time)) + ) + ) ) (suspend) ) @@ -987,8 +986,8 @@ (* 30.0 (-> self clock seconds-per-frame)) (bucket-id screen-filter) ) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.05)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.05)) (suspend) ) ) @@ -1152,7 +1151,7 @@ (suspend) (scene-player-method-25 self 0.0) (set! (-> self cur-speed) 0.0) - (set! (-> self scene-start-time) (-> self clock frame-counter)) + (set! (-> self scene-start-time) (current-time)) (ja-play-spooled-anim (-> self anim) (the-as art-joint-anim #f) @@ -1325,10 +1324,10 @@ ) (when (cpad-pressed? 0 square) (set! (-> *setting-control* user-default subtitle) (not (-> *setting-control* user-default subtitle))) - (set! (-> self subtitle-change-time) (-> self clock frame-counter)) + (set! (-> self subtitle-change-time) (current-time)) ) - (when (and (< (- (-> self clock frame-counter) (-> self subtitle-change-time)) (seconds 2)) - (< (mod (- (-> self clock frame-counter) (-> self subtitle-change-time)) 300) 210) + (when (and (< (- (current-time) (-> self subtitle-change-time)) (seconds 2)) + (< (mod (- (current-time) (-> self subtitle-change-time)) 300) 210) ) (let ((gp-6 (new 'stack 'font-context *font-default-matrix* 36 60 0.0 (font-color default) (font-flags shadow kerning)) @@ -1370,31 +1369,31 @@ (cond ((cpad-hold? 0 r1) (if (cpad-pressed? 0 circle) - (set! (-> self speed-press-time) (-> self clock frame-counter)) + (set! (-> self speed-press-time) (current-time)) ) (seek! (-> self speed-change-speed) 8.0 - (* (lerp-scale 0.01 0.3 (the float (- (-> self clock frame-counter) (-> self speed-press-time))) 0.0 300.0) + (* (lerp-scale 0.01 0.3 (the float (- (current-time) (-> self speed-press-time))) 0.0 300.0) (-> self clock time-adjust-ratio) ) ) ) ((cpad-hold? 0 l1) (if (cpad-pressed? 0 square) - (set! (-> self speed-press-time) (-> self clock frame-counter)) + (set! (-> self speed-press-time) (current-time)) ) (seek! (-> self speed-change-speed) -8.0 - (* (lerp-scale 0.01 0.3 (the float (- (-> self clock frame-counter) (-> self speed-press-time))) 0.0 300.0) + (* (lerp-scale 0.01 0.3 (the float (- (current-time) (-> self speed-press-time))) 0.0 300.0) (-> self clock time-adjust-ratio) ) ) ) ((cpad-hold? 0 x) (when (cpad-pressed? 0 x) - (set! (-> self speed-press-time) (-> self clock frame-counter)) + (set! (-> self speed-press-time) (current-time)) (cond ((= (-> self cur-speed) 0.0) (set! (-> self speed-change-speed) -1000.0) @@ -1427,12 +1426,12 @@ ) (set! (-> self targ-speed) 0.0) (set! (-> self cur-speed) 0.0) - (set! (-> self speed-change-time) (-> self clock frame-counter)) + (set! (-> self speed-change-time) (current-time)) ) ) ((= (-> self speed-change-speed) -1000.0) (when (!= (-> self cur-speed) -1000.0) - (set! (-> self speed-change-time) (-> self clock frame-counter)) + (set! (-> self speed-change-time) (current-time)) (set! (-> self targ-speed) -1000.0) (set! (-> self cur-speed) -1000.0) (sound-pause (-> gp-7 id)) @@ -1445,7 +1444,7 @@ (fmin 10.0 (+ (-> self targ-speed) (* (-> self speed-change-speed) (-> self clock seconds-per-frame)))) ) ) - (if (< (- (-> self clock frame-counter) (-> self speed-change-time)) (seconds 3)) + (if (< (- (current-time) (-> self speed-change-time)) (seconds 3)) (format *stdcon* "id ~d speed ~f~%" @@ -1457,8 +1456,8 @@ ) ) (when (and gp-7 (and (!= (-> self targ-speed) (-> self cur-speed)) - (< (-> self speed-change-time) (-> self clock frame-counter)) - (>= (- (-> self clock frame-counter) (-> self scene-start-time)) (seconds 1)) + (< (-> self speed-change-time) (current-time)) + (>= (- (current-time) (-> self scene-start-time)) (seconds 1)) ) ) (when *sound-player-enable* @@ -1471,7 +1470,7 @@ ) ) (set! (-> self cur-speed) (-> self targ-speed)) - (set! (-> self speed-change-time) (-> self clock frame-counter)) + (set! (-> self speed-change-time) (current-time)) ) ) ) diff --git a/goal_src/jak2/engine/sound/gsound.gc b/goal_src/jak2/engine/sound/gsound.gc index 4f784a41eb..5968476bdc 100644 --- a/goal_src/jak2/engine/sound/gsound.gc +++ b/goal_src/jak2/engine/sound/gsound.gc @@ -672,10 +672,10 @@ otherwise, an explicit [[vector]] can be provided" ) (cond ((-> obj spec) - (when (or (< (-> obj time-base) 0) (>= (-> pp clock frame-counter) (-> obj play-time))) + (when (or (< (-> obj time-base) 0) (>= (current-time) (-> obj play-time))) (when (>= (-> obj time-base) 0) (set! (-> obj play-time) - (+ (-> pp clock frame-counter) (-> obj time-base) (rand-vu-int-count (the-as int (-> obj time-random)))) + (+ (current-time) (-> obj time-base) (rand-vu-int-count (the-as int (-> obj time-random)))) ) (set! (-> obj playing-id) (new-sound-id)) ) @@ -697,7 +697,7 @@ otherwise, an explicit [[vector]] can be provided" ) ) (when (and *debug-effect-control* (>= (-> obj time-base) 0)) - (format #t "(~5D) effect sound ~A ~G " (-> pp clock frame-counter) (-> pp name) (&-> s5-1 sound-name)) + (format #t "(~5D) effect sound ~A ~G " (current-time) (-> pp name) (&-> s5-1 sound-name)) (format #t "volume: ~f pitch-mod: ~f~%" @@ -731,7 +731,7 @@ otherwise, an explicit [[vector]] can be provided" ) ) (else - (when (>= (-> pp clock frame-counter) (-> obj play-time)) + (when (>= (current-time) (-> obj play-time)) (set! (-> obj playing-id) (sound-play-by-name (-> obj name) @@ -744,7 +744,7 @@ otherwise, an explicit [[vector]] can be provided" ) ) (set! (-> obj play-time) - (+ (-> pp clock frame-counter) (-> obj time-base) (rand-vu-int-count (the-as int (-> obj time-random)))) + (+ (current-time) (-> obj time-base) (rand-vu-int-count (the-as int (-> obj time-random)))) ) ) ) @@ -984,32 +984,31 @@ otherwise, an explicit [[vector]] can be provided" (defun sound-bank-reload () (process-spawn-function process - (lambda () (with-pp - (let ((gp-0 (new 'static 'boxed-array :type symbol :length 0 :allocated-length 3))) - (dotimes (v1-0 3) - (set! (-> gp-0 v1-0) (the-as symbol (-> *level* sound-bank v1-0))) - ) - (let ((a1-3 (new 'stack-no-clear 'array 'symbol 4))) - (set! (-> a1-3 2) 'empty2) - (set! (-> a1-3 1) 'empty1) - (set! (-> a1-3 0) 'empty0) - (want-sound-banks *load-state* a1-3) - ) - (let ((s5-0 (-> pp clock frame-counter))) - (until (>= (- (-> pp clock frame-counter) s5-0) (seconds 1)) - (suspend) - ) - ) - (let ((a1-4 (new 'stack-no-clear 'array 'symbol 4))) - (set! (-> a1-4 2) (-> gp-0 2)) - (set! (-> a1-4 1) (-> gp-0 1)) - (set! (-> a1-4 0) (-> gp-0 0)) - (want-sound-banks *load-state* a1-4) - ) - ) - (none) - ) + (lambda () + (let ((gp-0 (new 'static 'boxed-array :type symbol :length 0 :allocated-length 3))) + (dotimes (v1-0 3) + (set! (-> gp-0 v1-0) (the-as symbol (-> *level* sound-bank v1-0))) + ) + (let ((a1-3 (new 'stack-no-clear 'array 'symbol 4))) + (set! (-> a1-3 2) 'empty2) + (set! (-> a1-3 1) 'empty1) + (set! (-> a1-3 0) 'empty0) + (want-sound-banks *load-state* a1-3) + ) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) (seconds 1)) + (suspend) ) + ) + (let ((a1-4 (new 'stack-no-clear 'array 'symbol 4))) + (set! (-> a1-4 2) (-> gp-0 2)) + (set! (-> a1-4 1) (-> gp-0 1)) + (set! (-> a1-4 0) (-> gp-0 0)) + (want-sound-banks *load-state* a1-4) + ) + ) + (none) + ) :to *display-pool* ) 0 diff --git a/goal_src/jak2/engine/sound/speech.gc b/goal_src/jak2/engine/sound/speech.gc index 573de5faa5..d9bc46bfd7 100644 --- a/goal_src/jak2/engine/sound/speech.gc +++ b/goal_src/jak2/engine/sound/speech.gc @@ -55,10 +55,10 @@ (let ((s4-0 (handle->process (-> obj request handle)))) (when s4-0 (when (or (and (>= (-> obj request priority) 0.0) - (>= (- (-> pp clock frame-counter) (-> obj end-time)) (the-as time-frame (-> s5-1 delay))) + (>= (- (current-time) (-> obj end-time)) (the-as time-frame (-> s5-1 delay))) ) - (and (>= (- (-> pp clock frame-counter) (-> obj end-time)) (the-as time-frame (-> s5-1 delay))) - (>= (- (-> pp clock frame-counter) (-> obj end-time)) (the-as time-frame (-> obj delay))) + (and (>= (- (current-time) (-> obj end-time)) (the-as time-frame (-> s5-1 delay))) + (>= (- (current-time) (-> obj end-time)) (the-as time-frame (-> obj delay))) ) ) (let ((s3-0 (-> s5-1 list length)) @@ -85,7 +85,7 @@ (set! (-> s5-1 play-index) v1-44) (let ((s3-1 (-> s5-1 list v1-44))) (mem-copy! (the-as pointer (-> obj last-request)) (the-as pointer (-> obj request)) 21) - (set! (-> obj start-time) (-> pp clock frame-counter)) + (set! (-> obj start-time) (current-time)) (set! (-> obj delay) (the-as uint (rand-vu-int-range (the-as int (-> s5-1 min-delay)) (the-as int (-> s5-1 max-delay)))) ) @@ -106,7 +106,7 @@ ) ) ) - (set! (-> obj update-time) (-> pp clock frame-counter)) + (set! (-> obj update-time) (current-time)) (when (nonzero? (-> obj id)) (let ((s4-1 (handle->process (-> obj last-request handle)))) (cond @@ -152,7 +152,7 @@ ) (case (get-status *gui-control* (-> obj id)) (((gui-status pending)) - (when (>= (- (-> pp clock frame-counter) (-> obj start-time)) (seconds 1)) + (when (>= (- (current-time) (-> obj start-time)) (seconds 1)) (set-action! *gui-control* (gui-action stop) @@ -180,27 +180,25 @@ ) (defmethod speech-channel-method-9 speech-channel ((obj speech-channel) (arg0 process-drawable) (arg1 speech-type)) - (with-pp - (let ((f0-0 (vector-vector-distance-squared (-> arg0 root trans) (-> obj 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 (-> obj speech-table arg1 priority)))) - ) - (when (< (-> obj request priority) f0-2) - (set! (-> obj request priority) f0-2) - (set! (-> obj request handle) (process->handle arg0)) - (set! (-> obj request speech-type) arg1) - (set! (-> obj request time) (-> pp clock frame-counter)) - ) + (let ((f0-0 (vector-vector-distance-squared (-> arg0 root trans) (-> obj 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 (-> obj speech-table arg1 priority)))) + ) + (when (< (-> obj request priority) f0-2) + (set! (-> obj request priority) f0-2) + (set! (-> obj request handle) (process->handle arg0)) + (set! (-> obj request speech-type) arg1) + (set! (-> obj request time) (current-time)) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod speech-channel-method-10 speech-channel ((obj speech-channel) (arg0 handle)) diff --git a/goal_src/jak2/engine/target/board/board-h.gc b/goal_src/jak2/engine/target/board/board-h.gc index 89e83f5051..3bb2b4c7a9 100644 --- a/goal_src/jak2/engine/target/board/board-h.gc +++ b/goal_src/jak2/engine/target/board/board-h.gc @@ -265,13 +265,13 @@ (not (logtest? (-> *cpad-list* cpads (-> self control cpad number) button0-abs 0) (pad-buttons l2))) ) (not *pause-lock*) - (>= (- (-> self clock frame-counter) (-> self control time-of-last-debug-heal)) (seconds 0.1)) + (>= (- (current-time) (-> self control time-of-last-debug-heal)) (seconds 0.1)) (>= (-> self control last-time-on-surface) (-> self control time-of-last-debug-float)) ) (-> self board latch?) ) (not (focus-test? self dead hit grabbed in-head edge-grab pole board pilot mech dark)) - (or (zero? (-> self board)) (>= (- (-> self clock frame-counter) (-> self board board-time)) (seconds 0.5))) + (or (zero? (-> self board)) (>= (- (current-time) (-> self board board-time)) (seconds 0.5))) (not (logtest? (state-flags prevent-board) (-> self state-flags))) (< (-> self board board-time) (-> self control list-time-on-ground)) (not (logtest? (surface-flag no-board) (-> self control current-surface flags))) @@ -320,10 +320,7 @@ #f #t ) - (begin - (set! (-> self board latch?) #t) - (>= (- (-> self clock frame-counter) (-> self gun gun-time)) (seconds 0.4)) - ) + (begin (set! (-> self board latch?) #t) (>= (- (current-time) (-> self gun gun-time)) (seconds 0.4))) ) ) ) diff --git a/goal_src/jak2/engine/target/board/board-states.gc b/goal_src/jak2/engine/target/board/board-states.gc index 36f8ddee9e..81864f88d1 100644 --- a/goal_src/jak2/engine/target/board/board-states.gc +++ b/goal_src/jak2/engine/target/board/board-states.gc @@ -90,7 +90,7 @@ ) (when (and (or (< (* f30-0 (-> self board turn-anim-targ)) 0.0) (= f30-0 0.0)) (and (< (* 0.2 (-> *TARGET_BOARD-bank* turn-frames)) (fabs (- f30-0 (-> self board turn-anim-targ)))) - (>= (-> self clock frame-counter) (-> self control turn-lockout-end-time)) + (>= (current-time) (-> self control turn-lockout-end-time)) ) ) (let ((v1-50 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) @@ -107,9 +107,7 @@ ) (set! (-> self board turn-anim-duck-vel) (* 0.98 (-> self board turn-anim-duck-vel))) (+! (-> self board turn-anim-duck-vel) (* -8.0 (-> self clock seconds-per-frame))) - (when (and (board-on-ground?) - (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame02)) (seconds 0.2)) - ) + (when (and (board-on-ground?) (>= (- (current-time) (-> self board unknown-time-frame02)) (seconds 0.2))) (if (logtest? (-> self control status) (collide-status impact-surface)) (+! (-> self board turn-anim-duck-vel) (lerp-scale 0.0 15.0 (-> self control normal-impact-vel) 0.0 81920.0)) ) @@ -128,31 +126,30 @@ (defbehavior target-board-spin-check target () (when (and (or (cpad-pressed? (-> self control cpad number) r1) (and (cpad-hold? (-> self control cpad number) r1) - (>= (- (-> self clock frame-counter) (-> self board spin-check-time)) (seconds 0.3)) + (>= (- (current-time) (-> self board spin-check-time)) (seconds 0.3)) ) ) (not (and (and (-> self next-state) (let ((v1-24 (-> self next-state name))) (or (= v1-24 'target-board-trickx) (= v1-24 'target-board-hold)) ) ) - (< (- (-> self clock frame-counter) (-> self board spin-start-time)) (seconds 0.5)) + (< (- (current-time) (-> self board spin-start-time)) (seconds 0.5)) ) ) (not (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control cpad number) r2))) ) - (set! (-> self board spin-start-time) (-> self clock frame-counter)) + (set! (-> self board spin-start-time) (current-time)) (set! (-> self board spin-start-dir quad) (-> self node-list data 3 bone transform vector 2 quad)) (vector-flatten! (-> self control turn-to-alt-heading) (-> self control c-R-w vector 2) *up-vector*) (vector-normalize! (-> self control turn-to-alt-heading) 1.0) (rot->dir-targ! (-> self control)) - (set! (-> self board trotyv-max) - (lerp-scale - 218453.33 - 91022.22 - (the float (- (-> self clock frame-counter) (-> self control last-time-on-surface))) - 0.0 - 300.0 - ) + (set! (-> self board trotyv-max) (lerp-scale + 218453.33 + 91022.22 + (the float (- (current-time) (-> self control last-time-on-surface))) + 0.0 + 300.0 + ) ) (set! (-> self board trotyv) 0.0) (set! (-> self board troty) 0.0) @@ -164,14 +161,14 @@ (cond ((and (cpad-hold? (-> self control cpad number) r1) (and (or (= (-> self control mod-surface name) 'spin) - (< (- (-> self clock frame-counter) (-> self board spin-time)) (seconds 0.05)) + (< (- (current-time) (-> self board spin-time)) (seconds 0.05)) ) (not (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control cpad number) r2))) ) ) (set! (-> self board turn-anim-tilt?) #f) (set! (-> self control mod-surface) *board-spin-mods*) - (set! (-> self board spin-time) (-> self clock frame-counter)) + (set! (-> self board spin-time) (current-time)) (let ((gp-0 (new 'stack-no-clear 'vector))) (set! (-> gp-0 x) (* -0.0078125 (+ -128.0 (the float (-> self control cpad leftx))))) (set! (-> gp-0 y) 0.0) @@ -217,7 +214,7 @@ (set! (-> self control mod-surface) (the-as surface (-> self board mods-backup))) ) ) - (set! (-> self board spin-check-time) (-> self clock frame-counter)) + (set! (-> self board spin-check-time) (current-time)) (when (and (or (cpad-pressed? (-> self control cpad number) l1) (< (-> self control last-time-on-surface) (-> self board unknown-time-frame06)) ) @@ -225,7 +222,7 @@ ) (set! (-> self board turn-anim-tilt?) #f) (set! (-> self control mod-surface) *board-spin-mods*) - (set! (-> self board unknown-time-frame03) (-> self clock frame-counter)) + (set! (-> self board unknown-time-frame03) (current-time)) (let ((gp-2 (new 'stack-no-clear 'vector))) (set! (-> gp-2 x) (* -0.0078125 (+ -128.0 (the float (-> self control cpad leftx))))) (set! (-> gp-2 y) 0.0) @@ -243,7 +240,7 @@ (< 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (and (>= (target-height-above-ground) 4096.0) (< (seconds 0.165) (target-time-to-ground)) - (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame05)) (seconds 0.05)) + (>= (- (current-time) (-> self board unknown-time-frame05)) (seconds 0.05)) (< (-> self board unknown-time-frame05) (-> self board unknown-time-frame06)) ) ) @@ -267,7 +264,7 @@ (< 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (and (>= (target-height-above-ground) 4096.0) (< (seconds 0.165) (target-time-to-ground)) - (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame05)) (seconds 0.05)) + (>= (- (current-time) (-> self board unknown-time-frame05)) (seconds 0.05)) ) ) ) @@ -335,7 +332,7 @@ ) (set! (-> self board troty-cum) 0.0) (set! (-> self board flip-count) 0) - (if (>= (- (-> self clock frame-counter) (-> self board in-air-time)) (seconds 0.2)) + (if (>= (- (current-time) (-> self board in-air-time)) (seconds 0.2)) (flush-trick-list (-> self board)) ) 0 @@ -350,7 +347,7 @@ (f28-0 (vector-y-angle (-> self control transv))) (f0-2 (y-angle (-> self control))) ) - (if (< (- (-> self clock frame-counter) (-> self board halfpipe-time)) (seconds 0.1)) + (if (< (- (current-time) (-> self board halfpipe-time)) (seconds 0.1)) (set! f28-0 (+ 32768.0 f28-0)) ) (let ((f0-5 (fabs (deg-diff f0-2 f28-0)))) @@ -456,7 +453,7 @@ (< 0.0 (vector-dot (-> self control transv) gp-0)) (and (< (-> self control surface-angle) 0.3) (zero? (-> self board halfpipe-side-time))) ) - (set! (-> self board halfpipe-side-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-side-time) (current-time)) (set! v0-3 (logior (-> self control root-prim prim-core action) (collide-action no-normal-reset))) (set! (-> self control root-prim prim-core action) v0-3) v0-3 @@ -464,11 +461,11 @@ (else (if (and (not (board-on-ground?)) (nonzero? (-> self board halfpipe-side-time)) - (>= (- (-> self clock frame-counter) (-> self board halfpipe-side-time)) (seconds 0.05)) + (>= (- (current-time) (-> self board halfpipe-side-time)) (seconds 0.05)) ) (go target-board-halfpipe) ) - (when (>= (- (-> self clock frame-counter) (-> self board halfpipe-side-time)) (seconds 0.2)) + (when (>= (- (current-time) (-> self board halfpipe-side-time)) (seconds 0.2)) (set! (-> self board halfpipe-side-time) 0) (set! v0-3 (logclear (-> self control root-prim prim-core action) (collide-action no-normal-reset))) (set! (-> self control root-prim prim-core action) v0-3) @@ -480,11 +477,11 @@ ) (defbehavior target-board-jump-trans target () - (when (and (!= (-> self state-time) (-> self clock frame-counter)) (jump-hit-ground-stuck?)) - (set! (-> self board jump-land-time) (-> self clock frame-counter)) + (when (and (!= (-> self state-time) (current-time)) (jump-hit-ground-stuck?)) + (set! (-> self board jump-land-time) (current-time)) (go target-board-hit-ground) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (target-board-smack-surface?) ) (if (and (cpad-pressed? (-> self control cpad number) x) @@ -530,8 +527,8 @@ (< 0.0 (vector-dot (-> self control transv) s5-0)) ) ) - (set! (-> self board halfpipe-lip-time) (-> self clock frame-counter)) - (set! (-> self board halfpipe-side-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-lip-time) (current-time)) + (set! (-> self board halfpipe-side-time) (current-time)) (set! (-> self board halfpipe-lip-event) (the-as symbol (-> event param 0))) (let ((v0-2 (the-as object (logior (-> self control root-prim prim-core action) (collide-action no-normal-reset)))) ) @@ -586,7 +583,7 @@ :trans (behavior () (if (and (cpad-hold? (-> self control cpad number) l1) (not (logtest? (-> self state-flags) (state-flags prevent-duck))) - (< (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (< (- (current-time) (-> self control last-time-on-surface)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) ) @@ -610,7 +607,7 @@ ) (vector-normalize! gp-0 1.0) (cond - ((and (< (- (-> self clock frame-counter) (-> self board halfpipe-jump-time)) (seconds 0.5)) + ((and (< (- (current-time) (-> self board halfpipe-jump-time)) (seconds 0.5)) (= (-> self control ground-pat mode) (pat-mode halfpipe)) ) ) @@ -618,7 +615,7 @@ (< 0.0 (vector-dot (-> self control transv) gp-0)) (< (-> self control surface-angle) 0.5) ) - (set! (-> self board halfpipe-jump-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-jump-time) (current-time)) (vector-float*! (-> self control transv) (-> self control transv) 1.5) ) (else @@ -629,14 +626,14 @@ ) ) (if (cpad-pressed? (-> self control cpad number) r1) - (set! (-> self board spin-ground-press-time) (-> self clock frame-counter)) + (set! (-> self board spin-ground-press-time) (current-time)) ) (if (and (cpad-hold? (-> self control cpad number) r1) (can-feet? #t) - (< (- (-> self clock frame-counter) (-> self board spin-ground-press-time)) (seconds 0.3)) + (< (- (current-time) (-> self board spin-ground-press-time)) (seconds 0.3)) (turn-around?) ) - (set! (-> self board spin-ground-start-time) (-> self clock frame-counter)) + (set! (-> self board spin-ground-start-time) (current-time)) ) (target-board-halfpipe-check) (if (target-board-smack-surface?) @@ -649,7 +646,7 @@ (set! (-> self control mod-surface) *board-walk-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) ) - ((and (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.1)) + ((and (>= (- (current-time) (-> self control last-time-on-surface)) (seconds 0.1)) (or (= (-> self control mod-surface name) 'spin) (< 4096.0 (target-height-above-ground))) ) (set! (-> self control mod-surface) *board-jump-mods*) @@ -780,7 +777,7 @@ :trans (behavior () (if (and (or (not (cpad-hold? (-> self control cpad number) l1)) (logtest? (-> self state-flags) (state-flags prevent-duck)) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> self control last-time-on-surface)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) ) @@ -806,7 +803,7 @@ ) (vector-normalize! gp-0 1.0) (cond - ((and (< (- (-> self clock frame-counter) (-> self board halfpipe-jump-time)) (seconds 0.5)) + ((and (< (- (current-time) (-> self board halfpipe-jump-time)) (seconds 0.5)) (= (-> self control ground-pat mode) (pat-mode halfpipe)) ) ) @@ -814,7 +811,7 @@ (< 0.0 (vector-dot (-> self control transv) gp-0)) (< (-> self control surface-angle) 0.5) ) - (set! (-> self board halfpipe-jump-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-jump-time) (current-time)) (vector-float*! (-> self control transv) (-> self control transv) 1.5) ) (else @@ -834,14 +831,14 @@ ) ) (if (cpad-pressed? (-> self control cpad number) r1) - (set! (-> self board spin-ground-press-time) (-> self clock frame-counter)) + (set! (-> self board spin-ground-press-time) (current-time)) ) (if (and (cpad-hold? (-> self control cpad number) r1) (can-feet? #t) - (< (- (-> self clock frame-counter) (-> self board spin-ground-press-time)) (seconds 0.3)) + (< (- (current-time) (-> self board spin-ground-press-time)) (seconds 0.3)) (turn-around?) ) - (set! (-> self board spin-ground-start-time) (-> self clock frame-counter)) + (set! (-> self board spin-ground-start-time) (current-time)) ) (target-board-halfpipe-check) (if (target-board-smack-surface?) @@ -855,7 +852,7 @@ (set! (-> self control mod-surface) *board-duck-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) ) - ((and (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.1)) + ((and (>= (- (current-time) (-> self control last-time-on-surface)) (seconds 0.1)) (or (= (-> self control mod-surface name) 'spin) (< 4096.0 (target-height-above-ground))) ) (set! (-> self control mod-surface) *board-duck-jump-mods*) @@ -875,7 +872,7 @@ (defstate target-board-jump (target) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (if (and (= event-type 'edge-grab) (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1))) + (if (and (= event-type 'edge-grab) (< (- (current-time) (-> self state-time)) (seconds 0.1))) (return #f) ) (target-board-handler proc arg1 event-type event) @@ -888,7 +885,7 @@ (if (= arg2 'hit) (set! arg2 #f) ) - (when (< (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.5)) + (when (< (- (current-time) (-> self board ride-time)) (seconds 0.5)) (set! arg2 (the-as symbol *board-ride-jump-mods*)) (let ((s2-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> self control transv) 1.0))) (forward-up-nopitch->quaternion @@ -897,19 +894,19 @@ (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) ) (set! (-> self control turn-lockout-end-time) - (+ (-> self clock frame-counter) + (+ (current-time) (the int (lerp-scale 225.0 0.0 (vector-dot s2-0 (-> self control c-R-w vector 2)) -1.0 1.0)) ) ) ) ) (set! (-> self control dynam gravity-length) 245760.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((f30-0 0.0)) (cond ((and (< 0.0 (-> self board shock-offsetv)) - (< (- (-> self clock frame-counter) (-> self board jump-land-time)) (seconds 0.5)) - (>= (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.5)) + (< (- (current-time) (-> self board jump-land-time)) (seconds 0.5)) + (>= (- (current-time) (-> self board ride-time)) (seconds 0.5)) ) (let ((s3-2 (new 'stack-no-clear 'vector))) (set! (-> s3-2 quad) (-> self control trans quad)) @@ -1001,7 +998,7 @@ #t #f (-> self control transv) - (if (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) + (if (>= (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1)) 2.0 0.0 ) @@ -1166,7 +1163,7 @@ ) :enter (behavior () (set! (-> self focus-status) (logior (focus-status halfpipe) (-> self focus-status))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self control root-prim prim-core action) (collide-action no-normal-reset)) (set! (-> self control mod-surface) *board-halfpipe-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) @@ -1242,7 +1239,7 @@ ) :trans (behavior () (when (and (or (= (the-as int (-> self control did-move-to-pole-or-max-jump-height)) #t) - (and (< (- (-> self clock frame-counter) (-> self board halfpipe-lip-time)) (seconds 0.1)) + (and (< (- (current-time) (-> self board halfpipe-lip-time)) (seconds 0.1)) (= (-> self board halfpipe-lip-event) 'lipramp) ) ) @@ -1268,22 +1265,20 @@ ) ) ) - (set! (-> self board halfpipe-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-time) (current-time)) (if (= (-> self control gspot-pat-surfce mode) (pat-mode halfpipe)) - (set! (-> self board halfpipe-gspot-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-gspot-time) (current-time)) ) (when (jump-hit-ground-stuck?) (vector-float*! (-> self control transv) (-> self control transv) 1.5) (go target-board-turn-to (-> self control transv) (seconds 0.5)) ) (when (and (cpad-pressed? (-> self control cpad number) x) - (>= (- (-> self clock frame-counter) (-> self board halfpipe-jump-time)) (seconds 0.6)) - (< (- (-> self clock frame-counter) (-> self state-time)) - (the-as time-frame (-> *TARGET-bank* ground-timeout)) - ) + (>= (- (current-time) (-> self board halfpipe-jump-time)) (seconds 0.6)) + (< (- (current-time) (-> self state-time)) (the-as time-frame (-> *TARGET-bank* ground-timeout))) (< 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) ) - (set! (-> self board halfpipe-jump-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-jump-time) (current-time)) (vector-float*! (-> self control transv) (-> self control transv) 1.5) ) (target-board-spin-check) @@ -1296,7 +1291,7 @@ (set! (-> gp-0 y) 0.0) (vector-normalize! gp-0 1.0) (if (< 0.7 (vector-dot (-> self control to-target-pt-xz) gp-0)) - (+! (-> self control sliding-start-time) (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! (-> self control sliding-start-time) (- (current-time) (-> self clock old-frame-counter))) (set! (-> self control sliding-start-time) 1) ) ) @@ -1313,7 +1308,7 @@ ) ) (when (or (>= (-> self control sliding-start-time) (seconds 0.05)) - (and (>= (- (-> self clock frame-counter) (-> self board halfpipe-gspot-time)) (seconds 0.5)) + (and (>= (- (current-time) (-> self board halfpipe-gspot-time)) (seconds 0.5)) (< (-> self board halfpipe-lip-time) (+ (-> self state-time) (seconds -0.2))) ) ) @@ -1326,7 +1321,7 @@ ) :code (behavior () (cond - ((< (- (-> self clock frame-counter) (-> self board halfpipe-jump-time)) (seconds 0.5)) + ((< (- (current-time) (-> self board halfpipe-jump-time)) (seconds 0.5)) (ja-channel-push! 1 (seconds 0.05)) (ja-no-eval :group! (-> self draw art-group data 155) :num! (seek! (ja-aframe 8.0 0) 0.5) :frame-num 0.0) (until (ja-done? 0) @@ -1444,7 +1439,7 @@ (defstate target-board-jump-kick (target) :event target-board-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *board-jump-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) (sound-play "board-k-jump") @@ -1457,10 +1452,10 @@ ) (target-board-smack-surface?) (cond - ((< (- (-> self clock frame-counter) (-> self board smack-surface-time)) (seconds 0.2)) + ((< (- (current-time) (-> self board smack-surface-time)) (seconds 0.2)) (go target-board-wall-kick (-> self board smack-normal) (-> self board smack-speed)) ) - ((< (- (-> self clock frame-counter) (-> self board glance-time)) (seconds 0.2)) + ((< (- (current-time) (-> self board glance-time)) (seconds 0.2)) (go target-board-wall-kick (vector-normalize-copy! (-> self control unknown-vector38) (-> self board glance-out-transv) 1.0) @@ -1506,7 +1501,7 @@ (* 0.008333334 (- (-> self control dynam gravity-length))) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *board-wall-kick-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) (set! (-> self board smack-surface-time) 0) @@ -1551,7 +1546,7 @@ (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control dir-targ)) ) (set! (-> self control dynam gravity-length) 245760.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (cond ((= arg2 'halfpipe) (set! (-> self focus-status) (logior (focus-status halfpipe) (-> self focus-status))) @@ -1732,8 +1727,8 @@ (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control dir-targ)) ) (set! (-> self control dynam gravity-length) 245760.0) - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self board unknown-time-frame04) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self board unknown-time-frame04) (current-time)) (cond ((= arg2 'halfpipe) (set! (-> self focus-status) (logior (focus-status halfpipe) (-> self focus-status))) @@ -1754,7 +1749,7 @@ ) :exit (behavior () (set! (-> self board unknown-float01) 0.0) - (set! (-> self board unknown-time-frame05) (-> self clock frame-counter)) + (set! (-> self board unknown-time-frame05) (current-time)) (let ((v1-3 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) (set! (-> v1-3 command) (sound-command set-param)) (set! (-> v1-3 id) (-> self board unknown-sound-id01)) @@ -1946,7 +1941,7 @@ (mod-var-jump #t #f (cpad-hold? (-> self control cpad number) x) (-> self control transv)) ) (when (jump-hit-ground-stuck?) - (set! (-> self board jump-land-time) (-> self clock frame-counter)) + (set! (-> self board jump-land-time) (current-time)) (go target-board-hit-ground) ) (set! (-> self board slow-transv quad) (-> self control transv quad)) @@ -2141,7 +2136,7 @@ ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *board-turn-to-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) (set! (-> self control sliding-start-time) arg1) @@ -2151,7 +2146,7 @@ (-> self control unknown-vector38) (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) ) - (set! (-> self control turn-lockout-end-time) (+ (-> self clock frame-counter) arg1)) + (set! (-> self control turn-lockout-end-time) (+ (current-time) arg1)) (none) ) :exit target-board-exit @@ -2168,7 +2163,7 @@ (flush-trick-list (-> self board)) (go target-board-jump (-> *TARGET_BOARD-bank* jump-height-min) (-> *TARGET_BOARD-bank* jump-height-max) #f) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self control sliding-start-time)) + (if (>= (- (current-time) (-> self state-time)) (-> self control sliding-start-time)) (go target-board-stance) ) (target-board-anim-trans) @@ -2193,7 +2188,7 @@ ) (('end-mode) (when (-> event param 0) - (let ((v1-6 (/ (- (-> self clock frame-counter) (-> self board ride-start-time)) 300))) + (let ((v1-6 (/ (- (current-time) (-> self board ride-start-time)) 300))) (if (> v1-6 0) (add-to-trick-list (-> self board) (board-tricks board-rail) (* 100.0 (the float v1-6))) ) @@ -2207,7 +2202,7 @@ ) ) :enter (behavior ((arg0 symbol) (arg1 object) (arg2 object) (arg3 float)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self focus-status) (logior (focus-status rail) (-> self focus-status))) (logior! (-> self control root-prim prim-core action) (collide-action can-ride)) (set! (-> self control mod-surface) *board-ride-mods*) @@ -2316,7 +2311,7 @@ ) (can-jump? 'board) ) - (let ((v1-15 (/ (- (-> self clock frame-counter) (-> self board ride-start-time)) 300))) + (let ((v1-15 (/ (- (current-time) (-> self board ride-start-time)) 300))) (if (> v1-15 0) (add-to-trick-list (-> self board) (board-tricks board-rail) (* 100.0 (the float v1-15))) ) @@ -2333,7 +2328,7 @@ (set! (-> self control unknown-word04) (the-as uint #f)) ) (if (-> self control unknown-spool-anim00) - (set! (-> self board ride-button-time) (-> self clock frame-counter)) + (set! (-> self board ride-button-time) (current-time)) ) (set! (-> self board turn-anim-targ) (* (-> self board ride-lean) (- (-> *TARGET_BOARD-bank* turn-frames)))) (cond @@ -2419,13 +2414,11 @@ (until #f (ja :num-func num-func-identity :frame-num (ja-aframe - (fmax - -5.0 - (fmin 5.0 (+ (* 3.0 (-> self board ride-lean)) - (* 0.5 (sin (* 145.63556 (the float (- (-> self clock frame-counter) (-> self state-time)))))) - ) - ) - ) + (fmax -5.0 (fmin 5.0 (+ (* 3.0 (-> self board ride-lean)) + (* 0.5 (sin (* 145.63556 (the float (- (current-time) (-> self state-time)))))) + ) + ) + ) 0 ) ) @@ -2454,7 +2447,7 @@ :enter (behavior ((arg0 handle)) (set! (-> self focus-status) (logior (focus-status halfpipe) (-> self focus-status))) (set! (-> self control unknown-handle02) arg0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self control root-prim prim-core action) (collide-action no-normal-reset)) (set! (-> self control mod-surface) *board-halfpipe-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) @@ -2484,11 +2477,11 @@ (none) ) :trans (behavior () - (set! (-> self board halfpipe-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-time) (current-time)) (if (= (-> self control gspot-pat-surfce mode) (pat-mode halfpipe)) - (set! (-> self board halfpipe-gspot-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-gspot-time) (current-time)) ) - (if (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (< (- (current-time) (-> self state-time)) (seconds 1)) (vector+float*! (-> self control transv) (-> self control transv) @@ -2500,7 +2493,7 @@ (vector-float*! (-> self control transv) (-> self control transv) 1.5) (go target-board-turn-to (-> self control transv) (seconds 0.5)) ) - (when (>= (- (-> self clock frame-counter) (-> self board halfpipe-gspot-time)) (seconds 0.5)) + (when (>= (- (current-time) (-> self board halfpipe-gspot-time)) (seconds 0.5)) (+! (-> self control transv x) (* 20480.0 (-> self control edge-grab-across-edge-dir x))) (+! (-> self control transv z) (* 20480.0 (-> self control edge-grab-across-edge-dir z))) (go target-board-stance) @@ -2569,7 +2562,7 @@ ) :enter (behavior () (set! (-> self board shock-offsetv) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control mod-surface) *board-jump-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) @@ -2721,7 +2714,7 @@ :enter (behavior ((arg0 handle)) (logclear! (-> self focus-status) (focus-status halfpipe)) (set! (-> self board shock-offsetv) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (none) ) @@ -2814,7 +2807,7 @@ ) (logclear! (-> self focus-status) (focus-status halfpipe)) (set! (-> self board shock-offsetv) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control mod-surface) (new 'static 'surface :name 'jump @@ -3116,7 +3109,7 @@ :trans (behavior () (when (= *cheat-mode* 'debug) (when (and (not *pause-lock*) (cpad-hold? (-> self control cpad number) r2)) - (set! (-> self control time-of-last-debug-heal) (-> self clock frame-counter)) + (set! (-> self control time-of-last-debug-heal) (current-time)) (pickup-collectable! (-> self fact-override) (pickup-type health) 100.0 (the-as handle #f)) (go target-board-stance) ) @@ -3126,7 +3119,7 @@ :code (behavior ((arg0 vector) (arg1 attack-info)) (logclear! (-> self water flags) (water-flags jump-out)) (logclear! (-> self focus-status) (focus-status halfpipe)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (-> self attack-info))) (let ((s5-0 (new 'stack-no-clear 'vector))) (let ((v1-6 gp-0)) @@ -3175,7 +3168,7 @@ (cond ((= arg0 'attack) (logior! (-> self focus-status) (focus-status hit)) - (set! (-> self game hit-time) (-> self clock frame-counter)) + (set! (-> self game hit-time) (current-time)) (case (-> gp-0 mode) (('endlessfall) (cond @@ -3183,8 +3176,8 @@ (let ((s4-1 (new-stack-vector0))) (set! (-> s4-1 quad) (-> self control last-trans-on-ground quad)) (ja-channel-set! 0) - (let ((s3-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-1) (seconds 1)) + (let ((s3-1 (current-time))) + (until (>= (- (current-time) s3-1) (seconds 1)) (suspend) ) ) diff --git a/goal_src/jak2/engine/target/board/target-board.gc b/goal_src/jak2/engine/target/board/target-board.gc index a050857cd1..eff8584f3f 100644 --- a/goal_src/jak2/engine/target/board/target-board.gc +++ b/goal_src/jak2/engine/target/board/target-board.gc @@ -221,7 +221,7 @@ (case arg3 ((1) (if (< 0.9 (-> self control surface-angle)) - (set! (-> self board on-flat-time) (-> self clock frame-counter)) + (set! (-> self board on-flat-time) (current-time)) ) (set! (-> self board slip-factor) (lerp-scale 1.0 (-> arg0 slip-factor) (fabs (-> self control ctrl-slope-heading)) 0.0 1.0) @@ -229,41 +229,33 @@ (set! (-> arg0 slip-factor) (-> self board slip-factor)) (set! (-> arg0 slope-up-factor) (-> arg1 slope-up-factor)) (set! (-> arg0 slope-down-factor) (-> arg1 slope-down-factor)) - (set! (-> arg0 seek0) (lerp-scale - (* 0.1 (-> arg0 seek0)) - (-> arg0 seek0) - (the float (- (-> self clock frame-counter) (-> self board spin-time))) - 0.0 - 600.0 - ) + (set! (-> arg0 seek0) + (lerp-scale + (* 0.1 (-> arg0 seek0)) + (-> arg0 seek0) + (the float (- (current-time) (-> self board spin-time))) + 0.0 + 600.0 + ) ) - (set! (-> arg0 seek90) (lerp-scale - (* 0.1 (-> arg0 seek90)) - (-> arg0 seek90) - (the float (- (-> self clock frame-counter) (-> self board spin-time))) - 0.0 - 600.0 - ) + (set! (-> arg0 seek90) + (lerp-scale + (* 0.1 (-> arg0 seek90)) + (-> arg0 seek90) + (the float (- (current-time) (-> self board spin-time))) + 0.0 + 600.0 + ) ) - (set! (-> arg0 vel-turn) (lerp-scale - 131072.0 - (-> arg1 vel-turn) - (the float (- (-> self clock frame-counter) (-> self board spin-time))) - 0.0 - 600.0 - ) + (set! (-> arg0 vel-turn) + (lerp-scale 131072.0 (-> arg1 vel-turn) (the float (- (current-time) (-> self board spin-time))) 0.0 600.0) ) - (set! (-> arg0 turnv) (lerp-scale - 91022.22 - (-> arg1 turnv) - (the float (- (-> self clock frame-counter) (-> self board spin-time))) - 0.0 - 600.0 - ) + (set! (-> arg0 turnv) + (lerp-scale 91022.22 (-> arg1 turnv) (the float (- (current-time) (-> self board spin-time))) 0.0 600.0) ) - (when (< (- (-> self clock frame-counter) (-> self board spin-ground-start-time)) (seconds 0.3)) - (set! (-> self control last-attack-end-time) (-> self clock frame-counter)) - (set! (-> self board spin-ground-time) (-> self clock frame-counter)) + (when (< (- (current-time) (-> self board spin-ground-start-time)) (seconds 0.3)) + (set! (-> self control last-attack-end-time) (current-time)) + (set! (-> self board spin-ground-time) (current-time)) (set! (-> arg0 seek0) (* 0.1 (-> arg0 seek0))) (set! (-> arg0 seek90) (* 0.1 (-> arg0 seek90))) (set! (-> arg0 vel-turn) 131072.0) @@ -455,43 +447,42 @@ (set! *board-flip-mods* v1-14) ) -(define *board-wall-kick-mods* - (new 'static 'surface - :name 'jump - :tiltv 65536.0 - :tiltvv 262144.0 - :transv-max 143360.0 - :target-speed 102400.0 - :seek180 0.8 - :fric 0.2 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 0.8 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :tiltvf 150.0 - :tiltvvf 60.0 - :mult-hook (lambda :behavior target - ((arg0 surface) (arg1 surface) (arg2 surface) (arg3 int)) - (case arg3 - ((1) - (when (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) - (set! (-> arg0 turnv) 0.0) - (set! (-> arg0 turnvf) 0.0) - ) - ) +(define *board-wall-kick-mods* (new 'static 'surface + :name 'jump + :tiltv 65536.0 + :tiltvv 262144.0 + :transv-max 143360.0 + :target-speed 102400.0 + :seek180 0.8 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 0.8 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :tiltvf 150.0 + :tiltvvf 60.0 + :mult-hook (lambda :behavior target + ((arg0 surface) (arg1 surface) (arg2 surface) (arg3 int)) + (case arg3 + ((1) + (when (< (- (current-time) (-> self state-time)) (seconds 0.05)) + (set! (-> arg0 turnv) 0.0) + (set! (-> arg0 turnvf) 0.0) + ) + ) + ) + (none) + ) + :mode 'air + :flags (surface-flag no-turn-around turn-to-vel air) + ) ) - (none) - ) - :mode 'air - :flags (surface-flag no-turn-around turn-to-vel air) - ) - ) (define *board-halfpipe-mods* (new 'static 'surface :name 'jump @@ -706,7 +697,7 @@ (a2-3 (-> gp-1 world-vertex 1)) (f0-2 (t9-8 s5-1 (the-as vector a1-8) a2-3)) ) - (if (and (>= (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.4)) + (if (and (>= (- (current-time) (-> self board ride-time)) (seconds 0.4)) (>= f0-2 0.0) (>= 1.0 f0-2) (not (and (-> self next-state) (= (-> self next-state name) 'target-board-duck-stance))) @@ -863,10 +854,10 @@ (set! (-> self board unknown-sound-id00) (new 'static 'sound-id)) (set-setting! 'mode-sound-bank 'board 0.0 0) (set-setting! 'sound-flava #f 30.0 2) - (set! (-> self board board-get-on-time) (-> self clock frame-counter)) + (set! (-> self board board-get-on-time) (current-time)) (set! (-> self board stick-lock) #f) (set! (-> self board stick-off) #f) - (set! (-> self board unstuck-time) (-> self clock frame-counter)) + (set! (-> self board unstuck-time) (current-time)) (set! (-> self board stuck-count) 0) (set! (-> self board slip-factor) 1.0) (set! (-> self board unknown-symbol00) #f) @@ -1019,14 +1010,14 @@ (defbehavior target-board-smack-surface? target () (when (and (logtest? (-> self control status) (collide-status touch-wall)) - (< (+ (-> self clock frame-counter) (seconds -0.05)) (-> self control last-time-touching-actor)) + (< (+ (current-time) (seconds -0.05)) (-> self control last-time-touching-actor)) (< 0.7 (-> self control touch-angle)) (< 73728.0 (-> self control ctrl-xz-vel)) (and (< (vector-dot (-> self control wall-contact-normal) (-> self control dynam gravity-normal)) 0.3) (not (logtest? (-> self control status) (collide-status touch-actor))) ) ) - (set! (-> self board smack-surface-time) (-> self clock frame-counter)) + (set! (-> self board smack-surface-time) (current-time)) (set! (-> self board smack-speed) (-> self control ctrl-xz-vel)) (set! (-> self board smack-normal quad) (-> self control wall-contact-normal quad)) #t @@ -1101,14 +1092,14 @@ (set! f0-28 0.0) (set! f1-23 0.0) ) - (when (and (< (- (-> self clock frame-counter) (-> self control last-time-touching-actor)) (seconds 1)) + (when (and (< (- (current-time) (-> self control last-time-touching-actor)) (seconds 1)) (>= f28-0 0.5) (< (vector-dot (-> self control wall-contact-normal) (-> self control to-target-pt-xz)) -0.7) (logtest? (-> self control mod-surface flags) (surface-flag air)) (< 0.0 (-> gp-0 y)) ) (cond - ((and (>= (- (-> self clock frame-counter) (-> self control last-time-touching-actor)) (seconds 0.1)) + ((and (>= (- (current-time) (-> self control last-time-touching-actor)) (seconds 0.1)) (< 0.3 (-> self control blocked-factor)) ) (set! f0-28 f1-23) @@ -1210,7 +1201,7 @@ (logtest? (state-flags prevent-board) (-> self state-flags)) (not (logtest? (-> *game-info* features) (game-feature board))) ) - (and (>= (- (-> self clock frame-counter) (-> self board board-get-on-time)) (seconds 1)) + (and (>= (- (current-time) (-> self board board-get-on-time)) (seconds 1)) (< (-> self board board-get-on-time) (max (-> self control list-time-on-ground) (-> self control last-time-of-stuck)) ) @@ -1377,7 +1368,7 @@ (defbehavior target-board-physics target ((arg0 vector)) (let ((f30-0 0.5)) - (if (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame02)) (seconds 0.3)) + (if (>= (- (current-time) (-> self board unknown-time-frame02)) (seconds 0.3)) (+! (-> self board shock-offsetv) (* (- (-> arg0 y) (-> self control transv y)) f30-0)) (set! (-> self board up-vector 1 quad) (-> self board up-vector 0 quad)) ) @@ -1395,7 +1386,7 @@ (set! (-> self board shock-offsetv) 0.0) (set! (-> self board shock-offset) (* 0.96 (-> self board shock-offset))) ) - ((and (or (< (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.2)) + ((and (or (< (- (current-time) (-> self control last-time-on-surface)) (seconds 0.2)) (< (-> self board shock-offset) 0.0) ) (!= (-> self control mod-surface mode) 'air) @@ -1578,7 +1569,7 @@ (not (and (-> self next-state) (= (-> self next-state name) 'target-board-smack))) (not (focus-test? self halfpipe)) (!= (-> self control ground-pat mode) 3) - (>= (- (-> self clock frame-counter) (-> self board halfpipe-time)) (seconds 0.1)) + (>= (- (current-time) (-> self board halfpipe-time)) (seconds 0.1)) ) ) (let ((s5-3 (new 'stack-no-clear 'vector))) @@ -1599,7 +1590,7 @@ (s3-3 (vector-matrix*! (new 'stack-no-clear 'vector) s3-2 (-> self control w-R-c))) ) (logior! (-> self control status) (collide-status glance)) - (set! (-> self board glance-time) (-> self clock frame-counter)) + (set! (-> self board glance-time) (current-time)) (let ((v1-99 s2-2)) (set! (-> self board glance-speed) (sqrtf (+ (* (-> v1-99 x) (-> v1-99 x)) (* (-> v1-99 z) (-> v1-99 z))))) ) @@ -1628,10 +1619,7 @@ ) (else (set! (-> self control turn-lockout-end-time) - (the-as - time-frame - (max (+ (-> self clock frame-counter) (seconds 0.1)) (-> self control turn-lockout-end-time)) - ) + (the-as time-frame (max (+ (current-time) (seconds 0.1)) (-> self control turn-lockout-end-time))) ) ) ) @@ -1670,7 +1658,7 @@ (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) - (set! (-> self control last-time-of-stuck) (-> self clock frame-counter)) + (set! (-> self control last-time-of-stuck) (current-time)) ) 0 (none) @@ -1696,7 +1684,7 @@ (not (logtest? (-> self control status) (collide-status on-surface))) ) (begin - (set! (-> self board in-air-time) (-> self clock frame-counter)) + (set! (-> self board in-air-time) (current-time)) (and (not (and (-> self next-state) (let ((v1-12 (-> self next-state name))) (or (= v1-12 'target-board-stance) (= v1-12 'target-board-duck-stance) (= v1-12 'target-board-turn-to)) @@ -1735,7 +1723,7 @@ ) ) ) - (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.2)) + (>= (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.2)) ) ) ) @@ -1746,7 +1734,7 @@ (else (set! (-> self control bend-speed) 1024.0) (set! (-> self control bend-target) 1.0) - (when (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) + (when (< (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1)) (forward-up-nopitch->quaternion (-> self control dir-targ) (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control dir-targ)) @@ -1800,7 +1788,7 @@ (#f (set! (-> self control dynam gravity-length) 245760.0) ) - ((>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.1)) + ((>= (- (current-time) (-> self control last-time-on-surface)) (seconds 0.1)) (seek! (-> self control dynam gravity-length) 245760.0 (* 245760.0 (-> self clock seconds-per-frame))) ) (else @@ -1849,17 +1837,15 @@ ) (when (and (zero? (shr (shl (-> self board unknown-int00) 54) 61)) (!= (shr (shl (-> self board unknown-int00) 40) 58) 13) - (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame02)) (seconds 0.2)) + (>= (- (current-time) (-> self board unknown-time-frame02)) (seconds 0.2)) (< 819.2 (- f30-0 f0-36)) (or (< (-> self board unknown-time-frame01) (-> self control last-time-on-surface)) - (< (- (-> self clock frame-counter) (-> self board unknown-time-frame01)) (seconds 0.2)) + (< (- (current-time) (-> self board unknown-time-frame01)) (seconds 0.2)) ) (< 0.98 (vector-dot (-> self board unknown-vector01) (-> self control standard-dynamics gravity-normal))) (< f26-0 8192.0) (< f30-0 8192.0) - (or (< (* 0.2 f28-0) f30-0) - (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) - ) + (or (< (* 0.2 f28-0) f30-0) (< (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1))) ) (vector+float*! (-> self control transv) @@ -1867,25 +1853,25 @@ (-> self control dynam gravity-normal) (* 7.0 (fmin 4096.0 f30-0)) ) - (if (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) - (set! (-> self board unknown-time-frame01) (-> self clock frame-counter)) + (if (>= (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1)) + (set! (-> self board unknown-time-frame01) (current-time)) ) - (set! (-> self board unknown-time-frame00) (-> self clock frame-counter)) + (set! (-> self board unknown-time-frame00) (current-time)) ) ) (when (and (not (logtest? (-> self control status) (collide-status on-surface))) (< 0.0 f28-0) (or (and (or (< (target-height-above-ground) 4096.0) - (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) + (< (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1)) ) (< 8192.0 (- f28-0 (vector-dot (-> self control dynam gravity-normal) (-> self board slow-transv)))) ) - (< (- (-> self clock frame-counter) (-> self board unknown-time-frame02)) (seconds 0.1)) + (< (- (current-time) (-> self board unknown-time-frame02)) (seconds 0.1)) ) (>= 204.8 f30-0) (not (and (-> self next-state) (= (-> self next-state name) 'target-board-jump))) ) - (set! (-> self board unknown-time-frame02) (-> self clock frame-counter)) + (set! (-> self board unknown-time-frame02) (current-time)) (vector-length (-> self control transv)) (let ((v1-303 (new-stack-vector0)) (f0-51 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) @@ -1953,16 +1939,16 @@ (turn-to-vector s5-0 (-> self control pad-magnitude)) ) (if (and (= (-> self control pad-magnitude) 0.0) - (>= (-> self clock frame-counter) (-> self control turn-lockout-end-time)) + (>= (current-time) (-> self control turn-lockout-end-time)) (not (logtest? (-> self control current-surface flags) (surface-flag turn-to-vel))) - (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) + (>= (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1)) ) (rot->dir-targ! (-> self control)) ) - (when (and (< (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.1)) - (>= (-> self clock frame-counter) (-> self control turn-lockout-end-time)) + (when (and (< (- (current-time) (-> self control last-time-on-surface)) (seconds 0.1)) + (>= (current-time) (-> self control turn-lockout-end-time)) (not (logtest? (-> self control current-surface flags) (surface-flag turn-to-vel))) - (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) + (>= (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1)) ) (let* ((s3-0 (vector-flatten! @@ -1988,7 +1974,7 @@ ) ) (if (cpad-pressed? (-> self control cpad number) l1) - (set! (-> self board unknown-time-frame06) (-> self clock frame-counter)) + (set! (-> self board unknown-time-frame06) (current-time)) ) (board-add-thrust) (add-gravity) @@ -2062,7 +2048,7 @@ (set! (-> self board trotyv) 0.0) ) ((and (= (-> self control danger-mode) 'board-spin) - (or (board-on-ground?) (>= (- (-> self clock frame-counter) (-> self board spin-time)) (seconds 0.5))) + (or (board-on-ground?) (>= (- (current-time) (-> self board spin-time)) (seconds 0.5))) ) (target-danger-set! 'harmless #f) ) @@ -2158,7 +2144,7 @@ (joint-points) (do-target-gspot) (target-powerup-process) - (set! (-> self board board-time) (-> self clock frame-counter)) + (set! (-> self board board-time) (current-time)) (target-board-exit-check) (target-board-effect) (when (board-on-ground?) @@ -2214,9 +2200,9 @@ (return (the-as time-frame #f)) ) (vector-normalize-copy! (-> self board ride-dir) (-> self board ride-segment) 1.0) - (when (>= (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.2)) + (when (>= (- (current-time) (-> self board ride-time)) (seconds 0.2)) (set! (-> self board ride-lock-on) #f) - (set! (-> self board ride-start-time) (-> self clock frame-counter)) + (set! (-> self board ride-start-time) (current-time)) (vector-normalize-copy! (-> self board ride-dir) (-> self control transv) 1.0) (dotimes (v1-25 3) (vector-reset! (-> self board ride-vertex-old v1-25)) @@ -2308,7 +2294,7 @@ ) ) (when (and (< (-> self board ride-vertex-index) 0.0) - (< (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.2)) + (< (- (current-time) (-> self board ride-time)) (seconds 0.2)) (zero? s3-3) ) (+! s3-3 1) @@ -2336,7 +2322,7 @@ (dotimes (v1-127 3) (set! (-> self board ride-vertex v1-127 w) 1.0) ) - (when (>= (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.2)) + (when (>= (- (current-time) (-> self board ride-time)) (seconds 0.2)) (set! (-> self board ride-rot-abs 0) (vector-y-angle (-> self board ride-segment))) (set! (-> self board ride-rtv-abs) 0.0) ) @@ -2383,9 +2369,7 @@ ) ) (let ((s4-3 0)) - (if (and (< (fabs f30-2) 16384.0) - (< (- (-> self clock frame-counter) (-> self board ride-start-time)) (seconds 0.1)) - ) + (if (and (< (fabs f30-2) 16384.0) (< (- (current-time) (-> self board ride-start-time)) (seconds 0.1))) (set! s4-3 (logior s4-3 1)) ) (if (or (< (vector-dot @@ -2483,7 +2467,7 @@ (set! s4-3 (logior s4-3 8)) ) ) - (if (>= (- (-> self clock frame-counter) (-> self board ride-button-time)) (seconds 0.05)) + (if (>= (- (current-time) (-> self board ride-button-time)) (seconds 0.05)) (set! s4-3 (logior s4-3 16)) ) (if (< (vector-length (-> self board ride-segment)) @@ -2495,7 +2479,7 @@ (set! s4-3 (logior s4-3 64)) ) (logclear! (-> self control status) (collide-status probe-hit)) - (when (and (< (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.2)) (nonzero? s4-3)) + (when (and (< (- (current-time) (-> self board ride-time)) (seconds 0.2)) (nonzero? s4-3)) (if (logtest? s4-3 1) (format #t "exit speed ~M~%" f30-2) ) @@ -2571,12 +2555,12 @@ (-> self control to-target-pt-xz) (+ (-> self board ride-rot) (* -2730.6667 (-> self board ride-lean))) ) - (set! (-> self board ride-time) (-> self clock frame-counter)) + (set! (-> self board ride-time) (current-time)) (set! (-> self board ride-speed) f30-2) ) ) ) - (let ((v0-3 (-> self clock frame-counter))) + (let ((v0-3 (current-time))) (set! (-> self control last-time-on-surface) v0-3) v0-3 ) @@ -2729,7 +2713,7 @@ (when (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) (logclear! (-> *collide-edge-board-spec* flags) (collide-edge-spec-flags two)) (cond - ((>= (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.2)) + ((>= (- (current-time) (-> self board ride-time)) (seconds 0.2)) (logclear! (-> *collide-edge-board-spec* flags) (collide-edge-spec-flags one)) (set! (-> *collide-edge-board-spec* touching-segment) #f) ) @@ -2855,7 +2839,7 @@ (target-powerup-process) (target-board-exit-check) (target-board-effect) - (set! (-> self board board-time) (-> self clock frame-counter)) + (set! (-> self board board-time) (current-time)) 0 (none) ) @@ -2936,7 +2920,7 @@ (fmin (-> self board turn-anim-frame) (+ -1.0 (-> *TARGET_BOARD-bank* turn-frames))) (- (+ -1.0 (-> *TARGET_BOARD-bank* turn-frames))) ) - (* (sin (* 145.63556 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (* (sin (* 145.63556 (the float (- (current-time) (-> self state-time))))) (lerp-scale 1.0 2.0 (fabs (-> self board turn-anim-frame)) 0.0 (-> *TARGET_BOARD-bank* turn-frames)) ) ) @@ -2947,20 +2931,15 @@ arg0 ) ) - (let ((f0-59 (fmin - (if (logtest? (-> self control status) (collide-status on-surface)) - (seek (-> self board turn-anim-duck) 0.0 (-> self clock seconds-per-frame)) - (-> self board turn-anim-duck) - ) - (lerp-scale - 0.0 - -1.0 - (the float (- (-> self clock frame-counter) (-> self control last-time-on-surface))) - 30.0 - 120.0 - ) - ) - ) + (let ((f0-59 + (fmin + (if (logtest? (-> self control status) (collide-status on-surface)) + (seek (-> self board turn-anim-duck) 0.0 (-> self clock seconds-per-frame)) + (-> self board turn-anim-duck) + ) + (lerp-scale 0.0 -1.0 (the float (- (current-time) (-> self control last-time-on-surface))) 30.0 120.0) + ) + ) ) (+! (-> self board turn-anim-duck) (* (-> self board turn-anim-duck-vel) (-> self clock seconds-per-frame))) (cond diff --git a/goal_src/jak2/engine/target/collide-reaction-target.gc b/goal_src/jak2/engine/target/collide-reaction-target.gc index 16c79c24ee..cf37f67f08 100644 --- a/goal_src/jak2/engine/target/collide-reaction-target.gc +++ b/goal_src/jak2/engine/target/collide-reaction-target.gc @@ -55,151 +55,149 @@ (tangent vector) (overhang-nrm vector) ) - (with-pp - (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) - ) - (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))) + (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) ) - (vector-cross! tangent contact-normal overhang-nrm) - (if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) tangent)) - (vector-negate! tangent tangent) + (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! 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) ) - (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) - ) + (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-dist-to-next2) - (vector-vector-distance (-> s4-0 start-pos) (-> s4-0 best-other-tri intersect)) + (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-next2) (-> s4-0 best-other-tri pat)) - (set! (-> arg0 low-coverage-norm-of-next2 quad) (-> s4-0 best-other-tri normal quad)) + (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 (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)) - ) - ) - ) - ) - (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf07))) - (set! (-> arg0 time-of-last-lc-touch-edge) (-> pp clock frame-counter)) - (set! sv-40 (logior sv-40 (collide-status touch-edge))) - (set! (-> arg0 time-of-last-lc) (-> pp clock frame-counter)) - (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)) - ) - ) + (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)) ) - (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 (* -0.25 (-> arg1 best-my-prim local-sphere w))) - ) - (>= (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))) - ) - ) - ) + (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 ) - (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)) + ) + (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)) ) - (< 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! (-> arg0 time-of-last-lc) (-> pp clock frame-counter)) - (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! (-> arg0 time-of-last-lc) (-> pp clock frame-counter)) + ) + (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf07))) + (set! (-> arg0 time-of-last-lc-touch-edge) (current-time)) + (set! sv-40 (logior sv-40 (collide-status touch-edge))) + (set! (-> arg0 time-of-last-lc) (current-time)) + (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 (* -0.25 (-> arg1 best-my-prim local-sphere w))) + ) + (>= (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))) ) ) ) - (set! (-> sv-24 0) sv-40) - (set! (-> sv-20 0) sv-32) - (set! (-> sv-28 0) sv-48) - 0 - (none) ) + (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! (-> arg0 time-of-last-lc) (current-time)) + (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! (-> arg0 time-of-last-lc) (current-time)) + ) + ) + ) + (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)) @@ -370,7 +368,7 @@ (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> arg0 grount-touch-point)) ) ) - (< (- (-> self clock frame-counter) (-> arg0 list-time-on-ground)) (seconds 0.3)) + (< (- (current-time) (-> arg0 list-time-on-ground)) (seconds 0.3)) ) (logtest? sv-104 (cshape-reaction-flags csrf15)) ) @@ -441,7 +439,7 @@ (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! (-> arg0 list-time-on-ground) (-> self clock frame-counter)) + (set! (-> arg0 list-time-on-ground) (current-time)) (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)) @@ -564,7 +562,7 @@ ) (defbehavior rail-surface-touch target () - (when (>= (- (-> self clock frame-counter) (-> self control time-of-last-surface-change)) (seconds 0.2)) + (when (>= (- (current-time) (-> self control time-of-last-surface-change)) (seconds 0.2)) (logclear! (-> *collide-edge-board-spec* flags) (collide-edge-spec-flags one send-event)) (set! (-> *collide-edge-board-spec* touching-segment) #f) (do-edge-grabs *target* *collide-cache* *collide-edge-board-spec*) 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 602ad5c92d..90102029a9 100644 --- a/goal_src/jak2/engine/target/gun/gun-dark-shot.gc +++ b/goal_src/jak2/engine/target/gun/gun-dark-shot.gc @@ -208,7 +208,7 @@ (none) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (cond ((or (and *target* @@ -219,10 +219,8 @@ ) (go-virtual dissipate) ) - ((or (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.3)) (cpad-hold? 0 r1)) - (set! (-> self size-t) - (fmin 1.0 (* 0.016666668 (the float (- (-> self clock frame-counter) (-> self state-time))))) - ) + ((or (< (- (current-time) (-> self state-time)) (seconds 0.3)) (cpad-hold? 0 r1)) + (set! (-> self size-t) (fmin 1.0 (* 0.016666668 (the float (- (current-time) (-> self state-time)))))) (let ((t9-1 vector<-cspace!) (a0-13 (-> self root-override trans)) (v1-26 (-> self parent)) @@ -299,7 +297,7 @@ (vector-float*! (-> self spin-vector) (-> self spin-vector) (/ 1.0 f0-5)) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000))) (when gp-2 (let ((t9-4 (method-of-type part-tracker activate))) @@ -371,7 +369,7 @@ (vector-flatten! (-> self spin-vector) (-> self spin-vector) s4-0) (matrix-axis-angle! s5-0 s4-0 (* 2002.4889 (-> self clock time-adjust-ratio))) (vector-matrix*! (-> self spin-vector) (-> self spin-vector) s5-0) - (let ((f0-9 (the float (- (-> self clock frame-counter) (-> self state-time)))) + (let ((f0-9 (the float (- (current-time) (-> self state-time)))) (f30-0 0.0) ) (cond @@ -522,11 +520,11 @@ (defstate fizzle (gun-dark-shot) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (>= (- (current-time) (-> self state-time)) (seconds 1)) (deactivate self) ) (process-drawable-shock-effect @@ -624,7 +622,7 @@ (sv-320 process-drawable) (sv-336 process-drawable) ) - (if (< (- (-> self clock frame-counter) (-> self spawn-time)) (seconds 0.1)) + (if (< (- (current-time) (-> self spawn-time)) (seconds 0.1)) (send-event (ppointer->process (-> self parent)) 'release) ) (sound-stop (the-as sound-id (-> self trail-sound))) @@ -789,7 +787,7 @@ ((arg0 handle)) (let ((s5-0 (-> self parent)) (s4-0 0) - (s3-0 (-> self clock frame-counter)) + (s3-0 (current-time)) ) (set! (-> self clock) (-> s5-0 0 clock)) (while (and (nonzero? (-> (the-as process-drawable (-> s5-0 0)) skel)) @@ -821,18 +819,18 @@ ) ) ) - (< (- (-> self clock frame-counter) s3-0) (seconds 0.1)) + (< (- (current-time) s3-0) (seconds 0.1)) ) ) ) - (< (- (-> self clock frame-counter) s3-0) (seconds 5)) + (< (- (current-time) s3-0) (seconds 5)) (not (logtest? (-> (the-as process-drawable (-> s5-0 0)) draw status) (draw-control-status no-draw no-draw-temp)) ) ) ) ) - (when (>= (- (-> self clock frame-counter) (the-as time-frame s4-0)) (seconds 0.05)) - (set! s4-0 (the-as int (-> self clock frame-counter))) + (when (>= (- (current-time) (the-as time-frame s4-0)) (seconds 0.05)) + (set! s4-0 (the-as int (current-time))) (if (handle->process arg0) (process-drawable-shock-effect-bullseye (the-as process-focusable (handle->process arg0)) @@ -862,8 +860,8 @@ (-> self result-array (+ gp-2 -1)) :to s4-1 ) - (let ((s4-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-2) (seconds 0.1)) + (let ((s4-2 (current-time))) + (until (>= (- (current-time) s4-2) (seconds 0.1)) (suspend) ) ) @@ -872,9 +870,9 @@ ) ) ) - (let ((gp-3 (-> self clock frame-counter))) + (let ((gp-3 (current-time))) (while (or (-> self child) (and (nonzero? (get-status *gui-control* (the-as sound-id (-> self explode-sound)))) - (< (- (-> self clock frame-counter) gp-3) (seconds 10)) + (< (- (current-time) gp-3) (seconds 10)) ) ) (suspend) diff --git a/goal_src/jak2/engine/target/gun/gun-h.gc b/goal_src/jak2/engine/target/gun/gun-h.gc index f8699787d7..e4566d416c 100644 --- a/goal_src/jak2/engine/target/gun/gun-h.gc +++ b/goal_src/jak2/engine/target/gun/gun-h.gc @@ -133,7 +133,7 @@ (defbehavior want-to-gun? process ((arg0 target) (arg1 symbol)) (local-vars (v1-36 symbol)) (and (logtest? (-> arg0 game features) (game-feature gun)) - (>= (- (-> self clock frame-counter) (-> arg0 gun gun-time)) (seconds 0.1)) + (>= (- (current-time) (-> arg0 gun gun-time)) (seconds 0.1)) (not (focus-test? arg0 dead hit board mech dark teleporting)) (not (logtest? (surface-flag gun-inactive gun-hide gun-off) (-> arg0 control current-surface flags))) (not (logtest? (state-flags prevent-gun) (-> arg0 state-flags))) @@ -155,7 +155,7 @@ (-> arg0 gun latch?) ) (not (-> arg0 skel top-anim frame-group)) - (>= (- (-> self clock frame-counter) (-> arg0 control time-of-last-debug-float)) (seconds 0.1)) + (>= (- (current-time) (-> arg0 control time-of-last-debug-float)) (seconds 0.1)) ) ) 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 720988fe1d..bd39b6e67e 100644 --- a/goal_src/jak2/engine/target/gun/gun-red-shot.gc +++ b/goal_src/jak2/engine/target/gun/gun-red-shot.gc @@ -441,8 +441,8 @@ (defstate debug-idle (gun-red-shot) :virtual #t :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 3)) (let ((gp-0 (new 'stack-no-clear 'vector))) (dotimes (s5-0 (-> self probe-count)) (vector-float*! gp-0 (-> self probe-dir s5-0) 61440.0) diff --git a/goal_src/jak2/engine/target/gun/gun-states.gc b/goal_src/jak2/engine/target/gun/gun-states.gc index 15dae66e60..e3374ec196 100644 --- a/goal_src/jak2/engine/target/gun/gun-states.gc +++ b/goal_src/jak2/engine/target/gun/gun-states.gc @@ -48,7 +48,7 @@ (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) (set! (-> self control mod-surface) *gun-walk-mods*) (set! (-> self control unknown-word04) (the-as uint #f)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -236,7 +236,7 @@ (suspend) (ja :num! (loop!)) (when (can-play-stance-amibent?) - (set! (-> self ambient-time) (-> self clock frame-counter)) + (set! (-> self ambient-time) (current-time)) (target-gun-end-mode #t) ) (cond @@ -317,7 +317,7 @@ (defstate target-gun-walk (target) :event target-standard-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *gun-walk-mods*) (case (-> self gun gun-type) (((pickup-type eco-yellow) (pickup-type eco-blue)) diff --git a/goal_src/jak2/engine/target/gun/gun-util.gc b/goal_src/jak2/engine/target/gun/gun-util.gc index 20450756ac..d072252ebb 100644 --- a/goal_src/jak2/engine/target/gun/gun-util.gc +++ b/goal_src/jak2/engine/target/gun/gun-util.gc @@ -487,7 +487,7 @@ ) ) :enter (behavior ((arg0 symbol)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self draw shadow) (-> self shadow-backup)) (logior! (-> self skel status) (joint-control-status sync-math)) (none) @@ -521,7 +521,7 @@ ((begin (set! a0-14 (!= (-> (the-as target (-> self parent 0)) game gun-type) (-> self gun-type))) (and (the-as symbol a0-14) (let ((v1-16 (-> self state-time))) - (set! a0-14 (-> self clock frame-counter)) + (set! a0-14 (current-time)) (!= v1-16 (the-as time-frame a0-14)) ) ) diff --git a/goal_src/jak2/engine/target/logic-target.gc b/goal_src/jak2/engine/target/logic-target.gc index b4855cf672..f4c829cec3 100644 --- a/goal_src/jak2/engine/target/logic-target.gc +++ b/goal_src/jak2/engine/target/logic-target.gc @@ -31,7 +31,7 @@ (defbehavior build-conversions target ((arg0 vector)) (when (!= (-> self control prev-surf) (-> self control surf)) (set! (-> self control prev-surf) (-> self control surf)) - (set! (-> self control time-of-last-surface-change) (-> self clock frame-counter)) + (set! (-> self control time-of-last-surface-change) (current-time)) ) (surface-mult! (-> self control current-surface) (-> self control mod-surface) (-> self control surf)) (when (and (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 3) @@ -474,7 +474,7 @@ arg1 "~0ky:~,,2M t:~d cy: ~,,2M my: ~,,2M impv:~,,2M " (-> arg0 control last-trans-any-surf y) - (- (-> (the-as target pp) clock frame-counter) (-> arg0 control last-time-on-surface)) + (- (current-time) (-> arg0 control last-time-on-surface)) (- (-> arg0 control trans y) (-> arg0 control last-trans-any-surf y)) (- (-> arg0 control highest-jump-mark y) (-> arg0 control last-trans-leaving-surf y)) (-> arg0 control ground-impact-vel) @@ -535,7 +535,7 @@ (set! (-> arg0 w) 0.0) (set! (-> self control pad-xz-dir quad) (-> arg0 quad)) (set! (-> self control pad-magnitude) (-> self control cpad stick0-speed)) - (when (< (-> self control update-cam-R-w-start-time) (-> self clock frame-counter)) + (when (< (-> self control update-cam-R-w-start-time) (current-time)) (let ((s5-0 (-> self control cam-R-w)) (t9-2 matrix-local->world) (a0-13 #t) @@ -641,14 +641,14 @@ (set! (-> self control idx-of-fastest-xz-vel) a0-3) (set! (-> self control average-xz-vel) f1-1) (if (logtest? (-> self control current-surface flags) (surface-flag no-turn-around)) - (set! (-> v1-7 0) (-> self clock frame-counter)) + (set! (-> v1-7 0) (current-time)) ) - (and (>= (the-as uint (- (-> self clock frame-counter) (-> v1-7 0))) (the-as uint 300)) + (and (>= (the-as uint (- (current-time) (-> v1-7 0))) (the-as uint 300)) (< f0-1 0.0) (< 32768.0 f1-1) (< 0.7 (-> self control pad-magnitude)) - (>= (- (-> self clock frame-counter) (-> self control last-time-touching-actor)) (seconds 0.3)) - (>= (- (-> self clock frame-counter) (-> self control time-of-last-lc)) (seconds 0.3)) + (>= (- (current-time) (-> self control last-time-touching-actor)) (seconds 0.3)) + (>= (- (current-time) (-> self control time-of-last-lc)) (seconds 0.3)) (logtest? (-> self control status) (collide-status on-surface)) (and (< 0.7 (-> self control surface-angle)) #t) ) @@ -670,13 +670,11 @@ ) ) ) - (if (>= (- (-> self clock frame-counter) (-> self control time-of-last-wall-hide-first-check-pass)) (seconds 0.1)) - (set! (-> self control time-of-first-wall-hide-first-check-pass) (-> self clock frame-counter)) + (if (>= (- (current-time) (-> self control time-of-last-wall-hide-first-check-pass)) (seconds 0.1)) + (set! (-> self control time-of-first-wall-hide-first-check-pass) (current-time)) ) - (set! (-> self control time-of-last-wall-hide-first-check-pass) (-> self clock frame-counter)) - (when (>= (- (-> self clock frame-counter) (-> self control time-of-first-wall-hide-first-check-pass)) - (seconds 0.5) - ) + (set! (-> self control time-of-last-wall-hide-first-check-pass) (current-time)) + (when (>= (- (current-time) (-> self control time-of-first-wall-hide-first-check-pass)) (seconds 0.5)) (let ((gp-0 (new 'stack-no-clear 'collide-query))) (let ((v1-34 (-> gp-0 bbox)) (a0-13 (-> self control trans)) @@ -732,7 +730,7 @@ (defbehavior target-log-trans target () (let ((v1-1 (-> self control trans-log-idx))) - (set! (-> self control trans-log-times v1-1) (-> self clock frame-counter)) + (set! (-> self control trans-log-times v1-1) (current-time)) (set! (-> self control trans-log-trans v1-1 quad) (-> self control trans quad)) (set! (-> self control trans-log-idx) (logand (+ v1-1 1) 127)) ) @@ -749,7 +747,7 @@ (let* ((v1-0 127) (a1-2 (logand (+ (-> s4-0 trans-log-idx) v1-0) 127)) ) - (while (and (< (- (-> self clock frame-counter) (-> s4-0 trans-log-times a1-2)) arg0) (> v1-0 0)) + (while (and (< (- (current-time) (-> s4-0 trans-log-times a1-2)) arg0) (> v1-0 0)) (vector+! s5-0 s5-0 (-> s4-0 trans-log-trans a1-2)) (+! gp-0 1) (+! v1-0 -1) @@ -994,9 +992,9 @@ ) ) ) - (set! (-> self control time-of-last-clear-wall-in-jump) (-> self clock frame-counter)) + (set! (-> self control time-of-last-clear-wall-in-jump) (current-time)) ) - (if (< (- (-> self clock frame-counter) (-> self control time-of-last-clear-wall-in-jump)) (seconds 0.2)) + (if (< (- (current-time) (-> self control time-of-last-clear-wall-in-jump)) (seconds 0.2)) (set! f30-0 (+ 204800.0 f30-0)) ) (if (and (not (logtest? (-> self control status) (collide-status touch-wall))) @@ -1139,14 +1137,14 @@ (collide-status on-surface touch-surface) ) ) - (< (- (-> self clock frame-counter) (-> self control last-time-touching-actor)) (seconds 0.5)) + (< (- (current-time) (-> self control last-time-touching-actor)) (seconds 0.5)) (not (and (-> self next-state) (let ((v1-15 (-> self next-state name))) (or (= v1-15 'target-walk) (= v1-15 'target-gun-walk)) ) ) ) - (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) - (< (- (-> self clock frame-counter) (-> self control time-of-last-lc)) (seconds 0.5)) + (< (- (current-time) (-> self state-time)) (seconds 0.5)) + (< (- (current-time) (-> self control time-of-last-lc)) (seconds 0.5)) (logtest? (-> self control current-surface flags) (surface-flag turn-to-pad)) (!= (-> self control force-turn-to-strength) 0.0) ) @@ -1171,9 +1169,7 @@ s4-0 s3-1 (cond - ((and (or (>= 0.0 (-> self control turn-to-magnitude)) - (< (-> self clock frame-counter) (-> self control turn-lockout-end-time)) - ) + ((and (or (>= 0.0 (-> self control turn-to-magnitude)) (< (current-time) (-> self control turn-lockout-end-time))) (not (logtest? (-> self control current-surface flags) (surface-flag turn-when-centered))) ) 0.0 @@ -1513,7 +1509,7 @@ ) (defbehavior pre-collide-setup target () - (if (>= (-> self clock frame-counter) (-> self control additional-decaying-velocity-decay-start-time)) + (if (>= (current-time) (-> self control additional-decaying-velocity-decay-start-time)) (vector-normalize! (-> self control additional-decaying-velocity) (seek @@ -1525,9 +1521,7 @@ ) (cond ((logtest? (-> self control old-status) (collide-status on-surface)) - (if (>= (+ (-> self clock frame-counter) (seconds -0.035)) - (-> self control additional-decaying-velocity-end-time) - ) + (if (>= (+ (current-time) (seconds -0.035)) (-> self control additional-decaying-velocity-end-time)) (vector-reset! (-> self control additional-decaying-velocity)) ) ) @@ -1559,7 +1553,7 @@ (set! (-> self current-level) (level-get-target-inside *level*)) (if (-> self current-level) (+! (-> self game task-in-times (-> self current-level info task-level)) - (- (-> self clock frame-counter) (-> self clock old-frame-counter)) + (- (current-time) (-> self clock old-frame-counter)) ) ) (if (and (-> self current-level) (or (not gp-0) (!= (-> gp-0 name) (-> self current-level name)))) @@ -1574,15 +1568,13 @@ (cond ((= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) (if (zero? (-> self control time-between-zero-inputs)) - (set! (-> self control time-between-zero-inputs) - (- (-> self clock frame-counter) (-> self control time-of-last-zero-input)) - ) + (set! (-> self control time-between-zero-inputs) (- (current-time) (-> self control time-of-last-zero-input))) ) - (set! (-> self control time-of-last-zero-input) (-> self clock frame-counter)) + (set! (-> self control time-of-last-zero-input) (current-time)) (quaternion-copy! (-> self control last-nonzero-input-dir-targ) (-> self control dir-targ)) ) (else - (set! (-> self control time-of-last-nonzero-input) (-> self clock frame-counter)) + (set! (-> self control time-of-last-nonzero-input) (current-time)) (set! (-> self control time-between-zero-inputs) 0) 0 ) @@ -1593,7 +1585,7 @@ ((-> self control current-surface active-hook)) (cond ((logtest? (-> self control status) (collide-status on-surface)) - (set! (-> self control last-time-on-surface) (-> self clock frame-counter)) + (set! (-> self control last-time-on-surface) (current-time)) (set! (-> self control last-trans-any-surf quad) (-> self control trans quad)) (if (and (>= (-> self control coverage) 1.0) (not (logtest? (-> self control status) (collide-status touch-actor on-water))) @@ -1631,7 +1623,7 @@ (logtest? (-> self control mod-surface flags) (surface-flag look-around)) (not (focus-test? self edge-grab pole flut tube board pilot dark)) (-> *setting-control* user-current allow-look-around) - (>= (- (-> self clock frame-counter) (the-as int (-> self no-look-around-wait))) (seconds 0.05)) + (>= (- (current-time) (the-as int (-> self no-look-around-wait))) (seconds 0.05)) (not (and (= (-> self control ground-pat material) (pat-material ice)) (< 4096.0 (-> self control ctrl-xz-vel))) ) ) @@ -1687,7 +1679,7 @@ ) ) (send-event *camera* 'reset-follow) - (set! (-> self control time-of-last-debug-float) (-> self clock frame-counter)) + (set! (-> self control time-of-last-debug-float) (current-time)) (cond ((focus-test? self mech indax) (if (not (and (-> self next-state) (let ((v1-179 (-> self next-state name))) @@ -1771,9 +1763,7 @@ ) ) (let ((v1-229 (-> self current-level))) - (when (and (or (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 2)) - (focus-test? self pilot) - ) + (when (and (or (>= (- (current-time) (-> self control last-time-on-surface)) (seconds 2)) (focus-test? self pilot)) (and v1-229 (< (-> self control trans y) (-> v1-229 info buttom-height)) (not (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control cpad number) r2))) @@ -1823,19 +1813,19 @@ (defbehavior post-flag-setup target () (if (logtest? (-> self control status) (collide-status touch-wall touch-actor)) - (set! (-> self control last-time-touching-actor) (-> self clock frame-counter)) + (set! (-> self control last-time-touching-actor) (current-time)) ) (when (logtest? (-> self state-flags) (state-flags tinvul1)) - (if (< (logand (- (-> self clock frame-counter) (-> self control invul1-on-time)) 3) 1) + (if (< (logand (- (current-time) (-> self control invul1-on-time)) 3) 1) (logior! (-> self draw status) (draw-control-status no-draw-bounds)) (logclear! (-> self draw status) (draw-control-status no-draw-bounds)) ) - (if (>= (- (-> self clock frame-counter) (-> self control invul1-on-time)) (-> self control invul1-off-time)) + (if (>= (- (current-time) (-> self control invul1-on-time)) (-> self control invul1-off-time)) (target-timed-invulnerable-off self 1) ) ) (when (logtest? (state-flags tinvul2) (-> self state-flags)) - (if (>= (- (-> self clock frame-counter) (-> self control invul2-on-time)) (-> self control invul2-off-time)) + (if (>= (- (current-time) (-> self control invul2-on-time)) (-> self control invul2-off-time)) (target-timed-invulnerable-off self 2) ) ) @@ -2059,7 +2049,7 @@ (set! (-> self control hand-to-edge-dist) (vector-length s4-1)) (cond ((and (< 819.2 (-> self control hand-to-edge-dist)) - (>= (- (-> self clock frame-counter) (-> self control last-successful-compute-edge-time)) (seconds 0.2)) + (>= (- (current-time) (-> self control last-successful-compute-edge-time)) (seconds 0.2)) ) (cond ((-> s5-0 pilot-edge-grab?) @@ -2105,7 +2095,7 @@ ) ) (vector-float*! (-> self control rider-last-move) s4-1 (-> self clock frames-per-second)) - (set! (-> self control rider-time) (-> self clock frame-counter)) + (set! (-> self control rider-time) (current-time)) (vector+! s3-1 s3-1 (-> self control cspace-offset)) (move-to-point! (-> self control) s3-1) ) @@ -2118,9 +2108,9 @@ (move-by-vector! (-> self control) a1-20) ) (vector-float*! (-> self control rider-last-move) s4-1 (-> self clock frames-per-second)) - (set! (-> self control rider-time) (-> self clock frame-counter)) - (if (and (>= (- (-> self clock frame-counter) (-> self control edge-grab-start-time)) (seconds 0.5)) - (>= (- (-> self clock frame-counter) (-> self control last-successful-compute-edge-time)) (seconds 0.5)) + (set! (-> self control rider-time) (current-time)) + (if (and (>= (- (current-time) (-> self control edge-grab-start-time)) (seconds 0.5)) + (>= (- (current-time) (-> self control last-successful-compute-edge-time)) (seconds 0.5)) ) (send-event self 'end-mode) ) @@ -2131,13 +2121,13 @@ (let ((a1-23 (new 'stack-no-clear 'vector))) (vector-! a1-23 (-> s5-0 center-hold) (-> self control ctrl-to-hands-offset)) (vector-float*! (-> self control rider-last-move) s4-1 (-> self clock frames-per-second)) - (set! (-> self control rider-time) (-> self clock frame-counter)) + (set! (-> self control rider-time) (current-time)) (vector+! a1-23 a1-23 (-> self control cspace-offset)) (move-to-point! (-> self control) a1-23) ) (set! (-> self control hand-to-edge-dist) 0.0) (set! (-> self control last-trans-any-surf quad) (-> self control trans quad)) - (set! (-> self control last-successful-compute-edge-time) (-> self clock frame-counter)) + (set! (-> self control last-successful-compute-edge-time) (current-time)) ) ) ) @@ -2208,7 +2198,7 @@ ) (let ((a1-15 (vector-! (new-stack-vector0) (-> gp-0 center-hold) (-> gp-0 center-hold-old)))) (vector-float*! (-> self control rider-last-move) a1-15 (-> self clock frames-per-second)) - (set! (-> self control rider-time) (-> self clock frame-counter)) + (set! (-> self control rider-time) (current-time)) (move-by-vector! (-> self control) a1-15) ) ) @@ -2246,7 +2236,7 @@ (send-event *camera* 'ease-in #x3f000000 v1-10) ) (vector-segment-distance-point! (-> self control midpoint-of-hands) s4-1 s3-1 s5-0) - (if (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (if (< (- (current-time) (-> self state-time)) (seconds 0.05)) (set! (-> self control hand-to-edge-dist) (fmax 0.0 (fmin 1.0 (/ (vector-vector-distance s4-1 s5-0) (* 2.0 (-> (the-as swingpole s2-0) edge-length))))) ) @@ -2342,7 +2332,7 @@ ) (vector<-cspace! gp-0 (-> self node-list data 6)) (cond - ((>= (+ (-> self clock frame-counter) (seconds -2)) (-> self control unknown-time-frame26)) + ((>= (+ (current-time) (seconds -2)) (-> self control unknown-time-frame26)) (set! (-> self control camera-pos quad) (-> s5-0 quad)) ) ((not (and (logtest? (-> self water flags) (water-flags under-water)) @@ -2353,7 +2343,7 @@ (-> self control camera-pos) gp-0 s5-0 - (* 0.0016666667 (the float (- (-> self clock frame-counter) (-> self control unknown-time-frame26)))) + (* 0.0016666667 (the float (- (current-time) (-> self control unknown-time-frame26)))) ) ) (else @@ -2361,13 +2351,7 @@ (-> self control camera-pos) s5-0 gp-0 - (fmax - 0.0 - (fmin - 1.0 - (* 0.0011111111 (the float (- (-> self clock frame-counter) (-> self control unknown-time-frame27)))) - ) - ) + (fmax 0.0 (fmin 1.0 (* 0.0011111111 (the float (- (current-time) (-> self control unknown-time-frame27)))))) ) ) ) @@ -3077,7 +3061,7 @@ (set! (-> self control bent-gravity-normal quad) (-> self control standard-dynamics gravity-normal quad)) (quaternion-identity! (-> self control override-quat)) (set! (-> self control override-quat-alpha) 0.0) - (set! (-> self control last-time-on-surface) (-> self clock frame-counter)) + (set! (-> self control last-time-on-surface) (current-time)) (set! (-> self control bend-amount) 0.0) (set! (-> self control bend-speed) 32.0) (set! (-> self cam-user-mode) 'normal) @@ -3310,9 +3294,9 @@ (set! (-> obj current-level) #f) (level-setup) (set! (-> obj pre-joint-hook) (the-as (function none :behavior target) nothing)) - (set! (-> obj init-time) (-> self clock frame-counter)) + (set! (-> obj init-time) (current-time)) (set! (-> obj spool-anim) (the-as spool-anim #t)) - (set! (-> obj ambient-time) (-> self clock frame-counter)) + (set! (-> obj ambient-time) (current-time)) 0 (none) ) diff --git a/goal_src/jak2/engine/target/mech_suit/carry-h.gc b/goal_src/jak2/engine/target/mech_suit/carry-h.gc index 2bc56c6262..4266e84947 100644 --- a/goal_src/jak2/engine/target/mech_suit/carry-h.gc +++ b/goal_src/jak2/engine/target/mech_suit/carry-h.gc @@ -437,10 +437,10 @@ Returns `-1.0` if it exceeds the maximum allowed" (let* ((a1-8 (quaternion-normalize! (matrix->quaternion (new 'stack-no-clear 'quaternion) s5-1))) (s5-3 (quaternion-normalize! (quaternion*! a1-8 a1-8 (-> obj grab-quat)))) (v1-19 (vector-! (new 'stack-no-clear 'vector) (-> s4-0 point) s3-2)) - (f30-0 (* 0.033333335 (the float (- (-> self clock frame-counter) (-> obj pickup-time))))) + (f30-0 (* 0.033333335 (the float (- (current-time) (-> obj pickup-time))))) ) (cond - ((>= (- (-> self clock frame-counter) (-> obj pickup-time)) (seconds 1)) + ((>= (- (current-time) (-> obj pickup-time)) (seconds 1)) (set! (-> obj process 0 control trans quad) (-> v1-19 quad)) (quaternion-copy! (-> obj process 0 control quat) s5-3) ) diff --git a/goal_src/jak2/engine/target/mech_suit/grunt-mech.gc b/goal_src/jak2/engine/target/mech_suit/grunt-mech.gc index b04c14312f..40f4a9ebb5 100644 --- a/goal_src/jak2/engine/target/mech_suit/grunt-mech.gc +++ b/goal_src/jak2/engine/target/mech_suit/grunt-mech.gc @@ -94,74 +94,70 @@ ) (defmethod grunt-mech-info-method-10 grunt-mech-info ((obj grunt-mech-info)) - (with-pp - (let ((s5-0 (-> pp clock frame-counter))) - (when (!= (-> obj last-update-time) s5-0) - (when (< s5-0 (-> obj last-update-time)) - (countdown (v1-4 6) - (let ((a0-4 (-> obj holds v1-4))) - (set! (-> a0-4 grunt-handle) (the-as handle #f)) - (set! (-> a0-4 timeout) (the-as uint 0)) - ) - 0 + (let ((s5-0 (current-time))) + (when (!= (-> obj last-update-time) s5-0) + (when (< s5-0 (-> obj last-update-time)) + (countdown (v1-4 6) + (let ((a0-4 (-> obj holds v1-4))) + (set! (-> a0-4 grunt-handle) (the-as handle #f)) + (set! (-> a0-4 timeout) (the-as uint 0)) ) - (set! (-> obj reserved-mask) (the-as uint 0)) 0 ) - (set! (-> obj last-update-time) s5-0) - (let ((v1-8 *target*)) - (cond - ((and v1-8 (focus-test? v1-8 mech)) - (let ((s4-0 (-> v1-8 manipy 0 node-list data 3))) - (dotimes (s3-0 6) - (let ((s2-0 (-> obj holds s3-0))) - (matrix*! (-> s2-0 world-mat) (-> s2-0 local-mat) (-> s4-0 bone transform)) - (vector-float*! (-> s2-0 world-mat trans) (-> s2-0 world-mat trans) (/ 1.0 (-> s2-0 world-mat trans w))) - (when (and (!= (-> s2-0 grunt-handle) #f) (>= s5-0 (the-as time-frame (-> s2-0 timeout)))) - (set! (-> s2-0 grunt-handle) (the-as handle #f)) - (logclear! (-> obj reserved-mask) (-> s2-0 reserve-mask)) - ) + (set! (-> obj reserved-mask) (the-as uint 0)) + 0 + ) + (set! (-> obj last-update-time) s5-0) + (let ((v1-8 *target*)) + (cond + ((and v1-8 (focus-test? v1-8 mech)) + (let ((s4-0 (-> v1-8 manipy 0 node-list data 3))) + (dotimes (s3-0 6) + (let ((s2-0 (-> obj holds s3-0))) + (matrix*! (-> s2-0 world-mat) (-> s2-0 local-mat) (-> s4-0 bone transform)) + (vector-float*! (-> s2-0 world-mat trans) (-> s2-0 world-mat trans) (/ 1.0 (-> s2-0 world-mat trans w))) + (when (and (!= (-> s2-0 grunt-handle) #f) (>= s5-0 (the-as time-frame (-> s2-0 timeout)))) + (set! (-> s2-0 grunt-handle) (the-as handle #f)) + (logclear! (-> obj reserved-mask) (-> s2-0 reserve-mask)) ) ) ) ) - (else - (countdown (v1-25 6) - (let ((a0-16 (-> obj holds v1-25))) - (set! (-> a0-16 grunt-handle) (the-as handle #f)) - (set! (-> a0-16 timeout) (the-as uint 0)) - ) - 0 + ) + (else + (countdown (v1-25 6) + (let ((a0-16 (-> obj holds v1-25))) + (set! (-> a0-16 grunt-handle) (the-as handle #f)) + (set! (-> a0-16 timeout) (the-as uint 0)) ) - (set! (-> obj reserved-mask) (the-as uint 0)) 0 ) + (set! (-> obj reserved-mask) (the-as uint 0)) + 0 ) ) ) ) - (none) ) + (none) ) (defmethod grunt-mech-info-method-9 grunt-mech-info ((obj grunt-mech-info) (arg0 int) (arg1 process) (arg2 symbol)) - (with-pp - (grunt-mech-info-method-10 obj) - (let ((v1-2 *target*)) - (when (and v1-2 (focus-test? v1-2 mech) (not (logtest? (-> v1-2 focus-status) (focus-status dead ignore)))) - (let ((v1-8 (-> obj holds arg0))) - (when (and (!= (-> v1-8 grunt-handle) #f) (= (handle->process (-> v1-8 grunt-handle)) arg1)) - (set! (-> v1-8 timeout) (the-as uint (+ (-> pp clock frame-counter) (seconds 0.5)))) - (return #t) - ) - (when (not (logtest? (-> obj reserved-mask) (-> v1-8 reserve-mask))) - (when (not arg2) - (logior! (-> obj reserved-mask) (-> v1-8 reserve-mask)) - (set! (-> v1-8 grunt-handle) (process->handle arg1)) - (set! (-> v1-8 timeout) (the-as uint (+ (-> pp clock frame-counter) (seconds 0.5)))) - ) - #t + (grunt-mech-info-method-10 obj) + (let ((v1-2 *target*)) + (when (and v1-2 (focus-test? v1-2 mech) (not (logtest? (-> v1-2 focus-status) (focus-status dead ignore)))) + (let ((v1-8 (-> obj holds arg0))) + (when (and (!= (-> v1-8 grunt-handle) #f) (= (handle->process (-> v1-8 grunt-handle)) arg1)) + (set! (-> v1-8 timeout) (the-as uint (+ (current-time) (seconds 0.5)))) + (return #t) + ) + (when (not (logtest? (-> obj reserved-mask) (-> v1-8 reserve-mask))) + (when (not arg2) + (logior! (-> obj reserved-mask) (-> v1-8 reserve-mask)) + (set! (-> v1-8 grunt-handle) (process->handle arg1)) + (set! (-> v1-8 timeout) (the-as uint (+ (current-time) (seconds 0.5)))) ) + #t ) ) ) @@ -559,23 +555,21 @@ ;; WARN: Return type mismatch object vs none. (defmethod grunt-mech-method-191 grunt-mech ((obj grunt-mech)) - (with-pp - (if (>= (-> pp clock frame-counter) (-> obj state-timeout)) - (go (method-of-object obj mech-dismount)) - ) - (none) - ) + (if (>= (current-time) (-> obj state-timeout)) + (go (method-of-object obj mech-dismount)) + ) + (none) ) (defstate mech-hold (grunt-mech) :virtual #t :event (the-as (function process int symbol event-message-block object :behavior grunt-mech) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) (set! (-> self root-override2 root-prim prim-core collide-as) (collide-spec)) (stop-looking-at-target! self) - (set! (-> self state-timeout) (+ (-> self clock frame-counter) (get-rand-int-range self 450 900))) + (set! (-> self state-timeout) (+ (current-time) (get-rand-int-range self 450 900))) (logclear! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) (none) ) @@ -714,7 +708,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior grunt-mech) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self root-override2 root-prim prim-core collide-as) (collide-spec)) (let* ((v1-4 (-> self nav)) (a1-0 (-> self dismount-dest)) @@ -807,7 +801,7 @@ :event (the-as (function process int symbol event-message-block object :behavior grunt-mech) enemy-event-handler) :enter (behavior () ((-> (method-of-type grunt circling) enter)) - (set! (-> self state-timeout) (+ (-> self clock frame-counter) (get-rand-int-range self 750 1200))) + (set! (-> self state-timeout) (+ (current-time) (get-rand-int-range self 750 1200))) (none) ) :trans (behavior () @@ -818,9 +812,9 @@ ) (let ((gp-1 (-> self focus aware))) (if (or (!= gp-1 3) (not (get-enemy-target self))) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (when (>= 1 (the-as int gp-1)) (nav-enemy-method-161 self) (if (-> self enemy-info-override use-stop-chase) @@ -833,13 +827,13 @@ (when v1-33 (cond ((focus-test? v1-33 mech) - (when (>= (-> self clock frame-counter) (-> self state-timeout)) + (when (>= (current-time) (-> self state-timeout)) (nav-enemy-method-161 self) (go-hostile self) ) ) (else - (when (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self starting-time)) (-> self reaction-time)) (nav-enemy-method-161 self) (go-hostile self) ) @@ -867,7 +861,7 @@ :event (the-as (function process int symbol event-message-block object :behavior grunt-mech) enemy-event-handler) :enter (behavior () ((-> (method-of-type grunt-mech mech-post-circling) enter)) - (set! (-> self state-timeout) (+ (-> self clock frame-counter) (get-rand-int-range self 900 1800))) + (set! (-> self state-timeout) (+ (current-time) (get-rand-int-range self 900 1800))) (none) ) :trans (-> (method-of-type grunt-mech mech-post-circling) trans) diff --git a/goal_src/jak2/engine/target/mech_suit/mech-states.gc b/goal_src/jak2/engine/target/mech_suit/mech-states.gc index 647af0d262..bfba3d2cd3 100644 --- a/goal_src/jak2/engine/target/mech_suit/mech-states.gc +++ b/goal_src/jak2/engine/target/mech_suit/mech-states.gc @@ -62,7 +62,7 @@ ) 1820.4445 ) - (>= (- (-> self clock frame-counter) (-> self control time-of-last-zero-input)) (seconds 0.05)) + (>= (- (current-time) (-> self control time-of-last-zero-input)) (seconds 0.05)) ) ) (go target-mech-walk) @@ -354,7 +354,7 @@ *null-vector* *null-vector* (the-as process #f) - (-> self clock frame-counter) + (current-time) ) (let* ((s4-0 (get-trans self 3)) (a0-4 (the-as process-focusable (combo-tracker-method-13 @@ -523,7 +523,7 @@ ) (when (send-event-function (-> s4-1 cshape process) a1-6) (set! (-> self control send-attack-dest) (process->handle s5-2)) - (set! (-> self control send-attack-time) (-> self clock frame-counter)) + (set! (-> self control send-attack-time) (current-time)) #t ) ) @@ -535,7 +535,7 @@ (set! (-> self mech forward-vel) 0.0) (set! (-> self mech forward-vel) -40960.0) ) - (when (or (not s5-2) (= (-> self control send-attack-time) (-> self clock frame-counter))) + (when (or (not s5-2) (= (-> self control send-attack-time) (current-time))) (let ((s5-3 (get-process *default-dead-pool* part-tracker #x4000))) (when s5-3 (let ((t9-7 (method-of-type part-tracker activate))) @@ -583,7 +583,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *mech-punch-mods*) (set! (-> self mech state-impact? 0) #f) (rot->dir-targ! (-> self control)) @@ -592,7 +592,7 @@ :exit (behavior () (set! (-> *mech-punch-mods* turnvv) 0.0) (set! (-> self mech state-impact? 0) #f) - (set! (-> self control last-running-attack-end-time) (-> self clock frame-counter)) + (set! (-> self control last-running-attack-end-time) (current-time)) (target-exit) (target-mech-exit) (none) @@ -685,14 +685,14 @@ ) (+! gp-0 1) (target-mech-punch-pick (the-as symbol gp-0)) - (set! (-> self state-time) (+ (-> self clock frame-counter) (seconds -0.465))) + (set! (-> self state-time) (+ (current-time) (seconds -0.465))) (set! (-> self mech forward-vel) (fmax 0.0 (-> self mech forward-vel))) (set! s4-0 159) (set! s5-0 #f) ) ) ) - (let ((v1-142 (- (-> self clock frame-counter) (-> self state-time))) + (let ((v1-142 (- (current-time) (-> self state-time))) (s3-2 #t) (f30-4 1.0) ) @@ -746,9 +746,8 @@ ) ) ) - (set! s3-2 (and (>= (- (-> self clock frame-counter) (-> self state-time)) s4-0) - (and (>= (-> self mech forward-vel) 0.0) s3-2) - ) + (set! s3-2 + (and (>= (- (current-time) (-> self state-time)) s4-0) (and (>= (-> self mech forward-vel) 0.0) s3-2)) ) (set! (-> self mech state-impact? 0) s3-2) (set-forward-vel (-> self mech forward-vel)) @@ -782,7 +781,7 @@ ) ) :enter (behavior ((arg0 symbol)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *mech-jump-mods*) (set! (-> self mech jump-thrust) 0.0) (let* ((v1-4 *game-info*) @@ -811,7 +810,7 @@ ) (when (if (and (and v1-9 (= v1-9 (-> self draw art-group data 330))) (< f0-0 (-> *TARGET-bank* stuck-distance)) - (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (and (>= (- (current-time) (-> self state-time)) (seconds 2)) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) ) @@ -852,11 +851,7 @@ (set! (-> self mech thruster-flame-length) 20480.0) ) ) - (seek! - (-> self mech jump-thrust-fuel) - 0.0 - (the float (- (-> self clock frame-counter) (-> self clock old-frame-counter))) - ) + (seek! (-> self mech jump-thrust-fuel) 0.0 (the float (- (current-time) (-> self clock old-frame-counter)))) ) (else (seek! (-> self mech jump-thrust) 0.0 (* 491520.0 (-> self clock seconds-per-frame))) @@ -918,7 +913,7 @@ (defstate target-mech-jump (target) :event (-> target-mech-falling event) :enter (behavior ((arg0 float) (arg1 float) (arg2 surface)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (let* ((v1-4 *game-info*) (a2-5 (+ (-> v1-4 attack-id) 1)) @@ -960,7 +955,7 @@ (-> v1-0 id) ) (set! (-> self mech jump-thrust-fuel) (-> *TARGET-bank* mech-jump-thrust-fuel)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (cond ((= arg0 'stuck) ) @@ -992,7 +987,7 @@ (if (and (cpad-pressed? (-> self control cpad number) circle square) (can-hands? #t)) (go target-mech-punch) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.25)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.25)) (if (move-legs?) (go target-mech-walk) ) @@ -1043,7 +1038,7 @@ :trans (behavior () (when (= *cheat-mode* 'debug) (when (and (not *pause-lock*) (cpad-hold? (-> self control cpad number) r2)) - (set! (-> self control time-of-last-debug-heal) (-> self clock frame-counter)) + (set! (-> self control time-of-last-debug-heal) (current-time)) (pickup-collectable! (-> self fact-override) (pickup-type health) 100.0 (the-as handle #f)) (go target-mech-stance) ) @@ -1052,7 +1047,7 @@ ) :code (behavior ((arg0 symbol) (arg1 attack-info)) (logclear! (-> self water flags) (water-flags jump-out)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (-> self attack-info)) (s5-0 (new 'stack-no-clear 'vector)) ) @@ -1099,7 +1094,7 @@ (cond ((= arg0 'attack) (logior! (-> self focus-status) (focus-status hit)) - (set! (-> self game hit-time) (-> self clock frame-counter)) + (set! (-> self game hit-time) (current-time)) (case (-> gp-0 mode) (('endlessfall) (cond @@ -1107,8 +1102,8 @@ (let ((s4-1 (new-stack-vector0))) (set! (-> s4-1 quad) (-> self control last-trans-on-ground quad)) (ja-channel-set! 0) - (let ((s3-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-1) (seconds 1)) + (let ((s3-1 (current-time))) + (until (>= (- (current-time) s3-1) (seconds 1)) (suspend) ) ) @@ -1251,8 +1246,8 @@ ) (ja-channel-push! 1 (seconds 0.3)) (ja-no-eval :group! (-> self draw art-group data 330) :num! (loop! 0.5) :frame-num 0.0) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.8)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 0.8)) (ja :group! (-> self draw art-group data 330) :num! (loop! 0.5)) (suspend) ) @@ -1382,8 +1377,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-9 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-9) (seconds 2)) + (let ((gp-9 (current-time))) + (until (>= (- (current-time) gp-9) (seconds 2)) (suspend) ) ) @@ -1394,7 +1389,7 @@ (if (!= (-> self game mode) 'play) (go target-jump 16384.0 16384.0 (the-as surface #f)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sleep-code) (none) ) @@ -1486,7 +1481,7 @@ :enter (behavior () (set! (-> self control mod-surface) *mech-pickup-mods*) (set! (-> self mech stick-off) (the-as basic #t)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-forward-vel 0.0) (set! (-> self carry other) (the-as handle #f)) (set! (-> self carry other-value) 100000000000.0) @@ -1733,7 +1728,7 @@ ) :enter (behavior () (set! (-> self control mod-surface) *mech-walk-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-forward-vel 0.0) (set! (-> self mech stick-off) (the-as basic #t)) (none) @@ -1900,7 +1895,7 @@ (set! (-> self control mod-surface turnvv) 20024.889) (set! (-> self control did-move-to-pole-or-max-jump-height) 0.0) (rot->dir-targ! (-> self control)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -1915,13 +1910,13 @@ ) 1820.4445 ) - (>= (- (-> self clock frame-counter) (-> self control time-of-last-zero-input)) (seconds 0.05)) + (>= (- (current-time) (-> self control time-of-last-zero-input)) (seconds 0.05)) ) ) (go target-mech-carry-walk) ) (if (and (cpad-pressed? (-> self control cpad number) r1) - (>= (- (-> self clock frame-counter) (-> self carry pickup-time)) (seconds 0.1)) + (>= (- (current-time) (-> self carry pickup-time)) (seconds 0.1)) ) (go target-mech-carry-drop) ) @@ -1995,7 +1990,7 @@ (defstate target-mech-carry-walk (target) :event (-> target-mech-carry-stance event) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *mech-carry-walk-mods*) (set! (-> self control unknown-word04) (the-as uint 0.0)) (none) @@ -2019,7 +2014,7 @@ ) ) (if (and (cpad-pressed? (-> self control cpad number) r1) - (>= (- (-> self clock frame-counter) (-> self carry pickup-time)) (seconds 0.1)) + (>= (- (current-time) (-> self carry pickup-time)) (seconds 0.1)) ) (go target-mech-carry-drop) ) @@ -2107,9 +2102,7 @@ (case event-type (('push) (when (zero? (-> self control sliding-start-time)) - (set! (-> self control sliding-start-time) - (+ (-> self clock frame-counter) (the-as time-frame (-> event param 0))) - ) + (set! (-> self control sliding-start-time) (+ (current-time) (the-as time-frame (-> event param 0)))) (let ((v0-0 (the-as object #t))) (set! (-> self control unknown-word04) (the-as uint v0-0)) v0-0 @@ -2129,7 +2122,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control sliding-start-time) 0) (set! (-> self control unknown-word04) (the-as uint #f)) (set! (-> self control mod-surface) *mech-carry-drag-mods*) @@ -2163,7 +2156,7 @@ ) :trans (behavior () (when (and (not (cpad-hold? (-> self control cpad number) r1)) - (>= (- (-> self clock frame-counter) (-> self carry pickup-time)) (seconds 0.5)) + (>= (- (current-time) (-> self carry pickup-time)) (seconds 0.5)) ) (sound-play "mech-drag-off") (if (or (and (>= (-> self mech back-touch-time) (-> self state-time)) @@ -2216,9 +2209,7 @@ ) (f26-0 0.0) ) - (if (and (nonzero? (-> self control sliding-start-time)) - (< (-> self control sliding-start-time) (-> self clock frame-counter)) - ) + (if (and (nonzero? (-> self control sliding-start-time)) (< (-> self control sliding-start-time) (current-time))) (send-event self 'drop) (set! f28-0 (cond @@ -2345,7 +2336,7 @@ ) :enter (behavior () (set! (-> self control mod-surface) *mech-carry-jump-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (-> target-mech-carry-pickup exit) @@ -2354,7 +2345,7 @@ (go target-mech-carry-hit-ground #f) ) (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (>= (- (current-time) (-> self state-time)) (seconds 0.05)) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) #t @@ -2468,7 +2459,7 @@ (defstate target-mech-carry-jump (target) :event (-> target-mech-carry-falling event) :enter (behavior ((arg0 float) (arg1 float)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control mod-surface) *mech-carry-jump-mods*) @@ -2543,7 +2534,7 @@ :event (-> target-mech-carry-drop event) :enter (behavior () (set! (-> self control mod-surface) *mech-walk-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-forward-vel 0.0) (set! (-> self mech stick-off) (the-as basic #t)) (none) diff --git a/goal_src/jak2/engine/target/mech_suit/mech.gc b/goal_src/jak2/engine/target/mech_suit/mech.gc index 30fbf35b7c..278e2b294e 100644 --- a/goal_src/jak2/engine/target/mech_suit/mech.gc +++ b/goal_src/jak2/engine/target/mech_suit/mech.gc @@ -152,7 +152,7 @@ (let ((f30-0 20480.0)) (until #f (when (and (logtest? (-> self draw status) (draw-control-status on-screen)) - (>= (- (-> self clock frame-counter) (-> self probe-time)) (seconds 1)) + (>= (- (current-time) (-> self probe-time)) (seconds 1)) ) (move-to-ground (-> self root-override) @@ -161,7 +161,7 @@ #t (collide-spec backgnd obstacle hit-by-player-list hit-by-others-list pusher) ) - (set! (-> self probe-time) (-> self clock frame-counter)) + (set! (-> self probe-time) (current-time)) ) (when (and (and *target* (and (>= f30-0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))) @@ -268,8 +268,8 @@ (mech-method-24 self) (suspend) ) - (let ((s5-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-0) (seconds 1)) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) (seconds 1)) (mech-method-24 self) (suspend) ) @@ -419,7 +419,7 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('look-at-point) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (go-virtual active) ) ) @@ -453,7 +453,7 @@ This commonly includes things such as: :virtual #t :event (-> (method-of-type mech-target idle) event) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -463,7 +463,7 @@ This commonly includes things such as: ) (not (logtest? (focus-status mech) (-> *target* focus-status))) ) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 10)) + (>= (- (current-time) (-> self state-time)) (seconds 10)) ) (go-virtual idle) ) diff --git a/goal_src/jak2/engine/target/mech_suit/target-mech.gc b/goal_src/jak2/engine/target/mech_suit/target-mech.gc index 440ea7ece2..8da0fb2770 100644 --- a/goal_src/jak2/engine/target/mech_suit/target-mech.gc +++ b/goal_src/jak2/engine/target/mech_suit/target-mech.gc @@ -477,7 +477,7 @@ (defbehavior target-mech-get-off? target () (when (and (mech-on-ground?) - (< (-> self mech no-get-off-time) (-> self clock frame-counter)) + (< (-> self mech no-get-off-time) (current-time)) (-> *setting-control* user-current pilot-exit) ) (let ((gp-0 (new 'stack-no-clear 'collide-query)) @@ -771,7 +771,7 @@ ) ) (('target-mech-get-off) - (set! v0-0 (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 0)))) + (set! v0-0 (+ (current-time) (the-as time-frame (-> arg3 param 0)))) (set! (-> self mech no-get-off-time) (the-as time-frame v0-0)) v0-0 ) @@ -1121,9 +1121,9 @@ (set! (-> self board latch?) #f) (set! (-> self mech stick-lock) #f) (set! (-> self mech stick-off) #f) - (set! (-> self mech unstuck-time) (-> self clock frame-counter)) + (set! (-> self mech unstuck-time) (current-time)) (set! (-> self mech stuck-count) 0) - (set! (-> self mech mech-start-time) (-> self clock frame-counter)) + (set! (-> self mech mech-start-time) (current-time)) (set! (-> self mech jump-thrust) 0.0) (set! (-> self mech jump-thrust-fuel) (-> *TARGET-bank* mech-jump-thrust-fuel)) (set! (-> self mech state-impact? 0) #f) @@ -1625,7 +1625,7 @@ (let ((v1-98 (vector-! (new 'stack-no-clear 'vector) (-> self control wall-contact-pt) (-> self control trans)))) (set! (-> v1-98 y) 0.0) (when (< (vector-dot v1-98 (-> self control c-R-w vector 2)) 0.0) - (set! (-> self mech back-touch-time) (-> self clock frame-counter)) + (set! (-> self mech back-touch-time) (current-time)) (set! (-> self mech back-touch-point quad) (-> self control wall-contact-pt quad)) (set! (-> self mech back-touch-trans quad) (-> self control trans quad)) ) @@ -1760,7 +1760,7 @@ (quaternion-copy! (the-as quaternion (-> self mech mech-quat)) (-> self control quat)) (set! (-> self mech mech-scale quad) (-> self control scale quad)) (vector+! (-> self alt-cam-pos) (-> self control camera-pos) (new 'static 'vector :y 4096.0 :w 1.0)) - (set! (-> self mech mech-time) (-> self clock frame-counter)) + (set! (-> self mech mech-time) (current-time)) (target-mech-effect) 0 (none) diff --git a/goal_src/jak2/engine/target/sidekick.gc b/goal_src/jak2/engine/target/sidekick.gc index 8d00e420d3..a8d997a7ff 100644 --- a/goal_src/jak2/engine/target/sidekick.gc +++ b/goal_src/jak2/engine/target/sidekick.gc @@ -73,7 +73,7 @@ ) ) ) - (when (>= (- (-> self clock frame-counter) (-> self special-anim-time)) (seconds 1)) + (when (>= (- (current-time) (-> self special-anim-time)) (seconds 1)) (set! (-> self special-anim-interp) 0.0) (set! (-> self special-anim-frame) 0.0) ) @@ -83,7 +83,7 @@ ) (case arg2 ((1) - (set! (-> self special-anim-time) (-> self clock frame-counter)) + (set! (-> self special-anim-time) (current-time)) (cond ((= (-> gp-0 control mod-surface name) 'spin) (set! (-> arg1 z) diff --git a/goal_src/jak2/engine/target/target-anim.gc b/goal_src/jak2/engine/target/target-anim.gc index ee6d44cd76..500b0777e5 100644 --- a/goal_src/jak2/engine/target/target-anim.gc +++ b/goal_src/jak2/engine/target/target-anim.gc @@ -596,9 +596,9 @@ (let ((v1-52 (ja-group))) (cond ((and v1-52 (= v1-52 (-> self draw art-group data 61))) - (let ((s5-0 (-> self clock frame-counter))) - (while (or (= arg0 -1) (< (- (-> self clock frame-counter) s5-0) arg0)) - (when (>= (- (-> self clock frame-counter) s5-0) (seconds 0.01)) + (let ((s5-0 (current-time))) + (while (or (= arg0 -1) (< (- (current-time) s5-0) arg0)) + (when (>= (- (current-time) s5-0) (seconds 0.01)) (let ((v1-62 (ja-group))) (when (not (and v1-62 (= v1-62 (-> self draw art-group data 27)))) (ja-channel-push! 1 (seconds 0.1)) @@ -646,10 +646,9 @@ ) ) (ja-no-eval :group! (-> self draw art-group data 27) :num! (loop!) :frame-num 0.0) - (let ((s5-1 (-> self clock frame-counter))) - (while (or (= arg0 -1) (and (< (- (-> self clock frame-counter) s5-1) arg0) - (not (logtest? (-> self control status) (collide-status on-surface))) - ) + (let ((s5-1 (current-time))) + (while (or (= arg0 -1) + (and (< (- (current-time) s5-1) arg0) (not (logtest? (-> self control status) (collide-status on-surface)))) ) (suspend) (ja :group! (-> self draw art-group data 27) :num! (loop!)) @@ -1111,7 +1110,7 @@ ) ) ) - (let ((s4-10 (-> self clock frame-counter)) + (let ((s4-10 (current-time)) (f24-2 (if (and (using-gun? self) (or (= (-> self gun gun-type) (pickup-type eco-yellow)) (= (-> self gun gun-type) (pickup-type eco-blue))) @@ -1121,7 +1120,7 @@ ) ) ) - (until (and (>= arg0 0) (>= (- (-> self clock frame-counter) s4-10) arg0)) + (until (and (>= arg0 0) (>= (- (current-time) s4-10) arg0)) (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))))) ) @@ -1331,7 +1330,7 @@ ) ) ) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.4))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.4))) (if (using-gun? self) (go target-high-jump @@ -1771,7 +1770,7 @@ (f1-1 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) ) (while (not (or (and (< (fabs (/ f0-11 (* 0.0033333334 f1-1))) 150.0) (< f1-1 0.0)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.7)) + (>= (- (current-time) (-> self state-time)) (seconds 1.7)) ) ) (quaternion-rotate-y! diff --git a/goal_src/jak2/engine/target/target-carry.gc b/goal_src/jak2/engine/target/target-carry.gc index 3162819590..3a9f5ae4b9 100644 --- a/goal_src/jak2/engine/target/target-carry.gc +++ b/goal_src/jak2/engine/target/target-carry.gc @@ -152,7 +152,7 @@ ) :enter (behavior () (set! (-> self control mod-surface) *walk-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-forward-vel 0.0) (set! (-> self carry other) (the-as handle #f)) (set! (-> self carry other-value) 100000000000.0) @@ -295,7 +295,7 @@ :event target-standard-event-handler :enter (behavior () (set! (-> self control mod-surface) *walk-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-forward-vel 0.0) (none) ) @@ -421,7 +421,7 @@ :event target-standard-event-handler :enter (behavior () (set! (-> self control mod-surface) *carry-walk-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -482,7 +482,7 @@ (defstate target-carry-walk (target) :event target-standard-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *carry-walk-mods*) (none) ) @@ -549,7 +549,7 @@ :event target-jump-event-handler :enter (behavior () (set! (-> self control mod-surface) *carry-jump-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -566,7 +566,7 @@ ) (when (if (and (< f0-0 (-> *TARGET-bank* stuck-distance)) (and (>= v1-12 0) - (>= (- (-> self clock frame-counter) (-> self state-time)) v1-12) + (>= (- (current-time) (-> self state-time)) v1-12) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) ) @@ -668,7 +668,7 @@ (defstate target-carry-jump (target) :event target-jump-event-handler :enter (behavior ((arg0 float) (arg1 float)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "jump" :vol 70) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) @@ -736,7 +736,7 @@ :event target-standard-event-handler :enter (behavior () (set! (-> self control mod-surface) *walk-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-forward-vel 0.0) (none) ) diff --git a/goal_src/jak2/engine/target/target-darkjak.gc b/goal_src/jak2/engine/target/target-darkjak.gc index ea5488fea1..cd496f7253 100644 --- a/goal_src/jak2/engine/target/target-darkjak.gc +++ b/goal_src/jak2/engine/target/target-darkjak.gc @@ -59,7 +59,7 @@ ) ) (or (and (not (and (focus-test? self dark) (nonzero? (-> self darkjak)))) - (and (>= (- (-> self clock frame-counter) (-> (the-as fact-info-target (-> self fact-override)) darkjak-start-time)) + (and (>= (- (current-time) (-> (the-as fact-info-target (-> self fact-override)) darkjak-start-time)) (seconds 0.05) ) (>= (-> self game eco-pill-dark) (-> *FACT-bank* eco-pill-dark-max-default)) @@ -114,7 +114,7 @@ ) (target-danger-set! (-> self control danger-mode) #f) (update-transforms (-> self control)) - (if (and (or (>= (- (-> self clock frame-counter) (-> (the-as fact-info-target (-> self fact-override)) darkjak-start-time)) + (if (and (or (>= (- (current-time) (-> (the-as fact-info-target (-> self fact-override)) darkjak-start-time)) (-> (the-as fact-info-target (-> self fact-override)) darkjak-effect-time) ) (not (-> *setting-control* user-current darkjak)) @@ -189,9 +189,9 @@ (set! (-> a3-7 w) 1.0) (t9-14 a0-43 (the-as vector a1-11) (the-as quaternion a2-8) a3-7) ) - ;; (set-darkjak-texture-morph! f30-0) + (set-darkjak-texture-morph! f30-0) (cond - ((and (= f30-0 0.0) (< (- (-> self clock frame-counter) (-> self teleport-time)) (seconds 0.5))) + ((and (= f30-0 0.0) (< (- (current-time) (-> self teleport-time)) (seconds 0.5))) (set! (-> self skel override 0) 0.00001) (set! (-> self skel override 41) 0.000001) ) @@ -315,12 +315,12 @@ (set! (-> self darkjak want-stage) (-> self darkjak stage)) (set! (-> self neck flex-blend) 0.0) (set! (-> self control mod-surface) *darkjak-trans-mods*) - (set! (-> self darkjak start-time) (-> self clock frame-counter)) + (set! (-> self darkjak start-time) (current-time)) (set! (-> self darkjak attack-count) (the-as uint 0)) (set! (-> self darkjak-giant-interp) 1.0) (set-setting! 'sound-flava #f 30.0 4) (set! (-> self focus-status) (logior (focus-status dark) (-> self focus-status))) - (set! (-> (the-as fact-info-target (-> self fact-override)) darkjak-start-time) (-> self clock frame-counter)) + (set! (-> (the-as fact-info-target (-> self fact-override)) darkjak-start-time) (current-time)) (set! (-> (the-as fact-info-target (-> self fact-override)) darkjak-effect-time) (seconds 20)) (if (logtest? (-> self darkjak stage) 16) (logior! (-> self state-flags) (state-flags sf4)) @@ -335,7 +335,7 @@ (let ((s5-0 0)) (while (not (logtest? (-> self control status) (collide-status on-surface))) (target-falling-anim-trans) - (+! s5-0 (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! s5-0 (- (current-time) (-> self clock old-frame-counter))) (if (>= s5-0 300) (go target-falling #f) ) @@ -468,7 +468,7 @@ (let ((gp-0 0)) (while (not (logtest? (-> self control status) (collide-status on-surface))) (target-falling-anim-trans) - (+! gp-0 (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! gp-0 (- (current-time) (-> self clock old-frame-counter))) (if (>= gp-0 300) (go target-falling #f) ) @@ -665,9 +665,9 @@ (and (focus-test? self dark) (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) 2)) (< sv-32 2) ) - (set! sv-40 (the-as int (-> self clock frame-counter))) + (set! sv-40 (the-as int (current-time))) ) - (when (>= (- (-> self clock frame-counter) (the-as time-frame sv-40)) (seconds 0.5)) + (when (>= (- (current-time) (the-as time-frame sv-40)) (seconds 0.5)) (set! sv-40 0) 0 ) @@ -697,7 +697,7 @@ (-> self control trans) (get-trans s4-0 3) s4-0 - (-> self clock frame-counter) + (current-time) ) ) (target-start-attack) @@ -736,13 +736,13 @@ (cond ((and (>= (ja-frame-num 0) 20.0) (and (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> 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)) ) - (>= (- (-> self clock frame-counter) (-> self control sliding-start-time)) (seconds 0.04)) + (>= (- (current-time) (-> self control sliding-start-time)) (seconds 0.04)) ) ) (go target-falling #f) @@ -762,10 +762,8 @@ ) (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)) - (< (- (-> self clock frame-counter) (the-as time-frame sv-64)) (seconds 0.1)) - ) - (>= (- (-> self clock frame-counter) (the-as time-frame sv-64)) (seconds 1)) + (or (and (= gp-0 (handle->process sv-56)) (< (- (current-time) (the-as time-frame sv-64)) (seconds 0.1))) + (>= (- (current-time) (the-as time-frame sv-64)) (seconds 1)) ) ) (forward-up-nopitch->quaternion @@ -779,9 +777,7 @@ (new 'stack-no-clear 'vector) (-> self control trans) s5-1 - (* 0.009107469 - (the float (- (-> self clock frame-counter) (-> self control unknown-combo-tracker00 move-start-time))) - ) + (* 0.009107469 (the float (- (current-time) (-> self control unknown-combo-tracker00 move-start-time)))) ) ) ) @@ -792,7 +788,7 @@ ) (when (!= gp-0 (handle->process sv-56)) (set! sv-56 (process->handle gp-0)) - (set! sv-64 (the-as int (-> self clock frame-counter))) + (set! sv-64 (the-as int (current-time))) ) ) ) @@ -801,13 +797,13 @@ (set-forward-vel sv-16) ) ((and (nonzero? (-> self control unknown-time-frame18)) - (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame18)) (seconds 0.04)) + (>= (- (current-time) (-> 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) - (>= (- (-> self clock frame-counter) (-> self control unknown-combo-tracker00 move-start-time)) (seconds 0.2)) + (>= (- (current-time) (-> 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)))) @@ -949,7 +945,7 @@ ) (suspend) (ja :num! (seek! max (* (-> self control current-surface align-speed) (the-as float sv-48)))) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (set! (-> *run-attack-mods* turnvv) 0.0) ) (if (< 2 sv-24) @@ -958,7 +954,7 @@ (set! sv-24 (+ sv-24 1)) ) (if (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> 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))) @@ -1801,11 +1797,11 @@ ) ) (set! sv-64 0) - (set! sv-72 (-> self clock frame-counter)) - (set! sv-80 (-> self clock frame-counter)) + (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 (-> self clock frame-counter)) + (set! sv-96 (current-time)) (let* ((v1-70 (-> self game)) (a0-33 (+ (-> v1-70 attack-id) 1)) ) @@ -1815,7 +1811,7 @@ (ja-channel-push! 2 (seconds 0.05)) (ja :group! (-> self draw art-group data 419)) (ja :chan 1 :group! (-> self draw art-group data 420)) - (while (or (< sv-64 sv-48) (< (- (-> self clock frame-counter) sv-80) (seconds 1.5))) + (while (or (< sv-64 sv-48) (< (- (current-time) 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 @@ -1835,11 +1831,11 @@ (set! (-> self darkjak clock-vel) -4.0) (set! (-> self darkjak clock-on) #t) (send-event *camera* 'joystick -1098907648 #x3f800000) - (when (>= (- (-> self clock frame-counter) sv-72) (seconds 0.1)) - (set! sv-72 (-> self clock frame-counter)) + (when (>= (- (current-time) 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 (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (>= (- (current-time) (-> self state-time)) (seconds 1)) (set! sv-92 1.0) ) ) @@ -1872,7 +1868,7 @@ (suspend) (ja :num! (seek!)) ) - (set! (-> self gun surpress-time) (-> self clock frame-counter)) + (set! (-> self gun surpress-time) (current-time)) (send-event (handle->process (-> self notify)) 'notify 'attack 17) (go target-darkjak-get-off) (none) diff --git a/goal_src/jak2/engine/target/target-death.gc b/goal_src/jak2/engine/target/target-death.gc index de3c52aac4..22f86f100e 100644 --- a/goal_src/jak2/engine/target/target-death.gc +++ b/goal_src/jak2/engine/target/target-death.gc @@ -96,7 +96,7 @@ (apply-settings *setting-control*) (logclear! (-> self focus-status) (focus-status teleporting)) (set! (-> self mode-cache) #f) - (set! (-> self teleport-time) (-> self clock frame-counter)) + (set! (-> self teleport-time) (current-time)) (set! (-> self control last-trans-any-surf quad) (-> self control trans quad)) (set! (-> self game kiosk-timeout) (the-as uint (-> *display* game-clock frame-counter))) (none) @@ -105,7 +105,7 @@ (local-vars (v1-96 symbol)) (set! *spawn-actors* #f) (set! (-> self control unknown-word04) (the-as uint #f)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self focus-status) (logior (focus-status teleporting) (-> self focus-status))) (let ((a0-3 (get-continue-by-name (-> self game) (-> arg0 name)))) (cond @@ -300,8 +300,8 @@ ) ) ) - (let ((s5-6 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-6) (seconds 0.05)) + (let ((s5-6 (current-time))) + (until (>= (- (current-time) s5-6) (seconds 0.05)) (suspend) ) ) @@ -327,8 +327,8 @@ (intro-play) ) ((logtest? (-> arg0 flags) (continue-flags cf7)) - (let ((s5-7 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-7) (seconds 0.05)) + (let ((s5-7 (current-time))) + (until (>= (- (current-time) s5-7) (seconds 0.05)) (suspend) ) ) @@ -361,8 +361,8 @@ (go target-grab 'stance) ) (else - (let ((s5-9 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-9) (seconds 0.05)) + (let ((s5-9 (current-time))) + (until (>= (- (current-time) s5-9) (seconds 0.05)) (suspend) ) ) @@ -674,7 +674,7 @@ (if (and (cpad-pressed? (-> self control cpad number) square) (and (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 26624.0) (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - (and (>= (- (-> self clock frame-counter) (-> self control last-time-of-stuck)) + (and (>= (- (current-time) (-> self control last-time-of-stuck)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) (not (logtest? (-> self state-flags) (state-flags prevent-attack))) @@ -698,7 +698,7 @@ ) ) (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) - (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> *TARGET-bank* stuck-time))) + (and (>= (- (current-time) (-> self state-time)) (the-as time-frame (-> *TARGET-bank* stuck-time))) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) ) @@ -953,7 +953,7 @@ :trans (behavior () (when (= *cheat-mode* 'debug) (when (and (not *pause-lock*) (cpad-hold? (-> self control cpad number) r2)) - (set! (-> self control time-of-last-debug-heal) (-> self clock frame-counter)) + (set! (-> self control time-of-last-debug-heal) (current-time)) (pickup-collectable! (-> self fact-override) (pickup-type health) 100.0 (the-as handle #f)) (go target-stance) ) @@ -963,7 +963,7 @@ :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! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self neck flex-blend) 0.0) (set! sv-32 (-> self attack-info)) (set! sv-36 (new 'stack-no-clear 'vector)) @@ -1018,7 +1018,7 @@ ((= arg0 'attack) (send-event (handle->process (-> self notify)) 'notify 'hit (-> sv-32 mode)) (logior! (-> self focus-status) (focus-status hit)) - (set! (-> self game hit-time) (-> self clock frame-counter)) + (set! (-> self game hit-time) (current-time)) (case (-> sv-32 mode) (('endlessfall) (cond @@ -1026,8 +1026,8 @@ (let ((gp-1 (new-stack-vector0))) (set! (-> gp-1 quad) (-> self control last-trans-on-ground quad)) (ja-channel-set! 0) - (let ((s5-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-1) (seconds 1)) + (let ((s5-1 (current-time))) + (until (>= (- (current-time) s5-1) (seconds 1)) (suspend) ) ) @@ -1475,7 +1475,7 @@ (the-as game-save #f) (the-as string #f) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sleep-code) 0 (none) @@ -1667,8 +1667,8 @@ (set! (-> self post-hook) target-no-ja-move-post) (ja-channel-set! 0) (ja-post) - (let ((s5-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-3) (seconds 2)) + (let ((s5-3 (current-time))) + (until (>= (- (current-time) s5-3) (seconds 2)) (suspend) ) ) @@ -1748,7 +1748,7 @@ (ja :num! (seek!)) ) (while (not (or (logtest? (-> self control status) (collide-status on-surface)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (>= (- (current-time) (-> self state-time)) (seconds 2)) ) ) (suspend) @@ -1788,8 +1788,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((s5-7 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-7) (seconds 2)) + (let ((s5-7 (current-time))) + (until (>= (- (current-time) s5-7) (seconds 2)) (suspend) ) ) @@ -1841,8 +1841,8 @@ (set! (-> self post-hook) target-no-ja-move-post) (ja-channel-set! 0) (ja-post) - (let ((s5-10 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-10) (seconds 2)) + (let ((s5-10 (current-time))) + (until (>= (- (current-time) s5-10) (seconds 2)) (suspend) ) ) @@ -1861,8 +1861,8 @@ (set! (-> self post-hook) target-no-ja-move-post) (ja-channel-set! 0) (ja-post) - (let ((s5-11 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-11) (seconds 1.2)) + (let ((s5-11 (current-time))) + (until (>= (- (current-time) s5-11) (seconds 1.2)) (suspend) ) ) @@ -1903,8 +1903,8 @@ (target-falling-anim 30 (seconds 0.33)) (ja-channel-push! 1 (seconds 0.3)) (ja-no-eval :group! (-> self draw art-group data 32) :num! (loop! 0.5) :frame-num 0.0) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.8)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.8)) (when (and (logtest? (-> self control status) (collide-status on-surface)) (!= (-> self control cur-pat event) 2)) (set! v1-24 'target-hit-ground-hard) (goto cfg-17) @@ -1952,8 +1952,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 2)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 2)) (suspend) ) ) @@ -2064,8 +2064,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((s5-13 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-13) (seconds 2)) + (let ((s5-13 (current-time))) + (until (>= (- (current-time) s5-13) (seconds 2)) (suspend) ) ) @@ -2088,7 +2088,7 @@ (let ((gp-0 0)) (while (not (logtest? (-> self control status) (collide-status on-surface))) (target-falling-anim-trans) - (+! gp-0 (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! gp-0 (- (current-time) (-> self clock old-frame-counter))) (if (-> self control unknown-spool-anim00) (return #f) ) diff --git a/goal_src/jak2/engine/target/target-gun.gc b/goal_src/jak2/engine/target/target-gun.gc index e7745b0d5f..ff2ab1b8f1 100644 --- a/goal_src/jak2/engine/target/target-gun.gc +++ b/goal_src/jak2/engine/target/target-gun.gc @@ -85,9 +85,7 @@ (set! (-> arg0 turnvf) f0-15) ) (cond - ((and (nonzero? (-> self gun track-target-hold-time)) - (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) - ) + ((and (nonzero? (-> self gun track-target-hold-time)) (< (current-time) (-> self gun track-target-hold-time))) (set! (-> arg0 turnvv) 0.0) (set! (-> arg0 turnvvf) 0.0) (set! (-> arg0 seek0) 0.0) @@ -209,7 +207,7 @@ (set! (-> self gun top-anim-twist-reset) (the-as uint 0)) (set! (-> gp-0 gun-type) (pickup-type eco-yellow)) (target-gun-type-set! arg0) - (set! (-> gp-0 gun-get-on-time) (-> self clock frame-counter)) + (set! (-> gp-0 gun-get-on-time) (current-time)) ) (set! (-> self board latch?) #f) (set! (-> self gun put-away?) #f) @@ -1178,7 +1176,7 @@ (set! (-> self gun track?) (logand -9 (-> self gun track?))) ) (let ((gp-0 (the-as basic #f))) - (when (and (or (< (- (-> self clock frame-counter) (-> self control time-of-last-nonzero-input)) (seconds 0.2)) + (when (and (or (< (- (current-time) (-> self control time-of-last-nonzero-input)) (seconds 0.2)) (and (logtest? (-> self control mod-surface flags) (surface-flag air)) (not (logtest? (-> self control status) (collide-status on-surface))) ) @@ -1186,7 +1184,7 @@ (= (-> self gun gun-type) (pickup-type eco-dark)) ) ) - (>= (-> self clock frame-counter) (-> self gun track-target-hold-time)) + (>= (current-time) (-> self gun track-target-hold-time)) ) (target-gun-build-track-list) (let ((t2-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 8)))) @@ -1260,9 +1258,9 @@ (the-as focus (-> self gun track-target)) (the-as process-focusable gp-0) ) - (set! (-> self gun track-start-time) (-> self clock frame-counter)) - (if (< (- (-> self clock frame-counter) (-> self control time-of-last-nonzero-input)) (seconds 0.2)) - (set! (-> self gun track-press-start-time) (-> self clock frame-counter)) + (set! (-> self gun track-start-time) (current-time)) + (if (< (- (current-time) (-> self control time-of-last-nonzero-input)) (seconds 0.2)) + (set! (-> self gun track-press-start-time) (current-time)) ) ) (if (logtest? (process-mask enemy guard) (-> (the-as process-focusable gp-0) mask)) @@ -1274,9 +1272,7 @@ (cond ((or (not s5-1) (or (and (focus-test? (the-as process-focusable s5-1) dead) (zero? (-> self gun track-target-hold-time))) - (and (not (and (nonzero? (-> self gun track-target-hold-time)) - (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) - ) + (and (not (and (nonzero? (-> self gun track-target-hold-time)) (< (current-time) (-> self gun track-target-hold-time))) ) (and (not (logtest? (surface-flag spin) (-> self control current-surface flags))) (let ((f30-0 21845.334) @@ -1465,7 +1461,7 @@ ) (set! (-> self gun top-anim-low-high) 1.0) (if (zero? (-> self gun fire-pending)) - (set! (-> self gun fire-time) (-> self clock frame-counter)) + (set! (-> self gun fire-time) (current-time)) ) ) (((pickup-type eco-blue)) @@ -1513,8 +1509,8 @@ (defbehavior target-gun-combo-start target ((arg0 int) (arg1 time-frame)) (target-top-anim-base-mode arg0) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) arg0)) - (set! (-> self gun track-target-hold-time) (+ (-> self clock frame-counter) arg1)) + (set! (-> self gun surpress-time) (+ (current-time) arg0)) + (set! (-> self gun track-target-hold-time) (+ (current-time) arg1)) 0 (none) ) @@ -1523,14 +1519,14 @@ (if (!= (not (logtest? (-> self game features) (game-feature gun))) (not (-> self gun gun))) (target-gun-setup (logtest? (-> self game features) (game-feature gun))) ) - (if (and (>= (- (-> self clock frame-counter) (-> self gun combo-window-start)) (seconds 0.7)) + (if (and (>= (- (current-time) (-> self gun combo-window-start)) (seconds 0.7)) (zero? (-> self gun fire-pending)) ) (set! (-> self gun combo-window-state) #f) ) (cond ((and (cpad-pressed? (-> self control cpad number) r1) - (< (- (-> self clock frame-counter) (-> self gun combo-window-start)) (seconds 0.7)) + (< (- (current-time) (-> self gun combo-window-start)) (seconds 0.7)) (not (focus-test? self mech dark)) (not (logtest? (surface-flag gun-off) (-> self control current-surface flags))) (not (logtest? (state-flags prevent-gun) (-> self state-flags))) @@ -1556,7 +1552,7 @@ (-> self control trans) (get-trans (the-as process-focusable gp-0) 3) (the-as process-focusable gp-0) - (-> self clock frame-counter) + (current-time) ) ((method-of-type focus try-update-focus) (the-as focus (-> self gun track-target)) @@ -1568,7 +1564,7 @@ (if (zero? (-> self gun fire-pending)) (+! (-> self gun fire-pending) 1) ) - (set! (-> self gun fire-pending-time) (-> self clock frame-counter)) + (set! (-> self gun fire-pending-time) (current-time)) (target-gun-combo-start 20 (seconds 0.4)) (send-event self 'gun-combo #t) (case (-> self gun combo-window-state) @@ -1591,17 +1587,15 @@ (logtest? (surface-flag gun-turn-fast) (-> self control current-surface flags)) (not (logtest? (state-flags prevent-gun) (-> self state-flags))) (zero? (-> self gun track-target-hold-time)) - (or (zero? (-> self gun turn-fast-hold-time)) - (>= (-> self clock frame-counter) (-> self gun turn-fast-hold-time)) - ) + (or (zero? (-> self gun turn-fast-hold-time)) (>= (current-time) (-> self gun turn-fast-hold-time))) ) (if (zero? (-> self gun fire-pending)) (+! (-> self gun fire-pending) 1) ) - (set! (-> self gun fire-pending-time) (-> self clock frame-counter)) + (set! (-> self gun fire-pending-time) (current-time)) (target-top-anim-base-mode 60) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.2))) - (set! (-> self gun turn-fast-hold-time) (+ (-> self clock frame-counter) (seconds 0.2))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.2))) + (set! (-> self gun turn-fast-hold-time) (+ (current-time) (seconds 0.2))) (send-event self 'gun-combo #t) ) ) @@ -1612,14 +1606,14 @@ (if (zero? (-> self gun fire-pending)) (+! (-> self gun fire-pending) 1) ) - (set! (-> self gun fire-pending-time) (-> self clock frame-counter)) + (set! (-> self gun fire-pending-time) (current-time)) ) ) ) (cond ((using-gun? self) (when (and (nonzero? (-> self gun top-anim-twist-reset)) - (< (the-as time-frame (-> self gun top-anim-twist-reset)) (-> self clock frame-counter)) + (< (the-as time-frame (-> self gun top-anim-twist-reset)) (current-time)) ) (quat<-gun! (the-as quaternion (-> self gun top-anim-twist-targ)) (the-as quaternion (-> self gun gun-type))) (set! (-> self gun top-anim-twist-reset) (the-as uint 0)) @@ -1721,12 +1715,8 @@ (the-as vector #f) ) (cond - ((or (and (nonzero? (-> self gun track-target-hold-time)) - (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) - ) - (and (nonzero? (-> self gun turn-fast-hold-time)) - (< (-> self clock frame-counter) (-> self gun turn-fast-hold-time)) - ) + ((or (and (nonzero? (-> self gun track-target-hold-time)) (< (current-time) (-> self gun track-target-hold-time))) + (and (nonzero? (-> self gun turn-fast-hold-time)) (< (current-time) (-> self gun turn-fast-hold-time))) (and (logtest? (-> self gun track?) 1) (logtest? (-> self gun track?) 4)) (or (logtest? (surface-flag gun-strafe) (-> self control current-surface flags)) (focus-test? self pilot-riding) @@ -1789,7 +1779,7 @@ ((and (logtest? (-> self gun track?) 1) (logtest? (process-mask enemy guard) (-> (handle->process (-> self gun track-target 0 handle)) mask)) ) - (if (and (< (- (-> self clock frame-counter) (-> self gun track-press-start-time)) (seconds 0.5)) + (if (and (< (- (current-time) (-> self gun track-press-start-time)) (seconds 0.5)) (< (-> self control time-between-zero-inputs) (seconds 0.5)) (and (= (-> self control turn-to-magnitude) 0.0) (not (logtest? (-> self control current-surface flags) (surface-flag air attack))) @@ -1803,12 +1793,8 @@ ) ) (cond - ((or (and (nonzero? (-> self gun track-target-hold-time)) - (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) - ) - (and (nonzero? (-> self gun turn-fast-hold-time)) - (< (-> self clock frame-counter) (-> self gun turn-fast-hold-time)) - ) + ((or (and (nonzero? (-> self gun track-target-hold-time)) (< (current-time) (-> self gun track-target-hold-time))) + (and (nonzero? (-> self gun turn-fast-hold-time)) (< (current-time) (-> self gun turn-fast-hold-time))) ) (set! (-> self gun track?) (the-as uint 7)) (set! (-> self gun upper-body twist-max y) 21845.334) @@ -1874,7 +1860,7 @@ ) ) (set! (-> self gun upper-body track-mode) (the-as track-mode (-> self gun track?))) - (when (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 1.5)) + (when (< (- (current-time) (-> self gun fire-time)) (seconds 1.5)) (let ((v1-459 (-> self neck))) (set! (-> v1-459 blend) 0.0) ) @@ -1940,7 +1926,7 @@ (-> self draw art-group data 245) ) (else - (when (and (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 1.5)) + (when (and (>= (- (current-time) (-> self gun fire-time)) (seconds 1.5)) (let ((v1-50 (-> self skel top-anim frame-group))) (or (= v1-50 (-> self draw art-group data 247)) (= v1-50 (-> self draw art-group data 254))) ) @@ -1987,10 +1973,8 @@ (-> self draw art-group data 244) ) (else - (when (and (or (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 2.5)) - (and (< 4096.0 (-> self control ctrl-xz-vel)) - (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 1.25)) - ) + (when (and (or (>= (- (current-time) (-> self gun fire-time)) (seconds 2.5)) + (and (< 4096.0 (-> self control ctrl-xz-vel)) (>= (- (current-time) (-> self gun fire-time)) (seconds 1.25))) ) (let ((v1-104 (-> self skel top-anim frame-group))) (or (= v1-104 (-> self draw art-group data 294)) @@ -2020,9 +2004,7 @@ (let ((v1-119 (ja-group))) (cond ((and (and v1-119 (or (= v1-119 self) (= v1-119 (-> self draw art-group data 261)))) - (and (< (-> self gun top-anim-low-high) 0.5) - (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 0.2)) - ) + (and (< (-> self gun top-anim-low-high) 0.5) (>= (- (current-time) (-> self gun fire-time)) (seconds 0.2))) ) (let ((s5-2 (get-channel (-> self skel top-anim) 0))) (set! gp-0 (if (< 0.9 (-> self control unknown-float002)) @@ -2159,8 +2141,8 @@ ) (set! (-> self gun active?) (and (not (logtest? (surface-flag gun-inactive gun-hide gun-off) (-> self control current-surface flags))) - (and (>= (- (-> self clock frame-counter) (-> self gun gun-get-on-time)) (seconds 0.1)) - (>= (-> self clock frame-counter) (-> self gun surpress-time)) + (and (>= (- (current-time) (-> self gun gun-get-on-time)) (seconds 0.1)) + (>= (current-time) (-> self gun surpress-time)) (let ((v1-35 (-> self skel top-anim frame-group)) (f0-13 (-> self skel top-anim frame-num)) ) @@ -2227,19 +2209,19 @@ ) ) (if (-> self gun active?) - (set! (-> self gun active-time) (-> self clock frame-counter)) + (set! (-> self gun active-time) (current-time)) ) (set! (-> self gun laser-active?) (not (logtest? (surface-flag gun-inactive gun-hide gun-off laser-hide) (-> self control current-surface flags)) ) ) (when (and (not (and (not (logtest? (surface-flag gun-inactive gun-hide gun-off) (-> self control current-surface flags))) - (>= (- (-> self clock frame-counter) (-> self gun gun-get-on-time)) (seconds 0.1)) - (>= (-> self clock frame-counter) (-> self gun surpress-time)) + (>= (- (current-time) (-> self gun gun-get-on-time)) (seconds 0.1)) + (>= (current-time) (-> self gun surpress-time)) ) ) - (and (>= (- (-> self clock frame-counter) (-> self gun fire-pending-time)) (seconds 0.2)) - (>= (- (-> self clock frame-counter) (-> self gun active-time)) (seconds 0.2)) + (and (>= (- (current-time) (-> self gun fire-pending-time)) (seconds 0.2)) + (>= (- (current-time) (-> self gun active-time)) (seconds 0.2)) (= (-> self gun fire-pending) 1) ) ) @@ -2303,7 +2285,7 @@ ) ) ) - (>= (- (-> self clock frame-counter) (-> self gun gun-get-on-time)) (seconds 0.1)) + (>= (- (current-time) (-> self gun gun-get-on-time)) (seconds 0.1)) (let ((v1-110 (-> self skel top-anim frame-targ))) (or (not v1-110) (= v1-110 (-> self draw art-group data 304)) @@ -2489,7 +2471,7 @@ ) (set! (-> self gun top-anim-low-high) 0.0) ) - ((and (rand-vu-percent? 0.2) (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 2))) + ((and (rand-vu-percent? 0.2) (< (- (current-time) (-> self gun fire-time)) (seconds 2))) (push-anim-to-targ (-> self skel top-anim) (the-as art-joint-anim (-> self draw art-group data 293)) @@ -2505,7 +2487,7 @@ ) ) ((and (or (rand-vu-percent? 0.2) (= (-> self skel top-anim frame-targ) (-> self draw art-group data 256))) - (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 2)) + (< (- (current-time) (-> self gun fire-time)) (seconds 2)) ) (push-anim-to-targ (-> self skel top-anim) @@ -2622,23 +2604,23 @@ (set! (-> gp-0 combo-window-state) 'target-attack-air) ) (if (cpad-pressed? (-> self control cpad number) r1) - (set! (-> gp-0 fire-start-time) (-> self clock frame-counter)) + (set! (-> gp-0 fire-start-time) (current-time)) ) (case (-> gp-0 gun-control) ((1) (when (and (cpad-pressed? (-> self control cpad number) r1) - (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (-> self clock frame-counter) (-> gp-0 fire-time))) + (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (current-time) (-> gp-0 fire-time))) ) - (set! (-> gp-0 fire-pending-time) (-> self clock frame-counter)) + (set! (-> gp-0 fire-pending-time) (current-time)) (if (zero? (-> self gun fire-pending)) (+! (-> self gun fire-pending) 1) ) (set! (-> gp-0 fire-charge) 0.5) ) - (when (and (or (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) + (when (and (or (>= (- (current-time) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) (case (-> gp-0 combo-window-state) (('target-attack-air 'target-attack 'target-running-attack) - (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 combo-fire-delay))) + (>= (- (current-time) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 combo-fire-delay))) ) ) ) @@ -2648,7 +2630,7 @@ (seekl! (-> self gun fire-pending) 0 1) (cond ((send-event self 'gun (-> gp-0 gun-type)) - (set! (-> self gun fire-time) (-> self clock frame-counter)) + (set! (-> self gun fire-time) (current-time)) ) (else (set! (-> self gun fire-time) 0) @@ -2661,23 +2643,23 @@ ((2) (when (and (cpad-hold? (-> self control cpad number) r1) (and (not (handle->process (-> self gun charge-active?))) - (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (-> self clock frame-counter) (-> gp-0 fire-time))) + (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (current-time) (-> gp-0 fire-time))) ) ) - (set! (-> gp-0 fire-pending-time) (-> self clock frame-counter)) + (set! (-> gp-0 fire-pending-time) (current-time)) (if (zero? (-> self gun fire-pending)) (+! (-> self gun fire-pending) 1) ) (set! (-> gp-0 fire-charge) 0.5) ) - (when (and (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) + (when (and (>= (- (current-time) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) (> (-> gp-0 fire-pending) 0) (-> self gun active?) ) (seekl! (-> self gun fire-pending) 0 1) (cond ((send-event self 'gun (-> gp-0 gun-type)) - (set! (-> self gun fire-time) (-> self clock frame-counter)) + (set! (-> self gun fire-time) (current-time)) ) (else (set! (-> self gun fire-time) 0) @@ -2691,9 +2673,7 @@ (cond ((cpad-hold? (-> self control cpad number) r1) (seek! (-> gp-0 fire-spinv) 218453.33 (* 145635.56 (-> self clock seconds-per-frame))) - (if (and (nonzero? (-> self gun track-target-hold-time)) - (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) - ) + (if (and (nonzero? (-> self gun track-target-hold-time)) (< (current-time) (-> self gun track-target-hold-time))) (set! (-> gp-0 fire-spinv) 218453.33) ) ) @@ -2741,22 +2721,22 @@ ) (when (and (cpad-hold? (-> self control cpad number) r1) (-> self gun active?) - (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (-> self clock frame-counter) (-> gp-0 fire-time))) + (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (current-time) (-> gp-0 fire-time))) ) - (set! (-> gp-0 fire-pending-time) (-> self clock frame-counter)) + (set! (-> gp-0 fire-pending-time) (current-time)) (if (zero? (-> self gun fire-pending)) (+! (-> self gun fire-pending) 1) ) (set! (-> gp-0 fire-charge) 0.5) ) - (when (and (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) + (when (and (>= (- (current-time) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) (> (-> gp-0 fire-pending) 0) (-> self gun active?) ) (seekl! (-> self gun fire-pending) 0 1) (cond ((send-event self 'gun (-> gp-0 gun-type)) - (set! (-> self gun fire-time) (-> self clock frame-counter)) + (set! (-> self gun fire-time) (current-time)) ) (else (set! (-> self gun fire-time) 0) @@ -2795,7 +2775,7 @@ ) ) ) - (set! (-> gp-0 gun-time) (-> self clock frame-counter)) + (set! (-> gp-0 gun-time) (current-time)) ) ) 0 diff --git a/goal_src/jak2/engine/target/target-handler.gc b/goal_src/jak2/engine/target/target-handler.gc index ae33e91266..40868e17f5 100644 --- a/goal_src/jak2/engine/target/target-handler.gc +++ b/goal_src/jak2/engine/target/target-handler.gc @@ -272,7 +272,7 @@ ) (when sv-96 (set! (-> self control send-attack-dest) (process->handle arg0)) - (set! (-> self control send-attack-time) (-> self clock frame-counter)) + (set! (-> self control send-attack-time) (current-time)) (send-event self 'hit arg1 arg0 arg2) ;; TODO - manual fix? (set! arg0 (the process (and (and (logtest? (focus-status dark) (-> self focus-status)) @@ -293,7 +293,7 @@ (stack-size-set! (-> self main-thread) 512) ;; added (let ((gp-0 (-> self parent))) (let ((s4-0 0) - (s3-0 (-> self clock frame-counter)) + (s3-0 (current-time)) ) (set! (-> self clock) (-> gp-0 0 clock)) (while (let ((v1-48 gp-0)) @@ -326,7 +326,7 @@ ) ) ) - (< (- (-> self clock frame-counter) s3-0) (seconds 15)) + (< (- (current-time) s3-0) (seconds 15)) (not (logtest? (-> (the-as process-focusable (-> gp-0 0)) draw status) (draw-control-status no-draw no-draw-temp)) ) ) @@ -355,10 +355,10 @@ ) ) (send-event (ppointer->process gp-0) 'color-effect 'dark 60) - (when (>= (- (-> self clock frame-counter) (the-as time-frame s4-0)) (seconds 0.05)) - (set! s4-0 (the-as int (-> self clock frame-counter))) + (when (>= (- (current-time) (the-as time-frame s4-0)) (seconds 0.05)) + (set! s4-0 (the-as int (current-time))) (cond - ((and (< (- (-> self clock frame-counter) s3-0) (seconds 0.5)) (handle->process arg0)) + ((and (< (- (current-time) 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)) @@ -644,7 +644,7 @@ (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) ) ((= v1-37 'darkjak) - (set! (-> self darkjak attack-time) (-> self clock frame-counter)) + (set! (-> self darkjak attack-time) (current-time)) (let* ((v1-160 *game-info*) (a0-102 (+ (-> v1-160 attack-id) 1)) ) @@ -792,7 +792,7 @@ (('release) (when (and (nonzero? (-> self gun)) (handle->process (-> self gun charge-active?))) (set! (-> self gun charge-active?) (the-as handle #f)) - (set! v0-0 (-> self clock frame-counter)) + (set! v0-0 (current-time)) (set! (-> self gun fire-time) (the-as time-frame v0-0)) v0-0 ) @@ -812,7 +812,7 @@ ) (rot->dir-targ! (-> self control)) (logior! (-> self control status) (collide-status on-surface on-ground touch-surface)) - (set! v0-0 (-> self clock frame-counter)) + (set! v0-0 (current-time)) (set! (-> self control last-time-on-surface) (the-as time-frame v0-0)) v0-0 ) @@ -828,7 +828,7 @@ ) (('color-effect) (set! (-> self color-effect) (the-as basic (-> arg3 param 0))) - (set! (-> self color-effect-start-time) (-> self clock frame-counter)) + (set! (-> self color-effect-start-time) (current-time)) (set! v0-0 (-> arg3 param 1)) (set! (-> self color-effect-duration) (the-as uint v0-0)) v0-0 @@ -1006,14 +1006,12 @@ ) ) (('no-load-wait) - (set! v0-0 (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 0)))) + (set! v0-0 (+ (current-time) (the-as time-frame (-> arg3 param 0)))) (set! (-> self no-load-wait) (the-as uint v0-0)) v0-0 ) (('no-look-around) - (set! (-> self no-look-around-wait) - (the-as uint (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 0)))) - ) + (set! (-> self no-look-around-wait) (the-as uint (+ (current-time) (the-as time-frame (-> arg3 param 0))))) (if (and (-> self next-state) (= (-> self next-state name) 'target-look-around)) (send-event self 'end-mode) ) @@ -1107,18 +1105,18 @@ (.mul.x.vf vf1 vf1 vf2 :mask #b111) (.svf (&-> v1-15 quad) vf1) ) - (set! (-> self control additional-decaying-velocity-end-time) (-> self clock frame-counter)) + (set! (-> self control additional-decaying-velocity-end-time) (current-time)) (set! (-> self control additional-decaying-velocity-decay-start-time) - (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 1))) + (+ (current-time) (the-as time-frame (-> arg3 param 1))) ) (set! v0-0 #t) (b! #t cfg-291 :delay (nop!)) (label cfg-23) (b! (!= v1-0 'push-transv) cfg-25 :delay (nop!)) (set! (-> self control additional-decaying-velocity quad) (-> (the-as vector (-> arg3 param 0)) quad)) - (set! (-> self control additional-decaying-velocity-end-time) (-> self clock frame-counter)) + (set! (-> self control additional-decaying-velocity-end-time) (current-time)) (set! (-> self control additional-decaying-velocity-decay-start-time) - (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 1))) + (+ (current-time) (the-as time-frame (-> arg3 param 1))) ) (set! v0-0 #t) (b! #t cfg-291 :delay (nop!)) @@ -1133,7 +1131,7 @@ ) (or (logtest? (-> self state-flags) (state-flags sf1)) (focus-test? self dead dangerous hit grabbed in-head edge-grab pole flut tube board pilot mech) - (>= (the-as time-frame (-> self no-load-wait)) (-> self clock frame-counter)) + (>= (the-as time-frame (-> self no-load-wait)) (current-time)) ) ) ) @@ -1266,7 +1264,7 @@ ) ((logtest? (-> arg3 param 2) 128) (set! (-> self darkjak stage) (logand -2 (-> self darkjak stage))) - (set! v0-0 (+ (- (seconds 20) (-> self fact-override darkjak-start-time)) (-> self clock frame-counter))) + (set! v0-0 (+ (- (seconds 20) (-> self fact-override darkjak-start-time)) (current-time))) (set! (-> self fact-override darkjak-effect-time) (the-as time-frame v0-0)) v0-0 ) diff --git a/goal_src/jak2/engine/target/target-part.gc b/goal_src/jak2/engine/target/target-part.gc index 8c19de9411..0c32d3887e 100644 --- a/goal_src/jak2/engine/target/target-part.gc +++ b/goal_src/jak2/engine/target/target-part.gc @@ -2111,13 +2111,13 @@ (defbehavior process-drawable-burn-effect target ((arg0 time-frame)) (sound-play "get-burned") (let ((s5-1 (new 'stack 'rgbaf)) - (s3-0 (-> self clock frame-counter)) + (s3-0 (current-time)) (s4-1 (-> self parent)) ) (set! (-> s5-1 quad) (-> (the-as process-drawable (-> s4-1 0)) draw color-mult quad)) (let ((s2-1 (vector-float*! (the-as vector (new 'stack 'rgbaf)) (the-as vector s5-1) 0.0))) - (while (< (- (-> self clock frame-counter) s3-0) arg0) - (let ((v1-8 (- (-> self clock frame-counter) s3-0))) + (while (< (- (current-time) s3-0) arg0) + (let ((v1-8 (- (current-time) s3-0))) (if (< v1-8 (the-as time-frame (/ arg0 2))) (vector-lerp! (-> (the-as process-drawable (-> s4-1 0)) draw color-mult) @@ -2459,98 +2459,96 @@ (sv-736 int) (sv-752 lightning-tracker) ) - (with-pp - (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))) - ) - (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-640 arg6) + (let ((s5-0 *lightning-probe-vars*)) + (if (= arg4 256) (set! sv-656 arg4) - sv-656 + (set! sv-656 (rand-vu-int-range 3 (/ (+ (-> arg0 node-list length) -1) 2))) ) - (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! (-> s5-0 last-valid-time) (-> pp clock frame-counter)) - (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) - ) + (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! (-> s5-0 last-valid-time) (current-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) - ) - (-> s5-0 end-pos) - ) - (-> sv-752 ppointer-override) + ) + (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) + ) + (-> s5-0 end-pos) + ) + (-> sv-752 ppointer-override) ) - (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*) - ) - (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) - ) + ) + (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*) + ) + (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) ) ) ) ) - (the-as object 0) ) + (the-as object 0) ) ;; ERROR: function was not converted to expressions. Cannot decompile. diff --git a/goal_src/jak2/engine/target/target-swim.gc b/goal_src/jak2/engine/target/target-swim.gc index 154888c88c..a4d369cbd0 100644 --- a/goal_src/jak2/engine/target/target-swim.gc +++ b/goal_src/jak2/engine/target/target-swim.gc @@ -10,7 +10,7 @@ (defstate target-wade-stance (target) :event target-standard-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *wade-mods*) (set-zero! (-> self water bob)) (none) @@ -27,7 +27,7 @@ :trans (behavior () ((-> self state-hook)) (when (and (not (logtest? (water-flags wading) (-> self water flags))) - (>= (- (-> self clock frame-counter) (-> self water wade-time)) (seconds 0.05)) + (>= (- (current-time) (-> self water wade-time)) (seconds 0.05)) ) (if (logtest? (water-flags swimming) (-> self water flags)) (go target-swim-stance) @@ -81,7 +81,7 @@ :trans (behavior () ((-> self state-hook)) (when (and (not (logtest? (water-flags wading) (-> self water flags))) - (>= (- (-> self clock frame-counter) (-> self water wade-time)) (seconds 0.1)) + (>= (- (current-time) (-> self water wade-time)) (seconds 0.1)) ) (if (logtest? (water-flags swimming) (-> self water flags)) (go target-swim-stance) @@ -308,7 +308,7 @@ (ja :chan 2 :num! (chan 0)) (ja :chan 3 :num! (chan 0)) (ja :chan 4 :num! (chan 0)) - (when (and (>= (- (-> self clock frame-counter) (the-as time-frame gp-6)) (seconds 0.2)) + (when (and (>= (- (current-time) (the-as time-frame gp-6)) (seconds 0.2)) (< (- (-> self water height) (-> self control trans y)) 4096.0) ) (case (the int (ja-aframe-num 0)) @@ -321,7 +321,7 @@ (vector-float*! (new 'stack-no-clear 'vector) (-> self control transv) 2.5) #f ) - (set! gp-6 (the-as int (-> self clock frame-counter))) + (set! gp-6 (the-as int (current-time))) ) ((46 47 48 49) (spawn-ripples @@ -332,7 +332,7 @@ (vector-float*! (new 'stack-no-clear 'vector) (-> self control transv) 2.5) #f ) - (set! gp-6 (the-as int (-> self clock frame-counter))) + (set! gp-6 (the-as int (current-time))) ) ) ) @@ -379,7 +379,7 @@ (defstate target-swim-stance (target) :event target-standard-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *swim-mods*) (logior! (-> self water flags) (water-flags swim-ground)) (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) @@ -426,7 +426,7 @@ (set-zero! (-> self water bob)) ) (when (and (not (logtest? (water-flags swimming) (-> self water flags))) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (>= (- (current-time) (-> self state-time)) (seconds 0.1)) ) (if (logtest? (water-flags wading) (-> self water flags)) (go target-wade-stance) @@ -441,7 +441,7 @@ (pad-buttons x) ) (can-jump? #f) - (>= (- (-> self clock frame-counter) (-> self water enter-swim-time)) (seconds 0.1)) + (>= (- (current-time) (-> self water enter-swim-time)) (seconds 0.1)) ) (go target-swim-jump (-> *TARGET-bank* swim-jump-height-min) (-> *TARGET-bank* swim-jump-height-max)) ) @@ -535,7 +535,7 @@ :enter (behavior () ((-> target-swim-stance enter)) (die-on-next-update! (-> self water bob)) - (set! (-> self control unknown-word04) (the-as uint (-> self clock frame-counter))) + (set! (-> self control unknown-word04) (the-as uint (current-time))) (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) (none) ) @@ -548,7 +548,7 @@ (set-zero! (-> self water bob)) ) (when (and (not (logtest? (water-flags swimming) (-> self water flags))) - (>= (- (-> self clock frame-counter) (-> self water swim-time)) (seconds 0.1)) + (>= (- (current-time) (-> self water swim-time)) (seconds 0.1)) ) (if (logtest? (water-flags wading) (-> self water flags)) (go target-wade-stance) @@ -563,7 +563,7 @@ (pad-buttons x) ) (can-jump? #f) - (>= (- (-> self clock frame-counter) (-> self water enter-swim-time)) (seconds 0.1)) + (>= (- (current-time) (-> self water enter-swim-time)) (seconds 0.1)) ) (go target-swim-jump (-> *TARGET-bank* swim-jump-height-min) (-> *TARGET-bank* swim-jump-height-max)) ) @@ -582,14 +582,12 @@ ) (cond ((= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) - (if (>= (the-as uint (- (-> self clock frame-counter) (the-as int (-> self control unknown-word04)))) - (the-as uint 15) - ) + (if (>= (the-as uint (- (current-time) (the-as int (-> self control unknown-word04)))) (the-as uint 15)) (go target-swim-stance) ) ) (else - (set! (-> self control unknown-word04) (the-as uint (-> self clock frame-counter))) + (set! (-> self control unknown-word04) (the-as uint (current-time))) ) ) (target-swim-tilt 0.0 2.0 0.0 1.0) @@ -697,13 +695,13 @@ (target-standard-event-handler proc arg1 event-type event) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) (logclear! (-> self water flags) (water-flags swim-ground)) (set! (-> self control mod-surface) *dive-mods*) (set! (-> self control dynam gravity-max) 16384.0) (set! (-> self control dynam gravity-length) 16384.0) - (set! (-> self water swim-time) (-> self clock frame-counter)) + (set! (-> self water swim-time) (current-time)) (set! (-> self control unknown-word04) (the-as uint #f)) (set! (-> self neck flex-blend) 0.0) (none) @@ -743,11 +741,11 @@ (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self water swim-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self water swim-time)) (seconds 0.5)) (go target-stance) ) (cond - ((>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.1)) + ((>= (- (current-time) (-> self control last-time-on-surface)) (seconds 0.1)) (set! (-> self control mod-surface) *dive-mods*) (if (and (-> self next-state) (= (-> self next-state name) 'target-swim-down)) (target-swim-tilt -0.9 1.0 0.0 0.5) @@ -834,21 +832,21 @@ ) ) (until #f - (when (and (!= (-> self tobot?) 'tobot) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05))) + (when (and (!= (-> self tobot?) 'tobot) (>= (- (current-time) (-> self state-time)) (seconds 0.05))) (if (and (or (not (cpad-hold? (-> self control cpad number) circle square)) (-> self control unknown-spool-anim00)) - (>= (- (-> self clock frame-counter) (-> self state-time)) gp-0) + (>= (- (current-time) (-> self state-time)) gp-0) ) (go target-swim-up) ) - (if (or (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame27)) s5-0) + (if (or (>= (- (current-time) (-> self control unknown-time-frame27)) s5-0) (and (logtest? (-> self control status) (collide-status on-surface)) - (and (< (-> self water swim-depth) 8192.0) (>= (- (-> self clock frame-counter) (-> self state-time)) gp-0)) + (and (< (-> self water swim-depth) 8192.0) (>= (- (current-time) (-> self state-time)) gp-0)) ) ) (go target-swim-up) ) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (sound-play "water-bubbles" :id (-> self control bubbles-sound)) ) (let ((s4-3 (new-stack-vector0)) @@ -897,7 +895,7 @@ (the-as surface #f) ) ) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 10)) + (when (and (>= (- (current-time) (-> self state-time)) (seconds 10)) (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) ) (let ((a1-3 (new 'stack-no-clear 'event-message-block))) @@ -919,11 +917,11 @@ ) ) (if (and (cpad-pressed? (-> self control cpad number) circle square) - (or (< (- (-> self clock frame-counter) (-> self control unknown-time-frame27)) (seconds 10)) + (or (< (- (current-time) (-> self control unknown-time-frame27)) (seconds 10)) (logtest? (-> self control status) (collide-status touch-ceiling)) ) (and (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (>= (- (current-time) (-> self state-time)) (seconds 0.05)) ) ) (go target-swim-down) @@ -1010,9 +1008,9 @@ #f (label cfg-51) (logior! (-> self water flags) (water-flags swim-ground)) - (set! (-> self water swim-time) (-> self clock frame-counter)) + (set! (-> self water swim-time) (current-time)) (start-bobbing! (-> self water) -4096.0 600 1500) - (set! (-> self water bob start-time) (+ (-> self clock frame-counter) (seconds -0.05))) + (set! (-> self water bob start-time) (+ (current-time) (seconds -0.05))) (go target-swim-stance) (none) ) @@ -1025,7 +1023,7 @@ :exit target-exit :trans (behavior () (cond - ((< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + ((< (- (current-time) (-> self state-time)) (seconds 0.5)) (set! (-> self water flags) (logior (water-flags jump-out) (-> self water flags))) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) ) diff --git a/goal_src/jak2/engine/target/target-tube.gc b/goal_src/jak2/engine/target/target-tube.gc index 9017511bf8..d6f6b13b9f 100644 --- a/goal_src/jak2/engine/target/target-tube.gc +++ b/goal_src/jak2/engine/target/target-tube.gc @@ -584,7 +584,7 @@ (set! (-> self tube entity) (-> a0-4 entity)) ) ) - (set! (-> self tube start-time) (-> self clock frame-counter)) + (set! (-> self tube start-time) (current-time)) (set! (-> self tube tube-sound-id) (new-sound-id)) (set! (-> self tube tube-sound-vol) 0.0) (set! (-> self tube tube-sound-pitch) 0.0) @@ -672,7 +672,7 @@ (ja :group! (-> self draw art-group data 111) :num! (identity (ja-aframe (+ (-> self tube turn-anim-frame) - (* 5.0 (sin (* 145.63556 (the float (- (-> self clock frame-counter) (-> self state-time)))))) + (* 5.0 (sin (* 145.63556 (the float (- (current-time) (-> self state-time)))))) ) 0 ) @@ -741,7 +741,7 @@ (defstate target-tube-jump (target) :event (-> target-tube-start event) :enter (behavior ((arg0 float) (arg1 float)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control mod-surface) *tube-jump-mods*) @@ -820,9 +820,9 @@ ) :code (behavior ((arg0 symbol) (arg1 attack-info)) (let ((gp-0 (-> self attack-info))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self focus-status) (focus-status hit)) - (set! (-> self game hit-time) (-> self clock frame-counter)) + (set! (-> self game hit-time) (current-time)) (when (not (logtest? (-> arg1 mask) (attack-info-mask vector))) (vector-! (-> arg1 vector) @@ -871,7 +871,7 @@ (when (= arg0 'attack) (send-event (handle->process (-> self notify)) 'notify 'hit (-> gp-0 mode)) (logior! (-> self focus-status) (focus-status hit)) - (set! (-> self game hit-time) (-> self clock frame-counter)) + (set! (-> self game hit-time) (current-time)) (case (-> gp-0 mode) (('bot) (pickup-collectable! (-> self fact-override) (pickup-type health) -1000.0 (the-as handle #f)) @@ -955,10 +955,10 @@ ) (set! (-> self control transv quad) (the-as uint128 0)) (initialize! (-> self game) 'life (the-as game-save #f) (the-as string #f)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until v1-42 (suspend) - (set! v1-42 (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (movie?)))) + (set! v1-42 (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (not (movie?)))) ) (go target-tube) (none) diff --git a/goal_src/jak2/engine/target/target-turret.gc b/goal_src/jak2/engine/target/target-turret.gc index c4252d0e9b..8c826a9f97 100644 --- a/goal_src/jak2/engine/target/target-turret.gc +++ b/goal_src/jak2/engine/target/target-turret.gc @@ -1067,110 +1067,108 @@ :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'draw) - (cond - ((-> event param 0) - (ja-channel-set! 1) - (ja :group! (-> self draw art-group data 2)) - (transform-post) - ) - (else - (ja-channel-set! 0) - (transform-post) - ) - ) - ) - ((= v1-0 'fire-down) - (cond - ((>= (-> self heat) 1.0) - (let ((v1-8 (- (-> self clock frame-counter) (-> self fire-time))) - (a0-7 6) - (a1-1 (-> self fire-time-interval)) - ) - (when (>= v1-8 (* a0-7 a1-1)) - (set! (-> self fire-time) (-> self clock frame-counter)) - (the-as object (base-turret-method-45 self a1-1 event-type)) - ) - ) - ) - (else - (when (>= (- (-> self clock frame-counter) (-> self fire-time)) (-> self fire-time-interval)) - (set! (-> self fire-time) (-> self clock frame-counter)) - (the-as object (base-turret-method-45 self arg1 event-type)) - ) - ) - ) - ) - ((= v1-0 'fire-pressed) - (set! (-> self fire-time) (-> self clock frame-counter)) - (the-as object (base-turret-method-45 self arg1 event-type)) - ) - ((= v1-0 'bonk) - #f - ) - ((or (= v1-0 'touch) (= v1-0 'attack)) - (let* ((gp-0 (-> event param 0)) - (s5-0 (the-as object (-> event param 1))) - (s4-0 proc) - (v1-21 (if (type? s4-0 projectile) - s4-0 + (the-as object (cond + ((= v1-0 'draw) + (cond + ((-> event param 0) + (ja-channel-set! 1) + (ja :group! (-> self draw art-group data 2)) + (transform-post) + ) + (else + (ja-channel-set! 0) + (transform-post) + ) + ) + ) + ((= v1-0 'fire-down) + (cond + ((>= (-> self heat) 1.0) + (let ((v1-8 (- (current-time) (-> self fire-time))) + (a0-7 6) + (a1-1 (-> self fire-time-interval)) + ) + (when (>= v1-8 (* a0-7 a1-1)) + (set! (-> self fire-time) (current-time)) + (the-as object (base-turret-method-45 self a1-1 event-type)) + ) ) + ) + (else + (when (>= (- (current-time) (-> self fire-time)) (-> self fire-time-interval)) + (set! (-> self fire-time) (current-time)) + (the-as object (base-turret-method-45 self arg1 event-type)) + ) + ) + ) + ) + ((= v1-0 'fire-pressed) + (set! (-> self fire-time) (current-time)) + (the-as object (base-turret-method-45 self arg1 event-type)) + ) + ((= v1-0 'bonk) + #f + ) + ((or (= v1-0 'touch) (= v1-0 'attack)) + (let* ((gp-0 (-> event param 0)) + (s5-0 (the-as object (-> event param 1))) + (s4-0 proc) + (v1-21 (if (type? s4-0 projectile) + s4-0 + ) + ) + ) + (when (and gp-0 v1-21) + (case (-> (the-as attack-info s5-0) mode) + (('wasp-shot 'guard-shot) + (seek! (-> self health) 0.0 0.25) + (activate! (-> self smush-control) 0.2 15 75 1.0 0.9 (-> *display* entity-clock)) + (sound-play "turret-take-hit") + (let ((v0-1 (the-as object (+ (current-time) (seconds 0.08))))) + (set! (-> self red-filter-timer) (the-as time-frame v0-1)) + v0-1 + ) + ) + (('drill-ship-shot) + (seek! (-> self health) 0.0 0.5) + (activate! (-> self smush-control) 0.2 24 144 1.0 0.9 (-> *display* entity-clock)) + (sound-play "turret-take-hit") + ) + ) + ) + ) + ) + ((= v1-0 'test) + (set! (-> self health) (seek (-> self health) 0.0 (the-as float (-> event param 0)))) + ) + ((= v1-0 'exit-valid) + (let ((v1-33 (-> self path-mode))) + (cond + ((or (zero? v1-33) (= v1-33 5) (= v1-33 1)) + (base-turret-method-41 self (the-as vector (-> event param 0))) + #t + ) + (else + #f + ) + ) + ) + ) + ((= v1-0 'exit) + (let ((v1-37 (-> self path-mode))) + (when (if (or (zero? v1-37) (= v1-37 5) (= v1-37 1)) + #t + ) + (go-virtual shutdown) + #f + ) + ) + ) + (else + (turret-handler proc arg1 event-type event) ) - ) - (when (and gp-0 v1-21) - (case (-> (the-as attack-info s5-0) mode) - (('wasp-shot 'guard-shot) - (seek! (-> self health) 0.0 0.25) - (activate! (-> self smush-control) 0.2 15 75 1.0 0.9 (-> *display* entity-clock)) - (sound-play "turret-take-hit") - (let ((v0-1 (the-as object (+ (-> self clock frame-counter) (seconds 0.08))))) - (set! (-> self red-filter-timer) (the-as time-frame v0-1)) - v0-1 - ) - ) - (('drill-ship-shot) - (seek! (-> self health) 0.0 0.5) - (activate! (-> self smush-control) 0.2 24 144 1.0 0.9 (-> *display* entity-clock)) - (sound-play "turret-take-hit") - ) - ) - ) - ) - ) - ((= v1-0 'test) - (set! (-> self health) (seek (-> self health) 0.0 (the-as float (-> event param 0)))) - ) - ((= v1-0 'exit-valid) - (let ((v1-33 (-> self path-mode))) - (cond - ((or (zero? v1-33) (= v1-33 5) (= v1-33 1)) - (base-turret-method-41 self (the-as vector (-> event param 0))) - #t - ) - (else - #f - ) - ) - ) - ) - ((= v1-0 'exit) - (let ((v1-37 (-> self path-mode))) - (when (if (or (zero? v1-37) (= v1-37 5) (= v1-37 1)) - #t ) - (go-virtual shutdown) - #f - ) - ) - ) - (else - (turret-handler proc arg1 event-type event) - ) - ) - ) + ) ) ) :enter (behavior () @@ -1281,8 +1279,8 @@ :post (behavior () (when (nonzero? (-> self red-filter-timer)) (cond - ((< (-> self clock frame-counter) (-> self red-filter-timer)) - (let* ((v1-5 (- (-> self red-filter-timer) (-> self clock frame-counter))) + ((< (current-time) (-> self red-filter-timer)) + (let* ((v1-5 (- (-> self red-filter-timer) (current-time))) (f0-1 (- 1.0 (* 0.041666668 (the float v1-5)))) ) (set-filter-color! 1.0 f0-1 f0-1) @@ -1551,8 +1549,8 @@ (sound-stop (-> self sound-id 1)) (sound-stop (-> self sound-id 2)) (set! (-> self focus-status) (focus-status disable ignore inactive)) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.8)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.8)) (suspend) ) ) diff --git a/goal_src/jak2/engine/target/target-util.gc b/goal_src/jak2/engine/target/target-util.gc index 1de2c24985..345c79b3ce 100644 --- a/goal_src/jak2/engine/target/target-util.gc +++ b/goal_src/jak2/engine/target/target-util.gc @@ -1083,7 +1083,7 @@ (>= (- (-> *display* base-clock frame-counter) (-> self control cpad change-time)) (seconds 60)) (>= (- (-> *display* game-clock frame-counter) (the-as int (-> self game kiosk-timeout))) (seconds 60)) ) - (and (>= (- (-> self clock frame-counter) (-> self ambient-time)) (seconds 30)) + (and (>= (- (current-time) (-> self ambient-time)) (seconds 30)) (not (logtest? (-> self control status) (collide-status touch-actor))) (logtest? (-> self control status) (collide-status on-surface)) (not (or (logtest? (water-flags touch-water) (-> self water flags)) @@ -1125,15 +1125,15 @@ (defbehavior can-jump? target ((arg0 symbol)) (and (or (logtest? (-> self control status) (collide-status on-surface)) - (< (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (< (- (current-time) (-> self control last-time-on-surface)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) (and (logtest? (-> self control status) (collide-status on-surface)) (< 0.866 (-> self control surface-angle)) ) (and (= arg0 'board) - (or (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.05)) - (and (< (- (-> self clock frame-counter) (-> self control last-time-of-stuck)) (seconds 0.5)) + (or (< (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.05)) + (and (< (- (current-time) (-> self control last-time-of-stuck)) (seconds 0.5)) (< (target-height-above-ground) 2048.0) ) ) @@ -1165,7 +1165,7 @@ (when (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) - (set! (-> self control last-time-of-stuck) (-> self clock frame-counter)) + (set! (-> self control last-time-of-stuck) (current-time)) #t ) ) @@ -1189,15 +1189,13 @@ ;; WARN: Return type mismatch object vs none. (defbehavior fall-test target ((arg0 (state symbol target)) (arg1 float)) (when (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> 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) arg1) ) - (if (< (- (-> self clock frame-counter) (-> self control rider-time)) - (the-as time-frame (-> *TARGET-bank* ground-timeout)) - ) + (if (< (- (current-time) (-> self control rider-time)) (the-as time-frame (-> *TARGET-bank* ground-timeout))) (send-event self 'push-transv (-> self control rider-last-move) #x7530) ) (go arg0 #f) @@ -1208,7 +1206,7 @@ ;; WARN: Return type mismatch object vs none. (defbehavior slide-down-test target () (if (and (not (logtest? (-> self control status) (collide-status on-surface touch-edge))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> self control last-time-on-surface)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) (logtest? (-> self control status) (collide-status touch-surface)) @@ -1236,13 +1234,11 @@ (< (-> self control local-slope-z) 0.7) (not (logtest? (-> self state-flags) (state-flags prevent-attack prevent-duck))) (not (and (focus-test? self dark) (nonzero? (-> self darkjak)))) - (>= (- (-> self clock frame-counter) (the-as int (-> *TARGET-bank* roll-timeout))) - (-> self control last-roll-end-time) - ) + (>= (- (current-time) (the-as int (-> *TARGET-bank* roll-timeout))) (-> self control last-roll-end-time)) (or (not (enabled-gun? self)) (not (-> *TARGET-bank* strafe-duck-jump)) (and (< 0.3 (vector-dot (-> self control to-target-pt-xz) (-> self control c-R-w vector 2))) - (>= (- (-> self clock frame-counter) (-> self control time-of-last-zero-input)) (seconds 0.3)) + (>= (- (current-time) (-> self control time-of-last-zero-input)) (seconds 0.3)) ) ) (not (and (not (using-gun? self)) (!= (-> self skel top-anim interp) 0.0))) @@ -1302,13 +1298,13 @@ #f ) ((and (or (not arg0) - (and (< (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (and (< (- (current-time) (-> self control last-time-on-surface)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) (< (-> self control local-slope-z) 0.7) ) ) - (>= (- (-> self clock frame-counter) (-> self control last-running-attack-end-time)) + (>= (- (current-time) (-> self control last-running-attack-end-time)) (the-as time-frame (if (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 1) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) @@ -1321,7 +1317,7 @@ #t ) (else - (set! (-> self control last-hands-attempt-time) (-> self clock frame-counter)) + (set! (-> self control last-hands-attempt-time) (current-time)) #f ) ) @@ -1334,13 +1330,13 @@ ) #f ) - ((>= (- (-> self clock frame-counter) (-> self control last-attack-end-time)) + ((>= (- (current-time) (-> self control last-attack-end-time)) (the-as time-frame (-> *TARGET-bank* attack-timeout)) ) #t ) (else - (set! (-> self control last-feet-attempt-time) (-> self clock frame-counter)) + (set! (-> self control last-feet-attempt-time) (current-time)) #f ) ) @@ -1414,24 +1410,22 @@ ) (defun target-timed-invulnerable ((arg0 time-frame) (arg1 target) (arg2 int)) - (with-pp - (case arg2 - ((1) - (logior! (-> arg1 state-flags) (state-flags tinvul1)) - (set! (-> arg1 control invul1-on-time) (-> pp clock frame-counter)) - (set! (-> arg1 control invul1-off-time) arg0) - ) - ((2) - (set! (-> arg1 state-flags) (logior (state-flags tinvul2) (-> arg1 state-flags))) - (set! (-> arg1 control invul2-on-time) (-> pp clock frame-counter)) - (set! (-> arg1 control invul2-off-time) arg0) - ) - ) - (modify-collide-as! (-> arg1 control) 2 (collide-spec jak-vulnerable) (collide-spec)) - (logior! (-> arg1 focus-status) (focus-status ignore)) - 0 - (none) + (case arg2 + ((1) + (logior! (-> arg1 state-flags) (state-flags tinvul1)) + (set! (-> arg1 control invul1-on-time) (current-time)) + (set! (-> arg1 control invul1-off-time) arg0) + ) + ((2) + (set! (-> arg1 state-flags) (logior (state-flags tinvul2) (-> arg1 state-flags))) + (set! (-> arg1 control invul2-on-time) (current-time)) + (set! (-> arg1 control invul2-off-time) arg0) + ) ) + (modify-collide-as! (-> arg1 control) 2 (collide-spec jak-vulnerable) (collide-spec)) + (logior! (-> arg1 focus-status) (focus-status ignore)) + 0 + (none) ) (defun target-timed-invulnerable-off ((arg0 target) (arg1 int)) @@ -1464,7 +1458,7 @@ (dotimes (a2-2 8) (let ((v1-9 (-> self attack-info-old a2-2))) (when (= (-> arg0 id) (-> v1-9 id)) - (if (< (- (-> self clock frame-counter) (-> v1-9 attack-time)) + (if (< (- (current-time) (-> v1-9 attack-time)) (the-as time-frame (-> *TARGET-bank* same-attack-invulnerable-timeout)) ) (return #f) diff --git a/goal_src/jak2/engine/target/target.gc b/goal_src/jak2/engine/target/target.gc index 8e38fb559c..647bcfc6e1 100644 --- a/goal_src/jak2/engine/target/target.gc +++ b/goal_src/jak2/engine/target/target.gc @@ -19,7 +19,7 @@ ) (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) (>= arg1 0) - (>= (- (-> self clock frame-counter) (-> self state-time)) arg1) + (>= (- (current-time) (-> self state-time)) arg1) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) #t @@ -27,7 +27,7 @@ (logior! (-> self control status) (collide-status on-surface)) (go target-hit-ground 'stuck) ) - (if (!= (-> self state-time) (-> self clock frame-counter)) + (if (!= (-> self state-time) (current-time)) (slide-down-test) ) 0 @@ -49,7 +49,7 @@ :event target-standard-event-handler :enter (behavior () (set! (-> self control mod-surface) *walk-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -150,7 +150,7 @@ (if (and (using-gun? self) (-> self next-state) (= (-> self next-state name) 'target-walk)) (go target-gun-walk) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *walk-mods*) (none) ) @@ -223,7 +223,7 @@ ) (go target-running-attack) ) - (when (and (turn-around?) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.3))) + (when (and (turn-around?) (>= (- (current-time) (-> self state-time)) (seconds 0.3))) (set! (-> self control transv quad) (-> self control transv-history (-> self control idx-of-fastest-xz-vel) quad) ) @@ -291,7 +291,7 @@ (go target-running-attack) ) (if (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.08)) + (>= (- (current-time) (-> self control last-time-on-surface)) (seconds 0.08)) ) (go target-falling #f) ) @@ -327,7 +327,7 @@ (none) ) :exit (behavior () - (set! (-> self control unknown-time-frame13) (-> self clock frame-counter)) + (set! (-> self control unknown-time-frame13) (current-time)) (none) ) :trans (behavior () @@ -443,7 +443,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *slide-down-mods*) (set! (-> self control sliding-start-time) 0) (set! (-> self control force-turn-to-strength) 1.0) @@ -453,7 +453,7 @@ :exit (behavior () (target-effect-exit) (target-exit) - (set! (-> self control unknown-time-frame13) (-> self clock frame-counter)) + (set! (-> self control unknown-time-frame13) (current-time)) (none) ) :trans (behavior () @@ -473,7 +473,7 @@ ) (zero? (-> self control sliding-start-time)) ) - (set! (-> self control sliding-start-time) (-> self clock frame-counter)) + (set! (-> self control sliding-start-time) (current-time)) ) (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) @@ -483,7 +483,7 @@ (pad-buttons x) ) (can-jump? #f) - (!= (-> self state-time) (-> self clock frame-counter)) + (!= (-> self state-time) (current-time)) ) (forward-up-nopitch->quaternion (-> self control dir-targ) @@ -501,7 +501,7 @@ (pad-buttons circle) ) (can-feet? #t) - (!= (-> self state-time) (-> self clock frame-counter)) + (!= (-> self state-time) (current-time)) ) (go target-attack) ) @@ -513,8 +513,8 @@ (pad-buttons square) ) (can-hands? #t) - (>= (- (-> self clock frame-counter) (-> self control last-running-attack-end-time)) (seconds 0.7)) - (!= (-> self state-time) (-> self clock frame-counter)) + (>= (- (current-time) (-> self control last-running-attack-end-time)) (seconds 0.7)) + (!= (-> self state-time) (current-time)) ) (go target-running-attack) ) @@ -562,7 +562,7 @@ (seek! (-> self control force-turn-to-strength) 0.0 (* 4.0 (-> self clock seconds-per-frame))) ) ) - (set! (-> self control turn-lockout-end-time) (+ (-> self clock frame-counter) (seconds 0.1))) + (set! (-> self control turn-lockout-end-time) (+ (current-time) (seconds 0.1))) (target-post) (none) ) @@ -574,7 +574,7 @@ (set! arg1 (* arg1 (-> self darkjak-giant-interp))) ) (logclear! (-> self control status) (collide-status touch-ceiling-sticky)) - (set! (-> self control unknown-time-frame19) (-> self clock frame-counter)) + (set! (-> self control unknown-time-frame19) (current-time)) (delete-back-vel) (let* ((f0-4 arg5) (f1-2 0.0) @@ -586,7 +586,7 @@ (s3-1 (+ arg0 f0-5)) ) (let ((s2-1 (+ arg1 f0-5))) - (when (< (- (-> self clock frame-counter) (-> self control rider-time)) (seconds 0.05)) + (when (< (- (current-time) (-> self control rider-time)) (seconds 0.05)) (let ((f0-8 (fmax 0.0 @@ -645,7 +645,7 @@ (defbehavior mod-var-jump target ((arg0 symbol) (arg1 symbol) (arg2 symbol) (arg3 vector)) (local-vars (v0-1 vector)) - (let ((f0-1 (* 0.033333335 (the float (- (-> self clock frame-counter) (-> self state-time)))))) + (let ((f0-1 (* 0.033333335 (the float (- (current-time) (-> self state-time)))))) (cond ((or (< 1.0 f0-1) (< (-> self control unknown-float36) 0.0) (not arg2)) (set! (-> self control unknown-float36) -1.0) @@ -774,7 +774,7 @@ :event target-standard-event-handler :enter (behavior ((arg0 symbol)) (if (not arg0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (set! (-> self control bend-target) 1.0) (set! (-> self control mod-surface) *duck-mods*) @@ -863,7 +863,7 @@ (set! (-> self neck base-joint) (the-as uint 8)) (cond ((using-gun? self) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.7))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.7))) (push-anim-to-targ (-> self skel top-anim) (the-as art-joint-anim (-> self draw art-group data 283)) @@ -944,7 +944,7 @@ :event target-standard-event-handler :enter (behavior ((arg0 symbol)) (if (not arg0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (set! (-> self control bend-target) 1.0) (target-collide-set! 'duck 1.0) @@ -1095,7 +1095,7 @@ (go target-launch (the-as float a0-7) (the-as symbol a1-3) a2-3 (-> self control unknown-dword10)) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "jump" :vol 70) (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) @@ -1153,7 +1153,7 @@ (* 26624.0 (-> self darkjak-giant-interp) (-> self darkjak-giant-interp)) ) (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - (and (>= (- (-> self clock frame-counter) (-> self control last-time-of-stuck)) + (and (>= (- (current-time) (-> self control last-time-of-stuck)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) (not (logtest? (-> self state-flags) (state-flags prevent-attack))) @@ -1383,7 +1383,7 @@ (go target-launch (the-as float a0-3) (the-as symbol a1-1) a2-0 (-> self control unknown-dword10)) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (if (!= (-> self control mod-surface) *slide-jump-mods*) @@ -1407,7 +1407,7 @@ (if (and (cpad-pressed? (-> self control cpad number) square) (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 22118.4) (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - (and (>= (- (-> self clock frame-counter) (-> self control last-time-of-stuck)) + (and (>= (- (current-time) (-> self control last-time-of-stuck)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) (not (logtest? (-> self state-flags) (state-flags prevent-attack))) @@ -1426,7 +1426,7 @@ ) ) ) - (if (!= (-> self state-time) (-> self clock frame-counter)) + (if (!= (-> self state-time) (current-time)) (mod-var-jump #t #t (cpad-hold? (-> self control cpad number) x) (-> self control transv)) ) (seek! @@ -1523,7 +1523,7 @@ (if (or (= arg2 'duck) (= arg2 'launch)) (go target-duck-high-jump arg0 arg1 (the-as symbol arg2)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (sound-play "jump" :pitch 0.3) (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) @@ -1566,7 +1566,7 @@ ) (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 73728.0) (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - (and (>= (- (-> self clock frame-counter) (-> self control last-time-of-stuck)) + (and (>= (- (current-time) (-> self control last-time-of-stuck)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) (not (logtest? (-> self state-flags) (state-flags prevent-attack))) @@ -1600,7 +1600,7 @@ (defstate target-duck-high-jump (target) :event target-standard-event-handler :enter (behavior ((arg0 float) (arg1 float) (arg2 symbol)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control mod-surface) *turn-around-mods*) (case arg2 @@ -1652,7 +1652,7 @@ :event target-jump-event-handler :enter (behavior ((arg0 float) (arg1 float) (arg2 symbol)) (set! (-> self control unknown-symbol03) (the-as float arg2)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "jump" :vol 80 :pitch -0.4) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) @@ -1807,7 +1807,7 @@ ) ) (set! (-> self control unknown-word04) (the-as uint arg0)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -2052,18 +2052,17 @@ (let ((v1-25 (copy *attack-mods* 'global))) (set! (-> v1-25 flags) (surface-flag attack spin gun-turn-fast)) - (set! (-> v1-25 mult-hook) (lambda :behavior target - ((arg0 surface) (arg1 surface) (arg2 surface) (arg3 int)) - ((-> *attack-mods* mult-hook) arg0 arg1 arg2 arg3) - (when (= arg3 1) - (if (and (nonzero? (-> self gun turn-fast-hold-time)) - (< (-> self clock frame-counter) (-> self gun turn-fast-hold-time)) - ) - (set-quaternion! (-> self control) (-> self control dir-targ)) - ) - ) - (none) - ) + (set! (-> v1-25 mult-hook) + (lambda :behavior target + ((arg0 surface) (arg1 surface) (arg2 surface) (arg3 int)) + ((-> *attack-mods* mult-hook) arg0 arg1 arg2 arg3) + (when (= arg3 1) + (if (and (nonzero? (-> self gun turn-fast-hold-time)) (< (current-time) (-> self gun turn-fast-hold-time))) + (set-quaternion! (-> self control) (-> self control dir-targ)) + ) + ) + (none) + ) ) (set! *attack-end-mods* v1-25) ) @@ -2086,7 +2085,7 @@ (the-as int (-> self control attack-count)) (-> self control penetrate-using) ) - (set! (-> self gun combo-window-start) (-> self clock frame-counter)) + (set! (-> self gun combo-window-start) (current-time)) (let ((v0-2 (the-as object (-> self state name)))) (set! (-> self gun combo-window-state) (the-as symbol v0-2)) v0-2 @@ -2119,7 +2118,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (target-start-attack) (target-danger-set! 'spin #f) (set! (-> self control mod-surface) *attack-mods*) @@ -2143,7 +2142,7 @@ (if (zero? (-> self gun track-target-hold-time)) (quaternion-copy! (-> self control dir-targ) (-> self control unknown-quaternion04)) ) - (set! (-> self control last-attack-end-time) (-> self clock frame-counter)) + (set! (-> self control last-attack-end-time) (current-time)) (target-exit) (none) ) @@ -2345,8 +2344,8 @@ ) ) (when gp-1 - (set! (-> self control sliding-start-time) (-> self clock frame-counter)) - (set! (-> self gun combo-window-start) (-> self clock frame-counter)) + (set! (-> self control sliding-start-time) (current-time)) + (set! (-> self gun combo-window-start) (current-time)) (set! (-> self gun combo-window-state) (-> self state name)) (let ((v1-13 (if (type? proc process-focusable) proc @@ -2371,7 +2370,7 @@ ) (cond ((or (= gp-1 'die) (= gp-1 'push)) - (let ((v0-2 (the-as object (-> self clock frame-counter)))) + (let ((v0-2 (the-as object (current-time)))) (set! (-> self control unknown-time-frame18) (the-as time-frame v0-2)) v0-2 ) @@ -2413,13 +2412,13 @@ ) (logclear! (-> *cpad-list* cpads (-> self control cpad number) button0-abs 0) (pad-buttons square)) (logclear! (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) (pad-buttons square)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (combo-tracker-method-12 (-> self control unknown-combo-tracker00) *null-vector* *null-vector* (the-as process #f) - (-> self clock frame-counter) + (current-time) ) (set! (-> self control sliding-start-time) 0) (set! (-> self control unknown-time-frame18) 0) @@ -2449,19 +2448,19 @@ (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) (set! (-> *run-attack-mods* turnv) 0.0) (set! (-> *run-attack-mods* turnvv) 0.0) - (set! (-> self control last-running-attack-end-time) (-> self clock frame-counter)) + (set! (-> self control last-running-attack-end-time) (current-time)) (target-exit) (none) ) :trans (behavior () - (when (!= (-> self state-time) (-> self clock frame-counter)) + (when (!= (-> self state-time) (current-time)) (when (and (or (smack-surface? #t) (and (>= (-> self control surface-slope-z) 0.7) (not (logtest? (-> self control status) (collide-status touch-actor))) ) ) (begin - (set! (-> self control unknown-time-frame18) (-> self clock frame-counter)) + (set! (-> self control unknown-time-frame18) (current-time)) (set! (-> self control bend-target) 0.0) (let ((v1-11 (new-stack-vector0)) (f0-3 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) @@ -2482,14 +2481,14 @@ #t ) (or (zero? (-> self control sliding-start-time)) - (>= (- (-> self clock frame-counter) (-> self control sliding-start-time)) (seconds 0.04)) + (>= (- (current-time) (-> self control sliding-start-time)) (seconds 0.04)) ) (!= (-> self control unknown-word04) 1) ) ) (if (and (cpad-pressed? (-> self control cpad number) x) (< 4096.0 (-> self control ctrl-xz-vel)) - (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (or (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (not (logtest? (-> *cpad-list* cpads (-> self control cpad number) button0-abs 0) (pad-buttons square))) ) (not (logtest? (-> self state-flags) (state-flags prevent-jump prevent-attack))) @@ -2509,7 +2508,7 @@ ) ) (if (and (logtest? (water-flags touch-water) (-> self water flags)) - (zero? (mod (- (-> self clock frame-counter) (-> self state-time)) 21)) + (zero? (mod (- (current-time) (-> self state-time)) 21)) ) (spawn-ripples (-> self water) @@ -2598,13 +2597,13 @@ (cond ((and (>= (ja-aframe-num 0) 20.0) (and (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> 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)) ) - (>= (- (-> self clock frame-counter) (-> self control sliding-start-time)) (seconds 0.04)) + (>= (- (current-time) (-> self control sliding-start-time)) (seconds 0.04)) ) ) (go target-falling #f) @@ -2614,14 +2613,12 @@ (set-forward-vel (the-as float f26-0)) ) ((and (nonzero? (-> self control unknown-time-frame18)) - (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame18)) (seconds 0.04)) + (>= (- (current-time) (-> self control unknown-time-frame18)) (seconds 0.04)) ) (set-forward-vel 0.0) ) ((and (not (cpad-hold? (-> self control cpad number) square)) - (>= (- (-> self clock frame-counter) (-> self control unknown-combo-tracker00 move-start-time)) - (seconds 0.05) - ) + (>= (- (current-time) (-> self control unknown-combo-tracker00 move-start-time)) (seconds 0.05)) ) (if (= (-> self control ground-pat material) (pat-material ice)) (set-forward-vel (fmax 32768.0 (* 0.8 (-> self control ctrl-xz-vel)))) @@ -2719,8 +2716,8 @@ ) ) (let ((t1-6 (if (using-gun? self) - (static-sound-name "gun-punch-w-hit") - (static-sound-name "punch-w-hit") + (the-as sound-name (static-sound-name "gun-punch-w-hit")) + (the-as sound-name (static-sound-name "punch-w-hit")) ) ) ) @@ -2730,7 +2727,7 @@ -1.0 (-> self control impact-ctrl joint) (the-as basic #f) - (the-as sound-name t1-6) + t1-6 ) ) (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) @@ -2741,7 +2738,7 @@ ) (suspend) (ja :num! (seek! max (* (-> self control current-surface align-speed) f28-0))) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (set! (-> *run-attack-mods* turnvv) 0.0) ) (if (< 2 gp-2) @@ -2751,7 +2748,7 @@ ) ) (if (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> 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))) @@ -2762,7 +2759,7 @@ (when (and (using-gun? self) (or (< (-> self control pad-magnitude) 0.7) (= (-> self gun gun-type) (pickup-type eco-blue))) ) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.5))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.5))) (when (zero? (-> self gun track-target-hold-time)) (case (-> self gun gun-type) (((pickup-type eco-blue)) @@ -2863,7 +2860,7 @@ ) ) :enter (behavior ((arg0 symbol)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (target-start-attack) (target-danger-set! 'spin-air #f) @@ -2940,7 +2937,7 @@ :exit (behavior () (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) - (set! (-> self control last-attack-end-time) (-> self clock frame-counter)) + (set! (-> self control last-attack-end-time) (current-time)) (target-exit) (none) ) @@ -2949,14 +2946,14 @@ (set-quaternion! (-> self control) (-> self control dir-targ)) (go target-hit-ground #f) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (seek! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length) (* 245760.0 (-> self clock seconds-per-frame)) ) ) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (when (and (>= (- (current-time) (-> self state-time)) (seconds 0.05)) (< (vector-dot (-> self control dynam gravity-normal) (-> self control last-transv)) (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) ) @@ -3044,12 +3041,12 @@ (defstate target-attack-uppercut (target) :event target-dangerous-event-handler :enter (behavior ((arg0 float) (arg1 float)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (target-start-attack) (target-danger-set! 'uppercut #f) (set! (-> self control mod-surface) *uppercut-mods*) (set! (-> self neck flex-blend) 0.0) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.15))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.15))) (if (using-gun? self) (target-top-anim-base-mode 37) ) @@ -3189,7 +3186,7 @@ ) ) ) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.5))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.5))) (go target-falling 'uppercut) ) #t @@ -3203,14 +3200,14 @@ (if (and (= (-> self control ground-pat material) (pat-material ice)) (< 32768.0 (-> self control ctrl-xz-vel))) (set-forward-vel 32768.0) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self neck flex-blend) 0.0) (set! (-> self control mod-surface) *uppercut-jump-mods*) (target-start-attack) (target-danger-set! 'uppercut #f) - (set! (-> self gun combo-window-start) (-> self clock frame-counter)) + (set! (-> self gun combo-window-start) (current-time)) (set! (-> self gun combo-window-state) (-> self state name)) (set! (-> self gun track-target-hold-time) 0) 0 @@ -3224,7 +3221,7 @@ (when (and (cpad-pressed? (-> self control cpad number) square) (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 22118.4) (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - (and (>= (- (-> self clock frame-counter) (-> self control last-time-of-stuck)) + (and (>= (- (current-time) (-> self control last-time-of-stuck)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) (not (logtest? (-> self state-flags) (state-flags prevent-attack))) @@ -3292,7 +3289,7 @@ (-> self align) (the-as align-opts (cond ((>= 30.0 (ja-aframe-num 0)) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.1))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.1))) (if (nonzero? (-> self gun track-target-hold-time)) 2 18 @@ -3315,7 +3312,7 @@ (-> self align) (the-as align-opts (cond ((>= 35.0 (ja-aframe-num 0)) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.1))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.1))) (if (nonzero? (-> self gun track-target-hold-time)) 2 18 @@ -3337,7 +3334,7 @@ ) ) ) - (set! (-> self gun surpress-time) (-> self clock frame-counter)) + (set! (-> self gun surpress-time) (current-time)) (go target-falling #f) (none) ) @@ -3389,7 +3386,7 @@ (set-forward-vel arg2) (set-forward-vel (-> self control ctrl-xz-vel)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control mod-surface) *flop-mods*) (set! (-> self neck flex-blend) 0.0) @@ -3445,7 +3442,7 @@ (not (logtest? (-> self control status) (collide-status touch-actor))) (>= (-> self control unknown-word04) (the-as uint 2)) ) - (set! (-> self control last-time-of-stuck) (-> self clock frame-counter)) + (set! (-> self control last-time-of-stuck) (current-time)) (set! gp-1 'stuck) ) ) @@ -3608,9 +3605,7 @@ ) ) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) - (the-as time-frame (-> *TARGET-bank* fall-timeout)) - ) + (if (and (>= (- (current-time) (-> self state-time)) (the-as time-frame (-> *TARGET-bank* fall-timeout))) (!= (-> self tobot?) 'tobot) ) (go target-falling #f) @@ -3662,7 +3657,7 @@ ) (target-land-effect) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.1)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control unknown-word04) (the-as uint arg0)) (set-forward-vel 0.0) (set! (-> self control mod-surface) *flop-land-mods*) @@ -3679,9 +3674,7 @@ ) :exit target-exit :trans (behavior () - (when (and (!= (-> self control unknown-spool-anim00) 'stuck) - (!= (-> self state-time) (-> self clock frame-counter)) - ) + (when (and (!= (-> self control unknown-spool-anim00) 'stuck) (!= (-> self state-time) (current-time))) (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) ) @@ -3697,7 +3690,7 @@ (when (and (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) - (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.25)) + (< (- (current-time) (-> self state-time)) (seconds 0.25)) ) (do-effect (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) (if (rand-vu-percent? 0.5) 22 @@ -3749,7 +3742,7 @@ ) :enter (behavior () (target-collide-set! 'duck 1.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self neck flex-blend) 0.0) (set! (-> self neck base-joint) (the-as uint 8)) (set! (-> self control mod-surface) *roll-mods*) @@ -3770,7 +3763,7 @@ :exit (behavior () (when (not (and (-> self next-state) (= (-> self next-state name) 'target-roll))) (set! (-> self control unknown-word02) 0) - (set! (-> self control last-roll-end-time) (-> self clock frame-counter)) + (set! (-> self control last-roll-end-time) (current-time)) ) (target-exit) (target-collide-set! 'normal 0.0) @@ -3805,18 +3798,16 @@ ) (until (ja-done? 0) (if (cpad-pressed? (-> self control cpad number) x) - (set! gp-0 (the-as int (-> self clock frame-counter))) + (set! gp-0 (the-as int (current-time))) ) - (when (and (not s4-0) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2))) + (when (and (not s4-0) (>= (- (current-time) (-> self state-time)) (seconds 0.2))) (set! s4-0 #t) - (set! (-> self gun combo-window-start) (-> self clock frame-counter)) + (set! (-> self gun combo-window-start) (current-time)) (set! (-> self gun combo-window-state) (-> self state name)) ) (when (and (or (smack-surface? #f) (>= (-> self control surface-slope-z) 0.7)) - (>= (the-as uint (- (-> self clock frame-counter) (the-as int (-> self control unknown-word04)))) - (the-as uint 3) - ) - (>= (- (-> self clock frame-counter) (-> self state-time)) 1) + (>= (the-as uint (- (current-time) (the-as int (-> self control unknown-word04)))) (the-as uint 3)) + (>= (- (current-time) (-> self state-time)) 1) ) (when (>= 6.0 (ja-aframe-num 0)) (if (using-gun? self) @@ -3830,11 +3821,11 @@ ) ) (if (zero? s5-0) - (set! s5-0 (the-as int (-> self clock frame-counter))) + (set! s5-0 (the-as int (current-time))) ) ) (if (cpad-pressed? (-> self control cpad number) square) - (-> self clock frame-counter) + (current-time) ) (compute-alignment! (-> self align)) (cond @@ -3854,9 +3845,7 @@ (set! f30-0 (* f30-0 (fmin 1.0 (-> self control zx-vel-frac)))) ) ) - (if (and (or (< (- (-> self clock frame-counter) (the-as time-frame gp-0)) - (the-as time-frame (-> *TARGET-bank* roll-jump-pre-window)) - ) + (if (and (or (< (- (current-time) (the-as time-frame gp-0)) (the-as time-frame (-> *TARGET-bank* roll-jump-pre-window))) (cpad-pressed? (-> self control cpad number) x) ) (can-jump? 'target-roll-flip) @@ -3864,14 +3853,12 @@ (go target-roll-flip (-> *TARGET-bank* roll-flip-height) (-> *TARGET-bank* roll-flip-dist)) ) ) - (set! (-> self state-hook-time) (-> self clock frame-counter)) + (set! (-> self state-hook-time) (current-time)) (set! (-> self state-hook) (lambda :behavior target () (cond - ((>= (- (-> self clock frame-counter) (-> self state-hook-time)) - (the-as time-frame (-> *TARGET-bank* roll-jump-post-window)) - ) + ((>= (- (current-time) (-> self state-hook-time)) (the-as time-frame (-> *TARGET-bank* roll-jump-post-window))) (set! (-> self state-hook) (the-as (function none :behavior target) nothing)) ) (else @@ -3891,7 +3878,7 @@ (none) ) ) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.2))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.2))) (go target-duck-stance 'roll) (none) ) @@ -3923,7 +3910,7 @@ (set! (-> self neck flex-blend) 0.0) (set! (-> self neck base-joint) (the-as uint 8)) (set! (-> self gun track-target-hold-time) 0) - (set! (-> self gun combo-window-start) (-> self clock frame-counter)) + (set! (-> self gun combo-window-start) (current-time)) (set! (-> self gun combo-window-state) (-> self state name)) (target-collide-set! 'duck 1.0) (none) @@ -3937,7 +3924,7 @@ (if (and (or (smack-surface? #f) (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) ) - (and (!= (-> self state-time) (-> self clock frame-counter)) (not (using-gun? self))) + (and (!= (-> self state-time) (current-time)) (not (using-gun? self))) ) (target-shoved (-> *TARGET-bank* smack-surface-dist) @@ -4009,9 +3996,9 @@ ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (while (not (logtest? (-> self control status) (collide-status on-surface))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.01)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.01)) (let ((v1-50 (ja-group))) (when (not (and v1-50 (= v1-50 (-> self draw art-group data 27)))) (ja-channel-push! 1 (seconds 0.1)) @@ -4044,13 +4031,13 @@ ) ) (target-land-effect) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.1))) - (set! (-> self state-hook-time) (-> self clock frame-counter)) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.1))) + (set! (-> self state-hook-time) (current-time)) (set! (-> self state-hook) (lambda :behavior target () (cond - ((>= (- (-> self clock frame-counter) (-> self state-hook-time)) (seconds 0.1)) + ((>= (- (current-time) (-> self state-hook-time)) (seconds 0.1)) (set! (-> self state-hook) (the-as (function none :behavior target) nothing)) ) (else diff --git a/goal_src/jak2/engine/target/target2.gc b/goal_src/jak2/engine/target/target2.gc index 437c44f669..2cae873709 100644 --- a/goal_src/jak2/engine/target/target2.gc +++ b/goal_src/jak2/engine/target/target2.gc @@ -19,7 +19,7 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('loading) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) #f ) (else @@ -30,8 +30,8 @@ :exit target-exit :code (behavior () (set! (-> self control mod-surface) *trip-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 0.05)) (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! (-> self draw art-group data 63) :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 63)) frames num-frames) -1))) @@ -53,8 +53,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.3)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.3)) (suspend) (ja :num! (seek! (ja-aframe 19.0 0) 0.05)) (suspend) @@ -137,11 +137,11 @@ ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () - (set! (-> self ambient-time) (-> self clock frame-counter)) + (set! (-> self ambient-time) (current-time)) (let ((a0-0 (-> self spool-anim))) (when (and a0-0 (= (-> *setting-control* user-current spooling) (process->ppointer self))) (ja-abort-spooled-anim a0-0 (the-as art-joint-anim #f) -1) @@ -205,10 +205,8 @@ (set! (-> a1-0 from) (process->ppointer self)) (set! (-> a1-0 num-params) 0) (set! (-> a1-0 message) 'dist-from-interp-src) - (and (or (< (send-event-function *camera* a1-0) 4915.2) - (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) - ) - (and (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.07)) (zero? (ja-group-size))) + (and (or (< (send-event-function *camera* a1-0) 4915.2) (< (- (current-time) (-> self state-time)) (seconds 0.05))) + (and (< (- (current-time) (-> self state-time)) (seconds 0.07)) (zero? (ja-group-size))) ) ) (suspend) @@ -390,7 +388,7 @@ (none) ) :exit (behavior () - (set! (-> self ambient-time) (-> self clock frame-counter)) + (set! (-> self ambient-time) (current-time)) (logclear! (-> self state-flags) (state-flags sf2)) (target-exit) (none) @@ -400,7 +398,7 @@ (let ((gp-0 0)) (while (not (logtest? (-> self control status) (collide-status on-surface))) (target-falling-anim-trans) - (+! gp-0 (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! gp-0 (- (current-time) (-> self clock old-frame-counter))) (suspend) ) (if (or (> gp-0 0) (let ((v1-10 (ja-group))) @@ -555,7 +553,7 @@ ) :enter (behavior ((arg0 handle)) (set! (-> self control anim-handle) arg0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *pole-mods*) (logior! (-> self focus-status) (focus-status pole)) (target-collide-set! 'pole 0.0) @@ -581,7 +579,7 @@ (pad-buttons x) ) (not (logtest? (-> self state-flags) (state-flags prevent-jump))) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.4)) + (>= (- (current-time) (-> self state-time)) (seconds 0.4)) ) (set! (-> self control transv quad) (the-as uint128 0)) (cond @@ -792,11 +790,11 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> *edge-grab-info* pilot-edge-grab?) #f) (set! (-> self control unknown-handle000) (the-as handle #f)) (set! (-> self control mod-surface) *edge-grab-mods*) - (set! (-> self control edge-grab-start-time) (-> self clock frame-counter)) + (set! (-> self control edge-grab-start-time) (current-time)) (logior! (-> self control root-prim prim-core action) (collide-action dont-push-away)) (logior! (-> self focus-status) (focus-status edge-grab)) (set! (-> self control unknown-vector37 quad) (-> self control transv quad)) @@ -831,7 +829,7 @@ (none) ) :trans (behavior () - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (when (and (>= (- (current-time) (-> self state-time)) (seconds 0.2)) (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) ) @@ -1027,7 +1025,7 @@ (set! (-> self control transv quad) (the-as uint128 0)) (set! (-> self control time-of-last-clear-wall-in-jump) 0) (set-forward-vel 16384.0) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.2))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.2))) (send-event *camera* 'damp-up) (go target-jump-forward arg0 arg1) (none) @@ -1069,9 +1067,9 @@ (set! (-> self control transv quad) (the-as uint128 0)) (logclear! (-> self focus-status) (focus-status edge-grab)) (logclear! (-> self control root-prim prim-core action) (collide-action dont-push-away)) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.2))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.2))) (vector-float*! (-> self control transv) (-> self control edge-grab-across-edge-dir) -40960.0) - (if (< (- (-> self clock frame-counter) (-> self control rider-time)) (seconds 0.2)) + (if (< (- (current-time) (-> self control rider-time)) (seconds 0.2)) (send-event self 'push-transv (-> self control rider-last-move) #x7530) ) (go target-falling 'target-edge-grab) @@ -1183,7 +1181,7 @@ (-> self control wall-contact-normal) (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control quat)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -1202,7 +1200,7 @@ (go target-ice-stance) ) (if (and (move-legs?) - (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (let ((f0-1 (vector-dot (-> self control to-target-pt-xz) (-> self control wall-contact-normal)))) (< 0.1 f0-1) ) @@ -1322,8 +1320,8 @@ (until #f (let ((s5-0 (rand-vu-int-range 30 600))) (ja :group! (-> self draw art-group data 85)) - (let ((s4-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-0) s5-0) + (let ((s4-0 (current-time))) + (until (>= (- (current-time) s4-0) s5-0) (gp-0) (suspend) ) @@ -1383,9 +1381,9 @@ (ja :num! (seek! max f30-0)) ) (let ((s5-2 (rand-vu-int-range 60 300)) - (s4-2 (-> self clock frame-counter)) + (s4-2 (current-time)) ) - (until (>= (- (-> self clock frame-counter) s4-2) s5-2) + (until (>= (- (current-time) s4-2) s5-2) (gp-0) (suspend) ) @@ -1411,9 +1409,9 @@ (ja :num! (seek! 0.0 f30-0)) ) (let ((s5-3 (rand-vu-int-range 60 300)) - (s4-3 (-> self clock frame-counter)) + (s4-3 (current-time)) ) - (until (>= (- (-> self clock frame-counter) s4-3) s5-3) + (until (>= (- (current-time) s4-3) s5-3) (gp-0) (suspend) ) @@ -1449,7 +1447,7 @@ ) ) :code (behavior ((arg0 float) (arg1 symbol) (arg2 vector) (arg3 int)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *turn-around-mods*) (ja-channel-push! 1 (seconds 0.15)) (set-forward-vel 0.0) @@ -1467,13 +1465,13 @@ (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 (-> self clock frame-counter)) + (set! sv-32 (current-time)) (let ((v1-2 (new-stack-vector0))) (set! (-> v1-2 quad) (-> arg0 quad)) (set! sv-40 v1-2) ) (set! sv-44 #t) - (until (>= (- (-> self clock frame-counter) sv-32) arg1) + (until (>= (- (current-time) sv-32) arg1) (let ((s4-0 (ppointer->process (-> self parent)))) (cond ((and sv-44 @@ -1489,7 +1487,7 @@ ) (else (if sv-44 - (set! sv-32 (-> self clock frame-counter)) + (set! sv-32 (current-time)) ) (set! sv-44 (the-as symbol #f)) (when (and (-> (the-as target s4-0) next-state) @@ -1622,7 +1620,7 @@ ) (rot->dir-targ! (-> self control)) (logior! (-> self control status) (collide-status on-surface on-ground touch-surface)) - (set! (-> self control last-time-on-surface) (-> self clock frame-counter)) + (set! (-> self control last-time-on-surface) (current-time)) (ja-channel-set! 0) (ja-post) (target-exit) @@ -1689,7 +1687,7 @@ (none) ) :trans (behavior () - (set! (-> self control time-of-last-debug-float) (-> self clock frame-counter)) + (set! (-> self control time-of-last-debug-float) (current-time)) (cond ((and (cpad-hold? (-> self control cpad number) r2) (not *pause-lock*)) ;; no debug hover when paused. diff --git a/goal_src/jak2/engine/ui/credits.gc b/goal_src/jak2/engine/ui/credits.gc index f1120b8217..e9b7d4033c 100644 --- a/goal_src/jak2/engine/ui/credits.gc +++ b/goal_src/jak2/engine/ui/credits.gc @@ -100,9 +100,9 @@ ) ) ) - (let ((gp-1 (-> self clock frame-counter))) + (let ((gp-1 (current-time))) (while (let ((a0-9 (level-get *level* 'outrocst))) - (and a0-9 (not (draw-end-credits a0-9 (* 0.15 (the float (- (-> self clock frame-counter) gp-1)))))) + (and a0-9 (not (draw-end-credits a0-9 (* 0.15 (the float (- (current-time) gp-1)))))) ) (suspend) ) diff --git a/goal_src/jak2/engine/ui/minimap.gc b/goal_src/jak2/engine/ui/minimap.gc index f2be73e9ca..a54e395008 100644 --- a/goal_src/jak2/engine/ui/minimap.gc +++ b/goal_src/jak2/engine/ui/minimap.gc @@ -841,167 +841,163 @@ ) (defmethod debug-draw minimap ((obj minimap)) - (with-pp - (when *trail-graph* - (dotimes (s5-0 6) - (let ((s4-0 (-> obj trail s5-0))) - (when (and (-> s4-0 used-by) - (>= (-> s4-0 node-count) 0) - (< (- (-> pp clock frame-counter) (the-as int (-> s4-0 last-updated))) (seconds 5)) - ) - (let* ((a3-0 (target-pos 0)) - (v1-12 s5-0) - (t1-0 (cond - ((zero? v1-12) - *color-green* - ) - ((= v1-12 1) - *color-blue* - ) - ((= v1-12 2) - *color-white* - ) - ((= v1-12 3) - *color-red* - ) - (else - *color-magenta* - ) + (when *trail-graph* + (dotimes (s5-0 6) + (let ((s4-0 (-> obj trail s5-0))) + (when (and (-> s4-0 used-by) + (>= (-> s4-0 node-count) 0) + (< (- (current-time) (the-as int (-> s4-0 last-updated))) (seconds 5)) + ) + (let* ((a3-0 (target-pos 0)) + (v1-12 s5-0) + (t1-0 (cond + ((zero? v1-12) + *color-green* + ) + ((= v1-12 1) + *color-blue* + ) + ((= v1-12 2) + *color-white* + ) + ((= v1-12 3) + *color-red* + ) + (else + *color-magenta* ) ) - ) - (debug-draw-path - *trail-graph* - (-> s4-0 node-count) - (-> s4-0 node-id) - a3-0 - (-> s4-0 cached-info orig-goal-pos) - t1-0 - (* 1024.0 (the float s5-0)) - ) + ) + ) + (debug-draw-path + *trail-graph* + (-> s4-0 node-count) + (-> s4-0 node-id) + a3-0 + (-> s4-0 cached-info orig-goal-pos) + t1-0 + (* 1024.0 (the float s5-0)) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count] (defmethod update-trails minimap ((obj minimap)) "Main function to do trail search per-frame" - (with-pp - (let ((s5-0 *trail-graph*)) - (when s5-0 - (.mtc0 Count 0) - (let ((v1-1 0)) - (while (< (the-as uint v1-1) (the-as uint #x605a)) - (let ((v1-2 (-> s5-0 mode))) - (cond - ((= v1-2 1) - (run-until-done-or-timeout s5-0 #x605a) - ) - ((zero? v1-2) - (let ((v1-5 -1)) - (let ((a0-5 0)) - (countdown (a1-1 6) - (let* ((a2-3 (-> obj trail a1-1)) - (a3-0 (-> a2-3 used-by)) - ) - (when (and a3-0 (and (< 0.0 (-> a3-0 alpha)) (or (< v1-5 0) (< (the-as int (-> a2-3 last-updated)) a0-5)))) - (set! v1-5 a1-1) - (set! a0-5 (the-as int (-> a2-3 last-updated))) - ) - ) - ) - (let ((a1-5 (-> pp clock frame-counter))) - (if (or (< v1-5 0) (= a0-5 a1-5)) - (goto cfg-68) - ) - ) - ) - (let ((s4-0 (-> obj trail v1-5)) - (s3-0 (the-as object #f)) - ) - (let* ((v1-9 (-> s4-0 used-by)) - (s2-0 (-> v1-9 position)) + (let ((s5-0 *trail-graph*)) + (when s5-0 + (.mtc0 Count 0) + (let ((v1-1 0)) + (while (< (the-as uint v1-1) (the-as uint #x605a)) + (let ((v1-2 (-> s5-0 mode))) + (cond + ((= v1-2 1) + (run-until-done-or-timeout s5-0 #x605a) + ) + ((zero? v1-2) + (let ((v1-5 -1)) + (let ((a0-5 0)) + (countdown (a1-1 6) + (let* ((a2-3 (-> obj trail a1-1)) + (a3-0 (-> a2-3 used-by)) ) - (set! s3-0 (cond - ((= s2-0 #t) - (let* ((s2-1 (handle->process (-> v1-9 handle))) - (v1-13 (if (type? s2-1 process-drawable) - s2-1 - ) - ) - ) - (if v1-13 - (set! s3-0 (-> (the-as process-drawable v1-13) root trans)) - ) - ) - s3-0 + (when (and a3-0 (and (< 0.0 (-> a3-0 alpha)) (or (< v1-5 0) (< (the-as int (-> a2-3 last-updated)) a0-5)))) + (set! v1-5 a1-1) + (set! a0-5 (the-as int (-> a2-3 last-updated))) + ) + ) + ) + (let ((a1-5 (current-time))) + (if (or (< v1-5 0) (= a0-5 a1-5)) + (goto cfg-68) + ) + ) + ) + (let ((s4-0 (-> obj trail v1-5)) + (s3-0 (the-as object #f)) + ) + (let* ((v1-9 (-> s4-0 used-by)) + (s2-0 (-> v1-9 position)) + ) + (set! s3-0 (cond + ((= s2-0 #t) + (let* ((s2-1 (handle->process (-> v1-9 handle))) + (v1-13 (if (type? s2-1 process-drawable) + s2-1 + ) + ) + ) + (if v1-13 + (set! s3-0 (-> (the-as process-drawable v1-13) root trans)) + ) ) - ((and (= (logand (the-as int s2-0) 7) 4) (= (-> (the-as basic s2-0) type) entity-actor)) - (let* ((v1-19 s2-0) - (s3-1 (if v1-19 - (-> (the-as entity-actor v1-19) extra process) - ) - ) - (v1-21 (if (type? s3-1 process-drawable) - s3-1 - ) - ) - ) - (if v1-21 - (set! s3-0 (-> (the-as process-drawable v1-21) root trans)) - (set! s3-0 (-> (the-as entity-actor s2-0) extra trans)) - ) - ) - s3-0 + s3-0 + ) + ((and (= (logand (the-as int s2-0) 7) 4) (= (-> (the-as basic s2-0) type) entity-actor)) + (let* ((v1-19 s2-0) + (s3-1 (if v1-19 + (-> (the-as entity-actor v1-19) extra process) + ) + ) + (v1-21 (if (type? s3-1 process-drawable) + s3-1 + ) + ) + ) + (if v1-21 + (set! s3-0 (-> (the-as process-drawable v1-21) root trans)) + (set! s3-0 (-> (the-as entity-actor s2-0) extra trans)) + ) ) - (else - s2-0 - ) + s3-0 + ) + (else + s2-0 ) - ) - ) - (when s3-0 - (do-search! s5-0 (target-pos 0) (the-as vector s3-0) (-> s4-0 cached-info)) - (set! (-> s4-0 search-id) (-> s5-0 search-id)) - ) + ) + ) + ) + (when s3-0 + (do-search! s5-0 (target-pos 0) (the-as vector s3-0) (-> s4-0 cached-info)) + (set! (-> s4-0 search-id) (-> s5-0 search-id)) ) ) ) - ((or (= v1-2 3) (= v1-2 2)) - (countdown (v1-33 6) - (let ((s4-1 (-> obj trail v1-33))) - (when (and (= (-> s4-1 search-id) (-> s5-0 search-id)) (-> s4-1 used-by)) - (set! (-> s4-1 node-count) - (get-path-to-root s5-0 (-> s4-1 node-id) 64 (&-> s4-1 goal-node-id) (&-> s4-1 node-path-dist)) - ) - (set! (-> s4-1 last-updated) (the-as uint (-> pp clock frame-counter))) - (goto cfg-64) - ) + ) + ((or (= v1-2 3) (= v1-2 2)) + (countdown (v1-33 6) + (let ((s4-1 (-> obj trail v1-33))) + (when (and (= (-> s4-1 search-id) (-> s5-0 search-id)) (-> s4-1 used-by)) + (set! (-> s4-1 node-count) + (get-path-to-root s5-0 (-> s4-1 node-id) 64 (&-> s4-1 goal-node-id) (&-> s4-1 node-path-dist)) + ) + (set! (-> s4-1 last-updated) (the-as uint (current-time))) + (goto cfg-64) ) ) - (label cfg-64) - (reset-search-state s5-0) ) - ) + (label cfg-64) + (reset-search-state s5-0) + ) ) + ) ;; added in PC port: they timed stuff, we just allow it to run a fixed number of iterations. (+! v1-1 100) (.mfc0 v1-1 Count) - ) ) - (label cfg-68) - 0 ) + (label cfg-68) + 0 ) - 0 - (none) ) + 0 + (none) ) (defmethod get-trail-for-connection minimap ((obj minimap) (arg0 connection-minimap) (arg1 symbol)) @@ -1159,7 +1155,7 @@ (let ((f30-0 1.0)) (when (logtest? (-> s3-0 class flags) (minimap-flag trail)) (let ((v1-26 (get-trail-for-connection *minimap* s3-0 #f))) - (if (or (not v1-26) (>= (- (-> pp clock frame-counter) (the-as int (-> v1-26 last-updated))) (seconds 5))) + (if (or (not v1-26) (>= (- (current-time) (the-as int (-> v1-26 last-updated))) (seconds 5))) (set! f30-0 0.0001) ) ) @@ -2332,7 +2328,7 @@ (set! s2-0 #t) (set! (-> arg1 edge-ry) -131072.0) ) - ((>= (- (-> pp clock frame-counter) (the-as int (-> a2-2 last-updated))) (seconds 5)) + ((>= (- (current-time) (the-as int (-> a2-2 last-updated))) (seconds 5)) (set! s2-0 #t) (set! (-> arg1 edge-ry) -131072.0) ) diff --git a/goal_src/jak2/engine/ui/progress/progress-draw.gc b/goal_src/jak2/engine/ui/progress/progress-draw.gc index a0aeb818ff..10aa51c6f9 100644 --- a/goal_src/jak2/engine/ui/progress/progress-draw.gc +++ b/goal_src/jak2/engine/ui/progress/progress-draw.gc @@ -116,7 +116,7 @@ (let ((a0-5 arg0)) (set! (-> a0-5 flags) (font-flags kerning middle large)) ) - (if (< (mod (-> self clock frame-counter) 300) 210) + (if (< (mod (current-time) 300) 210) (print-game-text (lookup-text! *common-text* (text-id progress-memcard-loading-data) #f) arg0 @@ -2413,60 +2413,58 @@ ) (defmethod draw-option menu-loading-option ((obj menu-loading-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (with-pp - (let ((f30-0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) - (set! (-> arg1 alpha) (- 1.0 (-> arg0 menu-transition))) - (let ((v1-3 arg1)) - (set! (-> v1-3 scale) 0.55) - ) - (let ((s4-0 arg1)) - (set! (-> s4-0 color) (progress-selected 0)) - ) - (let ((a0-3 arg1)) - (set! (-> a0-3 flags) (font-flags kerning middle left large)) - ) - (set! (-> arg1 origin x) 120.0) - (set! (-> arg1 origin y) 110.0) - (let ((v1-8 arg1)) - (set! (-> v1-8 width) (the float 270)) - ) - (let ((v1-9 arg1)) - (set! (-> v1-9 height) (the float 35)) - ) - (if (< f30-0 0.0) - 0.0 - ) + (let ((f30-0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) + (set! (-> arg1 alpha) (- 1.0 (-> arg0 menu-transition))) + (let ((v1-3 arg1)) + (set! (-> v1-3 scale) 0.55) ) - (when (or (< (mod (-> pp clock frame-counter) 300) 150) (!= (-> arg0 menu-transition) 0.0)) - (let ((a1-1 416)) - (case (-> arg0 current) - (('saving) - (set! a1-1 415) - ) - (('formatting) - (set! a1-1 417) - ) - (('creating) - (set! a1-1 418) - ) - ) - (print-game-text (lookup-text! *common-text* (the-as text-id a1-1) #f) arg1 #f 44 (bucket-id progress)) + (let ((s4-0 arg1)) + (set! (-> s4-0 color) (progress-selected 0)) + ) + (let ((a0-3 arg1)) + (set! (-> a0-3 flags) (font-flags kerning middle left large)) + ) + (set! (-> arg1 origin x) 120.0) + (set! (-> arg1 origin y) 110.0) + (let ((v1-8 arg1)) + (set! (-> v1-8 width) (the float 270)) + ) + (let ((v1-9 arg1)) + (set! (-> v1-9 height) (the float 35)) + ) + (if (< f30-0 0.0) + 0.0 ) - ) - (set! (-> arg1 origin y) (+ 45.0 (-> arg1 origin y))) - (let ((v1-25 arg1)) - (set! (-> v1-25 height) (the float 160)) - ) - (let ((a0-16 arg1)) - (set! (-> a0-16 color) (font-color #7efbfb)) - ) - (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* arg1 #f 44 (bucket-id progress)) - ) - 0 - (none) ) + (when (or (< (mod (current-time) 300) 150) (!= (-> arg0 menu-transition) 0.0)) + (let ((a1-1 416)) + (case (-> arg0 current) + (('saving) + (set! a1-1 415) + ) + (('formatting) + (set! a1-1 417) + ) + (('creating) + (set! a1-1 418) + ) + ) + (print-game-text (lookup-text! *common-text* (the-as text-id a1-1) #f) arg1 #f 44 (bucket-id progress)) + ) + ) + (set! (-> arg1 origin y) (+ 45.0 (-> arg1 origin y))) + (let ((v1-25 arg1)) + (set! (-> v1-25 height) (the float 160)) + ) + (let ((a0-16 arg1)) + (set! (-> a0-16 color) (font-color #7efbfb)) + ) + (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* arg1 #f 44 (bucket-id progress)) + ) + 0 + (none) ) (defmethod draw-option menu-insufficient-space-option ((obj menu-insufficient-space-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) diff --git a/goal_src/jak2/engine/ui/progress/progress.gc b/goal_src/jak2/engine/ui/progress/progress.gc index 3e211c26c8..8c01c0c55f 100644 --- a/goal_src/jak2/engine/ui/progress/progress.gc +++ b/goal_src/jak2/engine/ui/progress/progress.gc @@ -1238,13 +1238,13 @@ (let ((gp-4 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *x-vector* - (* 182.04445 (* (-> self swing) (sin (the float (* 40 (-> self clock frame-counter)))))) + (* 182.04445 (* (-> self swing) (sin (the float (* 40 (current-time)))))) ) ) (s5-4 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *y-vector* - (* 182.04445 (* (-> self swing) (sin (the float (* 0 (-> self clock frame-counter)))))) + (* 182.04445 (* (-> self swing) (sin (the float (* 0 (current-time)))))) ) ) ) @@ -1881,8 +1881,8 @@ (set! f30-0 (-> (the-as (pointer float) gp-0))) ) ) - (when (< (seconds 0.03) (- (-> self clock frame-counter) (-> *progress-state* last-slider-sound))) - (set! (-> *progress-state* last-slider-sound) (-> self clock frame-counter)) + (when (< (seconds 0.03) (- (current-time) (-> *progress-state* last-slider-sound))) + (set! (-> *progress-state* last-slider-sound) (current-time)) (sound-play-by-name (static-sound-name "menu-slide") (new-sound-id) @@ -2401,7 +2401,7 @@ ) (else (sound-play "generic-beep") - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (set! (-> arg0 current) 'none) (set-next-state arg0 s3-0 0) ) @@ -2496,7 +2496,7 @@ (cond ((-> *progress-state* yes-no-choice) (set! (-> *setting-control* user-default video-mode) (-> *progress-state* video-mode-choice)) - (set! (-> *progress-state* video-mode-timeout) (-> self clock frame-counter)) + (set! (-> *progress-state* video-mode-timeout) (current-time)) (set-next-state arg0 'video-mode-ok 0) ) (else @@ -2549,7 +2549,7 @@ ) ) (when (and (nonzero? (-> *progress-state* video-mode-timeout)) - (< (seconds 10) (- (-> self clock frame-counter) (-> *progress-state* video-mode-timeout))) + (< (seconds 10) (- (current-time) (-> *progress-state* video-mode-timeout))) ) (set! (-> *progress-state* video-mode-timeout) 0) (set! (-> *progress-state* video-mode-choice) 'pal) @@ -2584,7 +2584,7 @@ (sound-play "generic-beep") (set-progressive-scan #t) (set! (-> *progress-state* graphic-options-progressive-scan) #t) - (set! (-> *progress-state* progressive-mode-timeout) (-> self clock frame-counter)) + (set! (-> *progress-state* progressive-mode-timeout) (current-time)) (set-next-state arg0 'progressive-mode-ok 0) ) (else @@ -2641,7 +2641,7 @@ ) ) (when (and (nonzero? (-> *progress-state* progressive-mode-timeout)) - (< (seconds 10) (- (-> self clock frame-counter) (-> *progress-state* progressive-mode-timeout))) + (< (seconds 10) (- (current-time) (-> *progress-state* progressive-mode-timeout))) ) (set! (-> *progress-state* progressive-mode-timeout) 0) (set! (-> *setting-control* user-default use-progressive-scan) #f) @@ -2846,10 +2846,10 @@ (cond ((or (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (when (> (-> obj task-index) 0) (set! s4-0 #t) (+! (-> obj task-index) -1) @@ -2858,10 +2858,10 @@ ) ((or (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (let ((s3-0 -1)) (dotimes (s2-0 (-> *game-info* play-list length)) (let* ((v1-41 (-> *game-info* play-list s2-0)) @@ -2957,10 +2957,10 @@ (cond ((or (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (when (> (-> obj task-index) 0) (set! gp-0 #t) (+! (-> obj task-index) -1) @@ -2969,10 +2969,10 @@ ) ((or (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (when (< (-> obj task-index) (+ (length s4-0) -1)) (set! gp-0 #t) (+! (-> obj task-index) 1) @@ -3026,10 +3026,10 @@ (cond ((or (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (when (> (-> obj task-line-index) 0) (set! s5-0 #t) (+! (-> obj task-line-index) -1) @@ -3038,10 +3038,10 @@ ) ((or (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (when (< (-> obj task-line-index) (+ (-> *progress-state* total-num-tasks) -1)) (+! (-> obj task-line-index) 1) (set! (-> arg0 sliding-height) 1.0) @@ -3088,11 +3088,11 @@ (cond ((or (logtest? (pad-buttons right l-analog-right) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons right l-analog-right) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) (when (< 1 (get-num-highscores)) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (set! s5-0 #t) (set! (-> obj prev-page-index) (-> obj page-index)) (set! (-> obj page-index) (get-next-highscore (-> obj page-index))) @@ -3103,11 +3103,11 @@ ) ((or (logtest? (pad-buttons left l-analog-left) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons left l-analog-left) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) (when (< 1 (get-num-highscores)) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (set! (-> obj prev-page-index) (-> obj page-index)) (set! (-> obj page-index) (get-prev-highscore (-> obj page-index))) (set! s5-0 #t) @@ -3184,10 +3184,10 @@ (cond ((or (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (when (< (-> obj item-index) s2-0) (set! (-> obj prev-item-index) (-> obj item-index)) (set! s5-2 #t) @@ -3198,10 +3198,10 @@ ) ((or (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (when (< s3-0 (-> obj item-index)) (set! (-> obj prev-item-index) (-> obj item-index)) (+! (-> obj item-index) -1) @@ -3269,10 +3269,10 @@ (cond ((or (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> *progress-state* game-options-last-move))) (seconds 0.5)) + (>= (- (current-time) (the-as int (-> *progress-state* game-options-last-move))) (seconds 0.5)) ) ) - (set! (-> *progress-state* game-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* game-options-last-move) (the-as uint (current-time))) (cond ((< (-> *progress-state* game-options-item-selected) 3) (+! (-> *progress-state* game-options-item-selected) 1) @@ -3285,10 +3285,10 @@ ) ((or (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> *progress-state* game-options-last-move))) (seconds 0.5)) + (>= (- (current-time) (the-as int (-> *progress-state* game-options-last-move))) (seconds 0.5)) ) ) - (set! (-> *progress-state* game-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* game-options-last-move) (the-as uint (current-time))) (if (> (-> *progress-state* game-options-item-selected) 0) (+! (-> *progress-state* game-options-item-selected) -1) (set! (-> *progress-state* game-options-item-selected) 3) @@ -3297,7 +3297,7 @@ ((logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm)) (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm)) - (set! (-> *progress-state* game-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* game-options-last-move) (the-as uint (current-time))) (set! (-> *progress-state* game-options-item-picked) (the-as basic #t)) (sound-play "generic-beep") ) @@ -3444,57 +3444,55 @@ ) (defun update-center-screen () - (with-pp - (let ((v1-0 #f)) - (cond - (#t - (cond - ((logtest? (pad-buttons left l-analog-left) (-> *cpad-list* cpads 0 button0-abs 0)) - (set! (-> *setting-control* user-default display-dx) - (min-max-wrap-around (+ (-> *setting-control* user-default display-dx) -2) -96 96) - ) - (set! v1-0 #t) - ) - ((logtest? (pad-buttons right l-analog-right) (-> *cpad-list* cpads 0 button0-abs 0)) - (set! (-> *setting-control* user-default display-dx) - (min-max-wrap-around (+ (-> *setting-control* user-default display-dx) 2) -96 96) - ) - (set! v1-0 #t) - ) - ((logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (set! (-> *setting-control* user-default display-dy) - (min-max-wrap-around (+ (-> *setting-control* user-default display-dy) -2) -48 48) - ) - (set! v1-0 #f) - ) - ((logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (set! (-> *setting-control* user-default display-dy) - (min-max-wrap-around (+ (-> *setting-control* user-default display-dy) 2) -48 48) - ) - (set! v1-0 #f) - ) - ((cpad-pressed? 0 triangle) - (set! (-> *setting-control* user-default display-dx) (-> *progress-state* center-x-backup)) - (set! (-> *setting-control* user-default display-dy) (-> *progress-state* center-y-backup)) - ) - ) - ) - (else - (when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) - (set! (-> *progress-state* center-x-backup) (-> *setting-control* user-default display-dx)) - (set! (-> *progress-state* center-y-backup) (-> *setting-control* user-default display-dy)) - ) + (let ((v1-0 #f)) + (cond + (#t + (cond + ((logtest? (pad-buttons left l-analog-left) (-> *cpad-list* cpads 0 button0-abs 0)) + (set! (-> *setting-control* user-default display-dx) + (min-max-wrap-around (+ (-> *setting-control* user-default display-dx) -2) -96 96) + ) + (set! v1-0 #t) + ) + ((logtest? (pad-buttons right l-analog-right) (-> *cpad-list* cpads 0 button0-abs 0)) + (set! (-> *setting-control* user-default display-dx) + (min-max-wrap-around (+ (-> *setting-control* user-default display-dx) 2) -96 96) + ) + (set! v1-0 #t) + ) + ((logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) + (set! (-> *setting-control* user-default display-dy) + (min-max-wrap-around (+ (-> *setting-control* user-default display-dy) -2) -48 48) + ) + (set! v1-0 #f) + ) + ((logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) + (set! (-> *setting-control* user-default display-dy) + (min-max-wrap-around (+ (-> *setting-control* user-default display-dy) 2) -48 48) + ) + (set! v1-0 #f) + ) + ((cpad-pressed? 0 triangle) + (set! (-> *setting-control* user-default display-dx) (-> *progress-state* center-x-backup)) + (set! (-> *setting-control* user-default display-dy) (-> *progress-state* center-y-backup)) + ) ) ) - (when v1-0 - (when (< (seconds 0.3) (- (-> pp clock frame-counter) (-> *progress-state* last-slider-sound))) - (set! (-> *progress-state* last-slider-sound) (-> pp clock frame-counter)) - (sound-play "roll-over") + (else + (when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) + (set! (-> *progress-state* center-x-backup) (-> *setting-control* user-default display-dx)) + (set! (-> *progress-state* center-y-backup) (-> *setting-control* user-default display-dy)) ) ) ) - 0 + (when v1-0 + (when (< (seconds 0.3) (- (current-time) (-> *progress-state* last-slider-sound))) + (set! (-> *progress-state* last-slider-sound) (current-time)) + (sound-play "roll-over") + ) + ) ) + 0 ) (defmethod respond-progress menu-graphic-option ((obj menu-graphic-option) (arg0 progress) (arg1 object)) @@ -3507,12 +3505,10 @@ (cond ((or (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> *progress-state* graphic-options-last-move))) - (seconds 0.5) - ) + (>= (- (current-time) (the-as int (-> *progress-state* graphic-options-last-move))) (seconds 0.5)) ) ) - (set! (-> *progress-state* graphic-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* graphic-options-last-move) (the-as uint (current-time))) (set! (-> arg0 selected-option) #f) (cond ((< (-> *progress-state* graphic-options-item-selected) (if (= (scf-get-territory) 1) @@ -3531,12 +3527,10 @@ ) ((or (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> *progress-state* graphic-options-last-move))) - (seconds 0.5) - ) + (>= (- (current-time) (the-as int (-> *progress-state* graphic-options-last-move))) (seconds 0.5)) ) ) - (set! (-> *progress-state* graphic-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* graphic-options-last-move) (the-as uint (current-time))) (set! (-> arg0 selected-option) #f) (cond ((> (-> *progress-state* graphic-options-item-selected) 0) @@ -3556,7 +3550,7 @@ ((logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm)) (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm)) - (set! (-> *progress-state* graphic-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* graphic-options-last-move) (the-as uint (current-time))) (set! (-> *progress-state* graphic-options-item-picked) (the-as basic #t)) (set! (-> arg0 selected-option) #f) (sound-play "generic-beep") @@ -3744,10 +3738,10 @@ (cond ((or (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> *progress-state* qr-options-last-move))) (seconds 0.5)) + (>= (- (current-time) (the-as int (-> *progress-state* qr-options-last-move))) (seconds 0.5)) ) ) - (set! (-> *progress-state* qr-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* qr-options-last-move) (the-as uint (current-time))) (cond ((< (-> *progress-state* qr-options-item-selected) 1) (+! (-> *progress-state* qr-options-item-selected) 1) @@ -3765,10 +3759,10 @@ ) ((or (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> *progress-state* qr-options-last-move))) (seconds 0.5)) + (>= (- (current-time) (the-as int (-> *progress-state* qr-options-last-move))) (seconds 0.5)) ) ) - (set! (-> *progress-state* qr-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* qr-options-last-move) (the-as uint (current-time))) (cond ((> (-> *progress-state* qr-options-item-selected) 0) (+! (-> *progress-state* qr-options-item-selected) -1) @@ -3785,7 +3779,7 @@ ((logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm)) (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm)) - (set! (-> *progress-state* qr-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* qr-options-last-move) (the-as uint (current-time))) (set! (-> *progress-state* qr-options-item-picked) (the-as basic #t)) (set! (-> arg0 selected-option) #t) (sound-play "generic-beep") diff --git a/goal_src/jak2/engine/util/smush-control-h.gc b/goal_src/jak2/engine/util/smush-control-h.gc index 85d0b67e3f..dd069caa1a 100644 --- a/goal_src/jak2/engine/util/smush-control-h.gc +++ b/goal_src/jak2/engine/util/smush-control-h.gc @@ -46,52 +46,48 @@ ) (defmethod update! smush-control ((obj smush-control)) - (with-pp - (cond - ((!= (-> obj amp) 0.0) - (let* ((f30-0 (the float (- (-> pp clock frame-counter) (-> obj start-time)))) - (f0-2 (-> obj period)) - (f28-0 (- f30-0 (* (the float (the int (/ f30-0 f0-2))) f0-2))) - ) - (when (>= (- f30-0 (-> obj ticks)) (-> obj period)) - (set! (-> obj amp) (* (-> obj amp) (-> obj damp-amp))) - (set! (-> obj period) (* (-> obj period) (-> obj damp-period))) - (set! (-> obj ticks) f30-0) - (if (< (-> obj damp-period) 0.0) - (set-zero! obj) - ) - ) - (if (>= f30-0 (-> obj duration)) + (cond + ((!= (-> obj amp) 0.0) + (let* ((f30-0 (the float (- (current-time) (-> obj start-time)))) + (f0-2 (-> obj period)) + (f28-0 (- f30-0 (* (the float (the int (/ f30-0 f0-2))) f0-2))) + ) + (when (>= (- f30-0 (-> obj ticks)) (-> obj period)) + (set! (-> obj amp) (* (-> obj amp) (-> obj damp-amp))) + (set! (-> obj period) (* (-> obj period) (-> obj damp-period))) + (set! (-> obj ticks) f30-0) + (if (< (-> obj damp-period) 0.0) (set-zero! obj) ) - (* (sin (/ (* 65536.0 f28-0) (-> obj period))) - (* (-> obj amp) (/ (- (-> obj duration) f30-0) (-> obj duration))) - ) ) + (if (>= f30-0 (-> obj duration)) + (set-zero! obj) + ) + (* (sin (/ (* 65536.0 f28-0) (-> obj period))) + (* (-> obj amp) (/ (- (-> obj duration) f30-0) (-> obj duration))) + ) ) - (else - 0.0 - ) + ) + (else + 0.0 ) ) ) (defmethod get-no-update smush-control ((obj smush-control)) - (with-pp - (cond - ((!= (-> obj amp) 0.0) - (let* ((f30-0 (the float (- (-> pp clock frame-counter) (-> obj start-time)))) - (f0-2 (-> obj period)) - (f0-4 (- f30-0 (* (the float (the int (/ f30-0 f0-2))) f0-2))) - ) - (* (sin (/ (* 65536.0 f0-4) (-> obj period))) - (* (-> obj amp) (/ (- (-> obj duration) f30-0) (-> obj duration))) + (cond + ((!= (-> obj amp) 0.0) + (let* ((f30-0 (the float (- (current-time) (-> obj start-time)))) + (f0-2 (-> obj period)) + (f0-4 (- f30-0 (* (the float (the int (/ f30-0 f0-2))) f0-2))) ) - ) + (* (sin (/ (* 65536.0 f0-4) (-> obj period))) + (* (-> obj amp) (/ (- (-> obj duration) f30-0) (-> obj duration))) + ) ) - (else - 0.0 - ) + ) + (else + 0.0 ) ) ) diff --git a/goal_src/jak2/engine/util/sync-info.gc b/goal_src/jak2/engine/util/sync-info.gc index fc192b67bb..0cb6c60d5a 100644 --- a/goal_src/jak2/engine/util/sync-info.gc +++ b/goal_src/jak2/engine/util/sync-info.gc @@ -7,6 +7,7 @@ ;; DECOMP BEGINS +;; WARN: Return type mismatch object vs none. (defmethod initialize! sync-info ((obj sync-info) (arg0 sync-info-params)) "Set up a sync-info from params." (format 0 "ERROR: Invalid call to sync-info::initialize!~%") @@ -15,13 +16,11 @@ (defmethod get-current-phase-no-mod sync-info ((obj sync-info)) "Get the current value, with no fancy modifications." - (with-pp - (let* ((v1-0 (-> obj period)) - (f0-1 (the float v1-0)) - (f1-2 (+ (the float (mod (the-as uint (-> pp clock frame-counter)) v1-0)) (-> obj offset))) - ) - (/ (- f1-2 (* (the float (the int (/ f1-2 f0-1))) f0-1)) f0-1) - ) + (let* ((v1-0 (-> obj period)) + (f0-1 (the float v1-0)) + (f1-2 (+ (the float (mod (the-as uint (current-time)) v1-0)) (-> obj offset))) + ) + (/ (- f1-2 (* (the float (the int (/ f1-2 f0-1))) f0-1)) f0-1) ) ) @@ -32,19 +31,17 @@ (defmethod sync-now! sync-info ((obj sync-info) (arg0 float)) "Adjust our offset so our current phase is the given phase." - (with-pp - (let* ((a2-0 (-> obj period)) - (f0-1 (the float a2-0)) - (v1-0 (- arg0 (* (the float (the int (/ arg0 f0-1))) f0-1))) - (f1-4 (+ (the float (mod (the-as uint (-> pp clock frame-counter)) a2-0)) (-> obj offset))) - (f1-6 (/ (- f1-4 (* (the float (the int (/ f1-4 f0-1))) f0-1)) f0-1)) - (f1-10 (+ (* (- v1-0 f1-6) f0-1) f0-1 (-> obj offset))) - ) - (set! (-> obj offset) (- f1-10 (* (the float (the int (/ f1-10 f0-1))) f0-1))) - ) - 0 - (none) + (let* ((a2-0 (-> obj period)) + (f0-1 (the float a2-0)) + (v1-0 (- arg0 (* (the float (the int (/ arg0 f0-1))) f0-1))) + (f1-4 (+ (the float (mod (the-as uint (current-time)) a2-0)) (-> obj offset))) + (f1-6 (/ (- f1-4 (* (the float (the int (/ f1-4 f0-1))) f0-1)) f0-1)) + (f1-10 (+ (* (- v1-0 f1-6) f0-1) f0-1 (-> obj offset))) + ) + (set! (-> obj offset) (- f1-10 (* (the float (the int (/ f1-10 f0-1))) f0-1))) ) + 0 + (none) ) (defmethod get-norm! sync-info ((obj sync-info) (arg0 int)) @@ -60,19 +57,18 @@ (defmethod get-timeframe-offset! sync-info ((obj sync-info) (arg0 time-frame)) "Get the difference between the given time-frame and when this sync-info is at 0." - (with-pp - (if (zero? arg0) - (set! arg0 (-> pp clock frame-counter)) - ) - (let* ((v1-4 (-> obj period)) - (f0-1 (the float v1-4)) - (f1-2 (+ (the float (mod arg0 (the-as time-frame v1-4))) (-> obj offset))) - ) - (+ arg0 (the int (- f0-1 (* (/ (- f1-2 (* (the float (the int (/ f1-2 f0-1))) f0-1)) f0-1) f0-1)))) + (if (zero? arg0) + (set! arg0 (current-time)) ) + (let* ((v1-4 (-> obj period)) + (f0-1 (the float v1-4)) + (f1-2 (+ (the float (mod arg0 (the-as time-frame v1-4))) (-> obj offset))) + ) + (+ arg0 (the int (- f0-1 (* (/ (- f1-2 (* (the float (the int (/ f1-2 f0-1))) f0-1)) f0-1) f0-1)))) ) ) +;; WARN: Return type mismatch float vs none. (defmethod initialize! sync-linear ((obj sync-linear) (arg0 sync-info-params)) "Set up a sync-info from params." (local-vars (sv-16 res-tag)) @@ -110,29 +106,27 @@ (defmethod get-norm! sync-linear ((obj sync-linear) (arg0 int)) "Get the current value, from 0 to 1." - (with-pp - (if (zero? arg0) - (set! arg0 (the-as int (-> pp clock frame-counter))) - ) - (let* ((v1-4 (-> obj period)) - (f0-1 (the float v1-4)) - ) - (cond - ((logtest? (-> obj sync-flags) (sync-flags pong)) - (let* ((f1-0 2.0) - (f2-2 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) - (f0-3 (* f1-0 (/ (- f2-2 (* (the float (the int (/ f2-2 f0-1))) f0-1)) f0-1))) - ) - (if (>= f0-3 1.0) - (set! f0-3 (- 2.0 f0-3)) - ) - f0-3 - ) + (if (zero? arg0) + (set! arg0 (the-as int (current-time))) + ) + (let* ((v1-4 (-> obj period)) + (f0-1 (the float v1-4)) ) - (else - (let ((f1-5 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset)))) - (/ (- f1-5 (* (the float (the int (/ f1-5 f0-1))) f0-1)) f0-1) - ) + (cond + ((logtest? (-> obj sync-flags) (sync-flags pong)) + (let* ((f1-0 2.0) + (f2-2 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) + (f0-3 (* f1-0 (/ (- f2-2 (* (the float (the int (/ f2-2 f0-1))) f0-1)) f0-1))) + ) + (if (>= f0-3 1.0) + (set! f0-3 (- 2.0 f0-3)) + ) + f0-3 + ) + ) + (else + (let ((f1-5 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset)))) + (/ (- f1-5 (* (the float (the int (/ f1-5 f0-1))) f0-1)) f0-1) ) ) ) @@ -144,6 +138,7 @@ (* (get-norm! obj arg1) arg0) ) +;; WARN: Return type mismatch float vs none. (defmethod initialize! sync-eased ((obj sync-eased) (arg0 sync-info-params)) "Set up a sync-info from params." (local-vars (sv-16 res-tag)) @@ -245,67 +240,65 @@ (defmethod get-norm! sync-eased ((obj sync-eased) (arg0 int)) "Get the current value, from 0 to 1." - (with-pp - (if (zero? arg0) - (set! arg0 (the-as int (-> pp clock frame-counter))) - ) - (let* ((v1-4 (-> obj period)) - (f3-0 (the float v1-4)) - (f0-1 (-> obj pause-in)) - (f2-0 (-> obj pause-out)) - (f1-1 (* 0.5 (- f3-0 (+ f0-1 f2-0)))) + (if (zero? arg0) + (set! arg0 (the-as int (current-time))) + ) + (let* ((v1-4 (-> obj period)) + (f3-0 (the float v1-4)) + (f0-1 (-> obj pause-in)) + (f2-0 (-> obj pause-out)) + (f1-1 (* 0.5 (- f3-0 (+ f0-1 f2-0)))) + ) + (the int (+ f0-1 f2-0 f3-0)) + (cond + ((logtest? (-> obj sync-flags) (sync-flags pong)) + (let* ((f4-7 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) + (f3-2 (- f4-7 (* (the float (the int (/ f4-7 f3-0))) f3-0))) + (v1-6 #f) + ) + (when (>= f3-2 (+ f1-1 f0-1)) + (set! v1-6 #t) + (set! f3-2 (- f3-2 (+ f1-1 f0-1))) + f0-1 + (set! f0-1 f2-0) ) - (the int (+ f0-1 f2-0 f3-0)) - (cond - ((logtest? (-> obj sync-flags) (sync-flags pong)) - (let* ((f4-7 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) - (f3-2 (- f4-7 (* (the float (the int (/ f4-7 f3-0))) f3-0))) - (v1-6 #f) - ) - (when (>= f3-2 (+ f1-1 f0-1)) - (set! v1-6 #t) - (set! f3-2 (- f3-2 (+ f1-1 f0-1))) - f0-1 - (set! f0-1 f2-0) - ) - (cond - ((< f3-2 f0-1) - (set! f3-2 f0-1) - ) - ((< (+ f0-1 f1-1) f3-2) - (set! f3-2 (+ f0-1 f1-1)) - ) - ) - (let* ((f0-3 (/ (- f3-2 f0-1) f1-1)) - (f1-2 (-> obj tlo)) - (f0-8 (/ (cond - ((< f0-3 f1-2) - (* f0-3 f0-3) - ) - ((< f0-3 (-> obj thi)) - (+ (* 2.0 f1-2 (- f0-3 f1-2)) (-> obj ylo)) - ) - (else - (let ((f1-5 (- 1.0 f0-3))) - (- (-> obj yend) (* f1-5 f1-5 (-> obj m2))) - ) + (cond + ((< f3-2 f0-1) + (set! f3-2 f0-1) + ) + ((< (+ f0-1 f1-1) f3-2) + (set! f3-2 (+ f0-1 f1-1)) + ) + ) + (let* ((f0-3 (/ (- f3-2 f0-1) f1-1)) + (f1-2 (-> obj tlo)) + (f0-8 (/ (cond + ((< f0-3 f1-2) + (* f0-3 f0-3) + ) + ((< f0-3 (-> obj thi)) + (+ (* 2.0 f1-2 (- f0-3 f1-2)) (-> obj ylo)) + ) + (else + (let ((f1-5 (- 1.0 f0-3))) + (- (-> obj yend) (* f1-5 f1-5 (-> obj m2))) ) ) - (-> obj yend) ) - ) - ) - (if v1-6 - (set! f0-8 (- 1.0 f0-8)) - ) - f0-8 - ) + (-> obj yend) + ) + ) + ) + (if v1-6 + (set! f0-8 (- 1.0 f0-8)) + ) + f0-8 ) ) - (else - (format 0 "ERROR: Attempting to use sync-eased in unsupported non-pong mode.~%") - 0.0 - ) + ) + (else + (format 0 "ERROR: Attempting to use sync-eased in unsupported non-pong mode.~%") + 0.0 ) ) ) @@ -316,6 +309,7 @@ (* (get-norm! obj arg1) arg0) ) +;; WARN: Return type mismatch float vs none. (defmethod initialize! sync-paused ((obj sync-paused) (arg0 sync-info-params)) "Set up a sync-info from params." (local-vars (sv-16 res-tag)) @@ -379,46 +373,44 @@ (defmethod get-norm! sync-paused ((obj sync-paused) (arg0 int)) "Get the current value, from 0 to 1." - (with-pp - (if (zero? arg0) - (set! arg0 (the-as int (-> pp clock frame-counter))) - ) - (let* ((v1-4 (-> obj period)) - (f2-0 (the float v1-4)) - (f0-1 (-> obj pause-in)) - (f1-0 (-> obj pause-out)) + (if (zero? arg0) + (set! arg0 (the-as int (current-time))) + ) + (let* ((v1-4 (-> obj period)) + (f2-0 (the float v1-4)) + (f0-1 (-> obj pause-in)) + (f1-0 (-> obj pause-out)) + ) + (the int (+ f0-1 f1-0 f2-0)) + (cond + ((logtest? (-> obj sync-flags) (sync-flags pong)) + (let* ((f3-5 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) + (f3-6 (- f3-5 (* (the float (the int (/ f3-5 f2-0))) f2-0))) + (f2-2 (* 0.5 (- f2-0 (+ f0-1 f1-0)))) + (v1-7 #f) + ) + (when (>= f3-6 (+ f2-2 f0-1)) + (set! v1-7 #t) + (set! f3-6 (- f3-6 (+ f2-2 f0-1))) + (set! f0-1 f1-0) ) - (the int (+ f0-1 f1-0 f2-0)) - (cond - ((logtest? (-> obj sync-flags) (sync-flags pong)) - (let* ((f3-5 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) - (f3-6 (- f3-5 (* (the float (the int (/ f3-5 f2-0))) f2-0))) - (f2-2 (* 0.5 (- f2-0 (+ f0-1 f1-0)))) - (v1-7 #f) + (let* ((f1-1 (/ (- f3-6 f0-1) f2-2)) + (f0-5 (fmax 0.0 (fmin 1.0 f1-1))) ) - (when (>= f3-6 (+ f2-2 f0-1)) - (set! v1-7 #t) - (set! f3-6 (- f3-6 (+ f2-2 f0-1))) - (set! f0-1 f1-0) - ) - (let* ((f1-1 (/ (- f3-6 f0-1) f2-2)) - (f0-5 (fmax 0.0 (fmin 1.0 f1-1))) - ) - (if v1-7 - (set! f0-5 (- 1.0 f0-5)) - ) - f0-5 - ) + (if v1-7 + (set! f0-5 (- 1.0 f0-5)) + ) + f0-5 ) ) - (else - (let* ((f3-9 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) - (f3-10 (- f3-9 (* (the float (the int (/ f3-9 f2-0))) f2-0))) - (f1-5 (- f2-0 (+ f0-1 f1-0))) - (f1-6 (/ (- f3-10 f0-1) f1-5)) - ) - (fmax 0.0 (fmin 1.0 f1-6)) - ) + ) + (else + (let* ((f3-9 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) + (f3-10 (- f3-9 (* (the float (the int (/ f3-9 f2-0))) f2-0))) + (f1-5 (- f2-0 (+ f0-1 f1-0))) + (f1-6 (/ (- f3-10 f0-1) f1-5)) + ) + (fmax 0.0 (fmin 1.0 f1-6)) ) ) ) @@ -441,31 +433,26 @@ ) (defmethod reset! delayed-rand-float ((obj delayed-rand-float)) - (with-pp - (set! (-> obj start-time) (-> pp clock frame-counter)) - (set! (-> obj timer) (rand-vu-int-range (-> obj min-time) (-> obj max-time))) - (set! (-> obj value) (rand-vu-float-range (- (-> obj max-val)) (-> obj max-val))) - ) + (set! (-> obj start-time) (current-time)) + (set! (-> obj timer) (rand-vu-int-range (-> obj min-time) (-> obj max-time))) + (set! (-> obj value) (rand-vu-float-range (- (-> obj max-val)) (-> obj max-val))) ) (defmethod update! delayed-rand-float ((obj delayed-rand-float)) - (with-pp - (if (>= (- (-> pp clock frame-counter) (-> obj start-time)) (-> obj timer)) - (reset! obj) - ) - (-> obj value) - ) + (if (>= (- (current-time) (-> obj start-time)) (-> obj timer)) + (reset! obj) + ) + (-> obj value) ) +;; WARN: Return type mismatch float vs none. (defmethod update-and-clear! delayed-rand-float ((obj delayed-rand-float)) - (with-pp - (if (>= (- (-> pp clock frame-counter) (-> obj start-time)) (-> obj timer)) - (reset! obj) - (set! (-> obj value) 0.0) - ) - (-> obj value) - (none) - ) + (if (>= (- (current-time) (-> obj start-time)) (-> obj timer)) + (reset! obj) + (set! (-> obj value) 0.0) + ) + (-> obj value) + (none) ) (defmethod set-params! oscillating-float ((obj oscillating-float) (arg0 float) (arg1 float) (arg2 float) (arg3 float)) @@ -547,33 +534,27 @@ ) (defmethod update-now! delayed-rand-vector ((obj delayed-rand-vector)) - (with-pp - (set! (-> obj start-time) (-> pp clock frame-counter)) - (set! (-> obj timer) (rand-vu-int-range (-> obj min-time) (-> obj max-time))) - (set! (-> obj value x) (rand-vu-float-range (- (-> obj xz-max)) (-> obj xz-max))) - (set! (-> obj value y) (rand-vu-float-range (- (-> obj y-max)) (-> obj y-max))) - (set! (-> obj value z) (rand-vu-float-range (- (-> obj xz-max)) (-> obj xz-max))) - (-> obj value) - ) + (set! (-> obj start-time) (current-time)) + (set! (-> obj timer) (rand-vu-int-range (-> obj min-time) (-> obj max-time))) + (set! (-> obj value x) (rand-vu-float-range (- (-> obj xz-max)) (-> obj xz-max))) + (set! (-> obj value y) (rand-vu-float-range (- (-> obj y-max)) (-> obj y-max))) + (set! (-> obj value z) (rand-vu-float-range (- (-> obj xz-max)) (-> obj xz-max))) + (-> obj value) ) (defmethod update-with-delay! delayed-rand-vector ((obj delayed-rand-vector)) - (with-pp - (if (>= (- (-> pp clock frame-counter) (-> obj start-time)) (-> obj timer)) - (update-now! obj) - ) - (-> obj value) - ) + (if (>= (- (current-time) (-> obj start-time)) (-> obj timer)) + (update-now! obj) + ) + (-> obj value) ) (defmethod update-with-delay-or-reset! delayed-rand-vector ((obj delayed-rand-vector)) - (with-pp - (if (>= (- (-> pp clock frame-counter) (-> obj start-time)) (-> obj timer)) - (update-now! obj) - (vector-reset! (-> obj value)) - ) - (-> obj value) - ) + (if (>= (- (current-time) (-> obj start-time)) (-> obj timer)) + (update-now! obj) + (vector-reset! (-> obj value)) + ) + (-> obj value) ) (defmethod set-params! oscillating-vector ((obj oscillating-vector) (arg0 vector) (arg1 float) (arg2 float) (arg3 float)) @@ -620,4 +601,3 @@ (-> obj value) ) ) - diff --git a/goal_src/jak2/kernel/gkernel-h.gc b/goal_src/jak2/kernel/gkernel-h.gc index 886a4adb6e..293548a4c4 100644 --- a/goal_src/jak2/kernel/gkernel-h.gc +++ b/goal_src/jak2/kernel/gkernel-h.gc @@ -739,3 +739,7 @@ "Create a pointer to an object on the scratchpad." `(the-as (pointer ,type) (&+ *fake-scratchpad-data* ,offset)) ) + +(defmacro current-time () + `(-> PP clock frame-counter) + ) diff --git a/goal_src/jak2/levels/atoll/ash1-course.gc b/goal_src/jak2/levels/atoll/ash1-course.gc index e0f49a9233..ae2ffb9846 100644 --- a/goal_src/jak2/levels/atoll/ash1-course.gc +++ b/goal_src/jak2/levels/atoll/ash1-course.gc @@ -90,12 +90,12 @@ ) ) ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + (set! (-> arg1 waypoint-time0) (current-time)) ) (let ((s5-0 (get-current-task-event (-> arg1 task)))) (cond ((and (nonzero? (-> arg1 waypoint-time0)) - (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) + (and (>= (- (current-time) (-> 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-override2 trans))) (= (-> s5-0 action) (game-task-action say)) @@ -194,19 +194,13 @@ (with-pp (when (not (channel-active? arg1 (the-as uint 0))) (cond - ((and (not (speech-playing? arg1 45)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2.5)) - ) + ((and (not (speech-playing? arg1 45)) (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2.5))) (play-speech arg1 45) ) - ((and (not (speech-playing? arg1 46)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 7)) - ) + ((and (not (speech-playing? arg1 46)) (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 7))) (play-speech arg1 46) ) - ((and (not (speech-playing? arg1 47)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 14)) - ) + ((and (not (speech-playing? arg1 47)) (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 14))) (play-speech arg1 47) ) ) @@ -241,22 +235,20 @@ ) ) :on-update (lambda ((arg0 ashelin-battle)) - (with-pp - (set-frontline-dist! arg0) - (let ((s5-0 (target-pos 0))) - (if (>= (-> s5-0 y) 176128.0) - (set! (-> arg0 player-in-bounds-time) (-> pp clock frame-counter)) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg0 player-in-bounds-time)) (seconds 4)) - (send-event arg0 'instant-death) - ) - (if (< (-> s5-0 y) 192512.0) - (logior! (-> arg0 bot-flags) (bot-flags bf10)) - (logclear! (-> arg0 bot-flags) (bot-flags bf10)) - ) - ) - (none) + (set-frontline-dist! arg0) + (let ((s5-0 (target-pos 0))) + (if (>= (-> s5-0 y) 176128.0) + (set! (-> arg0 player-in-bounds-time) (current-time)) + ) + (if (>= (- (current-time) (-> arg0 player-in-bounds-time)) (seconds 4)) + (send-event arg0 'instant-death) + ) + (if (< (-> s5-0 y) 192512.0) + (logior! (-> arg0 bot-flags) (bot-flags bf10)) + (logclear! (-> arg0 bot-flags) (bot-flags bf10)) + ) ) + (none) ) :on-skipping-here #f :check-too-far #f @@ -305,18 +297,16 @@ (set! (-> v1-22 bytes 8) 7) (let ((v0-12 (lambda ((arg0 asht-wait-spot) (arg1 ashelin-battle)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.5)) - (let ((s5-0 (get-current-task-event (-> arg1 task)))) - (when (and (= (-> s5-0 action) (game-task-action say)) - (not (channel-active? arg1 (the-as uint 0))) - (scene-play arg1 (the-as string (-> s5-0 scene)) #f) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 5 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.5)) + (let ((s5-0 (get-current-task-event (-> arg1 task)))) + (when (and (= (-> s5-0 action) (game-task-action say)) + (not (channel-active? arg1 (the-as uint 0))) + (scene-play arg1 (the-as string (-> s5-0 scene)) #f) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 5 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) diff --git a/goal_src/jak2/levels/atoll/atoll-obs.gc b/goal_src/jak2/levels/atoll/atoll-obs.gc index 7fc3baf10c..de8f43e5bf 100644 --- a/goal_src/jak2/levels/atoll/atoll-obs.gc +++ b/goal_src/jak2/levels/atoll/atoll-obs.gc @@ -110,9 +110,7 @@ (+ (-> self init-height) (+ (-> self range-bottom) (get-scaled-val! (-> self sync) f0-1 0))) ) ) - (when (and (logtest? (actor-option user18) (-> self fact options)) - (< (-> self sound-time 0) (-> self clock frame-counter)) - ) + (when (and (logtest? (actor-option user18) (-> self fact options)) (< (-> self sound-time 0) (current-time))) (sound-stop (the-as sound-id (-> self looping-id))) (sound-play "piston-loop" :id (the-as sound-id (-> self looping-id)) :position (-> self sound-trans)) (+! (-> self sound-time 0) (the int (* 0.5 (the float (-> self sync period))))) @@ -424,7 +422,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "liftcat") (none) ) @@ -434,7 +432,7 @@ This commonly includes things such as: (if (>= (-> self down-y) (-> gp-0 trans y)) (go-virtual idle-down) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (set! (-> self root transv y) -8192.0) (set! (-> self root transv y) 0.0) ) @@ -597,38 +595,38 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (the int (-> self cycle-offset))) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (the int (-> self cycle-offset))) (suspend) ) ) (until #f - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (the int (-> self cycle-time))) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (the int (-> self cycle-time))) (suspend) ) ) (activate! (-> self smush) -1.0 60 225 1.0 1.0 (-> self clock)) (sound-play "rot-pipe-wiggle" :position (-> self root-override trans)) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.75)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 0.75)) (set! (-> self shudder-angle) (* 364.0889 (update! (-> self smush)))) (suspend) ) ) (set! (-> self shudder-angle) 0.0) (set-zero! (-> self smush)) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 0.25)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 0.25)) (suspend) ) ) (sound-play "rot-pipe-turn" :position (-> self root-override trans)) (let* ((f0-7 2.0) (f30-1 (* 16384.0 f0-7)) - (gp-6 (-> self clock frame-counter)) + (gp-6 (current-time)) ) - (until (>= (- (-> self clock frame-counter) gp-6) (seconds 0.5)) + (until (>= (- (current-time) gp-6) (seconds 0.5)) (set! (-> self rot-angle) (the float (sar (shl (the int (+ (-> self rot-angle) (* f30-1 (-> self clock seconds-per-frame)))) 48) 48)) ) @@ -752,7 +750,7 @@ This commonly includes things such as: object (case event-type (('touch 'attack) - (when (>= (- (-> self clock frame-counter) (the-as int (-> self collide-off-timer))) (seconds 2)) + (when (>= (- (current-time) (the-as int (-> self collide-off-timer))) (seconds 2)) (let* ((s4-0 proc) (s3-0 (if (type? s4-0 process-focusable) s4-0 @@ -784,7 +782,7 @@ This commonly includes things such as: (send-event-function proc a1-8) ) ) - (let ((v0-0 (-> self clock frame-counter))) + (let ((v0-0 (current-time))) (set! (-> self collide-off-timer) (the-as uint v0-0)) v0-0 ) @@ -1311,9 +1309,9 @@ This commonly includes things such as: () (local-vars (v1-31 symbol)) (set! (-> self data-int32 0) 0) - (set! (-> self beep-time) (-> self clock frame-counter)) + (set! (-> self beep-time) (current-time)) (until #f - (when (>= (- (-> self clock frame-counter) (-> self beep-time)) (seconds 40)) + (when (>= (- (current-time) (-> self beep-time)) (seconds 40)) (let ((v1-7 (logand (-> self data-int32 0) 3))) (cond ((zero? v1-7) @@ -1330,7 +1328,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self beep-time) (-> self clock frame-counter)) + (set! (-> self beep-time) (current-time)) (+! (-> self data-int32 0) 1) ) (b! diff --git a/goal_src/jak2/levels/atoll/juicer.gc b/goal_src/jak2/levels/atoll/juicer.gc index 6bbf5f1bba..acb36ae78c 100644 --- a/goal_src/jak2/levels/atoll/juicer.gc +++ b/goal_src/jak2/levels/atoll/juicer.gc @@ -120,26 +120,24 @@ (defmethod event-handler! juicer-shot ((obj juicer-shot) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Multiplex the projectile's event processing, called by [[projectile-event-handler]]" - (with-pp - (case arg2 - (('reset) - (let ((v1-1 (the-as object (-> arg3 param 0)))) - (set! (-> obj root-override trans quad) (-> (the-as matrix v1-1) trans quad)) - (set! (-> obj starting-pos quad) (-> (the-as matrix v1-1) trans quad)) - (set! (-> obj root-override transv quad) (-> (&+ (the-as matrix v1-1) 64) quad 0)) - (set! (-> obj pre-move-transv quad) (-> (&+ (the-as matrix v1-1) 64) quad 0)) - ) - (set! (-> obj hits) 0) - (set! (-> obj spawn-time) (-> pp clock frame-counter)) - (if (made-impact? obj) - (go (method-of-object obj impact)) - (go (method-of-object obj moving)) - ) - #t + (case arg2 + (('reset) + (let ((v1-1 (the-as object (-> arg3 param 0)))) + (set! (-> obj root-override trans quad) (-> (the-as matrix v1-1) trans quad)) + (set! (-> obj starting-pos quad) (-> (the-as matrix v1-1) trans quad)) + (set! (-> obj root-override transv quad) (-> (&+ (the-as matrix v1-1) 64) quad 0)) + (set! (-> obj pre-move-transv quad) (-> (&+ (the-as matrix v1-1) 64) quad 0)) ) - (else - ((method-of-type projectile event-handler!) obj arg0 arg1 arg2 arg3) - ) + (set! (-> obj hits) 0) + (set! (-> obj spawn-time) (current-time)) + (if (made-impact? obj) + (go (method-of-object obj impact)) + (go (method-of-object obj moving)) + ) + #t + ) + (else + ((method-of-type projectile event-handler!) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1192,9 +1190,9 @@ (when (and (or (logtest? (-> self nav state flags) (nav-state-flag blocked)) (logtest? (-> self nav state flags) (nav-state-flag at-target)) ) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) ) - (if (and (>= (- (-> self clock frame-counter) (-> self last-fire-time)) (rand-vu-int-range (seconds 1) (seconds 2))) + (if (and (>= (- (current-time) (-> self last-fire-time)) (rand-vu-int-range (seconds 1) (seconds 2))) (< 20480.0 f30-0) ) (go-virtual attack) @@ -1205,7 +1203,7 @@ ) (if (and (check-los? (-> self los) 0) (or (>= 11468.8 f30-0) - (and (>= (- (-> self clock frame-counter) (-> self last-fire-time)) (rand-vu-int-range (seconds 5) (seconds 8))) + (and (>= (- (current-time) (-> self last-fire-time)) (rand-vu-int-range (seconds 5) (seconds 8))) (>= 53248.0 f30-0) ) ) @@ -1319,7 +1317,7 @@ (set! (-> self torso-track-player) #f) (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (juicer-method-184 self #f) - (set! (-> self last-fire-time) (-> self clock frame-counter)) + (set! (-> self last-fire-time) (current-time)) (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) @@ -1351,8 +1349,8 @@ (s5-0 (+ (-> v1-29 attack-id) 1)) ) (set! (-> v1-29 attack-id) s5-0) - (let ((s4-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-0) (seconds 0.25)) + (let ((s4-0 (current-time))) + (until (>= (- (current-time) s4-0) (seconds 0.25)) (ja-no-eval :group! juicer-attack0-ja :num! (seek! (the float (+ (-> (the-as art-joint-anim juicer-attack0-ja) frames num-frames) -1))) :frame-num 0.0 @@ -1364,7 +1362,7 @@ (vector-vector-distance (-> self root-override2 trans) (get-trans (the-as process-focusable s3-0) 0)) ) (fire-projectile self (the-as process-focusable s3-0) s5-0) - (-> self clock frame-counter) + (current-time) (if (not gp-0) (set! gp-0 #t) ) @@ -1586,14 +1584,14 @@ (ja-channel-push! 1 (seconds 0.6)) (let ((f30-0 (get-rand-float-range self 0.8 1.2))) (let ((gp-0 (get-rand-int-range self 60 210)) - (s5-0 (-> self clock frame-counter)) + (s5-0 (current-time)) (f28-0 f30-0) ) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info-override idle-anim)) :num! (loop! f28-0) :frame-num 0.0 ) - (until (>= (- (-> self clock frame-counter) s5-0) gp-0) + (until (>= (- (current-time) s5-0) gp-0) (suspend) (ja :num! (loop! f28-0)) ) diff --git a/goal_src/jak2/levels/atoll/sig0-course.gc b/goal_src/jak2/levels/atoll/sig0-course.gc index b8a0615129..33f68d81a6 100644 --- a/goal_src/jak2/levels/atoll/sig0-course.gc +++ b/goal_src/jak2/levels/atoll/sig0-course.gc @@ -885,15 +885,13 @@ ) ) (when (and (demo?) - (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 1)) + (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 1)) (logtest? (-> arg0 waypoint-bits) 16) ) (set! (-> arg0 waypoint-bits) (logand -17 (-> arg0 waypoint-bits))) (talker-spawn-func (-> *talker-speech* 80) *entity-pool* (target-pos 0) (the-as region #f)) ) - (when (or (not (logtest? (-> arg0 waypoint-bits) 8)) - (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 8)) - ) + (when (or (not (logtest? (-> arg0 waypoint-bits) 8)) (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 8))) (if (and (demo?) (not (logtest? (-> arg0 waypoint-bits) 8))) (logior! (-> arg0 waypoint-bits) 16) ) @@ -909,7 +907,7 @@ (set! (-> s5-4 liftcat-speech-index) v1-62) ) ) - (set! (-> arg0 waypoint-time0) (-> pp clock frame-counter)) + (set! (-> arg0 waypoint-time0) (current-time)) ) ) ) @@ -947,57 +945,55 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) - (with-pp - (set! (-> arg1 too-far-warn-dist) 184320.0) - (set! (-> arg1 too-far-fail-dist-delta) 122880.0) - (cond - ((not (logtest? (-> arg1 waypoint-bits) 1)) - (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-override2 trans) (target-pos 0))) - (f1-0 81920.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (logior! (-> arg1 waypoint-bits) 1) - (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) - ) + (set! (-> arg1 too-far-warn-dist) 184320.0) + (set! (-> arg1 too-far-fail-dist-delta) 122880.0) + (cond + ((not (logtest? (-> arg1 waypoint-bits) 1)) + (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-override2 trans) (target-pos 0))) + (f1-0 81920.0) + ) + (cond + ((and (< f0-2 (* f1-0 f1-0)) + (not (channel-active? arg1 (the-as uint 0))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set! (-> arg1 waypoint-time0) (current-time)) + (logior! (-> arg1 waypoint-bits) 1) + (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) ) ) ) ) - ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 2)) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4.5)) - (process-release? arg1) - (process-release? *target*) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 13 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) + ) + ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 2)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4.5)) + (process-release? arg1) + (process-release? *target*) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 13 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) - (remove-setting! 'entity-name) - (logior! (-> arg1 waypoint-bits) 2) - (set-setting! 'sound-mode #f 0.0 1) - ) + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3)) + (remove-setting! 'entity-name) + (logior! (-> arg1 waypoint-bits) 2) + (set-setting! 'sound-mode #f 0.0 1) ) ) - #f ) + #f ) ) ) @@ -1217,14 +1213,11 @@ :on-update (lambda ((arg0 sig-atoll)) (with-pp (b! (not (channel-active? arg0 (the-as uint 0))) cfg-2 :delay (empty-form)) - (set! (-> arg0 waypoint-time0) (-> pp clock frame-counter)) + (set! (-> arg0 waypoint-time0) (current-time)) (b! #t cfg-21 :delay (nop!)) (label cfg-2) (b! - (not (and (not (speech-playing? arg0 12)) - (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 0.75)) - ) - ) + (not (and (not (speech-playing? arg0 12)) (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 0.75)))) cfg-7 :delay (empty-form) ) @@ -1232,7 +1225,7 @@ (b! #t cfg-21 :delay (nop!)) (label cfg-7) (if (and (not (speech-playing? arg0 13)) - (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 0.5)) + (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 0.5)) (outside-spot-radius? arg0 (the-as bot-spot #f) (the-as vector #f) #f) (let ((a1-5 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-5 from) (process->ppointer pp)) @@ -1380,56 +1373,54 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) - (with-pp - (set! (-> arg1 too-far-warn-dist) 184320.0) - (set! (-> arg1 too-far-fail-dist-delta) 122880.0) - (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-override2 trans) (target-pos 0))) - (f1-0 73728.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (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) - ) + (set! (-> arg1 too-far-warn-dist) 184320.0) + (set! (-> arg1 too-far-fail-dist-delta) 122880.0) + (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-override2 trans) (target-pos 0))) + (f1-0 73728.0) + ) + (cond + ((and (< f0-2 (* f1-0 f1-0)) + (not (channel-active? arg1 (the-as uint 0))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set! (-> arg1 waypoint-time0) (current-time)) + (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) ) ) ) ) - ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4.5)) - (process-release? arg1) - (process-release? *target*) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 18 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) + ) + ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4.5)) + (process-release? arg1) + (process-release? *target*) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 18 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) - (remove-setting! 'entity-name) - (logior! (-> arg1 waypoint-bits) 1) - (set-setting! 'sound-mode #f 0.0 1) - ) + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3)) + (remove-setting! 'entity-name) + (logior! (-> arg1 waypoint-bits) 1) + (set-setting! 'sound-mode #f 0.0 1) ) ) - #f ) + #f ) ) ) @@ -1622,15 +1613,13 @@ (none) ) :on-update (lambda ((arg0 sig-atoll)) - (with-pp - (if (and (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 1.5)) - (not (speech-playing? arg0 18)) - (not (channel-active? arg0 (the-as uint 0))) - ) - (play-speech arg0 18) - ) - (none) - ) + (if (and (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 1.5)) + (not (speech-playing? arg0 18)) + (not (channel-active? arg0 (the-as uint 0))) + ) + (play-speech arg0 18) + ) + (none) ) :on-skipping-here #f :check-too-far #f @@ -1680,9 +1669,7 @@ ) ) ) - (when (or (not (logtest? (-> arg1 waypoint-bits) 2)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 8)) - ) + (when (or (not (logtest? (-> arg1 waypoint-bits) 2)) (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 8))) (logior! (-> arg1 waypoint-bits) 2) (let* ((s5-1 (-> arg1 sig-course)) (s4-1 (-> s5-1 liftcat-speech-index)) @@ -1695,7 +1682,7 @@ (set! (-> s5-1 liftcat-speech-index) v1-35) ) ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + (set! (-> arg1 waypoint-time0) (current-time)) ) ) ) @@ -1786,56 +1773,54 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) - (with-pp - (set! (-> arg1 too-far-warn-dist) 184320.0) - (set! (-> arg1 too-far-fail-dist-delta) 122880.0) - (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-override2 trans) (target-pos 0))) - (f1-0 61440.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (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) - ) + (set! (-> arg1 too-far-warn-dist) 184320.0) + (set! (-> arg1 too-far-fail-dist-delta) 122880.0) + (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-override2 trans) (target-pos 0))) + (f1-0 61440.0) + ) + (cond + ((and (< f0-2 (* f1-0 f1-0)) + (not (channel-active? arg1 (the-as uint 0))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set! (-> arg1 waypoint-time0) (current-time)) + (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) ) ) ) ) - ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4.5)) - (process-release? arg1) - (process-release? *target*) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 23 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) + ) + ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4.5)) + (process-release? arg1) + (process-release? *target*) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 23 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) - (remove-setting! 'entity-name) - (logior! (-> arg1 waypoint-bits) 1) - (set-setting! 'sound-mode #f 0.0 1) - ) + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3)) + (remove-setting! 'entity-name) + (logior! (-> arg1 waypoint-bits) 1) + (set-setting! 'sound-mode #f 0.0 1) ) ) - #f ) + #f ) ) ) @@ -2135,63 +2120,61 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) - (with-pp - (set! (-> arg1 too-far-warn-dist) 184320.0) - (set! (-> arg1 too-far-fail-dist-delta) 122880.0) - (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-override2 trans) (target-pos 0))) - (f1-0 73728.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (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) - ) + (set! (-> arg1 too-far-warn-dist) 184320.0) + (set! (-> arg1 too-far-fail-dist-delta) 122880.0) + (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-override2 trans) (target-pos 0))) + (f1-0 73728.0) + ) + (cond + ((and (< f0-2 (* f1-0 f1-0)) + (not (channel-active? arg1 (the-as uint 0))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set! (-> arg1 waypoint-time0) (current-time)) + (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) ) ) ) ) - ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) - (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.1)) - ) - (remove-setting! 'string-startup-vector) - (logior! (-> arg1 waypoint-bits) 2) - ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3.5)) - (process-release? arg1) - (process-release? *target*) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 29 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) + ) + ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) + (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.1)) + ) + (remove-setting! 'string-startup-vector) + (logior! (-> arg1 waypoint-bits) 2) ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) - (set-setting! 'string-startup-vector 'abs (new 'static 'vector :x 1.0) 0) - (remove-setting! 'entity-name) - (logior! (-> arg1 waypoint-bits) 1) - (set-setting! 'sound-mode #f 0.0 1) - ) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3.5)) + (process-release? arg1) + (process-release? *target*) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 29 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) + (set-setting! 'string-startup-vector 'abs (new 'static 'vector :x 1.0) 0) + (remove-setting! 'entity-name) + (logior! (-> arg1 waypoint-bits) 1) + (set-setting! 'sound-mode #f 0.0 1) ) ) - #f ) + #f ) ) ) @@ -2390,7 +2373,7 @@ (with-pp (cond ((not (logtest? (-> arg0 bot-task-bits) 4)) - (when (and (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 0.25)) + (when (and (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 0.25)) (< (-> arg0 sig-course spots 36 center x) (-> (target-pos 0) x)) ) (logior! (-> arg0 bot-task-bits) 4) @@ -2478,17 +2461,13 @@ ) ) :on-update (lambda ((arg0 sig-atoll)) - (with-pp - (sig0-say-look-out-if-should arg0) - (when (and (not (logtest? (-> arg0 waypoint-bits) 1)) - (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 8)) - ) - (logior! (-> arg0 waypoint-bits) 1) - (logior! (-> arg0 focus-status) (focus-status disable)) - (set! (-> arg0 notice-enemy-dist) 16384.0) - ) - (none) + (sig0-say-look-out-if-should arg0) + (when (and (not (logtest? (-> arg0 waypoint-bits) 1)) (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 8))) + (logior! (-> arg0 waypoint-bits) 1) + (logior! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 notice-enemy-dist) 16384.0) ) + (none) ) :on-skipping-here #f :check-too-far 'sig0-final-snipers-check-too-far @@ -2583,7 +2562,7 @@ (with-pp (cond ((not (speech-playing? arg0 27)) - (if (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 0.5)) + (if (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 0.5)) (play-speech arg0 27) ) ) @@ -2592,7 +2571,7 @@ (logior! (-> arg0 waypoint-bits) 1) (logclear! (-> arg0 focus-status) (focus-status disable)) (set! (-> arg0 notice-enemy-dist) 122880.0) - (set! (-> arg0 waypoint-time0) (-> pp clock frame-counter)) + (set! (-> arg0 waypoint-time0) (current-time)) ) ) ((not (logtest? (-> arg0 waypoint-bits) 2)) @@ -2616,15 +2595,13 @@ ) 5 ) - (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 10)) + (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 10)) ) (set! (-> arg0 bot-flags) (logior (bot-flags bf21) (-> arg0 bot-flags))) (logior! (-> arg0 waypoint-bits) 2) ) (else - (if (and (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 4)) - (not (speech-playing? arg0 28)) - ) + (if (and (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 4)) (not (speech-playing? arg0 28))) (play-speech arg0 28) ) ) @@ -2767,61 +2744,59 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) - (with-pp - (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-override2 trans) (target-pos 0))) - (f1-0 61440.0) - ) - (cond - ((and (< f0-0 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (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 + ((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-override2 trans) (target-pos 0))) + (f1-0 61440.0) + ) + (cond + ((and (< f0-0 (* f1-0 f1-0)) + (not (channel-active? arg1 (the-as uint 0))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set! (-> arg1 waypoint-time0) (current-time)) + (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) ) ) ) ) - ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) - (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.1)) - ) - (remove-setting! 'string-startup-vector) - (logior! (-> arg1 waypoint-bits) 2) - ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4.5)) - (process-release? arg1) - (process-release? *target*) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 38 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) + ) + ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) + (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.1)) + ) + (remove-setting! 'string-startup-vector) + (logior! (-> arg1 waypoint-bits) 2) ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) - (set-setting! 'string-startup-vector 'abs (new 'static 'vector :x -1.0) 0) - (remove-setting! 'entity-name) - (logior! (-> arg1 waypoint-bits) 1) - (set-setting! 'sound-mode #f 0.0 1) - ) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4.5)) + (process-release? arg1) + (process-release? *target*) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 38 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3)) + (set-setting! 'string-startup-vector 'abs (new 'static 'vector :x -1.0) 0) + (remove-setting! 'entity-name) + (logior! (-> arg1 waypoint-bits) 1) + (set-setting! 'sound-mode #f 0.0 1) ) ) - #f ) + #f ) ) ) diff --git a/goal_src/jak2/levels/atoll/sniper.gc b/goal_src/jak2/levels/atoll/sniper.gc index 7414104dbe..bb4af53d66 100644 --- a/goal_src/jak2/levels/atoll/sniper.gc +++ b/goal_src/jak2/levels/atoll/sniper.gc @@ -251,7 +251,7 @@ (t9-0) ) ) - (set! (-> self next-pick-time) (-> self clock frame-counter)) + (set! (-> self next-pick-time) (current-time)) (none) ) :code (behavior () @@ -284,11 +284,11 @@ :post (behavior () (when (or (logtest? (-> self nav state flags) (nav-state-flag at-target)) (nav-enemy-method-163 self) - (>= (-> self clock frame-counter) (-> self next-pick-time)) + (>= (current-time) (-> self next-pick-time)) ) (nav-enemy-method-156 self) (nav-enemy-method-162 self) - (set! (-> self next-pick-time) (+ (-> self clock frame-counter) (get-rand-int-range self 300 1050))) + (set! (-> self next-pick-time) (+ (current-time) (get-rand-int-range self 300 1050))) ) (nav-enemy-method-176 self) (none) diff --git a/goal_src/jak2/levels/castle/boss/castle-baron.gc b/goal_src/jak2/levels/castle/boss/castle-baron.gc index e9762208c9..d80e593400 100644 --- a/goal_src/jak2/levels/castle/boss/castle-baron.gc +++ b/goal_src/jak2/levels/castle/boss/castle-baron.gc @@ -1288,13 +1288,13 @@ For example for an elevator pre-compute the distance between the first and last (none) ) :code (behavior () - (set! (-> self wiggle-time) (+ (-> self clock frame-counter) (seconds -10))) + (set! (-> self wiggle-time) (+ (current-time) (seconds -10))) (set! (-> self wiggle-angle) 0.0) (let ((f30-0 (get-rand-float-range self 0.9 1.1))) (until #f (ja :num! (loop! f30-0)) - (when (>= (- (-> self clock frame-counter) (-> self wiggle-time)) (seconds 1)) - (set! (-> self wiggle-time) (-> self clock frame-counter)) + (when (>= (- (current-time) (-> self wiggle-time)) (seconds 1)) + (set! (-> self wiggle-time) (current-time)) (krew-boss-clone-method-180 self) ) (suspend) @@ -2154,37 +2154,35 @@ For example for an elevator pre-compute the distance between the first and last (defmethod general-event-handler krew-boss ((obj krew-boss) (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" - (with-pp - (case arg2 - (('track) - (cond - ((-> arg3 param 0) - (if (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) - #t - 'abort - ) - ) - (else - (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) - ) - ) - ) - (('notify) - (case (-> arg3 param 0) - (('hit) - (krew-hits-jak-speech obj) - (set! (-> obj next-shooting-frame) 100) - (set! (-> obj spawn-charge) #t) - (let ((v0-0 (the-as object (-> pp clock frame-counter)))) - (set! (-> obj state-time) (the-as time-frame v0-0)) - v0-0 + (case arg2 + (('track) + (cond + ((-> arg3 param 0) + (if (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) + #t + 'abort ) - ) + ) + (else + (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) ) ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (('notify) + (case (-> arg3 param 0) + (('hit) + (krew-hits-jak-speech obj) + (set! (-> obj next-shooting-frame) 100) + (set! (-> obj spawn-charge) #t) + (let ((v0-0 (the-as object (current-time)))) + (set! (-> obj state-time) (the-as time-frame v0-0)) + v0-0 + ) ) + ) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -2516,7 +2514,7 @@ For example for an elevator pre-compute the distance between the first and last 0 (set! (-> self root-override2 trans y) 1449984.0) (set! (-> self num-clones-to-spawn) 20) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (when (< (vector-vector-xz-distance (-> self root-override2 trans) @@ -2565,7 +2563,7 @@ For example for an elevator pre-compute the distance between the first and last ) (when (and (> gp-2 0) (> (-> self num-clones-to-spawn) 0) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.6)) + (>= (- (current-time) (-> self state-time)) (seconds 0.6)) ) (let ((s3-0 (-> self root-override2)) (a1-26 (new 'stack-no-clear 'collide-query)) @@ -2584,7 +2582,7 @@ For example for an elevator pre-compute the distance between the first and last ((not s2-0) (set! (-> s5-1 quad) (-> s3-0 trans quad)) (set! s4-1 #t) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (else (let ((s2-1 0) @@ -2784,26 +2782,24 @@ For example for an elevator pre-compute the distance between the first and last (defmethod damage-amount-from-attack krew-boss ((obj krew-boss) (arg0 process) (arg1 event-message-block)) "@returns the amount of damage taken from an attack. This can come straight off the [[attack-info]] or via [[penetrate-using->damage]]" - (with-pp - (let ((v1-0 (get-penetrate-using-from-attack-event (the-as process-drawable arg0) arg1))) - (cond - ((or (logtest? (penetrate jak-blue-shot) v1-0) (logtest? (penetrate jak-dark-shot) v1-0)) - (cond - ((>= (- (-> pp clock frame-counter) (-> obj last-damage-time)) (seconds 5)) - (set! (-> obj last-damage-time) (-> pp clock frame-counter)) - 5 - ) - (else - 0 - ) - ) - ) - ((logtest? (penetrate dark-bomb) v1-0) - 20 - ) - (else + (let ((v1-0 (get-penetrate-using-from-attack-event (the-as process-drawable arg0) arg1))) + (cond + ((or (logtest? (penetrate jak-blue-shot) v1-0) (logtest? (penetrate jak-dark-shot) v1-0)) + (cond + ((>= (- (current-time) (-> obj last-damage-time)) (seconds 5)) + (set! (-> obj last-damage-time) (current-time)) 5 ) + (else + 0 + ) + ) + ) + ((logtest? (penetrate dark-bomb) v1-0) + 20 + ) + (else + 5 ) ) ) @@ -2943,7 +2939,7 @@ For example for an elevator pre-compute the distance between the first and last (set! (-> self spawn-charge) #t) (set! (-> self enemy-flags) (the-as enemy-flag (logxor (shl 256 32) (the-as int (-> self enemy-flags))))) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag enemy-flag41)))) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) (when (not (handle->process (-> self hud-handle))) (set! (-> self hud-handle) (ppointer->handle (process-spawn hud-krew-boss :init hud-init-by-other :to self))) (krew-comes-in-speech self) @@ -2967,7 +2963,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) (if (or (!= (-> self focus aware) 3) (not (get-enemy-target self))) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) ) (when (= (-> self next-shooting-frame) 200) (cond @@ -3008,7 +3004,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) (else - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ) ) @@ -3075,7 +3071,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) (let ((gp-2 (the int (* 300.0 (- 3.0 (* 0.5 (+ -1.0 (the float (-> self gameplay-pass))))))))) - (when (and (-> self spawn-charge) (>= (- (-> self clock frame-counter) (-> self state-time)) (+ gp-2 -300))) + (when (and (-> self spawn-charge) (>= (- (current-time) (-> self state-time)) (+ gp-2 -300))) (process-spawn part-tracker :init part-tracker-init @@ -3089,7 +3085,7 @@ For example for an elevator pre-compute the distance between the first and last ) (set! (-> self spawn-charge) #f) ) - (when (and (= (-> self next-shooting-frame) 100) (>= (- (-> self clock frame-counter) (-> self state-time)) gp-2)) + (when (and (= (-> self next-shooting-frame) 100) (>= (- (current-time) (-> self state-time)) gp-2)) (set! (-> self next-shooting-frame) 0) (ja :chan 1 :num-func num-func-identity :frame-num 0.0) ) @@ -3105,7 +3101,7 @@ For example for an elevator pre-compute the distance between the first and last ((= (-> self next-shooting-frame) 20) (set! (-> self next-shooting-frame) 100) (set! (-> self spawn-charge) #t) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (else (+! (-> self next-shooting-frame) 5) diff --git a/goal_src/jak2/levels/castle/pad/caspad-obs.gc b/goal_src/jak2/levels/castle/pad/caspad-obs.gc index 69eb4ba077..fc64f70a86 100644 --- a/goal_src/jak2/levels/castle/pad/caspad-obs.gc +++ b/goal_src/jak2/levels/castle/pad/caspad-obs.gc @@ -112,8 +112,8 @@ (none) ) :code (behavior () - (let ((frame-counter (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 1)) + (let ((frame-counter (current-time))) + (until (>= (- (current-time) frame-counter) (seconds 1)) (suspend) ) ) diff --git a/goal_src/jak2/levels/castle/pad/castle-tasks.gc b/goal_src/jak2/levels/castle/pad/castle-tasks.gc index cb4554ce2d..09403ad4b6 100644 --- a/goal_src/jak2/levels/castle/pad/castle-tasks.gc +++ b/goal_src/jak2/levels/castle/pad/castle-tasks.gc @@ -23,8 +23,8 @@ (until #f (when (< (vector-vector-distance (target-pos 0) (-> self info end-sphere)) (-> self info end-sphere r)) (send-event (handle->process (-> self arrow)) 'leave) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 0.007)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 0.007)) (suspend) ) ) diff --git a/goal_src/jak2/levels/city/common/citizen-enemy.gc b/goal_src/jak2/levels/city/common/citizen-enemy.gc index 021af582b4..f265815deb 100644 --- a/goal_src/jak2/levels/city/common/citizen-enemy.gc +++ b/goal_src/jak2/levels/city/common/citizen-enemy.gc @@ -27,26 +27,24 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (with-pp - (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) - (set! (-> a1-0 options) (overlaps-others-options)) - (set! (-> a1-0 collide-with-filter) (-> obj enemy-info-override overlaps-others-collide-with-filter)) - (set! (-> a1-0 tlist) *touching-list*) - (find-overlapping-shapes (-> obj root-override2) a1-0) - ) - (when (and (not (focus-test? obj disable dead ignore inactive)) - (< (-> obj next-update-target) (-> pp clock frame-counter)) - (not (logtest? (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (-> obj next-state) - (= (-> obj next-state name) 'active) - ) - (citizen-enemy-method-202 obj) - (set! (-> obj next-update-target) (+ (-> pp clock frame-counter) (seconds 0.2))) - (traffic-danger-init! obj) - ) - ((method-of-type citizen track-target!) obj) - (none) + (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-0 options) (overlaps-others-options)) + (set! (-> a1-0 collide-with-filter) (-> obj enemy-info-override overlaps-others-collide-with-filter)) + (set! (-> a1-0 tlist) *touching-list*) + (find-overlapping-shapes (-> obj root-override2) a1-0) ) + (when (and (not (focus-test? obj disable dead ignore inactive)) + (< (-> obj next-update-target) (current-time)) + (not (logtest? (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (-> obj next-state) + (= (-> obj next-state name) 'active) + ) + (citizen-enemy-method-202 obj) + (set! (-> obj next-update-target) (+ (current-time) (seconds 0.2))) + (traffic-danger-init! obj) + ) + ((method-of-type citizen track-target!) obj) + (none) ) ;; WARN: Return type mismatch object vs symbol. diff --git a/goal_src/jak2/levels/city/common/citizen.gc b/goal_src/jak2/levels/city/common/citizen.gc index 513de4b71f..5f6c2baaf2 100644 --- a/goal_src/jak2/levels/city/common/citizen.gc +++ b/goal_src/jak2/levels/city/common/citizen.gc @@ -384,89 +384,85 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (with-pp - (when (< (-> obj next-time-look-at) (-> pp clock frame-counter)) - (when (nonzero? (-> obj neck)) - (let ((a0-4 (handle->process (-> obj focus handle)))) - (when a0-4 - (let ((s5-0 (new 'stack-no-clear 'vector))) - (set! (-> s5-0 quad) (-> (get-trans (the-as process-focusable a0-4) 2) quad)) - (if (and (-> obj next-state) (= (-> obj next-state name) 'flee)) - (set! (-> s5-0 quad) (-> obj danger-pos quad)) - ) - (when (< (vector-vector-distance s5-0 (-> obj root-override2 trans)) 122880.0) - (look-at-target! obj (enemy-flag lock-focus)) - (target-set! (-> obj neck) s5-0) - ) - ) - ) - ) - (when (< (-> obj stop-time-look-at) (-> pp clock frame-counter)) - (shut-down (-> obj neck)) - (set! (-> obj next-time-look-at) - (+ (-> pp clock frame-counter) (the int (* 300.0 (get-rand-float-range obj 0.0 20.0)))) - ) - (set! (-> obj stop-time-look-at) - (+ (-> obj next-time-look-at) (the int (* 300.0 (get-rand-float-range obj 5.0 10.0)))) - ) - ) - ) - ) - (let ((a0-18 (-> obj enemy-flags))) - (when (and (logtest? a0-18 (enemy-flag attackable-backup)) - (>= (- (-> pp clock frame-counter) (-> obj auto-reset-penetrate-time)) (seconds 0.1)) - ) - (set! (-> obj enemy-flags) (logclear a0-18 (enemy-flag attackable-backup))) - (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) - (let ((v1-50 0)) - (if (logtest? (penetrate knocked) (-> obj root-override2 penetrate-using)) - (set! v1-50 (logior (shl 1 32) v1-50)) - ) - (set! (-> obj root-override2 penetrate-using) (the-as penetrate v1-50)) - ) - ) - ) - (if (and (nonzero? (-> obj draw)) (logtest? (-> obj draw status) (draw-control-status on-screen))) - (set! (-> obj last-draw-time) (-> pp clock frame-counter)) - ) - (let ((s5-3 (-> obj draw shadow-ctrl))) - (when (!= *nav-enemy-dummy-shadow-control* s5-3) - (let ((f0-7 (vector-vector-distance (camera-pos) (-> obj root-override2 trans)))) - (cond - ((< 163840.0 f0-7) - (logior! (-> s5-3 settings flags) (shadow-flags disable-draw)) - 0 - ) - (else - (let ((v1-65 s5-3)) - (logclear! (-> v1-65 settings flags) (shadow-flags disable-draw)) - ) - 0 - (let* ((f0-8 (lerp-scale 0.0 1.0 f0-7 163840.0 40960.0)) - (f0-11 (fmax 0.01 (+ (* -2.0 f0-8 f0-8 f0-8) (* 3.0 f0-8 f0-8)))) - ) - (set! (-> s5-3 settings shadow-dir w) (* 614400.0 f0-11)) + (when (< (-> obj next-time-look-at) (current-time)) + (when (nonzero? (-> obj neck)) + (let ((a0-4 (handle->process (-> obj focus handle)))) + (when a0-4 + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> (get-trans (the-as process-focusable a0-4) 2) quad)) + (if (and (-> obj next-state) (= (-> obj next-state name) 'flee)) + (set! (-> s5-0 quad) (-> obj danger-pos quad)) ) + (when (< (vector-vector-distance s5-0 (-> obj root-override2 trans)) 122880.0) + (look-at-target! obj (enemy-flag lock-focus)) + (target-set! (-> obj neck) s5-0) ) ) ) ) - ) - (when (logtest? (enemy-flag trackable-backup directed-ready) (-> obj enemy-flags)) - (enemy-method-54 obj) - (when (and (focus-test? obj touch-water) - (< (-> obj root-override2 trans y) (+ -11468.8 (-> obj water-surface-height))) - ) - (set! (-> obj root-override2 trans y) (+ -11468.8 (-> obj water-surface-height))) - (if (not (and (-> obj next-state) (= (-> obj next-state name) 'in-ditch))) - (go (method-of-object obj in-ditch)) - ) + (when (< (-> obj stop-time-look-at) (current-time)) + (shut-down (-> obj neck)) + (set! (-> obj next-time-look-at) (+ (current-time) (the int (* 300.0 (get-rand-float-range obj 0.0 20.0))))) + (set! (-> obj stop-time-look-at) + (+ (-> obj next-time-look-at) (the int (* 300.0 (get-rand-float-range obj 5.0 10.0)))) + ) ) ) - (ja-post) - 0 - (none) ) + (let ((a0-18 (-> obj enemy-flags))) + (when (and (logtest? a0-18 (enemy-flag attackable-backup)) + (>= (- (current-time) (-> obj auto-reset-penetrate-time)) (seconds 0.1)) + ) + (set! (-> obj enemy-flags) (logclear a0-18 (enemy-flag attackable-backup))) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) + (let ((v1-50 0)) + (if (logtest? (penetrate knocked) (-> obj root-override2 penetrate-using)) + (set! v1-50 (logior (shl 1 32) v1-50)) + ) + (set! (-> obj root-override2 penetrate-using) (the-as penetrate v1-50)) + ) + ) + ) + (if (and (nonzero? (-> obj draw)) (logtest? (-> obj draw status) (draw-control-status on-screen))) + (set! (-> obj last-draw-time) (current-time)) + ) + (let ((s5-3 (-> obj draw shadow-ctrl))) + (when (!= *nav-enemy-dummy-shadow-control* s5-3) + (let ((f0-7 (vector-vector-distance (camera-pos) (-> obj root-override2 trans)))) + (cond + ((< 163840.0 f0-7) + (logior! (-> s5-3 settings flags) (shadow-flags disable-draw)) + 0 + ) + (else + (let ((v1-65 s5-3)) + (logclear! (-> v1-65 settings flags) (shadow-flags disable-draw)) + ) + 0 + (let* ((f0-8 (lerp-scale 0.0 1.0 f0-7 163840.0 40960.0)) + (f0-11 (fmax 0.01 (+ (* -2.0 f0-8 f0-8 f0-8) (* 3.0 f0-8 f0-8)))) + ) + (set! (-> s5-3 settings shadow-dir w) (* 614400.0 f0-11)) + ) + ) + ) + ) + ) + ) + (when (logtest? (enemy-flag trackable-backup directed-ready) (-> obj enemy-flags)) + (enemy-method-54 obj) + (when (and (focus-test? obj touch-water) + (< (-> obj root-override2 trans y) (+ -11468.8 (-> obj water-surface-height))) + ) + (set! (-> obj root-override2 trans y) (+ -11468.8 (-> obj water-surface-height))) + (if (not (and (-> obj next-state) (= (-> obj next-state name) 'in-ditch))) + (go (method-of-object obj in-ditch)) + ) + ) + ) + (ja-post) + 0 + (none) ) (defmethod enemy-method-128 citizen ((obj citizen) (arg0 vector) (arg1 move-above-ground-params)) @@ -1305,7 +1301,7 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior citizen) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1399,7 +1395,7 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior citizen) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1416,9 +1412,7 @@ This commonly includes things such as: (none) ) :trans (behavior () - (if (and (-> self wait-return-state) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self wait-time)) - ) + (if (and (-> self wait-return-state) (>= (- (current-time) (-> self state-time)) (-> self wait-time))) (go (-> self wait-return-state)) ) (none) @@ -1464,7 +1458,7 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior citizen) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -1504,13 +1498,13 @@ This commonly includes things such as: (none) ) :trans (behavior () - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (not (logtest? (-> self nav state flags) (nav-state-flag in-mesh))) (< (-> self root-override2 trans y) 4096.0) ) (go-virtual in-ditch) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self wait-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self wait-time)) (let ((f0-2 (-> self nav state speed))) (set! (-> self nav target-speed) (seek f0-2 0.0 (* 12288.0 (-> self clock seconds-per-frame)))) ) @@ -1525,10 +1519,10 @@ This commonly includes things such as: (v1-36 (-> self root-override2 transv)) ) (if (< f0-8 (sqrtf (+ (* (-> v1-36 x) (-> v1-36 x)) (* (-> v1-36 z) (-> v1-36 z))))) - (set! (-> self cp-next-time) (-> self clock frame-counter)) + (set! (-> self cp-next-time) (current-time)) ) ) - (when (< (+ (-> self cp-next-time) (seconds 2)) (-> self clock frame-counter)) + (when (< (+ (-> self cp-next-time) (seconds 2)) (current-time)) (let ((a1-3 (vector-! (new 'stack-no-clear 'vector) (-> self controller path-prev-point) @@ -1536,7 +1530,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self cp-next-time) (-> self clock frame-counter)) + (set! (-> self cp-next-time) (current-time)) (citizen-method-195 self a1-3) ) ) diff --git a/goal_src/jak2/levels/city/common/civilian.gc b/goal_src/jak2/levels/city/common/civilian.gc index 29a134b64f..3a8aaece68 100644 --- a/goal_src/jak2/levels/city/common/civilian.gc +++ b/goal_src/jak2/levels/city/common/civilian.gc @@ -264,121 +264,119 @@ (defmethod general-event-handler civilian ((obj civilian) (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" - (with-pp - (let ((v1-0 arg2)) - (the-as - object - (cond - ((= v1-0 'track) - #f + (let ((v1-0 arg2)) + (the-as + object + (cond + ((= v1-0 'track) + #f + ) + ((= v1-0 'combo) + #f + ) + ((= v1-0 'touched) + ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ((= v1-0 'panic) + (let ((a0-6 (-> arg3 param 0))) + (set! (-> obj danger-pos quad) (-> (the-as sphere (+ a0-6 0)) quad)) ) - ((= v1-0 'combo) - #f - ) - ((= v1-0 'touched) - ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) - ) - ((= v1-0 'panic) - (let ((a0-6 (-> arg3 param 0))) - (set! (-> obj danger-pos quad) (-> (the-as sphere (+ a0-6 0)) quad)) + (if (and (-> obj next-state) (let ((v1-6 (-> obj next-state name))) + (or (= v1-6 'active) (= v1-6 'wait) (= v1-6 'avoid-danger)) + ) + ) + (go (method-of-object obj flee)) ) - (if (and (-> obj next-state) (let ((v1-6 (-> obj next-state name))) - (or (= v1-6 'active) (= v1-6 'wait) (= v1-6 'avoid-danger)) - ) - ) - (go (method-of-object obj flee)) - ) - ) - ((= v1-0 'event-death) - (if (zero? (-> obj hit-points)) - (the-as object (do-effect (-> obj skel effect) 'death-default 0.0 -1)) - ) - ) - ((= v1-0 'avoid) - (set! (-> obj last-danger-time) (-> pp clock frame-counter)) - (let ((a0-15 (-> arg3 param 0))) - (set! (-> obj danger-pos quad) (-> (the-as vector (+ a0-15 0)) quad)) + ) + ((= v1-0 'event-death) + (if (zero? (-> obj hit-points)) + (the-as object (do-effect (-> obj skel effect) 'death-default 0.0 -1)) ) - (if (and (-> obj next-state) (let ((v1-18 (-> obj next-state name))) - (or (= v1-18 'active) (= v1-18 'wait)) - ) - ) - (go (method-of-object obj avoid-danger)) - ) + ) + ((= v1-0 'avoid) + (set! (-> obj last-danger-time) (current-time)) + (let ((a0-15 (-> arg3 param 0))) + (set! (-> obj danger-pos quad) (-> (the-as vector (+ a0-15 0)) quad)) ) - ((= v1-0 'clear-path) - (set! (-> obj last-danger-time) (-> pp clock frame-counter)) - (let ((v1-23 (the-as traffic-danger-info (-> arg3 param 0)))) - (set! (-> obj cp-valid?) #t) - (set! (-> obj cp-sphere quad) (-> v1-23 sphere quad)) - (set! (-> obj cp-vec quad) (-> v1-23 velocity quad)) - (case (-> v1-23 danger-type) - (((traffic-danger-type tdt0)) - (set! (-> obj allow-dive) #f) - (set! (-> obj cp-factor) 20.0) - ) - (((traffic-danger-type tdt1)) - (set! (-> obj allow-dive) #f) - (set! (-> obj cp-factor) 20.0) - ) - (((traffic-danger-type tdt2)) - (set! (-> obj allow-dive) #t) - (set! (-> obj cp-factor) 50.0) - ) - (((traffic-danger-type tdt3)) - (set! (-> obj allow-dive) #t) - (set! (-> obj cp-factor) 50.0) - ) - (((traffic-danger-type tdt4)) - (set! (-> obj allow-dive) #f) - (set! (-> obj cp-factor) 2.0) - ) - (((traffic-danger-type tdt5)) - (set! (-> obj allow-dive) #t) - (set! (-> obj cp-factor) 50.0) - ) - (((traffic-danger-type tdt6)) - (set! (-> obj allow-dive) #t) - (set! (-> obj cp-factor) 50.0) - ) - ) + (if (and (-> obj next-state) (let ((v1-18 (-> obj next-state name))) + (or (= v1-18 'active) (= v1-18 'wait)) + ) + ) + (go (method-of-object obj avoid-danger)) ) - (let ((s5-1 (-> obj cp-plane))) - (set! (-> s5-1 quad) (-> obj cp-vec quad)) - (set! (-> s5-1 y) 0.0) - (vector-rotate90-around-y! s5-1 s5-1) - (vector-normalize! s5-1 1.0) - (set! (-> s5-1 w) (- (vector-dot (the-as vector s5-1) (the-as vector (-> obj cp-sphere))))) - ) - (set! (-> obj cp-exit-time) (+ (-> pp clock frame-counter) (seconds 4))) - (if (and (-> obj next-state) (let ((v1-54 (-> obj next-state name))) - (or (= v1-54 'active) (= v1-54 'wait) (= v1-54 'avoid-danger)) - ) - ) - (go (method-of-object obj clear-path)) - ) - ) - ((or (= v1-0 'hit) (= v1-0 'hit-flinch) (= v1-0 'hit-knocked)) - (speech-control-method-13 *speech-control* (the-as handle obj)) - (if (logtest? (-> obj flags) (citizen-flag female)) - (speech-control-method-12 - *speech-control* - obj - (speech-type speech-type-0 speech-type-1 speech-type-3 speech-type-4) - ) - (speech-control-method-12 *speech-control* obj (speech-type speech-type-0 speech-type-1 speech-type-4)) - ) - ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) - ) - ((= v1-0 'end-task) - (let ((v0-0 (the-as object (logclear (-> obj flags) (citizen-flag persistent))))) - (set! (-> obj flags) (the-as citizen-flag v0-0)) - v0-0 + ) + ((= v1-0 'clear-path) + (set! (-> obj last-danger-time) (current-time)) + (let ((v1-23 (the-as traffic-danger-info (-> arg3 param 0)))) + (set! (-> obj cp-valid?) #t) + (set! (-> obj cp-sphere quad) (-> v1-23 sphere quad)) + (set! (-> obj cp-vec quad) (-> v1-23 velocity quad)) + (case (-> v1-23 danger-type) + (((traffic-danger-type tdt0)) + (set! (-> obj allow-dive) #f) + (set! (-> obj cp-factor) 20.0) + ) + (((traffic-danger-type tdt1)) + (set! (-> obj allow-dive) #f) + (set! (-> obj cp-factor) 20.0) + ) + (((traffic-danger-type tdt2)) + (set! (-> obj allow-dive) #t) + (set! (-> obj cp-factor) 50.0) + ) + (((traffic-danger-type tdt3)) + (set! (-> obj allow-dive) #t) + (set! (-> obj cp-factor) 50.0) + ) + (((traffic-danger-type tdt4)) + (set! (-> obj allow-dive) #f) + (set! (-> obj cp-factor) 2.0) + ) + (((traffic-danger-type tdt5)) + (set! (-> obj allow-dive) #t) + (set! (-> obj cp-factor) 50.0) + ) + (((traffic-danger-type tdt6)) + (set! (-> obj allow-dive) #t) + (set! (-> obj cp-factor) 50.0) + ) ) ) - (else - ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) - ) + (let ((s5-1 (-> obj cp-plane))) + (set! (-> s5-1 quad) (-> obj cp-vec quad)) + (set! (-> s5-1 y) 0.0) + (vector-rotate90-around-y! s5-1 s5-1) + (vector-normalize! s5-1 1.0) + (set! (-> s5-1 w) (- (vector-dot (the-as vector s5-1) (the-as vector (-> obj cp-sphere))))) + ) + (set! (-> obj cp-exit-time) (+ (current-time) (seconds 4))) + (if (and (-> obj next-state) (let ((v1-54 (-> obj next-state name))) + (or (= v1-54 'active) (= v1-54 'wait) (= v1-54 'avoid-danger)) + ) + ) + (go (method-of-object obj clear-path)) + ) + ) + ((or (= v1-0 'hit) (= v1-0 'hit-flinch) (= v1-0 'hit-knocked)) + (speech-control-method-13 *speech-control* (the-as handle obj)) + (if (logtest? (-> obj flags) (citizen-flag female)) + (speech-control-method-12 + *speech-control* + obj + (speech-type speech-type-0 speech-type-1 speech-type-3 speech-type-4) + ) + (speech-control-method-12 *speech-control* obj (speech-type speech-type-0 speech-type-1 speech-type-4)) + ) + ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ((= v1-0 'end-task) + (let ((v0-0 (the-as object (logclear (-> obj flags) (citizen-flag persistent))))) + (set! (-> obj flags) (the-as citizen-flag v0-0)) + v0-0 + ) + ) + (else + ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -483,8 +481,8 @@ ) ) ) - (when (< (-> self cp-next-time) (-> self clock frame-counter)) - (set! (-> self cp-next-time) (+ (-> self clock frame-counter) (get-rand-int-range self 600 1200))) + (when (< (-> self cp-next-time) (current-time)) + (set! (-> self cp-next-time) (+ (current-time) (get-rand-int-range self 600 1200))) (citizen-method-190 self (-> self cp-force)) ) (add-offset-to-target! (-> self nav state) (-> self cp-force)) @@ -516,7 +514,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -566,7 +564,7 @@ (speech-control-method-12 *speech-control* self (speech-type speech-type-4)) ) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (not (logtest? (-> self nav state flags) (nav-state-flag in-mesh))) (< (-> self root-override2 trans y) 4096.0) ) @@ -742,7 +740,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -760,7 +758,7 @@ (set! (-> v1-9 target-speed) (* (-> self speed-scale) (-> self speed-walk))) ) 0 - (set! (-> self next-time) (+ (-> self clock frame-counter) (get-rand-int-range self 300 600))) + (set! (-> self next-time) (+ (current-time) (get-rand-int-range self 300 600))) (set! (-> self last-second-pos quad) (-> self root-override2 trans quad)) (set! (-> self last-distance) (vector-vector-xz-distance (-> self controller turn-exit-point) (-> self root-override2 trans)) @@ -777,7 +775,7 @@ (none) ) :trans (behavior () - (if (< (+ (-> self last-danger-time) (seconds 1)) (-> self clock frame-counter)) + (if (< (+ (-> self last-danger-time) (seconds 1)) (current-time)) (go-virtual active) ) (when (citizen-method-187 self) @@ -890,9 +888,9 @@ (defbehavior civilian-clear-path-post2 civilian () (citizen-method-192 self) - (when (< (-> self cp-next-time) (-> self clock frame-counter)) + (when (< (-> self cp-next-time) (current-time)) (citizen-method-190 self (-> self cp-force)) - (set! (-> self cp-next-time) (+ (-> self clock frame-counter) (get-rand-int-range self 1200 2400))) + (set! (-> self cp-next-time) (+ (current-time) (get-rand-int-range self 1200 2400))) ) (let ((gp-1 (new 'stack-no-clear 'vector))) (citizen-method-188 self gp-1) @@ -926,7 +924,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -944,7 +942,7 @@ (set! (-> v1-9 target-speed) (* (-> self speed-scale) (-> self speed-walk))) ) 0 - (set! (-> self cp-next-time) (+ (-> self clock frame-counter) (get-rand-int-range self 1200 2400))) + (set! (-> self cp-next-time) (+ (current-time) (get-rand-int-range self 1200 2400))) (set! (-> self cp-force quad) (the-as uint128 0)) (if *citizen-debug* (set-vector! (-> self draw color-mult) 0.0 1.0 0.0 1.0) @@ -1007,7 +1005,7 @@ (go-dive self) ) ) - (if (< (-> self cp-exit-time) (-> self clock frame-counter)) + (if (< (-> self cp-exit-time) (current-time)) (go-virtual active) ) (none) @@ -1035,7 +1033,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1068,7 +1066,7 @@ (none) ) :trans (behavior () - (if (< (+ (-> self last-danger-time) (seconds 1)) (-> self clock frame-counter)) + (if (< (+ (-> self last-danger-time) (seconds 1)) (current-time)) (go-virtual get-up-front) ) (none) @@ -1104,7 +1102,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -1212,7 +1210,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1293,7 +1291,7 @@ (suspend) (ja :num! (seek! max (-> self speed-scale))) ) - (if (< (+ (-> self last-danger-time) (seconds 1)) (-> self clock frame-counter)) + (if (< (+ (-> self last-danger-time) (seconds 1)) (current-time)) (goto cfg-9) ) ) @@ -1336,7 +1334,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1399,7 +1397,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1506,7 +1504,7 @@ ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -1553,7 +1551,7 @@ ) :enter (behavior () (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-4 nav callback-info) *nav-enemy-null-callback-info*) @@ -1723,7 +1721,7 @@ ) :enter (behavior () (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-4 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-4 enemy-flags))) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-4 enemy-flags)))) @@ -1845,7 +1843,7 @@ ) :enter (behavior () (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-5 (-> self root-override2 root-prim))) (set! (-> v1-5 prim-core collide-as) (collide-spec)) (set! (-> v1-5 prim-core collide-with) (collide-spec)) @@ -1979,7 +1977,7 @@ (let ((a0-1 (the-as object (-> event param 0)))) (set! (-> self event-param-point quad) (-> (the-as vector a0-1) quad)) ) - (let ((v1-3 (-> self clock frame-counter)) + (let ((v1-3 (current-time)) (a0-3 (-> self state-time)) ) (if (>= (- v1-3 a0-3) (seconds 1)) @@ -2005,7 +2003,7 @@ ) :enter (behavior () (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-5 (-> self root-override2 root-prim))) (set! (-> v1-5 prim-core collide-as) (collide-spec)) (set! (-> v1-5 prim-core collide-with) (collide-spec)) @@ -2086,7 +2084,7 @@ (set! (-> self gnd-height) (-> self root-override2 gspot-pos y)) (logior! (-> self flags) (citizen-flag persistent)) (set! (-> self focus-status) (logior (focus-status pilot-riding pilot) (-> self focus-status))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-28 (-> self root-override2 root-prim))) (set! (-> v1-28 prim-core collide-as) (collide-spec)) (set! (-> v1-28 prim-core collide-with) (collide-spec)) @@ -2217,7 +2215,7 @@ :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () (logclear! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-4 nav callback-info) *nav-enemy-null-callback-info*) diff --git a/goal_src/jak2/levels/city/common/ctyport-obs.gc b/goal_src/jak2/levels/city/common/ctyport-obs.gc index 7999ba08d8..577cf80ec8 100644 --- a/goal_src/jak2/levels/city/common/ctyport-obs.gc +++ b/goal_src/jak2/levels/city/common/ctyport-obs.gc @@ -610,7 +610,7 @@ :event (the-as (function process int symbol event-message-block object :behavior boat-base) vehicle-event-handler) :enter (behavior () (logior! (-> self flags) (rigid-body-object-flag riding)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () diff --git a/goal_src/jak2/levels/city/common/ctywide-obs.gc b/goal_src/jak2/levels/city/common/ctywide-obs.gc index 28d333d587..3381fa50ec 100644 --- a/goal_src/jak2/levels/city/common/ctywide-obs.gc +++ b/goal_src/jak2/levels/city/common/ctywide-obs.gc @@ -40,155 +40,153 @@ ) (defmethod security-wall-method-23 security-wall ((obj security-wall)) - (with-pp - (when (< (-> obj next-message-time) (-> pp clock frame-counter)) - (set! (-> obj next-message-time) - (the-as int (+ (-> pp clock frame-counter) (the int (* 300.0 (rand-vu-float-range 2.0 5.0))))) - ) - (let ((v1-6 (rand-vu-int-count 15))) - (cond - ((zero? v1-6) - (case (-> obj pass) - ((29) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) - ) - ((30) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) - ) - ((31) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) - ) - ((32) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) - ) - ) - ) - ((= v1-6 1) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) - ) - ((= v1-6 2) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) - ) - ((= v1-6 3) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) - ) - ((= v1-6 4) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) - ) - ((= v1-6 5) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) - ) - ((= v1-6 6) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) - ) - ((= v1-6 7) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) - ) - ((= v1-6 8) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) - ) - ((= v1-6 9) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) - ) - ((= v1-6 10) - (let ((v1-45 (rand-vu-int-count 3))) - (cond - ((zero? v1-45) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv035" -99.0 0) - ) - ((= v1-45 1) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv038" -99.0 0) - ) - ((= v1-45 2) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv058" -99.0 0) - ) - ) - ) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) - ) - ((= v1-6 11) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) - (let ((v1-57 (rand-vu-int-count 3))) - (cond - ((zero? v1-57) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv035" -99.0 0) - ) - ((= v1-57 1) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv038" -99.0 0) - ) - ((= v1-57 2) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv058" -99.0 0) - ) - ) - ) - ) - ((= v1-6 12) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) - (case (-> obj pass) - ((29) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) - ) - ((30) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) - ) - ((31) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) - ) - ((32) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) - ) - ) - ) - ((= v1-6 13) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) - (case (-> obj pass) - ((29) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) - ) - ((30) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) - ) - ((31) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) - ) - ((32) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) - ) - ) - ) - ((= v1-6 14) - (case (-> obj pass) - ((29) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) - ) - ((30) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) - ) - ((31) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) - ) - ((32) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) - ) - ) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) - ) + (when (< (-> obj next-message-time) (current-time)) + (set! (-> obj next-message-time) + (the-as int (+ (current-time) (the int (* 300.0 (rand-vu-float-range 2.0 5.0))))) ) - ) - (+! (-> obj message) 1) - (when (>= (-> obj message) 5) - (set! (-> obj message) 0) - 0 + (let ((v1-6 (rand-vu-int-count 15))) + (cond + ((zero? v1-6) + (case (-> obj pass) + ((29) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) + ) + ((30) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) + ) + ((31) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) + ) + ((32) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) + ) + ) + ) + ((= v1-6 1) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) + ) + ((= v1-6 2) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) + ) + ((= v1-6 3) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) + ) + ((= v1-6 4) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) + ) + ((= v1-6 5) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) + ) + ((= v1-6 6) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) + ) + ((= v1-6 7) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) + ) + ((= v1-6 8) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) + ) + ((= v1-6 9) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) + ) + ((= v1-6 10) + (let ((v1-45 (rand-vu-int-count 3))) + (cond + ((zero? v1-45) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv035" -99.0 0) + ) + ((= v1-45 1) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv038" -99.0 0) + ) + ((= v1-45 2) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv058" -99.0 0) + ) + ) + ) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) + ) + ((= v1-6 11) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) + (let ((v1-57 (rand-vu-int-count 3))) + (cond + ((zero? v1-57) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv035" -99.0 0) + ) + ((= v1-57 1) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv038" -99.0 0) + ) + ((= v1-57 2) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv058" -99.0 0) + ) + ) + ) + ) + ((= v1-6 12) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) + (case (-> obj pass) + ((29) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) + ) + ((30) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) + ) + ((31) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) + ) + ((32) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) + ) + ) + ) + ((= v1-6 13) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) + (case (-> obj pass) + ((29) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) + ) + ((30) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) + ) + ((31) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) + ) + ((32) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) + ) + ) + ) + ((= v1-6 14) + (case (-> obj pass) + ((29) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) + ) + ((30) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) + ) + ((31) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) + ) + ((32) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) + ) + ) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) + ) ) ) - 0 - (none) + (+! (-> obj message) 1) + (when (>= (-> obj message) 5) + (set! (-> obj message) 0) + 0 + ) ) + 0 + (none) ) (defmethod security-wall-method-24 security-wall ((obj security-wall)) @@ -1579,8 +1577,8 @@ This commonly includes things such as: ) ) ) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 2)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 2)) (let ((a1-1 (new 'stack-no-clear 'vector))) (set! (-> a1-1 quad) (-> self root-override trans quad)) (set! (-> a1-1 y) (+ 10240.0 (-> a1-1 y))) @@ -1623,8 +1621,8 @@ This commonly includes things such as: (suspend) (ja :num! (seek! 32.0 0.5)) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 3)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 3)) (suspend) ) ) @@ -1779,8 +1777,8 @@ This commonly includes things such as: (suspend) (ja :num! (seek! (ja-aframe 32.0 0))) ) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 5)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 5)) (suspend) ) ) @@ -1977,7 +1975,7 @@ This commonly includes things such as: ) (quaternion-axis-angle! (-> obj jm-turret quat) 0.0 1.0 0.0 (-> obj angle-turret)) (when (= (+ (fabs (- (-> obj angle-turret) (-> s4-1 y))) (fabs (- (-> obj angle-guns) (-> s4-1 x)))) 0.0) - (set! (-> obj next-time-shot) (+ (-> pp clock frame-counter) (seconds 1))) + (set! (-> obj next-time-shot) (+ (current-time) (seconds 1))) (set! (-> obj num-shots) (the-as uint 0)) 0 ) @@ -2010,7 +2008,7 @@ This commonly includes things such as: :virtual #t :event cty-guard-turret-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self num-shots) (the-as uint 0)) 0 (none) @@ -2030,7 +2028,7 @@ This commonly includes things such as: ((zero? (-> self next-time-shot)) (cty-guard-turret-method-35 self) ) - ((>= (-> self clock frame-counter) (-> self next-time-shot)) + ((>= (current-time) (-> self next-time-shot)) (cty-guard-turret-method-34 self) (+! (-> self num-shots) 1) (cond @@ -2039,7 +2037,7 @@ This commonly includes things such as: 0 ) (else - (set! (-> self next-time-shot) (+ (-> self clock frame-counter) (seconds 0.1))) + (set! (-> self next-time-shot) (+ (current-time) (seconds 0.1))) ) ) ) @@ -2411,30 +2409,28 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (with-pp - (set! (-> obj root) (new 'process 'trsqv)) - (set! (-> obj minimap) #f) - (set! (-> obj vehicle) (the-as handle #f)) - (set! (-> obj spawned) #f) - (process-drawable-from-entity! obj arg0) - (logclear! (-> obj mask) (process-mask actor-pause movie)) - (let ((f0-0 (res-lump-float (-> obj entity) 'rotoffset))) - (if (!= f0-0 0.0) - (quaternion-rotate-y! (-> obj root quat) (-> obj root quat) f0-0) - ) - ) - (parking-spot-method-24 obj) - (set! (-> obj test-sphere quad) (-> obj root trans quad)) - (set! (-> obj test-sphere r) 24576.0) - (set! (-> obj state-time) (-> pp clock frame-counter)) - (let ((a1-5 (get-random-parking-spot-type *traffic-engine*))) - (if (!= a1-5 (traffic-type traffic-type-21)) - (parking-spot-method-23 obj (the-as uint a1-5)) - ) - ) - (go (method-of-object obj idle)) - (none) + (set! (-> obj root) (new 'process 'trsqv)) + (set! (-> obj minimap) #f) + (set! (-> obj vehicle) (the-as handle #f)) + (set! (-> obj spawned) #f) + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause movie)) + (let ((f0-0 (res-lump-float (-> obj entity) 'rotoffset))) + (if (!= f0-0 0.0) + (quaternion-rotate-y! (-> obj root quat) (-> obj root quat) f0-0) + ) ) + (parking-spot-method-24 obj) + (set! (-> obj test-sphere quad) (-> obj root trans quad)) + (set! (-> obj test-sphere r) 24576.0) + (set! (-> obj state-time) (current-time)) + (let ((a1-5 (get-random-parking-spot-type *traffic-engine*))) + (if (!= a1-5 (traffic-type traffic-type-21)) + (parking-spot-method-23 obj (the-as uint a1-5)) + ) + ) + (go (method-of-object obj idle)) + (none) ) (defstate idle (parking-spot) @@ -2446,8 +2442,8 @@ This commonly includes things such as: ) :code (the-as (function none :behavior parking-spot) sleep-code) :post (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.25)) - (set! (-> self state-time) (-> self clock frame-counter)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.25)) + (set! (-> self state-time) (current-time)) (parking-spot-method-21 self) (when (not (-> self spawned)) (let ((f0-0 (vector-vector-distance-squared (camera-pos) (-> self test-sphere))) @@ -3278,7 +3274,7 @@ This commonly includes things such as: (add-setting! 'music-volume 'rel (-> *setting-control* user-current music-volume-movie) 0) (add-setting! 'sfx-volume 'rel (-> *setting-control* user-current sfx-movie-volume) 0) (add-setting! 'dialog-volume 'rel (-> *setting-control* user-current dialog-volume-hint) 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let* ((v1-21 (get-current-task-event (-> self task))) (gp-0 (add-process *gui-control* @@ -3292,7 +3288,7 @@ This commonly includes things such as: ) ) (while (nonzero? (get-status *gui-control* gp-0)) - (set! (-> self time) (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (set! (-> self time) (* 0.0033333334 (the float (- (current-time) (-> self state-time))))) (suspend) (when (cpad-pressed? 0 triangle) (set-action! @@ -3358,7 +3354,7 @@ This commonly includes things such as: :enter (behavior () (set-setting! 'minimap 'clear 0.0 (minimap-flag minimap)) (set! (-> self time) -1.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -3402,7 +3398,7 @@ This commonly includes things such as: (vf7 :class vf) ) (init-vf0-vector) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.5)) + (when (>= (- (current-time) (-> self state-time)) (seconds 1.5)) (let ((gp-0 0) (s5-0 0) ) diff --git a/goal_src/jak2/levels/city/common/ctywide-tasks.gc b/goal_src/jak2/levels/city/common/ctywide-tasks.gc index 6a9075e578..0328a843b8 100644 --- a/goal_src/jak2/levels/city/common/ctywide-tasks.gc +++ b/goal_src/jak2/levels/city/common/ctywide-tasks.gc @@ -46,8 +46,8 @@ TASK_MANAGER_COMPLETE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (none) @@ -93,8 +93,8 @@ (lambda :behavior task-manager () (send-event (handle->process (-> self arrow)) 'leave) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (none) @@ -181,8 +181,8 @@ (the-as sound-id (talker-spawn-func (-> *talker-speech* 38) *entity-pool* (target-pos 0) (the-as region #f))) ) (wait-for-speech-end (-> self sound-id 0)) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -234,8 +234,8 @@ (the-as sound-id (talker-spawn-func (-> *talker-speech* 31) *entity-pool* (target-pos 0) (the-as region #f))) ) (wait-for-speech-end (-> self sound-id 0)) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -246,8 +246,8 @@ (the-as sound-id (talker-spawn-func (-> *talker-speech* 35) *entity-pool* (target-pos 0) (the-as region #f))) ) (wait-for-speech-end (-> self sound-id 0)) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 1)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 1)) (suspend) ) ) @@ -271,8 +271,8 @@ ) (wait-for-speech-end (-> self sound-id 0)) (set! (-> self sub-state) (the-as uint 2)) - (let ((gp-6 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-6) (seconds 1)) + (let ((gp-6 (current-time))) + (until (>= (- (current-time) gp-6) (seconds 1)) (suspend) ) ) @@ -320,7 +320,7 @@ ) ) (else - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ) ) @@ -340,7 +340,7 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 60)) + (until (>= (- (current-time) (-> self state-time)) (seconds 60)) (suspend) ) (set! (-> self sub-state) (the-as uint 1)) @@ -348,8 +348,8 @@ (the-as sound-id (talker-spawn-func (-> *talker-speech* 35) *entity-pool* (target-pos 0) (the-as region #f))) ) (wait-for-speech-end (-> self sound-id 0)) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -366,8 +366,8 @@ (the-as sound-id (talker-spawn-func (-> *talker-speech* 37) *entity-pool* (target-pos 0) (the-as region #f))) ) (wait-for-speech-end (-> self sound-id 0)) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 3)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 3)) (suspend) ) ) @@ -460,7 +460,7 @@ ) ) (set-setting! 'airlock #f 0.0 0) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (none) ) ) @@ -475,8 +475,8 @@ (send-event *traffic-manager* 'set-alert-duration 9000) (send-event *target* 'end-mode) (set-setting! 'pilot #f 0.0 0) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (script-eval '(send-event "keira-npc-1" 'say)) @@ -764,7 +764,7 @@ (set! (-> self arrow) (process->handle a0-20)) ) ) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (set! (-> self time-limit) (the-as time-frame (the int (-> gp-0 time)))) ) (none) @@ -816,8 +816,8 @@ () (send-event *target* 'end-mode) (set-setting! 'pilot #f 0.0 0) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (close! (-> self node-info) 'event) diff --git a/goal_src/jak2/levels/city/common/guard.gc b/goal_src/jak2/levels/city/common/guard.gc index 83b5535426..56605c0b4a 100644 --- a/goal_src/jak2/levels/city/common/guard.gc +++ b/goal_src/jak2/levels/city/common/guard.gc @@ -517,193 +517,191 @@ (defmethod general-event-handler crimson-guard ((obj crimson-guard) (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" - (with-pp - (let ((v1-0 arg2)) - (the-as - object - (cond - ((or (= v1-0 'hit) (= v1-0 'hit-flinch) (= v1-0 'hit-knocked)) - (speech-control-method-13 *speech-control* (the-as handle obj)) - (logior! (-> obj flags) (citizen-flag hostile)) - (let* ((s0-0 (handle->process (-> obj incoming attacker-handle))) - (s1-0 (if (type? s0-0 process-focusable) - s0-0 - ) - ) - ) - (when s1-0 - (speech-control-method-12 *speech-control* obj (speech-type speech-type-0 speech-type-1 speech-type-3)) - (trigger-alert obj 1 (the-as target s1-0)) - ) - ) - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - ((= v1-0 'event-death) - (if (zero? (-> obj hit-points)) - (the-as object (do-effect (-> obj skel effect) 'death-default 0.0 -1)) - ) - ) - ((= v1-0 'bouncing-off) - (when (or (and (-> obj next-state) (= (-> obj next-state name) 'active)) - (and (-> obj next-state) (= (-> obj next-state name) 'wait)) - ) - (speech-control-method-12 *speech-control* obj (speech-type speech-type-1 speech-type-2 speech-type-3)) - (go (method-of-object obj close-attack-active)) - ) - ) - ((= v1-0 'combo) - (and (not (and (-> obj next-state) (= (-> obj next-state name) 'inactive))) - (and (not (logtest? (enemy-flag multi-focus) (-> obj enemy-flags))) (nonzero? (-> obj hit-points))) - ) - ) - ((= v1-0 'avoid) - #f - ) - ((= v1-0 'panic) - (set! (-> obj last-danger-time) (-> pp clock frame-counter)) - (let ((v1-38 (the-as traffic-danger-info (-> arg3 param 0)))) - (case (-> v1-38 danger-type) - (((traffic-danger-type tdt7)) - (set! (-> obj cp-factor) 20.0) - (let ((s5-1 (method-of-object obj trigger-alert)) - (s4-1 1) - (s3-1 (handle->process (-> v1-38 handle))) - ) - (the-as object (s5-1 obj s4-1 (the-as target (if (type? s3-1 process-focusable) - s3-1 - ) - ) - ) + (let ((v1-0 arg2)) + (the-as + object + (cond + ((or (= v1-0 'hit) (= v1-0 'hit-flinch) (= v1-0 'hit-knocked)) + (speech-control-method-13 *speech-control* (the-as handle obj)) + (logior! (-> obj flags) (citizen-flag hostile)) + (let* ((s0-0 (handle->process (-> obj incoming attacker-handle))) + (s1-0 (if (type? s0-0 process-focusable) + s0-0 ) - ) + ) ) - ) + (when s1-0 + (speech-control-method-12 *speech-control* obj (speech-type speech-type-0 speech-type-1 speech-type-3)) + (trigger-alert obj 1 (the-as target s1-0)) ) ) - ((= v1-0 'clear-path) - (set! (-> obj last-danger-time) (-> pp clock frame-counter)) - (let ((v1-44 (the-as traffic-danger-info (-> arg3 param 0)))) - (set! (-> obj cp-valid?) #t) - (set! (-> obj cp-sphere quad) (-> v1-44 sphere quad)) - (set! (-> obj cp-vec quad) (-> v1-44 velocity quad)) - (case (-> v1-44 danger-type) - (((traffic-danger-type tdt0)) - (trigger-alert obj 1 *target*) - ) - (((traffic-danger-type tdt1)) - ) - (((traffic-danger-type tdt2)) - ) - (((traffic-danger-type tdt3)) - ) - (((traffic-danger-type tdt4)) - ) - (((traffic-danger-type tdt5)) - ) - (((traffic-danger-type tdt6)) - ) - (((traffic-danger-type tdt7)) - (trigger-alert obj 1 *target*) - ) - ) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ((= v1-0 'event-death) + (if (zero? (-> obj hit-points)) + (the-as object (do-effect (-> obj skel effect) 'death-default 0.0 -1)) ) - (let ((s5-2 (-> obj cp-plane))) - (set! (-> s5-2 quad) (-> obj cp-vec quad)) - (set! (-> s5-2 y) 0.0) - (vector-rotate90-around-y! s5-2 s5-2) - (vector-normalize! s5-2 1.0) - (set! (-> s5-2 w) (- (vector-dot (the-as vector s5-2) (the-as vector (-> obj cp-sphere))))) - ) - (let ((v0-4 (the-as object (+ (-> pp clock frame-counter) (seconds 1))))) - (set! (-> obj cp-exit-time) (the-as time-frame v0-4)) - v0-4 - ) - ) - ((= v1-0 'end-pursuit) - (when *debug-segment* - (when (focus-test? obj inactive) - (format 0 "guard::event end-pursuit recieved by inactive process ~d~%" (-> obj pid)) - (break!) - 0 - ) - ) - (when (not (focus-test? obj dead)) - (when (logtest? (-> obj flags) (citizen-flag hostile)) - (logclear! (-> obj flags) (citizen-flag persistent in-pursuit hostile)) - (citizen-method-195 obj (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> obj root-override2 quat))) - (go (method-of-object obj active)) - ) - ) - ) - ((= v1-0 'alert-begin) - (when *debug-segment* - (when (focus-test? obj inactive) - (format 0 "guard::event alert-begin recieved by inactive process ~d~%" (-> obj pid)) - (break!) - 0 - ) - ) - (when (not (focus-test? obj dead)) - (when (not (logtest? (-> obj flags) (citizen-flag hostile))) - (let ((a1-27 (the-as object (-> arg3 param 0)))) - (when (and (the-as uint a1-27) - (not (logtest? (-> (the-as process-focusable a1-27) focus-status) (focus-status disable dead inactive))) - ) - (set! (-> obj traffic-target-status handle) (process->handle (the-as process-focusable a1-27))) - (try-update-focus (-> obj focus) (the-as process-focusable a1-27) obj) - (if (and (not (and (-> obj next-state) (= (-> obj next-state name) 'jump))) - (not (and (-> obj next-state) (= (-> obj next-state name) 'exit-transport))) - ) - (the-as object (go-hostile obj)) - ) + ) + ((= v1-0 'bouncing-off) + (when (or (and (-> obj next-state) (= (-> obj next-state name) 'active)) + (and (-> obj next-state) (= (-> obj next-state name) 'wait)) ) - ) - ) - ) + (speech-control-method-12 *speech-control* obj (speech-type speech-type-1 speech-type-2 speech-type-3)) + (go (method-of-object obj close-attack-active)) ) - ((= v1-0 'alert-end) - (when *debug-segment* - (when (focus-test? obj inactive) - (format 0 "guard::event alert-end recieved by inactive process ~d~%" (-> obj pid)) - (break!) - 0 - ) - ) - (when (not (focus-test? obj dead)) - (when (logtest? (-> obj flags) (citizen-flag hostile)) - (logclear! (-> obj flags) (citizen-flag persistent in-pursuit hostile)) - (speech-control-method-12 *speech-control* obj (speech-type speech-type-0 speech-type-2)) - (citizen-method-195 obj (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> obj root-override2 quat))) - (go (method-of-object obj active)) - ) - ) - ) - ((= v1-0 'track) - (if (and (-> obj next-state) (let ((v1-129 (-> obj next-state name))) - (or (= v1-129 'exit-transport) (= v1-129 'jump)) - ) + ) + ((= v1-0 'combo) + (and (not (and (-> obj next-state) (= (-> obj next-state name) 'inactive))) + (and (not (logtest? (enemy-flag multi-focus) (-> obj enemy-flags))) (nonzero? (-> obj hit-points))) + ) + ) + ((= v1-0 'avoid) + #f + ) + ((= v1-0 'panic) + (set! (-> obj last-danger-time) (current-time)) + (let ((v1-38 (the-as traffic-danger-info (-> arg3 param 0)))) + (case (-> v1-38 danger-type) + (((traffic-danger-type tdt7)) + (set! (-> obj cp-factor) 20.0) + (let ((s5-1 (method-of-object obj trigger-alert)) + (s4-1 1) + (s3-1 (handle->process (-> v1-38 handle))) ) - #f - #t - ) + (the-as object (s5-1 obj s4-1 (the-as target (if (type? s3-1 process-focusable) + s3-1 + ) + ) + ) + ) + ) + ) + ) ) - ((= v1-0 'notify) - (let ((a0-84 (-> arg3 param 0)) - (v1-130 (the-as object (-> arg3 param 1))) - ) - (when (= a0-84 'attack) - (when (logtest? (-> (the-as process-focusable v1-130) mask) (process-mask target)) - (when (focus-test? (the-as process-focusable v1-130) dead) - (format #t "guard killed player~%") - (the-as object (speech-control-method-12 *speech-control* obj (speech-type speech-type-1 speech-type-3))) - ) + ) + ((= v1-0 'clear-path) + (set! (-> obj last-danger-time) (current-time)) + (let ((v1-44 (the-as traffic-danger-info (-> arg3 param 0)))) + (set! (-> obj cp-valid?) #t) + (set! (-> obj cp-sphere quad) (-> v1-44 sphere quad)) + (set! (-> obj cp-vec quad) (-> v1-44 velocity quad)) + (case (-> v1-44 danger-type) + (((traffic-danger-type tdt0)) + (trigger-alert obj 1 *target*) + ) + (((traffic-danger-type tdt1)) + ) + (((traffic-danger-type tdt2)) + ) + (((traffic-danger-type tdt3)) + ) + (((traffic-danger-type tdt4)) + ) + (((traffic-danger-type tdt5)) + ) + (((traffic-danger-type tdt6)) + ) + (((traffic-danger-type tdt7)) + (trigger-alert obj 1 *target*) + ) + ) + ) + (let ((s5-2 (-> obj cp-plane))) + (set! (-> s5-2 quad) (-> obj cp-vec quad)) + (set! (-> s5-2 y) 0.0) + (vector-rotate90-around-y! s5-2 s5-2) + (vector-normalize! s5-2 1.0) + (set! (-> s5-2 w) (- (vector-dot (the-as vector s5-2) (the-as vector (-> obj cp-sphere))))) + ) + (let ((v0-4 (the-as object (+ (current-time) (seconds 1))))) + (set! (-> obj cp-exit-time) (the-as time-frame v0-4)) + v0-4 + ) + ) + ((= v1-0 'end-pursuit) + (when *debug-segment* + (when (focus-test? obj inactive) + (format 0 "guard::event end-pursuit recieved by inactive process ~d~%" (-> obj pid)) + (break!) + 0 + ) + ) + (when (not (focus-test? obj dead)) + (when (logtest? (-> obj flags) (citizen-flag hostile)) + (logclear! (-> obj flags) (citizen-flag persistent in-pursuit hostile)) + (citizen-method-195 obj (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> obj root-override2 quat))) + (go (method-of-object obj active)) + ) + ) + ) + ((= v1-0 'alert-begin) + (when *debug-segment* + (when (focus-test? obj inactive) + (format 0 "guard::event alert-begin recieved by inactive process ~d~%" (-> obj pid)) + (break!) + 0 + ) + ) + (when (not (focus-test? obj dead)) + (when (not (logtest? (-> obj flags) (citizen-flag hostile))) + (let ((a1-27 (the-as object (-> arg3 param 0)))) + (when (and (the-as uint a1-27) + (not (logtest? (-> (the-as process-focusable a1-27) focus-status) (focus-status disable dead inactive))) + ) + (set! (-> obj traffic-target-status handle) (process->handle (the-as process-focusable a1-27))) + (try-update-focus (-> obj focus) (the-as process-focusable a1-27) obj) + (if (and (not (and (-> obj next-state) (= (-> obj next-state name) 'jump))) + (not (and (-> obj next-state) (= (-> obj next-state name) 'exit-transport))) + ) + (the-as object (go-hostile obj)) + ) ) ) ) ) - (else - ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) - ) + ) + ((= v1-0 'alert-end) + (when *debug-segment* + (when (focus-test? obj inactive) + (format 0 "guard::event alert-end recieved by inactive process ~d~%" (-> obj pid)) + (break!) + 0 + ) + ) + (when (not (focus-test? obj dead)) + (when (logtest? (-> obj flags) (citizen-flag hostile)) + (logclear! (-> obj flags) (citizen-flag persistent in-pursuit hostile)) + (speech-control-method-12 *speech-control* obj (speech-type speech-type-0 speech-type-2)) + (citizen-method-195 obj (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> obj root-override2 quat))) + (go (method-of-object obj active)) + ) + ) + ) + ((= v1-0 'track) + (if (and (-> obj next-state) (let ((v1-129 (-> obj next-state name))) + (or (= v1-129 'exit-transport) (= v1-129 'jump)) + ) + ) + #f + #t + ) + ) + ((= v1-0 'notify) + (let ((a0-84 (-> arg3 param 0)) + (v1-130 (the-as object (-> arg3 param 1))) + ) + (when (= a0-84 'attack) + (when (logtest? (-> (the-as process-focusable v1-130) mask) (process-mask target)) + (when (focus-test? (the-as process-focusable v1-130) dead) + (format #t "guard killed player~%") + (the-as object (speech-control-method-12 *speech-control* obj (speech-type speech-type-1 speech-type-3))) + ) + ) + ) + ) + ) + (else + ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -718,7 +716,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior crimson-guard) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -791,7 +789,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior crimson-guard) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1696,7 +1694,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior crimson-guard) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -1848,7 +1846,7 @@ (t9-1) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-11 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-11 enemy-flags))) (set! (-> v1-11 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-11 enemy-flags)))) @@ -1944,9 +1942,7 @@ (when (and (< (-> self target-self-xz-dist) 163840.0) (or (< 40960.0 (-> self target-self-xz-dist)) (>= 2 (the-as int (-> self focus aware)))) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) - (the int (* 300.0 (get-rand-float-range self 1.0 3.0))) - ) + (if (and (>= (- (current-time) (-> self state-time)) (the int (* 300.0 (get-rand-float-range self 1.0 3.0)))) (logtest? (-> self flags) (citizen-flag target-in-sight)) ) (go-virtual gun-shoot) @@ -2147,8 +2143,8 @@ (set! (-> a0-9 velocity quad) (-> v1-15 quad)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-time-see-target) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self last-time-see-target) (current-time)) (crimson-guard-method-220 self) (set! (-> self miss-amount) (lerp-scale 0.0 16384.0 (-> self target-self-dist) 40960.0 122880.0)) (set! (-> self miss-amount) 16384.0) @@ -2157,7 +2153,7 @@ (set! (-> self miss-amount) 0.0) ) ) - (set! (-> self next-shot) (the-as int (-> self clock frame-counter))) + (set! (-> self next-shot) (the-as int (current-time))) (set! (-> self joint-enable) #t) (none) ) @@ -2185,7 +2181,7 @@ ) (go-virtual close-attack) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (or (not (logtest? (-> self flags) (citizen-flag target-in-sight))) (< 184320.0 (-> self target-self-xz-dist)) (< 10922.667 (fabs (-> self target-y-angle))) @@ -2224,7 +2220,7 @@ (set! v1-35 #t) (goto cfg-10) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 1)) (set! v1-35 #f) (goto cfg-10) ) @@ -2232,7 +2228,7 @@ (b! (not #f) cfg-3 :delay (set! v1-35 #f)) (label cfg-10) (when v1-35 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 3)) (until #f (ja-channel-push! 1 (seconds 0.1)) @@ -2605,10 +2601,10 @@ (set! (-> a0-9 velocity quad) (-> v1-12 quad)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-time-see-target) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self last-time-see-target) (current-time)) (set! (-> self miss-amount) 0.0) - (set! (-> self next-shot) (the-as int (-> self clock frame-counter))) + (set! (-> self next-shot) (the-as int (current-time))) (set! (-> self joint-enable) #t) (crimson-guard-method-221 self) (none) @@ -2705,9 +2701,9 @@ (set! (-> a0-9 velocity quad) (-> v1-12 quad)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self miss-amount) 0.0) - (set! (-> self next-shot) (the-as int (-> self clock frame-counter))) + (set! (-> self next-shot) (the-as int (current-time))) (set! (-> self joint-enable) #t) (crimson-guard-method-221 self) (none) @@ -3178,7 +3174,7 @@ ) 0 (set! (-> self miss-amount) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self lazer-sound) (the-as uint 0)) 0 (none) @@ -3219,7 +3215,7 @@ ) :trans (behavior () (crimson-guard-method-220 self) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (or (< 32768.0 (-> self target-self-xz-dist)) (not (logtest? (-> self flags) (citizen-flag target-in-sight)))) ) (go-hostile self) @@ -3246,7 +3242,7 @@ ) (let ((gp-2 #t)) (until #f - (while (or (< 7281.778 (fabs (-> self target-y-angle))) (>= (-> self next-shot) (-> self clock frame-counter))) + (while (or (< 7281.778 (fabs (-> self target-y-angle))) (>= (-> self next-shot) (current-time))) (when gp-2 ) (speech-control-method-12 *speech-control* self (speech-type speech-type-0 speech-type-3)) @@ -3305,7 +3301,7 @@ (suspend) (ja :num! (loop!)) (set! v1-94 - (or (< (-> self clock frame-counter) (-> self next-shot)) + (or (< (current-time) (-> self next-shot)) (< (-> self target-self-xz-dist) 16384.0) (not (and (handle->process (-> self focus handle)) (not (logtest? (-> (the-as process-focusable (handle->process (-> self focus handle))) focus-status) @@ -3347,7 +3343,7 @@ (ja :num! (seek!)) ) (crimson-guard-method-221 self) - (set! (-> self next-shot) (the-as int (+ (-> self clock frame-counter) (seconds 0.1)))) + (set! (-> self next-shot) (the-as int (+ (current-time) (seconds 0.1)))) (let ((v1-155 (-> (the-as collide-shape-prim-group (-> self root-override2 root-prim)) child 2))) (logior! (-> v1-155 prim-core action) (collide-action deadly)) ) @@ -3376,12 +3372,12 @@ ) (set! (-> v1-158 state mode) (the-as lightning-mode a0-56)) ) - (let ((s5-1 (-> self clock frame-counter)) + (let ((s5-1 (current-time)) (s4-1 150) (f30-1 1.0) ) (ja-no-eval :group! (-> self draw art-group data 22) :num! (loop! f30-1) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) s5-1) s4-1) + (until (>= (- (current-time) s5-1) s4-1) (crimson-guard-method-222 self) (suspend) (ja :num! (loop! f30-1)) @@ -3420,7 +3416,7 @@ ) ) (else - (set! (-> self next-shot) (the-as int (+ (-> self clock frame-counter) (seconds 1)))) + (set! (-> self next-shot) (the-as int (+ (current-time) (seconds 1)))) (suspend) 0 ) @@ -3707,7 +3703,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior crimson-guard) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self nav flags) (nav-control-flag output-sphere-hash)) (logclear! (-> self flags) (citizen-flag hostile)) (nav-enemy-method-166 self) @@ -3785,18 +3781,15 @@ (while (not (-> self already-shot)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (ja-channel-set! 1) - (let ((gp-0 (-> self clock frame-counter)) + (let ((gp-0 (current-time)) (s5-0 150) (f30-0 2.0) ) (ja-no-eval :group! (-> self draw art-group data 6) :num! (loop! f30-0) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-0) s5-0) - (crimson-guard-method-223 - self - (* 0.006666667 (the float (- (-> self clock frame-counter) (-> self state-time)))) - ) + (until (>= (- (current-time) gp-0) s5-0) + (crimson-guard-method-223 self (* 0.006666667 (the float (- (current-time) (-> self state-time))))) (suspend) (ja :num! (loop! f30-0)) ) diff --git a/goal_src/jak2/levels/city/common/metalhead-flitter.gc b/goal_src/jak2/levels/city/common/metalhead-flitter.gc index e35c8684e4..ae4709d9bd 100644 --- a/goal_src/jak2/levels/city/common/metalhead-flitter.gc +++ b/goal_src/jak2/levels/city/common/metalhead-flitter.gc @@ -387,15 +387,15 @@ ) ) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 0.6)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 0.6)) (suspend) ) ) (set! (-> self root-override2 trans y) (+ -8192.0 (-> self root-override2 trans y))) (logior! (-> self draw status) (draw-control-status no-draw)) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) (suspend) ) ) @@ -425,7 +425,7 @@ ) 0 (look-at-target! self (enemy-flag lock-focus)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (-> self root-override2))) (vector-reset! (-> gp-0 transv)) (set! (-> gp-0 transv y) (* 4096.0 (get-rand-float-range self 34.0 38.0))) @@ -536,87 +536,83 @@ ) (defmethod metalhead-flitter-method-205 metalhead-flitter ((obj metalhead-flitter)) - (with-pp - (let* ((s5-0 (handle->process (-> obj focus handle))) - (s3-0 (if (type? s5-0 process-focusable) - s5-0 - ) - ) + (let* ((s5-0 (handle->process (-> obj focus handle))) + (s3-0 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when s3-0 + (let* ((s5-1 (get-trans (the-as process-focusable s3-0) 0)) + (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-1 (-> obj root-override2 trans))) + (f30-0 (vector-length s4-1)) + ) + (cond + ((enemy-method-99 obj (the-as process-focusable s3-0)) + (go-flee obj) ) - (when s3-0 - (let* ((s5-1 (get-trans (the-as process-focusable s3-0) 0)) - (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-1 (-> obj root-override2 trans))) - (f30-0 (vector-length s4-1)) - ) - (cond - ((enemy-method-99 obj (the-as process-focusable s3-0)) - (go-flee obj) - ) - ((and (< f30-0 32768.0) (not (metalhead-flitter-method-207 obj (the-as process-focusable s3-0)))) - (go (method-of-object obj circling)) - ) - ((< f30-0 (-> obj enemy-info-override notice-nav-radius)) - (set! (-> obj target-pos quad) (-> s5-1 quad)) - (let ((s3-1 (new 'stack-no-clear 'vector))) - (set! (-> s3-1 quad) (-> s4-1 quad)) - (let ((s5-2 (new 'stack-no-clear 'vector))) - (set! (-> s5-2 quad) (-> obj root-override2 transv quad)) - (vector-normalize! s5-2 f30-0) - (if (>= (vector-dot s3-1 s5-2) 0.98) - (go (method-of-object obj attack)) - ) - ) - ) - ) - ((< f30-0 32768.0) - (set! (-> obj target-pos quad) (-> s5-1 quad)) - ) - ((or (>= (- (-> pp clock frame-counter) (the-as int (-> obj last-change-dir))) (-> obj change-dir-time)) - (< (vector-vector-distance-squared (-> obj root-override2 trans) (-> obj target-pos)) 0.1) - ) - (set! (-> obj last-change-dir) (the-as uint (-> pp clock frame-counter))) - (set! (-> obj change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) - (let ((s3-2 (new 'stack-no-clear 'vector)) - (f0-9 (* 0.5 f30-0 (tan (-> obj move-angle)))) - (s2-0 (new 'stack-no-clear 'vector)) + ((and (< f30-0 32768.0) (not (metalhead-flitter-method-207 obj (the-as process-focusable s3-0)))) + (go (method-of-object obj circling)) + ) + ((< f30-0 (-> obj enemy-info-override notice-nav-radius)) + (set! (-> obj target-pos quad) (-> s5-1 quad)) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (set! (-> s3-1 quad) (-> s4-1 quad)) + (let ((s5-2 (new 'stack-no-clear 'vector))) + (set! (-> s5-2 quad) (-> obj root-override2 transv quad)) + (vector-normalize! s5-2 f30-0) + (if (>= (vector-dot s3-1 s5-2) 0.98) + (go (method-of-object obj attack)) ) - (if (-> obj heading) - (set-vector! s3-2 (-> s4-1 z) (-> s4-1 y) (- (-> s4-1 x)) 1.0) - (set-vector! s3-2 (- (-> s4-1 z)) (-> s4-1 y) (-> s4-1 x) 1.0) - ) - (set! (-> obj heading) (not (-> obj heading))) - (let ((f28-1 (rand-vu-float-range (* 0.75 f0-9) f0-9)) - (s4-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s4-1 (* -0.6 f30-0))) - ) - (vector-normalize! s3-2 f28-1) - (vector+! s3-2 s3-2 s4-2) - ) - (clamp-vector-to-mesh-cross-gaps (-> obj nav state) s3-2) - (vector+! s2-0 s5-1 s3-2) - (set! (-> obj target-pos quad) (-> s2-0 quad)) ) ) - ) + ) + ((< f30-0 32768.0) + (set! (-> obj target-pos quad) (-> s5-1 quad)) + ) + ((or (>= (- (current-time) (the-as int (-> obj last-change-dir))) (-> obj change-dir-time)) + (< (vector-vector-distance-squared (-> obj root-override2 trans) (-> obj target-pos)) 0.1) + ) + (set! (-> obj last-change-dir) (the-as uint (current-time))) + (set! (-> obj change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) + (let ((s3-2 (new 'stack-no-clear 'vector)) + (f0-9 (* 0.5 f30-0 (tan (-> obj move-angle)))) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (if (-> obj heading) + (set-vector! s3-2 (-> s4-1 z) (-> s4-1 y) (- (-> s4-1 x)) 1.0) + (set-vector! s3-2 (- (-> s4-1 z)) (-> s4-1 y) (-> s4-1 x) 1.0) + ) + (set! (-> obj heading) (not (-> obj heading))) + (let ((f28-1 (rand-vu-float-range (* 0.75 f0-9) f0-9)) + (s4-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s4-1 (* -0.6 f30-0))) + ) + (vector-normalize! s3-2 f28-1) + (vector+! s3-2 s3-2 s4-2) + ) + (clamp-vector-to-mesh-cross-gaps (-> obj nav state) s3-2) + (vector+! s2-0 s5-1 s3-2) + (set! (-> obj target-pos quad) (-> s2-0 quad)) + ) + ) ) - 0 ) + 0 ) - 0 - (none) ) + 0 + (none) ) ;; WARN: Return type mismatch time-frame vs none. (defmethod metalhead-flitter-method-206 metalhead-flitter ((obj metalhead-flitter)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (the-as int (-> obj amb-sound-timer))) - (the int (* 300.0 (rand-vu-float-range 1.5 3.0))) - ) - (sound-play "flitter-amb" :position (-> obj root-override2 trans)) - (set! (-> obj amb-sound-timer) (the-as uint (-> pp clock frame-counter))) - ) - (none) + (when (>= (- (current-time) (the-as int (-> obj amb-sound-timer))) + (the int (* 300.0 (rand-vu-float-range 1.5 3.0))) + ) + (sound-play "flitter-amb" :position (-> obj root-override2 trans)) + (set! (-> obj amb-sound-timer) (the-as uint (current-time))) ) + (none) ) (defbehavior metalhead-flitter-fall-and-play-death-anim metalhead-flitter ((arg0 int) (arg1 float) (arg2 time-frame)) @@ -631,7 +627,7 @@ ) (set! (-> self root-override2 transv y) 33775.48) (ja :num-func num-func-identity :frame-num 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self root-override2 status) (collide-status on-surface on-ground touch-surface)) (until v1-29 (let ((f0-2 102400.0)) @@ -640,7 +636,7 @@ ) (suspend) (ja :num! (seek! max arg1)) - (set! v1-29 (or (ja-done? 0) (>= (- (-> self clock frame-counter) (-> self state-time)) arg2))) + (set! v1-29 (or (ja-done? 0) (>= (- (current-time) (-> self state-time)) arg2))) ) ) ) @@ -732,9 +728,9 @@ (defstate hostile (metalhead-flitter) :virtual #t :enter (behavior () - (set! (-> self last-change-dir) (the-as uint (-> self clock frame-counter))) + (set! (-> self last-change-dir) (the-as uint (current-time))) (set! (-> self change-dir-time) 0) - (set! (-> self attack-time) (+ (-> self clock frame-counter) (seconds 0.35))) + (set! (-> self attack-time) (+ (current-time) (seconds 0.35))) (let ((t9-0 (-> (method-of-type citizen-enemy hostile) enter))) (if t9-0 (t9-0) @@ -800,7 +796,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -839,7 +835,7 @@ (set! s5-2 (cond ((and gp-0 - (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.5)) + (< (- (current-time) (-> self state-time)) (seconds 1.5)) gp-0 (not (logtest? (-> (the-as process-focusable gp-0) focus-status) (focus-status disable dead ignore grabbed))) ) @@ -1000,7 +996,7 @@ (t9-0) ) ) - (set! (-> self off-screen-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self off-screen-timer) (the-as uint (current-time))) (none) ) :trans (behavior () @@ -1008,7 +1004,7 @@ (if gp-0 (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable gp-0) 0) quad)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((v1-11 (-> self focus aware))) (cond ((= v1-11 (enemy-aware enemy-aware-3)) @@ -1025,14 +1021,12 @@ ) ) ) - (if (and (get-enemy-target self) - (>= (- (-> self clock frame-counter) (the-as int (-> self off-screen-timer))) (seconds 0.3)) - ) + (if (and (get-enemy-target self) (>= (- (current-time) (the-as int (-> self off-screen-timer))) (seconds 0.3))) (go-hostile self) ) ) (else - (set! (-> self off-screen-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self off-screen-timer) (the-as uint (current-time))) ) ) ) diff --git a/goal_src/jak2/levels/city/common/metalhead-grunt.gc b/goal_src/jak2/levels/city/common/metalhead-grunt.gc index 1efa2178c4..f5f58bccb5 100644 --- a/goal_src/jak2/levels/city/common/metalhead-grunt.gc +++ b/goal_src/jak2/levels/city/common/metalhead-grunt.gc @@ -688,7 +688,7 @@ ) ) (let ((a0-1 (metalhead-grunt-method-209 self 13312.0)) - (gp-0 (-> self clock frame-counter)) + (gp-0 (current-time)) ) (when (and (>= gp-0 (-> self next-warn-time)) (not (logtest? (-> self draw status) (draw-control-status on-screen))) diff --git a/goal_src/jak2/levels/city/common/pilot-states.gc b/goal_src/jak2/levels/city/common/pilot-states.gc index 277a0f6f51..083863bd1c 100644 --- a/goal_src/jak2/levels/city/common/pilot-states.gc +++ b/goal_src/jak2/levels/city/common/pilot-states.gc @@ -171,7 +171,7 @@ (vector-rotate*! (-> gp-0 local-accel) (-> s4-0 0) (the-as matrix (-> s4-0 1))) ) (vehicle-method-116 (the-as vehicle s5-0) (the-as (pointer vehicle-controls) (-> gp-0 controls))) - (let ((f30-0 (* 182.04445 (* 0.6 (the float (-> self clock frame-counter))))) + (let ((f30-0 (* 182.04445 (* 0.6 (the float (current-time))))) (s5-1 (-> gp-0 local-accel)) ) (let ((f3-0 @@ -844,7 +844,7 @@ ) :code (behavior ((arg0 symbol) (arg1 attack-info)) (local-vars (sv-16 attack-info)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self neck flex-blend) 0.0) (set! sv-16 (-> self attack-info)) (let ((v1-4 sv-16)) @@ -902,8 +902,8 @@ (logior! (-> self focus-status) (focus-status dead)) (case arg0 (('melt 'grenade 'explode) - (let ((s5-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-0) (seconds 0.2)) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) (seconds 0.2)) (suspend) ) ) @@ -1029,8 +1029,8 @@ ) 0 (ja-channel-set! 0) - (let ((s5-7 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-7) (seconds 1.8)) + (let ((s5-7 (current-time))) + (until (>= (- (current-time) s5-7) (seconds 1.8)) (suspend) ) ) @@ -1062,8 +1062,8 @@ ) ) ) - (let ((s5-9 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-9) (seconds 0.5)) + (let ((s5-9 (current-time))) + (until (>= (- (current-time) s5-9) (seconds 0.5)) (suspend) ) ) diff --git a/goal_src/jak2/levels/city/common/traffic-engine.gc b/goal_src/jak2/levels/city/common/traffic-engine.gc index 4b26b13a45..b897d2fd86 100644 --- a/goal_src/jak2/levels/city/common/traffic-engine.gc +++ b/goal_src/jak2/levels/city/common/traffic-engine.gc @@ -1194,89 +1194,87 @@ Process is recycled and moved to reserved, if it deactivates." ) (defmethod update-sync-from-frame-counter traffic-engine ((obj traffic-engine)) - (with-pp - (+! (-> obj sync-clock) 1) - (set! (-> obj sync-mask-8) (the-as uint (ash 1 (logand (-> obj sync-clock) 7)))) - (set! (-> obj sync-mask-16) (the-as uint (ash 1 (logand (-> obj sync-clock) 15)))) - (set! (-> obj sync-mask-32) (the-as uint (ash 1 (logand (-> obj sync-clock) 31)))) - (let ((v1-10 (/ (-> pp clock frame-counter) 300))) - (set! (-> obj sync-array 0) (the-as uint 255)) - (let ((a1-12 (mod v1-10 20))) - (set! (-> obj sync-array 1) (the-as uint (cond - ((>= 6 a1-12) - 1 - ) - ((>= 9 a1-12) - 2 - ) - ((>= 16 a1-12) - 4 - ) - (else - 8 - ) + (+! (-> obj sync-clock) 1) + (set! (-> obj sync-mask-8) (the-as uint (ash 1 (logand (-> obj sync-clock) 7)))) + (set! (-> obj sync-mask-16) (the-as uint (ash 1 (logand (-> obj sync-clock) 15)))) + (set! (-> obj sync-mask-32) (the-as uint (ash 1 (logand (-> obj sync-clock) 31)))) + (let ((v1-10 (/ (current-time) 300))) + (set! (-> obj sync-array 0) (the-as uint 255)) + (let ((a1-12 (mod v1-10 20))) + (set! (-> obj sync-array 1) (the-as uint (cond + ((>= 6 a1-12) + 1 + ) + ((>= 9 a1-12) + 2 + ) + ((>= 16 a1-12) + 4 + ) + (else + 8 ) - ) - ) - ) - (let ((a1-15 (mod v1-10 30))) - (set! (-> obj sync-array 2) (the-as uint (cond - ((>= 6 a1-15) - 1 - ) - ((>= 9 a1-15) - 2 - ) - ((>= 16 a1-15) - 4 - ) - ((>= 19 a1-15) - 8 - ) - ((>= 26 a1-15) - 16 - ) - (else - 32 - ) - ) - ) - ) - ) - (let ((v1-11 (mod v1-10 40))) - (set! (-> obj sync-array 3) (the-as uint (cond - ((>= 6 v1-11) - 1 - ) - ((>= 9 v1-11) - 2 - ) - ((>= 16 v1-11) - 4 - ) - ((>= 19 v1-11) - 8 - ) - ((>= 26 v1-11) - 16 - ) - ((>= 29 v1-11) - 32 - ) - ((>= 36 v1-11) - 64 - ) - (else - 128 - ) - ) - ) - ) - ) + ) + ) + ) + ) + (let ((a1-15 (mod v1-10 30))) + (set! (-> obj sync-array 2) (the-as uint (cond + ((>= 6 a1-15) + 1 + ) + ((>= 9 a1-15) + 2 + ) + ((>= 16 a1-15) + 4 + ) + ((>= 19 a1-15) + 8 + ) + ((>= 26 a1-15) + 16 + ) + (else + 32 + ) + ) + ) + ) + ) + (let ((v1-11 (mod v1-10 40))) + (set! (-> obj sync-array 3) (the-as uint (cond + ((>= 6 v1-11) + 1 + ) + ((>= 9 v1-11) + 2 + ) + ((>= 16 v1-11) + 4 + ) + ((>= 19 v1-11) + 8 + ) + ((>= 26 v1-11) + 16 + ) + ((>= 29 v1-11) + 32 + ) + ((>= 36 v1-11) + 64 + ) + (else + 128 + ) + ) + ) + ) ) - 0 - (none) ) + 0 + (none) ) (defmethod update-danger-from-target traffic-engine ((obj traffic-engine)) @@ -1835,21 +1833,19 @@ Process is recycled and moved to reserved, if it deactivates." ) (defmethod increase-alert-level traffic-engine ((obj traffic-engine) (arg0 int) (arg1 target)) - (with-pp - (when (and (logtest? (-> obj alert-state flags) (traffic-alert-flag target-jak)) - (logtest? (-> arg1 mask) (process-mask target)) - ) - (let ((v1-6 (min arg0 (the-as int (-> obj alert-state max-level))))) - (when #t - (set! (-> obj alert-state start-time) (-> pp clock frame-counter)) - (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) - ) - (set! (-> obj alert-state level) (the-as uint (max (the-as int (-> obj alert-state level)) v1-6))) + (when (and (logtest? (-> obj alert-state flags) (traffic-alert-flag target-jak)) + (logtest? (-> arg1 mask) (process-mask target)) + ) + (let ((v1-6 (min arg0 (the-as int (-> obj alert-state max-level))))) + (when #t + (set! (-> obj alert-state start-time) (current-time)) + (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) ) + (set! (-> obj alert-state level) (the-as uint (max (the-as int (-> obj alert-state level)) v1-6))) ) - 0 - (none) ) + 0 + (none) ) (defmethod decrease-alert-level traffic-engine ((obj traffic-engine) (arg0 int)) @@ -1861,13 +1857,11 @@ Process is recycled and moved to reserved, if it deactivates." ) (defmethod set-alert-level traffic-engine ((obj traffic-engine) (arg0 int)) - (with-pp - (set! (-> obj alert-state level) (the-as uint arg0)) - (set! (-> obj alert-state start-time) (-> pp clock frame-counter)) - (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) - 0 - (none) - ) + (set! (-> obj alert-state level) (the-as uint arg0)) + (set! (-> obj alert-state start-time) (current-time)) + (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) + 0 + (none) ) (defmethod set-max-alert-level traffic-engine ((obj traffic-engine) (arg0 int)) @@ -2147,114 +2141,112 @@ Process is recycled and moved to reserved, if it deactivates." (sv-208 int) (sv-216 float) ) - (with-pp - (logclear! (-> target-status flags) (traffic-target-flag visible-now updated)) - (cond - ((= (-> obj sync-mask-16) (ash 1 (logand arg2 15))) - (logior! (-> target-status flags) (traffic-target-flag updated)) - (let ((target-proc (handle->process (-> target-status handle))) - (target-pos (new 'stack-no-clear 'vector)) - ) - (when target-proc - (set! (-> target-pos quad) (-> (get-trans (the-as process-focusable target-proc) 3) quad)) - (cond - ((= (-> (the-as process-focusable target-proc) type) target) - (let ((s1-1 (-> obj alert-state target-status-array))) - (logclear! (-> s1-1 0 flags) (traffic-target-flag visible-now updated)) - (logior! (-> s1-1 0 flags) (traffic-target-flag updated)) - (cond - ((or (logtest? (-> s1-1 0 flags) (traffic-target-flag force-visible)) (traffic-los-clear? los target-pos)) - (logior! (-> s1-1 0 flags) (traffic-target-flag visible-now visible-recently visible-ever)) - (set! (-> s1-1 0 last-seen-time) (-> pp clock frame-counter)) - (set! (-> s1-1 0 position quad) (-> target-pos quad)) - (set! (-> s1-1 0 velocity quad) (-> (get-transv (the-as process-focusable target-proc)) quad)) - ) - (else - (if (>= (- (-> pp clock frame-counter) (-> s1-1 0 last-seen-time)) (seconds 2)) - (logclear! (-> s1-1 0 flags) (traffic-target-flag visible-recently)) - ) - ) - ) - (mem-copy! (the-as pointer target-status) (the-as pointer s1-1) 80) - ) - 0 - ) - (else - (logior! (-> target-status flags) (traffic-target-flag visible-now visible-recently visible-ever)) - (set! (-> target-status last-seen-time) (-> pp clock frame-counter)) - (set! (-> target-status position quad) (-> target-pos quad)) - (set! (-> target-status velocity quad) (-> (get-transv (the-as process-focusable target-proc)) quad)) - ) - ) - (set! (-> target-pos quad) (-> target-status position quad)) - (when (not (update-guard-status-spots target-pos)) - ) - (when (update-guard-status-spots target-pos) - (set! guards (new 'stack-no-clear 'array 'crimson-guard 16)) - (set! guard-target-dists (new 'stack-no-clear 'array 'float 16)) - (set! guard-idx 0) - (dotimes (guard-count (the-as int (-> obj vehicle-tracker-array active-object-count))) - (case (-> obj vehicle-tracker-array active-object-type-list guard-count) - (((traffic-type crimson-guard-1)) - (let ((guard (handle->process (-> obj 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-override2 trans) target-pos) - ) - (set! guard-idx (+ guard-idx 1)) - (set! (-> (the-as crimson-guard guard) move-index) -1) + (logclear! (-> target-status flags) (traffic-target-flag visible-now updated)) + (cond + ((= (-> obj sync-mask-16) (ash 1 (logand arg2 15))) + (logior! (-> target-status flags) (traffic-target-flag updated)) + (let ((target-proc (handle->process (-> target-status handle))) + (target-pos (new 'stack-no-clear 'vector)) + ) + (when target-proc + (set! (-> target-pos quad) (-> (get-trans (the-as process-focusable target-proc) 3) quad)) + (cond + ((= (-> (the-as process-focusable target-proc) type) target) + (let ((s1-1 (-> obj alert-state target-status-array))) + (logclear! (-> s1-1 0 flags) (traffic-target-flag visible-now updated)) + (logior! (-> s1-1 0 flags) (traffic-target-flag updated)) + (cond + ((or (logtest? (-> s1-1 0 flags) (traffic-target-flag force-visible)) (traffic-los-clear? los target-pos)) + (logior! (-> s1-1 0 flags) (traffic-target-flag visible-now visible-recently visible-ever)) + (set! (-> s1-1 0 last-seen-time) (current-time)) + (set! (-> s1-1 0 position quad) (-> target-pos quad)) + (set! (-> s1-1 0 velocity quad) (-> (get-transv (the-as process-focusable target-proc)) quad)) + ) + (else + (if (>= (- (current-time) (-> s1-1 0 last-seen-time)) (seconds 2)) + (logclear! (-> s1-1 0 flags) (traffic-target-flag visible-recently)) ) + ) + ) + (mem-copy! (the-as pointer target-status) (the-as pointer s1-1) 80) + ) + 0 + ) + (else + (logior! (-> target-status flags) (traffic-target-flag visible-now visible-recently visible-ever)) + (set! (-> target-status last-seen-time) (current-time)) + (set! (-> target-status position quad) (-> target-pos quad)) + (set! (-> target-status velocity quad) (-> (get-transv (the-as process-focusable target-proc)) quad)) + ) + ) + (set! (-> target-pos quad) (-> target-status position quad)) + (when (not (update-guard-status-spots target-pos)) + ) + (when (update-guard-status-spots target-pos) + (set! guards (new 'stack-no-clear 'array 'crimson-guard 16)) + (set! guard-target-dists (new 'stack-no-clear 'array 'float 16)) + (set! guard-idx 0) + (dotimes (guard-count (the-as int (-> obj vehicle-tracker-array active-object-count))) + (case (-> obj vehicle-tracker-array active-object-type-list guard-count) + (((traffic-type crimson-guard-1)) + (let ((guard (handle->process (-> obj 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-override2 trans) target-pos) + ) + (set! guard-idx (+ 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) - ) - (set! a0-35 #t) + ) + (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) ) ) ) - (dotimes (s4-1 guard-idx) - (let ((crimson-guard (-> (the-as (pointer crimson-guard) guards) s4-1))) - (when (= (-> crimson-guard move-index) -1) - (set! sv-208 -1) - (set! sv-216 100000000000000000.0) ;; kinda hacky, was ps2 weird infinity. - (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-override2 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 (pointer crimson-guard) guards) s4-1))) + (when (= (-> crimson-guard move-index) -1) + (set! sv-208 -1) + (set! sv-216 100000000000000000.0) ;; kinda hacky, was ps2 weird infinity. + (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-override2 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)) ) ) ) @@ -2263,26 +2255,26 @@ Process is recycled and moved to reserved, if it deactivates." ) ) ) - (else - (let ((s5-1 (handle->process (-> target-status handle))) - (s3-3 (new 'stack-no-clear 'vector)) - ) - (when s5-1 - (set! (-> s3-3 quad) (-> (get-trans (the-as process-focusable s5-1) 3) quad)) - (cond - ((= (-> s5-1 type) target) - (mem-copy! (the-as pointer target-status) (the-as pointer (-> obj alert-state target-status-array)) 80) - ) - (else - ) + ) + (else + (let ((s5-1 (handle->process (-> target-status handle))) + (s3-3 (new 'stack-no-clear 'vector)) + ) + (when s5-1 + (set! (-> s3-3 quad) (-> (get-trans (the-as process-focusable s5-1) 3) quad)) + (cond + ((= (-> s5-1 type) target) + (mem-copy! (the-as pointer target-status) (the-as pointer (-> obj alert-state target-status-array)) 80) + ) + (else ) ) ) - (logclear! (-> target-status flags) (traffic-target-flag updated)) ) + (logclear! (-> target-status flags) (traffic-target-flag updated)) ) - target-status ) + target-status ) (defmethod set-alert-duration traffic-engine ((obj traffic-engine) (arg0 time-frame)) @@ -2731,189 +2723,184 @@ Process is recycled and moved to reserved, if it deactivates." ) (defmethod update-alert-state traffic-engine ((obj traffic-engine)) - (with-pp - (if (and (logtest? (-> obj alert-state flags) (traffic-alert-flag target-jak)) *target*) - (set! (-> obj alert-state target-status-array 0 handle) (process->handle *target*)) - ) - (when #t - (mem-copy! - (the-as pointer (-> obj alert-state settings)) - (the-as pointer (-> *alert-level-settings* (-> obj alert-state level))) - 96 - ) - (dotimes (v1-10 6) - (let ((a1-3 (-> obj alert-state settings guard-settings-array v1-10)) - (a0-10 (-> obj alert-state guard-type-info-array v1-10)) - ) - (set! (-> a1-3 inaccuracy) - (fmax 0.0 (fmin 1.0 (* (-> a1-3 inaccuracy) (-> obj alert-state guard-inaccuracy-factor)))) - ) - (when *target* - (when (focus-test? *target* pilot) - (set! (-> a1-3 acquire-delay) (the-as uint (the int (* 0.75 (the float (-> a1-3 acquire-delay)))))) - (set! (-> a1-3 shot-delay) (the-as uint (the int (* 0.6 (the float (-> a1-3 shot-delay)))))) - (set! (-> a1-3 burst-delay) (the-as uint (the int (* 0.8 (the float (-> a1-3 burst-delay)))))) - ) + (if (and (logtest? (-> obj alert-state flags) (traffic-alert-flag target-jak)) *target*) + (set! (-> obj alert-state target-status-array 0 handle) (process->handle *target*)) + ) + (when #t + (mem-copy! + (the-as pointer (-> obj alert-state settings)) + (the-as pointer (-> *alert-level-settings* (-> obj alert-state level))) + 96 + ) + (dotimes (v1-10 6) + (let ((a1-3 (-> obj alert-state settings guard-settings-array v1-10)) + (a0-10 (-> obj alert-state guard-type-info-array v1-10)) ) - (set! (-> a0-10 target-count) - (max - (min - (the int (* (the float (-> a1-3 target-count)) (-> obj alert-state guard-target-level))) - (-> a0-10 max-target-count) - ) - (-> a0-10 min-target-count) + (set! (-> a1-3 inaccuracy) + (fmax 0.0 (fmin 1.0 (* (-> a1-3 inaccuracy) (-> obj alert-state guard-inaccuracy-factor)))) + ) + (when *target* + (when (focus-test? *target* pilot) + (set! (-> a1-3 acquire-delay) (the-as uint (the int (* 0.75 (the float (-> a1-3 acquire-delay)))))) + (set! (-> a1-3 shot-delay) (the-as uint (the int (* 0.6 (the float (-> a1-3 shot-delay)))))) + (set! (-> a1-3 burst-delay) (the-as uint (the int (* 0.8 (the float (-> a1-3 burst-delay)))))) + ) + ) + (set! (-> a0-10 target-count) + (max + (min + (the int (* (the float (-> a1-3 target-count)) (-> obj alert-state guard-target-level))) + (-> a0-10 max-target-count) ) + (-> a0-10 min-target-count) ) + ) + ) + ) + ) + (dotimes (v1-13 21) + (let ((a1-8 (-> obj alert-state guard-type-mask-from-object-type v1-13))) + (when (nonzero? a1-8) + (let ((a2-18 0) + (a0-14 0) + ) + (while (nonzero? a1-8) + (if (logtest? a1-8 1) + (+! a0-14 (-> obj alert-state guard-type-info-array a2-18 target-count)) + ) + (+! a2-18 1) + (set! a1-8 (shr a1-8 1)) + ) + (set! (-> obj object-type-info-array v1-13 target-count) a0-14) ) ) ) - (dotimes (v1-13 21) - (let ((a1-8 (-> obj alert-state guard-type-mask-from-object-type v1-13))) - (when (nonzero? a1-8) - (let ((a2-18 0) - (a0-14 0) - ) - (while (nonzero? a1-8) - (if (logtest? a1-8 1) - (+! a0-14 (-> obj alert-state guard-type-info-array a2-18 target-count)) - ) - (+! a2-18 1) - (set! a1-8 (shr a1-8 1)) - ) - (set! (-> obj object-type-info-array v1-13 target-count) a0-14) - ) - ) - ) + ) + (let ((s5-0 #f)) + (when *traffic-alert-level-force* + (set! (-> obj alert-state level) (the-as uint 3)) + (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) + (set! (-> obj alert-state start-time) (current-time)) ) - (let ((s5-0 #f)) - (when *traffic-alert-level-force* - (set! (-> obj alert-state level) (the-as uint 3)) - (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) - (set! (-> obj alert-state start-time) (-> pp clock frame-counter)) - ) - (when (>= (-> obj alert-state level) (the-as uint 1)) - (set! s5-0 #t) - (cond - ((logtest? (-> obj alert-state flags) (traffic-alert-flag alert-ending)) - (cond - ((> (guard-count obj) 0) - (set! (-> obj alert-state start-time) (-> pp clock frame-counter)) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> obj alert-state start-time)) (seconds 3)) - (set! s5-0 #f) - (set! (-> obj alert-state level) (the-as uint 0)) - (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) - ) + (when (>= (-> obj alert-state level) (the-as uint 1)) + (set! s5-0 #t) + (cond + ((logtest? (-> obj alert-state flags) (traffic-alert-flag alert-ending)) + (cond + ((> (guard-count obj) 0) + (set! (-> obj alert-state start-time) (current-time)) + ) + (else + (when (>= (- (current-time) (-> obj alert-state start-time)) (seconds 3)) + (set! s5-0 #f) + (set! (-> obj alert-state level) (the-as uint 0)) + (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) ) ) ) - (else - (let ((v1-39 (+ (- (-> obj alert-state start-time) (-> pp clock frame-counter)) - (the-as time-frame (-> obj alert-state duration)) - ) - ) - ) - (if (and *target* (-> *target* next-state) (= (-> *target* next-state name) 'target-hide)) - (set! v1-39 (- v1-39 (the-as time-frame (* (- (-> pp clock frame-counter) (-> *target* state-time)) 2)))) - ) - (if (> v1-39 0) - 0 - (logior! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) - ) - ) - ) - ) - ) - (cond - (s5-0 - (when (not (logtest? (-> obj alert-state flags) (traffic-alert-flag alarm-on))) - (logior! (-> obj alert-state flags) (traffic-alert-flag alarm-on)) - (set! (-> *game-info* wanted-flash) (the-as basic #t)) - (if (= (-> *setting-control* user-current music) 'city1) - (set-setting! 'sound-mode #f 0.0 1) - ) - ) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (set! (-> s5-1 quad) (-> (target-pos 0) quad)) - (if (or (= (-> *setting-control* user-default music-volume) 0.0) - (!= (-> *setting-control* user-current music) 'city1) - ) - (sound-play "city-alarm" :id (-> obj alert-state alarm-sound-id) :position s5-1) - ) - ) - (if #t - (send-alert-events obj) - ) - (let ((v1-67 0)) - (dotimes (a0-45 21) - (let ((a1-19 (-> obj object-type-info-array a0-45))) - (if #t - (+! v1-67 (-> a1-19 killed-count)) - ) - ) - ) - (if (and (>= v1-67 (the-as int (* (-> obj alert-state level) 8))) - (< (-> obj alert-state level) (-> obj alert-state max-level)) - ) - (set-alert-level obj (the-as int (+ (-> obj alert-state level) 1))) - ) - ) - ) + ) (else - (when (logtest? (-> obj alert-state flags) (traffic-alert-flag alarm-on)) - (logclear! (-> obj alert-state flags) (traffic-alert-flag alarm-on)) - (set! (-> *game-info* wanted-flash) #f) - (remove-setting! 'sound-mode) - (sound-stop (-> obj alert-state alarm-sound-id)) - (send-alert-events obj) - (let ((v1-84 (-> obj alert-state target-status-array))) - (logclear! (-> v1-84 0 flags) (traffic-target-flag visible-now visible-recently visible-ever)) - ) - (dotimes (v1-85 21) - (set! (-> obj object-type-info-array v1-85 killed-count) (the-as uint 0)) - 0 - ) + (let ((v1-39 + (+ (- (-> obj alert-state start-time) (current-time)) (the-as time-frame (-> obj alert-state duration))) + ) + ) + (if (and *target* (-> *target* next-state) (= (-> *target* next-state name) 'target-hide)) + (set! v1-39 (- v1-39 (the-as time-frame (* (- (current-time) (-> *target* state-time)) 2)))) + ) + (if (> v1-39 0) + 0 + (logior! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) + ) + ) + ) + ) + ) + (cond + (s5-0 + (when (not (logtest? (-> obj alert-state flags) (traffic-alert-flag alarm-on))) + (logior! (-> obj alert-state flags) (traffic-alert-flag alarm-on)) + (set! (-> *game-info* wanted-flash) (the-as basic #t)) + (if (= (-> *setting-control* user-current music) 'city1) + (set-setting! 'sound-mode #f 0.0 1) + ) + ) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (set! (-> s5-1 quad) (-> (target-pos 0) quad)) + (if (or (= (-> *setting-control* user-default music-volume) 0.0) + (!= (-> *setting-control* user-current music) 'city1) + ) + (sound-play "city-alarm" :id (-> obj alert-state alarm-sound-id) :position s5-1) + ) + ) + (if #t + (send-alert-events obj) + ) + (let ((v1-67 0)) + (dotimes (a0-45 21) + (let ((a1-19 (-> obj object-type-info-array a0-45))) + (if #t + (+! v1-67 (-> a1-19 killed-count)) + ) + ) + ) + (if (and (>= v1-67 (the-as int (* (-> obj alert-state level) 8))) + (< (-> obj alert-state level) (-> obj alert-state max-level)) + ) + (set-alert-level obj (the-as int (+ (-> obj alert-state level) 1))) + ) + ) + ) + (else + (when (logtest? (-> obj alert-state flags) (traffic-alert-flag alarm-on)) + (logclear! (-> obj alert-state flags) (traffic-alert-flag alarm-on)) + (set! (-> *game-info* wanted-flash) #f) + (remove-setting! 'sound-mode) + (sound-stop (-> obj alert-state alarm-sound-id)) + (send-alert-events obj) + (let ((v1-84 (-> obj alert-state target-status-array))) + (logclear! (-> v1-84 0 flags) (traffic-target-flag visible-now visible-recently visible-ever)) + ) + (dotimes (v1-85 21) + (set! (-> obj object-type-info-array v1-85 killed-count) (the-as uint 0)) + 0 ) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod send-alert-events traffic-engine ((obj traffic-engine)) - (with-pp - (set! (-> obj alert-state notify-time) (-> pp clock frame-counter)) - (cond - ((> (-> obj alert-state level) 0) - (if (and (logtest? (-> obj alert-state flags) (traffic-alert-flag target-jak)) - (not (logtest? (-> obj alert-state flags) (traffic-alert-flag alert-ending))) - *target* - ) - (for-all-active-processes obj (lambda ((arg0 process-focusable) (arg1 traffic-object-type-info)) - (if (logtest? (-> arg1 flags) (traffic-type-flags trtflags-0)) - (send-event arg0 'alert-begin *target*) - ) - (none) - ) - ) - ) - ) - (else - (for-all-active-processes obj (lambda ((arg0 process-focusable) (arg1 traffic-object-type-info)) - (if (logtest? (-> arg1 flags) (traffic-type-flags trtflags-0)) - (send-event arg0 'alert-end) - ) - (none) - ) - ) - ) + (set! (-> obj alert-state notify-time) (current-time)) + (cond + ((> (-> obj alert-state level) 0) + (if (and (logtest? (-> obj alert-state flags) (traffic-alert-flag target-jak)) + (not (logtest? (-> obj alert-state flags) (traffic-alert-flag alert-ending))) + *target* + ) + (for-all-active-processes obj (lambda ((arg0 process-focusable) (arg1 traffic-object-type-info)) + (if (logtest? (-> arg1 flags) (traffic-type-flags trtflags-0)) + (send-event arg0 'alert-begin *target*) + ) + (none) + ) + ) + ) + ) + (else + (for-all-active-processes obj (lambda ((arg0 process-focusable) (arg1 traffic-object-type-info)) + (if (logtest? (-> arg1 flags) (traffic-type-flags trtflags-0)) + (send-event arg0 'alert-end) + ) + (none) + ) + ) ) - 0 - (none) ) + 0 + (none) ) (defmethod restore-default-settings traffic-engine ((obj traffic-engine)) diff --git a/goal_src/jak2/levels/city/common/transport.gc b/goal_src/jak2/levels/city/common/transport.gc index 551f3b3307..4a2c3849f2 100644 --- a/goal_src/jak2/levels/city/common/transport.gc +++ b/goal_src/jak2/levels/city/common/transport.gc @@ -285,8 +285,8 @@ :virtual #t :event transport-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-guard-spawn-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self last-guard-spawn-time) (current-time)) (none) ) :code (behavior () @@ -319,7 +319,7 @@ :virtual #t :event transport-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self root-override transv y) 0.0) (set! (-> self last-guard-spawn-time) 0) 0 @@ -364,16 +364,16 @@ gp-0 ) ) - (set! (-> self leave-time) (+ (-> self clock frame-counter) (seconds 3))) + (set! (-> self leave-time) (+ (current-time) (seconds 3))) ) - (if (and (nonzero? (-> self leave-time)) (< (-> self leave-time) (-> self clock frame-counter))) + (if (and (nonzero? (-> self leave-time)) (< (-> self leave-time) (current-time))) (go-virtual leave) ) (when (and (zero? (-> self leave-time)) (nonzero? (-> self max-guard)) (>= (-> self count-guard) (-> self max-guard)) ) - (set! (-> self leave-time) (+ (-> self clock frame-counter) (seconds 3))) + (set! (-> self leave-time) (+ (current-time) (seconds 3))) (send-event self 'stop-spawning) ) (transport-method-34 self *target*) @@ -396,7 +396,7 @@ :virtual #t :event transport-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self root-override transv y) 0.0) (none) ) @@ -431,42 +431,40 @@ ) (defmethod transport-method-33 transport ((obj transport)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> obj last-guard-spawn-time)) 0) - (let ((s5-0 (new 'stack 'traffic-object-spawn-params))) - (set! (-> s5-0 object-type) (traffic-type crimson-guard-1)) - (set! (-> s5-0 behavior) (the-as uint 6)) - (set! (-> s5-0 id) (the-as uint 0)) - (set! (-> s5-0 nav-mesh) (-> obj nav-mesh)) - (set! (-> s5-0 nav-branch) #f) - (set! (-> s5-0 proc) #f) - (set! (-> s5-0 handle) (process->handle obj)) - (set! (-> s5-0 user-data) (-> obj spawn-side)) - (set! (-> s5-0 flags) (traffic-spawn-flags)) - (set! (-> s5-0 guard-type) (the-as uint 7)) - (vector-reset! (-> s5-0 velocity)) - (set! (-> s5-0 position quad) (-> obj root-override trans quad)) - (set! (-> s5-0 position y) (+ 8192.0 (-> s5-0 position y))) - (quaternion-rotate-local-y! (-> s5-0 rotation) (-> obj root-override quat) 32768.0) - (send-event *traffic-manager* 'activate-object s5-0) - (when (-> s5-0 proc) - (set! (-> obj spawn-side) (- 1 (the-as int (-> obj spawn-side)))) - (if (logtest? (-> obj draw status) (draw-control-status on-screen)) - (set! (-> obj last-guard-spawn-time) (+ (-> pp clock frame-counter) (seconds 1))) - (set! (-> obj last-guard-spawn-time) (+ (-> pp clock frame-counter) (seconds 2))) - ) - (+! (-> obj count-guard) 1) - ) - (when (not (-> s5-0 proc)) - (if (logtest? (-> obj draw status) (draw-control-status on-screen)) - (set! (-> obj last-guard-spawn-time) (+ (-> pp clock frame-counter) (seconds 0.1))) - (set! (-> obj last-guard-spawn-time) (+ (-> pp clock frame-counter) (seconds 1))) - ) - ) + (when (>= (- (current-time) (-> obj last-guard-spawn-time)) 0) + (let ((s5-0 (new 'stack 'traffic-object-spawn-params))) + (set! (-> s5-0 object-type) (traffic-type crimson-guard-1)) + (set! (-> s5-0 behavior) (the-as uint 6)) + (set! (-> s5-0 id) (the-as uint 0)) + (set! (-> s5-0 nav-mesh) (-> obj nav-mesh)) + (set! (-> s5-0 nav-branch) #f) + (set! (-> s5-0 proc) #f) + (set! (-> s5-0 handle) (process->handle obj)) + (set! (-> s5-0 user-data) (-> obj spawn-side)) + (set! (-> s5-0 flags) (traffic-spawn-flags)) + (set! (-> s5-0 guard-type) (the-as uint 7)) + (vector-reset! (-> s5-0 velocity)) + (set! (-> s5-0 position quad) (-> obj root-override trans quad)) + (set! (-> s5-0 position y) (+ 8192.0 (-> s5-0 position y))) + (quaternion-rotate-local-y! (-> s5-0 rotation) (-> obj root-override quat) 32768.0) + (send-event *traffic-manager* 'activate-object s5-0) + (when (-> s5-0 proc) + (set! (-> obj spawn-side) (- 1 (the-as int (-> obj spawn-side)))) + (if (logtest? (-> obj draw status) (draw-control-status on-screen)) + (set! (-> obj last-guard-spawn-time) (+ (current-time) (seconds 1))) + (set! (-> obj last-guard-spawn-time) (+ (current-time) (seconds 2))) + ) + (+! (-> obj count-guard) 1) + ) + (when (not (-> s5-0 proc)) + (if (logtest? (-> obj draw status) (draw-control-status on-screen)) + (set! (-> obj last-guard-spawn-time) (+ (current-time) (seconds 0.1))) + (set! (-> obj last-guard-spawn-time) (+ (current-time) (seconds 1))) + ) ) ) - (none) ) + (none) ) (defmethod transport-method-34 transport ((obj transport) (arg0 process)) diff --git a/goal_src/jak2/levels/city/common/vehicle-control.gc b/goal_src/jak2/levels/city/common/vehicle-control.gc index 8446731e75..70e6e39714 100644 --- a/goal_src/jak2/levels/city/common/vehicle-control.gc +++ b/goal_src/jak2/levels/city/common/vehicle-control.gc @@ -602,7 +602,7 @@ (vector-xz-normalize! s3-0 1.0) (cond ((= arg3 (-> arg0 sample-index)) - (let* ((f30-0 (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> arg0 sample-time))))) + (let* ((f30-0 (* 0.0033333334 (the float (- (current-time) (-> arg0 sample-time))))) (f0-3 (acos-rad (vector-dot s3-0 (-> arg0 sample-dir)))) (f28-0 (/ (* arg4 f30-0) f0-3)) ) @@ -614,7 +614,7 @@ ) (else (set! (-> arg0 sample-index) arg3) - (set! (-> arg0 sample-time) (-> self clock frame-counter)) + (set! (-> arg0 sample-time) (current-time)) (set! (-> arg0 sample-dir quad) (-> s3-0 quad)) ) ) diff --git a/goal_src/jak2/levels/city/common/vehicle-effects.gc b/goal_src/jak2/levels/city/common/vehicle-effects.gc index 274ab391a5..752a28c32a 100644 --- a/goal_src/jak2/levels/city/common/vehicle-effects.gc +++ b/goal_src/jak2/levels/city/common/vehicle-effects.gc @@ -55,7 +55,7 @@ (f0-22 (+ (-> obj info-override engine-pitch-offset) (* (-> obj info-override engine-pitch-scale) f30-0) (* (-> obj info-override engine-pitch-mod-amp) - (sin (* 109.22667 (the float (- (-> pp clock frame-counter) (-> obj state-time))))) + (sin (* 109.22667 (the float (- (current-time) (-> obj state-time))))) ) f26-0 ) diff --git a/goal_src/jak2/levels/city/common/vehicle-guard.gc b/goal_src/jak2/levels/city/common/vehicle-guard.gc index 982254343c..67f1841cc9 100644 --- a/goal_src/jak2/levels/city/common/vehicle-guard.gc +++ b/goal_src/jak2/levels/city/common/vehicle-guard.gc @@ -445,50 +445,42 @@ ) (defmethod turret-control-method-10 turret-control ((obj turret-control) (arg0 vehicle)) - (with-pp - (cond - ((logtest? (-> obj flags) (turret-flag should-shoot)) - (cond - ((logtest? (-> obj flags) (turret-flag firing)) - (cond - ((> (-> obj shot-count) 0) - (if (>= (- (-> pp clock frame-counter) (-> obj shoot-time)) - (the-as time-frame (-> obj guard-settings shot-delay)) - ) - (turret-control-method-17 obj arg0) - ) - ) - (else - (logclear! (-> obj flags) (turret-flag firing)) - (+! (-> obj burst-count) 1) - (turret-control-method-13 obj) - ) + (cond + ((logtest? (-> obj flags) (turret-flag should-shoot)) + (cond + ((logtest? (-> obj flags) (turret-flag firing)) + (cond + ((> (-> obj shot-count) 0) + (if (>= (- (current-time) (-> obj shoot-time)) (the-as time-frame (-> obj guard-settings shot-delay))) + (turret-control-method-17 obj arg0) + ) + ) + (else + (logclear! (-> obj flags) (turret-flag firing)) + (+! (-> obj burst-count) 1) + (turret-control-method-13 obj) ) ) - (else - (when (and (>= (- (-> pp clock frame-counter) (-> obj shoot-time)) - (the-as time-frame (-> obj guard-settings burst-delay)) - ) - (>= (- (-> pp clock frame-counter) (-> obj aim-acquire-time)) - (the-as time-frame (-> obj guard-settings acquire-delay)) - ) - ) - (set! (-> obj shot-count) - (+ (-> obj guard-settings shot-count) (rand-vu-int-count (+ (-> obj guard-settings rand-shot-count) 1))) - ) - (logior! (-> obj flags) (turret-flag firing)) - ) + ) + (else + (when (and (>= (- (current-time) (-> obj shoot-time)) (the-as time-frame (-> obj guard-settings burst-delay))) + (>= (- (current-time) (-> obj aim-acquire-time)) (the-as time-frame (-> obj guard-settings acquire-delay))) + ) + (set! (-> obj shot-count) + (+ (-> obj guard-settings shot-count) (rand-vu-int-count (+ (-> obj guard-settings rand-shot-count) 1))) + ) + (logior! (-> obj flags) (turret-flag firing)) ) ) ) - (else - (set! (-> obj aim-acquire-time) (-> pp clock frame-counter)) - (turret-control-method-14 obj) - ) + ) + (else + (set! (-> obj aim-acquire-time) (current-time)) + (turret-control-method-14 obj) ) - 0 - (none) ) + 0 + (none) ) (defmethod turret-control-method-11 turret-control ((obj turret-control) (arg0 object) (arg1 object) (arg2 vector)) @@ -502,46 +494,44 @@ ) (defmethod turret-control-method-17 turret-control ((obj turret-control) (arg0 vehicle)) - (with-pp - (let ((s4-0 (new 'stack-no-clear 'turret-unknown-stack-structure2))) - (set! (-> s4-0 proj-params ent) (-> arg0 entity)) - (set! (-> s4-0 proj-params charge) 1.0) - (set! (-> s4-0 proj-params options) (projectile-options)) - (set! (-> s4-0 proj-params notify-handle) (process->handle arg0)) - (set! (-> s4-0 proj-params owner-handle) (process->handle (handle->process (-> obj owner-handle)))) - (set! (-> s4-0 proj-params ignore-handle) (process->handle arg0)) - (let* ((v1-14 *game-info*) - (a0-16 (+ (-> v1-14 attack-id) 1)) - ) - (set! (-> v1-14 attack-id) a0-16) - (set! (-> s4-0 proj-params attack-id) a0-16) - ) - (set! (-> s4-0 proj-params timeout) (seconds 4)) - (let* ((v1-16 (-> s4-0 mat-1)) - (a3-0 (-> arg0 node-list data (-> obj info joint-index) bone transform)) - (a0-20 (-> a3-0 quad 0)) - (a1-6 (-> a3-0 quad 1)) - (a2-0 (-> a3-0 quad 2)) - (a3-1 (-> a3-0 trans quad)) - ) - (set! (-> v1-16 quad 0) a0-20) - (set! (-> v1-16 quad 1) a1-6) - (set! (-> v1-16 quad 2) a2-0) - (set! (-> v1-16 trans quad) a3-1) - ) - (dotimes (s3-0 (-> obj info barrel-count)) - (vector-matrix*! (-> s4-0 vec-1) (the-as vector (-> obj info barrel-array s3-0)) (-> 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) (-> obj info shot-speed)) - (spawn-projectile guard-shot (-> s4-0 proj-params) arg0 *default-dead-pool*) - ) + (let ((s4-0 (new 'stack-no-clear 'turret-unknown-stack-structure2))) + (set! (-> s4-0 proj-params ent) (-> arg0 entity)) + (set! (-> s4-0 proj-params charge) 1.0) + (set! (-> s4-0 proj-params options) (projectile-options)) + (set! (-> s4-0 proj-params notify-handle) (process->handle arg0)) + (set! (-> s4-0 proj-params owner-handle) (process->handle (handle->process (-> obj owner-handle)))) + (set! (-> s4-0 proj-params ignore-handle) (process->handle arg0)) + (let* ((v1-14 *game-info*) + (a0-16 (+ (-> v1-14 attack-id) 1)) + ) + (set! (-> v1-14 attack-id) a0-16) + (set! (-> s4-0 proj-params attack-id) a0-16) + ) + (set! (-> s4-0 proj-params timeout) (seconds 4)) + (let* ((v1-16 (-> s4-0 mat-1)) + (a3-0 (-> arg0 node-list data (-> obj info joint-index) bone transform)) + (a0-20 (-> a3-0 quad 0)) + (a1-6 (-> a3-0 quad 1)) + (a2-0 (-> a3-0 quad 2)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-16 quad 0) a0-20) + (set! (-> v1-16 quad 1) a1-6) + (set! (-> v1-16 quad 2) a2-0) + (set! (-> v1-16 trans quad) a3-1) + ) + (dotimes (s3-0 (-> obj info barrel-count)) + (vector-matrix*! (-> s4-0 vec-1) (the-as vector (-> obj info barrel-array s3-0)) (-> 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) (-> obj info shot-speed)) + (spawn-projectile guard-shot (-> s4-0 proj-params) arg0 *default-dead-pool*) ) - (set! (-> obj shoot-time) (-> pp clock frame-counter)) - (+! (-> obj shot-count) -1) - 0 - (none) ) + (set! (-> obj shoot-time) (current-time)) + (+! (-> obj shot-count) -1) + 0 + (none) ) (defmethod turret-control-method-16 turret-control ((obj turret-control) (arg0 float) (arg1 float)) @@ -722,58 +712,56 @@ ) (defmethod vehicle-guard-method-150 vehicle-guard ((obj vehicle-guard)) - (with-pp - (cond - ((handle->process (-> obj pursuit-target)) - (let ((v1-3 (new 'stack-no-clear 'vehicle-control-point))) - (set! (-> v1-3 local-pos quad) (-> obj root-override-2 trans quad)) - (let ((v1-4 (traffic-engine-method-49 - (-> obj controller traffic) - (-> v1-3 local-pos) - (-> obj traffic-priority-id) - (the-as traffic-target-status (&-> obj traffic-target-status)) - ) + (cond + ((handle->process (-> obj pursuit-target)) + (let ((v1-3 (new 'stack-no-clear 'vehicle-control-point))) + (set! (-> v1-3 local-pos quad) (-> obj root-override-2 trans quad)) + (let ((v1-4 (traffic-engine-method-49 + (-> obj controller traffic) + (-> v1-3 local-pos) + (-> obj traffic-priority-id) + (the-as traffic-target-status (&-> obj traffic-target-status)) ) - ) - (when (logtest? (-> v1-4 flags) (traffic-target-flag updated)) - (set! (-> obj flags) - (the-as rigid-body-object-flag (logclear (-> obj flags) (rigid-body-object-flag target-in-sight))) ) - (when (logtest? (-> v1-4 flags) (traffic-target-flag visible-now)) - (set! (-> obj flags) - (the-as rigid-body-object-flag (logior (rigid-body-object-flag target-in-sight) (-> obj flags))) - ) - (set! (-> obj target-in-sight-time) (-> pp clock frame-counter)) - ) ) - (set! (-> obj target-flags) (the-as turret-flag (-> v1-4 flags))) + (when (logtest? (-> v1-4 flags) (traffic-target-flag updated)) + (set! (-> obj flags) + (the-as rigid-body-object-flag (logclear (-> obj flags) (rigid-body-object-flag target-in-sight))) + ) + (when (logtest? (-> v1-4 flags) (traffic-target-flag visible-now)) + (set! (-> obj flags) + (the-as rigid-body-object-flag (logior (rigid-body-object-flag target-in-sight) (-> obj flags))) + ) + (set! (-> obj target-in-sight-time) (current-time)) + ) ) - ) - (when (not (logtest? (rigid-body-object-flag in-pursuit) (-> obj flags))) - (if (logtest? (rigid-body-object-flag target-in-sight) (-> obj flags)) - (vehicle-method-108 obj) - ) + (set! (-> obj target-flags) (the-as turret-flag (-> v1-4 flags))) ) ) - (else - (vehicle-method-109 obj) - ) + (when (not (logtest? (rigid-body-object-flag in-pursuit) (-> obj flags))) + (if (logtest? (rigid-body-object-flag target-in-sight) (-> obj flags)) + (vehicle-method-108 obj) + ) + ) + ) + (else + (vehicle-method-109 obj) ) - (let ((v1-22 (if (logtest? (rigid-body-object-flag in-pursuit) (-> obj flags)) - (-> obj draw lod-set lod 1 geo) - (-> obj lod2) - ) - ) - ) - (when (!= v1-22 (-> obj draw lod-set lod 2 geo)) - (set! (-> obj draw lod-set lod 2 geo) (the-as merc-ctrl v1-22)) - (set! (-> obj draw cur-lod) -1) - (lod-set! (-> obj draw) (-> obj draw desired-lod)) - ) - ) - 0 - (none) ) + (let ((v1-22 (if (logtest? (rigid-body-object-flag in-pursuit) (-> obj flags)) + (-> obj draw lod-set lod 1 geo) + (-> obj lod2) + ) + ) + ) + (when (!= v1-22 (-> obj draw lod-set lod 2 geo)) + (set! (-> obj draw lod-set lod 2 geo) (the-as merc-ctrl v1-22)) + (set! (-> obj draw cur-lod) -1) + (lod-set! (-> obj draw) (-> obj draw desired-lod)) + ) + ) + 0 + (none) ) (defmethod vehicle-guard-method-155 vehicle-guard ((obj vehicle-guard) (arg0 vector) (arg1 vector)) @@ -1142,91 +1130,85 @@ ) (defmethod vehicle-guard-method-158 vehicle-guard ((obj vehicle-guard)) - (with-pp - (vehicle-guard-method-150 obj) - (let ((s5-0 (new 'stack-no-clear 'vehicle-guard-target-data))) - (vehicle-guard-method-151 obj s5-0) - (let ((a1-1 (-> s5-0 target))) - (when a1-1 - (cond - ((logtest? (rigid-body-object-flag target-in-sight) (-> obj flags)) - (vehicle-guard-method-153 obj a1-1) - (speech-control-method-15 *speech-control* obj) - ) - (else - (if (and (>= (- (-> pp clock frame-counter) (-> obj target-in-sight-time)) (seconds 4)) - (< 368640.0 (-> s5-0 dist)) - ) - (vehicle-method-109 obj) - ) - ) + (vehicle-guard-method-150 obj) + (let ((s5-0 (new 'stack-no-clear 'vehicle-guard-target-data))) + (vehicle-guard-method-151 obj s5-0) + (let ((a1-1 (-> s5-0 target))) + (when a1-1 + (cond + ((logtest? (rigid-body-object-flag target-in-sight) (-> obj flags)) + (vehicle-guard-method-153 obj a1-1) + (speech-control-method-15 *speech-control* obj) + ) + (else + (if (and (>= (- (current-time) (-> obj target-in-sight-time)) (seconds 4)) (< 368640.0 (-> s5-0 dist))) + (vehicle-method-109 obj) + ) ) ) ) ) - (if (not (logtest? (rigid-body-object-flag in-pursuit) (-> obj flags))) - (go (method-of-object obj active)) - ) - (rigid-body-object-method-42 obj) - (vehicle-method-122 obj) - 0 - (none) ) + (if (not (logtest? (rigid-body-object-flag in-pursuit) (-> obj flags))) + (go (method-of-object obj active)) + ) + (rigid-body-object-method-42 obj) + (vehicle-method-122 obj) + 0 + (none) ) (defmethod vehicle-method-94 vehicle-guard ((obj vehicle-guard)) - (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((v1-0 (new 'stack-no-clear 'camera-free-floating-move-info))) - (let* ((a0-1 (-> v1-0 tm)) - (t0-0 (-> obj rbody state matrix)) - (a1-1 (-> t0-0 quad 0)) - (a2-0 (-> t0-0 quad 1)) - (a3-0 (-> t0-0 quad 2)) - (t0-1 (-> t0-0 trans quad)) - ) - (set! (-> a0-1 quad 0) a1-1) - (set! (-> a0-1 quad 1) a2-0) - (set! (-> a0-1 quad 2) a3-0) - (set! (-> a0-1 trans quad) t0-1) - ) - (let ((a0-2 (-> v1-0 rv))) - (let ((a1-3 (-> obj rbody state position))) - (let ((a2-1 (-> v1-0 tm vector 2))) - (let ((a3-2 163840.0)) - (.mov vf7 a3-2) - ) - (.lvf vf5 (&-> a2-1 quad)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 (new 'stack-no-clear 'camera-free-floating-move-info))) + (let* ((a0-1 (-> v1-0 tm)) + (t0-0 (-> obj rbody state matrix)) + (a1-1 (-> t0-0 quad 0)) + (a2-0 (-> t0-0 quad 1)) + (a3-0 (-> t0-0 quad 2)) + (t0-1 (-> t0-0 trans quad)) + ) + (set! (-> a0-1 quad 0) a1-1) + (set! (-> a0-1 quad 1) a2-0) + (set! (-> a0-1 quad 2) a3-0) + (set! (-> a0-1 trans quad) t0-1) + ) + (let ((a0-2 (-> v1-0 rv))) + (let ((a1-3 (-> obj rbody state position))) + (let ((a2-1 (-> v1-0 tm vector 2))) + (let ((a3-2 163840.0)) + (.mov vf7 a3-2) ) - (.lvf vf4 (&-> a1-3 quad)) + (.lvf vf5 (&-> a2-1 quad)) ) - (.add.x.vf vf6 vf0 vf0 :mask #b1000) - (.mul.x.vf acc vf5 vf7 :mask #b111) - (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) - (.svf (&-> a0-2 quad) vf6) + (.lvf vf4 (&-> a1-3 quad)) ) - (vector-reset! (-> v1-0 up)) - (set! (-> obj turret inaccuracy) 0.0) - (turret-control-method-9 (-> obj turret) obj (-> v1-0 rv) (-> v1-0 up)) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a0-2 quad) vf6) ) - (when (cpad-hold? 0 r1) - (when (>= (- (-> pp clock frame-counter) (-> obj turret shoot-time)) (seconds 0.35)) - (set! (-> obj turret owner-handle) (process->handle *target*)) - (turret-control-method-17 (-> obj turret) obj) - (set! (-> obj turret owner-handle) (the-as handle #f)) - ) - ) - ((method-of-type vehicle vehicle-method-94) obj) - 0 - (none) + (vector-reset! (-> v1-0 up)) + (set! (-> obj turret inaccuracy) 0.0) + (turret-control-method-9 (-> obj turret) obj (-> v1-0 rv) (-> v1-0 up)) ) + (when (cpad-hold? 0 r1) + (when (>= (- (current-time) (-> obj turret shoot-time)) (seconds 0.35)) + (set! (-> obj turret owner-handle) (process->handle *target*)) + (turret-control-method-17 (-> obj turret) obj) + (set! (-> obj turret owner-handle) (the-as handle #f)) + ) + ) + ((method-of-type vehicle vehicle-method-94) obj) + 0 + (none) ) ) @@ -1269,10 +1251,9 @@ (go-virtual hostile) ) (speech-control-method-12 *speech-control* self (speech-type speech-type-2)) - (if (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 8)) - (let ((f0-0 409600.0)) - (< (* f0-0 f0-0) (-> self player-dist2)) - ) + (if (or (>= (- (current-time) (-> self state-time)) (seconds 8)) (let ((f0-0 409600.0)) + (< (* f0-0 f0-0) (-> self player-dist2)) + ) ) (logclear! (-> self flags) (rigid-body-object-flag persistent alert)) ) @@ -1302,9 +1283,9 @@ :post (behavior () (vehicle-guard-method-150 self) (when (logtest? (rigid-body-object-flag in-pursuit) (-> self flags)) - (if (or (>= (- (-> self clock frame-counter) (-> self target-in-sight-time)) (seconds 8)) + (if (or (>= (- (current-time) (-> self target-in-sight-time)) (seconds 8)) (and (>= (-> self controller traffic alert-state guards-in-sight-of-target) 2) - (>= (- (-> self clock frame-counter) (-> self target-in-sight-time)) (seconds 0.5)) + (>= (- (current-time) (-> self target-in-sight-time)) (seconds 0.5)) ) ) (vehicle-method-109 self) @@ -1379,7 +1360,7 @@ vehicle-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self ai-hook) (method-of-object self vehicle-guard-method-156)) (none) ) @@ -1393,7 +1374,7 @@ (when gp-0 (when (or (< (-> s5-0 attack-range) (-> s5-0 dist)) (not (logtest? (rigid-body-object-flag target-in-sight) (-> self flags))) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (>= (- (current-time) (-> self state-time)) (seconds 2)) ) (set! (-> self flags) (the-as rigid-body-object-flag (logclear (-> self flags) (rigid-body-object-flag rammed-target))) diff --git a/goal_src/jak2/levels/city/common/vehicle-states.gc b/goal_src/jak2/levels/city/common/vehicle-states.gc index 308c5165db..22a4e9d337 100644 --- a/goal_src/jak2/levels/city/common/vehicle-states.gc +++ b/goal_src/jak2/levels/city/common/vehicle-states.gc @@ -17,7 +17,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior vehicle) vehicle-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (rigid-body-object-method-39 self) (go-virtual waiting) (none) @@ -59,7 +59,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior vehicle) vehicle-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (vehicle-method-139 self) (set! (-> self flags) (logior (rigid-body-object-flag riding ai-driving) (-> self flags))) (vehicle-method-142 self) @@ -83,7 +83,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior vehicle) vehicle-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (vehicle-method-140 self) (set! (-> self flags) (the-as rigid-body-object-flag @@ -141,7 +141,7 @@ :event (the-as (function process int symbol event-message-block object :behavior vehicle) vehicle-event-handler) :enter (behavior () (set-setting! 'sound-flava #f 31.0 5) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (iterate-prims (-> self root-override-2) (lambda ((arg0 collide-shape-prim)) @@ -206,7 +206,7 @@ (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (not *target*) (go-virtual waiting) ) @@ -266,7 +266,7 @@ :event (the-as (function process int symbol event-message-block object :behavior vehicle) vehicle-event-handler) :enter (behavior () (logclear! (-> self flags) (rigid-body-object-flag player-driving)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (vehicle-method-129 self) (set! (-> self crash-level) 3) (vehicle-method-88 self) @@ -277,7 +277,7 @@ ) :trans (behavior () (set! (-> self hit-points) (- (-> self hit-points) (* 0.5 (-> self clock seconds-per-frame)))) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) 1) (< (-> self hit-points) -0.25)) + (if (and (>= (- (current-time) (-> self state-time)) 1) (< (-> self hit-points) -0.25)) (go-virtual explode) ) (none) @@ -301,13 +301,12 @@ (set! (-> self player-dist2) (vector-vector-distance-squared (-> self root-override-2 trans) (target-pos 0))) (cond ((logtest? (-> self draw status) (draw-control-status on-screen)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (else - (if (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) - (let ((f0-2 409600.0)) - (< (* f0-2 f0-2) (-> self camera-dist2)) - ) + (if (or (>= (- (current-time) (-> self state-time)) (seconds 5)) (let ((f0-2 409600.0)) + (< (* f0-2 f0-2) (-> self camera-dist2)) + ) ) (go-virtual die) ) @@ -332,7 +331,7 @@ (vehicle-method-121 self) (set! (-> self rbody state info) (-> self info-override info)) (when (logtest? (-> self flags) (rigid-body-object-flag disturbed)) - (let* ((f0-14 (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> self disturbed-time))))) + (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))) @@ -485,7 +484,7 @@ ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) ) diff --git a/goal_src/jak2/levels/city/common/vehicle-util.gc b/goal_src/jak2/levels/city/common/vehicle-util.gc index 43a77883ef..b61ca2a7bd 100644 --- a/goal_src/jak2/levels/city/common/vehicle-util.gc +++ b/goal_src/jak2/levels/city/common/vehicle-util.gc @@ -120,31 +120,29 @@ (defmethod vehicle-hud-chooser-method-9 vehicle-hud-chooser ((obj vehicle-hud-chooser) (arg0 handle) (arg1 float)) - (with-pp - (let ((s3-0 (-> pp clock frame-counter))) - (when (!= s3-0 (-> obj cur time)) - (if (zero? (-> obj cur time)) - (vehicle-hud-requests-method-9 (-> obj cur)) - ) - (mem-copy! (the-as pointer (-> obj last)) (the-as pointer (-> obj cur)) 72) - (set! (-> obj cur time) s3-0) - (vehicle-hud-requests-method-9 (-> obj cur)) - ) + (let ((s3-0 (current-time))) + (when (!= s3-0 (-> obj cur time)) + (if (zero? (-> obj cur time)) + (vehicle-hud-requests-method-9 (-> obj cur)) + ) + (mem-copy! (the-as pointer (-> obj last)) (the-as pointer (-> obj cur)) 72) + (set! (-> obj cur time) s3-0) + (vehicle-hud-requests-method-9 (-> obj cur)) ) - (let ((v1-10 (vehicle-hud-requests-method-11 (-> obj cur)))) - (when (< (-> v1-10 priority) arg1) - (set! (-> v1-10 handle) arg0) - (set! (-> v1-10 priority) arg1) - ) + ) + (let ((v1-10 (vehicle-hud-requests-method-11 (-> obj cur)))) + (when (< (-> v1-10 priority) arg1) + (set! (-> v1-10 handle) arg0) + (set! (-> v1-10 priority) arg1) ) - (let ((s4-1 #f)) - (let ((v1-12 (vehicle-hud-requests-method-10 (-> obj last)))) - (if (and (handle->process arg0) (= (-> v1-12 handle) arg0)) - (set! s4-1 #t) - ) - ) - s4-1 + ) + (let ((s4-1 #f)) + (let ((v1-12 (vehicle-hud-requests-method-10 (-> obj last)))) + (if (and (handle->process arg0) (= (-> v1-12 handle) arg0)) + (set! s4-1 #t) + ) ) + s4-1 ) ) @@ -723,26 +721,24 @@ This commonly includes things such as: ) (defmethod vehicle-method-76 vehicle ((obj vehicle) (arg0 int) (arg1 uint)) - (with-pp - (when (< (-> obj crash-level) arg0) - (set! (-> obj crash-level) arg0) - (set! (-> obj crash-duration) arg1) - (set! (-> obj crash-time) (-> pp clock frame-counter)) - (set! (-> obj force-scale) 0.0) - (when (>= (-> obj crash-level) 2) - (sound-play "bike-engine-off") - (vehicle-method-83 obj) - ) + (when (< (-> obj crash-level) arg0) + (set! (-> obj crash-level) arg0) + (set! (-> obj crash-duration) arg1) + (set! (-> obj crash-time) (current-time)) + (set! (-> obj force-scale) 0.0) + (when (>= (-> obj crash-level) 2) + (sound-play "bike-engine-off") + (vehicle-method-83 obj) ) - (when (and (>= 0.0 (-> obj hit-points)) (!= (-> obj crash-level) 3)) - (logior! (-> obj flags) (rigid-body-object-flag dead)) - (set! (-> obj crash-level) 3) - (set! (-> obj crash-duration) (the-as uint 1500)) - (set! (-> obj crash-time) (-> pp clock frame-counter)) - ) - 0 - (none) ) + (when (and (>= 0.0 (-> obj hit-points)) (!= (-> obj crash-level) 3)) + (logior! (-> obj flags) (rigid-body-object-flag dead)) + (set! (-> obj crash-level) 3) + (set! (-> obj crash-duration) (the-as uint 1500)) + (set! (-> obj crash-time) (current-time)) + ) + 0 + (none) ) (defmethod vehicle-method-77 vehicle ((obj vehicle)) @@ -752,28 +748,24 @@ This commonly includes things such as: ) (defmethod vehicle-method-78 vehicle ((obj vehicle) (arg0 int)) - (with-pp - (set! (-> obj flight-level-index-prev) (-> obj flight-level-index)) - (set! (-> obj flight-level-index) arg0) - (set! (-> obj flags) - (logior (rigid-body-object-flag flight-level-transition camera-rapid-track-mode) (-> obj flags)) - ) - (logclear! (-> obj flags) (rigid-body-object-flag flight-level-transition-ending)) - (set! (-> obj transition-time) (-> pp clock frame-counter)) - (vehicle-method-91 obj) - 0 - (none) - ) + (set! (-> obj flight-level-index-prev) (-> obj flight-level-index)) + (set! (-> obj flight-level-index) arg0) + (set! (-> obj flags) + (logior (rigid-body-object-flag flight-level-transition camera-rapid-track-mode) (-> obj flags)) + ) + (logclear! (-> obj flags) (rigid-body-object-flag flight-level-transition-ending)) + (set! (-> obj transition-time) (current-time)) + (vehicle-method-91 obj) + 0 + (none) ) (defmethod vehicle-method-79 vehicle ((obj vehicle)) - (with-pp - (logclear! (-> obj flags) (rigid-body-object-flag flight-level-transition)) - (set! (-> obj flags) (logior (rigid-body-object-flag flight-level-transition-ending) (-> obj flags))) - (set! (-> obj transition-end-time) (-> pp clock frame-counter)) - 0 - (none) - ) + (logclear! (-> obj flags) (rigid-body-object-flag flight-level-transition)) + (set! (-> obj flags) (logior (rigid-body-object-flag flight-level-transition-ending) (-> obj flags))) + (set! (-> obj transition-end-time) (current-time)) + 0 + (none) ) (defmethod vehicle-method-131 vehicle ((obj vehicle)) @@ -1292,74 +1284,72 @@ This commonly includes things such as: (defmethod vehicle-method-106 vehicle ((obj vehicle)) (local-vars (v1-13 float) (v1-25 float) (v1-30 float)) - (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (when (>= (- (-> pp clock frame-counter) (-> obj disturbed-time)) (seconds 2)) - (cond - ((logtest? (rigid-body-object-flag ai-driving) (-> obj flags)) - (when (and (not (logtest? (-> obj controller flags) (vehicle-controller-flag off-path))) - (>= (-> obj rbody state matrix vector 1 y) (cos 910.2222)) - ) - (.lvf vf1 (&-> (-> obj rbody state ang-velocity) quad)) - (.add.w.vf vf2 vf0 vf0 :mask #b1) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf acc vf2 vf1 :mask #b1) - (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) - (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) - (.mov v1-13 vf1) - (let ((f0-1 v1-13) - (f1-0 0.5) - ) - (if (< f0-1 (* f1-0 f1-0)) - (logclear! (-> obj flags) (rigid-body-object-flag disturbed)) - ) - ) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (when (>= (- (current-time) (-> obj disturbed-time)) (seconds 2)) + (cond + ((logtest? (rigid-body-object-flag ai-driving) (-> obj flags)) + (when (and (not (logtest? (-> obj controller flags) (vehicle-controller-flag off-path))) + (>= (-> obj rbody state matrix vector 1 y) (cos 910.2222)) + ) + (.lvf vf1 (&-> (-> obj rbody state ang-velocity) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-13 vf1) + (let ((f0-1 v1-13) + (f1-0 0.5) + ) + (if (< f0-1 (* f1-0 f1-0)) + (logclear! (-> obj flags) (rigid-body-object-flag disturbed)) + ) ) ) - (else - (when (>= (-> obj rbody state matrix vector 1 y) (cos 910.2222)) - (let* ((f0-3 (-> obj camera-dist2)) - (f1-3 0.000024414063) - (f0-4 (* f0-3 (* f1-3 f1-3))) - ) - (.lvf vf1 (&-> (-> obj rbody state ang-velocity) quad)) - (.add.w.vf vf2 vf0 vf0 :mask #b1) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf acc vf2 vf1 :mask #b1) - (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) - (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) - (.mov v1-25 vf1) - (when (and (< v1-25 f0-4) (begin - (.lvf vf1 (&-> (-> obj rbody state lin-velocity) quad)) - (.add.w.vf vf2 vf0 vf0 :mask #b1) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf acc vf2 vf1 :mask #b1) - (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) - (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) - (.mov v1-30 vf1) - (let ((f1-7 v1-30) - (f2-0 614.4) - ) - (< f1-7 (* f0-4 (* f2-0 f2-0))) - ) + ) + (else + (when (>= (-> obj rbody state matrix vector 1 y) (cos 910.2222)) + (let* ((f0-3 (-> obj camera-dist2)) + (f1-3 0.000024414063) + (f0-4 (* f0-3 (* f1-3 f1-3))) + ) + (.lvf vf1 (&-> (-> obj rbody state ang-velocity) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-25 vf1) + (when (and (< v1-25 f0-4) (begin + (.lvf vf1 (&-> (-> obj rbody state lin-velocity) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-30 vf1) + (let ((f1-7 v1-30) + (f2-0 614.4) + ) + (< f1-7 (* f0-4 (* f2-0 f2-0))) ) - ) - (logclear! (-> obj flags) (rigid-body-object-flag disturbed)) - (clear-momentum! (-> obj rbody state)) - ) + ) + ) + (logclear! (-> obj flags) (rigid-body-object-flag disturbed)) + (clear-momentum! (-> obj rbody state)) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ) diff --git a/goal_src/jak2/levels/city/common/vehicle.gc b/goal_src/jak2/levels/city/common/vehicle.gc index 22f50c1da9..0e7e0400d5 100644 --- a/goal_src/jak2/levels/city/common/vehicle.gc +++ b/goal_src/jak2/levels/city/common/vehicle.gc @@ -427,9 +427,9 @@ (seek! (-> obj force-scale) 1.0 (-> pp clock seconds-per-frame)) ) ((< (-> obj crash-level) 3) - (when (>= (- (-> pp clock frame-counter) (-> obj crash-time)) (the-as time-frame (-> obj crash-duration))) + (when (>= (- (current-time) (-> obj crash-time)) (the-as time-frame (-> obj crash-duration))) (if (or (>= (-> obj rbody state matrix vector 1 y) (cos 18204.445)) - (>= (- (-> pp clock frame-counter) (-> obj crash-time)) (seconds 3)) + (>= (- (current-time) (-> obj crash-time)) (seconds 3)) ) (vehicle-method-77 obj) ) @@ -476,12 +476,8 @@ ) ) (when (logtest? (rigid-body-object-flag turbo-boost) (-> obj flags)) - (if (or (>= (- (-> pp clock frame-counter) (-> obj turbo-boost-time)) - (the-as time-frame (-> obj turbo-boost-duration)) - ) - (and (>= (- (-> pp clock frame-counter) (-> obj turbo-boost-time)) (seconds 0.1)) - (>= (-> obj controls brake) 0.75) - ) + (if (or (>= (- (current-time) (-> obj turbo-boost-time)) (the-as time-frame (-> obj turbo-boost-duration))) + (and (>= (- (current-time) (-> obj turbo-boost-time)) (seconds 0.1)) (>= (-> obj controls brake) 0.75)) ) (logclear! (-> obj flags) (rigid-body-object-flag turbo-boost)) ) @@ -541,15 +537,15 @@ (logtest? (-> obj vehicle-jkhn1b23jn1) 1024) ) (set! (-> obj flags) (logior (rigid-body-object-flag hard-turn) (-> obj flags))) - (set! (-> obj turn-time) (-> pp clock frame-counter)) + (set! (-> obj turn-time) (current-time)) ) (if (or (not (logtest? (rigid-body-object-flag jump) (-> obj flags))) - (>= (- (-> pp clock frame-counter) (-> obj turn-time)) (seconds 1)) + (>= (- (current-time) (-> obj turn-time)) (seconds 1)) ) (logclear! (-> obj flags) (rigid-body-object-flag hard-turn)) ) (if (logtest? (-> obj flags) (rigid-body-object-flag on-ground on-flight-level)) - (set! (-> obj air-time) (-> pp clock frame-counter)) + (set! (-> obj air-time) (current-time)) ) (when (logtest? (rigid-body-object-flag flight-level-transition) (-> obj flags)) (if (or (and (> (-> obj flight-level-index) 0) @@ -560,15 +556,13 @@ ) (vehicle-method-79 obj) ) - (when (and (> (-> obj flight-level-index) 0) - (>= (- (-> pp clock frame-counter) (-> obj transition-time)) (seconds 2)) - ) + (when (and (> (-> obj flight-level-index) 0) (>= (- (current-time) (-> obj transition-time)) (seconds 2))) (vehicle-method-79 obj) (vehicle-method-83 obj) ) ) (when (and (logtest? (rigid-body-object-flag flight-level-transition-ending) (-> obj flags)) - (>= (- (-> pp clock frame-counter) (-> obj transition-end-time)) (seconds 1)) + (>= (- (current-time) (-> obj transition-end-time)) (seconds 1)) ) (logclear! (-> obj flags) (rigid-body-object-flag flight-level-transition-ending)) (vehicle-method-92 obj) @@ -609,9 +603,7 @@ ) (cond ((logtest? (-> obj flags) (rigid-body-object-flag in-air)) - (when (or (< 55296.0 (-> obj rbody state lin-velocity y)) - (>= (- (-> pp clock frame-counter) (-> obj air-time)) (seconds 0.75)) - ) + (when (or (< 55296.0 (-> obj rbody state lin-velocity y)) (>= (- (current-time) (-> obj air-time)) (seconds 0.75))) (set-setting! 'extra-follow-height 'abs (meters -4) 0) (send-event *camera* 'set-max-angle-offset (-> obj info-override camera-air-max-angle-offset)) ) @@ -978,25 +970,23 @@ ) (defmethod vehicle-method-121 vehicle ((obj vehicle)) - (with-pp - (if (>= (- (-> pp clock frame-counter) (-> obj player-touch-time)) (seconds 0.1)) - (logclear! (-> obj flags) (rigid-body-object-flag player-touching player-edge-grabbing player-standing-on)) - ) - (when (logtest? (-> obj flags) (rigid-body-object-flag player-touching)) - (detect-riders! (-> obj root-override-2)) - 0 - ) - (if (logtest? (-> obj flags) (rigid-body-object-flag player-touching player-driving)) - (logior! (-> obj skel status) (joint-control-status sync-math)) - (logclear! (-> obj skel status) (joint-control-status sync-math)) - ) - (vehicle-method-96 obj) - (let ((a1-0 (-> obj rbody state position))) - (set! (-> obj flight-level) (get-height-at-point *traffic-height-map* a1-0)) + (if (>= (- (current-time) (-> obj player-touch-time)) (seconds 0.1)) + (logclear! (-> obj flags) (rigid-body-object-flag player-touching player-edge-grabbing player-standing-on)) ) + (when (logtest? (-> obj flags) (rigid-body-object-flag player-touching)) + (detect-riders! (-> obj root-override-2)) 0 - (none) ) + (if (logtest? (-> obj flags) (rigid-body-object-flag player-touching player-driving)) + (logior! (-> obj skel status) (joint-control-status sync-math)) + (logclear! (-> obj skel status) (joint-control-status sync-math)) + ) + (vehicle-method-96 obj) + (let ((a1-0 (-> obj rbody state position))) + (set! (-> obj flight-level) (get-height-at-point *traffic-height-map* a1-0)) + ) + 0 + (none) ) (defmethod rigid-body-object-method-37 vehicle ((obj vehicle)) @@ -1090,106 +1080,104 @@ (defmethod vehicle-method-123 vehicle ((obj vehicle)) (local-vars (v1-4 symbol) (a0-21 int) (a0-23 int)) - (with-pp - (set! (-> obj camera-dist2) (vector-vector-distance-squared (-> obj root-override-2 trans) (camera-pos))) - (set! (-> obj player-dist2) (vector-vector-distance-squared (-> obj root-override-2 trans) (target-pos 0))) - (b! - (not (logtest? (rigid-body-object-flag traffic-managed) (-> obj flags))) - cfg-3 - :likely-delay (set! v1-4 #f) + (set! (-> obj camera-dist2) (vector-vector-distance-squared (-> obj root-override-2 trans) (camera-pos))) + (set! (-> obj player-dist2) (vector-vector-distance-squared (-> obj root-override-2 trans) (target-pos 0))) + (b! + (not (logtest? (rigid-body-object-flag traffic-managed) (-> obj flags))) + cfg-3 + :likely-delay (set! v1-4 #f) + ) + (set! v1-4 (not (logtest? (-> obj flags) (rigid-body-object-flag persistent)))) + (label cfg-3) + (b! (not v1-4) cfg-20 :delay (empty-form)) + (let ((f0-3 (fmin (-> obj player-dist2) (-> obj camera-dist2)))) + (let ((f1-1 819200.0)) + (b! (>= (* f1-1 f1-1) f0-3) cfg-8) ) - (set! v1-4 (not (logtest? (-> obj flags) (rigid-body-object-flag persistent)))) - (label cfg-3) - (b! (not v1-4) cfg-20 :delay (empty-form)) - (let ((f0-3 (fmin (-> obj player-dist2) (-> obj 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 obj) - ) - ) - (b! #t cfg-19 :delay (nop!)) - (label cfg-8) - (let ((f1-7 81920.0)) - (b! (>= (* f1-7 f1-7) f0-3) cfg-18) - ) - (b! (not (logtest? (-> obj draw status) (draw-control-status on-screen))) cfg-11 :delay (nop!)) - (set! (-> obj state-time) (-> pp clock frame-counter)) - (b! #t cfg-17 :delay (nop!)) - (label cfg-11) - (if (or (>= (- (-> pp clock frame-counter) (-> obj state-time)) (seconds 10)) (let ((f1-10 409600.0)) - (< (* f1-10 f1-10) f0-3) - ) - ) + (let ((f1-4 819200.0)) + (if (< (* f1-4 f1-4) f0-3) (vehicle-method-113 obj) ) ) - (label cfg-17) (b! #t cfg-19 :delay (nop!)) - (label cfg-18) - (set! (-> obj state-time) (-> pp clock frame-counter)) - (label cfg-19) - 0 - (label cfg-20) - (check-player-get-on obj) - (b! (not (logtest? (-> obj rbody state flags) (rigid-body-flag enable-physics))) cfg-24 :delay (nop!)) - (if (not (vehicle-method-105 obj)) - (rigid-body-object-method-39 obj) - ) - (b! #t cfg-26 :delay (nop!)) - (label cfg-24) - (if (vehicle-method-105 obj) - (rigid-body-object-method-38 obj) - ) - (label cfg-26) - (b! (not (logtest? (-> obj rbody state flags) (rigid-body-flag enable-physics))) cfg-31 :delay (nop!)) - (vector-reset! (-> obj target-acceleration)) - (when (logtest? (-> obj flags) (rigid-body-object-flag disturbed)) - (if (logtest? (-> obj flags) (rigid-body-object-flag in-air)) - (set! (-> obj disturbed-time) (-> pp clock frame-counter)) - ) + (label cfg-8) + (let ((f1-7 81920.0)) + (b! (>= (* f1-7 f1-7) f0-3) cfg-18) ) - (vehicle-method-121 obj) - (vehicle-method-106 obj) - (b! #t cfg-36 :delay (nop!)) - (label cfg-31) - (let* ((v1-65 (-> *perf-stats* data 20)) - (a0-18 (-> v1-65 ctrl)) - ) - (+! (-> v1-65 count) 1) - (b! (zero? a0-18) cfg-33 :delay (nop!)) - (.mtc0 Perf 0) - (.sync.l) - (.sync.p) - (.mtpc pcr0 0) - (.mtpc pcr1 0) - (.sync.l) - (.sync.p) - (.mtc0 Perf a0-18) + (b! (not (logtest? (-> obj draw status) (draw-control-status on-screen))) cfg-11 :delay (nop!)) + (set! (-> obj state-time) (current-time)) + (b! #t cfg-17 :delay (nop!)) + (label cfg-11) + (if (or (>= (- (current-time) (-> obj state-time)) (seconds 10)) (let ((f1-10 409600.0)) + (< (* f1-10 f1-10) f0-3) + ) + ) + (vehicle-method-113 obj) + ) + ) + (label cfg-17) + (b! #t cfg-19 :delay (nop!)) + (label cfg-18) + (set! (-> obj state-time) (current-time)) + (label cfg-19) + 0 + (label cfg-20) + (check-player-get-on obj) + (b! (not (logtest? (-> obj rbody state flags) (rigid-body-flag enable-physics))) cfg-24 :delay (nop!)) + (if (not (vehicle-method-105 obj)) + (rigid-body-object-method-39 obj) ) + (b! #t cfg-26 :delay (nop!)) + (label cfg-24) + (if (vehicle-method-105 obj) + (rigid-body-object-method-38 obj) + ) + (label cfg-26) + (b! (not (logtest? (-> obj rbody state flags) (rigid-body-flag enable-physics))) cfg-31 :delay (nop!)) + (vector-reset! (-> obj target-acceleration)) + (when (logtest? (-> obj flags) (rigid-body-object-flag disturbed)) + (if (logtest? (-> obj flags) (rigid-body-object-flag in-air)) + (set! (-> obj disturbed-time) (current-time)) + ) + ) + (vehicle-method-121 obj) + (vehicle-method-106 obj) + (b! #t cfg-36 :delay (nop!)) + (label cfg-31) + (let* ((v1-65 (-> *perf-stats* data 20)) + (a0-18 (-> v1-65 ctrl)) + ) + (+! (-> v1-65 count) 1) + (b! (zero? a0-18) cfg-33 :delay (nop!)) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (label cfg-33) - 0 - (vehicle-method-120 obj) - (let ((v1-70 (-> *perf-stats* data 20))) - (b! (zero? (-> v1-70 ctrl)) cfg-35 :delay (nop!)) - (.mtc0 Perf 0) - (.sync.l) - (.sync.p) - (.mfpc a0-21 pcr0) - (+! (-> v1-70 accum0) a0-21) - (.mfpc a0-23 pcr1) - (+! (-> v1-70 accum1) a0-23) - ) - (label cfg-35) - 0 - (label cfg-36) - 0 - (none) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf a0-18) ) + (.sync.l) + (.sync.p) + (label cfg-33) + 0 + (vehicle-method-120 obj) + (let ((v1-70 (-> *perf-stats* data 20))) + (b! (zero? (-> v1-70 ctrl)) cfg-35 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-21 pcr0) + (+! (-> v1-70 accum0) a0-21) + (.mfpc a0-23 pcr1) + (+! (-> v1-70 accum1) a0-23) + ) + (label cfg-35) + 0 + (label cfg-36) + 0 + (none) ) (defmethod vehicle-method-122 vehicle ((obj vehicle)) @@ -1495,154 +1483,152 @@ (defmethod rigid-body-object-method-47 vehicle ((obj vehicle) (arg0 process-drawable) (arg1 attack-info) (arg2 touching-shapes-entry) (arg3 penetrate)) (local-vars (f0-2 float) (sv-96 vector)) - (with-pp - (rlet ((vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'matrix))) - (rigid-body-object-method-49 obj (the-as rigid-body-impact s5-0) arg2) - (cond - ((logtest? (attack-info-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)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (new 'stack-no-clear 'matrix))) + (rigid-body-object-method-49 obj (the-as rigid-body-impact s5-0) arg2) + (cond + ((logtest? (attack-info-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) ) - (.mov.vf vf6 vf0 :mask #b1000) - (.sub.vf vf6 vf4 vf5 :mask #b111) - (.svf (&-> sv-96 quad) vf6) + (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)) ) - (else - (vector-! (-> s5-0 vector 2) (the-as vector (-> s5-0 vector)) (-> arg0 root trans)) - ) + (.mov.vf vf6 vf0 :mask #b1000) + (.sub.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> sv-96 quad) vf6) + ) + (else + (vector-! (-> s5-0 vector 2) (the-as vector (-> s5-0 vector)) (-> arg0 root trans)) ) ) ) ) - 0.0 - 0.0 - (let ((f1-0 (cond - ((= (-> arg1 mode) 'mine) - (set! f0-2 20480.0) - 0.2 - ) - ((or (logtest? (penetrate dark-giant) arg3) - (and (logtest? (-> arg1 mask) (attack-info-mask mode)) (= (-> arg1 mode) 'eco-dark)) - ) - (set! (-> s5-0 vector 2 y) (* 0.1 (-> s5-0 vector 2 y))) - (set! f0-2 (* 409600.0 (-> obj info-override info mass))) - (/ 0.4 (-> obj info-override damage-factor)) - ) - ((or (logtest? (penetrate dark-punch dark-bomb) arg3) - (and (logtest? (penetrate dark-skin) arg3) (logtest? arg3 (penetrate punch spin))) - ) - (set! f0-2 (* 204800.0 (-> obj info-override info mass))) - (/ 0.2 (-> obj info-override damage-factor)) - ) - ((logtest? (penetrate enemy-yellow-shot) arg3) - (set! f0-2 49152.0) - 0.025 - ) - ((logtest? (penetrate jak-yellow-shot) arg3) - (set! f0-2 98304.0) - 0.05 - ) - ((logtest? (penetrate jak-blue-shot) arg3) - (set! f0-2 196608.0) - 0.05 - ) - ((logtest? (penetrate jak-red-shot) arg3) - (set! f0-2 196608.0) - 0.05 - ) - ((logtest? (penetrate jak-dark-shot enemy-dark-shot) arg3) - (set! f0-2 393216.0) - 0.5 - ) - ((or (logtest? (penetrate explode) arg3) - (and (logtest? (-> arg1 mask) (attack-info-mask mode)) (case (-> arg1 mode) - (('explode 'grenade 'melt 'ice) - #t - ) - ) - ) - ) - (set! f0-2 122880.0) - 1.0 - ) - ((logtest? arg3 (penetrate punch)) - (set! f0-2 40960.0) - 0.1 - ) - ((logtest? arg3 (penetrate flop spin)) - (set! f0-2 20480.0) - 0.05 - ) - (else - (set! f0-2 8192.0) - 0.01 - ) + ) + 0.0 + 0.0 + (let ((f1-0 (cond + ((= (-> arg1 mode) 'mine) + (set! f0-2 20480.0) + 0.2 + ) + ((or (logtest? (penetrate dark-giant) arg3) + (and (logtest? (-> arg1 mask) (attack-info-mask mode)) (= (-> arg1 mode) 'eco-dark)) + ) + (set! (-> s5-0 vector 2 y) (* 0.1 (-> s5-0 vector 2 y))) + (set! f0-2 (* 409600.0 (-> obj info-override info mass))) + (/ 0.4 (-> obj info-override damage-factor)) + ) + ((or (logtest? (penetrate dark-punch dark-bomb) arg3) + (and (logtest? (penetrate dark-skin) arg3) (logtest? arg3 (penetrate punch spin))) + ) + (set! f0-2 (* 204800.0 (-> obj info-override info mass))) + (/ 0.2 (-> obj info-override damage-factor)) + ) + ((logtest? (penetrate enemy-yellow-shot) arg3) + (set! f0-2 49152.0) + 0.025 + ) + ((logtest? (penetrate jak-yellow-shot) arg3) + (set! f0-2 98304.0) + 0.05 + ) + ((logtest? (penetrate jak-blue-shot) arg3) + (set! f0-2 196608.0) + 0.05 + ) + ((logtest? (penetrate jak-red-shot) arg3) + (set! f0-2 196608.0) + 0.05 + ) + ((logtest? (penetrate jak-dark-shot enemy-dark-shot) arg3) + (set! f0-2 393216.0) + 0.5 + ) + ((or (logtest? (penetrate explode) arg3) + (and (logtest? (-> arg1 mask) (attack-info-mask mode)) (case (-> arg1 mode) + (('explode 'grenade 'melt 'ice) + #t + ) + ) + ) + ) + (set! f0-2 122880.0) + 1.0 + ) + ((logtest? arg3 (penetrate punch)) + (set! f0-2 40960.0) + 0.1 + ) + ((logtest? arg3 (penetrate flop spin)) + (set! f0-2 20480.0) + 0.05 + ) + (else + (set! f0-2 8192.0) + 0.01 ) ) - ) - (set! (-> s5-0 trans x) f0-2) - (apply-damage obj (* 0.667 f1-0) (the-as rigid-body-impact s5-0)) - ) - (rigid-body-object-method-42 obj) - (let ((s3-1 (new 'stack-no-clear 'vector))) - (set! (-> s3-1 quad) (-> s5-0 vector 2 quad)) - (vector-normalize! s3-1 1.0) - (vector-float*! s3-1 s3-1 (-> s5-0 trans x)) - (let ((v1-90 (-> obj rbody)) - (a1-11 (-> s5-0 vector)) - (a2-3 s3-1) - ) - (rigid-body-method-18 (-> v1-90 state) (the-as vector a1-11) a2-3) + ) ) - (let ((v1-93 (-> obj rbody)) - (f0-10 1.0) - ) - (rigid-body-method-12 (-> v1-93 state) f0-10) - ) - (rigid-body-method-13 (-> obj rbody state)) - (when #f - (set! (-> *debug-vehicle-work* impact-time) (-> pp clock frame-counter)) - (mem-copy! (the-as pointer (-> *debug-vehicle-work* impact)) (the-as pointer s5-0) 64) - (let ((v1-103 (-> arg2 head))) - (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* - ) - ) - ) - (rigid-body-object-method-45 obj (the-as rigid-body-impact s5-0)) + (set! (-> s5-0 trans x) f0-2) + (apply-damage obj (* 0.667 f1-0) (the-as rigid-body-impact s5-0)) ) - (if (and (-> obj next-state) (= (-> obj next-state name) 'idle)) - (go (method-of-object obj waiting)) + (rigid-body-object-method-42 obj) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (set! (-> s3-1 quad) (-> s5-0 vector 2 quad)) + (vector-normalize! s3-1 1.0) + (vector-float*! s3-1 s3-1 (-> s5-0 trans x)) + (let ((v1-90 (-> obj rbody)) + (a1-11 (-> s5-0 vector)) + (a2-3 s3-1) + ) + (rigid-body-method-18 (-> v1-90 state) (the-as vector a1-11) a2-3) ) - #t + (let ((v1-93 (-> obj rbody)) + (f0-10 1.0) + ) + (rigid-body-method-12 (-> v1-93 state) f0-10) + ) + (rigid-body-method-13 (-> obj rbody state)) + (when #f + (set! (-> *debug-vehicle-work* impact-time) (current-time)) + (mem-copy! (the-as pointer (-> *debug-vehicle-work* impact)) (the-as pointer s5-0) 64) + (let ((v1-103 (-> arg2 head))) + (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* + ) + ) + ) + (rigid-body-object-method-45 obj (the-as rigid-body-impact s5-0)) ) + (if (and (-> obj next-state) (= (-> obj next-state name) 'idle)) + (go (method-of-object obj waiting)) + ) + #t ) ) @@ -1690,8 +1676,8 @@ (set! v1-30 (!= arg0 *target*)) (label cfg-13) (b! (not v1-30) cfg-25 :delay (empty-form)) - (when (>= (- (-> pp clock frame-counter) (-> obj sent-attack-time)) (seconds 0.5)) - (set! (-> obj sent-attack-time) (-> pp clock frame-counter)) + (when (>= (- (current-time) (-> obj sent-attack-time)) (seconds 0.5)) + (set! (-> obj sent-attack-time) (current-time)) (let* ((v1-39 *game-info*) (a0-18 (+ (-> v1-39 attack-id) 1)) ) @@ -1740,7 +1726,7 @@ ) (rigid-body-method-13 (-> obj rbody state)) (when #f - (set! (-> *debug-vehicle-work* impact-time) (-> pp clock frame-counter)) + (set! (-> *debug-vehicle-work* impact-time) (current-time)) (mem-copy! (the-as pointer (-> *debug-vehicle-work* impact)) (the-as pointer s5-0) 64) (let ((v1-73 (-> arg1 head))) (set! (-> *debug-vehicle-work* prim-sphere1 quad) (-> v1-73 prim1 cprim prim-core world-sphere quad)) @@ -1847,7 +1833,7 @@ ) ((= v1-19 'turbo-ring) (set! (-> obj turbo-boost-factor) (the-as float (-> arg3 param 0))) - (set! (-> obj turbo-boost-time) (-> self clock frame-counter)) + (set! (-> obj turbo-boost-time) (current-time)) (set! (-> obj turbo-boost-duration) (the-as uint 75)) (set! (-> obj flags) (logior (rigid-body-object-flag turbo-boost) (-> obj flags))) (if (logtest? (-> obj flags) (rigid-body-object-flag player-driving)) diff --git a/goal_src/jak2/levels/city/farm/ctyfarm-obs.gc b/goal_src/jak2/levels/city/farm/ctyfarm-obs.gc index d2f68d9d4e..7598597a5d 100644 --- a/goal_src/jak2/levels/city/farm/ctyfarm-obs.gc +++ b/goal_src/jak2/levels/city/farm/ctyfarm-obs.gc @@ -901,21 +901,19 @@ ;; WARN: Return type mismatch float vs none. (defmethod shaker-method-9 shaker ((obj shaker)) - (with-pp - (let ((s5-0 (- (-> pp clock frame-counter) (-> obj start-time)))) - (set! (-> obj shake) (* (-> obj amplitude) - (lerp-scale 1.0 0.0 (the float s5-0) 0.0 (-> obj decay-time)) - (cos (* 65536.0 (/ (the float s5-0) (-> obj freq)))) + (let ((s5-0 (- (current-time) (-> obj start-time)))) + (set! (-> obj shake) (* (-> obj amplitude) + (lerp-scale 1.0 0.0 (the float s5-0) 0.0 (-> obj decay-time)) + (cos (* 65536.0 (/ (the float s5-0) (-> obj freq)))) + ) + ) + (set! (-> obj y-shake) (* (-> obj y-amplitude) + (lerp-scale 1.0 0.0 (the float s5-0) 0.0 (-> obj y-decay-time)) + (cos (* 65536.0 (/ (the float s5-0) (-> obj y-freq)))) ) - ) - (set! (-> obj y-shake) (* (-> obj y-amplitude) - (lerp-scale 1.0 0.0 (the float s5-0) 0.0 (-> obj y-decay-time)) - (cos (* 65536.0 (/ (the float s5-0) (-> obj y-freq)))) - ) - ) - ) - (none) + ) ) + (none) ) ;; WARN: Return type mismatch int vs knocked-type. @@ -995,27 +993,23 @@ (defun farm-marrow-callback ((arg0 cspace) (arg1 transformq)) - (with-pp - (let ((s4-0 (the-as farm-marrow (-> arg0 param1))) - (s3-0 (the-as int (-> arg0 param2))) - ) - (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! - (new 'stack-no-clear 'quaternion) - (the-as vector (-> s4-0 shakers s3-0)) - (-> s4-0 shakers s3-0 shake) - ) - ) - (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) - (if (< (the int (-> s4-0 shakers s3-0 decay-time)) - (- (-> pp clock frame-counter) (-> s4-0 shakers s3-0 start-time)) - ) - (set! (-> arg0 param0) #f) - ) - ) - (cspace<-parented-transformq-joint! arg0 arg1) - 0 - (none) + (let ((s4-0 (the-as farm-marrow (-> arg0 param1))) + (s3-0 (the-as int (-> arg0 param2))) + ) + (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (the-as vector (-> s4-0 shakers s3-0)) + (-> s4-0 shakers s3-0 shake) + ) + ) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) + (if (< (the int (-> s4-0 shakers s3-0 decay-time)) (- (current-time) (-> s4-0 shakers s3-0 start-time))) + (set! (-> arg0 param0) #f) + ) ) + (cspace<-parented-transformq-joint! arg0 arg1) + 0 + (none) ) (defstate die (farm-marrow) @@ -1071,7 +1065,7 @@ ) (let ((v1-10 (-> self shakers))) (set! (-> v1-10 0 axis quad) (-> gp-4 quad)) - (set! (-> v1-10 0 start-time) (-> self clock frame-counter)) + (set! (-> v1-10 0 start-time) (current-time)) (set! (-> v1-10 0 decay-time) 300.0) (set! (-> v1-10 0 freq) 150.0) (set! (-> v1-10 0 amplitude) 1820.4445) @@ -1084,7 +1078,7 @@ ) (let ((v1-13 (-> self shakers 1))) (set! (-> v1-13 axis quad) (-> gp-4 quad)) - (set! (-> v1-13 start-time) (+ (-> self clock frame-counter) (seconds -0.06))) + (set! (-> v1-13 start-time) (+ (current-time) (seconds -0.06))) (set! (-> v1-13 decay-time) 450.0) (set! (-> v1-13 freq) 150.0) (set! (-> v1-13 amplitude) 1820.4445) @@ -1097,7 +1091,7 @@ ) (let ((v1-16 (-> self shakers 2))) (set! (-> v1-16 axis quad) (-> gp-4 quad)) - (set! (-> v1-16 start-time) (+ (-> self clock frame-counter) (seconds -0.12))) + (set! (-> v1-16 start-time) (+ (current-time) (seconds -0.12))) (set! (-> v1-16 decay-time) 600.0) (set! (-> v1-16 freq) 150.0) (set! (-> v1-16 amplitude) 1820.4445) @@ -1110,7 +1104,7 @@ ) (let ((v1-19 (-> self shakers 3))) (set! (-> v1-19 axis quad) (-> gp-4 quad)) - (set! (-> v1-19 start-time) (+ (-> self clock frame-counter) (seconds -0.06))) + (set! (-> v1-19 start-time) (+ (current-time) (seconds -0.06))) (set! (-> v1-19 decay-time) 300.0) (set! (-> v1-19 freq) 150.0) (set! (-> v1-19 amplitude) 910.2222) @@ -1125,7 +1119,7 @@ ) (let ((v1-22 (-> self shakers 4))) (set! (-> v1-22 axis quad) (-> gp-4 quad)) - (set! (-> v1-22 start-time) (+ (-> self clock frame-counter) (seconds -0.12))) + (set! (-> v1-22 start-time) (+ (current-time) (seconds -0.12))) (set! (-> v1-22 decay-time) 600.0) (set! (-> v1-22 freq) 150.0) (set! (-> v1-22 amplitude) 910.2222) @@ -1299,27 +1293,23 @@ This commonly includes things such as: (defun farm-beetree-callback ((arg0 cspace) (arg1 transformq)) - (with-pp - (let ((s4-0 (the-as farm-beetree (-> arg0 param1))) - (s3-0 (the-as int (-> arg0 param2))) - ) - (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! - (new 'stack-no-clear 'quaternion) - (the-as vector (-> s4-0 shakers s3-0)) - (-> s4-0 shakers s3-0 shake) - ) - ) - (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) - (if (< (the int (-> s4-0 shakers s3-0 decay-time)) - (- (-> pp clock frame-counter) (-> s4-0 shakers s3-0 start-time)) - ) - (set! (-> arg0 param0) #f) - ) - ) - (cspace<-parented-transformq-joint! arg0 arg1) - 0 - (none) + (let ((s4-0 (the-as farm-beetree (-> arg0 param1))) + (s3-0 (the-as int (-> arg0 param2))) + ) + (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (the-as vector (-> s4-0 shakers s3-0)) + (-> s4-0 shakers s3-0 shake) + ) + ) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) + (if (< (the int (-> s4-0 shakers s3-0 decay-time)) (- (current-time) (-> s4-0 shakers s3-0 start-time))) + (set! (-> arg0 param0) #f) + ) ) + (cspace<-parented-transformq-joint! arg0 arg1) + 0 + (none) ) (defstate die (farm-beetree) @@ -1375,7 +1365,7 @@ This commonly includes things such as: ) (let ((v1-10 (-> self shakers))) (set! (-> v1-10 0 axis quad) (-> gp-4 quad)) - (set! (-> v1-10 0 start-time) (-> self clock frame-counter)) + (set! (-> v1-10 0 start-time) (current-time)) (set! (-> v1-10 0 decay-time) 300.0) (set! (-> v1-10 0 freq) 150.0) (set! (-> v1-10 0 amplitude) 1820.4445) @@ -1388,7 +1378,7 @@ This commonly includes things such as: ) (let ((v1-13 (-> self shakers 1))) (set! (-> v1-13 axis quad) (-> gp-4 quad)) - (set! (-> v1-13 start-time) (+ (-> self clock frame-counter) (seconds -0.06))) + (set! (-> v1-13 start-time) (+ (current-time) (seconds -0.06))) (set! (-> v1-13 decay-time) 600.0) (set! (-> v1-13 freq) 150.0) (set! (-> v1-13 amplitude) 364.0889) @@ -1557,27 +1547,23 @@ This commonly includes things such as: (defun farm-cabbage-callback ((arg0 cspace) (arg1 transformq)) - (with-pp - (let ((s4-0 (the-as farm-cabbage (-> arg0 param1))) - (s3-0 (the-as int (-> arg0 param2))) - ) - (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! - (new 'stack-no-clear 'quaternion) - (the-as vector (-> s4-0 shakers s3-0)) - (-> s4-0 shakers s3-0 shake) - ) - ) - (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) - (if (< (the int (-> s4-0 shakers s3-0 decay-time)) - (- (-> pp clock frame-counter) (-> s4-0 shakers s3-0 start-time)) - ) - (set! (-> arg0 param0) #f) - ) - ) - (cspace<-parented-transformq-joint! arg0 arg1) - 0 - (none) + (let ((s4-0 (the-as farm-cabbage (-> arg0 param1))) + (s3-0 (the-as int (-> arg0 param2))) + ) + (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (the-as vector (-> s4-0 shakers s3-0)) + (-> s4-0 shakers s3-0 shake) + ) + ) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) + (if (< (the int (-> s4-0 shakers s3-0 decay-time)) (- (current-time) (-> s4-0 shakers s3-0 start-time))) + (set! (-> arg0 param0) #f) + ) ) + (cspace<-parented-transformq-joint! arg0 arg1) + 0 + (none) ) (defstate die (farm-cabbage) @@ -1633,7 +1619,7 @@ This commonly includes things such as: ) (let ((v1-10 (-> self shakers))) (set! (-> v1-10 0 axis quad) (-> gp-4 quad)) - (set! (-> v1-10 0 start-time) (-> self clock frame-counter)) + (set! (-> v1-10 0 start-time) (current-time)) (set! (-> v1-10 0 decay-time) 300.0) (set! (-> v1-10 0 freq) 150.0) (set! (-> v1-10 0 amplitude) 1820.4445) @@ -1646,7 +1632,7 @@ This commonly includes things such as: ) (let ((v1-13 (-> self shakers 1))) (set! (-> v1-13 axis quad) (-> gp-4 quad)) - (set! (-> v1-13 start-time) (+ (-> self clock frame-counter) (seconds -0.06))) + (set! (-> v1-13 start-time) (+ (current-time) (seconds -0.06))) (set! (-> v1-13 decay-time) 600.0) (set! (-> v1-13 freq) 150.0) (set! (-> v1-13 amplitude) 364.0889) @@ -1817,27 +1803,23 @@ This commonly includes things such as: (defun farm-small-cabbage-callback ((arg0 cspace) (arg1 transformq)) - (with-pp - (let ((s4-0 (the-as farm-small-cabbage (-> arg0 param1))) - (s3-0 (the-as int (-> arg0 param2))) - ) - (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! - (new 'stack-no-clear 'quaternion) - (the-as vector (-> s4-0 shakers s3-0)) - (-> s4-0 shakers s3-0 shake) - ) - ) - (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) - (if (< (the int (-> s4-0 shakers s3-0 decay-time)) - (- (-> pp clock frame-counter) (-> s4-0 shakers s3-0 start-time)) - ) - (set! (-> arg0 param0) #f) - ) - ) - (cspace<-parented-transformq-joint! arg0 arg1) - 0 - (none) + (let ((s4-0 (the-as farm-small-cabbage (-> arg0 param1))) + (s3-0 (the-as int (-> arg0 param2))) + ) + (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (the-as vector (-> s4-0 shakers s3-0)) + (-> s4-0 shakers s3-0 shake) + ) + ) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) + (if (< (the int (-> s4-0 shakers s3-0 decay-time)) (- (current-time) (-> s4-0 shakers s3-0 start-time))) + (set! (-> arg0 param0) #f) + ) ) + (cspace<-parented-transformq-joint! arg0 arg1) + 0 + (none) ) (defstate die (farm-small-cabbage) @@ -1893,7 +1875,7 @@ This commonly includes things such as: ) (let ((v1-10 (-> self shakers))) (set! (-> v1-10 0 axis quad) (-> gp-4 quad)) - (set! (-> v1-10 0 start-time) (-> self clock frame-counter)) + (set! (-> v1-10 0 start-time) (current-time)) (set! (-> v1-10 0 decay-time) 300.0) (set! (-> v1-10 0 freq) 150.0) (set! (-> v1-10 0 amplitude) 910.2222) @@ -2062,27 +2044,23 @@ This commonly includes things such as: (defun farm-chilirots-callback ((arg0 cspace) (arg1 transformq)) - (with-pp - (let ((s4-0 (the-as farm-chilirots (-> arg0 param1))) - (s3-0 (the-as int (-> arg0 param2))) - ) - (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! - (new 'stack-no-clear 'quaternion) - (the-as vector (-> s4-0 shakers s3-0)) - (-> s4-0 shakers s3-0 shake) - ) - ) - (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) - (if (< (the int (-> s4-0 shakers s3-0 decay-time)) - (- (-> pp clock frame-counter) (-> s4-0 shakers s3-0 start-time)) - ) - (set! (-> arg0 param0) #f) - ) - ) - (cspace<-parented-transformq-joint! arg0 arg1) - 0 - (none) + (let ((s4-0 (the-as farm-chilirots (-> arg0 param1))) + (s3-0 (the-as int (-> arg0 param2))) + ) + (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (the-as vector (-> s4-0 shakers s3-0)) + (-> s4-0 shakers s3-0 shake) + ) + ) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) + (if (< (the int (-> s4-0 shakers s3-0 decay-time)) (- (current-time) (-> s4-0 shakers s3-0 start-time))) + (set! (-> arg0 param0) #f) + ) ) + (cspace<-parented-transformq-joint! arg0 arg1) + 0 + (none) ) (defstate die (farm-chilirots) @@ -2138,7 +2116,7 @@ This commonly includes things such as: ) (let ((v1-10 (-> self shakers))) (set! (-> v1-10 0 axis quad) (-> gp-4 quad)) - (set! (-> v1-10 0 start-time) (-> self clock frame-counter)) + (set! (-> v1-10 0 start-time) (current-time)) (set! (-> v1-10 0 decay-time) 300.0) (set! (-> v1-10 0 freq) 150.0) (set! (-> v1-10 0 amplitude) 1820.4445) @@ -2151,7 +2129,7 @@ This commonly includes things such as: ) (let ((v1-13 (-> self shakers 1))) (set! (-> v1-13 axis quad) (-> gp-4 quad)) - (set! (-> v1-13 start-time) (+ (-> self clock frame-counter) (seconds -0.06))) + (set! (-> v1-13 start-time) (+ (current-time) (seconds -0.06))) (set! (-> v1-13 decay-time) 450.0) (set! (-> v1-13 freq) 150.0) (set! (-> v1-13 amplitude) 1820.4445) @@ -2166,7 +2144,7 @@ This commonly includes things such as: ) (let ((v1-16 (-> self shakers 2))) (set! (-> v1-16 axis quad) (-> gp-4 quad)) - (set! (-> v1-16 start-time) (+ (-> self clock frame-counter) (seconds -0.12))) + (set! (-> v1-16 start-time) (+ (current-time) (seconds -0.12))) (set! (-> v1-16 decay-time) 600.0) (set! (-> v1-16 freq) 150.0) (set! (-> v1-16 amplitude) 1820.4445) @@ -2181,7 +2159,7 @@ This commonly includes things such as: ) (let ((v1-19 (-> self shakers 3))) (set! (-> v1-19 axis quad) (-> gp-4 quad)) - (set! (-> v1-19 start-time) (+ (-> self clock frame-counter) (seconds -0.18))) + (set! (-> v1-19 start-time) (+ (current-time) (seconds -0.18))) (set! (-> v1-19 decay-time) 750.0) (set! (-> v1-19 freq) 150.0) (set! (-> v1-19 amplitude) 1820.4445) diff --git a/goal_src/jak2/levels/city/farm/yakow.gc b/goal_src/jak2/levels/city/farm/yakow.gc index 2bf696afe5..9b7f7ef0be 100644 --- a/goal_src/jak2/levels/city/farm/yakow.gc +++ b/goal_src/jak2/levels/city/farm/yakow.gc @@ -296,7 +296,7 @@ ) :post (behavior () (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (-> self clock frame-counter)) + (set! (-> self last-draw-time) (current-time)) ) (enemy-method-129 self) (ja-post) @@ -307,7 +307,7 @@ (defstate active (yakow) :virtual #t :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (< (the-as int (-> self focus aware)) 1) (go-virtual idle) ) @@ -431,7 +431,7 @@ (set! (-> v1-0 nav callback-info) *nav-enemy-null-callback-info*) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () diff --git a/goal_src/jak2/levels/city/kid_escort/crocesc-states.gc b/goal_src/jak2/levels/city/kid_escort/crocesc-states.gc index 55158e8349..907627b416 100644 --- a/goal_src/jak2/levels/city/kid_escort/crocesc-states.gc +++ b/goal_src/jak2/levels/city/kid_escort/crocesc-states.gc @@ -14,7 +14,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -175,7 +175,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -233,7 +233,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -260,12 +260,10 @@ ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) (go-idle-or-move self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -301,7 +299,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -331,12 +329,10 @@ (logclear! (-> self bot-flags) (bot-flags bf15)) (go-idle-or-move self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -398,7 +394,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -575,7 +571,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -661,7 +657,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -831,7 +827,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -849,7 +845,7 @@ ) :trans (behavior () (bot-method-223 self #f) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) (go-virtual traveling) ) (none) @@ -875,7 +871,7 @@ ) :trans (behavior () (bot-method-223 self #f) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (not (nav-enemy-method-163 self)) (go-virtual traveling) ) @@ -955,7 +951,7 @@ 0.0 (until #f (if (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (>= (- (current-time) (-> self state-time)) (seconds 3)) (reset? *fail-mission-control*) ) (reset! *fail-mission-control*) @@ -1003,7 +999,7 @@ (defstate failed (crocadog-escort) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1022,7 +1018,7 @@ (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (when (not (logtest? (bot-flags bf19) (-> self bot-flags))) (set! (-> self bot-flags) (logior (bot-flags bf19) (-> self bot-flags))) (fail-mission! self) @@ -1041,7 +1037,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) diff --git a/goal_src/jak2/levels/city/kid_escort/hal4-course.gc b/goal_src/jak2/levels/city/kid_escort/hal4-course.gc index ca1224a39e..a9b2b0c9c8 100644 --- a/goal_src/jak2/levels/city/kid_escort/hal4-course.gc +++ b/goal_src/jak2/levels/city/kid_escort/hal4-course.gc @@ -80,25 +80,23 @@ (defmethod general-event-handler hal-escort ((obj 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" - (with-pp - (case arg2 - (('notify) - (case (-> arg3 param 0) - (('arrest) - (set! (-> obj arrestor-handle) (process->handle (the-as process (-> arg3 param 1)))) - (let ((v0-0 (the-as object (-> pp clock frame-counter)))) - (set! (-> obj arrestor-time) (the-as time-frame v0-0)) - v0-0 - ) + (case arg2 + (('notify) + (case (-> arg3 param 0) + (('arrest) + (set! (-> obj arrestor-handle) (process->handle (the-as process (-> arg3 param 1)))) + (let ((v0-0 (the-as object (current-time)))) + (set! (-> obj arrestor-time) (the-as time-frame v0-0)) + v0-0 ) - (else - ((method-of-type hal general-event-handler) obj arg0 arg1 arg2 arg3) - ) + ) + (else + ((method-of-type hal general-event-handler) obj arg0 arg1 arg2 arg3) ) ) - (else - ((method-of-type hal general-event-handler) obj arg0 arg1 arg2 arg3) - ) + ) + (else + ((method-of-type hal general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -114,50 +112,48 @@ ) (defmethod hal-escort-method-235 hal-escort ((obj hal-escort)) - (with-pp - (let* ((s5-0 (handle->process (-> obj arrestor-handle))) - (v1-3 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) - (when v1-3 - (cond - ((>= (- (-> pp clock frame-counter) (-> obj arrestor-time)) (seconds 4)) - (set! (-> obj arrestor-handle) (the-as handle #f)) - ) - ((focus-test? (the-as process-focusable v1-3) hit) - (when (and (>= (- (-> pp clock frame-counter) (-> obj played-defend-time)) (seconds 6)) - (not (channel-active? obj (the-as uint 0))) - ) - (let ((a1-5 (bot-speech-list-method-9 - (-> obj hal4-course defend-speeches) - obj - (-> obj hal4-course speeches) - (speech-flags) - ) - ) + (let* ((s5-0 (handle->process (-> obj arrestor-handle))) + (v1-3 (if (type? s5-0 process-focusable) + s5-0 ) - (when (>= a1-5 0) - (play-speech obj a1-5) - (set! (-> obj played-defend-time) (-> pp clock frame-counter)) + ) + ) + (when v1-3 + (cond + ((>= (- (current-time) (-> obj arrestor-time)) (seconds 4)) + (set! (-> obj arrestor-handle) (the-as handle #f)) + ) + ((focus-test? (the-as process-focusable v1-3) hit) + (when (and (>= (- (current-time) (-> obj played-defend-time)) (seconds 6)) + (not (channel-active? obj (the-as uint 0))) + ) + (let ((a1-5 (bot-speech-list-method-9 + (-> obj hal4-course defend-speeches) + obj + (-> obj hal4-course speeches) + (speech-flags) + ) + ) ) + (when (>= a1-5 0) + (play-speech obj a1-5) + (set! (-> obj played-defend-time) (current-time)) ) ) - (set! (-> obj arrestor-handle) (the-as handle #f)) ) - ) + (set! (-> obj arrestor-handle) (the-as handle #f)) + ) ) ) - (if (and (not (speech-playing? obj 30)) - (nonzero? (-> obj played-defend-time)) - (>= (- (-> pp clock frame-counter) (-> obj played-defend-time)) (seconds 3)) - (not (channel-active? obj (the-as uint 0))) - ) - (play-speech obj 30) - ) - (none) ) + (if (and (not (speech-playing? obj 30)) + (nonzero? (-> obj played-defend-time)) + (>= (- (current-time) (-> obj played-defend-time)) (seconds 3)) + (not (channel-active? obj (the-as uint 0))) + ) + (play-speech obj 30) + ) + (none) ) (defmethod vehicle-destroyed? hal-escort ((obj hal-escort)) @@ -167,38 +163,36 @@ ) (defmethod hal-escort-method-227 hal-escort ((obj hal-escort)) - (with-pp - (let ((s5-0 *target*)) - (when (focus-test? s5-0 pilot-riding pilot) - (let* ((a0-2 (-> obj 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 - ) - ) + (let ((s5-0 *target*)) + (when (focus-test? s5-0 pilot-riding pilot) + (let* ((a0-2 (-> obj 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 + ) ) ) - ) - (when (focus-test? (the-as process-focusable v1-5) pilot-riding pilot) - (let* ((v1-12 (-> obj 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 - ) - ) + ) + ) + (when (focus-test? (the-as process-focusable v1-5) pilot-riding pilot) + (let* ((v1-12 (-> obj 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 + ) ) ) - ) - (when (not (focus-test? (the-as process-focusable a0-5) pilot-riding pilot)) - (let ((f0-0 245760.0)) - (and (< (* f0-0 f0-0) - (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-5) 0) (get-trans s5-0 0)) - ) - (>= (-> pp clock frame-counter) (-> obj dont-fail-until)) ) - ) + ) + (when (not (focus-test? (the-as process-focusable a0-5) pilot-riding pilot)) + (let ((f0-0 245760.0)) + (and (< (* f0-0 f0-0) + (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-5) 0) (get-trans s5-0 0)) + ) + (>= (current-time) (-> obj dont-fail-until)) + ) ) ) ) @@ -210,32 +204,30 @@ ;; WARN: Return type mismatch object vs symbol. (defmethod hal-escort-method-228 hal-escort ((obj hal-escort)) - (with-pp - (let* ((v1-3 (-> obj 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 - ) - ) + (let* ((v1-3 (-> obj 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 + ) ) ) - (s5-1 *target*) - ) - (the-as - 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)) - ) - (>= (-> pp clock frame-counter) (-> obj dont-fail-until)) - ) - ) + ) + (s5-1 *target*) + ) + (the-as + 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) (-> obj dont-fail-until)) + ) ) - ) - ) + ) + ) ) ) ) @@ -340,60 +332,58 @@ ) (defmethod hal-escort-method-232 hal-escort ((obj hal-escort)) - (with-pp - (let* ((target *target*) - (v1-3 (-> obj 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 - ) - ) + (let* ((target *target*) + (v1-3 (-> obj 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 + ) ) ) - (a0-2 (-> obj 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 - ) - ) + ) + (a0-2 (-> obj 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 + ) ) ) + ) + ) + (when target + (cond + ((not (-> *setting-control* user-current pilot-exit)) + (when (and s5-0 + v1-8 + (not (focus-test? (the-as process-focusable s5-0) pilot-riding)) + (not (focus-test? (the-as process-focusable v1-8) pilot-riding)) + (>= (- (current-time) (-> obj locked-player-time)) (seconds 10)) + ) + (remove-setting! 'pilot-exit) + (set-setting! 'pilot #f 0.0 0) + (apply-settings *setting-control*) ) - (when target - (cond - ((not (-> *setting-control* user-current pilot-exit)) - (when (and s5-0 - v1-8 - (not (focus-test? (the-as process-focusable s5-0) pilot-riding)) - (not (focus-test? (the-as process-focusable v1-8) pilot-riding)) - (>= (- (-> pp clock frame-counter) (-> obj locked-player-time)) (seconds 10)) - ) - (remove-setting! 'pilot-exit) - (set-setting! 'pilot #f 0.0 0) - (apply-settings *setting-control*) - ) + ) + ((focus-test? target pilot-riding) + (when (and (nonzero? (-> target pilot)) + (and (= (handle->process (-> target pilot vehicle)) (handle->process (-> obj vehicle-handle))) + (or (and s5-0 (focus-test? (the-as process-focusable s5-0) pilot)) + (and v1-8 (focus-test? (the-as process-focusable v1-8) pilot)) + ) + ) + ) + (set-setting! 'pilot-exit #f 0.0 0) + (apply-settings *setting-control*) + (set! (-> obj locked-player-time) (current-time)) ) - ((focus-test? target pilot-riding) - (when (and (nonzero? (-> target pilot)) - (and (= (handle->process (-> target pilot vehicle)) (handle->process (-> obj vehicle-handle))) - (or (and s5-0 (focus-test? (the-as process-focusable s5-0) pilot)) - (and v1-8 (focus-test? (the-as process-focusable v1-8) pilot)) - ) - ) - ) - (set-setting! 'pilot-exit #f 0.0 0) - (apply-settings *setting-control*) - (set! (-> obj locked-player-time) (-> pp clock frame-counter)) - ) - ) - ) + ) ) ) - 0 - (none) ) + 0 + (none) ) ;; WARN: Return type mismatch object vs none. @@ -958,36 +948,34 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-escort)) - (with-pp - (if (and (not (speech-playing? arg1 3)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) - (not (channel-active? arg1 (the-as uint 0))) - ) - (play-speech arg1 3) - ) - (when (hal-escort-method-228 arg1) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 28 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) + (if (and (not (speech-playing? arg1 3)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 3) ) - (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 - ) - ) + (when (hal-escort-method-228 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 28 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (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 + ) ) ) - ) - (when (and a0-11 (>= (the-as int (send-event a0-11 'query 'waypoint)) 6)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 6 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + ) + ) + (when (and a0-11 (>= (the-as int (send-event a0-11 'query 'waypoint)) 6)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 6 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) @@ -1153,36 +1141,34 @@ ) :on-update (lambda ((arg0 hal-escort)) (set-traffic-danger! arg0) (hal-escort-method-235 arg0) (none)) :on-skipping-here (lambda ((arg0 hal-escort)) - (with-pp - (set! (-> arg0 dont-fail-until) (+ (-> pp clock frame-counter) (seconds 10))) - (reset-warn-time! arg0) - (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 - ) - ) + (set! (-> arg0 dont-fail-until) (+ (current-time) (seconds 10))) + (reset-warn-time! arg0) + (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 + ) ) ) - (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 - ) - ) + ) + (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 + ) ) ) - ) - (send-event s5-1 'skip) - (send-event s4-1 'skip) - ) - (init-traffic-params! arg0 #f) - (none) + ) + ) + (send-event s5-1 'skip) + (send-event s4-1 'skip) ) + (init-traffic-params! arg0 #f) + (none) ) :check-too-far #f ) @@ -1205,90 +1191,88 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-escort)) - (with-pp - (hal-escort-method-232 arg1) - (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) (not (-> *setting-control* user-current pilot-exit))) - (send-event (handle->process (-> arg1 arrow-handle)) 'set-position (-> arg1 hal4-course spots 6)) - (logior! (-> arg1 waypoint-bits) 1) - ) - (if (and (not (speech-playing? arg1 14)) - (not (-> *setting-control* user-current pilot-exit)) - (>= (- (-> pp clock frame-counter) (-> arg1 locked-player-time)) (seconds 1.5)) - ) - (play-speech arg1 14) - ) - (when (vehicle-destroyed? arg1) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 29 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (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 - ) - ) - ) - ) - (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 - ) - ) - ) - ) + (hal-escort-method-232 arg1) + (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) (not (-> *setting-control* user-current pilot-exit))) + (send-event (handle->process (-> arg1 arrow-handle)) 'set-position (-> arg1 hal4-course spots 6)) + (logior! (-> arg1 waypoint-bits) 1) + ) + (if (and (not (speech-playing? arg1 14)) + (not (-> *setting-control* user-current pilot-exit)) + (>= (- (current-time) (-> arg1 locked-player-time)) (seconds 1.5)) ) - (let ((s3-1 #f)) - (let* ((s1-0 (handle->process (-> arg1 vehicle-handle))) - (s2-0 (if (type? s1-0 process-focusable) - s1-0 - ) - ) - ) - (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))) - (>= 16384.0 (- (-> s1-1 y) (-> s0-0 center y))) - (>= 61440.0 (vector-length (-> (the-as process-focusable s2-0) root-override transv))) - (>= 1.0 (vector-length (-> (the-as process-focusable s2-0) rbody state ang-velocity))) + (play-speech arg1 14) + ) + (when (vehicle-destroyed? arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 29 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (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 ) - (set! s3-1 #t) - ) - ) + ) + ) + ) + (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 + ) + ) + ) + ) + ) + (let ((s3-1 #f)) + (let* ((s1-0 (handle->process (-> arg1 vehicle-handle))) + (s2-0 (if (type? s1-0 process-focusable) + s1-0 + ) + ) + ) + (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))) + (>= 16384.0 (- (-> s1-1 y) (-> s0-0 center y))) + (>= 61440.0 (vector-length (-> (the-as process-focusable s2-0) root-override transv))) + (>= 1.0 (vector-length (-> (the-as process-focusable s2-0) rbody state ang-velocity))) + ) + (set! s3-1 #t) + ) ) ) - (if (focus-test? (the-as process-focusable s5-0) pilot) - (send-event s5-0 'request 'exit-vehicle s3-1 1) - ) - (if (focus-test? (the-as process-focusable s5-0) pilot) - (send-event s4-1 'request 'exit-vehicle s3-1 1) - ) - (if (and (not (speech-playing? arg1 7)) - (not (focus-test? (the-as process-focusable s4-1) pilot-riding)) - (not (logtest? (bot-flags bf17) (-> (the-as bot s4-1) bot-flags))) - s3-1 - (not (channel-active? arg1 (the-as uint 0))) - ) - (play-speech arg1 7) - ) - ) - (when (and (not (focus-test? (the-as process-focusable s4-1) pilot)) - (not (logtest? (bot-flags bf17) (-> (the-as bot s4-1) bot-flags))) - (not (focus-test? (the-as process-focusable s5-0) pilot)) - (not (logtest? (bot-flags bf17) (-> (the-as bot s5-0) bot-flags))) - ) - (send-event *target* 'end-mode) - (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 ) + (if (focus-test? (the-as process-focusable s5-0) pilot) + (send-event s5-0 'request 'exit-vehicle s3-1 1) + ) + (if (focus-test? (the-as process-focusable s5-0) pilot) + (send-event s4-1 'request 'exit-vehicle s3-1 1) + ) + (if (and (not (speech-playing? arg1 7)) + (not (focus-test? (the-as process-focusable s4-1) pilot-riding)) + (not (logtest? (bot-flags bf17) (-> (the-as bot s4-1) bot-flags))) + s3-1 + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 7) + ) + ) + (when (and (not (focus-test? (the-as process-focusable s4-1) pilot)) + (not (logtest? (bot-flags bf17) (-> (the-as bot s4-1) bot-flags))) + (not (focus-test? (the-as process-focusable s5-0) pilot)) + (not (logtest? (bot-flags bf17) (-> (the-as bot s5-0) bot-flags))) + ) + (send-event *target* 'end-mode) + (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 ) ) ) @@ -1298,45 +1282,43 @@ (none) ) :on-update (lambda ((arg0 hal-escort)) - (with-pp - (when (and (not (speech-playing? arg0 31)) (not (speech-playing? arg0 32))) - (let ((v1-7 (handle->process (-> arg0 vehicle-handle)))) - (if (and v1-7 - (and (not (logtest? (-> (the-as vehicle v1-7) flags) (rigid-body-object-flag dead))) - (>= (vector-length (-> (the-as vehicle v1-7) root-override-2 transv)) 40960.0) - (not (channel-active? arg0 (the-as uint 0))) - ) - ) - (play-speech arg0 (if (zero? (get-rand-int arg0 2)) - 32 - 31 + (when (and (not (speech-playing? arg0 31)) (not (speech-playing? arg0 32))) + (let ((v1-7 (handle->process (-> arg0 vehicle-handle)))) + (if (and v1-7 + (and (not (logtest? (-> (the-as vehicle v1-7) flags) (rigid-body-object-flag dead))) + (>= (vector-length (-> (the-as vehicle v1-7) root-override-2 transv)) 40960.0) + (not (channel-active? arg0 (the-as uint 0))) + ) + ) + (play-speech arg0 (if (zero? (get-rand-int arg0 2)) + 32 + 31 + ) + ) + ) + ) + ) + (when (and (zero? (-> arg0 locked-player-time)) + (or (not (speech-playing? arg0 33)) (not (speech-playing? arg0 34))) + (>= (- (current-time) (-> arg0 played-get-in-time)) (seconds 6)) + (not (channel-active? arg0 (the-as uint 0))) + ) + (let ((a0-18 (handle->process (-> arg0 vehicle-handle)))) + (when a0-18 + (let ((f0-1 (vector-vector-xz-distance (get-trans (the-as vehicle a0-18) 0) (target-pos 0)))) + (when (and (< 28672.0 f0-1) (< f0-1 184320.0)) + (play-speech arg0 (if (speech-playing? arg0 33) + 34 + 33 ) ) - ) - ) - ) - (when (and (zero? (-> arg0 locked-player-time)) - (or (not (speech-playing? arg0 33)) (not (speech-playing? arg0 34))) - (>= (- (-> pp clock frame-counter) (-> arg0 played-get-in-time)) (seconds 6)) - (not (channel-active? arg0 (the-as uint 0))) - ) - (let ((a0-18 (handle->process (-> arg0 vehicle-handle)))) - (when a0-18 - (let ((f0-1 (vector-vector-xz-distance (get-trans (the-as vehicle a0-18) 0) (target-pos 0)))) - (when (and (< 28672.0 f0-1) (< f0-1 184320.0)) - (play-speech arg0 (if (speech-playing? arg0 33) - 34 - 33 - ) - ) - (set! (-> arg0 played-get-in-time) (-> pp clock frame-counter)) - ) + (set! (-> arg0 played-get-in-time) (current-time)) ) ) ) ) - (none) ) + (none) ) :on-skipping-here #f :check-too-far #f @@ -1354,40 +1336,38 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-escort)) - (with-pp - (if (!= (level-status *level* 'ctyinda) 'active) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - (when (>= (- (-> pp clock frame-counter) (-> 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 + (if (!= (level-status *level* 'ctyinda) 'active) + (set! (-> arg1 waypoint-time0) (current-time)) ) + (when (>= (- (current-time) (-> 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 ) ) ) @@ -1397,38 +1377,36 @@ ) :on-update #f :on-skipping-here (lambda ((arg0 hal-escort)) - (with-pp - (set! (-> arg0 dont-fail-until) (+ (-> pp clock frame-counter) (seconds 15))) - (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 - ) - ) + (set! (-> arg0 dont-fail-until) (+ (current-time) (seconds 15))) + (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 + ) ) ) - (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 - ) - ) + ) + (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 + ) ) ) - ) - (vector-reset! (-> (the-as process-focusable s5-0) root-override transv)) - (vector-reset! (-> (the-as process-focusable s4-1) root-override transv)) - (send-event s5-0 'hide #t) - (send-event s4-1 'hide #t) - ) - (send-event arg0 'move-trans (-> arg0 hal4-course spots 7)) - (send-event *target* 'continue (get-continue-by-name *game-info* "lkiddoge-skip1")) - (none) + ) + ) + (vector-reset! (-> (the-as process-focusable s5-0) root-override transv)) + (vector-reset! (-> (the-as process-focusable s4-1) root-override transv)) + (send-event s5-0 'hide #t) + (send-event s4-1 'hide #t) ) + (send-event arg0 'move-trans (-> arg0 hal4-course spots 7)) + (send-event *target* 'continue (get-continue-by-name *game-info* "lkiddoge-skip1")) + (none) ) :check-too-far #f ) @@ -1455,47 +1433,45 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-escort)) - (with-pp - (when (and (not (speech-playing? arg1 4)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) - (not (channel-active? arg1 (the-as uint 0))) + (when (and (not (speech-playing? arg1 4)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 15) + (play-speech arg1 4) + ) + (when (hal-escort-method-228 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 31 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (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 + ) + ) + ) + ) + (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 + ) + ) + ) + ) + ) + (when (and (and s4-0 (>= (the-as int (send-event s4-0 'query 'waypoint)) 25)) + (and s5-1 (>= (the-as int (send-event s5-1 'query 'waypoint)) 25)) ) - (play-speech arg1 15) - (play-speech arg1 4) - ) - (when (hal-escort-method-228 arg1) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 31 #f) + (go-to-waypoint! arg1 25 #f) (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (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 - ) - ) - ) - ) - (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 - ) - ) - ) - ) - ) - (when (and (and s4-0 (>= (the-as int (send-event s4-0 'query 'waypoint)) 25)) - (and s5-1 (>= (the-as int (send-event s5-1 'query 'waypoint)) 25)) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 25 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + #t ) ) ) @@ -1511,36 +1487,34 @@ (none) ) :on-skipping-here (lambda ((arg0 hal-escort)) - (with-pp - (set! (-> arg0 dont-fail-until) (+ (-> pp clock frame-counter) (seconds 15))) - (reset-warn-time! arg0) - (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) - (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 - ) - ) + (set! (-> arg0 dont-fail-until) (+ (current-time) (seconds 15))) + (reset-warn-time! arg0) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (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 + ) ) ) - (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 - ) - ) + ) + (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 + ) ) ) - ) - (send-event s5-1 'skip) - (send-event gp-1 'skip) - ) - (none) + ) + ) + (send-event s5-1 'skip) + (send-event gp-1 'skip) ) + (none) ) :check-too-far 'hal4-walking-too-far ) @@ -1698,7 +1672,7 @@ ) ) (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.75)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.75)) ) (logior! (-> arg1 waypoint-bits) 2) (let ((s5-0 *traffic-manager*)) @@ -1709,7 +1683,7 @@ ) ) (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.2)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.2)) ) (let* ((v1-55 (-> arg1 actor-group 0 data 2 actor)) (s5-1 (when v1-55 @@ -1737,7 +1711,7 @@ (send-event s5-1 'request 'waypoint 26) ) ) - (when (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) + (when (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3)) (not (channel-active? arg1 (the-as uint 0))) (scene-play arg1 "dig-knock-down-scaffolding-intro" #t) ) @@ -1839,7 +1813,7 @@ (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-escort)) (with-pp - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3)) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-1 from) (process->ppointer pp)) (set! (-> a1-1 num-params) 0) diff --git a/goal_src/jak2/levels/city/kid_escort/kidesc-states.gc b/goal_src/jak2/levels/city/kid_escort/kidesc-states.gc index 3cd2a4cdff..b03ed7032b 100644 --- a/goal_src/jak2/levels/city/kid_escort/kidesc-states.gc +++ b/goal_src/jak2/levels/city/kid_escort/kidesc-states.gc @@ -11,7 +11,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -92,7 +92,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -154,7 +154,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -187,12 +187,10 @@ ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) (check-arrest self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -226,7 +224,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -263,12 +261,10 @@ (logclear! (-> self bot-flags) (bot-flags bf15)) (check-arrest self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -328,7 +324,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -480,7 +476,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -566,7 +562,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -724,7 +720,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -749,7 +745,7 @@ ) (go-virtual arrested) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + ((and (>= (- (current-time) (-> 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) @@ -787,7 +783,7 @@ (go-virtual arrested) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (when (not (nav-enemy-method-163 self)) (if (logtest? (-> self bot-flags) (bot-flags bf15)) (go-virtual move-to-vehicle) @@ -859,7 +855,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -948,7 +944,7 @@ (when (not (logtest? (bot-flags bf19) (-> self bot-flags))) (until #f (until (ja-done? 0) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2.5)) (goto cfg-27) ) (suspend) @@ -973,11 +969,11 @@ ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (until (ja-done? 0) (if (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (>= (- (current-time) (-> self state-time)) (seconds 3)) (reset? *fail-mission-control*) ) (reset! *fail-mission-control*) @@ -1029,7 +1025,7 @@ (until #f (until (ja-done? 0) (if (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (>= (- (current-time) (-> self state-time)) (seconds 3)) (reset? *fail-mission-control*) ) (reset! *fail-mission-control*) @@ -1067,7 +1063,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) diff --git a/goal_src/jak2/levels/city/kid_escort/kidesc4-course.gc b/goal_src/jak2/levels/city/kid_escort/kidesc4-course.gc index 8accc5f6ba..2dec43e24b 100644 --- a/goal_src/jak2/levels/city/kid_escort/kidesc4-course.gc +++ b/goal_src/jak2/levels/city/kid_escort/kidesc4-course.gc @@ -365,15 +365,13 @@ (the-as (function kidesct-wait-spot kid-escort symbol) (lambda ((arg0 object) (arg1 kid-escort)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) - (let ((v1-4 (-> arg1 spot))) - (set! (-> v1-4 center quad) (-> arg1 root-override2 trans quad)) - (set! (-> v1-4 center w) 20480.0) - ) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) + (let ((v1-4 (-> arg1 spot))) + (set! (-> v1-4 center quad) (-> arg1 root-override2 trans quad)) + (set! (-> v1-4 center w) 20480.0) ) - #f ) + #f ) ) ) diff --git a/goal_src/jak2/levels/city/market/ctymark-obs.gc b/goal_src/jak2/levels/city/market/ctymark-obs.gc index 91a42d52b5..0fc33a5351 100644 --- a/goal_src/jak2/levels/city/market/ctymark-obs.gc +++ b/goal_src/jak2/levels/city/market/ctymark-obs.gc @@ -1046,8 +1046,8 @@ :to self ) (process-entity-status! self (entity-perm-status dead) #t) - (let ((frame (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) frame) (seconds 5)) + (let ((frame (current-time))) + (until (>= (- (current-time) frame) (seconds 5)) (suspend) ) ) diff --git a/goal_src/jak2/levels/city/market/east/ashelin/ash4-course.gc b/goal_src/jak2/levels/city/market/east/ashelin/ash4-course.gc index 0c44e6797c..b3c3e74308 100644 --- a/goal_src/jak2/levels/city/market/east/ashelin/ash4-course.gc +++ b/goal_src/jak2/levels/city/market/east/ashelin/ash4-course.gc @@ -328,52 +328,50 @@ :nav-mesh-index -1 :skip-to -1 :on-set (lambda ((arg0 ashelin-tanker)) - (with-pp - (set! (-> arg0 waypoint-time0) (-> pp clock frame-counter)) - (ashelin-method-250 arg0 #f) - (task-node-close! (game-task-node city-intercept-tanker-battle)) - (remove-setting! 'sound-mode) - (remove-setting! 'music) - (when (not (channel-active? arg0 (the-as uint 0))) - (let ((v1-12 (get-rand-int arg0 3))) - (cond - ((zero? v1-12) - (play-speech arg0 42) - ) - ((= v1-12 1) - (play-speech arg0 43) - ) - (else - (play-speech arg0 44) - ) + (set! (-> arg0 waypoint-time0) (current-time)) + (ashelin-method-250 arg0 #f) + (task-node-close! (game-task-node city-intercept-tanker-battle)) + (remove-setting! 'sound-mode) + (remove-setting! 'music) + (when (not (channel-active? arg0 (the-as uint 0))) + (let ((v1-12 (get-rand-int arg0 3))) + (cond + ((zero? v1-12) + (play-speech arg0 42) + ) + ((= v1-12 1) + (play-speech arg0 43) + ) + (else + (play-speech arg0 44) ) ) ) - (let ((v1-20 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) - (set! (-> v1-20 bytes 5) 1) - (set! (-> v1-20 bytes 6) 0) - (set! (-> v1-20 bytes 4) -1) - (set! (-> (the-as asht-wait-spot v1-20) check-done) - (the-as - (function asht-wait-spot ashelin symbol) - (lambda ((arg0 object) (arg1 ashelin-tanker)) - (let ((s5-0 (get-current-task-event (-> arg1 task)))) - (when (and (= (-> s5-0 action) (game-task-action say)) - (not (channel-active? arg1 (the-as uint 0))) - (scene-play arg1 (the-as string (-> s5-0 scene)) #f) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 7 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + ) + (let ((v1-20 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-20 bytes 5) 1) + (set! (-> v1-20 bytes 6) 0) + (set! (-> v1-20 bytes 4) -1) + (set! (-> (the-as asht-wait-spot v1-20) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) + (let ((s5-0 (get-current-task-event (-> arg1 task)))) + (when (and (= (-> s5-0 action) (game-task-action say)) + (not (channel-active? arg1 (the-as uint 0))) + (scene-play arg1 (the-as string (-> s5-0 scene)) #f) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 7 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) ) - ) - (none) + ) ) + (none) ) :on-update (lambda ((arg0 ashelin-tanker)) (suppress-traffic arg0) diff --git a/goal_src/jak2/levels/city/market/east/ashelin/ctyasha-obs.gc b/goal_src/jak2/levels/city/market/east/ashelin/ctyasha-obs.gc index 9cb0e465c7..570e084c9c 100644 --- a/goal_src/jak2/levels/city/market/east/ashelin/ctyasha-obs.gc +++ b/goal_src/jak2/levels/city/market/east/ashelin/ctyasha-obs.gc @@ -1504,7 +1504,7 @@ This commonly includes things such as: (set! (-> a1-5 tlist) *touching-list*) (find-overlapping-shapes (-> self root-override) a1-5) ) - (if (>= (-> self clock frame-counter) (-> self die-time)) + (if (>= (current-time) (-> self die-time)) (go-virtual die-fast) ) (none) @@ -1522,7 +1522,7 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defbehavior tanker-deadly-init-by-other tanker-deadly ((arg0 vector) (arg1 int) (arg2 int)) (set! (-> self track-joint) arg1) - (set! (-> self die-time) (+ (-> self clock frame-counter) arg2)) + (set! (-> self die-time) (+ (current-time) arg2)) (let* ((v1-3 *game-info*) (a0-2 (+ (-> v1-3 attack-id) 1)) ) diff --git a/goal_src/jak2/levels/city/market/west/brutter_kiosk/meet-brutter.gc b/goal_src/jak2/levels/city/market/west/brutter_kiosk/meet-brutter.gc index 71b6972fa0..2dbfe6feb5 100644 --- a/goal_src/jak2/levels/city/market/west/brutter_kiosk/meet-brutter.gc +++ b/goal_src/jak2/levels/city/market/west/brutter_kiosk/meet-brutter.gc @@ -1201,7 +1201,7 @@ (set! (-> self gnd-height) (-> self root-override2 gspot-pos y)) (logior! (-> self flags) (citizen-flag persistent)) (set! (-> self focus-status) (logior (focus-status pilot-riding pilot) (-> self focus-status))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-31 (-> self root-override2 root-prim))) (set! (-> v1-31 prim-core collide-as) (collide-spec)) (set! (-> v1-31 prim-core collide-with) (collide-spec)) @@ -1254,14 +1254,14 @@ ) (let ((s5-3 (new 'stack-no-clear 'vector))) (let ((s4-0 (new 'stack-no-clear 'quaternion))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (while (not (civilian-method-217 self s5-3)) (let ((s3-0 (handle->process (-> self vehicle)))) (new 'stack-no-clear 'vector) (quaternion-copy! (-> self root-override2 quat) (-> (the-as vehicle s3-0) root-override-2 quat)) (compute-seat-position (the-as vehicle s3-0) (-> self root-override2 trans) (-> self seat)) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2)) (go-virtual ride) ) (suspend) @@ -1322,7 +1322,7 @@ ) ) (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-166 self) (let ((v1-15 (-> self nav))) (set! (-> v1-15 target-speed) (* (-> self speed-scale) (-> self speed-run))) @@ -1474,7 +1474,7 @@ :event (the-as (function process int symbol event-message-block object :behavior city-lurker) enemy-event-handler) :enter (behavior () (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-166 self) (let ((v1-6 (-> self nav))) (set! (-> v1-6 target-speed) (* (-> self speed-scale) (-> self speed-run))) @@ -1532,7 +1532,7 @@ (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) (send-event self 'jump 0 (-> self end-pos)) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (logtest? (-> self nav state flags) (nav-state-flag at-target)) ) (go-virtual wait-at-end) @@ -1571,7 +1571,7 @@ :event (the-as (function process int symbol event-message-block object :behavior city-lurker) enemy-event-handler) :enter (behavior () (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-166 self) (let ((v1-6 (-> self nav))) (set! (-> v1-6 target-speed) (* (-> self speed-scale) (-> self speed-run))) @@ -1711,7 +1711,7 @@ :event (the-as (function process int symbol event-message-block object :behavior city-lurker) enemy-event-handler) :enter (behavior () (logclear! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-4 nav callback-info) *nav-enemy-null-callback-info*) @@ -1850,7 +1850,7 @@ (citizen-init! self) (set! (-> self hit-points) 100) (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-8 (-> self root-override2 root-prim))) (set! (-> v1-8 prim-core collide-as) (collide-spec)) (set! (-> v1-8 prim-core collide-with) (collide-spec)) @@ -2381,7 +2381,7 @@ (cond ((= (-> self data-int32 (-> gp-0 index)) -1) (+! (-> self data-int32 (-> gp-0 index)) 1) - (set! (-> self beep-time) (+ (-> self clock frame-counter) (rand-vu-int-range (seconds 10) (seconds 20)))) + (set! (-> self beep-time) (+ (current-time) (rand-vu-int-range (seconds 10) (seconds 20)))) (let ((v1-14 (-> self data-int32 16))) (cond ((zero? v1-14) @@ -2395,7 +2395,7 @@ ) ) ) - (set! (-> self beep-time) (+ (-> self clock frame-counter) (rand-vu-int-range (seconds 10) (seconds 20)))) + (set! (-> self beep-time) (+ (current-time) (rand-vu-int-range (seconds 10) (seconds 20)))) (+! (-> self data-int32 16) 1) ) ((= (-> self data-int32 (-> gp-0 index)) 1) @@ -2701,8 +2701,8 @@ (set! (-> self hud-counter) (ppointer->handle (process-spawn hud-lurker :init hud-init-by-other :to self))) (suspend) (send-event *traffic-manager* 'set-target-level #x3f400000) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (none) @@ -2725,8 +2725,8 @@ (send-event *traffic-manager* 'decrease-alert-level 0) (send-event *traffic-manager* 'set-alert-duration 9000) (send-event *target* 'end-mode) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (task-node-close! (game-task-node city-meet-brutter-meet-brutter)) @@ -3273,8 +3273,8 @@ (set! (-> self hud-counter) (ppointer->handle (process-spawn hud-lurker :init hud-init-by-other :to self))) (suspend) (send-event *traffic-manager* 'set-target-level #x3f400000) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (none) @@ -3294,7 +3294,7 @@ TASK_MANAGER_COMPLETE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (let ((v1-2 0)) (dotimes (a0-0 6) diff --git a/goal_src/jak2/levels/city/misc/collection_task/collection-task.gc b/goal_src/jak2/levels/city/misc/collection_task/collection-task.gc index 306040994b..cb358d72cc 100644 --- a/goal_src/jak2/levels/city/misc/collection_task/collection-task.gc +++ b/goal_src/jak2/levels/city/misc/collection_task/collection-task.gc @@ -313,7 +313,7 @@ (when krew-item (set! (-> self slave 0) (process->handle krew-item)) (set! (-> self time-limit) (the-as time-frame (-> self data-int32 task-count))) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (+! (-> self count) 1) ) ) @@ -353,8 +353,8 @@ (ppointer->handle (process-spawn hud-moneybag :init hud-init-by-other :to *target*)) ) (send-event *traffic-manager* 'set-target-level #x3f800000) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (send-event *traffic-manager* 'set-alert-level 2) @@ -377,8 +377,8 @@ () (send-event *traffic-manager* 'decrease-alert-level 0) (send-event *traffic-manager* 'set-alert-duration 9000) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (talker-spawn-func (-> *talker-speech* 88) *entity-pool* (target-pos 0) (the-as region #f)) diff --git a/goal_src/jak2/levels/city/misc/delivery/delivery-task.gc b/goal_src/jak2/levels/city/misc/delivery/delivery-task.gc index 4b4c470a20..23f8f75aa1 100644 --- a/goal_src/jak2/levels/city/misc/delivery/delivery-task.gc +++ b/goal_src/jak2/levels/city/misc/delivery/delivery-task.gc @@ -521,8 +521,8 @@ This commonly includes things such as: (send-event *target* 'change-mode 'normal) ) (set-setting! 'pilot #f 0.0 0) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (none) diff --git a/goal_src/jak2/levels/city/onin_tent/onin-game.gc b/goal_src/jak2/levels/city/onin_tent/onin-game.gc index 60b21b4c23..db1232e674 100644 --- a/goal_src/jak2/levels/city/onin_tent/onin-game.gc +++ b/goal_src/jak2/levels/city/onin_tent/onin-game.gc @@ -1843,8 +1843,8 @@ (-> gp-0 ppointer) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.25)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.25)) (suspend) ) ) @@ -2004,7 +2004,7 @@ (defbehavior onin-game-bubble-init onin-game-bubble ((arg0 vector) (arg1 int) (arg2 meters) (arg3 float) (arg4 float)) "TODO - bubble type enum" (sound-play "onin-launch") - (set! (-> self bubble-start-time) (-> self clock frame-counter)) + (set! (-> self bubble-start-time) (current-time)) (set! (-> self bubble-type) arg1) (set! (-> self gravity) arg2) (set! (-> self angle) arg3) @@ -2094,169 +2094,163 @@ (sv-96 meters) (sv-112 float) ) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> obj game-start-time)) (seconds 2)) - (let ((s5-0 (-> obj game (-> obj wave)))) - (when (>= (- (-> pp clock frame-counter) (the-as int (-> obj wave-length))) (-> obj wave-time)) - (let ((s4-0 (-> obj child))) - (while s4-0 - (if (type? (ppointer->process s4-0) onin-game-bubble) - (goto cfg-58) - ) - (set! s4-0 (-> s4-0 0 brother)) - ) - ) - (if (zero? (-> obj wave-delay-time)) - (set! (-> obj wave-delay-time) (-> pp clock frame-counter)) - ) - (if (< (- (-> pp clock frame-counter) (-> obj wave-delay-time)) (the-as time-frame (-> s5-0 wave-delay))) - (goto cfg-58) - ) - (set! (-> obj event-length) (the-as uint 0)) - (+! (-> obj wave) 1) - (set! s5-0 (-> obj game (-> obj wave))) - (when (zero? (-> s5-0 min-count)) - (set! (-> obj wave) (the-as int (-> s5-0 max-count))) - (set! s5-0 (-> obj game (-> obj wave))) - ) - (set! (-> obj wave-time) (-> pp clock frame-counter)) - (set! (-> obj wave-length) - (the-as uint (rand-vu-int-range (the-as int (-> s5-0 min-wave)) (the-as int (-> s5-0 max-wave)))) + (when (>= (- (current-time) (-> obj game-start-time)) (seconds 2)) + (let ((s5-0 (-> obj game (-> obj wave)))) + (when (>= (- (current-time) (the-as int (-> obj wave-length))) (-> obj wave-time)) + (let ((s4-0 (-> obj child))) + (while s4-0 + (if (type? (ppointer->process s4-0) onin-game-bubble) + (goto cfg-58) ) - (set! (-> obj wave-delay-time) 0) - (when (< 1 (-> obj wave)) - (cond - ((< 4 (- (-> obj miss-count) (-> obj wave-start-miss))) - (let ((v0-2 (rand-vu-int-count 5))) - (cond - ((zero? v0-2) - (talker-spawn-func (-> *talker-speech* 148) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-2 1) - (talker-spawn-func (-> *talker-speech* 153) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-2 2) - (talker-spawn-func (-> *talker-speech* 154) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-2 3) - (talker-spawn-func (-> *talker-speech* 157) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-2 4) - (talker-spawn-func (-> *talker-speech* 158) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) - ) - ) - ((>= 1 (- (-> obj miss-count) (-> obj wave-start-miss))) - (let ((v0-9 (rand-vu-int-count 7))) - (cond - ((zero? v0-9) - (talker-spawn-func (-> *talker-speech* 141) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-9 1) - (talker-spawn-func (-> *talker-speech* 142) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-9 2) - (talker-spawn-func (-> *talker-speech* 143) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-9 3) - (talker-spawn-func (-> *talker-speech* 150) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-9 4) - (talker-spawn-func (-> *talker-speech* 156) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-9 5) - (talker-spawn-func (-> *talker-speech* 159) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-9 6) - (talker-spawn-func (-> *talker-speech* 160) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) - ) - ) - ) + (set! s4-0 (-> s4-0 0 brother)) ) - (set! (-> obj wave-start-miss) (-> obj miss-count)) ) - (set! v0-18 - (when (>= (- (-> pp clock frame-counter) (-> obj event-time)) (the-as time-frame (-> obj event-length))) - (set! (-> obj event-time) (-> pp clock frame-counter)) - (let ((s4-14 (vector+! (new 'stack-no-clear 'vector) (-> obj root trans) (new 'static 'vector :w 1.0))) - (s3-12 (rand-vu-int-range (the-as int (-> s5-0 min-count)) (the-as int (-> s5-0 max-count)))) + (if (zero? (-> obj wave-delay-time)) + (set! (-> obj wave-delay-time) (current-time)) + ) + (if (< (- (current-time) (-> obj wave-delay-time)) (the-as time-frame (-> s5-0 wave-delay))) + (goto cfg-58) + ) + (set! (-> obj event-length) (the-as uint 0)) + (+! (-> obj wave) 1) + (set! s5-0 (-> obj game (-> obj wave))) + (when (zero? (-> s5-0 min-count)) + (set! (-> obj wave) (the-as int (-> s5-0 max-count))) + (set! s5-0 (-> obj game (-> obj wave))) + ) + (set! (-> obj wave-time) (current-time)) + (set! (-> obj wave-length) + (the-as uint (rand-vu-int-range (the-as int (-> s5-0 min-wave)) (the-as int (-> s5-0 max-wave)))) + ) + (set! (-> obj wave-delay-time) 0) + (when (< 1 (-> obj wave)) + (cond + ((< 4 (- (-> obj miss-count) (-> obj wave-start-miss))) + (let ((v0-2 (rand-vu-int-count 5))) + (cond + ((zero? v0-2) + (talker-spawn-func (-> *talker-speech* 148) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-2 1) + (talker-spawn-func (-> *talker-speech* 153) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-2 2) + (talker-spawn-func (-> *talker-speech* 154) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-2 3) + (talker-spawn-func (-> *talker-speech* 157) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-2 4) + (talker-spawn-func (-> *talker-speech* 158) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + ) + ) + ((>= 1 (- (-> obj miss-count) (-> obj wave-start-miss))) + (let ((v0-9 (rand-vu-int-count 7))) + (cond + ((zero? v0-9) + (talker-spawn-func (-> *talker-speech* 141) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-9 1) + (talker-spawn-func (-> *talker-speech* 142) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-9 2) + (talker-spawn-func (-> *talker-speech* 143) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-9 3) + (talker-spawn-func (-> *talker-speech* 150) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-9 4) + (talker-spawn-func (-> *talker-speech* 156) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-9 5) + (talker-spawn-func (-> *talker-speech* 159) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-9 6) + (talker-spawn-func (-> *talker-speech* 160) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + ) + ) + ) + ) + (set! (-> obj wave-start-miss) (-> obj miss-count)) + ) + (set! v0-18 + (when (>= (- (current-time) (-> obj event-time)) (the-as time-frame (-> obj event-length))) + (set! (-> obj event-time) (current-time)) + (let ((s4-14 (vector+! (new 'stack-no-clear 'vector) (-> obj root trans) (new 'static 'vector :w 1.0))) + (s3-12 (rand-vu-int-range (the-as int (-> s5-0 min-count)) (the-as int (-> s5-0 max-count)))) + ) + (dotimes (s2-12 s3-12) + (let ((f0-0 (-> obj last-angle))) + (while (< (fabs (- (-> obj last-angle) f0-0)) 819.2) + (set! f0-0 (rand-vu-float-range -1720.32 1720.32)) ) - (dotimes (s2-12 s3-12) - (let ((f0-0 (-> obj last-angle))) - (while (< (fabs (- (-> obj last-angle) f0-0)) 819.2) - (set! f0-0 (rand-vu-float-range -1720.32 1720.32)) - ) - (set! (-> obj 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) - obj - (symbol->string (-> onin-game-bubble symbol)) - (the-as pointer #x70004000) - ) + (set! (-> obj 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) + obj + (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 (-> obj 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) ) + (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 (-> obj 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) ) ) ) - (set! v0-18 (rand-vu-int-range (the-as int (-> s5-0 min-event)) (the-as int (-> s5-0 max-event)))) - (set! (-> obj event-length) (the-as uint v0-18)) - v0-18 ) + (set! v0-18 (rand-vu-int-range (the-as int (-> s5-0 min-event)) (the-as int (-> s5-0 max-event)))) + (set! (-> obj event-length) (the-as uint v0-18)) + v0-18 ) - ) + ) ) - (label cfg-58) - (onin-game-method-26 obj) - 0 - (none) ) + (label cfg-58) + (onin-game-method-26 obj) + 0 + (none) ) (defmethod onin-game-method-26 onin-game ((obj onin-game)) - (with-pp - (cond - ((>= (-> *game-info* score) (-> obj score)) - (set! (-> *game-info* score) (-> obj score)) - ) - ((and (< (-> *game-info* score) (-> obj score)) - (>= (- (-> pp clock frame-counter) (-> obj score-time)) (seconds 0.1)) - ) - (sound-play "onin-score") - (seek! (-> *game-info* score) (-> obj score) 1.0) - (set! (-> obj score-time) (-> pp clock frame-counter)) - ) - ) - (set! (-> *game-info* miss) (the float (-> obj miss-count))) - 0 - (none) + (cond + ((>= (-> *game-info* score) (-> obj score)) + (set! (-> *game-info* score) (-> obj score)) + ) + ((and (< (-> *game-info* score) (-> obj score)) (>= (- (current-time) (-> obj score-time)) (seconds 0.1))) + (sound-play "onin-score") + (seek! (-> *game-info* score) (-> obj score) 1.0) + (set! (-> obj score-time) (current-time)) + ) ) + (set! (-> *game-info* miss) (the float (-> obj miss-count))) + 0 + (none) ) ;; WARN: Return type mismatch number vs none. @@ -2413,7 +2407,7 @@ (set! (-> self hud-score) (ppointer->handle (process-spawn hud-big-score :init hud-init-by-other :to self))) (set! (-> self hud-goal) (ppointer->handle (process-spawn hud-goal :init hud-init-by-other :to self))) (set! (-> self hud-miss) (ppointer->handle (process-spawn hud-miss :init hud-init-by-other :to self))) - (set! (-> self game-start-time) (-> self clock frame-counter)) + (set! (-> self game-start-time) (current-time)) (send-event *target* 'draw #f) (set-setting! 'gun #f 0.0 0) (set-setting! 'calm #t 0.0 0) @@ -2563,8 +2557,8 @@ ) :code (behavior ((arg0 symbol)) (ja-channel-set! 0) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -2663,8 +2657,8 @@ (when (and (task-node-closed? (game-task-node city-play-onin-game-resolution)) (not (task-node-closed? (game-task-node city-play-onin-game-skill))) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -2689,8 +2683,8 @@ (while (nonzero? (get-status *gui-control* (the-as sound-id s5-1))) (suspend) ) - (let ((s5-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-3) (seconds 2)) + (let ((s5-3 (current-time))) + (until (>= (- (current-time) s5-3) (seconds 2)) (suspend) ) ) diff --git a/goal_src/jak2/levels/city/oracle/oracle-training.gc b/goal_src/jak2/levels/city/oracle/oracle-training.gc index f18d9487c0..805db73117 100644 --- a/goal_src/jak2/levels/city/oracle/oracle-training.gc +++ b/goal_src/jak2/levels/city/oracle/oracle-training.gc @@ -207,7 +207,7 @@ (add-process *gui-control* self (gui-channel message) (gui-action play) (-> self name) 81920.0 0) ) (send-event *target* 'get-notify self) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (none) ) ) diff --git a/goal_src/jak2/levels/city/port/mines/portrun.gc b/goal_src/jak2/levels/city/port/mines/portrun.gc index 127790f500..4c17b0ecd1 100644 --- a/goal_src/jak2/levels/city/port/mines/portrun.gc +++ b/goal_src/jak2/levels/city/port/mines/portrun.gc @@ -228,11 +228,11 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) - (while (or (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 30)) + (set! (-> self state-time) (current-time)) + (while (or (< (- (current-time) (-> self state-time)) (seconds 30)) (let ((a0-3 (level-get-target-inside *level*))) (when (not (and a0-3 (logtest? (-> a0-3 info level-flags) 1))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) #t ) ) @@ -880,16 +880,14 @@ (t9-1 sin-rad) (f1-0 -3.1415925) (f2-0 6.283185) - (f3-1 (the float (+ (-> pp clock frame-counter) (the-as time-frame (-> obj time-skew))))) + (f3-1 (the float (+ (current-time) (the-as time-frame (-> obj time-skew))))) ) (t9-1 (+ f1-0 (* f2-0 (/ (- f3-1 (* (the float (the int (/ f3-1 f0-1))) f0-1)) f0-1)))) ) (let ((s5-0 (-> obj info))) (cond ((zero? (-> obj info type)) - (let* ((f0-8 - (+ (* 2.0 (-> s5-0 offset)) (/ (* 0.0033333334 (the float (-> pp clock frame-counter))) (-> s5-0 speed))) - ) + (let* ((f0-8 (+ (* 2.0 (-> s5-0 offset)) (/ (* 0.0033333334 (the float (current-time))) (-> s5-0 speed)))) (f0-9 (- f0-8 (* (the float (the int (/ f0-8 2.0))) 2.0))) ) (if (< 1.0 f0-9) @@ -934,14 +932,13 @@ (set! (-> s3-0 y) (-> s5-0 pos1-y)) (set! (-> s3-0 z) (-> s5-0 pos1-z)) (set! (-> s3-0 w) 1.0) - (let ((v1-35 (vector-rotate-around-y! - (new 'stack-no-clear 'vector) - *x-vector* - (+ (* 182.04445 (* 360.0 (-> s5-0 offset))) - (* 0.60681486 (-> s5-0 speed) (the float (-> pp clock frame-counter))) - ) - ) - ) + (let ((v1-35 + (vector-rotate-around-y! + (new 'stack-no-clear 'vector) + *x-vector* + (+ (* 182.04445 (* 360.0 (-> s5-0 offset))) (* 0.60681486 (-> s5-0 speed) (the float (current-time)))) + ) + ) ) (let ((a0-8 (-> s5-0 pos2-x))) (.mov vf7 a0-8) @@ -975,14 +972,14 @@ (defstate die (ctyport-mine) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self beep-time) 0) 0 (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 3)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 3)) (suspend) ) ) @@ -991,15 +988,13 @@ ) :post (behavior () (cond - ((and (-> self beep) (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1))) + ((and (-> self beep) (< (- (current-time) (-> self state-time)) (seconds 1))) (vector-seek! (-> self beep-color) *null-vector* (* 4.0 (-> self clock seconds-per-frame))) - (when (< (-> self beep-time) (-> self clock frame-counter)) + (when (< (-> self beep-time) (current-time)) (sound-play "cargo-beep") (set-vector! (-> self beep-color) 1.0 1.0 1.0 1.0) (set! (-> self beep-time) - (+ (-> self clock frame-counter) - (the int (* 0.2 (the float (- (seconds 1) (- (-> self clock frame-counter) (-> self state-time)))))) - ) + (+ (current-time) (the int (* 0.2 (the float (- (seconds 1) (- (current-time) (-> self state-time))))))) ) ) (set! (-> self draw color-emissive quad) (-> self beep-color quad)) @@ -1227,19 +1222,18 @@ (defstate idle (ctyport-spy) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.3)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.3)) (+! (-> self trans-y) (* (-> self root transv y) (-> self clock seconds-per-frame))) (+! (-> self root transv y) (* -8.0 (-> self clock seconds-per-frame) (-> self root transv y))) (set! (-> self root trans y) (+ (-> self trans-y) - (* 1024.0 - (+ (sin (* 182.04445 (* 50.0 (+ 10.0 (* 0.0033333334 (the float (-> self clock frame-counter))))))) - (cos (* 182.04445 (* -80.0 (- 40.0 (* 0.0033333334 (the float (-> self clock frame-counter))))))) - ) + (* 1024.0 (+ (sin (* 182.04445 (* 50.0 (+ 10.0 (* 0.0033333334 (the float (current-time))))))) + (cos (* 182.04445 (* -80.0 (- 40.0 (* 0.0033333334 (the float (current-time))))))) + ) ) ) ) @@ -1248,13 +1242,9 @@ (s4-0 gp-0) (s3-0 (new 'stack-no-clear 'vector)) ) - (set! (-> s3-0 x) - (* 182.04445 (* 5.0 (sin (* 182.04445 (* 0.33333334 (the float (-> self clock frame-counter))))))) - ) + (set! (-> s3-0 x) (* 182.04445 (* 5.0 (sin (* 182.04445 (* 0.33333334 (the float (current-time)))))))) (set! (-> s3-0 y) - (* 182.04445 - (* 5.0 (sin (* 182.04445 (* 50.0 (+ 10.0 (* 0.0033333334 (the float (-> self clock frame-counter)))))))) - ) + (* 182.04445 (* 5.0 (sin (* 182.04445 (* 50.0 (+ 10.0 (* 0.0033333334 (the float (current-time))))))))) ) (set! (-> s3-0 z) 0.0) (set! (-> s3-0 w) 1.0) @@ -1507,10 +1497,9 @@ :trans (behavior () (set! (-> self root-override trans y) (+ (-> self trans-y) - (* 1024.0 - (+ (sin (* 182.04445 (* 150.0 (+ 10.0 (* 0.0033333334 (the float (-> self clock frame-counter))))))) - (cos (* 182.04445 (* -80.0 (- 40.0 (* 0.0033333334 (the float (-> self clock frame-counter))))))) - ) + (* 1024.0 (+ (sin (* 182.04445 (* 150.0 (+ 10.0 (* 0.0033333334 (the float (current-time))))))) + (cos (* 182.04445 (* -80.0 (- 40.0 (* 0.0033333334 (the float (current-time))))))) + ) ) ) ) @@ -1541,8 +1530,8 @@ (defstate die (ctyport-cargo) :virtual #t :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -1812,7 +1801,7 @@ ) (cond ((and (= (-> self count) (-> self max-count)) (zero? (-> self data-int32 22))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ((and (or (and (zero? (-> self data-int32 20)) (= (-> self count) (+ (-> self max-count) -1))) (= (-> self data-int32 22) 1) @@ -1823,7 +1812,7 @@ (set! (-> self data-int32 20) 1) (+! (-> self data-int32 22) 1) (set! (-> self time-limit) (seconds 135)) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (set! (-> self hud-counter) (ppointer->handle (process-spawn hud-cargo :init hud-init-by-other :to self))) ) ) @@ -1896,8 +1885,8 @@ (lambda :behavior task-manager () (send-event *traffic-manager* 'set-target-level #x3f800000) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (send-event *traffic-manager* 'set-alert-level 1) @@ -1912,7 +1901,7 @@ TASK_MANAGER_FAIL_HOOK (lambda :behavior task-manager () - (when (< (- (-> self time-limit) (- (-> self clock frame-counter) (-> self start-time))) 0) + (when (< (- (-> self time-limit) (- (current-time) (-> self start-time))) 0) (let ((gp-0 #f)) (dotimes (s5-0 (-> self max-count)) (when (zero? (-> self data-int32 s5-0)) @@ -1933,8 +1922,8 @@ ) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 2)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 2)) (suspend) ) ) @@ -1949,8 +1938,8 @@ TASK_MANAGER_COMPLETE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) (task-node-close! (game-task-node city-port-run-post-win)) 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 2c21742c2c..d2828e663b 100644 --- a/goal_src/jak2/levels/city/port/race/errol-chal.gc +++ b/goal_src/jak2/levels/city/port/race/errol-chal.gc @@ -787,7 +787,7 @@ (when (< f0-5 (* f1-0 f1-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! (-> self touch-time) (-> self clock frame-counter)) + (set! (-> self touch-time) (current-time)) (process-spawn part-tracker :init part-tracker-init @@ -819,7 +819,7 @@ :code (the-as (function none :behavior turbo-ring) sleep-code) :post (behavior () (if (and (-> self player-got) - (>= (- (-> self clock frame-counter) (-> self touch-time)) (seconds 3)) + (>= (- (current-time) (-> self touch-time)) (seconds 3)) (or (not *target*) (or (< 204800.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))) (focus-test? *target* teleporting) @@ -838,13 +838,13 @@ (defstate die (turbo-ring) :virtual #t :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-3 (-> self root-override root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) ) 0 - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (until (>= (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (none) @@ -874,26 +874,24 @@ ) (defmethod turbo-ring-method-23 turbo-ring ((obj turbo-ring)) - (with-pp - (let ((s5-0 (-> obj mat))) - (let ((s4-0 (new 'stack-no-clear 'quaternion))) - (quaternion-rotate-local-y! s4-0 (-> obj root-override quat) 16384.0) - (quaternion->matrix s5-0 s4-0) - ) - (set! (-> s5-0 trans quad) (-> obj root-override trans quad)) - (set! (-> obj plane quad) (-> s5-0 vector 0 quad)) + (let ((s5-0 (-> obj mat))) + (let ((s4-0 (new 'stack-no-clear 'quaternion))) + (quaternion-rotate-local-y! s4-0 (-> obj root-override quat) 16384.0) + (quaternion->matrix s5-0 s4-0) ) - (set! (-> obj plane w) (- (vector-dot (-> obj plane) (-> obj root-override trans)))) - (update-transforms (-> obj root-override)) - (set! (-> obj player-got) #f) - (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 1058) obj)) - (if (not (-> obj persistent)) - (set! (-> obj minimap) (add-icon! *minimap* obj (the-as uint 15) (the-as int #f) (the-as vector #t) 0)) - ) - (set! (-> obj touch-time) (-> pp clock frame-counter)) - 0 - (none) + (set! (-> s5-0 trans quad) (-> obj root-override trans quad)) + (set! (-> obj plane quad) (-> s5-0 vector 0 quad)) ) + (set! (-> obj plane w) (- (vector-dot (-> obj plane) (-> obj root-override trans)))) + (update-transforms (-> obj root-override)) + (set! (-> obj player-got) #f) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 1058) obj)) + (if (not (-> obj persistent)) + (set! (-> obj minimap) (add-icon! *minimap* obj (the-as uint 15) (the-as int #f) (the-as vector #t) 0)) + ) + (set! (-> obj touch-time) (current-time)) + 0 + (none) ) ;; WARN: Return type mismatch object vs none. @@ -1262,7 +1260,7 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (while (not (logtest? (-> *race-state* flags) 1)) (let ((f0-0 (-> self begin-pos w))) (if (< (* f0-0 f0-0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0))) @@ -1463,7 +1461,7 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (while (not (logtest? (-> *race-state* flags) 1)) (let ((f0-0 (-> self begin-pos w))) (if (< (* f0-0 f0-0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0))) diff --git a/goal_src/jak2/levels/city/side_missions/ctywide-bbush.gc b/goal_src/jak2/levels/city/side_missions/ctywide-bbush.gc index 32411b928c..ce2b52a5b5 100644 --- a/goal_src/jak2/levels/city/side_missions/ctywide-bbush.gc +++ b/goal_src/jak2/levels/city/side_missions/ctywide-bbush.gc @@ -371,7 +371,7 @@ (cond ((handle->process (-> self part-track)) (if (-> self keep-part-track-alive) - (set! (-> (the-as part-tracker (-> self part-track process 0)) start-time) (-> self clock frame-counter)) + (set! (-> (the-as part-tracker (-> self part-track process 0)) start-time) (current-time)) ) ) (else @@ -1490,7 +1490,7 @@ ) ) ) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (+! (-> self sub-state) 1) ) ) @@ -1512,7 +1512,7 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (none) @@ -1702,7 +1702,7 @@ (none) ) :trans (behavior () - (let ((f30-0 (+ (* 0.0033333334 (the float (-> self clock frame-counter))) (* 0.1 (the float (-> self pid)))))) + (let ((f30-0 (+ (* 0.0033333334 (the float (current-time))) (* 0.1 (the float (-> self pid)))))) (when (< (-> self beep-time) f30-0) (sound-play "homeing-beep") (set! (-> self beep-time) (+ 1.0 f30-0)) @@ -2638,7 +2638,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (set! (-> self time-limit) (-> gp-0 time)) ) (none) @@ -2681,7 +2681,7 @@ This commonly includes things such as: *game-info* (game-task-node city-burning-bush-collection-1-resolution) TASK_MANAGER_CODE_HOOK - (lambda :behavior task-manager () (set! (-> self state-time) (-> self clock frame-counter)) (none)) + (lambda :behavior task-manager () (set! (-> self state-time) (current-time)) (none)) ) (copy-hooks! @@ -2896,7 +2896,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (set! (-> self time-limit) (the-as time-frame (the int (+ 300.0 (-> *burning-bush-get-on-info* (-> self info index) time)))) ) @@ -2932,8 +2932,8 @@ This commonly includes things such as: ) (send-event *camera* 'teleport-to-transformq gp-0) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 3)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 3)) (suspend) ) ) diff --git a/goal_src/jak2/levels/city/slums/kor/kid-states.gc b/goal_src/jak2/levels/city/slums/kor/kid-states.gc index 2b248216e5..19cca5c234 100644 --- a/goal_src/jak2/levels/city/slums/kor/kid-states.gc +++ b/goal_src/jak2/levels/city/slums/kor/kid-states.gc @@ -13,7 +13,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -89,7 +89,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -251,7 +251,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -327,7 +327,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -357,12 +357,10 @@ ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) (kid-method-232 self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -396,7 +394,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -421,7 +419,7 @@ ) (go-virtual arrested) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + ((and (>= (- (current-time) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) (go-virtual traveling) ) ) @@ -456,7 +454,7 @@ (go-virtual arrested) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (not (nav-enemy-method-163 self)) (go-virtual traveling) ) @@ -534,7 +532,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -607,7 +605,7 @@ (ja-channel-push! 1 (seconds 0.1)) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (ja-no-eval :group! (-> self draw art-group data 16) :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 16)) frames num-frames) -1))) @@ -615,7 +613,7 @@ ) (until (ja-done? 0) (if (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + (>= (- (current-time) (-> self state-time)) (seconds 4)) (reset? *fail-mission-control*) ) (reset! *fail-mission-control*) diff --git a/goal_src/jak2/levels/city/slums/kor/kid.gc b/goal_src/jak2/levels/city/slums/kor/kid.gc index fee1986001..1bfe3db6fa 100644 --- a/goal_src/jak2/levels/city/slums/kor/kid.gc +++ b/goal_src/jak2/levels/city/slums/kor/kid.gc @@ -183,172 +183,168 @@ (defmethod general-event-handler kid ((obj kid) (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" - (with-pp - (case arg2 - (('arrest) - (let* ((s4-0 (handle->process (-> obj arrestor-handle))) - (v1-4 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) - (when (or (not v1-4) - (= v1-4 arg0) - (and (!= v1-4 arg0) (>= (- (-> pp clock frame-counter) (-> obj arrest-attempt-time)) (seconds 0.1))) - ) - (set! (-> obj arrestor-handle) (process->handle arg0)) - (set! (-> obj arrest-attempt-time) (-> pp clock frame-counter)) - 0 - ) + (case arg2 + (('arrest) + (let* ((s4-0 (handle->process (-> obj arrestor-handle))) + (v1-4 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (when (or (not v1-4) + (= v1-4 arg0) + (and (!= v1-4 arg0) (>= (- (current-time) (-> obj arrest-attempt-time)) (seconds 0.1))) + ) + (set! (-> obj arrestor-handle) (process->handle arg0)) + (set! (-> obj arrest-attempt-time) (current-time)) + 0 ) - #t ) - (('instant-arrest) - (set! (-> obj bot-flags) (logior (bot-flags bf20) (-> obj bot-flags))) - (let ((v1-18 (the-as object (-> arg3 param 0)))) - (set! (-> obj arrestor-handle) (process->handle (the-as process v1-18))) - (set! (-> obj arrest-attempt-time) (-> pp clock frame-counter)) - (let ((a1-8 (new 'stack-no-clear 'vector))) - (vector-! a1-8 (-> (the-as process-drawable v1-18) root trans) (-> obj root-override2 trans)) - (set! (-> a1-8 y) 0.0) - (forward-up->quaternion (-> obj root-override2 quat) a1-8 *up-vector*) - ) + #t + ) + (('instant-arrest) + (set! (-> obj bot-flags) (logior (bot-flags bf20) (-> obj bot-flags))) + (let ((v1-18 (the-as object (-> arg3 param 0)))) + (set! (-> obj arrestor-handle) (process->handle (the-as process v1-18))) + (set! (-> obj arrest-attempt-time) (current-time)) + (let ((a1-8 (new 'stack-no-clear 'vector))) + (vector-! a1-8 (-> (the-as process-drawable v1-18) root trans) (-> obj root-override2 trans)) + (set! (-> a1-8 y) 0.0) + (forward-up->quaternion (-> obj root-override2 quat) a1-8 *up-vector*) ) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) - (logclear! (-> obj mask) (process-mask collectable)) - (logclear! (-> obj enemy-flags) (enemy-flag look-at-move-dest)) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj enemy-flags) (enemy-flag notice)) - (send-event (handle->process (-> obj master-handle)) 'notify 'arrest #f) - (go (method-of-object obj arrested)) ) - (('attack) - ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) - #f - ) - (else - ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) - ) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> obj mask) (process-mask collectable)) + (logclear! (-> obj enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj enemy-flags) (enemy-flag notice)) + (send-event (handle->process (-> obj master-handle)) 'notify 'arrest #f) + (go (method-of-object obj arrested)) + ) + (('attack) + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) + #f + ) + (else + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) (defmethod enemy-method-97 kid ((obj kid)) - (with-pp - (let* ((s4-0 (handle->process (-> obj attacker-handle))) - (s5-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - (s3-0 (handle->process (-> obj arrestor-handle))) - (s4-1 (if (type? s3-0 process-focusable) - s3-0 - ) - ) + (let* ((s4-0 (handle->process (-> obj attacker-handle))) + (s5-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + (s3-0 (handle->process (-> obj arrestor-handle))) + (s4-1 (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + (when s5-0 + (cond + ((= (-> s5-0 type) target) + (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) + (>= (- (current-time) (-> obj attacker-time)) (seconds 1.5)) + ) + (if (logtest? (-> obj bot-flags) (bot-flags attacked)) + (reset-attacker! obj) + ) + (set! s5-0 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) - (when s5-0 - (cond - ((= (-> s5-0 type) target) - (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) - (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 1.5)) - ) - (if (logtest? (-> obj bot-flags) (bot-flags attacked)) - (reset-attacker! obj) - ) - (set! s5-0 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 6)) - (set! s5-0 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) + ) + (else + (when (>= (- (current-time) (-> obj attacker-time)) (seconds 6)) + (set! s5-0 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) ) ) - (when s4-1 - (when (or (>= (- (-> pp clock frame-counter) (-> obj arrest-attempt-time)) (seconds 0.5)) - (focus-test? (the-as process-focusable s4-1) dead hit) - ) - (set! s4-1 (the-as process #f)) - (set! (-> obj arrestor-handle) (the-as handle #f)) - ) - ) - (let ((v1-34 (-> obj focus-mode)) - (s3-1 (the-as process #f)) - ) - (cond - ((zero? v1-34) - (cond - (s4-1 - (set! s3-1 s4-1) - ) - (s5-0 - (set! s3-1 s5-0) - ) - ((begin (set! s3-1 (select-focus! obj)) s3-1) - (empty) - ) - (else - (let ((s5-1 (handle->process (-> obj poi-handle)))) - (set! s3-1 (if (type? s5-1 process-focusable) - s5-1 - ) - ) - ) - (if s3-1 - (empty) - (set! s3-1 *target*) - ) - ) - ) - ) - ((= v1-34 1) - (cond - (s4-1 - (set! s3-1 s4-1) - ) - (s5-0 - (set! s3-1 s5-0) - ) - (else - (let ((s5-2 (handle->process (-> obj poi-handle)))) - (set! s3-1 (if (type? s5-2 process-focusable) - s5-2 - ) - ) - ) - (cond - (s3-1 - (empty) - ) - ((begin (set! s3-1 (select-focus! obj)) s3-1) - (empty) - ) - (else - (set! s3-1 *target*) - ) - ) - ) - ) - ) - ) - (cond - (s3-1 - (try-update-focus (-> obj focus) (the-as process-focusable s3-1) obj) - (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> s3-1 type) target)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + (when s4-1 + (when (or (>= (- (current-time) (-> obj arrest-attempt-time)) (seconds 0.5)) + (focus-test? (the-as process-focusable s4-1) dead hit) ) - ) - (else - (clear-focused (-> obj focus)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) - ) - ) - s3-1 + (set! s4-1 (the-as process #f)) + (set! (-> obj arrestor-handle) (the-as handle #f)) ) ) + (let ((v1-34 (-> obj focus-mode)) + (s3-1 (the-as process #f)) + ) + (cond + ((zero? v1-34) + (cond + (s4-1 + (set! s3-1 s4-1) + ) + (s5-0 + (set! s3-1 s5-0) + ) + ((begin (set! s3-1 (select-focus! obj)) s3-1) + (empty) + ) + (else + (let ((s5-1 (handle->process (-> obj poi-handle)))) + (set! s3-1 (if (type? s5-1 process-focusable) + s5-1 + ) + ) + ) + (if s3-1 + (empty) + (set! s3-1 *target*) + ) + ) + ) + ) + ((= v1-34 1) + (cond + (s4-1 + (set! s3-1 s4-1) + ) + (s5-0 + (set! s3-1 s5-0) + ) + (else + (let ((s5-2 (handle->process (-> obj poi-handle)))) + (set! s3-1 (if (type? s5-2 process-focusable) + s5-2 + ) + ) + ) + (cond + (s3-1 + (empty) + ) + ((begin (set! s3-1 (select-focus! obj)) s3-1) + (empty) + ) + (else + (set! s3-1 *target*) + ) + ) + ) + ) + ) + ) + (cond + (s3-1 + (try-update-focus (-> obj focus) (the-as process-focusable s3-1) obj) + (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> s3-1 type) target)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + (else + (clear-focused (-> obj focus)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + s3-1 + ) ) ) diff --git a/goal_src/jak2/levels/city/slums/kor/kor-states.gc b/goal_src/jak2/levels/city/slums/kor/kor-states.gc index b010c06b54..1feaa26e92 100644 --- a/goal_src/jak2/levels/city/slums/kor/kor-states.gc +++ b/goal_src/jak2/levels/city/slums/kor/kor-states.gc @@ -11,7 +11,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kor) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -87,7 +87,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kor) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -260,7 +260,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kor) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -336,7 +336,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kor) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -366,12 +366,10 @@ ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) (kor-method-232 self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -405,7 +403,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kor) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -430,7 +428,7 @@ ) (go-virtual arrested) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + ((and (>= (- (current-time) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) (go-virtual traveling) ) ) @@ -465,7 +463,7 @@ (go-virtual arrested) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (not (nav-enemy-method-163 self)) (go-virtual traveling) ) @@ -543,7 +541,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kor) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -592,7 +590,7 @@ (ja-channel-push! 1 (seconds 0.25)) (cond ((and (not (logtest? (bot-flags bf20) (-> self bot-flags))) - (< (- (-> self clock frame-counter) (-> self arrest-attempt-time)) (seconds 0.8)) + (< (- (current-time) (-> self arrest-attempt-time)) (seconds 0.8)) ) (ja-no-eval :group! (-> self draw art-group data 4) :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) frames num-frames) -1))) @@ -631,7 +629,7 @@ (suspend) (ja :num! (seek!)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (ja-no-eval :group! (-> self draw art-group data 18) :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 18)) frames num-frames) -1))) @@ -639,7 +637,7 @@ ) (until (ja-done? 0) (if (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (>= (- (current-time) (-> self state-time)) (seconds 3)) (reset? *fail-mission-control*) ) (reset! *fail-mission-control*) diff --git a/goal_src/jak2/levels/city/slums/kor/kor.gc b/goal_src/jak2/levels/city/slums/kor/kor.gc index ce94f71df3..a42d025a10 100644 --- a/goal_src/jak2/levels/city/slums/kor/kor.gc +++ b/goal_src/jak2/levels/city/slums/kor/kor.gc @@ -192,167 +192,163 @@ (defmethod general-event-handler kor ((obj kor) (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" - (with-pp - (case arg2 - (('arrest) - (let* ((s4-0 (handle->process (-> obj arrestor-handle))) - (v1-4 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) - (when (or (not v1-4) - (= v1-4 arg0) - (and (!= v1-4 arg0) (>= (- (-> pp clock frame-counter) (-> obj arrest-attempt-time)) (seconds 0.1))) - ) - (set! (-> obj arrestor-handle) (process->handle arg0)) - (set! (-> obj arrest-attempt-time) (-> pp clock frame-counter)) - 0 - ) + (case arg2 + (('arrest) + (let* ((s4-0 (handle->process (-> obj arrestor-handle))) + (v1-4 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (when (or (not v1-4) + (= v1-4 arg0) + (and (!= v1-4 arg0) (>= (- (current-time) (-> obj arrest-attempt-time)) (seconds 0.1))) + ) + (set! (-> obj arrestor-handle) (process->handle arg0)) + (set! (-> obj arrest-attempt-time) (current-time)) + 0 ) - #t ) - (('instant-arrest) - (set! (-> obj bot-flags) (logior (bot-flags bf20) (-> obj bot-flags))) - (let ((v1-18 (the-as object (-> arg3 param 0)))) - (set! (-> obj arrestor-handle) (process->handle (the-as process v1-18))) - (set! (-> obj arrest-attempt-time) (-> pp clock frame-counter)) - (let ((a1-8 (new 'stack-no-clear 'vector))) - (vector-! a1-8 (-> (the-as process-drawable v1-18) root trans) (-> obj root-override2 trans)) - (set! (-> a1-8 y) 0.0) - (forward-up->quaternion (-> obj root-override2 quat) a1-8 *up-vector*) - ) + #t + ) + (('instant-arrest) + (set! (-> obj bot-flags) (logior (bot-flags bf20) (-> obj bot-flags))) + (let ((v1-18 (the-as object (-> arg3 param 0)))) + (set! (-> obj arrestor-handle) (process->handle (the-as process v1-18))) + (set! (-> obj arrest-attempt-time) (current-time)) + (let ((a1-8 (new 'stack-no-clear 'vector))) + (vector-! a1-8 (-> (the-as process-drawable v1-18) root trans) (-> obj root-override2 trans)) + (set! (-> a1-8 y) 0.0) + (forward-up->quaternion (-> obj root-override2 quat) a1-8 *up-vector*) ) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) - (logclear! (-> obj mask) (process-mask collectable)) - (logclear! (-> obj enemy-flags) (enemy-flag look-at-move-dest)) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj enemy-flags) (enemy-flag notice)) - (go (method-of-object obj arrested)) ) - (else - ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) - ) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> obj mask) (process-mask collectable)) + (logclear! (-> obj enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj enemy-flags) (enemy-flag notice)) + (go (method-of-object obj arrested)) + ) + (else + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) (defmethod enemy-method-97 kor ((obj kor)) - (with-pp - (let* ((s4-0 (handle->process (-> obj attacker-handle))) - (s5-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - (s3-0 (handle->process (-> obj arrestor-handle))) - (s4-1 (if (type? s3-0 process-focusable) - s3-0 - ) - ) + (let* ((s4-0 (handle->process (-> obj attacker-handle))) + (s5-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + (s3-0 (handle->process (-> obj arrestor-handle))) + (s4-1 (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + (when s5-0 + (cond + ((= (-> s5-0 type) target) + (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) + (>= (- (current-time) (-> obj attacker-time)) (seconds 1.5)) + ) + (if (logtest? (-> obj bot-flags) (bot-flags attacked)) + (reset-attacker! obj) + ) + (set! s5-0 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) - (when s5-0 - (cond - ((= (-> s5-0 type) target) - (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) - (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 1.5)) - ) - (if (logtest? (-> obj bot-flags) (bot-flags attacked)) - (reset-attacker! obj) - ) - (set! s5-0 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 6)) - (set! s5-0 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) + ) + (else + (when (>= (- (current-time) (-> obj attacker-time)) (seconds 6)) + (set! s5-0 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) ) ) - (when s4-1 - (when (or (>= (- (-> pp clock frame-counter) (-> obj arrest-attempt-time)) (seconds 0.5)) - (focus-test? (the-as process-focusable s4-1) dead hit) - ) - (set! s4-1 (the-as process #f)) - (set! (-> obj arrestor-handle) (the-as handle #f)) - ) - ) - (let ((v1-34 (-> obj focus-mode)) - (s3-1 (the-as process #f)) - ) - (cond - ((zero? v1-34) - (cond - (s4-1 - (set! s3-1 s4-1) - ) - (s5-0 - (set! s3-1 s5-0) - ) - ((begin (set! s3-1 (select-focus! obj)) s3-1) - (empty) - ) - (else - (let ((s5-1 (handle->process (-> obj poi-handle)))) - (set! s3-1 (if (type? s5-1 process-focusable) - s5-1 - ) - ) - ) - (if s3-1 - (empty) - (set! s3-1 *target*) - ) - ) - ) - ) - ((= v1-34 1) - (cond - (s4-1 - (set! s3-1 s4-1) - ) - (s5-0 - (set! s3-1 s5-0) - ) - (else - (let ((s5-2 (handle->process (-> obj poi-handle)))) - (set! s3-1 (if (type? s5-2 process-focusable) - s5-2 - ) - ) - ) - (cond - (s3-1 - (empty) - ) - ((begin (set! s3-1 (select-focus! obj)) s3-1) - (empty) - ) - (else - (set! s3-1 *target*) - ) - ) - ) - ) - ) - ) - (cond - (s3-1 - (try-update-focus (-> obj focus) (the-as process-focusable s3-1) obj) - (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> s3-1 type) target)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + (when s4-1 + (when (or (>= (- (current-time) (-> obj arrest-attempt-time)) (seconds 0.5)) + (focus-test? (the-as process-focusable s4-1) dead hit) ) - ) - (else - (clear-focused (-> obj focus)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) - ) - ) - s3-1 + (set! s4-1 (the-as process #f)) + (set! (-> obj arrestor-handle) (the-as handle #f)) ) ) + (let ((v1-34 (-> obj focus-mode)) + (s3-1 (the-as process #f)) + ) + (cond + ((zero? v1-34) + (cond + (s4-1 + (set! s3-1 s4-1) + ) + (s5-0 + (set! s3-1 s5-0) + ) + ((begin (set! s3-1 (select-focus! obj)) s3-1) + (empty) + ) + (else + (let ((s5-1 (handle->process (-> obj poi-handle)))) + (set! s3-1 (if (type? s5-1 process-focusable) + s5-1 + ) + ) + ) + (if s3-1 + (empty) + (set! s3-1 *target*) + ) + ) + ) + ) + ((= v1-34 1) + (cond + (s4-1 + (set! s3-1 s4-1) + ) + (s5-0 + (set! s3-1 s5-0) + ) + (else + (let ((s5-2 (handle->process (-> obj poi-handle)))) + (set! s3-1 (if (type? s5-2 process-focusable) + s5-2 + ) + ) + ) + (cond + (s3-1 + (empty) + ) + ((begin (set! s3-1 (select-focus! obj)) s3-1) + (empty) + ) + (else + (set! s3-1 *target*) + ) + ) + ) + ) + ) + ) + (cond + (s3-1 + (try-update-focus (-> obj focus) (the-as process-focusable s3-1) obj) + (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> s3-1 type) target)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + (else + (clear-focused (-> obj focus)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + s3-1 + ) ) ) diff --git a/goal_src/jak2/levels/city/slums/neon-baron-part.gc b/goal_src/jak2/levels/city/slums/neon-baron-part.gc index 857fbe882f..1ff43d8f4b 100644 --- a/goal_src/jak2/levels/city/slums/neon-baron-part.gc +++ b/goal_src/jak2/levels/city/slums/neon-baron-part.gc @@ -3285,16 +3285,16 @@ 600 (dotimes (gp-0 19) (let ((s5-0 (-> *neon-baron-flashing-acc* (* gp-0 2)))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 8) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame s5-0)) + (until (>= (- (current-time) (-> self state-time)) (the-as time-frame s5-0)) (suspend) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 9) (let ((s5-1 (-> *neon-baron-flashing-acc* (+ (* gp-0 2) 1)))) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame s5-1)) + (until (>= (- (current-time) (-> self state-time)) (the-as time-frame s5-1)) (suspend) ) ) @@ -3302,28 +3302,28 @@ ) ((zero? v1-2) (dotimes (gp-1 3) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 8) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 9) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) ) ) ((= v1-2 1) (dotimes (gp-2 3) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 8) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 9) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (suspend) ) ) @@ -3332,16 +3332,16 @@ 600 (dotimes (gp-3 19) (let ((s5-2 (-> *neon-baron-flashing-acc* (* gp-3 2)))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 3) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame s5-2)) + (until (>= (- (current-time) (-> self state-time)) (the-as time-frame s5-2)) (suspend) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 2) (let ((s5-3 (-> *neon-baron-flashing-acc* (+ (* gp-3 2) 1)))) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame s5-3)) + (until (>= (- (current-time) (-> self state-time)) (the-as time-frame s5-3)) (suspend) ) ) @@ -3349,28 +3349,28 @@ ) ((= v1-2 8) (dotimes (gp-4 3) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 3) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 2) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) ) ) ((= v1-2 9) (dotimes (gp-5 3) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 3) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 2) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (suspend) ) ) @@ -3454,8 +3454,8 @@ (set! (-> self flags) 1) (let ((gp-11 (rand-vu-int-range 3 6))) (dotimes (s5-9 gp-11) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) ) diff --git a/goal_src/jak2/levels/common/ai/bot-states.gc b/goal_src/jak2/levels/common/ai/bot-states.gc index 0bb1251cfb..aa523cae4d 100644 --- a/goal_src/jak2/levels/common/ai/bot-states.gc +++ b/goal_src/jak2/levels/common/ai/bot-states.gc @@ -95,7 +95,7 @@ (bot-method-191 self) (when (zero? (-> self hit-points)) (set! (-> self hit-points) 1) - (set! (-> self fated-time) (-> self clock frame-counter)) + (set! (-> self fated-time) (current-time)) ) (logclear! (-> self bot-flags) (bot-flags bf11)) (let ((t9-2 (-> (method-of-type nav-enemy knocked) enter))) @@ -124,7 +124,7 @@ (t9-0) ) ) - (when (and (logtest? (-> self bot-flags) (bot-flags bf12)) (!= (-> self state-time) (-> self clock frame-counter))) + (when (and (logtest? (-> self bot-flags) (bot-flags bf12)) (!= (-> self state-time) (current-time))) (logclear! (-> self bot-flags) (bot-flags bf12)) (play-attacked-speech self) ) @@ -221,7 +221,7 @@ :trans (behavior () ((-> (method-of-type bot die-falling) trans)) (if (channel-active? self (the-as uint 0)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (none) ) @@ -237,7 +237,7 @@ ) (until (ja-done? 0) (when (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (reset? *fail-mission-control*) ) (cleanup-for-death self) diff --git a/goal_src/jak2/levels/common/ai/bot.gc b/goal_src/jak2/levels/common/ai/bot.gc index cd0e7803f2..cb36457d20 100644 --- a/goal_src/jak2/levels/common/ai/bot.gc +++ b/goal_src/jak2/levels/common/ai/bot.gc @@ -321,7 +321,7 @@ (cond ((attacked-by-player? obj (the-as process-focusable s5-0)) (set! (-> obj attacker-handle) (process->handle s5-0)) - (set! (-> obj attacker-time) (-> self clock frame-counter)) + (set! (-> obj attacker-time) (current-time)) ) (else (logclear! (-> obj bot-flags) (bot-flags attacked)) @@ -338,7 +338,7 @@ (reset-attacker! obj) ) (set! (-> obj attacker-handle) (process->handle s5-0)) - (set! (-> obj attacker-time) (-> self clock frame-counter)) + (set! (-> obj attacker-time) (current-time)) ) ) ) @@ -433,132 +433,128 @@ (defmethod enemy-method-129 bot ((obj bot)) (local-vars (s5-1 process)) - (with-pp - (let ((s5-0 (-> obj focus))) - (cond - ((logtest? (enemy-flag actor-pause-backup) (-> obj enemy-flags)) - (set! s5-1 (handle->process (-> s5-0 handle))) - ) - (else - (enemy-method-97 obj) - (set! s5-1 (handle->process (-> s5-0 handle))) - ) + (let ((s5-0 (-> obj focus))) + (cond + ((logtest? (enemy-flag actor-pause-backup) (-> obj enemy-flags)) + (set! s5-1 (handle->process (-> s5-0 handle))) + ) + (else + (enemy-method-97 obj) + (set! s5-1 (handle->process (-> s5-0 handle))) ) ) - (let ((s4-0 #f)) - (when (or (logtest? (bot-flags bf18) (-> obj bot-flags)) - (and s5-1 (attacked-by-player? obj (the-as process-focusable s5-1))) - ) - (set! (-> obj danger-time) (-> pp clock frame-counter)) - (set! s4-0 #t) - ) - (when (nonzero? (-> obj swivel-joint-mod)) - (if (and s4-0 s5-1 (logtest? (-> obj bot-flags) (bot-flags bf11))) - (bot-method-222 obj (get-trans (the-as process-focusable s5-1) 3)) - (bot-method-221 obj) - ) - ) - ) - (none) ) + (let ((s4-0 #f)) + (when (or (logtest? (bot-flags bf18) (-> obj bot-flags)) + (and s5-1 (attacked-by-player? obj (the-as process-focusable s5-1))) + ) + (set! (-> obj danger-time) (current-time)) + (set! s4-0 #t) + ) + (when (nonzero? (-> obj swivel-joint-mod)) + (if (and s4-0 s5-1 (logtest? (-> obj bot-flags) (bot-flags bf11))) + (bot-method-222 obj (get-trans (the-as process-focusable s5-1) 3)) + (bot-method-221 obj) + ) + ) + ) + (none) ) (defmethod enemy-method-97 bot ((obj bot)) - (with-pp - (let* ((s5-0 (handle->process (-> obj attacker-handle))) - (v1-3 (if (type? s5-0 process-focusable) - s5-0 - ) - ) + (let* ((s5-0 (handle->process (-> obj attacker-handle))) + (v1-3 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when v1-3 + (cond + ((= (-> v1-3 type) target) + (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) + (>= (- (current-time) (-> obj attacker-time)) (seconds 1.5)) + ) + (if (logtest? (-> obj bot-flags) (bot-flags attacked)) + (reset-attacker! obj) + ) + (set! v1-3 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) - (when v1-3 - (cond - ((= (-> v1-3 type) target) - (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) - (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 1.5)) - ) - (if (logtest? (-> obj bot-flags) (bot-flags attacked)) - (reset-attacker! obj) - ) - (set! v1-3 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 6)) - (set! v1-3 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) + ) + (else + (when (>= (- (current-time) (-> obj attacker-time)) (seconds 6)) + (set! v1-3 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) ) ) - (let ((a0-21 (-> obj focus-mode)) - (s5-1 (the-as process #f)) - ) - (cond - ((zero? a0-21) - (cond - (v1-3 - (set! s5-1 v1-3) - ) - ((begin (set! s5-1 (select-focus! obj)) s5-1) - (empty) - ) - (else - (let ((s4-0 (handle->process (-> obj poi-handle)))) - (set! s5-1 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) - (if s5-1 - (empty) - (set! s5-1 *target*) - ) - ) - ) - ) - ((= a0-21 1) - (cond - (v1-3 - (set! s5-1 v1-3) - ) - (else - (let ((s4-1 (handle->process (-> obj poi-handle)))) - (set! s5-1 (if (type? s4-1 process-focusable) - s4-1 - ) - ) - ) - (cond - (s5-1 - (empty) - ) - ((begin (set! s5-1 (select-focus! obj)) s5-1) - (empty) - ) - (else - (set! s5-1 *target*) - ) - ) - ) - ) - ) + ) + (let ((a0-21 (-> obj focus-mode)) + (s5-1 (the-as process #f)) ) - (cond - (s5-1 - (try-update-focus (-> obj focus) (the-as process-focusable s5-1) obj) - (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> (the-as process-focusable s5-1) type) target)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) + (cond + ((zero? a0-21) + (cond + (v1-3 + (set! s5-1 v1-3) + ) + ((begin (set! s5-1 (select-focus! obj)) s5-1) + (empty) + ) + (else + (let ((s4-0 (handle->process (-> obj poi-handle)))) + (set! s5-1 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (if s5-1 + (empty) + (set! s5-1 *target*) + ) + ) + ) + ) + ((= a0-21 1) + (cond + (v1-3 + (set! s5-1 v1-3) + ) + (else + (let ((s4-1 (handle->process (-> obj poi-handle)))) + (set! s5-1 (if (type? s4-1 process-focusable) + s4-1 + ) + ) + ) + (cond + (s5-1 + (empty) + ) + ((begin (set! s5-1 (select-focus! obj)) s5-1) + (empty) ) - ) - (else - (clear-focused (-> obj focus)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) - ) - ) - s5-1 + (else + (set! s5-1 *target*) + ) + ) + ) + ) + ) ) + (cond + (s5-1 + (try-update-focus (-> obj focus) (the-as process-focusable s5-1) obj) + (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> (the-as process-focusable s5-1) type) target)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + (else + (clear-focused (-> obj focus)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + s5-1 ) ) ) @@ -739,205 +735,203 @@ "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 (v0-0 none)) - (with-pp - (let ((v1-0 arg2)) - (the-as - object - (cond - ((= v1-0 'track) - #f - ) - ((= v1-0 'combo) - #f - ) - ((= v1-0 'query) - (case (-> arg3 param 0) - (('waypoint) - (-> obj waypoint waypoint-id) - ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) + (let ((v1-0 arg2)) + (the-as + object + (cond + ((= v1-0 'track) + #f + ) + ((= v1-0 'combo) + #f + ) + ((= v1-0 'query) + (case (-> arg3 param 0) + (('waypoint) + (-> obj waypoint waypoint-id) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) - ((= v1-0 'request) - (case (-> arg3 param 0) - (('waypoint) - (set! (-> obj waypoint-request) (the-as int (-> arg3 param 1))) - #t + ) + ((= v1-0 'request) + (case (-> arg3 param 0) + (('waypoint) + (set! (-> obj waypoint-request) (the-as int (-> arg3 param 1))) + #t + ) + (('health-meter) + (cond + ((-> arg3 param 1) + (set! v0-0 (the-as none (logior (-> obj bot-flags) (bot-flags bf06)))) + (set! (-> obj bot-flags) (the-as bot-flags v0-0)) + ) + (else + (set! v0-0 (the-as none (logclear (-> obj bot-flags) (bot-flags bf06)))) + (set! (-> obj bot-flags) (the-as bot-flags v0-0)) + ) ) - (('health-meter) + v0-0 + ) + (('too-far-fail) + (when (not (logtest? (-> obj bot-flags) (bot-flags too-far-fail bf09))) + (logior! (-> obj bot-flags) (bot-flags bf09)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag check-water)) + (logclear! (-> obj mask) (process-mask collectable)) + (logclear! (-> obj enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj enemy-flags) (enemy-flag notice)) + (go (method-of-object obj failed)) + ) + ) + (('move-to-vehicle) + (let ((a0-19 (-> arg3 param 2))) (cond - ((-> arg3 param 1) - (set! v0-0 (the-as none (logior (-> obj bot-flags) (bot-flags bf06)))) - (set! (-> obj bot-flags) (the-as bot-flags v0-0)) - ) - (else - (set! v0-0 (the-as none (logclear (-> obj bot-flags) (bot-flags bf06)))) - (set! (-> obj bot-flags) (the-as bot-flags v0-0)) - ) - ) - v0-0 - ) - (('too-far-fail) - (when (not (logtest? (-> obj bot-flags) (bot-flags too-far-fail bf09))) - (logior! (-> obj bot-flags) (bot-flags bf09)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag check-water)) - (logclear! (-> obj mask) (process-mask collectable)) - (logclear! (-> obj enemy-flags) (enemy-flag look-at-move-dest)) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj enemy-flags) (enemy-flag notice)) - (go (method-of-object obj failed)) - ) - ) - (('move-to-vehicle) - (let ((a0-19 (-> arg3 param 2))) - (cond - ((>= (the-as int a0-19) 0) - (let ((v1-29 (the-as object (-> arg3 param 1)))) - (cond - ((focus-test? obj pilot) - (if (= (-> obj vehicle-seat-index) a0-19) - (= (the-as uint v1-29) (handle->process (-> obj vehicle-handle))) - ) - ) - (else - (set! (-> obj vehicle-seat-index) (the-as int a0-19)) - (set! (-> obj vehicle-handle) (process->handle (the-as uint v1-29))) - (logior! (-> obj bot-flags) (bot-flags bf15)) - #t - ) + ((>= (the-as int a0-19) 0) + (let ((v1-29 (the-as object (-> arg3 param 1)))) + (cond + ((focus-test? obj pilot) + (if (= (-> obj vehicle-seat-index) a0-19) + (= (the-as uint v1-29) (handle->process (-> obj vehicle-handle))) + ) + ) + (else + (set! (-> obj vehicle-seat-index) (the-as int a0-19)) + (set! (-> obj vehicle-handle) (process->handle (the-as uint v1-29))) + (logior! (-> obj bot-flags) (bot-flags bf15)) + #t ) ) ) - (else - (when (not (focus-test? obj pilot)) - (set! (-> obj vehicle-seat-index) -1) - (set! (-> obj vehicle-handle) (the-as handle #f)) - (logclear! (-> obj bot-flags) (bot-flags bf15)) - #t - ) - ) - ) - ) - ) - (('exit-vehicle) - (when (focus-test? obj pilot) - (let ((v1-43 (-> arg3 param 1)) - (s5-1 (-> arg3 param 2)) - ) - (cond - (v1-43 - (set! (-> obj bot-flags) (logior (bot-flags bf16) (-> obj bot-flags))) - (when (and (>= (the-as int s5-1) 0) (!= s5-1 (-> obj nav-mesh-index))) - (change-to (nav-mesh-from-res-tag (-> obj entity) 'nav-mesh-actor (the-as int s5-1)) obj) - (set! (-> obj nav-mesh-index) (the-as int s5-1)) - ) - ) - (else - (logclear! (-> obj bot-flags) (bot-flags bf16)) - ) - ) - ) - #t - ) - ) - (('slave-id) - (set! (-> obj slave-id) (the-as int (-> arg3 param 1))) - #t - ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - ) - ) - ((= v1-0 'notify) - (case (-> arg3 param 0) - (('attack) - (let ((s5-2 (-> arg3 param 1))) - (when (if (type? s5-2 process-focusable) - s5-2 - ) - (logior! (-> obj enemy-flags) (enemy-flag look-at-focus)) - (set! (-> obj hit-focus-time) (-> pp clock frame-counter)) - ) - ) - #t - ) - (('mission-failed) - (logior! (-> obj bot-flags) (bot-flags bf09)) - (logclear! (-> obj bot-flags) (bot-flags bf06)) - #t - ) - (('follow-dir) - (set! (-> obj follow-dir quad) (-> (the-as vector (-> arg3 param 1)) quad)) - #t - ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - ) - ) - ((= v1-0 'set-task) - (let ((a1-11 (/ (the-as int (-> arg3 param 0)) 8))) - (logior! (-> obj bot-task-bits) (ash 1 a1-11)) - ) - #t - ) - ((= v1-0 'clear-task) - (let ((a1-13 (/ (the-as int (-> arg3 param 0)) 8))) - (logclear! (-> obj bot-task-bits) (ash 1 a1-13)) - ) - #t - ) - ((= v1-0 'skip) - (skip-waypoint obj) - ) - ((= v1-0 'change-mode) - (when (= (-> arg3 param 0) 'grab) - (set! v0-0 (the-as none (alive? obj))) - (if (and (the-as symbol v0-0) (-> arg3 param 1)) - (logior! (-> obj focus-status) (focus-status grabbed)) ) - v0-0 - ) - ) - ((= v1-0 'end-mode) - (when (focus-test? obj grabbed) - (logclear! (-> obj focus-status) (focus-status grabbed)) - #t - ) - ) - ((= v1-0 'hide) - (cond - ((-> arg3 param 0) - (go (method-of-object obj hidden)) + (else + (when (not (focus-test? obj pilot)) + (set! (-> obj vehicle-seat-index) -1) + (set! (-> obj vehicle-handle) (the-as handle #f)) + (logclear! (-> obj bot-flags) (bot-flags bf15)) + #t + ) + ) + ) ) - (else - (if (and (-> obj next-state) (= (-> obj next-state name) 'hidden)) - (react-to-focus obj) - ) - ) + ) + (('exit-vehicle) + (when (focus-test? obj pilot) + (let ((v1-43 (-> arg3 param 1)) + (s5-1 (-> arg3 param 2)) + ) + (cond + (v1-43 + (set! (-> obj bot-flags) (logior (bot-flags bf16) (-> obj bot-flags))) + (when (and (>= (the-as int s5-1) 0) (!= s5-1 (-> obj nav-mesh-index))) + (change-to (nav-mesh-from-res-tag (-> obj entity) 'nav-mesh-actor (the-as int s5-1)) obj) + (set! (-> obj nav-mesh-index) (the-as int s5-1)) + ) + ) + (else + (logclear! (-> obj bot-flags) (bot-flags bf16)) + ) + ) + ) + #t + ) + ) + (('slave-id) + (set! (-> obj slave-id) (the-as int (-> arg3 param 1))) + #t + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) - ((= v1-0 'draw) - (cond - ((-> arg3 param 0) - (set! v0-0 (the-as none (logclear (-> obj draw status) (draw-control-status no-draw)))) - (set! (-> obj draw status) (the-as draw-control-status v0-0)) + ) + ((= v1-0 'notify) + (case (-> arg3 param 0) + (('attack) + (let ((s5-2 (-> arg3 param 1))) + (when (if (type? s5-2 process-focusable) + s5-2 + ) + (logior! (-> obj enemy-flags) (enemy-flag look-at-focus)) + (set! (-> obj hit-focus-time) (current-time)) + ) ) - (else - (set! v0-0 (the-as none (logior (-> obj draw status) (draw-control-status no-draw)))) - (set! (-> obj draw status) (the-as draw-control-status v0-0)) - ) + #t + ) + (('mission-failed) + (logior! (-> obj bot-flags) (bot-flags bf09)) + (logclear! (-> obj bot-flags) (bot-flags bf06)) + #t + ) + (('follow-dir) + (set! (-> obj follow-dir quad) (-> (the-as vector (-> arg3 param 1)) quad)) + #t + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) + ) + ) + ((= v1-0 'set-task) + (let ((a1-11 (/ (the-as int (-> arg3 param 0)) 8))) + (logior! (-> obj bot-task-bits) (ash 1 a1-11)) + ) + #t + ) + ((= v1-0 'clear-task) + (let ((a1-13 (/ (the-as int (-> arg3 param 0)) 8))) + (logclear! (-> obj bot-task-bits) (ash 1 a1-13)) + ) + #t + ) + ((= v1-0 'skip) + (skip-waypoint obj) + ) + ((= v1-0 'change-mode) + (when (= (-> arg3 param 0) 'grab) + (set! v0-0 (the-as none (alive? obj))) + (if (and (the-as symbol v0-0) (-> arg3 param 1)) + (logior! (-> obj focus-status) (focus-status grabbed)) + ) v0-0 ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ((= v1-0 'end-mode) + (when (focus-test? obj grabbed) + (logclear! (-> obj focus-status) (focus-status grabbed)) + #t + ) + ) + ((= v1-0 'hide) + (cond + ((-> arg3 param 0) + (go (method-of-object obj hidden)) ) + (else + (if (and (-> obj next-state) (= (-> obj next-state name) 'hidden)) + (react-to-focus obj) + ) + ) + ) + ) + ((= v1-0 'draw) + (cond + ((-> arg3 param 0) + (set! v0-0 (the-as none (logclear (-> obj draw status) (draw-control-status no-draw)))) + (set! (-> obj draw status) (the-as draw-control-status v0-0)) + ) + (else + (set! v0-0 (the-as none (logior (-> obj draw status) (draw-control-status no-draw)))) + (set! (-> obj draw status) (the-as draw-control-status v0-0)) + ) + ) + v0-0 + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1089,74 +1083,68 @@ (defmethod bot-check-too-far bot ((obj 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." - (with-pp - (let ((result 0)) - (let ((too-far-check (-> obj delay-too-far-check))) - (cond - ((> too-far-check 0) - (set! (-> obj delay-too-far-check) (+ too-far-check -1)) - ) - ((and (zero? too-far-check) *target* (not (logtest? (-> obj focus-status) (focus-status grabbed)))) - (let ((check-too-far-func (the-as object (-> obj waypoint check-too-far)))) - (if (not (the-as symbol check-too-far-func)) - (set! check-too-far-func (-> obj course default-check-too-far)) - ) - (when (the-as symbol check-too-far-func) - (cond - ((logtest? (the-as int check-too-far-func) 1) - (set! result ((the-as (function bot int) (-> (the-as symbol check-too-far-func) value)) obj)) - ) - ((= (rtype-of (the-as symbol check-too-far-func)) function) - (set! result ((the-as (function bot int) check-too-far-func) obj)) - ) - ) + (let ((result 0)) + (let ((too-far-check (-> obj delay-too-far-check))) + (cond + ((> too-far-check 0) + (set! (-> obj delay-too-far-check) (+ too-far-check -1)) + ) + ((and (zero? too-far-check) *target* (not (logtest? (-> obj focus-status) (focus-status grabbed)))) + (let ((check-too-far-func (the-as object (-> obj waypoint check-too-far)))) + (if (not (the-as symbol check-too-far-func)) + (set! check-too-far-func (-> obj course default-check-too-far)) + ) + (when (the-as symbol check-too-far-func) + (cond + ((logtest? (the-as int check-too-far-func) 1) + (set! result ((the-as (function bot int) (-> (the-as symbol check-too-far-func) value)) obj)) + ) + ((= (rtype-of (the-as symbol check-too-far-func)) function) + (set! result ((the-as (function bot int) check-too-far-func) obj)) + ) ) ) - (if (and (= result 1) - (nonzero? (-> obj started-warning-time)) - (>= (- (-> pp clock frame-counter) (-> obj started-warning-time)) - (the-as time-frame (-> obj warn-to-fail-timeout)) - ) - ) - (set! result 2) - ) - (case result - ((1) - (if (zero? (-> obj started-warning-time)) - (set! (-> obj started-warning-time) (-> pp clock frame-counter)) - ) - (if (and (>= (-> pp clock frame-counter) (-> obj next-too-far-warn-time)) (play-too-far-warn-speech obj)) - (set! (-> obj next-too-far-warn-time) - (+ (-> pp clock frame-counter) - (get-rand-int-range obj (the-as int (-> obj warn-min-delay)) (the-as int (-> obj warn-max-delay))) - ) - ) - ) - ) - ) ) - ) + (if (and (= result 1) + (nonzero? (-> obj started-warning-time)) + (>= (- (current-time) (-> obj started-warning-time)) (the-as time-frame (-> obj warn-to-fail-timeout))) + ) + (set! result 2) + ) + (case result + ((1) + (if (zero? (-> obj started-warning-time)) + (set! (-> obj started-warning-time) (current-time)) + ) + (if (and (>= (current-time) (-> obj next-too-far-warn-time)) (play-too-far-warn-speech obj)) + (set! (-> obj next-too-far-warn-time) + (+ (current-time) + (get-rand-int-range obj (the-as int (-> obj warn-min-delay)) (the-as int (-> obj warn-max-delay))) + ) + ) + ) + ) + ) + ) ) - (when (zero? result) - (set! (-> obj started-warning-time) 0) - 0 - ) - (= result 2) ) + (when (zero? result) + (set! (-> obj started-warning-time) 0) + 0 + ) + (= result 2) ) ) ;; WARN: Return type mismatch time-frame vs none. (defmethod reset-warn-time! bot ((obj bot)) - (with-pp - (set! (-> obj started-warning-time) 0) - (set! (-> obj next-too-far-warn-time) - (+ (-> pp clock frame-counter) - (get-rand-int-range obj (the-as int (-> obj warn-min-delay)) (the-as int (-> obj warn-max-delay))) - ) - ) - (none) - ) + (set! (-> obj started-warning-time) 0) + (set! (-> obj next-too-far-warn-time) + (+ (current-time) + (get-rand-int-range obj (the-as int (-> obj warn-min-delay)) (the-as int (-> obj warn-max-delay))) + ) + ) + (none) ) (defmethod track-target! bot ((obj bot)) @@ -1381,44 +1369,42 @@ If the player is too far, play a warning speech." (defmethod go-to-waypoint! bot ((obj bot) (id int) (skipped? symbol)) "Start moving to the given [[bot-waypoint]]." - (with-pp - (let* ((course (-> obj course)) - (waypoint-count (-> course waypoints length)) - ) - (dotimes (i waypoint-count) - (let ((waypoint (-> course waypoints i))) - (when (= (-> waypoint waypoint-id) id) - (set! (-> obj waypoint) waypoint) - (set! (-> obj waypoint-bits) (the-as uint 0)) - (set! (-> obj waypoint-time0) (-> pp clock frame-counter)) - (set! (-> obj too-far-warn-dist) (-> obj too-far-warn-dist-default)) - (set! (-> obj too-far-fail-dist-delta) (-> obj too-far-fail-dist-delta-default)) - (let ((mesh-idx (-> waypoint nav-mesh-index))) - (when (and (>= mesh-idx 0) (!= (-> obj nav-mesh-index) mesh-idx)) - (change-to (nav-mesh-from-res-tag (-> obj entity) 'nav-mesh-actor mesh-idx) obj) - (set! (-> obj nav-mesh-index) mesh-idx) - ) + (let* ((course (-> obj course)) + (waypoint-count (-> course waypoints length)) + ) + (dotimes (i waypoint-count) + (let ((waypoint (-> course waypoints i))) + (when (= (-> waypoint waypoint-id) id) + (set! (-> obj waypoint) waypoint) + (set! (-> obj waypoint-bits) (the-as uint 0)) + (set! (-> obj waypoint-time0) (current-time)) + (set! (-> obj too-far-warn-dist) (-> obj too-far-warn-dist-default)) + (set! (-> obj too-far-fail-dist-delta) (-> obj too-far-fail-dist-delta-default)) + (let ((mesh-idx (-> waypoint nav-mesh-index))) + (when (and (>= mesh-idx 0) (!= (-> obj nav-mesh-index) mesh-idx)) + (change-to (nav-mesh-from-res-tag (-> obj entity) 'nav-mesh-actor mesh-idx) obj) + (set! (-> obj nav-mesh-index) mesh-idx) ) - (when skipped? - (let ((on-skip (-> waypoint on-skipping-here))) - (when on-skip - (process-entity-status! obj (entity-perm-status no-kill) #t) - (on-skip obj) - ) - ) - ) - (let ((on-set (-> waypoint on-set))) - (if on-set - (on-set obj) - ) - ) - (return #f) ) + (when skipped? + (let ((on-skip (-> waypoint on-skipping-here))) + (when on-skip + (process-entity-status! obj (entity-perm-status no-kill) #t) + (on-skip obj) + ) + ) + ) + (let ((on-set (-> waypoint on-set))) + (if on-set + (on-set obj) + ) + ) + (return #f) ) ) ) - (go process-drawable-art-error "bad waypoint id") ) + (go process-drawable-art-error "bad waypoint id") ) ;; WARN: Return type mismatch object vs none. @@ -1540,88 +1526,86 @@ If the player is too far, play a warning speech." ) (defmethod bot-method-223 bot ((obj bot) (arg0 symbol)) - (with-pp - (let ((focus (-> obj focus-info)) - (timer (-> pp clock frame-counter)) - (focus-proc (handle->process (-> obj focus handle))) - ) - (when (or (!= timer (-> focus update-time)) (!= focus-proc (-> focus fproc))) - (set! (-> focus update-time) timer) - (set! (-> focus fproc) (the-as process-focusable focus-proc)) - (set! (-> focus los) 0) - (when focus-proc - (set! (-> focus pos quad) (-> (get-trans (the-as process-focusable focus-proc) 0) quad)) - (set! (-> focus bullseye quad) (-> (get-trans (the-as process-focusable focus-proc) 3) quad)) - (vector-z-quaternion! (-> focus my-facing-xz-dir) (-> obj root-override2 quat)) - (set! (-> focus my-facing-xz-dir y) 0.0) - (vector-normalize! (-> focus my-facing-xz-dir) 1.0) - (set! (-> focus my-facing-ry) (atan (-> focus my-facing-xz-dir x) (-> focus my-facing-xz-dir z))) - (vector-! (-> focus bullseye-xz-dir) (-> focus bullseye) (-> obj root-override2 trans)) - (let ((v1-11 (-> focus bullseye-xz-dir))) - (set! (-> focus bullseye-xz-dist) (sqrtf (+ (* (-> v1-11 x) (-> v1-11 x)) (* (-> v1-11 z) (-> v1-11 z))))) - ) - (set! (-> focus bullseye-xz-dir y) 0.0) - (vector-normalize! (-> focus bullseye-xz-dir) 1.0) - (set! (-> focus bullseye-ry) (atan (-> focus bullseye-xz-dir x) (-> focus bullseye-xz-dir z))) - (set! (-> focus ry-diff) (deg- (-> focus bullseye-ry) (-> focus my-facing-ry))) - ) + (let ((focus (-> obj focus-info)) + (timer (current-time)) + (focus-proc (handle->process (-> obj focus handle))) ) - (when (and arg0 focus-proc (zero? (-> focus los))) - (let ((cquery (new 'stack-no-clear 'collide-query))) - (set! (-> cquery start-pos quad) (-> obj root-override2 trans quad)) - (set! (-> cquery start-pos y) (+ 8192.0 (-> cquery start-pos y))) - (vector-! (-> cquery move-dist) (-> focus bullseye) (-> cquery start-pos)) - (let ((f0-19 (fmax 1.0 (+ -1638.4 (vector-length (-> cquery move-dist)))))) - (cond - ((< f0-19 (-> focus max-los-dist)) - (vector-normalize! (-> cquery move-dist) f0-19) - (let ((v1-23 cquery)) - (set! (-> v1-23 radius) 2048.0) - (set! (-> v1-23 collide-with) (collide-spec backgnd obstacle hit-by-others-list pusher)) - (set! (-> v1-23 ignore-process0) obj) - (set! (-> v1-23 ignore-process1) #f) - (set! (-> v1-23 ignore-pat) (-> obj root-override2 pat-ignore-mask)) - (set! (-> v1-23 action-mask) (collide-action solid)) - ) - (cond - ((>= (fill-and-probe-using-line-sphere *collide-cache* cquery) 0.0) - (set! (-> focus los) 3) - 0 - ) - (else - (let ((s3-3 1)) - (when (not (logtest? (-> obj bot-flags) (bot-flags attacked))) - (let ((a0-31 *target*)) - (when a0-31 - (vector+! (-> cquery move-dist) (-> cquery move-dist) (-> cquery start-pos)) - (if (>= 16384.0 (vector-segment-distance-point! - (get-trans a0-31 3) - (-> cquery start-pos) - (-> cquery move-dist) - (the-as vector #f) - ) - ) - (set! s3-3 4) - ) - ) + (when (or (!= timer (-> focus update-time)) (!= focus-proc (-> focus fproc))) + (set! (-> focus update-time) timer) + (set! (-> focus fproc) (the-as process-focusable focus-proc)) + (set! (-> focus los) 0) + (when focus-proc + (set! (-> focus pos quad) (-> (get-trans (the-as process-focusable focus-proc) 0) quad)) + (set! (-> focus bullseye quad) (-> (get-trans (the-as process-focusable focus-proc) 3) quad)) + (vector-z-quaternion! (-> focus my-facing-xz-dir) (-> obj root-override2 quat)) + (set! (-> focus my-facing-xz-dir y) 0.0) + (vector-normalize! (-> focus my-facing-xz-dir) 1.0) + (set! (-> focus my-facing-ry) (atan (-> focus my-facing-xz-dir x) (-> focus my-facing-xz-dir z))) + (vector-! (-> focus bullseye-xz-dir) (-> focus bullseye) (-> obj root-override2 trans)) + (let ((v1-11 (-> focus bullseye-xz-dir))) + (set! (-> focus bullseye-xz-dist) (sqrtf (+ (* (-> v1-11 x) (-> v1-11 x)) (* (-> v1-11 z) (-> v1-11 z))))) + ) + (set! (-> focus bullseye-xz-dir y) 0.0) + (vector-normalize! (-> focus bullseye-xz-dir) 1.0) + (set! (-> focus bullseye-ry) (atan (-> focus bullseye-xz-dir x) (-> focus bullseye-xz-dir z))) + (set! (-> focus ry-diff) (deg- (-> focus bullseye-ry) (-> focus my-facing-ry))) + ) + ) + (when (and arg0 focus-proc (zero? (-> focus los))) + (let ((cquery (new 'stack-no-clear 'collide-query))) + (set! (-> cquery start-pos quad) (-> obj root-override2 trans quad)) + (set! (-> cquery start-pos y) (+ 8192.0 (-> cquery start-pos y))) + (vector-! (-> cquery move-dist) (-> focus bullseye) (-> cquery start-pos)) + (let ((f0-19 (fmax 1.0 (+ -1638.4 (vector-length (-> cquery move-dist)))))) + (cond + ((< f0-19 (-> focus max-los-dist)) + (vector-normalize! (-> cquery move-dist) f0-19) + (let ((v1-23 cquery)) + (set! (-> v1-23 radius) 2048.0) + (set! (-> v1-23 collide-with) (collide-spec backgnd obstacle hit-by-others-list pusher)) + (set! (-> v1-23 ignore-process0) obj) + (set! (-> v1-23 ignore-process1) #f) + (set! (-> v1-23 ignore-pat) (-> obj root-override2 pat-ignore-mask)) + (set! (-> v1-23 action-mask) (collide-action solid)) + ) + (cond + ((>= (fill-and-probe-using-line-sphere *collide-cache* cquery) 0.0) + (set! (-> focus los) 3) + 0 + ) + (else + (let ((s3-3 1)) + (when (not (logtest? (-> obj bot-flags) (bot-flags attacked))) + (let ((a0-31 *target*)) + (when a0-31 + (vector+! (-> cquery move-dist) (-> cquery move-dist) (-> cquery start-pos)) + (if (>= 16384.0 (vector-segment-distance-point! + (get-trans a0-31 3) + (-> cquery start-pos) + (-> cquery move-dist) + (the-as vector #f) + ) + ) + (set! s3-3 4) + ) ) ) - (set! (-> focus los) s3-3) ) + (set! (-> focus los) s3-3) ) ) ) - (else - (set! (-> focus los) 2) - ) + ) + (else + (set! (-> focus los) 2) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; WARN: Return type mismatch float vs none. @@ -1869,77 +1853,71 @@ If the player is too far, play a warning speech." ;; WARN: Return type mismatch focus-status vs none. (defmethod bot-method-191 bot ((obj bot)) - (with-pp - (logior! (-> obj bot-flags) (bot-flags bf02)) - (set! (-> obj hit-invuln-starting-time) (-> pp clock frame-counter)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active)) - (if (nonzero? (-> obj hit-invuln-ignore-me-delay)) - (logior! (-> obj focus-status) (focus-status ignore)) - ) - (if (nonzero? (-> obj hit-invuln-focus-disable-delay)) - (logior! (-> obj focus-status) (focus-status disable)) - ) - (none) - ) + (logior! (-> obj bot-flags) (bot-flags bf02)) + (set! (-> obj hit-invuln-starting-time) (current-time)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active)) + (if (nonzero? (-> obj hit-invuln-ignore-me-delay)) + (logior! (-> obj focus-status) (focus-status ignore)) + ) + (if (nonzero? (-> obj hit-invuln-focus-disable-delay)) + (logior! (-> obj focus-status) (focus-status disable)) + ) + (none) ) ;; WARN: Return type mismatch bot-flags vs none. (defmethod bot-method-192 bot ((obj bot)) (local-vars (a2-7 enemy-flag)) - (with-pp - (let ((a1-0 (-> obj hit-invuln-starting-time)) - (v1-0 #t) - ) - (if (not (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active))) - (set! v1-0 (cond - ((>= (- (-> pp clock frame-counter) a1-0) (seconds 0.6)) - (let ((a2-6 (-> obj enemy-flags))) - (if (logtest? a2-6 (enemy-flag checking-water)) - (set! a2-7 (logior a2-6 (enemy-flag enable-on-active))) - (set! a2-7 (logclear a2-6 (enemy-flag enable-on-active))) - ) - ) - (set! (-> obj enemy-flags) a2-7) - v1-0 + (let ((a1-0 (-> obj hit-invuln-starting-time)) + (v1-0 #t) + ) + (if (not (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active))) + (set! v1-0 (cond + ((>= (- (current-time) a1-0) (seconds 0.6)) + (let ((a2-6 (-> obj enemy-flags))) + (if (logtest? a2-6 (enemy-flag checking-water)) + (set! a2-7 (logior a2-6 (enemy-flag enable-on-active))) + (set! a2-7 (logclear a2-6 (enemy-flag enable-on-active))) + ) ) - (else - #f - ) + (set! (-> obj enemy-flags) a2-7) + v1-0 + ) + (else + #f ) - ) - ) - (if (focus-test? obj ignore) - (set! v1-0 - (cond - ((>= (- (-> pp clock frame-counter) a1-0) (the-as time-frame (-> obj hit-invuln-ignore-me-delay))) - (logclear! (-> obj focus-status) (focus-status ignore)) - v1-0 - ) - (else - #f - ) - ) - ) - ) - (if (focus-test? obj disable) - (set! v1-0 - (cond - ((>= (- (-> pp clock frame-counter) a1-0) (the-as time-frame (-> obj hit-invuln-focus-disable-delay))) - (logclear! (-> obj focus-status) (focus-status disable)) - v1-0 - ) - (else - #f - ) - ) - ) - ) - (if v1-0 - (logclear! (-> obj bot-flags) (bot-flags bf02)) - ) - ) - (none) + ) + ) + ) + (if (focus-test? obj ignore) + (set! v1-0 (cond + ((>= (- (current-time) a1-0) (the-as time-frame (-> obj hit-invuln-ignore-me-delay))) + (logclear! (-> obj focus-status) (focus-status ignore)) + v1-0 + ) + (else + #f + ) + ) + ) + ) + (if (focus-test? obj disable) + (set! v1-0 (cond + ((>= (- (current-time) a1-0) (the-as time-frame (-> obj hit-invuln-focus-disable-delay))) + (logclear! (-> obj focus-status) (focus-status disable)) + v1-0 + ) + (else + #f + ) + ) + ) + ) + (if v1-0 + (logclear! (-> obj bot-flags) (bot-flags bf02)) + ) ) + (none) ) (defmethod bot-method-216 bot ((obj bot)) diff --git a/goal_src/jak2/levels/common/airlock.gc b/goal_src/jak2/levels/common/airlock.gc index bf72bd320a..15d1062153 100644 --- a/goal_src/jak2/levels/common/airlock.gc +++ b/goal_src/jak2/levels/common/airlock.gc @@ -174,7 +174,7 @@ (local-vars (a0-12 entity-actor)) (let* ((tgt (target-pos 0)) (f30-0 (check-crossing-distance obj tgt #t)) - (s5-0 (>= (-> obj latch-open-time) (-> self clock frame-counter))) + (s5-0 (>= (-> obj latch-open-time) (current-time))) ) (the-as symbol @@ -187,7 +187,7 @@ (if (and (not (-> obj were-behind?)) (and (< f30-0 0.0) (-> obj inner?))) (set! (-> obj were-behind?) #t) ) - (and (< (-> obj latch-closed-time) (-> self clock frame-counter)) + (and (< (-> obj latch-closed-time) (current-time)) (or (not (and *target* (focus-test? *target* pilot teleporting))) (< f30-0 -409.6)) (or (and (< f30-0 (-> obj open-distance)) (or (not (-> obj were-behind?)) (< f30-0 20480.0)) @@ -322,8 +322,8 @@ ) ) (cond - ((and gp-0 (>= (- (-> self clock frame-counter) (-> obj spool-sound-time)) (seconds 2))) - (set! (-> obj spool-sound-time) (-> self clock frame-counter)) + ((and gp-0 (>= (- (current-time) (-> obj spool-sound-time)) (seconds 2))) + (set! (-> obj spool-sound-time) (current-time)) (add-process *gui-control* obj @@ -359,10 +359,10 @@ object (case event-type (('close) - (set! (-> self latch-closed-time) (+ (-> self clock frame-counter) (if (>= arg1 1) - (the-as int (-> event param 0)) - 3000 - ) + (set! (-> self latch-closed-time) (+ (current-time) (if (>= arg1 1) + (the-as int (-> event param 0)) + 3000 + ) ) ) (if (and (>= arg1 2) (and (= (-> event param 1) #t) (not (want-cross-airlock? self)))) @@ -371,10 +371,10 @@ (and (-> self next-state) (= (-> self next-state name) 'open)) ) (('open) - (set! (-> self latch-open-time) (+ (-> self clock frame-counter) (if (>= arg1 1) - (the-as int (-> event param 0)) - 3000 - ) + (set! (-> self latch-open-time) (+ (current-time) (if (>= arg1 1) + (the-as int (-> event param 0)) + 3000 + ) ) ) (if (and (>= arg1 2) (and (= (-> event param 1) #t) (want-cross-airlock? self) (destination-loaded? self #f))) @@ -804,7 +804,7 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (stack-size-set! (-> obj main-thread) 1024) + (stack-size-set! (-> obj main-thread) 1024) ;; added (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 penetrated-by) (penetrate)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) @@ -875,7 +875,7 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (stack-size-set! (-> obj main-thread) 1024) + (stack-size-set! (-> obj main-thread) 1024) ;; added (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 penetrated-by) (penetrate)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) @@ -959,7 +959,7 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (stack-size-set! (-> obj main-thread) 1024) + (stack-size-set! (-> obj main-thread) 1024) ;; added (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 penetrated-by) (penetrate)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) @@ -1027,7 +1027,7 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (stack-size-set! (-> obj main-thread) 1024) + (stack-size-set! (-> obj main-thread) 1024) ;; added (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 penetrated-by) (penetrate)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) @@ -1097,7 +1097,7 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (stack-size-set! (-> obj main-thread) 1024) + (stack-size-set! (-> obj main-thread) 1024) ;; added (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 penetrated-by) (penetrate)) (let ((v1-2 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) @@ -1162,7 +1162,7 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (stack-size-set! (-> obj main-thread) 1024) + (stack-size-set! (-> obj main-thread) 1024) ;; added (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 penetrated-by) (penetrate)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) @@ -1231,7 +1231,7 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (stack-size-set! (-> obj main-thread) 1024) + (stack-size-set! (-> obj main-thread) 1024) ;; added (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 penetrated-by) (penetrate)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) @@ -1366,7 +1366,7 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (stack-size-set! (-> obj main-thread) 1024) + (stack-size-set! (-> obj main-thread) 1024) ;; added (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 penetrated-by) (penetrate)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) diff --git a/goal_src/jak2/levels/common/battle.gc b/goal_src/jak2/levels/common/battle.gc index 9d410ef7f3..9bfc6aa249 100644 --- a/goal_src/jak2/levels/common/battle.gc +++ b/goal_src/jak2/levels/common/battle.gc @@ -1097,64 +1097,62 @@ ) (defmethod battle-method-39 battle ((obj battle) (arg0 battle-spawner) (arg1 symbol)) - (with-pp - (let ((s3-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'quaternion)) - (s2-0 (-> arg0 intro-path)) - ) - (cond - (s2-0 - (let ((s1-0 0)) - (when arg1 - (set! s1-0 (-> arg0 ready-index)) - (set! s1-0 (cond - ((>= s1-0 0) - (empty) - s1-0 - ) - (else - (-> arg0 attack-index) - ) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'quaternion)) + (s2-0 (-> arg0 intro-path)) + ) + (cond + (s2-0 + (let ((s1-0 0)) + (when arg1 + (set! s1-0 (-> arg0 ready-index)) + (set! s1-0 (cond + ((>= s1-0 0) + (empty) + s1-0 + ) + (else + (-> arg0 attack-index) ) - ) - ) - (set! (-> arg0 creature-index) s1-0) - (get-point-in-path! s2-0 s3-0 (the float s1-0) 'exact) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (displacement-between-two-points-normalized! s2-0 s0-0 (the float s1-0)) - (set! (-> s0-0 y) 0.0) - (vector-normalize! s0-0 1.0) - (forward-up->quaternion s4-0 s0-0 *up-vector*) - ) + ) + ) ) - ) - (else - (set! (-> arg0 creature-index) 0) - (let ((v1-7 (-> arg0 entity))) - (set! (-> s3-0 quad) (-> v1-7 extra trans quad)) - (quaternion-copy! s4-0 (-> v1-7 quat)) + (set! (-> arg0 creature-index) s1-0) + (get-point-in-path! s2-0 s3-0 (the float s1-0) 'exact) + (let ((s0-0 (new 'stack-no-clear 'vector))) + (displacement-between-two-points-normalized! s2-0 s0-0 (the float s1-0)) + (set! (-> s0-0 y) 0.0) + (vector-normalize! s0-0 1.0) + (forward-up->quaternion s4-0 s0-0 *up-vector*) ) ) ) - (let ((s1-1 (new 'stack-no-clear 'transformq)) - (s2-1 (!= s2-0 #f)) - (s0-1 (battle-method-41 obj arg0)) - ) - (set! (-> s1-1 trans quad) (-> s3-0 quad)) - (quaternion-copy! (-> s1-1 quat) s4-0) - (set! (-> s1-1 scale x) (the-as float (-> arg0 entity))) - (set! (-> s1-1 scale y) (the-as float #t)) - (set! (-> s1-1 scale z) (the-as float s2-1)) - (let ((v0-7 (battle-method-38 obj s0-1 s1-1))) - (when (handle->process v0-7) - (set! (-> arg0 creature) v0-7) - (set! (-> arg0 mode) (the-as uint 1)) - (set! (-> arg0 last-spawn-time) (-> pp clock frame-counter)) - ) - v0-7 + (else + (set! (-> arg0 creature-index) 0) + (let ((v1-7 (-> arg0 entity))) + (set! (-> s3-0 quad) (-> v1-7 extra trans quad)) + (quaternion-copy! s4-0 (-> v1-7 quat)) ) ) ) + (let ((s1-1 (new 'stack-no-clear 'transformq)) + (s2-1 (!= s2-0 #f)) + (s0-1 (battle-method-41 obj arg0)) + ) + (set! (-> s1-1 trans quad) (-> s3-0 quad)) + (quaternion-copy! (-> s1-1 quat) s4-0) + (set! (-> s1-1 scale x) (the-as float (-> arg0 entity))) + (set! (-> s1-1 scale y) (the-as float #t)) + (set! (-> s1-1 scale z) (the-as float s2-1)) + (let ((v0-7 (battle-method-38 obj s0-1 s1-1))) + (when (handle->process v0-7) + (set! (-> arg0 creature) v0-7) + (set! (-> arg0 mode) (the-as uint 1)) + (set! (-> arg0 last-spawn-time) (current-time)) + ) + v0-7 + ) + ) ) ) @@ -1188,10 +1186,10 @@ (let ((v1-5 (-> arg0 noticed-attack-time))) (cond ((zero? v1-5) - (set! (-> arg0 noticed-attack-time) (-> self clock frame-counter)) + (set! (-> arg0 noticed-attack-time) (current-time)) ) (else - (if (>= (- (-> self clock frame-counter) v1-5) (the-as time-frame (-> arg0 notice-attack-delay))) + (if (>= (- (current-time) v1-5) (the-as time-frame (-> arg0 notice-attack-delay))) (logior! (-> arg0 flags) 1) ) ) @@ -1389,7 +1387,7 @@ :virtual #t :event battle-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval (the-as pair gp-0) :vector (-> self root trans)) @@ -1446,84 +1444,82 @@ ) (defmethod battle-method-50 battle ((obj battle)) - (with-pp - (let ((s5-0 (battle-method-52 obj)) - (v1-2 (battle-method-49 obj)) - (a1-0 (-> obj child)) - (a0-3 0) - ) - (while a1-0 - (+! a0-3 1) - (set! a1-0 (-> a1-0 0 brother)) - (nop!) - (nop!) + (let ((s5-0 (battle-method-52 obj)) + (v1-2 (battle-method-49 obj)) + (a1-0 (-> obj child)) + (a0-3 0) ) - (set! (-> obj stat-child-count) (the-as uint a0-3)) - (let ((a0-4 (+ v1-2 a0-3)) - (v1-4 (-> obj max-count)) + (while a1-0 + (+! a0-3 1) + (set! a1-0 (-> a1-0 0 brother)) + (nop!) + (nop!) + ) + (set! (-> obj stat-child-count) (the-as uint a0-3)) + (let ((a0-4 (+ v1-2 a0-3)) + (v1-4 (-> obj max-count)) + ) + (when (zero? a0-4) + (if (or (logtest? (-> obj flags) 4) (>= (-> obj die-count) v1-4)) + (return #t) ) - (when (zero? a0-4) - (if (or (logtest? (-> obj flags) 4) (>= (-> obj die-count) v1-4)) - (return #t) + ) + (set! (-> obj flags) (logand -9 (-> obj flags))) + (cond + ((and (> s5-0 0) (>= s5-0 (the-as int (- v1-4 (-> obj die-count))))) + (let ((a1-14 (-> obj jammed-starting-time))) + (cond + ((zero? (-> obj jammed-starting-time)) + (set! (-> obj jammed-starting-time) (current-time)) ) + (else + (if (>= (- (current-time) a1-14) (seconds 3.5)) + (logior! (-> obj flags) 8) + ) + ) + ) + ) + ) + (else + (set! (-> obj jammed-starting-time) 0) + 0 ) - (set! (-> obj flags) (logand -9 (-> obj flags))) - (cond - ((and (> s5-0 0) (>= s5-0 (the-as int (- v1-4 (-> obj die-count))))) - (let ((a1-14 (-> obj jammed-starting-time))) + ) + (cond + ((and (not (logtest? (-> obj flags) 4)) + (> (-> obj spawners length) 0) + (< a0-4 (the-as int (-> obj info desired-alive-count))) + (< (-> obj count) v1-4) + ) + (when (>= (- (current-time) (-> obj cant-spawn-time)) (the-as time-frame (-> obj next-spawn-delay))) + (let ((a1-29 (battle-method-36 obj))) (cond - ((zero? (-> obj jammed-starting-time)) - (set! (-> obj jammed-starting-time) (-> pp clock frame-counter)) - ) + (a1-29 + (battle-method-39 obj a1-29 #f) + (set! (-> obj next-spawn-delay) (the-as uint (battle-method-35 obj))) + (set! (-> obj cant-spawn-time) (current-time)) + ) (else - (if (>= (- (-> pp clock frame-counter) a1-14) (seconds 3.5)) - (logior! (-> obj flags) 8) - ) + (set! (-> obj cant-spawn-time) (current-time)) ) ) ) ) - (else - (set! (-> obj jammed-starting-time) 0) - 0 - ) - ) - (cond - ((and (not (logtest? (-> obj flags) 4)) - (> (-> obj spawners length) 0) - (< a0-4 (the-as int (-> obj info desired-alive-count))) - (< (-> obj count) v1-4) - ) - (when (>= (- (-> pp clock frame-counter) (-> obj cant-spawn-time)) (the-as time-frame (-> obj next-spawn-delay))) - (let ((a1-29 (battle-method-36 obj))) - (cond - (a1-29 - (battle-method-39 obj a1-29 #f) - (set! (-> obj next-spawn-delay) (the-as uint (battle-method-35 obj))) - (set! (-> obj cant-spawn-time) (-> pp clock frame-counter)) - ) - (else - (set! (-> obj cant-spawn-time) (-> pp clock frame-counter)) - ) - ) - ) - ) - ) - (else - (set! (-> obj cant-spawn-time) (-> pp clock frame-counter)) - ) + ) + (else + (set! (-> obj cant-spawn-time) (current-time)) ) ) ) - #f ) + #f ) (defstate hostile (battle) :virtual #t :event battle-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self flags) 2) (set! (-> self flags) (logand -9 (-> self flags))) (set! (-> self jammed-starting-time) 0) diff --git a/goal_src/jak2/levels/common/enemy/amphibian/amphibian.gc b/goal_src/jak2/levels/common/enemy/amphibian/amphibian.gc index cb912dcc52..cb9ba574e2 100644 --- a/goal_src/jak2/levels/common/enemy/amphibian/amphibian.gc +++ b/goal_src/jak2/levels/common/enemy/amphibian/amphibian.gc @@ -1028,8 +1028,8 @@ :virtual #t :code (behavior () (until #f - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.067)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1.067)) (amphibian-method-187 self) (suspend) ) @@ -1089,7 +1089,7 @@ 0 (nav-enemy-method-165 self) (ja-no-eval :num! (loop!)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.067)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1.067)) (amphibian-method-187 self) (suspend) ) @@ -1675,7 +1675,7 @@ :event (the-as (function process int symbol event-message-block object :behavior amphibian) enemy-event-handler) :enter (behavior () ((-> (method-of-type nav-enemy hostile) enter)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-4 nav callback-info) *nav-enemy-null-callback-info*) @@ -1702,7 +1702,7 @@ (let ((v1-0 (-> self tongue-mode))) (cond ((zero? v1-0) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.8)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.8)) (set! (-> self tongue-mode) (the-as uint 1)) (sound-play "tongue-attack") ) diff --git a/goal_src/jak2/levels/common/enemy/baby_spider/tomb-baby-spider.gc b/goal_src/jak2/levels/common/enemy/baby_spider/tomb-baby-spider.gc index c2f6edc869..170497cc4a 100644 --- a/goal_src/jak2/levels/common/enemy/baby_spider/tomb-baby-spider.gc +++ b/goal_src/jak2/levels/common/enemy/baby_spider/tomb-baby-spider.gc @@ -468,7 +468,7 @@ 0 ) (ja-channel-push! 1 (seconds 0.2)) - (let ((gp-3 (-> self clock frame-counter)) + (let ((gp-3 (current-time)) (s5-1 (the int (* 300.0 (rand-vu-float-range 0.6 1.2)))) (f30-2 1.0) ) @@ -476,7 +476,7 @@ :num! (loop! f30-2) :frame-num 0.0 ) - (until (>= (- (-> self clock frame-counter) gp-3) s5-1) + (until (>= (- (current-time) gp-3) s5-1) (suspend) (ja :num! (loop! f30-2)) ) diff --git a/goal_src/jak2/levels/common/enemy/bombots/bombbot.gc b/goal_src/jak2/levels/common/enemy/bombots/bombbot.gc index a1d6418a80..10e7cc2641 100644 --- a/goal_src/jak2/levels/common/enemy/bombots/bombbot.gc +++ b/goal_src/jak2/levels/common/enemy/bombots/bombbot.gc @@ -855,7 +855,7 @@ (let ((f30-0 0.4)) (vector-normalize! s2-0 1.0) (let ((s1-0 (-> obj feet s4-0))) - (let* ((f0-10 (+ (* 0.0033333334 (the float (mod (-> pp clock frame-counter) 300))) (-> s1-0 offset))) + (let* ((f0-10 (+ (* 0.0033333334 (the float (mod (current-time) 300))) (-> s1-0 offset))) (f28-0 (- f0-10 (* (the float (the int (/ f0-10 1.0))) 1.0))) (s0-0 (new 'stack-no-clear 'vector)) ) @@ -1868,14 +1868,14 @@ (init-vf0-vector) (when (>= (the int (* 30.0 (-> self shield-hit-points))) (-> self hit-points)) ) - (when (< (the-as time-frame (-> self next-target)) (-> self clock frame-counter)) + (when (< (the-as time-frame (-> self next-target)) (current-time)) (let ((a1-0 (new 'stack-no-clear 'vector))) (set! (-> a1-0 quad) (-> self root-override2 trans quad)) (set! (-> a1-0 w) 122880.0) (bombbot-method-181 self a1-0) ) - (set! (-> self next-target) (the-as uint (+ (-> self clock frame-counter) (seconds 2)))) - (set! (-> self start-target) (the-as uint (-> self clock frame-counter))) + (set! (-> self next-target) (the-as uint (+ (current-time) (seconds 2)))) + (set! (-> self start-target) (the-as uint (current-time))) ) (let ((gp-0 (handle->process (-> self focus handle)))) (let ((f30-0 1.0)) @@ -1891,7 +1891,7 @@ (let ((a1-6 (-> self target-pos))) (let ((v1-34 (-> self start-target-pos))) (let ((a0-14 (-> self start-target-vel))) - (let ((a2-8 (* 0.0033333334 (the float (- (-> self clock frame-counter) (the-as int (-> self start-target))))))) + (let ((a2-8 (* 0.0033333334 (the float (- (current-time) (the-as int (-> self start-target))))))) (.mov vf7 a2-8) ) (.lvf vf5 (&-> a0-14 quad)) @@ -1904,7 +1904,7 @@ (.svf (&-> a1-6 quad) vf6) ) (cond - ((< (the-as time-frame (+ (-> self next-target) -300)) (-> self clock frame-counter)) + ((< (the-as time-frame (+ (-> self next-target) -300)) (current-time)) (bombbot-method-182 self) ) (else @@ -1956,7 +1956,7 @@ ) ) (if (= (vector-length (-> self root-override2 transv)) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (set! (-> self last-head-roty-speed) (-> self head-roty-speed)) (set! (-> self head-roty-speed) (vector-y-angle (-> self node-list data 4 bone transform vector 2))) @@ -2088,7 +2088,7 @@ ) (set! (-> self explosing) #f) (set! (-> self beep-time) 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -2098,28 +2098,26 @@ ) ) 0 - (if (>= (- (-> self clock frame-counter) (-> self state-time)) 0) + (if (>= (- (current-time) (-> self state-time)) 0) (seek! (-> self legs-strength 0) 0.8 (* 10.0 (-> self clock seconds-per-frame))) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.8)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.8)) (seek! (-> self legs-strength 3) 0.4 (* 10.0 (-> self clock seconds-per-frame))) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.6)) + (if (>= (- (current-time) (-> self state-time)) (seconds 1.6)) (seek! (-> self legs-strength 1) 0.0 (* 10.0 (-> self clock seconds-per-frame))) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2.4)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2.4)) (seek! (-> self legs-strength 2) 0.5 (* 10.0 (-> self clock seconds-per-frame))) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2.8)) + (when (>= (- (current-time) (-> self state-time)) (seconds 2.8)) (sound-play "bb-explode") (go-virtual explode) ) - (when (< (-> self beep-time) (-> self clock frame-counter)) + (when (< (-> self beep-time) (current-time)) (sound-play "bb-beep") (set! (-> self beep-time) - (+ (-> self clock frame-counter) - (the int (* 0.2 (the float (- (seconds 2.8) (- (-> self clock frame-counter) (-> self state-time)))))) - ) + (+ (current-time) (the int (* 0.2 (the float (- (seconds 2.8) (- (current-time) (-> self state-time))))))) ) ) (none) @@ -2153,7 +2151,7 @@ (set! (-> self minimap) #f) ) (set! (-> self explosing) #f) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 1)))) (set! (-> gp-0 fountain-rand-transv-lo quad) (-> self root-override2 trans quad)) (set! (-> gp-0 duration) (seconds 3)) @@ -3152,7 +3150,7 @@ TASK_MANAGER_COMPLETE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (talker-spawn-func (-> *talker-speech* 117) *entity-pool* (target-pos 0) (the-as region #f)) (none) ) @@ -3173,8 +3171,8 @@ ((= (level-status *level* 'ctysluma) 'active) (set-setting! 'entity-name "camera-236" 0.0 0) (set-setting! 'minimap 'clear 0.0 (minimap-flag minimap)) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (add-process *gui-control* self (gui-channel sig) (gui-action play) "bbotxplo" -99.0 0) @@ -3190,8 +3188,8 @@ ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.3)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 0.3)) (suspend) ) (setup @@ -3201,7 +3199,7 @@ (-> self clock seconds-per-frame) (bucket-id tex-all-map) ) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (while (< (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) (set-setting! 'interp-time 'abs 0.0 0) @@ -3297,7 +3295,7 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (suspend) ) diff --git a/goal_src/jak2/levels/common/enemy/bouncer.gc b/goal_src/jak2/levels/common/enemy/bouncer.gc index 181827b23b..05136000cf 100644 --- a/goal_src/jak2/levels/common/enemy/bouncer.gc +++ b/goal_src/jak2/levels/common/enemy/bouncer.gc @@ -138,7 +138,7 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('touch) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) #f ) (else @@ -147,10 +147,10 @@ ) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self smush) 0.0) (until #f - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.2)) (ja :num! (seek! 0.0 0.1)) (ja :num! (seek! (lerp-scale diff --git a/goal_src/jak2/levels/common/enemy/fodder/fodder.gc b/goal_src/jak2/levels/common/enemy/fodder/fodder.gc index 674c11ffd9..d00fbe325b 100644 --- a/goal_src/jak2/levels/common/enemy/fodder/fodder.gc +++ b/goal_src/jak2/levels/common/enemy/fodder/fodder.gc @@ -270,52 +270,50 @@ (defmethod fodder-method-180 fodder ((obj fodder)) "@TODO no idea, never seems to do anything because the actor-group-count is always 0" - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> obj look-at-other-time)) (seconds 0.25)) - (dotimes (group-idx (-> obj actor-group-count)) - (let ((group (-> obj 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) - ) - ) - ) - (when (and fodder-proc - (!= fodder-proc obj) - (>= (- (-> pp clock frame-counter) (-> fodder-proc look-at-other-time)) (seconds 0.25)) - ) - (let* ((dir-to-other-fodder - (vector-! (new 'stack-no-clear 'vector) (-> fodder-proc root-override2 trans) (-> obj root-override2 trans)) - ) - (dir-length (vector-length dir-to-other-fodder)) + (when (>= (- (current-time) (-> obj look-at-other-time)) (seconds 0.25)) + (dotimes (group-idx (-> obj actor-group-count)) + (let ((group (-> obj 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) + ) + ) + ) + (when (and fodder-proc + (!= fodder-proc obj) + (>= (- (current-time) (-> fodder-proc look-at-other-time)) (seconds 0.25)) ) - (when (< dir-length 8192.0) - (vector-float*! dir-to-other-fodder dir-to-other-fodder (/ 1.0 dir-length)) - (let ((f30-0 (vector-dot - dir-to-other-fodder - (-> (quaternion->matrix (new 'stack-no-clear 'matrix) (-> obj root-override2 quat)) vector 2) - ) + (let* ((dir-to-other-fodder + (vector-! (new 'stack-no-clear 'vector) (-> fodder-proc root-override2 trans) (-> obj root-override2 trans)) + ) + (dir-length (vector-length dir-to-other-fodder)) + ) + (when (< dir-length 8192.0) + (vector-float*! dir-to-other-fodder dir-to-other-fodder (/ 1.0 dir-length)) + (let ((f30-0 (vector-dot + dir-to-other-fodder + (-> (quaternion->matrix (new 'stack-no-clear 'matrix) (-> obj root-override2 quat)) vector 2) ) - ) - (when (< (cos 14563.556) f30-0) - (let ((channel (ja-channel-float! (the-as art-joint-anim (-> obj draw art-group data 15)) 0.0 0.0 0.0))) - (when channel - (set! (-> obj skel interp-select 0) #xe00010) - (set! (-> obj skel interp-select 1) 0) - (set! (-> channel param 0) 1.0) - (set! (-> channel param 1) 1.0) - (set! (-> channel param 2) 1.0) - (set! (-> channel num-func) num-func-interp1-play!) - ) - ) - (set! (-> obj look-at-other-time) (-> pp clock frame-counter)) - (set! (-> obj look-at-other) (process->handle fodder-proc)) - (set! (-> obj neck-away-from) #f) - (set! (-> fodder-proc look-at-other-time) (-> pp clock frame-counter)) - (set! (-> fodder-proc look-at-other) (process->handle obj)) - (set! (-> fodder-proc neck-away-from) #t) + ) ) + (when (< (cos 14563.556) f30-0) + (let ((channel (ja-channel-float! (the-as art-joint-anim (-> obj draw art-group data 15)) 0.0 0.0 0.0))) + (when channel + (set! (-> obj skel interp-select 0) #xe00010) + (set! (-> obj skel interp-select 1) 0) + (set! (-> channel param 0) 1.0) + (set! (-> channel param 1) 1.0) + (set! (-> channel param 2) 1.0) + (set! (-> channel num-func) num-func-interp1-play!) + ) + ) + (set! (-> obj look-at-other-time) (current-time)) + (set! (-> obj look-at-other) (process->handle fodder-proc)) + (set! (-> obj neck-away-from) #f) + (set! (-> fodder-proc look-at-other-time) (current-time)) + (set! (-> fodder-proc look-at-other) (process->handle obj)) + (set! (-> fodder-proc neck-away-from) #t) ) ) ) @@ -324,8 +322,8 @@ ) ) ) - #f ) + #f ) ) @@ -334,50 +332,48 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (with-pp - (let ((parent-method (method-of-type nav-enemy track-target!))) - (parent-method obj) - ) - (let ((proc (the-as process-drawable #f))) - (cond - ((and (< (- (-> pp clock frame-counter) (-> obj look-at-other-time)) (seconds 0.5)) - (begin - (let ((other-proc (handle->process (-> obj look-at-other)))) - (set! proc (if (type? other-proc process-drawable) - (the-as process-drawable other-proc) - ) - ) - ) - proc + (let ((parent-method (method-of-type nav-enemy track-target!))) + (parent-method obj) + ) + (let ((proc (the-as process-drawable #f))) + (cond + ((and (< (- (current-time) (-> obj look-at-other-time)) (seconds 0.5)) + (begin + (let ((other-proc (handle->process (-> obj look-at-other)))) + (set! proc (if (type? other-proc process-drawable) + (the-as process-drawable other-proc) + ) + ) ) + proc ) - (let ((s5-1 (vector<-cspace! (new 'static 'vector) (-> proc node-list data 5)))) - (look-at-position! obj s5-1) - (cond - ((zero? (-> obj neck)) - ) - ((-> obj neck-away-from) - (let ((s4-0 (new 'static 'vector))) - (let ((v1-11 (vector<-cspace! (new 'static 'vector) (-> obj node-list data 5)))) - (vector-! s4-0 v1-11 s5-1) - (vector+! s4-0 s4-0 v1-11) - ) - (target-set! (-> obj neck) s4-0) + ) + (let ((s5-1 (vector<-cspace! (new 'static 'vector) (-> proc node-list data 5)))) + (look-at-position! obj s5-1) + (cond + ((zero? (-> obj neck)) + ) + ((-> obj neck-away-from) + (let ((s4-0 (new 'static 'vector))) + (let ((v1-11 (vector<-cspace! (new 'static 'vector) (-> obj node-list data 5)))) + (vector-! s4-0 v1-11 s5-1) + (vector+! s4-0 s4-0 v1-11) ) + (target-set! (-> obj neck) s4-0) ) - (else - (target-set! (-> obj neck) s5-1) - ) + ) + (else + (target-set! (-> obj neck) s5-1) ) ) ) - ((logtest? (-> obj enemy-flags) (enemy-flag lock-focus)) - (look-at-position! obj (the-as vector #f)) - ) - ) + ) + ((logtest? (-> obj enemy-flags) (enemy-flag lock-focus)) + (look-at-position! obj (the-as vector #f)) + ) ) - (none) ) + (none) ) (defstate idle (fodder) @@ -431,7 +427,7 @@ (set! (-> _self nav callback-info) *nav-enemy-null-callback-info*) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until (not #f) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.25)) @@ -538,7 +534,7 @@ ) (goto cfg-22) ) - (set! s5-0 (- (the-as time-frame s5-0) (- (-> self clock frame-counter) (-> self clock old-frame-counter)))) + (set! s5-0 (- (the-as time-frame s5-0) (- (current-time) (-> self clock old-frame-counter)))) (when (<= s5-0 0) (set! s5-0 (rand-vu-int-range 75 150)) (set! s4-0 (not s4-0)) @@ -675,7 +671,7 @@ (set! (-> v1-22 turning-acceleration) 0.0) ) 0 - (set! (-> self slow-timer) (-> self clock frame-counter)) + (set! (-> self slow-timer) (current-time)) (ja-channel-push! 1 (seconds 0.08)) (ja :group! (-> self draw art-group data (-> self enemy-info-override idle-anim))) (ja :num-func num-func-identity :frame-num 0.0) @@ -695,9 +691,9 @@ ) (when (and (nonzero? (-> self slow-timer)) (zero? (-> self fast-timer)) - (>= (- (-> self clock frame-counter) (-> self slow-timer)) (seconds 0.35)) + (>= (- (current-time) (-> self slow-timer)) (seconds 0.35)) ) - (set! (-> self fast-timer) (-> self clock frame-counter)) + (set! (-> self fast-timer) (current-time)) (ja-channel-push! 1 (seconds 0.02)) (let ((v1-55 (-> self attack-type))) (cond @@ -756,7 +752,7 @@ ) ) (cond - ((>= (- (-> self clock frame-counter) (-> self fast-timer)) v1-82) + ((>= (- (current-time) (-> self fast-timer)) v1-82) (set! (-> self slow-timer) 0) (set! (-> self fast-timer) 0) (let ((v1-83 (-> self nav))) @@ -800,9 +796,7 @@ ) (when (zero? (-> self attack-type)) (let ((f0-20 20480.0)) - (when (and (< f30-0 (* f0-20 f0-20)) - (>= (- (-> self clock frame-counter) (-> self look-at-other-time)) (seconds 0.125)) - ) + (when (and (< f30-0 (* f0-20 f0-20)) (>= (- (current-time) (-> 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) @@ -813,7 +807,7 @@ (set! (-> v1-117 num-func) num-func-interp1-play!) ) ) - (set! (-> self look-at-other-time) (-> self clock frame-counter)) + (set! (-> self look-at-other-time) (current-time)) ) ) ) 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 06cb38efa7..e69abbcaff 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 @@ -1092,7 +1092,7 @@ (defstate stare (crimson-guard-level) :virtual #t :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((gp-0 (-> self focus aware))) (cond ((>= 1 (the-as int gp-0)) @@ -1573,7 +1573,7 @@ :virtual #t :enter (behavior () (talker-spawn-func (-> *talker-speech* 10) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-4 (logior (-> self enemy-flags) (enemy-flag use-notice-distance)))) (set! (-> self enemy-flags) (logclear v1-4 (enemy-flag called-dying))) ) @@ -1662,7 +1662,7 @@ (t9-0) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (if (logtest? (-> self flags) 4) (go-virtual gun-shoot) ) @@ -1675,7 +1675,7 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (cond ((or (< (the-as int gp-0) 2) (not (get-enemy-target self))) (go-stare self) @@ -1754,7 +1754,7 @@ ) :enter (behavior () ((-> (method-of-type nav-enemy hostile) enter)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self reaction-time) (the-as time-frame (the int (* 300.0 (get-rand-float-range self 0.5 1.5))))) (none) ) @@ -1764,7 +1764,7 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (cond ((or (>= 2 (the-as int gp-0)) (not (get-enemy-target self))) (go-stare self) @@ -1824,7 +1824,7 @@ ) :enter (behavior () ((-> (method-of-type nav-enemy hostile) enter)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-156 self) (none) ) @@ -1834,7 +1834,7 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (cond ((or (< (the-as int gp-0) 2) (not (get-enemy-target self))) (go-stare self) @@ -1868,7 +1868,7 @@ ) (if (and (< (-> self target-self-xz-dist) 327680.0) (crimson-guard-level-method-193 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the int (* 300.0 (rand-vu-float-range 1.0 8.0)))) + (>= (- (current-time) (-> self state-time)) (the int (* 300.0 (rand-vu-float-range 1.0 8.0)))) ) (go-virtual gun-shoot) ) @@ -1906,7 +1906,7 @@ ) :enter (behavior () ((-> (method-of-type nav-enemy hostile) enter)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-156 self) (none) ) @@ -1916,7 +1916,7 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (cond ((or (< (the-as int gp-0) 2) (not (get-enemy-target self))) (go-stare self) @@ -1946,9 +1946,9 @@ ) (else (if (or (and (logtest? (-> self nav state flags) (nav-state-flag at-target)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (>= (- (current-time) (-> self state-time)) (seconds 0.1)) ) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (>= (- (current-time) (-> self state-time)) (seconds 1)) ) (go-virtual grenade-attack) ) @@ -2003,10 +2003,10 @@ (set! (-> a0-9 velocity quad) (-> v1-12 quad)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-time-see-target) (the-as int (-> self clock frame-counter))) + (set! (-> self state-time) (current-time)) + (set! (-> self last-time-see-target) (the-as int (current-time))) (set! (-> self miss-amount) 0.0) - (set! (-> self next-shot) (the-as int (-> self clock frame-counter))) + (set! (-> self next-shot) (the-as int (current-time))) (set! (-> self joint-enable) #t) (set! (-> self reaction-time) (the-as time-frame (the int (* 300.0 (get-rand-float-range self 3.0 5.0))))) (none) @@ -2019,7 +2019,7 @@ :trans (behavior () (crimson-guard-level-method-200 self) (let ((v1-2 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (cond ((< (the-as int v1-2) 2) (go-stare self) @@ -2053,7 +2053,7 @@ ) ) (until #f - (if (or (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (if (or (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (< 10922.667 (fabs (-> self target-y-angle))) ) (goto cfg-13) @@ -2126,14 +2126,14 @@ (set! (-> a0-8 velocity quad) (-> v1-13 quad)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-time-see-target) (the-as int (-> self clock frame-counter))) + (set! (-> self state-time) (current-time)) + (set! (-> self last-time-see-target) (the-as int (current-time))) (crimson-guard-level-method-200 self) (if (logtest? (-> self flags) 4) (set! (-> self miss-amount) 16384.0) (set! (-> self miss-amount) (lerp-scale 0.0 16384.0 (-> self target-self-dist) 40960.0 122880.0)) ) - (set! (-> self next-shot) (the-as int (-> self clock frame-counter))) + (set! (-> self next-shot) (the-as int (current-time))) (set! (-> self joint-enable) #t) (none) ) @@ -2185,7 +2185,7 @@ (set! (-> self start-target-vel quad) (-> (the-as process-drawable v1-31) root transv quad)) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (label cfg-10) (when (crimson-guard-level-method-194 self) (when (or (not (logtest? (-> self flags) 256)) (and (logtest? (-> self flags) 256) (-> self trigger))) @@ -2193,7 +2193,7 @@ (goto cfg-23) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 1)) (set! v1-48 #f) (goto cfg-23) ) @@ -2201,7 +2201,7 @@ (b! (not #f) cfg-10 :delay (set! v1-48 #f)) (label cfg-23) (when v1-48 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 3)) (until #f (ja-channel-push! 1 (seconds 0.1)) @@ -2239,8 +2239,8 @@ (suspend) ) (when (logtest? (-> self flags) 4) - (let ((s5-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-1) (seconds 1)) + (let ((s5-1 (current-time))) + (until (>= (- (current-time) s5-1) (seconds 1)) (suspend) ) ) @@ -2855,8 +2855,8 @@ (suspend) (ja :num! (seek! (ja-aframe 12.0 0))) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (the int (* 900.0 (you-suck-scale *game-info* #f)))) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (the int (* 900.0 (you-suck-scale *game-info* #f)))) (ja-no-eval :group! (-> self draw art-group data 37) :num! (seek! (ja-aframe 12.0 0)) :frame-num (ja-aframe 12.0 0) @@ -2924,8 +2924,8 @@ ) 0 (set! (-> self miss-amount) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self next-shot) (the-as int (-> self clock frame-counter))) + (set! (-> self state-time) (current-time)) + (set! (-> self next-shot) (the-as int (current-time))) (set! (-> self lazer-sound) (new 'static 'sound-id)) 0 (none) @@ -2968,9 +2968,7 @@ ) :trans (behavior () (crimson-guard-level-method-200 self) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) - (< 32768.0 (-> self target-self-xz-dist)) - ) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (< 32768.0 (-> self target-self-xz-dist))) (go-hostile self) ) (none) @@ -2985,7 +2983,7 @@ ) (until #f (let ((gp-2 #t)) - (while (or (< 5461.3335 (fabs (-> self target-y-angle))) (>= (-> self next-shot) (-> self clock frame-counter))) + (while (or (< 5461.3335 (fabs (-> self target-y-angle))) (>= (-> self next-shot) (current-time))) (when gp-2 (ja-channel-push! 1 (seconds 0.1)) (set! gp-2 #f) @@ -3051,7 +3049,7 @@ (suspend) (ja :num! (seek!)) ) - (set! (-> self next-shot) (the-as int (+ (-> self clock frame-counter) (seconds 1)))) + (set! (-> self next-shot) (the-as int (+ (current-time) (seconds 1)))) (let ((v1-124 (-> (the-as collide-shape-prim-group (-> self root-override2 root-prim)) child 2))) (logior! (-> v1-124 prim-core action) (collide-action deadly)) ) @@ -3080,12 +3078,12 @@ ) (set! (-> v1-127 state mode) (the-as lightning-mode a0-38)) ) - (let ((gp-4 (-> self clock frame-counter)) + (let ((gp-4 (current-time)) (s5-1 150) (f30-0 1.0) ) (ja-no-eval :group! (-> self draw art-group data 22) :num! (loop! f30-0) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-4) s5-1) + (until (>= (- (current-time) gp-4) s5-1) (crimson-guard-level-method-198 self) (suspend) (ja :num! (loop! f30-0)) @@ -3124,7 +3122,7 @@ ) ) (else - (set! (-> self next-shot) (the-as int (+ (-> self clock frame-counter) (seconds 1)))) + (set! (-> self next-shot) (the-as int (+ (current-time) (seconds 1)))) (suspend) 0 ) @@ -3160,7 +3158,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -3227,7 +3225,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -4223,7 +4221,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self nav flags) (nav-control-flag output-sphere-hash)) (nav-enemy-method-166 self) (let ((v1-7 (-> self nav))) @@ -4300,18 +4298,15 @@ (while (not (-> self already-shot)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (ja-channel-set! 1) - (let ((gp-0 (-> self clock frame-counter)) + (let ((gp-0 (current-time)) (s5-0 150) (f30-0 2.0) ) (ja-no-eval :group! (-> self draw art-group data 6) :num! (loop! f30-0) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-0) s5-0) - (crimson-guard-level-method-201 - self - (* 0.006666667 (the float (- (-> self clock frame-counter) (-> self state-time)))) - ) + (until (>= (- (current-time) gp-0) s5-0) + (crimson-guard-level-method-201 self (* 0.006666667 (the float (- (current-time) (-> self state-time))))) (suspend) (ja :num! (loop! f30-0)) ) 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 8cd73d2c06..e946f3cad8 100644 --- a/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc +++ b/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc @@ -302,9 +302,9 @@ ) ) ) - (set! (-> self last-playing-time) (-> self clock frame-counter)) + (set! (-> self last-playing-time) (current-time)) ) - (if (and (-> self triggered?) (>= (- (-> self clock frame-counter) (-> self last-playing-time)) (seconds 6))) + (if (and (-> self triggered?) (>= (- (current-time) (-> self last-playing-time)) (seconds 6))) (guard-conversation-method-24 self) ) (none) diff --git a/goal_src/jak2/levels/common/enemy/guards/transport-level.gc b/goal_src/jak2/levels/common/enemy/guards/transport-level.gc index 88aa0ba2ff..ab54aa123e 100644 --- a/goal_src/jak2/levels/common/enemy/guards/transport-level.gc +++ b/goal_src/jak2/levels/common/enemy/guards/transport-level.gc @@ -107,8 +107,8 @@ :virtual #t :event transport-level-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-guard-spawn-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self last-guard-spawn-time) (current-time)) (none) ) :code (behavior () @@ -141,7 +141,7 @@ :virtual #t :event transport-level-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self root-override transv y) 0.0) (set! (-> self last-guard-spawn-time) 0) 0 @@ -186,16 +186,16 @@ gp-0 ) ) - (set! (-> self leave-time) (+ (-> self clock frame-counter) (seconds 3))) + (set! (-> self leave-time) (+ (current-time) (seconds 3))) ) - (if (and (nonzero? (-> self leave-time)) (< (-> self leave-time) (-> self clock frame-counter))) + (if (and (nonzero? (-> self leave-time)) (< (-> self leave-time) (current-time))) (go-virtual leave) ) (when (and (zero? (-> self leave-time)) (nonzero? (-> self max-guard)) (>= (-> self count-guard) (-> self max-guard)) ) - (set! (-> self leave-time) (+ (-> self clock frame-counter) (seconds 3))) + (set! (-> self leave-time) (+ (current-time) (seconds 3))) (send-event self 'stop-spawning) ) (transport-level-method-34 self) @@ -217,7 +217,7 @@ :virtual #t :event transport-level-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self root-override transv y) 0.0) (none) ) @@ -252,43 +252,41 @@ ) (defmethod transport-level-method-33 transport-level ((obj transport-level)) - (with-pp - (let ((v1-0 0)) - (dotimes (a0-1 8) - (if (handle->process (-> obj guards a0-1)) - (+! v1-0 1) + (let ((v1-0 0)) + (dotimes (a0-1 8) + (if (handle->process (-> obj guards a0-1)) + (+! v1-0 1) + ) + ) + (when (zero? (-> obj count-guard)) + (set! (-> obj last-guard-spawn-time) 0) + 0 + ) + (when (and (>= (- (current-time) (-> obj last-guard-spawn-time)) (-> obj spawn-time)) + (< v1-0 (the-as int (-> obj num-wanted-guards))) + ) + (let ((s5-0 (new 'stack-no-clear 'crimson-guard-level-params))) + (set! (-> s5-0 transport-side) (-> obj spawn-side)) + (set! (-> s5-0 nav-mesh) (-> obj nav-mesh)) + (set! (-> s5-0 pos quad) (-> obj root-override trans quad)) + (set! (-> s5-0 pos y) (+ 8192.0 (-> s5-0 pos y))) + (quaternion-rotate-local-y! (-> s5-0 quat) (-> obj root-override quat) 32768.0) + (set! (-> s5-0 handle) (the-as uint (process->handle obj))) + (set! (-> s5-0 weapon) 1) + (dotimes (s4-0 (the-as int (-> obj num-wanted-guards))) + (when (not (handle->process (-> obj guards s4-0))) + (set! (-> obj guards s4-0) (ppointer->handle (process-spawn crimson-guard-level s5-0 :to obj))) + #t + (goto cfg-38) ) - ) - (when (zero? (-> obj count-guard)) - (set! (-> obj last-guard-spawn-time) 0) - 0 - ) - (when (and (>= (- (-> pp clock frame-counter) (-> obj last-guard-spawn-time)) (-> obj spawn-time)) - (< v1-0 (the-as int (-> obj num-wanted-guards))) - ) - (let ((s5-0 (new 'stack-no-clear 'crimson-guard-level-params))) - (set! (-> s5-0 transport-side) (-> obj spawn-side)) - (set! (-> s5-0 nav-mesh) (-> obj nav-mesh)) - (set! (-> s5-0 pos quad) (-> obj root-override trans quad)) - (set! (-> s5-0 pos y) (+ 8192.0 (-> s5-0 pos y))) - (quaternion-rotate-local-y! (-> s5-0 quat) (-> obj root-override quat) 32768.0) - (set! (-> s5-0 handle) (the-as uint (process->handle obj))) - (set! (-> s5-0 weapon) 1) - (dotimes (s4-0 (the-as int (-> obj num-wanted-guards))) - (when (not (handle->process (-> obj guards s4-0))) - (set! (-> obj guards s4-0) (ppointer->handle (process-spawn crimson-guard-level s5-0 :to obj))) - #t - (goto cfg-38) - ) - ) - (label cfg-38) - (when (-> s5-0 proc) - (set! (-> obj spawn-side) (- 1 (the-as int (-> obj spawn-side)))) - (set! (-> obj last-guard-spawn-time) (-> pp clock frame-counter)) - (let ((v0-0 (+ (-> obj count-guard) 1))) - (set! (-> obj count-guard) v0-0) - v0-0 - ) + ) + (label cfg-38) + (when (-> s5-0 proc) + (set! (-> obj spawn-side) (- 1 (the-as int (-> obj spawn-side)))) + (set! (-> obj last-guard-spawn-time) (current-time)) + (let ((v0-0 (+ (-> obj count-guard) 1))) + (set! (-> obj count-guard) v0-0) + v0-0 ) ) ) diff --git a/goal_src/jak2/levels/common/enemy/hopper.gc b/goal_src/jak2/levels/common/enemy/hopper.gc index db793e9a1b..697a1dd59a 100644 --- a/goal_src/jak2/levels/common/enemy/hopper.gc +++ b/goal_src/jak2/levels/common/enemy/hopper.gc @@ -655,7 +655,7 @@ 0 (set! (-> self speed-y) 0.0) (set! (-> self accel-y) 0.0) - (set! (-> self next-jump-time) (the-as int (+ (-> self clock frame-counter) (get-rand-int-range self 0 120)))) + (set! (-> self next-jump-time) (the-as int (+ (current-time) (get-rand-int-range self 0 120)))) (set! (-> self step-num) 0) (set! (-> self best-score) -2.0) (none) @@ -674,7 +674,7 @@ (t9-0) ) ) - (when (< *hopper-next-jump-time* (-> self clock frame-counter)) + (when (< *hopper-next-jump-time* (current-time)) (let ((gp-0 (handle->process (-> self focus handle)))) (when gp-0 (let ((s4-1 (vector-! @@ -759,7 +759,7 @@ ) ) ) - (set! *hopper-next-jump-time* (+ (-> self clock frame-counter) (get-rand-int-range self 4 22))) + (set! *hopper-next-jump-time* (+ (current-time) (get-rand-int-range self 4 22))) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) (send-event self 'jump 0 (-> self best-point)) ) @@ -789,7 +789,7 @@ (set! (-> self jump-anim-start-frame) 8.0) ) ) - (set! *hopper-next-jump-time* (+ (-> self clock frame-counter) (get-rand-int-range self 4 22))) + (set! *hopper-next-jump-time* (+ (current-time) (get-rand-int-range self 4 22))) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) (send-event self 'jump 0 (-> self best-point)) ) 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 872bae7988..3761d5f2e7 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 @@ -606,9 +606,7 @@ (t9-0) ) ) - (set! (-> self last-fire-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (get-rand-float-range self 2.0 3.0)))) - ) + (set! (-> self last-fire-time) (+ (current-time) (the int (* 300.0 (get-rand-float-range self 2.0 3.0))))) (go-virtual ambush-fly) (none) ) @@ -689,7 +687,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self attack-miss-dist-curr) (-> self attack-miss-dist-min)) (let ((f0-1 (vector-vector-distance-squared (-> self root-override2 trans) (-> self focus-pos))) (f1-0 122880.0) @@ -703,7 +701,7 @@ (none) ) :exit (behavior () - (set! (-> self last-fire-time) (-> self clock frame-counter)) + (set! (-> self last-fire-time) (current-time)) (set! (-> self restart-fly-anims) #t) (none) ) @@ -767,7 +765,7 @@ ) ) (talker-spawn-func (-> *talker-speech* 10) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self last-fire-time) (+ (-> self clock frame-counter) (seconds -1.5))) + (set! (-> self last-fire-time) (+ (current-time) (seconds -1.5))) (none) ) ) @@ -803,11 +801,11 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + (if (>= (- (current-time) (-> self state-time)) (seconds 4)) (go-hostile self) ) (none) @@ -884,14 +882,14 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self attack-miss-dist-curr) (-> self attack-miss-dist-min)) (set! (-> self shots-fired) 0) 0 (none) ) :exit (behavior () - (set! (-> self last-fire-time) (-> self clock frame-counter)) + (set! (-> self last-fire-time) (current-time)) (set! (-> self restart-fly-anims) #t) (none) ) @@ -1029,8 +1027,8 @@ 0 (set! (-> self hit-points) 0) (do-effect (-> self skel effect) 'death-default 0.0 -1) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -1269,35 +1267,33 @@ ;; WARN: Return type mismatch object vs symbol. (defmethod crimson-guard-hover-method-162 crimson-guard-hover ((obj crimson-guard-hover) (arg0 process-focusable)) - (with-pp - (let* ((v1-1 (vector+! (new 'stack-no-clear 'vector) (-> obj root-override2 trans) (-> obj root-override2 transv))) - (s5-1 (vector-! (new 'stack-no-clear 'vector) v1-1 (-> obj focus-pos))) - (f30-0 (vector-length s5-1)) - (a0-4 (if arg0 - arg0 - (handle->process (-> obj focus handle)) - ) - ) - ) - (the-as - symbol - (when a0-4 - (let ((s4-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable a0-4) 0))) - (s5-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s5-1 1.0)) - ) - (and (< 0.0 (vector-dot s4-1 s5-2)) - (and (>= (- (-> pp clock frame-counter) (-> obj last-fire-time)) - (the int (* 300.0 (rand-vu-float-range (-> obj attack-wait-min) (-> obj attack-wait-max)))) - ) - (get-enemy-target obj) - (< f30-0 225280.0) - (and (< (fabs (vector-x-angle s5-2)) 3640.889) - (enemy-method-95 obj (-> obj focus-pos) 5461.3335) - (check-los? (-> obj los) (seconds 0.4)) - ) - ) - ) - ) + (let* ((v1-1 (vector+! (new 'stack-no-clear 'vector) (-> obj root-override2 trans) (-> obj root-override2 transv))) + (s5-1 (vector-! (new 'stack-no-clear 'vector) v1-1 (-> obj focus-pos))) + (f30-0 (vector-length s5-1)) + (a0-4 (if arg0 + arg0 + (handle->process (-> obj focus handle)) + ) + ) + ) + (the-as + symbol + (when a0-4 + (let ((s4-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable a0-4) 0))) + (s5-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s5-1 1.0)) + ) + (and (< 0.0 (vector-dot s4-1 s5-2)) + (and (>= (- (current-time) (-> obj last-fire-time)) + (the int (* 300.0 (rand-vu-float-range (-> obj attack-wait-min) (-> obj attack-wait-max)))) + ) + (get-enemy-target obj) + (< f30-0 225280.0) + (and (< (fabs (vector-x-angle s5-2)) 3640.889) + (enemy-method-95 obj (-> obj focus-pos) 5461.3335) + (check-los? (-> obj los) (seconds 0.4)) + ) + ) + ) ) ) ) diff --git a/goal_src/jak2/levels/common/enemy/hover/flamer.gc b/goal_src/jak2/levels/common/enemy/hover/flamer.gc index 8eb9ae35cf..603738e259 100644 --- a/goal_src/jak2/levels/common/enemy/hover/flamer.gc +++ b/goal_src/jak2/levels/common/enemy/hover/flamer.gc @@ -368,7 +368,7 @@ ) ) ) - (let* ((v1-30 (+ (-> pp clock frame-counter) (the-as time-frame (-> obj sync-off)))) + (let* ((v1-30 (+ (current-time) (the-as time-frame (-> obj sync-off)))) (f0-5 (+ (-> arg0 x) (* 614.4 (cos (* 54.613335 (the float (mod v1-30 1200))))))) ) (set! (-> arg0 x) f0-5) @@ -424,13 +424,13 @@ ) (defbehavior flamer-flit-post flamer () - (when (>= (- (-> self clock frame-counter) (-> self flit-timer)) (rand-vu-int-range (seconds 1.2) (seconds 3))) + (when (>= (- (current-time) (-> self flit-timer)) (rand-vu-int-range (seconds 1.2) (seconds 3))) (set! (-> self flit-angle) (the float (sar (shl (the int (+ (-> self flit-angle) (* 182.04445 (rand-vu-float-range 160.0 200.0)))) 48) 48) ) ) - (set! (-> self flit-timer) (-> self clock frame-counter)) + (set! (-> self flit-timer) (current-time)) ) (flamer-attack-post) (none) @@ -716,7 +716,7 @@ ) ) ) - (let ((v1-16 (+ (-> pp clock frame-counter) (the-as time-frame (-> obj sync-off))))) + (let ((v1-16 (+ (current-time) (the-as time-frame (-> obj sync-off))))) (seek! (-> obj root-override2 trans y) (+ (-> obj base-pos y) (* 1228.8 (cos (* 100.66974 (the float (mod v1-16 651)))))) @@ -788,9 +788,7 @@ (none) ) :trans (behavior () - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) - (flamer-method-183 self) - ) + (when (and (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (flamer-method-183 self)) (if (logtest? (enemy-option ambush) (-> self fact-info-override enemy-options)) (go-virtual ambush) (go-virtual active) @@ -877,7 +875,7 @@ (vector-reset! (-> self fly-dir)) (sound-play "flamer-ambush") (quaternion-copy! (-> self root-override2 quat) (-> self init-quat)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -889,7 +887,7 @@ (logior! (-> self mask) (process-mask actor-pause)) (logior! (-> self enemy-flags) (enemy-flag notice)) (set! (-> self flit-joint twist-min-y) (the-as float #t)) - (set! (-> self last-fire-time) (+ (-> self clock frame-counter) (seconds -1.5))) + (set! (-> self last-fire-time) (+ (current-time) (seconds -1.5))) (none) ) :trans (behavior () @@ -980,7 +978,7 @@ (set! (-> v1-3 enemy-flags) (the-as enemy-flag (logclear (-> v1-3 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -1014,9 +1012,9 @@ :code (the-as (function none :behavior flamer) flamer-fly-code) :post (behavior () (flamer-method-187 self) - (when (>= (- (-> self clock frame-counter) (-> self flit-timer)) (rand-vu-int-range (seconds 1.2) (seconds 3))) + (when (>= (- (current-time) (-> self flit-timer)) (rand-vu-int-range (seconds 1.2) (seconds 3))) (set! (-> self flit-angle) (* 182.04445 (rand-vu-float-range 0.0 360.0))) - (set! (-> self flit-timer) (-> self clock frame-counter)) + (set! (-> self flit-timer) (current-time)) ) (vector-seek! (-> self root-override2 trans) (-> self base-pos) (* 16384.0 (-> self clock seconds-per-frame))) (flamer-method-184 self) @@ -1055,7 +1053,7 @@ ) (flamer-method-189 self) (set! (-> self ground-mode) 0) - (set! (-> self flit-timer) (+ (-> self clock frame-counter) (seconds -3))) + (set! (-> self flit-timer) (+ (current-time) (seconds -3))) (none) ) :trans (behavior () @@ -1074,9 +1072,7 @@ ) (let ((gp-1 (get-enemy-target self))) (if (and gp-1 - (>= (- (-> self clock frame-counter) (-> self last-fire-time)) - (the int (* 300.0 (rand-vu-float-range 3.0 6.0))) - ) + (>= (- (current-time) (-> self last-fire-time)) (the int (* 300.0 (rand-vu-float-range 3.0 6.0)))) (< (vector-vector-distance (get-trans gp-1 3) (-> self root-override2 trans)) 245760.0) ) (go-virtual attack) @@ -1136,7 +1132,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :code (behavior () @@ -1163,7 +1159,7 @@ ) ) ) - (set! (-> self last-fire-time) (-> self clock frame-counter)) + (set! (-> self last-fire-time) (current-time)) (go-virtual hostile) (none) ) @@ -1289,7 +1285,7 @@ ) (when (and (nonzero? (-> self hit-points)) (zero? (-> self fated-time)) - (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (or (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (and (< (-> self root-override2 trans y) (+ 18432.0 (-> self root-override2 gspot-pos y))) (< (-> self root-override2 transv y) 0.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 7d391c415d..784e11ca3b 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 @@ -128,11 +128,9 @@ a0-0 ) ) - (when (and (logtest? (-> gp-0 flags) 2) - (>= (- (-> self clock frame-counter) (-> self formation-timer)) (seconds 0.2)) - ) + (when (and (logtest? (-> gp-0 flags) 2) (>= (- (current-time) (-> self formation-timer)) (seconds 0.2))) (hover-formation-control-method-11 gp-0) - (set! (-> self formation-timer) (-> self clock frame-counter)) + (set! (-> self formation-timer) (current-time)) ) ) ) @@ -188,8 +186,8 @@ (('wait) ) ) - (let ((s4-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-0) (-> gp-0 s5-0 time)) + (let ((s4-0 (current-time))) + (until (>= (- (current-time) s4-0) (-> gp-0 s5-0 time)) (suspend) ) ) @@ -198,8 +196,8 @@ ) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 2)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 2)) (suspend) ) ) @@ -271,41 +269,39 @@ (defmethod hover-enemy-manager-init! hover-enemy-manager ((obj hover-enemy-manager) (arg0 (array hover-enemy-battle-command))) "Initialize this [[hover-enemy-manager]]." (local-vars (sv-16 res-tag)) - (with-pp - (set! (-> obj command-table) arg0) - (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) - (logior! (-> obj 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 (-> obj entity) 'actor-groups pointer :tag-ptr (& sv-16)))) - (cond - ((and v1-5 (nonzero? (-> sv-16 elt-count))) - (set! (-> obj actor-group) (the-as (pointer actor-group) v1-5)) - (set! (-> obj actor-group-count) (the-as int (-> sv-16 elt-count))) - ) - (else - (set! (-> obj actor-group) (the-as (pointer actor-group) #f)) - (set! (-> obj actor-group-count) 0) - 0 - ) + (set! (-> obj command-table) arg0) + (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) + (logior! (-> obj 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 (-> obj entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (cond + ((and v1-5 (nonzero? (-> sv-16 elt-count))) + (set! (-> obj actor-group) (the-as (pointer actor-group) v1-5)) + (set! (-> obj actor-group-count) (the-as int (-> sv-16 elt-count))) + ) + (else + (set! (-> obj actor-group) (the-as (pointer actor-group) #f)) + (set! (-> obj actor-group-count) 0) + 0 ) ) - (set! (-> obj total-to-spawn) 0) - (set! (-> obj num-spawned) 0) - (when (-> obj command-table) - (let ((v1-13 (-> obj command-table))) - (dotimes (a0-6 (-> v1-13 length)) - (if (= (-> v1-13 a0-6 command) 'spawn) - (+! (-> obj total-to-spawn) (-> obj actor-group (-> v1-13 a0-6 wave) length)) - ) - ) - ) - ) - (set! (-> obj formation) #f) - (set! (-> obj formation-timer) (-> pp clock frame-counter)) - (set! (-> obj alive-count) 0) - 0 - (none) ) + (set! (-> obj total-to-spawn) 0) + (set! (-> obj num-spawned) 0) + (when (-> obj command-table) + (let ((v1-13 (-> obj command-table))) + (dotimes (a0-6 (-> v1-13 length)) + (if (= (-> v1-13 a0-6 command) 'spawn) + (+! (-> obj total-to-spawn) (-> obj actor-group (-> v1-13 a0-6 wave) length)) + ) + ) + ) + ) + (set! (-> obj formation) #f) + (set! (-> obj formation-timer) (current-time)) + (set! (-> obj alive-count) 0) + 0 + (none) ) ;; WARN: Return type mismatch object vs none. 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 f61e382074..bf2b319f20 100644 --- a/goal_src/jak2/levels/common/enemy/hover/hover-enemy.gc +++ b/goal_src/jak2/levels/common/enemy/hover/hover-enemy.gc @@ -453,7 +453,7 @@ (if (logtest? (-> self path flags) (path-control-flag not-found)) (go process-drawable-art-error "no path") ) - (set! (-> self scale-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self scale-timer) (the-as uint (current-time))) (cond ((not (logtest? (-> self fact-info-override enemy-options) (enemy-option user0))) (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) @@ -509,7 +509,7 @@ ) (hover-enemy-method-144 self) (hover-nav-control-method-18 (-> self hover) (-> self path) -1 -1) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -540,7 +540,7 @@ :post (behavior () (local-vars (v1-19 enemy-flag)) (when (not (logtest? (-> self fact-info-override enemy-options) (enemy-option user0))) - (let ((f0-1 (the float (- (-> self clock frame-counter) (the-as int (-> self scale-timer))))) + (let ((f0-1 (the float (- (current-time) (the-as int (-> self scale-timer))))) (f1-0 1200.0) ) (when (< f0-1 f1-0) @@ -647,7 +647,7 @@ ) (if (and (nonzero? (-> self hit-points)) (zero? (-> self fated-time)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (< (-> self root-override2 trans y) (- (-> self knocked-start-level) (-> self knocked-fall-dist))) ) (go-virtual knocked-recover) @@ -716,14 +716,14 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('touch 'touched 'attack) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (go-virtual flying-death-explode) ) ) ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (dispose! self) (stop-looking-at-target! self) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) @@ -775,14 +775,14 @@ (set! (-> self hover speed) 0.2) (set! (-> self flying-death-spin) 0.0) (enemy-method-103 self) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (if (or (logtest? (-> self root-override2 status) (collide-status touch-surface touch-wall touch-ceiling touch-actor impact-surface touch-background) ) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + (>= (- (current-time) (-> self state-time)) (seconds 4)) ) (go-virtual flying-death-explode) ) 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 34643df160..a4f1589e2b 100644 --- a/goal_src/jak2/levels/common/enemy/hover/hover-formation.gc +++ b/goal_src/jak2/levels/common/enemy/hover/hover-formation.gc @@ -648,10 +648,10 @@ (set-anchor-proc (-> self formation) (process->handle *target*)) (hover-formation-control-method-14 (-> self formation)) (when (and (logtest? (-> self formation flags) 2) - (>= (- (-> self clock frame-counter) (the-as int (-> self formation-timer))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> self formation-timer))) (seconds 0.2)) ) (hover-formation-control-method-11 (-> self formation)) - (set! (-> self formation-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self formation-timer) (the-as uint (current-time))) ) (if (not (logtest? (-> self path flags) (path-control-flag not-found))) (debug-draw (-> self path)) @@ -684,51 +684,49 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (local-vars (sv-32 structure)) - (with-pp - (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) - (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) - (let* ((s5-0 (method-of-type hover-formation-control new)) - (s4-0 'process) - (s3-0 hover-formation-control) - (s2-0 obj) - (v0-1 (entity-actor-lookup (-> obj entity) 'alt-actor 0)) - (s1-0 (if v0-1 - v0-1 - (-> obj entity) - ) - ) - (s0-0 (res-lump-float (-> obj entity) 'notice-dist :default 225280.0)) - ) - (let ((t9-3 (method-of-type res-lump get-property-struct)) - (a0-5 (-> obj 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! 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 (-> obj entity) 'rotoffset :default 5461.3335)) - (t3-0 #f) - ) - (set! (-> obj 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! (-> obj formation-timer) (the-as uint (-> pp clock frame-counter))) - (logclear! (-> obj mask) (process-mask actor-pause)) - (let ((t9-6 process-entity-status!) - (a0-9 obj) - (a1-7 8) - (a2-6 #t) + (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) + (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) + (let* ((s5-0 (method-of-type hover-formation-control new)) + (s4-0 'process) + (s3-0 hover-formation-control) + (s2-0 obj) + (v0-1 (entity-actor-lookup (-> obj entity) 'alt-actor 0)) + (s1-0 (if v0-1 + v0-1 + (-> obj entity) + ) + ) + (s0-0 (res-lump-float (-> obj entity) 'notice-dist :default 225280.0)) + ) + (let ((t9-3 (method-of-type res-lump get-property-struct)) + (a0-5 (-> obj entity)) + (a1-4 'trans-offset) + (a2-3 'interp) + (a3-2 -1000000000.0) + (t0-2 (new 'stack-no-clear 'vector)) ) - (t9-6 a0-9 (the-as entity-perm-status a1-7) a2-6) - (hover-formation-method-15 obj (the-as vector a1-7) (the-as vector a2-6)) + (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 (-> obj entity) 'rotoffset :default 5461.3335)) + (t3-0 #f) + ) + (set! (-> obj 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))) ) - (go (method-of-object obj idle)) - (none) ) + (set! (-> obj formation-timer) (the-as uint (current-time))) + (logclear! (-> obj mask) (process-mask actor-pause)) + (let ((t9-6 process-entity-status!) + (a0-9 obj) + (a1-7 8) + (a2-6 #t) + ) + (t9-6 a0-9 (the-as entity-perm-status a1-7) a2-6) + (hover-formation-method-15 obj (the-as vector a1-7) (the-as vector a2-6)) + ) + (go (method-of-object obj idle)) + (none) ) 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 2db179813c..4fb5e4f542 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 @@ -829,7 +829,7 @@ (while v1-0 (let ((a0-2 (-> v1-0 next))) (set! (-> (the-as hover-nav-sphere v1-0) timer) - (- (-> (the-as hover-nav-sphere v1-0) timer) (- (-> pp clock frame-counter) (-> pp clock old-frame-counter))) + (- (-> (the-as hover-nav-sphere v1-0) timer) (- (current-time) (-> pp clock old-frame-counter))) ) (when (<= (-> (the-as hover-nav-sphere v1-0) timer) 0) (let ((a1-4 v1-0)) @@ -1265,48 +1265,46 @@ ) (defmethod hover-nav-control-method-24 hover-nav-control ((obj hover-nav-control)) - (with-pp - (when (not (logtest? (-> obj flags) 1)) - (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (-> obj params) - (let ((v1-5 (hover-nav-control-method-17 obj)) - (s4-0 (-> obj root transv)) - ) - (when (< 0.0 (vector-length s4-0)) - (set! (-> s5-0 start-pos quad) (-> v1-5 world-sphere quad)) - (set! (-> s5-0 move-dist quad) (-> s4-0 quad)) - (let ((f0-1 (vector-length (-> s5-0 move-dist)))) - (if (< 40960.0 f0-1) - (vector-float*! (-> s5-0 move-dist) (-> s5-0 move-dist) (/ 40960.0 f0-1)) - ) - ) - (let ((a0-14 s5-0)) - (set! (-> a0-14 radius) (-> v1-5 world-sphere w)) - (set! (-> a0-14 collide-with) (-> obj root root-prim prim-core collide-with)) - (set! (-> a0-14 ignore-process0) (-> obj root process)) - (set! (-> a0-14 ignore-process1) #f) - (set! (-> a0-14 ignore-pat) (-> obj root pat-ignore-mask)) - (set! (-> a0-14 action-mask) (collide-action solid)) - ) - (let ((f0-4 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) - (cond - ((>= f0-4 0.0) - (set! (-> obj los-obstruction-distance) (* f0-4 (vector-length s4-0))) - (logior! (-> obj flags) 2) - ) - (else - (set! (-> obj los-last-clear-time) (-> pp clock frame-counter)) - (set! (-> obj flags) (logand -3 (-> obj flags))) - ) + (when (not (logtest? (-> obj flags) 1)) + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (-> obj params) + (let ((v1-5 (hover-nav-control-method-17 obj)) + (s4-0 (-> obj root transv)) + ) + (when (< 0.0 (vector-length s4-0)) + (set! (-> s5-0 start-pos quad) (-> v1-5 world-sphere quad)) + (set! (-> s5-0 move-dist quad) (-> s4-0 quad)) + (let ((f0-1 (vector-length (-> s5-0 move-dist)))) + (if (< 40960.0 f0-1) + (vector-float*! (-> s5-0 move-dist) (-> s5-0 move-dist) (/ 40960.0 f0-1)) + ) + ) + (let ((a0-14 s5-0)) + (set! (-> a0-14 radius) (-> v1-5 world-sphere w)) + (set! (-> a0-14 collide-with) (-> obj root root-prim prim-core collide-with)) + (set! (-> a0-14 ignore-process0) (-> obj root process)) + (set! (-> a0-14 ignore-process1) #f) + (set! (-> a0-14 ignore-pat) (-> obj root pat-ignore-mask)) + (set! (-> a0-14 action-mask) (collide-action solid)) + ) + (let ((f0-4 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) + (cond + ((>= f0-4 0.0) + (set! (-> obj los-obstruction-distance) (* f0-4 (vector-length s4-0))) + (logior! (-> obj flags) 2) + ) + (else + (set! (-> obj los-last-clear-time) (current-time)) + (set! (-> obj flags) (logand -3 (-> obj flags))) ) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod hover-nav-control-method-11 hover-nav-control ((obj hover-nav-control) (arg0 vector)) @@ -1329,21 +1327,19 @@ (when (not (logtest? (-> obj flags) 1)) (cond ((and arg0 (and (< (vector-vector-distance arg0 (-> obj root trans)) 40960.0) - (>= (-> obj los-last-clear-time) (+ (-> pp clock frame-counter) (seconds -0.2))) + (>= (-> obj los-last-clear-time) (+ (current-time) (seconds -0.2))) ) ) (if (not (and (-> obj path-info curr-segment) (< (-> obj path-info curr-u) 1.0))) (hover-nav-control-method-21 obj) ) ) - ((or (>= (- (-> pp clock frame-counter) (-> obj los-last-clear-time)) (seconds 1)) - (not (-> obj path-info curr-segment)) - ) + ((or (>= (- (current-time) (-> obj los-last-clear-time)) (seconds 1)) (not (-> obj path-info curr-segment))) (hover-nav-control-method-21 obj) (when arg0 (let ((s4-0 (new 'stack-no-clear 'vector))) (set! (-> s4-0 quad) (-> obj root transv quad)) - (if (>= (- (-> pp clock frame-counter) (-> obj los-last-clear-time)) (seconds 1)) + (if (>= (- (current-time) (-> obj los-last-clear-time)) (seconds 1)) (vector-normalize! s4-0 (fmin (vector-length s4-0) (-> obj los-obstruction-distance))) ) (hover-nav-control-method-28 @@ -1697,35 +1693,33 @@ ) (defmethod new hover-nav-control ((allocation symbol) (type-to-make type) (arg0 process) (arg1 collide-shape-moving) (arg2 hover-nav-params)) - (with-pp - (let ((s5-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) - (set! (-> s5-0 root) arg1) - (set! (-> s5-0 root reaction) hover-bounce-reaction) - (set! (-> s5-0 nav) *nav-network*) - (set! (-> s5-0 path-info segment-list) #f) - (set! (-> s5-0 path-info tail-segment) #f) - (set! (-> s5-0 path-info curr-segment) #f) - (set! (-> s5-0 path-info curr-u) 0.0) - (set! (-> s5-0 flags) (the-as uint 0)) - (set! (-> s5-0 params) arg2) - (set! *hover-nav-time-offset* (+ *hover-nav-time-offset* 1)) - (vector-reset! (-> s5-0 dest-pos)) - (set! (-> s5-0 dest-vel quad) (the-as uint128 0)) - (set! (-> s5-0 dest-move-dir quad) (the-as uint128 0)) - (set! (-> s5-0 dest-offset quad) (the-as uint128 0)) - (set! (-> s5-0 nav-collide-impulse quad) (the-as uint128 0)) - (vector-z-quaternion! (-> s5-0 move-dir) (-> s5-0 root quat)) - (set! (-> s5-0 nav-collide-impulse-len) 0.0) - (set! (-> s5-0 speed) 0.0) - (set! (-> s5-0 target-speed) 0.0) - (set! (-> s5-0 target-acceleration) 0.0) - (set! (-> s5-0 speed-dest) 0.0) - (set! (-> s5-0 curr-dest-pt) -1) - (set! (-> s5-0 los-obstruction-distance) 0.0) - (set! (-> s5-0 los-last-clear-time) (-> pp clock frame-counter)) - (hover-nav-control-method-14 s5-0 1.0 1.0) - (nav-network-method-25 (-> s5-0 nav) arg0 (the-as collide-prim-core #f)) - s5-0 - ) + (let ((s5-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> s5-0 root) arg1) + (set! (-> s5-0 root reaction) hover-bounce-reaction) + (set! (-> s5-0 nav) *nav-network*) + (set! (-> s5-0 path-info segment-list) #f) + (set! (-> s5-0 path-info tail-segment) #f) + (set! (-> s5-0 path-info curr-segment) #f) + (set! (-> s5-0 path-info curr-u) 0.0) + (set! (-> s5-0 flags) (the-as uint 0)) + (set! (-> s5-0 params) arg2) + (set! *hover-nav-time-offset* (+ *hover-nav-time-offset* 1)) + (vector-reset! (-> s5-0 dest-pos)) + (set! (-> s5-0 dest-vel quad) (the-as uint128 0)) + (set! (-> s5-0 dest-move-dir quad) (the-as uint128 0)) + (set! (-> s5-0 dest-offset quad) (the-as uint128 0)) + (set! (-> s5-0 nav-collide-impulse quad) (the-as uint128 0)) + (vector-z-quaternion! (-> s5-0 move-dir) (-> s5-0 root quat)) + (set! (-> s5-0 nav-collide-impulse-len) 0.0) + (set! (-> s5-0 speed) 0.0) + (set! (-> s5-0 target-speed) 0.0) + (set! (-> s5-0 target-acceleration) 0.0) + (set! (-> s5-0 speed-dest) 0.0) + (set! (-> s5-0 curr-dest-pt) -1) + (set! (-> s5-0 los-obstruction-distance) 0.0) + (set! (-> s5-0 los-last-clear-time) (current-time)) + (hover-nav-control-method-14 s5-0 1.0 1.0) + (nav-network-method-25 (-> s5-0 nav) arg0 (the-as collide-prim-core #f)) + s5-0 ) ) diff --git a/goal_src/jak2/levels/common/enemy/hover/wasp.gc b/goal_src/jak2/levels/common/enemy/hover/wasp.gc index 046b6337d6..3f23d43235 100644 --- a/goal_src/jak2/levels/common/enemy/hover/wasp.gc +++ b/goal_src/jak2/levels/common/enemy/hover/wasp.gc @@ -579,7 +579,7 @@ ((the-as (function none) t9-0)) ) ) - (set! (-> self last-fire-time) (+ (-> self clock frame-counter) (seconds -1.5))) + (set! (-> self last-fire-time) (+ (current-time) (seconds -1.5))) (none) ) ) @@ -592,7 +592,7 @@ ((the-as (function none) t9-0)) ) ) - (set! (-> self last-fire-time) (+ (-> self clock frame-counter) (seconds -1.5))) + (set! (-> self last-fire-time) (+ (current-time) (seconds -1.5))) (none) ) ) @@ -624,7 +624,7 @@ ) (hover-enemy-method-146 self) (hover-nav-control-method-18 (-> self hover) (-> self path) -1 6) - (set! (-> self last-fire-time) (-> self clock frame-counter)) + (set! (-> self last-fire-time) (current-time)) (set! (-> self bridge-index) 0) (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) (logclear! (-> self mask) (process-mask collectable)) @@ -767,7 +767,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self attack-miss-dist-curr) (-> self attack-miss-dist-min)) (none) ) @@ -788,7 +788,7 @@ (suspend) (ja :num! (seek!)) ) - (set! (-> self last-fire-time) (-> self clock frame-counter)) + (set! (-> self last-fire-time) (current-time)) (set! (-> self restart-fly-anims) #t) (go-virtual shoot-bridge-hostile) (none) @@ -843,7 +843,7 @@ (the-as vector #t) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -885,7 +885,7 @@ ) ) ) - (if (and (>= (- (-> self clock frame-counter) (-> self last-fire-time)) + (if (and (>= (- (current-time) (-> self last-fire-time)) (the int (* 300.0 (rand-vu-float-range (-> self attack-wait-min) (-> self attack-wait-max)))) ) (get-enemy-target self) @@ -928,7 +928,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self attack-miss-dist-curr) (-> self attack-miss-dist-min)) (none) ) @@ -949,7 +949,7 @@ (suspend) (ja :num! (seek!)) ) - (set! (-> self last-fire-time) (-> self clock frame-counter)) + (set! (-> self last-fire-time) (current-time)) (set! (-> self restart-fly-anims) #t) (go-hostile self) (none) @@ -1103,8 +1103,8 @@ 0 (set! (-> self hit-points) 0) (do-effect (-> self skel effect) 'death-default 0.0 -1) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) diff --git a/goal_src/jak2/levels/common/enemy/metalhead_bearer/centurion.gc b/goal_src/jak2/levels/common/enemy/metalhead_bearer/centurion.gc index a1d7f2bbff..64537d3602 100644 --- a/goal_src/jak2/levels/common/enemy/metalhead_bearer/centurion.gc +++ b/goal_src/jak2/levels/common/enemy/metalhead_bearer/centurion.gc @@ -485,7 +485,7 @@ (talker-spawn-func (-> *talker-speech* 58) *entity-pool* (target-pos 0) (the-as region #f)) ) (set! (-> *part-id-table* 2102 init-specs 13 initial-valuef) 255.0) - (set! (-> obj state-time) (-> pp clock frame-counter)) + (set! (-> obj state-time) (current-time)) 'back ) ) @@ -1158,7 +1158,7 @@ (t9-0) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-165 self) (set! (-> self joint-enable) #t) (set! (-> self can-shoot?) (the-as basic #t)) @@ -1214,14 +1214,14 @@ (else (when (-> self can-shoot?) (if (and (get-enemy-target self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the int (+ 60.0 (* 0.0036621094 f30-0)))) + (>= (- (current-time) (-> self state-time)) (the int (+ 60.0 (* 0.0036621094 f30-0)))) (check-los? (-> self los) 0) ) (go-virtual fire) ) ) (if (skip-check-los? (-> self los) 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ) ) @@ -1329,7 +1329,7 @@ ) ) ) - (+ (-> self clock frame-counter) (seconds 3)) + (+ (current-time) (seconds 3)) ) #f ) diff --git a/goal_src/jak2/levels/common/enemy/metalhead_brown/metalmonk.gc b/goal_src/jak2/levels/common/enemy/metalhead_brown/metalmonk.gc index 1fd3217553..8c344f6e34 100644 --- a/goal_src/jak2/levels/common/enemy/metalhead_brown/metalmonk.gc +++ b/goal_src/jak2/levels/common/enemy/metalhead_brown/metalmonk.gc @@ -262,114 +262,110 @@ ) (defmethod metalmonk-method-181 metalmonk ((obj metalmonk) (arg0 float) (arg1 float)) - (with-pp - (let ((f28-0 (vector-dot (-> obj new-facing) (-> obj old-facing))) - (f30-1 (/ (ja-frame-num 0) (the float (ja-num-frames 0)))) - ) - (when (and (< f28-0 (cos (* 182.04445 arg0))) (let ((v1-7 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) - ) - (not (and v1-7 (= v1-7 (-> obj draw art-group data 13)))) - ) - ) - (ja-channel-push! 1 (seconds 0.16)) - (let ((v1-13 (-> obj skel root-channel 0))) - (set! (-> v1-13 frame-group) (the-as art-joint-anim (-> obj draw art-group data 13))) - ) - (let ((s4-1 (-> obj skel root-channel 0))) - (set! (-> s4-1 num-func) num-func-identity) - (set! (-> s4-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) - ) - (set! (-> obj high-time) (-> pp clock frame-counter)) + (let ((f28-0 (vector-dot (-> obj new-facing) (-> obj old-facing))) + (f30-1 (/ (ja-frame-num 0) (the float (ja-num-frames 0)))) ) - (let ((v1-22 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) + (when (and (< f28-0 (cos (* 182.04445 arg0))) (let ((v1-7 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (not (and v1-7 (= v1-7 (-> obj draw art-group data 13)))) + ) + ) + (ja-channel-push! 1 (seconds 0.16)) + (let ((v1-13 (-> obj skel root-channel 0))) + (set! (-> v1-13 frame-group) (the-as art-joint-anim (-> obj draw art-group data 13))) + ) + (let ((s4-1 (-> obj skel root-channel 0))) + (set! (-> s4-1 num-func) num-func-identity) + (set! (-> s4-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) + ) + (set! (-> obj high-time) (current-time)) + ) + (let ((v1-22 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (when (or (not (and v1-22 (or (= v1-22 (-> obj draw art-group data 12)) (= v1-22 (-> obj draw art-group data 13))))) + (let ((v1-28 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (and (and v1-28 (= v1-28 (-> obj draw art-group data 13))) + (< (ja-frame-num 0) 3.0) + (and (< (cos (* 182.04445 arg1)) f28-0) (>= (- (current-time) (-> obj high-time)) (seconds 1))) ) - ) - ) - (when (or (not (and v1-22 (or (= v1-22 (-> obj draw art-group data 12)) (= v1-22 (-> obj draw art-group data 13))))) - (let ((v1-28 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) - ) - (and (and v1-28 (= v1-28 (-> obj draw art-group data 13))) - (< (ja-frame-num 0) 3.0) - (and (< (cos (* 182.04445 arg1)) f28-0) (>= (- (-> pp clock frame-counter) (-> obj high-time)) (seconds 1))) - ) - ) ) - (ja-channel-push! 1 (seconds 0.16)) - (let ((v1-41 (-> obj skel root-channel 0))) - (set! (-> v1-41 frame-group) (the-as art-joint-anim (-> obj draw art-group data 12))) - ) - (let ((gp-1 (-> obj skel root-channel 0))) - (set! (-> gp-1 num-func) num-func-identity) - (set! (-> gp-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) - ) + ) + (ja-channel-push! 1 (seconds 0.16)) + (let ((v1-41 (-> obj skel root-channel 0))) + (set! (-> v1-41 frame-group) (the-as art-joint-anim (-> obj draw art-group data 12))) + ) + (let ((gp-1 (-> obj skel root-channel 0))) + (set! (-> gp-1 num-func) num-func-identity) + (set! (-> gp-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod metalmonk-method-182 metalmonk ((obj metalmonk) (arg0 float) (arg1 float)) - (with-pp - (let ((f28-0 (vector-dot (-> obj new-facing) (-> obj old-facing))) - (f30-1 (/ (ja-frame-num 0) (the float (ja-num-frames 0)))) - ) - (when (and (< f28-0 (cos (* 182.04445 arg0))) (let ((v1-7 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) - ) - (not (and v1-7 (= v1-7 (-> obj draw art-group data 9)))) - ) - ) - (ja-channel-push! 1 (seconds 0.16)) - (let ((v1-13 (-> obj skel root-channel 0))) - (set! (-> v1-13 frame-group) (the-as art-joint-anim (-> obj draw art-group data 9))) - ) - (let ((s4-1 (-> obj skel root-channel 0))) - (set! (-> s4-1 num-func) num-func-identity) - (set! (-> s4-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) - ) - (set! (-> obj high-time) (-> pp clock frame-counter)) + (let ((f28-0 (vector-dot (-> obj new-facing) (-> obj old-facing))) + (f30-1 (/ (ja-frame-num 0) (the float (ja-num-frames 0)))) ) - (let ((v1-22 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) + (when (and (< f28-0 (cos (* 182.04445 arg0))) (let ((v1-7 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (not (and v1-7 (= v1-7 (-> obj draw art-group data 9)))) + ) + ) + (ja-channel-push! 1 (seconds 0.16)) + (let ((v1-13 (-> obj skel root-channel 0))) + (set! (-> v1-13 frame-group) (the-as art-joint-anim (-> obj draw art-group data 9))) + ) + (let ((s4-1 (-> obj skel root-channel 0))) + (set! (-> s4-1 num-func) num-func-identity) + (set! (-> s4-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) + ) + (set! (-> obj high-time) (current-time)) + ) + (let ((v1-22 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (when (or (not (and v1-22 (or (= v1-22 (-> obj draw art-group data 8)) (= v1-22 (-> obj draw art-group data 9))))) + (let ((v1-28 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (and (and v1-28 (= v1-28 (-> obj draw art-group data 9))) + (and (< (cos (* 182.04445 arg1)) f28-0) (>= (- (current-time) (-> obj high-time)) (seconds 1))) ) - ) - ) - (when (or (not (and v1-22 (or (= v1-22 (-> obj draw art-group data 8)) (= v1-22 (-> obj draw art-group data 9))))) - (let ((v1-28 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) - ) - (and (and v1-28 (= v1-28 (-> obj draw art-group data 9))) - (and (< (cos (* 182.04445 arg1)) f28-0) (>= (- (-> pp clock frame-counter) (-> obj high-time)) (seconds 1))) - ) - ) ) - (ja-channel-push! 1 (seconds 0.5)) - (let ((v1-39 (-> obj skel root-channel 0))) - (set! (-> v1-39 frame-group) (the-as art-joint-anim (-> obj draw art-group data 8))) - ) - (let ((gp-1 (-> obj skel root-channel 0))) - (set! (-> gp-1 num-func) num-func-identity) - (set! (-> gp-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) - ) + ) + (ja-channel-push! 1 (seconds 0.5)) + (let ((v1-39 (-> obj skel root-channel 0))) + (set! (-> v1-39 frame-group) (the-as art-joint-anim (-> obj draw art-group data 8))) + ) + (let ((gp-1 (-> obj skel root-channel 0))) + (set! (-> gp-1 num-func) num-func-identity) + (set! (-> gp-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) ) ) ) - 0 - (none) ) + 0 + (none) ) (defmethod track-target! metalmonk ((obj metalmonk)) @@ -619,7 +615,7 @@ ) ) (let ((gp-0 (handle->process (-> self focus handle)))) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (if (and (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (and gp-0 (or (and (< (vector-vector-xz-distance (get-trans (the-as process-focusable gp-0) 0) (-> self root-override2 trans)) 20480.0 @@ -824,7 +820,7 @@ (t9-0) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -834,7 +830,7 @@ ) ) (let ((a0-1 (handle->process (-> self focus handle)))) - (if (and a0-1 (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (if (and a0-1 (and (>= (- (current-time) (-> 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-override2 trans) diff --git a/goal_src/jak2/levels/common/enemy/metalhead_slinger/grenadier.gc b/goal_src/jak2/levels/common/enemy/metalhead_slinger/grenadier.gc index 12cf5661b8..18d8f1e01c 100644 --- a/goal_src/jak2/levels/common/enemy/metalhead_slinger/grenadier.gc +++ b/goal_src/jak2/levels/common/enemy/metalhead_slinger/grenadier.gc @@ -283,45 +283,43 @@ (defmethod general-event-handler grenadier ((obj grenadier) (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" - (with-pp - (case arg2 - (('hit-knocked) - (when (= (-> obj incoming knocked-type) (knocked-type knocked-type-4)) - (if (and (< (- (-> pp clock frame-counter) (-> obj suppress-knockaside-timer)) (seconds 0.6)) - (and (-> obj next-state) (= (-> obj next-state name) 'attack)) - (nonzero? (-> obj hit-points)) - ) - (return #t) - ) - (logior! (-> obj status-flags) 1) - (set! (-> obj suppress-knockaside-timer) (-> pp clock frame-counter)) - ) - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - (('notify) - (cond - ((and (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) - (let ((v1-23 (new 'stack-no-clear 'event-message-block))) - (set! (-> v1-23 from) (process->ppointer arg0)) - (set! (-> v1-23 num-params) arg1) - (set! (-> v1-23 message) 'victory) - (set! (-> v1-23 param 0) (-> arg3 param 0)) - (set! (-> v1-23 param 1) (-> arg3 param 1)) - (set! (-> v1-23 param 2) (-> arg3 param 2)) - (set! (-> v1-23 param 3) (-> arg3 param 3)) - (set! (-> v1-23 param 4) (-> arg3 param 4)) - (set! (-> v1-23 param 5) (-> arg3 param 5)) - (send-event-function obj v1-23) - ) - ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + (case arg2 + (('hit-knocked) + (when (= (-> obj incoming knocked-type) (knocked-type knocked-type-4)) + (if (and (< (- (current-time) (-> obj suppress-knockaside-timer)) (seconds 0.6)) + (and (-> obj next-state) (= (-> obj next-state name) 'attack)) + (nonzero? (-> obj hit-points)) + ) + (return #t) ) + (logior! (-> obj status-flags) 1) + (set! (-> obj suppress-knockaside-timer) (current-time)) + ) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (('notify) + (cond + ((and (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) + (let ((v1-23 (new 'stack-no-clear 'event-message-block))) + (set! (-> v1-23 from) (process->ppointer arg0)) + (set! (-> v1-23 num-params) arg1) + (set! (-> v1-23 message) 'victory) + (set! (-> v1-23 param 0) (-> arg3 param 0)) + (set! (-> v1-23 param 1) (-> arg3 param 1)) + (set! (-> v1-23 param 2) (-> arg3 param 2)) + (set! (-> v1-23 param 3) (-> arg3 param 3)) + (set! (-> v1-23 param 4) (-> arg3 param 4)) + (set! (-> v1-23 param 5) (-> arg3 param 5)) + (send-event-function obj v1-23) + ) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -566,7 +564,7 @@ ) ) ) - (when (or (>= (- (-> self clock frame-counter) (-> self state-time)) (rand-vu-int-range (seconds 3) (seconds 9))) + (when (or (>= (- (current-time) (-> self state-time)) (rand-vu-int-range (seconds 3) (seconds 9))) (>= 8192.0 (vector-vector-xz-distance (-> self root-override2 trans) (-> self bank final-pos))) ) (if (and (handle->process (-> self focus handle)) @@ -632,7 +630,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior grenadier) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -645,7 +643,7 @@ ) :trans (behavior () (let ((f0-0 (vector-vector-xz-distance (-> self root-override2 trans) (-> self move-pos)))) - (if (or (>= 12288.0 f0-0) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 6))) + (if (or (>= 12288.0 f0-0) (>= (- (current-time) (-> self state-time)) (seconds 6))) (go-hostile self) ) ) @@ -683,7 +681,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior grenadier) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) diff --git a/goal_src/jak2/levels/common/enemy/spyder.gc b/goal_src/jak2/levels/common/enemy/spyder.gc index d1aa1d5d60..70964b22b1 100644 --- a/goal_src/jak2/levels/common/enemy/spyder.gc +++ b/goal_src/jak2/levels/common/enemy/spyder.gc @@ -262,78 +262,76 @@ (defmethod general-event-handler spyder ((obj spyder) (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" - (with-pp - (case arg2 - (('hit-knocked) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) - (logior! (-> obj focus-status) (focus-status hit)) - (if (zero? (-> obj hit-points)) - (logior! (-> obj focus-status) (focus-status dead)) - ) - (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) - (enemy-method-62 obj) - (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (process-contact-action arg0) - (send-event arg0 'get-attack-count 1) - (when (zero? (-> obj hit-points)) - (case (-> obj incoming knocked-type) - (((knocked-type knocked-type-4) (knocked-type knocked-type-6)) - (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) - 0 - ) - ) + (case arg2 + (('hit-knocked) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) + ) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (process-contact-action arg0) + (send-event arg0 'get-attack-count 1) + (when (zero? (-> obj hit-points)) + (case (-> obj incoming knocked-type) + (((knocked-type knocked-type-4) (knocked-type knocked-type-6)) + (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) + 0 + ) ) - (go (method-of-object obj knocked)) ) - (('attack) - (if (type? (-> arg0 parent 0) enemy) - (logior! (-> obj status-flags) 2) - ) - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - (('notify) - (cond - ((= (-> arg3 param 0) 'attack) - (cond - ((= (-> arg3 param 1) (handle->process (-> obj focus handle))) - (let ((a1-6 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-6 from) (process->ppointer arg0)) - (set! (-> a1-6 num-params) arg1) - (set! (-> a1-6 message) 'victory) - (set! (-> a1-6 param 0) (-> arg3 param 0)) - (set! (-> a1-6 param 1) (-> arg3 param 1)) - (set! (-> a1-6 param 2) (-> arg3 param 2)) - (set! (-> a1-6 param 3) (-> arg3 param 3)) - (set! (-> a1-6 param 4) (-> arg3 param 4)) - (set! (-> a1-6 param 5) (-> arg3 param 5)) - (send-event-function obj a1-6) - ) + (go (method-of-object obj knocked)) + ) + (('attack) + (if (type? (-> arg0 parent 0) enemy) + (logior! (-> obj status-flags) 2) + ) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (('notify) + (cond + ((= (-> arg3 param 0) 'attack) + (cond + ((= (-> arg3 param 1) (handle->process (-> obj focus handle))) + (let ((a1-6 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-6 from) (process->ppointer arg0)) + (set! (-> a1-6 num-params) arg1) + (set! (-> a1-6 message) 'victory) + (set! (-> a1-6 param 0) (-> arg3 param 0)) + (set! (-> a1-6 param 1) (-> arg3 param 1)) + (set! (-> a1-6 param 2) (-> arg3 param 2)) + (set! (-> a1-6 param 3) (-> arg3 param 3)) + (set! (-> a1-6 param 4) (-> arg3 param 4)) + (set! (-> a1-6 param 5) (-> arg3 param 5)) + (send-event-function obj a1-6) ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - ) - ) - (('uncloak) - (when (!= (-> obj dest-fade) 128.0) - (set! (-> obj shock-effect-end) (+ (-> pp clock frame-counter) (seconds 1))) - (set! (-> obj dest-fade) 128.0) - (sound-play "spyder-uncloak") - ) - (send-event obj 'cue-chase) - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + ) + (('uncloak) + (when (!= (-> obj dest-fade) 128.0) + (set! (-> obj shock-effect-end) (+ (current-time) (seconds 1))) + (set! (-> obj dest-fade) 128.0) + (sound-play "spyder-uncloak") + ) + (send-event obj 'cue-chase) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -362,9 +360,9 @@ (if (< 245760.0 (vector-vector-distance (-> obj root-override2 trans) (camera-pos))) (setup-masks (-> obj draw) 0 16) ) - (when (< (-> pp clock frame-counter) (-> obj shock-effect-end)) - (when (>= (- (-> pp clock frame-counter) (-> obj shock-effect-time)) (seconds 0.04)) - (set! (-> obj shock-effect-time) (-> pp clock frame-counter)) + (when (< (current-time) (-> obj shock-effect-end)) + (when (>= (- (current-time) (-> obj shock-effect-time)) (seconds 0.04)) + (set! (-> obj shock-effect-time) (current-time)) (process-drawable-shock-skel-effect obj (-> *lightning-spec-id-table* 5) @@ -711,7 +709,7 @@ ) ) (when (!= (-> self dest-fade) 128.0) - (set! (-> self shock-effect-end) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self shock-effect-end) (+ (current-time) (seconds 1))) (set! (-> self dest-fade) 128.0) ) (none) @@ -866,7 +864,7 @@ (look-at-target! self (enemy-flag death-start)) (set! (-> self status-flags) (logand -3 (-> self status-flags))) (when (!= (-> self dest-fade) 128.0) - (set! (-> self shock-effect-end) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self shock-effect-end) (+ (current-time) (seconds 1))) (set! (-> self dest-fade) 128.0) (sound-play "spyder-uncloak") ) @@ -931,7 +929,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior spyder) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -944,7 +942,7 @@ ) :trans (behavior () (let ((f0-0 (vector-vector-xz-distance (-> self root-override2 trans) (-> self move-dest)))) - (if (or (>= 4096.0 f0-0) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 6))) + (if (or (>= 4096.0 f0-0) (>= (- (current-time) (-> self state-time)) (seconds 6))) (go-hostile self) ) ) @@ -1097,8 +1095,8 @@ (set! (-> self fire-info 0 quad) (-> s3-0 quad)) (set! (-> self fire-info 1 quad) (-> s2-1 quad)) ) - (let ((s3-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-1) (seconds 0.2)) + (let ((s3-1 (current-time))) + (until (>= (- (current-time) s3-1) (seconds 0.2)) (set! f30-0 (seek f30-0 (lerp-scale 0.0 1.0 (the float s4-0) 0.0 8.0) (-> self clock seconds-per-frame))) (ja :num! (loop!)) (let ((a0-27 (-> self skel root-channel 1))) diff --git a/goal_src/jak2/levels/common/entities/com-elevator.gc b/goal_src/jak2/levels/common/entities/com-elevator.gc index 98c46816c5..211b8fbe4b 100644 --- a/goal_src/jak2/levels/common/entities/com-elevator.gc +++ b/goal_src/jak2/levels/common/entities/com-elevator.gc @@ -134,8 +134,8 @@ (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -286,8 +286,8 @@ For example for an elevator pre-compute the distance between the first and last (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) 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 24eddc9834..62100966ea 100644 --- a/goal_src/jak2/levels/common/entities/fort-floor-spike.gc +++ b/goal_src/jak2/levels/common/entities/fort-floor-spike.gc @@ -90,7 +90,7 @@ object (case event-type (('touched) - (when (+ (-> self clock frame-counter) (seconds -2)) + (when (+ (current-time) (seconds -2)) (let* ((s3-0 proc) (proc-draw (if (type? s3-0 process-drawable) (the-as process-drawable s3-0) @@ -124,7 +124,7 @@ (send-event-function proc evt) ) ) - (let ((frame-count (-> self clock frame-counter))) + (let ((frame-count (current-time))) (set! (-> self no-overlap-timer) (the-as uint frame-count)) frame-count ) diff --git a/goal_src/jak2/levels/common/entities/gun-buoy.gc b/goal_src/jak2/levels/common/entities/gun-buoy.gc index fcb90b1023..49302cd3ef 100644 --- a/goal_src/jak2/levels/common/entities/gun-buoy.gc +++ b/goal_src/jak2/levels/common/entities/gun-buoy.gc @@ -404,7 +404,7 @@ (none) ) :trans (behavior () - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (when (and (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (< 2 (the-as int (-> self focus aware))) (-> *setting-control* user-current gun-buoy) ) @@ -643,7 +643,7 @@ (defstate stare-down (gun-buoy) :virtual #t :enter (behavior () - (set! (-> self stare-down-timer) (-> self clock frame-counter)) + (set! (-> self stare-down-timer) (current-time)) (none) ) :trans (behavior () @@ -654,7 +654,7 @@ ) ((or (< (the-as int v1-0) 2) (not (-> *setting-control* user-current gun-buoy)) - (>= (- (-> self clock frame-counter) (-> self stare-down-timer)) (seconds 6)) + (>= (- (current-time) (-> self stare-down-timer)) (seconds 6)) ) (go-virtual exit-ambush) ) @@ -718,7 +718,7 @@ ) ) ) - (set! (-> self warning-timer) (-> self clock frame-counter)) + (set! (-> self warning-timer) (current-time)) (set! (-> self warning-id) (sound-play "buoy-alarm")) (none) ) @@ -731,7 +731,7 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self warning-timer)) (-> self warning-interval)) + (when (>= (- (current-time) (-> self warning-timer)) (-> self warning-interval)) (cond ((>= (the-as int gp-0) 3) (logior! (-> self flags) 2) @@ -793,7 +793,7 @@ (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (let ((v1-3 (-> self focus aware))) (cond ((= v1-3 (enemy-aware enemy-aware-2)) @@ -855,8 +855,8 @@ (gun-buoy-method-183 self a1-1) ) ) - (let ((s5-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-1) (seconds 0.75)) + (let ((s5-1 (current-time))) + (until (>= (- (current-time) s5-1) (seconds 0.75)) (suspend) ) ) @@ -890,8 +890,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 2)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 2)) (suspend) ) ) @@ -982,7 +982,7 @@ ) ) 0 - (let ((v1-30 (-> pp clock frame-counter)) + (let ((v1-30 (current-time)) (f0-18 4.83) ) (set! (-> obj y-bob) diff --git a/goal_src/jak2/levels/common/entities/sew-gunturret.gc b/goal_src/jak2/levels/common/entities/sew-gunturret.gc index 5c1567c315..579a73a2b4 100644 --- a/goal_src/jak2/levels/common/entities/sew-gunturret.gc +++ b/goal_src/jak2/levels/common/entities/sew-gunturret.gc @@ -708,7 +708,7 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) @@ -719,14 +719,14 @@ :code (behavior () (set-aim-at-default! self) (until #f - (-> self clock frame-counter) - (until (>= (- (-> self clock frame-counter) (-> self last-hit-time)) (seconds 2)) + (current-time) + (until (>= (- (current-time) (-> self last-hit-time)) (seconds 2)) (suspend) ) (update-collision! self) (sound-play "sew-gun-lock") - (let ((frame-counter (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 0.75)) + (let ((frame-counter (current-time))) + (until (>= (- (current-time) frame-counter) (seconds 0.75)) (aim-turret! self #t) (suspend) ) @@ -736,14 +736,14 @@ (fire-sound? #t) ) (sound-play "gturret") - (let ((s4-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-1) (seconds 0.125)) + (let ((s4-1 (current-time))) + (until (>= (- (current-time) s4-1) (seconds 0.125)) (cond ((not (-> self can-shoot)) ) - ((>= (- (-> self clock frame-counter) (the-as time-frame frames)) (seconds 0.05)) + ((>= (- (current-time) (the-as time-frame frames)) (seconds 0.05)) (fire-turret! self fire-sound?) - (set! frames (the-as int (-> self clock frame-counter))) + (set! frames (the-as int (current-time))) (set! fire-sound? (not fire-sound?)) ) (else @@ -758,8 +758,8 @@ (set! (-> self flash-state) #f) (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self params idle-anim))) - (let ((_frame-counter (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) _frame-counter) (seconds 0.5)) + (let ((_frame-counter (current-time))) + (until (>= (- (current-time) _frame-counter) (seconds 0.5)) (spawn-with-cspace (-> self smoke-part) (-> self node-list data (-> self params hole-joints 0))) (spawn-with-cspace (-> self smoke-part) (-> self node-list data (-> self params hole-joints 1))) (spawn-with-cspace (-> self smoke-part) (-> self node-list data (-> self params hole-joints 2))) @@ -797,7 +797,7 @@ @TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (if (and (= event-type 'notify) (< 1 arg2) (= (-> event param 0) 'attack) (= (-> event param 1) *target*)) - (set! (-> obj last-hit-time) (-> pp clock frame-counter)) + (set! (-> obj last-hit-time) (current-time)) ) (case event-type (('start) @@ -874,15 +874,15 @@ (let ((vec (new 'stack-no-clear 'vector))) (set! (-> vec quad) (-> self root-override2 trans quad)) (set! (-> vec y) (+ 10240.0 (-> vec y))) - (let ((frame-counter (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 2)) + (let ((frame-counter (current-time))) + (until (>= (- (current-time) frame-counter) (seconds 2)) (spawn (-> self part) vec) (suspend) ) ) ) - (let ((_frame-counter (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) _frame-counter) (seconds 1)) + (let ((_frame-counter (current-time))) + (until (>= (- (current-time) _frame-counter) (seconds 1)) (suspend) ) ) diff --git a/goal_src/jak2/levels/common/entities/spydroid.gc b/goal_src/jak2/levels/common/entities/spydroid.gc index d3c380f3d0..7e1cc4563a 100644 --- a/goal_src/jak2/levels/common/entities/spydroid.gc +++ b/goal_src/jak2/levels/common/entities/spydroid.gc @@ -859,7 +859,7 @@ (t9-0) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -868,7 +868,7 @@ (t9-0) ) ) - (if (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (< (- (current-time) (-> self state-time)) (seconds 2)) (spawn (-> self explode-part) (-> self root-override2 trans)) ) (none) @@ -910,8 +910,8 @@ ) (suspend) (ja-channel-set! 0) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -1067,7 +1067,7 @@ ) ) (let ((a0-1 (handle->process (-> self focus handle)))) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (if (and (>= (- (current-time) (-> 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-override2 trans) diff --git a/goal_src/jak2/levels/common/flitter.gc b/goal_src/jak2/levels/common/flitter.gc index 766328a6ce..370869c2c7 100644 --- a/goal_src/jak2/levels/common/flitter.gc +++ b/goal_src/jak2/levels/common/flitter.gc @@ -698,8 +698,8 @@ (-> gp-0 ppointer) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.6)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.6)) (suspend) ) ) @@ -720,8 +720,8 @@ ) ) ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) (suspend) ) ) @@ -748,7 +748,7 @@ ) 0 (look-at-target! self (enemy-flag lock-focus)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (-> self root-override2))) (vector-reset! (-> gp-0 transv)) (set! (-> gp-0 transv y) (* 4096.0 (get-rand-float-range self 34.0 38.0))) @@ -859,87 +859,83 @@ ) (defmethod flitter-method-180 flitter ((obj flitter)) - (with-pp - (let* ((s5-0 (handle->process (-> obj focus handle))) - (s3-0 (if (type? s5-0 process-focusable) - (the-as process-focusable s5-0) - ) - ) + (let* ((s5-0 (handle->process (-> obj focus handle))) + (s3-0 (if (type? s5-0 process-focusable) + (the-as process-focusable s5-0) + ) + ) + ) + (when s3-0 + (let* ((s5-1 (get-trans s3-0 0)) + (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-1 (-> obj root-override2 trans))) + (f30-0 (vector-length s4-1)) + ) + (cond + ((enemy-method-99 obj s3-0) + (go-flee obj) ) - (when s3-0 - (let* ((s5-1 (get-trans s3-0 0)) - (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-1 (-> obj root-override2 trans))) - (f30-0 (vector-length s4-1)) - ) - (cond - ((enemy-method-99 obj s3-0) - (go-flee obj) - ) - ((and (< f30-0 32768.0) (not (flitter-method-182 obj s3-0))) - (go (method-of-object obj circling)) - ) - ((< f30-0 (-> obj enemy-info-override notice-nav-radius)) - (set! (-> obj target-pos quad) (-> s5-1 quad)) - (let ((s3-1 (new 'stack-no-clear 'vector))) - (set! (-> s3-1 quad) (-> s4-1 quad)) - (let ((s5-2 (new 'stack-no-clear 'vector))) - (set! (-> s5-2 quad) (-> obj root-override2 transv quad)) - (vector-normalize! s5-2 f30-0) - (if (>= (vector-dot s3-1 s5-2) 0.98) - (go (method-of-object obj attack)) - ) - ) - ) - ) - ((< f30-0 32768.0) - (set! (-> obj target-pos quad) (-> s5-1 quad)) - ) - ((or (>= (- (-> pp clock frame-counter) (the-as int (-> obj last-change-dir))) (-> obj change-dir-time)) - (< (vector-vector-distance-squared (-> obj root-override2 trans) (-> obj target-pos)) 0.1) - ) - (set! (-> obj last-change-dir) (the-as uint (-> pp clock frame-counter))) - (set! (-> obj change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) - (let ((s3-2 (new 'stack-no-clear 'vector)) - (f0-9 (* 0.5 f30-0 (tan (-> obj move-angle)))) - (s2-0 (new 'stack-no-clear 'vector)) + ((and (< f30-0 32768.0) (not (flitter-method-182 obj s3-0))) + (go (method-of-object obj circling)) + ) + ((< f30-0 (-> obj enemy-info-override notice-nav-radius)) + (set! (-> obj target-pos quad) (-> s5-1 quad)) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (set! (-> s3-1 quad) (-> s4-1 quad)) + (let ((s5-2 (new 'stack-no-clear 'vector))) + (set! (-> s5-2 quad) (-> obj root-override2 transv quad)) + (vector-normalize! s5-2 f30-0) + (if (>= (vector-dot s3-1 s5-2) 0.98) + (go (method-of-object obj attack)) ) - (if (-> obj heading) - (set-vector! s3-2 (-> s4-1 z) (-> s4-1 y) (- (-> s4-1 x)) 1.0) - (set-vector! s3-2 (- (-> s4-1 z)) (-> s4-1 y) (-> s4-1 x) 1.0) - ) - (set! (-> obj heading) (the-as basic (not (-> obj heading)))) - (let ((f28-1 (rand-vu-float-range (* 0.75 f0-9) f0-9)) - (s4-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s4-1 (* -0.6 f30-0))) - ) - (vector-normalize! s3-2 f28-1) - (vector+! s3-2 s3-2 s4-2) - ) - (clamp-vector-to-mesh-cross-gaps (-> obj nav state) s3-2) - (vector+! s2-0 s5-1 s3-2) - (set! (-> obj target-pos quad) (-> s2-0 quad)) ) ) - ) + ) + ((< f30-0 32768.0) + (set! (-> obj target-pos quad) (-> s5-1 quad)) + ) + ((or (>= (- (current-time) (the-as int (-> obj last-change-dir))) (-> obj change-dir-time)) + (< (vector-vector-distance-squared (-> obj root-override2 trans) (-> obj target-pos)) 0.1) + ) + (set! (-> obj last-change-dir) (the-as uint (current-time))) + (set! (-> obj change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) + (let ((s3-2 (new 'stack-no-clear 'vector)) + (f0-9 (* 0.5 f30-0 (tan (-> obj move-angle)))) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (if (-> obj heading) + (set-vector! s3-2 (-> s4-1 z) (-> s4-1 y) (- (-> s4-1 x)) 1.0) + (set-vector! s3-2 (- (-> s4-1 z)) (-> s4-1 y) (-> s4-1 x) 1.0) + ) + (set! (-> obj heading) (the-as basic (not (-> obj heading)))) + (let ((f28-1 (rand-vu-float-range (* 0.75 f0-9) f0-9)) + (s4-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s4-1 (* -0.6 f30-0))) + ) + (vector-normalize! s3-2 f28-1) + (vector+! s3-2 s3-2 s4-2) + ) + (clamp-vector-to-mesh-cross-gaps (-> obj nav state) s3-2) + (vector+! s2-0 s5-1 s3-2) + (set! (-> obj target-pos quad) (-> s2-0 quad)) + ) + ) ) - 0 ) + 0 ) - 0 - (none) ) + 0 + (none) ) ;; WARN: Return type mismatch time-frame vs none. (defmethod flitter-method-181 flitter ((obj flitter)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (the-as int (-> obj amb-sound-timer))) - (the int (* 300.0 (rand-vu-float-range 1.5 3.0))) - ) - (sound-play "flitter-amb" :position (-> obj root-override2 trans)) - (set! (-> obj amb-sound-timer) (the-as uint (-> pp clock frame-counter))) - ) - (none) + (when (>= (- (current-time) (the-as int (-> obj amb-sound-timer))) + (the int (* 300.0 (rand-vu-float-range 1.5 3.0))) + ) + (sound-play "flitter-amb" :position (-> obj root-override2 trans)) + (set! (-> obj amb-sound-timer) (the-as uint (current-time))) ) + (none) ) (defbehavior flitter-fall-and-play-death-anim flitter ((arg0 art-joint-anim) (arg1 float) (arg2 time-frame)) @@ -954,7 +950,7 @@ ) (set! (-> self root-override2 transv y) 33775.48) (ja :num-func num-func-identity :frame-num 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self root-override2 status) (collide-status on-surface on-ground touch-surface)) (until v1-29 (let ((f0-2 102400.0)) @@ -963,7 +959,7 @@ ) (suspend) (ja :num! (seek! max arg1)) - (set! v1-29 (or (ja-done? 0) (>= (- (-> self clock frame-counter) (-> self state-time)) arg2))) + (set! v1-29 (or (ja-done? 0) (>= (- (current-time) (-> self state-time)) arg2))) ) ) ) @@ -1056,7 +1052,7 @@ (t9-0) ) ) - (set! (-> self off-screen-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self off-screen-timer) (the-as uint (current-time))) (none) ) :trans (behavior () @@ -1064,7 +1060,7 @@ (if gp-0 (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable gp-0) 0) quad)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((v1-11 (-> self focus aware))) (cond ((= v1-11 (enemy-aware enemy-aware-3)) @@ -1081,14 +1077,12 @@ ) ) ) - (if (and (get-enemy-target self) - (>= (- (-> self clock frame-counter) (the-as int (-> self off-screen-timer))) (seconds 0.3)) - ) + (if (and (get-enemy-target self) (>= (- (current-time) (the-as int (-> self off-screen-timer))) (seconds 0.3))) (go-hostile self) ) ) (else - (set! (-> self off-screen-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self off-screen-timer) (the-as uint (current-time))) ) ) ) @@ -1138,9 +1132,9 @@ (defstate hostile (flitter) :virtual #t :enter (behavior () - (set! (-> self last-change-dir) (the-as uint (-> self clock frame-counter))) + (set! (-> self last-change-dir) (the-as uint (current-time))) (set! (-> self change-dir-time) 0) - (set! (-> self attack-time) (+ (-> self clock frame-counter) (seconds 0.35))) + (set! (-> self attack-time) (+ (current-time) (seconds 0.35))) (let ((t9-0 (-> (method-of-type nav-enemy hostile) enter))) (if t9-0 (t9-0) @@ -1203,7 +1197,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior flitter) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -1240,7 +1234,7 @@ ) (set! s5-2 (cond ((and gp-0 - (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.5)) + (< (- (current-time) (-> self state-time)) (seconds 1.5)) gp-0 (not (logtest? (-> gp-0 focus-status) (focus-status disable dead ignore grabbed))) ) diff --git a/goal_src/jak2/levels/common/grunt.gc b/goal_src/jak2/levels/common/grunt.gc index dc3af85521..cf7a3a147b 100644 --- a/goal_src/jak2/levels/common/grunt.gc +++ b/goal_src/jak2/levels/common/grunt.gc @@ -461,8 +461,8 @@ (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.2)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.2)) (suspend) ) ) @@ -781,7 +781,7 @@ ) ) (let ((a0-1 (grunt-method-184 self 13312.0)) - (gp-0 (-> self clock frame-counter)) + (gp-0 (current-time)) ) (when (and (>= gp-0 (-> self next-warn-time)) (not (logtest? (-> self draw status) (draw-control-status on-screen))) diff --git a/goal_src/jak2/levels/common/guard-projectile.gc b/goal_src/jak2/levels/common/guard-projectile.gc index 0f55445f39..ed0973cc4b 100644 --- a/goal_src/jak2/levels/common/guard-projectile.gc +++ b/goal_src/jak2/levels/common/guard-projectile.gc @@ -777,9 +777,9 @@ (vector-float*! (-> a2-0 transv) (-> a2-0 transv) 0.2) ) (when (and (logtest? v1-0 (collide-status impact-surface)) - (>= (- (-> self clock frame-counter) (-> obj played-bounce-time)) (seconds 0.3)) + (>= (- (current-time) (-> obj played-bounce-time)) (seconds 0.3)) ) - (set! (-> obj played-bounce-time) (-> self clock frame-counter)) + (set! (-> obj played-bounce-time) (current-time)) (sound-play "grenade-bounce") ) ) diff --git a/goal_src/jak2/levels/common/races/race-manager.gc b/goal_src/jak2/levels/common/races/race-manager.gc index 9d3a05d988..972aea4f04 100644 --- a/goal_src/jak2/levels/common/races/race-manager.gc +++ b/goal_src/jak2/levels/common/races/race-manager.gc @@ -585,204 +585,200 @@ ) (defmethod race-state-method-11 race-state ((obj race-state)) - (with-pp - (set! (-> obj current-time) (the-as uint (-> pp clock frame-counter))) - (let ((v1-2 (-> obj state))) - (cond - ((zero? v1-2) - (let ((v1-3 (the-as object #t))) - (when (not (logtest? (-> obj flags) 4)) - (dotimes (s5-0 (-> obj racer-count)) - (let ((a0-7 (-> obj racer-array s5-0))) - (set! v1-3 (and v1-3 (send-event (handle->process (-> a0-7 racer)) 'test-ready))) - ) + (set! (-> obj current-time) (the-as uint (current-time))) + (let ((v1-2 (-> obj state))) + (cond + ((zero? v1-2) + (let ((v1-3 (the-as object #t))) + (when (not (logtest? (-> obj flags) 4)) + (dotimes (s5-0 (-> obj racer-count)) + (let ((a0-7 (-> obj racer-array s5-0))) + (set! v1-3 (and v1-3 (send-event (handle->process (-> a0-7 racer)) 'test-ready))) ) ) - (when (and v1-3 (not (logtest? (-> obj info flags) 1))) - (race-state-method-15 obj) - (set! v1-3 (handle->process (-> obj race-signal))) - ) - (when v1-3 - (race-state-method-18 obj) - (set! (-> obj state) (the-as uint (if (or (logtest? (-> obj flags) 2) (logtest? (-> obj info flags) 1)) - 5 - 1 - ) - ) - ) - ) + ) + (when (and v1-3 (not (logtest? (-> obj info flags) 1))) + (race-state-method-15 obj) + (set! v1-3 (handle->process (-> obj race-signal))) + ) + (when v1-3 + (race-state-method-18 obj) + (set! (-> obj state) (the-as uint (if (or (logtest? (-> obj flags) 2) (logtest? (-> obj info flags) 1)) + 5 + 1 + ) + ) + ) ) ) - ((= v1-2 1) - (let* ((f30-0 (* 0.0033333334 (the float (- (-> obj current-time) (-> obj countdown-start-time))))) - (s4-0 (handle->process (-> obj racer-array (-> obj i-player) racer))) - (s5-1 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) - (cond - ((< f30-0 1.0) - (when s5-1 - (cubic-curve-method-10 - (-> obj player-intro-curve) - (-> (the-as process-focusable s5-1) root-override trans) - f30-0 - ) - (cubic-curve-method-11 - (-> obj player-intro-curve) - (-> (the-as process-focusable s5-1) root-override transv) - f30-0 - ) - (when (< 0.4 f30-0) - (when (-> obj info start-camera) - (set-setting! 'entity-name (-> obj info start-camera) 0.0 0) - (if (logtest? (-> obj info flags) 64) - (talker-spawn-func (-> *talker-speech* 377) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-2 1) + (let* ((f30-0 (* 0.0033333334 (the float (- (-> obj current-time) (-> obj countdown-start-time))))) + (s4-0 (handle->process (-> obj racer-array (-> obj i-player) racer))) + (s5-1 (if (type? s4-0 process-focusable) + s4-0 ) ) - ) - ) ) - (else - (set! (-> obj state) (the-as uint 2)) - ) - ) - ) - ) - ((= v1-2 2) - (let* ((s4-2 (handle->process (-> obj racer-array (-> obj i-player) racer))) - (s5-3 (if (type? s4-2 process-focusable) - s4-2 - ) - ) - ) - (when s5-3 - (cubic-curve-method-10 - (-> obj player-intro-curve) - (-> (the-as process-focusable s5-3) root-override trans) - 1.0 - ) - (vector-reset! (-> (the-as process-focusable s5-3) root-override transv)) - ) - ) - (let ((a0-48 (-> obj info hatch-actor-name))) - (when a0-48 - (let ((a0-49 (process-by-name a0-48 *active-pool*))) - (send-event a0-49 'close) - ) - ) - ) - (set! (-> obj countdown-start-time) (-> obj current-time)) - (set! (-> obj state) (the-as uint (if (-> obj info countdown-scene) - 3 - 5 - ) - ) - ) - ) - ((= v1-2 3) - (when (>= (the-as uint (- (-> pp clock frame-counter) (the-as int (-> obj countdown-start-time)))) - (the-as uint 300) - ) - (set! (-> obj state) (the-as uint 4)) - (set! (-> obj scene-player) - (ppointer->handle (process-spawn scene-player :init scene-player-init (-> obj info countdown-scene) #t #f)) - ) - ) - ) - ((= v1-2 4) (cond - ((handle->process (-> obj scene-player)) - (let ((s5-5 (-> obj info))) - (dotimes (s4-3 (-> s5-5 racer-count)) - (let ((v1-95 (-> obj racer-array s4-3))) - (if (logtest? (-> s5-5 racer-array s4-3 flags) 1) - (send-event (handle->process (-> v1-95 racer)) 'hide) + ((< f30-0 1.0) + (when s5-1 + (cubic-curve-method-10 + (-> obj player-intro-curve) + (-> (the-as process-focusable s5-1) root-override trans) + f30-0 + ) + (cubic-curve-method-11 + (-> obj player-intro-curve) + (-> (the-as process-focusable s5-1) root-override transv) + f30-0 + ) + (when (< 0.4 f30-0) + (when (-> obj info start-camera) + (set-setting! 'entity-name (-> obj info start-camera) 0.0 0) + (if (logtest? (-> obj info flags) 64) + (talker-spawn-func (-> *talker-speech* 377) *entity-pool* (target-pos 0) (the-as region #f)) ) ) ) ) ) (else - (let ((s5-6 (-> obj info))) - (dotimes (s4-4 (-> s5-6 racer-count)) - (let ((v1-105 (-> obj racer-array s4-4))) - (if (logtest? (-> s5-6 racer-array s4-4 flags) 1) - (send-event (handle->process (-> v1-105 racer)) 'unhide) - ) - ) - ) - ) - (set! (-> obj state) (the-as uint 5)) + (set! (-> obj state) (the-as uint 2)) ) ) ) - ((= v1-2 5) - (set! (-> obj i-countdown) 4) - (set! (-> obj state) (the-as uint 6)) - (set! (-> obj countdown-start-time) (-> obj current-time)) - (remove-setting! 'entity-name) + ) + ((= v1-2 2) + (let* ((s4-2 (handle->process (-> obj racer-array (-> obj i-player) racer))) + (s5-3 (if (type? s4-2 process-focusable) + s4-2 + ) + ) + ) + (when s5-3 + (cubic-curve-method-10 + (-> obj player-intro-curve) + (-> (the-as process-focusable s5-3) root-override trans) + 1.0 + ) + (vector-reset! (-> (the-as process-focusable s5-3) root-override transv)) + ) ) - ((= v1-2 6) - (let ((f0-3 3.0)) - (if (logtest? (-> obj info flags) 1) - (set! f0-3 0.2) - ) - (let ((v1-127 (+ (the int (* 300.0 f0-3)) (- (-> obj countdown-start-time) (-> obj current-time))))) - (cond - ((>= v1-127 (the int (* 225.0 f0-3))) - ) - ((>= v1-127 (the int (* 150.0 f0-3))) - (when (!= (-> obj i-countdown) 3) - (set! (-> obj i-countdown) 3) - (send-event (handle->process (-> obj race-signal)) 'count-3) - ) - ) - ((>= v1-127 (the int (* 75.0 f0-3))) - (when (!= (-> obj i-countdown) 2) - (set! (-> obj i-countdown) 2) - (send-event (handle->process (-> obj race-signal)) 'count-2) - ) - ) - ((< (the int (* 0.0 f0-3)) v1-127) - (when (!= (-> obj i-countdown) 1) - (set! (-> obj i-countdown) 1) - (send-event (handle->process (-> obj race-signal)) 'count-1) - ) - ) - (else - (set! (-> obj i-countdown) 0) - (set! (-> obj state) (the-as uint 7)) - (begin-race obj) - ) - ) + (let ((a0-48 (-> obj info hatch-actor-name))) + (when a0-48 + (let ((a0-49 (process-by-name a0-48 *active-pool*))) + (send-event a0-49 'close) ) ) - (race-state-method-14 obj) ) - ((= v1-2 7) - (race-state-method-14 obj) - (race-state-method-12 obj) + (set! (-> obj countdown-start-time) (-> obj current-time)) + (set! (-> obj state) (the-as uint (if (-> obj info countdown-scene) + 3 + 5 + ) + ) + ) + ) + ((= v1-2 3) + (when (>= (the-as uint (- (current-time) (the-as int (-> obj countdown-start-time)))) (the-as uint 300)) + (set! (-> obj state) (the-as uint 4)) + (set! (-> obj scene-player) + (ppointer->handle (process-spawn scene-player :init scene-player-init (-> obj info countdown-scene) #t #f)) + ) ) - ((= v1-2 8) - ) - (else - ) - ) - ) - (dotimes (s5-7 (-> obj info turbo-pad-count)) - (let ((s4-5 (-> obj info turbo-pad-array s5-7))) - (if (not (handle->process (-> s4-5 handle))) - (set! (-> s4-5 handle) - (process->handle (turbo-pickup-spawn (handle->process (-> obj manager)) (-> s4-5 position))) - ) + ) + ((= v1-2 4) + (cond + ((handle->process (-> obj scene-player)) + (let ((s5-5 (-> obj info))) + (dotimes (s4-3 (-> s5-5 racer-count)) + (let ((v1-95 (-> obj racer-array s4-3))) + (if (logtest? (-> s5-5 racer-array s4-3 flags) 1) + (send-event (handle->process (-> v1-95 racer)) 'hide) + ) + ) + ) ) + ) + (else + (let ((s5-6 (-> obj info))) + (dotimes (s4-4 (-> s5-6 racer-count)) + (let ((v1-105 (-> obj racer-array s4-4))) + (if (logtest? (-> s5-6 racer-array s4-4 flags) 1) + (send-event (handle->process (-> v1-105 racer)) 'unhide) + ) + ) + ) + ) + (set! (-> obj state) (the-as uint 5)) + ) + ) + ) + ((= v1-2 5) + (set! (-> obj i-countdown) 4) + (set! (-> obj state) (the-as uint 6)) + (set! (-> obj countdown-start-time) (-> obj current-time)) + (remove-setting! 'entity-name) + ) + ((= v1-2 6) + (let ((f0-3 3.0)) + (if (logtest? (-> obj info flags) 1) + (set! f0-3 0.2) + ) + (let ((v1-127 (+ (the int (* 300.0 f0-3)) (- (-> obj countdown-start-time) (-> obj current-time))))) + (cond + ((>= v1-127 (the int (* 225.0 f0-3))) + ) + ((>= v1-127 (the int (* 150.0 f0-3))) + (when (!= (-> obj i-countdown) 3) + (set! (-> obj i-countdown) 3) + (send-event (handle->process (-> obj race-signal)) 'count-3) + ) + ) + ((>= v1-127 (the int (* 75.0 f0-3))) + (when (!= (-> obj i-countdown) 2) + (set! (-> obj i-countdown) 2) + (send-event (handle->process (-> obj race-signal)) 'count-2) + ) + ) + ((< (the int (* 0.0 f0-3)) v1-127) + (when (!= (-> obj i-countdown) 1) + (set! (-> obj i-countdown) 1) + (send-event (handle->process (-> obj race-signal)) 'count-1) + ) + ) + (else + (set! (-> obj i-countdown) 0) + (set! (-> obj state) (the-as uint 7)) + (begin-race obj) + ) + ) + ) + ) + (race-state-method-14 obj) + ) + ((= v1-2 7) + (race-state-method-14 obj) + (race-state-method-12 obj) + ) + ((= v1-2 8) + ) + (else ) ) - 0 - (none) ) + (dotimes (s5-7 (-> obj info turbo-pad-count)) + (let ((s4-5 (-> obj info turbo-pad-array s5-7))) + (if (not (handle->process (-> s4-5 handle))) + (set! (-> s4-5 handle) + (process->handle (turbo-pickup-spawn (handle->process (-> obj manager)) (-> s4-5 position))) + ) + ) + ) + ) + 0 + (none) ) (defmethod race-state-method-15 race-state ((obj race-state)) @@ -1438,10 +1434,10 @@ (when (logtest? (-> gp-0 flags) 1) (cond ((logtest? (-> gp-0 flags) 64) - (set! (-> self player-on-track-time) (-> self clock frame-counter)) + (set! (-> self player-on-track-time) (current-time)) ) (else - (when (>= (- (-> self clock frame-counter) (-> self player-on-track-time)) (seconds 1)) + (when (>= (- (current-time) (-> self player-on-track-time)) (seconds 1)) (let ((v1-16 (handle->process (-> gp-0 racer)))) (when v1-16 (when (logtest? (-> (the-as vehicle-racer v1-16) flags) (rigid-body-object-flag on-ground)) @@ -1514,7 +1510,7 @@ (send-event (handle->process (-> self race-state hud-lap-counter)) 'force-hide) (send-event (handle->process (-> self race-state hud-turbo-counter)) 'force-hide) (process-spawn hud-race-final-stats :init hud-init-by-other :to self) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (when (logtest? (-> self race-state info flags) 4) (send-event (ppointer->process (-> self parent)) 'complete) (sleep-code) @@ -1523,7 +1519,7 @@ (cond ((logtest? (-> self race-state info flags) 8) (race-manager-method-25 self) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (cond ((logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) (race-manager-method-27 self) @@ -1540,7 +1536,7 @@ ) (else (race-manager-method-24 self) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) (race-manager-method-27 self) (send-event (ppointer->process (-> self parent)) 'complete) @@ -1574,11 +1570,11 @@ (send-event (handle->process (-> self race-state hud-lap-counter)) 'force-hide) (send-event (handle->process (-> self race-state hud-turbo-counter)) 'force-hide) (process-spawn hud-race-final-stats :init hud-init-by-other :to self) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (race-manager-method-25 self) (-> self race-state info) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (cond ((logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) (race-manager-method-27 self) @@ -1610,7 +1606,7 @@ (send-event (handle->process (-> self race-state hud-timer)) 'force-hide) (send-event (handle->process (-> self race-state hud-lap-counter)) 'force-hide) (send-event (handle->process (-> self race-state hud-turbo-counter)) 'force-hide) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (suspend) ) diff --git a/goal_src/jak2/levels/common/races/race-obs.gc b/goal_src/jak2/levels/common/races/race-obs.gc index 06abc8cd8d..89c322f292 100644 --- a/goal_src/jak2/levels/common/races/race-obs.gc +++ b/goal_src/jak2/levels/common/races/race-obs.gc @@ -111,7 +111,7 @@ (+! (-> obj y-offset) (* (- (-> obj dest-y-offset) (-> obj y-offset)) (fmin 1.0 (* 2.0 (-> pp clock seconds-per-frame)))) ) - (let ((f30-0 (* 0.0033333334 (the float (- (-> pp clock frame-counter) (-> obj bob-time)))))) + (let ((f30-0 (* 0.0033333334 (the float (- (current-time) (-> obj bob-time)))))) (set! (-> obj root trans y) (+ (-> obj pos y) (-> obj y-offset) (* 1024.0 (sin (* 32768.0 f30-0))))) (set! (-> obj root trans z) (+ (-> obj pos z) (* 2048.0 (cos (* 32768.0 f30-0))))) ) @@ -273,7 +273,7 @@ (-> v1-8 trans) ) ) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (until #f (suspend) ) @@ -281,7 +281,7 @@ (none) ) :post (behavior () - (let ((f30-0 (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> self start-time)))))) + (let ((f30-0 (* 0.0033333334 (the float (- (current-time) (-> self start-time)))))) (cubic-curve-method-10 (-> self curve) (-> self pos) f30-0) (if (< 1.0 f30-0) (go-virtual die) @@ -306,8 +306,8 @@ :code (behavior () (until #f (ja :num-func num-func-identity :frame-num (ja-aframe 0.0 0)) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.5)) (suspend) ) ) @@ -317,8 +317,8 @@ (ja :num! (seek! (ja-aframe 2.0 0))) ) (process-spawn part-tracker :init part-tracker-init (-> *part-group-id-table* 196) 600 #f #f self 5 :to self) - (let ((gp-5 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-5) (seconds 0.5)) + (let ((gp-5 (current-time))) + (until (>= (- (current-time) gp-5) (seconds 0.5)) (suspend) ) ) @@ -328,8 +328,8 @@ (ja :num! (seek! (ja-aframe 4.0 0))) ) (process-spawn part-tracker :init part-tracker-init (-> *part-group-id-table* 195) 300 #f #f self 7 :to self) - (let ((gp-9 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-9) (seconds 0.5)) + (let ((gp-9 (current-time))) + (until (>= (- (current-time) gp-9) (seconds 0.5)) (suspend) ) ) @@ -339,14 +339,14 @@ (ja :num! (seek! (ja-aframe 6.0 0))) ) (process-spawn part-tracker :init part-tracker-init (-> *part-group-id-table* 194) 300 #f #f self 9 :to self) - (let ((gp-13 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-13) (seconds 0.5)) + (let ((gp-13 (current-time))) + (until (>= (- (current-time) gp-13) (seconds 0.5)) (suspend) ) ) (process-spawn part-tracker :init part-tracker-init (-> *part-group-id-table* 197) 300 #f #f self 10 :to self) - (let ((gp-15 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-15) (seconds 0.5)) + (let ((gp-15 (current-time))) + (until (>= (- (current-time) gp-15) (seconds 0.5)) (suspend) ) ) @@ -375,7 +375,7 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-race-signal" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (set! (-> self bob-time) (-> self clock frame-counter)) + (set! (-> self bob-time) (current-time)) (set! (-> self banner) (the-as handle #f)) (set! (-> self draw shadow-mask) (the-as uint 30)) (set! (-> self draw shadow-values) (the-as uint #x22220)) @@ -731,7 +731,7 @@ (defstate die (turbo-pickup) :virtual #t :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (get-process *default-dead-pool* part-tracker #x4000))) (when gp-0 (let ((t9-1 (method-of-type part-tracker activate))) @@ -772,7 +772,7 @@ (set! (-> v1-11 prim-core collide-with) (collide-spec)) ) 0 - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (until (>= (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (none) diff --git a/goal_src/jak2/levels/common/races/vehicle-racer.gc b/goal_src/jak2/levels/common/races/vehicle-racer.gc index 36f129cd5e..71d33669b8 100644 --- a/goal_src/jak2/levels/common/races/vehicle-racer.gc +++ b/goal_src/jak2/levels/common/races/vehicle-racer.gc @@ -83,17 +83,11 @@ (set! (-> s3-0 search-sphere r) 61440.0) (race-mesh-method-13 (-> obj mesh) (the-as race-mesh-slice-query (&-> s3-0 slice-id))) (when (!= (-> s3-0 slice-id) -1) - (let* ((v1-12 (the-as object (+ (the-as uint (-> obj mesh slices)) (* (-> s3-0 slice-id) 4)))) - (f0-1 - (-> (the-as (pointer float) (+ (* (-> (the-as (pointer int16) v1-12)) 4) (the-as int (-> s4-0 edge-infos))))) + (let* ((v1-12 (-> obj mesh slices (-> s3-0 slice-id))) + (f0-1 (-> (the-as (pointer float) (+ (* (-> v1-12 start-edge) 4) (the-as int (-> s4-0 edge-infos)))))) + (f1-0 + (-> (the-as race-path-edge-info (+ (* (-> v1-12 end-edge) 4) (the-as int (-> s4-0 edge-infos)))) sample-t) ) - (f1-0 (-> (the-as - race-path-edge-info - (+ (* (-> (the-as race-mesh-slice v1-12) end-edge) 4) (the-as int (-> s4-0 edge-infos))) - ) - sample-t - ) - ) ) (when (and (>= f0-1 0.0) (>= f1-0 0.0)) (let ((f0-2 (race-path-method-12 s4-0 arg1 f0-1 f1-0))) @@ -269,20 +263,18 @@ ) (defmethod vehicle-method-66 vehicle-racer ((obj vehicle-racer)) - (with-pp - (when (and (not (logtest? (rigid-body-object-flag turbo-boost) (-> obj flags))) (> (-> obj turbo-pickup-count) 0)) - (+! (-> obj turbo-pickup-count) -1) - (set! (-> obj turbo-boost-time) (-> pp clock frame-counter)) - (set! (-> obj turbo-boost-factor) 1.0) - (set! (-> obj turbo-boost-duration) (the-as uint 150)) - (set! (-> obj flags) (logior (rigid-body-object-flag turbo-boost) (-> obj flags))) - (if (logtest? (-> obj flags) (rigid-body-object-flag player-driving)) - (sound-play "turbo-boost") - ) - ) - 0 - (none) + (when (and (not (logtest? (rigid-body-object-flag turbo-boost) (-> obj flags))) (> (-> obj turbo-pickup-count) 0)) + (+! (-> obj turbo-pickup-count) -1) + (set! (-> obj turbo-boost-time) (current-time)) + (set! (-> obj turbo-boost-factor) 1.0) + (set! (-> obj turbo-boost-duration) (the-as uint 150)) + (set! (-> obj flags) (logior (rigid-body-object-flag turbo-boost) (-> obj flags))) + (if (logtest? (-> obj flags) (rigid-body-object-flag player-driving)) + (sound-play "turbo-boost") + ) ) + 0 + (none) ) (defmethod vehicle-method-136 vehicle-racer ((obj vehicle-racer) (arg0 traffic-object-spawn-params)) @@ -433,7 +425,7 @@ ) ) (select-path-randomly-from-mask obj (-> v1-37 shortcuts)) - (set! (-> obj shortcut-time) (-> self clock frame-counter)) + (set! (-> obj shortcut-time) (current-time)) (set! (-> obj shortcut-speed-factor) 1.0) ) (else @@ -868,23 +860,21 @@ ) (defmethod vehicle-racer-method-152 vehicle-racer ((obj vehicle-racer)) - (with-pp - (let ((s5-0 (new 'stack-no-clear 'matrix3))) - (set! (-> s5-0 vector 0 quad) (-> obj rbody state position quad)) - (set! (-> obj camera-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (camera-pos))) - (set! (-> obj player-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (target-pos 0))) - ) - (if (>= (- (-> pp clock frame-counter) (-> obj shortcut-time)) (seconds 5)) - (set! (-> obj shortcut-speed-factor) 0.0) - ) - (vehicle-racer-method-154 obj) - (if (logtest? (-> obj rbody state flags) (rigid-body-flag enable-physics)) - (physics-post obj) - (vehicle-racer-method-151 obj) - ) - 0 - (none) + (let ((s5-0 (new 'stack-no-clear 'matrix3))) + (set! (-> s5-0 vector 0 quad) (-> obj rbody state position quad)) + (set! (-> obj camera-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (camera-pos))) + (set! (-> obj player-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (target-pos 0))) ) + (if (>= (- (current-time) (-> obj shortcut-time)) (seconds 5)) + (set! (-> obj shortcut-speed-factor) 0.0) + ) + (vehicle-racer-method-154 obj) + (if (logtest? (-> obj rbody state flags) (rigid-body-flag enable-physics)) + (physics-post obj) + (vehicle-racer-method-151 obj) + ) + 0 + (none) ) (defmethod vehicle-racer-method-155 vehicle-racer ((obj vehicle-racer)) @@ -930,7 +920,7 @@ vehicle-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) (logior (rigid-body-object-flag ignition) (-> self flags))) (set! (-> self controls throttle) 0.0) (set! (-> self controls brake) 0.0) @@ -994,7 +984,7 @@ vehicle-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self damage-factor) (-> self info-override damage-factor)) (vehicle-method-143 self) (set! (-> self flags) (logior (rigid-body-object-flag ignition) (-> self flags))) @@ -1023,7 +1013,7 @@ vehicle-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) (logior (rigid-body-object-flag riding ignition) (-> self flags))) (set! (-> self controls throttle) 0.0) (set! (-> self controls brake) 0.0) @@ -1067,7 +1057,7 @@ vehicle-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) (the-as rigid-body-object-flag (logior (rigid-body-object-flag persistent riding nav-spheres) (-> self flags)) diff --git a/goal_src/jak2/levels/common/warp-gate.gc b/goal_src/jak2/levels/common/warp-gate.gc index fff901bd84..4ae079da7e 100644 --- a/goal_src/jak2/levels/common/warp-gate.gc +++ b/goal_src/jak2/levels/common/warp-gate.gc @@ -528,7 +528,7 @@ ) :code (behavior () (remove-setting! 'allow-progress) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (update-transforms (-> self root-override)) (until #f (handle-notice self) @@ -550,14 +550,14 @@ (or (= v1-30 'target-warp-in) (= v1-30 'target-warp-out)) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) #f ) (else #t ) ) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (>= (- (current-time) (-> self state-time)) (seconds 0.1)) ) (if (and (cpad-pressed? 0 triangle) (process-grab? *target* #f)) (go-virtual use (-> self continue)) @@ -641,7 +641,7 @@ (kill-current-talker (the-as symbol '()) '() 'exit) (set-setting! 'mode-name 'cam-fixed 0.0 0) (set-setting! 'interp-time 'abs 0.0 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self mask) (process-mask actor-pause)) (when (not arg0) (process-release? *target*) @@ -683,7 +683,7 @@ ) ) (label cfg-21) - (or v1-38 (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2))) + (or v1-38 (< (- (current-time) (-> self state-time)) (seconds 2))) ) (update! (-> self sound)) (suspend) @@ -694,8 +694,8 @@ (set-blackout-frames (seconds 0.05)) ) (start 'play arg0) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -834,7 +834,7 @@ This commonly includes things such as: ) ) :enter (behavior ((arg0 vector) (arg1 vector) (arg2 target)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control mod-surface) *warp-jump-mods*) (set! (-> self control unknown-vector37 quad) (-> arg0 quad)) @@ -898,7 +898,7 @@ This commonly includes things such as: (set! (-> v1-20 prim-core collide-with) (collide-spec)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self trans-hook) (lambda :behavior target () @@ -924,7 +924,7 @@ This commonly includes things such as: (set! (-> gp-1 y) 0.0) (send-event *target* 'sidekick #f) (when (and (or (< (vector-dot gp-1 (-> self control transv)) 0.0) (-> self control unknown-spool-anim00)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (>= (- (current-time) (-> self state-time)) (seconds 0.05)) ) (vector-seek! (-> self draw color-mult) (new 'static 'vector) (* 2.0 (-> self clock seconds-per-frame))) (set! (-> self control transv x) (* 0.95 (-> self control transv x))) @@ -1017,8 +1017,8 @@ This commonly includes things such as: (ja-channel-set! 0) (vector-reset! (-> self control transv)) (move-to-point! (-> self control) (-> self control unknown-vector37)) - (let ((s5-1 (-> self clock frame-counter))) - (while (or (< (- (-> self clock frame-counter) s5-1) (seconds 1)) + (let ((s5-1 (current-time))) + (while (or (< (- (current-time) s5-1) (seconds 1)) (< 81920.0 (vector-vector-distance (camera-pos) (-> self control trans))) ) (suspend) @@ -1026,7 +1026,7 @@ This commonly includes things such as: ) (set-heading-vec! (-> self control) (-> self control transv)) (rot->dir-targ! (-> self control)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self post-hook) target-no-stick-post) (ja-channel-set! 1) (send-event @@ -1225,11 +1225,10 @@ This commonly includes things such as: ((the-as (function none) t9-0)) ) ) - (set! (-> self root-override trans y) - (+ (-> self base-pos y) - (* 696.32 (cos (* 66.19798 (the float (mod (-> self clock frame-counter) 990))))) - (* 450.56 (cos (* 42.25403 (the float (mod (-> self clock frame-counter) 1551))))) - ) + (set! (-> self root-override trans y) (+ (-> self base-pos y) + (* 696.32 (cos (* 66.19798 (the float (mod (current-time) 990))))) + (* 450.56 (cos (* 42.25403 (the float (mod (current-time) 1551))))) + ) ) (spawn-with-cspace (-> self part-exhaust-left) (-> self node-list data 5)) (spawn-with-cspace (-> self part-exhaust-right) (-> self node-list data 6)) @@ -1251,7 +1250,7 @@ This commonly includes things such as: :virtual #t :code (behavior ((arg0 continue-point)) (kill-current-talker (the-as symbol '()) '() 'exit) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self mask) (process-mask actor-pause)) (when (not arg0) (process-release? *target*) diff --git a/goal_src/jak2/levels/demo/demo-obs.gc b/goal_src/jak2/levels/demo/demo-obs.gc index fc0f4e6fee..363f15bebe 100644 --- a/goal_src/jak2/levels/demo/demo-obs.gc +++ b/goal_src/jak2/levels/demo/demo-obs.gc @@ -469,20 +469,17 @@ ) (defun demo-wait-for-press ((arg0 time-frame) (arg1 time-frame) (arg2 symbol)) - (with-pp - (let ((s4-0 (-> pp clock frame-counter)) - (s3-0 #f) - ) - (while (not (or (>= (- (-> pp clock frame-counter) s4-0) arg1) (and (>= (- (-> pp clock frame-counter) s4-0) arg0) s3-0)) - ) - (if (cpad-pressed? 0 triangle) - (set! s3-0 #t) - ) - (suspend) + (let ((s4-0 (current-time)) + (s3-0 #f) ) + (while (not (or (>= (- (current-time) s4-0) arg1) (and (>= (- (current-time) s4-0) arg0) s3-0))) + (if (cpad-pressed? 0 triangle) + (set! s3-0 #t) + ) + (suspend) ) - #f ) + #f ) ;; WARN: Return type mismatch int vs object. @@ -644,63 +641,63 @@ ) (cond ((zero? (scf-get-territory)) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.38)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 0.38)) (suspend) ) ) (set! (-> self sprite-draw) (the-as uint 3)) (set-vector! (-> self sprite-pos) -512.0 40.0 0.0 1.0) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 0.25)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 0.25)) (set! (-> self sprite-pos x) - (lerp-scale -512.0 0.0 (sin (* 218.45334 (the float (- (-> self clock frame-counter) gp-4)))) 0.0 1.0) + (lerp-scale -512.0 0.0 (sin (* 218.45334 (the float (- (current-time) gp-4)))) 0.0 1.0) ) (suspend) ) ) - (let ((gp-5 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-5) (seconds 2)) + (let ((gp-5 (current-time))) + (until (>= (- (current-time) gp-5) (seconds 2)) (suspend) ) ) - (let ((gp-6 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-6) (seconds 0.25)) + (let ((gp-6 (current-time))) + (until (>= (- (current-time) gp-6) (seconds 0.25)) (set! (-> self sprite-pos x) - (lerp-scale 0.0 512.0 (sin (* 218.45334 (the float (- (-> self clock frame-counter) gp-6)))) 0.0 1.0) + (lerp-scale 0.0 512.0 (sin (* 218.45334 (the float (- (current-time) gp-6)))) 0.0 1.0) ) (suspend) ) ) (set! (-> self sprite-draw) (the-as uint 1)) (set-vector! (-> self sprite-pos) 30.0 -240.0 0.0 1.0) - (let ((gp-7 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-7) (seconds 0.25)) + (let ((gp-7 (current-time))) + (until (>= (- (current-time) gp-7) (seconds 0.25)) (set! (-> self sprite-pos y) - (lerp-scale -240.0 270.0 (sin (* 218.45334 (the float (- (-> self clock frame-counter) gp-7)))) 0.0 1.0) + (lerp-scale -240.0 270.0 (sin (* 218.45334 (the float (- (current-time) gp-7)))) 0.0 1.0) ) (suspend) ) ) - (let ((gp-8 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-8) (seconds 2)) + (let ((gp-8 (current-time))) + (until (>= (- (current-time) gp-8) (seconds 2)) (suspend) ) ) - (let ((gp-9 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-9) (seconds 0.25)) + (let ((gp-9 (current-time))) + (until (>= (- (current-time) gp-9) (seconds 0.25)) (set! (-> self sprite-pos y) - (lerp-scale 270.0 720.0 (sin (* 218.45334 (the float (- (-> self clock frame-counter) gp-9)))) 0.0 1.0) + (lerp-scale 270.0 720.0 (sin (* 218.45334 (the float (- (current-time) gp-9)))) 0.0 1.0) ) (suspend) ) ) (set! (-> self sprite-draw) (the-as uint 2)) (set-vector! (-> self sprite-pos) 20.0 40.0 0.0 1.0) - (let ((gp-10 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-10) (seconds 0.25)) + (let ((gp-10 (current-time))) + (until (>= (- (current-time) gp-10) (seconds 0.25)) (set! (-> self sprite-pos y) - (lerp-scale 720.0 20.0 (sin (* 218.45334 (the float (- (-> self clock frame-counter) gp-10)))) 0.0 1.0) + (lerp-scale 720.0 20.0 (sin (* 218.45334 (the float (- (current-time) gp-10)))) 0.0 1.0) ) (suspend) ) @@ -714,70 +711,70 @@ (set! (-> a1-21 0) 'demo) (want-levels *load-state* a1-21) ) - (let ((gp-11 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-11) (seconds 2)) + (let ((gp-11 (current-time))) + (until (>= (- (current-time) gp-11) (seconds 2)) (suspend) ) ) - (let ((gp-12 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-12) (seconds 0.25)) + (let ((gp-12 (current-time))) + (until (>= (- (current-time) gp-12) (seconds 0.25)) (set! (-> self sprite-pos y) - (lerp-scale 20.0 -720.0 (sin (* 218.45334 (the float (- (-> self clock frame-counter) gp-12)))) 0.0 1.0) + (lerp-scale 20.0 -720.0 (sin (* 218.45334 (the float (- (current-time) gp-12)))) 0.0 1.0) ) (suspend) ) ) ) (else - (let ((gp-13 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-13) (seconds 0.38)) + (let ((gp-13 (current-time))) + (until (>= (- (current-time) gp-13) (seconds 0.38)) (suspend) ) ) - (let ((gp-14 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-14) (seconds 2)) + (let ((gp-14 (current-time))) + (until (>= (- (current-time) gp-14) (seconds 2)) (suspend) ) ) - (let ((gp-15 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-15) (seconds 0.25)) + (let ((gp-15 (current-time))) + (until (>= (- (current-time) gp-15) (seconds 0.25)) (suspend) ) ) - (let ((gp-16 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-16) (seconds 0.25)) + (let ((gp-16 (current-time))) + (until (>= (- (current-time) gp-16) (seconds 0.25)) (suspend) ) ) - (let ((gp-17 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-17) (seconds 2)) + (let ((gp-17 (current-time))) + (until (>= (- (current-time) gp-17) (seconds 2)) (suspend) ) ) - (let ((gp-18 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-18) (seconds 0.25)) + (let ((gp-18 (current-time))) + (until (>= (- (current-time) gp-18) (seconds 0.25)) (suspend) ) ) - (let ((gp-19 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-19) (seconds 0.25)) + (let ((gp-19 (current-time))) + (until (>= (- (current-time) gp-19) (seconds 0.25)) (suspend) ) ) - (let ((gp-20 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-20) (seconds 2)) + (let ((gp-20 (current-time))) + (until (>= (- (current-time) gp-20) (seconds 2)) (suspend) ) ) - (let ((gp-21 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-21) (seconds 0.25)) + (let ((gp-21 (current-time))) + (until (>= (- (current-time) gp-21) (seconds 0.25)) (suspend) ) ) ) ) - (let ((gp-22 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-22) (seconds 3)) + (let ((gp-22 (current-time))) + (until (>= (- (current-time) gp-22) (seconds 3)) (suspend) ) ) @@ -794,9 +791,9 @@ (set! (-> *setting-control* user-default allow-timeout) #t) (let ((gp-24 (demo-menu))) (script-eval '(fadeout (seconds (new 'static 'bfloat :data 0.3)))) - (let ((s5-8 (-> self clock frame-counter))) + (let ((s5-8 (current-time))) (while (or (!= (-> *setting-control* user-current bg-a) (-> *setting-control* user-target bg-a)) - (< (- (-> self clock frame-counter) s5-8) (seconds 0.3)) + (< (- (current-time) s5-8) (seconds 0.3)) ) (suspend) ) diff --git a/goal_src/jak2/levels/dig/dig-digger.gc b/goal_src/jak2/levels/dig/dig-digger.gc index 1af208adfb..f8ae901e53 100644 --- a/goal_src/jak2/levels/dig/dig-digger.gc +++ b/goal_src/jak2/levels/dig/dig-digger.gc @@ -1188,83 +1188,81 @@ This commonly includes things such as: ) (defmethod dig-digger-method-24 dig-digger ((obj dig-digger)) - (with-pp - (set! (-> obj vertical target x) 0.0) - (set! (-> obj vertical target z) 0.0) - (let ((s4-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (-> obj vertical)) 1.0)) - (s5-0 0) - ) - (dotimes (s3-0 24) - (let* ((s2-0 (-> obj tethers s3-0)) - (s1-0 (handle->process (-> s2-0 handle))) + (set! (-> obj vertical target x) 0.0) + (set! (-> obj vertical target z) 0.0) + (let ((s4-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (-> obj vertical)) 1.0)) + (s5-0 0) + ) + (dotimes (s3-0 24) + (let* ((s2-0 (-> obj tethers s3-0)) + (s1-0 (handle->process (-> s2-0 handle))) + ) + (cond + (s1-0 + (let ((v1-10 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data (-> obj tethers s3-0 rp))))) + (send-event s1-0 'set-pos v1-10 (-> obj root trans) s4-0) + ) + (cond + ((send-event s1-0 'broken?) + (+! (-> obj vertical target x) (-> s2-0 broken-x)) + (+! (-> obj vertical target z) (-> s2-0 broken-z)) ) - (cond - (s1-0 - (let ((v1-10 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data (-> obj tethers s3-0 rp))))) - (send-event s1-0 'set-pos v1-10 (-> obj root trans) s4-0) - ) - (cond - ((send-event s1-0 'broken?) - (+! (-> obj vertical target x) (-> s2-0 broken-x)) - (+! (-> obj vertical target z) (-> s2-0 broken-z)) - ) - (else - (+! s5-0 1) - ) + (else + (+! s5-0 1) ) ) - (else - (+! (-> obj vertical target x) (-> s2-0 broken-x)) - (+! (-> obj vertical target z) (-> s2-0 broken-z)) - ) + ) + (else + (+! (-> obj vertical target x) (-> s2-0 broken-x)) + (+! (-> obj vertical target z) (-> s2-0 broken-z)) ) ) ) - (set! (-> *game-info* counter) (the float s5-0)) - (when (and (= s5-0 24) - (>= (- (-> pp clock frame-counter) (-> obj speech-time)) (seconds 20)) - *target* - (and (>= 409600.0 (vector-vector-distance (-> obj root trans) (-> *target* control trans))) - (not (logtest? (focus-status teleporting) (-> *target* focus-status))) - ) - ) - (let ((v1-37 (logand (-> obj speech-count) 1))) - (cond - ((zero? v1-37) - (talker-spawn-func (-> *talker-speech* 191) *entity-pool* (target-pos 0) (the-as region #f)) - (if (and *target* (not (logtest? (focus-status board) (-> *target* focus-status)))) - (talker-spawn-func (-> *talker-speech* 115) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) - ((= v1-37 1) - (talker-spawn-func (-> *talker-speech* 192) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) - ) - (set! (-> obj speech-time) (-> pp clock frame-counter)) - (+! (-> obj speech-count) 1) - ) - (cond - ((zero? s5-0) - (send-event (handle->process (-> obj hud-counter)) 'hide-and-die) - (set! (-> obj hud-counter) (the-as handle #f)) - (when (= (-> obj movie-handle) #f) - (set! (-> obj movie-handle) - (ppointer->handle (process-spawn scene-player :init scene-player-init "dig-digger-explode" #t #f)) - ) - (if (handle->process (-> obj movie-handle)) - (cleanup-for-death obj) - ) - ) - ) - ((>= 4 s5-0) - (script-eval '(want-anim "dig-digger-explode")) - ) - ) ) - 0 - (none) + (set! (-> *game-info* counter) (the float s5-0)) + (when (and (= s5-0 24) + (>= (- (current-time) (-> obj speech-time)) (seconds 20)) + *target* + (and (>= 409600.0 (vector-vector-distance (-> obj root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (let ((v1-37 (logand (-> obj speech-count) 1))) + (cond + ((zero? v1-37) + (talker-spawn-func (-> *talker-speech* 191) *entity-pool* (target-pos 0) (the-as region #f)) + (if (and *target* (not (logtest? (focus-status board) (-> *target* focus-status)))) + (talker-spawn-func (-> *talker-speech* 115) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + ((= v1-37 1) + (talker-spawn-func (-> *talker-speech* 192) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + ) + (set! (-> obj speech-time) (current-time)) + (+! (-> obj speech-count) 1) + ) + (cond + ((zero? s5-0) + (send-event (handle->process (-> obj hud-counter)) 'hide-and-die) + (set! (-> obj hud-counter) (the-as handle #f)) + (when (= (-> obj movie-handle) #f) + (set! (-> obj movie-handle) + (ppointer->handle (process-spawn scene-player :init scene-player-init "dig-digger-explode" #t #f)) + ) + (if (handle->process (-> obj movie-handle)) + (cleanup-for-death obj) + ) + ) + ) + ((>= 4 s5-0) + (script-eval '(want-anim "dig-digger-explode")) + ) + ) ) + 0 + (none) ) (defstate idle (dig-digger) diff --git a/goal_src/jak2/levels/dig/dig-obs.gc b/goal_src/jak2/levels/dig/dig-obs.gc index a2124f8726..96f366aba0 100644 --- a/goal_src/jak2/levels/dig/dig-obs.gc +++ b/goal_src/jak2/levels/dig/dig-obs.gc @@ -103,98 +103,96 @@ ) (defmethod rigid-body-object-method-37 dig-sinking-plat ((obj dig-sinking-plat)) - (with-pp - (when (not (logtest? (-> obj path flags) (path-control-flag not-found))) - (set! (-> obj prev-pos) (-> obj path-pos)) - (set! (-> obj path-pos) (get-norm! (-> obj sync) 0)) - (when (< (-> obj path-pos) (-> obj prev-pos)) - (let ((a0-2 (-> obj skel root-channel 0))) - (set! (-> a0-2 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) - (set! (-> a0-2 param 0) - (the float (+ (-> (the-as art-joint-anim (-> obj draw art-group data 2)) frames num-frames) -1)) - ) - (set! (-> a0-2 param 1) 1.0) - (set! (-> a0-2 frame-num) 0.0) - (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-seek!) - ) - (let ((a0-3 (-> obj skel root-channel 0))) - (set! (-> a0-3 param 0) (the float (+ (-> a0-3 frame-group frames num-frames) -1))) - (set! (-> a0-3 param 1) 1.0) - (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-seek!) - ) - ) - (let ((f30-0 (/ 300.0 (the float (-> obj sync period))))) - (let* ((f0-12 (/ 1.0 (- 1.0 (* 2.0 f30-0)))) - (f0-13 (* (fmax 0.0 (- (-> obj path-pos) f30-0)) f0-12)) - ) - (get-point-at-percent-along-path! (-> obj path) (-> obj anchor-point) f0-13 'interp) - ) - (cond - ((< (-> obj path-pos) f30-0) - (set! (-> obj float-height-offset) (* -8192.0 (/ (- f30-0 (-> obj path-pos)) f30-0))) - ) - ((< (- 1.0 (* 2.0 f30-0)) (-> obj path-pos)) - (cond - ((< (- 1.0 f30-0) (-> obj path-pos)) - (set! (-> obj float-height-offset) (* -8192.0 (/ (- (-> obj path-pos) (- 1.0 f30-0)) f30-0))) - (let ((a0-5 (-> obj skel root-channel 0))) - (set! (-> a0-5 param 0) (the float (+ (-> a0-5 frame-group frames num-frames) -1))) - (set! (-> a0-5 param 1) 1.0) - (joint-control-channel-group-eval! a0-5 (the-as art-joint-anim #f) num-func-seek!) - ) + (when (not (logtest? (-> obj path flags) (path-control-flag not-found))) + (set! (-> obj prev-pos) (-> obj path-pos)) + (set! (-> obj path-pos) (get-norm! (-> obj sync) 0)) + (when (< (-> obj path-pos) (-> obj prev-pos)) + (let ((a0-2 (-> obj skel root-channel 0))) + (set! (-> a0-2 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-2 param 0) + (the float (+ (-> (the-as art-joint-anim (-> obj draw art-group data 2)) frames num-frames) -1)) ) - (else - (when (-> obj once) - (let ((a0-6 (-> obj skel root-channel 0))) - (set! (-> a0-6 frame-group) (the-as art-joint-anim (-> obj draw art-group data 3))) - (set! (-> a0-6 param 0) - (the float (+ (-> (the-as art-joint-anim (-> obj draw art-group data 3)) frames num-frames) -1)) - ) - (set! (-> a0-6 param 1) 1.0) - (set! (-> a0-6 frame-num) 0.0) - (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> obj draw art-group data 3)) num-func-seek!) - ) - (set! (-> obj once) #f) - ) - (let ((a0-7 (-> obj skel root-channel 0))) - (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group frames num-frames) -1))) - (set! (-> a0-7 param 1) 1.0) - (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-seek!) + (set! (-> a0-2 param 1) 1.0) + (set! (-> a0-2 frame-num) 0.0) + (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-seek!) + ) + (let ((a0-3 (-> obj skel root-channel 0))) + (set! (-> a0-3 param 0) (the float (+ (-> a0-3 frame-group frames num-frames) -1))) + (set! (-> a0-3 param 1) 1.0) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (let ((f30-0 (/ 300.0 (the float (-> obj sync period))))) + (let* ((f0-12 (/ 1.0 (- 1.0 (* 2.0 f30-0)))) + (f0-13 (* (fmax 0.0 (- (-> obj path-pos) f30-0)) f0-12)) + ) + (get-point-at-percent-along-path! (-> obj path) (-> obj anchor-point) f0-13 'interp) + ) + (cond + ((< (-> obj path-pos) f30-0) + (set! (-> obj float-height-offset) (* -8192.0 (/ (- f30-0 (-> obj path-pos)) f30-0))) + ) + ((< (- 1.0 (* 2.0 f30-0)) (-> obj path-pos)) + (cond + ((< (- 1.0 f30-0) (-> obj path-pos)) + (set! (-> obj float-height-offset) (* -8192.0 (/ (- (-> obj path-pos) (- 1.0 f30-0)) f30-0))) + (let ((a0-5 (-> obj skel root-channel 0))) + (set! (-> a0-5 param 0) (the float (+ (-> a0-5 frame-group frames num-frames) -1))) + (set! (-> a0-5 param 1) 1.0) + (joint-control-channel-group-eval! a0-5 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (else + (when (-> obj once) + (let ((a0-6 (-> obj skel root-channel 0))) + (set! (-> a0-6 frame-group) (the-as art-joint-anim (-> obj draw art-group data 3))) + (set! (-> a0-6 param 0) + (the float (+ (-> (the-as art-joint-anim (-> obj draw art-group data 3)) frames num-frames) -1)) + ) + (set! (-> a0-6 param 1) 1.0) + (set! (-> a0-6 frame-num) 0.0) + (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> obj draw art-group data 3)) num-func-seek!) ) + (set! (-> obj once) #f) + ) + (let ((a0-7 (-> obj skel root-channel 0))) + (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group frames num-frames) -1))) + (set! (-> a0-7 param 1) 1.0) + (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-seek!) ) ) ) - (else - (set! (-> obj float-height-offset) 0.0) - ) + ) + (else + (set! (-> obj float-height-offset) 0.0) ) ) ) - (cond - ((>= (- (-> pp clock frame-counter) (-> obj last-ridden-time)) (seconds 0.5)) - (when (nonzero? (-> obj bubbling-sound-id)) - (let ((v1-84 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) - (set! (-> v1-84 command) (sound-command set-param)) - (set! (-> v1-84 id) (the-as sound-id (-> obj bubbling-sound-id))) - (set! (-> v1-84 params volume) -4) - (set! (-> v1-84 auto-time) 120) - (set! (-> v1-84 auto-from) 2) - (set! (-> v1-84 params mask) (the-as uint 17)) - (-> v1-84 id) - ) - (set! (-> obj bubbling-sound-id) (the-as uint 0)) - 0 - ) - ) - (else - (if (zero? (-> obj bubbling-sound-id)) - (set! (-> obj bubbling-sound-id) (the-as uint (sound-play "lava-plat-sink"))) - ) - ) - ) - ((method-of-type rigid-body-platform rigid-body-object-method-37) obj) - (none) ) + (cond + ((>= (- (current-time) (-> obj last-ridden-time)) (seconds 0.5)) + (when (nonzero? (-> obj bubbling-sound-id)) + (let ((v1-84 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-84 command) (sound-command set-param)) + (set! (-> v1-84 id) (the-as sound-id (-> obj bubbling-sound-id))) + (set! (-> v1-84 params volume) -4) + (set! (-> v1-84 auto-time) 120) + (set! (-> v1-84 auto-from) 2) + (set! (-> v1-84 params mask) (the-as uint 17)) + (-> v1-84 id) + ) + (set! (-> obj bubbling-sound-id) (the-as uint 0)) + 0 + ) + ) + (else + (if (zero? (-> obj bubbling-sound-id)) + (set! (-> obj bubbling-sound-id) (the-as uint (sound-play "lava-plat-sink"))) + ) + ) + ) + ((method-of-type rigid-body-platform rigid-body-object-method-37) obj) + (none) ) (defmethod rigid-body-platform-method-56 dig-sinking-plat ((obj dig-sinking-plat) (arg0 vector)) @@ -237,7 +235,7 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('ridden) - (set! (-> self last-ridden-time) (-> self clock frame-counter)) + (set! (-> self last-ridden-time) (current-time)) ) ) (the-as object (rigid-body-object-event-handler proc arg1 event-type event)) @@ -567,8 +565,8 @@ ) (s5-0 (add-process *gui-control* self (gui-channel jak) (gui-action queue) t0-0 -99.0 0)) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.15)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.15)) (suspend) ) (until v1-12 @@ -578,8 +576,8 @@ (while (!= (get-status *gui-control* s5-0) (gui-status ready)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.2)) (suspend) ) (set-setting! 'entity-name "camera-249" 0.0 0) @@ -594,20 +592,20 @@ (the-as process #f) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (suspend) ) (let ((f30-0 (+ (-> (&-> *dig-log-heights* 0 data (- (-> self total-buttons) (-> self pressed-count))) 0) (-> self base-y)) ) - (s5-1 (-> self clock frame-counter)) + (s5-1 (current-time)) ) (until (>= (-> self root trans y) f30-0) (set! (-> self root trans y) (seek-with-smooth (-> self root trans y) f30-0 (* 4096.0 (-> self clock seconds-per-frame)) 0.25 40.96) ) - (when (>= (-> self clock frame-counter) s5-1) + (when (>= (current-time) s5-1) (activate! *camera-smush-control* (rand-vu-float-range 614.4 1433.6) @@ -617,7 +615,7 @@ 0.95 (-> *display* camera-clock) ) - (set! s5-1 (+ (-> self clock frame-counter) (rand-vu-int-range (seconds 0.05) (seconds 0.15)))) + (set! s5-1 (+ (current-time) (rand-vu-int-range (seconds 0.05) (seconds 0.15)))) ) (let ((a1-10 (new 'stack-no-clear 'vector))) (set! (-> a1-10 quad) (-> self root trans quad)) @@ -627,8 +625,8 @@ (suspend) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) (if (= (-> gp-0 cam-ret-mode) 'instant) @@ -637,22 +635,22 @@ (set-setting! 'string-startup-vector 'abs (-> gp-0 cam-ret-dir) 0) (remove-setting! 'entity-name) (when (!= (-> gp-0 cam-ret-mode) 'instant) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (suspend) ) (remove-setting! 'string-startup-vector) (until (process-release? *target*) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 4)) (suspend) ) (go-virtual idle) diff --git a/goal_src/jak2/levels/dig/dig1-obs.gc b/goal_src/jak2/levels/dig/dig1-obs.gc index d44663b41a..21c74347b4 100644 --- a/goal_src/jak2/levels/dig/dig1-obs.gc +++ b/goal_src/jak2/levels/dig/dig1-obs.gc @@ -444,8 +444,8 @@ ) :code (behavior () (let ((f30-0 (rand-vu-float-range 0.22 0.27))) - (set! (-> self wait-time) (+ (-> self clock frame-counter) (the int (rand-vu-float-range 0.0 450.0)))) - (while (< (-> self clock frame-counter) (-> self wait-time)) + (set! (-> self wait-time) (+ (current-time) (the int (rand-vu-float-range 0.0 450.0)))) + (while (< (current-time) (-> self wait-time)) (suspend) ) (ja-no-eval :group! (-> self draw art-group data 3) @@ -463,8 +463,8 @@ :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1))) :frame-num 0.0 ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.5)) (suspend) ) ) @@ -483,8 +483,8 @@ :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1))) :frame-num 0.0 ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 0.5)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 0.5)) (suspend) ) ) @@ -504,8 +504,8 @@ :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1))) :frame-num 0.0 ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.5)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 0.5)) (suspend) ) ) @@ -524,8 +524,8 @@ :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1))) :frame-num 0.0 ) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 0.25)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 0.25)) (suspend) ) ) @@ -544,8 +544,8 @@ :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1))) :frame-num 0.0 ) - (let ((gp-5 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-5) (seconds 0.125)) + (let ((gp-5 (current-time))) + (until (>= (- (current-time) gp-5) (seconds 0.125)) (suspend) ) ) @@ -565,8 +565,8 @@ :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1))) :frame-num 0.0 ) - (let ((s5-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-0) (seconds 0.05)) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) (seconds 0.05)) (suspend) ) ) @@ -952,8 +952,8 @@ ) ) (suspend) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 4)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 4)) (suspend) ) ) diff --git a/goal_src/jak2/levels/dig/dig3-obs.gc b/goal_src/jak2/levels/dig/dig3-obs.gc index 614edc980c..d96f2962b0 100644 --- a/goal_src/jak2/levels/dig/dig3-obs.gc +++ b/goal_src/jak2/levels/dig/dig3-obs.gc @@ -265,38 +265,38 @@ :virtual #t :trans (the-as (function none :behavior dig-spikey-step) rider-trans) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (the int (-> self cycle-offset))) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (the int (-> self cycle-offset))) (suspend) ) ) (until #f - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (the int (-> self cycle-time))) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (the int (-> self cycle-time))) (suspend) ) ) (activate! (-> self smush) -1.0 60 225 1.0 1.0 (-> self clock)) (sound-play "spikey-shake" :position (-> self root trans)) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.75)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 0.75)) (set! (-> self shudder-angle) (* 364.0889 (update! (-> self smush)))) (suspend) ) ) (set! (-> self shudder-angle) 0.0) (set-zero! (-> self smush)) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 0.25)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 0.25)) (suspend) ) ) (sound-play "spikey-turn" :position (-> self root trans)) (let* ((f0-7 1.0) (f30-1 (* 65536.0 f0-7)) - (gp-6 (-> self clock frame-counter)) + (gp-6 (current-time)) ) - (until (>= (- (-> self clock frame-counter) gp-6) (seconds 1)) + (until (>= (- (current-time) gp-6) (seconds 1)) (set! (-> self rot-angle) (the float (sar (shl (the int (+ (-> self rot-angle) (* f30-1 (-> self clock seconds-per-frame)))) 48) 48)) ) @@ -449,8 +449,8 @@ This commonly includes things such as: ) (sound-play "spikey-break") (suspend) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 4)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 4)) (suspend) ) ) @@ -609,9 +609,9 @@ This commonly includes things such as: ) ) (the-as sound-id (when (and (logtest? s5-0 (collide-status impact-surface)) - (>= (- (-> self clock frame-counter) (-> obj played-bounce-time)) (seconds 0.3)) + (>= (- (current-time) (-> obj played-bounce-time)) (seconds 0.3)) ) - (let ((v0-7 (-> self clock frame-counter))) + (let ((v0-7 (current-time))) (set! (-> obj played-bounce-time) v0-7) v0-7 ) @@ -698,8 +698,8 @@ This commonly includes things such as: :virtual #t :code (behavior () (sound-play "spikey-door") - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.1)) (suspend) ) ) @@ -1377,34 +1377,32 @@ This commonly includes things such as: ) (defmethod rigid-body-object-method-37 dig-tipping-rock ((obj dig-tipping-rock)) - (with-pp - (let ((t9-0 (method-of-type rigid-body-platform rigid-body-object-method-37))) - (t9-0 obj) - ) - (cond - ((>= (- (-> pp clock frame-counter) (-> obj last-ridden-time)) (seconds 0.5)) - (when (nonzero? (-> obj bubbling-sound-id)) - (let ((v1-5 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) - (set! (-> v1-5 command) (sound-command set-param)) - (set! (-> v1-5 id) (the-as sound-id (-> obj bubbling-sound-id))) - (set! (-> v1-5 params volume) -4) - (set! (-> v1-5 auto-time) 120) - (set! (-> v1-5 auto-from) 2) - (set! (-> v1-5 params mask) (the-as uint 17)) - (-> v1-5 id) - ) - (set! (-> obj bubbling-sound-id) (the-as uint 0)) - 0 - ) - ) - (else - (if (zero? (-> obj bubbling-sound-id)) - (set! (-> obj bubbling-sound-id) (the-as uint (sound-play "lava-plat-tip"))) - ) - ) - ) - (none) + (let ((t9-0 (method-of-type rigid-body-platform rigid-body-object-method-37))) + (t9-0 obj) ) + (cond + ((>= (- (current-time) (-> obj last-ridden-time)) (seconds 0.5)) + (when (nonzero? (-> obj bubbling-sound-id)) + (let ((v1-5 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-5 command) (sound-command set-param)) + (set! (-> v1-5 id) (the-as sound-id (-> obj bubbling-sound-id))) + (set! (-> v1-5 params volume) -4) + (set! (-> v1-5 auto-time) 120) + (set! (-> v1-5 auto-from) 2) + (set! (-> v1-5 params mask) (the-as uint 17)) + (-> v1-5 id) + ) + (set! (-> obj bubbling-sound-id) (the-as uint 0)) + 0 + ) + ) + (else + (if (zero? (-> obj bubbling-sound-id)) + (set! (-> obj bubbling-sound-id) (the-as uint (sound-play "lava-plat-tip"))) + ) + ) + ) + (none) ) (defstate idle (dig-tipping-rock) @@ -1412,7 +1410,7 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('ridden) - (set! (-> self last-ridden-time) (-> self clock frame-counter)) + (set! (-> self last-ridden-time) (current-time)) ) ) (the-as object (rigid-body-object-event-handler proc arg1 event-type event)) diff --git a/goal_src/jak2/levels/drill_platform/drill-baron.gc b/goal_src/jak2/levels/drill_platform/drill-baron.gc index 34d109247b..b6748e2b61 100644 --- a/goal_src/jak2/levels/drill_platform/drill-baron.gc +++ b/goal_src/jak2/levels/drill_platform/drill-baron.gc @@ -1256,9 +1256,7 @@ This commonly includes things such as: ) ) (set! (-> self root-override trans y) - (+ (-> self current-y-position) - (* 4096.0 (* 2.0 (sin (+ 16384.0 (* 45.511112 (the float (-> self clock frame-counter))))))) - ) + (+ (-> self current-y-position) (* 4096.0 (* 2.0 (sin (+ 16384.0 (* 45.511112 (the float (current-time)))))))) ) (drill-barons-ship-method-22 self) (transform-post) @@ -1379,9 +1377,7 @@ This commonly includes things such as: ) ) (set! (-> self root-override trans y) - (+ (-> self current-y-position) - (* 4096.0 (* 2.0 (sin (+ 16384.0 (* 45.511112 (the float (-> self clock frame-counter))))))) - ) + (+ (-> self current-y-position) (* 4096.0 (* 2.0 (sin (+ 16384.0 (* 45.511112 (the float (current-time)))))))) ) (drill-barons-ship-method-22 self) (+! (-> self x-offset-angle) (* 0.7 (-> self clock time-adjust-ratio))) @@ -1395,9 +1391,9 @@ This commonly includes things such as: (quaternion-rotate-local-x! (-> obj root-override quat) (-> obj init-quat) - (* 182.04445 (sin (* 36.40889 (the float (-> pp clock frame-counter))))) + (* 182.04445 (sin (* 36.40889 (the float (current-time))))) ) - (let ((f30-2 (* 182.04445 (* 5.0 (sin (* 45.511112 (the float (-> pp clock frame-counter)))))))) + (let ((f30-2 (* 182.04445 (* 5.0 (sin (* 45.511112 (the float (current-time)))))))) (when (!= (-> obj rock-angle) 0.0) (+! f30-2 (* 182.04445 (* 20.0 (if (= (-> obj pass) 1) @@ -1421,10 +1417,10 @@ This commonly includes things such as: (quaternion-rotate-local-z! (-> obj root-override quat) (-> obj root-override quat) f30-2) ) (set! (-> obj root-override trans z) - (+ (* 4096.0 (* 30.0 (cos (* 45.511112 (the float (-> pp clock frame-counter)))))) (if (= (-> obj pass) 1) - -1433600.0 - -1433600.0 - ) + (+ (* 4096.0 (* 30.0 (cos (* 45.511112 (the float (current-time)))))) (if (= (-> obj pass) 1) + -1433600.0 + -1433600.0 + ) ) ) (if *target* @@ -1445,59 +1441,57 @@ This commonly includes things such as: ) (defmethod drill-barons-ship-turret-method-24 drill-barons-ship-turret ((obj drill-barons-ship-turret)) - (with-pp - (vector<-cspace! - (-> obj root-override trans) - (-> (the-as drill-barons-ship (-> obj parent 0)) node-list data (-> obj info joint-idx)) - ) - (let ((a2-1 (quaternion-axis-angle! (new 'stack-no-clear 'quaternion) 0.0 1.0 0.0 (-> obj info init-y-angle)))) - (quaternion*! - (-> obj root-override quat) - (-> (the-as drill-barons-ship (-> obj parent 0)) root-override quat) - a2-1 - ) - ) - (when (-> obj jmod) - (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (target-pos 0) (-> obj root-override trans))) - (s3-0 (quaternion->matrix (new-stack-matrix0) (-> obj root-override quat))) - ) - (vector-normalize! s5-1 1.0) - (let* ((s4-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s3-0 vector 1) 1.0)) - (s3-1 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s3-0 vector 2) 1.0)) - (a0-13 (vector-normalize! (vector-flatten! (new 'stack-no-clear 'vector) s5-1 s4-0) 1.0)) - (f30-0 (vector-y-angle a0-13)) - (f0-1 (vector-y-angle s3-1)) - (f0-5 (fmax - (fmin (+ (deg-diff f0-1 f30-0) (* 182.04445 (-> obj error-y-angle))) (-> obj info twist-y-max)) - (- (-> obj info twist-y-max)) - ) - ) - ) - (quaternion-axis-angle! (the-as quaternion (-> obj jmod twist)) 0.0 1.0 0.0 f0-5) - ) - ) - (if (-> obj jmod-left) - (quaternion-axis-angle! - (the-as quaternion (-> obj jmod-left twist)) - 0.0 - 0.0 - 1.0 - (* 182.04445 (* -3.0 (the float (-> pp clock frame-counter)))) - ) - ) - (if (-> obj jmod-right) - (quaternion-axis-angle! - (the-as quaternion (-> obj jmod-right twist)) - 0.0 - 0.0 - 1.0 - (* 182.04445 (* 3.0 (the float (-> pp clock frame-counter)))) - ) - ) - ) - 0 - (none) + (vector<-cspace! + (-> obj root-override trans) + (-> (the-as drill-barons-ship (-> obj parent 0)) node-list data (-> obj info joint-idx)) ) + (let ((a2-1 (quaternion-axis-angle! (new 'stack-no-clear 'quaternion) 0.0 1.0 0.0 (-> obj info init-y-angle)))) + (quaternion*! + (-> obj root-override quat) + (-> (the-as drill-barons-ship (-> obj parent 0)) root-override quat) + a2-1 + ) + ) + (when (-> obj jmod) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (target-pos 0) (-> obj root-override trans))) + (s3-0 (quaternion->matrix (new-stack-matrix0) (-> obj root-override quat))) + ) + (vector-normalize! s5-1 1.0) + (let* ((s4-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s3-0 vector 1) 1.0)) + (s3-1 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s3-0 vector 2) 1.0)) + (a0-13 (vector-normalize! (vector-flatten! (new 'stack-no-clear 'vector) s5-1 s4-0) 1.0)) + (f30-0 (vector-y-angle a0-13)) + (f0-1 (vector-y-angle s3-1)) + (f0-5 (fmax + (fmin (+ (deg-diff f0-1 f30-0) (* 182.04445 (-> obj error-y-angle))) (-> obj info twist-y-max)) + (- (-> obj info twist-y-max)) + ) + ) + ) + (quaternion-axis-angle! (the-as quaternion (-> obj jmod twist)) 0.0 1.0 0.0 f0-5) + ) + ) + (if (-> obj jmod-left) + (quaternion-axis-angle! + (the-as quaternion (-> obj jmod-left twist)) + 0.0 + 0.0 + 1.0 + (* 182.04445 (* -3.0 (the float (current-time)))) + ) + ) + (if (-> obj jmod-right) + (quaternion-axis-angle! + (the-as quaternion (-> obj jmod-right twist)) + 0.0 + 0.0 + 1.0 + (* 182.04445 (* 3.0 (the float (current-time)))) + ) + ) + ) + 0 + (none) ) (defstate dead (drill-barons-ship-turret) @@ -1508,7 +1502,7 @@ This commonly includes things such as: (set! (-> v1-1 prim-core collide-with) (collide-spec)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -1776,7 +1770,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self shot-timer) (-> self clock frame-counter)) + (set! (-> self shot-timer) (current-time)) (set! (-> self shot-counter) 0) (set! (-> self error-y-angle) (if (< 25.0 (rand-vu-float-range 0.0 50.0)) -15.0 @@ -1901,7 +1895,7 @@ This commonly includes things such as: ) (go-virtual idle) ) - (when (and (= (-> self anim-frame) 1.0) (>= (- (-> self clock frame-counter) (-> self shot-timer)) (seconds 0.2))) + (when (and (= (-> self anim-frame) 1.0) (>= (- (current-time) (-> self shot-timer)) (seconds 0.2))) (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))) (cond ((-> self jmod) @@ -1988,7 +1982,7 @@ This commonly includes things such as: ) (sound-play "ship-gun1-fire") (+! (-> self shot-counter) 1) - (set! (-> self shot-timer) (-> self clock frame-counter)) + (set! (-> self shot-timer) (current-time)) (seek! (-> self error-y-angle) (-> self error-y-angle-dest) (-> self clock time-adjust-ratio)) (if (= (-> self error-y-angle) (-> self error-y-angle-dest)) (set! (-> self info next-to-shoot) #f) diff --git a/goal_src/jak2/levels/drill_platform/drill-mech-master.gc b/goal_src/jak2/levels/drill_platform/drill-mech-master.gc index 1b996b5af4..21fbeff51f 100644 --- a/goal_src/jak2/levels/drill_platform/drill-mech-master.gc +++ b/goal_src/jak2/levels/drill_platform/drill-mech-master.gc @@ -116,7 +116,7 @@ (set! (-> *game-info* counter) (the float (-> self cpanel-count))) (spawn-hud-panel self #t) (when (= (-> self cpanel-count) 9) - (set! (-> self next-warn-time) (+ (-> self clock frame-counter) (seconds 3))) + (set! (-> self next-warn-time) (+ (current-time) (seconds 3))) (task-node-close! (game-task-node drill-mech-started-smashing)) ) (if (and (zero? (-> self cpanel-count)) (-> self next-state) (= (-> self next-state name) 'idle)) @@ -146,11 +146,8 @@ :virtual #t :event drill-mech-master-event-handler :trans (behavior () - (when (and (< (-> self cpanel-count) 10) - (< 1 (-> self cpanel-count)) - (>= (-> self clock frame-counter) (-> self next-warn-time)) - ) - (set! (-> self next-warn-time) (+ (-> self clock frame-counter) (seconds 10))) + (when (and (< (-> self cpanel-count) 10) (< 1 (-> self cpanel-count)) (>= (current-time) (-> self next-warn-time))) + (set! (-> self next-warn-time) (+ (current-time) (seconds 10))) (talker-spawn-func (-> *talker-speech* 182) *entity-pool* (target-pos 0) (the-as region #f)) ) (none) @@ -162,16 +159,16 @@ :virtual #t :event drill-mech-master-event-handler :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (task-node-close! (game-task-node drill-mech-smash-consoles)) (set! (-> self alarm-sound-id) (sound-play "drill-alarm")) (persist-with-delay *setting-control* 'ignore-target (seconds 8) 'ignore-target #t 0.0 0) (set-setting! 'music 'danger10 0.0 0) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) (talker-spawn-func (-> *talker-speech* 183) *entity-pool* (target-pos 0) (the-as region #f)) @@ -190,10 +187,10 @@ :virtual #t :event drill-mech-master-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-continue! *game-info* "drill-escape" #f) - (set! (-> self next-warn-time) (+ (-> self clock frame-counter) (seconds 1))) - (set! (-> self started-timer-time) (-> self clock frame-counter)) + (set! (-> self next-warn-time) (+ (current-time) (seconds 1))) + (set! (-> self started-timer-time) (current-time)) (set! (-> self exited?) #f) (none) ) @@ -201,10 +198,7 @@ (if (and (-> self exited?) (process-grab? *target* #f)) (go-virtual victory) ) - (let ((gp-0 - (the-as int (- (-> self total-countdown-time) (- (-> self clock frame-counter) (-> self started-timer-time)))) - ) - ) + (let ((gp-0 (the-as int (- (-> self total-countdown-time) (- (current-time) (-> self started-timer-time)))))) (if (< (the-as time-frame gp-0) 0) (set! gp-0 0) ) @@ -217,8 +211,8 @@ (if (zero? gp-0) (go-virtual failed) ) - (when (>= (-> self clock frame-counter) (-> self next-warn-time)) - (set! (-> self next-warn-time) (+ (-> self clock frame-counter) (seconds 25))) + (when (>= (current-time) (-> self next-warn-time)) + (set! (-> self next-warn-time) (+ (current-time) (seconds 25))) (cond ((>= 9000 gp-0) (add-process *gui-control* self (gui-channel alert) (gui-action play) "cityv029" -99.0 0) @@ -245,7 +239,7 @@ :virtual #t :event drill-mech-master-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-setting! 'allow-pause #f 0.0 0) (set-setting! 'allow-progress #f 0.0 0) (none) @@ -258,7 +252,7 @@ ) :trans (behavior () (when (and (not (-> self killed-jak?)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.225)) + (>= (- (current-time) (-> self state-time)) (seconds 0.225)) (let ((a1-0 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-0 from) (process->ppointer self)) (set! (-> a1-0 num-params) 2) @@ -310,8 +304,8 @@ (set! (-> s4-0 trans w) 1.0) (spawn-with-matrix (-> self part-doom) s4-0) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.2)) (when (and (not gp-1) (>= 2 s5-1) (= (get-status *gui-control* (-> self explosion-sound-id)) (gui-status ready))) (set! gp-1 #t) (set-action! diff --git a/goal_src/jak2/levels/drill_platform/drill-obs.gc b/goal_src/jak2/levels/drill_platform/drill-obs.gc index 2837cdc283..225eb37d3c 100644 --- a/goal_src/jak2/levels/drill_platform/drill-obs.gc +++ b/goal_src/jak2/levels/drill_platform/drill-obs.gc @@ -106,7 +106,7 @@ and translate the platform via the `smush` @see [[smush-control]]" (activate! (-> obj smush) -1.0 24 120 1.0 1.0 (-> self clock)) - (set! (-> obj bounce-time) (-> self clock frame-counter)) + (set! (-> obj bounce-time) (current-time)) (set! (-> obj bouncing) #t) (logclear! (-> obj mask) (process-mask sleep)) (logclear! (-> obj mask) (process-mask sleep-code)) @@ -158,7 +158,7 @@ and translate the platform via the `smush` (defstate falling (drill-plat-falling) :virtual #t :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.4)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.4)) (logclear! (-> self root-override root-prim prim-core action) (collide-action rideable)) ) (drill-plat-falling-trans) @@ -689,7 +689,7 @@ For example for an elevator pre-compute the distance between the first and last ) (when gp-0 (when (or (focus-test? (the-as process-focusable gp-0) mech) - (>= (- (-> self clock frame-counter) (-> self no-collision-timer)) + (>= (- (current-time) (-> self no-collision-timer)) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout)) ) ) @@ -733,7 +733,7 @@ For example for an elevator pre-compute the distance between the first and last (set! (-> a1-10 param 1) (the-as uint v1-32)) ) (when (send-event-function gp-0 a1-10) - (let ((v0-0 (-> self clock frame-counter))) + (let ((v0-0 (current-time))) (set! (-> self no-collision-timer) v0-0) v0-0 ) @@ -1074,21 +1074,19 @@ This commonly includes things such as: (defmethod set-switch-color drill-switch ((obj drill-switch) (arg0 symbol)) "Set the switch color based on its state." - (with-pp - (when (or arg0 (not (logtest? (-> pp clock frame-counter) 64))) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (vector<-cspace+vector! s4-0 (-> obj node-list data 4) (new 'static 'vector :y 6963.2 :w 1.0)) - (spawn - (if arg0 - (-> obj green-part) - (-> obj part) - ) - s4-0 - ) + (when (or arg0 (not (logtest? (current-time) 64))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector<-cspace+vector! s4-0 (-> obj node-list data 4) (new 'static 'vector :y 6963.2 :w 1.0)) + (spawn + (if arg0 + (-> obj green-part) + (-> obj part) + ) + s4-0 ) ) - (none) ) + (none) ) (defmethod basebutton-method-34 drill-switch ((obj drill-switch)) @@ -1242,7 +1240,7 @@ This commonly includes things such as: (sleep-code) ) (else - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (the int (* 300.0 (-> self timeout)))) + (until (>= (- (current-time) (-> self state-time)) (the int (* 300.0 (-> self timeout)))) (suspend) ) (send-event! self (-> self event-going-up)) @@ -1441,11 +1439,11 @@ This commonly includes things such as: (defstate drill-laser-idle (drill-laser) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (let* ((f0-2 (+ (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> self state-time)))) + (let* ((f0-2 (+ (* 0.0033333334 (the float (- (current-time) (-> self state-time)))) (* (-> self offset) (+ (-> self speed) (-> self pause))) ) ) diff --git a/goal_src/jak2/levels/drill_platform/drill-obs2.gc b/goal_src/jak2/levels/drill_platform/drill-obs2.gc index 73e39df48f..330e5bba19 100644 --- a/goal_src/jak2/levels/drill_platform/drill-obs2.gc +++ b/goal_src/jak2/levels/drill_platform/drill-obs2.gc @@ -858,8 +858,8 @@ This commonly includes things such as: ) ) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 0.5)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 0.5)) (suspend) ) ) @@ -1396,9 +1396,9 @@ This commonly includes things such as: ) (if (-> self ridden?) (set! (-> self ridden?) #f) - (set! (-> self not-ridden-timer) (-> self clock frame-counter)) + (set! (-> self not-ridden-timer) (current-time)) ) - (if (>= (- (-> self clock frame-counter) (-> self not-ridden-timer)) (seconds 0.4)) + (if (>= (- (current-time) (-> self not-ridden-timer)) (seconds 0.4)) (go-virtual swing-down) ) (none) @@ -1421,7 +1421,7 @@ This commonly includes things such as: (t9-0) ) ) - (if (>= (- (-> self clock frame-counter) (-> self not-ridden-timer)) (seconds 2)) + (if (>= (- (current-time) (-> self not-ridden-timer)) (seconds 2)) (send-event self 'trigger) ) (none) @@ -1434,12 +1434,10 @@ This commonly includes things such as: (defmethod set-flipped-state drill-drop-plat ((obj drill-drop-plat)) "Set the state of the platform." - (with-pp - (set! (-> obj not-ridden-timer) (-> pp clock frame-counter)) - (go (method-of-object obj up)) - 0 - (none) - ) + (set! (-> obj not-ridden-timer) (current-time)) + (go (method-of-object obj up)) + 0 + (none) ) (defmethod init-plat-collision! drill-drop-plat ((obj drill-drop-plat)) diff --git a/goal_src/jak2/levels/drill_platform/drill-panel.gc b/goal_src/jak2/levels/drill_platform/drill-panel.gc index ebee9c32f0..e0be39875f 100644 --- a/goal_src/jak2/levels/drill_platform/drill-panel.gc +++ b/goal_src/jak2/levels/drill_platform/drill-panel.gc @@ -514,97 +514,91 @@ (defmethod spawn-shock-part drill-control-panel ((obj drill-control-panel)) "Spawn shock particles." - (with-pp - (let ((v1-0 (-> obj id))) - (cond - ((or (zero? v1-0) (= v1-0 1)) - (set! (-> *part-id-table* 1852 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -4.0 4.0))) - (set! (-> *part-id-table* 1852 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -2.0 2.0))) - (set! (-> *part-id-table* 1852 init-specs 4 initial-valuef) (* 4096.0 (rand-vu-float-range 1.0 3.0))) - (when (= (-> obj id) 1) - (set! (-> *part-id-table* 1870 init-specs 3 initial-valuef) 8192.0) - (set! (-> *part-id-table* 1869 init-specs 3 initial-valuef) 8192.0) - (set! (-> *part-id-table* 1871 init-specs 2 initial-valuef) 8192.0) - (set! (-> *part-id-table* 1872 init-specs 2 initial-valuef) 8192.0) - (set! (-> *part-id-table* 1873 init-specs 2 initial-valuef) 8192.0) - (when (>= (-> pp clock frame-counter) (-> obj next-warn-time)) - (set! (-> obj next-warn-time) - (+ (-> pp clock frame-counter) (the int (* 300.0 (rand-vu-float-range 1.0 2.0)))) - ) - (set! (-> *part-id-table* 1851 init-specs 4 initial-valuef) -4096.0) - (set! (-> *part-id-table* 1851 init-specs 24 initial-valuef) (* 182.04445 (rand-vu-float-range -45.0 45.0))) - (set! (-> *part-id-table* 1851 init-specs 25 initial-valuef) (* 182.04445 (rand-vu-float-range 0.0 45.0))) - (set! (-> *part-id-table* 1851 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -3.0 3.0))) - (set! (-> *part-id-table* 1851 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 3.0))) - ) + (let ((v1-0 (-> obj id))) + (cond + ((or (zero? v1-0) (= v1-0 1)) + (set! (-> *part-id-table* 1852 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -4.0 4.0))) + (set! (-> *part-id-table* 1852 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -2.0 2.0))) + (set! (-> *part-id-table* 1852 init-specs 4 initial-valuef) (* 4096.0 (rand-vu-float-range 1.0 3.0))) + (when (= (-> obj id) 1) + (set! (-> *part-id-table* 1870 init-specs 3 initial-valuef) 8192.0) + (set! (-> *part-id-table* 1869 init-specs 3 initial-valuef) 8192.0) + (set! (-> *part-id-table* 1871 init-specs 2 initial-valuef) 8192.0) + (set! (-> *part-id-table* 1872 init-specs 2 initial-valuef) 8192.0) + (set! (-> *part-id-table* 1873 init-specs 2 initial-valuef) 8192.0) + (when (>= (current-time) (-> obj next-warn-time)) + (set! (-> obj next-warn-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 1.0 2.0))))) + (set! (-> *part-id-table* 1851 init-specs 4 initial-valuef) -4096.0) + (set! (-> *part-id-table* 1851 init-specs 24 initial-valuef) (* 182.04445 (rand-vu-float-range -45.0 45.0))) + (set! (-> *part-id-table* 1851 init-specs 25 initial-valuef) (* 182.04445 (rand-vu-float-range 0.0 45.0))) + (set! (-> *part-id-table* 1851 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -3.0 3.0))) + (set! (-> *part-id-table* 1851 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 3.0))) ) - (spawn-with-cspace (-> obj debris-part) (-> obj node-list data 18)) ) - (else - (case (-> obj id) - ((3 5 7 8) - (if (zero? (rand-vu-int-count 2)) - (process-drawable-shock-effect - obj - (new 'static 'lightning-spec - :name #f - :flags (lightning-spec-flags lsf0) - :start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) - :end-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) - :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5) - :fade-start-factor 0.2 - :texture (new 'static 'texture-id :index #x83 :page #xc) - :reduction 0.42 - :num-points 16 - :box-size 16384.0 - :merge-factor 0.5 - :merge-count 2 - :radius 2048.0 - :duration 30.0 - :sound (static-sound-spec "shock" :volume 50.0) - ) - lightning-probe-callback - (-> *part-id-table* 166) - 12 - 0 - 12288.0 + (spawn-with-cspace (-> obj debris-part) (-> obj node-list data 18)) + ) + (else + (case (-> obj id) + ((3 5 7 8) + (if (zero? (rand-vu-int-count 2)) + (process-drawable-shock-effect + obj + (new 'static 'lightning-spec + :name #f + :flags (lightning-spec-flags lsf0) + :start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + :end-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5) + :fade-start-factor 0.2 + :texture (new 'static 'texture-id :index #x83 :page #xc) + :reduction 0.42 + :num-points 16 + :box-size 16384.0 + :merge-factor 0.5 + :merge-count 2 + :radius 2048.0 + :duration 30.0 + :sound (static-sound-spec "shock" :volume 50.0) ) + lightning-probe-callback + (-> *part-id-table* 166) + 12 + 0 + 12288.0 ) - ) - (else - 0 - ) + ) + ) + (else + 0 ) - (set! (-> *part-id-table* 1852 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 3.0))) - (set! (-> *part-id-table* 1852 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -0.5 3.0))) - (set! (-> *part-id-table* 1852 init-specs 4 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 -1.25))) - (set! (-> *part-id-table* 1870 init-specs 3 initial-valuef) -6144.0) - (set! (-> *part-id-table* 1869 init-specs 3 initial-valuef) -6144.0) - (set! (-> *part-id-table* 1871 init-specs 2 initial-valuef) -6144.0) - (set! (-> *part-id-table* 1872 init-specs 2 initial-valuef) -6144.0) - (set! (-> *part-id-table* 1873 init-specs 2 initial-valuef) -6144.0) - (when (>= (-> pp clock frame-counter) (-> obj next-warn-time)) - (set! (-> obj next-warn-time) - (+ (-> pp clock frame-counter) (the int (* 300.0 (rand-vu-float-range 1.5 3.0)))) - ) - (set! (-> *part-id-table* 1851 init-specs 4 initial-valuef) 4096.0) - (set! (-> *part-id-table* 1879 init-specs 23 initial-valuef) (* 182.04445 (rand-vu-float-range -30.0 30.0))) - (set! (-> *part-id-table* 1879 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -1.5 1.5))) - (set! (-> *part-id-table* 1879 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 3.0))) - ) - (spawn-with-cspace (-> obj debris-part) (-> obj node-list data 12)) ) + (set! (-> *part-id-table* 1852 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 3.0))) + (set! (-> *part-id-table* 1852 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -0.5 3.0))) + (set! (-> *part-id-table* 1852 init-specs 4 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 -1.25))) + (set! (-> *part-id-table* 1870 init-specs 3 initial-valuef) -6144.0) + (set! (-> *part-id-table* 1869 init-specs 3 initial-valuef) -6144.0) + (set! (-> *part-id-table* 1871 init-specs 2 initial-valuef) -6144.0) + (set! (-> *part-id-table* 1872 init-specs 2 initial-valuef) -6144.0) + (set! (-> *part-id-table* 1873 init-specs 2 initial-valuef) -6144.0) + (when (>= (current-time) (-> obj next-warn-time)) + (set! (-> obj next-warn-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 1.5 3.0))))) + (set! (-> *part-id-table* 1851 init-specs 4 initial-valuef) 4096.0) + (set! (-> *part-id-table* 1879 init-specs 23 initial-valuef) (* 182.04445 (rand-vu-float-range -30.0 30.0))) + (set! (-> *part-id-table* 1879 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -1.5 1.5))) + (set! (-> *part-id-table* 1879 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 3.0))) + ) + (spawn-with-cspace (-> obj debris-part) (-> obj node-list data 12)) ) ) - (none) ) + (none) ) (defstate hit (drill-control-panel) :virtual #t :enter (behavior ((arg0 symbol)) - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self next-warn-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self next-warn-time) (current-time)) (process-entity-status! self (entity-perm-status bit-12) #t) (set! (-> self draw force-lod) 0) (logior! (-> self focus-status) (focus-status disable dead ignore)) @@ -615,7 +609,7 @@ (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (>= (- (current-time) (-> self state-time)) (seconds 1)) (spawn-shock-part self) ) (none) diff --git a/goal_src/jak2/levels/drill_platform/ginsu.gc b/goal_src/jak2/levels/drill_platform/ginsu.gc index 57dece0310..baacceb898 100644 --- a/goal_src/jak2/levels/drill_platform/ginsu.gc +++ b/goal_src/jak2/levels/drill_platform/ginsu.gc @@ -359,61 +359,59 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (with-pp - (ginsu-method-180 obj) - (let ((t9-1 (method-of-type nav-enemy track-target!))) - (t9-1 obj) - ) - (cond - ((not (and (-> obj next-state) (let ((v1-6 (-> obj next-state name))) - (or (= v1-6 'idle) - (= v1-6 'active) - (= v1-6 'dormant) - (= v1-6 'ambush) - (= v1-6 'knocked) - (= v1-6 'idle) - (= v1-6 'dormant) - (= v1-6 'die) - (= v1-6 'die-falling) - ) - ) - ) - ) - (sound-play "ginsu-loop" :id (the-as sound-id (-> obj blade-sound)) :position (-> obj root-override2 trans)) - (set! (-> obj blade-sound-playing) #t) - ) - ((-> obj blade-sound-playing) - (sound-stop (the-as sound-id (-> obj blade-sound))) - (set! (-> obj blade-sound-playing) #f) - ) - ) - (cond - ((and (not (and (-> obj next-state) (let ((v1-17 (-> obj next-state name))) - (or (= v1-17 'idle) - (= v1-17 'active) - (= v1-17 'dormant) - (= v1-17 'ambush) - (= v1-17 'knocked) - (= v1-17 'idle) - (= v1-17 'dormant) - (= v1-17 'die) - (= v1-17 'die-falling) - ) - ) - ) - ) - (< (- (-> pp clock frame-counter) (-> obj grind-timer)) 0) - ) - (sound-play "ginsu-grind" :id (the-as sound-id (-> obj grind-sound)) :position (-> obj root-override2 trans)) - (set! (-> obj grind-sound-playing) #t) - ) - ((-> obj grind-sound-playing) - (sound-stop (the-as sound-id (-> obj grind-sound))) - (set! (-> obj grind-sound-playing) #f) - ) - ) - (none) + (ginsu-method-180 obj) + (let ((t9-1 (method-of-type nav-enemy track-target!))) + (t9-1 obj) ) + (cond + ((not (and (-> obj next-state) (let ((v1-6 (-> obj next-state name))) + (or (= v1-6 'idle) + (= v1-6 'active) + (= v1-6 'dormant) + (= v1-6 'ambush) + (= v1-6 'knocked) + (= v1-6 'idle) + (= v1-6 'dormant) + (= v1-6 'die) + (= v1-6 'die-falling) + ) + ) + ) + ) + (sound-play "ginsu-loop" :id (the-as sound-id (-> obj blade-sound)) :position (-> obj root-override2 trans)) + (set! (-> obj blade-sound-playing) #t) + ) + ((-> obj blade-sound-playing) + (sound-stop (the-as sound-id (-> obj blade-sound))) + (set! (-> obj blade-sound-playing) #f) + ) + ) + (cond + ((and (not (and (-> obj next-state) (let ((v1-17 (-> obj next-state name))) + (or (= v1-17 'idle) + (= v1-17 'active) + (= v1-17 'dormant) + (= v1-17 'ambush) + (= v1-17 'knocked) + (= v1-17 'idle) + (= v1-17 'dormant) + (= v1-17 'die) + (= v1-17 'die-falling) + ) + ) + ) + ) + (< (- (current-time) (-> obj grind-timer)) 0) + ) + (sound-play "ginsu-grind" :id (the-as sound-id (-> obj grind-sound)) :position (-> obj root-override2 trans)) + (set! (-> obj grind-sound-playing) #t) + ) + ((-> obj grind-sound-playing) + (sound-stop (the-as sound-id (-> obj grind-sound))) + (set! (-> obj grind-sound-playing) #f) + ) + ) + (none) ) (defmethod ginsu-method-182 ginsu ((obj ginsu)) @@ -540,7 +538,7 @@ (vector-float*! s5-1 s5-1 0.5) (spawn (-> obj part) s5-1) ) - (set! v0-1 (+ (-> pp clock frame-counter) (seconds 0.125))) + (set! v0-1 (+ (current-time) (seconds 0.125))) (set! (-> obj grind-timer) (the-as time-frame v0-1)) v0-1 ) @@ -621,8 +619,8 @@ (set! (-> self enemy-flags) (the-as enemy-flag (logxor (shl 256 32) (the-as int (-> self enemy-flags))))) ) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag enemy-flag41)))) - (set! (-> self starting-time) (-> self clock frame-counter)) - (set! (-> self spiral-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) + (set! (-> self spiral-time) (current-time)) (set! (-> self desired-distance) (vector-length (ginsu-method-181 self (new 'stack-no-clear 'vector)))) (none) ) @@ -655,7 +653,7 @@ 0.0 (set! (-> s5-0 y) 0.0) (let* ((f0-3 (vector-normalize-ret-len! s5-0 1.0)) - (f1-1 (- 1.0 (* 0.0016666667 (the float (- (-> self clock frame-counter) (-> self spiral-time)))))) + (f1-1 (- 1.0 (* 0.0016666667 (the float (- (current-time) (-> self spiral-time)))))) (f2-3 (fmax 12288.0 (* 102400.0 f1-1))) (f0-4 (- f0-3 (fmin (fmax 12288.0 (* 122880.0 f1-1)) (fmax f2-3 (-> self desired-distance))))) (f30-0 (fmin 8192.0 (fmax -8192.0 f0-4))) @@ -695,7 +693,7 @@ (set! (-> v1-4 target-speed) 8192.0) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (ja-channel-push! 1 (seconds 0.2)) (ja :group! ginsu-idle-ja :num! min) (none) @@ -721,7 +719,7 @@ (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (go-virtual circling) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.75)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.75)) (go-virtual attack) ) (ja :num! (loop!)) @@ -769,7 +767,7 @@ (set! (-> v1-10 target-speed) 49152.0) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (ja :group! ginsu-attack-ja :num! min) (none) ) diff --git a/goal_src/jak2/levels/forest/forest-obs.gc b/goal_src/jak2/levels/forest/forest-obs.gc index cdbb20f3d8..1742f6b0a7 100644 --- a/goal_src/jak2/levels/forest/forest-obs.gc +++ b/goal_src/jak2/levels/forest/forest-obs.gc @@ -137,7 +137,7 @@ This commonly includes things such as: ) ) (when (and (nonzero? (-> self focus-disable-timer)) - (< (the-as time-frame (-> self focus-disable-timer)) (-> self clock frame-counter)) + (< (the-as time-frame (-> self focus-disable-timer)) (current-time)) ) (logclear! (-> self focus-status) (focus-status disable)) (set! (-> self focus-disable-timer) (the-as uint 0)) @@ -271,7 +271,7 @@ This commonly includes things such as: (sound-play "samos-impact") (set! (-> self falling?) (the-as basic #t)) (logior! (-> self focus-status) (focus-status disable)) - (set! (-> self focus-disable-timer) (the-as uint (+ (-> self clock frame-counter) (seconds 3.5)))) + (set! (-> self focus-disable-timer) (the-as uint (+ (current-time) (seconds 3.5)))) (none) ) :code (behavior () @@ -384,8 +384,8 @@ This commonly includes things such as: ) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 2)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 2)) (suspend) ) ) @@ -647,9 +647,9 @@ This commonly includes things such as: TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (set! (-> self start-time) (-> self clock frame-counter)) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.5)) + (set! (-> self start-time) (current-time)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.5)) (suspend) ) ) @@ -721,8 +721,8 @@ This commonly includes things such as: ) ) ) - (let ((s3-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-0) (seconds 15)) + (let ((s3-0 (current-time))) + (until (>= (- (current-time) s3-0) (seconds 15)) (suspend) ) ) @@ -759,8 +759,8 @@ This commonly includes things such as: ) ) (dotimes (s3-1 3) - (let ((s2-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s2-0) (seconds 10)) + (let ((s2-0 (current-time))) + (until (>= (- (current-time) s2-0) (seconds 10)) (suspend) ) ) @@ -796,8 +796,8 @@ This commonly includes things such as: ) ) ) - (let ((s2-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s2-1) (seconds 10)) + (let ((s2-1 (current-time))) + (until (>= (- (current-time) s2-1) (seconds 10)) (suspend) ) ) @@ -834,8 +834,8 @@ This commonly includes things such as: ) ) ) - (let ((s3-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-2) (seconds 10)) + (let ((s3-2 (current-time))) + (until (>= (- (current-time) s3-2) (seconds 10)) (suspend) ) ) @@ -871,8 +871,8 @@ This commonly includes things such as: ) ) ) - (let ((s3-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-3) (seconds 10)) + (let ((s3-3 (current-time))) + (until (>= (- (current-time) s3-3) (seconds 10)) (suspend) ) ) @@ -885,8 +885,8 @@ This commonly includes things such as: (goto cfg-74) ) ) - (let ((s2-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s2-2) (seconds 1)) + (let ((s2-2 (current-time))) + (until (>= (- (current-time) s2-2) (seconds 1)) (suspend) ) ) @@ -964,23 +964,23 @@ This commonly includes things such as: ) ) ) - (let ((s3-5 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-5) (seconds 1)) + (let ((s3-5 (current-time))) + (until (>= (- (current-time) s3-5) (seconds 1)) (suspend) ) ) ) ) - (let ((s4-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-1) (seconds 0.5)) + (let ((s4-1 (current-time))) + (until (>= (- (current-time) s4-1) (seconds 0.5)) (suspend) ) ) (set-setting! 'entity-name "camera-260" 0.0 0) (set-setting! 'process-mask 'set 0.0 (process-mask movie enemy)) (process-grab? *target* #f) - (let ((s4-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-2) (seconds 0.5)) + (let ((s4-2 (current-time))) + (until (>= (- (current-time) s4-2) (seconds 0.5)) (suspend) ) ) @@ -990,8 +990,8 @@ This commonly includes things such as: ) 'leave ) - (let ((s5-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-1) (seconds 0.2)) + (let ((s5-1 (current-time))) + (until (>= (- (current-time) s5-1) (seconds 0.2)) (suspend) ) ) @@ -1002,16 +1002,16 @@ This commonly includes things such as: 'leave ) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 3)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 3)) (suspend) ) ) (remove-setting! 'entity-name) (remove-setting! 'process-mask) (process-release? *target*) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 3)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 3)) (suspend) ) ) diff --git a/goal_src/jak2/levels/forest/lifeseed/protect.gc b/goal_src/jak2/levels/forest/lifeseed/protect.gc index cb6b02a5b8..1539acc1e5 100644 --- a/goal_src/jak2/levels/forest/lifeseed/protect.gc +++ b/goal_src/jak2/levels/forest/lifeseed/protect.gc @@ -437,9 +437,7 @@ This commonly includes things such as: (let ((f0-7 (vector-vector-xz-distance (target-pos 0) (-> s5-1 t-pos)))) (cond ((and (< f0-7 327680.0) (< 204800.0 f0-7)) - (when (and (not (handle->process (-> self slave gp-1))) - (< (the int (-> self data-float gp-1)) (-> self clock frame-counter)) - ) + (when (and (not (handle->process (-> self slave gp-1))) (< (the int (-> self data-float gp-1)) (current-time))) (let ((s4-2 (new 'stack-no-clear 'transport-params))) (let ((s3-2 (new 'stack-no-clear 'vector))) (set! (-> s3-2 quad) (-> s5-1 t-pos quad)) @@ -488,7 +486,7 @@ This commonly includes things such as: s5-4 ) ) - (set! (-> self data-float gp-1) (the float (+ (-> self clock frame-counter) (seconds 20)))) + (set! (-> self data-float gp-1) (the float (+ (current-time) (seconds 20)))) ) ) ) @@ -531,8 +529,8 @@ This commonly includes things such as: (lambda :behavior task-manager () (send-event (handle->process (-> self arrow)) 'leave) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (talker-spawn-func (-> *talker-speech* 185) *entity-pool* (target-pos 0) (the-as region #f)) diff --git a/goal_src/jak2/levels/forest/pegasus.gc b/goal_src/jak2/levels/forest/pegasus.gc index 437d1279e7..e5a831c024 100644 --- a/goal_src/jak2/levels/forest/pegasus.gc +++ b/goal_src/jak2/levels/forest/pegasus.gc @@ -165,32 +165,30 @@ (defmethod track-how-long-aimed-at! pegasus ((obj pegasus)) "Updates `targetted-timer` with the `frame-counter` while Jak is aiming at the [[pegasus]]" - (with-pp - (let ((target *target*)) - (when (and target (-> target gun active?)) - (let ((inaccuracy-dir (new 'stack-no-clear 'vector)) - (inaccuracy-vec (new 'stack-no-clear 'vector)) + (let ((target *target*)) + (when (and target (-> target gun active?)) + (let ((inaccuracy-dir (new 'stack-no-clear 'vector)) + (inaccuracy-vec (new 'stack-no-clear 'vector)) + ) + (vector-! inaccuracy-dir (-> obj root-override2 trans) (-> target gun fire-point)) + (vector+float*! + inaccuracy-vec + (-> target gun fire-point) + (-> target gun fire-dir-out) + (vector-length inaccuracy-dir) + ) + (let ((inaccuracy-mag (vector-vector-distance-squared inaccuracy-vec (-> obj root-override2 trans))) + (threshold 20480.0) + ) + (if (< inaccuracy-mag (* threshold threshold)) + (set! (-> obj targetted-timer) (current-time)) ) - (vector-! inaccuracy-dir (-> obj root-override2 trans) (-> target gun fire-point)) - (vector+float*! - inaccuracy-vec - (-> target gun fire-point) - (-> target gun fire-dir-out) - (vector-length inaccuracy-dir) - ) - (let ((inaccuracy-mag (vector-vector-distance-squared inaccuracy-vec (-> obj root-override2 trans))) - (threshold 20480.0) - ) - (if (< inaccuracy-mag (* threshold threshold)) - (set! (-> obj targetted-timer) (-> pp clock frame-counter)) - ) - ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; WARN: Return type mismatch int vs enemy-aware. @@ -198,52 +196,48 @@ "Checks a variety of criteria to determine the level of awareness the enemy is of the target. Sets `aware` and related fields as well! For pegasus, it will call [[enemy::57]] only if the [[pegasus]] has been targetted for more than 5 [[seconds]] @returns the value from [[enemy::57]], otherwise [[enemy-aware::4]]" - (with-pp - (the-as enemy-aware (if (>= (- (-> pp clock frame-counter) (-> obj targetted-timer)) (seconds 5)) - (the-as int ((method-of-type enemy update-target-awareness!) obj proc focus)) - 4 - ) - ) - ) + (the-as enemy-aware (if (>= (- (current-time) (-> obj targetted-timer)) (seconds 5)) + (the-as int ((method-of-type enemy update-target-awareness!) obj proc focus)) + 4 + ) + ) ) (defmethod general-event-handler pegasus ((obj pegasus) (proc process) (arg2 int) (event-type symbol) (event 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" - (with-pp - (case event-type - (('track) - #f - ) - (('hit 'hit-knocked) - (cond - ((zero? (-> obj hit-points)) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) - (logior! (-> obj focus-status) (focus-status hit)) - (if (zero? (-> obj hit-points)) - (logior! (-> obj focus-status) (focus-status dead)) - ) - (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) - (enemy-method-62 obj) - (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (process-contact-action proc) - (send-event proc 'get-attack-count 1) - (kill-prefer-falling obj) - ) - (else - (let ((v0-0 (the-as object (-> pp clock frame-counter)))) - (set! (-> obj targetted-timer) (the-as time-frame v0-0)) - v0-0 - ) + (case event-type + (('track) + #f + ) + (('hit 'hit-knocked) + (cond + ((zero? (-> obj hit-points)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) + ) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (process-contact-action proc) + (send-event proc 'get-attack-count 1) + (kill-prefer-falling obj) + ) + (else + (let ((v0-0 (the-as object (current-time)))) + (set! (-> obj targetted-timer) (the-as time-frame v0-0)) + v0-0 ) ) ) - (else - ((method-of-type enemy general-event-handler) obj proc arg2 event-type event) - ) + ) + (else + ((method-of-type enemy general-event-handler) obj proc arg2 event-type event) ) ) ) @@ -253,20 +247,18 @@ For pegasus, it will call [[enemy::57]] only if the [[pegasus]] has been targett This is why the scouts are technically killable by other means @returns the amount of damage taken from an attack. Also updates the `targetted-timer`. @see [[*pegasus-enemy-info*]]" - (with-pp - (let ((hitpoints 1)) - (let ((attack-info (the-as attack-info (-> arg1 param 1)))) - (case (-> arg1 message) - (('attack) - (if (and (logtest? (-> attack-info mask) (attack-info-mask mode)) (= (-> attack-info mode) 'board)) - (set! hitpoints (-> obj hit-points)) - ) - ) - ) + (let ((hitpoints 1)) + (let ((attack-info (the-as attack-info (-> arg1 param 1)))) + (case (-> arg1 message) + (('attack) + (if (and (logtest? (-> attack-info mask) (attack-info-mask mode)) (= (-> attack-info mode) 'board)) + (set! hitpoints (-> obj hit-points)) + ) + ) ) - (set! (-> obj targetted-timer) (-> pp clock frame-counter)) - hitpoints ) + (set! (-> obj targetted-timer) (current-time)) + hitpoints ) ) @@ -541,7 +533,7 @@ There are many fail-safes here if something goes wrong to try to keep the pegasu @param explicit-y-vel Normally `0.0` but this value is used when the pegasus needs to switch direction @param adjust-y-offset? Normally [[#f]] which forces the movement to reflect the result of the collison query - the [[pegasus]] will stay close to the ground. [[#t]] ignores this" (+! (-> self curve-position) - (/ (the float (* (- (-> self clock frame-counter) (-> self clock old-frame-counter)) (the int (-> self speed)))) + (/ (the float (* (- (current-time) (-> self clock old-frame-counter)) (the int (-> self speed)))) (total-distance (-> self path-info (-> self current-path) path-data)) ) ) @@ -642,7 +634,7 @@ This function also is what causes the pegasus to flip around (interpolant (- 1.0 (fmax 0.0 (fmin 1.0 dist-from-target)))) (interpolated-speed (lerp min-speed max-speed interpolant)) ) - (if (< (- (-> self clock frame-counter) (-> self targetted-timer)) (seconds 5)) + (if (< (- (current-time) (-> self targetted-timer)) (seconds 5)) (set! interpolated-speed (fmax 163840.0 interpolated-speed)) ) (let ((movement-speed (* 0.0033333334 interpolated-speed))) @@ -807,7 +799,7 @@ The faster it's moving the fast it flaps it's wings, etc (defstate stare (pegasus) :virtual #t :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((awareness (-> self focus aware))) (cond ((and (>= 1 (the-as int awareness)) @@ -854,10 +846,7 @@ The faster it's moving the fast it flaps it's wings, etc "Handles the flying animations and sounds @TODO - cleanup a bit more" (let ((anim-speed (pegasus-calc-anim-speed))) - (let ((gp-0 - (and (-> self can-run) (< (the-as time-frame (-> self ambient-possible)) (-> self clock frame-counter))) - ) - ) + (let ((gp-0 (and (-> self can-run) (< (the-as time-frame (-> self ambient-possible)) (current-time))))) (let* ((min-dist (lerp-scale 61440.0 32768.0 (the float arg0) 0.0 3000.0)) (min-speed (lerp-scale 122880.0 81920.0 (the float arg0) 0.0 3000.0)) (s4-0 (pegasus-calc-speed min-dist 122880.0 min-speed 49152.0)) @@ -930,7 +919,7 @@ The faster it's moving the fast it flaps it's wings, etc ((let ((v1-72 (ja-group))) (and v1-72 (= v1-72 pegasus-run-ja)) ) - (if (or (not (-> self can-run)) (< (the-as time-frame (-> self ambient-expire)) (-> self clock frame-counter))) + (if (or (not (-> self can-run)) (< (the-as time-frame (-> self ambient-expire)) (current-time))) (ja :group! pegasus-run-to-fly-ja) ) (ja :num-func num-func-identity :frame-num 0.0) @@ -939,7 +928,7 @@ The faster it's moving the fast it flaps it's wings, etc (ja-channel-push! 1 (seconds 0.125)) (ja :group! pegasus-fly-to-run-ja) (ja :num-func num-func-identity :frame-num 0.0) - (let* ((s5-4 (-> self clock frame-counter)) + (let* ((s5-4 (current-time)) (f30-1 300.0) (f28-1 2.0) (f26-0 3.0) @@ -1019,8 +1008,8 @@ The faster it's moving the fast it flaps it's wings, etc (func) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self far-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self far-time) (current-time)) (set-setting! 'sound-mode #f 0.0 1) (none) ) @@ -1045,24 +1034,22 @@ The faster it's moving the fast it flaps it's wings, etc (not (logtest? (focus-status teleporting) (-> *target* focus-status))) ) ) - (set! (-> self state-time) - (the-as time-frame (max (+ (-> self clock frame-counter) (seconds -10)) (-> self state-time))) - ) + (set! (-> self state-time) (the-as time-frame (max (+ (current-time) (seconds -10)) (-> self state-time)))) ) (else - (+! (-> self state-time) (* 10 (- (-> self clock frame-counter) (-> self far-time)))) - (if (>= (-> self state-time) (-> self clock frame-counter)) + (+! (-> self state-time) (* 10 (- (current-time) (-> self far-time)))) + (if (>= (-> self state-time) (current-time)) (go-virtual flee) ) ) ) - (set! (-> self far-time) (-> self clock frame-counter)) + (set! (-> self far-time) (current-time)) (none) ) :code (behavior () (until #f (set! (-> self y-offset-desired) 0.0) - (pegasus-fly-code (the-as int (- (-> self clock frame-counter) (-> self state-time)))) + (pegasus-fly-code (the-as int (- (current-time) (-> self state-time)))) (suspend) ) #f @@ -1080,7 +1067,7 @@ The faster it's moving the fast it flaps it's wings, etc ) ) (set! (-> self near-timer) 3000) - (set! (-> self far-time) (-> self clock frame-counter)) + (set! (-> self far-time) (current-time)) (set-setting! 'sound-mode #f 0.0 1) (none) ) @@ -1107,16 +1094,15 @@ The faster it's moving the fast it flaps it's wings, etc (not (logtest? (focus-status teleporting) (-> *target* focus-status))) ) ) - (set! (-> self near-timer) (- (the-as time-frame (-> self near-timer)) - (- (-> self clock frame-counter) (-> self clock old-frame-counter)) - ) + (set! (-> self near-timer) + (- (the-as time-frame (-> self near-timer)) (- (current-time) (-> self clock old-frame-counter))) ) (if (<= (-> self near-timer) 0) (go pegasus-tired) ) - (set! (-> self far-time) (-> self clock frame-counter)) + (set! (-> self far-time) (current-time)) ) - (if (>= (- (-> self clock frame-counter) (-> self far-time)) (seconds 3)) + (if (>= (- (current-time) (-> self far-time)) (seconds 3)) (set! (-> self near-timer) (the-as int (-> self timeout))) ) (none) @@ -1252,7 +1238,6 @@ The faster it's moving the fast it flaps it's wings, etc (defmethod init-enemy-collision! pegasus ((obj pegasus)) "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" - (stack-size-set! (-> obj main-thread) 512) ;; added (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) (set! (-> cshape reaction) cshape-reaction-default) @@ -1441,7 +1426,7 @@ The faster it's moving the fast it flaps it's wings, etc (lambda :behavior task-manager () (local-vars (data int)) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-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)) diff --git a/goal_src/jak2/levels/forest/predator.gc b/goal_src/jak2/levels/forest/predator.gc index bb385c4907..ed24ce7053 100644 --- a/goal_src/jak2/levels/forest/predator.gc +++ b/goal_src/jak2/levels/forest/predator.gc @@ -412,23 +412,21 @@ (defmethod general-event-handler predator ((obj predator) (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" - (with-pp - (case arg2 - (('attack) - (set! (-> obj shock-effect-end) (the-as uint (+ (-> pp clock frame-counter) (seconds 1)))) - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + (case arg2 + (('attack) + (set! (-> obj shock-effect-end) (the-as uint (+ (current-time) (seconds 1)))) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (('death-end) + (when (nonzero? (-> obj ambient-sound-id)) + (sound-stop (-> obj ambient-sound-id)) + (set! (-> obj ambient-sound-id) (new 'static 'sound-id)) + 0 ) - (('death-end) - (when (nonzero? (-> obj ambient-sound-id)) - (sound-stop (-> obj ambient-sound-id)) - (set! (-> obj ambient-sound-id) (new 'static 'sound-id)) - 0 - ) - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -852,9 +850,9 @@ (if (< 245760.0 (vector-vector-distance (-> obj root-override2 trans) (camera-pos))) (setup-masks (-> obj draw) 0 8) ) - (when (< (-> pp clock frame-counter) (the-as time-frame (-> obj shock-effect-end))) - (when (>= (- (-> pp clock frame-counter) (-> obj shock-effect-time)) (seconds 0.04)) - (set! (-> obj shock-effect-time) (-> pp clock frame-counter)) + (when (< (current-time) (the-as time-frame (-> obj shock-effect-end))) + (when (>= (- (current-time) (-> obj shock-effect-time)) (seconds 0.04)) + (set! (-> obj shock-effect-time) (current-time)) (process-drawable-shock-skel-effect obj (-> *lightning-spec-id-table* 18) @@ -1063,14 +1061,14 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior predator) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) ) 0 (set! (-> self next-change) - (the-as uint (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 2.0 5.0))))) + (the-as uint (+ (current-time) (the int (* 300.0 (rand-vu-float-range 2.0 5.0))))) ) (none) ) @@ -1096,7 +1094,7 @@ ) ) ) - (if (< (the-as time-frame (-> self next-change)) (-> self clock frame-counter)) + (if (< (the-as time-frame (-> self next-change)) (current-time)) (go-virtual hide) ) (none) @@ -1139,7 +1137,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior predator) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-166 self) (let ((v1-4 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-4 enemy-flags))) @@ -1165,7 +1163,7 @@ ) (go-virtual hostile) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (check-los? (-> self los) 0) (not (logtest? (-> self draw status) (draw-control-status on-screen))) ) @@ -1182,7 +1180,7 @@ (set! (-> a0-12 target-post quad) (-> v1-30 quad)) ) 0 - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (logtest? (-> self nav state flags) (nav-state-flag at-target)) ) (go-virtual hidden) @@ -1219,9 +1217,9 @@ ) ) (set! (-> self want-stop) #f) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self next-change) - (the-as uint (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 4.0 8.0))))) + (the-as uint (+ (current-time) (the int (* 300.0 (rand-vu-float-range 4.0 8.0))))) ) (if (zero? (get-rand-int self 3)) (sound-play "pred-talk") @@ -1234,7 +1232,7 @@ (t9-0) ) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 5)) (go-virtual hide) ) (let ((gp-0 (handle->process (-> self focus handle)))) @@ -1242,7 +1240,7 @@ (go-virtual active) ) (when (get-enemy-target self) - (when (and gp-0 (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time))) + (when (and gp-0 (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (let ((f0-0 (vector-vector-xz-distance (get-trans (the-as process-focusable gp-0) 0) (-> self root-override2 trans)) ) diff --git a/goal_src/jak2/levels/forest/wren.gc b/goal_src/jak2/levels/forest/wren.gc index 19c6534341..71fe15e464 100644 --- a/goal_src/jak2/levels/forest/wren.gc +++ b/goal_src/jak2/levels/forest/wren.gc @@ -187,13 +187,13 @@ If so, it transitions from [[wren::peck]] to [[wren::hunt]]" (defstate peck (wren) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self peck-timer) (the-as uint (the int (* 300.0 (rand-vu-float-range 1.4 4.3))))) (set! (-> self flags) (logand -7 (-> self flags))) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self peck-timer))) + (when (>= (- (current-time) (-> self state-time)) (the-as time-frame (-> self peck-timer))) (let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-dest) (-> self root trans)))) (if (< (fabs (deg-diff (quaternion-y-angle (-> self root quat)) (vector-y-angle gp-1))) 728.1778) (go-virtual hunt) @@ -235,23 +235,23 @@ If so, it transitions from [[wren::peck]] to [[wren::hunt]]" (set! v1-33 v1-33) (cmove-#f-zero v1-34 v1-33 v1-33) ) - (let ((gp-1 (-> self clock frame-counter)) + (let ((gp-1 (current-time)) (s5-1 (the int (* 300.0 (rand-vu-float-range 0.1 0.6)))) (f30-1 1.0) ) (ja-no-eval :group! wren-idle-ja :num! (loop! f30-1) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-1) s5-1) + (until (>= (- (current-time) gp-1) s5-1) (suspend) (ja :num! (loop! f30-1)) ) ) (logior! (-> self flags) 1) - (let ((gp-2 (-> self clock frame-counter)) + (let ((gp-2 (current-time)) (s5-2 (the int (* 300.0 (rand-vu-float-range 0.2 1.5)))) (f30-3 1.0) ) (ja-no-eval :group! wren-idle-ja :num! (loop! f30-3) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-2) s5-2) + (until (>= (- (current-time) gp-2) s5-2) (suspend) (ja :num! (loop! f30-3)) ) @@ -291,12 +291,12 @@ If so, it transitions from [[wren::peck]] to [[wren::hunt]]" (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter)) + (let ((gp-0 (current-time)) (s5-0 240) (f30-0 2.0) ) (ja-no-eval :group! wren-takeoff-ja :num! (loop! f30-0) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-0) s5-0) + (until (>= (- (current-time) gp-0) s5-0) (suspend) (ja :num! (loop! f30-0)) ) @@ -391,7 +391,7 @@ If so, it transitions from [[wren::peck]] to [[wren::hunt]]" :trans (behavior () (let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-dest) (-> self root trans)))) (when (< (fabs (deg-diff (quaternion-y-angle (-> self root quat)) (vector-y-angle gp-1))) 728.1778) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self peck-timer))) + (when (>= (- (current-time) (-> self state-time)) (the-as time-frame (-> self peck-timer))) (set! (-> self fly-index) (logand (+ (-> self fly-index) 1) 1)) (go-virtual fly) ) @@ -402,23 +402,23 @@ If so, it transitions from [[wren::peck]] to [[wren::hunt]]" :code (behavior () (set! (-> self flags) (logand -2 (-> self flags))) (ja-channel-push! 1 (seconds 0.2)) - (let ((gp-0 (-> self clock frame-counter)) + (let ((gp-0 (current-time)) (s5-0 (the int (* 300.0 (rand-vu-float-range 4.2 16.8)))) (f30-1 1.0) ) (ja-no-eval :group! wren-idle-ja :num! (loop! f30-1) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-0) s5-0) + (until (>= (- (current-time) gp-0) s5-0) (suspend) (ja :num! (loop! f30-1)) ) ) (logior! (-> self flags) 1) - (let ((gp-1 (-> self clock frame-counter)) + (let ((gp-1 (current-time)) (s5-1 600) (f30-2 1.0) ) (ja-no-eval :group! wren-idle-ja :num! (loop! f30-2) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-1) s5-1) + (until (>= (- (current-time) gp-1) s5-1) (suspend) (ja :num! (loop! f30-2)) ) diff --git a/goal_src/jak2/levels/fortress/ammo_dump/fordumpa-obs.gc b/goal_src/jak2/levels/fortress/ammo_dump/fordumpa-obs.gc index b5b57f0e5d..385360ce49 100644 --- a/goal_src/jak2/levels/fortress/ammo_dump/fordumpa-obs.gc +++ b/goal_src/jak2/levels/fortress/ammo_dump/fordumpa-obs.gc @@ -52,16 +52,16 @@ :virtual #t :event (-> (method-of-type fort-elec-switch idle) event) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 16)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 16)) (suspend) ) ) (until (logtest? (-> self draw status) (draw-control-status on-screen)) (suspend) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.4)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.4)) (suspend) ) ) @@ -143,8 +143,8 @@ ) ) (sound-play "elec-switch") - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 0.5)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 0.5)) (suspend) ) ) @@ -179,8 +179,8 @@ ) ) ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.75)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 0.75)) (suspend) ) ) @@ -199,8 +199,8 @@ ) ) ) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 1.5)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 1.5)) (suspend) ) ) @@ -245,7 +245,7 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (stack-size-set! (-> obj main-thread) 512) + (stack-size-set! (-> obj main-thread) 512) ;; added (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape obj (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)))) diff --git a/goal_src/jak2/levels/fortress/ammo_dump/fordumpb-obs.gc b/goal_src/jak2/levels/fortress/ammo_dump/fordumpb-obs.gc index 1be5ef87ed..3e475c0218 100644 --- a/goal_src/jak2/levels/fortress/ammo_dump/fordumpb-obs.gc +++ b/goal_src/jak2/levels/fortress/ammo_dump/fordumpb-obs.gc @@ -289,7 +289,7 @@ This commonly includes things such as: (none) ) :trans (behavior () - (when (>= (-> self clock frame-counter) (-> self next-spawn-time)) + (when (>= (current-time) (-> self next-spawn-time)) (process-spawn fort-plat-shuttle-plat 0 :to self) (set! (-> self next-spawn-time) (get-timeframe-offset! (-> self sync) 0)) ) @@ -299,24 +299,22 @@ This commonly includes things such as: ) (defmethod fort-plat-shuttle-method-22 fort-plat-shuttle ((obj fort-plat-shuttle)) - (with-pp - (let* ((f28-0 (total-distance (-> obj path))) - (s5-0 (-> obj sync)) - (f26-0 81.92) - (a0-3 (- (-> pp clock frame-counter) (get-timeframe-offset! s5-0 0))) - (v1-6 (-> s5-0 period)) - (f30-0 (/ (* f26-0 (the float a0-3)) f28-0)) - (f28-1 (/ (* f26-0 (the float v1-6)) f28-0)) - ) - (while (>= 1.0 f30-0) - (if (>= f30-0 0.0) - (process-spawn fort-plat-shuttle-plat f30-0 :to obj) - ) - (+! f30-0 f28-1) - ) + (let* ((f28-0 (total-distance (-> obj path))) + (s5-0 (-> obj sync)) + (f26-0 81.92) + (a0-3 (- (current-time) (get-timeframe-offset! s5-0 0))) + (v1-6 (-> s5-0 period)) + (f30-0 (/ (* f26-0 (the float a0-3)) f28-0)) + (f28-1 (/ (* f26-0 (the float v1-6)) f28-0)) + ) + (while (>= 1.0 f30-0) + (if (>= f30-0 0.0) + (process-spawn fort-plat-shuttle-plat f30-0 :to obj) + ) + (+! f30-0 f28-1) ) - #f ) + #f ) ;; WARN: Return type mismatch object vs none. diff --git a/goal_src/jak2/levels/fortress/ammo_dump/fordumpc-obs.gc b/goal_src/jak2/levels/fortress/ammo_dump/fordumpc-obs.gc index b624070bb1..544bf10f47 100644 --- a/goal_src/jak2/levels/fortress/ammo_dump/fordumpc-obs.gc +++ b/goal_src/jak2/levels/fortress/ammo_dump/fordumpc-obs.gc @@ -139,8 +139,8 @@ ) ) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 0.5)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 0.5)) (suspend) ) ) @@ -366,8 +366,8 @@ This commonly includes things such as: (-> gp-2 ppointer) ) ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 1)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 1)) (suspend) ) ) @@ -540,8 +540,8 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 8)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 8)) (suspend) ) ) @@ -549,15 +549,15 @@ This commonly includes things such as: (suspend) ) (when (= (-> self bomb-count) 4) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.4)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.4)) (suspend) ) ) (add-process *gui-control* self (gui-channel daxter) (gui-action play) "ds017" -99.0 0) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 20)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 20)) (suspend) ) ) @@ -565,14 +565,14 @@ This commonly includes things such as: (add-process *gui-control* self (gui-channel daxter) (gui-action play) "ds018" -99.0 0) ) (while (> (-> self bomb-count) 0) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.2)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 0.2)) (suspend) ) ) ) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 0.8)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 0.8)) (suspend) ) ) @@ -621,8 +621,8 @@ This commonly includes things such as: ) ) (set-fordumpc-light-flag! #t) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.2)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.2)) (suspend) ) ) @@ -632,8 +632,8 @@ This commonly includes things such as: (set-setting! 'entity-name "camera-182" 0.0 0) (set-setting! 'process-mask 'set 0.0 (process-mask movie enemy)) (task-node-close! (game-task-node fortress-dump-missile)) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.75)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.75)) (suspend) ) ) @@ -667,8 +667,8 @@ This commonly includes things such as: ) ) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 1.5)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 1.5)) (suspend) ) ) @@ -694,8 +694,8 @@ This commonly includes things such as: (set! (-> *game-info* timer) 0) (set! (-> self hud) (ppointer->handle (process-spawn hud-timer :init hud-init-by-other :to *target*))) ) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 0.4)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 0.4)) (suspend) ) ) @@ -704,8 +704,8 @@ This commonly includes things such as: ) (dotimes (gp-5 10) (set! (-> *game-info* timer) (the-as time-frame (- 3000 (the int (* 300.0 (the float gp-5)))))) - (let ((s5-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-0) (seconds 1)) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) (seconds 1)) (suspend) ) ) @@ -759,8 +759,8 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.4)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.4)) (suspend) ) ) @@ -931,13 +931,13 @@ This commonly includes things such as: (set! (-> s5-3 trans w) 1.0) (spawn-with-matrix (-> self part-doom) s5-3) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.2)) (suspend) ) ) - (let ((gp-5 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-5) (seconds 10)) + (let ((gp-5 (current-time))) + (until (>= (- (current-time) gp-5) (seconds 10)) (suspend) ) ) diff --git a/goal_src/jak2/levels/fortress/ammo_dump/fort-robotank-turret.gc b/goal_src/jak2/levels/fortress/ammo_dump/fort-robotank-turret.gc index 22c1c4cac2..4658dd4f5a 100644 --- a/goal_src/jak2/levels/fortress/ammo_dump/fort-robotank-turret.gc +++ b/goal_src/jak2/levels/fortress/ammo_dump/fort-robotank-turret.gc @@ -103,7 +103,7 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('trigger) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (go-virtual active) ) (('die) @@ -180,7 +180,7 @@ ) :code (behavior () (until #f - (when (and (not (paused?)) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1))) + (when (and (not (paused?)) (>= (- (current-time) (-> self state-time)) (seconds 1))) (seek! (-> self anim-frame) 0.0 (* 0.2 (-> self clock time-adjust-ratio))) (seek! (-> self transition) 1.0 (* 0.01 (-> self clock time-adjust-ratio))) ) @@ -234,8 +234,8 @@ (defstate die (fort-roboscreen) :virtual #t :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (seek! (-> self transition) 0.0 (-> self clock seconds-per-frame)) (set-roboscreen-alpha! (-> self transition)) (suspend) @@ -505,7 +505,7 @@ (none) ) :post (behavior () - (when (< (-> self ring-timer) (-> self clock frame-counter)) + (when (< (-> self ring-timer) (current-time)) (let ((v1-2 (rand-vu-int-range 0 7))) (dotimes (a0-3 3) (if (logand (ash 1 a0-3) v1-2) @@ -513,9 +513,7 @@ ) ) ) - (set! (-> self ring-timer) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.6 1.8)))) - ) + (set! (-> self ring-timer) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.6 1.8))))) ) (fort-robotank-reticle-post) (none) @@ -1128,19 +1126,19 @@ :virtual #t :event robotank-turret-handler :enter (behavior () - (set! (-> self gun-timer) (-> self clock frame-counter)) + (set! (-> self gun-timer) (current-time)) (none) ) :trans (behavior () (if (logtest? (-> self flags) 16) - (set! (-> self gun-timer) (-> self clock frame-counter)) + (set! (-> self gun-timer) (current-time)) ) (let ((gp-0 *target*)) (if (and (if (type? gp-0 process-focusable) gp-0 ) (or (not (logtest? (-> self flags) 512)) (check-los? (-> self los) 0)) - (>= (- (-> self clock frame-counter) (-> self gun-timer)) (seconds 1)) + (>= (- (current-time) (-> self gun-timer)) (seconds 1)) ) (go-virtual fire) ) @@ -1206,8 +1204,8 @@ (logior! (-> self flags) 8) (set! (-> self firing-sight-pos quad) (-> self sight-pos quad)) (send-event (handle->process (-> self reticle)) 'lock) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.5)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.5)) (suspend) ) ) @@ -1245,9 +1243,9 @@ ) ) (let ((f30-0 (rand-vu-float-range 0.05 0.43)) - (s4-2 (-> self clock frame-counter)) + (s4-2 (current-time)) ) - (until (>= (- (-> self clock frame-counter) s4-2) (the int (* 300.0 f30-0))) + (until (>= (- (current-time) s4-2) (the int (* 300.0 f30-0))) (suspend) ) ) @@ -1267,9 +1265,9 @@ 2.11 ) ) - (gp-3 (-> self clock frame-counter)) + (gp-3 (current-time)) ) - (until (>= (- (-> self clock frame-counter) gp-3) (the int (* 300.0 f30-1))) + (until (>= (- (current-time) gp-3) (the int (* 300.0 f30-1))) (suspend) ) ) @@ -1285,8 +1283,8 @@ :code (behavior () (send-event (handle->process (-> self reticle)) 'die) (send-event (handle->process (-> self screen)) 'die) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -1393,7 +1391,7 @@ (set! (-> self aim-pos 0 quad) (-> self root-override trans quad)) (set! (-> self aim-pos-2 quad) (-> self root-override trans quad)) (set! (-> self aim-pos-1 quad) (-> self root-override trans quad)) - (set! (-> self gun-timer) (-> self clock frame-counter)) + (set! (-> self gun-timer) (current-time)) (set! (-> self flags) (the-as uint 0)) (set! (-> self fov-mult) 1.0) (set! (-> self shot-range) 204800.0) diff --git a/goal_src/jak2/levels/fortress/ammo_dump/fort-robotank.gc b/goal_src/jak2/levels/fortress/ammo_dump/fort-robotank.gc index ce31f8d273..47f144c221 100644 --- a/goal_src/jak2/levels/fortress/ammo_dump/fort-robotank.gc +++ b/goal_src/jak2/levels/fortress/ammo_dump/fort-robotank.gc @@ -290,7 +290,7 @@ (defbehavior fort-robotank-post fort-robotank () (when (and (nonzero? (-> self no-collision-timer)) - (>= (- (-> self clock frame-counter) (-> self no-collision-timer)) + (>= (- (current-time) (-> self no-collision-timer)) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout)) ) ) @@ -362,11 +362,11 @@ ) (let* ((f0-35 30.0) (f1-7 65536.0) - (f2-1 (the float (-> self clock frame-counter))) + (f2-1 (the float (current-time))) (f0-36 (/ (* f1-7 (- f2-1 (* (the float (the int (/ f2-1 f0-35))) f0-35))) f0-35)) (f28-1 (sin f0-36)) (f30-2 (* 300.0 (/ 1.0 (-> self engine-vibe-rate)))) - (f0-39 (the float (-> self clock frame-counter))) + (f0-39 (the float (current-time))) (f24-0 (/ (- f0-39 (* (the float (the int (/ f0-39 f30-2))) f30-2)) f30-2)) (f28-2 (* f28-1 (sin (* 65536.0 f24-0)))) ) @@ -375,7 +375,7 @@ (f26-0 0.0) ) (when (and (or (< f0-44 f24-0) (< f24-0 f1-16)) - (>= (- (-> self clock frame-counter) (-> self buzz-timer)) (the int (* 0.5 f30-2))) + (>= (- (current-time) (-> self buzz-timer)) (the int (* 0.5 f30-2))) ) (let* ((gp-2 *target*) (a0-43 (if (type? gp-2 process-focusable) @@ -401,7 +401,7 @@ (the int (* 255.0 (* 0.49 f26-0))) (the-as time-frame (max 45 (the int (* 0.25 f30-2)))) ) - (set! (-> self buzz-timer) (-> self clock frame-counter)) + (set! (-> self buzz-timer) (current-time)) ) ) (quaternion-axis-angle! @@ -536,7 +536,7 @@ (set! (-> a1-19 param 1) (the-as uint v1-40)) ) (the-as object (when (send-event-function s5-0 a1-19) - (set! (-> self no-collision-timer) (-> self clock frame-counter)) + (set! (-> self no-collision-timer) (current-time)) (let ((v1-45 (-> self root-override root-prim))) (set! (-> v1-45 prim-core collide-as) (collide-spec)) (set! (-> v1-45 prim-core collide-with) (collide-spec)) @@ -804,8 +804,8 @@ ) :code (behavior () (set! (-> self flags) (logand -5 (-> self flags))) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.1)) (suspend) ) ) @@ -943,8 +943,8 @@ (remove-setting! 'process-mask) (remove-setting! 'target-height) (send-event (handle->process (-> self turret)) 'die) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 2)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 2)) (suspend) ) ) diff --git a/goal_src/jak2/levels/fortress/exit/forexita-obs.gc b/goal_src/jak2/levels/fortress/exit/forexita-obs.gc index 462ab70c15..40874214f5 100644 --- a/goal_src/jak2/levels/fortress/exit/forexita-obs.gc +++ b/goal_src/jak2/levels/fortress/exit/forexita-obs.gc @@ -68,7 +68,7 @@ (none) ) :post (behavior () - (when (< (-> self sound-time) (-> self clock frame-counter)) + (when (< (-> self sound-time) (current-time)) (sound-stop (-> self sound-id)) (set! (-> self sound-time) (get-timeframe-offset! (-> self sync) 0)) ) @@ -105,7 +105,7 @@ ) :code (the-as (function none :behavior fort-lift-plat) sleep-code) :post (behavior () - (when (< (-> self sound-time) (-> self clock frame-counter)) + (when (< (-> self sound-time) (current-time)) (sound-stop (-> self sound-id)) (set! (-> self sound-time) (get-timeframe-offset! (-> self sync) 0)) ) @@ -282,11 +282,11 @@ otherwise, [[plat::34]] (defstate pause (fort-claw) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2)) (go-virtual idle) ) (none) @@ -332,8 +332,8 @@ This commonly includes things such as: () (until #f (sound-play "fortress-alarm") - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) diff --git a/goal_src/jak2/levels/fortress/fort-turret.gc b/goal_src/jak2/levels/fortress/fort-turret.gc index caa945f6df..599a659798 100644 --- a/goal_src/jak2/levels/fortress/fort-turret.gc +++ b/goal_src/jak2/levels/fortress/fort-turret.gc @@ -619,66 +619,64 @@ ) (defmethod fort-turret-method-141 fort-turret ((obj fort-turret)) - (with-pp - (let* ((s5-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data 12))) - (v1-3 - (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> obj node-list data 12 bone transform vector 2) 1.0) - ) - (s4-1 (vector-float*! (new 'stack-no-clear 'vector) v1-3 163840.0)) + (let* ((s5-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data 12))) + (v1-3 + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> obj node-list data 12 bone transform vector 2) 1.0) ) - (let ((s3-0 (new 'stack-no-clear 'collide-query))) - (set! (-> s3-0 start-pos quad) (-> s5-0 quad)) - (set! (-> s3-0 move-dist quad) (-> s4-1 quad)) - (let ((v1-6 s3-0)) - (set! (-> v1-6 radius) 409.6) - (set! (-> v1-6 collide-with) - (collide-spec backgnd jak crate obstacle hit-by-player-list hit-by-others-list player-list pusher) - ) - (set! (-> v1-6 ignore-process0) obj) - (set! (-> v1-6 ignore-process1) #f) - (set! (-> v1-6 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-6 action-mask) (collide-action solid)) - ) - (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* s3-0))) - (cond - ((>= f30-0 0.0) - (set! (-> obj beam-intersect) (the-as basic 'wall)) - (when (-> s3-0 best-other-tri collide-ptr) - (let* ((s3-1 (-> s3-0 best-other-tri collide-ptr)) - (a0-14 (if (type? s3-1 collide-shape-prim) - (the-as collide-shape-prim s3-1) - ) - ) - ) - (when a0-14 - (when (= (-> a0-14 cshape process type) target) - (set! (-> obj target-timeout) (the-as uint (-> pp clock frame-counter))) - (set! (-> obj beam-intersect) (the-as basic 'target)) - ) + (s4-1 (vector-float*! (new 'stack-no-clear 'vector) v1-3 163840.0)) + ) + (let ((s3-0 (new 'stack-no-clear 'collide-query))) + (set! (-> s3-0 start-pos quad) (-> s5-0 quad)) + (set! (-> s3-0 move-dist quad) (-> s4-1 quad)) + (let ((v1-6 s3-0)) + (set! (-> v1-6 radius) 409.6) + (set! (-> v1-6 collide-with) + (collide-spec backgnd jak crate obstacle hit-by-player-list hit-by-others-list player-list pusher) + ) + (set! (-> v1-6 ignore-process0) obj) + (set! (-> v1-6 ignore-process1) #f) + (set! (-> v1-6 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-6 action-mask) (collide-action solid)) + ) + (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* s3-0))) + (cond + ((>= f30-0 0.0) + (set! (-> obj beam-intersect) (the-as basic 'wall)) + (when (-> s3-0 best-other-tri collide-ptr) + (let* ((s3-1 (-> s3-0 best-other-tri collide-ptr)) + (a0-14 (if (type? s3-1 collide-shape-prim) + (the-as collide-shape-prim s3-1) + ) + ) + ) + (when a0-14 + (when (= (-> a0-14 cshape process type) target) + (set! (-> obj target-timeout) (the-as uint (current-time))) + (set! (-> obj beam-intersect) (the-as basic 'target)) ) ) ) - (vector-float*! s4-1 s4-1 f30-0) - (let ((s3-3 (vector+! (new 'stack-no-clear 'vector) s5-0 s4-1)) - (a0-21 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data 10))) - (v1-23 (-> obj gun-shadow-jm twist-max)) - ) - (set! (-> v1-23 z) - (+ 2.0 (* 0.00024414062 (vector-length (vector-! (new 'stack-no-clear 'vector) s3-3 a0-21)))) - ) - (if (= (-> obj beam-intersect) 'wall) - (set! (-> v1-23 z) (+ -5.0 (-> v1-23 z))) - ) - ) ) - (else - (set! (-> obj beam-intersect) (the-as basic 'nothing)) - ) + (vector-float*! s4-1 s4-1 f30-0) + (let ((s3-3 (vector+! (new 'stack-no-clear 'vector) s5-0 s4-1)) + (a0-21 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data 10))) + (v1-23 (-> obj gun-shadow-jm twist-max)) + ) + (set! (-> v1-23 z) + (+ 2.0 (* 0.00024414062 (vector-length (vector-! (new 'stack-no-clear 'vector) s3-3 a0-21)))) + ) + (if (= (-> obj beam-intersect) 'wall) + (set! (-> v1-23 z) (+ -5.0 (-> v1-23 z))) + ) + ) + ) + (else + (set! (-> obj beam-intersect) (the-as basic 'nothing)) ) ) ) - (vector+! (-> obj target-bullseye) s5-0 s4-1) ) + (vector+! (-> obj target-bullseye) s5-0 s4-1) ) ) @@ -737,15 +735,15 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) ) (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) (fort-turret-method-141 self) - (if (or (>= (- (-> self clock frame-counter) (the-as int (-> self target-timeout))) (seconds 0.5)) - (< (- (-> self clock frame-counter) (-> self last-hit-time)) (seconds 2)) + (if (or (>= (- (current-time) (the-as int (-> self target-timeout))) (seconds 0.5)) + (< (- (current-time) (-> self last-hit-time)) (seconds 2)) ) (go-virtual hostile) ) @@ -762,8 +760,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.5)) (suspend) ) ) @@ -786,8 +784,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((s4-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-1) (seconds 0.33)) + (let ((s4-1 (current-time))) + (until (>= (- (current-time) s4-1) (seconds 0.33)) (suspend) ) ) @@ -798,8 +796,8 @@ ) ) (set! (-> self flash-state) #f) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 1.5)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 1.5)) (suspend) ) ) @@ -821,14 +819,14 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior fort-turret) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) @@ -837,8 +835,8 @@ (set! (-> self desired-twist) (* 8192.0 (cos (get-scaled-val! (-> self sync) 32768.0 0)))) (fort-turret-method-140 self 0.1 91.022224) (fort-turret-method-141 self) - (if (and (< (- (-> self clock frame-counter) (the-as int (-> self target-timeout))) (seconds 0.5)) - (>= (- (-> self clock frame-counter) (-> self last-hit-time)) (seconds 2)) + (if (and (< (- (current-time) (the-as int (-> self target-timeout))) (seconds 0.5)) + (>= (- (current-time) (-> self last-hit-time)) (seconds 2)) ) (go-virtual attack) ) @@ -869,15 +867,15 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) ) (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) (fort-turret-method-141 self) - (if (and (< (- (-> self clock frame-counter) (the-as int (-> self target-timeout))) (seconds 0.5)) - (>= (- (-> self clock frame-counter) (-> self last-hit-time)) (seconds 2)) + (if (and (< (- (current-time) (the-as int (-> self target-timeout))) (seconds 0.5)) + (>= (- (current-time) (-> self last-hit-time)) (seconds 2)) ) (go-virtual attack) ) @@ -897,37 +895,35 @@ (defmethod general-event-handler fort-turret ((obj fort-turret) (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" - (with-pp - (if (and (= arg2 'notify) (< 1 arg1) (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) - (set! (-> obj last-hit-time) (-> pp clock frame-counter)) + (if (and (= arg2 'notify) (< 1 arg1) (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) + (set! (-> obj last-hit-time) (current-time)) + ) + (case arg2 + (('start) + (let ((v0-0 (the-as object #t))) + (set! (-> obj can-shoot) (the-as symbol v0-0)) + v0-0 + ) + ) + (('stop) + (set! (-> obj can-shoot) #f) + #f + ) + (('attack) + (cond + ((= (-> arg0 type) target) + #f ) - (case arg2 - (('start) - (let ((v0-0 (the-as object #t))) - (set! (-> obj can-shoot) (the-as symbol v0-0)) - v0-0 + ((-> obj invincible) + #f + ) + (else + ((method-of-type enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) - (('stop) - (set! (-> obj can-shoot) #f) - #f - ) - (('attack) - (cond - ((= (-> arg0 type) target) - #f - ) - ((-> obj invincible) - #f - ) - (else - ((method-of-type enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - ) - ) - (else - ((method-of-type enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) + ) + (else + ((method-of-type enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -961,15 +957,15 @@ (suspend) (ja-channel-set! 0) (let ((gp-2 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 4))) - (s5-2 (-> self clock frame-counter)) + (s5-2 (current-time)) ) - (until (>= (- (-> self clock frame-counter) s5-2) (seconds 2)) + (until (>= (- (current-time) s5-2) (seconds 2)) (spawn (-> self part) gp-2) (suspend) ) ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 1)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 1)) (suspend) ) ) diff --git a/goal_src/jak2/levels/fortress/fortress-obs.gc b/goal_src/jak2/levels/fortress/fortress-obs.gc index 57955ec748..109e112fe4 100644 --- a/goal_src/jak2/levels/fortress/fortress-obs.gc +++ b/goal_src/jak2/levels/fortress/fortress-obs.gc @@ -137,8 +137,8 @@ ) (suspend) (ja-channel-set! 0) - (let ((frame-counter (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 1)) + (let ((frame-counter (current-time))) + (until (>= (- (current-time) frame-counter) (seconds 1)) (suspend) ) ) diff --git a/goal_src/jak2/levels/fortress/prison/prison-obs.gc b/goal_src/jak2/levels/fortress/prison/prison-obs.gc index f5b0fb547b..5f0887add2 100644 --- a/goal_src/jak2/levels/fortress/prison/prison-obs.gc +++ b/goal_src/jak2/levels/fortress/prison/prison-obs.gc @@ -234,7 +234,7 @@ (defstate idle (prsn-hang-cell) :virtual #t :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let* ((f0-2 (* (/ 1.0 (-> self path-du)) (-> self path-u))) (f0-3 (- f0-2 (* (the float (the int (/ f0-2 1.0))) 1.0))) ) @@ -251,7 +251,7 @@ (seek! (-> self path-u) 1.0 (* (-> self path-du) (-> self clock seconds-per-frame))) (when (>= (-> self path-u) 1.0) (set! (-> self path-u) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (get-point-at-percent-along-path! (-> self path) (-> self root trans) (-> self path-u) 'interp) (ja-post) @@ -267,42 +267,40 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (with-pp - (set! (-> obj root) (new 'process 'trsqv)) - (process-drawable-from-entity! obj arg0) - (initialize-skeleton - obj - (the-as skeleton-group (art-group-get-by-name *level* "skel-prsn-hang-cell" (the-as (pointer uint32) #f))) - (the-as pair 0) - ) - (logclear! (-> obj mask) (process-mask actor-pause)) - (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (the-as entity #f) #f)) - (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) - (set! (-> obj path-du) 0.01) - (let ((f0-2 (* 300.0 (/ 1.0 (-> obj path-du)))) - (f1-3 (the float (-> pp clock frame-counter))) - ) - (set! (-> obj path-u) (/ (- f1-3 (* (the float (the int (/ f1-3 f0-2))) f0-2)) f0-2)) - ) - (let* ((f30-0 (-> obj path-u)) - (f28-0 8.0) - (f26-0 (/ 1.0 f28-0)) - ) - (dotimes (s5-2 (+ (the int f28-0) -1)) - (+! f30-0 f26-0) - (process-spawn - prsn-hang-cell - (if (>= f30-0 1.0) - (+ -1.0 f30-0) - f30-0 - ) - :to obj - ) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-prsn-hang-cell" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (logclear! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (the-as entity #f) #f)) + (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) + (set! (-> obj path-du) 0.01) + (let ((f0-2 (* 300.0 (/ 1.0 (-> obj path-du)))) + (f1-3 (the float (current-time))) + ) + (set! (-> obj path-u) (/ (- f1-3 (* (the float (the int (/ f1-3 f0-2))) f0-2)) f0-2)) + ) + (let* ((f30-0 (-> obj path-u)) + (f28-0 8.0) + (f26-0 (/ 1.0 f28-0)) + ) + (dotimes (s5-2 (+ (the int f28-0) -1)) + (+! f30-0 f26-0) + (process-spawn + prsn-hang-cell + (if (>= f30-0 1.0) + (+ -1.0 f30-0) + f30-0 + ) + :to obj ) ) - (go (method-of-object obj idle)) - (none) ) + (go (method-of-object obj idle)) + (none) ) ;; WARN: Return type mismatch object vs none. diff --git a/goal_src/jak2/levels/fortress/rescue/forresca-obs.gc b/goal_src/jak2/levels/fortress/rescue/forresca-obs.gc index 2d6d9e4c18..c8d3ee6db6 100644 --- a/goal_src/jak2/levels/fortress/rescue/forresca-obs.gc +++ b/goal_src/jak2/levels/fortress/rescue/forresca-obs.gc @@ -232,8 +232,8 @@ This commonly includes things such as: (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) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.5)) (suspend) ) ) @@ -241,8 +241,8 @@ This commonly includes things such as: (set-setting! 'entity-name "camera-243" 0.0 0) (set-setting! 'process-mask 'set 0.0 (process-mask movie enemy)) (process-grab? *target* #f) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 2)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 2)) (suspend) ) ) @@ -341,8 +341,8 @@ This commonly includes things such as: ) :code (behavior () (until (-> self all-gone?) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.5)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.5)) (suspend) ) ) diff --git a/goal_src/jak2/levels/fortress/rescue/forrescb-obs.gc b/goal_src/jak2/levels/fortress/rescue/forrescb-obs.gc index 695ac21240..469ec864d1 100644 --- a/goal_src/jak2/levels/fortress/rescue/forrescb-obs.gc +++ b/goal_src/jak2/levels/fortress/rescue/forrescb-obs.gc @@ -490,7 +490,7 @@ This commonly includes things such as: ) :trans (behavior () (set-forrescb-electricity-scale! 1.0 0) - (when (>= (-> self clock frame-counter) (-> self next-spawn-time)) + (when (>= (current-time) (-> self next-spawn-time)) (process-spawn fort-elec-belt-inst (-> self init-quat) @@ -509,32 +509,30 @@ This commonly includes things such as: ;; WARN: Return type mismatch symbol vs none. (defmethod fort-elec-belt-method-15 fort-elec-belt ((obj fort-elec-belt)) - (with-pp - (let* ((f28-0 (total-distance (-> obj path))) - (s5-0 (-> obj sync)) - (f26-0 81.92) - (a0-3 (- (-> pp clock frame-counter) (get-timeframe-offset! s5-0 0))) - (v1-6 (-> s5-0 period)) - (f30-0 (/ (* f26-0 (the float a0-3)) f28-0)) - (f28-1 (/ (* f26-0 (the float v1-6)) f28-0)) - ) - (while (>= 1.0 f30-0) - (if (>= f30-0 0.0) - (process-spawn - fort-elec-belt-inst - (-> obj init-quat) - f30-0 - (-> obj path-du) - (-> obj l-spec) - (-> obj attack-id) - :to obj - ) + (let* ((f28-0 (total-distance (-> obj path))) + (s5-0 (-> obj sync)) + (f26-0 81.92) + (a0-3 (- (current-time) (get-timeframe-offset! s5-0 0))) + (v1-6 (-> s5-0 period)) + (f30-0 (/ (* f26-0 (the float a0-3)) f28-0)) + (f28-1 (/ (* f26-0 (the float v1-6)) f28-0)) + ) + (while (>= 1.0 f30-0) + (if (>= f30-0 0.0) + (process-spawn + fort-elec-belt-inst + (-> obj init-quat) + f30-0 + (-> obj path-du) + (-> obj l-spec) + (-> obj attack-id) + :to obj ) - (+! f30-0 f28-1) - ) + ) + (+! f30-0 f28-1) ) - (none) ) + (none) ) ;; WARN: Return type mismatch process vs fort-elec-belt. diff --git a/goal_src/jak2/levels/gungame/gun-dummy.gc b/goal_src/jak2/levels/gungame/gun-dummy.gc index 0599e9978c..f379f5d364 100644 --- a/goal_src/jak2/levels/gungame/gun-dummy.gc +++ b/goal_src/jak2/levels/gungame/gun-dummy.gc @@ -1962,7 +1962,7 @@ (set! (-> event-msg-block message) 'path) (set! (-> event-msg-block param 0) (-> obj path-num)) (let ((path (the-as path-control (send-event-function (handle->process (-> obj train-man)) event-msg-block))) - (f30-0 (* 0.0033333334 (the float (- (-> pp clock frame-counter) (-> obj state-time))))) + (f30-0 (* 0.0033333334 (the float (- (current-time) (-> obj state-time))))) ) (if (not path) (return #f) @@ -2000,7 +2000,7 @@ (when (>= f30-0 (-> curr-path-command 0 time)) (set! (-> obj current) (the-as (inline-array tpath-control-frame) (-> obj current 1))) (set! (-> obj first-time-command) #t) - (set! (-> obj state-time) (-> pp clock frame-counter)) + (set! (-> obj state-time) (current-time)) ) (return #t) ret @@ -2015,7 +2015,7 @@ (when (>= f30-0 (-> curr-path-command 0 time)) (set! (-> obj current) (the-as (inline-array tpath-control-frame) (-> obj current 1))) (set! (-> obj first-time-command) #t) - (set! (-> obj state-time) (-> pp clock frame-counter)) + (set! (-> obj state-time) (current-time)) ) (return #t) ret @@ -2050,7 +2050,7 @@ (set! (-> obj current) (the-as (inline-array tpath-control-frame) (-> obj current 1))) (set! (-> obj inout-percent) 1.0) (set! (-> obj first-time-command) #t) - (set! (-> obj state-time) (-> pp clock frame-counter)) + (set! (-> obj state-time) (current-time)) ) (return #t) ret @@ -2116,10 +2116,8 @@ ) (sound-play-by-spec s4-7 (-> obj move-sound) (-> obj root-override trans)) ) - (when (< (-> obj next-spark) (-> pp clock frame-counter)) - (set! (-> obj next-spark) - (the-as int (+ (-> pp clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.0 0.3))))) - ) + (when (< (-> obj next-spark) (current-time)) + (set! (-> obj next-spark) (the-as int (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.0 0.3)))))) (spawn (-> obj part) (-> obj root-override trans)) ) (set! (-> obj first-time-command) #f) @@ -2133,7 +2131,7 @@ (set! (-> obj current) (the-as (inline-array tpath-control-frame) (-> obj current 1))) (set! (-> obj path-pos) (* 0.007843138 (the float (-> curr-path-command 0 path-pos)))) (set! (-> obj first-time-command) #t) - (set! (-> obj state-time) (-> pp clock frame-counter)) + (set! (-> obj state-time) (current-time)) ) (return #t) ret @@ -2148,7 +2146,7 @@ ) (set! (-> obj current) (the-as (inline-array tpath-control-frame) (-> obj current 1))) (set! (-> obj first-time-command) #t) - (set! (-> obj state-time) (-> pp clock frame-counter)) + (set! (-> obj state-time) (current-time)) ) (return #t) ret @@ -2189,7 +2187,7 @@ object (case event-type (('combo) - (set! (-> self last-combo-time) (-> self clock frame-counter)) + (set! (-> self last-combo-time) (current-time)) #t ) (('track) @@ -2247,7 +2245,7 @@ ) (else (if (and (logtest? (process-mask projectile) (-> proc-draw mask)) - (< (- (-> self clock frame-counter) (-> self last-combo-time)) (seconds 1)) + (< (- (current-time) (-> self last-combo-time)) (seconds 1)) ) (send-event (ppointer->process (-> self parent)) 'combo) ) @@ -2267,7 +2265,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self inout-percent) 1.0) (set! (-> self y-offset) 0.0) (set! (-> self rot-y-offset) 0.0) diff --git a/goal_src/jak2/levels/gungame/gungame-obs.gc b/goal_src/jak2/levels/gungame/gungame-obs.gc index 9b1e2c5995..07a5af56fc 100644 --- a/goal_src/jak2/levels/gungame/gungame-obs.gc +++ b/goal_src/jak2/levels/gungame/gungame-obs.gc @@ -446,7 +446,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self start-time) (+ (current-time) (seconds 1))) ) (if (task-node-open? (game-task-node city-yellow-gun-training-introduction)) (go-virtual yellow-training-intro) @@ -496,7 +496,7 @@ This commonly includes things such as: ) ) (else - (when (< (-> self start-time) (-> self clock frame-counter)) + (when (< (-> self start-time) (current-time)) (set! (-> self course) *red-training-path-global-info*) (set! (-> self end-door) (the-as uint 1)) (training-manager-method-24 self) @@ -565,7 +565,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self start-time) (+ (current-time) (seconds 1))) ) ) ) @@ -617,7 +617,7 @@ This commonly includes things such as: ) ) (else - (when (< (-> self start-time) (-> self clock frame-counter)) + (when (< (-> self start-time) (current-time)) (set! (-> self end-door) (the-as uint 0)) (set! (-> self course) *yellow-training-path-global-info*) (training-manager-method-24 self) @@ -693,7 +693,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self start-time) (+ (current-time) (seconds 1))) ) ((let ((a1-6 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-6 from) (process->ppointer self)) @@ -735,7 +735,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self start-time) (+ (current-time) (seconds 1))) ) ) ) @@ -783,7 +783,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self start-time) (+ (current-time) (seconds 1))) ) ((and (logtest? (-> *game-info* secrets) (game-secrets gungame-dark)) (let ((a1-12 (new 'stack-no-clear 'event-message-block))) @@ -825,7 +825,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self start-time) (+ (current-time) (seconds 1))) ) ) ) @@ -903,7 +903,7 @@ This commonly includes things such as: (label cfg-30) (b! #t cfg-33 :delay (nop!)) (label cfg-31) - (if (< (-> self start-time) (-> self clock frame-counter)) + (if (< (-> self start-time) (current-time)) (go-virtual course) ) (label cfg-33) @@ -1130,7 +1130,7 @@ This commonly includes things such as: :enter (behavior () (set! (-> self hud-score) (ppointer->handle (process-spawn hud-big-score :init hud-init-by-other :to self))) (set! (-> self hud-goal) (ppointer->handle (process-spawn hud-goal :init hud-init-by-other :to self))) - (set! (-> self start-time) (+ (-> self clock frame-counter) (seconds 2))) + (set! (-> self start-time) (+ (current-time) (seconds 2))) (set! (-> self first-enemy-shown?) #f) (set! (-> self first-citizen-shown?) #f) (set! (-> self open-end?) #t) @@ -1426,7 +1426,7 @@ This commonly includes things such as: (training-manager-method-32 self) (training-manager-method-31 self) (when (-> self open-end?) - (let ((f30-0 (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> self start-time)))))) + (let ((f30-0 (* 0.0033333334 (the float (- (current-time) (-> self start-time)))))) (when (and (handle->process (-> self voicebox)) (or (and (task-node-closed? (game-task-node city-red-gun-training-try-once)) (< 1.0 f30-0)) (and (task-node-open? (game-task-node city-red-gun-training-try-once)) (< 15.0 f30-0)) @@ -1860,8 +1860,8 @@ This commonly includes things such as: t1-0 ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -2309,8 +2309,8 @@ This commonly includes things such as: ) :code (behavior () (sound-play "gungame-door") - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.2)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.2)) (suspend) (suspend) ) diff --git a/goal_src/jak2/levels/hiphog/whack.gc b/goal_src/jak2/levels/hiphog/whack.gc index d1736d9632..05629a9343 100644 --- a/goal_src/jak2/levels/hiphog/whack.gc +++ b/goal_src/jak2/levels/hiphog/whack.gc @@ -1615,8 +1615,8 @@ (ja :num! (seek!)) ) (ja-channel-push! 1 (seconds 0.05)) - (let ((s5-0 (-> self clock frame-counter))) - (while (and (< (- (-> self clock frame-counter) s5-0) arg0) (not (-> self abort?))) + (let ((s5-0 (current-time))) + (while (and (< (- (current-time) s5-0) arg0) (not (-> self abort?))) (ja :group! (-> self draw art-group data 4) :num! (loop!)) (suspend) ) @@ -1819,238 +1819,232 @@ ) (defmethod whack-a-metal-method-27 whack-a-metal ((obj whack-a-metal)) - (with-pp - (let ((s4-0 (-> *mole-data* (-> obj wave) (-> obj event))) - (s5-0 #t) - ) - (when (zero? (-> obj event-length)) - (set! (-> obj event-length) - (rand-vu-int-range (the-as int (-> s4-0 min-time)) (the-as int (+ (-> s4-0 min-time) (-> s4-0 max-time)))) - ) - (set! (-> obj event-time) (-> pp clock frame-counter)) + (let ((s4-0 (-> *mole-data* (-> obj wave) (-> obj event))) + (s5-0 #t) ) - (let ((v1-8 (-> s4-0 mode))) - (cond - ((= v1-8 8) - (set! s5-0 (>= (- (-> pp clock frame-counter) (-> obj event-time)) (-> obj event-length))) - ) - ((or (= v1-8 9) (= v1-8 10) (= v1-8 11)) - (let ((v1-13 (rand-vu-int-range 0 7))) - (let ((s3-0 0)) - (while (let ((a0-20 (-> obj mole v1-13))) - (and (-> (the-as hip-mole (if a0-20 - (the-as hip-mole (-> a0-20 0 self)) - ) - ) - next-state - ) - (let ((a0-26 (-> obj mole v1-13))) - (= (-> (the-as hip-mole (if a0-26 - (the-as hip-mole (-> a0-26 0 self)) - ) - ) - next-state - name - ) - 'active - ) + (when (zero? (-> obj event-length)) + (set! (-> obj event-length) + (rand-vu-int-range (the-as int (-> s4-0 min-time)) (the-as int (+ (-> s4-0 min-time) (-> s4-0 max-time)))) + ) + (set! (-> obj event-time) (current-time)) + ) + (let ((v1-8 (-> s4-0 mode))) + (cond + ((= v1-8 8) + (set! s5-0 (>= (- (current-time) (-> obj event-time)) (-> obj event-length))) + ) + ((or (= v1-8 9) (= v1-8 10) (= v1-8 11)) + (let ((v1-13 (rand-vu-int-range 0 7))) + (let ((s3-0 0)) + (while (let ((a0-20 (-> obj mole v1-13))) + (and (-> (the-as hip-mole (if a0-20 + (the-as hip-mole (-> a0-20 0 self)) + ) + ) + next-state ) + (let ((a0-26 (-> obj mole v1-13))) + (= (-> (the-as hip-mole (if a0-26 + (the-as hip-mole (-> a0-26 0 self)) + ) + ) + next-state + name + ) + 'active + ) ) - ) - (set! v1-13 (rand-vu-int-range 0 7)) - (+! s3-0 1) - (if (< 100 s3-0) - (goto cfg-27) - ) - ) + ) + ) + (set! v1-13 (rand-vu-int-range 0 7)) + (+! s3-0 1) + (if (< 100 s3-0) + (goto cfg-27) + ) ) - (send-event (ppointer->process (-> obj mole v1-13)) 'active (-> obj event-length) (-> s4-0 mode)) ) - (label cfg-27) + (send-event (ppointer->process (-> obj mole v1-13)) 'active (-> obj event-length) (-> s4-0 mode)) ) - ((or (zero? v1-8) (= v1-8 1) (= v1-8 2) (= v1-8 3) (= v1-8 4) (= v1-8 5) (= v1-8 6) (= v1-8 7)) - (let ((v1-22 (the-as int (-> s4-0 mode)))) - (let ((s3-1 0)) - (while (let ((a0-49 (-> obj mole v1-22))) - (and (-> (the-as hip-mole (if a0-49 - (the-as hip-mole (-> a0-49 0 self)) - ) - ) - next-state - ) - (let ((a0-55 (-> obj mole v1-22))) - (= (-> (the-as hip-mole (if a0-55 - (the-as hip-mole (-> a0-55 0 self)) - ) - ) - next-state - name - ) - 'active - ) + (label cfg-27) + ) + ((or (zero? v1-8) (= v1-8 1) (= v1-8 2) (= v1-8 3) (= v1-8 4) (= v1-8 5) (= v1-8 6) (= v1-8 7)) + (let ((v1-22 (the-as int (-> s4-0 mode)))) + (let ((s3-1 0)) + (while (let ((a0-49 (-> obj mole v1-22))) + (and (-> (the-as hip-mole (if a0-49 + (the-as hip-mole (-> a0-49 0 self)) + ) + ) + next-state ) + (let ((a0-55 (-> obj mole v1-22))) + (= (-> (the-as hip-mole (if a0-55 + (the-as hip-mole (-> a0-55 0 self)) + ) + ) + next-state + name + ) + 'active + ) ) - ) - (set! v1-22 (rand-vu-int-range 0 7)) - (+! s3-1 1) - (if (< 100 s3-1) - (goto cfg-61) - ) - ) + ) + ) + (set! v1-22 (rand-vu-int-range 0 7)) + (+! s3-1 1) + (if (< 100 s3-1) + (goto cfg-61) + ) ) - (send-event (ppointer->process (-> obj mole v1-22)) 'active (-> obj event-length) (-> s4-0 mode)) ) + (send-event (ppointer->process (-> obj mole v1-22)) 'active (-> obj event-length) (-> s4-0 mode)) ) - ) - ) - (label cfg-61) - (when s5-0 - (set! (-> obj event-length) 0) - (+! (-> obj event) 1) - (when (>= (-> obj event) (-> *mole-data* (-> obj wave) length)) - (set! (-> obj event) 0) - (+! (-> obj wave) 1) - (if (>= (-> obj wave) (-> *mole-data* length)) - (set! (-> obj wave) (+ (-> *mole-data* length) -1)) - ) - ) + ) ) ) - (when (>= (- (-> pp clock frame-counter) (-> obj speech-time)) (seconds 15)) - (if (nonzero? (cond - ((= (-> obj speech-count) 1) - 0 - ) - ((>= (-> obj score) 1300.0) - (set! (-> obj speech-count) 1) - (let ((v1-50 (whack-a-metal-method-29 obj 0 3))) - (cond - ((zero? v1-50) - (talker-spawn-func (-> *talker-speech* 430) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-50 1) - (talker-spawn-func (-> *talker-speech* 431) *entity-pool* (target-pos 0) (the-as region #f)) - ) - (else - (talker-spawn-func (-> *talker-speech* 432) *entity-pool* (target-pos 0) (the-as region #f)) - ) + (label cfg-61) + (when s5-0 + (set! (-> obj event-length) 0) + (+! (-> obj event) 1) + (when (>= (-> obj event) (-> *mole-data* (-> obj wave) length)) + (set! (-> obj event) 0) + (+! (-> obj wave) 1) + (if (>= (-> obj wave) (-> *mole-data* length)) + (set! (-> obj wave) (+ (-> *mole-data* length) -1)) + ) + ) + ) + ) + (when (>= (- (current-time) (-> obj speech-time)) (seconds 15)) + (if (nonzero? (cond + ((= (-> obj speech-count) 1) + 0 + ) + ((>= (-> obj score) 1300.0) + (set! (-> obj speech-count) 1) + (let ((v1-50 (whack-a-metal-method-29 obj 0 3))) + (cond + ((zero? v1-50) + (talker-spawn-func (-> *talker-speech* 430) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-50 1) + (talker-spawn-func (-> *talker-speech* 431) *entity-pool* (target-pos 0) (the-as region #f)) + ) + (else + (talker-spawn-func (-> *talker-speech* 432) *entity-pool* (target-pos 0) (the-as region #f)) ) ) ) - (else - (let ((v1-55 (whack-a-metal-method-29 obj 1 20))) - (cond - ((zero? v1-55) - (talker-spawn-func (-> *talker-speech* 395) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 1) - (talker-spawn-func (-> *talker-speech* 396) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 2) - (talker-spawn-func (-> *talker-speech* 397) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 3) - (talker-spawn-func (-> *talker-speech* 398) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 4) - (talker-spawn-func (-> *talker-speech* 401) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 5) - (talker-spawn-func (-> *talker-speech* 403) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 6) - (talker-spawn-func (-> *talker-speech* 404) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 7) - (talker-spawn-func (-> *talker-speech* 405) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 8) - (talker-spawn-func (-> *talker-speech* 406) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 9) - (talker-spawn-func (-> *talker-speech* 407) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 10) - (talker-spawn-func (-> *talker-speech* 408) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 11) - (talker-spawn-func (-> *talker-speech* 409) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 12) - (talker-spawn-func (-> *talker-speech* 410) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 13) - (talker-spawn-func (-> *talker-speech* 411) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 14) - (talker-spawn-func (-> *talker-speech* 412) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 15) - (talker-spawn-func (-> *talker-speech* 413) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 16) - (talker-spawn-func (-> *talker-speech* 414) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 17) - (talker-spawn-func (-> *talker-speech* 415) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 18) - (talker-spawn-func (-> *talker-speech* 416) *entity-pool* (target-pos 0) (the-as region #f)) - ) - (else - (talker-spawn-func (-> *talker-speech* 417) *entity-pool* (target-pos 0) (the-as region #f)) - ) + ) + (else + (let ((v1-55 (whack-a-metal-method-29 obj 1 20))) + (cond + ((zero? v1-55) + (talker-spawn-func (-> *talker-speech* 395) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 1) + (talker-spawn-func (-> *talker-speech* 396) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 2) + (talker-spawn-func (-> *talker-speech* 397) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 3) + (talker-spawn-func (-> *talker-speech* 398) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 4) + (talker-spawn-func (-> *talker-speech* 401) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 5) + (talker-spawn-func (-> *talker-speech* 403) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 6) + (talker-spawn-func (-> *talker-speech* 404) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 7) + (talker-spawn-func (-> *talker-speech* 405) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 8) + (talker-spawn-func (-> *talker-speech* 406) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 9) + (talker-spawn-func (-> *talker-speech* 407) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 10) + (talker-spawn-func (-> *talker-speech* 408) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 11) + (talker-spawn-func (-> *talker-speech* 409) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 12) + (talker-spawn-func (-> *talker-speech* 410) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 13) + (talker-spawn-func (-> *talker-speech* 411) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 14) + (talker-spawn-func (-> *talker-speech* 412) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 15) + (talker-spawn-func (-> *talker-speech* 413) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 16) + (talker-spawn-func (-> *talker-speech* 414) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 17) + (talker-spawn-func (-> *talker-speech* 415) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 18) + (talker-spawn-func (-> *talker-speech* 416) *entity-pool* (target-pos 0) (the-as region #f)) + ) + (else + (talker-spawn-func (-> *talker-speech* 417) *entity-pool* (target-pos 0) (the-as region #f)) ) ) ) ) ) - (set! (-> obj speech-time) (-> pp clock frame-counter)) - ) - ) - (whack-a-metal-method-28 obj) - 0 - (none) + ) + (set! (-> obj speech-time) (current-time)) + ) ) + (whack-a-metal-method-28 obj) + 0 + (none) ) (defmethod whack-a-metal-method-28 whack-a-metal ((obj whack-a-metal)) - (with-pp - (cond - ((>= (-> *game-info* score) (-> obj score)) - (set! (-> *game-info* score) (-> obj score)) - ) - ((and (< (-> *game-info* score) (-> obj score)) - (>= (- (-> pp clock frame-counter) (-> obj score-time)) (seconds 0.1)) - ) - (sound-play "whack-score") - (seek! (-> *game-info* score) (-> obj score) 2.0) - (set! (-> obj score-time) (-> pp clock frame-counter)) - ) - ) - (let ((s5-1 (handle->process (-> obj cabinet)))) - (when s5-1 - (spawn-with-matrix (-> obj score-part 1) (-> (the-as process-drawable s5-1) node-list data 13 bone transform)) - (spawn-with-matrix (-> obj score-part 0) (-> (the-as process-drawable s5-1) node-list data 12 bone transform)) - (dotimes (s4-1 (- 20 (-> obj miss-count))) - (set! (-> *part-id-table* 3336 init-specs 2 initial-valuef) (+ -1228.8 (* 614.4 (the float (mod s4-1 5))))) - (set! (-> *part-id-table* 3336 init-specs 2 random-rangef) 0.0) - (set! (-> *part-id-table* 3336 init-specs 3 initial-valuef) (- 921.6 (* 614.4 (the float (/ s4-1 5))))) - (set! (-> *part-id-table* 3336 init-specs 3 random-rangef) 0.0) - (sp-launch-particles-var - *sp-particle-system-3d* - (-> *part-id-table* 3336) - (-> (the-as process-drawable s5-1) node-list data 12 bone transform) - (the-as sparticle-launch-state #f) - (the-as sparticle-launch-control #f) - 1.0 - ) + (cond + ((>= (-> *game-info* score) (-> obj score)) + (set! (-> *game-info* score) (-> obj score)) + ) + ((and (< (-> *game-info* score) (-> obj score)) (>= (- (current-time) (-> obj score-time)) (seconds 0.1))) + (sound-play "whack-score") + (seek! (-> *game-info* score) (-> obj score) 2.0) + (set! (-> obj score-time) (current-time)) + ) + ) + (let ((s5-1 (handle->process (-> obj cabinet)))) + (when s5-1 + (spawn-with-matrix (-> obj score-part 1) (-> (the-as process-drawable s5-1) node-list data 13 bone transform)) + (spawn-with-matrix (-> obj score-part 0) (-> (the-as process-drawable s5-1) node-list data 12 bone transform)) + (dotimes (s4-1 (- 20 (-> obj miss-count))) + (set! (-> *part-id-table* 3336 init-specs 2 initial-valuef) (+ -1228.8 (* 614.4 (the float (mod s4-1 5))))) + (set! (-> *part-id-table* 3336 init-specs 2 random-rangef) 0.0) + (set! (-> *part-id-table* 3336 init-specs 3 initial-valuef) (- 921.6 (* 614.4 (the float (/ s4-1 5))))) + (set! (-> *part-id-table* 3336 init-specs 3 random-rangef) 0.0) + (sp-launch-particles-var + *sp-particle-system-3d* + (-> *part-id-table* 3336) + (-> (the-as process-drawable s5-1) node-list data 12 bone transform) + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 ) ) ) - 0 - (none) ) + 0 + (none) ) (defstate hide (whack-a-metal) @@ -2117,7 +2111,7 @@ (set-setting! 'borrow '((ctywide 1 lwidea #f) (hiphog 0 lwhack special)) 0.0 0) (want-display-level *load-state* 'ctyport #f) (want-display-level *load-state* 'ctywide #f) - (set! (-> self speech-time) (-> self clock frame-counter)) + (set! (-> self speech-time) (current-time)) (if (not (task-node-closed? (game-task-node city-whack-resolution))) (set! (-> self hud-goal) (ppointer->handle (process-spawn hud-goal :init hud-init-by-other :to self))) ) @@ -2264,7 +2258,7 @@ ) ) ) - (+! (-> self event-time) (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! (-> self event-time) (- (current-time) (-> self clock old-frame-counter))) (ja-blend-eval) (suspend) (ja :num! (seek!)) @@ -2285,7 +2279,7 @@ :frame-num 0.0 ) (until (ja-done? 0) - (+! (-> self event-time) (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! (-> self event-time) (- (current-time) (-> self clock old-frame-counter))) (suspend) (ja :num! (seek!)) ) @@ -2298,7 +2292,7 @@ :frame-num 0.0 ) (until (ja-done? 0) - (+! (-> self event-time) (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! (-> self event-time) (- (current-time) (-> self clock old-frame-counter))) (suspend) (ja :num! (seek!)) ) @@ -2328,7 +2322,7 @@ :exit (-> (method-of-type whack-a-metal active) exit) :code (behavior ((arg0 int)) (sound-play "whack-swish") - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (dotimes (v1-3 3) (set! (-> self slot-buffer v1-3) (-> self slot-buffer (+ v1-3 1))) ) @@ -2557,7 +2551,7 @@ (set! (-> self score) (+ 50.0 (-> self score))) ) (else - (when (>= (- (-> self clock frame-counter) (-> self speech-time)) (seconds 12)) + (when (>= (- (current-time) (-> self speech-time)) (seconds 12)) (let ((v1-78 (whack-a-metal-method-29 self 3 3))) (cond ((zero? v1-78) @@ -2571,7 +2565,7 @@ ) ) ) - (set! (-> self speech-time) (-> self clock frame-counter)) + (set! (-> self speech-time) (current-time)) ) (process-spawn part-tracker @@ -2661,11 +2655,9 @@ ) ) ) - (s5-8 (-> self clock frame-counter)) + (s5-8 (current-time)) ) - (while (or (nonzero? (get-status *gui-control* (the-as sound-id gp-1))) - (< (- (-> self clock frame-counter) s5-8) (seconds 2)) - ) + (while (or (nonzero? (get-status *gui-control* (the-as sound-id gp-1))) (< (- (current-time) s5-8) (seconds 2))) (suspend) (ja :num! (loop!)) ) @@ -2736,11 +2728,9 @@ ) ) ) - (s5-8 (-> self clock frame-counter)) + (s5-8 (current-time)) ) - (while (or (nonzero? (get-status *gui-control* (the-as sound-id gp-1))) - (< (- (-> self clock frame-counter) s5-8) (seconds 2)) - ) + (while (or (nonzero? (get-status *gui-control* (the-as sound-id gp-1))) (< (- (current-time) s5-8) (seconds 2))) (suspend) (ja :num! (loop!)) ) diff --git a/goal_src/jak2/levels/intro/intro-obs.gc b/goal_src/jak2/levels/intro/intro-obs.gc index afe5e0d61f..cf10500c2b 100644 --- a/goal_src/jak2/levels/intro/intro-obs.gc +++ b/goal_src/jak2/levels/intro/intro-obs.gc @@ -52,9 +52,7 @@ (if (= (-> self path-u) 1.0) (go-virtual die) ) - (when (>= (- (-> self clock frame-counter) (the-as int (-> self flit-timer))) - (the-as time-frame (-> self flit-interval)) - ) + (when (>= (- (current-time) (the-as int (-> self flit-timer))) (the-as time-frame (-> self flit-interval))) (let ((f28-0 (rand-vu-float-range -1.0 1.0)) (f30-0 (rand-vu-float-range -1.0 1.0)) (f0-1 (rand-vu-float-range 0.2 0.6)) @@ -64,7 +62,7 @@ (set! (-> self flit-factor) 0.0) (set! (-> self flit-interval) (the-as uint (the int (* 300.0 f0-1)))) ) - (set! (-> self flit-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self flit-timer) (the-as uint (current-time))) ) (none) ) @@ -247,7 +245,7 @@ This commonly includes things such as: (set! (-> self path-u) 0.0) (set! (-> self path-du) (rand-vu-float-range 0.15 0.32)) (set! (-> self z-rot) 0.0) - (set! (-> self flit-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self flit-timer) (the-as uint (current-time))) (set! (-> self flit-interval) (the-as uint 0)) (vector-reset! (-> self flit-prev-offset)) (vector-reset! (-> self flit-next-offset)) @@ -327,9 +325,9 @@ This commonly includes things such as: ) ) (let ((s5-1 (the int (* 300.0 (rand-vu-float-range 0.03 0.08)))) - (s4-0 (-> self clock frame-counter)) + (s4-0 (current-time)) ) - (until (>= (- (-> self clock frame-counter) s4-0) s5-1) + (until (>= (- (current-time) s4-0) s5-1) (suspend) ) ) diff --git a/goal_src/jak2/levels/intro/intro-scenes.gc b/goal_src/jak2/levels/intro/intro-scenes.gc index 49af78beba..53666951cb 100644 --- a/goal_src/jak2/levels/intro/intro-scenes.gc +++ b/goal_src/jak2/levels/intro/intro-scenes.gc @@ -2192,8 +2192,8 @@ (lambda :behavior scene-player () (talker-spawn-func (-> *talker-speech* 123) self (target-pos 0) (the-as region #f)) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 5)) (if (cpad-pressed? 0 square) (return #f) ) @@ -2256,8 +2256,8 @@ (set! (-> gp-0 scale-x) 1.0) (set! (-> gp-0 scale-y) 1.0) (when (and s5-0 (-> gp-0 tex)) - (let ((s4-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-0) (seconds 5)) + (let ((s4-0 (current-time))) + (until (>= (- (current-time) s4-0) (seconds 5)) (let ((f0-2 1.0)) (cond ((< f30-0 2.0) @@ -2379,8 +2379,8 @@ ) ) (when (and s4-0 (-> gp-0 tex)) - (let ((s3-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-0) (seconds 8)) + (let ((s3-0 (current-time))) + (until (>= (- (current-time) s3-0) (seconds 8)) (let ((f0-6 1.0)) (cond ((< f30-0 2.0) diff --git a/goal_src/jak2/levels/landing_pad/castle-obs.gc b/goal_src/jak2/levels/landing_pad/castle-obs.gc index 88bb5287fd..2f2937e031 100644 --- a/goal_src/jak2/levels/landing_pad/castle-obs.gc +++ b/goal_src/jak2/levels/landing_pad/castle-obs.gc @@ -298,7 +298,7 @@ This commonly includes things such as: (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) (-> self clock frame-counter)) + (< (-> self lightning-timer) (current-time)) ) (let ((s5-0 (new 'stack-no-clear 'vector))) (set! (-> s5-0 quad) (-> *y-vector* quad)) @@ -357,9 +357,7 @@ This commonly includes things such as: (-> s4-2 ppointer) ) ) - (set! (-> self lightning-timer) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.04 0.1)))) - ) + (set! (-> self lightning-timer) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.04 0.1))))) ) ) ) @@ -513,8 +511,8 @@ This commonly includes things such as: (sound-play "lightning-node") (suspend) (logior! (-> self entity extra perm status) (entity-perm-status dead)) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 4)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 4)) (suspend) ) ) @@ -551,7 +549,7 @@ This commonly includes things such as: :code (the-as (function none :behavior cas-electric-fence) sleep-code) :post (behavior () (when (not (-> self stop)) - (when (< (-> self next-spawn-time) (-> self clock frame-counter)) + (when (< (-> self next-spawn-time) (current-time)) (let ((s5-0 (new 'stack-no-clear 'vector))) (set! (-> s5-0 quad) (-> *y-vector* quad)) (let ((gp-0 (new 'stack-no-clear 'collide-query))) @@ -614,9 +612,7 @@ This commonly includes things such as: (t9-10 a0-21 a1-10 a2-8 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) - (set! (-> self next-spawn-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.07 0.4)))) - ) + (set! (-> self next-spawn-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.07 0.4))))) ) ) ) @@ -1762,8 +1758,8 @@ This commonly includes things such as: (sound-play "trapdoor") (suspend) (ja-channel-set! 0) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -1949,16 +1945,10 @@ This commonly includes things such as: ) (defun cas-rot-blade-callback ((arg0 cspace) (arg1 transformq)) - (with-pp - (quaternion-rotate-local-y! - (-> arg1 quat) - (-> arg1 quat) - (* 606.8148 (the float (-> pp clock frame-counter))) - ) - (cspace<-parented-transformq-joint! arg0 arg1) - 0 - (none) - ) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (* 606.8148 (the float (current-time)))) + (cspace<-parented-transformq-joint! arg0 arg1) + 0 + (none) ) (defstate idle (cas-rot-blade) @@ -2257,11 +2247,11 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.6)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.6)) (let ((a0-1 *target*)) (if (and a0-1 (not (focus-test? a0-1 disable dead)) @@ -2270,7 +2260,7 @@ This commonly includes things such as: (go-virtual spawning) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (none) ) @@ -2291,20 +2281,20 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self spawn-count) 0) (set! (-> self spawn-count-total) 0) (set! (-> self player-dist) (-> self notice-dist)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.6)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.6)) (let ((a0-1 *target*)) (if (and a0-1 (not (logtest? (-> a0-1 focus-status) (focus-status disable dead)))) (set! (-> self player-dist) (vector-vector-distance (get-trans a0-1 0) (-> self root trans))) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (none) ) @@ -2319,8 +2309,8 @@ This commonly includes things such as: (suspend) (ja :num! (seek!)) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.5)) (suspend) ) ) @@ -2359,15 +2349,15 @@ This commonly includes things such as: ) ) ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (the int (* 300.0 (rand-vu-float-range 0.5 1.0)))) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (the int (* 300.0 (rand-vu-float-range 0.5 1.0)))) (suspend) ) ) ) (while (> (-> self spawn-count) 0) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 0.43)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 0.43)) (suspend) ) ) @@ -2388,8 +2378,8 @@ This commonly includes things such as: (set-setting! 'entity-name a3-4 0.0 0) ) ) - (let ((gp-5 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-5) (seconds 2)) + (let ((gp-5 (current-time))) + (until (>= (- (current-time) gp-5) (seconds 2)) (suspend) ) ) @@ -2422,8 +2412,8 @@ This commonly includes things such as: (set-setting! 'entity-name a3-6 0.0 0) ) ) - (let ((gp-7 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-7) (seconds 1)) + (let ((gp-7 (current-time))) + (until (>= (- (current-time) gp-7) (seconds 1)) (suspend) ) ) @@ -2459,8 +2449,8 @@ This commonly includes things such as: (suspend) (ja :num! (seek! 0.0)) ) - (let ((gp-10 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-10) (seconds 1)) + (let ((gp-10 (current-time))) + (until (>= (- (current-time) gp-10) (seconds 1)) (suspend) ) ) @@ -2504,8 +2494,8 @@ This commonly includes things such as: (label cfg-14) (not v1-28) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.51)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.51)) (suspend) ) ) @@ -2518,8 +2508,8 @@ This commonly includes things such as: (set-setting! 'entity-name a3-2 0.0 0) ) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 1)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 1)) (suspend) ) ) @@ -2558,8 +2548,8 @@ This commonly includes things such as: ) ) ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 2.5)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 2.5)) (suspend) ) ) @@ -2580,7 +2570,7 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (stack-size-set! (-> obj main-thread) 512) + (stack-size-set! (-> obj main-thread) 512) ;; added (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((s4-0 (new 'process 'collide-shape obj (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)))) @@ -2686,7 +2676,7 @@ This commonly includes things such as: :virtual #t :code (the-as (function none :behavior lightning-ball) sleep-code) :post (behavior () - (when (>= (- (-> self clock frame-counter) (-> self timer)) (seconds 0.08)) + (when (>= (- (current-time) (-> self timer)) (seconds 0.08)) (let ((gp-0 (new 'stack-no-clear 'collide-query))) (let ((f30-1 (* 182.04445 (rand-vu-float-range -20.0 20.0))) (f28-1 (* 182.04445 (rand-vu-float-range -180.0 180.0))) @@ -2722,7 +2712,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self timer) (-> self clock frame-counter)) + (set! (-> self timer) (current-time)) ) (none) ) @@ -2736,26 +2726,24 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (with-pp - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) - (let ((v1-2 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) - (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-2 prim-core action) (collide-action solid)) - (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 56320.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) v1-2) - ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-5 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) - ) - (set! (-> obj root-override) s4-0) + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((v1-2 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-2 prim-core action) (collide-action solid)) + (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 56320.0) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) v1-2) ) - (process-drawable-from-entity! obj arg0) - (set! (-> obj timer) (-> pp clock frame-counter)) - (update-transforms (-> obj root-override)) - (go (method-of-object obj idle)) - (none) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-5 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> obj root-override) s4-0) ) + (process-drawable-from-entity! obj arg0) + (set! (-> obj timer) (current-time)) + (update-transforms (-> obj root-override)) + (go (method-of-object obj idle)) + (none) ) diff --git a/goal_src/jak2/levels/landing_pad/castle-part.gc b/goal_src/jak2/levels/landing_pad/castle-part.gc index 77e2c9d646..3ebb197279 100644 --- a/goal_src/jak2/levels/landing_pad/castle-part.gc +++ b/goal_src/jak2/levels/landing_pad/castle-part.gc @@ -393,18 +393,16 @@ ) (defun castle-green-dome-light-pulsate ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) - (with-pp - (let ((s5-0 lerp-scale) - (s4-0 32.0) - (s3-0 64.0) - (t9-0 sin) - (f0-0 3640.889) - (f1-1 (* 0.0033333334 (the float (-> pp clock frame-counter)))) + (let ((s5-0 lerp-scale) + (s4-0 32.0) + (s3-0 64.0) + (t9-0 sin) + (f0-0 3640.889) + (f1-1 (* 0.0033333334 (the float (current-time)))) + ) + (set! (-> arg2 coneradius) + (s5-0 s4-0 s3-0 (t9-0 (* f0-0 (- f1-1 (* (the float (the int (/ f1-1 360.0))) 360.0)))) -1.0 1.0) ) - (set! (-> arg2 coneradius) - (s5-0 s4-0 s3-0 (t9-0 (* f0-0 (- f1-1 (* (the float (the int (/ f1-1 360.0))) 360.0)))) -1.0 1.0) - ) - ) ) ) diff --git a/goal_src/jak2/levels/landing_pad/roboguard-level.gc b/goal_src/jak2/levels/landing_pad/roboguard-level.gc index 042fd93768..5df880034f 100644 --- a/goal_src/jak2/levels/landing_pad/roboguard-level.gc +++ b/goal_src/jak2/levels/landing_pad/roboguard-level.gc @@ -486,7 +486,7 @@ ) :post (behavior () (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (-> self clock frame-counter)) + (set! (-> self last-draw-time) (current-time)) ) (enemy-method-129 self) (ja-post) @@ -592,7 +592,7 @@ ) 0 (logior! (-> self focus-status) (focus-status dangerous)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (roboguard-level-method-185 self (the-as symbol 1)) (vector-z-quaternion! (-> self roll-dir) (-> self root-override2 quat)) (set! (-> self roll-timer) 0) @@ -635,10 +635,8 @@ ) 0 (nav-enemy-method-160 self) - (when (< (-> self roll-timer) (-> self clock frame-counter)) - (set! (-> self roll-timer) - (+ (-> self clock frame-counter) (the int (* 300.0 (get-rand-float-range self 3.0 5.0)))) - ) + (when (< (-> self roll-timer) (current-time)) + (set! (-> self roll-timer) (+ (current-time) (the int (* 300.0 (get-rand-float-range self 3.0 5.0))))) (let ((gp-2 (handle->process (-> self focus handle)))) (when (and gp-2 (and gp-2 @@ -1088,99 +1086,94 @@ ;; WARN: Return type mismatch object vs symbol. (defmethod enemy-method-76 roboguard-level ((obj roboguard-level) (arg0 process) (arg1 event-message-block)) - (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (the-as - symbol - (cond - ((or (= (-> arg0 type) target) (not (logtest? (-> obj flags) 4))) - ((method-of-type nav-enemy enemy-method-76) obj arg0 arg1) - ) - (else - (when (!= (-> arg0 type) target) - (-> arg1 param 0) - (let* ((s3-0 arg0) - (s1-0 (if (type? s3-0 process-focusable) - s3-0 - ) - ) - ) - (when (and s1-0 (logtest? (process-mask enemy) (-> s1-0 mask))) - (let ((s2-1 (vector-! - (new 'stack-no-clear 'vector) - (-> obj root-override2 trans) - (-> (the-as process-drawable s1-0) root trans) - ) - ) - ) - (new 'stack-no-clear 'vector) - 0.0 - (let ((s3-1 (new 'stack-no-clear 'vector))) - (vector-normalize! s2-1 1.0) - (let ((f0-3 - (- (vector-dot (-> obj root-override2 transv) s2-1) - (vector-dot (-> (the-as process-drawable s1-0) root transv) s2-1) - ) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (the-as + symbol + (cond + ((or (= (-> arg0 type) target) (not (logtest? (-> obj flags) 4))) + ((method-of-type nav-enemy enemy-method-76) obj arg0 arg1) + ) + (else + (when (!= (-> arg0 type) target) + (-> arg1 param 0) + (let* ((s3-0 arg0) + (s1-0 (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + (when (and s1-0 (logtest? (process-mask enemy) (-> s1-0 mask))) + (let ((s2-1 (vector-! + (new 'stack-no-clear 'vector) + (-> obj root-override2 trans) + (-> (the-as process-drawable s1-0) root trans) ) ) - (let ((a1-5 (-> obj nav state))) - (set! (-> s3-1 quad) (-> a1-5 velocity quad)) - ) - (let ((a0-16 s3-1)) - (let ((v1-20 s3-1)) - (let ((a1-9 (* -1.0 f0-3))) - (.mov vf7 a1-9) - ) - (.lvf vf5 (&-> s2-1 quad)) - (.lvf vf4 (&-> v1-20 quad)) - ) - (.add.x.vf vf6 vf0 vf0 :mask #b1000) - (.mul.x.vf acc vf5 vf7 :mask #b111) - (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) - (.svf (&-> a0-16 quad) vf6) - ) - ) - (let ((a0-17 (-> obj nav state)) - (v1-22 s3-1) - ) - (set! (-> a0-17 velocity quad) (-> v1-22 quad)) - ) - 0 - (set! (-> obj speed) (vector-length s3-1)) - (let ((v1-28 (-> obj nav state))) - (set! (-> v1-28 speed) (-> obj speed)) - ) - 0 - (let ((v1-30 (-> obj nav))) - (set! (-> v1-30 target-speed) (-> obj speed)) - ) - 0 - (set! (-> obj roll-timer) - (+ (-> pp clock frame-counter) (the int (* 300.0 (get-rand-float-range obj 3.0 5.0)))) - ) - (set! (-> obj roll-dir quad) (-> s3-1 quad)) ) - ) - (set! (-> obj roll-dir y) 0.0) - (vector-xz-normalize! (-> obj roll-dir) 1.0) - (let ((a0-22 (-> obj nav state)) - (v1-40 (-> obj roll-dir)) + (new 'stack-no-clear 'vector) + 0.0 + (let ((s3-1 (new 'stack-no-clear 'vector))) + (vector-normalize! s2-1 1.0) + (let ((f0-3 (- (vector-dot (-> obj root-override2 transv) s2-1) + (vector-dot (-> (the-as process-drawable s1-0) root transv) s2-1) + ) + ) + ) + (let ((a1-5 (-> obj nav state))) + (set! (-> s3-1 quad) (-> a1-5 velocity quad)) ) - (set! (-> a0-22 heading quad) (-> v1-40 quad)) + (let ((a0-16 s3-1)) + (let ((v1-20 s3-1)) + (let ((a1-9 (* -1.0 f0-3))) + (.mov vf7 a1-9) + ) + (.lvf vf5 (&-> s2-1 quad)) + (.lvf vf4 (&-> v1-20 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a0-16 quad) vf6) + ) + ) + (let ((a0-17 (-> obj nav state)) + (v1-22 s3-1) + ) + (set! (-> a0-17 velocity quad) (-> v1-22 quad)) + ) + 0 + (set! (-> obj speed) (vector-length s3-1)) + (let ((v1-28 (-> obj nav state))) + (set! (-> v1-28 speed) (-> obj speed)) + ) + 0 + (let ((v1-30 (-> obj nav))) + (set! (-> v1-30 target-speed) (-> obj speed)) + ) + 0 + (set! (-> obj roll-timer) (+ (current-time) (the int (* 300.0 (get-rand-float-range obj 3.0 5.0))))) + (set! (-> obj roll-dir quad) (-> s3-1 quad)) ) - 0 - (logior! (-> obj flags) 64) ) + (set! (-> obj roll-dir y) 0.0) + (vector-xz-normalize! (-> obj roll-dir) 1.0) + (let ((a0-22 (-> obj nav state)) + (v1-40 (-> obj roll-dir)) + ) + (set! (-> a0-22 heading quad) (-> v1-40 quad)) + ) + 0 + (logior! (-> obj flags) 64) ) - (send-event arg0 'touch (-> arg1 param 0)) ) + (send-event arg0 'touch (-> arg1 param 0)) ) ) ) diff --git a/goal_src/jak2/levels/mars_tomb/left/chase/target-indax.gc b/goal_src/jak2/levels/mars_tomb/left/chase/target-indax.gc index a6498227fb..1beb1d8e16 100644 --- a/goal_src/jak2/levels/mars_tomb/left/chase/target-indax.gc +++ b/goal_src/jak2/levels/mars_tomb/left/chase/target-indax.gc @@ -279,7 +279,7 @@ (set! (-> self control bend-target) 0.0) (target-collide-set! 'indax 0.0) (set! (-> self fact-override health) (-> self fact-override health-max)) - (set! (-> self indax indax-start-time) (-> self clock frame-counter)) + (set! (-> self indax indax-start-time) (current-time)) (set! (-> self indax art-group-backup) (-> self draw art-group)) (set! (-> self draw art-group) (-> self sidekick 0 draw art-group)) (logior! (-> self draw status) (draw-control-status no-draw-bounds2)) @@ -586,7 +586,7 @@ (defstate target-indax-walk (target) :event target-indax-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *indax-walk-mods*) (none) ) @@ -648,7 +648,7 @@ (let ((f26-0 0.0) (f30-0 0.0) (f28-0 0.0) - (gp-0 (-> self clock frame-counter)) + (gp-0 (current-time)) ) (let ((v1-3 (ja-group))) (cond @@ -700,12 +700,12 @@ (suspend) (let ((f26-1 (lerp-scale 0.0 1.0 (-> self control ctrl-xz-vel) 16384.0 32768.0))) (cond - ((>= (- (-> self clock frame-counter) gp-0) (seconds 5)) - (set! gp-0 (-> self clock frame-counter)) + ((>= (- (current-time) gp-0) (seconds 5)) + (set! gp-0 (current-time)) ) - ((>= (- (-> self clock frame-counter) gp-0) (seconds 2.5)) + ((>= (- (current-time) gp-0) (seconds 2.5)) ) - ((>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + ((>= (- (current-time) gp-0) (seconds 1)) (set! f28-0 (seek f28-0 1.0 (* 2.0 (-> self clock seconds-per-frame)))) ) (else @@ -902,7 +902,7 @@ (defstate target-indax-double-jump (target) :event target-indax-jump-event-handler :enter (behavior ((arg0 float) (arg1 float)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (if (!= (-> self control mod-surface) *slide-jump-mods*) @@ -1037,7 +1037,7 @@ (defstate target-indax-trip (target) :event target-indax-jump-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "jump" :vol 70) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (none) @@ -1210,13 +1210,13 @@ (cond ((and (>= (ja-aframe-num 0) 20.0) (and (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> 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)) ) - (>= (- (-> self clock frame-counter) (-> self control sliding-start-time)) (seconds 0.04)) + (>= (- (current-time) (-> self control sliding-start-time)) (seconds 0.04)) ) ) (go target-indax-falling #f) @@ -1226,14 +1226,12 @@ (set-forward-vel (the-as float f26-0)) ) ((and (nonzero? (-> self control unknown-time-frame18)) - (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame18)) (seconds 0.04)) + (>= (- (current-time) (-> self control unknown-time-frame18)) (seconds 0.04)) ) (set-forward-vel 0.0) ) ((and (not (cpad-hold? (-> self control cpad number) square)) - (>= (- (-> self clock frame-counter) (-> self control unknown-combo-tracker00 move-start-time)) - (seconds 0.05) - ) + (>= (- (current-time) (-> self control unknown-combo-tracker00 move-start-time)) (seconds 0.05)) ) (if (= (-> self control ground-pat material) (pat-material ice)) (set-forward-vel (fmax 32768.0 (* 0.8 (-> self control ctrl-xz-vel)))) @@ -1263,7 +1261,7 @@ ) (suspend) (ja :num! (seek! max (* (-> self control current-surface align-speed) f28-0))) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (set! (-> *run-attack-mods* turnvv) 0.0) ) (if (< 2 gp-2) @@ -1273,7 +1271,7 @@ ) ) (if (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> 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))) @@ -1328,7 +1326,7 @@ ) :code (behavior ((arg0 symbol) (arg1 attack-info)) (logclear! (-> self water flags) (water-flags jump-out)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self neck flex-blend) 0.0) (let ((gp-0 (-> self attack-info))) (let ((s5-0 (new 'stack-no-clear 'vector))) @@ -1376,7 +1374,7 @@ (cond ((= arg0 'attack) (logior! (-> self focus-status) (focus-status hit)) - (set! (-> self game hit-time) (-> self clock frame-counter)) + (set! (-> self game hit-time) (current-time)) (case (-> gp-0 mode) (('endlessfall) (cond @@ -1384,8 +1382,8 @@ (let ((s4-1 (new-stack-vector0))) (set! (-> s4-1 quad) (-> self control last-trans-on-ground quad)) (ja-channel-set! 0) - (let ((s3-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-1) (seconds 1)) + (let ((s3-1 (current-time))) + (until (>= (- (current-time) s3-1) (seconds 1)) (suspend) ) ) @@ -1561,7 +1559,7 @@ ) (set! (-> self control transv quad) (the-as uint128 0)) (initialize! (-> self game) 'life (the-as game-save #f) (the-as string #f)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sleep-code) (none) ) diff --git a/goal_src/jak2/levels/mars_tomb/monster-frog.gc b/goal_src/jak2/levels/mars_tomb/monster-frog.gc index 39efd0d998..3dbbfea490 100644 --- a/goal_src/jak2/levels/mars_tomb/monster-frog.gc +++ b/goal_src/jak2/levels/mars_tomb/monster-frog.gc @@ -539,7 +539,7 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info-override use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (nav-enemy-method-163 self) (go-stare2 self) ) @@ -728,7 +728,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior monster-frog) enemy-event-handler) :enter (behavior ((arg0 vector)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) diff --git a/goal_src/jak2/levels/mars_tomb/tomb-beetle.gc b/goal_src/jak2/levels/mars_tomb/tomb-beetle.gc index 0db4ed9bc8..22d7009223 100644 --- a/goal_src/jak2/levels/mars_tomb/tomb-beetle.gc +++ b/goal_src/jak2/levels/mars_tomb/tomb-beetle.gc @@ -193,44 +193,42 @@ (defmethod general-event-handler tomb-beetle ((obj tomb-beetle) (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" - (with-pp - (let ((v1-0 (new 'static 'array int64 2 -1 0))) - (case arg2 - (('cue-chase) - (set! (-> obj round) (-> arg3 param 0)) - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - (('attack) - (when (and (-> obj next-state) (let ((a1-4 (-> obj next-state name))) - (or (= a1-4 'active) (= a1-4 'stand)) - ) - ) - (-> arg3 param 1) - (cond - ((logtest? (-> obj fact-info-override enemy-options) (ash 1 (+ (-> obj round) 8))) - (set! (-> v1-0 0) (the-as int (-> pp clock frame-counter))) - (go (method-of-object obj go-to-door)) - ) - ((>= (- (-> pp clock frame-counter) (the-as time-frame (-> v1-0 0))) (seconds 0.5)) - (logior! (-> obj flags) 1) - (go (method-of-object obj die)) - ) - ) - ) - ) - (('die) + (let ((v1-0 (new 'static 'array int64 2 -1 0))) + (case arg2 + (('cue-chase) + (set! (-> obj round) (-> arg3 param 0)) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (('attack) + (when (and (-> obj next-state) (let ((a1-4 (-> obj next-state name))) + (or (= a1-4 'active) (= a1-4 'stand)) + ) + ) + (-> arg3 param 1) (cond - ((and (-> obj next-state) (= (-> obj next-state name) 'key)) - (go (method-of-object obj explode)) + ((logtest? (-> obj fact-info-override enemy-options) (ash 1 (+ (-> obj round) 8))) + (set! (-> v1-0 0) (the-as int (current-time))) + (go (method-of-object obj go-to-door)) ) - ((not (and (-> obj next-state) (= (-> obj next-state name) 'dormant))) - (go (method-of-object obj fly-away)) + ((>= (- (current-time) (the-as time-frame (-> v1-0 0))) (seconds 0.5)) + (logior! (-> obj flags) 1) + (go (method-of-object obj die)) ) ) ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (('die) + (cond + ((and (-> obj next-state) (= (-> obj next-state name) 'key)) + (go (method-of-object obj explode)) ) + ((not (and (-> obj next-state) (= (-> obj next-state name) 'dormant))) + (go (method-of-object obj fly-away)) + ) + ) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -395,7 +393,7 @@ (logclear! (-> v1-1 settings flags) (shadow-flags disable-draw)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :code (behavior () @@ -407,12 +405,12 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-0 (-> self clock frame-counter)) + (let ((gp-0 (current-time)) (s5-0 (the int (* 300.0 (rand-vu-float-range 1.1 2.3)))) (f30-1 (rand-vu-float-range 0.8 1.4)) ) (ja-no-eval :group! tomb-beetle-wiggle-ja :num! (loop! f30-1) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-0) s5-0) + (until (>= (- (current-time) gp-0) s5-0) (suspend) (ja :num! (loop! f30-1)) ) @@ -517,7 +515,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior tomb-beetle) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -531,7 +529,7 @@ (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (if (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (go-virtual active) ) (none) @@ -590,15 +588,13 @@ (none) ) :code (behavior () - (set! (-> self state-timeout) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.0 0.8)))) - ) + (set! (-> self state-timeout) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.0 0.8))))) (let ((v1-6 (ja-group))) (cond ((and v1-6 (= v1-6 tomb-beetle-stand0-ja)) (ja-no-eval :num! (seek!)) (while (not (ja-done? 0)) - (if (>= (-> self clock frame-counter) (-> self state-timeout)) + (if (>= (current-time) (-> self state-timeout)) (goto cfg-20) ) (suspend) @@ -616,7 +612,7 @@ :frame-num 0.0 ) (until (ja-done? 0) - (if (>= (-> self clock frame-counter) (-> self state-timeout)) + (if (>= (current-time) (-> self state-timeout)) (goto cfg-20) ) (suspend) @@ -804,8 +800,8 @@ (-> gp-1 ppointer) ) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 2)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 2)) (suspend) ) ) diff --git a/goal_src/jak2/levels/mars_tomb/tomb-obs.gc b/goal_src/jak2/levels/mars_tomb/tomb-obs.gc index f919344e4c..75e866f0eb 100644 --- a/goal_src/jak2/levels/mars_tomb/tomb-obs.gc +++ b/goal_src/jak2/levels/mars_tomb/tomb-obs.gc @@ -426,8 +426,8 @@ This commonly includes things such as: ) (defbehavior position-spikes tomb-stair-block ((arg0 int)) - (let ((s5-0 (and (nonzero? arg0) (< (mod (-> self clock frame-counter) arg0) (/ arg0 2)))) - (s4-0 (and (nonzero? arg0) (< (mod (+ (-> self clock frame-counter) (seconds 0.75)) arg0) (/ arg0 2)))) + (let ((s5-0 (and (nonzero? arg0) (< (mod (current-time) arg0) (/ arg0 2)))) + (s4-0 (and (nonzero? arg0) (< (mod (+ (current-time) (seconds 0.75)) arg0) (/ arg0 2)))) ) (dotimes (s3-0 4) (let ((f0-1 (seek @@ -494,7 +494,7 @@ This commonly includes things such as: :virtual #t :enter (behavior () (set! (-> self camera-state) 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (task-node-close! (game-task-node tomb-poles-block)) (none) ) @@ -515,7 +515,7 @@ This commonly includes things such as: (remove-setting! 'string-startup-vector) (set! (-> self camera-state) 3) ) - ((and (= (-> self camera-state) 1) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 8))) + ((and (= (-> self camera-state) 1) (>= (- (current-time) (-> self state-time)) (seconds 8))) (set-setting! 'interp-time 'abs 0.0 0) (set-setting! 'string-startup-vector 'abs (new 'static 'vector :x 1.0) 0) (remove-setting! 'entity-name) @@ -538,8 +538,8 @@ This commonly includes things such as: (set! (-> self camera-state) 1) (ja-channel-push! 1 (seconds 2)) (ja :group! (-> self draw art-group data 3) :num! min) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 2)) (lift-pool 0) (drop-pool 1) (suspend) @@ -626,7 +626,7 @@ This commonly includes things such as: (set! (-> self camera-state) 3) ) ) - ((and (= (-> self camera-state) 1) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4))) + ((and (= (-> self camera-state) 1) (>= (- (current-time) (-> self state-time)) (seconds 4))) (set-setting! 'interp-time 'abs 0.0 0) (set-setting! 'string-startup-vector 'abs (new 'static 'vector :x 1.0) 0) (remove-setting! 'entity-name) @@ -657,7 +657,7 @@ This commonly includes things such as: (set! v1-1 (or (not *target*) (process-grab? *target* #f))) ) (set-setting! 'entity-name "camera-170" 0.0 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self camera-state) 1) (ja-channel-push! 1 (seconds 2)) (until #f @@ -1162,7 +1162,7 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (stack-size-set! (-> obj main-thread) 1024) + (stack-size-set! (-> obj main-thread) 1024) ;; added (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 penetrated-by) (penetrate)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) @@ -1266,7 +1266,7 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (stack-size-set! (-> obj main-thread) 1024) + (stack-size-set! (-> obj main-thread) 1024) ;; added (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 penetrated-by) (penetrate)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 3) 0))) @@ -1516,7 +1516,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (get-point-at-percent-along-path! (-> self path) (-> self basetrans) (-> self path-pos) 'interp) (none) ) @@ -1524,9 +1524,9 @@ This commonly includes things such as: (set! (-> self flags) (logand -2 (-> self flags))) (plat-trans) (if (not (logtest? (-> self flags) 1)) - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) ) - (when (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 0.5)) + (when (>= (- (current-time) (-> self ride-timer)) (seconds 0.5)) (if (= (-> self path-pos) 0.0) (set! (-> self dest-pos) 1.0) (set! (-> self dest-pos) 0.0) @@ -1585,7 +1585,7 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('ridden) - (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (let ((v0-0 (the-as object (current-time)))) (set! (-> self ride-timer) (the-as time-frame v0-0)) v0-0 ) @@ -1597,7 +1597,7 @@ This commonly includes things such as: ) :trans (behavior () (plat-trans) - (when (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 1)) + (when (>= (- (current-time) (-> self ride-timer)) (seconds 1)) (cond ((= (-> self path-pos) 1.0) (set! (-> self dest-pos) 0.0) @@ -1831,7 +1831,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :code (behavior () @@ -1863,7 +1863,7 @@ This commonly includes things such as: (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 (- (-> self clock frame-counter) (-> self state-time))) 0.0 300.0))) + (let ((v1-13 (lerp-scale 0.0 1.0 (the float (- (current-time) (-> self state-time))) 0.0 300.0))) (.mov vf7 v1-13) ) (.lvf vf5 (&-> s0-1 quad)) @@ -1893,7 +1893,7 @@ This commonly includes things such as: (defstate doors-open (tomb-sphinx) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :code (behavior () @@ -1950,7 +1950,7 @@ This commonly includes things such as: (.mov.vf vf6 vf0 :mask #b1000) (.sub.vf vf6 vf4 vf5 :mask #b111) (.svf (&-> sv-96 quad) vf6) - (let ((v1-15 (lerp-scale 0.0 1.0 (the float (- (-> self clock frame-counter) (-> self state-time))) 0.0 930.0))) + (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)) diff --git a/goal_src/jak2/levels/mars_tomb/tomb-scenes.gc b/goal_src/jak2/levels/mars_tomb/tomb-scenes.gc index 79ec9843cd..046b5b2333 100644 --- a/goal_src/jak2/levels/mars_tomb/tomb-scenes.gc +++ b/goal_src/jak2/levels/mars_tomb/tomb-scenes.gc @@ -346,12 +346,12 @@ (let ((v1-0 #f) (sub-change-time (-> self subtitle-change-time)) ) - (when (>= (- (-> self clock frame-counter) (-> self speed-press-time)) 0) + (when (>= (- (current-time) (-> self speed-press-time)) 0) (set! sub-change-time (logxor sub-change-time 2048)) - (set! (-> self speed-press-time) (+ (-> self clock frame-counter) (seconds 0.5))) + (set! (-> self speed-press-time) (+ (current-time) (seconds 0.5))) (set! v1-0 #t) ) - (when (>= (- (-> self clock frame-counter) (-> self unknown-time)) 0) + (when (>= (- (current-time) (-> self unknown-time)) 0) (dotimes (s5-0 10) (let* ((f30-0 0.5) (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) @@ -363,9 +363,7 @@ ) ) ) - (set! (-> self unknown-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.25 0.75)))) - ) + (set! (-> self unknown-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.25 0.75))))) (set! v1-0 #t) ) (when v1-0 diff --git a/goal_src/jak2/levels/mars_tomb/tomb-water.gc b/goal_src/jak2/levels/mars_tomb/tomb-water.gc index a2e276dda3..bf04fd7e5d 100644 --- a/goal_src/jak2/levels/mars_tomb/tomb-water.gc +++ b/goal_src/jak2/levels/mars_tomb/tomb-water.gc @@ -130,8 +130,8 @@ (none) ) :code (behavior ((arg0 time-frame)) - (let ((s5-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-0) arg0) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) arg0) (suspend) ) ) @@ -507,35 +507,33 @@ This commonly includes things such as: (defmethod tomb-beetle-button-method-39 tomb-beetle-button ((obj tomb-beetle-button)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> obj speech-timer)) (seconds 6)) - (let ((s5-0 (rand-vu-int-count-excluding 4 (the-as int (-> obj speech-mask))))) - (let* ((v1-4 s5-0) - (t0-0 (cond - ((zero? v1-4) - "ora011" - ) - ((= v1-4 1) - "ora012" - ) - ((= v1-4 2) - "ora013" - ) - ((= v1-4 3) - "ora014" - ) - ) + (when (>= (- (current-time) (-> obj speech-timer)) (seconds 6)) + (let ((s5-0 (rand-vu-int-count-excluding 4 (the-as int (-> obj speech-mask))))) + (let* ((v1-4 s5-0) + (t0-0 (cond + ((zero? v1-4) + "ora011" + ) + ((= v1-4 1) + "ora012" + ) + ((= v1-4 2) + "ora013" + ) + ((= v1-4 3) + "ora014" + ) ) - ) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) t0-0 -99.0 0) - ) - (set! (-> obj speech-mask) (the-as uint (ash 1 s5-0))) + ) + ) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) t0-0 -99.0 0) ) - (set! (-> obj speech-timer) (-> pp clock frame-counter)) + (set! (-> obj speech-mask) (the-as uint (ash 1 s5-0))) ) - 0 - (none) + (set! (-> obj speech-timer) (current-time)) ) + 0 + (none) ) (defstate going-down (tomb-beetle-button) @@ -589,7 +587,7 @@ This commonly includes things such as: (t9-0) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + (when (>= (- (current-time) (-> self state-time)) (seconds 4)) (if (and *target* (focus-test? *target* grabbed)) (process-release? *target*) ) @@ -914,7 +912,7 @@ This commonly includes things such as: (sv-160 int) (sv-176 (function vector vector float)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self plat-idx) 0) (dotimes (gp-0 (-> self plat-count)) (if (nonzero? (-> self plat gp-0)) @@ -987,8 +985,8 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 2)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 2)) (suspend) ) ) @@ -1001,14 +999,14 @@ This commonly includes things such as: :virtual #t :event tomb-plat-simon-handler :enter (behavior () - (set! (-> self state-time) (+ (-> self clock frame-counter) (seconds -1))) + (set! (-> self state-time) (+ (current-time) (seconds -1))) (set! (-> self plat-idx) 0) 0 (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) - (set! (-> self state-time) (-> self clock frame-counter)) + (when (>= (- (current-time) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) (if (< (-> self plat-idx) (-> self plat-seq-count)) (send-event (handle->process (-> self plat (-> self plat-seq (-> self plat-idx)))) 'blink) ) @@ -1139,7 +1137,7 @@ This commonly includes things such as: (defbehavior tomb-simon-block-trans tomb-simon-block () (when (logtest? (-> self flags) (simon-block-flags sbf0)) - (when (>= (-> self clock frame-counter) (-> self blink-timer 1)) + (when (>= (current-time) (-> self blink-timer 1)) (cond ((logtest? (-> self flags) (simon-block-flags sbf1)) (set! (-> self draw color-mult quad) (-> self color quad)) @@ -1150,9 +1148,9 @@ This commonly includes things such as: ) ) (logxor! (-> self flags) (simon-block-flags sbf1)) - (set! (-> self blink-timer 1) (+ (-> self clock frame-counter) (seconds 0.2))) + (set! (-> self blink-timer 1) (+ (current-time) (seconds 0.2))) ) - (when (>= (- (-> self clock frame-counter) (-> self blink-timer 0)) (seconds 1.2)) + (when (>= (- (current-time) (-> self blink-timer 0)) (seconds 1.2)) (logclear! (-> self flags) (simon-block-flags sbf0)) (set! (-> self draw color-mult quad) (-> self color quad)) ) @@ -1204,7 +1202,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self flags) (simon-block-flags sbf0 sbf1 sbf2 sbf5)) (set! (-> self move-rate) 122880.0) (none) @@ -1212,7 +1210,7 @@ This commonly includes things such as: :trans tomb-simon-block-trans :code (the-as (function none :behavior tomb-simon-block) sleep-code) :post (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) + (if (>= (- (current-time) (-> self state-time)) (the int (* 300.0 (+ (* 0.1 (the float (-> self order))) (* 0.015 (the float (-> self my-idx)))))) ) (tomb-simon-block-post) @@ -1233,7 +1231,7 @@ This commonly includes things such as: (go-virtual idle) ) (('touch 'ridden 'bonk 'edge-grabbed) - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (when (logtest? (-> self flags) (simon-block-flags sbf4)) (let* ((gp-0 *target*) (a0-10 (if (type? gp-0 process-focusable) @@ -1280,14 +1278,14 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self flags) (simon-block-flags sbf4)) - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (send-event (ppointer->process (-> self parent)) 'die-but (-> self my-idx)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 1)) + (when (>= (- (current-time) (-> self ride-timer)) (seconds 1)) (sound-play "tomb-simon-last") (go-virtual die) ) @@ -1346,7 +1344,7 @@ This commonly includes things such as: (go-virtual temporary) ) (('ridden) - (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (let ((v0-0 (the-as object (current-time)))) (set! (-> self ride-timer) (the-as time-frame v0-0)) v0-0 ) @@ -1355,7 +1353,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (none) ) :trans (behavior () @@ -1370,7 +1368,7 @@ This commonly includes things such as: (a0-3 (-> self root-override trans)) ) (when (and (or (< 16384.0 (fabs (- (-> a0-3 x) (-> v1-2 x)))) (< 16384.0 (fabs (- (-> a0-3 z) (-> v1-2 z))))) - (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 0.25)) + (>= (- (current-time) (-> self ride-timer)) (seconds 0.25)) ) (when (= (-> self next-idx) -1) (when (< (-> *event-queue* length) (-> *event-queue* allocated-length)) @@ -1412,7 +1410,7 @@ This commonly includes things such as: (('ridden) (when (not (logtest? (-> self flags) (simon-block-flags sbf2))) (logior! (-> self flags) (simon-block-flags sbf2)) - (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (let ((v0-0 (the-as object (current-time)))) (set! (-> self ride-timer) (the-as time-frame v0-0)) v0-0 ) @@ -1428,7 +1426,7 @@ This commonly includes things such as: ) :trans (behavior () (if (and (logtest? (-> self flags) (simon-block-flags sbf2)) - (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 0.5)) + (>= (- (current-time) (-> self ride-timer)) (seconds 0.5)) ) (go-virtual wobble-die) ) @@ -1472,14 +1470,14 @@ This commonly includes things such as: :virtual #t :code (behavior () (set! (-> self move-rate) (* 4096.0 (rand-vu-float-range 0.5 1.5))) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.25)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.25)) (suspend) ) ) (logclear! (-> self root-override root-prim prim-core action) (collide-action rideable)) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -1498,12 +1496,10 @@ This commonly includes things such as: ;; WARN: Return type mismatch time-frame vs none. (defmethod set-blink-timers! tomb-simon-block ((obj tomb-simon-block)) - (with-pp - (logior! (-> obj flags) (simon-block-flags sbf0 sbf1)) - (set! (-> obj blink-timer 0) (-> pp clock frame-counter)) - (set! (-> obj blink-timer 1) (-> pp clock frame-counter)) - (none) - ) + (logior! (-> obj flags) (simon-block-flags sbf0 sbf1)) + (set! (-> obj blink-timer 0) (current-time)) + (set! (-> obj blink-timer 1) (current-time)) + (none) ) (defmethod get-art-group tomb-simon-block ((obj tomb-simon-block)) @@ -1910,8 +1906,8 @@ This commonly includes things such as: ) ) ) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.45)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.45)) (suspend) ) ) @@ -2020,7 +2016,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self pat-entry-index) 0) (set-vector! (-> self draw color-mult) 0.9 0.9 0.9 1.0) (let ((gp-0 (-> self actor-group 0))) @@ -2063,8 +2059,8 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.2)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.2)) (suspend) ) ) @@ -2077,18 +2073,18 @@ This commonly includes things such as: 0.0 (+ (-> (the-as (pointer int32) (+ (the-as uint (-> self pat-tbl)) (* (-> self pat-index) 4)))) 18) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.2)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.2)) (suspend) ) ) (process-grab? *target* #f) - (let ((gp-2 (-> self clock frame-counter)) + (let ((gp-2 (current-time)) (s5-0 540) (f30-0 1.0) ) (ja-no-eval :group! (-> self draw art-group data 4) :num! (loop! f30-0) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-2) s5-0) + (until (>= (- (current-time) gp-2) s5-0) (suspend) (ja :num! (loop! f30-0)) ) @@ -2385,10 +2381,10 @@ This commonly includes things such as: (until #f (set! (-> self can-exit-running?) #f) (let ((gp-0 0) - (s5-0 (-> self clock frame-counter)) + (s5-0 (current-time)) ) - (until (>= (- (-> self clock frame-counter) s5-0) (-> self on-duration)) - (when (< (-> self harmless-time) (-> self clock frame-counter)) + (until (>= (- (current-time) s5-0) (-> self on-duration)) + (when (< (-> self harmless-time) (current-time)) (tomb-water-trap-method-22 self) (dotimes (s4-0 (+ (-> self path curve num-cverts) -1)) (let ((s3-0 (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (the float s4-0) 'interp)) @@ -2430,18 +2426,18 @@ This commonly includes things such as: ) (set! (-> self can-exit-running?) #t) (let ((gp-1 90)) - (let ((s5-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-1) gp-1) + (let ((s5-1 (current-time))) + (until (>= (- (current-time) s5-1) gp-1) (suspend) ) ) (let ((s5-2 #f) - (s4-2 (-> self clock frame-counter)) + (s4-2 (current-time)) ) - (until (>= (- (-> self clock frame-counter) s4-2) + (until (>= (- (current-time) s4-2) (the-as time-frame (- (- (-> self sync period) (the-as uint (-> self on-duration))) (the-as uint gp-1))) ) - (when (and (not s5-2) (>= (- (-> self clock frame-counter) s4-2) (seconds 0.3))) + (when (and (not s5-2) (>= (- (current-time) s4-2) (seconds 0.3))) (set! s5-2 #t) (set-tombc-electricity-scale! 0.0) ) @@ -2518,7 +2514,7 @@ This commonly includes things such as: (set! (-> a1-5 param 1) (the-as uint a0-17)) ) (if (send-event-function (-> s4-1 cshape process) a1-5) - (set! (-> obj harmless-time) (+ (-> pp clock frame-counter) (seconds 3))) + (set! (-> obj harmless-time) (+ (current-time) (seconds 3))) ) ) ) @@ -2700,11 +2696,11 @@ This commonly includes things such as: (defstate open (tomb-smash-door) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self timeout)) + (when (>= (- (current-time) (-> self state-time)) (-> self timeout)) (let* ((s5-0 *target*) (gp-0 (if (type? s5-0 process-focusable) s5-0 diff --git a/goal_src/jak2/levels/mars_tomb/widow-baron.gc b/goal_src/jak2/levels/mars_tomb/widow-baron.gc index 7517d207cb..579fab0a6e 100644 --- a/goal_src/jak2/levels/mars_tomb/widow-baron.gc +++ b/goal_src/jak2/levels/mars_tomb/widow-baron.gc @@ -129,7 +129,7 @@ (defmethod widow-rand-vector-method-10 widow-rand-vector ((obj widow-rand-vector)) (with-pp (set! (-> obj timer) - (- (the-as time-frame (-> obj timer)) (- (-> pp clock frame-counter) (-> pp clock old-frame-counter))) + (- (the-as time-frame (-> obj timer)) (- (current-time) (-> pp clock old-frame-counter))) ) (when (<= (-> obj timer) 0) (set! (-> obj timer) (rand-vu-int-range (-> obj min-time) (-> obj max-time))) @@ -360,84 +360,82 @@ ) (defmethod baron-pod-method-21 baron-pod ((obj baron-pod) (arg0 symbol)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> obj red-tip-change-time)) 0) - (set! (-> obj alt-red-tip-on) (not (-> obj alt-red-tip-on))) - (set! (-> obj red-tip-change-time) (+ (-> pp clock frame-counter) (seconds 0.5))) - (set! arg0 #t) - ) - (when (>= (- (-> pp clock frame-counter) (-> obj blink-time)) 0) - (set! (-> obj blink-mask) 0) - (dotimes (s5-0 10) - (let* ((f30-0 0.5) - (v1-17 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-18 (the-as number (logior #x3f800000 v1-17))) - ) - (if (< f30-0 (+ -1.0 (the-as float v1-18))) - (logior! (-> obj blink-mask) (ash 1 s5-0)) - ) - ) - ) - (set! (-> obj blink-time) (+ (-> pp clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.25 0.75))))) - (set! arg0 #t) - ) - (when arg0 - (remove-from-process *part-engine* obj) - (add-connection *part-engine* obj 13 obj 3264 (new 'static 'vector :w 819200.0)) - (add-connection *part-engine* obj 14 obj 3264 (new 'static 'vector :w 819200.0)) - (if (-> obj alt-red-tip-on) - (add-connection *part-engine* obj 5 obj 3251 (new 'static 'vector :w 819200.0)) - (add-connection *part-engine* obj 6 obj 3251 (new 'static 'vector :w 819200.0)) - ) - (let ((s5-2 (-> obj blink-mask))) - (if (logtest? s5-2 1) - (add-connection *part-engine* obj 8 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 2) - (add-connection *part-engine* obj 9 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 4) - (add-connection *part-engine* obj 10 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 8) - (add-connection *part-engine* obj 11 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 16) - (add-connection *part-engine* obj 12 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 32) - (add-connection *part-engine* obj 15 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 64) - (add-connection *part-engine* obj 16 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 128) - (add-connection *part-engine* obj 17 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 256) - (add-connection *part-engine* obj 18 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 512) - (add-connection *part-engine* obj 19 obj 3252 (new 'static 'vector :w 819200.0)) - ) - ) - (cond - ((-> obj has-stone) - (add-connection *part-engine* obj 4 obj 3258 (new 'static 'vector :y 4096.0 :w 819200.0)) - (add-connection *part-engine* obj 4 obj 3259 (new 'static 'vector :y 4096.0 :w 819200.0)) - ) - (else - (add-connection *part-engine* obj 4 obj 3256 (new 'static 'vector :y 4096.0 :w 819200.0)) - (add-connection *part-engine* obj 4 obj 3257 (new 'static 'vector :y 4096.0 :w 819200.0)) - ) - ) - ) - (if (-> obj has-stone) - (spawn (-> obj part) (-> obj root trans)) - ) - 0 - (none) + (when (>= (- (current-time) (-> obj red-tip-change-time)) 0) + (set! (-> obj alt-red-tip-on) (not (-> obj alt-red-tip-on))) + (set! (-> obj red-tip-change-time) (+ (current-time) (seconds 0.5))) + (set! arg0 #t) ) + (when (>= (- (current-time) (-> obj blink-time)) 0) + (set! (-> obj blink-mask) 0) + (dotimes (s5-0 10) + (let* ((f30-0 0.5) + (v1-17 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-18 (the-as number (logior #x3f800000 v1-17))) + ) + (if (< f30-0 (+ -1.0 (the-as float v1-18))) + (logior! (-> obj blink-mask) (ash 1 s5-0)) + ) + ) + ) + (set! (-> obj blink-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.25 0.75))))) + (set! arg0 #t) + ) + (when arg0 + (remove-from-process *part-engine* obj) + (add-connection *part-engine* obj 13 obj 3264 (new 'static 'vector :w 819200.0)) + (add-connection *part-engine* obj 14 obj 3264 (new 'static 'vector :w 819200.0)) + (if (-> obj alt-red-tip-on) + (add-connection *part-engine* obj 5 obj 3251 (new 'static 'vector :w 819200.0)) + (add-connection *part-engine* obj 6 obj 3251 (new 'static 'vector :w 819200.0)) + ) + (let ((s5-2 (-> obj blink-mask))) + (if (logtest? s5-2 1) + (add-connection *part-engine* obj 8 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 2) + (add-connection *part-engine* obj 9 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 4) + (add-connection *part-engine* obj 10 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 8) + (add-connection *part-engine* obj 11 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 16) + (add-connection *part-engine* obj 12 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 32) + (add-connection *part-engine* obj 15 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 64) + (add-connection *part-engine* obj 16 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 128) + (add-connection *part-engine* obj 17 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 256) + (add-connection *part-engine* obj 18 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 512) + (add-connection *part-engine* obj 19 obj 3252 (new 'static 'vector :w 819200.0)) + ) + ) + (cond + ((-> obj has-stone) + (add-connection *part-engine* obj 4 obj 3258 (new 'static 'vector :y 4096.0 :w 819200.0)) + (add-connection *part-engine* obj 4 obj 3259 (new 'static 'vector :y 4096.0 :w 819200.0)) + ) + (else + (add-connection *part-engine* obj 4 obj 3256 (new 'static 'vector :y 4096.0 :w 819200.0)) + (add-connection *part-engine* obj 4 obj 3257 (new 'static 'vector :y 4096.0 :w 819200.0)) + ) + ) + ) + (if (-> obj has-stone) + (spawn (-> obj part) (-> obj root trans)) + ) + 0 + (none) ) (defstate idle (baron-pod) diff --git a/goal_src/jak2/levels/mars_tomb/widow-extras.gc b/goal_src/jak2/levels/mars_tomb/widow-extras.gc index d4d506d9bd..12f0ccc64f 100644 --- a/goal_src/jak2/levels/mars_tomb/widow-extras.gc +++ b/goal_src/jak2/levels/mars_tomb/widow-extras.gc @@ -703,7 +703,7 @@ This commonly includes things such as: ) ) (('fizzle) - (let* ((gp-1 (-> self clock frame-counter)) + (let* ((gp-1 (current-time)) (f30-1 600.0) (v1-34 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-35 (the-as number (logior #x3f800000 v1-34))) @@ -745,7 +745,7 @@ This commonly includes things such as: ) ) (('fizzle) - (let* ((gp-1 (-> self clock frame-counter)) + (let* ((gp-1 (current-time)) (f30-0 600.0) (v1-34 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-35 (the-as number (logior #x3f800000 v1-34))) @@ -761,13 +761,11 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior widow-bomb) widow-bomb-back-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (if (and (nonzero? (-> self fizzle-timer)) - (>= (- (-> self clock frame-counter) (-> self fizzle-timer)) (seconds 3)) - ) + (if (and (nonzero? (-> self fizzle-timer)) (>= (- (current-time) (-> self fizzle-timer)) (seconds 3))) (go-virtual explode) ) (set! (-> self x-rotate) (+ 1092.2667 (-> self x-rotate))) @@ -775,7 +773,7 @@ This commonly includes things such as: (widow-bomb-method-34 self) (spawn-with-cspace (-> self part) (-> self node-list data 3)) (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + ((>= (- (current-time) (-> self state-time)) (seconds 4)) (go-virtual explode) ) (else @@ -804,7 +802,7 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior widow-bomb) widow-bomb-back-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (initialize (-> self impact) self @@ -819,16 +817,14 @@ This commonly includes things such as: (none) ) :trans (behavior () - (if (and (nonzero? (-> self fizzle-timer)) - (>= (- (-> self clock frame-counter) (-> self fizzle-timer)) (seconds 3)) - ) + (if (and (nonzero? (-> self fizzle-timer)) (>= (- (current-time) (-> self fizzle-timer)) (seconds 3))) (go-virtual explode) ) (set! (-> self x-rotate) (+ 4369.067 (-> self x-rotate))) (set! (-> self y-rotate) (+ 3458.8445 (-> self y-rotate))) (widow-bomb-method-34 self) (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (the int (-> self traj time))) + ((>= (- (current-time) (-> self state-time)) (the int (-> self traj time))) (compute-transv-at-time (-> self traj) (-> self traj time) (-> self root-override transv)) (vector-float*! (-> self root-override transv) (-> self root-override transv) 300.0) (go-virtual freefall) @@ -836,11 +832,11 @@ This commonly includes things such as: (else (compute-trans-at-time (-> self traj) - (the float (- (-> self clock frame-counter) (-> self state-time))) + (the float (- (current-time) (-> self state-time))) (-> self root-override trans) ) (update-from-cspace (-> self impact)) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) 1) + (when (>= (- (current-time) (-> self state-time)) 1) (let* ((a1-4 (new 'stack-no-clear 'collide-query)) (f0-10 (impact-control-method-11 (-> self impact) @@ -854,7 +850,7 @@ This commonly includes things such as: (set! (-> self root-override trans quad) (-> self impact trans 1 quad)) (compute-transv-at-time (-> self traj) - (the float (- (-> self clock frame-counter) (-> self state-time))) + (the float (- (current-time) (-> self state-time))) (-> self root-override transv) ) (vector-float*! (-> self root-override transv) (-> self root-override transv) 300.0) @@ -909,12 +905,12 @@ This commonly includes things such as: ) 0 (sound-play "w-bomb-explode") - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (cond - ((< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + ((< (- (current-time) (-> self state-time)) (seconds 2)) (let ((a1-0 (new 'stack-no-clear 'vector))) (set! (-> a1-0 quad) (-> self root-override trans quad)) (set! (-> a1-0 y) (+ 2048.0 (-> a1-0 y))) @@ -932,59 +928,55 @@ This commonly includes things such as: ) (defmethod widow-bomb-method-32 widow-bomb ((obj widow-bomb)) - (with-pp - (spawn-with-cspace (-> obj part) (-> obj node-list data 3)) - (sound-play "w-bomb-steam" :id (the-as sound-id (-> obj steam-sound)) :position (-> obj root-override trans)) - (let ((s5-0 (the-as int (- (-> pp clock frame-counter) (-> obj state-time))))) - (if (nonzero? (-> obj fizzle-timer)) - (set! s5-0 (max - (the-as time-frame s5-0) - (- (seconds 12) (- (seconds 3) (- (-> pp clock frame-counter) (-> obj fizzle-timer)))) - ) - ) - ) - (if (< 3600 s5-0) - (go (method-of-object obj explode)) - ) - (when (< 3000 s5-0) - (spawn-with-cspace (-> obj warning-spark-part) (-> obj node-list data 3)) - (when (not (-> obj firework-sound-played)) - (set! (-> obj firework-sound-played) #t) - (sound-play "w-bomb-firewrks") - ) + (spawn-with-cspace (-> obj part) (-> obj node-list data 3)) + (sound-play "w-bomb-steam" :id (the-as sound-id (-> obj steam-sound)) :position (-> obj root-override trans)) + (let ((s5-0 (the-as int (- (current-time) (-> obj state-time))))) + (if (nonzero? (-> obj fizzle-timer)) + (set! s5-0 + (max (the-as time-frame s5-0) (- (seconds 12) (- (seconds 3) (- (current-time) (-> obj fizzle-timer))))) + ) ) - (let* ((v1-27 (* s5-0 s5-0)) - (a0-10 3600) - (v1-28 (- (* a0-10 a0-10) v1-27)) - ) - (when (< v1-28 (-> obj next-countdown-tick)) - (let ((a0-14 540)) - (set! (-> obj next-countdown-tick) (the-as time-frame (- v1-28 (mod v1-28 (* a0-14 a0-14))))) - ) - (let ((s5-2 (new 'stack-no-clear 'vector))) - (vector<-cspace! s5-2 (-> obj node-list data 7)) - (spawn (-> obj warning-glow-part) s5-2) - (vector<-cspace! s5-2 (-> obj node-list data 6)) - (spawn (-> obj warning-glow-part) s5-2) - (vector<-cspace! s5-2 (-> obj node-list data 5)) - (spawn (-> obj warning-glow-part) s5-2) - (vector<-cspace! s5-2 (-> obj node-list data 4)) - (spawn (-> obj warning-glow-part) s5-2) - ) - (sound-play "w-bomb-timer") - ) + (if (< 3600 s5-0) + (go (method-of-object obj explode)) + ) + (when (< 3000 s5-0) + (spawn-with-cspace (-> obj warning-spark-part) (-> obj node-list data 3)) + (when (not (-> obj firework-sound-played)) + (set! (-> obj firework-sound-played) #t) + (sound-play "w-bomb-firewrks") + ) + ) + (let* ((v1-27 (* s5-0 s5-0)) + (a0-10 3600) + (v1-28 (- (* a0-10 a0-10) v1-27)) + ) + (when (< v1-28 (-> obj next-countdown-tick)) + (let ((a0-14 540)) + (set! (-> obj next-countdown-tick) (the-as time-frame (- v1-28 (mod v1-28 (* a0-14 a0-14))))) + ) + (let ((s5-2 (new 'stack-no-clear 'vector))) + (vector<-cspace! s5-2 (-> obj node-list data 7)) + (spawn (-> obj warning-glow-part) s5-2) + (vector<-cspace! s5-2 (-> obj node-list data 6)) + (spawn (-> obj warning-glow-part) s5-2) + (vector<-cspace! s5-2 (-> obj node-list data 5)) + (spawn (-> obj warning-glow-part) s5-2) + (vector<-cspace! s5-2 (-> obj node-list data 4)) + (spawn (-> obj warning-glow-part) s5-2) + ) + (sound-play "w-bomb-timer") ) ) - 0 - (none) ) + 0 + (none) ) (defstate smoke (widow-bomb) :virtual #t :event (the-as (function process int symbol event-message-block object :behavior widow-bomb) widow-bomb-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let* ((v1-2 3600) (v1-3 (* v1-2 v1-2)) (a0-0 540) @@ -1059,7 +1051,7 @@ This commonly includes things such as: ) ) ((= v1-0 'fizzle) - (let* ((gp-0 (-> self clock frame-counter)) + (let* ((gp-0 (current-time)) (f30-0 600.0) (v1-17 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-18 (the-as number (logior #x3f800000 v1-17))) @@ -1077,13 +1069,13 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (initialize (-> self impact) self 3 4096.0 (collide-spec backgnd obstacle hit-by-others-list player-list)) (none) ) :exit (behavior () (when (nonzero? (-> self fizzle-timer)) - (let* ((gp-0 (-> self clock frame-counter)) + (let* ((gp-0 (current-time)) (f30-0 600.0) (v1-4 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-5 (the-as number (logior #x3f800000 v1-4))) @@ -1122,17 +1114,17 @@ This commonly includes things such as: ) ) (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (the int (-> self traj time))) + ((>= (- (current-time) (-> self state-time)) (the int (-> self traj time))) (let ((v1-29 (-> self which-trajectory))) (cond ((zero? v1-29) (set! (-> self which-trajectory) 1) (compute-trans-at-time (-> self traj) - (fmin (-> self traj time) (the float (- (-> self clock frame-counter) (-> self state-time)))) + (fmin (-> self traj time) (the float (- (current-time) (-> self state-time)))) (-> self root-override trans) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self root-override trans) (the-as vector (-> self traj))))) (set! (-> gp-1 y) 0.0) (vector-normalize! gp-1 12288.0) @@ -1146,10 +1138,10 @@ This commonly includes things such as: (set! (-> self which-trajectory) 2) (compute-trans-at-time (-> self traj) - (fmin (-> self traj time) (the float (- (-> self clock frame-counter) (-> self state-time)))) + (fmin (-> self traj time) (the float (- (current-time) (-> self state-time)))) (-> self root-override trans) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-4 (vector-! (new 'stack-no-clear 'vector) (-> self root-override trans) (the-as vector (-> self traj))))) (set! (-> gp-4 y) 0.0) (vector-normalize! gp-4 4096.0) @@ -1162,7 +1154,7 @@ This commonly includes things such as: ((= v1-29 2) (compute-trans-at-time (-> self traj) - (fmin (-> self traj time) (the float (- (-> self clock frame-counter) (-> self state-time)))) + (fmin (-> self traj time) (the float (- (current-time) (-> self state-time)))) (-> self root-override trans) ) (set! (-> self which-trajectory) 3) @@ -1184,11 +1176,11 @@ This commonly includes things such as: ((< (-> self which-trajectory) 3) (compute-trans-at-time (-> self traj) - (fmin (-> self traj time) (the float (- (-> self clock frame-counter) (-> self state-time)))) + (fmin (-> self traj time) (the float (- (current-time) (-> self state-time)))) (-> self root-override trans) ) (when (and (zero? (-> self which-trajectory)) - (< (- (-> self clock frame-counter) (-> self state-time)) (the int (* 0.75 (-> self traj time)))) + (< (- (current-time) (-> self state-time)) (the int (* 0.75 (-> self traj time)))) ) (vector+float*! (-> self launch-pos) (-> self launch-pos) (-> self launch) (-> self clock time-adjust-ratio)) (vector-lerp! @@ -1196,14 +1188,14 @@ This commonly includes things such as: (-> self launch-pos) (-> self root-override trans) (parameter-ease-sin-clamp - (* 1.3333334 (/ (the float (- (-> self clock frame-counter) (-> self state-time))) (-> self traj time))) + (* 1.3333334 (/ (the float (- (current-time) (-> self state-time))) (-> self traj time))) ) ) ) (spawn-with-cspace (-> self trail-part) (-> self node-list data 3)) (when (zero? (-> self which-trajectory)) (update-from-cspace (-> self impact)) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.05)) (let ((f0-42 (impact-control-method-11 (-> self impact) (new 'stack-no-clear 'collide-query) @@ -1545,11 +1537,11 @@ This commonly includes things such as: :virtual #t :enter (behavior () (set! (-> self draw bounds w) 245760.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (if (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (< (- (current-time) (-> self state-time)) (seconds 1)) (spawn-with-cspace (-> self explode-part) (-> self node-list data 6)) ) (let ((v1-9 (ja-group))) @@ -1587,7 +1579,7 @@ This commonly includes things such as: ((>= (-> self segs-shot) 16) (go-virtual break-it) ) - ((>= (- (-> self clock frame-counter) (-> self last-pillar-hit)) (seconds 2)) + ((>= (- (current-time) (-> self last-pillar-hit)) (seconds 2)) (process-spawn part-tracker :init part-tracker-init @@ -1599,7 +1591,7 @@ This commonly includes things such as: 0 :to *entity-pool* ) - (set! (-> self last-pillar-hit) (-> self clock frame-counter)) + (set! (-> self last-pillar-hit) (current-time)) (sound-play "pillar-hit" :position (-> self root-override trans)) ) ) @@ -1614,7 +1606,7 @@ This commonly includes things such as: (set! (-> v1-3 prim-core collide-with) (collide-spec)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () diff --git a/goal_src/jak2/levels/mars_tomb/widow-more-extras.gc b/goal_src/jak2/levels/mars_tomb/widow-more-extras.gc index a60f7bde14..86346a3262 100644 --- a/goal_src/jak2/levels/mars_tomb/widow-more-extras.gc +++ b/goal_src/jak2/levels/mars_tomb/widow-more-extras.gc @@ -458,20 +458,18 @@ (defstate idle (cave-in-master) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (spawn (-> self part) (-> self root trans)) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) 0) + (when (>= (- (current-time) (-> self state-time)) 0) (let ((gp-0 (new 'stack-no-clear 'vector))) (cavein-get-random-point gp-0) (set! (-> gp-0 y) (+ 327680.0 (-> gp-0 y))) (process-spawn tomb-boss-debris gp-0 (rand-vu-int-count 8) :to self) ) - (set! (-> self state-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.1 0.5)))) - ) + (set! (-> self state-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.1 0.5))))) ) (none) ) diff --git a/goal_src/jak2/levels/nest/boss/metalkor-extras.gc b/goal_src/jak2/levels/nest/boss/metalkor-extras.gc index c5a361f8d5..4b836a4347 100644 --- a/goal_src/jak2/levels/nest/boss/metalkor-extras.gc +++ b/goal_src/jak2/levels/nest/boss/metalkor-extras.gc @@ -115,7 +115,7 @@ :virtual #t :event metalkor-egg-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -142,7 +142,7 @@ ((< f0-0 (* f1-0 f1-0)) (go-virtual idle) ) - ((>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + ((>= (- (current-time) (-> self state-time)) (seconds 4)) (go-virtual hatch) ) (else @@ -227,11 +227,11 @@ :virtual #t :event metalkor-egg-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (if (>= (- (current-time) (-> self state-time)) (seconds 3)) (go-virtual hatch) ) (let ((v1-9 (ja-group))) @@ -544,7 +544,7 @@ ) (defbehavior ik-adjust metalkor-legs () - (let* ((f0-1 (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (let* ((f0-1 (* 0.0033333334 (the float (- (current-time) (-> self state-time))))) (f0-2 (* 9102.223 f0-1)) (f0-3 (- f0-2 (* (the float (the int (/ f0-2 65536.0))) 65536.0))) (f0-4 (sin f0-3)) @@ -693,7 +693,7 @@ :virtual #t :event metalkor-legs-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (dotimes (gp-0 6) (enable-set! (-> self joint-ik gp-0) #t) ((method-of-type cam-float-seeker init) (the-as cam-float-seeker (-> self foot-locks gp-0)) 0.0 0.1 0.3 0.9) @@ -1391,7 +1391,7 @@ (set! (-> a1-14 param 1) (the-as uint v1-47)) ) (when (send-event-function proc a1-14) - (set! (-> self no-collision-timer) (-> self clock frame-counter)) + (set! (-> self no-collision-timer) (current-time)) (let ((v1-52 (-> self root-override root-prim))) (set! (-> v1-52 prim-core collide-as) (collide-spec)) (set! (-> v1-52 prim-core collide-with) (collide-spec)) @@ -1408,12 +1408,12 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-params! (-> self egg-toss-joint-angle) 0.0 0.05 0.3 0.9) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self no-collision-timer)) (seconds 0.1)) + (when (>= (- (current-time) (-> self no-collision-timer)) (seconds 0.1)) (let ((v1-5 (-> self root-override root-prim))) (set! (-> v1-5 prim-core collide-as) (-> self root-override backup-collide-as)) (set! (-> v1-5 prim-core collide-with) (-> self root-override backup-collide-with)) @@ -1749,7 +1749,7 @@ This commonly includes things such as: (set! (-> self chain joint-length) (* 12288.0 (-> self root scale y))) (set! (-> self root scale y) 1.0) (initialize-chain-joints (-> self chain)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let* ((f30-0 0.9) (f28-0 0.2) (v1-12 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) @@ -1777,7 +1777,7 @@ This commonly includes things such as: (quaternion-normalize! (-> self root quat)) (update (-> self chain) self) (cond - ((< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + ((< (- (current-time) (-> self state-time)) (seconds 1)) ) ((let ((v1-13 (ja-group))) (and v1-13 (= v1-13 (-> self draw art-group data 53))) diff --git a/goal_src/jak2/levels/nest/boss/metalkor-setup.gc b/goal_src/jak2/levels/nest/boss/metalkor-setup.gc index 8c01f33828..d58401341d 100644 --- a/goal_src/jak2/levels/nest/boss/metalkor-setup.gc +++ b/goal_src/jak2/levels/nest/boss/metalkor-setup.gc @@ -935,7 +935,7 @@ This commonly includes things such as: (cshape-reaction-update-state arg0 arg1 sv-16) (let ((s5-0 (-> arg0 process))) (cond - ((>= (- (-> self clock frame-counter) (-> (the-as metalkor-egg s5-0) sticky-time)) (seconds 0.05)) + ((>= (- (current-time) (-> (the-as metalkor-egg s5-0) sticky-time)) (seconds 0.05)) (let ((t9-1 vector--float*!) (a0-3 arg2) (a1-1 sv-16) @@ -996,7 +996,7 @@ This commonly includes things such as: ) ((let ((f1-6 4096.0)) (and (< (* f1-6 f1-6) f0-10) - (>= (- (-> self clock frame-counter) (-> (the-as metalkor-egg s5-0) sticky-time)) (seconds 0.2)) + (>= (- (current-time) (-> (the-as metalkor-egg s5-0) sticky-time)) (seconds 0.2)) ) ) (vector-float*! arg2 arg2 (/ 4096.0 (sqrtf f0-10))) diff --git a/goal_src/jak2/levels/nest/boss/metalkor-states.gc b/goal_src/jak2/levels/nest/boss/metalkor-states.gc index 963282d5af..dd175de90c 100644 --- a/goal_src/jak2/levels/nest/boss/metalkor-states.gc +++ b/goal_src/jak2/levels/nest/boss/metalkor-states.gc @@ -238,12 +238,10 @@ 0 ) ) - (if (and (nonzero? (-> self next-stage-timer)) - (>= (- (-> self clock frame-counter) (-> self next-stage-timer)) 0) - ) + (if (and (nonzero? (-> self next-stage-timer)) (>= (- (current-time) (-> self next-stage-timer)) 0)) (metalkor-go-next-stage) ) - (when (>= (- (-> self clock frame-counter) (-> self no-collision-timer)) (seconds 0.1)) + (when (>= (- (current-time) (-> self no-collision-timer)) (seconds 0.1)) (let ((v1-25 (-> self root-override root-prim))) (set! (-> v1-25 prim-core collide-as) (-> self root-override backup-collide-as)) (set! (-> v1-25 prim-core collide-with) (-> self root-override backup-collide-with)) @@ -742,7 +740,7 @@ (logtest? (penetrate dark-bomb) (-> (the-as attack-info s5-2) penetrate-using)) (= (-> self stage-hit-points) 0.0) ) - (set! v0-2 (the-as none (+ (-> self clock frame-counter) (seconds 1)))) + (set! v0-2 (the-as none (+ (current-time) (seconds 1)))) (set! (-> self next-stage-timer) (the-as time-frame v0-2)) v0-2 ) @@ -832,7 +830,7 @@ (set! (-> a1-43 param 1) (the-as uint v1-170)) ) (when (send-event-function gp-5 a1-43) - (set! (-> self no-collision-timer) (-> self clock frame-counter)) + (set! (-> self no-collision-timer) (current-time)) (let ((v1-175 (-> self root-override root-prim))) (set! (-> v1-175 prim-core collide-as) (collide-spec)) (set! (-> v1-175 prim-core collide-with) (collide-spec)) @@ -857,7 +855,7 @@ (when (not (handle->process (-> self flitters v1-3))) (new 'stack-no-clear 'vector) (let ((f0-1 (* 182.04445 (rand-vu-float-range 70.0 290.0)))) - (set! (-> self egg-timer) (-> self clock frame-counter)) + (set! (-> self egg-timer) (current-time)) (set! (-> self egg-angle) f0-1) (if (< 32768.0 f0-1) (send-event (handle->process (-> self lowtorso)) 'egg-toss 1.0) @@ -875,7 +873,7 @@ (if (zero? (-> self egg-timer)) (return #f) ) - (if (< (- (-> self clock frame-counter) (-> self egg-timer)) (seconds 0.2)) + (if (< (- (current-time) (-> self egg-timer)) (seconds 0.2)) (return #t) ) (dotimes (gp-0 10) @@ -1820,7 +1818,7 @@ :virtual #t :event metalkor-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (ja-channel-push! 1 (seconds 0.1)) (ja :group! (-> self draw art-group data 30) :num! min) (none) @@ -1876,7 +1874,7 @@ :virtual #t :event metalkor-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self min-state-hit-points) (+ -0.34 (-> self stage-hit-points))) (if (nonzero? (-> self neck)) (set! (-> self neck flex-blend) 0.0) @@ -1903,7 +1901,7 @@ (none) ) :trans (behavior () - (if (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (or (>= (- (current-time) (-> self state-time)) (seconds 1)) (>= (-> self min-state-hit-points) (-> self stage-hit-points)) ) (go-virtual overload-recover) @@ -1971,13 +1969,13 @@ (defstate play-drop-movie (metalkor) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (process-entity-status! self (entity-perm-status subtask-complete) #t) (process-spawn scene-player :init scene-player-init "nest-kor-boss-fight-mid" #t "nestb-boss") (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (deactivate self) ) (none) @@ -2013,7 +2011,7 @@ (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)) - (>= (+ (-> self clock frame-counter) (seconds -1.2)) (-> 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) @@ -2082,7 +2080,7 @@ (vector-normalize! s4-0 f0-12) ) ) - (if (and (< (+ (-> self clock frame-counter) (seconds -0.1)) (-> self previous-flat-travel-timer)) + (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) @@ -2090,11 +2088,11 @@ (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) (< (+ (-> self clock frame-counter) (seconds -0.1)) (-> self previous-flat-travel-timer))) + (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! (-> self previous-flat-travel-timer) (-> self clock frame-counter)) + (set! (-> self previous-flat-travel-timer) (current-time)) (if (zero? (-> self previous-flat-travel-long-timer)) - (set! (-> self previous-flat-travel-long-timer) (-> self clock frame-counter)) + (set! (-> self previous-flat-travel-long-timer) (current-time)) ) ) ) @@ -2289,12 +2287,12 @@ :virtual #t :event metalkor-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + ((>= (- (current-time) (-> self state-time)) (seconds 4)) (go-virtual chase-target) ) ((let ((f0-0 57344.0)) @@ -2334,7 +2332,7 @@ :virtual #t :event metalkor-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self shots-fired) 0) (set! (-> self current-nav-poly) (cloest-point-on-mesh (-> self nav) @@ -2368,12 +2366,10 @@ (sound-play "nboss-pre-shot") ) ) - (when (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.25)) - (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.75)) - (nonzero? (-> self shots-fired)) - ) + (when (or (>= (- (current-time) (-> self state-time)) (seconds 1.25)) + (and (>= (- (current-time) (-> self state-time)) (seconds 0.75)) (nonzero? (-> self shots-fired))) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (metalkor-shoot-projectile) (set-nestb-purple! (fmax 1.0 (get-nestb-purple))) (metalkor-ja-float-stop (the-as art-joint-anim (-> self draw art-group data 32))) @@ -2382,10 +2378,10 @@ ) (if (zero? (-> self shots-fired)) (set-nestb-purple! - (fmax (get-nestb-purple) (* 0.0013333333 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (fmax (get-nestb-purple) (* 0.0013333333 (the float (- (current-time) (-> self state-time))))) ) (set-nestb-purple! - (fmax (get-nestb-purple) (* 0.0022222223 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (fmax (get-nestb-purple) (* 0.0022222223 (the float (- (current-time) (-> self state-time))))) ) ) (metalkor-common) @@ -2403,7 +2399,7 @@ :virtual #t :event metalkor-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self current-nav-poly) (cloest-point-on-mesh (-> self nav) (-> self root-override trans) @@ -2416,7 +2412,7 @@ :trans (behavior () (let ((v1-2 (ja-group))) (when (and (not (and v1-2 (= v1-2 (-> self draw art-group data 33)))) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (>= (- (current-time) (-> self state-time)) (seconds 3)) ) (cond ((or (< (-> self last-standing-attack) -1) @@ -2519,7 +2515,7 @@ :virtual #t :event metalkor-handler :enter (behavior () - (set! (-> self shoot-timer) (-> self clock frame-counter)) + (set! (-> self shoot-timer) (current-time)) (set! (-> self shots-fired) 0) (set! (-> self wave-timer) 0) (set! (-> self in-wave) #f) @@ -2542,9 +2538,9 @@ (if (and (-> self in-wave) (= (-> self stage) 1)) (set! v1-0 3000) ) - (when (>= (- (-> self clock frame-counter) (-> self wave-timer)) v1-0) + (when (>= (- (current-time) (-> self wave-timer)) v1-0) (set! (-> self in-wave) (not (-> self in-wave))) - (set! (-> self wave-timer) (-> self clock frame-counter)) + (set! (-> self wave-timer) (current-time)) ) ) (cond @@ -2555,8 +2551,8 @@ (set! (-> self launching-wasps) #t) ) ) - (when (and (-> self launching-wasps) (>= (- (-> self clock frame-counter) (-> self wasp-timer)) (seconds 1.5))) - (set! (-> self wasp-timer) (-> self clock frame-counter)) + (when (and (-> self launching-wasps) (>= (- (current-time) (-> self wasp-timer)) (seconds 1.5))) + (set! (-> self wasp-timer) (current-time)) (dotimes (gp-0 3) (when (not (handle->process (-> self wasps gp-0))) (set! sv-16 (new 'static 'res-tag)) @@ -2626,31 +2622,31 @@ ) (rotate-and-update-hang-anim) (if (and (< 10922.667 (-> self target-angle)) - (< (- (-> self clock frame-counter) (-> self shoot-timer)) (seconds 3.75)) + (< (- (current-time) (-> self shoot-timer)) (seconds 3.75)) (zero? (mod (-> self shots-fired) (-> self stage))) ) (set! (-> self shoot-timer) - (the-as time-frame (max (-> self shoot-timer) (+ (-> self clock frame-counter) (seconds -2.75)))) + (the-as time-frame (max (-> self shoot-timer) (+ (current-time) (seconds -2.75)))) ) ) (cond ((metalkor-check-egg) - (set! (-> self shoot-timer) (-> self clock frame-counter)) + (set! (-> self shoot-timer) (current-time)) ) - ((or (>= (- (-> self clock frame-counter) (-> self shoot-timer)) (seconds 3.75)) + ((or (>= (- (current-time) (-> self shoot-timer)) (seconds 3.75)) (nonzero? (mod (-> self shots-fired) (-> self stage))) ) - (set! (-> self flitter-timer) (-> self clock frame-counter)) + (set! (-> self flitter-timer) (current-time)) (spawn (-> self shot-anticipate) (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 7))) (if (zero? (mod (-> self shots-fired) (-> self stage))) (set-nestb-purple! (fmax (get-nestb-purple) - (* 0.0013333333 (the float (+ (- (seconds -3.75) (-> self shoot-timer)) (-> self clock frame-counter)))) + (* 0.0013333333 (the float (+ (- (seconds -3.75) (-> self shoot-timer)) (current-time)))) ) ) (set-nestb-purple! - (fmax (get-nestb-purple) (* 0.0022222223 (the float (- (-> self clock frame-counter) (-> self shoot-timer))))) + (fmax (get-nestb-purple) (* 0.0022222223 (the float (- (current-time) (-> self shoot-timer))))) ) ) (let* ((v1-123 (the-as art-joint-anim (-> self draw art-group data 23))) @@ -2664,12 +2660,12 @@ (sound-play "nboss-pre-shot") ) ) - (when (or (>= (- (-> self clock frame-counter) (-> self shoot-timer)) (seconds 5)) - (and (>= (- (-> self clock frame-counter) (-> self shoot-timer)) (seconds 0.75)) + (when (or (>= (- (current-time) (-> self shoot-timer)) (seconds 5)) + (and (>= (- (current-time) (-> self shoot-timer)) (seconds 0.75)) (nonzero? (mod (-> self shots-fired) (-> self stage))) ) ) - (set! (-> self shoot-timer) (-> self clock frame-counter)) + (set! (-> self shoot-timer) (current-time)) (metalkor-shoot-projectile) (set-nestb-purple! (fmax 1.0 (get-nestb-purple))) (metalkor-ja-float-stop (the-as art-joint-anim (-> self draw art-group data 23))) @@ -2678,11 +2674,9 @@ (metalkor-all-spinners-on) ) ) - ((and (-> self launching-flitters) - (>= (+ (-> self clock frame-counter) (seconds -0.5)) (-> self flitter-timer)) - ) - (set! (-> self flitter-timer) (-> self clock frame-counter)) - (set! (-> self shoot-timer) (-> self clock frame-counter)) + ((and (-> self launching-flitters) (>= (+ (current-time) (seconds -0.5)) (-> self flitter-timer))) + (set! (-> self flitter-timer) (current-time)) + (set! (-> self shoot-timer) (current-time)) (metalkor-start-egg) ) ) @@ -2724,7 +2718,7 @@ :virtual #t :event metalkor-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self current-nav-poly) (cloest-point-on-mesh (-> self nav) (-> self root-override trans) @@ -2743,7 +2737,7 @@ (vf2 :class vf) ) (init-vf0-vector) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.017)) (cpad-hold? 1 x)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.017)) (cpad-hold? 1 x)) (go-virtual test) ) (let ((s4-0 (new-stack-vector0)) @@ -2764,7 +2758,7 @@ (matrix->quaternion (-> self root-override quat) s1-0) (quaternion-normalize! (-> self root-override quat)) (when (and (nonzero? (-> self previous-flat-travel-long-timer)) - (>= (+ (-> self clock frame-counter) (seconds -1.2)) (-> 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) @@ -2792,7 +2786,7 @@ (vector-normalize! s5-1 f0-9) ) ) - (if (and (< (+ (-> self clock frame-counter) (seconds -0.1)) (-> self previous-flat-travel-timer)) + (if (and (< (+ (current-time) (seconds -0.1)) (-> self previous-flat-travel-timer)) (< (vector-dot s5-1 (-> self previous-flat-travel)) 0.0) ) (vector-negate! s5-1 s5-1) @@ -2800,11 +2794,11 @@ (set! (-> s4-1 x) (-> s3-0 intersection x)) (set! (-> s4-1 z) (-> s3-0 intersection z)) (vector-! s4-1 s4-1 (-> s3-0 boundary-normal)) - (when (or (> s2-1 0) (< (+ (-> self clock frame-counter) (seconds -0.1)) (-> self previous-flat-travel-timer))) + (when (or (> s2-1 0) (< (+ (current-time) (seconds -0.1)) (-> self previous-flat-travel-timer))) (set! (-> self previous-flat-travel quad) (-> s5-1 quad)) - (set! (-> self previous-flat-travel-timer) (-> self clock frame-counter)) + (set! (-> self previous-flat-travel-timer) (current-time)) (if (zero? (-> self previous-flat-travel-long-timer)) - (set! (-> self previous-flat-travel-long-timer) (-> self clock frame-counter)) + (set! (-> self previous-flat-travel-long-timer) (current-time)) ) ) ) diff --git a/goal_src/jak2/levels/nest/boss/nestb-scenes.gc b/goal_src/jak2/levels/nest/boss/nestb-scenes.gc index ace5c5be12..f5f999d621 100644 --- a/goal_src/jak2/levels/nest/boss/nestb-scenes.gc +++ b/goal_src/jak2/levels/nest/boss/nestb-scenes.gc @@ -20,14 +20,14 @@ (set! (-> a1-0 message) 'test-pickup) (set! (-> a1-0 param 0) (the-as uint 7)) (let ((f30-0 (send-event-function *target* a1-0))) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.1)) (suspend) ) ) (send-event *target* 'change-mode 'darkjak #f 64) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.1)) (suspend) ) ) diff --git a/goal_src/jak2/levels/nest/flying-spider.gc b/goal_src/jak2/levels/nest/flying-spider.gc index fcdbe3c362..6f692746bc 100644 --- a/goal_src/jak2/levels/nest/flying-spider.gc +++ b/goal_src/jak2/levels/nest/flying-spider.gc @@ -575,7 +575,7 @@ :event (the-as (function process int symbol event-message-block object :behavior flying-spider) enemy-event-handler) :enter (behavior () (dispose! self) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self hit-points) 0) (enemy-method-103 self) (none) @@ -695,48 +695,46 @@ ;; WARN: Return type mismatch symbol vs pat-surface. (defmethod enemy-method-125 flying-spider ((obj flying-spider) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) - (with-pp - (the-as - pat-surface - (when (find-ground (-> obj root-override2) arg0 arg1 arg2 arg3 arg4) - (set! (-> obj root-override2 ground-pat) (-> arg0 best-other-tri pat)) - (when (>= (- (-> pp clock frame-counter) (-> obj gspot-timer)) (seconds 0.2)) - (let ((a1-2 (new 'stack-no-clear 'collide-query))) - (set! (-> a1-2 start-pos quad) (-> obj root-override2 gspot-pos quad)) - (set! (-> a1-2 start-pos y) (+ 2048.0 (-> a1-2 start-pos y))) - (set-vector! (-> a1-2 move-dist) 0.0 -6144.0 0.0 0.0) - (let ((v1-10 a1-2)) - (set! (-> v1-10 radius) 4915.2) - (set! (-> v1-10 collide-with) arg1) - (set! (-> v1-10 ignore-process0) obj) - (set! (-> v1-10 ignore-process1) #f) - (set! (-> v1-10 ignore-pat) (-> obj root-override2 pat-ignore-mask)) - (set! (-> v1-10 action-mask) (collide-action solid)) - ) - (fill-using-line-sphere *collide-cache* a1-2) + (the-as + pat-surface + (when (find-ground (-> obj root-override2) arg0 arg1 arg2 arg3 arg4) + (set! (-> obj root-override2 ground-pat) (-> arg0 best-other-tri pat)) + (when (>= (- (current-time) (-> obj gspot-timer)) (seconds 0.2)) + (let ((a1-2 (new 'stack-no-clear 'collide-query))) + (set! (-> a1-2 start-pos quad) (-> obj root-override2 gspot-pos quad)) + (set! (-> a1-2 start-pos y) (+ 2048.0 (-> a1-2 start-pos y))) + (set-vector! (-> a1-2 move-dist) 0.0 -6144.0 0.0 0.0) + (let ((v1-10 a1-2)) + (set! (-> v1-10 radius) 4915.2) + (set! (-> v1-10 collide-with) arg1) + (set! (-> v1-10 ignore-process0) obj) + (set! (-> v1-10 ignore-process1) #f) + (set! (-> v1-10 ignore-pat) (-> obj root-override2 pat-ignore-mask)) + (set! (-> v1-10 action-mask) (collide-action solid)) ) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (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)))) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (vector-normalize! s2-1 1.0) - (vector-normalize! s1-1 1.0) - (vector-cross! s3-0 s2-1 s1-1) - (if (< (cos 10922.667) (vector-dot s3-0 *y-vector*)) - (vector+! s5-1 s5-1 s3-0) - ) - ) - ) - (vector-normalize-copy! (-> obj gspot-normal) s5-1 1.0) - ) - (set! (-> obj gspot-timer) (-> pp clock frame-counter)) + (fill-using-line-sphere *collide-cache* a1-2) ) - #t + (let ((s5-1 (new 'stack-no-clear 'vector))) + (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)))) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (vector-normalize! s2-1 1.0) + (vector-normalize! s1-1 1.0) + (vector-cross! s3-0 s2-1 s1-1) + (if (< (cos 10922.667) (vector-dot s3-0 *y-vector*)) + (vector+! s5-1 s5-1 s3-0) + ) + ) + ) + (vector-normalize-copy! (-> obj gspot-normal) s5-1 1.0) + ) + (set! (-> obj gspot-timer) (current-time)) ) + #t ) ) ) diff --git a/goal_src/jak2/levels/nest/mammoth.gc b/goal_src/jak2/levels/nest/mammoth.gc index fc873f652b..3a15090e35 100644 --- a/goal_src/jak2/levels/nest/mammoth.gc +++ b/goal_src/jak2/levels/nest/mammoth.gc @@ -494,8 +494,8 @@ (ja :num! (seek!)) ) (mammoth-walk-check-end) - (when (>= (- (-> self clock frame-counter) (-> self attack-timer)) (seconds 5)) - (set! (-> self attack-timer) (-> self clock frame-counter)) + (when (>= (- (current-time) (-> self attack-timer)) (seconds 5)) + (set! (-> self attack-timer) (current-time)) (go-virtual walking-attack) ) ) @@ -510,7 +510,7 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('event-attack) - (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (let ((v0-0 (the-as object (current-time)))) (set! (-> self lightning-timer) (the-as time-frame v0-0)) v0-0 ) @@ -538,15 +538,11 @@ (none) ) :trans (behavior () - (when (and (< (- (-> self clock frame-counter) (-> self lightning-timer)) (seconds 3)) - (< (-> self spawn-timer) (-> self clock frame-counter)) - ) + (when (and (< (- (current-time) (-> self lightning-timer)) (seconds 3)) (< (-> self spawn-timer) (current-time))) (let ((s5-0 *mammoth-lightning-joint-tbl*)) (mammoth-method-185 self (-> self root-override2 trans) (-> s5-0 (get-rand-int self (-> s5-0 length)))) ) - (set! (-> self spawn-timer) - (+ (-> self clock frame-counter) (the int (* 300.0 (get-rand-float-range self 0.0 0.1)))) - ) + (set! (-> self spawn-timer) (+ (current-time) (the int (* 300.0 (get-rand-float-range self 0.0 0.1))))) ) (none) ) @@ -573,8 +569,8 @@ (ja :num! (seek! max 0.8)) ) (mammoth-walk-check-end) - (when (>= (- (-> self clock frame-counter) (-> self attack-timer)) (seconds 3)) - (set! (-> self attack-timer) (-> self clock frame-counter)) + (when (>= (- (current-time) (-> self attack-timer)) (seconds 3)) + (set! (-> self attack-timer) (current-time)) (go-virtual walking) ) ) @@ -1474,8 +1470,8 @@ (when (logtest? (ash 1 v1-37) (-> obj foot-flags)) ) ) - (when (and (< (- (-> pp clock frame-counter) (-> obj lightning-timer)) (seconds 3)) - (< (-> obj lightning-attack-timer) (-> pp clock frame-counter)) + (when (and (< (- (current-time) (-> obj lightning-timer)) (seconds 3)) + (< (-> obj lightning-attack-timer) (current-time)) ) (let ((s5-2 *target*)) (when s5-2 @@ -1568,7 +1564,7 @@ ) ) (set! (-> obj lightning-attack-timer) - (+ (-> pp clock frame-counter) (the int (* 300.0 (get-rand-float-range obj 0.067 0.1)))) + (+ (current-time) (the int (* 300.0 (get-rand-float-range obj 0.067 0.1)))) ) ) ) @@ -1696,92 +1692,90 @@ (defmethod init-enemy! mammoth ((obj mammoth)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (with-pp - (initialize-skeleton - obj - (the-as skeleton-group (art-group-get-by-name *level* "skel-mammoth" (the-as (pointer uint32) #f))) - (the-as pair 0) - ) - (init-enemy-behaviour-and-stats! obj *mammoth-nav-enemy-info*) - (logclear! (-> obj mask) (process-mask actor-pause)) - (set-vector! (-> obj root-override2 scale) 1.5 1.5 1.5 1.0) - (set! (-> obj y-level) -40959590.0) - (set! (-> obj foot-flags) (the-as uint 0)) - (set! (-> obj old-foot-flags) (the-as uint 0)) - (set! (-> obj attack-timer) (-> pp clock frame-counter)) - (set! (-> obj spawn-timer) 0) - (set! (-> obj my-up-vector quad) (-> *y-vector* quad)) - (quaternion-copy! (-> obj my-up-quat) *unity-quaternion*) - (set! (-> obj gspot-timer) 0) - (set! (-> obj gspot-normal quad) (-> *y-vector* quad)) - (set! (-> obj align) (new 'process 'align-control obj)) - (dotimes (s5-1 4) - (set! (-> obj joint-ik s5-1) (new - 'process - 'joint-mod-ik - obj - (-> *mammoth-ik-setup* s5-1 elbow-index) - (-> *mammoth-ik-setup* s5-1 hand-dist) - ) - ) - (set! (-> obj joint-ik s5-1 elbow-pole-vector-axis) (the-as uint 2)) - (set! (-> obj joint-ik s5-1 elbow-rotation-axis) (the-as uint 0)) - (set! (-> obj joint-ik 0 callback) mammoth-leg-ik-callback) - ) - (logior! (-> obj joint-ik 1 flags) (joint-mod-ik-flags elbow-trans-neg)) - (logior! (-> obj joint-ik 2 flags) (joint-mod-ik-flags elbow-trans-neg)) - (logior! (-> obj joint-ik 0 flags) (joint-mod-ik-flags elbow-rot-neg)) - (logior! (-> obj joint-ik 1 flags) (joint-mod-ik-flags elbow-rot-neg)) - (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) - (set! (-> obj path-pos) 0.0) - (set! (-> obj path-index) 0) - (set! (-> obj path-index-dir) 1) - (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) - (get-point-in-path! (-> obj path) (-> obj root-override2 trans) 0.0 'interp) - (set! (-> obj move-pos 0 quad) (-> obj root-override2 trans quad)) - (set! (-> obj move-pos 1 quad) (-> obj root-override2 trans quad)) - (forward-up-nopitch->quaternion - (-> obj root-override2 quat) - (vector-! - (new 'stack-no-clear 'vector) - (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) (the float (+ (-> obj path-index) 1)) 'interp) - (-> obj root-override2 trans) - ) - *up-vector* - ) - (quaternion-copy! (-> obj tilt-quat) *unity-quaternion*) - (let ((a0-38 (-> obj node-list data 4))) - (set! (-> a0-38 param0) mammoth-joint-mod-tilt) - (set! (-> a0-38 param1) obj) - ) - (let ((a0-39 (-> obj node-list data 10))) - (set! (-> a0-39 param0) mammoth-joint-mod-heel) - (set! (-> a0-39 param1) obj) - (set! (-> a0-39 param2) (the-as basic 0)) - ) - (let ((v1-61 (-> obj node-list data 13))) - (set! (-> v1-61 param0) mammoth-joint-mod-heel) - (set! (-> v1-61 param1) obj) - (set! (-> v1-61 param2) (the-as basic 1)) - ) - (let ((v1-63 (-> obj node-list data 25))) - (set! (-> v1-63 param0) mammoth-joint-mod-heel) - (set! (-> v1-63 param1) obj) - (set! (-> v1-63 param2) (the-as basic 2)) - ) - (let ((v1-65 (-> obj node-list data 28))) - (set! (-> v1-65 param0) mammoth-joint-mod-heel) - (set! (-> v1-65 param1) obj) - (set! (-> v1-65 param2) (the-as basic 3)) - ) - (dotimes (v1-66 4) - (set! (-> obj heel-lerp v1-66) 0.0) - ) - (set! (-> obj lightning-timer) 0) - (set! (-> obj lightning-attack-timer) 0) - (set! (-> obj feet-ik-init-timer) (-> pp clock frame-counter)) - (logclear! (-> obj enemy-flags) (enemy-flag check-water-backup)) - 0 - (none) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-mammoth" (the-as (pointer uint32) #f))) + (the-as pair 0) ) + (init-enemy-behaviour-and-stats! obj *mammoth-nav-enemy-info*) + (logclear! (-> obj mask) (process-mask actor-pause)) + (set-vector! (-> obj root-override2 scale) 1.5 1.5 1.5 1.0) + (set! (-> obj y-level) -40959590.0) + (set! (-> obj foot-flags) (the-as uint 0)) + (set! (-> obj old-foot-flags) (the-as uint 0)) + (set! (-> obj attack-timer) (current-time)) + (set! (-> obj spawn-timer) 0) + (set! (-> obj my-up-vector quad) (-> *y-vector* quad)) + (quaternion-copy! (-> obj my-up-quat) *unity-quaternion*) + (set! (-> obj gspot-timer) 0) + (set! (-> obj gspot-normal quad) (-> *y-vector* quad)) + (set! (-> obj align) (new 'process 'align-control obj)) + (dotimes (s5-1 4) + (set! (-> obj joint-ik s5-1) (new + 'process + 'joint-mod-ik + obj + (-> *mammoth-ik-setup* s5-1 elbow-index) + (-> *mammoth-ik-setup* s5-1 hand-dist) + ) + ) + (set! (-> obj joint-ik s5-1 elbow-pole-vector-axis) (the-as uint 2)) + (set! (-> obj joint-ik s5-1 elbow-rotation-axis) (the-as uint 0)) + (set! (-> obj joint-ik 0 callback) mammoth-leg-ik-callback) + ) + (logior! (-> obj joint-ik 1 flags) (joint-mod-ik-flags elbow-trans-neg)) + (logior! (-> obj joint-ik 2 flags) (joint-mod-ik-flags elbow-trans-neg)) + (logior! (-> obj joint-ik 0 flags) (joint-mod-ik-flags elbow-rot-neg)) + (logior! (-> obj joint-ik 1 flags) (joint-mod-ik-flags elbow-rot-neg)) + (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) + (set! (-> obj path-pos) 0.0) + (set! (-> obj path-index) 0) + (set! (-> obj path-index-dir) 1) + (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) + (get-point-in-path! (-> obj path) (-> obj root-override2 trans) 0.0 'interp) + (set! (-> obj move-pos 0 quad) (-> obj root-override2 trans quad)) + (set! (-> obj move-pos 1 quad) (-> obj root-override2 trans quad)) + (forward-up-nopitch->quaternion + (-> obj root-override2 quat) + (vector-! + (new 'stack-no-clear 'vector) + (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) (the float (+ (-> obj path-index) 1)) 'interp) + (-> obj root-override2 trans) + ) + *up-vector* + ) + (quaternion-copy! (-> obj tilt-quat) *unity-quaternion*) + (let ((a0-38 (-> obj node-list data 4))) + (set! (-> a0-38 param0) mammoth-joint-mod-tilt) + (set! (-> a0-38 param1) obj) + ) + (let ((a0-39 (-> obj node-list data 10))) + (set! (-> a0-39 param0) mammoth-joint-mod-heel) + (set! (-> a0-39 param1) obj) + (set! (-> a0-39 param2) (the-as basic 0)) + ) + (let ((v1-61 (-> obj node-list data 13))) + (set! (-> v1-61 param0) mammoth-joint-mod-heel) + (set! (-> v1-61 param1) obj) + (set! (-> v1-61 param2) (the-as basic 1)) + ) + (let ((v1-63 (-> obj node-list data 25))) + (set! (-> v1-63 param0) mammoth-joint-mod-heel) + (set! (-> v1-63 param1) obj) + (set! (-> v1-63 param2) (the-as basic 2)) + ) + (let ((v1-65 (-> obj node-list data 28))) + (set! (-> v1-65 param0) mammoth-joint-mod-heel) + (set! (-> v1-65 param1) obj) + (set! (-> v1-65 param2) (the-as basic 3)) + ) + (dotimes (v1-66 4) + (set! (-> obj heel-lerp v1-66) 0.0) + ) + (set! (-> obj lightning-timer) 0) + (set! (-> obj lightning-attack-timer) 0) + (set! (-> obj feet-ik-init-timer) (current-time)) + (logclear! (-> obj enemy-flags) (enemy-flag check-water-backup)) + 0 + (none) ) diff --git a/goal_src/jak2/levels/nest/mantis.gc b/goal_src/jak2/levels/nest/mantis.gc index 3dedd6de10..e7b54b049d 100644 --- a/goal_src/jak2/levels/nest/mantis.gc +++ b/goal_src/jak2/levels/nest/mantis.gc @@ -543,14 +543,14 @@ ) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.6)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.6)) (suspend) ) ) (logior! (-> self draw status) (draw-control-status no-draw)) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) (suspend) ) ) @@ -605,7 +605,7 @@ ) 0 (look-at-target! self (enemy-flag lock-focus)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self root-override2 trans y) (+ -18841.6 (-> self base-height))) (let ((gp-0 (-> self root-override2))) (let ((v1-11 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> gp-0 quat)))) @@ -668,8 +668,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (if (logtest? (-> self root-override2 status) (collide-status on-ground)) (goto cfg-32) ) @@ -726,7 +726,7 @@ (let ((f30-1 (vector-length s5-1))) (when (not (logtest? (-> self flags) (mantis-flag tracked))) (cond - ((< (- (-> self clock frame-counter) (-> self attack-timer)) (seconds 5)) + ((< (- (current-time) (-> self attack-timer)) (seconds 5)) (if (and (< 73728.0 f30-1) (mantis-method-194 self)) (go-virtual crawl) ) @@ -739,7 +739,7 @@ (when (and (and gp-0 (not (logtest? (-> (the-as process-focusable gp-0) focus-status) (focus-status disable dead ignore grabbed))) ) - (and (>= (- (-> self clock frame-counter) (-> self attack-timer)) (seconds 5)) + (and (>= (- (current-time) (-> self attack-timer)) (seconds 5)) (enemy-method-95 self s4-0 8192.0) (< f30-1 32768.0) ) @@ -775,7 +775,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior mantis) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (change-to (nav-mesh-from-res-tag (-> self entity) 'nav-mesh-actor 1) self) (nav-enemy-method-166 self) (let ((v1-6 (-> self nav))) @@ -895,9 +895,7 @@ (suspend) (ja :num! (seek!)) ) - (if (and (>= (- (-> self clock frame-counter) (-> self attack-timer)) (seconds 5)) - (< 1 (the-as int (-> self focus aware))) - ) + (if (and (>= (- (current-time) (-> self attack-timer)) (seconds 5)) (< 1 (the-as int (-> self focus aware)))) (go-virtual hostile) ) (if (< (vector-vector-xz-distance (-> self root-override2 trans) (-> self move-dest)) 13107.2) @@ -916,7 +914,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior mantis) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -925,7 +923,7 @@ (set! (-> v1-2 nav callback-info) (-> v1-2 enemy-info-override callback-info)) ) 0 - (set! (-> self attack-timer) (-> self clock frame-counter)) + (set! (-> self attack-timer) (current-time)) (none) ) :exit (behavior () @@ -985,8 +983,8 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior mantis) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self attack-timer) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self attack-timer) (current-time)) (none) ) :exit (behavior () @@ -1187,7 +1185,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior mantis) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (look-at-target! self (enemy-flag lock-focus)) (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (let ((v1-6 self)) @@ -1204,7 +1202,7 @@ ) 0 (logclear! (-> self mask) (process-mask actor-pause)) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) (none) ) :trans (behavior () @@ -1249,7 +1247,7 @@ (go-virtual crawl) ) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (if (and (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (>= (the-as int (-> self focus aware)) 3) (get-enemy-target self) ) @@ -1278,73 +1276,71 @@ (defmethod general-event-handler mantis ((obj mantis) (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" - (with-pp - (case arg2 - (('track) - (if (and (-> arg3 param 0) (>= (- (-> pp clock frame-counter) (-> obj track-timer)) (seconds 0.5))) - 'abort - #t - ) - ) - (('tracked) - (logior! (-> obj flags) (mantis-flag tracked)) - (let ((v0-0 (the-as object (-> pp clock frame-counter)))) - (set! (-> obj track-timer) (the-as time-frame v0-0)) - v0-0 + (case arg2 + (('track) + (if (and (-> arg3 param 0) (>= (- (current-time) (-> obj track-timer)) (seconds 0.5))) + 'abort + #t ) + ) + (('tracked) + (logior! (-> obj flags) (mantis-flag tracked)) + (let ((v0-0 (the-as object (current-time)))) + (set! (-> obj track-timer) (the-as time-frame v0-0)) + v0-0 ) - (('hit 'hit-knocked) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) - (logior! (-> obj focus-status) (focus-status hit)) - (if (zero? (-> obj hit-points)) - (logior! (-> obj focus-status) (focus-status dead)) - ) - (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) - (enemy-method-62 obj) - (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (process-contact-action arg0) - (send-event arg0 'get-attack-count 1) - (cond - ((zero? (-> obj hit-points)) - (let ((s5-1 (-> obj incoming knocked-type))) - (cond - ((and (= s5-1 (knocked-type knocked-type-4)) - (not (and (-> obj next-state) (let ((v1-41 (-> obj next-state name))) - (or (= v1-41 'knocked) (= v1-41 'jump) (= v1-41 'jump-land)) - ) - ) - ) - (zero? (get-rand-int obj 3)) - (let ((f0-0 (vector-vector-distance-squared (-> obj root-override2 trans) (target-pos 0))) - (f1-0 32768.0) - ) - (>= f0-0 (* f1-0 f1-0)) - ) + ) + (('hit 'hit-knocked) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) + ) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (process-contact-action arg0) + (send-event arg0 'get-attack-count 1) + (cond + ((zero? (-> obj hit-points)) + (let ((s5-1 (-> obj incoming knocked-type))) + (cond + ((and (= s5-1 (knocked-type knocked-type-4)) + (not (and (-> obj next-state) (let ((v1-41 (-> obj next-state name))) + (or (= v1-41 'knocked) (= v1-41 'jump) (= v1-41 'jump-land)) + ) + ) + ) + (zero? (get-rand-int obj 3)) + (let ((f0-0 (vector-vector-distance-squared (-> obj root-override2 trans) (target-pos 0))) + (f1-0 32768.0) + ) + (>= f0-0 (* f1-0 f1-0)) ) - (kill-prefer-falling obj) - ) - ((or (= s5-1 (knocked-type knocked-type-4)) (= s5-1 (knocked-type knocked-type-6))) - (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) - (go (method-of-object obj knocked)) - ) - (else - (go (method-of-object obj knocked)) - ) + ) + (kill-prefer-falling obj) + ) + ((or (= s5-1 (knocked-type knocked-type-4)) (= s5-1 (knocked-type knocked-type-6))) + (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) + (go (method-of-object obj knocked)) + ) + (else + (go (method-of-object obj knocked)) ) ) ) - (else - (go (method-of-object obj knocked)) - ) - ) - #t - ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) + (else + (go (method-of-object obj knocked)) + ) + ) + #t + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1427,48 +1423,46 @@ ;; WARN: Return type mismatch symbol vs pat-surface. (defmethod enemy-method-125 mantis ((obj mantis) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) - (with-pp - (the-as - pat-surface - (when (find-ground (-> obj root-override2) arg0 arg1 arg2 arg3 arg4) - (set! (-> obj root-override2 ground-pat) (-> arg0 best-other-tri pat)) - (when (>= (- (-> pp clock frame-counter) (-> obj gspot-timer)) (seconds 0.2)) - (let ((a1-2 (new 'stack-no-clear 'collide-query))) - (set! (-> a1-2 start-pos quad) (-> obj root-override2 gspot-pos quad)) - (set! (-> a1-2 start-pos y) (+ 2048.0 (-> a1-2 start-pos y))) - (set-vector! (-> a1-2 move-dist) 0.0 -6144.0 0.0 0.0) - (let ((v1-10 a1-2)) - (set! (-> v1-10 radius) 4915.2) - (set! (-> v1-10 collide-with) arg1) - (set! (-> v1-10 ignore-process0) obj) - (set! (-> v1-10 ignore-process1) #f) - (set! (-> v1-10 ignore-pat) (-> obj root-override2 pat-ignore-mask)) - (set! (-> v1-10 action-mask) (collide-action solid)) - ) - (fill-using-line-sphere *collide-cache* a1-2) + (the-as + pat-surface + (when (find-ground (-> obj root-override2) arg0 arg1 arg2 arg3 arg4) + (set! (-> obj root-override2 ground-pat) (-> arg0 best-other-tri pat)) + (when (>= (- (current-time) (-> obj gspot-timer)) (seconds 0.2)) + (let ((a1-2 (new 'stack-no-clear 'collide-query))) + (set! (-> a1-2 start-pos quad) (-> obj root-override2 gspot-pos quad)) + (set! (-> a1-2 start-pos y) (+ 2048.0 (-> a1-2 start-pos y))) + (set-vector! (-> a1-2 move-dist) 0.0 -6144.0 0.0 0.0) + (let ((v1-10 a1-2)) + (set! (-> v1-10 radius) 4915.2) + (set! (-> v1-10 collide-with) arg1) + (set! (-> v1-10 ignore-process0) obj) + (set! (-> v1-10 ignore-process1) #f) + (set! (-> v1-10 ignore-pat) (-> obj root-override2 pat-ignore-mask)) + (set! (-> v1-10 action-mask) (collide-action solid)) ) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (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)))) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (vector-normalize! s2-1 1.0) - (vector-normalize! s1-1 1.0) - (vector-cross! s3-0 s2-1 s1-1) - (if (< (cos 10922.667) (vector-dot s3-0 *y-vector*)) - (vector+! s5-1 s5-1 s3-0) - ) - ) - ) - (vector-normalize-copy! (-> obj gspot-normal) s5-1 1.0) - ) - (set! (-> obj gspot-timer) (-> pp clock frame-counter)) + (fill-using-line-sphere *collide-cache* a1-2) ) - #t + (let ((s5-1 (new 'stack-no-clear 'vector))) + (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)))) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (vector-normalize! s2-1 1.0) + (vector-normalize! s1-1 1.0) + (vector-cross! s3-0 s2-1 s1-1) + (if (< (cos 10922.667) (vector-dot s3-0 *y-vector*)) + (vector+! s5-1 s5-1 s3-0) + ) + ) + ) + (vector-normalize-copy! (-> obj gspot-normal) s5-1 1.0) + ) + (set! (-> obj gspot-timer) (current-time)) ) + #t ) ) ) @@ -2001,20 +1995,18 @@ (defmethod init-enemy! mantis ((obj mantis)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (with-pp - (initialize-skeleton - obj - (the-as skeleton-group (art-group-get-by-name *level* "skel-mantis" (the-as (pointer uint32) #f))) - (the-as pair 0) - ) - (init-enemy-behaviour-and-stats! obj *mantis-nav-enemy-info*) - (set! (-> obj flags) (mantis-flag)) - (set! (-> obj my-up-vector quad) (-> *y-vector* quad)) - (set! (-> obj gspot-normal quad) (-> *y-vector* quad)) - (set! (-> obj gspot-timer) 0) - (set! (-> obj attack-timer) (+ (-> pp clock frame-counter) (seconds -5))) - (set! (-> obj track-timer) 0) - (set! (-> obj draw light-index) (the-as uint 30)) - (none) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-mantis" (the-as (pointer uint32) #f))) + (the-as pair 0) ) + (init-enemy-behaviour-and-stats! obj *mantis-nav-enemy-info*) + (set! (-> obj flags) (mantis-flag)) + (set! (-> obj my-up-vector quad) (-> *y-vector* quad)) + (set! (-> obj gspot-normal quad) (-> *y-vector* quad)) + (set! (-> obj gspot-timer) 0) + (set! (-> obj attack-timer) (+ (current-time) (seconds -5))) + (set! (-> obj track-timer) 0) + (set! (-> obj draw light-index) (the-as uint 30)) + (none) ) diff --git a/goal_src/jak2/levels/nest/nest-obs.gc b/goal_src/jak2/levels/nest/nest-obs.gc index 1371e465ad..0448ddb01a 100644 --- a/goal_src/jak2/levels/nest/nest-obs.gc +++ b/goal_src/jak2/levels/nest/nest-obs.gc @@ -67,12 +67,12 @@ (defstate down (nest-switch) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self set-camera) #f) (none) ) :trans (behavior () - (when (and (not (-> self set-camera)) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.6))) + (when (and (not (-> self set-camera)) (>= (- (current-time) (-> self state-time)) (seconds 0.6))) (process-grab? *target* #f) (hide-hud-quick #f) (set-setting! 'process-mask 'set 0.0 (process-mask movie enemy)) @@ -96,8 +96,8 @@ (set! (-> self root trans y) (+ (-> self y-start) (-> self y-delta))) (suspend) ) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (seek! (-> self y-rot-rate) 0.0 (* 4000.0 (-> self clock seconds-per-frame))) (quaternion-rotate-y! (-> self root quat) @@ -107,8 +107,8 @@ (suspend) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -215,8 +215,8 @@ This commonly includes things such as: :virtual #t :trans (the-as (function none :behavior nest-piston) rider-trans) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) diff --git a/goal_src/jak2/levels/nest/nest-scenes.gc b/goal_src/jak2/levels/nest/nest-scenes.gc index 208247a2e3..66acd4a48a 100644 --- a/goal_src/jak2/levels/nest/nest-scenes.gc +++ b/goal_src/jak2/levels/nest/nest-scenes.gc @@ -78,7 +78,7 @@ (defstate zap (canyon-lightning-thingy) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -106,7 +106,7 @@ ) :trans (behavior () (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.125)) + ((>= (- (current-time) (-> self state-time)) (seconds 0.125)) (let ((gp-0 (new 'stack-no-clear 'vector))) (set! (-> gp-0 quad) (-> self root trans quad)) (let ((v1-7 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> self root quat))) diff --git a/goal_src/jak2/levels/palace/boss/squid-extras.gc b/goal_src/jak2/levels/palace/boss/squid-extras.gc index 437783ec6b..55b9b7dadf 100644 --- a/goal_src/jak2/levels/palace/boss/squid-extras.gc +++ b/goal_src/jak2/levels/palace/boss/squid-extras.gc @@ -152,7 +152,7 @@ (vf2 :class vf) ) (init-vf0-vector) - (let ((f28-0 (/ (the float (- (-> pp clock frame-counter) (-> arg0 traj-timer))) (-> arg0 traj-duration))) + (let ((f28-0 (/ (the float (- (current-time) (-> arg0 traj-timer))) (-> arg0 traj-duration))) (s5-0 (new 'stack-no-clear 'vector)) ) (let ((f30-0 (compute-time-until-apex (-> arg0 traj)))) @@ -299,28 +299,26 @@ (defmethod init-proj-settings! squid-grenade ((obj squid-grenade)) "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc" - (with-pp - (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 1120) obj)) - (set! (-> obj attack-mode) 'squid-grenade) - (set! (-> obj max-speed) 655360.0) - (set! (-> obj move) squid-grenade-move) - (set! (-> obj timeout) (seconds 5)) - (set! (-> obj stop-speed) 4.096) - (set! (-> obj fly-sound) (new-sound-id)) - (set! (-> obj traj-timer) (-> pp clock frame-counter)) - (vector+! (-> obj traj-dest) (-> obj root-override trans) (-> obj root-override transv)) - (set! (-> obj traj-duration) - (fmax 600.0 (* 0.0018310547 (vector-vector-xz-distance (-> obj root-override trans) (-> obj traj-dest)))) - ) - (+! (-> obj traj-duration) (* 75.0 (rand-vu))) - (let ((f0-8 32768.0)) - (if (< (-> obj root-override trans y) (-> obj traj-dest y)) - (+! f0-8 (- (-> obj traj-dest y) (-> obj root-override trans y))) - ) - (setup-from-to-duration-and-height! (-> obj traj) (-> obj root-override trans) (-> obj traj-dest) 1.0 f0-8) - ) - (none) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 1120) obj)) + (set! (-> obj attack-mode) 'squid-grenade) + (set! (-> obj max-speed) 655360.0) + (set! (-> obj move) squid-grenade-move) + (set! (-> obj timeout) (seconds 5)) + (set! (-> obj stop-speed) 4.096) + (set! (-> obj fly-sound) (new-sound-id)) + (set! (-> obj traj-timer) (current-time)) + (vector+! (-> obj traj-dest) (-> obj root-override trans) (-> obj root-override transv)) + (set! (-> obj traj-duration) + (fmax 600.0 (* 0.0018310547 (vector-vector-xz-distance (-> obj root-override trans) (-> obj traj-dest)))) + ) + (+! (-> obj traj-duration) (* 75.0 (rand-vu))) + (let ((f0-8 32768.0)) + (if (< (-> obj root-override trans y) (-> obj traj-dest y)) + (+! f0-8 (- (-> obj traj-dest y) (-> obj root-override trans y))) + ) + (setup-from-to-duration-and-height! (-> obj traj) (-> obj root-override trans) (-> obj traj-dest) 1.0 f0-8) ) + (none) ) (defbehavior squid-whirlwind-move squid-whirlwind () @@ -331,12 +329,8 @@ (* 819.2 (-> self clock time-adjust-ratio)) ) (let ((gp-0 (new 'stack-no-clear 'vector))) - (let ((f30-0 - (lerp-scale 12288.0 32768.0 (the float (- (-> self clock frame-counter) (-> self state-time))) 0.0 900.0) - ) - (f28-0 - (lerp-scale 1024.0 4096.0 (the float (- (-> self clock frame-counter) (-> self state-time))) 0.0 900.0) - ) + (let ((f30-0 (lerp-scale 12288.0 32768.0 (the float (- (current-time) (-> self state-time))) 0.0 900.0)) + (f28-0 (lerp-scale 1024.0 4096.0 (the float (- (current-time) (-> self state-time))) 0.0 900.0)) ) (vector-! (-> self root transv) (-> self root trans) (-> self center)) (set-vector! gp-0 (- (-> self root transv z)) 0.0 (-> self root transv x) 1.0) @@ -395,7 +389,7 @@ (defstate idle (squid-whirlwind) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self duration) (the-as time-frame (+ (the int (* 150.0 (rand-vu))) 1050))) (none) ) @@ -409,7 +403,7 @@ (set! (-> a1-2 y) (+ 2048.0 (-> a1-2 y))) (spawn (-> self part) a1-2) ) - (when (or (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self duration)) + (when (or (>= (- (current-time) (-> self state-time)) (-> self duration)) (let ((f0-3 (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans))) (f1-1 12288.0) ) diff --git a/goal_src/jak2/levels/palace/boss/squid-setup.gc b/goal_src/jak2/levels/palace/boss/squid-setup.gc index 77bb628f72..fd014936ee 100644 --- a/goal_src/jak2/levels/palace/boss/squid-setup.gc +++ b/goal_src/jak2/levels/palace/boss/squid-setup.gc @@ -1274,7 +1274,7 @@ ;; WARN: Return type mismatch vector vs none. (defbehavior squid-increment-shield squid ((arg0 float)) (set! (-> self shield-hit-points) (fmin 1.0 (fmax 0.0 (+ (-> self shield-hit-points) arg0)))) - (set! (-> self shield-timer) (+ (-> self clock frame-counter) (seconds -0.125))) + (set! (-> self shield-timer) (+ (current-time) (seconds -0.125))) (let ((gp-0 (new 'stack-no-clear 'vector))) (cond ((< (-> self shield-hit-points) 0.5) @@ -1480,7 +1480,7 @@ (squid-take-hit (the-as touching-shapes-entry (-> arg3 param 0)) (the-as attack-info (-> arg3 param 1)) #f) ) ) - ((>= (- (-> self clock frame-counter) (-> self invincible-timer)) (seconds 3)) + ((>= (- (current-time) (-> self invincible-timer)) (seconds 3)) (cond ((and (= (-> self shield-hit-points) 0.0) (not (and (-> self next-state) (= (-> self next-state name) 'recharge))) @@ -1494,7 +1494,7 @@ ) ) (squid-take-hit (the-as touching-shapes-entry (-> arg3 param 0)) (the-as attack-info (-> arg3 param 1)) #t) - (set! (-> self invincible-timer) (-> self clock frame-counter)) + (set! (-> self invincible-timer) (current-time)) (squid-check-hit-points) ) ((or (!= (-> self shield-hit-points) 0.0) (and (-> self next-state) (= (-> self next-state name) 'recharge))) @@ -2132,23 +2132,21 @@ This commonly includes things such as: (defmethod set-traj-towards-vec squid ((obj squid) (src vector) (arg2 vector) (dest vector)) "Set up the [[trajectory]] towards `dest`." - (with-pp - (set! (-> obj traj-timer) (-> pp clock frame-counter)) - (set! (-> obj traj-src quad) (-> src quad)) - (set! (-> obj traj-dest quad) (-> dest quad)) - (set! (-> obj traj-duration) (* 0.00091552734 (vector-vector-xz-distance arg2 dest))) - (set! (-> obj traj-duration) (fmax 480.0 (-> obj traj-duration))) - (let ((f0-4 49152.0)) - (if (< (-> arg2 y) (-> dest y)) - (+! f0-4 (- (-> dest y) (-> arg2 y))) - ) - (setup-from-to-duration-and-height! (-> obj traj) arg2 dest 1.0 f0-4) - ) - (set! (-> obj residual-accumulator-1) 1.0) - (set! (-> obj residual-accumulator-2) 0.0) - 0 - (none) + (set! (-> obj traj-timer) (current-time)) + (set! (-> obj traj-src quad) (-> src quad)) + (set! (-> obj traj-dest quad) (-> dest quad)) + (set! (-> obj traj-duration) (* 0.00091552734 (vector-vector-xz-distance arg2 dest))) + (set! (-> obj traj-duration) (fmax 480.0 (-> obj traj-duration))) + (let ((f0-4 49152.0)) + (if (< (-> arg2 y) (-> dest y)) + (+! f0-4 (- (-> dest y) (-> arg2 y))) + ) + (setup-from-to-duration-and-height! (-> obj traj) arg2 dest 1.0 f0-4) ) + (set! (-> obj residual-accumulator-1) 1.0) + (set! (-> obj residual-accumulator-2) 0.0) + 0 + (none) ) (defmethod float-sin-clamp squid ((obj squid) (arg0 float)) @@ -2156,223 +2154,219 @@ This commonly includes things such as: ) (defmethod squid-method-48 squid ((obj squid)) - (with-pp - (when (< 0.00001 (-> obj residual-accumulator-1)) - (set! (-> obj residual-accumulator-1) (* 0.95 (-> obj residual-accumulator-1))) - (+! (-> obj residual-accumulator-2) (-> obj residual-accumulator-1)) - ) - (let* ((f28-0 ((method-of-type trajectory compute-time-until-apex) - (the-as trajectory (&-> (the-as squid-grenade (-> obj self)) ignore-handle)) - ) - ) - (s3-0 (compute-trans-at-time (-> obj traj) f28-0 (new 'stack-no-clear 'vector))) - (s5-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - (f30-0 (/ (the float (- (-> pp clock frame-counter) (-> obj traj-timer))) (-> obj traj-duration))) - ) - (let ((f26-0 (float-sin-clamp obj f30-0))) - (when (and (-> obj can-play-squid-boost) (< 0.125 f30-0)) - (set! (-> obj can-play-squid-boost) #f) - (sound-play "squid-boost") - ) - (cond - ((< f26-0 1.0) - (compute-trans-at-time (-> obj traj) f26-0 s5-0) - (set! (-> s4-0 quad) (-> obj traj-src quad)) - (+! (-> s4-0 y) (* 204.8 (the float (- (-> pp clock frame-counter) (-> obj traj-timer))) (/ f26-0 f30-0))) - (vector+float*! s4-0 s4-0 (-> obj residual-velocity) (-> obj residual-accumulator-2)) - (vector-lerp! s5-0 s4-0 s5-0 f26-0) - (cond - ((< f28-0 f26-0) - (let ((f28-1 (/ (- f26-0 f28-0) (- 1.0 f28-0)))) - (vector-lerp! s4-0 s3-0 (-> obj traj-dest) f28-1) - (vector-lerp! s5-0 s5-0 s4-0 f28-1) - ) - (squid-method-43 obj (squid-method-42 obj (new 'stack-no-clear 'vector)) 1092.2667 0.05) - (vector-! s4-0 (-> obj traj-dest) (-> obj trans)) - (vector-normalize! s4-0 1.75) - (dotimes (s3-2 6) - (send-event (handle->process (-> obj tentacles s3-2)) 'set-gravity s4-0) + (when (< 0.00001 (-> obj residual-accumulator-1)) + (set! (-> obj residual-accumulator-1) (* 0.95 (-> obj residual-accumulator-1))) + (+! (-> obj residual-accumulator-2) (-> obj residual-accumulator-1)) + ) + (let* ((f28-0 ((method-of-type trajectory compute-time-until-apex) + (the-as trajectory (&-> (the-as squid-grenade (-> obj self)) ignore-handle)) + ) ) + (s3-0 (compute-trans-at-time (-> obj traj) f28-0 (new 'stack-no-clear 'vector))) + (s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (f30-0 (/ (the float (- (current-time) (-> obj traj-timer))) (-> obj traj-duration))) + ) + (let ((f26-0 (float-sin-clamp obj f30-0))) + (when (and (-> obj can-play-squid-boost) (< 0.125 f30-0)) + (set! (-> obj can-play-squid-boost) #f) + (sound-play "squid-boost") + ) + (cond + ((< f26-0 1.0) + (compute-trans-at-time (-> obj traj) f26-0 s5-0) + (set! (-> s4-0 quad) (-> obj traj-src quad)) + (+! (-> s4-0 y) (* 204.8 (the float (- (current-time) (-> obj traj-timer))) (/ f26-0 f30-0))) + (vector+float*! s4-0 s4-0 (-> obj residual-velocity) (-> obj residual-accumulator-2)) + (vector-lerp! s5-0 s4-0 s5-0 f26-0) + (cond + ((< f28-0 f26-0) + (let ((f28-1 (/ (- f26-0 f28-0) (- 1.0 f28-0)))) + (vector-lerp! s4-0 s3-0 (-> obj traj-dest) f28-1) + (vector-lerp! s5-0 s5-0 s4-0 f28-1) ) - (else - (squid-method-43 obj (-> obj traj-dest) 546.13336 0.005) - ) - ) - (set! (-> obj trans quad) (-> s5-0 quad)) - ) - (else - (dotimes (s5-1 6) - (send-event (handle->process (-> obj tentacles s5-1)) 'set-gravity-slow (new 'static 'vector :y -1.0)) + (squid-method-43 obj (squid-method-42 obj (new 'stack-no-clear 'vector)) 1092.2667 0.05) + (vector-! s4-0 (-> obj traj-dest) (-> obj trans)) + (vector-normalize! s4-0 1.75) + (dotimes (s3-2 6) + (send-event (handle->process (-> obj tentacles s3-2)) 'set-gravity s4-0) ) - (set! (-> obj trans quad) (-> obj traj-dest quad)) ) + (else + (squid-method-43 obj (-> obj traj-dest) 546.13336 0.005) + ) + ) + (set! (-> obj trans quad) (-> s5-0 quad)) + ) + (else + (dotimes (s5-1 6) + (send-event (handle->process (-> obj tentacles s5-1)) 'set-gravity-slow (new 'static 'vector :y -1.0)) + ) + (set! (-> obj trans quad) (-> obj traj-dest quad)) ) ) - f30-0 ) + f30-0 ) ) (defmethod setup-part-engine squid ((obj squid) (arg0 symbol)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> obj blink-time)) 0) - (set! (-> obj blink-mask) 0) - (dotimes (s5-0 10) - (let* ((f30-0 0.5) - (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-7 (the-as number (logior #x3f800000 v1-6))) - ) - (if (< f30-0 (+ -1.0 (the-as float v1-7))) - (logior! (-> obj blink-mask) (ash 1 s5-0)) - ) - ) - ) - (set! (-> obj blink-time) (+ (-> pp clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.25 0.75))))) - (set! arg0 #t) - ) - (when arg0 - (remove-from-process *part-engine* obj) - (add-connection - *part-engine* - obj - 5 - obj - 4790 - (new 'static 'vector :x -5906.432 :y 3317.76 :z -409.6 :w 819200.0) - ) - (add-connection - *part-engine* - obj - 5 - obj - 4790 - (new 'static 'vector :x 5906.432 :y 3317.76 :z -409.6 :w 819200.0) - ) - (add-connection *part-engine* obj 6 obj 4791 (new 'static 'vector :y 3366.912 :w 819200.0)) - (add-connection *part-engine* obj 13 obj 4791 (new 'static 'vector :y 11993.088 :z 5255.168 :w 819200.0)) - (add-connection - *part-engine* - obj - 5 - obj - 4792 - (new 'static 'vector :x 5439.488 :y -1794.048 :z 11444.224 :w 819200.0) - ) - (add-connection - *part-engine* - obj - 5 - obj - 4792 - (new 'static 'vector :x -5439.488 :y -1794.048 :z 11444.224 :w 819200.0) - ) - (let ((s5-2 (-> obj blink-mask))) - (if (logtest? s5-2 1) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x -4128.768 :y 2355.2 :z 3653.632 :w 819200.0) - ) - ) - (if (logtest? s5-2 2) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x -4554.752 :y 2449.408 :z 2359.296 :w 819200.0) - ) - ) - (if (logtest? s5-2 4) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x -4386.816 :y 2191.36 :z 528.384 :w 819200.0) - ) - ) - (if (logtest? s5-2 8) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x -5832.704 :y 2945.024 :z 1691.648 :w 819200.0) - ) - ) - (if (logtest? s5-2 16) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x -5861.376 :y 2920.448 :z 1118.208 :w 819200.0) - ) - ) - (if (logtest? s5-2 32) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x 4128.768 :y 2355.2 :z 3653.632 :w 819200.0) - ) - ) - (if (logtest? s5-2 64) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x 4554.752 :y 2449.408 :z 2359.296 :w 819200.0) - ) - ) - (if (logtest? s5-2 128) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x 4386.816 :y 2191.36 :z -528.384 :w 819200.0) - ) - ) - (if (logtest? s5-2 256) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x 5832.704 :y 2945.024 :z 1691.648 :w 819200.0) - ) - ) - (if (logtest? s5-2 512) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x 5861.376 :y 2920.448 :z 1118.208 :w 819200.0) - ) + (when (>= (- (current-time) (-> obj blink-time)) 0) + (set! (-> obj blink-mask) 0) + (dotimes (s5-0 10) + (let* ((f30-0 0.5) + (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-7 (the-as number (logior #x3f800000 v1-6))) + ) + (if (< f30-0 (+ -1.0 (the-as float v1-7))) + (logior! (-> obj blink-mask) (ash 1 s5-0)) ) ) ) - 0 - (none) + (set! (-> obj blink-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.25 0.75))))) + (set! arg0 #t) ) + (when arg0 + (remove-from-process *part-engine* obj) + (add-connection + *part-engine* + obj + 5 + obj + 4790 + (new 'static 'vector :x -5906.432 :y 3317.76 :z -409.6 :w 819200.0) + ) + (add-connection + *part-engine* + obj + 5 + obj + 4790 + (new 'static 'vector :x 5906.432 :y 3317.76 :z -409.6 :w 819200.0) + ) + (add-connection *part-engine* obj 6 obj 4791 (new 'static 'vector :y 3366.912 :w 819200.0)) + (add-connection *part-engine* obj 13 obj 4791 (new 'static 'vector :y 11993.088 :z 5255.168 :w 819200.0)) + (add-connection + *part-engine* + obj + 5 + obj + 4792 + (new 'static 'vector :x 5439.488 :y -1794.048 :z 11444.224 :w 819200.0) + ) + (add-connection + *part-engine* + obj + 5 + obj + 4792 + (new 'static 'vector :x -5439.488 :y -1794.048 :z 11444.224 :w 819200.0) + ) + (let ((s5-2 (-> obj blink-mask))) + (if (logtest? s5-2 1) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x -4128.768 :y 2355.2 :z 3653.632 :w 819200.0) + ) + ) + (if (logtest? s5-2 2) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x -4554.752 :y 2449.408 :z 2359.296 :w 819200.0) + ) + ) + (if (logtest? s5-2 4) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x -4386.816 :y 2191.36 :z 528.384 :w 819200.0) + ) + ) + (if (logtest? s5-2 8) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x -5832.704 :y 2945.024 :z 1691.648 :w 819200.0) + ) + ) + (if (logtest? s5-2 16) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x -5861.376 :y 2920.448 :z 1118.208 :w 819200.0) + ) + ) + (if (logtest? s5-2 32) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x 4128.768 :y 2355.2 :z 3653.632 :w 819200.0) + ) + ) + (if (logtest? s5-2 64) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x 4554.752 :y 2449.408 :z 2359.296 :w 819200.0) + ) + ) + (if (logtest? s5-2 128) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x 4386.816 :y 2191.36 :z -528.384 :w 819200.0) + ) + ) + (if (logtest? s5-2 256) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x 5832.704 :y 2945.024 :z 1691.648 :w 819200.0) + ) + ) + (if (logtest? s5-2 512) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x 5861.376 :y 2920.448 :z 1118.208 :w 819200.0) + ) + ) + ) + ) + 0 + (none) ) ;; WARN: Return type mismatch float vs none. @@ -2526,7 +2520,7 @@ This commonly includes things such as: ) (when (-> obj rush-sound-playing) (cond - ((or (zero? (-> obj rush-end-time)) (< (- (-> pp clock frame-counter) (-> obj rush-end-time)) (seconds 0.1))) + ((or (zero? (-> obj rush-end-time)) (< (- (current-time) (-> obj rush-end-time)) (seconds 0.1))) (the-as int (sound-play "squid-rush" :id (-> obj rush-sound) :position (-> obj root-override trans))) ) (else @@ -2560,12 +2554,8 @@ This commonly includes things such as: ) ) (else - (let* ((f0-23 - (fmin 1.0 (* 0.0011111111 (the float (- (-> pp clock frame-counter) (the-as time-frame (-> obj jet-pitch)))))) - ) - (f28-2 - (fmin 1.0 (* 0.006666667 (the float (- (-> pp clock frame-counter) (the-as time-frame (-> obj jet-volume)))))) - ) + (let* ((f0-23 (fmin 1.0 (* 0.0011111111 (the float (- (current-time) (the-as time-frame (-> obj jet-pitch))))))) + (f28-2 (fmin 1.0 (* 0.006666667 (the float (- (current-time) (the-as time-frame (-> obj jet-volume))))))) (f30-6 (* 0.2 (- 1.0 f0-23) (sin (* 32768.0 f0-23)))) (f0-31 (+ 1.0 (* 5.0 (- 1.0 f28-2) (sin (* 32768.0 f30-6))))) ) @@ -2618,10 +2608,7 @@ This commonly includes things such as: ) ) (when (not (and (-> obj next-state) (= (-> obj next-state name) 'recharge))) - (let ((v1-249 - (the int (lerp-scale 0.0 128.0 (the float (- (-> pp clock frame-counter) (-> obj shield-timer))) 0.0 600.0)) - ) - ) + (let ((v1-249 (the int (lerp-scale 0.0 128.0 (the float (- (current-time) (-> obj shield-timer))) 0.0 600.0)))) (cond ((< 0.0 (-> obj shield-hit-points)) (set! s5-9 (min 100 v1-249)) @@ -2693,7 +2680,7 @@ This commonly includes things such as: (dotimes (s4-11 6) (send-event (handle->process (-> obj tentacles s4-11)) 'set-fade s5-9) ) - (let* ((f0-56 (lerp-scale 0.5 0.0 (the float (- (-> pp clock frame-counter) (-> obj shield-timer))) 0.0 75.0)) + (let* ((f0-56 (lerp-scale 0.5 0.0 (the float (- (current-time) (-> obj shield-timer))) 0.0 75.0)) (a0-147 (vector-float*! (new 'stack-no-clear 'vector) (-> obj shield-color) (if (< 0.0 (-> obj shield-hit-points)) f0-56 diff --git a/goal_src/jak2/levels/palace/boss/squid-states.gc b/goal_src/jak2/levels/palace/boss/squid-states.gc index 84990c4798..4cd24f4077 100644 --- a/goal_src/jak2/levels/palace/boss/squid-states.gc +++ b/goal_src/jak2/levels/palace/boss/squid-states.gc @@ -226,14 +226,14 @@ (defstate test (squid) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (ja :num! (loop!)) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (when (>= (- (current-time) (-> self state-time)) (seconds 2)) (set! (-> self driver-blend target) (- 1.0 (-> self driver-blend target))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (debug-draw (-> self first-path)) (debug-draw (-> self second-path)) @@ -507,10 +507,8 @@ :virtual #t :event squid-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self traj-timer) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.25 0.5)))) - ) + (set! (-> self state-time) (current-time)) + (set! (-> self traj-timer) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.25 0.5))))) (set! (-> self traj initial-position quad) (-> self trans quad)) (let ((v1-7 (-> self stage))) (cond @@ -562,17 +560,15 @@ (-> self trans) (the-as vector (-> self traj)) (-> self traj-dest) - (parameter-ease-sqr-clamp (* 0.0011111111 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (parameter-ease-sqr-clamp (* 0.0011111111 (the float (- (current-time) (-> self state-time))))) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (if (>= (- (current-time) (-> self state-time)) (seconds 3)) (go-virtual flee) ) (spawn (-> self part) (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 55))) - (when (>= (- (-> self clock frame-counter) (-> self traj-timer)) 0) + (when (>= (- (current-time) (-> self traj-timer)) 0) (sound-play "squid-explosion") - (set! (-> self traj-timer) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.25 0.5)))) - ) + (set! (-> self traj-timer) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.25 0.5))))) (cond ((zero? (-> self stage)) (setup-masks (-> self draw) 320 160) @@ -699,7 +695,7 @@ :event squid-handler :enter (behavior () (squid-talker 'start-recharging) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self invincible-timer) 0) (setup-masks (-> self draw) 8192 0) (logior! (-> self draw status) (draw-control-status warp-cross-fade)) @@ -733,7 +729,7 @@ (go-virtual fly-to-shoot-spot) ) ) - ((>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + ((>= (- (current-time) (-> self state-time)) (seconds 2)) (set! (-> self driver-blend target) 1.0) (ja-channel-push! 1 (seconds 0.1)) (ja :group! (-> self draw art-group data 34) :num! min) @@ -759,27 +755,21 @@ (let ((v1-70 (handle->process (-> self hud)))) (if v1-70 (set! (-> (the-as hud-squid v1-70) values 2 target) - (min 100 (/ (* 100 (- (-> self clock frame-counter) (-> self state-time))) 600)) + (min 100 (/ (* 100 (- (current-time) (-> self state-time))) 600)) ) ) ) (let ((gp-3 (new 'stack-no-clear 'vector))) - (let ((f30-0 - (* 16384.0 (fmin 1.0 (* 0.0016666667 (the float (- (-> self clock frame-counter) (-> self state-time)))))) - ) - ) - (let* ((f0-16 (* 164.25063 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (let ((f30-0 (* 16384.0 (fmin 1.0 (* 0.0016666667 (the float (- (current-time) (-> self state-time)))))))) + (let* ((f0-16 (* 164.25063 (the float (- (current-time) (-> self state-time))))) (f0-19 (lerp-scale 70.0 120.0 (fabs (cos f0-16)) 1.0 0.0)) ) (set! (-> self draw force-fade) - (the-as - uint - (the int (lerp-scale 128.0 f0-19 (the float (- (-> self clock frame-counter) (-> self state-time))) 0.0 37.5)) - ) + (the-as uint (the int (lerp-scale 128.0 f0-19 (the float (- (current-time) (-> self state-time))) 0.0 37.5))) ) ) (set! (-> self shield-timer) - (- (-> self clock frame-counter) + (- (current-time) (the-as time-frame (the int (lerp-scale 0.0 600.0 (the float (-> self draw force-fade)) 0.0 128.0))) ) ) @@ -796,7 +786,7 @@ ) (dotimes (gp-4 6) (send-event (handle->process (-> self tentacles gp-4)) 'set-fade (-> self draw force-fade)) - (when (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (when (< (- (current-time) (-> self state-time)) (seconds 2)) (case (-> self stage) ((1) (send-event (handle->process (-> self tentacles gp-4)) 'wrap *squid-second-pole*) @@ -867,16 +857,16 @@ (set! (-> self allowed-rotate-to-vector-angle) 0.0) (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data 21) :num! min) - (set! (-> self jet-volume) (the-as int (-> self clock frame-counter))) - (set! (-> self jet-pitch) (the-as int (-> self clock frame-counter))) + (set! (-> self jet-volume) (the-as int (current-time))) + (set! (-> self jet-pitch) (the-as int (current-time))) (set! (-> self negate-jet-pitch) #f) ) ((< 910.2222 (-> self desired-rotate-to-vector-angle)) (set! (-> self allowed-rotate-to-vector-angle) 0.0) (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data 24) :num! min) - (set! (-> self jet-volume) (the-as int (-> self clock frame-counter))) - (set! (-> self jet-pitch) (the-as int (-> self clock frame-counter))) + (set! (-> self jet-volume) (the-as int (current-time))) + (set! (-> self jet-pitch) (the-as int (current-time))) (set! (-> self negate-jet-pitch) #f) ) ((let ((v1-106 (ja-group))) @@ -944,22 +934,22 @@ :event squid-handler :enter (behavior () (squid-talker 'headbutting) - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self traj-timer) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self traj-timer) (current-time)) (vector-reset! (-> self residual-velocity)) (set! (-> self can-play-squid-boost) #t) (none) ) :exit (behavior () (sound-play "squid-rush-end") - (set! (-> self rush-end-time) (-> self clock frame-counter)) + (set! (-> self rush-end-time) (current-time)) (let ((v1-5 (ja-group))) (when (and v1-5 (= v1-5 (-> self draw art-group data 5))) (ja-channel-push! 1 (seconds 0.05)) (ja :group! (-> self draw art-group data 6) :num! min) (sound-play "sqd-shield-down") - (set! (-> self jet-volume) (the-as int (-> self clock frame-counter))) - (set! (-> self jet-pitch) (the-as int (-> self clock frame-counter))) + (set! (-> self jet-volume) (the-as int (current-time))) + (set! (-> self jet-pitch) (the-as int (current-time))) (set! (-> self negate-jet-pitch) #t) ) ) @@ -971,7 +961,7 @@ ) (go-virtual pre-flee) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (if (>= (- (current-time) (-> self state-time)) (seconds 3)) (go-virtual fly-to-shoot-spot) ) (let ((v1-17 (ja-group))) @@ -981,8 +971,8 @@ (when (and (-> self can-play-squid-boost) (< 30.0 (ja-aframe-num 0))) (sound-play "squid-boost") (set! (-> self can-play-squid-boost) #f) - (set! (-> self jet-volume) (the-as int (-> self clock frame-counter))) - (set! (-> self jet-pitch) (the-as int (-> self clock frame-counter))) + (set! (-> self jet-volume) (the-as int (current-time))) + (set! (-> self jet-pitch) (the-as int (current-time))) (set! (-> self negate-jet-pitch) #f) (set! (-> self rush-sound-playing) #t) (set! (-> self rush-end-time) 0) @@ -994,7 +984,7 @@ (if (< (ja-aframe-num 0) 20.0) (squid-method-42 self (-> self traj-dest)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (else (let ((v1-53 (ja-group))) @@ -1018,7 +1008,7 @@ (s5-1 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.017)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.017)) (let ((f0-8 (vector-vector-xz-distance-squared (-> self traj-dest) (-> self trans))) (f1-1 8192.0) ) @@ -1027,7 +1017,7 @@ ) (go-virtual fly-to-shoot-spot) ) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.017)) (-> self mesh-forced)) + (when (and (>= (- (current-time) (-> self state-time)) (seconds 0.017)) (-> self mesh-forced)) (vector-reset! (-> self residual-velocity)) (go-virtual fly-to-shoot-spot) ) @@ -1037,10 +1027,7 @@ (set! (-> s3-0 quad) (-> self traj-dest quad)) (clamp-vector-to-mesh-cross-gaps (-> self nav) gp-3 (-> self current-nav-poly) s3-0 409600.0 #f s2-0) (set! (-> self residual-velocity quad) (-> self trans quad)) - (let ((f30-1 - (lerp-scale 0.01 1.0 (+ -375.0 (the float (- (-> self clock frame-counter) (-> self traj-timer)))) 0.0 150.0) - ) - ) + (let ((f30-1 (lerp-scale 0.01 1.0 (+ -375.0 (the float (- (current-time) (-> self traj-timer)))) 0.0 150.0))) (set! (-> gp-3 y) (-> self trans y)) (vector-seek-3d-smooth! (-> self trans) gp-3 (* 4096.0 f30-1) 0.5) (set! (-> gp-3 quad) (-> self trans quad)) @@ -1101,7 +1088,7 @@ :event squid-handler :enter (behavior () (squid-talker 'shooting) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self stop-shooting) #f) (set! (-> self traj-timer) 0) (set! (-> self tentacle-base-rotation-speed target) 1.0) @@ -1135,15 +1122,13 @@ ) ) (squid-method-43 self (squid-method-42 self (new 'stack-no-clear 'vector)) 9.102222 0.75) - (when (or (>= (- (-> self clock frame-counter) (-> self state-time)) (squid-whirlwind-time)) - (-> self stop-shooting) - ) + (when (or (>= (- (current-time) (-> self state-time)) (squid-whirlwind-time)) (-> self stop-shooting)) (vector-reset! (-> self residual-velocity)) (go-virtual fly-to-shoot-spot) ) - (when (>= (- (-> self clock frame-counter) (-> self traj-timer)) (seconds 0.7)) + (when (>= (- (current-time) (-> self traj-timer)) (seconds 0.7)) (spawn-whirlwind self) - (set! (-> self traj-timer) (-> self clock frame-counter)) + (set! (-> self traj-timer) (current-time)) ) (none) ) @@ -1407,7 +1392,7 @@ (else (ja-channel-push! 1 (seconds 0.15)) (ja :group! (-> self draw art-group data 7) :num! min) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ) ) @@ -1484,14 +1469,10 @@ (+ -3640.889 f30-1) ) ((-> self gun-high-to-low) - (+ f30-1 - (lerp-scale -1820.4445 910.2222 (the float (- (-> self clock frame-counter) (-> self state-time))) 0.0 900.0) - ) + (+ f30-1 (lerp-scale -1820.4445 910.2222 (the float (- (current-time) (-> self state-time))) 0.0 900.0)) ) (else - (+ f30-1 - (lerp-scale 3640.889 -910.2222 (the float (- (-> self clock frame-counter) (-> self state-time))) 0.0 900.0) - ) + (+ f30-1 (lerp-scale 3640.889 -910.2222 (the float (- (current-time) (-> self state-time))) 0.0 900.0)) ) ) ) @@ -1522,7 +1503,7 @@ ((let ((v1-77 (ja-group))) (and v1-77 (= v1-77 (-> self draw art-group data 17))) ) - (if (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (if (or (>= (- (current-time) (-> self state-time)) (seconds 3)) (or (= (-> self shield-hit-points) 0.0) (zero? (-> self hit-points)) (-> self stop-shooting)) ) (ja :num! (seek!)) @@ -1541,7 +1522,7 @@ 0 ) ) - (if (and (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (if (and (or (>= (- (current-time) (-> self state-time)) (seconds 3)) (or (= (-> self shield-hit-points) 0.0) (zero? (-> self hit-points)) (-> self stop-shooting)) ) (ja-done? 0) @@ -1584,7 +1565,7 @@ (else (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data 16) :num! min) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self next-gun) 1) ) ) @@ -1632,7 +1613,7 @@ (squid-adjust-fly-anim) (when (and (zero? (-> self stage)) (not (-> self reload-played)) - (< (- (-> self traj-duration) (the float (- (-> self clock frame-counter) (-> self traj-timer)))) -210.0) + (< (- (-> self traj-duration) (the float (- (current-time) (-> self traj-timer)))) -210.0) ) (sound-play "squid-reload") (set! (-> self reload-played) #t) @@ -1680,7 +1661,7 @@ :enter (behavior () (set-setting! 'music 'danger4 0.0 0) (set! (-> self driver-blend target) 1.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self hud) (ppointer->handle (process-spawn hud-squid :init hud-init-by-other :to self))) (vector+! (-> self trans) (-> self trans) (new 'static 'vector :x 101171.2 :y 45056.0 :z 31047.68)) (let ((v1-14 (squid-method-42 self (new 'stack-no-clear 'vector)))) @@ -1698,7 +1679,7 @@ ) :trans (behavior () (ja :num! (loop!)) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (when (>= (- (current-time) (-> self state-time)) (seconds 3)) ) (none) ) diff --git a/goal_src/jak2/levels/palace/cable/palcab-obs.gc b/goal_src/jak2/levels/palace/cable/palcab-obs.gc index 4837bf81b9..79fbf140fc 100644 --- a/goal_src/jak2/levels/palace/cable/palcab-obs.gc +++ b/goal_src/jak2/levels/palace/cable/palcab-obs.gc @@ -101,7 +101,7 @@ (set! (-> a1-7 param 1) (the-as uint v1-14)) ) (when (send-event-function gp-0 a1-7) - (set! (-> self no-collision-timer) (-> self clock frame-counter)) + (set! (-> self no-collision-timer) (current-time)) (let ((v1-19 (-> self root-override root-prim))) (set! (-> v1-19 prim-core collide-as) (collide-spec)) (set! (-> v1-19 prim-core collide-with) (collide-spec)) @@ -117,12 +117,12 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (when (and (nonzero? (-> self no-collision-timer)) - (>= (- (-> self clock frame-counter) (-> self no-collision-timer)) + (>= (- (current-time) (-> self no-collision-timer)) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout)) ) ) @@ -196,14 +196,14 @@ ) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self sound-timer)) + (when (>= (- (current-time) (-> self state-time)) (-> self sound-timer)) (sound-play "cab-fan-blade") (sound-stop (-> self sound-id)) (sound-play "pal-fan-buzz" :id (-> self sound-id)) (set! (-> self sound-timer) (the-as time-frame (the int (* 300.0 (/ 21845.334 (fabs (-> self rotate-speed)))))) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (update! (-> self sound)) (rider-post) @@ -830,7 +830,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self fire-timer) (-> self clock frame-counter)) + (set! (-> self fire-timer) (current-time)) (set! (-> self gun-index) 0) 0 (none) @@ -844,7 +844,7 @@ This commonly includes things such as: (* (-> self spin-rate) (-> self clock seconds-per-frame)) ) (let ((f30-0 1.0)) - (when (>= (- (-> self clock frame-counter) (-> self fire-timer)) (seconds 0.05)) + (when (>= (- (current-time) (-> self fire-timer)) (seconds 0.05)) (let ((gp-0 (new 'stack-no-clear 'matrix))) (let ((s5-0 (-> self node-list data (+ (* (-> self gun-index) 2) 4)))) (vector<-cspace! (the-as vector (-> gp-0 vector)) s5-0) @@ -855,7 +855,7 @@ This commonly includes things such as: (pal-rot-gun-method-23 self gp-0) ) (set! (-> self gun-index) (- 1 (-> self gun-index))) - (set! (-> self fire-timer) (-> self clock frame-counter)) + (set! (-> self fire-timer) (current-time)) (set! f30-0 1.2) ) (let* ((f0-10 (the float (sar (shl (the int (quaternion-z-angle (-> self root quat))) 48) 48))) diff --git a/goal_src/jak2/levels/palace/cable/palcab-part.gc b/goal_src/jak2/levels/palace/cable/palcab-part.gc index 4cd2f9937b..dceb6ab469 100644 --- a/goal_src/jak2/levels/palace/cable/palcab-part.gc +++ b/goal_src/jak2/levels/palace/cable/palcab-part.gc @@ -292,9 +292,7 @@ (defbehavior palcab-bird-bob-func palcab-part ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) (set! (-> arg2 vector 0 y) - (+ (-> arg1 key proc root trans y) - (* -2048.0 (sin (* 218.45334 (the float (mod (-> self clock frame-counter) 300))))) - ) + (+ (-> arg1 key proc root trans y) (* -2048.0 (sin (* 218.45334 (the float (mod (current-time) 300)))))) ) 0 (none) diff --git a/goal_src/jak2/levels/palace/pal-obs.gc b/goal_src/jak2/levels/palace/pal-obs.gc index 4eecb3a5ca..2345bfa4d8 100644 --- a/goal_src/jak2/levels/palace/pal-obs.gc +++ b/goal_src/jak2/levels/palace/pal-obs.gc @@ -192,7 +192,7 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (stack-size-set! (-> obj main-thread) 1024) + (stack-size-set! (-> obj main-thread) 1024) ;; added (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 penetrated-by) (penetrate)) (let ((v1-2 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) @@ -796,7 +796,7 @@ This commonly includes things such as: (defstate idle (palent-turret) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -806,13 +806,13 @@ This commonly includes things such as: :trans (behavior () (cond ((not (task-node-closed? (game-task-node palace-sneak-in-meeting))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (else (let* ((f0-0 65536.0) (f1-0 -0.5) (f2-0 0.16666667) - (f3-1 (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (f3-1 (* 0.0033333334 (the float (- (current-time) (-> self state-time))))) (f30-0 (* f0-0 (+ f1-0 (* f2-0 (- f3-1 (* (the float (the int (/ f3-1 6.0))) 6.0)))))) (s4-0 (-> self node-list data 5 bone transform)) (s5-0 (matrix->trans s4-0 (new 'stack-no-clear 'vector))) @@ -822,7 +822,7 @@ This commonly includes things such as: (let ((f0-2 (* 5097.2446 (sin f30-0)))) (quaternion-rotate-local-y! (-> self root-override quat) (-> self entity quat) f0-2) ) - (when (< (the-as time-frame (-> self next-shoot)) (-> self clock frame-counter)) + (when (< (the-as time-frame (-> self next-shoot)) (current-time)) (set-palent-turret-flash! 1.0) (let ((a1-2 (new 'stack-no-clear 'projectile-init-by-other-params))) (set! (-> a1-2 ent) (-> self entity)) @@ -842,7 +842,7 @@ This commonly includes things such as: (set! (-> a1-2 vel quad) (-> gp-0 quad)) (spawn-projectile palent-turret-shot a1-2 self *default-dead-pool*) ) - (set! (-> self next-shoot) (the-as uint (+ (-> self clock frame-counter) (seconds 0.1)))) + (set! (-> self next-shoot) (the-as uint (+ (current-time) (seconds 0.1)))) ) ) ) diff --git a/goal_src/jak2/levels/palace/roof/palboss-scenes.gc b/goal_src/jak2/levels/palace/roof/palboss-scenes.gc index 9e1d5cec12..5bcf24acd2 100644 --- a/goal_src/jak2/levels/palace/roof/palboss-scenes.gc +++ b/goal_src/jak2/levels/palace/roof/palboss-scenes.gc @@ -53,7 +53,7 @@ (let ((v1-0 #f) (gp-0 (-> self elevator-status)) ) - (when (>= (- (-> self clock frame-counter) (-> self sticky-player-last-ride-time)) 0) + (when (>= (- (current-time) (-> self sticky-player-last-ride-time)) 0) (dotimes (s5-0 10) (let* ((f30-0 0.5) (v1-3 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) @@ -66,7 +66,7 @@ ) ) (set! (-> self sticky-player-last-ride-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.25 0.75)))) + (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.25 0.75)))) ) (set! v1-0 #t) ) @@ -705,7 +705,7 @@ (let ((v1-8 #f) (gp-0 (-> self elevator-status)) ) - (when (>= (- (-> self clock frame-counter) (-> self sticky-player-last-ride-time)) 0) + (when (>= (- (current-time) (-> self sticky-player-last-ride-time)) 0) (dotimes (s5-0 10) (let* ((f30-0 0.5) (v1-11 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) @@ -718,7 +718,7 @@ ) ) (set! (-> self sticky-player-last-ride-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.25 0.75)))) + (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.25 0.75)))) ) (set! v1-8 #t) ) diff --git a/goal_src/jak2/levels/power_station/power_switches/ctypower.gc b/goal_src/jak2/levels/power_station/power_switches/ctypower.gc index ed99b132dc..c1cc2c6268 100644 --- a/goal_src/jak2/levels/power_station/power_switches/ctypower.gc +++ b/goal_src/jak2/levels/power_station/power_switches/ctypower.gc @@ -113,7 +113,7 @@ ) ) (if (= (-> self count) (-> self max-count)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (set! (-> *game-info* counter) (the float (-> self count))) ) @@ -153,8 +153,8 @@ () (set! (-> self hud-counter) (ppointer->handle (process-spawn hud-turret :init hud-init-by-other :to self))) (send-event *traffic-manager* 'set-target-level #x3f800000) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (send-event *traffic-manager* 'set-alert-level 1) @@ -186,8 +186,8 @@ TASK_MANAGER_COMPLETE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) (task-node-close! (game-task-node city-power-post-win)) diff --git a/goal_src/jak2/levels/power_station/vinroom-obs.gc b/goal_src/jak2/levels/power_station/vinroom-obs.gc index 10f58a1e65..8c08d14d87 100644 --- a/goal_src/jak2/levels/power_station/vinroom-obs.gc +++ b/goal_src/jak2/levels/power_station/vinroom-obs.gc @@ -128,7 +128,7 @@ (when (and (or (not (-> self dont-draw-outside?)) (>= (vector4-dot (the-as vector (-> self lightning-plane)) (math-camera-pos)) 0.0) ) - (< (the-as time-frame (-> self lightning-timer)) (-> self clock frame-counter)) + (< (the-as time-frame (-> self lightning-timer)) (current-time)) ) (let ((s4-0 (new 'stack-no-clear 'matrix)) (s3-1 @@ -166,7 +166,7 @@ ) (when (>= (fill-and-probe-using-line-sphere *collide-cache* s5-1) 0.0) (set! (-> self lightning-timer) - (the-as uint (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.1 0.4))))) + (the-as uint (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.1 0.4))))) ) (let ((s4-3 (new 'stack-no-clear 'vector))) (set! (-> s4-3 quad) (-> s5-1 best-other-tri intersect quad)) @@ -260,7 +260,7 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (stack-size-set! (-> obj main-thread) 1024) + (stack-size-set! (-> obj main-thread) 1024) ;; added (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 penetrated-by) (penetrate)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) diff --git a/goal_src/jak2/levels/ruins/mechtest-obs.gc b/goal_src/jak2/levels/ruins/mechtest-obs.gc index b8c5346a0f..d5ddd2e709 100644 --- a/goal_src/jak2/levels/ruins/mechtest-obs.gc +++ b/goal_src/jak2/levels/ruins/mechtest-obs.gc @@ -303,7 +303,7 @@ ) :enter (behavior () (logclear! (-> self mask) (process-mask actor-pause)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (if (handle->process (-> self carry other)) (drop-impl! (the-as carry-info (send-event (handle->process (-> self carry other)) 'carry-info)) @@ -318,14 +318,14 @@ (when (or (and (logtest? (-> self root-override status) (collide-status on-surface)) (< 0.8 (-> self root-override surface-angle)) ) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (>= (- (current-time) (-> self state-time)) (seconds 5)) ) (vector-reset! (-> self root-override transv)) (set! (-> self root-override root-prim local-sphere w) (-> self carry backup-radius)) (cond ((and (-> self reset-on-land?) (and (or (< 12288.0 (vector-vector-distance (-> self drop-point) (-> self root-override trans))) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (>= (- (current-time) (-> self state-time)) (seconds 5)) ) (and (-> self next-entity) (not (logtest? (-> self next-entity extra perm status) (entity-perm-status subtask-complete))) @@ -366,7 +366,7 @@ (go-virtual wait) ) ((or (< 12288.0 (vector-vector-distance (-> self drop-point) (-> self root-override trans))) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (>= (- (current-time) (-> self state-time)) (seconds 5)) ) (sound-play "block-break") (let ((gp-3 (get-process *default-dead-pool* part-tracker #x4000))) diff --git a/goal_src/jak2/levels/ruins/rapid-gunner.gc b/goal_src/jak2/levels/ruins/rapid-gunner.gc index 69f37f0ef2..4a2e4b1bf8 100644 --- a/goal_src/jak2/levels/ruins/rapid-gunner.gc +++ b/goal_src/jak2/levels/ruins/rapid-gunner.gc @@ -549,7 +549,7 @@ (vector+! (-> self target-next-pos) (-> self focus-dir) gp-0) (set! (-> self target-prev-pos quad) (-> gp-0 quad)) ) - (set! (-> self predict-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self predict-timer) (the-as uint (current-time))) ) (else (set! (-> self target-next-pos quad) (-> self target-prev-pos quad)) @@ -693,9 +693,9 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior rapid-gunner) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self predict-timer) (the-as uint (+ (-> self clock frame-counter) 1))) - (set! (-> self shot-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self state-time) (current-time)) + (set! (-> self predict-timer) (the-as uint (+ (current-time) 1))) + (set! (-> self shot-timer) (the-as uint (current-time))) (let ((v1-7 self)) (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-7 nav callback-info) *nav-enemy-null-callback-info*) @@ -714,7 +714,7 @@ (set! (-> self attack-id) a0-6) ) (when (logtest? (-> self status-flags) 2) - (set! (-> self spin-up-timer) (+ (-> self clock frame-counter) (seconds 2))) + (set! (-> self spin-up-timer) (+ (current-time) (seconds 2))) (set! (-> self status-flags) (logand -3 (-> self status-flags))) ) (if (zero? (rand-vu-int-range 0 3)) @@ -765,10 +765,10 @@ ) (go-virtual reload) ) - ((>= (- (-> self clock frame-counter) (the-as int (-> self shot-timer))) (seconds 0.25)) + ((>= (- (current-time) (the-as int (-> self shot-timer))) (seconds 0.25)) (when (rapid-gunner-method-184 self 2184.5334) (let* ((a1-11 (-> self node-list data 18)) - (f30-0 (fmax 0.0 (the float (- (-> self spin-up-timer) (-> self clock frame-counter))))) + (f30-0 (fmax 0.0 (the float (- (-> self spin-up-timer) (current-time))))) (s5-1 (vector<-cspace! (new 'stack-no-clear 'vector) a1-11)) (s4-2 (vector+! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable gp-0) 0) (-> self focus-dir)) @@ -787,7 +787,7 @@ ) (+! (-> self shots-fired) 1) ) - (set! (-> self shot-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self shot-timer) (the-as uint (current-time))) ) ) ) @@ -878,7 +878,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior rapid-gunner) enemy-event-handler) :enter (behavior () - (set! (-> self predict-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self predict-timer) (the-as uint (current-time))) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -1009,7 +1009,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior rapid-gunner) enemy-event-handler) :enter (behavior () - (set! (-> self predict-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self predict-timer) (the-as uint (current-time))) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1087,13 +1087,13 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior rapid-gunner) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self shots-fired) (the-as uint 0)) 0 (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (go-hostile self) ) (none) @@ -1124,7 +1124,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior rapid-gunner) enemy-event-handler) :enter (behavior () - (set! (-> self predict-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self predict-timer) (the-as uint (current-time))) (set! (-> self shots-fired) (the-as uint 0)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) @@ -1169,7 +1169,7 @@ (t9-0) ) ) - (set! (-> self predict-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self predict-timer) (the-as uint (current-time))) (cond ((handle->process (-> self focus handle)) (if (check-los? (-> self los) 0) @@ -1222,7 +1222,7 @@ ) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (>= 1 (the-as int (-> self focus aware))) (go-virtual active) ) @@ -1285,7 +1285,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior rapid-gunner) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) diff --git a/goal_src/jak2/levels/ruins/ruins-obs.gc b/goal_src/jak2/levels/ruins/ruins-obs.gc index 2ceb4efab4..8689474bc8 100644 --- a/goal_src/jak2/levels/ruins/ruins-obs.gc +++ b/goal_src/jak2/levels/ruins/ruins-obs.gc @@ -439,7 +439,7 @@ This commonly includes things such as: and translate the platform via the `smush` @see [[smush-control]]" (activate! (-> obj smush) -1.0 60 150 1.0 1.0 (-> self clock)) - (set! (-> obj bounce-time) (-> self clock frame-counter)) + (set! (-> obj bounce-time) (current-time)) (set! (-> obj bouncing) #t) (logclear! (-> obj mask) (process-mask sleep)) (logclear! (-> obj mask) (process-mask sleep-code)) @@ -510,7 +510,7 @@ and translate the platform via the `smush` ) :post (behavior () (when (and (nonzero? (-> self root-override root-prim prim-core collide-as)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.25)) + (>= (- (current-time) (-> self state-time)) (seconds 0.25)) ) (let ((v1-9 (-> self root-override root-prim))) (set! (-> v1-9 prim-core collide-as) (collide-spec)) @@ -729,9 +729,9 @@ This commonly includes things such as: (lambda :behavior task-manager () (set! (-> self data-int32 0) 0) - (set! (-> self beep-time) (+ (-> self clock frame-counter) (seconds -30))) + (set! (-> self beep-time) (+ (current-time) (seconds -30))) (until #f - (when (>= (- (-> self clock frame-counter) (-> self beep-time)) (seconds 40)) + (when (>= (- (current-time) (-> self beep-time)) (seconds 40)) (let ((v1-8 (mod (-> self data-int32 0) (if (= (-> self node-info task) (game-task ruins-tower)) 4 2 @@ -754,7 +754,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self beep-time) (-> self clock frame-counter)) + (set! (-> self beep-time) (current-time)) (+! (-> self data-int32 0) 1) ) (b! @@ -807,12 +807,12 @@ This commonly includes things such as: ) (b! #t cfg-17 :delay (nop!)) (label cfg-8) - (when (and (>= (- (-> self clock frame-counter) (-> self time-limit)) (seconds 10)) + (when (and (>= (- (current-time) (-> self time-limit)) (seconds 10)) gp-0 (< (vector-vector-xz-distance (target-pos 0) (-> gp-0 extra trans)) 40960.0) ) (talker-spawn-func (-> *talker-speech* 452) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) ) (suspend) (label cfg-17) @@ -831,22 +831,22 @@ This commonly includes things such as: (until (not (or (not *target*) (not (logtest? (focus-status mech) (-> *target* focus-status))))) (b! #t cfg-47 :delay (nop!)) (label cfg-38) - (when (and (>= (- (-> self clock frame-counter) (-> self time-limit)) (seconds 10)) + (when (and (>= (- (current-time) (-> self time-limit)) (seconds 10)) gp-0 (< (vector-vector-xz-distance (target-pos 0) (-> gp-0 extra trans)) 40960.0) ) (talker-spawn-func (-> *talker-speech* 452) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) ) (suspend) (label cfg-47) (b! (or (not *target*) (not (logtest? (focus-status mech) (-> *target* focus-status)))) cfg-38 :delay (nop!)) (talker-spawn-func (-> *talker-speech* 457) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) (b! #t cfg-66 :delay (nop!)) (label cfg-52) ) - (when (>= (- (-> self clock frame-counter) (-> self time-limit)) (seconds 10)) + (when (>= (- (current-time) (-> self time-limit)) (seconds 10)) (b! (not (and gp-0 (< (vector-vector-xz-distance (target-pos 0) (-> gp-0 extra trans)) 61440.0))) cfg-63 @@ -857,7 +857,7 @@ This commonly includes things such as: (label cfg-63) (talker-spawn-func (-> *talker-speech* 454) *entity-pool* (target-pos 0) (the-as region #f)) (label cfg-64) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) ) (suspend) (label cfg-66) @@ -885,7 +885,7 @@ This commonly includes things such as: (label cfg-1) (b! #t cfg-14 :delay (nop!)) (label cfg-2) - (let ((a0-2 (>= (- (-> self clock frame-counter) (-> self time-limit)) (seconds 10)))) + (let ((a0-2 (>= (- (current-time) (-> self time-limit)) (seconds 10)))) (b! (not a0-2) cfg-11 :likely-delay (set! v1-3 a0-2)) ) (b! (not gp-0) cfg-11 :likely-delay (set! v1-3 gp-0)) @@ -902,7 +902,7 @@ This commonly includes things such as: (label cfg-11) (when v1-3 (talker-spawn-func (-> *talker-speech* 452) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) ) (suspend) (label cfg-14) @@ -915,7 +915,7 @@ This commonly includes things such as: (set! v1-18 (not (logtest? (focus-status mech) (-> *target* focus-status)))) (label cfg-22) (b! v1-18 cfg-1 :delay (nop!)) - (when (>= (- (-> self clock frame-counter) (-> self time-limit)) (seconds 10)) + (when (>= (- (current-time) (-> self time-limit)) (seconds 10)) (b! (not gp-0) cfg-38 :likely-delay (set! v1-25 gp-0)) (let ((v1-27 (-> gp-0 extra process))) (b! (not v1-27) cfg-28 :delay (nop!)) @@ -940,7 +940,7 @@ This commonly includes things such as: (label cfg-38) (when v1-25 (talker-spawn-func (-> *talker-speech* 458) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) ) ) (suspend) @@ -974,7 +974,7 @@ This commonly includes things such as: (b! #t cfg-20 :delay (nop!)) (label cfg-8) (set! v1-6 - (and (>= (- (-> self clock frame-counter) (-> self time-limit)) (seconds 10)) + (and (>= (- (current-time) (-> self time-limit)) (seconds 10)) (and gp-0 (begin (let ((v1-8 (-> gp-0 extra process))) (b! (not v1-8) cfg-14 :delay (nop!)) @@ -994,7 +994,7 @@ This commonly includes things such as: (label cfg-17) (b! (not v1-6) cfg-19 :delay (empty-form)) (talker-spawn-func (-> *talker-speech* 452) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) (label cfg-19) (suspend) (label cfg-20) @@ -1002,7 +1002,7 @@ This commonly includes things such as: (b! #t cfg-53 :delay (nop!)) (label cfg-25) ) - (when (>= (- (-> self clock frame-counter) (-> self time-limit)) (seconds 10)) + (when (>= (- (current-time) (-> self time-limit)) (seconds 10)) (b! (not (and *target* (focus-test? *target* carry))) cfg-43 :delay (empty-form)) (when (< (vector-vector-xz-distance (target-pos 0) @@ -1030,7 +1030,7 @@ This commonly includes things such as: ) ) (talker-spawn-func (-> *talker-speech* 459) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) ) (b! #t cfg-52 :delay (nop!)) (label cfg-43) @@ -1046,7 +1046,7 @@ This commonly includes things such as: ) ) (talker-spawn-func (-> *talker-speech* 458) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) ) ) (label cfg-52) diff --git a/goal_src/jak2/levels/ruins/ruins-part.gc b/goal_src/jak2/levels/ruins/ruins-part.gc index d75e153f18..6fe523db31 100644 --- a/goal_src/jak2/levels/ruins/ruins-part.gc +++ b/goal_src/jak2/levels/ruins/ruins-part.gc @@ -706,15 +706,11 @@ (defun ruins-bird-bob-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) "Move the bird particles up and down, on a sinusoidal period with a wavelength of 300 frames TODO - check argument types / what birds?" - (with-pp - (set! (-> arg2 vector 0 y) - (+ (-> arg1 key proc root trans y) - (* -2048.0 (sin (* 218.45334 (the float (mod (-> pp clock frame-counter) 300))))) - ) - ) - 0 - (none) - ) + (set! (-> arg2 vector 0 y) + (+ (-> arg1 key proc root trans y) (* -2048.0 (sin (* 218.45334 (the float (mod (current-time) 300)))))) + ) + 0 + (none) ) (defpart 1272 diff --git a/goal_src/jak2/levels/sewer/escort/jinx-bomb.gc b/goal_src/jak2/levels/sewer/escort/jinx-bomb.gc index 5e7b3c8061..2ab56e6b82 100644 --- a/goal_src/jak2/levels/sewer/escort/jinx-bomb.gc +++ b/goal_src/jak2/levels/sewer/escort/jinx-bomb.gc @@ -44,12 +44,12 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (if (and (nonzero? (-> self fuse-delay)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self fuse-delay))) + (>= (- (current-time) (-> self state-time)) (the-as time-frame (-> self fuse-delay))) ) (go-virtual explode) ) @@ -69,7 +69,7 @@ (defstate explode (jinx-bomb) :virtual #t :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self draw status) (draw-control-status no-draw)) (let ((v1-6 (-> self root-override root-prim))) (set! (-> v1-6 prim-core collide-as) (collide-spec)) diff --git a/goal_src/jak2/levels/sewer/escort/jinx-states.gc b/goal_src/jak2/levels/sewer/escort/jinx-states.gc index ab3b072809..c6b8f22b17 100644 --- a/goal_src/jak2/levels/sewer/escort/jinx-states.gc +++ b/goal_src/jak2/levels/sewer/escort/jinx-states.gc @@ -522,7 +522,7 @@ (seconds 0.05) ) (bot-method-223 self #t) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (or (not (bot-method-214 self)) (not (ruffian-method-237 self))) ) (react-to-focus self) @@ -616,7 +616,7 @@ (suspend) (ja :num! (seek!)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (ja-no-eval :group! (-> self draw art-group data 3) :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1))) @@ -624,7 +624,7 @@ ) (until (ja-done? 0) (if (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (reset? *fail-mission-control*) ) (reset! *fail-mission-control*) diff --git a/goal_src/jak2/levels/sewer/gator.gc b/goal_src/jak2/levels/sewer/gator.gc index 2cc116a3f5..a94ae77cbe 100644 --- a/goal_src/jak2/levels/sewer/gator.gc +++ b/goal_src/jak2/levels/sewer/gator.gc @@ -183,95 +183,93 @@ "Core movement for the [[gator]], circles the target, charges at the target, etc @params TODO - not sure, they all dont seem to do very much and this method is a mess" (local-vars (v1-17 object) (a0-5 object)) - (with-pp - (let ((f30-0 (vector-dot (-> obj new-facing) (-> obj old-facing))) - (s5-0 75) - (s4-0 (the-as art-joint-anim (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) - ) - ) - (b! (not arg2) cfg-26 :delay (nop!)) - (set! s5-0 18) - (b! (>= f30-0 (cos (* 182.04445 arg0))) cfg-8 :delay #f) - (if (< (-> (vector-cross! (new 'stack-no-clear 'vector) (-> obj new-facing) (-> obj old-facing)) y) 0.0) - (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 40))) - (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 39))) - ) - (b! #t cfg-25 :delay (nop!)) - (label cfg-8) - (let ((v1-16 (< (cos (* 182.04445 arg1)) f30-0))) - (b! v1-16 cfg-23 :likely-delay (set! v1-17 v1-16)) - ) - (let ((v1-20 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) - ) - (b! (not v1-20) cfg-21 :likely-delay (set! a0-5 v1-20)) - (let ((a1-3 (= v1-20 (-> obj draw art-group data 14)))) - (b! a1-3 cfg-21 :likely-delay (set! a0-5 a1-3)) - ) - (let ((a1-4 (= v1-20 (-> obj draw art-group data 40)))) - (b! a1-4 cfg-21 :likely-delay (set! a0-5 a1-4)) - ) - (set! a0-5 (= v1-20 (-> obj draw art-group data 39))) - ) - (label cfg-21) - (b! (not a0-5) cfg-23 :delay (set! v1-17 #t)) - (set! v1-17 #f) - (label cfg-23) - (if v1-17 - (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 14))) - ) - (label cfg-25) - (b! #t cfg-48 :delay (nop!)) - (label cfg-26) - (b! (>= f30-0 (cos (* 182.04445 arg0))) cfg-31 :delay #f) - (if (< (-> (vector-cross! (new 'stack-no-clear 'vector) (-> obj new-facing) (-> obj old-facing)) y) 0.0) - (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 38))) - (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 37))) - ) - (b! #t cfg-48 :delay (nop!)) - (label cfg-31) - (if (or (< (cos (* 182.04445 arg1)) f30-0) (let ((v1-41 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) - ) - (not (and v1-41 (or (= v1-41 (-> obj draw art-group data 13)) - (= v1-41 (-> obj draw art-group data 38)) - (= v1-41 (-> obj draw art-group data 37)) - ) - ) - ) - ) + (let ((f30-0 (vector-dot (-> obj new-facing) (-> obj old-facing))) + (s5-0 75) + (s4-0 (the-as art-joint-anim (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) ) - (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 13))) + ) + (b! (not arg2) cfg-26 :delay (nop!)) + (set! s5-0 18) + (b! (>= f30-0 (cos (* 182.04445 arg0))) cfg-8 :delay #f) + (if (< (-> (vector-cross! (new 'stack-no-clear 'vector) (-> obj new-facing) (-> obj old-facing)) y) 0.0) + (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 40))) + (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 39))) + ) + (b! #t cfg-25 :delay (nop!)) + (label cfg-8) + (let ((v1-16 (< (cos (* 182.04445 arg1)) f30-0))) + (b! v1-16 cfg-23 :likely-delay (set! v1-17 v1-16)) + ) + (let ((v1-20 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) ) - (label cfg-48) - (let ((v1-50 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) + (b! (not v1-20) cfg-21 :likely-delay (set! a0-5 v1-20)) + (let ((a1-3 (= v1-20 (-> obj draw art-group data 14)))) + (b! a1-3 cfg-21 :likely-delay (set! a0-5 a1-3)) + ) + (let ((a1-4 (= v1-20 (-> obj draw art-group data 40)))) + (b! a1-4 cfg-21 :likely-delay (set! a0-5 a1-4)) + ) + (set! a0-5 (= v1-20 (-> obj draw art-group data 39))) + ) + (label cfg-21) + (b! (not a0-5) cfg-23 :delay (set! v1-17 #t)) + (set! v1-17 #f) + (label cfg-23) + (if v1-17 + (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 14))) + ) + (label cfg-25) + (b! #t cfg-48 :delay (nop!)) + (label cfg-26) + (b! (>= f30-0 (cos (* 182.04445 arg0))) cfg-31 :delay #f) + (if (< (-> (vector-cross! (new 'stack-no-clear 'vector) (-> obj new-facing) (-> obj old-facing)) y) 0.0) + (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 38))) + (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 37))) + ) + (b! #t cfg-48 :delay (nop!)) + (label cfg-31) + (if (or (< (cos (* 182.04445 arg1)) f30-0) (let ((v1-41 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (not (and v1-41 (or (= v1-41 (-> obj draw art-group data 13)) + (= v1-41 (-> obj draw art-group data 38)) + (= v1-41 (-> obj draw art-group data 37)) + ) + ) + ) + ) ) - (when (and (not (and v1-50 (= v1-50 (the-as art-element s4-0)))) - (>= (- (-> pp clock frame-counter) (the-as time-frame s5-0)) (-> obj turn-time)) - ) - (let ((f30-2 (/ (ja-frame-num 0) (the float (ja-num-frames 0))))) - (ja-channel-push! 1 (the-as time-frame s5-0)) - (set! (-> obj skel root-channel 0 frame-group) s4-0) - (let ((s5-1 (-> obj skel root-channel 0))) - (set! (-> s5-1 num-func) num-func-identity) - (set! (-> s5-1 frame-num) (* f30-2 (the float (ja-num-frames 0)))) - ) - ) - (let ((v0-4 (-> pp clock frame-counter))) - (set! (-> obj turn-time) v0-4) - v0-4 + (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 13))) + ) + (label cfg-48) + (let ((v1-50 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (when (and (not (and v1-50 (= v1-50 (the-as art-element s4-0)))) + (>= (- (current-time) (the-as time-frame s5-0)) (-> obj turn-time)) + ) + (let ((f30-2 (/ (ja-frame-num 0) (the float (ja-num-frames 0))))) + (ja-channel-push! 1 (the-as time-frame s5-0)) + (set! (-> obj skel root-channel 0 frame-group) s4-0) + (let ((s5-1 (-> obj skel root-channel 0))) + (set! (-> s5-1 num-func) num-func-identity) + (set! (-> s5-1 frame-num) (* f30-2 (the float (ja-num-frames 0)))) ) ) + (let ((v0-4 (current-time))) + (set! (-> obj turn-time) v0-4) + v0-4 + ) ) ) ) @@ -506,7 +504,7 @@ (defstate stare (gator) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -515,7 +513,7 @@ (func) ) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.017)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.017)) (go-virtual pacing) ) (none) diff --git a/goal_src/jak2/levels/sewer/grim2-course.gc b/goal_src/jak2/levels/sewer/grim2-course.gc index 6047229d39..75fd976265 100644 --- a/goal_src/jak2/levels/sewer/grim2-course.gc +++ b/goal_src/jak2/levels/sewer/grim2-course.gc @@ -420,36 +420,31 @@ :nav-mesh-index 2 :skip-to -1 :on-set (lambda ((arg0 grim-sewer)) - (with-pp - (set! (-> arg0 waypoint-time0) (-> pp clock frame-counter)) - (set! (-> arg0 bot-flags) (logior (bot-flags bf19) (-> arg0 bot-flags))) - (clear-poi-and-focus! arg0) - (logclear! (-> arg0 focus-status) (focus-status disable)) - (set! (-> arg0 notice-enemy-dist) 204800.0) - (set! (-> arg0 min-speed) 40960.0) - (set! (-> arg0 max-speed) 40960.0) - (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) ruft-wait-spot arg0))) - (set! (-> v1-12 bytes 5) 1) - (set! (-> v1-12 bytes 6) 11) - (set! (-> v1-12 bytes 4) -1) - (set! (-> (the-as ruft-wait-spot v1-12) check-done) - (the-as - (function ruft-wait-spot ruffian symbol) - (lambda ((arg0 object) (arg1 grim-sewer)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 16 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t + (set! (-> arg0 waypoint-time0) (current-time)) + (set! (-> arg0 bot-flags) (logior (bot-flags bf19) (-> arg0 bot-flags))) + (clear-poi-and-focus! arg0) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 notice-enemy-dist) 204800.0) + (set! (-> arg0 min-speed) 40960.0) + (set! (-> arg0 max-speed) 40960.0) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) ruft-wait-spot arg0))) + (set! (-> v1-12 bytes 5) 1) + (set! (-> v1-12 bytes 6) 11) + (set! (-> v1-12 bytes 4) -1) + (set! (-> (the-as ruft-wait-spot v1-12) check-done) + (the-as + (function ruft-wait-spot ruffian symbol) + (lambda ((arg0 object) (arg1 grim-sewer)) (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 16 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) ) - ) - ) - ) ) - ) - (none) + ) ) + (none) ) :on-update #f :on-skipping-here #f diff --git a/goal_src/jak2/levels/sewer/hal2-course.gc b/goal_src/jak2/levels/sewer/hal2-course.gc index 17a92ca965..82d3e9d599 100644 --- a/goal_src/jak2/levels/sewer/hal2-course.gc +++ b/goal_src/jak2/levels/sewer/hal2-course.gc @@ -494,35 +494,33 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (with-pp - (let* ((v1-3 (-> arg1 actor-group 0 data 5 actor)) - (a0-1 (if v1-3 - (-> v1-3 extra process) - ) - ) - ) - (if (or (not a0-1) - (or (not (logtest? (-> a0-1 entity extra perm status) (entity-perm-status subtask-complete))) - (< -176128.0 (-> (target-pos 0) y)) - ) - ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - ) - (cond - ((logtest? (bot-flags bf19 bf20 bf21) (-> arg1 bot-flags)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 4 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - ((>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.5)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 3 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - ) + (let* ((v1-3 (-> arg1 actor-group 0 data 5 actor)) + (a0-1 (if v1-3 + (-> v1-3 extra process) + ) + ) + ) + (if (or (not a0-1) + (or (not (logtest? (-> a0-1 entity extra perm status) (entity-perm-status subtask-complete))) + (< -176128.0 (-> (target-pos 0) y)) + ) + ) + (set! (-> arg1 waypoint-time0) (current-time)) + ) + ) + (cond + ((logtest? (bot-flags bf19 bf20 bf21) (-> arg1 bot-flags)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 4 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.5)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 3 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) ) ) ) @@ -549,60 +547,58 @@ (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) (local-vars (a0-8 process) (a0-13 process)) - (with-pp - (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (s3-0 (if v1-3 - (-> v1-3 extra process) - ) - ) - (v1-8 (-> arg1 actor-group 0 data 3 actor)) - (s4-0 (if v1-8 - (-> v1-8 extra process) - ) - ) - (v1-13 (-> arg1 actor-group 0 data 2 actor)) - (s5-0 (if v1-13 - (-> v1-13 extra process) - ) - ) - ) - (if (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.1)) - (let ((a0-3 s3-0)) - (and a0-3 (< (the-as int (send-event a0-3 'query 'waypoint)) 3)) - ) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (s3-0 (if v1-3 + (-> v1-3 extra process) + ) ) - (send-event s3-0 'request 'waypoint 3) - ) - (if (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.75)) - (begin (set! a0-8 s4-0) a0-8) - (< (the-as int (send-event a0-8 'query 'waypoint)) 3) + (v1-8 (-> arg1 actor-group 0 data 3 actor)) + (s4-0 (if v1-8 + (-> v1-8 extra process) + ) ) - (send-event s4-0 'request 'waypoint 3) - ) - (if (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.9)) - (begin (set! a0-13 s5-0) a0-13) - (< (the-as int (send-event a0-13 'query 'waypoint)) 3) + (v1-13 (-> arg1 actor-group 0 data 2 actor)) + (s5-0 (if v1-13 + (-> v1-13 extra process) + ) ) - (send-event s5-0 'request 'waypoint 3) - ) - (cond - ((logtest? (bot-flags bf19 bf20 bf21) (-> arg1 bot-flags)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 4 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - ((and (>= (- (-> (target-pos 0) x) (-> arg1 root-override2 trans x)) -65536.0) - (or (not s3-0) (>= (the-as int (send-event s3-0 'query 'waypoint)) 3)) - (or (not s4-0) (>= (the-as int (send-event s4-0 'query 'waypoint)) 3)) - (or (not s5-0) (>= (the-as int (send-event s5-0 'query 'waypoint)) 3)) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 4 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t ) + (if (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.1)) + (let ((a0-3 s3-0)) + (and a0-3 (< (the-as int (send-event a0-3 'query 'waypoint)) 3)) + ) + ) + (send-event s3-0 'request 'waypoint 3) ) + (if (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.75)) + (begin (set! a0-8 s4-0) a0-8) + (< (the-as int (send-event a0-8 'query 'waypoint)) 3) + ) + (send-event s4-0 'request 'waypoint 3) + ) + (if (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.9)) + (begin (set! a0-13 s5-0) a0-13) + (< (the-as int (send-event a0-13 'query 'waypoint)) 3) + ) + (send-event s5-0 'request 'waypoint 3) + ) + (cond + ((logtest? (bot-flags bf19 bf20 bf21) (-> arg1 bot-flags)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 4 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((and (>= (- (-> (target-pos 0) x) (-> arg1 root-override2 trans x)) -65536.0) + (or (not s3-0) (>= (the-as int (send-event s3-0 'query 'waypoint)) 3)) + (or (not s4-0) (>= (the-as int (send-event s4-0 'query 'waypoint)) 3)) + (or (not s5-0) (>= (the-as int (send-event s5-0 'query 'waypoint)) 3)) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 4 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) ) ) ) @@ -666,73 +662,71 @@ (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) (local-vars (a0-8 process)) - (with-pp - (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (s3-0 (if v1-3 - (-> v1-3 extra process) - ) - ) - (v1-8 (-> arg1 actor-group 0 data 3 actor)) - (s4-0 (if v1-8 - (-> v1-8 extra process) - ) - ) - (v1-13 (-> arg1 actor-group 0 data 2 actor)) - (s5-0 (if v1-13 - (-> v1-13 extra process) - ) - ) - ) - (let ((a0-1 s3-0)) - (if (and (and a0-1 (= (send-event a0-1 'query 'waypoint) 3)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.5)) - ) - (send-event s3-0 'request 'waypoint 9) - ) - ) - (when (and (not (channel-active? arg1 (the-as uint 0))) - (not (speech-playing? arg1 6)) - (begin (set! a0-8 s3-0) a0-8) - (>= (the-as int (send-event a0-8 'query 'waypoint)) 9) - ) - (play-speech arg1 6) - (play-speech arg1 7) - ) - (let ((a0-11 s5-0)) - (if (and (and a0-11 (= (send-event a0-11 'query 'waypoint) 3)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.6)) - ) - (send-event s5-0 'request 'waypoint 9) - ) - ) - (let ((a0-16 s4-0)) - (if (and (and a0-16 (= (send-event a0-16 'query 'waypoint) 3)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.8)) - ) - (send-event s4-0 'request 'waypoint 9) - ) - ) - (when (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4)) - (not (speech-playing? arg1 2)) - (not (channel-active? arg1 (the-as uint 0))) - ) - (play-speech arg1 2) - (play-speech arg1 3) - (play-speech arg1 4) - (play-speech arg1 5) - ) - (when (and (or (not s3-0) (>= (the-as int (send-event s3-0 'query 'waypoint)) 9)) - (or (not s4-0) (>= (the-as int (send-event s4-0 'query 'waypoint)) 9)) - (or (not s5-0) (>= (the-as int (send-event s5-0 'query 'waypoint)) 9)) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 9 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (s3-0 (if v1-3 + (-> v1-3 extra process) + ) + ) + (v1-8 (-> arg1 actor-group 0 data 3 actor)) + (s4-0 (if v1-8 + (-> v1-8 extra process) + ) + ) + (v1-13 (-> arg1 actor-group 0 data 2 actor)) + (s5-0 (if v1-13 + (-> v1-13 extra process) + ) + ) + ) + (let ((a0-1 s3-0)) + (if (and (and a0-1 (= (send-event a0-1 'query 'waypoint) 3)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.5)) + ) + (send-event s3-0 'request 'waypoint 9) + ) + ) + (when (and (not (channel-active? arg1 (the-as uint 0))) + (not (speech-playing? arg1 6)) + (begin (set! a0-8 s3-0) a0-8) + (>= (the-as int (send-event a0-8 'query 'waypoint)) 9) + ) + (play-speech arg1 6) + (play-speech arg1 7) + ) + (let ((a0-11 s5-0)) + (if (and (and a0-11 (= (send-event a0-11 'query 'waypoint) 3)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.6)) + ) + (send-event s5-0 'request 'waypoint 9) + ) + ) + (let ((a0-16 s4-0)) + (if (and (and a0-16 (= (send-event a0-16 'query 'waypoint) 3)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.8)) + ) + (send-event s4-0 'request 'waypoint 9) + ) + ) + (when (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4)) + (not (speech-playing? arg1 2)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 2) + (play-speech arg1 3) + (play-speech arg1 4) + (play-speech arg1 5) + ) + (when (and (or (not s3-0) (>= (the-as int (send-event s3-0 'query 'waypoint)) 9)) + (or (not s4-0) (>= (the-as int (send-event s4-0 'query 'waypoint)) 9)) + (or (not s5-0) (>= (the-as int (send-event s5-0 'query 'waypoint)) 9)) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 9 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) - #f ) + #f ) ) ) @@ -807,27 +801,27 @@ ) 1.0 ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + (set! (-> arg1 waypoint-time0) (current-time)) ) ) ) (let ((a0-3 s3-0)) (if (and (and a0-3 (= (send-event a0-3 'query 'waypoint) 9)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.1)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.1)) ) (send-event s3-0 'request 'waypoint 11) ) ) (let ((a0-8 s4-0)) (if (and (and a0-8 (= (send-event a0-8 'query 'waypoint) 9)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.9)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.9)) ) (send-event s4-0 'request 'waypoint 11) ) ) (let ((a0-13 s5-0)) (if (and (and a0-13 (= (send-event a0-13 'query 'waypoint) 9)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.7)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.7)) ) (send-event s5-0 'request 'waypoint 11) ) @@ -1615,18 +1609,16 @@ (set! (-> (the-as halt-wait-spot v1-34) check-done) (the-as (function halt-wait-spot hal symbol) - (lambda ((arg0 object) (arg1 hal-sewer)) (with-pp - (cond - ((logtest? (-> arg1 bot-task-bits) 1) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 24 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - (else - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - #f - ) + (lambda ((arg0 object) (arg1 hal-sewer)) (cond + ((logtest? (-> arg1 bot-task-bits) 1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 24 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + (else + (set! (-> arg1 waypoint-time0) (current-time)) + #f ) ) ) @@ -1697,7 +1689,7 @@ (-> v1-13 extra process) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.4)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.4)) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-1 from) (process->ppointer pp)) (set! (-> a1-1 num-params) 2) @@ -1716,7 +1708,7 @@ ) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.75)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.75)) (let ((a1-2 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-2 from) (process->ppointer pp)) (set! (-> a1-2 num-params) 2) @@ -1736,7 +1728,7 @@ ) ) (if (and (not (speech-playing? arg1 28)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) (not (channel-active? arg1 (the-as uint 0))) ) (play-speech arg1 28) @@ -1832,7 +1824,7 @@ (lambda ((arg0 object) (arg1 hal-sewer)) (with-pp (cond - ((>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.5)) + ((>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.5)) (cond ((logtest? (-> arg1 waypoint-bits) 1) (when (and (not (speech-playing? arg1 29)) (not (speech-playing? arg1 30))) @@ -1874,7 +1866,7 @@ (-> v1-44 extra process) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) (let ((a1-10 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-10 from) (process->ppointer pp)) (set! (-> a1-10 num-params) 2) @@ -1893,7 +1885,7 @@ ) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2.5)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2.5)) (let ((a1-11 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-11 from) (process->ppointer pp)) (set! (-> a1-11 num-params) 2) @@ -1912,7 +1904,7 @@ ) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3.5)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3.5)) (let ((a1-12 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-12 from) (process->ppointer pp)) (set! (-> a1-12 num-params) 2) @@ -2136,7 +2128,7 @@ #t ) ) - ((and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4)) + ((and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4)) (>= (vector4-dot (math-camera-pos) (the-as vector (-> arg1 test-plane))) 0.0) ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) @@ -2231,7 +2223,7 @@ ) ) (hal-sewer-method-228 arg1) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.75)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.75)) (let ((a1-8 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-8 from) (process->ppointer pp)) (set! (-> a1-8 num-params) 2) @@ -2250,7 +2242,7 @@ ) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2.75)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2.75)) (let ((a1-9 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-9 from) (process->ppointer pp)) (set! (-> a1-9 num-params) 2) @@ -2269,7 +2261,7 @@ ) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3.5)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3.5)) (let ((a1-10 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-10 from) (process->ppointer pp)) (set! (-> a1-10 num-params) 2) @@ -2344,69 +2336,67 @@ (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) (local-vars (a0-10 process)) - (with-pp - (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (s5-0 (if v1-3 - (-> v1-3 extra process) - ) - ) - (v1-8 (-> arg1 actor-group 0 data 3 actor)) - (s4-0 (if v1-8 - (-> v1-8 extra process) - ) - ) - (v1-13 (-> arg1 actor-group 0 data 2 actor)) - (s3-0 (if v1-13 - (-> v1-13 extra process) - ) - ) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.75)) - (send-event s4-0 'request 'waypoint 34) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2.25)) - (send-event s3-0 'request 'waypoint 34) - ) - (when (and (not (channel-active? arg1 (the-as uint 0))) - (and (not (speech-playing? arg1 42)) - (not (speech-playing? arg1 43)) - (begin - (let ((v1-45 (-> arg1 actor-group 0 data 1 actor))) - (set! a0-10 (if v1-45 - (-> v1-45 extra process) - ) - ) - ) - a0-10 - ) - (>= (the-as int (send-event a0-10 'query 'waypoint)) 33) - ) - ) - (if (zero? (get-rand-int arg1 2)) - (play-speech arg1 42) - (play-speech arg1 43) - ) - (play-speech arg1 44) - (play-speech arg1 45) - ) - (let ((a0-16 s5-0)) - (when (and (and a0-16 (= (send-event a0-16 'query 'waypoint) 34)) - (let ((a0-18 s4-0)) - (and a0-18 (= (send-event a0-18 'query 'waypoint) 34)) - ) - (let ((a0-20 s3-0)) - (and (and a0-20 (= (send-event a0-20 'query 'waypoint) 34)) - (outside-spot-radius? (the-as bot s5-0) (the-as bot-spot #f) (the-as vector #f) #f) - (outside-spot-radius? (the-as bot s4-0) (the-as bot-spot #f) (the-as vector #f) #f) - (outside-spot-radius? (the-as bot s3-0) (the-as bot-spot #f) (the-as vector #f) #f) - ) - ) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (s5-0 (if v1-3 + (-> v1-3 extra process) ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 35 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t + ) + (v1-8 (-> arg1 actor-group 0 data 3 actor)) + (s4-0 (if v1-8 + (-> v1-8 extra process) + ) + ) + (v1-13 (-> arg1 actor-group 0 data 2 actor)) + (s3-0 (if v1-13 + (-> v1-13 extra process) + ) + ) + ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.75)) + (send-event s4-0 'request 'waypoint 34) + ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2.25)) + (send-event s3-0 'request 'waypoint 34) + ) + (when (and (not (channel-active? arg1 (the-as uint 0))) + (and (not (speech-playing? arg1 42)) + (not (speech-playing? arg1 43)) + (begin + (let ((v1-45 (-> arg1 actor-group 0 data 1 actor))) + (set! a0-10 (if v1-45 + (-> v1-45 extra process) + ) + ) + ) + a0-10 + ) + (>= (the-as int (send-event a0-10 'query 'waypoint)) 33) + ) + ) + (if (zero? (get-rand-int arg1 2)) + (play-speech arg1 42) + (play-speech arg1 43) ) + (play-speech arg1 44) + (play-speech arg1 45) + ) + (let ((a0-16 s5-0)) + (when (and (and a0-16 (= (send-event a0-16 'query 'waypoint) 34)) + (let ((a0-18 s4-0)) + (and a0-18 (= (send-event a0-18 'query 'waypoint) 34)) + ) + (let ((a0-20 s3-0)) + (and (and a0-20 (= (send-event a0-20 'query 'waypoint) 34)) + (outside-spot-radius? (the-as bot s5-0) (the-as bot-spot #f) (the-as vector #f) #f) + (outside-spot-radius? (the-as bot s4-0) (the-as bot-spot #f) (the-as vector #f) #f) + (outside-spot-radius? (the-as bot s3-0) (the-as bot-spot #f) (the-as vector #f) #f) + ) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 35 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) @@ -2561,7 +2551,7 @@ ) 1.0 ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + (set! (-> arg1 waypoint-time0) (current-time)) ) (else (if (and (not (speech-playing? arg1 46)) (not (channel-active? arg1 (the-as uint 0)))) @@ -2573,21 +2563,21 @@ ) (let ((a0-6 s3-0)) (if (and (and a0-6 (= (send-event a0-6 'query 'waypoint) 35)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.1)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.1)) ) (send-event s3-0 'request 'waypoint 37) ) ) (let ((a0-11 s4-0)) (if (and (and a0-11 (= (send-event a0-11 'query 'waypoint) 35)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.9)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.9)) ) (send-event s4-0 'request 'waypoint 37) ) ) (let ((a0-16 s5-0)) (if (and (and a0-16 (= (send-event a0-16 'query 'waypoint) 35)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.7)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.7)) ) (send-event s5-0 'request 'waypoint 37) ) @@ -2738,7 +2728,7 @@ ) (cond ((not (logtest? (-> arg1 waypoint-bits) 1)) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.5)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.5)) (logior! (-> arg1 waypoint-bits) 1) (let ((a1-5 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-5 from) (process->ppointer pp)) @@ -2763,7 +2753,7 @@ #f ) ((not (logtest? (-> arg1 waypoint-bits) 2)) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4)) (logior! (-> arg1 waypoint-bits) 2) (let ((a1-10 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-10 from) (process->ppointer pp)) @@ -2784,7 +2774,7 @@ #f ) ((not (logtest? (-> arg1 waypoint-bits) 4)) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 5)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 5)) (logior! (-> arg1 waypoint-bits) 4) (let ((a1-11 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-11 from) (process->ppointer pp)) @@ -2875,58 +2865,56 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (with-pp - (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (s3-0 (if v1-3 - (-> v1-3 extra process) - ) - ) - (v1-8 (-> arg1 actor-group 0 data 3 actor)) - (s4-0 (if v1-8 - (-> v1-8 extra process) - ) - ) - (v1-13 (-> arg1 actor-group 0 data 2 actor)) - (s5-0 (if v1-13 - (-> v1-13 extra process) - ) - ) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.4)) - (send-event s4-0 'request 'waypoint 42) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.7)) - (send-event s5-0 'request 'waypoint 42) - ) - (cond - ((hal-sewer-method-231 arg1 24) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 44 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - ((let ((a0-11 s3-0)) - (or (and (or (not a0-11) (>= (the-as int (send-event a0-11 'query 'waypoint)) 42)) - (outside-spot-radius? (the-as bot s3-0) (the-as bot-spot #f) (the-as vector #f) #f) - ) - (let ((a0-14 s4-0)) - (and (or (not a0-14) (>= (the-as int (send-event a0-14 'query 'waypoint)) 42)) - (outside-spot-radius? (the-as bot s4-0) (the-as bot-spot #f) (the-as vector #f) #f) - ) - ) - (let ((a0-17 s5-0)) - (and (or (not a0-17) (>= (the-as int (send-event a0-17 'query 'waypoint)) 42)) - (outside-spot-radius? (the-as bot s5-0) (the-as bot-spot #f) (the-as vector #f) #f) - ) - ) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (s3-0 (if v1-3 + (-> v1-3 extra process) + ) + ) + (v1-8 (-> arg1 actor-group 0 data 3 actor)) + (s4-0 (if v1-8 + (-> v1-8 extra process) + ) + ) + (v1-13 (-> arg1 actor-group 0 data 2 actor)) + (s5-0 (if v1-13 + (-> v1-13 extra process) + ) ) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 43 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.4)) + (send-event s4-0 'request 'waypoint 42) ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.7)) + (send-event s5-0 'request 'waypoint 42) + ) + (cond + ((hal-sewer-method-231 arg1 24) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 44 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((let ((a0-11 s3-0)) + (or (and (or (not a0-11) (>= (the-as int (send-event a0-11 'query 'waypoint)) 42)) + (outside-spot-radius? (the-as bot s3-0) (the-as bot-spot #f) (the-as vector #f) #f) + ) + (let ((a0-14 s4-0)) + (and (or (not a0-14) (>= (the-as int (send-event a0-14 'query 'waypoint)) 42)) + (outside-spot-radius? (the-as bot s4-0) (the-as bot-spot #f) (the-as vector #f) #f) + ) + ) + (let ((a0-17 s5-0)) + (and (or (not a0-17) (>= (the-as int (send-event a0-17 'query 'waypoint)) 42)) + (outside-spot-radius? (the-as bot s5-0) (the-as bot-spot #f) (the-as vector #f) #f) + ) + ) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 43 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) ) ) ) @@ -2974,62 +2962,60 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (with-pp - (when (hal-sewer-method-231 arg1 24) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 44 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) - (cond - ((logtest? (-> arg1 bot-task-bits) 20) - (logclear! (-> arg1 bot-flags) (bot-flags bf24)) - (reset-warn-time! arg1) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (when (not (channel-active? arg1 (the-as uint 0))) - (let ((v1-22 *target*)) - (when (and v1-22 (focus-test? v1-22 in-air) (not (logtest? (-> v1-22 focus-status) (focus-status hit)))) - (cond - ((not (speech-playing? arg1 58)) - (play-speech arg1 58) - ) - ((not (speech-playing? arg1 59)) - (play-speech arg1 59) - ) - ((not (speech-playing? arg1 60)) - (play-speech arg1 60) - (play-speech arg1 61) - ) - ) + (when (hal-sewer-method-231 arg1 24) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 44 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (cond + ((logtest? (-> arg1 bot-task-bits) 20) + (logclear! (-> arg1 bot-flags) (bot-flags bf24)) + (reset-warn-time! arg1) + (set! (-> arg1 waypoint-time0) (current-time)) + (when (not (channel-active? arg1 (the-as uint 0))) + (let ((v1-22 *target*)) + (when (and v1-22 (focus-test? v1-22 in-air) (not (logtest? (-> v1-22 focus-status) (focus-status hit)))) + (cond + ((not (speech-playing? arg1 58)) + (play-speech arg1 58) + ) + ((not (speech-playing? arg1 59)) + (play-speech arg1 59) + ) + ((not (speech-playing? arg1 60)) + (play-speech arg1 60) + (play-speech arg1 61) + ) ) ) ) ) - ((channel-active? arg1 (the-as uint 0)) - (reset-warn-time! arg1) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 11)) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (let ((v1-55 (-> arg1 sentries1-reminder-index)) - (a1-14 (-> arg1 hal2-course sentries1-reminders)) - ) - (cond - ((< v1-55 (-> a1-14 length)) - (set! (-> arg1 sentries1-reminder-index) (+ v1-55 1)) - (play-speech arg1 (-> a1-14 v1-55)) - ) - (else - (set! (-> arg1 bot-flags) (logior (bot-flags bf24) (-> arg1 bot-flags))) - ) + ) + ((channel-active? arg1 (the-as uint 0)) + (reset-warn-time! arg1) + (set! (-> arg1 waypoint-time0) (current-time)) + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 11)) + (set! (-> arg1 waypoint-time0) (current-time)) + (let ((v1-55 (-> arg1 sentries1-reminder-index)) + (a1-14 (-> arg1 hal2-course sentries1-reminders)) + ) + (cond + ((< v1-55 (-> a1-14 length)) + (set! (-> arg1 sentries1-reminder-index) (+ v1-55 1)) + (play-speech arg1 (-> a1-14 v1-55)) + ) + (else + (set! (-> arg1 bot-flags) (logior (bot-flags bf24) (-> arg1 bot-flags))) ) ) ) ) ) - #f ) + #f ) ) ) @@ -3103,58 +3089,56 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (with-pp - (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (s3-0 (if v1-3 - (-> v1-3 extra process) - ) - ) - (v1-8 (-> arg1 actor-group 0 data 3 actor)) - (s4-0 (if v1-8 - (-> v1-8 extra process) - ) - ) - (v1-13 (-> arg1 actor-group 0 data 2 actor)) - (s5-0 (if v1-13 - (-> v1-13 extra process) - ) - ) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.2)) - (send-event s4-0 'request 'waypoint 44) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.4)) - (send-event s5-0 'request 'waypoint 44) - ) - (cond - ((hal-sewer-method-231 arg1 27) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 48 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - ((let ((a0-11 s3-0)) - (or (and (or (not a0-11) (>= (the-as int (send-event a0-11 'query 'waypoint)) 47)) - (outside-spot-radius? (the-as bot s3-0) (the-as bot-spot #f) (the-as vector #f) #f) - ) - (let ((a0-14 s4-0)) - (and (or (not a0-14) (>= (the-as int (send-event a0-14 'query 'waypoint)) 47)) - (outside-spot-radius? (the-as bot s4-0) (the-as bot-spot #f) (the-as vector #f) #f) - ) - ) - (let ((a0-17 s5-0)) - (and (or (not a0-17) (>= (the-as int (send-event a0-17 'query 'waypoint)) 47)) - (outside-spot-radius? (the-as bot s5-0) (the-as bot-spot #f) (the-as vector #f) #f) - ) - ) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (s3-0 (if v1-3 + (-> v1-3 extra process) + ) + ) + (v1-8 (-> arg1 actor-group 0 data 3 actor)) + (s4-0 (if v1-8 + (-> v1-8 extra process) + ) + ) + (v1-13 (-> arg1 actor-group 0 data 2 actor)) + (s5-0 (if v1-13 + (-> v1-13 extra process) + ) ) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 47 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.2)) + (send-event s4-0 'request 'waypoint 44) ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.4)) + (send-event s5-0 'request 'waypoint 44) + ) + (cond + ((hal-sewer-method-231 arg1 27) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 48 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((let ((a0-11 s3-0)) + (or (and (or (not a0-11) (>= (the-as int (send-event a0-11 'query 'waypoint)) 47)) + (outside-spot-radius? (the-as bot s3-0) (the-as bot-spot #f) (the-as vector #f) #f) + ) + (let ((a0-14 s4-0)) + (and (or (not a0-14) (>= (the-as int (send-event a0-14 'query 'waypoint)) 47)) + (outside-spot-radius? (the-as bot s4-0) (the-as bot-spot #f) (the-as vector #f) #f) + ) + ) + (let ((a0-17 s5-0)) + (and (or (not a0-17) (>= (the-as int (send-event a0-17 'query 'waypoint)) 47)) + (outside-spot-radius? (the-as bot s5-0) (the-as bot-spot #f) (the-as vector #f) #f) + ) + ) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 47 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) ) ) ) @@ -3202,60 +3186,58 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (with-pp - (when (hal-sewer-method-231 arg1 27) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 48 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) - (cond - ((logtest? (-> arg1 bot-task-bits) 40) - (logclear! (-> arg1 bot-flags) (bot-flags bf24)) - (reset-warn-time! arg1) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (when (not (channel-active? arg1 (the-as uint 0))) - (let ((v1-22 *target*)) - (when (and v1-22 (focus-test? v1-22 in-air) (not (logtest? (-> v1-22 focus-status) (focus-status hit)))) - (cond - ((not (speech-playing? arg1 64)) - (play-speech arg1 64) - ) - ((not (speech-playing? arg1 65)) - (play-speech arg1 65) - ) - ) + (when (hal-sewer-method-231 arg1 27) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 48 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (cond + ((logtest? (-> arg1 bot-task-bits) 40) + (logclear! (-> arg1 bot-flags) (bot-flags bf24)) + (reset-warn-time! arg1) + (set! (-> arg1 waypoint-time0) (current-time)) + (when (not (channel-active? arg1 (the-as uint 0))) + (let ((v1-22 *target*)) + (when (and v1-22 (focus-test? v1-22 in-air) (not (logtest? (-> v1-22 focus-status) (focus-status hit)))) + (cond + ((not (speech-playing? arg1 64)) + (play-speech arg1 64) + ) + ((not (speech-playing? arg1 65)) + (play-speech arg1 65) + ) ) ) ) ) - ((channel-active? arg1 (the-as uint 0)) - (reset-warn-time! arg1) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 9)) - (let ((v1-46 (-> arg1 sentries2-reminder-index)) - (a1-11 (-> arg1 hal2-course sentries2-reminders)) - ) - (cond - ((< v1-46 (-> a1-11 length)) - (set! (-> arg1 sentries2-reminder-index) (+ v1-46 1)) - (play-speech arg1 (-> a1-11 v1-46)) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - (else - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 20)) - (set! (-> arg1 bot-flags) (logior (bot-flags bf24) (-> arg1 bot-flags))) - ) - ) + ) + ((channel-active? arg1 (the-as uint 0)) + (reset-warn-time! arg1) + (set! (-> arg1 waypoint-time0) (current-time)) + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 9)) + (let ((v1-46 (-> arg1 sentries2-reminder-index)) + (a1-11 (-> arg1 hal2-course sentries2-reminders)) + ) + (cond + ((< v1-46 (-> a1-11 length)) + (set! (-> arg1 sentries2-reminder-index) (+ v1-46 1)) + (play-speech arg1 (-> a1-11 v1-46)) + (set! (-> arg1 waypoint-time0) (current-time)) + ) + (else + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 20)) + (set! (-> arg1 bot-flags) (logior (bot-flags bf24) (-> arg1 bot-flags))) + ) ) ) ) ) ) - #f ) + #f ) ) ) @@ -3318,9 +3300,7 @@ ) ) ) - (when (and (logtest? (-> arg1 waypoint-bits) 1) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.25)) - ) + (when (and (logtest? (-> arg1 waypoint-bits) 1) (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.25))) (set! (-> arg1 waypoint-bits) (logand -2 (-> arg1 waypoint-bits))) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-1 from) (process->ppointer pp)) @@ -3488,10 +3468,10 @@ ) ) ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.2)) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.2)) (send-event s3-0 'request 'waypoint 48) ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.4)) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.4)) (send-event s4-0 'request 'waypoint 48) ) ) @@ -3682,44 +3662,42 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (with-pp - (cond - ((hal-sewer-method-229 arg1) - (logclear! (-> arg1 bot-flags) (bot-flags bf24)) - (reset-warn-time! arg1) - (when (and (not (channel-active? arg1 (the-as uint 0))) (scene-play arg1 "sewer-hosehead" #f)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 57 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + (cond + ((hal-sewer-method-229 arg1) + (logclear! (-> arg1 bot-flags) (bot-flags bf24)) + (reset-warn-time! arg1) + (when (and (not (channel-active? arg1 (the-as uint 0))) (scene-play arg1 "sewer-hosehead" #f)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 57 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) - (else - (cond - ((channel-active? arg1 (the-as uint 0)) - (set! (-> arg1 waypoint-time0) (+ (-> pp clock frame-counter) (seconds 9))) - ) - ((>= (-> pp clock frame-counter) (-> arg1 waypoint-time0)) - (let ((a1-8 - (bot-speech-list-method-9 - (-> arg1 hal2-course bomb2-reminders) - arg1 - (-> arg1 hal2-course speeches) - (speech-flags) - ) + ) + (else + (cond + ((channel-active? arg1 (the-as uint 0)) + (set! (-> arg1 waypoint-time0) (+ (current-time) (seconds 9))) + ) + ((>= (current-time) (-> arg1 waypoint-time0)) + (let ((a1-8 + (bot-speech-list-method-9 + (-> arg1 hal2-course bomb2-reminders) + arg1 + (-> arg1 hal2-course speeches) + (speech-flags) ) ) - (if (>= a1-8 0) - (play-speech arg1 a1-8) - (set! (-> arg1 bot-flags) (logior (bot-flags bf24) (-> arg1 bot-flags))) - ) - ) + ) + (if (>= a1-8 0) + (play-speech arg1 a1-8) + (set! (-> arg1 bot-flags) (logior (bot-flags bf24) (-> arg1 bot-flags))) + ) ) - ) + ) ) ) - #f ) + #f ) ) ) @@ -3927,70 +3905,66 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (with-pp - (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (s3-0 (if v1-3 - (-> v1-3 extra process) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (s3-0 (if v1-3 + (-> v1-3 extra process) + ) + ) + (v1-8 (-> arg1 actor-group 0 data 3 actor)) + (s4-0 (if v1-8 + (-> v1-8 extra process) + ) + ) + (v1-13 (-> arg1 actor-group 0 data 2 actor)) + (s5-0 (if v1-13 + (-> v1-13 extra process) + ) + ) + ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) + (send-event s5-0 'request 'waypoint 59) + ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3)) + (send-event s3-0 'request 'waypoint 59) + ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4)) + (send-event s4-0 'request 'waypoint 59) + ) + (when (not (channel-active? arg1 (the-as uint 0))) + (cond + ((and (not (speech-playing? arg1 75)) (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 6))) + (play-speech arg1 75) + (play-speech arg1 76) + ) + (else + (when (and (>= (vector4-dot (-> (the-as process-focusable s3-0) root-override trans) (the-as vector (-> arg1 test-plane))) + 0.0 + ) + (>= (vector4-dot (-> (the-as process-focusable s4-0) root-override trans) (the-as vector (-> arg1 test-plane))) + 0.0 + ) + (>= (vector4-dot (-> (the-as process-focusable s5-0) root-override trans) (the-as vector (-> arg1 test-plane))) + 0.0 + ) ) - ) - (v1-8 (-> arg1 actor-group 0 data 3 actor)) - (s4-0 (if v1-8 - (-> v1-8 extra process) - ) - ) - (v1-13 (-> arg1 actor-group 0 data 2 actor)) - (s5-0 (if v1-13 - (-> v1-13 extra process) - ) - ) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) - (send-event s5-0 'request 'waypoint 59) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) - (send-event s3-0 'request 'waypoint 59) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4)) - (send-event s4-0 'request 'waypoint 59) - ) - (when (not (channel-active? arg1 (the-as uint 0))) - (cond - ((and (not (speech-playing? arg1 75)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 6)) - ) - (play-speech arg1 75) - (play-speech arg1 76) - ) - (else - (when (and (>= (vector4-dot (-> (the-as process-focusable s3-0) root-override trans) (the-as vector (-> arg1 test-plane))) - 0.0 - ) - (>= (vector4-dot (-> (the-as process-focusable s4-0) root-override trans) (the-as vector (-> arg1 test-plane))) - 0.0 - ) - (>= (vector4-dot (-> (the-as process-focusable s5-0) root-override trans) (the-as vector (-> arg1 test-plane))) - 0.0 - ) - ) - (let ((a0-18 *target*)) - (when (and a0-18 - (and (>= (vector4-dot (get-trans a0-18 0) (the-as vector (-> arg1 test-plane))) 0.0) - (scene-play arg1 "sewer-blow-up-statue-res" #f) - ) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 67 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + (let ((a0-18 *target*)) + (when (and a0-18 + (and (>= (vector4-dot (get-trans a0-18 0) (the-as vector (-> arg1 test-plane))) 0.0) + (scene-play arg1 "sewer-blow-up-statue-res" #f) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 67 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) ) ) ) - (none) ) + (none) ) ) ) diff --git a/goal_src/jak2/levels/sewer/hosehead.gc b/goal_src/jak2/levels/sewer/hosehead.gc index 8b2a87dd18..016831c213 100644 --- a/goal_src/jak2/levels/sewer/hosehead.gc +++ b/goal_src/jak2/levels/sewer/hosehead.gc @@ -971,7 +971,7 @@ :enter (-> (method-of-type nav-enemy idle) enter) :exit (-> (method-of-type nav-enemy idle) exit) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (when (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (let ((a0-3 (handle->process (-> self focus handle)))) (when a0-3 (let ((f0-0 @@ -1017,7 +1017,7 @@ (set! (-> self fire-beam?) #f) (set! (-> self allow-head) #t) (set! (-> self lazer-length) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -1063,7 +1063,7 @@ ) (set! (-> self head-angle) f0-5) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (when (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (let ((a0-8 (handle->process (-> self focus handle)))) (when a0-8 (let ((f0-6 @@ -1429,7 +1429,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior hosehead) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -1831,9 +1831,9 @@ (ja :num! (seek! max f30-0)) ) (set! (-> self fire-beam?) #t) - (let ((gp-0 (+ (-> self clock frame-counter) (seconds 2)))) + (let ((gp-0 (+ (current-time) (seconds 2)))) (until #f - (when (or (< gp-0 (-> self clock frame-counter)) (not (-> self fire-beam?)) (not (enemy-method-96 self 8192.0 #t))) + (when (or (< gp-0 (current-time)) (not (-> self fire-beam?)) (not (enemy-method-96 self 8192.0 #t))) (set! (-> self fire-beam?) #f) (set! (-> self allow-head) #f) (goto cfg-13) @@ -1954,9 +1954,9 @@ ) ) (nav-enemy-method-166 self) - (set! (-> self last-time-dist-changed) (-> self clock frame-counter)) + (set! (-> self last-time-dist-changed) (current-time)) (set! (-> self next-lazer-time) 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -1985,11 +1985,9 @@ 0 ) ((zero? (-> self next-lazer-time)) - (set! (-> self next-lazer-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (get-rand-float-range self 1.0 2.0)))) - ) + (set! (-> self next-lazer-time) (+ (current-time) (the int (* 300.0 (get-rand-float-range self 1.0 2.0))))) ) - ((>= (-> self clock frame-counter) (-> self next-lazer-time)) + ((>= (current-time) (-> self next-lazer-time)) (if (and (enemy-method-96 self 3640.889 #t) (and (< 40960.0 f30-0) (hosehead-method-190 self))) (go-virtual fire) ) diff --git a/goal_src/jak2/levels/sewer/mog2-course.gc b/goal_src/jak2/levels/sewer/mog2-course.gc index 6d51ae1a2b..be6f8d4638 100644 --- a/goal_src/jak2/levels/sewer/mog2-course.gc +++ b/goal_src/jak2/levels/sewer/mog2-course.gc @@ -428,36 +428,31 @@ :nav-mesh-index 2 :skip-to -1 :on-set (lambda ((arg0 mog-sewer)) - (with-pp - (set! (-> arg0 waypoint-time0) (-> pp clock frame-counter)) - (set! (-> arg0 bot-flags) (logior (bot-flags bf19) (-> arg0 bot-flags))) - (clear-poi-and-focus! arg0) - (logclear! (-> arg0 focus-status) (focus-status disable)) - (set! (-> arg0 notice-enemy-dist) 204800.0) - (set! (-> arg0 min-speed) 32768.0) - (set! (-> arg0 max-speed) 32768.0) - (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) ruft-wait-spot arg0))) - (set! (-> v1-12 bytes 5) 1) - (set! (-> v1-12 bytes 6) 9) - (set! (-> v1-12 bytes 4) -1) - (set! (-> (the-as ruft-wait-spot v1-12) check-done) - (the-as - (function ruft-wait-spot ruffian symbol) - (lambda ((arg0 object) (arg1 mog-sewer)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 16 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t + (set! (-> arg0 waypoint-time0) (current-time)) + (set! (-> arg0 bot-flags) (logior (bot-flags bf19) (-> arg0 bot-flags))) + (clear-poi-and-focus! arg0) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 notice-enemy-dist) 204800.0) + (set! (-> arg0 min-speed) 32768.0) + (set! (-> arg0 max-speed) 32768.0) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) ruft-wait-spot arg0))) + (set! (-> v1-12 bytes 5) 1) + (set! (-> v1-12 bytes 6) 9) + (set! (-> v1-12 bytes 4) -1) + (set! (-> (the-as ruft-wait-spot v1-12) check-done) + (the-as + (function ruft-wait-spot ruffian symbol) + (lambda ((arg0 object) (arg1 mog-sewer)) (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 16 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) ) - ) - ) - ) ) - ) - (none) + ) ) + (none) ) :on-update #f :on-skipping-here #f diff --git a/goal_src/jak2/levels/sewer/sewer-obs.gc b/goal_src/jak2/levels/sewer/sewer-obs.gc index d274f4f17a..982bdf459f 100644 --- a/goal_src/jak2/levels/sewer/sewer-obs.gc +++ b/goal_src/jak2/levels/sewer/sewer-obs.gc @@ -215,29 +215,27 @@ This commonly includes things such as: (defun sew-tri-blade-joint-callback ((arg0 draw-control) (arg1 cspace-array) (arg2 joint-control)) "Handles the rotation and transformation of the [[sew-tri-blade]]" - (with-pp - (let ((blade (the-as sew-tri-blade (-> arg0 process))) - (matrix (new-stack-matrix0)) - (f30-0 (* 182.04445 (* 0.0033333334 (the float (-> pp clock frame-counter))))) - ) - (let ((s3-0 (-> arg1 data 4 bone transform))) - (matrix-rotate-y! matrix (* 240.0 f30-0)) - (matrix*! s3-0 matrix s3-0) - ) - (let ((s3-1 (-> arg1 data 5 bone transform))) - (matrix-rotate-y! matrix (* -240.0 f30-0)) - (matrix*! s3-1 matrix s3-1) - (set! (-> blade y-max) (+ (- 25395.2 (-> blade root trans y)) (-> s3-1 trans y))) - ) - (let ((s4-1 (-> arg1 data 6 bone transform))) - (matrix-rotate-y! matrix (* 240.0 f30-0)) - (matrix*! s4-1 matrix s4-1) - (set! (-> blade y-max) (fmax (-> blade y-max) (+ (- 19251.2 (-> blade root trans y)) (-> s4-1 trans y)))) + (let ((blade (the-as sew-tri-blade (-> arg0 process))) + (matrix (new-stack-matrix0)) + (f30-0 (* 182.04445 (* 0.0033333334 (the float (current-time))))) ) + (let ((s3-0 (-> arg1 data 4 bone transform))) + (matrix-rotate-y! matrix (* 240.0 f30-0)) + (matrix*! s3-0 matrix s3-0) + ) + (let ((s3-1 (-> arg1 data 5 bone transform))) + (matrix-rotate-y! matrix (* -240.0 f30-0)) + (matrix*! s3-1 matrix s3-1) + (set! (-> blade y-max) (+ (- 25395.2 (-> blade root trans y)) (-> s3-1 trans y))) + ) + (let ((s4-1 (-> arg1 data 6 bone transform))) + (matrix-rotate-y! matrix (* 240.0 f30-0)) + (matrix*! s4-1 matrix s4-1) + (set! (-> blade y-max) (fmax (-> blade y-max) (+ (- 19251.2 (-> blade root trans y)) (-> s4-1 trans y)))) ) - 0 - (none) ) + 0 + (none) ) (defstate idle (sew-tri-blade) @@ -342,81 +340,79 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (with-pp - (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) - (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) - (set! (-> cshape reaction) cshape-reaction-default) - (set! (-> cshape no-reaction) - (the-as (function collide-shape-moving collide-query vector vector object) nothing) - ) - (let ((s3-0 (new 'process 'collide-shape-prim-group cshape (the-as uint 3) 0))) - (set! (-> cshape total-prims) (the-as uint 4)) - (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid deadly)) - (set-vector! (-> s3-0 local-sphere) 0.0 10240.0 0.0 36864.0) - (set! (-> cshape root-prim) s3-0) - ) - (pusher-init cshape) - (let ((v1-16 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 2) (the-as uint 0)))) - (set! (-> v1-16 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> v1-16 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-16 prim-core action) (collide-action solid deadly)) - (set! (-> v1-16 transform-index) 4) - (set-vector! (-> v1-16 local-sphere) 0.0 8192.0 0.0 18841.6) - ) - (let ((v1-18 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 1) (the-as uint 0)))) - (set! (-> v1-18 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> v1-18 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-18 prim-core action) (collide-action solid deadly)) - (set! (-> v1-18 transform-index) 5) - (set-vector! (-> v1-18 local-sphere) 0.0 8192.0 0.0 12288.0) - ) - (let ((v1-20 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-20 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> v1-20 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-20 prim-core action) (collide-action solid deadly)) - (set! (-> v1-20 transform-index) 6) - (set-vector! (-> v1-20 local-sphere) 0.0 4915.2 0.0 7372.8) - ) - (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) - (let ((v1-23 (-> cshape root-prim))) - (set! (-> cshape backup-collide-as) (-> v1-23 prim-core collide-as)) - (set! (-> cshape backup-collide-with) (-> v1-23 prim-core collide-with)) - ) - (set! (-> obj root) cshape) + (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((s3-0 (new 'process 'collide-shape-prim-group cshape (the-as uint 3) 0))) + (set! (-> cshape total-prims) (the-as uint 4)) + (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s3-0 prim-core action) (collide-action solid deadly)) + (set-vector! (-> s3-0 local-sphere) 0.0 10240.0 0.0 36864.0) + (set! (-> cshape root-prim) s3-0) ) - (process-drawable-from-entity! obj entity) - (logclear! (-> obj mask) (process-mask actor-pause)) - (initialize-skeleton - obj - (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-tri-blade" (the-as (pointer uint32) #f))) - (the-as pair 0) + (pusher-init cshape) + (let ((v1-16 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 2) (the-as uint 0)))) + (set! (-> v1-16 prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> v1-16 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-16 prim-core action) (collide-action solid deadly)) + (set! (-> v1-16 transform-index) 4) + (set-vector! (-> v1-16 local-sphere) 0.0 8192.0 0.0 18841.6) ) - (set! (-> obj state-time) (-> pp clock frame-counter)) - (set! (-> obj anim-time) 0.0) - (set! (-> obj anim-offset) 0.0) - (set! (-> obj skel postbind-function) sew-tri-blade-joint-callback) - (let* ((v1-33 *game-info*) - (a0-33 (+ (-> v1-33 attack-id) 1)) - ) - (set! (-> v1-33 attack-id) a0-33) - (set! (-> obj attack-id) a0-33) + (let ((v1-18 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-18 prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> v1-18 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-18 prim-core action) (collide-action solid deadly)) + (set! (-> v1-18 transform-index) 5) + (set-vector! (-> v1-18 local-sphere) 0.0 8192.0 0.0 12288.0) ) - (if (>= (res-lump-value entity 'extra-id int :default (the-as uint128 -1) :time -1000000000.0) 0) - (set! (-> obj anim-offset) 3.0) - ) - (set! (-> obj sound) (new 'process 'ambient-sound "none" (-> obj root trans))) - (set-falloff-far! (-> obj sound) 286720.0) - (set! (-> obj y-min) 0.0) - (set! (-> obj y-max) 48332.8) - (set! (-> obj snd-water) (static-sound-name "tri-blade-w")) - (set! (-> obj snd-no-water) (static-sound-name "tri-blade")) - (transform-post) - (go (method-of-object obj idle)) - (none) + (let ((v1-20 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-20 prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> v1-20 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-20 prim-core action) (collide-action solid deadly)) + (set! (-> v1-20 transform-index) 6) + (set-vector! (-> v1-20 local-sphere) 0.0 4915.2 0.0 7372.8) + ) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((v1-23 (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> v1-23 prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> v1-23 prim-core collide-with)) + ) + (set! (-> obj root) cshape) ) + (process-drawable-from-entity! obj entity) + (logclear! (-> obj mask) (process-mask actor-pause)) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-tri-blade" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> obj state-time) (current-time)) + (set! (-> obj anim-time) 0.0) + (set! (-> obj anim-offset) 0.0) + (set! (-> obj skel postbind-function) sew-tri-blade-joint-callback) + (let* ((v1-33 *game-info*) + (a0-33 (+ (-> v1-33 attack-id) 1)) + ) + (set! (-> v1-33 attack-id) a0-33) + (set! (-> obj attack-id) a0-33) + ) + (if (>= (res-lump-value entity 'extra-id int :default (the-as uint128 -1) :time -1000000000.0) 0) + (set! (-> obj anim-offset) 3.0) + ) + (set! (-> obj sound) (new 'process 'ambient-sound "none" (-> obj root trans))) + (set-falloff-far! (-> obj sound) 286720.0) + (set! (-> obj y-min) 0.0) + (set! (-> obj y-max) 48332.8) + (set! (-> obj snd-water) (static-sound-name "tri-blade-w")) + (set! (-> obj snd-no-water) (static-sound-name "tri-blade")) + (transform-post) + (go (method-of-object obj idle)) + (none) ) (deftype sew-arm-blade (sew-blade) @@ -733,7 +729,7 @@ This commonly includes things such as: (send-event-function hit-proc evt) ) ) - (set! (-> self no-collision-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self no-collision-timer) (the-as uint (current-time))) (let ((root-prim (-> self root-overide root-prim))) (set! (-> root-prim prim-core collide-as) (collide-spec)) (set! (-> root-prim prim-core collide-with) (collide-spec)) @@ -747,7 +743,7 @@ This commonly includes things such as: ) :trans (behavior () (when (and (nonzero? (-> self no-collision-timer)) - (>= (- (-> self clock frame-counter) (the-as int (-> self no-collision-timer))) + (>= (- (current-time) (the-as int (-> self no-collision-timer))) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout)) ) ) @@ -1067,17 +1063,17 @@ This commonly includes things such as: (defstate idle (sew-light-control) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (local-vars (v0-0 entity)) + (local-vars (actor entity)) (the-as object (case event-type (('use-switch) - (set! v0-0 (entity-by-name (the-as string (-> event param 0)))) - (set! (-> self switch-ent) (the-as entity-actor v0-0)) - v0-0 + (set! actor (entity-by-name (the-as string (-> event param 0)))) + (set! (-> self switch-ent) (the-as entity-actor actor)) + actor ) (('use-turret) - (set! v0-0 (entity-by-name (the-as string (-> event param 0)))) - (set! (-> self turret-ent) (the-as entity-actor v0-0)) - v0-0 + (set! actor (entity-by-name (the-as string (-> event param 0)))) + (set! (-> self turret-ent) (the-as entity-actor actor)) + actor ) ) ) diff --git a/goal_src/jak2/levels/sewer/sewer-obs2.gc b/goal_src/jak2/levels/sewer/sewer-obs2.gc index 4fc424a537..9a12ee907e 100644 --- a/goal_src/jak2/levels/sewer/sewer-obs2.gc +++ b/goal_src/jak2/levels/sewer/sewer-obs2.gc @@ -907,8 +907,8 @@ This commonly includes things such as: ) ) (cleanup-for-death self) - (let ((frame-counter (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 2)) + (let ((frame-counter (current-time))) + (until (>= (- (current-time) frame-counter) (seconds 2)) (suspend) ) ) @@ -1000,7 +1000,7 @@ This commonly includes things such as: (t9-2 sin-rad) (f1-0 -3.1415925) (f2-0 6.283185) - (f3-1 (the float (+ (-> self clock frame-counter) (the-as time-frame (-> self time-skew))))) + (f3-1 (the float (+ (current-time) (the-as time-frame (-> self time-skew))))) (f28-0 (t9-2 (+ f1-0 (* f2-0 (/ (- f3-1 (* (the float (the int (/ f3-1 period))) period)) period))))) ) (when (< ocean-base-height (-> self center y)) @@ -1566,7 +1566,7 @@ This commonly includes things such as: enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self draw status) (draw-control-status no-draw)) (none) ) diff --git a/goal_src/jak2/levels/sewer/sewer-scenes.gc b/goal_src/jak2/levels/sewer/sewer-scenes.gc index a2bad21a31..9b207aaaa0 100644 --- a/goal_src/jak2/levels/sewer/sewer-scenes.gc +++ b/goal_src/jak2/levels/sewer/sewer-scenes.gc @@ -1282,7 +1282,7 @@ (lambda :behavior task-manager () (local-vars (sv-96 int) (sv-100 float) (sv-104 vector)) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (set! (-> self hud-timer) (ppointer->handle (process-spawn hud-gunturret :init hud-init-by-other :to self))) (while (> (-> self data-int32 0) 0) (when (!= (level-status *level* 'sewer) 'active) @@ -1327,10 +1327,10 @@ (set! (-> *game-info* counter) (the float v1-51)) ) (when (and (= (-> self data-int32 1) sv-96) - (and (< sv-100 122880.0) (>= (- (-> self clock frame-counter) (-> self beep-time)) (seconds 40))) + (and (< sv-100 122880.0) (>= (- (current-time) (-> self beep-time)) (seconds 40))) ) (talker-spawn-func (-> *talker-speech* 53) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self beep-time) (-> self clock frame-counter)) + (set! (-> self beep-time) (current-time)) ) (suspend) ) diff --git a/goal_src/jak2/levels/stadium/jetboard/skatea-obs.gc b/goal_src/jak2/levels/stadium/jetboard/skatea-obs.gc index a956fcb233..2397c84744 100644 --- a/goal_src/jak2/levels/stadium/jetboard/skatea-obs.gc +++ b/goal_src/jak2/levels/stadium/jetboard/skatea-obs.gc @@ -350,8 +350,8 @@ (suspend) ) (send-event (handle->process (-> self voicebox)) 'speak-effect #f) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -392,8 +392,8 @@ (suspend) ) (send-event (handle->process (-> self voicebox)) 'speak-effect #f) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -414,7 +414,7 @@ (send-event *target* 'get-notify self) (set! (-> self trick-type) (board-tricks none)) (let ((gp-2 #f) - (s5-0 (+ (-> self clock frame-counter) (seconds 15))) + (s5-0 (+ (current-time) (seconds 15))) ) (until #f (let ((a1-7 (new 'stack-no-clear 'event-message-block))) @@ -433,11 +433,11 @@ ) ) (render-text self (text-id board-tutorial-boost-jump)) - (when (< s5-0 (-> self clock frame-counter)) + (when (< s5-0 (current-time)) (set! (-> self last-sound-id) (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei009" -99.0 0) ) - (set! s5-0 (+ (-> self clock frame-counter) (seconds 15))) + (set! s5-0 (+ (current-time) (seconds 15))) ) (suspend) (if (= (-> self trick-type) (board-tricks board-quick-jump)) @@ -467,8 +467,8 @@ (while (nonzero? (get-status *gui-control* (-> self last-sound-id))) (suspend) ) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -533,8 +533,8 @@ (suspend) ) (send-event (handle->process (-> self voicebox)) 'speak-effect #f) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -574,8 +574,8 @@ (suspend) ) (send-event (handle->process (-> self voicebox)) 'speak-effect #f) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -612,8 +612,8 @@ (suspend) ) (send-event (handle->process (-> self voicebox)) 'speak-effect #f) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -962,11 +962,11 @@ (hoverboard-training-manager-method-29 self) (when (not (-> self challenge-done)) (when (and (not (-> self combo-done?)) - (>= (- (-> self clock frame-counter) (-> self hint-time)) (seconds 30)) + (>= (- (current-time) (-> self hint-time)) (seconds 30)) (not (task-node-closed? (game-task-node stadium-board1-resolution))) ) (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei018" -99.0 0) - (set! (-> self hint-time) (-> self clock frame-counter)) + (set! (-> self hint-time) (current-time)) ) ) (none) @@ -1047,7 +1047,7 @@ (set! (-> self score) 0.0) (set! (-> self challenge-done) #f) (set! (-> self combo-done?) #f) - (set! (-> self hint-time) (-> self clock frame-counter)) + (set! (-> self hint-time) (current-time)) (while (and (not (-> self challenge-done)) (logtest? (-> *game-info* features) (game-feature board))) (suspend) ) @@ -1098,8 +1098,8 @@ t1-3 ) ) - (let ((s5-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-2) (seconds 1)) + (let ((s5-2 (current-time))) + (until (>= (- (current-time) s5-2) (seconds 1)) (suspend) ) ) @@ -1307,8 +1307,8 @@ t1-3 ) ) - (let ((s5-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-2) (seconds 1)) + (let ((s5-2 (current-time))) + (until (>= (- (current-time) s5-2) (seconds 1)) (suspend) ) ) @@ -1451,7 +1451,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :code (behavior () @@ -1583,7 +1583,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :code (behavior () @@ -1854,7 +1854,7 @@ This commonly includes things such as: ) (set! (-> self root-override trans y) (+ (-> self pos-y) - (* 2048.0 (cos (* 18204.445 (+ (-> self offset) (* 0.0033333334 (the float (-> self clock frame-counter))))))) + (* 2048.0 (cos (* 18204.445 (+ (-> self offset) (* 0.0033333334 (the float (current-time))))))) ) ) (transform-post) diff --git a/goal_src/jak2/levels/stadium/stadium-obs.gc b/goal_src/jak2/levels/stadium/stadium-obs.gc index 8d4d3db68d..0bbb14c7ef 100644 --- a/goal_src/jak2/levels/stadium/stadium-obs.gc +++ b/goal_src/jak2/levels/stadium/stadium-obs.gc @@ -907,7 +907,7 @@ This commonly includes things such as: :virtual #t :event defend-stadium-rift-rider-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -917,8 +917,8 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1.2)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1.2)) (suspend) ) ) @@ -1382,11 +1382,11 @@ This commonly includes things such as: (defbehavior stad-samos-post stad-samos () - (when (>= (- (-> self clock frame-counter) (-> self cquery-timer)) (seconds 0.32)) + (when (>= (- (current-time) (-> self cquery-timer)) (seconds 0.32)) (move-to-ground (-> self root-override2) 40960.0 40960.0 #t (collide-spec backgnd)) - (set! (-> self cquery-timer) (-> self clock frame-counter)) + (set! (-> self cquery-timer) (current-time)) ) - (when (and (nonzero? (-> self focus-disable-timer)) (< (-> self focus-disable-timer) (-> self clock frame-counter))) + (when (and (nonzero? (-> self focus-disable-timer)) (< (-> self focus-disable-timer) (current-time))) (logclear! (-> self focus-status) (focus-status ignore)) (set! (-> self focus-disable-timer) 0) 0 @@ -1529,8 +1529,8 @@ This commonly includes things such as: ) ) (set! (-> self rift-rider-actor) (entity-actor-lookup (-> self entity) 'alt-actor 0)) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.31)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.31)) (suspend) ) ) @@ -1594,11 +1594,11 @@ This commonly includes things such as: (set! (-> self enable-move?) #t) (set! (-> self speed) 12288.0) (set! (-> self observed-speed) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (when (and (nonzero? (-> self state-time)) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1))) + (when (and (nonzero? (-> self state-time)) (>= (- (current-time) (-> self state-time)) (seconds 1))) (set! (-> self state-time) 0) (let ((a1-0 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-0 from) (process->ppointer self)) @@ -1617,7 +1617,7 @@ This commonly includes things such as: ) (spawn-lightning self) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2)) (go-virtual move-rift-rider) ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) @@ -1802,7 +1802,7 @@ This commonly includes things such as: :virtual #t :enter (behavior () (logior! (-> self focus-status) (focus-status ignore)) - (set! (-> self focus-disable-timer) (+ (-> self clock frame-counter) (seconds 5))) + (set! (-> self focus-disable-timer) (+ (current-time) (seconds 5))) (kill-lightning self) (let ((a1-0 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-0 from) (process->ppointer self)) @@ -2024,8 +2024,8 @@ This commonly includes things such as: ) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 2)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 2)) (suspend) ) ) @@ -2102,86 +2102,84 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (with-pp - (stack-size-set! (-> obj main-thread) #x180) ;; added - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) - (the-as (function collide-shape-moving collide-query vector vector object) nothing) + (stack-size-set! (-> obj main-thread) #x180) ;; added + (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) + (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s4-0 reaction) cshape-reaction-default) + (set! (-> s4-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s4-0 penetrated-by) (penetrate jak-yellow-shot jak-red-shot jak-blue-shot)) + (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 3) 0))) + (set! (-> s4-0 total-prims) (the-as uint 4)) + (set! (-> s3-0 prim-core collide-as) (collide-spec bot)) + (set! (-> s3-0 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) ) - (set! (-> s4-0 penetrated-by) (penetrate jak-yellow-shot jak-red-shot jak-blue-shot)) - (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 3) 0))) - (set! (-> s4-0 total-prims) (the-as uint 4)) - (set! (-> s3-0 prim-core collide-as) (collide-spec bot)) - (set! (-> s3-0 prim-core collide-with) - (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) - ) - (set! (-> s3-0 prim-core action) (collide-action solid no-standon)) - (set-vector! (-> s3-0 local-sphere) 0.0 4505.6 0.0 5734.4) - (set! (-> s4-0 root-prim) s3-0) - ) - (let ((v1-13 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) - (set! (-> v1-13 prim-core collide-as) (collide-spec bot)) - (set! (-> v1-13 prim-core collide-with) - (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) - ) - (set! (-> v1-13 prim-core action) (collide-action solid)) - (set-vector! (-> v1-13 local-sphere) 0.0 2457.6 0.0 2457.6) - ) - (let ((v1-15 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) - (set! (-> v1-15 prim-core collide-as) (collide-spec bot)) - (set! (-> v1-15 prim-core collide-with) - (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) - ) - (set! (-> v1-15 prim-core action) (collide-action solid)) - (set-vector! (-> v1-15 local-sphere) 0.0 4505.6 0.0 2457.6) - ) - (let ((v1-17 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) - (set! (-> v1-17 prim-core collide-as) (collide-spec bot)) - (set! (-> v1-17 prim-core collide-with) - (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) - ) - (set! (-> v1-17 prim-core action) (collide-action solid no-standon)) - (set-vector! (-> v1-17 local-sphere) 0.0 6553.6 0.0 2457.6) - ) - (set! (-> s4-0 nav-radius) 6144.0) - (let ((v1-19 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-19 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-19 prim-core collide-with)) - ) - (set! (-> s4-0 event-self) 'touched) - (set! (-> obj root-override2) s4-0) + (set! (-> s3-0 prim-core action) (collide-action solid no-standon)) + (set-vector! (-> s3-0 local-sphere) 0.0 4505.6 0.0 5734.4) + (set! (-> s4-0 root-prim) s3-0) ) - (set! (-> obj hud) (the-as handle #f)) - (set! (-> obj hud-bot-index) 0) - (set! (-> obj rift-rider-joint-offset) 0) - (process-drawable-from-entity! obj arg0) - (init! obj) - (get-nav-control obj (the-as nav-mesh #f)) - (let ((v1-24 (-> obj nav))) - (set! (-> v1-24 sphere-mask) (the-as uint 1102)) + (let ((v1-13 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-13 prim-core collide-as) (collide-spec bot)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> v1-13 prim-core action) (collide-action solid)) + (set-vector! (-> v1-13 local-sphere) 0.0 2457.6 0.0 2457.6) ) - 0 - (logclear! (-> obj mask) (process-mask actor-pause)) - (process-entity-status! obj (entity-perm-status no-kill) #t) - (set! (-> obj rift-rider-actor) (entity-actor-lookup (-> obj entity) 'alt-actor 0)) - (set! (-> obj entity) arg0) - (dotimes (v1-28 4) - (set! (-> obj lightning v1-28) (the-as handle #f)) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec bot)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> v1-15 prim-core action) (collide-action solid)) + (set-vector! (-> v1-15 local-sphere) 0.0 4505.6 0.0 2457.6) ) - (set! (-> obj lightning-on?) #f) - (set! (-> obj rift-rider-actor) #f) - (set! (-> obj cquery-timer) (-> pp clock frame-counter)) - (vector-reset! (-> obj hit-dir)) - (set! (-> obj max-hit-points) (+ 5.0 (* 5.0 (you-suck-scale *game-info* #f)))) - (set! (-> obj hit-points) (-> obj max-hit-points)) - (set! (-> obj incoming-attack-id) (the-as uint -1)) - (set! (-> obj focus-disable-timer) 0) - (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 903) obj)) - (go (method-of-object obj idle)) - (none) + (let ((v1-17 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-17 prim-core collide-as) (collide-spec bot)) + (set! (-> v1-17 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> v1-17 prim-core action) (collide-action solid no-standon)) + (set-vector! (-> v1-17 local-sphere) 0.0 6553.6 0.0 2457.6) + ) + (set! (-> s4-0 nav-radius) 6144.0) + (let ((v1-19 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-19 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-19 prim-core collide-with)) + ) + (set! (-> s4-0 event-self) 'touched) + (set! (-> obj root-override2) s4-0) ) + (set! (-> obj hud) (the-as handle #f)) + (set! (-> obj hud-bot-index) 0) + (set! (-> obj rift-rider-joint-offset) 0) + (process-drawable-from-entity! obj arg0) + (init! obj) + (get-nav-control obj (the-as nav-mesh #f)) + (let ((v1-24 (-> obj nav))) + (set! (-> v1-24 sphere-mask) (the-as uint 1102)) + ) + 0 + (logclear! (-> obj mask) (process-mask actor-pause)) + (process-entity-status! obj (entity-perm-status no-kill) #t) + (set! (-> obj rift-rider-actor) (entity-actor-lookup (-> obj entity) 'alt-actor 0)) + (set! (-> obj entity) arg0) + (dotimes (v1-28 4) + (set! (-> obj lightning v1-28) (the-as handle #f)) + ) + (set! (-> obj lightning-on?) #f) + (set! (-> obj rift-rider-actor) #f) + (set! (-> obj cquery-timer) (current-time)) + (vector-reset! (-> obj hit-dir)) + (set! (-> obj max-hit-points) (+ 5.0 (* 5.0 (you-suck-scale *game-info* #f)))) + (set! (-> obj hit-points) (-> obj max-hit-points)) + (set! (-> obj incoming-attack-id) (the-as uint -1)) + (set! (-> obj focus-disable-timer) 0) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 903) obj)) + (go (method-of-object obj idle)) + (none) ) (defskelgroup skel-stad-samos samos samos-lod0-jg samos-idle-ja @@ -2669,10 +2667,8 @@ This commonly includes things such as: ) (send-event-function proc a1-2) ) - (when (< (-> self next-message-time) (-> self clock frame-counter)) - (set! (-> self next-message-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 2.0 5.0)))) - ) + (when (< (-> self next-message-time) (current-time)) + (set! (-> self next-message-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 2.0 5.0))))) (add-process *gui-control* self (gui-channel alert) (gui-action play) "cityv014" -99.0 0) ) ) @@ -2701,10 +2697,8 @@ This commonly includes things such as: ) (send-event-function proc a1-6) ) - (when (< (-> self next-message-time) (-> self clock frame-counter)) - (set! (-> self next-message-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 2.0 5.0)))) - ) + (when (< (-> self next-message-time) (current-time)) + (set! (-> self next-message-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 2.0 5.0))))) (add-process *gui-control* self (gui-channel alert) (gui-action play) "cityv014" -99.0 0) ) ) diff --git a/goal_src/jak2/levels/strip/chaincrate.gc b/goal_src/jak2/levels/strip/chaincrate.gc index 534d380012..544ba5db7a 100644 --- a/goal_src/jak2/levels/strip/chaincrate.gc +++ b/goal_src/jak2/levels/strip/chaincrate.gc @@ -283,36 +283,32 @@ ;; WARN: Return type mismatch symbol vs none. (defmethod strip-chain-crate-method-21 strip-chain-crate ((obj strip-chain-crate)) - (with-pp - (let ((f30-0 (total-distance (-> obj path))) - (f28-0 - (* (/ (the float (mod - (the-as uint (+ (-> pp clock frame-counter) (the-as time-frame (-> obj spawn-offset)))) - (-> obj spawn-delay) - ) - ) - (the float (-> obj spawn-delay)) - ) - (-> obj dist-apart) - ) - ) + (let ((f30-0 (total-distance (-> obj path))) + (f28-0 + (* (/ (the float + (mod (the-as uint (+ (current-time) (the-as time-frame (-> obj spawn-offset)))) (-> obj spawn-delay)) + ) + (the float (-> obj spawn-delay)) + ) + (-> obj dist-apart) + ) ) - (while (>= f30-0 f28-0) - (let ((f26-0 (/ f28-0 f30-0))) - (process-spawn strip-chain-crate-slave f26-0 (-> obj crate-speed) :to obj) - ) - (+! f28-0 (-> obj dist-apart)) ) + (while (>= f30-0 f28-0) + (let ((f26-0 (/ f28-0 f30-0))) + (process-spawn strip-chain-crate-slave f26-0 (-> obj crate-speed) :to obj) + ) + (+! f28-0 (-> obj dist-apart)) ) - (none) ) + (none) ) (defstate idle (strip-chain-crate) :virtual #t :code (behavior () (until #f - (when (>= (-> self clock frame-counter) (-> self next-spawn-time)) + (when (>= (current-time) (-> self next-spawn-time)) (process-spawn strip-chain-crate-slave 0 (-> self crate-speed) :to self) (+! (-> self next-spawn-time) (the-as time-frame (-> self spawn-delay))) ) @@ -332,43 +328,38 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (local-vars (sv-16 int)) - (with-pp - (set! (-> obj root) (new 'process 'trsqv)) - (set! (-> obj path) (new 'process 'curve-control obj 'path -1000000000.0)) - (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) - (let ((f28-0 53248.0) - (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))))) - (when v1-8 - (set! f28-0 (-> v1-8 0)) - (set! f26-0 (-> v1-8 1)) - (set! f30-0 (-> v1-8 2)) - ) + (set! (-> obj root) (new 'process 'trsqv)) + (set! (-> obj path) (new 'process 'curve-control obj 'path -1000000000.0)) + (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) + (let ((f28-0 53248.0) + (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))))) + (when v1-8 + (set! f28-0 (-> v1-8 0)) + (set! f26-0 (-> v1-8 1)) + (set! f30-0 (-> v1-8 2)) ) - (set! (-> obj crate-speed) f28-0) - (set! (-> obj dist-apart) f26-0) - (set! (-> obj spawn-delay) (the-as uint (the int (* 300.0 (/ f26-0 f28-0))))) - (set! (-> obj spawn-offset) (the-as uint (the int (* f30-0 (the float (-> obj spawn-delay)))))) ) - (set! (-> obj next-spawn-time) - (+ (-> pp clock frame-counter) - (the-as - time-frame - (- (-> obj spawn-delay) - (mod - (the-as uint (+ (-> pp clock frame-counter) (the-as time-frame (-> obj spawn-offset)))) - (-> obj spawn-delay) - ) - ) - ) - ) - ) - (logclear! (-> obj mask) (process-mask actor-pause)) - (strip-chain-crate-method-21 obj) - (go (method-of-object obj idle)) - (none) + (set! (-> obj crate-speed) f28-0) + (set! (-> obj dist-apart) f26-0) + (set! (-> obj spawn-delay) (the-as uint (the int (* 300.0 (/ f26-0 f28-0))))) + (set! (-> obj spawn-offset) (the-as uint (the int (* f30-0 (the float (-> obj spawn-delay)))))) ) + (set! (-> obj next-spawn-time) + (+ (current-time) + (the-as + time-frame + (- (-> obj spawn-delay) + (mod (the-as uint (+ (current-time) (the-as time-frame (-> obj spawn-offset)))) (-> obj spawn-delay)) + ) + ) + ) + ) + (logclear! (-> obj mask) (process-mask actor-pause)) + (strip-chain-crate-method-21 obj) + (go (method-of-object obj idle)) + (none) ) diff --git a/goal_src/jak2/levels/strip/strip-drop.gc b/goal_src/jak2/levels/strip/strip-drop.gc index 63344d9498..08771d045c 100644 --- a/goal_src/jak2/levels/strip/strip-drop.gc +++ b/goal_src/jak2/levels/strip/strip-drop.gc @@ -248,10 +248,10 @@ :trans (the-as (function none :behavior strip-game-crate) rider-trans) :code (the-as (function none :behavior strip-game-crate) sleep-code) :post (behavior () - (let* ((f30-1 (* 333.14133 (cos (* 66.8053 (the float (mod (-> self clock frame-counter) 981)))))) - (f28-1 (* 358.62756 (cos (* 48.65331 (the float (mod (-> self clock frame-counter) 1346)))))) + (let* ((f30-1 (* 333.14133 (cos (* 66.8053 (the float (mod (current-time) 981)))))) + (f28-1 (* 358.62756 (cos (* 48.65331 (the float (mod (current-time) 1346)))))) (f0-6 30.0) - (gp-0 (+ (-> self clock frame-counter) (seconds -15.24))) + (gp-0 (+ (current-time) (seconds -15.24))) (f26-1 (+ 637.1556 (* 637.1556 (cos (* 65536.0 (/ (the float (mod gp-0 (the int (* 300.0 f0-6)))) (* 300.0 f0-6)))))) ) @@ -415,7 +415,7 @@ (none) ) :post (behavior () - (let* ((f0-1 (* 3.640889 (the float (mod (-> self clock frame-counter) #x4650)))) + (let* ((f0-1 (* 3.640889 (the float (mod (current-time) #x4650)))) (f0-5 (+ -16384.0 (* 8192.0 (+ 1.0 (cos f0-1))))) ) (quaternion-rotate-y! (-> self root quat) (-> self init-quat) f0-5) diff --git a/goal_src/jak2/levels/strip/strip-obs.gc b/goal_src/jak2/levels/strip/strip-obs.gc index 04dff10aed..b9099a5e4b 100644 --- a/goal_src/jak2/levels/strip/strip-obs.gc +++ b/goal_src/jak2/levels/strip/strip-obs.gc @@ -100,7 +100,7 @@ (set! (-> a1-7 param 1) (the-as uint v1-13)) ) (when (send-event-function gp-0 a1-7) - (set! (-> self no-collision-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self no-collision-timer) (the-as uint (current-time))) (let ((v1-18 (-> self root-override root-prim))) (set! (-> v1-18 prim-core collide-as) (collide-spec)) (set! (-> v1-18 prim-core collide-with) (collide-spec)) @@ -119,7 +119,7 @@ ;; WARN: Return type mismatch symbol vs none. (defbehavior strip-trans strip-hazard () (when (and (nonzero? (-> self no-collision-timer)) - (>= (- (-> self clock frame-counter) (the-as int (-> self no-collision-timer))) (seconds 0.3)) + (>= (- (current-time) (the-as int (-> self no-collision-timer))) (seconds 0.3)) ) (let ((v1-7 (-> self root-override root-prim))) (set! (-> v1-7 prim-core collide-as) (-> self root-override backup-collide-as)) @@ -770,11 +770,11 @@ This commonly includes things such as: (set-setting! 'entity-name (-> self camera-name) 0.0 -1) ) ) - ((>= (- (-> self clock frame-counter) (-> self enter-time)) (seconds 3)) + ((>= (- (current-time) (-> self enter-time)) (seconds 3)) (talker-speech-class-method-12 (-> *talker-speech* 194) 1) ) ) - (set! (-> self enter-time) (-> self clock frame-counter)) + (set! (-> self enter-time) (current-time)) ) #f ) @@ -795,7 +795,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self lightning-time) (+ (-> self clock frame-counter) -1)) + (set! (-> self lightning-time) (+ (current-time) -1)) (none) ) :exit (behavior () @@ -805,10 +805,8 @@ This commonly includes things such as: :code (the-as (function none :behavior grenade-point) sleep-code) :post (behavior () (spawn (-> self part) (-> self root-override trans)) - (when (< (-> self lightning-time) (-> self clock frame-counter)) - (set! (-> self lightning-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.6 1.4)))) - ) + (when (< (-> self lightning-time) (current-time)) + (set! (-> self lightning-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.6 1.4))))) (let ((s5-0 (new 'stack-no-clear 'vector))) (set! (-> s5-0 quad) (-> self root-override trans quad)) (let* ((gp-1 (-> self strike-table (-> self last-strike-index))) @@ -1304,7 +1302,7 @@ This commonly includes things such as: (t9-0) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (send-event (handle->process (-> self end-target)) 'die) (remove-setting! 'point-of-interest) (none) @@ -1507,14 +1505,14 @@ This commonly includes things such as: (lambda :behavior task-manager () (local-vars (sv-16 object)) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (set! (-> self total-time) (seconds 120)) (set! (-> self hud-timer) (ppointer->handle (process-spawn hud-timer :init hud-init-by-other :to *target*))) (set! (-> self hud-counter) (ppointer->handle (process-spawn hud-plasmite :init hud-init-by-other :to self))) - (while (or (< (- (-> self clock frame-counter) (-> self start-time)) (-> self total-time)) + (while (or (< (- (current-time) (-> self start-time)) (-> self total-time)) (and *target* (focus-test? *target* in-air)) ) - (let ((v1-18 (the-as int (- (-> self total-time) (- (-> self clock frame-counter) (-> self start-time)))))) + (let ((v1-18 (the-as int (- (-> self total-time) (- (current-time) (-> self start-time)))))) (if (< (the-as time-frame v1-18) 0) (set! v1-18 0) ) @@ -1551,23 +1549,23 @@ This commonly includes things such as: (set! (-> self count) (the-as int sv-16)) ) (cond - ((and (>= (-> self clock frame-counter) (+ #x80e8 (-> self start-time))) + ((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 (>= (-> self clock frame-counter) (+ (-> self start-time) (seconds 90))) + ((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 (>= (-> self clock frame-counter) (+ (-> self start-time) (seconds 60))) + ((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! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> *game-info* counter) (the float (the-as int sv-16))) (if (>= 1 (the-as int sv-16)) (gui-control-method-12 diff --git a/goal_src/jak2/levels/temple/mountain-obs.gc b/goal_src/jak2/levels/temple/mountain-obs.gc index 63c228462e..7b17eed161 100644 --- a/goal_src/jak2/levels/temple/mountain-obs.gc +++ b/goal_src/jak2/levels/temple/mountain-obs.gc @@ -350,13 +350,13 @@ ) ) (sound-play "dice-sink") - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (set! (-> self draw color-mult quad) (-> self color quad)) (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + ((>= (- (current-time) (-> self state-time)) (seconds 0.5)) (+! (-> self speed-anim) (* -0.5 (-> self clock seconds-per-frame) (-> self time-anim))) (+! (-> self speed-anim) (* -6.0 (-> self clock seconds-per-frame) (-> self speed-anim))) (+! (-> self time-anim) (-> self speed-anim)) @@ -368,7 +368,7 @@ (set! (-> self active) (the-as uint 3)) ) ) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (!= (-> self active) 2)) + (when (and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (!= (-> self active) 2)) (set! (-> self active) (the-as uint 2)) (dotimes (gp-0 6) (matrix-rotate-xyz! (-> self face-matrix gp-0) (-> *dice-angle-array* gp-0)) @@ -400,7 +400,7 @@ (+ (-> self face-matrix-back v1-51 trans y) (* 4096.0 (-> self time-anim))) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (when (>= (- (current-time) (-> self state-time)) (seconds 2)) (set! (-> self active) (-> self first)) (go-virtual idle) ) @@ -872,9 +872,9 @@ ) :trans (behavior () (if (nonzero? (-> self curtime)) - (set! (-> self first-touch-time) (-> self clock frame-counter)) + (set! (-> self first-touch-time) (current-time)) ) - (set! (-> self curtime) (-> self clock frame-counter)) + (set! (-> self curtime) (current-time)) (when (and (zero? (-> self active)) (dice-wrong-way?)) ) (none) @@ -959,7 +959,7 @@ (set! (-> a0-2 trans quad) t0-1) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self time-anim) 1.0) (set! (-> self speed-anim) -0.5) (none) @@ -981,7 +981,7 @@ (set! (-> self time-anim) 0.0) (set! (-> self speed-anim) (- (-> self speed-anim))) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.7)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.7)) (set! (-> self time-anim) 0.0) ) (let ((s4-0 (new 'stack-no-clear 'matrix)) @@ -1003,7 +1003,7 @@ ) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.7)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.7)) (dotimes (v1-34 6) (when (= (-> self face-status v1-34) 1) (set! (-> self face-status v1-34) 0) @@ -1026,7 +1026,7 @@ :enter (behavior () (set! (-> self time-anim) 0.0) (set! (-> self speed-anim) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "dice-sink") (none) ) @@ -1038,7 +1038,7 @@ (dotimes (v1-5 6) (+! (-> self face-matrix v1-5 trans y) (* 4096.0 (-> self time-anim))) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 1)) (dotimes (v1-11 6) (when (= (-> self face-status v1-11) 1) (set! (-> self face-status v1-11) 0) @@ -1921,8 +1921,8 @@ This commonly includes things such as: (suspend) ) (set-setting! 'entity-name "camera-259" 0.0 0) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -1934,8 +1934,8 @@ This commonly includes things such as: (suspend) (ja :num! (seek!)) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -2591,7 +2591,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (get-point-at-percent-along-path! (-> self path) (-> self basetrans) (-> self path-pos) 'interp) (none) ) @@ -2599,9 +2599,9 @@ This commonly includes things such as: (set! (-> self flags) (logand -2 (-> self flags))) (plat-trans) (if (not (logtest? (-> self flags) 1)) - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) ) - (let ((v1-10 (and (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 0.5)) + (let ((v1-10 (and (>= (- (current-time) (-> self ride-timer)) (seconds 0.5)) (logtest? (-> self flags) 1) (if (logtest? (-> self flags) 2) (and *target* (process-grab? *target* #f)) @@ -2665,7 +2665,7 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('ridden) - (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (let ((v0-0 (the-as object (current-time)))) (set! (-> self ride-timer) (the-as time-frame v0-0)) v0-0 ) @@ -2677,7 +2677,7 @@ This commonly includes things such as: ) :trans (behavior () (plat-trans) - (when (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 1)) + (when (>= (- (current-time) (-> self ride-timer)) (seconds 1)) (cond ((= (-> self path-pos) 1.0) (set! (-> self dest-pos) 0.0) @@ -3331,7 +3331,7 @@ This commonly includes things such as: :virtual #t :trans (behavior () (plat-trans) - (if (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 1)) + (if (>= (- (current-time) (-> self ride-timer)) (seconds 1)) (go-virtual waiting) ) (none) diff --git a/goal_src/jak2/levels/temple/mountain-obs2.gc b/goal_src/jak2/levels/temple/mountain-obs2.gc index 317ca453d5..855dc6f453 100644 --- a/goal_src/jak2/levels/temple/mountain-obs2.gc +++ b/goal_src/jak2/levels/temple/mountain-obs2.gc @@ -224,7 +224,7 @@ For example for an elevator pre-compute the distance between the first and last (vector-normalize! (-> self axe-flip) 1.0) (vector-rotate90-around-y! (-> self axe-flip) (-> self axe-flip)) (set! (-> self angle-flip-vel) -10.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ) ) @@ -274,11 +274,11 @@ For example for an elevator pre-compute the distance between the first and last ) (set! (-> self dest-angle) 180.0) (set! (-> self on-shake) #f) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the int (-> self time-flip))) + (when (>= (- (current-time) (-> self state-time)) (the int (-> self time-flip))) (set! (-> self state-flip) (the-as uint 0)) 0 ) @@ -302,7 +302,7 @@ For example for an elevator pre-compute the distance between the first and last (+! (-> self angle-flip-vel) (* -6.0 (-> self clock seconds-per-frame) (-> self angle-flip-vel))) (+! (-> self angle-flip) (-> self angle-flip-vel)) (quaternion-vector-angle! (-> self root-override quat) (-> self axe-flip) (* 182.04445 (-> self angle-flip))) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the int (+ -300.0 (-> self time-flip)))) + (when (and (>= (- (current-time) (-> self state-time)) (the int (+ -300.0 (-> self time-flip)))) (= 1 (-> self state-flip)) ) (when (not (-> self on-shake)) diff --git a/goal_src/jak2/levels/temple/rhino.gc b/goal_src/jak2/levels/temple/rhino.gc index 79c173c2c9..e4acab70a2 100644 --- a/goal_src/jak2/levels/temple/rhino.gc +++ b/goal_src/jak2/levels/temple/rhino.gc @@ -624,7 +624,7 @@ ) ) (else - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (if (and (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (> (the-as int (-> self focus aware)) 0) ) (go-virtual active) @@ -1053,7 +1053,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior rhino) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-166 self) (let ((v1-4 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-4 enemy-flags))) @@ -1098,7 +1098,7 @@ (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 1.5)) (go-virtual active) ) (none) @@ -1137,7 +1137,7 @@ ) (set! (-> self charge-straight) #f) (nav-enemy-method-166 self) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) (none) ) @@ -1165,7 +1165,7 @@ (vector-! gp-0 s2-0 (-> self root-override2 trans)) (vector-normalize! gp-0 (+ 16384.0 (vector-length gp-0))) (vector+! s4-0 (-> self root-override2 trans) gp-0) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (and (< (vector-vector-xz-distance (get-trans (the-as process-focusable s3-0) 0) (-> self root-override2 trans)) 40960.0 ) @@ -1177,7 +1177,7 @@ (cond ((-> self charge-straight) (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + ((>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (< (vector-vector-xz-distance (get-trans (the-as process-focusable s3-0) 0) (-> self root-override2 trans)) 20480.0 ) @@ -1194,7 +1194,7 @@ ) ) ((and (< f28-0 8192.0) - (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) (>= 9.0 (ja-frame-num 0))) + (and (>= (- (current-time) (-> self state-time)) (seconds 2)) (>= 9.0 (ja-frame-num 0))) ) (go-virtual stop-run) ) @@ -1474,7 +1474,7 @@ :enter (behavior () (set-setting! 'sound-mode #f 0.0 1) (set-setting! 'sound-excitement 'abs 0.0 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-166 self) (let ((v1-8 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-8 enemy-flags))) diff --git a/goal_src/jak2/levels/title/title-obs.gc b/goal_src/jak2/levels/title/title-obs.gc index e1ff0336a7..3fe3b96a2b 100644 --- a/goal_src/jak2/levels/title/title-obs.gc +++ b/goal_src/jak2/levels/title/title-obs.gc @@ -477,24 +477,21 @@ ) (defun wait-for-press ((arg0 time-frame) (arg1 time-frame) (arg2 symbol)) - (with-pp - (let ((s3-0 (-> pp clock frame-counter)) - (s4-0 #f) - ) - (while (not (or (>= (- (-> pp clock frame-counter) s3-0) arg1) (and (>= (- (-> pp clock frame-counter) s3-0) arg0) s4-0)) - ) - (if (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) - (set! s4-0 #t) - ) - (when (cpad-pressed? 0 triangle) - (set! s4-0 'abort) - (goto cfg-14) - ) - (suspend) + (let ((s3-0 (current-time)) + (s4-0 #f) ) - (label cfg-14) - s4-0 + (while (not (or (>= (- (current-time) s3-0) arg1) (and (>= (- (current-time) s3-0) arg0) s4-0))) + (if (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) + (set! s4-0 #t) + ) + (when (cpad-pressed? 0 triangle) + (set! s4-0 'abort) + (goto cfg-14) + ) + (suspend) ) + (label cfg-14) + s4-0 ) ) @@ -528,7 +525,7 @@ (return (the-as object (-> self selected))) ) ) - (when (< (mod (-> self clock frame-counter) 300) 210) + (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)) ) @@ -564,28 +561,26 @@ ) (defun title-fade-out ((arg0 float)) - (with-pp - (setup *screen-filter* (new 'static 'vector) (new 'static 'vector :w 128.0) arg0 (bucket-id screen-filter)) - (let ((gp-0 (-> pp clock frame-counter))) - (until (>= (- (-> pp clock frame-counter) gp-0) (seconds 0.4)) - (suspend) - ) - ) - (send-event (ppointer->process (-> *setting-control* user-current movie)) 'abort) - (set! (-> *setting-control* user-current bg-a) 0.0) - (while (or (-> *setting-control* user-current movie) - (not *target*) - (not (and (-> *target* next-state) (= (-> *target* next-state name) 'target-title))) - (!= (-> *setting-control* user-current bg-a) 0.0) - ) + (setup *screen-filter* (new 'static 'vector) (new 'static 'vector :w 128.0) arg0 (bucket-id screen-filter)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.4)) (suspend) ) - (set! (-> *game-info* blackout-time) 0) - (set! (-> *setting-control* user-current bg-a-force) 0.0) - (disable *screen-filter*) - 0 - (none) ) + (send-event (ppointer->process (-> *setting-control* user-current movie)) 'abort) + (set! (-> *setting-control* user-current bg-a) 0.0) + (while (or (-> *setting-control* user-current movie) + (not *target*) + (not (and (-> *target* next-state) (= (-> *target* next-state name) 'target-title))) + (!= (-> *setting-control* user-current bg-a) 0.0) + ) + (suspend) + ) + (set! (-> *game-info* blackout-time) 0) + (set! (-> *setting-control* user-current bg-a-force) 0.0) + (disable *screen-filter*) + 0 + (none) ) (defun title-progress ((arg0 symbol)) diff --git a/goal_src/jak2/levels/undefined/ruf-states.gc b/goal_src/jak2/levels/undefined/ruf-states.gc index bab177f1fb..3b55a311a8 100644 --- a/goal_src/jak2/levels/undefined/ruf-states.gc +++ b/goal_src/jak2/levels/undefined/ruf-states.gc @@ -11,7 +11,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -57,7 +57,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -103,7 +103,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -146,7 +146,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -194,7 +194,7 @@ :enter (-> (method-of-type ruffian scared-idle) enter) :trans (behavior () (bot-method-223 self #t) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (cond ((not (bot-method-214 self)) (react-to-focus self) @@ -220,7 +220,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -256,7 +256,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -283,12 +283,10 @@ ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) (ruffian-method-240 self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -321,7 +319,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -342,7 +340,7 @@ ((bot-method-214 self) (go-hostile self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + ((and (>= (- (current-time) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) (go-virtual traveling) ) ) @@ -369,7 +367,7 @@ ) :trans (behavior () (bot-method-223 self #f) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (bot-method-214 self) (go-hostile self) ) @@ -512,7 +510,7 @@ (t9-0) ) ) - (when (and (logtest? (bot-flags bf24) (-> self bot-flags)) (!= (-> self state-time) (-> self clock frame-counter))) + (when (and (logtest? (bot-flags bf24) (-> self bot-flags)) (!= (-> self state-time) (current-time))) (logclear! (-> self bot-flags) (bot-flags bf24)) (ruffian-method-242 self) ) @@ -551,7 +549,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) diff --git a/goal_src/jak2/levels/underport/centipede.gc b/goal_src/jak2/levels/underport/centipede.gc index 6cc3d2f570..cb439e0cfb 100644 --- a/goal_src/jak2/levels/underport/centipede.gc +++ b/goal_src/jak2/levels/underport/centipede.gc @@ -222,15 +222,14 @@ (set! (-> centipede-cam dir y) 0.0) (vector-normalize! (-> centipede-cam dir) 1.0) (set! (-> centipede-cam trans quad) (-> obj root-override2 trans quad)) - (set! (-> centipede-cam trans y) - (+ 32768.0 - (* (+ (* 2048.0 (cos (* 218.45334 (the float (mod (-> pp clock frame-counter) 300))))) - (* 614.4 (cos (* 68.91272 (the float (mod (-> pp clock frame-counter) 951))))) - ) - (-> obj bobbing-intensity) - ) - (-> centipede-cam trans y) - ) + (set! (-> centipede-cam trans y) (+ 32768.0 + (* (+ (* 2048.0 (cos (* 218.45334 (the float (mod (current-time) 300))))) + (* 614.4 (cos (* 68.91272 (the float (mod (current-time) 951))))) + ) + (-> obj bobbing-intensity) + ) + (-> centipede-cam trans y) + ) ) (if (= (-> obj id) 1) (set! (-> centipede-cam dir y) -0.574) @@ -594,7 +593,7 @@ (quaternion-copy! (-> obj bobbing quat) (-> obj root-override2 quat)) (set! (-> obj bobbing trans quad) (-> obj root-override2 trans quad)) (let ((s5-0 (new 'stack-no-clear 'vector)) - (f30-1 (* 2662.4 (cos (* 283.70563 (the float (mod (-> pp clock frame-counter) 231)))))) + (f30-1 (* 2662.4 (cos (* 283.70563 (the float (mod (current-time) 231)))))) (bob-trans (-> obj bobbing trans)) ) (vector-z-quaternion! s5-0 (-> obj root-override2 quat)) @@ -850,10 +849,10 @@ (until #f (cond (*target* - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (else - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (when (>= (- (current-time) (-> self state-time)) (seconds 2)) (cleanup-for-death self) (go-virtual die-fast) ) @@ -945,7 +944,7 @@ (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (let ((v1-6 (handle->process (-> self focus handle)))) (if (or (not v1-6) (focus-test? (the-as process-focusable v1-6) dead)) (go-virtual stop-chase) @@ -1006,7 +1005,7 @@ (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2)) (react-to-focus self) ) (none) @@ -1176,10 +1175,10 @@ (none) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self desired-talking-volume) 1.0) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.35)) - (let* ((v1-5 (- (-> self clock frame-counter) (-> self state-time))) + (while (< (- (current-time) (-> self state-time)) (seconds 0.35)) + (let* ((v1-5 (- (current-time) (-> self state-time))) (f1-2 (* 0.00952381 (the float v1-5))) ) (quaternion-slerp! (-> self root-override2 quat) (-> self src-quat) (-> self dest-quat) (- 1.0 (* f1-2 f1-2))) @@ -1187,7 +1186,7 @@ (centipede-method-188 self) (suspend) ) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (while (< (- (current-time) (-> self state-time)) (seconds 1)) (centipede-method-188 self) (suspend) ) diff --git a/goal_src/jak2/levels/underport/jellyfish.gc b/goal_src/jak2/levels/underport/jellyfish.gc index 7a123e80c3..4ef6e20991 100644 --- a/goal_src/jak2/levels/underport/jellyfish.gc +++ b/goal_src/jak2/levels/underport/jellyfish.gc @@ -360,7 +360,7 @@ (v1-6 (jellyfish-method-161 self (new 'stack-no-clear 'vector) - (get-norm! (-> self sync) (the-as int (+ (-> self clock frame-counter) (seconds 1)))) + (get-norm! (-> self sync) (the-as int (+ (current-time) (seconds 1)))) ) ) (s5-2 (new 'stack-no-clear 'vector)) @@ -434,7 +434,7 @@ :trans (behavior () (local-vars (gp-0 vector)) (seek! (-> self tentacle-blend) 1.0 (-> self clock seconds-per-frame)) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((v1-4 (-> self focus aware))) (cond ((>= 1 (the-as int v1-4)) @@ -445,13 +445,13 @@ ) ) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 2)) (not (jellyfish-method-164 self (the-as process-focusable #f))) ) (go-virtual active) ) (if (and (not *jellyfish-mech-reserved*) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (>= (- (current-time) (-> self state-time)) (seconds 1)) (jellyfish-method-163 self (the-as process-focusable #f)) (begin (set! gp-0 (jellyfish-method-161 self (new 'stack-no-clear 'vector) (-> self path-stare-u))) @@ -541,7 +541,7 @@ (the-as vector #t) ) (logior! (-> self focus-status) (focus-status dangerous)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -655,7 +655,7 @@ (let ((gp-0 *target*)) (cond ((not (jellyfish-method-163 self gp-0)) - (set! (-> self last-attack-time) (-> self clock frame-counter)) + (set! (-> self last-attack-time) (current-time)) (go-virtual active) ) (else @@ -775,7 +775,7 @@ (suspend) (ja :num! (seek!)) ) - (set! (-> self last-attack-time) (-> self clock frame-counter)) + (set! (-> self last-attack-time) (current-time)) (go-virtual active) (none) ) @@ -804,7 +804,7 @@ (dispose! self) (logclear! (-> self focus-status) (focus-status dangerous)) (enemy-method-52 self (-> self root-override2 transv)) - (let ((gp-0 (-> self clock frame-counter))) + (let ((gp-0 (current-time))) (ja-no-eval :group! jellyfish-die-ja :num! (seek! (the float (+ (-> (the-as art-joint-anim jellyfish-die-ja) frames num-frames) -1))) :frame-num 0.0 @@ -814,7 +814,7 @@ (f0-4 (ja-aframe-num 0)) ) (when (and (= s5-0 jellyfish-die-ja) (>= f0-4 0.0) (>= 0.5 f0-4)) - (when (>= (- (-> self clock frame-counter) gp-0) (seconds 0.05)) + (when (>= (- (current-time) gp-0) (seconds 0.05)) (process-drawable-shock-skel-effect self (-> *lightning-spec-id-table* 5) @@ -824,7 +824,7 @@ -1 -1 ) - (set! gp-0 (-> self clock frame-counter)) + (set! gp-0 (current-time)) ) ) ) @@ -1262,168 +1262,166 @@ (defmethod init-enemy! jellyfish ((obj jellyfish)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (with-pp - (hover-enemy-method-149 obj) - (init-enemy-behaviour-and-stats! obj (hover-enemy-method-150 obj)) - (hover-enemy-method-155 obj) - (set-vector! (-> obj offset) 0.0 6144.0 61440.0 1.0) - (set! (-> obj knocked-fall-dist) 0.0) - (let ((v1-8 (-> obj neck))) - (set! (-> v1-8 up) (the-as uint 1)) - (set! (-> v1-8 nose) (the-as uint 2)) - (set! (-> v1-8 ear) (the-as uint 0)) - (set! (-> v1-8 twist-speed-x) 0.05) - (set! (-> v1-8 twist-speed-y) 0.06) - (set! (-> v1-8 max-dist) 122880.0) - ) - (set! (-> obj root-override2 dynam gravity y) 40960.0) - (set! (-> obj root-override2 dynam gravity-length) 40960.0) - (set! (-> obj root-override2 dynam gravity-max) 40960.0) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj enemy-flags) (enemy-flag notice)) - (new-source! (-> obj los) obj (seconds 1) (collide-spec backgnd enemy obstacle hit-by-others-list)) - (set! (-> obj last-fire-time) (-> pp clock frame-counter)) - (set! (-> obj last-attack-time) 0) - (set! (-> obj sound-id) (the-as uint (new-sound-id))) - (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) - (set! (-> obj path-player-u) 0.0) - (set! (-> obj path-my-u) 0.0) - (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) - (set! (-> obj path-y-offset) (res-lump-float (-> obj entity) 'y-offset)) - (let ((a1-4 (new 'stack-no-clear 'sync-info-params))) - (let ((v1-32 0)) - (if #t - (set! v1-32 (logior v1-32 1)) - ) - (set! (-> a1-4 sync-type) 'sync-eased) - (set! (-> a1-4 sync-flags) (the-as sync-flags v1-32)) - ) - (set! (-> a1-4 period) (the-as uint 6000)) - (set! (-> a1-4 entity) (-> obj entity)) - (set! (-> a1-4 percent) 0.0) - (set! (-> a1-4 ease-in) 0.15) - (set! (-> a1-4 ease-out) 0.15) - (set! (-> a1-4 pause-in) 0.0) - (set! (-> a1-4 pause-out) 0.0) - (initialize! (-> obj sync) a1-4) - ) - (add-connection - *part-engine* - obj - 36 - obj - 318 - (new 'static 'vector :x 1187.84 :y -3112.96 :z 1392.64 :w 163840.0) - ) - (add-connection - *part-engine* - obj - 36 - obj - 318 - (new 'static 'vector :x -1187.84 :y -3112.96 :z 1392.64 :w 163840.0) - ) - (add-connection *part-engine* obj 36 obj 743 (new 'static 'vector :y 1433.6 :z 1228.8 :w 163840.0)) - (dotimes (s5-1 5) - (set! (-> obj tentacles s5-1) (new 'process 'jellyfish-chain-physics)) - ) - (chain-physics-initialize obj (-> obj tentacles 0) 10 4096.0 *jellyfish-mainvein-chain-setup*) - (chain-physics-initialize obj (-> obj tentacles 1) 16 4096.0 *jellyfish-lfront-chain-setup*) - (chain-physics-initialize obj (-> obj tentacles 2) 21 4096.0 *jellyfish-rfront-chain-setup*) - (chain-physics-initialize obj (-> obj tentacles 3) 26 4096.0 *jellyfish-lrear-chain-setup*) - (chain-physics-initialize obj (-> obj tentacles 4) 31 4096.0 *jellyfish-rrear-chain-setup*) - (set! (-> obj tentacles 2 negate-y) #t) - (set! (-> obj tentacles 4 negate-y) #t) - (let ((a0-35 (-> obj skel root-channel 0))) - (set! (-> a0-35 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) - (set! (-> a0-35 frame-num) 0.0) - (joint-control-channel-group! a0-35 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-identity) - ) - (ja-post) - (dotimes (s5-2 5) - (initialize-chain-joints (-> obj tentacles s5-2)) - ) - (let ((a1-15 (-> obj node-list data 16)) - (v1-68 - (new 'static 'jellyfish-joint-mod-tentacle-info - :axis (new 'static 'vector :z 1.0 :w 1.0) - :angle 3094.7556 - :offset 30.0 - ) - ) - ) - (set! (-> a1-15 param0) jellyfish-joint-mod-tentacle) - (set! (-> a1-15 param1) obj) - (set! (-> a1-15 param2) (the-as basic v1-68)) - ) - (let ((a1-16 (-> obj node-list data 21)) - (v1-70 - (new 'static 'jellyfish-joint-mod-tentacle-info - :axis (new 'static 'vector :z 1.0 :w 1.0) - :angle 3094.7556 - :offset 30.0 - ) - ) - ) - (set! (-> a1-16 param0) jellyfish-joint-mod-tentacle) - (set! (-> a1-16 param1) obj) - (set! (-> a1-16 param2) (the-as basic v1-70)) - ) - (let ((a1-17 (-> obj node-list data 26)) - (v1-72 - (new 'static 'jellyfish-joint-mod-tentacle-info - :axis (new 'static 'vector :z 1.0 :w 1.0) - :angle 4369.067 - :offset 45.0 - ) - ) - ) - (set! (-> a1-17 param0) jellyfish-joint-mod-tentacle) - (set! (-> a1-17 param1) obj) - (set! (-> a1-17 param2) (the-as basic v1-72)) - ) - (let ((a1-18 (-> obj node-list data 31)) - (v1-74 - (new 'static 'jellyfish-joint-mod-tentacle-info - :axis (new 'static 'vector :z 1.0 :w 1.0) - :angle 4369.067 - :offset 45.0 - ) - ) - ) - (set! (-> a1-18 param0) jellyfish-joint-mod-tentacle) - (set! (-> a1-18 param1) obj) - (set! (-> a1-18 param2) (the-as basic v1-74)) - ) - (let ((a1-19 (-> obj node-list data 10)) - (v1-76 - (new 'static 'jellyfish-joint-mod-tentacle-info :axis (new 'static 'vector :x 1.0 :w 1.0) :angle 2730.6667) - ) - ) - (set! (-> a1-19 param0) jellyfish-joint-mod-tentacle) - (set! (-> a1-19 param1) obj) - (set! (-> a1-19 param2) (the-as basic v1-76)) - ) - (set! (-> obj tentacles-initialized) #f) - (set! (-> obj tentacle-clock) 0.0) - (set! (-> obj tentacle-blend) 1.0) - (add-connection - *part-engine* - obj - 36 - obj - 318 - (new 'static 'vector :x 1966.08 :y -1843.2 :z 2129.92 :w 163840.0) - ) - (add-connection - *part-engine* - obj - 36 - obj - 318 - (new 'static 'vector :x -1966.08 :y -1843.2 :z 2129.92 :w 163840.0) - ) - 0 - (none) + (hover-enemy-method-149 obj) + (init-enemy-behaviour-and-stats! obj (hover-enemy-method-150 obj)) + (hover-enemy-method-155 obj) + (set-vector! (-> obj offset) 0.0 6144.0 61440.0 1.0) + (set! (-> obj knocked-fall-dist) 0.0) + (let ((v1-8 (-> obj neck))) + (set! (-> v1-8 up) (the-as uint 1)) + (set! (-> v1-8 nose) (the-as uint 2)) + (set! (-> v1-8 ear) (the-as uint 0)) + (set! (-> v1-8 twist-speed-x) 0.05) + (set! (-> v1-8 twist-speed-y) 0.06) + (set! (-> v1-8 max-dist) 122880.0) ) + (set! (-> obj root-override2 dynam gravity y) 40960.0) + (set! (-> obj root-override2 dynam gravity-length) 40960.0) + (set! (-> obj root-override2 dynam gravity-max) 40960.0) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj enemy-flags) (enemy-flag notice)) + (new-source! (-> obj los) obj (seconds 1) (collide-spec backgnd enemy obstacle hit-by-others-list)) + (set! (-> obj last-fire-time) (current-time)) + (set! (-> obj last-attack-time) 0) + (set! (-> obj sound-id) (the-as uint (new-sound-id))) + (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) + (set! (-> obj path-player-u) 0.0) + (set! (-> obj path-my-u) 0.0) + (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) + (set! (-> obj path-y-offset) (res-lump-float (-> obj entity) 'y-offset)) + (let ((a1-4 (new 'stack-no-clear 'sync-info-params))) + (let ((v1-32 0)) + (if #t + (set! v1-32 (logior v1-32 1)) + ) + (set! (-> a1-4 sync-type) 'sync-eased) + (set! (-> a1-4 sync-flags) (the-as sync-flags v1-32)) + ) + (set! (-> a1-4 period) (the-as uint 6000)) + (set! (-> a1-4 entity) (-> obj entity)) + (set! (-> a1-4 percent) 0.0) + (set! (-> a1-4 ease-in) 0.15) + (set! (-> a1-4 ease-out) 0.15) + (set! (-> a1-4 pause-in) 0.0) + (set! (-> a1-4 pause-out) 0.0) + (initialize! (-> obj sync) a1-4) + ) + (add-connection + *part-engine* + obj + 36 + obj + 318 + (new 'static 'vector :x 1187.84 :y -3112.96 :z 1392.64 :w 163840.0) + ) + (add-connection + *part-engine* + obj + 36 + obj + 318 + (new 'static 'vector :x -1187.84 :y -3112.96 :z 1392.64 :w 163840.0) + ) + (add-connection *part-engine* obj 36 obj 743 (new 'static 'vector :y 1433.6 :z 1228.8 :w 163840.0)) + (dotimes (s5-1 5) + (set! (-> obj tentacles s5-1) (new 'process 'jellyfish-chain-physics)) + ) + (chain-physics-initialize obj (-> obj tentacles 0) 10 4096.0 *jellyfish-mainvein-chain-setup*) + (chain-physics-initialize obj (-> obj tentacles 1) 16 4096.0 *jellyfish-lfront-chain-setup*) + (chain-physics-initialize obj (-> obj tentacles 2) 21 4096.0 *jellyfish-rfront-chain-setup*) + (chain-physics-initialize obj (-> obj tentacles 3) 26 4096.0 *jellyfish-lrear-chain-setup*) + (chain-physics-initialize obj (-> obj tentacles 4) 31 4096.0 *jellyfish-rrear-chain-setup*) + (set! (-> obj tentacles 2 negate-y) #t) + (set! (-> obj tentacles 4 negate-y) #t) + (let ((a0-35 (-> obj skel root-channel 0))) + (set! (-> a0-35 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-35 frame-num) 0.0) + (joint-control-channel-group! a0-35 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-identity) + ) + (ja-post) + (dotimes (s5-2 5) + (initialize-chain-joints (-> obj tentacles s5-2)) + ) + (let ((a1-15 (-> obj node-list data 16)) + (v1-68 + (new 'static 'jellyfish-joint-mod-tentacle-info + :axis (new 'static 'vector :z 1.0 :w 1.0) + :angle 3094.7556 + :offset 30.0 + ) + ) + ) + (set! (-> a1-15 param0) jellyfish-joint-mod-tentacle) + (set! (-> a1-15 param1) obj) + (set! (-> a1-15 param2) (the-as basic v1-68)) + ) + (let ((a1-16 (-> obj node-list data 21)) + (v1-70 + (new 'static 'jellyfish-joint-mod-tentacle-info + :axis (new 'static 'vector :z 1.0 :w 1.0) + :angle 3094.7556 + :offset 30.0 + ) + ) + ) + (set! (-> a1-16 param0) jellyfish-joint-mod-tentacle) + (set! (-> a1-16 param1) obj) + (set! (-> a1-16 param2) (the-as basic v1-70)) + ) + (let ((a1-17 (-> obj node-list data 26)) + (v1-72 + (new 'static 'jellyfish-joint-mod-tentacle-info + :axis (new 'static 'vector :z 1.0 :w 1.0) + :angle 4369.067 + :offset 45.0 + ) + ) + ) + (set! (-> a1-17 param0) jellyfish-joint-mod-tentacle) + (set! (-> a1-17 param1) obj) + (set! (-> a1-17 param2) (the-as basic v1-72)) + ) + (let ((a1-18 (-> obj node-list data 31)) + (v1-74 + (new 'static 'jellyfish-joint-mod-tentacle-info + :axis (new 'static 'vector :z 1.0 :w 1.0) + :angle 4369.067 + :offset 45.0 + ) + ) + ) + (set! (-> a1-18 param0) jellyfish-joint-mod-tentacle) + (set! (-> a1-18 param1) obj) + (set! (-> a1-18 param2) (the-as basic v1-74)) + ) + (let ((a1-19 (-> obj node-list data 10)) + (v1-76 + (new 'static 'jellyfish-joint-mod-tentacle-info :axis (new 'static 'vector :x 1.0 :w 1.0) :angle 2730.6667) + ) + ) + (set! (-> a1-19 param0) jellyfish-joint-mod-tentacle) + (set! (-> a1-19 param1) obj) + (set! (-> a1-19 param2) (the-as basic v1-76)) + ) + (set! (-> obj tentacles-initialized) #f) + (set! (-> obj tentacle-clock) 0.0) + (set! (-> obj tentacle-blend) 1.0) + (add-connection + *part-engine* + obj + 36 + obj + 318 + (new 'static 'vector :x 1966.08 :y -1843.2 :z 2129.92 :w 163840.0) + ) + (add-connection + *part-engine* + obj + 36 + obj + 318 + (new 'static 'vector :x -1966.08 :y -1843.2 :z 2129.92 :w 163840.0) + ) + 0 + (none) ) diff --git a/goal_src/jak2/levels/underport/pipe-grunt.gc b/goal_src/jak2/levels/underport/pipe-grunt.gc index ccf0520815..2ef4fde583 100644 --- a/goal_src/jak2/levels/underport/pipe-grunt.gc +++ b/goal_src/jak2/levels/underport/pipe-grunt.gc @@ -50,7 +50,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior pipe-grunt) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self enemy-flags) (enemy-flag chase-startup)) (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice alert victory)) (let ((v1-7 (-> self root-override2 root-prim))) diff --git a/goal_src/jak2/levels/underport/sig5-course.gc b/goal_src/jak2/levels/underport/sig5-course.gc index 2869f4611c..8b9da7cc54 100644 --- a/goal_src/jak2/levels/underport/sig5-course.gc +++ b/goal_src/jak2/levels/underport/sig5-course.gc @@ -41,29 +41,27 @@ ;; WARN: Return type mismatch time-frame vs none. (defmethod sig-under-method-263 sig-under ((obj sig-under)) - (with-pp - (let ((s5-0 (-> pp clock frame-counter))) - (when (and (>= s5-0 (-> obj next-chase-play-time)) - (not (channel-active? obj (the-as uint 0))) - (>= (the-as int (sig-method-256 obj)) 750) - ) - (let ((a1-2 (bot-speech-list-method-9 - (-> obj sig5-course chase-speeches) - obj - (-> obj sig5-course speeches) - (speech-flags) - ) + (let ((s5-0 (current-time))) + (when (and (>= s5-0 (-> obj next-chase-play-time)) + (not (channel-active? obj (the-as uint 0))) + (>= (the-as int (sig-method-256 obj)) 750) + ) + (let ((a1-2 (bot-speech-list-method-9 + (-> obj sig5-course chase-speeches) + obj + (-> obj sig5-course speeches) + (speech-flags) ) - ) - (when (>= a1-2 0) - (play-speech obj a1-2) - (set! (-> obj next-chase-play-time) (+ s5-0 (get-rand-int-range obj 1500 2700))) + ) ) + (when (>= a1-2 0) + (play-speech obj a1-2) + (set! (-> obj next-chase-play-time) (+ s5-0 (get-rand-int-range obj 1500 2700))) ) ) ) - (none) ) + (none) ) ;; WARN: Return type mismatch object vs symbol. @@ -433,16 +431,16 @@ (ja-eval) ) (when #t - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self bot-flags) (bot-flags bf18)) - (let ((gp-3 (+ (-> self clock frame-counter) (get-rand-int-range self 30 600)))) + (let ((gp-3 (+ (current-time) (get-rand-int-range self 30 600)))) (ja-channel-push! 1 (seconds 0.5)) (ja-no-eval :group! (-> self draw art-group data 7) :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 7)) frames num-frames) -1))) :frame-num 0.0 ) (until (ja-done? 0) - (if (>= (-> self clock frame-counter) gp-3) + (if (>= (current-time) gp-3) (goto cfg-27) ) (suspend) @@ -550,27 +548,25 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (if (not (and (logtest? (-> arg1 bot-task-bits) 1) - *target* - (not (logtest? (-> *target* focus-status) (focus-status dead in-air edge-grab))) - ) - ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - (when (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.1)) - (task-node-open? (game-task-node under-sig-introduction)) - (scene-play arg1 "under-find-sig-res" #f) - ) - (process-entity-status! arg1 (entity-perm-status no-kill) #t) - (countdown (s5-0 2) - (send-event (handle->process (-> arg1 growls s5-0)) 'die-fast) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 2 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t + (if (not (and (logtest? (-> arg1 bot-task-bits) 1) + *target* + (not (logtest? (-> *target* focus-status) (focus-status dead in-air edge-grab))) + ) + ) + (set! (-> arg1 waypoint-time0) (current-time)) ) + (when (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.1)) + (task-node-open? (game-task-node under-sig-introduction)) + (scene-play arg1 "under-find-sig-res" #f) + ) + (process-entity-status! arg1 (entity-perm-status no-kill) #t) + (countdown (s5-0 2) + (send-event (handle->process (-> arg1 growls s5-0)) 'die-fast) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 2 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) @@ -863,48 +859,46 @@ :nav-mesh-index 2 :skip-to -1 :on-set (lambda ((arg0 sig-under)) - (with-pp - (set! (-> arg0 next-chase-play-time) (+ (-> pp clock frame-counter) (get-rand-int-range arg0 900 1500))) - (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-centipede-two" -99.0 0) - (let* ((v1-7 (-> arg0 sig5-course spots)) - (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)) - ) - (set! (-> arg0 test-plane y) 0.0) - (vector-normalize! (-> arg0 test-plane) 1.0) - (set! (-> arg0 test-plane w) - (- (+ (* (-> s5-1 center x) (-> arg0 test-plane x)) (* (-> s5-1 center z) (-> arg0 test-plane z)))) - ) + (set! (-> arg0 next-chase-play-time) (+ (current-time) (get-rand-int-range arg0 900 1500))) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-centipede-two" -99.0 0) + (let* ((v1-7 (-> arg0 sig5-course spots)) + (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)) ) - (let ((v1-11 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) - (set! (-> v1-11 bytes 5) 1) - (set! (-> v1-11 bytes 6) 10) - (set! (-> v1-11 bytes 4) -1) - (set! (-> (the-as sigt-wait-spot v1-11) check-done) - (the-as - (function sigt-wait-spot sig symbol) - (lambda ((arg0 object) (arg1 sig-under)) - (sig-under-method-263 arg1) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (set! (-> s5-0 quad) (-> (target-pos 0) quad)) - (set! (-> s5-0 y) 0.0) - (when (and (>= (vector4-dot (the-as vector (-> arg1 test-plane)) s5-0) 0.0) - (scene-play arg1 "under-centipede-two" #f) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 11 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + (set! (-> arg0 test-plane y) 0.0) + (vector-normalize! (-> arg0 test-plane) 1.0) + (set! (-> arg0 test-plane w) + (- (+ (* (-> s5-1 center x) (-> arg0 test-plane x)) (* (-> s5-1 center z) (-> arg0 test-plane z)))) + ) + ) + (let ((v1-11 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-11 bytes 5) 1) + (set! (-> v1-11 bytes 6) 10) + (set! (-> v1-11 bytes 4) -1) + (set! (-> (the-as sigt-wait-spot v1-11) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (sig-under-method-263 arg1) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> (target-pos 0) quad)) + (set! (-> s5-0 y) 0.0) + (when (and (>= (vector4-dot (the-as vector (-> arg1 test-plane)) s5-0) 0.0) + (scene-play arg1 "under-centipede-two" #f) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 11 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) ) - ) - (none) + ) ) + (none) ) :on-update #f :on-skipping-here #f @@ -957,16 +951,13 @@ (set! (-> (the-as sigt-wait-spot v1-15) check-done) (the-as (function sigt-wait-spot sig symbol) - (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.8)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 13 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - ) - ) + (lambda ((arg0 object) (arg1 sig-under)) (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.8)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 13 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) ) ) ) @@ -1095,16 +1086,14 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (if (sig-under-method-261 arg1 (-> arg1 test-plane) (target-pos 0) #t) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 16 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t + (if (sig-under-method-261 arg1 (-> arg1 test-plane) (target-pos 0) #t) + (set! (-> arg1 waypoint-time0) (current-time)) ) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 16 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) @@ -1219,7 +1208,7 @@ ) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.7)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.7)) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) (go-to-waypoint! arg1 20 #f) (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) @@ -1252,13 +1241,11 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) (+ (-> pp clock frame-counter) (seconds -6))) - (logior! (-> arg1 waypoint-bits) 1) - (set-setting! 'music 'danger3 0.0 0) - ) - #f + (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) (+ (current-time) (seconds -6))) + (logior! (-> arg1 waypoint-bits) 1) + (set-setting! 'music 'danger3 0.0 0) ) + #f ) ) ) @@ -1350,38 +1337,36 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (if (and (not (speech-playing? arg1 12)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.5)) - (not (channel-active? arg1 (the-as uint 0))) - ) - (play-speech arg1 12) - ) - (cond - ((not (logtest? (-> arg1 waypoint-bits) 1)) - (logior! (-> arg1 waypoint-bits) 1) - (process-release? arg1) - (sig-under-method-260 arg1) - (move-to-point! (-> arg1 root-override2) (the-as vector (-> arg1 sig5-course spots 20))) - #f + (if (and (not (speech-playing? arg1 12)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.5)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 12) + ) + (cond + ((not (logtest? (-> arg1 waypoint-bits) 1)) + (logior! (-> arg1 waypoint-bits) 1) + (process-release? arg1) + (sig-under-method-260 arg1) + (move-to-point! (-> arg1 root-override2) (the-as vector (-> arg1 sig5-course spots 20))) + #f + ) + ((not (logtest? (-> arg1 waypoint-bits) 2)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) + (remove-setting! 'entity-name) + (logior! (-> arg1 waypoint-bits) 2) + (add-process *gui-control* arg1 (gui-channel art-load) (gui-action queue) "under-centipede-three" -99.0 0) ) - ((not (logtest? (-> arg1 waypoint-bits) 2)) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) - (remove-setting! 'entity-name) - (logior! (-> arg1 waypoint-bits) 2) - (add-process *gui-control* arg1 (gui-channel art-load) (gui-action queue) "under-centipede-three" -99.0 0) - ) - #f - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2.5)) - (process-release? *target*) - (reset-warn-time! arg1) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 22 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + #f + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2.5)) + (process-release? *target*) + (reset-warn-time! arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 22 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) @@ -1444,7 +1429,7 @@ ) (let ((s5-0 (new 'stack-no-clear 'vector))) (set! v1-14 - (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.25)) + (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.25)) (begin (set! (-> s5-0 quad) (-> (target-pos 0) quad)) (set! (-> s5-0 y) 0.0) @@ -1555,63 +1540,59 @@ :nav-mesh-index #x7 :skip-to -1 :on-set (lambda ((arg0 sig-under)) - (with-pp - (set! (-> arg0 next-chase-play-time) (+ (-> pp clock frame-counter) (get-rand-int-range arg0 600 1200))) - (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-get-sig-out-res" -99.0 0) - (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) - (set! (-> v1-7 bytes 5) 1) - (set! (-> v1-7 bytes 6) 26) - (set! (-> v1-7 bytes 4) -1) - (set! (-> (the-as sigt-wait-spot v1-7) check-done) - (the-as - (function sigt-wait-spot sig symbol) - (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (when (sig-under-method-264 arg1) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 27 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) - (sig-under-method-263 arg1) - (when (and (>= (- (-> pp clock frame-counter) (-> 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-override2 trans))) + (set! (-> arg0 next-chase-play-time) (+ (current-time) (get-rand-int-range arg0 600 1200))) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-get-sig-out-res" -99.0 0) + (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-7 bytes 5) 1) + (set! (-> v1-7 bytes 6) 26) + (set! (-> v1-7 bytes 4) -1) + (set! (-> (the-as sigt-wait-spot v1-7) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (when (sig-under-method-264 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 27 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (sig-under-method-263 arg1) + (when (and (>= (- (current-time) (-> 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-override2 trans))) + ) + ) + (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) + (when (send-event arg1 'jump 5 (-> arg1 sig5-course spots 28)) + (let ((s5-1 (-> arg1 actor-group 0 data 6 actor))) + (when (and (not (channel-active? arg1 (the-as uint 0))) + (or (not s5-1) (not (logtest? (-> s5-1 extra perm status) (entity-perm-status subtask-complete)))) ) - ) - (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) - (when (send-event arg1 'jump 5 (-> arg1 sig5-course spots 28)) - (let ((s5-1 (-> arg1 actor-group 0 data 6 actor))) - (when (and (not (channel-active? arg1 (the-as uint 0))) - (or (not s5-1) (not (logtest? (-> s5-1 extra perm status) (entity-perm-status subtask-complete)))) - ) - (let ((s5-2 18)) - (case (get-rand-int arg1 3) - ((1) - (set! s5-2 19) - ) - ((2) - (set! s5-2 20) - ) - ) - (play-speech arg1 s5-2) - ) + (let ((s5-2 18)) + (case (get-rand-int arg1 3) + ((1) + (set! s5-2 19) + ) + ((2) + (set! s5-2 20) + ) ) + (play-speech arg1 s5-2) ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 25 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t ) ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 25 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) ) - ) - (none) + ) ) + (none) ) :on-update #f :on-skipping-here #f @@ -1634,85 +1615,81 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (when (sig-under-method-264 arg1) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 27 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) + (when (sig-under-method-264 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 27 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (if (not (logtest? (-> arg1 bot-task-bits) 16)) + (set! (-> arg1 waypoint-time0) (current-time)) ) - (if (not (logtest? (-> arg1 bot-task-bits) 16)) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.5)) - (not (logtest? (-> arg1 focus-status) (focus-status in-air))) - ) - (logior! (-> arg1 waypoint-bits) 2) - (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) - ) - (if (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) - (not (speech-playing? arg1 21)) - (not (channel-active? arg1 (the-as uint 0))) + (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.5)) + (not (logtest? (-> arg1 focus-status) (focus-status in-air))) ) - (play-speech arg1 21) - ) - (when (zero? (-> arg1 next-chase-play-time)) - (let ((a0-14 (-> arg1 actor-group 0 data 7 actor))) - (if (and a0-14 (logtest? (-> a0-14 extra perm status) (entity-perm-status subtask-complete))) - (set! (-> arg1 next-chase-play-time) (-> pp clock frame-counter)) - ) - ) + (logior! (-> arg1 waypoint-bits) 2) + (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + ) + (if (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1)) + (not (speech-playing? arg1 21)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 21) ) - (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (and (-> arg1 next-state) (let ((v1-54 (-> arg1 next-state name))) - (or (= v1-54 'waiting-far) (= v1-54 'waiting-close) (= v1-54 'waiting-turn)) - ) - ) - (or (nonzero? (-> arg1 next-chase-play-time)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 6)) - ) - ) - (when (not (logtest? (-> arg1 waypoint-bits) 1)) - (logior! (-> arg1 waypoint-bits) 1) - (send-event (ppointer->process (-> arg1 my-simple-focus)) 'move-trans (-> arg1 sig5-course spots 32)) - (set! (-> arg1 poi-handle) (ppointer->handle (-> arg1 my-simple-focus))) - ) - (let ((v1-78 (-> arg1 sig5-course spots 32))) - (when (>= 10012.445 - (fabs - (deg- - (atan - (- (-> v1-78 center x) (-> arg1 root-override2 trans x)) - (- (-> v1-78 center z) (-> arg1 root-override2 trans z)) - ) - (quaternion-y-angle (-> arg1 root-override2 quat)) + (when (zero? (-> arg1 next-chase-play-time)) + (let ((a0-14 (-> arg1 actor-group 0 data 7 actor))) + (if (and a0-14 (logtest? (-> a0-14 extra perm status) (entity-perm-status subtask-complete))) + (set! (-> arg1 next-chase-play-time) (current-time)) + ) + ) + ) + (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (and (-> arg1 next-state) (let ((v1-54 (-> arg1 next-state name))) + (or (= v1-54 'waiting-far) (= v1-54 'waiting-close) (= v1-54 'waiting-turn)) + ) + ) + (or (nonzero? (-> arg1 next-chase-play-time)) (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 6))) + ) + (when (not (logtest? (-> arg1 waypoint-bits) 1)) + (logior! (-> arg1 waypoint-bits) 1) + (send-event (ppointer->process (-> arg1 my-simple-focus)) 'move-trans (-> arg1 sig5-course spots 32)) + (set! (-> arg1 poi-handle) (ppointer->handle (-> arg1 my-simple-focus))) + ) + (let ((v1-78 (-> arg1 sig5-course spots 32))) + (when (>= 10012.445 + (fabs + (deg- + (atan + (- (-> v1-78 center x) (-> arg1 root-override2 trans x)) + (- (-> v1-78 center z) (-> arg1 root-override2 trans z)) ) + (quaternion-y-angle (-> arg1 root-override2 quat)) ) ) - (let ((s4-1 (target-pos 0)) - (s5-1 (-> arg1 sig5-course spots 32)) ) - (when (or (zero? (-> arg1 next-chase-play-time)) - (and (nonzero? (-> arg1 next-chase-play-time)) - (>= (- (-> pp clock frame-counter) (-> arg1 next-chase-play-time)) (seconds 2)) - (or (>= (- (-> pp clock frame-counter) (-> arg1 next-chase-play-time)) (seconds 9)) - (>= (vector-vector-xz-distance s4-1 (-> s5-1 center)) (+ 8192.0 (-> s5-1 center w))) - (< 20480.0 (- (-> s4-1 y) (-> s5-1 center y))) - ) - ) - ) - (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) - (when (send-event arg1 'jump 5 (-> s5-1 center)) - (logclear! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) - (if (not (channel-active? arg1 (the-as uint 0))) - (play-speech arg1 22) + (let ((s4-1 (target-pos 0)) + (s5-1 (-> arg1 sig5-course spots 32)) + ) + (when (or (zero? (-> arg1 next-chase-play-time)) + (and (nonzero? (-> arg1 next-chase-play-time)) + (>= (- (current-time) (-> arg1 next-chase-play-time)) (seconds 2)) + (or (>= (- (current-time) (-> arg1 next-chase-play-time)) (seconds 9)) + (>= (vector-vector-xz-distance s4-1 (-> s5-1 center)) (+ 8192.0 (-> s5-1 center w))) + (< 20480.0 (- (-> s4-1 y) (-> s5-1 center y))) + ) + ) ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 26 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) + (when (send-event arg1 'jump 5 (-> s5-1 center)) + (logclear! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + (if (not (channel-active? arg1 (the-as uint 0))) + (play-speech arg1 22) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 26 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) @@ -1745,30 +1722,28 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.5)) - (not (logtest? (-> arg1 focus-status) (focus-status in-air))) + (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.5)) + (not (logtest? (-> arg1 focus-status) (focus-status in-air))) + ) + (logior! (-> arg1 waypoint-bits) 1) + (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + ) + (cond + ((sig-under-method-264 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 27 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + (else + (if (and (not (speech-playing? arg1 23)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3.5)) + (not (channel-active? arg1 (the-as uint 0))) ) - (logior! (-> arg1 waypoint-bits) 1) - (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) - ) - (cond - ((sig-under-method-264 arg1) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 27 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - (else - (if (and (not (speech-playing? arg1 23)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3.5)) - (not (channel-active? arg1 (the-as uint 0))) - ) - (play-speech arg1 23) - ) - #f - ) + (play-speech arg1 23) + ) + #f ) ) ) diff --git a/goal_src/jak2/levels/underport/under-laser.gc b/goal_src/jak2/levels/underport/under-laser.gc index d18080f316..a5f9292cc0 100644 --- a/goal_src/jak2/levels/underport/under-laser.gc +++ b/goal_src/jak2/levels/underport/under-laser.gc @@ -359,7 +359,7 @@ s5-0 (-> self zero-pos) (-> self one-pos) - (get-norm! (-> self sync) (the-as int (+ (-> self clock frame-counter) (seconds 0.15)))) + (get-norm! (-> self sync) (the-as int (+ (current-time) (seconds 0.15)))) ) (vector-normalize-copy! s4-0 (-> self laser-dir) 1228.8) (vector+! s4-0 s4-0 s5-0) diff --git a/goal_src/jak2/levels/underport/under-obs.gc b/goal_src/jak2/levels/underport/under-obs.gc index 2526d13050..f89bba4728 100644 --- a/goal_src/jak2/levels/underport/under-obs.gc +++ b/goal_src/jak2/levels/underport/under-obs.gc @@ -346,10 +346,10 @@ (>= (* f0-18 f0-18) (vector-vector-xz-distance-squared a0-5 (-> self root trans))) ) ) - (if (>= (- (-> self clock frame-counter) (-> self last-recharge-time)) (seconds 1)) + (if (>= (- (current-time) (-> self last-recharge-time)) (seconds 1)) (sound-play "oxygen-recharge") ) - (set! (-> self last-recharge-time) (-> self clock frame-counter)) + (set! (-> self last-recharge-time) (current-time)) (send-event (ppointer->process *underb-master*) 'bubbler) ) ) @@ -418,7 +418,7 @@ This commonly includes things such as: (case arg2 (('ridden) (set! (-> self ridden) #t) - (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (let ((v0-0 (the-as object (current-time)))) (set! (-> self last-ridden) (the-as time-frame v0-0)) v0-0 ) @@ -580,7 +580,7 @@ This commonly includes things such as: :trans (behavior () (rider-trans) (when (-> self rider-started) - (when (and (not (-> self ridden)) (>= (- (-> self clock frame-counter) (-> self last-ridden)) (seconds 2))) + (when (and (not (-> self ridden)) (>= (- (current-time) (-> self last-ridden)) (seconds 2))) (if (= (-> self extra-id) 1) (send-event (ppointer->process *underb-master*) 'request 'big-room 'under-plat 'player #f) ) @@ -1249,7 +1249,7 @@ This commonly includes things such as: (defstate explode (under-mine) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-3 (-> self root-override root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) diff --git a/goal_src/jak2/levels/underport/under-shoot-block.gc b/goal_src/jak2/levels/underport/under-shoot-block.gc index 08af9392d1..00dd646cb1 100644 --- a/goal_src/jak2/levels/underport/under-shoot-block.gc +++ b/goal_src/jak2/levels/underport/under-shoot-block.gc @@ -858,78 +858,74 @@ ) (defmethod under-block-method-42 under-block ((obj under-block)) - (with-pp - (set! (-> obj activated-time) (-> pp clock frame-counter)) - (logior! (-> obj flags) 2) - (set! (-> obj pulse-pc) 0) - (set! (-> obj pulse-op) 0) - 0 - (none) - ) + (set! (-> obj activated-time) (current-time)) + (logior! (-> obj flags) 2) + (set! (-> obj pulse-pc) 0) + (set! (-> obj pulse-op) 0) + 0 + (none) ) ;; WARN: Return type mismatch object vs none. ;; WARN: Function (method 45 under-block) has a return type of none, but the expression builder found a return statement. (defmethod under-block-method-45 under-block ((obj under-block)) - (with-pp - (let ((v1-0 (-> obj puzzle))) - (when (logtest? (-> obj flags) 2) - (cond - ((!= (-> v1-0 slot-mask) (-> v1-0 slot-mask-full)) - (when (zero? (-> obj pulse-op)) - (if (< (- (-> pp clock frame-counter) (-> obj activated-time)) - (the-as time-frame (-> (the-as (pointer uint32) (&+ (-> obj puzzle pulse-ops) (* (-> obj pulse-pc) 4))))) - ) - (return #f) - ) - (set! (-> obj pulse-op) - (the-as int (-> (the-as (pointer uint32) (&+ (-> obj puzzle pulse-ops) (* (+ (-> obj pulse-pc) 1) 4))))) - ) - (+! (-> obj pulse-pc) 2) - (case (-> obj pulse-op) - ((1) - (set! (-> obj pulse-ctr) 3) - (sound-play "und-block-flash") - ) - ((2) - (go (method-of-object obj explode)) - ) + (let ((v1-0 (-> obj puzzle))) + (when (logtest? (-> obj flags) 2) + (cond + ((!= (-> v1-0 slot-mask) (-> v1-0 slot-mask-full)) + (when (zero? (-> obj pulse-op)) + (if (< (- (current-time) (-> obj activated-time)) + (the-as time-frame (-> (the-as (pointer uint32) (&+ (-> obj puzzle pulse-ops) (* (-> obj pulse-pc) 4))))) + ) + (return #f) ) - ) + (set! (-> obj pulse-op) + (the-as int (-> (the-as (pointer uint32) (&+ (-> obj puzzle pulse-ops) (* (+ (-> obj pulse-pc) 1) 4))))) + ) + (+! (-> obj pulse-pc) 2) (case (-> obj pulse-op) ((1) - (let ((v1-24 (-> obj pulse-ctr))) - (cond - ((= v1-24 3) - (set-vector! (-> obj draw color-mult) 1.1 0.25 0.25 1.0) - (+! (-> obj pulse-ctr) -1) - ) - ((or (= v1-24 2) (= v1-24 1)) - (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) - (set-vector! (-> obj draw color-emissive) 1.0 1.0 1.0 1.0) - (+! (-> obj pulse-ctr) -1) - ) - ((zero? v1-24) - (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) - (set-vector! (-> obj draw color-emissive) 0.0 0.0 0.0 1.0) - (set! (-> obj pulse-op) 0) - 0 - ) - ) - ) + (set! (-> obj pulse-ctr) 3) + (sound-play "und-block-flash") + ) + ((2) + (go (method-of-object obj explode)) ) ) ) - (else - (set! (-> obj flags) (logand -3 (-> obj flags))) - (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) - (set-vector! (-> obj draw color-emissive) 0.0 0.0 0.0 1.0) + (case (-> obj pulse-op) + ((1) + (let ((v1-24 (-> obj pulse-ctr))) + (cond + ((= v1-24 3) + (set-vector! (-> obj draw color-mult) 1.1 0.25 0.25 1.0) + (+! (-> obj pulse-ctr) -1) + ) + ((or (= v1-24 2) (= v1-24 1)) + (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) + (set-vector! (-> obj draw color-emissive) 1.0 1.0 1.0 1.0) + (+! (-> obj pulse-ctr) -1) + ) + ((zero? v1-24) + (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) + (set-vector! (-> obj draw color-emissive) 0.0 0.0 0.0 1.0) + (set! (-> obj pulse-op) 0) + 0 + ) + ) + ) ) + ) + ) + (else + (set! (-> obj flags) (logand -3 (-> obj flags))) + (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) + (set-vector! (-> obj draw color-emissive) 0.0 0.0 0.0 1.0) ) ) ) - (none) ) + (none) ) (defmethod under-block-method-41 under-block ((obj under-block) (arg0 symbol)) @@ -1248,7 +1244,7 @@ (suspend) ) (under-block-method-41 self 'active) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "und-block-rise") (let ((gp-1 (new 'stack-no-clear 'matrix))) (set! (-> gp-1 vector 0 quad) (-> self root-override trans quad)) @@ -1278,7 +1274,7 @@ :trans (the-as (function none :behavior under-block) rider-trans) :code (behavior () (set! (-> self flags) (logand -2 (-> self flags))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (new 'stack-no-clear 'matrix))) (set! (-> gp-0 vector 0 quad) (-> self root-override trans quad)) (set! (-> gp-0 vector 1 quad) (-> gp-0 vector 0 quad)) @@ -1384,9 +1380,9 @@ (the-as quaternion (-> gp-1 vector 2)) (the-as quaternion (-> gp-1 trans)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f - (let ((f30-0 (fmin 1.0 (* 0.022222223 (the float (- (-> self clock frame-counter) (-> self state-time))))))) + (let ((f30-0 (fmin 1.0 (* 0.022222223 (the float (- (current-time) (-> self state-time))))))) (let ((s5-1 (-> self root-override))) (set! (-> s5-1 transv quad) (-> s5-1 trans quad)) (vector-lerp! (-> s5-1 trans) (-> gp-1 vector 1) (the-as vector (-> gp-1 vector)) f30-0) @@ -1471,9 +1467,9 @@ (the-as quaternion (-> gp-1 vector 2)) (the-as quaternion (-> gp-1 trans)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f - (let ((f30-0 (fmin 1.0 (* 0.0074074073 (the float (- (-> self clock frame-counter) (-> self state-time))))))) + (let ((f30-0 (fmin 1.0 (* 0.0074074073 (the float (- (current-time) (-> self state-time))))))) (let ((s5-1 (-> self root-override))) (set! (-> s5-1 transv quad) (-> s5-1 trans quad)) (vector-lerp! (-> s5-1 trans) (-> gp-1 vector 1) (the-as vector (-> gp-1 vector)) f30-0) @@ -1494,9 +1490,9 @@ ) #f (label cfg-5) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f - (let* ((f1-9 (fmin 1.0 (* 0.0074074073 (the float (- (-> self clock frame-counter) (-> self state-time)))))) + (let* ((f1-9 (fmin 1.0 (* 0.0074074073 (the float (- (current-time) (-> self state-time)))))) (s5-2 (-> self root-override)) (f30-1 (fmax 0.0 (- 0.15 f1-9))) ) @@ -1534,7 +1530,7 @@ (none) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "und-block-lock") (let ((gp-1 (new 'stack-no-clear 'matrix))) (set! (-> gp-1 vector 0 quad) (-> self root-override trans quad)) @@ -1574,7 +1570,7 @@ (none) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "und-block-sink") (let ((gp-1 (new 'stack-no-clear 'matrix))) (set! (-> gp-1 vector 0 quad) (-> self root-override trans quad)) @@ -1622,13 +1618,13 @@ (none) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (new 'stack-no-clear 'quaternion)) (s5-0 (new 'stack-no-clear 'quaternion)) (f30-0 0.0) ) (quaternion-copy! gp-0 (-> self root-override quat)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.25)) + (while (< (- (current-time) (-> self state-time)) (seconds 1.25)) (+! f30-0 (* 65536.0 (-> self clock seconds-per-frame))) (quaternion-vector-angle! s5-0 (-> self rot-axis) (- f30-0)) (quaternion*! (-> self root-override quat) s5-0 gp-0) @@ -1650,7 +1646,7 @@ (fill-cache-integrate-and-collide gp-0 (-> gp-0 transv) a2-0 (meters 0)) ) (when (and (logtest? (-> (the-as collide-shape-moving gp-0) status) (collide-status touch-surface)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.01)) + (>= (- (current-time) (-> self state-time)) (seconds 0.01)) ) (logior! (-> self flags) 4) (go-virtual explode) @@ -2088,7 +2084,7 @@ (('explode) (let ((v1-4 (-> self puzzle spawners (-> arg3 param 0)))) (set! (-> v1-4 active-handle) (the-as handle #f)) - (set! v0-0 (-> self clock frame-counter)) + (set! v0-0 (current-time)) (set! (-> v1-4 exploded-time) (the-as time-frame v0-0)) ) v0-0 @@ -2124,7 +2120,7 @@ (countdown (s5-0 (-> gp-1 length)) (let ((s4-0 (-> gp-1 s5-0))) (when (and (not (handle->process (-> s4-0 active-handle))) - (>= (- (-> self clock frame-counter) (-> s4-0 exploded-time)) (seconds 1)) + (>= (- (current-time) (-> s4-0 exploded-time)) (seconds 1)) ) (set! (-> s4-0 active-handle) (-> s4-0 waiting-handle)) (let ((s3-0 (get-process *default-dead-pool* under-block #x4000))) @@ -2196,8 +2192,8 @@ :code (behavior () (process-entity-status! self (entity-perm-status subtask-complete) #t) (sound-play "und-block-chime") - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (suspend) ) (let ((gp-1 (-> self puzzle spawners))) diff --git a/goal_src/jak2/levels/underport/under-sig-obs.gc b/goal_src/jak2/levels/underport/under-sig-obs.gc index 29213336f4..23fa3ff562 100644 --- a/goal_src/jak2/levels/underport/under-sig-obs.gc +++ b/goal_src/jak2/levels/underport/under-sig-obs.gc @@ -47,9 +47,9 @@ (let ((gp-0 (cshape-reaction-default arg0 arg1 arg2 arg3))) (when (logtest? gp-0 (collide-status touch-surface)) (let ((s5-0 self)) - (when (>= (- (-> self clock frame-counter) (-> s5-0 hit-time)) (seconds 0.25)) + (when (>= (- (current-time) (-> s5-0 hit-time)) (seconds 0.25)) (sound-play "shoot-plat-fall") - (set! (-> s5-0 hit-time) (-> self clock frame-counter)) + (set! (-> s5-0 hit-time) (current-time)) ) ) ) @@ -203,7 +203,7 @@ For example for an elevator pre-compute the distance between the first and last (vector-normalize! (-> self axe-flip) 1.0) (vector-rotate90-around-y! (-> self axe-flip) (-> self axe-flip)) (set! (-> self angle-flip-vel) -10.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ) ) @@ -279,11 +279,11 @@ For example for an elevator pre-compute the distance between the first and last ) (set! (-> self dest-angle) 180.0) (set! (-> self on-shake) #f) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self time-flip))) + (when (>= (- (current-time) (-> self state-time)) (the-as time-frame (-> self time-flip))) (set! (-> self state-flip) (the-as uint 0)) 0 ) @@ -310,7 +310,7 @@ For example for an elevator pre-compute the distance between the first and last (set! (-> self angle-flip) 0.0) ) (quaternion-vector-angle! (-> self root-override quat) (-> self axe-flip) (* 182.04445 (-> self angle-flip))) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (+ (-> self time-flip) -300))) + (when (and (>= (- (current-time) (-> self state-time)) (the-as time-frame (+ (-> self time-flip) -300))) (= 1 (-> self state-flip)) ) (when (not (-> self on-shake)) @@ -358,7 +358,7 @@ For example for an elevator pre-compute the distance between the first and last (defstate die-falling (under-plat-shoot) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self mask) (process-mask actor-pause enemy platform)) (let ((v1-7 (-> (the-as collide-shape-prim-group (-> self root-override root-prim)) child 0))) (set! (-> v1-7 prim-core collide-as) (collide-spec)) @@ -368,8 +368,8 @@ For example for an elevator pre-compute the distance between the first and last (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) - (let ((f30-0 (* 0.0016666667 (the float (+ (- (seconds -1) (-> self state-time)) (-> self clock frame-counter)))))) + (when (>= (- (current-time) (-> self state-time)) (seconds 1)) + (let ((f30-0 (* 0.0016666667 (the float (+ (- (seconds -1) (-> self state-time)) (current-time)))))) (when (>= f30-0 1.0) (cleanup-for-death self) (go empty-state) @@ -393,7 +393,7 @@ For example for an elevator pre-compute the distance between the first and last #t ) ) - (set! (-> self hit-time) (-> self clock frame-counter)) + (set! (-> self hit-time) (current-time)) (let ((gp-1 (new 'stack-no-clear 'quaternion)) (s5-1 (new 'stack-no-clear 'quaternion)) (s4-0 (new 'stack-no-clear 'vector)) @@ -541,8 +541,8 @@ otherwise, [[plat::34]] ) (suspend) (ja-channel-set! 0) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -1318,7 +1318,7 @@ This commonly includes things such as: (defbehavior under-pipe-growls-post under-pipe-growls () - (when (and (zero? (-> self approach-sound-id)) (>= (-> self clock frame-counter) (-> self approach-play-time))) + (when (and (zero? (-> self approach-sound-id)) (>= (current-time) (-> self approach-play-time))) (let ((gp-0 (-> self root trans))) (set! (-> self approach-sound-id) (if (zero? (rand-vu-int-count 3)) (sound-play "grunt-warn" :position gp-0) @@ -1427,28 +1427,28 @@ This commonly includes things such as: ) :code (behavior () (sound-play "grunt-notice" :vol 40 :position (target-pos 0)) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.2)) (suspend) ) (sound-play "grunt-warn" :vol 50 :position (target-pos 0)) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.2)) (suspend) ) (sound-play "grunt-hit" :vol 60 :position (target-pos 0)) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (suspend) ) (sound-play "grunt-notice" :vol 70 :position (target-pos 0)) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) (sound-play "grunt-notice" :position (target-pos 0)) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) (sound-play "grunt-notice" :vol 200 :position (target-pos 0)) @@ -1479,9 +1479,7 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defbehavior under-pipe-growls-init-by-other under-pipe-growls ((arg0 vector) (arg1 symbol)) (set! (-> self approach-sound-id) (new 'static 'sound-id)) - (set! (-> self approach-play-time) - (+ (-> self clock frame-counter) (rand-vu-int-range (seconds 0.1) (seconds 1))) - ) + (set! (-> self approach-play-time) (+ (current-time) (rand-vu-int-range (seconds 0.1) (seconds 1)))) (set! (-> self root) (new 'process 'trsqv)) (logclear! (-> self mask) (process-mask actor-pause)) (let ((s4-1 (-> self root))) diff --git a/goal_src/jak2/levels/underport/underb-master.gc b/goal_src/jak2/levels/underport/underb-master.gc index b3ce6ec08a..ada0b29db0 100644 --- a/goal_src/jak2/levels/underport/underb-master.gc +++ b/goal_src/jak2/levels/underport/underb-master.gc @@ -379,7 +379,7 @@ ) (if (or (not gp-0) (not (logtest? (-> gp-0 water flags) (water-flags under-water)))) (set! (-> self air-charge-up?) #t) - (set! (-> self underwater-time) (-> self clock frame-counter)) + (set! (-> self underwater-time) (current-time)) ) ) (cond @@ -419,8 +419,8 @@ (else (when (>= 0.4 (-> self air-supply)) (let ((v1-39 (the int (lerp-scale 90.0 300.0 (-> self air-supply) 0.0 0.4)))) - (when (>= (- (-> self clock frame-counter) (-> self last-air-beep-time)) v1-39) - (set! (-> self last-air-beep-time) (-> self clock frame-counter)) + (when (>= (- (current-time) (-> self last-air-beep-time)) v1-39) + (set! (-> self last-air-beep-time) (current-time)) (sound-play "oxygen-warning") ) ) @@ -431,9 +431,7 @@ ) (set! (-> *game-info* air-supply) (fmin 1.0 (-> self air-supply))) (if (or (and *target* (not (logtest? (focus-status mech) (-> *target* focus-status)))) - (and (>= (-> self air-supply) 1.0) - (>= (- (-> self clock frame-counter) (-> self underwater-time)) (seconds 3)) - ) + (and (>= (-> self air-supply) 1.0) (>= (- (current-time) (-> self underwater-time)) (seconds 3))) ) (spawn-air-tank-hud self #f) (spawn-air-tank-hud self #t) @@ -564,7 +562,7 @@ :enter (behavior () (persist-with-delay *setting-control* 'interp-time (seconds 0.05) 'interp-time 'abs 0.0 0) (set-setting! 'entity-name "camera-244" 0.0 0) - (set! (-> self big-room-timer) (-> self clock frame-counter)) + (set! (-> self big-room-timer) (current-time)) (send-event (ppointer->process *underb-master*) 'request 'under-warp #t) (none) ) @@ -574,7 +572,7 @@ (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self big-room-timer)) (seconds 1)) + (if (>= (- (current-time) (-> self big-room-timer)) (seconds 1)) (go-virtual idle) ) (none) @@ -686,7 +684,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -709,7 +707,7 @@ ) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((a0-13 (-> v1-0 0 data 0 actor))) (if a0-13 (-> a0-13 extra process) @@ -766,7 +764,7 @@ ) ) (else - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ) ) @@ -854,8 +852,8 @@ 0 ) ) - (when (>= (- (-> self clock frame-counter) (-> self last-reminder-time)) (seconds 9)) - (set! (-> self last-reminder-time) (-> self clock frame-counter)) + (when (>= (- (current-time) (-> self last-reminder-time)) (seconds 9)) + (set! (-> self last-reminder-time) (current-time)) (add-process *gui-control* self @@ -897,12 +895,12 @@ (when (and (zero? (-> self state-time)) (= (get-status *gui-control* (the-as sound-id (-> self spooled-sound-id))) (gui-status ready)) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-reminder-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self last-reminder-time) (current-time)) ) (when (nonzero? (-> self state-time)) (when (and (>= (-> self spooled-sound-delay) 0) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self spooled-sound-delay)) + (>= (- (current-time) (-> self state-time)) (-> self spooled-sound-delay)) ) (set-action! *gui-control* @@ -930,7 +928,7 @@ ) ) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2)) (spawn (-> self part) (-> self root trans)) ) ) @@ -1003,8 +1001,8 @@ (when (and (zero? (-> self state-time)) (= (get-status *gui-control* (the-as sound-id (-> self spooled-sound-id))) (gui-status ready)) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-reminder-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self last-reminder-time) (current-time)) (set-action! *gui-control* (gui-action play) @@ -1031,7 +1029,7 @@ ) ) ) - (if (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (< (- (current-time) (-> self state-time)) (seconds 1)) (spawn (-> self draining-part) (-> self root trans)) ) ) diff --git a/test/decompiler/reference/jak2/characters/ashelin/ash-states_REF.gc b/test/decompiler/reference/jak2/characters/ashelin/ash-states_REF.gc index 9d00f0dd94..4c68a6fbb5 100644 --- a/test/decompiler/reference/jak2/characters/ashelin/ash-states_REF.gc +++ b/test/decompiler/reference/jak2/characters/ashelin/ash-states_REF.gc @@ -6,7 +6,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -105,7 +105,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -165,9 +165,7 @@ (ashelin-method-240 self a1-6) ) (else - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - (ashelin-method-247 self) - ) + (if (and (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (ashelin-method-247 self)) (go-virtual chase) ) ) @@ -185,7 +183,7 @@ ) ) (else - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (if (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (ashelin-method-239 self) ) ) @@ -256,7 +254,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -347,7 +345,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -377,12 +375,10 @@ ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) (ashelin-method-239 self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -416,7 +412,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -437,7 +433,7 @@ ((bot-method-214 self) (go-hostile self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + ((and (>= (- (current-time) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) (go-virtual traveling) ) ) @@ -465,7 +461,7 @@ ) :trans (behavior () (bot-method-223 self #f) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (when (bot-method-214 self) (if (ashelin-method-238 self #t #f) (go-virtual standing-idle) @@ -555,16 +551,14 @@ :trans (behavior () (bot-method-223 self #t) (cond - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ((not (bot-method-214 self)) (go-virtual traveling) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (or (ashelin-method-238 self #t #f) (ashelin-method-248 self)) (go-virtual standing-idle) ) @@ -609,7 +603,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -752,7 +746,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -888,7 +882,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ashelin) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1090,7 +1084,7 @@ (t9-0) ) ) - (when (and (logtest? (bot-flags bf23) (-> self bot-flags)) (!= (-> self state-time) (-> self clock frame-counter))) + (when (and (logtest? (bot-flags bf23) (-> self bot-flags)) (!= (-> self state-time) (current-time))) (logclear! (-> self bot-flags) (bot-flags bf23)) (ashelin-method-244 self) ) diff --git a/test/decompiler/reference/jak2/characters/ashelin/ash_REF.gc b/test/decompiler/reference/jak2/characters/ashelin/ash_REF.gc index 7b56f1a545..a71ae05fff 100644 --- a/test/decompiler/reference/jak2/characters/ashelin/ash_REF.gc +++ b/test/decompiler/reference/jak2/characters/ashelin/ash_REF.gc @@ -299,101 +299,99 @@ ;; definition for method 97 of type ashelin (defmethod enemy-method-97 ashelin ((obj ashelin)) - (with-pp - (let* ((s5-0 (handle->process (-> obj attacker-handle))) - (v1-3 (if (type? s5-0 process-focusable) - s5-0 - ) - ) + (let* ((s5-0 (handle->process (-> obj attacker-handle))) + (v1-3 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when v1-3 + (cond + ((= (-> v1-3 type) target) + (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) + (>= (- (current-time) (-> obj attacker-time)) (seconds 5)) + ) + (if (logtest? (-> obj bot-flags) (bot-flags attacked)) + (reset-attacker! obj) + ) + (set! v1-3 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) - (when v1-3 - (cond - ((= (-> v1-3 type) target) - (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) - (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 5)) - ) - (if (logtest? (-> obj bot-flags) (bot-flags attacked)) - (reset-attacker! obj) - ) - (set! v1-3 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 2.5)) - (set! v1-3 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) + ) + (else + (when (>= (- (current-time) (-> obj attacker-time)) (seconds 2.5)) + (set! v1-3 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) ) ) - (let ((a0-21 (-> obj focus-mode)) - (s5-1 (the-as process #f)) - ) - (cond - ((zero? a0-21) - (cond - (v1-3 - (set! s5-1 v1-3) - ) - ((begin (set! s5-1 (select-focus! obj)) s5-1) - (empty) - ) - (else - (let ((s4-0 (handle->process (-> obj poi-handle)))) - (set! s5-1 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) - (if s5-1 - (empty) - (set! s5-1 *target*) - ) - ) - ) - ) - ((= a0-21 1) - (cond - (v1-3 - (set! s5-1 v1-3) - ) - (else - (let ((s4-1 (handle->process (-> obj poi-handle)))) - (set! s5-1 (if (type? s4-1 process-focusable) - s4-1 - ) - ) - ) - (cond - (s5-1 - (empty) - ) - ((begin (set! s5-1 (select-focus! obj)) s5-1) - (empty) - ) - (else - (set! s5-1 *target*) - ) - ) - ) - ) - ) + ) + (let ((a0-21 (-> obj focus-mode)) + (s5-1 (the-as process #f)) ) - (cond - (s5-1 - (try-update-focus (-> obj focus) (the-as process-focusable s5-1) obj) - (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> s5-1 type) target)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) + (cond + ((zero? a0-21) + (cond + (v1-3 + (set! s5-1 v1-3) + ) + ((begin (set! s5-1 (select-focus! obj)) s5-1) + (empty) + ) + (else + (let ((s4-0 (handle->process (-> obj poi-handle)))) + (set! s5-1 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (if s5-1 + (empty) + (set! s5-1 *target*) + ) + ) + ) + ) + ((= a0-21 1) + (cond + (v1-3 + (set! s5-1 v1-3) + ) + (else + (let ((s4-1 (handle->process (-> obj poi-handle)))) + (set! s5-1 (if (type? s4-1 process-focusable) + s4-1 + ) + ) + ) + (cond + (s5-1 + (empty) + ) + ((begin (set! s5-1 (select-focus! obj)) s5-1) + (empty) ) - ) - (else - (clear-focused (-> obj focus)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) - ) - ) - s5-1 + (else + (set! s5-1 *target*) + ) + ) + ) + ) + ) ) + (cond + (s5-1 + (try-update-focus (-> obj focus) (the-as process-focusable s5-1) obj) + (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> s5-1 type) target)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + (else + (clear-focused (-> obj focus)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + s5-1 ) ) ) @@ -527,11 +525,9 @@ ;; definition for method 235 of type ashelin (defmethod ashelin-method-235 ashelin ((obj ashelin) (arg0 symbol)) - (with-pp - (and (>= (- (-> pp clock frame-counter) (-> obj last-fire-time)) (seconds 1)) - (and (>= 8556.089 (fabs (-> obj focus-info ry-diff))) (ashelin-method-238 obj arg0 #t)) - ) - ) + (and (>= (- (current-time) (-> obj last-fire-time)) (seconds 1)) + (and (>= 8556.089 (fabs (-> obj focus-info ry-diff))) (ashelin-method-238 obj arg0 #t)) + ) ) ;; definition for method 243 of type ashelin @@ -786,31 +782,29 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch (pointer process) vs none. (defmethod fire-projectile ashelin ((obj ashelin) (arg0 vector)) - (with-pp - (set! (-> obj last-fire-time) (-> pp clock frame-counter)) - (+! (-> obj fired-gun-count) 1) - (let ((s4-0 (new 'stack-no-clear 'projectile-init-by-other-params))) - (set! (-> s4-0 ent) (-> obj entity)) - (set! (-> s4-0 charge) 1.0) - (set! (-> s4-0 options) (projectile-options account-for-target-velocity proj-options-8000)) - (set! (-> s4-0 notify-handle) (process->handle obj)) - (set! (-> s4-0 owner-handle) (the-as handle #f)) - (set! (-> s4-0 ignore-handle) (process->handle obj)) - (let* ((v1-13 *game-info*) - (a0-10 (+ (-> v1-13 attack-id) 1)) - ) - (set! (-> v1-13 attack-id) a0-10) - (set! (-> s4-0 attack-id) a0-10) - ) - (set! (-> s4-0 timeout) (seconds 4)) - (vector<-cspace! (-> s4-0 pos) (-> obj node-list data 22)) - (set! (-> s4-0 vel quad) (-> arg0 quad)) - (vector-! (-> s4-0 vel) (-> s4-0 vel) (-> s4-0 pos)) - (vector-normalize! (-> s4-0 vel) 307200.0) - (spawn-projectile ashelin-shot s4-0 obj *default-dead-pool*) + (set! (-> obj last-fire-time) (current-time)) + (+! (-> obj fired-gun-count) 1) + (let ((s4-0 (new 'stack-no-clear 'projectile-init-by-other-params))) + (set! (-> s4-0 ent) (-> obj entity)) + (set! (-> s4-0 charge) 1.0) + (set! (-> s4-0 options) (projectile-options account-for-target-velocity proj-options-8000)) + (set! (-> s4-0 notify-handle) (process->handle obj)) + (set! (-> s4-0 owner-handle) (the-as handle #f)) + (set! (-> s4-0 ignore-handle) (process->handle obj)) + (let* ((v1-13 *game-info*) + (a0-10 (+ (-> v1-13 attack-id) 1)) + ) + (set! (-> v1-13 attack-id) a0-10) + (set! (-> s4-0 attack-id) a0-10) ) - (none) + (set! (-> s4-0 timeout) (seconds 4)) + (vector<-cspace! (-> s4-0 pos) (-> obj node-list data 22)) + (set! (-> s4-0 vel quad) (-> arg0 quad)) + (vector-! (-> s4-0 vel) (-> s4-0 vel) (-> s4-0 pos)) + (vector-normalize! (-> s4-0 vel) 307200.0) + (spawn-projectile ashelin-shot s4-0 obj *default-dead-pool*) ) + (none) ) ;; definition for method 249 of type ashelin @@ -1409,38 +1403,30 @@ ;; definition for method 245 of type ashelin (defmethod ashelin-method-245 ashelin ((obj ashelin)) - (with-pp - (when (and (not (channel-active? obj (the-as uint 0))) - (>= (-> pp clock frame-counter) (-> obj victory-speech-time)) - ) - (let ((s5-0 (bot-speech-list-method-9 - (-> obj ash-course victory-speeches) - obj - (-> obj ash-course speeches) - (speech-flags) - ) + (when (and (not (channel-active? obj (the-as uint 0))) (>= (current-time) (-> obj victory-speech-time))) + (let ((s5-0 (bot-speech-list-method-9 + (-> obj ash-course victory-speeches) + obj + (-> obj ash-course speeches) + (speech-flags) ) - ) - (when (>= s5-0 0) - (set! (-> obj victory-speech-time) - (the-as time-frame (+ (get-rand-int-range obj 1200 2100) (-> pp clock frame-counter))) ) - (play-speech obj s5-0) ) + (when (>= s5-0 0) + (set! (-> obj victory-speech-time) (the-as time-frame (+ (get-rand-int-range obj 1200 2100) (current-time)))) + (play-speech obj s5-0) ) ) - (none) ) + (none) ) ;; definition for method 136 of type ashelin (defmethod enemy-method-136 ashelin ((obj ashelin)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> obj hit-focus-time)) (seconds 2)) - (let ((v0-0 (logclear (-> obj enemy-flags) (enemy-flag look-at-focus)))) - (set! (-> obj enemy-flags) v0-0) - v0-0 - ) + (when (>= (- (current-time) (-> obj hit-focus-time)) (seconds 2)) + (let ((v0-0 (logclear (-> obj enemy-flags) (enemy-flag look-at-focus)))) + (set! (-> obj enemy-flags) v0-0) + v0-0 ) ) ) @@ -1505,7 +1491,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak2/characters/sig/sig-states_REF.gc b/test/decompiler/reference/jak2/characters/sig/sig-states_REF.gc index 7b3e069d39..1a72bb74c9 100644 --- a/test/decompiler/reference/jak2/characters/sig/sig-states_REF.gc +++ b/test/decompiler/reference/jak2/characters/sig/sig-states_REF.gc @@ -6,7 +6,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -67,7 +67,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -171,7 +171,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -214,7 +214,7 @@ ) ) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (or (not (-> self focus-info fproc)) (>= (-> self focus-info bullseye-xz-dist) 102400.0)) ) (go-virtual waiting-far) @@ -303,7 +303,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -495,7 +495,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -649,7 +649,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -681,7 +681,7 @@ ) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) (zero? (-> self played-unjam-time))) - (set! (-> self played-unjam-time) (-> self clock frame-counter)) + (set! (-> self played-unjam-time) (current-time)) (sound-play "sig-gun-unjam") ) (none) @@ -708,7 +708,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -724,7 +724,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -739,7 +739,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -754,7 +754,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -769,7 +769,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -784,7 +784,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -800,7 +800,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -816,7 +816,7 @@ (ja :num! (seek!)) ) (when (and (logtest? (bot-flags bf21) (-> self bot-flags)) - (>= (- (-> self clock frame-counter) (-> self played-unjam-time)) (seconds 0.35)) + (>= (- (current-time) (-> self played-unjam-time)) (seconds 0.35)) ) (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) @@ -833,7 +833,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -942,7 +942,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -976,12 +976,10 @@ ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) (go-virtual waiting-close) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -1015,7 +1013,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1043,7 +1041,7 @@ ((sig-method-255 self) (go-virtual repair-gun) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + ((and (>= (- (current-time) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) (go-virtual traveling) ) ) @@ -1086,7 +1084,7 @@ ) :trans (behavior () (bot-method-223 self #f) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (when (bot-method-214 self) (cond ((sig-method-246 self) @@ -1329,7 +1327,7 @@ (seconds 0.05) ) (bot-method-223 self #t) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (or (not (bot-method-214 self)) (not (sig-method-245 self))) ) (react-to-focus self) @@ -1373,9 +1371,7 @@ :trans (behavior () (bot-method-223 self #t) (cond - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ((not (bot-method-214 self)) @@ -1448,7 +1444,7 @@ 0.0 #f ) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.167)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.167)) (sig-method-258 self) (suspend) ) @@ -1478,7 +1474,7 @@ ) ) ) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.8)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.8)) (sig-method-258 self) (suspend) ) @@ -1629,7 +1625,7 @@ (ja :num! (seek!)) ) (ja-channel-push! 1 (seconds 0.2)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (ja-no-eval :group! (-> self draw art-group data 4) :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) frames num-frames) -1))) @@ -1637,7 +1633,7 @@ ) (until (ja-done? 0) (if (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (reset? *fail-mission-control*) ) (reset! *fail-mission-control*) @@ -1656,7 +1652,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1719,7 +1715,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1749,7 +1745,7 @@ (if (logtest? s5-0 2) (go-virtual sig-path-shoot-jump) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) (not (logtest? s5-0 4))) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.05)) (not (logtest? s5-0 4))) (go-virtual sig-path-jump-land) ) ) @@ -1792,7 +1788,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1862,7 +1858,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1893,7 +1889,7 @@ (if (and (logtest? s5-0 1) (logtest? (bot-flags bf25) (-> self bot-flags))) (go-virtual sig-path-jump) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) (not (logtest? s5-0 4))) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.05)) (not (logtest? s5-0 4))) (go-virtual sig-path-shoot-jump-land) ) ) @@ -1941,7 +1937,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -2011,7 +2007,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior sig) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) diff --git a/test/decompiler/reference/jak2/characters/sig/sig-task_REF.gc b/test/decompiler/reference/jak2/characters/sig/sig-task_REF.gc index 2f6599a7dc..4906e9e002 100644 --- a/test/decompiler/reference/jak2/characters/sig/sig-task_REF.gc +++ b/test/decompiler/reference/jak2/characters/sig/sig-task_REF.gc @@ -178,7 +178,7 @@ (set! (-> a1-3 message) 'sync) (let ((v1-19 (- ((method-of-type sync-info get-timeframe-offset!) (the-as sync-info (send-event-function s5-1 a1-3)) 0) - (-> pp clock frame-counter) + (current-time) ) ) ) @@ -278,7 +278,7 @@ (set! (-> a1-6 message) 'sync) (let ((v1-16 (- ((method-of-type sync-info get-timeframe-offset!) (the-as sync-info (send-event-function a0-4 a1-6)) 0) - (-> pp clock frame-counter) + (current-time) ) ) ) diff --git a/test/decompiler/reference/jak2/characters/sig/sig_REF.gc b/test/decompiler/reference/jak2/characters/sig/sig_REF.gc index 9864fbc27a..b554641ea1 100644 --- a/test/decompiler/reference/jak2/characters/sig/sig_REF.gc +++ b/test/decompiler/reference/jak2/characters/sig/sig_REF.gc @@ -260,122 +260,120 @@ ;; definition for method 97 of type sig (defmethod enemy-method-97 sig ((obj sig)) - (with-pp - (let* ((s5-0 (handle->process (-> obj attacker-handle))) - (s4-0 (if (type? s5-0 process-focusable) - s5-0 - ) - ) + (let* ((s5-0 (handle->process (-> obj attacker-handle))) + (s4-0 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when s4-0 + (cond + ((= (-> s4-0 type) target) + (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) + (>= (- (current-time) (-> obj attacker-time)) (seconds 1.5)) + ) + (if (logtest? (-> obj bot-flags) (bot-flags attacked)) + (reset-attacker! obj) + ) + (set! s4-0 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) - (when s4-0 - (cond - ((= (-> s4-0 type) target) - (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) - (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 1.5)) + ) + (else + (when (>= (- (current-time) (-> obj attacker-time)) (seconds 6)) + (set! s4-0 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) + ) + ) + ) + ) + (let ((v1-23 (-> obj focus-mode)) + (s5-1 (the-as process #f)) + ) + (cond + ((zero? v1-23) + (cond + (s4-0 + (if (or (not (logtest? (bot-flags bf19) (-> obj bot-flags))) + (>= 16384.0 + (vector-vector-xz-distance (-> obj root-override2 trans) (get-trans (the-as process-focusable s4-0) 3)) + ) ) - (if (logtest? (-> obj bot-flags) (bot-flags attacked)) - (reset-attacker! obj) + (set! s5-1 s4-0) ) - (set! s4-0 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) + ) + (else + (when (not (logtest? (bot-flags bf19) (-> obj bot-flags))) + (set! s5-1 (select-focus! obj)) + (cond + (s5-1 + (empty) + ) + (else + (let ((s4-1 (handle->process (-> obj poi-handle)))) + (set! s5-1 (if (type? s4-1 process-focusable) + s4-1 + ) + ) + ) + (if s5-1 + (empty) + (set! s5-1 *target*) + ) + ) + ) + ) ) ) - (else - (when (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 6)) - (set! s4-0 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) + ) + ((= v1-23 1) + (cond + (s4-0 + (if (or (not (logtest? (bot-flags bf19) (-> obj bot-flags))) + (>= 16384.0 + (vector-vector-xz-distance (-> obj root-override2 trans) (get-trans (the-as process-focusable s4-0) 3)) + ) + ) + (set! s5-1 s4-0) + ) + ) + (else + (when (not (logtest? (bot-flags bf19) (-> obj bot-flags))) + (let ((s4-2 (handle->process (-> obj poi-handle)))) + (set! s5-1 (if (type? s4-2 process-focusable) + s4-2 + ) + ) + ) + (cond + (s5-1 + (empty) + ) + ((begin (set! s5-1 (select-focus! obj)) s5-1) + (empty) + ) + (else + (set! s5-1 *target*) + ) + ) + ) + ) + ) + ) + ) + (cond + (s5-1 + (try-update-focus (-> obj focus) (the-as process-focusable s5-1) obj) + (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> (the-as process-focusable s5-1) type) target)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) ) - ) + ) + (else + (clear-focused (-> obj focus)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) ) ) - (let ((v1-23 (-> obj focus-mode)) - (s5-1 (the-as process #f)) - ) - (cond - ((zero? v1-23) - (cond - (s4-0 - (if (or (not (logtest? (bot-flags bf19) (-> obj bot-flags))) - (>= 16384.0 - (vector-vector-xz-distance (-> obj root-override2 trans) (get-trans (the-as process-focusable s4-0) 3)) - ) - ) - (set! s5-1 s4-0) - ) - ) - (else - (when (not (logtest? (bot-flags bf19) (-> obj bot-flags))) - (set! s5-1 (select-focus! obj)) - (cond - (s5-1 - (empty) - ) - (else - (let ((s4-1 (handle->process (-> obj poi-handle)))) - (set! s5-1 (if (type? s4-1 process-focusable) - s4-1 - ) - ) - ) - (if s5-1 - (empty) - (set! s5-1 *target*) - ) - ) - ) - ) - ) - ) - ) - ((= v1-23 1) - (cond - (s4-0 - (if (or (not (logtest? (bot-flags bf19) (-> obj bot-flags))) - (>= 16384.0 - (vector-vector-xz-distance (-> obj root-override2 trans) (get-trans (the-as process-focusable s4-0) 3)) - ) - ) - (set! s5-1 s4-0) - ) - ) - (else - (when (not (logtest? (bot-flags bf19) (-> obj bot-flags))) - (let ((s4-2 (handle->process (-> obj poi-handle)))) - (set! s5-1 (if (type? s4-2 process-focusable) - s4-2 - ) - ) - ) - (cond - (s5-1 - (empty) - ) - ((begin (set! s5-1 (select-focus! obj)) s5-1) - (empty) - ) - (else - (set! s5-1 *target*) - ) - ) - ) - ) - ) - ) - ) - (cond - (s5-1 - (try-update-focus (-> obj focus) (the-as process-focusable s5-1) obj) - (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> (the-as process-focusable s5-1) type) target)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) - ) - ) - (else - (clear-focused (-> obj focus)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) - ) - ) - s5-1 - ) + s5-1 ) ) ) @@ -416,68 +414,64 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (with-pp - (let ((v1-2 (-> obj skel top-anim frame-group))) - (cond - ((>= (- (-> pp clock frame-counter) (-> obj danger-time)) (seconds 2)) - (cond - ((not v1-2) - (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 42)) + (let ((v1-2 (-> obj skel top-anim frame-group))) + (cond + ((>= (- (current-time) (-> obj danger-time)) (seconds 2)) + (cond + ((not v1-2) + (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 42)) + ) + ((= v1-2 (-> obj draw art-group data 44)) + (push-anim-to-targ + (-> obj skel top-anim) + (the-as art-joint-anim (-> obj draw art-group data 46)) + 0.0 + 0 + 0 + 1.0 + 0.0 + #f ) - ((= v1-2 (-> obj draw art-group data 44)) - (push-anim-to-targ - (-> obj skel top-anim) - (the-as art-joint-anim (-> obj draw art-group data 46)) - 0.0 - 0 - 0 - 1.0 - 0.0 - #f - ) - (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 42)) - ) - ) + (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 42)) + ) ) - (else - (cond - ((not v1-2) - (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 44)) + ) + (else + (cond + ((not v1-2) + (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 44)) + ) + ((= v1-2 (-> obj draw art-group data 42)) + (push-anim-to-targ + (-> obj skel top-anim) + (the-as art-joint-anim (-> obj draw art-group data 43)) + 0.0 + 0 + 0 + 1.0 + 0.0 + #f ) - ((= v1-2 (-> obj draw art-group data 42)) - (push-anim-to-targ - (-> obj skel top-anim) - (the-as art-joint-anim (-> obj draw art-group data 43)) - 0.0 - 0 - 0 - 1.0 - 0.0 - #f - ) - (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 44)) - ) - ) + (set! (-> obj skel top-anim base-anim) (-> obj draw art-group data 44)) + ) ) ) ) - (let ((t9-2 (method-of-type bot track-target!))) - (t9-2 obj) - ) - (when (logtest? (-> obj bot-flags) (bot-flags too-far-fail)) - (let ((f0-0 (vector-vector-distance (-> obj root-override2 trans) (target-pos 0)))) - (when (or (>= f0-0 491520.0) - (and (>= f0-0 102400.0) (>= (- (-> pp clock frame-counter) (-> obj last-draw-time)) (seconds 10))) - ) - (process-entity-status! obj (entity-perm-status no-kill) #f) - (cleanup-for-death obj) - (go (method-of-object obj die-fast)) - ) - ) - ) - (sig-plasma-method-14 (-> obj plasma) obj) - (none) ) + (let ((t9-2 (method-of-type bot track-target!))) + (t9-2 obj) + ) + (when (logtest? (-> obj bot-flags) (bot-flags too-far-fail)) + (let ((f0-0 (vector-vector-distance (-> obj root-override2 trans) (target-pos 0)))) + (when (or (>= f0-0 491520.0) (and (>= f0-0 102400.0) (>= (- (current-time) (-> obj last-draw-time)) (seconds 10)))) + (process-entity-status! obj (entity-perm-status no-kill) #f) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + ) + ) + (sig-plasma-method-14 (-> obj plasma) obj) + (none) ) ;; definition for method 213 of type sig diff --git a/test/decompiler/reference/jak2/characters/underground_fighters/shuttle_REF.gc b/test/decompiler/reference/jak2/characters/underground_fighters/shuttle_REF.gc index 48abb48c3d..c8b07683d1 100644 --- a/test/decompiler/reference/jak2/characters/underground_fighters/shuttle_REF.gc +++ b/test/decompiler/reference/jak2/characters/underground_fighters/shuttle_REF.gc @@ -434,7 +434,7 @@ (set! (-> self gnd-height) (-> self root-override2 gspot-pos y)) (logior! (-> self flags) (citizen-flag persistent)) (set! (-> self focus-status) (logior (focus-status pilot-riding pilot) (-> self focus-status))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-31 (-> self root-override2 root-prim))) (set! (-> v1-31 prim-core collide-as) (collide-spec)) (set! (-> v1-31 prim-core collide-with) (collide-spec)) @@ -466,7 +466,7 @@ (let ((gp-0 (new 'stack-no-clear 'vector)) (s5-0 (new 'stack-no-clear 'quaternion)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (while (not (civilian-method-217 self gp-0)) (let ((s4-0 (handle->process (-> self vehicle))) (s3-0 (new 'stack-no-clear 'quaternion)) @@ -475,7 +475,7 @@ (compute-seat-position (the-as vehicle s4-0) (-> self root-override2 trans) (-> self seat)) (quaternion-copy! (-> self root-override2 quat) s3-0) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (when (>= (- (current-time) (-> self state-time)) (seconds 2)) (put-rider-in-seat (the-as vehicle (handle->process (-> self vehicle))) (-> self seat) self) (go-virtual ride) ) @@ -1136,246 +1136,244 @@ ;; 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)) - (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (cond - ((nonzero? (-> arg0 data-int32 9)) - (check-time arg0) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) ) - (else - (set! (-> arg0 start-time) (-> pp clock frame-counter)) - (when (< (vector-vector-xz-distance (target-pos 0) (-> arg0 begin-pos)) 102400.0) - (set-setting! 'airlock #f 0.0 0) - (set! (-> arg0 data-int32 9) 1) - ) + (init-vf0-vector) + (cond + ((nonzero? (-> arg0 data-int32 9)) + (check-time arg0) + ) + (else + (set! (-> arg0 start-time) (current-time)) + (when (< (vector-vector-xz-distance (target-pos 0) (-> arg0 begin-pos)) 102400.0) + (set-setting! 'airlock #f 0.0 0) + (set! (-> arg0 data-int32 9) 1) ) ) - (when (= (-> arg0 data-int32 10) (+ (-> arg0 sub-state) -1)) - (let ((s3-1 (handle->process (-> arg0 slave (logand -2 (-> arg0 data-int32 10)))))) - (when s3-1 - (let ((v1-20 (-> arg0 data-int32 10))) - (cond - ((zero? v1-20) - (let ((v0-4 (rand-vu-int-count 3))) - (cond - ((zero? v0-4) - (send-event s3-1 'play-speech "agnt038") - ) - ((= v0-4 1) - (send-event s3-1 'play-speech "agnt039") - ) - ((= v0-4 2) - (send-event s3-1 'play-speech "agnt040") - ) - ) + ) + (when (= (-> arg0 data-int32 10) (+ (-> arg0 sub-state) -1)) + (let ((s3-1 (handle->process (-> arg0 slave (logand -2 (-> arg0 data-int32 10)))))) + (when s3-1 + (let ((v1-20 (-> arg0 data-int32 10))) + (cond + ((zero? v1-20) + (let ((v0-4 (rand-vu-int-count 3))) + (cond + ((zero? v0-4) + (send-event s3-1 'play-speech "agnt038") + ) + ((= v0-4 1) + (send-event s3-1 'play-speech "agnt039") + ) + ((= v0-4 2) + (send-event s3-1 'play-speech "agnt040") + ) ) ) - ((= v1-20 1) - (let ((v0-8 (rand-vu-int-count 4))) - (cond - ((zero? v0-8) - (send-event s3-1 'play-speech "agnt045") - ) - ((= v0-8 1) - (send-event s3-1 'play-speech "agnt046") - ) - ((= v0-8 2) - (send-event s3-1 'play-speech "agnt047") - ) - ((= v0-8 3) - (send-event s3-1 'play-speech "agnt048") - ) - ) + ) + ((= v1-20 1) + (let ((v0-8 (rand-vu-int-count 4))) + (cond + ((zero? v0-8) + (send-event s3-1 'play-speech "agnt045") + ) + ((= v0-8 1) + (send-event s3-1 'play-speech "agnt046") + ) + ((= v0-8 2) + (send-event s3-1 'play-speech "agnt047") + ) + ((= v0-8 3) + (send-event s3-1 'play-speech "agnt048") + ) ) ) - ((= v1-20 2) - (let ((v0-13 (rand-vu-int-count 4))) - (cond - ((zero? v0-13) - (send-event s3-1 'play-speech "agnt092") - ) - ((= v0-13 1) - (send-event s3-1 'play-speech "agnt093") - ) - ((= v0-13 2) - (send-event s3-1 'play-speech "agnt094") - ) - ((= v0-13 3) - (send-event s3-1 'play-speech "agnt095") - ) - ) + ) + ((= v1-20 2) + (let ((v0-13 (rand-vu-int-count 4))) + (cond + ((zero? v0-13) + (send-event s3-1 'play-speech "agnt092") + ) + ((= v0-13 1) + (send-event s3-1 'play-speech "agnt093") + ) + ((= v0-13 2) + (send-event s3-1 'play-speech "agnt094") + ) + ((= v0-13 3) + (send-event s3-1 'play-speech "agnt095") + ) ) ) - ((= v1-20 3) - (let ((v0-18 (rand-vu-int-count 3))) - (cond - ((zero? v0-18) - (send-event s3-1 'play-speech "agnt100") - ) - ((= v0-18 1) - (send-event s3-1 'play-speech "agnt101") - ) - ((= v0-18 2) - (send-event s3-1 'play-speech "agnt102") - ) - ) + ) + ((= v1-20 3) + (let ((v0-18 (rand-vu-int-count 3))) + (cond + ((zero? v0-18) + (send-event s3-1 'play-speech "agnt100") + ) + ((= v0-18 1) + (send-event s3-1 'play-speech "agnt101") + ) + ((= v0-18 2) + (send-event s3-1 'play-speech "agnt102") + ) ) ) - ((= v1-20 4) - (let ((v0-22 (rand-vu-int-count 3))) - (cond - ((zero? v0-22) - (send-event s3-1 'play-speech "agnt115") - ) - ((= v0-22 1) - (send-event s3-1 'play-speech "agnt121") - ) - ((= v0-22 2) - (send-event s3-1 'play-speech "agnt122") - ) - ) + ) + ((= v1-20 4) + (let ((v0-22 (rand-vu-int-count 3))) + (cond + ((zero? v0-22) + (send-event s3-1 'play-speech "agnt115") + ) + ((= v0-22 1) + (send-event s3-1 'play-speech "agnt121") + ) + ((= v0-22 2) + (send-event s3-1 'play-speech "agnt122") + ) ) ) - ((= v1-20 5) - (let ((v0-26 (rand-vu-int-count 3))) - (cond - ((zero? v0-26) - (send-event s3-1 'play-speech "agnt119") - ) - ((= v0-26 1) - (send-event s3-1 'play-speech "agnt120") - ) - ((= v0-26 2) - (send-event s3-1 'play-speech "agnt125") - ) - ) + ) + ((= v1-20 5) + (let ((v0-26 (rand-vu-int-count 3))) + (cond + ((zero? v0-26) + (send-event s3-1 'play-speech "agnt119") + ) + ((= v0-26 1) + (send-event s3-1 'play-speech "agnt120") + ) + ((= v0-26 2) + (send-event s3-1 'play-speech "agnt125") + ) ) ) - ((= v1-20 6) - (let ((v0-30 (rand-vu-int-count 5))) - (cond - ((zero? v0-30) - (send-event s3-1 'play-speech "agnt131") - ) - ((= v0-30 1) - (send-event s3-1 'play-speech "agnt132") - ) - ((= v0-30 2) - (send-event s3-1 'play-speech "agnt133") - ) - ((= v0-30 3) - (send-event s3-1 'play-speech "agnt126") - ) - ((= v0-30 4) - (send-event s3-1 'play-speech "agnt127") - ) - ) + ) + ((= v1-20 6) + (let ((v0-30 (rand-vu-int-count 5))) + (cond + ((zero? v0-30) + (send-event s3-1 'play-speech "agnt131") + ) + ((= v0-30 1) + (send-event s3-1 'play-speech "agnt132") + ) + ((= v0-30 2) + (send-event s3-1 'play-speech "agnt133") + ) + ((= v0-30 3) + (send-event s3-1 'play-speech "agnt126") + ) + ((= v0-30 4) + (send-event s3-1 'play-speech "agnt127") + ) ) ) - ((= v1-20 7) - (let ((v0-36 (rand-vu-int-count 2))) - (cond - ((zero? v0-36) - (send-event s3-1 'play-speech "agnt135") - ) - ((= v0-36 1) - (send-event s3-1 'play-speech "agnt130") - ) - ) + ) + ((= v1-20 7) + (let ((v0-36 (rand-vu-int-count 2))) + (cond + ((zero? v0-36) + (send-event s3-1 'play-speech "agnt135") + ) + ((= v0-36 1) + (send-event s3-1 'play-speech "agnt130") + ) ) ) - ) + ) ) - (+! (-> arg0 data-int32 10) 1) ) + (+! (-> arg0 data-int32 10) 1) ) ) - (let ((s3-2 (-> arg0 sub-state))) - (cond - ((>= s3-2 (the-as uint (-> arg0 count))) - (go (method-of-object arg0 complete)) - ) - ((not (logtest? s3-2 1)) - (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 - ) - ) - ) - (cond - (s4-1 - (when (focus-test? (the-as citizen-rebel s2-0) inactive) - (let ((s1-1 (new 'stack 'traffic-object-spawn-params))) - (set! (-> s1-1 object-type) (traffic-type tt5)) - (set! (-> s1-1 behavior) (the-as uint 7)) - (set! (-> s1-1 id) (the-as uint 0)) - (set! (-> s1-1 nav-mesh) #f) - (set! (-> s1-1 nav-branch) #f) - (set! (-> s1-1 proc) #f) - (set! (-> s1-1 handle) (-> arg0 slave s3-2)) - (set! (-> s1-1 user-data) (the-as uint 0)) - (set! (-> s1-1 flags) (traffic-spawn-flags)) - (set! (-> s1-1 guard-type) (the-as uint 7)) - (vector-reset! (-> s1-1 velocity)) - (set! (-> s1-1 position quad) (-> (the-as citizen-rebel s2-0) root-override2 trans quad)) - (quaternion-copy! (-> s1-1 rotation) (-> (the-as citizen-rebel s2-0) root-override2 quat)) - (set! (-> s1-1 nav-mesh) (-> s4-1 nav-mesh)) - (activate-by-handle *traffic-engine* s1-1) - ) + ) + (let ((s3-2 (-> arg0 sub-state))) + (cond + ((>= s3-2 (the-as uint (-> arg0 count))) + (go (method-of-object arg0 complete)) + ) + ((not (logtest? s3-2 1)) + (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 + ) + ) + ) + (cond + (s4-1 + (when (focus-test? (the-as citizen-rebel s2-0) inactive) + (let ((s1-1 (new 'stack 'traffic-object-spawn-params))) + (set! (-> s1-1 object-type) (traffic-type tt5)) + (set! (-> s1-1 behavior) (the-as uint 7)) + (set! (-> s1-1 id) (the-as uint 0)) + (set! (-> s1-1 nav-mesh) #f) + (set! (-> s1-1 nav-branch) #f) + (set! (-> s1-1 proc) #f) + (set! (-> s1-1 handle) (-> arg0 slave s3-2)) + (set! (-> s1-1 user-data) (the-as uint 0)) + (set! (-> s1-1 flags) (traffic-spawn-flags)) + (set! (-> s1-1 guard-type) (the-as uint 7)) + (vector-reset! (-> s1-1 velocity)) + (set! (-> s1-1 position quad) (-> (the-as citizen-rebel s2-0) root-override2 trans quad)) + (quaternion-copy! (-> s1-1 rotation) (-> (the-as citizen-rebel s2-0) root-override2 quat)) + (set! (-> s1-1 nav-mesh) (-> s4-1 nav-mesh)) + (activate-by-handle *traffic-engine* s1-1) ) - (let ((v1-230 *target*)) - (when (and v1-230 (focus-test? v1-230 pilot)) - (let ((s4-2 (handle->process (-> v1-230 pilot vehicle)))) - (when s4-2 - (cond - ((and (focus-test? (the-as citizen-rebel s2-0) pilot) - (handle->process (-> (the-as citizen-rebel s2-0) vehicle)) - ) - (send-event (handle->process (-> arg0 arrow)) 'set-position (-> arg1 (+ s3-2 1) pos)) - (+! (-> arg0 sub-state) 1) - (set! (-> arg0 time-limit) (+ (-> arg1 s3-2 time) (-> arg1 (+ s3-2 1) time))) - ) - (else - (let ((v1-260 (get-best-seat-for-vehicle - (the-as vehicle s4-2) - (-> (the-as vehicle s4-2) root-override-2 trans) - (the-as int (-> (the-as citizen-rebel s2-0) info seat-flag)) - 1 - ) + ) + (let ((v1-230 *target*)) + (when (and v1-230 (focus-test? v1-230 pilot)) + (let ((s4-2 (handle->process (-> v1-230 pilot vehicle)))) + (when s4-2 + (cond + ((and (focus-test? (the-as citizen-rebel s2-0) pilot) + (handle->process (-> (the-as citizen-rebel s2-0) vehicle)) + ) + (send-event (handle->process (-> arg0 arrow)) 'set-position (-> arg1 (+ s3-2 1) pos)) + (+! (-> arg0 sub-state) 1) + (set! (-> arg0 time-limit) (+ (-> arg1 s3-2 time) (-> arg1 (+ s3-2 1) time))) + ) + (else + (let ((v1-260 (get-best-seat-for-vehicle + (the-as vehicle s4-2) + (-> (the-as vehicle s4-2) root-override-2 trans) + (the-as int (-> (the-as citizen-rebel s2-0) info seat-flag)) + 1 ) - ) - (when (!= v1-260 -1) - (.lvf vf1 (&-> (-> (the-as vehicle s4-2) root-override-2 transv) quad)) - (.add.w.vf vf2 vf0 vf0 :mask #b1) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf acc vf2 vf1 :mask #b1) - (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) - (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) - (.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-override-2 trans) - (-> (the-as citizen-rebel s2-0) root-override2 trans) - ) + ) + ) + (when (!= v1-260 -1) + (.lvf vf1 (&-> (-> (the-as vehicle s4-2) root-override-2 transv) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.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-override-2 trans) + (-> (the-as citizen-rebel s2-0) root-override2 trans) ) - (f1-4 65536.0) - ) - (< f0-2 (* f1-4 f1-4)) - ) - ) - (send-event s2-0 'board-vehicle s4-2) - ) - ) + ) + (f1-4 65536.0) + ) + (< f0-2 (* f1-4 f1-4)) + ) + ) + (send-event s2-0 'board-vehicle s4-2) + ) ) ) ) @@ -1385,66 +1383,66 @@ ) ) ) - (else - (if (not (focus-test? (the-as citizen-rebel s2-0) inactive)) - (send-event s2-0 'traffic-off-force) - ) - ) ) - ) - (if (and (-> s2-0 next-state) (= (-> s2-0 next-state name) 'wait-for-ride)) - (send-event - (handle->process (-> arg0 arrow)) - 'set-position - (-> (the-as citizen-rebel s2-0) root-override2 trans) - ) - ) - ) - (else - (when (zero? (-> arg0 data-int32 s3-2)) - (send-event (handle->process (-> arg0 arrow)) 'set-position (-> arg1 s3-2 pos)) - (set! (-> arg0 time-limit) (-> arg1 s3-2 time)) - (set! (-> arg0 start-time) (-> pp clock frame-counter)) - (set! (-> arg0 data-int32 s3-2) 1) - ) - (let ((s1-2 (find-nearest-nav-mesh (-> arg1 s3-2 pos) (the-as float #x7f800000)))) - (when (and s1-2 (nonzero? s1-2)) - (let ((s2-1 (new 'stack 'traffic-object-spawn-params))) - (set! (-> s2-1 object-type) (traffic-type tt5)) - (set! (-> s2-1 behavior) (the-as uint 7)) - (set! (-> s2-1 id) (the-as uint 0)) - (set! (-> s2-1 nav-mesh) #f) - (set! (-> s2-1 nav-branch) #f) - (set! (-> s2-1 proc) #f) - (set! (-> s2-1 handle) (the-as handle #f)) - (set! (-> s2-1 user-data) (the-as uint 0)) - (set! (-> s2-1 flags) (traffic-spawn-flags)) - (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) - ) + (else + (if (not (focus-test? (the-as citizen-rebel s2-0) inactive)) + (send-event s2-0 'traffic-off-force) ) - (logior! (-> s2-1 flags) (traffic-spawn-flags trsflags-00)) - (set! (-> s2-1 id) (the-as uint 122)) - (set! (-> s2-1 proc) #f) - (let ((v0-58 (citizen-spawn arg0 citizen-rebel s2-1))) - (cond - (v0-58 - (set! (-> (the-as citizen-rebel v0-58) end-pos quad) (-> arg1 (+ s3-2 1) pos quad)) - (set! (-> arg0 slave s3-2) (process->handle (the-as citizen-rebel v0-58))) - (logior! (-> (the-as citizen-rebel v0-58) flags) (citizen-flag persistent)) - (set! (-> (the-as citizen-rebel v0-58) task-node) arg2) - (set! (-> (the-as citizen-rebel v0-58) nav-mesh-aid) (the-as actor-id (-> s1-2 entity aid))) - (set! (-> (the-as citizen-rebel v0-58) done?) #f) - (set! (-> (the-as citizen-rebel v0-58) index) s3-2) - (send-event *traffic-manager* 'add-object (-> s2-1 object-type) (the-as citizen-rebel v0-58)) - ) - (else - ) + ) + ) + ) + (if (and (-> s2-0 next-state) (= (-> s2-0 next-state name) 'wait-for-ride)) + (send-event + (handle->process (-> arg0 arrow)) + 'set-position + (-> (the-as citizen-rebel s2-0) root-override2 trans) + ) + ) + ) + (else + (when (zero? (-> arg0 data-int32 s3-2)) + (send-event (handle->process (-> arg0 arrow)) 'set-position (-> arg1 s3-2 pos)) + (set! (-> arg0 time-limit) (-> arg1 s3-2 time)) + (set! (-> arg0 start-time) (current-time)) + (set! (-> arg0 data-int32 s3-2) 1) + ) + (let ((s1-2 (find-nearest-nav-mesh (-> arg1 s3-2 pos) (the-as float #x7f800000)))) + (when (and s1-2 (nonzero? s1-2)) + (let ((s2-1 (new 'stack 'traffic-object-spawn-params))) + (set! (-> s2-1 object-type) (traffic-type tt5)) + (set! (-> s2-1 behavior) (the-as uint 7)) + (set! (-> s2-1 id) (the-as uint 0)) + (set! (-> s2-1 nav-mesh) #f) + (set! (-> s2-1 nav-branch) #f) + (set! (-> s2-1 proc) #f) + (set! (-> s2-1 handle) (the-as handle #f)) + (set! (-> s2-1 user-data) (the-as uint 0)) + (set! (-> s2-1 flags) (traffic-spawn-flags)) + (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) + ) + ) + (logior! (-> s2-1 flags) (traffic-spawn-flags trsflags-00)) + (set! (-> s2-1 id) (the-as uint 122)) + (set! (-> s2-1 proc) #f) + (let ((v0-58 (citizen-spawn arg0 citizen-rebel s2-1))) + (cond + (v0-58 + (set! (-> (the-as citizen-rebel v0-58) end-pos quad) (-> arg1 (+ s3-2 1) pos quad)) + (set! (-> arg0 slave s3-2) (process->handle (the-as citizen-rebel v0-58))) + (logior! (-> (the-as citizen-rebel v0-58) flags) (citizen-flag persistent)) + (set! (-> (the-as citizen-rebel v0-58) task-node) arg2) + (set! (-> (the-as citizen-rebel v0-58) nav-mesh-aid) (the-as actor-id (-> s1-2 entity aid))) + (set! (-> (the-as citizen-rebel v0-58) done?) #f) + (set! (-> (the-as citizen-rebel v0-58) index) s3-2) + (send-event *traffic-manager* 'add-object (-> s2-1 object-type) (the-as citizen-rebel v0-58)) + ) + (else ) ) ) @@ -1454,57 +1452,57 @@ ) ) ) - (else - (let ((s4-3 (handle->process (-> arg0 slave (+ s3-2 -1))))) - (if (not s4-3) - (go (method-of-object arg0 fail)) - ) - (if (or (not *target*) (not (logtest? (focus-status pilot) (-> *target* focus-status)))) - (send-event s4-3 'exit-vehicle (-> (the-as process-drawable s4-3) root trans)) - ) - (when (-> *target* pilot) - (let ((s5-1 (-> arg1 s3-2 pos)) - (s2-2 (handle->process (-> *target* pilot vehicle))) - ) - (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)) - ) - (begin - (.lvf vf1 (&-> (-> (the-as process-drawable s2-2) root transv) quad)) - (.add.w.vf vf2 vf0 vf0 :mask #b1) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf acc vf2 vf1 :mask #b1) - (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) - (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) - (.mov v1-377 vf1) - (let ((f0-4 v1-377) - (f1-10 12288.0) - ) - (< f0-4 (* f1-10 f1-10)) + ) + (else + (let ((s4-3 (handle->process (-> arg0 slave (+ s3-2 -1))))) + (if (not s4-3) + (go (method-of-object arg0 fail)) + ) + (if (or (not *target*) (not (logtest? (focus-status pilot) (-> *target* focus-status)))) + (send-event s4-3 'exit-vehicle (-> (the-as process-drawable s4-3) root trans)) + ) + (when (-> *target* pilot) + (let ((s5-1 (-> arg1 s3-2 pos)) + (s2-2 (handle->process (-> *target* pilot vehicle))) + ) + (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)) + ) + (begin + (.lvf vf1 (&-> (-> (the-as process-drawable s2-2) root transv) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-377 vf1) + (let ((f0-4 v1-377) + (f1-10 12288.0) + ) + (< f0-4 (* f1-10 f1-10)) ) ) - (send-event s4-3 'exit-vehicle s5-1) - ) - ) - ((not (-> (the-as citizen-rebel s4-3) done?)) - (set! (-> arg0 data-int32 s3-2) 0) - (+! (-> arg0 sub-state) -1) - ) - ) + ) + (send-event s4-3 'exit-vehicle s5-1) + ) + ) + ((not (-> (the-as citizen-rebel s4-3) done?)) + (set! (-> arg0 data-int32 s3-2) 0) + (+! (-> arg0 sub-state) -1) + ) ) ) ) ) ) ) - (none) ) + (none) ) ) @@ -1640,8 +1638,8 @@ (while (zero? (-> self sub-state)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (send-event *traffic-manager* 'set-alert-level 2) @@ -1665,9 +1663,9 @@ TASK_MANAGER_COMPLETE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (talker-spawn-func (-> *talker-speech* 97) *entity-pool* (target-pos 0) (the-as region #f)) - (let ((gp-1 (-> self clock frame-counter))) + (let ((gp-1 (current-time))) (until #f (let ((v1-4 0)) (dotimes (a0-2 4) @@ -1677,7 +1675,7 @@ ) ) ) - (if (or (>= v1-4 4) (>= (- (-> self clock frame-counter) gp-1) (seconds 10))) + (if (or (>= v1-4 4) (>= (- (current-time) gp-1) (seconds 10))) (goto cfg-23) ) ) @@ -1824,8 +1822,8 @@ (while (zero? (-> self sub-state)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (send-event *traffic-manager* 'set-alert-level 2) @@ -1849,7 +1847,7 @@ TASK_MANAGER_COMPLETE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (let ((v1-2 0)) (dotimes (a0-0 4) diff --git a/test/decompiler/reference/jak2/decompiler-macros.gc b/test/decompiler/reference/jak2/decompiler-macros.gc index 04416687eb..15fcbff348 100644 --- a/test/decompiler/reference/jak2/decompiler-macros.gc +++ b/test/decompiler/reference/jak2/decompiler-macros.gc @@ -1556,7 +1556,9 @@ (defmacro focus-test? (pfoc &rest status) `(logtest? (-> (the process-focusable ,pfoc) focus-status) (focus-status ,@status))) - +(defmacro current-time () + `(-> PP clock frame-counter) + ) (defconstant TASK_MANAGER_INIT_HOOK 0) (defconstant TASK_MANAGER_CLEANUP_HOOK 1) diff --git a/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc b/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc index e354e13989..b6261a7425 100644 --- a/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc +++ b/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc @@ -310,77 +310,73 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (with-pp - (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (-> pp clock frame-counter)) - ) - (enemy-method-129 self) - (if (logtest? (enemy-flag use-trigger) (-> self enemy-flags)) - (enemy-method-100 self) - ) - (when *target* - (if *target* - (look-at! - (-> *target* neck) - (the-as vector (-> self root-override2 root-prim prim-core)) - (if (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance)) - 'attacking - ) - self - ) - ) + (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) + (set! (-> self last-draw-time) (current-time)) ) - (when (nonzero? (-> self neck)) - (when (logtest? (-> self enemy-flags) (enemy-flag lock-focus)) - (let ((a0-9 (handle->process (-> self focus handle)))) - (if a0-9 - (target-set! (-> self neck) (get-trans (the-as process-focusable a0-9) 2)) + (enemy-method-129 self) + (if (logtest? (enemy-flag use-trigger) (-> self enemy-flags)) + (enemy-method-100 self) + ) + (when *target* + (if *target* + (look-at! + (-> *target* neck) + (the-as vector (-> self root-override2 root-prim prim-core)) + (if (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance)) + 'attacking ) + self ) ) - ) - (when (and (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) - (>= (- (-> pp clock frame-counter) (-> self auto-reset-penetrate-time)) (seconds 0.1)) - ) - (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) - (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) - (let ((v1-48 0)) - (if (logtest? (penetrate knocked) (-> self root-override2 penetrate-using)) - (set! v1-48 (logior (shl 1 32) v1-48)) - ) - (set! (-> self root-override2 penetrate-using) (the-as penetrate v1-48)) - ) - ) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (enemy-method-136 self) - ) - (if (logtest? (enemy-flag trackable-backup directed-ready) (-> self enemy-flags)) - (enemy-method-54 self) - ) - (if (and *debug-segment* (-> self enemy-info debug-draw-neck) (nonzero? (-> self neck))) - (joint-mod-debug-draw (-> self neck)) - ) - (ja-post) - 0 - (none) ) + (when (nonzero? (-> self neck)) + (when (logtest? (-> self enemy-flags) (enemy-flag lock-focus)) + (let ((a0-9 (handle->process (-> self focus handle)))) + (if a0-9 + (target-set! (-> self neck) (get-trans (the-as process-focusable a0-9) 2)) + ) + ) + ) + ) + (when (and (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) + (>= (- (current-time) (-> self auto-reset-penetrate-time)) (seconds 0.1)) + ) + (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) + (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) + (let ((v1-48 0)) + (if (logtest? (penetrate knocked) (-> self root-override2 penetrate-using)) + (set! v1-48 (logior (shl 1 32) v1-48)) + ) + (set! (-> self root-override2 penetrate-using) (the-as penetrate v1-48)) + ) + ) + (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (enemy-method-136 self) + ) + (if (logtest? (enemy-flag trackable-backup directed-ready) (-> self enemy-flags)) + (enemy-method-54 self) + ) + (if (and *debug-segment* (-> self enemy-info debug-draw-neck) (nonzero? (-> self neck))) + (joint-mod-debug-draw (-> self neck)) + ) + (ja-post) + 0 + (none) ) ;; definition for method 136 of type enemy (defmethod enemy-method-136 enemy ((obj enemy)) - (with-pp - (when (or (>= (- (-> pp clock frame-counter) (-> obj hit-focus-time)) (seconds 2)) - (and (handle->process (-> obj focus handle)) - (not (logtest? (-> (the-as process-focusable (handle->process (-> obj focus handle))) focus-status) - (focus-status disable dead ignore grabbed) - ) - ) - ) - ) - (let ((v0-0 (logclear (-> obj enemy-flags) (enemy-flag look-at-focus)))) - (set! (-> obj enemy-flags) v0-0) - v0-0 - ) + (when (or (>= (- (current-time) (-> obj hit-focus-time)) (seconds 2)) + (and (handle->process (-> obj focus handle)) + (not (logtest? (-> (the-as process-focusable (handle->process (-> obj focus handle))) focus-status) + (focus-status disable dead ignore grabbed) + ) + ) + ) + ) + (let ((v0-0 (logclear (-> obj enemy-flags) (enemy-flag look-at-focus)))) + (set! (-> obj enemy-flags) v0-0) + v0-0 ) ) ) @@ -703,28 +699,26 @@ ;; definition for method 105 of type enemy (defmethod enemy-method-105 enemy ((obj enemy) (arg0 process)) - (with-pp - (when (logtest? (process-mask target bot) (-> arg0 mask)) - (set! (-> obj root-override2 penetrated-by) (the-as penetrate -1)) - (enemy-method-49 obj) - ) - (let ((s5-0 (if (type? arg0 process-focusable) - arg0 - ) - ) - ) - (when (enemy-method-53 obj (the-as process-focusable s5-0)) - (let ((v1-10 (handle->process (-> obj focus handle)))) - (when (or (= s5-0 v1-10) (and (not (logtest? (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (or (not v1-10) (not (logtest? (-> obj focus flags) (enemy-flag lock-focus)))) - ) - ) - (enemy-method-63 obj (the-as process-focusable s5-0) (the-as enemy-aware #f)) - (set! (-> obj hit-focus-time) (-> pp clock frame-counter)) - (let ((v0-3 (logior (-> obj enemy-flags) (enemy-flag look-at-focus)))) - (set! (-> obj enemy-flags) v0-3) - v0-3 + (when (logtest? (process-mask target bot) (-> arg0 mask)) + (set! (-> obj root-override2 penetrated-by) (the-as penetrate -1)) + (enemy-method-49 obj) + ) + (let ((s5-0 (if (type? arg0 process-focusable) + arg0 + ) ) + ) + (when (enemy-method-53 obj (the-as process-focusable s5-0)) + (let ((v1-10 (handle->process (-> obj focus handle)))) + (when (or (= s5-0 v1-10) (and (not (logtest? (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (or (not v1-10) (not (logtest? (-> obj focus flags) (enemy-flag lock-focus)))) + ) + ) + (enemy-method-63 obj (the-as process-focusable s5-0) (the-as enemy-aware #f)) + (set! (-> obj hit-focus-time) (current-time)) + (let ((v0-3 (logior (-> obj enemy-flags) (enemy-flag look-at-focus)))) + (set! (-> obj enemy-flags) v0-3) + v0-3 ) ) ) @@ -735,7 +729,7 @@ ;; definition for method 49 of type enemy (defmethod enemy-method-49 enemy ((obj enemy)) (logior! (-> obj enemy-flags) (enemy-flag attackable-backup)) - (let ((v0-0 (-> self clock frame-counter))) + (let ((v0-0 (current-time))) (set! (-> obj auto-reset-penetrate-time) v0-0) v0-0 ) @@ -800,13 +794,13 @@ ) ) (set! (-> obj incoming knocked-type) (the-as knocked-type v1-3)) - (let ((a0-4 (-> self clock frame-counter))) + (let ((a0-4 (current-time))) (cond ((!= v1-3 6) (set! (-> obj incoming blue-juggle-count) (the-as uint 0)) 0 ) - ((>= (- (-> self clock frame-counter) (-> obj incoming attack-time)) (seconds 1)) + ((>= (- (current-time) (-> obj incoming attack-time)) (seconds 1)) (set! (-> obj incoming blue-juggle-count) (the-as uint 1)) ) (else @@ -1676,10 +1670,10 @@ This commonly includes things such as: (v1-1 (when (not (logtest? (-> obj enemy-flags) (enemy-flag spawn-gem))) (logior! (-> obj enemy-flags) (enemy-flag spawn-gem)) - (set! (-> obj notice-time) (-> self clock frame-counter)) + (set! (-> obj notice-time) (current-time)) ) (if (and (not (logtest? (-> obj enemy-flags) (enemy-flag chase-startup))) - (< (- (-> self clock frame-counter) (-> obj notice-time)) (-> obj reaction-time)) + (< (- (current-time) (-> obj notice-time)) (-> obj reaction-time)) ) (set! v1-1 #f) ) @@ -1692,7 +1686,7 @@ This commonly includes things such as: (v1-1 arg0 ) - ((or (zero? arg0) (>= (- (-> self clock frame-counter) (-> obj last-draw-time)) (seconds 2))) + ((or (zero? arg0) (>= (- (current-time) (-> obj last-draw-time)) (seconds 2))) 0 ) (else @@ -1732,350 +1726,348 @@ This commonly includes things such as: "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)) - (with-pp - (the-as - object - (cond - ((= arg2 'track) - (and (nonzero? (-> obj hit-points)) - (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) - (logtest? (enemy-flag check-water-backup) (-> obj enemy-flags)) - ) - ) - ((= arg2 'combo) - (and (not (logtest? (enemy-flag multi-focus) (-> obj enemy-flags))) (nonzero? (-> obj hit-points))) - ) - ((= arg2 'touch) - (enemy-method-75 obj arg0 arg3) - ) - ((= arg2 'touched) - (when (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup)) - (let* ((s3-1 arg0) - (v1-20 (if (type? s3-1 process-drawable) - (the-as process-drawable s3-1) - ) - ) - ) - (when v1-20 - (let* ((s3-2 (-> v1-20 root)) - (a1-4 (if (type? s3-2 collide-shape) - s3-2 - ) - ) - (s3-3 (-> arg3 param 0)) - ) - (if (and a1-4 - s3-3 - ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s3-3) - (the-as collide-shape a1-4) - (collide-action solid) - (collide-action) - ) - ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry s3-3) - (-> obj root-override2) - (collide-action solid) - (collide-action) + (the-as + object + (cond + ((= arg2 'track) + (and (nonzero? (-> obj hit-points)) + (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) + (logtest? (enemy-flag check-water-backup) (-> obj enemy-flags)) + ) + ) + ((= arg2 'combo) + (and (not (logtest? (enemy-flag multi-focus) (-> obj enemy-flags))) (nonzero? (-> obj hit-points))) + ) + ((= arg2 'touch) + (enemy-method-75 obj arg0 arg3) + ) + ((= arg2 'touched) + (when (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup)) + (let* ((s3-1 arg0) + (v1-20 (if (type? s3-1 process-drawable) + (the-as process-drawable s3-1) ) + ) + ) + (when v1-20 + (let* ((s3-2 (-> v1-20 root)) + (a1-4 (if (type? s3-2 collide-shape) + s3-2 + ) ) - (set! (-> obj auto-reset-penetrate-time) (-> pp clock frame-counter)) - ) - ) + (s3-3 (-> arg3 param 0)) + ) + (if (and a1-4 + s3-3 + ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s3-3) + (the-as collide-shape a1-4) + (collide-action solid) + (collide-action) + ) + ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s3-3) + (-> obj root-override2) + (collide-action solid) + (collide-action) + ) + ) + (set! (-> obj auto-reset-penetrate-time) (current-time)) + ) ) ) ) - (enemy-method-76 obj arg0 arg3) ) - ((= arg2 'attack-invinc) - (case (-> (the-as attack-info (-> arg3 param 1)) mode) - (('endlessfall) - (let ((v1-31 (-> obj root-override2 root-prim))) - (set! (-> v1-31 prim-core collide-as) (collide-spec)) - (set! (-> v1-31 prim-core collide-with) (collide-spec)) + (enemy-method-76 obj arg0 arg3) + ) + ((= arg2 'attack-invinc) + (case (-> (the-as attack-info (-> arg3 param 1)) mode) + (('endlessfall) + (let ((v1-31 (-> obj root-override2 root-prim))) + (set! (-> v1-31 prim-core collide-as) (collide-spec)) + (set! (-> v1-31 prim-core collide-with) (collide-spec)) + ) + 0 + (kill-prefer-falling obj) + ) + ) + ) + ((= arg2 'attack) + (let ((s2-0 (the-as object (-> arg3 param 1)))) + (when (!= (-> (the-as attack-info s2-0) id) (-> obj incoming attack-id)) + (cond + ((and (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) + (not (logtest? (-> obj focus-status) (focus-status grabbed))) + ) + (let* ((s1-0 obj) + (s0-0 (method-of-object s1-0 enemy-method-106)) + ) + (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 (the-as int a3-3) (the-as attack-info s2-0)) + ) + ) + (send-event (ppointer->process (-> obj parent)) 'child-hit) + 0 + (if (not *debug-unkillable*) + (enemy-method-48 obj arg0 arg3) + ) + (let ((s2-1 (the-as attack-info (enemy-method-58 obj arg0 arg3)))) + (when s2-1 + (logclear! (-> obj enemy-flags) (enemy-flag called-dying)) + (enemy-method-108 obj (the-as enemy arg0) arg3) + (let ((a1-13 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-13 from) (process->ppointer arg0)) + (set! (-> a1-13 num-params) arg1) + (set! (-> a1-13 message) (the-as symbol s2-1)) + (set! (-> a1-13 param 0) (-> arg3 param 0)) + (set! (-> a1-13 param 1) (-> arg3 param 1)) + (set! (-> a1-13 param 2) (-> arg3 param 2)) + (set! (-> a1-13 param 3) (-> arg3 param 3)) + (set! (-> a1-13 param 4) (-> arg3 param 4)) + (set! (-> a1-13 param 5) (-> arg3 param 5)) + (send-event-function obj a1-13) + ) + ) + ) ) + (else + (set! (-> obj incoming attack-id) (-> (the-as attack-info s2-0) id)) + (enemy-method-75 obj arg0 arg3) + ) + ) + ) + ) + ) + ((= arg2 'hit-flinch) + (when (zero? (-> obj hit-points)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) + ) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (process-contact-action arg0) + (send-event arg0 'get-attack-count 1) + (kill-prefer-falling obj) + ) + #t + ) + ((= arg2 'hit-knocked) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) + ) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (process-contact-action arg0) + (send-event arg0 'get-attack-count 1) + (when (zero? (-> obj hit-points)) + (case (-> obj incoming knocked-type) + (((knocked-type knocked-type-4) (knocked-type knocked-type-6)) + (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) 0 - (kill-prefer-falling obj) ) ) ) - ((= arg2 'attack) - (let ((s2-0 (the-as object (-> arg3 param 1)))) - (when (!= (-> (the-as attack-info s2-0) id) (-> obj incoming attack-id)) - (cond - ((and (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) - (not (logtest? (-> obj focus-status) (focus-status grabbed))) - ) - (let* ((s1-0 obj) - (s0-0 (method-of-object s1-0 enemy-method-106)) - ) - (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 (the-as int a3-3) (the-as attack-info s2-0)) - ) - ) - (send-event (ppointer->process (-> obj parent)) 'child-hit) - 0 - (if (not *debug-unkillable*) - (enemy-method-48 obj arg0 arg3) - ) - (let ((s2-1 (the-as attack-info (enemy-method-58 obj arg0 arg3)))) - (when s2-1 - (logclear! (-> obj enemy-flags) (enemy-flag called-dying)) - (enemy-method-108 obj (the-as enemy arg0) arg3) - (let ((a1-13 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-13 from) (process->ppointer arg0)) - (set! (-> a1-13 num-params) arg1) - (set! (-> a1-13 message) (the-as symbol s2-1)) - (set! (-> a1-13 param 0) (-> arg3 param 0)) - (set! (-> a1-13 param 1) (-> arg3 param 1)) - (set! (-> a1-13 param 2) (-> arg3 param 2)) - (set! (-> a1-13 param 3) (-> arg3 param 3)) - (set! (-> a1-13 param 4) (-> arg3 param 4)) - (set! (-> a1-13 param 5) (-> arg3 param 5)) - (send-event-function obj a1-13) - ) - ) - ) - ) - (else - (set! (-> obj incoming attack-id) (-> (the-as attack-info s2-0) id)) - (enemy-method-75 obj arg0 arg3) - ) - ) - ) + (go (method-of-object obj knocked)) + ) + ((= arg2 'hit) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) ) - ) - ((= arg2 'hit-flinch) - (when (zero? (-> obj hit-points)) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) - (logior! (-> obj focus-status) (focus-status hit)) - (if (zero? (-> obj hit-points)) - (logior! (-> obj focus-status) (focus-status dead)) - ) - (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) - (enemy-method-62 obj) - (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (process-contact-action arg0) - (send-event arg0 'get-attack-count 1) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (process-contact-action arg0) + (send-event arg0 'get-attack-count 1) + (if (zero? (-> obj hit-points)) (kill-prefer-falling obj) + (go (method-of-object obj hit)) ) - #t - ) - ((= arg2 'hit-knocked) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) - (logior! (-> obj focus-status) (focus-status hit)) - (if (zero? (-> obj hit-points)) - (logior! (-> obj focus-status) (focus-status dead)) - ) - (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) - (enemy-method-62 obj) - (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (process-contact-action arg0) - (send-event arg0 'get-attack-count 1) - (when (zero? (-> obj hit-points)) - (case (-> obj incoming knocked-type) - (((knocked-type knocked-type-4) (knocked-type knocked-type-6)) - (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) - 0 - ) - ) - ) - (go (method-of-object obj knocked)) - ) - ((= arg2 'hit) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) - (logior! (-> obj focus-status) (focus-status hit)) - (if (zero? (-> obj hit-points)) - (logior! (-> obj focus-status) (focus-status dead)) - ) - (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) - (enemy-method-62 obj) - (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (process-contact-action arg0) - (send-event arg0 'get-attack-count 1) - (if (zero? (-> obj hit-points)) - (kill-prefer-falling obj) - (go (method-of-object obj hit)) - ) - ) - ((= arg2 'cue-chase) - (when (and (> (-> obj hit-points) 0) - (zero? (-> obj fated-time)) - (not (logtest? (-> obj focus-status) (focus-status grabbed))) - ) - (let ((v1-162 (logtest? (enemy-flag alert) (-> obj enemy-flags)))) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) - (set! (-> obj enemy-flags) (logior (enemy-flag dangerous-backup) (-> obj enemy-flags))) - (logclear! (-> obj mask) (process-mask actor-pause)) - (cond - (v1-162 - (if (logtest? (enemy-option ambush) (-> obj fact-info-override enemy-options)) - (go-ambush obj) - (go-hostile obj) - ) - ) - ((and (-> obj next-state) (let ((v1-173 (-> obj next-state name))) - (or (= v1-173 'dormant) (= v1-173 'dormant-aware)) - ) - ) - (if (logtest? (enemy-option ambush) (-> obj fact-info-override enemy-options)) - (go-ambush obj) - (go (method-of-object obj notice)) - ) - ) - ) - ) - #t - ) - ) - ((= arg2 'cue-wake) - (when (and (> (-> obj hit-points) 0) - (zero? (-> obj fated-time)) - (not (logtest? (-> obj focus-status) (focus-status grabbed))) - ) - (logclear! (-> obj enemy-flags) (enemy-flag alert victory called-dying)) - (if (logtest? (enemy-option ambush) (-> obj fact-info-override enemy-options)) - (go-ambush obj) - (react-to-focus obj) - ) - #t - ) - ) - ((= arg2 'jump) - (when (and (> (-> obj hit-points) 0) - (zero? (-> obj fated-time)) - (not (logtest? (-> obj focus-status) (focus-status grabbed))) - ) - (logclear! (-> obj mask) (process-mask actor-pause)) - (set! (-> obj jump-why) (-> arg3 param 0)) - (set! (-> obj event-param-point quad) (-> (the-as vector (-> arg3 param 1)) quad)) - (go (method-of-object obj jump)) - ) - ) - ((= arg2 'death-start) - (set! (-> obj enemy-flags) (the-as enemy-flag (logior (enemy-flag recover) (-> obj enemy-flags)))) - (send-event (ppointer->process (-> obj parent)) 'child-die) - (drop-pickup (-> obj fact-info-override) #t *entity-pool* (-> obj fact-info-override) 0) - (let ((s5-1 (-> obj on-death))) - (if s5-1 - (script-eval (the-as pair s5-1) :vector (-> obj root-override2 trans)) - ) - ) - ) - ((= arg2 'death-end) - (if (-> obj skel effect) - (logior! (-> obj skel effect flags) (effect-control-flag ecf2)) - ) - (logior! (-> obj draw status) (draw-control-status no-draw)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (set! (-> obj enemy-flags) (logclear (-> obj enemy-flags) (enemy-flag check-water))) - ) - ((= arg2 'instant-death) - (when (and (> (-> obj hit-points) 0) (zero? (-> obj fated-time))) - (set! (-> obj hit-points) 0) - (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) - (let ((s5-2 (enemy-method-50 obj (new 'stack-no-clear 'vector)))) - (vector-z-quaternion! s5-2 (-> obj root-override2 quat)) - (vector-float*! s5-2 s5-2 -1.0) - (vector-normalize! s5-2 1.0) - ) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) - (logior! (-> obj focus-status) (focus-status hit)) - (if (zero? (-> obj hit-points)) - (logior! (-> obj focus-status) (focus-status dead)) - ) - (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) - (enemy-method-62 obj) - (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (kill-prefer-falling obj) - ) - ) - ((= arg2 'die-fast) - (logior! (-> obj draw status) (draw-control-status no-draw)) - (dispose! obj) - (send-event (ppointer->process (-> obj parent)) 'child-die) - (let ((s5-3 (-> obj on-death))) - (if s5-3 - (script-eval (the-as pair s5-3) :vector (-> obj root-override2 trans)) - ) - ) - (cleanup-for-death obj) - (go (method-of-object obj die-fast)) - ) - ((= arg2 'victory) - (if (and (-> obj enemy-info use-victory) - (not (and (-> obj next-state) (= (-> obj next-state name) 'victory))) - (> (-> obj hit-points) 0) + ) + ((= arg2 'cue-chase) + (when (and (> (-> obj hit-points) 0) (zero? (-> obj fated-time)) (not (logtest? (-> obj focus-status) (focus-status grabbed))) ) - (go (method-of-object obj victory)) - ) - ) - ((= arg2 'nav-control) - (if (nonzero? (-> obj nav)) - (-> obj nav) - ) - ) - ((= arg2 'push-trans) - (move-by-vector! (-> obj root-override2) (the-as vector (-> arg3 param 0))) - ) - ((= arg2 'move-trans) - (move-to-point! (-> obj root-override2) (the-as vector (-> arg3 param 0))) - ) - ((= arg2 'shadow) - (cond - ((-> arg3 param 0) - (let ((v1-320 (-> obj draw shadow-ctrl))) - (logclear! (-> v1-320 settings flags) (shadow-flags disable-draw)) - ) - 0 - ) - (else - (let ((v1-323 (-> obj draw shadow-ctrl))) - (logior! (-> v1-323 settings flags) (shadow-flags disable-draw)) + (let ((v1-162 (logtest? (enemy-flag alert) (-> obj enemy-flags)))) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) + (set! (-> obj enemy-flags) (logior (enemy-flag dangerous-backup) (-> obj enemy-flags))) + (logclear! (-> obj mask) (process-mask actor-pause)) + (cond + (v1-162 + (if (logtest? (enemy-option ambush) (-> obj fact-info-override enemy-options)) + (go-ambush obj) + (go-hostile obj) + ) ) - 0 + ((and (-> obj next-state) (let ((v1-173 (-> obj next-state name))) + (or (= v1-173 'dormant) (= v1-173 'dormant-aware)) + ) + ) + (if (logtest? (enemy-option ambush) (-> obj fact-info-override enemy-options)) + (go-ambush obj) + (go (method-of-object obj notice)) + ) + ) ) ) + #t ) - ((= arg2 'color-effect) - (case (-> arg3 param 0) - (('dark) - (let ((f30-0 (rand-vu-float-range 0.2 1.0))) - (set-vector! (-> obj draw color-mult) (lerp 1.0 1.0 f30-0) (lerp 1.0 0.0 f30-0) (lerp 1.0 1.0 f30-0) 1.0) - (set! s5-5 (-> obj draw color-emissive)) - (set! (-> s5-5 x) (lerp 0.0 0.3 f30-0)) - (set! (-> s5-5 y) (lerp 0.0 0.0 f30-0)) - (set! (-> s5-5 z) (lerp 0.0 0.3 f30-0)) - ) - (set! (-> s5-5 w) 1.0) - s5-5 - ) - ((#f) - (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) - (set! s5-5 (-> obj draw color-emissive)) - (set! (-> s5-5 quad) (the-as uint128 0)) - s5-5 + ) + ((= arg2 'cue-wake) + (when (and (> (-> obj hit-points) 0) + (zero? (-> obj fated-time)) + (not (logtest? (-> obj focus-status) (focus-status grabbed))) + ) + (logclear! (-> obj enemy-flags) (enemy-flag alert victory called-dying)) + (if (logtest? (enemy-option ambush) (-> obj fact-info-override enemy-options)) + (go-ambush obj) + (react-to-focus obj) + ) + #t + ) + ) + ((= arg2 'jump) + (when (and (> (-> obj hit-points) 0) + (zero? (-> obj fated-time)) + (not (logtest? (-> obj focus-status) (focus-status grabbed))) + ) + (logclear! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj jump-why) (-> arg3 param 0)) + (set! (-> obj event-param-point quad) (-> (the-as vector (-> arg3 param 1)) quad)) + (go (method-of-object obj jump)) + ) + ) + ((= arg2 'death-start) + (set! (-> obj enemy-flags) (the-as enemy-flag (logior (enemy-flag recover) (-> obj enemy-flags)))) + (send-event (ppointer->process (-> obj parent)) 'child-die) + (drop-pickup (-> obj fact-info-override) #t *entity-pool* (-> obj fact-info-override) 0) + (let ((s5-1 (-> obj on-death))) + (if s5-1 + (script-eval (the-as pair s5-1) :vector (-> obj root-override2 trans)) + ) + ) + ) + ((= arg2 'death-end) + (if (-> obj skel effect) + (logior! (-> obj skel effect flags) (effect-control-flag ecf2)) + ) + (logior! (-> obj draw status) (draw-control-status no-draw)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (set! (-> obj enemy-flags) (logclear (-> obj enemy-flags) (enemy-flag check-water))) + ) + ((= arg2 'instant-death) + (when (and (> (-> obj hit-points) 0) (zero? (-> obj fated-time))) + (set! (-> obj hit-points) 0) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) + (let ((s5-2 (enemy-method-50 obj (new 'stack-no-clear 'vector)))) + (vector-z-quaternion! s5-2 (-> obj root-override2 quat)) + (vector-float*! s5-2 s5-2 -1.0) + (vector-normalize! s5-2 1.0) + ) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) + ) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (kill-prefer-falling obj) + ) + ) + ((= arg2 'die-fast) + (logior! (-> obj draw status) (draw-control-status no-draw)) + (dispose! obj) + (send-event (ppointer->process (-> obj parent)) 'child-die) + (let ((s5-3 (-> obj on-death))) + (if s5-3 + (script-eval (the-as pair s5-3) :vector (-> obj root-override2 trans)) + ) + ) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + ((= arg2 'victory) + (if (and (-> obj enemy-info use-victory) + (not (and (-> obj next-state) (= (-> obj next-state name) 'victory))) + (> (-> obj hit-points) 0) + (zero? (-> obj fated-time)) + (not (logtest? (-> obj focus-status) (focus-status grabbed))) + ) + (go (method-of-object obj victory)) + ) + ) + ((= arg2 'nav-control) + (if (nonzero? (-> obj nav)) + (-> obj nav) + ) + ) + ((= arg2 'push-trans) + (move-by-vector! (-> obj root-override2) (the-as vector (-> arg3 param 0))) + ) + ((= arg2 'move-trans) + (move-to-point! (-> obj root-override2) (the-as vector (-> arg3 param 0))) + ) + ((= arg2 'shadow) + (cond + ((-> arg3 param 0) + (let ((v1-320 (-> obj draw shadow-ctrl))) + (logclear! (-> v1-320 settings flags) (shadow-flags disable-draw)) ) + 0 + ) + (else + (let ((v1-323 (-> obj draw shadow-ctrl))) + (logior! (-> v1-323 settings flags) (shadow-flags disable-draw)) + ) + 0 ) ) - ) + ) + ((= arg2 'color-effect) + (case (-> arg3 param 0) + (('dark) + (let ((f30-0 (rand-vu-float-range 0.2 1.0))) + (set-vector! (-> obj draw color-mult) (lerp 1.0 1.0 f30-0) (lerp 1.0 0.0 f30-0) (lerp 1.0 1.0 f30-0) 1.0) + (set! s5-5 (-> obj draw color-emissive)) + (set! (-> s5-5 x) (lerp 0.0 0.3 f30-0)) + (set! (-> s5-5 y) (lerp 0.0 0.0 f30-0)) + (set! (-> s5-5 z) (lerp 0.0 0.3 f30-0)) + ) + (set! (-> s5-5 w) 1.0) + s5-5 + ) + ((#f) + (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) + (set! s5-5 (-> obj draw color-emissive)) + (set! (-> s5-5 quad) (the-as uint128 0)) + s5-5 + ) + ) + ) ) ) ) @@ -2110,30 +2102,28 @@ This commonly includes things such as: ;; definition for method 48 of type enemy (defmethod enemy-method-48 enemy ((obj enemy) (arg0 process) (arg1 event-message-block)) - (with-pp - (let* ((v1-1 (damage-amount-from-attack obj arg0 arg1)) - (s5-0 (-> obj hit-points)) - (s4-1 (max 0 (- s5-0 v1-1))) - ) - (when (and (zero? s4-1) (nonzero? s5-0) (= (-> obj incoming knocked-type) (knocked-type knocked-type-6))) - (cond - ((zero? (-> obj fated-time)) - (set! (-> obj fated-time) (-> pp clock frame-counter)) - (set! s4-1 1) - ) - (else - (if (< (- (-> pp clock frame-counter) (-> obj fated-time)) (seconds 1)) - (set! s4-1 1) - ) - ) + (let* ((v1-1 (damage-amount-from-attack obj arg0 arg1)) + (s5-0 (-> obj hit-points)) + (s4-1 (max 0 (- s5-0 v1-1))) + ) + (when (and (zero? s4-1) (nonzero? s5-0) (= (-> obj incoming knocked-type) (knocked-type knocked-type-6))) + (cond + ((zero? (-> obj fated-time)) + (set! (-> obj fated-time) (current-time)) + (set! s4-1 1) + ) + (else + (if (< (- (current-time) (-> obj fated-time)) (seconds 1)) + (set! s4-1 1) + ) ) ) - (set! (-> obj hit-points) s4-1) - (if (not (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup))) - (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) - ) - (- s5-0 s4-1) ) + (set! (-> obj hit-points) s4-1) + (if (not (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup))) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) + ) + (- s5-0 s4-1) ) ) @@ -2318,7 +2308,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (stop-looking-at-target! self) (logclear! (-> self enemy-flags) (enemy-flag spawn-gem chase-startup use-notice-distance)) (logior! (-> self enemy-flags) (enemy-flag enable-on-notice)) @@ -2341,7 +2331,7 @@ This commonly includes things such as: (none) ) :trans (behavior () - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (if (and (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (> (the-as int (-> self focus aware)) 0) ) (go-virtual active) @@ -2356,7 +2346,7 @@ This commonly includes things such as: :post (behavior () (idle-control-method-10 (-> self idle-anim-player) self) (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (-> self clock frame-counter)) + (set! (-> self last-draw-time) (current-time)) ) (enemy-method-129 self) (ja-post) @@ -2405,7 +2395,7 @@ This commonly includes things such as: :enter (-> (method-of-type enemy dormant) enter) :exit (-> (method-of-type enemy dormant) exit) :trans (behavior () - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (when (and (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (> (the-as int (-> self focus aware)) 0) ) (if (logtest? (enemy-option ambush) (-> self fact-info-override enemy-options)) @@ -2418,7 +2408,7 @@ This commonly includes things such as: :code (the-as (function none :behavior enemy) sleep-code) :post (behavior () (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (-> self clock frame-counter)) + (set! (-> self last-draw-time) (current-time)) ) (enemy-method-129 self) (none) @@ -2444,7 +2434,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self enemy-flags) (enemy-flag use-notice-distance)) (when (logtest? (-> self enemy-flags) (enemy-flag jump-check-blocked)) (logclear! (-> self enemy-flags) (enemy-flag jump-check-blocked)) @@ -2463,7 +2453,7 @@ This commonly includes things such as: (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((v1-3 (-> self focus aware))) (cond ((< (the-as int v1-3) 1) @@ -2494,7 +2484,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-3 (logior (-> self enemy-flags) (enemy-flag use-notice-distance)))) (set! (-> self enemy-flags) (logclear v1-3 (enemy-flag called-dying))) ) @@ -2560,7 +2550,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (look-at-target! self (enemy-flag lock-focus)) (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) @@ -2580,7 +2570,7 @@ This commonly includes things such as: (go-virtual victory) ) (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (cond ((or (>= 2 (the-as int gp-0)) (not (get-enemy-target self))) (go-stare self) @@ -2614,13 +2604,13 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self mask) (process-mask actor-pause)) (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((gp-0 (-> self focus aware))) (cond ((>= 1 (the-as int gp-0)) @@ -2698,14 +2688,14 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (look-at-target! self (enemy-flag lock-focus)) (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> self mask) (process-mask actor-pause)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (!= (-> self focus aware) (enemy-aware unaware)) (go-stare self) ) @@ -2950,7 +2940,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self mask) (process-mask actor-pause)) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-6 *game-info*) @@ -2997,7 +2987,7 @@ This commonly includes things such as: (let ((s5-1 2)) (logior! (-> self focus-status) (focus-status in-air)) (until (enemy-method-86 self) - (+! (-> gp-0 hang-time) (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! (-> gp-0 hang-time) (- (current-time) (-> self clock old-frame-counter))) (enemy-method-90 self s5-1 gp-0) (enemy-method-91 self s5-1 gp-0) (enemy-method-92 self s5-1 (the-as nav-poly gp-0)) @@ -3050,12 +3040,12 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self mask) (process-mask actor-pause)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (if (logtest? (enemy-flag alert) (-> self enemy-flags)) (go-virtual jump) (enemy-method-93 self) @@ -3486,7 +3476,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (stop-looking-at-target! self) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) (logclear! (-> self mask) (process-mask actor-pause)) @@ -3599,7 +3589,7 @@ This commonly includes things such as: (set! (-> gp-0 on-surface-count) 0) (set! (-> gp-0 move-count) 0) (until (enemy-method-80 self gp-0) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2)) (kill-prefer-falling self) ) (if (logtest? (-> self root-override2 status) (collide-status on-surface)) @@ -3612,7 +3602,7 @@ This commonly includes things such as: ) ) (let ((s5-1 2)) - (set! (-> gp-0 land-can-land-time) (-> self clock frame-counter)) + (set! (-> gp-0 land-can-land-time) (current-time)) (until #f (if (logtest? (-> self root-override2 status) (collide-status on-surface)) (+! (-> gp-0 on-surface-count) 1) @@ -3624,14 +3614,14 @@ This commonly includes things such as: (+! (-> gp-0 move-count) 1) (set! s5-1 3) (if (enemy-method-80 self gp-0) - (set! (-> gp-0 land-can-land-time) (-> self clock frame-counter)) + (set! (-> gp-0 land-can-land-time) (current-time)) ) ) ) #f (label cfg-15) (if (and (not (logtest? (enemy-flag recover) (-> self enemy-flags))) - (or (>= (- (-> self clock frame-counter) (-> gp-0 land-can-land-time)) (seconds 0.1)) + (or (>= (- (current-time) (-> gp-0 land-can-land-time)) (seconds 0.1)) (enemy-method-81 self) (enemy-method-102 self) ) @@ -3730,7 +3720,7 @@ This commonly includes things such as: (set! (-> v1-3 prim-core collide-with) (collide-spec)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self hit-points) 0) (enemy-method-103 self) (none) diff --git a/test/decompiler/reference/jak2/engine/ambient/ambient_REF.gc b/test/decompiler/reference/jak2/engine/ambient/ambient_REF.gc index f207ecb468..bd4c44b342 100644 --- a/test/decompiler/reference/jak2/engine/ambient/ambient_REF.gc +++ b/test/decompiler/reference/jak2/engine/ambient/ambient_REF.gc @@ -254,7 +254,7 @@ (set! (-> self region) arg2) (set! (-> self total-time) 0) (set! (-> self total-off-time) 0) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (set! (-> self voicebox) (the-as handle #f)) (set! (-> self save?) #f) (if (logtest? (-> self message flags) 96) @@ -359,8 +359,8 @@ (defstate idle (talker) :virtual #t :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (the-as time-frame (-> self message delay))) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (the-as time-frame (-> self message delay))) (suspend) ) ) @@ -371,7 +371,7 @@ ) ) ) - (while (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (+ (-> self message delay) 300))) + (while (< (- (current-time) (-> self start-time)) (the-as time-frame (+ (-> self message delay) 300))) (if (and (or (zero? (-> self voice-id)) (= (get-status *gui-control* (-> self voice-id)) (gui-status ready))) (or (zero? (-> self message-id)) (= (get-status *gui-control* (-> self message-id)) (gui-status active))) ) @@ -388,7 +388,7 @@ (defstate active (talker) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (if (logtest? (-> self message flags) 1) (play-communicator-speech! (-> self message)) ) @@ -488,16 +488,16 @@ ) (set! v1-43 #t) (label cfg-39) - (and v1-43 (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 120))) + (and v1-43 (< (- (current-time) (-> self state-time)) (seconds 120))) ) ) (and (nonzero? (-> self message-id)) (= (get-status *gui-control* (-> self message-id)) (gui-status active)) - (or (< (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self message text-duration))) + (or (< (- (current-time) (-> self state-time)) (the-as time-frame (-> self message text-duration))) (and (logtest? (-> self message flags) 16) (-> self region) (region-method-9 (-> self region) (target-pos 0))) ) ) - (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (< (- (current-time) (-> self state-time)) (seconds 0.05)) ) (when (and (nonzero? (-> self voice-id)) (not gp-1) (zero? (get-status *gui-control* (-> self voice-id)))) (remove-setting! 'music-volume) @@ -529,8 +529,8 @@ ) ) (when (and (logtest? (-> self message flags) 8) (not (-> self save?))) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 1)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 1)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/engine/anim/fma-sphere_REF.gc b/test/decompiler/reference/jak2/engine/anim/fma-sphere_REF.gc index 3257efa6d1..977f58ae20 100644 --- a/test/decompiler/reference/jak2/engine/anim/fma-sphere_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/fma-sphere_REF.gc @@ -83,7 +83,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self first-time?) #f) (if (logtest? (-> self mode) (fma-sphere-mode kill-once)) (send-event *traffic-manager* 'kill-traffic-sphere (-> self sphere)) @@ -98,7 +98,7 @@ ) (init-vf0-vector) (let ((v1-0 (-> self duration))) - (if (and (nonzero? v1-0) (>= (- (-> self clock frame-counter) (-> self state-time)) v1-0)) + (if (and (nonzero? v1-0) (>= (- (current-time) (-> self state-time)) v1-0)) (go empty-state) ) ) diff --git a/test/decompiler/reference/jak2/engine/anim/joint-exploder_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint-exploder_REF.gc index 8dcb3a50eb..5e48cd428d 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint-exploder_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint-exploder_REF.gc @@ -679,11 +679,11 @@ ;; failed to figure out what this is: (defstate joint-exploder-shatter (joint-exploder) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (let* ((f0-1 (the float (- (-> self clock frame-counter) (-> self state-time)))) + (let* ((f0-1 (the float (- (current-time) (-> self state-time)))) (f1-1 (- 1.0 (/ f0-1 (the float (-> self tuning duration))))) (f0-3 (- 1.0 (/ f0-1 (* 0.75 (the float (-> self tuning duration)))))) ) @@ -731,8 +731,8 @@ (none) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self tuning duration)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (-> self tuning duration)) (suspend) (ja :num! (loop!)) ) diff --git a/test/decompiler/reference/jak2/engine/anim/joint-mod_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint-mod_REF.gc index 5dbbdeb6d6..aa13874e11 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint-mod_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint-mod_REF.gc @@ -776,7 +776,7 @@ ) (when s2-1 (when (< (vector-vector-distance (-> obj process root trans) (-> s1-0 root trans)) (-> s2-1 cam-notice-dist)) - (set! (-> obj notice-time) (-> self clock frame-counter)) + (set! (-> obj notice-time) (current-time)) (set! (-> last-try-to-look-at-data who) (process->handle arg2)) (if (< (-> last-try-to-look-at-data vert) (-> s2-1 cam-vert)) (set! (-> last-try-to-look-at-data vert) (-> s2-1 cam-vert)) diff --git a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc index 8ad36b3d3b..d055b4bf1b 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc @@ -650,7 +650,7 @@ ;; definition for function joint-control-channel-eval (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 (-> self clock frame-counter))) + (set! (-> arg0 eval-time) (the-as uint (current-time))) f0-3 ) ) @@ -659,7 +659,7 @@ (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 (-> self clock frame-counter))) + (set! (-> arg0 eval-time) (the-as uint (current-time))) f0-3 ) ) @@ -669,21 +669,19 @@ (arg1 art-joint-anim) (arg2 (function joint-control-channel float float float float)) ) - (with-pp - (set! (-> arg0 num-func) arg2) - (cond - ((= (-> arg0 command) (joint-control-command stack)) - ) - (else - (if arg1 - (set! (-> arg0 frame-group) arg1) - ) - (arg2 arg0 (-> arg0 param 0) (-> arg0 param 1) (-> arg0 param 2)) - (set! (-> arg0 eval-time) (the-as uint (-> pp clock frame-counter))) - ) + (set! (-> arg0 num-func) arg2) + (cond + ((= (-> arg0 command) (joint-control-command stack)) + ) + (else + (if arg1 + (set! (-> arg0 frame-group) arg1) + ) + (arg2 arg0 (-> arg0 param 0) (-> arg0 param 1) (-> arg0 param 2)) + (set! (-> arg0 eval-time) (the-as uint (current-time))) ) - 0 ) + 0 ) ;; definition for function joint-control-channel-group! @@ -810,24 +808,7 @@ ;; definition for function flatten-joint-control-to-spr ;; INFO: Used lq/sq -;; WARN: Failed load: (set! vf2 (l.vf (the-as int a2-1))) at op 46 -;; WARN: Failed load: (set! vf3 (l.vf (+ (the-as int a2-1) 16))) at op 48 -;; WARN: Failed load: (set! vf4 (l.vf (+ (the-as int a2-1) 32))) at op 49 -;; WARN: Failed load: (set! vf5 (l.vf (+ (the-as int a2-1) 48))) at op 50 -;; WARN: Failed load: (set! vf6 (l.vf (+ (the-as int a2-1) 64))) at op 51 -;; WARN: Failed load: (set! vf7 (l.vf (+ (the-as int a2-1) 80))) at op 52 -;; WARN: Failed load: (set! vf3 (l.vf (the-as int a2-2))) at op 82 -;; WARN: Failed load: (set! vf4 (l.vf (+ (the-as int a2-2) 16))) at op 83 -;; WARN: Failed load: (set! vf5 (l.vf (+ (the-as int a2-2) 32))) at op 84 -;; WARN: Failed load: (set! vf6 (l.vf (+ (the-as int a2-2) 48))) at op 85 -;; WARN: Failed load: (set! vf7 (l.vf (+ (the-as int a2-2) 64))) at op 86 -;; WARN: Failed load: (set! vf8 (l.vf (+ (the-as int a2-2) 80))) at op 87 -;; WARN: Failed load: (set! vf9 (l.vf (+ (the-as int a2-2) 96))) at op 94 -;; WARN: Failed load: (set! vf10 (l.vf (+ (the-as int a2-2) 112))) at op 95 -;; WARN: Failed load: (set! vf11 (l.vf (+ (the-as int a2-2) 128))) at op 96 -;; WARN: Failed load: (set! vf12 (l.vf (+ (the-as int a2-2) 144))) at op 97 -;; WARN: Failed load: (set! vf13 (l.vf (+ (the-as int a2-2) 160))) at op 98 -;; WARN: Failed load: (set! vf14 (l.vf (+ (the-as int a2-2) 176))) at op 99 +;; ERROR: Failed load: (set! vf2 (l.vf (the-as int a2-1))) at op 46 (defun flatten-joint-control-to-spr ((arg0 joint-control)) (rlet ((vf1 :class vf) (vf10 :class vf) @@ -1691,54 +1672,54 @@ ;; ERROR: function was not converted to expressions. Cannot decompile. ;; definition for function make-joint-jump-tables -;; WARN: Failed store: (s.w! (+ a0-2 1616) v1-1) at op 5 -;; WARN: Failed store: (s.w! (+ a0-5 1620) v1-3) at op 11 -;; WARN: Failed store: (s.w! (+ a0-8 1624) v1-5) at op 17 -;; WARN: Failed store: (s.w! (+ a0-11 1628) v1-7) at op 23 -;; WARN: Failed store: (s.w! (+ a0-14 1632) v1-9) at op 29 -;; WARN: Failed store: (s.w! (+ a0-17 1636) v1-11) at op 35 -;; WARN: Failed store: (s.w! (+ a0-20 1640) v1-13) at op 41 -;; WARN: Failed store: (s.w! (+ a0-23 1644) v1-15) at op 47 -;; WARN: Failed store: (s.w! (+ a0-26 1648) v1-17) at op 53 -;; WARN: Failed store: (s.w! (+ a0-29 1652) v1-19) at op 59 -;; WARN: Failed store: (s.w! (+ a0-32 1656) v1-21) at op 65 -;; WARN: Failed store: (s.w! (+ a0-35 1660) v1-23) at op 71 -;; WARN: Failed store: (s.w! (+ a0-38 1664) v1-25) at op 77 -;; WARN: Failed store: (s.w! (+ a0-41 1668) v1-27) at op 83 -;; WARN: Failed store: (s.w! (+ a0-44 1672) v1-29) at op 89 -;; WARN: Failed store: (s.w! (+ a0-47 1676) v1-31) at op 95 -;; WARN: Failed store: (s.w! (+ a0-50 1680) v1-33) at op 101 -;; WARN: Failed store: (s.w! (+ a0-53 1684) v1-35) at op 107 -;; WARN: Failed store: (s.w! (+ a0-56 1688) v1-37) at op 113 -;; WARN: Failed store: (s.w! (+ a0-59 1692) v1-39) at op 119 -;; WARN: Failed store: (s.w! (+ a0-62 1696) v1-41) at op 125 -;; WARN: Failed store: (s.w! (+ a0-65 1700) v1-43) at op 131 -;; WARN: Failed store: (s.w! (+ a0-68 1704) v1-45) at op 137 -;; WARN: Failed store: (s.w! (+ a0-71 1708) v1-47) at op 143 -;; WARN: Failed store: (s.w! (+ a0-74 1712) v1-49) at op 149 -;; WARN: Failed store: (s.w! (+ a0-77 1716) v1-51) at op 155 -;; WARN: Failed store: (s.w! (+ a0-80 1720) v1-53) at op 161 -;; WARN: Failed store: (s.w! (+ a0-83 1724) v1-55) at op 167 -;; WARN: Failed store: (s.w! (+ a0-86 1728) v1-57) at op 173 -;; WARN: Failed store: (s.w! (+ a0-89 1732) v1-59) at op 179 -;; WARN: Failed store: (s.w! (+ a0-92 1736) v1-61) at op 185 -;; WARN: Failed store: (s.w! (+ a0-95 1740) v1-63) at op 191 -;; WARN: Failed store: (s.w! (+ a0-98 1744) v1-65) at op 197 -;; WARN: Failed store: (s.w! (+ a0-101 1748) v1-67) at op 203 -;; WARN: Failed store: (s.w! (+ a0-104 1752) v1-69) at op 209 -;; WARN: Failed store: (s.w! (+ a0-107 1756) v1-71) at op 215 -;; WARN: Failed store: (s.w! (+ a0-110 1760) v1-73) at op 221 -;; WARN: Failed store: (s.w! (+ a0-113 1764) v1-75) at op 227 -;; WARN: Failed store: (s.w! (+ a0-116 1768) v1-77) at op 233 -;; WARN: Failed store: (s.w! (+ a0-119 1772) v1-79) at op 239 -;; WARN: Failed store: (s.w! (+ a0-122 1776) v1-81) at op 245 -;; WARN: Failed store: (s.w! (+ a0-125 1780) v1-83) at op 251 -;; WARN: Failed store: (s.w! (+ a0-128 1784) v1-85) at op 257 -;; WARN: Failed store: (s.w! (+ a0-131 1788) v1-87) at op 263 -;; WARN: Failed store: (s.w! (+ a0-134 1792) v1-89) at op 269 -;; WARN: Failed store: (s.w! (+ a0-137 1796) v1-91) at op 275 -;; WARN: Failed store: (s.w! (+ a0-140 1800) v1-93) at op 281 -;; WARN: Failed store: (s.w! (+ a0-143 1804) v1-95) at op 287 +;; ERROR: Failed store: (s.w! (+ a0-2 1616) v1-1) at op 5 +;; ERROR: Failed store: (s.w! (+ a0-5 1620) v1-3) at op 11 +;; ERROR: Failed store: (s.w! (+ a0-8 1624) v1-5) at op 17 +;; ERROR: Failed store: (s.w! (+ a0-11 1628) v1-7) at op 23 +;; ERROR: Failed store: (s.w! (+ a0-14 1632) v1-9) at op 29 +;; ERROR: Failed store: (s.w! (+ a0-17 1636) v1-11) at op 35 +;; ERROR: Failed store: (s.w! (+ a0-20 1640) v1-13) at op 41 +;; ERROR: Failed store: (s.w! (+ a0-23 1644) v1-15) at op 47 +;; ERROR: Failed store: (s.w! (+ a0-26 1648) v1-17) at op 53 +;; ERROR: Failed store: (s.w! (+ a0-29 1652) v1-19) at op 59 +;; ERROR: Failed store: (s.w! (+ a0-32 1656) v1-21) at op 65 +;; ERROR: Failed store: (s.w! (+ a0-35 1660) v1-23) at op 71 +;; ERROR: Failed store: (s.w! (+ a0-38 1664) v1-25) at op 77 +;; ERROR: Failed store: (s.w! (+ a0-41 1668) v1-27) at op 83 +;; ERROR: Failed store: (s.w! (+ a0-44 1672) v1-29) at op 89 +;; ERROR: Failed store: (s.w! (+ a0-47 1676) v1-31) at op 95 +;; ERROR: Failed store: (s.w! (+ a0-50 1680) v1-33) at op 101 +;; ERROR: Failed store: (s.w! (+ a0-53 1684) v1-35) at op 107 +;; ERROR: Failed store: (s.w! (+ a0-56 1688) v1-37) at op 113 +;; ERROR: Failed store: (s.w! (+ a0-59 1692) v1-39) at op 119 +;; ERROR: Failed store: (s.w! (+ a0-62 1696) v1-41) at op 125 +;; ERROR: Failed store: (s.w! (+ a0-65 1700) v1-43) at op 131 +;; ERROR: Failed store: (s.w! (+ a0-68 1704) v1-45) at op 137 +;; ERROR: Failed store: (s.w! (+ a0-71 1708) v1-47) at op 143 +;; ERROR: Failed store: (s.w! (+ a0-74 1712) v1-49) at op 149 +;; ERROR: Failed store: (s.w! (+ a0-77 1716) v1-51) at op 155 +;; ERROR: Failed store: (s.w! (+ a0-80 1720) v1-53) at op 161 +;; ERROR: Failed store: (s.w! (+ a0-83 1724) v1-55) at op 167 +;; ERROR: Failed store: (s.w! (+ a0-86 1728) v1-57) at op 173 +;; ERROR: Failed store: (s.w! (+ a0-89 1732) v1-59) at op 179 +;; ERROR: Failed store: (s.w! (+ a0-92 1736) v1-61) at op 185 +;; ERROR: Failed store: (s.w! (+ a0-95 1740) v1-63) at op 191 +;; ERROR: Failed store: (s.w! (+ a0-98 1744) v1-65) at op 197 +;; ERROR: Failed store: (s.w! (+ a0-101 1748) v1-67) at op 203 +;; ERROR: Failed store: (s.w! (+ a0-104 1752) v1-69) at op 209 +;; ERROR: Failed store: (s.w! (+ a0-107 1756) v1-71) at op 215 +;; ERROR: Failed store: (s.w! (+ a0-110 1760) v1-73) at op 221 +;; ERROR: Failed store: (s.w! (+ a0-113 1764) v1-75) at op 227 +;; ERROR: Failed store: (s.w! (+ a0-116 1768) v1-77) at op 233 +;; ERROR: Failed store: (s.w! (+ a0-119 1772) v1-79) at op 239 +;; ERROR: Failed store: (s.w! (+ a0-122 1776) v1-81) at op 245 +;; ERROR: Failed store: (s.w! (+ a0-125 1780) v1-83) at op 251 +;; ERROR: Failed store: (s.w! (+ a0-128 1784) v1-85) at op 257 +;; ERROR: Failed store: (s.w! (+ a0-131 1788) v1-87) at op 263 +;; ERROR: Failed store: (s.w! (+ a0-134 1792) v1-89) at op 269 +;; ERROR: Failed store: (s.w! (+ a0-137 1796) v1-91) at op 275 +;; ERROR: Failed store: (s.w! (+ a0-140 1800) v1-93) at op 281 +;; ERROR: Failed store: (s.w! (+ a0-143 1804) v1-95) at op 287 (defun make-joint-jump-tables () (let ((v1-1 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 108 4))) (a0-2 #x70000000) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc index bf4c5c60d6..db97ccd260 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc @@ -200,7 +200,6 @@ ;; definition for function cam-line-dma ;; INFO: Used lq/sq -;; ERROR: Failed store: (s.w! (+ a0-2 8) 0) at op 78 (defun cam-line-dma () (with-dma-buffer-add-bucket ((v1-5 (-> *display* frames (-> *display* on-screen) debug-buf)) (bucket-id debug-no-zbuf1) @@ -1475,41 +1474,39 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun cam-collision-record-save ((arg0 vector) (arg1 vector) (arg2 int) (arg3 symbol) (arg4 camera-slave)) - (with-pp - (when *record-cam-collide-history* - (let ((v1-5 (the-as - cam-collision-record - (+ (+ (* 176 *cam-collision-record-last*) 12) (the-as int *cam-collision-record*)) - ) + (when *record-cam-collide-history* + (let ((v1-5 (the-as + cam-collision-record + (+ (+ (* 176 *cam-collision-record-last*) 12) (the-as int *cam-collision-record*)) ) - ) - (set! (-> v1-5 pos quad) (-> arg0 quad)) - (set! (-> v1-5 vel quad) (-> arg1 quad)) - (set! (-> v1-5 view-flat quad) (-> arg4 view-flat quad)) - (set! (-> v1-5 desired-pos quad) (-> arg4 desired-pos quad)) - (set! (-> v1-5 cam-tpos-cur quad) (-> *camera* tpos-curr-adj quad)) - (set! (-> v1-5 cam-tpos-old quad) (-> *camera* tpos-old-adj quad)) - (set! (-> v1-5 string-min-val quad) (-> arg4 string-min-val quad)) - (set! (-> v1-5 string-max-val quad) (-> arg4 string-max-val quad)) - (set! (-> v1-5 view-off quad) (-> arg4 view-off quad)) - (set! (-> v1-5 frame) (the-as int (-> pp clock frame-counter))) - (set! (-> v1-5 iteration) arg2) - (set! (-> v1-5 move-type) arg3) - (set! (-> v1-5 min-z-override) (-> arg4 min-z-override)) - (set! (-> v1-5 string-push-z) (-> *camera* string-push-z)) - (set! (-> v1-5 view-off-param) (-> arg4 view-off-param)) - ) - (set! *cam-collision-record-show* *cam-collision-record-last*) - (set! *cam-collision-record-last* (+ *cam-collision-record-last* 1)) - (set! *cam-collision-record-last* (mod *cam-collision-record-last* 600)) - (when (= *cam-collision-record-last* *cam-collision-record-first*) - (set! *cam-collision-record-first* (+ *cam-collision-record-first* 1)) - (set! *cam-collision-record-first* (mod *cam-collision-record-first* 600)) - ) + ) + ) + (set! (-> v1-5 pos quad) (-> arg0 quad)) + (set! (-> v1-5 vel quad) (-> arg1 quad)) + (set! (-> v1-5 view-flat quad) (-> arg4 view-flat quad)) + (set! (-> v1-5 desired-pos quad) (-> arg4 desired-pos quad)) + (set! (-> v1-5 cam-tpos-cur quad) (-> *camera* tpos-curr-adj quad)) + (set! (-> v1-5 cam-tpos-old quad) (-> *camera* tpos-old-adj quad)) + (set! (-> v1-5 string-min-val quad) (-> arg4 string-min-val quad)) + (set! (-> v1-5 string-max-val quad) (-> arg4 string-max-val quad)) + (set! (-> v1-5 view-off quad) (-> arg4 view-off quad)) + (set! (-> v1-5 frame) (the-as int (current-time))) + (set! (-> v1-5 iteration) arg2) + (set! (-> v1-5 move-type) arg3) + (set! (-> v1-5 min-z-override) (-> arg4 min-z-override)) + (set! (-> v1-5 string-push-z) (-> *camera* string-push-z)) + (set! (-> v1-5 view-off-param) (-> arg4 view-off-param)) + ) + (set! *cam-collision-record-show* *cam-collision-record-last*) + (set! *cam-collision-record-last* (+ *cam-collision-record-last* 1)) + (set! *cam-collision-record-last* (mod *cam-collision-record-last* 600)) + (when (= *cam-collision-record-last* *cam-collision-record-first*) + (set! *cam-collision-record-first* (+ *cam-collision-record-first* 1)) + (set! *cam-collision-record-first* (mod *cam-collision-record-first* 600)) ) - 0 - (none) ) + 0 + (none) ) ;; definition for function cam-collision-record-step diff --git a/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc index 63cdb26415..e6acd246fa 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc @@ -59,13 +59,11 @@ (set! (-> self string-max target z) (-> self settings string-max-length)) (set! (-> self string-push-z) (fmax (-> self string-min value z) (-> *CAMERA-bank* default-string-push-z))) (cond - ((>= (- (-> self clock frame-counter) (get-notice-time (the-as process-focusable gp-0))) - (-> *CAMERA-bank* attack-timeout) - ) + ((>= (- (current-time) (get-notice-time (the-as process-focusable gp-0))) (-> *CAMERA-bank* attack-timeout)) (set! (-> self being-attacked) #f) ) (else - (set! (-> self attack-start) (-> self clock frame-counter)) + (set! (-> self attack-start) (current-time)) (set! (-> self being-attacked) #t) (when (or (!= (-> last-try-to-look-at-data horz) 0.0) (!= (-> last-try-to-look-at-data vert) 0.0)) (set! (-> self string-max target y) (fmax (-> self string-max target y) (-> last-try-to-look-at-data vert))) @@ -117,14 +115,12 @@ (gp-0 (logior! (-> self master-options) (cam-master-options-u32 HAVE_TARGET)) (cond - ((>= (- (-> self clock frame-counter) (get-notice-time (the-as target gp-0))) - (-> *CAMERA-bank* attack-timeout) - ) + ((>= (- (current-time) (get-notice-time (the-as target gp-0))) (-> *CAMERA-bank* attack-timeout)) (set! (-> self being-attacked) #f) ) (else (if (not (-> self being-attacked)) - (set! (-> self attack-start) (-> self clock frame-counter)) + (set! (-> self attack-start) (current-time)) ) (set! (-> self being-attacked) #t) (when (or (!= (-> last-try-to-look-at-data horz) 0.0) (!= (-> last-try-to-look-at-data vert) 0.0)) @@ -936,7 +932,7 @@ ) ) ((= v1-0 'part-water-drip) - (set! (-> self water-drip-time) (-> self clock frame-counter)) + (set! (-> self water-drip-time) (current-time)) (set! (-> self water-drip-mult) (the-as float (-> event param 0))) (set! (-> self water-drip-speed) (the-as float (-> event param 1))) ) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc index a0e04056f6..ea6185b30e 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc @@ -540,7 +540,7 @@ (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) + (let ((gp-0 (current-time))) (until #f (when (not (paused?)) (let ((s4-0 (vector-reset! (new-stack-vector0))) @@ -586,10 +586,10 @@ ) (cond ((and (= (-> s4-0 x) 0.0) (= (-> s4-0 y) 0.0)) - (set! gp-0 (-> self clock frame-counter)) + (set! gp-0 (current-time)) ) (else - (let ((v1-39 (min 10 (max 1 (- (-> self clock frame-counter) gp-0))))) + (let ((v1-39 (min 10 (max 1 (- (current-time) gp-0))))) (vector-float*! s4-0 s4-0 (* 0.1 (the float v1-39))) ) ) @@ -2222,8 +2222,8 @@ ) (set! (-> self los-last-pos quad) (-> self good-point quad)) (when *display-cam-los-debug* - (format 0 "going because u(~f) > 0 frame ~D~%" f30-2 (-> self clock frame-counter)) - (format *stdcon* " going because u(~f) > 0 frame ~D~%" f30-2 (-> self clock frame-counter)) + (format 0 "going because u(~f) > 0 frame ~D~%" f30-2 (current-time)) + (format *stdcon* " going because u(~f) > 0 frame ~D~%" f30-2 (current-time)) ) (logior! (-> self options) (cam-slave-options-u32 GOTO_GOOD_POINT)) ) @@ -2476,9 +2476,7 @@ (if (-> self have-phony-joystick) (set! f28-0 (* 0.05 (-> self phony-joystick-y))) ) - (if (and (-> *camera* being-attacked) - (< (- (-> self clock frame-counter) (-> *camera* attack-start)) (seconds 0.25)) - ) + (if (and (-> *camera* being-attacked) (< (- (current-time) (-> *camera* attack-start)) (seconds 0.25))) (set! f28-0 0.05) ) (when (logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)) @@ -2722,7 +2720,7 @@ ) (vector-flatten! s5-3 s5-3 (-> *camera* local-down)) ) - ((< (- (-> self clock frame-counter) (the-as int (-> self butt-timer))) 0) + ((< (- (current-time) (the-as int (-> self butt-timer))) 0) (vector-flatten! s5-3 (-> self butt-vector) (-> *camera* local-down)) ) (else @@ -3102,7 +3100,7 @@ object (cond ((= v1-0 'get-behind) - (set! (-> self butt-timer) (the-as uint (+ (-> self clock frame-counter) (seconds 0.25)))) + (set! (-> self butt-timer) (the-as uint (+ (current-time) (seconds 0.25)))) (set! (-> self butt-seek) (the-as basic #t)) (set! v0-0 (-> self butt-vector)) (set! (-> (the-as vector v0-0) quad) (-> (the-as vector (-> event param 0)) quad)) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-debug_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-debug_REF.gc index 1762d65033..2fc8c8b297 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-debug_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-debug_REF.gc @@ -186,124 +186,122 @@ ;; definition for method 9 of type col-rend ;; INFO: Used lq/sq (defmethod col-rend-method-9 col-rend ((obj col-rend)) - (with-pp - (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (let ((f30-0 (-> obj bbox-radius))) - (let ((v1-0 (-> obj track))) - (cond - ((zero? v1-0) - (set! (-> obj bbox-center quad) (-> (target-pos 0) quad)) - (+! (-> obj bbox-center y) (* 0.7 f30-0)) - ) - ((= v1-0 1) - (position-in-front-of-camera! (-> obj bbox-center) (+ (-> obj camera-to-bbox-dist) (-> obj bbox-radius)) 0.0) - ) - ) - ) - (set! (-> s5-0 bbox min quad) (-> obj bbox-center quad)) - (set! (-> s5-0 bbox min x) (- (-> s5-0 bbox min x) f30-0)) - (set! (-> s5-0 bbox min y) (- (-> s5-0 bbox min y) f30-0)) - (set! (-> s5-0 bbox min z) (- (-> s5-0 bbox min z) f30-0)) - (set! (-> s5-0 bbox max quad) (-> obj bbox-center quad)) - (+! (-> s5-0 bbox max x) f30-0) - (+! (-> s5-0 bbox max y) f30-0) - (+! (-> s5-0 bbox max z) f30-0) - ) - (let ((v1-9 -1)) - (let ((a0-9 (-> obj cspec))) - (if (not (logtest? a0-9 (collide-spec crate))) - (set! v1-9 (logxor v1-9 1)) - ) - (if (not (logtest? a0-9 (collide-spec civilian))) - (set! v1-9 (logxor v1-9 64)) - ) - (if (not (logtest? a0-9 (collide-spec enemy))) - (set! v1-9 (logxor #x80000 v1-9)) - ) - (if (not (logtest? a0-9 (collide-spec obstacle))) - (set! v1-9 (logxor v1-9 2)) - ) - (if (not (logtest? a0-9 (collide-spec vehicle-sphere))) - (set! v1-9 (logand #x80743 v1-9)) - ) - ) - (set! (-> s5-0 collide-with) (the-as collide-spec v1-9)) - ) - (set! (-> s5-0 ignore-pat) (new 'static 'pat-surface)) - (set! (-> s5-0 ignore-process0) #f) - (set! (-> s5-0 ignore-process1) #f) - (add-debug-box - #t - (bucket-id debug2) - (the-as vector (-> s5-0 bbox)) - (-> s5-0 bbox max) - (if (logtest? (-> pp clock frame-counter) 128) - (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x20) - (new 'static 'rgba :a #x20) - ) - ) - (fill-using-bounding-box *collide-cache* s5-0) - ) - (let ((s5-1 (-> obj show-only)) - (a1-17 (new 'stack 'col-rend-filter)) - ) - (when (nonzero? s5-1) + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (let ((f30-0 (-> obj bbox-radius))) + (let ((v1-0 (-> obj track))) (cond - ((logtest? s5-1 8) - (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :noboard #x1)) + ((zero? v1-0) + (set! (-> obj bbox-center quad) (-> (target-pos 0) quad)) + (+! (-> obj bbox-center y) (* 0.7 f30-0)) ) - ((logtest? s5-1 16) - (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :nogrind #x1)) + ((= v1-0 1) + (position-in-front-of-camera! (-> obj bbox-center) (+ (-> obj camera-to-bbox-dist) (-> obj bbox-radius)) 0.0) ) - ((logtest? s5-1 32) - (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :nogrind #x1)) - (set! (-> a1-17 show-pat-set) (new 'static 'pat-surface :nojak #x1)) - ) - (else - (if (logtest? s5-1 8192) - (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :nolineofsight #x1) (-> a1-17 show-pat-set))) - ) - (if (logtest? s5-1 1024) - (set! (-> a1-17 show-pat-set noentity) 1) - ) - (if (logtest? s5-1 64) - (set! (-> a1-17 show-pat-set noboard) 1) - ) - (if (logtest? s5-1 2048) - (set! (-> a1-17 show-pat-set nogrind) 1) - ) - (if (logtest? s5-1 128) - (set! (-> a1-17 show-pat-set nocamera) 1) - ) - (if (logtest? s5-1 4096) - (set! (-> a1-17 show-pat-set nojak) 1) - ) - (if (logtest? s5-1 256) - (set! (-> a1-17 show-pat-set noedge) 1) - ) - (if (logtest? s5-1 #x8000) - (set! (-> a1-17 show-pat-set nopilot) 1) - ) - (if (logtest? s5-1 512) - (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :noendlessfall #x1) (-> a1-17 show-pat-set))) - ) - (if (logtest? s5-1 #x4000) - (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :nomech #x1) (-> a1-17 show-pat-set))) - ) - (if (logtest? #x10000 s5-1) - (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :noproj #x1) (-> a1-17 show-pat-set))) - ) - (if (logtest? #x40000 s5-1) - (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :probe #x1) (-> a1-17 show-pat-set))) - ) - (if (logtest? #x20000 s5-1) - (logior! (-> a1-17 event-mask) 64) - ) - ) ) ) - (col-rend-draw obj a1-17) + (set! (-> s5-0 bbox min quad) (-> obj bbox-center quad)) + (set! (-> s5-0 bbox min x) (- (-> s5-0 bbox min x) f30-0)) + (set! (-> s5-0 bbox min y) (- (-> s5-0 bbox min y) f30-0)) + (set! (-> s5-0 bbox min z) (- (-> s5-0 bbox min z) f30-0)) + (set! (-> s5-0 bbox max quad) (-> obj bbox-center quad)) + (+! (-> s5-0 bbox max x) f30-0) + (+! (-> s5-0 bbox max y) f30-0) + (+! (-> s5-0 bbox max z) f30-0) ) - (none) + (let ((v1-9 -1)) + (let ((a0-9 (-> obj cspec))) + (if (not (logtest? a0-9 (collide-spec crate))) + (set! v1-9 (logxor v1-9 1)) + ) + (if (not (logtest? a0-9 (collide-spec civilian))) + (set! v1-9 (logxor v1-9 64)) + ) + (if (not (logtest? a0-9 (collide-spec enemy))) + (set! v1-9 (logxor #x80000 v1-9)) + ) + (if (not (logtest? a0-9 (collide-spec obstacle))) + (set! v1-9 (logxor v1-9 2)) + ) + (if (not (logtest? a0-9 (collide-spec vehicle-sphere))) + (set! v1-9 (logand #x80743 v1-9)) + ) + ) + (set! (-> s5-0 collide-with) (the-as collide-spec v1-9)) + ) + (set! (-> s5-0 ignore-pat) (new 'static 'pat-surface)) + (set! (-> s5-0 ignore-process0) #f) + (set! (-> s5-0 ignore-process1) #f) + (add-debug-box + #t + (bucket-id debug2) + (the-as vector (-> s5-0 bbox)) + (-> s5-0 bbox max) + (if (logtest? (current-time) 128) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x20) + (new 'static 'rgba :a #x20) + ) + ) + (fill-using-bounding-box *collide-cache* s5-0) ) + (let ((s5-1 (-> obj show-only)) + (a1-17 (new 'stack 'col-rend-filter)) + ) + (when (nonzero? s5-1) + (cond + ((logtest? s5-1 8) + (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :noboard #x1)) + ) + ((logtest? s5-1 16) + (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :nogrind #x1)) + ) + ((logtest? s5-1 32) + (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :nogrind #x1)) + (set! (-> a1-17 show-pat-set) (new 'static 'pat-surface :nojak #x1)) + ) + (else + (if (logtest? s5-1 8192) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :nolineofsight #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? s5-1 1024) + (set! (-> a1-17 show-pat-set noentity) 1) + ) + (if (logtest? s5-1 64) + (set! (-> a1-17 show-pat-set noboard) 1) + ) + (if (logtest? s5-1 2048) + (set! (-> a1-17 show-pat-set nogrind) 1) + ) + (if (logtest? s5-1 128) + (set! (-> a1-17 show-pat-set nocamera) 1) + ) + (if (logtest? s5-1 4096) + (set! (-> a1-17 show-pat-set nojak) 1) + ) + (if (logtest? s5-1 256) + (set! (-> a1-17 show-pat-set noedge) 1) + ) + (if (logtest? s5-1 #x8000) + (set! (-> a1-17 show-pat-set nopilot) 1) + ) + (if (logtest? s5-1 512) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :noendlessfall #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? s5-1 #x4000) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :nomech #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? #x10000 s5-1) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :noproj #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? #x40000 s5-1) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :probe #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? #x20000 s5-1) + (logior! (-> a1-17 event-mask) 64) + ) + ) + ) + ) + (col-rend-draw obj a1-17) + ) + (none) ) diff --git a/test/decompiler/reference/jak2/engine/collide/los-control_REF.gc b/test/decompiler/reference/jak2/engine/collide/los-control_REF.gc index bd297faf49..3e821b35a3 100644 --- a/test/decompiler/reference/jak2/engine/collide/los-control_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/los-control_REF.gc @@ -1,9 +1,14 @@ +;;-*-Lisp-*- (in-package goal) +;; definition for symbol *los-time-offset*, type time-frame (define *los-time-offset* (the-as time-frame 0)) +;; definition for method 9 of type los-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch time-frame vs none. (defmethod los-control-method-9 los-control ((obj los-control) (process process-focusable) (trans-vec vector) (radius float)) - (when (and (>= (- (-> self clock frame-counter) (-> obj last-check-time)) (-> obj check-interval)) + (when (and (>= (- (current-time) (-> obj last-check-time)) (-> obj check-interval)) (-> obj src-proc) (or process (-> obj dst-proc)) ) @@ -45,13 +50,13 @@ (let ((f30-0 (probe-using-line-sphere *collide-cache* cquery))) (quad-copy! (the-as pointer (-> obj last-collide-result)) (the-as pointer (-> cquery best-other-tri)) 6) (if (>= 0.0 f30-0) - (set! (-> obj have-no-los) (-> self clock frame-counter)) - (set! (-> obj have-los) (-> self clock frame-counter)) + (set! (-> obj have-no-los) (current-time)) + (set! (-> obj have-los) (current-time)) ) ) ) ) - (set! (-> obj last-check-time) (-> self clock frame-counter)) + (set! (-> obj last-check-time) (current-time)) ) ) ) @@ -59,24 +64,30 @@ (none) ) +;; definition for method 10 of type los-control (defmethod check-los? los-control ((obj los-control) (arg0 time-frame)) - (and (>= (- (-> self clock frame-counter) (-> obj have-los)) (+ (-> obj check-interval) arg0)) - (< (- (-> self clock frame-counter) (-> obj have-no-los)) (-> obj check-interval)) + (and (>= (- (current-time) (-> obj have-los)) (+ (-> obj check-interval) arg0)) + (< (- (current-time) (-> obj have-no-los)) (-> obj check-interval)) ) ) +;; definition for method 11 of type los-control (defmethod skip-check-los? los-control ((obj los-control) (arg0 int)) - (and (>= (- (-> self clock frame-counter) (-> obj have-no-los)) (+ (-> obj check-interval) arg0)) - (< (- (-> self clock frame-counter) (-> obj have-los)) (-> obj check-interval)) + (and (>= (- (current-time) (-> obj have-no-los)) (+ (-> obj check-interval) arg0)) + (< (- (current-time) (-> obj have-los)) (-> obj check-interval)) ) ) +;; definition for method 12 of type los-control +;; WARN: Return type mismatch int vs none. (defmethod set-dst-proc! los-control ((obj los-control) (dst handle)) (set! (-> obj dst-proc) dst) 0 (none) ) +;; definition for method 13 of type los-control +;; WARN: Return type mismatch int vs none. (defmethod new-source! los-control ((obj los-control) (proc process) (check-interval time-frame) (c-spec collide-spec)) (set! (-> obj src-proc) (process->handle proc)) (set! (-> obj dst-proc) (the-as handle #f)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/base-plat_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/base-plat_REF.gc index b54f8ff127..b5cab46333 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/base-plat_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/base-plat_REF.gc @@ -71,7 +71,7 @@ For example for an elevator pre-compute the distance between the first and last and translate the platform via the `smush` @see [[smush-control]]" (activate! (-> obj smush) -1.0 60 150 1.0 1.0 (-> self clock)) - (set! (-> obj bounce-time) (-> self clock frame-counter)) + (set! (-> obj bounce-time) (current-time)) (set! (-> obj bouncing) #t) (sound-play "plat-bounce" :position (-> obj root-override trans)) (logclear! (-> obj mask) (process-mask sleep)) @@ -323,7 +323,7 @@ eco-door-event-handler :virtual #t :event eco-door-event-handler :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (process-entity-status! self (entity-perm-status subtask-complete) #t) (let ((prim (-> self root-override root-prim))) (set! (-> prim prim-core collide-as) (collide-spec)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc index 08728f5c98..2e1e08ead6 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc @@ -222,7 +222,7 @@ ) :enter (behavior () (press! self #t) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -237,7 +237,7 @@ (sleep-code) ) (else - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (the int (* 300.0 (-> self timeout)))) + (until (>= (- (current-time) (-> self state-time)) (the int (* 300.0 (-> self timeout)))) (suspend) ) (send-event! self (-> self event-going-up)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/collectables_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/collectables_REF.gc index 751660a164..e35b56e0bc 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/collectables_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/collectables_REF.gc @@ -173,75 +173,73 @@ ;; definition for method 32 of type collectable ;; INFO: Used lq/sq (defmethod initialize-options collectable ((obj collectable) (arg0 int) (arg1 float) (arg2 fact-info)) - (with-pp - (logclear! (-> obj mask) (process-mask crate enemy platform ambient)) - (set! (-> obj mask) (logior (process-mask bit18) (-> obj mask))) - (set! (-> obj flags) (collectable-flag pickup no-eco-blue)) - (set! (-> obj bob-amount) arg1) - (set! (-> obj bob-offset) (the-as seconds (+ (the-as int (-> obj root-override2 trans x)) - (the-as int (-> obj root-override2 trans y)) - (the-as int (-> obj root-override2 trans z)) - ) - ) - ) - (cond - ((or (= (vector-length (-> obj root-override2 transv)) 0.0) - (logtest? (-> obj fact options) (actor-option auto-pickup)) - ) - (vector-reset! (-> obj root-override2 transv)) - ) - (else - (logior! (-> obj flags) (collectable-flag bounce)) - (logclear! (-> obj flags) (collectable-flag pickup)) - (logclear! (-> obj mask) (process-mask actor-pause)) - (set! (-> obj bob-amount) 0.0) + (logclear! (-> obj mask) (process-mask crate enemy platform ambient)) + (set! (-> obj mask) (logior (process-mask bit18) (-> obj mask))) + (set! (-> obj flags) (collectable-flag pickup no-eco-blue)) + (set! (-> obj bob-amount) arg1) + (set! (-> obj bob-offset) (the-as seconds (+ (the-as int (-> obj root-override2 trans x)) + (the-as int (-> obj root-override2 trans y)) + (the-as int (-> obj root-override2 trans z)) + ) + ) ) + (cond + ((or (= (vector-length (-> obj root-override2 transv)) 0.0) + (logtest? (-> obj fact options) (actor-option auto-pickup)) + ) + (vector-reset! (-> obj root-override2 transv)) + ) + (else + (logior! (-> obj flags) (collectable-flag bounce)) + (logclear! (-> obj flags) (collectable-flag pickup)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj bob-amount) 0.0) ) - (when (> arg0 0) - (logior! (-> obj flags) (collectable-flag fadeout)) - (set! (-> obj fadeout-timeout) (the-as seconds arg0)) - (if (logtest? (actor-option no-distance-check-fadeout) (-> arg2 options)) - (logior! (-> obj flags) (collectable-flag no-distance-check-fadeout)) - ) - ) - (set! (-> obj collect-timeout) (the-as seconds 99)) - (set! (-> obj birth-time) (-> pp clock frame-counter)) - (set! (-> obj base quad) (-> obj root-override2 trans quad)) - (set! (-> obj old-base quad) (-> obj root-override2 trans quad)) - (set! (-> obj pickup-handle) (the-as handle #f)) - (case (-> obj fact pickup-type) - (((pickup-type eco-pill-green) - (pickup-type eco-pill-dark) - (pickup-type eco-green) - (pickup-type money) - (pickup-type gem) - (pickup-type skill) - (pickup-type eco-blue) - (pickup-type health) - (pickup-type trick-point) - ) - (logclear! (-> obj flags) (collectable-flag no-eco-blue)) - ) - ) - (if (logtest? (-> obj fact options) (actor-option big-collision)) - (set! (-> obj root-override2 root-prim local-sphere w) - (* 2.5 (-> obj root-override2 root-prim local-sphere w)) - ) - ) - (when (and arg2 (nonzero? (-> obj draw))) - (let* ((s5-0 (-> arg2 process)) - (v1-56 (if (type? s5-0 process-drawable) - s5-0 - ) - ) - ) - (if v1-56 - (set! (-> obj draw light-index) (-> (the-as process-drawable v1-56) draw light-index)) - ) - ) - ) - obj ) + (when (> arg0 0) + (logior! (-> obj flags) (collectable-flag fadeout)) + (set! (-> obj fadeout-timeout) (the-as seconds arg0)) + (if (logtest? (actor-option no-distance-check-fadeout) (-> arg2 options)) + (logior! (-> obj flags) (collectable-flag no-distance-check-fadeout)) + ) + ) + (set! (-> obj collect-timeout) (the-as seconds 99)) + (set! (-> obj birth-time) (current-time)) + (set! (-> obj base quad) (-> obj root-override2 trans quad)) + (set! (-> obj old-base quad) (-> obj root-override2 trans quad)) + (set! (-> obj pickup-handle) (the-as handle #f)) + (case (-> obj fact pickup-type) + (((pickup-type eco-pill-green) + (pickup-type eco-pill-dark) + (pickup-type eco-green) + (pickup-type money) + (pickup-type gem) + (pickup-type skill) + (pickup-type eco-blue) + (pickup-type health) + (pickup-type trick-point) + ) + (logclear! (-> obj flags) (collectable-flag no-eco-blue)) + ) + ) + (if (logtest? (-> obj fact options) (actor-option big-collision)) + (set! (-> obj root-override2 root-prim local-sphere w) + (* 2.5 (-> obj root-override2 root-prim local-sphere w)) + ) + ) + (when (and arg2 (nonzero? (-> obj draw))) + (let* ((s5-0 (-> arg2 process)) + (v1-56 (if (type? s5-0 process-drawable) + s5-0 + ) + ) + ) + (if v1-56 + (set! (-> obj draw light-index) (-> (the-as process-drawable v1-56) draw light-index)) + ) + ) + ) + obj ) ;; definition for method 33 of type collectable @@ -547,26 +545,24 @@ (a3-12 0) (t0-9 (lambda ((arg0 part-tracker)) - (with-pp - (let ((v1-1 (handle->process (-> arg0 userdata)))) - (when (the-as process v1-1) - (let* ((s5-0 (handle->process (-> (the-as collectable v1-1) pickup-handle))) - (a0-9 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - (a2-0 (if (not a0-9) - (-> arg0 root trans) - (get-trans (the-as process-focusable a0-9) 3) - ) - ) - ) - (vector-lerp! - (-> arg0 root trans) - (-> arg0 offset) - a2-0 - (/ (the float (- (-> pp clock frame-counter) (-> arg0 start-time))) (the float (-> arg0 part group duration))) - ) + (let ((v1-1 (handle->process (-> arg0 userdata)))) + (when (the-as process v1-1) + (let* ((s5-0 (handle->process (-> (the-as collectable v1-1) pickup-handle))) + (a0-9 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + (a2-0 (if (not a0-9) + (-> arg0 root trans) + (get-trans (the-as process-focusable a0-9) 3) + ) + ) + ) + (vector-lerp! + (-> arg0 root trans) + (-> arg0 offset) + a2-0 + (/ (the float (- (current-time) (-> arg0 start-time))) (the float (-> arg0 part group duration))) ) ) ) @@ -677,13 +673,13 @@ ) (logior! (-> self flags) (collectable-flag suck-in)) (when (= (-> self speed w) 0.0) - (set! (-> self suck-time) (-> self clock frame-counter)) + (set! (-> self suck-time) (current-time)) (set! (-> self speed x) (rand-vu-float-range 327680.0 819200.0)) ) (+! (-> self speed w) (* (lerp-scale 40960.0 (-> self speed x) - (the float (- (-> self clock frame-counter) (the-as int (-> self suck-time)))) + (the float (- (current-time) (the-as int (-> self suck-time)))) 45.0 60.0 ) @@ -701,9 +697,7 @@ (vector-rotate-y! s5-2 s5-2 (* (-> self speed y) (-> self speed z) (-> self clock seconds-per-frame))) ) (set! (-> self suck-y-offset) - (* 2048.0 - (sin (* 873.81335 (the float (mod (- (-> self clock frame-counter) (the-as int (-> self suck-time))) 75)))) - ) + (* 2048.0 (sin (* 873.81335 (the float (mod (- (current-time) (the-as int (-> self suck-time))) 75))))) ) (vector+! (-> self base) gp-1 s5-2) ) @@ -743,9 +737,7 @@ (local-vars (v0-4 none)) (when (and (or (= arg2 'touch) (= arg2 'attack)) (and (logtest? (-> self flags) (collectable-flag pickup)) - (>= (- (-> self clock frame-counter) (the-as int (-> self birth-time))) - (the-as time-frame (-> self collect-timeout)) - ) + (>= (- (current-time) (the-as int (-> self birth-time))) (the-as time-frame (-> self collect-timeout))) (not (and (-> self next-state) (= (-> self next-state name) 'pickup))) (send-event arg0 'get-pickup (-> self fact pickup-type) (-> self fact pickup-amount)) ) @@ -812,7 +804,7 @@ ((= arg2 'fade) (logior! (-> self flags) (collectable-flag fadeout)) (set! (-> self fadeout-timeout) (the-as seconds 30)) - (set! v0-4 (the-as none (-> self clock frame-counter))) + (set! v0-4 (the-as none (current-time))) (set! (-> self birth-time) (the-as time-frame v0-4)) v0-4 ) @@ -907,9 +899,9 @@ (let ((gp-0 (new 'stack 'trajectory))) (set! (-> self base y) (-> self jump-pos y)) (setup-from-to-duration! gp-0 (-> self root-override2 trans) (-> self jump-pos) 300.0 -2.2755556) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) - (let ((f0-2 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) + (let ((f0-2 (the float (- (current-time) (-> self state-time))))) (compute-trans-at-time gp-0 f0-2 (-> self root-override2 trans)) ) (transform-post) @@ -939,7 +931,7 @@ :virtual #t :event collectable-standard-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (case (-> self pickup-type) (((pickup-type gem)) (sound-play "gem-spawn") @@ -1056,9 +1048,7 @@ (go-virtual suck (process->handle proc)) ) (logtest? (-> self flags) (collectable-flag pickup)) - (>= (- (-> self clock frame-counter) (the-as int (-> self birth-time))) - (the-as time-frame (-> self collect-timeout)) - ) + (>= (- (current-time) (the-as int (-> self birth-time))) (the-as time-frame (-> self collect-timeout))) ) ) (logclear! (-> self mask) (process-mask actor-pause)) @@ -1086,11 +1076,9 @@ (if (and (logtest? (-> self flags) (collectable-flag fadeout)) (begin (if (movie?) - (set! (-> self birth-time) (-> self clock frame-counter)) - ) - (>= (- (-> self clock frame-counter) (the-as int (-> self birth-time))) - (the-as time-frame (-> self fadeout-timeout)) + (set! (-> self birth-time) (current-time)) ) + (>= (- (current-time) (the-as int (-> self birth-time))) (the-as time-frame (-> self fadeout-timeout))) ) (or (or (not *target*) (or (< 204800.0 (vector-vector-distance (-> self root-override2 trans) (-> *target* control trans))) @@ -1119,9 +1107,9 @@ (set! (-> self actor-pause) #f) (logior! (-> self flags) (collectable-flag do-fadeout)) (logior! (-> self state-flags) (state-flags sf0)) - (let ((gp-0 (-> self clock frame-counter))) + (let ((gp-0 (current-time))) (until #f - (let ((f0-1 (- 300.0 (the float (- (-> self clock frame-counter) gp-0))))) + (let ((f0-1 (- 300.0 (the float (- (current-time) gp-0))))) (cond ((< f0-1 0.0) (process-entity-status! self (entity-perm-status dead) #t) @@ -1154,9 +1142,7 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (when (and (or (= event-type 'touch) (= event-type 'attack)) (and (logtest? (-> self flags) (collectable-flag pickup)) - (>= (- (-> self clock frame-counter) (the-as int (-> self birth-time))) - (the-as time-frame (-> self collect-timeout)) - ) + (>= (- (current-time) (the-as int (-> self birth-time))) (the-as time-frame (-> self collect-timeout))) (not (and (-> self next-state) (= (-> self next-state name) 'pickup))) (send-event proc 'get-pickup (-> self fact pickup-type) (-> self fact pickup-amount)) ) @@ -1344,8 +1330,8 @@ ) (cond ((nonzero? (-> self respan-delay)) - (let ((gp-0 (-> self clock frame-counter))) - (while (< (- (-> self clock frame-counter) gp-0) (the-as time-frame (-> self respan-delay))) + (let ((gp-0 (current-time))) + (while (< (- (current-time) gp-0) (the-as time-frame (-> self respan-delay))) (suspend) ) ) @@ -1734,10 +1720,7 @@ This commonly includes things such as: (sin (* 109.22667 (the float - (mod - (+ (- (-> pp clock frame-counter) (the-as int (-> obj birth-time))) (the-as time-frame (-> obj bob-offset))) - 600 - ) + (mod (+ (- (current-time) (the-as int (-> obj birth-time))) (the-as time-frame (-> obj bob-offset))) 600) ) ) ) @@ -1770,15 +1753,13 @@ This commonly includes things such as: (+ (-> self base y) (-> self suck-y-offset) (* f30-0 - (sin (* 109.22667 (the float (mod - (+ (- (-> self clock frame-counter) (the-as int (-> self birth-time))) - (the-as time-frame (-> self bob-offset)) - ) - 600 - ) - ) - ) + (sin + (* 109.22667 + (the float + (mod (+ (- (current-time) (the-as int (-> self birth-time))) (the-as time-frame (-> self bob-offset))) 600) + ) ) + ) ) ) ) @@ -2108,12 +2089,12 @@ This commonly includes things such as: ) ) (if (or (and (logtest? s5-2 (collide-status on-surface)) (< (vector-length (-> gp-1 transv)) 1228.8)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 10)) + (>= (- (current-time) (-> self state-time)) (seconds 10)) ) (go-virtual wait) ) - (when (>= (- (-> self clock frame-counter) (the-as int (-> self bounce-time))) (seconds 0.1)) - (set! (-> self bounce-time) (-> self clock frame-counter)) + (when (>= (- (current-time) (the-as int (-> self bounce-time))) (seconds 0.1)) + (set! (-> self bounce-time) (current-time)) (sound-play-by-name (static-sound-name "gem-bounce") (new-sound-id) @@ -2125,7 +2106,7 @@ This commonly includes things such as: ) ) ) - ((>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 15)) + ((>= (- (current-time) (-> self state-time)) (seconds 15)) (go-virtual wait) ) ) @@ -2238,11 +2219,9 @@ This commonly includes things such as: (if (and (logtest? (-> self flags) (collectable-flag fadeout)) (begin (if (movie?) - (set! (-> self birth-time) (-> self clock frame-counter)) - ) - (>= (- (-> self clock frame-counter) (the-as int (-> self birth-time))) - (the-as time-frame (-> self fadeout-timeout)) + (set! (-> self birth-time) (current-time)) ) + (>= (- (current-time) (the-as int (-> self birth-time))) (the-as time-frame (-> self fadeout-timeout))) ) ) (go-virtual fade) diff --git a/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc index 19fd398ae9..48a61961ed 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc @@ -979,8 +979,8 @@ ) ) (when (not arg0) - (let ((s5-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-1) (seconds 0.04)) + (let ((s5-1 (current-time))) + (until (>= (- (current-time) s5-1) (seconds 0.04)) (suspend) ) ) @@ -1137,14 +1137,14 @@ (drop-pickup (-> self fact) #t *entity-pool* (the-as fact-info #f) arg1) (process-entity-status! self (entity-perm-status dead) #t) (process-entity-status! self (entity-perm-status subtask-complete) #t) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 5)) (suspend) ) ) (when (logtest? (actor-option cond-respawn) (-> self fact options)) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 15)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 15)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/dark-eco-pool_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/dark-eco-pool_REF.gc index af1dfb70b5..de0ba6efc7 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/dark-eco-pool_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/dark-eco-pool_REF.gc @@ -322,7 +322,7 @@ ) ) (let* ((gp-0 (-> self draw ripple)) - (f0-1 (the float (logand (-> self clock frame-counter) #xffff))) + (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-9 (fmax -1.0 (fmin 1.0 f0-7))) diff --git a/test/decompiler/reference/jak2/engine/common_objs/elevator_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/elevator_REF.gc index addd1057a1..37cf5dc7e4 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/elevator_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/elevator_REF.gc @@ -321,7 +321,7 @@ which is obviously useful for an elevator." ((= evt-type 'ridden) (let ((proc-focus (handle->process (-> (the-as focus (-> event param 0)) handle)))) (if (= (-> proc-focus type) target) - (set! (-> self sticky-player-last-ride-time) (-> self clock frame-counter)) + (set! (-> self sticky-player-last-ride-time) (current-time)) ) ) #t @@ -421,7 +421,7 @@ which is obviously useful for an elevator." (+ (-> self move-pos 0) (* (-> self path-pos) (- (-> self move-pos 1) (-> self move-pos 0)))) ) (('player-standing-on?) - (= (-> self sticky-player-last-ride-time) (-> self clock frame-counter)) + (= (-> self sticky-player-last-ride-time) (current-time)) ) (('point-inside-shaft?) (move-between-points self (the-as vector (-> event param 1)) (-> self bottom-top 1) (-> self bottom-top 0)) @@ -600,7 +600,7 @@ do so. ) ) :enter (behavior () - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (logclear! (-> self elevator-status) (elevator-status waiting-to-descend moving)) (logior! (-> self mask) (process-mask actor-pause)) (if (nonzero? (-> self sound)) @@ -611,7 +611,7 @@ do so. :trans (behavior () (plat-trans) (when (not (logtest? (-> self elevator-status) (elevator-status waiting-to-descend))) - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (-> self params) (if (and (logtest? (-> self params flags) (elevator-flags elevator-flags-0)) (not (logtest? (-> self params flags) (elevator-flags elevator-flags-3))) @@ -620,7 +620,7 @@ do so. ) ) (when (and (not (logtest? (-> self params flags) (elevator-flags elevator-flags-3))) - (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 1)) + (>= (- (current-time) (-> self ride-timer)) (seconds 1)) ) (set! (-> self move-pos 0) (-> self move-pos 1)) (set! (-> self move-pos 1) (-> self path-seq data (the int (-> self move-pos 1)) next-pos)) @@ -753,7 +753,7 @@ do so. :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('ridden) - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (elevator-event proc arg1 event-type event) ) (else @@ -762,7 +762,7 @@ do so. ) ) :enter (behavior () - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (if (not (-> *setting-control* user-current jump)) (remove-setting! 'jump) ) @@ -778,10 +778,10 @@ do so. (begin *target* *target*) (focus-test? *target* in-air) ) - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) ) (when (or (logtest? (-> self elevator-status) (elevator-status moving)) - (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 0.5)) + (>= (- (current-time) (-> self ride-timer)) (seconds 0.5)) ) (cond ((and (logtest? (-> self params flags) (elevator-flags elevator-flags-1)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc index 54485f5715..d6b131ae56 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc @@ -231,8 +231,8 @@ (move-along-path self) (suspend) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.5)) (move-along-path self) (suspend) ) @@ -1371,9 +1371,9 @@ This commonly includes things such as: ) ) :code (behavior () - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (while (or (zero? (-> self duration)) - (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self duration))) + (< (- (current-time) (-> self start-time)) (the-as time-frame (-> self duration))) ) (if (-> self callback) ((-> self callback) self) @@ -1402,8 +1402,8 @@ This commonly includes things such as: ) (suspend) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (the-as time-frame (-> self linger-duration))) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (the-as time-frame (-> self linger-duration))) (if (-> self linger-callback) ((-> self linger-callback) self) ) @@ -1529,20 +1529,18 @@ This commonly includes things such as: ;; definition for function part-tracker-move-to-target (defun part-tracker-move-to-target ((arg0 part-tracker)) - (with-pp - (let* ((a0-1 *target*) - (a2-0 (if (not a0-1) - (-> arg0 root trans) - (get-trans a0-1 3) - ) - ) - ) - (vector-lerp! - (-> arg0 root trans) - (-> arg0 offset) - a2-0 - (* 0.006666667 (the float (- (-> pp clock frame-counter) (-> arg0 start-time)))) - ) + (let* ((a0-1 *target*) + (a2-0 (if (not a0-1) + (-> arg0 root trans) + (get-trans a0-1 3) + ) + ) + ) + (vector-lerp! + (-> arg0 root trans) + (-> arg0 offset) + a2-0 + (* 0.006666667 (the float (- (current-time) (-> arg0 start-time)))) ) ) ) @@ -1721,7 +1719,7 @@ This commonly includes things such as: :code (behavior () (set! (-> self sound) (the-as uint 0)) (when (!= (+ (-> self lightning spec delay) (-> self lightning spec delay-rand)) 0.0) - (let ((gp-0 (-> self clock frame-counter)) + (let ((gp-0 (current-time)) (s5-0 (the int (rand-vu-float-range (-> self lightning spec delay) (+ (-> self lightning spec delay) (-> self lightning spec delay-rand)) @@ -1729,7 +1727,7 @@ This commonly includes things such as: ) ) ) - (while (< (- (-> self clock frame-counter) gp-0) s5-0) + (while (< (- (current-time) gp-0) s5-0) (suspend) ) ) @@ -1778,9 +1776,9 @@ This commonly includes things such as: ) (set! (-> v1-33 state mode) (the-as lightning-mode a0-10)) ) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (while (or (zero? (-> self duration)) - (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self duration))) + (< (- (current-time) (-> self start-time)) (the-as time-frame (-> self duration))) ) (update self) (suspend) @@ -1805,8 +1803,8 @@ This commonly includes things such as: ) (set! (-> v1-47 state mode) (the-as lightning-mode a0-14)) ) - (set! (-> self start-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self start-time)) (the int f30-0)) + (set! (-> self start-time) (current-time)) + (while (< (- (current-time) (-> self start-time)) (the int f30-0)) (suspend) ) ) @@ -2580,12 +2578,12 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) + (let ((gp-0 (current-time))) (until #f (when (not (paused?)) (vector--float*! (-> self trans) (-> *camera* tpos-curr) (-> *camera* local-down) 28672.0) (send-event *camera* 'teleport) - (if (and (-> *camera* on-ground) (>= (- (-> self clock frame-counter) gp-0) (seconds 1))) + (if (and (-> *camera* on-ground) (>= (- (current-time) gp-0) (seconds 1))) (send-event *camera* 'change-state cam-string (seconds 0.5)) ) ) @@ -2647,7 +2645,7 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) + (let ((gp-0 (current-time))) (until #f (when (not (paused?)) (let ((s4-0 (new 'stack-no-clear 'vector)) @@ -2689,7 +2687,7 @@ This commonly includes things such as: (set! (-> self trans x) (-> *camera* tpos-curr x)) (set! (-> self trans z) (-> *camera* tpos-curr z)) (vector+! (-> self trans) (-> self trans) (-> self view-flat)) - (if (and (-> *camera* on-ground) (>= (- (-> self clock frame-counter) gp-0) (seconds 1))) + (if (and (-> *camera* on-ground) (>= (- (current-time) gp-0) (seconds 1))) (send-event *camera* 'change-state cam-string (seconds 0.5)) ) ) @@ -2764,7 +2762,7 @@ This commonly includes things such as: :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (when (or (= event-type 'touch) (= event-type 'attack)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (send-event proc 'launch (-> self spring-height) (-> self camera) (-> self dest) (-> self seek-time)) ) (the-as object (cond @@ -2809,7 +2807,7 @@ This commonly includes things such as: (not (logtest? (focus-status teleporting) (-> *target* focus-status))) ) ) - (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (< (- (current-time) (-> self state-time)) (seconds 0.5)) ) (send-event *target* 'launch (-> self spring-height) (-> self camera) (-> self dest) (-> self seek-time)) ) @@ -3043,7 +3041,7 @@ This commonly includes things such as: ) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (while ((-> self run-function)) (let* ((gp-0 (handle->process (-> self target))) (a0-4 (if (type? gp-0 process-drawable) @@ -3101,17 +3099,18 @@ This commonly includes things such as: ) (let ((v1-6 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) (set! (-> v1-6 prim-core collide-as) (collide-spec jak enemy)) - (set! (-> v1-6 prim-core collide-with) (collide-spec - crate - civilian - enemy - obstacle - vehicle-sphere - hit-by-player-list - hit-by-others-list - collectable - pusher - ) + (set! (-> v1-6 prim-core collide-with) + (collide-spec + crate + civilian + enemy + obstacle + vehicle-sphere + hit-by-player-list + hit-by-others-list + collectable + pusher + ) ) (set-vector! (-> v1-6 local-sphere) 0.0 0.0 0.0 arg1) (set! (-> s4-0 total-prims) (the-as uint 1)) @@ -3130,10 +3129,8 @@ This commonly includes things such as: (set! (-> self target) (the-as handle #f)) (set! (-> self event) #f) (set! (-> self callback) #f) - (set! (-> self run-function) (lambda :behavior touch-tracker - () - (< (- (-> self clock frame-counter) (-> self state-time)) (-> self duration)) - ) + (set! (-> self run-function) + (lambda :behavior touch-tracker () (< (- (current-time) (-> self state-time)) (-> self duration))) ) (set! (-> self event-hook) (-> (method-of-object self active) event)) (go-virtual active) @@ -3278,7 +3275,7 @@ This commonly includes things such as: ) ) :code (behavior () - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (update-transforms (-> self root-override)) (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) (set! (-> a1-0 options) (overlaps-others-options)) @@ -3291,14 +3288,14 @@ This commonly includes things such as: (set! (-> v1-9 prim-core collide-with) (collide-spec)) ) 0 - (while (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self duration))) + (while (< (- (current-time) (-> self start-time)) (the-as time-frame (-> self duration))) (let ((a1-1 (-> self root-override trans))) (spawn (-> self part) a1-1) ) (suspend) ) - (set! (-> self start-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self linger-duration))) + (set! (-> self start-time) (current-time)) + (while (< (- (current-time) (-> self start-time)) (the-as time-frame (-> self linger-duration))) (suspend) ) (none) diff --git a/test/decompiler/reference/jak2/engine/common_objs/plat_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/plat_REF.gc index 5927d49861..c7aac8a3ed 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/plat_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/plat_REF.gc @@ -299,10 +299,10 @@ This commonly includes things such as: ) (cond ((and proc-focus (focus-test? proc-focus edge-grab)) - (set! (-> self safe-time) (+ (-> self clock frame-counter) (seconds 0.2))) + (set! (-> self safe-time) (+ (current-time) (seconds 0.2))) (return (the-as object #f)) ) - ((< (- (-> self clock frame-counter) (-> self safe-time)) (seconds 0.05)) + ((< (- (current-time) (-> self safe-time)) (seconds 0.05)) (return (the-as object #f)) ) ) @@ -346,7 +346,7 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('edge-grabbed) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (send-event proc 'end-mode) ) ) @@ -356,7 +356,7 @@ This commonly includes things such as: ) ) :enter (behavior ((arg0 symbol)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () diff --git a/test/decompiler/reference/jak2/engine/common_objs/powerups_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/powerups_REF.gc index df46985e36..9ac7d36b3b 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/powerups_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/powerups_REF.gc @@ -16,19 +16,14 @@ (let ((s1-1 (process->handle arg0)) (s2-1 (process->handle arg1)) ) - (let ((s0-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s0-0) (+ arg3 arg4)) + (let ((s0-0 (current-time))) + (until (>= (- (current-time) s0-0) (+ arg3 arg4)) (let ((v1-8 (or (not (handle->process s1-1)) (not (handle->process s2-1))))) (if v1-8 (deactivate self) ) ) - (let* ((f0-1 - (fmax - 0.0 - (fmin 1.0 (/ (- (the float (- (-> self clock frame-counter) s0-0)) (the float arg3)) (the float arg4))) - ) - ) + (let* ((f0-1 (fmax 0.0 (fmin 1.0 (/ (- (the float (- (current-time) s0-0)) (the float arg3)) (the float arg4))))) (a0-18 (process-drawable-pair-random-point! (the-as process-drawable (-> s1-1 process 0)) (the-as process-drawable (-> s2-1 process 0)) @@ -50,8 +45,8 @@ #f ) (else - (let ((s4-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-1) arg5) + (let ((s4-1 (current-time))) + (until (>= (- (current-time) s4-1) arg5) (let ((a0-21 (process-drawable-random-point! (the-as process-drawable (-> s2-1 process 0)) (new-stack-vector0)))) (arg2 a0-21) ) @@ -775,9 +770,8 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defbehavior target-color-effect-process target () - (when (and (-> self color-effect) (>= (- (-> self clock frame-counter) (-> self color-effect-start-time)) - (the-as time-frame (-> self color-effect-duration)) - ) + (when (and (-> self color-effect) + (>= (- (current-time) (-> self color-effect-start-time)) (the-as time-frame (-> self color-effect-duration))) ) (set! (-> self color-effect) #f) (set-vector! (-> self draw color-mult) 1.0 1.0 1.0 1.0) @@ -793,7 +787,7 @@ (let ((f30-0 (lerp-scale 1.0 0.0 - (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (the float (- (current-time) (-> self color-effect-start-time))) (* 0.25 (the float (-> self color-effect-duration))) (the float (-> self color-effect-duration)) ) @@ -807,7 +801,7 @@ (let ((f30-1 (lerp-scale 1.0 0.0 - (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (the float (- (current-time) (-> self color-effect-start-time))) (* 0.25 (the float (-> self color-effect-duration))) (the float (-> self color-effect-duration)) ) @@ -821,7 +815,7 @@ (let ((f30-2 (lerp-scale 1.0 0.0 - (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (the float (- (current-time) (-> self color-effect-start-time))) (* 0.25 (the float (-> self color-effect-duration))) (the float (-> self color-effect-duration)) ) @@ -835,7 +829,7 @@ (let ((f30-3 (lerp-scale 1.0 0.0 - (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (the float (- (current-time) (-> self color-effect-start-time))) (* 0.25 (the float (-> self color-effect-duration))) (the float (-> self color-effect-duration)) ) @@ -849,7 +843,7 @@ (let ((f30-4 (lerp-scale 1.0 0.0 - (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (the float (- (current-time) (-> self color-effect-start-time))) (* 0.25 (the float (-> self color-effect-duration))) (the float (-> self color-effect-duration)) ) @@ -863,7 +857,7 @@ (let ((f30-5 (lerp-scale 1.0 0.0 - (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (the float (- (current-time) (-> self color-effect-start-time))) (* 0.25 (the float (-> self color-effect-duration))) (the float (-> self color-effect-duration)) ) @@ -894,13 +888,13 @@ (if (and (logtest? (-> self water flags) (water-flags under-water)) (not (logtest? (-> self water flags) (water-flags swim-ground))) ) - (set! (-> self control unknown-time-frame26) (-> self clock frame-counter)) - (set! (-> self control unknown-time-frame27) (-> self clock frame-counter)) + (set! (-> self control unknown-time-frame26) (current-time)) + (set! (-> self control unknown-time-frame27) (current-time)) ) (cond ((and (= (-> self control ground-pat material) (pat-material ice)) (and (>= (-> self control ctrl-xz-vel) 204.8) - (< (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.05)) + (< (- (current-time) (-> self control last-time-on-surface)) (seconds 0.05)) ) ) (let ((gp-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 38)))) @@ -1002,7 +996,7 @@ (cond ((logtest? (-> self game features) (game-feature unk-game-feature-01)) (cond - ((< (-> self clock frame-counter) (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout)) + ((< (current-time) (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout)) (set-setting! 'bg-a 'abs 0.3 0) (set-setting! 'bg-r 'abs 1.0 0) (update-rates! (-> *display* entity-clock) 0.0) @@ -1018,9 +1012,7 @@ 0 ) ((cpad-pressed? (-> self control cpad number) r1) - (set! (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout) - (+ (-> self clock frame-counter) (seconds 5)) - ) + (set! (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout) (+ (current-time) (seconds 5))) ) ) ) @@ -1135,9 +1127,7 @@ ((or (and (logtest? (-> self control mod-surface flags) (surface-flag air)) (not (logtest? (-> self control status) (collide-status on-surface))) ) - (and (focus-test? self board) - (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) - ) + (and (focus-test? self board) (< (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1))) ) (logior! (-> self focus-status) (focus-status in-air)) (if (logtest? (surface-flag super) (-> self control current-surface flags)) @@ -1172,7 +1162,7 @@ (set! (-> self focus-status) (logior (focus-status ice) (-> self focus-status))) (logclear! (-> self focus-status) (focus-status ice)) ) - (if (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 0.1)) + (if (< (- (current-time) (-> self gun fire-time)) (seconds 0.1)) (set! (-> self focus-status) (logior (focus-status shooting) (-> self focus-status))) (logclear! (-> self focus-status) (focus-status shooting)) ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/projectile_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/projectile_REF.gc index b353fbc197..e8369a5cc0 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/projectile_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/projectile_REF.gc @@ -317,7 +317,7 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self spawn-time)) (-> self timeout)) + (if (>= (- (current-time) (-> self spawn-time)) (-> self timeout)) (go-virtual dissipate) ) (let ((t9-1 (-> self pick-target))) @@ -509,7 +509,7 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p (set! (-> self last-target) (the-as handle #f)) (set! (-> self timeout) (-> arg0 timeout)) (set! (-> self max-hits) 1) - (set! (-> self spawn-time) (-> self clock frame-counter)) + (set! (-> self spawn-time) (current-time)) (set! (-> self update-velocity) #f) (set! (-> self move) projectile-move-fill-line-sphere) (set! (-> self pick-target) #f) @@ -597,7 +597,7 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p ) :trans (behavior () (noop self) - (if (>= (- (-> self clock frame-counter) (-> self spawn-time)) (-> self timeout)) + (if (>= (- (current-time) (-> self spawn-time)) (-> self timeout)) (go-virtual impact) ) (none) @@ -669,9 +669,9 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p (vector-float*! (-> a2-0 transv) (-> a2-0 transv) 0.6) ) (when (and (logtest? v1-0 (collide-status impact-surface)) - (>= (- (-> self clock frame-counter) (-> obj played-bounce-time)) (seconds 0.3)) + (>= (- (current-time) (-> obj played-bounce-time)) (seconds 0.3)) ) - (set! (-> obj played-bounce-time) (-> self clock frame-counter)) + (set! (-> obj played-bounce-time) (current-time)) (sound-play "dark-shot-bounc") ) ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/rigid-body-plat_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/rigid-body-plat_REF.gc index 794f3f0865..9030ef2c3a 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/rigid-body-plat_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/rigid-body-plat_REF.gc @@ -391,10 +391,10 @@ ) ) (('bonk) - (when (>= (- (-> self clock frame-counter) (the-as int (-> obj player-bonk-timeout))) + (when (>= (- (current-time) (the-as int (-> obj player-bonk-timeout))) (the-as time-frame (-> obj info-override player-force-timeout)) ) - (set! (-> obj player-bonk-timeout) (the-as uint (-> self clock frame-counter))) + (set! (-> obj player-bonk-timeout) (the-as uint (current-time))) (let* ((s4-0 arg0) (v1-31 (if (type? s4-0 process-drawable) s4-0 @@ -455,31 +455,29 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod alloc-and-init-rigid-body-control rigid-body-platform ((obj rigid-body-platform) (arg0 rigid-body-object-constants)) - (with-pp - (set! (-> obj info-override) (the-as rigid-body-platform-constants arg0)) - (set! (-> obj rbody) (new 'process 'rigid-body-control obj)) - (set! (-> obj control-point-array) - (new 'process 'rigid-body-control-point-inline-array (-> obj info-override control-point-count)) - ) - (update-transforms (-> obj root-override-2)) - (let ((v1-5 (-> obj rbody)) - (a1-3 (-> obj info-override info)) - (a2-2 (-> obj root-override-2 trans)) - (a3-0 (-> obj root-override-2 quat)) - (t0-0 (method-of-object obj rigid-body-object-method-29)) - ) - (rigid-body-method-25 (-> v1-5 state) a1-3 a2-2 a3-0 t0-0) - ) - (set! (-> obj player-bonk-timeout) (the-as uint (-> pp clock frame-counter))) - (set! (-> obj player-force quad) (-> *null-vector* quad)) - (set! (-> obj player-velocity quad) (-> *null-vector* quad)) - (set! (-> obj player-velocity-prev quad) (-> *null-vector* quad)) - (set! (-> obj root-override-2 max-iteration-count) (the-as uint 4)) - (set! (-> obj max-time-step) (-> arg0 extra max-time-step)) - (set! (-> obj water-anim) (the-as water-anim (entity-actor-lookup (-> obj entity) 'water-actor 0))) - 0 - (none) + (set! (-> obj info-override) (the-as rigid-body-platform-constants arg0)) + (set! (-> obj rbody) (new 'process 'rigid-body-control obj)) + (set! (-> obj control-point-array) + (new 'process 'rigid-body-control-point-inline-array (-> obj info-override control-point-count)) + ) + (update-transforms (-> obj root-override-2)) + (let ((v1-5 (-> obj rbody)) + (a1-3 (-> obj info-override info)) + (a2-2 (-> obj root-override-2 trans)) + (a3-0 (-> obj root-override-2 quat)) + (t0-0 (method-of-object obj rigid-body-object-method-29)) + ) + (rigid-body-method-25 (-> v1-5 state) a1-3 a2-2 a3-0 t0-0) ) + (set! (-> obj player-bonk-timeout) (the-as uint (current-time))) + (set! (-> obj player-force quad) (-> *null-vector* quad)) + (set! (-> obj player-velocity quad) (-> *null-vector* quad)) + (set! (-> obj player-velocity-prev quad) (-> *null-vector* quad)) + (set! (-> obj root-override-2 max-iteration-count) (the-as uint 4)) + (set! (-> obj max-time-step) (-> arg0 extra max-time-step)) + (set! (-> obj water-anim) (the-as water-anim (entity-actor-lookup (-> obj entity) 'water-actor 0))) + 0 + (none) ) ;; definition for method 32 of type rigid-body-platform diff --git a/test/decompiler/reference/jak2/engine/common_objs/voicebox_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/voicebox_REF.gc index f6100bbdb5..32a68bdad8 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/voicebox_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/voicebox_REF.gc @@ -203,9 +203,7 @@ (set! (-> a1-2 quad) (-> self parent-override 0 trans quad)) (vector-lerp! (-> self root trans) a1-2 s5-0 (-> self blend)) ) - (+! (-> self root trans y) - (* 1638.4 (sin (* 54.613335 (the float (mod (-> self clock frame-counter) 1200))))) - ) + (+! (-> self root trans y) (* 1638.4 (sin (* 54.613335 (the float (mod (current-time) 1200)))))) (let ((s5-1 (new 'stack-no-clear 'quaternion))) (forward-up->quaternion s5-1 @@ -422,14 +420,13 @@ :virtual #t :code (behavior () (remove-setting! 'sound-flava) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self seeker target) 1.0) - (while (and (< (-> self blend) 0.9999) - (not (and (not (handle->process (-> self hint))) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) - (-> *setting-control* user-current hint) - ) - ) + (while (and (< (-> self blend) 0.9999) (not (and (not (handle->process (-> self hint))) + (>= (- (current-time) (-> self state-time)) (seconds 0.05)) + (-> *setting-control* user-current hint) + ) + ) ) (update! (-> self seeker) 0.0) (set! (-> self blend) (-> self seeker value)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc index 6b2f0c4853..778c74fe68 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc @@ -799,7 +799,7 @@ (and (>= (-> obj height) (-> obj bottom 0 y)) (logtest? (water-flags touch-water) (-> s5-0 flags))) ) (if (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (collide-status on-water)) - (set! (-> obj on-water-time) (-> pp clock frame-counter)) + (set! (-> obj on-water-time) (current-time)) ) (when (not (logtest? (-> obj flags) (water-flags dark-eco lava))) (set! (-> obj drip-wetness) 1.0) @@ -821,9 +821,7 @@ ) (set! (-> obj flags) (logior (water-flags break-surface) (-> obj flags))) (set! (-> s3-0 y) (+ 40.96 (-> obj surface-height))) - (when (and (not (handle->process (-> obj ripple))) - (>= (+ (-> pp clock frame-counter) (seconds -1.5)) (-> obj enter-water-time)) - ) + (when (and (not (handle->process (-> obj ripple))) (>= (+ (current-time) (seconds -1.5)) (-> obj enter-water-time))) (let* ((s1-0 (get-process *default-dead-pool* manipy #x4000)) (s2-0 (when s1-0 @@ -952,7 +950,7 @@ ) (when (< (-> s3-1 y) (-> obj surface-height)) (set! (-> *part-id-table* 502 init-specs 16 initial-valuef) (-> obj surface-height)) - (let ((f0-72 (lerp-scale 12.0 0.4 (the float (- (-> pp clock frame-counter) (-> obj enter-water-time))) 0.0 600.0)) + (let ((f0-72 (lerp-scale 12.0 0.4 (the float (- (current-time) (-> obj enter-water-time))) 0.0 600.0)) (f1-26 0.00012207031) (v1-222 (-> obj process control transv)) ) @@ -992,7 +990,7 @@ s3-2 ) ) - (v1-237 (and v1-236 (< (- (-> pp clock frame-counter) (-> v1-236 last-time-on-surface)) (seconds 0.5)))) + (v1-237 (and v1-236 (< (- (current-time) (-> v1-236 last-time-on-surface)) (seconds 0.5)))) ) (if (and (logtest? (-> obj flags) (water-flags swim-ground)) (and v1-237 @@ -1018,7 +1016,7 @@ ) (< f0-84 (sqrtf (+ (* (-> a0-112 x) (-> a0-112 x)) (* (-> a0-112 z) (-> a0-112 z))))) ) - (< (+ (-> pp clock frame-counter) (seconds -0.2)) (-> obj enter-water-time)) + (< (+ (current-time) (seconds -0.2)) (-> obj enter-water-time)) (or (>= (+ (- 204.8 (fmin 6144.0 (+ (-> obj ocean-offset) (-> obj bob-offset) (-> obj align-offset)))) f30-1) (-> obj bottom 0 y) ) @@ -1026,11 +1024,11 @@ ) ) ) - (set! (-> obj swim-time) (-> pp clock frame-counter)) + (set! (-> obj swim-time) (current-time)) (send-event (-> obj process) 'swim) (set! (-> obj flags) (logior (water-flags swimming) (-> obj flags))) (if (not (logtest? (water-flags swimming) s4-0)) - (set! (-> obj enter-swim-time) (-> pp clock frame-counter)) + (set! (-> obj enter-swim-time) (current-time)) ) (cond ((and (logtest? (-> obj flags) (water-flags swim-ground)) @@ -1064,13 +1062,13 @@ ((begin (set! v1-237 (and (logtest? (-> obj flags) (water-flags can-wade)) - (or (not (!= (-> obj bob amp) 0.0)) (>= (- (-> pp clock frame-counter) (-> obj swim-time)) (seconds 0.05))) + (or (not (!= (-> obj bob amp) 0.0)) (>= (- (current-time) (-> obj swim-time)) (seconds 0.05))) (and (>= (- (-> obj height) (-> obj wade-height)) (-> obj bottom 0 y)) v1-237) ) ) v1-237 ) - (set! (-> obj wade-time) (-> pp clock frame-counter)) + (set! (-> obj wade-time) (current-time)) (send-event (-> obj process) 'wade) (set! (-> obj flags) (logior (water-flags wading) (-> obj flags))) ) @@ -1203,7 +1201,7 @@ (t9-35 a0-208 a1-61 a2-22 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) - (set! (-> obj drip-time) (-> pp clock frame-counter)) + (set! (-> obj drip-time) (current-time)) (logclear! (-> obj flags) (water-flags spawn-drip)) (seek! (-> obj drip-wetness) 0.0 (* 0.001 (-> obj drip-speed))) (set! (-> obj drip-speed) (* 1.05 (-> obj drip-speed))) @@ -1211,9 +1209,7 @@ (set! (-> obj drip-height) 0.0) ) ) - ((>= (- (-> pp clock frame-counter) - (the-as time-frame (the int (/ (the float (-> obj drip-time)) (-> obj drip-mult)))) - ) + ((>= (- (current-time) (the-as time-frame (the int (/ (the float (-> obj drip-time)) (-> obj drip-mult))))) (the int (-> obj drip-speed)) ) (let* ((s5-1 (rand-vu-int-range 3 (+ (-> obj process node-list length) -1))) @@ -1337,7 +1333,7 @@ (with-pp (set! (-> obj flags) (logior (water-flags touch-water) (-> obj flags))) (logclear! (-> obj flags) (water-flags jump-out)) - (set! (-> obj enter-water-time) (-> pp clock frame-counter)) + (set! (-> obj enter-water-time) (current-time)) (set-vector! (-> obj enter-water-pos) (-> obj bottom 0 x) (-> obj surface-height) (-> obj bottom 0 z) 1.0) (when (and (logtest? (water-flags part-splash) (-> obj flags)) (logtest? (water-flags part-water) (-> obj flags))) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) @@ -1474,41 +1470,39 @@ ;; definition for method 13 of type water-control ;; WARN: Return type mismatch int vs none. (defmethod spawn-ripples water-control ((obj water-control) (arg0 float) (arg1 vector) (arg2 int) (arg3 vector) (arg4 symbol)) - (with-pp - (when (and (logtest? (water-flags part-splash) (-> obj flags)) (logtest? (water-flags part-water) (-> obj flags))) - (let ((s4-1 (vector+float*! (new 'stack-no-clear 'vector) arg1 arg3 0.05))) - (set! (-> s4-1 y) (+ 40.96 (-> obj surface-height))) - (if (>= (- (-> pp clock frame-counter) (-> obj distort-time)) (seconds 0.1)) - (splash-spawn arg0 s4-1 arg2) - ) - (when (and arg4 (>= (- (-> pp clock frame-counter) (-> obj distort-time)) (seconds 0.3))) - (set! (-> obj distort-time) (-> pp clock frame-counter)) - (let ((s3-1 (process-spawn - manipy - :init manipy-init - s4-1 - (-> obj process entity) - (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f)) - #f - 0 - :to (-> obj process) - ) + (when (and (logtest? (water-flags part-splash) (-> obj flags)) (logtest? (water-flags part-water) (-> obj flags))) + (let ((s4-1 (vector+float*! (new 'stack-no-clear 'vector) arg1 arg3 0.05))) + (set! (-> s4-1 y) (+ 40.96 (-> obj surface-height))) + (if (>= (- (current-time) (-> obj distort-time)) (seconds 0.1)) + (splash-spawn arg0 s4-1 arg2) + ) + (when (and arg4 (>= (- (current-time) (-> obj distort-time)) (seconds 0.3))) + (set! (-> obj distort-time) (current-time)) + (let ((s3-1 (process-spawn + manipy + :init manipy-init + s4-1 + (-> obj process entity) + (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f)) + #f + 0 + :to (-> obj process) ) - ) - (when s3-1 - (send-event (ppointer->process s3-1) 'anim-mode 'play1) - (send-event (ppointer->process s3-1) 'anim "idle") - (let ((f0-4 (fmax 0.6 (fmin 1.0 (* 2.0 arg0))))) - (set-vector! (-> (the-as process-drawable (-> s3-1 0)) root scale) f0-4 0.5 f0-4 1.0) - ) + ) + ) + (when s3-1 + (send-event (ppointer->process s3-1) 'anim-mode 'play1) + (send-event (ppointer->process s3-1) 'anim "idle") + (let ((f0-4 (fmax 0.6 (fmin 1.0 (* 2.0 arg0))))) + (set-vector! (-> (the-as process-drawable (-> s3-1 0)) root scale) f0-4 0.5 f0-4 1.0) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for function water-info<-region diff --git a/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc b/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc index 97b4028dba..ce1a1f1bbb 100644 --- a/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc @@ -4363,34 +4363,30 @@ "Clear map" #f ,(lambda () - (let ((v1-1 - (process-spawn-function - process - (lambda () (with-pp - (set-master-mode 'game) - (let ((gp-0 (-> pp clock frame-counter))) - (until (>= (- (-> pp clock frame-counter) gp-0) (seconds 0.3)) - (suspend) - ) - ) - (until #f - (format *stdcon* "press x clear map, press circle cancel~%") - (cond - ((cpad-pressed? 0 x) - (initialize *bigmap*) - (return #f) - ) - ((cpad-pressed? 0 circle) - (return #f) - ) - ) - (suspend) - ) - #f - ) - ) - ) - ) + (let ((v1-1 (process-spawn-function process (lambda () + (set-master-mode 'game) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.3)) + (suspend) + ) + ) + (until #f + (format *stdcon* "press x clear map, press circle cancel~%") + (cond + ((cpad-pressed? 0 x) + (initialize *bigmap*) + (return #f) + ) + ((cpad-pressed? 0 circle) + (return #f) + ) + ) + (suspend) + ) + #f + ) + ) + ) ) (when v1-1 (let ((v0-3 (logclear (-> v1-1 0 mask) (process-mask menu)))) diff --git a/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc b/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc index 8e0238dfde..4ce9b97614 100644 --- a/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc @@ -1622,7 +1622,7 @@ (the-as object (deactivate self)) ) (('menu) - (set! v0-0 (+ (-> self clock frame-counter) (the-as time-frame (-> event param 0)))) + (set! v0-0 (+ (current-time) (the-as time-frame (-> event param 0)))) (set! (-> self close-menu-time) (the-as time-frame v0-0)) v0-0 ) @@ -1858,10 +1858,7 @@ (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons start)) ) ) - (when (or (and (= *master-mode* 'menu) - (> (-> self close-menu-time) 0) - (>= (-> self clock frame-counter) (-> self close-menu-time)) - ) + (when (or (and (= *master-mode* 'menu) (> (-> self close-menu-time) 0) (>= (current-time) (-> self close-menu-time))) (cpad-pressed? 1 start) ) (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) diff --git a/test/decompiler/reference/jak2/engine/entity/entity_REF.gc b/test/decompiler/reference/jak2/engine/entity/entity_REF.gc index ddedb54f4d..9384553ff6 100644 --- a/test/decompiler/reference/jak2/engine/entity/entity_REF.gc +++ b/test/decompiler/reference/jak2/engine/entity/entity_REF.gc @@ -71,7 +71,6 @@ ) ;; definition for method 3 of type actor-group -;; INFO: this function exists in multiple non-identical object files (defmethod inspect actor-group ((obj actor-group)) (format #t "[~8x] ~A~%" obj (-> obj type)) (format #t "~Tlength: ~D~%" (-> obj length)) @@ -531,7 +530,6 @@ ) ;; definition for method 2 of type process -;; INFO: this function exists in multiple non-identical object files (defmethod print process ((obj process)) (cond ((and (-> obj top-thread) (!= (-> obj status) 'dead)) @@ -1410,117 +1408,115 @@ (sv-112 pointer) (sv-128 int) ) - (with-pp - (let ((s4-0 *debug-actor-info*)) - (set! (-> s4-0 process) #f) - (if (zero? (-> s4-0 handle pid)) - (set! (-> s4-0 handle) - (logior (logand (-> s4-0 handle) (shl (the-as uint #xffffffff) 32)) (shr (shl (the-as int #f) 32) 32)) - ) - ) - (let ((v0-0 (handle->process (-> s4-0 handle)))) - (when (not v0-0) - (if (-> s4-0 name) - (set! v0-0 (process-by-name (the-as string (-> s4-0 name)) *active-pool*)) + (let ((s4-0 *debug-actor-info*)) + (set! (-> s4-0 process) #f) + (if (zero? (-> s4-0 handle pid)) + (set! (-> s4-0 handle) + (logior (logand (-> s4-0 handle) (shl (the-as uint #xffffffff) 32)) (shr (shl (the-as int #f) 32) 32)) ) - ) - (set! (-> s4-0 process) v0-0) ) - (set! *debug-actor* (-> s4-0 process)) - ) - (set! sv-16 arg0) - (when (and sv-16 (not (or (= *master-mode* 'menu) (= *master-mode* 'progress)))) - (cond - ((= sv-16 'process) - (let ((s5-1 draw-actor-marks)) - (iterate-process-tree *pusher-pool* (the-as (function object object) s5-1) *null-kernel-context*) - (iterate-process-tree *entity-pool* (the-as (function object object) s5-1) *null-kernel-context*) - ) - ) - (else - (dotimes (s5-2 (-> obj length)) - (let ((v1-25 (-> obj level s5-2))) - (when (= (-> v1-25 status) 'active) - (let ((s4-1 (-> v1-25 bsp level entity))) - (dotimes (s3-0 (-> s4-1 length)) - (let ((s2-0 (-> s4-1 data s3-0 entity))) - (set! sv-20 (-> s2-0 extra trans)) - (when (or (= sv-16 'full) (-> s2-0 extra process)) - (add-debug-x #t (bucket-id debug-no-zbuf1) sv-20 (if (-> s2-0 extra process) - (new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80) - (new 'static 'rgba :r #xff :a #x80) - ) - ) - (let ((s1-0 add-debug-text-3d) - (s0-0 #t) - ) - (set! sv-32 318) - (let ((a2-4 (res-lump-struct s2-0 'name structure)) - (a3-2 sv-20) - (t0-1 (if (logtest? (-> s2-0 extra perm status) (entity-perm-status bit-0 bit-1)) - 1 - 5 - ) - ) - (t1-1 (new 'static 'vector2h :data (new 'static 'array int16 2 0 8))) - ) - (s1-0 s0-0 (the-as bucket-id sv-32) (the-as string a2-4) a3-2 (the-as font-color t0-1) t1-1) - ) - ) - ) - ) - ) - ) - ) - ) + (let ((v0-0 (handle->process (-> s4-0 handle)))) + (when (not v0-0) + (if (-> s4-0 name) + (set! v0-0 (process-by-name (the-as string (-> s4-0 name)) *active-pool*)) ) - ) ) + (set! (-> s4-0 process) v0-0) ) - (when (and *display-actor-vis* (not *debug-actor*)) - (let ((s5-3 *display-actor-vis*)) - (dotimes (s4-2 (-> obj length)) - (let ((s3-1 (-> obj level s4-2))) - (when (= (-> s3-1 status) 'active) - (let ((s2-1 (-> s3-1 bsp level entity))) - (dotimes (s1-1 (-> s2-1 length)) - (let ((s0-1 (-> s2-1 data s1-1 entity))) - (let ((v0-6 (res-lump-data s0-1 'visvol pointer)) - (a1-10 (-> s0-1 extra vis-id)) - ) - (when (and v0-6 (or (= s5-3 #t) (= s5-3 'box))) - (set! sv-48 add-debug-box) - (set! sv-64 #t) - (set! sv-80 318) - (set! sv-96 (&+ v0-6 0)) - (set! sv-112 (&+ v0-6 16)) - (let ((t0-3 (if (is-object-visible? s3-1 a1-10) - (the-as uint #x80808000) - (the-as uint #x80800080) + (set! *debug-actor* (-> s4-0 process)) + ) + (set! sv-16 arg0) + (when (and sv-16 (not (or (= *master-mode* 'menu) (= *master-mode* 'progress)))) + (cond + ((= sv-16 'process) + (let ((s5-1 draw-actor-marks)) + (iterate-process-tree *pusher-pool* (the-as (function object object) s5-1) *null-kernel-context*) + (iterate-process-tree *entity-pool* (the-as (function object object) s5-1) *null-kernel-context*) + ) + ) + (else + (dotimes (s5-2 (-> obj length)) + (let ((v1-25 (-> obj level s5-2))) + (when (= (-> v1-25 status) 'active) + (let ((s4-1 (-> v1-25 bsp level entity))) + (dotimes (s3-0 (-> s4-1 length)) + (let ((s2-0 (-> s4-1 data s3-0 entity))) + (set! sv-20 (-> s2-0 extra trans)) + (when (or (= sv-16 'full) (-> s2-0 extra process)) + (add-debug-x #t (bucket-id debug-no-zbuf1) sv-20 (if (-> s2-0 extra process) + (new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80) + (new 'static 'rgba :r #xff :a #x80) + ) + ) + (let ((s1-0 add-debug-text-3d) + (s0-0 #t) + ) + (set! sv-32 318) + (let ((a2-4 (res-lump-struct s2-0 'name structure)) + (a3-2 sv-20) + (t0-1 (if (logtest? (-> s2-0 extra perm status) (entity-perm-status bit-0 bit-1)) + 1 + 5 ) ) + (t1-1 (new 'static 'vector2h :data (new 'static 'array int16 2 0 8))) ) - (sv-48 sv-64 (the-as bucket-id sv-80) (the-as vector sv-96) (the-as vector sv-112) (the-as rgba t0-3)) + (s1-0 s0-0 (the-as bucket-id sv-32) (the-as string a2-4) a3-2 (the-as font-color t0-1) t1-1) ) ) ) - (when (or (= s5-3 #t) (= s5-3 'sphere)) - (let ((s0-2 (-> s0-1 extra process))) - (when s0-2 - (when (and (type? s0-2 process-drawable) (nonzero? (-> (the-as process-drawable s0-2) draw))) - (add-debug-x - #t - (bucket-id debug-no-zbuf1) - (-> (the-as process-drawable s0-2) root trans) - (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) - ) - (add-debug-sphere - #t - (bucket-id debug2) - (-> (the-as process-drawable s0-2) draw origin) - (-> (the-as process-drawable s0-2) draw bounds w) - (new 'static 'rgba :r #x80 :a #x80) - ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (when (and *display-actor-vis* (not *debug-actor*)) + (let ((s5-3 *display-actor-vis*)) + (dotimes (s4-2 (-> obj length)) + (let ((s3-1 (-> obj level s4-2))) + (when (= (-> s3-1 status) 'active) + (let ((s2-1 (-> s3-1 bsp level entity))) + (dotimes (s1-1 (-> s2-1 length)) + (let ((s0-1 (-> s2-1 data s1-1 entity))) + (let ((v0-6 (res-lump-data s0-1 'visvol pointer)) + (a1-10 (-> s0-1 extra vis-id)) + ) + (when (and v0-6 (or (= s5-3 #t) (= s5-3 'box))) + (set! sv-48 add-debug-box) + (set! sv-64 #t) + (set! sv-80 318) + (set! sv-96 (&+ v0-6 0)) + (set! sv-112 (&+ v0-6 16)) + (let ((t0-3 (if (is-object-visible? s3-1 a1-10) + (the-as uint #x80808000) + (the-as uint #x80800080) + ) + ) + ) + (sv-48 sv-64 (the-as bucket-id sv-80) (the-as vector sv-96) (the-as vector sv-112) (the-as rgba t0-3)) + ) + ) + ) + (when (or (= s5-3 #t) (= s5-3 'sphere)) + (let ((s0-2 (-> s0-1 extra process))) + (when s0-2 + (when (and (type? s0-2 process-drawable) (nonzero? (-> (the-as process-drawable s0-2) draw))) + (add-debug-x + #t + (bucket-id debug-no-zbuf1) + (-> (the-as process-drawable s0-2) root trans) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + ) + (add-debug-sphere + #t + (bucket-id debug2) + (-> (the-as process-drawable s0-2) draw origin) + (-> (the-as process-drawable s0-2) draw bounds w) + (new 'static 'rgba :r #x80 :a #x80) ) ) ) @@ -1533,247 +1529,247 @@ ) ) ) - (if *generate-actor-vis* - (update-vis-volumes obj) - ) - (cond - (*debug-actor* - (let* ((s4-3 *debug-actor*) - (s5-4 (if (type? s4-3 process-drawable) - s4-3 - ) - ) - ) - (when s5-4 - (if (nonzero? (-> (the-as process-drawable s5-4) skel)) - (debug-print-channels (-> (the-as process-drawable s5-4) skel) (the-as symbol *stdcon*)) - ) - (when (and (nonzero? (-> (the-as process-drawable s5-4) nav)) - (-> (the-as process-drawable s5-4) nav) - *display-nav-marks* - ) - (let ((s4-4 (-> (the-as process-drawable s5-4) nav state flags))) - (if (= (logand s4-4 (nav-state-flag in-target-poly)) (nav-state-flag in-target-poly)) - (format *stdcon* "in-target-poly ") - ) - (if (= (logand s4-4 (nav-state-flag directional-mode)) (nav-state-flag directional-mode)) - (format *stdcon* "directional-mode ") - ) - (if (= (logand s4-4 (nav-state-flag initialized)) (nav-state-flag initialized)) - (format *stdcon* "initialized ") - ) - (if (= (logand s4-4 (nav-state-flag display-marks)) (nav-state-flag display-marks)) - (format *stdcon* "display-marks ") - ) - (if (= (logand s4-4 (nav-state-flag recovery-mode)) (nav-state-flag recovery-mode)) - (format *stdcon* "recovery-mode ") - ) - (if (= (logand s4-4 (nav-state-flag touching-sphere)) (nav-state-flag touching-sphere)) - (format *stdcon* "touching-sphere ") - ) - (if (= (logand s4-4 (nav-state-flag trapped-by-sphere)) (nav-state-flag trapped-by-sphere)) - (format *stdcon* "trapped-by-sphere ") - ) - (if (= (logand s4-4 (nav-state-flag blocked)) (nav-state-flag blocked)) - (format *stdcon* "blocked ") - ) - (if (= (logand s4-4 (nav-state-flag avoiding-sphere)) (nav-state-flag avoiding-sphere)) - (format *stdcon* "avoiding-sphere ") - ) - (if (= (logand s4-4 (nav-state-flag target-inside)) (nav-state-flag target-inside)) - (format *stdcon* "target-inside ") - ) - (if (= (logand s4-4 (nav-state-flag debug)) (nav-state-flag debug)) - (format *stdcon* "debug ") - ) - (if (= (logand s4-4 (nav-state-flag at-gap)) (nav-state-flag at-gap)) - (format *stdcon* "at-gap ") - ) - (if (= (logand s4-4 (nav-state-flag in-mesh)) (nav-state-flag in-mesh)) - (format *stdcon* "in-mesh ") - ) - (if (= (logand s4-4 (nav-state-flag at-target)) (nav-state-flag at-target)) - (format *stdcon* "at-target ") - ) - (if (= (logand s4-4 (nav-state-flag target-poly-dirty)) (nav-state-flag target-poly-dirty)) - (format *stdcon* "target-poly-dirty ") - ) - ) - (format *stdcon* "~%") - ) - (when *display-joint-axes* - (if (and (type? (the-as process-drawable s5-4) process-drawable) - (nonzero? (-> (the-as process-drawable s5-4) draw)) - ) - (draw-joint-axes (the-as process-drawable s5-4)) - ) - ) - (draw-actor-marks (the-as process-drawable s5-4)) - ) - ) - ) - (*display-nav-mesh* - (dotimes (s5-5 (-> obj length)) - (let ((v1-145 (-> obj level s5-5))) - (when (= (-> v1-145 status) 'active) - (let ((s4-5 (-> v1-145 bsp nav-meshes))) - (when (nonzero? s4-5) - (dotimes (s3-2 (-> s4-5 length)) - (let ((s2-2 (-> s4-5 s3-2))) - (if (name= *display-nav-mesh* (res-lump-struct s2-2 'name structure)) - (debug-draw s2-2) - ) - ) - ) - ) - ) - ) - ) - ) - ) - (else - (when *display-nav-marks* - (dotimes (s5-6 (-> obj length)) - (let ((v1-163 (-> obj level s5-6))) - (when (= (-> v1-163 status) 'active) - (let ((s4-6 (-> v1-163 bsp nav-meshes))) - (when (nonzero? s4-6) - (dotimes (s3-3 (-> s4-6 length)) - (debug-draw (-> s4-6 s3-3)) - ) - ) - ) - ) - ) - ) - ) - (if (or *display-path-marks* *display-vol-marks*) - (iterate-process-tree - *active-pool* - (the-as (function object object) (lambda ((arg0 process-drawable)) - (when (type? arg0 process-drawable) - (if (nonzero? (-> arg0 path)) - (debug-draw (-> arg0 path)) - ) - (if (nonzero? (-> arg0 vol)) - (debug-draw (-> arg0 vol)) - ) - ) - (none) - ) - ) - *null-kernel-context* - ) - ) - ) - ) - (when (and *display-actor-graph* (not (or (= *master-mode* 'menu) (= *master-mode* 'progress)))) - (if (not (paused?)) - (float-save-timeplot (if (< (the int (the float (mod (-> pp clock frame-counter) 600))) 300) - 1.0 - 0.0 - ) - ) - ) - (camera-plot-float-func - 0.0 - 399.0 - -81920.0 - 81920.0 - float-lookup-redline - (new 'static 'vector4w :x #xff :w #x80) - ) - (camera-plot-float-func - 0.0 - 399.0 - -81920.0 - 81920.0 - float-lookup-blueline - (new 'static 'vector4w :z #xff :w #x80) - ) - (camera-plot-float-func - 0.0 - 399.0 - -81920.0 - 81920.0 - float-lookup-greenline - (new 'static 'vector4w :y #xff :w #x80) - ) - (camera-plot-float-func - 0.0 - 399.0 - 0.0 - 409600.0 - float-lookup-yellowline - (new 'static 'vector4w :x #xff :y #xff :w #x80) - ) - (camera-plot-float-func - 0.0 - 399.0 - 0.0 - 1.0 - float-lookup-timeplot - (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w #x80) - ) - ) - (when *display-split-boxes* - (dotimes (s5-7 (-> obj length)) - (let ((v1-193 (-> obj level s5-7))) - (when (= (-> v1-193 status) 'active) - (let ((s4-7 (-> v1-193 bsp region-tree))) - (when (nonzero? s4-7) - (let* ((s3-4 (-> s4-7 data2 (+ (-> s4-7 length) -1) length)) - (s2-3 0) - (a0-102 (-> (the-as drawable-inline-array-region-prim (-> s4-7 data2 (+ (-> s4-7 length) -1))) data s2-3)) - ) - (while (< s2-3 s3-4) - (debug-draw-region a0-102 0) - (+! s2-3 1) - (set! a0-102 - (-> (the-as drawable-inline-array-region-prim (-> s4-7 data2 (+ (-> s4-7 length) -1))) data s2-3) - ) - ) - ) - ) - ) - ) - ) - ) - ) - (when *display-region-marks* - (dotimes (s5-8 (-> obj length)) - (let ((s4-8 (-> obj level s5-8))) - (when (= (-> s4-8 status) 'active) - (when (nonzero? (-> s4-8 bsp region-trees)) - (let* ((s3-5 (-> s4-8 bsp region-trees length)) - (s2-4 0) - (s1-3 (-> s4-8 bsp region-trees s2-4)) - ) - (while (< s2-4 s3-5) - (let ((s0-4 (-> s1-3 data2 (+ (-> s1-3 length) -1) length))) - (set! sv-128 0) - (let ((a0-117 (-> (the-as drawable-inline-array-region-prim (-> s1-3 data2 (+ (-> s1-3 length) -1))) data sv-128))) - (while (< sv-128 s0-4) - (debug-draw-region a0-117 0) - (set! sv-128 (+ sv-128 1)) - (set! a0-117 - (-> (the-as drawable-inline-array-region-prim (-> s1-3 data2 (+ (-> s1-3 length) -1))) data sv-128) - ) - ) - ) - ) - (+! s2-4 1) - (set! s1-3 (-> s4-8 bsp region-trees s2-4)) - ) - ) - ) - ) - ) - ) - ) - 0 - (none) ) + (if *generate-actor-vis* + (update-vis-volumes obj) + ) + (cond + (*debug-actor* + (let* ((s4-3 *debug-actor*) + (s5-4 (if (type? s4-3 process-drawable) + s4-3 + ) + ) + ) + (when s5-4 + (if (nonzero? (-> (the-as process-drawable s5-4) skel)) + (debug-print-channels (-> (the-as process-drawable s5-4) skel) (the-as symbol *stdcon*)) + ) + (when (and (nonzero? (-> (the-as process-drawable s5-4) nav)) + (-> (the-as process-drawable s5-4) nav) + *display-nav-marks* + ) + (let ((s4-4 (-> (the-as process-drawable s5-4) nav state flags))) + (if (= (logand s4-4 (nav-state-flag in-target-poly)) (nav-state-flag in-target-poly)) + (format *stdcon* "in-target-poly ") + ) + (if (= (logand s4-4 (nav-state-flag directional-mode)) (nav-state-flag directional-mode)) + (format *stdcon* "directional-mode ") + ) + (if (= (logand s4-4 (nav-state-flag initialized)) (nav-state-flag initialized)) + (format *stdcon* "initialized ") + ) + (if (= (logand s4-4 (nav-state-flag display-marks)) (nav-state-flag display-marks)) + (format *stdcon* "display-marks ") + ) + (if (= (logand s4-4 (nav-state-flag recovery-mode)) (nav-state-flag recovery-mode)) + (format *stdcon* "recovery-mode ") + ) + (if (= (logand s4-4 (nav-state-flag touching-sphere)) (nav-state-flag touching-sphere)) + (format *stdcon* "touching-sphere ") + ) + (if (= (logand s4-4 (nav-state-flag trapped-by-sphere)) (nav-state-flag trapped-by-sphere)) + (format *stdcon* "trapped-by-sphere ") + ) + (if (= (logand s4-4 (nav-state-flag blocked)) (nav-state-flag blocked)) + (format *stdcon* "blocked ") + ) + (if (= (logand s4-4 (nav-state-flag avoiding-sphere)) (nav-state-flag avoiding-sphere)) + (format *stdcon* "avoiding-sphere ") + ) + (if (= (logand s4-4 (nav-state-flag target-inside)) (nav-state-flag target-inside)) + (format *stdcon* "target-inside ") + ) + (if (= (logand s4-4 (nav-state-flag debug)) (nav-state-flag debug)) + (format *stdcon* "debug ") + ) + (if (= (logand s4-4 (nav-state-flag at-gap)) (nav-state-flag at-gap)) + (format *stdcon* "at-gap ") + ) + (if (= (logand s4-4 (nav-state-flag in-mesh)) (nav-state-flag in-mesh)) + (format *stdcon* "in-mesh ") + ) + (if (= (logand s4-4 (nav-state-flag at-target)) (nav-state-flag at-target)) + (format *stdcon* "at-target ") + ) + (if (= (logand s4-4 (nav-state-flag target-poly-dirty)) (nav-state-flag target-poly-dirty)) + (format *stdcon* "target-poly-dirty ") + ) + ) + (format *stdcon* "~%") + ) + (when *display-joint-axes* + (if (and (type? (the-as process-drawable s5-4) process-drawable) + (nonzero? (-> (the-as process-drawable s5-4) draw)) + ) + (draw-joint-axes (the-as process-drawable s5-4)) + ) + ) + (draw-actor-marks (the-as process-drawable s5-4)) + ) + ) + ) + (*display-nav-mesh* + (dotimes (s5-5 (-> obj length)) + (let ((v1-145 (-> obj level s5-5))) + (when (= (-> v1-145 status) 'active) + (let ((s4-5 (-> v1-145 bsp nav-meshes))) + (when (nonzero? s4-5) + (dotimes (s3-2 (-> s4-5 length)) + (let ((s2-2 (-> s4-5 s3-2))) + (if (name= *display-nav-mesh* (res-lump-struct s2-2 'name structure)) + (debug-draw s2-2) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (else + (when *display-nav-marks* + (dotimes (s5-6 (-> obj length)) + (let ((v1-163 (-> obj level s5-6))) + (when (= (-> v1-163 status) 'active) + (let ((s4-6 (-> v1-163 bsp nav-meshes))) + (when (nonzero? s4-6) + (dotimes (s3-3 (-> s4-6 length)) + (debug-draw (-> s4-6 s3-3)) + ) + ) + ) + ) + ) + ) + ) + (if (or *display-path-marks* *display-vol-marks*) + (iterate-process-tree + *active-pool* + (the-as (function object object) (lambda ((arg0 process-drawable)) + (when (type? arg0 process-drawable) + (if (nonzero? (-> arg0 path)) + (debug-draw (-> arg0 path)) + ) + (if (nonzero? (-> arg0 vol)) + (debug-draw (-> arg0 vol)) + ) + ) + (none) + ) + ) + *null-kernel-context* + ) + ) + ) + ) + (when (and *display-actor-graph* (not (or (= *master-mode* 'menu) (= *master-mode* 'progress)))) + (if (not (paused?)) + (float-save-timeplot (if (< (the int (the float (mod (current-time) 600))) 300) + 1.0 + 0.0 + ) + ) + ) + (camera-plot-float-func + 0.0 + 399.0 + -81920.0 + 81920.0 + float-lookup-redline + (new 'static 'vector4w :x #xff :w #x80) + ) + (camera-plot-float-func + 0.0 + 399.0 + -81920.0 + 81920.0 + float-lookup-blueline + (new 'static 'vector4w :z #xff :w #x80) + ) + (camera-plot-float-func + 0.0 + 399.0 + -81920.0 + 81920.0 + float-lookup-greenline + (new 'static 'vector4w :y #xff :w #x80) + ) + (camera-plot-float-func + 0.0 + 399.0 + 0.0 + 409600.0 + float-lookup-yellowline + (new 'static 'vector4w :x #xff :y #xff :w #x80) + ) + (camera-plot-float-func + 0.0 + 399.0 + 0.0 + 1.0 + float-lookup-timeplot + (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w #x80) + ) + ) + (when *display-split-boxes* + (dotimes (s5-7 (-> obj length)) + (let ((v1-193 (-> obj level s5-7))) + (when (= (-> v1-193 status) 'active) + (let ((s4-7 (-> v1-193 bsp region-tree))) + (when (nonzero? s4-7) + (let* ((s3-4 (-> s4-7 data2 (+ (-> s4-7 length) -1) length)) + (s2-3 0) + (a0-102 (-> (the-as drawable-inline-array-region-prim (-> s4-7 data2 (+ (-> s4-7 length) -1))) data s2-3)) + ) + (while (< s2-3 s3-4) + (debug-draw-region a0-102 0) + (+! s2-3 1) + (set! a0-102 + (-> (the-as drawable-inline-array-region-prim (-> s4-7 data2 (+ (-> s4-7 length) -1))) data s2-3) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (when *display-region-marks* + (dotimes (s5-8 (-> obj length)) + (let ((s4-8 (-> obj level s5-8))) + (when (= (-> s4-8 status) 'active) + (when (nonzero? (-> s4-8 bsp region-trees)) + (let* ((s3-5 (-> s4-8 bsp region-trees length)) + (s2-4 0) + (s1-3 (-> s4-8 bsp region-trees s2-4)) + ) + (while (< s2-4 s3-5) + (let ((s0-4 (-> s1-3 data2 (+ (-> s1-3 length) -1) length))) + (set! sv-128 0) + (let ((a0-117 (-> (the-as drawable-inline-array-region-prim (-> s1-3 data2 (+ (-> s1-3 length) -1))) data sv-128))) + (while (< sv-128 s0-4) + (debug-draw-region a0-117 0) + (set! sv-128 (+ sv-128 1)) + (set! a0-117 + (-> (the-as drawable-inline-array-region-prim (-> s1-3 data2 (+ (-> s1-3 length) -1))) data sv-128) + ) + ) + ) + ) + (+! s2-4 1) + (set! s1-3 (-> s4-8 bsp region-trees s2-4)) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) ) ;; definition for method 22 of type entity-camera diff --git a/test/decompiler/reference/jak2/engine/game/effect-control_REF.gc b/test/decompiler/reference/jak2/engine/game/effect-control_REF.gc index 325835b1ce..e1e0402905 100644 --- a/test/decompiler/reference/jak2/engine/game/effect-control_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/effect-control_REF.gc @@ -307,327 +307,301 @@ (sv-496 matrix) (sv-512 res-lump) ) - (with-pp - (cond - ((logtest? (-> obj flags) (effect-control-flag ecf2)) - (return #f) - ) - ((= arg0 'script) - (let ((gp-1 (get-property-struct - (-> obj res) - 'effect-script - 'exact - arg1 - (the-as structure #f) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (script-eval (the-as pair gp-1)) - ) - (return #f) - ) - ) - (let ((s3-0 (-> arg0 value)) - (s5-0 (cond - ((< arg2 0) - (let ((v0-5 (get-property-value - (-> obj res) - 'effect-joint - 'exact - arg1 - (the-as uint128 0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (if (zero? v0-5) - 0 - (the-as int (+ v0-5 1)) - ) - ) - ) - (else - (empty) - arg2 - ) - ) - ) - ) - (when (logtest? (-> obj flags) (effect-control-flag ecf0)) - (if (send-event (-> obj process) 'effect-control arg0 arg1 s5-0) - (return 0) - ) - ) - (let ((v1-23 (symbol->string arg0))) - (cond - ((and (= (-> v1-23 data 0) 101) - (= (-> v1-23 data 1) 102) - (= (-> v1-23 data 2) 102) - (= (-> v1-23 data 3) 101) - (= (-> v1-23 data 4) 99) - (= (-> v1-23 data 5) 116) - (= (-> v1-23 data 6) 45) - ) - (let* ((s3-1 (-> obj process root)) - (v1-27 (if (type? s3-1 collide-shape-moving) - s3-1 - ) - ) - (t1-2 (if v1-27 - (-> (the-as collide-shape-moving v1-27) ground-pat) - *footstep-surface* - ) - ) - ) - (do-effect-for-surface obj arg0 arg1 s5-0 (-> obj res) t1-2) - ) - ) - ((let ((v1-31 (symbol->string arg0))) - (and (= (-> v1-31 data 0) 103) - (= (-> v1-31 data 1) 114) - (= (-> v1-31 data 2) 111) - (= (-> v1-31 data 3) 117) - (= (-> v1-31 data 4) 112) - (= (-> v1-31 data 5) 45) - ) - ) - (set! s3-0 (cond - ((zero? s3-0) - (let ((v0-10 (lookup-part-group-pointer-by-name (symbol->string arg0)))) - (when v0-10 - (set! (-> arg0 value) v0-10) - (set! s3-0 (-> v0-10 0)) - ) - ) - s3-0 - ) - (else - (-> (the-as (pointer object) s3-0) 0) - ) - ) - ) - (when (and (nonzero? s3-0) (= (-> (the-as basic s3-0) type) sparticle-launch-group)) - (if *debug-effect-control* - (format - #t - "(~5D) effect group ~A ~A frame ~F joint ~D~%" - (-> pp clock frame-counter) - (-> obj process name) - arg0 + (cond + ((logtest? (-> obj flags) (effect-control-flag ecf2)) + (return #f) + ) + ((= arg0 'script) + (let ((gp-1 (get-property-struct + (-> obj res) + 'effect-script + 'exact arg1 - s5-0 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* ) ) - (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-1 - (let ((t9-10 (method-of-type part-tracker activate))) - (t9-10 - (the-as part-tracker s4-1) - (-> obj process) - (symbol->string (-> part-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s2-1 run-function-in-process) - (s1-0 s4-1) - (s0-0 part-tracker-init) + ) + (script-eval (the-as pair gp-1)) + ) + (return #f) + ) + ) + (let ((s3-0 (-> arg0 value)) + (s5-0 (cond + ((< arg2 0) + (let ((v0-5 (get-property-value + (-> obj res) + 'effect-joint + 'exact + arg1 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if (zero? v0-5) + 0 + (the-as int (+ v0-5 1)) ) - (set! sv-320 0) - (set! sv-336 (the-as symbol #f)) - (set! sv-352 (the-as symbol #f)) - (set! sv-368 (the-as symbol #f)) - (set! sv-400 *launch-matrix*) - (set! sv-384 (-> sv-400 trans)) - (let ((v1-55 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad))) - (set! (-> sv-384 quad) v1-55) - ) - ((the-as (function object object object object object object object object none) s2-1) - s1-0 - s0-0 - s3-0 - sv-320 - sv-336 - sv-352 - sv-368 - sv-400 - ) ) - (-> s4-1 ppointer) ) - ) - ) - ) - ((let ((v1-58 (symbol->string arg0))) - (and (= (-> v1-58 data 0) 101) - (= (-> v1-58 data 1) 118) - (= (-> v1-58 data 2) 101) - (= (-> v1-58 data 3) 110) - (= (-> v1-58 data 4) 116) - (= (-> v1-58 data 5) 45) + (else + (empty) + arg2 ) - ) - (send-event (-> obj process) arg0 arg1 s5-0) + ) + ) + ) + (when (logtest? (-> obj flags) (effect-control-flag ecf0)) + (if (send-event (-> obj process) 'effect-control arg0 arg1 s5-0) + (return 0) + ) + ) + (let ((v1-23 (symbol->string arg0))) + (cond + ((and (= (-> v1-23 data 0) 101) + (= (-> v1-23 data 1) 102) + (= (-> v1-23 data 2) 102) + (= (-> v1-23 data 3) 101) + (= (-> v1-23 data 4) 99) + (= (-> v1-23 data 5) 116) + (= (-> v1-23 data 6) 45) + ) + (let* ((s3-1 (-> obj process root)) + (v1-27 (if (type? s3-1 collide-shape-moving) + s3-1 + ) + ) + (t1-2 (if v1-27 + (-> (the-as collide-shape-moving v1-27) ground-pat) + *footstep-surface* + ) + ) + ) + (do-effect-for-surface obj arg0 arg1 s5-0 (-> obj res) t1-2) ) - ((= arg0 'camera-shake) - (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + ) + ((let ((v1-31 (symbol->string arg0))) + (and (= (-> v1-31 data 0) 103) + (= (-> v1-31 data 1) 114) + (= (-> v1-31 data 2) 111) + (= (-> v1-31 data 3) 117) + (= (-> v1-31 data 4) 112) + (= (-> v1-31 data 5) 45) + ) ) - ((zero? s3-0) - (play-effect-sound obj arg0 arg1 s5-0 (-> obj res) (string->sound-name (symbol->string arg0))) - ) - ((= (-> (the-as basic s3-0) type) sparticle-launcher) + (set! s3-0 (cond + ((zero? s3-0) + (let ((v0-10 (lookup-part-group-pointer-by-name (symbol->string arg0)))) + (when v0-10 + (set! (-> arg0 value) v0-10) + (set! s3-0 (-> v0-10 0)) + ) + ) + s3-0 + ) + (else + (-> (the-as (pointer object) s3-0) 0) + ) + ) + ) + (when (and (nonzero? s3-0) (= (-> (the-as basic s3-0) type) sparticle-launch-group)) (if *debug-effect-control* - (format - #t - "(~5D) effect part ~A ~A frame ~F joint ~D~%" - (-> pp clock frame-counter) - (-> obj process name) - arg0 - arg1 - s5-0 - ) + (format #t "(~5D) effect group ~A ~A frame ~F joint ~D~%" (current-time) (-> obj process name) arg0 arg1 s5-0) ) - (format - #t - "-----> (~5D) effect part ~A ~A frame ~F joint ~D~%" - (-> pp clock frame-counter) - (-> obj process name) - arg0 - arg1 - s5-0 - ) - (let ((s4-2 sp-launch-particles-var) - (s2-2 *sp-particle-system-2d*) - (s0-2 *launch-matrix*) - ) - (set! (-> s0-2 trans quad) - (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad) - ) - (s4-2 - s2-2 - (the-as sparticle-launcher s3-0) - s0-2 - (the-as sparticle-launch-state #f) - (the-as sparticle-launch-control #f) - 1.0 - ) - ) - ) - ((= (-> (the-as basic s3-0) type) sparticle-launch-group) - (if *debug-effect-control* - (format - #t - "(~5D) effect group ~A ~A frame ~F joint ~D~%" - (-> pp clock frame-counter) - (-> obj process name) - arg0 - arg1 - s5-0 - ) - ) - (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-3 - (let ((t9-23 (method-of-type part-tracker activate))) - (t9-23 - (the-as part-tracker s4-3) + (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-1 + (let ((t9-10 (method-of-type part-tracker activate))) + (t9-10 + (the-as part-tracker s4-1) (-> obj process) (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000) ) ) - (let ((s2-3 run-function-in-process) - (s1-3 s4-3) - (s0-3 part-tracker-init) + (let ((s2-1 run-function-in-process) + (s1-0 s4-1) + (s0-0 part-tracker-init) ) - (set! sv-416 0) - (set! sv-432 (the-as symbol #f)) - (set! sv-448 (the-as symbol #f)) - (set! sv-464 (the-as symbol #f)) - (set! sv-496 *launch-matrix*) - (set! sv-480 (-> sv-496 trans)) - (let ((v1-95 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad))) - (set! (-> sv-480 quad) v1-95) + (set! sv-320 0) + (set! sv-336 (the-as symbol #f)) + (set! sv-352 (the-as symbol #f)) + (set! sv-368 (the-as symbol #f)) + (set! sv-400 *launch-matrix*) + (set! sv-384 (-> sv-400 trans)) + (let ((v1-55 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad))) + (set! (-> sv-384 quad) v1-55) ) - ((the-as (function object object object object object object object object none) s2-3) - s1-3 - s0-3 + ((the-as (function object object object object object object object object none) s2-1) + s1-0 + s0-0 s3-0 - sv-416 - sv-432 - sv-448 - sv-464 - sv-496 + sv-320 + sv-336 + sv-352 + sv-368 + sv-400 ) ) - (-> s4-3 ppointer) + (-> s4-1 ppointer) ) ) ) - ((= (-> (the-as basic s3-0) type) sound-spec) - (sound-play-by-spec - (the-as sound-spec s3-0) - (new-sound-id) - (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) - ) + ) + ((let ((v1-58 (symbol->string arg0))) + (and (= (-> v1-58 data 0) 101) + (= (-> v1-58 data 1) 118) + (= (-> v1-58 data 2) 101) + (= (-> v1-58 data 3) 110) + (= (-> v1-58 data 4) 116) + (= (-> v1-58 data 5) 45) + ) ) - ((= (-> (the-as basic s3-0) type) death-info) - (when (and (logtest? (-> obj flags) (effect-control-flag ecf1)) (zero? (-> obj process draw death-timer))) - (let ((v1-106 (-> obj process draw))) - (let ((a1-51 (-> (the-as death-info s3-0) vertex-skip)) - (a0-77 - (max - 2 - (the-as int (/ (-> (the-as death-info s3-0) timer) (the-as uint (the int (-> *display* time-factor))))) - ) - ) - ) - (when (= (-> *setting-control* user-current video-mode) 'pal) - (if (< (the-as uint 1) a1-51) - (set! a1-51 (/ (the-as uint (* (the-as uint 50) a1-51)) (the-as uint 60))) - ) - ) - (let ((a2-37 (-> *display* frames (-> *display* last-screen) run-time))) - (cond - ((< 9000 a2-37) - (set! a1-51 (* a1-51 4)) - ) - ((< 7000 a2-37) - (set! a1-51 (* a1-51 2)) - ) - ) - ) - (set! (-> v1-106 death-vertex-skip) a1-51) - (set! (-> v1-106 death-effect) (-> (the-as death-info s3-0) effect)) - (set! (-> v1-106 death-timer) (the-as uint (+ a0-77 1))) + (send-event (-> obj process) arg0 arg1 s5-0) + ) + ((= arg0 'camera-shake) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + ) + ((zero? s3-0) + (play-effect-sound obj arg0 arg1 s5-0 (-> obj res) (string->sound-name (symbol->string arg0))) + ) + ((= (-> (the-as basic s3-0) type) sparticle-launcher) + (if *debug-effect-control* + (format #t "(~5D) effect part ~A ~A frame ~F joint ~D~%" (current-time) (-> obj process name) arg0 arg1 s5-0) + ) + (format + #t + "-----> (~5D) effect part ~A ~A frame ~F joint ~D~%" + (current-time) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + (let ((s4-2 sp-launch-particles-var) + (s2-2 *sp-particle-system-2d*) + (s0-2 *launch-matrix*) + ) + (set! (-> s0-2 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad) ) - (set! (-> v1-106 death-timer-org) (-> v1-106 death-timer)) - (set! (-> v1-106 death-draw-overlap) (-> (the-as death-info s3-0) overlap)) - ) - (when (-> (the-as death-info s3-0) sound) - (let* ((s2-5 obj) - (s1-4 (method-of-object s2-5 play-effect-sound)) - (s0-4 (-> (the-as death-info s3-0) sound)) - ) - (set! sv-512 (-> obj res)) - (let ((t1-12 (string->sound-name (symbol->string (-> (the-as death-info s3-0) sound))))) - (s1-4 s2-5 s0-4 arg1 s5-0 sv-512 t1-12) - ) + (s4-2 + s2-2 + (the-as sparticle-launcher s3-0) + s0-2 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + ((= (-> (the-as basic s3-0) type) sparticle-launch-group) + (if *debug-effect-control* + (format #t "(~5D) effect group ~A ~A frame ~F joint ~D~%" (current-time) (-> obj process name) arg0 arg1 s5-0) + ) + (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-3 + (let ((t9-23 (method-of-type part-tracker activate))) + (t9-23 + (the-as part-tracker s4-3) + (-> obj process) + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) ) ) - (send-event (-> obj process) 'death-start (the-as death-info s3-0)) + (let ((s2-3 run-function-in-process) + (s1-3 s4-3) + (s0-3 part-tracker-init) + ) + (set! sv-416 0) + (set! sv-432 (the-as symbol #f)) + (set! sv-448 (the-as symbol #f)) + (set! sv-464 (the-as symbol #f)) + (set! sv-496 *launch-matrix*) + (set! sv-480 (-> sv-496 trans)) + (let ((v1-95 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad))) + (set! (-> sv-480 quad) v1-95) + ) + ((the-as (function object object object object object object object object none) s2-3) + s1-3 + s0-3 + s3-0 + sv-416 + sv-432 + sv-448 + sv-464 + sv-496 + ) + ) + (-> s4-3 ppointer) ) ) - (else - (play-effect-sound obj arg0 arg1 s5-0 (-> obj res) (string->sound-name (symbol->string arg0))) - ) + ) + ((= (-> (the-as basic s3-0) type) sound-spec) + (sound-play-by-spec + (the-as sound-spec s3-0) + (new-sound-id) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) + ) + ) + ((= (-> (the-as basic s3-0) type) death-info) + (when (and (logtest? (-> obj flags) (effect-control-flag ecf1)) (zero? (-> obj process draw death-timer))) + (let ((v1-106 (-> obj process draw))) + (let ((a1-51 (-> (the-as death-info s3-0) vertex-skip)) + (a0-77 + (max + 2 + (the-as int (/ (-> (the-as death-info s3-0) timer) (the-as uint (the int (-> *display* time-factor))))) + ) + ) + ) + (when (= (-> *setting-control* user-current video-mode) 'pal) + (if (< (the-as uint 1) a1-51) + (set! a1-51 (/ (the-as uint (* (the-as uint 50) a1-51)) (the-as uint 60))) + ) + ) + (let ((a2-37 (-> *display* frames (-> *display* last-screen) run-time))) + (cond + ((< 9000 a2-37) + (set! a1-51 (* a1-51 4)) + ) + ((< 7000 a2-37) + (set! a1-51 (* a1-51 2)) + ) + ) + ) + (set! (-> v1-106 death-vertex-skip) a1-51) + (set! (-> v1-106 death-effect) (-> (the-as death-info s3-0) effect)) + (set! (-> v1-106 death-timer) (the-as uint (+ a0-77 1))) + ) + (set! (-> v1-106 death-timer-org) (-> v1-106 death-timer)) + (set! (-> v1-106 death-draw-overlap) (-> (the-as death-info s3-0) overlap)) + ) + (when (-> (the-as death-info s3-0) sound) + (let* ((s2-5 obj) + (s1-4 (method-of-object s2-5 play-effect-sound)) + (s0-4 (-> (the-as death-info s3-0) sound)) + ) + (set! sv-512 (-> obj res)) + (let ((t1-12 (string->sound-name (symbol->string (-> (the-as death-info s3-0) sound))))) + (s1-4 s2-5 s0-4 arg1 s5-0 sv-512 t1-12) + ) + ) + ) + (send-event (-> obj process) 'death-start (the-as death-info s3-0)) + ) + ) + (else + (play-effect-sound obj arg0 arg1 s5-0 (-> obj res) (string->sound-name (symbol->string arg0))) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 11 of type effect-control @@ -1068,90 +1042,88 @@ ;; INFO: Used lq/sq (defmethod play-effect-sound effect-control ((obj effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 sound-name)) (local-vars (sv-112 res-tag) (sv-128 sound-name) (sv-144 basic) (sv-160 (function vector vector float))) - (with-pp - (set! sv-144 arg3) - (let ((s0-0 arg4) - (gp-0 (the-as object (new 'stack 'sound-spec))) - (s5-0 (if (< arg2 0) - (the-as vector #f) - (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data arg2)) - ) + (set! sv-144 arg3) + (let ((s0-0 arg4) + (gp-0 (the-as object (new 'stack 'sound-spec))) + (s5-0 (if (< arg2 0) + (the-as vector #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data arg2)) + ) + ) + ) + (set! (-> (the-as sound-spec gp-0) sound-name) s0-0) + (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask volume)) + (set! (-> (the-as sound-spec gp-0) pitch-mod) 0) + (set! (-> (the-as sound-spec gp-0) volume) 1024) + (set! sv-112 (new 'static 'res-tag)) + (let* ((t9-2 (method-of-type res-lump get-property-data)) + (a1-5 'effect-param) + (a2-1 'exact) + (a3-1 arg1) + (t0-1 #f) + (t1-1 (the-as (pointer res-tag) (& sv-112))) + (t2-0 *res-static-buf*) + (a1-6 (t9-2 (the-as res-lump sv-144) a1-5 a2-1 a3-1 (the-as pointer t0-1) t1-1 t2-0)) + ) + (when a1-6 + (effect-param->sound-spec + (the-as sound-spec gp-0) + (the-as (pointer float) a1-6) + (the-as int (-> sv-112 elt-count)) + (the-as process-focusable (-> obj process)) + ) + (if (logtest? (-> (the-as sound-spec gp-0) mask) (sound-mask unk)) + (return 0) + ) + ) + ) + (let ((f0-0 (-> *setting-control* user-current under-water-pitch-mod))) + (when (!= f0-0 0.0) + (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask pitch)) + (let ((f0-1 (* 2.0 f0-0))) + (set! (-> (the-as sound-spec gp-0) pitch-mod) + (- (-> (the-as sound-spec gp-0) pitch-mod) (the int (* 1524.0 f0-1))) ) ) - (set! (-> (the-as sound-spec gp-0) sound-name) s0-0) - (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask volume)) - (set! (-> (the-as sound-spec gp-0) pitch-mod) 0) - (set! (-> (the-as sound-spec gp-0) volume) 1024) - (set! sv-112 (new 'static 'res-tag)) - (let* ((t9-2 (method-of-type res-lump get-property-data)) - (a1-5 'effect-param) - (a2-1 'exact) - (a3-1 arg1) - (t0-1 #f) - (t1-1 (the-as (pointer res-tag) (& sv-112))) - (t2-0 *res-static-buf*) - (a1-6 (t9-2 (the-as res-lump sv-144) a1-5 a2-1 a3-1 (the-as pointer t0-1) t1-1 t2-0)) - ) - (when a1-6 - (effect-param->sound-spec - (the-as sound-spec gp-0) - (the-as (pointer float) a1-6) - (the-as int (-> sv-112 elt-count)) - (the-as process-focusable (-> obj process)) - ) - (if (logtest? (-> (the-as sound-spec gp-0) mask) (sound-mask unk)) - (return 0) - ) - ) ) - (let ((f0-0 (-> *setting-control* user-current under-water-pitch-mod))) - (when (!= f0-0 0.0) - (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask pitch)) - (let ((f0-1 (* 2.0 f0-0))) - (set! (-> (the-as sound-spec gp-0) pitch-mod) - (- (-> (the-as sound-spec gp-0) pitch-mod) (the int (* 1524.0 f0-1))) - ) - ) - ) - ) - (if (or (and (nonzero? (-> (the-as sound-spec gp-0) fo-max)) - (let ((f30-0 (* 4096.0 (the float (-> (the-as sound-spec gp-0) fo-max))))) - (set! sv-160 vector-vector-distance) - (let ((a0-8 (ear-trans 0)) - (a1-7 s5-0) - ) - (< f30-0 (sv-160 a0-8 a1-7)) - ) + ) + (if (or (and (nonzero? (-> (the-as sound-spec gp-0) fo-max)) + (let ((f30-0 (* 4096.0 (the float (-> (the-as sound-spec gp-0) fo-max))))) + (set! sv-160 vector-vector-distance) + (let ((a0-8 (ear-trans 0)) + (a1-7 s5-0) + ) + (< f30-0 (sv-160 a0-8 a1-7)) ) ) - (= (-> (the-as (pointer int8) gp-0) 9) 126) - ) - (return 0) - ) - (when *debug-effect-control* - (set! sv-128 s0-0) - (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128))) - (format - #t - "(~5D) effect sound ~A ~A (~S) frame ~F joint ~D " - (-> pp clock frame-counter) - (-> obj process name) - arg0 - *temp-string* - arg1 - arg2 - ) - (format - #t - "volume: ~f pitch-mod: ~f~%" - (* 0.09765625 (the float (-> (the-as sound-spec gp-0) volume))) - (* 0.000656168 (the float (-> (the-as sound-spec gp-0) pitch-mod))) - ) + ) + (= (-> (the-as (pointer int8) gp-0) 9) 126) + ) + (return 0) + ) + (when *debug-effect-control* + (set! sv-128 s0-0) + (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128))) + (format + #t + "(~5D) effect sound ~A ~A (~S) frame ~F joint ~D " + (current-time) + (-> obj process name) + arg0 + *temp-string* + arg1 + arg2 + ) + (format + #t + "volume: ~f pitch-mod: ~f~%" + (* 0.09765625 (the float (-> (the-as sound-spec gp-0) volume))) + (* 0.000656168 (the float (-> (the-as sound-spec gp-0) pitch-mod))) ) - (sound-play-by-spec (the-as sound-spec gp-0) (new-sound-id) s5-0) ) - 0 + (sound-play-by-spec (the-as sound-spec gp-0) (new-sound-id) s5-0) ) + 0 ) ;; definition for function target-land-effect diff --git a/test/decompiler/reference/jak2/engine/game/game-info_REF.gc b/test/decompiler/reference/jak2/engine/game/game-info_REF.gc index f3499b2ce1..06510085b3 100644 --- a/test/decompiler/reference/jak2/engine/game/game-info_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/game-info_REF.gc @@ -790,8 +790,8 @@ (set! (-> v1-9 origin z) (the float (/ (-> s3-0 z) 16))) ) (set! (-> s5-0 flags) (font-flags shadow kerning large)) - (let ((s3-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-1) (+ arg2 -75)) + (let ((s3-1 (current-time))) + (until (>= (- (current-time) s3-1) (+ arg2 -75)) (+! (-> s5-0 origin y) (* -120.0 (-> self clock seconds-per-frame))) (let ((s2-0 print-game-text)) (format (clear *temp-string*) "~4,,0f" arg1) @@ -800,9 +800,9 @@ (suspend) ) ) - (let ((s4-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-1) (seconds 0.25)) - (set! (-> s5-0 alpha) (lerp-scale 1.0 0.0 (the float (- (-> self clock frame-counter) s4-1)) 0.0 150.0)) + (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 (-> self clock seconds-per-frame))) (let ((s3-2 print-game-text)) (format (clear *temp-string*) "~4,,0f" arg1) @@ -1239,8 +1239,8 @@ process (lambda :behavior process ((arg0 string)) - (let ((s5-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-0) (seconds 10)) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) (seconds 10)) (format *stdcon* "~S~%" arg0) (suspend) ) diff --git a/test/decompiler/reference/jak2/engine/game/main_REF.gc b/test/decompiler/reference/jak2/engine/game/main_REF.gc index 5ca0f94787..fd719e304c 100644 --- a/test/decompiler/reference/jak2/engine/game/main_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/main_REF.gc @@ -16,7 +16,6 @@ ;; definition for function letterbox ;; WARN: Return type mismatch pointer vs none. -;; ERROR: Failed store: (s.w! (+ v1-7 8) 0) at op 30 (defun letterbox () (with-dma-buffer-add-bucket ((s5-0 (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id screen-filter) @@ -52,7 +51,6 @@ ;; definition for function blackout ;; WARN: Return type mismatch pointer vs none. -;; ERROR: Failed store: (s.w! (+ v1-6 8) 0) at op 21 (defun blackout () (with-dma-buffer-add-bucket ((s5-0 (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id debug-no-zbuf2) @@ -261,7 +259,6 @@ ;; definition for method 9 of type screen-filter ;; WARN: Return type mismatch int vs none. -;; ERROR: Failed store: (s.w! (+ a0-2 8) 0) at op 28 (defmethod draw screen-filter ((obj screen-filter)) (local-vars (v1-1 float)) (rlet ((vf0 :class vf) @@ -343,7 +340,6 @@ (define *first-boot* #t) ;; definition for function main-cheats -;; ERROR: Failed store: (s.w! (+ v1-77 8) 0) at op 163 (defun main-cheats () (when (and (cpad-hold? 0 l3) (or *cheat-mode* (not (demo?)))) ((lambda () @@ -1169,24 +1165,23 @@ (else (when (process-spawn-function process - (lambda ((arg0 time-frame)) (with-pp - (set-blackout-frames (seconds 100)) - (set! (-> *setting-control* user-default allow-pause) #f) - (set! (-> *setting-control* user-default allow-progress) #f) - (apply-settings *setting-control*) - (set! (-> *setting-control* user-default sfx-volume) 0.0) - (set! (-> *setting-control* user-default music-volume) 0.0) - (set! (-> *setting-control* user-default dialog-volume) 0.0) - (set! (-> *setting-control* user-default ambient-volume) 0.0) - (let ((s5-0 (-> pp clock frame-counter))) - (until (>= (- (-> pp clock frame-counter) s5-0) (seconds 0.1)) - (suspend) - ) - ) - (kernel-shutdown) - (none) - ) - ) + (lambda ((arg0 time-frame)) + (set-blackout-frames (seconds 100)) + (set! (-> *setting-control* user-default allow-pause) #f) + (set! (-> *setting-control* user-default allow-progress) #f) + (apply-settings *setting-control*) + (set! (-> *setting-control* user-default sfx-volume) 0.0) + (set! (-> *setting-control* user-default music-volume) 0.0) + (set! (-> *setting-control* user-default dialog-volume) 0.0) + (set! (-> *setting-control* user-default ambient-volume) 0.0) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) (seconds 0.1)) + (suspend) + ) + ) + (kernel-shutdown) + (none) + ) (if (= *master-exit* 'movie) 2 1 @@ -1209,7 +1204,6 @@ ;; definition for function end-display ;; WARN: Return type mismatch int vs none. -;; ERROR: Failed store: (s.w! (+ v1-37 8) 0) at op 87 (defun end-display ((arg0 display)) (let ((s5-0 (-> (if *debug-segment* (-> arg0 frames (-> arg0 on-screen) debug-buf) diff --git a/test/decompiler/reference/jak2/engine/game/task/task-control_REF.gc b/test/decompiler/reference/jak2/engine/game/task/task-control_REF.gc index 21a120a20e..708585a5f7 100644 --- a/test/decompiler/reference/jak2/engine/game/task/task-control_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/task/task-control_REF.gc @@ -1591,11 +1591,11 @@ ) ) (logior! (-> self flags) (fail-mission-flags famflags-1)) - (set! (-> self grabbed-time) (-> self clock frame-counter)) + (set! (-> self grabbed-time) (current-time)) (when (not (logtest? (-> self flags) (fail-mission-flags famflags-3))) (when (not (logtest? (-> self flags) (fail-mission-flags famflags-5))) - (while (< (- (-> self clock frame-counter) (-> self grabbed-time)) (seconds 1.5)) - (let ((f30-0 (lerp-scale 0.0 1.0 (the float (- (-> self clock frame-counter) (-> self grabbed-time))) 0.0 450.0))) + (while (< (- (current-time) (-> self grabbed-time)) (seconds 1.5)) + (let ((f30-0 (lerp-scale 0.0 1.0 (the float (- (current-time) (-> self grabbed-time))) 0.0 450.0))) (set-filter-color! (lerp-scale 1.0 1.25 f30-0 0.0 1.0) (lerp-scale 1.0 0.875 f30-0 0.0 1.0) @@ -1618,7 +1618,7 @@ (((fail-mission-message fammsg-0)) (until #f (when (or (and (logtest? (-> self flags) (fail-mission-flags famflags-0)) - (>= (- (-> self clock frame-counter) (-> self grabbed-time)) (the-as time-frame (-> self reset-delay))) + (>= (- (current-time) (-> self grabbed-time)) (the-as time-frame (-> self reset-delay))) ) (or (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) (logtest? (-> self flags) (fail-mission-flags famflags-3)) @@ -1713,9 +1713,9 @@ ) :code (behavior () (local-vars (a1-10 basic)) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) - (let ((f30-0 (lerp-scale 1.0 0.0 (the float (- (-> self clock frame-counter) gp-0)) 0.0 270.0))) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) + (let ((f30-0 (lerp-scale 1.0 0.0 (the float (- (current-time) gp-0)) 0.0 270.0))) (when *sound-player-enable* (let ((v1-6 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) (set! (-> v1-6 command) (sound-command set-param)) @@ -1726,7 +1726,7 @@ ) ) ) - (let ((f30-1 (lerp-scale 1.0 0.0 (the float (- (-> self clock frame-counter) gp-0)) 0.0 300.0))) + (let ((f30-1 (lerp-scale 1.0 0.0 (the float (- (current-time) gp-0)) 0.0 300.0))) (set-filter-color! (lerp-scale 1.0 1.25 f30-1 0.0 1.0) (lerp-scale 1.0 0.875 f30-1 0.0 1.0) @@ -1889,7 +1889,7 @@ (set! (-> self lev-name) arg1) (add-setting! 'task arg0 0.0 0) (add-setting! 'task-manager (process->ppointer self) 0.0 0) - (set! (-> self intro-time) (-> self clock frame-counter)) + (set! (-> self intro-time) (current-time)) (set! (-> self fail-on-death?) (not (logtest? (-> arg0 flags) (game-task-node-flag no-fail-on-death)))) (when arg1 (let* ((v1-15 (level-get *level* arg1)) @@ -1917,29 +1917,27 @@ ;; definition for method 21 of type task-manager (defmethod check-time task-manager ((obj task-manager)) - (with-pp - (when (nonzero? (-> obj start-time)) - (let ((v1-3 (handle->process (-> obj hud-timer)))) - (if (and *target* (not v1-3)) - (set! (-> obj hud-timer) (ppointer->handle (process-spawn hud-timer :init hud-init-by-other :to *target*))) - ) + (when (nonzero? (-> obj start-time)) + (let ((v1-3 (handle->process (-> obj hud-timer)))) + (if (and *target* (not v1-3)) + (set! (-> obj hud-timer) (ppointer->handle (process-spawn hud-timer :init hud-init-by-other :to *target*))) + ) + ) + (let ((v1-15 (- (-> obj time-limit) (- (current-time) (-> obj start-time))))) + (let ((a0-15 *game-info*)) + (set! (-> a0-15 timer) v1-15) + (set! (-> a0-15 timer-flash) (< v1-15 (seconds 10))) ) - (let ((v1-15 (- (-> obj time-limit) (- (-> pp clock frame-counter) (-> obj start-time))))) - (let ((a0-15 *game-info*)) - (set! (-> a0-15 timer) v1-15) - (set! (-> a0-15 timer-flash) (< v1-15 (seconds 10))) - ) - (when (< v1-15 0) - (if *debug-segment* - (format #t "task failed: ran out of time~%") - ) - (send-event (handle->process (-> obj hud-timer)) 'hide-and-die) - (go (method-of-object obj fail)) - ) + (when (< v1-15 0) + (if *debug-segment* + (format #t "task failed: ran out of time~%") + ) + (send-event (handle->process (-> obj hud-timer)) 'hide-and-die) + (go (method-of-object obj fail)) ) ) - 0 ) + 0 ) ;; definition for method 19 of type task-manager @@ -2102,28 +2100,26 @@ ;; definition for method 22 of type task-manager ;; WARN: Return type mismatch object vs symbol. (defmethod task-manager-method-22 task-manager ((obj task-manager)) - (with-pp - (the-as - symbol - (and (or (not (logtest? (-> obj node-info flags) (game-task-node-flag city-wait))) - (let ((a0-2 (level-get-target-inside *level*))) - (cond - ((not (and a0-2 (logtest? (-> a0-2 info level-flags) 1))) - (set! (-> obj intro-time) (-> pp clock frame-counter)) - #f - ) - (else - #t - ) + (the-as + symbol + (and (or (not (logtest? (-> obj node-info flags) (game-task-node-flag city-wait))) + (let ((a0-2 (level-get-target-inside *level*))) + (cond + ((not (and a0-2 (logtest? (-> a0-2 info level-flags) 1))) + (set! (-> obj intro-time) (current-time)) + #f + ) + (else + #t ) ) ) - (or (zero? (-> obj info intro-delay)) - (>= (- (-> pp clock frame-counter) (-> obj intro-time)) (the-as time-frame (-> obj info intro-delay))) - ) - (and *target* (not (logtest? (focus-status dead teleporting) (-> *target* focus-status)))) - ) - ) + ) + (or (zero? (-> obj info intro-delay)) + (>= (- (current-time) (-> obj intro-time)) (the-as time-frame (-> obj info intro-delay))) + ) + (and *target* (not (logtest? (focus-status dead teleporting) (-> *target* focus-status)))) + ) ) ) @@ -2217,7 +2213,7 @@ (t9-3) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (when (logtest? (-> self info mask) (task-manager-mask resolution-scene)) (let ((gp-2 (ppointer->handle (process-spawn scene-player diff --git a/test/decompiler/reference/jak2/engine/gfx/mood/weather-part_REF.gc b/test/decompiler/reference/jak2/engine/gfx/mood/weather-part_REF.gc index 04a7bbd4f2..9cbbd74173 100644 --- a/test/decompiler/reference/jak2/engine/gfx/mood/weather-part_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/mood/weather-part_REF.gc @@ -787,7 +787,7 @@ ;; definition for function cam-master-effect ;; WARN: Return type mismatch int vs none. (defbehavior cam-master-effect camera-master () - (when (not (or (movie?) (>= (+ (-> self clock frame-counter) (seconds -10)) (-> self water-drip-time)))) + (when (not (or (movie?) (>= (+ (current-time) (seconds -10)) (-> self water-drip-time)))) (set! (-> *part-id-table* 46 init-specs 1 initial-valuef) (-> self water-drip-mult)) (set! (-> *part-id-table* 45 init-specs 1 initial-valuef) (* 0.9 (-> self water-drip-mult))) (set! (-> *part-id-table* 43 init-specs 11 initial-valuef) (* -2.7306666 (-> self water-drip-speed))) diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher_REF.gc index 70649bc3ef..7380db0163 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher_REF.gc @@ -1039,87 +1039,85 @@ ;; definition for method 9 of type sparticle-launch-control ;; WARN: Return type mismatch int vs none. (defmethod initialize sparticle-launch-control ((obj sparticle-launch-control) (arg0 sparticle-launch-group) (arg1 process)) - (with-pp - (let ((s5-0 0)) - (set! (-> obj group) arg0) - (set! (-> obj proc) (the-as process-drawable arg1)) - (set! (-> obj local-clock) 0) - (set! (-> obj fade) 1.0) - (set! (-> obj matrix) 0) - (set! (-> obj last-spawn-frame) (the-as int (+ (-> *display* real-frame-clock integral-frame-counter) -2))) - (set! (-> obj last-spawn-time) 0) - (if (logtest? (-> obj group flags) (sp-group-flag unk-4)) - (quaternion->matrix (-> obj origin) (-> (the-as process-drawable arg1) root quat)) - (matrix-identity! (-> obj origin)) - ) - (when (logtest? (-> arg0 flags) (sp-group-flag unk-6)) - (let ((f0-1 (-> arg0 rotate-x)) - (f1-0 (-> arg0 rotate-y)) - (f2-0 (-> arg0 rotate-z)) - (t9-2 matrix-rotate-xyz!) - (a0-3 (new 'stack-no-clear 'matrix)) - (a1-2 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-2 x) f0-1) - (set! (-> a1-2 y) f1-0) - (set! (-> a1-2 z) f2-0) - (set! (-> a1-2 w) 1.0) - (let ((a1-3 (t9-2 a0-3 a1-2))) - (matrix*! (-> obj origin) a1-3 (-> obj origin)) + (let ((s5-0 0)) + (set! (-> obj group) arg0) + (set! (-> obj proc) (the-as process-drawable arg1)) + (set! (-> obj local-clock) 0) + (set! (-> obj fade) 1.0) + (set! (-> obj matrix) 0) + (set! (-> obj last-spawn-frame) (the-as int (+ (-> *display* real-frame-clock integral-frame-counter) -2))) + (set! (-> obj last-spawn-time) 0) + (if (logtest? (-> obj group flags) (sp-group-flag unk-4)) + (quaternion->matrix (-> obj origin) (-> (the-as process-drawable arg1) root quat)) + (matrix-identity! (-> obj origin)) + ) + (when (logtest? (-> arg0 flags) (sp-group-flag unk-6)) + (let ((f0-1 (-> arg0 rotate-x)) + (f1-0 (-> arg0 rotate-y)) + (f2-0 (-> arg0 rotate-z)) + (t9-2 matrix-rotate-xyz!) + (a0-3 (new 'stack-no-clear 'matrix)) + (a1-2 (new 'stack-no-clear 'vector)) ) + (set! (-> a1-2 x) f0-1) + (set! (-> a1-2 y) f1-0) + (set! (-> a1-2 z) f2-0) + (set! (-> a1-2 w) 1.0) + (let ((a1-3 (t9-2 a0-3 a1-2))) + (matrix*! (-> obj origin) a1-3 (-> obj origin)) ) ) - (when (logtest? (-> arg0 flags) (sp-group-flag unk-7)) - (let ((a1-4 (new 'stack-no-clear 'vector))) - (set! (-> a1-4 x) (-> arg0 scale-x)) - (set! (-> a1-4 y) (-> arg0 scale-y)) - (set! (-> a1-4 z) (-> arg0 scale-z)) - (set! (-> a1-4 w) 1.0) - (set! (-> a1-4 w) 1.0) - (scale-matrix! (-> obj origin) a1-4 (-> obj origin)) - ) - ) - (dotimes (s3-0 (-> arg0 length)) - (let* ((a0-7 (-> arg0 launcher s3-0)) - (a1-6 (-> *part-id-table* (-> a0-7 launcher))) - (v1-29 (-> obj data s5-0)) - ) - (when (nonzero? a1-6) - (set! (-> v1-29 group-item) a0-7) - (cond - ((= (-> a1-6 type) sparticle-launcher) - (set! (-> v1-29 accum) 0.0) - (set! (-> v1-29 spawn-time) (the-as uint (+ (-> pp clock frame-counter) (seconds -100)))) - (set! (-> v1-29 offset) (the-as uint (-> a0-7 offset))) - (set! (-> v1-29 randomize) (the-as uint 0)) - (cond - ((logtest? (-> a0-7 flags) (sp-group-item-flag start-dead)) - (logclear! (-> v1-29 flags) (sp-launch-state-flags launcher-active)) - (set! (-> v1-29 center) #f) - (set! (-> v1-29 sprite3d) #f) - (set! (-> v1-29 sprite) #f) - ) - (else - (logior! (-> v1-29 flags) (sp-launch-state-flags launcher-active)) - (set! (-> v1-29 center) (-> obj origin trans)) - (set! (-> v1-29 sprite3d) #f) - (set! (-> v1-29 sprite) #f) - ) - ) - (+! s5-0 1) - ) - (else - (format 0 "initialize called with non-particle-launcher~%") - ) - ) - ) - ) - ) - (set! (-> obj length) s5-0) ) - 0 - (none) + (when (logtest? (-> arg0 flags) (sp-group-flag unk-7)) + (let ((a1-4 (new 'stack-no-clear 'vector))) + (set! (-> a1-4 x) (-> arg0 scale-x)) + (set! (-> a1-4 y) (-> arg0 scale-y)) + (set! (-> a1-4 z) (-> arg0 scale-z)) + (set! (-> a1-4 w) 1.0) + (set! (-> a1-4 w) 1.0) + (scale-matrix! (-> obj origin) a1-4 (-> obj origin)) + ) + ) + (dotimes (s3-0 (-> arg0 length)) + (let* ((a0-7 (-> arg0 launcher s3-0)) + (a1-6 (-> *part-id-table* (-> a0-7 launcher))) + (v1-29 (-> obj data s5-0)) + ) + (when (nonzero? a1-6) + (set! (-> v1-29 group-item) a0-7) + (cond + ((= (-> a1-6 type) sparticle-launcher) + (set! (-> v1-29 accum) 0.0) + (set! (-> v1-29 spawn-time) (the-as uint (+ (current-time) (seconds -100)))) + (set! (-> v1-29 offset) (the-as uint (-> a0-7 offset))) + (set! (-> v1-29 randomize) (the-as uint 0)) + (cond + ((logtest? (-> a0-7 flags) (sp-group-item-flag start-dead)) + (logclear! (-> v1-29 flags) (sp-launch-state-flags launcher-active)) + (set! (-> v1-29 center) #f) + (set! (-> v1-29 sprite3d) #f) + (set! (-> v1-29 sprite) #f) + ) + (else + (logior! (-> v1-29 flags) (sp-launch-state-flags launcher-active)) + (set! (-> v1-29 center) (-> obj origin trans)) + (set! (-> v1-29 sprite3d) #f) + (set! (-> v1-29 sprite) #f) + ) + ) + (+! s5-0 1) + ) + (else + (format 0 "initialize called with non-particle-launcher~%") + ) + ) + ) + ) + ) + (set! (-> obj length) s5-0) ) + 0 + (none) ) ;; definition for method 9 of type sparticle-launch-group @@ -1301,7 +1299,7 @@ (if (not (or (is-visible? obj arg0) (logtest? (-> obj group flags) (sp-group-flag always-draw screen-space)))) (return 0) ) - (let ((s4-0 (the-as int (-> pp clock frame-counter))) + (let ((s4-0 (the-as int (current-time))) (s5-0 (-> obj last-spawn-time)) ) (let ((v1-10 (-> *display* real-frame-clock integral-frame-counter))) @@ -2391,7 +2389,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak2/engine/load/load-state_REF.gc b/test/decompiler/reference/jak2/engine/load/load-state_REF.gc index df7d0b14f7..dfe645a496 100644 --- a/test/decompiler/reference/jak2/engine/load/load-state_REF.gc +++ b/test/decompiler/reference/jak2/engine/load/load-state_REF.gc @@ -149,7 +149,7 @@ ;; definition for method 21 of type load-state ;; WARN: Return type mismatch int vs none. -;; ERROR: Failed store: (s.w! (+ v1-22 12) a0-5) at op 48 +;; ERROR: Failed load: (set! a0-11 (l.wu (+ a0-10 12))) at op 138 (defmethod add-borrow-levels load-state ((obj load-state)) (dotimes (s5-0 6) (let ((a0-1 (-> obj want s5-0 name))) @@ -318,7 +318,7 @@ (return #f) ) (if *display-load-commands* - (format 0 "NOTICE: ~D: ~f: execute command ~A~%" (-> pp clock frame-counter) f0-0 s3-0) + (format 0 "NOTICE: ~D: ~f: execute command ~A~%" (current-time) f0-0 s3-0) ) (cond ((pair? (car s3-0)) diff --git a/test/decompiler/reference/jak2/engine/load/loader_REF.gc b/test/decompiler/reference/jak2/engine/load/loader_REF.gc index d3f799a793..c1d2915072 100644 --- a/test/decompiler/reference/jak2/engine/load/loader_REF.gc +++ b/test/decompiler/reference/jak2/engine/load/loader_REF.gc @@ -925,7 +925,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) (-> self clock frame-counter)) + (set! (-> gp-0 old-time) (current-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)))) @@ -1071,13 +1071,13 @@ (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) (-> self clock frame-counter)) + (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) (>= (- (-> self clock frame-counter) (-> gp-0 good-time)) (seconds 4))) + (and (<= sv-176 0) (>= (- (current-time) (-> gp-0 good-time)) (seconds 4))) (and (< 300 (-> gp-0 good-count)) (<= sv-176 0)) ) (goto cfg-130) @@ -1108,15 +1108,15 @@ (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) (- (-> self clock frame-counter) (-> self clock old-frame-counter))) - (set! (-> gp-0 good-time) (-> self clock frame-counter)) + (+! (-> gp-0 good-count) (- (current-time) (-> self clock old-frame-counter))) + (set! (-> gp-0 good-time) (current-time)) ) (else 0 ) ) (set! (-> gp-0 old-pos) sv-176) - (set! (-> gp-0 old-time) (-> self clock frame-counter)) + (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))) diff --git a/test/decompiler/reference/jak2/engine/math/transformq_REF.gc b/test/decompiler/reference/jak2/engine/math/transformq_REF.gc index 97a03b0ea2..e8ccaaedbc 100644 --- a/test/decompiler/reference/jak2/engine/math/transformq_REF.gc +++ b/test/decompiler/reference/jak2/engine/math/transformq_REF.gc @@ -38,20 +38,19 @@ (f30-0 (fmax (fmin f0-0 f1-2) (- f1-2))) ) (let ((f0-2 (-> obj old-y-angle-diff))) - (set! f30-0 (cond - ((or (= f0-2 0.0) - (and (< 0.0 f30-0) (< 0.0 f0-2)) - (or (and (< f30-0 0.0) (< f0-2 0.0)) - (>= (- (-> pp clock frame-counter) (-> obj angle-change-time)) (seconds 0.2)) - ) - ) - (set! (-> obj angle-change-time) (-> pp clock frame-counter)) - f30-0 - ) - (else - (* 0.000000001 f30-0) - ) - ) + (set! f30-0 + (cond + ((or (= f0-2 0.0) + (and (< 0.0 f30-0) (< 0.0 f0-2)) + (or (and (< f30-0 0.0) (< f0-2 0.0)) (>= (- (current-time) (-> obj angle-change-time)) (seconds 0.2))) + ) + (set! (-> obj angle-change-time) (current-time)) + f30-0 + ) + (else + (* 0.000000001 f30-0) + ) + ) ) ) (set! (-> obj old-y-angle-diff) f30-0) diff --git a/test/decompiler/reference/jak2/engine/nav/nav-enemy_REF.gc b/test/decompiler/reference/jak2/engine/nav/nav-enemy_REF.gc index 88a0ede198..7bbeb8594f 100644 --- a/test/decompiler/reference/jak2/engine/nav/nav-enemy_REF.gc +++ b/test/decompiler/reference/jak2/engine/nav/nav-enemy_REF.gc @@ -230,89 +230,87 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (with-pp - (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (-> pp clock frame-counter)) - ) - (enemy-method-129 self) - (when (logtest? (enemy-flag use-trigger) (-> self enemy-flags)) - (if (-> self nav) - (enemy-method-100 self) - (enemy-method-103 self) - ) + (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) + (set! (-> self last-draw-time) (current-time)) ) - (when *target* - (if *target* - (look-at! - (-> *target* neck) - (the-as vector (-> self root-override2 root-prim prim-core)) - (if (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance)) - 'attacking - ) - self - ) - ) - ) - (when (nonzero? (-> self neck)) - (cond - ((logtest? (-> self enemy-flags) (enemy-flag lock-focus)) - (let ((a0-10 (handle->process (-> self focus handle)))) - (if a0-10 - (target-set! (-> self neck) (get-trans (the-as process-focusable a0-10) 2)) - ) - ) - ) - ((logtest? (-> self enemy-flags) (enemy-flag death-start)) - (let ((s5-1 (-> self move-dest)) - (v1-47 (vector<-cspace! - (new 'stack-no-clear 'vector) - (-> self node-list data (-> self enemy-info-override neck-joint)) - ) - ) - (a1-6 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-6 x) (-> s5-1 x)) - (set! (-> a1-6 y) (-> v1-47 y)) - (set! (-> a1-6 z) (-> s5-1 z)) - (set! (-> a1-6 w) 1.0) - (target-set! (-> self neck) a1-6) - ) - ) + (enemy-method-129 self) + (when (logtest? (enemy-flag use-trigger) (-> self enemy-flags)) + (if (-> self nav) + (enemy-method-100 self) + (enemy-method-103 self) ) - ) - (when (and (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) - (>= (- (-> pp clock frame-counter) (-> self auto-reset-penetrate-time)) (seconds 0.1)) - ) - (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) - (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) - (let ((v1-62 0)) - (if (logtest? (penetrate knocked) (-> self root-override2 penetrate-using)) - (set! v1-62 (logior (shl 1 32) v1-62)) - ) - (set! (-> self root-override2 penetrate-using) (the-as penetrate v1-62)) - ) - ) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (enemy-method-136 self) - ) - (if (logtest? (enemy-flag trackable-backup directed-ready) (-> self enemy-flags)) - (enemy-method-54 self) - ) - (let ((v1-73 (-> self restore-nav-radius-time))) - (when (nonzero? v1-73) - (when (>= (-> pp clock frame-counter) v1-73) - (set! (-> self restore-nav-radius-time) 0) - (set! (-> self root-override2 nav-radius) (-> self nav-radius-backup)) - ) - ) - ) - (if (and *debug-segment* (-> self enemy-info-override debug-draw-neck) (nonzero? (-> self neck))) - (joint-mod-debug-draw (-> self neck)) - ) - (ja-post) - 0 - (none) ) + (when *target* + (if *target* + (look-at! + (-> *target* neck) + (the-as vector (-> self root-override2 root-prim prim-core)) + (if (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance)) + 'attacking + ) + self + ) + ) + ) + (when (nonzero? (-> self neck)) + (cond + ((logtest? (-> self enemy-flags) (enemy-flag lock-focus)) + (let ((a0-10 (handle->process (-> self focus handle)))) + (if a0-10 + (target-set! (-> self neck) (get-trans (the-as process-focusable a0-10) 2)) + ) + ) + ) + ((logtest? (-> self enemy-flags) (enemy-flag death-start)) + (let ((s5-1 (-> self move-dest)) + (v1-47 (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> self node-list data (-> self enemy-info-override neck-joint)) + ) + ) + (a1-6 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-6 x) (-> s5-1 x)) + (set! (-> a1-6 y) (-> v1-47 y)) + (set! (-> a1-6 z) (-> s5-1 z)) + (set! (-> a1-6 w) 1.0) + (target-set! (-> self neck) a1-6) + ) + ) + ) + ) + (when (and (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) + (>= (- (current-time) (-> self auto-reset-penetrate-time)) (seconds 0.1)) + ) + (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) + (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) + (let ((v1-62 0)) + (if (logtest? (penetrate knocked) (-> self root-override2 penetrate-using)) + (set! v1-62 (logior (shl 1 32) v1-62)) + ) + (set! (-> self root-override2 penetrate-using) (the-as penetrate v1-62)) + ) + ) + (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (enemy-method-136 self) + ) + (if (logtest? (enemy-flag trackable-backup directed-ready) (-> self enemy-flags)) + (enemy-method-54 self) + ) + (let ((v1-73 (-> self restore-nav-radius-time))) + (when (nonzero? v1-73) + (when (>= (current-time) v1-73) + (set! (-> self restore-nav-radius-time) 0) + (set! (-> self root-override2 nav-radius) (-> self nav-radius-backup)) + ) + ) + ) + (if (and *debug-segment* (-> self enemy-info-override debug-draw-neck) (nonzero? (-> self neck))) + (joint-mod-debug-draw (-> self neck)) + ) + (ja-post) + 0 + (none) ) ;; definition for method 177 of type nav-enemy @@ -361,7 +359,7 @@ (cond ((logtest? (-> s5-0 state flags) (nav-state-flag blocked)) (if (zero? (-> obj blocked-start-time)) - (set! (-> obj blocked-start-time) (-> self clock frame-counter)) + (set! (-> obj blocked-start-time) (current-time)) ) ) (else @@ -1024,44 +1022,40 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod nav-enemy-method-161 nav-enemy ((obj nav-enemy)) - (with-pp - (set! (-> obj enemy-flags) (the-as enemy-flag (logclear (-> obj enemy-flags) (enemy-flag enemy-flag39)))) - (set! (-> obj frustration-time) (-> pp clock frame-counter)) - (let ((v1-7 (handle->process (-> obj focus handle)))) - (if v1-7 - (set! (-> obj frustration-point quad) (-> (get-trans (the-as process-focusable v1-7) 1) quad)) - ) - ) - 0 - (none) + (set! (-> obj enemy-flags) (the-as enemy-flag (logclear (-> obj enemy-flags) (enemy-flag enemy-flag39)))) + (set! (-> obj frustration-time) (current-time)) + (let ((v1-7 (handle->process (-> obj focus handle)))) + (if v1-7 + (set! (-> obj frustration-point quad) (-> (get-trans (the-as process-focusable v1-7) 1) quad)) + ) ) + 0 + (none) ) ;; definition for method 160 of type nav-enemy (defmethod nav-enemy-method-160 nav-enemy ((obj nav-enemy)) - (with-pp - (let ((s5-0 (handle->process (-> obj focus handle)))) - (cond - ((or (not s5-0) - (< 6144.0 (vector-vector-distance (get-trans (the-as process-focusable s5-0) 1) (-> obj frustration-point))) - (< (-> obj enemy-info-override frustration-distance) - (vector-vector-xz-distance (get-trans (the-as process-focusable s5-0) 0) (-> obj root-override2 trans)) - ) - ) - (nav-enemy-method-161 obj) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> obj frustration-time)) - (+ (-> obj reaction-time) (-> obj enemy-info-override frustration-time)) - ) - (set! (-> obj enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag39) (-> obj enemy-flags)))) - 0 - ) + (let ((s5-0 (handle->process (-> obj focus handle)))) + (cond + ((or (not s5-0) + (< 6144.0 (vector-vector-distance (get-trans (the-as process-focusable s5-0) 1) (-> obj frustration-point))) + (< (-> obj enemy-info-override frustration-distance) + (vector-vector-xz-distance (get-trans (the-as process-focusable s5-0) 0) (-> obj root-override2 trans)) + ) + ) + (nav-enemy-method-161 obj) + ) + (else + (when (>= (- (current-time) (-> obj frustration-time)) + (+ (-> obj reaction-time) (-> obj enemy-info-override frustration-time)) + ) + (set! (-> obj enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag39) (-> obj enemy-flags)))) + 0 ) ) ) - (none) ) + (none) ) ;; definition for method 162 of type nav-enemy @@ -1074,10 +1068,8 @@ ;; definition for method 163 of type nav-enemy (defmethod nav-enemy-method-163 nav-enemy ((obj nav-enemy)) - (with-pp - (let ((v1-0 (-> obj blocked-start-time))) - (and (nonzero? v1-0) (>= (- (-> pp clock frame-counter) v1-0) (-> obj enemy-info-override blocked-time))) - ) + (let ((v1-0 (-> obj blocked-start-time))) + (and (nonzero? v1-0) (>= (- (current-time) v1-0) (-> obj enemy-info-override blocked-time))) ) ) @@ -1553,10 +1545,7 @@ This commonly includes things such as: ;; WARN: Return type mismatch int vs time-frame. (defmethod nav-enemy-method-144 nav-enemy ((obj nav-enemy)) (set! (-> obj root-override2 nav-radius) 4.096) - (let ((s5-1 - (max (-> obj restore-nav-radius-time) (+ (-> self clock frame-counter) (get-rand-int-range obj 1500 2400))) - ) - ) + (let ((s5-1 (max (-> obj restore-nav-radius-time) (+ (current-time) (get-rand-int-range obj 1500 2400))))) (set! (-> obj restore-nav-radius-time) (the-as time-frame s5-1)) (the-as time-frame s5-1) ) @@ -1582,7 +1571,7 @@ This commonly includes things such as: (nav-enemy-method-176 self) (if (and (nav-enemy-method-163 self) (zero? (-> self restore-nav-radius-time)) - (>= (- (-> self clock frame-counter) (-> self blocked-start-time)) (seconds 4)) + (>= (- (current-time) (-> self blocked-start-time)) (seconds 4)) ) (nav-enemy-method-144 self) ) @@ -1600,14 +1589,14 @@ This commonly includes things such as: ;; WARN: Return type mismatch int vs none. (defbehavior nav-enemy-turn-to-face-dir nav-enemy ((arg0 vector) (arg1 float)) (local-vars (v1-18 symbol)) - (let ((s4-0 (-> self clock frame-counter))) + (let ((s4-0 (current-time))) (ja :group! (-> self draw art-group data (-> self enemy-info-override turn-anim))) (ja :num-func num-func-identity :frame-num 0.0) (until v1-18 (seek-toward-heading-vec! (-> self root-override2) arg0 (-> self nav max-rotation-rate) (seconds 0.02)) (suspend) (ja :num! (loop! 0.75)) - (set! v1-18 (or (>= (- (-> self clock frame-counter) s4-0) (seconds 10)) (enemy-method-94 self arg0 arg1))) + (set! v1-18 (or (>= (- (current-time) s4-0) (seconds 10)) (enemy-method-94 self arg0 arg1))) ) ) (forward-up->quaternion (-> self root-override2 quat) arg0 *y-vector*) @@ -2017,7 +2006,7 @@ This commonly includes things such as: (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info-override use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (nav-enemy-method-163 self) (go-stare2 self) ) @@ -2054,7 +2043,7 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior nav-enemy) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((a1-0 (new 'stack-no-clear 'vector))) (let ((a2-0 (-> self nav state))) (set! (-> a1-0 quad) (-> a2-0 target-post quad)) @@ -2089,14 +2078,14 @@ This commonly includes things such as: (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info-override use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (nav-enemy-method-163 self) (go-stare2 self) ) (let ((gp-0 (-> self focus aware))) (cond ((>= 1 (the-as int gp-0)) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (if (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (go-virtual active) ) ) @@ -2107,7 +2096,7 @@ This commonly includes things such as: (go-flee self) ) (else - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (if (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (go-stare self) ) ) @@ -2158,7 +2147,7 @@ This commonly includes things such as: 0 (nav-enemy-method-167 self) (vector-reset! (-> self root-override2 transv)) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) (none) ) :exit (behavior () @@ -2219,11 +2208,9 @@ This commonly includes things such as: ) (let ((gp-0 (-> self focus aware))) (if (< (the-as int gp-0) 2) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) ) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - (not (nav-enemy-method-163 self)) - ) + (when (and (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (not (nav-enemy-method-163 self))) (cond ((>= 1 (the-as int gp-0)) (go-virtual active) @@ -2232,7 +2219,7 @@ This commonly includes things such as: (if (and (get-enemy-target self) (not (and (-> self enemy-info-override use-frustration) (logtest? (enemy-flag enemy-flag39) (-> self enemy-flags))) ) - (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) + (>= (- (current-time) (-> self starting-time)) (-> self reaction-time)) ) (go-hostile self) ) @@ -2245,7 +2232,7 @@ This commonly includes things such as: ) ((and (= gp-0 (enemy-aware enemy-aware-2)) (-> self enemy-info-override use-pacing) - (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) + (>= (- (current-time) (-> self starting-time)) (-> self reaction-time)) ) (go-virtual pacing) ) @@ -2295,9 +2282,7 @@ This commonly includes things such as: ) :exit (-> (method-of-type nav-enemy stare) exit) :trans (behavior () - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - (not (nav-enemy-method-163 self)) - ) + (when (and (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (not (nav-enemy-method-163 self))) (let ((v1-6 (-> self focus aware))) (cond ((>= 1 (the-as int v1-6)) @@ -2315,14 +2300,14 @@ This commonly includes things such as: (ja-channel-push! 1 (seconds 0.2)) (let ((f30-0 (get-rand-float-range self 0.8 1.2))) (let ((gp-0 (get-rand-int-range self 60 210)) - (s5-0 (-> self clock frame-counter)) + (s5-0 (current-time)) (f28-0 f30-0) ) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info-override idle-anim)) :num! (loop! f28-0) :frame-num 0.0 ) - (until (>= (- (-> self clock frame-counter) s5-0) gp-0) + (until (>= (- (current-time) s5-0) gp-0) (suspend) (ja :num! (loop! f28-0)) ) @@ -2358,7 +2343,7 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior nav-enemy) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (look-at-target! self (enemy-flag lock-focus)) (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (let ((v1-6 self)) @@ -2377,7 +2362,7 @@ This commonly includes things such as: (logclear! (-> self mask) (process-mask actor-pause)) (set! (-> self move-dest quad) (-> self root-override2 trans quad)) (set! (-> self state-timeout) (the-as time-frame (get-rand-int-range self 2100 3300))) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) (if (zero? (get-rand-int self 2)) (set! (-> self enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag40) (-> self enemy-flags)))) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag enemy-flag40)))) @@ -2398,16 +2383,14 @@ This commonly includes things such as: ) (let ((gp-1 (-> self focus aware))) (if (or (!= gp-1 3) (not (get-enemy-target self))) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (>= 1 (the-as int gp-1)) (go-virtual active) ) (when (= gp-1 (enemy-aware enemy-aware-3)) - (when (and (get-enemy-target self) - (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) - ) + (when (and (get-enemy-target self) (>= (- (current-time) (-> self starting-time)) (-> self reaction-time))) (nav-enemy-method-161 self) (go-virtual hostile) ) @@ -2418,16 +2401,14 @@ This commonly includes things such as: (if (nav-enemy-method-163 self) (go-stare2 self) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (when (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (nav-enemy-method-161 self) (go-stare2 self) ) ) ) (when (>= 1024.0 (vector-vector-xz-distance (-> self root-override2 trans) (-> self move-dest))) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - (zero? (get-rand-int self 3)) - ) + (when (and (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (zero? (get-rand-int self 3))) (nav-enemy-method-161 self) (go-stare2 self) ) @@ -2502,7 +2483,7 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior nav-enemy) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (look-at-target! self (enemy-flag lock-focus)) (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (let ((v1-6 self)) @@ -2537,7 +2518,7 @@ This commonly includes things such as: ) (set! (-> self enemy-flags) (the-as enemy-flag (logxor (shl 256 32) (the-as int (-> self enemy-flags))))) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag enemy-flag41)))) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) (none) ) :trans (behavior () @@ -2548,9 +2529,9 @@ This commonly includes things such as: ) (let ((gp-1 (-> self focus aware))) (if (or (!= gp-1 3) (not (get-enemy-target self))) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (when (>= 1 (the-as int gp-1)) (nav-enemy-method-161 self) (if (-> self enemy-info-override use-stop-chase) @@ -2560,7 +2541,7 @@ This commonly includes things such as: ) (when (and (= gp-1 (enemy-aware enemy-aware-3)) (get-enemy-target self) - (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) + (>= (- (current-time) (-> self starting-time)) (-> self reaction-time)) ) (nav-enemy-method-161 self) (go-hostile self) @@ -2665,7 +2646,7 @@ This commonly includes things such as: (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (let ((v1-3 (-> self focus aware))) (if (!= v1-3 (enemy-aware unaware)) (go-stare self) @@ -2965,7 +2946,7 @@ This commonly includes things such as: (let ((s5-1 2)) (logior! (-> self focus-status) (focus-status in-air)) (until (enemy-method-86 self) - (+! (-> gp-0 hang-time) (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! (-> gp-0 hang-time) (- (current-time) (-> self clock old-frame-counter))) (enemy-method-90 self s5-1 gp-0) (enemy-method-91 self s5-1 gp-0) (enemy-method-92 self s5-1 (the-as nav-poly gp-0)) diff --git a/test/decompiler/reference/jak2/engine/physics/chain-physics_REF.gc b/test/decompiler/reference/jak2/engine/physics/chain-physics_REF.gc index 45f9feec7e..26429f9501 100644 --- a/test/decompiler/reference/jak2/engine/physics/chain-physics_REF.gc +++ b/test/decompiler/reference/jak2/engine/physics/chain-physics_REF.gc @@ -70,7 +70,7 @@ ;; definition for method 10 of type chain-physics ;; WARN: Return type mismatch int vs none. (defmethod turn-off chain-physics ((obj chain-physics) (arg0 time-frame)) - (set! (-> obj turn-off-start) (-> self clock frame-counter)) + (set! (-> obj turn-off-start) (current-time)) (set! (-> obj turn-off-duration) arg0) 0 (none) @@ -135,11 +135,9 @@ 0.0 (fmin 1.0 - (parameter-ease-sin-clamp (- 1.0 (/ (the float (- (-> self clock frame-counter) (-> obj turn-off-start))) - (the float (-> obj turn-off-duration)) - ) - ) - ) + (parameter-ease-sin-clamp + (- 1.0 (/ (the float (- (current-time) (-> obj turn-off-start))) (the float (-> obj turn-off-duration)))) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/physics/rigid-body_REF.gc b/test/decompiler/reference/jak2/engine/physics/rigid-body_REF.gc index 61d1c6aff6..580d966954 100644 --- a/test/decompiler/reference/jak2/engine/physics/rigid-body_REF.gc +++ b/test/decompiler/reference/jak2/engine/physics/rigid-body_REF.gc @@ -882,7 +882,6 @@ ) ;; definition for method 10 of type rigid-body-control -;; INFO: this function exists in multiple non-identical object files ;; WARN: Return type mismatch int vs object. (defmethod rigid-body-control-method-10 rigid-body-control ((obj rigid-body-control) (arg0 rigid-body-object) (arg1 float) (arg2 float)) (let* ((s4-1 (max 1 (min 4 (+ (the int (* 0.9999 (/ arg1 arg2))) 1)))) @@ -1173,7 +1172,7 @@ This commonly includes things such as: ;; WARN: Return type mismatch int vs none. (defmethod rigid-body-object-method-42 rigid-body-object ((obj rigid-body-object)) (logior! (-> obj flags) (rigid-body-object-flag disturbed)) - (set! (-> obj disturbed-time) (-> self clock frame-counter)) + (set! (-> obj disturbed-time) (current-time)) (if (not (logtest? (-> obj rbody state flags) (rigid-body-flag enable-physics))) (rigid-body-object-method-38 obj) ) @@ -1429,7 +1428,7 @@ This commonly includes things such as: (when s3-0 (when (logtest? (-> s3-0 mask) (process-mask target)) (logior! (-> obj flags) (rigid-body-object-flag player-touching)) - (set! (-> obj player-touch-time) (-> self clock frame-counter)) + (set! (-> obj player-touch-time) (current-time)) (rigid-body-object-method-42 obj) ) (if (not (logtest? (-> s3-0 mask) (process-mask target))) diff --git a/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc b/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc index 3b271cb283..46a402f7ee 100644 --- a/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc +++ b/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc @@ -148,7 +148,7 @@ ;; definition for method 9 of type impact-control ;; INFO: Used lq/sq (defmethod initialize impact-control ((obj impact-control) (arg0 process-drawable) (arg1 int) (arg2 float) (arg3 collide-spec)) - (set! (-> obj start-time) (-> self clock frame-counter)) + (set! (-> obj start-time) (current-time)) (set! (-> obj process) (the-as (pointer process-drawable) (process->ppointer arg0))) (set! (-> obj joint) arg1) (set! (-> obj radius) arg2) diff --git a/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc b/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc index 91228a4fd7..2d43617bc6 100644 --- a/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc +++ b/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc @@ -966,7 +966,7 @@ (set! (-> s5-0 root-channel) (-> s5-0 channel)) (set! (-> s5-0 blend-index) (the-as uint -1)) (dotimes (v1-19 arg0) - (set! (-> s5-0 root-channel v1-19 eval-time) (the-as uint (-> self clock frame-counter))) + (set! (-> s5-0 root-channel v1-19 eval-time) (the-as uint (current-time))) (set! (-> s5-0 root-channel v1-19 group-sub-index) v1-19) (set! (-> s5-0 root-channel v1-19 command) (if (zero? v1-19) (joint-control-command push) @@ -1032,7 +1032,7 @@ ) (set! (-> s5-0 active-channels) (the-as uint (+ arg0 1 (-> s5-0 active-channels)))) (dotimes (v1-38 arg0) - (set! (-> s5-0 root-channel v1-38 eval-time) (the-as uint (-> self clock frame-counter))) + (set! (-> s5-0 root-channel v1-38 eval-time) (the-as uint (current-time))) (set! (-> s5-0 root-channel v1-38 group-sub-index) v1-38) (set! (-> s5-0 root-channel v1-38 command) (if (zero? v1-38) (joint-control-command push) @@ -1090,7 +1090,7 @@ (else (let ((v0-1 (-> self skel channel (+ (-> self skel active-channels) (-> self skel float-channels))))) (+! (-> self skel float-channels) 1) - (set! (-> v0-1 eval-time) (the-as uint (-> self clock frame-counter))) + (set! (-> v0-1 eval-time) (the-as uint (current-time))) (set! (-> v0-1 group-sub-index) 0) (set! (-> v0-1 command) (joint-control-command float)) (set! (-> v0-1 frame-interp 0) arg2) @@ -1153,7 +1153,7 @@ (defbehavior ja-eval process-drawable () (let ((gp-0 (-> self skel root-channel 0)) (s5-0 (-> self skel channel (+ (-> self skel active-channels) (-> self skel float-channels)))) - (s4-0 (-> self clock frame-counter)) + (s4-0 (current-time)) ) (while (< (the-as int gp-0) (the-as int s5-0)) (cond @@ -1175,7 +1175,7 @@ (defbehavior ja-blend-eval process-drawable () (let ((gp-0 (-> self skel root-channel)) (s5-0 (the-as joint-control-channel (-> self skel channel))) - (s4-0 (-> self clock frame-counter)) + (s4-0 (current-time)) ) (when (and (nonzero? (-> self skel active-channels)) (!= gp-0 s5-0)) (while (< (the-as int s5-0) (the-as int gp-0)) @@ -1245,92 +1245,90 @@ ;; ERROR: Unsupported inline assembly instruction kind - [jr ra] (defmethod evaluate-joint-control process-drawable ((obj process-drawable)) (local-vars (s1-0 joint-control-channel) (s2-0 int) (s4-0 uint) (s7-0 none) (ra-0 int)) - (with-pp - (let ((gp-0 (-> obj skel))) - (let ((a0-1 (-> gp-0 top-anim))) - (b! (not a0-1) cfg-2 :delay (empty-form)) - (update a0-1) - ) - (until (= s4-0 (+ (-> gp-0 active-channels) (-> gp-0 float-channels))) - (label cfg-2) - (set! s4-0 (+ (-> gp-0 active-channels) (-> gp-0 float-channels))) - (let ((s3-0 (-> pp clock frame-counter))) - (b! (logtest? (-> obj draw status) (draw-control-status no-draw)) cfg-45 :delay (empty-form)) - (set! s2-0 0) - (b! #t cfg-30 :delay (nop!)) - (label cfg-4) - (set! s1-0 (-> gp-0 channel s2-0)) - (b! - (not (and (logtest? (-> s1-0 command) (joint-control-command thirty-two)) (!= (-> s1-0 eval-time) s3-0))) - cfg-10 - :delay (empty-form) - ) + (let ((gp-0 (-> obj skel))) + (let ((a0-1 (-> gp-0 top-anim))) + (b! (not a0-1) cfg-2 :delay (empty-form)) + (update a0-1) + ) + (until (= s4-0 (+ (-> gp-0 active-channels) (-> gp-0 float-channels))) + (label cfg-2) + (set! s4-0 (+ (-> gp-0 active-channels) (-> gp-0 float-channels))) + (let ((s3-0 (current-time))) + (b! (logtest? (-> obj draw status) (draw-control-status no-draw)) cfg-45 :delay (empty-form)) + (set! s2-0 0) + (b! #t cfg-30 :delay (nop!)) + (label cfg-4) + (set! s1-0 (-> gp-0 channel s2-0)) + (b! + (not (and (logtest? (-> s1-0 command) (joint-control-command thirty-two)) (!= (-> s1-0 eval-time) s3-0))) + cfg-10 + :delay (empty-form) ) - (joint-control-channel-eval s1-0) ) - (label cfg-10) - (let ((v1-19 (-> s1-0 command))) - (b! (!= v1-19 (joint-control-command stack)) cfg-12 :delay (nop!)) - (b! #t cfg-29 :delay (nop!)) - (label cfg-12) - (cond - ((= v1-19 (joint-control-command stack1)) - (set! (-> gp-0 channel (+ s2-0 -1) frame-interp 0) (-> s1-0 frame-interp 0)) - (set! (-> gp-0 channel (+ s2-0 -1) frame-interp 1) (-> s1-0 frame-interp 1)) - ) - (else - (let ((s0-0 (-> s1-0 frame-group))) - (when (not (and s0-0 (nonzero? s0-0) (= (logand (the-as int s0-0) 7) 4) (= (-> s0-0 type) art-joint-anim))) - (go process-drawable-art-error "joint-anim") - (.lw ra-0 return-from-thread s7-0) - (.jr ra-0) - (nop!) - 0 - ) - (when (nonzero? (-> s0-0 frames flags)) - (cond - ((logtest? (-> s0-0 frames flags) 2) - (update-time-stamp *anim-manager* s0-0) - ) - ((logtest? (-> s0-0 frames flags) 1) - (decompress *anim-manager* s0-0) - ) - ) - ) - (set! (-> s1-0 frame-num) - (fmax 0.0 (fmin (-> s1-0 frame-num) (the float (+ (-> s0-0 frames num-frames) -1)))) - ) + (joint-control-channel-eval s1-0) + ) + (label cfg-10) + (let ((v1-19 (-> s1-0 command))) + (b! (!= v1-19 (joint-control-command stack)) cfg-12 :delay (nop!)) + (b! #t cfg-29 :delay (nop!)) + (label cfg-12) + (cond + ((= v1-19 (joint-control-command stack1)) + (set! (-> gp-0 channel (+ s2-0 -1) frame-interp 0) (-> s1-0 frame-interp 0)) + (set! (-> gp-0 channel (+ s2-0 -1) frame-interp 1) (-> s1-0 frame-interp 1)) + ) + (else + (let ((s0-0 (-> s1-0 frame-group))) + (when (not (and s0-0 (nonzero? s0-0) (= (logand (the-as int s0-0) 7) 4) (= (-> s0-0 type) art-joint-anim))) + (go process-drawable-art-error "joint-anim") + (.lw ra-0 return-from-thread s7-0) + (.jr ra-0) + (nop!) + 0 ) + (when (nonzero? (-> s0-0 frames flags)) + (cond + ((logtest? (-> s0-0 frames flags) 2) + (update-time-stamp *anim-manager* s0-0) + ) + ((logtest? (-> s0-0 frames flags) 1) + (decompress *anim-manager* s0-0) + ) + ) + ) + (set! (-> s1-0 frame-num) + (fmax 0.0 (fmin (-> s1-0 frame-num) (the float (+ (-> s0-0 frames num-frames) -1)))) + ) ) ) ) - (label cfg-29) - (+! s2-0 1) - (label cfg-30) - (b! (< s2-0 (the-as int s4-0)) cfg-4) - (dotimes (v1-56 (the-as int s4-0)) - (set! (-> gp-0 channel v1-56 frame-interp 0) (fmax 0.0 (fmin 1.0 (-> gp-0 channel v1-56 frame-interp 0)))) - (set! (-> gp-0 channel v1-56 frame-interp 1) (fmax 0.0 (fmin 1.0 (-> gp-0 channel v1-56 frame-interp 1)))) - ) - (if (or (zero? s4-0) (or (not (-> gp-0 root-channel 0 frame-group)) (zero? (-> gp-0 active-channels)))) - (logior! (-> obj draw status) (draw-control-status no-draw-temp)) - ) - (if (logtest? (-> obj skel status) (joint-control-status blend-shape blend-shape-valid)) - (merc-blend-shape obj) - ) - (if (logtest? (-> obj skel status) (joint-control-status eye-anim-valid eye-anim)) - (merc-eye-anim obj) - ) - (label cfg-45) - (let ((a0-26 (-> gp-0 effect))) - (if a0-26 - (update-effects a0-26) - ) - ) ) - 0 - (none) + (label cfg-29) + (+! s2-0 1) + (label cfg-30) + (b! (< s2-0 (the-as int s4-0)) cfg-4) + (dotimes (v1-56 (the-as int s4-0)) + (set! (-> gp-0 channel v1-56 frame-interp 0) (fmax 0.0 (fmin 1.0 (-> gp-0 channel v1-56 frame-interp 0)))) + (set! (-> gp-0 channel v1-56 frame-interp 1) (fmax 0.0 (fmin 1.0 (-> gp-0 channel v1-56 frame-interp 1)))) + ) + (if (or (zero? s4-0) (or (not (-> gp-0 root-channel 0 frame-group)) (zero? (-> gp-0 active-channels)))) + (logior! (-> obj draw status) (draw-control-status no-draw-temp)) + ) + (if (logtest? (-> obj skel status) (joint-control-status blend-shape blend-shape-valid)) + (merc-blend-shape obj) + ) + (if (logtest? (-> obj skel status) (joint-control-status eye-anim-valid eye-anim)) + (merc-eye-anim obj) + ) + (label cfg-45) + (let ((a0-26 (-> gp-0 effect))) + (if a0-26 + (update-effects a0-26) + ) + ) ) + 0 + (none) ) ;; definition for function ja-post @@ -1467,33 +1465,31 @@ (arg5 float) (arg6 symbol) ) - (with-pp - (when (!= (-> obj interp) 0.0) - (let ((v1-1 obj)) - (set! (-> v1-1 frame-targ) arg0) - (set! (-> v1-1 frame-speed) arg4) - (set! (-> v1-1 frame-start) (/ arg1 (-> arg0 artist-step))) - (set! (-> v1-1 frame-blend) (if (zero? arg2) - 0.0 - (/ 5.0 (+ 5.0 (the float arg2))) - ) - ) - (set! (-> v1-1 frame-post-blend) (if (zero? arg3) - 0.0 - (/ 5.0 (+ 5.0 (the float arg3))) - ) - ) - (set! (-> v1-1 frame-post-end) (/ arg5 (-> arg0 artist-step))) - (set! (-> v1-1 frame-push-time) (-> pp clock frame-counter)) - (set! (-> v1-1 frame-post-put-away) #f) - ) - (if arg6 - (sound-play-by-spec (the-as sound-spec arg6) (new-sound-id) (the-as vector #t)) - ) + (when (!= (-> obj interp) 0.0) + (let ((v1-1 obj)) + (set! (-> v1-1 frame-targ) arg0) + (set! (-> v1-1 frame-speed) arg4) + (set! (-> v1-1 frame-start) (/ arg1 (-> arg0 artist-step))) + (set! (-> v1-1 frame-blend) (if (zero? arg2) + 0.0 + (/ 5.0 (+ 5.0 (the float arg2))) + ) + ) + (set! (-> v1-1 frame-post-blend) (if (zero? arg3) + 0.0 + (/ 5.0 (+ 5.0 (the float arg3))) + ) + ) + (set! (-> v1-1 frame-post-end) (/ arg5 (-> arg0 artist-step))) + (set! (-> v1-1 frame-push-time) (current-time)) + (set! (-> v1-1 frame-post-put-away) #f) ) - 0 - (none) + (if arg6 + (sound-play-by-spec (the-as sound-spec arg6) (new-sound-id) (the-as vector #t)) + ) ) + 0 + (none) ) ;; definition for method 10 of type top-anim-joint-control @@ -1505,230 +1501,228 @@ (the-as process-drawable (-> v1-0 0 self)) ) ) + (s3-0 (get-channel obj 1)) + (s5-0 (get-channel obj 0)) + (s4-0 (-> obj base-anim)) ) - (let ((s3-0 (get-channel obj 1)) - (s5-0 (get-channel obj 0)) - (s4-0 (-> obj base-anim)) - ) - (set! (-> obj frame-group-push) #f) - (cond - ((= (-> obj interp) 0.0) - (when s5-0 - (seek! (-> s5-0 frame-interp 1) 0.0 (* 8.0 (-> pp clock seconds-per-frame))) - (if s3-0 - (set! (-> s3-0 frame-interp 1) (fmin (-> s3-0 frame-interp 1) (-> s5-0 frame-interp 1))) - ) - (when (= (-> s5-0 frame-interp 1) 0.0) - (set! (-> obj frame-post-put-away) #f) - (when (= (-> obj interp) 0.0) - (joint-channel-float-delete! s5-0) - (set! (-> obj frame-group) #f) - (set! (-> obj frame-num) 0.0) - (set! (-> pp skel generate-frame-function) create-interpolated-joint-animation-frame) - ) - (when s3-0 - (joint-channel-float-delete! s3-0) - (set! (-> obj frame-group-push) #f) - ) + (set! (-> obj frame-group-push) #f) + (cond + ((= (-> obj interp) 0.0) + (when s5-0 + (seek! (-> s5-0 frame-interp 1) 0.0 (* 8.0 (-> pp clock seconds-per-frame))) + (if s3-0 + (set! (-> s3-0 frame-interp 1) (fmin (-> s3-0 frame-interp 1) (-> s5-0 frame-interp 1))) + ) + (when (= (-> s5-0 frame-interp 1) 0.0) + (set! (-> obj frame-post-put-away) #f) + (when (= (-> obj interp) 0.0) + (joint-channel-float-delete! s5-0) + (set! (-> obj frame-group) #f) + (set! (-> obj frame-num) 0.0) + (set! (-> pp skel generate-frame-function) create-interpolated-joint-animation-frame) + ) + (when s3-0 + (joint-channel-float-delete! s3-0) + (set! (-> obj frame-group-push) #f) ) ) ) - (else - (when (or (not s5-0) - (or (and (-> obj frame-targ) - (and (!= (-> obj frame-blend) 0.0) - (or (!= (-> s5-0 frame-group) (-> obj frame-targ)) (< (-> obj update-time) (-> obj frame-push-time))) - ) - ) - (and (not (-> obj frame-targ)) - (!= (-> s5-0 frame-group) s4-0) - (set! (-> obj frame-blend) (-> obj frame-post-blend)) - ) - ) + ) + (else + (when (or (not s5-0) + (or (and (-> obj frame-targ) + (and (!= (-> obj frame-blend) 0.0) + (or (!= (-> s5-0 frame-group) (-> obj frame-targ)) (< (-> obj update-time) (-> obj frame-push-time))) + ) + ) + (and (not (-> obj frame-targ)) + (!= (-> s5-0 frame-group) s4-0) + (set! (-> obj frame-blend) (-> obj frame-post-blend)) + ) + ) + ) + (when s3-0 + (joint-channel-float-delete! s3-0) + (set! (-> obj frame-group-push) #f) + (set! s5-0 (get-channel obj 0)) + (set! (-> s5-0 frame-interp 1) (-> obj interp)) + ) + (set! (-> pp skel generate-frame-function) create-interpolated2-joint-animation-frame) + (let ((s2-0 (the-as basic (-> obj frame-targ)))) + (set! s2-0 (cond + ((the-as art-joint-anim s2-0) + (empty) + s2-0 + ) + (else + s4-0 + ) + ) + ) + (set! s3-0 s5-0) + (if s3-0 + (set! (-> obj frame-group-push) (-> s3-0 frame-group)) + ) + (cond + ((= s4-0 s2-0) + (let ((v1-30 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) + (set! s5-0 (when v1-30 + (set! (-> v1-30 param 0) 1.0) + (set! (-> v1-30 num-func) num-func-loop!) + v1-30 + ) + ) + ) + (when s5-0 + (set! (-> s5-0 frame-num) (-> obj frame-start)) + (set! (-> obj base-anim-speed) 1.0) + (set! (-> obj base-anim-blend) 0.1333333) + ) + ) + ((>= (-> obj frame-speed) 0.0) + (let ((v1-35 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) + (set! s5-0 + (when v1-35 + (set! (-> v1-35 param 0) + (- (the float (+ (-> (the-as art-joint-anim s2-0) frames num-frames) -1)) (-> obj frame-post-end)) + ) + (set! (-> v1-35 param 1) (-> obj frame-speed)) + (set! (-> v1-35 num-func) num-func-seek!) + v1-35 + ) + ) + ) + (if s5-0 + (set! (-> s5-0 frame-num) (-> obj frame-start)) + ) + ) + (else + (when s5-0 + (let ((v1-39 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) + (set! s5-0 (when v1-39 + (set! (-> v1-39 param 0) 0.0) + (set! (-> v1-39 param 1) (fabs (-> obj frame-speed))) + (set! (-> v1-39 num-func) num-func-seek!) + v1-39 + ) + ) ) - (when s3-0 + (when s5-0 + (set! (-> s5-0 frame-num) (- (the float (+ (-> s5-0 frame-group frames num-frames) -1)) (-> obj frame-start))) + (set! (-> obj base-anim-speed) 1.0) + (set! (-> obj base-anim-blend) 0.1333333) + ) + ) + ) + ) + ) + (when s5-0 + (set! (-> obj frame-group) (-> s5-0 frame-group)) + (set! (-> obj frame-num) (-> s5-0 frame-num)) + (set! (-> obj frame-cur-blend) (-> obj frame-blend)) + ) + ) + (when s5-0 + (set! (-> pp skel interp-select 0) (the-as int (-> obj interp-select 0))) + (set! (-> pp skel interp-select 1) (the-as int (-> obj interp-select 1))) + (let ((f0-35 (cond + ((not (-> obj frame-targ)) + (-> obj base-anim-blend) + ) + (s3-0 + (-> obj frame-cur-blend) + ) + (else + 0.1333333 + ) + ) + ) + ) + (if (= f0-35 0.0) + (set! (-> s5-0 frame-interp 1) (-> obj interp)) + (seek! (-> s5-0 frame-interp 1) (-> obj interp) (* f0-35 (-> pp clock time-adjust-ratio))) + ) + ) + (when s3-0 + (set! (-> obj frame-group-push) (-> s3-0 frame-group)) + (set! (-> s3-0 frame-interp 1) (-> obj interp)) + (if (!= (-> s3-0 eval-time) (current-time)) + (joint-control-channel-eval s3-0) + ) + (when (= (-> s5-0 frame-interp 1) (-> obj interp)) (joint-channel-float-delete! s3-0) (set! (-> obj frame-group-push) #f) (set! s5-0 (get-channel obj 0)) (set! (-> s5-0 frame-interp 1) (-> obj interp)) ) - (set! (-> pp skel generate-frame-function) create-interpolated2-joint-animation-frame) - (let ((s2-0 (the-as basic (-> obj frame-targ)))) - (set! s2-0 (cond - ((the-as art-joint-anim s2-0) - (empty) - s2-0 - ) - (else - s4-0 - ) - ) - ) - (set! s3-0 s5-0) - (if s3-0 - (set! (-> obj frame-group-push) (-> s3-0 frame-group)) - ) - (cond - ((= s4-0 s2-0) - (let ((v1-30 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) - (set! s5-0 (when v1-30 - (set! (-> v1-30 param 0) 1.0) - (set! (-> v1-30 num-func) num-func-loop!) - v1-30 - ) - ) - ) - (when s5-0 - (set! (-> s5-0 frame-num) (-> obj frame-start)) - (set! (-> obj base-anim-speed) 1.0) - (set! (-> obj base-anim-blend) 0.1333333) - ) - ) - ((>= (-> obj frame-speed) 0.0) - (let ((v1-35 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) - (set! s5-0 - (when v1-35 - (set! (-> v1-35 param 0) - (- (the float (+ (-> (the-as art-joint-anim s2-0) frames num-frames) -1)) (-> obj frame-post-end)) - ) - (set! (-> v1-35 param 1) (-> obj frame-speed)) - (set! (-> v1-35 num-func) num-func-seek!) - v1-35 - ) - ) - ) - (if s5-0 - (set! (-> s5-0 frame-num) (-> obj frame-start)) - ) - ) - (else - (when s5-0 - (let ((v1-39 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) - (set! s5-0 (when v1-39 - (set! (-> v1-39 param 0) 0.0) - (set! (-> v1-39 param 1) (fabs (-> obj frame-speed))) - (set! (-> v1-39 num-func) num-func-seek!) - v1-39 - ) - ) - ) - (when s5-0 - (set! (-> s5-0 frame-num) (- (the float (+ (-> s5-0 frame-group frames num-frames) -1)) (-> obj frame-start))) - (set! (-> obj base-anim-speed) 1.0) - (set! (-> obj base-anim-blend) 0.1333333) - ) - ) - ) - ) - ) - (when s5-0 - (set! (-> obj frame-group) (-> s5-0 frame-group)) - (set! (-> obj frame-num) (-> s5-0 frame-num)) - (set! (-> obj frame-cur-blend) (-> obj frame-blend)) - ) ) - (when s5-0 - (set! (-> pp skel interp-select 0) (the-as int (-> obj interp-select 0))) - (set! (-> pp skel interp-select 1) (the-as int (-> obj interp-select 1))) - (let ((f0-35 (cond - ((not (-> obj frame-targ)) - (-> obj base-anim-blend) - ) - (s3-0 - (-> obj frame-cur-blend) - ) - (else - 0.1333333 - ) - ) - ) - ) - (if (= f0-35 0.0) - (set! (-> s5-0 frame-interp 1) (-> obj interp)) - (seek! (-> s5-0 frame-interp 1) (-> obj interp) (* f0-35 (-> pp clock time-adjust-ratio))) - ) - ) - (when s3-0 - (set! (-> obj frame-group-push) (-> s3-0 frame-group)) - (set! (-> s3-0 frame-interp 1) (-> obj interp)) - (if (!= (-> s3-0 eval-time) (-> pp clock frame-counter)) - (joint-control-channel-eval s3-0) - ) - (when (= (-> s5-0 frame-interp 1) (-> obj interp)) - (joint-channel-float-delete! s3-0) - (set! (-> obj frame-group-push) #f) - (set! s5-0 (get-channel obj 0)) - (set! (-> s5-0 frame-interp 1) (-> obj interp)) - ) - ) - (let ((v1-70 (-> obj frame-targ))) - (cond - (v1-70 - (cond - ((= (-> s5-0 frame-group) v1-70) - (if (!= (-> s5-0 eval-time) (-> pp clock frame-counter)) - (joint-control-channel-eval s5-0) - ) - (when (= (-> s5-0 frame-num) (-> s5-0 param 0)) - (set! (-> obj frame-targ) #f) - (set! (-> obj frame-start) 0.0) - (cond - ((-> obj frame-post-put-away) - (set! (-> obj interp) 0.0) - (set! (-> obj frame-post-put-away) #f) - ) - ((!= (-> obj frame-post-blend) 0.0) - (set! (-> s5-0 param 0) (the float (+ (-> s5-0 frame-group frames num-frames) -1))) - ) - (else - (set! (-> s5-0 frame-num) 0.0) - (set! (-> s5-0 frame-group) (the-as art-joint-anim s4-0)) - (set! (-> s5-0 num-func) num-func-loop!) - (set! (-> s5-0 param 0) 1.0) - ) + (let ((v1-70 (-> obj frame-targ))) + (cond + (v1-70 + (cond + ((= (-> s5-0 frame-group) v1-70) + (if (!= (-> s5-0 eval-time) (current-time)) + (joint-control-channel-eval s5-0) + ) + (when (= (-> s5-0 frame-num) (-> s5-0 param 0)) + (set! (-> obj frame-targ) #f) + (set! (-> obj frame-start) 0.0) + (cond + ((-> obj frame-post-put-away) + (set! (-> obj interp) 0.0) + (set! (-> obj frame-post-put-away) #f) + ) + ((!= (-> obj frame-post-blend) 0.0) + (set! (-> s5-0 param 0) (the float (+ (-> s5-0 frame-group frames num-frames) -1))) + ) + (else + (set! (-> s5-0 frame-num) 0.0) + (set! (-> s5-0 frame-group) (the-as art-joint-anim s4-0)) + (set! (-> s5-0 num-func) num-func-loop!) + (set! (-> s5-0 param 0) 1.0) ) ) ) - (else - (set! (-> s5-0 eval-time) (the-as uint (-> pp clock frame-counter))) - (set! (-> s5-0 frame-group) v1-70) - (set! (-> s5-0 frame-num) (if (< (-> obj frame-speed) 0.0) - (- (the float (+ (-> v1-70 frames num-frames) -1)) (-> obj frame-start)) - (set! (-> s5-0 frame-num) (-> obj frame-start)) - ) - ) - (set! (-> s5-0 num-func) num-func-seek!) - (if (>= (-> obj frame-speed) 0.0) - (set! (-> s5-0 param 0) - (- (the float (+ (-> s5-0 frame-group frames num-frames) -1)) (-> obj frame-post-end)) - ) - (set! (-> s5-0 param 0) 0.0) + ) + (else + (set! (-> s5-0 eval-time) (the-as uint (current-time))) + (set! (-> s5-0 frame-group) v1-70) + (set! (-> s5-0 frame-num) (if (< (-> obj frame-speed) 0.0) + (- (the float (+ (-> v1-70 frames num-frames) -1)) (-> obj frame-start)) + (set! (-> s5-0 frame-num) (-> obj frame-start)) + ) ) - (set! (-> s5-0 param 1) (fabs (-> obj frame-speed))) - ) + (set! (-> s5-0 num-func) num-func-seek!) + (if (>= (-> obj frame-speed) 0.0) + (set! (-> s5-0 param 0) + (- (the float (+ (-> s5-0 frame-group frames num-frames) -1)) (-> obj frame-post-end)) + ) + (set! (-> s5-0 param 0) 0.0) + ) + (set! (-> s5-0 param 1) (fabs (-> obj frame-speed))) ) ) - (else - (when (!= (-> s5-0 frame-group) s4-0) - (set! (-> s5-0 frame-num) 0.0) - (set! (-> obj base-anim-speed) 1.0) - (set! (-> obj base-anim-blend) 0.1333333) - ) - (set! (-> s5-0 frame-group) (the-as art-joint-anim s4-0)) - (set! (-> s5-0 num-func) num-func-loop!) - (set! (-> s5-0 param 0) (-> obj base-anim-speed)) - (set! (-> obj frame-post-blend) 0.1333333) - ) + ) + (else + (when (!= (-> s5-0 frame-group) s4-0) + (set! (-> s5-0 frame-num) 0.0) + (set! (-> obj base-anim-speed) 1.0) + (set! (-> obj base-anim-blend) 0.1333333) + ) + (set! (-> s5-0 frame-group) (the-as art-joint-anim s4-0)) + (set! (-> s5-0 num-func) num-func-loop!) + (set! (-> s5-0 param 0) (-> obj base-anim-speed)) + (set! (-> obj frame-post-blend) 0.1333333) ) ) - (set! (-> obj frame-group) (-> s5-0 frame-group)) - (set! (-> obj frame-num) (-> s5-0 frame-num)) ) + (set! (-> obj frame-group) (-> s5-0 frame-group)) + (set! (-> obj frame-num) (-> s5-0 frame-num)) ) ) ) - (set! (-> obj update-time) (-> pp clock frame-counter)) ) + (set! (-> obj update-time) (current-time)) 0 (none) ) @@ -1817,7 +1811,7 @@ (while (and *target* (focus-test? *target* in-air)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (process-grab? *target* #f) (while (or (-> *setting-control* user-current talking) (-> *setting-control* user-current spooling) @@ -1826,7 +1820,7 @@ ) (suspend) ) - (while (< (- (-> self clock frame-counter) (-> self state-time)) arg0) + (while (< (- (current-time) (-> self state-time)) arg0) (suspend) ) (process-release? *target*) diff --git a/test/decompiler/reference/jak2/engine/process-drawable/process-taskable_REF.gc b/test/decompiler/reference/jak2/engine/process-drawable/process-taskable_REF.gc index b340be28eb..70b0cb9a31 100644 --- a/test/decompiler/reference/jak2/engine/process-drawable/process-taskable_REF.gc +++ b/test/decompiler/reference/jak2/engine/process-drawable/process-taskable_REF.gc @@ -81,7 +81,7 @@ Seen take in - `true-func` which takes no args TODO - seems fishy :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (the-as object (case event-type (('say) - (let ((v0-0 (-> self clock frame-counter))) + (let ((v0-0 (current-time))) (set! (-> self want-to-say) v0-0) v0-0 ) @@ -90,7 +90,7 @@ Seen take in - `true-func` which takes no args TODO - seems fishy ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self draw status) (draw-control-status no-draw-bounds)) (let ((v1-6 (-> self root-override root-prim))) (set! (-> v1-6 prim-core collide-as) (collide-spec)) @@ -111,7 +111,7 @@ Seen take in - `true-func` which takes no args TODO - seems fishy (let ((v1-1 (get-current-task-event (-> self task)))) (if (and (nonzero? (-> v1-1 action)) (or (not (logtest? (-> self draw status) (draw-control-status on-screen))) (logtest? (-> v1-1 flags) (game-task-flags gatflag-01)) - (< (- (-> self clock frame-counter) (-> self birth-time)) (seconds 0.1)) + (< (- (current-time) (-> self birth-time)) (seconds 0.1)) ) ) (go-virtual idle) @@ -126,7 +126,7 @@ Seen take in - `true-func` which takes no args TODO - seems fishy (defstate idle (process-taskable) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -181,7 +181,7 @@ Seen take in - `true-func` which takes no args TODO - seems fishy (< (vector-vector-distance (target-pos 0) s5-0) f30-0) ) ) - (< (- (-> self clock frame-counter) (-> self want-to-say)) (seconds 4)) + (< (- (current-time) (-> self want-to-say)) (seconds 4)) ) (or (not (load-in-progress? *level*)) (= (-> gp-0 action) (game-task-action say))) (and (not (movie?)) @@ -201,9 +201,7 @@ Seen take in - `true-func` which takes no args TODO - seems fishy ) (process-taskable-method-34 self) ) - (when (or (= (-> gp-0 action) (game-task-action say)) - (< (- (-> self clock frame-counter) (-> self want-to-say)) (seconds 4)) - ) + (when (or (= (-> gp-0 action) (game-task-action say)) (< (- (current-time) (-> self want-to-say)) (seconds 4))) (case (-> gp-0 action) (((game-task-action play)) (go-virtual play-game gp-0) @@ -283,7 +281,7 @@ Seen take in - `true-func` which takes no args TODO - seems fishy ) :exit (behavior () (set! (-> self last-talk) (-> *display* game-clock frame-counter)) - (if (< (- (-> self clock frame-counter) (-> self want-to-say)) (seconds 4)) + (if (< (- (current-time) (-> self want-to-say)) (seconds 4)) (set! (-> self will-talk) #t) (set! (-> self will-talk) #f) ) @@ -324,8 +322,8 @@ Seen take in - `true-func` which takes no args TODO - seems fishy :enter (-> (method-of-type process-taskable active) enter) :exit (-> (method-of-type process-taskable active) exit) :code (behavior ((arg0 game-task-event)) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.5)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.5)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/engine/scene/scene_REF.gc b/test/decompiler/reference/jak2/engine/scene/scene_REF.gc index e92d21f64d..3f0463f7bf 100644 --- a/test/decompiler/reference/jak2/engine/scene/scene_REF.gc +++ b/test/decompiler/reference/jak2/engine/scene/scene_REF.gc @@ -921,7 +921,7 @@ (defstate wait (scene-player) :virtual #t :enter (behavior ((arg0 symbol)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (when (or (-> self scene) (-> self preload-continue)) (let ((gp-0 (scene-decode-continue (the-as basic (if (-> self scene) (-> self scene load-point-obj) @@ -1012,12 +1012,12 @@ (and (-> *target* next-state) (= (-> *target* next-state name) 'target-flop-hit-ground)) ) (-> self scene) - (< (- (-> self clock frame-counter) (-> self state-time)) (-> self scene wait-air-time)) + (< (- (current-time) (-> self state-time)) (-> self scene wait-air-time)) ) (suspend) ) (suspend) - (let ((s5-0 (-> self clock frame-counter))) + (let ((s5-0 (current-time))) (when (and *target* (not (logtest? (-> *target* focus-status) (focus-status grabbed)))) (label cfg-44) (when (not (process-grab? *target* #f)) @@ -1050,11 +1050,10 @@ ) ) (when arg0 - (while (and (-> self scene) - (not (or (>= (- (-> self clock frame-counter) s5-0) (-> self scene wait-ground-time)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self scene wait-max-time)) - ) - ) + (while (and (-> self scene) (not (or (>= (- (current-time) s5-0) (-> self scene wait-ground-time)) + (>= (- (current-time) (-> self state-time)) (-> self scene wait-max-time)) + ) + ) ) (suspend) ) @@ -1153,8 +1152,8 @@ (* 30.0 (-> self clock seconds-per-frame)) (bucket-id screen-filter) ) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.05)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.05)) (suspend) ) ) @@ -1319,7 +1318,7 @@ (suspend) (scene-player-method-25 self 0.0) (set! (-> self cur-speed) 0.0) - (set! (-> self scene-start-time) (-> self clock frame-counter)) + (set! (-> self scene-start-time) (current-time)) (ja-play-spooled-anim (-> self anim) (the-as art-joint-anim #f) @@ -1492,10 +1491,10 @@ ) (when (cpad-pressed? 0 square) (set! (-> *setting-control* user-default subtitle) (not (-> *setting-control* user-default subtitle))) - (set! (-> self subtitle-change-time) (-> self clock frame-counter)) + (set! (-> self subtitle-change-time) (current-time)) ) - (when (and (< (- (-> self clock frame-counter) (-> self subtitle-change-time)) (seconds 2)) - (< (mod (- (-> self clock frame-counter) (-> self subtitle-change-time)) 300) 210) + (when (and (< (- (current-time) (-> self subtitle-change-time)) (seconds 2)) + (< (mod (- (current-time) (-> self subtitle-change-time)) 300) 210) ) (let ((gp-6 (new 'stack 'font-context *font-default-matrix* 36 60 0.0 (font-color default) (font-flags shadow kerning)) @@ -1537,31 +1536,31 @@ (cond ((cpad-hold? 0 r1) (if (cpad-pressed? 0 circle) - (set! (-> self speed-press-time) (-> self clock frame-counter)) + (set! (-> self speed-press-time) (current-time)) ) (seek! (-> self speed-change-speed) 8.0 - (* (lerp-scale 0.01 0.3 (the float (- (-> self clock frame-counter) (-> self speed-press-time))) 0.0 300.0) + (* (lerp-scale 0.01 0.3 (the float (- (current-time) (-> self speed-press-time))) 0.0 300.0) (-> self clock time-adjust-ratio) ) ) ) ((cpad-hold? 0 l1) (if (cpad-pressed? 0 square) - (set! (-> self speed-press-time) (-> self clock frame-counter)) + (set! (-> self speed-press-time) (current-time)) ) (seek! (-> self speed-change-speed) -8.0 - (* (lerp-scale 0.01 0.3 (the float (- (-> self clock frame-counter) (-> self speed-press-time))) 0.0 300.0) + (* (lerp-scale 0.01 0.3 (the float (- (current-time) (-> self speed-press-time))) 0.0 300.0) (-> self clock time-adjust-ratio) ) ) ) ((cpad-hold? 0 x) (when (cpad-pressed? 0 x) - (set! (-> self speed-press-time) (-> self clock frame-counter)) + (set! (-> self speed-press-time) (current-time)) (cond ((= (-> self cur-speed) 0.0) (set! (-> self speed-change-speed) -1000.0) @@ -1594,12 +1593,12 @@ ) (set! (-> self targ-speed) 0.0) (set! (-> self cur-speed) 0.0) - (set! (-> self speed-change-time) (-> self clock frame-counter)) + (set! (-> self speed-change-time) (current-time)) ) ) ((= (-> self speed-change-speed) -1000.0) (when (!= (-> self cur-speed) -1000.0) - (set! (-> self speed-change-time) (-> self clock frame-counter)) + (set! (-> self speed-change-time) (current-time)) (set! (-> self targ-speed) -1000.0) (set! (-> self cur-speed) -1000.0) (sound-pause (-> gp-7 id)) @@ -1612,7 +1611,7 @@ (fmin 10.0 (+ (-> self targ-speed) (* (-> self speed-change-speed) (-> self clock seconds-per-frame)))) ) ) - (if (< (- (-> self clock frame-counter) (-> self speed-change-time)) (seconds 3)) + (if (< (- (current-time) (-> self speed-change-time)) (seconds 3)) (format *stdcon* "id ~d speed ~f~%" @@ -1624,8 +1623,8 @@ ) ) (when (and gp-7 (and (!= (-> self targ-speed) (-> self cur-speed)) - (< (-> self speed-change-time) (-> self clock frame-counter)) - (>= (- (-> self clock frame-counter) (-> self scene-start-time)) (seconds 1)) + (< (-> self speed-change-time) (current-time)) + (>= (- (current-time) (-> self scene-start-time)) (seconds 1)) ) ) (when *sound-player-enable* @@ -1638,7 +1637,7 @@ ) ) (set! (-> self cur-speed) (-> self targ-speed)) - (set! (-> self speed-change-time) (-> self clock frame-counter)) + (set! (-> self speed-change-time) (current-time)) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc b/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc index d3a3ea3444..a3ef031e4a 100644 --- a/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc +++ b/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc @@ -966,10 +966,10 @@ otherwise, an explicit [[vector]] can be provided" ) (cond ((-> obj spec) - (when (or (< (-> obj time-base) 0) (>= (-> pp clock frame-counter) (-> obj play-time))) + (when (or (< (-> obj time-base) 0) (>= (current-time) (-> obj play-time))) (when (>= (-> obj time-base) 0) (set! (-> obj play-time) - (+ (-> pp clock frame-counter) (-> obj time-base) (rand-vu-int-count (the-as int (-> obj time-random)))) + (+ (current-time) (-> obj time-base) (rand-vu-int-count (the-as int (-> obj time-random)))) ) (set! (-> obj playing-id) (new-sound-id)) ) @@ -991,7 +991,7 @@ otherwise, an explicit [[vector]] can be provided" ) ) (when (and *debug-effect-control* (>= (-> obj time-base) 0)) - (format #t "(~5D) effect sound ~A ~G " (-> pp clock frame-counter) (-> pp name) (&-> s5-1 sound-name)) + (format #t "(~5D) effect sound ~A ~G " (current-time) (-> pp name) (&-> s5-1 sound-name)) (format #t "volume: ~f pitch-mod: ~f~%" @@ -1025,7 +1025,7 @@ otherwise, an explicit [[vector]] can be provided" ) ) (else - (when (>= (-> pp clock frame-counter) (-> obj play-time)) + (when (>= (current-time) (-> obj play-time)) (set! (-> obj playing-id) (sound-play-by-name (-> obj name) @@ -1038,7 +1038,7 @@ otherwise, an explicit [[vector]] can be provided" ) ) (set! (-> obj play-time) - (+ (-> pp clock frame-counter) (-> obj time-base) (rand-vu-int-count (the-as int (-> obj time-random)))) + (+ (current-time) (-> obj time-base) (rand-vu-int-count (the-as int (-> obj time-random)))) ) ) ) @@ -1301,32 +1301,31 @@ otherwise, an explicit [[vector]] can be provided" (defun sound-bank-reload () (process-spawn-function process - (lambda () (with-pp - (let ((gp-0 (new 'static 'boxed-array :type symbol :length 0 :allocated-length 3))) - (dotimes (v1-0 3) - (set! (-> gp-0 v1-0) (the-as symbol (-> *level* sound-bank v1-0))) - ) - (let ((a1-3 (new 'stack-no-clear 'array 'symbol 4))) - (set! (-> a1-3 2) 'empty2) - (set! (-> a1-3 1) 'empty1) - (set! (-> a1-3 0) 'empty0) - (want-sound-banks *load-state* a1-3) - ) - (let ((s5-0 (-> pp clock frame-counter))) - (until (>= (- (-> pp clock frame-counter) s5-0) (seconds 1)) - (suspend) - ) - ) - (let ((a1-4 (new 'stack-no-clear 'array 'symbol 4))) - (set! (-> a1-4 2) (-> gp-0 2)) - (set! (-> a1-4 1) (-> gp-0 1)) - (set! (-> a1-4 0) (-> gp-0 0)) - (want-sound-banks *load-state* a1-4) - ) - ) - (none) - ) + (lambda () + (let ((gp-0 (new 'static 'boxed-array :type symbol :length 0 :allocated-length 3))) + (dotimes (v1-0 3) + (set! (-> gp-0 v1-0) (the-as symbol (-> *level* sound-bank v1-0))) + ) + (let ((a1-3 (new 'stack-no-clear 'array 'symbol 4))) + (set! (-> a1-3 2) 'empty2) + (set! (-> a1-3 1) 'empty1) + (set! (-> a1-3 0) 'empty0) + (want-sound-banks *load-state* a1-3) + ) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) (seconds 1)) + (suspend) ) + ) + (let ((a1-4 (new 'stack-no-clear 'array 'symbol 4))) + (set! (-> a1-4 2) (-> gp-0 2)) + (set! (-> a1-4 1) (-> gp-0 1)) + (set! (-> a1-4 0) (-> gp-0 0)) + (want-sound-banks *load-state* a1-4) + ) + ) + (none) + ) :to *display-pool* ) 0 diff --git a/test/decompiler/reference/jak2/engine/sound/speech_REF.gc b/test/decompiler/reference/jak2/engine/sound/speech_REF.gc index 5651b92e23..c11fc060db 100644 --- a/test/decompiler/reference/jak2/engine/sound/speech_REF.gc +++ b/test/decompiler/reference/jak2/engine/sound/speech_REF.gc @@ -56,10 +56,10 @@ (let ((s4-0 (handle->process (-> obj request handle)))) (when s4-0 (when (or (and (>= (-> obj request priority) 0.0) - (>= (- (-> pp clock frame-counter) (-> obj end-time)) (the-as time-frame (-> s5-1 delay))) + (>= (- (current-time) (-> obj end-time)) (the-as time-frame (-> s5-1 delay))) ) - (and (>= (- (-> pp clock frame-counter) (-> obj end-time)) (the-as time-frame (-> s5-1 delay))) - (>= (- (-> pp clock frame-counter) (-> obj end-time)) (the-as time-frame (-> obj delay))) + (and (>= (- (current-time) (-> obj end-time)) (the-as time-frame (-> s5-1 delay))) + (>= (- (current-time) (-> obj end-time)) (the-as time-frame (-> obj delay))) ) ) (let ((s3-0 (-> s5-1 list length)) @@ -86,7 +86,7 @@ (set! (-> s5-1 play-index) v1-44) (let ((s3-1 (-> s5-1 list v1-44))) (mem-copy! (the-as pointer (-> obj last-request)) (the-as pointer (-> obj request)) 21) - (set! (-> obj start-time) (-> pp clock frame-counter)) + (set! (-> obj start-time) (current-time)) (set! (-> obj delay) (the-as uint (rand-vu-int-range (the-as int (-> s5-1 min-delay)) (the-as int (-> s5-1 max-delay)))) ) @@ -107,7 +107,7 @@ ) ) ) - (set! (-> obj update-time) (-> pp clock frame-counter)) + (set! (-> obj update-time) (current-time)) (when (nonzero? (-> obj id)) (let ((s4-1 (handle->process (-> obj last-request handle)))) (cond @@ -153,7 +153,7 @@ ) (case (get-status *gui-control* (-> obj id)) (((gui-status pending)) - (when (>= (- (-> pp clock frame-counter) (-> obj start-time)) (seconds 1)) + (when (>= (- (current-time) (-> obj start-time)) (seconds 1)) (set-action! *gui-control* (gui-action stop) @@ -183,27 +183,25 @@ ;; definition for method 9 of type speech-channel ;; WARN: Return type mismatch int vs none. (defmethod speech-channel-method-9 speech-channel ((obj speech-channel) (arg0 process-drawable) (arg1 speech-type)) - (with-pp - (let ((f0-0 (vector-vector-distance-squared (-> arg0 root trans) (-> obj 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 (-> obj speech-table arg1 priority)))) - ) - (when (< (-> obj request priority) f0-2) - (set! (-> obj request priority) f0-2) - (set! (-> obj request handle) (process->handle arg0)) - (set! (-> obj request speech-type) arg1) - (set! (-> obj request time) (-> pp clock frame-counter)) - ) + (let ((f0-0 (vector-vector-distance-squared (-> arg0 root trans) (-> obj 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 (-> obj speech-table arg1 priority)))) + ) + (when (< (-> obj request priority) f0-2) + (set! (-> obj request priority) f0-2) + (set! (-> obj request handle) (process->handle arg0)) + (set! (-> obj request speech-type) arg1) + (set! (-> obj request time) (current-time)) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 10 of type speech-channel diff --git a/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc b/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc index 22306b55b0..d1272d9c51 100644 --- a/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc @@ -411,13 +411,13 @@ (not (logtest? (-> *cpad-list* cpads (-> self control cpad number) button0-abs 0) (pad-buttons l2))) ) (not *pause-lock*) - (>= (- (-> self clock frame-counter) (-> self control time-of-last-debug-heal)) (seconds 0.1)) + (>= (- (current-time) (-> self control time-of-last-debug-heal)) (seconds 0.1)) (>= (-> self control last-time-on-surface) (-> self control time-of-last-debug-float)) ) (-> self board latch?) ) (not (focus-test? self dead hit grabbed in-head edge-grab pole board pilot mech dark)) - (or (zero? (-> self board)) (>= (- (-> self clock frame-counter) (-> self board board-time)) (seconds 0.5))) + (or (zero? (-> self board)) (>= (- (current-time) (-> self board board-time)) (seconds 0.5))) (not (logtest? (state-flags prevent-board) (-> self state-flags))) (< (-> self board board-time) (-> self control list-time-on-ground)) (not (logtest? (surface-flag no-board) (-> self control current-surface flags))) @@ -466,10 +466,7 @@ #f #t ) - (begin - (set! (-> self board latch?) #t) - (>= (- (-> self clock frame-counter) (-> self gun gun-time)) (seconds 0.4)) - ) + (begin (set! (-> self board latch?) #t) (>= (- (current-time) (-> self gun gun-time)) (seconds 0.4))) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc b/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc index 8c4ce99a96..c13a5aabf2 100644 --- a/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc @@ -64,7 +64,7 @@ ) (when (and (or (< (* f30-0 (-> self board turn-anim-targ)) 0.0) (= f30-0 0.0)) (and (< (* 0.2 (-> *TARGET_BOARD-bank* turn-frames)) (fabs (- f30-0 (-> self board turn-anim-targ)))) - (>= (-> self clock frame-counter) (-> self control turn-lockout-end-time)) + (>= (current-time) (-> self control turn-lockout-end-time)) ) ) (let ((v1-50 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) @@ -81,9 +81,7 @@ ) (set! (-> self board turn-anim-duck-vel) (* 0.98 (-> self board turn-anim-duck-vel))) (+! (-> self board turn-anim-duck-vel) (* -8.0 (-> self clock seconds-per-frame))) - (when (and (board-on-ground?) - (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame02)) (seconds 0.2)) - ) + (when (and (board-on-ground?) (>= (- (current-time) (-> self board unknown-time-frame02)) (seconds 0.2))) (if (logtest? (-> self control status) (collide-status impact-surface)) (+! (-> self board turn-anim-duck-vel) (lerp-scale 0.0 15.0 (-> self control normal-impact-vel) 0.0 81920.0)) ) @@ -104,31 +102,30 @@ (defbehavior target-board-spin-check target () (when (and (or (cpad-pressed? (-> self control cpad number) r1) (and (cpad-hold? (-> self control cpad number) r1) - (>= (- (-> self clock frame-counter) (-> self board spin-check-time)) (seconds 0.3)) + (>= (- (current-time) (-> self board spin-check-time)) (seconds 0.3)) ) ) (not (and (and (-> self next-state) (let ((v1-24 (-> self next-state name))) (or (= v1-24 'target-board-trickx) (= v1-24 'target-board-hold)) ) ) - (< (- (-> self clock frame-counter) (-> self board spin-start-time)) (seconds 0.5)) + (< (- (current-time) (-> self board spin-start-time)) (seconds 0.5)) ) ) (not (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control cpad number) r2))) ) - (set! (-> self board spin-start-time) (-> self clock frame-counter)) + (set! (-> self board spin-start-time) (current-time)) (set! (-> self board spin-start-dir quad) (-> self node-list data 3 bone transform vector 2 quad)) (vector-flatten! (-> self control turn-to-alt-heading) (-> self control c-R-w vector 2) *up-vector*) (vector-normalize! (-> self control turn-to-alt-heading) 1.0) (rot->dir-targ! (-> self control)) - (set! (-> self board trotyv-max) - (lerp-scale - 218453.33 - 91022.22 - (the float (- (-> self clock frame-counter) (-> self control last-time-on-surface))) - 0.0 - 300.0 - ) + (set! (-> self board trotyv-max) (lerp-scale + 218453.33 + 91022.22 + (the float (- (current-time) (-> self control last-time-on-surface))) + 0.0 + 300.0 + ) ) (set! (-> self board trotyv) 0.0) (set! (-> self board troty) 0.0) @@ -140,14 +137,14 @@ (cond ((and (cpad-hold? (-> self control cpad number) r1) (and (or (= (-> self control mod-surface name) 'spin) - (< (- (-> self clock frame-counter) (-> self board spin-time)) (seconds 0.05)) + (< (- (current-time) (-> self board spin-time)) (seconds 0.05)) ) (not (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control cpad number) r2))) ) ) (set! (-> self board turn-anim-tilt?) #f) (set! (-> self control mod-surface) *board-spin-mods*) - (set! (-> self board spin-time) (-> self clock frame-counter)) + (set! (-> self board spin-time) (current-time)) (let ((gp-0 (new 'stack-no-clear 'vector))) (set! (-> gp-0 x) (* -0.0078125 (+ -128.0 (the float (-> self control cpad leftx))))) (set! (-> gp-0 y) 0.0) @@ -193,7 +190,7 @@ (set! (-> self control mod-surface) (the-as surface (-> self board mods-backup))) ) ) - (set! (-> self board spin-check-time) (-> self clock frame-counter)) + (set! (-> self board spin-check-time) (current-time)) (when (and (or (cpad-pressed? (-> self control cpad number) l1) (< (-> self control last-time-on-surface) (-> self board unknown-time-frame06)) ) @@ -201,7 +198,7 @@ ) (set! (-> self board turn-anim-tilt?) #f) (set! (-> self control mod-surface) *board-spin-mods*) - (set! (-> self board unknown-time-frame03) (-> self clock frame-counter)) + (set! (-> self board unknown-time-frame03) (current-time)) (let ((gp-2 (new 'stack-no-clear 'vector))) (set! (-> gp-2 x) (* -0.0078125 (+ -128.0 (the float (-> self control cpad leftx))))) (set! (-> gp-2 y) 0.0) @@ -219,7 +216,7 @@ (< 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (and (>= (target-height-above-ground) 4096.0) (< (seconds 0.165) (target-time-to-ground)) - (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame05)) (seconds 0.05)) + (>= (- (current-time) (-> self board unknown-time-frame05)) (seconds 0.05)) (< (-> self board unknown-time-frame05) (-> self board unknown-time-frame06)) ) ) @@ -243,7 +240,7 @@ (< 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (and (>= (target-height-above-ground) 4096.0) (< (seconds 0.165) (target-time-to-ground)) - (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame05)) (seconds 0.05)) + (>= (- (current-time) (-> self board unknown-time-frame05)) (seconds 0.05)) ) ) ) @@ -315,7 +312,7 @@ ) (set! (-> self board troty-cum) 0.0) (set! (-> self board flip-count) 0) - (if (>= (- (-> self clock frame-counter) (-> self board in-air-time)) (seconds 0.2)) + (if (>= (- (current-time) (-> self board in-air-time)) (seconds 0.2)) (flush-trick-list (-> self board)) ) 0 @@ -332,7 +329,7 @@ (f28-0 (vector-y-angle (-> self control transv))) (f0-2 (y-angle (-> self control))) ) - (if (< (- (-> self clock frame-counter) (-> self board halfpipe-time)) (seconds 0.1)) + (if (< (- (current-time) (-> self board halfpipe-time)) (seconds 0.1)) (set! f28-0 (+ 32768.0 f28-0)) ) (let ((f0-5 (fabs (deg-diff f0-2 f28-0)))) @@ -440,7 +437,7 @@ (< 0.0 (vector-dot (-> self control transv) gp-0)) (and (< (-> self control surface-angle) 0.3) (zero? (-> self board halfpipe-side-time))) ) - (set! (-> self board halfpipe-side-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-side-time) (current-time)) (set! v0-3 (logior (-> self control root-prim prim-core action) (collide-action no-normal-reset))) (set! (-> self control root-prim prim-core action) v0-3) v0-3 @@ -448,11 +445,11 @@ (else (if (and (not (board-on-ground?)) (nonzero? (-> self board halfpipe-side-time)) - (>= (- (-> self clock frame-counter) (-> self board halfpipe-side-time)) (seconds 0.05)) + (>= (- (current-time) (-> self board halfpipe-side-time)) (seconds 0.05)) ) (go target-board-halfpipe) ) - (when (>= (- (-> self clock frame-counter) (-> self board halfpipe-side-time)) (seconds 0.2)) + (when (>= (- (current-time) (-> self board halfpipe-side-time)) (seconds 0.2)) (set! (-> self board halfpipe-side-time) 0) (set! v0-3 (logclear (-> self control root-prim prim-core action) (collide-action no-normal-reset))) (set! (-> self control root-prim prim-core action) v0-3) @@ -465,11 +462,11 @@ ;; definition for function target-board-jump-trans (defbehavior target-board-jump-trans target () - (when (and (!= (-> self state-time) (-> self clock frame-counter)) (jump-hit-ground-stuck?)) - (set! (-> self board jump-land-time) (-> self clock frame-counter)) + (when (and (!= (-> self state-time) (current-time)) (jump-hit-ground-stuck?)) + (set! (-> self board jump-land-time) (current-time)) (go target-board-hit-ground) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (target-board-smack-surface?) ) (if (and (cpad-pressed? (-> self control cpad number) x) @@ -517,8 +514,8 @@ (< 0.0 (vector-dot (-> self control transv) s5-0)) ) ) - (set! (-> self board halfpipe-lip-time) (-> self clock frame-counter)) - (set! (-> self board halfpipe-side-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-lip-time) (current-time)) + (set! (-> self board halfpipe-side-time) (current-time)) (set! (-> self board halfpipe-lip-event) (the-as symbol (-> event param 0))) (let ((v0-2 (the-as object (logior (-> self control root-prim prim-core action) (collide-action no-normal-reset)))) ) @@ -573,7 +570,7 @@ :trans (behavior () (if (and (cpad-hold? (-> self control cpad number) l1) (not (logtest? (-> self state-flags) (state-flags prevent-duck))) - (< (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (< (- (current-time) (-> self control last-time-on-surface)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) ) @@ -597,7 +594,7 @@ ) (vector-normalize! gp-0 1.0) (cond - ((and (< (- (-> self clock frame-counter) (-> self board halfpipe-jump-time)) (seconds 0.5)) + ((and (< (- (current-time) (-> self board halfpipe-jump-time)) (seconds 0.5)) (= (-> self control ground-pat mode) (pat-mode halfpipe)) ) ) @@ -605,7 +602,7 @@ (< 0.0 (vector-dot (-> self control transv) gp-0)) (< (-> self control surface-angle) 0.5) ) - (set! (-> self board halfpipe-jump-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-jump-time) (current-time)) (vector-float*! (-> self control transv) (-> self control transv) 1.5) ) (else @@ -616,14 +613,14 @@ ) ) (if (cpad-pressed? (-> self control cpad number) r1) - (set! (-> self board spin-ground-press-time) (-> self clock frame-counter)) + (set! (-> self board spin-ground-press-time) (current-time)) ) (if (and (cpad-hold? (-> self control cpad number) r1) (can-feet? #t) - (< (- (-> self clock frame-counter) (-> self board spin-ground-press-time)) (seconds 0.3)) + (< (- (current-time) (-> self board spin-ground-press-time)) (seconds 0.3)) (turn-around?) ) - (set! (-> self board spin-ground-start-time) (-> self clock frame-counter)) + (set! (-> self board spin-ground-start-time) (current-time)) ) (target-board-halfpipe-check) (if (target-board-smack-surface?) @@ -636,7 +633,7 @@ (set! (-> self control mod-surface) *board-walk-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) ) - ((and (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.1)) + ((and (>= (- (current-time) (-> self control last-time-on-surface)) (seconds 0.1)) (or (= (-> self control mod-surface name) 'spin) (< 4096.0 (target-height-above-ground))) ) (set! (-> self control mod-surface) *board-jump-mods*) @@ -768,7 +765,7 @@ :trans (behavior () (if (and (or (not (cpad-hold? (-> self control cpad number) l1)) (logtest? (-> self state-flags) (state-flags prevent-duck)) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> self control last-time-on-surface)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) ) @@ -794,7 +791,7 @@ ) (vector-normalize! gp-0 1.0) (cond - ((and (< (- (-> self clock frame-counter) (-> self board halfpipe-jump-time)) (seconds 0.5)) + ((and (< (- (current-time) (-> self board halfpipe-jump-time)) (seconds 0.5)) (= (-> self control ground-pat mode) (pat-mode halfpipe)) ) ) @@ -802,7 +799,7 @@ (< 0.0 (vector-dot (-> self control transv) gp-0)) (< (-> self control surface-angle) 0.5) ) - (set! (-> self board halfpipe-jump-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-jump-time) (current-time)) (vector-float*! (-> self control transv) (-> self control transv) 1.5) ) (else @@ -822,14 +819,14 @@ ) ) (if (cpad-pressed? (-> self control cpad number) r1) - (set! (-> self board spin-ground-press-time) (-> self clock frame-counter)) + (set! (-> self board spin-ground-press-time) (current-time)) ) (if (and (cpad-hold? (-> self control cpad number) r1) (can-feet? #t) - (< (- (-> self clock frame-counter) (-> self board spin-ground-press-time)) (seconds 0.3)) + (< (- (current-time) (-> self board spin-ground-press-time)) (seconds 0.3)) (turn-around?) ) - (set! (-> self board spin-ground-start-time) (-> self clock frame-counter)) + (set! (-> self board spin-ground-start-time) (current-time)) ) (target-board-halfpipe-check) (if (target-board-smack-surface?) @@ -843,7 +840,7 @@ (set! (-> self control mod-surface) *board-duck-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) ) - ((and (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.1)) + ((and (>= (- (current-time) (-> self control last-time-on-surface)) (seconds 0.1)) (or (= (-> self control mod-surface name) 'spin) (< 4096.0 (target-height-above-ground))) ) (set! (-> self control mod-surface) *board-duck-jump-mods*) @@ -864,7 +861,7 @@ ;; failed to figure out what this is: (defstate target-board-jump (target) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (if (and (= event-type 'edge-grab) (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1))) + (if (and (= event-type 'edge-grab) (< (- (current-time) (-> self state-time)) (seconds 0.1))) (return #f) ) (target-board-handler proc arg1 event-type event) @@ -877,7 +874,7 @@ (if (= arg2 'hit) (set! arg2 #f) ) - (when (< (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.5)) + (when (< (- (current-time) (-> self board ride-time)) (seconds 0.5)) (set! arg2 (the-as symbol *board-ride-jump-mods*)) (let ((s2-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> self control transv) 1.0))) (forward-up-nopitch->quaternion @@ -886,19 +883,19 @@ (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) ) (set! (-> self control turn-lockout-end-time) - (+ (-> self clock frame-counter) + (+ (current-time) (the int (lerp-scale 225.0 0.0 (vector-dot s2-0 (-> self control c-R-w vector 2)) -1.0 1.0)) ) ) ) ) (set! (-> self control dynam gravity-length) 245760.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((f30-0 0.0)) (cond ((and (< 0.0 (-> self board shock-offsetv)) - (< (- (-> self clock frame-counter) (-> self board jump-land-time)) (seconds 0.5)) - (>= (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.5)) + (< (- (current-time) (-> self board jump-land-time)) (seconds 0.5)) + (>= (- (current-time) (-> self board ride-time)) (seconds 0.5)) ) (let ((s3-2 (new 'stack-no-clear 'vector))) (set! (-> s3-2 quad) (-> self control trans quad)) @@ -990,7 +987,7 @@ #t #f (-> self control transv) - (if (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) + (if (>= (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1)) 2.0 0.0 ) @@ -1156,7 +1153,7 @@ ) :enter (behavior () (set! (-> self focus-status) (logior (focus-status halfpipe) (-> self focus-status))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self control root-prim prim-core action) (collide-action no-normal-reset)) (set! (-> self control mod-surface) *board-halfpipe-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) @@ -1232,7 +1229,7 @@ ) :trans (behavior () (when (and (or (= (the-as int (-> self control did-move-to-pole-or-max-jump-height)) #t) - (and (< (- (-> self clock frame-counter) (-> self board halfpipe-lip-time)) (seconds 0.1)) + (and (< (- (current-time) (-> self board halfpipe-lip-time)) (seconds 0.1)) (= (-> self board halfpipe-lip-event) 'lipramp) ) ) @@ -1258,22 +1255,20 @@ ) ) ) - (set! (-> self board halfpipe-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-time) (current-time)) (if (= (-> self control gspot-pat-surfce mode) (pat-mode halfpipe)) - (set! (-> self board halfpipe-gspot-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-gspot-time) (current-time)) ) (when (jump-hit-ground-stuck?) (vector-float*! (-> self control transv) (-> self control transv) 1.5) (go target-board-turn-to (-> self control transv) (seconds 0.5)) ) (when (and (cpad-pressed? (-> self control cpad number) x) - (>= (- (-> self clock frame-counter) (-> self board halfpipe-jump-time)) (seconds 0.6)) - (< (- (-> self clock frame-counter) (-> self state-time)) - (the-as time-frame (-> *TARGET-bank* ground-timeout)) - ) + (>= (- (current-time) (-> self board halfpipe-jump-time)) (seconds 0.6)) + (< (- (current-time) (-> self state-time)) (the-as time-frame (-> *TARGET-bank* ground-timeout))) (< 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) ) - (set! (-> self board halfpipe-jump-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-jump-time) (current-time)) (vector-float*! (-> self control transv) (-> self control transv) 1.5) ) (target-board-spin-check) @@ -1286,7 +1281,7 @@ (set! (-> gp-0 y) 0.0) (vector-normalize! gp-0 1.0) (if (< 0.7 (vector-dot (-> self control to-target-pt-xz) gp-0)) - (+! (-> self control sliding-start-time) (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! (-> self control sliding-start-time) (- (current-time) (-> self clock old-frame-counter))) (set! (-> self control sliding-start-time) 1) ) ) @@ -1303,7 +1298,7 @@ ) ) (when (or (>= (-> self control sliding-start-time) (seconds 0.05)) - (and (>= (- (-> self clock frame-counter) (-> self board halfpipe-gspot-time)) (seconds 0.5)) + (and (>= (- (current-time) (-> self board halfpipe-gspot-time)) (seconds 0.5)) (< (-> self board halfpipe-lip-time) (+ (-> self state-time) (seconds -0.2))) ) ) @@ -1316,7 +1311,7 @@ ) :code (behavior () (cond - ((< (- (-> self clock frame-counter) (-> self board halfpipe-jump-time)) (seconds 0.5)) + ((< (- (current-time) (-> self board halfpipe-jump-time)) (seconds 0.5)) (ja-channel-push! 1 (seconds 0.05)) (ja-no-eval :group! (-> self draw art-group data 155) :num! (seek! (ja-aframe 8.0 0) 0.5) :frame-num 0.0) (until (ja-done? 0) @@ -1436,7 +1431,7 @@ (defstate target-board-jump-kick (target) :event target-board-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *board-jump-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) (sound-play "board-k-jump") @@ -1449,10 +1444,10 @@ ) (target-board-smack-surface?) (cond - ((< (- (-> self clock frame-counter) (-> self board smack-surface-time)) (seconds 0.2)) + ((< (- (current-time) (-> self board smack-surface-time)) (seconds 0.2)) (go target-board-wall-kick (-> self board smack-normal) (-> self board smack-speed)) ) - ((< (- (-> self clock frame-counter) (-> self board glance-time)) (seconds 0.2)) + ((< (- (current-time) (-> self board glance-time)) (seconds 0.2)) (go target-board-wall-kick (vector-normalize-copy! (-> self control unknown-vector38) (-> self board glance-out-transv) 1.0) @@ -1499,7 +1494,7 @@ (* 0.008333334 (- (-> self control dynam gravity-length))) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *board-wall-kick-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) (set! (-> self board smack-surface-time) 0) @@ -1545,7 +1540,7 @@ (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control dir-targ)) ) (set! (-> self control dynam gravity-length) 245760.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (cond ((= arg2 'halfpipe) (set! (-> self focus-status) (logior (focus-status halfpipe) (-> self focus-status))) @@ -1727,8 +1722,8 @@ (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control dir-targ)) ) (set! (-> self control dynam gravity-length) 245760.0) - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self board unknown-time-frame04) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self board unknown-time-frame04) (current-time)) (cond ((= arg2 'halfpipe) (set! (-> self focus-status) (logior (focus-status halfpipe) (-> self focus-status))) @@ -1749,7 +1744,7 @@ ) :exit (behavior () (set! (-> self board unknown-float01) 0.0) - (set! (-> self board unknown-time-frame05) (-> self clock frame-counter)) + (set! (-> self board unknown-time-frame05) (current-time)) (let ((v1-3 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) (set! (-> v1-3 command) (sound-command set-param)) (set! (-> v1-3 id) (-> self board unknown-sound-id01)) @@ -1942,7 +1937,7 @@ (mod-var-jump #t #f (cpad-hold? (-> self control cpad number) x) (-> self control transv)) ) (when (jump-hit-ground-stuck?) - (set! (-> self board jump-land-time) (-> self clock frame-counter)) + (set! (-> self board jump-land-time) (current-time)) (go target-board-hit-ground) ) (set! (-> self board slow-transv quad) (-> self control transv quad)) @@ -2139,7 +2134,7 @@ ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *board-turn-to-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) (set! (-> self control sliding-start-time) arg1) @@ -2149,7 +2144,7 @@ (-> self control unknown-vector38) (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) ) - (set! (-> self control turn-lockout-end-time) (+ (-> self clock frame-counter) arg1)) + (set! (-> self control turn-lockout-end-time) (+ (current-time) arg1)) (none) ) :exit target-board-exit @@ -2166,7 +2161,7 @@ (flush-trick-list (-> self board)) (go target-board-jump (-> *TARGET_BOARD-bank* jump-height-min) (-> *TARGET_BOARD-bank* jump-height-max) #f) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self control sliding-start-time)) + (if (>= (- (current-time) (-> self state-time)) (-> self control sliding-start-time)) (go target-board-stance) ) (target-board-anim-trans) @@ -2192,7 +2187,7 @@ ) (('end-mode) (when (-> event param 0) - (let ((v1-6 (/ (- (-> self clock frame-counter) (-> self board ride-start-time)) 300))) + (let ((v1-6 (/ (- (current-time) (-> self board ride-start-time)) 300))) (if (> v1-6 0) (add-to-trick-list (-> self board) (board-tricks board-rail) (* 100.0 (the float v1-6))) ) @@ -2206,7 +2201,7 @@ ) ) :enter (behavior ((arg0 symbol) (arg1 object) (arg2 object) (arg3 float)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self focus-status) (logior (focus-status rail) (-> self focus-status))) (logior! (-> self control root-prim prim-core action) (collide-action can-ride)) (set! (-> self control mod-surface) *board-ride-mods*) @@ -2315,7 +2310,7 @@ ) (can-jump? 'board) ) - (let ((v1-15 (/ (- (-> self clock frame-counter) (-> self board ride-start-time)) 300))) + (let ((v1-15 (/ (- (current-time) (-> self board ride-start-time)) 300))) (if (> v1-15 0) (add-to-trick-list (-> self board) (board-tricks board-rail) (* 100.0 (the float v1-15))) ) @@ -2332,7 +2327,7 @@ (set! (-> self control unknown-word04) (the-as uint #f)) ) (if (-> self control unknown-spool-anim00) - (set! (-> self board ride-button-time) (-> self clock frame-counter)) + (set! (-> self board ride-button-time) (current-time)) ) (set! (-> self board turn-anim-targ) (* (-> self board ride-lean) (- (-> *TARGET_BOARD-bank* turn-frames)))) (cond @@ -2418,13 +2413,11 @@ (until #f (ja :num-func num-func-identity :frame-num (ja-aframe - (fmax - -5.0 - (fmin 5.0 (+ (* 3.0 (-> self board ride-lean)) - (* 0.5 (sin (* 145.63556 (the float (- (-> self clock frame-counter) (-> self state-time)))))) - ) - ) - ) + (fmax -5.0 (fmin 5.0 (+ (* 3.0 (-> self board ride-lean)) + (* 0.5 (sin (* 145.63556 (the float (- (current-time) (-> self state-time)))))) + ) + ) + ) 0 ) ) @@ -2454,7 +2447,7 @@ :enter (behavior ((arg0 handle)) (set! (-> self focus-status) (logior (focus-status halfpipe) (-> self focus-status))) (set! (-> self control unknown-handle02) arg0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self control root-prim prim-core action) (collide-action no-normal-reset)) (set! (-> self control mod-surface) *board-halfpipe-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) @@ -2484,11 +2477,11 @@ (none) ) :trans (behavior () - (set! (-> self board halfpipe-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-time) (current-time)) (if (= (-> self control gspot-pat-surfce mode) (pat-mode halfpipe)) - (set! (-> self board halfpipe-gspot-time) (-> self clock frame-counter)) + (set! (-> self board halfpipe-gspot-time) (current-time)) ) - (if (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (< (- (current-time) (-> self state-time)) (seconds 1)) (vector+float*! (-> self control transv) (-> self control transv) @@ -2500,7 +2493,7 @@ (vector-float*! (-> self control transv) (-> self control transv) 1.5) (go target-board-turn-to (-> self control transv) (seconds 0.5)) ) - (when (>= (- (-> self clock frame-counter) (-> self board halfpipe-gspot-time)) (seconds 0.5)) + (when (>= (- (current-time) (-> self board halfpipe-gspot-time)) (seconds 0.5)) (+! (-> self control transv x) (* 20480.0 (-> self control edge-grab-across-edge-dir x))) (+! (-> self control transv z) (* 20480.0 (-> self control edge-grab-across-edge-dir z))) (go target-board-stance) @@ -2570,7 +2563,7 @@ ) :enter (behavior () (set! (-> self board shock-offsetv) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control mod-surface) *board-jump-mods*) (set! (-> self board mods-backup) (-> self control mod-surface)) @@ -2723,7 +2716,7 @@ :enter (behavior ((arg0 handle)) (logclear! (-> self focus-status) (focus-status halfpipe)) (set! (-> self board shock-offsetv) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (none) ) @@ -2817,7 +2810,7 @@ ) (logclear! (-> self focus-status) (focus-status halfpipe)) (set! (-> self board shock-offsetv) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control mod-surface) (new 'static 'surface :name 'jump @@ -3122,7 +3115,7 @@ :trans (behavior () (when (= *cheat-mode* 'debug) (when (and (not *pause-lock*) (cpad-hold? (-> self control cpad number) r2)) - (set! (-> self control time-of-last-debug-heal) (-> self clock frame-counter)) + (set! (-> self control time-of-last-debug-heal) (current-time)) (pickup-collectable! (-> self fact-override) (pickup-type health) 100.0 (the-as handle #f)) (go target-board-stance) ) @@ -3132,7 +3125,7 @@ :code (behavior ((arg0 vector) (arg1 attack-info)) (logclear! (-> self water flags) (water-flags jump-out)) (logclear! (-> self focus-status) (focus-status halfpipe)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (-> self attack-info))) (let ((s5-0 (new 'stack-no-clear 'vector))) (let ((v1-6 gp-0)) @@ -3181,7 +3174,7 @@ (cond ((= arg0 'attack) (logior! (-> self focus-status) (focus-status hit)) - (set! (-> self game hit-time) (-> self clock frame-counter)) + (set! (-> self game hit-time) (current-time)) (case (-> gp-0 mode) (('endlessfall) (cond @@ -3189,8 +3182,8 @@ (let ((s4-1 (new-stack-vector0))) (set! (-> s4-1 quad) (-> self control last-trans-on-ground quad)) (ja-channel-set! 0) - (let ((s3-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-1) (seconds 1)) + (let ((s3-1 (current-time))) + (until (>= (- (current-time) s3-1) (seconds 1)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc b/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc index 1cd08a96d6..4e98e64936 100644 --- a/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc @@ -37,7 +37,7 @@ (case arg3 ((1) (if (< 0.9 (-> self control surface-angle)) - (set! (-> self board on-flat-time) (-> self clock frame-counter)) + (set! (-> self board on-flat-time) (current-time)) ) (set! (-> self board slip-factor) (lerp-scale 1.0 (-> arg0 slip-factor) (fabs (-> self control ctrl-slope-heading)) 0.0 1.0) @@ -45,41 +45,33 @@ (set! (-> arg0 slip-factor) (-> self board slip-factor)) (set! (-> arg0 slope-up-factor) (-> arg1 slope-up-factor)) (set! (-> arg0 slope-down-factor) (-> arg1 slope-down-factor)) - (set! (-> arg0 seek0) (lerp-scale - (* 0.1 (-> arg0 seek0)) - (-> arg0 seek0) - (the float (- (-> self clock frame-counter) (-> self board spin-time))) - 0.0 - 600.0 - ) + (set! (-> arg0 seek0) + (lerp-scale + (* 0.1 (-> arg0 seek0)) + (-> arg0 seek0) + (the float (- (current-time) (-> self board spin-time))) + 0.0 + 600.0 + ) ) - (set! (-> arg0 seek90) (lerp-scale - (* 0.1 (-> arg0 seek90)) - (-> arg0 seek90) - (the float (- (-> self clock frame-counter) (-> self board spin-time))) - 0.0 - 600.0 - ) + (set! (-> arg0 seek90) + (lerp-scale + (* 0.1 (-> arg0 seek90)) + (-> arg0 seek90) + (the float (- (current-time) (-> self board spin-time))) + 0.0 + 600.0 + ) ) - (set! (-> arg0 vel-turn) (lerp-scale - 131072.0 - (-> arg1 vel-turn) - (the float (- (-> self clock frame-counter) (-> self board spin-time))) - 0.0 - 600.0 - ) + (set! (-> arg0 vel-turn) + (lerp-scale 131072.0 (-> arg1 vel-turn) (the float (- (current-time) (-> self board spin-time))) 0.0 600.0) ) - (set! (-> arg0 turnv) (lerp-scale - 91022.22 - (-> arg1 turnv) - (the float (- (-> self clock frame-counter) (-> self board spin-time))) - 0.0 - 600.0 - ) + (set! (-> arg0 turnv) + (lerp-scale 91022.22 (-> arg1 turnv) (the float (- (current-time) (-> self board spin-time))) 0.0 600.0) ) - (when (< (- (-> self clock frame-counter) (-> self board spin-ground-start-time)) (seconds 0.3)) - (set! (-> self control last-attack-end-time) (-> self clock frame-counter)) - (set! (-> self board spin-ground-time) (-> self clock frame-counter)) + (when (< (- (current-time) (-> self board spin-ground-start-time)) (seconds 0.3)) + (set! (-> self control last-attack-end-time) (current-time)) + (set! (-> self board spin-ground-time) (current-time)) (set! (-> arg0 seek0) (* 0.1 (-> arg0 seek0))) (set! (-> arg0 seek90) (* 0.1 (-> arg0 seek90))) (set! (-> arg0 vel-turn) 131072.0) @@ -282,43 +274,42 @@ ) ;; definition for symbol *board-wall-kick-mods*, type surface -(define *board-wall-kick-mods* - (new 'static 'surface - :name 'jump - :tiltv 65536.0 - :tiltvv 262144.0 - :transv-max 143360.0 - :target-speed 102400.0 - :seek180 0.8 - :fric 0.2 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 0.8 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :tiltvf 150.0 - :tiltvvf 60.0 - :mult-hook (lambda :behavior target - ((arg0 surface) (arg1 surface) (arg2 surface) (arg3 int)) - (case arg3 - ((1) - (when (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) - (set! (-> arg0 turnv) 0.0) - (set! (-> arg0 turnvf) 0.0) - ) - ) +(define *board-wall-kick-mods* (new 'static 'surface + :name 'jump + :tiltv 65536.0 + :tiltvv 262144.0 + :transv-max 143360.0 + :target-speed 102400.0 + :seek180 0.8 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 0.8 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :tiltvf 150.0 + :tiltvvf 60.0 + :mult-hook (lambda :behavior target + ((arg0 surface) (arg1 surface) (arg2 surface) (arg3 int)) + (case arg3 + ((1) + (when (< (- (current-time) (-> self state-time)) (seconds 0.05)) + (set! (-> arg0 turnv) 0.0) + (set! (-> arg0 turnvf) 0.0) + ) + ) + ) + (none) + ) + :mode 'air + :flags (surface-flag no-turn-around turn-to-vel air) + ) ) - (none) - ) - :mode 'air - :flags (surface-flag no-turn-around turn-to-vel air) - ) - ) ;; definition for symbol *board-halfpipe-mods*, type surface (define *board-halfpipe-mods* (new 'static 'surface @@ -539,7 +530,7 @@ (a2-3 (-> gp-1 world-vertex 1)) (f0-2 (t9-8 s5-1 (the-as vector a1-8) a2-3)) ) - (if (and (>= (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.4)) + (if (and (>= (- (current-time) (-> self board ride-time)) (seconds 0.4)) (>= f0-2 0.0) (>= 1.0 f0-2) (not (and (-> self next-state) (= (-> self next-state name) 'target-board-duck-stance))) @@ -699,10 +690,10 @@ (set! (-> self board unknown-sound-id00) (new 'static 'sound-id)) (set-setting! 'mode-sound-bank 'board 0.0 0) (set-setting! 'sound-flava #f 30.0 2) - (set! (-> self board board-get-on-time) (-> self clock frame-counter)) + (set! (-> self board board-get-on-time) (current-time)) (set! (-> self board stick-lock) #f) (set! (-> self board stick-off) #f) - (set! (-> self board unstuck-time) (-> self clock frame-counter)) + (set! (-> self board unstuck-time) (current-time)) (set! (-> self board stuck-count) 0) (set! (-> self board slip-factor) 1.0) (set! (-> self board unknown-symbol00) #f) @@ -862,14 +853,14 @@ ;; INFO: Used lq/sq (defbehavior target-board-smack-surface? target () (when (and (logtest? (-> self control status) (collide-status touch-wall)) - (< (+ (-> self clock frame-counter) (seconds -0.05)) (-> self control last-time-touching-actor)) + (< (+ (current-time) (seconds -0.05)) (-> self control last-time-touching-actor)) (< 0.7 (-> self control touch-angle)) (< 73728.0 (-> self control ctrl-xz-vel)) (and (< (vector-dot (-> self control wall-contact-normal) (-> self control dynam gravity-normal)) 0.3) (not (logtest? (-> self control status) (collide-status touch-actor))) ) ) - (set! (-> self board smack-surface-time) (-> self clock frame-counter)) + (set! (-> self board smack-surface-time) (current-time)) (set! (-> self board smack-speed) (-> self control ctrl-xz-vel)) (set! (-> self board smack-normal quad) (-> self control wall-contact-normal quad)) #t @@ -947,14 +938,14 @@ (set! f0-28 0.0) (set! f1-23 0.0) ) - (when (and (< (- (-> self clock frame-counter) (-> self control last-time-touching-actor)) (seconds 1)) + (when (and (< (- (current-time) (-> self control last-time-touching-actor)) (seconds 1)) (>= f28-0 0.5) (< (vector-dot (-> self control wall-contact-normal) (-> self control to-target-pt-xz)) -0.7) (logtest? (-> self control mod-surface flags) (surface-flag air)) (< 0.0 (-> gp-0 y)) ) (cond - ((and (>= (- (-> self clock frame-counter) (-> self control last-time-touching-actor)) (seconds 0.1)) + ((and (>= (- (current-time) (-> self control last-time-touching-actor)) (seconds 0.1)) (< 0.3 (-> self control blocked-factor)) ) (set! f0-28 f1-23) @@ -1060,7 +1051,7 @@ (logtest? (state-flags prevent-board) (-> self state-flags)) (not (logtest? (-> *game-info* features) (game-feature board))) ) - (and (>= (- (-> self clock frame-counter) (-> self board board-get-on-time)) (seconds 1)) + (and (>= (- (current-time) (-> self board board-get-on-time)) (seconds 1)) (< (-> self board board-get-on-time) (max (-> self control list-time-on-ground) (-> self control last-time-of-stuck)) ) @@ -1232,7 +1223,7 @@ ;; WARN: Return type mismatch int vs none. (defbehavior target-board-physics target ((arg0 vector)) (let ((f30-0 0.5)) - (if (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame02)) (seconds 0.3)) + (if (>= (- (current-time) (-> self board unknown-time-frame02)) (seconds 0.3)) (+! (-> self board shock-offsetv) (* (- (-> arg0 y) (-> self control transv y)) f30-0)) (set! (-> self board up-vector 1 quad) (-> self board up-vector 0 quad)) ) @@ -1250,7 +1241,7 @@ (set! (-> self board shock-offsetv) 0.0) (set! (-> self board shock-offset) (* 0.96 (-> self board shock-offset))) ) - ((and (or (< (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.2)) + ((and (or (< (- (current-time) (-> self control last-time-on-surface)) (seconds 0.2)) (< (-> self board shock-offset) 0.0) ) (!= (-> self control mod-surface mode) 'air) @@ -1436,7 +1427,7 @@ (not (and (-> self next-state) (= (-> self next-state name) 'target-board-smack))) (not (focus-test? self halfpipe)) (!= (-> self control ground-pat mode) 3) - (>= (- (-> self clock frame-counter) (-> self board halfpipe-time)) (seconds 0.1)) + (>= (- (current-time) (-> self board halfpipe-time)) (seconds 0.1)) ) ) (let ((s5-3 (new 'stack-no-clear 'vector))) @@ -1457,7 +1448,7 @@ (s3-3 (vector-matrix*! (new 'stack-no-clear 'vector) s3-2 (-> self control w-R-c))) ) (logior! (-> self control status) (collide-status glance)) - (set! (-> self board glance-time) (-> self clock frame-counter)) + (set! (-> self board glance-time) (current-time)) (let ((v1-99 s2-2)) (set! (-> self board glance-speed) (sqrtf (+ (* (-> v1-99 x) (-> v1-99 x)) (* (-> v1-99 z) (-> v1-99 z))))) ) @@ -1486,10 +1477,7 @@ ) (else (set! (-> self control turn-lockout-end-time) - (the-as - time-frame - (max (+ (-> self clock frame-counter) (seconds 0.1)) (-> self control turn-lockout-end-time)) - ) + (the-as time-frame (max (+ (current-time) (seconds 0.1)) (-> self control turn-lockout-end-time))) ) ) ) @@ -1528,7 +1516,7 @@ (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) - (set! (-> self control last-time-of-stuck) (-> self clock frame-counter)) + (set! (-> self control last-time-of-stuck) (current-time)) ) 0 (none) @@ -1560,7 +1548,7 @@ (not (logtest? (-> self control status) (collide-status on-surface))) ) (begin - (set! (-> self board in-air-time) (-> self clock frame-counter)) + (set! (-> self board in-air-time) (current-time)) (and (not (and (-> self next-state) (let ((v1-12 (-> self next-state name))) (or (= v1-12 'target-board-stance) (= v1-12 'target-board-duck-stance) (= v1-12 'target-board-turn-to)) @@ -1599,7 +1587,7 @@ ) ) ) - (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.2)) + (>= (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.2)) ) ) ) @@ -1610,7 +1598,7 @@ (else (set! (-> self control bend-speed) 1024.0) (set! (-> self control bend-target) 1.0) - (when (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) + (when (< (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1)) (forward-up-nopitch->quaternion (-> self control dir-targ) (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control dir-targ)) @@ -1664,7 +1652,7 @@ (#f (set! (-> self control dynam gravity-length) 245760.0) ) - ((>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.1)) + ((>= (- (current-time) (-> self control last-time-on-surface)) (seconds 0.1)) (seek! (-> self control dynam gravity-length) 245760.0 (* 245760.0 (-> self clock seconds-per-frame))) ) (else @@ -1713,17 +1701,15 @@ ) (when (and (zero? (shr (shl (-> self board unknown-int00) 54) 61)) (!= (shr (shl (-> self board unknown-int00) 40) 58) 13) - (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame02)) (seconds 0.2)) + (>= (- (current-time) (-> self board unknown-time-frame02)) (seconds 0.2)) (< 819.2 (- f30-0 f0-36)) (or (< (-> self board unknown-time-frame01) (-> self control last-time-on-surface)) - (< (- (-> self clock frame-counter) (-> self board unknown-time-frame01)) (seconds 0.2)) + (< (- (current-time) (-> self board unknown-time-frame01)) (seconds 0.2)) ) (< 0.98 (vector-dot (-> self board unknown-vector01) (-> self control standard-dynamics gravity-normal))) (< f26-0 8192.0) (< f30-0 8192.0) - (or (< (* 0.2 f28-0) f30-0) - (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) - ) + (or (< (* 0.2 f28-0) f30-0) (< (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1))) ) (vector+float*! (-> self control transv) @@ -1731,25 +1717,25 @@ (-> self control dynam gravity-normal) (* 7.0 (fmin 4096.0 f30-0)) ) - (if (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) - (set! (-> self board unknown-time-frame01) (-> self clock frame-counter)) + (if (>= (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1)) + (set! (-> self board unknown-time-frame01) (current-time)) ) - (set! (-> self board unknown-time-frame00) (-> self clock frame-counter)) + (set! (-> self board unknown-time-frame00) (current-time)) ) ) (when (and (not (logtest? (-> self control status) (collide-status on-surface))) (< 0.0 f28-0) (or (and (or (< (target-height-above-ground) 4096.0) - (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) + (< (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1)) ) (< 8192.0 (- f28-0 (vector-dot (-> self control dynam gravity-normal) (-> self board slow-transv)))) ) - (< (- (-> self clock frame-counter) (-> self board unknown-time-frame02)) (seconds 0.1)) + (< (- (current-time) (-> self board unknown-time-frame02)) (seconds 0.1)) ) (>= 204.8 f30-0) (not (and (-> self next-state) (= (-> self next-state name) 'target-board-jump))) ) - (set! (-> self board unknown-time-frame02) (-> self clock frame-counter)) + (set! (-> self board unknown-time-frame02) (current-time)) (vector-length (-> self control transv)) (let ((v1-303 (new-stack-vector0)) (f0-51 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) @@ -1820,16 +1806,16 @@ (turn-to-vector s5-0 (-> self control pad-magnitude)) ) (if (and (= (-> self control pad-magnitude) 0.0) - (>= (-> self clock frame-counter) (-> self control turn-lockout-end-time)) + (>= (current-time) (-> self control turn-lockout-end-time)) (not (logtest? (-> self control current-surface flags) (surface-flag turn-to-vel))) - (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) + (>= (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1)) ) (rot->dir-targ! (-> self control)) ) - (when (and (< (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.1)) - (>= (-> self clock frame-counter) (-> self control turn-lockout-end-time)) + (when (and (< (- (current-time) (-> self control last-time-on-surface)) (seconds 0.1)) + (>= (current-time) (-> self control turn-lockout-end-time)) (not (logtest? (-> self control current-surface flags) (surface-flag turn-to-vel))) - (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) + (>= (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.1)) ) (let* ((s3-0 (vector-flatten! @@ -1855,7 +1841,7 @@ ) ) (if (cpad-pressed? (-> self control cpad number) l1) - (set! (-> self board unknown-time-frame06) (-> self clock frame-counter)) + (set! (-> self board unknown-time-frame06) (current-time)) ) (board-add-thrust) (add-gravity) @@ -1929,7 +1915,7 @@ (set! (-> self board trotyv) 0.0) ) ((and (= (-> self control danger-mode) 'board-spin) - (or (board-on-ground?) (>= (- (-> self clock frame-counter) (-> self board spin-time)) (seconds 0.5))) + (or (board-on-ground?) (>= (- (current-time) (-> self board spin-time)) (seconds 0.5))) ) (target-danger-set! 'harmless #f) ) @@ -2025,7 +2011,7 @@ (joint-points) (do-target-gspot) (target-powerup-process) - (set! (-> self board board-time) (-> self clock frame-counter)) + (set! (-> self board board-time) (current-time)) (target-board-exit-check) (target-board-effect) (when (board-on-ground?) @@ -2085,9 +2071,9 @@ (return (the-as time-frame #f)) ) (vector-normalize-copy! (-> self board ride-dir) (-> self board ride-segment) 1.0) - (when (>= (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.2)) + (when (>= (- (current-time) (-> self board ride-time)) (seconds 0.2)) (set! (-> self board ride-lock-on) #f) - (set! (-> self board ride-start-time) (-> self clock frame-counter)) + (set! (-> self board ride-start-time) (current-time)) (vector-normalize-copy! (-> self board ride-dir) (-> self control transv) 1.0) (dotimes (v1-25 3) (vector-reset! (-> self board ride-vertex-old v1-25)) @@ -2179,7 +2165,7 @@ ) ) (when (and (< (-> self board ride-vertex-index) 0.0) - (< (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.2)) + (< (- (current-time) (-> self board ride-time)) (seconds 0.2)) (zero? s3-3) ) (+! s3-3 1) @@ -2207,7 +2193,7 @@ (dotimes (v1-127 3) (set! (-> self board ride-vertex v1-127 w) 1.0) ) - (when (>= (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.2)) + (when (>= (- (current-time) (-> self board ride-time)) (seconds 0.2)) (set! (-> self board ride-rot-abs 0) (vector-y-angle (-> self board ride-segment))) (set! (-> self board ride-rtv-abs) 0.0) ) @@ -2254,9 +2240,7 @@ ) ) (let ((s4-3 0)) - (if (and (< (fabs f30-2) 16384.0) - (< (- (-> self clock frame-counter) (-> self board ride-start-time)) (seconds 0.1)) - ) + (if (and (< (fabs f30-2) 16384.0) (< (- (current-time) (-> self board ride-start-time)) (seconds 0.1))) (set! s4-3 (logior s4-3 1)) ) (if (or (< (vector-dot @@ -2354,7 +2338,7 @@ (set! s4-3 (logior s4-3 8)) ) ) - (if (>= (- (-> self clock frame-counter) (-> self board ride-button-time)) (seconds 0.05)) + (if (>= (- (current-time) (-> self board ride-button-time)) (seconds 0.05)) (set! s4-3 (logior s4-3 16)) ) (if (< (vector-length (-> self board ride-segment)) @@ -2366,7 +2350,7 @@ (set! s4-3 (logior s4-3 64)) ) (logclear! (-> self control status) (collide-status probe-hit)) - (when (and (< (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.2)) (nonzero? s4-3)) + (when (and (< (- (current-time) (-> self board ride-time)) (seconds 0.2)) (nonzero? s4-3)) (if (logtest? s4-3 1) (format #t "exit speed ~M~%" f30-2) ) @@ -2442,12 +2426,12 @@ (-> self control to-target-pt-xz) (+ (-> self board ride-rot) (* -2730.6667 (-> self board ride-lean))) ) - (set! (-> self board ride-time) (-> self clock frame-counter)) + (set! (-> self board ride-time) (current-time)) (set! (-> self board ride-speed) f30-2) ) ) ) - (let ((v0-3 (-> self clock frame-counter))) + (let ((v0-3 (current-time))) (set! (-> self control last-time-on-surface) v0-3) v0-3 ) @@ -2605,7 +2589,7 @@ (when (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) (logclear! (-> *collide-edge-board-spec* flags) (collide-edge-spec-flags two)) (cond - ((>= (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.2)) + ((>= (- (current-time) (-> self board ride-time)) (seconds 0.2)) (logclear! (-> *collide-edge-board-spec* flags) (collide-edge-spec-flags one)) (set! (-> *collide-edge-board-spec* touching-segment) #f) ) @@ -2731,7 +2715,7 @@ (target-powerup-process) (target-board-exit-check) (target-board-effect) - (set! (-> self board board-time) (-> self clock frame-counter)) + (set! (-> self board board-time) (current-time)) 0 (none) ) @@ -2817,7 +2801,7 @@ (fmin (-> self board turn-anim-frame) (+ -1.0 (-> *TARGET_BOARD-bank* turn-frames))) (- (+ -1.0 (-> *TARGET_BOARD-bank* turn-frames))) ) - (* (sin (* 145.63556 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (* (sin (* 145.63556 (the float (- (current-time) (-> self state-time))))) (lerp-scale 1.0 2.0 (fabs (-> self board turn-anim-frame)) 0.0 (-> *TARGET_BOARD-bank* turn-frames)) ) ) @@ -2828,20 +2812,15 @@ arg0 ) ) - (let ((f0-59 (fmin - (if (logtest? (-> self control status) (collide-status on-surface)) - (seek (-> self board turn-anim-duck) 0.0 (-> self clock seconds-per-frame)) - (-> self board turn-anim-duck) - ) - (lerp-scale - 0.0 - -1.0 - (the float (- (-> self clock frame-counter) (-> self control last-time-on-surface))) - 30.0 - 120.0 - ) - ) - ) + (let ((f0-59 + (fmin + (if (logtest? (-> self control status) (collide-status on-surface)) + (seek (-> self board turn-anim-duck) 0.0 (-> self clock seconds-per-frame)) + (-> self board turn-anim-duck) + ) + (lerp-scale 0.0 -1.0 (the float (- (current-time) (-> self control last-time-on-surface))) 30.0 120.0) + ) + ) ) (+! (-> self board turn-anim-duck) (* (-> self board turn-anim-duck-vel) (-> self clock seconds-per-frame))) (cond diff --git a/test/decompiler/reference/jak2/engine/target/collide-reaction-target_REF.gc b/test/decompiler/reference/jak2/engine/target/collide-reaction-target_REF.gc index f78d0bc506..2301aeae01 100644 --- a/test/decompiler/reference/jak2/engine/target/collide-reaction-target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/collide-reaction-target_REF.gc @@ -66,151 +66,149 @@ (tangent vector) (overhang-nrm vector) ) - (with-pp - (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) - ) - (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))) + (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) ) - (vector-cross! tangent contact-normal overhang-nrm) - (if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) tangent)) - (vector-negate! tangent tangent) + (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! 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) ) - (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) - ) + (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-dist-to-next2) - (vector-vector-distance (-> s4-0 start-pos) (-> s4-0 best-other-tri intersect)) + (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-next2) (-> s4-0 best-other-tri pat)) - (set! (-> arg0 low-coverage-norm-of-next2 quad) (-> s4-0 best-other-tri normal quad)) + (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 (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)) - ) - ) - ) - ) - (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf07))) - (set! (-> arg0 time-of-last-lc-touch-edge) (-> pp clock frame-counter)) - (set! sv-40 (logior sv-40 (collide-status touch-edge))) - (set! (-> arg0 time-of-last-lc) (-> pp clock frame-counter)) - (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)) - ) - ) + (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)) ) - (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 (* -0.25 (-> arg1 best-my-prim local-sphere w))) - ) - (>= (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))) - ) - ) - ) + (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 ) - (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)) + ) + (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)) ) - (< 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! (-> arg0 time-of-last-lc) (-> pp clock frame-counter)) - (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! (-> arg0 time-of-last-lc) (-> pp clock frame-counter)) + ) + (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf07))) + (set! (-> arg0 time-of-last-lc-touch-edge) (current-time)) + (set! sv-40 (logior sv-40 (collide-status touch-edge))) + (set! (-> arg0 time-of-last-lc) (current-time)) + (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 (* -0.25 (-> arg1 best-my-prim local-sphere w))) + ) + (>= (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))) ) ) ) - (set! (-> sv-24 0) sv-40) - (set! (-> sv-20 0) sv-32) - (set! (-> sv-28 0) sv-48) - 0 - (none) ) + (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! (-> arg0 time-of-last-lc) (current-time)) + (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! (-> arg0 time-of-last-lc) (current-time)) + ) + ) + ) + (set! (-> sv-24 0) sv-40) + (set! (-> sv-20 0) sv-32) + (set! (-> sv-28 0) sv-48) + 0 + (none) ) ;; definition for function target-collision-reaction @@ -383,7 +381,7 @@ (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> arg0 grount-touch-point)) ) ) - (< (- (-> self clock frame-counter) (-> arg0 list-time-on-ground)) (seconds 0.3)) + (< (- (current-time) (-> arg0 list-time-on-ground)) (seconds 0.3)) ) (logtest? sv-104 (cshape-reaction-flags csrf15)) ) @@ -454,7 +452,7 @@ (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! (-> arg0 list-time-on-ground) (-> self clock frame-counter)) + (set! (-> arg0 list-time-on-ground) (current-time)) (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)) @@ -584,7 +582,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defbehavior rail-surface-touch target () - (when (>= (- (-> self clock frame-counter) (-> self control time-of-last-surface-change)) (seconds 0.2)) + (when (>= (- (current-time) (-> self control time-of-last-surface-change)) (seconds 0.2)) (logclear! (-> *collide-edge-board-spec* flags) (collide-edge-spec-flags one send-event)) (set! (-> *collide-edge-board-spec* touching-segment) #f) (do-edge-grabs *target* *collide-cache* *collide-edge-board-spec*) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-dark-shot_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-dark-shot_REF.gc index 0a76cba8ad..4dd54b6ac6 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-dark-shot_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-dark-shot_REF.gc @@ -235,7 +235,7 @@ (none) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (cond ((or (and *target* @@ -246,10 +246,8 @@ ) (go-virtual dissipate) ) - ((or (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.3)) (cpad-hold? 0 r1)) - (set! (-> self size-t) - (fmin 1.0 (* 0.016666668 (the float (- (-> self clock frame-counter) (-> self state-time))))) - ) + ((or (< (- (current-time) (-> self state-time)) (seconds 0.3)) (cpad-hold? 0 r1)) + (set! (-> self size-t) (fmin 1.0 (* 0.016666668 (the float (- (current-time) (-> self state-time)))))) (let ((t9-1 vector<-cspace!) (a0-13 (-> self root-override trans)) (v1-26 (-> self parent)) @@ -327,7 +325,7 @@ (vector-float*! (-> self spin-vector) (-> self spin-vector) (/ 1.0 f0-5)) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000))) (when gp-2 (let ((t9-4 (method-of-type part-tracker activate))) @@ -399,7 +397,7 @@ (vector-flatten! (-> self spin-vector) (-> self spin-vector) s4-0) (matrix-axis-angle! s5-0 s4-0 (* 2002.4889 (-> self clock time-adjust-ratio))) (vector-matrix*! (-> self spin-vector) (-> self spin-vector) s5-0) - (let ((f0-9 (the float (- (-> self clock frame-counter) (-> self state-time)))) + (let ((f0-9 (the float (- (current-time) (-> self state-time)))) (f30-0 0.0) ) (cond @@ -554,11 +552,11 @@ (defstate fizzle (gun-dark-shot) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (>= (- (current-time) (-> self state-time)) (seconds 1)) (deactivate self) ) (process-drawable-shock-effect @@ -659,7 +657,7 @@ (sv-320 process-drawable) (sv-336 process-drawable) ) - (if (< (- (-> self clock frame-counter) (-> self spawn-time)) (seconds 0.1)) + (if (< (- (current-time) (-> self spawn-time)) (seconds 0.1)) (send-event (ppointer->process (-> self parent)) 'release) ) (sound-stop (the-as sound-id (-> self trail-sound))) @@ -830,7 +828,7 @@ ((arg0 handle)) (let ((s5-0 (-> self parent)) (s4-0 0) - (s3-0 (-> self clock frame-counter)) + (s3-0 (current-time)) ) (set! (-> self clock) (-> s5-0 0 clock)) (while (and (nonzero? (-> (the-as process-drawable (-> s5-0 0)) skel)) @@ -862,18 +860,18 @@ ) ) ) - (< (- (-> self clock frame-counter) s3-0) (seconds 0.1)) + (< (- (current-time) s3-0) (seconds 0.1)) ) ) ) - (< (- (-> self clock frame-counter) s3-0) (seconds 5)) + (< (- (current-time) s3-0) (seconds 5)) (not (logtest? (-> (the-as process-drawable (-> s5-0 0)) draw status) (draw-control-status no-draw no-draw-temp)) ) ) ) ) - (when (>= (- (-> self clock frame-counter) (the-as time-frame s4-0)) (seconds 0.05)) - (set! s4-0 (the-as int (-> self clock frame-counter))) + (when (>= (- (current-time) (the-as time-frame s4-0)) (seconds 0.05)) + (set! s4-0 (the-as int (current-time))) (if (handle->process arg0) (process-drawable-shock-effect-bullseye (the-as process-focusable (handle->process arg0)) @@ -903,8 +901,8 @@ (-> self result-array (+ gp-2 -1)) :to s4-1 ) - (let ((s4-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-2) (seconds 0.1)) + (let ((s4-2 (current-time))) + (until (>= (- (current-time) s4-2) (seconds 0.1)) (suspend) ) ) @@ -913,9 +911,9 @@ ) ) ) - (let ((gp-3 (-> self clock frame-counter))) + (let ((gp-3 (current-time))) (while (or (-> self child) (and (nonzero? (get-status *gui-control* (the-as sound-id (-> self explode-sound)))) - (< (- (-> self clock frame-counter) gp-3) (seconds 10)) + (< (- (current-time) gp-3) (seconds 10)) ) ) (suspend) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc index a379858bd6..69b08fb2a1 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc @@ -465,7 +465,7 @@ (defbehavior want-to-gun? process ((arg0 target) (arg1 symbol)) (local-vars (v1-36 symbol)) (and (logtest? (-> arg0 game features) (game-feature gun)) - (>= (- (-> self clock frame-counter) (-> arg0 gun gun-time)) (seconds 0.1)) + (>= (- (current-time) (-> arg0 gun gun-time)) (seconds 0.1)) (not (focus-test? arg0 dead hit board mech dark teleporting)) (not (logtest? (surface-flag gun-inactive gun-hide gun-off) (-> arg0 control current-surface flags))) (not (logtest? (state-flags prevent-gun) (-> arg0 state-flags))) @@ -487,7 +487,7 @@ (-> arg0 gun latch?) ) (not (-> arg0 skel top-anim frame-group)) - (>= (- (-> self clock frame-counter) (-> arg0 control time-of-last-debug-float)) (seconds 0.1)) + (>= (- (current-time) (-> arg0 control time-of-last-debug-float)) (seconds 0.1)) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc index 11d21f6d35..1711b81770 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc @@ -472,8 +472,8 @@ (defstate debug-idle (gun-red-shot) :virtual #t :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 3)) (let ((gp-0 (new 'stack-no-clear 'vector))) (dotimes (s5-0 (-> self probe-count)) (vector-float*! gp-0 (-> self probe-dir s5-0) 61440.0) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-states_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-states_REF.gc index 8745f4b1d7..51db9150a4 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-states_REF.gc @@ -43,7 +43,7 @@ (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) (set! (-> self control mod-surface) *gun-walk-mods*) (set! (-> self control unknown-word04) (the-as uint #f)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -120,7 +120,7 @@ (defstate target-gun-walk (target) :event target-standard-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *gun-walk-mods*) (case (-> self gun gun-type) (((pickup-type eco-yellow) (pickup-type eco-blue)) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-util_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-util_REF.gc index 0329fdbb54..1024a719fc 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-util_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-util_REF.gc @@ -583,7 +583,7 @@ ) ) :enter (behavior ((arg0 symbol)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self draw shadow) (-> self shadow-backup)) (logior! (-> self skel status) (joint-control-status sync-math)) (none) @@ -617,7 +617,7 @@ ((begin (set! a0-14 (!= (-> (the-as target (-> self parent 0)) game gun-type) (-> self gun-type))) (and (the-as symbol a0-14) (let ((v1-16 (-> self state-time))) - (set! a0-14 (-> self clock frame-counter)) + (set! a0-14 (current-time)) (!= v1-16 (the-as time-frame a0-14)) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc index 8173ea2c3e..00917f2b74 100644 --- a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc @@ -6,7 +6,7 @@ (defbehavior build-conversions target ((arg0 vector)) (when (!= (-> self control prev-surf) (-> self control surf)) (set! (-> self control prev-surf) (-> self control surf)) - (set! (-> self control time-of-last-surface-change) (-> self clock frame-counter)) + (set! (-> self control time-of-last-surface-change) (current-time)) ) (surface-mult! (-> self control current-surface) (-> self control mod-surface) (-> self control surf)) (when (and (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 3) @@ -456,7 +456,7 @@ arg1 "~0ky:~,,2M t:~d cy: ~,,2M my: ~,,2M impv:~,,2M " (-> arg0 control last-trans-any-surf y) - (- (-> (the-as target pp) clock frame-counter) (-> arg0 control last-time-on-surface)) + (- (current-time) (-> arg0 control last-time-on-surface)) (- (-> arg0 control trans y) (-> arg0 control last-trans-any-surf y)) (- (-> arg0 control highest-jump-mark y) (-> arg0 control last-trans-leaving-surf y)) (-> arg0 control ground-impact-vel) @@ -519,7 +519,7 @@ (set! (-> arg0 w) 0.0) (set! (-> self control pad-xz-dir quad) (-> arg0 quad)) (set! (-> self control pad-magnitude) (-> self control cpad stick0-speed)) - (when (< (-> self control update-cam-R-w-start-time) (-> self clock frame-counter)) + (when (< (-> self control update-cam-R-w-start-time) (current-time)) (let ((s5-0 (-> self control cam-R-w)) (t9-2 matrix-local->world) (a0-13 #t) @@ -635,14 +635,14 @@ (set! (-> self control idx-of-fastest-xz-vel) a0-3) (set! (-> self control average-xz-vel) f1-1) (if (logtest? (-> self control current-surface flags) (surface-flag no-turn-around)) - (set! (-> v1-7 0) (-> self clock frame-counter)) + (set! (-> v1-7 0) (current-time)) ) - (and (>= (the-as uint (- (-> self clock frame-counter) (-> v1-7 0))) (the-as uint 300)) + (and (>= (the-as uint (- (current-time) (-> v1-7 0))) (the-as uint 300)) (< f0-1 0.0) (< 32768.0 f1-1) (< 0.7 (-> self control pad-magnitude)) - (>= (- (-> self clock frame-counter) (-> self control last-time-touching-actor)) (seconds 0.3)) - (>= (- (-> self clock frame-counter) (-> self control time-of-last-lc)) (seconds 0.3)) + (>= (- (current-time) (-> self control last-time-touching-actor)) (seconds 0.3)) + (>= (- (current-time) (-> self control time-of-last-lc)) (seconds 0.3)) (logtest? (-> self control status) (collide-status on-surface)) (and (< 0.7 (-> self control surface-angle)) #t) ) @@ -666,13 +666,11 @@ ) ) ) - (if (>= (- (-> self clock frame-counter) (-> self control time-of-last-wall-hide-first-check-pass)) (seconds 0.1)) - (set! (-> self control time-of-first-wall-hide-first-check-pass) (-> self clock frame-counter)) + (if (>= (- (current-time) (-> self control time-of-last-wall-hide-first-check-pass)) (seconds 0.1)) + (set! (-> self control time-of-first-wall-hide-first-check-pass) (current-time)) ) - (set! (-> self control time-of-last-wall-hide-first-check-pass) (-> self clock frame-counter)) - (when (>= (- (-> self clock frame-counter) (-> self control time-of-first-wall-hide-first-check-pass)) - (seconds 0.5) - ) + (set! (-> self control time-of-last-wall-hide-first-check-pass) (current-time)) + (when (>= (- (current-time) (-> self control time-of-first-wall-hide-first-check-pass)) (seconds 0.5)) (let ((gp-0 (new 'stack-no-clear 'collide-query))) (let ((v1-34 (-> gp-0 bbox)) (a0-13 (-> self control trans)) @@ -731,7 +729,7 @@ ;; WARN: Return type mismatch int vs none. (defbehavior target-log-trans target () (let ((v1-1 (-> self control trans-log-idx))) - (set! (-> self control trans-log-times v1-1) (-> self clock frame-counter)) + (set! (-> self control trans-log-times v1-1) (current-time)) (set! (-> self control trans-log-trans v1-1 quad) (-> self control trans quad)) (set! (-> self control trans-log-idx) (logand (+ v1-1 1) 127)) ) @@ -750,7 +748,7 @@ (let* ((v1-0 127) (a1-2 (logand (+ (-> s4-0 trans-log-idx) v1-0) 127)) ) - (while (and (< (- (-> self clock frame-counter) (-> s4-0 trans-log-times a1-2)) arg0) (> v1-0 0)) + (while (and (< (- (current-time) (-> s4-0 trans-log-times a1-2)) arg0) (> v1-0 0)) (vector+! s5-0 s5-0 (-> s4-0 trans-log-trans a1-2)) (+! gp-0 1) (+! v1-0 -1) @@ -1002,9 +1000,9 @@ ) ) ) - (set! (-> self control time-of-last-clear-wall-in-jump) (-> self clock frame-counter)) + (set! (-> self control time-of-last-clear-wall-in-jump) (current-time)) ) - (if (< (- (-> self clock frame-counter) (-> self control time-of-last-clear-wall-in-jump)) (seconds 0.2)) + (if (< (- (current-time) (-> self control time-of-last-clear-wall-in-jump)) (seconds 0.2)) (set! f30-0 (+ 204800.0 f30-0)) ) (if (and (not (logtest? (-> self control status) (collide-status touch-wall))) @@ -1153,14 +1151,14 @@ (collide-status on-surface touch-surface) ) ) - (< (- (-> self clock frame-counter) (-> self control last-time-touching-actor)) (seconds 0.5)) + (< (- (current-time) (-> self control last-time-touching-actor)) (seconds 0.5)) (not (and (-> self next-state) (let ((v1-15 (-> self next-state name))) (or (= v1-15 'target-walk) (= v1-15 'target-gun-walk)) ) ) ) - (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) - (< (- (-> self clock frame-counter) (-> self control time-of-last-lc)) (seconds 0.5)) + (< (- (current-time) (-> self state-time)) (seconds 0.5)) + (< (- (current-time) (-> self control time-of-last-lc)) (seconds 0.5)) (logtest? (-> self control current-surface flags) (surface-flag turn-to-pad)) (!= (-> self control force-turn-to-strength) 0.0) ) @@ -1185,9 +1183,7 @@ s4-0 s3-1 (cond - ((and (or (>= 0.0 (-> self control turn-to-magnitude)) - (< (-> self clock frame-counter) (-> self control turn-lockout-end-time)) - ) + ((and (or (>= 0.0 (-> self control turn-to-magnitude)) (< (current-time) (-> self control turn-lockout-end-time))) (not (logtest? (-> self control current-surface flags) (surface-flag turn-when-centered))) ) 0.0 @@ -1535,7 +1531,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defbehavior pre-collide-setup target () - (if (>= (-> self clock frame-counter) (-> self control additional-decaying-velocity-decay-start-time)) + (if (>= (current-time) (-> self control additional-decaying-velocity-decay-start-time)) (vector-normalize! (-> self control additional-decaying-velocity) (seek @@ -1547,9 +1543,7 @@ ) (cond ((logtest? (-> self control old-status) (collide-status on-surface)) - (if (>= (+ (-> self clock frame-counter) (seconds -0.035)) - (-> self control additional-decaying-velocity-end-time) - ) + (if (>= (+ (current-time) (seconds -0.035)) (-> self control additional-decaying-velocity-end-time)) (vector-reset! (-> self control additional-decaying-velocity)) ) ) @@ -1583,7 +1577,7 @@ (set! (-> self current-level) (level-get-target-inside *level*)) (if (-> self current-level) (+! (-> self game task-in-times (-> self current-level info task-level)) - (- (-> self clock frame-counter) (-> self clock old-frame-counter)) + (- (current-time) (-> self clock old-frame-counter)) ) ) (if (and (-> self current-level) (or (not gp-0) (!= (-> gp-0 name) (-> self current-level name)))) @@ -1601,15 +1595,13 @@ (cond ((= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) (if (zero? (-> self control time-between-zero-inputs)) - (set! (-> self control time-between-zero-inputs) - (- (-> self clock frame-counter) (-> self control time-of-last-zero-input)) - ) + (set! (-> self control time-between-zero-inputs) (- (current-time) (-> self control time-of-last-zero-input))) ) - (set! (-> self control time-of-last-zero-input) (-> self clock frame-counter)) + (set! (-> self control time-of-last-zero-input) (current-time)) (quaternion-copy! (-> self control last-nonzero-input-dir-targ) (-> self control dir-targ)) ) (else - (set! (-> self control time-of-last-nonzero-input) (-> self clock frame-counter)) + (set! (-> self control time-of-last-nonzero-input) (current-time)) (set! (-> self control time-between-zero-inputs) 0) 0 ) @@ -1620,7 +1612,7 @@ ((-> self control current-surface active-hook)) (cond ((logtest? (-> self control status) (collide-status on-surface)) - (set! (-> self control last-time-on-surface) (-> self clock frame-counter)) + (set! (-> self control last-time-on-surface) (current-time)) (set! (-> self control last-trans-any-surf quad) (-> self control trans quad)) (if (and (>= (-> self control coverage) 1.0) (not (logtest? (-> self control status) (collide-status touch-actor on-water))) @@ -1658,7 +1650,7 @@ (logtest? (-> self control mod-surface flags) (surface-flag look-around)) (not (focus-test? self edge-grab pole flut tube board pilot dark)) (-> *setting-control* user-current allow-look-around) - (>= (- (-> self clock frame-counter) (the-as int (-> self no-look-around-wait))) (seconds 0.05)) + (>= (- (current-time) (the-as int (-> self no-look-around-wait))) (seconds 0.05)) (not (and (= (-> self control ground-pat material) (pat-material ice)) (< 4096.0 (-> self control ctrl-xz-vel))) ) ) @@ -1714,7 +1706,7 @@ ) ) (send-event *camera* 'reset-follow) - (set! (-> self control time-of-last-debug-float) (-> self clock frame-counter)) + (set! (-> self control time-of-last-debug-float) (current-time)) (cond ((focus-test? self mech indax) (if (not (and (-> self next-state) (let ((v1-179 (-> self next-state name))) @@ -1798,9 +1790,7 @@ ) ) (let ((v1-229 (-> self current-level))) - (when (and (or (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 2)) - (focus-test? self pilot) - ) + (when (and (or (>= (- (current-time) (-> self control last-time-on-surface)) (seconds 2)) (focus-test? self pilot)) (and v1-229 (< (-> self control trans y) (-> v1-229 info buttom-height)) (not (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control cpad number) r2))) @@ -1852,19 +1842,19 @@ ;; WARN: Return type mismatch int vs none. (defbehavior post-flag-setup target () (if (logtest? (-> self control status) (collide-status touch-wall touch-actor)) - (set! (-> self control last-time-touching-actor) (-> self clock frame-counter)) + (set! (-> self control last-time-touching-actor) (current-time)) ) (when (logtest? (-> self state-flags) (state-flags tinvul1)) - (if (< (logand (- (-> self clock frame-counter) (-> self control invul1-on-time)) 3) 1) + (if (< (logand (- (current-time) (-> self control invul1-on-time)) 3) 1) (logior! (-> self draw status) (draw-control-status no-draw-bounds)) (logclear! (-> self draw status) (draw-control-status no-draw-bounds)) ) - (if (>= (- (-> self clock frame-counter) (-> self control invul1-on-time)) (-> self control invul1-off-time)) + (if (>= (- (current-time) (-> self control invul1-on-time)) (-> self control invul1-off-time)) (target-timed-invulnerable-off self 1) ) ) (when (logtest? (state-flags tinvul2) (-> self state-flags)) - (if (>= (- (-> self clock frame-counter) (-> self control invul2-on-time)) (-> self control invul2-off-time)) + (if (>= (- (current-time) (-> self control invul2-on-time)) (-> self control invul2-off-time)) (target-timed-invulnerable-off self 2) ) ) @@ -2092,7 +2082,7 @@ (set! (-> self control hand-to-edge-dist) (vector-length s4-1)) (cond ((and (< 819.2 (-> self control hand-to-edge-dist)) - (>= (- (-> self clock frame-counter) (-> self control last-successful-compute-edge-time)) (seconds 0.2)) + (>= (- (current-time) (-> self control last-successful-compute-edge-time)) (seconds 0.2)) ) (cond ((-> s5-0 pilot-edge-grab?) @@ -2138,7 +2128,7 @@ ) ) (vector-float*! (-> self control rider-last-move) s4-1 (-> self clock frames-per-second)) - (set! (-> self control rider-time) (-> self clock frame-counter)) + (set! (-> self control rider-time) (current-time)) (vector+! s3-1 s3-1 (-> self control cspace-offset)) (move-to-point! (-> self control) s3-1) ) @@ -2151,9 +2141,9 @@ (move-by-vector! (-> self control) a1-20) ) (vector-float*! (-> self control rider-last-move) s4-1 (-> self clock frames-per-second)) - (set! (-> self control rider-time) (-> self clock frame-counter)) - (if (and (>= (- (-> self clock frame-counter) (-> self control edge-grab-start-time)) (seconds 0.5)) - (>= (- (-> self clock frame-counter) (-> self control last-successful-compute-edge-time)) (seconds 0.5)) + (set! (-> self control rider-time) (current-time)) + (if (and (>= (- (current-time) (-> self control edge-grab-start-time)) (seconds 0.5)) + (>= (- (current-time) (-> self control last-successful-compute-edge-time)) (seconds 0.5)) ) (send-event self 'end-mode) ) @@ -2164,13 +2154,13 @@ (let ((a1-23 (new 'stack-no-clear 'vector))) (vector-! a1-23 (-> s5-0 center-hold) (-> self control ctrl-to-hands-offset)) (vector-float*! (-> self control rider-last-move) s4-1 (-> self clock frames-per-second)) - (set! (-> self control rider-time) (-> self clock frame-counter)) + (set! (-> self control rider-time) (current-time)) (vector+! a1-23 a1-23 (-> self control cspace-offset)) (move-to-point! (-> self control) a1-23) ) (set! (-> self control hand-to-edge-dist) 0.0) (set! (-> self control last-trans-any-surf quad) (-> self control trans quad)) - (set! (-> self control last-successful-compute-edge-time) (-> self clock frame-counter)) + (set! (-> self control last-successful-compute-edge-time) (current-time)) ) ) ) @@ -2243,7 +2233,7 @@ ) (let ((a1-15 (vector-! (new-stack-vector0) (-> gp-0 center-hold) (-> gp-0 center-hold-old)))) (vector-float*! (-> self control rider-last-move) a1-15 (-> self clock frames-per-second)) - (set! (-> self control rider-time) (-> self clock frame-counter)) + (set! (-> self control rider-time) (current-time)) (move-by-vector! (-> self control) a1-15) ) ) @@ -2283,7 +2273,7 @@ (send-event *camera* 'ease-in #x3f000000 v1-10) ) (vector-segment-distance-point! (-> self control midpoint-of-hands) s4-1 s3-1 s5-0) - (if (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (if (< (- (current-time) (-> self state-time)) (seconds 0.05)) (set! (-> self control hand-to-edge-dist) (fmax 0.0 (fmin 1.0 (/ (vector-vector-distance s4-1 s5-0) (* 2.0 (-> (the-as swingpole s2-0) edge-length))))) ) @@ -2382,7 +2372,7 @@ ) (vector<-cspace! gp-0 (-> self node-list data 6)) (cond - ((>= (+ (-> self clock frame-counter) (seconds -2)) (-> self control unknown-time-frame26)) + ((>= (+ (current-time) (seconds -2)) (-> self control unknown-time-frame26)) (set! (-> self control camera-pos quad) (-> s5-0 quad)) ) ((not (and (logtest? (-> self water flags) (water-flags under-water)) @@ -2393,7 +2383,7 @@ (-> self control camera-pos) gp-0 s5-0 - (* 0.0016666667 (the float (- (-> self clock frame-counter) (-> self control unknown-time-frame26)))) + (* 0.0016666667 (the float (- (current-time) (-> self control unknown-time-frame26)))) ) ) (else @@ -2401,13 +2391,7 @@ (-> self control camera-pos) s5-0 gp-0 - (fmax - 0.0 - (fmin - 1.0 - (* 0.0011111111 (the float (- (-> self clock frame-counter) (-> self control unknown-time-frame27)))) - ) - ) + (fmax 0.0 (fmin 1.0 (* 0.0011111111 (the float (- (current-time) (-> self control unknown-time-frame27)))))) ) ) ) @@ -3135,7 +3119,7 @@ (set! (-> self control bent-gravity-normal quad) (-> self control standard-dynamics gravity-normal quad)) (quaternion-identity! (-> self control override-quat)) (set! (-> self control override-quat-alpha) 0.0) - (set! (-> self control last-time-on-surface) (-> self clock frame-counter)) + (set! (-> self control last-time-on-surface) (current-time)) (set! (-> self control bend-amount) 0.0) (set! (-> self control bend-speed) 32.0) (set! (-> self cam-user-mode) 'normal) @@ -3371,9 +3355,9 @@ (set! (-> obj current-level) #f) (level-setup) (set! (-> obj pre-joint-hook) (the-as (function none :behavior target) nothing)) - (set! (-> obj init-time) (-> self clock frame-counter)) + (set! (-> obj init-time) (current-time)) (set! (-> obj spool-anim) (the-as spool-anim #t)) - (set! (-> obj ambient-time) (-> self clock frame-counter)) + (set! (-> obj ambient-time) (current-time)) 0 (none) ) diff --git a/test/decompiler/reference/jak2/engine/target/mech_suit/carry-h_REF.gc b/test/decompiler/reference/jak2/engine/target/mech_suit/carry-h_REF.gc index 99b7c32ff4..97410899b8 100644 --- a/test/decompiler/reference/jak2/engine/target/mech_suit/carry-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/mech_suit/carry-h_REF.gc @@ -472,10 +472,10 @@ Returns `-1.0` if it exceeds the maximum allowed" (let* ((a1-8 (quaternion-normalize! (matrix->quaternion (new 'stack-no-clear 'quaternion) s5-1))) (s5-3 (quaternion-normalize! (quaternion*! a1-8 a1-8 (-> obj grab-quat)))) (v1-19 (vector-! (new 'stack-no-clear 'vector) (-> s4-0 point) s3-2)) - (f30-0 (* 0.033333335 (the float (- (-> self clock frame-counter) (-> obj pickup-time))))) + (f30-0 (* 0.033333335 (the float (- (current-time) (-> obj pickup-time))))) ) (cond - ((>= (- (-> self clock frame-counter) (-> obj pickup-time)) (seconds 1)) + ((>= (- (current-time) (-> obj pickup-time)) (seconds 1)) (set! (-> obj process 0 control trans quad) (-> v1-19 quad)) (quaternion-copy! (-> obj process 0 control quat) s5-3) ) diff --git a/test/decompiler/reference/jak2/engine/target/mech_suit/grunt-mech_REF.gc b/test/decompiler/reference/jak2/engine/target/mech_suit/grunt-mech_REF.gc index ae9b5d8eaf..0026912f67 100644 --- a/test/decompiler/reference/jak2/engine/target/mech_suit/grunt-mech_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/mech_suit/grunt-mech_REF.gc @@ -125,75 +125,71 @@ ;; definition for method 10 of type grunt-mech-info ;; WARN: Return type mismatch int vs none. (defmethod grunt-mech-info-method-10 grunt-mech-info ((obj grunt-mech-info)) - (with-pp - (let ((s5-0 (-> pp clock frame-counter))) - (when (!= (-> obj last-update-time) s5-0) - (when (< s5-0 (-> obj last-update-time)) - (countdown (v1-4 6) - (let ((a0-4 (-> obj holds v1-4))) - (set! (-> a0-4 grunt-handle) (the-as handle #f)) - (set! (-> a0-4 timeout) (the-as uint 0)) - ) - 0 + (let ((s5-0 (current-time))) + (when (!= (-> obj last-update-time) s5-0) + (when (< s5-0 (-> obj last-update-time)) + (countdown (v1-4 6) + (let ((a0-4 (-> obj holds v1-4))) + (set! (-> a0-4 grunt-handle) (the-as handle #f)) + (set! (-> a0-4 timeout) (the-as uint 0)) ) - (set! (-> obj reserved-mask) (the-as uint 0)) 0 ) - (set! (-> obj last-update-time) s5-0) - (let ((v1-8 *target*)) - (cond - ((and v1-8 (focus-test? v1-8 mech)) - (let ((s4-0 (-> v1-8 manipy 0 node-list data 3))) - (dotimes (s3-0 6) - (let ((s2-0 (-> obj holds s3-0))) - (matrix*! (-> s2-0 world-mat) (-> s2-0 local-mat) (-> s4-0 bone transform)) - (vector-float*! (-> s2-0 world-mat trans) (-> s2-0 world-mat trans) (/ 1.0 (-> s2-0 world-mat trans w))) - (when (and (!= (-> s2-0 grunt-handle) #f) (>= s5-0 (the-as time-frame (-> s2-0 timeout)))) - (set! (-> s2-0 grunt-handle) (the-as handle #f)) - (logclear! (-> obj reserved-mask) (-> s2-0 reserve-mask)) - ) + (set! (-> obj reserved-mask) (the-as uint 0)) + 0 + ) + (set! (-> obj last-update-time) s5-0) + (let ((v1-8 *target*)) + (cond + ((and v1-8 (focus-test? v1-8 mech)) + (let ((s4-0 (-> v1-8 manipy 0 node-list data 3))) + (dotimes (s3-0 6) + (let ((s2-0 (-> obj holds s3-0))) + (matrix*! (-> s2-0 world-mat) (-> s2-0 local-mat) (-> s4-0 bone transform)) + (vector-float*! (-> s2-0 world-mat trans) (-> s2-0 world-mat trans) (/ 1.0 (-> s2-0 world-mat trans w))) + (when (and (!= (-> s2-0 grunt-handle) #f) (>= s5-0 (the-as time-frame (-> s2-0 timeout)))) + (set! (-> s2-0 grunt-handle) (the-as handle #f)) + (logclear! (-> obj reserved-mask) (-> s2-0 reserve-mask)) ) ) ) ) - (else - (countdown (v1-25 6) - (let ((a0-16 (-> obj holds v1-25))) - (set! (-> a0-16 grunt-handle) (the-as handle #f)) - (set! (-> a0-16 timeout) (the-as uint 0)) - ) - 0 + ) + (else + (countdown (v1-25 6) + (let ((a0-16 (-> obj holds v1-25))) + (set! (-> a0-16 grunt-handle) (the-as handle #f)) + (set! (-> a0-16 timeout) (the-as uint 0)) ) - (set! (-> obj reserved-mask) (the-as uint 0)) 0 ) + (set! (-> obj reserved-mask) (the-as uint 0)) + 0 ) ) ) ) - (none) ) + (none) ) ;; definition for method 9 of type grunt-mech-info (defmethod grunt-mech-info-method-9 grunt-mech-info ((obj grunt-mech-info) (arg0 int) (arg1 process) (arg2 symbol)) - (with-pp - (grunt-mech-info-method-10 obj) - (let ((v1-2 *target*)) - (when (and v1-2 (focus-test? v1-2 mech) (not (logtest? (-> v1-2 focus-status) (focus-status dead ignore)))) - (let ((v1-8 (-> obj holds arg0))) - (when (and (!= (-> v1-8 grunt-handle) #f) (= (handle->process (-> v1-8 grunt-handle)) arg1)) - (set! (-> v1-8 timeout) (the-as uint (+ (-> pp clock frame-counter) (seconds 0.5)))) - (return #t) - ) - (when (not (logtest? (-> obj reserved-mask) (-> v1-8 reserve-mask))) - (when (not arg2) - (logior! (-> obj reserved-mask) (-> v1-8 reserve-mask)) - (set! (-> v1-8 grunt-handle) (process->handle arg1)) - (set! (-> v1-8 timeout) (the-as uint (+ (-> pp clock frame-counter) (seconds 0.5)))) - ) - #t + (grunt-mech-info-method-10 obj) + (let ((v1-2 *target*)) + (when (and v1-2 (focus-test? v1-2 mech) (not (logtest? (-> v1-2 focus-status) (focus-status dead ignore)))) + (let ((v1-8 (-> obj holds arg0))) + (when (and (!= (-> v1-8 grunt-handle) #f) (= (handle->process (-> v1-8 grunt-handle)) arg1)) + (set! (-> v1-8 timeout) (the-as uint (+ (current-time) (seconds 0.5)))) + (return #t) + ) + (when (not (logtest? (-> obj reserved-mask) (-> v1-8 reserve-mask))) + (when (not arg2) + (logior! (-> obj reserved-mask) (-> v1-8 reserve-mask)) + (set! (-> v1-8 grunt-handle) (process->handle arg1)) + (set! (-> v1-8 timeout) (the-as uint (+ (current-time) (seconds 0.5)))) ) + #t ) ) ) @@ -619,12 +615,10 @@ ;; definition for method 191 of type grunt-mech ;; WARN: Return type mismatch object vs none. (defmethod grunt-mech-method-191 grunt-mech ((obj grunt-mech)) - (with-pp - (if (>= (-> pp clock frame-counter) (-> obj state-timeout)) - (go (method-of-object obj mech-dismount)) - ) - (none) - ) + (if (>= (current-time) (-> obj state-timeout)) + (go (method-of-object obj mech-dismount)) + ) + (none) ) ;; failed to figure out what this is: @@ -632,11 +626,11 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior grunt-mech) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) (set! (-> self root-override2 root-prim prim-core collide-as) (collide-spec)) (stop-looking-at-target! self) - (set! (-> self state-timeout) (+ (-> self clock frame-counter) (get-rand-int-range self 450 900))) + (set! (-> self state-timeout) (+ (current-time) (get-rand-int-range self 450 900))) (logclear! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) (none) ) @@ -776,7 +770,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior grunt-mech) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self root-override2 root-prim prim-core collide-as) (collide-spec)) (let* ((v1-4 (-> self nav)) (a1-0 (-> self dismount-dest)) @@ -870,7 +864,7 @@ :event (the-as (function process int symbol event-message-block object :behavior grunt-mech) enemy-event-handler) :enter (behavior () ((-> (method-of-type grunt circling) enter)) - (set! (-> self state-timeout) (+ (-> self clock frame-counter) (get-rand-int-range self 750 1200))) + (set! (-> self state-timeout) (+ (current-time) (get-rand-int-range self 750 1200))) (none) ) :trans (behavior () @@ -881,9 +875,9 @@ ) (let ((gp-1 (-> self focus aware))) (if (or (!= gp-1 3) (not (get-enemy-target self))) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (when (>= 1 (the-as int gp-1)) (nav-enemy-method-161 self) (if (-> self enemy-info-override use-stop-chase) @@ -896,13 +890,13 @@ (when v1-33 (cond ((focus-test? v1-33 mech) - (when (>= (-> self clock frame-counter) (-> self state-timeout)) + (when (>= (current-time) (-> self state-timeout)) (nav-enemy-method-161 self) (go-hostile self) ) ) (else - (when (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self starting-time)) (-> self reaction-time)) (nav-enemy-method-161 self) (go-hostile self) ) @@ -931,7 +925,7 @@ :event (the-as (function process int symbol event-message-block object :behavior grunt-mech) enemy-event-handler) :enter (behavior () ((-> (method-of-type grunt-mech mech-post-circling) enter)) - (set! (-> self state-timeout) (+ (-> self clock frame-counter) (get-rand-int-range self 900 1800))) + (set! (-> self state-timeout) (+ (current-time) (get-rand-int-range self 900 1800))) (none) ) :trans (-> (method-of-type grunt-mech mech-post-circling) trans) diff --git a/test/decompiler/reference/jak2/engine/target/mech_suit/mech-states_REF.gc b/test/decompiler/reference/jak2/engine/target/mech_suit/mech-states_REF.gc index 654e645c51..a4ed2046cc 100644 --- a/test/decompiler/reference/jak2/engine/target/mech_suit/mech-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/mech_suit/mech-states_REF.gc @@ -59,7 +59,7 @@ ) 1820.4445 ) - (>= (- (-> self clock frame-counter) (-> self control time-of-last-zero-input)) (seconds 0.05)) + (>= (- (current-time) (-> self control time-of-last-zero-input)) (seconds 0.05)) ) ) (go target-mech-walk) @@ -354,7 +354,7 @@ *null-vector* *null-vector* (the-as process #f) - (-> self clock frame-counter) + (current-time) ) (let* ((s4-0 (get-trans self 3)) (a0-4 (the-as process-focusable (combo-tracker-method-13 @@ -524,7 +524,7 @@ ) (when (send-event-function (-> s4-1 cshape process) a1-6) (set! (-> self control send-attack-dest) (process->handle s5-2)) - (set! (-> self control send-attack-time) (-> self clock frame-counter)) + (set! (-> self control send-attack-time) (current-time)) #t ) ) @@ -536,7 +536,7 @@ (set! (-> self mech forward-vel) 0.0) (set! (-> self mech forward-vel) -40960.0) ) - (when (or (not s5-2) (= (-> self control send-attack-time) (-> self clock frame-counter))) + (when (or (not s5-2) (= (-> self control send-attack-time) (current-time))) (let ((s5-3 (get-process *default-dead-pool* part-tracker #x4000))) (when s5-3 (let ((t9-7 (method-of-type part-tracker activate))) @@ -584,7 +584,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *mech-punch-mods*) (set! (-> self mech state-impact? 0) #f) (rot->dir-targ! (-> self control)) @@ -593,7 +593,7 @@ :exit (behavior () (set! (-> *mech-punch-mods* turnvv) 0.0) (set! (-> self mech state-impact? 0) #f) - (set! (-> self control last-running-attack-end-time) (-> self clock frame-counter)) + (set! (-> self control last-running-attack-end-time) (current-time)) (target-exit) (target-mech-exit) (none) @@ -686,14 +686,14 @@ ) (+! gp-0 1) (target-mech-punch-pick (the-as symbol gp-0)) - (set! (-> self state-time) (+ (-> self clock frame-counter) (seconds -0.465))) + (set! (-> self state-time) (+ (current-time) (seconds -0.465))) (set! (-> self mech forward-vel) (fmax 0.0 (-> self mech forward-vel))) (set! s4-0 159) (set! s5-0 #f) ) ) ) - (let ((v1-142 (- (-> self clock frame-counter) (-> self state-time))) + (let ((v1-142 (- (current-time) (-> self state-time))) (s3-2 #t) (f30-4 1.0) ) @@ -747,9 +747,8 @@ ) ) ) - (set! s3-2 (and (>= (- (-> self clock frame-counter) (-> self state-time)) s4-0) - (and (>= (-> self mech forward-vel) 0.0) s3-2) - ) + (set! s3-2 + (and (>= (- (current-time) (-> self state-time)) s4-0) (and (>= (-> self mech forward-vel) 0.0) s3-2)) ) (set! (-> self mech state-impact? 0) s3-2) (set-forward-vel (-> self mech forward-vel)) @@ -784,7 +783,7 @@ ) ) :enter (behavior ((arg0 symbol)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *mech-jump-mods*) (set! (-> self mech jump-thrust) 0.0) (let* ((v1-4 *game-info*) @@ -813,7 +812,7 @@ ) (when (if (and (and v1-9 (= v1-9 (-> self draw art-group data 330))) (< f0-0 (-> *TARGET-bank* stuck-distance)) - (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (and (>= (- (current-time) (-> self state-time)) (seconds 2)) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) ) @@ -854,11 +853,7 @@ (set! (-> self mech thruster-flame-length) 20480.0) ) ) - (seek! - (-> self mech jump-thrust-fuel) - 0.0 - (the float (- (-> self clock frame-counter) (-> self clock old-frame-counter))) - ) + (seek! (-> self mech jump-thrust-fuel) 0.0 (the float (- (current-time) (-> self clock old-frame-counter)))) ) (else (seek! (-> self mech jump-thrust) 0.0 (* 491520.0 (-> self clock seconds-per-frame))) @@ -921,7 +916,7 @@ (defstate target-mech-jump (target) :event (-> target-mech-falling event) :enter (behavior ((arg0 float) (arg1 float) (arg2 surface)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (let* ((v1-4 *game-info*) (a2-5 (+ (-> v1-4 attack-id) 1)) @@ -964,7 +959,7 @@ (-> v1-0 id) ) (set! (-> self mech jump-thrust-fuel) (-> *TARGET-bank* mech-jump-thrust-fuel)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (cond ((= arg0 'stuck) ) @@ -996,7 +991,7 @@ (if (and (cpad-pressed? (-> self control cpad number) circle square) (can-hands? #t)) (go target-mech-punch) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.25)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.25)) (if (move-legs?) (go target-mech-walk) ) @@ -1048,7 +1043,7 @@ :trans (behavior () (when (= *cheat-mode* 'debug) (when (and (not *pause-lock*) (cpad-hold? (-> self control cpad number) r2)) - (set! (-> self control time-of-last-debug-heal) (-> self clock frame-counter)) + (set! (-> self control time-of-last-debug-heal) (current-time)) (pickup-collectable! (-> self fact-override) (pickup-type health) 100.0 (the-as handle #f)) (go target-mech-stance) ) @@ -1057,7 +1052,7 @@ ) :code (behavior ((arg0 symbol) (arg1 attack-info)) (logclear! (-> self water flags) (water-flags jump-out)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (-> self attack-info)) (s5-0 (new 'stack-no-clear 'vector)) ) @@ -1104,7 +1099,7 @@ (cond ((= arg0 'attack) (logior! (-> self focus-status) (focus-status hit)) - (set! (-> self game hit-time) (-> self clock frame-counter)) + (set! (-> self game hit-time) (current-time)) (case (-> gp-0 mode) (('endlessfall) (cond @@ -1112,8 +1107,8 @@ (let ((s4-1 (new-stack-vector0))) (set! (-> s4-1 quad) (-> self control last-trans-on-ground quad)) (ja-channel-set! 0) - (let ((s3-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-1) (seconds 1)) + (let ((s3-1 (current-time))) + (until (>= (- (current-time) s3-1) (seconds 1)) (suspend) ) ) @@ -1257,8 +1252,8 @@ ) (ja-channel-push! 1 (seconds 0.3)) (ja-no-eval :group! (-> self draw art-group data 330) :num! (loop! 0.5) :frame-num 0.0) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.8)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 0.8)) (ja :group! (-> self draw art-group data 330) :num! (loop! 0.5)) (suspend) ) @@ -1388,8 +1383,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-9 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-9) (seconds 2)) + (let ((gp-9 (current-time))) + (until (>= (- (current-time) gp-9) (seconds 2)) (suspend) ) ) @@ -1400,7 +1395,7 @@ (if (!= (-> self game mode) 'play) (go target-jump 16384.0 16384.0 (the-as surface #f)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sleep-code) (none) ) @@ -1496,7 +1491,7 @@ :enter (behavior () (set! (-> self control mod-surface) *mech-pickup-mods*) (set! (-> self mech stick-off) (the-as basic #t)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-forward-vel 0.0) (set! (-> self carry other) (the-as handle #f)) (set! (-> self carry other-value) 100000000000.0) @@ -1744,7 +1739,7 @@ ) :enter (behavior () (set! (-> self control mod-surface) *mech-walk-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-forward-vel 0.0) (set! (-> self mech stick-off) (the-as basic #t)) (none) @@ -1912,7 +1907,7 @@ (set! (-> self control mod-surface turnvv) 20024.889) (set! (-> self control did-move-to-pole-or-max-jump-height) 0.0) (rot->dir-targ! (-> self control)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -1927,13 +1922,13 @@ ) 1820.4445 ) - (>= (- (-> self clock frame-counter) (-> self control time-of-last-zero-input)) (seconds 0.05)) + (>= (- (current-time) (-> self control time-of-last-zero-input)) (seconds 0.05)) ) ) (go target-mech-carry-walk) ) (if (and (cpad-pressed? (-> self control cpad number) r1) - (>= (- (-> self clock frame-counter) (-> self carry pickup-time)) (seconds 0.1)) + (>= (- (current-time) (-> self carry pickup-time)) (seconds 0.1)) ) (go target-mech-carry-drop) ) @@ -2008,7 +2003,7 @@ (defstate target-mech-carry-walk (target) :event (-> target-mech-carry-stance event) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *mech-carry-walk-mods*) (set! (-> self control unknown-word04) (the-as uint 0.0)) (none) @@ -2032,7 +2027,7 @@ ) ) (if (and (cpad-pressed? (-> self control cpad number) r1) - (>= (- (-> self clock frame-counter) (-> self carry pickup-time)) (seconds 0.1)) + (>= (- (current-time) (-> self carry pickup-time)) (seconds 0.1)) ) (go target-mech-carry-drop) ) @@ -2121,9 +2116,7 @@ (case event-type (('push) (when (zero? (-> self control sliding-start-time)) - (set! (-> self control sliding-start-time) - (+ (-> self clock frame-counter) (the-as time-frame (-> event param 0))) - ) + (set! (-> self control sliding-start-time) (+ (current-time) (the-as time-frame (-> event param 0)))) (let ((v0-0 (the-as object #t))) (set! (-> self control unknown-word04) (the-as uint v0-0)) v0-0 @@ -2143,7 +2136,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control sliding-start-time) 0) (set! (-> self control unknown-word04) (the-as uint #f)) (set! (-> self control mod-surface) *mech-carry-drag-mods*) @@ -2177,7 +2170,7 @@ ) :trans (behavior () (when (and (not (cpad-hold? (-> self control cpad number) r1)) - (>= (- (-> self clock frame-counter) (-> self carry pickup-time)) (seconds 0.5)) + (>= (- (current-time) (-> self carry pickup-time)) (seconds 0.5)) ) (sound-play "mech-drag-off") (if (or (and (>= (-> self mech back-touch-time) (-> self state-time)) @@ -2230,9 +2223,7 @@ ) (f26-0 0.0) ) - (if (and (nonzero? (-> self control sliding-start-time)) - (< (-> self control sliding-start-time) (-> self clock frame-counter)) - ) + (if (and (nonzero? (-> self control sliding-start-time)) (< (-> self control sliding-start-time) (current-time))) (send-event self 'drop) (set! f28-0 (cond @@ -2360,7 +2351,7 @@ ) :enter (behavior () (set! (-> self control mod-surface) *mech-carry-jump-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (-> target-mech-carry-pickup exit) @@ -2369,7 +2360,7 @@ (go target-mech-carry-hit-ground #f) ) (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (>= (- (current-time) (-> self state-time)) (seconds 0.05)) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) #t @@ -2485,7 +2476,7 @@ (defstate target-mech-carry-jump (target) :event (-> target-mech-carry-falling event) :enter (behavior ((arg0 float) (arg1 float)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control mod-surface) *mech-carry-jump-mods*) @@ -2561,7 +2552,7 @@ :event (-> target-mech-carry-drop event) :enter (behavior () (set! (-> self control mod-surface) *mech-walk-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-forward-vel 0.0) (set! (-> self mech stick-off) (the-as basic #t)) (none) diff --git a/test/decompiler/reference/jak2/engine/target/mech_suit/mech_REF.gc b/test/decompiler/reference/jak2/engine/target/mech_suit/mech_REF.gc index d228a0627a..685666bf55 100644 --- a/test/decompiler/reference/jak2/engine/target/mech_suit/mech_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/mech_suit/mech_REF.gc @@ -168,7 +168,7 @@ (let ((f30-0 20480.0)) (until #f (when (and (logtest? (-> self draw status) (draw-control-status on-screen)) - (>= (- (-> self clock frame-counter) (-> self probe-time)) (seconds 1)) + (>= (- (current-time) (-> self probe-time)) (seconds 1)) ) (move-to-ground (-> self root-override) @@ -177,7 +177,7 @@ #t (collide-spec backgnd obstacle hit-by-player-list hit-by-others-list pusher) ) - (set! (-> self probe-time) (-> self clock frame-counter)) + (set! (-> self probe-time) (current-time)) ) (when (and (and *target* (and (>= f30-0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))) @@ -296,8 +296,8 @@ (mech-method-24 self) (suspend) ) - (let ((s5-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-0) (seconds 1)) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) (seconds 1)) (mech-method-24 self) (suspend) ) @@ -466,7 +466,7 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('look-at-point) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (go-virtual active) ) ) @@ -501,7 +501,7 @@ This commonly includes things such as: :virtual #t :event (-> (method-of-type mech-target idle) event) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -511,7 +511,7 @@ This commonly includes things such as: ) (not (logtest? (focus-status mech) (-> *target* focus-status))) ) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 10)) + (>= (- (current-time) (-> self state-time)) (seconds 10)) ) (go-virtual idle) ) diff --git a/test/decompiler/reference/jak2/engine/target/mech_suit/target-mech_REF.gc b/test/decompiler/reference/jak2/engine/target/mech_suit/target-mech_REF.gc index 5def06c9ce..9185d65431 100644 --- a/test/decompiler/reference/jak2/engine/target/mech_suit/target-mech_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/mech_suit/target-mech_REF.gc @@ -468,7 +468,7 @@ ;; definition for function target-mech-get-off? (defbehavior target-mech-get-off? target () (when (and (mech-on-ground?) - (< (-> self mech no-get-off-time) (-> self clock frame-counter)) + (< (-> self mech no-get-off-time) (current-time)) (-> *setting-control* user-current pilot-exit) ) (let ((gp-0 (new 'stack-no-clear 'collide-query)) @@ -764,7 +764,7 @@ ) ) (('target-mech-get-off) - (set! v0-0 (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 0)))) + (set! v0-0 (+ (current-time) (the-as time-frame (-> arg3 param 0)))) (set! (-> self mech no-get-off-time) (the-as time-frame v0-0)) v0-0 ) @@ -1123,9 +1123,9 @@ (set! (-> self board latch?) #f) (set! (-> self mech stick-lock) #f) (set! (-> self mech stick-off) #f) - (set! (-> self mech unstuck-time) (-> self clock frame-counter)) + (set! (-> self mech unstuck-time) (current-time)) (set! (-> self mech stuck-count) 0) - (set! (-> self mech mech-start-time) (-> self clock frame-counter)) + (set! (-> self mech mech-start-time) (current-time)) (set! (-> self mech jump-thrust) 0.0) (set! (-> self mech jump-thrust-fuel) (-> *TARGET-bank* mech-jump-thrust-fuel)) (set! (-> self mech state-impact? 0) #f) @@ -1636,7 +1636,7 @@ (let ((v1-98 (vector-! (new 'stack-no-clear 'vector) (-> self control wall-contact-pt) (-> self control trans)))) (set! (-> v1-98 y) 0.0) (when (< (vector-dot v1-98 (-> self control c-R-w vector 2)) 0.0) - (set! (-> self mech back-touch-time) (-> self clock frame-counter)) + (set! (-> self mech back-touch-time) (current-time)) (set! (-> self mech back-touch-point quad) (-> self control wall-contact-pt quad)) (set! (-> self mech back-touch-trans quad) (-> self control trans quad)) ) @@ -1774,7 +1774,7 @@ (quaternion-copy! (the-as quaternion (-> self mech mech-quat)) (-> self control quat)) (set! (-> self mech mech-scale quad) (-> self control scale quad)) (vector+! (-> self alt-cam-pos) (-> self control camera-pos) (new 'static 'vector :y 4096.0 :w 1.0)) - (set! (-> self mech mech-time) (-> self clock frame-counter)) + (set! (-> self mech mech-time) (current-time)) (target-mech-effect) 0 (none) @@ -1785,7 +1785,3 @@ (target-mech-real-post) (none) ) - - - - diff --git a/test/decompiler/reference/jak2/engine/target/sidekick_REF.gc b/test/decompiler/reference/jak2/engine/target/sidekick_REF.gc index 56c0d10fac..0dd5fa904d 100644 --- a/test/decompiler/reference/jak2/engine/target/sidekick_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/sidekick_REF.gc @@ -67,7 +67,7 @@ ) ) ) - (when (>= (- (-> self clock frame-counter) (-> self special-anim-time)) (seconds 1)) + (when (>= (- (current-time) (-> self special-anim-time)) (seconds 1)) (set! (-> self special-anim-interp) 0.0) (set! (-> self special-anim-frame) 0.0) ) @@ -77,7 +77,7 @@ ) (case arg2 ((1) - (set! (-> self special-anim-time) (-> self clock frame-counter)) + (set! (-> self special-anim-time) (current-time)) (cond ((= (-> gp-0 control mod-surface name) 'spin) (set! (-> arg1 z) diff --git a/test/decompiler/reference/jak2/engine/target/target-anim_REF.gc b/test/decompiler/reference/jak2/engine/target/target-anim_REF.gc index a7736e9592..19236a03c1 100644 --- a/test/decompiler/reference/jak2/engine/target/target-anim_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-anim_REF.gc @@ -596,9 +596,9 @@ (let ((v1-52 (ja-group))) (cond ((and v1-52 (= v1-52 (-> self draw art-group data 61))) - (let ((s5-0 (-> self clock frame-counter))) - (while (or (= arg0 -1) (< (- (-> self clock frame-counter) s5-0) arg0)) - (when (>= (- (-> self clock frame-counter) s5-0) (seconds 0.01)) + (let ((s5-0 (current-time))) + (while (or (= arg0 -1) (< (- (current-time) s5-0) arg0)) + (when (>= (- (current-time) s5-0) (seconds 0.01)) (let ((v1-62 (ja-group))) (when (not (and v1-62 (= v1-62 (-> self draw art-group data 27)))) (ja-channel-push! 1 (seconds 0.1)) @@ -646,10 +646,9 @@ ) ) (ja-no-eval :group! (-> self draw art-group data 27) :num! (loop!) :frame-num 0.0) - (let ((s5-1 (-> self clock frame-counter))) - (while (or (= arg0 -1) (and (< (- (-> self clock frame-counter) s5-1) arg0) - (not (logtest? (-> self control status) (collide-status on-surface))) - ) + (let ((s5-1 (current-time))) + (while (or (= arg0 -1) + (and (< (- (current-time) s5-1) arg0) (not (logtest? (-> self control status) (collide-status on-surface)))) ) (suspend) (ja :group! (-> self draw art-group data 27) :num! (loop!)) @@ -1123,7 +1122,7 @@ ) ) ) - (let ((s4-10 (-> self clock frame-counter)) + (let ((s4-10 (current-time)) (f24-2 (if (and (using-gun? self) (or (= (-> self gun gun-type) (pickup-type eco-yellow)) (= (-> self gun gun-type) (pickup-type eco-blue))) @@ -1133,7 +1132,7 @@ ) ) ) - (until (and (>= arg0 0) (>= (- (-> self clock frame-counter) s4-10) arg0)) + (until (and (>= arg0 0) (>= (- (current-time) s4-10) arg0)) (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))))) ) @@ -1346,7 +1345,7 @@ ) ) ) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.4))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.4))) (if (using-gun? self) (go target-high-jump @@ -1788,7 +1787,7 @@ (f1-1 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) ) (while (not (or (and (< (fabs (/ f0-11 (* 0.0033333334 f1-1))) 150.0) (< f1-1 0.0)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.7)) + (>= (- (current-time) (-> self state-time)) (seconds 1.7)) ) ) (quaternion-rotate-y! diff --git a/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc b/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc index b434edbe0e..5a24fdd43e 100644 --- a/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc @@ -152,7 +152,7 @@ ) :enter (behavior () (set! (-> self control mod-surface) *walk-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-forward-vel 0.0) (set! (-> self carry other) (the-as handle #f)) (set! (-> self carry other-value) 100000000000.0) @@ -296,7 +296,7 @@ :event target-standard-event-handler :enter (behavior () (set! (-> self control mod-surface) *walk-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-forward-vel 0.0) (none) ) @@ -423,7 +423,7 @@ :event target-standard-event-handler :enter (behavior () (set! (-> self control mod-surface) *carry-walk-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -485,7 +485,7 @@ (defstate target-carry-walk (target) :event target-standard-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *carry-walk-mods*) (none) ) @@ -553,7 +553,7 @@ :event target-jump-event-handler :enter (behavior () (set! (-> self control mod-surface) *carry-jump-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -570,7 +570,7 @@ ) (when (if (and (< f0-0 (-> *TARGET-bank* stuck-distance)) (and (>= v1-12 0) - (>= (- (-> self clock frame-counter) (-> self state-time)) v1-12) + (>= (- (current-time) (-> self state-time)) v1-12) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) ) @@ -674,7 +674,7 @@ (defstate target-carry-jump (target) :event target-jump-event-handler :enter (behavior ((arg0 float) (arg1 float)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "jump" :vol 70) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) @@ -743,7 +743,7 @@ :event target-standard-event-handler :enter (behavior () (set! (-> self control mod-surface) *walk-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-forward-vel 0.0) (none) ) diff --git a/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc b/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc index c3662bf809..abd0ddfd3a 100644 --- a/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc @@ -51,7 +51,7 @@ ) ) (or (and (not (and (focus-test? self dark) (nonzero? (-> self darkjak)))) - (and (>= (- (-> self clock frame-counter) (-> (the-as fact-info-target (-> self fact-override)) darkjak-start-time)) + (and (>= (- (current-time) (-> (the-as fact-info-target (-> self fact-override)) darkjak-start-time)) (seconds 0.05) ) (>= (-> self game eco-pill-dark) (-> *FACT-bank* eco-pill-dark-max-default)) @@ -112,7 +112,7 @@ ) (target-danger-set! (-> self control danger-mode) #f) (update-transforms (-> self control)) - (if (and (or (>= (- (-> self clock frame-counter) (-> (the-as fact-info-target (-> self fact-override)) darkjak-start-time)) + (if (and (or (>= (- (current-time) (-> (the-as fact-info-target (-> self fact-override)) darkjak-start-time)) (-> (the-as fact-info-target (-> self fact-override)) darkjak-effect-time) ) (not (-> *setting-control* user-current darkjak)) @@ -189,7 +189,7 @@ ) (set-darkjak-texture-morph! f30-0) (cond - ((and (= f30-0 0.0) (< (- (-> self clock frame-counter) (-> self teleport-time)) (seconds 0.5))) + ((and (= f30-0 0.0) (< (- (current-time) (-> self teleport-time)) (seconds 0.5))) (set! (-> self skel override 0) 0.00001) (set! (-> self skel override 41) 0.000001) ) @@ -314,12 +314,12 @@ (set! (-> self darkjak want-stage) (-> self darkjak stage)) (set! (-> self neck flex-blend) 0.0) (set! (-> self control mod-surface) *darkjak-trans-mods*) - (set! (-> self darkjak start-time) (-> self clock frame-counter)) + (set! (-> self darkjak start-time) (current-time)) (set! (-> self darkjak attack-count) (the-as uint 0)) (set! (-> self darkjak-giant-interp) 1.0) (set-setting! 'sound-flava #f 30.0 4) (set! (-> self focus-status) (logior (focus-status dark) (-> self focus-status))) - (set! (-> (the-as fact-info-target (-> self fact-override)) darkjak-start-time) (-> self clock frame-counter)) + (set! (-> (the-as fact-info-target (-> self fact-override)) darkjak-start-time) (current-time)) (set! (-> (the-as fact-info-target (-> self fact-override)) darkjak-effect-time) (seconds 20)) (if (logtest? (-> self darkjak stage) 16) (logior! (-> self state-flags) (state-flags sf4)) @@ -334,7 +334,7 @@ (let ((s5-0 0)) (while (not (logtest? (-> self control status) (collide-status on-surface))) (target-falling-anim-trans) - (+! s5-0 (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! s5-0 (- (current-time) (-> self clock old-frame-counter))) (if (>= s5-0 300) (go target-falling #f) ) @@ -468,7 +468,7 @@ (let ((gp-0 0)) (while (not (logtest? (-> self control status) (collide-status on-surface))) (target-falling-anim-trans) - (+! gp-0 (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! gp-0 (- (current-time) (-> self clock old-frame-counter))) (if (>= gp-0 300) (go target-falling #f) ) @@ -666,9 +666,9 @@ (and (focus-test? self dark) (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) 2)) (< sv-32 2) ) - (set! sv-40 (the-as int (-> self clock frame-counter))) + (set! sv-40 (the-as int (current-time))) ) - (when (>= (- (-> self clock frame-counter) (the-as time-frame sv-40)) (seconds 0.5)) + (when (>= (- (current-time) (the-as time-frame sv-40)) (seconds 0.5)) (set! sv-40 0) 0 ) @@ -698,7 +698,7 @@ (-> self control trans) (get-trans s4-0 3) s4-0 - (-> self clock frame-counter) + (current-time) ) ) (target-start-attack) @@ -737,13 +737,13 @@ (cond ((and (>= (ja-frame-num 0) 20.0) (and (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> 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)) ) - (>= (- (-> self clock frame-counter) (-> self control sliding-start-time)) (seconds 0.04)) + (>= (- (current-time) (-> self control sliding-start-time)) (seconds 0.04)) ) ) (go target-falling #f) @@ -763,10 +763,8 @@ ) (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)) - (< (- (-> self clock frame-counter) (the-as time-frame sv-64)) (seconds 0.1)) - ) - (>= (- (-> self clock frame-counter) (the-as time-frame sv-64)) (seconds 1)) + (or (and (= gp-0 (handle->process sv-56)) (< (- (current-time) (the-as time-frame sv-64)) (seconds 0.1))) + (>= (- (current-time) (the-as time-frame sv-64)) (seconds 1)) ) ) (forward-up-nopitch->quaternion @@ -780,9 +778,7 @@ (new 'stack-no-clear 'vector) (-> self control trans) s5-1 - (* 0.009107469 - (the float (- (-> self clock frame-counter) (-> self control unknown-combo-tracker00 move-start-time))) - ) + (* 0.009107469 (the float (- (current-time) (-> self control unknown-combo-tracker00 move-start-time)))) ) ) ) @@ -793,7 +789,7 @@ ) (when (!= gp-0 (handle->process sv-56)) (set! sv-56 (process->handle gp-0)) - (set! sv-64 (the-as int (-> self clock frame-counter))) + (set! sv-64 (the-as int (current-time))) ) ) ) @@ -802,13 +798,13 @@ (set-forward-vel sv-16) ) ((and (nonzero? (-> self control unknown-time-frame18)) - (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame18)) (seconds 0.04)) + (>= (- (current-time) (-> 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) - (>= (- (-> self clock frame-counter) (-> self control unknown-combo-tracker00 move-start-time)) (seconds 0.2)) + (>= (- (current-time) (-> 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)))) @@ -950,7 +946,7 @@ ) (suspend) (ja :num! (seek! max (* (-> self control current-surface align-speed) (the-as float sv-48)))) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (set! (-> *run-attack-mods* turnvv) 0.0) ) (if (< 2 sv-24) @@ -959,7 +955,7 @@ (set! sv-24 (+ sv-24 1)) ) (if (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> 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))) @@ -1811,11 +1807,11 @@ ) ) (set! sv-64 0) - (set! sv-72 (-> self clock frame-counter)) - (set! sv-80 (-> self clock frame-counter)) + (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 (-> self clock frame-counter)) + (set! sv-96 (current-time)) (let* ((v1-70 (-> self game)) (a0-33 (+ (-> v1-70 attack-id) 1)) ) @@ -1825,7 +1821,7 @@ (ja-channel-push! 2 (seconds 0.05)) (ja :group! (-> self draw art-group data 419)) (ja :chan 1 :group! (-> self draw art-group data 420)) - (while (or (< sv-64 sv-48) (< (- (-> self clock frame-counter) sv-80) (seconds 1.5))) + (while (or (< sv-64 sv-48) (< (- (current-time) 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 @@ -1845,11 +1841,11 @@ (set! (-> self darkjak clock-vel) -4.0) (set! (-> self darkjak clock-on) #t) (send-event *camera* 'joystick -1098907648 #x3f800000) - (when (>= (- (-> self clock frame-counter) sv-72) (seconds 0.1)) - (set! sv-72 (-> self clock frame-counter)) + (when (>= (- (current-time) 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 (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (>= (- (current-time) (-> self state-time)) (seconds 1)) (set! sv-92 1.0) ) ) @@ -1882,7 +1878,7 @@ (suspend) (ja :num! (seek!)) ) - (set! (-> self gun surpress-time) (-> self clock frame-counter)) + (set! (-> self gun surpress-time) (current-time)) (send-event (handle->process (-> self notify)) 'notify 'attack 17) (go target-darkjak-get-off) (none) diff --git a/test/decompiler/reference/jak2/engine/target/target-death_REF.gc b/test/decompiler/reference/jak2/engine/target/target-death_REF.gc index 2507ce2856..07c2a1b69e 100644 --- a/test/decompiler/reference/jak2/engine/target/target-death_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-death_REF.gc @@ -89,7 +89,7 @@ (apply-settings *setting-control*) (logclear! (-> self focus-status) (focus-status teleporting)) (set! (-> self mode-cache) #f) - (set! (-> self teleport-time) (-> self clock frame-counter)) + (set! (-> self teleport-time) (current-time)) (set! (-> self control last-trans-any-surf quad) (-> self control trans quad)) (set! (-> self game kiosk-timeout) (the-as uint (-> *display* game-clock frame-counter))) (none) @@ -98,7 +98,7 @@ (local-vars (v1-96 symbol)) (set! *spawn-actors* #f) (set! (-> self control unknown-word04) (the-as uint #f)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self focus-status) (logior (focus-status teleporting) (-> self focus-status))) (let ((a0-3 (get-continue-by-name (-> self game) (-> arg0 name)))) (cond @@ -293,8 +293,8 @@ ) ) ) - (let ((s5-6 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-6) (seconds 0.05)) + (let ((s5-6 (current-time))) + (until (>= (- (current-time) s5-6) (seconds 0.05)) (suspend) ) ) @@ -320,8 +320,8 @@ (intro-play) ) ((logtest? (-> arg0 flags) (continue-flags cf7)) - (let ((s5-7 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-7) (seconds 0.05)) + (let ((s5-7 (current-time))) + (until (>= (- (current-time) s5-7) (seconds 0.05)) (suspend) ) ) @@ -354,8 +354,8 @@ (go target-grab 'stance) ) (else - (let ((s5-9 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-9) (seconds 0.05)) + (let ((s5-9 (current-time))) + (until (>= (- (current-time) s5-9) (seconds 0.05)) (suspend) ) ) @@ -676,7 +676,7 @@ (if (and (cpad-pressed? (-> self control cpad number) square) (and (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 26624.0) (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - (and (>= (- (-> self clock frame-counter) (-> self control last-time-of-stuck)) + (and (>= (- (current-time) (-> self control last-time-of-stuck)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) (not (logtest? (-> self state-flags) (state-flags prevent-attack))) @@ -700,7 +700,7 @@ ) ) (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) - (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> *TARGET-bank* stuck-time))) + (and (>= (- (current-time) (-> self state-time)) (the-as time-frame (-> *TARGET-bank* stuck-time))) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) ) @@ -961,7 +961,7 @@ :trans (behavior () (when (= *cheat-mode* 'debug) (when (and (not *pause-lock*) (cpad-hold? (-> self control cpad number) r2)) - (set! (-> self control time-of-last-debug-heal) (-> self clock frame-counter)) + (set! (-> self control time-of-last-debug-heal) (current-time)) (pickup-collectable! (-> self fact-override) (pickup-type health) 100.0 (the-as handle #f)) (go target-stance) ) @@ -971,7 +971,7 @@ :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! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self neck flex-blend) 0.0) (set! sv-32 (-> self attack-info)) (set! sv-36 (new 'stack-no-clear 'vector)) @@ -1026,7 +1026,7 @@ ((= arg0 'attack) (send-event (handle->process (-> self notify)) 'notify 'hit (-> sv-32 mode)) (logior! (-> self focus-status) (focus-status hit)) - (set! (-> self game hit-time) (-> self clock frame-counter)) + (set! (-> self game hit-time) (current-time)) (case (-> sv-32 mode) (('endlessfall) (cond @@ -1034,8 +1034,8 @@ (let ((gp-1 (new-stack-vector0))) (set! (-> gp-1 quad) (-> self control last-trans-on-ground quad)) (ja-channel-set! 0) - (let ((s5-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-1) (seconds 1)) + (let ((s5-1 (current-time))) + (until (>= (- (current-time) s5-1) (seconds 1)) (suspend) ) ) @@ -1510,7 +1510,7 @@ (the-as game-save #f) (the-as string #f) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sleep-code) 0 (none) @@ -1703,8 +1703,8 @@ (set! (-> self post-hook) target-no-ja-move-post) (ja-channel-set! 0) (ja-post) - (let ((s5-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-3) (seconds 2)) + (let ((s5-3 (current-time))) + (until (>= (- (current-time) s5-3) (seconds 2)) (suspend) ) ) @@ -1784,7 +1784,7 @@ (ja :num! (seek!)) ) (while (not (or (logtest? (-> self control status) (collide-status on-surface)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (>= (- (current-time) (-> self state-time)) (seconds 2)) ) ) (suspend) @@ -1824,8 +1824,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((s5-7 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-7) (seconds 2)) + (let ((s5-7 (current-time))) + (until (>= (- (current-time) s5-7) (seconds 2)) (suspend) ) ) @@ -1877,8 +1877,8 @@ (set! (-> self post-hook) target-no-ja-move-post) (ja-channel-set! 0) (ja-post) - (let ((s5-10 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-10) (seconds 2)) + (let ((s5-10 (current-time))) + (until (>= (- (current-time) s5-10) (seconds 2)) (suspend) ) ) @@ -1897,8 +1897,8 @@ (set! (-> self post-hook) target-no-ja-move-post) (ja-channel-set! 0) (ja-post) - (let ((s5-11 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-11) (seconds 1.2)) + (let ((s5-11 (current-time))) + (until (>= (- (current-time) s5-11) (seconds 1.2)) (suspend) ) ) @@ -1939,8 +1939,8 @@ (target-falling-anim 30 (seconds 0.33)) (ja-channel-push! 1 (seconds 0.3)) (ja-no-eval :group! (-> self draw art-group data 32) :num! (loop! 0.5) :frame-num 0.0) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.8)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.8)) (when (and (logtest? (-> self control status) (collide-status on-surface)) (!= (-> self control cur-pat event) 2)) (set! v1-24 'target-hit-ground-hard) (goto cfg-17) @@ -1988,8 +1988,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 2)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 2)) (suspend) ) ) @@ -2100,8 +2100,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((s5-13 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-13) (seconds 2)) + (let ((s5-13 (current-time))) + (until (>= (- (current-time) s5-13) (seconds 2)) (suspend) ) ) @@ -2124,7 +2124,7 @@ (let ((gp-0 0)) (while (not (logtest? (-> self control status) (collide-status on-surface))) (target-falling-anim-trans) - (+! gp-0 (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! gp-0 (- (current-time) (-> self clock old-frame-counter))) (if (-> self control unknown-spool-anim00) (return #f) ) diff --git a/test/decompiler/reference/jak2/engine/target/target-gun_REF.gc b/test/decompiler/reference/jak2/engine/target/target-gun_REF.gc index 59e1f50556..e42b47ad21 100644 --- a/test/decompiler/reference/jak2/engine/target/target-gun_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-gun_REF.gc @@ -81,9 +81,7 @@ (set! (-> arg0 turnvf) f0-15) ) (cond - ((and (nonzero? (-> self gun track-target-hold-time)) - (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) - ) + ((and (nonzero? (-> self gun track-target-hold-time)) (< (current-time) (-> self gun track-target-hold-time))) (set! (-> arg0 turnvv) 0.0) (set! (-> arg0 turnvvf) 0.0) (set! (-> arg0 seek0) 0.0) @@ -210,7 +208,7 @@ (set! (-> self gun top-anim-twist-reset) (the-as uint 0)) (set! (-> gp-0 gun-type) (pickup-type eco-yellow)) (target-gun-type-set! arg0) - (set! (-> gp-0 gun-get-on-time) (-> self clock frame-counter)) + (set! (-> gp-0 gun-get-on-time) (current-time)) ) (set! (-> self board latch?) #f) (set! (-> self gun put-away?) #f) @@ -1193,7 +1191,7 @@ (set! (-> self gun track?) (logand -9 (-> self gun track?))) ) (let ((gp-0 (the-as basic #f))) - (when (and (or (< (- (-> self clock frame-counter) (-> self control time-of-last-nonzero-input)) (seconds 0.2)) + (when (and (or (< (- (current-time) (-> self control time-of-last-nonzero-input)) (seconds 0.2)) (and (logtest? (-> self control mod-surface flags) (surface-flag air)) (not (logtest? (-> self control status) (collide-status on-surface))) ) @@ -1201,7 +1199,7 @@ (= (-> self gun gun-type) (pickup-type eco-dark)) ) ) - (>= (-> self clock frame-counter) (-> self gun track-target-hold-time)) + (>= (current-time) (-> self gun track-target-hold-time)) ) (target-gun-build-track-list) (let ((t2-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 8)))) @@ -1275,9 +1273,9 @@ (the-as focus (-> self gun track-target)) (the-as process-focusable gp-0) ) - (set! (-> self gun track-start-time) (-> self clock frame-counter)) - (if (< (- (-> self clock frame-counter) (-> self control time-of-last-nonzero-input)) (seconds 0.2)) - (set! (-> self gun track-press-start-time) (-> self clock frame-counter)) + (set! (-> self gun track-start-time) (current-time)) + (if (< (- (current-time) (-> self control time-of-last-nonzero-input)) (seconds 0.2)) + (set! (-> self gun track-press-start-time) (current-time)) ) ) (if (logtest? (process-mask enemy guard) (-> (the-as process-focusable gp-0) mask)) @@ -1289,9 +1287,7 @@ (cond ((or (not s5-1) (or (and (focus-test? (the-as process-focusable s5-1) dead) (zero? (-> self gun track-target-hold-time))) - (and (not (and (nonzero? (-> self gun track-target-hold-time)) - (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) - ) + (and (not (and (nonzero? (-> self gun track-target-hold-time)) (< (current-time) (-> self gun track-target-hold-time))) ) (and (not (logtest? (surface-flag spin) (-> self control current-surface flags))) (let ((f30-0 21845.334) @@ -1482,7 +1478,7 @@ ) (set! (-> self gun top-anim-low-high) 1.0) (if (zero? (-> self gun fire-pending)) - (set! (-> self gun fire-time) (-> self clock frame-counter)) + (set! (-> self gun fire-time) (current-time)) ) ) (((pickup-type eco-blue)) @@ -1532,8 +1528,8 @@ ;; WARN: Return type mismatch int vs none. (defbehavior target-gun-combo-start target ((arg0 int) (arg1 time-frame)) (target-top-anim-base-mode arg0) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) arg0)) - (set! (-> self gun track-target-hold-time) (+ (-> self clock frame-counter) arg1)) + (set! (-> self gun surpress-time) (+ (current-time) arg0)) + (set! (-> self gun track-target-hold-time) (+ (current-time) arg1)) 0 (none) ) @@ -1545,14 +1541,14 @@ (if (!= (not (logtest? (-> self game features) (game-feature gun))) (not (-> self gun gun))) (target-gun-setup (logtest? (-> self game features) (game-feature gun))) ) - (if (and (>= (- (-> self clock frame-counter) (-> self gun combo-window-start)) (seconds 0.7)) + (if (and (>= (- (current-time) (-> self gun combo-window-start)) (seconds 0.7)) (zero? (-> self gun fire-pending)) ) (set! (-> self gun combo-window-state) #f) ) (cond ((and (cpad-pressed? (-> self control cpad number) r1) - (< (- (-> self clock frame-counter) (-> self gun combo-window-start)) (seconds 0.7)) + (< (- (current-time) (-> self gun combo-window-start)) (seconds 0.7)) (not (focus-test? self mech dark)) (not (logtest? (surface-flag gun-off) (-> self control current-surface flags))) (not (logtest? (state-flags prevent-gun) (-> self state-flags))) @@ -1578,7 +1574,7 @@ (-> self control trans) (get-trans (the-as process-focusable gp-0) 3) (the-as process-focusable gp-0) - (-> self clock frame-counter) + (current-time) ) ((method-of-type focus try-update-focus) (the-as focus (-> self gun track-target)) @@ -1590,7 +1586,7 @@ (if (zero? (-> self gun fire-pending)) (+! (-> self gun fire-pending) 1) ) - (set! (-> self gun fire-pending-time) (-> self clock frame-counter)) + (set! (-> self gun fire-pending-time) (current-time)) (target-gun-combo-start 20 (seconds 0.4)) (send-event self 'gun-combo #t) (case (-> self gun combo-window-state) @@ -1613,17 +1609,15 @@ (logtest? (surface-flag gun-turn-fast) (-> self control current-surface flags)) (not (logtest? (state-flags prevent-gun) (-> self state-flags))) (zero? (-> self gun track-target-hold-time)) - (or (zero? (-> self gun turn-fast-hold-time)) - (>= (-> self clock frame-counter) (-> self gun turn-fast-hold-time)) - ) + (or (zero? (-> self gun turn-fast-hold-time)) (>= (current-time) (-> self gun turn-fast-hold-time))) ) (if (zero? (-> self gun fire-pending)) (+! (-> self gun fire-pending) 1) ) - (set! (-> self gun fire-pending-time) (-> self clock frame-counter)) + (set! (-> self gun fire-pending-time) (current-time)) (target-top-anim-base-mode 60) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.2))) - (set! (-> self gun turn-fast-hold-time) (+ (-> self clock frame-counter) (seconds 0.2))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.2))) + (set! (-> self gun turn-fast-hold-time) (+ (current-time) (seconds 0.2))) (send-event self 'gun-combo #t) ) ) @@ -1634,14 +1628,14 @@ (if (zero? (-> self gun fire-pending)) (+! (-> self gun fire-pending) 1) ) - (set! (-> self gun fire-pending-time) (-> self clock frame-counter)) + (set! (-> self gun fire-pending-time) (current-time)) ) ) ) (cond ((using-gun? self) (when (and (nonzero? (-> self gun top-anim-twist-reset)) - (< (the-as time-frame (-> self gun top-anim-twist-reset)) (-> self clock frame-counter)) + (< (the-as time-frame (-> self gun top-anim-twist-reset)) (current-time)) ) (quat<-gun! (the-as quaternion (-> self gun top-anim-twist-targ)) (the-as quaternion (-> self gun gun-type))) (set! (-> self gun top-anim-twist-reset) (the-as uint 0)) @@ -1743,12 +1737,8 @@ (the-as vector #f) ) (cond - ((or (and (nonzero? (-> self gun track-target-hold-time)) - (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) - ) - (and (nonzero? (-> self gun turn-fast-hold-time)) - (< (-> self clock frame-counter) (-> self gun turn-fast-hold-time)) - ) + ((or (and (nonzero? (-> self gun track-target-hold-time)) (< (current-time) (-> self gun track-target-hold-time))) + (and (nonzero? (-> self gun turn-fast-hold-time)) (< (current-time) (-> self gun turn-fast-hold-time))) (and (logtest? (-> self gun track?) 1) (logtest? (-> self gun track?) 4)) (or (logtest? (surface-flag gun-strafe) (-> self control current-surface flags)) (focus-test? self pilot-riding) @@ -1811,7 +1801,7 @@ ((and (logtest? (-> self gun track?) 1) (logtest? (process-mask enemy guard) (-> (handle->process (-> self gun track-target 0 handle)) mask)) ) - (if (and (< (- (-> self clock frame-counter) (-> self gun track-press-start-time)) (seconds 0.5)) + (if (and (< (- (current-time) (-> self gun track-press-start-time)) (seconds 0.5)) (< (-> self control time-between-zero-inputs) (seconds 0.5)) (and (= (-> self control turn-to-magnitude) 0.0) (not (logtest? (-> self control current-surface flags) (surface-flag air attack))) @@ -1825,12 +1815,8 @@ ) ) (cond - ((or (and (nonzero? (-> self gun track-target-hold-time)) - (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) - ) - (and (nonzero? (-> self gun turn-fast-hold-time)) - (< (-> self clock frame-counter) (-> self gun turn-fast-hold-time)) - ) + ((or (and (nonzero? (-> self gun track-target-hold-time)) (< (current-time) (-> self gun track-target-hold-time))) + (and (nonzero? (-> self gun turn-fast-hold-time)) (< (current-time) (-> self gun turn-fast-hold-time))) ) (set! (-> self gun track?) (the-as uint 7)) (set! (-> self gun upper-body twist-max y) 21845.334) @@ -1896,7 +1882,7 @@ ) ) (set! (-> self gun upper-body track-mode) (the-as track-mode (-> self gun track?))) - (when (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 1.5)) + (when (< (- (current-time) (-> self gun fire-time)) (seconds 1.5)) (let ((v1-459 (-> self neck))) (set! (-> v1-459 blend) 0.0) ) @@ -1964,7 +1950,7 @@ (-> self draw art-group data 245) ) (else - (when (and (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 1.5)) + (when (and (>= (- (current-time) (-> self gun fire-time)) (seconds 1.5)) (let ((v1-50 (-> self skel top-anim frame-group))) (or (= v1-50 (-> self draw art-group data 247)) (= v1-50 (-> self draw art-group data 254))) ) @@ -2011,10 +1997,8 @@ (-> self draw art-group data 244) ) (else - (when (and (or (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 2.5)) - (and (< 4096.0 (-> self control ctrl-xz-vel)) - (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 1.25)) - ) + (when (and (or (>= (- (current-time) (-> self gun fire-time)) (seconds 2.5)) + (and (< 4096.0 (-> self control ctrl-xz-vel)) (>= (- (current-time) (-> self gun fire-time)) (seconds 1.25))) ) (let ((v1-104 (-> self skel top-anim frame-group))) (or (= v1-104 (-> self draw art-group data 294)) @@ -2044,9 +2028,7 @@ (let ((v1-119 (ja-group))) (cond ((and (and v1-119 (or (= v1-119 self) (= v1-119 (-> self draw art-group data 261)))) - (and (< (-> self gun top-anim-low-high) 0.5) - (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 0.2)) - ) + (and (< (-> self gun top-anim-low-high) 0.5) (>= (- (current-time) (-> self gun fire-time)) (seconds 0.2))) ) (let ((s5-2 (get-channel (-> self skel top-anim) 0))) (set! gp-0 (if (< 0.9 (-> self control unknown-float002)) @@ -2187,8 +2169,8 @@ ) (set! (-> self gun active?) (and (not (logtest? (surface-flag gun-inactive gun-hide gun-off) (-> self control current-surface flags))) - (and (>= (- (-> self clock frame-counter) (-> self gun gun-get-on-time)) (seconds 0.1)) - (>= (-> self clock frame-counter) (-> self gun surpress-time)) + (and (>= (- (current-time) (-> self gun gun-get-on-time)) (seconds 0.1)) + (>= (current-time) (-> self gun surpress-time)) (let ((v1-35 (-> self skel top-anim frame-group)) (f0-13 (-> self skel top-anim frame-num)) ) @@ -2255,19 +2237,19 @@ ) ) (if (-> self gun active?) - (set! (-> self gun active-time) (-> self clock frame-counter)) + (set! (-> self gun active-time) (current-time)) ) (set! (-> self gun laser-active?) (not (logtest? (surface-flag gun-inactive gun-hide gun-off laser-hide) (-> self control current-surface flags)) ) ) (when (and (not (and (not (logtest? (surface-flag gun-inactive gun-hide gun-off) (-> self control current-surface flags))) - (>= (- (-> self clock frame-counter) (-> self gun gun-get-on-time)) (seconds 0.1)) - (>= (-> self clock frame-counter) (-> self gun surpress-time)) + (>= (- (current-time) (-> self gun gun-get-on-time)) (seconds 0.1)) + (>= (current-time) (-> self gun surpress-time)) ) ) - (and (>= (- (-> self clock frame-counter) (-> self gun fire-pending-time)) (seconds 0.2)) - (>= (- (-> self clock frame-counter) (-> self gun active-time)) (seconds 0.2)) + (and (>= (- (current-time) (-> self gun fire-pending-time)) (seconds 0.2)) + (>= (- (current-time) (-> self gun active-time)) (seconds 0.2)) (= (-> self gun fire-pending) 1) ) ) @@ -2331,7 +2313,7 @@ ) ) ) - (>= (- (-> self clock frame-counter) (-> self gun gun-get-on-time)) (seconds 0.1)) + (>= (- (current-time) (-> self gun gun-get-on-time)) (seconds 0.1)) (let ((v1-110 (-> self skel top-anim frame-targ))) (or (not v1-110) (= v1-110 (-> self draw art-group data 304)) @@ -2518,7 +2500,7 @@ ) (set! (-> self gun top-anim-low-high) 0.0) ) - ((and (rand-vu-percent? 0.2) (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 2))) + ((and (rand-vu-percent? 0.2) (< (- (current-time) (-> self gun fire-time)) (seconds 2))) (push-anim-to-targ (-> self skel top-anim) (the-as art-joint-anim (-> self draw art-group data 293)) @@ -2534,7 +2516,7 @@ ) ) ((and (or (rand-vu-percent? 0.2) (= (-> self skel top-anim frame-targ) (-> self draw art-group data 256))) - (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 2)) + (< (- (current-time) (-> self gun fire-time)) (seconds 2)) ) (push-anim-to-targ (-> self skel top-anim) @@ -2653,23 +2635,23 @@ (set! (-> gp-0 combo-window-state) 'target-attack-air) ) (if (cpad-pressed? (-> self control cpad number) r1) - (set! (-> gp-0 fire-start-time) (-> self clock frame-counter)) + (set! (-> gp-0 fire-start-time) (current-time)) ) (case (-> gp-0 gun-control) ((1) (when (and (cpad-pressed? (-> self control cpad number) r1) - (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (-> self clock frame-counter) (-> gp-0 fire-time))) + (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (current-time) (-> gp-0 fire-time))) ) - (set! (-> gp-0 fire-pending-time) (-> self clock frame-counter)) + (set! (-> gp-0 fire-pending-time) (current-time)) (if (zero? (-> self gun fire-pending)) (+! (-> self gun fire-pending) 1) ) (set! (-> gp-0 fire-charge) 0.5) ) - (when (and (or (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) + (when (and (or (>= (- (current-time) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) (case (-> gp-0 combo-window-state) (('target-attack-air 'target-attack 'target-running-attack) - (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 combo-fire-delay))) + (>= (- (current-time) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 combo-fire-delay))) ) ) ) @@ -2679,7 +2661,7 @@ (seekl! (-> self gun fire-pending) 0 1) (cond ((send-event self 'gun (-> gp-0 gun-type)) - (set! (-> self gun fire-time) (-> self clock frame-counter)) + (set! (-> self gun fire-time) (current-time)) ) (else (set! (-> self gun fire-time) 0) @@ -2692,23 +2674,23 @@ ((2) (when (and (cpad-hold? (-> self control cpad number) r1) (and (not (handle->process (-> self gun charge-active?))) - (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (-> self clock frame-counter) (-> gp-0 fire-time))) + (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (current-time) (-> gp-0 fire-time))) ) ) - (set! (-> gp-0 fire-pending-time) (-> self clock frame-counter)) + (set! (-> gp-0 fire-pending-time) (current-time)) (if (zero? (-> self gun fire-pending)) (+! (-> self gun fire-pending) 1) ) (set! (-> gp-0 fire-charge) 0.5) ) - (when (and (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) + (when (and (>= (- (current-time) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) (> (-> gp-0 fire-pending) 0) (-> self gun active?) ) (seekl! (-> self gun fire-pending) 0 1) (cond ((send-event self 'gun (-> gp-0 gun-type)) - (set! (-> self gun fire-time) (-> self clock frame-counter)) + (set! (-> self gun fire-time) (current-time)) ) (else (set! (-> self gun fire-time) 0) @@ -2722,9 +2704,7 @@ (cond ((cpad-hold? (-> self control cpad number) r1) (seek! (-> gp-0 fire-spinv) 218453.33 (* 145635.56 (-> self clock seconds-per-frame))) - (if (and (nonzero? (-> self gun track-target-hold-time)) - (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) - ) + (if (and (nonzero? (-> self gun track-target-hold-time)) (< (current-time) (-> self gun track-target-hold-time))) (set! (-> gp-0 fire-spinv) 218453.33) ) ) @@ -2772,22 +2752,22 @@ ) (when (and (cpad-hold? (-> self control cpad number) r1) (-> self gun active?) - (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (-> self clock frame-counter) (-> gp-0 fire-time))) + (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (current-time) (-> gp-0 fire-time))) ) - (set! (-> gp-0 fire-pending-time) (-> self clock frame-counter)) + (set! (-> gp-0 fire-pending-time) (current-time)) (if (zero? (-> self gun fire-pending)) (+! (-> self gun fire-pending) 1) ) (set! (-> gp-0 fire-charge) 0.5) ) - (when (and (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) + (when (and (>= (- (current-time) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) (> (-> gp-0 fire-pending) 0) (-> self gun active?) ) (seekl! (-> self gun fire-pending) 0 1) (cond ((send-event self 'gun (-> gp-0 gun-type)) - (set! (-> self gun fire-time) (-> self clock frame-counter)) + (set! (-> self gun fire-time) (current-time)) ) (else (set! (-> self gun fire-time) 0) @@ -2826,7 +2806,7 @@ ) ) ) - (set! (-> gp-0 gun-time) (-> self clock frame-counter)) + (set! (-> gp-0 gun-time) (current-time)) ) ) 0 diff --git a/test/decompiler/reference/jak2/engine/target/target-handler_REF.gc b/test/decompiler/reference/jak2/engine/target/target-handler_REF.gc index 87122a776a..8435818a69 100644 --- a/test/decompiler/reference/jak2/engine/target/target-handler_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-handler_REF.gc @@ -278,7 +278,7 @@ ) (when sv-96 (set! (-> self control send-attack-dest) (process->handle arg0)) - (set! (-> self control send-attack-time) (-> self clock frame-counter)) + (set! (-> self control send-attack-time) (current-time)) (send-event self 'hit arg1 arg0 arg2) (set! arg0 (and (and (focus-test? self dark) (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) 2)) arg0) @@ -293,7 +293,7 @@ (local-vars (sv-112 vector) (sv-128 matrix)) (let ((gp-0 (-> self parent))) (let ((s4-0 0) - (s3-0 (-> self clock frame-counter)) + (s3-0 (current-time)) ) (set! (-> self clock) (-> gp-0 0 clock)) (while (let ((v1-48 gp-0)) @@ -326,7 +326,7 @@ ) ) ) - (< (- (-> self clock frame-counter) s3-0) (seconds 15)) + (< (- (current-time) s3-0) (seconds 15)) (not (logtest? (-> (the-as process-focusable (-> gp-0 0)) draw status) (draw-control-status no-draw no-draw-temp)) ) ) @@ -355,10 +355,10 @@ ) ) (send-event (ppointer->process gp-0) 'color-effect 'dark 60) - (when (>= (- (-> self clock frame-counter) (the-as time-frame s4-0)) (seconds 0.05)) - (set! s4-0 (the-as int (-> self clock frame-counter))) + (when (>= (- (current-time) (the-as time-frame s4-0)) (seconds 0.05)) + (set! s4-0 (the-as int (current-time))) (cond - ((and (< (- (-> self clock frame-counter) s3-0) (seconds 0.5)) (handle->process arg0)) + ((and (< (- (current-time) 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)) @@ -644,7 +644,7 @@ (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) ) ((= v1-37 'darkjak) - (set! (-> self darkjak attack-time) (-> self clock frame-counter)) + (set! (-> self darkjak attack-time) (current-time)) (let* ((v1-160 *game-info*) (a0-102 (+ (-> v1-160 attack-id) 1)) ) @@ -794,7 +794,7 @@ (('release) (when (and (nonzero? (-> self gun)) (handle->process (-> self gun charge-active?))) (set! (-> self gun charge-active?) (the-as handle #f)) - (set! v0-0 (-> self clock frame-counter)) + (set! v0-0 (current-time)) (set! (-> self gun fire-time) (the-as time-frame v0-0)) v0-0 ) @@ -814,7 +814,7 @@ ) (rot->dir-targ! (-> self control)) (logior! (-> self control status) (collide-status on-surface on-ground touch-surface)) - (set! v0-0 (-> self clock frame-counter)) + (set! v0-0 (current-time)) (set! (-> self control last-time-on-surface) (the-as time-frame v0-0)) v0-0 ) @@ -830,7 +830,7 @@ ) (('color-effect) (set! (-> self color-effect) (the-as basic (-> arg3 param 0))) - (set! (-> self color-effect-start-time) (-> self clock frame-counter)) + (set! (-> self color-effect-start-time) (current-time)) (set! v0-0 (-> arg3 param 1)) (set! (-> self color-effect-duration) (the-as uint v0-0)) v0-0 @@ -1008,14 +1008,12 @@ ) ) (('no-load-wait) - (set! v0-0 (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 0)))) + (set! v0-0 (+ (current-time) (the-as time-frame (-> arg3 param 0)))) (set! (-> self no-load-wait) (the-as uint v0-0)) v0-0 ) (('no-look-around) - (set! (-> self no-look-around-wait) - (the-as uint (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 0)))) - ) + (set! (-> self no-look-around-wait) (the-as uint (+ (current-time) (the-as time-frame (-> arg3 param 0))))) (if (and (-> self next-state) (= (-> self next-state name) 'target-look-around)) (send-event self 'end-mode) ) @@ -1111,18 +1109,18 @@ (.mul.x.vf vf1 vf1 vf2 :mask #b111) (.svf (&-> v1-15 quad) vf1) ) - (set! (-> self control additional-decaying-velocity-end-time) (-> self clock frame-counter)) + (set! (-> self control additional-decaying-velocity-end-time) (current-time)) (set! (-> self control additional-decaying-velocity-decay-start-time) - (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 1))) + (+ (current-time) (the-as time-frame (-> arg3 param 1))) ) (set! v0-0 #t) (b! #t cfg-291 :delay (nop!)) (label cfg-23) (b! (!= v1-0 'push-transv) cfg-25 :delay (nop!)) (set! (-> self control additional-decaying-velocity quad) (-> (the-as vector (-> arg3 param 0)) quad)) - (set! (-> self control additional-decaying-velocity-end-time) (-> self clock frame-counter)) + (set! (-> self control additional-decaying-velocity-end-time) (current-time)) (set! (-> self control additional-decaying-velocity-decay-start-time) - (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 1))) + (+ (current-time) (the-as time-frame (-> arg3 param 1))) ) (set! v0-0 #t) (b! #t cfg-291 :delay (nop!)) @@ -1137,7 +1135,7 @@ ) (or (logtest? (-> self state-flags) (state-flags sf1)) (focus-test? self dead dangerous hit grabbed in-head edge-grab pole flut tube board pilot mech) - (>= (the-as time-frame (-> self no-load-wait)) (-> self clock frame-counter)) + (>= (the-as time-frame (-> self no-load-wait)) (current-time)) ) ) ) @@ -1270,7 +1268,7 @@ ) ((logtest? (-> arg3 param 2) 128) (set! (-> self darkjak stage) (logand -2 (-> self darkjak stage))) - (set! v0-0 (+ (- (seconds 20) (-> self fact-override darkjak-start-time)) (-> self clock frame-counter))) + (set! v0-0 (+ (- (seconds 20) (-> self fact-override darkjak-start-time)) (current-time))) (set! (-> self fact-override darkjak-effect-time) (the-as time-frame v0-0)) v0-0 ) diff --git a/test/decompiler/reference/jak2/engine/target/target-part_REF.gc b/test/decompiler/reference/jak2/engine/target/target-part_REF.gc index 9ae4b5058a..09437adf02 100644 --- a/test/decompiler/reference/jak2/engine/target/target-part_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-part_REF.gc @@ -2244,13 +2244,13 @@ (defbehavior process-drawable-burn-effect target ((arg0 time-frame)) (sound-play "get-burned") (let ((s5-1 (new 'stack 'rgbaf)) - (s3-0 (-> self clock frame-counter)) + (s3-0 (current-time)) (s4-1 (-> self parent)) ) (set! (-> s5-1 quad) (-> (the-as process-drawable (-> s4-1 0)) draw color-mult quad)) (let ((s2-1 (vector-float*! (the-as vector (new 'stack 'rgbaf)) (the-as vector s5-1) 0.0))) - (while (< (- (-> self clock frame-counter) s3-0) arg0) - (let ((v1-8 (- (-> self clock frame-counter) s3-0))) + (while (< (- (current-time) s3-0) arg0) + (let ((v1-8 (- (current-time) s3-0))) (if (< v1-8 (the-as time-frame (/ arg0 2))) (vector-lerp! (-> (the-as process-drawable (-> s4-1 0)) draw color-mult) @@ -2616,98 +2616,96 @@ (sv-736 int) (sv-752 lightning-tracker) ) - (with-pp - (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))) - ) - (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-640 arg6) + (let ((s5-0 *lightning-probe-vars*)) + (if (= arg4 256) (set! sv-656 arg4) - sv-656 + (set! sv-656 (rand-vu-int-range 3 (/ (+ (-> arg0 node-list length) -1) 2))) ) - (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! (-> s5-0 last-valid-time) (-> pp clock frame-counter)) - (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) - ) + (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! (-> s5-0 last-valid-time) (current-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) - ) - (-> s5-0 end-pos) - ) - (-> sv-752 ppointer-override) + ) + (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) + ) + (-> s5-0 end-pos) + ) + (-> sv-752 ppointer-override) ) - (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*) - ) - (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) - ) + ) + (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*) + ) + (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) ) ) ) ) - (the-as object 0) ) + (the-as object 0) ) ;; definition for function process-drawable-shock-wall-effect diff --git a/test/decompiler/reference/jak2/engine/target/target-swim_REF.gc b/test/decompiler/reference/jak2/engine/target/target-swim_REF.gc index 9cd99e6f35..fbfd51b64e 100644 --- a/test/decompiler/reference/jak2/engine/target/target-swim_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-swim_REF.gc @@ -5,7 +5,7 @@ (defstate target-wade-stance (target) :event target-standard-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *wade-mods*) (set-zero! (-> self water bob)) (none) @@ -22,7 +22,7 @@ :trans (behavior () ((-> self state-hook)) (when (and (not (logtest? (water-flags wading) (-> self water flags))) - (>= (- (-> self clock frame-counter) (-> self water wade-time)) (seconds 0.05)) + (>= (- (current-time) (-> self water wade-time)) (seconds 0.05)) ) (if (logtest? (water-flags swimming) (-> self water flags)) (go target-swim-stance) @@ -77,7 +77,7 @@ :trans (behavior () ((-> self state-hook)) (when (and (not (logtest? (water-flags wading) (-> self water flags))) - (>= (- (-> self clock frame-counter) (-> self water wade-time)) (seconds 0.1)) + (>= (- (current-time) (-> self water wade-time)) (seconds 0.1)) ) (if (logtest? (water-flags swimming) (-> self water flags)) (go target-swim-stance) @@ -304,7 +304,7 @@ (ja :chan 2 :num! (chan 0)) (ja :chan 3 :num! (chan 0)) (ja :chan 4 :num! (chan 0)) - (when (and (>= (- (-> self clock frame-counter) (the-as time-frame gp-6)) (seconds 0.2)) + (when (and (>= (- (current-time) (the-as time-frame gp-6)) (seconds 0.2)) (< (- (-> self water height) (-> self control trans y)) 4096.0) ) (case (the int (ja-aframe-num 0)) @@ -317,7 +317,7 @@ (vector-float*! (new 'stack-no-clear 'vector) (-> self control transv) 2.5) #f ) - (set! gp-6 (the-as int (-> self clock frame-counter))) + (set! gp-6 (the-as int (current-time))) ) ((46 47 48 49) (spawn-ripples @@ -328,7 +328,7 @@ (vector-float*! (new 'stack-no-clear 'vector) (-> self control transv) 2.5) #f ) - (set! gp-6 (the-as int (-> self clock frame-counter))) + (set! gp-6 (the-as int (current-time))) ) ) ) @@ -377,7 +377,7 @@ (defstate target-swim-stance (target) :event target-standard-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *swim-mods*) (logior! (-> self water flags) (water-flags swim-ground)) (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) @@ -424,7 +424,7 @@ (set-zero! (-> self water bob)) ) (when (and (not (logtest? (water-flags swimming) (-> self water flags))) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (>= (- (current-time) (-> self state-time)) (seconds 0.1)) ) (if (logtest? (water-flags wading) (-> self water flags)) (go target-wade-stance) @@ -439,7 +439,7 @@ (pad-buttons x) ) (can-jump? #f) - (>= (- (-> self clock frame-counter) (-> self water enter-swim-time)) (seconds 0.1)) + (>= (- (current-time) (-> self water enter-swim-time)) (seconds 0.1)) ) (go target-swim-jump (-> *TARGET-bank* swim-jump-height-min) (-> *TARGET-bank* swim-jump-height-max)) ) @@ -534,7 +534,7 @@ :enter (behavior () ((-> target-swim-stance enter)) (die-on-next-update! (-> self water bob)) - (set! (-> self control unknown-word04) (the-as uint (-> self clock frame-counter))) + (set! (-> self control unknown-word04) (the-as uint (current-time))) (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) (none) ) @@ -547,7 +547,7 @@ (set-zero! (-> self water bob)) ) (when (and (not (logtest? (water-flags swimming) (-> self water flags))) - (>= (- (-> self clock frame-counter) (-> self water swim-time)) (seconds 0.1)) + (>= (- (current-time) (-> self water swim-time)) (seconds 0.1)) ) (if (logtest? (water-flags wading) (-> self water flags)) (go target-wade-stance) @@ -562,7 +562,7 @@ (pad-buttons x) ) (can-jump? #f) - (>= (- (-> self clock frame-counter) (-> self water enter-swim-time)) (seconds 0.1)) + (>= (- (current-time) (-> self water enter-swim-time)) (seconds 0.1)) ) (go target-swim-jump (-> *TARGET-bank* swim-jump-height-min) (-> *TARGET-bank* swim-jump-height-max)) ) @@ -581,14 +581,12 @@ ) (cond ((= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) - (if (>= (the-as uint (- (-> self clock frame-counter) (the-as int (-> self control unknown-word04)))) - (the-as uint 15) - ) + (if (>= (the-as uint (- (current-time) (the-as int (-> self control unknown-word04)))) (the-as uint 15)) (go target-swim-stance) ) ) (else - (set! (-> self control unknown-word04) (the-as uint (-> self clock frame-counter))) + (set! (-> self control unknown-word04) (the-as uint (current-time))) ) ) (target-swim-tilt 0.0 2.0 0.0 1.0) @@ -697,13 +695,13 @@ (target-standard-event-handler proc arg1 event-type event) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) (logclear! (-> self water flags) (water-flags swim-ground)) (set! (-> self control mod-surface) *dive-mods*) (set! (-> self control dynam gravity-max) 16384.0) (set! (-> self control dynam gravity-length) 16384.0) - (set! (-> self water swim-time) (-> self clock frame-counter)) + (set! (-> self water swim-time) (current-time)) (set! (-> self control unknown-word04) (the-as uint #f)) (set! (-> self neck flex-blend) 0.0) (none) @@ -743,11 +741,11 @@ (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self water swim-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self water swim-time)) (seconds 0.5)) (go target-stance) ) (cond - ((>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.1)) + ((>= (- (current-time) (-> self control last-time-on-surface)) (seconds 0.1)) (set! (-> self control mod-surface) *dive-mods*) (if (and (-> self next-state) (= (-> self next-state name) 'target-swim-down)) (target-swim-tilt -0.9 1.0 0.0 0.5) @@ -834,21 +832,21 @@ ) ) (until #f - (when (and (!= (-> self tobot?) 'tobot) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05))) + (when (and (!= (-> self tobot?) 'tobot) (>= (- (current-time) (-> self state-time)) (seconds 0.05))) (if (and (or (not (cpad-hold? (-> self control cpad number) circle square)) (-> self control unknown-spool-anim00)) - (>= (- (-> self clock frame-counter) (-> self state-time)) gp-0) + (>= (- (current-time) (-> self state-time)) gp-0) ) (go target-swim-up) ) - (if (or (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame27)) s5-0) + (if (or (>= (- (current-time) (-> self control unknown-time-frame27)) s5-0) (and (logtest? (-> self control status) (collide-status on-surface)) - (and (< (-> self water swim-depth) 8192.0) (>= (- (-> self clock frame-counter) (-> self state-time)) gp-0)) + (and (< (-> self water swim-depth) 8192.0) (>= (- (current-time) (-> self state-time)) gp-0)) ) ) (go target-swim-up) ) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (sound-play "water-bubbles" :id (-> self control bubbles-sound)) ) (let ((s4-3 (new-stack-vector0)) @@ -898,7 +896,7 @@ (the-as surface #f) ) ) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 10)) + (when (and (>= (- (current-time) (-> self state-time)) (seconds 10)) (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) ) (let ((a1-3 (new 'stack-no-clear 'event-message-block))) @@ -920,11 +918,11 @@ ) ) (if (and (cpad-pressed? (-> self control cpad number) circle square) - (or (< (- (-> self clock frame-counter) (-> self control unknown-time-frame27)) (seconds 10)) + (or (< (- (current-time) (-> self control unknown-time-frame27)) (seconds 10)) (logtest? (-> self control status) (collide-status touch-ceiling)) ) (and (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (>= (- (current-time) (-> self state-time)) (seconds 0.05)) ) ) (go target-swim-down) @@ -1011,9 +1009,9 @@ #f (label cfg-51) (logior! (-> self water flags) (water-flags swim-ground)) - (set! (-> self water swim-time) (-> self clock frame-counter)) + (set! (-> self water swim-time) (current-time)) (start-bobbing! (-> self water) -4096.0 600 1500) - (set! (-> self water bob start-time) (+ (-> self clock frame-counter) (seconds -0.05))) + (set! (-> self water bob start-time) (+ (current-time) (seconds -0.05))) (go target-swim-stance) (none) ) @@ -1027,7 +1025,7 @@ :exit target-exit :trans (behavior () (cond - ((< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + ((< (- (current-time) (-> self state-time)) (seconds 0.5)) (set! (-> self water flags) (logior (water-flags jump-out) (-> self water flags))) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) ) diff --git a/test/decompiler/reference/jak2/engine/target/target-tube_REF.gc b/test/decompiler/reference/jak2/engine/target/target-tube_REF.gc index 991308dad3..5c0f32ed0c 100644 --- a/test/decompiler/reference/jak2/engine/target/target-tube_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-tube_REF.gc @@ -623,7 +623,7 @@ (set! (-> self tube entity) (-> a0-4 entity)) ) ) - (set! (-> self tube start-time) (-> self clock frame-counter)) + (set! (-> self tube start-time) (current-time)) (set! (-> self tube tube-sound-id) (new-sound-id)) (set! (-> self tube tube-sound-vol) 0.0) (set! (-> self tube tube-sound-pitch) 0.0) @@ -713,7 +713,7 @@ (ja :group! (-> self draw art-group data 111) :num! (identity (ja-aframe (+ (-> self tube turn-anim-frame) - (* 5.0 (sin (* 145.63556 (the float (- (-> self clock frame-counter) (-> self state-time)))))) + (* 5.0 (sin (* 145.63556 (the float (- (current-time) (-> self state-time)))))) ) 0 ) @@ -784,7 +784,7 @@ (defstate target-tube-jump (target) :event (-> target-tube-start event) :enter (behavior ((arg0 float) (arg1 float)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control mod-surface) *tube-jump-mods*) @@ -864,9 +864,9 @@ ) :code (behavior ((arg0 symbol) (arg1 attack-info)) (let ((gp-0 (-> self attack-info))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self focus-status) (focus-status hit)) - (set! (-> self game hit-time) (-> self clock frame-counter)) + (set! (-> self game hit-time) (current-time)) (when (not (logtest? (-> arg1 mask) (attack-info-mask vector))) (vector-! (-> arg1 vector) @@ -915,7 +915,7 @@ (when (= arg0 'attack) (send-event (handle->process (-> self notify)) 'notify 'hit (-> gp-0 mode)) (logior! (-> self focus-status) (focus-status hit)) - (set! (-> self game hit-time) (-> self clock frame-counter)) + (set! (-> self game hit-time) (current-time)) (case (-> gp-0 mode) (('bot) (pickup-collectable! (-> self fact-override) (pickup-type health) -1000.0 (the-as handle #f)) @@ -1000,10 +1000,10 @@ ) (set! (-> self control transv quad) (the-as uint128 0)) (initialize! (-> self game) 'life (the-as game-save #f) (the-as string #f)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until v1-42 (suspend) - (set! v1-42 (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (movie?)))) + (set! v1-42 (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (not (movie?)))) ) (go target-tube) (none) diff --git a/test/decompiler/reference/jak2/engine/target/target-turret_REF.gc b/test/decompiler/reference/jak2/engine/target/target-turret_REF.gc index 8b93722235..4adb736f4e 100644 --- a/test/decompiler/reference/jak2/engine/target/target-turret_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-turret_REF.gc @@ -1268,110 +1268,108 @@ :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'draw) - (cond - ((-> event param 0) - (ja-channel-set! 1) - (ja :group! (-> self draw art-group data 2)) - (transform-post) - ) - (else - (ja-channel-set! 0) - (transform-post) - ) - ) - ) - ((= v1-0 'fire-down) - (cond - ((>= (-> self heat) 1.0) - (let ((v1-8 (- (-> self clock frame-counter) (-> self fire-time))) - (a0-7 6) - (a1-1 (-> self fire-time-interval)) - ) - (when (>= v1-8 (* a0-7 a1-1)) - (set! (-> self fire-time) (-> self clock frame-counter)) - (the-as object (base-turret-method-45 self a1-1 event-type)) - ) - ) - ) - (else - (when (>= (- (-> self clock frame-counter) (-> self fire-time)) (-> self fire-time-interval)) - (set! (-> self fire-time) (-> self clock frame-counter)) - (the-as object (base-turret-method-45 self arg1 event-type)) - ) - ) - ) - ) - ((= v1-0 'fire-pressed) - (set! (-> self fire-time) (-> self clock frame-counter)) - (the-as object (base-turret-method-45 self arg1 event-type)) - ) - ((= v1-0 'bonk) - #f - ) - ((or (= v1-0 'touch) (= v1-0 'attack)) - (let* ((gp-0 (-> event param 0)) - (s5-0 (the-as object (-> event param 1))) - (s4-0 proc) - (v1-21 (if (type? s4-0 projectile) - s4-0 + (the-as object (cond + ((= v1-0 'draw) + (cond + ((-> event param 0) + (ja-channel-set! 1) + (ja :group! (-> self draw art-group data 2)) + (transform-post) + ) + (else + (ja-channel-set! 0) + (transform-post) + ) + ) + ) + ((= v1-0 'fire-down) + (cond + ((>= (-> self heat) 1.0) + (let ((v1-8 (- (current-time) (-> self fire-time))) + (a0-7 6) + (a1-1 (-> self fire-time-interval)) + ) + (when (>= v1-8 (* a0-7 a1-1)) + (set! (-> self fire-time) (current-time)) + (the-as object (base-turret-method-45 self a1-1 event-type)) + ) ) + ) + (else + (when (>= (- (current-time) (-> self fire-time)) (-> self fire-time-interval)) + (set! (-> self fire-time) (current-time)) + (the-as object (base-turret-method-45 self arg1 event-type)) + ) + ) + ) + ) + ((= v1-0 'fire-pressed) + (set! (-> self fire-time) (current-time)) + (the-as object (base-turret-method-45 self arg1 event-type)) + ) + ((= v1-0 'bonk) + #f + ) + ((or (= v1-0 'touch) (= v1-0 'attack)) + (let* ((gp-0 (-> event param 0)) + (s5-0 (the-as object (-> event param 1))) + (s4-0 proc) + (v1-21 (if (type? s4-0 projectile) + s4-0 + ) + ) + ) + (when (and gp-0 v1-21) + (case (-> (the-as attack-info s5-0) mode) + (('wasp-shot 'guard-shot) + (seek! (-> self health) 0.0 0.25) + (activate! (-> self smush-control) 0.2 15 75 1.0 0.9 (-> *display* entity-clock)) + (sound-play "turret-take-hit") + (let ((v0-1 (the-as object (+ (current-time) (seconds 0.08))))) + (set! (-> self red-filter-timer) (the-as time-frame v0-1)) + v0-1 + ) + ) + (('drill-ship-shot) + (seek! (-> self health) 0.0 0.5) + (activate! (-> self smush-control) 0.2 24 144 1.0 0.9 (-> *display* entity-clock)) + (sound-play "turret-take-hit") + ) + ) + ) + ) + ) + ((= v1-0 'test) + (set! (-> self health) (seek (-> self health) 0.0 (the-as float (-> event param 0)))) + ) + ((= v1-0 'exit-valid) + (let ((v1-33 (-> self path-mode))) + (cond + ((or (zero? v1-33) (= v1-33 5) (= v1-33 1)) + (base-turret-method-41 self (the-as vector (-> event param 0))) + #t + ) + (else + #f + ) + ) + ) + ) + ((= v1-0 'exit) + (let ((v1-37 (-> self path-mode))) + (when (if (or (zero? v1-37) (= v1-37 5) (= v1-37 1)) + #t + ) + (go-virtual shutdown) + #f + ) + ) + ) + (else + (turret-handler proc arg1 event-type event) ) - ) - (when (and gp-0 v1-21) - (case (-> (the-as attack-info s5-0) mode) - (('wasp-shot 'guard-shot) - (seek! (-> self health) 0.0 0.25) - (activate! (-> self smush-control) 0.2 15 75 1.0 0.9 (-> *display* entity-clock)) - (sound-play "turret-take-hit") - (let ((v0-1 (the-as object (+ (-> self clock frame-counter) (seconds 0.08))))) - (set! (-> self red-filter-timer) (the-as time-frame v0-1)) - v0-1 - ) - ) - (('drill-ship-shot) - (seek! (-> self health) 0.0 0.5) - (activate! (-> self smush-control) 0.2 24 144 1.0 0.9 (-> *display* entity-clock)) - (sound-play "turret-take-hit") - ) - ) - ) - ) - ) - ((= v1-0 'test) - (set! (-> self health) (seek (-> self health) 0.0 (the-as float (-> event param 0)))) - ) - ((= v1-0 'exit-valid) - (let ((v1-33 (-> self path-mode))) - (cond - ((or (zero? v1-33) (= v1-33 5) (= v1-33 1)) - (base-turret-method-41 self (the-as vector (-> event param 0))) - #t - ) - (else - #f - ) - ) - ) - ) - ((= v1-0 'exit) - (let ((v1-37 (-> self path-mode))) - (when (if (or (zero? v1-37) (= v1-37 5) (= v1-37 1)) - #t ) - (go-virtual shutdown) - #f - ) - ) - ) - (else - (turret-handler proc arg1 event-type event) - ) - ) - ) + ) ) ) :enter (behavior () @@ -1482,8 +1480,8 @@ :post (behavior () (when (nonzero? (-> self red-filter-timer)) (cond - ((< (-> self clock frame-counter) (-> self red-filter-timer)) - (let* ((v1-5 (- (-> self red-filter-timer) (-> self clock frame-counter))) + ((< (current-time) (-> self red-filter-timer)) + (let* ((v1-5 (- (-> self red-filter-timer) (current-time))) (f0-1 (- 1.0 (* 0.041666668 (the float v1-5)))) ) (set-filter-color! 1.0 f0-1 f0-1) @@ -1766,8 +1764,8 @@ (sound-stop (-> self sound-id 1)) (sound-stop (-> self sound-id 2)) (set! (-> self focus-status) (focus-status disable ignore inactive)) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.8)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.8)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/target-util_REF.gc b/test/decompiler/reference/jak2/engine/target/target-util_REF.gc index 8afd333a01..26be7c23e2 100644 --- a/test/decompiler/reference/jak2/engine/target/target-util_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-util_REF.gc @@ -1212,7 +1212,7 @@ (>= (- (-> *display* base-clock frame-counter) (-> self control cpad change-time)) (seconds 60)) (>= (- (-> *display* game-clock frame-counter) (the-as int (-> self game kiosk-timeout))) (seconds 60)) ) - (and (>= (- (-> self clock frame-counter) (-> self ambient-time)) (seconds 30)) + (and (>= (- (current-time) (-> self ambient-time)) (seconds 30)) (not (logtest? (-> self control status) (collide-status touch-actor))) (logtest? (-> self control status) (collide-status on-surface)) (not (or (logtest? (water-flags touch-water) (-> self water flags)) @@ -1256,15 +1256,15 @@ ;; definition for function can-jump? (defbehavior can-jump? target ((arg0 symbol)) (and (or (logtest? (-> self control status) (collide-status on-surface)) - (< (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (< (- (current-time) (-> self control last-time-on-surface)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) (and (logtest? (-> self control status) (collide-status on-surface)) (< 0.866 (-> self control surface-angle)) ) (and (= arg0 'board) - (or (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.05)) - (and (< (- (-> self clock frame-counter) (-> self control last-time-of-stuck)) (seconds 0.5)) + (or (< (- (current-time) (-> self board unknown-time-frame00)) (seconds 0.05)) + (and (< (- (current-time) (-> self control last-time-of-stuck)) (seconds 0.5)) (< (target-height-above-ground) 2048.0) ) ) @@ -1299,7 +1299,7 @@ (when (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) - (set! (-> self control last-time-of-stuck) (-> self clock frame-counter)) + (set! (-> self control last-time-of-stuck) (current-time)) #t ) ) @@ -1325,15 +1325,13 @@ ;; WARN: Return type mismatch object vs none. (defbehavior fall-test target ((arg0 (state symbol target)) (arg1 float)) (when (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> 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) arg1) ) - (if (< (- (-> self clock frame-counter) (-> self control rider-time)) - (the-as time-frame (-> *TARGET-bank* ground-timeout)) - ) + (if (< (- (current-time) (-> self control rider-time)) (the-as time-frame (-> *TARGET-bank* ground-timeout))) (send-event self 'push-transv (-> self control rider-last-move) #x7530) ) (go arg0 #f) @@ -1345,7 +1343,7 @@ ;; WARN: Return type mismatch object vs none. (defbehavior slide-down-test target () (if (and (not (logtest? (-> self control status) (collide-status on-surface touch-edge))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> self control last-time-on-surface)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) (logtest? (-> self control status) (collide-status touch-surface)) @@ -1375,13 +1373,11 @@ (< (-> self control local-slope-z) 0.7) (not (logtest? (-> self state-flags) (state-flags prevent-attack prevent-duck))) (not (and (focus-test? self dark) (nonzero? (-> self darkjak)))) - (>= (- (-> self clock frame-counter) (the-as int (-> *TARGET-bank* roll-timeout))) - (-> self control last-roll-end-time) - ) + (>= (- (current-time) (the-as int (-> *TARGET-bank* roll-timeout))) (-> self control last-roll-end-time)) (or (not (enabled-gun? self)) (not (-> *TARGET-bank* strafe-duck-jump)) (and (< 0.3 (vector-dot (-> self control to-target-pt-xz) (-> self control c-R-w vector 2))) - (>= (- (-> self clock frame-counter) (-> self control time-of-last-zero-input)) (seconds 0.3)) + (>= (- (current-time) (-> self control time-of-last-zero-input)) (seconds 0.3)) ) ) (not (and (not (using-gun? self)) (!= (-> self skel top-anim interp) 0.0))) @@ -1445,13 +1441,13 @@ #f ) ((and (or (not arg0) - (and (< (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (and (< (- (current-time) (-> self control last-time-on-surface)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) (< (-> self control local-slope-z) 0.7) ) ) - (>= (- (-> self clock frame-counter) (-> self control last-running-attack-end-time)) + (>= (- (current-time) (-> self control last-running-attack-end-time)) (the-as time-frame (if (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 1) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) @@ -1464,7 +1460,7 @@ #t ) (else - (set! (-> self control last-hands-attempt-time) (-> self clock frame-counter)) + (set! (-> self control last-hands-attempt-time) (current-time)) #f ) ) @@ -1478,13 +1474,13 @@ ) #f ) - ((>= (- (-> self clock frame-counter) (-> self control last-attack-end-time)) + ((>= (- (current-time) (-> self control last-attack-end-time)) (the-as time-frame (-> *TARGET-bank* attack-timeout)) ) #t ) (else - (set! (-> self control last-feet-attempt-time) (-> self clock frame-counter)) + (set! (-> self control last-feet-attempt-time) (current-time)) #f ) ) @@ -1572,24 +1568,22 @@ ;; definition for function target-timed-invulnerable ;; WARN: Return type mismatch int vs none. (defun target-timed-invulnerable ((arg0 time-frame) (arg1 target) (arg2 int)) - (with-pp - (case arg2 - ((1) - (logior! (-> arg1 state-flags) (state-flags tinvul1)) - (set! (-> arg1 control invul1-on-time) (-> pp clock frame-counter)) - (set! (-> arg1 control invul1-off-time) arg0) - ) - ((2) - (set! (-> arg1 state-flags) (logior (state-flags tinvul2) (-> arg1 state-flags))) - (set! (-> arg1 control invul2-on-time) (-> pp clock frame-counter)) - (set! (-> arg1 control invul2-off-time) arg0) - ) - ) - (modify-collide-as! (-> arg1 control) 2 (collide-spec jak-vulnerable) (collide-spec)) - (logior! (-> arg1 focus-status) (focus-status ignore)) - 0 - (none) + (case arg2 + ((1) + (logior! (-> arg1 state-flags) (state-flags tinvul1)) + (set! (-> arg1 control invul1-on-time) (current-time)) + (set! (-> arg1 control invul1-off-time) arg0) + ) + ((2) + (set! (-> arg1 state-flags) (logior (state-flags tinvul2) (-> arg1 state-flags))) + (set! (-> arg1 control invul2-on-time) (current-time)) + (set! (-> arg1 control invul2-off-time) arg0) + ) ) + (modify-collide-as! (-> arg1 control) 2 (collide-spec jak-vulnerable) (collide-spec)) + (logior! (-> arg1 focus-status) (focus-status ignore)) + 0 + (none) ) ;; definition for function target-timed-invulnerable-off @@ -1625,7 +1619,7 @@ (dotimes (a2-2 8) (let ((v1-9 (-> self attack-info-old a2-2))) (when (= (-> arg0 id) (-> v1-9 id)) - (if (< (- (-> self clock frame-counter) (-> v1-9 attack-time)) + (if (< (- (current-time) (-> v1-9 attack-time)) (the-as time-frame (-> *TARGET-bank* same-attack-invulnerable-timeout)) ) (return #f) diff --git a/test/decompiler/reference/jak2/engine/target/target2_REF.gc b/test/decompiler/reference/jak2/engine/target/target2_REF.gc index e1c0c8f4be..1ea367d3ba 100644 --- a/test/decompiler/reference/jak2/engine/target/target2_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target2_REF.gc @@ -12,7 +12,7 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('loading) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) #f ) (else @@ -23,8 +23,8 @@ :exit target-exit :code (behavior () (set! (-> self control mod-surface) *trip-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 0.05)) (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! (-> self draw art-group data 63) :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 63)) frames num-frames) -1))) @@ -46,8 +46,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.3)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.3)) (suspend) (ja :num! (seek! (ja-aframe 19.0 0) 0.05)) (suspend) @@ -131,11 +131,11 @@ ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () - (set! (-> self ambient-time) (-> self clock frame-counter)) + (set! (-> self ambient-time) (current-time)) (let ((a0-0 (-> self spool-anim))) (when (and a0-0 (= (-> *setting-control* user-current spooling) (process->ppointer self))) (ja-abort-spooled-anim a0-0 (the-as art-joint-anim #f) -1) @@ -200,10 +200,8 @@ (set! (-> a1-0 from) (process->ppointer self)) (set! (-> a1-0 num-params) 0) (set! (-> a1-0 message) 'dist-from-interp-src) - (and (or (< (send-event-function *camera* a1-0) 4915.2) - (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) - ) - (and (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.07)) (zero? (ja-group-size))) + (and (or (< (send-event-function *camera* a1-0) 4915.2) (< (- (current-time) (-> self state-time)) (seconds 0.05))) + (and (< (- (current-time) (-> self state-time)) (seconds 0.07)) (zero? (ja-group-size))) ) ) (suspend) @@ -388,7 +386,7 @@ (none) ) :exit (behavior () - (set! (-> self ambient-time) (-> self clock frame-counter)) + (set! (-> self ambient-time) (current-time)) (logclear! (-> self state-flags) (state-flags sf2)) (target-exit) (none) @@ -398,7 +396,7 @@ (let ((gp-0 0)) (while (not (logtest? (-> self control status) (collide-status on-surface))) (target-falling-anim-trans) - (+! gp-0 (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! gp-0 (- (current-time) (-> self clock old-frame-counter))) (suspend) ) (if (or (> gp-0 0) (let ((v1-10 (ja-group))) @@ -554,7 +552,7 @@ ) :enter (behavior ((arg0 handle)) (set! (-> self control anim-handle) arg0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *pole-mods*) (logior! (-> self focus-status) (focus-status pole)) (target-collide-set! 'pole 0.0) @@ -580,7 +578,7 @@ (pad-buttons x) ) (not (logtest? (-> self state-flags) (state-flags prevent-jump))) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.4)) + (>= (- (current-time) (-> self state-time)) (seconds 0.4)) ) (set! (-> self control transv quad) (the-as uint128 0)) (cond @@ -796,11 +794,11 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> *edge-grab-info* pilot-edge-grab?) #f) (set! (-> self control unknown-handle000) (the-as handle #f)) (set! (-> self control mod-surface) *edge-grab-mods*) - (set! (-> self control edge-grab-start-time) (-> self clock frame-counter)) + (set! (-> self control edge-grab-start-time) (current-time)) (logior! (-> self control root-prim prim-core action) (collide-action dont-push-away)) (logior! (-> self focus-status) (focus-status edge-grab)) (set! (-> self control unknown-vector37 quad) (-> self control transv quad)) @@ -835,7 +833,7 @@ (none) ) :trans (behavior () - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (when (and (>= (- (current-time) (-> self state-time)) (seconds 0.2)) (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) ) @@ -1032,7 +1030,7 @@ (set! (-> self control transv quad) (the-as uint128 0)) (set! (-> self control time-of-last-clear-wall-in-jump) 0) (set-forward-vel 16384.0) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.2))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.2))) (send-event *camera* 'damp-up) (go target-jump-forward arg0 arg1) (none) @@ -1075,9 +1073,9 @@ (set! (-> self control transv quad) (the-as uint128 0)) (logclear! (-> self focus-status) (focus-status edge-grab)) (logclear! (-> self control root-prim prim-core action) (collide-action dont-push-away)) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.2))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.2))) (vector-float*! (-> self control transv) (-> self control edge-grab-across-edge-dir) -40960.0) - (if (< (- (-> self clock frame-counter) (-> self control rider-time)) (seconds 0.2)) + (if (< (- (current-time) (-> self control rider-time)) (seconds 0.2)) (send-event self 'push-transv (-> self control rider-last-move) #x7530) ) (go target-falling 'target-edge-grab) @@ -1193,7 +1191,7 @@ (-> self control wall-contact-normal) (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control quat)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -1212,7 +1210,7 @@ (go target-ice-stance) ) (if (and (move-legs?) - (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (let ((f0-1 (vector-dot (-> self control to-target-pt-xz) (-> self control wall-contact-normal)))) (< 0.1 f0-1) ) @@ -1332,8 +1330,8 @@ (until #f (let ((s5-0 (rand-vu-int-range 30 600))) (ja :group! (-> self draw art-group data 85)) - (let ((s4-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-0) s5-0) + (let ((s4-0 (current-time))) + (until (>= (- (current-time) s4-0) s5-0) (gp-0) (suspend) ) @@ -1393,9 +1391,9 @@ (ja :num! (seek! max f30-0)) ) (let ((s5-2 (rand-vu-int-range 60 300)) - (s4-2 (-> self clock frame-counter)) + (s4-2 (current-time)) ) - (until (>= (- (-> self clock frame-counter) s4-2) s5-2) + (until (>= (- (current-time) s4-2) s5-2) (gp-0) (suspend) ) @@ -1421,9 +1419,9 @@ (ja :num! (seek! 0.0 f30-0)) ) (let ((s5-3 (rand-vu-int-range 60 300)) - (s4-3 (-> self clock frame-counter)) + (s4-3 (current-time)) ) - (until (>= (- (-> self clock frame-counter) s4-3) s5-3) + (until (>= (- (current-time) s4-3) s5-3) (gp-0) (suspend) ) @@ -1460,7 +1458,7 @@ ) ) :code (behavior ((arg0 float) (arg1 symbol) (arg2 vector) (arg3 int)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *turn-around-mods*) (ja-channel-push! 1 (seconds 0.15)) (set-forward-vel 0.0) @@ -1478,13 +1476,13 @@ (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 (-> self clock frame-counter)) + (set! sv-32 (current-time)) (let ((v1-2 (new-stack-vector0))) (set! (-> v1-2 quad) (-> arg0 quad)) (set! sv-40 v1-2) ) (set! sv-44 #t) - (until (>= (- (-> self clock frame-counter) sv-32) arg1) + (until (>= (- (current-time) sv-32) arg1) (let ((s4-0 (ppointer->process (-> self parent)))) (cond ((and sv-44 @@ -1500,7 +1498,7 @@ ) (else (if sv-44 - (set! sv-32 (-> self clock frame-counter)) + (set! sv-32 (current-time)) ) (set! sv-44 (the-as symbol #f)) (when (and (-> (the-as target s4-0) next-state) @@ -1635,7 +1633,7 @@ ) (rot->dir-targ! (-> self control)) (logior! (-> self control status) (collide-status on-surface on-ground touch-surface)) - (set! (-> self control last-time-on-surface) (-> self clock frame-counter)) + (set! (-> self control last-time-on-surface) (current-time)) (ja-channel-set! 0) (ja-post) (target-exit) @@ -1704,7 +1702,7 @@ (none) ) :trans (behavior () - (set! (-> self control time-of-last-debug-float) (-> self clock frame-counter)) + (set! (-> self control time-of-last-debug-float) (current-time)) (cond ((cpad-hold? (-> self control cpad number) r2) (let ((a1-0 (new 'stack-no-clear 'vector))) diff --git a/test/decompiler/reference/jak2/engine/target/target_REF.gc b/test/decompiler/reference/jak2/engine/target/target_REF.gc index 2b3cf43b8b..3a38111f77 100644 --- a/test/decompiler/reference/jak2/engine/target/target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target_REF.gc @@ -15,7 +15,7 @@ ) (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) (>= arg1 0) - (>= (- (-> self clock frame-counter) (-> self state-time)) arg1) + (>= (- (current-time) (-> self state-time)) arg1) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) #t @@ -23,7 +23,7 @@ (logior! (-> self control status) (collide-status on-surface)) (go target-hit-ground 'stuck) ) - (if (!= (-> self state-time) (-> self clock frame-counter)) + (if (!= (-> self state-time) (current-time)) (slide-down-test) ) 0 @@ -47,7 +47,7 @@ :event target-standard-event-handler :enter (behavior () (set! (-> self control mod-surface) *walk-mods*) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -149,7 +149,7 @@ (if (and (using-gun? self) (-> self next-state) (= (-> self next-state name) 'target-walk)) (go target-gun-walk) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *walk-mods*) (none) ) @@ -222,7 +222,7 @@ ) (go target-running-attack) ) - (when (and (turn-around?) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.3))) + (when (and (turn-around?) (>= (- (current-time) (-> self state-time)) (seconds 0.3))) (set! (-> self control transv quad) (-> self control transv-history (-> self control idx-of-fastest-xz-vel) quad) ) @@ -291,7 +291,7 @@ (go target-running-attack) ) (if (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.08)) + (>= (- (current-time) (-> self control last-time-on-surface)) (seconds 0.08)) ) (go target-falling #f) ) @@ -328,7 +328,7 @@ (none) ) :exit (behavior () - (set! (-> self control unknown-time-frame13) (-> self clock frame-counter)) + (set! (-> self control unknown-time-frame13) (current-time)) (none) ) :trans (behavior () @@ -447,7 +447,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *slide-down-mods*) (set! (-> self control sliding-start-time) 0) (set! (-> self control force-turn-to-strength) 1.0) @@ -457,7 +457,7 @@ :exit (behavior () (target-effect-exit) (target-exit) - (set! (-> self control unknown-time-frame13) (-> self clock frame-counter)) + (set! (-> self control unknown-time-frame13) (current-time)) (none) ) :trans (behavior () @@ -477,7 +477,7 @@ ) (zero? (-> self control sliding-start-time)) ) - (set! (-> self control sliding-start-time) (-> self clock frame-counter)) + (set! (-> self control sliding-start-time) (current-time)) ) (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) @@ -487,7 +487,7 @@ (pad-buttons x) ) (can-jump? #f) - (!= (-> self state-time) (-> self clock frame-counter)) + (!= (-> self state-time) (current-time)) ) (forward-up-nopitch->quaternion (-> self control dir-targ) @@ -505,7 +505,7 @@ (pad-buttons circle) ) (can-feet? #t) - (!= (-> self state-time) (-> self clock frame-counter)) + (!= (-> self state-time) (current-time)) ) (go target-attack) ) @@ -517,8 +517,8 @@ (pad-buttons square) ) (can-hands? #t) - (>= (- (-> self clock frame-counter) (-> self control last-running-attack-end-time)) (seconds 0.7)) - (!= (-> self state-time) (-> self clock frame-counter)) + (>= (- (current-time) (-> self control last-running-attack-end-time)) (seconds 0.7)) + (!= (-> self state-time) (current-time)) ) (go target-running-attack) ) @@ -566,7 +566,7 @@ (seek! (-> self control force-turn-to-strength) 0.0 (* 4.0 (-> self clock seconds-per-frame))) ) ) - (set! (-> self control turn-lockout-end-time) (+ (-> self clock frame-counter) (seconds 0.1))) + (set! (-> self control turn-lockout-end-time) (+ (current-time) (seconds 0.1))) (target-post) (none) ) @@ -580,7 +580,7 @@ (set! arg1 (* arg1 (-> self darkjak-giant-interp))) ) (logclear! (-> self control status) (collide-status touch-ceiling-sticky)) - (set! (-> self control unknown-time-frame19) (-> self clock frame-counter)) + (set! (-> self control unknown-time-frame19) (current-time)) (delete-back-vel) (let* ((f0-4 arg5) (f1-2 0.0) @@ -592,7 +592,7 @@ (s3-1 (+ arg0 f0-5)) ) (let ((s2-1 (+ arg1 f0-5))) - (when (< (- (-> self clock frame-counter) (-> self control rider-time)) (seconds 0.05)) + (when (< (- (current-time) (-> self control rider-time)) (seconds 0.05)) (let ((f0-8 (fmax 0.0 @@ -653,7 +653,7 @@ ;; INFO: Used lq/sq (defbehavior mod-var-jump target ((arg0 symbol) (arg1 symbol) (arg2 symbol) (arg3 vector)) (local-vars (v0-1 vector)) - (let ((f0-1 (* 0.033333335 (the float (- (-> self clock frame-counter) (-> self state-time)))))) + (let ((f0-1 (* 0.033333335 (the float (- (current-time) (-> self state-time)))))) (cond ((or (< 1.0 f0-1) (< (-> self control unknown-float36) 0.0) (not arg2)) (set! (-> self control unknown-float36) -1.0) @@ -784,7 +784,7 @@ :event target-standard-event-handler :enter (behavior ((arg0 symbol)) (if (not arg0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (set! (-> self control bend-target) 1.0) (set! (-> self control mod-surface) *duck-mods*) @@ -873,7 +873,7 @@ (set! (-> self neck base-joint) (the-as uint 8)) (cond ((using-gun? self) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.7))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.7))) (push-anim-to-targ (-> self skel top-anim) (the-as art-joint-anim (-> self draw art-group data 283)) @@ -955,7 +955,7 @@ :event target-standard-event-handler :enter (behavior ((arg0 symbol)) (if (not arg0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (set! (-> self control bend-target) 1.0) (target-collide-set! 'duck 1.0) @@ -1109,7 +1109,7 @@ (go target-launch (the-as float a0-7) (the-as symbol a1-3) a2-3 (-> self control unknown-dword10)) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "jump" :vol 70) (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) @@ -1167,7 +1167,7 @@ (* 26624.0 (-> self darkjak-giant-interp) (-> self darkjak-giant-interp)) ) (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - (and (>= (- (-> self clock frame-counter) (-> self control last-time-of-stuck)) + (and (>= (- (current-time) (-> self control last-time-of-stuck)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) (not (logtest? (-> self state-flags) (state-flags prevent-attack))) @@ -1399,7 +1399,7 @@ (go target-launch (the-as float a0-3) (the-as symbol a1-1) a2-0 (-> self control unknown-dword10)) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (if (!= (-> self control mod-surface) *slide-jump-mods*) @@ -1423,7 +1423,7 @@ (if (and (cpad-pressed? (-> self control cpad number) square) (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 22118.4) (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - (and (>= (- (-> self clock frame-counter) (-> self control last-time-of-stuck)) + (and (>= (- (current-time) (-> self control last-time-of-stuck)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) (not (logtest? (-> self state-flags) (state-flags prevent-attack))) @@ -1442,7 +1442,7 @@ ) ) ) - (if (!= (-> self state-time) (-> self clock frame-counter)) + (if (!= (-> self state-time) (current-time)) (mod-var-jump #t #t (cpad-hold? (-> self control cpad number) x) (-> self control transv)) ) (seek! @@ -1540,7 +1540,7 @@ (if (or (= arg2 'duck) (= arg2 'launch)) (go target-duck-high-jump arg0 arg1 (the-as symbol arg2)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (sound-play "jump" :pitch 0.3) (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) @@ -1583,7 +1583,7 @@ ) (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 73728.0) (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - (and (>= (- (-> self clock frame-counter) (-> self control last-time-of-stuck)) + (and (>= (- (current-time) (-> self control last-time-of-stuck)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) (not (logtest? (-> self state-flags) (state-flags prevent-attack))) @@ -1618,7 +1618,7 @@ (defstate target-duck-high-jump (target) :event target-standard-event-handler :enter (behavior ((arg0 float) (arg1 float) (arg2 symbol)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control mod-surface) *turn-around-mods*) (case arg2 @@ -1671,7 +1671,7 @@ :event target-jump-event-handler :enter (behavior ((arg0 float) (arg1 float) (arg2 symbol)) (set! (-> self control unknown-symbol03) (the-as float arg2)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "jump" :vol 80 :pitch -0.4) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) @@ -1827,7 +1827,7 @@ ) ) (set! (-> self control unknown-word04) (the-as uint arg0)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -2075,18 +2075,17 @@ ;; failed to figure out what this is: (let ((v1-25 (copy *attack-mods* 'global))) (set! (-> v1-25 flags) (surface-flag attack spin gun-turn-fast)) - (set! (-> v1-25 mult-hook) (lambda :behavior target - ((arg0 surface) (arg1 surface) (arg2 surface) (arg3 int)) - ((-> *attack-mods* mult-hook) arg0 arg1 arg2 arg3) - (when (= arg3 1) - (if (and (nonzero? (-> self gun turn-fast-hold-time)) - (< (-> self clock frame-counter) (-> self gun turn-fast-hold-time)) - ) - (set-quaternion! (-> self control) (-> self control dir-targ)) - ) - ) - (none) - ) + (set! (-> v1-25 mult-hook) + (lambda :behavior target + ((arg0 surface) (arg1 surface) (arg2 surface) (arg3 int)) + ((-> *attack-mods* mult-hook) arg0 arg1 arg2 arg3) + (when (= arg3 1) + (if (and (nonzero? (-> self gun turn-fast-hold-time)) (< (current-time) (-> self gun turn-fast-hold-time))) + (set-quaternion! (-> self control) (-> self control dir-targ)) + ) + ) + (none) + ) ) (set! *attack-end-mods* v1-25) ) @@ -2110,7 +2109,7 @@ (the-as int (-> self control attack-count)) (-> self control penetrate-using) ) - (set! (-> self gun combo-window-start) (-> self clock frame-counter)) + (set! (-> self gun combo-window-start) (current-time)) (let ((v0-2 (the-as object (-> self state name)))) (set! (-> self gun combo-window-state) (the-as symbol v0-2)) v0-2 @@ -2143,7 +2142,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (target-start-attack) (target-danger-set! 'spin #f) (set! (-> self control mod-surface) *attack-mods*) @@ -2167,7 +2166,7 @@ (if (zero? (-> self gun track-target-hold-time)) (quaternion-copy! (-> self control dir-targ) (-> self control unknown-quaternion04)) ) - (set! (-> self control last-attack-end-time) (-> self clock frame-counter)) + (set! (-> self control last-attack-end-time) (current-time)) (target-exit) (none) ) @@ -2371,8 +2370,8 @@ ) ) (when gp-1 - (set! (-> self control sliding-start-time) (-> self clock frame-counter)) - (set! (-> self gun combo-window-start) (-> self clock frame-counter)) + (set! (-> self control sliding-start-time) (current-time)) + (set! (-> self gun combo-window-start) (current-time)) (set! (-> self gun combo-window-state) (-> self state name)) (let ((v1-13 (if (type? proc process-focusable) proc @@ -2397,7 +2396,7 @@ ) (cond ((or (= gp-1 'die) (= gp-1 'push)) - (let ((v0-2 (the-as object (-> self clock frame-counter)))) + (let ((v0-2 (the-as object (current-time)))) (set! (-> self control unknown-time-frame18) (the-as time-frame v0-2)) v0-2 ) @@ -2439,13 +2438,13 @@ ) (logclear! (-> *cpad-list* cpads (-> self control cpad number) button0-abs 0) (pad-buttons square)) (logclear! (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) (pad-buttons square)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (combo-tracker-method-12 (-> self control unknown-combo-tracker00) *null-vector* *null-vector* (the-as process #f) - (-> self clock frame-counter) + (current-time) ) (set! (-> self control sliding-start-time) 0) (set! (-> self control unknown-time-frame18) 0) @@ -2475,19 +2474,19 @@ (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) (set! (-> *run-attack-mods* turnv) 0.0) (set! (-> *run-attack-mods* turnvv) 0.0) - (set! (-> self control last-running-attack-end-time) (-> self clock frame-counter)) + (set! (-> self control last-running-attack-end-time) (current-time)) (target-exit) (none) ) :trans (behavior () - (when (!= (-> self state-time) (-> self clock frame-counter)) + (when (!= (-> self state-time) (current-time)) (when (and (or (smack-surface? #t) (and (>= (-> self control surface-slope-z) 0.7) (not (logtest? (-> self control status) (collide-status touch-actor))) ) ) (begin - (set! (-> self control unknown-time-frame18) (-> self clock frame-counter)) + (set! (-> self control unknown-time-frame18) (current-time)) (set! (-> self control bend-target) 0.0) (let ((v1-11 (new-stack-vector0)) (f0-3 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) @@ -2508,14 +2507,14 @@ #t ) (or (zero? (-> self control sliding-start-time)) - (>= (- (-> self clock frame-counter) (-> self control sliding-start-time)) (seconds 0.04)) + (>= (- (current-time) (-> self control sliding-start-time)) (seconds 0.04)) ) (!= (-> self control unknown-word04) 1) ) ) (if (and (cpad-pressed? (-> self control cpad number) x) (< 4096.0 (-> self control ctrl-xz-vel)) - (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (or (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (not (logtest? (-> *cpad-list* cpads (-> self control cpad number) button0-abs 0) (pad-buttons square))) ) (not (logtest? (-> self state-flags) (state-flags prevent-jump prevent-attack))) @@ -2535,7 +2534,7 @@ ) ) (if (and (logtest? (water-flags touch-water) (-> self water flags)) - (zero? (mod (- (-> self clock frame-counter) (-> self state-time)) 21)) + (zero? (mod (- (current-time) (-> self state-time)) 21)) ) (spawn-ripples (-> self water) @@ -2624,13 +2623,13 @@ (cond ((and (>= (ja-aframe-num 0) 20.0) (and (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> 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)) ) - (>= (- (-> self clock frame-counter) (-> self control sliding-start-time)) (seconds 0.04)) + (>= (- (current-time) (-> self control sliding-start-time)) (seconds 0.04)) ) ) (go target-falling #f) @@ -2640,14 +2639,12 @@ (set-forward-vel (the-as float f26-0)) ) ((and (nonzero? (-> self control unknown-time-frame18)) - (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame18)) (seconds 0.04)) + (>= (- (current-time) (-> self control unknown-time-frame18)) (seconds 0.04)) ) (set-forward-vel 0.0) ) ((and (not (cpad-hold? (-> self control cpad number) square)) - (>= (- (-> self clock frame-counter) (-> self control unknown-combo-tracker00 move-start-time)) - (seconds 0.05) - ) + (>= (- (current-time) (-> self control unknown-combo-tracker00 move-start-time)) (seconds 0.05)) ) (if (= (-> self control ground-pat material) (pat-material ice)) (set-forward-vel (fmax 32768.0 (* 0.8 (-> self control ctrl-xz-vel)))) @@ -2767,7 +2764,7 @@ ) (suspend) (ja :num! (seek! max (* (-> self control current-surface align-speed) f28-0))) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (set! (-> *run-attack-mods* turnvv) 0.0) ) (if (< 2 gp-2) @@ -2777,7 +2774,7 @@ ) ) (if (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> 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))) @@ -2788,7 +2785,7 @@ (when (and (using-gun? self) (or (< (-> self control pad-magnitude) 0.7) (= (-> self gun gun-type) (pickup-type eco-blue))) ) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.5))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.5))) (when (zero? (-> self gun track-target-hold-time)) (case (-> self gun gun-type) (((pickup-type eco-blue)) @@ -2891,7 +2888,7 @@ ) ) :enter (behavior ((arg0 symbol)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (target-start-attack) (target-danger-set! 'spin-air #f) @@ -2968,7 +2965,7 @@ :exit (behavior () (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) - (set! (-> self control last-attack-end-time) (-> self clock frame-counter)) + (set! (-> self control last-attack-end-time) (current-time)) (target-exit) (none) ) @@ -2977,14 +2974,14 @@ (set-quaternion! (-> self control) (-> self control dir-targ)) (go target-hit-ground #f) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (seek! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length) (* 245760.0 (-> self clock seconds-per-frame)) ) ) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (when (and (>= (- (current-time) (-> self state-time)) (seconds 0.05)) (< (vector-dot (-> self control dynam gravity-normal) (-> self control last-transv)) (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) ) @@ -3075,12 +3072,12 @@ (defstate target-attack-uppercut (target) :event target-dangerous-event-handler :enter (behavior ((arg0 float) (arg1 float)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (target-start-attack) (target-danger-set! 'uppercut #f) (set! (-> self control mod-surface) *uppercut-mods*) (set! (-> self neck flex-blend) 0.0) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.15))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.15))) (if (using-gun? self) (target-top-anim-base-mode 37) ) @@ -3221,7 +3218,7 @@ ) ) ) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.5))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.5))) (go target-falling 'uppercut) ) #t @@ -3235,14 +3232,14 @@ (if (and (= (-> self control ground-pat material) (pat-material ice)) (< 32768.0 (-> self control ctrl-xz-vel))) (set-forward-vel 32768.0) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self neck flex-blend) 0.0) (set! (-> self control mod-surface) *uppercut-jump-mods*) (target-start-attack) (target-danger-set! 'uppercut #f) - (set! (-> self gun combo-window-start) (-> self clock frame-counter)) + (set! (-> self gun combo-window-start) (current-time)) (set! (-> self gun combo-window-state) (-> self state name)) (set! (-> self gun track-target-hold-time) 0) 0 @@ -3256,7 +3253,7 @@ (when (and (cpad-pressed? (-> self control cpad number) square) (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 22118.4) (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - (and (>= (- (-> self clock frame-counter) (-> self control last-time-of-stuck)) + (and (>= (- (current-time) (-> self control last-time-of-stuck)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) (not (logtest? (-> self state-flags) (state-flags prevent-attack))) @@ -3324,7 +3321,7 @@ (-> self align) (the-as align-opts (cond ((>= 30.0 (ja-aframe-num 0)) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.1))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.1))) (if (nonzero? (-> self gun track-target-hold-time)) 2 18 @@ -3347,7 +3344,7 @@ (-> self align) (the-as align-opts (cond ((>= 35.0 (ja-aframe-num 0)) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.1))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.1))) (if (nonzero? (-> self gun track-target-hold-time)) 2 18 @@ -3369,7 +3366,7 @@ ) ) ) - (set! (-> self gun surpress-time) (-> self clock frame-counter)) + (set! (-> self gun surpress-time) (current-time)) (go target-falling #f) (none) ) @@ -3422,7 +3419,7 @@ (set-forward-vel arg2) (set-forward-vel (-> self control ctrl-xz-vel)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control mod-surface) *flop-mods*) (set! (-> self neck flex-blend) 0.0) @@ -3478,7 +3475,7 @@ (not (logtest? (-> self control status) (collide-status touch-actor))) (>= (-> self control unknown-word04) (the-as uint 2)) ) - (set! (-> self control last-time-of-stuck) (-> self clock frame-counter)) + (set! (-> self control last-time-of-stuck) (current-time)) (set! gp-1 'stuck) ) ) @@ -3641,9 +3638,7 @@ ) ) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) - (the-as time-frame (-> *TARGET-bank* fall-timeout)) - ) + (if (and (>= (- (current-time) (-> self state-time)) (the-as time-frame (-> *TARGET-bank* fall-timeout))) (!= (-> self tobot?) 'tobot) ) (go target-falling #f) @@ -3696,7 +3691,7 @@ ) (target-land-effect) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.1)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control unknown-word04) (the-as uint arg0)) (set-forward-vel 0.0) (set! (-> self control mod-surface) *flop-land-mods*) @@ -3713,9 +3708,7 @@ ) :exit target-exit :trans (behavior () - (when (and (!= (-> self control unknown-spool-anim00) 'stuck) - (!= (-> self state-time) (-> self clock frame-counter)) - ) + (when (and (!= (-> self control unknown-spool-anim00) 'stuck) (!= (-> self state-time) (current-time))) (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) ) @@ -3731,7 +3724,7 @@ (when (and (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) - (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.25)) + (< (- (current-time) (-> self state-time)) (seconds 0.25)) ) (do-effect (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) (if (rand-vu-percent? 0.5) 22 @@ -3784,7 +3777,7 @@ ) :enter (behavior () (target-collide-set! 'duck 1.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self neck flex-blend) 0.0) (set! (-> self neck base-joint) (the-as uint 8)) (set! (-> self control mod-surface) *roll-mods*) @@ -3805,7 +3798,7 @@ :exit (behavior () (when (not (and (-> self next-state) (= (-> self next-state name) 'target-roll))) (set! (-> self control unknown-word02) 0) - (set! (-> self control last-roll-end-time) (-> self clock frame-counter)) + (set! (-> self control last-roll-end-time) (current-time)) ) (target-exit) (target-collide-set! 'normal 0.0) @@ -3840,18 +3833,16 @@ ) (until (ja-done? 0) (if (cpad-pressed? (-> self control cpad number) x) - (set! gp-0 (the-as int (-> self clock frame-counter))) + (set! gp-0 (the-as int (current-time))) ) - (when (and (not s4-0) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2))) + (when (and (not s4-0) (>= (- (current-time) (-> self state-time)) (seconds 0.2))) (set! s4-0 #t) - (set! (-> self gun combo-window-start) (-> self clock frame-counter)) + (set! (-> self gun combo-window-start) (current-time)) (set! (-> self gun combo-window-state) (-> self state name)) ) (when (and (or (smack-surface? #f) (>= (-> self control surface-slope-z) 0.7)) - (>= (the-as uint (- (-> self clock frame-counter) (the-as int (-> self control unknown-word04)))) - (the-as uint 3) - ) - (>= (- (-> self clock frame-counter) (-> self state-time)) 1) + (>= (the-as uint (- (current-time) (the-as int (-> self control unknown-word04)))) (the-as uint 3)) + (>= (- (current-time) (-> self state-time)) 1) ) (when (>= 6.0 (ja-aframe-num 0)) (if (using-gun? self) @@ -3865,11 +3856,11 @@ ) ) (if (zero? s5-0) - (set! s5-0 (the-as int (-> self clock frame-counter))) + (set! s5-0 (the-as int (current-time))) ) ) (if (cpad-pressed? (-> self control cpad number) square) - (-> self clock frame-counter) + (current-time) ) (compute-alignment! (-> self align)) (cond @@ -3889,9 +3880,7 @@ (set! f30-0 (* f30-0 (fmin 1.0 (-> self control zx-vel-frac)))) ) ) - (if (and (or (< (- (-> self clock frame-counter) (the-as time-frame gp-0)) - (the-as time-frame (-> *TARGET-bank* roll-jump-pre-window)) - ) + (if (and (or (< (- (current-time) (the-as time-frame gp-0)) (the-as time-frame (-> *TARGET-bank* roll-jump-pre-window))) (cpad-pressed? (-> self control cpad number) x) ) (can-jump? 'target-roll-flip) @@ -3899,14 +3888,12 @@ (go target-roll-flip (-> *TARGET-bank* roll-flip-height) (-> *TARGET-bank* roll-flip-dist)) ) ) - (set! (-> self state-hook-time) (-> self clock frame-counter)) + (set! (-> self state-hook-time) (current-time)) (set! (-> self state-hook) (lambda :behavior target () (cond - ((>= (- (-> self clock frame-counter) (-> self state-hook-time)) - (the-as time-frame (-> *TARGET-bank* roll-jump-post-window)) - ) + ((>= (- (current-time) (-> self state-hook-time)) (the-as time-frame (-> *TARGET-bank* roll-jump-post-window))) (set! (-> self state-hook) (the-as (function none :behavior target) nothing)) ) (else @@ -3926,7 +3913,7 @@ (none) ) ) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.2))) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.2))) (go target-duck-stance 'roll) (none) ) @@ -3959,7 +3946,7 @@ (set! (-> self neck flex-blend) 0.0) (set! (-> self neck base-joint) (the-as uint 8)) (set! (-> self gun track-target-hold-time) 0) - (set! (-> self gun combo-window-start) (-> self clock frame-counter)) + (set! (-> self gun combo-window-start) (current-time)) (set! (-> self gun combo-window-state) (-> self state name)) (target-collide-set! 'duck 1.0) (none) @@ -3973,7 +3960,7 @@ (if (and (or (smack-surface? #f) (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) ) - (and (!= (-> self state-time) (-> self clock frame-counter)) (not (using-gun? self))) + (and (!= (-> self state-time) (current-time)) (not (using-gun? self))) ) (target-shoved (-> *TARGET-bank* smack-surface-dist) @@ -4045,9 +4032,9 @@ ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (while (not (logtest? (-> self control status) (collide-status on-surface))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.01)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.01)) (let ((v1-50 (ja-group))) (when (not (and v1-50 (= v1-50 (-> self draw art-group data 27)))) (ja-channel-push! 1 (seconds 0.1)) @@ -4080,13 +4067,13 @@ ) ) (target-land-effect) - (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.1))) - (set! (-> self state-hook-time) (-> self clock frame-counter)) + (set! (-> self gun surpress-time) (+ (current-time) (seconds 0.1))) + (set! (-> self state-hook-time) (current-time)) (set! (-> self state-hook) (lambda :behavior target () (cond - ((>= (- (-> self clock frame-counter) (-> self state-hook-time)) (seconds 0.1)) + ((>= (- (current-time) (-> self state-hook-time)) (seconds 0.1)) (set! (-> self state-hook) (the-as (function none :behavior target) nothing)) ) (else diff --git a/test/decompiler/reference/jak2/engine/ui/credits_REF.gc b/test/decompiler/reference/jak2/engine/ui/credits_REF.gc index 1866b52054..c21b3bab2c 100644 --- a/test/decompiler/reference/jak2/engine/ui/credits_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/credits_REF.gc @@ -97,9 +97,9 @@ ) ) ) - (let ((gp-1 (-> self clock frame-counter))) + (let ((gp-1 (current-time))) (while (let ((a0-9 (level-get *level* 'outrocst))) - (and a0-9 (not (draw-end-credits a0-9 (* 0.15 (the float (- (-> self clock frame-counter) gp-1)))))) + (and a0-9 (not (draw-end-credits a0-9 (* 0.15 (the float (- (current-time) gp-1)))))) ) (suspend) ) diff --git a/test/decompiler/reference/jak2/engine/ui/minimap_REF.gc b/test/decompiler/reference/jak2/engine/ui/minimap_REF.gc index 16cef87826..9a861d253b 100644 --- a/test/decompiler/reference/jak2/engine/ui/minimap_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/minimap_REF.gc @@ -863,52 +863,50 @@ ;; definition for method 9 of type minimap ;; WARN: Return type mismatch int vs none. (defmethod debug-draw minimap ((obj minimap)) - (with-pp - (when *trail-graph* - (dotimes (s5-0 6) - (let ((s4-0 (-> obj trail s5-0))) - (when (and (-> s4-0 used-by) - (>= (-> s4-0 node-count) 0) - (< (- (-> pp clock frame-counter) (the-as int (-> s4-0 last-updated))) (seconds 5)) - ) - (let* ((a3-0 (target-pos 0)) - (v1-12 s5-0) - (t1-0 (cond - ((zero? v1-12) - *color-green* - ) - ((= v1-12 1) - *color-blue* - ) - ((= v1-12 2) - *color-white* - ) - ((= v1-12 3) - *color-red* - ) - (else - *color-magenta* - ) + (when *trail-graph* + (dotimes (s5-0 6) + (let ((s4-0 (-> obj trail s5-0))) + (when (and (-> s4-0 used-by) + (>= (-> s4-0 node-count) 0) + (< (- (current-time) (the-as int (-> s4-0 last-updated))) (seconds 5)) + ) + (let* ((a3-0 (target-pos 0)) + (v1-12 s5-0) + (t1-0 (cond + ((zero? v1-12) + *color-green* + ) + ((= v1-12 1) + *color-blue* + ) + ((= v1-12 2) + *color-white* + ) + ((= v1-12 3) + *color-red* + ) + (else + *color-magenta* ) ) - ) - (debug-draw-path - *trail-graph* - (-> s4-0 node-count) - (-> s4-0 node-id) - a3-0 - (-> s4-0 cached-info orig-goal-pos) - t1-0 - (* 1024.0 (the float s5-0)) - ) + ) + ) + (debug-draw-path + *trail-graph* + (-> s4-0 node-count) + (-> s4-0 node-id) + a3-0 + (-> s4-0 cached-info orig-goal-pos) + t1-0 + (* 1024.0 (the float s5-0)) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 14 of type minimap @@ -916,114 +914,112 @@ ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count] (defmethod update-trails minimap ((obj minimap)) "Main function to do trail search per-frame" - (with-pp - (let ((s5-0 *trail-graph*)) - (when s5-0 - (.mtc0 Count 0) - (let ((v1-1 0)) - (while (< (the-as uint v1-1) (the-as uint #x605a)) - (let ((v1-2 (-> s5-0 mode))) - (cond - ((= v1-2 1) - (run-until-done-or-timeout s5-0 #x605a) - ) - ((zero? v1-2) - (let ((v1-5 -1)) - (let ((a0-5 0)) - (countdown (a1-1 6) - (let* ((a2-3 (-> obj trail a1-1)) - (a3-0 (-> a2-3 used-by)) - ) - (when (and a3-0 (and (< 0.0 (-> a3-0 alpha)) (or (< v1-5 0) (< (the-as int (-> a2-3 last-updated)) a0-5)))) - (set! v1-5 a1-1) - (set! a0-5 (the-as int (-> a2-3 last-updated))) - ) - ) - ) - (let ((a1-5 (-> pp clock frame-counter))) - (if (or (< v1-5 0) (= a0-5 a1-5)) - (goto cfg-68) - ) - ) - ) - (let ((s4-0 (-> obj trail v1-5)) - (s3-0 (the-as object #f)) - ) - (let* ((v1-9 (-> s4-0 used-by)) - (s2-0 (-> v1-9 position)) + (let ((s5-0 *trail-graph*)) + (when s5-0 + (.mtc0 Count 0) + (let ((v1-1 0)) + (while (< (the-as uint v1-1) (the-as uint #x605a)) + (let ((v1-2 (-> s5-0 mode))) + (cond + ((= v1-2 1) + (run-until-done-or-timeout s5-0 #x605a) + ) + ((zero? v1-2) + (let ((v1-5 -1)) + (let ((a0-5 0)) + (countdown (a1-1 6) + (let* ((a2-3 (-> obj trail a1-1)) + (a3-0 (-> a2-3 used-by)) ) - (set! s3-0 (cond - ((= s2-0 #t) - (let* ((s2-1 (handle->process (-> v1-9 handle))) - (v1-13 (if (type? s2-1 process-drawable) - s2-1 - ) - ) - ) - (if v1-13 - (set! s3-0 (-> (the-as process-drawable v1-13) root trans)) - ) - ) - s3-0 + (when (and a3-0 (and (< 0.0 (-> a3-0 alpha)) (or (< v1-5 0) (< (the-as int (-> a2-3 last-updated)) a0-5)))) + (set! v1-5 a1-1) + (set! a0-5 (the-as int (-> a2-3 last-updated))) + ) + ) + ) + (let ((a1-5 (current-time))) + (if (or (< v1-5 0) (= a0-5 a1-5)) + (goto cfg-68) + ) + ) + ) + (let ((s4-0 (-> obj trail v1-5)) + (s3-0 (the-as object #f)) + ) + (let* ((v1-9 (-> s4-0 used-by)) + (s2-0 (-> v1-9 position)) + ) + (set! s3-0 (cond + ((= s2-0 #t) + (let* ((s2-1 (handle->process (-> v1-9 handle))) + (v1-13 (if (type? s2-1 process-drawable) + s2-1 + ) + ) + ) + (if v1-13 + (set! s3-0 (-> (the-as process-drawable v1-13) root trans)) + ) ) - ((and (= (logand (the-as int s2-0) 7) 4) (= (-> (the-as basic s2-0) type) entity-actor)) - (let* ((v1-19 s2-0) - (s3-1 (if v1-19 - (-> (the-as entity-actor v1-19) extra process) - ) - ) - (v1-21 (if (type? s3-1 process-drawable) - s3-1 - ) - ) - ) - (if v1-21 - (set! s3-0 (-> (the-as process-drawable v1-21) root trans)) - (set! s3-0 (-> (the-as entity-actor s2-0) extra trans)) - ) - ) - s3-0 + s3-0 + ) + ((and (= (logand (the-as int s2-0) 7) 4) (= (-> (the-as basic s2-0) type) entity-actor)) + (let* ((v1-19 s2-0) + (s3-1 (if v1-19 + (-> (the-as entity-actor v1-19) extra process) + ) + ) + (v1-21 (if (type? s3-1 process-drawable) + s3-1 + ) + ) + ) + (if v1-21 + (set! s3-0 (-> (the-as process-drawable v1-21) root trans)) + (set! s3-0 (-> (the-as entity-actor s2-0) extra trans)) + ) ) - (else - s2-0 - ) + s3-0 + ) + (else + s2-0 ) - ) - ) - (when s3-0 - (do-search! s5-0 (target-pos 0) (the-as vector s3-0) (-> s4-0 cached-info)) - (set! (-> s4-0 search-id) (-> s5-0 search-id)) - ) + ) + ) + ) + (when s3-0 + (do-search! s5-0 (target-pos 0) (the-as vector s3-0) (-> s4-0 cached-info)) + (set! (-> s4-0 search-id) (-> s5-0 search-id)) ) ) ) - ((or (= v1-2 3) (= v1-2 2)) - (countdown (v1-33 6) - (let ((s4-1 (-> obj trail v1-33))) - (when (and (= (-> s4-1 search-id) (-> s5-0 search-id)) (-> s4-1 used-by)) - (set! (-> s4-1 node-count) - (get-path-to-root s5-0 (-> s4-1 node-id) 64 (&-> s4-1 goal-node-id) (&-> s4-1 node-path-dist)) - ) - (set! (-> s4-1 last-updated) (the-as uint (-> pp clock frame-counter))) - (goto cfg-64) - ) + ) + ((or (= v1-2 3) (= v1-2 2)) + (countdown (v1-33 6) + (let ((s4-1 (-> obj trail v1-33))) + (when (and (= (-> s4-1 search-id) (-> s5-0 search-id)) (-> s4-1 used-by)) + (set! (-> s4-1 node-count) + (get-path-to-root s5-0 (-> s4-1 node-id) 64 (&-> s4-1 goal-node-id) (&-> s4-1 node-path-dist)) + ) + (set! (-> s4-1 last-updated) (the-as uint (current-time))) + (goto cfg-64) ) ) - (label cfg-64) - (reset-search-state s5-0) ) - ) + (label cfg-64) + (reset-search-state s5-0) + ) ) - (.mfc0 v1-1 Count) ) + (.mfc0 v1-1 Count) ) - (label cfg-68) - 0 ) + (label cfg-68) + 0 ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 10 of type minimap @@ -1167,7 +1163,6 @@ ) ;; definition for method 3 of type engine-minimap -;; INFO: this function exists in multiple non-identical object files (defmethod inspect engine-minimap ((obj engine-minimap)) ((the-as (function engine-minimap engine-minimap) (find-parent-method engine-minimap 3)) obj) (let ((s5-0 0) @@ -1209,7 +1204,7 @@ (let ((f30-0 1.0)) (when (logtest? (-> s3-0 class flags) (minimap-flag trail)) (let ((v1-26 (get-trail-for-connection *minimap* s3-0 #f))) - (if (or (not v1-26) (>= (- (-> pp clock frame-counter) (the-as int (-> v1-26 last-updated))) (seconds 5))) + (if (or (not v1-26) (>= (- (current-time) (the-as int (-> v1-26 last-updated))) (seconds 5))) (set! f30-0 0.0001) ) ) @@ -1964,7 +1959,6 @@ ;; definition for method 21 of type minimap ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -;; ERROR: Failed store: (s.w! (+ a0-4 8) 0) at op 35 (defmethod sub-draw-1-1 minimap ((obj minimap) (arg0 minimap-draw-work)) (with-pp (let ((s5-0 (-> arg0 buf))) @@ -2137,7 +2131,6 @@ ;; definition for method 19 of type minimap ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -;; ERROR: Failed store: (s.w! (+ a0-2 8) 0) at op 11 (defmethod sub-draw-1-2 minimap ((obj minimap) (arg0 minimap-draw-work)) (local-vars (a3-4 int) (t0-4 int) (sv-48 vector) (sv-52 matrix) (sv-56 vector)) (let ((s5-0 (-> arg0 buf))) @@ -2412,7 +2405,7 @@ (set! s2-0 #t) (set! (-> arg1 edge-ry) -131072.0) ) - ((>= (- (-> pp clock frame-counter) (the-as int (-> a2-2 last-updated))) (seconds 5)) + ((>= (- (current-time) (the-as int (-> a2-2 last-updated))) (seconds 5)) (set! s2-0 #t) (set! (-> arg1 edge-ry) -131072.0) ) diff --git a/test/decompiler/reference/jak2/engine/ui/progress/progress-draw_REF.gc b/test/decompiler/reference/jak2/engine/ui/progress/progress-draw_REF.gc index df45a00c3c..f066f674e9 100644 --- a/test/decompiler/reference/jak2/engine/ui/progress/progress-draw_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/progress/progress-draw_REF.gc @@ -115,7 +115,7 @@ (let ((a0-5 arg0)) (set! (-> a0-5 flags) (font-flags kerning middle large)) ) - (if (< (mod (-> self clock frame-counter) 300) 210) + (if (< (mod (current-time) 300) 210) (print-game-text (lookup-text! *common-text* (text-id progress-memcard-loading-data) #f) arg0 @@ -2560,60 +2560,58 @@ ;; definition for method 10 of type menu-loading-option ;; WARN: Return type mismatch int vs none. (defmethod draw-option menu-loading-option ((obj menu-loading-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (with-pp - (let ((f30-0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) - (set! (-> arg1 alpha) (- 1.0 (-> arg0 menu-transition))) - (let ((v1-3 arg1)) - (set! (-> v1-3 scale) 0.55) - ) - (let ((s4-0 arg1)) - (set! (-> s4-0 color) (progress-selected 0)) - ) - (let ((a0-3 arg1)) - (set! (-> a0-3 flags) (font-flags kerning middle left large)) - ) - (set! (-> arg1 origin x) 120.0) - (set! (-> arg1 origin y) 110.0) - (let ((v1-8 arg1)) - (set! (-> v1-8 width) (the float 270)) - ) - (let ((v1-9 arg1)) - (set! (-> v1-9 height) (the float 35)) - ) - (if (< f30-0 0.0) - 0.0 - ) + (let ((f30-0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) + (set! (-> arg1 alpha) (- 1.0 (-> arg0 menu-transition))) + (let ((v1-3 arg1)) + (set! (-> v1-3 scale) 0.55) ) - (when (or (< (mod (-> pp clock frame-counter) 300) 150) (!= (-> arg0 menu-transition) 0.0)) - (let ((a1-1 416)) - (case (-> arg0 current) - (('saving) - (set! a1-1 415) - ) - (('formatting) - (set! a1-1 417) - ) - (('creating) - (set! a1-1 418) - ) - ) - (print-game-text (lookup-text! *common-text* (the-as text-id a1-1) #f) arg1 #f 44 (bucket-id progress)) + (let ((s4-0 arg1)) + (set! (-> s4-0 color) (progress-selected 0)) + ) + (let ((a0-3 arg1)) + (set! (-> a0-3 flags) (font-flags kerning middle left large)) + ) + (set! (-> arg1 origin x) 120.0) + (set! (-> arg1 origin y) 110.0) + (let ((v1-8 arg1)) + (set! (-> v1-8 width) (the float 270)) + ) + (let ((v1-9 arg1)) + (set! (-> v1-9 height) (the float 35)) + ) + (if (< f30-0 0.0) + 0.0 ) - ) - (set! (-> arg1 origin y) (+ 45.0 (-> arg1 origin y))) - (let ((v1-25 arg1)) - (set! (-> v1-25 height) (the float 160)) - ) - (let ((a0-16 arg1)) - (set! (-> a0-16 color) (font-color #7efbfb)) - ) - (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* arg1 #f 44 (bucket-id progress)) - ) - 0 - (none) ) + (when (or (< (mod (current-time) 300) 150) (!= (-> arg0 menu-transition) 0.0)) + (let ((a1-1 416)) + (case (-> arg0 current) + (('saving) + (set! a1-1 415) + ) + (('formatting) + (set! a1-1 417) + ) + (('creating) + (set! a1-1 418) + ) + ) + (print-game-text (lookup-text! *common-text* (the-as text-id a1-1) #f) arg1 #f 44 (bucket-id progress)) + ) + ) + (set! (-> arg1 origin y) (+ 45.0 (-> arg1 origin y))) + (let ((v1-25 arg1)) + (set! (-> v1-25 height) (the float 160)) + ) + (let ((a0-16 arg1)) + (set! (-> a0-16 color) (font-color #7efbfb)) + ) + (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* arg1 #f 44 (bucket-id progress)) + ) + 0 + (none) ) ;; definition for method 10 of type menu-insufficient-space-option @@ -7983,7 +7981,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc b/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc index 84149a9557..569c14302d 100644 --- a/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc @@ -1339,13 +1339,13 @@ (let ((gp-4 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *x-vector* - (* 182.04445 (* (-> self swing) (sin (the float (* 40 (-> self clock frame-counter)))))) + (* 182.04445 (* (-> self swing) (sin (the float (* 40 (current-time)))))) ) ) (s5-4 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *y-vector* - (* 182.04445 (* (-> self swing) (sin (the float (* 0 (-> self clock frame-counter)))))) + (* 182.04445 (* (-> self swing) (sin (the float (* 0 (current-time)))))) ) ) ) @@ -2010,8 +2010,8 @@ (set! f30-0 (-> (the-as (pointer float) gp-0))) ) ) - (when (< (seconds 0.03) (- (-> self clock frame-counter) (-> *progress-state* last-slider-sound))) - (set! (-> *progress-state* last-slider-sound) (-> self clock frame-counter)) + (when (< (seconds 0.03) (- (current-time) (-> *progress-state* last-slider-sound))) + (set! (-> *progress-state* last-slider-sound) (current-time)) (sound-play-by-name (static-sound-name "menu-slide") (new-sound-id) @@ -2538,7 +2538,7 @@ ) (else (sound-play "generic-beep") - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (set! (-> arg0 current) 'none) (set-next-state arg0 s3-0 0) ) @@ -2635,7 +2635,7 @@ (cond ((-> *progress-state* yes-no-choice) (set! (-> *setting-control* user-default video-mode) (-> *progress-state* video-mode-choice)) - (set! (-> *progress-state* video-mode-timeout) (-> self clock frame-counter)) + (set! (-> *progress-state* video-mode-timeout) (current-time)) (set-next-state arg0 'video-mode-ok 0) ) (else @@ -2689,7 +2689,7 @@ ) ) (when (and (nonzero? (-> *progress-state* video-mode-timeout)) - (< (seconds 10) (- (-> self clock frame-counter) (-> *progress-state* video-mode-timeout))) + (< (seconds 10) (- (current-time) (-> *progress-state* video-mode-timeout))) ) (set! (-> *progress-state* video-mode-timeout) 0) (set! (-> *progress-state* video-mode-choice) 'pal) @@ -2725,7 +2725,7 @@ (sound-play "generic-beep") (set-progressive-scan #t) (set! (-> *progress-state* graphic-options-progressive-scan) #t) - (set! (-> *progress-state* progressive-mode-timeout) (-> self clock frame-counter)) + (set! (-> *progress-state* progressive-mode-timeout) (current-time)) (set-next-state arg0 'progressive-mode-ok 0) ) (else @@ -2783,7 +2783,7 @@ ) ) (when (and (nonzero? (-> *progress-state* progressive-mode-timeout)) - (< (seconds 10) (- (-> self clock frame-counter) (-> *progress-state* progressive-mode-timeout))) + (< (seconds 10) (- (current-time) (-> *progress-state* progressive-mode-timeout))) ) (set! (-> *progress-state* progressive-mode-timeout) 0) (set! (-> *setting-control* user-default use-progressive-scan) #f) @@ -2998,10 +2998,10 @@ (cond ((or (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (when (> (-> obj task-index) 0) (set! s4-0 #t) (+! (-> obj task-index) -1) @@ -3010,10 +3010,10 @@ ) ((or (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (let ((s3-0 -1)) (dotimes (s2-0 (-> *game-info* play-list length)) (let* ((v1-41 (-> *game-info* play-list s2-0)) @@ -3110,10 +3110,10 @@ (cond ((or (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (when (> (-> obj task-index) 0) (set! gp-0 #t) (+! (-> obj task-index) -1) @@ -3122,10 +3122,10 @@ ) ((or (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (when (< (-> obj task-index) (+ (length s4-0) -1)) (set! gp-0 #t) (+! (-> obj task-index) 1) @@ -3181,10 +3181,10 @@ (cond ((or (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (when (> (-> obj task-line-index) 0) (set! s5-0 #t) (+! (-> obj task-line-index) -1) @@ -3193,10 +3193,10 @@ ) ((or (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (when (< (-> obj task-line-index) (+ (-> *progress-state* total-num-tasks) -1)) (+! (-> obj task-line-index) 1) (set! (-> arg0 sliding-height) 1.0) @@ -3244,11 +3244,11 @@ (cond ((or (logtest? (pad-buttons right l-analog-right) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons right l-analog-right) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) (when (< 1 (get-num-highscores)) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (set! s5-0 #t) (set! (-> obj prev-page-index) (-> obj page-index)) (set! (-> obj page-index) (get-next-highscore (-> obj page-index))) @@ -3259,11 +3259,11 @@ ) ((or (logtest? (pad-buttons left l-analog-left) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons left l-analog-left) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) (when (< 1 (get-num-highscores)) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (set! (-> obj prev-page-index) (-> obj page-index)) (set! (-> obj page-index) (get-prev-highscore (-> obj page-index))) (set! s5-0 #t) @@ -3341,10 +3341,10 @@ (cond ((or (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (when (< (-> obj item-index) s2-0) (set! (-> obj prev-item-index) (-> obj item-index)) (set! s5-2 #t) @@ -3355,10 +3355,10 @@ ) ((or (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> obj last-move))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.2)) ) ) - (set! (-> obj last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> obj last-move) (the-as uint (current-time))) (when (< s3-0 (-> obj item-index)) (set! (-> obj prev-item-index) (-> obj item-index)) (+! (-> obj item-index) -1) @@ -3427,10 +3427,10 @@ (cond ((or (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> *progress-state* game-options-last-move))) (seconds 0.5)) + (>= (- (current-time) (the-as int (-> *progress-state* game-options-last-move))) (seconds 0.5)) ) ) - (set! (-> *progress-state* game-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* game-options-last-move) (the-as uint (current-time))) (cond ((< (-> *progress-state* game-options-item-selected) 3) (+! (-> *progress-state* game-options-item-selected) 1) @@ -3443,10 +3443,10 @@ ) ((or (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> *progress-state* game-options-last-move))) (seconds 0.5)) + (>= (- (current-time) (the-as int (-> *progress-state* game-options-last-move))) (seconds 0.5)) ) ) - (set! (-> *progress-state* game-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* game-options-last-move) (the-as uint (current-time))) (if (> (-> *progress-state* game-options-item-selected) 0) (+! (-> *progress-state* game-options-item-selected) -1) (set! (-> *progress-state* game-options-item-selected) 3) @@ -3455,7 +3455,7 @@ ((logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm)) (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm)) - (set! (-> *progress-state* game-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* game-options-last-move) (the-as uint (current-time))) (set! (-> *progress-state* game-options-item-picked) (the-as basic #t)) (sound-play "generic-beep") ) @@ -3603,57 +3603,55 @@ ;; definition for function update-center-screen (defun update-center-screen () - (with-pp - (let ((v1-0 #f)) - (cond - (#t - (cond - ((logtest? (pad-buttons left l-analog-left) (-> *cpad-list* cpads 0 button0-abs 0)) - (set! (-> *setting-control* user-default display-dx) - (min-max-wrap-around (+ (-> *setting-control* user-default display-dx) -2) -96 96) - ) - (set! v1-0 #t) - ) - ((logtest? (pad-buttons right l-analog-right) (-> *cpad-list* cpads 0 button0-abs 0)) - (set! (-> *setting-control* user-default display-dx) - (min-max-wrap-around (+ (-> *setting-control* user-default display-dx) 2) -96 96) - ) - (set! v1-0 #t) - ) - ((logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (set! (-> *setting-control* user-default display-dy) - (min-max-wrap-around (+ (-> *setting-control* user-default display-dy) -2) -48 48) - ) - (set! v1-0 #f) - ) - ((logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (set! (-> *setting-control* user-default display-dy) - (min-max-wrap-around (+ (-> *setting-control* user-default display-dy) 2) -48 48) - ) - (set! v1-0 #f) - ) - ((cpad-pressed? 0 triangle) - (set! (-> *setting-control* user-default display-dx) (-> *progress-state* center-x-backup)) - (set! (-> *setting-control* user-default display-dy) (-> *progress-state* center-y-backup)) - ) - ) - ) - (else - (when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) - (set! (-> *progress-state* center-x-backup) (-> *setting-control* user-default display-dx)) - (set! (-> *progress-state* center-y-backup) (-> *setting-control* user-default display-dy)) - ) + (let ((v1-0 #f)) + (cond + (#t + (cond + ((logtest? (pad-buttons left l-analog-left) (-> *cpad-list* cpads 0 button0-abs 0)) + (set! (-> *setting-control* user-default display-dx) + (min-max-wrap-around (+ (-> *setting-control* user-default display-dx) -2) -96 96) + ) + (set! v1-0 #t) + ) + ((logtest? (pad-buttons right l-analog-right) (-> *cpad-list* cpads 0 button0-abs 0)) + (set! (-> *setting-control* user-default display-dx) + (min-max-wrap-around (+ (-> *setting-control* user-default display-dx) 2) -96 96) + ) + (set! v1-0 #t) + ) + ((logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) + (set! (-> *setting-control* user-default display-dy) + (min-max-wrap-around (+ (-> *setting-control* user-default display-dy) -2) -48 48) + ) + (set! v1-0 #f) + ) + ((logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) + (set! (-> *setting-control* user-default display-dy) + (min-max-wrap-around (+ (-> *setting-control* user-default display-dy) 2) -48 48) + ) + (set! v1-0 #f) + ) + ((cpad-pressed? 0 triangle) + (set! (-> *setting-control* user-default display-dx) (-> *progress-state* center-x-backup)) + (set! (-> *setting-control* user-default display-dy) (-> *progress-state* center-y-backup)) + ) ) ) - (when v1-0 - (when (< (seconds 0.3) (- (-> pp clock frame-counter) (-> *progress-state* last-slider-sound))) - (set! (-> *progress-state* last-slider-sound) (-> pp clock frame-counter)) - (sound-play "roll-over") + (else + (when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) + (set! (-> *progress-state* center-x-backup) (-> *setting-control* user-default display-dx)) + (set! (-> *progress-state* center-y-backup) (-> *setting-control* user-default display-dy)) ) ) ) - 0 + (when v1-0 + (when (< (seconds 0.3) (- (current-time) (-> *progress-state* last-slider-sound))) + (set! (-> *progress-state* last-slider-sound) (current-time)) + (sound-play "roll-over") + ) + ) ) + 0 ) ;; definition for method 9 of type menu-graphic-option @@ -3667,12 +3665,10 @@ (cond ((or (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> *progress-state* graphic-options-last-move))) - (seconds 0.5) - ) + (>= (- (current-time) (the-as int (-> *progress-state* graphic-options-last-move))) (seconds 0.5)) ) ) - (set! (-> *progress-state* graphic-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* graphic-options-last-move) (the-as uint (current-time))) (set! (-> arg0 selected-option) #f) (cond ((< (-> *progress-state* graphic-options-item-selected) (if (= (scf-get-territory) 1) @@ -3691,12 +3687,10 @@ ) ((or (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> *progress-state* graphic-options-last-move))) - (seconds 0.5) - ) + (>= (- (current-time) (the-as int (-> *progress-state* graphic-options-last-move))) (seconds 0.5)) ) ) - (set! (-> *progress-state* graphic-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* graphic-options-last-move) (the-as uint (current-time))) (set! (-> arg0 selected-option) #f) (cond ((> (-> *progress-state* graphic-options-item-selected) 0) @@ -3716,7 +3710,7 @@ ((logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm)) (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm)) - (set! (-> *progress-state* graphic-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* graphic-options-last-move) (the-as uint (current-time))) (set! (-> *progress-state* graphic-options-item-picked) (the-as basic #t)) (set! (-> arg0 selected-option) #f) (sound-play "generic-beep") @@ -3906,10 +3900,10 @@ (cond ((or (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons down l-analog-up) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> *progress-state* qr-options-last-move))) (seconds 0.5)) + (>= (- (current-time) (the-as int (-> *progress-state* qr-options-last-move))) (seconds 0.5)) ) ) - (set! (-> *progress-state* qr-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* qr-options-last-move) (the-as uint (current-time))) (cond ((< (-> *progress-state* qr-options-item-selected) 1) (+! (-> *progress-state* qr-options-item-selected) 1) @@ -3927,10 +3921,10 @@ ) ((or (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-rel 0)) (and (logtest? (pad-buttons up l-analog-down) (-> *cpad-list* cpads 0 button0-abs 0)) - (>= (- (-> self clock frame-counter) (the-as int (-> *progress-state* qr-options-last-move))) (seconds 0.5)) + (>= (- (current-time) (the-as int (-> *progress-state* qr-options-last-move))) (seconds 0.5)) ) ) - (set! (-> *progress-state* qr-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* qr-options-last-move) (the-as uint (current-time))) (cond ((> (-> *progress-state* qr-options-item-selected) 0) (+! (-> *progress-state* qr-options-item-selected) -1) @@ -3947,7 +3941,7 @@ ((logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm)) (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm)) - (set! (-> *progress-state* qr-options-last-move) (the-as uint (-> self clock frame-counter))) + (set! (-> *progress-state* qr-options-last-move) (the-as uint (current-time))) (set! (-> *progress-state* qr-options-item-picked) (the-as basic #t)) (set! (-> arg0 selected-option) #t) (sound-play "generic-beep") diff --git a/test/decompiler/reference/jak2/engine/util/smush-control-h_REF.gc b/test/decompiler/reference/jak2/engine/util/smush-control-h_REF.gc index cc5c262380..fce7690b82 100644 --- a/test/decompiler/reference/jak2/engine/util/smush-control-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/util/smush-control-h_REF.gc @@ -61,53 +61,49 @@ ;; definition for method 10 of type smush-control (defmethod update! smush-control ((obj smush-control)) - (with-pp - (cond - ((!= (-> obj amp) 0.0) - (let* ((f30-0 (the float (- (-> pp clock frame-counter) (-> obj start-time)))) - (f0-2 (-> obj period)) - (f28-0 (- f30-0 (* (the float (the int (/ f30-0 f0-2))) f0-2))) - ) - (when (>= (- f30-0 (-> obj ticks)) (-> obj period)) - (set! (-> obj amp) (* (-> obj amp) (-> obj damp-amp))) - (set! (-> obj period) (* (-> obj period) (-> obj damp-period))) - (set! (-> obj ticks) f30-0) - (if (< (-> obj damp-period) 0.0) - (set-zero! obj) - ) - ) - (if (>= f30-0 (-> obj duration)) + (cond + ((!= (-> obj amp) 0.0) + (let* ((f30-0 (the float (- (current-time) (-> obj start-time)))) + (f0-2 (-> obj period)) + (f28-0 (- f30-0 (* (the float (the int (/ f30-0 f0-2))) f0-2))) + ) + (when (>= (- f30-0 (-> obj ticks)) (-> obj period)) + (set! (-> obj amp) (* (-> obj amp) (-> obj damp-amp))) + (set! (-> obj period) (* (-> obj period) (-> obj damp-period))) + (set! (-> obj ticks) f30-0) + (if (< (-> obj damp-period) 0.0) (set-zero! obj) ) - (* (sin (/ (* 65536.0 f28-0) (-> obj period))) - (* (-> obj amp) (/ (- (-> obj duration) f30-0) (-> obj duration))) - ) ) + (if (>= f30-0 (-> obj duration)) + (set-zero! obj) + ) + (* (sin (/ (* 65536.0 f28-0) (-> obj period))) + (* (-> obj amp) (/ (- (-> obj duration) f30-0) (-> obj duration))) + ) ) - (else - 0.0 - ) + ) + (else + 0.0 ) ) ) ;; definition for method 11 of type smush-control (defmethod get-no-update smush-control ((obj smush-control)) - (with-pp - (cond - ((!= (-> obj amp) 0.0) - (let* ((f30-0 (the float (- (-> pp clock frame-counter) (-> obj start-time)))) - (f0-2 (-> obj period)) - (f0-4 (- f30-0 (* (the float (the int (/ f30-0 f0-2))) f0-2))) - ) - (* (sin (/ (* 65536.0 f0-4) (-> obj period))) - (* (-> obj amp) (/ (- (-> obj duration) f30-0) (-> obj duration))) + (cond + ((!= (-> obj amp) 0.0) + (let* ((f30-0 (the float (- (current-time) (-> obj start-time)))) + (f0-2 (-> obj period)) + (f0-4 (- f30-0 (* (the float (the int (/ f30-0 f0-2))) f0-2))) ) - ) + (* (sin (/ (* 65536.0 f0-4) (-> obj period))) + (* (-> obj amp) (/ (- (-> obj duration) f30-0) (-> obj duration))) + ) ) - (else - 0.0 - ) + ) + (else + 0.0 ) ) ) diff --git a/test/decompiler/reference/jak2/engine/util/sync-info_REF.gc b/test/decompiler/reference/jak2/engine/util/sync-info_REF.gc index 1a173c070b..80f8fb8d88 100644 --- a/test/decompiler/reference/jak2/engine/util/sync-info_REF.gc +++ b/test/decompiler/reference/jak2/engine/util/sync-info_REF.gc @@ -12,13 +12,11 @@ ;; definition for method 9 of type sync-info (defmethod get-current-phase-no-mod sync-info ((obj sync-info)) "Get the current value, with no fancy modifications." - (with-pp - (let* ((v1-0 (-> obj period)) - (f0-1 (the float v1-0)) - (f1-2 (+ (the float (mod (the-as uint (-> pp clock frame-counter)) v1-0)) (-> obj offset))) - ) - (/ (- f1-2 (* (the float (the int (/ f1-2 f0-1))) f0-1)) f0-1) - ) + (let* ((v1-0 (-> obj period)) + (f0-1 (the float v1-0)) + (f1-2 (+ (the float (mod (the-as uint (current-time)) v1-0)) (-> obj offset))) + ) + (/ (- f1-2 (* (the float (the int (/ f1-2 f0-1))) f0-1)) f0-1) ) ) @@ -32,19 +30,17 @@ ;; WARN: Return type mismatch int vs none. (defmethod sync-now! sync-info ((obj sync-info) (arg0 float)) "Adjust our offset so our current phase is the given phase." - (with-pp - (let* ((a2-0 (-> obj period)) - (f0-1 (the float a2-0)) - (v1-0 (- arg0 (* (the float (the int (/ arg0 f0-1))) f0-1))) - (f1-4 (+ (the float (mod (the-as uint (-> pp clock frame-counter)) a2-0)) (-> obj offset))) - (f1-6 (/ (- f1-4 (* (the float (the int (/ f1-4 f0-1))) f0-1)) f0-1)) - (f1-10 (+ (* (- v1-0 f1-6) f0-1) f0-1 (-> obj offset))) - ) - (set! (-> obj offset) (- f1-10 (* (the float (the int (/ f1-10 f0-1))) f0-1))) - ) - 0 - (none) + (let* ((a2-0 (-> obj period)) + (f0-1 (the float a2-0)) + (v1-0 (- arg0 (* (the float (the int (/ arg0 f0-1))) f0-1))) + (f1-4 (+ (the float (mod (the-as uint (current-time)) a2-0)) (-> obj offset))) + (f1-6 (/ (- f1-4 (* (the float (the int (/ f1-4 f0-1))) f0-1)) f0-1)) + (f1-10 (+ (* (- v1-0 f1-6) f0-1) f0-1 (-> obj offset))) + ) + (set! (-> obj offset) (- f1-10 (* (the float (the int (/ f1-10 f0-1))) f0-1))) ) + 0 + (none) ) ;; definition for method 11 of type sync-info @@ -63,16 +59,14 @@ ;; definition for method 14 of type sync-info (defmethod get-timeframe-offset! sync-info ((obj sync-info) (arg0 time-frame)) "Get the difference between the given time-frame and when this sync-info is at 0." - (with-pp - (if (zero? arg0) - (set! arg0 (-> pp clock frame-counter)) - ) - (let* ((v1-4 (-> obj period)) - (f0-1 (the float v1-4)) - (f1-2 (+ (the float (mod arg0 (the-as time-frame v1-4))) (-> obj offset))) - ) - (+ arg0 (the int (- f0-1 (* (/ (- f1-2 (* (the float (the int (/ f1-2 f0-1))) f0-1)) f0-1) f0-1)))) + (if (zero? arg0) + (set! arg0 (current-time)) ) + (let* ((v1-4 (-> obj period)) + (f0-1 (the float v1-4)) + (f1-2 (+ (the float (mod arg0 (the-as time-frame v1-4))) (-> obj offset))) + ) + (+ arg0 (the int (- f0-1 (* (/ (- f1-2 (* (the float (the int (/ f1-2 f0-1))) f0-1)) f0-1) f0-1)))) ) ) @@ -117,29 +111,27 @@ ;; definition for method 11 of type sync-linear (defmethod get-norm! sync-linear ((obj sync-linear) (arg0 int)) "Get the current value, from 0 to 1." - (with-pp - (if (zero? arg0) - (set! arg0 (the-as int (-> pp clock frame-counter))) - ) - (let* ((v1-4 (-> obj period)) - (f0-1 (the float v1-4)) - ) - (cond - ((logtest? (-> obj sync-flags) (sync-flags pong)) - (let* ((f1-0 2.0) - (f2-2 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) - (f0-3 (* f1-0 (/ (- f2-2 (* (the float (the int (/ f2-2 f0-1))) f0-1)) f0-1))) - ) - (if (>= f0-3 1.0) - (set! f0-3 (- 2.0 f0-3)) - ) - f0-3 - ) + (if (zero? arg0) + (set! arg0 (the-as int (current-time))) + ) + (let* ((v1-4 (-> obj period)) + (f0-1 (the float v1-4)) ) - (else - (let ((f1-5 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset)))) - (/ (- f1-5 (* (the float (the int (/ f1-5 f0-1))) f0-1)) f0-1) - ) + (cond + ((logtest? (-> obj sync-flags) (sync-flags pong)) + (let* ((f1-0 2.0) + (f2-2 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) + (f0-3 (* f1-0 (/ (- f2-2 (* (the float (the int (/ f2-2 f0-1))) f0-1)) f0-1))) + ) + (if (>= f0-3 1.0) + (set! f0-3 (- 2.0 f0-3)) + ) + f0-3 + ) + ) + (else + (let ((f1-5 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset)))) + (/ (- f1-5 (* (the float (the int (/ f1-5 f0-1))) f0-1)) f0-1) ) ) ) @@ -257,67 +249,65 @@ ;; definition for method 11 of type sync-eased (defmethod get-norm! sync-eased ((obj sync-eased) (arg0 int)) "Get the current value, from 0 to 1." - (with-pp - (if (zero? arg0) - (set! arg0 (the-as int (-> pp clock frame-counter))) - ) - (let* ((v1-4 (-> obj period)) - (f3-0 (the float v1-4)) - (f0-1 (-> obj pause-in)) - (f2-0 (-> obj pause-out)) - (f1-1 (* 0.5 (- f3-0 (+ f0-1 f2-0)))) + (if (zero? arg0) + (set! arg0 (the-as int (current-time))) + ) + (let* ((v1-4 (-> obj period)) + (f3-0 (the float v1-4)) + (f0-1 (-> obj pause-in)) + (f2-0 (-> obj pause-out)) + (f1-1 (* 0.5 (- f3-0 (+ f0-1 f2-0)))) + ) + (the int (+ f0-1 f2-0 f3-0)) + (cond + ((logtest? (-> obj sync-flags) (sync-flags pong)) + (let* ((f4-7 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) + (f3-2 (- f4-7 (* (the float (the int (/ f4-7 f3-0))) f3-0))) + (v1-6 #f) + ) + (when (>= f3-2 (+ f1-1 f0-1)) + (set! v1-6 #t) + (set! f3-2 (- f3-2 (+ f1-1 f0-1))) + f0-1 + (set! f0-1 f2-0) ) - (the int (+ f0-1 f2-0 f3-0)) - (cond - ((logtest? (-> obj sync-flags) (sync-flags pong)) - (let* ((f4-7 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) - (f3-2 (- f4-7 (* (the float (the int (/ f4-7 f3-0))) f3-0))) - (v1-6 #f) - ) - (when (>= f3-2 (+ f1-1 f0-1)) - (set! v1-6 #t) - (set! f3-2 (- f3-2 (+ f1-1 f0-1))) - f0-1 - (set! f0-1 f2-0) - ) - (cond - ((< f3-2 f0-1) - (set! f3-2 f0-1) - ) - ((< (+ f0-1 f1-1) f3-2) - (set! f3-2 (+ f0-1 f1-1)) - ) - ) - (let* ((f0-3 (/ (- f3-2 f0-1) f1-1)) - (f1-2 (-> obj tlo)) - (f0-8 (/ (cond - ((< f0-3 f1-2) - (* f0-3 f0-3) - ) - ((< f0-3 (-> obj thi)) - (+ (* 2.0 f1-2 (- f0-3 f1-2)) (-> obj ylo)) - ) - (else - (let ((f1-5 (- 1.0 f0-3))) - (- (-> obj yend) (* f1-5 f1-5 (-> obj m2))) - ) + (cond + ((< f3-2 f0-1) + (set! f3-2 f0-1) + ) + ((< (+ f0-1 f1-1) f3-2) + (set! f3-2 (+ f0-1 f1-1)) + ) + ) + (let* ((f0-3 (/ (- f3-2 f0-1) f1-1)) + (f1-2 (-> obj tlo)) + (f0-8 (/ (cond + ((< f0-3 f1-2) + (* f0-3 f0-3) + ) + ((< f0-3 (-> obj thi)) + (+ (* 2.0 f1-2 (- f0-3 f1-2)) (-> obj ylo)) + ) + (else + (let ((f1-5 (- 1.0 f0-3))) + (- (-> obj yend) (* f1-5 f1-5 (-> obj m2))) ) ) - (-> obj yend) ) - ) - ) - (if v1-6 - (set! f0-8 (- 1.0 f0-8)) - ) - f0-8 - ) + (-> obj yend) + ) + ) + ) + (if v1-6 + (set! f0-8 (- 1.0 f0-8)) + ) + f0-8 ) ) - (else - (format 0 "ERROR: Attempting to use sync-eased in unsupported non-pong mode.~%") - 0.0 - ) + ) + (else + (format 0 "ERROR: Attempting to use sync-eased in unsupported non-pong mode.~%") + 0.0 ) ) ) @@ -396,46 +386,44 @@ ;; definition for method 11 of type sync-paused (defmethod get-norm! sync-paused ((obj sync-paused) (arg0 int)) "Get the current value, from 0 to 1." - (with-pp - (if (zero? arg0) - (set! arg0 (the-as int (-> pp clock frame-counter))) - ) - (let* ((v1-4 (-> obj period)) - (f2-0 (the float v1-4)) - (f0-1 (-> obj pause-in)) - (f1-0 (-> obj pause-out)) + (if (zero? arg0) + (set! arg0 (the-as int (current-time))) + ) + (let* ((v1-4 (-> obj period)) + (f2-0 (the float v1-4)) + (f0-1 (-> obj pause-in)) + (f1-0 (-> obj pause-out)) + ) + (the int (+ f0-1 f1-0 f2-0)) + (cond + ((logtest? (-> obj sync-flags) (sync-flags pong)) + (let* ((f3-5 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) + (f3-6 (- f3-5 (* (the float (the int (/ f3-5 f2-0))) f2-0))) + (f2-2 (* 0.5 (- f2-0 (+ f0-1 f1-0)))) + (v1-7 #f) + ) + (when (>= f3-6 (+ f2-2 f0-1)) + (set! v1-7 #t) + (set! f3-6 (- f3-6 (+ f2-2 f0-1))) + (set! f0-1 f1-0) ) - (the int (+ f0-1 f1-0 f2-0)) - (cond - ((logtest? (-> obj sync-flags) (sync-flags pong)) - (let* ((f3-5 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) - (f3-6 (- f3-5 (* (the float (the int (/ f3-5 f2-0))) f2-0))) - (f2-2 (* 0.5 (- f2-0 (+ f0-1 f1-0)))) - (v1-7 #f) + (let* ((f1-1 (/ (- f3-6 f0-1) f2-2)) + (f0-5 (fmax 0.0 (fmin 1.0 f1-1))) ) - (when (>= f3-6 (+ f2-2 f0-1)) - (set! v1-7 #t) - (set! f3-6 (- f3-6 (+ f2-2 f0-1))) - (set! f0-1 f1-0) - ) - (let* ((f1-1 (/ (- f3-6 f0-1) f2-2)) - (f0-5 (fmax 0.0 (fmin 1.0 f1-1))) - ) - (if v1-7 - (set! f0-5 (- 1.0 f0-5)) - ) - f0-5 - ) + (if v1-7 + (set! f0-5 (- 1.0 f0-5)) + ) + f0-5 ) ) - (else - (let* ((f3-9 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) - (f3-10 (- f3-9 (* (the float (the int (/ f3-9 f2-0))) f2-0))) - (f1-5 (- f2-0 (+ f0-1 f1-0))) - (f1-6 (/ (- f3-10 f0-1) f1-5)) - ) - (fmax 0.0 (fmin 1.0 f1-6)) - ) + ) + (else + (let* ((f3-9 (+ (the float (mod arg0 (the-as int v1-4))) (-> obj offset))) + (f3-10 (- f3-9 (* (the float (the int (/ f3-9 f2-0))) f2-0))) + (f1-5 (- f2-0 (+ f0-1 f1-0))) + (f1-6 (/ (- f3-10 f0-1) f1-5)) + ) + (fmax 0.0 (fmin 1.0 f1-6)) ) ) ) @@ -461,34 +449,28 @@ ;; definition for method 10 of type delayed-rand-float (defmethod reset! delayed-rand-float ((obj delayed-rand-float)) - (with-pp - (set! (-> obj start-time) (-> pp clock frame-counter)) - (set! (-> obj timer) (rand-vu-int-range (-> obj min-time) (-> obj max-time))) - (set! (-> obj value) (rand-vu-float-range (- (-> obj max-val)) (-> obj max-val))) - ) + (set! (-> obj start-time) (current-time)) + (set! (-> obj timer) (rand-vu-int-range (-> obj min-time) (-> obj max-time))) + (set! (-> obj value) (rand-vu-float-range (- (-> obj max-val)) (-> obj max-val))) ) ;; definition for method 11 of type delayed-rand-float (defmethod update! delayed-rand-float ((obj delayed-rand-float)) - (with-pp - (if (>= (- (-> pp clock frame-counter) (-> obj start-time)) (-> obj timer)) - (reset! obj) - ) - (-> obj value) - ) + (if (>= (- (current-time) (-> obj start-time)) (-> obj timer)) + (reset! obj) + ) + (-> obj value) ) ;; definition for method 12 of type delayed-rand-float ;; WARN: Return type mismatch float vs none. (defmethod update-and-clear! delayed-rand-float ((obj delayed-rand-float)) - (with-pp - (if (>= (- (-> pp clock frame-counter) (-> obj start-time)) (-> obj timer)) - (reset! obj) - (set! (-> obj value) 0.0) - ) - (-> obj value) - (none) - ) + (if (>= (- (current-time) (-> obj start-time)) (-> obj timer)) + (reset! obj) + (set! (-> obj value) 0.0) + ) + (-> obj value) + (none) ) ;; definition for method 9 of type oscillating-float @@ -578,35 +560,29 @@ ;; definition for method 10 of type delayed-rand-vector (defmethod update-now! delayed-rand-vector ((obj delayed-rand-vector)) - (with-pp - (set! (-> obj start-time) (-> pp clock frame-counter)) - (set! (-> obj timer) (rand-vu-int-range (-> obj min-time) (-> obj max-time))) - (set! (-> obj value x) (rand-vu-float-range (- (-> obj xz-max)) (-> obj xz-max))) - (set! (-> obj value y) (rand-vu-float-range (- (-> obj y-max)) (-> obj y-max))) - (set! (-> obj value z) (rand-vu-float-range (- (-> obj xz-max)) (-> obj xz-max))) - (-> obj value) - ) + (set! (-> obj start-time) (current-time)) + (set! (-> obj timer) (rand-vu-int-range (-> obj min-time) (-> obj max-time))) + (set! (-> obj value x) (rand-vu-float-range (- (-> obj xz-max)) (-> obj xz-max))) + (set! (-> obj value y) (rand-vu-float-range (- (-> obj y-max)) (-> obj y-max))) + (set! (-> obj value z) (rand-vu-float-range (- (-> obj xz-max)) (-> obj xz-max))) + (-> obj value) ) ;; definition for method 11 of type delayed-rand-vector (defmethod update-with-delay! delayed-rand-vector ((obj delayed-rand-vector)) - (with-pp - (if (>= (- (-> pp clock frame-counter) (-> obj start-time)) (-> obj timer)) - (update-now! obj) - ) - (-> obj value) - ) + (if (>= (- (current-time) (-> obj start-time)) (-> obj timer)) + (update-now! obj) + ) + (-> obj value) ) ;; definition for method 12 of type delayed-rand-vector (defmethod update-with-delay-or-reset! delayed-rand-vector ((obj delayed-rand-vector)) - (with-pp - (if (>= (- (-> pp clock frame-counter) (-> obj start-time)) (-> obj timer)) - (update-now! obj) - (vector-reset! (-> obj value)) - ) - (-> obj value) - ) + (if (>= (- (current-time) (-> obj start-time)) (-> obj timer)) + (update-now! obj) + (vector-reset! (-> obj value)) + ) + (-> obj value) ) ;; definition for method 9 of type oscillating-vector @@ -656,7 +632,3 @@ (-> obj value) ) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/atoll/ash1-course_REF.gc b/test/decompiler/reference/jak2/levels/atoll/ash1-course_REF.gc index dfd3936ea7..ce1f243563 100644 --- a/test/decompiler/reference/jak2/levels/atoll/ash1-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/ash1-course_REF.gc @@ -101,12 +101,12 @@ ) ) ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + (set! (-> arg1 waypoint-time0) (current-time)) ) (let ((s5-0 (get-current-task-event (-> arg1 task)))) (cond ((and (nonzero? (-> arg1 waypoint-time0)) - (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) + (and (>= (- (current-time) (-> 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-override2 trans))) (= (-> s5-0 action) (game-task-action say)) @@ -205,19 +205,13 @@ (with-pp (when (not (channel-active? arg1 (the-as uint 0))) (cond - ((and (not (speech-playing? arg1 45)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2.5)) - ) + ((and (not (speech-playing? arg1 45)) (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2.5))) (play-speech arg1 45) ) - ((and (not (speech-playing? arg1 46)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 7)) - ) + ((and (not (speech-playing? arg1 46)) (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 7))) (play-speech arg1 46) ) - ((and (not (speech-playing? arg1 47)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 14)) - ) + ((and (not (speech-playing? arg1 47)) (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 14))) (play-speech arg1 47) ) ) @@ -252,22 +246,20 @@ ) ) :on-update (lambda ((arg0 ashelin-battle)) - (with-pp - (set-frontline-dist! arg0) - (let ((s5-0 (target-pos 0))) - (if (>= (-> s5-0 y) 176128.0) - (set! (-> arg0 player-in-bounds-time) (-> pp clock frame-counter)) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg0 player-in-bounds-time)) (seconds 4)) - (send-event arg0 'instant-death) - ) - (if (< (-> s5-0 y) 192512.0) - (logior! (-> arg0 bot-flags) (bot-flags bf10)) - (logclear! (-> arg0 bot-flags) (bot-flags bf10)) - ) - ) - (none) + (set-frontline-dist! arg0) + (let ((s5-0 (target-pos 0))) + (if (>= (-> s5-0 y) 176128.0) + (set! (-> arg0 player-in-bounds-time) (current-time)) + ) + (if (>= (- (current-time) (-> arg0 player-in-bounds-time)) (seconds 4)) + (send-event arg0 'instant-death) + ) + (if (< (-> s5-0 y) 192512.0) + (logior! (-> arg0 bot-flags) (bot-flags bf10)) + (logclear! (-> arg0 bot-flags) (bot-flags bf10)) + ) ) + (none) ) :on-skipping-here #f :check-too-far #f @@ -316,18 +308,16 @@ (set! (-> v1-22 bytes 8) 7) (let ((v0-12 (lambda ((arg0 asht-wait-spot) (arg1 ashelin-battle)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.5)) - (let ((s5-0 (get-current-task-event (-> arg1 task)))) - (when (and (= (-> s5-0 action) (game-task-action say)) - (not (channel-active? arg1 (the-as uint 0))) - (scene-play arg1 (the-as string (-> s5-0 scene)) #f) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 5 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.5)) + (let ((s5-0 (get-current-task-event (-> arg1 task)))) + (when (and (= (-> s5-0 action) (game-task-action say)) + (not (channel-active? arg1 (the-as uint 0))) + (scene-play arg1 (the-as string (-> s5-0 scene)) #f) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 5 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) diff --git a/test/decompiler/reference/jak2/levels/atoll/atoll-obs_REF.gc b/test/decompiler/reference/jak2/levels/atoll/atoll-obs_REF.gc index b0c43875bb..235bf68d39 100644 --- a/test/decompiler/reference/jak2/levels/atoll/atoll-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/atoll-obs_REF.gc @@ -130,9 +130,7 @@ (+ (-> self init-height) (+ (-> self range-bottom) (get-scaled-val! (-> self sync) f0-1 0))) ) ) - (when (and (logtest? (actor-option user18) (-> self fact options)) - (< (-> self sound-time 0) (-> self clock frame-counter)) - ) + (when (and (logtest? (actor-option user18) (-> self fact options)) (< (-> self sound-time 0) (current-time))) (sound-stop (the-as sound-id (-> self looping-id))) (sound-play "piston-loop" :id (the-as sound-id (-> self looping-id)) :position (-> self sound-trans)) (+! (-> self sound-time 0) (the int (* 0.5 (the float (-> self sync period))))) @@ -487,7 +485,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "liftcat") (none) ) @@ -497,7 +495,7 @@ This commonly includes things such as: (if (>= (-> self down-y) (-> gp-0 trans y)) (go-virtual idle-down) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (set! (-> self root transv y) -8192.0) (set! (-> self root transv y) 0.0) ) @@ -684,38 +682,38 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (the int (-> self cycle-offset))) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (the int (-> self cycle-offset))) (suspend) ) ) (until #f - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (the int (-> self cycle-time))) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (the int (-> self cycle-time))) (suspend) ) ) (activate! (-> self smush) -1.0 60 225 1.0 1.0 (-> self clock)) (sound-play "rot-pipe-wiggle" :position (-> self root-override trans)) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.75)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 0.75)) (set! (-> self shudder-angle) (* 364.0889 (update! (-> self smush)))) (suspend) ) ) (set! (-> self shudder-angle) 0.0) (set-zero! (-> self smush)) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 0.25)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 0.25)) (suspend) ) ) (sound-play "rot-pipe-turn" :position (-> self root-override trans)) (let* ((f0-7 2.0) (f30-1 (* 16384.0 f0-7)) - (gp-6 (-> self clock frame-counter)) + (gp-6 (current-time)) ) - (until (>= (- (-> self clock frame-counter) gp-6) (seconds 0.5)) + (until (>= (- (current-time) gp-6) (seconds 0.5)) (set! (-> self rot-angle) (the float (sar (shl (the int (+ (-> self rot-angle) (* f30-1 (-> self clock seconds-per-frame)))) 48) 48)) ) @@ -863,7 +861,7 @@ This commonly includes things such as: object (case event-type (('touch 'attack) - (when (>= (- (-> self clock frame-counter) (the-as int (-> self collide-off-timer))) (seconds 2)) + (when (>= (- (current-time) (the-as int (-> self collide-off-timer))) (seconds 2)) (let* ((s4-0 proc) (s3-0 (if (type? s4-0 process-focusable) s4-0 @@ -895,7 +893,7 @@ This commonly includes things such as: (send-event-function proc a1-8) ) ) - (let ((v0-0 (-> self clock frame-counter))) + (let ((v0-0 (current-time))) (set! (-> self collide-off-timer) (the-as uint v0-0)) v0-0 ) @@ -1511,9 +1509,9 @@ This commonly includes things such as: () (local-vars (v1-31 symbol)) (set! (-> self data-int32 0) 0) - (set! (-> self beep-time) (-> self clock frame-counter)) + (set! (-> self beep-time) (current-time)) (until #f - (when (>= (- (-> self clock frame-counter) (-> self beep-time)) (seconds 40)) + (when (>= (- (current-time) (-> self beep-time)) (seconds 40)) (let ((v1-7 (logand (-> self data-int32 0) 3))) (cond ((zero? v1-7) @@ -1530,7 +1528,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self beep-time) (-> self clock frame-counter)) + (set! (-> self beep-time) (current-time)) (+! (-> self data-int32 0) 1) ) (b! diff --git a/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc b/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc index 08cc62e702..017c13ed64 100644 --- a/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc @@ -135,26 +135,24 @@ ;; INFO: Used lq/sq (defmethod event-handler! juicer-shot ((obj juicer-shot) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Multiplex the projectile's event processing, called by [[projectile-event-handler]]" - (with-pp - (case arg2 - (('reset) - (let ((v1-1 (the-as object (-> arg3 param 0)))) - (set! (-> obj root-override trans quad) (-> (the-as matrix v1-1) trans quad)) - (set! (-> obj starting-pos quad) (-> (the-as matrix v1-1) trans quad)) - (set! (-> obj root-override transv quad) (-> (&+ (the-as matrix v1-1) 64) quad 0)) - (set! (-> obj pre-move-transv quad) (-> (&+ (the-as matrix v1-1) 64) quad 0)) - ) - (set! (-> obj hits) 0) - (set! (-> obj spawn-time) (-> pp clock frame-counter)) - (if (made-impact? obj) - (go (method-of-object obj impact)) - (go (method-of-object obj moving)) - ) - #t + (case arg2 + (('reset) + (let ((v1-1 (the-as object (-> arg3 param 0)))) + (set! (-> obj root-override trans quad) (-> (the-as matrix v1-1) trans quad)) + (set! (-> obj starting-pos quad) (-> (the-as matrix v1-1) trans quad)) + (set! (-> obj root-override transv quad) (-> (&+ (the-as matrix v1-1) 64) quad 0)) + (set! (-> obj pre-move-transv quad) (-> (&+ (the-as matrix v1-1) 64) quad 0)) ) - (else - ((method-of-type projectile event-handler!) obj arg0 arg1 arg2 arg3) - ) + (set! (-> obj hits) 0) + (set! (-> obj spawn-time) (current-time)) + (if (made-impact? obj) + (go (method-of-object obj impact)) + (go (method-of-object obj moving)) + ) + #t + ) + (else + ((method-of-type projectile event-handler!) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1308,9 +1306,9 @@ (when (and (or (logtest? (-> self nav state flags) (nav-state-flag blocked)) (logtest? (-> self nav state flags) (nav-state-flag at-target)) ) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) ) - (if (and (>= (- (-> self clock frame-counter) (-> self last-fire-time)) (rand-vu-int-range (seconds 1) (seconds 2))) + (if (and (>= (- (current-time) (-> self last-fire-time)) (rand-vu-int-range (seconds 1) (seconds 2))) (< 20480.0 f30-0) ) (go-virtual attack) @@ -1321,7 +1319,7 @@ ) (if (and (check-los? (-> self los) 0) (or (>= 11468.8 f30-0) - (and (>= (- (-> self clock frame-counter) (-> self last-fire-time)) (rand-vu-int-range (seconds 5) (seconds 8))) + (and (>= (- (current-time) (-> self last-fire-time)) (rand-vu-int-range (seconds 5) (seconds 8))) (>= 53248.0 f30-0) ) ) @@ -1439,7 +1437,7 @@ (set! (-> self torso-track-player) #f) (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (juicer-method-184 self #f) - (set! (-> self last-fire-time) (-> self clock frame-counter)) + (set! (-> self last-fire-time) (current-time)) (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) @@ -1471,8 +1469,8 @@ (s5-0 (+ (-> v1-29 attack-id) 1)) ) (set! (-> v1-29 attack-id) s5-0) - (let ((s4-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-0) (seconds 0.25)) + (let ((s4-0 (current-time))) + (until (>= (- (current-time) s4-0) (seconds 0.25)) (ja-no-eval :group! juicer-attack0-ja :num! (seek! (the float (+ (-> (the-as art-joint-anim juicer-attack0-ja) frames num-frames) -1))) :frame-num 0.0 @@ -1484,7 +1482,7 @@ (vector-vector-distance (-> self root-override2 trans) (get-trans (the-as process-focusable s3-0) 0)) ) (fire-projectile self (the-as process-focusable s3-0) s5-0) - (-> self clock frame-counter) + (current-time) (if (not gp-0) (set! gp-0 #t) ) @@ -1710,14 +1708,14 @@ (ja-channel-push! 1 (seconds 0.6)) (let ((f30-0 (get-rand-float-range self 0.8 1.2))) (let ((gp-0 (get-rand-int-range self 60 210)) - (s5-0 (-> self clock frame-counter)) + (s5-0 (current-time)) (f28-0 f30-0) ) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info-override idle-anim)) :num! (loop! f28-0) :frame-num 0.0 ) - (until (>= (- (-> self clock frame-counter) s5-0) gp-0) + (until (>= (- (current-time) s5-0) gp-0) (suspend) (ja :num! (loop! f28-0)) ) diff --git a/test/decompiler/reference/jak2/levels/atoll/sig0-course_REF.gc b/test/decompiler/reference/jak2/levels/atoll/sig0-course_REF.gc index 723225be0d..93ce4e97e9 100644 --- a/test/decompiler/reference/jak2/levels/atoll/sig0-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/sig0-course_REF.gc @@ -927,15 +927,13 @@ ) ) (when (and (demo?) - (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 1)) + (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 1)) (logtest? (-> arg0 waypoint-bits) 16) ) (set! (-> arg0 waypoint-bits) (logand -17 (-> arg0 waypoint-bits))) (talker-spawn-func (-> *talker-speech* 80) *entity-pool* (target-pos 0) (the-as region #f)) ) - (when (or (not (logtest? (-> arg0 waypoint-bits) 8)) - (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 8)) - ) + (when (or (not (logtest? (-> arg0 waypoint-bits) 8)) (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 8))) (if (and (demo?) (not (logtest? (-> arg0 waypoint-bits) 8))) (logior! (-> arg0 waypoint-bits) 16) ) @@ -951,7 +949,7 @@ (set! (-> s5-4 liftcat-speech-index) v1-62) ) ) - (set! (-> arg0 waypoint-time0) (-> pp clock frame-counter)) + (set! (-> arg0 waypoint-time0) (current-time)) ) ) ) @@ -989,57 +987,55 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) - (with-pp - (set! (-> arg1 too-far-warn-dist) 184320.0) - (set! (-> arg1 too-far-fail-dist-delta) 122880.0) - (cond - ((not (logtest? (-> arg1 waypoint-bits) 1)) - (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-override2 trans) (target-pos 0))) - (f1-0 81920.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (logior! (-> arg1 waypoint-bits) 1) - (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) - ) + (set! (-> arg1 too-far-warn-dist) 184320.0) + (set! (-> arg1 too-far-fail-dist-delta) 122880.0) + (cond + ((not (logtest? (-> arg1 waypoint-bits) 1)) + (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-override2 trans) (target-pos 0))) + (f1-0 81920.0) + ) + (cond + ((and (< f0-2 (* f1-0 f1-0)) + (not (channel-active? arg1 (the-as uint 0))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set! (-> arg1 waypoint-time0) (current-time)) + (logior! (-> arg1 waypoint-bits) 1) + (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) ) ) ) ) - ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 2)) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4.5)) - (process-release? arg1) - (process-release? *target*) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 13 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) + ) + ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 2)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4.5)) + (process-release? arg1) + (process-release? *target*) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 13 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) - (remove-setting! 'entity-name) - (logior! (-> arg1 waypoint-bits) 2) - (set-setting! 'sound-mode #f 0.0 1) - ) + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3)) + (remove-setting! 'entity-name) + (logior! (-> arg1 waypoint-bits) 2) + (set-setting! 'sound-mode #f 0.0 1) ) ) - #f ) + #f ) ) ) @@ -1259,14 +1255,11 @@ :on-update (lambda ((arg0 sig-atoll)) (with-pp (b! (not (channel-active? arg0 (the-as uint 0))) cfg-2 :delay (empty-form)) - (set! (-> arg0 waypoint-time0) (-> pp clock frame-counter)) + (set! (-> arg0 waypoint-time0) (current-time)) (b! #t cfg-21 :delay (nop!)) (label cfg-2) (b! - (not (and (not (speech-playing? arg0 12)) - (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 0.75)) - ) - ) + (not (and (not (speech-playing? arg0 12)) (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 0.75)))) cfg-7 :delay (empty-form) ) @@ -1274,7 +1267,7 @@ (b! #t cfg-21 :delay (nop!)) (label cfg-7) (if (and (not (speech-playing? arg0 13)) - (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 0.5)) + (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 0.5)) (outside-spot-radius? arg0 (the-as bot-spot #f) (the-as vector #f) #f) (let ((a1-5 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-5 from) (process->ppointer pp)) @@ -1422,56 +1415,54 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) - (with-pp - (set! (-> arg1 too-far-warn-dist) 184320.0) - (set! (-> arg1 too-far-fail-dist-delta) 122880.0) - (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-override2 trans) (target-pos 0))) - (f1-0 73728.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (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) - ) + (set! (-> arg1 too-far-warn-dist) 184320.0) + (set! (-> arg1 too-far-fail-dist-delta) 122880.0) + (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-override2 trans) (target-pos 0))) + (f1-0 73728.0) + ) + (cond + ((and (< f0-2 (* f1-0 f1-0)) + (not (channel-active? arg1 (the-as uint 0))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set! (-> arg1 waypoint-time0) (current-time)) + (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) ) ) ) ) - ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4.5)) - (process-release? arg1) - (process-release? *target*) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 18 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) + ) + ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4.5)) + (process-release? arg1) + (process-release? *target*) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 18 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) - (remove-setting! 'entity-name) - (logior! (-> arg1 waypoint-bits) 1) - (set-setting! 'sound-mode #f 0.0 1) - ) + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3)) + (remove-setting! 'entity-name) + (logior! (-> arg1 waypoint-bits) 1) + (set-setting! 'sound-mode #f 0.0 1) ) ) - #f ) + #f ) ) ) @@ -1664,15 +1655,13 @@ (none) ) :on-update (lambda ((arg0 sig-atoll)) - (with-pp - (if (and (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 1.5)) - (not (speech-playing? arg0 18)) - (not (channel-active? arg0 (the-as uint 0))) - ) - (play-speech arg0 18) - ) - (none) - ) + (if (and (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 1.5)) + (not (speech-playing? arg0 18)) + (not (channel-active? arg0 (the-as uint 0))) + ) + (play-speech arg0 18) + ) + (none) ) :on-skipping-here #f :check-too-far #f @@ -1722,9 +1711,7 @@ ) ) ) - (when (or (not (logtest? (-> arg1 waypoint-bits) 2)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 8)) - ) + (when (or (not (logtest? (-> arg1 waypoint-bits) 2)) (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 8))) (logior! (-> arg1 waypoint-bits) 2) (let* ((s5-1 (-> arg1 sig-course)) (s4-1 (-> s5-1 liftcat-speech-index)) @@ -1737,7 +1724,7 @@ (set! (-> s5-1 liftcat-speech-index) v1-35) ) ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + (set! (-> arg1 waypoint-time0) (current-time)) ) ) ) @@ -1828,56 +1815,54 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) - (with-pp - (set! (-> arg1 too-far-warn-dist) 184320.0) - (set! (-> arg1 too-far-fail-dist-delta) 122880.0) - (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-override2 trans) (target-pos 0))) - (f1-0 61440.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (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) - ) + (set! (-> arg1 too-far-warn-dist) 184320.0) + (set! (-> arg1 too-far-fail-dist-delta) 122880.0) + (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-override2 trans) (target-pos 0))) + (f1-0 61440.0) + ) + (cond + ((and (< f0-2 (* f1-0 f1-0)) + (not (channel-active? arg1 (the-as uint 0))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set! (-> arg1 waypoint-time0) (current-time)) + (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) ) ) ) ) - ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4.5)) - (process-release? arg1) - (process-release? *target*) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 23 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) + ) + ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4.5)) + (process-release? arg1) + (process-release? *target*) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 23 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) - (remove-setting! 'entity-name) - (logior! (-> arg1 waypoint-bits) 1) - (set-setting! 'sound-mode #f 0.0 1) - ) + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3)) + (remove-setting! 'entity-name) + (logior! (-> arg1 waypoint-bits) 1) + (set-setting! 'sound-mode #f 0.0 1) ) ) - #f ) + #f ) ) ) @@ -2177,63 +2162,61 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) - (with-pp - (set! (-> arg1 too-far-warn-dist) 184320.0) - (set! (-> arg1 too-far-fail-dist-delta) 122880.0) - (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-override2 trans) (target-pos 0))) - (f1-0 73728.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (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) - ) + (set! (-> arg1 too-far-warn-dist) 184320.0) + (set! (-> arg1 too-far-fail-dist-delta) 122880.0) + (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-override2 trans) (target-pos 0))) + (f1-0 73728.0) + ) + (cond + ((and (< f0-2 (* f1-0 f1-0)) + (not (channel-active? arg1 (the-as uint 0))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set! (-> arg1 waypoint-time0) (current-time)) + (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) ) ) ) ) - ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) - (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.1)) - ) - (remove-setting! 'string-startup-vector) - (logior! (-> arg1 waypoint-bits) 2) - ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3.5)) - (process-release? arg1) - (process-release? *target*) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 29 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) + ) + ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) + (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.1)) + ) + (remove-setting! 'string-startup-vector) + (logior! (-> arg1 waypoint-bits) 2) ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) - (set-setting! 'string-startup-vector 'abs (new 'static 'vector :x 1.0) 0) - (remove-setting! 'entity-name) - (logior! (-> arg1 waypoint-bits) 1) - (set-setting! 'sound-mode #f 0.0 1) - ) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3.5)) + (process-release? arg1) + (process-release? *target*) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 29 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) + (set-setting! 'string-startup-vector 'abs (new 'static 'vector :x 1.0) 0) + (remove-setting! 'entity-name) + (logior! (-> arg1 waypoint-bits) 1) + (set-setting! 'sound-mode #f 0.0 1) ) ) - #f ) + #f ) ) ) @@ -2432,7 +2415,7 @@ (with-pp (cond ((not (logtest? (-> arg0 bot-task-bits) 4)) - (when (and (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 0.25)) + (when (and (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 0.25)) (< (-> arg0 sig-course spots 36 center x) (-> (target-pos 0) x)) ) (logior! (-> arg0 bot-task-bits) 4) @@ -2520,17 +2503,13 @@ ) ) :on-update (lambda ((arg0 sig-atoll)) - (with-pp - (sig0-say-look-out-if-should arg0) - (when (and (not (logtest? (-> arg0 waypoint-bits) 1)) - (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 8)) - ) - (logior! (-> arg0 waypoint-bits) 1) - (logior! (-> arg0 focus-status) (focus-status disable)) - (set! (-> arg0 notice-enemy-dist) 16384.0) - ) - (none) + (sig0-say-look-out-if-should arg0) + (when (and (not (logtest? (-> arg0 waypoint-bits) 1)) (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 8))) + (logior! (-> arg0 waypoint-bits) 1) + (logior! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 notice-enemy-dist) 16384.0) ) + (none) ) :on-skipping-here #f :check-too-far 'sig0-final-snipers-check-too-far @@ -2625,7 +2604,7 @@ (with-pp (cond ((not (speech-playing? arg0 27)) - (if (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 0.5)) + (if (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 0.5)) (play-speech arg0 27) ) ) @@ -2634,7 +2613,7 @@ (logior! (-> arg0 waypoint-bits) 1) (logclear! (-> arg0 focus-status) (focus-status disable)) (set! (-> arg0 notice-enemy-dist) 122880.0) - (set! (-> arg0 waypoint-time0) (-> pp clock frame-counter)) + (set! (-> arg0 waypoint-time0) (current-time)) ) ) ((not (logtest? (-> arg0 waypoint-bits) 2)) @@ -2658,15 +2637,13 @@ ) 5 ) - (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 10)) + (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 10)) ) (set! (-> arg0 bot-flags) (logior (bot-flags bf21) (-> arg0 bot-flags))) (logior! (-> arg0 waypoint-bits) 2) ) (else - (if (and (>= (- (-> pp clock frame-counter) (-> arg0 waypoint-time0)) (seconds 4)) - (not (speech-playing? arg0 28)) - ) + (if (and (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 4)) (not (speech-playing? arg0 28))) (play-speech arg0 28) ) ) @@ -2809,61 +2786,59 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) - (with-pp - (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-override2 trans) (target-pos 0))) - (f1-0 61440.0) - ) - (cond - ((and (< f0-0 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (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 + ((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-override2 trans) (target-pos 0))) + (f1-0 61440.0) + ) + (cond + ((and (< f0-0 (* f1-0 f1-0)) + (not (channel-active? arg1 (the-as uint 0))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set! (-> arg1 waypoint-time0) (current-time)) + (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) ) ) ) ) - ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) - (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.1)) - ) - (remove-setting! 'string-startup-vector) - (logior! (-> arg1 waypoint-bits) 2) - ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4.5)) - (process-release? arg1) - (process-release? *target*) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 38 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) + ) + ((begin (reset-warn-time! arg1) (logtest? (-> arg1 waypoint-bits) 1)) + (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.1)) + ) + (remove-setting! 'string-startup-vector) + (logior! (-> arg1 waypoint-bits) 2) ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) - (set-setting! 'string-startup-vector 'abs (new 'static 'vector :x -1.0) 0) - (remove-setting! 'entity-name) - (logior! (-> arg1 waypoint-bits) 1) - (set-setting! 'sound-mode #f 0.0 1) - ) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4.5)) + (process-release? arg1) + (process-release? *target*) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 38 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3)) + (set-setting! 'string-startup-vector 'abs (new 'static 'vector :x -1.0) 0) + (remove-setting! 'entity-name) + (logior! (-> arg1 waypoint-bits) 1) + (set-setting! 'sound-mode #f 0.0 1) ) ) - #f ) + #f ) ) ) diff --git a/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc b/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc index bb791c54d5..15edd601c6 100644 --- a/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc @@ -268,7 +268,7 @@ (t9-0) ) ) - (set! (-> self next-pick-time) (-> self clock frame-counter)) + (set! (-> self next-pick-time) (current-time)) (none) ) :code (behavior () @@ -301,11 +301,11 @@ :post (behavior () (when (or (logtest? (-> self nav state flags) (nav-state-flag at-target)) (nav-enemy-method-163 self) - (>= (-> self clock frame-counter) (-> self next-pick-time)) + (>= (current-time) (-> self next-pick-time)) ) (nav-enemy-method-156 self) (nav-enemy-method-162 self) - (set! (-> self next-pick-time) (+ (-> self clock frame-counter) (get-rand-int-range self 300 1050))) + (set! (-> self next-pick-time) (+ (current-time) (get-rand-int-range self 300 1050))) ) (nav-enemy-method-176 self) (none) diff --git a/test/decompiler/reference/jak2/levels/castle/boss/castle-baron_REF.gc b/test/decompiler/reference/jak2/levels/castle/boss/castle-baron_REF.gc index f81b424c80..3041e576ec 100644 --- a/test/decompiler/reference/jak2/levels/castle/boss/castle-baron_REF.gc +++ b/test/decompiler/reference/jak2/levels/castle/boss/castle-baron_REF.gc @@ -1403,13 +1403,13 @@ For example for an elevator pre-compute the distance between the first and last (none) ) :code (behavior () - (set! (-> self wiggle-time) (+ (-> self clock frame-counter) (seconds -10))) + (set! (-> self wiggle-time) (+ (current-time) (seconds -10))) (set! (-> self wiggle-angle) 0.0) (let ((f30-0 (get-rand-float-range self 0.9 1.1))) (until #f (ja :num! (loop! f30-0)) - (when (>= (- (-> self clock frame-counter) (-> self wiggle-time)) (seconds 1)) - (set! (-> self wiggle-time) (-> self clock frame-counter)) + (when (>= (- (current-time) (-> self wiggle-time)) (seconds 1)) + (set! (-> self wiggle-time) (current-time)) (krew-boss-clone-method-180 self) ) (suspend) @@ -2332,37 +2332,35 @@ For example for an elevator pre-compute the distance between the first and last (defmethod general-event-handler krew-boss ((obj krew-boss) (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" - (with-pp - (case arg2 - (('track) - (cond - ((-> arg3 param 0) - (if (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) - #t - 'abort - ) - ) - (else - (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) - ) - ) - ) - (('notify) - (case (-> arg3 param 0) - (('hit) - (krew-hits-jak-speech obj) - (set! (-> obj next-shooting-frame) 100) - (set! (-> obj spawn-charge) #t) - (let ((v0-0 (the-as object (-> pp clock frame-counter)))) - (set! (-> obj state-time) (the-as time-frame v0-0)) - v0-0 + (case arg2 + (('track) + (cond + ((-> arg3 param 0) + (if (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) + #t + 'abort ) - ) + ) + (else + (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active)) ) ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (('notify) + (case (-> arg3 param 0) + (('hit) + (krew-hits-jak-speech obj) + (set! (-> obj next-shooting-frame) 100) + (set! (-> obj spawn-charge) #t) + (let ((v0-0 (the-as object (current-time)))) + (set! (-> obj state-time) (the-as time-frame v0-0)) + v0-0 + ) ) + ) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -2678,26 +2676,24 @@ For example for an elevator pre-compute the distance between the first and last ;; definition for method 56 of type krew-boss (defmethod damage-amount-from-attack krew-boss ((obj krew-boss) (arg0 process) (arg1 event-message-block)) "@returns the amount of damage taken from an attack. This can come straight off the [[attack-info]] or via [[penetrate-using->damage]]" - (with-pp - (let ((v1-0 (get-penetrate-using-from-attack-event (the-as process-drawable arg0) arg1))) - (cond - ((or (logtest? (penetrate jak-blue-shot) v1-0) (logtest? (penetrate jak-dark-shot) v1-0)) - (cond - ((>= (- (-> pp clock frame-counter) (-> obj last-damage-time)) (seconds 5)) - (set! (-> obj last-damage-time) (-> pp clock frame-counter)) - 5 - ) - (else - 0 - ) - ) - ) - ((logtest? (penetrate dark-bomb) v1-0) - 20 - ) - (else + (let ((v1-0 (get-penetrate-using-from-attack-event (the-as process-drawable arg0) arg1))) + (cond + ((or (logtest? (penetrate jak-blue-shot) v1-0) (logtest? (penetrate jak-dark-shot) v1-0)) + (cond + ((>= (- (current-time) (-> obj last-damage-time)) (seconds 5)) + (set! (-> obj last-damage-time) (current-time)) 5 ) + (else + 0 + ) + ) + ) + ((logtest? (penetrate dark-bomb) v1-0) + 20 + ) + (else + 5 ) ) ) @@ -2841,7 +2837,7 @@ For example for an elevator pre-compute the distance between the first and last (set! (-> self spawn-charge) #t) (set! (-> self enemy-flags) (the-as enemy-flag (logxor (shl 256 32) (the-as int (-> self enemy-flags))))) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag enemy-flag41)))) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) (when (not (handle->process (-> self hud-handle))) (set! (-> self hud-handle) (ppointer->handle (process-spawn hud-krew-boss :init hud-init-by-other :to self))) (krew-comes-in-speech self) @@ -2865,7 +2861,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) (if (or (!= (-> self focus aware) 3) (not (get-enemy-target self))) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) ) (when (= (-> self next-shooting-frame) 200) (cond @@ -2906,7 +2902,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) (else - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ) ) @@ -2973,7 +2969,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) (let ((gp-2 (the int (* 300.0 (- 3.0 (* 0.5 (+ -1.0 (the float (-> self gameplay-pass))))))))) - (when (and (-> self spawn-charge) (>= (- (-> self clock frame-counter) (-> self state-time)) (+ gp-2 -300))) + (when (and (-> self spawn-charge) (>= (- (current-time) (-> self state-time)) (+ gp-2 -300))) (process-spawn part-tracker :init part-tracker-init @@ -2987,7 +2983,7 @@ For example for an elevator pre-compute the distance between the first and last ) (set! (-> self spawn-charge) #f) ) - (when (and (= (-> self next-shooting-frame) 100) (>= (- (-> self clock frame-counter) (-> self state-time)) gp-2)) + (when (and (= (-> self next-shooting-frame) 100) (>= (- (current-time) (-> self state-time)) gp-2)) (set! (-> self next-shooting-frame) 0) (ja :chan 1 :num-func num-func-identity :frame-num 0.0) ) @@ -3003,7 +2999,7 @@ For example for an elevator pre-compute the distance between the first and last ((= (-> self next-shooting-frame) 20) (set! (-> self next-shooting-frame) 100) (set! (-> self spawn-charge) #t) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (else (+! (-> self next-shooting-frame) 5) diff --git a/test/decompiler/reference/jak2/levels/castle/pad/caspad-obs_REF.gc b/test/decompiler/reference/jak2/levels/castle/pad/caspad-obs_REF.gc index aa0020694a..10a84fd7f7 100644 --- a/test/decompiler/reference/jak2/levels/castle/pad/caspad-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/castle/pad/caspad-obs_REF.gc @@ -127,8 +127,8 @@ (none) ) :code (behavior () - (let ((frame-counter (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 1)) + (let ((frame-counter (current-time))) + (until (>= (- (current-time) frame-counter) (seconds 1)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/castle/pad/castle-tasks_REF.gc b/test/decompiler/reference/jak2/levels/castle/pad/castle-tasks_REF.gc index b946ba715c..8eef4893b1 100644 --- a/test/decompiler/reference/jak2/levels/castle/pad/castle-tasks_REF.gc +++ b/test/decompiler/reference/jak2/levels/castle/pad/castle-tasks_REF.gc @@ -18,8 +18,8 @@ (until #f (when (< (vector-vector-distance (target-pos 0) (-> self info end-sphere)) (-> self info end-sphere r)) (send-event (handle->process (-> self arrow)) 'leave) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 0.007)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 0.007)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/common/citizen-enemy_REF.gc b/test/decompiler/reference/jak2/levels/city/common/citizen-enemy_REF.gc index 6878babf08..e2e6e26bdd 100644 --- a/test/decompiler/reference/jak2/levels/city/common/citizen-enemy_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/citizen-enemy_REF.gc @@ -37,26 +37,24 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (with-pp - (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) - (set! (-> a1-0 options) (overlaps-others-options)) - (set! (-> a1-0 collide-with-filter) (-> obj enemy-info-override overlaps-others-collide-with-filter)) - (set! (-> a1-0 tlist) *touching-list*) - (find-overlapping-shapes (-> obj root-override2) a1-0) - ) - (when (and (not (focus-test? obj disable dead ignore inactive)) - (< (-> obj next-update-target) (-> pp clock frame-counter)) - (not (logtest? (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (-> obj next-state) - (= (-> obj next-state name) 'active) - ) - (citizen-enemy-method-202 obj) - (set! (-> obj next-update-target) (+ (-> pp clock frame-counter) (seconds 0.2))) - (traffic-danger-init! obj) - ) - ((method-of-type citizen track-target!) obj) - (none) + (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-0 options) (overlaps-others-options)) + (set! (-> a1-0 collide-with-filter) (-> obj enemy-info-override overlaps-others-collide-with-filter)) + (set! (-> a1-0 tlist) *touching-list*) + (find-overlapping-shapes (-> obj root-override2) a1-0) ) + (when (and (not (focus-test? obj disable dead ignore inactive)) + (< (-> obj next-update-target) (current-time)) + (not (logtest? (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (-> obj next-state) + (= (-> obj next-state name) 'active) + ) + (citizen-enemy-method-202 obj) + (set! (-> obj next-update-target) (+ (current-time) (seconds 0.2))) + (traffic-danger-init! obj) + ) + ((method-of-type citizen track-target!) obj) + (none) ) ;; definition for method 76 of type citizen-enemy @@ -351,7 +349,3 @@ (go (method-of-object obj active)) (none) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/city/common/citizen_REF.gc b/test/decompiler/reference/jak2/levels/city/common/citizen_REF.gc index 8a7a327edf..ef02954e31 100644 --- a/test/decompiler/reference/jak2/levels/city/common/citizen_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/citizen_REF.gc @@ -413,89 +413,85 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (with-pp - (when (< (-> obj next-time-look-at) (-> pp clock frame-counter)) - (when (nonzero? (-> obj neck)) - (let ((a0-4 (handle->process (-> obj focus handle)))) - (when a0-4 - (let ((s5-0 (new 'stack-no-clear 'vector))) - (set! (-> s5-0 quad) (-> (get-trans (the-as process-focusable a0-4) 2) quad)) - (if (and (-> obj next-state) (= (-> obj next-state name) 'flee)) - (set! (-> s5-0 quad) (-> obj danger-pos quad)) - ) - (when (< (vector-vector-distance s5-0 (-> obj root-override2 trans)) 122880.0) - (look-at-target! obj (enemy-flag lock-focus)) - (target-set! (-> obj neck) s5-0) - ) - ) - ) - ) - (when (< (-> obj stop-time-look-at) (-> pp clock frame-counter)) - (shut-down (-> obj neck)) - (set! (-> obj next-time-look-at) - (+ (-> pp clock frame-counter) (the int (* 300.0 (get-rand-float-range obj 0.0 20.0)))) - ) - (set! (-> obj stop-time-look-at) - (+ (-> obj next-time-look-at) (the int (* 300.0 (get-rand-float-range obj 5.0 10.0)))) - ) - ) - ) - ) - (let ((a0-18 (-> obj enemy-flags))) - (when (and (logtest? a0-18 (enemy-flag attackable-backup)) - (>= (- (-> pp clock frame-counter) (-> obj auto-reset-penetrate-time)) (seconds 0.1)) - ) - (set! (-> obj enemy-flags) (logclear a0-18 (enemy-flag attackable-backup))) - (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) - (let ((v1-50 0)) - (if (logtest? (penetrate knocked) (-> obj root-override2 penetrate-using)) - (set! v1-50 (logior (shl 1 32) v1-50)) - ) - (set! (-> obj root-override2 penetrate-using) (the-as penetrate v1-50)) - ) - ) - ) - (if (and (nonzero? (-> obj draw)) (logtest? (-> obj draw status) (draw-control-status on-screen))) - (set! (-> obj last-draw-time) (-> pp clock frame-counter)) - ) - (let ((s5-3 (-> obj draw shadow-ctrl))) - (when (!= *nav-enemy-dummy-shadow-control* s5-3) - (let ((f0-7 (vector-vector-distance (camera-pos) (-> obj root-override2 trans)))) - (cond - ((< 163840.0 f0-7) - (logior! (-> s5-3 settings flags) (shadow-flags disable-draw)) - 0 - ) - (else - (let ((v1-65 s5-3)) - (logclear! (-> v1-65 settings flags) (shadow-flags disable-draw)) - ) - 0 - (let* ((f0-8 (lerp-scale 0.0 1.0 f0-7 163840.0 40960.0)) - (f0-11 (fmax 0.01 (+ (* -2.0 f0-8 f0-8 f0-8) (* 3.0 f0-8 f0-8)))) - ) - (set! (-> s5-3 settings shadow-dir w) (* 614400.0 f0-11)) + (when (< (-> obj next-time-look-at) (current-time)) + (when (nonzero? (-> obj neck)) + (let ((a0-4 (handle->process (-> obj focus handle)))) + (when a0-4 + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> (get-trans (the-as process-focusable a0-4) 2) quad)) + (if (and (-> obj next-state) (= (-> obj next-state name) 'flee)) + (set! (-> s5-0 quad) (-> obj danger-pos quad)) ) + (when (< (vector-vector-distance s5-0 (-> obj root-override2 trans)) 122880.0) + (look-at-target! obj (enemy-flag lock-focus)) + (target-set! (-> obj neck) s5-0) ) ) ) ) - ) - (when (logtest? (enemy-flag trackable-backup directed-ready) (-> obj enemy-flags)) - (enemy-method-54 obj) - (when (and (focus-test? obj touch-water) - (< (-> obj root-override2 trans y) (+ -11468.8 (-> obj water-surface-height))) - ) - (set! (-> obj root-override2 trans y) (+ -11468.8 (-> obj water-surface-height))) - (if (not (and (-> obj next-state) (= (-> obj next-state name) 'in-ditch))) - (go (method-of-object obj in-ditch)) - ) + (when (< (-> obj stop-time-look-at) (current-time)) + (shut-down (-> obj neck)) + (set! (-> obj next-time-look-at) (+ (current-time) (the int (* 300.0 (get-rand-float-range obj 0.0 20.0))))) + (set! (-> obj stop-time-look-at) + (+ (-> obj next-time-look-at) (the int (* 300.0 (get-rand-float-range obj 5.0 10.0)))) + ) ) ) - (ja-post) - 0 - (none) ) + (let ((a0-18 (-> obj enemy-flags))) + (when (and (logtest? a0-18 (enemy-flag attackable-backup)) + (>= (- (current-time) (-> obj auto-reset-penetrate-time)) (seconds 0.1)) + ) + (set! (-> obj enemy-flags) (logclear a0-18 (enemy-flag attackable-backup))) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) + (let ((v1-50 0)) + (if (logtest? (penetrate knocked) (-> obj root-override2 penetrate-using)) + (set! v1-50 (logior (shl 1 32) v1-50)) + ) + (set! (-> obj root-override2 penetrate-using) (the-as penetrate v1-50)) + ) + ) + ) + (if (and (nonzero? (-> obj draw)) (logtest? (-> obj draw status) (draw-control-status on-screen))) + (set! (-> obj last-draw-time) (current-time)) + ) + (let ((s5-3 (-> obj draw shadow-ctrl))) + (when (!= *nav-enemy-dummy-shadow-control* s5-3) + (let ((f0-7 (vector-vector-distance (camera-pos) (-> obj root-override2 trans)))) + (cond + ((< 163840.0 f0-7) + (logior! (-> s5-3 settings flags) (shadow-flags disable-draw)) + 0 + ) + (else + (let ((v1-65 s5-3)) + (logclear! (-> v1-65 settings flags) (shadow-flags disable-draw)) + ) + 0 + (let* ((f0-8 (lerp-scale 0.0 1.0 f0-7 163840.0 40960.0)) + (f0-11 (fmax 0.01 (+ (* -2.0 f0-8 f0-8 f0-8) (* 3.0 f0-8 f0-8)))) + ) + (set! (-> s5-3 settings shadow-dir w) (* 614400.0 f0-11)) + ) + ) + ) + ) + ) + ) + (when (logtest? (enemy-flag trackable-backup directed-ready) (-> obj enemy-flags)) + (enemy-method-54 obj) + (when (and (focus-test? obj touch-water) + (< (-> obj root-override2 trans y) (+ -11468.8 (-> obj water-surface-height))) + ) + (set! (-> obj root-override2 trans y) (+ -11468.8 (-> obj water-surface-height))) + (if (not (and (-> obj next-state) (= (-> obj next-state name) 'in-ditch))) + (go (method-of-object obj in-ditch)) + ) + ) + ) + (ja-post) + 0 + (none) ) ;; definition for method 128 of type citizen @@ -1393,7 +1389,7 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior citizen) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1488,7 +1484,7 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior citizen) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1505,9 +1501,7 @@ This commonly includes things such as: (none) ) :trans (behavior () - (if (and (-> self wait-return-state) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self wait-time)) - ) + (if (and (-> self wait-return-state) (>= (- (current-time) (-> self state-time)) (-> self wait-time))) (go (-> self wait-return-state)) ) (none) @@ -1554,7 +1548,7 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior citizen) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -1594,13 +1588,13 @@ This commonly includes things such as: (none) ) :trans (behavior () - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (not (logtest? (-> self nav state flags) (nav-state-flag in-mesh))) (< (-> self root-override2 trans y) 4096.0) ) (go-virtual in-ditch) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self wait-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self wait-time)) (let ((f0-2 (-> self nav state speed))) (set! (-> self nav target-speed) (seek f0-2 0.0 (* 12288.0 (-> self clock seconds-per-frame)))) ) @@ -1615,10 +1609,10 @@ This commonly includes things such as: (v1-36 (-> self root-override2 transv)) ) (if (< f0-8 (sqrtf (+ (* (-> v1-36 x) (-> v1-36 x)) (* (-> v1-36 z) (-> v1-36 z))))) - (set! (-> self cp-next-time) (-> self clock frame-counter)) + (set! (-> self cp-next-time) (current-time)) ) ) - (when (< (+ (-> self cp-next-time) (seconds 2)) (-> self clock frame-counter)) + (when (< (+ (-> self cp-next-time) (seconds 2)) (current-time)) (let ((a1-3 (vector-! (new 'stack-no-clear 'vector) (-> self controller path-prev-point) @@ -1626,7 +1620,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self cp-next-time) (-> self clock frame-counter)) + (set! (-> self cp-next-time) (current-time)) (citizen-method-195 self a1-3) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/common/civilian_REF.gc b/test/decompiler/reference/jak2/levels/city/common/civilian_REF.gc index e4641b74fa..ddba1440cd 100644 --- a/test/decompiler/reference/jak2/levels/city/common/civilian_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/civilian_REF.gc @@ -353,121 +353,119 @@ (defmethod general-event-handler civilian ((obj civilian) (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" - (with-pp - (let ((v1-0 arg2)) - (the-as - object - (cond - ((= v1-0 'track) - #f + (let ((v1-0 arg2)) + (the-as + object + (cond + ((= v1-0 'track) + #f + ) + ((= v1-0 'combo) + #f + ) + ((= v1-0 'touched) + ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ((= v1-0 'panic) + (let ((a0-6 (-> arg3 param 0))) + (set! (-> obj danger-pos quad) (-> (the-as sphere (+ a0-6 0)) quad)) ) - ((= v1-0 'combo) - #f - ) - ((= v1-0 'touched) - ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) - ) - ((= v1-0 'panic) - (let ((a0-6 (-> arg3 param 0))) - (set! (-> obj danger-pos quad) (-> (the-as sphere (+ a0-6 0)) quad)) + (if (and (-> obj next-state) (let ((v1-6 (-> obj next-state name))) + (or (= v1-6 'active) (= v1-6 'wait) (= v1-6 'avoid-danger)) + ) + ) + (go (method-of-object obj flee)) ) - (if (and (-> obj next-state) (let ((v1-6 (-> obj next-state name))) - (or (= v1-6 'active) (= v1-6 'wait) (= v1-6 'avoid-danger)) - ) - ) - (go (method-of-object obj flee)) - ) - ) - ((= v1-0 'event-death) - (if (zero? (-> obj hit-points)) - (the-as object (do-effect (-> obj skel effect) 'death-default 0.0 -1)) - ) - ) - ((= v1-0 'avoid) - (set! (-> obj last-danger-time) (-> pp clock frame-counter)) - (let ((a0-15 (-> arg3 param 0))) - (set! (-> obj danger-pos quad) (-> (the-as vector (+ a0-15 0)) quad)) + ) + ((= v1-0 'event-death) + (if (zero? (-> obj hit-points)) + (the-as object (do-effect (-> obj skel effect) 'death-default 0.0 -1)) ) - (if (and (-> obj next-state) (let ((v1-18 (-> obj next-state name))) - (or (= v1-18 'active) (= v1-18 'wait)) - ) - ) - (go (method-of-object obj avoid-danger)) - ) + ) + ((= v1-0 'avoid) + (set! (-> obj last-danger-time) (current-time)) + (let ((a0-15 (-> arg3 param 0))) + (set! (-> obj danger-pos quad) (-> (the-as vector (+ a0-15 0)) quad)) ) - ((= v1-0 'clear-path) - (set! (-> obj last-danger-time) (-> pp clock frame-counter)) - (let ((v1-23 (the-as traffic-danger-info (-> arg3 param 0)))) - (set! (-> obj cp-valid?) #t) - (set! (-> obj cp-sphere quad) (-> v1-23 sphere quad)) - (set! (-> obj cp-vec quad) (-> v1-23 velocity quad)) - (case (-> v1-23 danger-type) - (((traffic-danger-type tdt0)) - (set! (-> obj allow-dive) #f) - (set! (-> obj cp-factor) 20.0) - ) - (((traffic-danger-type tdt1)) - (set! (-> obj allow-dive) #f) - (set! (-> obj cp-factor) 20.0) - ) - (((traffic-danger-type tdt2)) - (set! (-> obj allow-dive) #t) - (set! (-> obj cp-factor) 50.0) - ) - (((traffic-danger-type tdt3)) - (set! (-> obj allow-dive) #t) - (set! (-> obj cp-factor) 50.0) - ) - (((traffic-danger-type tdt4)) - (set! (-> obj allow-dive) #f) - (set! (-> obj cp-factor) 2.0) - ) - (((traffic-danger-type tdt5)) - (set! (-> obj allow-dive) #t) - (set! (-> obj cp-factor) 50.0) - ) - (((traffic-danger-type tdt6)) - (set! (-> obj allow-dive) #t) - (set! (-> obj cp-factor) 50.0) - ) - ) + (if (and (-> obj next-state) (let ((v1-18 (-> obj next-state name))) + (or (= v1-18 'active) (= v1-18 'wait)) + ) + ) + (go (method-of-object obj avoid-danger)) ) - (let ((s5-1 (-> obj cp-plane))) - (set! (-> s5-1 quad) (-> obj cp-vec quad)) - (set! (-> s5-1 y) 0.0) - (vector-rotate90-around-y! s5-1 s5-1) - (vector-normalize! s5-1 1.0) - (set! (-> s5-1 w) (- (vector-dot (the-as vector s5-1) (the-as vector (-> obj cp-sphere))))) - ) - (set! (-> obj cp-exit-time) (+ (-> pp clock frame-counter) (seconds 4))) - (if (and (-> obj next-state) (let ((v1-54 (-> obj next-state name))) - (or (= v1-54 'active) (= v1-54 'wait) (= v1-54 'avoid-danger)) - ) - ) - (go (method-of-object obj clear-path)) - ) - ) - ((or (= v1-0 'hit) (= v1-0 'hit-flinch) (= v1-0 'hit-knocked)) - (speech-control-method-13 *speech-control* (the-as handle obj)) - (if (logtest? (-> obj flags) (citizen-flag female)) - (speech-control-method-12 - *speech-control* - obj - (speech-type speech-type-0 speech-type-1 speech-type-3 speech-type-4) - ) - (speech-control-method-12 *speech-control* obj (speech-type speech-type-0 speech-type-1 speech-type-4)) - ) - ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) - ) - ((= v1-0 'end-task) - (let ((v0-0 (the-as object (logclear (-> obj flags) (citizen-flag persistent))))) - (set! (-> obj flags) (the-as citizen-flag v0-0)) - v0-0 + ) + ((= v1-0 'clear-path) + (set! (-> obj last-danger-time) (current-time)) + (let ((v1-23 (the-as traffic-danger-info (-> arg3 param 0)))) + (set! (-> obj cp-valid?) #t) + (set! (-> obj cp-sphere quad) (-> v1-23 sphere quad)) + (set! (-> obj cp-vec quad) (-> v1-23 velocity quad)) + (case (-> v1-23 danger-type) + (((traffic-danger-type tdt0)) + (set! (-> obj allow-dive) #f) + (set! (-> obj cp-factor) 20.0) + ) + (((traffic-danger-type tdt1)) + (set! (-> obj allow-dive) #f) + (set! (-> obj cp-factor) 20.0) + ) + (((traffic-danger-type tdt2)) + (set! (-> obj allow-dive) #t) + (set! (-> obj cp-factor) 50.0) + ) + (((traffic-danger-type tdt3)) + (set! (-> obj allow-dive) #t) + (set! (-> obj cp-factor) 50.0) + ) + (((traffic-danger-type tdt4)) + (set! (-> obj allow-dive) #f) + (set! (-> obj cp-factor) 2.0) + ) + (((traffic-danger-type tdt5)) + (set! (-> obj allow-dive) #t) + (set! (-> obj cp-factor) 50.0) + ) + (((traffic-danger-type tdt6)) + (set! (-> obj allow-dive) #t) + (set! (-> obj cp-factor) 50.0) + ) ) ) - (else - ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) - ) + (let ((s5-1 (-> obj cp-plane))) + (set! (-> s5-1 quad) (-> obj cp-vec quad)) + (set! (-> s5-1 y) 0.0) + (vector-rotate90-around-y! s5-1 s5-1) + (vector-normalize! s5-1 1.0) + (set! (-> s5-1 w) (- (vector-dot (the-as vector s5-1) (the-as vector (-> obj cp-sphere))))) + ) + (set! (-> obj cp-exit-time) (+ (current-time) (seconds 4))) + (if (and (-> obj next-state) (let ((v1-54 (-> obj next-state name))) + (or (= v1-54 'active) (= v1-54 'wait) (= v1-54 'avoid-danger)) + ) + ) + (go (method-of-object obj clear-path)) + ) + ) + ((or (= v1-0 'hit) (= v1-0 'hit-flinch) (= v1-0 'hit-knocked)) + (speech-control-method-13 *speech-control* (the-as handle obj)) + (if (logtest? (-> obj flags) (citizen-flag female)) + (speech-control-method-12 + *speech-control* + obj + (speech-type speech-type-0 speech-type-1 speech-type-3 speech-type-4) + ) + (speech-control-method-12 *speech-control* obj (speech-type speech-type-0 speech-type-1 speech-type-4)) + ) + ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ((= v1-0 'end-task) + (let ((v0-0 (the-as object (logclear (-> obj flags) (citizen-flag persistent))))) + (set! (-> obj flags) (the-as citizen-flag v0-0)) + v0-0 + ) + ) + (else + ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -576,8 +574,8 @@ ) ) ) - (when (< (-> self cp-next-time) (-> self clock frame-counter)) - (set! (-> self cp-next-time) (+ (-> self clock frame-counter) (get-rand-int-range self 600 1200))) + (when (< (-> self cp-next-time) (current-time)) + (set! (-> self cp-next-time) (+ (current-time) (get-rand-int-range self 600 1200))) (citizen-method-190 self (-> self cp-force)) ) (add-offset-to-target! (-> self nav state) (-> self cp-force)) @@ -610,7 +608,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -660,7 +658,7 @@ (speech-control-method-12 *speech-control* self (speech-type speech-type-4)) ) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (not (logtest? (-> self nav state flags) (nav-state-flag in-mesh))) (< (-> self root-override2 trans y) 4096.0) ) @@ -841,7 +839,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -859,7 +857,7 @@ (set! (-> v1-9 target-speed) (* (-> self speed-scale) (-> self speed-walk))) ) 0 - (set! (-> self next-time) (+ (-> self clock frame-counter) (get-rand-int-range self 300 600))) + (set! (-> self next-time) (+ (current-time) (get-rand-int-range self 300 600))) (set! (-> self last-second-pos quad) (-> self root-override2 trans quad)) (set! (-> self last-distance) (vector-vector-xz-distance (-> self controller turn-exit-point) (-> self root-override2 trans)) @@ -876,7 +874,7 @@ (none) ) :trans (behavior () - (if (< (+ (-> self last-danger-time) (seconds 1)) (-> self clock frame-counter)) + (if (< (+ (-> self last-danger-time) (seconds 1)) (current-time)) (go-virtual active) ) (when (citizen-method-187 self) @@ -993,9 +991,9 @@ ;; INFO: Used lq/sq (defbehavior civilian-clear-path-post2 civilian () (citizen-method-192 self) - (when (< (-> self cp-next-time) (-> self clock frame-counter)) + (when (< (-> self cp-next-time) (current-time)) (citizen-method-190 self (-> self cp-force)) - (set! (-> self cp-next-time) (+ (-> self clock frame-counter) (get-rand-int-range self 1200 2400))) + (set! (-> self cp-next-time) (+ (current-time) (get-rand-int-range self 1200 2400))) ) (let ((gp-1 (new 'stack-no-clear 'vector))) (citizen-method-188 self gp-1) @@ -1030,7 +1028,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -1048,7 +1046,7 @@ (set! (-> v1-9 target-speed) (* (-> self speed-scale) (-> self speed-walk))) ) 0 - (set! (-> self cp-next-time) (+ (-> self clock frame-counter) (get-rand-int-range self 1200 2400))) + (set! (-> self cp-next-time) (+ (current-time) (get-rand-int-range self 1200 2400))) (set! (-> self cp-force quad) (the-as uint128 0)) (if *citizen-debug* (set-vector! (-> self draw color-mult) 0.0 1.0 0.0 1.0) @@ -1111,7 +1109,7 @@ (go-dive self) ) ) - (if (< (-> self cp-exit-time) (-> self clock frame-counter)) + (if (< (-> self cp-exit-time) (current-time)) (go-virtual active) ) (none) @@ -1141,7 +1139,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1174,7 +1172,7 @@ (none) ) :trans (behavior () - (if (< (+ (-> self last-danger-time) (seconds 1)) (-> self clock frame-counter)) + (if (< (+ (-> self last-danger-time) (seconds 1)) (current-time)) (go-virtual get-up-front) ) (none) @@ -1211,7 +1209,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -1320,7 +1318,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1401,7 +1399,7 @@ (suspend) (ja :num! (seek! max (-> self speed-scale))) ) - (if (< (+ (-> self last-danger-time) (seconds 1)) (-> self clock frame-counter)) + (if (< (+ (-> self last-danger-time) (seconds 1)) (current-time)) (goto cfg-9) ) ) @@ -1445,7 +1443,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1509,7 +1507,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1619,7 +1617,7 @@ ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -1667,7 +1665,7 @@ ) :enter (behavior () (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-4 nav callback-info) *nav-enemy-null-callback-info*) @@ -1840,7 +1838,7 @@ ) :enter (behavior () (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-4 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-4 enemy-flags))) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-4 enemy-flags)))) @@ -1963,7 +1961,7 @@ ) :enter (behavior () (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-5 (-> self root-override2 root-prim))) (set! (-> v1-5 prim-core collide-as) (collide-spec)) (set! (-> v1-5 prim-core collide-with) (collide-spec)) @@ -2098,7 +2096,7 @@ (let ((a0-1 (the-as object (-> event param 0)))) (set! (-> self event-param-point quad) (-> (the-as vector a0-1) quad)) ) - (let ((v1-3 (-> self clock frame-counter)) + (let ((v1-3 (current-time)) (a0-3 (-> self state-time)) ) (if (>= (- v1-3 a0-3) (seconds 1)) @@ -2124,7 +2122,7 @@ ) :enter (behavior () (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-5 (-> self root-override2 root-prim))) (set! (-> v1-5 prim-core collide-as) (collide-spec)) (set! (-> v1-5 prim-core collide-with) (collide-spec)) @@ -2206,7 +2204,7 @@ (set! (-> self gnd-height) (-> self root-override2 gspot-pos y)) (logior! (-> self flags) (citizen-flag persistent)) (set! (-> self focus-status) (logior (focus-status pilot-riding pilot) (-> self focus-status))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-28 (-> self root-override2 root-prim))) (set! (-> v1-28 prim-core collide-as) (collide-spec)) (set! (-> v1-28 prim-core collide-with) (collide-spec)) @@ -2338,7 +2336,7 @@ :event (the-as (function process int symbol event-message-block object :behavior civilian) enemy-event-handler) :enter (behavior () (logclear! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-4 nav callback-info) *nav-enemy-null-callback-info*) diff --git a/test/decompiler/reference/jak2/levels/city/common/ctyport-obs_REF.gc b/test/decompiler/reference/jak2/levels/city/common/ctyport-obs_REF.gc index c9e7eb35c9..49e74d7006 100644 --- a/test/decompiler/reference/jak2/levels/city/common/ctyport-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/ctyport-obs_REF.gc @@ -668,7 +668,7 @@ :event (the-as (function process int symbol event-message-block object :behavior boat-base) vehicle-event-handler) :enter (behavior () (logior! (-> self flags) (rigid-body-object-flag riding)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () diff --git a/test/decompiler/reference/jak2/levels/city/common/ctywide-obs_REF.gc b/test/decompiler/reference/jak2/levels/city/common/ctywide-obs_REF.gc index 1a61a3af35..a02986875c 100644 --- a/test/decompiler/reference/jak2/levels/city/common/ctywide-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/ctywide-obs_REF.gc @@ -60,155 +60,153 @@ ;; definition for method 23 of type security-wall ;; WARN: Return type mismatch int vs none. (defmethod security-wall-method-23 security-wall ((obj security-wall)) - (with-pp - (when (< (-> obj next-message-time) (-> pp clock frame-counter)) - (set! (-> obj next-message-time) - (the-as int (+ (-> pp clock frame-counter) (the int (* 300.0 (rand-vu-float-range 2.0 5.0))))) - ) - (let ((v1-6 (rand-vu-int-count 15))) - (cond - ((zero? v1-6) - (case (-> obj pass) - ((29) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) - ) - ((30) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) - ) - ((31) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) - ) - ((32) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) - ) - ) - ) - ((= v1-6 1) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) - ) - ((= v1-6 2) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) - ) - ((= v1-6 3) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) - ) - ((= v1-6 4) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) - ) - ((= v1-6 5) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) - ) - ((= v1-6 6) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) - ) - ((= v1-6 7) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) - ) - ((= v1-6 8) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) - ) - ((= v1-6 9) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) - ) - ((= v1-6 10) - (let ((v1-45 (rand-vu-int-count 3))) - (cond - ((zero? v1-45) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv035" -99.0 0) - ) - ((= v1-45 1) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv038" -99.0 0) - ) - ((= v1-45 2) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv058" -99.0 0) - ) - ) - ) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) - ) - ((= v1-6 11) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) - (let ((v1-57 (rand-vu-int-count 3))) - (cond - ((zero? v1-57) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv035" -99.0 0) - ) - ((= v1-57 1) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv038" -99.0 0) - ) - ((= v1-57 2) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv058" -99.0 0) - ) - ) - ) - ) - ((= v1-6 12) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) - (case (-> obj pass) - ((29) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) - ) - ((30) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) - ) - ((31) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) - ) - ((32) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) - ) - ) - ) - ((= v1-6 13) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) - (case (-> obj pass) - ((29) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) - ) - ((30) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) - ) - ((31) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) - ) - ((32) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) - ) - ) - ) - ((= v1-6 14) - (case (-> obj pass) - ((29) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) - ) - ((30) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) - ) - ((31) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) - ) - ((32) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) - ) - ) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) - ) + (when (< (-> obj next-message-time) (current-time)) + (set! (-> obj next-message-time) + (the-as int (+ (current-time) (the int (* 300.0 (rand-vu-float-range 2.0 5.0))))) ) - ) - (+! (-> obj message) 1) - (when (>= (-> obj message) 5) - (set! (-> obj message) 0) - 0 + (let ((v1-6 (rand-vu-int-count 15))) + (cond + ((zero? v1-6) + (case (-> obj pass) + ((29) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) + ) + ((30) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) + ) + ((31) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) + ) + ((32) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) + ) + ) + ) + ((= v1-6 1) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) + ) + ((= v1-6 2) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) + ) + ((= v1-6 3) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) + ) + ((= v1-6 4) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) + ) + ((= v1-6 5) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) + ) + ((= v1-6 6) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) + ) + ((= v1-6 7) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) + ) + ((= v1-6 8) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) + ) + ((= v1-6 9) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv012" -99.0 0) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) + ) + ((= v1-6 10) + (let ((v1-45 (rand-vu-int-count 3))) + (cond + ((zero? v1-45) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv035" -99.0 0) + ) + ((= v1-45 1) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv038" -99.0 0) + ) + ((= v1-45 2) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv058" -99.0 0) + ) + ) + ) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) + ) + ((= v1-6 11) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) + (let ((v1-57 (rand-vu-int-count 3))) + (cond + ((zero? v1-57) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv035" -99.0 0) + ) + ((= v1-57 1) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv038" -99.0 0) + ) + ((= v1-57 2) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv058" -99.0 0) + ) + ) + ) + ) + ((= v1-6 12) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv014" -99.0 0) + (case (-> obj pass) + ((29) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) + ) + ((30) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) + ) + ((31) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) + ) + ((32) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) + ) + ) + ) + ((= v1-6 13) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv011" -99.0 0) + (case (-> obj pass) + ((29) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) + ) + ((30) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) + ) + ((31) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) + ) + ((32) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) + ) + ) + ) + ((= v1-6 14) + (case (-> obj pass) + ((29) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv015" -99.0 0) + ) + ((30) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv016" -99.0 0) + ) + ((31) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv017" -99.0 0) + ) + ((32) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv018" -99.0 0) + ) + ) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) "cityv013" -99.0 0) + ) ) ) - 0 - (none) + (+! (-> obj message) 1) + (when (>= (-> obj message) 5) + (set! (-> obj message) 0) + 0 + ) ) + 0 + (none) ) ;; definition for method 24 of type security-wall @@ -1809,8 +1807,8 @@ This commonly includes things such as: (suspend) (ja :num! (seek! (ja-aframe 32.0 0))) ) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 5)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 5)) (suspend) ) ) @@ -2011,7 +2009,7 @@ This commonly includes things such as: ) (quaternion-axis-angle! (-> obj jm-turret quat) 0.0 1.0 0.0 (-> obj angle-turret)) (when (= (+ (fabs (- (-> obj angle-turret) (-> s4-1 y))) (fabs (- (-> obj angle-guns) (-> s4-1 x)))) 0.0) - (set! (-> obj next-time-shot) (+ (-> pp clock frame-counter) (seconds 1))) + (set! (-> obj next-time-shot) (+ (current-time) (seconds 1))) (set! (-> obj num-shots) (the-as uint 0)) 0 ) @@ -2045,7 +2043,7 @@ This commonly includes things such as: :virtual #t :event cty-guard-turret-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self num-shots) (the-as uint 0)) 0 (none) @@ -2065,7 +2063,7 @@ This commonly includes things such as: ((zero? (-> self next-time-shot)) (cty-guard-turret-method-35 self) ) - ((>= (-> self clock frame-counter) (-> self next-time-shot)) + ((>= (current-time) (-> self next-time-shot)) (cty-guard-turret-method-34 self) (+! (-> self num-shots) 1) (cond @@ -2074,7 +2072,7 @@ This commonly includes things such as: 0 ) (else - (set! (-> self next-time-shot) (+ (-> self clock frame-counter) (seconds 0.1))) + (set! (-> self next-time-shot) (+ (current-time) (seconds 0.1))) ) ) ) @@ -2479,30 +2477,28 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (with-pp - (set! (-> obj root) (new 'process 'trsqv)) - (set! (-> obj minimap) #f) - (set! (-> obj vehicle) (the-as handle #f)) - (set! (-> obj spawned) #f) - (process-drawable-from-entity! obj arg0) - (logclear! (-> obj mask) (process-mask actor-pause movie)) - (let ((f0-0 (res-lump-float (-> obj entity) 'rotoffset))) - (if (!= f0-0 0.0) - (quaternion-rotate-y! (-> obj root quat) (-> obj root quat) f0-0) - ) - ) - (parking-spot-method-24 obj) - (set! (-> obj test-sphere quad) (-> obj root trans quad)) - (set! (-> obj test-sphere r) 24576.0) - (set! (-> obj state-time) (-> pp clock frame-counter)) - (let ((a1-5 (get-random-parking-spot-type *traffic-engine*))) - (if (!= a1-5 (traffic-type traffic-type-21)) - (parking-spot-method-23 obj (the-as uint a1-5)) - ) - ) - (go (method-of-object obj idle)) - (none) + (set! (-> obj root) (new 'process 'trsqv)) + (set! (-> obj minimap) #f) + (set! (-> obj vehicle) (the-as handle #f)) + (set! (-> obj spawned) #f) + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause movie)) + (let ((f0-0 (res-lump-float (-> obj entity) 'rotoffset))) + (if (!= f0-0 0.0) + (quaternion-rotate-y! (-> obj root quat) (-> obj root quat) f0-0) + ) ) + (parking-spot-method-24 obj) + (set! (-> obj test-sphere quad) (-> obj root trans quad)) + (set! (-> obj test-sphere r) 24576.0) + (set! (-> obj state-time) (current-time)) + (let ((a1-5 (get-random-parking-spot-type *traffic-engine*))) + (if (!= a1-5 (traffic-type traffic-type-21)) + (parking-spot-method-23 obj (the-as uint a1-5)) + ) + ) + (go (method-of-object obj idle)) + (none) ) ;; failed to figure out what this is: @@ -2515,8 +2511,8 @@ This commonly includes things such as: ) :code (the-as (function none :behavior parking-spot) sleep-code) :post (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.25)) - (set! (-> self state-time) (-> self clock frame-counter)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.25)) + (set! (-> self state-time) (current-time)) (parking-spot-method-21 self) (when (not (-> self spawned)) (let ((f0-0 (vector-vector-distance-squared (camera-pos) (-> self test-sphere))) @@ -3421,7 +3417,7 @@ This commonly includes things such as: (add-setting! 'music-volume 'rel (-> *setting-control* user-current music-volume-movie) 0) (add-setting! 'sfx-volume 'rel (-> *setting-control* user-current sfx-movie-volume) 0) (add-setting! 'dialog-volume 'rel (-> *setting-control* user-current dialog-volume-hint) 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let* ((v1-21 (get-current-task-event (-> self task))) (gp-0 (add-process *gui-control* @@ -3435,7 +3431,7 @@ This commonly includes things such as: ) ) (while (nonzero? (get-status *gui-control* gp-0)) - (set! (-> self time) (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (set! (-> self time) (* 0.0033333334 (the float (- (current-time) (-> self state-time))))) (suspend) (when (cpad-pressed? 0 triangle) (set-action! @@ -3502,7 +3498,7 @@ This commonly includes things such as: :enter (behavior () (set-setting! 'minimap 'clear 0.0 (minimap-flag minimap)) (set! (-> self time) -1.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -3546,7 +3542,7 @@ This commonly includes things such as: (vf7 :class vf) ) (init-vf0-vector) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.5)) + (when (>= (- (current-time) (-> self state-time)) (seconds 1.5)) (let ((gp-0 0) (s5-0 0) ) diff --git a/test/decompiler/reference/jak2/levels/city/common/ctywide-tasks_REF.gc b/test/decompiler/reference/jak2/levels/city/common/ctywide-tasks_REF.gc index e1d46ffe59..70a9ae594e 100644 --- a/test/decompiler/reference/jak2/levels/city/common/ctywide-tasks_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/ctywide-tasks_REF.gc @@ -42,8 +42,8 @@ TASK_MANAGER_COMPLETE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (none) @@ -92,8 +92,8 @@ (lambda :behavior task-manager () (send-event (handle->process (-> self arrow)) 'leave) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (none) @@ -185,8 +185,8 @@ (the-as sound-id (talker-spawn-func (-> *talker-speech* 38) *entity-pool* (target-pos 0) (the-as region #f))) ) (wait-for-speech-end (-> self sound-id 0)) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -240,8 +240,8 @@ (the-as sound-id (talker-spawn-func (-> *talker-speech* 31) *entity-pool* (target-pos 0) (the-as region #f))) ) (wait-for-speech-end (-> self sound-id 0)) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -252,8 +252,8 @@ (the-as sound-id (talker-spawn-func (-> *talker-speech* 35) *entity-pool* (target-pos 0) (the-as region #f))) ) (wait-for-speech-end (-> self sound-id 0)) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 1)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 1)) (suspend) ) ) @@ -277,8 +277,8 @@ ) (wait-for-speech-end (-> self sound-id 0)) (set! (-> self sub-state) (the-as uint 2)) - (let ((gp-6 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-6) (seconds 1)) + (let ((gp-6 (current-time))) + (until (>= (- (current-time) gp-6) (seconds 1)) (suspend) ) ) @@ -329,7 +329,7 @@ ) ) (else - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ) ) @@ -350,7 +350,7 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 60)) + (until (>= (- (current-time) (-> self state-time)) (seconds 60)) (suspend) ) (set! (-> self sub-state) (the-as uint 1)) @@ -358,8 +358,8 @@ (the-as sound-id (talker-spawn-func (-> *talker-speech* 35) *entity-pool* (target-pos 0) (the-as region #f))) ) (wait-for-speech-end (-> self sound-id 0)) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -376,8 +376,8 @@ (the-as sound-id (talker-spawn-func (-> *talker-speech* 37) *entity-pool* (target-pos 0) (the-as region #f))) ) (wait-for-speech-end (-> self sound-id 0)) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 3)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 3)) (suspend) ) ) @@ -474,7 +474,7 @@ ) ) (set-setting! 'airlock #f 0.0 0) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (none) ) ) @@ -490,8 +490,8 @@ (send-event *traffic-manager* 'set-alert-duration 9000) (send-event *target* 'end-mode) (set-setting! 'pilot #f 0.0 0) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (script-eval '(send-event "keira-npc-1" 'say)) @@ -810,7 +810,7 @@ (set! (-> self arrow) (process->handle a0-20)) ) ) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (set! (-> self time-limit) (the-as time-frame (the int (-> gp-0 time)))) ) (none) @@ -866,8 +866,8 @@ () (send-event *target* 'end-mode) (set-setting! 'pilot #f 0.0 0) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (close! (-> self node-info) 'event) diff --git a/test/decompiler/reference/jak2/levels/city/common/guard_REF.gc b/test/decompiler/reference/jak2/levels/city/common/guard_REF.gc index 6903a9c0ee..0916db40a8 100644 --- a/test/decompiler/reference/jak2/levels/city/common/guard_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/guard_REF.gc @@ -627,193 +627,191 @@ (defmethod general-event-handler crimson-guard ((obj crimson-guard) (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" - (with-pp - (let ((v1-0 arg2)) - (the-as - object - (cond - ((or (= v1-0 'hit) (= v1-0 'hit-flinch) (= v1-0 'hit-knocked)) - (speech-control-method-13 *speech-control* (the-as handle obj)) - (logior! (-> obj flags) (citizen-flag hostile)) - (let* ((s0-0 (handle->process (-> obj incoming attacker-handle))) - (s1-0 (if (type? s0-0 process-focusable) - s0-0 - ) - ) - ) - (when s1-0 - (speech-control-method-12 *speech-control* obj (speech-type speech-type-0 speech-type-1 speech-type-3)) - (trigger-alert obj 1 (the-as target s1-0)) - ) - ) - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - ((= v1-0 'event-death) - (if (zero? (-> obj hit-points)) - (the-as object (do-effect (-> obj skel effect) 'death-default 0.0 -1)) - ) - ) - ((= v1-0 'bouncing-off) - (when (or (and (-> obj next-state) (= (-> obj next-state name) 'active)) - (and (-> obj next-state) (= (-> obj next-state name) 'wait)) - ) - (speech-control-method-12 *speech-control* obj (speech-type speech-type-1 speech-type-2 speech-type-3)) - (go (method-of-object obj close-attack-active)) - ) - ) - ((= v1-0 'combo) - (and (not (and (-> obj next-state) (= (-> obj next-state name) 'inactive))) - (and (not (logtest? (enemy-flag multi-focus) (-> obj enemy-flags))) (nonzero? (-> obj hit-points))) - ) - ) - ((= v1-0 'avoid) - #f - ) - ((= v1-0 'panic) - (set! (-> obj last-danger-time) (-> pp clock frame-counter)) - (let ((v1-38 (the-as traffic-danger-info (-> arg3 param 0)))) - (case (-> v1-38 danger-type) - (((traffic-danger-type tdt7)) - (set! (-> obj cp-factor) 20.0) - (let ((s5-1 (method-of-object obj trigger-alert)) - (s4-1 1) - (s3-1 (handle->process (-> v1-38 handle))) - ) - (the-as object (s5-1 obj s4-1 (the-as target (if (type? s3-1 process-focusable) - s3-1 - ) - ) - ) + (let ((v1-0 arg2)) + (the-as + object + (cond + ((or (= v1-0 'hit) (= v1-0 'hit-flinch) (= v1-0 'hit-knocked)) + (speech-control-method-13 *speech-control* (the-as handle obj)) + (logior! (-> obj flags) (citizen-flag hostile)) + (let* ((s0-0 (handle->process (-> obj incoming attacker-handle))) + (s1-0 (if (type? s0-0 process-focusable) + s0-0 ) - ) + ) ) - ) + (when s1-0 + (speech-control-method-12 *speech-control* obj (speech-type speech-type-0 speech-type-1 speech-type-3)) + (trigger-alert obj 1 (the-as target s1-0)) ) ) - ((= v1-0 'clear-path) - (set! (-> obj last-danger-time) (-> pp clock frame-counter)) - (let ((v1-44 (the-as traffic-danger-info (-> arg3 param 0)))) - (set! (-> obj cp-valid?) #t) - (set! (-> obj cp-sphere quad) (-> v1-44 sphere quad)) - (set! (-> obj cp-vec quad) (-> v1-44 velocity quad)) - (case (-> v1-44 danger-type) - (((traffic-danger-type tdt0)) - (trigger-alert obj 1 *target*) - ) - (((traffic-danger-type tdt1)) - ) - (((traffic-danger-type tdt2)) - ) - (((traffic-danger-type tdt3)) - ) - (((traffic-danger-type tdt4)) - ) - (((traffic-danger-type tdt5)) - ) - (((traffic-danger-type tdt6)) - ) - (((traffic-danger-type tdt7)) - (trigger-alert obj 1 *target*) - ) - ) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ((= v1-0 'event-death) + (if (zero? (-> obj hit-points)) + (the-as object (do-effect (-> obj skel effect) 'death-default 0.0 -1)) ) - (let ((s5-2 (-> obj cp-plane))) - (set! (-> s5-2 quad) (-> obj cp-vec quad)) - (set! (-> s5-2 y) 0.0) - (vector-rotate90-around-y! s5-2 s5-2) - (vector-normalize! s5-2 1.0) - (set! (-> s5-2 w) (- (vector-dot (the-as vector s5-2) (the-as vector (-> obj cp-sphere))))) - ) - (let ((v0-4 (the-as object (+ (-> pp clock frame-counter) (seconds 1))))) - (set! (-> obj cp-exit-time) (the-as time-frame v0-4)) - v0-4 - ) - ) - ((= v1-0 'end-pursuit) - (when *debug-segment* - (when (focus-test? obj inactive) - (format 0 "guard::event end-pursuit recieved by inactive process ~d~%" (-> obj pid)) - (break!) - 0 - ) - ) - (when (not (focus-test? obj dead)) - (when (logtest? (-> obj flags) (citizen-flag hostile)) - (logclear! (-> obj flags) (citizen-flag persistent in-pursuit hostile)) - (citizen-method-195 obj (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> obj root-override2 quat))) - (go (method-of-object obj active)) - ) - ) - ) - ((= v1-0 'alert-begin) - (when *debug-segment* - (when (focus-test? obj inactive) - (format 0 "guard::event alert-begin recieved by inactive process ~d~%" (-> obj pid)) - (break!) - 0 - ) - ) - (when (not (focus-test? obj dead)) - (when (not (logtest? (-> obj flags) (citizen-flag hostile))) - (let ((a1-27 (the-as object (-> arg3 param 0)))) - (when (and (the-as uint a1-27) - (not (logtest? (-> (the-as process-focusable a1-27) focus-status) (focus-status disable dead inactive))) - ) - (set! (-> obj traffic-target-status handle) (process->handle (the-as process-focusable a1-27))) - (try-update-focus (-> obj focus) (the-as process-focusable a1-27) obj) - (if (and (not (and (-> obj next-state) (= (-> obj next-state name) 'jump))) - (not (and (-> obj next-state) (= (-> obj next-state name) 'exit-transport))) - ) - (the-as object (go-hostile obj)) - ) + ) + ((= v1-0 'bouncing-off) + (when (or (and (-> obj next-state) (= (-> obj next-state name) 'active)) + (and (-> obj next-state) (= (-> obj next-state name) 'wait)) ) - ) - ) - ) + (speech-control-method-12 *speech-control* obj (speech-type speech-type-1 speech-type-2 speech-type-3)) + (go (method-of-object obj close-attack-active)) ) - ((= v1-0 'alert-end) - (when *debug-segment* - (when (focus-test? obj inactive) - (format 0 "guard::event alert-end recieved by inactive process ~d~%" (-> obj pid)) - (break!) - 0 - ) - ) - (when (not (focus-test? obj dead)) - (when (logtest? (-> obj flags) (citizen-flag hostile)) - (logclear! (-> obj flags) (citizen-flag persistent in-pursuit hostile)) - (speech-control-method-12 *speech-control* obj (speech-type speech-type-0 speech-type-2)) - (citizen-method-195 obj (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> obj root-override2 quat))) - (go (method-of-object obj active)) - ) - ) - ) - ((= v1-0 'track) - (if (and (-> obj next-state) (let ((v1-129 (-> obj next-state name))) - (or (= v1-129 'exit-transport) (= v1-129 'jump)) - ) + ) + ((= v1-0 'combo) + (and (not (and (-> obj next-state) (= (-> obj next-state name) 'inactive))) + (and (not (logtest? (enemy-flag multi-focus) (-> obj enemy-flags))) (nonzero? (-> obj hit-points))) + ) + ) + ((= v1-0 'avoid) + #f + ) + ((= v1-0 'panic) + (set! (-> obj last-danger-time) (current-time)) + (let ((v1-38 (the-as traffic-danger-info (-> arg3 param 0)))) + (case (-> v1-38 danger-type) + (((traffic-danger-type tdt7)) + (set! (-> obj cp-factor) 20.0) + (let ((s5-1 (method-of-object obj trigger-alert)) + (s4-1 1) + (s3-1 (handle->process (-> v1-38 handle))) ) - #f - #t - ) + (the-as object (s5-1 obj s4-1 (the-as target (if (type? s3-1 process-focusable) + s3-1 + ) + ) + ) + ) + ) + ) + ) ) - ((= v1-0 'notify) - (let ((a0-84 (-> arg3 param 0)) - (v1-130 (the-as object (-> arg3 param 1))) - ) - (when (= a0-84 'attack) - (when (logtest? (-> (the-as process-focusable v1-130) mask) (process-mask target)) - (when (focus-test? (the-as process-focusable v1-130) dead) - (format #t "guard killed player~%") - (the-as object (speech-control-method-12 *speech-control* obj (speech-type speech-type-1 speech-type-3))) - ) + ) + ((= v1-0 'clear-path) + (set! (-> obj last-danger-time) (current-time)) + (let ((v1-44 (the-as traffic-danger-info (-> arg3 param 0)))) + (set! (-> obj cp-valid?) #t) + (set! (-> obj cp-sphere quad) (-> v1-44 sphere quad)) + (set! (-> obj cp-vec quad) (-> v1-44 velocity quad)) + (case (-> v1-44 danger-type) + (((traffic-danger-type tdt0)) + (trigger-alert obj 1 *target*) + ) + (((traffic-danger-type tdt1)) + ) + (((traffic-danger-type tdt2)) + ) + (((traffic-danger-type tdt3)) + ) + (((traffic-danger-type tdt4)) + ) + (((traffic-danger-type tdt5)) + ) + (((traffic-danger-type tdt6)) + ) + (((traffic-danger-type tdt7)) + (trigger-alert obj 1 *target*) + ) + ) + ) + (let ((s5-2 (-> obj cp-plane))) + (set! (-> s5-2 quad) (-> obj cp-vec quad)) + (set! (-> s5-2 y) 0.0) + (vector-rotate90-around-y! s5-2 s5-2) + (vector-normalize! s5-2 1.0) + (set! (-> s5-2 w) (- (vector-dot (the-as vector s5-2) (the-as vector (-> obj cp-sphere))))) + ) + (let ((v0-4 (the-as object (+ (current-time) (seconds 1))))) + (set! (-> obj cp-exit-time) (the-as time-frame v0-4)) + v0-4 + ) + ) + ((= v1-0 'end-pursuit) + (when *debug-segment* + (when (focus-test? obj inactive) + (format 0 "guard::event end-pursuit recieved by inactive process ~d~%" (-> obj pid)) + (break!) + 0 + ) + ) + (when (not (focus-test? obj dead)) + (when (logtest? (-> obj flags) (citizen-flag hostile)) + (logclear! (-> obj flags) (citizen-flag persistent in-pursuit hostile)) + (citizen-method-195 obj (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> obj root-override2 quat))) + (go (method-of-object obj active)) + ) + ) + ) + ((= v1-0 'alert-begin) + (when *debug-segment* + (when (focus-test? obj inactive) + (format 0 "guard::event alert-begin recieved by inactive process ~d~%" (-> obj pid)) + (break!) + 0 + ) + ) + (when (not (focus-test? obj dead)) + (when (not (logtest? (-> obj flags) (citizen-flag hostile))) + (let ((a1-27 (the-as object (-> arg3 param 0)))) + (when (and (the-as uint a1-27) + (not (logtest? (-> (the-as process-focusable a1-27) focus-status) (focus-status disable dead inactive))) + ) + (set! (-> obj traffic-target-status handle) (process->handle (the-as process-focusable a1-27))) + (try-update-focus (-> obj focus) (the-as process-focusable a1-27) obj) + (if (and (not (and (-> obj next-state) (= (-> obj next-state name) 'jump))) + (not (and (-> obj next-state) (= (-> obj next-state name) 'exit-transport))) + ) + (the-as object (go-hostile obj)) + ) ) ) ) ) - (else - ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) - ) + ) + ((= v1-0 'alert-end) + (when *debug-segment* + (when (focus-test? obj inactive) + (format 0 "guard::event alert-end recieved by inactive process ~d~%" (-> obj pid)) + (break!) + 0 + ) + ) + (when (not (focus-test? obj dead)) + (when (logtest? (-> obj flags) (citizen-flag hostile)) + (logclear! (-> obj flags) (citizen-flag persistent in-pursuit hostile)) + (speech-control-method-12 *speech-control* obj (speech-type speech-type-0 speech-type-2)) + (citizen-method-195 obj (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> obj root-override2 quat))) + (go (method-of-object obj active)) + ) + ) + ) + ((= v1-0 'track) + (if (and (-> obj next-state) (let ((v1-129 (-> obj next-state name))) + (or (= v1-129 'exit-transport) (= v1-129 'jump)) + ) + ) + #f + #t + ) + ) + ((= v1-0 'notify) + (let ((a0-84 (-> arg3 param 0)) + (v1-130 (the-as object (-> arg3 param 1))) + ) + (when (= a0-84 'attack) + (when (logtest? (-> (the-as process-focusable v1-130) mask) (process-mask target)) + (when (focus-test? (the-as process-focusable v1-130) dead) + (format #t "guard killed player~%") + (the-as object (speech-control-method-12 *speech-control* obj (speech-type speech-type-1 speech-type-3))) + ) + ) + ) + ) + ) + (else + ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -830,7 +828,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior crimson-guard) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -904,7 +902,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior crimson-guard) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1836,7 +1834,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior crimson-guard) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -1990,7 +1988,7 @@ (t9-1) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-11 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-11 enemy-flags))) (set! (-> v1-11 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-11 enemy-flags)))) @@ -2086,9 +2084,7 @@ (when (and (< (-> self target-self-xz-dist) 163840.0) (or (< 40960.0 (-> self target-self-xz-dist)) (>= 2 (the-as int (-> self focus aware)))) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) - (the int (* 300.0 (get-rand-float-range self 1.0 3.0))) - ) + (if (and (>= (- (current-time) (-> self state-time)) (the int (* 300.0 (get-rand-float-range self 1.0 3.0)))) (logtest? (-> self flags) (citizen-flag target-in-sight)) ) (go-virtual gun-shoot) @@ -2291,8 +2287,8 @@ (set! (-> a0-9 velocity quad) (-> v1-15 quad)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-time-see-target) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self last-time-see-target) (current-time)) (crimson-guard-method-220 self) (set! (-> self miss-amount) (lerp-scale 0.0 16384.0 (-> self target-self-dist) 40960.0 122880.0)) (set! (-> self miss-amount) 16384.0) @@ -2301,7 +2297,7 @@ (set! (-> self miss-amount) 0.0) ) ) - (set! (-> self next-shot) (the-as int (-> self clock frame-counter))) + (set! (-> self next-shot) (the-as int (current-time))) (set! (-> self joint-enable) #t) (none) ) @@ -2329,7 +2325,7 @@ ) (go-virtual close-attack) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (or (not (logtest? (-> self flags) (citizen-flag target-in-sight))) (< 184320.0 (-> self target-self-xz-dist)) (< 10922.667 (fabs (-> self target-y-angle))) @@ -2368,7 +2364,7 @@ (set! v1-35 #t) (goto cfg-10) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 1)) (set! v1-35 #f) (goto cfg-10) ) @@ -2376,7 +2372,7 @@ (b! (not #f) cfg-3 :delay (set! v1-35 #f)) (label cfg-10) (when v1-35 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 3)) (until #f (ja-channel-push! 1 (seconds 0.1)) @@ -2753,10 +2749,10 @@ (set! (-> a0-9 velocity quad) (-> v1-12 quad)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-time-see-target) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self last-time-see-target) (current-time)) (set! (-> self miss-amount) 0.0) - (set! (-> self next-shot) (the-as int (-> self clock frame-counter))) + (set! (-> self next-shot) (the-as int (current-time))) (set! (-> self joint-enable) #t) (crimson-guard-method-221 self) (none) @@ -2854,9 +2850,9 @@ (set! (-> a0-9 velocity quad) (-> v1-12 quad)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self miss-amount) 0.0) - (set! (-> self next-shot) (the-as int (-> self clock frame-counter))) + (set! (-> self next-shot) (the-as int (current-time))) (set! (-> self joint-enable) #t) (crimson-guard-method-221 self) (none) @@ -3332,7 +3328,7 @@ ) 0 (set! (-> self miss-amount) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self lazer-sound) (the-as uint 0)) 0 (none) @@ -3373,7 +3369,7 @@ ) :trans (behavior () (crimson-guard-method-220 self) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (or (< 32768.0 (-> self target-self-xz-dist)) (not (logtest? (-> self flags) (citizen-flag target-in-sight)))) ) (go-hostile self) @@ -3400,7 +3396,7 @@ ) (let ((gp-2 #t)) (until #f - (while (or (< 7281.778 (fabs (-> self target-y-angle))) (>= (-> self next-shot) (-> self clock frame-counter))) + (while (or (< 7281.778 (fabs (-> self target-y-angle))) (>= (-> self next-shot) (current-time))) (when gp-2 ) (speech-control-method-12 *speech-control* self (speech-type speech-type-0 speech-type-3)) @@ -3459,7 +3455,7 @@ (suspend) (ja :num! (loop!)) (set! v1-94 - (or (< (-> self clock frame-counter) (-> self next-shot)) + (or (< (current-time) (-> self next-shot)) (< (-> self target-self-xz-dist) 16384.0) (not (and (handle->process (-> self focus handle)) (not (logtest? (-> (the-as process-focusable (handle->process (-> self focus handle))) focus-status) @@ -3501,7 +3497,7 @@ (ja :num! (seek!)) ) (crimson-guard-method-221 self) - (set! (-> self next-shot) (the-as int (+ (-> self clock frame-counter) (seconds 0.1)))) + (set! (-> self next-shot) (the-as int (+ (current-time) (seconds 0.1)))) (let ((v1-155 (-> (the-as collide-shape-prim-group (-> self root-override2 root-prim)) child 2))) (logior! (-> v1-155 prim-core action) (collide-action deadly)) ) @@ -3530,12 +3526,12 @@ ) (set! (-> v1-158 state mode) (the-as lightning-mode a0-56)) ) - (let ((s5-1 (-> self clock frame-counter)) + (let ((s5-1 (current-time)) (s4-1 150) (f30-1 1.0) ) (ja-no-eval :group! (-> self draw art-group data 22) :num! (loop! f30-1) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) s5-1) s4-1) + (until (>= (- (current-time) s5-1) s4-1) (crimson-guard-method-222 self) (suspend) (ja :num! (loop! f30-1)) @@ -3574,7 +3570,7 @@ ) ) (else - (set! (-> self next-shot) (the-as int (+ (-> self clock frame-counter) (seconds 1)))) + (set! (-> self next-shot) (the-as int (+ (current-time) (seconds 1)))) (suspend) 0 ) @@ -3871,7 +3867,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior crimson-guard) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self nav flags) (nav-control-flag output-sphere-hash)) (logclear! (-> self flags) (citizen-flag hostile)) (nav-enemy-method-166 self) @@ -3949,18 +3945,15 @@ (while (not (-> self already-shot)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (ja-channel-set! 1) - (let ((gp-0 (-> self clock frame-counter)) + (let ((gp-0 (current-time)) (s5-0 150) (f30-0 2.0) ) (ja-no-eval :group! (-> self draw art-group data 6) :num! (loop! f30-0) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-0) s5-0) - (crimson-guard-method-223 - self - (* 0.006666667 (the float (- (-> self clock frame-counter) (-> self state-time)))) - ) + (until (>= (- (current-time) gp-0) s5-0) + (crimson-guard-method-223 self (* 0.006666667 (the float (- (current-time) (-> self state-time))))) (suspend) (ja :num! (loop! f30-0)) ) diff --git a/test/decompiler/reference/jak2/levels/city/common/metalhead-flitter_REF.gc b/test/decompiler/reference/jak2/levels/city/common/metalhead-flitter_REF.gc index 0f7c79b0a7..836ce0e365 100644 --- a/test/decompiler/reference/jak2/levels/city/common/metalhead-flitter_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/metalhead-flitter_REF.gc @@ -411,15 +411,15 @@ ) ) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 0.6)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 0.6)) (suspend) ) ) (set! (-> self root-override2 trans y) (+ -8192.0 (-> self root-override2 trans y))) (logior! (-> self draw status) (draw-control-status no-draw)) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) (suspend) ) ) @@ -450,7 +450,7 @@ ) 0 (look-at-target! self (enemy-flag lock-focus)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (-> self root-override2))) (vector-reset! (-> gp-0 transv)) (set! (-> gp-0 transv y) (* 4096.0 (get-rand-float-range self 34.0 38.0))) @@ -565,88 +565,84 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod metalhead-flitter-method-205 metalhead-flitter ((obj metalhead-flitter)) - (with-pp - (let* ((s5-0 (handle->process (-> obj focus handle))) - (s3-0 (if (type? s5-0 process-focusable) - s5-0 - ) - ) + (let* ((s5-0 (handle->process (-> obj focus handle))) + (s3-0 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when s3-0 + (let* ((s5-1 (get-trans (the-as process-focusable s3-0) 0)) + (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-1 (-> obj root-override2 trans))) + (f30-0 (vector-length s4-1)) + ) + (cond + ((enemy-method-99 obj (the-as process-focusable s3-0)) + (go-flee obj) ) - (when s3-0 - (let* ((s5-1 (get-trans (the-as process-focusable s3-0) 0)) - (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-1 (-> obj root-override2 trans))) - (f30-0 (vector-length s4-1)) - ) - (cond - ((enemy-method-99 obj (the-as process-focusable s3-0)) - (go-flee obj) - ) - ((and (< f30-0 32768.0) (not (metalhead-flitter-method-207 obj (the-as process-focusable s3-0)))) - (go (method-of-object obj circling)) - ) - ((< f30-0 (-> obj enemy-info-override notice-nav-radius)) - (set! (-> obj target-pos quad) (-> s5-1 quad)) - (let ((s3-1 (new 'stack-no-clear 'vector))) - (set! (-> s3-1 quad) (-> s4-1 quad)) - (let ((s5-2 (new 'stack-no-clear 'vector))) - (set! (-> s5-2 quad) (-> obj root-override2 transv quad)) - (vector-normalize! s5-2 f30-0) - (if (>= (vector-dot s3-1 s5-2) 0.98) - (go (method-of-object obj attack)) - ) - ) - ) - ) - ((< f30-0 32768.0) - (set! (-> obj target-pos quad) (-> s5-1 quad)) - ) - ((or (>= (- (-> pp clock frame-counter) (the-as int (-> obj last-change-dir))) (-> obj change-dir-time)) - (< (vector-vector-distance-squared (-> obj root-override2 trans) (-> obj target-pos)) 0.1) - ) - (set! (-> obj last-change-dir) (the-as uint (-> pp clock frame-counter))) - (set! (-> obj change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) - (let ((s3-2 (new 'stack-no-clear 'vector)) - (f0-9 (* 0.5 f30-0 (tan (-> obj move-angle)))) - (s2-0 (new 'stack-no-clear 'vector)) + ((and (< f30-0 32768.0) (not (metalhead-flitter-method-207 obj (the-as process-focusable s3-0)))) + (go (method-of-object obj circling)) + ) + ((< f30-0 (-> obj enemy-info-override notice-nav-radius)) + (set! (-> obj target-pos quad) (-> s5-1 quad)) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (set! (-> s3-1 quad) (-> s4-1 quad)) + (let ((s5-2 (new 'stack-no-clear 'vector))) + (set! (-> s5-2 quad) (-> obj root-override2 transv quad)) + (vector-normalize! s5-2 f30-0) + (if (>= (vector-dot s3-1 s5-2) 0.98) + (go (method-of-object obj attack)) ) - (if (-> obj heading) - (set-vector! s3-2 (-> s4-1 z) (-> s4-1 y) (- (-> s4-1 x)) 1.0) - (set-vector! s3-2 (- (-> s4-1 z)) (-> s4-1 y) (-> s4-1 x) 1.0) - ) - (set! (-> obj heading) (not (-> obj heading))) - (let ((f28-1 (rand-vu-float-range (* 0.75 f0-9) f0-9)) - (s4-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s4-1 (* -0.6 f30-0))) - ) - (vector-normalize! s3-2 f28-1) - (vector+! s3-2 s3-2 s4-2) - ) - (clamp-vector-to-mesh-cross-gaps (-> obj nav state) s3-2) - (vector+! s2-0 s5-1 s3-2) - (set! (-> obj target-pos quad) (-> s2-0 quad)) ) ) - ) + ) + ((< f30-0 32768.0) + (set! (-> obj target-pos quad) (-> s5-1 quad)) + ) + ((or (>= (- (current-time) (the-as int (-> obj last-change-dir))) (-> obj change-dir-time)) + (< (vector-vector-distance-squared (-> obj root-override2 trans) (-> obj target-pos)) 0.1) + ) + (set! (-> obj last-change-dir) (the-as uint (current-time))) + (set! (-> obj change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) + (let ((s3-2 (new 'stack-no-clear 'vector)) + (f0-9 (* 0.5 f30-0 (tan (-> obj move-angle)))) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (if (-> obj heading) + (set-vector! s3-2 (-> s4-1 z) (-> s4-1 y) (- (-> s4-1 x)) 1.0) + (set-vector! s3-2 (- (-> s4-1 z)) (-> s4-1 y) (-> s4-1 x) 1.0) + ) + (set! (-> obj heading) (not (-> obj heading))) + (let ((f28-1 (rand-vu-float-range (* 0.75 f0-9) f0-9)) + (s4-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s4-1 (* -0.6 f30-0))) + ) + (vector-normalize! s3-2 f28-1) + (vector+! s3-2 s3-2 s4-2) + ) + (clamp-vector-to-mesh-cross-gaps (-> obj nav state) s3-2) + (vector+! s2-0 s5-1 s3-2) + (set! (-> obj target-pos quad) (-> s2-0 quad)) + ) + ) ) - 0 ) + 0 ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 206 of type metalhead-flitter ;; WARN: Return type mismatch time-frame vs none. (defmethod metalhead-flitter-method-206 metalhead-flitter ((obj metalhead-flitter)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (the-as int (-> obj amb-sound-timer))) - (the int (* 300.0 (rand-vu-float-range 1.5 3.0))) - ) - (sound-play "flitter-amb" :position (-> obj root-override2 trans)) - (set! (-> obj amb-sound-timer) (the-as uint (-> pp clock frame-counter))) - ) - (none) + (when (>= (- (current-time) (the-as int (-> obj amb-sound-timer))) + (the int (* 300.0 (rand-vu-float-range 1.5 3.0))) + ) + (sound-play "flitter-amb" :position (-> obj root-override2 trans)) + (set! (-> obj amb-sound-timer) (the-as uint (current-time))) ) + (none) ) ;; definition for function metalhead-flitter-fall-and-play-death-anim @@ -663,7 +659,7 @@ ) (set! (-> self root-override2 transv y) 33775.48) (ja :num-func num-func-identity :frame-num 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self root-override2 status) (collide-status on-surface on-ground touch-surface)) (until v1-29 (let ((f0-2 102400.0)) @@ -672,7 +668,7 @@ ) (suspend) (ja :num! (seek! max arg1)) - (set! v1-29 (or (ja-done? 0) (>= (- (-> self clock frame-counter) (-> self state-time)) arg2))) + (set! v1-29 (or (ja-done? 0) (>= (- (current-time) (-> self state-time)) arg2))) ) ) ) @@ -767,9 +763,9 @@ (defstate hostile (metalhead-flitter) :virtual #t :enter (behavior () - (set! (-> self last-change-dir) (the-as uint (-> self clock frame-counter))) + (set! (-> self last-change-dir) (the-as uint (current-time))) (set! (-> self change-dir-time) 0) - (set! (-> self attack-time) (+ (-> self clock frame-counter) (seconds 0.35))) + (set! (-> self attack-time) (+ (current-time) (seconds 0.35))) (let ((t9-0 (-> (method-of-type citizen-enemy hostile) enter))) (if t9-0 (t9-0) @@ -838,7 +834,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -877,7 +873,7 @@ (set! s5-2 (cond ((and gp-0 - (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.5)) + (< (- (current-time) (-> self state-time)) (seconds 1.5)) gp-0 (not (logtest? (-> (the-as process-focusable gp-0) focus-status) (focus-status disable dead ignore grabbed))) ) @@ -1041,7 +1037,7 @@ (t9-0) ) ) - (set! (-> self off-screen-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self off-screen-timer) (the-as uint (current-time))) (none) ) :trans (behavior () @@ -1049,7 +1045,7 @@ (if gp-0 (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable gp-0) 0) quad)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((v1-11 (-> self focus aware))) (cond ((= v1-11 (enemy-aware enemy-aware-3)) @@ -1066,14 +1062,12 @@ ) ) ) - (if (and (get-enemy-target self) - (>= (- (-> self clock frame-counter) (the-as int (-> self off-screen-timer))) (seconds 0.3)) - ) + (if (and (get-enemy-target self) (>= (- (current-time) (the-as int (-> self off-screen-timer))) (seconds 0.3))) (go-hostile self) ) ) (else - (set! (-> self off-screen-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self off-screen-timer) (the-as uint (current-time))) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/common/metalhead-grunt_REF.gc b/test/decompiler/reference/jak2/levels/city/common/metalhead-grunt_REF.gc index 6de1e46002..a8ffadc8cf 100644 --- a/test/decompiler/reference/jak2/levels/city/common/metalhead-grunt_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/metalhead-grunt_REF.gc @@ -722,7 +722,7 @@ ) ) (let ((a0-1 (metalhead-grunt-method-209 self 13312.0)) - (gp-0 (-> self clock frame-counter)) + (gp-0 (current-time)) ) (when (and (>= gp-0 (-> self next-warn-time)) (not (logtest? (-> self draw status) (draw-control-status on-screen))) diff --git a/test/decompiler/reference/jak2/levels/city/common/pilot-states_REF.gc b/test/decompiler/reference/jak2/levels/city/common/pilot-states_REF.gc index 80b5b87b3c..c9f75e8e46 100644 --- a/test/decompiler/reference/jak2/levels/city/common/pilot-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/pilot-states_REF.gc @@ -169,7 +169,7 @@ (vector-rotate*! (-> gp-0 local-accel) (-> s4-0 0) (the-as matrix (-> s4-0 1))) ) (vehicle-method-116 (the-as vehicle s5-0) (the-as (pointer vehicle-controls) (-> gp-0 controls))) - (let ((f30-0 (* 182.04445 (* 0.6 (the float (-> self clock frame-counter))))) + (let ((f30-0 (* 182.04445 (* 0.6 (the float (current-time))))) (s5-1 (-> gp-0 local-accel)) ) (let ((f3-0 @@ -830,7 +830,7 @@ ) :code (behavior ((arg0 symbol) (arg1 attack-info)) (local-vars (sv-16 attack-info)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self neck flex-blend) 0.0) (set! sv-16 (-> self attack-info)) (let ((v1-4 sv-16)) @@ -889,8 +889,8 @@ (logior! (-> self focus-status) (focus-status dead)) (case arg0 (('melt 'grenade 'explode) - (let ((s5-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-0) (seconds 0.2)) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) (seconds 0.2)) (suspend) ) ) @@ -1016,8 +1016,8 @@ ) 0 (ja-channel-set! 0) - (let ((s5-7 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-7) (seconds 1.8)) + (let ((s5-7 (current-time))) + (until (>= (- (current-time) s5-7) (seconds 1.8)) (suspend) ) ) @@ -1049,8 +1049,8 @@ ) ) ) - (let ((s5-9 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-9) (seconds 0.5)) + (let ((s5-9 (current-time))) + (until (>= (- (current-time) s5-9) (seconds 0.5)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/common/traffic-engine_REF.gc b/test/decompiler/reference/jak2/levels/city/common/traffic-engine_REF.gc index e39c91024b..e7d3916171 100644 --- a/test/decompiler/reference/jak2/levels/city/common/traffic-engine_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/traffic-engine_REF.gc @@ -1284,89 +1284,87 @@ Process is recycled and moved to reserved, if it deactivates." ;; definition for method 66 of type traffic-engine ;; WARN: Return type mismatch int vs none. (defmethod update-sync-from-frame-counter traffic-engine ((obj traffic-engine)) - (with-pp - (+! (-> obj sync-clock) 1) - (set! (-> obj sync-mask-8) (the-as uint (ash 1 (logand (-> obj sync-clock) 7)))) - (set! (-> obj sync-mask-16) (the-as uint (ash 1 (logand (-> obj sync-clock) 15)))) - (set! (-> obj sync-mask-32) (the-as uint (ash 1 (logand (-> obj sync-clock) 31)))) - (let ((v1-10 (/ (-> pp clock frame-counter) 300))) - (set! (-> obj sync-array 0) (the-as uint 255)) - (let ((a1-12 (mod v1-10 20))) - (set! (-> obj sync-array 1) (the-as uint (cond - ((>= 6 a1-12) - 1 - ) - ((>= 9 a1-12) - 2 - ) - ((>= 16 a1-12) - 4 - ) - (else - 8 - ) + (+! (-> obj sync-clock) 1) + (set! (-> obj sync-mask-8) (the-as uint (ash 1 (logand (-> obj sync-clock) 7)))) + (set! (-> obj sync-mask-16) (the-as uint (ash 1 (logand (-> obj sync-clock) 15)))) + (set! (-> obj sync-mask-32) (the-as uint (ash 1 (logand (-> obj sync-clock) 31)))) + (let ((v1-10 (/ (current-time) 300))) + (set! (-> obj sync-array 0) (the-as uint 255)) + (let ((a1-12 (mod v1-10 20))) + (set! (-> obj sync-array 1) (the-as uint (cond + ((>= 6 a1-12) + 1 + ) + ((>= 9 a1-12) + 2 + ) + ((>= 16 a1-12) + 4 + ) + (else + 8 ) - ) - ) - ) - (let ((a1-15 (mod v1-10 30))) - (set! (-> obj sync-array 2) (the-as uint (cond - ((>= 6 a1-15) - 1 - ) - ((>= 9 a1-15) - 2 - ) - ((>= 16 a1-15) - 4 - ) - ((>= 19 a1-15) - 8 - ) - ((>= 26 a1-15) - 16 - ) - (else - 32 - ) - ) - ) - ) - ) - (let ((v1-11 (mod v1-10 40))) - (set! (-> obj sync-array 3) (the-as uint (cond - ((>= 6 v1-11) - 1 - ) - ((>= 9 v1-11) - 2 - ) - ((>= 16 v1-11) - 4 - ) - ((>= 19 v1-11) - 8 - ) - ((>= 26 v1-11) - 16 - ) - ((>= 29 v1-11) - 32 - ) - ((>= 36 v1-11) - 64 - ) - (else - 128 - ) - ) - ) - ) - ) + ) + ) + ) + ) + (let ((a1-15 (mod v1-10 30))) + (set! (-> obj sync-array 2) (the-as uint (cond + ((>= 6 a1-15) + 1 + ) + ((>= 9 a1-15) + 2 + ) + ((>= 16 a1-15) + 4 + ) + ((>= 19 a1-15) + 8 + ) + ((>= 26 a1-15) + 16 + ) + (else + 32 + ) + ) + ) + ) + ) + (let ((v1-11 (mod v1-10 40))) + (set! (-> obj sync-array 3) (the-as uint (cond + ((>= 6 v1-11) + 1 + ) + ((>= 9 v1-11) + 2 + ) + ((>= 16 v1-11) + 4 + ) + ((>= 19 v1-11) + 8 + ) + ((>= 26 v1-11) + 16 + ) + ((>= 29 v1-11) + 32 + ) + ((>= 36 v1-11) + 64 + ) + (else + 128 + ) + ) + ) + ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 70 of type traffic-engine @@ -1961,21 +1959,19 @@ Process is recycled and moved to reserved, if it deactivates." ;; definition for method 30 of type traffic-engine ;; WARN: Return type mismatch int vs none. (defmethod increase-alert-level traffic-engine ((obj traffic-engine) (arg0 int) (arg1 target)) - (with-pp - (when (and (logtest? (-> obj alert-state flags) (traffic-alert-flag target-jak)) - (logtest? (-> arg1 mask) (process-mask target)) - ) - (let ((v1-6 (min arg0 (the-as int (-> obj alert-state max-level))))) - (when #t - (set! (-> obj alert-state start-time) (-> pp clock frame-counter)) - (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) - ) - (set! (-> obj alert-state level) (the-as uint (max (the-as int (-> obj alert-state level)) v1-6))) + (when (and (logtest? (-> obj alert-state flags) (traffic-alert-flag target-jak)) + (logtest? (-> arg1 mask) (process-mask target)) + ) + (let ((v1-6 (min arg0 (the-as int (-> obj alert-state max-level))))) + (when #t + (set! (-> obj alert-state start-time) (current-time)) + (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) ) + (set! (-> obj alert-state level) (the-as uint (max (the-as int (-> obj alert-state level)) v1-6))) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 31 of type traffic-engine @@ -1991,13 +1987,11 @@ Process is recycled and moved to reserved, if it deactivates." ;; definition for method 32 of type traffic-engine ;; WARN: Return type mismatch int vs none. (defmethod set-alert-level traffic-engine ((obj traffic-engine) (arg0 int)) - (with-pp - (set! (-> obj alert-state level) (the-as uint arg0)) - (set! (-> obj alert-state start-time) (-> pp clock frame-counter)) - (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) - 0 - (none) - ) + (set! (-> obj alert-state level) (the-as uint arg0)) + (set! (-> obj alert-state start-time) (current-time)) + (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) + 0 + (none) ) ;; definition for method 33 of type traffic-engine @@ -2298,114 +2292,112 @@ Process is recycled and moved to reserved, if it deactivates." (sv-208 int) (sv-216 float) ) - (with-pp - (logclear! (-> target-status flags) (traffic-target-flag visible-now updated)) - (cond - ((= (-> obj sync-mask-16) (ash 1 (logand arg2 15))) - (logior! (-> target-status flags) (traffic-target-flag updated)) - (let ((target-proc (handle->process (-> target-status handle))) - (target-pos (new 'stack-no-clear 'vector)) - ) - (when target-proc - (set! (-> target-pos quad) (-> (get-trans (the-as process-focusable target-proc) 3) quad)) - (cond - ((= (-> (the-as process-focusable target-proc) type) target) - (let ((s1-1 (-> obj alert-state target-status-array))) - (logclear! (-> s1-1 0 flags) (traffic-target-flag visible-now updated)) - (logior! (-> s1-1 0 flags) (traffic-target-flag updated)) - (cond - ((or (logtest? (-> s1-1 0 flags) (traffic-target-flag force-visible)) (traffic-los-clear? los target-pos)) - (logior! (-> s1-1 0 flags) (traffic-target-flag visible-now visible-recently visible-ever)) - (set! (-> s1-1 0 last-seen-time) (-> pp clock frame-counter)) - (set! (-> s1-1 0 position quad) (-> target-pos quad)) - (set! (-> s1-1 0 velocity quad) (-> (get-transv (the-as process-focusable target-proc)) quad)) - ) - (else - (if (>= (- (-> pp clock frame-counter) (-> s1-1 0 last-seen-time)) (seconds 2)) - (logclear! (-> s1-1 0 flags) (traffic-target-flag visible-recently)) - ) - ) - ) - (mem-copy! (the-as pointer target-status) (the-as pointer s1-1) 80) - ) - 0 - ) - (else - (logior! (-> target-status flags) (traffic-target-flag visible-now visible-recently visible-ever)) - (set! (-> target-status last-seen-time) (-> pp clock frame-counter)) - (set! (-> target-status position quad) (-> target-pos quad)) - (set! (-> target-status velocity quad) (-> (get-transv (the-as process-focusable target-proc)) quad)) - ) - ) - (set! (-> target-pos quad) (-> target-status position quad)) - (when (not (update-guard-status-spots target-pos)) - ) - (when (update-guard-status-spots target-pos) - (set! guards (the-as (array crimson-guard) (new 'stack 'array crimson-guard 16))) - (set! guard-target-dists (the-as (array float) (new 'stack 'array float 16))) - (set! guard-idx 0) - (dotimes (guard-count (the-as int (-> obj vehicle-tracker-array active-object-count))) - (case (-> obj vehicle-tracker-array active-object-type-list guard-count) - (((traffic-type crimson-guard-1)) - (let ((guard (handle->process (-> obj 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-override2 trans) target-pos) - ) - (set! guard-idx (+ guard-idx 1)) - (set! (-> (the-as crimson-guard guard) move-index) -1) + (logclear! (-> target-status flags) (traffic-target-flag visible-now updated)) + (cond + ((= (-> obj sync-mask-16) (ash 1 (logand arg2 15))) + (logior! (-> target-status flags) (traffic-target-flag updated)) + (let ((target-proc (handle->process (-> target-status handle))) + (target-pos (new 'stack-no-clear 'vector)) + ) + (when target-proc + (set! (-> target-pos quad) (-> (get-trans (the-as process-focusable target-proc) 3) quad)) + (cond + ((= (-> (the-as process-focusable target-proc) type) target) + (let ((s1-1 (-> obj alert-state target-status-array))) + (logclear! (-> s1-1 0 flags) (traffic-target-flag visible-now updated)) + (logior! (-> s1-1 0 flags) (traffic-target-flag updated)) + (cond + ((or (logtest? (-> s1-1 0 flags) (traffic-target-flag force-visible)) (traffic-los-clear? los target-pos)) + (logior! (-> s1-1 0 flags) (traffic-target-flag visible-now visible-recently visible-ever)) + (set! (-> s1-1 0 last-seen-time) (current-time)) + (set! (-> s1-1 0 position quad) (-> target-pos quad)) + (set! (-> s1-1 0 velocity quad) (-> (get-transv (the-as process-focusable target-proc)) quad)) + ) + (else + (if (>= (- (current-time) (-> s1-1 0 last-seen-time)) (seconds 2)) + (logclear! (-> s1-1 0 flags) (traffic-target-flag visible-recently)) ) + ) + ) + (mem-copy! (the-as pointer target-status) (the-as pointer s1-1) 80) + ) + 0 + ) + (else + (logior! (-> target-status flags) (traffic-target-flag visible-now visible-recently visible-ever)) + (set! (-> target-status last-seen-time) (current-time)) + (set! (-> target-status position quad) (-> target-pos quad)) + (set! (-> target-status velocity quad) (-> (get-transv (the-as process-focusable target-proc)) quad)) + ) + ) + (set! (-> target-pos quad) (-> target-status position quad)) + (when (not (update-guard-status-spots target-pos)) + ) + (when (update-guard-status-spots target-pos) + (set! guards (the-as (array crimson-guard) (new 'stack 'array crimson-guard 16))) + (set! guard-target-dists (the-as (array float) (new 'stack 'array float 16))) + (set! guard-idx 0) + (dotimes (guard-count (the-as int (-> obj vehicle-tracker-array active-object-count))) + (case (-> obj vehicle-tracker-array active-object-type-list guard-count) + (((traffic-type crimson-guard-1)) + (let ((guard (handle->process (-> obj 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-override2 trans) target-pos) + ) + (set! guard-idx (+ 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) - ) - (set! a0-35 #t) + ) + (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) ) ) ) - (dotimes (s4-1 guard-idx) - (let ((crimson-guard (-> (the-as (array crimson-guard) guards) s4-1))) - (when (= (-> crimson-guard move-index) -1) - (set! sv-208 -1) - (set! sv-216 (the-as float (gpr->fpr #x7f800000))) - (dotimes (s2-4 (-> *guard-target-spots* length)) - (when (= (-> *guard-status-spots* s2-4) 1) - (let* ((a0-53 (vector+! (new 'stack-no-clear 'vector) target-pos (-> *guard-target-spots* s2-4))) - (f0-4 (vector-vector-distance a0-53 (-> crimson-guard root-override2 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) + (set! sv-208 -1) + (set! sv-216 (the-as float (gpr->fpr #x7f800000))) + (dotimes (s2-4 (-> *guard-target-spots* length)) + (when (= (-> *guard-status-spots* s2-4) 1) + (let* ((a0-53 (vector+! (new 'stack-no-clear 'vector) target-pos (-> *guard-target-spots* s2-4))) + (f0-4 (vector-vector-distance a0-53 (-> crimson-guard root-override2 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)) ) ) ) @@ -2414,26 +2406,26 @@ Process is recycled and moved to reserved, if it deactivates." ) ) ) - (else - (let ((s5-1 (handle->process (-> target-status handle))) - (s3-3 (new 'stack-no-clear 'vector)) - ) - (when s5-1 - (set! (-> s3-3 quad) (-> (get-trans (the-as process-focusable s5-1) 3) quad)) - (cond - ((= (-> s5-1 type) target) - (mem-copy! (the-as pointer target-status) (the-as pointer (-> obj alert-state target-status-array)) 80) - ) - (else - ) + ) + (else + (let ((s5-1 (handle->process (-> target-status handle))) + (s3-3 (new 'stack-no-clear 'vector)) + ) + (when s5-1 + (set! (-> s3-3 quad) (-> (get-trans (the-as process-focusable s5-1) 3) quad)) + (cond + ((= (-> s5-1 type) target) + (mem-copy! (the-as pointer target-status) (the-as pointer (-> obj alert-state target-status-array)) 80) + ) + (else ) ) ) - (logclear! (-> target-status flags) (traffic-target-flag updated)) ) + (logclear! (-> target-status flags) (traffic-target-flag updated)) ) - target-status ) + target-status ) ;; definition for method 34 of type traffic-engine @@ -2900,191 +2892,186 @@ Process is recycled and moved to reserved, if it deactivates." ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod update-alert-state traffic-engine ((obj traffic-engine)) - (with-pp - (if (and (logtest? (-> obj alert-state flags) (traffic-alert-flag target-jak)) *target*) - (set! (-> obj alert-state target-status-array 0 handle) (process->handle *target*)) - ) - (when #t - (mem-copy! - (the-as pointer (-> obj alert-state settings)) - (the-as pointer (-> *alert-level-settings* (-> obj alert-state level))) - 96 - ) - (dotimes (v1-10 6) - (let ((a1-3 (-> obj alert-state settings guard-settings-array v1-10)) - (a0-10 (-> obj alert-state guard-type-info-array v1-10)) - ) - (set! (-> a1-3 inaccuracy) - (fmax 0.0 (fmin 1.0 (* (-> a1-3 inaccuracy) (-> obj alert-state guard-inaccuracy-factor)))) - ) - (when *target* - (when (focus-test? *target* pilot) - (set! (-> a1-3 acquire-delay) (the-as uint (the int (* 0.75 (the float (-> a1-3 acquire-delay)))))) - (set! (-> a1-3 shot-delay) (the-as uint (the int (* 0.6 (the float (-> a1-3 shot-delay)))))) - (set! (-> a1-3 burst-delay) (the-as uint (the int (* 0.8 (the float (-> a1-3 burst-delay)))))) - ) + (if (and (logtest? (-> obj alert-state flags) (traffic-alert-flag target-jak)) *target*) + (set! (-> obj alert-state target-status-array 0 handle) (process->handle *target*)) + ) + (when #t + (mem-copy! + (the-as pointer (-> obj alert-state settings)) + (the-as pointer (-> *alert-level-settings* (-> obj alert-state level))) + 96 + ) + (dotimes (v1-10 6) + (let ((a1-3 (-> obj alert-state settings guard-settings-array v1-10)) + (a0-10 (-> obj alert-state guard-type-info-array v1-10)) ) - (set! (-> a0-10 target-count) - (max - (min - (the int (* (the float (-> a1-3 target-count)) (-> obj alert-state guard-target-level))) - (-> a0-10 max-target-count) - ) - (-> a0-10 min-target-count) + (set! (-> a1-3 inaccuracy) + (fmax 0.0 (fmin 1.0 (* (-> a1-3 inaccuracy) (-> obj alert-state guard-inaccuracy-factor)))) + ) + (when *target* + (when (focus-test? *target* pilot) + (set! (-> a1-3 acquire-delay) (the-as uint (the int (* 0.75 (the float (-> a1-3 acquire-delay)))))) + (set! (-> a1-3 shot-delay) (the-as uint (the int (* 0.6 (the float (-> a1-3 shot-delay)))))) + (set! (-> a1-3 burst-delay) (the-as uint (the int (* 0.8 (the float (-> a1-3 burst-delay)))))) + ) + ) + (set! (-> a0-10 target-count) + (max + (min + (the int (* (the float (-> a1-3 target-count)) (-> obj alert-state guard-target-level))) + (-> a0-10 max-target-count) ) + (-> a0-10 min-target-count) ) + ) + ) + ) + ) + (dotimes (v1-13 21) + (let ((a1-8 (-> obj alert-state guard-type-mask-from-object-type v1-13))) + (when (nonzero? a1-8) + (let ((a2-18 0) + (a0-14 0) + ) + (while (nonzero? a1-8) + (if (logtest? a1-8 1) + (+! a0-14 (-> obj alert-state guard-type-info-array a2-18 target-count)) + ) + (+! a2-18 1) + (set! a1-8 (shr a1-8 1)) + ) + (set! (-> obj object-type-info-array v1-13 target-count) a0-14) ) ) ) - (dotimes (v1-13 21) - (let ((a1-8 (-> obj alert-state guard-type-mask-from-object-type v1-13))) - (when (nonzero? a1-8) - (let ((a2-18 0) - (a0-14 0) - ) - (while (nonzero? a1-8) - (if (logtest? a1-8 1) - (+! a0-14 (-> obj alert-state guard-type-info-array a2-18 target-count)) - ) - (+! a2-18 1) - (set! a1-8 (shr a1-8 1)) - ) - (set! (-> obj object-type-info-array v1-13 target-count) a0-14) - ) - ) - ) + ) + (let ((s5-0 #f)) + (when *traffic-alert-level-force* + (set! (-> obj alert-state level) (the-as uint 3)) + (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) + (set! (-> obj alert-state start-time) (current-time)) ) - (let ((s5-0 #f)) - (when *traffic-alert-level-force* - (set! (-> obj alert-state level) (the-as uint 3)) - (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) - (set! (-> obj alert-state start-time) (-> pp clock frame-counter)) - ) - (when (>= (-> obj alert-state level) (the-as uint 1)) - (set! s5-0 #t) - (cond - ((logtest? (-> obj alert-state flags) (traffic-alert-flag alert-ending)) - (cond - ((> (guard-count obj) 0) - (set! (-> obj alert-state start-time) (-> pp clock frame-counter)) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> obj alert-state start-time)) (seconds 3)) - (set! s5-0 #f) - (set! (-> obj alert-state level) (the-as uint 0)) - (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) - ) + (when (>= (-> obj alert-state level) (the-as uint 1)) + (set! s5-0 #t) + (cond + ((logtest? (-> obj alert-state flags) (traffic-alert-flag alert-ending)) + (cond + ((> (guard-count obj) 0) + (set! (-> obj alert-state start-time) (current-time)) + ) + (else + (when (>= (- (current-time) (-> obj alert-state start-time)) (seconds 3)) + (set! s5-0 #f) + (set! (-> obj alert-state level) (the-as uint 0)) + (logclear! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) ) ) ) - (else - (let ((v1-39 (+ (- (-> obj alert-state start-time) (-> pp clock frame-counter)) - (the-as time-frame (-> obj alert-state duration)) - ) - ) - ) - (if (and *target* (-> *target* next-state) (= (-> *target* next-state name) 'target-hide)) - (set! v1-39 (- v1-39 (the-as time-frame (* (- (-> pp clock frame-counter) (-> *target* state-time)) 2)))) - ) - (if (> v1-39 0) - 0 - (logior! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) - ) - ) - ) - ) - ) - (cond - (s5-0 - (when (not (logtest? (-> obj alert-state flags) (traffic-alert-flag alarm-on))) - (logior! (-> obj alert-state flags) (traffic-alert-flag alarm-on)) - (set! (-> *game-info* wanted-flash) (the-as basic #t)) - (if (= (-> *setting-control* user-current music) 'city1) - (set-setting! 'sound-mode #f 0.0 1) - ) - ) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (set! (-> s5-1 quad) (-> (target-pos 0) quad)) - (if (or (= (-> *setting-control* user-default music-volume) 0.0) - (!= (-> *setting-control* user-current music) 'city1) - ) - (sound-play "city-alarm" :id (-> obj alert-state alarm-sound-id) :position s5-1) - ) - ) - (if #t - (send-alert-events obj) - ) - (let ((v1-67 0)) - (dotimes (a0-45 21) - (let ((a1-19 (-> obj object-type-info-array a0-45))) - (if #t - (+! v1-67 (-> a1-19 killed-count)) - ) - ) - ) - (if (and (>= v1-67 (the-as int (* (-> obj alert-state level) 8))) - (< (-> obj alert-state level) (-> obj alert-state max-level)) - ) - (set-alert-level obj (the-as int (+ (-> obj alert-state level) 1))) - ) - ) - ) + ) (else - (when (logtest? (-> obj alert-state flags) (traffic-alert-flag alarm-on)) - (logclear! (-> obj alert-state flags) (traffic-alert-flag alarm-on)) - (set! (-> *game-info* wanted-flash) #f) - (remove-setting! 'sound-mode) - (sound-stop (-> obj alert-state alarm-sound-id)) - (send-alert-events obj) - (let ((v1-84 (-> obj alert-state target-status-array))) - (logclear! (-> v1-84 0 flags) (traffic-target-flag visible-now visible-recently visible-ever)) - ) - (dotimes (v1-85 21) - (set! (-> obj object-type-info-array v1-85 killed-count) (the-as uint 0)) - 0 - ) + (let ((v1-39 + (+ (- (-> obj alert-state start-time) (current-time)) (the-as time-frame (-> obj alert-state duration))) + ) + ) + (if (and *target* (-> *target* next-state) (= (-> *target* next-state name) 'target-hide)) + (set! v1-39 (- v1-39 (the-as time-frame (* (- (current-time) (-> *target* state-time)) 2)))) + ) + (if (> v1-39 0) + 0 + (logior! (-> obj alert-state flags) (traffic-alert-flag alert-ending)) + ) + ) + ) + ) + ) + (cond + (s5-0 + (when (not (logtest? (-> obj alert-state flags) (traffic-alert-flag alarm-on))) + (logior! (-> obj alert-state flags) (traffic-alert-flag alarm-on)) + (set! (-> *game-info* wanted-flash) (the-as basic #t)) + (if (= (-> *setting-control* user-current music) 'city1) + (set-setting! 'sound-mode #f 0.0 1) + ) + ) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (set! (-> s5-1 quad) (-> (target-pos 0) quad)) + (if (or (= (-> *setting-control* user-default music-volume) 0.0) + (!= (-> *setting-control* user-current music) 'city1) + ) + (sound-play "city-alarm" :id (-> obj alert-state alarm-sound-id) :position s5-1) + ) + ) + (if #t + (send-alert-events obj) + ) + (let ((v1-67 0)) + (dotimes (a0-45 21) + (let ((a1-19 (-> obj object-type-info-array a0-45))) + (if #t + (+! v1-67 (-> a1-19 killed-count)) + ) + ) + ) + (if (and (>= v1-67 (the-as int (* (-> obj alert-state level) 8))) + (< (-> obj alert-state level) (-> obj alert-state max-level)) + ) + (set-alert-level obj (the-as int (+ (-> obj alert-state level) 1))) + ) + ) + ) + (else + (when (logtest? (-> obj alert-state flags) (traffic-alert-flag alarm-on)) + (logclear! (-> obj alert-state flags) (traffic-alert-flag alarm-on)) + (set! (-> *game-info* wanted-flash) #f) + (remove-setting! 'sound-mode) + (sound-stop (-> obj alert-state alarm-sound-id)) + (send-alert-events obj) + (let ((v1-84 (-> obj alert-state target-status-array))) + (logclear! (-> v1-84 0 flags) (traffic-target-flag visible-now visible-recently visible-ever)) + ) + (dotimes (v1-85 21) + (set! (-> obj object-type-info-array v1-85 killed-count) (the-as uint 0)) + 0 ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 52 of type traffic-engine ;; WARN: Return type mismatch int vs none. (defmethod send-alert-events traffic-engine ((obj traffic-engine)) - (with-pp - (set! (-> obj alert-state notify-time) (-> pp clock frame-counter)) - (cond - ((> (-> obj alert-state level) 0) - (if (and (logtest? (-> obj alert-state flags) (traffic-alert-flag target-jak)) - (not (logtest? (-> obj alert-state flags) (traffic-alert-flag alert-ending))) - *target* - ) - (for-all-active-processes obj (lambda ((arg0 process-focusable) (arg1 traffic-object-type-info)) - (if (logtest? (-> arg1 flags) (traffic-type-flags trtflags-0)) - (send-event arg0 'alert-begin *target*) - ) - (none) - ) - ) - ) - ) - (else - (for-all-active-processes obj (lambda ((arg0 process-focusable) (arg1 traffic-object-type-info)) - (if (logtest? (-> arg1 flags) (traffic-type-flags trtflags-0)) - (send-event arg0 'alert-end) - ) - (none) - ) - ) - ) + (set! (-> obj alert-state notify-time) (current-time)) + (cond + ((> (-> obj alert-state level) 0) + (if (and (logtest? (-> obj alert-state flags) (traffic-alert-flag target-jak)) + (not (logtest? (-> obj alert-state flags) (traffic-alert-flag alert-ending))) + *target* + ) + (for-all-active-processes obj (lambda ((arg0 process-focusable) (arg1 traffic-object-type-info)) + (if (logtest? (-> arg1 flags) (traffic-type-flags trtflags-0)) + (send-event arg0 'alert-begin *target*) + ) + (none) + ) + ) + ) + ) + (else + (for-all-active-processes obj (lambda ((arg0 process-focusable) (arg1 traffic-object-type-info)) + (if (logtest? (-> arg1 flags) (traffic-type-flags trtflags-0)) + (send-event arg0 'alert-end) + ) + (none) + ) + ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 29 of type traffic-engine diff --git a/test/decompiler/reference/jak2/levels/city/common/transport_REF.gc b/test/decompiler/reference/jak2/levels/city/common/transport_REF.gc index 0a6f53805e..5627ac4408 100644 --- a/test/decompiler/reference/jak2/levels/city/common/transport_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/transport_REF.gc @@ -354,8 +354,8 @@ :virtual #t :event transport-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-guard-spawn-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self last-guard-spawn-time) (current-time)) (none) ) :code (behavior () @@ -389,7 +389,7 @@ :virtual #t :event transport-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self root-override transv y) 0.0) (set! (-> self last-guard-spawn-time) 0) 0 @@ -434,16 +434,16 @@ gp-0 ) ) - (set! (-> self leave-time) (+ (-> self clock frame-counter) (seconds 3))) + (set! (-> self leave-time) (+ (current-time) (seconds 3))) ) - (if (and (nonzero? (-> self leave-time)) (< (-> self leave-time) (-> self clock frame-counter))) + (if (and (nonzero? (-> self leave-time)) (< (-> self leave-time) (current-time))) (go-virtual leave) ) (when (and (zero? (-> self leave-time)) (nonzero? (-> self max-guard)) (>= (-> self count-guard) (-> self max-guard)) ) - (set! (-> self leave-time) (+ (-> self clock frame-counter) (seconds 3))) + (set! (-> self leave-time) (+ (current-time) (seconds 3))) (send-event self 'stop-spawning) ) (transport-method-34 self *target*) @@ -468,7 +468,7 @@ :virtual #t :event transport-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self root-override transv y) 0.0) (none) ) @@ -506,42 +506,40 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod transport-method-33 transport ((obj transport)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> obj last-guard-spawn-time)) 0) - (let ((s5-0 (new 'stack 'traffic-object-spawn-params))) - (set! (-> s5-0 object-type) (traffic-type crimson-guard-1)) - (set! (-> s5-0 behavior) (the-as uint 6)) - (set! (-> s5-0 id) (the-as uint 0)) - (set! (-> s5-0 nav-mesh) (-> obj nav-mesh)) - (set! (-> s5-0 nav-branch) #f) - (set! (-> s5-0 proc) #f) - (set! (-> s5-0 handle) (process->handle obj)) - (set! (-> s5-0 user-data) (-> obj spawn-side)) - (set! (-> s5-0 flags) (traffic-spawn-flags)) - (set! (-> s5-0 guard-type) (the-as uint 7)) - (vector-reset! (-> s5-0 velocity)) - (set! (-> s5-0 position quad) (-> obj root-override trans quad)) - (set! (-> s5-0 position y) (+ 8192.0 (-> s5-0 position y))) - (quaternion-rotate-local-y! (-> s5-0 rotation) (-> obj root-override quat) 32768.0) - (send-event *traffic-manager* 'activate-object s5-0) - (when (-> s5-0 proc) - (set! (-> obj spawn-side) (- 1 (the-as int (-> obj spawn-side)))) - (if (logtest? (-> obj draw status) (draw-control-status on-screen)) - (set! (-> obj last-guard-spawn-time) (+ (-> pp clock frame-counter) (seconds 1))) - (set! (-> obj last-guard-spawn-time) (+ (-> pp clock frame-counter) (seconds 2))) - ) - (+! (-> obj count-guard) 1) - ) - (when (not (-> s5-0 proc)) - (if (logtest? (-> obj draw status) (draw-control-status on-screen)) - (set! (-> obj last-guard-spawn-time) (+ (-> pp clock frame-counter) (seconds 0.1))) - (set! (-> obj last-guard-spawn-time) (+ (-> pp clock frame-counter) (seconds 1))) - ) - ) + (when (>= (- (current-time) (-> obj last-guard-spawn-time)) 0) + (let ((s5-0 (new 'stack 'traffic-object-spawn-params))) + (set! (-> s5-0 object-type) (traffic-type crimson-guard-1)) + (set! (-> s5-0 behavior) (the-as uint 6)) + (set! (-> s5-0 id) (the-as uint 0)) + (set! (-> s5-0 nav-mesh) (-> obj nav-mesh)) + (set! (-> s5-0 nav-branch) #f) + (set! (-> s5-0 proc) #f) + (set! (-> s5-0 handle) (process->handle obj)) + (set! (-> s5-0 user-data) (-> obj spawn-side)) + (set! (-> s5-0 flags) (traffic-spawn-flags)) + (set! (-> s5-0 guard-type) (the-as uint 7)) + (vector-reset! (-> s5-0 velocity)) + (set! (-> s5-0 position quad) (-> obj root-override trans quad)) + (set! (-> s5-0 position y) (+ 8192.0 (-> s5-0 position y))) + (quaternion-rotate-local-y! (-> s5-0 rotation) (-> obj root-override quat) 32768.0) + (send-event *traffic-manager* 'activate-object s5-0) + (when (-> s5-0 proc) + (set! (-> obj spawn-side) (- 1 (the-as int (-> obj spawn-side)))) + (if (logtest? (-> obj draw status) (draw-control-status on-screen)) + (set! (-> obj last-guard-spawn-time) (+ (current-time) (seconds 1))) + (set! (-> obj last-guard-spawn-time) (+ (current-time) (seconds 2))) + ) + (+! (-> obj count-guard) 1) + ) + (when (not (-> s5-0 proc)) + (if (logtest? (-> obj draw status) (draw-control-status on-screen)) + (set! (-> obj last-guard-spawn-time) (+ (current-time) (seconds 0.1))) + (set! (-> obj last-guard-spawn-time) (+ (current-time) (seconds 1))) + ) ) ) - (none) ) + (none) ) ;; definition for method 34 of type transport @@ -661,7 +659,3 @@ This commonly includes things such as: (go (method-of-object obj come-down)) (none) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/city/common/vehicle-control_REF.gc b/test/decompiler/reference/jak2/levels/city/common/vehicle-control_REF.gc index 30dcc80e1a..1f7616e9ae 100644 --- a/test/decompiler/reference/jak2/levels/city/common/vehicle-control_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/vehicle-control_REF.gc @@ -641,7 +641,7 @@ (vector-xz-normalize! s3-0 1.0) (cond ((= arg3 (-> arg0 sample-index)) - (let* ((f30-0 (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> arg0 sample-time))))) + (let* ((f30-0 (* 0.0033333334 (the float (- (current-time) (-> arg0 sample-time))))) (f0-3 (acos-rad (vector-dot s3-0 (-> arg0 sample-dir)))) (f28-0 (/ (* arg4 f30-0) f0-3)) ) @@ -653,7 +653,7 @@ ) (else (set! (-> arg0 sample-index) arg3) - (set! (-> arg0 sample-time) (-> self clock frame-counter)) + (set! (-> arg0 sample-time) (current-time)) (set! (-> arg0 sample-dir quad) (-> s3-0 quad)) ) ) @@ -714,7 +714,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/city/common/vehicle-effects_REF.gc b/test/decompiler/reference/jak2/levels/city/common/vehicle-effects_REF.gc index 7ffe598908..baed6e3e09 100644 --- a/test/decompiler/reference/jak2/levels/city/common/vehicle-effects_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/vehicle-effects_REF.gc @@ -52,7 +52,7 @@ (f0-22 (+ (-> obj info-override engine-pitch-offset) (* (-> obj info-override engine-pitch-scale) f30-0) (* (-> obj info-override engine-pitch-mod-amp) - (sin (* 109.22667 (the float (- (-> pp clock frame-counter) (-> obj state-time))))) + (sin (* 109.22667 (the float (- (current-time) (-> obj state-time))))) ) f26-0 ) diff --git a/test/decompiler/reference/jak2/levels/city/common/vehicle-guard_REF.gc b/test/decompiler/reference/jak2/levels/city/common/vehicle-guard_REF.gc index 9330dee172..2a93b82ca9 100644 --- a/test/decompiler/reference/jak2/levels/city/common/vehicle-guard_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/vehicle-guard_REF.gc @@ -512,50 +512,42 @@ ;; definition for method 10 of type turret-control ;; WARN: Return type mismatch int vs none. (defmethod turret-control-method-10 turret-control ((obj turret-control) (arg0 vehicle)) - (with-pp - (cond - ((logtest? (-> obj flags) (turret-flag should-shoot)) - (cond - ((logtest? (-> obj flags) (turret-flag firing)) - (cond - ((> (-> obj shot-count) 0) - (if (>= (- (-> pp clock frame-counter) (-> obj shoot-time)) - (the-as time-frame (-> obj guard-settings shot-delay)) - ) - (turret-control-method-17 obj arg0) - ) - ) - (else - (logclear! (-> obj flags) (turret-flag firing)) - (+! (-> obj burst-count) 1) - (turret-control-method-13 obj) - ) + (cond + ((logtest? (-> obj flags) (turret-flag should-shoot)) + (cond + ((logtest? (-> obj flags) (turret-flag firing)) + (cond + ((> (-> obj shot-count) 0) + (if (>= (- (current-time) (-> obj shoot-time)) (the-as time-frame (-> obj guard-settings shot-delay))) + (turret-control-method-17 obj arg0) + ) + ) + (else + (logclear! (-> obj flags) (turret-flag firing)) + (+! (-> obj burst-count) 1) + (turret-control-method-13 obj) ) ) - (else - (when (and (>= (- (-> pp clock frame-counter) (-> obj shoot-time)) - (the-as time-frame (-> obj guard-settings burst-delay)) - ) - (>= (- (-> pp clock frame-counter) (-> obj aim-acquire-time)) - (the-as time-frame (-> obj guard-settings acquire-delay)) - ) - ) - (set! (-> obj shot-count) - (+ (-> obj guard-settings shot-count) (rand-vu-int-count (+ (-> obj guard-settings rand-shot-count) 1))) - ) - (logior! (-> obj flags) (turret-flag firing)) - ) + ) + (else + (when (and (>= (- (current-time) (-> obj shoot-time)) (the-as time-frame (-> obj guard-settings burst-delay))) + (>= (- (current-time) (-> obj aim-acquire-time)) (the-as time-frame (-> obj guard-settings acquire-delay))) + ) + (set! (-> obj shot-count) + (+ (-> obj guard-settings shot-count) (rand-vu-int-count (+ (-> obj guard-settings rand-shot-count) 1))) + ) + (logior! (-> obj flags) (turret-flag firing)) ) ) ) - (else - (set! (-> obj aim-acquire-time) (-> pp clock frame-counter)) - (turret-control-method-14 obj) - ) + ) + (else + (set! (-> obj aim-acquire-time) (current-time)) + (turret-control-method-14 obj) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 11 of type turret-control @@ -574,46 +566,44 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod turret-control-method-17 turret-control ((obj turret-control) (arg0 vehicle)) - (with-pp - (let ((s4-0 (new 'stack-no-clear 'turret-unknown-stack-structure2))) - (set! (-> s4-0 proj-params ent) (-> arg0 entity)) - (set! (-> s4-0 proj-params charge) 1.0) - (set! (-> s4-0 proj-params options) (projectile-options)) - (set! (-> s4-0 proj-params notify-handle) (process->handle arg0)) - (set! (-> s4-0 proj-params owner-handle) (process->handle (handle->process (-> obj owner-handle)))) - (set! (-> s4-0 proj-params ignore-handle) (process->handle arg0)) - (let* ((v1-14 *game-info*) - (a0-16 (+ (-> v1-14 attack-id) 1)) - ) - (set! (-> v1-14 attack-id) a0-16) - (set! (-> s4-0 proj-params attack-id) a0-16) - ) - (set! (-> s4-0 proj-params timeout) (seconds 4)) - (let* ((v1-16 (-> s4-0 mat-1)) - (a3-0 (-> arg0 node-list data (-> obj info joint-index) bone transform)) - (a0-20 (-> a3-0 quad 0)) - (a1-6 (-> a3-0 quad 1)) - (a2-0 (-> a3-0 quad 2)) - (a3-1 (-> a3-0 trans quad)) - ) - (set! (-> v1-16 quad 0) a0-20) - (set! (-> v1-16 quad 1) a1-6) - (set! (-> v1-16 quad 2) a2-0) - (set! (-> v1-16 trans quad) a3-1) - ) - (dotimes (s3-0 (-> obj info barrel-count)) - (vector-matrix*! (-> s4-0 vec-1) (the-as vector (-> obj info barrel-array s3-0)) (-> 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) (-> obj info shot-speed)) - (spawn-projectile guard-shot (-> s4-0 proj-params) arg0 *default-dead-pool*) - ) + (let ((s4-0 (new 'stack-no-clear 'turret-unknown-stack-structure2))) + (set! (-> s4-0 proj-params ent) (-> arg0 entity)) + (set! (-> s4-0 proj-params charge) 1.0) + (set! (-> s4-0 proj-params options) (projectile-options)) + (set! (-> s4-0 proj-params notify-handle) (process->handle arg0)) + (set! (-> s4-0 proj-params owner-handle) (process->handle (handle->process (-> obj owner-handle)))) + (set! (-> s4-0 proj-params ignore-handle) (process->handle arg0)) + (let* ((v1-14 *game-info*) + (a0-16 (+ (-> v1-14 attack-id) 1)) + ) + (set! (-> v1-14 attack-id) a0-16) + (set! (-> s4-0 proj-params attack-id) a0-16) + ) + (set! (-> s4-0 proj-params timeout) (seconds 4)) + (let* ((v1-16 (-> s4-0 mat-1)) + (a3-0 (-> arg0 node-list data (-> obj info joint-index) bone transform)) + (a0-20 (-> a3-0 quad 0)) + (a1-6 (-> a3-0 quad 1)) + (a2-0 (-> a3-0 quad 2)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-16 quad 0) a0-20) + (set! (-> v1-16 quad 1) a1-6) + (set! (-> v1-16 quad 2) a2-0) + (set! (-> v1-16 trans quad) a3-1) + ) + (dotimes (s3-0 (-> obj info barrel-count)) + (vector-matrix*! (-> s4-0 vec-1) (the-as vector (-> obj info barrel-array s3-0)) (-> 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) (-> obj info shot-speed)) + (spawn-projectile guard-shot (-> s4-0 proj-params) arg0 *default-dead-pool*) ) - (set! (-> obj shoot-time) (-> pp clock frame-counter)) - (+! (-> obj shot-count) -1) - 0 - (none) ) + (set! (-> obj shoot-time) (current-time)) + (+! (-> obj shot-count) -1) + 0 + (none) ) ;; definition for method 16 of type turret-control @@ -871,58 +861,56 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod vehicle-guard-method-150 vehicle-guard ((obj vehicle-guard)) - (with-pp - (cond - ((handle->process (-> obj pursuit-target)) - (let ((v1-3 (new 'stack-no-clear 'vehicle-control-point))) - (set! (-> v1-3 local-pos quad) (-> obj root-override-2 trans quad)) - (let ((v1-4 (traffic-engine-method-49 - (-> obj controller traffic) - (-> v1-3 local-pos) - (-> obj traffic-priority-id) - (the-as traffic-target-status (&-> obj traffic-target-status)) - ) + (cond + ((handle->process (-> obj pursuit-target)) + (let ((v1-3 (new 'stack-no-clear 'vehicle-control-point))) + (set! (-> v1-3 local-pos quad) (-> obj root-override-2 trans quad)) + (let ((v1-4 (traffic-engine-method-49 + (-> obj controller traffic) + (-> v1-3 local-pos) + (-> obj traffic-priority-id) + (the-as traffic-target-status (&-> obj traffic-target-status)) ) - ) - (when (logtest? (-> v1-4 flags) (traffic-target-flag updated)) - (set! (-> obj flags) - (the-as rigid-body-object-flag (logclear (-> obj flags) (rigid-body-object-flag target-in-sight))) ) - (when (logtest? (-> v1-4 flags) (traffic-target-flag visible-now)) - (set! (-> obj flags) - (the-as rigid-body-object-flag (logior (rigid-body-object-flag target-in-sight) (-> obj flags))) - ) - (set! (-> obj target-in-sight-time) (-> pp clock frame-counter)) - ) ) - (set! (-> obj target-flags) (the-as turret-flag (-> v1-4 flags))) + (when (logtest? (-> v1-4 flags) (traffic-target-flag updated)) + (set! (-> obj flags) + (the-as rigid-body-object-flag (logclear (-> obj flags) (rigid-body-object-flag target-in-sight))) + ) + (when (logtest? (-> v1-4 flags) (traffic-target-flag visible-now)) + (set! (-> obj flags) + (the-as rigid-body-object-flag (logior (rigid-body-object-flag target-in-sight) (-> obj flags))) + ) + (set! (-> obj target-in-sight-time) (current-time)) + ) ) - ) - (when (not (logtest? (rigid-body-object-flag in-pursuit) (-> obj flags))) - (if (logtest? (rigid-body-object-flag target-in-sight) (-> obj flags)) - (vehicle-method-108 obj) - ) + (set! (-> obj target-flags) (the-as turret-flag (-> v1-4 flags))) ) ) - (else - (vehicle-method-109 obj) - ) + (when (not (logtest? (rigid-body-object-flag in-pursuit) (-> obj flags))) + (if (logtest? (rigid-body-object-flag target-in-sight) (-> obj flags)) + (vehicle-method-108 obj) + ) + ) + ) + (else + (vehicle-method-109 obj) ) - (let ((v1-22 (if (logtest? (rigid-body-object-flag in-pursuit) (-> obj flags)) - (-> obj draw lod-set lod 1 geo) - (-> obj lod2) - ) - ) - ) - (when (!= v1-22 (-> obj draw lod-set lod 2 geo)) - (set! (-> obj draw lod-set lod 2 geo) (the-as merc-ctrl v1-22)) - (set! (-> obj draw cur-lod) -1) - (lod-set! (-> obj draw) (-> obj draw desired-lod)) - ) - ) - 0 - (none) ) + (let ((v1-22 (if (logtest? (rigid-body-object-flag in-pursuit) (-> obj flags)) + (-> obj draw lod-set lod 1 geo) + (-> obj lod2) + ) + ) + ) + (when (!= v1-22 (-> obj draw lod-set lod 2 geo)) + (set! (-> obj draw lod-set lod 2 geo) (the-as merc-ctrl v1-22)) + (set! (-> obj draw cur-lod) -1) + (lod-set! (-> obj draw) (-> obj draw desired-lod)) + ) + ) + 0 + (none) ) ;; definition for method 155 of type vehicle-guard @@ -1315,94 +1303,88 @@ ;; definition for method 158 of type vehicle-guard ;; WARN: Return type mismatch int vs none. (defmethod vehicle-guard-method-158 vehicle-guard ((obj vehicle-guard)) - (with-pp - (vehicle-guard-method-150 obj) - (let ((s5-0 (new 'stack-no-clear 'vehicle-guard-target-data))) - (vehicle-guard-method-151 obj s5-0) - (let ((a1-1 (-> s5-0 target))) - (when a1-1 - (cond - ((logtest? (rigid-body-object-flag target-in-sight) (-> obj flags)) - (vehicle-guard-method-153 obj a1-1) - (speech-control-method-15 *speech-control* obj) - ) - (else - (if (and (>= (- (-> pp clock frame-counter) (-> obj target-in-sight-time)) (seconds 4)) - (< 368640.0 (-> s5-0 dist)) - ) - (vehicle-method-109 obj) - ) - ) + (vehicle-guard-method-150 obj) + (let ((s5-0 (new 'stack-no-clear 'vehicle-guard-target-data))) + (vehicle-guard-method-151 obj s5-0) + (let ((a1-1 (-> s5-0 target))) + (when a1-1 + (cond + ((logtest? (rigid-body-object-flag target-in-sight) (-> obj flags)) + (vehicle-guard-method-153 obj a1-1) + (speech-control-method-15 *speech-control* obj) + ) + (else + (if (and (>= (- (current-time) (-> obj target-in-sight-time)) (seconds 4)) (< 368640.0 (-> s5-0 dist))) + (vehicle-method-109 obj) + ) ) ) ) ) - (if (not (logtest? (rigid-body-object-flag in-pursuit) (-> obj flags))) - (go (method-of-object obj active)) - ) - (rigid-body-object-method-42 obj) - (vehicle-method-122 obj) - 0 - (none) ) + (if (not (logtest? (rigid-body-object-flag in-pursuit) (-> obj flags))) + (go (method-of-object obj active)) + ) + (rigid-body-object-method-42 obj) + (vehicle-method-122 obj) + 0 + (none) ) ;; definition for method 94 of type vehicle-guard ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-94 vehicle-guard ((obj vehicle-guard)) - (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (let ((v1-0 (new 'stack-no-clear 'camera-free-floating-move-info))) - (let* ((a0-1 (-> v1-0 tm)) - (t0-0 (-> obj rbody state matrix)) - (a1-1 (-> t0-0 quad 0)) - (a2-0 (-> t0-0 quad 1)) - (a3-0 (-> t0-0 quad 2)) - (t0-1 (-> t0-0 trans quad)) - ) - (set! (-> a0-1 quad 0) a1-1) - (set! (-> a0-1 quad 1) a2-0) - (set! (-> a0-1 quad 2) a3-0) - (set! (-> a0-1 trans quad) t0-1) - ) - (let ((a0-2 (-> v1-0 rv))) - (let ((a1-3 (-> obj rbody state position))) - (let ((a2-1 (-> v1-0 tm vector 2))) - (let ((a3-2 163840.0)) - (.mov vf7 a3-2) - ) - (.lvf vf5 (&-> a2-1 quad)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 (new 'stack-no-clear 'camera-free-floating-move-info))) + (let* ((a0-1 (-> v1-0 tm)) + (t0-0 (-> obj rbody state matrix)) + (a1-1 (-> t0-0 quad 0)) + (a2-0 (-> t0-0 quad 1)) + (a3-0 (-> t0-0 quad 2)) + (t0-1 (-> t0-0 trans quad)) + ) + (set! (-> a0-1 quad 0) a1-1) + (set! (-> a0-1 quad 1) a2-0) + (set! (-> a0-1 quad 2) a3-0) + (set! (-> a0-1 trans quad) t0-1) + ) + (let ((a0-2 (-> v1-0 rv))) + (let ((a1-3 (-> obj rbody state position))) + (let ((a2-1 (-> v1-0 tm vector 2))) + (let ((a3-2 163840.0)) + (.mov vf7 a3-2) ) - (.lvf vf4 (&-> a1-3 quad)) + (.lvf vf5 (&-> a2-1 quad)) ) - (.add.x.vf vf6 vf0 vf0 :mask #b1000) - (.mul.x.vf acc vf5 vf7 :mask #b111) - (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) - (.svf (&-> a0-2 quad) vf6) + (.lvf vf4 (&-> a1-3 quad)) ) - (vector-reset! (-> v1-0 up)) - (set! (-> obj turret inaccuracy) 0.0) - (turret-control-method-9 (-> obj turret) obj (-> v1-0 rv) (-> v1-0 up)) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a0-2 quad) vf6) ) - (when (cpad-hold? 0 r1) - (when (>= (- (-> pp clock frame-counter) (-> obj turret shoot-time)) (seconds 0.35)) - (set! (-> obj turret owner-handle) (process->handle *target*)) - (turret-control-method-17 (-> obj turret) obj) - (set! (-> obj turret owner-handle) (the-as handle #f)) - ) - ) - ((method-of-type vehicle vehicle-method-94) obj) - 0 - (none) + (vector-reset! (-> v1-0 up)) + (set! (-> obj turret inaccuracy) 0.0) + (turret-control-method-9 (-> obj turret) obj (-> v1-0 rv) (-> v1-0 up)) ) + (when (cpad-hold? 0 r1) + (when (>= (- (current-time) (-> obj turret shoot-time)) (seconds 0.35)) + (set! (-> obj turret owner-handle) (process->handle *target*)) + (turret-control-method-17 (-> obj turret) obj) + (set! (-> obj turret owner-handle) (the-as handle #f)) + ) + ) + ((method-of-type vehicle vehicle-method-94) obj) + 0 + (none) ) ) @@ -1446,10 +1428,9 @@ (go-virtual hostile) ) (speech-control-method-12 *speech-control* self (speech-type speech-type-2)) - (if (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 8)) - (let ((f0-0 409600.0)) - (< (* f0-0 f0-0) (-> self player-dist2)) - ) + (if (or (>= (- (current-time) (-> self state-time)) (seconds 8)) (let ((f0-0 409600.0)) + (< (* f0-0 f0-0) (-> self player-dist2)) + ) ) (logclear! (-> self flags) (rigid-body-object-flag persistent alert)) ) @@ -1480,9 +1461,9 @@ :post (behavior () (vehicle-guard-method-150 self) (when (logtest? (rigid-body-object-flag in-pursuit) (-> self flags)) - (if (or (>= (- (-> self clock frame-counter) (-> self target-in-sight-time)) (seconds 8)) + (if (or (>= (- (current-time) (-> self target-in-sight-time)) (seconds 8)) (and (>= (-> self controller traffic alert-state guards-in-sight-of-target) 2) - (>= (- (-> self clock frame-counter) (-> self target-in-sight-time)) (seconds 0.5)) + (>= (- (current-time) (-> self target-in-sight-time)) (seconds 0.5)) ) ) (vehicle-method-109 self) @@ -1559,7 +1540,7 @@ vehicle-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self ai-hook) (method-of-object self vehicle-guard-method-156)) (none) ) @@ -1573,7 +1554,7 @@ (when gp-0 (when (or (< (-> s5-0 attack-range) (-> s5-0 dist)) (not (logtest? (rigid-body-object-flag target-in-sight) (-> self flags))) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (>= (- (current-time) (-> self state-time)) (seconds 2)) ) (set! (-> self flags) (the-as rigid-body-object-flag (logclear (-> self flags) (rigid-body-object-flag rammed-target))) diff --git a/test/decompiler/reference/jak2/levels/city/common/vehicle-states_REF.gc b/test/decompiler/reference/jak2/levels/city/common/vehicle-states_REF.gc index 8eb99b0284..a91f31447d 100644 --- a/test/decompiler/reference/jak2/levels/city/common/vehicle-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/vehicle-states_REF.gc @@ -13,7 +13,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior vehicle) vehicle-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (rigid-body-object-method-39 self) (go-virtual waiting) (none) @@ -57,7 +57,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior vehicle) vehicle-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (vehicle-method-139 self) (set! (-> self flags) (logior (rigid-body-object-flag riding ai-driving) (-> self flags))) (vehicle-method-142 self) @@ -82,7 +82,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior vehicle) vehicle-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (vehicle-method-140 self) (set! (-> self flags) (the-as rigid-body-object-flag @@ -141,7 +141,7 @@ :event (the-as (function process int symbol event-message-block object :behavior vehicle) vehicle-event-handler) :enter (behavior () (set-setting! 'sound-flava #f 31.0 5) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (iterate-prims (-> self root-override-2) (lambda ((arg0 collide-shape-prim)) @@ -206,7 +206,7 @@ (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (not *target*) (go-virtual waiting) ) @@ -267,7 +267,7 @@ :event (the-as (function process int symbol event-message-block object :behavior vehicle) vehicle-event-handler) :enter (behavior () (logclear! (-> self flags) (rigid-body-object-flag player-driving)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (vehicle-method-129 self) (set! (-> self crash-level) 3) (vehicle-method-88 self) @@ -278,7 +278,7 @@ ) :trans (behavior () (set! (-> self hit-points) (- (-> self hit-points) (* 0.5 (-> self clock seconds-per-frame)))) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) 1) (< (-> self hit-points) -0.25)) + (if (and (>= (- (current-time) (-> self state-time)) 1) (< (-> self hit-points) -0.25)) (go-virtual explode) ) (none) @@ -305,13 +305,12 @@ (set! (-> self player-dist2) (vector-vector-distance-squared (-> self root-override-2 trans) (target-pos 0))) (cond ((logtest? (-> self draw status) (draw-control-status on-screen)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (else - (if (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) - (let ((f0-2 409600.0)) - (< (* f0-2 f0-2) (-> self camera-dist2)) - ) + (if (or (>= (- (current-time) (-> self state-time)) (seconds 5)) (let ((f0-2 409600.0)) + (< (* f0-2 f0-2) (-> self camera-dist2)) + ) ) (go-virtual die) ) @@ -336,7 +335,7 @@ (vehicle-method-121 self) (set! (-> self rbody state info) (-> self info-override info)) (when (logtest? (-> self flags) (rigid-body-object-flag disturbed)) - (let* ((f0-14 (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> self disturbed-time))))) + (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))) @@ -490,7 +489,7 @@ ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/common/vehicle-util_REF.gc b/test/decompiler/reference/jak2/levels/city/common/vehicle-util_REF.gc index 37cd6d5285..52593af588 100644 --- a/test/decompiler/reference/jak2/levels/city/common/vehicle-util_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/vehicle-util_REF.gc @@ -163,31 +163,29 @@ ;; definition for method 9 of type vehicle-hud-chooser (defmethod vehicle-hud-chooser-method-9 vehicle-hud-chooser ((obj vehicle-hud-chooser) (arg0 handle) (arg1 float)) - (with-pp - (let ((s3-0 (-> pp clock frame-counter))) - (when (!= s3-0 (-> obj cur time)) - (if (zero? (-> obj cur time)) - (vehicle-hud-requests-method-9 (-> obj cur)) - ) - (mem-copy! (the-as pointer (-> obj last)) (the-as pointer (-> obj cur)) 72) - (set! (-> obj cur time) s3-0) - (vehicle-hud-requests-method-9 (-> obj cur)) - ) + (let ((s3-0 (current-time))) + (when (!= s3-0 (-> obj cur time)) + (if (zero? (-> obj cur time)) + (vehicle-hud-requests-method-9 (-> obj cur)) + ) + (mem-copy! (the-as pointer (-> obj last)) (the-as pointer (-> obj cur)) 72) + (set! (-> obj cur time) s3-0) + (vehicle-hud-requests-method-9 (-> obj cur)) ) - (let ((v1-10 (vehicle-hud-requests-method-11 (-> obj cur)))) - (when (< (-> v1-10 priority) arg1) - (set! (-> v1-10 handle) arg0) - (set! (-> v1-10 priority) arg1) - ) + ) + (let ((v1-10 (vehicle-hud-requests-method-11 (-> obj cur)))) + (when (< (-> v1-10 priority) arg1) + (set! (-> v1-10 handle) arg0) + (set! (-> v1-10 priority) arg1) ) - (let ((s4-1 #f)) - (let ((v1-12 (vehicle-hud-requests-method-10 (-> obj last)))) - (if (and (handle->process arg0) (= (-> v1-12 handle) arg0)) - (set! s4-1 #t) - ) - ) - s4-1 + ) + (let ((s4-1 #f)) + (let ((v1-12 (vehicle-hud-requests-method-10 (-> obj last)))) + (if (and (handle->process arg0) (= (-> v1-12 handle) arg0)) + (set! s4-1 #t) + ) ) + s4-1 ) ) @@ -819,26 +817,24 @@ This commonly includes things such as: ;; definition for method 76 of type vehicle ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-76 vehicle ((obj vehicle) (arg0 int) (arg1 uint)) - (with-pp - (when (< (-> obj crash-level) arg0) - (set! (-> obj crash-level) arg0) - (set! (-> obj crash-duration) arg1) - (set! (-> obj crash-time) (-> pp clock frame-counter)) - (set! (-> obj force-scale) 0.0) - (when (>= (-> obj crash-level) 2) - (sound-play "bike-engine-off") - (vehicle-method-83 obj) - ) + (when (< (-> obj crash-level) arg0) + (set! (-> obj crash-level) arg0) + (set! (-> obj crash-duration) arg1) + (set! (-> obj crash-time) (current-time)) + (set! (-> obj force-scale) 0.0) + (when (>= (-> obj crash-level) 2) + (sound-play "bike-engine-off") + (vehicle-method-83 obj) ) - (when (and (>= 0.0 (-> obj hit-points)) (!= (-> obj crash-level) 3)) - (logior! (-> obj flags) (rigid-body-object-flag dead)) - (set! (-> obj crash-level) 3) - (set! (-> obj crash-duration) (the-as uint 1500)) - (set! (-> obj crash-time) (-> pp clock frame-counter)) - ) - 0 - (none) ) + (when (and (>= 0.0 (-> obj hit-points)) (!= (-> obj crash-level) 3)) + (logior! (-> obj flags) (rigid-body-object-flag dead)) + (set! (-> obj crash-level) 3) + (set! (-> obj crash-duration) (the-as uint 1500)) + (set! (-> obj crash-time) (current-time)) + ) + 0 + (none) ) ;; definition for method 77 of type vehicle @@ -852,30 +848,26 @@ This commonly includes things such as: ;; definition for method 78 of type vehicle ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-78 vehicle ((obj vehicle) (arg0 int)) - (with-pp - (set! (-> obj flight-level-index-prev) (-> obj flight-level-index)) - (set! (-> obj flight-level-index) arg0) - (set! (-> obj flags) - (logior (rigid-body-object-flag flight-level-transition camera-rapid-track-mode) (-> obj flags)) - ) - (logclear! (-> obj flags) (rigid-body-object-flag flight-level-transition-ending)) - (set! (-> obj transition-time) (-> pp clock frame-counter)) - (vehicle-method-91 obj) - 0 - (none) - ) + (set! (-> obj flight-level-index-prev) (-> obj flight-level-index)) + (set! (-> obj flight-level-index) arg0) + (set! (-> obj flags) + (logior (rigid-body-object-flag flight-level-transition camera-rapid-track-mode) (-> obj flags)) + ) + (logclear! (-> obj flags) (rigid-body-object-flag flight-level-transition-ending)) + (set! (-> obj transition-time) (current-time)) + (vehicle-method-91 obj) + 0 + (none) ) ;; definition for method 79 of type vehicle ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-79 vehicle ((obj vehicle)) - (with-pp - (logclear! (-> obj flags) (rigid-body-object-flag flight-level-transition)) - (set! (-> obj flags) (logior (rigid-body-object-flag flight-level-transition-ending) (-> obj flags))) - (set! (-> obj transition-end-time) (-> pp clock frame-counter)) - 0 - (none) - ) + (logclear! (-> obj flags) (rigid-body-object-flag flight-level-transition)) + (set! (-> obj flags) (logior (rigid-body-object-flag flight-level-transition-ending) (-> obj flags))) + (set! (-> obj transition-end-time) (current-time)) + 0 + (none) ) ;; definition for method 131 of type vehicle @@ -1471,74 +1463,72 @@ This commonly includes things such as: ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-106 vehicle ((obj vehicle)) (local-vars (v1-13 float) (v1-25 float) (v1-30 float)) - (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf1 :class vf) - (vf2 :class vf) - ) - (init-vf0-vector) - (when (>= (- (-> pp clock frame-counter) (-> obj disturbed-time)) (seconds 2)) - (cond - ((logtest? (rigid-body-object-flag ai-driving) (-> obj flags)) - (when (and (not (logtest? (-> obj controller flags) (vehicle-controller-flag off-path))) - (>= (-> obj rbody state matrix vector 1 y) (cos 910.2222)) - ) - (.lvf vf1 (&-> (-> obj rbody state ang-velocity) quad)) - (.add.w.vf vf2 vf0 vf0 :mask #b1) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf acc vf2 vf1 :mask #b1) - (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) - (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) - (.mov v1-13 vf1) - (let ((f0-1 v1-13) - (f1-0 0.5) - ) - (if (< f0-1 (* f1-0 f1-0)) - (logclear! (-> obj flags) (rigid-body-object-flag disturbed)) - ) - ) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (when (>= (- (current-time) (-> obj disturbed-time)) (seconds 2)) + (cond + ((logtest? (rigid-body-object-flag ai-driving) (-> obj flags)) + (when (and (not (logtest? (-> obj controller flags) (vehicle-controller-flag off-path))) + (>= (-> obj rbody state matrix vector 1 y) (cos 910.2222)) + ) + (.lvf vf1 (&-> (-> obj rbody state ang-velocity) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-13 vf1) + (let ((f0-1 v1-13) + (f1-0 0.5) + ) + (if (< f0-1 (* f1-0 f1-0)) + (logclear! (-> obj flags) (rigid-body-object-flag disturbed)) + ) ) ) - (else - (when (>= (-> obj rbody state matrix vector 1 y) (cos 910.2222)) - (let* ((f0-3 (-> obj camera-dist2)) - (f1-3 0.000024414063) - (f0-4 (* f0-3 (* f1-3 f1-3))) - ) - (.lvf vf1 (&-> (-> obj rbody state ang-velocity) quad)) - (.add.w.vf vf2 vf0 vf0 :mask #b1) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf acc vf2 vf1 :mask #b1) - (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) - (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) - (.mov v1-25 vf1) - (when (and (< v1-25 f0-4) (begin - (.lvf vf1 (&-> (-> obj rbody state lin-velocity) quad)) - (.add.w.vf vf2 vf0 vf0 :mask #b1) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf acc vf2 vf1 :mask #b1) - (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) - (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) - (.mov v1-30 vf1) - (let ((f1-7 v1-30) - (f2-0 614.4) - ) - (< f1-7 (* f0-4 (* f2-0 f2-0))) - ) + ) + (else + (when (>= (-> obj rbody state matrix vector 1 y) (cos 910.2222)) + (let* ((f0-3 (-> obj camera-dist2)) + (f1-3 0.000024414063) + (f0-4 (* f0-3 (* f1-3 f1-3))) + ) + (.lvf vf1 (&-> (-> obj rbody state ang-velocity) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-25 vf1) + (when (and (< v1-25 f0-4) (begin + (.lvf vf1 (&-> (-> obj rbody state lin-velocity) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-30 vf1) + (let ((f1-7 v1-30) + (f2-0 614.4) + ) + (< f1-7 (* f0-4 (* f2-0 f2-0))) ) - ) - (logclear! (-> obj flags) (rigid-body-object-flag disturbed)) - (clear-momentum! (-> obj rbody state)) - ) + ) + ) + (logclear! (-> obj flags) (rigid-body-object-flag disturbed)) + (clear-momentum! (-> obj rbody state)) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/common/vehicle_REF.gc b/test/decompiler/reference/jak2/levels/city/common/vehicle_REF.gc index 3a80793642..5d9c248842 100644 --- a/test/decompiler/reference/jak2/levels/city/common/vehicle_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/vehicle_REF.gc @@ -452,9 +452,9 @@ (seek! (-> obj force-scale) 1.0 (-> pp clock seconds-per-frame)) ) ((< (-> obj crash-level) 3) - (when (>= (- (-> pp clock frame-counter) (-> obj crash-time)) (the-as time-frame (-> obj crash-duration))) + (when (>= (- (current-time) (-> obj crash-time)) (the-as time-frame (-> obj crash-duration))) (if (or (>= (-> obj rbody state matrix vector 1 y) (cos 18204.445)) - (>= (- (-> pp clock frame-counter) (-> obj crash-time)) (seconds 3)) + (>= (- (current-time) (-> obj crash-time)) (seconds 3)) ) (vehicle-method-77 obj) ) @@ -501,12 +501,8 @@ ) ) (when (logtest? (rigid-body-object-flag turbo-boost) (-> obj flags)) - (if (or (>= (- (-> pp clock frame-counter) (-> obj turbo-boost-time)) - (the-as time-frame (-> obj turbo-boost-duration)) - ) - (and (>= (- (-> pp clock frame-counter) (-> obj turbo-boost-time)) (seconds 0.1)) - (>= (-> obj controls brake) 0.75) - ) + (if (or (>= (- (current-time) (-> obj turbo-boost-time)) (the-as time-frame (-> obj turbo-boost-duration))) + (and (>= (- (current-time) (-> obj turbo-boost-time)) (seconds 0.1)) (>= (-> obj controls brake) 0.75)) ) (logclear! (-> obj flags) (rigid-body-object-flag turbo-boost)) ) @@ -566,15 +562,15 @@ (logtest? (-> obj vehicle-jkhn1b23jn1) 1024) ) (set! (-> obj flags) (logior (rigid-body-object-flag hard-turn) (-> obj flags))) - (set! (-> obj turn-time) (-> pp clock frame-counter)) + (set! (-> obj turn-time) (current-time)) ) (if (or (not (logtest? (rigid-body-object-flag jump) (-> obj flags))) - (>= (- (-> pp clock frame-counter) (-> obj turn-time)) (seconds 1)) + (>= (- (current-time) (-> obj turn-time)) (seconds 1)) ) (logclear! (-> obj flags) (rigid-body-object-flag hard-turn)) ) (if (logtest? (-> obj flags) (rigid-body-object-flag on-ground on-flight-level)) - (set! (-> obj air-time) (-> pp clock frame-counter)) + (set! (-> obj air-time) (current-time)) ) (when (logtest? (rigid-body-object-flag flight-level-transition) (-> obj flags)) (if (or (and (> (-> obj flight-level-index) 0) @@ -585,15 +581,13 @@ ) (vehicle-method-79 obj) ) - (when (and (> (-> obj flight-level-index) 0) - (>= (- (-> pp clock frame-counter) (-> obj transition-time)) (seconds 2)) - ) + (when (and (> (-> obj flight-level-index) 0) (>= (- (current-time) (-> obj transition-time)) (seconds 2))) (vehicle-method-79 obj) (vehicle-method-83 obj) ) ) (when (and (logtest? (rigid-body-object-flag flight-level-transition-ending) (-> obj flags)) - (>= (- (-> pp clock frame-counter) (-> obj transition-end-time)) (seconds 1)) + (>= (- (current-time) (-> obj transition-end-time)) (seconds 1)) ) (logclear! (-> obj flags) (rigid-body-object-flag flight-level-transition-ending)) (vehicle-method-92 obj) @@ -637,9 +631,7 @@ ) (cond ((logtest? (-> obj flags) (rigid-body-object-flag in-air)) - (when (or (< 55296.0 (-> obj rbody state lin-velocity y)) - (>= (- (-> pp clock frame-counter) (-> obj air-time)) (seconds 0.75)) - ) + (when (or (< 55296.0 (-> obj rbody state lin-velocity y)) (>= (- (current-time) (-> obj air-time)) (seconds 0.75))) (set-setting! 'extra-follow-height 'abs (meters -4) 0) (send-event *camera* 'set-max-angle-offset (-> obj info-override camera-air-max-angle-offset)) ) @@ -1017,25 +1009,23 @@ ;; definition for method 121 of type vehicle ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-121 vehicle ((obj vehicle)) - (with-pp - (if (>= (- (-> pp clock frame-counter) (-> obj player-touch-time)) (seconds 0.1)) - (logclear! (-> obj flags) (rigid-body-object-flag player-touching player-edge-grabbing player-standing-on)) - ) - (when (logtest? (-> obj flags) (rigid-body-object-flag player-touching)) - (detect-riders! (-> obj root-override-2)) - 0 - ) - (if (logtest? (-> obj flags) (rigid-body-object-flag player-touching player-driving)) - (logior! (-> obj skel status) (joint-control-status sync-math)) - (logclear! (-> obj skel status) (joint-control-status sync-math)) - ) - (vehicle-method-96 obj) - (let ((a1-0 (-> obj rbody state position))) - (set! (-> obj flight-level) (get-height-at-point *traffic-height-map* a1-0)) + (if (>= (- (current-time) (-> obj player-touch-time)) (seconds 0.1)) + (logclear! (-> obj flags) (rigid-body-object-flag player-touching player-edge-grabbing player-standing-on)) ) + (when (logtest? (-> obj flags) (rigid-body-object-flag player-touching)) + (detect-riders! (-> obj root-override-2)) 0 - (none) ) + (if (logtest? (-> obj flags) (rigid-body-object-flag player-touching player-driving)) + (logior! (-> obj skel status) (joint-control-status sync-math)) + (logclear! (-> obj skel status) (joint-control-status sync-math)) + ) + (vehicle-method-96 obj) + (let ((a1-0 (-> obj rbody state position))) + (set! (-> obj flight-level) (get-height-at-point *traffic-height-map* a1-0)) + ) + 0 + (none) ) ;; definition for method 37 of type vehicle @@ -1133,106 +1123,104 @@ ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-123 vehicle ((obj vehicle)) (local-vars (v1-4 symbol) (a0-21 int) (a0-23 int)) - (with-pp - (set! (-> obj camera-dist2) (vector-vector-distance-squared (-> obj root-override-2 trans) (camera-pos))) - (set! (-> obj player-dist2) (vector-vector-distance-squared (-> obj root-override-2 trans) (target-pos 0))) - (b! - (not (logtest? (rigid-body-object-flag traffic-managed) (-> obj flags))) - cfg-3 - :likely-delay (set! v1-4 #f) + (set! (-> obj camera-dist2) (vector-vector-distance-squared (-> obj root-override-2 trans) (camera-pos))) + (set! (-> obj player-dist2) (vector-vector-distance-squared (-> obj root-override-2 trans) (target-pos 0))) + (b! + (not (logtest? (rigid-body-object-flag traffic-managed) (-> obj flags))) + cfg-3 + :likely-delay (set! v1-4 #f) + ) + (set! v1-4 (not (logtest? (-> obj flags) (rigid-body-object-flag persistent)))) + (label cfg-3) + (b! (not v1-4) cfg-20 :delay (empty-form)) + (let ((f0-3 (fmin (-> obj player-dist2) (-> obj camera-dist2)))) + (let ((f1-1 819200.0)) + (b! (>= (* f1-1 f1-1) f0-3) cfg-8) ) - (set! v1-4 (not (logtest? (-> obj flags) (rigid-body-object-flag persistent)))) - (label cfg-3) - (b! (not v1-4) cfg-20 :delay (empty-form)) - (let ((f0-3 (fmin (-> obj player-dist2) (-> obj 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 obj) - ) - ) - (b! #t cfg-19 :delay (nop!)) - (label cfg-8) - (let ((f1-7 81920.0)) - (b! (>= (* f1-7 f1-7) f0-3) cfg-18) - ) - (b! (not (logtest? (-> obj draw status) (draw-control-status on-screen))) cfg-11 :delay (nop!)) - (set! (-> obj state-time) (-> pp clock frame-counter)) - (b! #t cfg-17 :delay (nop!)) - (label cfg-11) - (if (or (>= (- (-> pp clock frame-counter) (-> obj state-time)) (seconds 10)) (let ((f1-10 409600.0)) - (< (* f1-10 f1-10) f0-3) - ) - ) + (let ((f1-4 819200.0)) + (if (< (* f1-4 f1-4) f0-3) (vehicle-method-113 obj) ) ) - (label cfg-17) (b! #t cfg-19 :delay (nop!)) - (label cfg-18) - (set! (-> obj state-time) (-> pp clock frame-counter)) - (label cfg-19) - 0 - (label cfg-20) - (check-player-get-on obj) - (b! (not (logtest? (-> obj rbody state flags) (rigid-body-flag enable-physics))) cfg-24 :delay (nop!)) - (if (not (vehicle-method-105 obj)) - (rigid-body-object-method-39 obj) - ) - (b! #t cfg-26 :delay (nop!)) - (label cfg-24) - (if (vehicle-method-105 obj) - (rigid-body-object-method-38 obj) - ) - (label cfg-26) - (b! (not (logtest? (-> obj rbody state flags) (rigid-body-flag enable-physics))) cfg-31 :delay (nop!)) - (vector-reset! (-> obj target-acceleration)) - (when (logtest? (-> obj flags) (rigid-body-object-flag disturbed)) - (if (logtest? (-> obj flags) (rigid-body-object-flag in-air)) - (set! (-> obj disturbed-time) (-> pp clock frame-counter)) - ) + (label cfg-8) + (let ((f1-7 81920.0)) + (b! (>= (* f1-7 f1-7) f0-3) cfg-18) ) - (vehicle-method-121 obj) - (vehicle-method-106 obj) - (b! #t cfg-36 :delay (nop!)) - (label cfg-31) - (let* ((v1-65 (-> *perf-stats* data 20)) - (a0-18 (-> v1-65 ctrl)) - ) - (+! (-> v1-65 count) 1) - (b! (zero? a0-18) cfg-33 :delay (nop!)) - (.mtc0 Perf 0) - (.sync.l) - (.sync.p) - (.mtpc pcr0 0) - (.mtpc pcr1 0) - (.sync.l) - (.sync.p) - (.mtc0 Perf a0-18) + (b! (not (logtest? (-> obj draw status) (draw-control-status on-screen))) cfg-11 :delay (nop!)) + (set! (-> obj state-time) (current-time)) + (b! #t cfg-17 :delay (nop!)) + (label cfg-11) + (if (or (>= (- (current-time) (-> obj state-time)) (seconds 10)) (let ((f1-10 409600.0)) + (< (* f1-10 f1-10) f0-3) + ) + ) + (vehicle-method-113 obj) + ) + ) + (label cfg-17) + (b! #t cfg-19 :delay (nop!)) + (label cfg-18) + (set! (-> obj state-time) (current-time)) + (label cfg-19) + 0 + (label cfg-20) + (check-player-get-on obj) + (b! (not (logtest? (-> obj rbody state flags) (rigid-body-flag enable-physics))) cfg-24 :delay (nop!)) + (if (not (vehicle-method-105 obj)) + (rigid-body-object-method-39 obj) ) + (b! #t cfg-26 :delay (nop!)) + (label cfg-24) + (if (vehicle-method-105 obj) + (rigid-body-object-method-38 obj) + ) + (label cfg-26) + (b! (not (logtest? (-> obj rbody state flags) (rigid-body-flag enable-physics))) cfg-31 :delay (nop!)) + (vector-reset! (-> obj target-acceleration)) + (when (logtest? (-> obj flags) (rigid-body-object-flag disturbed)) + (if (logtest? (-> obj flags) (rigid-body-object-flag in-air)) + (set! (-> obj disturbed-time) (current-time)) + ) + ) + (vehicle-method-121 obj) + (vehicle-method-106 obj) + (b! #t cfg-36 :delay (nop!)) + (label cfg-31) + (let* ((v1-65 (-> *perf-stats* data 20)) + (a0-18 (-> v1-65 ctrl)) + ) + (+! (-> v1-65 count) 1) + (b! (zero? a0-18) cfg-33 :delay (nop!)) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (label cfg-33) - 0 - (vehicle-method-120 obj) - (let ((v1-70 (-> *perf-stats* data 20))) - (b! (zero? (-> v1-70 ctrl)) cfg-35 :delay (nop!)) - (.mtc0 Perf 0) - (.sync.l) - (.sync.p) - (.mfpc a0-21 pcr0) - (+! (-> v1-70 accum0) a0-21) - (.mfpc a0-23 pcr1) - (+! (-> v1-70 accum1) a0-23) - ) - (label cfg-35) - 0 - (label cfg-36) - 0 - (none) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf a0-18) ) + (.sync.l) + (.sync.p) + (label cfg-33) + 0 + (vehicle-method-120 obj) + (let ((v1-70 (-> *perf-stats* data 20))) + (b! (zero? (-> v1-70 ctrl)) cfg-35 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-21 pcr0) + (+! (-> v1-70 accum0) a0-21) + (.mfpc a0-23 pcr1) + (+! (-> v1-70 accum1) a0-23) + ) + (label cfg-35) + 0 + (label cfg-36) + 0 + (none) ) ;; definition for method 122 of type vehicle @@ -1547,154 +1535,152 @@ ;; INFO: Used lq/sq (defmethod rigid-body-object-method-47 vehicle ((obj vehicle) (arg0 process-drawable) (arg1 attack-info) (arg2 touching-shapes-entry) (arg3 penetrate)) (local-vars (f0-2 float) (sv-96 vector)) - (with-pp - (rlet ((vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - ) - (init-vf0-vector) - (let ((s5-0 (new 'stack-no-clear 'matrix))) - (rigid-body-object-method-49 obj (the-as rigid-body-impact s5-0) arg2) - (cond - ((logtest? (attack-info-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)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (new 'stack-no-clear 'matrix))) + (rigid-body-object-method-49 obj (the-as rigid-body-impact s5-0) arg2) + (cond + ((logtest? (attack-info-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) ) - (.mov.vf vf6 vf0 :mask #b1000) - (.sub.vf vf6 vf4 vf5 :mask #b111) - (.svf (&-> sv-96 quad) vf6) + (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)) ) - (else - (vector-! (-> s5-0 vector 2) (the-as vector (-> s5-0 vector)) (-> arg0 root trans)) - ) + (.mov.vf vf6 vf0 :mask #b1000) + (.sub.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> sv-96 quad) vf6) + ) + (else + (vector-! (-> s5-0 vector 2) (the-as vector (-> s5-0 vector)) (-> arg0 root trans)) ) ) ) ) - 0.0 - 0.0 - (let ((f1-0 (cond - ((= (-> arg1 mode) 'mine) - (set! f0-2 20480.0) - 0.2 - ) - ((or (logtest? (penetrate dark-giant) arg3) - (and (logtest? (-> arg1 mask) (attack-info-mask mode)) (= (-> arg1 mode) 'eco-dark)) - ) - (set! (-> s5-0 vector 2 y) (* 0.1 (-> s5-0 vector 2 y))) - (set! f0-2 (* 409600.0 (-> obj info-override info mass))) - (/ 0.4 (-> obj info-override damage-factor)) - ) - ((or (logtest? (penetrate dark-punch dark-bomb) arg3) - (and (logtest? (penetrate dark-skin) arg3) (logtest? arg3 (penetrate punch spin))) - ) - (set! f0-2 (* 204800.0 (-> obj info-override info mass))) - (/ 0.2 (-> obj info-override damage-factor)) - ) - ((logtest? (penetrate enemy-yellow-shot) arg3) - (set! f0-2 49152.0) - 0.025 - ) - ((logtest? (penetrate jak-yellow-shot) arg3) - (set! f0-2 98304.0) - 0.05 - ) - ((logtest? (penetrate jak-blue-shot) arg3) - (set! f0-2 196608.0) - 0.05 - ) - ((logtest? (penetrate jak-red-shot) arg3) - (set! f0-2 196608.0) - 0.05 - ) - ((logtest? (penetrate jak-dark-shot enemy-dark-shot) arg3) - (set! f0-2 393216.0) - 0.5 - ) - ((or (logtest? (penetrate explode) arg3) - (and (logtest? (-> arg1 mask) (attack-info-mask mode)) (case (-> arg1 mode) - (('explode 'grenade 'melt 'ice) - #t - ) - ) - ) - ) - (set! f0-2 122880.0) - 1.0 - ) - ((logtest? arg3 (penetrate punch)) - (set! f0-2 40960.0) - 0.1 - ) - ((logtest? arg3 (penetrate flop spin)) - (set! f0-2 20480.0) - 0.05 - ) - (else - (set! f0-2 8192.0) - 0.01 - ) + ) + 0.0 + 0.0 + (let ((f1-0 (cond + ((= (-> arg1 mode) 'mine) + (set! f0-2 20480.0) + 0.2 + ) + ((or (logtest? (penetrate dark-giant) arg3) + (and (logtest? (-> arg1 mask) (attack-info-mask mode)) (= (-> arg1 mode) 'eco-dark)) + ) + (set! (-> s5-0 vector 2 y) (* 0.1 (-> s5-0 vector 2 y))) + (set! f0-2 (* 409600.0 (-> obj info-override info mass))) + (/ 0.4 (-> obj info-override damage-factor)) + ) + ((or (logtest? (penetrate dark-punch dark-bomb) arg3) + (and (logtest? (penetrate dark-skin) arg3) (logtest? arg3 (penetrate punch spin))) + ) + (set! f0-2 (* 204800.0 (-> obj info-override info mass))) + (/ 0.2 (-> obj info-override damage-factor)) + ) + ((logtest? (penetrate enemy-yellow-shot) arg3) + (set! f0-2 49152.0) + 0.025 + ) + ((logtest? (penetrate jak-yellow-shot) arg3) + (set! f0-2 98304.0) + 0.05 + ) + ((logtest? (penetrate jak-blue-shot) arg3) + (set! f0-2 196608.0) + 0.05 + ) + ((logtest? (penetrate jak-red-shot) arg3) + (set! f0-2 196608.0) + 0.05 + ) + ((logtest? (penetrate jak-dark-shot enemy-dark-shot) arg3) + (set! f0-2 393216.0) + 0.5 + ) + ((or (logtest? (penetrate explode) arg3) + (and (logtest? (-> arg1 mask) (attack-info-mask mode)) (case (-> arg1 mode) + (('explode 'grenade 'melt 'ice) + #t + ) + ) + ) + ) + (set! f0-2 122880.0) + 1.0 + ) + ((logtest? arg3 (penetrate punch)) + (set! f0-2 40960.0) + 0.1 + ) + ((logtest? arg3 (penetrate flop spin)) + (set! f0-2 20480.0) + 0.05 + ) + (else + (set! f0-2 8192.0) + 0.01 ) ) - ) - (set! (-> s5-0 trans x) f0-2) - (apply-damage obj (* 0.667 f1-0) (the-as rigid-body-impact s5-0)) - ) - (rigid-body-object-method-42 obj) - (let ((s3-1 (new 'stack-no-clear 'vector))) - (set! (-> s3-1 quad) (-> s5-0 vector 2 quad)) - (vector-normalize! s3-1 1.0) - (vector-float*! s3-1 s3-1 (-> s5-0 trans x)) - (let ((v1-90 (-> obj rbody)) - (a1-11 (-> s5-0 vector)) - (a2-3 s3-1) - ) - (rigid-body-method-18 (-> v1-90 state) (the-as vector a1-11) a2-3) + ) ) - (let ((v1-93 (-> obj rbody)) - (f0-10 1.0) - ) - (rigid-body-method-12 (-> v1-93 state) f0-10) - ) - (rigid-body-method-13 (-> obj rbody state)) - (when #f - (set! (-> *debug-vehicle-work* impact-time) (-> pp clock frame-counter)) - (mem-copy! (the-as pointer (-> *debug-vehicle-work* impact)) (the-as pointer s5-0) 64) - (let ((v1-103 (-> arg2 head))) - (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* - ) - ) - ) - (rigid-body-object-method-45 obj (the-as rigid-body-impact s5-0)) + (set! (-> s5-0 trans x) f0-2) + (apply-damage obj (* 0.667 f1-0) (the-as rigid-body-impact s5-0)) ) - (if (and (-> obj next-state) (= (-> obj next-state name) 'idle)) - (go (method-of-object obj waiting)) + (rigid-body-object-method-42 obj) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (set! (-> s3-1 quad) (-> s5-0 vector 2 quad)) + (vector-normalize! s3-1 1.0) + (vector-float*! s3-1 s3-1 (-> s5-0 trans x)) + (let ((v1-90 (-> obj rbody)) + (a1-11 (-> s5-0 vector)) + (a2-3 s3-1) + ) + (rigid-body-method-18 (-> v1-90 state) (the-as vector a1-11) a2-3) ) - #t + (let ((v1-93 (-> obj rbody)) + (f0-10 1.0) + ) + (rigid-body-method-12 (-> v1-93 state) f0-10) + ) + (rigid-body-method-13 (-> obj rbody state)) + (when #f + (set! (-> *debug-vehicle-work* impact-time) (current-time)) + (mem-copy! (the-as pointer (-> *debug-vehicle-work* impact)) (the-as pointer s5-0) 64) + (let ((v1-103 (-> arg2 head))) + (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* + ) + ) + ) + (rigid-body-object-method-45 obj (the-as rigid-body-impact s5-0)) ) + (if (and (-> obj next-state) (= (-> obj next-state name) 'idle)) + (go (method-of-object obj waiting)) + ) + #t ) ) @@ -1744,8 +1730,8 @@ (set! v1-30 (!= arg0 *target*)) (label cfg-13) (b! (not v1-30) cfg-25 :delay (empty-form)) - (when (>= (- (-> pp clock frame-counter) (-> obj sent-attack-time)) (seconds 0.5)) - (set! (-> obj sent-attack-time) (-> pp clock frame-counter)) + (when (>= (- (current-time) (-> obj sent-attack-time)) (seconds 0.5)) + (set! (-> obj sent-attack-time) (current-time)) (let* ((v1-39 *game-info*) (a0-18 (+ (-> v1-39 attack-id) 1)) ) @@ -1794,7 +1780,7 @@ ) (rigid-body-method-13 (-> obj rbody state)) (when #f - (set! (-> *debug-vehicle-work* impact-time) (-> pp clock frame-counter)) + (set! (-> *debug-vehicle-work* impact-time) (current-time)) (mem-copy! (the-as pointer (-> *debug-vehicle-work* impact)) (the-as pointer s5-0) 64) (let ((v1-73 (-> arg1 head))) (set! (-> *debug-vehicle-work* prim-sphere1 quad) (-> v1-73 prim1 cprim prim-core world-sphere quad)) @@ -1903,7 +1889,7 @@ ) ((= v1-19 'turbo-ring) (set! (-> obj turbo-boost-factor) (the-as float (-> arg3 param 0))) - (set! (-> obj turbo-boost-time) (-> self clock frame-counter)) + (set! (-> obj turbo-boost-time) (current-time)) (set! (-> obj turbo-boost-duration) (the-as uint 75)) (set! (-> obj flags) (logior (rigid-body-object-flag turbo-boost) (-> obj flags))) (if (logtest? (-> obj flags) (rigid-body-object-flag player-driving)) diff --git a/test/decompiler/reference/jak2/levels/city/farm/ctyfarm-obs_REF.gc b/test/decompiler/reference/jak2/levels/city/farm/ctyfarm-obs_REF.gc index 3c0e1fe552..51056ccc1f 100644 --- a/test/decompiler/reference/jak2/levels/city/farm/ctyfarm-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/farm/ctyfarm-obs_REF.gc @@ -953,21 +953,19 @@ ;; definition for method 9 of type shaker ;; WARN: Return type mismatch float vs none. (defmethod shaker-method-9 shaker ((obj shaker)) - (with-pp - (let ((s5-0 (- (-> pp clock frame-counter) (-> obj start-time)))) - (set! (-> obj shake) (* (-> obj amplitude) - (lerp-scale 1.0 0.0 (the float s5-0) 0.0 (-> obj decay-time)) - (cos (* 65536.0 (/ (the float s5-0) (-> obj freq)))) + (let ((s5-0 (- (current-time) (-> obj start-time)))) + (set! (-> obj shake) (* (-> obj amplitude) + (lerp-scale 1.0 0.0 (the float s5-0) 0.0 (-> obj decay-time)) + (cos (* 65536.0 (/ (the float s5-0) (-> obj freq)))) + ) + ) + (set! (-> obj y-shake) (* (-> obj y-amplitude) + (lerp-scale 1.0 0.0 (the float s5-0) 0.0 (-> obj y-decay-time)) + (cos (* 65536.0 (/ (the float s5-0) (-> obj y-freq)))) ) - ) - (set! (-> obj y-shake) (* (-> obj y-amplitude) - (lerp-scale 1.0 0.0 (the float s5-0) 0.0 (-> obj y-decay-time)) - (cos (* 65536.0 (/ (the float s5-0) (-> obj y-freq)))) - ) - ) - ) - (none) + ) ) + (none) ) ;; definition for function pu->knocked-type @@ -1068,27 +1066,23 @@ ;; definition for function farm-marrow-callback ;; WARN: Return type mismatch int vs none. (defun farm-marrow-callback ((arg0 cspace) (arg1 transformq)) - (with-pp - (let ((s4-0 (the-as farm-marrow (-> arg0 param1))) - (s3-0 (the-as int (-> arg0 param2))) - ) - (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! - (new 'stack-no-clear 'quaternion) - (the-as vector (-> s4-0 shakers s3-0)) - (-> s4-0 shakers s3-0 shake) - ) - ) - (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) - (if (< (the int (-> s4-0 shakers s3-0 decay-time)) - (- (-> pp clock frame-counter) (-> s4-0 shakers s3-0 start-time)) - ) - (set! (-> arg0 param0) #f) - ) - ) - (cspace<-parented-transformq-joint! arg0 arg1) - 0 - (none) + (let ((s4-0 (the-as farm-marrow (-> arg0 param1))) + (s3-0 (the-as int (-> arg0 param2))) + ) + (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (the-as vector (-> s4-0 shakers s3-0)) + (-> s4-0 shakers s3-0 shake) + ) + ) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) + (if (< (the int (-> s4-0 shakers s3-0 decay-time)) (- (current-time) (-> s4-0 shakers s3-0 start-time))) + (set! (-> arg0 param0) #f) + ) ) + (cspace<-parented-transformq-joint! arg0 arg1) + 0 + (none) ) ;; failed to figure out what this is: @@ -1146,7 +1140,7 @@ ) (let ((v1-10 (-> self shakers))) (set! (-> v1-10 0 axis quad) (-> gp-4 quad)) - (set! (-> v1-10 0 start-time) (-> self clock frame-counter)) + (set! (-> v1-10 0 start-time) (current-time)) (set! (-> v1-10 0 decay-time) 300.0) (set! (-> v1-10 0 freq) 150.0) (set! (-> v1-10 0 amplitude) 1820.4445) @@ -1159,7 +1153,7 @@ ) (let ((v1-13 (-> self shakers 1))) (set! (-> v1-13 axis quad) (-> gp-4 quad)) - (set! (-> v1-13 start-time) (+ (-> self clock frame-counter) (seconds -0.06))) + (set! (-> v1-13 start-time) (+ (current-time) (seconds -0.06))) (set! (-> v1-13 decay-time) 450.0) (set! (-> v1-13 freq) 150.0) (set! (-> v1-13 amplitude) 1820.4445) @@ -1172,7 +1166,7 @@ ) (let ((v1-16 (-> self shakers 2))) (set! (-> v1-16 axis quad) (-> gp-4 quad)) - (set! (-> v1-16 start-time) (+ (-> self clock frame-counter) (seconds -0.12))) + (set! (-> v1-16 start-time) (+ (current-time) (seconds -0.12))) (set! (-> v1-16 decay-time) 600.0) (set! (-> v1-16 freq) 150.0) (set! (-> v1-16 amplitude) 1820.4445) @@ -1185,7 +1179,7 @@ ) (let ((v1-19 (-> self shakers 3))) (set! (-> v1-19 axis quad) (-> gp-4 quad)) - (set! (-> v1-19 start-time) (+ (-> self clock frame-counter) (seconds -0.06))) + (set! (-> v1-19 start-time) (+ (current-time) (seconds -0.06))) (set! (-> v1-19 decay-time) 300.0) (set! (-> v1-19 freq) 150.0) (set! (-> v1-19 amplitude) 910.2222) @@ -1200,7 +1194,7 @@ ) (let ((v1-22 (-> self shakers 4))) (set! (-> v1-22 axis quad) (-> gp-4 quad)) - (set! (-> v1-22 start-time) (+ (-> self clock frame-counter) (seconds -0.12))) + (set! (-> v1-22 start-time) (+ (current-time) (seconds -0.12))) (set! (-> v1-22 decay-time) 600.0) (set! (-> v1-22 freq) 150.0) (set! (-> v1-22 amplitude) 910.2222) @@ -1399,27 +1393,23 @@ This commonly includes things such as: ;; definition for function farm-beetree-callback ;; WARN: Return type mismatch int vs none. (defun farm-beetree-callback ((arg0 cspace) (arg1 transformq)) - (with-pp - (let ((s4-0 (the-as farm-beetree (-> arg0 param1))) - (s3-0 (the-as int (-> arg0 param2))) - ) - (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! - (new 'stack-no-clear 'quaternion) - (the-as vector (-> s4-0 shakers s3-0)) - (-> s4-0 shakers s3-0 shake) - ) - ) - (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) - (if (< (the int (-> s4-0 shakers s3-0 decay-time)) - (- (-> pp clock frame-counter) (-> s4-0 shakers s3-0 start-time)) - ) - (set! (-> arg0 param0) #f) - ) - ) - (cspace<-parented-transformq-joint! arg0 arg1) - 0 - (none) + (let ((s4-0 (the-as farm-beetree (-> arg0 param1))) + (s3-0 (the-as int (-> arg0 param2))) + ) + (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (the-as vector (-> s4-0 shakers s3-0)) + (-> s4-0 shakers s3-0 shake) + ) + ) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) + (if (< (the int (-> s4-0 shakers s3-0 decay-time)) (- (current-time) (-> s4-0 shakers s3-0 start-time))) + (set! (-> arg0 param0) #f) + ) ) + (cspace<-parented-transformq-joint! arg0 arg1) + 0 + (none) ) ;; failed to figure out what this is: @@ -1477,7 +1467,7 @@ This commonly includes things such as: ) (let ((v1-10 (-> self shakers))) (set! (-> v1-10 0 axis quad) (-> gp-4 quad)) - (set! (-> v1-10 0 start-time) (-> self clock frame-counter)) + (set! (-> v1-10 0 start-time) (current-time)) (set! (-> v1-10 0 decay-time) 300.0) (set! (-> v1-10 0 freq) 150.0) (set! (-> v1-10 0 amplitude) 1820.4445) @@ -1490,7 +1480,7 @@ This commonly includes things such as: ) (let ((v1-13 (-> self shakers 1))) (set! (-> v1-13 axis quad) (-> gp-4 quad)) - (set! (-> v1-13 start-time) (+ (-> self clock frame-counter) (seconds -0.06))) + (set! (-> v1-13 start-time) (+ (current-time) (seconds -0.06))) (set! (-> v1-13 decay-time) 600.0) (set! (-> v1-13 freq) 150.0) (set! (-> v1-13 amplitude) 364.0889) @@ -1684,27 +1674,23 @@ This commonly includes things such as: ;; definition for function farm-cabbage-callback ;; WARN: Return type mismatch int vs none. (defun farm-cabbage-callback ((arg0 cspace) (arg1 transformq)) - (with-pp - (let ((s4-0 (the-as farm-cabbage (-> arg0 param1))) - (s3-0 (the-as int (-> arg0 param2))) - ) - (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! - (new 'stack-no-clear 'quaternion) - (the-as vector (-> s4-0 shakers s3-0)) - (-> s4-0 shakers s3-0 shake) - ) - ) - (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) - (if (< (the int (-> s4-0 shakers s3-0 decay-time)) - (- (-> pp clock frame-counter) (-> s4-0 shakers s3-0 start-time)) - ) - (set! (-> arg0 param0) #f) - ) - ) - (cspace<-parented-transformq-joint! arg0 arg1) - 0 - (none) + (let ((s4-0 (the-as farm-cabbage (-> arg0 param1))) + (s3-0 (the-as int (-> arg0 param2))) + ) + (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (the-as vector (-> s4-0 shakers s3-0)) + (-> s4-0 shakers s3-0 shake) + ) + ) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) + (if (< (the int (-> s4-0 shakers s3-0 decay-time)) (- (current-time) (-> s4-0 shakers s3-0 start-time))) + (set! (-> arg0 param0) #f) + ) ) + (cspace<-parented-transformq-joint! arg0 arg1) + 0 + (none) ) ;; failed to figure out what this is: @@ -1762,7 +1748,7 @@ This commonly includes things such as: ) (let ((v1-10 (-> self shakers))) (set! (-> v1-10 0 axis quad) (-> gp-4 quad)) - (set! (-> v1-10 0 start-time) (-> self clock frame-counter)) + (set! (-> v1-10 0 start-time) (current-time)) (set! (-> v1-10 0 decay-time) 300.0) (set! (-> v1-10 0 freq) 150.0) (set! (-> v1-10 0 amplitude) 1820.4445) @@ -1775,7 +1761,7 @@ This commonly includes things such as: ) (let ((v1-13 (-> self shakers 1))) (set! (-> v1-13 axis quad) (-> gp-4 quad)) - (set! (-> v1-13 start-time) (+ (-> self clock frame-counter) (seconds -0.06))) + (set! (-> v1-13 start-time) (+ (current-time) (seconds -0.06))) (set! (-> v1-13 decay-time) 600.0) (set! (-> v1-13 freq) 150.0) (set! (-> v1-13 amplitude) 364.0889) @@ -1971,27 +1957,23 @@ This commonly includes things such as: ;; definition for function farm-small-cabbage-callback ;; WARN: Return type mismatch int vs none. (defun farm-small-cabbage-callback ((arg0 cspace) (arg1 transformq)) - (with-pp - (let ((s4-0 (the-as farm-small-cabbage (-> arg0 param1))) - (s3-0 (the-as int (-> arg0 param2))) - ) - (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! - (new 'stack-no-clear 'quaternion) - (the-as vector (-> s4-0 shakers s3-0)) - (-> s4-0 shakers s3-0 shake) - ) - ) - (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) - (if (< (the int (-> s4-0 shakers s3-0 decay-time)) - (- (-> pp clock frame-counter) (-> s4-0 shakers s3-0 start-time)) - ) - (set! (-> arg0 param0) #f) - ) - ) - (cspace<-parented-transformq-joint! arg0 arg1) - 0 - (none) + (let ((s4-0 (the-as farm-small-cabbage (-> arg0 param1))) + (s3-0 (the-as int (-> arg0 param2))) + ) + (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (the-as vector (-> s4-0 shakers s3-0)) + (-> s4-0 shakers s3-0 shake) + ) + ) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) + (if (< (the int (-> s4-0 shakers s3-0 decay-time)) (- (current-time) (-> s4-0 shakers s3-0 start-time))) + (set! (-> arg0 param0) #f) + ) ) + (cspace<-parented-transformq-joint! arg0 arg1) + 0 + (none) ) ;; failed to figure out what this is: @@ -2049,7 +2031,7 @@ This commonly includes things such as: ) (let ((v1-10 (-> self shakers))) (set! (-> v1-10 0 axis quad) (-> gp-4 quad)) - (set! (-> v1-10 0 start-time) (-> self clock frame-counter)) + (set! (-> v1-10 0 start-time) (current-time)) (set! (-> v1-10 0 decay-time) 300.0) (set! (-> v1-10 0 freq) 150.0) (set! (-> v1-10 0 amplitude) 910.2222) @@ -2243,27 +2225,23 @@ This commonly includes things such as: ;; definition for function farm-chilirots-callback ;; WARN: Return type mismatch int vs none. (defun farm-chilirots-callback ((arg0 cspace) (arg1 transformq)) - (with-pp - (let ((s4-0 (the-as farm-chilirots (-> arg0 param1))) - (s3-0 (the-as int (-> arg0 param2))) - ) - (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! - (new 'stack-no-clear 'quaternion) - (the-as vector (-> s4-0 shakers s3-0)) - (-> s4-0 shakers s3-0 shake) - ) - ) - (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) - (if (< (the int (-> s4-0 shakers s3-0 decay-time)) - (- (-> pp clock frame-counter) (-> s4-0 shakers s3-0 start-time)) - ) - (set! (-> arg0 param0) #f) - ) - ) - (cspace<-parented-transformq-joint! arg0 arg1) - 0 - (none) + (let ((s4-0 (the-as farm-chilirots (-> arg0 param1))) + (s3-0 (the-as int (-> arg0 param2))) + ) + (quaternion*! (-> arg1 quat) (-> arg1 quat) (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (the-as vector (-> s4-0 shakers s3-0)) + (-> s4-0 shakers s3-0 shake) + ) + ) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (-> s4-0 shakers s3-0 y-shake)) + (if (< (the int (-> s4-0 shakers s3-0 decay-time)) (- (current-time) (-> s4-0 shakers s3-0 start-time))) + (set! (-> arg0 param0) #f) + ) ) + (cspace<-parented-transformq-joint! arg0 arg1) + 0 + (none) ) ;; failed to figure out what this is: @@ -2321,7 +2299,7 @@ This commonly includes things such as: ) (let ((v1-10 (-> self shakers))) (set! (-> v1-10 0 axis quad) (-> gp-4 quad)) - (set! (-> v1-10 0 start-time) (-> self clock frame-counter)) + (set! (-> v1-10 0 start-time) (current-time)) (set! (-> v1-10 0 decay-time) 300.0) (set! (-> v1-10 0 freq) 150.0) (set! (-> v1-10 0 amplitude) 1820.4445) @@ -2334,7 +2312,7 @@ This commonly includes things such as: ) (let ((v1-13 (-> self shakers 1))) (set! (-> v1-13 axis quad) (-> gp-4 quad)) - (set! (-> v1-13 start-time) (+ (-> self clock frame-counter) (seconds -0.06))) + (set! (-> v1-13 start-time) (+ (current-time) (seconds -0.06))) (set! (-> v1-13 decay-time) 450.0) (set! (-> v1-13 freq) 150.0) (set! (-> v1-13 amplitude) 1820.4445) @@ -2349,7 +2327,7 @@ This commonly includes things such as: ) (let ((v1-16 (-> self shakers 2))) (set! (-> v1-16 axis quad) (-> gp-4 quad)) - (set! (-> v1-16 start-time) (+ (-> self clock frame-counter) (seconds -0.12))) + (set! (-> v1-16 start-time) (+ (current-time) (seconds -0.12))) (set! (-> v1-16 decay-time) 600.0) (set! (-> v1-16 freq) 150.0) (set! (-> v1-16 amplitude) 1820.4445) @@ -2364,7 +2342,7 @@ This commonly includes things such as: ) (let ((v1-19 (-> self shakers 3))) (set! (-> v1-19 axis quad) (-> gp-4 quad)) - (set! (-> v1-19 start-time) (+ (-> self clock frame-counter) (seconds -0.18))) + (set! (-> v1-19 start-time) (+ (current-time) (seconds -0.18))) (set! (-> v1-19 decay-time) 750.0) (set! (-> v1-19 freq) 150.0) (set! (-> v1-19 amplitude) 1820.4445) diff --git a/test/decompiler/reference/jak2/levels/city/farm/yakow_REF.gc b/test/decompiler/reference/jak2/levels/city/farm/yakow_REF.gc index e4ee75e68f..4347f1ad69 100644 --- a/test/decompiler/reference/jak2/levels/city/farm/yakow_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/farm/yakow_REF.gc @@ -315,7 +315,7 @@ ) :post (behavior () (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (-> self clock frame-counter)) + (set! (-> self last-draw-time) (current-time)) ) (enemy-method-129 self) (ja-post) @@ -327,7 +327,7 @@ (defstate active (yakow) :virtual #t :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (< (the-as int (-> self focus aware)) 1) (go-virtual idle) ) @@ -452,7 +452,7 @@ (set! (-> v1-0 nav callback-info) *nav-enemy-null-callback-info*) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () diff --git a/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc-states_REF.gc b/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc-states_REF.gc index 182ebb5a56..964b8a1df8 100644 --- a/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc-states_REF.gc @@ -9,7 +9,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -171,7 +171,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -230,7 +230,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -257,12 +257,10 @@ ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) (go-idle-or-move self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -299,7 +297,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -329,12 +327,10 @@ (logclear! (-> self bot-flags) (bot-flags bf15)) (go-idle-or-move self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -397,7 +393,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -575,7 +571,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -662,7 +658,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -833,7 +829,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -851,7 +847,7 @@ ) :trans (behavior () (bot-method-223 self #f) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) (go-virtual traveling) ) (none) @@ -878,7 +874,7 @@ ) :trans (behavior () (bot-method-223 self #f) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (not (nav-enemy-method-163 self)) (go-virtual traveling) ) @@ -961,7 +957,7 @@ 0.0 (until #f (if (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (>= (- (current-time) (-> self state-time)) (seconds 3)) (reset? *fail-mission-control*) ) (reset! *fail-mission-control*) @@ -1010,7 +1006,7 @@ (defstate failed (crocadog-escort) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1029,7 +1025,7 @@ (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (when (not (logtest? (bot-flags bf19) (-> self bot-flags))) (set! (-> self bot-flags) (logior (bot-flags bf19) (-> self bot-flags))) (fail-mission! self) @@ -1049,7 +1045,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) diff --git a/test/decompiler/reference/jak2/levels/city/kid_escort/hal4-course_REF.gc b/test/decompiler/reference/jak2/levels/city/kid_escort/hal4-course_REF.gc index 56c28ec0fd..4a69591e76 100644 --- a/test/decompiler/reference/jak2/levels/city/kid_escort/hal4-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kid_escort/hal4-course_REF.gc @@ -125,25 +125,23 @@ (defmethod general-event-handler hal-escort ((obj 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" - (with-pp - (case arg2 - (('notify) - (case (-> arg3 param 0) - (('arrest) - (set! (-> obj arrestor-handle) (process->handle (the-as process (-> arg3 param 1)))) - (let ((v0-0 (the-as object (-> pp clock frame-counter)))) - (set! (-> obj arrestor-time) (the-as time-frame v0-0)) - v0-0 - ) + (case arg2 + (('notify) + (case (-> arg3 param 0) + (('arrest) + (set! (-> obj arrestor-handle) (process->handle (the-as process (-> arg3 param 1)))) + (let ((v0-0 (the-as object (current-time)))) + (set! (-> obj arrestor-time) (the-as time-frame v0-0)) + v0-0 ) - (else - ((method-of-type hal general-event-handler) obj arg0 arg1 arg2 arg3) - ) + ) + (else + ((method-of-type hal general-event-handler) obj arg0 arg1 arg2 arg3) ) ) - (else - ((method-of-type hal general-event-handler) obj arg0 arg1 arg2 arg3) - ) + ) + (else + ((method-of-type hal general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -162,50 +160,48 @@ ;; definition for method 235 of type hal-escort (defmethod hal-escort-method-235 hal-escort ((obj hal-escort)) - (with-pp - (let* ((s5-0 (handle->process (-> obj arrestor-handle))) - (v1-3 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - ) - (when v1-3 - (cond - ((>= (- (-> pp clock frame-counter) (-> obj arrestor-time)) (seconds 4)) - (set! (-> obj arrestor-handle) (the-as handle #f)) - ) - ((focus-test? (the-as process-focusable v1-3) hit) - (when (and (>= (- (-> pp clock frame-counter) (-> obj played-defend-time)) (seconds 6)) - (not (channel-active? obj (the-as uint 0))) - ) - (let ((a1-5 (bot-speech-list-method-9 - (-> obj hal4-course defend-speeches) - obj - (-> obj hal4-course speeches) - (speech-flags) - ) - ) + (let* ((s5-0 (handle->process (-> obj arrestor-handle))) + (v1-3 (if (type? s5-0 process-focusable) + s5-0 ) - (when (>= a1-5 0) - (play-speech obj a1-5) - (set! (-> obj played-defend-time) (-> pp clock frame-counter)) + ) + ) + (when v1-3 + (cond + ((>= (- (current-time) (-> obj arrestor-time)) (seconds 4)) + (set! (-> obj arrestor-handle) (the-as handle #f)) + ) + ((focus-test? (the-as process-focusable v1-3) hit) + (when (and (>= (- (current-time) (-> obj played-defend-time)) (seconds 6)) + (not (channel-active? obj (the-as uint 0))) + ) + (let ((a1-5 (bot-speech-list-method-9 + (-> obj hal4-course defend-speeches) + obj + (-> obj hal4-course speeches) + (speech-flags) + ) + ) ) + (when (>= a1-5 0) + (play-speech obj a1-5) + (set! (-> obj played-defend-time) (current-time)) ) ) - (set! (-> obj arrestor-handle) (the-as handle #f)) ) - ) + (set! (-> obj arrestor-handle) (the-as handle #f)) + ) ) ) - (if (and (not (speech-playing? obj 30)) - (nonzero? (-> obj played-defend-time)) - (>= (- (-> pp clock frame-counter) (-> obj played-defend-time)) (seconds 3)) - (not (channel-active? obj (the-as uint 0))) - ) - (play-speech obj 30) - ) - (none) ) + (if (and (not (speech-playing? obj 30)) + (nonzero? (-> obj played-defend-time)) + (>= (- (current-time) (-> obj played-defend-time)) (seconds 3)) + (not (channel-active? obj (the-as uint 0))) + ) + (play-speech obj 30) + ) + (none) ) ;; definition for method 236 of type hal-escort @@ -217,38 +213,36 @@ ;; definition for method 227 of type hal-escort (defmethod hal-escort-method-227 hal-escort ((obj hal-escort)) - (with-pp - (let ((s5-0 *target*)) - (when (focus-test? s5-0 pilot-riding pilot) - (let* ((a0-2 (-> obj 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 - ) - ) + (let ((s5-0 *target*)) + (when (focus-test? s5-0 pilot-riding pilot) + (let* ((a0-2 (-> obj 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 + ) ) ) - ) - (when (focus-test? (the-as process-focusable v1-5) pilot-riding pilot) - (let* ((v1-12 (-> obj 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 - ) - ) + ) + ) + (when (focus-test? (the-as process-focusable v1-5) pilot-riding pilot) + (let* ((v1-12 (-> obj 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 + ) ) ) - ) - (when (not (focus-test? (the-as process-focusable a0-5) pilot-riding pilot)) - (let ((f0-0 245760.0)) - (and (< (* f0-0 f0-0) - (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-5) 0) (get-trans s5-0 0)) - ) - (>= (-> pp clock frame-counter) (-> obj dont-fail-until)) ) - ) + ) + (when (not (focus-test? (the-as process-focusable a0-5) pilot-riding pilot)) + (let ((f0-0 245760.0)) + (and (< (* f0-0 f0-0) + (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-5) 0) (get-trans s5-0 0)) + ) + (>= (current-time) (-> obj dont-fail-until)) + ) ) ) ) @@ -261,32 +255,30 @@ ;; definition for method 228 of type hal-escort ;; WARN: Return type mismatch object vs symbol. (defmethod hal-escort-method-228 hal-escort ((obj hal-escort)) - (with-pp - (let* ((v1-3 (-> obj 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 - ) - ) + (let* ((v1-3 (-> obj 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 + ) ) ) - (s5-1 *target*) - ) - (the-as - 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)) - ) - (>= (-> pp clock frame-counter) (-> obj dont-fail-until)) - ) - ) + ) + (s5-1 *target*) + ) + (the-as + 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) (-> obj dont-fail-until)) + ) ) - ) - ) + ) + ) ) ) ) @@ -396,60 +388,58 @@ ;; definition for method 232 of type hal-escort ;; WARN: Return type mismatch int vs none. (defmethod hal-escort-method-232 hal-escort ((obj hal-escort)) - (with-pp - (let* ((target *target*) - (v1-3 (-> obj 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 - ) - ) + (let* ((target *target*) + (v1-3 (-> obj 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 + ) ) ) - (a0-2 (-> obj 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 - ) - ) + ) + (a0-2 (-> obj 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 + ) ) ) + ) + ) + (when target + (cond + ((not (-> *setting-control* user-current pilot-exit)) + (when (and s5-0 + v1-8 + (not (focus-test? (the-as process-focusable s5-0) pilot-riding)) + (not (focus-test? (the-as process-focusable v1-8) pilot-riding)) + (>= (- (current-time) (-> obj locked-player-time)) (seconds 10)) + ) + (remove-setting! 'pilot-exit) + (set-setting! 'pilot #f 0.0 0) + (apply-settings *setting-control*) ) - (when target - (cond - ((not (-> *setting-control* user-current pilot-exit)) - (when (and s5-0 - v1-8 - (not (focus-test? (the-as process-focusable s5-0) pilot-riding)) - (not (focus-test? (the-as process-focusable v1-8) pilot-riding)) - (>= (- (-> pp clock frame-counter) (-> obj locked-player-time)) (seconds 10)) - ) - (remove-setting! 'pilot-exit) - (set-setting! 'pilot #f 0.0 0) - (apply-settings *setting-control*) - ) + ) + ((focus-test? target pilot-riding) + (when (and (nonzero? (-> target pilot)) + (and (= (handle->process (-> target pilot vehicle)) (handle->process (-> obj vehicle-handle))) + (or (and s5-0 (focus-test? (the-as process-focusable s5-0) pilot)) + (and v1-8 (focus-test? (the-as process-focusable v1-8) pilot)) + ) + ) + ) + (set-setting! 'pilot-exit #f 0.0 0) + (apply-settings *setting-control*) + (set! (-> obj locked-player-time) (current-time)) ) - ((focus-test? target pilot-riding) - (when (and (nonzero? (-> target pilot)) - (and (= (handle->process (-> target pilot vehicle)) (handle->process (-> obj vehicle-handle))) - (or (and s5-0 (focus-test? (the-as process-focusable s5-0) pilot)) - (and v1-8 (focus-test? (the-as process-focusable v1-8) pilot)) - ) - ) - ) - (set-setting! 'pilot-exit #f 0.0 0) - (apply-settings *setting-control*) - (set! (-> obj locked-player-time) (-> pp clock frame-counter)) - ) - ) - ) + ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 231 of type hal-escort @@ -1024,36 +1014,34 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-escort)) - (with-pp - (if (and (not (speech-playing? arg1 3)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) - (not (channel-active? arg1 (the-as uint 0))) - ) - (play-speech arg1 3) - ) - (when (hal-escort-method-228 arg1) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 28 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) + (if (and (not (speech-playing? arg1 3)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 3) ) - (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 - ) - ) + (when (hal-escort-method-228 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 28 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (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 + ) ) ) - ) - (when (and a0-11 (>= (the-as int (send-event a0-11 'query 'waypoint)) 6)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 6 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + ) + ) + (when (and a0-11 (>= (the-as int (send-event a0-11 'query 'waypoint)) 6)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 6 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) @@ -1219,36 +1207,34 @@ ) :on-update (lambda ((arg0 hal-escort)) (set-traffic-danger! arg0) (hal-escort-method-235 arg0) (none)) :on-skipping-here (lambda ((arg0 hal-escort)) - (with-pp - (set! (-> arg0 dont-fail-until) (+ (-> pp clock frame-counter) (seconds 10))) - (reset-warn-time! arg0) - (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 - ) - ) + (set! (-> arg0 dont-fail-until) (+ (current-time) (seconds 10))) + (reset-warn-time! arg0) + (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 + ) ) ) - (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 - ) - ) + ) + (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 + ) ) ) - ) - (send-event s5-1 'skip) - (send-event s4-1 'skip) - ) - (init-traffic-params! arg0 #f) - (none) + ) + ) + (send-event s5-1 'skip) + (send-event s4-1 'skip) ) + (init-traffic-params! arg0 #f) + (none) ) :check-too-far #f ) @@ -1271,90 +1257,88 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-escort)) - (with-pp - (hal-escort-method-232 arg1) - (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) (not (-> *setting-control* user-current pilot-exit))) - (send-event (handle->process (-> arg1 arrow-handle)) 'set-position (-> arg1 hal4-course spots 6)) - (logior! (-> arg1 waypoint-bits) 1) - ) - (if (and (not (speech-playing? arg1 14)) - (not (-> *setting-control* user-current pilot-exit)) - (>= (- (-> pp clock frame-counter) (-> arg1 locked-player-time)) (seconds 1.5)) - ) - (play-speech arg1 14) - ) - (when (vehicle-destroyed? arg1) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 29 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (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 - ) - ) - ) - ) - (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 - ) - ) - ) - ) + (hal-escort-method-232 arg1) + (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) (not (-> *setting-control* user-current pilot-exit))) + (send-event (handle->process (-> arg1 arrow-handle)) 'set-position (-> arg1 hal4-course spots 6)) + (logior! (-> arg1 waypoint-bits) 1) + ) + (if (and (not (speech-playing? arg1 14)) + (not (-> *setting-control* user-current pilot-exit)) + (>= (- (current-time) (-> arg1 locked-player-time)) (seconds 1.5)) ) - (let ((s3-1 #f)) - (let* ((s1-0 (handle->process (-> arg1 vehicle-handle))) - (s2-0 (if (type? s1-0 process-focusable) - s1-0 - ) - ) - ) - (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))) - (>= 16384.0 (- (-> s1-1 y) (-> s0-0 center y))) - (>= 61440.0 (vector-length (-> (the-as process-focusable s2-0) root-override transv))) - (>= 1.0 (vector-length (-> (the-as process-focusable s2-0) rbody state ang-velocity))) + (play-speech arg1 14) + ) + (when (vehicle-destroyed? arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 29 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (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 ) - (set! s3-1 #t) - ) - ) + ) + ) + ) + (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 + ) + ) + ) + ) + ) + (let ((s3-1 #f)) + (let* ((s1-0 (handle->process (-> arg1 vehicle-handle))) + (s2-0 (if (type? s1-0 process-focusable) + s1-0 + ) + ) + ) + (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))) + (>= 16384.0 (- (-> s1-1 y) (-> s0-0 center y))) + (>= 61440.0 (vector-length (-> (the-as process-focusable s2-0) root-override transv))) + (>= 1.0 (vector-length (-> (the-as process-focusable s2-0) rbody state ang-velocity))) + ) + (set! s3-1 #t) + ) ) ) - (if (focus-test? (the-as process-focusable s5-0) pilot) - (send-event s5-0 'request 'exit-vehicle s3-1 1) - ) - (if (focus-test? (the-as process-focusable s5-0) pilot) - (send-event s4-1 'request 'exit-vehicle s3-1 1) - ) - (if (and (not (speech-playing? arg1 7)) - (not (focus-test? (the-as process-focusable s4-1) pilot-riding)) - (not (logtest? (bot-flags bf17) (-> (the-as bot s4-1) bot-flags))) - s3-1 - (not (channel-active? arg1 (the-as uint 0))) - ) - (play-speech arg1 7) - ) - ) - (when (and (not (focus-test? (the-as process-focusable s4-1) pilot)) - (not (logtest? (bot-flags bf17) (-> (the-as bot s4-1) bot-flags))) - (not (focus-test? (the-as process-focusable s5-0) pilot)) - (not (logtest? (bot-flags bf17) (-> (the-as bot s5-0) bot-flags))) - ) - (send-event *target* 'end-mode) - (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 ) + (if (focus-test? (the-as process-focusable s5-0) pilot) + (send-event s5-0 'request 'exit-vehicle s3-1 1) + ) + (if (focus-test? (the-as process-focusable s5-0) pilot) + (send-event s4-1 'request 'exit-vehicle s3-1 1) + ) + (if (and (not (speech-playing? arg1 7)) + (not (focus-test? (the-as process-focusable s4-1) pilot-riding)) + (not (logtest? (bot-flags bf17) (-> (the-as bot s4-1) bot-flags))) + s3-1 + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 7) + ) + ) + (when (and (not (focus-test? (the-as process-focusable s4-1) pilot)) + (not (logtest? (bot-flags bf17) (-> (the-as bot s4-1) bot-flags))) + (not (focus-test? (the-as process-focusable s5-0) pilot)) + (not (logtest? (bot-flags bf17) (-> (the-as bot s5-0) bot-flags))) + ) + (send-event *target* 'end-mode) + (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 ) ) ) @@ -1364,45 +1348,43 @@ (none) ) :on-update (lambda ((arg0 hal-escort)) - (with-pp - (when (and (not (speech-playing? arg0 31)) (not (speech-playing? arg0 32))) - (let ((v1-7 (handle->process (-> arg0 vehicle-handle)))) - (if (and v1-7 - (and (not (logtest? (-> (the-as vehicle v1-7) flags) (rigid-body-object-flag dead))) - (>= (vector-length (-> (the-as vehicle v1-7) root-override-2 transv)) 40960.0) - (not (channel-active? arg0 (the-as uint 0))) - ) - ) - (play-speech arg0 (if (zero? (get-rand-int arg0 2)) - 32 - 31 + (when (and (not (speech-playing? arg0 31)) (not (speech-playing? arg0 32))) + (let ((v1-7 (handle->process (-> arg0 vehicle-handle)))) + (if (and v1-7 + (and (not (logtest? (-> (the-as vehicle v1-7) flags) (rigid-body-object-flag dead))) + (>= (vector-length (-> (the-as vehicle v1-7) root-override-2 transv)) 40960.0) + (not (channel-active? arg0 (the-as uint 0))) + ) + ) + (play-speech arg0 (if (zero? (get-rand-int arg0 2)) + 32 + 31 + ) + ) + ) + ) + ) + (when (and (zero? (-> arg0 locked-player-time)) + (or (not (speech-playing? arg0 33)) (not (speech-playing? arg0 34))) + (>= (- (current-time) (-> arg0 played-get-in-time)) (seconds 6)) + (not (channel-active? arg0 (the-as uint 0))) + ) + (let ((a0-18 (handle->process (-> arg0 vehicle-handle)))) + (when a0-18 + (let ((f0-1 (vector-vector-xz-distance (get-trans (the-as vehicle a0-18) 0) (target-pos 0)))) + (when (and (< 28672.0 f0-1) (< f0-1 184320.0)) + (play-speech arg0 (if (speech-playing? arg0 33) + 34 + 33 ) ) - ) - ) - ) - (when (and (zero? (-> arg0 locked-player-time)) - (or (not (speech-playing? arg0 33)) (not (speech-playing? arg0 34))) - (>= (- (-> pp clock frame-counter) (-> arg0 played-get-in-time)) (seconds 6)) - (not (channel-active? arg0 (the-as uint 0))) - ) - (let ((a0-18 (handle->process (-> arg0 vehicle-handle)))) - (when a0-18 - (let ((f0-1 (vector-vector-xz-distance (get-trans (the-as vehicle a0-18) 0) (target-pos 0)))) - (when (and (< 28672.0 f0-1) (< f0-1 184320.0)) - (play-speech arg0 (if (speech-playing? arg0 33) - 34 - 33 - ) - ) - (set! (-> arg0 played-get-in-time) (-> pp clock frame-counter)) - ) + (set! (-> arg0 played-get-in-time) (current-time)) ) ) ) ) - (none) ) + (none) ) :on-skipping-here #f :check-too-far #f @@ -1420,40 +1402,38 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-escort)) - (with-pp - (if (!= (level-status *level* 'ctyinda) 'active) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - (when (>= (- (-> pp clock frame-counter) (-> 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 + (if (!= (level-status *level* 'ctyinda) 'active) + (set! (-> arg1 waypoint-time0) (current-time)) ) + (when (>= (- (current-time) (-> 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 ) ) ) @@ -1463,38 +1443,36 @@ ) :on-update #f :on-skipping-here (lambda ((arg0 hal-escort)) - (with-pp - (set! (-> arg0 dont-fail-until) (+ (-> pp clock frame-counter) (seconds 15))) - (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 - ) - ) + (set! (-> arg0 dont-fail-until) (+ (current-time) (seconds 15))) + (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 + ) ) ) - (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 - ) - ) + ) + (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 + ) ) ) - ) - (vector-reset! (-> (the-as process-focusable s5-0) root-override transv)) - (vector-reset! (-> (the-as process-focusable s4-1) root-override transv)) - (send-event s5-0 'hide #t) - (send-event s4-1 'hide #t) - ) - (send-event arg0 'move-trans (-> arg0 hal4-course spots 7)) - (send-event *target* 'continue (get-continue-by-name *game-info* "lkiddoge-skip1")) - (none) + ) + ) + (vector-reset! (-> (the-as process-focusable s5-0) root-override transv)) + (vector-reset! (-> (the-as process-focusable s4-1) root-override transv)) + (send-event s5-0 'hide #t) + (send-event s4-1 'hide #t) ) + (send-event arg0 'move-trans (-> arg0 hal4-course spots 7)) + (send-event *target* 'continue (get-continue-by-name *game-info* "lkiddoge-skip1")) + (none) ) :check-too-far #f ) @@ -1521,47 +1499,45 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-escort)) - (with-pp - (when (and (not (speech-playing? arg1 4)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) - (not (channel-active? arg1 (the-as uint 0))) + (when (and (not (speech-playing? arg1 4)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 15) + (play-speech arg1 4) + ) + (when (hal-escort-method-228 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 31 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (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 + ) + ) + ) + ) + (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 + ) + ) + ) + ) + ) + (when (and (and s4-0 (>= (the-as int (send-event s4-0 'query 'waypoint)) 25)) + (and s5-1 (>= (the-as int (send-event s5-1 'query 'waypoint)) 25)) ) - (play-speech arg1 15) - (play-speech arg1 4) - ) - (when (hal-escort-method-228 arg1) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 31 #f) + (go-to-waypoint! arg1 25 #f) (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (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 - ) - ) - ) - ) - (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 - ) - ) - ) - ) - ) - (when (and (and s4-0 (>= (the-as int (send-event s4-0 'query 'waypoint)) 25)) - (and s5-1 (>= (the-as int (send-event s5-1 'query 'waypoint)) 25)) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 25 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + #t ) ) ) @@ -1577,36 +1553,34 @@ (none) ) :on-skipping-here (lambda ((arg0 hal-escort)) - (with-pp - (set! (-> arg0 dont-fail-until) (+ (-> pp clock frame-counter) (seconds 15))) - (reset-warn-time! arg0) - (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) - (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 - ) - ) + (set! (-> arg0 dont-fail-until) (+ (current-time) (seconds 15))) + (reset-warn-time! arg0) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (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 + ) ) ) - (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 - ) - ) + ) + (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 + ) ) ) - ) - (send-event s5-1 'skip) - (send-event gp-1 'skip) - ) - (none) + ) + ) + (send-event s5-1 'skip) + (send-event gp-1 'skip) ) + (none) ) :check-too-far 'hal4-walking-too-far ) @@ -1764,7 +1738,7 @@ ) ) (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.75)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.75)) ) (logior! (-> arg1 waypoint-bits) 2) (let ((s5-0 *traffic-manager*)) @@ -1775,7 +1749,7 @@ ) ) (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.2)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.2)) ) (let* ((v1-55 (-> arg1 actor-group 0 data 2 actor)) (s5-1 (when v1-55 @@ -1803,7 +1777,7 @@ (send-event s5-1 'request 'waypoint 26) ) ) - (when (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) + (when (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3)) (not (channel-active? arg1 (the-as uint 0))) (scene-play arg1 "dig-knock-down-scaffolding-intro" #t) ) @@ -1905,7 +1879,7 @@ (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-escort)) (with-pp - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3)) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-1 from) (process->ppointer pp)) (set! (-> a1-1 num-params) 0) diff --git a/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc-states_REF.gc b/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc-states_REF.gc index a7555c4242..6335f892a2 100644 --- a/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc-states_REF.gc @@ -6,7 +6,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -88,7 +88,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -151,7 +151,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -184,12 +184,10 @@ ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) (check-arrest self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -224,7 +222,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -261,12 +259,10 @@ (logclear! (-> self bot-flags) (bot-flags bf15)) (check-arrest self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -327,7 +323,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -480,7 +476,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -567,7 +563,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -726,7 +722,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -751,7 +747,7 @@ ) (go-virtual arrested) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + ((and (>= (- (current-time) (-> 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) @@ -790,7 +786,7 @@ (go-virtual arrested) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (when (not (nav-enemy-method-163 self)) (if (logtest? (-> self bot-flags) (bot-flags bf15)) (go-virtual move-to-vehicle) @@ -865,7 +861,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -954,7 +950,7 @@ (when (not (logtest? (bot-flags bf19) (-> self bot-flags))) (until #f (until (ja-done? 0) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2.5)) (goto cfg-27) ) (suspend) @@ -979,11 +975,11 @@ ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (until (ja-done? 0) (if (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (>= (- (current-time) (-> self state-time)) (seconds 3)) (reset? *fail-mission-control*) ) (reset! *fail-mission-control*) @@ -1036,7 +1032,7 @@ (until #f (until (ja-done? 0) (if (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (>= (- (current-time) (-> self state-time)) (seconds 3)) (reset? *fail-mission-control*) ) (reset! *fail-mission-control*) @@ -1076,7 +1072,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) diff --git a/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc4-course_REF.gc b/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc4-course_REF.gc index 31b7fdddad..e83e53e7dc 100644 --- a/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc4-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc4-course_REF.gc @@ -361,15 +361,13 @@ (the-as (function kidesct-wait-spot kid-escort symbol) (lambda ((arg0 object) (arg1 kid-escort)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) - (let ((v1-4 (-> arg1 spot))) - (set! (-> v1-4 center quad) (-> arg1 root-override2 trans quad)) - (set! (-> v1-4 center w) 20480.0) - ) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) + (let ((v1-4 (-> arg1 spot))) + (set! (-> v1-4 center quad) (-> arg1 root-override2 trans quad)) + (set! (-> v1-4 center w) 20480.0) ) - #f ) + #f ) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/market/ctymark-obs_REF.gc b/test/decompiler/reference/jak2/levels/city/market/ctymark-obs_REF.gc index c5d54cd8f1..a1743684da 100644 --- a/test/decompiler/reference/jak2/levels/city/market/ctymark-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/market/ctymark-obs_REF.gc @@ -1099,8 +1099,8 @@ :to self ) (process-entity-status! self (entity-perm-status dead) #t) - (let ((frame (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) frame) (seconds 5)) + (let ((frame (current-time))) + (until (>= (- (current-time) frame) (seconds 5)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/market/east/ashelin/ash4-course_REF.gc b/test/decompiler/reference/jak2/levels/city/market/east/ashelin/ash4-course_REF.gc index 9c4ee1d771..7c27e4ce6d 100644 --- a/test/decompiler/reference/jak2/levels/city/market/east/ashelin/ash4-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/market/east/ashelin/ash4-course_REF.gc @@ -341,52 +341,50 @@ :nav-mesh-index -1 :skip-to -1 :on-set (lambda ((arg0 ashelin-tanker)) - (with-pp - (set! (-> arg0 waypoint-time0) (-> pp clock frame-counter)) - (ashelin-method-250 arg0 #f) - (task-node-close! (game-task-node city-intercept-tanker-battle)) - (remove-setting! 'sound-mode) - (remove-setting! 'music) - (when (not (channel-active? arg0 (the-as uint 0))) - (let ((v1-12 (get-rand-int arg0 3))) - (cond - ((zero? v1-12) - (play-speech arg0 42) - ) - ((= v1-12 1) - (play-speech arg0 43) - ) - (else - (play-speech arg0 44) - ) + (set! (-> arg0 waypoint-time0) (current-time)) + (ashelin-method-250 arg0 #f) + (task-node-close! (game-task-node city-intercept-tanker-battle)) + (remove-setting! 'sound-mode) + (remove-setting! 'music) + (when (not (channel-active? arg0 (the-as uint 0))) + (let ((v1-12 (get-rand-int arg0 3))) + (cond + ((zero? v1-12) + (play-speech arg0 42) + ) + ((= v1-12 1) + (play-speech arg0 43) + ) + (else + (play-speech arg0 44) ) ) ) - (let ((v1-20 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) - (set! (-> v1-20 bytes 5) 1) - (set! (-> v1-20 bytes 6) 0) - (set! (-> v1-20 bytes 4) -1) - (set! (-> (the-as asht-wait-spot v1-20) check-done) - (the-as - (function asht-wait-spot ashelin symbol) - (lambda ((arg0 object) (arg1 ashelin-tanker)) - (let ((s5-0 (get-current-task-event (-> arg1 task)))) - (when (and (= (-> s5-0 action) (game-task-action say)) - (not (channel-active? arg1 (the-as uint 0))) - (scene-play arg1 (the-as string (-> s5-0 scene)) #f) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 7 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + ) + (let ((v1-20 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-20 bytes 5) 1) + (set! (-> v1-20 bytes 6) 0) + (set! (-> v1-20 bytes 4) -1) + (set! (-> (the-as asht-wait-spot v1-20) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) + (let ((s5-0 (get-current-task-event (-> arg1 task)))) + (when (and (= (-> s5-0 action) (game-task-action say)) + (not (channel-active? arg1 (the-as uint 0))) + (scene-play arg1 (the-as string (-> s5-0 scene)) #f) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 7 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) ) - ) - (none) + ) ) + (none) ) :on-update (lambda ((arg0 ashelin-tanker)) (suppress-traffic arg0) diff --git a/test/decompiler/reference/jak2/levels/city/market/east/ashelin/ctyasha-obs_REF.gc b/test/decompiler/reference/jak2/levels/city/market/east/ashelin/ctyasha-obs_REF.gc index f3a565e7ff..954d20ca4b 100644 --- a/test/decompiler/reference/jak2/levels/city/market/east/ashelin/ctyasha-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/market/east/ashelin/ctyasha-obs_REF.gc @@ -1644,7 +1644,7 @@ This commonly includes things such as: (set! (-> a1-5 tlist) *touching-list*) (find-overlapping-shapes (-> self root-override) a1-5) ) - (if (>= (-> self clock frame-counter) (-> self die-time)) + (if (>= (current-time) (-> self die-time)) (go-virtual die-fast) ) (none) @@ -1665,7 +1665,7 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defbehavior tanker-deadly-init-by-other tanker-deadly ((arg0 vector) (arg1 int) (arg2 int)) (set! (-> self track-joint) arg1) - (set! (-> self die-time) (+ (-> self clock frame-counter) arg2)) + (set! (-> self die-time) (+ (current-time) arg2)) (let* ((v1-3 *game-info*) (a0-2 (+ (-> v1-3 attack-id) 1)) ) diff --git a/test/decompiler/reference/jak2/levels/city/market/west/brutter_kiosk/meet-brutter_REF.gc b/test/decompiler/reference/jak2/levels/city/market/west/brutter_kiosk/meet-brutter_REF.gc index ae21a002c6..ce30f95581 100644 --- a/test/decompiler/reference/jak2/levels/city/market/west/brutter_kiosk/meet-brutter_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/market/west/brutter_kiosk/meet-brutter_REF.gc @@ -1283,7 +1283,7 @@ (set! (-> self gnd-height) (-> self root-override2 gspot-pos y)) (logior! (-> self flags) (citizen-flag persistent)) (set! (-> self focus-status) (logior (focus-status pilot-riding pilot) (-> self focus-status))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-31 (-> self root-override2 root-prim))) (set! (-> v1-31 prim-core collide-as) (collide-spec)) (set! (-> v1-31 prim-core collide-with) (collide-spec)) @@ -1336,14 +1336,14 @@ ) (let ((s5-3 (new 'stack-no-clear 'vector))) (let ((s4-0 (new 'stack-no-clear 'quaternion))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (while (not (civilian-method-217 self s5-3)) (let ((s3-0 (handle->process (-> self vehicle)))) (new 'stack-no-clear 'vector) (quaternion-copy! (-> self root-override2 quat) (-> (the-as vehicle s3-0) root-override-2 quat)) (compute-seat-position (the-as vehicle s3-0) (-> self root-override2 trans) (-> self seat)) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2)) (go-virtual ride) ) (suspend) @@ -1405,7 +1405,7 @@ ) ) (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-166 self) (let ((v1-15 (-> self nav))) (set! (-> v1-15 target-speed) (* (-> self speed-scale) (-> self speed-run))) @@ -1558,7 +1558,7 @@ :event (the-as (function process int symbol event-message-block object :behavior city-lurker) enemy-event-handler) :enter (behavior () (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-166 self) (let ((v1-6 (-> self nav))) (set! (-> v1-6 target-speed) (* (-> self speed-scale) (-> self speed-run))) @@ -1616,7 +1616,7 @@ (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) (send-event self 'jump 0 (-> self end-pos)) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (logtest? (-> self nav state flags) (nav-state-flag at-target)) ) (go-virtual wait-at-end) @@ -1656,7 +1656,7 @@ :event (the-as (function process int symbol event-message-block object :behavior city-lurker) enemy-event-handler) :enter (behavior () (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-166 self) (let ((v1-6 (-> self nav))) (set! (-> v1-6 target-speed) (* (-> self speed-scale) (-> self speed-run))) @@ -1802,7 +1802,7 @@ :event (the-as (function process int symbol event-message-block object :behavior city-lurker) enemy-event-handler) :enter (behavior () (logclear! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-4 nav callback-info) *nav-enemy-null-callback-info*) @@ -1948,7 +1948,7 @@ (citizen-init! self) (set! (-> self hit-points) 100) (logior! (-> self flags) (citizen-flag persistent)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-8 (-> self root-override2 root-prim))) (set! (-> v1-8 prim-core collide-as) (collide-spec)) (set! (-> v1-8 prim-core collide-with) (collide-spec)) @@ -2509,7 +2509,7 @@ (cond ((= (-> self data-int32 (-> gp-0 index)) -1) (+! (-> self data-int32 (-> gp-0 index)) 1) - (set! (-> self beep-time) (+ (-> self clock frame-counter) (rand-vu-int-range (seconds 10) (seconds 20)))) + (set! (-> self beep-time) (+ (current-time) (rand-vu-int-range (seconds 10) (seconds 20)))) (let ((v1-14 (-> self data-int32 16))) (cond ((zero? v1-14) @@ -2523,7 +2523,7 @@ ) ) ) - (set! (-> self beep-time) (+ (-> self clock frame-counter) (rand-vu-int-range (seconds 10) (seconds 20)))) + (set! (-> self beep-time) (+ (current-time) (rand-vu-int-range (seconds 10) (seconds 20)))) (+! (-> self data-int32 16) 1) ) ((= (-> self data-int32 (-> gp-0 index)) 1) @@ -2831,8 +2831,8 @@ (set! (-> self hud-counter) (ppointer->handle (process-spawn hud-lurker :init hud-init-by-other :to self))) (suspend) (send-event *traffic-manager* 'set-target-level #x3f400000) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (none) @@ -2857,8 +2857,8 @@ (send-event *traffic-manager* 'decrease-alert-level 0) (send-event *traffic-manager* 'set-alert-duration 9000) (send-event *target* 'end-mode) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (task-node-close! (game-task-node city-meet-brutter-meet-brutter)) @@ -3429,8 +3429,8 @@ (set! (-> self hud-counter) (ppointer->handle (process-spawn hud-lurker :init hud-init-by-other :to self))) (suspend) (send-event *traffic-manager* 'set-target-level #x3f400000) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (none) @@ -3452,7 +3452,7 @@ TASK_MANAGER_COMPLETE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (let ((v1-2 0)) (dotimes (a0-0 6) diff --git a/test/decompiler/reference/jak2/levels/city/misc/collection_task/collection-task_REF.gc b/test/decompiler/reference/jak2/levels/city/misc/collection_task/collection-task_REF.gc index c839d9c0fa..eb65898514 100644 --- a/test/decompiler/reference/jak2/levels/city/misc/collection_task/collection-task_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/misc/collection_task/collection-task_REF.gc @@ -337,7 +337,7 @@ (when krew-item (set! (-> self slave 0) (process->handle krew-item)) (set! (-> self time-limit) (the-as time-frame (-> self data-int32 task-count))) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (+! (-> self count) 1) ) ) @@ -378,8 +378,8 @@ (ppointer->handle (process-spawn hud-moneybag :init hud-init-by-other :to *target*)) ) (send-event *traffic-manager* 'set-target-level #x3f800000) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (send-event *traffic-manager* 'set-alert-level 2) @@ -404,8 +404,8 @@ () (send-event *traffic-manager* 'decrease-alert-level 0) (send-event *traffic-manager* 'set-alert-duration 9000) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (talker-spawn-func (-> *talker-speech* 88) *entity-pool* (target-pos 0) (the-as region #f)) diff --git a/test/decompiler/reference/jak2/levels/city/misc/delivery/delivery-task_REF.gc b/test/decompiler/reference/jak2/levels/city/misc/delivery/delivery-task_REF.gc index 04ce8e1be2..2c666120cc 100644 --- a/test/decompiler/reference/jak2/levels/city/misc/delivery/delivery-task_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/misc/delivery/delivery-task_REF.gc @@ -548,8 +548,8 @@ This commonly includes things such as: (send-event *target* 'change-mode 'normal) ) (set-setting! 'pilot #f 0.0 0) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (none) diff --git a/test/decompiler/reference/jak2/levels/city/onin_tent/onin-game_REF.gc b/test/decompiler/reference/jak2/levels/city/onin_tent/onin-game_REF.gc index 17ffff41c5..8693a5f238 100644 --- a/test/decompiler/reference/jak2/levels/city/onin_tent/onin-game_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/onin_tent/onin-game_REF.gc @@ -1962,8 +1962,8 @@ (-> gp-0 ppointer) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.25)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.25)) (suspend) ) ) @@ -2126,7 +2126,7 @@ (defbehavior onin-game-bubble-init onin-game-bubble ((arg0 vector) (arg1 int) (arg2 meters) (arg3 float) (arg4 float)) "TODO - bubble type enum" (sound-play "onin-launch") - (set! (-> self bubble-start-time) (-> self clock frame-counter)) + (set! (-> self bubble-start-time) (current-time)) (set! (-> self bubble-type) arg1) (set! (-> self gravity) arg2) (set! (-> self angle) arg3) @@ -2253,171 +2253,165 @@ (sv-96 meters) (sv-112 float) ) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> obj game-start-time)) (seconds 2)) - (let ((s5-0 (-> obj game (-> obj wave)))) - (when (>= (- (-> pp clock frame-counter) (the-as int (-> obj wave-length))) (-> obj wave-time)) - (let ((s4-0 (-> obj child))) - (while s4-0 - (if (type? (ppointer->process s4-0) onin-game-bubble) - (goto cfg-58) - ) - (set! s4-0 (-> s4-0 0 brother)) - ) - ) - (if (zero? (-> obj wave-delay-time)) - (set! (-> obj wave-delay-time) (-> pp clock frame-counter)) - ) - (if (< (- (-> pp clock frame-counter) (-> obj wave-delay-time)) (the-as time-frame (-> s5-0 wave-delay))) - (goto cfg-58) - ) - (set! (-> obj event-length) (the-as uint 0)) - (+! (-> obj wave) 1) - (set! s5-0 (-> obj game (-> obj wave))) - (when (zero? (-> s5-0 min-count)) - (set! (-> obj wave) (the-as int (-> s5-0 max-count))) - (set! s5-0 (-> obj game (-> obj wave))) - ) - (set! (-> obj wave-time) (-> pp clock frame-counter)) - (set! (-> obj wave-length) - (the-as uint (rand-vu-int-range (the-as int (-> s5-0 min-wave)) (the-as int (-> s5-0 max-wave)))) + (when (>= (- (current-time) (-> obj game-start-time)) (seconds 2)) + (let ((s5-0 (-> obj game (-> obj wave)))) + (when (>= (- (current-time) (the-as int (-> obj wave-length))) (-> obj wave-time)) + (let ((s4-0 (-> obj child))) + (while s4-0 + (if (type? (ppointer->process s4-0) onin-game-bubble) + (goto cfg-58) ) - (set! (-> obj wave-delay-time) 0) - (when (< 1 (-> obj wave)) - (cond - ((< 4 (- (-> obj miss-count) (-> obj wave-start-miss))) - (let ((v0-2 (rand-vu-int-count 5))) - (cond - ((zero? v0-2) - (talker-spawn-func (-> *talker-speech* 148) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-2 1) - (talker-spawn-func (-> *talker-speech* 153) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-2 2) - (talker-spawn-func (-> *talker-speech* 154) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-2 3) - (talker-spawn-func (-> *talker-speech* 157) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-2 4) - (talker-spawn-func (-> *talker-speech* 158) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) - ) - ) - ((>= 1 (- (-> obj miss-count) (-> obj wave-start-miss))) - (let ((v0-9 (rand-vu-int-count 7))) - (cond - ((zero? v0-9) - (talker-spawn-func (-> *talker-speech* 141) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-9 1) - (talker-spawn-func (-> *talker-speech* 142) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-9 2) - (talker-spawn-func (-> *talker-speech* 143) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-9 3) - (talker-spawn-func (-> *talker-speech* 150) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-9 4) - (talker-spawn-func (-> *talker-speech* 156) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-9 5) - (talker-spawn-func (-> *talker-speech* 159) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v0-9 6) - (talker-spawn-func (-> *talker-speech* 160) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) - ) - ) - ) + (set! s4-0 (-> s4-0 0 brother)) ) - (set! (-> obj wave-start-miss) (-> obj miss-count)) ) - (set! v0-18 - (when (>= (- (-> pp clock frame-counter) (-> obj event-time)) (the-as time-frame (-> obj event-length))) - (set! (-> obj event-time) (-> pp clock frame-counter)) - (let ((s4-14 (vector+! (new 'stack-no-clear 'vector) (-> obj root trans) (new 'static 'vector :w 1.0))) - (s3-12 (rand-vu-int-range (the-as int (-> s5-0 min-count)) (the-as int (-> s5-0 max-count)))) + (if (zero? (-> obj wave-delay-time)) + (set! (-> obj wave-delay-time) (current-time)) + ) + (if (< (- (current-time) (-> obj wave-delay-time)) (the-as time-frame (-> s5-0 wave-delay))) + (goto cfg-58) + ) + (set! (-> obj event-length) (the-as uint 0)) + (+! (-> obj wave) 1) + (set! s5-0 (-> obj game (-> obj wave))) + (when (zero? (-> s5-0 min-count)) + (set! (-> obj wave) (the-as int (-> s5-0 max-count))) + (set! s5-0 (-> obj game (-> obj wave))) + ) + (set! (-> obj wave-time) (current-time)) + (set! (-> obj wave-length) + (the-as uint (rand-vu-int-range (the-as int (-> s5-0 min-wave)) (the-as int (-> s5-0 max-wave)))) + ) + (set! (-> obj wave-delay-time) 0) + (when (< 1 (-> obj wave)) + (cond + ((< 4 (- (-> obj miss-count) (-> obj wave-start-miss))) + (let ((v0-2 (rand-vu-int-count 5))) + (cond + ((zero? v0-2) + (talker-spawn-func (-> *talker-speech* 148) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-2 1) + (talker-spawn-func (-> *talker-speech* 153) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-2 2) + (talker-spawn-func (-> *talker-speech* 154) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-2 3) + (talker-spawn-func (-> *talker-speech* 157) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-2 4) + (talker-spawn-func (-> *talker-speech* 158) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + ) + ) + ((>= 1 (- (-> obj miss-count) (-> obj wave-start-miss))) + (let ((v0-9 (rand-vu-int-count 7))) + (cond + ((zero? v0-9) + (talker-spawn-func (-> *talker-speech* 141) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-9 1) + (talker-spawn-func (-> *talker-speech* 142) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-9 2) + (talker-spawn-func (-> *talker-speech* 143) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-9 3) + (talker-spawn-func (-> *talker-speech* 150) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-9 4) + (talker-spawn-func (-> *talker-speech* 156) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-9 5) + (talker-spawn-func (-> *talker-speech* 159) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v0-9 6) + (talker-spawn-func (-> *talker-speech* 160) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + ) + ) + ) + ) + (set! (-> obj wave-start-miss) (-> obj miss-count)) + ) + (set! v0-18 + (when (>= (- (current-time) (-> obj event-time)) (the-as time-frame (-> obj event-length))) + (set! (-> obj event-time) (current-time)) + (let ((s4-14 (vector+! (new 'stack-no-clear 'vector) (-> obj root trans) (new 'static 'vector :w 1.0))) + (s3-12 (rand-vu-int-range (the-as int (-> s5-0 min-count)) (the-as int (-> s5-0 max-count)))) + ) + (dotimes (s2-12 s3-12) + (let ((f0-0 (-> obj last-angle))) + (while (< (fabs (- (-> obj last-angle) f0-0)) 819.2) + (set! f0-0 (rand-vu-float-range -1720.32 1720.32)) ) - (dotimes (s2-12 s3-12) - (let ((f0-0 (-> obj last-angle))) - (while (< (fabs (- (-> obj last-angle) f0-0)) 819.2) - (set! f0-0 (rand-vu-float-range -1720.32 1720.32)) - ) - (set! (-> obj 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) - obj - (symbol->string (-> onin-game-bubble symbol)) - (the-as pointer #x70004000) - ) + (set! (-> obj 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) + obj + (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 (-> obj 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) ) + (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 (-> obj 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) ) ) ) - (set! v0-18 (rand-vu-int-range (the-as int (-> s5-0 min-event)) (the-as int (-> s5-0 max-event)))) - (set! (-> obj event-length) (the-as uint v0-18)) - v0-18 ) + (set! v0-18 (rand-vu-int-range (the-as int (-> s5-0 min-event)) (the-as int (-> s5-0 max-event)))) + (set! (-> obj event-length) (the-as uint v0-18)) + v0-18 ) - ) + ) ) - (label cfg-58) - (onin-game-method-26 obj) - 0 - (none) ) + (label cfg-58) + (onin-game-method-26 obj) + 0 + (none) ) ;; definition for method 26 of type onin-game ;; WARN: Return type mismatch int vs none. (defmethod onin-game-method-26 onin-game ((obj onin-game)) - (with-pp - (cond - ((>= (-> *game-info* score) (-> obj score)) - (set! (-> *game-info* score) (-> obj score)) - ) - ((and (< (-> *game-info* score) (-> obj score)) - (>= (- (-> pp clock frame-counter) (-> obj score-time)) (seconds 0.1)) - ) - (sound-play "onin-score") - (seek! (-> *game-info* score) (-> obj score) 1.0) - (set! (-> obj score-time) (-> pp clock frame-counter)) - ) - ) - (set! (-> *game-info* miss) (the float (-> obj miss-count))) - 0 - (none) + (cond + ((>= (-> *game-info* score) (-> obj score)) + (set! (-> *game-info* score) (-> obj score)) + ) + ((and (< (-> *game-info* score) (-> obj score)) (>= (- (current-time) (-> obj score-time)) (seconds 0.1))) + (sound-play "onin-score") + (seek! (-> *game-info* score) (-> obj score) 1.0) + (set! (-> obj score-time) (current-time)) + ) ) + (set! (-> *game-info* miss) (the float (-> obj miss-count))) + 0 + (none) ) ;; definition for method 27 of type onin-game @@ -2578,7 +2572,7 @@ (set! (-> self hud-score) (ppointer->handle (process-spawn hud-big-score :init hud-init-by-other :to self))) (set! (-> self hud-goal) (ppointer->handle (process-spawn hud-goal :init hud-init-by-other :to self))) (set! (-> self hud-miss) (ppointer->handle (process-spawn hud-miss :init hud-init-by-other :to self))) - (set! (-> self game-start-time) (-> self clock frame-counter)) + (set! (-> self game-start-time) (current-time)) (send-event *target* 'draw #f) (set-setting! 'gun #f 0.0 0) (set-setting! 'calm #t 0.0 0) @@ -2728,8 +2722,8 @@ ) :code (behavior ((arg0 symbol)) (ja-channel-set! 0) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -2830,8 +2824,8 @@ (when (and (task-node-closed? (game-task-node city-play-onin-game-resolution)) (not (task-node-closed? (game-task-node city-play-onin-game-skill))) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -2856,8 +2850,8 @@ (while (nonzero? (get-status *gui-control* (the-as sound-id s5-1))) (suspend) ) - (let ((s5-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-3) (seconds 2)) + (let ((s5-3 (current-time))) + (until (>= (- (current-time) s5-3) (seconds 2)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/oracle/oracle-training_REF.gc b/test/decompiler/reference/jak2/levels/city/oracle/oracle-training_REF.gc index 0500131b51..2e008af78d 100644 --- a/test/decompiler/reference/jak2/levels/city/oracle/oracle-training_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/oracle/oracle-training_REF.gc @@ -210,7 +210,7 @@ (add-process *gui-control* self (gui-channel message) (gui-action play) (-> self name) 81920.0 0) ) (send-event *target* 'get-notify self) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (none) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/port/mines/portrun_REF.gc b/test/decompiler/reference/jak2/levels/city/port/mines/portrun_REF.gc index 3d560eec1b..472fb7e541 100644 --- a/test/decompiler/reference/jak2/levels/city/port/mines/portrun_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/port/mines/portrun_REF.gc @@ -239,11 +239,11 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) - (while (or (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 30)) + (set! (-> self state-time) (current-time)) + (while (or (< (- (current-time) (-> self state-time)) (seconds 30)) (let ((a0-3 (level-get-target-inside *level*))) (when (not (and a0-3 (logtest? (-> a0-3 info level-flags) 1))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) #t ) ) @@ -943,16 +943,14 @@ (t9-1 sin-rad) (f1-0 -3.1415925) (f2-0 6.283185) - (f3-1 (the float (+ (-> pp clock frame-counter) (the-as time-frame (-> obj time-skew))))) + (f3-1 (the float (+ (current-time) (the-as time-frame (-> obj time-skew))))) ) (t9-1 (+ f1-0 (* f2-0 (/ (- f3-1 (* (the float (the int (/ f3-1 f0-1))) f0-1)) f0-1)))) ) (let ((s5-0 (-> obj info))) (cond ((zero? (-> obj info type)) - (let* ((f0-8 - (+ (* 2.0 (-> s5-0 offset)) (/ (* 0.0033333334 (the float (-> pp clock frame-counter))) (-> s5-0 speed))) - ) + (let* ((f0-8 (+ (* 2.0 (-> s5-0 offset)) (/ (* 0.0033333334 (the float (current-time))) (-> s5-0 speed)))) (f0-9 (- f0-8 (* (the float (the int (/ f0-8 2.0))) 2.0))) ) (if (< 1.0 f0-9) @@ -997,14 +995,13 @@ (set! (-> s3-0 y) (-> s5-0 pos1-y)) (set! (-> s3-0 z) (-> s5-0 pos1-z)) (set! (-> s3-0 w) 1.0) - (let ((v1-35 (vector-rotate-around-y! - (new 'stack-no-clear 'vector) - *x-vector* - (+ (* 182.04445 (* 360.0 (-> s5-0 offset))) - (* 0.60681486 (-> s5-0 speed) (the float (-> pp clock frame-counter))) - ) - ) - ) + (let ((v1-35 + (vector-rotate-around-y! + (new 'stack-no-clear 'vector) + *x-vector* + (+ (* 182.04445 (* 360.0 (-> s5-0 offset))) (* 0.60681486 (-> s5-0 speed) (the float (current-time)))) + ) + ) ) (let ((a0-8 (-> s5-0 pos2-x))) (.mov vf7 a0-8) @@ -1039,14 +1036,14 @@ (defstate die (ctyport-mine) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self beep-time) 0) 0 (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 3)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 3)) (suspend) ) ) @@ -1055,15 +1052,13 @@ ) :post (behavior () (cond - ((and (-> self beep) (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1))) + ((and (-> self beep) (< (- (current-time) (-> self state-time)) (seconds 1))) (vector-seek! (-> self beep-color) *null-vector* (* 4.0 (-> self clock seconds-per-frame))) - (when (< (-> self beep-time) (-> self clock frame-counter)) + (when (< (-> self beep-time) (current-time)) (sound-play "cargo-beep") (set-vector! (-> self beep-color) 1.0 1.0 1.0 1.0) (set! (-> self beep-time) - (+ (-> self clock frame-counter) - (the int (* 0.2 (the float (- (seconds 1) (- (-> self clock frame-counter) (-> self state-time)))))) - ) + (+ (current-time) (the int (* 0.2 (the float (- (seconds 1) (- (current-time) (-> self state-time))))))) ) ) (set! (-> self draw color-emissive quad) (-> self beep-color quad)) @@ -1312,19 +1307,18 @@ (defstate idle (ctyport-spy) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.3)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.3)) (+! (-> self trans-y) (* (-> self root transv y) (-> self clock seconds-per-frame))) (+! (-> self root transv y) (* -8.0 (-> self clock seconds-per-frame) (-> self root transv y))) (set! (-> self root trans y) (+ (-> self trans-y) - (* 1024.0 - (+ (sin (* 182.04445 (* 50.0 (+ 10.0 (* 0.0033333334 (the float (-> self clock frame-counter))))))) - (cos (* 182.04445 (* -80.0 (- 40.0 (* 0.0033333334 (the float (-> self clock frame-counter))))))) - ) + (* 1024.0 (+ (sin (* 182.04445 (* 50.0 (+ 10.0 (* 0.0033333334 (the float (current-time))))))) + (cos (* 182.04445 (* -80.0 (- 40.0 (* 0.0033333334 (the float (current-time))))))) + ) ) ) ) @@ -1333,13 +1327,9 @@ (s4-0 gp-0) (s3-0 (new 'stack-no-clear 'vector)) ) - (set! (-> s3-0 x) - (* 182.04445 (* 5.0 (sin (* 182.04445 (* 0.33333334 (the float (-> self clock frame-counter))))))) - ) + (set! (-> s3-0 x) (* 182.04445 (* 5.0 (sin (* 182.04445 (* 0.33333334 (the float (current-time)))))))) (set! (-> s3-0 y) - (* 182.04445 - (* 5.0 (sin (* 182.04445 (* 50.0 (+ 10.0 (* 0.0033333334 (the float (-> self clock frame-counter)))))))) - ) + (* 182.04445 (* 5.0 (sin (* 182.04445 (* 50.0 (+ 10.0 (* 0.0033333334 (the float (current-time))))))))) ) (set! (-> s3-0 z) 0.0) (set! (-> s3-0 w) 1.0) @@ -1619,10 +1609,9 @@ :trans (behavior () (set! (-> self root-override trans y) (+ (-> self trans-y) - (* 1024.0 - (+ (sin (* 182.04445 (* 150.0 (+ 10.0 (* 0.0033333334 (the float (-> self clock frame-counter))))))) - (cos (* 182.04445 (* -80.0 (- 40.0 (* 0.0033333334 (the float (-> self clock frame-counter))))))) - ) + (* 1024.0 (+ (sin (* 182.04445 (* 150.0 (+ 10.0 (* 0.0033333334 (the float (current-time))))))) + (cos (* 182.04445 (* -80.0 (- 40.0 (* 0.0033333334 (the float (current-time))))))) + ) ) ) ) @@ -1654,8 +1643,8 @@ (defstate die (ctyport-cargo) :virtual #t :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -1944,7 +1933,7 @@ ) (cond ((and (= (-> self count) (-> self max-count)) (zero? (-> self data-int32 22))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ((and (or (and (zero? (-> self data-int32 20)) (= (-> self count) (+ (-> self max-count) -1))) (= (-> self data-int32 22) 1) @@ -1955,7 +1944,7 @@ (set! (-> self data-int32 20) 1) (+! (-> self data-int32 22) 1) (set! (-> self time-limit) (seconds 135)) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (set! (-> self hud-counter) (ppointer->handle (process-spawn hud-cargo :init hud-init-by-other :to self))) ) ) @@ -2030,8 +2019,8 @@ (lambda :behavior task-manager () (send-event *traffic-manager* 'set-target-level #x3f800000) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (send-event *traffic-manager* 'set-alert-level 1) @@ -2047,7 +2036,7 @@ TASK_MANAGER_FAIL_HOOK (lambda :behavior task-manager () - (when (< (- (-> self time-limit) (- (-> self clock frame-counter) (-> self start-time))) 0) + (when (< (- (-> self time-limit) (- (current-time) (-> self start-time))) 0) (let ((gp-0 #f)) (dotimes (s5-0 (-> self max-count)) (when (zero? (-> self data-int32 s5-0)) @@ -2068,8 +2057,8 @@ ) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 2)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 2)) (suspend) ) ) @@ -2085,8 +2074,8 @@ TASK_MANAGER_COMPLETE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) (task-node-close! (game-task-node city-port-run-post-win)) diff --git a/test/decompiler/reference/jak2/levels/city/port/race/errol-chal_REF.gc b/test/decompiler/reference/jak2/levels/city/port/race/errol-chal_REF.gc index 95e34b688d..8ba91abac7 100644 --- a/test/decompiler/reference/jak2/levels/city/port/race/errol-chal_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/port/race/errol-chal_REF.gc @@ -884,7 +884,7 @@ (when (< f0-5 (* f1-0 f1-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! (-> self touch-time) (-> self clock frame-counter)) + (set! (-> self touch-time) (current-time)) (process-spawn part-tracker :init part-tracker-init @@ -916,7 +916,7 @@ :code (the-as (function none :behavior turbo-ring) sleep-code) :post (behavior () (if (and (-> self player-got) - (>= (- (-> self clock frame-counter) (-> self touch-time)) (seconds 3)) + (>= (- (current-time) (-> self touch-time)) (seconds 3)) (or (not *target*) (or (< 204800.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))) (focus-test? *target* teleporting) @@ -936,13 +936,13 @@ (defstate die (turbo-ring) :virtual #t :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-3 (-> self root-override root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) ) 0 - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (until (>= (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (none) @@ -977,26 +977,24 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod turbo-ring-method-23 turbo-ring ((obj turbo-ring)) - (with-pp - (let ((s5-0 (-> obj mat))) - (let ((s4-0 (new 'stack-no-clear 'quaternion))) - (quaternion-rotate-local-y! s4-0 (-> obj root-override quat) 16384.0) - (quaternion->matrix s5-0 s4-0) - ) - (set! (-> s5-0 trans quad) (-> obj root-override trans quad)) - (set! (-> obj plane quad) (-> s5-0 vector 0 quad)) + (let ((s5-0 (-> obj mat))) + (let ((s4-0 (new 'stack-no-clear 'quaternion))) + (quaternion-rotate-local-y! s4-0 (-> obj root-override quat) 16384.0) + (quaternion->matrix s5-0 s4-0) ) - (set! (-> obj plane w) (- (vector-dot (-> obj plane) (-> obj root-override trans)))) - (update-transforms (-> obj root-override)) - (set! (-> obj player-got) #f) - (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 1058) obj)) - (if (not (-> obj persistent)) - (set! (-> obj minimap) (add-icon! *minimap* obj (the-as uint 15) (the-as int #f) (the-as vector #t) 0)) - ) - (set! (-> obj touch-time) (-> pp clock frame-counter)) - 0 - (none) + (set! (-> s5-0 trans quad) (-> obj root-override trans quad)) + (set! (-> obj plane quad) (-> s5-0 vector 0 quad)) ) + (set! (-> obj plane w) (- (vector-dot (-> obj plane) (-> obj root-override trans)))) + (update-transforms (-> obj root-override)) + (set! (-> obj player-got) #f) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 1058) obj)) + (if (not (-> obj persistent)) + (set! (-> obj minimap) (add-icon! *minimap* obj (the-as uint 15) (the-as int #f) (the-as vector #t) 0)) + ) + (set! (-> obj touch-time) (current-time)) + 0 + (none) ) ;; definition for function turbo-ring-init-by-other @@ -1374,7 +1372,7 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (while (not (logtest? (-> *race-state* flags) 1)) (let ((f0-0 (-> self begin-pos w))) (if (< (* f0-0 f0-0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0))) @@ -1583,7 +1581,7 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (while (not (logtest? (-> *race-state* flags) 1)) (let ((f0-0 (-> self begin-pos w))) (if (< (* f0-0 f0-0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0))) diff --git a/test/decompiler/reference/jak2/levels/city/side_missions/ctywide-bbush_REF.gc b/test/decompiler/reference/jak2/levels/city/side_missions/ctywide-bbush_REF.gc index 4da5400b4e..3ede56fdd3 100644 --- a/test/decompiler/reference/jak2/levels/city/side_missions/ctywide-bbush_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/side_missions/ctywide-bbush_REF.gc @@ -399,7 +399,7 @@ (cond ((handle->process (-> self part-track)) (if (-> self keep-part-track-alive) - (set! (-> (the-as part-tracker (-> self part-track process 0)) start-time) (-> self clock frame-counter)) + (set! (-> (the-as part-tracker (-> self part-track process 0)) start-time) (current-time)) ) ) (else @@ -1547,7 +1547,7 @@ ) ) ) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (+! (-> self sub-state) 1) ) ) @@ -1570,7 +1570,7 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (none) @@ -1791,7 +1791,7 @@ (none) ) :trans (behavior () - (let ((f30-0 (+ (* 0.0033333334 (the float (-> self clock frame-counter))) (* 0.1 (the float (-> self pid)))))) + (let ((f30-0 (+ (* 0.0033333334 (the float (current-time))) (* 0.1 (the float (-> self pid)))))) (when (< (-> self beep-time) f30-0) (sound-play "homeing-beep") (set! (-> self beep-time) (+ 1.0 f30-0)) @@ -2772,7 +2772,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (set! (-> self time-limit) (-> gp-0 time)) ) (none) @@ -2817,7 +2817,7 @@ This commonly includes things such as: *game-info* (game-task-node city-burning-bush-collection-1-resolution) TASK_MANAGER_CODE_HOOK - (lambda :behavior task-manager () (set! (-> self state-time) (-> self clock frame-counter)) (none)) + (lambda :behavior task-manager () (set! (-> self state-time) (current-time)) (none)) ) ;; failed to figure out what this is: @@ -3057,7 +3057,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (set! (-> self time-limit) (the-as time-frame (the int (+ 300.0 (-> *burning-bush-get-on-info* (-> self info index) time)))) ) @@ -3093,8 +3093,8 @@ This commonly includes things such as: ) (send-event *camera* 'teleport-to-transformq gp-0) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 3)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 3)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/slums/kor/kid-states_REF.gc b/test/decompiler/reference/jak2/levels/city/slums/kor/kid-states_REF.gc index 70f9b7265b..a78003cd01 100644 --- a/test/decompiler/reference/jak2/levels/city/slums/kor/kid-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/slums/kor/kid-states_REF.gc @@ -6,7 +6,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -83,7 +83,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -247,7 +247,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -324,7 +324,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -354,12 +354,10 @@ ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) (kid-method-232 self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -394,7 +392,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -419,7 +417,7 @@ ) (go-virtual arrested) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + ((and (>= (- (current-time) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) (go-virtual traveling) ) ) @@ -455,7 +453,7 @@ (go-virtual arrested) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (not (nav-enemy-method-163 self)) (go-virtual traveling) ) @@ -536,7 +534,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kid) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -609,7 +607,7 @@ (ja-channel-push! 1 (seconds 0.1)) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (ja-no-eval :group! (-> self draw art-group data 16) :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 16)) frames num-frames) -1))) @@ -617,7 +615,7 @@ ) (until (ja-done? 0) (if (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + (>= (- (current-time) (-> self state-time)) (seconds 4)) (reset? *fail-mission-control*) ) (reset! *fail-mission-control*) diff --git a/test/decompiler/reference/jak2/levels/city/slums/kor/kid_REF.gc b/test/decompiler/reference/jak2/levels/city/slums/kor/kid_REF.gc index 7fd00f2c0f..f9ca2c6f8f 100644 --- a/test/decompiler/reference/jak2/levels/city/slums/kor/kid_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/slums/kor/kid_REF.gc @@ -180,173 +180,169 @@ (defmethod general-event-handler kid ((obj kid) (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" - (with-pp - (case arg2 - (('arrest) - (let* ((s4-0 (handle->process (-> obj arrestor-handle))) - (v1-4 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) - (when (or (not v1-4) - (= v1-4 arg0) - (and (!= v1-4 arg0) (>= (- (-> pp clock frame-counter) (-> obj arrest-attempt-time)) (seconds 0.1))) - ) - (set! (-> obj arrestor-handle) (process->handle arg0)) - (set! (-> obj arrest-attempt-time) (-> pp clock frame-counter)) - 0 - ) + (case arg2 + (('arrest) + (let* ((s4-0 (handle->process (-> obj arrestor-handle))) + (v1-4 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (when (or (not v1-4) + (= v1-4 arg0) + (and (!= v1-4 arg0) (>= (- (current-time) (-> obj arrest-attempt-time)) (seconds 0.1))) + ) + (set! (-> obj arrestor-handle) (process->handle arg0)) + (set! (-> obj arrest-attempt-time) (current-time)) + 0 ) - #t ) - (('instant-arrest) - (set! (-> obj bot-flags) (logior (bot-flags bf20) (-> obj bot-flags))) - (let ((v1-18 (the-as object (-> arg3 param 0)))) - (set! (-> obj arrestor-handle) (process->handle (the-as process v1-18))) - (set! (-> obj arrest-attempt-time) (-> pp clock frame-counter)) - (let ((a1-8 (new 'stack-no-clear 'vector))) - (vector-! a1-8 (-> (the-as process-drawable v1-18) root trans) (-> obj root-override2 trans)) - (set! (-> a1-8 y) 0.0) - (forward-up->quaternion (-> obj root-override2 quat) a1-8 *up-vector*) - ) + #t + ) + (('instant-arrest) + (set! (-> obj bot-flags) (logior (bot-flags bf20) (-> obj bot-flags))) + (let ((v1-18 (the-as object (-> arg3 param 0)))) + (set! (-> obj arrestor-handle) (process->handle (the-as process v1-18))) + (set! (-> obj arrest-attempt-time) (current-time)) + (let ((a1-8 (new 'stack-no-clear 'vector))) + (vector-! a1-8 (-> (the-as process-drawable v1-18) root trans) (-> obj root-override2 trans)) + (set! (-> a1-8 y) 0.0) + (forward-up->quaternion (-> obj root-override2 quat) a1-8 *up-vector*) ) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) - (logclear! (-> obj mask) (process-mask collectable)) - (logclear! (-> obj enemy-flags) (enemy-flag look-at-move-dest)) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj enemy-flags) (enemy-flag notice)) - (send-event (handle->process (-> obj master-handle)) 'notify 'arrest #f) - (go (method-of-object obj arrested)) ) - (('attack) - ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) - #f - ) - (else - ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) - ) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> obj mask) (process-mask collectable)) + (logclear! (-> obj enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj enemy-flags) (enemy-flag notice)) + (send-event (handle->process (-> obj master-handle)) 'notify 'arrest #f) + (go (method-of-object obj arrested)) + ) + (('attack) + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) + #f + ) + (else + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) ;; definition for method 97 of type kid (defmethod enemy-method-97 kid ((obj kid)) - (with-pp - (let* ((s4-0 (handle->process (-> obj attacker-handle))) - (s5-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - (s3-0 (handle->process (-> obj arrestor-handle))) - (s4-1 (if (type? s3-0 process-focusable) - s3-0 - ) - ) + (let* ((s4-0 (handle->process (-> obj attacker-handle))) + (s5-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + (s3-0 (handle->process (-> obj arrestor-handle))) + (s4-1 (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + (when s5-0 + (cond + ((= (-> s5-0 type) target) + (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) + (>= (- (current-time) (-> obj attacker-time)) (seconds 1.5)) + ) + (if (logtest? (-> obj bot-flags) (bot-flags attacked)) + (reset-attacker! obj) + ) + (set! s5-0 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) - (when s5-0 - (cond - ((= (-> s5-0 type) target) - (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) - (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 1.5)) - ) - (if (logtest? (-> obj bot-flags) (bot-flags attacked)) - (reset-attacker! obj) - ) - (set! s5-0 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 6)) - (set! s5-0 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) + ) + (else + (when (>= (- (current-time) (-> obj attacker-time)) (seconds 6)) + (set! s5-0 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) ) ) - (when s4-1 - (when (or (>= (- (-> pp clock frame-counter) (-> obj arrest-attempt-time)) (seconds 0.5)) - (focus-test? (the-as process-focusable s4-1) dead hit) - ) - (set! s4-1 (the-as process #f)) - (set! (-> obj arrestor-handle) (the-as handle #f)) - ) - ) - (let ((v1-34 (-> obj focus-mode)) - (s3-1 (the-as process #f)) - ) - (cond - ((zero? v1-34) - (cond - (s4-1 - (set! s3-1 s4-1) - ) - (s5-0 - (set! s3-1 s5-0) - ) - ((begin (set! s3-1 (select-focus! obj)) s3-1) - (empty) - ) - (else - (let ((s5-1 (handle->process (-> obj poi-handle)))) - (set! s3-1 (if (type? s5-1 process-focusable) - s5-1 - ) - ) - ) - (if s3-1 - (empty) - (set! s3-1 *target*) - ) - ) - ) - ) - ((= v1-34 1) - (cond - (s4-1 - (set! s3-1 s4-1) - ) - (s5-0 - (set! s3-1 s5-0) - ) - (else - (let ((s5-2 (handle->process (-> obj poi-handle)))) - (set! s3-1 (if (type? s5-2 process-focusable) - s5-2 - ) - ) - ) - (cond - (s3-1 - (empty) - ) - ((begin (set! s3-1 (select-focus! obj)) s3-1) - (empty) - ) - (else - (set! s3-1 *target*) - ) - ) - ) - ) - ) - ) - (cond - (s3-1 - (try-update-focus (-> obj focus) (the-as process-focusable s3-1) obj) - (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> s3-1 type) target)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + (when s4-1 + (when (or (>= (- (current-time) (-> obj arrest-attempt-time)) (seconds 0.5)) + (focus-test? (the-as process-focusable s4-1) dead hit) ) - ) - (else - (clear-focused (-> obj focus)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) - ) - ) - s3-1 + (set! s4-1 (the-as process #f)) + (set! (-> obj arrestor-handle) (the-as handle #f)) ) ) + (let ((v1-34 (-> obj focus-mode)) + (s3-1 (the-as process #f)) + ) + (cond + ((zero? v1-34) + (cond + (s4-1 + (set! s3-1 s4-1) + ) + (s5-0 + (set! s3-1 s5-0) + ) + ((begin (set! s3-1 (select-focus! obj)) s3-1) + (empty) + ) + (else + (let ((s5-1 (handle->process (-> obj poi-handle)))) + (set! s3-1 (if (type? s5-1 process-focusable) + s5-1 + ) + ) + ) + (if s3-1 + (empty) + (set! s3-1 *target*) + ) + ) + ) + ) + ((= v1-34 1) + (cond + (s4-1 + (set! s3-1 s4-1) + ) + (s5-0 + (set! s3-1 s5-0) + ) + (else + (let ((s5-2 (handle->process (-> obj poi-handle)))) + (set! s3-1 (if (type? s5-2 process-focusable) + s5-2 + ) + ) + ) + (cond + (s3-1 + (empty) + ) + ((begin (set! s3-1 (select-focus! obj)) s3-1) + (empty) + ) + (else + (set! s3-1 *target*) + ) + ) + ) + ) + ) + ) + (cond + (s3-1 + (try-update-focus (-> obj focus) (the-as process-focusable s3-1) obj) + (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> s3-1 type) target)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + (else + (clear-focused (-> obj focus)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + s3-1 + ) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/slums/kor/kor-states_REF.gc b/test/decompiler/reference/jak2/levels/city/slums/kor/kor-states_REF.gc index 8022a0bc0f..f99f232319 100644 --- a/test/decompiler/reference/jak2/levels/city/slums/kor/kor-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/slums/kor/kor-states_REF.gc @@ -6,7 +6,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kor) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -83,7 +83,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kor) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -258,7 +258,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kor) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -335,7 +335,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kor) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -365,12 +365,10 @@ ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) (kor-method-232 self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -405,7 +403,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kor) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -430,7 +428,7 @@ ) (go-virtual arrested) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + ((and (>= (- (current-time) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) (go-virtual traveling) ) ) @@ -466,7 +464,7 @@ (go-virtual arrested) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (not (nav-enemy-method-163 self)) (go-virtual traveling) ) @@ -547,7 +545,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior kor) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -596,7 +594,7 @@ (ja-channel-push! 1 (seconds 0.25)) (cond ((and (not (logtest? (bot-flags bf20) (-> self bot-flags))) - (< (- (-> self clock frame-counter) (-> self arrest-attempt-time)) (seconds 0.8)) + (< (- (current-time) (-> self arrest-attempt-time)) (seconds 0.8)) ) (ja-no-eval :group! (-> self draw art-group data 4) :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) frames num-frames) -1))) @@ -635,7 +633,7 @@ (suspend) (ja :num! (seek!)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (ja-no-eval :group! (-> self draw art-group data 18) :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 18)) frames num-frames) -1))) @@ -643,7 +641,7 @@ ) (until (ja-done? 0) (if (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (>= (- (current-time) (-> self state-time)) (seconds 3)) (reset? *fail-mission-control*) ) (reset! *fail-mission-control*) diff --git a/test/decompiler/reference/jak2/levels/city/slums/kor/kor_REF.gc b/test/decompiler/reference/jak2/levels/city/slums/kor/kor_REF.gc index cdad783426..aa7bcc750d 100644 --- a/test/decompiler/reference/jak2/levels/city/slums/kor/kor_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/slums/kor/kor_REF.gc @@ -201,168 +201,164 @@ (defmethod general-event-handler kor ((obj kor) (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" - (with-pp - (case arg2 - (('arrest) - (let* ((s4-0 (handle->process (-> obj arrestor-handle))) - (v1-4 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) - (when (or (not v1-4) - (= v1-4 arg0) - (and (!= v1-4 arg0) (>= (- (-> pp clock frame-counter) (-> obj arrest-attempt-time)) (seconds 0.1))) - ) - (set! (-> obj arrestor-handle) (process->handle arg0)) - (set! (-> obj arrest-attempt-time) (-> pp clock frame-counter)) - 0 - ) + (case arg2 + (('arrest) + (let* ((s4-0 (handle->process (-> obj arrestor-handle))) + (v1-4 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (when (or (not v1-4) + (= v1-4 arg0) + (and (!= v1-4 arg0) (>= (- (current-time) (-> obj arrest-attempt-time)) (seconds 0.1))) + ) + (set! (-> obj arrestor-handle) (process->handle arg0)) + (set! (-> obj arrest-attempt-time) (current-time)) + 0 ) - #t ) - (('instant-arrest) - (set! (-> obj bot-flags) (logior (bot-flags bf20) (-> obj bot-flags))) - (let ((v1-18 (the-as object (-> arg3 param 0)))) - (set! (-> obj arrestor-handle) (process->handle (the-as process v1-18))) - (set! (-> obj arrest-attempt-time) (-> pp clock frame-counter)) - (let ((a1-8 (new 'stack-no-clear 'vector))) - (vector-! a1-8 (-> (the-as process-drawable v1-18) root trans) (-> obj root-override2 trans)) - (set! (-> a1-8 y) 0.0) - (forward-up->quaternion (-> obj root-override2 quat) a1-8 *up-vector*) - ) + #t + ) + (('instant-arrest) + (set! (-> obj bot-flags) (logior (bot-flags bf20) (-> obj bot-flags))) + (let ((v1-18 (the-as object (-> arg3 param 0)))) + (set! (-> obj arrestor-handle) (process->handle (the-as process v1-18))) + (set! (-> obj arrest-attempt-time) (current-time)) + (let ((a1-8 (new 'stack-no-clear 'vector))) + (vector-! a1-8 (-> (the-as process-drawable v1-18) root trans) (-> obj root-override2 trans)) + (set! (-> a1-8 y) 0.0) + (forward-up->quaternion (-> obj root-override2 quat) a1-8 *up-vector*) ) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) - (logclear! (-> obj mask) (process-mask collectable)) - (logclear! (-> obj enemy-flags) (enemy-flag look-at-move-dest)) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj enemy-flags) (enemy-flag notice)) - (go (method-of-object obj arrested)) ) - (else - ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) - ) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> obj mask) (process-mask collectable)) + (logclear! (-> obj enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj enemy-flags) (enemy-flag notice)) + (go (method-of-object obj arrested)) + ) + (else + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) ;; definition for method 97 of type kor (defmethod enemy-method-97 kor ((obj kor)) - (with-pp - (let* ((s4-0 (handle->process (-> obj attacker-handle))) - (s5-0 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - (s3-0 (handle->process (-> obj arrestor-handle))) - (s4-1 (if (type? s3-0 process-focusable) - s3-0 - ) - ) + (let* ((s4-0 (handle->process (-> obj attacker-handle))) + (s5-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + (s3-0 (handle->process (-> obj arrestor-handle))) + (s4-1 (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + (when s5-0 + (cond + ((= (-> s5-0 type) target) + (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) + (>= (- (current-time) (-> obj attacker-time)) (seconds 1.5)) + ) + (if (logtest? (-> obj bot-flags) (bot-flags attacked)) + (reset-attacker! obj) + ) + (set! s5-0 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) - (when s5-0 - (cond - ((= (-> s5-0 type) target) - (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) - (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 1.5)) - ) - (if (logtest? (-> obj bot-flags) (bot-flags attacked)) - (reset-attacker! obj) - ) - (set! s5-0 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 6)) - (set! s5-0 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) + ) + (else + (when (>= (- (current-time) (-> obj attacker-time)) (seconds 6)) + (set! s5-0 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) ) ) - (when s4-1 - (when (or (>= (- (-> pp clock frame-counter) (-> obj arrest-attempt-time)) (seconds 0.5)) - (focus-test? (the-as process-focusable s4-1) dead hit) - ) - (set! s4-1 (the-as process #f)) - (set! (-> obj arrestor-handle) (the-as handle #f)) - ) - ) - (let ((v1-34 (-> obj focus-mode)) - (s3-1 (the-as process #f)) - ) - (cond - ((zero? v1-34) - (cond - (s4-1 - (set! s3-1 s4-1) - ) - (s5-0 - (set! s3-1 s5-0) - ) - ((begin (set! s3-1 (select-focus! obj)) s3-1) - (empty) - ) - (else - (let ((s5-1 (handle->process (-> obj poi-handle)))) - (set! s3-1 (if (type? s5-1 process-focusable) - s5-1 - ) - ) - ) - (if s3-1 - (empty) - (set! s3-1 *target*) - ) - ) - ) - ) - ((= v1-34 1) - (cond - (s4-1 - (set! s3-1 s4-1) - ) - (s5-0 - (set! s3-1 s5-0) - ) - (else - (let ((s5-2 (handle->process (-> obj poi-handle)))) - (set! s3-1 (if (type? s5-2 process-focusable) - s5-2 - ) - ) - ) - (cond - (s3-1 - (empty) - ) - ((begin (set! s3-1 (select-focus! obj)) s3-1) - (empty) - ) - (else - (set! s3-1 *target*) - ) - ) - ) - ) - ) - ) - (cond - (s3-1 - (try-update-focus (-> obj focus) (the-as process-focusable s3-1) obj) - (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> s3-1 type) target)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + (when s4-1 + (when (or (>= (- (current-time) (-> obj arrest-attempt-time)) (seconds 0.5)) + (focus-test? (the-as process-focusable s4-1) dead hit) ) - ) - (else - (clear-focused (-> obj focus)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) - ) - ) - s3-1 + (set! s4-1 (the-as process #f)) + (set! (-> obj arrestor-handle) (the-as handle #f)) ) ) + (let ((v1-34 (-> obj focus-mode)) + (s3-1 (the-as process #f)) + ) + (cond + ((zero? v1-34) + (cond + (s4-1 + (set! s3-1 s4-1) + ) + (s5-0 + (set! s3-1 s5-0) + ) + ((begin (set! s3-1 (select-focus! obj)) s3-1) + (empty) + ) + (else + (let ((s5-1 (handle->process (-> obj poi-handle)))) + (set! s3-1 (if (type? s5-1 process-focusable) + s5-1 + ) + ) + ) + (if s3-1 + (empty) + (set! s3-1 *target*) + ) + ) + ) + ) + ((= v1-34 1) + (cond + (s4-1 + (set! s3-1 s4-1) + ) + (s5-0 + (set! s3-1 s5-0) + ) + (else + (let ((s5-2 (handle->process (-> obj poi-handle)))) + (set! s3-1 (if (type? s5-2 process-focusable) + s5-2 + ) + ) + ) + (cond + (s3-1 + (empty) + ) + ((begin (set! s3-1 (select-focus! obj)) s3-1) + (empty) + ) + (else + (set! s3-1 *target*) + ) + ) + ) + ) + ) + ) + (cond + (s3-1 + (try-update-focus (-> obj focus) (the-as process-focusable s3-1) obj) + (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> s3-1 type) target)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + (else + (clear-focused (-> obj focus)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + s3-1 + ) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/slums/neon-baron-part_REF.gc b/test/decompiler/reference/jak2/levels/city/slums/neon-baron-part_REF.gc index f49f70e233..6f6726eb22 100644 --- a/test/decompiler/reference/jak2/levels/city/slums/neon-baron-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/slums/neon-baron-part_REF.gc @@ -3407,16 +3407,16 @@ 600 (dotimes (gp-0 19) (let ((s5-0 (-> *neon-baron-flashing-acc* (* gp-0 2)))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 8) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame s5-0)) + (until (>= (- (current-time) (-> self state-time)) (the-as time-frame s5-0)) (suspend) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 9) (let ((s5-1 (-> *neon-baron-flashing-acc* (+ (* gp-0 2) 1)))) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame s5-1)) + (until (>= (- (current-time) (-> self state-time)) (the-as time-frame s5-1)) (suspend) ) ) @@ -3424,28 +3424,28 @@ ) ((zero? v1-2) (dotimes (gp-1 3) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 8) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 9) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) ) ) ((= v1-2 1) (dotimes (gp-2 3) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 8) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 9) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (suspend) ) ) @@ -3454,16 +3454,16 @@ 600 (dotimes (gp-3 19) (let ((s5-2 (-> *neon-baron-flashing-acc* (* gp-3 2)))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 3) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame s5-2)) + (until (>= (- (current-time) (-> self state-time)) (the-as time-frame s5-2)) (suspend) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 2) (let ((s5-3 (-> *neon-baron-flashing-acc* (+ (* gp-3 2) 1)))) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame s5-3)) + (until (>= (- (current-time) (-> self state-time)) (the-as time-frame s5-3)) (suspend) ) ) @@ -3471,28 +3471,28 @@ ) ((= v1-2 8) (dotimes (gp-4 3) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 3) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 2) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) ) ) ((= v1-2 9) (dotimes (gp-5 3) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 3) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) 2) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (suspend) ) ) @@ -3576,8 +3576,8 @@ (set! (-> self flags) 1) (let ((gp-11 (rand-vu-int-range 3 6))) (dotimes (s5-9 gp-11) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/ai/bot-states_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/bot-states_REF.gc index 5fb7498522..a9b08c7d06 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/bot-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/bot-states_REF.gc @@ -91,7 +91,7 @@ (bot-method-191 self) (when (zero? (-> self hit-points)) (set! (-> self hit-points) 1) - (set! (-> self fated-time) (-> self clock frame-counter)) + (set! (-> self fated-time) (current-time)) ) (logclear! (-> self bot-flags) (bot-flags bf11)) (let ((t9-2 (-> (method-of-type nav-enemy knocked) enter))) @@ -120,7 +120,7 @@ (t9-0) ) ) - (when (and (logtest? (-> self bot-flags) (bot-flags bf12)) (!= (-> self state-time) (-> self clock frame-counter))) + (when (and (logtest? (-> self bot-flags) (bot-flags bf12)) (!= (-> self state-time) (current-time))) (logclear! (-> self bot-flags) (bot-flags bf12)) (play-attacked-speech self) ) @@ -219,7 +219,7 @@ :trans (behavior () ((-> (method-of-type bot die-falling) trans)) (if (channel-active? self (the-as uint 0)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (none) ) @@ -235,7 +235,7 @@ ) (until (ja-done? 0) (when (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (reset? *fail-mission-control*) ) (cleanup-for-death self) diff --git a/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc index aaf45e0574..61cf3bfe26 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc @@ -329,7 +329,7 @@ (cond ((attacked-by-player? obj (the-as process-focusable s5-0)) (set! (-> obj attacker-handle) (process->handle s5-0)) - (set! (-> obj attacker-time) (-> self clock frame-counter)) + (set! (-> obj attacker-time) (current-time)) ) (else (logclear! (-> obj bot-flags) (bot-flags attacked)) @@ -346,7 +346,7 @@ (reset-attacker! obj) ) (set! (-> obj attacker-handle) (process->handle s5-0)) - (set! (-> obj attacker-time) (-> self clock frame-counter)) + (set! (-> obj attacker-time) (current-time)) ) ) ) @@ -448,133 +448,129 @@ ;; definition for method 129 of type bot (defmethod enemy-method-129 bot ((obj bot)) (local-vars (s5-1 process)) - (with-pp - (let ((s5-0 (-> obj focus))) - (cond - ((logtest? (enemy-flag actor-pause-backup) (-> obj enemy-flags)) - (set! s5-1 (handle->process (-> s5-0 handle))) - ) - (else - (enemy-method-97 obj) - (set! s5-1 (handle->process (-> s5-0 handle))) - ) + (let ((s5-0 (-> obj focus))) + (cond + ((logtest? (enemy-flag actor-pause-backup) (-> obj enemy-flags)) + (set! s5-1 (handle->process (-> s5-0 handle))) + ) + (else + (enemy-method-97 obj) + (set! s5-1 (handle->process (-> s5-0 handle))) ) ) - (let ((s4-0 #f)) - (when (or (logtest? (bot-flags bf18) (-> obj bot-flags)) - (and s5-1 (attacked-by-player? obj (the-as process-focusable s5-1))) - ) - (set! (-> obj danger-time) (-> pp clock frame-counter)) - (set! s4-0 #t) - ) - (when (nonzero? (-> obj swivel-joint-mod)) - (if (and s4-0 s5-1 (logtest? (-> obj bot-flags) (bot-flags bf11))) - (bot-method-222 obj (get-trans (the-as process-focusable s5-1) 3)) - (bot-method-221 obj) - ) - ) - ) - (none) ) + (let ((s4-0 #f)) + (when (or (logtest? (bot-flags bf18) (-> obj bot-flags)) + (and s5-1 (attacked-by-player? obj (the-as process-focusable s5-1))) + ) + (set! (-> obj danger-time) (current-time)) + (set! s4-0 #t) + ) + (when (nonzero? (-> obj swivel-joint-mod)) + (if (and s4-0 s5-1 (logtest? (-> obj bot-flags) (bot-flags bf11))) + (bot-method-222 obj (get-trans (the-as process-focusable s5-1) 3)) + (bot-method-221 obj) + ) + ) + ) + (none) ) ;; definition for method 97 of type bot (defmethod enemy-method-97 bot ((obj bot)) - (with-pp - (let* ((s5-0 (handle->process (-> obj attacker-handle))) - (v1-3 (if (type? s5-0 process-focusable) - s5-0 - ) - ) + (let* ((s5-0 (handle->process (-> obj attacker-handle))) + (v1-3 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when v1-3 + (cond + ((= (-> v1-3 type) target) + (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) + (>= (- (current-time) (-> obj attacker-time)) (seconds 1.5)) + ) + (if (logtest? (-> obj bot-flags) (bot-flags attacked)) + (reset-attacker! obj) + ) + (set! v1-3 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) - (when v1-3 - (cond - ((= (-> v1-3 type) target) - (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) - (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 1.5)) - ) - (if (logtest? (-> obj bot-flags) (bot-flags attacked)) - (reset-attacker! obj) - ) - (set! v1-3 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 6)) - (set! v1-3 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) - ) + ) + (else + (when (>= (- (current-time) (-> obj attacker-time)) (seconds 6)) + (set! v1-3 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) ) ) ) - (let ((a0-21 (-> obj focus-mode)) - (s5-1 (the-as process #f)) - ) - (cond - ((zero? a0-21) - (cond - (v1-3 - (set! s5-1 v1-3) - ) - ((begin (set! s5-1 (select-focus! obj)) s5-1) - (empty) - ) - (else - (let ((s4-0 (handle->process (-> obj poi-handle)))) - (set! s5-1 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) - (if s5-1 - (empty) - (set! s5-1 *target*) - ) - ) - ) - ) - ((= a0-21 1) - (cond - (v1-3 - (set! s5-1 v1-3) - ) - (else - (let ((s4-1 (handle->process (-> obj poi-handle)))) - (set! s5-1 (if (type? s4-1 process-focusable) - s4-1 - ) - ) - ) - (cond - (s5-1 - (empty) - ) - ((begin (set! s5-1 (select-focus! obj)) s5-1) - (empty) - ) - (else - (set! s5-1 *target*) - ) - ) - ) - ) - ) + ) + (let ((a0-21 (-> obj focus-mode)) + (s5-1 (the-as process #f)) ) - (cond - (s5-1 - (try-update-focus (-> obj focus) (the-as process-focusable s5-1) obj) - (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> (the-as process-focusable s5-1) type) target)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) + (cond + ((zero? a0-21) + (cond + (v1-3 + (set! s5-1 v1-3) + ) + ((begin (set! s5-1 (select-focus! obj)) s5-1) + (empty) + ) + (else + (let ((s4-0 (handle->process (-> obj poi-handle)))) + (set! s5-1 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (if s5-1 + (empty) + (set! s5-1 *target*) + ) + ) + ) + ) + ((= a0-21 1) + (cond + (v1-3 + (set! s5-1 v1-3) + ) + (else + (let ((s4-1 (handle->process (-> obj poi-handle)))) + (set! s5-1 (if (type? s4-1 process-focusable) + s4-1 + ) + ) + ) + (cond + (s5-1 + (empty) + ) + ((begin (set! s5-1 (select-focus! obj)) s5-1) + (empty) ) - ) - (else - (clear-focused (-> obj focus)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) - ) - ) - s5-1 + (else + (set! s5-1 *target*) + ) + ) + ) + ) + ) ) + (cond + (s5-1 + (try-update-focus (-> obj focus) (the-as process-focusable s5-1) obj) + (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> (the-as process-focusable s5-1) type) target)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + (else + (clear-focused (-> obj focus)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + s5-1 ) ) ) @@ -761,205 +757,203 @@ "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 (v0-0 none)) - (with-pp - (let ((v1-0 arg2)) - (the-as - object - (cond - ((= v1-0 'track) - #f - ) - ((= v1-0 'combo) - #f - ) - ((= v1-0 'query) - (case (-> arg3 param 0) - (('waypoint) - (-> obj waypoint waypoint-id) - ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) + (let ((v1-0 arg2)) + (the-as + object + (cond + ((= v1-0 'track) + #f + ) + ((= v1-0 'combo) + #f + ) + ((= v1-0 'query) + (case (-> arg3 param 0) + (('waypoint) + (-> obj waypoint waypoint-id) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) - ((= v1-0 'request) - (case (-> arg3 param 0) - (('waypoint) - (set! (-> obj waypoint-request) (the-as int (-> arg3 param 1))) - #t + ) + ((= v1-0 'request) + (case (-> arg3 param 0) + (('waypoint) + (set! (-> obj waypoint-request) (the-as int (-> arg3 param 1))) + #t + ) + (('health-meter) + (cond + ((-> arg3 param 1) + (set! v0-0 (the-as none (logior (-> obj bot-flags) (bot-flags bf06)))) + (set! (-> obj bot-flags) (the-as bot-flags v0-0)) + ) + (else + (set! v0-0 (the-as none (logclear (-> obj bot-flags) (bot-flags bf06)))) + (set! (-> obj bot-flags) (the-as bot-flags v0-0)) + ) ) - (('health-meter) + v0-0 + ) + (('too-far-fail) + (when (not (logtest? (-> obj bot-flags) (bot-flags too-far-fail bf09))) + (logior! (-> obj bot-flags) (bot-flags bf09)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag check-water)) + (logclear! (-> obj mask) (process-mask collectable)) + (logclear! (-> obj enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj enemy-flags) (enemy-flag notice)) + (go (method-of-object obj failed)) + ) + ) + (('move-to-vehicle) + (let ((a0-19 (-> arg3 param 2))) (cond - ((-> arg3 param 1) - (set! v0-0 (the-as none (logior (-> obj bot-flags) (bot-flags bf06)))) - (set! (-> obj bot-flags) (the-as bot-flags v0-0)) - ) - (else - (set! v0-0 (the-as none (logclear (-> obj bot-flags) (bot-flags bf06)))) - (set! (-> obj bot-flags) (the-as bot-flags v0-0)) - ) - ) - v0-0 - ) - (('too-far-fail) - (when (not (logtest? (-> obj bot-flags) (bot-flags too-far-fail bf09))) - (logior! (-> obj bot-flags) (bot-flags bf09)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag check-water)) - (logclear! (-> obj mask) (process-mask collectable)) - (logclear! (-> obj enemy-flags) (enemy-flag look-at-move-dest)) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj enemy-flags) (enemy-flag notice)) - (go (method-of-object obj failed)) - ) - ) - (('move-to-vehicle) - (let ((a0-19 (-> arg3 param 2))) - (cond - ((>= (the-as int a0-19) 0) - (let ((v1-29 (the-as object (-> arg3 param 1)))) - (cond - ((focus-test? obj pilot) - (if (= (-> obj vehicle-seat-index) a0-19) - (= (the-as uint v1-29) (handle->process (-> obj vehicle-handle))) - ) - ) - (else - (set! (-> obj vehicle-seat-index) (the-as int a0-19)) - (set! (-> obj vehicle-handle) (process->handle (the-as uint v1-29))) - (logior! (-> obj bot-flags) (bot-flags bf15)) - #t - ) + ((>= (the-as int a0-19) 0) + (let ((v1-29 (the-as object (-> arg3 param 1)))) + (cond + ((focus-test? obj pilot) + (if (= (-> obj vehicle-seat-index) a0-19) + (= (the-as uint v1-29) (handle->process (-> obj vehicle-handle))) + ) + ) + (else + (set! (-> obj vehicle-seat-index) (the-as int a0-19)) + (set! (-> obj vehicle-handle) (process->handle (the-as uint v1-29))) + (logior! (-> obj bot-flags) (bot-flags bf15)) + #t ) ) ) - (else - (when (not (focus-test? obj pilot)) - (set! (-> obj vehicle-seat-index) -1) - (set! (-> obj vehicle-handle) (the-as handle #f)) - (logclear! (-> obj bot-flags) (bot-flags bf15)) - #t - ) - ) - ) - ) - ) - (('exit-vehicle) - (when (focus-test? obj pilot) - (let ((v1-43 (-> arg3 param 1)) - (s5-1 (-> arg3 param 2)) - ) - (cond - (v1-43 - (set! (-> obj bot-flags) (logior (bot-flags bf16) (-> obj bot-flags))) - (when (and (>= (the-as int s5-1) 0) (!= s5-1 (-> obj nav-mesh-index))) - (change-to (nav-mesh-from-res-tag (-> obj entity) 'nav-mesh-actor (the-as int s5-1)) obj) - (set! (-> obj nav-mesh-index) (the-as int s5-1)) - ) - ) - (else - (logclear! (-> obj bot-flags) (bot-flags bf16)) - ) - ) - ) - #t - ) - ) - (('slave-id) - (set! (-> obj slave-id) (the-as int (-> arg3 param 1))) - #t - ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - ) - ) - ((= v1-0 'notify) - (case (-> arg3 param 0) - (('attack) - (let ((s5-2 (-> arg3 param 1))) - (when (if (type? s5-2 process-focusable) - s5-2 - ) - (logior! (-> obj enemy-flags) (enemy-flag look-at-focus)) - (set! (-> obj hit-focus-time) (-> pp clock frame-counter)) - ) - ) - #t - ) - (('mission-failed) - (logior! (-> obj bot-flags) (bot-flags bf09)) - (logclear! (-> obj bot-flags) (bot-flags bf06)) - #t - ) - (('follow-dir) - (set! (-> obj follow-dir quad) (-> (the-as vector (-> arg3 param 1)) quad)) - #t - ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - ) - ) - ((= v1-0 'set-task) - (let ((a1-11 (/ (the-as int (-> arg3 param 0)) 8))) - (logior! (-> obj bot-task-bits) (ash 1 a1-11)) - ) - #t - ) - ((= v1-0 'clear-task) - (let ((a1-13 (/ (the-as int (-> arg3 param 0)) 8))) - (logclear! (-> obj bot-task-bits) (ash 1 a1-13)) - ) - #t - ) - ((= v1-0 'skip) - (skip-waypoint obj) - ) - ((= v1-0 'change-mode) - (when (= (-> arg3 param 0) 'grab) - (set! v0-0 (the-as none (alive? obj))) - (if (and (the-as symbol v0-0) (-> arg3 param 1)) - (logior! (-> obj focus-status) (focus-status grabbed)) ) - v0-0 - ) - ) - ((= v1-0 'end-mode) - (when (focus-test? obj grabbed) - (logclear! (-> obj focus-status) (focus-status grabbed)) - #t - ) - ) - ((= v1-0 'hide) - (cond - ((-> arg3 param 0) - (go (method-of-object obj hidden)) + (else + (when (not (focus-test? obj pilot)) + (set! (-> obj vehicle-seat-index) -1) + (set! (-> obj vehicle-handle) (the-as handle #f)) + (logclear! (-> obj bot-flags) (bot-flags bf15)) + #t + ) + ) + ) ) - (else - (if (and (-> obj next-state) (= (-> obj next-state name) 'hidden)) - (react-to-focus obj) - ) - ) + ) + (('exit-vehicle) + (when (focus-test? obj pilot) + (let ((v1-43 (-> arg3 param 1)) + (s5-1 (-> arg3 param 2)) + ) + (cond + (v1-43 + (set! (-> obj bot-flags) (logior (bot-flags bf16) (-> obj bot-flags))) + (when (and (>= (the-as int s5-1) 0) (!= s5-1 (-> obj nav-mesh-index))) + (change-to (nav-mesh-from-res-tag (-> obj entity) 'nav-mesh-actor (the-as int s5-1)) obj) + (set! (-> obj nav-mesh-index) (the-as int s5-1)) + ) + ) + (else + (logclear! (-> obj bot-flags) (bot-flags bf16)) + ) + ) + ) + #t + ) + ) + (('slave-id) + (set! (-> obj slave-id) (the-as int (-> arg3 param 1))) + #t + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) - ((= v1-0 'draw) - (cond - ((-> arg3 param 0) - (set! v0-0 (the-as none (logclear (-> obj draw status) (draw-control-status no-draw)))) - (set! (-> obj draw status) (the-as draw-control-status v0-0)) + ) + ((= v1-0 'notify) + (case (-> arg3 param 0) + (('attack) + (let ((s5-2 (-> arg3 param 1))) + (when (if (type? s5-2 process-focusable) + s5-2 + ) + (logior! (-> obj enemy-flags) (enemy-flag look-at-focus)) + (set! (-> obj hit-focus-time) (current-time)) + ) ) - (else - (set! v0-0 (the-as none (logior (-> obj draw status) (draw-control-status no-draw)))) - (set! (-> obj draw status) (the-as draw-control-status v0-0)) - ) + #t + ) + (('mission-failed) + (logior! (-> obj bot-flags) (bot-flags bf09)) + (logclear! (-> obj bot-flags) (bot-flags bf06)) + #t + ) + (('follow-dir) + (set! (-> obj follow-dir quad) (-> (the-as vector (-> arg3 param 1)) quad)) + #t + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) + ) + ) + ((= v1-0 'set-task) + (let ((a1-11 (/ (the-as int (-> arg3 param 0)) 8))) + (logior! (-> obj bot-task-bits) (ash 1 a1-11)) + ) + #t + ) + ((= v1-0 'clear-task) + (let ((a1-13 (/ (the-as int (-> arg3 param 0)) 8))) + (logclear! (-> obj bot-task-bits) (ash 1 a1-13)) + ) + #t + ) + ((= v1-0 'skip) + (skip-waypoint obj) + ) + ((= v1-0 'change-mode) + (when (= (-> arg3 param 0) 'grab) + (set! v0-0 (the-as none (alive? obj))) + (if (and (the-as symbol v0-0) (-> arg3 param 1)) + (logior! (-> obj focus-status) (focus-status grabbed)) + ) v0-0 ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ((= v1-0 'end-mode) + (when (focus-test? obj grabbed) + (logclear! (-> obj focus-status) (focus-status grabbed)) + #t + ) + ) + ((= v1-0 'hide) + (cond + ((-> arg3 param 0) + (go (method-of-object obj hidden)) ) + (else + (if (and (-> obj next-state) (= (-> obj next-state name) 'hidden)) + (react-to-focus obj) + ) + ) + ) + ) + ((= v1-0 'draw) + (cond + ((-> arg3 param 0) + (set! v0-0 (the-as none (logclear (-> obj draw status) (draw-control-status no-draw)))) + (set! (-> obj draw status) (the-as draw-control-status v0-0)) + ) + (else + (set! v0-0 (the-as none (logior (-> obj draw status) (draw-control-status no-draw)))) + (set! (-> obj draw status) (the-as draw-control-status v0-0)) + ) + ) + v0-0 + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1118,75 +1112,69 @@ (defmethod bot-check-too-far bot ((obj 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." - (with-pp - (let ((result 0)) - (let ((too-far-check (-> obj delay-too-far-check))) - (cond - ((> too-far-check 0) - (set! (-> obj delay-too-far-check) (+ too-far-check -1)) - ) - ((and (zero? too-far-check) *target* (not (logtest? (-> obj focus-status) (focus-status grabbed)))) - (let ((check-too-far-func (the-as object (-> obj waypoint check-too-far)))) - (if (not (the-as symbol check-too-far-func)) - (set! check-too-far-func (-> obj course default-check-too-far)) - ) - (when (the-as symbol check-too-far-func) - (cond - ((logtest? (the-as int check-too-far-func) 1) - (set! result ((the-as (function bot int) (-> (the-as symbol check-too-far-func) value)) obj)) - ) - ((= (rtype-of (the-as symbol check-too-far-func)) function) - (set! result ((the-as (function bot int) check-too-far-func) obj)) - ) - ) + (let ((result 0)) + (let ((too-far-check (-> obj delay-too-far-check))) + (cond + ((> too-far-check 0) + (set! (-> obj delay-too-far-check) (+ too-far-check -1)) + ) + ((and (zero? too-far-check) *target* (not (logtest? (-> obj focus-status) (focus-status grabbed)))) + (let ((check-too-far-func (the-as object (-> obj waypoint check-too-far)))) + (if (not (the-as symbol check-too-far-func)) + (set! check-too-far-func (-> obj course default-check-too-far)) + ) + (when (the-as symbol check-too-far-func) + (cond + ((logtest? (the-as int check-too-far-func) 1) + (set! result ((the-as (function bot int) (-> (the-as symbol check-too-far-func) value)) obj)) + ) + ((= (rtype-of (the-as symbol check-too-far-func)) function) + (set! result ((the-as (function bot int) check-too-far-func) obj)) + ) ) ) - (if (and (= result 1) - (nonzero? (-> obj started-warning-time)) - (>= (- (-> pp clock frame-counter) (-> obj started-warning-time)) - (the-as time-frame (-> obj warn-to-fail-timeout)) - ) - ) - (set! result 2) - ) - (case result - ((1) - (if (zero? (-> obj started-warning-time)) - (set! (-> obj started-warning-time) (-> pp clock frame-counter)) - ) - (if (and (>= (-> pp clock frame-counter) (-> obj next-too-far-warn-time)) (play-too-far-warn-speech obj)) - (set! (-> obj next-too-far-warn-time) - (+ (-> pp clock frame-counter) - (get-rand-int-range obj (the-as int (-> obj warn-min-delay)) (the-as int (-> obj warn-max-delay))) - ) - ) - ) - ) - ) ) - ) + (if (and (= result 1) + (nonzero? (-> obj started-warning-time)) + (>= (- (current-time) (-> obj started-warning-time)) (the-as time-frame (-> obj warn-to-fail-timeout))) + ) + (set! result 2) + ) + (case result + ((1) + (if (zero? (-> obj started-warning-time)) + (set! (-> obj started-warning-time) (current-time)) + ) + (if (and (>= (current-time) (-> obj next-too-far-warn-time)) (play-too-far-warn-speech obj)) + (set! (-> obj next-too-far-warn-time) + (+ (current-time) + (get-rand-int-range obj (the-as int (-> obj warn-min-delay)) (the-as int (-> obj warn-max-delay))) + ) + ) + ) + ) + ) + ) ) - (when (zero? result) - (set! (-> obj started-warning-time) 0) - 0 - ) - (= result 2) ) + (when (zero? result) + (set! (-> obj started-warning-time) 0) + 0 + ) + (= result 2) ) ) ;; definition for method 212 of type bot ;; WARN: Return type mismatch time-frame vs none. (defmethod reset-warn-time! bot ((obj bot)) - (with-pp - (set! (-> obj started-warning-time) 0) - (set! (-> obj next-too-far-warn-time) - (+ (-> pp clock frame-counter) - (get-rand-int-range obj (the-as int (-> obj warn-min-delay)) (the-as int (-> obj warn-max-delay))) - ) - ) - (none) - ) + (set! (-> obj started-warning-time) 0) + (set! (-> obj next-too-far-warn-time) + (+ (current-time) + (get-rand-int-range obj (the-as int (-> obj warn-min-delay)) (the-as int (-> obj warn-max-delay))) + ) + ) + (none) ) ;; definition for method 55 of type bot @@ -1423,44 +1411,42 @@ If the player is too far, play a warning speech." ;; definition for method 213 of type bot (defmethod go-to-waypoint! bot ((obj bot) (id int) (skipped? symbol)) "Start moving to the given [[bot-waypoint]]." - (with-pp - (let* ((course (-> obj course)) - (waypoint-count (-> course waypoints length)) - ) - (dotimes (i waypoint-count) - (let ((waypoint (-> course waypoints i))) - (when (= (-> waypoint waypoint-id) id) - (set! (-> obj waypoint) waypoint) - (set! (-> obj waypoint-bits) (the-as uint 0)) - (set! (-> obj waypoint-time0) (-> pp clock frame-counter)) - (set! (-> obj too-far-warn-dist) (-> obj too-far-warn-dist-default)) - (set! (-> obj too-far-fail-dist-delta) (-> obj too-far-fail-dist-delta-default)) - (let ((mesh-idx (-> waypoint nav-mesh-index))) - (when (and (>= mesh-idx 0) (!= (-> obj nav-mesh-index) mesh-idx)) - (change-to (nav-mesh-from-res-tag (-> obj entity) 'nav-mesh-actor mesh-idx) obj) - (set! (-> obj nav-mesh-index) mesh-idx) - ) + (let* ((course (-> obj course)) + (waypoint-count (-> course waypoints length)) + ) + (dotimes (i waypoint-count) + (let ((waypoint (-> course waypoints i))) + (when (= (-> waypoint waypoint-id) id) + (set! (-> obj waypoint) waypoint) + (set! (-> obj waypoint-bits) (the-as uint 0)) + (set! (-> obj waypoint-time0) (current-time)) + (set! (-> obj too-far-warn-dist) (-> obj too-far-warn-dist-default)) + (set! (-> obj too-far-fail-dist-delta) (-> obj too-far-fail-dist-delta-default)) + (let ((mesh-idx (-> waypoint nav-mesh-index))) + (when (and (>= mesh-idx 0) (!= (-> obj nav-mesh-index) mesh-idx)) + (change-to (nav-mesh-from-res-tag (-> obj entity) 'nav-mesh-actor mesh-idx) obj) + (set! (-> obj nav-mesh-index) mesh-idx) ) - (when skipped? - (let ((on-skip (-> waypoint on-skipping-here))) - (when on-skip - (process-entity-status! obj (entity-perm-status no-kill) #t) - (on-skip obj) - ) - ) - ) - (let ((on-set (-> waypoint on-set))) - (if on-set - (on-set obj) - ) - ) - (return #f) ) + (when skipped? + (let ((on-skip (-> waypoint on-skipping-here))) + (when on-skip + (process-entity-status! obj (entity-perm-status no-kill) #t) + (on-skip obj) + ) + ) + ) + (let ((on-set (-> waypoint on-set))) + (if on-set + (on-set obj) + ) + ) + (return #f) ) ) ) - (go process-drawable-art-error "bad waypoint id") ) + (go process-drawable-art-error "bad waypoint id") ) ;; definition for method 215 of type bot @@ -1593,88 +1579,86 @@ If the player is too far, play a warning speech." ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod bot-method-223 bot ((obj bot) (arg0 symbol)) - (with-pp - (let ((focus (-> obj focus-info)) - (timer (-> pp clock frame-counter)) - (focus-proc (handle->process (-> obj focus handle))) - ) - (when (or (!= timer (-> focus update-time)) (!= focus-proc (-> focus fproc))) - (set! (-> focus update-time) timer) - (set! (-> focus fproc) (the-as process-focusable focus-proc)) - (set! (-> focus los) 0) - (when focus-proc - (set! (-> focus pos quad) (-> (get-trans (the-as process-focusable focus-proc) 0) quad)) - (set! (-> focus bullseye quad) (-> (get-trans (the-as process-focusable focus-proc) 3) quad)) - (vector-z-quaternion! (-> focus my-facing-xz-dir) (-> obj root-override2 quat)) - (set! (-> focus my-facing-xz-dir y) 0.0) - (vector-normalize! (-> focus my-facing-xz-dir) 1.0) - (set! (-> focus my-facing-ry) (atan (-> focus my-facing-xz-dir x) (-> focus my-facing-xz-dir z))) - (vector-! (-> focus bullseye-xz-dir) (-> focus bullseye) (-> obj root-override2 trans)) - (let ((v1-11 (-> focus bullseye-xz-dir))) - (set! (-> focus bullseye-xz-dist) (sqrtf (+ (* (-> v1-11 x) (-> v1-11 x)) (* (-> v1-11 z) (-> v1-11 z))))) - ) - (set! (-> focus bullseye-xz-dir y) 0.0) - (vector-normalize! (-> focus bullseye-xz-dir) 1.0) - (set! (-> focus bullseye-ry) (atan (-> focus bullseye-xz-dir x) (-> focus bullseye-xz-dir z))) - (set! (-> focus ry-diff) (deg- (-> focus bullseye-ry) (-> focus my-facing-ry))) - ) + (let ((focus (-> obj focus-info)) + (timer (current-time)) + (focus-proc (handle->process (-> obj focus handle))) ) - (when (and arg0 focus-proc (zero? (-> focus los))) - (let ((cquery (new 'stack-no-clear 'collide-query))) - (set! (-> cquery start-pos quad) (-> obj root-override2 trans quad)) - (set! (-> cquery start-pos y) (+ 8192.0 (-> cquery start-pos y))) - (vector-! (-> cquery move-dist) (-> focus bullseye) (-> cquery start-pos)) - (let ((f0-19 (fmax 1.0 (+ -1638.4 (vector-length (-> cquery move-dist)))))) - (cond - ((< f0-19 (-> focus max-los-dist)) - (vector-normalize! (-> cquery move-dist) f0-19) - (let ((v1-23 cquery)) - (set! (-> v1-23 radius) 2048.0) - (set! (-> v1-23 collide-with) (collide-spec backgnd obstacle hit-by-others-list pusher)) - (set! (-> v1-23 ignore-process0) obj) - (set! (-> v1-23 ignore-process1) #f) - (set! (-> v1-23 ignore-pat) (-> obj root-override2 pat-ignore-mask)) - (set! (-> v1-23 action-mask) (collide-action solid)) - ) - (cond - ((>= (fill-and-probe-using-line-sphere *collide-cache* cquery) 0.0) - (set! (-> focus los) 3) - 0 - ) - (else - (let ((s3-3 1)) - (when (not (logtest? (-> obj bot-flags) (bot-flags attacked))) - (let ((a0-31 *target*)) - (when a0-31 - (vector+! (-> cquery move-dist) (-> cquery move-dist) (-> cquery start-pos)) - (if (>= 16384.0 (vector-segment-distance-point! - (get-trans a0-31 3) - (-> cquery start-pos) - (-> cquery move-dist) - (the-as vector #f) - ) - ) - (set! s3-3 4) - ) - ) + (when (or (!= timer (-> focus update-time)) (!= focus-proc (-> focus fproc))) + (set! (-> focus update-time) timer) + (set! (-> focus fproc) (the-as process-focusable focus-proc)) + (set! (-> focus los) 0) + (when focus-proc + (set! (-> focus pos quad) (-> (get-trans (the-as process-focusable focus-proc) 0) quad)) + (set! (-> focus bullseye quad) (-> (get-trans (the-as process-focusable focus-proc) 3) quad)) + (vector-z-quaternion! (-> focus my-facing-xz-dir) (-> obj root-override2 quat)) + (set! (-> focus my-facing-xz-dir y) 0.0) + (vector-normalize! (-> focus my-facing-xz-dir) 1.0) + (set! (-> focus my-facing-ry) (atan (-> focus my-facing-xz-dir x) (-> focus my-facing-xz-dir z))) + (vector-! (-> focus bullseye-xz-dir) (-> focus bullseye) (-> obj root-override2 trans)) + (let ((v1-11 (-> focus bullseye-xz-dir))) + (set! (-> focus bullseye-xz-dist) (sqrtf (+ (* (-> v1-11 x) (-> v1-11 x)) (* (-> v1-11 z) (-> v1-11 z))))) + ) + (set! (-> focus bullseye-xz-dir y) 0.0) + (vector-normalize! (-> focus bullseye-xz-dir) 1.0) + (set! (-> focus bullseye-ry) (atan (-> focus bullseye-xz-dir x) (-> focus bullseye-xz-dir z))) + (set! (-> focus ry-diff) (deg- (-> focus bullseye-ry) (-> focus my-facing-ry))) + ) + ) + (when (and arg0 focus-proc (zero? (-> focus los))) + (let ((cquery (new 'stack-no-clear 'collide-query))) + (set! (-> cquery start-pos quad) (-> obj root-override2 trans quad)) + (set! (-> cquery start-pos y) (+ 8192.0 (-> cquery start-pos y))) + (vector-! (-> cquery move-dist) (-> focus bullseye) (-> cquery start-pos)) + (let ((f0-19 (fmax 1.0 (+ -1638.4 (vector-length (-> cquery move-dist)))))) + (cond + ((< f0-19 (-> focus max-los-dist)) + (vector-normalize! (-> cquery move-dist) f0-19) + (let ((v1-23 cquery)) + (set! (-> v1-23 radius) 2048.0) + (set! (-> v1-23 collide-with) (collide-spec backgnd obstacle hit-by-others-list pusher)) + (set! (-> v1-23 ignore-process0) obj) + (set! (-> v1-23 ignore-process1) #f) + (set! (-> v1-23 ignore-pat) (-> obj root-override2 pat-ignore-mask)) + (set! (-> v1-23 action-mask) (collide-action solid)) + ) + (cond + ((>= (fill-and-probe-using-line-sphere *collide-cache* cquery) 0.0) + (set! (-> focus los) 3) + 0 + ) + (else + (let ((s3-3 1)) + (when (not (logtest? (-> obj bot-flags) (bot-flags attacked))) + (let ((a0-31 *target*)) + (when a0-31 + (vector+! (-> cquery move-dist) (-> cquery move-dist) (-> cquery start-pos)) + (if (>= 16384.0 (vector-segment-distance-point! + (get-trans a0-31 3) + (-> cquery start-pos) + (-> cquery move-dist) + (the-as vector #f) + ) + ) + (set! s3-3 4) + ) ) ) - (set! (-> focus los) s3-3) ) + (set! (-> focus los) s3-3) ) ) ) - (else - (set! (-> focus los) 2) - ) + ) + (else + (set! (-> focus los) 2) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 182 of type bot @@ -1938,78 +1922,72 @@ If the player is too far, play a warning speech." ;; definition for method 191 of type bot ;; WARN: Return type mismatch focus-status vs none. (defmethod bot-method-191 bot ((obj bot)) - (with-pp - (logior! (-> obj bot-flags) (bot-flags bf02)) - (set! (-> obj hit-invuln-starting-time) (-> pp clock frame-counter)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active)) - (if (nonzero? (-> obj hit-invuln-ignore-me-delay)) - (logior! (-> obj focus-status) (focus-status ignore)) - ) - (if (nonzero? (-> obj hit-invuln-focus-disable-delay)) - (logior! (-> obj focus-status) (focus-status disable)) - ) - (none) - ) + (logior! (-> obj bot-flags) (bot-flags bf02)) + (set! (-> obj hit-invuln-starting-time) (current-time)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active)) + (if (nonzero? (-> obj hit-invuln-ignore-me-delay)) + (logior! (-> obj focus-status) (focus-status ignore)) + ) + (if (nonzero? (-> obj hit-invuln-focus-disable-delay)) + (logior! (-> obj focus-status) (focus-status disable)) + ) + (none) ) ;; definition for method 192 of type bot ;; WARN: Return type mismatch bot-flags vs none. (defmethod bot-method-192 bot ((obj bot)) (local-vars (a2-7 enemy-flag)) - (with-pp - (let ((a1-0 (-> obj hit-invuln-starting-time)) - (v1-0 #t) - ) - (if (not (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active))) - (set! v1-0 (cond - ((>= (- (-> pp clock frame-counter) a1-0) (seconds 0.6)) - (let ((a2-6 (-> obj enemy-flags))) - (if (logtest? a2-6 (enemy-flag checking-water)) - (set! a2-7 (logior a2-6 (enemy-flag enable-on-active))) - (set! a2-7 (logclear a2-6 (enemy-flag enable-on-active))) - ) - ) - (set! (-> obj enemy-flags) a2-7) - v1-0 + (let ((a1-0 (-> obj hit-invuln-starting-time)) + (v1-0 #t) + ) + (if (not (logtest? (-> obj enemy-flags) (enemy-flag enable-on-active))) + (set! v1-0 (cond + ((>= (- (current-time) a1-0) (seconds 0.6)) + (let ((a2-6 (-> obj enemy-flags))) + (if (logtest? a2-6 (enemy-flag checking-water)) + (set! a2-7 (logior a2-6 (enemy-flag enable-on-active))) + (set! a2-7 (logclear a2-6 (enemy-flag enable-on-active))) + ) ) - (else - #f - ) + (set! (-> obj enemy-flags) a2-7) + v1-0 + ) + (else + #f ) - ) - ) - (if (focus-test? obj ignore) - (set! v1-0 - (cond - ((>= (- (-> pp clock frame-counter) a1-0) (the-as time-frame (-> obj hit-invuln-ignore-me-delay))) - (logclear! (-> obj focus-status) (focus-status ignore)) - v1-0 - ) - (else - #f - ) - ) - ) - ) - (if (focus-test? obj disable) - (set! v1-0 - (cond - ((>= (- (-> pp clock frame-counter) a1-0) (the-as time-frame (-> obj hit-invuln-focus-disable-delay))) - (logclear! (-> obj focus-status) (focus-status disable)) - v1-0 - ) - (else - #f - ) - ) - ) - ) - (if v1-0 - (logclear! (-> obj bot-flags) (bot-flags bf02)) - ) - ) - (none) + ) + ) + ) + (if (focus-test? obj ignore) + (set! v1-0 (cond + ((>= (- (current-time) a1-0) (the-as time-frame (-> obj hit-invuln-ignore-me-delay))) + (logclear! (-> obj focus-status) (focus-status ignore)) + v1-0 + ) + (else + #f + ) + ) + ) + ) + (if (focus-test? obj disable) + (set! v1-0 (cond + ((>= (- (current-time) a1-0) (the-as time-frame (-> obj hit-invuln-focus-disable-delay))) + (logclear! (-> obj focus-status) (focus-status disable)) + v1-0 + ) + (else + #f + ) + ) + ) + ) + (if v1-0 + (logclear! (-> obj bot-flags) (bot-flags bf02)) + ) ) + (none) ) ;; definition for method 216 of type bot diff --git a/test/decompiler/reference/jak2/levels/common/airlock_REF.gc b/test/decompiler/reference/jak2/levels/common/airlock_REF.gc index 2157027afd..53fd32dba8 100644 --- a/test/decompiler/reference/jak2/levels/common/airlock_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/airlock_REF.gc @@ -221,7 +221,7 @@ (local-vars (a0-12 entity-actor)) (let* ((tgt (target-pos 0)) (f30-0 (check-crossing-distance obj tgt #t)) - (s5-0 (>= (-> obj latch-open-time) (-> self clock frame-counter))) + (s5-0 (>= (-> obj latch-open-time) (current-time))) ) (the-as symbol @@ -234,7 +234,7 @@ (if (and (not (-> obj were-behind?)) (and (< f30-0 0.0) (-> obj inner?))) (set! (-> obj were-behind?) #t) ) - (and (< (-> obj latch-closed-time) (-> self clock frame-counter)) + (and (< (-> obj latch-closed-time) (current-time)) (or (not (and *target* (focus-test? *target* pilot teleporting))) (< f30-0 -409.6)) (or (and (< f30-0 (-> obj open-distance)) (or (not (-> obj were-behind?)) (< f30-0 20480.0)) @@ -373,8 +373,8 @@ ) ) (cond - ((and gp-0 (>= (- (-> self clock frame-counter) (-> obj spool-sound-time)) (seconds 2))) - (set! (-> obj spool-sound-time) (-> self clock frame-counter)) + ((and gp-0 (>= (- (current-time) (-> obj spool-sound-time)) (seconds 2))) + (set! (-> obj spool-sound-time) (current-time)) (add-process *gui-control* obj @@ -413,10 +413,10 @@ object (case event-type (('close) - (set! (-> self latch-closed-time) (+ (-> self clock frame-counter) (if (>= arg1 1) - (the-as int (-> event param 0)) - 3000 - ) + (set! (-> self latch-closed-time) (+ (current-time) (if (>= arg1 1) + (the-as int (-> event param 0)) + 3000 + ) ) ) (if (and (>= arg1 2) (and (= (-> event param 1) #t) (not (want-cross-airlock? self)))) @@ -425,10 +425,10 @@ (and (-> self next-state) (= (-> self next-state name) 'open)) ) (('open) - (set! (-> self latch-open-time) (+ (-> self clock frame-counter) (if (>= arg1 1) - (the-as int (-> event param 0)) - 3000 - ) + (set! (-> self latch-open-time) (+ (current-time) (if (>= arg1 1) + (the-as int (-> event param 0)) + 3000 + ) ) ) (if (and (>= arg1 2) (and (= (-> event param 1) #t) (want-cross-airlock? self) (destination-loaded? self #f))) @@ -1600,7 +1600,3 @@ This commonly includes things such as: (go (method-of-object obj close) #t) (none) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/common/battle_REF.gc b/test/decompiler/reference/jak2/levels/common/battle_REF.gc index b4c18b593c..fde1794b26 100644 --- a/test/decompiler/reference/jak2/levels/common/battle_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/battle_REF.gc @@ -1254,64 +1254,62 @@ ;; definition for method 39 of type battle ;; INFO: Used lq/sq (defmethod battle-method-39 battle ((obj battle) (arg0 battle-spawner) (arg1 symbol)) - (with-pp - (let ((s3-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'quaternion)) - (s2-0 (-> arg0 intro-path)) - ) - (cond - (s2-0 - (let ((s1-0 0)) - (when arg1 - (set! s1-0 (-> arg0 ready-index)) - (set! s1-0 (cond - ((>= s1-0 0) - (empty) - s1-0 - ) - (else - (-> arg0 attack-index) - ) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'quaternion)) + (s2-0 (-> arg0 intro-path)) + ) + (cond + (s2-0 + (let ((s1-0 0)) + (when arg1 + (set! s1-0 (-> arg0 ready-index)) + (set! s1-0 (cond + ((>= s1-0 0) + (empty) + s1-0 + ) + (else + (-> arg0 attack-index) ) - ) - ) - (set! (-> arg0 creature-index) s1-0) - (get-point-in-path! s2-0 s3-0 (the float s1-0) 'exact) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (displacement-between-two-points-normalized! s2-0 s0-0 (the float s1-0)) - (set! (-> s0-0 y) 0.0) - (vector-normalize! s0-0 1.0) - (forward-up->quaternion s4-0 s0-0 *up-vector*) - ) + ) + ) ) - ) - (else - (set! (-> arg0 creature-index) 0) - (let ((v1-7 (-> arg0 entity))) - (set! (-> s3-0 quad) (-> v1-7 extra trans quad)) - (quaternion-copy! s4-0 (-> v1-7 quat)) + (set! (-> arg0 creature-index) s1-0) + (get-point-in-path! s2-0 s3-0 (the float s1-0) 'exact) + (let ((s0-0 (new 'stack-no-clear 'vector))) + (displacement-between-two-points-normalized! s2-0 s0-0 (the float s1-0)) + (set! (-> s0-0 y) 0.0) + (vector-normalize! s0-0 1.0) + (forward-up->quaternion s4-0 s0-0 *up-vector*) ) ) ) - (let ((s1-1 (new 'stack-no-clear 'transformq)) - (s2-1 (!= s2-0 #f)) - (s0-1 (battle-method-41 obj arg0)) - ) - (set! (-> s1-1 trans quad) (-> s3-0 quad)) - (quaternion-copy! (-> s1-1 quat) s4-0) - (set! (-> s1-1 scale x) (the-as float (-> arg0 entity))) - (set! (-> s1-1 scale y) (the-as float #t)) - (set! (-> s1-1 scale z) (the-as float s2-1)) - (let ((v0-7 (battle-method-38 obj s0-1 s1-1))) - (when (handle->process v0-7) - (set! (-> arg0 creature) v0-7) - (set! (-> arg0 mode) (the-as uint 1)) - (set! (-> arg0 last-spawn-time) (-> pp clock frame-counter)) - ) - v0-7 + (else + (set! (-> arg0 creature-index) 0) + (let ((v1-7 (-> arg0 entity))) + (set! (-> s3-0 quad) (-> v1-7 extra trans quad)) + (quaternion-copy! s4-0 (-> v1-7 quat)) ) ) ) + (let ((s1-1 (new 'stack-no-clear 'transformq)) + (s2-1 (!= s2-0 #f)) + (s0-1 (battle-method-41 obj arg0)) + ) + (set! (-> s1-1 trans quad) (-> s3-0 quad)) + (quaternion-copy! (-> s1-1 quat) s4-0) + (set! (-> s1-1 scale x) (the-as float (-> arg0 entity))) + (set! (-> s1-1 scale y) (the-as float #t)) + (set! (-> s1-1 scale z) (the-as float s2-1)) + (let ((v0-7 (battle-method-38 obj s0-1 s1-1))) + (when (handle->process v0-7) + (set! (-> arg0 creature) v0-7) + (set! (-> arg0 mode) (the-as uint 1)) + (set! (-> arg0 last-spawn-time) (current-time)) + ) + v0-7 + ) + ) ) ) @@ -1347,10 +1345,10 @@ (let ((v1-5 (-> arg0 noticed-attack-time))) (cond ((zero? v1-5) - (set! (-> arg0 noticed-attack-time) (-> self clock frame-counter)) + (set! (-> arg0 noticed-attack-time) (current-time)) ) (else - (if (>= (- (-> self clock frame-counter) v1-5) (the-as time-frame (-> arg0 notice-attack-delay))) + (if (>= (- (current-time) v1-5) (the-as time-frame (-> arg0 notice-attack-delay))) (logior! (-> arg0 flags) 1) ) ) @@ -1561,7 +1559,7 @@ :virtual #t :event battle-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval (the-as pair gp-0) :vector (-> self root trans)) @@ -1614,77 +1612,75 @@ ;; definition for method 50 of type battle (defmethod battle-method-50 battle ((obj battle)) - (with-pp - (let ((s5-0 (battle-method-52 obj)) - (v1-2 (battle-method-49 obj)) - (a1-0 (-> obj child)) - (a0-3 0) - ) - (while a1-0 - (+! a0-3 1) - (set! a1-0 (-> a1-0 0 brother)) - (nop!) - (nop!) + (let ((s5-0 (battle-method-52 obj)) + (v1-2 (battle-method-49 obj)) + (a1-0 (-> obj child)) + (a0-3 0) ) - (set! (-> obj stat-child-count) (the-as uint a0-3)) - (let ((a0-4 (+ v1-2 a0-3)) - (v1-4 (-> obj max-count)) + (while a1-0 + (+! a0-3 1) + (set! a1-0 (-> a1-0 0 brother)) + (nop!) + (nop!) + ) + (set! (-> obj stat-child-count) (the-as uint a0-3)) + (let ((a0-4 (+ v1-2 a0-3)) + (v1-4 (-> obj max-count)) + ) + (when (zero? a0-4) + (if (or (logtest? (-> obj flags) 4) (>= (-> obj die-count) v1-4)) + (return #t) ) - (when (zero? a0-4) - (if (or (logtest? (-> obj flags) 4) (>= (-> obj die-count) v1-4)) - (return #t) + ) + (set! (-> obj flags) (logand -9 (-> obj flags))) + (cond + ((and (> s5-0 0) (>= s5-0 (the-as int (- v1-4 (-> obj die-count))))) + (let ((a1-14 (-> obj jammed-starting-time))) + (cond + ((zero? (-> obj jammed-starting-time)) + (set! (-> obj jammed-starting-time) (current-time)) ) + (else + (if (>= (- (current-time) a1-14) (seconds 3.5)) + (logior! (-> obj flags) 8) + ) + ) + ) + ) + ) + (else + (set! (-> obj jammed-starting-time) 0) + 0 ) - (set! (-> obj flags) (logand -9 (-> obj flags))) - (cond - ((and (> s5-0 0) (>= s5-0 (the-as int (- v1-4 (-> obj die-count))))) - (let ((a1-14 (-> obj jammed-starting-time))) + ) + (cond + ((and (not (logtest? (-> obj flags) 4)) + (> (-> obj spawners length) 0) + (< a0-4 (the-as int (-> obj info desired-alive-count))) + (< (-> obj count) v1-4) + ) + (when (>= (- (current-time) (-> obj cant-spawn-time)) (the-as time-frame (-> obj next-spawn-delay))) + (let ((a1-29 (battle-method-36 obj))) (cond - ((zero? (-> obj jammed-starting-time)) - (set! (-> obj jammed-starting-time) (-> pp clock frame-counter)) - ) + (a1-29 + (battle-method-39 obj a1-29 #f) + (set! (-> obj next-spawn-delay) (the-as uint (battle-method-35 obj))) + (set! (-> obj cant-spawn-time) (current-time)) + ) (else - (if (>= (- (-> pp clock frame-counter) a1-14) (seconds 3.5)) - (logior! (-> obj flags) 8) - ) + (set! (-> obj cant-spawn-time) (current-time)) ) ) ) ) - (else - (set! (-> obj jammed-starting-time) 0) - 0 - ) - ) - (cond - ((and (not (logtest? (-> obj flags) 4)) - (> (-> obj spawners length) 0) - (< a0-4 (the-as int (-> obj info desired-alive-count))) - (< (-> obj count) v1-4) - ) - (when (>= (- (-> pp clock frame-counter) (-> obj cant-spawn-time)) (the-as time-frame (-> obj next-spawn-delay))) - (let ((a1-29 (battle-method-36 obj))) - (cond - (a1-29 - (battle-method-39 obj a1-29 #f) - (set! (-> obj next-spawn-delay) (the-as uint (battle-method-35 obj))) - (set! (-> obj cant-spawn-time) (-> pp clock frame-counter)) - ) - (else - (set! (-> obj cant-spawn-time) (-> pp clock frame-counter)) - ) - ) - ) - ) - ) - (else - (set! (-> obj cant-spawn-time) (-> pp clock frame-counter)) - ) + ) + (else + (set! (-> obj cant-spawn-time) (current-time)) ) ) ) - #f ) + #f ) ;; failed to figure out what this is: @@ -1692,7 +1688,7 @@ :virtual #t :event battle-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self flags) 2) (set! (-> self flags) (logand -9 (-> self flags))) (set! (-> self jammed-starting-time) 0) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/amphibian/amphibian_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/amphibian/amphibian_REF.gc index 0ef9ced1ee..ffe69e2b1e 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/amphibian/amphibian_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/amphibian/amphibian_REF.gc @@ -1148,8 +1148,8 @@ :virtual #t :code (behavior () (until #f - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.067)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1.067)) (amphibian-method-187 self) (suspend) ) @@ -1209,7 +1209,7 @@ 0 (nav-enemy-method-165 self) (ja-no-eval :num! (loop!)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.067)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1.067)) (amphibian-method-187 self) (suspend) ) @@ -1807,7 +1807,7 @@ :event (the-as (function process int symbol event-message-block object :behavior amphibian) enemy-event-handler) :enter (behavior () ((-> (method-of-type nav-enemy hostile) enter)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-4 nav callback-info) *nav-enemy-null-callback-info*) @@ -1834,7 +1834,7 @@ (let ((v1-0 (-> self tongue-mode))) (cond ((zero? v1-0) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.8)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.8)) (set! (-> self tongue-mode) (the-as uint 1)) (sound-play "tongue-attack") ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/baby_spider/tomb-baby-spider_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/baby_spider/tomb-baby-spider_REF.gc index ea2704aff9..3da31985b1 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/baby_spider/tomb-baby-spider_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/baby_spider/tomb-baby-spider_REF.gc @@ -482,7 +482,7 @@ 0 ) (ja-channel-push! 1 (seconds 0.2)) - (let ((gp-3 (-> self clock frame-counter)) + (let ((gp-3 (current-time)) (s5-1 (the int (* 300.0 (rand-vu-float-range 0.6 1.2)))) (f30-2 1.0) ) @@ -490,7 +490,7 @@ :num! (loop! f30-2) :frame-num 0.0 ) - (until (>= (- (-> self clock frame-counter) gp-3) s5-1) + (until (>= (- (current-time) gp-3) s5-1) (suspend) (ja :num! (loop! f30-2)) ) @@ -827,7 +827,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak2/levels/common/enemy/bombots/bombbot_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/bombots/bombbot_REF.gc index 0f1be49362..43f5cb7b66 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/bombots/bombbot_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/bombots/bombbot_REF.gc @@ -788,7 +788,6 @@ ) ;; definition for method 3 of type ik-setup -;; INFO: this function exists in multiple non-identical object files (defmethod inspect ik-setup ((obj ik-setup)) (when (not obj) (set! obj obj) @@ -977,7 +976,7 @@ (let ((f30-0 0.4)) (vector-normalize! s2-0 1.0) (let ((s1-0 (-> obj feet s4-0))) - (let* ((f0-10 (+ (* 0.0033333334 (the float (mod (-> pp clock frame-counter) 300))) (-> s1-0 offset))) + (let* ((f0-10 (+ (* 0.0033333334 (the float (mod (current-time) 300))) (-> s1-0 offset))) (f28-0 (- f0-10 (* (the float (the int (/ f0-10 1.0))) 1.0))) (s0-0 (new 'stack-no-clear 'vector)) ) @@ -2008,14 +2007,14 @@ (init-vf0-vector) (when (>= (the int (* 30.0 (-> self shield-hit-points))) (-> self hit-points)) ) - (when (< (the-as time-frame (-> self next-target)) (-> self clock frame-counter)) + (when (< (the-as time-frame (-> self next-target)) (current-time)) (let ((a1-0 (new 'stack-no-clear 'vector))) (set! (-> a1-0 quad) (-> self root-override2 trans quad)) (set! (-> a1-0 w) 122880.0) (bombbot-method-181 self a1-0) ) - (set! (-> self next-target) (the-as uint (+ (-> self clock frame-counter) (seconds 2)))) - (set! (-> self start-target) (the-as uint (-> self clock frame-counter))) + (set! (-> self next-target) (the-as uint (+ (current-time) (seconds 2)))) + (set! (-> self start-target) (the-as uint (current-time))) ) (let ((gp-0 (handle->process (-> self focus handle)))) (let ((f30-0 1.0)) @@ -2031,7 +2030,7 @@ (let ((a1-6 (-> self target-pos))) (let ((v1-34 (-> self start-target-pos))) (let ((a0-14 (-> self start-target-vel))) - (let ((a2-8 (* 0.0033333334 (the float (- (-> self clock frame-counter) (the-as int (-> self start-target))))))) + (let ((a2-8 (* 0.0033333334 (the float (- (current-time) (the-as int (-> self start-target))))))) (.mov vf7 a2-8) ) (.lvf vf5 (&-> a0-14 quad)) @@ -2044,7 +2043,7 @@ (.svf (&-> a1-6 quad) vf6) ) (cond - ((< (the-as time-frame (+ (-> self next-target) -300)) (-> self clock frame-counter)) + ((< (the-as time-frame (+ (-> self next-target) -300)) (current-time)) (bombbot-method-182 self) ) (else @@ -2096,7 +2095,7 @@ ) ) (if (= (vector-length (-> self root-override2 transv)) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (set! (-> self last-head-roty-speed) (-> self head-roty-speed)) (set! (-> self head-roty-speed) (vector-y-angle (-> self node-list data 4 bone transform vector 2))) @@ -2229,7 +2228,7 @@ ) (set! (-> self explosing) #f) (set! (-> self beep-time) 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -2239,28 +2238,26 @@ ) ) 0 - (if (>= (- (-> self clock frame-counter) (-> self state-time)) 0) + (if (>= (- (current-time) (-> self state-time)) 0) (seek! (-> self legs-strength 0) 0.8 (* 10.0 (-> self clock seconds-per-frame))) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.8)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.8)) (seek! (-> self legs-strength 3) 0.4 (* 10.0 (-> self clock seconds-per-frame))) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.6)) + (if (>= (- (current-time) (-> self state-time)) (seconds 1.6)) (seek! (-> self legs-strength 1) 0.0 (* 10.0 (-> self clock seconds-per-frame))) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2.4)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2.4)) (seek! (-> self legs-strength 2) 0.5 (* 10.0 (-> self clock seconds-per-frame))) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2.8)) + (when (>= (- (current-time) (-> self state-time)) (seconds 2.8)) (sound-play "bb-explode") (go-virtual explode) ) - (when (< (-> self beep-time) (-> self clock frame-counter)) + (when (< (-> self beep-time) (current-time)) (sound-play "bb-beep") (set! (-> self beep-time) - (+ (-> self clock frame-counter) - (the int (* 0.2 (the float (- (seconds 2.8) (- (-> self clock frame-counter) (-> self state-time)))))) - ) + (+ (current-time) (the int (* 0.2 (the float (- (seconds 2.8) (- (current-time) (-> self state-time))))))) ) ) (none) @@ -2295,7 +2292,7 @@ (set! (-> self minimap) #f) ) (set! (-> self explosing) #f) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 1)))) (set! (-> gp-0 fountain-rand-transv-lo quad) (-> self root-override2 trans quad)) (set! (-> gp-0 duration) (seconds 3)) @@ -3354,7 +3351,7 @@ TASK_MANAGER_COMPLETE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (talker-spawn-func (-> *talker-speech* 117) *entity-pool* (target-pos 0) (the-as region #f)) (none) ) @@ -3376,8 +3373,8 @@ ((= (level-status *level* 'ctysluma) 'active) (set-setting! 'entity-name "camera-236" 0.0 0) (set-setting! 'minimap 'clear 0.0 (minimap-flag minimap)) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (add-process *gui-control* self (gui-channel sig) (gui-action play) "bbotxplo" -99.0 0) @@ -3393,8 +3390,8 @@ ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.3)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 0.3)) (suspend) ) (setup @@ -3404,7 +3401,7 @@ (-> self clock seconds-per-frame) (bucket-id tex-all-map) ) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (while (< (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) (set-setting! 'interp-time 'abs 0.0 0) @@ -3505,7 +3502,7 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (suspend) ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/bouncer_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/bouncer_REF.gc index 48c02d93b6..c7575c4782 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/bouncer_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/bouncer_REF.gc @@ -152,7 +152,7 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('touch) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) #f ) (else @@ -161,10 +161,10 @@ ) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self smush) 0.0) (until #f - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.2)) (ja :num! (seek! 0.0 0.1)) (ja :num! (seek! (lerp-scale diff --git a/test/decompiler/reference/jak2/levels/common/enemy/fodder/fodder_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/fodder/fodder_REF.gc index 2083a33c90..126bd8a4ba 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/fodder/fodder_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/fodder/fodder_REF.gc @@ -322,52 +322,50 @@ ;; definition for method 180 of type fodder (defmethod fodder-method-180 fodder ((obj fodder)) "@TODO no idea, never seems to do anything because the actor-group-count is always 0" - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> obj look-at-other-time)) (seconds 0.25)) - (dotimes (group-idx (-> obj actor-group-count)) - (let ((group (-> obj 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) - ) - ) - ) - (when (and fodder-proc - (!= fodder-proc obj) - (>= (- (-> pp clock frame-counter) (-> fodder-proc look-at-other-time)) (seconds 0.25)) - ) - (let* ((dir-to-other-fodder - (vector-! (new 'stack-no-clear 'vector) (-> fodder-proc root-override2 trans) (-> obj root-override2 trans)) - ) - (dir-length (vector-length dir-to-other-fodder)) + (when (>= (- (current-time) (-> obj look-at-other-time)) (seconds 0.25)) + (dotimes (group-idx (-> obj actor-group-count)) + (let ((group (-> obj 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) + ) + ) + ) + (when (and fodder-proc + (!= fodder-proc obj) + (>= (- (current-time) (-> fodder-proc look-at-other-time)) (seconds 0.25)) ) - (when (< dir-length 8192.0) - (vector-float*! dir-to-other-fodder dir-to-other-fodder (/ 1.0 dir-length)) - (let ((f30-0 (vector-dot - dir-to-other-fodder - (-> (quaternion->matrix (new 'stack-no-clear 'matrix) (-> obj root-override2 quat)) vector 2) - ) + (let* ((dir-to-other-fodder + (vector-! (new 'stack-no-clear 'vector) (-> fodder-proc root-override2 trans) (-> obj root-override2 trans)) + ) + (dir-length (vector-length dir-to-other-fodder)) + ) + (when (< dir-length 8192.0) + (vector-float*! dir-to-other-fodder dir-to-other-fodder (/ 1.0 dir-length)) + (let ((f30-0 (vector-dot + dir-to-other-fodder + (-> (quaternion->matrix (new 'stack-no-clear 'matrix) (-> obj root-override2 quat)) vector 2) ) - ) - (when (< (cos 14563.556) f30-0) - (let ((channel (ja-channel-float! (the-as art-joint-anim (-> obj draw art-group data 15)) 0.0 0.0 0.0))) - (when channel - (set! (-> obj skel interp-select 0) #xe00010) - (set! (-> obj skel interp-select 1) 0) - (set! (-> channel param 0) 1.0) - (set! (-> channel param 1) 1.0) - (set! (-> channel param 2) 1.0) - (set! (-> channel num-func) num-func-interp1-play!) - ) - ) - (set! (-> obj look-at-other-time) (-> pp clock frame-counter)) - (set! (-> obj look-at-other) (process->handle fodder-proc)) - (set! (-> obj neck-away-from) #f) - (set! (-> fodder-proc look-at-other-time) (-> pp clock frame-counter)) - (set! (-> fodder-proc look-at-other) (process->handle obj)) - (set! (-> fodder-proc neck-away-from) #t) + ) ) + (when (< (cos 14563.556) f30-0) + (let ((channel (ja-channel-float! (the-as art-joint-anim (-> obj draw art-group data 15)) 0.0 0.0 0.0))) + (when channel + (set! (-> obj skel interp-select 0) #xe00010) + (set! (-> obj skel interp-select 1) 0) + (set! (-> channel param 0) 1.0) + (set! (-> channel param 1) 1.0) + (set! (-> channel param 2) 1.0) + (set! (-> channel num-func) num-func-interp1-play!) + ) + ) + (set! (-> obj look-at-other-time) (current-time)) + (set! (-> obj look-at-other) (process->handle fodder-proc)) + (set! (-> obj neck-away-from) #f) + (set! (-> fodder-proc look-at-other-time) (current-time)) + (set! (-> fodder-proc look-at-other) (process->handle obj)) + (set! (-> fodder-proc neck-away-from) #t) ) ) ) @@ -376,8 +374,8 @@ ) ) ) - #f ) + #f ) ) @@ -387,50 +385,48 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (with-pp - (let ((parent-method (method-of-type nav-enemy track-target!))) - (parent-method obj) - ) - (let ((proc (the-as process-drawable #f))) - (cond - ((and (< (- (-> pp clock frame-counter) (-> obj look-at-other-time)) (seconds 0.5)) - (begin - (let ((other-proc (handle->process (-> obj look-at-other)))) - (set! proc (if (type? other-proc process-drawable) - (the-as process-drawable other-proc) - ) - ) - ) - proc + (let ((parent-method (method-of-type nav-enemy track-target!))) + (parent-method obj) + ) + (let ((proc (the-as process-drawable #f))) + (cond + ((and (< (- (current-time) (-> obj look-at-other-time)) (seconds 0.5)) + (begin + (let ((other-proc (handle->process (-> obj look-at-other)))) + (set! proc (if (type? other-proc process-drawable) + (the-as process-drawable other-proc) + ) + ) ) + proc ) - (let ((s5-1 (vector<-cspace! (new 'static 'vector) (-> proc node-list data 5)))) - (look-at-position! obj s5-1) - (cond - ((zero? (-> obj neck)) - ) - ((-> obj neck-away-from) - (let ((s4-0 (new 'static 'vector))) - (let ((v1-11 (vector<-cspace! (new 'static 'vector) (-> obj node-list data 5)))) - (vector-! s4-0 v1-11 s5-1) - (vector+! s4-0 s4-0 v1-11) - ) - (target-set! (-> obj neck) s4-0) + ) + (let ((s5-1 (vector<-cspace! (new 'static 'vector) (-> proc node-list data 5)))) + (look-at-position! obj s5-1) + (cond + ((zero? (-> obj neck)) + ) + ((-> obj neck-away-from) + (let ((s4-0 (new 'static 'vector))) + (let ((v1-11 (vector<-cspace! (new 'static 'vector) (-> obj node-list data 5)))) + (vector-! s4-0 v1-11 s5-1) + (vector+! s4-0 s4-0 v1-11) ) + (target-set! (-> obj neck) s4-0) ) - (else - (target-set! (-> obj neck) s5-1) - ) + ) + (else + (target-set! (-> obj neck) s5-1) ) ) ) - ((logtest? (-> obj enemy-flags) (enemy-flag lock-focus)) - (look-at-position! obj (the-as vector #f)) - ) - ) + ) + ((logtest? (-> obj enemy-flags) (enemy-flag lock-focus)) + (look-at-position! obj (the-as vector #f)) + ) ) - (none) ) + (none) ) ;; failed to figure out what this is: @@ -486,7 +482,7 @@ (set! (-> _self nav callback-info) *nav-enemy-null-callback-info*) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until (not #f) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.25)) @@ -594,7 +590,7 @@ ) (goto cfg-22) ) - (set! s5-0 (- (the-as time-frame s5-0) (- (-> self clock frame-counter) (-> self clock old-frame-counter)))) + (set! s5-0 (- (the-as time-frame s5-0) (- (current-time) (-> self clock old-frame-counter)))) (when (<= s5-0 0) (set! s5-0 (rand-vu-int-range 75 150)) (set! s4-0 (not s4-0)) @@ -733,7 +729,7 @@ (set! (-> v1-22 turning-acceleration) 0.0) ) 0 - (set! (-> self slow-timer) (-> self clock frame-counter)) + (set! (-> self slow-timer) (current-time)) (ja-channel-push! 1 (seconds 0.08)) (ja :group! (-> self draw art-group data (-> self enemy-info-override idle-anim))) (ja :num-func num-func-identity :frame-num 0.0) @@ -753,9 +749,9 @@ ) (when (and (nonzero? (-> self slow-timer)) (zero? (-> self fast-timer)) - (>= (- (-> self clock frame-counter) (-> self slow-timer)) (seconds 0.35)) + (>= (- (current-time) (-> self slow-timer)) (seconds 0.35)) ) - (set! (-> self fast-timer) (-> self clock frame-counter)) + (set! (-> self fast-timer) (current-time)) (ja-channel-push! 1 (seconds 0.02)) (let ((v1-55 (-> self attack-type))) (cond @@ -814,7 +810,7 @@ ) ) (cond - ((>= (- (-> self clock frame-counter) (-> self fast-timer)) v1-82) + ((>= (- (current-time) (-> self fast-timer)) v1-82) (set! (-> self slow-timer) 0) (set! (-> self fast-timer) 0) (let ((v1-83 (-> self nav))) @@ -858,9 +854,7 @@ ) (when (zero? (-> self attack-type)) (let ((f0-20 20480.0)) - (when (and (< f30-0 (* f0-20 f0-20)) - (>= (- (-> self clock frame-counter) (-> self look-at-other-time)) (seconds 0.125)) - ) + (when (and (< f30-0 (* f0-20 f0-20)) (>= (- (current-time) (-> 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) @@ -871,7 +865,7 @@ (set! (-> v1-117 num-func) num-func-interp1-play!) ) ) - (set! (-> self look-at-other-time) (-> self clock frame-counter)) + (set! (-> self look-at-other-time) (current-time)) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/guards/crimson-guard-level_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/guards/crimson-guard-level_REF.gc index 2e389e4043..a2d5024963 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/guards/crimson-guard-level_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/guards/crimson-guard-level_REF.gc @@ -1199,7 +1199,7 @@ (defstate stare (crimson-guard-level) :virtual #t :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((gp-0 (-> self focus aware))) (cond ((>= 1 (the-as int gp-0)) @@ -1697,7 +1697,7 @@ :virtual #t :enter (behavior () (talker-spawn-func (-> *talker-speech* 10) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-4 (logior (-> self enemy-flags) (enemy-flag use-notice-distance)))) (set! (-> self enemy-flags) (logclear v1-4 (enemy-flag called-dying))) ) @@ -1787,7 +1787,7 @@ (t9-0) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (if (logtest? (-> self flags) 4) (go-virtual gun-shoot) ) @@ -1800,7 +1800,7 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (cond ((or (< (the-as int gp-0) 2) (not (get-enemy-target self))) (go-stare self) @@ -1880,7 +1880,7 @@ ) :enter (behavior () ((-> (method-of-type nav-enemy hostile) enter)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self reaction-time) (the-as time-frame (the int (* 300.0 (get-rand-float-range self 0.5 1.5))))) (none) ) @@ -1890,7 +1890,7 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (cond ((or (>= 2 (the-as int gp-0)) (not (get-enemy-target self))) (go-stare self) @@ -1951,7 +1951,7 @@ ) :enter (behavior () ((-> (method-of-type nav-enemy hostile) enter)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-156 self) (none) ) @@ -1961,7 +1961,7 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (cond ((or (< (the-as int gp-0) 2) (not (get-enemy-target self))) (go-stare self) @@ -1995,7 +1995,7 @@ ) (if (and (< (-> self target-self-xz-dist) 327680.0) (crimson-guard-level-method-193 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the int (* 300.0 (rand-vu-float-range 1.0 8.0)))) + (>= (- (current-time) (-> self state-time)) (the int (* 300.0 (rand-vu-float-range 1.0 8.0)))) ) (go-virtual gun-shoot) ) @@ -2034,7 +2034,7 @@ ) :enter (behavior () ((-> (method-of-type nav-enemy hostile) enter)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-156 self) (none) ) @@ -2044,7 +2044,7 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (cond ((or (< (the-as int gp-0) 2) (not (get-enemy-target self))) (go-stare self) @@ -2074,9 +2074,9 @@ ) (else (if (or (and (logtest? (-> self nav state flags) (nav-state-flag at-target)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (>= (- (current-time) (-> self state-time)) (seconds 0.1)) ) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (>= (- (current-time) (-> self state-time)) (seconds 1)) ) (go-virtual grenade-attack) ) @@ -2132,10 +2132,10 @@ (set! (-> a0-9 velocity quad) (-> v1-12 quad)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-time-see-target) (the-as int (-> self clock frame-counter))) + (set! (-> self state-time) (current-time)) + (set! (-> self last-time-see-target) (the-as int (current-time))) (set! (-> self miss-amount) 0.0) - (set! (-> self next-shot) (the-as int (-> self clock frame-counter))) + (set! (-> self next-shot) (the-as int (current-time))) (set! (-> self joint-enable) #t) (set! (-> self reaction-time) (the-as time-frame (the int (* 300.0 (get-rand-float-range self 3.0 5.0))))) (none) @@ -2148,7 +2148,7 @@ :trans (behavior () (crimson-guard-level-method-200 self) (let ((v1-2 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (cond ((< (the-as int v1-2) 2) (go-stare self) @@ -2182,7 +2182,7 @@ ) ) (until #f - (if (or (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (if (or (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (< 10922.667 (fabs (-> self target-y-angle))) ) (goto cfg-13) @@ -2256,14 +2256,14 @@ (set! (-> a0-8 velocity quad) (-> v1-13 quad)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-time-see-target) (the-as int (-> self clock frame-counter))) + (set! (-> self state-time) (current-time)) + (set! (-> self last-time-see-target) (the-as int (current-time))) (crimson-guard-level-method-200 self) (if (logtest? (-> self flags) 4) (set! (-> self miss-amount) 16384.0) (set! (-> self miss-amount) (lerp-scale 0.0 16384.0 (-> self target-self-dist) 40960.0 122880.0)) ) - (set! (-> self next-shot) (the-as int (-> self clock frame-counter))) + (set! (-> self next-shot) (the-as int (current-time))) (set! (-> self joint-enable) #t) (none) ) @@ -2315,7 +2315,7 @@ (set! (-> self start-target-vel quad) (-> (the-as process-drawable v1-31) root transv quad)) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (label cfg-10) (when (crimson-guard-level-method-194 self) (when (or (not (logtest? (-> self flags) 256)) (and (logtest? (-> self flags) 256) (-> self trigger))) @@ -2323,7 +2323,7 @@ (goto cfg-23) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 1)) (set! v1-48 #f) (goto cfg-23) ) @@ -2331,7 +2331,7 @@ (b! (not #f) cfg-10 :delay (set! v1-48 #f)) (label cfg-23) (when v1-48 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 3)) (until #f (ja-channel-push! 1 (seconds 0.1)) @@ -2369,8 +2369,8 @@ (suspend) ) (when (logtest? (-> self flags) 4) - (let ((s5-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-1) (seconds 1)) + (let ((s5-1 (current-time))) + (until (>= (- (current-time) s5-1) (seconds 1)) (suspend) ) ) @@ -2994,8 +2994,8 @@ (suspend) (ja :num! (seek! (ja-aframe 12.0 0))) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (the int (* 900.0 (you-suck-scale *game-info* #f)))) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (the int (* 900.0 (you-suck-scale *game-info* #f)))) (ja-no-eval :group! (-> self draw art-group data 37) :num! (seek! (ja-aframe 12.0 0)) :frame-num (ja-aframe 12.0 0) @@ -3064,8 +3064,8 @@ ) 0 (set! (-> self miss-amount) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self next-shot) (the-as int (-> self clock frame-counter))) + (set! (-> self state-time) (current-time)) + (set! (-> self next-shot) (the-as int (current-time))) (set! (-> self lazer-sound) (new 'static 'sound-id)) 0 (none) @@ -3108,9 +3108,7 @@ ) :trans (behavior () (crimson-guard-level-method-200 self) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) - (< 32768.0 (-> self target-self-xz-dist)) - ) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 1)) (< 32768.0 (-> self target-self-xz-dist))) (go-hostile self) ) (none) @@ -3125,7 +3123,7 @@ ) (until #f (let ((gp-2 #t)) - (while (or (< 5461.3335 (fabs (-> self target-y-angle))) (>= (-> self next-shot) (-> self clock frame-counter))) + (while (or (< 5461.3335 (fabs (-> self target-y-angle))) (>= (-> self next-shot) (current-time))) (when gp-2 (ja-channel-push! 1 (seconds 0.1)) (set! gp-2 #f) @@ -3191,7 +3189,7 @@ (suspend) (ja :num! (seek!)) ) - (set! (-> self next-shot) (the-as int (+ (-> self clock frame-counter) (seconds 1)))) + (set! (-> self next-shot) (the-as int (+ (current-time) (seconds 1)))) (let ((v1-124 (-> (the-as collide-shape-prim-group (-> self root-override2 root-prim)) child 2))) (logior! (-> v1-124 prim-core action) (collide-action deadly)) ) @@ -3220,12 +3218,12 @@ ) (set! (-> v1-127 state mode) (the-as lightning-mode a0-38)) ) - (let ((gp-4 (-> self clock frame-counter)) + (let ((gp-4 (current-time)) (s5-1 150) (f30-0 1.0) ) (ja-no-eval :group! (-> self draw art-group data 22) :num! (loop! f30-0) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-4) s5-1) + (until (>= (- (current-time) gp-4) s5-1) (crimson-guard-level-method-198 self) (suspend) (ja :num! (loop! f30-0)) @@ -3264,7 +3262,7 @@ ) ) (else - (set! (-> self next-shot) (the-as int (+ (-> self clock frame-counter) (seconds 1)))) + (set! (-> self next-shot) (the-as int (+ (current-time) (seconds 1)))) (suspend) 0 ) @@ -3301,7 +3299,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -3369,7 +3367,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -4383,7 +4381,7 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self nav flags) (nav-control-flag output-sphere-hash)) (nav-enemy-method-166 self) (let ((v1-7 (-> self nav))) @@ -4460,18 +4458,15 @@ (while (not (-> self already-shot)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (ja-channel-set! 1) - (let ((gp-0 (-> self clock frame-counter)) + (let ((gp-0 (current-time)) (s5-0 150) (f30-0 2.0) ) (ja-no-eval :group! (-> self draw art-group data 6) :num! (loop! f30-0) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-0) s5-0) - (crimson-guard-level-method-201 - self - (* 0.006666667 (the float (- (-> self clock frame-counter) (-> self state-time)))) - ) + (until (>= (- (current-time) gp-0) s5-0) + (crimson-guard-level-method-201 self (* 0.006666667 (the float (- (current-time) (-> self state-time))))) (suspend) (ja :num! (loop! f30-0)) ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/guards/guard-conversation_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/guards/guard-conversation_REF.gc index 54e03a8641..be374102f8 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/guards/guard-conversation_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/guards/guard-conversation_REF.gc @@ -357,9 +357,9 @@ ) ) ) - (set! (-> self last-playing-time) (-> self clock frame-counter)) + (set! (-> self last-playing-time) (current-time)) ) - (if (and (-> self triggered?) (>= (- (-> self clock frame-counter) (-> self last-playing-time)) (seconds 6))) + (if (and (-> self triggered?) (>= (- (current-time) (-> self last-playing-time)) (seconds 6))) (guard-conversation-method-24 self) ) (none) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/guards/transport-level_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/guards/transport-level_REF.gc index f9d5b71380..72c2cd4ee1 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/guards/transport-level_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/guards/transport-level_REF.gc @@ -132,8 +132,8 @@ :virtual #t :event transport-level-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-guard-spawn-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self last-guard-spawn-time) (current-time)) (none) ) :code (behavior () @@ -167,7 +167,7 @@ :virtual #t :event transport-level-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self root-override transv y) 0.0) (set! (-> self last-guard-spawn-time) 0) 0 @@ -212,16 +212,16 @@ gp-0 ) ) - (set! (-> self leave-time) (+ (-> self clock frame-counter) (seconds 3))) + (set! (-> self leave-time) (+ (current-time) (seconds 3))) ) - (if (and (nonzero? (-> self leave-time)) (< (-> self leave-time) (-> self clock frame-counter))) + (if (and (nonzero? (-> self leave-time)) (< (-> self leave-time) (current-time))) (go-virtual leave) ) (when (and (zero? (-> self leave-time)) (nonzero? (-> self max-guard)) (>= (-> self count-guard) (-> self max-guard)) ) - (set! (-> self leave-time) (+ (-> self clock frame-counter) (seconds 3))) + (set! (-> self leave-time) (+ (current-time) (seconds 3))) (send-event self 'stop-spawning) ) (transport-level-method-34 self) @@ -245,7 +245,7 @@ :virtual #t :event transport-level-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self root-override transv y) 0.0) (none) ) @@ -282,43 +282,41 @@ ;; definition for method 33 of type transport-level ;; INFO: Used lq/sq (defmethod transport-level-method-33 transport-level ((obj transport-level)) - (with-pp - (let ((v1-0 0)) - (dotimes (a0-1 8) - (if (handle->process (-> obj guards a0-1)) - (+! v1-0 1) + (let ((v1-0 0)) + (dotimes (a0-1 8) + (if (handle->process (-> obj guards a0-1)) + (+! v1-0 1) + ) + ) + (when (zero? (-> obj count-guard)) + (set! (-> obj last-guard-spawn-time) 0) + 0 + ) + (when (and (>= (- (current-time) (-> obj last-guard-spawn-time)) (-> obj spawn-time)) + (< v1-0 (the-as int (-> obj num-wanted-guards))) + ) + (let ((s5-0 (new 'stack-no-clear 'crimson-guard-level-params))) + (set! (-> s5-0 transport-side) (-> obj spawn-side)) + (set! (-> s5-0 nav-mesh) (-> obj nav-mesh)) + (set! (-> s5-0 pos quad) (-> obj root-override trans quad)) + (set! (-> s5-0 pos y) (+ 8192.0 (-> s5-0 pos y))) + (quaternion-rotate-local-y! (-> s5-0 quat) (-> obj root-override quat) 32768.0) + (set! (-> s5-0 handle) (the-as uint (process->handle obj))) + (set! (-> s5-0 weapon) 1) + (dotimes (s4-0 (the-as int (-> obj num-wanted-guards))) + (when (not (handle->process (-> obj guards s4-0))) + (set! (-> obj guards s4-0) (ppointer->handle (process-spawn crimson-guard-level s5-0 :to obj))) + #t + (goto cfg-38) ) - ) - (when (zero? (-> obj count-guard)) - (set! (-> obj last-guard-spawn-time) 0) - 0 - ) - (when (and (>= (- (-> pp clock frame-counter) (-> obj last-guard-spawn-time)) (-> obj spawn-time)) - (< v1-0 (the-as int (-> obj num-wanted-guards))) - ) - (let ((s5-0 (new 'stack-no-clear 'crimson-guard-level-params))) - (set! (-> s5-0 transport-side) (-> obj spawn-side)) - (set! (-> s5-0 nav-mesh) (-> obj nav-mesh)) - (set! (-> s5-0 pos quad) (-> obj root-override trans quad)) - (set! (-> s5-0 pos y) (+ 8192.0 (-> s5-0 pos y))) - (quaternion-rotate-local-y! (-> s5-0 quat) (-> obj root-override quat) 32768.0) - (set! (-> s5-0 handle) (the-as uint (process->handle obj))) - (set! (-> s5-0 weapon) 1) - (dotimes (s4-0 (the-as int (-> obj num-wanted-guards))) - (when (not (handle->process (-> obj guards s4-0))) - (set! (-> obj guards s4-0) (ppointer->handle (process-spawn crimson-guard-level s5-0 :to obj))) - #t - (goto cfg-38) - ) - ) - (label cfg-38) - (when (-> s5-0 proc) - (set! (-> obj spawn-side) (- 1 (the-as int (-> obj spawn-side)))) - (set! (-> obj last-guard-spawn-time) (-> pp clock frame-counter)) - (let ((v0-0 (+ (-> obj count-guard) 1))) - (set! (-> obj count-guard) v0-0) - v0-0 - ) + ) + (label cfg-38) + (when (-> s5-0 proc) + (set! (-> obj spawn-side) (- 1 (the-as int (-> obj spawn-side)))) + (set! (-> obj last-guard-spawn-time) (current-time)) + (let ((v0-0 (+ (-> obj count-guard) 1))) + (set! (-> obj count-guard) v0-0) + v0-0 ) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hopper_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hopper_REF.gc index c2a0478a15..28fe5de81c 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hopper_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hopper_REF.gc @@ -727,7 +727,7 @@ 0 (set! (-> self speed-y) 0.0) (set! (-> self accel-y) 0.0) - (set! (-> self next-jump-time) (the-as int (+ (-> self clock frame-counter) (get-rand-int-range self 0 120)))) + (set! (-> self next-jump-time) (the-as int (+ (current-time) (get-rand-int-range self 0 120)))) (set! (-> self step-num) 0) (set! (-> self best-score) -2.0) (none) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hover/crimson-guard-hover_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hover/crimson-guard-hover_REF.gc index 5d9f375e03..31de6eeb79 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hover/crimson-guard-hover_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hover/crimson-guard-hover_REF.gc @@ -681,9 +681,7 @@ (t9-0) ) ) - (set! (-> self last-fire-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (get-rand-float-range self 2.0 3.0)))) - ) + (set! (-> self last-fire-time) (+ (current-time) (the int (* 300.0 (get-rand-float-range self 2.0 3.0))))) (go-virtual ambush-fly) (none) ) @@ -766,7 +764,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self attack-miss-dist-curr) (-> self attack-miss-dist-min)) (let ((f0-1 (vector-vector-distance-squared (-> self root-override2 trans) (-> self focus-pos))) (f1-0 122880.0) @@ -780,7 +778,7 @@ (none) ) :exit (behavior () - (set! (-> self last-fire-time) (-> self clock frame-counter)) + (set! (-> self last-fire-time) (current-time)) (set! (-> self restart-fly-anims) #t) (none) ) @@ -845,7 +843,7 @@ ) ) (talker-spawn-func (-> *talker-speech* 10) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self last-fire-time) (+ (-> self clock frame-counter) (seconds -1.5))) + (set! (-> self last-fire-time) (+ (current-time) (seconds -1.5))) (none) ) ) @@ -883,11 +881,11 @@ enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + (if (>= (- (current-time) (-> self state-time)) (seconds 4)) (go-hostile self) ) (none) @@ -965,14 +963,14 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self attack-miss-dist-curr) (-> self attack-miss-dist-min)) (set! (-> self shots-fired) 0) 0 (none) ) :exit (behavior () - (set! (-> self last-fire-time) (-> self clock frame-counter)) + (set! (-> self last-fire-time) (current-time)) (set! (-> self restart-fly-anims) #t) (none) ) @@ -1113,8 +1111,8 @@ 0 (set! (-> self hit-points) 0) (do-effect (-> self skel effect) 'death-default 0.0 -1) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -1357,35 +1355,33 @@ ;; definition for method 162 of type crimson-guard-hover ;; WARN: Return type mismatch object vs symbol. (defmethod crimson-guard-hover-method-162 crimson-guard-hover ((obj crimson-guard-hover) (arg0 process-focusable)) - (with-pp - (let* ((v1-1 (vector+! (new 'stack-no-clear 'vector) (-> obj root-override2 trans) (-> obj root-override2 transv))) - (s5-1 (vector-! (new 'stack-no-clear 'vector) v1-1 (-> obj focus-pos))) - (f30-0 (vector-length s5-1)) - (a0-4 (if arg0 - arg0 - (handle->process (-> obj focus handle)) - ) - ) - ) - (the-as - symbol - (when a0-4 - (let ((s4-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable a0-4) 0))) - (s5-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s5-1 1.0)) - ) - (and (< 0.0 (vector-dot s4-1 s5-2)) - (and (>= (- (-> pp clock frame-counter) (-> obj last-fire-time)) - (the int (* 300.0 (rand-vu-float-range (-> obj attack-wait-min) (-> obj attack-wait-max)))) - ) - (get-enemy-target obj) - (< f30-0 225280.0) - (and (< (fabs (vector-x-angle s5-2)) 3640.889) - (enemy-method-95 obj (-> obj focus-pos) 5461.3335) - (check-los? (-> obj los) (seconds 0.4)) - ) - ) - ) - ) + (let* ((v1-1 (vector+! (new 'stack-no-clear 'vector) (-> obj root-override2 trans) (-> obj root-override2 transv))) + (s5-1 (vector-! (new 'stack-no-clear 'vector) v1-1 (-> obj focus-pos))) + (f30-0 (vector-length s5-1)) + (a0-4 (if arg0 + arg0 + (handle->process (-> obj focus handle)) + ) + ) + ) + (the-as + symbol + (when a0-4 + (let ((s4-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat (the-as process-focusable a0-4) 0))) + (s5-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s5-1 1.0)) + ) + (and (< 0.0 (vector-dot s4-1 s5-2)) + (and (>= (- (current-time) (-> obj last-fire-time)) + (the int (* 300.0 (rand-vu-float-range (-> obj attack-wait-min) (-> obj attack-wait-max)))) + ) + (get-enemy-target obj) + (< f30-0 225280.0) + (and (< (fabs (vector-x-angle s5-2)) 3640.889) + (enemy-method-95 obj (-> obj focus-pos) 5461.3335) + (check-los? (-> obj los) (seconds 0.4)) + ) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hover/flamer_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hover/flamer_REF.gc index 34b9d5c1d6..31a5834df9 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hover/flamer_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hover/flamer_REF.gc @@ -429,7 +429,7 @@ ) ) ) - (let* ((v1-30 (+ (-> pp clock frame-counter) (the-as time-frame (-> obj sync-off)))) + (let* ((v1-30 (+ (current-time) (the-as time-frame (-> obj sync-off)))) (f0-5 (+ (-> arg0 x) (* 614.4 (cos (* 54.613335 (the float (mod v1-30 1200))))))) ) (set! (-> arg0 x) f0-5) @@ -488,13 +488,13 @@ ;; definition for function flamer-flit-post (defbehavior flamer-flit-post flamer () - (when (>= (- (-> self clock frame-counter) (-> self flit-timer)) (rand-vu-int-range (seconds 1.2) (seconds 3))) + (when (>= (- (current-time) (-> self flit-timer)) (rand-vu-int-range (seconds 1.2) (seconds 3))) (set! (-> self flit-angle) (the float (sar (shl (the int (+ (-> self flit-angle) (* 182.04445 (rand-vu-float-range 160.0 200.0)))) 48) 48) ) ) - (set! (-> self flit-timer) (-> self clock frame-counter)) + (set! (-> self flit-timer) (current-time)) ) (flamer-attack-post) (none) @@ -793,7 +793,7 @@ ) ) ) - (let ((v1-16 (+ (-> pp clock frame-counter) (the-as time-frame (-> obj sync-off))))) + (let ((v1-16 (+ (current-time) (the-as time-frame (-> obj sync-off))))) (seek! (-> obj root-override2 trans y) (+ (-> obj base-pos y) (* 1228.8 (cos (* 100.66974 (the float (mod v1-16 651)))))) @@ -869,9 +869,7 @@ (none) ) :trans (behavior () - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) - (flamer-method-183 self) - ) + (when (and (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (flamer-method-183 self)) (if (logtest? (enemy-option ambush) (-> self fact-info-override enemy-options)) (go-virtual ambush) (go-virtual active) @@ -961,7 +959,7 @@ (vector-reset! (-> self fly-dir)) (sound-play "flamer-ambush") (quaternion-copy! (-> self root-override2 quat) (-> self init-quat)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -973,7 +971,7 @@ (logior! (-> self mask) (process-mask actor-pause)) (logior! (-> self enemy-flags) (enemy-flag notice)) (set! (-> self flit-joint twist-min-y) (the-as float #t)) - (set! (-> self last-fire-time) (+ (-> self clock frame-counter) (seconds -1.5))) + (set! (-> self last-fire-time) (+ (current-time) (seconds -1.5))) (none) ) :trans (behavior () @@ -1066,7 +1064,7 @@ (set! (-> v1-3 enemy-flags) (the-as enemy-flag (logclear (-> v1-3 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -1100,9 +1098,9 @@ :code (the-as (function none :behavior flamer) flamer-fly-code) :post (behavior () (flamer-method-187 self) - (when (>= (- (-> self clock frame-counter) (-> self flit-timer)) (rand-vu-int-range (seconds 1.2) (seconds 3))) + (when (>= (- (current-time) (-> self flit-timer)) (rand-vu-int-range (seconds 1.2) (seconds 3))) (set! (-> self flit-angle) (* 182.04445 (rand-vu-float-range 0.0 360.0))) - (set! (-> self flit-timer) (-> self clock frame-counter)) + (set! (-> self flit-timer) (current-time)) ) (vector-seek! (-> self root-override2 trans) (-> self base-pos) (* 16384.0 (-> self clock seconds-per-frame))) (flamer-method-184 self) @@ -1144,7 +1142,7 @@ ) (flamer-method-189 self) (set! (-> self ground-mode) 0) - (set! (-> self flit-timer) (+ (-> self clock frame-counter) (seconds -3))) + (set! (-> self flit-timer) (+ (current-time) (seconds -3))) (none) ) :trans (behavior () @@ -1163,9 +1161,7 @@ ) (let ((gp-1 (get-enemy-target self))) (if (and gp-1 - (>= (- (-> self clock frame-counter) (-> self last-fire-time)) - (the int (* 300.0 (rand-vu-float-range 3.0 6.0))) - ) + (>= (- (current-time) (-> self last-fire-time)) (the int (* 300.0 (rand-vu-float-range 3.0 6.0)))) (< (vector-vector-distance (get-trans gp-1 3) (-> self root-override2 trans)) 245760.0) ) (go-virtual attack) @@ -1226,7 +1222,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :code (behavior () @@ -1253,7 +1249,7 @@ ) ) ) - (set! (-> self last-fire-time) (-> self clock frame-counter)) + (set! (-> self last-fire-time) (current-time)) (go-virtual hostile) (none) ) @@ -1383,7 +1379,7 @@ ) (when (and (nonzero? (-> self hit-points)) (zero? (-> self fated-time)) - (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (or (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (and (< (-> self root-override2 trans y) (+ 18432.0 (-> self root-override2 gspot-pos y))) (< (-> self root-override2 transv y) 0.0) ) @@ -1647,7 +1643,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy-battle_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy-battle_REF.gc index 992b1161a1..06cb438c54 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy-battle_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy-battle_REF.gc @@ -161,11 +161,9 @@ a0-0 ) ) - (when (and (logtest? (-> gp-0 flags) 2) - (>= (- (-> self clock frame-counter) (-> self formation-timer)) (seconds 0.2)) - ) + (when (and (logtest? (-> gp-0 flags) 2) (>= (- (current-time) (-> self formation-timer)) (seconds 0.2))) (hover-formation-control-method-11 gp-0) - (set! (-> self formation-timer) (-> self clock frame-counter)) + (set! (-> self formation-timer) (current-time)) ) ) ) @@ -223,8 +221,8 @@ (('wait) ) ) - (let ((s4-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-0) (-> gp-0 s5-0 time)) + (let ((s4-0 (current-time))) + (until (>= (- (current-time) s4-0) (-> gp-0 s5-0 time)) (suspend) ) ) @@ -233,8 +231,8 @@ ) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 2)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 2)) (suspend) ) ) @@ -314,41 +312,39 @@ (defmethod hover-enemy-manager-init! hover-enemy-manager ((obj hover-enemy-manager) (arg0 (array hover-enemy-battle-command))) "Initialize this [[hover-enemy-manager]]." (local-vars (sv-16 res-tag)) - (with-pp - (set! (-> obj command-table) arg0) - (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) - (logior! (-> obj 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 (-> obj entity) 'actor-groups pointer :tag-ptr (& sv-16)))) - (cond - ((and v1-5 (nonzero? (-> sv-16 elt-count))) - (set! (-> obj actor-group) (the-as (pointer actor-group) v1-5)) - (set! (-> obj actor-group-count) (the-as int (-> sv-16 elt-count))) - ) - (else - (set! (-> obj actor-group) (the-as (pointer actor-group) #f)) - (set! (-> obj actor-group-count) 0) - 0 - ) + (set! (-> obj command-table) arg0) + (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) + (logior! (-> obj 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 (-> obj entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (cond + ((and v1-5 (nonzero? (-> sv-16 elt-count))) + (set! (-> obj actor-group) (the-as (pointer actor-group) v1-5)) + (set! (-> obj actor-group-count) (the-as int (-> sv-16 elt-count))) + ) + (else + (set! (-> obj actor-group) (the-as (pointer actor-group) #f)) + (set! (-> obj actor-group-count) 0) + 0 ) ) - (set! (-> obj total-to-spawn) 0) - (set! (-> obj num-spawned) 0) - (when (-> obj command-table) - (let ((v1-13 (-> obj command-table))) - (dotimes (a0-6 (-> v1-13 length)) - (if (= (-> v1-13 a0-6 command) 'spawn) - (+! (-> obj total-to-spawn) (-> obj actor-group (-> v1-13 a0-6 wave) length)) - ) - ) - ) - ) - (set! (-> obj formation) #f) - (set! (-> obj formation-timer) (-> pp clock frame-counter)) - (set! (-> obj alive-count) 0) - 0 - (none) ) + (set! (-> obj total-to-spawn) 0) + (set! (-> obj num-spawned) 0) + (when (-> obj command-table) + (let ((v1-13 (-> obj command-table))) + (dotimes (a0-6 (-> v1-13 length)) + (if (= (-> v1-13 a0-6 command) 'spawn) + (+! (-> obj total-to-spawn) (-> obj actor-group (-> v1-13 a0-6 wave) length)) + ) + ) + ) + ) + (set! (-> obj formation) #f) + (set! (-> obj formation-timer) (current-time)) + (set! (-> obj alive-count) 0) + 0 + (none) ) ;; definition for function hover-enemy-manager-init-by-other @@ -365,7 +361,3 @@ (defun hover-manager-spawn ((arg0 turret) (arg1 entity-actor) (arg2 (array hover-enemy-battle-command))) (the-as process (ppointer->process (process-spawn hover-enemy-manager arg1 arg2 :to arg0))) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy_REF.gc index 8e201a26e6..8be9d57e87 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy_REF.gc @@ -474,7 +474,7 @@ (if (logtest? (-> self path flags) (path-control-flag not-found)) (go process-drawable-art-error "no path") ) - (set! (-> self scale-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self scale-timer) (the-as uint (current-time))) (cond ((not (logtest? (-> self fact-info-override enemy-options) (enemy-option user0))) (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) @@ -530,7 +530,7 @@ ) (hover-enemy-method-144 self) (hover-nav-control-method-18 (-> self hover) (-> self path) -1 -1) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -561,7 +561,7 @@ :post (behavior () (local-vars (v1-19 enemy-flag)) (when (not (logtest? (-> self fact-info-override enemy-options) (enemy-option user0))) - (let ((f0-1 (the float (- (-> self clock frame-counter) (the-as int (-> self scale-timer))))) + (let ((f0-1 (the float (- (current-time) (the-as int (-> self scale-timer))))) (f1-0 1200.0) ) (when (< f0-1 f1-0) @@ -671,7 +671,7 @@ ) (if (and (nonzero? (-> self hit-points)) (zero? (-> self fated-time)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (< (-> self root-override2 trans y) (- (-> self knocked-start-level) (-> self knocked-fall-dist))) ) (go-virtual knocked-recover) @@ -742,14 +742,14 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('touch 'touched 'attack) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (go-virtual flying-death-explode) ) ) ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (dispose! self) (stop-looking-at-target! self) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) @@ -801,14 +801,14 @@ (set! (-> self hover speed) 0.2) (set! (-> self flying-death-spin) 0.0) (enemy-method-103 self) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (if (or (logtest? (-> self root-override2 status) (collide-status touch-surface touch-wall touch-ceiling touch-actor impact-surface touch-background) ) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + (>= (- (current-time) (-> self state-time)) (seconds 4)) ) (go-virtual flying-death-explode) ) @@ -1109,7 +1109,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-formation_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-formation_REF.gc index d64008c87b..a2feb5fcc3 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-formation_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-formation_REF.gc @@ -680,10 +680,10 @@ (set-anchor-proc (-> self formation) (process->handle *target*)) (hover-formation-control-method-14 (-> self formation)) (when (and (logtest? (-> self formation flags) 2) - (>= (- (-> self clock frame-counter) (the-as int (-> self formation-timer))) (seconds 0.2)) + (>= (- (current-time) (the-as int (-> self formation-timer))) (seconds 0.2)) ) (hover-formation-control-method-11 (-> self formation)) - (set! (-> self formation-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self formation-timer) (the-as uint (current-time))) ) (if (not (logtest? (-> self path flags) (path-control-flag not-found))) (debug-draw (-> self path)) @@ -720,51 +720,49 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (local-vars (sv-32 structure)) - (with-pp - (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) - (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) - (let* ((s5-0 (method-of-type hover-formation-control new)) - (s4-0 'process) - (s3-0 hover-formation-control) - (s2-0 obj) - (v0-1 (entity-actor-lookup (-> obj entity) 'alt-actor 0)) - (s1-0 (if v0-1 - v0-1 - (-> obj entity) - ) - ) - (s0-0 (res-lump-float (-> obj entity) 'notice-dist :default 225280.0)) - ) - (let ((t9-3 (method-of-type res-lump get-property-struct)) - (a0-5 (-> obj 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! 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 (-> obj entity) 'rotoffset :default 5461.3335)) - (t3-0 #f) - ) - (set! (-> obj 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! (-> obj formation-timer) (the-as uint (-> pp clock frame-counter))) - (logclear! (-> obj mask) (process-mask actor-pause)) - (let ((t9-6 process-entity-status!) - (a0-9 obj) - (a1-7 8) - (a2-6 #t) + (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) + (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) + (let* ((s5-0 (method-of-type hover-formation-control new)) + (s4-0 'process) + (s3-0 hover-formation-control) + (s2-0 obj) + (v0-1 (entity-actor-lookup (-> obj entity) 'alt-actor 0)) + (s1-0 (if v0-1 + v0-1 + (-> obj entity) + ) + ) + (s0-0 (res-lump-float (-> obj entity) 'notice-dist :default 225280.0)) + ) + (let ((t9-3 (method-of-type res-lump get-property-struct)) + (a0-5 (-> obj entity)) + (a1-4 'trans-offset) + (a2-3 'interp) + (a3-2 -1000000000.0) + (t0-2 (new 'stack-no-clear 'vector)) ) - (t9-6 a0-9 (the-as entity-perm-status a1-7) a2-6) - (hover-formation-method-15 obj (the-as vector a1-7) (the-as vector a2-6)) + (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 (-> obj entity) 'rotoffset :default 5461.3335)) + (t3-0 #f) + ) + (set! (-> obj 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))) ) - (go (method-of-object obj idle)) - (none) ) + (set! (-> obj formation-timer) (the-as uint (current-time))) + (logclear! (-> obj mask) (process-mask actor-pause)) + (let ((t9-6 process-entity-status!) + (a0-9 obj) + (a1-7 8) + (a2-6 #t) + ) + (t9-6 a0-9 (the-as entity-perm-status a1-7) a2-6) + (hover-formation-method-15 obj (the-as vector a1-7) (the-as vector a2-6)) + ) + (go (method-of-object obj idle)) + (none) ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-nav-control_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-nav-control_REF.gc index ccac14e1a8..e1a1fdc440 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-nav-control_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-nav-control_REF.gc @@ -875,7 +875,7 @@ (while v1-0 (let ((a0-2 (-> v1-0 next))) (set! (-> (the-as hover-nav-sphere v1-0) timer) - (- (-> (the-as hover-nav-sphere v1-0) timer) (- (-> pp clock frame-counter) (-> pp clock old-frame-counter))) + (- (-> (the-as hover-nav-sphere v1-0) timer) (- (current-time) (-> pp clock old-frame-counter))) ) (when (<= (-> (the-as hover-nav-sphere v1-0) timer) 0) (let ((a1-4 v1-0)) @@ -1367,48 +1367,46 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod hover-nav-control-method-24 hover-nav-control ((obj hover-nav-control)) - (with-pp - (when (not (logtest? (-> obj flags) 1)) - (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (-> obj params) - (let ((v1-5 (hover-nav-control-method-17 obj)) - (s4-0 (-> obj root transv)) - ) - (when (< 0.0 (vector-length s4-0)) - (set! (-> s5-0 start-pos quad) (-> v1-5 world-sphere quad)) - (set! (-> s5-0 move-dist quad) (-> s4-0 quad)) - (let ((f0-1 (vector-length (-> s5-0 move-dist)))) - (if (< 40960.0 f0-1) - (vector-float*! (-> s5-0 move-dist) (-> s5-0 move-dist) (/ 40960.0 f0-1)) - ) - ) - (let ((a0-14 s5-0)) - (set! (-> a0-14 radius) (-> v1-5 world-sphere w)) - (set! (-> a0-14 collide-with) (-> obj root root-prim prim-core collide-with)) - (set! (-> a0-14 ignore-process0) (-> obj root process)) - (set! (-> a0-14 ignore-process1) #f) - (set! (-> a0-14 ignore-pat) (-> obj root pat-ignore-mask)) - (set! (-> a0-14 action-mask) (collide-action solid)) - ) - (let ((f0-4 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) - (cond - ((>= f0-4 0.0) - (set! (-> obj los-obstruction-distance) (* f0-4 (vector-length s4-0))) - (logior! (-> obj flags) 2) - ) - (else - (set! (-> obj los-last-clear-time) (-> pp clock frame-counter)) - (set! (-> obj flags) (logand -3 (-> obj flags))) - ) + (when (not (logtest? (-> obj flags) 1)) + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (-> obj params) + (let ((v1-5 (hover-nav-control-method-17 obj)) + (s4-0 (-> obj root transv)) + ) + (when (< 0.0 (vector-length s4-0)) + (set! (-> s5-0 start-pos quad) (-> v1-5 world-sphere quad)) + (set! (-> s5-0 move-dist quad) (-> s4-0 quad)) + (let ((f0-1 (vector-length (-> s5-0 move-dist)))) + (if (< 40960.0 f0-1) + (vector-float*! (-> s5-0 move-dist) (-> s5-0 move-dist) (/ 40960.0 f0-1)) + ) + ) + (let ((a0-14 s5-0)) + (set! (-> a0-14 radius) (-> v1-5 world-sphere w)) + (set! (-> a0-14 collide-with) (-> obj root root-prim prim-core collide-with)) + (set! (-> a0-14 ignore-process0) (-> obj root process)) + (set! (-> a0-14 ignore-process1) #f) + (set! (-> a0-14 ignore-pat) (-> obj root pat-ignore-mask)) + (set! (-> a0-14 action-mask) (collide-action solid)) + ) + (let ((f0-4 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) + (cond + ((>= f0-4 0.0) + (set! (-> obj los-obstruction-distance) (* f0-4 (vector-length s4-0))) + (logior! (-> obj flags) 2) + ) + (else + (set! (-> obj los-last-clear-time) (current-time)) + (set! (-> obj flags) (logand -3 (-> obj flags))) ) ) ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 11 of type hover-nav-control @@ -1434,21 +1432,19 @@ (when (not (logtest? (-> obj flags) 1)) (cond ((and arg0 (and (< (vector-vector-distance arg0 (-> obj root trans)) 40960.0) - (>= (-> obj los-last-clear-time) (+ (-> pp clock frame-counter) (seconds -0.2))) + (>= (-> obj los-last-clear-time) (+ (current-time) (seconds -0.2))) ) ) (if (not (and (-> obj path-info curr-segment) (< (-> obj path-info curr-u) 1.0))) (hover-nav-control-method-21 obj) ) ) - ((or (>= (- (-> pp clock frame-counter) (-> obj los-last-clear-time)) (seconds 1)) - (not (-> obj path-info curr-segment)) - ) + ((or (>= (- (current-time) (-> obj los-last-clear-time)) (seconds 1)) (not (-> obj path-info curr-segment))) (hover-nav-control-method-21 obj) (when arg0 (let ((s4-0 (new 'stack-no-clear 'vector))) (set! (-> s4-0 quad) (-> obj root transv quad)) - (if (>= (- (-> pp clock frame-counter) (-> obj los-last-clear-time)) (seconds 1)) + (if (>= (- (current-time) (-> obj los-last-clear-time)) (seconds 1)) (vector-normalize! s4-0 (fmin (vector-length s4-0) (-> obj los-obstruction-distance))) ) (hover-nav-control-method-28 @@ -1816,39 +1812,33 @@ ;; definition for method 0 of type hover-nav-control ;; INFO: Used lq/sq (defmethod new hover-nav-control ((allocation symbol) (type-to-make type) (arg0 process) (arg1 collide-shape-moving) (arg2 hover-nav-params)) - (with-pp - (let ((s5-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) - (set! (-> s5-0 root) arg1) - (set! (-> s5-0 root reaction) hover-bounce-reaction) - (set! (-> s5-0 nav) *nav-network*) - (set! (-> s5-0 path-info segment-list) #f) - (set! (-> s5-0 path-info tail-segment) #f) - (set! (-> s5-0 path-info curr-segment) #f) - (set! (-> s5-0 path-info curr-u) 0.0) - (set! (-> s5-0 flags) (the-as uint 0)) - (set! (-> s5-0 params) arg2) - (set! *hover-nav-time-offset* (+ *hover-nav-time-offset* 1)) - (vector-reset! (-> s5-0 dest-pos)) - (set! (-> s5-0 dest-vel quad) (the-as uint128 0)) - (set! (-> s5-0 dest-move-dir quad) (the-as uint128 0)) - (set! (-> s5-0 dest-offset quad) (the-as uint128 0)) - (set! (-> s5-0 nav-collide-impulse quad) (the-as uint128 0)) - (vector-z-quaternion! (-> s5-0 move-dir) (-> s5-0 root quat)) - (set! (-> s5-0 nav-collide-impulse-len) 0.0) - (set! (-> s5-0 speed) 0.0) - (set! (-> s5-0 target-speed) 0.0) - (set! (-> s5-0 target-acceleration) 0.0) - (set! (-> s5-0 speed-dest) 0.0) - (set! (-> s5-0 curr-dest-pt) -1) - (set! (-> s5-0 los-obstruction-distance) 0.0) - (set! (-> s5-0 los-last-clear-time) (-> pp clock frame-counter)) - (hover-nav-control-method-14 s5-0 1.0 1.0) - (nav-network-method-25 (-> s5-0 nav) arg0 (the-as collide-prim-core #f)) - s5-0 - ) + (let ((s5-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> s5-0 root) arg1) + (set! (-> s5-0 root reaction) hover-bounce-reaction) + (set! (-> s5-0 nav) *nav-network*) + (set! (-> s5-0 path-info segment-list) #f) + (set! (-> s5-0 path-info tail-segment) #f) + (set! (-> s5-0 path-info curr-segment) #f) + (set! (-> s5-0 path-info curr-u) 0.0) + (set! (-> s5-0 flags) (the-as uint 0)) + (set! (-> s5-0 params) arg2) + (set! *hover-nav-time-offset* (+ *hover-nav-time-offset* 1)) + (vector-reset! (-> s5-0 dest-pos)) + (set! (-> s5-0 dest-vel quad) (the-as uint128 0)) + (set! (-> s5-0 dest-move-dir quad) (the-as uint128 0)) + (set! (-> s5-0 dest-offset quad) (the-as uint128 0)) + (set! (-> s5-0 nav-collide-impulse quad) (the-as uint128 0)) + (vector-z-quaternion! (-> s5-0 move-dir) (-> s5-0 root quat)) + (set! (-> s5-0 nav-collide-impulse-len) 0.0) + (set! (-> s5-0 speed) 0.0) + (set! (-> s5-0 target-speed) 0.0) + (set! (-> s5-0 target-acceleration) 0.0) + (set! (-> s5-0 speed-dest) 0.0) + (set! (-> s5-0 curr-dest-pt) -1) + (set! (-> s5-0 los-obstruction-distance) 0.0) + (set! (-> s5-0 los-last-clear-time) (current-time)) + (hover-nav-control-method-14 s5-0 1.0 1.0) + (nav-network-method-25 (-> s5-0 nav) arg0 (the-as collide-prim-core #f)) + s5-0 ) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hover/wasp_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hover/wasp_REF.gc index 38493f646a..d3b2d7fb82 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hover/wasp_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hover/wasp_REF.gc @@ -625,7 +625,7 @@ ((the-as (function none) t9-0)) ) ) - (set! (-> self last-fire-time) (+ (-> self clock frame-counter) (seconds -1.5))) + (set! (-> self last-fire-time) (+ (current-time) (seconds -1.5))) (none) ) ) @@ -639,7 +639,7 @@ ((the-as (function none) t9-0)) ) ) - (set! (-> self last-fire-time) (+ (-> self clock frame-counter) (seconds -1.5))) + (set! (-> self last-fire-time) (+ (current-time) (seconds -1.5))) (none) ) ) @@ -672,7 +672,7 @@ ) (hover-enemy-method-146 self) (hover-nav-control-method-18 (-> self hover) (-> self path) -1 6) - (set! (-> self last-fire-time) (-> self clock frame-counter)) + (set! (-> self last-fire-time) (current-time)) (set! (-> self bridge-index) 0) (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) (logclear! (-> self mask) (process-mask collectable)) @@ -819,7 +819,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self attack-miss-dist-curr) (-> self attack-miss-dist-min)) (none) ) @@ -840,7 +840,7 @@ (suspend) (ja :num! (seek!)) ) - (set! (-> self last-fire-time) (-> self clock frame-counter)) + (set! (-> self last-fire-time) (current-time)) (set! (-> self restart-fly-anims) #t) (go-virtual shoot-bridge-hostile) (none) @@ -896,7 +896,7 @@ (the-as vector #t) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -939,7 +939,7 @@ ) ) ) - (if (and (>= (- (-> self clock frame-counter) (-> self last-fire-time)) + (if (and (>= (- (current-time) (-> self last-fire-time)) (the int (* 300.0 (rand-vu-float-range (-> self attack-wait-min) (-> self attack-wait-max)))) ) (get-enemy-target self) @@ -983,7 +983,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self attack-miss-dist-curr) (-> self attack-miss-dist-min)) (none) ) @@ -1004,7 +1004,7 @@ (suspend) (ja :num! (seek!)) ) - (set! (-> self last-fire-time) (-> self clock frame-counter)) + (set! (-> self last-fire-time) (current-time)) (set! (-> self restart-fly-anims) #t) (go-hostile self) (none) @@ -1161,8 +1161,8 @@ 0 (set! (-> self hit-points) 0) (do-effect (-> self skel effect) 'death-default 0.0 -1) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/metalhead_bearer/centurion_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/metalhead_bearer/centurion_REF.gc index 340d606d0d..d9b072071e 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/metalhead_bearer/centurion_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/metalhead_bearer/centurion_REF.gc @@ -570,7 +570,7 @@ (talker-spawn-func (-> *talker-speech* 58) *entity-pool* (target-pos 0) (the-as region #f)) ) (set! (-> *part-id-table* 2102 init-specs 13 initial-valuef) 255.0) - (set! (-> obj state-time) (-> pp clock frame-counter)) + (set! (-> obj state-time) (current-time)) 'back ) ) @@ -1261,7 +1261,7 @@ (t9-0) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-165 self) (set! (-> self joint-enable) #t) (set! (-> self can-shoot?) (the-as basic #t)) @@ -1317,14 +1317,14 @@ (else (when (-> self can-shoot?) (if (and (get-enemy-target self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the int (+ 60.0 (* 0.0036621094 f30-0)))) + (>= (- (current-time) (-> self state-time)) (the int (+ 60.0 (* 0.0036621094 f30-0)))) (check-los? (-> self los) 0) ) (go-virtual fire) ) ) (if (skip-check-los? (-> self los) 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ) ) @@ -1432,7 +1432,7 @@ ) ) ) - (+ (-> self clock frame-counter) (seconds 3)) + (+ (current-time) (seconds 3)) ) #f ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/metalhead_brown/metalmonk_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/metalhead_brown/metalmonk_REF.gc index 9dd2be5c8e..0879834144 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/metalhead_brown/metalmonk_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/metalhead_brown/metalmonk_REF.gc @@ -316,116 +316,112 @@ ;; definition for method 181 of type metalmonk ;; WARN: Return type mismatch int vs none. (defmethod metalmonk-method-181 metalmonk ((obj metalmonk) (arg0 float) (arg1 float)) - (with-pp - (let ((f28-0 (vector-dot (-> obj new-facing) (-> obj old-facing))) - (f30-1 (/ (ja-frame-num 0) (the float (ja-num-frames 0)))) - ) - (when (and (< f28-0 (cos (* 182.04445 arg0))) (let ((v1-7 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) - ) - (not (and v1-7 (= v1-7 (-> obj draw art-group data 13)))) - ) - ) - (ja-channel-push! 1 (seconds 0.16)) - (let ((v1-13 (-> obj skel root-channel 0))) - (set! (-> v1-13 frame-group) (the-as art-joint-anim (-> obj draw art-group data 13))) - ) - (let ((s4-1 (-> obj skel root-channel 0))) - (set! (-> s4-1 num-func) num-func-identity) - (set! (-> s4-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) - ) - (set! (-> obj high-time) (-> pp clock frame-counter)) + (let ((f28-0 (vector-dot (-> obj new-facing) (-> obj old-facing))) + (f30-1 (/ (ja-frame-num 0) (the float (ja-num-frames 0)))) ) - (let ((v1-22 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) + (when (and (< f28-0 (cos (* 182.04445 arg0))) (let ((v1-7 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (not (and v1-7 (= v1-7 (-> obj draw art-group data 13)))) + ) + ) + (ja-channel-push! 1 (seconds 0.16)) + (let ((v1-13 (-> obj skel root-channel 0))) + (set! (-> v1-13 frame-group) (the-as art-joint-anim (-> obj draw art-group data 13))) + ) + (let ((s4-1 (-> obj skel root-channel 0))) + (set! (-> s4-1 num-func) num-func-identity) + (set! (-> s4-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) + ) + (set! (-> obj high-time) (current-time)) + ) + (let ((v1-22 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (when (or (not (and v1-22 (or (= v1-22 (-> obj draw art-group data 12)) (= v1-22 (-> obj draw art-group data 13))))) + (let ((v1-28 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (and (and v1-28 (= v1-28 (-> obj draw art-group data 13))) + (< (ja-frame-num 0) 3.0) + (and (< (cos (* 182.04445 arg1)) f28-0) (>= (- (current-time) (-> obj high-time)) (seconds 1))) ) - ) - ) - (when (or (not (and v1-22 (or (= v1-22 (-> obj draw art-group data 12)) (= v1-22 (-> obj draw art-group data 13))))) - (let ((v1-28 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) - ) - (and (and v1-28 (= v1-28 (-> obj draw art-group data 13))) - (< (ja-frame-num 0) 3.0) - (and (< (cos (* 182.04445 arg1)) f28-0) (>= (- (-> pp clock frame-counter) (-> obj high-time)) (seconds 1))) - ) - ) ) - (ja-channel-push! 1 (seconds 0.16)) - (let ((v1-41 (-> obj skel root-channel 0))) - (set! (-> v1-41 frame-group) (the-as art-joint-anim (-> obj draw art-group data 12))) - ) - (let ((gp-1 (-> obj skel root-channel 0))) - (set! (-> gp-1 num-func) num-func-identity) - (set! (-> gp-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) - ) + ) + (ja-channel-push! 1 (seconds 0.16)) + (let ((v1-41 (-> obj skel root-channel 0))) + (set! (-> v1-41 frame-group) (the-as art-joint-anim (-> obj draw art-group data 12))) + ) + (let ((gp-1 (-> obj skel root-channel 0))) + (set! (-> gp-1 num-func) num-func-identity) + (set! (-> gp-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 182 of type metalmonk ;; WARN: Return type mismatch int vs none. (defmethod metalmonk-method-182 metalmonk ((obj metalmonk) (arg0 float) (arg1 float)) - (with-pp - (let ((f28-0 (vector-dot (-> obj new-facing) (-> obj old-facing))) - (f30-1 (/ (ja-frame-num 0) (the float (ja-num-frames 0)))) - ) - (when (and (< f28-0 (cos (* 182.04445 arg0))) (let ((v1-7 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) - ) - (not (and v1-7 (= v1-7 (-> obj draw art-group data 9)))) - ) - ) - (ja-channel-push! 1 (seconds 0.16)) - (let ((v1-13 (-> obj skel root-channel 0))) - (set! (-> v1-13 frame-group) (the-as art-joint-anim (-> obj draw art-group data 9))) - ) - (let ((s4-1 (-> obj skel root-channel 0))) - (set! (-> s4-1 num-func) num-func-identity) - (set! (-> s4-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) - ) - (set! (-> obj high-time) (-> pp clock frame-counter)) + (let ((f28-0 (vector-dot (-> obj new-facing) (-> obj old-facing))) + (f30-1 (/ (ja-frame-num 0) (the float (ja-num-frames 0)))) ) - (let ((v1-22 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) + (when (and (< f28-0 (cos (* 182.04445 arg0))) (let ((v1-7 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (not (and v1-7 (= v1-7 (-> obj draw art-group data 9)))) + ) + ) + (ja-channel-push! 1 (seconds 0.16)) + (let ((v1-13 (-> obj skel root-channel 0))) + (set! (-> v1-13 frame-group) (the-as art-joint-anim (-> obj draw art-group data 9))) + ) + (let ((s4-1 (-> obj skel root-channel 0))) + (set! (-> s4-1 num-func) num-func-identity) + (set! (-> s4-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) + ) + (set! (-> obj high-time) (current-time)) + ) + (let ((v1-22 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (when (or (not (and v1-22 (or (= v1-22 (-> obj draw art-group data 8)) (= v1-22 (-> obj draw art-group data 9))))) + (let ((v1-28 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (and (and v1-28 (= v1-28 (-> obj draw art-group data 9))) + (and (< (cos (* 182.04445 arg1)) f28-0) (>= (- (current-time) (-> obj high-time)) (seconds 1))) ) - ) - ) - (when (or (not (and v1-22 (or (= v1-22 (-> obj draw art-group data 8)) (= v1-22 (-> obj draw art-group data 9))))) - (let ((v1-28 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) - ) - (and (and v1-28 (= v1-28 (-> obj draw art-group data 9))) - (and (< (cos (* 182.04445 arg1)) f28-0) (>= (- (-> pp clock frame-counter) (-> obj high-time)) (seconds 1))) - ) - ) ) - (ja-channel-push! 1 (seconds 0.5)) - (let ((v1-39 (-> obj skel root-channel 0))) - (set! (-> v1-39 frame-group) (the-as art-joint-anim (-> obj draw art-group data 8))) - ) - (let ((gp-1 (-> obj skel root-channel 0))) - (set! (-> gp-1 num-func) num-func-identity) - (set! (-> gp-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) - ) + ) + (ja-channel-push! 1 (seconds 0.5)) + (let ((v1-39 (-> obj skel root-channel 0))) + (set! (-> v1-39 frame-group) (the-as art-joint-anim (-> obj draw art-group data 8))) + ) + (let ((gp-1 (-> obj skel root-channel 0))) + (set! (-> gp-1 num-func) num-func-identity) + (set! (-> gp-1 frame-num) (* f30-1 (the float (ja-num-frames 0)))) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 55 of type metalmonk @@ -688,7 +684,7 @@ ) ) (let ((gp-0 (handle->process (-> self focus handle)))) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (if (and (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (and gp-0 (or (and (< (vector-vector-xz-distance (get-trans (the-as process-focusable gp-0) 0) (-> self root-override2 trans)) 20480.0 @@ -896,7 +892,7 @@ (t9-0) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -906,7 +902,7 @@ ) ) (let ((a0-1 (handle->process (-> self focus handle)))) - (if (and a0-1 (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (if (and a0-1 (and (>= (- (current-time) (-> 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-override2 trans) @@ -1350,7 +1346,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/common/enemy/metalhead_slinger/grenadier_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/metalhead_slinger/grenadier_REF.gc index 4e59cce2dd..def057fb39 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/metalhead_slinger/grenadier_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/metalhead_slinger/grenadier_REF.gc @@ -320,45 +320,43 @@ (defmethod general-event-handler grenadier ((obj grenadier) (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" - (with-pp - (case arg2 - (('hit-knocked) - (when (= (-> obj incoming knocked-type) (knocked-type knocked-type-4)) - (if (and (< (- (-> pp clock frame-counter) (-> obj suppress-knockaside-timer)) (seconds 0.6)) - (and (-> obj next-state) (= (-> obj next-state name) 'attack)) - (nonzero? (-> obj hit-points)) - ) - (return #t) - ) - (logior! (-> obj status-flags) 1) - (set! (-> obj suppress-knockaside-timer) (-> pp clock frame-counter)) - ) - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - (('notify) - (cond - ((and (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) - (let ((v1-23 (new 'stack-no-clear 'event-message-block))) - (set! (-> v1-23 from) (process->ppointer arg0)) - (set! (-> v1-23 num-params) arg1) - (set! (-> v1-23 message) 'victory) - (set! (-> v1-23 param 0) (-> arg3 param 0)) - (set! (-> v1-23 param 1) (-> arg3 param 1)) - (set! (-> v1-23 param 2) (-> arg3 param 2)) - (set! (-> v1-23 param 3) (-> arg3 param 3)) - (set! (-> v1-23 param 4) (-> arg3 param 4)) - (set! (-> v1-23 param 5) (-> arg3 param 5)) - (send-event-function obj v1-23) - ) - ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + (case arg2 + (('hit-knocked) + (when (= (-> obj incoming knocked-type) (knocked-type knocked-type-4)) + (if (and (< (- (current-time) (-> obj suppress-knockaside-timer)) (seconds 0.6)) + (and (-> obj next-state) (= (-> obj next-state name) 'attack)) + (nonzero? (-> obj hit-points)) + ) + (return #t) ) + (logior! (-> obj status-flags) 1) + (set! (-> obj suppress-knockaside-timer) (current-time)) + ) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (('notify) + (cond + ((and (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) + (let ((v1-23 (new 'stack-no-clear 'event-message-block))) + (set! (-> v1-23 from) (process->ppointer arg0)) + (set! (-> v1-23 num-params) arg1) + (set! (-> v1-23 message) 'victory) + (set! (-> v1-23 param 0) (-> arg3 param 0)) + (set! (-> v1-23 param 1) (-> arg3 param 1)) + (set! (-> v1-23 param 2) (-> arg3 param 2)) + (set! (-> v1-23 param 3) (-> arg3 param 3)) + (set! (-> v1-23 param 4) (-> arg3 param 4)) + (set! (-> v1-23 param 5) (-> arg3 param 5)) + (send-event-function obj v1-23) + ) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -611,7 +609,7 @@ ) ) ) - (when (or (>= (- (-> self clock frame-counter) (-> self state-time)) (rand-vu-int-range (seconds 3) (seconds 9))) + (when (or (>= (- (current-time) (-> self state-time)) (rand-vu-int-range (seconds 3) (seconds 9))) (>= 8192.0 (vector-vector-xz-distance (-> self root-override2 trans) (-> self bank final-pos))) ) (if (and (handle->process (-> self focus handle)) @@ -678,7 +676,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior grenadier) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -691,7 +689,7 @@ ) :trans (behavior () (let ((f0-0 (vector-vector-xz-distance (-> self root-override2 trans) (-> self move-pos)))) - (if (or (>= 12288.0 f0-0) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 6))) + (if (or (>= 12288.0 f0-0) (>= (- (current-time) (-> self state-time)) (seconds 6))) (go-hostile self) ) ) @@ -730,7 +728,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior grenadier) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/spyder_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/spyder_REF.gc index 95bd1884ad..fb93746156 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/spyder_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/spyder_REF.gc @@ -306,78 +306,76 @@ (defmethod general-event-handler spyder ((obj spyder) (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" - (with-pp - (case arg2 - (('hit-knocked) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) - (logior! (-> obj focus-status) (focus-status hit)) - (if (zero? (-> obj hit-points)) - (logior! (-> obj focus-status) (focus-status dead)) - ) - (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) - (enemy-method-62 obj) - (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (process-contact-action arg0) - (send-event arg0 'get-attack-count 1) - (when (zero? (-> obj hit-points)) - (case (-> obj incoming knocked-type) - (((knocked-type knocked-type-4) (knocked-type knocked-type-6)) - (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) - 0 - ) - ) + (case arg2 + (('hit-knocked) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) + ) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (process-contact-action arg0) + (send-event arg0 'get-attack-count 1) + (when (zero? (-> obj hit-points)) + (case (-> obj incoming knocked-type) + (((knocked-type knocked-type-4) (knocked-type knocked-type-6)) + (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) + 0 + ) ) - (go (method-of-object obj knocked)) ) - (('attack) - (if (type? (-> arg0 parent 0) enemy) - (logior! (-> obj status-flags) 2) - ) - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - (('notify) - (cond - ((= (-> arg3 param 0) 'attack) - (cond - ((= (-> arg3 param 1) (handle->process (-> obj focus handle))) - (let ((a1-6 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-6 from) (process->ppointer arg0)) - (set! (-> a1-6 num-params) arg1) - (set! (-> a1-6 message) 'victory) - (set! (-> a1-6 param 0) (-> arg3 param 0)) - (set! (-> a1-6 param 1) (-> arg3 param 1)) - (set! (-> a1-6 param 2) (-> arg3 param 2)) - (set! (-> a1-6 param 3) (-> arg3 param 3)) - (set! (-> a1-6 param 4) (-> arg3 param 4)) - (set! (-> a1-6 param 5) (-> arg3 param 5)) - (send-event-function obj a1-6) - ) + (go (method-of-object obj knocked)) + ) + (('attack) + (if (type? (-> arg0 parent 0) enemy) + (logior! (-> obj status-flags) 2) + ) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (('notify) + (cond + ((= (-> arg3 param 0) 'attack) + (cond + ((= (-> arg3 param 1) (handle->process (-> obj focus handle))) + (let ((a1-6 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-6 from) (process->ppointer arg0)) + (set! (-> a1-6 num-params) arg1) + (set! (-> a1-6 message) 'victory) + (set! (-> a1-6 param 0) (-> arg3 param 0)) + (set! (-> a1-6 param 1) (-> arg3 param 1)) + (set! (-> a1-6 param 2) (-> arg3 param 2)) + (set! (-> a1-6 param 3) (-> arg3 param 3)) + (set! (-> a1-6 param 4) (-> arg3 param 4)) + (set! (-> a1-6 param 5) (-> arg3 param 5)) + (send-event-function obj a1-6) ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - ) - ) - (('uncloak) - (when (!= (-> obj dest-fade) 128.0) - (set! (-> obj shock-effect-end) (+ (-> pp clock frame-counter) (seconds 1))) - (set! (-> obj dest-fade) 128.0) - (sound-play "spyder-uncloak") - ) - (send-event obj 'cue-chase) - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + ) + (('uncloak) + (when (!= (-> obj dest-fade) 128.0) + (set! (-> obj shock-effect-end) (+ (current-time) (seconds 1))) + (set! (-> obj dest-fade) 128.0) + (sound-play "spyder-uncloak") + ) + (send-event obj 'cue-chase) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -408,9 +406,9 @@ (if (< 245760.0 (vector-vector-distance (-> obj root-override2 trans) (camera-pos))) (setup-masks (-> obj draw) 0 16) ) - (when (< (-> pp clock frame-counter) (-> obj shock-effect-end)) - (when (>= (- (-> pp clock frame-counter) (-> obj shock-effect-time)) (seconds 0.04)) - (set! (-> obj shock-effect-time) (-> pp clock frame-counter)) + (when (< (current-time) (-> obj shock-effect-end)) + (when (>= (- (current-time) (-> obj shock-effect-time)) (seconds 0.04)) + (set! (-> obj shock-effect-time) (current-time)) (process-drawable-shock-skel-effect obj (-> *lightning-spec-id-table* 5) @@ -791,7 +789,7 @@ ) ) (when (!= (-> self dest-fade) 128.0) - (set! (-> self shock-effect-end) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self shock-effect-end) (+ (current-time) (seconds 1))) (set! (-> self dest-fade) 128.0) ) (none) @@ -951,7 +949,7 @@ (look-at-target! self (enemy-flag death-start)) (set! (-> self status-flags) (logand -3 (-> self status-flags))) (when (!= (-> self dest-fade) 128.0) - (set! (-> self shock-effect-end) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self shock-effect-end) (+ (current-time) (seconds 1))) (set! (-> self dest-fade) 128.0) (sound-play "spyder-uncloak") ) @@ -1017,7 +1015,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior spyder) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -1030,7 +1028,7 @@ ) :trans (behavior () (let ((f0-0 (vector-vector-xz-distance (-> self root-override2 trans) (-> self move-dest)))) - (if (or (>= 4096.0 f0-0) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 6))) + (if (or (>= 4096.0 f0-0) (>= (- (current-time) (-> self state-time)) (seconds 6))) (go-hostile self) ) ) @@ -1186,8 +1184,8 @@ (set! (-> self fire-info 0 quad) (-> s3-0 quad)) (set! (-> self fire-info 1 quad) (-> s2-1 quad)) ) - (let ((s3-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-1) (seconds 0.2)) + (let ((s3-1 (current-time))) + (until (>= (- (current-time) s3-1) (seconds 0.2)) (set! f30-0 (seek f30-0 (lerp-scale 0.0 1.0 (the float s4-0) 0.0 8.0) (-> self clock seconds-per-frame))) (ja :num! (loop!)) (let ((a0-27 (-> self skel root-channel 1))) diff --git a/test/decompiler/reference/jak2/levels/common/entities/com-elevator_REF.gc b/test/decompiler/reference/jak2/levels/common/entities/com-elevator_REF.gc index 23d5c5557a..770a6e5eae 100644 --- a/test/decompiler/reference/jak2/levels/common/entities/com-elevator_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/entities/com-elevator_REF.gc @@ -152,8 +152,8 @@ (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -323,8 +323,8 @@ For example for an elevator pre-compute the distance between the first and last (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/entities/fort-floor-spike_REF.gc b/test/decompiler/reference/jak2/levels/common/entities/fort-floor-spike_REF.gc index d219de1d69..46070ded25 100644 --- a/test/decompiler/reference/jak2/levels/common/entities/fort-floor-spike_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/entities/fort-floor-spike_REF.gc @@ -139,7 +139,7 @@ object (case event-type (('touched) - (when (+ (-> self clock frame-counter) (seconds -2)) + (when (+ (current-time) (seconds -2)) (let* ((s3-0 proc) (proc-draw (if (type? s3-0 process-drawable) (the-as process-drawable s3-0) @@ -173,7 +173,7 @@ (send-event-function proc evt) ) ) - (let ((frame-count (-> self clock frame-counter))) + (let ((frame-count (current-time))) (set! (-> self no-overlap-timer) (the-as uint frame-count)) frame-count ) diff --git a/test/decompiler/reference/jak2/levels/common/entities/gun-buoy_REF.gc b/test/decompiler/reference/jak2/levels/common/entities/gun-buoy_REF.gc index 6aed9b6269..8637c703fa 100644 --- a/test/decompiler/reference/jak2/levels/common/entities/gun-buoy_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/entities/gun-buoy_REF.gc @@ -464,7 +464,7 @@ (none) ) :trans (behavior () - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (when (and (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (< 2 (the-as int (-> self focus aware))) (-> *setting-control* user-current gun-buoy) ) @@ -707,7 +707,7 @@ (defstate stare-down (gun-buoy) :virtual #t :enter (behavior () - (set! (-> self stare-down-timer) (-> self clock frame-counter)) + (set! (-> self stare-down-timer) (current-time)) (none) ) :trans (behavior () @@ -718,7 +718,7 @@ ) ((or (< (the-as int v1-0) 2) (not (-> *setting-control* user-current gun-buoy)) - (>= (- (-> self clock frame-counter) (-> self stare-down-timer)) (seconds 6)) + (>= (- (current-time) (-> self stare-down-timer)) (seconds 6)) ) (go-virtual exit-ambush) ) @@ -783,7 +783,7 @@ ) ) ) - (set! (-> self warning-timer) (-> self clock frame-counter)) + (set! (-> self warning-timer) (current-time)) (set! (-> self warning-id) (sound-play "buoy-alarm")) (none) ) @@ -796,7 +796,7 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self warning-timer)) (-> self warning-interval)) + (when (>= (- (current-time) (-> self warning-timer)) (-> self warning-interval)) (cond ((>= (the-as int gp-0) 3) (logior! (-> self flags) 2) @@ -859,7 +859,7 @@ (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (let ((v1-3 (-> self focus aware))) (cond ((= v1-3 (enemy-aware enemy-aware-2)) @@ -922,8 +922,8 @@ (gun-buoy-method-183 self a1-1) ) ) - (let ((s5-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-1) (seconds 0.75)) + (let ((s5-1 (current-time))) + (until (>= (- (current-time) s5-1) (seconds 0.75)) (suspend) ) ) @@ -958,8 +958,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 2)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 2)) (suspend) ) ) @@ -1055,7 +1055,7 @@ ) ) 0 - (let ((v1-30 (-> pp clock frame-counter)) + (let ((v1-30 (current-time)) (f0-18 4.83) ) (set! (-> obj y-bob) diff --git a/test/decompiler/reference/jak2/levels/common/entities/sew-gunturret_REF.gc b/test/decompiler/reference/jak2/levels/common/entities/sew-gunturret_REF.gc index ecf3220a3e..e121dc8abb 100644 --- a/test/decompiler/reference/jak2/levels/common/entities/sew-gunturret_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/entities/sew-gunturret_REF.gc @@ -789,7 +789,7 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) @@ -800,14 +800,14 @@ :code (behavior () (set-aim-at-default! self) (until #f - (-> self clock frame-counter) - (until (>= (- (-> self clock frame-counter) (-> self last-hit-time)) (seconds 2)) + (current-time) + (until (>= (- (current-time) (-> self last-hit-time)) (seconds 2)) (suspend) ) (update-collision! self) (sound-play "sew-gun-lock") - (let ((frame-counter (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 0.75)) + (let ((frame-counter (current-time))) + (until (>= (- (current-time) frame-counter) (seconds 0.75)) (aim-turret! self #t) (suspend) ) @@ -817,14 +817,14 @@ (fire-sound? #t) ) (sound-play "gturret") - (let ((s4-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-1) (seconds 0.125)) + (let ((s4-1 (current-time))) + (until (>= (- (current-time) s4-1) (seconds 0.125)) (cond ((not (-> self can-shoot)) ) - ((>= (- (-> self clock frame-counter) (the-as time-frame frames)) (seconds 0.05)) + ((>= (- (current-time) (the-as time-frame frames)) (seconds 0.05)) (fire-turret! self fire-sound?) - (set! frames (the-as int (-> self clock frame-counter))) + (set! frames (the-as int (current-time))) (set! fire-sound? (not fire-sound?)) ) (else @@ -839,8 +839,8 @@ (set! (-> self flash-state) #f) (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self params idle-anim))) - (let ((_frame-counter (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) _frame-counter) (seconds 0.5)) + (let ((_frame-counter (current-time))) + (until (>= (- (current-time) _frame-counter) (seconds 0.5)) (spawn-with-cspace (-> self smoke-part) (-> self node-list data (-> self params hole-joints 0))) (spawn-with-cspace (-> self smoke-part) (-> self node-list data (-> self params hole-joints 1))) (spawn-with-cspace (-> self smoke-part) (-> self node-list data (-> self params hole-joints 2))) @@ -880,7 +880,7 @@ @TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (if (and (= event-type 'notify) (< 1 arg2) (= (-> event param 0) 'attack) (= (-> event param 1) *target*)) - (set! (-> obj last-hit-time) (-> pp clock frame-counter)) + (set! (-> obj last-hit-time) (current-time)) ) (case event-type (('start) @@ -958,15 +958,15 @@ (let ((vec (new 'stack-no-clear 'vector))) (set! (-> vec quad) (-> self root-override2 trans quad)) (set! (-> vec y) (+ 10240.0 (-> vec y))) - (let ((frame-counter (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 2)) + (let ((frame-counter (current-time))) + (until (>= (- (current-time) frame-counter) (seconds 2)) (spawn (-> self part) vec) (suspend) ) ) ) - (let ((_frame-counter (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) _frame-counter) (seconds 1)) + (let ((_frame-counter (current-time))) + (until (>= (- (current-time) _frame-counter) (seconds 1)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/entities/spydroid_REF.gc b/test/decompiler/reference/jak2/levels/common/entities/spydroid_REF.gc index 25a36e7435..facf2bb34a 100644 --- a/test/decompiler/reference/jak2/levels/common/entities/spydroid_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/entities/spydroid_REF.gc @@ -911,7 +911,7 @@ (t9-0) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -920,7 +920,7 @@ (t9-0) ) ) - (if (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (< (- (current-time) (-> self state-time)) (seconds 2)) (spawn (-> self explode-part) (-> self root-override2 trans)) ) (none) @@ -962,8 +962,8 @@ ) (suspend) (ja-channel-set! 0) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -1122,7 +1122,7 @@ ) ) (let ((a0-1 (handle->process (-> self focus handle)))) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (if (and (>= (- (current-time) (-> 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-override2 trans) diff --git a/test/decompiler/reference/jak2/levels/common/flitter_REF.gc b/test/decompiler/reference/jak2/levels/common/flitter_REF.gc index f82fa32ca3..e625551387 100644 --- a/test/decompiler/reference/jak2/levels/common/flitter_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/flitter_REF.gc @@ -738,8 +738,8 @@ (-> gp-0 ppointer) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.6)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.6)) (suspend) ) ) @@ -760,8 +760,8 @@ ) ) ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) (suspend) ) ) @@ -789,7 +789,7 @@ ) 0 (look-at-target! self (enemy-flag lock-focus)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (-> self root-override2))) (vector-reset! (-> gp-0 transv)) (set! (-> gp-0 transv y) (* 4096.0 (get-rand-float-range self 34.0 38.0))) @@ -904,88 +904,84 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod flitter-method-180 flitter ((obj flitter)) - (with-pp - (let* ((s5-0 (handle->process (-> obj focus handle))) - (s3-0 (if (type? s5-0 process-focusable) - (the-as process-focusable s5-0) - ) - ) + (let* ((s5-0 (handle->process (-> obj focus handle))) + (s3-0 (if (type? s5-0 process-focusable) + (the-as process-focusable s5-0) + ) + ) + ) + (when s3-0 + (let* ((s5-1 (get-trans s3-0 0)) + (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-1 (-> obj root-override2 trans))) + (f30-0 (vector-length s4-1)) + ) + (cond + ((enemy-method-99 obj s3-0) + (go-flee obj) ) - (when s3-0 - (let* ((s5-1 (get-trans s3-0 0)) - (s4-1 (vector-! (new 'stack-no-clear 'vector) s5-1 (-> obj root-override2 trans))) - (f30-0 (vector-length s4-1)) - ) - (cond - ((enemy-method-99 obj s3-0) - (go-flee obj) - ) - ((and (< f30-0 32768.0) (not (flitter-method-182 obj s3-0))) - (go (method-of-object obj circling)) - ) - ((< f30-0 (-> obj enemy-info-override notice-nav-radius)) - (set! (-> obj target-pos quad) (-> s5-1 quad)) - (let ((s3-1 (new 'stack-no-clear 'vector))) - (set! (-> s3-1 quad) (-> s4-1 quad)) - (let ((s5-2 (new 'stack-no-clear 'vector))) - (set! (-> s5-2 quad) (-> obj root-override2 transv quad)) - (vector-normalize! s5-2 f30-0) - (if (>= (vector-dot s3-1 s5-2) 0.98) - (go (method-of-object obj attack)) - ) - ) - ) - ) - ((< f30-0 32768.0) - (set! (-> obj target-pos quad) (-> s5-1 quad)) - ) - ((or (>= (- (-> pp clock frame-counter) (the-as int (-> obj last-change-dir))) (-> obj change-dir-time)) - (< (vector-vector-distance-squared (-> obj root-override2 trans) (-> obj target-pos)) 0.1) - ) - (set! (-> obj last-change-dir) (the-as uint (-> pp clock frame-counter))) - (set! (-> obj change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) - (let ((s3-2 (new 'stack-no-clear 'vector)) - (f0-9 (* 0.5 f30-0 (tan (-> obj move-angle)))) - (s2-0 (new 'stack-no-clear 'vector)) + ((and (< f30-0 32768.0) (not (flitter-method-182 obj s3-0))) + (go (method-of-object obj circling)) + ) + ((< f30-0 (-> obj enemy-info-override notice-nav-radius)) + (set! (-> obj target-pos quad) (-> s5-1 quad)) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (set! (-> s3-1 quad) (-> s4-1 quad)) + (let ((s5-2 (new 'stack-no-clear 'vector))) + (set! (-> s5-2 quad) (-> obj root-override2 transv quad)) + (vector-normalize! s5-2 f30-0) + (if (>= (vector-dot s3-1 s5-2) 0.98) + (go (method-of-object obj attack)) ) - (if (-> obj heading) - (set-vector! s3-2 (-> s4-1 z) (-> s4-1 y) (- (-> s4-1 x)) 1.0) - (set-vector! s3-2 (- (-> s4-1 z)) (-> s4-1 y) (-> s4-1 x) 1.0) - ) - (set! (-> obj heading) (the-as basic (not (-> obj heading)))) - (let ((f28-1 (rand-vu-float-range (* 0.75 f0-9) f0-9)) - (s4-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s4-1 (* -0.6 f30-0))) - ) - (vector-normalize! s3-2 f28-1) - (vector+! s3-2 s3-2 s4-2) - ) - (clamp-vector-to-mesh-cross-gaps (-> obj nav state) s3-2) - (vector+! s2-0 s5-1 s3-2) - (set! (-> obj target-pos quad) (-> s2-0 quad)) ) ) - ) + ) + ((< f30-0 32768.0) + (set! (-> obj target-pos quad) (-> s5-1 quad)) + ) + ((or (>= (- (current-time) (the-as int (-> obj last-change-dir))) (-> obj change-dir-time)) + (< (vector-vector-distance-squared (-> obj root-override2 trans) (-> obj target-pos)) 0.1) + ) + (set! (-> obj last-change-dir) (the-as uint (current-time))) + (set! (-> obj change-dir-time) (rand-vu-int-range (seconds 0.5) (seconds 0.7))) + (let ((s3-2 (new 'stack-no-clear 'vector)) + (f0-9 (* 0.5 f30-0 (tan (-> obj move-angle)))) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (if (-> obj heading) + (set-vector! s3-2 (-> s4-1 z) (-> s4-1 y) (- (-> s4-1 x)) 1.0) + (set-vector! s3-2 (- (-> s4-1 z)) (-> s4-1 y) (-> s4-1 x) 1.0) + ) + (set! (-> obj heading) (the-as basic (not (-> obj heading)))) + (let ((f28-1 (rand-vu-float-range (* 0.75 f0-9) f0-9)) + (s4-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s4-1 (* -0.6 f30-0))) + ) + (vector-normalize! s3-2 f28-1) + (vector+! s3-2 s3-2 s4-2) + ) + (clamp-vector-to-mesh-cross-gaps (-> obj nav state) s3-2) + (vector+! s2-0 s5-1 s3-2) + (set! (-> obj target-pos quad) (-> s2-0 quad)) + ) + ) ) - 0 ) + 0 ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 181 of type flitter ;; WARN: Return type mismatch time-frame vs none. (defmethod flitter-method-181 flitter ((obj flitter)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (the-as int (-> obj amb-sound-timer))) - (the int (* 300.0 (rand-vu-float-range 1.5 3.0))) - ) - (sound-play "flitter-amb" :position (-> obj root-override2 trans)) - (set! (-> obj amb-sound-timer) (the-as uint (-> pp clock frame-counter))) - ) - (none) + (when (>= (- (current-time) (the-as int (-> obj amb-sound-timer))) + (the int (* 300.0 (rand-vu-float-range 1.5 3.0))) + ) + (sound-play "flitter-amb" :position (-> obj root-override2 trans)) + (set! (-> obj amb-sound-timer) (the-as uint (current-time))) ) + (none) ) ;; definition for function flitter-fall-and-play-death-anim @@ -1002,7 +998,7 @@ ) (set! (-> self root-override2 transv y) 33775.48) (ja :num-func num-func-identity :frame-num 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self root-override2 status) (collide-status on-surface on-ground touch-surface)) (until v1-29 (let ((f0-2 102400.0)) @@ -1011,7 +1007,7 @@ ) (suspend) (ja :num! (seek! max arg1)) - (set! v1-29 (or (ja-done? 0) (>= (- (-> self clock frame-counter) (-> self state-time)) arg2))) + (set! v1-29 (or (ja-done? 0) (>= (- (current-time) (-> self state-time)) arg2))) ) ) ) @@ -1107,7 +1103,7 @@ (t9-0) ) ) - (set! (-> self off-screen-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self off-screen-timer) (the-as uint (current-time))) (none) ) :trans (behavior () @@ -1115,7 +1111,7 @@ (if gp-0 (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable gp-0) 0) quad)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((v1-11 (-> self focus aware))) (cond ((= v1-11 (enemy-aware enemy-aware-3)) @@ -1132,14 +1128,12 @@ ) ) ) - (if (and (get-enemy-target self) - (>= (- (-> self clock frame-counter) (the-as int (-> self off-screen-timer))) (seconds 0.3)) - ) + (if (and (get-enemy-target self) (>= (- (current-time) (the-as int (-> self off-screen-timer))) (seconds 0.3))) (go-hostile self) ) ) (else - (set! (-> self off-screen-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self off-screen-timer) (the-as uint (current-time))) ) ) ) @@ -1190,9 +1184,9 @@ (defstate hostile (flitter) :virtual #t :enter (behavior () - (set! (-> self last-change-dir) (the-as uint (-> self clock frame-counter))) + (set! (-> self last-change-dir) (the-as uint (current-time))) (set! (-> self change-dir-time) 0) - (set! (-> self attack-time) (+ (-> self clock frame-counter) (seconds 0.35))) + (set! (-> self attack-time) (+ (current-time) (seconds 0.35))) (let ((t9-0 (-> (method-of-type nav-enemy hostile) enter))) (if t9-0 (t9-0) @@ -1258,7 +1252,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior flitter) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -1295,7 +1289,7 @@ ) (set! s5-2 (cond ((and gp-0 - (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.5)) + (< (- (current-time) (-> self state-time)) (seconds 1.5)) gp-0 (not (logtest? (-> gp-0 focus-status) (focus-status disable dead ignore grabbed))) ) diff --git a/test/decompiler/reference/jak2/levels/common/grunt_REF.gc b/test/decompiler/reference/jak2/levels/common/grunt_REF.gc index f995088232..78aae3eadb 100644 --- a/test/decompiler/reference/jak2/levels/common/grunt_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/grunt_REF.gc @@ -526,8 +526,8 @@ (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.2)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.2)) (suspend) ) ) @@ -852,7 +852,7 @@ ) ) (let ((a0-1 (grunt-method-184 self 13312.0)) - (gp-0 (-> self clock frame-counter)) + (gp-0 (current-time)) ) (when (and (>= gp-0 (-> self next-warn-time)) (not (logtest? (-> self draw status) (draw-control-status on-screen))) diff --git a/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc b/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc index 13b683a082..89d9630144 100644 --- a/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc @@ -850,9 +850,9 @@ (vector-float*! (-> a2-0 transv) (-> a2-0 transv) 0.2) ) (when (and (logtest? v1-0 (collide-status impact-surface)) - (>= (- (-> self clock frame-counter) (-> obj played-bounce-time)) (seconds 0.3)) + (>= (- (current-time) (-> obj played-bounce-time)) (seconds 0.3)) ) - (set! (-> obj played-bounce-time) (-> self clock frame-counter)) + (set! (-> obj played-bounce-time) (current-time)) (sound-play "grenade-bounce") ) ) diff --git a/test/decompiler/reference/jak2/levels/common/races/race-manager_REF.gc b/test/decompiler/reference/jak2/levels/common/races/race-manager_REF.gc index f2774db8d8..3409d673a4 100644 --- a/test/decompiler/reference/jak2/levels/common/races/race-manager_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/races/race-manager_REF.gc @@ -600,204 +600,200 @@ ;; definition for method 11 of type race-state ;; WARN: Return type mismatch int vs none. (defmethod race-state-method-11 race-state ((obj race-state)) - (with-pp - (set! (-> obj current-time) (the-as uint (-> pp clock frame-counter))) - (let ((v1-2 (-> obj state))) - (cond - ((zero? v1-2) - (let ((v1-3 (the-as object #t))) - (when (not (logtest? (-> obj flags) 4)) - (dotimes (s5-0 (-> obj racer-count)) - (let ((a0-7 (-> obj racer-array s5-0))) - (set! v1-3 (and v1-3 (send-event (handle->process (-> a0-7 racer)) 'test-ready))) - ) + (set! (-> obj current-time) (the-as uint (current-time))) + (let ((v1-2 (-> obj state))) + (cond + ((zero? v1-2) + (let ((v1-3 (the-as object #t))) + (when (not (logtest? (-> obj flags) 4)) + (dotimes (s5-0 (-> obj racer-count)) + (let ((a0-7 (-> obj racer-array s5-0))) + (set! v1-3 (and v1-3 (send-event (handle->process (-> a0-7 racer)) 'test-ready))) ) ) - (when (and v1-3 (not (logtest? (-> obj info flags) 1))) - (race-state-method-15 obj) - (set! v1-3 (handle->process (-> obj race-signal))) - ) - (when v1-3 - (race-state-method-18 obj) - (set! (-> obj state) (the-as uint (if (or (logtest? (-> obj flags) 2) (logtest? (-> obj info flags) 1)) - 5 - 1 - ) - ) - ) - ) + ) + (when (and v1-3 (not (logtest? (-> obj info flags) 1))) + (race-state-method-15 obj) + (set! v1-3 (handle->process (-> obj race-signal))) + ) + (when v1-3 + (race-state-method-18 obj) + (set! (-> obj state) (the-as uint (if (or (logtest? (-> obj flags) 2) (logtest? (-> obj info flags) 1)) + 5 + 1 + ) + ) + ) ) ) - ((= v1-2 1) - (let* ((f30-0 (* 0.0033333334 (the float (- (-> obj current-time) (-> obj countdown-start-time))))) - (s4-0 (handle->process (-> obj racer-array (-> obj i-player) racer))) - (s5-1 (if (type? s4-0 process-focusable) - s4-0 - ) - ) - ) - (cond - ((< f30-0 1.0) - (when s5-1 - (cubic-curve-method-10 - (-> obj player-intro-curve) - (-> (the-as process-focusable s5-1) root-override trans) - f30-0 - ) - (cubic-curve-method-11 - (-> obj player-intro-curve) - (-> (the-as process-focusable s5-1) root-override transv) - f30-0 - ) - (when (< 0.4 f30-0) - (when (-> obj info start-camera) - (set-setting! 'entity-name (-> obj info start-camera) 0.0 0) - (if (logtest? (-> obj info flags) 64) - (talker-spawn-func (-> *talker-speech* 377) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-2 1) + (let* ((f30-0 (* 0.0033333334 (the float (- (-> obj current-time) (-> obj countdown-start-time))))) + (s4-0 (handle->process (-> obj racer-array (-> obj i-player) racer))) + (s5-1 (if (type? s4-0 process-focusable) + s4-0 ) ) - ) - ) ) - (else - (set! (-> obj state) (the-as uint 2)) - ) - ) - ) - ) - ((= v1-2 2) - (let* ((s4-2 (handle->process (-> obj racer-array (-> obj i-player) racer))) - (s5-3 (if (type? s4-2 process-focusable) - s4-2 - ) - ) - ) - (when s5-3 - (cubic-curve-method-10 - (-> obj player-intro-curve) - (-> (the-as process-focusable s5-3) root-override trans) - 1.0 - ) - (vector-reset! (-> (the-as process-focusable s5-3) root-override transv)) - ) - ) - (let ((a0-48 (-> obj info hatch-actor-name))) - (when a0-48 - (let ((a0-49 (process-by-name a0-48 *active-pool*))) - (send-event a0-49 'close) - ) - ) - ) - (set! (-> obj countdown-start-time) (-> obj current-time)) - (set! (-> obj state) (the-as uint (if (-> obj info countdown-scene) - 3 - 5 - ) - ) - ) - ) - ((= v1-2 3) - (when (>= (the-as uint (- (-> pp clock frame-counter) (the-as int (-> obj countdown-start-time)))) - (the-as uint 300) - ) - (set! (-> obj state) (the-as uint 4)) - (set! (-> obj scene-player) - (ppointer->handle (process-spawn scene-player :init scene-player-init (-> obj info countdown-scene) #t #f)) - ) - ) - ) - ((= v1-2 4) (cond - ((handle->process (-> obj scene-player)) - (let ((s5-5 (-> obj info))) - (dotimes (s4-3 (-> s5-5 racer-count)) - (let ((v1-95 (-> obj racer-array s4-3))) - (if (logtest? (-> s5-5 racer-array s4-3 flags) 1) - (send-event (handle->process (-> v1-95 racer)) 'hide) + ((< f30-0 1.0) + (when s5-1 + (cubic-curve-method-10 + (-> obj player-intro-curve) + (-> (the-as process-focusable s5-1) root-override trans) + f30-0 + ) + (cubic-curve-method-11 + (-> obj player-intro-curve) + (-> (the-as process-focusable s5-1) root-override transv) + f30-0 + ) + (when (< 0.4 f30-0) + (when (-> obj info start-camera) + (set-setting! 'entity-name (-> obj info start-camera) 0.0 0) + (if (logtest? (-> obj info flags) 64) + (talker-spawn-func (-> *talker-speech* 377) *entity-pool* (target-pos 0) (the-as region #f)) ) ) ) ) ) (else - (let ((s5-6 (-> obj info))) - (dotimes (s4-4 (-> s5-6 racer-count)) - (let ((v1-105 (-> obj racer-array s4-4))) - (if (logtest? (-> s5-6 racer-array s4-4 flags) 1) - (send-event (handle->process (-> v1-105 racer)) 'unhide) - ) - ) - ) - ) - (set! (-> obj state) (the-as uint 5)) + (set! (-> obj state) (the-as uint 2)) ) ) ) - ((= v1-2 5) - (set! (-> obj i-countdown) 4) - (set! (-> obj state) (the-as uint 6)) - (set! (-> obj countdown-start-time) (-> obj current-time)) - (remove-setting! 'entity-name) + ) + ((= v1-2 2) + (let* ((s4-2 (handle->process (-> obj racer-array (-> obj i-player) racer))) + (s5-3 (if (type? s4-2 process-focusable) + s4-2 + ) + ) + ) + (when s5-3 + (cubic-curve-method-10 + (-> obj player-intro-curve) + (-> (the-as process-focusable s5-3) root-override trans) + 1.0 + ) + (vector-reset! (-> (the-as process-focusable s5-3) root-override transv)) + ) ) - ((= v1-2 6) - (let ((f0-3 3.0)) - (if (logtest? (-> obj info flags) 1) - (set! f0-3 0.2) - ) - (let ((v1-127 (+ (the int (* 300.0 f0-3)) (- (-> obj countdown-start-time) (-> obj current-time))))) - (cond - ((>= v1-127 (the int (* 225.0 f0-3))) - ) - ((>= v1-127 (the int (* 150.0 f0-3))) - (when (!= (-> obj i-countdown) 3) - (set! (-> obj i-countdown) 3) - (send-event (handle->process (-> obj race-signal)) 'count-3) - ) - ) - ((>= v1-127 (the int (* 75.0 f0-3))) - (when (!= (-> obj i-countdown) 2) - (set! (-> obj i-countdown) 2) - (send-event (handle->process (-> obj race-signal)) 'count-2) - ) - ) - ((< (the int (* 0.0 f0-3)) v1-127) - (when (!= (-> obj i-countdown) 1) - (set! (-> obj i-countdown) 1) - (send-event (handle->process (-> obj race-signal)) 'count-1) - ) - ) - (else - (set! (-> obj i-countdown) 0) - (set! (-> obj state) (the-as uint 7)) - (begin-race obj) - ) - ) + (let ((a0-48 (-> obj info hatch-actor-name))) + (when a0-48 + (let ((a0-49 (process-by-name a0-48 *active-pool*))) + (send-event a0-49 'close) ) ) - (race-state-method-14 obj) ) - ((= v1-2 7) - (race-state-method-14 obj) - (race-state-method-12 obj) + (set! (-> obj countdown-start-time) (-> obj current-time)) + (set! (-> obj state) (the-as uint (if (-> obj info countdown-scene) + 3 + 5 + ) + ) + ) + ) + ((= v1-2 3) + (when (>= (the-as uint (- (current-time) (the-as int (-> obj countdown-start-time)))) (the-as uint 300)) + (set! (-> obj state) (the-as uint 4)) + (set! (-> obj scene-player) + (ppointer->handle (process-spawn scene-player :init scene-player-init (-> obj info countdown-scene) #t #f)) + ) ) - ((= v1-2 8) - ) - (else - ) - ) - ) - (dotimes (s5-7 (-> obj info turbo-pad-count)) - (let ((s4-5 (-> obj info turbo-pad-array s5-7))) - (if (not (handle->process (-> s4-5 handle))) - (set! (-> s4-5 handle) - (process->handle (turbo-pickup-spawn (handle->process (-> obj manager)) (-> s4-5 position))) - ) + ) + ((= v1-2 4) + (cond + ((handle->process (-> obj scene-player)) + (let ((s5-5 (-> obj info))) + (dotimes (s4-3 (-> s5-5 racer-count)) + (let ((v1-95 (-> obj racer-array s4-3))) + (if (logtest? (-> s5-5 racer-array s4-3 flags) 1) + (send-event (handle->process (-> v1-95 racer)) 'hide) + ) + ) + ) ) + ) + (else + (let ((s5-6 (-> obj info))) + (dotimes (s4-4 (-> s5-6 racer-count)) + (let ((v1-105 (-> obj racer-array s4-4))) + (if (logtest? (-> s5-6 racer-array s4-4 flags) 1) + (send-event (handle->process (-> v1-105 racer)) 'unhide) + ) + ) + ) + ) + (set! (-> obj state) (the-as uint 5)) + ) + ) + ) + ((= v1-2 5) + (set! (-> obj i-countdown) 4) + (set! (-> obj state) (the-as uint 6)) + (set! (-> obj countdown-start-time) (-> obj current-time)) + (remove-setting! 'entity-name) + ) + ((= v1-2 6) + (let ((f0-3 3.0)) + (if (logtest? (-> obj info flags) 1) + (set! f0-3 0.2) + ) + (let ((v1-127 (+ (the int (* 300.0 f0-3)) (- (-> obj countdown-start-time) (-> obj current-time))))) + (cond + ((>= v1-127 (the int (* 225.0 f0-3))) + ) + ((>= v1-127 (the int (* 150.0 f0-3))) + (when (!= (-> obj i-countdown) 3) + (set! (-> obj i-countdown) 3) + (send-event (handle->process (-> obj race-signal)) 'count-3) + ) + ) + ((>= v1-127 (the int (* 75.0 f0-3))) + (when (!= (-> obj i-countdown) 2) + (set! (-> obj i-countdown) 2) + (send-event (handle->process (-> obj race-signal)) 'count-2) + ) + ) + ((< (the int (* 0.0 f0-3)) v1-127) + (when (!= (-> obj i-countdown) 1) + (set! (-> obj i-countdown) 1) + (send-event (handle->process (-> obj race-signal)) 'count-1) + ) + ) + (else + (set! (-> obj i-countdown) 0) + (set! (-> obj state) (the-as uint 7)) + (begin-race obj) + ) + ) + ) + ) + (race-state-method-14 obj) + ) + ((= v1-2 7) + (race-state-method-14 obj) + (race-state-method-12 obj) + ) + ((= v1-2 8) + ) + (else ) ) - 0 - (none) ) + (dotimes (s5-7 (-> obj info turbo-pad-count)) + (let ((s4-5 (-> obj info turbo-pad-array s5-7))) + (if (not (handle->process (-> s4-5 handle))) + (set! (-> s4-5 handle) + (process->handle (turbo-pickup-spawn (handle->process (-> obj manager)) (-> s4-5 position))) + ) + ) + ) + ) + 0 + (none) ) ;; definition for method 15 of type race-state @@ -1482,10 +1478,10 @@ (when (logtest? (-> gp-0 flags) 1) (cond ((logtest? (-> gp-0 flags) 64) - (set! (-> self player-on-track-time) (-> self clock frame-counter)) + (set! (-> self player-on-track-time) (current-time)) ) (else - (when (>= (- (-> self clock frame-counter) (-> self player-on-track-time)) (seconds 1)) + (when (>= (- (current-time) (-> self player-on-track-time)) (seconds 1)) (let ((v1-16 (handle->process (-> gp-0 racer)))) (when v1-16 (when (logtest? (-> (the-as vehicle-racer v1-16) flags) (rigid-body-object-flag on-ground)) @@ -1559,7 +1555,7 @@ (send-event (handle->process (-> self race-state hud-lap-counter)) 'force-hide) (send-event (handle->process (-> self race-state hud-turbo-counter)) 'force-hide) (process-spawn hud-race-final-stats :init hud-init-by-other :to self) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (when (logtest? (-> self race-state info flags) 4) (send-event (ppointer->process (-> self parent)) 'complete) (sleep-code) @@ -1568,7 +1564,7 @@ (cond ((logtest? (-> self race-state info flags) 8) (race-manager-method-25 self) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (cond ((logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) (race-manager-method-27 self) @@ -1585,7 +1581,7 @@ ) (else (race-manager-method-24 self) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) (race-manager-method-27 self) (send-event (ppointer->process (-> self parent)) 'complete) @@ -1620,11 +1616,11 @@ (send-event (handle->process (-> self race-state hud-lap-counter)) 'force-hide) (send-event (handle->process (-> self race-state hud-turbo-counter)) 'force-hide) (process-spawn hud-race-final-stats :init hud-init-by-other :to self) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (race-manager-method-25 self) (-> self race-state info) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (cond ((logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) (race-manager-method-27 self) @@ -1657,7 +1653,7 @@ (send-event (handle->process (-> self race-state hud-timer)) 'force-hide) (send-event (handle->process (-> self race-state hud-lap-counter)) 'force-hide) (send-event (handle->process (-> self race-state hud-turbo-counter)) 'force-hide) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (suspend) ) diff --git a/test/decompiler/reference/jak2/levels/common/races/race-obs_REF.gc b/test/decompiler/reference/jak2/levels/common/races/race-obs_REF.gc index e2dc794a86..1faecdb0ca 100644 --- a/test/decompiler/reference/jak2/levels/common/races/race-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/races/race-obs_REF.gc @@ -147,7 +147,7 @@ (+! (-> obj y-offset) (* (- (-> obj dest-y-offset) (-> obj y-offset)) (fmin 1.0 (* 2.0 (-> pp clock seconds-per-frame)))) ) - (let ((f30-0 (* 0.0033333334 (the float (- (-> pp clock frame-counter) (-> obj bob-time)))))) + (let ((f30-0 (* 0.0033333334 (the float (- (current-time) (-> obj bob-time)))))) (set! (-> obj root trans y) (+ (-> obj pos y) (-> obj y-offset) (* 1024.0 (sin (* 32768.0 f30-0))))) (set! (-> obj root trans z) (+ (-> obj pos z) (* 2048.0 (cos (* 32768.0 f30-0))))) ) @@ -316,7 +316,7 @@ (-> v1-8 trans) ) ) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (until #f (suspend) ) @@ -324,7 +324,7 @@ (none) ) :post (behavior () - (let ((f30-0 (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> self start-time)))))) + (let ((f30-0 (* 0.0033333334 (the float (- (current-time) (-> self start-time)))))) (cubic-curve-method-10 (-> self curve) (-> self pos) f30-0) (if (< 1.0 f30-0) (go-virtual die) @@ -351,8 +351,8 @@ :code (behavior () (until #f (ja :num-func num-func-identity :frame-num (ja-aframe 0.0 0)) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.5)) (suspend) ) ) @@ -362,8 +362,8 @@ (ja :num! (seek! (ja-aframe 2.0 0))) ) (process-spawn part-tracker :init part-tracker-init (-> *part-group-id-table* 196) 600 #f #f self 5 :to self) - (let ((gp-5 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-5) (seconds 0.5)) + (let ((gp-5 (current-time))) + (until (>= (- (current-time) gp-5) (seconds 0.5)) (suspend) ) ) @@ -373,8 +373,8 @@ (ja :num! (seek! (ja-aframe 4.0 0))) ) (process-spawn part-tracker :init part-tracker-init (-> *part-group-id-table* 195) 300 #f #f self 7 :to self) - (let ((gp-9 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-9) (seconds 0.5)) + (let ((gp-9 (current-time))) + (until (>= (- (current-time) gp-9) (seconds 0.5)) (suspend) ) ) @@ -384,14 +384,14 @@ (ja :num! (seek! (ja-aframe 6.0 0))) ) (process-spawn part-tracker :init part-tracker-init (-> *part-group-id-table* 194) 300 #f #f self 9 :to self) - (let ((gp-13 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-13) (seconds 0.5)) + (let ((gp-13 (current-time))) + (until (>= (- (current-time) gp-13) (seconds 0.5)) (suspend) ) ) (process-spawn part-tracker :init part-tracker-init (-> *part-group-id-table* 197) 300 #f #f self 10 :to self) - (let ((gp-15 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-15) (seconds 0.5)) + (let ((gp-15 (current-time))) + (until (>= (- (current-time) gp-15) (seconds 0.5)) (suspend) ) ) @@ -422,7 +422,7 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-race-signal" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (set! (-> self bob-time) (-> self clock frame-counter)) + (set! (-> self bob-time) (current-time)) (set! (-> self banner) (the-as handle #f)) (set! (-> self draw shadow-mask) (the-as uint 30)) (set! (-> self draw shadow-values) (the-as uint #x22220)) @@ -836,7 +836,7 @@ (defstate die (turbo-pickup) :virtual #t :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (get-process *default-dead-pool* part-tracker #x4000))) (when gp-0 (let ((t9-1 (method-of-type part-tracker activate))) @@ -877,7 +877,7 @@ (set! (-> v1-11 prim-core collide-with) (collide-spec)) ) 0 - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (until (>= (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (none) @@ -927,7 +927,3 @@ (the-as turbo-pickup gp-0) ) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/common/races/vehicle-racer_REF.gc b/test/decompiler/reference/jak2/levels/common/races/vehicle-racer_REF.gc index 65dc35f87a..c799d9f516 100644 --- a/test/decompiler/reference/jak2/levels/common/races/vehicle-racer_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/races/vehicle-racer_REF.gc @@ -317,20 +317,18 @@ ;; definition for method 66 of type vehicle-racer ;; WARN: Return type mismatch int vs none. (defmethod vehicle-method-66 vehicle-racer ((obj vehicle-racer)) - (with-pp - (when (and (not (logtest? (rigid-body-object-flag turbo-boost) (-> obj flags))) (> (-> obj turbo-pickup-count) 0)) - (+! (-> obj turbo-pickup-count) -1) - (set! (-> obj turbo-boost-time) (-> pp clock frame-counter)) - (set! (-> obj turbo-boost-factor) 1.0) - (set! (-> obj turbo-boost-duration) (the-as uint 150)) - (set! (-> obj flags) (logior (rigid-body-object-flag turbo-boost) (-> obj flags))) - (if (logtest? (-> obj flags) (rigid-body-object-flag player-driving)) - (sound-play "turbo-boost") - ) - ) - 0 - (none) + (when (and (not (logtest? (rigid-body-object-flag turbo-boost) (-> obj flags))) (> (-> obj turbo-pickup-count) 0)) + (+! (-> obj turbo-pickup-count) -1) + (set! (-> obj turbo-boost-time) (current-time)) + (set! (-> obj turbo-boost-factor) 1.0) + (set! (-> obj turbo-boost-duration) (the-as uint 150)) + (set! (-> obj flags) (logior (rigid-body-object-flag turbo-boost) (-> obj flags))) + (if (logtest? (-> obj flags) (rigid-body-object-flag player-driving)) + (sound-play "turbo-boost") + ) ) + 0 + (none) ) ;; definition for method 136 of type vehicle-racer @@ -487,7 +485,7 @@ ) ) (select-path-randomly-from-mask obj (-> v1-37 shortcuts)) - (set! (-> obj shortcut-time) (-> self clock frame-counter)) + (set! (-> obj shortcut-time) (current-time)) (set! (-> obj shortcut-speed-factor) 1.0) ) (else @@ -935,23 +933,21 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod vehicle-racer-method-152 vehicle-racer ((obj vehicle-racer)) - (with-pp - (let ((s5-0 (new 'stack-no-clear 'matrix3))) - (set! (-> s5-0 vector 0 quad) (-> obj rbody state position quad)) - (set! (-> obj camera-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (camera-pos))) - (set! (-> obj player-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (target-pos 0))) - ) - (if (>= (- (-> pp clock frame-counter) (-> obj shortcut-time)) (seconds 5)) - (set! (-> obj shortcut-speed-factor) 0.0) - ) - (vehicle-racer-method-154 obj) - (if (logtest? (-> obj rbody state flags) (rigid-body-flag enable-physics)) - (physics-post obj) - (vehicle-racer-method-151 obj) - ) - 0 - (none) + (let ((s5-0 (new 'stack-no-clear 'matrix3))) + (set! (-> s5-0 vector 0 quad) (-> obj rbody state position quad)) + (set! (-> obj camera-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (camera-pos))) + (set! (-> obj player-dist2) (vector-vector-distance-squared (the-as vector (-> s5-0 vector)) (target-pos 0))) ) + (if (>= (- (current-time) (-> obj shortcut-time)) (seconds 5)) + (set! (-> obj shortcut-speed-factor) 0.0) + ) + (vehicle-racer-method-154 obj) + (if (logtest? (-> obj rbody state flags) (rigid-body-flag enable-physics)) + (physics-post obj) + (vehicle-racer-method-151 obj) + ) + 0 + (none) ) ;; definition for method 155 of type vehicle-racer @@ -1003,7 +999,7 @@ vehicle-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) (logior (rigid-body-object-flag ignition) (-> self flags))) (set! (-> self controls throttle) 0.0) (set! (-> self controls brake) 0.0) @@ -1068,7 +1064,7 @@ vehicle-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self damage-factor) (-> self info-override damage-factor)) (vehicle-method-143 self) (set! (-> self flags) (logior (rigid-body-object-flag ignition) (-> self flags))) @@ -1098,7 +1094,7 @@ vehicle-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) (logior (rigid-body-object-flag riding ignition) (-> self flags))) (set! (-> self controls throttle) 0.0) (set! (-> self controls brake) 0.0) @@ -1143,7 +1139,7 @@ vehicle-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self flags) (the-as rigid-body-object-flag (logior (rigid-body-object-flag persistent riding nav-spheres) (-> self flags)) diff --git a/test/decompiler/reference/jak2/levels/common/warp-gate_REF.gc b/test/decompiler/reference/jak2/levels/common/warp-gate_REF.gc index 8c73e51079..657d02ae67 100644 --- a/test/decompiler/reference/jak2/levels/common/warp-gate_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/warp-gate_REF.gc @@ -575,7 +575,7 @@ ) :code (behavior () (remove-setting! 'allow-progress) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (update-transforms (-> self root-override)) (until #f (handle-notice self) @@ -597,14 +597,14 @@ (or (= v1-30 'target-warp-in) (= v1-30 'target-warp-out)) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) #f ) (else #t ) ) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (>= (- (current-time) (-> self state-time)) (seconds 0.1)) ) (if (and (cpad-pressed? 0 triangle) (process-grab? *target* #f)) (go-virtual use (-> self continue)) @@ -689,7 +689,7 @@ (kill-current-talker (the-as symbol '()) '() 'exit) (set-setting! 'mode-name 'cam-fixed 0.0 0) (set-setting! 'interp-time 'abs 0.0 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self mask) (process-mask actor-pause)) (when (not arg0) (process-release? *target*) @@ -731,7 +731,7 @@ ) ) (label cfg-21) - (or v1-38 (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2))) + (or v1-38 (< (- (current-time) (-> self state-time)) (seconds 2))) ) (update! (-> self sound)) (suspend) @@ -742,8 +742,8 @@ (set-blackout-frames (seconds 0.05)) ) (start 'play arg0) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -890,7 +890,7 @@ This commonly includes things such as: ) ) :enter (behavior ((arg0 vector) (arg1 vector) (arg2 target)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control mod-surface) *warp-jump-mods*) (set! (-> self control unknown-vector37 quad) (-> arg0 quad)) @@ -954,7 +954,7 @@ This commonly includes things such as: (set! (-> v1-20 prim-core collide-with) (collide-spec)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self trans-hook) (lambda :behavior target () @@ -980,7 +980,7 @@ This commonly includes things such as: (set! (-> gp-1 y) 0.0) (send-event *target* 'sidekick #f) (when (and (or (< (vector-dot gp-1 (-> self control transv)) 0.0) (-> self control unknown-spool-anim00)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (>= (- (current-time) (-> self state-time)) (seconds 0.05)) ) (vector-seek! (-> self draw color-mult) (new 'static 'vector) (* 2.0 (-> self clock seconds-per-frame))) (set! (-> self control transv x) (* 0.95 (-> self control transv x))) @@ -1074,8 +1074,8 @@ This commonly includes things such as: (ja-channel-set! 0) (vector-reset! (-> self control transv)) (move-to-point! (-> self control) (-> self control unknown-vector37)) - (let ((s5-1 (-> self clock frame-counter))) - (while (or (< (- (-> self clock frame-counter) s5-1) (seconds 1)) + (let ((s5-1 (current-time))) + (while (or (< (- (current-time) s5-1) (seconds 1)) (< 81920.0 (vector-vector-distance (camera-pos) (-> self control trans))) ) (suspend) @@ -1083,7 +1083,7 @@ This commonly includes things such as: ) (set-heading-vec! (-> self control) (-> self control transv)) (rot->dir-targ! (-> self control)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self post-hook) target-no-stick-post) (ja-channel-set! 1) (send-event @@ -1308,11 +1308,10 @@ This commonly includes things such as: ((the-as (function none) t9-0)) ) ) - (set! (-> self root-override trans y) - (+ (-> self base-pos y) - (* 696.32 (cos (* 66.19798 (the float (mod (-> self clock frame-counter) 990))))) - (* 450.56 (cos (* 42.25403 (the float (mod (-> self clock frame-counter) 1551))))) - ) + (set! (-> self root-override trans y) (+ (-> self base-pos y) + (* 696.32 (cos (* 66.19798 (the float (mod (current-time) 990))))) + (* 450.56 (cos (* 42.25403 (the float (mod (current-time) 1551))))) + ) ) (spawn-with-cspace (-> self part-exhaust-left) (-> self node-list data 5)) (spawn-with-cspace (-> self part-exhaust-right) (-> self node-list data 6)) @@ -1335,7 +1334,7 @@ This commonly includes things such as: :virtual #t :code (behavior ((arg0 continue-point)) (kill-current-talker (the-as symbol '()) '() 'exit) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self mask) (process-mask actor-pause)) (when (not arg0) (process-release? *target*) diff --git a/test/decompiler/reference/jak2/levels/demo/demo-obs_REF.gc b/test/decompiler/reference/jak2/levels/demo/demo-obs_REF.gc index cec9b672c2..8b16c39a3a 100644 --- a/test/decompiler/reference/jak2/levels/demo/demo-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/demo/demo-obs_REF.gc @@ -497,20 +497,17 @@ ;; definition for function demo-wait-for-press (defun demo-wait-for-press ((arg0 time-frame) (arg1 time-frame) (arg2 symbol)) - (with-pp - (let ((s4-0 (-> pp clock frame-counter)) - (s3-0 #f) - ) - (while (not (or (>= (- (-> pp clock frame-counter) s4-0) arg1) (and (>= (- (-> pp clock frame-counter) s4-0) arg0) s3-0)) - ) - (if (cpad-pressed? 0 triangle) - (set! s3-0 #t) - ) - (suspend) + (let ((s4-0 (current-time)) + (s3-0 #f) ) + (while (not (or (>= (- (current-time) s4-0) arg1) (and (>= (- (current-time) s4-0) arg0) s3-0))) + (if (cpad-pressed? 0 triangle) + (set! s3-0 #t) + ) + (suspend) ) - #f ) + #f ) ;; definition for function demo-menu @@ -674,63 +671,63 @@ ) (cond ((zero? (scf-get-territory)) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.38)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 0.38)) (suspend) ) ) (set! (-> self sprite-draw) (the-as uint 3)) (set-vector! (-> self sprite-pos) -512.0 40.0 0.0 1.0) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 0.25)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 0.25)) (set! (-> self sprite-pos x) - (lerp-scale -512.0 0.0 (sin (* 218.45334 (the float (- (-> self clock frame-counter) gp-4)))) 0.0 1.0) + (lerp-scale -512.0 0.0 (sin (* 218.45334 (the float (- (current-time) gp-4)))) 0.0 1.0) ) (suspend) ) ) - (let ((gp-5 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-5) (seconds 2)) + (let ((gp-5 (current-time))) + (until (>= (- (current-time) gp-5) (seconds 2)) (suspend) ) ) - (let ((gp-6 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-6) (seconds 0.25)) + (let ((gp-6 (current-time))) + (until (>= (- (current-time) gp-6) (seconds 0.25)) (set! (-> self sprite-pos x) - (lerp-scale 0.0 512.0 (sin (* 218.45334 (the float (- (-> self clock frame-counter) gp-6)))) 0.0 1.0) + (lerp-scale 0.0 512.0 (sin (* 218.45334 (the float (- (current-time) gp-6)))) 0.0 1.0) ) (suspend) ) ) (set! (-> self sprite-draw) (the-as uint 1)) (set-vector! (-> self sprite-pos) 30.0 -240.0 0.0 1.0) - (let ((gp-7 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-7) (seconds 0.25)) + (let ((gp-7 (current-time))) + (until (>= (- (current-time) gp-7) (seconds 0.25)) (set! (-> self sprite-pos y) - (lerp-scale -240.0 270.0 (sin (* 218.45334 (the float (- (-> self clock frame-counter) gp-7)))) 0.0 1.0) + (lerp-scale -240.0 270.0 (sin (* 218.45334 (the float (- (current-time) gp-7)))) 0.0 1.0) ) (suspend) ) ) - (let ((gp-8 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-8) (seconds 2)) + (let ((gp-8 (current-time))) + (until (>= (- (current-time) gp-8) (seconds 2)) (suspend) ) ) - (let ((gp-9 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-9) (seconds 0.25)) + (let ((gp-9 (current-time))) + (until (>= (- (current-time) gp-9) (seconds 0.25)) (set! (-> self sprite-pos y) - (lerp-scale 270.0 720.0 (sin (* 218.45334 (the float (- (-> self clock frame-counter) gp-9)))) 0.0 1.0) + (lerp-scale 270.0 720.0 (sin (* 218.45334 (the float (- (current-time) gp-9)))) 0.0 1.0) ) (suspend) ) ) (set! (-> self sprite-draw) (the-as uint 2)) (set-vector! (-> self sprite-pos) 20.0 40.0 0.0 1.0) - (let ((gp-10 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-10) (seconds 0.25)) + (let ((gp-10 (current-time))) + (until (>= (- (current-time) gp-10) (seconds 0.25)) (set! (-> self sprite-pos y) - (lerp-scale 720.0 20.0 (sin (* 218.45334 (the float (- (-> self clock frame-counter) gp-10)))) 0.0 1.0) + (lerp-scale 720.0 20.0 (sin (* 218.45334 (the float (- (current-time) gp-10)))) 0.0 1.0) ) (suspend) ) @@ -744,70 +741,70 @@ (set! (-> a1-21 0) 'demo) (want-levels *load-state* a1-21) ) - (let ((gp-11 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-11) (seconds 2)) + (let ((gp-11 (current-time))) + (until (>= (- (current-time) gp-11) (seconds 2)) (suspend) ) ) - (let ((gp-12 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-12) (seconds 0.25)) + (let ((gp-12 (current-time))) + (until (>= (- (current-time) gp-12) (seconds 0.25)) (set! (-> self sprite-pos y) - (lerp-scale 20.0 -720.0 (sin (* 218.45334 (the float (- (-> self clock frame-counter) gp-12)))) 0.0 1.0) + (lerp-scale 20.0 -720.0 (sin (* 218.45334 (the float (- (current-time) gp-12)))) 0.0 1.0) ) (suspend) ) ) ) (else - (let ((gp-13 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-13) (seconds 0.38)) + (let ((gp-13 (current-time))) + (until (>= (- (current-time) gp-13) (seconds 0.38)) (suspend) ) ) - (let ((gp-14 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-14) (seconds 2)) + (let ((gp-14 (current-time))) + (until (>= (- (current-time) gp-14) (seconds 2)) (suspend) ) ) - (let ((gp-15 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-15) (seconds 0.25)) + (let ((gp-15 (current-time))) + (until (>= (- (current-time) gp-15) (seconds 0.25)) (suspend) ) ) - (let ((gp-16 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-16) (seconds 0.25)) + (let ((gp-16 (current-time))) + (until (>= (- (current-time) gp-16) (seconds 0.25)) (suspend) ) ) - (let ((gp-17 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-17) (seconds 2)) + (let ((gp-17 (current-time))) + (until (>= (- (current-time) gp-17) (seconds 2)) (suspend) ) ) - (let ((gp-18 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-18) (seconds 0.25)) + (let ((gp-18 (current-time))) + (until (>= (- (current-time) gp-18) (seconds 0.25)) (suspend) ) ) - (let ((gp-19 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-19) (seconds 0.25)) + (let ((gp-19 (current-time))) + (until (>= (- (current-time) gp-19) (seconds 0.25)) (suspend) ) ) - (let ((gp-20 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-20) (seconds 2)) + (let ((gp-20 (current-time))) + (until (>= (- (current-time) gp-20) (seconds 2)) (suspend) ) ) - (let ((gp-21 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-21) (seconds 0.25)) + (let ((gp-21 (current-time))) + (until (>= (- (current-time) gp-21) (seconds 0.25)) (suspend) ) ) ) ) - (let ((gp-22 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-22) (seconds 3)) + (let ((gp-22 (current-time))) + (until (>= (- (current-time) gp-22) (seconds 3)) (suspend) ) ) @@ -824,9 +821,9 @@ (set! (-> *setting-control* user-default allow-timeout) #t) (let ((gp-24 (demo-menu))) (script-eval '(fadeout (seconds (new 'static 'bfloat :data 0.3)))) - (let ((s5-8 (-> self clock frame-counter))) + (let ((s5-8 (current-time))) (while (or (!= (-> *setting-control* user-current bg-a) (-> *setting-control* user-target bg-a)) - (< (- (-> self clock frame-counter) s5-8) (seconds 0.3)) + (< (- (current-time) s5-8) (seconds 0.3)) ) (suspend) ) diff --git a/test/decompiler/reference/jak2/levels/dig/dig-digger_REF.gc b/test/decompiler/reference/jak2/levels/dig/dig-digger_REF.gc index c559cc1bfd..6227670e29 100644 --- a/test/decompiler/reference/jak2/levels/dig/dig-digger_REF.gc +++ b/test/decompiler/reference/jak2/levels/dig/dig-digger_REF.gc @@ -1360,83 +1360,81 @@ This commonly includes things such as: ;; definition for method 24 of type dig-digger ;; WARN: Return type mismatch int vs none. (defmethod dig-digger-method-24 dig-digger ((obj dig-digger)) - (with-pp - (set! (-> obj vertical target x) 0.0) - (set! (-> obj vertical target z) 0.0) - (let ((s4-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (-> obj vertical)) 1.0)) - (s5-0 0) - ) - (dotimes (s3-0 24) - (let* ((s2-0 (-> obj tethers s3-0)) - (s1-0 (handle->process (-> s2-0 handle))) + (set! (-> obj vertical target x) 0.0) + (set! (-> obj vertical target z) 0.0) + (let ((s4-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (-> obj vertical)) 1.0)) + (s5-0 0) + ) + (dotimes (s3-0 24) + (let* ((s2-0 (-> obj tethers s3-0)) + (s1-0 (handle->process (-> s2-0 handle))) + ) + (cond + (s1-0 + (let ((v1-10 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data (-> obj tethers s3-0 rp))))) + (send-event s1-0 'set-pos v1-10 (-> obj root trans) s4-0) + ) + (cond + ((send-event s1-0 'broken?) + (+! (-> obj vertical target x) (-> s2-0 broken-x)) + (+! (-> obj vertical target z) (-> s2-0 broken-z)) ) - (cond - (s1-0 - (let ((v1-10 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data (-> obj tethers s3-0 rp))))) - (send-event s1-0 'set-pos v1-10 (-> obj root trans) s4-0) - ) - (cond - ((send-event s1-0 'broken?) - (+! (-> obj vertical target x) (-> s2-0 broken-x)) - (+! (-> obj vertical target z) (-> s2-0 broken-z)) - ) - (else - (+! s5-0 1) - ) + (else + (+! s5-0 1) ) ) - (else - (+! (-> obj vertical target x) (-> s2-0 broken-x)) - (+! (-> obj vertical target z) (-> s2-0 broken-z)) - ) + ) + (else + (+! (-> obj vertical target x) (-> s2-0 broken-x)) + (+! (-> obj vertical target z) (-> s2-0 broken-z)) ) ) ) - (set! (-> *game-info* counter) (the float s5-0)) - (when (and (= s5-0 24) - (>= (- (-> pp clock frame-counter) (-> obj speech-time)) (seconds 20)) - *target* - (and (>= 409600.0 (vector-vector-distance (-> obj root trans) (-> *target* control trans))) - (not (logtest? (focus-status teleporting) (-> *target* focus-status))) - ) - ) - (let ((v1-37 (logand (-> obj speech-count) 1))) - (cond - ((zero? v1-37) - (talker-spawn-func (-> *talker-speech* 191) *entity-pool* (target-pos 0) (the-as region #f)) - (if (and *target* (not (logtest? (focus-status board) (-> *target* focus-status)))) - (talker-spawn-func (-> *talker-speech* 115) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) - ((= v1-37 1) - (talker-spawn-func (-> *talker-speech* 192) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) - ) - (set! (-> obj speech-time) (-> pp clock frame-counter)) - (+! (-> obj speech-count) 1) - ) - (cond - ((zero? s5-0) - (send-event (handle->process (-> obj hud-counter)) 'hide-and-die) - (set! (-> obj hud-counter) (the-as handle #f)) - (when (= (-> obj movie-handle) #f) - (set! (-> obj movie-handle) - (ppointer->handle (process-spawn scene-player :init scene-player-init "dig-digger-explode" #t #f)) - ) - (if (handle->process (-> obj movie-handle)) - (cleanup-for-death obj) - ) - ) - ) - ((>= 4 s5-0) - (script-eval '(want-anim "dig-digger-explode")) - ) - ) ) - 0 - (none) + (set! (-> *game-info* counter) (the float s5-0)) + (when (and (= s5-0 24) + (>= (- (current-time) (-> obj speech-time)) (seconds 20)) + *target* + (and (>= 409600.0 (vector-vector-distance (-> obj root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (let ((v1-37 (logand (-> obj speech-count) 1))) + (cond + ((zero? v1-37) + (talker-spawn-func (-> *talker-speech* 191) *entity-pool* (target-pos 0) (the-as region #f)) + (if (and *target* (not (logtest? (focus-status board) (-> *target* focus-status)))) + (talker-spawn-func (-> *talker-speech* 115) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + ((= v1-37 1) + (talker-spawn-func (-> *talker-speech* 192) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + ) + (set! (-> obj speech-time) (current-time)) + (+! (-> obj speech-count) 1) + ) + (cond + ((zero? s5-0) + (send-event (handle->process (-> obj hud-counter)) 'hide-and-die) + (set! (-> obj hud-counter) (the-as handle #f)) + (when (= (-> obj movie-handle) #f) + (set! (-> obj movie-handle) + (ppointer->handle (process-spawn scene-player :init scene-player-init "dig-digger-explode" #t #f)) + ) + (if (handle->process (-> obj movie-handle)) + (cleanup-for-death obj) + ) + ) + ) + ((>= 4 s5-0) + (script-eval '(want-anim "dig-digger-explode")) + ) + ) ) + 0 + (none) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak2/levels/dig/dig-obs_REF.gc b/test/decompiler/reference/jak2/levels/dig/dig-obs_REF.gc index 83147b21d3..1154ca8c88 100644 --- a/test/decompiler/reference/jak2/levels/dig/dig-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/dig/dig-obs_REF.gc @@ -126,98 +126,96 @@ ;; definition for method 37 of type dig-sinking-plat (defmethod rigid-body-object-method-37 dig-sinking-plat ((obj dig-sinking-plat)) - (with-pp - (when (not (logtest? (-> obj path flags) (path-control-flag not-found))) - (set! (-> obj prev-pos) (-> obj path-pos)) - (set! (-> obj path-pos) (get-norm! (-> obj sync) 0)) - (when (< (-> obj path-pos) (-> obj prev-pos)) - (let ((a0-2 (-> obj skel root-channel 0))) - (set! (-> a0-2 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) - (set! (-> a0-2 param 0) - (the float (+ (-> (the-as art-joint-anim (-> obj draw art-group data 2)) frames num-frames) -1)) - ) - (set! (-> a0-2 param 1) 1.0) - (set! (-> a0-2 frame-num) 0.0) - (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-seek!) - ) - (let ((a0-3 (-> obj skel root-channel 0))) - (set! (-> a0-3 param 0) (the float (+ (-> a0-3 frame-group frames num-frames) -1))) - (set! (-> a0-3 param 1) 1.0) - (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-seek!) - ) - ) - (let ((f30-0 (/ 300.0 (the float (-> obj sync period))))) - (let* ((f0-12 (/ 1.0 (- 1.0 (* 2.0 f30-0)))) - (f0-13 (* (fmax 0.0 (- (-> obj path-pos) f30-0)) f0-12)) - ) - (get-point-at-percent-along-path! (-> obj path) (-> obj anchor-point) f0-13 'interp) - ) - (cond - ((< (-> obj path-pos) f30-0) - (set! (-> obj float-height-offset) (* -8192.0 (/ (- f30-0 (-> obj path-pos)) f30-0))) - ) - ((< (- 1.0 (* 2.0 f30-0)) (-> obj path-pos)) - (cond - ((< (- 1.0 f30-0) (-> obj path-pos)) - (set! (-> obj float-height-offset) (* -8192.0 (/ (- (-> obj path-pos) (- 1.0 f30-0)) f30-0))) - (let ((a0-5 (-> obj skel root-channel 0))) - (set! (-> a0-5 param 0) (the float (+ (-> a0-5 frame-group frames num-frames) -1))) - (set! (-> a0-5 param 1) 1.0) - (joint-control-channel-group-eval! a0-5 (the-as art-joint-anim #f) num-func-seek!) - ) + (when (not (logtest? (-> obj path flags) (path-control-flag not-found))) + (set! (-> obj prev-pos) (-> obj path-pos)) + (set! (-> obj path-pos) (get-norm! (-> obj sync) 0)) + (when (< (-> obj path-pos) (-> obj prev-pos)) + (let ((a0-2 (-> obj skel root-channel 0))) + (set! (-> a0-2 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-2 param 0) + (the float (+ (-> (the-as art-joint-anim (-> obj draw art-group data 2)) frames num-frames) -1)) ) - (else - (when (-> obj once) - (let ((a0-6 (-> obj skel root-channel 0))) - (set! (-> a0-6 frame-group) (the-as art-joint-anim (-> obj draw art-group data 3))) - (set! (-> a0-6 param 0) - (the float (+ (-> (the-as art-joint-anim (-> obj draw art-group data 3)) frames num-frames) -1)) - ) - (set! (-> a0-6 param 1) 1.0) - (set! (-> a0-6 frame-num) 0.0) - (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> obj draw art-group data 3)) num-func-seek!) - ) - (set! (-> obj once) #f) - ) - (let ((a0-7 (-> obj skel root-channel 0))) - (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group frames num-frames) -1))) - (set! (-> a0-7 param 1) 1.0) - (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-seek!) + (set! (-> a0-2 param 1) 1.0) + (set! (-> a0-2 frame-num) 0.0) + (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-seek!) + ) + (let ((a0-3 (-> obj skel root-channel 0))) + (set! (-> a0-3 param 0) (the float (+ (-> a0-3 frame-group frames num-frames) -1))) + (set! (-> a0-3 param 1) 1.0) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (let ((f30-0 (/ 300.0 (the float (-> obj sync period))))) + (let* ((f0-12 (/ 1.0 (- 1.0 (* 2.0 f30-0)))) + (f0-13 (* (fmax 0.0 (- (-> obj path-pos) f30-0)) f0-12)) + ) + (get-point-at-percent-along-path! (-> obj path) (-> obj anchor-point) f0-13 'interp) + ) + (cond + ((< (-> obj path-pos) f30-0) + (set! (-> obj float-height-offset) (* -8192.0 (/ (- f30-0 (-> obj path-pos)) f30-0))) + ) + ((< (- 1.0 (* 2.0 f30-0)) (-> obj path-pos)) + (cond + ((< (- 1.0 f30-0) (-> obj path-pos)) + (set! (-> obj float-height-offset) (* -8192.0 (/ (- (-> obj path-pos) (- 1.0 f30-0)) f30-0))) + (let ((a0-5 (-> obj skel root-channel 0))) + (set! (-> a0-5 param 0) (the float (+ (-> a0-5 frame-group frames num-frames) -1))) + (set! (-> a0-5 param 1) 1.0) + (joint-control-channel-group-eval! a0-5 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (else + (when (-> obj once) + (let ((a0-6 (-> obj skel root-channel 0))) + (set! (-> a0-6 frame-group) (the-as art-joint-anim (-> obj draw art-group data 3))) + (set! (-> a0-6 param 0) + (the float (+ (-> (the-as art-joint-anim (-> obj draw art-group data 3)) frames num-frames) -1)) + ) + (set! (-> a0-6 param 1) 1.0) + (set! (-> a0-6 frame-num) 0.0) + (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> obj draw art-group data 3)) num-func-seek!) ) + (set! (-> obj once) #f) + ) + (let ((a0-7 (-> obj skel root-channel 0))) + (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group frames num-frames) -1))) + (set! (-> a0-7 param 1) 1.0) + (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-seek!) ) ) ) - (else - (set! (-> obj float-height-offset) 0.0) - ) + ) + (else + (set! (-> obj float-height-offset) 0.0) ) ) ) - (cond - ((>= (- (-> pp clock frame-counter) (-> obj last-ridden-time)) (seconds 0.5)) - (when (nonzero? (-> obj bubbling-sound-id)) - (let ((v1-84 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) - (set! (-> v1-84 command) (sound-command set-param)) - (set! (-> v1-84 id) (the-as sound-id (-> obj bubbling-sound-id))) - (set! (-> v1-84 params volume) -4) - (set! (-> v1-84 auto-time) 120) - (set! (-> v1-84 auto-from) 2) - (set! (-> v1-84 params mask) (the-as uint 17)) - (-> v1-84 id) - ) - (set! (-> obj bubbling-sound-id) (the-as uint 0)) - 0 - ) - ) - (else - (if (zero? (-> obj bubbling-sound-id)) - (set! (-> obj bubbling-sound-id) (the-as uint (sound-play "lava-plat-sink"))) - ) - ) - ) - ((method-of-type rigid-body-platform rigid-body-object-method-37) obj) - (none) ) + (cond + ((>= (- (current-time) (-> obj last-ridden-time)) (seconds 0.5)) + (when (nonzero? (-> obj bubbling-sound-id)) + (let ((v1-84 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-84 command) (sound-command set-param)) + (set! (-> v1-84 id) (the-as sound-id (-> obj bubbling-sound-id))) + (set! (-> v1-84 params volume) -4) + (set! (-> v1-84 auto-time) 120) + (set! (-> v1-84 auto-from) 2) + (set! (-> v1-84 params mask) (the-as uint 17)) + (-> v1-84 id) + ) + (set! (-> obj bubbling-sound-id) (the-as uint 0)) + 0 + ) + ) + (else + (if (zero? (-> obj bubbling-sound-id)) + (set! (-> obj bubbling-sound-id) (the-as uint (sound-play "lava-plat-sink"))) + ) + ) + ) + ((method-of-type rigid-body-platform rigid-body-object-method-37) obj) + (none) ) ;; definition for method 56 of type dig-sinking-plat @@ -264,7 +262,7 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('ridden) - (set! (-> self last-ridden-time) (-> self clock frame-counter)) + (set! (-> self last-ridden-time) (current-time)) ) ) (the-as object (rigid-body-object-event-handler proc arg1 event-type event)) @@ -644,8 +642,8 @@ ) (s5-0 (add-process *gui-control* self (gui-channel jak) (gui-action queue) t0-0 -99.0 0)) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.15)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.15)) (suspend) ) (until v1-12 @@ -655,8 +653,8 @@ (while (!= (get-status *gui-control* s5-0) (gui-status ready)) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.2)) (suspend) ) (set-setting! 'entity-name "camera-249" 0.0 0) @@ -671,20 +669,20 @@ (the-as process #f) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (suspend) ) (let ((f30-0 (+ (-> (&-> *dig-log-heights* 0 data (- (-> self total-buttons) (-> self pressed-count))) 0) (-> self base-y)) ) - (s5-1 (-> self clock frame-counter)) + (s5-1 (current-time)) ) (until (>= (-> self root trans y) f30-0) (set! (-> self root trans y) (seek-with-smooth (-> self root trans y) f30-0 (* 4096.0 (-> self clock seconds-per-frame)) 0.25 40.96) ) - (when (>= (-> self clock frame-counter) s5-1) + (when (>= (current-time) s5-1) (activate! *camera-smush-control* (rand-vu-float-range 614.4 1433.6) @@ -694,7 +692,7 @@ 0.95 (-> *display* camera-clock) ) - (set! s5-1 (+ (-> self clock frame-counter) (rand-vu-int-range (seconds 0.05) (seconds 0.15)))) + (set! s5-1 (+ (current-time) (rand-vu-int-range (seconds 0.05) (seconds 0.15)))) ) (let ((a1-10 (new 'stack-no-clear 'vector))) (set! (-> a1-10 quad) (-> self root trans quad)) @@ -704,8 +702,8 @@ (suspend) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) (if (= (-> gp-0 cam-ret-mode) 'instant) @@ -714,22 +712,22 @@ (set-setting! 'string-startup-vector 'abs (-> gp-0 cam-ret-dir) 0) (remove-setting! 'entity-name) (when (!= (-> gp-0 cam-ret-mode) 'instant) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (suspend) ) (remove-setting! 'string-startup-vector) (until (process-release? *target*) (suspend) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 4)) (suspend) ) (go-virtual idle) diff --git a/test/decompiler/reference/jak2/levels/dig/dig1-obs_REF.gc b/test/decompiler/reference/jak2/levels/dig/dig1-obs_REF.gc index 5a63b5e478..8269822346 100644 --- a/test/decompiler/reference/jak2/levels/dig/dig1-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/dig/dig1-obs_REF.gc @@ -509,8 +509,8 @@ ) :code (behavior () (let ((f30-0 (rand-vu-float-range 0.22 0.27))) - (set! (-> self wait-time) (+ (-> self clock frame-counter) (the int (rand-vu-float-range 0.0 450.0)))) - (while (< (-> self clock frame-counter) (-> self wait-time)) + (set! (-> self wait-time) (+ (current-time) (the int (rand-vu-float-range 0.0 450.0)))) + (while (< (current-time) (-> self wait-time)) (suspend) ) (ja-no-eval :group! (-> self draw art-group data 3) @@ -528,8 +528,8 @@ :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1))) :frame-num 0.0 ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.5)) (suspend) ) ) @@ -548,8 +548,8 @@ :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1))) :frame-num 0.0 ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 0.5)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 0.5)) (suspend) ) ) @@ -569,8 +569,8 @@ :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1))) :frame-num 0.0 ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.5)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 0.5)) (suspend) ) ) @@ -589,8 +589,8 @@ :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1))) :frame-num 0.0 ) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 0.25)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 0.25)) (suspend) ) ) @@ -609,8 +609,8 @@ :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1))) :frame-num 0.0 ) - (let ((gp-5 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-5) (seconds 0.125)) + (let ((gp-5 (current-time))) + (until (>= (- (current-time) gp-5) (seconds 0.125)) (suspend) ) ) @@ -630,8 +630,8 @@ :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1))) :frame-num 0.0 ) - (let ((s5-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-0) (seconds 0.05)) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) (seconds 0.05)) (suspend) ) ) @@ -1053,8 +1053,8 @@ ) ) (suspend) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 4)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 4)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/dig/dig3-obs_REF.gc b/test/decompiler/reference/jak2/levels/dig/dig3-obs_REF.gc index b156240984..5191e2b282 100644 --- a/test/decompiler/reference/jak2/levels/dig/dig3-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/dig/dig3-obs_REF.gc @@ -289,38 +289,38 @@ :virtual #t :trans (the-as (function none :behavior dig-spikey-step) rider-trans) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (the int (-> self cycle-offset))) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (the int (-> self cycle-offset))) (suspend) ) ) (until #f - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (the int (-> self cycle-time))) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (the int (-> self cycle-time))) (suspend) ) ) (activate! (-> self smush) -1.0 60 225 1.0 1.0 (-> self clock)) (sound-play "spikey-shake" :position (-> self root trans)) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.75)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 0.75)) (set! (-> self shudder-angle) (* 364.0889 (update! (-> self smush)))) (suspend) ) ) (set! (-> self shudder-angle) 0.0) (set-zero! (-> self smush)) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 0.25)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 0.25)) (suspend) ) ) (sound-play "spikey-turn" :position (-> self root trans)) (let* ((f0-7 1.0) (f30-1 (* 65536.0 f0-7)) - (gp-6 (-> self clock frame-counter)) + (gp-6 (current-time)) ) - (until (>= (- (-> self clock frame-counter) gp-6) (seconds 1)) + (until (>= (- (current-time) gp-6) (seconds 1)) (set! (-> self rot-angle) (the float (sar (shl (the int (+ (-> self rot-angle) (* f30-1 (-> self clock seconds-per-frame)))) 48) 48)) ) @@ -494,8 +494,8 @@ This commonly includes things such as: ) (sound-play "spikey-break") (suspend) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 4)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 4)) (suspend) ) ) @@ -662,9 +662,9 @@ This commonly includes things such as: ) ) (the-as sound-id (when (and (logtest? s5-0 (collide-status impact-surface)) - (>= (- (-> self clock frame-counter) (-> obj played-bounce-time)) (seconds 0.3)) + (>= (- (current-time) (-> obj played-bounce-time)) (seconds 0.3)) ) - (let ((v0-7 (-> self clock frame-counter))) + (let ((v0-7 (current-time))) (set! (-> obj played-bounce-time) v0-7) v0-7 ) @@ -771,8 +771,8 @@ This commonly includes things such as: :virtual #t :code (behavior () (sound-play "spikey-door") - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.1)) (suspend) ) ) @@ -1544,34 +1544,32 @@ This commonly includes things such as: ;; definition for method 37 of type dig-tipping-rock ;; WARN: Return type mismatch int vs none. (defmethod rigid-body-object-method-37 dig-tipping-rock ((obj dig-tipping-rock)) - (with-pp - (let ((t9-0 (method-of-type rigid-body-platform rigid-body-object-method-37))) - (t9-0 obj) - ) - (cond - ((>= (- (-> pp clock frame-counter) (-> obj last-ridden-time)) (seconds 0.5)) - (when (nonzero? (-> obj bubbling-sound-id)) - (let ((v1-5 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) - (set! (-> v1-5 command) (sound-command set-param)) - (set! (-> v1-5 id) (the-as sound-id (-> obj bubbling-sound-id))) - (set! (-> v1-5 params volume) -4) - (set! (-> v1-5 auto-time) 120) - (set! (-> v1-5 auto-from) 2) - (set! (-> v1-5 params mask) (the-as uint 17)) - (-> v1-5 id) - ) - (set! (-> obj bubbling-sound-id) (the-as uint 0)) - 0 - ) - ) - (else - (if (zero? (-> obj bubbling-sound-id)) - (set! (-> obj bubbling-sound-id) (the-as uint (sound-play "lava-plat-tip"))) - ) - ) - ) - (none) + (let ((t9-0 (method-of-type rigid-body-platform rigid-body-object-method-37))) + (t9-0 obj) ) + (cond + ((>= (- (current-time) (-> obj last-ridden-time)) (seconds 0.5)) + (when (nonzero? (-> obj bubbling-sound-id)) + (let ((v1-5 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-5 command) (sound-command set-param)) + (set! (-> v1-5 id) (the-as sound-id (-> obj bubbling-sound-id))) + (set! (-> v1-5 params volume) -4) + (set! (-> v1-5 auto-time) 120) + (set! (-> v1-5 auto-from) 2) + (set! (-> v1-5 params mask) (the-as uint 17)) + (-> v1-5 id) + ) + (set! (-> obj bubbling-sound-id) (the-as uint 0)) + 0 + ) + ) + (else + (if (zero? (-> obj bubbling-sound-id)) + (set! (-> obj bubbling-sound-id) (the-as uint (sound-play "lava-plat-tip"))) + ) + ) + ) + (none) ) ;; failed to figure out what this is: @@ -1580,7 +1578,7 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('ridden) - (set! (-> self last-ridden-time) (-> self clock frame-counter)) + (set! (-> self last-ridden-time) (current-time)) ) ) (the-as object (rigid-body-object-event-handler proc arg1 event-type event)) diff --git a/test/decompiler/reference/jak2/levels/drill_platform/drill-baron_REF.gc b/test/decompiler/reference/jak2/levels/drill_platform/drill-baron_REF.gc index 22c3b8f548..a84f67de93 100644 --- a/test/decompiler/reference/jak2/levels/drill_platform/drill-baron_REF.gc +++ b/test/decompiler/reference/jak2/levels/drill_platform/drill-baron_REF.gc @@ -1399,9 +1399,7 @@ This commonly includes things such as: ) ) (set! (-> self root-override trans y) - (+ (-> self current-y-position) - (* 4096.0 (* 2.0 (sin (+ 16384.0 (* 45.511112 (the float (-> self clock frame-counter))))))) - ) + (+ (-> self current-y-position) (* 4096.0 (* 2.0 (sin (+ 16384.0 (* 45.511112 (the float (current-time)))))))) ) (drill-barons-ship-method-22 self) (transform-post) @@ -1523,9 +1521,7 @@ This commonly includes things such as: ) ) (set! (-> self root-override trans y) - (+ (-> self current-y-position) - (* 4096.0 (* 2.0 (sin (+ 16384.0 (* 45.511112 (the float (-> self clock frame-counter))))))) - ) + (+ (-> self current-y-position) (* 4096.0 (* 2.0 (sin (+ 16384.0 (* 45.511112 (the float (current-time)))))))) ) (drill-barons-ship-method-22 self) (+! (-> self x-offset-angle) (* 0.7 (-> self clock time-adjust-ratio))) @@ -1541,9 +1537,9 @@ This commonly includes things such as: (quaternion-rotate-local-x! (-> obj root-override quat) (-> obj init-quat) - (* 182.04445 (sin (* 36.40889 (the float (-> pp clock frame-counter))))) + (* 182.04445 (sin (* 36.40889 (the float (current-time))))) ) - (let ((f30-2 (* 182.04445 (* 5.0 (sin (* 45.511112 (the float (-> pp clock frame-counter)))))))) + (let ((f30-2 (* 182.04445 (* 5.0 (sin (* 45.511112 (the float (current-time)))))))) (when (!= (-> obj rock-angle) 0.0) (+! f30-2 (* 182.04445 (* 20.0 (if (= (-> obj pass) 1) @@ -1567,10 +1563,10 @@ This commonly includes things such as: (quaternion-rotate-local-z! (-> obj root-override quat) (-> obj root-override quat) f30-2) ) (set! (-> obj root-override trans z) - (+ (* 4096.0 (* 30.0 (cos (* 45.511112 (the float (-> pp clock frame-counter)))))) (if (= (-> obj pass) 1) - -1433600.0 - -1433600.0 - ) + (+ (* 4096.0 (* 30.0 (cos (* 45.511112 (the float (current-time)))))) (if (= (-> obj pass) 1) + -1433600.0 + -1433600.0 + ) ) ) (if *target* @@ -1594,59 +1590,57 @@ This commonly includes things such as: ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod drill-barons-ship-turret-method-24 drill-barons-ship-turret ((obj drill-barons-ship-turret)) - (with-pp - (vector<-cspace! - (-> obj root-override trans) - (-> (the-as drill-barons-ship (-> obj parent 0)) node-list data (-> obj info joint-idx)) - ) - (let ((a2-1 (quaternion-axis-angle! (new 'stack-no-clear 'quaternion) 0.0 1.0 0.0 (-> obj info init-y-angle)))) - (quaternion*! - (-> obj root-override quat) - (-> (the-as drill-barons-ship (-> obj parent 0)) root-override quat) - a2-1 - ) - ) - (when (-> obj jmod) - (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (target-pos 0) (-> obj root-override trans))) - (s3-0 (quaternion->matrix (new-stack-matrix0) (-> obj root-override quat))) - ) - (vector-normalize! s5-1 1.0) - (let* ((s4-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s3-0 vector 1) 1.0)) - (s3-1 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s3-0 vector 2) 1.0)) - (a0-13 (vector-normalize! (vector-flatten! (new 'stack-no-clear 'vector) s5-1 s4-0) 1.0)) - (f30-0 (vector-y-angle a0-13)) - (f0-1 (vector-y-angle s3-1)) - (f0-5 (fmax - (fmin (+ (deg-diff f0-1 f30-0) (* 182.04445 (-> obj error-y-angle))) (-> obj info twist-y-max)) - (- (-> obj info twist-y-max)) - ) - ) - ) - (quaternion-axis-angle! (the-as quaternion (-> obj jmod twist)) 0.0 1.0 0.0 f0-5) - ) - ) - (if (-> obj jmod-left) - (quaternion-axis-angle! - (the-as quaternion (-> obj jmod-left twist)) - 0.0 - 0.0 - 1.0 - (* 182.04445 (* -3.0 (the float (-> pp clock frame-counter)))) - ) - ) - (if (-> obj jmod-right) - (quaternion-axis-angle! - (the-as quaternion (-> obj jmod-right twist)) - 0.0 - 0.0 - 1.0 - (* 182.04445 (* 3.0 (the float (-> pp clock frame-counter)))) - ) - ) - ) - 0 - (none) + (vector<-cspace! + (-> obj root-override trans) + (-> (the-as drill-barons-ship (-> obj parent 0)) node-list data (-> obj info joint-idx)) ) + (let ((a2-1 (quaternion-axis-angle! (new 'stack-no-clear 'quaternion) 0.0 1.0 0.0 (-> obj info init-y-angle)))) + (quaternion*! + (-> obj root-override quat) + (-> (the-as drill-barons-ship (-> obj parent 0)) root-override quat) + a2-1 + ) + ) + (when (-> obj jmod) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (target-pos 0) (-> obj root-override trans))) + (s3-0 (quaternion->matrix (new-stack-matrix0) (-> obj root-override quat))) + ) + (vector-normalize! s5-1 1.0) + (let* ((s4-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s3-0 vector 1) 1.0)) + (s3-1 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s3-0 vector 2) 1.0)) + (a0-13 (vector-normalize! (vector-flatten! (new 'stack-no-clear 'vector) s5-1 s4-0) 1.0)) + (f30-0 (vector-y-angle a0-13)) + (f0-1 (vector-y-angle s3-1)) + (f0-5 (fmax + (fmin (+ (deg-diff f0-1 f30-0) (* 182.04445 (-> obj error-y-angle))) (-> obj info twist-y-max)) + (- (-> obj info twist-y-max)) + ) + ) + ) + (quaternion-axis-angle! (the-as quaternion (-> obj jmod twist)) 0.0 1.0 0.0 f0-5) + ) + ) + (if (-> obj jmod-left) + (quaternion-axis-angle! + (the-as quaternion (-> obj jmod-left twist)) + 0.0 + 0.0 + 1.0 + (* 182.04445 (* -3.0 (the float (current-time)))) + ) + ) + (if (-> obj jmod-right) + (quaternion-axis-angle! + (the-as quaternion (-> obj jmod-right twist)) + 0.0 + 0.0 + 1.0 + (* 182.04445 (* 3.0 (the float (current-time)))) + ) + ) + ) + 0 + (none) ) ;; failed to figure out what this is: @@ -1658,7 +1652,7 @@ This commonly includes things such as: (set! (-> v1-1 prim-core collide-with) (collide-spec)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -1930,7 +1924,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self shot-timer) (-> self clock frame-counter)) + (set! (-> self shot-timer) (current-time)) (set! (-> self shot-counter) 0) (set! (-> self error-y-angle) (if (< 25.0 (rand-vu-float-range 0.0 50.0)) -15.0 @@ -2055,7 +2049,7 @@ This commonly includes things such as: ) (go-virtual idle) ) - (when (and (= (-> self anim-frame) 1.0) (>= (- (-> self clock frame-counter) (-> self shot-timer)) (seconds 0.2))) + (when (and (= (-> self anim-frame) 1.0) (>= (- (current-time) (-> self shot-timer)) (seconds 0.2))) (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))) (cond ((-> self jmod) @@ -2142,7 +2136,7 @@ This commonly includes things such as: ) (sound-play "ship-gun1-fire") (+! (-> self shot-counter) 1) - (set! (-> self shot-timer) (-> self clock frame-counter)) + (set! (-> self shot-timer) (current-time)) (seek! (-> self error-y-angle) (-> self error-y-angle-dest) (-> self clock time-adjust-ratio)) (if (= (-> self error-y-angle) (-> self error-y-angle-dest)) (set! (-> self info next-to-shoot) #f) diff --git a/test/decompiler/reference/jak2/levels/drill_platform/drill-mech-master_REF.gc b/test/decompiler/reference/jak2/levels/drill_platform/drill-mech-master_REF.gc index a54e0ae1de..ed17750e91 100644 --- a/test/decompiler/reference/jak2/levels/drill_platform/drill-mech-master_REF.gc +++ b/test/decompiler/reference/jak2/levels/drill_platform/drill-mech-master_REF.gc @@ -144,7 +144,7 @@ (set! (-> *game-info* counter) (the float (-> self cpanel-count))) (spawn-hud-panel self #t) (when (= (-> self cpanel-count) 9) - (set! (-> self next-warn-time) (+ (-> self clock frame-counter) (seconds 3))) + (set! (-> self next-warn-time) (+ (current-time) (seconds 3))) (task-node-close! (game-task-node drill-mech-started-smashing)) ) (if (and (zero? (-> self cpanel-count)) (-> self next-state) (= (-> self next-state name) 'idle)) @@ -177,11 +177,8 @@ :virtual #t :event drill-mech-master-event-handler :trans (behavior () - (when (and (< (-> self cpanel-count) 10) - (< 1 (-> self cpanel-count)) - (>= (-> self clock frame-counter) (-> self next-warn-time)) - ) - (set! (-> self next-warn-time) (+ (-> self clock frame-counter) (seconds 10))) + (when (and (< (-> self cpanel-count) 10) (< 1 (-> self cpanel-count)) (>= (current-time) (-> self next-warn-time))) + (set! (-> self next-warn-time) (+ (current-time) (seconds 10))) (talker-spawn-func (-> *talker-speech* 182) *entity-pool* (target-pos 0) (the-as region #f)) ) (none) @@ -194,16 +191,16 @@ :virtual #t :event drill-mech-master-event-handler :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (task-node-close! (game-task-node drill-mech-smash-consoles)) (set! (-> self alarm-sound-id) (sound-play "drill-alarm")) (persist-with-delay *setting-control* 'ignore-target (seconds 8) 'ignore-target #t 0.0 0) (set-setting! 'music 'danger10 0.0 0) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) (talker-spawn-func (-> *talker-speech* 183) *entity-pool* (target-pos 0) (the-as region #f)) @@ -223,10 +220,10 @@ :virtual #t :event drill-mech-master-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-continue! *game-info* "drill-escape" #f) - (set! (-> self next-warn-time) (+ (-> self clock frame-counter) (seconds 1))) - (set! (-> self started-timer-time) (-> self clock frame-counter)) + (set! (-> self next-warn-time) (+ (current-time) (seconds 1))) + (set! (-> self started-timer-time) (current-time)) (set! (-> self exited?) #f) (none) ) @@ -234,10 +231,7 @@ (if (and (-> self exited?) (process-grab? *target* #f)) (go-virtual victory) ) - (let ((gp-0 - (the-as int (- (-> self total-countdown-time) (- (-> self clock frame-counter) (-> self started-timer-time)))) - ) - ) + (let ((gp-0 (the-as int (- (-> self total-countdown-time) (- (current-time) (-> self started-timer-time)))))) (if (< (the-as time-frame gp-0) 0) (set! gp-0 0) ) @@ -250,8 +244,8 @@ (if (zero? gp-0) (go-virtual failed) ) - (when (>= (-> self clock frame-counter) (-> self next-warn-time)) - (set! (-> self next-warn-time) (+ (-> self clock frame-counter) (seconds 25))) + (when (>= (current-time) (-> self next-warn-time)) + (set! (-> self next-warn-time) (+ (current-time) (seconds 25))) (cond ((>= 9000 gp-0) (add-process *gui-control* self (gui-channel alert) (gui-action play) "cityv029" -99.0 0) @@ -279,7 +273,7 @@ :virtual #t :event drill-mech-master-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-setting! 'allow-pause #f 0.0 0) (set-setting! 'allow-progress #f 0.0 0) (none) @@ -292,7 +286,7 @@ ) :trans (behavior () (when (and (not (-> self killed-jak?)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.225)) + (>= (- (current-time) (-> self state-time)) (seconds 0.225)) (let ((a1-0 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-0 from) (process->ppointer self)) (set! (-> a1-0 num-params) 2) @@ -344,8 +338,8 @@ (set! (-> s4-0 trans w) 1.0) (spawn-with-matrix (-> self part-doom) s4-0) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.2)) (when (and (not gp-1) (>= 2 s5-1) (= (get-status *gui-control* (-> self explosion-sound-id)) (gui-status ready))) (set! gp-1 #t) (set-action! diff --git a/test/decompiler/reference/jak2/levels/drill_platform/drill-obs2_REF.gc b/test/decompiler/reference/jak2/levels/drill_platform/drill-obs2_REF.gc index 3c069d90a7..23cb0ffe9f 100644 --- a/test/decompiler/reference/jak2/levels/drill_platform/drill-obs2_REF.gc +++ b/test/decompiler/reference/jak2/levels/drill_platform/drill-obs2_REF.gc @@ -968,8 +968,8 @@ This commonly includes things such as: ) ) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 0.5)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 0.5)) (suspend) ) ) @@ -1615,9 +1615,9 @@ This commonly includes things such as: ) (if (-> self ridden?) (set! (-> self ridden?) #f) - (set! (-> self not-ridden-timer) (-> self clock frame-counter)) + (set! (-> self not-ridden-timer) (current-time)) ) - (if (>= (- (-> self clock frame-counter) (-> self not-ridden-timer)) (seconds 0.4)) + (if (>= (- (current-time) (-> self not-ridden-timer)) (seconds 0.4)) (go-virtual swing-down) ) (none) @@ -1641,7 +1641,7 @@ This commonly includes things such as: (t9-0) ) ) - (if (>= (- (-> self clock frame-counter) (-> self not-ridden-timer)) (seconds 2)) + (if (>= (- (current-time) (-> self not-ridden-timer)) (seconds 2)) (send-event self 'trigger) ) (none) @@ -1657,12 +1657,10 @@ This commonly includes things such as: ;; WARN: Return type mismatch int vs none. (defmethod set-flipped-state drill-drop-plat ((obj drill-drop-plat)) "Set the state of the platform." - (with-pp - (set! (-> obj not-ridden-timer) (-> pp clock frame-counter)) - (go (method-of-object obj up)) - 0 - (none) - ) + (set! (-> obj not-ridden-timer) (current-time)) + (go (method-of-object obj up)) + 0 + (none) ) ;; definition for method 31 of type drill-drop-plat diff --git a/test/decompiler/reference/jak2/levels/drill_platform/drill-obs_REF.gc b/test/decompiler/reference/jak2/levels/drill_platform/drill-obs_REF.gc index eaf171318b..fc2d2bff08 100644 --- a/test/decompiler/reference/jak2/levels/drill_platform/drill-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/drill_platform/drill-obs_REF.gc @@ -129,7 +129,7 @@ and translate the platform via the `smush` @see [[smush-control]]" (activate! (-> obj smush) -1.0 24 120 1.0 1.0 (-> self clock)) - (set! (-> obj bounce-time) (-> self clock frame-counter)) + (set! (-> obj bounce-time) (current-time)) (set! (-> obj bouncing) #t) (logclear! (-> obj mask) (process-mask sleep)) (logclear! (-> obj mask) (process-mask sleep-code)) @@ -184,7 +184,7 @@ and translate the platform via the `smush` (defstate falling (drill-plat-falling) :virtual #t :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.4)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.4)) (logclear! (-> self root-override root-prim prim-core action) (collide-action rideable)) ) (drill-plat-falling-trans) @@ -821,7 +821,7 @@ For example for an elevator pre-compute the distance between the first and last ) (when gp-0 (when (or (focus-test? (the-as process-focusable gp-0) mech) - (>= (- (-> self clock frame-counter) (-> self no-collision-timer)) + (>= (- (current-time) (-> self no-collision-timer)) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout)) ) ) @@ -865,7 +865,7 @@ For example for an elevator pre-compute the distance between the first and last (set! (-> a1-10 param 1) (the-as uint v1-32)) ) (when (send-event-function gp-0 a1-10) - (let ((v0-0 (-> self clock frame-counter))) + (let ((v0-0 (current-time))) (set! (-> self no-collision-timer) v0-0) v0-0 ) @@ -1250,21 +1250,19 @@ This commonly includes things such as: ;; definition for method 40 of type drill-switch (defmethod set-switch-color drill-switch ((obj drill-switch) (arg0 symbol)) "Set the switch color based on its state." - (with-pp - (when (or arg0 (not (logtest? (-> pp clock frame-counter) 64))) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (vector<-cspace+vector! s4-0 (-> obj node-list data 4) (new 'static 'vector :y 6963.2 :w 1.0)) - (spawn - (if arg0 - (-> obj green-part) - (-> obj part) - ) - s4-0 - ) + (when (or arg0 (not (logtest? (current-time) 64))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector<-cspace+vector! s4-0 (-> obj node-list data 4) (new 'static 'vector :y 6963.2 :w 1.0)) + (spawn + (if arg0 + (-> obj green-part) + (-> obj part) + ) + s4-0 ) ) - (none) ) + (none) ) ;; definition for method 34 of type drill-switch @@ -1423,7 +1421,7 @@ This commonly includes things such as: (sleep-code) ) (else - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (the int (* 300.0 (-> self timeout)))) + (until (>= (- (current-time) (-> self state-time)) (the int (* 300.0 (-> self timeout)))) (suspend) ) (send-event! self (-> self event-going-up)) @@ -1652,11 +1650,11 @@ This commonly includes things such as: (defstate drill-laser-idle (drill-laser) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (let* ((f0-2 (+ (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> self state-time)))) + (let* ((f0-2 (+ (* 0.0033333334 (the float (- (current-time) (-> self state-time)))) (* (-> self offset) (+ (-> self speed) (-> self pause))) ) ) diff --git a/test/decompiler/reference/jak2/levels/drill_platform/drill-panel_REF.gc b/test/decompiler/reference/jak2/levels/drill_platform/drill-panel_REF.gc index 0f238f7c58..9340490607 100644 --- a/test/decompiler/reference/jak2/levels/drill_platform/drill-panel_REF.gc +++ b/test/decompiler/reference/jak2/levels/drill_platform/drill-panel_REF.gc @@ -531,98 +531,92 @@ ;; definition for method 31 of type drill-control-panel (defmethod spawn-shock-part drill-control-panel ((obj drill-control-panel)) "Spawn shock particles." - (with-pp - (let ((v1-0 (-> obj id))) - (cond - ((or (zero? v1-0) (= v1-0 1)) - (set! (-> *part-id-table* 1852 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -4.0 4.0))) - (set! (-> *part-id-table* 1852 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -2.0 2.0))) - (set! (-> *part-id-table* 1852 init-specs 4 initial-valuef) (* 4096.0 (rand-vu-float-range 1.0 3.0))) - (when (= (-> obj id) 1) - (set! (-> *part-id-table* 1870 init-specs 3 initial-valuef) 8192.0) - (set! (-> *part-id-table* 1869 init-specs 3 initial-valuef) 8192.0) - (set! (-> *part-id-table* 1871 init-specs 2 initial-valuef) 8192.0) - (set! (-> *part-id-table* 1872 init-specs 2 initial-valuef) 8192.0) - (set! (-> *part-id-table* 1873 init-specs 2 initial-valuef) 8192.0) - (when (>= (-> pp clock frame-counter) (-> obj next-warn-time)) - (set! (-> obj next-warn-time) - (+ (-> pp clock frame-counter) (the int (* 300.0 (rand-vu-float-range 1.0 2.0)))) - ) - (set! (-> *part-id-table* 1851 init-specs 4 initial-valuef) -4096.0) - (set! (-> *part-id-table* 1851 init-specs 24 initial-valuef) (* 182.04445 (rand-vu-float-range -45.0 45.0))) - (set! (-> *part-id-table* 1851 init-specs 25 initial-valuef) (* 182.04445 (rand-vu-float-range 0.0 45.0))) - (set! (-> *part-id-table* 1851 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -3.0 3.0))) - (set! (-> *part-id-table* 1851 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 3.0))) - ) + (let ((v1-0 (-> obj id))) + (cond + ((or (zero? v1-0) (= v1-0 1)) + (set! (-> *part-id-table* 1852 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -4.0 4.0))) + (set! (-> *part-id-table* 1852 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -2.0 2.0))) + (set! (-> *part-id-table* 1852 init-specs 4 initial-valuef) (* 4096.0 (rand-vu-float-range 1.0 3.0))) + (when (= (-> obj id) 1) + (set! (-> *part-id-table* 1870 init-specs 3 initial-valuef) 8192.0) + (set! (-> *part-id-table* 1869 init-specs 3 initial-valuef) 8192.0) + (set! (-> *part-id-table* 1871 init-specs 2 initial-valuef) 8192.0) + (set! (-> *part-id-table* 1872 init-specs 2 initial-valuef) 8192.0) + (set! (-> *part-id-table* 1873 init-specs 2 initial-valuef) 8192.0) + (when (>= (current-time) (-> obj next-warn-time)) + (set! (-> obj next-warn-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 1.0 2.0))))) + (set! (-> *part-id-table* 1851 init-specs 4 initial-valuef) -4096.0) + (set! (-> *part-id-table* 1851 init-specs 24 initial-valuef) (* 182.04445 (rand-vu-float-range -45.0 45.0))) + (set! (-> *part-id-table* 1851 init-specs 25 initial-valuef) (* 182.04445 (rand-vu-float-range 0.0 45.0))) + (set! (-> *part-id-table* 1851 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -3.0 3.0))) + (set! (-> *part-id-table* 1851 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 3.0))) ) - (spawn-with-cspace (-> obj debris-part) (-> obj node-list data 18)) ) - (else - (case (-> obj id) - ((3 5 7 8) - (if (zero? (rand-vu-int-count 2)) - (process-drawable-shock-effect - obj - (new 'static 'lightning-spec - :name #f - :flags (lightning-spec-flags lsf0) - :start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) - :end-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) - :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5) - :fade-start-factor 0.2 - :texture (new 'static 'texture-id :index #x83 :page #xc) - :reduction 0.42 - :num-points 16 - :box-size 16384.0 - :merge-factor 0.5 - :merge-count 2 - :radius 2048.0 - :duration 30.0 - :sound (static-sound-spec "shock" :volume 50.0) - ) - lightning-probe-callback - (-> *part-id-table* 166) - 12 - 0 - 12288.0 + (spawn-with-cspace (-> obj debris-part) (-> obj node-list data 18)) + ) + (else + (case (-> obj id) + ((3 5 7 8) + (if (zero? (rand-vu-int-count 2)) + (process-drawable-shock-effect + obj + (new 'static 'lightning-spec + :name #f + :flags (lightning-spec-flags lsf0) + :start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + :end-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5) + :fade-start-factor 0.2 + :texture (new 'static 'texture-id :index #x83 :page #xc) + :reduction 0.42 + :num-points 16 + :box-size 16384.0 + :merge-factor 0.5 + :merge-count 2 + :radius 2048.0 + :duration 30.0 + :sound (static-sound-spec "shock" :volume 50.0) ) + lightning-probe-callback + (-> *part-id-table* 166) + 12 + 0 + 12288.0 ) - ) - (else - 0 - ) + ) + ) + (else + 0 ) - (set! (-> *part-id-table* 1852 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 3.0))) - (set! (-> *part-id-table* 1852 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -0.5 3.0))) - (set! (-> *part-id-table* 1852 init-specs 4 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 -1.25))) - (set! (-> *part-id-table* 1870 init-specs 3 initial-valuef) -6144.0) - (set! (-> *part-id-table* 1869 init-specs 3 initial-valuef) -6144.0) - (set! (-> *part-id-table* 1871 init-specs 2 initial-valuef) -6144.0) - (set! (-> *part-id-table* 1872 init-specs 2 initial-valuef) -6144.0) - (set! (-> *part-id-table* 1873 init-specs 2 initial-valuef) -6144.0) - (when (>= (-> pp clock frame-counter) (-> obj next-warn-time)) - (set! (-> obj next-warn-time) - (+ (-> pp clock frame-counter) (the int (* 300.0 (rand-vu-float-range 1.5 3.0)))) - ) - (set! (-> *part-id-table* 1851 init-specs 4 initial-valuef) 4096.0) - (set! (-> *part-id-table* 1879 init-specs 23 initial-valuef) (* 182.04445 (rand-vu-float-range -30.0 30.0))) - (set! (-> *part-id-table* 1879 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -1.5 1.5))) - (set! (-> *part-id-table* 1879 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 3.0))) - ) - (spawn-with-cspace (-> obj debris-part) (-> obj node-list data 12)) ) + (set! (-> *part-id-table* 1852 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 3.0))) + (set! (-> *part-id-table* 1852 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -0.5 3.0))) + (set! (-> *part-id-table* 1852 init-specs 4 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 -1.25))) + (set! (-> *part-id-table* 1870 init-specs 3 initial-valuef) -6144.0) + (set! (-> *part-id-table* 1869 init-specs 3 initial-valuef) -6144.0) + (set! (-> *part-id-table* 1871 init-specs 2 initial-valuef) -6144.0) + (set! (-> *part-id-table* 1872 init-specs 2 initial-valuef) -6144.0) + (set! (-> *part-id-table* 1873 init-specs 2 initial-valuef) -6144.0) + (when (>= (current-time) (-> obj next-warn-time)) + (set! (-> obj next-warn-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 1.5 3.0))))) + (set! (-> *part-id-table* 1851 init-specs 4 initial-valuef) 4096.0) + (set! (-> *part-id-table* 1879 init-specs 23 initial-valuef) (* 182.04445 (rand-vu-float-range -30.0 30.0))) + (set! (-> *part-id-table* 1879 init-specs 2 initial-valuef) (* 4096.0 (rand-vu-float-range -1.5 1.5))) + (set! (-> *part-id-table* 1879 init-specs 3 initial-valuef) (* 4096.0 (rand-vu-float-range -1.0 3.0))) + ) + (spawn-with-cspace (-> obj debris-part) (-> obj node-list data 12)) ) ) - (none) ) + (none) ) ;; failed to figure out what this is: (defstate hit (drill-control-panel) :virtual #t :enter (behavior ((arg0 symbol)) - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self next-warn-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self next-warn-time) (current-time)) (process-entity-status! self (entity-perm-status bit-12) #t) (set! (-> self draw force-lod) 0) (logior! (-> self focus-status) (focus-status disable dead ignore)) @@ -633,7 +627,7 @@ (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (>= (- (current-time) (-> self state-time)) (seconds 1)) (spawn-shock-part self) ) (none) diff --git a/test/decompiler/reference/jak2/levels/drill_platform/ginsu_REF.gc b/test/decompiler/reference/jak2/levels/drill_platform/ginsu_REF.gc index 8ecb8ebe8a..42408ae512 100644 --- a/test/decompiler/reference/jak2/levels/drill_platform/ginsu_REF.gc +++ b/test/decompiler/reference/jak2/levels/drill_platform/ginsu_REF.gc @@ -420,61 +420,59 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (with-pp - (ginsu-method-180 obj) - (let ((t9-1 (method-of-type nav-enemy track-target!))) - (t9-1 obj) - ) - (cond - ((not (and (-> obj next-state) (let ((v1-6 (-> obj next-state name))) - (or (= v1-6 'idle) - (= v1-6 'active) - (= v1-6 'dormant) - (= v1-6 'ambush) - (= v1-6 'knocked) - (= v1-6 'idle) - (= v1-6 'dormant) - (= v1-6 'die) - (= v1-6 'die-falling) - ) - ) - ) - ) - (sound-play "ginsu-loop" :id (the-as sound-id (-> obj blade-sound)) :position (-> obj root-override2 trans)) - (set! (-> obj blade-sound-playing) #t) - ) - ((-> obj blade-sound-playing) - (sound-stop (the-as sound-id (-> obj blade-sound))) - (set! (-> obj blade-sound-playing) #f) - ) - ) - (cond - ((and (not (and (-> obj next-state) (let ((v1-17 (-> obj next-state name))) - (or (= v1-17 'idle) - (= v1-17 'active) - (= v1-17 'dormant) - (= v1-17 'ambush) - (= v1-17 'knocked) - (= v1-17 'idle) - (= v1-17 'dormant) - (= v1-17 'die) - (= v1-17 'die-falling) - ) - ) - ) - ) - (< (- (-> pp clock frame-counter) (-> obj grind-timer)) 0) - ) - (sound-play "ginsu-grind" :id (the-as sound-id (-> obj grind-sound)) :position (-> obj root-override2 trans)) - (set! (-> obj grind-sound-playing) #t) - ) - ((-> obj grind-sound-playing) - (sound-stop (the-as sound-id (-> obj grind-sound))) - (set! (-> obj grind-sound-playing) #f) - ) - ) - (none) + (ginsu-method-180 obj) + (let ((t9-1 (method-of-type nav-enemy track-target!))) + (t9-1 obj) ) + (cond + ((not (and (-> obj next-state) (let ((v1-6 (-> obj next-state name))) + (or (= v1-6 'idle) + (= v1-6 'active) + (= v1-6 'dormant) + (= v1-6 'ambush) + (= v1-6 'knocked) + (= v1-6 'idle) + (= v1-6 'dormant) + (= v1-6 'die) + (= v1-6 'die-falling) + ) + ) + ) + ) + (sound-play "ginsu-loop" :id (the-as sound-id (-> obj blade-sound)) :position (-> obj root-override2 trans)) + (set! (-> obj blade-sound-playing) #t) + ) + ((-> obj blade-sound-playing) + (sound-stop (the-as sound-id (-> obj blade-sound))) + (set! (-> obj blade-sound-playing) #f) + ) + ) + (cond + ((and (not (and (-> obj next-state) (let ((v1-17 (-> obj next-state name))) + (or (= v1-17 'idle) + (= v1-17 'active) + (= v1-17 'dormant) + (= v1-17 'ambush) + (= v1-17 'knocked) + (= v1-17 'idle) + (= v1-17 'dormant) + (= v1-17 'die) + (= v1-17 'die-falling) + ) + ) + ) + ) + (< (- (current-time) (-> obj grind-timer)) 0) + ) + (sound-play "ginsu-grind" :id (the-as sound-id (-> obj grind-sound)) :position (-> obj root-override2 trans)) + (set! (-> obj grind-sound-playing) #t) + ) + ((-> obj grind-sound-playing) + (sound-stop (the-as sound-id (-> obj grind-sound))) + (set! (-> obj grind-sound-playing) #f) + ) + ) + (none) ) ;; definition for method 182 of type ginsu @@ -608,7 +606,7 @@ (vector-float*! s5-1 s5-1 0.5) (spawn (-> obj part) s5-1) ) - (set! v0-1 (+ (-> pp clock frame-counter) (seconds 0.125))) + (set! v0-1 (+ (current-time) (seconds 0.125))) (set! (-> obj grind-timer) (the-as time-frame v0-1)) v0-1 ) @@ -691,8 +689,8 @@ (set! (-> self enemy-flags) (the-as enemy-flag (logxor (shl 256 32) (the-as int (-> self enemy-flags))))) ) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag enemy-flag41)))) - (set! (-> self starting-time) (-> self clock frame-counter)) - (set! (-> self spiral-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) + (set! (-> self spiral-time) (current-time)) (set! (-> self desired-distance) (vector-length (ginsu-method-181 self (new 'stack-no-clear 'vector)))) (none) ) @@ -725,7 +723,7 @@ 0.0 (set! (-> s5-0 y) 0.0) (let* ((f0-3 (vector-normalize-ret-len! s5-0 1.0)) - (f1-1 (- 1.0 (* 0.0016666667 (the float (- (-> self clock frame-counter) (-> self spiral-time)))))) + (f1-1 (- 1.0 (* 0.0016666667 (the float (- (current-time) (-> self spiral-time)))))) (f2-3 (fmax 12288.0 (* 102400.0 f1-1))) (f0-4 (- f0-3 (fmin (fmax 12288.0 (* 122880.0 f1-1)) (fmax f2-3 (-> self desired-distance))))) (f30-0 (fmin 8192.0 (fmax -8192.0 f0-4))) @@ -766,7 +764,7 @@ (set! (-> v1-4 target-speed) 8192.0) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (ja-channel-push! 1 (seconds 0.2)) (ja :group! ginsu-idle-ja :num! min) (none) @@ -792,7 +790,7 @@ (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (go-virtual circling) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.75)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.75)) (go-virtual attack) ) (ja :num! (loop!)) @@ -841,7 +839,7 @@ (set! (-> v1-10 target-speed) 49152.0) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (ja :group! ginsu-attack-ja :num! min) (none) ) diff --git a/test/decompiler/reference/jak2/levels/forest/forest-obs_REF.gc b/test/decompiler/reference/jak2/levels/forest/forest-obs_REF.gc index 8a67554336..6d743b1bc7 100644 --- a/test/decompiler/reference/jak2/levels/forest/forest-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/forest/forest-obs_REF.gc @@ -173,7 +173,7 @@ This commonly includes things such as: ) ) (when (and (nonzero? (-> self focus-disable-timer)) - (< (the-as time-frame (-> self focus-disable-timer)) (-> self clock frame-counter)) + (< (the-as time-frame (-> self focus-disable-timer)) (current-time)) ) (logclear! (-> self focus-status) (focus-status disable)) (set! (-> self focus-disable-timer) (the-as uint 0)) @@ -309,7 +309,7 @@ This commonly includes things such as: (sound-play "samos-impact") (set! (-> self falling?) (the-as basic #t)) (logior! (-> self focus-status) (focus-status disable)) - (set! (-> self focus-disable-timer) (the-as uint (+ (-> self clock frame-counter) (seconds 3.5)))) + (set! (-> self focus-disable-timer) (the-as uint (+ (current-time) (seconds 3.5)))) (none) ) :code (behavior () @@ -423,8 +423,8 @@ This commonly includes things such as: ) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 2)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 2)) (suspend) ) ) @@ -695,9 +695,9 @@ This commonly includes things such as: TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (set! (-> self start-time) (-> self clock frame-counter)) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.5)) + (set! (-> self start-time) (current-time)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.5)) (suspend) ) ) @@ -769,8 +769,8 @@ This commonly includes things such as: ) ) ) - (let ((s3-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-0) (seconds 15)) + (let ((s3-0 (current-time))) + (until (>= (- (current-time) s3-0) (seconds 15)) (suspend) ) ) @@ -807,8 +807,8 @@ This commonly includes things such as: ) ) (dotimes (s3-1 3) - (let ((s2-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s2-0) (seconds 10)) + (let ((s2-0 (current-time))) + (until (>= (- (current-time) s2-0) (seconds 10)) (suspend) ) ) @@ -844,8 +844,8 @@ This commonly includes things such as: ) ) ) - (let ((s2-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s2-1) (seconds 10)) + (let ((s2-1 (current-time))) + (until (>= (- (current-time) s2-1) (seconds 10)) (suspend) ) ) @@ -882,8 +882,8 @@ This commonly includes things such as: ) ) ) - (let ((s3-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-2) (seconds 10)) + (let ((s3-2 (current-time))) + (until (>= (- (current-time) s3-2) (seconds 10)) (suspend) ) ) @@ -919,8 +919,8 @@ This commonly includes things such as: ) ) ) - (let ((s3-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-3) (seconds 10)) + (let ((s3-3 (current-time))) + (until (>= (- (current-time) s3-3) (seconds 10)) (suspend) ) ) @@ -933,8 +933,8 @@ This commonly includes things such as: (goto cfg-74) ) ) - (let ((s2-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s2-2) (seconds 1)) + (let ((s2-2 (current-time))) + (until (>= (- (current-time) s2-2) (seconds 1)) (suspend) ) ) @@ -1012,23 +1012,23 @@ This commonly includes things such as: ) ) ) - (let ((s3-5 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-5) (seconds 1)) + (let ((s3-5 (current-time))) + (until (>= (- (current-time) s3-5) (seconds 1)) (suspend) ) ) ) ) - (let ((s4-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-1) (seconds 0.5)) + (let ((s4-1 (current-time))) + (until (>= (- (current-time) s4-1) (seconds 0.5)) (suspend) ) ) (set-setting! 'entity-name "camera-260" 0.0 0) (set-setting! 'process-mask 'set 0.0 (process-mask movie enemy)) (process-grab? *target* #f) - (let ((s4-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-2) (seconds 0.5)) + (let ((s4-2 (current-time))) + (until (>= (- (current-time) s4-2) (seconds 0.5)) (suspend) ) ) @@ -1038,8 +1038,8 @@ This commonly includes things such as: ) 'leave ) - (let ((s5-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-1) (seconds 0.2)) + (let ((s5-1 (current-time))) + (until (>= (- (current-time) s5-1) (seconds 0.2)) (suspend) ) ) @@ -1050,16 +1050,16 @@ This commonly includes things such as: 'leave ) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 3)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 3)) (suspend) ) ) (remove-setting! 'entity-name) (remove-setting! 'process-mask) (process-release? *target*) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 3)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 3)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/forest/lifeseed/protect_REF.gc b/test/decompiler/reference/jak2/levels/forest/lifeseed/protect_REF.gc index 655be73934..b68cb2e229 100644 --- a/test/decompiler/reference/jak2/levels/forest/lifeseed/protect_REF.gc +++ b/test/decompiler/reference/jak2/levels/forest/lifeseed/protect_REF.gc @@ -480,9 +480,7 @@ This commonly includes things such as: (let ((f0-7 (vector-vector-xz-distance (target-pos 0) (-> s5-1 t-pos)))) (cond ((and (< f0-7 327680.0) (< 204800.0 f0-7)) - (when (and (not (handle->process (-> self slave gp-1))) - (< (the int (-> self data-float gp-1)) (-> self clock frame-counter)) - ) + (when (and (not (handle->process (-> self slave gp-1))) (< (the int (-> self data-float gp-1)) (current-time))) (let ((s4-2 (new 'stack-no-clear 'transport-params))) (let ((s3-2 (new 'stack-no-clear 'vector))) (set! (-> s3-2 quad) (-> s5-1 t-pos quad)) @@ -531,7 +529,7 @@ This commonly includes things such as: s5-4 ) ) - (set! (-> self data-float gp-1) (the float (+ (-> self clock frame-counter) (seconds 20)))) + (set! (-> self data-float gp-1) (the float (+ (current-time) (seconds 20)))) ) ) ) @@ -576,8 +574,8 @@ This commonly includes things such as: (lambda :behavior task-manager () (send-event (handle->process (-> self arrow)) 'leave) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) (talker-spawn-func (-> *talker-speech* 185) *entity-pool* (target-pos 0) (the-as region #f)) diff --git a/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc b/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc index 6a529a772d..297d921280 100644 --- a/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc +++ b/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc @@ -216,32 +216,30 @@ ;; WARN: Return type mismatch int vs none. (defmethod track-how-long-aimed-at! pegasus ((obj pegasus)) "Updates `targetted-timer` with the `frame-counter` while Jak is aiming at the [[pegasus]]" - (with-pp - (let ((target *target*)) - (when (and target (-> target gun active?)) - (let ((inaccuracy-dir (new 'stack-no-clear 'vector)) - (inaccuracy-vec (new 'stack-no-clear 'vector)) + (let ((target *target*)) + (when (and target (-> target gun active?)) + (let ((inaccuracy-dir (new 'stack-no-clear 'vector)) + (inaccuracy-vec (new 'stack-no-clear 'vector)) + ) + (vector-! inaccuracy-dir (-> obj root-override2 trans) (-> target gun fire-point)) + (vector+float*! + inaccuracy-vec + (-> target gun fire-point) + (-> target gun fire-dir-out) + (vector-length inaccuracy-dir) + ) + (let ((inaccuracy-mag (vector-vector-distance-squared inaccuracy-vec (-> obj root-override2 trans))) + (threshold 20480.0) + ) + (if (< inaccuracy-mag (* threshold threshold)) + (set! (-> obj targetted-timer) (current-time)) ) - (vector-! inaccuracy-dir (-> obj root-override2 trans) (-> target gun fire-point)) - (vector+float*! - inaccuracy-vec - (-> target gun fire-point) - (-> target gun fire-dir-out) - (vector-length inaccuracy-dir) - ) - (let ((inaccuracy-mag (vector-vector-distance-squared inaccuracy-vec (-> obj root-override2 trans))) - (threshold 20480.0) - ) - (if (< inaccuracy-mag (* threshold threshold)) - (set! (-> obj targetted-timer) (-> pp clock frame-counter)) - ) - ) ) ) ) - 0 - (none) ) + 0 + (none) ) ;; definition for method 57 of type pegasus @@ -250,53 +248,49 @@ "Checks a variety of criteria to determine the level of awareness the enemy is of the target. Sets `aware` and related fields as well! For pegasus, it will call [[enemy::57]] only if the [[pegasus]] has been targetted for more than 5 [[seconds]] @returns the value from [[enemy::57]], otherwise [[enemy-aware::4]]" - (with-pp - (the-as enemy-aware (if (>= (- (-> pp clock frame-counter) (-> obj targetted-timer)) (seconds 5)) - (the-as int ((method-of-type enemy update-target-awareness!) obj proc focus)) - 4 - ) - ) - ) + (the-as enemy-aware (if (>= (- (current-time) (-> obj targetted-timer)) (seconds 5)) + (the-as int ((method-of-type enemy update-target-awareness!) obj proc focus)) + 4 + ) + ) ) ;; definition for method 74 of type pegasus (defmethod general-event-handler pegasus ((obj pegasus) (proc process) (arg2 int) (event-type symbol) (event 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" - (with-pp - (case event-type - (('track) - #f - ) - (('hit 'hit-knocked) - (cond - ((zero? (-> obj hit-points)) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) - (logior! (-> obj focus-status) (focus-status hit)) - (if (zero? (-> obj hit-points)) - (logior! (-> obj focus-status) (focus-status dead)) - ) - (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) - (enemy-method-62 obj) - (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (process-contact-action proc) - (send-event proc 'get-attack-count 1) - (kill-prefer-falling obj) - ) - (else - (let ((v0-0 (the-as object (-> pp clock frame-counter)))) - (set! (-> obj targetted-timer) (the-as time-frame v0-0)) - v0-0 - ) + (case event-type + (('track) + #f + ) + (('hit 'hit-knocked) + (cond + ((zero? (-> obj hit-points)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) + ) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (process-contact-action proc) + (send-event proc 'get-attack-count 1) + (kill-prefer-falling obj) + ) + (else + (let ((v0-0 (the-as object (current-time)))) + (set! (-> obj targetted-timer) (the-as time-frame v0-0)) + v0-0 ) ) ) - (else - ((method-of-type enemy general-event-handler) obj proc arg2 event-type event) - ) + ) + (else + ((method-of-type enemy general-event-handler) obj proc arg2 event-type event) ) ) ) @@ -307,20 +301,18 @@ For pegasus, it will call [[enemy::57]] only if the [[pegasus]] has been targett This is why the scouts are technically killable by other means @returns the amount of damage taken from an attack. Also updates the `targetted-timer`. @see [[*pegasus-enemy-info*]]" - (with-pp - (let ((hitpoints 1)) - (let ((attack-info (the-as attack-info (-> arg1 param 1)))) - (case (-> arg1 message) - (('attack) - (if (and (logtest? (-> attack-info mask) (attack-info-mask mode)) (= (-> attack-info mode) 'board)) - (set! hitpoints (-> obj hit-points)) - ) - ) - ) + (let ((hitpoints 1)) + (let ((attack-info (the-as attack-info (-> arg1 param 1)))) + (case (-> arg1 message) + (('attack) + (if (and (logtest? (-> attack-info mask) (attack-info-mask mode)) (= (-> attack-info mode) 'board)) + (set! hitpoints (-> obj hit-points)) + ) + ) ) - (set! (-> obj targetted-timer) (-> pp clock frame-counter)) - hitpoints ) + (set! (-> obj targetted-timer) (current-time)) + hitpoints ) ) @@ -604,7 +596,7 @@ There are many fail-safes here if something goes wrong to try to keep the pegasu @param explicit-y-vel Normally `0.0` but this value is used when the pegasus needs to switch direction @param adjust-y-offset? Normally [[#f]] which forces the movement to reflect the result of the collison query - the [[pegasus]] will stay close to the ground. [[#t]] ignores this" (+! (-> self curve-position) - (/ (the float (* (- (-> self clock frame-counter) (-> self clock old-frame-counter)) (the int (-> self speed)))) + (/ (the float (* (- (current-time) (-> self clock old-frame-counter)) (the int (-> self speed)))) (total-distance (-> self path-info (-> self current-path) path-data)) ) ) @@ -706,7 +698,7 @@ This function also is what causes the pegasus to flip around (interpolant (- 1.0 (fmax 0.0 (fmin 1.0 dist-from-target)))) (interpolated-speed (lerp min-speed max-speed interpolant)) ) - (if (< (- (-> self clock frame-counter) (-> self targetted-timer)) (seconds 5)) + (if (< (- (current-time) (-> self targetted-timer)) (seconds 5)) (set! interpolated-speed (fmax 163840.0 interpolated-speed)) ) (let ((movement-speed (* 0.0033333334 interpolated-speed))) @@ -877,7 +869,7 @@ The faster it's moving the fast it flaps it's wings, etc (defstate stare (pegasus) :virtual #t :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((awareness (-> self focus aware))) (cond ((and (>= 1 (the-as int awareness)) @@ -925,10 +917,7 @@ The faster it's moving the fast it flaps it's wings, etc "Handles the flying animations and sounds @TODO - cleanup a bit more" (let ((anim-speed (pegasus-calc-anim-speed))) - (let ((gp-0 - (and (-> self can-run) (< (the-as time-frame (-> self ambient-possible)) (-> self clock frame-counter))) - ) - ) + (let ((gp-0 (and (-> self can-run) (< (the-as time-frame (-> self ambient-possible)) (current-time))))) (let* ((min-dist (lerp-scale 61440.0 32768.0 (the float arg0) 0.0 3000.0)) (min-speed (lerp-scale 122880.0 81920.0 (the float arg0) 0.0 3000.0)) (s4-0 (pegasus-calc-speed min-dist 122880.0 min-speed 49152.0)) @@ -1001,7 +990,7 @@ The faster it's moving the fast it flaps it's wings, etc ((let ((v1-72 (ja-group))) (and v1-72 (= v1-72 pegasus-run-ja)) ) - (if (or (not (-> self can-run)) (< (the-as time-frame (-> self ambient-expire)) (-> self clock frame-counter))) + (if (or (not (-> self can-run)) (< (the-as time-frame (-> self ambient-expire)) (current-time))) (ja :group! pegasus-run-to-fly-ja) ) (ja :num-func num-func-identity :frame-num 0.0) @@ -1010,7 +999,7 @@ The faster it's moving the fast it flaps it's wings, etc (ja-channel-push! 1 (seconds 0.125)) (ja :group! pegasus-fly-to-run-ja) (ja :num-func num-func-identity :frame-num 0.0) - (let* ((s5-4 (-> self clock frame-counter)) + (let* ((s5-4 (current-time)) (f30-1 300.0) (f28-1 2.0) (f26-0 3.0) @@ -1091,8 +1080,8 @@ The faster it's moving the fast it flaps it's wings, etc (func) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self far-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self far-time) (current-time)) (set-setting! 'sound-mode #f 0.0 1) (none) ) @@ -1117,24 +1106,22 @@ The faster it's moving the fast it flaps it's wings, etc (not (logtest? (focus-status teleporting) (-> *target* focus-status))) ) ) - (set! (-> self state-time) - (the-as time-frame (max (+ (-> self clock frame-counter) (seconds -10)) (-> self state-time))) - ) + (set! (-> self state-time) (the-as time-frame (max (+ (current-time) (seconds -10)) (-> self state-time)))) ) (else - (+! (-> self state-time) (* 10 (- (-> self clock frame-counter) (-> self far-time)))) - (if (>= (-> self state-time) (-> self clock frame-counter)) + (+! (-> self state-time) (* 10 (- (current-time) (-> self far-time)))) + (if (>= (-> self state-time) (current-time)) (go-virtual flee) ) ) ) - (set! (-> self far-time) (-> self clock frame-counter)) + (set! (-> self far-time) (current-time)) (none) ) :code (behavior () (until #f (set! (-> self y-offset-desired) 0.0) - (pegasus-fly-code (the-as int (- (-> self clock frame-counter) (-> self state-time)))) + (pegasus-fly-code (the-as int (- (current-time) (-> self state-time)))) (suspend) ) #f @@ -1153,7 +1140,7 @@ The faster it's moving the fast it flaps it's wings, etc ) ) (set! (-> self near-timer) 3000) - (set! (-> self far-time) (-> self clock frame-counter)) + (set! (-> self far-time) (current-time)) (set-setting! 'sound-mode #f 0.0 1) (none) ) @@ -1180,16 +1167,15 @@ The faster it's moving the fast it flaps it's wings, etc (not (logtest? (focus-status teleporting) (-> *target* focus-status))) ) ) - (set! (-> self near-timer) (- (the-as time-frame (-> self near-timer)) - (- (-> self clock frame-counter) (-> self clock old-frame-counter)) - ) + (set! (-> self near-timer) + (- (the-as time-frame (-> self near-timer)) (- (current-time) (-> self clock old-frame-counter))) ) (if (<= (-> self near-timer) 0) (go pegasus-tired) ) - (set! (-> self far-time) (-> self clock frame-counter)) + (set! (-> self far-time) (current-time)) ) - (if (>= (- (-> self clock frame-counter) (-> self far-time)) (seconds 3)) + (if (>= (- (current-time) (-> self far-time)) (seconds 3)) (set! (-> self near-timer) (the-as int (-> self timeout))) ) (none) @@ -1526,7 +1512,7 @@ The faster it's moving the fast it flaps it's wings, etc (lambda :behavior task-manager () (local-vars (data int)) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-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)) diff --git a/test/decompiler/reference/jak2/levels/forest/predator_REF.gc b/test/decompiler/reference/jak2/levels/forest/predator_REF.gc index badb085a80..56620b56c7 100644 --- a/test/decompiler/reference/jak2/levels/forest/predator_REF.gc +++ b/test/decompiler/reference/jak2/levels/forest/predator_REF.gc @@ -468,23 +468,21 @@ (defmethod general-event-handler predator ((obj predator) (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" - (with-pp - (case arg2 - (('attack) - (set! (-> obj shock-effect-end) (the-as uint (+ (-> pp clock frame-counter) (seconds 1)))) - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + (case arg2 + (('attack) + (set! (-> obj shock-effect-end) (the-as uint (+ (current-time) (seconds 1)))) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (('death-end) + (when (nonzero? (-> obj ambient-sound-id)) + (sound-stop (-> obj ambient-sound-id)) + (set! (-> obj ambient-sound-id) (new 'static 'sound-id)) + 0 ) - (('death-end) - (when (nonzero? (-> obj ambient-sound-id)) - (sound-stop (-> obj ambient-sound-id)) - (set! (-> obj ambient-sound-id) (new 'static 'sound-id)) - 0 - ) - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -918,9 +916,9 @@ (if (< 245760.0 (vector-vector-distance (-> obj root-override2 trans) (camera-pos))) (setup-masks (-> obj draw) 0 8) ) - (when (< (-> pp clock frame-counter) (the-as time-frame (-> obj shock-effect-end))) - (when (>= (- (-> pp clock frame-counter) (-> obj shock-effect-time)) (seconds 0.04)) - (set! (-> obj shock-effect-time) (-> pp clock frame-counter)) + (when (< (current-time) (the-as time-frame (-> obj shock-effect-end))) + (when (>= (- (current-time) (-> obj shock-effect-time)) (seconds 0.04)) + (set! (-> obj shock-effect-time) (current-time)) (process-drawable-shock-skel-effect obj (-> *lightning-spec-id-table* 18) @@ -1135,14 +1133,14 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior predator) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) ) 0 (set! (-> self next-change) - (the-as uint (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 2.0 5.0))))) + (the-as uint (+ (current-time) (the int (* 300.0 (rand-vu-float-range 2.0 5.0))))) ) (none) ) @@ -1168,7 +1166,7 @@ ) ) ) - (if (< (the-as time-frame (-> self next-change)) (-> self clock frame-counter)) + (if (< (the-as time-frame (-> self next-change)) (current-time)) (go-virtual hide) ) (none) @@ -1212,7 +1210,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior predator) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-166 self) (let ((v1-4 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-4 enemy-flags))) @@ -1238,7 +1236,7 @@ ) (go-virtual hostile) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (check-los? (-> self los) 0) (not (logtest? (-> self draw status) (draw-control-status on-screen))) ) @@ -1255,7 +1253,7 @@ (set! (-> a0-12 target-post quad) (-> v1-30 quad)) ) 0 - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (logtest? (-> self nav state flags) (nav-state-flag at-target)) ) (go-virtual hidden) @@ -1293,9 +1291,9 @@ ) ) (set! (-> self want-stop) #f) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self next-change) - (the-as uint (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 4.0 8.0))))) + (the-as uint (+ (current-time) (the int (* 300.0 (rand-vu-float-range 4.0 8.0))))) ) (if (zero? (get-rand-int self 3)) (sound-play "pred-talk") @@ -1308,7 +1306,7 @@ (t9-0) ) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 5)) (go-virtual hide) ) (let ((gp-0 (handle->process (-> self focus handle)))) @@ -1316,7 +1314,7 @@ (go-virtual active) ) (when (get-enemy-target self) - (when (and gp-0 (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time))) + (when (and gp-0 (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (let ((f0-0 (vector-vector-xz-distance (get-trans (the-as process-focusable gp-0) 0) (-> self root-override2 trans)) ) diff --git a/test/decompiler/reference/jak2/levels/forest/wren_REF.gc b/test/decompiler/reference/jak2/levels/forest/wren_REF.gc index 280ddd32ce..17e1d1cd86 100644 --- a/test/decompiler/reference/jak2/levels/forest/wren_REF.gc +++ b/test/decompiler/reference/jak2/levels/forest/wren_REF.gc @@ -214,13 +214,13 @@ If so, it transitions from [[wren::peck]] to [[wren::hunt]]" (defstate peck (wren) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self peck-timer) (the-as uint (the int (* 300.0 (rand-vu-float-range 1.4 4.3))))) (set! (-> self flags) (logand -7 (-> self flags))) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self peck-timer))) + (when (>= (- (current-time) (-> self state-time)) (the-as time-frame (-> self peck-timer))) (let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-dest) (-> self root trans)))) (if (< (fabs (deg-diff (quaternion-y-angle (-> self root quat)) (vector-y-angle gp-1))) 728.1778) (go-virtual hunt) @@ -262,23 +262,23 @@ If so, it transitions from [[wren::peck]] to [[wren::hunt]]" (set! v1-33 v1-33) (cmove-#f-zero v1-34 v1-33 v1-33) ) - (let ((gp-1 (-> self clock frame-counter)) + (let ((gp-1 (current-time)) (s5-1 (the int (* 300.0 (rand-vu-float-range 0.1 0.6)))) (f30-1 1.0) ) (ja-no-eval :group! wren-idle-ja :num! (loop! f30-1) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-1) s5-1) + (until (>= (- (current-time) gp-1) s5-1) (suspend) (ja :num! (loop! f30-1)) ) ) (logior! (-> self flags) 1) - (let ((gp-2 (-> self clock frame-counter)) + (let ((gp-2 (current-time)) (s5-2 (the int (* 300.0 (rand-vu-float-range 0.2 1.5)))) (f30-3 1.0) ) (ja-no-eval :group! wren-idle-ja :num! (loop! f30-3) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-2) s5-2) + (until (>= (- (current-time) gp-2) s5-2) (suspend) (ja :num! (loop! f30-3)) ) @@ -319,12 +319,12 @@ If so, it transitions from [[wren::peck]] to [[wren::hunt]]" (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter)) + (let ((gp-0 (current-time)) (s5-0 240) (f30-0 2.0) ) (ja-no-eval :group! wren-takeoff-ja :num! (loop! f30-0) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-0) s5-0) + (until (>= (- (current-time) gp-0) s5-0) (suspend) (ja :num! (loop! f30-0)) ) @@ -421,7 +421,7 @@ If so, it transitions from [[wren::peck]] to [[wren::hunt]]" :trans (behavior () (let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-dest) (-> self root trans)))) (when (< (fabs (deg-diff (quaternion-y-angle (-> self root quat)) (vector-y-angle gp-1))) 728.1778) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self peck-timer))) + (when (>= (- (current-time) (-> self state-time)) (the-as time-frame (-> self peck-timer))) (set! (-> self fly-index) (logand (+ (-> self fly-index) 1) 1)) (go-virtual fly) ) @@ -432,23 +432,23 @@ If so, it transitions from [[wren::peck]] to [[wren::hunt]]" :code (behavior () (set! (-> self flags) (logand -2 (-> self flags))) (ja-channel-push! 1 (seconds 0.2)) - (let ((gp-0 (-> self clock frame-counter)) + (let ((gp-0 (current-time)) (s5-0 (the int (* 300.0 (rand-vu-float-range 4.2 16.8)))) (f30-1 1.0) ) (ja-no-eval :group! wren-idle-ja :num! (loop! f30-1) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-0) s5-0) + (until (>= (- (current-time) gp-0) s5-0) (suspend) (ja :num! (loop! f30-1)) ) ) (logior! (-> self flags) 1) - (let ((gp-1 (-> self clock frame-counter)) + (let ((gp-1 (current-time)) (s5-1 600) (f30-2 1.0) ) (ja-no-eval :group! wren-idle-ja :num! (loop! f30-2) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-1) s5-1) + (until (>= (- (current-time) gp-1) s5-1) (suspend) (ja :num! (loop! f30-2)) ) diff --git a/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fordumpa-obs_REF.gc b/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fordumpa-obs_REF.gc index ae86921b46..098d03416a 100644 --- a/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fordumpa-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fordumpa-obs_REF.gc @@ -70,16 +70,16 @@ :virtual #t :event (-> (method-of-type fort-elec-switch idle) event) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 16)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 16)) (suspend) ) ) (until (logtest? (-> self draw status) (draw-control-status on-screen)) (suspend) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.4)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.4)) (suspend) ) ) @@ -162,8 +162,8 @@ ) ) (sound-play "elec-switch") - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 0.5)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 0.5)) (suspend) ) ) @@ -198,8 +198,8 @@ ) ) ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.75)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 0.75)) (suspend) ) ) @@ -218,8 +218,8 @@ ) ) ) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 1.5)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 1.5)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fordumpb-obs_REF.gc b/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fordumpb-obs_REF.gc index 2603b3c710..ed62bcb8e8 100644 --- a/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fordumpb-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fordumpb-obs_REF.gc @@ -335,7 +335,7 @@ This commonly includes things such as: (none) ) :trans (behavior () - (when (>= (-> self clock frame-counter) (-> self next-spawn-time)) + (when (>= (current-time) (-> self next-spawn-time)) (process-spawn fort-plat-shuttle-plat 0 :to self) (set! (-> self next-spawn-time) (get-timeframe-offset! (-> self sync) 0)) ) @@ -346,24 +346,22 @@ This commonly includes things such as: ;; definition for method 22 of type fort-plat-shuttle (defmethod fort-plat-shuttle-method-22 fort-plat-shuttle ((obj fort-plat-shuttle)) - (with-pp - (let* ((f28-0 (total-distance (-> obj path))) - (s5-0 (-> obj sync)) - (f26-0 81.92) - (a0-3 (- (-> pp clock frame-counter) (get-timeframe-offset! s5-0 0))) - (v1-6 (-> s5-0 period)) - (f30-0 (/ (* f26-0 (the float a0-3)) f28-0)) - (f28-1 (/ (* f26-0 (the float v1-6)) f28-0)) - ) - (while (>= 1.0 f30-0) - (if (>= f30-0 0.0) - (process-spawn fort-plat-shuttle-plat f30-0 :to obj) - ) - (+! f30-0 f28-1) - ) + (let* ((f28-0 (total-distance (-> obj path))) + (s5-0 (-> obj sync)) + (f26-0 81.92) + (a0-3 (- (current-time) (get-timeframe-offset! s5-0 0))) + (v1-6 (-> s5-0 period)) + (f30-0 (/ (* f26-0 (the float a0-3)) f28-0)) + (f28-1 (/ (* f26-0 (the float v1-6)) f28-0)) + ) + (while (>= 1.0 f30-0) + (if (>= f30-0 0.0) + (process-spawn fort-plat-shuttle-plat f30-0 :to obj) + ) + (+! f30-0 f28-1) ) - #f ) + #f ) ;; definition for method 11 of type fort-plat-shuttle diff --git a/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fordumpc-obs_REF.gc b/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fordumpc-obs_REF.gc index 1320d45312..bc2315def4 100644 --- a/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fordumpc-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fordumpc-obs_REF.gc @@ -155,8 +155,8 @@ ) ) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 0.5)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 0.5)) (suspend) ) ) @@ -403,8 +403,8 @@ This commonly includes things such as: (-> gp-2 ppointer) ) ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 1)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 1)) (suspend) ) ) @@ -605,8 +605,8 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 8)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 8)) (suspend) ) ) @@ -614,15 +614,15 @@ This commonly includes things such as: (suspend) ) (when (= (-> self bomb-count) 4) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.4)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.4)) (suspend) ) ) (add-process *gui-control* self (gui-channel daxter) (gui-action play) "ds017" -99.0 0) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 20)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 20)) (suspend) ) ) @@ -630,14 +630,14 @@ This commonly includes things such as: (add-process *gui-control* self (gui-channel daxter) (gui-action play) "ds018" -99.0 0) ) (while (> (-> self bomb-count) 0) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.2)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 0.2)) (suspend) ) ) ) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 0.8)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 0.8)) (suspend) ) ) @@ -687,8 +687,8 @@ This commonly includes things such as: ) ) (set-fordumpc-light-flag! #t) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.2)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.2)) (suspend) ) ) @@ -698,8 +698,8 @@ This commonly includes things such as: (set-setting! 'entity-name "camera-182" 0.0 0) (set-setting! 'process-mask 'set 0.0 (process-mask movie enemy)) (task-node-close! (game-task-node fortress-dump-missile)) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.75)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.75)) (suspend) ) ) @@ -733,8 +733,8 @@ This commonly includes things such as: ) ) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 1.5)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 1.5)) (suspend) ) ) @@ -760,8 +760,8 @@ This commonly includes things such as: (set! (-> *game-info* timer) 0) (set! (-> self hud) (ppointer->handle (process-spawn hud-timer :init hud-init-by-other :to *target*))) ) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 0.4)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 0.4)) (suspend) ) ) @@ -770,8 +770,8 @@ This commonly includes things such as: ) (dotimes (gp-5 10) (set! (-> *game-info* timer) (the-as time-frame (- 3000 (the int (* 300.0 (the float gp-5)))))) - (let ((s5-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-0) (seconds 1)) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) (seconds 1)) (suspend) ) ) @@ -826,8 +826,8 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.4)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.4)) (suspend) ) ) @@ -998,13 +998,13 @@ This commonly includes things such as: (set! (-> s5-3 trans w) 1.0) (spawn-with-matrix (-> self part-doom) s5-3) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.2)) (suspend) ) ) - (let ((gp-5 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-5) (seconds 10)) + (let ((gp-5 (current-time))) + (until (>= (- (current-time) gp-5) (seconds 10)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fort-robotank-turret_REF.gc b/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fort-robotank-turret_REF.gc index 0077e7382f..37207252b3 100644 --- a/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fort-robotank-turret_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fort-robotank-turret_REF.gc @@ -170,7 +170,7 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('trigger) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (go-virtual active) ) (('die) @@ -248,7 +248,7 @@ ) :code (behavior () (until #f - (when (and (not (paused?)) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1))) + (when (and (not (paused?)) (>= (- (current-time) (-> self state-time)) (seconds 1))) (seek! (-> self anim-frame) 0.0 (* 0.2 (-> self clock time-adjust-ratio))) (seek! (-> self transition) 1.0 (* 0.01 (-> self clock time-adjust-ratio))) ) @@ -304,8 +304,8 @@ (defstate die (fort-roboscreen) :virtual #t :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (seek! (-> self transition) 0.0 (-> self clock seconds-per-frame)) (set-roboscreen-alpha! (-> self transition)) (suspend) @@ -589,7 +589,7 @@ (none) ) :post (behavior () - (when (< (-> self ring-timer) (-> self clock frame-counter)) + (when (< (-> self ring-timer) (current-time)) (let ((v1-2 (rand-vu-int-range 0 7))) (dotimes (a0-3 3) (if (logand (ash 1 a0-3) v1-2) @@ -597,9 +597,7 @@ ) ) ) - (set! (-> self ring-timer) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.6 1.8)))) - ) + (set! (-> self ring-timer) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.6 1.8))))) ) (fort-robotank-reticle-post) (none) @@ -1416,19 +1414,19 @@ :virtual #t :event robotank-turret-handler :enter (behavior () - (set! (-> self gun-timer) (-> self clock frame-counter)) + (set! (-> self gun-timer) (current-time)) (none) ) :trans (behavior () (if (logtest? (-> self flags) 16) - (set! (-> self gun-timer) (-> self clock frame-counter)) + (set! (-> self gun-timer) (current-time)) ) (let ((gp-0 *target*)) (if (and (if (type? gp-0 process-focusable) gp-0 ) (or (not (logtest? (-> self flags) 512)) (check-los? (-> self los) 0)) - (>= (- (-> self clock frame-counter) (-> self gun-timer)) (seconds 1)) + (>= (- (current-time) (-> self gun-timer)) (seconds 1)) ) (go-virtual fire) ) @@ -1495,8 +1493,8 @@ (logior! (-> self flags) 8) (set! (-> self firing-sight-pos quad) (-> self sight-pos quad)) (send-event (handle->process (-> self reticle)) 'lock) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.5)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.5)) (suspend) ) ) @@ -1534,9 +1532,9 @@ ) ) (let ((f30-0 (rand-vu-float-range 0.05 0.43)) - (s4-2 (-> self clock frame-counter)) + (s4-2 (current-time)) ) - (until (>= (- (-> self clock frame-counter) s4-2) (the int (* 300.0 f30-0))) + (until (>= (- (current-time) s4-2) (the int (* 300.0 f30-0))) (suspend) ) ) @@ -1556,9 +1554,9 @@ 2.11 ) ) - (gp-3 (-> self clock frame-counter)) + (gp-3 (current-time)) ) - (until (>= (- (-> self clock frame-counter) gp-3) (the int (* 300.0 f30-1))) + (until (>= (- (current-time) gp-3) (the int (* 300.0 f30-1))) (suspend) ) ) @@ -1575,8 +1573,8 @@ :code (behavior () (send-event (handle->process (-> self reticle)) 'die) (send-event (handle->process (-> self screen)) 'die) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -1687,7 +1685,7 @@ (set! (-> self aim-pos 0 quad) (-> self root-override trans quad)) (set! (-> self aim-pos-2 quad) (-> self root-override trans quad)) (set! (-> self aim-pos-1 quad) (-> self root-override trans quad)) - (set! (-> self gun-timer) (-> self clock frame-counter)) + (set! (-> self gun-timer) (current-time)) (set! (-> self flags) (the-as uint 0)) (set! (-> self fov-mult) 1.0) (set! (-> self shot-range) 204800.0) diff --git a/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fort-robotank_REF.gc b/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fort-robotank_REF.gc index 9cfe22b165..25e1edb8f5 100644 --- a/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fort-robotank_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fort-robotank_REF.gc @@ -424,7 +424,7 @@ ;; WARN: Return type mismatch int vs none. (defbehavior fort-robotank-post fort-robotank () (when (and (nonzero? (-> self no-collision-timer)) - (>= (- (-> self clock frame-counter) (-> self no-collision-timer)) + (>= (- (current-time) (-> self no-collision-timer)) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout)) ) ) @@ -496,11 +496,11 @@ ) (let* ((f0-35 30.0) (f1-7 65536.0) - (f2-1 (the float (-> self clock frame-counter))) + (f2-1 (the float (current-time))) (f0-36 (/ (* f1-7 (- f2-1 (* (the float (the int (/ f2-1 f0-35))) f0-35))) f0-35)) (f28-1 (sin f0-36)) (f30-2 (* 300.0 (/ 1.0 (-> self engine-vibe-rate)))) - (f0-39 (the float (-> self clock frame-counter))) + (f0-39 (the float (current-time))) (f24-0 (/ (- f0-39 (* (the float (the int (/ f0-39 f30-2))) f30-2)) f30-2)) (f28-2 (* f28-1 (sin (* 65536.0 f24-0)))) ) @@ -509,7 +509,7 @@ (f26-0 0.0) ) (when (and (or (< f0-44 f24-0) (< f24-0 f1-16)) - (>= (- (-> self clock frame-counter) (-> self buzz-timer)) (the int (* 0.5 f30-2))) + (>= (- (current-time) (-> self buzz-timer)) (the int (* 0.5 f30-2))) ) (let* ((gp-2 *target*) (a0-43 (if (type? gp-2 process-focusable) @@ -535,7 +535,7 @@ (the int (* 255.0 (* 0.49 f26-0))) (the-as time-frame (max 45 (the int (* 0.25 f30-2)))) ) - (set! (-> self buzz-timer) (-> self clock frame-counter)) + (set! (-> self buzz-timer) (current-time)) ) ) (quaternion-axis-angle! @@ -672,7 +672,7 @@ (set! (-> a1-19 param 1) (the-as uint v1-40)) ) (the-as object (when (send-event-function s5-0 a1-19) - (set! (-> self no-collision-timer) (-> self clock frame-counter)) + (set! (-> self no-collision-timer) (current-time)) (let ((v1-45 (-> self root-override root-prim))) (set! (-> v1-45 prim-core collide-as) (collide-spec)) (set! (-> v1-45 prim-core collide-with) (collide-spec)) @@ -946,8 +946,8 @@ ) :code (behavior () (set! (-> self flags) (logand -5 (-> self flags))) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.1)) (suspend) ) ) @@ -1087,8 +1087,8 @@ (remove-setting! 'process-mask) (remove-setting! 'target-height) (send-event (handle->process (-> self turret)) 'die) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 2)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 2)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/fortress/exit/forexita-obs_REF.gc b/test/decompiler/reference/jak2/levels/fortress/exit/forexita-obs_REF.gc index b4a73f2bd1..acbd3be5fc 100644 --- a/test/decompiler/reference/jak2/levels/fortress/exit/forexita-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/exit/forexita-obs_REF.gc @@ -84,7 +84,7 @@ (none) ) :post (behavior () - (when (< (-> self sound-time) (-> self clock frame-counter)) + (when (< (-> self sound-time) (current-time)) (sound-stop (-> self sound-id)) (set! (-> self sound-time) (get-timeframe-offset! (-> self sync) 0)) ) @@ -122,7 +122,7 @@ ) :code (the-as (function none :behavior fort-lift-plat) sleep-code) :post (behavior () - (when (< (-> self sound-time) (-> self clock frame-counter)) + (when (< (-> self sound-time) (current-time)) (sound-stop (-> self sound-id)) (set! (-> self sound-time) (get-timeframe-offset! (-> self sync) 0)) ) @@ -326,11 +326,11 @@ otherwise, [[plat::34]] (defstate pause (fort-claw) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2)) (go-virtual idle) ) (none) @@ -378,8 +378,8 @@ This commonly includes things such as: () (until #f (sound-play "fortress-alarm") - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/fortress/fort-turret_REF.gc b/test/decompiler/reference/jak2/levels/fortress/fort-turret_REF.gc index 457aa04e72..38eabfee61 100644 --- a/test/decompiler/reference/jak2/levels/fortress/fort-turret_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/fort-turret_REF.gc @@ -679,66 +679,64 @@ ;; definition for method 141 of type fort-turret ;; INFO: Used lq/sq (defmethod fort-turret-method-141 fort-turret ((obj fort-turret)) - (with-pp - (let* ((s5-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data 12))) - (v1-3 - (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> obj node-list data 12 bone transform vector 2) 1.0) - ) - (s4-1 (vector-float*! (new 'stack-no-clear 'vector) v1-3 163840.0)) + (let* ((s5-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data 12))) + (v1-3 + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> obj node-list data 12 bone transform vector 2) 1.0) ) - (let ((s3-0 (new 'stack-no-clear 'collide-query))) - (set! (-> s3-0 start-pos quad) (-> s5-0 quad)) - (set! (-> s3-0 move-dist quad) (-> s4-1 quad)) - (let ((v1-6 s3-0)) - (set! (-> v1-6 radius) 409.6) - (set! (-> v1-6 collide-with) - (collide-spec backgnd jak crate obstacle hit-by-player-list hit-by-others-list player-list pusher) - ) - (set! (-> v1-6 ignore-process0) obj) - (set! (-> v1-6 ignore-process1) #f) - (set! (-> v1-6 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-6 action-mask) (collide-action solid)) - ) - (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* s3-0))) - (cond - ((>= f30-0 0.0) - (set! (-> obj beam-intersect) (the-as basic 'wall)) - (when (-> s3-0 best-other-tri collide-ptr) - (let* ((s3-1 (-> s3-0 best-other-tri collide-ptr)) - (a0-14 (if (type? s3-1 collide-shape-prim) - (the-as collide-shape-prim s3-1) - ) - ) - ) - (when a0-14 - (when (= (-> a0-14 cshape process type) target) - (set! (-> obj target-timeout) (the-as uint (-> pp clock frame-counter))) - (set! (-> obj beam-intersect) (the-as basic 'target)) - ) + (s4-1 (vector-float*! (new 'stack-no-clear 'vector) v1-3 163840.0)) + ) + (let ((s3-0 (new 'stack-no-clear 'collide-query))) + (set! (-> s3-0 start-pos quad) (-> s5-0 quad)) + (set! (-> s3-0 move-dist quad) (-> s4-1 quad)) + (let ((v1-6 s3-0)) + (set! (-> v1-6 radius) 409.6) + (set! (-> v1-6 collide-with) + (collide-spec backgnd jak crate obstacle hit-by-player-list hit-by-others-list player-list pusher) + ) + (set! (-> v1-6 ignore-process0) obj) + (set! (-> v1-6 ignore-process1) #f) + (set! (-> v1-6 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-6 action-mask) (collide-action solid)) + ) + (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* s3-0))) + (cond + ((>= f30-0 0.0) + (set! (-> obj beam-intersect) (the-as basic 'wall)) + (when (-> s3-0 best-other-tri collide-ptr) + (let* ((s3-1 (-> s3-0 best-other-tri collide-ptr)) + (a0-14 (if (type? s3-1 collide-shape-prim) + (the-as collide-shape-prim s3-1) + ) + ) + ) + (when a0-14 + (when (= (-> a0-14 cshape process type) target) + (set! (-> obj target-timeout) (the-as uint (current-time))) + (set! (-> obj beam-intersect) (the-as basic 'target)) ) ) ) - (vector-float*! s4-1 s4-1 f30-0) - (let ((s3-3 (vector+! (new 'stack-no-clear 'vector) s5-0 s4-1)) - (a0-21 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data 10))) - (v1-23 (-> obj gun-shadow-jm twist-max)) - ) - (set! (-> v1-23 z) - (+ 2.0 (* 0.00024414062 (vector-length (vector-! (new 'stack-no-clear 'vector) s3-3 a0-21)))) - ) - (if (= (-> obj beam-intersect) 'wall) - (set! (-> v1-23 z) (+ -5.0 (-> v1-23 z))) - ) - ) ) - (else - (set! (-> obj beam-intersect) (the-as basic 'nothing)) - ) + (vector-float*! s4-1 s4-1 f30-0) + (let ((s3-3 (vector+! (new 'stack-no-clear 'vector) s5-0 s4-1)) + (a0-21 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data 10))) + (v1-23 (-> obj gun-shadow-jm twist-max)) + ) + (set! (-> v1-23 z) + (+ 2.0 (* 0.00024414062 (vector-length (vector-! (new 'stack-no-clear 'vector) s3-3 a0-21)))) + ) + (if (= (-> obj beam-intersect) 'wall) + (set! (-> v1-23 z) (+ -5.0 (-> v1-23 z))) + ) + ) + ) + (else + (set! (-> obj beam-intersect) (the-as basic 'nothing)) ) ) ) - (vector+! (-> obj target-bullseye) s5-0 s4-1) ) + (vector+! (-> obj target-bullseye) s5-0 s4-1) ) ) @@ -800,15 +798,15 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) ) (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) (fort-turret-method-141 self) - (if (or (>= (- (-> self clock frame-counter) (the-as int (-> self target-timeout))) (seconds 0.5)) - (< (- (-> self clock frame-counter) (-> self last-hit-time)) (seconds 2)) + (if (or (>= (- (current-time) (the-as int (-> self target-timeout))) (seconds 0.5)) + (< (- (current-time) (-> self last-hit-time)) (seconds 2)) ) (go-virtual hostile) ) @@ -825,8 +823,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.5)) (suspend) ) ) @@ -849,8 +847,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((s4-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-1) (seconds 0.33)) + (let ((s4-1 (current-time))) + (until (>= (- (current-time) s4-1) (seconds 0.33)) (suspend) ) ) @@ -861,8 +859,8 @@ ) ) (set! (-> self flash-state) #f) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 1.5)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 1.5)) (suspend) ) ) @@ -885,14 +883,14 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior fort-turret) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) @@ -901,8 +899,8 @@ (set! (-> self desired-twist) (* 8192.0 (cos (get-scaled-val! (-> self sync) 32768.0 0)))) (fort-turret-method-140 self 0.1 91.022224) (fort-turret-method-141 self) - (if (and (< (- (-> self clock frame-counter) (the-as int (-> self target-timeout))) (seconds 0.5)) - (>= (- (-> self clock frame-counter) (-> self last-hit-time)) (seconds 2)) + (if (and (< (- (current-time) (the-as int (-> self target-timeout))) (seconds 0.5)) + (>= (- (current-time) (-> self last-hit-time)) (seconds 2)) ) (go-virtual attack) ) @@ -934,15 +932,15 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) ) (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) (fort-turret-method-141 self) - (if (and (< (- (-> self clock frame-counter) (the-as int (-> self target-timeout))) (seconds 0.5)) - (>= (- (-> self clock frame-counter) (-> self last-hit-time)) (seconds 2)) + (if (and (< (- (current-time) (the-as int (-> self target-timeout))) (seconds 0.5)) + (>= (- (current-time) (-> self last-hit-time)) (seconds 2)) ) (go-virtual attack) ) @@ -963,37 +961,35 @@ (defmethod general-event-handler fort-turret ((obj fort-turret) (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" - (with-pp - (if (and (= arg2 'notify) (< 1 arg1) (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) - (set! (-> obj last-hit-time) (-> pp clock frame-counter)) + (if (and (= arg2 'notify) (< 1 arg1) (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) + (set! (-> obj last-hit-time) (current-time)) + ) + (case arg2 + (('start) + (let ((v0-0 (the-as object #t))) + (set! (-> obj can-shoot) (the-as symbol v0-0)) + v0-0 + ) + ) + (('stop) + (set! (-> obj can-shoot) #f) + #f + ) + (('attack) + (cond + ((= (-> arg0 type) target) + #f ) - (case arg2 - (('start) - (let ((v0-0 (the-as object #t))) - (set! (-> obj can-shoot) (the-as symbol v0-0)) - v0-0 + ((-> obj invincible) + #f + ) + (else + ((method-of-type enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) - (('stop) - (set! (-> obj can-shoot) #f) - #f - ) - (('attack) - (cond - ((= (-> arg0 type) target) - #f - ) - ((-> obj invincible) - #f - ) - (else - ((method-of-type enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - ) - ) - (else - ((method-of-type enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) + ) + (else + ((method-of-type enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1028,15 +1024,15 @@ (suspend) (ja-channel-set! 0) (let ((gp-2 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 4))) - (s5-2 (-> self clock frame-counter)) + (s5-2 (current-time)) ) - (until (>= (- (-> self clock frame-counter) s5-2) (seconds 2)) + (until (>= (- (current-time) s5-2) (seconds 2)) (spawn (-> self part) gp-2) (suspend) ) ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 1)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 1)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/fortress/fortress-obs_REF.gc b/test/decompiler/reference/jak2/levels/fortress/fortress-obs_REF.gc index 3896ed2b08..6039a00664 100644 --- a/test/decompiler/reference/jak2/levels/fortress/fortress-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/fortress-obs_REF.gc @@ -150,8 +150,8 @@ ) (suspend) (ja-channel-set! 0) - (let ((frame-counter (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 1)) + (let ((frame-counter (current-time))) + (until (>= (- (current-time) frame-counter) (seconds 1)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/fortress/prison/prison-obs_REF.gc b/test/decompiler/reference/jak2/levels/fortress/prison/prison-obs_REF.gc index 7d52a79c1f..74cf4f55a0 100644 --- a/test/decompiler/reference/jak2/levels/fortress/prison/prison-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/prison/prison-obs_REF.gc @@ -248,7 +248,7 @@ (defstate idle (prsn-hang-cell) :virtual #t :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let* ((f0-2 (* (/ 1.0 (-> self path-du)) (-> self path-u))) (f0-3 (- f0-2 (* (the float (the int (/ f0-2 1.0))) 1.0))) ) @@ -265,7 +265,7 @@ (seek! (-> self path-u) 1.0 (* (-> self path-du) (-> self clock seconds-per-frame))) (when (>= (-> self path-u) 1.0) (set! (-> self path-u) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (get-point-at-percent-along-path! (-> self path) (-> self root trans) (-> self path-u) 'interp) (ja-post) @@ -282,42 +282,40 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (with-pp - (set! (-> obj root) (new 'process 'trsqv)) - (process-drawable-from-entity! obj arg0) - (initialize-skeleton - obj - (the-as skeleton-group (art-group-get-by-name *level* "skel-prsn-hang-cell" (the-as (pointer uint32) #f))) - (the-as pair 0) - ) - (logclear! (-> obj mask) (process-mask actor-pause)) - (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (the-as entity #f) #f)) - (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) - (set! (-> obj path-du) 0.01) - (let ((f0-2 (* 300.0 (/ 1.0 (-> obj path-du)))) - (f1-3 (the float (-> pp clock frame-counter))) - ) - (set! (-> obj path-u) (/ (- f1-3 (* (the float (the int (/ f1-3 f0-2))) f0-2)) f0-2)) - ) - (let* ((f30-0 (-> obj path-u)) - (f28-0 8.0) - (f26-0 (/ 1.0 f28-0)) - ) - (dotimes (s5-2 (+ (the int f28-0) -1)) - (+! f30-0 f26-0) - (process-spawn - prsn-hang-cell - (if (>= f30-0 1.0) - (+ -1.0 f30-0) - f30-0 - ) - :to obj - ) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-prsn-hang-cell" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (logclear! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (the-as entity #f) #f)) + (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) + (set! (-> obj path-du) 0.01) + (let ((f0-2 (* 300.0 (/ 1.0 (-> obj path-du)))) + (f1-3 (the float (current-time))) + ) + (set! (-> obj path-u) (/ (- f1-3 (* (the float (the int (/ f1-3 f0-2))) f0-2)) f0-2)) + ) + (let* ((f30-0 (-> obj path-u)) + (f28-0 8.0) + (f26-0 (/ 1.0 f28-0)) + ) + (dotimes (s5-2 (+ (the int f28-0) -1)) + (+! f30-0 f26-0) + (process-spawn + prsn-hang-cell + (if (>= f30-0 1.0) + (+ -1.0 f30-0) + f30-0 + ) + :to obj ) ) - (go (method-of-object obj idle)) - (none) ) + (go (method-of-object obj idle)) + (none) ) ;; definition for function prsn-hang-cell-init-by-other diff --git a/test/decompiler/reference/jak2/levels/fortress/rescue/forresca-obs_REF.gc b/test/decompiler/reference/jak2/levels/fortress/rescue/forresca-obs_REF.gc index 8861a8fd4e..0070f62fd6 100644 --- a/test/decompiler/reference/jak2/levels/fortress/rescue/forresca-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/rescue/forresca-obs_REF.gc @@ -290,8 +290,8 @@ This commonly includes things such as: (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) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.5)) (suspend) ) ) @@ -299,8 +299,8 @@ This commonly includes things such as: (set-setting! 'entity-name "camera-243" 0.0 0) (set-setting! 'process-mask 'set 0.0 (process-mask movie enemy)) (process-grab? *target* #f) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 2)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 2)) (suspend) ) ) @@ -400,8 +400,8 @@ This commonly includes things such as: ) :code (behavior () (until (-> self all-gone?) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.5)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.5)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/fortress/rescue/forrescb-obs_REF.gc b/test/decompiler/reference/jak2/levels/fortress/rescue/forrescb-obs_REF.gc index 2fe3a9504d..aa3668fca0 100644 --- a/test/decompiler/reference/jak2/levels/fortress/rescue/forrescb-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/rescue/forrescb-obs_REF.gc @@ -550,7 +550,7 @@ This commonly includes things such as: ) :trans (behavior () (set-forrescb-electricity-scale! 1.0 0) - (when (>= (-> self clock frame-counter) (-> self next-spawn-time)) + (when (>= (current-time) (-> self next-spawn-time)) (process-spawn fort-elec-belt-inst (-> self init-quat) @@ -570,32 +570,30 @@ This commonly includes things such as: ;; definition for method 15 of type fort-elec-belt ;; WARN: Return type mismatch symbol vs none. (defmethod fort-elec-belt-method-15 fort-elec-belt ((obj fort-elec-belt)) - (with-pp - (let* ((f28-0 (total-distance (-> obj path))) - (s5-0 (-> obj sync)) - (f26-0 81.92) - (a0-3 (- (-> pp clock frame-counter) (get-timeframe-offset! s5-0 0))) - (v1-6 (-> s5-0 period)) - (f30-0 (/ (* f26-0 (the float a0-3)) f28-0)) - (f28-1 (/ (* f26-0 (the float v1-6)) f28-0)) - ) - (while (>= 1.0 f30-0) - (if (>= f30-0 0.0) - (process-spawn - fort-elec-belt-inst - (-> obj init-quat) - f30-0 - (-> obj path-du) - (-> obj l-spec) - (-> obj attack-id) - :to obj - ) + (let* ((f28-0 (total-distance (-> obj path))) + (s5-0 (-> obj sync)) + (f26-0 81.92) + (a0-3 (- (current-time) (get-timeframe-offset! s5-0 0))) + (v1-6 (-> s5-0 period)) + (f30-0 (/ (* f26-0 (the float a0-3)) f28-0)) + (f28-1 (/ (* f26-0 (the float v1-6)) f28-0)) + ) + (while (>= 1.0 f30-0) + (if (>= f30-0 0.0) + (process-spawn + fort-elec-belt-inst + (-> obj init-quat) + f30-0 + (-> obj path-du) + (-> obj l-spec) + (-> obj attack-id) + :to obj ) - (+! f30-0 f28-1) - ) + ) + (+! f30-0 f28-1) ) - (none) ) + (none) ) ;; definition for method 7 of type fort-elec-belt @@ -688,7 +686,6 @@ This commonly includes things such as: ) ;; definition for method 3 of type fort-conveyor -;; INFO: this function exists in multiple non-identical object files (defmethod inspect fort-conveyor ((obj fort-conveyor)) (when (not obj) (set! obj obj) @@ -708,14 +705,12 @@ This commonly includes things such as: ) ;; definition for method 22 of type fort-conveyor -;; INFO: this function exists in multiple non-identical object files (defmethod get-art-group fort-conveyor ((obj fort-conveyor)) "@returns The respective [[art-group]] for the [[conveyor]]" (art-group-get-by-name *level* "skel-fort-conveyor" (the-as (pointer uint32) #f)) ) ;; definition for method 23 of type fort-conveyor -;; INFO: this function exists in multiple non-identical object files ;; WARN: Return type mismatch collide-shape-moving vs none. (defmethod reset-root! fort-conveyor ((obj fort-conveyor)) "Re-initializes the `root` [[trsqv]]" @@ -746,7 +741,6 @@ This commonly includes things such as: ) ;; definition for method 24 of type fort-conveyor -;; INFO: this function exists in multiple non-identical object files ;; WARN: Return type mismatch vector vs none. (defmethod init! fort-conveyor ((obj fort-conveyor)) "Initializes defaults for things like the `speed` and `belt-radius`" @@ -760,7 +754,6 @@ This commonly includes things such as: ) ;; definition for method 25 of type fort-conveyor -;; INFO: this function exists in multiple non-identical object files (defmethod set-and-get-ambient-sound! fort-conveyor ((obj 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`" diff --git a/test/decompiler/reference/jak2/levels/gungame/gun-dummy_REF.gc b/test/decompiler/reference/jak2/levels/gungame/gun-dummy_REF.gc index a92d24e81a..9ea266f794 100644 --- a/test/decompiler/reference/jak2/levels/gungame/gun-dummy_REF.gc +++ b/test/decompiler/reference/jak2/levels/gungame/gun-dummy_REF.gc @@ -2082,7 +2082,7 @@ (set! (-> event-msg-block message) 'path) (set! (-> event-msg-block param 0) (-> obj path-num)) (let ((path (the-as path-control (send-event-function (handle->process (-> obj train-man)) event-msg-block))) - (f30-0 (* 0.0033333334 (the float (- (-> pp clock frame-counter) (-> obj state-time))))) + (f30-0 (* 0.0033333334 (the float (- (current-time) (-> obj state-time))))) ) (if (not path) (return #f) @@ -2120,7 +2120,7 @@ (when (>= f30-0 (-> curr-path-command 0 time)) (set! (-> obj current) (the-as (inline-array tpath-control-frame) (-> obj current 1))) (set! (-> obj first-time-command) #t) - (set! (-> obj state-time) (-> pp clock frame-counter)) + (set! (-> obj state-time) (current-time)) ) (return #t) ret @@ -2135,7 +2135,7 @@ (when (>= f30-0 (-> curr-path-command 0 time)) (set! (-> obj current) (the-as (inline-array tpath-control-frame) (-> obj current 1))) (set! (-> obj first-time-command) #t) - (set! (-> obj state-time) (-> pp clock frame-counter)) + (set! (-> obj state-time) (current-time)) ) (return #t) ret @@ -2170,7 +2170,7 @@ (set! (-> obj current) (the-as (inline-array tpath-control-frame) (-> obj current 1))) (set! (-> obj inout-percent) 1.0) (set! (-> obj first-time-command) #t) - (set! (-> obj state-time) (-> pp clock frame-counter)) + (set! (-> obj state-time) (current-time)) ) (return #t) ret @@ -2236,10 +2236,8 @@ ) (sound-play-by-spec s4-7 (-> obj move-sound) (-> obj root-override trans)) ) - (when (< (-> obj next-spark) (-> pp clock frame-counter)) - (set! (-> obj next-spark) - (the-as int (+ (-> pp clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.0 0.3))))) - ) + (when (< (-> obj next-spark) (current-time)) + (set! (-> obj next-spark) (the-as int (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.0 0.3)))))) (spawn (-> obj part) (-> obj root-override trans)) ) (set! (-> obj first-time-command) #f) @@ -2253,7 +2251,7 @@ (set! (-> obj current) (the-as (inline-array tpath-control-frame) (-> obj current 1))) (set! (-> obj path-pos) (* 0.007843138 (the float (-> curr-path-command 0 path-pos)))) (set! (-> obj first-time-command) #t) - (set! (-> obj state-time) (-> pp clock frame-counter)) + (set! (-> obj state-time) (current-time)) ) (return #t) ret @@ -2268,7 +2266,7 @@ ) (set! (-> obj current) (the-as (inline-array tpath-control-frame) (-> obj current 1))) (set! (-> obj first-time-command) #t) - (set! (-> obj state-time) (-> pp clock frame-counter)) + (set! (-> obj state-time) (current-time)) ) (return #t) ret @@ -2312,7 +2310,7 @@ object (case event-type (('combo) - (set! (-> self last-combo-time) (-> self clock frame-counter)) + (set! (-> self last-combo-time) (current-time)) #t ) (('track) @@ -2370,7 +2368,7 @@ ) (else (if (and (logtest? (process-mask projectile) (-> proc-draw mask)) - (< (- (-> self clock frame-counter) (-> self last-combo-time)) (seconds 1)) + (< (- (current-time) (-> self last-combo-time)) (seconds 1)) ) (send-event (ppointer->process (-> self parent)) 'combo) ) @@ -2390,7 +2388,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self inout-percent) 1.0) (set! (-> self y-offset) 0.0) (set! (-> self rot-y-offset) 0.0) diff --git a/test/decompiler/reference/jak2/levels/gungame/gungame-obs_REF.gc b/test/decompiler/reference/jak2/levels/gungame/gungame-obs_REF.gc index ce4576fd0f..18eb4ed410 100644 --- a/test/decompiler/reference/jak2/levels/gungame/gungame-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/gungame/gungame-obs_REF.gc @@ -512,7 +512,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self start-time) (+ (current-time) (seconds 1))) ) (if (task-node-open? (game-task-node city-yellow-gun-training-introduction)) (go-virtual yellow-training-intro) @@ -562,7 +562,7 @@ This commonly includes things such as: ) ) (else - (when (< (-> self start-time) (-> self clock frame-counter)) + (when (< (-> self start-time) (current-time)) (set! (-> self course) *red-training-path-global-info*) (set! (-> self end-door) (the-as uint 1)) (training-manager-method-24 self) @@ -632,7 +632,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self start-time) (+ (current-time) (seconds 1))) ) ) ) @@ -684,7 +684,7 @@ This commonly includes things such as: ) ) (else - (when (< (-> self start-time) (-> self clock frame-counter)) + (when (< (-> self start-time) (current-time)) (set! (-> self end-door) (the-as uint 0)) (set! (-> self course) *yellow-training-path-global-info*) (training-manager-method-24 self) @@ -761,7 +761,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self start-time) (+ (current-time) (seconds 1))) ) ((let ((a1-6 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-6 from) (process->ppointer self)) @@ -803,7 +803,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self start-time) (+ (current-time) (seconds 1))) ) ) ) @@ -851,7 +851,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self start-time) (+ (current-time) (seconds 1))) ) ((and (logtest? (-> *game-info* secrets) (game-secrets gungame-dark)) (let ((a1-12 (new 'stack-no-clear 'event-message-block))) @@ -893,7 +893,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self start-time) (+ (-> self clock frame-counter) (seconds 1))) + (set! (-> self start-time) (+ (current-time) (seconds 1))) ) ) ) @@ -971,7 +971,7 @@ This commonly includes things such as: (label cfg-30) (b! #t cfg-33 :delay (nop!)) (label cfg-31) - (if (< (-> self start-time) (-> self clock frame-counter)) + (if (< (-> self start-time) (current-time)) (go-virtual course) ) (label cfg-33) @@ -1201,7 +1201,7 @@ This commonly includes things such as: :enter (behavior () (set! (-> self hud-score) (ppointer->handle (process-spawn hud-big-score :init hud-init-by-other :to self))) (set! (-> self hud-goal) (ppointer->handle (process-spawn hud-goal :init hud-init-by-other :to self))) - (set! (-> self start-time) (+ (-> self clock frame-counter) (seconds 2))) + (set! (-> self start-time) (+ (current-time) (seconds 2))) (set! (-> self first-enemy-shown?) #f) (set! (-> self first-citizen-shown?) #f) (set! (-> self open-end?) #t) @@ -1497,7 +1497,7 @@ This commonly includes things such as: (training-manager-method-32 self) (training-manager-method-31 self) (when (-> self open-end?) - (let ((f30-0 (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> self start-time)))))) + (let ((f30-0 (* 0.0033333334 (the float (- (current-time) (-> self start-time)))))) (when (and (handle->process (-> self voicebox)) (or (and (task-node-closed? (game-task-node city-red-gun-training-try-once)) (< 1.0 f30-0)) (and (task-node-open? (game-task-node city-red-gun-training-try-once)) (< 15.0 f30-0)) @@ -1932,8 +1932,8 @@ This commonly includes things such as: t1-0 ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -2418,8 +2418,8 @@ This commonly includes things such as: ) :code (behavior () (sound-play "gungame-door") - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.2)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.2)) (suspend) (suspend) ) @@ -3012,7 +3012,3 @@ This commonly includes things such as: :save #t ) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/hiphog/whack_REF.gc b/test/decompiler/reference/jak2/levels/hiphog/whack_REF.gc index 2bd5ccc214..8fd0ee01c7 100644 --- a/test/decompiler/reference/jak2/levels/hiphog/whack_REF.gc +++ b/test/decompiler/reference/jak2/levels/hiphog/whack_REF.gc @@ -1680,8 +1680,8 @@ (ja :num! (seek!)) ) (ja-channel-push! 1 (seconds 0.05)) - (let ((s5-0 (-> self clock frame-counter))) - (while (and (< (- (-> self clock frame-counter) s5-0) arg0) (not (-> self abort?))) + (let ((s5-0 (current-time))) + (while (and (< (- (current-time) s5-0) arg0) (not (-> self abort?))) (ja :group! (-> self draw art-group data 4) :num! (loop!)) (suspend) ) @@ -1923,240 +1923,234 @@ ;; definition for method 27 of type whack-a-metal ;; WARN: Return type mismatch int vs none. (defmethod whack-a-metal-method-27 whack-a-metal ((obj whack-a-metal)) - (with-pp - (let ((s4-0 (-> *mole-data* (-> obj wave) (-> obj event))) - (s5-0 #t) - ) - (when (zero? (-> obj event-length)) - (set! (-> obj event-length) - (rand-vu-int-range (the-as int (-> s4-0 min-time)) (the-as int (+ (-> s4-0 min-time) (-> s4-0 max-time)))) - ) - (set! (-> obj event-time) (-> pp clock frame-counter)) + (let ((s4-0 (-> *mole-data* (-> obj wave) (-> obj event))) + (s5-0 #t) ) - (let ((v1-8 (-> s4-0 mode))) - (cond - ((= v1-8 8) - (set! s5-0 (>= (- (-> pp clock frame-counter) (-> obj event-time)) (-> obj event-length))) - ) - ((or (= v1-8 9) (= v1-8 10) (= v1-8 11)) - (let ((v1-13 (rand-vu-int-range 0 7))) - (let ((s3-0 0)) - (while (let ((a0-20 (-> obj mole v1-13))) - (and (-> (the-as hip-mole (if a0-20 - (the-as hip-mole (-> a0-20 0 self)) - ) - ) - next-state - ) - (let ((a0-26 (-> obj mole v1-13))) - (= (-> (the-as hip-mole (if a0-26 - (the-as hip-mole (-> a0-26 0 self)) - ) - ) - next-state - name - ) - 'active - ) + (when (zero? (-> obj event-length)) + (set! (-> obj event-length) + (rand-vu-int-range (the-as int (-> s4-0 min-time)) (the-as int (+ (-> s4-0 min-time) (-> s4-0 max-time)))) + ) + (set! (-> obj event-time) (current-time)) + ) + (let ((v1-8 (-> s4-0 mode))) + (cond + ((= v1-8 8) + (set! s5-0 (>= (- (current-time) (-> obj event-time)) (-> obj event-length))) + ) + ((or (= v1-8 9) (= v1-8 10) (= v1-8 11)) + (let ((v1-13 (rand-vu-int-range 0 7))) + (let ((s3-0 0)) + (while (let ((a0-20 (-> obj mole v1-13))) + (and (-> (the-as hip-mole (if a0-20 + (the-as hip-mole (-> a0-20 0 self)) + ) + ) + next-state ) + (let ((a0-26 (-> obj mole v1-13))) + (= (-> (the-as hip-mole (if a0-26 + (the-as hip-mole (-> a0-26 0 self)) + ) + ) + next-state + name + ) + 'active + ) ) - ) - (set! v1-13 (rand-vu-int-range 0 7)) - (+! s3-0 1) - (if (< 100 s3-0) - (goto cfg-27) - ) - ) + ) + ) + (set! v1-13 (rand-vu-int-range 0 7)) + (+! s3-0 1) + (if (< 100 s3-0) + (goto cfg-27) + ) ) - (send-event (ppointer->process (-> obj mole v1-13)) 'active (-> obj event-length) (-> s4-0 mode)) ) - (label cfg-27) + (send-event (ppointer->process (-> obj mole v1-13)) 'active (-> obj event-length) (-> s4-0 mode)) ) - ((or (zero? v1-8) (= v1-8 1) (= v1-8 2) (= v1-8 3) (= v1-8 4) (= v1-8 5) (= v1-8 6) (= v1-8 7)) - (let ((v1-22 (the-as int (-> s4-0 mode)))) - (let ((s3-1 0)) - (while (let ((a0-49 (-> obj mole v1-22))) - (and (-> (the-as hip-mole (if a0-49 - (the-as hip-mole (-> a0-49 0 self)) - ) - ) - next-state - ) - (let ((a0-55 (-> obj mole v1-22))) - (= (-> (the-as hip-mole (if a0-55 - (the-as hip-mole (-> a0-55 0 self)) - ) - ) - next-state - name - ) - 'active - ) + (label cfg-27) + ) + ((or (zero? v1-8) (= v1-8 1) (= v1-8 2) (= v1-8 3) (= v1-8 4) (= v1-8 5) (= v1-8 6) (= v1-8 7)) + (let ((v1-22 (the-as int (-> s4-0 mode)))) + (let ((s3-1 0)) + (while (let ((a0-49 (-> obj mole v1-22))) + (and (-> (the-as hip-mole (if a0-49 + (the-as hip-mole (-> a0-49 0 self)) + ) + ) + next-state ) + (let ((a0-55 (-> obj mole v1-22))) + (= (-> (the-as hip-mole (if a0-55 + (the-as hip-mole (-> a0-55 0 self)) + ) + ) + next-state + name + ) + 'active + ) ) - ) - (set! v1-22 (rand-vu-int-range 0 7)) - (+! s3-1 1) - (if (< 100 s3-1) - (goto cfg-61) - ) - ) + ) + ) + (set! v1-22 (rand-vu-int-range 0 7)) + (+! s3-1 1) + (if (< 100 s3-1) + (goto cfg-61) + ) ) - (send-event (ppointer->process (-> obj mole v1-22)) 'active (-> obj event-length) (-> s4-0 mode)) ) + (send-event (ppointer->process (-> obj mole v1-22)) 'active (-> obj event-length) (-> s4-0 mode)) ) - ) - ) - (label cfg-61) - (when s5-0 - (set! (-> obj event-length) 0) - (+! (-> obj event) 1) - (when (>= (-> obj event) (-> *mole-data* (-> obj wave) length)) - (set! (-> obj event) 0) - (+! (-> obj wave) 1) - (if (>= (-> obj wave) (-> *mole-data* length)) - (set! (-> obj wave) (+ (-> *mole-data* length) -1)) - ) - ) + ) ) ) - (when (>= (- (-> pp clock frame-counter) (-> obj speech-time)) (seconds 15)) - (if (nonzero? (cond - ((= (-> obj speech-count) 1) - 0 - ) - ((>= (-> obj score) 1300.0) - (set! (-> obj speech-count) 1) - (let ((v1-50 (whack-a-metal-method-29 obj 0 3))) - (cond - ((zero? v1-50) - (talker-spawn-func (-> *talker-speech* 430) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-50 1) - (talker-spawn-func (-> *talker-speech* 431) *entity-pool* (target-pos 0) (the-as region #f)) - ) - (else - (talker-spawn-func (-> *talker-speech* 432) *entity-pool* (target-pos 0) (the-as region #f)) - ) + (label cfg-61) + (when s5-0 + (set! (-> obj event-length) 0) + (+! (-> obj event) 1) + (when (>= (-> obj event) (-> *mole-data* (-> obj wave) length)) + (set! (-> obj event) 0) + (+! (-> obj wave) 1) + (if (>= (-> obj wave) (-> *mole-data* length)) + (set! (-> obj wave) (+ (-> *mole-data* length) -1)) + ) + ) + ) + ) + (when (>= (- (current-time) (-> obj speech-time)) (seconds 15)) + (if (nonzero? (cond + ((= (-> obj speech-count) 1) + 0 + ) + ((>= (-> obj score) 1300.0) + (set! (-> obj speech-count) 1) + (let ((v1-50 (whack-a-metal-method-29 obj 0 3))) + (cond + ((zero? v1-50) + (talker-spawn-func (-> *talker-speech* 430) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-50 1) + (talker-spawn-func (-> *talker-speech* 431) *entity-pool* (target-pos 0) (the-as region #f)) + ) + (else + (talker-spawn-func (-> *talker-speech* 432) *entity-pool* (target-pos 0) (the-as region #f)) ) ) ) - (else - (let ((v1-55 (whack-a-metal-method-29 obj 1 20))) - (cond - ((zero? v1-55) - (talker-spawn-func (-> *talker-speech* 395) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 1) - (talker-spawn-func (-> *talker-speech* 396) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 2) - (talker-spawn-func (-> *talker-speech* 397) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 3) - (talker-spawn-func (-> *talker-speech* 398) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 4) - (talker-spawn-func (-> *talker-speech* 401) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 5) - (talker-spawn-func (-> *talker-speech* 403) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 6) - (talker-spawn-func (-> *talker-speech* 404) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 7) - (talker-spawn-func (-> *talker-speech* 405) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 8) - (talker-spawn-func (-> *talker-speech* 406) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 9) - (talker-spawn-func (-> *talker-speech* 407) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 10) - (talker-spawn-func (-> *talker-speech* 408) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 11) - (talker-spawn-func (-> *talker-speech* 409) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 12) - (talker-spawn-func (-> *talker-speech* 410) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 13) - (talker-spawn-func (-> *talker-speech* 411) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 14) - (talker-spawn-func (-> *talker-speech* 412) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 15) - (talker-spawn-func (-> *talker-speech* 413) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 16) - (talker-spawn-func (-> *talker-speech* 414) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 17) - (talker-spawn-func (-> *talker-speech* 415) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((= v1-55 18) - (talker-spawn-func (-> *talker-speech* 416) *entity-pool* (target-pos 0) (the-as region #f)) - ) - (else - (talker-spawn-func (-> *talker-speech* 417) *entity-pool* (target-pos 0) (the-as region #f)) - ) + ) + (else + (let ((v1-55 (whack-a-metal-method-29 obj 1 20))) + (cond + ((zero? v1-55) + (talker-spawn-func (-> *talker-speech* 395) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 1) + (talker-spawn-func (-> *talker-speech* 396) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 2) + (talker-spawn-func (-> *talker-speech* 397) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 3) + (talker-spawn-func (-> *talker-speech* 398) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 4) + (talker-spawn-func (-> *talker-speech* 401) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 5) + (talker-spawn-func (-> *talker-speech* 403) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 6) + (talker-spawn-func (-> *talker-speech* 404) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 7) + (talker-spawn-func (-> *talker-speech* 405) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 8) + (talker-spawn-func (-> *talker-speech* 406) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 9) + (talker-spawn-func (-> *talker-speech* 407) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 10) + (talker-spawn-func (-> *talker-speech* 408) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 11) + (talker-spawn-func (-> *talker-speech* 409) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 12) + (talker-spawn-func (-> *talker-speech* 410) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 13) + (talker-spawn-func (-> *talker-speech* 411) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 14) + (talker-spawn-func (-> *talker-speech* 412) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 15) + (talker-spawn-func (-> *talker-speech* 413) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 16) + (talker-spawn-func (-> *talker-speech* 414) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 17) + (talker-spawn-func (-> *talker-speech* 415) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((= v1-55 18) + (talker-spawn-func (-> *talker-speech* 416) *entity-pool* (target-pos 0) (the-as region #f)) + ) + (else + (talker-spawn-func (-> *talker-speech* 417) *entity-pool* (target-pos 0) (the-as region #f)) ) ) ) ) ) - (set! (-> obj speech-time) (-> pp clock frame-counter)) - ) - ) - (whack-a-metal-method-28 obj) - 0 - (none) + ) + (set! (-> obj speech-time) (current-time)) + ) ) + (whack-a-metal-method-28 obj) + 0 + (none) ) ;; definition for method 28 of type whack-a-metal ;; WARN: Return type mismatch int vs none. (defmethod whack-a-metal-method-28 whack-a-metal ((obj whack-a-metal)) - (with-pp - (cond - ((>= (-> *game-info* score) (-> obj score)) - (set! (-> *game-info* score) (-> obj score)) - ) - ((and (< (-> *game-info* score) (-> obj score)) - (>= (- (-> pp clock frame-counter) (-> obj score-time)) (seconds 0.1)) - ) - (sound-play "whack-score") - (seek! (-> *game-info* score) (-> obj score) 2.0) - (set! (-> obj score-time) (-> pp clock frame-counter)) - ) - ) - (let ((s5-1 (handle->process (-> obj cabinet)))) - (when s5-1 - (spawn-with-matrix (-> obj score-part 1) (-> (the-as process-drawable s5-1) node-list data 13 bone transform)) - (spawn-with-matrix (-> obj score-part 0) (-> (the-as process-drawable s5-1) node-list data 12 bone transform)) - (dotimes (s4-1 (- 20 (-> obj miss-count))) - (set! (-> *part-id-table* 3336 init-specs 2 initial-valuef) (+ -1228.8 (* 614.4 (the float (mod s4-1 5))))) - (set! (-> *part-id-table* 3336 init-specs 2 random-rangef) 0.0) - (set! (-> *part-id-table* 3336 init-specs 3 initial-valuef) (- 921.6 (* 614.4 (the float (/ s4-1 5))))) - (set! (-> *part-id-table* 3336 init-specs 3 random-rangef) 0.0) - (sp-launch-particles-var - *sp-particle-system-3d* - (-> *part-id-table* 3336) - (-> (the-as process-drawable s5-1) node-list data 12 bone transform) - (the-as sparticle-launch-state #f) - (the-as sparticle-launch-control #f) - 1.0 - ) + (cond + ((>= (-> *game-info* score) (-> obj score)) + (set! (-> *game-info* score) (-> obj score)) + ) + ((and (< (-> *game-info* score) (-> obj score)) (>= (- (current-time) (-> obj score-time)) (seconds 0.1))) + (sound-play "whack-score") + (seek! (-> *game-info* score) (-> obj score) 2.0) + (set! (-> obj score-time) (current-time)) + ) + ) + (let ((s5-1 (handle->process (-> obj cabinet)))) + (when s5-1 + (spawn-with-matrix (-> obj score-part 1) (-> (the-as process-drawable s5-1) node-list data 13 bone transform)) + (spawn-with-matrix (-> obj score-part 0) (-> (the-as process-drawable s5-1) node-list data 12 bone transform)) + (dotimes (s4-1 (- 20 (-> obj miss-count))) + (set! (-> *part-id-table* 3336 init-specs 2 initial-valuef) (+ -1228.8 (* 614.4 (the float (mod s4-1 5))))) + (set! (-> *part-id-table* 3336 init-specs 2 random-rangef) 0.0) + (set! (-> *part-id-table* 3336 init-specs 3 initial-valuef) (- 921.6 (* 614.4 (the float (/ s4-1 5))))) + (set! (-> *part-id-table* 3336 init-specs 3 random-rangef) 0.0) + (sp-launch-particles-var + *sp-particle-system-3d* + (-> *part-id-table* 3336) + (-> (the-as process-drawable s5-1) node-list data 12 bone transform) + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 ) ) ) - 0 - (none) ) + 0 + (none) ) ;; failed to figure out what this is: @@ -2226,7 +2220,7 @@ (set-setting! 'borrow '((ctywide 1 lwidea #f) (hiphog 0 lwhack special)) 0.0 0) (want-display-level *load-state* 'ctyport #f) (want-display-level *load-state* 'ctywide #f) - (set! (-> self speech-time) (-> self clock frame-counter)) + (set! (-> self speech-time) (current-time)) (if (not (task-node-closed? (game-task-node city-whack-resolution))) (set! (-> self hud-goal) (ppointer->handle (process-spawn hud-goal :init hud-init-by-other :to self))) ) @@ -2373,7 +2367,7 @@ ) ) ) - (+! (-> self event-time) (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! (-> self event-time) (- (current-time) (-> self clock old-frame-counter))) (ja-blend-eval) (suspend) (ja :num! (seek!)) @@ -2394,7 +2388,7 @@ :frame-num 0.0 ) (until (ja-done? 0) - (+! (-> self event-time) (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! (-> self event-time) (- (current-time) (-> self clock old-frame-counter))) (suspend) (ja :num! (seek!)) ) @@ -2407,7 +2401,7 @@ :frame-num 0.0 ) (until (ja-done? 0) - (+! (-> self event-time) (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (+! (-> self event-time) (- (current-time) (-> self clock old-frame-counter))) (suspend) (ja :num! (seek!)) ) @@ -2438,7 +2432,7 @@ :exit (-> (method-of-type whack-a-metal active) exit) :code (behavior ((arg0 int)) (sound-play "whack-swish") - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (dotimes (v1-3 3) (set! (-> self slot-buffer v1-3) (-> self slot-buffer (+ v1-3 1))) ) @@ -2667,7 +2661,7 @@ (set! (-> self score) (+ 50.0 (-> self score))) ) (else - (when (>= (- (-> self clock frame-counter) (-> self speech-time)) (seconds 12)) + (when (>= (- (current-time) (-> self speech-time)) (seconds 12)) (let ((v1-78 (whack-a-metal-method-29 self 3 3))) (cond ((zero? v1-78) @@ -2681,7 +2675,7 @@ ) ) ) - (set! (-> self speech-time) (-> self clock frame-counter)) + (set! (-> self speech-time) (current-time)) ) (process-spawn part-tracker @@ -2772,11 +2766,9 @@ ) ) ) - (s5-8 (-> self clock frame-counter)) + (s5-8 (current-time)) ) - (while (or (nonzero? (get-status *gui-control* (the-as sound-id gp-1))) - (< (- (-> self clock frame-counter) s5-8) (seconds 2)) - ) + (while (or (nonzero? (get-status *gui-control* (the-as sound-id gp-1))) (< (- (current-time) s5-8) (seconds 2))) (suspend) (ja :num! (loop!)) ) @@ -2848,11 +2840,9 @@ ) ) ) - (s5-8 (-> self clock frame-counter)) + (s5-8 (current-time)) ) - (while (or (nonzero? (get-status *gui-control* (the-as sound-id gp-1))) - (< (- (-> self clock frame-counter) s5-8) (seconds 2)) - ) + (while (or (nonzero? (get-status *gui-control* (the-as sound-id gp-1))) (< (- (current-time) s5-8) (seconds 2))) (suspend) (ja :num! (loop!)) ) diff --git a/test/decompiler/reference/jak2/levels/intro/intro-obs_REF.gc b/test/decompiler/reference/jak2/levels/intro/intro-obs_REF.gc index 8ab75cb356..10ce4fdf2c 100644 --- a/test/decompiler/reference/jak2/levels/intro/intro-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/intro/intro-obs_REF.gc @@ -72,9 +72,7 @@ (if (= (-> self path-u) 1.0) (go-virtual die) ) - (when (>= (- (-> self clock frame-counter) (the-as int (-> self flit-timer))) - (the-as time-frame (-> self flit-interval)) - ) + (when (>= (- (current-time) (the-as int (-> self flit-timer))) (the-as time-frame (-> self flit-interval))) (let ((f28-0 (rand-vu-float-range -1.0 1.0)) (f30-0 (rand-vu-float-range -1.0 1.0)) (f0-1 (rand-vu-float-range 0.2 0.6)) @@ -84,7 +82,7 @@ (set! (-> self flit-factor) 0.0) (set! (-> self flit-interval) (the-as uint (the int (* 300.0 f0-1)))) ) - (set! (-> self flit-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self flit-timer) (the-as uint (current-time))) ) (none) ) @@ -272,7 +270,7 @@ This commonly includes things such as: (set! (-> self path-u) 0.0) (set! (-> self path-du) (rand-vu-float-range 0.15 0.32)) (set! (-> self z-rot) 0.0) - (set! (-> self flit-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self flit-timer) (the-as uint (current-time))) (set! (-> self flit-interval) (the-as uint 0)) (vector-reset! (-> self flit-prev-offset)) (vector-reset! (-> self flit-next-offset)) @@ -370,9 +368,9 @@ This commonly includes things such as: ) ) (let ((s5-1 (the int (* 300.0 (rand-vu-float-range 0.03 0.08)))) - (s4-0 (-> self clock frame-counter)) + (s4-0 (current-time)) ) - (until (>= (- (-> self clock frame-counter) s4-0) s5-1) + (until (>= (- (current-time) s4-0) s5-1) (suspend) ) ) @@ -521,7 +519,3 @@ This commonly includes things such as: (go (method-of-object obj idle)) (none) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/intro/intro-scenes_REF.gc b/test/decompiler/reference/jak2/levels/intro/intro-scenes_REF.gc index f798388783..b733397a3a 100644 --- a/test/decompiler/reference/jak2/levels/intro/intro-scenes_REF.gc +++ b/test/decompiler/reference/jak2/levels/intro/intro-scenes_REF.gc @@ -2333,8 +2333,8 @@ (lambda :behavior scene-player () (talker-spawn-func (-> *talker-speech* 123) self (target-pos 0) (the-as region #f)) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 5)) (if (cpad-pressed? 0 square) (return #f) ) @@ -2397,8 +2397,8 @@ (set! (-> gp-0 scale-x) 1.0) (set! (-> gp-0 scale-y) 1.0) (when (and s5-0 (-> gp-0 tex)) - (let ((s4-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s4-0) (seconds 5)) + (let ((s4-0 (current-time))) + (until (>= (- (current-time) s4-0) (seconds 5)) (let ((f0-2 1.0)) (cond ((< f30-0 2.0) @@ -2520,8 +2520,8 @@ ) ) (when (and s4-0 (-> gp-0 tex)) - (let ((s3-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-0) (seconds 8)) + (let ((s3-0 (current-time))) + (until (>= (- (current-time) s3-0) (seconds 8)) (let ((f0-6 1.0)) (cond ((< f30-0 2.0) diff --git a/test/decompiler/reference/jak2/levels/landing_pad/castle-obs_REF.gc b/test/decompiler/reference/jak2/levels/landing_pad/castle-obs_REF.gc index da284192a5..b22a034373 100644 --- a/test/decompiler/reference/jak2/levels/landing_pad/castle-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/landing_pad/castle-obs_REF.gc @@ -350,7 +350,7 @@ This commonly includes things such as: (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) (-> self clock frame-counter)) + (< (-> self lightning-timer) (current-time)) ) (let ((s5-0 (new 'stack-no-clear 'vector))) (set! (-> s5-0 quad) (-> *y-vector* quad)) @@ -409,9 +409,7 @@ This commonly includes things such as: (-> s4-2 ppointer) ) ) - (set! (-> self lightning-timer) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.04 0.1)))) - ) + (set! (-> self lightning-timer) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.04 0.1))))) ) ) ) @@ -586,8 +584,8 @@ This commonly includes things such as: (sound-play "lightning-node") (suspend) (logior! (-> self entity extra perm status) (entity-perm-status dead)) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 4)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 4)) (suspend) ) ) @@ -625,7 +623,7 @@ This commonly includes things such as: :code (the-as (function none :behavior cas-electric-fence) sleep-code) :post (behavior () (when (not (-> self stop)) - (when (< (-> self next-spawn-time) (-> self clock frame-counter)) + (when (< (-> self next-spawn-time) (current-time)) (let ((s5-0 (new 'stack-no-clear 'vector))) (set! (-> s5-0 quad) (-> *y-vector* quad)) (let ((gp-0 (new 'stack-no-clear 'collide-query))) @@ -688,9 +686,7 @@ This commonly includes things such as: (t9-10 a0-21 a1-10 a2-8 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) - (set! (-> self next-spawn-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.07 0.4)))) - ) + (set! (-> self next-spawn-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.07 0.4))))) ) ) ) @@ -1955,8 +1951,8 @@ This commonly includes things such as: (sound-play "trapdoor") (suspend) (ja-channel-set! 0) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -2182,16 +2178,10 @@ This commonly includes things such as: ;; definition for function cas-rot-blade-callback ;; WARN: Return type mismatch int vs none. (defun cas-rot-blade-callback ((arg0 cspace) (arg1 transformq)) - (with-pp - (quaternion-rotate-local-y! - (-> arg1 quat) - (-> arg1 quat) - (* 606.8148 (the float (-> pp clock frame-counter))) - ) - (cspace<-parented-transformq-joint! arg0 arg1) - 0 - (none) - ) + (quaternion-rotate-local-y! (-> arg1 quat) (-> arg1 quat) (* 606.8148 (the float (current-time)))) + (cspace<-parented-transformq-joint! arg0 arg1) + 0 + (none) ) ;; failed to figure out what this is: @@ -2555,11 +2545,11 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.6)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.6)) (let ((a0-1 *target*)) (if (and a0-1 (not (focus-test? a0-1 disable dead)) @@ -2568,7 +2558,7 @@ This commonly includes things such as: (go-virtual spawning) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (none) ) @@ -2590,20 +2580,20 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self spawn-count) 0) (set! (-> self spawn-count-total) 0) (set! (-> self player-dist) (-> self notice-dist)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.6)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.6)) (let ((a0-1 *target*)) (if (and a0-1 (not (logtest? (-> a0-1 focus-status) (focus-status disable dead)))) (set! (-> self player-dist) (vector-vector-distance (get-trans a0-1 0) (-> self root trans))) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (none) ) @@ -2618,8 +2608,8 @@ This commonly includes things such as: (suspend) (ja :num! (seek!)) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.5)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.5)) (suspend) ) ) @@ -2658,15 +2648,15 @@ This commonly includes things such as: ) ) ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (the int (* 300.0 (rand-vu-float-range 0.5 1.0)))) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (the int (* 300.0 (rand-vu-float-range 0.5 1.0)))) (suspend) ) ) ) (while (> (-> self spawn-count) 0) - (let ((gp-4 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-4) (seconds 0.43)) + (let ((gp-4 (current-time))) + (until (>= (- (current-time) gp-4) (seconds 0.43)) (suspend) ) ) @@ -2687,8 +2677,8 @@ This commonly includes things such as: (set-setting! 'entity-name a3-4 0.0 0) ) ) - (let ((gp-5 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-5) (seconds 2)) + (let ((gp-5 (current-time))) + (until (>= (- (current-time) gp-5) (seconds 2)) (suspend) ) ) @@ -2721,8 +2711,8 @@ This commonly includes things such as: (set-setting! 'entity-name a3-6 0.0 0) ) ) - (let ((gp-7 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-7) (seconds 1)) + (let ((gp-7 (current-time))) + (until (>= (- (current-time) gp-7) (seconds 1)) (suspend) ) ) @@ -2758,8 +2748,8 @@ This commonly includes things such as: (suspend) (ja :num! (seek! 0.0)) ) - (let ((gp-10 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-10) (seconds 1)) + (let ((gp-10 (current-time))) + (until (>= (- (current-time) gp-10) (seconds 1)) (suspend) ) ) @@ -2804,8 +2794,8 @@ This commonly includes things such as: (label cfg-14) (not v1-28) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.51)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.51)) (suspend) ) ) @@ -2818,8 +2808,8 @@ This commonly includes things such as: (set-setting! 'entity-name a3-2 0.0 0) ) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 1)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 1)) (suspend) ) ) @@ -2858,8 +2848,8 @@ This commonly includes things such as: ) ) ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 2.5)) + (let ((gp-3 (current-time))) + (until (>= (- (current-time) gp-3) (seconds 2.5)) (suspend) ) ) @@ -3003,7 +2993,7 @@ This commonly includes things such as: :virtual #t :code (the-as (function none :behavior lightning-ball) sleep-code) :post (behavior () - (when (>= (- (-> self clock frame-counter) (-> self timer)) (seconds 0.08)) + (when (>= (- (current-time) (-> self timer)) (seconds 0.08)) (let ((gp-0 (new 'stack-no-clear 'collide-query))) (let ((f30-1 (* 182.04445 (rand-vu-float-range -20.0 20.0))) (f28-1 (* 182.04445 (rand-vu-float-range -180.0 180.0))) @@ -3039,7 +3029,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self timer) (-> self clock frame-counter)) + (set! (-> self timer) (current-time)) ) (none) ) @@ -3054,26 +3044,24 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (with-pp - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) - (let ((v1-2 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) - (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-2 prim-core action) (collide-action solid)) - (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 56320.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) v1-2) - ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-5 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) - ) - (set! (-> obj root-override) s4-0) + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((v1-2 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-2 prim-core action) (collide-action solid)) + (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 56320.0) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) v1-2) ) - (process-drawable-from-entity! obj arg0) - (set! (-> obj timer) (-> pp clock frame-counter)) - (update-transforms (-> obj root-override)) - (go (method-of-object obj idle)) - (none) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-5 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> obj root-override) s4-0) ) + (process-drawable-from-entity! obj arg0) + (set! (-> obj timer) (current-time)) + (update-transforms (-> obj root-override)) + (go (method-of-object obj idle)) + (none) ) diff --git a/test/decompiler/reference/jak2/levels/landing_pad/castle-part_REF.gc b/test/decompiler/reference/jak2/levels/landing_pad/castle-part_REF.gc index 8d6e63716b..7cd7203b82 100644 --- a/test/decompiler/reference/jak2/levels/landing_pad/castle-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/landing_pad/castle-part_REF.gc @@ -427,18 +427,16 @@ ;; definition for function castle-green-dome-light-pulsate (defun castle-green-dome-light-pulsate ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) - (with-pp - (let ((s5-0 lerp-scale) - (s4-0 32.0) - (s3-0 64.0) - (t9-0 sin) - (f0-0 3640.889) - (f1-1 (* 0.0033333334 (the float (-> pp clock frame-counter)))) + (let ((s5-0 lerp-scale) + (s4-0 32.0) + (s3-0 64.0) + (t9-0 sin) + (f0-0 3640.889) + (f1-1 (* 0.0033333334 (the float (current-time)))) + ) + (set! (-> arg2 coneradius) + (s5-0 s4-0 s3-0 (t9-0 (* f0-0 (- f1-1 (* (the float (the int (/ f1-1 360.0))) 360.0)))) -1.0 1.0) ) - (set! (-> arg2 coneradius) - (s5-0 s4-0 s3-0 (t9-0 (* f0-0 (- f1-1 (* (the float (the int (/ f1-1 360.0))) 360.0)))) -1.0 1.0) - ) - ) ) ) diff --git a/test/decompiler/reference/jak2/levels/landing_pad/roboguard-level_REF.gc b/test/decompiler/reference/jak2/levels/landing_pad/roboguard-level_REF.gc index 3f2a91517d..479bf01aa6 100644 --- a/test/decompiler/reference/jak2/levels/landing_pad/roboguard-level_REF.gc +++ b/test/decompiler/reference/jak2/levels/landing_pad/roboguard-level_REF.gc @@ -515,7 +515,7 @@ ) :post (behavior () (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (-> self clock frame-counter)) + (set! (-> self last-draw-time) (current-time)) ) (enemy-method-129 self) (ja-post) @@ -624,7 +624,7 @@ ) 0 (logior! (-> self focus-status) (focus-status dangerous)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (roboguard-level-method-185 self (the-as symbol 1)) (vector-z-quaternion! (-> self roll-dir) (-> self root-override2 quat)) (set! (-> self roll-timer) 0) @@ -667,10 +667,8 @@ ) 0 (nav-enemy-method-160 self) - (when (< (-> self roll-timer) (-> self clock frame-counter)) - (set! (-> self roll-timer) - (+ (-> self clock frame-counter) (the int (* 300.0 (get-rand-float-range self 3.0 5.0)))) - ) + (when (< (-> self roll-timer) (current-time)) + (set! (-> self roll-timer) (+ (current-time) (the int (* 300.0 (get-rand-float-range self 3.0 5.0))))) (let ((gp-2 (handle->process (-> self focus handle)))) (when (and gp-2 (and gp-2 @@ -1133,99 +1131,94 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs symbol. (defmethod enemy-method-76 roboguard-level ((obj roboguard-level) (arg0 process) (arg1 event-message-block)) - (with-pp - (rlet ((acc :class vf) - (vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - (vf7 :class vf) - ) - (init-vf0-vector) - (the-as - symbol - (cond - ((or (= (-> arg0 type) target) (not (logtest? (-> obj flags) 4))) - ((method-of-type nav-enemy enemy-method-76) obj arg0 arg1) - ) - (else - (when (!= (-> arg0 type) target) - (-> arg1 param 0) - (let* ((s3-0 arg0) - (s1-0 (if (type? s3-0 process-focusable) - s3-0 - ) - ) - ) - (when (and s1-0 (logtest? (process-mask enemy) (-> s1-0 mask))) - (let ((s2-1 (vector-! - (new 'stack-no-clear 'vector) - (-> obj root-override2 trans) - (-> (the-as process-drawable s1-0) root trans) - ) - ) - ) - (new 'stack-no-clear 'vector) - 0.0 - (let ((s3-1 (new 'stack-no-clear 'vector))) - (vector-normalize! s2-1 1.0) - (let ((f0-3 - (- (vector-dot (-> obj root-override2 transv) s2-1) - (vector-dot (-> (the-as process-drawable s1-0) root transv) s2-1) - ) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (the-as + symbol + (cond + ((or (= (-> arg0 type) target) (not (logtest? (-> obj flags) 4))) + ((method-of-type nav-enemy enemy-method-76) obj arg0 arg1) + ) + (else + (when (!= (-> arg0 type) target) + (-> arg1 param 0) + (let* ((s3-0 arg0) + (s1-0 (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + (when (and s1-0 (logtest? (process-mask enemy) (-> s1-0 mask))) + (let ((s2-1 (vector-! + (new 'stack-no-clear 'vector) + (-> obj root-override2 trans) + (-> (the-as process-drawable s1-0) root trans) ) ) - (let ((a1-5 (-> obj nav state))) - (set! (-> s3-1 quad) (-> a1-5 velocity quad)) - ) - (let ((a0-16 s3-1)) - (let ((v1-20 s3-1)) - (let ((a1-9 (* -1.0 f0-3))) - (.mov vf7 a1-9) - ) - (.lvf vf5 (&-> s2-1 quad)) - (.lvf vf4 (&-> v1-20 quad)) - ) - (.add.x.vf vf6 vf0 vf0 :mask #b1000) - (.mul.x.vf acc vf5 vf7 :mask #b111) - (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) - (.svf (&-> a0-16 quad) vf6) - ) - ) - (let ((a0-17 (-> obj nav state)) - (v1-22 s3-1) - ) - (set! (-> a0-17 velocity quad) (-> v1-22 quad)) - ) - 0 - (set! (-> obj speed) (vector-length s3-1)) - (let ((v1-28 (-> obj nav state))) - (set! (-> v1-28 speed) (-> obj speed)) - ) - 0 - (let ((v1-30 (-> obj nav))) - (set! (-> v1-30 target-speed) (-> obj speed)) - ) - 0 - (set! (-> obj roll-timer) - (+ (-> pp clock frame-counter) (the int (* 300.0 (get-rand-float-range obj 3.0 5.0)))) - ) - (set! (-> obj roll-dir quad) (-> s3-1 quad)) ) - ) - (set! (-> obj roll-dir y) 0.0) - (vector-xz-normalize! (-> obj roll-dir) 1.0) - (let ((a0-22 (-> obj nav state)) - (v1-40 (-> obj roll-dir)) + (new 'stack-no-clear 'vector) + 0.0 + (let ((s3-1 (new 'stack-no-clear 'vector))) + (vector-normalize! s2-1 1.0) + (let ((f0-3 (- (vector-dot (-> obj root-override2 transv) s2-1) + (vector-dot (-> (the-as process-drawable s1-0) root transv) s2-1) + ) + ) + ) + (let ((a1-5 (-> obj nav state))) + (set! (-> s3-1 quad) (-> a1-5 velocity quad)) ) - (set! (-> a0-22 heading quad) (-> v1-40 quad)) + (let ((a0-16 s3-1)) + (let ((v1-20 s3-1)) + (let ((a1-9 (* -1.0 f0-3))) + (.mov vf7 a1-9) + ) + (.lvf vf5 (&-> s2-1 quad)) + (.lvf vf4 (&-> v1-20 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a0-16 quad) vf6) + ) + ) + (let ((a0-17 (-> obj nav state)) + (v1-22 s3-1) + ) + (set! (-> a0-17 velocity quad) (-> v1-22 quad)) + ) + 0 + (set! (-> obj speed) (vector-length s3-1)) + (let ((v1-28 (-> obj nav state))) + (set! (-> v1-28 speed) (-> obj speed)) + ) + 0 + (let ((v1-30 (-> obj nav))) + (set! (-> v1-30 target-speed) (-> obj speed)) + ) + 0 + (set! (-> obj roll-timer) (+ (current-time) (the int (* 300.0 (get-rand-float-range obj 3.0 5.0))))) + (set! (-> obj roll-dir quad) (-> s3-1 quad)) ) - 0 - (logior! (-> obj flags) 64) ) + (set! (-> obj roll-dir y) 0.0) + (vector-xz-normalize! (-> obj roll-dir) 1.0) + (let ((a0-22 (-> obj nav state)) + (v1-40 (-> obj roll-dir)) + ) + (set! (-> a0-22 heading quad) (-> v1-40 quad)) + ) + 0 + (logior! (-> obj flags) 64) ) - (send-event arg0 'touch (-> arg1 param 0)) ) + (send-event arg0 'touch (-> arg1 param 0)) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/mars_tomb/left/chase/target-indax_REF.gc b/test/decompiler/reference/jak2/levels/mars_tomb/left/chase/target-indax_REF.gc index c1264b7d15..68a395cb89 100644 --- a/test/decompiler/reference/jak2/levels/mars_tomb/left/chase/target-indax_REF.gc +++ b/test/decompiler/reference/jak2/levels/mars_tomb/left/chase/target-indax_REF.gc @@ -271,7 +271,7 @@ (set! (-> self control bend-target) 0.0) (target-collide-set! 'indax 0.0) (set! (-> self fact-override health) (-> self fact-override health-max)) - (set! (-> self indax indax-start-time) (-> self clock frame-counter)) + (set! (-> self indax indax-start-time) (current-time)) (set! (-> self indax art-group-backup) (-> self draw art-group)) (set! (-> self draw art-group) (-> self sidekick 0 draw art-group)) (logior! (-> self draw status) (draw-control-status no-draw-bounds2)) @@ -585,7 +585,7 @@ (defstate target-indax-walk (target) :event target-indax-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self control mod-surface) *indax-walk-mods*) (none) ) @@ -647,7 +647,7 @@ (let ((f26-0 0.0) (f30-0 0.0) (f28-0 0.0) - (gp-0 (-> self clock frame-counter)) + (gp-0 (current-time)) ) (let ((v1-3 (ja-group))) (cond @@ -699,12 +699,12 @@ (suspend) (let ((f26-1 (lerp-scale 0.0 1.0 (-> self control ctrl-xz-vel) 16384.0 32768.0))) (cond - ((>= (- (-> self clock frame-counter) gp-0) (seconds 5)) - (set! gp-0 (-> self clock frame-counter)) + ((>= (- (current-time) gp-0) (seconds 5)) + (set! gp-0 (current-time)) ) - ((>= (- (-> self clock frame-counter) gp-0) (seconds 2.5)) + ((>= (- (current-time) gp-0) (seconds 2.5)) ) - ((>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + ((>= (- (current-time) gp-0) (seconds 1)) (set! f28-0 (seek f28-0 1.0 (* 2.0 (-> self clock seconds-per-frame)))) ) (else @@ -904,7 +904,7 @@ (defstate target-indax-double-jump (target) :event target-indax-jump-event-handler :enter (behavior ((arg0 float) (arg1 float)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (if (!= (-> self control mod-surface) *slide-jump-mods*) @@ -1041,7 +1041,7 @@ (defstate target-indax-trip (target) :event target-indax-jump-event-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "jump" :vol 70) (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (none) @@ -1217,13 +1217,13 @@ (cond ((and (>= (ja-aframe-num 0) 20.0) (and (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> 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)) ) - (>= (- (-> self clock frame-counter) (-> self control sliding-start-time)) (seconds 0.04)) + (>= (- (current-time) (-> self control sliding-start-time)) (seconds 0.04)) ) ) (go target-indax-falling #f) @@ -1233,14 +1233,12 @@ (set-forward-vel (the-as float f26-0)) ) ((and (nonzero? (-> self control unknown-time-frame18)) - (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame18)) (seconds 0.04)) + (>= (- (current-time) (-> self control unknown-time-frame18)) (seconds 0.04)) ) (set-forward-vel 0.0) ) ((and (not (cpad-hold? (-> self control cpad number) square)) - (>= (- (-> self clock frame-counter) (-> self control unknown-combo-tracker00 move-start-time)) - (seconds 0.05) - ) + (>= (- (current-time) (-> self control unknown-combo-tracker00 move-start-time)) (seconds 0.05)) ) (if (= (-> self control ground-pat material) (pat-material ice)) (set-forward-vel (fmax 32768.0 (* 0.8 (-> self control ctrl-xz-vel)))) @@ -1270,7 +1268,7 @@ ) (suspend) (ja :num! (seek! max (* (-> self control current-surface align-speed) f28-0))) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (set! (-> *run-attack-mods* turnvv) 0.0) ) (if (< 2 gp-2) @@ -1280,7 +1278,7 @@ ) ) (if (and (not (logtest? (-> self control status) (collide-status on-surface))) - (>= (- (-> self clock frame-counter) (-> self control last-time-on-surface)) + (>= (- (current-time) (-> 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))) @@ -1337,7 +1335,7 @@ ) :code (behavior ((arg0 symbol) (arg1 attack-info)) (logclear! (-> self water flags) (water-flags jump-out)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self neck flex-blend) 0.0) (let ((gp-0 (-> self attack-info))) (let ((s5-0 (new 'stack-no-clear 'vector))) @@ -1385,7 +1383,7 @@ (cond ((= arg0 'attack) (logior! (-> self focus-status) (focus-status hit)) - (set! (-> self game hit-time) (-> self clock frame-counter)) + (set! (-> self game hit-time) (current-time)) (case (-> gp-0 mode) (('endlessfall) (cond @@ -1393,8 +1391,8 @@ (let ((s4-1 (new-stack-vector0))) (set! (-> s4-1 quad) (-> self control last-trans-on-ground quad)) (ja-channel-set! 0) - (let ((s3-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s3-1) (seconds 1)) + (let ((s3-1 (current-time))) + (until (>= (- (current-time) s3-1) (seconds 1)) (suspend) ) ) @@ -1571,7 +1569,7 @@ ) (set! (-> self control transv quad) (the-as uint128 0)) (initialize! (-> self game) 'life (the-as game-save #f) (the-as string #f)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sleep-code) (none) ) diff --git a/test/decompiler/reference/jak2/levels/mars_tomb/monster-frog_REF.gc b/test/decompiler/reference/jak2/levels/mars_tomb/monster-frog_REF.gc index 241fdbf141..401c9f1430 100644 --- a/test/decompiler/reference/jak2/levels/mars_tomb/monster-frog_REF.gc +++ b/test/decompiler/reference/jak2/levels/mars_tomb/monster-frog_REF.gc @@ -558,7 +558,7 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info-override use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (nav-enemy-method-163 self) (go-stare2 self) ) @@ -749,7 +749,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior monster-frog) enemy-event-handler) :enter (behavior ((arg0 vector)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) diff --git a/test/decompiler/reference/jak2/levels/mars_tomb/tomb-beetle_REF.gc b/test/decompiler/reference/jak2/levels/mars_tomb/tomb-beetle_REF.gc index 0ba0df3ddd..63b053e222 100644 --- a/test/decompiler/reference/jak2/levels/mars_tomb/tomb-beetle_REF.gc +++ b/test/decompiler/reference/jak2/levels/mars_tomb/tomb-beetle_REF.gc @@ -232,44 +232,42 @@ (defmethod general-event-handler tomb-beetle ((obj tomb-beetle) (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" - (with-pp - (let ((v1-0 (new 'static 'array int64 2 -1 0))) - (case arg2 - (('cue-chase) - (set! (-> obj round) (-> arg3 param 0)) - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) - ) - (('attack) - (when (and (-> obj next-state) (let ((a1-4 (-> obj next-state name))) - (or (= a1-4 'active) (= a1-4 'stand)) - ) - ) - (-> arg3 param 1) - (cond - ((logtest? (-> obj fact-info-override enemy-options) (ash 1 (+ (-> obj round) 8))) - (set! (-> v1-0 0) (the-as int (-> pp clock frame-counter))) - (go (method-of-object obj go-to-door)) - ) - ((>= (- (-> pp clock frame-counter) (the-as time-frame (-> v1-0 0))) (seconds 0.5)) - (logior! (-> obj flags) 1) - (go (method-of-object obj die)) - ) - ) - ) - ) - (('die) + (let ((v1-0 (new 'static 'array int64 2 -1 0))) + (case arg2 + (('cue-chase) + (set! (-> obj round) (-> arg3 param 0)) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (('attack) + (when (and (-> obj next-state) (let ((a1-4 (-> obj next-state name))) + (or (= a1-4 'active) (= a1-4 'stand)) + ) + ) + (-> arg3 param 1) (cond - ((and (-> obj next-state) (= (-> obj next-state name) 'key)) - (go (method-of-object obj explode)) + ((logtest? (-> obj fact-info-override enemy-options) (ash 1 (+ (-> obj round) 8))) + (set! (-> v1-0 0) (the-as int (current-time))) + (go (method-of-object obj go-to-door)) ) - ((not (and (-> obj next-state) (= (-> obj next-state name) 'dormant))) - (go (method-of-object obj fly-away)) + ((>= (- (current-time) (the-as time-frame (-> v1-0 0))) (seconds 0.5)) + (logior! (-> obj flags) 1) + (go (method-of-object obj die)) ) ) ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (('die) + (cond + ((and (-> obj next-state) (= (-> obj next-state name) 'key)) + (go (method-of-object obj explode)) ) + ((not (and (-> obj next-state) (= (-> obj next-state name) 'dormant))) + (go (method-of-object obj fly-away)) + ) + ) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -439,7 +437,7 @@ (logclear! (-> v1-1 settings flags) (shadow-flags disable-draw)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :code (behavior () @@ -451,12 +449,12 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-0 (-> self clock frame-counter)) + (let ((gp-0 (current-time)) (s5-0 (the int (* 300.0 (rand-vu-float-range 1.1 2.3)))) (f30-1 (rand-vu-float-range 0.8 1.4)) ) (ja-no-eval :group! tomb-beetle-wiggle-ja :num! (loop! f30-1) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-0) s5-0) + (until (>= (- (current-time) gp-0) s5-0) (suspend) (ja :num! (loop! f30-1)) ) @@ -563,7 +561,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior tomb-beetle) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -577,7 +575,7 @@ (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (if (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (go-virtual active) ) (none) @@ -637,15 +635,13 @@ (none) ) :code (behavior () - (set! (-> self state-timeout) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.0 0.8)))) - ) + (set! (-> self state-timeout) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.0 0.8))))) (let ((v1-6 (ja-group))) (cond ((and v1-6 (= v1-6 tomb-beetle-stand0-ja)) (ja-no-eval :num! (seek!)) (while (not (ja-done? 0)) - (if (>= (-> self clock frame-counter) (-> self state-timeout)) + (if (>= (current-time) (-> self state-timeout)) (goto cfg-20) ) (suspend) @@ -663,7 +659,7 @@ :frame-num 0.0 ) (until (ja-done? 0) - (if (>= (-> self clock frame-counter) (-> self state-timeout)) + (if (>= (current-time) (-> self state-timeout)) (goto cfg-20) ) (suspend) @@ -853,8 +849,8 @@ (-> gp-1 ppointer) ) ) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (seconds 2)) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (seconds 2)) (suspend) ) ) @@ -1139,7 +1135,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/mars_tomb/tomb-obs_REF.gc b/test/decompiler/reference/jak2/levels/mars_tomb/tomb-obs_REF.gc index 2c9d30a17b..7df2488318 100644 --- a/test/decompiler/reference/jak2/levels/mars_tomb/tomb-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/mars_tomb/tomb-obs_REF.gc @@ -500,8 +500,8 @@ This commonly includes things such as: ;; definition for function position-spikes (defbehavior position-spikes tomb-stair-block ((arg0 int)) - (let ((s5-0 (and (nonzero? arg0) (< (mod (-> self clock frame-counter) arg0) (/ arg0 2)))) - (s4-0 (and (nonzero? arg0) (< (mod (+ (-> self clock frame-counter) (seconds 0.75)) arg0) (/ arg0 2)))) + (let ((s5-0 (and (nonzero? arg0) (< (mod (current-time) arg0) (/ arg0 2)))) + (s4-0 (and (nonzero? arg0) (< (mod (+ (current-time) (seconds 0.75)) arg0) (/ arg0 2)))) ) (dotimes (s3-0 4) (let ((f0-1 (seek @@ -570,7 +570,7 @@ This commonly includes things such as: :virtual #t :enter (behavior () (set! (-> self camera-state) 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (task-node-close! (game-task-node tomb-poles-block)) (none) ) @@ -591,7 +591,7 @@ This commonly includes things such as: (remove-setting! 'string-startup-vector) (set! (-> self camera-state) 3) ) - ((and (= (-> self camera-state) 1) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 8))) + ((and (= (-> self camera-state) 1) (>= (- (current-time) (-> self state-time)) (seconds 8))) (set-setting! 'interp-time 'abs 0.0 0) (set-setting! 'string-startup-vector 'abs (new 'static 'vector :x 1.0) 0) (remove-setting! 'entity-name) @@ -614,8 +614,8 @@ This commonly includes things such as: (set! (-> self camera-state) 1) (ja-channel-push! 1 (seconds 2)) (ja :group! (-> self draw art-group data 3) :num! min) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 2)) (lift-pool 0) (drop-pool 1) (suspend) @@ -703,7 +703,7 @@ This commonly includes things such as: (set! (-> self camera-state) 3) ) ) - ((and (= (-> self camera-state) 1) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4))) + ((and (= (-> self camera-state) 1) (>= (- (current-time) (-> self state-time)) (seconds 4))) (set-setting! 'interp-time 'abs 0.0 0) (set-setting! 'string-startup-vector 'abs (new 'static 'vector :x 1.0) 0) (remove-setting! 'entity-name) @@ -734,7 +734,7 @@ This commonly includes things such as: (set! v1-1 (or (not *target*) (process-grab? *target* #f))) ) (set-setting! 'entity-name "camera-170" 0.0 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self camera-state) 1) (ja-channel-push! 1 (seconds 2)) (until #f @@ -1739,7 +1739,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (get-point-at-percent-along-path! (-> self path) (-> self basetrans) (-> self path-pos) 'interp) (none) ) @@ -1747,9 +1747,9 @@ This commonly includes things such as: (set! (-> self flags) (logand -2 (-> self flags))) (plat-trans) (if (not (logtest? (-> self flags) 1)) - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) ) - (when (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 0.5)) + (when (>= (- (current-time) (-> self ride-timer)) (seconds 0.5)) (if (= (-> self path-pos) 0.0) (set! (-> self dest-pos) 1.0) (set! (-> self dest-pos) 0.0) @@ -1810,7 +1810,7 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('ridden) - (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (let ((v0-0 (the-as object (current-time)))) (set! (-> self ride-timer) (the-as time-frame v0-0)) v0-0 ) @@ -1822,7 +1822,7 @@ This commonly includes things such as: ) :trans (behavior () (plat-trans) - (when (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 1)) + (when (>= (- (current-time) (-> self ride-timer)) (seconds 1)) (cond ((= (-> self path-pos) 1.0) (set! (-> self dest-pos) 0.0) @@ -2085,7 +2085,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :code (behavior () @@ -2117,7 +2117,7 @@ This commonly includes things such as: (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 (- (-> self clock frame-counter) (-> self state-time))) 0.0 300.0))) + (let ((v1-13 (lerp-scale 0.0 1.0 (the float (- (current-time) (-> self state-time))) 0.0 300.0))) (.mov vf7 v1-13) ) (.lvf vf5 (&-> s0-1 quad)) @@ -2148,7 +2148,7 @@ This commonly includes things such as: (defstate doors-open (tomb-sphinx) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :code (behavior () @@ -2205,7 +2205,7 @@ This commonly includes things such as: (.mov.vf vf6 vf0 :mask #b1000) (.sub.vf vf6 vf4 vf5 :mask #b111) (.svf (&-> sv-96 quad) vf6) - (let ((v1-15 (lerp-scale 0.0 1.0 (the float (- (-> self clock frame-counter) (-> self state-time))) 0.0 930.0))) + (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)) diff --git a/test/decompiler/reference/jak2/levels/mars_tomb/tomb-scenes_REF.gc b/test/decompiler/reference/jak2/levels/mars_tomb/tomb-scenes_REF.gc index 6e1f0cdd6e..c22d877a09 100644 --- a/test/decompiler/reference/jak2/levels/mars_tomb/tomb-scenes_REF.gc +++ b/test/decompiler/reference/jak2/levels/mars_tomb/tomb-scenes_REF.gc @@ -348,12 +348,12 @@ (let ((v1-0 #f) (sub-change-time (-> self subtitle-change-time)) ) - (when (>= (- (-> self clock frame-counter) (-> self speed-press-time)) 0) + (when (>= (- (current-time) (-> self speed-press-time)) 0) (set! sub-change-time (logxor sub-change-time 2048)) - (set! (-> self speed-press-time) (+ (-> self clock frame-counter) (seconds 0.5))) + (set! (-> self speed-press-time) (+ (current-time) (seconds 0.5))) (set! v1-0 #t) ) - (when (>= (- (-> self clock frame-counter) (-> self unknown-time)) 0) + (when (>= (- (current-time) (-> self unknown-time)) 0) (dotimes (s5-0 10) (let* ((f30-0 0.5) (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) @@ -365,9 +365,7 @@ ) ) ) - (set! (-> self unknown-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.25 0.75)))) - ) + (set! (-> self unknown-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.25 0.75))))) (set! v1-0 #t) ) (when v1-0 diff --git a/test/decompiler/reference/jak2/levels/mars_tomb/tomb-water_REF.gc b/test/decompiler/reference/jak2/levels/mars_tomb/tomb-water_REF.gc index 4840cf98dc..5e60293e28 100644 --- a/test/decompiler/reference/jak2/levels/mars_tomb/tomb-water_REF.gc +++ b/test/decompiler/reference/jak2/levels/mars_tomb/tomb-water_REF.gc @@ -116,8 +116,8 @@ (none) ) :code (behavior ((arg0 time-frame)) - (let ((s5-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-0) arg0) + (let ((s5-0 (current-time))) + (until (>= (- (current-time) s5-0) arg0) (suspend) ) ) @@ -558,35 +558,33 @@ This commonly includes things such as: ;; definition for method 39 of type tomb-beetle-button ;; WARN: Return type mismatch int vs none. (defmethod tomb-beetle-button-method-39 tomb-beetle-button ((obj tomb-beetle-button)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> obj speech-timer)) (seconds 6)) - (let ((s5-0 (rand-vu-int-count-excluding 4 (the-as int (-> obj speech-mask))))) - (let* ((v1-4 s5-0) - (t0-0 (cond - ((zero? v1-4) - "ora011" - ) - ((= v1-4 1) - "ora012" - ) - ((= v1-4 2) - "ora013" - ) - ((= v1-4 3) - "ora014" - ) - ) + (when (>= (- (current-time) (-> obj speech-timer)) (seconds 6)) + (let ((s5-0 (rand-vu-int-count-excluding 4 (the-as int (-> obj speech-mask))))) + (let* ((v1-4 s5-0) + (t0-0 (cond + ((zero? v1-4) + "ora011" + ) + ((= v1-4 1) + "ora012" + ) + ((= v1-4 2) + "ora013" + ) + ((= v1-4 3) + "ora014" + ) ) - ) - (add-process *gui-control* obj (gui-channel alert) (gui-action play) t0-0 -99.0 0) - ) - (set! (-> obj speech-mask) (the-as uint (ash 1 s5-0))) + ) + ) + (add-process *gui-control* obj (gui-channel alert) (gui-action play) t0-0 -99.0 0) ) - (set! (-> obj speech-timer) (-> pp clock frame-counter)) + (set! (-> obj speech-mask) (the-as uint (ash 1 s5-0))) ) - 0 - (none) + (set! (-> obj speech-timer) (current-time)) ) + 0 + (none) ) ;; failed to figure out what this is: @@ -642,7 +640,7 @@ This commonly includes things such as: (t9-0) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + (when (>= (- (current-time) (-> self state-time)) (seconds 4)) (if (and *target* (focus-test? *target* grabbed)) (process-release? *target*) ) @@ -1024,7 +1022,7 @@ This commonly includes things such as: (sv-160 int) (sv-176 (function vector vector float)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self plat-idx) 0) (dotimes (gp-0 (-> self plat-count)) (if (nonzero? (-> self plat gp-0)) @@ -1097,8 +1095,8 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 2)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 2)) (suspend) ) ) @@ -1112,14 +1110,14 @@ This commonly includes things such as: :virtual #t :event tomb-plat-simon-handler :enter (behavior () - (set! (-> self state-time) (+ (-> self clock frame-counter) (seconds -1))) + (set! (-> self state-time) (+ (current-time) (seconds -1))) (set! (-> self plat-idx) 0) 0 (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) - (set! (-> self state-time) (-> self clock frame-counter)) + (when (>= (- (current-time) (-> self state-time)) (seconds 2)) + (set! (-> self state-time) (current-time)) (if (< (-> self plat-idx) (-> self plat-seq-count)) (send-event (handle->process (-> self plat (-> self plat-seq (-> self plat-idx)))) 'blink) ) @@ -1259,7 +1257,7 @@ This commonly includes things such as: ;; INFO: Used lq/sq (defbehavior tomb-simon-block-trans tomb-simon-block () (when (logtest? (-> self flags) (simon-block-flags sbf0)) - (when (>= (-> self clock frame-counter) (-> self blink-timer 1)) + (when (>= (current-time) (-> self blink-timer 1)) (cond ((logtest? (-> self flags) (simon-block-flags sbf1)) (set! (-> self draw color-mult quad) (-> self color quad)) @@ -1270,9 +1268,9 @@ This commonly includes things such as: ) ) (logxor! (-> self flags) (simon-block-flags sbf1)) - (set! (-> self blink-timer 1) (+ (-> self clock frame-counter) (seconds 0.2))) + (set! (-> self blink-timer 1) (+ (current-time) (seconds 0.2))) ) - (when (>= (- (-> self clock frame-counter) (-> self blink-timer 0)) (seconds 1.2)) + (when (>= (- (current-time) (-> self blink-timer 0)) (seconds 1.2)) (logclear! (-> self flags) (simon-block-flags sbf0)) (set! (-> self draw color-mult quad) (-> self color quad)) ) @@ -1325,7 +1323,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self flags) (simon-block-flags sbf0 sbf1 sbf2 sbf5)) (set! (-> self move-rate) 122880.0) (none) @@ -1333,7 +1331,7 @@ This commonly includes things such as: :trans tomb-simon-block-trans :code (the-as (function none :behavior tomb-simon-block) sleep-code) :post (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) + (if (>= (- (current-time) (-> self state-time)) (the int (* 300.0 (+ (* 0.1 (the float (-> self order))) (* 0.015 (the float (-> self my-idx)))))) ) (tomb-simon-block-post) @@ -1355,7 +1353,7 @@ This commonly includes things such as: (go-virtual idle) ) (('touch 'ridden 'bonk 'edge-grabbed) - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (when (logtest? (-> self flags) (simon-block-flags sbf4)) (let* ((gp-0 *target*) (a0-10 (if (type? gp-0 process-focusable) @@ -1402,14 +1400,14 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self flags) (simon-block-flags sbf4)) - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (send-event (ppointer->process (-> self parent)) 'die-but (-> self my-idx)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 1)) + (when (>= (- (current-time) (-> self ride-timer)) (seconds 1)) (sound-play "tomb-simon-last") (go-virtual die) ) @@ -1470,7 +1468,7 @@ This commonly includes things such as: (go-virtual temporary) ) (('ridden) - (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (let ((v0-0 (the-as object (current-time)))) (set! (-> self ride-timer) (the-as time-frame v0-0)) v0-0 ) @@ -1479,7 +1477,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (none) ) :trans (behavior () @@ -1494,7 +1492,7 @@ This commonly includes things such as: (a0-3 (-> self root-override trans)) ) (when (and (or (< 16384.0 (fabs (- (-> a0-3 x) (-> v1-2 x)))) (< 16384.0 (fabs (- (-> a0-3 z) (-> v1-2 z))))) - (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 0.25)) + (>= (- (current-time) (-> self ride-timer)) (seconds 0.25)) ) (when (= (-> self next-idx) -1) (when (< (-> *event-queue* length) (-> *event-queue* allocated-length)) @@ -1537,7 +1535,7 @@ This commonly includes things such as: (('ridden) (when (not (logtest? (-> self flags) (simon-block-flags sbf2))) (logior! (-> self flags) (simon-block-flags sbf2)) - (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (let ((v0-0 (the-as object (current-time)))) (set! (-> self ride-timer) (the-as time-frame v0-0)) v0-0 ) @@ -1553,7 +1551,7 @@ This commonly includes things such as: ) :trans (behavior () (if (and (logtest? (-> self flags) (simon-block-flags sbf2)) - (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 0.5)) + (>= (- (current-time) (-> self ride-timer)) (seconds 0.5)) ) (go-virtual wobble-die) ) @@ -1599,14 +1597,14 @@ This commonly includes things such as: :virtual #t :code (behavior () (set! (-> self move-rate) (* 4096.0 (rand-vu-float-range 0.5 1.5))) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.25)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.25)) (suspend) ) ) (logclear! (-> self root-override root-prim prim-core action) (collide-action rideable)) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -1626,12 +1624,10 @@ This commonly includes things such as: ;; definition for method 41 of type tomb-simon-block ;; WARN: Return type mismatch time-frame vs none. (defmethod set-blink-timers! tomb-simon-block ((obj tomb-simon-block)) - (with-pp - (logior! (-> obj flags) (simon-block-flags sbf0 sbf1)) - (set! (-> obj blink-timer 0) (-> pp clock frame-counter)) - (set! (-> obj blink-timer 1) (-> pp clock frame-counter)) - (none) - ) + (logior! (-> obj flags) (simon-block-flags sbf0 sbf1)) + (set! (-> obj blink-timer 0) (current-time)) + (set! (-> obj blink-timer 1) (current-time)) + (none) ) ;; definition for method 30 of type tomb-simon-block @@ -2094,8 +2090,8 @@ This commonly includes things such as: ) ) ) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.45)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.45)) (suspend) ) ) @@ -2206,7 +2202,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self pat-entry-index) 0) (set-vector! (-> self draw color-mult) 0.9 0.9 0.9 1.0) (let ((gp-0 (-> self actor-group 0))) @@ -2249,8 +2245,8 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.2)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.2)) (suspend) ) ) @@ -2263,18 +2259,18 @@ This commonly includes things such as: 0.0 (+ (-> (the-as (pointer int32) (+ (the-as uint (-> self pat-tbl)) (* (-> self pat-index) 4)))) 18) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.2)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.2)) (suspend) ) ) (process-grab? *target* #f) - (let ((gp-2 (-> self clock frame-counter)) + (let ((gp-2 (current-time)) (s5-0 540) (f30-0 1.0) ) (ja-no-eval :group! (-> self draw art-group data 4) :num! (loop! f30-0) :frame-num 0.0) - (until (>= (- (-> self clock frame-counter) gp-2) s5-0) + (until (>= (- (current-time) gp-2) s5-0) (suspend) (ja :num! (loop! f30-0)) ) @@ -2600,10 +2596,10 @@ This commonly includes things such as: (until #f (set! (-> self can-exit-running?) #f) (let ((gp-0 0) - (s5-0 (-> self clock frame-counter)) + (s5-0 (current-time)) ) - (until (>= (- (-> self clock frame-counter) s5-0) (-> self on-duration)) - (when (< (-> self harmless-time) (-> self clock frame-counter)) + (until (>= (- (current-time) s5-0) (-> self on-duration)) + (when (< (-> self harmless-time) (current-time)) (tomb-water-trap-method-22 self) (dotimes (s4-0 (+ (-> self path curve num-cverts) -1)) (let ((s3-0 (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (the float s4-0) 'interp)) @@ -2645,18 +2641,18 @@ This commonly includes things such as: ) (set! (-> self can-exit-running?) #t) (let ((gp-1 90)) - (let ((s5-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-1) gp-1) + (let ((s5-1 (current-time))) + (until (>= (- (current-time) s5-1) gp-1) (suspend) ) ) (let ((s5-2 #f) - (s4-2 (-> self clock frame-counter)) + (s4-2 (current-time)) ) - (until (>= (- (-> self clock frame-counter) s4-2) + (until (>= (- (current-time) s4-2) (the-as time-frame (- (- (-> self sync period) (the-as uint (-> self on-duration))) (the-as uint gp-1))) ) - (when (and (not s5-2) (>= (- (-> self clock frame-counter) s4-2) (seconds 0.3))) + (when (and (not s5-2) (>= (- (current-time) s4-2) (seconds 0.3))) (set! s5-2 #t) (set-tombc-electricity-scale! 0.0) ) @@ -2736,7 +2732,7 @@ This commonly includes things such as: (set! (-> a1-5 param 1) (the-as uint a0-17)) ) (if (send-event-function (-> s4-1 cshape process) a1-5) - (set! (-> obj harmless-time) (+ (-> pp clock frame-counter) (seconds 3))) + (set! (-> obj harmless-time) (+ (current-time) (seconds 3))) ) ) ) @@ -2940,11 +2936,11 @@ This commonly includes things such as: (defstate open (tomb-smash-door) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self timeout)) + (when (>= (- (current-time) (-> self state-time)) (-> self timeout)) (let* ((s5-0 *target*) (gp-0 (if (type? s5-0 process-focusable) s5-0 diff --git a/test/decompiler/reference/jak2/levels/mars_tomb/widow-baron_REF.gc b/test/decompiler/reference/jak2/levels/mars_tomb/widow-baron_REF.gc index fd9853f47f..2e6c8bfcc7 100644 --- a/test/decompiler/reference/jak2/levels/mars_tomb/widow-baron_REF.gc +++ b/test/decompiler/reference/jak2/levels/mars_tomb/widow-baron_REF.gc @@ -167,7 +167,7 @@ (defmethod widow-rand-vector-method-10 widow-rand-vector ((obj widow-rand-vector)) (with-pp (set! (-> obj timer) - (- (the-as time-frame (-> obj timer)) (- (-> pp clock frame-counter) (-> pp clock old-frame-counter))) + (- (the-as time-frame (-> obj timer)) (- (current-time) (-> pp clock old-frame-counter))) ) (when (<= (-> obj timer) 0) (set! (-> obj timer) (rand-vu-int-range (-> obj min-time) (-> obj max-time))) @@ -539,84 +539,82 @@ ;; definition for method 21 of type baron-pod ;; WARN: Return type mismatch int vs none. (defmethod baron-pod-method-21 baron-pod ((obj baron-pod) (arg0 symbol)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> obj red-tip-change-time)) 0) - (set! (-> obj alt-red-tip-on) (not (-> obj alt-red-tip-on))) - (set! (-> obj red-tip-change-time) (+ (-> pp clock frame-counter) (seconds 0.5))) - (set! arg0 #t) - ) - (when (>= (- (-> pp clock frame-counter) (-> obj blink-time)) 0) - (set! (-> obj blink-mask) 0) - (dotimes (s5-0 10) - (let* ((f30-0 0.5) - (v1-17 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-18 (the-as number (logior #x3f800000 v1-17))) - ) - (if (< f30-0 (+ -1.0 (the-as float v1-18))) - (logior! (-> obj blink-mask) (ash 1 s5-0)) - ) - ) - ) - (set! (-> obj blink-time) (+ (-> pp clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.25 0.75))))) - (set! arg0 #t) - ) - (when arg0 - (remove-from-process *part-engine* obj) - (add-connection *part-engine* obj 13 obj 3264 (new 'static 'vector :w 819200.0)) - (add-connection *part-engine* obj 14 obj 3264 (new 'static 'vector :w 819200.0)) - (if (-> obj alt-red-tip-on) - (add-connection *part-engine* obj 5 obj 3251 (new 'static 'vector :w 819200.0)) - (add-connection *part-engine* obj 6 obj 3251 (new 'static 'vector :w 819200.0)) - ) - (let ((s5-2 (-> obj blink-mask))) - (if (logtest? s5-2 1) - (add-connection *part-engine* obj 8 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 2) - (add-connection *part-engine* obj 9 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 4) - (add-connection *part-engine* obj 10 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 8) - (add-connection *part-engine* obj 11 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 16) - (add-connection *part-engine* obj 12 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 32) - (add-connection *part-engine* obj 15 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 64) - (add-connection *part-engine* obj 16 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 128) - (add-connection *part-engine* obj 17 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 256) - (add-connection *part-engine* obj 18 obj 3252 (new 'static 'vector :w 819200.0)) - ) - (if (logtest? s5-2 512) - (add-connection *part-engine* obj 19 obj 3252 (new 'static 'vector :w 819200.0)) - ) - ) - (cond - ((-> obj has-stone) - (add-connection *part-engine* obj 4 obj 3258 (new 'static 'vector :y 4096.0 :w 819200.0)) - (add-connection *part-engine* obj 4 obj 3259 (new 'static 'vector :y 4096.0 :w 819200.0)) - ) - (else - (add-connection *part-engine* obj 4 obj 3256 (new 'static 'vector :y 4096.0 :w 819200.0)) - (add-connection *part-engine* obj 4 obj 3257 (new 'static 'vector :y 4096.0 :w 819200.0)) - ) - ) - ) - (if (-> obj has-stone) - (spawn (-> obj part) (-> obj root trans)) - ) - 0 - (none) + (when (>= (- (current-time) (-> obj red-tip-change-time)) 0) + (set! (-> obj alt-red-tip-on) (not (-> obj alt-red-tip-on))) + (set! (-> obj red-tip-change-time) (+ (current-time) (seconds 0.5))) + (set! arg0 #t) ) + (when (>= (- (current-time) (-> obj blink-time)) 0) + (set! (-> obj blink-mask) 0) + (dotimes (s5-0 10) + (let* ((f30-0 0.5) + (v1-17 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-18 (the-as number (logior #x3f800000 v1-17))) + ) + (if (< f30-0 (+ -1.0 (the-as float v1-18))) + (logior! (-> obj blink-mask) (ash 1 s5-0)) + ) + ) + ) + (set! (-> obj blink-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.25 0.75))))) + (set! arg0 #t) + ) + (when arg0 + (remove-from-process *part-engine* obj) + (add-connection *part-engine* obj 13 obj 3264 (new 'static 'vector :w 819200.0)) + (add-connection *part-engine* obj 14 obj 3264 (new 'static 'vector :w 819200.0)) + (if (-> obj alt-red-tip-on) + (add-connection *part-engine* obj 5 obj 3251 (new 'static 'vector :w 819200.0)) + (add-connection *part-engine* obj 6 obj 3251 (new 'static 'vector :w 819200.0)) + ) + (let ((s5-2 (-> obj blink-mask))) + (if (logtest? s5-2 1) + (add-connection *part-engine* obj 8 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 2) + (add-connection *part-engine* obj 9 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 4) + (add-connection *part-engine* obj 10 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 8) + (add-connection *part-engine* obj 11 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 16) + (add-connection *part-engine* obj 12 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 32) + (add-connection *part-engine* obj 15 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 64) + (add-connection *part-engine* obj 16 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 128) + (add-connection *part-engine* obj 17 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 256) + (add-connection *part-engine* obj 18 obj 3252 (new 'static 'vector :w 819200.0)) + ) + (if (logtest? s5-2 512) + (add-connection *part-engine* obj 19 obj 3252 (new 'static 'vector :w 819200.0)) + ) + ) + (cond + ((-> obj has-stone) + (add-connection *part-engine* obj 4 obj 3258 (new 'static 'vector :y 4096.0 :w 819200.0)) + (add-connection *part-engine* obj 4 obj 3259 (new 'static 'vector :y 4096.0 :w 819200.0)) + ) + (else + (add-connection *part-engine* obj 4 obj 3256 (new 'static 'vector :y 4096.0 :w 819200.0)) + (add-connection *part-engine* obj 4 obj 3257 (new 'static 'vector :y 4096.0 :w 819200.0)) + ) + ) + ) + (if (-> obj has-stone) + (spawn (-> obj part) (-> obj root trans)) + ) + 0 + (none) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak2/levels/mars_tomb/widow-extras_REF.gc b/test/decompiler/reference/jak2/levels/mars_tomb/widow-extras_REF.gc index 351ea0a40e..72e0308f6a 100644 --- a/test/decompiler/reference/jak2/levels/mars_tomb/widow-extras_REF.gc +++ b/test/decompiler/reference/jak2/levels/mars_tomb/widow-extras_REF.gc @@ -774,7 +774,7 @@ This commonly includes things such as: ) ) (('fizzle) - (let* ((gp-1 (-> self clock frame-counter)) + (let* ((gp-1 (current-time)) (f30-1 600.0) (v1-34 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-35 (the-as number (logior #x3f800000 v1-34))) @@ -817,7 +817,7 @@ This commonly includes things such as: ) ) (('fizzle) - (let* ((gp-1 (-> self clock frame-counter)) + (let* ((gp-1 (current-time)) (f30-0 600.0) (v1-34 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-35 (the-as number (logior #x3f800000 v1-34))) @@ -834,13 +834,11 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior widow-bomb) widow-bomb-back-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (if (and (nonzero? (-> self fizzle-timer)) - (>= (- (-> self clock frame-counter) (-> self fizzle-timer)) (seconds 3)) - ) + (if (and (nonzero? (-> self fizzle-timer)) (>= (- (current-time) (-> self fizzle-timer)) (seconds 3))) (go-virtual explode) ) (set! (-> self x-rotate) (+ 1092.2667 (-> self x-rotate))) @@ -848,7 +846,7 @@ This commonly includes things such as: (widow-bomb-method-34 self) (spawn-with-cspace (-> self part) (-> self node-list data 3)) (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + ((>= (- (current-time) (-> self state-time)) (seconds 4)) (go-virtual explode) ) (else @@ -878,7 +876,7 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior widow-bomb) widow-bomb-back-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (initialize (-> self impact) self @@ -893,16 +891,14 @@ This commonly includes things such as: (none) ) :trans (behavior () - (if (and (nonzero? (-> self fizzle-timer)) - (>= (- (-> self clock frame-counter) (-> self fizzle-timer)) (seconds 3)) - ) + (if (and (nonzero? (-> self fizzle-timer)) (>= (- (current-time) (-> self fizzle-timer)) (seconds 3))) (go-virtual explode) ) (set! (-> self x-rotate) (+ 4369.067 (-> self x-rotate))) (set! (-> self y-rotate) (+ 3458.8445 (-> self y-rotate))) (widow-bomb-method-34 self) (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (the int (-> self traj time))) + ((>= (- (current-time) (-> self state-time)) (the int (-> self traj time))) (compute-transv-at-time (-> self traj) (-> self traj time) (-> self root-override transv)) (vector-float*! (-> self root-override transv) (-> self root-override transv) 300.0) (go-virtual freefall) @@ -910,11 +906,11 @@ This commonly includes things such as: (else (compute-trans-at-time (-> self traj) - (the float (- (-> self clock frame-counter) (-> self state-time))) + (the float (- (current-time) (-> self state-time))) (-> self root-override trans) ) (update-from-cspace (-> self impact)) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) 1) + (when (>= (- (current-time) (-> self state-time)) 1) (let* ((a1-4 (new 'stack-no-clear 'collide-query)) (f0-10 (impact-control-method-11 (-> self impact) @@ -928,7 +924,7 @@ This commonly includes things such as: (set! (-> self root-override trans quad) (-> self impact trans 1 quad)) (compute-transv-at-time (-> self traj) - (the float (- (-> self clock frame-counter) (-> self state-time))) + (the float (- (current-time) (-> self state-time))) (-> self root-override transv) ) (vector-float*! (-> self root-override transv) (-> self root-override transv) 300.0) @@ -984,12 +980,12 @@ This commonly includes things such as: ) 0 (sound-play "w-bomb-explode") - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (cond - ((< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + ((< (- (current-time) (-> self state-time)) (seconds 2)) (let ((a1-0 (new 'stack-no-clear 'vector))) (set! (-> a1-0 quad) (-> self root-override trans quad)) (set! (-> a1-0 y) (+ 2048.0 (-> a1-0 y))) @@ -1009,52 +1005,48 @@ This commonly includes things such as: ;; definition for method 32 of type widow-bomb ;; WARN: Return type mismatch int vs none. (defmethod widow-bomb-method-32 widow-bomb ((obj widow-bomb)) - (with-pp - (spawn-with-cspace (-> obj part) (-> obj node-list data 3)) - (sound-play "w-bomb-steam" :id (the-as sound-id (-> obj steam-sound)) :position (-> obj root-override trans)) - (let ((s5-0 (the-as int (- (-> pp clock frame-counter) (-> obj state-time))))) - (if (nonzero? (-> obj fizzle-timer)) - (set! s5-0 (max - (the-as time-frame s5-0) - (- (seconds 12) (- (seconds 3) (- (-> pp clock frame-counter) (-> obj fizzle-timer)))) - ) - ) - ) - (if (< 3600 s5-0) - (go (method-of-object obj explode)) - ) - (when (< 3000 s5-0) - (spawn-with-cspace (-> obj warning-spark-part) (-> obj node-list data 3)) - (when (not (-> obj firework-sound-played)) - (set! (-> obj firework-sound-played) #t) - (sound-play "w-bomb-firewrks") - ) + (spawn-with-cspace (-> obj part) (-> obj node-list data 3)) + (sound-play "w-bomb-steam" :id (the-as sound-id (-> obj steam-sound)) :position (-> obj root-override trans)) + (let ((s5-0 (the-as int (- (current-time) (-> obj state-time))))) + (if (nonzero? (-> obj fizzle-timer)) + (set! s5-0 + (max (the-as time-frame s5-0) (- (seconds 12) (- (seconds 3) (- (current-time) (-> obj fizzle-timer))))) + ) ) - (let* ((v1-27 (* s5-0 s5-0)) - (a0-10 3600) - (v1-28 (- (* a0-10 a0-10) v1-27)) - ) - (when (< v1-28 (-> obj next-countdown-tick)) - (let ((a0-14 540)) - (set! (-> obj next-countdown-tick) (the-as time-frame (- v1-28 (mod v1-28 (* a0-14 a0-14))))) - ) - (let ((s5-2 (new 'stack-no-clear 'vector))) - (vector<-cspace! s5-2 (-> obj node-list data 7)) - (spawn (-> obj warning-glow-part) s5-2) - (vector<-cspace! s5-2 (-> obj node-list data 6)) - (spawn (-> obj warning-glow-part) s5-2) - (vector<-cspace! s5-2 (-> obj node-list data 5)) - (spawn (-> obj warning-glow-part) s5-2) - (vector<-cspace! s5-2 (-> obj node-list data 4)) - (spawn (-> obj warning-glow-part) s5-2) - ) - (sound-play "w-bomb-timer") - ) + (if (< 3600 s5-0) + (go (method-of-object obj explode)) + ) + (when (< 3000 s5-0) + (spawn-with-cspace (-> obj warning-spark-part) (-> obj node-list data 3)) + (when (not (-> obj firework-sound-played)) + (set! (-> obj firework-sound-played) #t) + (sound-play "w-bomb-firewrks") + ) + ) + (let* ((v1-27 (* s5-0 s5-0)) + (a0-10 3600) + (v1-28 (- (* a0-10 a0-10) v1-27)) + ) + (when (< v1-28 (-> obj next-countdown-tick)) + (let ((a0-14 540)) + (set! (-> obj next-countdown-tick) (the-as time-frame (- v1-28 (mod v1-28 (* a0-14 a0-14))))) + ) + (let ((s5-2 (new 'stack-no-clear 'vector))) + (vector<-cspace! s5-2 (-> obj node-list data 7)) + (spawn (-> obj warning-glow-part) s5-2) + (vector<-cspace! s5-2 (-> obj node-list data 6)) + (spawn (-> obj warning-glow-part) s5-2) + (vector<-cspace! s5-2 (-> obj node-list data 5)) + (spawn (-> obj warning-glow-part) s5-2) + (vector<-cspace! s5-2 (-> obj node-list data 4)) + (spawn (-> obj warning-glow-part) s5-2) + ) + (sound-play "w-bomb-timer") ) ) - 0 - (none) ) + 0 + (none) ) ;; failed to figure out what this is: @@ -1062,7 +1054,7 @@ This commonly includes things such as: :virtual #t :event (the-as (function process int symbol event-message-block object :behavior widow-bomb) widow-bomb-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let* ((v1-2 3600) (v1-3 (* v1-2 v1-2)) (a0-0 540) @@ -1139,7 +1131,7 @@ This commonly includes things such as: ) ) ((= v1-0 'fizzle) - (let* ((gp-0 (-> self clock frame-counter)) + (let* ((gp-0 (current-time)) (f30-0 600.0) (v1-17 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-18 (the-as number (logior #x3f800000 v1-17))) @@ -1157,13 +1149,13 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (initialize (-> self impact) self 3 4096.0 (collide-spec backgnd obstacle hit-by-others-list player-list)) (none) ) :exit (behavior () (when (nonzero? (-> self fizzle-timer)) - (let* ((gp-0 (-> self clock frame-counter)) + (let* ((gp-0 (current-time)) (f30-0 600.0) (v1-4 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) (v1-5 (the-as number (logior #x3f800000 v1-4))) @@ -1202,17 +1194,17 @@ This commonly includes things such as: ) ) (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (the int (-> self traj time))) + ((>= (- (current-time) (-> self state-time)) (the int (-> self traj time))) (let ((v1-29 (-> self which-trajectory))) (cond ((zero? v1-29) (set! (-> self which-trajectory) 1) (compute-trans-at-time (-> self traj) - (fmin (-> self traj time) (the float (- (-> self clock frame-counter) (-> self state-time)))) + (fmin (-> self traj time) (the float (- (current-time) (-> self state-time)))) (-> self root-override trans) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self root-override trans) (the-as vector (-> self traj))))) (set! (-> gp-1 y) 0.0) (vector-normalize! gp-1 12288.0) @@ -1226,10 +1218,10 @@ This commonly includes things such as: (set! (-> self which-trajectory) 2) (compute-trans-at-time (-> self traj) - (fmin (-> self traj time) (the float (- (-> self clock frame-counter) (-> self state-time)))) + (fmin (-> self traj time) (the float (- (current-time) (-> self state-time)))) (-> self root-override trans) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-4 (vector-! (new 'stack-no-clear 'vector) (-> self root-override trans) (the-as vector (-> self traj))))) (set! (-> gp-4 y) 0.0) (vector-normalize! gp-4 4096.0) @@ -1242,7 +1234,7 @@ This commonly includes things such as: ((= v1-29 2) (compute-trans-at-time (-> self traj) - (fmin (-> self traj time) (the float (- (-> self clock frame-counter) (-> self state-time)))) + (fmin (-> self traj time) (the float (- (current-time) (-> self state-time)))) (-> self root-override trans) ) (set! (-> self which-trajectory) 3) @@ -1264,11 +1256,11 @@ This commonly includes things such as: ((< (-> self which-trajectory) 3) (compute-trans-at-time (-> self traj) - (fmin (-> self traj time) (the float (- (-> self clock frame-counter) (-> self state-time)))) + (fmin (-> self traj time) (the float (- (current-time) (-> self state-time)))) (-> self root-override trans) ) (when (and (zero? (-> self which-trajectory)) - (< (- (-> self clock frame-counter) (-> self state-time)) (the int (* 0.75 (-> self traj time)))) + (< (- (current-time) (-> self state-time)) (the int (* 0.75 (-> self traj time)))) ) (vector+float*! (-> self launch-pos) (-> self launch-pos) (-> self launch) (-> self clock time-adjust-ratio)) (vector-lerp! @@ -1276,14 +1268,14 @@ This commonly includes things such as: (-> self launch-pos) (-> self root-override trans) (parameter-ease-sin-clamp - (* 1.3333334 (/ (the float (- (-> self clock frame-counter) (-> self state-time))) (-> self traj time))) + (* 1.3333334 (/ (the float (- (current-time) (-> self state-time))) (-> self traj time))) ) ) ) (spawn-with-cspace (-> self trail-part) (-> self node-list data 3)) (when (zero? (-> self which-trajectory)) (update-from-cspace (-> self impact)) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.05)) (let ((f0-42 (impact-control-method-11 (-> self impact) (new 'stack-no-clear 'collide-query) @@ -1669,11 +1661,11 @@ This commonly includes things such as: :virtual #t :enter (behavior () (set! (-> self draw bounds w) 245760.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (if (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (< (- (current-time) (-> self state-time)) (seconds 1)) (spawn-with-cspace (-> self explode-part) (-> self node-list data 6)) ) (let ((v1-9 (ja-group))) @@ -1712,7 +1704,7 @@ This commonly includes things such as: ((>= (-> self segs-shot) 16) (go-virtual break-it) ) - ((>= (- (-> self clock frame-counter) (-> self last-pillar-hit)) (seconds 2)) + ((>= (- (current-time) (-> self last-pillar-hit)) (seconds 2)) (process-spawn part-tracker :init part-tracker-init @@ -1724,7 +1716,7 @@ This commonly includes things such as: 0 :to *entity-pool* ) - (set! (-> self last-pillar-hit) (-> self clock frame-counter)) + (set! (-> self last-pillar-hit) (current-time)) (sound-play "pillar-hit" :position (-> self root-override trans)) ) ) @@ -1739,7 +1731,7 @@ This commonly includes things such as: (set! (-> v1-3 prim-core collide-with) (collide-spec)) ) 0 - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () diff --git a/test/decompiler/reference/jak2/levels/mars_tomb/widow-more-extras_REF.gc b/test/decompiler/reference/jak2/levels/mars_tomb/widow-more-extras_REF.gc index 676906f6f8..d8b914e3f5 100644 --- a/test/decompiler/reference/jak2/levels/mars_tomb/widow-more-extras_REF.gc +++ b/test/decompiler/reference/jak2/levels/mars_tomb/widow-more-extras_REF.gc @@ -500,20 +500,18 @@ (defstate idle (cave-in-master) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (spawn (-> self part) (-> self root trans)) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) 0) + (when (>= (- (current-time) (-> self state-time)) 0) (let ((gp-0 (new 'stack-no-clear 'vector))) (cavein-get-random-point gp-0) (set! (-> gp-0 y) (+ 327680.0 (-> gp-0 y))) (process-spawn tomb-boss-debris gp-0 (rand-vu-int-count 8) :to self) ) - (set! (-> self state-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.1 0.5)))) - ) + (set! (-> self state-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.1 0.5))))) ) (none) ) diff --git a/test/decompiler/reference/jak2/levels/nest/boss/metalkor-extras_REF.gc b/test/decompiler/reference/jak2/levels/nest/boss/metalkor-extras_REF.gc index 61c05f9bf0..1c87aff591 100644 --- a/test/decompiler/reference/jak2/levels/nest/boss/metalkor-extras_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/boss/metalkor-extras_REF.gc @@ -113,7 +113,7 @@ :virtual #t :event metalkor-egg-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -140,7 +140,7 @@ ((< f0-0 (* f1-0 f1-0)) (go-virtual idle) ) - ((>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + ((>= (- (current-time) (-> self state-time)) (seconds 4)) (go-virtual hatch) ) (else @@ -226,11 +226,11 @@ :virtual #t :event metalkor-egg-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (if (>= (- (current-time) (-> self state-time)) (seconds 3)) (go-virtual hatch) ) (let ((v1-9 (ja-group))) @@ -557,7 +557,7 @@ ;; definition for function ik-adjust (defbehavior ik-adjust metalkor-legs () - (let* ((f0-1 (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (let* ((f0-1 (* 0.0033333334 (the float (- (current-time) (-> self state-time))))) (f0-2 (* 9102.223 f0-1)) (f0-3 (- f0-2 (* (the float (the int (/ f0-2 65536.0))) 65536.0))) (f0-4 (sin f0-3)) @@ -710,7 +710,7 @@ :virtual #t :event metalkor-legs-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (dotimes (gp-0 6) (enable-set! (-> self joint-ik gp-0) #t) ((method-of-type cam-float-seeker init) (the-as cam-float-seeker (-> self foot-locks gp-0)) 0.0 0.1 0.3 0.9) @@ -1425,7 +1425,7 @@ (set! (-> a1-14 param 1) (the-as uint v1-47)) ) (when (send-event-function proc a1-14) - (set! (-> self no-collision-timer) (-> self clock frame-counter)) + (set! (-> self no-collision-timer) (current-time)) (let ((v1-52 (-> self root-override root-prim))) (set! (-> v1-52 prim-core collide-as) (collide-spec)) (set! (-> v1-52 prim-core collide-with) (collide-spec)) @@ -1442,12 +1442,12 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set-params! (-> self egg-toss-joint-angle) 0.0 0.05 0.3 0.9) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self no-collision-timer)) (seconds 0.1)) + (when (>= (- (current-time) (-> self no-collision-timer)) (seconds 0.1)) (let ((v1-5 (-> self root-override root-prim))) (set! (-> v1-5 prim-core collide-as) (-> self root-override backup-collide-as)) (set! (-> v1-5 prim-core collide-with) (-> self root-override backup-collide-with)) @@ -1826,7 +1826,7 @@ This commonly includes things such as: (set! (-> self chain joint-length) (* 12288.0 (-> self root scale y))) (set! (-> self root scale y) 1.0) (initialize-chain-joints (-> self chain)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let* ((f30-0 0.9) (f28-0 0.2) (v1-12 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) @@ -1854,7 +1854,7 @@ This commonly includes things such as: (quaternion-normalize! (-> self root quat)) (update (-> self chain) self) (cond - ((< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + ((< (- (current-time) (-> self state-time)) (seconds 1)) ) ((let ((v1-13 (ja-group))) (and v1-13 (= v1-13 (-> self draw art-group data 53))) @@ -2663,7 +2663,3 @@ This commonly includes things such as: :code (the-as (function none :behavior metalkor-bomb) sleep-code) :post (the-as (function none :behavior metalkor-bomb) ja-post) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/nest/boss/metalkor-setup_REF.gc b/test/decompiler/reference/jak2/levels/nest/boss/metalkor-setup_REF.gc index 8830a82e1d..67ee423813 100644 --- a/test/decompiler/reference/jak2/levels/nest/boss/metalkor-setup_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/boss/metalkor-setup_REF.gc @@ -1390,7 +1390,7 @@ This commonly includes things such as: (cshape-reaction-update-state arg0 arg1 sv-16) (let ((s5-0 (-> arg0 process))) (cond - ((>= (- (-> self clock frame-counter) (-> (the-as metalkor-egg s5-0) sticky-time)) (seconds 0.05)) + ((>= (- (current-time) (-> (the-as metalkor-egg s5-0) sticky-time)) (seconds 0.05)) (let ((t9-1 vector--float*!) (a0-3 arg2) (a1-1 sv-16) @@ -1450,7 +1450,7 @@ This commonly includes things such as: ) ((let ((f1-6 4096.0)) (and (< (* f1-6 f1-6) f0-10) - (>= (- (-> self clock frame-counter) (-> (the-as metalkor-egg s5-0) sticky-time)) (seconds 0.2)) + (>= (- (current-time) (-> (the-as metalkor-egg s5-0) sticky-time)) (seconds 0.2)) ) ) (vector-float*! arg2 arg2 (/ 4096.0 (sqrtf f0-10))) @@ -2200,7 +2200,3 @@ This commonly includes things such as: (metalkor-go-next-stage) (none) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/nest/boss/metalkor-states_REF.gc b/test/decompiler/reference/jak2/levels/nest/boss/metalkor-states_REF.gc index 9ca4e5a4e4..c8735b6e1d 100644 --- a/test/decompiler/reference/jak2/levels/nest/boss/metalkor-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/boss/metalkor-states_REF.gc @@ -249,12 +249,10 @@ 0 ) ) - (if (and (nonzero? (-> self next-stage-timer)) - (>= (- (-> self clock frame-counter) (-> self next-stage-timer)) 0) - ) + (if (and (nonzero? (-> self next-stage-timer)) (>= (- (current-time) (-> self next-stage-timer)) 0)) (metalkor-go-next-stage) ) - (when (>= (- (-> self clock frame-counter) (-> self no-collision-timer)) (seconds 0.1)) + (when (>= (- (current-time) (-> self no-collision-timer)) (seconds 0.1)) (let ((v1-25 (-> self root-override root-prim))) (set! (-> v1-25 prim-core collide-as) (-> self root-override backup-collide-as)) (set! (-> v1-25 prim-core collide-with) (-> self root-override backup-collide-with)) @@ -765,7 +763,7 @@ (logtest? (penetrate dark-bomb) (-> (the-as attack-info s5-2) penetrate-using)) (= (-> self stage-hit-points) 0.0) ) - (set! v0-2 (the-as none (+ (-> self clock frame-counter) (seconds 1)))) + (set! v0-2 (the-as none (+ (current-time) (seconds 1)))) (set! (-> self next-stage-timer) (the-as time-frame v0-2)) v0-2 ) @@ -855,7 +853,7 @@ (set! (-> a1-43 param 1) (the-as uint v1-170)) ) (when (send-event-function gp-5 a1-43) - (set! (-> self no-collision-timer) (-> self clock frame-counter)) + (set! (-> self no-collision-timer) (current-time)) (let ((v1-175 (-> self root-override root-prim))) (set! (-> v1-175 prim-core collide-as) (collide-spec)) (set! (-> v1-175 prim-core collide-with) (collide-spec)) @@ -881,7 +879,7 @@ (when (not (handle->process (-> self flitters v1-3))) (new 'stack-no-clear 'vector) (let ((f0-1 (* 182.04445 (rand-vu-float-range 70.0 290.0)))) - (set! (-> self egg-timer) (-> self clock frame-counter)) + (set! (-> self egg-timer) (current-time)) (set! (-> self egg-angle) f0-1) (if (< 32768.0 f0-1) (send-event (handle->process (-> self lowtorso)) 'egg-toss 1.0) @@ -901,7 +899,7 @@ (if (zero? (-> self egg-timer)) (return #f) ) - (if (< (- (-> self clock frame-counter) (-> self egg-timer)) (seconds 0.2)) + (if (< (- (current-time) (-> self egg-timer)) (seconds 0.2)) (return #t) ) (dotimes (gp-0 10) @@ -1858,7 +1856,7 @@ :virtual #t :event metalkor-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (ja-channel-push! 1 (seconds 0.1)) (ja :group! (-> self draw art-group data 30) :num! min) (none) @@ -1916,7 +1914,7 @@ :virtual #t :event metalkor-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self min-state-hit-points) (+ -0.34 (-> self stage-hit-points))) (if (nonzero? (-> self neck)) (set! (-> self neck flex-blend) 0.0) @@ -1943,7 +1941,7 @@ (none) ) :trans (behavior () - (if (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (or (>= (- (current-time) (-> self state-time)) (seconds 1)) (>= (-> self min-state-hit-points) (-> self stage-hit-points)) ) (go-virtual overload-recover) @@ -2012,13 +2010,13 @@ (defstate play-drop-movie (metalkor) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (process-entity-status! self (entity-perm-status subtask-complete) #t) (process-spawn scene-player :init scene-player-init "nest-kor-boss-fight-mid" #t "nestb-boss") (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (deactivate self) ) (none) @@ -2056,7 +2054,7 @@ (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)) - (>= (+ (-> self clock frame-counter) (seconds -1.2)) (-> 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) @@ -2125,7 +2123,7 @@ (vector-normalize! s4-0 f0-12) ) ) - (if (and (< (+ (-> self clock frame-counter) (seconds -0.1)) (-> self previous-flat-travel-timer)) + (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) @@ -2133,11 +2131,11 @@ (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) (< (+ (-> self clock frame-counter) (seconds -0.1)) (-> self previous-flat-travel-timer))) + (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! (-> self previous-flat-travel-timer) (-> self clock frame-counter)) + (set! (-> self previous-flat-travel-timer) (current-time)) (if (zero? (-> self previous-flat-travel-long-timer)) - (set! (-> self previous-flat-travel-long-timer) (-> self clock frame-counter)) + (set! (-> self previous-flat-travel-long-timer) (current-time)) ) ) ) @@ -2337,12 +2335,12 @@ :virtual #t :event metalkor-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 4)) + ((>= (- (current-time) (-> self state-time)) (seconds 4)) (go-virtual chase-target) ) ((let ((f0-0 57344.0)) @@ -2383,7 +2381,7 @@ :virtual #t :event metalkor-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self shots-fired) 0) (set! (-> self current-nav-poly) (cloest-point-on-mesh (-> self nav) @@ -2417,12 +2415,10 @@ (sound-play "nboss-pre-shot") ) ) - (when (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.25)) - (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.75)) - (nonzero? (-> self shots-fired)) - ) + (when (or (>= (- (current-time) (-> self state-time)) (seconds 1.25)) + (and (>= (- (current-time) (-> self state-time)) (seconds 0.75)) (nonzero? (-> self shots-fired))) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (metalkor-shoot-projectile) (set-nestb-purple! (fmax 1.0 (get-nestb-purple))) (metalkor-ja-float-stop (the-as art-joint-anim (-> self draw art-group data 32))) @@ -2431,10 +2427,10 @@ ) (if (zero? (-> self shots-fired)) (set-nestb-purple! - (fmax (get-nestb-purple) (* 0.0013333333 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (fmax (get-nestb-purple) (* 0.0013333333 (the float (- (current-time) (-> self state-time))))) ) (set-nestb-purple! - (fmax (get-nestb-purple) (* 0.0022222223 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (fmax (get-nestb-purple) (* 0.0022222223 (the float (- (current-time) (-> self state-time))))) ) ) (metalkor-common) @@ -2453,7 +2449,7 @@ :virtual #t :event metalkor-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self current-nav-poly) (cloest-point-on-mesh (-> self nav) (-> self root-override trans) @@ -2466,7 +2462,7 @@ :trans (behavior () (let ((v1-2 (ja-group))) (when (and (not (and v1-2 (= v1-2 (-> self draw art-group data 33)))) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (>= (- (current-time) (-> self state-time)) (seconds 3)) ) (cond ((or (< (-> self last-standing-attack) -1) @@ -2571,7 +2567,7 @@ :virtual #t :event metalkor-handler :enter (behavior () - (set! (-> self shoot-timer) (-> self clock frame-counter)) + (set! (-> self shoot-timer) (current-time)) (set! (-> self shots-fired) 0) (set! (-> self wave-timer) 0) (set! (-> self in-wave) #f) @@ -2594,9 +2590,9 @@ (if (and (-> self in-wave) (= (-> self stage) 1)) (set! v1-0 3000) ) - (when (>= (- (-> self clock frame-counter) (-> self wave-timer)) v1-0) + (when (>= (- (current-time) (-> self wave-timer)) v1-0) (set! (-> self in-wave) (not (-> self in-wave))) - (set! (-> self wave-timer) (-> self clock frame-counter)) + (set! (-> self wave-timer) (current-time)) ) ) (cond @@ -2607,8 +2603,8 @@ (set! (-> self launching-wasps) #t) ) ) - (when (and (-> self launching-wasps) (>= (- (-> self clock frame-counter) (-> self wasp-timer)) (seconds 1.5))) - (set! (-> self wasp-timer) (-> self clock frame-counter)) + (when (and (-> self launching-wasps) (>= (- (current-time) (-> self wasp-timer)) (seconds 1.5))) + (set! (-> self wasp-timer) (current-time)) (dotimes (gp-0 3) (when (not (handle->process (-> self wasps gp-0))) (set! sv-16 (new 'static 'res-tag)) @@ -2678,31 +2674,31 @@ ) (rotate-and-update-hang-anim) (if (and (< 10922.667 (-> self target-angle)) - (< (- (-> self clock frame-counter) (-> self shoot-timer)) (seconds 3.75)) + (< (- (current-time) (-> self shoot-timer)) (seconds 3.75)) (zero? (mod (-> self shots-fired) (-> self stage))) ) (set! (-> self shoot-timer) - (the-as time-frame (max (-> self shoot-timer) (+ (-> self clock frame-counter) (seconds -2.75)))) + (the-as time-frame (max (-> self shoot-timer) (+ (current-time) (seconds -2.75)))) ) ) (cond ((metalkor-check-egg) - (set! (-> self shoot-timer) (-> self clock frame-counter)) + (set! (-> self shoot-timer) (current-time)) ) - ((or (>= (- (-> self clock frame-counter) (-> self shoot-timer)) (seconds 3.75)) + ((or (>= (- (current-time) (-> self shoot-timer)) (seconds 3.75)) (nonzero? (mod (-> self shots-fired) (-> self stage))) ) - (set! (-> self flitter-timer) (-> self clock frame-counter)) + (set! (-> self flitter-timer) (current-time)) (spawn (-> self shot-anticipate) (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 7))) (if (zero? (mod (-> self shots-fired) (-> self stage))) (set-nestb-purple! (fmax (get-nestb-purple) - (* 0.0013333333 (the float (+ (- (seconds -3.75) (-> self shoot-timer)) (-> self clock frame-counter)))) + (* 0.0013333333 (the float (+ (- (seconds -3.75) (-> self shoot-timer)) (current-time)))) ) ) (set-nestb-purple! - (fmax (get-nestb-purple) (* 0.0022222223 (the float (- (-> self clock frame-counter) (-> self shoot-timer))))) + (fmax (get-nestb-purple) (* 0.0022222223 (the float (- (current-time) (-> self shoot-timer))))) ) ) (let* ((v1-123 (the-as art-joint-anim (-> self draw art-group data 23))) @@ -2716,12 +2712,12 @@ (sound-play "nboss-pre-shot") ) ) - (when (or (>= (- (-> self clock frame-counter) (-> self shoot-timer)) (seconds 5)) - (and (>= (- (-> self clock frame-counter) (-> self shoot-timer)) (seconds 0.75)) + (when (or (>= (- (current-time) (-> self shoot-timer)) (seconds 5)) + (and (>= (- (current-time) (-> self shoot-timer)) (seconds 0.75)) (nonzero? (mod (-> self shots-fired) (-> self stage))) ) ) - (set! (-> self shoot-timer) (-> self clock frame-counter)) + (set! (-> self shoot-timer) (current-time)) (metalkor-shoot-projectile) (set-nestb-purple! (fmax 1.0 (get-nestb-purple))) (metalkor-ja-float-stop (the-as art-joint-anim (-> self draw art-group data 23))) @@ -2730,11 +2726,9 @@ (metalkor-all-spinners-on) ) ) - ((and (-> self launching-flitters) - (>= (+ (-> self clock frame-counter) (seconds -0.5)) (-> self flitter-timer)) - ) - (set! (-> self flitter-timer) (-> self clock frame-counter)) - (set! (-> self shoot-timer) (-> self clock frame-counter)) + ((and (-> self launching-flitters) (>= (+ (current-time) (seconds -0.5)) (-> self flitter-timer))) + (set! (-> self flitter-timer) (current-time)) + (set! (-> self shoot-timer) (current-time)) (metalkor-start-egg) ) ) @@ -2778,7 +2772,7 @@ :virtual #t :event metalkor-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self current-nav-poly) (cloest-point-on-mesh (-> self nav) (-> self root-override trans) @@ -2797,7 +2791,7 @@ (vf2 :class vf) ) (init-vf0-vector) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.017)) (cpad-hold? 1 x)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.017)) (cpad-hold? 1 x)) (go-virtual test) ) (let ((s4-0 (new-stack-vector0)) @@ -2818,7 +2812,7 @@ (matrix->quaternion (-> self root-override quat) s1-0) (quaternion-normalize! (-> self root-override quat)) (when (and (nonzero? (-> self previous-flat-travel-long-timer)) - (>= (+ (-> self clock frame-counter) (seconds -1.2)) (-> 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) @@ -2846,7 +2840,7 @@ (vector-normalize! s5-1 f0-9) ) ) - (if (and (< (+ (-> self clock frame-counter) (seconds -0.1)) (-> self previous-flat-travel-timer)) + (if (and (< (+ (current-time) (seconds -0.1)) (-> self previous-flat-travel-timer)) (< (vector-dot s5-1 (-> self previous-flat-travel)) 0.0) ) (vector-negate! s5-1 s5-1) @@ -2854,11 +2848,11 @@ (set! (-> s4-1 x) (-> s3-0 intersection x)) (set! (-> s4-1 z) (-> s3-0 intersection z)) (vector-! s4-1 s4-1 (-> s3-0 boundary-normal)) - (when (or (> s2-1 0) (< (+ (-> self clock frame-counter) (seconds -0.1)) (-> self previous-flat-travel-timer))) + (when (or (> s2-1 0) (< (+ (current-time) (seconds -0.1)) (-> self previous-flat-travel-timer))) (set! (-> self previous-flat-travel quad) (-> s5-1 quad)) - (set! (-> self previous-flat-travel-timer) (-> self clock frame-counter)) + (set! (-> self previous-flat-travel-timer) (current-time)) (if (zero? (-> self previous-flat-travel-long-timer)) - (set! (-> self previous-flat-travel-long-timer) (-> self clock frame-counter)) + (set! (-> self previous-flat-travel-long-timer) (current-time)) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/nest/boss/nestb-scenes_REF.gc b/test/decompiler/reference/jak2/levels/nest/boss/nestb-scenes_REF.gc index d2c09e2b0c..a72b4c853f 100644 --- a/test/decompiler/reference/jak2/levels/nest/boss/nestb-scenes_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/boss/nestb-scenes_REF.gc @@ -15,14 +15,14 @@ (set! (-> a1-0 message) 'test-pickup) (set! (-> a1-0 param 0) (the-as uint 7)) (let ((f30-0 (send-event-function *target* a1-0))) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.1)) (suspend) ) ) (send-event *target* 'change-mode 'darkjak #f 64) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.1)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/nest/flying-spider_REF.gc b/test/decompiler/reference/jak2/levels/nest/flying-spider_REF.gc index e983123565..74407eda6e 100644 --- a/test/decompiler/reference/jak2/levels/nest/flying-spider_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/flying-spider_REF.gc @@ -614,7 +614,7 @@ :event (the-as (function process int symbol event-message-block object :behavior flying-spider) enemy-event-handler) :enter (behavior () (dispose! self) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self hit-points) 0) (enemy-method-103 self) (none) @@ -738,48 +738,46 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs pat-surface. (defmethod enemy-method-125 flying-spider ((obj flying-spider) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) - (with-pp - (the-as - pat-surface - (when (find-ground (-> obj root-override2) arg0 arg1 arg2 arg3 arg4) - (set! (-> obj root-override2 ground-pat) (-> arg0 best-other-tri pat)) - (when (>= (- (-> pp clock frame-counter) (-> obj gspot-timer)) (seconds 0.2)) - (let ((a1-2 (new 'stack-no-clear 'collide-query))) - (set! (-> a1-2 start-pos quad) (-> obj root-override2 gspot-pos quad)) - (set! (-> a1-2 start-pos y) (+ 2048.0 (-> a1-2 start-pos y))) - (set-vector! (-> a1-2 move-dist) 0.0 -6144.0 0.0 0.0) - (let ((v1-10 a1-2)) - (set! (-> v1-10 radius) 4915.2) - (set! (-> v1-10 collide-with) arg1) - (set! (-> v1-10 ignore-process0) obj) - (set! (-> v1-10 ignore-process1) #f) - (set! (-> v1-10 ignore-pat) (-> obj root-override2 pat-ignore-mask)) - (set! (-> v1-10 action-mask) (collide-action solid)) - ) - (fill-using-line-sphere *collide-cache* a1-2) + (the-as + pat-surface + (when (find-ground (-> obj root-override2) arg0 arg1 arg2 arg3 arg4) + (set! (-> obj root-override2 ground-pat) (-> arg0 best-other-tri pat)) + (when (>= (- (current-time) (-> obj gspot-timer)) (seconds 0.2)) + (let ((a1-2 (new 'stack-no-clear 'collide-query))) + (set! (-> a1-2 start-pos quad) (-> obj root-override2 gspot-pos quad)) + (set! (-> a1-2 start-pos y) (+ 2048.0 (-> a1-2 start-pos y))) + (set-vector! (-> a1-2 move-dist) 0.0 -6144.0 0.0 0.0) + (let ((v1-10 a1-2)) + (set! (-> v1-10 radius) 4915.2) + (set! (-> v1-10 collide-with) arg1) + (set! (-> v1-10 ignore-process0) obj) + (set! (-> v1-10 ignore-process1) #f) + (set! (-> v1-10 ignore-pat) (-> obj root-override2 pat-ignore-mask)) + (set! (-> v1-10 action-mask) (collide-action solid)) ) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (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)))) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (vector-normalize! s2-1 1.0) - (vector-normalize! s1-1 1.0) - (vector-cross! s3-0 s2-1 s1-1) - (if (< (cos 10922.667) (vector-dot s3-0 *y-vector*)) - (vector+! s5-1 s5-1 s3-0) - ) - ) - ) - (vector-normalize-copy! (-> obj gspot-normal) s5-1 1.0) - ) - (set! (-> obj gspot-timer) (-> pp clock frame-counter)) + (fill-using-line-sphere *collide-cache* a1-2) ) - #t + (let ((s5-1 (new 'stack-no-clear 'vector))) + (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)))) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (vector-normalize! s2-1 1.0) + (vector-normalize! s1-1 1.0) + (vector-cross! s3-0 s2-1 s1-1) + (if (< (cos 10922.667) (vector-dot s3-0 *y-vector*)) + (vector+! s5-1 s5-1 s3-0) + ) + ) + ) + (vector-normalize-copy! (-> obj gspot-normal) s5-1 1.0) + ) + (set! (-> obj gspot-timer) (current-time)) ) + #t ) ) ) diff --git a/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc b/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc index 6940e13dbd..48dc6852ae 100644 --- a/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc @@ -562,8 +562,8 @@ (ja :num! (seek!)) ) (mammoth-walk-check-end) - (when (>= (- (-> self clock frame-counter) (-> self attack-timer)) (seconds 5)) - (set! (-> self attack-timer) (-> self clock frame-counter)) + (when (>= (- (current-time) (-> self attack-timer)) (seconds 5)) + (set! (-> self attack-timer) (current-time)) (go-virtual walking-attack) ) ) @@ -579,7 +579,7 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('event-attack) - (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (let ((v0-0 (the-as object (current-time)))) (set! (-> self lightning-timer) (the-as time-frame v0-0)) v0-0 ) @@ -607,15 +607,11 @@ (none) ) :trans (behavior () - (when (and (< (- (-> self clock frame-counter) (-> self lightning-timer)) (seconds 3)) - (< (-> self spawn-timer) (-> self clock frame-counter)) - ) + (when (and (< (- (current-time) (-> self lightning-timer)) (seconds 3)) (< (-> self spawn-timer) (current-time))) (let ((s5-0 *mammoth-lightning-joint-tbl*)) (mammoth-method-185 self (-> self root-override2 trans) (-> s5-0 (get-rand-int self (-> s5-0 length)))) ) - (set! (-> self spawn-timer) - (+ (-> self clock frame-counter) (the int (* 300.0 (get-rand-float-range self 0.0 0.1)))) - ) + (set! (-> self spawn-timer) (+ (current-time) (the int (* 300.0 (get-rand-float-range self 0.0 0.1))))) ) (none) ) @@ -642,8 +638,8 @@ (ja :num! (seek! max 0.8)) ) (mammoth-walk-check-end) - (when (>= (- (-> self clock frame-counter) (-> self attack-timer)) (seconds 3)) - (set! (-> self attack-timer) (-> self clock frame-counter)) + (when (>= (- (current-time) (-> self attack-timer)) (seconds 3)) + (set! (-> self attack-timer) (current-time)) (go-virtual walking) ) ) @@ -1570,8 +1566,8 @@ (when (logtest? (ash 1 v1-37) (-> obj foot-flags)) ) ) - (when (and (< (- (-> pp clock frame-counter) (-> obj lightning-timer)) (seconds 3)) - (< (-> obj lightning-attack-timer) (-> pp clock frame-counter)) + (when (and (< (- (current-time) (-> obj lightning-timer)) (seconds 3)) + (< (-> obj lightning-attack-timer) (current-time)) ) (let ((s5-2 *target*)) (when s5-2 @@ -1664,7 +1660,7 @@ ) ) (set! (-> obj lightning-attack-timer) - (+ (-> pp clock frame-counter) (the int (* 300.0 (get-rand-float-range obj 0.067 0.1)))) + (+ (current-time) (the int (* 300.0 (get-rand-float-range obj 0.067 0.1)))) ) ) ) @@ -1799,92 +1795,90 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy! mammoth ((obj mammoth)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (with-pp - (initialize-skeleton - obj - (the-as skeleton-group (art-group-get-by-name *level* "skel-mammoth" (the-as (pointer uint32) #f))) - (the-as pair 0) - ) - (init-enemy-behaviour-and-stats! obj *mammoth-nav-enemy-info*) - (logclear! (-> obj mask) (process-mask actor-pause)) - (set-vector! (-> obj root-override2 scale) 1.5 1.5 1.5 1.0) - (set! (-> obj y-level) -40959590.0) - (set! (-> obj foot-flags) (the-as uint 0)) - (set! (-> obj old-foot-flags) (the-as uint 0)) - (set! (-> obj attack-timer) (-> pp clock frame-counter)) - (set! (-> obj spawn-timer) 0) - (set! (-> obj my-up-vector quad) (-> *y-vector* quad)) - (quaternion-copy! (-> obj my-up-quat) *unity-quaternion*) - (set! (-> obj gspot-timer) 0) - (set! (-> obj gspot-normal quad) (-> *y-vector* quad)) - (set! (-> obj align) (new 'process 'align-control obj)) - (dotimes (s5-1 4) - (set! (-> obj joint-ik s5-1) (new - 'process - 'joint-mod-ik - obj - (-> *mammoth-ik-setup* s5-1 elbow-index) - (-> *mammoth-ik-setup* s5-1 hand-dist) - ) - ) - (set! (-> obj joint-ik s5-1 elbow-pole-vector-axis) (the-as uint 2)) - (set! (-> obj joint-ik s5-1 elbow-rotation-axis) (the-as uint 0)) - (set! (-> obj joint-ik 0 callback) mammoth-leg-ik-callback) - ) - (logior! (-> obj joint-ik 1 flags) (joint-mod-ik-flags elbow-trans-neg)) - (logior! (-> obj joint-ik 2 flags) (joint-mod-ik-flags elbow-trans-neg)) - (logior! (-> obj joint-ik 0 flags) (joint-mod-ik-flags elbow-rot-neg)) - (logior! (-> obj joint-ik 1 flags) (joint-mod-ik-flags elbow-rot-neg)) - (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) - (set! (-> obj path-pos) 0.0) - (set! (-> obj path-index) 0) - (set! (-> obj path-index-dir) 1) - (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) - (get-point-in-path! (-> obj path) (-> obj root-override2 trans) 0.0 'interp) - (set! (-> obj move-pos 0 quad) (-> obj root-override2 trans quad)) - (set! (-> obj move-pos 1 quad) (-> obj root-override2 trans quad)) - (forward-up-nopitch->quaternion - (-> obj root-override2 quat) - (vector-! - (new 'stack-no-clear 'vector) - (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) (the float (+ (-> obj path-index) 1)) 'interp) - (-> obj root-override2 trans) - ) - *up-vector* - ) - (quaternion-copy! (-> obj tilt-quat) *unity-quaternion*) - (let ((a0-38 (-> obj node-list data 4))) - (set! (-> a0-38 param0) mammoth-joint-mod-tilt) - (set! (-> a0-38 param1) obj) - ) - (let ((a0-39 (-> obj node-list data 10))) - (set! (-> a0-39 param0) mammoth-joint-mod-heel) - (set! (-> a0-39 param1) obj) - (set! (-> a0-39 param2) (the-as basic 0)) - ) - (let ((v1-61 (-> obj node-list data 13))) - (set! (-> v1-61 param0) mammoth-joint-mod-heel) - (set! (-> v1-61 param1) obj) - (set! (-> v1-61 param2) (the-as basic 1)) - ) - (let ((v1-63 (-> obj node-list data 25))) - (set! (-> v1-63 param0) mammoth-joint-mod-heel) - (set! (-> v1-63 param1) obj) - (set! (-> v1-63 param2) (the-as basic 2)) - ) - (let ((v1-65 (-> obj node-list data 28))) - (set! (-> v1-65 param0) mammoth-joint-mod-heel) - (set! (-> v1-65 param1) obj) - (set! (-> v1-65 param2) (the-as basic 3)) - ) - (dotimes (v1-66 4) - (set! (-> obj heel-lerp v1-66) 0.0) - ) - (set! (-> obj lightning-timer) 0) - (set! (-> obj lightning-attack-timer) 0) - (set! (-> obj feet-ik-init-timer) (-> pp clock frame-counter)) - (logclear! (-> obj enemy-flags) (enemy-flag check-water-backup)) - 0 - (none) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-mammoth" (the-as (pointer uint32) #f))) + (the-as pair 0) ) + (init-enemy-behaviour-and-stats! obj *mammoth-nav-enemy-info*) + (logclear! (-> obj mask) (process-mask actor-pause)) + (set-vector! (-> obj root-override2 scale) 1.5 1.5 1.5 1.0) + (set! (-> obj y-level) -40959590.0) + (set! (-> obj foot-flags) (the-as uint 0)) + (set! (-> obj old-foot-flags) (the-as uint 0)) + (set! (-> obj attack-timer) (current-time)) + (set! (-> obj spawn-timer) 0) + (set! (-> obj my-up-vector quad) (-> *y-vector* quad)) + (quaternion-copy! (-> obj my-up-quat) *unity-quaternion*) + (set! (-> obj gspot-timer) 0) + (set! (-> obj gspot-normal quad) (-> *y-vector* quad)) + (set! (-> obj align) (new 'process 'align-control obj)) + (dotimes (s5-1 4) + (set! (-> obj joint-ik s5-1) (new + 'process + 'joint-mod-ik + obj + (-> *mammoth-ik-setup* s5-1 elbow-index) + (-> *mammoth-ik-setup* s5-1 hand-dist) + ) + ) + (set! (-> obj joint-ik s5-1 elbow-pole-vector-axis) (the-as uint 2)) + (set! (-> obj joint-ik s5-1 elbow-rotation-axis) (the-as uint 0)) + (set! (-> obj joint-ik 0 callback) mammoth-leg-ik-callback) + ) + (logior! (-> obj joint-ik 1 flags) (joint-mod-ik-flags elbow-trans-neg)) + (logior! (-> obj joint-ik 2 flags) (joint-mod-ik-flags elbow-trans-neg)) + (logior! (-> obj joint-ik 0 flags) (joint-mod-ik-flags elbow-rot-neg)) + (logior! (-> obj joint-ik 1 flags) (joint-mod-ik-flags elbow-rot-neg)) + (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) + (set! (-> obj path-pos) 0.0) + (set! (-> obj path-index) 0) + (set! (-> obj path-index-dir) 1) + (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) + (get-point-in-path! (-> obj path) (-> obj root-override2 trans) 0.0 'interp) + (set! (-> obj move-pos 0 quad) (-> obj root-override2 trans quad)) + (set! (-> obj move-pos 1 quad) (-> obj root-override2 trans quad)) + (forward-up-nopitch->quaternion + (-> obj root-override2 quat) + (vector-! + (new 'stack-no-clear 'vector) + (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) (the float (+ (-> obj path-index) 1)) 'interp) + (-> obj root-override2 trans) + ) + *up-vector* + ) + (quaternion-copy! (-> obj tilt-quat) *unity-quaternion*) + (let ((a0-38 (-> obj node-list data 4))) + (set! (-> a0-38 param0) mammoth-joint-mod-tilt) + (set! (-> a0-38 param1) obj) + ) + (let ((a0-39 (-> obj node-list data 10))) + (set! (-> a0-39 param0) mammoth-joint-mod-heel) + (set! (-> a0-39 param1) obj) + (set! (-> a0-39 param2) (the-as basic 0)) + ) + (let ((v1-61 (-> obj node-list data 13))) + (set! (-> v1-61 param0) mammoth-joint-mod-heel) + (set! (-> v1-61 param1) obj) + (set! (-> v1-61 param2) (the-as basic 1)) + ) + (let ((v1-63 (-> obj node-list data 25))) + (set! (-> v1-63 param0) mammoth-joint-mod-heel) + (set! (-> v1-63 param1) obj) + (set! (-> v1-63 param2) (the-as basic 2)) + ) + (let ((v1-65 (-> obj node-list data 28))) + (set! (-> v1-65 param0) mammoth-joint-mod-heel) + (set! (-> v1-65 param1) obj) + (set! (-> v1-65 param2) (the-as basic 3)) + ) + (dotimes (v1-66 4) + (set! (-> obj heel-lerp v1-66) 0.0) + ) + (set! (-> obj lightning-timer) 0) + (set! (-> obj lightning-attack-timer) 0) + (set! (-> obj feet-ik-init-timer) (current-time)) + (logclear! (-> obj enemy-flags) (enemy-flag check-water-backup)) + 0 + (none) ) diff --git a/test/decompiler/reference/jak2/levels/nest/mantis_REF.gc b/test/decompiler/reference/jak2/levels/nest/mantis_REF.gc index edb005447b..79a2904ac9 100644 --- a/test/decompiler/reference/jak2/levels/nest/mantis_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/mantis_REF.gc @@ -588,14 +588,14 @@ ) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.6)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 0.6)) (suspend) ) ) (logior! (-> self draw status) (draw-control-status no-draw)) - (let ((gp-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-2) (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) + (let ((gp-2 (current-time))) + (until (>= (- (current-time) gp-2) (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) (suspend) ) ) @@ -652,7 +652,7 @@ ) 0 (look-at-target! self (enemy-flag lock-focus)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self root-override2 trans y) (+ -18841.6 (-> self base-height))) (let ((gp-0 (-> self root-override2))) (let ((v1-11 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> gp-0 quat)))) @@ -715,8 +715,8 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (if (logtest? (-> self root-override2 status) (collide-status on-ground)) (goto cfg-32) ) @@ -774,7 +774,7 @@ (let ((f30-1 (vector-length s5-1))) (when (not (logtest? (-> self flags) (mantis-flag tracked))) (cond - ((< (- (-> self clock frame-counter) (-> self attack-timer)) (seconds 5)) + ((< (- (current-time) (-> self attack-timer)) (seconds 5)) (if (and (< 73728.0 f30-1) (mantis-method-194 self)) (go-virtual crawl) ) @@ -787,7 +787,7 @@ (when (and (and gp-0 (not (logtest? (-> (the-as process-focusable gp-0) focus-status) (focus-status disable dead ignore grabbed))) ) - (and (>= (- (-> self clock frame-counter) (-> self attack-timer)) (seconds 5)) + (and (>= (- (current-time) (-> self attack-timer)) (seconds 5)) (enemy-method-95 self s4-0 8192.0) (< f30-1 32768.0) ) @@ -824,7 +824,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior mantis) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (change-to (nav-mesh-from-res-tag (-> self entity) 'nav-mesh-actor 1) self) (nav-enemy-method-166 self) (let ((v1-6 (-> self nav))) @@ -944,9 +944,7 @@ (suspend) (ja :num! (seek!)) ) - (if (and (>= (- (-> self clock frame-counter) (-> self attack-timer)) (seconds 5)) - (< 1 (the-as int (-> self focus aware))) - ) + (if (and (>= (- (current-time) (-> self attack-timer)) (seconds 5)) (< 1 (the-as int (-> self focus aware)))) (go-virtual hostile) ) (if (< (vector-vector-xz-distance (-> self root-override2 trans) (-> self move-dest)) 13107.2) @@ -966,7 +964,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior mantis) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -975,7 +973,7 @@ (set! (-> v1-2 nav callback-info) (-> v1-2 enemy-info-override callback-info)) ) 0 - (set! (-> self attack-timer) (-> self clock frame-counter)) + (set! (-> self attack-timer) (current-time)) (none) ) :exit (behavior () @@ -1036,8 +1034,8 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior mantis) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self attack-timer) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self attack-timer) (current-time)) (none) ) :exit (behavior () @@ -1241,7 +1239,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior mantis) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (look-at-target! self (enemy-flag lock-focus)) (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (let ((v1-6 self)) @@ -1258,7 +1256,7 @@ ) 0 (logclear! (-> self mask) (process-mask actor-pause)) - (set! (-> self starting-time) (-> self clock frame-counter)) + (set! (-> self starting-time) (current-time)) (none) ) :trans (behavior () @@ -1303,7 +1301,7 @@ (go-virtual crawl) ) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (if (and (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (>= (the-as int (-> self focus aware)) 3) (get-enemy-target self) ) @@ -1333,73 +1331,71 @@ (defmethod general-event-handler mantis ((obj mantis) (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" - (with-pp - (case arg2 - (('track) - (if (and (-> arg3 param 0) (>= (- (-> pp clock frame-counter) (-> obj track-timer)) (seconds 0.5))) - 'abort - #t - ) - ) - (('tracked) - (logior! (-> obj flags) (mantis-flag tracked)) - (let ((v0-0 (the-as object (-> pp clock frame-counter)))) - (set! (-> obj track-timer) (the-as time-frame v0-0)) - v0-0 + (case arg2 + (('track) + (if (and (-> arg3 param 0) (>= (- (current-time) (-> obj track-timer)) (seconds 0.5))) + 'abort + #t ) + ) + (('tracked) + (logior! (-> obj flags) (mantis-flag tracked)) + (let ((v0-0 (the-as object (current-time)))) + (set! (-> obj track-timer) (the-as time-frame v0-0)) + v0-0 ) - (('hit 'hit-knocked) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj focus-status) (focus-status dangerous)) - (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) - (logior! (-> obj focus-status) (focus-status hit)) - (if (zero? (-> obj hit-points)) - (logior! (-> obj focus-status) (focus-status dead)) - ) - (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) - (enemy-method-62 obj) - (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (process-contact-action arg0) - (send-event arg0 'get-attack-count 1) - (cond - ((zero? (-> obj hit-points)) - (let ((s5-1 (-> obj incoming knocked-type))) - (cond - ((and (= s5-1 (knocked-type knocked-type-4)) - (not (and (-> obj next-state) (let ((v1-41 (-> obj next-state name))) - (or (= v1-41 'knocked) (= v1-41 'jump) (= v1-41 'jump-land)) - ) - ) - ) - (zero? (get-rand-int obj 3)) - (let ((f0-0 (vector-vector-distance-squared (-> obj root-override2 trans) (target-pos 0))) - (f1-0 32768.0) - ) - (>= f0-0 (* f1-0 f1-0)) - ) + ) + (('hit 'hit-knocked) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) + ) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (process-contact-action arg0) + (send-event arg0 'get-attack-count 1) + (cond + ((zero? (-> obj hit-points)) + (let ((s5-1 (-> obj incoming knocked-type))) + (cond + ((and (= s5-1 (knocked-type knocked-type-4)) + (not (and (-> obj next-state) (let ((v1-41 (-> obj next-state name))) + (or (= v1-41 'knocked) (= v1-41 'jump) (= v1-41 'jump-land)) + ) + ) + ) + (zero? (get-rand-int obj 3)) + (let ((f0-0 (vector-vector-distance-squared (-> obj root-override2 trans) (target-pos 0))) + (f1-0 32768.0) + ) + (>= f0-0 (* f1-0 f1-0)) ) - (kill-prefer-falling obj) - ) - ((or (= s5-1 (knocked-type knocked-type-4)) (= s5-1 (knocked-type knocked-type-6))) - (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) - (go (method-of-object obj knocked)) - ) - (else - (go (method-of-object obj knocked)) - ) + ) + (kill-prefer-falling obj) + ) + ((or (= s5-1 (knocked-type knocked-type-4)) (= s5-1 (knocked-type knocked-type-6))) + (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) + (go (method-of-object obj knocked)) + ) + (else + (go (method-of-object obj knocked)) ) ) ) - (else - (go (method-of-object obj knocked)) - ) - ) - #t - ) - (else - ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) + (else + (go (method-of-object obj knocked)) + ) + ) + #t + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1486,48 +1482,46 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs pat-surface. (defmethod enemy-method-125 mantis ((obj mantis) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) - (with-pp - (the-as - pat-surface - (when (find-ground (-> obj root-override2) arg0 arg1 arg2 arg3 arg4) - (set! (-> obj root-override2 ground-pat) (-> arg0 best-other-tri pat)) - (when (>= (- (-> pp clock frame-counter) (-> obj gspot-timer)) (seconds 0.2)) - (let ((a1-2 (new 'stack-no-clear 'collide-query))) - (set! (-> a1-2 start-pos quad) (-> obj root-override2 gspot-pos quad)) - (set! (-> a1-2 start-pos y) (+ 2048.0 (-> a1-2 start-pos y))) - (set-vector! (-> a1-2 move-dist) 0.0 -6144.0 0.0 0.0) - (let ((v1-10 a1-2)) - (set! (-> v1-10 radius) 4915.2) - (set! (-> v1-10 collide-with) arg1) - (set! (-> v1-10 ignore-process0) obj) - (set! (-> v1-10 ignore-process1) #f) - (set! (-> v1-10 ignore-pat) (-> obj root-override2 pat-ignore-mask)) - (set! (-> v1-10 action-mask) (collide-action solid)) - ) - (fill-using-line-sphere *collide-cache* a1-2) + (the-as + pat-surface + (when (find-ground (-> obj root-override2) arg0 arg1 arg2 arg3 arg4) + (set! (-> obj root-override2 ground-pat) (-> arg0 best-other-tri pat)) + (when (>= (- (current-time) (-> obj gspot-timer)) (seconds 0.2)) + (let ((a1-2 (new 'stack-no-clear 'collide-query))) + (set! (-> a1-2 start-pos quad) (-> obj root-override2 gspot-pos quad)) + (set! (-> a1-2 start-pos y) (+ 2048.0 (-> a1-2 start-pos y))) + (set-vector! (-> a1-2 move-dist) 0.0 -6144.0 0.0 0.0) + (let ((v1-10 a1-2)) + (set! (-> v1-10 radius) 4915.2) + (set! (-> v1-10 collide-with) arg1) + (set! (-> v1-10 ignore-process0) obj) + (set! (-> v1-10 ignore-process1) #f) + (set! (-> v1-10 ignore-pat) (-> obj root-override2 pat-ignore-mask)) + (set! (-> v1-10 action-mask) (collide-action solid)) ) - (let ((s5-1 (new 'stack-no-clear 'vector))) - (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)))) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (vector-normalize! s2-1 1.0) - (vector-normalize! s1-1 1.0) - (vector-cross! s3-0 s2-1 s1-1) - (if (< (cos 10922.667) (vector-dot s3-0 *y-vector*)) - (vector+! s5-1 s5-1 s3-0) - ) - ) - ) - (vector-normalize-copy! (-> obj gspot-normal) s5-1 1.0) - ) - (set! (-> obj gspot-timer) (-> pp clock frame-counter)) + (fill-using-line-sphere *collide-cache* a1-2) ) - #t + (let ((s5-1 (new 'stack-no-clear 'vector))) + (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)))) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (vector-normalize! s2-1 1.0) + (vector-normalize! s1-1 1.0) + (vector-cross! s3-0 s2-1 s1-1) + (if (< (cos 10922.667) (vector-dot s3-0 *y-vector*)) + (vector+! s5-1 s5-1 s3-0) + ) + ) + ) + (vector-normalize-copy! (-> obj gspot-normal) s5-1 1.0) + ) + (set! (-> obj gspot-timer) (current-time)) ) + #t ) ) ) @@ -2088,20 +2082,18 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy! mantis ((obj mantis)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (with-pp - (initialize-skeleton - obj - (the-as skeleton-group (art-group-get-by-name *level* "skel-mantis" (the-as (pointer uint32) #f))) - (the-as pair 0) - ) - (init-enemy-behaviour-and-stats! obj *mantis-nav-enemy-info*) - (set! (-> obj flags) (mantis-flag)) - (set! (-> obj my-up-vector quad) (-> *y-vector* quad)) - (set! (-> obj gspot-normal quad) (-> *y-vector* quad)) - (set! (-> obj gspot-timer) 0) - (set! (-> obj attack-timer) (+ (-> pp clock frame-counter) (seconds -5))) - (set! (-> obj track-timer) 0) - (set! (-> obj draw light-index) (the-as uint 30)) - (none) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-mantis" (the-as (pointer uint32) #f))) + (the-as pair 0) ) + (init-enemy-behaviour-and-stats! obj *mantis-nav-enemy-info*) + (set! (-> obj flags) (mantis-flag)) + (set! (-> obj my-up-vector quad) (-> *y-vector* quad)) + (set! (-> obj gspot-normal quad) (-> *y-vector* quad)) + (set! (-> obj gspot-timer) 0) + (set! (-> obj attack-timer) (+ (current-time) (seconds -5))) + (set! (-> obj track-timer) 0) + (set! (-> obj draw light-index) (the-as uint 30)) + (none) ) diff --git a/test/decompiler/reference/jak2/levels/nest/nest-obs_REF.gc b/test/decompiler/reference/jak2/levels/nest/nest-obs_REF.gc index f26f031029..2768a4e137 100644 --- a/test/decompiler/reference/jak2/levels/nest/nest-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/nest-obs_REF.gc @@ -82,12 +82,12 @@ (defstate down (nest-switch) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self set-camera) #f) (none) ) :trans (behavior () - (when (and (not (-> self set-camera)) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.6))) + (when (and (not (-> self set-camera)) (>= (- (current-time) (-> self state-time)) (seconds 0.6))) (process-grab? *target* #f) (hide-hud-quick #f) (set-setting! 'process-mask 'set 0.0 (process-mask movie enemy)) @@ -111,8 +111,8 @@ (set! (-> self root trans y) (+ (-> self y-start) (-> self y-delta))) (suspend) ) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (seek! (-> self y-rot-rate) 0.0 (* 4000.0 (-> self clock seconds-per-frame))) (quaternion-rotate-y! (-> self root quat) @@ -122,8 +122,8 @@ (suspend) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -249,8 +249,8 @@ This commonly includes things such as: :virtual #t :trans (the-as (function none :behavior nest-piston) rider-trans) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/nest/nest-scenes_REF.gc b/test/decompiler/reference/jak2/levels/nest/nest-scenes_REF.gc index 715fc3b6c8..1b7e27395e 100644 --- a/test/decompiler/reference/jak2/levels/nest/nest-scenes_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/nest-scenes_REF.gc @@ -93,7 +93,7 @@ (defstate zap (canyon-lightning-thingy) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -121,7 +121,7 @@ ) :trans (behavior () (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.125)) + ((>= (- (current-time) (-> self state-time)) (seconds 0.125)) (let ((gp-0 (new 'stack-no-clear 'vector))) (set! (-> gp-0 quad) (-> self root trans quad)) (let ((v1-7 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> self root quat))) diff --git a/test/decompiler/reference/jak2/levels/palace/boss/squid-extras_REF.gc b/test/decompiler/reference/jak2/levels/palace/boss/squid-extras_REF.gc index d0d6921339..25e0bb39d1 100644 --- a/test/decompiler/reference/jak2/levels/palace/boss/squid-extras_REF.gc +++ b/test/decompiler/reference/jak2/levels/palace/boss/squid-extras_REF.gc @@ -155,7 +155,7 @@ (vf2 :class vf) ) (init-vf0-vector) - (let ((f28-0 (/ (the float (- (-> pp clock frame-counter) (-> arg0 traj-timer))) (-> arg0 traj-duration))) + (let ((f28-0 (/ (the float (- (current-time) (-> arg0 traj-timer))) (-> arg0 traj-duration))) (s5-0 (new 'stack-no-clear 'vector)) ) (let ((f30-0 (compute-time-until-apex (-> arg0 traj)))) @@ -306,28 +306,26 @@ ;; definition for method 31 of type squid-grenade (defmethod init-proj-settings! squid-grenade ((obj squid-grenade)) "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc" - (with-pp - (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 1120) obj)) - (set! (-> obj attack-mode) 'squid-grenade) - (set! (-> obj max-speed) 655360.0) - (set! (-> obj move) squid-grenade-move) - (set! (-> obj timeout) (seconds 5)) - (set! (-> obj stop-speed) 4.096) - (set! (-> obj fly-sound) (new-sound-id)) - (set! (-> obj traj-timer) (-> pp clock frame-counter)) - (vector+! (-> obj traj-dest) (-> obj root-override trans) (-> obj root-override transv)) - (set! (-> obj traj-duration) - (fmax 600.0 (* 0.0018310547 (vector-vector-xz-distance (-> obj root-override trans) (-> obj traj-dest)))) - ) - (+! (-> obj traj-duration) (* 75.0 (rand-vu))) - (let ((f0-8 32768.0)) - (if (< (-> obj root-override trans y) (-> obj traj-dest y)) - (+! f0-8 (- (-> obj traj-dest y) (-> obj root-override trans y))) - ) - (setup-from-to-duration-and-height! (-> obj traj) (-> obj root-override trans) (-> obj traj-dest) 1.0 f0-8) - ) - (none) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 1120) obj)) + (set! (-> obj attack-mode) 'squid-grenade) + (set! (-> obj max-speed) 655360.0) + (set! (-> obj move) squid-grenade-move) + (set! (-> obj timeout) (seconds 5)) + (set! (-> obj stop-speed) 4.096) + (set! (-> obj fly-sound) (new-sound-id)) + (set! (-> obj traj-timer) (current-time)) + (vector+! (-> obj traj-dest) (-> obj root-override trans) (-> obj root-override transv)) + (set! (-> obj traj-duration) + (fmax 600.0 (* 0.0018310547 (vector-vector-xz-distance (-> obj root-override trans) (-> obj traj-dest)))) + ) + (+! (-> obj traj-duration) (* 75.0 (rand-vu))) + (let ((f0-8 32768.0)) + (if (< (-> obj root-override trans y) (-> obj traj-dest y)) + (+! f0-8 (- (-> obj traj-dest y) (-> obj root-override trans y))) + ) + (setup-from-to-duration-and-height! (-> obj traj) (-> obj root-override trans) (-> obj traj-dest) 1.0 f0-8) ) + (none) ) ;; definition for function squid-whirlwind-move @@ -340,12 +338,8 @@ (* 819.2 (-> self clock time-adjust-ratio)) ) (let ((gp-0 (new 'stack-no-clear 'vector))) - (let ((f30-0 - (lerp-scale 12288.0 32768.0 (the float (- (-> self clock frame-counter) (-> self state-time))) 0.0 900.0) - ) - (f28-0 - (lerp-scale 1024.0 4096.0 (the float (- (-> self clock frame-counter) (-> self state-time))) 0.0 900.0) - ) + (let ((f30-0 (lerp-scale 12288.0 32768.0 (the float (- (current-time) (-> self state-time))) 0.0 900.0)) + (f28-0 (lerp-scale 1024.0 4096.0 (the float (- (current-time) (-> self state-time))) 0.0 900.0)) ) (vector-! (-> self root transv) (-> self root trans) (-> self center)) (set-vector! gp-0 (- (-> self root transv z)) 0.0 (-> self root transv x) 1.0) @@ -405,7 +399,7 @@ (defstate idle (squid-whirlwind) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self duration) (the-as time-frame (+ (the int (* 150.0 (rand-vu))) 1050))) (none) ) @@ -419,7 +413,7 @@ (set! (-> a1-2 y) (+ 2048.0 (-> a1-2 y))) (spawn (-> self part) a1-2) ) - (when (or (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self duration)) + (when (or (>= (- (current-time) (-> self state-time)) (-> self duration)) (let ((f0-3 (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans))) (f1-1 12288.0) ) @@ -573,7 +567,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/palace/boss/squid-setup_REF.gc b/test/decompiler/reference/jak2/levels/palace/boss/squid-setup_REF.gc index 5f315f5592..fa47bdc58e 100644 --- a/test/decompiler/reference/jak2/levels/palace/boss/squid-setup_REF.gc +++ b/test/decompiler/reference/jak2/levels/palace/boss/squid-setup_REF.gc @@ -1518,7 +1518,7 @@ ;; WARN: Return type mismatch vector vs none. (defbehavior squid-increment-shield squid ((arg0 float)) (set! (-> self shield-hit-points) (fmin 1.0 (fmax 0.0 (+ (-> self shield-hit-points) arg0)))) - (set! (-> self shield-timer) (+ (-> self clock frame-counter) (seconds -0.125))) + (set! (-> self shield-timer) (+ (current-time) (seconds -0.125))) (let ((gp-0 (new 'stack-no-clear 'vector))) (cond ((< (-> self shield-hit-points) 0.5) @@ -1728,7 +1728,7 @@ (squid-take-hit (the-as touching-shapes-entry (-> arg3 param 0)) (the-as attack-info (-> arg3 param 1)) #f) ) ) - ((>= (- (-> self clock frame-counter) (-> self invincible-timer)) (seconds 3)) + ((>= (- (current-time) (-> self invincible-timer)) (seconds 3)) (cond ((and (= (-> self shield-hit-points) 0.0) (not (and (-> self next-state) (= (-> self next-state name) 'recharge))) @@ -1742,7 +1742,7 @@ ) ) (squid-take-hit (the-as touching-shapes-entry (-> arg3 param 0)) (the-as attack-info (-> arg3 param 1)) #t) - (set! (-> self invincible-timer) (-> self clock frame-counter)) + (set! (-> self invincible-timer) (current-time)) (squid-check-hit-points) ) ((or (!= (-> self shield-hit-points) 0.0) (and (-> self next-state) (= (-> self next-state name) 'recharge))) @@ -2396,23 +2396,21 @@ This commonly includes things such as: ;; WARN: Return type mismatch int vs none. (defmethod set-traj-towards-vec squid ((obj squid) (src vector) (arg2 vector) (dest vector)) "Set up the [[trajectory]] towards `dest`." - (with-pp - (set! (-> obj traj-timer) (-> pp clock frame-counter)) - (set! (-> obj traj-src quad) (-> src quad)) - (set! (-> obj traj-dest quad) (-> dest quad)) - (set! (-> obj traj-duration) (* 0.00091552734 (vector-vector-xz-distance arg2 dest))) - (set! (-> obj traj-duration) (fmax 480.0 (-> obj traj-duration))) - (let ((f0-4 49152.0)) - (if (< (-> arg2 y) (-> dest y)) - (+! f0-4 (- (-> dest y) (-> arg2 y))) - ) - (setup-from-to-duration-and-height! (-> obj traj) arg2 dest 1.0 f0-4) - ) - (set! (-> obj residual-accumulator-1) 1.0) - (set! (-> obj residual-accumulator-2) 0.0) - 0 - (none) + (set! (-> obj traj-timer) (current-time)) + (set! (-> obj traj-src quad) (-> src quad)) + (set! (-> obj traj-dest quad) (-> dest quad)) + (set! (-> obj traj-duration) (* 0.00091552734 (vector-vector-xz-distance arg2 dest))) + (set! (-> obj traj-duration) (fmax 480.0 (-> obj traj-duration))) + (let ((f0-4 49152.0)) + (if (< (-> arg2 y) (-> dest y)) + (+! f0-4 (- (-> dest y) (-> arg2 y))) + ) + (setup-from-to-duration-and-height! (-> obj traj) arg2 dest 1.0 f0-4) ) + (set! (-> obj residual-accumulator-1) 1.0) + (set! (-> obj residual-accumulator-2) 0.0) + 0 + (none) ) ;; definition for method 47 of type squid @@ -2423,225 +2421,221 @@ This commonly includes things such as: ;; definition for method 48 of type squid ;; INFO: Used lq/sq (defmethod squid-method-48 squid ((obj squid)) - (with-pp - (when (< 0.00001 (-> obj residual-accumulator-1)) - (set! (-> obj residual-accumulator-1) (* 0.95 (-> obj residual-accumulator-1))) - (+! (-> obj residual-accumulator-2) (-> obj residual-accumulator-1)) - ) - (let* ((f28-0 ((method-of-type trajectory compute-time-until-apex) - (the-as trajectory (&-> (the-as squid-grenade (-> obj self)) ignore-handle)) - ) - ) - (s3-0 (compute-trans-at-time (-> obj traj) f28-0 (new 'stack-no-clear 'vector))) - (s5-0 (new 'stack-no-clear 'vector)) - (s4-0 (new 'stack-no-clear 'vector)) - (f30-0 (/ (the float (- (-> pp clock frame-counter) (-> obj traj-timer))) (-> obj traj-duration))) - ) - (let ((f26-0 (float-sin-clamp obj f30-0))) - (when (and (-> obj can-play-squid-boost) (< 0.125 f30-0)) - (set! (-> obj can-play-squid-boost) #f) - (sound-play "squid-boost") - ) - (cond - ((< f26-0 1.0) - (compute-trans-at-time (-> obj traj) f26-0 s5-0) - (set! (-> s4-0 quad) (-> obj traj-src quad)) - (+! (-> s4-0 y) (* 204.8 (the float (- (-> pp clock frame-counter) (-> obj traj-timer))) (/ f26-0 f30-0))) - (vector+float*! s4-0 s4-0 (-> obj residual-velocity) (-> obj residual-accumulator-2)) - (vector-lerp! s5-0 s4-0 s5-0 f26-0) - (cond - ((< f28-0 f26-0) - (let ((f28-1 (/ (- f26-0 f28-0) (- 1.0 f28-0)))) - (vector-lerp! s4-0 s3-0 (-> obj traj-dest) f28-1) - (vector-lerp! s5-0 s5-0 s4-0 f28-1) - ) - (squid-method-43 obj (squid-method-42 obj (new 'stack-no-clear 'vector)) 1092.2667 0.05) - (vector-! s4-0 (-> obj traj-dest) (-> obj trans)) - (vector-normalize! s4-0 1.75) - (dotimes (s3-2 6) - (send-event (handle->process (-> obj tentacles s3-2)) 'set-gravity s4-0) + (when (< 0.00001 (-> obj residual-accumulator-1)) + (set! (-> obj residual-accumulator-1) (* 0.95 (-> obj residual-accumulator-1))) + (+! (-> obj residual-accumulator-2) (-> obj residual-accumulator-1)) + ) + (let* ((f28-0 ((method-of-type trajectory compute-time-until-apex) + (the-as trajectory (&-> (the-as squid-grenade (-> obj self)) ignore-handle)) + ) ) + (s3-0 (compute-trans-at-time (-> obj traj) f28-0 (new 'stack-no-clear 'vector))) + (s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (f30-0 (/ (the float (- (current-time) (-> obj traj-timer))) (-> obj traj-duration))) + ) + (let ((f26-0 (float-sin-clamp obj f30-0))) + (when (and (-> obj can-play-squid-boost) (< 0.125 f30-0)) + (set! (-> obj can-play-squid-boost) #f) + (sound-play "squid-boost") + ) + (cond + ((< f26-0 1.0) + (compute-trans-at-time (-> obj traj) f26-0 s5-0) + (set! (-> s4-0 quad) (-> obj traj-src quad)) + (+! (-> s4-0 y) (* 204.8 (the float (- (current-time) (-> obj traj-timer))) (/ f26-0 f30-0))) + (vector+float*! s4-0 s4-0 (-> obj residual-velocity) (-> obj residual-accumulator-2)) + (vector-lerp! s5-0 s4-0 s5-0 f26-0) + (cond + ((< f28-0 f26-0) + (let ((f28-1 (/ (- f26-0 f28-0) (- 1.0 f28-0)))) + (vector-lerp! s4-0 s3-0 (-> obj traj-dest) f28-1) + (vector-lerp! s5-0 s5-0 s4-0 f28-1) ) - (else - (squid-method-43 obj (-> obj traj-dest) 546.13336 0.005) - ) - ) - (set! (-> obj trans quad) (-> s5-0 quad)) - ) - (else - (dotimes (s5-1 6) - (send-event (handle->process (-> obj tentacles s5-1)) 'set-gravity-slow (new 'static 'vector :y -1.0)) + (squid-method-43 obj (squid-method-42 obj (new 'stack-no-clear 'vector)) 1092.2667 0.05) + (vector-! s4-0 (-> obj traj-dest) (-> obj trans)) + (vector-normalize! s4-0 1.75) + (dotimes (s3-2 6) + (send-event (handle->process (-> obj tentacles s3-2)) 'set-gravity s4-0) ) - (set! (-> obj trans quad) (-> obj traj-dest quad)) ) + (else + (squid-method-43 obj (-> obj traj-dest) 546.13336 0.005) + ) + ) + (set! (-> obj trans quad) (-> s5-0 quad)) + ) + (else + (dotimes (s5-1 6) + (send-event (handle->process (-> obj tentacles s5-1)) 'set-gravity-slow (new 'static 'vector :y -1.0)) + ) + (set! (-> obj trans quad) (-> obj traj-dest quad)) ) ) - f30-0 ) + f30-0 ) ) ;; definition for method 49 of type squid ;; WARN: Return type mismatch int vs none. (defmethod setup-part-engine squid ((obj squid) (arg0 symbol)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> obj blink-time)) 0) - (set! (-> obj blink-mask) 0) - (dotimes (s5-0 10) - (let* ((f30-0 0.5) - (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-7 (the-as number (logior #x3f800000 v1-6))) - ) - (if (< f30-0 (+ -1.0 (the-as float v1-7))) - (logior! (-> obj blink-mask) (ash 1 s5-0)) - ) - ) - ) - (set! (-> obj blink-time) (+ (-> pp clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.25 0.75))))) - (set! arg0 #t) - ) - (when arg0 - (remove-from-process *part-engine* obj) - (add-connection - *part-engine* - obj - 5 - obj - 4790 - (new 'static 'vector :x -5906.432 :y 3317.76 :z -409.6 :w 819200.0) - ) - (add-connection - *part-engine* - obj - 5 - obj - 4790 - (new 'static 'vector :x 5906.432 :y 3317.76 :z -409.6 :w 819200.0) - ) - (add-connection *part-engine* obj 6 obj 4791 (new 'static 'vector :y 3366.912 :w 819200.0)) - (add-connection *part-engine* obj 13 obj 4791 (new 'static 'vector :y 11993.088 :z 5255.168 :w 819200.0)) - (add-connection - *part-engine* - obj - 5 - obj - 4792 - (new 'static 'vector :x 5439.488 :y -1794.048 :z 11444.224 :w 819200.0) - ) - (add-connection - *part-engine* - obj - 5 - obj - 4792 - (new 'static 'vector :x -5439.488 :y -1794.048 :z 11444.224 :w 819200.0) - ) - (let ((s5-2 (-> obj blink-mask))) - (if (logtest? s5-2 1) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x -4128.768 :y 2355.2 :z 3653.632 :w 819200.0) - ) - ) - (if (logtest? s5-2 2) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x -4554.752 :y 2449.408 :z 2359.296 :w 819200.0) - ) - ) - (if (logtest? s5-2 4) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x -4386.816 :y 2191.36 :z 528.384 :w 819200.0) - ) - ) - (if (logtest? s5-2 8) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x -5832.704 :y 2945.024 :z 1691.648 :w 819200.0) - ) - ) - (if (logtest? s5-2 16) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x -5861.376 :y 2920.448 :z 1118.208 :w 819200.0) - ) - ) - (if (logtest? s5-2 32) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x 4128.768 :y 2355.2 :z 3653.632 :w 819200.0) - ) - ) - (if (logtest? s5-2 64) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x 4554.752 :y 2449.408 :z 2359.296 :w 819200.0) - ) - ) - (if (logtest? s5-2 128) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x 4386.816 :y 2191.36 :z -528.384 :w 819200.0) - ) - ) - (if (logtest? s5-2 256) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x 5832.704 :y 2945.024 :z 1691.648 :w 819200.0) - ) - ) - (if (logtest? s5-2 512) - (add-connection - *part-engine* - obj - 5 - obj - 4793 - (new 'static 'vector :x 5861.376 :y 2920.448 :z 1118.208 :w 819200.0) - ) + (when (>= (- (current-time) (-> obj blink-time)) 0) + (set! (-> obj blink-mask) 0) + (dotimes (s5-0 10) + (let* ((f30-0 0.5) + (v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-7 (the-as number (logior #x3f800000 v1-6))) + ) + (if (< f30-0 (+ -1.0 (the-as float v1-7))) + (logior! (-> obj blink-mask) (ash 1 s5-0)) ) ) ) - 0 - (none) + (set! (-> obj blink-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.25 0.75))))) + (set! arg0 #t) ) + (when arg0 + (remove-from-process *part-engine* obj) + (add-connection + *part-engine* + obj + 5 + obj + 4790 + (new 'static 'vector :x -5906.432 :y 3317.76 :z -409.6 :w 819200.0) + ) + (add-connection + *part-engine* + obj + 5 + obj + 4790 + (new 'static 'vector :x 5906.432 :y 3317.76 :z -409.6 :w 819200.0) + ) + (add-connection *part-engine* obj 6 obj 4791 (new 'static 'vector :y 3366.912 :w 819200.0)) + (add-connection *part-engine* obj 13 obj 4791 (new 'static 'vector :y 11993.088 :z 5255.168 :w 819200.0)) + (add-connection + *part-engine* + obj + 5 + obj + 4792 + (new 'static 'vector :x 5439.488 :y -1794.048 :z 11444.224 :w 819200.0) + ) + (add-connection + *part-engine* + obj + 5 + obj + 4792 + (new 'static 'vector :x -5439.488 :y -1794.048 :z 11444.224 :w 819200.0) + ) + (let ((s5-2 (-> obj blink-mask))) + (if (logtest? s5-2 1) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x -4128.768 :y 2355.2 :z 3653.632 :w 819200.0) + ) + ) + (if (logtest? s5-2 2) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x -4554.752 :y 2449.408 :z 2359.296 :w 819200.0) + ) + ) + (if (logtest? s5-2 4) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x -4386.816 :y 2191.36 :z 528.384 :w 819200.0) + ) + ) + (if (logtest? s5-2 8) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x -5832.704 :y 2945.024 :z 1691.648 :w 819200.0) + ) + ) + (if (logtest? s5-2 16) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x -5861.376 :y 2920.448 :z 1118.208 :w 819200.0) + ) + ) + (if (logtest? s5-2 32) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x 4128.768 :y 2355.2 :z 3653.632 :w 819200.0) + ) + ) + (if (logtest? s5-2 64) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x 4554.752 :y 2449.408 :z 2359.296 :w 819200.0) + ) + ) + (if (logtest? s5-2 128) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x 4386.816 :y 2191.36 :z -528.384 :w 819200.0) + ) + ) + (if (logtest? s5-2 256) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x 5832.704 :y 2945.024 :z 1691.648 :w 819200.0) + ) + ) + (if (logtest? s5-2 512) + (add-connection + *part-engine* + obj + 5 + obj + 4793 + (new 'static 'vector :x 5861.376 :y 2920.448 :z 1118.208 :w 819200.0) + ) + ) + ) + ) + 0 + (none) ) ;; definition for method 50 of type squid @@ -2797,7 +2791,7 @@ This commonly includes things such as: ) (when (-> obj rush-sound-playing) (cond - ((or (zero? (-> obj rush-end-time)) (< (- (-> pp clock frame-counter) (-> obj rush-end-time)) (seconds 0.1))) + ((or (zero? (-> obj rush-end-time)) (< (- (current-time) (-> obj rush-end-time)) (seconds 0.1))) (the-as int (sound-play "squid-rush" :id (-> obj rush-sound) :position (-> obj root-override trans))) ) (else @@ -2831,12 +2825,8 @@ This commonly includes things such as: ) ) (else - (let* ((f0-23 - (fmin 1.0 (* 0.0011111111 (the float (- (-> pp clock frame-counter) (the-as time-frame (-> obj jet-pitch)))))) - ) - (f28-2 - (fmin 1.0 (* 0.006666667 (the float (- (-> pp clock frame-counter) (the-as time-frame (-> obj jet-volume)))))) - ) + (let* ((f0-23 (fmin 1.0 (* 0.0011111111 (the float (- (current-time) (the-as time-frame (-> obj jet-pitch))))))) + (f28-2 (fmin 1.0 (* 0.006666667 (the float (- (current-time) (the-as time-frame (-> obj jet-volume))))))) (f30-6 (* 0.2 (- 1.0 f0-23) (sin (* 32768.0 f0-23)))) (f0-31 (+ 1.0 (* 5.0 (- 1.0 f28-2) (sin (* 32768.0 f30-6))))) ) @@ -2889,10 +2879,7 @@ This commonly includes things such as: ) ) (when (not (and (-> obj next-state) (= (-> obj next-state name) 'recharge))) - (let ((v1-249 - (the int (lerp-scale 0.0 128.0 (the float (- (-> pp clock frame-counter) (-> obj shield-timer))) 0.0 600.0)) - ) - ) + (let ((v1-249 (the int (lerp-scale 0.0 128.0 (the float (- (current-time) (-> obj shield-timer))) 0.0 600.0)))) (cond ((< 0.0 (-> obj shield-hit-points)) (set! s5-9 (min 100 v1-249)) @@ -2964,7 +2951,7 @@ This commonly includes things such as: (dotimes (s4-11 6) (send-event (handle->process (-> obj tentacles s4-11)) 'set-fade s5-9) ) - (let* ((f0-56 (lerp-scale 0.5 0.0 (the float (- (-> pp clock frame-counter) (-> obj shield-timer))) 0.0 75.0)) + (let* ((f0-56 (lerp-scale 0.5 0.0 (the float (- (current-time) (-> obj shield-timer))) 0.0 75.0)) (a0-147 (vector-float*! (new 'stack-no-clear 'vector) (-> obj shield-color) (if (< 0.0 (-> obj shield-hit-points)) f0-56 diff --git a/test/decompiler/reference/jak2/levels/palace/boss/squid-states_REF.gc b/test/decompiler/reference/jak2/levels/palace/boss/squid-states_REF.gc index 64cd53109a..913095c575 100644 --- a/test/decompiler/reference/jak2/levels/palace/boss/squid-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/palace/boss/squid-states_REF.gc @@ -222,14 +222,14 @@ (defstate test (squid) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (ja :num! (loop!)) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (when (>= (- (current-time) (-> self state-time)) (seconds 2)) (set! (-> self driver-blend target) (- 1.0 (-> self driver-blend target))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (debug-draw (-> self first-path)) (debug-draw (-> self second-path)) @@ -512,10 +512,8 @@ :virtual #t :event squid-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self traj-timer) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.25 0.5)))) - ) + (set! (-> self state-time) (current-time)) + (set! (-> self traj-timer) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.25 0.5))))) (set! (-> self traj initial-position quad) (-> self trans quad)) (let ((v1-7 (-> self stage))) (cond @@ -567,17 +565,15 @@ (-> self trans) (the-as vector (-> self traj)) (-> self traj-dest) - (parameter-ease-sqr-clamp (* 0.0011111111 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (parameter-ease-sqr-clamp (* 0.0011111111 (the float (- (current-time) (-> self state-time))))) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (if (>= (- (current-time) (-> self state-time)) (seconds 3)) (go-virtual flee) ) (spawn (-> self part) (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 55))) - (when (>= (- (-> self clock frame-counter) (-> self traj-timer)) 0) + (when (>= (- (current-time) (-> self traj-timer)) 0) (sound-play "squid-explosion") - (set! (-> self traj-timer) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.25 0.5)))) - ) + (set! (-> self traj-timer) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.25 0.5))))) (cond ((zero? (-> self stage)) (setup-masks (-> self draw) 320 160) @@ -705,7 +701,7 @@ :event squid-handler :enter (behavior () (squid-talker 'start-recharging) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self invincible-timer) 0) (setup-masks (-> self draw) 8192 0) (logior! (-> self draw status) (draw-control-status warp-cross-fade)) @@ -739,7 +735,7 @@ (go-virtual fly-to-shoot-spot) ) ) - ((>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + ((>= (- (current-time) (-> self state-time)) (seconds 2)) (set! (-> self driver-blend target) 1.0) (ja-channel-push! 1 (seconds 0.1)) (ja :group! (-> self draw art-group data 34) :num! min) @@ -765,27 +761,21 @@ (let ((v1-70 (handle->process (-> self hud)))) (if v1-70 (set! (-> (the-as hud-squid v1-70) values 2 target) - (min 100 (/ (* 100 (- (-> self clock frame-counter) (-> self state-time))) 600)) + (min 100 (/ (* 100 (- (current-time) (-> self state-time))) 600)) ) ) ) (let ((gp-3 (new 'stack-no-clear 'vector))) - (let ((f30-0 - (* 16384.0 (fmin 1.0 (* 0.0016666667 (the float (- (-> self clock frame-counter) (-> self state-time)))))) - ) - ) - (let* ((f0-16 (* 164.25063 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (let ((f30-0 (* 16384.0 (fmin 1.0 (* 0.0016666667 (the float (- (current-time) (-> self state-time)))))))) + (let* ((f0-16 (* 164.25063 (the float (- (current-time) (-> self state-time))))) (f0-19 (lerp-scale 70.0 120.0 (fabs (cos f0-16)) 1.0 0.0)) ) (set! (-> self draw force-fade) - (the-as - uint - (the int (lerp-scale 128.0 f0-19 (the float (- (-> self clock frame-counter) (-> self state-time))) 0.0 37.5)) - ) + (the-as uint (the int (lerp-scale 128.0 f0-19 (the float (- (current-time) (-> self state-time))) 0.0 37.5))) ) ) (set! (-> self shield-timer) - (- (-> self clock frame-counter) + (- (current-time) (the-as time-frame (the int (lerp-scale 0.0 600.0 (the float (-> self draw force-fade)) 0.0 128.0))) ) ) @@ -802,7 +792,7 @@ ) (dotimes (gp-4 6) (send-event (handle->process (-> self tentacles gp-4)) 'set-fade (-> self draw force-fade)) - (when (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (when (< (- (current-time) (-> self state-time)) (seconds 2)) (case (-> self stage) ((1) (send-event (handle->process (-> self tentacles gp-4)) 'wrap *squid-second-pole*) @@ -874,16 +864,16 @@ (set! (-> self allowed-rotate-to-vector-angle) 0.0) (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data 21) :num! min) - (set! (-> self jet-volume) (the-as int (-> self clock frame-counter))) - (set! (-> self jet-pitch) (the-as int (-> self clock frame-counter))) + (set! (-> self jet-volume) (the-as int (current-time))) + (set! (-> self jet-pitch) (the-as int (current-time))) (set! (-> self negate-jet-pitch) #f) ) ((< 910.2222 (-> self desired-rotate-to-vector-angle)) (set! (-> self allowed-rotate-to-vector-angle) 0.0) (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data 24) :num! min) - (set! (-> self jet-volume) (the-as int (-> self clock frame-counter))) - (set! (-> self jet-pitch) (the-as int (-> self clock frame-counter))) + (set! (-> self jet-volume) (the-as int (current-time))) + (set! (-> self jet-pitch) (the-as int (current-time))) (set! (-> self negate-jet-pitch) #f) ) ((let ((v1-106 (ja-group))) @@ -953,22 +943,22 @@ :event squid-handler :enter (behavior () (squid-talker 'headbutting) - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self traj-timer) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self traj-timer) (current-time)) (vector-reset! (-> self residual-velocity)) (set! (-> self can-play-squid-boost) #t) (none) ) :exit (behavior () (sound-play "squid-rush-end") - (set! (-> self rush-end-time) (-> self clock frame-counter)) + (set! (-> self rush-end-time) (current-time)) (let ((v1-5 (ja-group))) (when (and v1-5 (= v1-5 (-> self draw art-group data 5))) (ja-channel-push! 1 (seconds 0.05)) (ja :group! (-> self draw art-group data 6) :num! min) (sound-play "sqd-shield-down") - (set! (-> self jet-volume) (the-as int (-> self clock frame-counter))) - (set! (-> self jet-pitch) (the-as int (-> self clock frame-counter))) + (set! (-> self jet-volume) (the-as int (current-time))) + (set! (-> self jet-pitch) (the-as int (current-time))) (set! (-> self negate-jet-pitch) #t) ) ) @@ -980,7 +970,7 @@ ) (go-virtual pre-flee) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (if (>= (- (current-time) (-> self state-time)) (seconds 3)) (go-virtual fly-to-shoot-spot) ) (let ((v1-17 (ja-group))) @@ -990,8 +980,8 @@ (when (and (-> self can-play-squid-boost) (< 30.0 (ja-aframe-num 0))) (sound-play "squid-boost") (set! (-> self can-play-squid-boost) #f) - (set! (-> self jet-volume) (the-as int (-> self clock frame-counter))) - (set! (-> self jet-pitch) (the-as int (-> self clock frame-counter))) + (set! (-> self jet-volume) (the-as int (current-time))) + (set! (-> self jet-pitch) (the-as int (current-time))) (set! (-> self negate-jet-pitch) #f) (set! (-> self rush-sound-playing) #t) (set! (-> self rush-end-time) 0) @@ -1003,7 +993,7 @@ (if (< (ja-aframe-num 0) 20.0) (squid-method-42 self (-> self traj-dest)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (else (let ((v1-53 (ja-group))) @@ -1027,7 +1017,7 @@ (s5-1 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.017)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.017)) (let ((f0-8 (vector-vector-xz-distance-squared (-> self traj-dest) (-> self trans))) (f1-1 8192.0) ) @@ -1036,7 +1026,7 @@ ) (go-virtual fly-to-shoot-spot) ) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.017)) (-> self mesh-forced)) + (when (and (>= (- (current-time) (-> self state-time)) (seconds 0.017)) (-> self mesh-forced)) (vector-reset! (-> self residual-velocity)) (go-virtual fly-to-shoot-spot) ) @@ -1046,10 +1036,7 @@ (set! (-> s3-0 quad) (-> self traj-dest quad)) (clamp-vector-to-mesh-cross-gaps (-> self nav) gp-3 (-> self current-nav-poly) s3-0 409600.0 #f s2-0) (set! (-> self residual-velocity quad) (-> self trans quad)) - (let ((f30-1 - (lerp-scale 0.01 1.0 (+ -375.0 (the float (- (-> self clock frame-counter) (-> self traj-timer)))) 0.0 150.0) - ) - ) + (let ((f30-1 (lerp-scale 0.01 1.0 (+ -375.0 (the float (- (current-time) (-> self traj-timer)))) 0.0 150.0))) (set! (-> gp-3 y) (-> self trans y)) (vector-seek-3d-smooth! (-> self trans) gp-3 (* 4096.0 f30-1) 0.5) (set! (-> gp-3 quad) (-> self trans quad)) @@ -1112,7 +1099,7 @@ :event squid-handler :enter (behavior () (squid-talker 'shooting) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self stop-shooting) #f) (set! (-> self traj-timer) 0) (set! (-> self tentacle-base-rotation-speed target) 1.0) @@ -1146,15 +1133,13 @@ ) ) (squid-method-43 self (squid-method-42 self (new 'stack-no-clear 'vector)) 9.102222 0.75) - (when (or (>= (- (-> self clock frame-counter) (-> self state-time)) (squid-whirlwind-time)) - (-> self stop-shooting) - ) + (when (or (>= (- (current-time) (-> self state-time)) (squid-whirlwind-time)) (-> self stop-shooting)) (vector-reset! (-> self residual-velocity)) (go-virtual fly-to-shoot-spot) ) - (when (>= (- (-> self clock frame-counter) (-> self traj-timer)) (seconds 0.7)) + (when (>= (- (current-time) (-> self traj-timer)) (seconds 0.7)) (spawn-whirlwind self) - (set! (-> self traj-timer) (-> self clock frame-counter)) + (set! (-> self traj-timer) (current-time)) ) (none) ) @@ -1421,7 +1406,7 @@ (else (ja-channel-push! 1 (seconds 0.15)) (ja :group! (-> self draw art-group data 7) :num! min) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ) ) @@ -1499,14 +1484,10 @@ (+ -3640.889 f30-1) ) ((-> self gun-high-to-low) - (+ f30-1 - (lerp-scale -1820.4445 910.2222 (the float (- (-> self clock frame-counter) (-> self state-time))) 0.0 900.0) - ) + (+ f30-1 (lerp-scale -1820.4445 910.2222 (the float (- (current-time) (-> self state-time))) 0.0 900.0)) ) (else - (+ f30-1 - (lerp-scale 3640.889 -910.2222 (the float (- (-> self clock frame-counter) (-> self state-time))) 0.0 900.0) - ) + (+ f30-1 (lerp-scale 3640.889 -910.2222 (the float (- (current-time) (-> self state-time))) 0.0 900.0)) ) ) ) @@ -1537,7 +1518,7 @@ ((let ((v1-77 (ja-group))) (and v1-77 (= v1-77 (-> self draw art-group data 17))) ) - (if (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (if (or (>= (- (current-time) (-> self state-time)) (seconds 3)) (or (= (-> self shield-hit-points) 0.0) (zero? (-> self hit-points)) (-> self stop-shooting)) ) (ja :num! (seek!)) @@ -1556,7 +1537,7 @@ 0 ) ) - (if (and (or (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (if (and (or (>= (- (current-time) (-> self state-time)) (seconds 3)) (or (= (-> self shield-hit-points) 0.0) (zero? (-> self hit-points)) (-> self stop-shooting)) ) (ja-done? 0) @@ -1599,7 +1580,7 @@ (else (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data 16) :num! min) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self next-gun) 1) ) ) @@ -1648,7 +1629,7 @@ (squid-adjust-fly-anim) (when (and (zero? (-> self stage)) (not (-> self reload-played)) - (< (- (-> self traj-duration) (the float (- (-> self clock frame-counter) (-> self traj-timer)))) -210.0) + (< (- (-> self traj-duration) (the float (- (current-time) (-> self traj-timer)))) -210.0) ) (sound-play "squid-reload") (set! (-> self reload-played) #t) @@ -1697,7 +1678,7 @@ :enter (behavior () (set-setting! 'music 'danger4 0.0 0) (set! (-> self driver-blend target) 1.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self hud) (ppointer->handle (process-spawn hud-squid :init hud-init-by-other :to self))) (vector+! (-> self trans) (-> self trans) (new 'static 'vector :x 101171.2 :y 45056.0 :z 31047.68)) (let ((v1-14 (squid-method-42 self (new 'stack-no-clear 'vector)))) @@ -1715,7 +1696,7 @@ ) :trans (behavior () (ja :num! (loop!)) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (when (>= (- (current-time) (-> self state-time)) (seconds 3)) ) (none) ) diff --git a/test/decompiler/reference/jak2/levels/palace/cable/palcab-obs_REF.gc b/test/decompiler/reference/jak2/levels/palace/cable/palcab-obs_REF.gc index b016a94dac..ef778575ff 100644 --- a/test/decompiler/reference/jak2/levels/palace/cable/palcab-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/palace/cable/palcab-obs_REF.gc @@ -144,7 +144,7 @@ (set! (-> a1-7 param 1) (the-as uint v1-14)) ) (when (send-event-function gp-0 a1-7) - (set! (-> self no-collision-timer) (-> self clock frame-counter)) + (set! (-> self no-collision-timer) (current-time)) (let ((v1-19 (-> self root-override root-prim))) (set! (-> v1-19 prim-core collide-as) (collide-spec)) (set! (-> v1-19 prim-core collide-with) (collide-spec)) @@ -160,12 +160,12 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (when (and (nonzero? (-> self no-collision-timer)) - (>= (- (-> self clock frame-counter) (-> self no-collision-timer)) + (>= (- (current-time) (-> self no-collision-timer)) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout)) ) ) @@ -239,14 +239,14 @@ ) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self sound-timer)) + (when (>= (- (current-time) (-> self state-time)) (-> self sound-timer)) (sound-play "cab-fan-blade") (sound-stop (-> self sound-id)) (sound-play "pal-fan-buzz" :id (-> self sound-id)) (set! (-> self sound-timer) (the-as time-frame (the int (* 300.0 (/ 21845.334 (fabs (-> self rotate-speed)))))) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (update! (-> self sound)) (rider-post) @@ -949,7 +949,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self fire-timer) (-> self clock frame-counter)) + (set! (-> self fire-timer) (current-time)) (set! (-> self gun-index) 0) 0 (none) @@ -963,7 +963,7 @@ This commonly includes things such as: (* (-> self spin-rate) (-> self clock seconds-per-frame)) ) (let ((f30-0 1.0)) - (when (>= (- (-> self clock frame-counter) (-> self fire-timer)) (seconds 0.05)) + (when (>= (- (current-time) (-> self fire-timer)) (seconds 0.05)) (let ((gp-0 (new 'stack-no-clear 'matrix))) (let ((s5-0 (-> self node-list data (+ (* (-> self gun-index) 2) 4)))) (vector<-cspace! (the-as vector (-> gp-0 vector)) s5-0) @@ -974,7 +974,7 @@ This commonly includes things such as: (pal-rot-gun-method-23 self gp-0) ) (set! (-> self gun-index) (- 1 (-> self gun-index))) - (set! (-> self fire-timer) (-> self clock frame-counter)) + (set! (-> self fire-timer) (current-time)) (set! f30-0 1.2) ) (let* ((f0-10 (the float (sar (shl (the int (quaternion-z-angle (-> self root quat))) 48) 48))) diff --git a/test/decompiler/reference/jak2/levels/palace/cable/palcab-part_REF.gc b/test/decompiler/reference/jak2/levels/palace/cable/palcab-part_REF.gc index 06095c29d7..64bfa16334 100644 --- a/test/decompiler/reference/jak2/levels/palace/cable/palcab-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/palace/cable/palcab-part_REF.gc @@ -323,9 +323,7 @@ ;; WARN: Return type mismatch int vs none. (defbehavior palcab-bird-bob-func palcab-part ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) (set! (-> arg2 vector 0 y) - (+ (-> arg1 key proc root trans y) - (* -2048.0 (sin (* 218.45334 (the float (mod (-> self clock frame-counter) 300))))) - ) + (+ (-> arg1 key proc root trans y) (* -2048.0 (sin (* 218.45334 (the float (mod (current-time) 300)))))) ) 0 (none) diff --git a/test/decompiler/reference/jak2/levels/palace/pal-obs_REF.gc b/test/decompiler/reference/jak2/levels/palace/pal-obs_REF.gc index 382c43000b..45aa06a76f 100644 --- a/test/decompiler/reference/jak2/levels/palace/pal-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/palace/pal-obs_REF.gc @@ -947,7 +947,7 @@ This commonly includes things such as: (defstate idle (palent-turret) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -957,13 +957,13 @@ This commonly includes things such as: :trans (behavior () (cond ((not (task-node-closed? (game-task-node palace-sneak-in-meeting))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (else (let* ((f0-0 65536.0) (f1-0 -0.5) (f2-0 0.16666667) - (f3-1 (* 0.0033333334 (the float (- (-> self clock frame-counter) (-> self state-time))))) + (f3-1 (* 0.0033333334 (the float (- (current-time) (-> self state-time))))) (f30-0 (* f0-0 (+ f1-0 (* f2-0 (- f3-1 (* (the float (the int (/ f3-1 6.0))) 6.0)))))) (s4-0 (-> self node-list data 5 bone transform)) (s5-0 (matrix->trans s4-0 (new 'stack-no-clear 'vector))) @@ -973,7 +973,7 @@ This commonly includes things such as: (let ((f0-2 (* 5097.2446 (sin f30-0)))) (quaternion-rotate-local-y! (-> self root-override quat) (-> self entity quat) f0-2) ) - (when (< (the-as time-frame (-> self next-shoot)) (-> self clock frame-counter)) + (when (< (the-as time-frame (-> self next-shoot)) (current-time)) (set-palent-turret-flash! 1.0) (let ((a1-2 (new 'stack-no-clear 'projectile-init-by-other-params))) (set! (-> a1-2 ent) (-> self entity)) @@ -993,7 +993,7 @@ This commonly includes things such as: (set! (-> a1-2 vel quad) (-> gp-0 quad)) (spawn-projectile palent-turret-shot a1-2 self *default-dead-pool*) ) - (set! (-> self next-shoot) (the-as uint (+ (-> self clock frame-counter) (seconds 0.1)))) + (set! (-> self next-shoot) (the-as uint (+ (current-time) (seconds 0.1)))) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/palace/roof/palboss-scenes_REF.gc b/test/decompiler/reference/jak2/levels/palace/roof/palboss-scenes_REF.gc index afbeb5517f..835b8ebe91 100644 --- a/test/decompiler/reference/jak2/levels/palace/roof/palboss-scenes_REF.gc +++ b/test/decompiler/reference/jak2/levels/palace/roof/palboss-scenes_REF.gc @@ -56,7 +56,7 @@ (let ((v1-0 #f) (gp-0 (-> self elevator-status)) ) - (when (>= (- (-> self clock frame-counter) (-> self sticky-player-last-ride-time)) 0) + (when (>= (- (current-time) (-> self sticky-player-last-ride-time)) 0) (dotimes (s5-0 10) (let* ((f30-0 0.5) (v1-3 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) @@ -69,7 +69,7 @@ ) ) (set! (-> self sticky-player-last-ride-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.25 0.75)))) + (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.25 0.75)))) ) (set! v1-0 #t) ) @@ -734,7 +734,7 @@ (let ((v1-8 #f) (gp-0 (-> self elevator-status)) ) - (when (>= (- (-> self clock frame-counter) (-> self sticky-player-last-ride-time)) 0) + (when (>= (- (current-time) (-> self sticky-player-last-ride-time)) 0) (dotimes (s5-0 10) (let* ((f30-0 0.5) (v1-11 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) @@ -747,7 +747,7 @@ ) ) (set! (-> self sticky-player-last-ride-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.25 0.75)))) + (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.25 0.75)))) ) (set! v1-8 #t) ) diff --git a/test/decompiler/reference/jak2/levels/power_station/power_switches/ctypower_REF.gc b/test/decompiler/reference/jak2/levels/power_station/power_switches/ctypower_REF.gc index 491f491d48..504be7d227 100644 --- a/test/decompiler/reference/jak2/levels/power_station/power_switches/ctypower_REF.gc +++ b/test/decompiler/reference/jak2/levels/power_station/power_switches/ctypower_REF.gc @@ -117,7 +117,7 @@ ) ) (if (= (-> self count) (-> self max-count)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (set! (-> *game-info* counter) (the float (-> self count))) ) @@ -158,8 +158,8 @@ () (set! (-> self hud-counter) (ppointer->handle (process-spawn hud-turret :init hud-init-by-other :to self))) (send-event *traffic-manager* 'set-target-level #x3f800000) - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 5)) (suspend) ) (send-event *traffic-manager* 'set-alert-level 1) @@ -193,8 +193,8 @@ TASK_MANAGER_COMPLETE_HOOK (lambda :behavior task-manager () - (set! (-> self state-time) (-> self clock frame-counter)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (while (< (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) (task-node-close! (game-task-node city-power-post-win)) diff --git a/test/decompiler/reference/jak2/levels/power_station/vinroom-obs_REF.gc b/test/decompiler/reference/jak2/levels/power_station/vinroom-obs_REF.gc index a8d645e592..7636b26e71 100644 --- a/test/decompiler/reference/jak2/levels/power_station/vinroom-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/power_station/vinroom-obs_REF.gc @@ -145,7 +145,7 @@ (when (and (or (not (-> self dont-draw-outside?)) (>= (vector4-dot (the-as vector (-> self lightning-plane)) (math-camera-pos)) 0.0) ) - (< (the-as time-frame (-> self lightning-timer)) (-> self clock frame-counter)) + (< (the-as time-frame (-> self lightning-timer)) (current-time)) ) (let ((s4-0 (new 'stack-no-clear 'matrix)) (s3-1 @@ -183,7 +183,7 @@ ) (when (>= (fill-and-probe-using-line-sphere *collide-cache* s5-1) 0.0) (set! (-> self lightning-timer) - (the-as uint (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.1 0.4))))) + (the-as uint (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.1 0.4))))) ) (let ((s4-3 (new 'stack-no-clear 'vector))) (set! (-> s4-3 quad) (-> s5-1 best-other-tri intersect quad)) diff --git a/test/decompiler/reference/jak2/levels/ruins/mechtest-obs_REF.gc b/test/decompiler/reference/jak2/levels/ruins/mechtest-obs_REF.gc index c082deebfc..ed9015e0e5 100644 --- a/test/decompiler/reference/jak2/levels/ruins/mechtest-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/ruins/mechtest-obs_REF.gc @@ -322,7 +322,7 @@ ) :enter (behavior () (logclear! (-> self mask) (process-mask actor-pause)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (if (handle->process (-> self carry other)) (drop-impl! (the-as carry-info (send-event (handle->process (-> self carry other)) 'carry-info)) @@ -337,14 +337,14 @@ (when (or (and (logtest? (-> self root-override status) (collide-status on-surface)) (< 0.8 (-> self root-override surface-angle)) ) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (>= (- (current-time) (-> self state-time)) (seconds 5)) ) (vector-reset! (-> self root-override transv)) (set! (-> self root-override root-prim local-sphere w) (-> self carry backup-radius)) (cond ((and (-> self reset-on-land?) (and (or (< 12288.0 (vector-vector-distance (-> self drop-point) (-> self root-override trans))) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (>= (- (current-time) (-> self state-time)) (seconds 5)) ) (and (-> self next-entity) (not (logtest? (-> self next-entity extra perm status) (entity-perm-status subtask-complete))) @@ -385,7 +385,7 @@ (go-virtual wait) ) ((or (< 12288.0 (vector-vector-distance (-> self drop-point) (-> self root-override trans))) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (>= (- (current-time) (-> self state-time)) (seconds 5)) ) (sound-play "block-break") (let ((gp-3 (get-process *default-dead-pool* part-tracker #x4000))) diff --git a/test/decompiler/reference/jak2/levels/ruins/rapid-gunner_REF.gc b/test/decompiler/reference/jak2/levels/ruins/rapid-gunner_REF.gc index b833fac856..ac1f54100d 100644 --- a/test/decompiler/reference/jak2/levels/ruins/rapid-gunner_REF.gc +++ b/test/decompiler/reference/jak2/levels/ruins/rapid-gunner_REF.gc @@ -591,7 +591,7 @@ (vector+! (-> self target-next-pos) (-> self focus-dir) gp-0) (set! (-> self target-prev-pos quad) (-> gp-0 quad)) ) - (set! (-> self predict-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self predict-timer) (the-as uint (current-time))) ) (else (set! (-> self target-next-pos quad) (-> self target-prev-pos quad)) @@ -742,9 +742,9 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior rapid-gunner) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self predict-timer) (the-as uint (+ (-> self clock frame-counter) 1))) - (set! (-> self shot-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self state-time) (current-time)) + (set! (-> self predict-timer) (the-as uint (+ (current-time) 1))) + (set! (-> self shot-timer) (the-as uint (current-time))) (let ((v1-7 self)) (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-7 nav callback-info) *nav-enemy-null-callback-info*) @@ -763,7 +763,7 @@ (set! (-> self attack-id) a0-6) ) (when (logtest? (-> self status-flags) 2) - (set! (-> self spin-up-timer) (+ (-> self clock frame-counter) (seconds 2))) + (set! (-> self spin-up-timer) (+ (current-time) (seconds 2))) (set! (-> self status-flags) (logand -3 (-> self status-flags))) ) (if (zero? (rand-vu-int-range 0 3)) @@ -814,10 +814,10 @@ ) (go-virtual reload) ) - ((>= (- (-> self clock frame-counter) (the-as int (-> self shot-timer))) (seconds 0.25)) + ((>= (- (current-time) (the-as int (-> self shot-timer))) (seconds 0.25)) (when (rapid-gunner-method-184 self 2184.5334) (let* ((a1-11 (-> self node-list data 18)) - (f30-0 (fmax 0.0 (the float (- (-> self spin-up-timer) (-> self clock frame-counter))))) + (f30-0 (fmax 0.0 (the float (- (-> self spin-up-timer) (current-time))))) (s5-1 (vector<-cspace! (new 'stack-no-clear 'vector) a1-11)) (s4-2 (vector+! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable gp-0) 0) (-> self focus-dir)) @@ -836,7 +836,7 @@ ) (+! (-> self shots-fired) 1) ) - (set! (-> self shot-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self shot-timer) (the-as uint (current-time))) ) ) ) @@ -929,7 +929,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior rapid-gunner) enemy-event-handler) :enter (behavior () - (set! (-> self predict-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self predict-timer) (the-as uint (current-time))) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -1061,7 +1061,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior rapid-gunner) enemy-event-handler) :enter (behavior () - (set! (-> self predict-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self predict-timer) (the-as uint (current-time))) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -1140,13 +1140,13 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior rapid-gunner) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self shots-fired) (the-as uint 0)) 0 (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (go-hostile self) ) (none) @@ -1178,7 +1178,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior rapid-gunner) enemy-event-handler) :enter (behavior () - (set! (-> self predict-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self predict-timer) (the-as uint (current-time))) (set! (-> self shots-fired) (the-as uint 0)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) @@ -1224,7 +1224,7 @@ (t9-0) ) ) - (set! (-> self predict-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self predict-timer) (the-as uint (current-time))) (cond ((handle->process (-> self focus handle)) (if (check-los? (-> self los) 0) @@ -1277,7 +1277,7 @@ ) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (>= 1 (the-as int (-> self focus aware))) (go-virtual active) ) @@ -1341,7 +1341,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior rapid-gunner) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) diff --git a/test/decompiler/reference/jak2/levels/ruins/ruins-obs_REF.gc b/test/decompiler/reference/jak2/levels/ruins/ruins-obs_REF.gc index c0774b7e1b..73ae442912 100644 --- a/test/decompiler/reference/jak2/levels/ruins/ruins-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/ruins/ruins-obs_REF.gc @@ -470,7 +470,7 @@ This commonly includes things such as: and translate the platform via the `smush` @see [[smush-control]]" (activate! (-> obj smush) -1.0 60 150 1.0 1.0 (-> self clock)) - (set! (-> obj bounce-time) (-> self clock frame-counter)) + (set! (-> obj bounce-time) (current-time)) (set! (-> obj bouncing) #t) (logclear! (-> obj mask) (process-mask sleep)) (logclear! (-> obj mask) (process-mask sleep-code)) @@ -502,7 +502,7 @@ and translate the platform via the `smush` ) :post (behavior () (when (and (nonzero? (-> self root-override root-prim prim-core collide-as)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.25)) + (>= (- (current-time) (-> self state-time)) (seconds 0.25)) ) (let ((v1-9 (-> self root-override root-prim))) (set! (-> v1-9 prim-core collide-as) (collide-spec)) @@ -726,9 +726,9 @@ This commonly includes things such as: (lambda :behavior task-manager () (set! (-> self data-int32 0) 0) - (set! (-> self beep-time) (+ (-> self clock frame-counter) (seconds -30))) + (set! (-> self beep-time) (+ (current-time) (seconds -30))) (until #f - (when (>= (- (-> self clock frame-counter) (-> self beep-time)) (seconds 40)) + (when (>= (- (current-time) (-> self beep-time)) (seconds 40)) (let ((v1-8 (mod (-> self data-int32 0) (if (= (-> self node-info task) (game-task ruins-tower)) 4 2 @@ -751,7 +751,7 @@ This commonly includes things such as: ) ) ) - (set! (-> self beep-time) (-> self clock frame-counter)) + (set! (-> self beep-time) (current-time)) (+! (-> self data-int32 0) 1) ) (b! @@ -806,12 +806,12 @@ This commonly includes things such as: ) (b! #t cfg-17 :delay (nop!)) (label cfg-8) - (when (and (>= (- (-> self clock frame-counter) (-> self time-limit)) (seconds 10)) + (when (and (>= (- (current-time) (-> self time-limit)) (seconds 10)) gp-0 (< (vector-vector-xz-distance (target-pos 0) (-> gp-0 extra trans)) 40960.0) ) (talker-spawn-func (-> *talker-speech* 452) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) ) (suspend) (label cfg-17) @@ -830,22 +830,22 @@ This commonly includes things such as: (until (not (or (not *target*) (not (logtest? (focus-status mech) (-> *target* focus-status))))) (b! #t cfg-47 :delay (nop!)) (label cfg-38) - (when (and (>= (- (-> self clock frame-counter) (-> self time-limit)) (seconds 10)) + (when (and (>= (- (current-time) (-> self time-limit)) (seconds 10)) gp-0 (< (vector-vector-xz-distance (target-pos 0) (-> gp-0 extra trans)) 40960.0) ) (talker-spawn-func (-> *talker-speech* 452) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) ) (suspend) (label cfg-47) (b! (or (not *target*) (not (logtest? (focus-status mech) (-> *target* focus-status)))) cfg-38 :delay (nop!)) (talker-spawn-func (-> *talker-speech* 457) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) (b! #t cfg-66 :delay (nop!)) (label cfg-52) ) - (when (>= (- (-> self clock frame-counter) (-> self time-limit)) (seconds 10)) + (when (>= (- (current-time) (-> self time-limit)) (seconds 10)) (b! (not (and gp-0 (< (vector-vector-xz-distance (target-pos 0) (-> gp-0 extra trans)) 61440.0))) cfg-63 @@ -856,7 +856,7 @@ This commonly includes things such as: (label cfg-63) (talker-spawn-func (-> *talker-speech* 454) *entity-pool* (target-pos 0) (the-as region #f)) (label cfg-64) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) ) (suspend) (label cfg-66) @@ -885,7 +885,7 @@ This commonly includes things such as: (label cfg-1) (b! #t cfg-14 :delay (nop!)) (label cfg-2) - (let ((a0-2 (>= (- (-> self clock frame-counter) (-> self time-limit)) (seconds 10)))) + (let ((a0-2 (>= (- (current-time) (-> self time-limit)) (seconds 10)))) (b! (not a0-2) cfg-11 :likely-delay (set! v1-3 a0-2)) ) (b! (not gp-0) cfg-11 :likely-delay (set! v1-3 gp-0)) @@ -902,7 +902,7 @@ This commonly includes things such as: (label cfg-11) (when v1-3 (talker-spawn-func (-> *talker-speech* 452) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) ) (suspend) (label cfg-14) @@ -915,7 +915,7 @@ This commonly includes things such as: (set! v1-18 (not (logtest? (focus-status mech) (-> *target* focus-status)))) (label cfg-22) (b! v1-18 cfg-1 :delay (nop!)) - (when (>= (- (-> self clock frame-counter) (-> self time-limit)) (seconds 10)) + (when (>= (- (current-time) (-> self time-limit)) (seconds 10)) (b! (not gp-0) cfg-38 :likely-delay (set! v1-25 gp-0)) (let ((v1-27 (-> gp-0 extra process))) (b! (not v1-27) cfg-28 :delay (nop!)) @@ -940,7 +940,7 @@ This commonly includes things such as: (label cfg-38) (when v1-25 (talker-spawn-func (-> *talker-speech* 458) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) ) ) (suspend) @@ -975,7 +975,7 @@ This commonly includes things such as: (b! #t cfg-20 :delay (nop!)) (label cfg-8) (set! v1-6 - (and (>= (- (-> self clock frame-counter) (-> self time-limit)) (seconds 10)) + (and (>= (- (current-time) (-> self time-limit)) (seconds 10)) (and gp-0 (begin (let ((v1-8 (-> gp-0 extra process))) (b! (not v1-8) cfg-14 :delay (nop!)) @@ -995,7 +995,7 @@ This commonly includes things such as: (label cfg-17) (b! (not v1-6) cfg-19 :delay (empty-form)) (talker-spawn-func (-> *talker-speech* 452) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) (label cfg-19) (suspend) (label cfg-20) @@ -1003,7 +1003,7 @@ This commonly includes things such as: (b! #t cfg-53 :delay (nop!)) (label cfg-25) ) - (when (>= (- (-> self clock frame-counter) (-> self time-limit)) (seconds 10)) + (when (>= (- (current-time) (-> self time-limit)) (seconds 10)) (b! (not (and *target* (focus-test? *target* carry))) cfg-43 :delay (empty-form)) (when (< (vector-vector-xz-distance (target-pos 0) @@ -1031,7 +1031,7 @@ This commonly includes things such as: ) ) (talker-spawn-func (-> *talker-speech* 459) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) ) (b! #t cfg-52 :delay (nop!)) (label cfg-43) @@ -1047,7 +1047,7 @@ This commonly includes things such as: ) ) (talker-spawn-func (-> *talker-speech* 458) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self time-limit) (-> self clock frame-counter)) + (set! (-> self time-limit) (current-time)) ) ) (label cfg-52) diff --git a/test/decompiler/reference/jak2/levels/ruins/ruins-part_REF.gc b/test/decompiler/reference/jak2/levels/ruins/ruins-part_REF.gc index a9e6d595d5..2f726f6075 100644 --- a/test/decompiler/reference/jak2/levels/ruins/ruins-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/ruins/ruins-part_REF.gc @@ -742,15 +742,11 @@ (defun ruins-bird-bob-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) "Move the bird particles up and down, on a sinusoidal period with a wavelength of 300 frames TODO - check argument types / what birds?" - (with-pp - (set! (-> arg2 vector 0 y) - (+ (-> arg1 key proc root trans y) - (* -2048.0 (sin (* 218.45334 (the float (mod (-> pp clock frame-counter) 300))))) - ) - ) - 0 - (none) - ) + (set! (-> arg2 vector 0 y) + (+ (-> arg1 key proc root trans y) (* -2048.0 (sin (* 218.45334 (the float (mod (current-time) 300)))))) + ) + 0 + (none) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak2/levels/sewer/escort/jinx-bomb_REF.gc b/test/decompiler/reference/jak2/levels/sewer/escort/jinx-bomb_REF.gc index c1a87a7d86..5417d33380 100644 --- a/test/decompiler/reference/jak2/levels/sewer/escort/jinx-bomb_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/escort/jinx-bomb_REF.gc @@ -55,12 +55,12 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (if (and (nonzero? (-> self fuse-delay)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self fuse-delay))) + (>= (- (current-time) (-> self state-time)) (the-as time-frame (-> self fuse-delay))) ) (go-virtual explode) ) @@ -81,7 +81,7 @@ (defstate explode (jinx-bomb) :virtual #t :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self draw status) (draw-control-status no-draw)) (let ((v1-6 (-> self root-override root-prim))) (set! (-> v1-6 prim-core collide-as) (collide-spec)) @@ -170,7 +170,3 @@ (go-virtual idle) (none) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/sewer/escort/jinx-states_REF.gc b/test/decompiler/reference/jak2/levels/sewer/escort/jinx-states_REF.gc index d6bd2a687f..999a71c675 100644 --- a/test/decompiler/reference/jak2/levels/sewer/escort/jinx-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/escort/jinx-states_REF.gc @@ -526,7 +526,7 @@ (seconds 0.05) ) (bot-method-223 self #t) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (or (not (bot-method-214 self)) (not (ruffian-method-237 self))) ) (react-to-focus self) @@ -623,7 +623,7 @@ (suspend) (ja :num! (seek!)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f (ja-no-eval :group! (-> self draw art-group data 3) :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1))) @@ -631,7 +631,7 @@ ) (until (ja-done? 0) (if (and (logtest? (-> self bot-flags) (bot-flags failed)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (reset? *fail-mission-control*) ) (reset! *fail-mission-control*) @@ -712,7 +712,3 @@ (none) ) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/sewer/gator_REF.gc b/test/decompiler/reference/jak2/levels/sewer/gator_REF.gc index a1b4c0bade..751984477d 100644 --- a/test/decompiler/reference/jak2/levels/sewer/gator_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/gator_REF.gc @@ -203,95 +203,93 @@ "Core movement for the [[gator]], circles the target, charges at the target, etc @params TODO - not sure, they all dont seem to do very much and this method is a mess" (local-vars (v1-17 object) (a0-5 object)) - (with-pp - (let ((f30-0 (vector-dot (-> obj new-facing) (-> obj old-facing))) - (s5-0 75) - (s4-0 (the-as art-joint-anim (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) - ) - ) - (b! (not arg2) cfg-26 :delay (nop!)) - (set! s5-0 18) - (b! (>= f30-0 (cos (* 182.04445 arg0))) cfg-8 :delay #f) - (if (< (-> (vector-cross! (new 'stack-no-clear 'vector) (-> obj new-facing) (-> obj old-facing)) y) 0.0) - (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 40))) - (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 39))) - ) - (b! #t cfg-25 :delay (nop!)) - (label cfg-8) - (let ((v1-16 (< (cos (* 182.04445 arg1)) f30-0))) - (b! v1-16 cfg-23 :likely-delay (set! v1-17 v1-16)) - ) - (let ((v1-20 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) - ) - (b! (not v1-20) cfg-21 :likely-delay (set! a0-5 v1-20)) - (let ((a1-3 (= v1-20 (-> obj draw art-group data 14)))) - (b! a1-3 cfg-21 :likely-delay (set! a0-5 a1-3)) - ) - (let ((a1-4 (= v1-20 (-> obj draw art-group data 40)))) - (b! a1-4 cfg-21 :likely-delay (set! a0-5 a1-4)) - ) - (set! a0-5 (= v1-20 (-> obj draw art-group data 39))) - ) - (label cfg-21) - (b! (not a0-5) cfg-23 :delay (set! v1-17 #t)) - (set! v1-17 #f) - (label cfg-23) - (if v1-17 - (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 14))) - ) - (label cfg-25) - (b! #t cfg-48 :delay (nop!)) - (label cfg-26) - (b! (>= f30-0 (cos (* 182.04445 arg0))) cfg-31 :delay #f) - (if (< (-> (vector-cross! (new 'stack-no-clear 'vector) (-> obj new-facing) (-> obj old-facing)) y) 0.0) - (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 38))) - (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 37))) - ) - (b! #t cfg-48 :delay (nop!)) - (label cfg-31) - (if (or (< (cos (* 182.04445 arg1)) f30-0) (let ((v1-41 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) - ) - (not (and v1-41 (or (= v1-41 (-> obj draw art-group data 13)) - (= v1-41 (-> obj draw art-group data 38)) - (= v1-41 (-> obj draw art-group data 37)) - ) - ) - ) - ) + (let ((f30-0 (vector-dot (-> obj new-facing) (-> obj old-facing))) + (s5-0 75) + (s4-0 (the-as art-joint-anim (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) ) - (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 13))) + ) + (b! (not arg2) cfg-26 :delay (nop!)) + (set! s5-0 18) + (b! (>= f30-0 (cos (* 182.04445 arg0))) cfg-8 :delay #f) + (if (< (-> (vector-cross! (new 'stack-no-clear 'vector) (-> obj new-facing) (-> obj old-facing)) y) 0.0) + (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 40))) + (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 39))) + ) + (b! #t cfg-25 :delay (nop!)) + (label cfg-8) + (let ((v1-16 (< (cos (* 182.04445 arg1)) f30-0))) + (b! v1-16 cfg-23 :likely-delay (set! v1-17 v1-16)) + ) + (let ((v1-20 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) ) - (label cfg-48) - (let ((v1-50 (if (> (-> obj skel active-channels) 0) - (-> obj skel root-channel 0 frame-group) - ) - ) + (b! (not v1-20) cfg-21 :likely-delay (set! a0-5 v1-20)) + (let ((a1-3 (= v1-20 (-> obj draw art-group data 14)))) + (b! a1-3 cfg-21 :likely-delay (set! a0-5 a1-3)) + ) + (let ((a1-4 (= v1-20 (-> obj draw art-group data 40)))) + (b! a1-4 cfg-21 :likely-delay (set! a0-5 a1-4)) + ) + (set! a0-5 (= v1-20 (-> obj draw art-group data 39))) + ) + (label cfg-21) + (b! (not a0-5) cfg-23 :delay (set! v1-17 #t)) + (set! v1-17 #f) + (label cfg-23) + (if v1-17 + (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 14))) + ) + (label cfg-25) + (b! #t cfg-48 :delay (nop!)) + (label cfg-26) + (b! (>= f30-0 (cos (* 182.04445 arg0))) cfg-31 :delay #f) + (if (< (-> (vector-cross! (new 'stack-no-clear 'vector) (-> obj new-facing) (-> obj old-facing)) y) 0.0) + (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 38))) + (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 37))) + ) + (b! #t cfg-48 :delay (nop!)) + (label cfg-31) + (if (or (< (cos (* 182.04445 arg1)) f30-0) (let ((v1-41 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (not (and v1-41 (or (= v1-41 (-> obj draw art-group data 13)) + (= v1-41 (-> obj draw art-group data 38)) + (= v1-41 (-> obj draw art-group data 37)) + ) + ) + ) + ) ) - (when (and (not (and v1-50 (= v1-50 (the-as art-element s4-0)))) - (>= (- (-> pp clock frame-counter) (the-as time-frame s5-0)) (-> obj turn-time)) - ) - (let ((f30-2 (/ (ja-frame-num 0) (the float (ja-num-frames 0))))) - (ja-channel-push! 1 (the-as time-frame s5-0)) - (set! (-> obj skel root-channel 0 frame-group) s4-0) - (let ((s5-1 (-> obj skel root-channel 0))) - (set! (-> s5-1 num-func) num-func-identity) - (set! (-> s5-1 frame-num) (* f30-2 (the float (ja-num-frames 0)))) - ) - ) - (let ((v0-4 (-> pp clock frame-counter))) - (set! (-> obj turn-time) v0-4) - v0-4 + (set! s4-0 (the-as art-joint-anim (-> obj draw art-group data 13))) + ) + (label cfg-48) + (let ((v1-50 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (when (and (not (and v1-50 (= v1-50 (the-as art-element s4-0)))) + (>= (- (current-time) (the-as time-frame s5-0)) (-> obj turn-time)) + ) + (let ((f30-2 (/ (ja-frame-num 0) (the float (ja-num-frames 0))))) + (ja-channel-push! 1 (the-as time-frame s5-0)) + (set! (-> obj skel root-channel 0 frame-group) s4-0) + (let ((s5-1 (-> obj skel root-channel 0))) + (set! (-> s5-1 num-func) num-func-identity) + (set! (-> s5-1 frame-num) (* f30-2 (the float (ja-num-frames 0)))) ) ) + (let ((v0-4 (current-time))) + (set! (-> obj turn-time) v0-4) + v0-4 + ) ) ) ) @@ -537,7 +535,7 @@ (defstate stare (gator) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -546,7 +544,7 @@ (func) ) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.017)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.017)) (go-virtual pacing) ) (none) diff --git a/test/decompiler/reference/jak2/levels/sewer/grim2-course_REF.gc b/test/decompiler/reference/jak2/levels/sewer/grim2-course_REF.gc index 07d458a6bb..4403c9fd9c 100644 --- a/test/decompiler/reference/jak2/levels/sewer/grim2-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/grim2-course_REF.gc @@ -429,36 +429,31 @@ :nav-mesh-index 2 :skip-to -1 :on-set (lambda ((arg0 grim-sewer)) - (with-pp - (set! (-> arg0 waypoint-time0) (-> pp clock frame-counter)) - (set! (-> arg0 bot-flags) (logior (bot-flags bf19) (-> arg0 bot-flags))) - (clear-poi-and-focus! arg0) - (logclear! (-> arg0 focus-status) (focus-status disable)) - (set! (-> arg0 notice-enemy-dist) 204800.0) - (set! (-> arg0 min-speed) 40960.0) - (set! (-> arg0 max-speed) 40960.0) - (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) ruft-wait-spot arg0))) - (set! (-> v1-12 bytes 5) 1) - (set! (-> v1-12 bytes 6) 11) - (set! (-> v1-12 bytes 4) -1) - (set! (-> (the-as ruft-wait-spot v1-12) check-done) - (the-as - (function ruft-wait-spot ruffian symbol) - (lambda ((arg0 object) (arg1 grim-sewer)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 16 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t + (set! (-> arg0 waypoint-time0) (current-time)) + (set! (-> arg0 bot-flags) (logior (bot-flags bf19) (-> arg0 bot-flags))) + (clear-poi-and-focus! arg0) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 notice-enemy-dist) 204800.0) + (set! (-> arg0 min-speed) 40960.0) + (set! (-> arg0 max-speed) 40960.0) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) ruft-wait-spot arg0))) + (set! (-> v1-12 bytes 5) 1) + (set! (-> v1-12 bytes 6) 11) + (set! (-> v1-12 bytes 4) -1) + (set! (-> (the-as ruft-wait-spot v1-12) check-done) + (the-as + (function ruft-wait-spot ruffian symbol) + (lambda ((arg0 object) (arg1 grim-sewer)) (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 16 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) ) - ) - ) - ) ) - ) - (none) + ) ) + (none) ) :on-update #f :on-skipping-here #f @@ -1761,7 +1756,3 @@ ;; failed to figure out what this is: (set! (-> *bot-course-table* course 4) *grim2-course*) - - - - diff --git a/test/decompiler/reference/jak2/levels/sewer/hal2-course_REF.gc b/test/decompiler/reference/jak2/levels/sewer/hal2-course_REF.gc index 90a0d3a7b4..b6ad64936e 100644 --- a/test/decompiler/reference/jak2/levels/sewer/hal2-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/hal2-course_REF.gc @@ -546,35 +546,33 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (with-pp - (let* ((v1-3 (-> arg1 actor-group 0 data 5 actor)) - (a0-1 (if v1-3 - (-> v1-3 extra process) - ) - ) - ) - (if (or (not a0-1) - (or (not (logtest? (-> a0-1 entity extra perm status) (entity-perm-status subtask-complete))) - (< -176128.0 (-> (target-pos 0) y)) - ) - ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - ) - (cond - ((logtest? (bot-flags bf19 bf20 bf21) (-> arg1 bot-flags)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 4 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - ((>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.5)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 3 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - ) + (let* ((v1-3 (-> arg1 actor-group 0 data 5 actor)) + (a0-1 (if v1-3 + (-> v1-3 extra process) + ) + ) + ) + (if (or (not a0-1) + (or (not (logtest? (-> a0-1 entity extra perm status) (entity-perm-status subtask-complete))) + (< -176128.0 (-> (target-pos 0) y)) + ) + ) + (set! (-> arg1 waypoint-time0) (current-time)) + ) + ) + (cond + ((logtest? (bot-flags bf19 bf20 bf21) (-> arg1 bot-flags)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 4 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.5)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 3 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) ) ) ) @@ -601,60 +599,58 @@ (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) (local-vars (a0-8 process) (a0-13 process)) - (with-pp - (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (s3-0 (if v1-3 - (-> v1-3 extra process) - ) - ) - (v1-8 (-> arg1 actor-group 0 data 3 actor)) - (s4-0 (if v1-8 - (-> v1-8 extra process) - ) - ) - (v1-13 (-> arg1 actor-group 0 data 2 actor)) - (s5-0 (if v1-13 - (-> v1-13 extra process) - ) - ) - ) - (if (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.1)) - (let ((a0-3 s3-0)) - (and a0-3 (< (the-as int (send-event a0-3 'query 'waypoint)) 3)) - ) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (s3-0 (if v1-3 + (-> v1-3 extra process) + ) ) - (send-event s3-0 'request 'waypoint 3) - ) - (if (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.75)) - (begin (set! a0-8 s4-0) a0-8) - (< (the-as int (send-event a0-8 'query 'waypoint)) 3) + (v1-8 (-> arg1 actor-group 0 data 3 actor)) + (s4-0 (if v1-8 + (-> v1-8 extra process) + ) ) - (send-event s4-0 'request 'waypoint 3) - ) - (if (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.9)) - (begin (set! a0-13 s5-0) a0-13) - (< (the-as int (send-event a0-13 'query 'waypoint)) 3) + (v1-13 (-> arg1 actor-group 0 data 2 actor)) + (s5-0 (if v1-13 + (-> v1-13 extra process) + ) ) - (send-event s5-0 'request 'waypoint 3) - ) - (cond - ((logtest? (bot-flags bf19 bf20 bf21) (-> arg1 bot-flags)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 4 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - ((and (>= (- (-> (target-pos 0) x) (-> arg1 root-override2 trans x)) -65536.0) - (or (not s3-0) (>= (the-as int (send-event s3-0 'query 'waypoint)) 3)) - (or (not s4-0) (>= (the-as int (send-event s4-0 'query 'waypoint)) 3)) - (or (not s5-0) (>= (the-as int (send-event s5-0 'query 'waypoint)) 3)) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 4 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t ) + (if (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.1)) + (let ((a0-3 s3-0)) + (and a0-3 (< (the-as int (send-event a0-3 'query 'waypoint)) 3)) + ) + ) + (send-event s3-0 'request 'waypoint 3) ) + (if (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.75)) + (begin (set! a0-8 s4-0) a0-8) + (< (the-as int (send-event a0-8 'query 'waypoint)) 3) + ) + (send-event s4-0 'request 'waypoint 3) + ) + (if (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.9)) + (begin (set! a0-13 s5-0) a0-13) + (< (the-as int (send-event a0-13 'query 'waypoint)) 3) + ) + (send-event s5-0 'request 'waypoint 3) + ) + (cond + ((logtest? (bot-flags bf19 bf20 bf21) (-> arg1 bot-flags)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 4 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((and (>= (- (-> (target-pos 0) x) (-> arg1 root-override2 trans x)) -65536.0) + (or (not s3-0) (>= (the-as int (send-event s3-0 'query 'waypoint)) 3)) + (or (not s4-0) (>= (the-as int (send-event s4-0 'query 'waypoint)) 3)) + (or (not s5-0) (>= (the-as int (send-event s5-0 'query 'waypoint)) 3)) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 4 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) ) ) ) @@ -718,73 +714,71 @@ (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) (local-vars (a0-8 process)) - (with-pp - (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (s3-0 (if v1-3 - (-> v1-3 extra process) - ) - ) - (v1-8 (-> arg1 actor-group 0 data 3 actor)) - (s4-0 (if v1-8 - (-> v1-8 extra process) - ) - ) - (v1-13 (-> arg1 actor-group 0 data 2 actor)) - (s5-0 (if v1-13 - (-> v1-13 extra process) - ) - ) - ) - (let ((a0-1 s3-0)) - (if (and (and a0-1 (= (send-event a0-1 'query 'waypoint) 3)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.5)) - ) - (send-event s3-0 'request 'waypoint 9) - ) - ) - (when (and (not (channel-active? arg1 (the-as uint 0))) - (not (speech-playing? arg1 6)) - (begin (set! a0-8 s3-0) a0-8) - (>= (the-as int (send-event a0-8 'query 'waypoint)) 9) - ) - (play-speech arg1 6) - (play-speech arg1 7) - ) - (let ((a0-11 s5-0)) - (if (and (and a0-11 (= (send-event a0-11 'query 'waypoint) 3)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.6)) - ) - (send-event s5-0 'request 'waypoint 9) - ) - ) - (let ((a0-16 s4-0)) - (if (and (and a0-16 (= (send-event a0-16 'query 'waypoint) 3)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.8)) - ) - (send-event s4-0 'request 'waypoint 9) - ) - ) - (when (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4)) - (not (speech-playing? arg1 2)) - (not (channel-active? arg1 (the-as uint 0))) - ) - (play-speech arg1 2) - (play-speech arg1 3) - (play-speech arg1 4) - (play-speech arg1 5) - ) - (when (and (or (not s3-0) (>= (the-as int (send-event s3-0 'query 'waypoint)) 9)) - (or (not s4-0) (>= (the-as int (send-event s4-0 'query 'waypoint)) 9)) - (or (not s5-0) (>= (the-as int (send-event s5-0 'query 'waypoint)) 9)) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 9 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (s3-0 (if v1-3 + (-> v1-3 extra process) + ) + ) + (v1-8 (-> arg1 actor-group 0 data 3 actor)) + (s4-0 (if v1-8 + (-> v1-8 extra process) + ) + ) + (v1-13 (-> arg1 actor-group 0 data 2 actor)) + (s5-0 (if v1-13 + (-> v1-13 extra process) + ) + ) + ) + (let ((a0-1 s3-0)) + (if (and (and a0-1 (= (send-event a0-1 'query 'waypoint) 3)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.5)) + ) + (send-event s3-0 'request 'waypoint 9) + ) + ) + (when (and (not (channel-active? arg1 (the-as uint 0))) + (not (speech-playing? arg1 6)) + (begin (set! a0-8 s3-0) a0-8) + (>= (the-as int (send-event a0-8 'query 'waypoint)) 9) + ) + (play-speech arg1 6) + (play-speech arg1 7) + ) + (let ((a0-11 s5-0)) + (if (and (and a0-11 (= (send-event a0-11 'query 'waypoint) 3)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.6)) + ) + (send-event s5-0 'request 'waypoint 9) + ) + ) + (let ((a0-16 s4-0)) + (if (and (and a0-16 (= (send-event a0-16 'query 'waypoint) 3)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.8)) + ) + (send-event s4-0 'request 'waypoint 9) + ) + ) + (when (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4)) + (not (speech-playing? arg1 2)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 2) + (play-speech arg1 3) + (play-speech arg1 4) + (play-speech arg1 5) + ) + (when (and (or (not s3-0) (>= (the-as int (send-event s3-0 'query 'waypoint)) 9)) + (or (not s4-0) (>= (the-as int (send-event s4-0 'query 'waypoint)) 9)) + (or (not s5-0) (>= (the-as int (send-event s5-0 'query 'waypoint)) 9)) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 9 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) - #f ) + #f ) ) ) @@ -859,27 +853,27 @@ ) 1.0 ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + (set! (-> arg1 waypoint-time0) (current-time)) ) ) ) (let ((a0-3 s3-0)) (if (and (and a0-3 (= (send-event a0-3 'query 'waypoint) 9)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.1)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.1)) ) (send-event s3-0 'request 'waypoint 11) ) ) (let ((a0-8 s4-0)) (if (and (and a0-8 (= (send-event a0-8 'query 'waypoint) 9)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.9)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.9)) ) (send-event s4-0 'request 'waypoint 11) ) ) (let ((a0-13 s5-0)) (if (and (and a0-13 (= (send-event a0-13 'query 'waypoint) 9)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.7)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.7)) ) (send-event s5-0 'request 'waypoint 11) ) @@ -1667,18 +1661,16 @@ (set! (-> (the-as halt-wait-spot v1-34) check-done) (the-as (function halt-wait-spot hal symbol) - (lambda ((arg0 object) (arg1 hal-sewer)) (with-pp - (cond - ((logtest? (-> arg1 bot-task-bits) 1) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 24 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - (else - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - #f - ) + (lambda ((arg0 object) (arg1 hal-sewer)) (cond + ((logtest? (-> arg1 bot-task-bits) 1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 24 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + (else + (set! (-> arg1 waypoint-time0) (current-time)) + #f ) ) ) @@ -1749,7 +1741,7 @@ (-> v1-13 extra process) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.4)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.4)) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-1 from) (process->ppointer pp)) (set! (-> a1-1 num-params) 2) @@ -1768,7 +1760,7 @@ ) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.75)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.75)) (let ((a1-2 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-2 from) (process->ppointer pp)) (set! (-> a1-2 num-params) 2) @@ -1788,7 +1780,7 @@ ) ) (if (and (not (speech-playing? arg1 28)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) (not (channel-active? arg1 (the-as uint 0))) ) (play-speech arg1 28) @@ -1884,7 +1876,7 @@ (lambda ((arg0 object) (arg1 hal-sewer)) (with-pp (cond - ((>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.5)) + ((>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.5)) (cond ((logtest? (-> arg1 waypoint-bits) 1) (when (and (not (speech-playing? arg1 29)) (not (speech-playing? arg1 30))) @@ -1926,7 +1918,7 @@ (-> v1-44 extra process) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) (let ((a1-10 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-10 from) (process->ppointer pp)) (set! (-> a1-10 num-params) 2) @@ -1945,7 +1937,7 @@ ) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2.5)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2.5)) (let ((a1-11 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-11 from) (process->ppointer pp)) (set! (-> a1-11 num-params) 2) @@ -1964,7 +1956,7 @@ ) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3.5)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3.5)) (let ((a1-12 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-12 from) (process->ppointer pp)) (set! (-> a1-12 num-params) 2) @@ -2188,7 +2180,7 @@ #t ) ) - ((and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4)) + ((and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4)) (>= (vector4-dot (math-camera-pos) (the-as vector (-> arg1 test-plane))) 0.0) ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) @@ -2283,7 +2275,7 @@ ) ) (hal-sewer-method-228 arg1) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.75)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.75)) (let ((a1-8 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-8 from) (process->ppointer pp)) (set! (-> a1-8 num-params) 2) @@ -2302,7 +2294,7 @@ ) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2.75)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2.75)) (let ((a1-9 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-9 from) (process->ppointer pp)) (set! (-> a1-9 num-params) 2) @@ -2321,7 +2313,7 @@ ) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3.5)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3.5)) (let ((a1-10 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-10 from) (process->ppointer pp)) (set! (-> a1-10 num-params) 2) @@ -2396,69 +2388,67 @@ (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) (local-vars (a0-10 process)) - (with-pp - (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (s5-0 (if v1-3 - (-> v1-3 extra process) - ) - ) - (v1-8 (-> arg1 actor-group 0 data 3 actor)) - (s4-0 (if v1-8 - (-> v1-8 extra process) - ) - ) - (v1-13 (-> arg1 actor-group 0 data 2 actor)) - (s3-0 (if v1-13 - (-> v1-13 extra process) - ) - ) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.75)) - (send-event s4-0 'request 'waypoint 34) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2.25)) - (send-event s3-0 'request 'waypoint 34) - ) - (when (and (not (channel-active? arg1 (the-as uint 0))) - (and (not (speech-playing? arg1 42)) - (not (speech-playing? arg1 43)) - (begin - (let ((v1-45 (-> arg1 actor-group 0 data 1 actor))) - (set! a0-10 (if v1-45 - (-> v1-45 extra process) - ) - ) - ) - a0-10 - ) - (>= (the-as int (send-event a0-10 'query 'waypoint)) 33) - ) - ) - (if (zero? (get-rand-int arg1 2)) - (play-speech arg1 42) - (play-speech arg1 43) - ) - (play-speech arg1 44) - (play-speech arg1 45) - ) - (let ((a0-16 s5-0)) - (when (and (and a0-16 (= (send-event a0-16 'query 'waypoint) 34)) - (let ((a0-18 s4-0)) - (and a0-18 (= (send-event a0-18 'query 'waypoint) 34)) - ) - (let ((a0-20 s3-0)) - (and (and a0-20 (= (send-event a0-20 'query 'waypoint) 34)) - (outside-spot-radius? (the-as bot s5-0) (the-as bot-spot #f) (the-as vector #f) #f) - (outside-spot-radius? (the-as bot s4-0) (the-as bot-spot #f) (the-as vector #f) #f) - (outside-spot-radius? (the-as bot s3-0) (the-as bot-spot #f) (the-as vector #f) #f) - ) - ) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (s5-0 (if v1-3 + (-> v1-3 extra process) ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 35 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t + ) + (v1-8 (-> arg1 actor-group 0 data 3 actor)) + (s4-0 (if v1-8 + (-> v1-8 extra process) + ) + ) + (v1-13 (-> arg1 actor-group 0 data 2 actor)) + (s3-0 (if v1-13 + (-> v1-13 extra process) + ) + ) + ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.75)) + (send-event s4-0 'request 'waypoint 34) + ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2.25)) + (send-event s3-0 'request 'waypoint 34) + ) + (when (and (not (channel-active? arg1 (the-as uint 0))) + (and (not (speech-playing? arg1 42)) + (not (speech-playing? arg1 43)) + (begin + (let ((v1-45 (-> arg1 actor-group 0 data 1 actor))) + (set! a0-10 (if v1-45 + (-> v1-45 extra process) + ) + ) + ) + a0-10 + ) + (>= (the-as int (send-event a0-10 'query 'waypoint)) 33) + ) + ) + (if (zero? (get-rand-int arg1 2)) + (play-speech arg1 42) + (play-speech arg1 43) ) + (play-speech arg1 44) + (play-speech arg1 45) + ) + (let ((a0-16 s5-0)) + (when (and (and a0-16 (= (send-event a0-16 'query 'waypoint) 34)) + (let ((a0-18 s4-0)) + (and a0-18 (= (send-event a0-18 'query 'waypoint) 34)) + ) + (let ((a0-20 s3-0)) + (and (and a0-20 (= (send-event a0-20 'query 'waypoint) 34)) + (outside-spot-radius? (the-as bot s5-0) (the-as bot-spot #f) (the-as vector #f) #f) + (outside-spot-radius? (the-as bot s4-0) (the-as bot-spot #f) (the-as vector #f) #f) + (outside-spot-radius? (the-as bot s3-0) (the-as bot-spot #f) (the-as vector #f) #f) + ) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 35 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) @@ -2613,7 +2603,7 @@ ) 1.0 ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + (set! (-> arg1 waypoint-time0) (current-time)) ) (else (if (and (not (speech-playing? arg1 46)) (not (channel-active? arg1 (the-as uint 0)))) @@ -2625,21 +2615,21 @@ ) (let ((a0-6 s3-0)) (if (and (and a0-6 (= (send-event a0-6 'query 'waypoint) 35)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.1)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.1)) ) (send-event s3-0 'request 'waypoint 37) ) ) (let ((a0-11 s4-0)) (if (and (and a0-11 (= (send-event a0-11 'query 'waypoint) 35)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.9)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.9)) ) (send-event s4-0 'request 'waypoint 37) ) ) (let ((a0-16 s5-0)) (if (and (and a0-16 (= (send-event a0-16 'query 'waypoint) 35)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.7)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.7)) ) (send-event s5-0 'request 'waypoint 37) ) @@ -2790,7 +2780,7 @@ ) (cond ((not (logtest? (-> arg1 waypoint-bits) 1)) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.5)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.5)) (logior! (-> arg1 waypoint-bits) 1) (let ((a1-5 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-5 from) (process->ppointer pp)) @@ -2815,7 +2805,7 @@ #f ) ((not (logtest? (-> arg1 waypoint-bits) 2)) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4)) (logior! (-> arg1 waypoint-bits) 2) (let ((a1-10 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-10 from) (process->ppointer pp)) @@ -2836,7 +2826,7 @@ #f ) ((not (logtest? (-> arg1 waypoint-bits) 4)) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 5)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 5)) (logior! (-> arg1 waypoint-bits) 4) (let ((a1-11 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-11 from) (process->ppointer pp)) @@ -2927,58 +2917,56 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (with-pp - (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (s3-0 (if v1-3 - (-> v1-3 extra process) - ) - ) - (v1-8 (-> arg1 actor-group 0 data 3 actor)) - (s4-0 (if v1-8 - (-> v1-8 extra process) - ) - ) - (v1-13 (-> arg1 actor-group 0 data 2 actor)) - (s5-0 (if v1-13 - (-> v1-13 extra process) - ) - ) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.4)) - (send-event s4-0 'request 'waypoint 42) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.7)) - (send-event s5-0 'request 'waypoint 42) - ) - (cond - ((hal-sewer-method-231 arg1 24) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 44 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - ((let ((a0-11 s3-0)) - (or (and (or (not a0-11) (>= (the-as int (send-event a0-11 'query 'waypoint)) 42)) - (outside-spot-radius? (the-as bot s3-0) (the-as bot-spot #f) (the-as vector #f) #f) - ) - (let ((a0-14 s4-0)) - (and (or (not a0-14) (>= (the-as int (send-event a0-14 'query 'waypoint)) 42)) - (outside-spot-radius? (the-as bot s4-0) (the-as bot-spot #f) (the-as vector #f) #f) - ) - ) - (let ((a0-17 s5-0)) - (and (or (not a0-17) (>= (the-as int (send-event a0-17 'query 'waypoint)) 42)) - (outside-spot-radius? (the-as bot s5-0) (the-as bot-spot #f) (the-as vector #f) #f) - ) - ) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (s3-0 (if v1-3 + (-> v1-3 extra process) + ) + ) + (v1-8 (-> arg1 actor-group 0 data 3 actor)) + (s4-0 (if v1-8 + (-> v1-8 extra process) + ) + ) + (v1-13 (-> arg1 actor-group 0 data 2 actor)) + (s5-0 (if v1-13 + (-> v1-13 extra process) + ) ) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 43 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.4)) + (send-event s4-0 'request 'waypoint 42) ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.7)) + (send-event s5-0 'request 'waypoint 42) + ) + (cond + ((hal-sewer-method-231 arg1 24) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 44 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((let ((a0-11 s3-0)) + (or (and (or (not a0-11) (>= (the-as int (send-event a0-11 'query 'waypoint)) 42)) + (outside-spot-radius? (the-as bot s3-0) (the-as bot-spot #f) (the-as vector #f) #f) + ) + (let ((a0-14 s4-0)) + (and (or (not a0-14) (>= (the-as int (send-event a0-14 'query 'waypoint)) 42)) + (outside-spot-radius? (the-as bot s4-0) (the-as bot-spot #f) (the-as vector #f) #f) + ) + ) + (let ((a0-17 s5-0)) + (and (or (not a0-17) (>= (the-as int (send-event a0-17 'query 'waypoint)) 42)) + (outside-spot-radius? (the-as bot s5-0) (the-as bot-spot #f) (the-as vector #f) #f) + ) + ) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 43 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) ) ) ) @@ -3026,62 +3014,60 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (with-pp - (when (hal-sewer-method-231 arg1 24) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 44 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) - (cond - ((logtest? (-> arg1 bot-task-bits) 20) - (logclear! (-> arg1 bot-flags) (bot-flags bf24)) - (reset-warn-time! arg1) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (when (not (channel-active? arg1 (the-as uint 0))) - (let ((v1-22 *target*)) - (when (and v1-22 (focus-test? v1-22 in-air) (not (logtest? (-> v1-22 focus-status) (focus-status hit)))) - (cond - ((not (speech-playing? arg1 58)) - (play-speech arg1 58) - ) - ((not (speech-playing? arg1 59)) - (play-speech arg1 59) - ) - ((not (speech-playing? arg1 60)) - (play-speech arg1 60) - (play-speech arg1 61) - ) - ) + (when (hal-sewer-method-231 arg1 24) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 44 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (cond + ((logtest? (-> arg1 bot-task-bits) 20) + (logclear! (-> arg1 bot-flags) (bot-flags bf24)) + (reset-warn-time! arg1) + (set! (-> arg1 waypoint-time0) (current-time)) + (when (not (channel-active? arg1 (the-as uint 0))) + (let ((v1-22 *target*)) + (when (and v1-22 (focus-test? v1-22 in-air) (not (logtest? (-> v1-22 focus-status) (focus-status hit)))) + (cond + ((not (speech-playing? arg1 58)) + (play-speech arg1 58) + ) + ((not (speech-playing? arg1 59)) + (play-speech arg1 59) + ) + ((not (speech-playing? arg1 60)) + (play-speech arg1 60) + (play-speech arg1 61) + ) ) ) ) ) - ((channel-active? arg1 (the-as uint 0)) - (reset-warn-time! arg1) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 11)) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (let ((v1-55 (-> arg1 sentries1-reminder-index)) - (a1-14 (-> arg1 hal2-course sentries1-reminders)) - ) - (cond - ((< v1-55 (-> a1-14 length)) - (set! (-> arg1 sentries1-reminder-index) (+ v1-55 1)) - (play-speech arg1 (-> a1-14 v1-55)) - ) - (else - (set! (-> arg1 bot-flags) (logior (bot-flags bf24) (-> arg1 bot-flags))) - ) + ) + ((channel-active? arg1 (the-as uint 0)) + (reset-warn-time! arg1) + (set! (-> arg1 waypoint-time0) (current-time)) + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 11)) + (set! (-> arg1 waypoint-time0) (current-time)) + (let ((v1-55 (-> arg1 sentries1-reminder-index)) + (a1-14 (-> arg1 hal2-course sentries1-reminders)) + ) + (cond + ((< v1-55 (-> a1-14 length)) + (set! (-> arg1 sentries1-reminder-index) (+ v1-55 1)) + (play-speech arg1 (-> a1-14 v1-55)) + ) + (else + (set! (-> arg1 bot-flags) (logior (bot-flags bf24) (-> arg1 bot-flags))) ) ) ) ) ) - #f ) + #f ) ) ) @@ -3155,58 +3141,56 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (with-pp - (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (s3-0 (if v1-3 - (-> v1-3 extra process) - ) - ) - (v1-8 (-> arg1 actor-group 0 data 3 actor)) - (s4-0 (if v1-8 - (-> v1-8 extra process) - ) - ) - (v1-13 (-> arg1 actor-group 0 data 2 actor)) - (s5-0 (if v1-13 - (-> v1-13 extra process) - ) - ) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.2)) - (send-event s4-0 'request 'waypoint 44) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.4)) - (send-event s5-0 'request 'waypoint 44) - ) - (cond - ((hal-sewer-method-231 arg1 27) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 48 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - ((let ((a0-11 s3-0)) - (or (and (or (not a0-11) (>= (the-as int (send-event a0-11 'query 'waypoint)) 47)) - (outside-spot-radius? (the-as bot s3-0) (the-as bot-spot #f) (the-as vector #f) #f) - ) - (let ((a0-14 s4-0)) - (and (or (not a0-14) (>= (the-as int (send-event a0-14 'query 'waypoint)) 47)) - (outside-spot-radius? (the-as bot s4-0) (the-as bot-spot #f) (the-as vector #f) #f) - ) - ) - (let ((a0-17 s5-0)) - (and (or (not a0-17) (>= (the-as int (send-event a0-17 'query 'waypoint)) 47)) - (outside-spot-radius? (the-as bot s5-0) (the-as bot-spot #f) (the-as vector #f) #f) - ) - ) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (s3-0 (if v1-3 + (-> v1-3 extra process) + ) + ) + (v1-8 (-> arg1 actor-group 0 data 3 actor)) + (s4-0 (if v1-8 + (-> v1-8 extra process) + ) + ) + (v1-13 (-> arg1 actor-group 0 data 2 actor)) + (s5-0 (if v1-13 + (-> v1-13 extra process) + ) ) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 47 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.2)) + (send-event s4-0 'request 'waypoint 44) ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.4)) + (send-event s5-0 'request 'waypoint 44) + ) + (cond + ((hal-sewer-method-231 arg1 27) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 48 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((let ((a0-11 s3-0)) + (or (and (or (not a0-11) (>= (the-as int (send-event a0-11 'query 'waypoint)) 47)) + (outside-spot-radius? (the-as bot s3-0) (the-as bot-spot #f) (the-as vector #f) #f) + ) + (let ((a0-14 s4-0)) + (and (or (not a0-14) (>= (the-as int (send-event a0-14 'query 'waypoint)) 47)) + (outside-spot-radius? (the-as bot s4-0) (the-as bot-spot #f) (the-as vector #f) #f) + ) + ) + (let ((a0-17 s5-0)) + (and (or (not a0-17) (>= (the-as int (send-event a0-17 'query 'waypoint)) 47)) + (outside-spot-radius? (the-as bot s5-0) (the-as bot-spot #f) (the-as vector #f) #f) + ) + ) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 47 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) ) ) ) @@ -3254,60 +3238,58 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (with-pp - (when (hal-sewer-method-231 arg1 27) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 48 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) - (cond - ((logtest? (-> arg1 bot-task-bits) 40) - (logclear! (-> arg1 bot-flags) (bot-flags bf24)) - (reset-warn-time! arg1) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - (when (not (channel-active? arg1 (the-as uint 0))) - (let ((v1-22 *target*)) - (when (and v1-22 (focus-test? v1-22 in-air) (not (logtest? (-> v1-22 focus-status) (focus-status hit)))) - (cond - ((not (speech-playing? arg1 64)) - (play-speech arg1 64) - ) - ((not (speech-playing? arg1 65)) - (play-speech arg1 65) - ) - ) + (when (hal-sewer-method-231 arg1 27) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 48 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (cond + ((logtest? (-> arg1 bot-task-bits) 40) + (logclear! (-> arg1 bot-flags) (bot-flags bf24)) + (reset-warn-time! arg1) + (set! (-> arg1 waypoint-time0) (current-time)) + (when (not (channel-active? arg1 (the-as uint 0))) + (let ((v1-22 *target*)) + (when (and v1-22 (focus-test? v1-22 in-air) (not (logtest? (-> v1-22 focus-status) (focus-status hit)))) + (cond + ((not (speech-playing? arg1 64)) + (play-speech arg1 64) + ) + ((not (speech-playing? arg1 65)) + (play-speech arg1 65) + ) ) ) ) ) - ((channel-active? arg1 (the-as uint 0)) - (reset-warn-time! arg1) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 9)) - (let ((v1-46 (-> arg1 sentries2-reminder-index)) - (a1-11 (-> arg1 hal2-course sentries2-reminders)) - ) - (cond - ((< v1-46 (-> a1-11 length)) - (set! (-> arg1 sentries2-reminder-index) (+ v1-46 1)) - (play-speech arg1 (-> a1-11 v1-46)) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - (else - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 20)) - (set! (-> arg1 bot-flags) (logior (bot-flags bf24) (-> arg1 bot-flags))) - ) - ) + ) + ((channel-active? arg1 (the-as uint 0)) + (reset-warn-time! arg1) + (set! (-> arg1 waypoint-time0) (current-time)) + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 9)) + (let ((v1-46 (-> arg1 sentries2-reminder-index)) + (a1-11 (-> arg1 hal2-course sentries2-reminders)) + ) + (cond + ((< v1-46 (-> a1-11 length)) + (set! (-> arg1 sentries2-reminder-index) (+ v1-46 1)) + (play-speech arg1 (-> a1-11 v1-46)) + (set! (-> arg1 waypoint-time0) (current-time)) + ) + (else + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 20)) + (set! (-> arg1 bot-flags) (logior (bot-flags bf24) (-> arg1 bot-flags))) + ) ) ) ) ) ) - #f ) + #f ) ) ) @@ -3370,9 +3352,7 @@ ) ) ) - (when (and (logtest? (-> arg1 waypoint-bits) 1) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.25)) - ) + (when (and (logtest? (-> arg1 waypoint-bits) 1) (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.25))) (set! (-> arg1 waypoint-bits) (logand -2 (-> arg1 waypoint-bits))) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-1 from) (process->ppointer pp)) @@ -3540,10 +3520,10 @@ ) ) ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.2)) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.2)) (send-event s3-0 'request 'waypoint 48) ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.4)) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.4)) (send-event s4-0 'request 'waypoint 48) ) ) @@ -3734,44 +3714,42 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (with-pp - (cond - ((hal-sewer-method-229 arg1) - (logclear! (-> arg1 bot-flags) (bot-flags bf24)) - (reset-warn-time! arg1) - (when (and (not (channel-active? arg1 (the-as uint 0))) (scene-play arg1 "sewer-hosehead" #f)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 57 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + (cond + ((hal-sewer-method-229 arg1) + (logclear! (-> arg1 bot-flags) (bot-flags bf24)) + (reset-warn-time! arg1) + (when (and (not (channel-active? arg1 (the-as uint 0))) (scene-play arg1 "sewer-hosehead" #f)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 57 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) - (else - (cond - ((channel-active? arg1 (the-as uint 0)) - (set! (-> arg1 waypoint-time0) (+ (-> pp clock frame-counter) (seconds 9))) - ) - ((>= (-> pp clock frame-counter) (-> arg1 waypoint-time0)) - (let ((a1-8 - (bot-speech-list-method-9 - (-> arg1 hal2-course bomb2-reminders) - arg1 - (-> arg1 hal2-course speeches) - (speech-flags) - ) + ) + (else + (cond + ((channel-active? arg1 (the-as uint 0)) + (set! (-> arg1 waypoint-time0) (+ (current-time) (seconds 9))) + ) + ((>= (current-time) (-> arg1 waypoint-time0)) + (let ((a1-8 + (bot-speech-list-method-9 + (-> arg1 hal2-course bomb2-reminders) + arg1 + (-> arg1 hal2-course speeches) + (speech-flags) ) ) - (if (>= a1-8 0) - (play-speech arg1 a1-8) - (set! (-> arg1 bot-flags) (logior (bot-flags bf24) (-> arg1 bot-flags))) - ) - ) + ) + (if (>= a1-8 0) + (play-speech arg1 a1-8) + (set! (-> arg1 bot-flags) (logior (bot-flags bf24) (-> arg1 bot-flags))) + ) ) - ) + ) ) ) - #f ) + #f ) ) ) @@ -3979,70 +3957,66 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (with-pp - (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) - (s3-0 (if v1-3 - (-> v1-3 extra process) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (s3-0 (if v1-3 + (-> v1-3 extra process) + ) + ) + (v1-8 (-> arg1 actor-group 0 data 3 actor)) + (s4-0 (if v1-8 + (-> v1-8 extra process) + ) + ) + (v1-13 (-> arg1 actor-group 0 data 2 actor)) + (s5-0 (if v1-13 + (-> v1-13 extra process) + ) + ) + ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) + (send-event s5-0 'request 'waypoint 59) + ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3)) + (send-event s3-0 'request 'waypoint 59) + ) + (if (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 4)) + (send-event s4-0 'request 'waypoint 59) + ) + (when (not (channel-active? arg1 (the-as uint 0))) + (cond + ((and (not (speech-playing? arg1 75)) (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 6))) + (play-speech arg1 75) + (play-speech arg1 76) + ) + (else + (when (and (>= (vector4-dot (-> (the-as process-focusable s3-0) root-override trans) (the-as vector (-> arg1 test-plane))) + 0.0 + ) + (>= (vector4-dot (-> (the-as process-focusable s4-0) root-override trans) (the-as vector (-> arg1 test-plane))) + 0.0 + ) + (>= (vector4-dot (-> (the-as process-focusable s5-0) root-override trans) (the-as vector (-> arg1 test-plane))) + 0.0 + ) ) - ) - (v1-8 (-> arg1 actor-group 0 data 3 actor)) - (s4-0 (if v1-8 - (-> v1-8 extra process) - ) - ) - (v1-13 (-> arg1 actor-group 0 data 2 actor)) - (s5-0 (if v1-13 - (-> v1-13 extra process) - ) - ) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) - (send-event s5-0 'request 'waypoint 59) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) - (send-event s3-0 'request 'waypoint 59) - ) - (if (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4)) - (send-event s4-0 'request 'waypoint 59) - ) - (when (not (channel-active? arg1 (the-as uint 0))) - (cond - ((and (not (speech-playing? arg1 75)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 6)) - ) - (play-speech arg1 75) - (play-speech arg1 76) - ) - (else - (when (and (>= (vector4-dot (-> (the-as process-focusable s3-0) root-override trans) (the-as vector (-> arg1 test-plane))) - 0.0 - ) - (>= (vector4-dot (-> (the-as process-focusable s4-0) root-override trans) (the-as vector (-> arg1 test-plane))) - 0.0 - ) - (>= (vector4-dot (-> (the-as process-focusable s5-0) root-override trans) (the-as vector (-> arg1 test-plane))) - 0.0 - ) - ) - (let ((a0-18 *target*)) - (when (and a0-18 - (and (>= (vector4-dot (get-trans a0-18 0) (the-as vector (-> arg1 test-plane))) 0.0) - (scene-play arg1 "sewer-blow-up-statue-res" #f) - ) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 67 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + (let ((a0-18 *target*)) + (when (and a0-18 + (and (>= (vector4-dot (get-trans a0-18 0) (the-as vector (-> arg1 test-plane))) 0.0) + (scene-play arg1 "sewer-blow-up-statue-res" #f) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 67 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) ) ) ) - (none) ) + (none) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/sewer/hosehead_REF.gc b/test/decompiler/reference/jak2/levels/sewer/hosehead_REF.gc index b5ca4abb87..9af5f5f360 100644 --- a/test/decompiler/reference/jak2/levels/sewer/hosehead_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/hosehead_REF.gc @@ -436,7 +436,6 @@ ) ;; definition for method 3 of type ik-setup -;; INFO: this function exists in multiple non-identical object files (defmethod inspect ik-setup ((obj ik-setup)) (when (not obj) (set! obj obj) @@ -1080,7 +1079,7 @@ :enter (-> (method-of-type nav-enemy idle) enter) :exit (-> (method-of-type nav-enemy idle) exit) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (when (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (let ((a0-3 (handle->process (-> self focus handle)))) (when a0-3 (let ((f0-0 @@ -1127,7 +1126,7 @@ (set! (-> self fire-beam?) #f) (set! (-> self allow-head) #t) (set! (-> self lazer-length) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -1173,7 +1172,7 @@ ) (set! (-> self head-angle) f0-5) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (when (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (let ((a0-8 (handle->process (-> self focus handle)))) (when a0-8 (let ((f0-6 @@ -1547,7 +1546,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior hosehead) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -1957,9 +1956,9 @@ (ja :num! (seek! max f30-0)) ) (set! (-> self fire-beam?) #t) - (let ((gp-0 (+ (-> self clock frame-counter) (seconds 2)))) + (let ((gp-0 (+ (current-time) (seconds 2)))) (until #f - (when (or (< gp-0 (-> self clock frame-counter)) (not (-> self fire-beam?)) (not (enemy-method-96 self 8192.0 #t))) + (when (or (< gp-0 (current-time)) (not (-> self fire-beam?)) (not (enemy-method-96 self 8192.0 #t))) (set! (-> self fire-beam?) #f) (set! (-> self allow-head) #f) (goto cfg-13) @@ -2082,9 +2081,9 @@ ) ) (nav-enemy-method-166 self) - (set! (-> self last-time-dist-changed) (-> self clock frame-counter)) + (set! (-> self last-time-dist-changed) (current-time)) (set! (-> self next-lazer-time) 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -2113,11 +2112,9 @@ 0 ) ((zero? (-> self next-lazer-time)) - (set! (-> self next-lazer-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (get-rand-float-range self 1.0 2.0)))) - ) + (set! (-> self next-lazer-time) (+ (current-time) (the int (* 300.0 (get-rand-float-range self 1.0 2.0))))) ) - ((>= (-> self clock frame-counter) (-> self next-lazer-time)) + ((>= (current-time) (-> self next-lazer-time)) (if (and (enemy-method-96 self 3640.889 #t) (and (< 40960.0 f30-0) (hosehead-method-190 self))) (go-virtual fire) ) diff --git a/test/decompiler/reference/jak2/levels/sewer/mog2-course_REF.gc b/test/decompiler/reference/jak2/levels/sewer/mog2-course_REF.gc index 337cdc784f..2075ae61e8 100644 --- a/test/decompiler/reference/jak2/levels/sewer/mog2-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/mog2-course_REF.gc @@ -437,36 +437,31 @@ :nav-mesh-index 2 :skip-to -1 :on-set (lambda ((arg0 mog-sewer)) - (with-pp - (set! (-> arg0 waypoint-time0) (-> pp clock frame-counter)) - (set! (-> arg0 bot-flags) (logior (bot-flags bf19) (-> arg0 bot-flags))) - (clear-poi-and-focus! arg0) - (logclear! (-> arg0 focus-status) (focus-status disable)) - (set! (-> arg0 notice-enemy-dist) 204800.0) - (set! (-> arg0 min-speed) 32768.0) - (set! (-> arg0 max-speed) 32768.0) - (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) ruft-wait-spot arg0))) - (set! (-> v1-12 bytes 5) 1) - (set! (-> v1-12 bytes 6) 9) - (set! (-> v1-12 bytes 4) -1) - (set! (-> (the-as ruft-wait-spot v1-12) check-done) - (the-as - (function ruft-wait-spot ruffian symbol) - (lambda ((arg0 object) (arg1 mog-sewer)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 16 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t + (set! (-> arg0 waypoint-time0) (current-time)) + (set! (-> arg0 bot-flags) (logior (bot-flags bf19) (-> arg0 bot-flags))) + (clear-poi-and-focus! arg0) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 notice-enemy-dist) 204800.0) + (set! (-> arg0 min-speed) 32768.0) + (set! (-> arg0 max-speed) 32768.0) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) ruft-wait-spot arg0))) + (set! (-> v1-12 bytes 5) 1) + (set! (-> v1-12 bytes 6) 9) + (set! (-> v1-12 bytes 4) -1) + (set! (-> (the-as ruft-wait-spot v1-12) check-done) + (the-as + (function ruft-wait-spot ruffian symbol) + (lambda ((arg0 object) (arg1 mog-sewer)) (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 16 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) ) - ) - ) - ) ) - ) - (none) + ) ) + (none) ) :on-update #f :on-skipping-here #f @@ -1855,7 +1850,3 @@ ;; failed to figure out what this is: (set! (-> *bot-course-table* course 3) *mog2-course*) - - - - diff --git a/test/decompiler/reference/jak2/levels/sewer/sewer-obs2_REF.gc b/test/decompiler/reference/jak2/levels/sewer/sewer-obs2_REF.gc index 2588c30a41..9932c2d83c 100644 --- a/test/decompiler/reference/jak2/levels/sewer/sewer-obs2_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/sewer-obs2_REF.gc @@ -1046,8 +1046,8 @@ This commonly includes things such as: ) ) (cleanup-for-death self) - (let ((frame-counter (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 2)) + (let ((frame-counter (current-time))) + (until (>= (- (current-time) frame-counter) (seconds 2)) (suspend) ) ) @@ -1175,7 +1175,7 @@ This commonly includes things such as: (t9-2 sin-rad) (f1-0 -3.1415925) (f2-0 6.283185) - (f3-1 (the float (+ (-> self clock frame-counter) (the-as time-frame (-> self time-skew))))) + (f3-1 (the float (+ (current-time) (the-as time-frame (-> self time-skew))))) (f28-0 (t9-2 (+ f1-0 (* f2-0 (/ (- f3-1 (* (the float (the int (/ f3-1 period))) period)) period))))) ) (when (< ocean-base-height (-> self center y)) @@ -1805,7 +1805,7 @@ This commonly includes things such as: enemy-event-handler ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self draw status) (draw-control-status no-draw)) (none) ) diff --git a/test/decompiler/reference/jak2/levels/sewer/sewer-obs_REF.gc b/test/decompiler/reference/jak2/levels/sewer/sewer-obs_REF.gc index 8f990b93bf..b650b181dd 100644 --- a/test/decompiler/reference/jak2/levels/sewer/sewer-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/sewer-obs_REF.gc @@ -270,29 +270,27 @@ This commonly includes things such as: ;; WARN: Return type mismatch int vs none. (defun sew-tri-blade-joint-callback ((arg0 draw-control) (arg1 cspace-array) (arg2 joint-control)) "Handles the rotation and transformation of the [[sew-tri-blade]]" - (with-pp - (let ((blade (the-as sew-tri-blade (-> arg0 process))) - (matrix (new-stack-matrix0)) - (f30-0 (* 182.04445 (* 0.0033333334 (the float (-> pp clock frame-counter))))) - ) - (let ((s3-0 (-> arg1 data 4 bone transform))) - (matrix-rotate-y! matrix (* 240.0 f30-0)) - (matrix*! s3-0 matrix s3-0) - ) - (let ((s3-1 (-> arg1 data 5 bone transform))) - (matrix-rotate-y! matrix (* -240.0 f30-0)) - (matrix*! s3-1 matrix s3-1) - (set! (-> blade y-max) (+ (- 25395.2 (-> blade root trans y)) (-> s3-1 trans y))) - ) - (let ((s4-1 (-> arg1 data 6 bone transform))) - (matrix-rotate-y! matrix (* 240.0 f30-0)) - (matrix*! s4-1 matrix s4-1) - (set! (-> blade y-max) (fmax (-> blade y-max) (+ (- 19251.2 (-> blade root trans y)) (-> s4-1 trans y)))) + (let ((blade (the-as sew-tri-blade (-> arg0 process))) + (matrix (new-stack-matrix0)) + (f30-0 (* 182.04445 (* 0.0033333334 (the float (current-time))))) ) + (let ((s3-0 (-> arg1 data 4 bone transform))) + (matrix-rotate-y! matrix (* 240.0 f30-0)) + (matrix*! s3-0 matrix s3-0) + ) + (let ((s3-1 (-> arg1 data 5 bone transform))) + (matrix-rotate-y! matrix (* -240.0 f30-0)) + (matrix*! s3-1 matrix s3-1) + (set! (-> blade y-max) (+ (- 25395.2 (-> blade root trans y)) (-> s3-1 trans y))) + ) + (let ((s4-1 (-> arg1 data 6 bone transform))) + (matrix-rotate-y! matrix (* 240.0 f30-0)) + (matrix*! s4-1 matrix s4-1) + (set! (-> blade y-max) (fmax (-> blade y-max) (+ (- 19251.2 (-> blade root trans y)) (-> s4-1 trans y)))) ) - 0 - (none) ) + 0 + (none) ) ;; failed to figure out what this is: @@ -400,81 +398,79 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (with-pp - (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) - (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) - (set! (-> cshape reaction) cshape-reaction-default) - (set! (-> cshape no-reaction) - (the-as (function collide-shape-moving collide-query vector vector object) nothing) - ) - (let ((s3-0 (new 'process 'collide-shape-prim-group cshape (the-as uint 3) 0))) - (set! (-> cshape total-prims) (the-as uint 4)) - (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid deadly)) - (set-vector! (-> s3-0 local-sphere) 0.0 10240.0 0.0 36864.0) - (set! (-> cshape root-prim) s3-0) - ) - (pusher-init cshape) - (let ((v1-16 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 2) (the-as uint 0)))) - (set! (-> v1-16 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> v1-16 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-16 prim-core action) (collide-action solid deadly)) - (set! (-> v1-16 transform-index) 4) - (set-vector! (-> v1-16 local-sphere) 0.0 8192.0 0.0 18841.6) - ) - (let ((v1-18 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 1) (the-as uint 0)))) - (set! (-> v1-18 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> v1-18 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-18 prim-core action) (collide-action solid deadly)) - (set! (-> v1-18 transform-index) 5) - (set-vector! (-> v1-18 local-sphere) 0.0 8192.0 0.0 12288.0) - ) - (let ((v1-20 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-20 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> v1-20 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-20 prim-core action) (collide-action solid deadly)) - (set! (-> v1-20 transform-index) 6) - (set-vector! (-> v1-20 local-sphere) 0.0 4915.2 0.0 7372.8) - ) - (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) - (let ((v1-23 (-> cshape root-prim))) - (set! (-> cshape backup-collide-as) (-> v1-23 prim-core collide-as)) - (set! (-> cshape backup-collide-with) (-> v1-23 prim-core collide-with)) - ) - (set! (-> obj root) cshape) + (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((s3-0 (new 'process 'collide-shape-prim-group cshape (the-as uint 3) 0))) + (set! (-> cshape total-prims) (the-as uint 4)) + (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s3-0 prim-core action) (collide-action solid deadly)) + (set-vector! (-> s3-0 local-sphere) 0.0 10240.0 0.0 36864.0) + (set! (-> cshape root-prim) s3-0) ) - (process-drawable-from-entity! obj entity) - (logclear! (-> obj mask) (process-mask actor-pause)) - (initialize-skeleton - obj - (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-tri-blade" (the-as (pointer uint32) #f))) - (the-as pair 0) + (pusher-init cshape) + (let ((v1-16 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 2) (the-as uint 0)))) + (set! (-> v1-16 prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> v1-16 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-16 prim-core action) (collide-action solid deadly)) + (set! (-> v1-16 transform-index) 4) + (set-vector! (-> v1-16 local-sphere) 0.0 8192.0 0.0 18841.6) ) - (set! (-> obj state-time) (-> pp clock frame-counter)) - (set! (-> obj anim-time) 0.0) - (set! (-> obj anim-offset) 0.0) - (set! (-> obj skel postbind-function) sew-tri-blade-joint-callback) - (let* ((v1-33 *game-info*) - (a0-33 (+ (-> v1-33 attack-id) 1)) - ) - (set! (-> v1-33 attack-id) a0-33) - (set! (-> obj attack-id) a0-33) + (let ((v1-18 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-18 prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> v1-18 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-18 prim-core action) (collide-action solid deadly)) + (set! (-> v1-18 transform-index) 5) + (set-vector! (-> v1-18 local-sphere) 0.0 8192.0 0.0 12288.0) ) - (if (>= (res-lump-value entity 'extra-id int :default (the-as uint128 -1) :time -1000000000.0) 0) - (set! (-> obj anim-offset) 3.0) - ) - (set! (-> obj sound) (new 'process 'ambient-sound "none" (-> obj root trans))) - (set-falloff-far! (-> obj sound) 286720.0) - (set! (-> obj y-min) 0.0) - (set! (-> obj y-max) 48332.8) - (set! (-> obj snd-water) (static-sound-name "tri-blade-w")) - (set! (-> obj snd-no-water) (static-sound-name "tri-blade")) - (transform-post) - (go (method-of-object obj idle)) - (none) + (let ((v1-20 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-20 prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> v1-20 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-20 prim-core action) (collide-action solid deadly)) + (set! (-> v1-20 transform-index) 6) + (set-vector! (-> v1-20 local-sphere) 0.0 4915.2 0.0 7372.8) + ) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((v1-23 (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> v1-23 prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> v1-23 prim-core collide-with)) + ) + (set! (-> obj root) cshape) ) + (process-drawable-from-entity! obj entity) + (logclear! (-> obj mask) (process-mask actor-pause)) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-tri-blade" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> obj state-time) (current-time)) + (set! (-> obj anim-time) 0.0) + (set! (-> obj anim-offset) 0.0) + (set! (-> obj skel postbind-function) sew-tri-blade-joint-callback) + (let* ((v1-33 *game-info*) + (a0-33 (+ (-> v1-33 attack-id) 1)) + ) + (set! (-> v1-33 attack-id) a0-33) + (set! (-> obj attack-id) a0-33) + ) + (if (>= (res-lump-value entity 'extra-id int :default (the-as uint128 -1) :time -1000000000.0) 0) + (set! (-> obj anim-offset) 3.0) + ) + (set! (-> obj sound) (new 'process 'ambient-sound "none" (-> obj root trans))) + (set-falloff-far! (-> obj sound) 286720.0) + (set! (-> obj y-min) 0.0) + (set! (-> obj y-max) 48332.8) + (set! (-> obj snd-water) (static-sound-name "tri-blade-w")) + (set! (-> obj snd-no-water) (static-sound-name "tri-blade")) + (transform-post) + (go (method-of-object obj idle)) + (none) ) ;; definition of type sew-arm-blade @@ -841,7 +837,7 @@ This commonly includes things such as: (send-event-function hit-proc evt) ) ) - (set! (-> self no-collision-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self no-collision-timer) (the-as uint (current-time))) (let ((root-prim (-> self root-overide root-prim))) (set! (-> root-prim prim-core collide-as) (collide-spec)) (set! (-> root-prim prim-core collide-with) (collide-spec)) @@ -855,7 +851,7 @@ This commonly includes things such as: ) :trans (behavior () (when (and (nonzero? (-> self no-collision-timer)) - (>= (- (-> self clock frame-counter) (the-as int (-> self no-collision-timer))) + (>= (- (current-time) (the-as int (-> self no-collision-timer))) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout)) ) ) diff --git a/test/decompiler/reference/jak2/levels/sewer/sewer-scenes_REF.gc b/test/decompiler/reference/jak2/levels/sewer/sewer-scenes_REF.gc index 0711be649a..b202d4713c 100644 --- a/test/decompiler/reference/jak2/levels/sewer/sewer-scenes_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/sewer-scenes_REF.gc @@ -1334,7 +1334,7 @@ (lambda :behavior task-manager () (local-vars (sv-96 int) (sv-100 float) (sv-104 vector)) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (set! (-> self hud-timer) (ppointer->handle (process-spawn hud-gunturret :init hud-init-by-other :to self))) (while (> (-> self data-int32 0) 0) (when (!= (level-status *level* 'sewer) 'active) @@ -1379,10 +1379,10 @@ (set! (-> *game-info* counter) (the float v1-51)) ) (when (and (= (-> self data-int32 1) sv-96) - (and (< sv-100 122880.0) (>= (- (-> self clock frame-counter) (-> self beep-time)) (seconds 40))) + (and (< sv-100 122880.0) (>= (- (current-time) (-> self beep-time)) (seconds 40))) ) (talker-spawn-func (-> *talker-speech* 53) *entity-pool* (target-pos 0) (the-as region #f)) - (set! (-> self beep-time) (-> self clock frame-counter)) + (set! (-> self beep-time) (current-time)) ) (suspend) ) diff --git a/test/decompiler/reference/jak2/levels/stadium/jetboard/skatea-obs_REF.gc b/test/decompiler/reference/jak2/levels/stadium/jetboard/skatea-obs_REF.gc index 046d67d148..64d4717e1f 100644 --- a/test/decompiler/reference/jak2/levels/stadium/jetboard/skatea-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/stadium/jetboard/skatea-obs_REF.gc @@ -395,8 +395,8 @@ (suspend) ) (send-event (handle->process (-> self voicebox)) 'speak-effect #f) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -438,8 +438,8 @@ (suspend) ) (send-event (handle->process (-> self voicebox)) 'speak-effect #f) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -460,7 +460,7 @@ (send-event *target* 'get-notify self) (set! (-> self trick-type) (board-tricks none)) (let ((gp-2 #f) - (s5-0 (+ (-> self clock frame-counter) (seconds 15))) + (s5-0 (+ (current-time) (seconds 15))) ) (until #f (let ((a1-7 (new 'stack-no-clear 'event-message-block))) @@ -479,11 +479,11 @@ ) ) (render-text self (text-id board-tutorial-boost-jump)) - (when (< s5-0 (-> self clock frame-counter)) + (when (< s5-0 (current-time)) (set! (-> self last-sound-id) (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei009" -99.0 0) ) - (set! s5-0 (+ (-> self clock frame-counter) (seconds 15))) + (set! s5-0 (+ (current-time) (seconds 15))) ) (suspend) (if (= (-> self trick-type) (board-tricks board-quick-jump)) @@ -514,8 +514,8 @@ (while (nonzero? (get-status *gui-control* (-> self last-sound-id))) (suspend) ) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -581,8 +581,8 @@ (suspend) ) (send-event (handle->process (-> self voicebox)) 'speak-effect #f) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -623,8 +623,8 @@ (suspend) ) (send-event (handle->process (-> self voicebox)) 'speak-effect #f) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -662,8 +662,8 @@ (suspend) ) (send-event (handle->process (-> self voicebox)) 'speak-effect #f) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -1018,11 +1018,11 @@ (hoverboard-training-manager-method-29 self) (when (not (-> self challenge-done)) (when (and (not (-> self combo-done?)) - (>= (- (-> self clock frame-counter) (-> self hint-time)) (seconds 30)) + (>= (- (current-time) (-> self hint-time)) (seconds 30)) (not (task-node-closed? (game-task-node stadium-board1-resolution))) ) (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei018" -99.0 0) - (set! (-> self hint-time) (-> self clock frame-counter)) + (set! (-> self hint-time) (current-time)) ) ) (none) @@ -1103,7 +1103,7 @@ (set! (-> self score) 0.0) (set! (-> self challenge-done) #f) (set! (-> self combo-done?) #f) - (set! (-> self hint-time) (-> self clock frame-counter)) + (set! (-> self hint-time) (current-time)) (while (and (not (-> self challenge-done)) (logtest? (-> *game-info* features) (game-feature board))) (suspend) ) @@ -1154,8 +1154,8 @@ t1-3 ) ) - (let ((s5-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-2) (seconds 1)) + (let ((s5-2 (current-time))) + (until (>= (- (current-time) s5-2) (seconds 1)) (suspend) ) ) @@ -1364,8 +1364,8 @@ t1-3 ) ) - (let ((s5-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-2) (seconds 1)) + (let ((s5-2 (current-time))) + (until (>= (- (current-time) s5-2) (seconds 1)) (suspend) ) ) @@ -1526,7 +1526,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :code (behavior () @@ -1676,7 +1676,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :code (behavior () @@ -1986,7 +1986,7 @@ This commonly includes things such as: ) (set! (-> self root-override trans y) (+ (-> self pos-y) - (* 2048.0 (cos (* 18204.445 (+ (-> self offset) (* 0.0033333334 (the float (-> self clock frame-counter))))))) + (* 2048.0 (cos (* 18204.445 (+ (-> self offset) (* 0.0033333334 (the float (current-time))))))) ) ) (transform-post) diff --git a/test/decompiler/reference/jak2/levels/stadium/stadium-obs_REF.gc b/test/decompiler/reference/jak2/levels/stadium/stadium-obs_REF.gc index 995f87d35c..ba34bfa5c2 100644 --- a/test/decompiler/reference/jak2/levels/stadium/stadium-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/stadium/stadium-obs_REF.gc @@ -1005,7 +1005,7 @@ This commonly includes things such as: :virtual #t :event defend-stadium-rift-rider-handler :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -1015,8 +1015,8 @@ This commonly includes things such as: (none) ) :code (behavior () - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1.2)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1.2)) (suspend) ) ) @@ -1562,11 +1562,11 @@ This commonly includes things such as: ;; definition for function stad-samos-post ;; WARN: Return type mismatch int vs none. (defbehavior stad-samos-post stad-samos () - (when (>= (- (-> self clock frame-counter) (-> self cquery-timer)) (seconds 0.32)) + (when (>= (- (current-time) (-> self cquery-timer)) (seconds 0.32)) (move-to-ground (-> self root-override2) 40960.0 40960.0 #t (collide-spec backgnd)) - (set! (-> self cquery-timer) (-> self clock frame-counter)) + (set! (-> self cquery-timer) (current-time)) ) - (when (and (nonzero? (-> self focus-disable-timer)) (< (-> self focus-disable-timer) (-> self clock frame-counter))) + (when (and (nonzero? (-> self focus-disable-timer)) (< (-> self focus-disable-timer) (current-time))) (logclear! (-> self focus-status) (focus-status ignore)) (set! (-> self focus-disable-timer) 0) 0 @@ -1714,8 +1714,8 @@ This commonly includes things such as: ) ) (set! (-> self rift-rider-actor) (entity-actor-lookup (-> self entity) 'alt-actor 0)) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.31)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.31)) (suspend) ) ) @@ -1781,11 +1781,11 @@ This commonly includes things such as: (set! (-> self enable-move?) #t) (set! (-> self speed) 12288.0) (set! (-> self observed-speed) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (when (and (nonzero? (-> self state-time)) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1))) + (when (and (nonzero? (-> self state-time)) (>= (- (current-time) (-> self state-time)) (seconds 1))) (set! (-> self state-time) 0) (let ((a1-0 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-0 from) (process->ppointer self)) @@ -1804,7 +1804,7 @@ This commonly includes things such as: ) (spawn-lightning self) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2)) (go-virtual move-rift-rider) ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) @@ -1991,7 +1991,7 @@ This commonly includes things such as: :virtual #t :enter (behavior () (logior! (-> self focus-status) (focus-status ignore)) - (set! (-> self focus-disable-timer) (+ (-> self clock frame-counter) (seconds 5))) + (set! (-> self focus-disable-timer) (+ (current-time) (seconds 5))) (kill-lightning self) (let ((a1-0 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-0 from) (process->ppointer self)) @@ -2214,8 +2214,8 @@ This commonly includes things such as: ) ) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 2)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 2)) (suspend) ) ) @@ -2297,85 +2297,83 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (with-pp - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) - (the-as (function collide-shape-moving collide-query vector vector object) nothing) + (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) + (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s4-0 reaction) cshape-reaction-default) + (set! (-> s4-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s4-0 penetrated-by) (penetrate jak-yellow-shot jak-red-shot jak-blue-shot)) + (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 3) 0))) + (set! (-> s4-0 total-prims) (the-as uint 4)) + (set! (-> s3-0 prim-core collide-as) (collide-spec bot)) + (set! (-> s3-0 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) ) - (set! (-> s4-0 penetrated-by) (penetrate jak-yellow-shot jak-red-shot jak-blue-shot)) - (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 3) 0))) - (set! (-> s4-0 total-prims) (the-as uint 4)) - (set! (-> s3-0 prim-core collide-as) (collide-spec bot)) - (set! (-> s3-0 prim-core collide-with) - (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) - ) - (set! (-> s3-0 prim-core action) (collide-action solid no-standon)) - (set-vector! (-> s3-0 local-sphere) 0.0 4505.6 0.0 5734.4) - (set! (-> s4-0 root-prim) s3-0) - ) - (let ((v1-13 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) - (set! (-> v1-13 prim-core collide-as) (collide-spec bot)) - (set! (-> v1-13 prim-core collide-with) - (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) - ) - (set! (-> v1-13 prim-core action) (collide-action solid)) - (set-vector! (-> v1-13 local-sphere) 0.0 2457.6 0.0 2457.6) - ) - (let ((v1-15 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) - (set! (-> v1-15 prim-core collide-as) (collide-spec bot)) - (set! (-> v1-15 prim-core collide-with) - (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) - ) - (set! (-> v1-15 prim-core action) (collide-action solid)) - (set-vector! (-> v1-15 local-sphere) 0.0 4505.6 0.0 2457.6) - ) - (let ((v1-17 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) - (set! (-> v1-17 prim-core collide-as) (collide-spec bot)) - (set! (-> v1-17 prim-core collide-with) - (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) - ) - (set! (-> v1-17 prim-core action) (collide-action solid no-standon)) - (set-vector! (-> v1-17 local-sphere) 0.0 6553.6 0.0 2457.6) - ) - (set! (-> s4-0 nav-radius) 6144.0) - (let ((v1-19 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-19 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-19 prim-core collide-with)) - ) - (set! (-> s4-0 event-self) 'touched) - (set! (-> obj root-override2) s4-0) + (set! (-> s3-0 prim-core action) (collide-action solid no-standon)) + (set-vector! (-> s3-0 local-sphere) 0.0 4505.6 0.0 5734.4) + (set! (-> s4-0 root-prim) s3-0) ) - (set! (-> obj hud) (the-as handle #f)) - (set! (-> obj hud-bot-index) 0) - (set! (-> obj rift-rider-joint-offset) 0) - (process-drawable-from-entity! obj arg0) - (init! obj) - (get-nav-control obj (the-as nav-mesh #f)) - (let ((v1-24 (-> obj nav))) - (set! (-> v1-24 sphere-mask) (the-as uint 1102)) + (let ((v1-13 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-13 prim-core collide-as) (collide-spec bot)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> v1-13 prim-core action) (collide-action solid)) + (set-vector! (-> v1-13 local-sphere) 0.0 2457.6 0.0 2457.6) ) - 0 - (logclear! (-> obj mask) (process-mask actor-pause)) - (process-entity-status! obj (entity-perm-status no-kill) #t) - (set! (-> obj rift-rider-actor) (entity-actor-lookup (-> obj entity) 'alt-actor 0)) - (set! (-> obj entity) arg0) - (dotimes (v1-28 4) - (set! (-> obj lightning v1-28) (the-as handle #f)) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec bot)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> v1-15 prim-core action) (collide-action solid)) + (set-vector! (-> v1-15 local-sphere) 0.0 4505.6 0.0 2457.6) ) - (set! (-> obj lightning-on?) #f) - (set! (-> obj rift-rider-actor) #f) - (set! (-> obj cquery-timer) (-> pp clock frame-counter)) - (vector-reset! (-> obj hit-dir)) - (set! (-> obj max-hit-points) (+ 5.0 (* 5.0 (you-suck-scale *game-info* #f)))) - (set! (-> obj hit-points) (-> obj max-hit-points)) - (set! (-> obj incoming-attack-id) (the-as uint -1)) - (set! (-> obj focus-disable-timer) 0) - (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 903) obj)) - (go (method-of-object obj idle)) - (none) + (let ((v1-17 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-17 prim-core collide-as) (collide-spec bot)) + (set! (-> v1-17 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> v1-17 prim-core action) (collide-action solid no-standon)) + (set-vector! (-> v1-17 local-sphere) 0.0 6553.6 0.0 2457.6) + ) + (set! (-> s4-0 nav-radius) 6144.0) + (let ((v1-19 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-19 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-19 prim-core collide-with)) + ) + (set! (-> s4-0 event-self) 'touched) + (set! (-> obj root-override2) s4-0) ) + (set! (-> obj hud) (the-as handle #f)) + (set! (-> obj hud-bot-index) 0) + (set! (-> obj rift-rider-joint-offset) 0) + (process-drawable-from-entity! obj arg0) + (init! obj) + (get-nav-control obj (the-as nav-mesh #f)) + (let ((v1-24 (-> obj nav))) + (set! (-> v1-24 sphere-mask) (the-as uint 1102)) + ) + 0 + (logclear! (-> obj mask) (process-mask actor-pause)) + (process-entity-status! obj (entity-perm-status no-kill) #t) + (set! (-> obj rift-rider-actor) (entity-actor-lookup (-> obj entity) 'alt-actor 0)) + (set! (-> obj entity) arg0) + (dotimes (v1-28 4) + (set! (-> obj lightning v1-28) (the-as handle #f)) + ) + (set! (-> obj lightning-on?) #f) + (set! (-> obj rift-rider-actor) #f) + (set! (-> obj cquery-timer) (current-time)) + (vector-reset! (-> obj hit-dir)) + (set! (-> obj max-hit-points) (+ 5.0 (* 5.0 (you-suck-scale *game-info* #f)))) + (set! (-> obj hit-points) (-> obj max-hit-points)) + (set! (-> obj incoming-attack-id) (the-as uint -1)) + (set! (-> obj focus-disable-timer) 0) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 903) obj)) + (go (method-of-object obj idle)) + (none) ) ;; failed to figure out what this is: @@ -2934,10 +2932,8 @@ This commonly includes things such as: ) (send-event-function proc a1-2) ) - (when (< (-> self next-message-time) (-> self clock frame-counter)) - (set! (-> self next-message-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 2.0 5.0)))) - ) + (when (< (-> self next-message-time) (current-time)) + (set! (-> self next-message-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 2.0 5.0))))) (add-process *gui-control* self (gui-channel alert) (gui-action play) "cityv014" -99.0 0) ) ) @@ -2966,10 +2962,8 @@ This commonly includes things such as: ) (send-event-function proc a1-6) ) - (when (< (-> self next-message-time) (-> self clock frame-counter)) - (set! (-> self next-message-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 2.0 5.0)))) - ) + (when (< (-> self next-message-time) (current-time)) + (set! (-> self next-message-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 2.0 5.0))))) (add-process *gui-control* self (gui-channel alert) (gui-action play) "cityv014" -99.0 0) ) ) diff --git a/test/decompiler/reference/jak2/levels/strip/chaincrate_REF.gc b/test/decompiler/reference/jak2/levels/strip/chaincrate_REF.gc index 109e973007..8a5b66ca5e 100644 --- a/test/decompiler/reference/jak2/levels/strip/chaincrate_REF.gc +++ b/test/decompiler/reference/jak2/levels/strip/chaincrate_REF.gc @@ -327,29 +327,25 @@ ;; definition for method 21 of type strip-chain-crate ;; WARN: Return type mismatch symbol vs none. (defmethod strip-chain-crate-method-21 strip-chain-crate ((obj strip-chain-crate)) - (with-pp - (let ((f30-0 (total-distance (-> obj path))) - (f28-0 - (* (/ (the float (mod - (the-as uint (+ (-> pp clock frame-counter) (the-as time-frame (-> obj spawn-offset)))) - (-> obj spawn-delay) - ) - ) - (the float (-> obj spawn-delay)) - ) - (-> obj dist-apart) - ) - ) + (let ((f30-0 (total-distance (-> obj path))) + (f28-0 + (* (/ (the float + (mod (the-as uint (+ (current-time) (the-as time-frame (-> obj spawn-offset)))) (-> obj spawn-delay)) + ) + (the float (-> obj spawn-delay)) + ) + (-> obj dist-apart) + ) ) - (while (>= f30-0 f28-0) - (let ((f26-0 (/ f28-0 f30-0))) - (process-spawn strip-chain-crate-slave f26-0 (-> obj crate-speed) :to obj) - ) - (+! f28-0 (-> obj dist-apart)) ) + (while (>= f30-0 f28-0) + (let ((f26-0 (/ f28-0 f30-0))) + (process-spawn strip-chain-crate-slave f26-0 (-> obj crate-speed) :to obj) + ) + (+! f28-0 (-> obj dist-apart)) ) - (none) ) + (none) ) ;; failed to figure out what this is: @@ -357,7 +353,7 @@ :virtual #t :code (behavior () (until #f - (when (>= (-> self clock frame-counter) (-> self next-spawn-time)) + (when (>= (current-time) (-> self next-spawn-time)) (process-spawn strip-chain-crate-slave 0 (-> self crate-speed) :to self) (+! (-> self next-spawn-time) (the-as time-frame (-> self spawn-delay))) ) @@ -379,43 +375,38 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (local-vars (sv-16 int)) - (with-pp - (set! (-> obj root) (new 'process 'trsqv)) - (set! (-> obj path) (new 'process 'curve-control obj 'path -1000000000.0)) - (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) - (let ((f28-0 53248.0) - (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))))) - (when v1-8 - (set! f28-0 (-> v1-8 0)) - (set! f26-0 (-> v1-8 1)) - (set! f30-0 (-> v1-8 2)) - ) + (set! (-> obj root) (new 'process 'trsqv)) + (set! (-> obj path) (new 'process 'curve-control obj 'path -1000000000.0)) + (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) + (let ((f28-0 53248.0) + (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))))) + (when v1-8 + (set! f28-0 (-> v1-8 0)) + (set! f26-0 (-> v1-8 1)) + (set! f30-0 (-> v1-8 2)) ) - (set! (-> obj crate-speed) f28-0) - (set! (-> obj dist-apart) f26-0) - (set! (-> obj spawn-delay) (the-as uint (the int (* 300.0 (/ f26-0 f28-0))))) - (set! (-> obj spawn-offset) (the-as uint (the int (* f30-0 (the float (-> obj spawn-delay)))))) ) - (set! (-> obj next-spawn-time) - (+ (-> pp clock frame-counter) - (the-as - time-frame - (- (-> obj spawn-delay) - (mod - (the-as uint (+ (-> pp clock frame-counter) (the-as time-frame (-> obj spawn-offset)))) - (-> obj spawn-delay) - ) - ) - ) - ) - ) - (logclear! (-> obj mask) (process-mask actor-pause)) - (strip-chain-crate-method-21 obj) - (go (method-of-object obj idle)) - (none) + (set! (-> obj crate-speed) f28-0) + (set! (-> obj dist-apart) f26-0) + (set! (-> obj spawn-delay) (the-as uint (the int (* 300.0 (/ f26-0 f28-0))))) + (set! (-> obj spawn-offset) (the-as uint (the int (* f30-0 (the float (-> obj spawn-delay)))))) ) + (set! (-> obj next-spawn-time) + (+ (current-time) + (the-as + time-frame + (- (-> obj spawn-delay) + (mod (the-as uint (+ (current-time) (the-as time-frame (-> obj spawn-offset)))) (-> obj spawn-delay)) + ) + ) + ) + ) + (logclear! (-> obj mask) (process-mask actor-pause)) + (strip-chain-crate-method-21 obj) + (go (method-of-object obj idle)) + (none) ) diff --git a/test/decompiler/reference/jak2/levels/strip/strip-drop_REF.gc b/test/decompiler/reference/jak2/levels/strip/strip-drop_REF.gc index 43b9a99375..84e04ceab3 100644 --- a/test/decompiler/reference/jak2/levels/strip/strip-drop_REF.gc +++ b/test/decompiler/reference/jak2/levels/strip/strip-drop_REF.gc @@ -274,10 +274,10 @@ :trans (the-as (function none :behavior strip-game-crate) rider-trans) :code (the-as (function none :behavior strip-game-crate) sleep-code) :post (behavior () - (let* ((f30-1 (* 333.14133 (cos (* 66.8053 (the float (mod (-> self clock frame-counter) 981)))))) - (f28-1 (* 358.62756 (cos (* 48.65331 (the float (mod (-> self clock frame-counter) 1346)))))) + (let* ((f30-1 (* 333.14133 (cos (* 66.8053 (the float (mod (current-time) 981)))))) + (f28-1 (* 358.62756 (cos (* 48.65331 (the float (mod (current-time) 1346)))))) (f0-6 30.0) - (gp-0 (+ (-> self clock frame-counter) (seconds -15.24))) + (gp-0 (+ (current-time) (seconds -15.24))) (f26-1 (+ 637.1556 (* 637.1556 (cos (* 65536.0 (/ (the float (mod gp-0 (the int (* 300.0 f0-6)))) (* 300.0 f0-6)))))) ) @@ -467,7 +467,7 @@ (none) ) :post (behavior () - (let* ((f0-1 (* 3.640889 (the float (mod (-> self clock frame-counter) #x4650)))) + (let* ((f0-1 (* 3.640889 (the float (mod (current-time) #x4650)))) (f0-5 (+ -16384.0 (* 8192.0 (+ 1.0 (cos f0-1))))) ) (quaternion-rotate-y! (-> self root quat) (-> self init-quat) f0-5) diff --git a/test/decompiler/reference/jak2/levels/strip/strip-obs_REF.gc b/test/decompiler/reference/jak2/levels/strip/strip-obs_REF.gc index 238cb6c161..698e483f1c 100644 --- a/test/decompiler/reference/jak2/levels/strip/strip-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/strip/strip-obs_REF.gc @@ -119,7 +119,7 @@ (set! (-> a1-7 param 1) (the-as uint v1-13)) ) (when (send-event-function gp-0 a1-7) - (set! (-> self no-collision-timer) (the-as uint (-> self clock frame-counter))) + (set! (-> self no-collision-timer) (the-as uint (current-time))) (let ((v1-18 (-> self root-override root-prim))) (set! (-> v1-18 prim-core collide-as) (collide-spec)) (set! (-> v1-18 prim-core collide-with) (collide-spec)) @@ -139,7 +139,7 @@ ;; WARN: Return type mismatch symbol vs none. (defbehavior strip-trans strip-hazard () (when (and (nonzero? (-> self no-collision-timer)) - (>= (- (-> self clock frame-counter) (the-as int (-> self no-collision-timer))) (seconds 0.3)) + (>= (- (current-time) (the-as int (-> self no-collision-timer))) (seconds 0.3)) ) (let ((v1-7 (-> self root-override root-prim))) (set! (-> v1-7 prim-core collide-as) (-> self root-override backup-collide-as)) @@ -878,11 +878,11 @@ This commonly includes things such as: (set-setting! 'entity-name (-> self camera-name) 0.0 -1) ) ) - ((>= (- (-> self clock frame-counter) (-> self enter-time)) (seconds 3)) + ((>= (- (current-time) (-> self enter-time)) (seconds 3)) (talker-speech-class-method-12 (-> *talker-speech* 194) 1) ) ) - (set! (-> self enter-time) (-> self clock frame-counter)) + (set! (-> self enter-time) (current-time)) ) #f ) @@ -903,7 +903,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self lightning-time) (+ (-> self clock frame-counter) -1)) + (set! (-> self lightning-time) (+ (current-time) -1)) (none) ) :exit (behavior () @@ -913,10 +913,8 @@ This commonly includes things such as: :code (the-as (function none :behavior grenade-point) sleep-code) :post (behavior () (spawn (-> self part) (-> self root-override trans)) - (when (< (-> self lightning-time) (-> self clock frame-counter)) - (set! (-> self lightning-time) - (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.6 1.4)))) - ) + (when (< (-> self lightning-time) (current-time)) + (set! (-> self lightning-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.6 1.4))))) (let ((s5-0 (new 'stack-no-clear 'vector))) (set! (-> s5-0 quad) (-> self root-override trans quad)) (let* ((gp-1 (-> self strike-table (-> self last-strike-index))) @@ -1453,7 +1451,7 @@ This commonly includes things such as: (t9-0) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (send-event (handle->process (-> self end-target)) 'die) (remove-setting! 'point-of-interest) (none) @@ -1670,14 +1668,14 @@ This commonly includes things such as: (lambda :behavior task-manager () (local-vars (sv-16 object)) - (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self start-time) (current-time)) (set! (-> self total-time) (seconds 120)) (set! (-> self hud-timer) (ppointer->handle (process-spawn hud-timer :init hud-init-by-other :to *target*))) (set! (-> self hud-counter) (ppointer->handle (process-spawn hud-plasmite :init hud-init-by-other :to self))) - (while (or (< (- (-> self clock frame-counter) (-> self start-time)) (-> self total-time)) + (while (or (< (- (current-time) (-> self start-time)) (-> self total-time)) (and *target* (focus-test? *target* in-air)) ) - (let ((v1-18 (the-as int (- (-> self total-time) (- (-> self clock frame-counter) (-> self start-time)))))) + (let ((v1-18 (the-as int (- (-> self total-time) (- (current-time) (-> self start-time)))))) (if (< (the-as time-frame v1-18) 0) (set! v1-18 0) ) @@ -1714,23 +1712,23 @@ This commonly includes things such as: (set! (-> self count) (the-as int sv-16)) ) (cond - ((and (>= (-> self clock frame-counter) (+ #x80e8 (-> self start-time))) + ((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 (>= (-> self clock frame-counter) (+ (-> self start-time) (seconds 90))) + ((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 (>= (-> self clock frame-counter) (+ (-> self start-time) (seconds 60))) + ((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! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> *game-info* counter) (the float (the-as int sv-16))) (if (>= 1 (the-as int sv-16)) (gui-control-method-12 diff --git a/test/decompiler/reference/jak2/levels/temple/mountain-obs2_REF.gc b/test/decompiler/reference/jak2/levels/temple/mountain-obs2_REF.gc index 211d7a1cd5..fd6e3cbaaf 100644 --- a/test/decompiler/reference/jak2/levels/temple/mountain-obs2_REF.gc +++ b/test/decompiler/reference/jak2/levels/temple/mountain-obs2_REF.gc @@ -268,7 +268,7 @@ For example for an elevator pre-compute the distance between the first and last (vector-normalize! (-> self axe-flip) 1.0) (vector-rotate90-around-y! (-> self axe-flip) (-> self axe-flip)) (set! (-> self angle-flip-vel) -10.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ) ) @@ -318,11 +318,11 @@ For example for an elevator pre-compute the distance between the first and last ) (set! (-> self dest-angle) 180.0) (set! (-> self on-shake) #f) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the int (-> self time-flip))) + (when (>= (- (current-time) (-> self state-time)) (the int (-> self time-flip))) (set! (-> self state-flip) (the-as uint 0)) 0 ) @@ -346,7 +346,7 @@ For example for an elevator pre-compute the distance between the first and last (+! (-> self angle-flip-vel) (* -6.0 (-> self clock seconds-per-frame) (-> self angle-flip-vel))) (+! (-> self angle-flip) (-> self angle-flip-vel)) (quaternion-vector-angle! (-> self root-override quat) (-> self axe-flip) (* 182.04445 (-> self angle-flip))) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the int (+ -300.0 (-> self time-flip)))) + (when (and (>= (- (current-time) (-> self state-time)) (the int (+ -300.0 (-> self time-flip)))) (= 1 (-> self state-flip)) ) (when (not (-> self on-shake)) diff --git a/test/decompiler/reference/jak2/levels/temple/mountain-obs_REF.gc b/test/decompiler/reference/jak2/levels/temple/mountain-obs_REF.gc index b897db570b..76df9d0d57 100644 --- a/test/decompiler/reference/jak2/levels/temple/mountain-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/temple/mountain-obs_REF.gc @@ -412,13 +412,13 @@ ) ) (sound-play "dice-sink") - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () (set! (-> self draw color-mult quad) (-> self color quad)) (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + ((>= (- (current-time) (-> self state-time)) (seconds 0.5)) (+! (-> self speed-anim) (* -0.5 (-> self clock seconds-per-frame) (-> self time-anim))) (+! (-> self speed-anim) (* -6.0 (-> self clock seconds-per-frame) (-> self speed-anim))) (+! (-> self time-anim) (-> self speed-anim)) @@ -430,7 +430,7 @@ (set! (-> self active) (the-as uint 3)) ) ) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (!= (-> self active) 2)) + (when (and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (!= (-> self active) 2)) (set! (-> self active) (the-as uint 2)) (dotimes (gp-0 6) (matrix-rotate-xyz! (-> self face-matrix gp-0) (-> *dice-angle-array* gp-0)) @@ -462,7 +462,7 @@ (+ (-> self face-matrix-back v1-51 trans y) (* 4096.0 (-> self time-anim))) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (when (>= (- (current-time) (-> self state-time)) (seconds 2)) (set! (-> self active) (-> self first)) (go-virtual idle) ) @@ -953,9 +953,9 @@ ) :trans (behavior () (if (nonzero? (-> self curtime)) - (set! (-> self first-touch-time) (-> self clock frame-counter)) + (set! (-> self first-touch-time) (current-time)) ) - (set! (-> self curtime) (-> self clock frame-counter)) + (set! (-> self curtime) (current-time)) (when (and (zero? (-> self active)) (dice-wrong-way?)) ) (none) @@ -1042,7 +1042,7 @@ (set! (-> a0-2 trans quad) t0-1) ) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self time-anim) 1.0) (set! (-> self speed-anim) -0.5) (none) @@ -1064,7 +1064,7 @@ (set! (-> self time-anim) 0.0) (set! (-> self speed-anim) (- (-> self speed-anim))) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.7)) + (if (>= (- (current-time) (-> self state-time)) (seconds 0.7)) (set! (-> self time-anim) 0.0) ) (let ((s4-0 (new 'stack-no-clear 'matrix)) @@ -1086,7 +1086,7 @@ ) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.7)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.7)) (dotimes (v1-34 6) (when (= (-> self face-status v1-34) 1) (set! (-> self face-status v1-34) 0) @@ -1110,7 +1110,7 @@ :enter (behavior () (set! (-> self time-anim) 0.0) (set! (-> self speed-anim) 0.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "dice-sink") (none) ) @@ -1122,7 +1122,7 @@ (dotimes (v1-5 6) (+! (-> self face-matrix v1-5 trans y) (* 4096.0 (-> self time-anim))) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 1)) (dotimes (v1-11 6) (when (= (-> self face-status v1-11) 1) (set! (-> self face-status v1-11) 0) @@ -2107,8 +2107,8 @@ This commonly includes things such as: (suspend) ) (set-setting! 'entity-name "camera-259" 0.0 0) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -2120,8 +2120,8 @@ This commonly includes things such as: (suspend) (ja :num! (seek!)) ) - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 1)) + (let ((gp-1 (current-time))) + (until (>= (- (current-time) gp-1) (seconds 1)) (suspend) ) ) @@ -2843,7 +2843,7 @@ This commonly includes things such as: ) ) :enter (behavior () - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) (get-point-at-percent-along-path! (-> self path) (-> self basetrans) (-> self path-pos) 'interp) (none) ) @@ -2851,9 +2851,9 @@ This commonly includes things such as: (set! (-> self flags) (logand -2 (-> self flags))) (plat-trans) (if (not (logtest? (-> self flags) 1)) - (set! (-> self ride-timer) (-> self clock frame-counter)) + (set! (-> self ride-timer) (current-time)) ) - (let ((v1-10 (and (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 0.5)) + (let ((v1-10 (and (>= (- (current-time) (-> self ride-timer)) (seconds 0.5)) (logtest? (-> self flags) 1) (if (logtest? (-> self flags) 2) (and *target* (process-grab? *target* #f)) @@ -2919,7 +2919,7 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('ridden) - (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (let ((v0-0 (the-as object (current-time)))) (set! (-> self ride-timer) (the-as time-frame v0-0)) v0-0 ) @@ -2931,7 +2931,7 @@ This commonly includes things such as: ) :trans (behavior () (plat-trans) - (when (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 1)) + (when (>= (- (current-time) (-> self ride-timer)) (seconds 1)) (cond ((= (-> self path-pos) 1.0) (set! (-> self dest-pos) 0.0) @@ -3675,7 +3675,7 @@ This commonly includes things such as: :virtual #t :trans (behavior () (plat-trans) - (if (>= (- (-> self clock frame-counter) (-> self ride-timer)) (seconds 1)) + (if (>= (- (current-time) (-> self ride-timer)) (seconds 1)) (go-virtual waiting) ) (none) diff --git a/test/decompiler/reference/jak2/levels/temple/rhino_REF.gc b/test/decompiler/reference/jak2/levels/temple/rhino_REF.gc index 9c7794d861..d907238d5c 100644 --- a/test/decompiler/reference/jak2/levels/temple/rhino_REF.gc +++ b/test/decompiler/reference/jak2/levels/temple/rhino_REF.gc @@ -886,7 +886,7 @@ ) ) (else - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) + (if (and (>= (- (current-time) (-> self state-time)) (-> self state-timeout)) (> (the-as int (-> self focus aware)) 0) ) (go-virtual active) @@ -1325,7 +1325,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior rhino) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-166 self) (let ((v1-4 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-4 enemy-flags))) @@ -1370,7 +1370,7 @@ (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.5)) + (if (>= (- (current-time) (-> self state-time)) (seconds 1.5)) (go-virtual active) ) (none) @@ -1410,7 +1410,7 @@ ) (set! (-> self charge-straight) #f) (nav-enemy-method-166 self) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) (none) ) @@ -1438,7 +1438,7 @@ (vector-! gp-0 s2-0 (-> self root-override2 trans)) (vector-normalize! gp-0 (+ 16384.0 (vector-length gp-0))) (vector+! s4-0 (-> self root-override2 trans) gp-0) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (when (>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (and (< (vector-vector-xz-distance (get-trans (the-as process-focusable s3-0) 0) (-> self root-override2 trans)) 40960.0 ) @@ -1450,7 +1450,7 @@ (cond ((-> self charge-straight) (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + ((>= (- (current-time) (-> self state-time)) (-> self reaction-time)) (if (< (vector-vector-xz-distance (get-trans (the-as process-focusable s3-0) 0) (-> self root-override2 trans)) 20480.0 ) @@ -1467,7 +1467,7 @@ ) ) ((and (< f28-0 8192.0) - (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) (>= 9.0 (ja-frame-num 0))) + (and (>= (- (current-time) (-> self state-time)) (seconds 2)) (>= 9.0 (ja-frame-num 0))) ) (go-virtual stop-run) ) @@ -1752,7 +1752,7 @@ :enter (behavior () (set-setting! 'sound-mode #f 0.0 1) (set-setting! 'sound-excitement 'abs 0.0 0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (nav-enemy-method-166 self) (let ((v1-8 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-8 enemy-flags))) diff --git a/test/decompiler/reference/jak2/levels/title/title-obs_REF.gc b/test/decompiler/reference/jak2/levels/title/title-obs_REF.gc index 7d63085be3..a3230e8688 100644 --- a/test/decompiler/reference/jak2/levels/title/title-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/title/title-obs_REF.gc @@ -507,24 +507,21 @@ ;; definition for function wait-for-press (defun wait-for-press ((arg0 time-frame) (arg1 time-frame) (arg2 symbol)) - (with-pp - (let ((s3-0 (-> pp clock frame-counter)) - (s4-0 #f) - ) - (while (not (or (>= (- (-> pp clock frame-counter) s3-0) arg1) (and (>= (- (-> pp clock frame-counter) s3-0) arg0) s4-0)) - ) - (if (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) - (set! s4-0 #t) - ) - (when (cpad-pressed? 0 triangle) - (set! s4-0 'abort) - (goto cfg-14) - ) - (suspend) + (let ((s3-0 (current-time)) + (s4-0 #f) ) - (label cfg-14) - s4-0 + (while (not (or (>= (- (current-time) s3-0) arg1) (and (>= (- (current-time) s3-0) arg0) s4-0))) + (if (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0)) + (set! s4-0 #t) + ) + (when (cpad-pressed? 0 triangle) + (set! s4-0 'abort) + (goto cfg-14) + ) + (suspend) ) + (label cfg-14) + s4-0 ) ) @@ -559,7 +556,7 @@ (return (the-as object (-> self selected))) ) ) - (when (< (mod (-> self clock frame-counter) 300) 210) + (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)) ) @@ -597,28 +594,26 @@ ;; definition for function title-fade-out ;; WARN: Return type mismatch int vs none. (defun title-fade-out ((arg0 float)) - (with-pp - (setup *screen-filter* (new 'static 'vector) (new 'static 'vector :w 128.0) arg0 (bucket-id screen-filter)) - (let ((gp-0 (-> pp clock frame-counter))) - (until (>= (- (-> pp clock frame-counter) gp-0) (seconds 0.4)) - (suspend) - ) - ) - (send-event (ppointer->process (-> *setting-control* user-current movie)) 'abort) - (set! (-> *setting-control* user-current bg-a) 0.0) - (while (or (-> *setting-control* user-current movie) - (not *target*) - (not (and (-> *target* next-state) (= (-> *target* next-state name) 'target-title))) - (!= (-> *setting-control* user-current bg-a) 0.0) - ) + (setup *screen-filter* (new 'static 'vector) (new 'static 'vector :w 128.0) arg0 (bucket-id screen-filter)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 0.4)) (suspend) ) - (set! (-> *game-info* blackout-time) 0) - (set! (-> *setting-control* user-current bg-a-force) 0.0) - (disable *screen-filter*) - 0 - (none) ) + (send-event (ppointer->process (-> *setting-control* user-current movie)) 'abort) + (set! (-> *setting-control* user-current bg-a) 0.0) + (while (or (-> *setting-control* user-current movie) + (not *target*) + (not (and (-> *target* next-state) (= (-> *target* next-state name) 'target-title))) + (!= (-> *setting-control* user-current bg-a) 0.0) + ) + (suspend) + ) + (set! (-> *game-info* blackout-time) 0) + (set! (-> *setting-control* user-current bg-a-force) 0.0) + (disable *screen-filter*) + 0 + (none) ) ;; definition for function title-progress diff --git a/test/decompiler/reference/jak2/levels/undefined/ruf-states_REF.gc b/test/decompiler/reference/jak2/levels/undefined/ruf-states_REF.gc index 844617d173..ff26efdcb7 100644 --- a/test/decompiler/reference/jak2/levels/undefined/ruf-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/undefined/ruf-states_REF.gc @@ -6,7 +6,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -53,7 +53,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -100,7 +100,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -144,7 +144,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -193,7 +193,7 @@ :enter (-> (method-of-type ruffian scared-idle) enter) :trans (behavior () (bot-method-223 self #t) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (cond ((not (bot-method-214 self)) (react-to-focus self) @@ -220,7 +220,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -257,7 +257,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) @@ -284,12 +284,10 @@ ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) (ruffian-method-240 self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + ((and (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) (go-virtual traveling-blocked) ) - ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) - ) + ((and (nav-enemy-method-163 self) (>= (- (current-time) (-> self state-time)) (-> self reaction-time))) (go-stare2 self) ) ) @@ -323,7 +321,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) @@ -344,7 +342,7 @@ ((bot-method-214 self) (go-hostile self) ) - ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + ((and (>= (- (current-time) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) (go-virtual traveling) ) ) @@ -372,7 +370,7 @@ ) :trans (behavior () (bot-method-223 self #f) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (if (bot-method-214 self) (go-hostile self) ) @@ -520,7 +518,7 @@ (t9-0) ) ) - (when (and (logtest? (bot-flags bf24) (-> self bot-flags)) (!= (-> self state-time) (-> self clock frame-counter))) + (when (and (logtest? (bot-flags bf24) (-> self bot-flags)) (!= (-> self state-time) (current-time))) (logclear! (-> self bot-flags) (bot-flags bf24)) (ruffian-method-242 self) ) @@ -562,7 +560,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior ruffian) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) diff --git a/test/decompiler/reference/jak2/levels/underport/centipede_REF.gc b/test/decompiler/reference/jak2/levels/underport/centipede_REF.gc index fbfd69fa28..ff1da64a75 100644 --- a/test/decompiler/reference/jak2/levels/underport/centipede_REF.gc +++ b/test/decompiler/reference/jak2/levels/underport/centipede_REF.gc @@ -270,15 +270,14 @@ (set! (-> centipede-cam dir y) 0.0) (vector-normalize! (-> centipede-cam dir) 1.0) (set! (-> centipede-cam trans quad) (-> obj root-override2 trans quad)) - (set! (-> centipede-cam trans y) - (+ 32768.0 - (* (+ (* 2048.0 (cos (* 218.45334 (the float (mod (-> pp clock frame-counter) 300))))) - (* 614.4 (cos (* 68.91272 (the float (mod (-> pp clock frame-counter) 951))))) - ) - (-> obj bobbing-intensity) - ) - (-> centipede-cam trans y) - ) + (set! (-> centipede-cam trans y) (+ 32768.0 + (* (+ (* 2048.0 (cos (* 218.45334 (the float (mod (current-time) 300))))) + (* 614.4 (cos (* 68.91272 (the float (mod (current-time) 951))))) + ) + (-> obj bobbing-intensity) + ) + (-> centipede-cam trans y) + ) ) (if (= (-> obj id) 1) (set! (-> centipede-cam dir y) -0.574) @@ -655,7 +654,7 @@ (quaternion-copy! (-> obj bobbing quat) (-> obj root-override2 quat)) (set! (-> obj bobbing trans quad) (-> obj root-override2 trans quad)) (let ((s5-0 (new 'stack-no-clear 'vector)) - (f30-1 (* 2662.4 (cos (* 283.70563 (the float (mod (-> pp clock frame-counter) 231)))))) + (f30-1 (* 2662.4 (cos (* 283.70563 (the float (mod (current-time) 231)))))) (bob-trans (-> obj bobbing trans)) ) (vector-z-quaternion! s5-0 (-> obj root-override2 quat)) @@ -917,10 +916,10 @@ (until #f (cond (*target* - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) (else - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (when (>= (- (current-time) (-> self state-time)) (seconds 2)) (cleanup-for-death self) (go-virtual die-fast) ) @@ -1015,7 +1014,7 @@ (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (let ((v1-6 (handle->process (-> self focus handle)))) (if (or (not v1-6) (focus-test? (the-as process-focusable v1-6) dead)) (go-virtual stop-chase) @@ -1077,7 +1076,7 @@ (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2)) (react-to-focus self) ) (none) @@ -1251,10 +1250,10 @@ (none) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (set! (-> self desired-talking-volume) 1.0) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.35)) - (let* ((v1-5 (- (-> self clock frame-counter) (-> self state-time))) + (while (< (- (current-time) (-> self state-time)) (seconds 0.35)) + (let* ((v1-5 (- (current-time) (-> self state-time))) (f1-2 (* 0.00952381 (the float v1-5))) ) (quaternion-slerp! (-> self root-override2 quat) (-> self src-quat) (-> self dest-quat) (- 1.0 (* f1-2 f1-2))) @@ -1262,7 +1261,7 @@ (centipede-method-188 self) (suspend) ) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (while (< (- (current-time) (-> self state-time)) (seconds 1)) (centipede-method-188 self) (suspend) ) diff --git a/test/decompiler/reference/jak2/levels/underport/jellyfish_REF.gc b/test/decompiler/reference/jak2/levels/underport/jellyfish_REF.gc index b89d9313b4..f79a27e87a 100644 --- a/test/decompiler/reference/jak2/levels/underport/jellyfish_REF.gc +++ b/test/decompiler/reference/jak2/levels/underport/jellyfish_REF.gc @@ -467,7 +467,7 @@ (v1-6 (jellyfish-method-161 self (new 'stack-no-clear 'vector) - (get-norm! (-> self sync) (the-as int (+ (-> self clock frame-counter) (seconds 1)))) + (get-norm! (-> self sync) (the-as int (+ (current-time) (seconds 1)))) ) ) (s5-2 (new 'stack-no-clear 'vector)) @@ -542,7 +542,7 @@ :trans (behavior () (local-vars (gp-0 vector)) (seek! (-> self tentacle-blend) 1.0 (-> self clock seconds-per-frame)) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((v1-4 (-> self focus aware))) (cond ((>= 1 (the-as int v1-4)) @@ -553,13 +553,13 @@ ) ) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (and (>= (- (current-time) (-> self state-time)) (seconds 2)) (not (jellyfish-method-164 self (the-as process-focusable #f))) ) (go-virtual active) ) (if (and (not *jellyfish-mech-reserved*) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (>= (- (current-time) (-> self state-time)) (seconds 1)) (jellyfish-method-163 self (the-as process-focusable #f)) (begin (set! gp-0 (jellyfish-method-161 self (new 'stack-no-clear 'vector) (-> self path-stare-u))) @@ -651,7 +651,7 @@ (the-as vector #t) ) (logior! (-> self focus-status) (focus-status dangerous)) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :exit (behavior () @@ -766,7 +766,7 @@ (let ((gp-0 *target*)) (cond ((not (jellyfish-method-163 self gp-0)) - (set! (-> self last-attack-time) (-> self clock frame-counter)) + (set! (-> self last-attack-time) (current-time)) (go-virtual active) ) (else @@ -886,7 +886,7 @@ (suspend) (ja :num! (seek!)) ) - (set! (-> self last-attack-time) (-> self clock frame-counter)) + (set! (-> self last-attack-time) (current-time)) (go-virtual active) (none) ) @@ -916,7 +916,7 @@ (dispose! self) (logclear! (-> self focus-status) (focus-status dangerous)) (enemy-method-52 self (-> self root-override2 transv)) - (let ((gp-0 (-> self clock frame-counter))) + (let ((gp-0 (current-time))) (ja-no-eval :group! jellyfish-die-ja :num! (seek! (the float (+ (-> (the-as art-joint-anim jellyfish-die-ja) frames num-frames) -1))) :frame-num 0.0 @@ -926,7 +926,7 @@ (f0-4 (ja-aframe-num 0)) ) (when (and (= s5-0 jellyfish-die-ja) (>= f0-4 0.0) (>= 0.5 f0-4)) - (when (>= (- (-> self clock frame-counter) gp-0) (seconds 0.05)) + (when (>= (- (current-time) gp-0) (seconds 0.05)) (process-drawable-shock-skel-effect self (-> *lightning-spec-id-table* 5) @@ -936,7 +936,7 @@ -1 -1 ) - (set! gp-0 (-> self clock frame-counter)) + (set! gp-0 (current-time)) ) ) ) @@ -1394,168 +1394,166 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy! jellyfish ((obj jellyfish)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (with-pp - (hover-enemy-method-149 obj) - (init-enemy-behaviour-and-stats! obj (hover-enemy-method-150 obj)) - (hover-enemy-method-155 obj) - (set-vector! (-> obj offset) 0.0 6144.0 61440.0 1.0) - (set! (-> obj knocked-fall-dist) 0.0) - (let ((v1-8 (-> obj neck))) - (set! (-> v1-8 up) (the-as uint 1)) - (set! (-> v1-8 nose) (the-as uint 2)) - (set! (-> v1-8 ear) (the-as uint 0)) - (set! (-> v1-8 twist-speed-x) 0.05) - (set! (-> v1-8 twist-speed-y) 0.06) - (set! (-> v1-8 max-dist) 122880.0) - ) - (set! (-> obj root-override2 dynam gravity y) 40960.0) - (set! (-> obj root-override2 dynam gravity-length) 40960.0) - (set! (-> obj root-override2 dynam gravity-max) 40960.0) - (logclear! (-> obj mask) (process-mask actor-pause)) - (logclear! (-> obj enemy-flags) (enemy-flag notice)) - (new-source! (-> obj los) obj (seconds 1) (collide-spec backgnd enemy obstacle hit-by-others-list)) - (set! (-> obj last-fire-time) (-> pp clock frame-counter)) - (set! (-> obj last-attack-time) 0) - (set! (-> obj sound-id) (the-as uint (new-sound-id))) - (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) - (set! (-> obj path-player-u) 0.0) - (set! (-> obj path-my-u) 0.0) - (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) - (set! (-> obj path-y-offset) (res-lump-float (-> obj entity) 'y-offset)) - (let ((a1-4 (new 'stack-no-clear 'sync-info-params))) - (let ((v1-32 0)) - (if #t - (set! v1-32 (logior v1-32 1)) - ) - (set! (-> a1-4 sync-type) 'sync-eased) - (set! (-> a1-4 sync-flags) (the-as sync-flags v1-32)) - ) - (set! (-> a1-4 period) (the-as uint 6000)) - (set! (-> a1-4 entity) (-> obj entity)) - (set! (-> a1-4 percent) 0.0) - (set! (-> a1-4 ease-in) 0.15) - (set! (-> a1-4 ease-out) 0.15) - (set! (-> a1-4 pause-in) 0.0) - (set! (-> a1-4 pause-out) 0.0) - (initialize! (-> obj sync) a1-4) - ) - (add-connection - *part-engine* - obj - 36 - obj - 318 - (new 'static 'vector :x 1187.84 :y -3112.96 :z 1392.64 :w 163840.0) - ) - (add-connection - *part-engine* - obj - 36 - obj - 318 - (new 'static 'vector :x -1187.84 :y -3112.96 :z 1392.64 :w 163840.0) - ) - (add-connection *part-engine* obj 36 obj 743 (new 'static 'vector :y 1433.6 :z 1228.8 :w 163840.0)) - (dotimes (s5-1 5) - (set! (-> obj tentacles s5-1) (new 'process 'jellyfish-chain-physics)) - ) - (chain-physics-initialize obj (-> obj tentacles 0) 10 4096.0 *jellyfish-mainvein-chain-setup*) - (chain-physics-initialize obj (-> obj tentacles 1) 16 4096.0 *jellyfish-lfront-chain-setup*) - (chain-physics-initialize obj (-> obj tentacles 2) 21 4096.0 *jellyfish-rfront-chain-setup*) - (chain-physics-initialize obj (-> obj tentacles 3) 26 4096.0 *jellyfish-lrear-chain-setup*) - (chain-physics-initialize obj (-> obj tentacles 4) 31 4096.0 *jellyfish-rrear-chain-setup*) - (set! (-> obj tentacles 2 negate-y) #t) - (set! (-> obj tentacles 4 negate-y) #t) - (let ((a0-35 (-> obj skel root-channel 0))) - (set! (-> a0-35 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) - (set! (-> a0-35 frame-num) 0.0) - (joint-control-channel-group! a0-35 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-identity) - ) - (ja-post) - (dotimes (s5-2 5) - (initialize-chain-joints (-> obj tentacles s5-2)) - ) - (let ((a1-15 (-> obj node-list data 16)) - (v1-68 - (new 'static 'jellyfish-joint-mod-tentacle-info - :axis (new 'static 'vector :z 1.0 :w 1.0) - :angle 3094.7556 - :offset 30.0 - ) - ) - ) - (set! (-> a1-15 param0) jellyfish-joint-mod-tentacle) - (set! (-> a1-15 param1) obj) - (set! (-> a1-15 param2) (the-as basic v1-68)) - ) - (let ((a1-16 (-> obj node-list data 21)) - (v1-70 - (new 'static 'jellyfish-joint-mod-tentacle-info - :axis (new 'static 'vector :z 1.0 :w 1.0) - :angle 3094.7556 - :offset 30.0 - ) - ) - ) - (set! (-> a1-16 param0) jellyfish-joint-mod-tentacle) - (set! (-> a1-16 param1) obj) - (set! (-> a1-16 param2) (the-as basic v1-70)) - ) - (let ((a1-17 (-> obj node-list data 26)) - (v1-72 - (new 'static 'jellyfish-joint-mod-tentacle-info - :axis (new 'static 'vector :z 1.0 :w 1.0) - :angle 4369.067 - :offset 45.0 - ) - ) - ) - (set! (-> a1-17 param0) jellyfish-joint-mod-tentacle) - (set! (-> a1-17 param1) obj) - (set! (-> a1-17 param2) (the-as basic v1-72)) - ) - (let ((a1-18 (-> obj node-list data 31)) - (v1-74 - (new 'static 'jellyfish-joint-mod-tentacle-info - :axis (new 'static 'vector :z 1.0 :w 1.0) - :angle 4369.067 - :offset 45.0 - ) - ) - ) - (set! (-> a1-18 param0) jellyfish-joint-mod-tentacle) - (set! (-> a1-18 param1) obj) - (set! (-> a1-18 param2) (the-as basic v1-74)) - ) - (let ((a1-19 (-> obj node-list data 10)) - (v1-76 - (new 'static 'jellyfish-joint-mod-tentacle-info :axis (new 'static 'vector :x 1.0 :w 1.0) :angle 2730.6667) - ) - ) - (set! (-> a1-19 param0) jellyfish-joint-mod-tentacle) - (set! (-> a1-19 param1) obj) - (set! (-> a1-19 param2) (the-as basic v1-76)) - ) - (set! (-> obj tentacles-initialized) #f) - (set! (-> obj tentacle-clock) 0.0) - (set! (-> obj tentacle-blend) 1.0) - (add-connection - *part-engine* - obj - 36 - obj - 318 - (new 'static 'vector :x 1966.08 :y -1843.2 :z 2129.92 :w 163840.0) - ) - (add-connection - *part-engine* - obj - 36 - obj - 318 - (new 'static 'vector :x -1966.08 :y -1843.2 :z 2129.92 :w 163840.0) - ) - 0 - (none) + (hover-enemy-method-149 obj) + (init-enemy-behaviour-and-stats! obj (hover-enemy-method-150 obj)) + (hover-enemy-method-155 obj) + (set-vector! (-> obj offset) 0.0 6144.0 61440.0 1.0) + (set! (-> obj knocked-fall-dist) 0.0) + (let ((v1-8 (-> obj neck))) + (set! (-> v1-8 up) (the-as uint 1)) + (set! (-> v1-8 nose) (the-as uint 2)) + (set! (-> v1-8 ear) (the-as uint 0)) + (set! (-> v1-8 twist-speed-x) 0.05) + (set! (-> v1-8 twist-speed-y) 0.06) + (set! (-> v1-8 max-dist) 122880.0) ) + (set! (-> obj root-override2 dynam gravity y) 40960.0) + (set! (-> obj root-override2 dynam gravity-length) 40960.0) + (set! (-> obj root-override2 dynam gravity-max) 40960.0) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj enemy-flags) (enemy-flag notice)) + (new-source! (-> obj los) obj (seconds 1) (collide-spec backgnd enemy obstacle hit-by-others-list)) + (set! (-> obj last-fire-time) (current-time)) + (set! (-> obj last-attack-time) 0) + (set! (-> obj sound-id) (the-as uint (new-sound-id))) + (set! (-> obj path) (new 'process 'path-control obj 'path 0.0 (-> obj entity) #f)) + (set! (-> obj path-player-u) 0.0) + (set! (-> obj path-my-u) 0.0) + (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) + (set! (-> obj path-y-offset) (res-lump-float (-> obj entity) 'y-offset)) + (let ((a1-4 (new 'stack-no-clear 'sync-info-params))) + (let ((v1-32 0)) + (if #t + (set! v1-32 (logior v1-32 1)) + ) + (set! (-> a1-4 sync-type) 'sync-eased) + (set! (-> a1-4 sync-flags) (the-as sync-flags v1-32)) + ) + (set! (-> a1-4 period) (the-as uint 6000)) + (set! (-> a1-4 entity) (-> obj entity)) + (set! (-> a1-4 percent) 0.0) + (set! (-> a1-4 ease-in) 0.15) + (set! (-> a1-4 ease-out) 0.15) + (set! (-> a1-4 pause-in) 0.0) + (set! (-> a1-4 pause-out) 0.0) + (initialize! (-> obj sync) a1-4) + ) + (add-connection + *part-engine* + obj + 36 + obj + 318 + (new 'static 'vector :x 1187.84 :y -3112.96 :z 1392.64 :w 163840.0) + ) + (add-connection + *part-engine* + obj + 36 + obj + 318 + (new 'static 'vector :x -1187.84 :y -3112.96 :z 1392.64 :w 163840.0) + ) + (add-connection *part-engine* obj 36 obj 743 (new 'static 'vector :y 1433.6 :z 1228.8 :w 163840.0)) + (dotimes (s5-1 5) + (set! (-> obj tentacles s5-1) (new 'process 'jellyfish-chain-physics)) + ) + (chain-physics-initialize obj (-> obj tentacles 0) 10 4096.0 *jellyfish-mainvein-chain-setup*) + (chain-physics-initialize obj (-> obj tentacles 1) 16 4096.0 *jellyfish-lfront-chain-setup*) + (chain-physics-initialize obj (-> obj tentacles 2) 21 4096.0 *jellyfish-rfront-chain-setup*) + (chain-physics-initialize obj (-> obj tentacles 3) 26 4096.0 *jellyfish-lrear-chain-setup*) + (chain-physics-initialize obj (-> obj tentacles 4) 31 4096.0 *jellyfish-rrear-chain-setup*) + (set! (-> obj tentacles 2 negate-y) #t) + (set! (-> obj tentacles 4 negate-y) #t) + (let ((a0-35 (-> obj skel root-channel 0))) + (set! (-> a0-35 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-35 frame-num) 0.0) + (joint-control-channel-group! a0-35 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-identity) + ) + (ja-post) + (dotimes (s5-2 5) + (initialize-chain-joints (-> obj tentacles s5-2)) + ) + (let ((a1-15 (-> obj node-list data 16)) + (v1-68 + (new 'static 'jellyfish-joint-mod-tentacle-info + :axis (new 'static 'vector :z 1.0 :w 1.0) + :angle 3094.7556 + :offset 30.0 + ) + ) + ) + (set! (-> a1-15 param0) jellyfish-joint-mod-tentacle) + (set! (-> a1-15 param1) obj) + (set! (-> a1-15 param2) (the-as basic v1-68)) + ) + (let ((a1-16 (-> obj node-list data 21)) + (v1-70 + (new 'static 'jellyfish-joint-mod-tentacle-info + :axis (new 'static 'vector :z 1.0 :w 1.0) + :angle 3094.7556 + :offset 30.0 + ) + ) + ) + (set! (-> a1-16 param0) jellyfish-joint-mod-tentacle) + (set! (-> a1-16 param1) obj) + (set! (-> a1-16 param2) (the-as basic v1-70)) + ) + (let ((a1-17 (-> obj node-list data 26)) + (v1-72 + (new 'static 'jellyfish-joint-mod-tentacle-info + :axis (new 'static 'vector :z 1.0 :w 1.0) + :angle 4369.067 + :offset 45.0 + ) + ) + ) + (set! (-> a1-17 param0) jellyfish-joint-mod-tentacle) + (set! (-> a1-17 param1) obj) + (set! (-> a1-17 param2) (the-as basic v1-72)) + ) + (let ((a1-18 (-> obj node-list data 31)) + (v1-74 + (new 'static 'jellyfish-joint-mod-tentacle-info + :axis (new 'static 'vector :z 1.0 :w 1.0) + :angle 4369.067 + :offset 45.0 + ) + ) + ) + (set! (-> a1-18 param0) jellyfish-joint-mod-tentacle) + (set! (-> a1-18 param1) obj) + (set! (-> a1-18 param2) (the-as basic v1-74)) + ) + (let ((a1-19 (-> obj node-list data 10)) + (v1-76 + (new 'static 'jellyfish-joint-mod-tentacle-info :axis (new 'static 'vector :x 1.0 :w 1.0) :angle 2730.6667) + ) + ) + (set! (-> a1-19 param0) jellyfish-joint-mod-tentacle) + (set! (-> a1-19 param1) obj) + (set! (-> a1-19 param2) (the-as basic v1-76)) + ) + (set! (-> obj tentacles-initialized) #f) + (set! (-> obj tentacle-clock) 0.0) + (set! (-> obj tentacle-blend) 1.0) + (add-connection + *part-engine* + obj + 36 + obj + 318 + (new 'static 'vector :x 1966.08 :y -1843.2 :z 2129.92 :w 163840.0) + ) + (add-connection + *part-engine* + obj + 36 + obj + 318 + (new 'static 'vector :x -1966.08 :y -1843.2 :z 2129.92 :w 163840.0) + ) + 0 + (none) ) diff --git a/test/decompiler/reference/jak2/levels/underport/pipe-grunt_REF.gc b/test/decompiler/reference/jak2/levels/underport/pipe-grunt_REF.gc index 91052e7ff5..a39f5047f7 100644 --- a/test/decompiler/reference/jak2/levels/underport/pipe-grunt_REF.gc +++ b/test/decompiler/reference/jak2/levels/underport/pipe-grunt_REF.gc @@ -62,7 +62,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior pipe-grunt) enemy-event-handler) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logior! (-> self enemy-flags) (enemy-flag chase-startup)) (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice alert victory)) (let ((v1-7 (-> self root-override2 root-prim))) @@ -125,7 +125,3 @@ ) :post (the-as (function none :behavior pipe-grunt) nav-enemy-simple-post) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/underport/sig5-course_REF.gc b/test/decompiler/reference/jak2/levels/underport/sig5-course_REF.gc index 79ba3cc7ac..1ab6a80b60 100644 --- a/test/decompiler/reference/jak2/levels/underport/sig5-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/underport/sig5-course_REF.gc @@ -79,29 +79,27 @@ ;; definition for method 263 of type sig-under ;; WARN: Return type mismatch time-frame vs none. (defmethod sig-under-method-263 sig-under ((obj sig-under)) - (with-pp - (let ((s5-0 (-> pp clock frame-counter))) - (when (and (>= s5-0 (-> obj next-chase-play-time)) - (not (channel-active? obj (the-as uint 0))) - (>= (the-as int (sig-method-256 obj)) 750) - ) - (let ((a1-2 (bot-speech-list-method-9 - (-> obj sig5-course chase-speeches) - obj - (-> obj sig5-course speeches) - (speech-flags) - ) + (let ((s5-0 (current-time))) + (when (and (>= s5-0 (-> obj next-chase-play-time)) + (not (channel-active? obj (the-as uint 0))) + (>= (the-as int (sig-method-256 obj)) 750) + ) + (let ((a1-2 (bot-speech-list-method-9 + (-> obj sig5-course chase-speeches) + obj + (-> obj sig5-course speeches) + (speech-flags) ) - ) - (when (>= a1-2 0) - (play-speech obj a1-2) - (set! (-> obj next-chase-play-time) (+ s5-0 (get-rand-int-range obj 1500 2700))) + ) ) + (when (>= a1-2 0) + (play-speech obj a1-2) + (set! (-> obj next-chase-play-time) (+ s5-0 (get-rand-int-range obj 1500 2700))) ) ) ) - (none) ) + (none) ) ;; definition for method 195 of type sig-under @@ -482,16 +480,16 @@ (ja-eval) ) (when #t - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self bot-flags) (bot-flags bf18)) - (let ((gp-3 (+ (-> self clock frame-counter) (get-rand-int-range self 30 600)))) + (let ((gp-3 (+ (current-time) (get-rand-int-range self 30 600)))) (ja-channel-push! 1 (seconds 0.5)) (ja-no-eval :group! (-> self draw art-group data 7) :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 7)) frames num-frames) -1))) :frame-num 0.0 ) (until (ja-done? 0) - (if (>= (-> self clock frame-counter) gp-3) + (if (>= (current-time) gp-3) (goto cfg-27) ) (suspend) @@ -604,27 +602,25 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (if (not (and (logtest? (-> arg1 bot-task-bits) 1) - *target* - (not (logtest? (-> *target* focus-status) (focus-status dead in-air edge-grab))) - ) - ) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - (when (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.1)) - (task-node-open? (game-task-node under-sig-introduction)) - (scene-play arg1 "under-find-sig-res" #f) - ) - (process-entity-status! arg1 (entity-perm-status no-kill) #t) - (countdown (s5-0 2) - (send-event (handle->process (-> arg1 growls s5-0)) 'die-fast) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 2 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t + (if (not (and (logtest? (-> arg1 bot-task-bits) 1) + *target* + (not (logtest? (-> *target* focus-status) (focus-status dead in-air edge-grab))) + ) + ) + (set! (-> arg1 waypoint-time0) (current-time)) ) + (when (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.1)) + (task-node-open? (game-task-node under-sig-introduction)) + (scene-play arg1 "under-find-sig-res" #f) + ) + (process-entity-status! arg1 (entity-perm-status no-kill) #t) + (countdown (s5-0 2) + (send-event (handle->process (-> arg1 growls s5-0)) 'die-fast) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 2 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) @@ -917,48 +913,46 @@ :nav-mesh-index 2 :skip-to -1 :on-set (lambda ((arg0 sig-under)) - (with-pp - (set! (-> arg0 next-chase-play-time) (+ (-> pp clock frame-counter) (get-rand-int-range arg0 900 1500))) - (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-centipede-two" -99.0 0) - (let* ((v1-7 (-> arg0 sig5-course spots)) - (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)) - ) - (set! (-> arg0 test-plane y) 0.0) - (vector-normalize! (-> arg0 test-plane) 1.0) - (set! (-> arg0 test-plane w) - (- (+ (* (-> s5-1 center x) (-> arg0 test-plane x)) (* (-> s5-1 center z) (-> arg0 test-plane z)))) - ) + (set! (-> arg0 next-chase-play-time) (+ (current-time) (get-rand-int-range arg0 900 1500))) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-centipede-two" -99.0 0) + (let* ((v1-7 (-> arg0 sig5-course spots)) + (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)) ) - (let ((v1-11 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) - (set! (-> v1-11 bytes 5) 1) - (set! (-> v1-11 bytes 6) 10) - (set! (-> v1-11 bytes 4) -1) - (set! (-> (the-as sigt-wait-spot v1-11) check-done) - (the-as - (function sigt-wait-spot sig symbol) - (lambda ((arg0 object) (arg1 sig-under)) - (sig-under-method-263 arg1) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (set! (-> s5-0 quad) (-> (target-pos 0) quad)) - (set! (-> s5-0 y) 0.0) - (when (and (>= (vector4-dot (the-as vector (-> arg1 test-plane)) s5-0) 0.0) - (scene-play arg1 "under-centipede-two" #f) - ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 11 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + (set! (-> arg0 test-plane y) 0.0) + (vector-normalize! (-> arg0 test-plane) 1.0) + (set! (-> arg0 test-plane w) + (- (+ (* (-> s5-1 center x) (-> arg0 test-plane x)) (* (-> s5-1 center z) (-> arg0 test-plane z)))) + ) + ) + (let ((v1-11 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-11 bytes 5) 1) + (set! (-> v1-11 bytes 6) 10) + (set! (-> v1-11 bytes 4) -1) + (set! (-> (the-as sigt-wait-spot v1-11) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (sig-under-method-263 arg1) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> (target-pos 0) quad)) + (set! (-> s5-0 y) 0.0) + (when (and (>= (vector4-dot (the-as vector (-> arg1 test-plane)) s5-0) 0.0) + (scene-play arg1 "under-centipede-two" #f) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 11 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) ) - ) - (none) + ) ) + (none) ) :on-update #f :on-skipping-here #f @@ -1011,16 +1005,13 @@ (set! (-> (the-as sigt-wait-spot v1-15) check-done) (the-as (function sigt-wait-spot sig symbol) - (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.8)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 13 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - ) - ) + (lambda ((arg0 object) (arg1 sig-under)) (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.8)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 13 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) ) ) ) @@ -1149,16 +1140,14 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (if (sig-under-method-261 arg1 (-> arg1 test-plane) (target-pos 0) #t) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 16 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t + (if (sig-under-method-261 arg1 (-> arg1 test-plane) (target-pos 0) #t) + (set! (-> arg1 waypoint-time0) (current-time)) ) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 16 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) @@ -1273,7 +1262,7 @@ ) ) ) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.7)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.7)) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) (go-to-waypoint! arg1 20 #f) (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) @@ -1306,13 +1295,11 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) (+ (-> pp clock frame-counter) (seconds -6))) - (logior! (-> arg1 waypoint-bits) 1) - (set-setting! 'music 'danger3 0.0 0) - ) - #f + (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) (+ (current-time) (seconds -6))) + (logior! (-> arg1 waypoint-bits) 1) + (set-setting! 'music 'danger3 0.0 0) ) + #f ) ) ) @@ -1404,38 +1391,36 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (if (and (not (speech-playing? arg1 12)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.5)) - (not (channel-active? arg1 (the-as uint 0))) - ) - (play-speech arg1 12) - ) - (cond - ((not (logtest? (-> arg1 waypoint-bits) 1)) - (logior! (-> arg1 waypoint-bits) 1) - (process-release? arg1) - (sig-under-method-260 arg1) - (move-to-point! (-> arg1 root-override2) (the-as vector (-> arg1 sig5-course spots 20))) - #f + (if (and (not (speech-playing? arg1 12)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1.5)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 12) + ) + (cond + ((not (logtest? (-> arg1 waypoint-bits) 1)) + (logior! (-> arg1 waypoint-bits) 1) + (process-release? arg1) + (sig-under-method-260 arg1) + (move-to-point! (-> arg1 root-override2) (the-as vector (-> arg1 sig5-course spots 20))) + #f + ) + ((not (logtest? (-> arg1 waypoint-bits) 2)) + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2)) + (remove-setting! 'entity-name) + (logior! (-> arg1 waypoint-bits) 2) + (add-process *gui-control* arg1 (gui-channel art-load) (gui-action queue) "under-centipede-three" -99.0 0) ) - ((not (logtest? (-> arg1 waypoint-bits) 2)) - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) - (remove-setting! 'entity-name) - (logior! (-> arg1 waypoint-bits) 2) - (add-process *gui-control* arg1 (gui-channel art-load) (gui-action queue) "under-centipede-three" -99.0 0) - ) - #f - ) - (else - (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2.5)) - (process-release? *target*) - (reset-warn-time! arg1) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 22 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + #f + ) + (else + (when (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 2.5)) + (process-release? *target*) + (reset-warn-time! arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 22 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) @@ -1498,7 +1483,7 @@ ) (let ((s5-0 (new 'stack-no-clear 'vector))) (set! v1-14 - (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.25)) + (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.25)) (begin (set! (-> s5-0 quad) (-> (target-pos 0) quad)) (set! (-> s5-0 y) 0.0) @@ -1609,63 +1594,59 @@ :nav-mesh-index #x7 :skip-to -1 :on-set (lambda ((arg0 sig-under)) - (with-pp - (set! (-> arg0 next-chase-play-time) (+ (-> pp clock frame-counter) (get-rand-int-range arg0 600 1200))) - (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-get-sig-out-res" -99.0 0) - (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) - (set! (-> v1-7 bytes 5) 1) - (set! (-> v1-7 bytes 6) 26) - (set! (-> v1-7 bytes 4) -1) - (set! (-> (the-as sigt-wait-spot v1-7) check-done) - (the-as - (function sigt-wait-spot sig symbol) - (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (when (sig-under-method-264 arg1) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 27 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) - ) - (sig-under-method-263 arg1) - (when (and (>= (- (-> pp clock frame-counter) (-> 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-override2 trans))) + (set! (-> arg0 next-chase-play-time) (+ (current-time) (get-rand-int-range arg0 600 1200))) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-get-sig-out-res" -99.0 0) + (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-7 bytes 5) 1) + (set! (-> v1-7 bytes 6) 26) + (set! (-> v1-7 bytes 4) -1) + (set! (-> (the-as sigt-wait-spot v1-7) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (when (sig-under-method-264 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 27 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (sig-under-method-263 arg1) + (when (and (>= (- (current-time) (-> 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-override2 trans))) + ) + ) + (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) + (when (send-event arg1 'jump 5 (-> arg1 sig5-course spots 28)) + (let ((s5-1 (-> arg1 actor-group 0 data 6 actor))) + (when (and (not (channel-active? arg1 (the-as uint 0))) + (or (not s5-1) (not (logtest? (-> s5-1 extra perm status) (entity-perm-status subtask-complete)))) ) - ) - (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) - (when (send-event arg1 'jump 5 (-> arg1 sig5-course spots 28)) - (let ((s5-1 (-> arg1 actor-group 0 data 6 actor))) - (when (and (not (channel-active? arg1 (the-as uint 0))) - (or (not s5-1) (not (logtest? (-> s5-1 extra perm status) (entity-perm-status subtask-complete)))) - ) - (let ((s5-2 18)) - (case (get-rand-int arg1 3) - ((1) - (set! s5-2 19) - ) - ((2) - (set! s5-2 20) - ) - ) - (play-speech arg1 s5-2) - ) + (let ((s5-2 18)) + (case (get-rand-int arg1 3) + ((1) + (set! s5-2 19) + ) + ((2) + (set! s5-2 20) + ) ) + (play-speech arg1 s5-2) ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 25 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t ) ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 25 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) ) - ) - (none) + ) ) + (none) ) :on-update #f :on-skipping-here #f @@ -1688,85 +1669,81 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (when (sig-under-method-264 arg1) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 27 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - (return #t) + (when (sig-under-method-264 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 27 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (if (not (logtest? (-> arg1 bot-task-bits) 16)) + (set! (-> arg1 waypoint-time0) (current-time)) ) - (if (not (logtest? (-> arg1 bot-task-bits) 16)) - (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) - ) - (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.5)) - (not (logtest? (-> arg1 focus-status) (focus-status in-air))) - ) - (logior! (-> arg1 waypoint-bits) 2) - (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) - ) - (if (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) - (not (speech-playing? arg1 21)) - (not (channel-active? arg1 (the-as uint 0))) + (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.5)) + (not (logtest? (-> arg1 focus-status) (focus-status in-air))) ) - (play-speech arg1 21) - ) - (when (zero? (-> arg1 next-chase-play-time)) - (let ((a0-14 (-> arg1 actor-group 0 data 7 actor))) - (if (and a0-14 (logtest? (-> a0-14 extra perm status) (entity-perm-status subtask-complete))) - (set! (-> arg1 next-chase-play-time) (-> pp clock frame-counter)) - ) - ) + (logior! (-> arg1 waypoint-bits) 2) + (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + ) + (if (and (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 1)) + (not (speech-playing? arg1 21)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 21) ) - (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (and (-> arg1 next-state) (let ((v1-54 (-> arg1 next-state name))) - (or (= v1-54 'waiting-far) (= v1-54 'waiting-close) (= v1-54 'waiting-turn)) - ) - ) - (or (nonzero? (-> arg1 next-chase-play-time)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 6)) - ) - ) - (when (not (logtest? (-> arg1 waypoint-bits) 1)) - (logior! (-> arg1 waypoint-bits) 1) - (send-event (ppointer->process (-> arg1 my-simple-focus)) 'move-trans (-> arg1 sig5-course spots 32)) - (set! (-> arg1 poi-handle) (ppointer->handle (-> arg1 my-simple-focus))) - ) - (let ((v1-78 (-> arg1 sig5-course spots 32))) - (when (>= 10012.445 - (fabs - (deg- - (atan - (- (-> v1-78 center x) (-> arg1 root-override2 trans x)) - (- (-> v1-78 center z) (-> arg1 root-override2 trans z)) - ) - (quaternion-y-angle (-> arg1 root-override2 quat)) + (when (zero? (-> arg1 next-chase-play-time)) + (let ((a0-14 (-> arg1 actor-group 0 data 7 actor))) + (if (and a0-14 (logtest? (-> a0-14 extra perm status) (entity-perm-status subtask-complete))) + (set! (-> arg1 next-chase-play-time) (current-time)) + ) + ) + ) + (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (and (-> arg1 next-state) (let ((v1-54 (-> arg1 next-state name))) + (or (= v1-54 'waiting-far) (= v1-54 'waiting-close) (= v1-54 'waiting-turn)) + ) + ) + (or (nonzero? (-> arg1 next-chase-play-time)) (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 6))) + ) + (when (not (logtest? (-> arg1 waypoint-bits) 1)) + (logior! (-> arg1 waypoint-bits) 1) + (send-event (ppointer->process (-> arg1 my-simple-focus)) 'move-trans (-> arg1 sig5-course spots 32)) + (set! (-> arg1 poi-handle) (ppointer->handle (-> arg1 my-simple-focus))) + ) + (let ((v1-78 (-> arg1 sig5-course spots 32))) + (when (>= 10012.445 + (fabs + (deg- + (atan + (- (-> v1-78 center x) (-> arg1 root-override2 trans x)) + (- (-> v1-78 center z) (-> arg1 root-override2 trans z)) ) + (quaternion-y-angle (-> arg1 root-override2 quat)) ) ) - (let ((s4-1 (target-pos 0)) - (s5-1 (-> arg1 sig5-course spots 32)) ) - (when (or (zero? (-> arg1 next-chase-play-time)) - (and (nonzero? (-> arg1 next-chase-play-time)) - (>= (- (-> pp clock frame-counter) (-> arg1 next-chase-play-time)) (seconds 2)) - (or (>= (- (-> pp clock frame-counter) (-> arg1 next-chase-play-time)) (seconds 9)) - (>= (vector-vector-xz-distance s4-1 (-> s5-1 center)) (+ 8192.0 (-> s5-1 center w))) - (< 20480.0 (- (-> s4-1 y) (-> s5-1 center y))) - ) - ) - ) - (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) - (when (send-event arg1 'jump 5 (-> s5-1 center)) - (logclear! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) - (if (not (channel-active? arg1 (the-as uint 0))) - (play-speech arg1 22) + (let ((s4-1 (target-pos 0)) + (s5-1 (-> arg1 sig5-course spots 32)) + ) + (when (or (zero? (-> arg1 next-chase-play-time)) + (and (nonzero? (-> arg1 next-chase-play-time)) + (>= (- (current-time) (-> arg1 next-chase-play-time)) (seconds 2)) + (or (>= (- (current-time) (-> arg1 next-chase-play-time)) (seconds 9)) + (>= (vector-vector-xz-distance s4-1 (-> s5-1 center)) (+ 8192.0 (-> s5-1 center w))) + (< 20480.0 (- (-> s4-1 y) (-> s5-1 center y))) + ) + ) ) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 26 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) + (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) + (when (send-event arg1 'jump 5 (-> s5-1 center)) + (logclear! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + (if (not (channel-active? arg1 (the-as uint 0))) + (play-speech arg1 22) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 26 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t ) ) ) @@ -1799,30 +1776,28 @@ (the-as (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-under)) - (with-pp - (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.5)) - (not (logtest? (-> arg1 focus-status) (focus-status in-air))) + (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 0.5)) + (not (logtest? (-> arg1 focus-status) (focus-status in-air))) + ) + (logior! (-> arg1 waypoint-bits) 1) + (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + ) + (cond + ((sig-under-method-264 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 27 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + (else + (if (and (not (speech-playing? arg1 23)) + (>= (- (current-time) (-> arg1 waypoint-time0)) (seconds 3.5)) + (not (channel-active? arg1 (the-as uint 0))) ) - (logior! (-> arg1 waypoint-bits) 1) - (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) - ) - (cond - ((sig-under-method-264 arg1) - (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) - (go-to-waypoint! arg1 27 #f) - (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) - #t - ) - (else - (if (and (not (speech-playing? arg1 23)) - (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3.5)) - (not (channel-active? arg1 (the-as uint 0))) - ) - (play-speech arg1 23) - ) - #f - ) + (play-speech arg1 23) + ) + #f ) ) ) diff --git a/test/decompiler/reference/jak2/levels/underport/under-laser_REF.gc b/test/decompiler/reference/jak2/levels/underport/under-laser_REF.gc index 21714f44f1..75752ea73f 100644 --- a/test/decompiler/reference/jak2/levels/underport/under-laser_REF.gc +++ b/test/decompiler/reference/jak2/levels/underport/under-laser_REF.gc @@ -433,7 +433,7 @@ s5-0 (-> self zero-pos) (-> self one-pos) - (get-norm! (-> self sync) (the-as int (+ (-> self clock frame-counter) (seconds 0.15)))) + (get-norm! (-> self sync) (the-as int (+ (current-time) (seconds 0.15)))) ) (vector-normalize-copy! s4-0 (-> self laser-dir) 1228.8) (vector+! s4-0 s4-0 s5-0) diff --git a/test/decompiler/reference/jak2/levels/underport/under-obs_REF.gc b/test/decompiler/reference/jak2/levels/underport/under-obs_REF.gc index 61fea22a82..493e57a6fc 100644 --- a/test/decompiler/reference/jak2/levels/underport/under-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/underport/under-obs_REF.gc @@ -374,10 +374,10 @@ (>= (* f0-18 f0-18) (vector-vector-xz-distance-squared a0-5 (-> self root trans))) ) ) - (if (>= (- (-> self clock frame-counter) (-> self last-recharge-time)) (seconds 1)) + (if (>= (- (current-time) (-> self last-recharge-time)) (seconds 1)) (sound-play "oxygen-recharge") ) - (set! (-> self last-recharge-time) (-> self clock frame-counter)) + (set! (-> self last-recharge-time) (current-time)) (send-event (ppointer->process *underb-master*) 'bubbler) ) ) @@ -472,7 +472,7 @@ This commonly includes things such as: (case arg2 (('ridden) (set! (-> self ridden) #t) - (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (let ((v0-0 (the-as object (current-time)))) (set! (-> self last-ridden) (the-as time-frame v0-0)) v0-0 ) @@ -640,7 +640,7 @@ This commonly includes things such as: :trans (behavior () (rider-trans) (when (-> self rider-started) - (when (and (not (-> self ridden)) (>= (- (-> self clock frame-counter) (-> self last-ridden)) (seconds 2))) + (when (and (not (-> self ridden)) (>= (- (current-time) (-> self last-ridden)) (seconds 2))) (if (= (-> self extra-id) 1) (send-event (ppointer->process *underb-master*) 'request 'big-room 'under-plat 'player #f) ) @@ -1434,7 +1434,7 @@ This commonly includes things such as: (defstate explode (under-mine) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((v1-3 (-> self root-override root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) diff --git a/test/decompiler/reference/jak2/levels/underport/under-shoot-block_REF.gc b/test/decompiler/reference/jak2/levels/underport/under-shoot-block_REF.gc index 2dab22488a..c32472769c 100644 --- a/test/decompiler/reference/jak2/levels/underport/under-shoot-block_REF.gc +++ b/test/decompiler/reference/jak2/levels/underport/under-shoot-block_REF.gc @@ -968,79 +968,75 @@ ;; definition for method 42 of type under-block ;; WARN: Return type mismatch int vs none. (defmethod under-block-method-42 under-block ((obj under-block)) - (with-pp - (set! (-> obj activated-time) (-> pp clock frame-counter)) - (logior! (-> obj flags) 2) - (set! (-> obj pulse-pc) 0) - (set! (-> obj pulse-op) 0) - 0 - (none) - ) + (set! (-> obj activated-time) (current-time)) + (logior! (-> obj flags) 2) + (set! (-> obj pulse-pc) 0) + (set! (-> obj pulse-op) 0) + 0 + (none) ) ;; definition for method 45 of type under-block ;; WARN: Return type mismatch object vs none. ;; WARN: Function (method 45 under-block) has a return type of none, but the expression builder found a return statement. (defmethod under-block-method-45 under-block ((obj under-block)) - (with-pp - (let ((v1-0 (-> obj puzzle))) - (when (logtest? (-> obj flags) 2) - (cond - ((!= (-> v1-0 slot-mask) (-> v1-0 slot-mask-full)) - (when (zero? (-> obj pulse-op)) - (if (< (- (-> pp clock frame-counter) (-> obj activated-time)) - (the-as time-frame (-> (the-as (pointer uint32) (&+ (-> obj puzzle pulse-ops) (* (-> obj pulse-pc) 4))))) - ) - (return #f) - ) - (set! (-> obj pulse-op) - (the-as int (-> (the-as (pointer uint32) (&+ (-> obj puzzle pulse-ops) (* (+ (-> obj pulse-pc) 1) 4))))) - ) - (+! (-> obj pulse-pc) 2) - (case (-> obj pulse-op) - ((1) - (set! (-> obj pulse-ctr) 3) - (sound-play "und-block-flash") - ) - ((2) - (go (method-of-object obj explode)) - ) + (let ((v1-0 (-> obj puzzle))) + (when (logtest? (-> obj flags) 2) + (cond + ((!= (-> v1-0 slot-mask) (-> v1-0 slot-mask-full)) + (when (zero? (-> obj pulse-op)) + (if (< (- (current-time) (-> obj activated-time)) + (the-as time-frame (-> (the-as (pointer uint32) (&+ (-> obj puzzle pulse-ops) (* (-> obj pulse-pc) 4))))) + ) + (return #f) ) - ) + (set! (-> obj pulse-op) + (the-as int (-> (the-as (pointer uint32) (&+ (-> obj puzzle pulse-ops) (* (+ (-> obj pulse-pc) 1) 4))))) + ) + (+! (-> obj pulse-pc) 2) (case (-> obj pulse-op) ((1) - (let ((v1-24 (-> obj pulse-ctr))) - (cond - ((= v1-24 3) - (set-vector! (-> obj draw color-mult) 1.1 0.25 0.25 1.0) - (+! (-> obj pulse-ctr) -1) - ) - ((or (= v1-24 2) (= v1-24 1)) - (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) - (set-vector! (-> obj draw color-emissive) 1.0 1.0 1.0 1.0) - (+! (-> obj pulse-ctr) -1) - ) - ((zero? v1-24) - (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) - (set-vector! (-> obj draw color-emissive) 0.0 0.0 0.0 1.0) - (set! (-> obj pulse-op) 0) - 0 - ) - ) - ) + (set! (-> obj pulse-ctr) 3) + (sound-play "und-block-flash") + ) + ((2) + (go (method-of-object obj explode)) ) ) ) - (else - (set! (-> obj flags) (logand -3 (-> obj flags))) - (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) - (set-vector! (-> obj draw color-emissive) 0.0 0.0 0.0 1.0) + (case (-> obj pulse-op) + ((1) + (let ((v1-24 (-> obj pulse-ctr))) + (cond + ((= v1-24 3) + (set-vector! (-> obj draw color-mult) 1.1 0.25 0.25 1.0) + (+! (-> obj pulse-ctr) -1) + ) + ((or (= v1-24 2) (= v1-24 1)) + (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) + (set-vector! (-> obj draw color-emissive) 1.0 1.0 1.0 1.0) + (+! (-> obj pulse-ctr) -1) + ) + ((zero? v1-24) + (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) + (set-vector! (-> obj draw color-emissive) 0.0 0.0 0.0 1.0) + (set! (-> obj pulse-op) 0) + 0 + ) + ) + ) ) + ) + ) + (else + (set! (-> obj flags) (logand -3 (-> obj flags))) + (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) + (set-vector! (-> obj draw color-emissive) 0.0 0.0 0.0 1.0) ) ) ) - (none) ) + (none) ) ;; definition for method 41 of type under-block @@ -1380,7 +1376,7 @@ (suspend) ) (under-block-method-41 self 'active) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "und-block-rise") (let ((gp-1 (new 'stack-no-clear 'matrix))) (set! (-> gp-1 vector 0 quad) (-> self root-override trans quad)) @@ -1411,7 +1407,7 @@ :trans (the-as (function none :behavior under-block) rider-trans) :code (behavior () (set! (-> self flags) (logand -2 (-> self flags))) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (new 'stack-no-clear 'matrix))) (set! (-> gp-0 vector 0 quad) (-> self root-override trans quad)) (set! (-> gp-0 vector 1 quad) (-> gp-0 vector 0 quad)) @@ -1520,9 +1516,9 @@ (the-as quaternion (-> gp-1 vector 2)) (the-as quaternion (-> gp-1 trans)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f - (let ((f30-0 (fmin 1.0 (* 0.022222223 (the float (- (-> self clock frame-counter) (-> self state-time))))))) + (let ((f30-0 (fmin 1.0 (* 0.022222223 (the float (- (current-time) (-> self state-time))))))) (let ((s5-1 (-> self root-override))) (set! (-> s5-1 transv quad) (-> s5-1 trans quad)) (vector-lerp! (-> s5-1 trans) (-> gp-1 vector 1) (the-as vector (-> gp-1 vector)) f30-0) @@ -1608,9 +1604,9 @@ (the-as quaternion (-> gp-1 vector 2)) (the-as quaternion (-> gp-1 trans)) ) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f - (let ((f30-0 (fmin 1.0 (* 0.0074074073 (the float (- (-> self clock frame-counter) (-> self state-time))))))) + (let ((f30-0 (fmin 1.0 (* 0.0074074073 (the float (- (current-time) (-> self state-time))))))) (let ((s5-1 (-> self root-override))) (set! (-> s5-1 transv quad) (-> s5-1 trans quad)) (vector-lerp! (-> s5-1 trans) (-> gp-1 vector 1) (the-as vector (-> gp-1 vector)) f30-0) @@ -1631,9 +1627,9 @@ ) #f (label cfg-5) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (until #f - (let* ((f1-9 (fmin 1.0 (* 0.0074074073 (the float (- (-> self clock frame-counter) (-> self state-time)))))) + (let* ((f1-9 (fmin 1.0 (* 0.0074074073 (the float (- (current-time) (-> self state-time)))))) (s5-2 (-> self root-override)) (f30-1 (fmax 0.0 (- 0.15 f1-9))) ) @@ -1672,7 +1668,7 @@ (none) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "und-block-lock") (let ((gp-1 (new 'stack-no-clear 'matrix))) (set! (-> gp-1 vector 0 quad) (-> self root-override trans quad)) @@ -1714,7 +1710,7 @@ (none) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (sound-play "und-block-sink") (let ((gp-1 (new 'stack-no-clear 'matrix))) (set! (-> gp-1 vector 0 quad) (-> self root-override trans quad)) @@ -1764,13 +1760,13 @@ (none) ) :code (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (let ((gp-0 (new 'stack-no-clear 'quaternion)) (s5-0 (new 'stack-no-clear 'quaternion)) (f30-0 0.0) ) (quaternion-copy! gp-0 (-> self root-override quat)) - (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.25)) + (while (< (- (current-time) (-> self state-time)) (seconds 1.25)) (+! f30-0 (* 65536.0 (-> self clock seconds-per-frame))) (quaternion-vector-angle! s5-0 (-> self rot-axis) (- f30-0)) (quaternion*! (-> self root-override quat) s5-0 gp-0) @@ -1792,7 +1788,7 @@ (fill-cache-integrate-and-collide gp-0 (-> gp-0 transv) a2-0 (meters 0)) ) (when (and (logtest? (-> (the-as collide-shape-moving gp-0) status) (collide-status touch-surface)) - (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.01)) + (>= (- (current-time) (-> self state-time)) (seconds 0.01)) ) (logior! (-> self flags) 4) (go-virtual explode) @@ -2242,7 +2238,7 @@ (('explode) (let ((v1-4 (-> self puzzle spawners (-> arg3 param 0)))) (set! (-> v1-4 active-handle) (the-as handle #f)) - (set! v0-0 (-> self clock frame-counter)) + (set! v0-0 (current-time)) (set! (-> v1-4 exploded-time) (the-as time-frame v0-0)) ) v0-0 @@ -2279,7 +2275,7 @@ (countdown (s5-0 (-> gp-1 length)) (let ((s4-0 (-> gp-1 s5-0))) (when (and (not (handle->process (-> s4-0 active-handle))) - (>= (- (-> self clock frame-counter) (-> s4-0 exploded-time)) (seconds 1)) + (>= (- (current-time) (-> s4-0 exploded-time)) (seconds 1)) ) (set! (-> s4-0 active-handle) (-> s4-0 waiting-handle)) (let ((s3-0 (get-process *default-dead-pool* under-block #x4000))) @@ -2353,8 +2349,8 @@ :code (behavior () (process-entity-status! self (entity-perm-status subtask-complete) #t) (sound-play "und-block-chime") - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (suspend) ) (let ((gp-1 (-> self puzzle spawners))) diff --git a/test/decompiler/reference/jak2/levels/underport/under-sig-obs_REF.gc b/test/decompiler/reference/jak2/levels/underport/under-sig-obs_REF.gc index b157ce5ac8..9975f88771 100644 --- a/test/decompiler/reference/jak2/levels/underport/under-sig-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/underport/under-sig-obs_REF.gc @@ -70,9 +70,9 @@ (let ((gp-0 (cshape-reaction-default arg0 arg1 arg2 arg3))) (when (logtest? gp-0 (collide-status touch-surface)) (let ((s5-0 self)) - (when (>= (- (-> self clock frame-counter) (-> s5-0 hit-time)) (seconds 0.25)) + (when (>= (- (current-time) (-> s5-0 hit-time)) (seconds 0.25)) (sound-play "shoot-plat-fall") - (set! (-> s5-0 hit-time) (-> self clock frame-counter)) + (set! (-> s5-0 hit-time) (current-time)) ) ) ) @@ -234,7 +234,7 @@ For example for an elevator pre-compute the distance between the first and last (vector-normalize! (-> self axe-flip) 1.0) (vector-rotate90-around-y! (-> self axe-flip) (-> self axe-flip)) (set! (-> self angle-flip-vel) -10.0) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ) ) @@ -310,11 +310,11 @@ For example for an elevator pre-compute the distance between the first and last ) (set! (-> self dest-angle) 180.0) (set! (-> self on-shake) #f) - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self time-flip))) + (when (>= (- (current-time) (-> self state-time)) (the-as time-frame (-> self time-flip))) (set! (-> self state-flip) (the-as uint 0)) 0 ) @@ -341,7 +341,7 @@ For example for an elevator pre-compute the distance between the first and last (set! (-> self angle-flip) 0.0) ) (quaternion-vector-angle! (-> self root-override quat) (-> self axe-flip) (* 182.04445 (-> self angle-flip))) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (+ (-> self time-flip) -300))) + (when (and (>= (- (current-time) (-> self state-time)) (the-as time-frame (+ (-> self time-flip) -300))) (= 1 (-> self state-flip)) ) (when (not (-> self on-shake)) @@ -390,7 +390,7 @@ For example for an elevator pre-compute the distance between the first and last (defstate die-falling (under-plat-shoot) :virtual #t :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (logclear! (-> self mask) (process-mask actor-pause enemy platform)) (let ((v1-7 (-> (the-as collide-shape-prim-group (-> self root-override root-prim)) child 0))) (set! (-> v1-7 prim-core collide-as) (collide-spec)) @@ -400,8 +400,8 @@ For example for an elevator pre-compute the distance between the first and last (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) - (let ((f30-0 (* 0.0016666667 (the float (+ (- (seconds -1) (-> self state-time)) (-> self clock frame-counter)))))) + (when (>= (- (current-time) (-> self state-time)) (seconds 1)) + (let ((f30-0 (* 0.0016666667 (the float (+ (- (seconds -1) (-> self state-time)) (current-time)))))) (when (>= f30-0 1.0) (cleanup-for-death self) (go empty-state) @@ -425,7 +425,7 @@ For example for an elevator pre-compute the distance between the first and last #t ) ) - (set! (-> self hit-time) (-> self clock frame-counter)) + (set! (-> self hit-time) (current-time)) (let ((gp-1 (new 'stack-no-clear 'quaternion)) (s5-1 (new 'stack-no-clear 'quaternion)) (s4-0 (new 'stack-no-clear 'vector)) @@ -592,8 +592,8 @@ otherwise, [[plat::34]] ) (suspend) (ja-channel-set! 0) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((gp-0 (current-time))) + (until (>= (- (current-time) gp-0) (seconds 1)) (suspend) ) ) @@ -1492,7 +1492,7 @@ This commonly includes things such as: ;; definition for function under-pipe-growls-post (defbehavior under-pipe-growls-post under-pipe-growls () - (when (and (zero? (-> self approach-sound-id)) (>= (-> self clock frame-counter) (-> self approach-play-time))) + (when (and (zero? (-> self approach-sound-id)) (>= (current-time) (-> self approach-play-time))) (let ((gp-0 (-> self root trans))) (set! (-> self approach-sound-id) (if (zero? (rand-vu-int-count 3)) (sound-play "grunt-warn" :position gp-0) @@ -1603,28 +1603,28 @@ This commonly includes things such as: ) :code (behavior () (sound-play "grunt-notice" :vol 40 :position (target-pos 0)) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.2)) (suspend) ) (sound-play "grunt-warn" :vol 50 :position (target-pos 0)) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.2)) (suspend) ) (sound-play "grunt-hit" :vol 60 :position (target-pos 0)) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 0.5)) (suspend) ) (sound-play "grunt-notice" :vol 70 :position (target-pos 0)) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) (sound-play "grunt-notice" :position (target-pos 0)) - (set! (-> self state-time) (-> self clock frame-counter)) - (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! (-> self state-time) (current-time)) + (until (>= (- (current-time) (-> self state-time)) (seconds 1)) (suspend) ) (sound-play "grunt-notice" :vol 200 :position (target-pos 0)) @@ -1658,9 +1658,7 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defbehavior under-pipe-growls-init-by-other under-pipe-growls ((arg0 vector) (arg1 symbol)) (set! (-> self approach-sound-id) (new 'static 'sound-id)) - (set! (-> self approach-play-time) - (+ (-> self clock frame-counter) (rand-vu-int-range (seconds 0.1) (seconds 1))) - ) + (set! (-> self approach-play-time) (+ (current-time) (rand-vu-int-range (seconds 0.1) (seconds 1)))) (set! (-> self root) (new 'process 'trsqv)) (logclear! (-> self mask) (process-mask actor-pause)) (let ((s4-1 (-> self root))) diff --git a/test/decompiler/reference/jak2/levels/underport/underb-master_REF.gc b/test/decompiler/reference/jak2/levels/underport/underb-master_REF.gc index f6729720f5..2579068f58 100644 --- a/test/decompiler/reference/jak2/levels/underport/underb-master_REF.gc +++ b/test/decompiler/reference/jak2/levels/underport/underb-master_REF.gc @@ -426,7 +426,7 @@ ) (if (or (not gp-0) (not (logtest? (-> gp-0 water flags) (water-flags under-water)))) (set! (-> self air-charge-up?) #t) - (set! (-> self underwater-time) (-> self clock frame-counter)) + (set! (-> self underwater-time) (current-time)) ) ) (cond @@ -466,8 +466,8 @@ (else (when (>= 0.4 (-> self air-supply)) (let ((v1-39 (the int (lerp-scale 90.0 300.0 (-> self air-supply) 0.0 0.4)))) - (when (>= (- (-> self clock frame-counter) (-> self last-air-beep-time)) v1-39) - (set! (-> self last-air-beep-time) (-> self clock frame-counter)) + (when (>= (- (current-time) (-> self last-air-beep-time)) v1-39) + (set! (-> self last-air-beep-time) (current-time)) (sound-play "oxygen-warning") ) ) @@ -478,9 +478,7 @@ ) (set! (-> *game-info* air-supply) (fmin 1.0 (-> self air-supply))) (if (or (and *target* (not (logtest? (focus-status mech) (-> *target* focus-status)))) - (and (>= (-> self air-supply) 1.0) - (>= (- (-> self clock frame-counter) (-> self underwater-time)) (seconds 3)) - ) + (and (>= (-> self air-supply) 1.0) (>= (- (current-time) (-> self underwater-time)) (seconds 3))) ) (spawn-air-tank-hud self #f) (spawn-air-tank-hud self #t) @@ -617,7 +615,7 @@ :enter (behavior () (persist-with-delay *setting-control* 'interp-time (seconds 0.05) 'interp-time 'abs 0.0 0) (set-setting! 'entity-name "camera-244" 0.0 0) - (set! (-> self big-room-timer) (-> self clock frame-counter)) + (set! (-> self big-room-timer) (current-time)) (send-event (ppointer->process *underb-master*) 'request 'under-warp #t) (none) ) @@ -627,7 +625,7 @@ (none) ) :trans (behavior () - (if (>= (- (-> self clock frame-counter) (-> self big-room-timer)) (seconds 1)) + (if (>= (- (current-time) (-> self big-room-timer)) (seconds 1)) (go-virtual idle) ) (none) @@ -774,7 +772,7 @@ ) ) :enter (behavior () - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) (none) ) :trans (behavior () @@ -797,7 +795,7 @@ ) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (>= (- (current-time) (-> self state-time)) (seconds 0.1)) (let ((a0-13 (-> v1-0 0 data 0 actor))) (if a0-13 (-> a0-13 extra process) @@ -854,7 +852,7 @@ ) ) (else - (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) ) ) ) @@ -943,8 +941,8 @@ 0 ) ) - (when (>= (- (-> self clock frame-counter) (-> self last-reminder-time)) (seconds 9)) - (set! (-> self last-reminder-time) (-> self clock frame-counter)) + (when (>= (- (current-time) (-> self last-reminder-time)) (seconds 9)) + (set! (-> self last-reminder-time) (current-time)) (add-process *gui-control* self @@ -987,12 +985,12 @@ (when (and (zero? (-> self state-time)) (= (get-status *gui-control* (the-as sound-id (-> self spooled-sound-id))) (gui-status ready)) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-reminder-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self last-reminder-time) (current-time)) ) (when (nonzero? (-> self state-time)) (when (and (>= (-> self spooled-sound-delay) 0) - (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self spooled-sound-delay)) + (>= (- (current-time) (-> self state-time)) (-> self spooled-sound-delay)) ) (set-action! *gui-control* @@ -1020,7 +1018,7 @@ ) ) ) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (if (>= (- (current-time) (-> self state-time)) (seconds 2)) (spawn (-> self part) (-> self root trans)) ) ) @@ -1094,8 +1092,8 @@ (when (and (zero? (-> self state-time)) (= (get-status *gui-control* (the-as sound-id (-> self spooled-sound-id))) (gui-status ready)) ) - (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self last-reminder-time) (-> self clock frame-counter)) + (set! (-> self state-time) (current-time)) + (set! (-> self last-reminder-time) (current-time)) (set-action! *gui-control* (gui-action play) @@ -1122,7 +1120,7 @@ ) ) ) - (if (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (if (< (- (current-time) (-> self state-time)) (seconds 1)) (spawn (-> self draining-part) (-> self root trans)) ) )