From 7a8aa7120422ae49dd48be538593620f461f6239 Mon Sep 17 00:00:00 2001 From: ManDude <7569514+ManDude@users.noreply.github.com> Date: Thu, 11 Jan 2024 22:49:41 +0000 Subject: [PATCH] [jak2] implement statistics tracker (#3288) Currently only tracks enemy kills, and how they were killed. There is currently no menu for this, but I've already added most of the text for it. Also did a bunch of misc decompilation fixes and renamed some methods. Fixes #3277 Fixes #3278 --- decompiler/config/jak1/all-types.gc | 2 +- decompiler/config/jak2/all-types.gc | 232 ++++--- .../ntsc_v1/anonymous_function_types.jsonc | 4 +- .../config/jak2/ntsc_v1/type_casts.jsonc | 12 +- .../config/jak2/ntsc_v1/var_names.jsonc | 5 + .../jak2/text/game_custom_text_en-US.json | 34 +- game/overlord/common/ssound.cpp | 137 ++--- game/overlord/jak2/ssound.cpp | 6 +- goal_src/goal-lib.gc | 16 +- goal_src/jak1/engine/common-obs/nav-enemy.gc | 2 +- goal_src/jak1/pc/pckernel-common.gc | 5 +- goal_src/jak1/pc/pckernel-h.gc | 3 +- goal_src/jak2/dgos/game.gd | 2 + goal_src/jak2/engine/ai/enemy-h.gc | 143 +++-- goal_src/jak2/engine/ai/enemy.gc | 581 +++++++++--------- goal_src/jak2/engine/anim/fma-sphere.gc | 2 +- goal_src/jak2/engine/anim/joint-exploder.gc | 8 +- goal_src/jak2/engine/camera/cam-states.gc | 160 +++-- goal_src/jak2/engine/game/game-h.gc | 21 +- goal_src/jak2/engine/nav/nav-enemy.gc | 159 +++-- .../jak2/engine/target/board/board-states.gc | 4 +- .../jak2/engine/target/mech/grunt-mech.gc | 34 +- goal_src/jak2/engine/ui/text-id-h.gc | 39 ++ goal_src/jak2/levels/atoll/ash1-course.gc | 10 +- goal_src/jak2/levels/atoll/juicer.gc | 124 ++-- goal_src/jak2/levels/atoll/sig0-course.gc | 64 +- goal_src/jak2/levels/atoll/sniper.gc | 8 +- .../jak2/levels/castle/boss/castle-baron.gc | 70 ++- .../jak2/levels/castle/roboguard-level.gc | 49 +- goal_src/jak2/levels/city/bombbot/bombbot.gc | 18 +- goal_src/jak2/levels/city/farm/yakow.gc | 12 +- .../city/kiddogescort/crocesc-states.gc | 73 ++- .../jak2/levels/city/kiddogescort/crocesc.gc | 28 +- .../city/kiddogescort/crocesc4-course.gc | 2 +- .../levels/city/kiddogescort/hal4-course.gc | 24 +- .../levels/city/kiddogescort/kidesc-states.gc | 62 +- .../jak2/levels/city/kiddogescort/kidesc.gc | 34 +- .../city/kiddogescort/kidesc4-course.gc | 2 +- .../levels/city/market/ashelin/ash4-course.gc | 6 +- .../levels/city/market/ashelin/ctyasha-obs.gc | 28 +- .../levels/city/meet-brutter/meet-brutter.gc | 21 +- goal_src/jak2/levels/city/shuttle/shuttle.gc | 18 +- .../jak2/levels/city/slums/kor/hal3-course.gc | 56 +- .../jak2/levels/city/slums/kor/kid-states.gc | 30 +- goal_src/jak2/levels/city/slums/kor/kid.gc | 12 +- .../jak2/levels/city/slums/kor/kid3-course.gc | 2 +- .../jak2/levels/city/slums/kor/kor-states.gc | 30 +- goal_src/jak2/levels/city/slums/kor/kor.gc | 12 +- .../jak2/levels/city/slums/kor/kor3-course.gc | 2 +- .../city/traffic/citizen/citizen-chick.gc | 38 +- .../city/traffic/citizen/citizen-enemy.gc | 16 +- .../city/traffic/citizen/citizen-fat.gc | 48 +- .../city/traffic/citizen/citizen-norm.gc | 46 +- .../levels/city/traffic/citizen/citizen.gc | 44 +- .../levels/city/traffic/citizen/civilian.gc | 36 +- .../jak2/levels/city/traffic/citizen/guard.gc | 112 ++-- .../city/traffic/citizen/metalhead-flitter.gc | 30 +- .../city/traffic/citizen/metalhead-grunt.gc | 110 ++-- .../traffic/citizen/metalhead-predator.gc | 50 +- .../levels/city/traffic/traffic-engine.gc | 2 +- .../city/traffic/vehicle/vehicle-guard.gc | 14 +- .../levels/common/ai/ashelin/ash-states.gc | 44 +- .../jak2/levels/common/ai/ashelin/ash-task.gc | 43 +- goal_src/jak2/levels/common/ai/ashelin/ash.gc | 46 +- goal_src/jak2/levels/common/ai/bot-h.gc | 10 +- goal_src/jak2/levels/common/ai/bot-states.gc | 38 +- goal_src/jak2/levels/common/ai/bot.gc | 76 +-- goal_src/jak2/levels/common/ai/halt/hal.gc | 18 +- .../levels/common/ai/ruffian/ruf-states.gc | 22 +- .../jak2/levels/common/ai/ruffian/ruf-task.gc | 4 +- goal_src/jak2/levels/common/ai/ruffian/ruf.gc | 244 ++++---- .../jak2/levels/common/ai/sig/sig-states.gc | 72 +-- .../jak2/levels/common/ai/sig/sig-task.gc | 19 +- goal_src/jak2/levels/common/ai/sig/sig.gc | 16 +- goal_src/jak2/levels/common/battle.gc | 10 +- .../common/enemy/amphibian/amphibian.gc | 114 ++-- .../jak2/levels/common/enemy/centurion.gc | 46 +- goal_src/jak2/levels/common/enemy/flitter.gc | 30 +- .../jak2/levels/common/enemy/fodder/fodder.gc | 40 +- .../jak2/levels/common/enemy/grenadier.gc | 56 +- goal_src/jak2/levels/common/enemy/grunt.gc | 165 ++--- .../enemy/guards/crimson-guard-level.gc | 112 ++-- goal_src/jak2/levels/common/enemy/hopper.gc | 56 +- .../common/enemy/hover/crimson-guard-hover.gc | 48 +- .../jak2/levels/common/enemy/hover/flamer.gc | 42 +- .../levels/common/enemy/hover/hover-enemy.gc | 70 +-- .../jak2/levels/common/enemy/hover/wasp.gc | 56 +- .../jak2/levels/common/enemy/metalmonk.gc | 72 +-- goal_src/jak2/levels/common/enemy/spyder.gc | 34 +- .../jak2/levels/common/entities/gun-buoy.gc | 8 +- .../jak2/levels/common/entities/spydroid.gc | 14 +- goal_src/jak2/levels/drill/drill-turret.gc | 129 ++-- goal_src/jak2/levels/drill/ginsu.gc | 28 +- goal_src/jak2/levels/forest/pegasus.gc | 16 +- goal_src/jak2/levels/forest/predator.gc | 48 +- goal_src/jak2/levels/fortress/fort-turret.gc | 16 +- goal_src/jak2/levels/mountain/rhino.gc | 72 +-- .../jak2/levels/nest/boss/metalkor-extras.gc | 25 +- .../jak2/levels/nest/boss/metalkor-setup.gc | 12 +- .../jak2/levels/nest/boss/metalkor-states.gc | 29 +- goal_src/jak2/levels/nest/flying-spider.gc | 30 +- goal_src/jak2/levels/nest/mammoth.gc | 26 +- goal_src/jak2/levels/nest/mantis.gc | 97 +-- goal_src/jak2/levels/ruins/mechtest-obs.gc | 6 +- goal_src/jak2/levels/ruins/rapid-gunner.gc | 60 +- goal_src/jak2/levels/sewer/escort/grim.gc | 2 +- .../jak2/levels/sewer/escort/jinx-shot.gc | 134 ++-- .../jak2/levels/sewer/escort/jinx-states.gc | 32 +- goal_src/jak2/levels/sewer/escort/jinx.gc | 16 +- goal_src/jak2/levels/sewer/escort/mog.gc | 2 +- goal_src/jak2/levels/sewer/gator.gc | 18 +- goal_src/jak2/levels/sewer/grim2-course.gc | 2 +- goal_src/jak2/levels/sewer/hal2-course.gc | 56 +- goal_src/jak2/levels/sewer/hosehead.gc | 98 +-- goal_src/jak2/levels/sewer/jinx2-course.gc | 2 +- goal_src/jak2/levels/sewer/mog2-course.gc | 2 +- goal_src/jak2/levels/sewer/sew-gunturret.gc | 8 +- goal_src/jak2/levels/strip/strip-drop.gc | 2 +- goal_src/jak2/levels/tomb/monster-frog.gc | 50 +- goal_src/jak2/levels/tomb/tomb-baby-spider.gc | 32 +- goal_src/jak2/levels/tomb/tomb-beetle.gc | 8 +- goal_src/jak2/levels/tomb/tomb-boulder.gc | 62 +- goal_src/jak2/levels/tomb/widow-baron.gc | 2 +- goal_src/jak2/levels/under/centipede.gc | 42 +- goal_src/jak2/levels/under/jellyfish.gc | 24 +- goal_src/jak2/levels/under/pipe-grunt.gc | 18 +- goal_src/jak2/levels/under/sig5-course.gc | 70 ++- goal_src/jak2/pc/pckernel-impl.gc | 13 +- goal_src/jak2/pc/pckernel.gc | 48 +- goal_src/jak2/pc/progress/progress-draw-pc.gc | 2 +- goal_src/jak2/pc/statistics-h.gc | 380 ++++++++++++ goal_src/jak2/pc/statistics.gc | 130 ++++ .../jak1/engine/common-obs/nav-enemy_REF.gc | 2 +- .../reference/jak2/engine/ai/enemy-h_REF.gc | 120 ++-- .../reference/jak2/engine/ai/enemy_REF.gc | 578 +++++++++-------- .../jak2/engine/anim/fma-sphere_REF.gc | 2 +- .../jak2/engine/anim/joint-exploder_REF.gc | 8 +- .../jak2/engine/camera/cam-states_REF.gc | 160 +++-- .../reference/jak2/engine/game/game-h_REF.gc | 2 +- .../jak2/engine/nav/nav-enemy_REF.gc | 159 +++-- .../engine/target/board/board-states_REF.gc | 4 +- .../jak2/engine/target/mech/grunt-mech_REF.gc | 34 +- .../jak2/levels/atoll/ash1-course_REF.gc | 10 +- .../reference/jak2/levels/atoll/juicer_REF.gc | 124 ++-- .../jak2/levels/atoll/sig0-course_REF.gc | 64 +- .../reference/jak2/levels/atoll/sniper_REF.gc | 8 +- .../levels/castle/boss/castle-baron_REF.gc | 70 ++- .../jak2/levels/castle/roboguard-level_REF.gc | 44 +- .../jak2/levels/city/bombbot/bombbot_REF.gc | 19 +- .../jak2/levels/city/farm/yakow_REF.gc | 12 +- .../city/kiddogescort/crocesc-states_REF.gc | 70 +-- .../city/kiddogescort/crocesc4-course_REF.gc | 2 +- .../levels/city/kiddogescort/crocesc_REF.gc | 28 +- .../city/kiddogescort/hal4-course_REF.gc | 24 +- .../city/kiddogescort/kidesc-states_REF.gc | 62 +- .../city/kiddogescort/kidesc4-course_REF.gc | 2 +- .../levels/city/kiddogescort/kidesc_REF.gc | 34 +- .../city/market/ashelin/ash4-course_REF.gc | 6 +- .../city/market/ashelin/ctyasha-obs_REF.gc | 28 +- .../city/meet-brutter/meet-brutter_REF.gc | 21 +- .../jak2/levels/city/shuttle/shuttle_REF.gc | 18 +- .../levels/city/slums/kor/kid-states_REF.gc | 30 +- .../levels/city/slums/kor/kid3-course_REF.gc | 2 +- .../jak2/levels/city/slums/kor/kid_REF.gc | 12 +- .../levels/city/slums/kor/kor-states_REF.gc | 30 +- .../levels/city/slums/kor/kor3-course_REF.gc | 2 +- .../jak2/levels/city/slums/kor/kor_REF.gc | 12 +- .../city/traffic/citizen/citizen-chick_REF.gc | 38 +- .../city/traffic/citizen/citizen-enemy_REF.gc | 16 +- .../city/traffic/citizen/citizen-fat_REF.gc | 48 +- .../city/traffic/citizen/citizen-norm_REF.gc | 46 +- .../city/traffic/citizen/citizen_REF.gc | 43 +- .../city/traffic/citizen/civilian_REF.gc | 36 +- .../levels/city/traffic/citizen/guard_REF.gc | 112 ++-- .../traffic/citizen/metalhead-flitter_REF.gc | 30 +- .../traffic/citizen/metalhead-grunt_REF.gc | 110 ++-- .../traffic/citizen/metalhead-predator_REF.gc | 50 +- .../levels/city/traffic/traffic-engine_REF.gc | 2 +- .../city/traffic/vehicle/vehicle-guard_REF.gc | 24 +- .../common/ai/ashelin/ash-states_REF.gc | 44 +- .../levels/common/ai/ashelin/ash-task_REF.gc | 80 +++ .../jak2/levels/common/ai/ashelin/ash_REF.gc | 46 +- .../jak2/levels/common/ai/bot-h_REF.gc | 10 +- .../jak2/levels/common/ai/bot-states_REF.gc | 38 +- .../jak2/levels/common/ai/bot_REF.gc | 76 +-- .../jak2/levels/common/ai/halt/hal_REF.gc | 18 +- .../common/ai/ruffian/ruf-states_REF.gc | 22 +- .../levels/common/ai/ruffian/ruf-task_REF.gc | 4 +- .../levels/common/ai/sig/sig-states_REF.gc | 72 +-- .../jak2/levels/common/ai/sig/sig-task_REF.gc | 19 +- .../jak2/levels/common/ai/sig/sig_REF.gc | 16 +- .../jak2/levels/common/battle_REF.gc | 10 +- .../common/enemy/amphibian/amphibian_REF.gc | 114 ++-- .../jak2/levels/common/enemy/centurion_REF.gc | 46 +- .../jak2/levels/common/enemy/flitter_REF.gc | 30 +- .../levels/common/enemy/fodder/fodder_REF.gc | 40 +- .../jak2/levels/common/enemy/grenadier_REF.gc | 56 +- .../jak2/levels/common/enemy/grunt_REF.gc | 167 ++--- .../enemy/guards/crimson-guard-level_REF.gc | 112 ++-- .../jak2/levels/common/enemy/hopper_REF.gc | 34 +- .../enemy/hover/crimson-guard-hover_REF.gc | 48 +- .../levels/common/enemy/hover/flamer_REF.gc | 42 +- .../common/enemy/hover/hover-enemy_REF.gc | 70 +-- .../levels/common/enemy/hover/wasp_REF.gc | 56 +- .../jak2/levels/common/enemy/metalmonk_REF.gc | 72 +-- .../jak2/levels/common/enemy/spyder_REF.gc | 34 +- .../levels/common/entities/gun-buoy_REF.gc | 8 +- .../levels/common/entities/spydroid_REF.gc | 14 +- .../reference/jak2/levels/drill/ginsu_REF.gc | 28 +- .../jak2/levels/forest/pegasus_REF.gc | 16 +- .../jak2/levels/forest/predator_REF.gc | 48 +- .../jak2/levels/fortress/fort-turret_REF.gc | 16 +- .../jak2/levels/mountain/rhino_REF.gc | 72 +-- .../levels/nest/boss/metalkor-extras_REF.gc | 20 +- .../levels/nest/boss/metalkor-setup_REF.gc | 16 +- .../levels/nest/boss/metalkor-states_REF.gc | 33 +- .../jak2/levels/nest/flying-spider_REF.gc | 30 +- .../reference/jak2/levels/nest/mammoth_REF.gc | 26 +- .../reference/jak2/levels/nest/mantis_REF.gc | 97 +-- .../jak2/levels/ruins/mechtest-obs_REF.gc | 6 +- .../jak2/levels/ruins/rapid-gunner_REF.gc | 60 +- .../jak2/levels/sewer/escort/grim_REF.gc | 2 +- .../levels/sewer/escort/jinx-states_REF.gc | 32 +- .../jak2/levels/sewer/escort/jinx_REF.gc | 16 +- .../jak2/levels/sewer/escort/mog_REF.gc | 2 +- .../reference/jak2/levels/sewer/gator_REF.gc | 18 +- .../jak2/levels/sewer/grim2-course_REF.gc | 2 +- .../jak2/levels/sewer/hal2-course_REF.gc | 56 +- .../jak2/levels/sewer/hosehead_REF.gc | 99 +-- .../jak2/levels/sewer/jinx2-course_REF.gc | 2 +- .../jak2/levels/sewer/mog2-course_REF.gc | 2 +- .../jak2/levels/sewer/sew-gunturret_REF.gc | 8 +- .../jak2/levels/strip/strip-drop_REF.gc | 2 +- .../jak2/levels/tomb/monster-frog_REF.gc | 50 +- .../jak2/levels/tomb/tomb-baby-spider_REF.gc | 32 +- .../jak2/levels/tomb/tomb-beetle_REF.gc | 8 +- .../jak2/levels/tomb/widow-baron_REF.gc | 2 +- .../jak2/levels/under/centipede_REF.gc | 42 +- .../jak2/levels/under/jellyfish_REF.gc | 24 +- .../jak2/levels/under/pipe-grunt_REF.gc | 18 +- .../jak2/levels/under/sig5-course_REF.gc | 70 ++- 241 files changed, 6004 insertions(+), 5135 deletions(-) create mode 100644 goal_src/jak2/pc/statistics-h.gc create mode 100644 goal_src/jak2/pc/statistics.gc create mode 100644 test/decompiler/reference/jak2/levels/common/ai/ashelin/ash-task_REF.gc diff --git a/decompiler/config/jak1/all-types.gc b/decompiler/config/jak1/all-types.gc index 76974bb4be..aee0f05485 100644 --- a/decompiler/config/jak1/all-types.gc +++ b/decompiler/config/jak1/all-types.gc @@ -23608,7 +23608,7 @@ (define-extern nav-enemy-turn-to-face-point (function vector float none :behavior nav-enemy)) (define-extern nav-enemy-execute-jump (function none :behavior nav-enemy)) (define-extern nav-enemy-jump-land-anim (function none :behavior nav-enemy)) ;; TODO -(define-extern nav-enemy-rnd-float-range (function float float float :behavior nav-enemy)) +(define-extern nav-enemy-rnd-float-range (function float float float)) (define-extern nav-enemy-common-post (function none :behavior nav-enemy)) ;; TODO not confirmed (define-extern nav-enemy-execute-custom-jump (function int float float none :behavior nav-enemy)) (define-extern nav-enemy-initialize-custom-jump (function vector symbol float float float none :behavior nav-enemy)) diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 8cfe65daf2..a9df4a0ec3 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -7425,6 +7425,45 @@ (progress-shadows-extended #x12a2) (progress-error-no-resolutions #x12a3) (progress-territory-auto #x12a4) + (progress-kill-stats #x12a5) + (progress-other-stats #x12a6) + (progress-ks-total-killed #x12a7) + (progress-ks-killed-by-jak #x12a8) + (progress-ks-killed-by-darkjak #x12a9) + (progress-ks-killed-by-daxter #x12aa) + (progress-ks-killed-by-others #x12ab) + (progress-ks-source-gun-yellow #x12ac) + (progress-ks-source-gun-red #x12ad) + (progress-ks-source-gun-blue #x12ae) + (progress-ks-source-gun-dark #x12af) + (progress-ks-source-board #x12b0) + (progress-ks-source-board-trick #x12b1) + (progress-ks-source-mech #x12b2) + (progress-ks-source-mech-bonk #x12b3) + (progress-ks-source-turret #x12b4) + (progress-ks-source-punch #x12b5) + (progress-ks-source-flop #x12b6) + (progress-ks-source-uppercut #x12b7) + (progress-ks-source-spin #x12b8) + (progress-ks-source-roll #x12b9) + (progress-ks-source-darkjak-punch #x12ba) + (progress-ks-source-darkjak-flop #x12bb) + (progress-ks-source-darkjak-uppercut #x12bc) + (progress-ks-source-darkjak-spin #x12bd) + (progress-ks-source-darkjak-roll #x12be) + (progress-ks-source-darkjak-bomb0 #x12bf) + (progress-ks-source-darkjak-bomb1 #x12c0) + (progress-ks-source-indax-punch #x12c1) + (progress-ks-source-indax-spin #x12c2) + (progress-ks-source-guard #x12c3) + (progress-ks-source-sig #x12c4) + (progress-ks-source-ashelin #x12c5) + (progress-ks-source-jinx #x12c6) + (progress-ks-source-grim #x12c7) + (progress-ks-source-mog #x12c8) + (progress-ks-source-metalhead #x12c9) + (progress-ks-source-other-bot #x12ca) + (progress-ks-source-other-enemy #x12cb) (progress-input-options-auto-hide-cursor #x1300) (progress-menu-reassign-binds #x1301) (progress-reassign-binds-controller #x1302) @@ -15786,6 +15825,24 @@ (test 22) ;; hi 64 ) + +;; +++game-h:knocked-type +(defenum knocked-type + :type uint8 + (knocked-type-0 0) + (knocked-type-1 1) + (knocked-type-2 2) + (knocked-type-3 3) + (knocked-type-4 4) ;; what the heck is this! (its on gator, and cant trigger it for the life of me) + (knocked-type-5 5) + (knocked-type-6 6) + (knocked-type-7 7) + (knocked-type-8 8) + (knocked-type-9 9) + (knocked-type-10 10) + ) +;; ---game-h:knocked-type + (declare-type touching-shapes-entry structure) (deftype attack-info (structure) @@ -15811,7 +15868,7 @@ (penetrate-using penetrate :offset-assert 136) (damage float :offset-assert 144) (shield-damage float :offset-assert 148) - (knock uint8 :offset-assert 152) + (knock knocked-type :offset-assert 152) (test symbol :offset-assert 156) ) :method-count-assert 12 @@ -27739,7 +27796,7 @@ (define-extern dist-info-valid? (function collide-los-dist-info symbol)) ;; (define-extern dist-info-append (function collide-los-dist-info vector none)) ;; (define-extern dist-info-print (function collide-los-dist-info string object)) ;; -(define-extern los-cw-ccw (function (inline-array collide-cache-tri) vector vector float collide-los-result vector float symbol)) ;; +(define-extern los-cw-ccw (function (inline-array collide-cache-tri) vector vector float collide-los-result vector float symbol :behavior camera-slave)) ;; (define-extern cam-los-spline-collide (function vector vector pat-surface float)) ;; (define-extern cam-los-setup-lateral (function collide-los-result vector vector symbol :behavior camera-slave)) ;; (define-extern cam-los-collide (function vector vector collide-los-result pat-surface symbol :behavior camera-slave)) ;; @@ -32812,42 +32869,42 @@ (defenum enemy-flag :type int64 :bitfield #t - (lock-focus 0) - (death-start 1) - (enable-on-active 2) - (checking-water 3) - (check-water 4) - (spawn-gem 5) - (chase-startup 6) - (attackable-backup 7) - (look-at-focus 8) - (use-notice-distance 9) - (enable-on-notice 10) - (look-at-move-dest 11) - (notice 12) - (auto-reset-penetrate 13) - (jump-check-blocked 14) - (drawn-mirrored 15) - (multi-focus 16) - (alert 17) - (victory 18) - (dangerous-backup 19) - (actor-pause-backup 20) - (trackable 21) - (called-dying 22) - (check-water-backup 23) - (no-initial-move-to-ground 24) - (cam-attack-mode 25) - (trackable-backup 26) - (enable-on-hostile 27) - (directed-ready 28) - (use-trigger 29) - (directed 30) - (dislike-combo 31) - (recover-applied-velocity 32) - (vulnerable-backup 33) - (vulnerable 34) - (recover 35) + (look-at-focus 0) + (look-at-move-dest 1) + (vulnerable 2) + (vulnerable-backup 3) + (dangerous-backup 4) + (notice 5) + (alert 6) + (auto-reset-penetrate 7) + (victory 8) + (cam-attack-mode 9) + (use-notice-distance 10) + (attackable-backup 11) + (actor-pause-backup 12) + (enable-on-notice 13) + (enable-on-active 14) + (enable-on-hostile 15) + (dislike-combo 16) + (directed 17) + (directed-ready 18) + (chase-startup 19) + (lock-focus 20) + (multi-focus 21) + (use-trigger 22) + (trackable 23) + (trackable-backup 24) + (spawn-gem 25) + (check-water 26) + (check-water-backup 27) + (checking-water 28) + (recover 29) + (recover-applied-velocity 30) + (drawn-mirrored 31) + (called-dying 32) + (no-initial-move-to-ground 33) + (jump-check-blocked 34) + (death-start 35) (enemy-flag36 36) (enemy-flag37 37) (enemy-flag38 38) @@ -32986,8 +33043,21 @@ :flag-assert #x900000018 ) +(defenum enemy-jump-flags + :bitfield #t + :type uint8 + (enjflag-0) + (enjflag-1) + (enjflag-2) + (enjflag-3) + (enjflag-4) + (enjflag-5) + (enjflag-6) + (enjflag-7) + ) + (deftype enemy-jump-info (structure) - ((flags uint8 :offset-assert 0) + ((flags enemy-jump-flags :offset-assert 0) (anim-speed float :offset-assert 4) (hang-time time-frame :offset-assert 8) (start-pos vector :inline :offset-assert 16) @@ -33011,27 +33081,13 @@ :flag-assert #x90000002c ) -;; +++enemy-h:knocked-type -(defenum knocked-type - :type uint8 - (knocked-type-0 0) - (knocked-type-1 1) - (knocked-type-2 2) - (knocked-type-3 3) - (knocked-type-4 4) ;; what the heck is this! (its on gator, and cant trigger it for the life of me) - (knocked-type-5 5) - (knocked-type-6 6) - (knocked-type-7 7) - ) -;; ---enemy-h:knocked-type - (deftype enemy-attack-info (structure) ((attack-id uint32 :offset-assert 0) (knocked-type knocked-type :offset-assert 4) (blue-juggle-count uint8 :offset-assert 5) (attacker-handle handle :offset-assert 8) (attack-time time-frame :offset-assert 16) - (penetrate-using uint64 :offset-assert 24) + (penetrate-using penetrate :offset-assert 24) (attacker-pos vector :inline :offset-assert 32) (attack-direction vector :inline :offset-assert 48) ) @@ -33125,7 +33181,7 @@ "TODO" (_type_ process-focusable) symbol) ;; 53 (enemy-method-54 (_type_) enemy-flag) ;; 54 - (track-target! + (common-post "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -33150,8 +33206,8 @@ (enemy-method-61 (_type_ int) int :behavior enemy) ;; 61 (enemy-method-62 (_type_) none) ;; 62 (enemy-method-63 (_type_ process-focusable enemy-aware) symbol) ;; 63 - (enemy-method-64 (_type_) none) ;; 64 - (enemy-method-65 (_type_) none) ;; 65 + (go-dormant (_type_) object) ;; 64 + (go-dormant-aware (_type_) object) ;; 65 (go-ambush (_type_) object) ;; 66 (go-stare (_type_) object) ;; 67 (go-stare2 (_type_) object) ;; 68 @@ -33170,8 +33226,8 @@ (_type_ process int symbol event-message-block) object) ;; 74 (enemy-method-75 (_type_ process event-message-block) object) ;; 75 (enemy-method-76 (_type_ process event-message-block) symbol) ;; 76 - (enemy-method-77 (_type_ (pointer float)) symbol) ;; 77 - (enemy-method-78 (_type_ (pointer float)) symbol) ;; 78 + (enemy-method-77 (_type_ enemy-knocked-info) symbol) ;; 77 + (enemy-method-78 (_type_ enemy-knocked-info) symbol) ;; 78 (enemy-method-79 (_type_ int enemy-knocked-info) symbol) ;; 79 (enemy-method-80 (_type_ enemy-knocked-info) symbol) ;; 80 (enemy-method-81 (_type_) symbol) ;; 81 @@ -33185,10 +33241,7 @@ (enemy-method-89 (_type_ enemy-jump-info) symbol) ;; 89 (enemy-method-90 (_type_ int enemy-jump-info) symbol) ;; 90 (enemy-method-91 (_type_ int enemy-jump-info) none) ;; 91 - (enemy-method-92 - "TODO - nav-poly is a guess - @abstract" - (_type_ int nav-poly) none) ;; 92 + (enemy-method-92 "@abstract" (_type_ int enemy-jump-info) none) ;; 92 (enemy-method-93 (_type_) none) ;; 93 (enemy-method-94 (_type_ vector float) symbol) ;; 94 (enemy-method-95 (_type_ vector float) symbol) ;; 95 @@ -33208,11 +33261,11 @@ (enemy-method-103 (_type_) collide-spec) ;; 103 (enemy-method-104 (_type_ process touching-shapes-entry uint) symbol :behavior process) ;; 104 (enemy-method-105 (_type_ process) enemy-flag) ;; 105 - (enemy-method-106 (_type_ process object int attack-info) none :behavior enemy) ;; 106 + (set-incoming-attack-info (_type_ process object penetrate attack-info) none :behavior enemy) ;; 106 (get-enemy-target "@returns the [[process-focusable]] that the enemy is currently focusing on, or [[#f]] otherwise" (_type_) process-focusable) ;; 107 - (enemy-method-108 (_type_ enemy event-message-block) int) ;; 108 + (enemy-method-108 (_type_ process-drawable event-message-block) int) ;; 108 (look-at-target! "Logic for looking at the target that is locked on, sets some flags and adjusts the neck to look at the target if available @param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" @@ -33235,33 +33288,32 @@ "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (_type_) none) ;; 115 (go-idle (_type_) none) ;; 116 - (get-rand-float + (rnd-float "@returns the result of calling [[rand-vu]]" (_type_) float) ;; 117 - (get-rand-float-range + (rnd-float-range "@param low The lower bound of the range (inclusive) @param high The upper bound of the range (exclusive) @returns A random float in the specified range" (_type_ float float) float) ;; 118 - (get-rand-int + (rnd-int-count "@param high The upper bound of the range (exclusive) @returns a random integer in the range 0 to `high` @see [[rand-vu]]" (_type_ int) int) ;; 119 - (enemy-method-120 "TODO" (_type_ int int) int) ;; 120 - (get-rand-int-range + (rnd-bit "TODO" (_type_ int int) int) ;; 120 + (rnd-int-range "@param low The lower bound of the range (inclusive) @param high The upper bound of the range (exclusive) @returns A random integer in the specified range" (_type_ int int) int) ;; 121 - (rng-hit? - "TODO - not the best name - @param chance The value to compare ([[>=]]) with the result from [[rand-vu]]. + (rnd-percent? + "@param chance The value to compare ([[>=]]) with the result from [[rand-vu]]. @returns If `chance` is greater than the random draw" (_type_ float) symbol) ;; 122 - (enemy-method-123 "TODO" (_type_ float) symbol) ;; 123 + (rnd-go-idle? "TODO" (_type_ float) symbol) ;; 123 (enemy-method-124 "TODO" (_type_) collide-spec) ;; 124 - (enemy-method-125 (_type_ collide-query collide-spec float float float) pat-surface) ;; 125 + (ground-pat-set! (_type_ collide-query collide-spec float float float) pat-surface) ;; 125 (enemy-above-ground? "@returns if the enemy is above the ground or not @see [[above-ground?]]" @@ -33270,12 +33322,12 @@ (enemy-method-128 (_type_ vector move-above-ground-params) none) ;; 128 (enemy-method-129 (_type_) none) ;; 129 (enemy-method-130 (_type_ float) symbol) ;; 130 - (enemy-method-131 (_type_ int) uint) ;; 131 - (dispose! + (penetrate-using->knocked (_type_ penetrate) knocked-type) ;; 131 + (dying "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (_type_) none) ;; 132 (enemy-method-133 (_type_) symbol) ;; 133 - (enemy-method-134 (_type_ process attack-info) process-focusable) ;; 134 + (get-attacker (_type_ process attack-info) process-focusable) ;; 134 (enemy-method-135 (_type_ int) sound-id) ;; 135 (enemy-method-136 (_type_) enemy-flag) ;; 136 ) @@ -34825,7 +34877,7 @@ (unknown-byte-n1k2n3 int8 :offset 636) (unknown-byte-m2j342 int8 :offset 637) (unknown-byte-1ji2n3 int8 :offset 638) - (unknown-byte-n123n int8 :offset 639) + (unknown-byte-n123n uint8 :offset 639) (state-timeout2 uint64 :offset-assert 640) (next-warn-time time-frame :offset-assert 648) (dest vector :inline :offset-assert 656) @@ -38526,7 +38578,7 @@ charge ) (:methods - (rhino-method-182 (_type_ process event-message-block) symbol) ;; 182 + (hit-stomach? (_type_ process event-message-block) symbol) ;; 182 ) ) @@ -39426,7 +39478,7 @@ (hit-by-enemy-count uint16 :offset-assert 698) (hit-by-player-count uint16 :offset-assert 700) (notice-enemy-dist float :offset-assert 704) - (channel uint8 :offset-assert 708) + (channel gui-channel :offset-assert 708) (focus-mode int8 :offset-assert 709) (nav-mesh-index int8 :offset-assert 710) (delay-too-far-check int8 :offset-assert 711) @@ -39489,13 +39541,13 @@ (play-speech (_type_ int) none) ;; 206 (play-death-sound "Play one of our death sounds." (_type_ string) none) ;; 207 (bot-method-208 (_type_) symbol) ;; 208 - (channel-active? "Is the given [[gui-channel]] active?" (_type_ uint) symbol) ;; 209 + (channel-active? "Is the given [[gui-channel]] active?" (_type_ gui-channel) symbol) ;; 209 (init! "Set defaults for various fields." (_type_) none) ;; 210 (clear-speech-flags! "Clear the `playing` flag for all of our speeches." (_type_) none) ;; 211 (reset-warn-time! (_type_) none) ;; 212 (go-to-waypoint! "Start moving to the given [[bot-waypoint]]." (_type_ int symbol) object) ;; 213 (bot-method-214 (_type_) symbol) ;; 214 - (skip-waypoint (_type_) none) ;; 215 + (skip-waypoint (_type_) object) ;; 215 (bot-method-216 (_type_) none) ;; 216 (speech-ended? "Is the given speech active?" (_type_ int) symbol) ;; 217 (speech-playing? "Is the given speech playing?" (_type_ int) symbol) ;; 218 @@ -43438,7 +43490,7 @@ (define-extern set-countdown-to-roar (function none :behavior metalkor)) (define-extern metalkor-go-next-stage (function none :behavior metalkor)) (define-extern metalkor-setup-hit-anim (function attack-info process-drawable art-element art-element float none :behavior metalkor)) -(define-extern metalkor-get-gem-tracker (function process-focusable none :behavior metalkor)) +(define-extern metalkor-get-gem-tracker (function process-focusable gem-tracker :behavior metalkor)) (define-extern metalkor-handler (function process int symbol event-message-block object :behavior metalkor)) (define-extern metalkor-start-egg (function symbol :behavior metalkor)) (define-extern metalkor-check-egg (function symbol :behavior metalkor)) @@ -50590,13 +50642,15 @@ ( (ai-hook (function vehicle-guard none) :offset-assert 880) (turret turret-control :inline :offset-assert 888) - (target-flags turret-flag :offset-assert 968) + (target-flags traffic-target-flag :offset-assert 968) (target-in-sight-time time-frame :offset-assert 976) (minimap connection-minimap :offset-assert 984) (vehicle-guard-pad-k1jn23k1 uint32 :offset-assert 988) (traffic-target-status traffic-target-status :offset-assert 992) (pursuit-target handle :offset-assert 1000) - (vehicle-guard-pad-1kjh2nb3k1 uint32 16 :offset-assert 1008) + (vehicle-guard-pad-0jkfdjslf uint32 4 :offset-assert 1008) + (vehicle-guard-vector0341413 vector :inline :offset-assert 1024) + (vehicle-guard-pad-1kjh2nb3k1 uint32 8 :offset-assert 1040) (lod2 symbol :offset-assert 1072) ) :method-count-assert 159 @@ -50627,7 +50681,7 @@ (define-extern vehicle-draw-beam (function sparticle-launcher vector vector object symbol none)) (define-extern vehicle-draw-laser-spot (function vector vector symbol none)) (define-extern vehicle-draw-laser (function vector vector none)) -(define-extern vehicle-guard-choose-branch (function vehicle-controller vehicle nav-branch)) +(define-extern vehicle-guard-choose-branch (function vehicle-controller vehicle-guard nav-branch)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; transport ;; @@ -52960,7 +53014,9 @@ (deftype mechblock (process-drawable) ((root collide-shape-moving :override) (origin vector :inline :offset-assert 208) - (drop-point vector :inline :offset 256) + (unknown-quat quaternion :inline :offset-assert 224) + (unknown-vector vector :inline :offset-assert 240) + (drop-point vector :inline :offset-assert 256) (allow-drag? symbol :offset-assert 272) (reset-on-land? symbol :offset-assert 276) (hit-something? symbol :offset-assert 280) diff --git a/decompiler/config/jak2/ntsc_v1/anonymous_function_types.jsonc b/decompiler/config/jak2/ntsc_v1/anonymous_function_types.jsonc index e160a6d03a..319616f5fc 100644 --- a/decompiler/config/jak2/ntsc_v1/anonymous_function_types.jsonc +++ b/decompiler/config/jak2/ntsc_v1/anonymous_function_types.jsonc @@ -1227,8 +1227,8 @@ "castle-baron": [[7, "(function collectable none)"]], "metalkor-extras": [[65, "(function vector :behavior metalkor-shot)"]], "metalkor-setup": [ - [1, "(function gem-tracker none)"], - [2, "(function gem-tracker none)"] + [1, "(function gem-tracker symbol)"], + [2, "(function gem-tracker symbol)"] ], "meet-brutter": [ [0, "(function none :behavior task-manager)"], diff --git a/decompiler/config/jak2/ntsc_v1/type_casts.jsonc b/decompiler/config/jak2/ntsc_v1/type_casts.jsonc index 092cc25c02..b1bde5edc2 100644 --- a/decompiler/config/jak2/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak2/ntsc_v1/type_casts.jsonc @@ -4309,7 +4309,8 @@ "(method 74 enemy)": [ [50, "s3", "process-drawable"], [94, "v1", "attack-info"], - [[111, 205], "s2", "attack-info"], + [[111, 137], "s2", "attack-info"], + [204, "s2", "attack-info"], [554, "a0", "vector"] ], "(method 56 enemy)": [[[0, 6], "v1", "attack-info"]], @@ -4537,7 +4538,7 @@ ], "(method 23 joint-exploder)": [[26, "v1", "process-drawable"]], "(method 28 joint-exploder)": [[[0, 250], "s5", "joint-exploder-list"]], - "joint-exploder-joint-callback": [[3, "s4", "joint-exploder"]], + "joint-exploder-joint-callback": [[[3, 25], "s4", "joint-exploder"]], "(event idle fort-trap-door)": [[4, "v1", "attack-info"]], "(code idle hide-light)": [[10, "v1", "art-joint-anim"]], "(event impact turret-shot)": [[11, "s4", "process-drawable"]], @@ -7060,7 +7061,7 @@ ], "(method 9 city-level-info)": [[387, "v1", "nav-segment"]], "(method 67 traffic-engine)": [ - [[137, 183], "s0", "crimson-guard"], + [[137, 185], "s0", "crimson-guard"], [[44, 86], "a3", "vehicle"] ], "set-eye-draw-flag": [[20, "s5", "eye-control"]], @@ -10151,5 +10152,8 @@ "race-birth-func-texture-position-word": [ [10, "v1", "(array int32)"], [1, "v1", "(array int32)"] - ] + ], + "(method 206 hal)": [[32, "a2", "bot"]], + "(method 209 hal)": [[32, "v1", "bot"]], + "(method 220 hal)": [[29, "v1", "bot"]] } diff --git a/decompiler/config/jak2/ntsc_v1/var_names.jsonc b/decompiler/config/jak2/ntsc_v1/var_names.jsonc index ee334eda84..4b954ab339 100644 --- a/decompiler/config/jak2/ntsc_v1/var_names.jsonc +++ b/decompiler/config/jak2/ntsc_v1/var_names.jsonc @@ -4656,5 +4656,10 @@ "s5-0": "secrets", "f30-0": "alpha" } + }, + "joint-exploder-joint-callback": { + "vars": { + "s4-0": ["exploder", "joint-exploder"] + } } } diff --git a/game/assets/jak2/text/game_custom_text_en-US.json b/game/assets/jak2/text/game_custom_text_en-US.json index de0710feae..49cdcc8a8d 100644 --- a/game/assets/jak2/text/game_custom_text_en-US.json +++ b/game/assets/jak2/text/game_custom_text_en-US.json @@ -92,7 +92,7 @@ "1251": "Enemy Health Bars", "1252": "Vehicle Health Bars", "1253": "Vehicle Invulnerability", - "1254": "Statistics Page", + "1254": "Statistics", "1255": "Automatically Grab Collectables", "1256": "Music Player", "1257": "No Textures Mode", @@ -152,6 +152,38 @@ "12a2": "Extended", "12a3": "No valid resolutions found.", "12a4": "Automatic", + "12a5": "Bestiary", + "12a6": "Other Statistics", + "12a7": "Total Killed", + "12a8": "Killed by Jak", + "12a9": "Killed by Dark Jak", + "12aa": "Killed by Daxter", + "12ab": "Killed by Others", + "12ac": "Blaster", + "12ad": "Scatter Gun", + "12ae": "Vulcan Fury", + "12af": "Peacemaker", + "12b0": "JET-Board", + "12b1": "JET-Board Trick", + "12b2": "Titan Suit Punch", + "12b3": "Titan Suit Body", + "12b4": "Gunpod", + "12b5": "Punch", + "12b6": "Flop", + "12b7": "Uppercut", + "12b8": "Spin", + "12b9": "Roll", + "12bf": "Dark Bomb", + "12c0": "Dark Blast", + "12c3": "Krimzon Guard", + "12c4": "Sig", + "12c5": "Ashelin", + "12c6": "Jinx", + "12c7": "Grim", + "12c8": "Mog", + "12c9": "Metal Heads", + "12ca": "Other Friends", + "12cb": "Other Enemies", "1300": "Auto Hide Cursor", "1301": "Reassign Binds", "1302": "Controller Binds", diff --git a/game/overlord/common/ssound.cpp b/game/overlord/common/ssound.cpp index 917b21dfc2..c04c5a963e 100644 --- a/game/overlord/common/ssound.cpp +++ b/game/overlord/common/ssound.cpp @@ -134,10 +134,12 @@ s32 CalculateAngle(Vec3w* trans) { } else { angle = angle + 90; } - } else if (diffZ >= 0) { - angle = angle + 270; } else { - angle = 270 - angle; + if (diffZ >= 0) { + angle = angle + 270; + } else { + angle = 270 - angle; + } } } @@ -170,30 +172,22 @@ s32 CalculateFalloffVolume(Vec3w* pos, s32 volume, s32 fo_curve, s32 fo_min, s32 } else { if (fo_curve == 1) { return volume; - } - - if (fo_curve < 9) { - xdiff = gEarTrans[0].x - pos->x; - ydiff = gEarTrans[0].y - pos->y; - zdiff = gEarTrans[0].z - pos->z; - } - - if (fo_curve == 9) { + } else if (fo_curve == 9) { xdiff = gEarTrans[1].x - pos->x; ydiff = gEarTrans[1].y - pos->y; zdiff = gEarTrans[1].z - pos->z; - } - - if (fo_curve == 10) { + } else if (fo_curve == 10) { xdiff = 0; ydiff = gEarTrans[0].y - pos->y; zdiff = 0; - } - - if (fo_curve == 11) { + } else if (fo_curve == 11) { xdiff = gEarTrans[1].x - pos->x; ydiff = gEarTrans[1].y - pos->y; zdiff = gEarTrans[1].z - pos->z; + } else { + xdiff = gEarTrans[0].x - pos->x; + ydiff = gEarTrans[0].y - pos->y; + zdiff = gEarTrans[0].z - pos->z; } } @@ -210,67 +204,58 @@ s32 CalculateFalloffVolume(Vec3w* pos, s32 volume, s32 fo_curve, s32 fo_min, s32 s32 min = fo_min << 8; s32 max = fo_max << 8; - if (max < xdiff || max < ydiff || max < zdiff) { - return 0; - } - - while (max > 0x7FFF) { - max >>= 1; - min >>= 1; - xdiff >>= 1; - ydiff >>= 1; - zdiff >>= 1; - } - - u32 distance = xdiff * xdiff + ydiff * ydiff + zdiff * zdiff; - if (distance != 0) { - s32 steps = 0; - while ((distance & 0xc0000000) == 0) { - distance <<= 2; - steps++; + s32 new_vol = 0; + if (xdiff <= max && ydiff <= max && zdiff <= max) { + while (max > 0x7fff) { + max >>= 1; + min >>= 1; + xdiff >>= 1; + ydiff >>= 1; + zdiff >>= 1; + } + s32 dist_squared = xdiff * xdiff + ydiff * ydiff + zdiff * zdiff; + s32 dist_steps = 0; + if (dist_squared != 0) { + while ((dist_squared & 0xc0000000) == 0) { + dist_steps = dist_steps + 1; + dist_squared <<= 2; + } + dist_steps = sqrt_table[dist_squared >> 24] >> (dist_steps & 0x1f); + } + new_vol = volume; + if (min < dist_steps) { + s32 voldiff = dist_steps - min; + if (dist_steps < max) { + dist_steps = max - min; + while (0xffff < voldiff) { + dist_steps >>= 1; + voldiff >>= 1; + } + voldiff = (voldiff << 0x10) / dist_steps; + if (voldiff != 0x10000) { + new_vol = voldiff * voldiff >> 0x10; + new_vol = gCurves[fo_curve].unk4 * 0x10000 + gCurves[fo_curve].unk3 * voldiff + + gCurves[fo_curve].unk2 * new_vol + + gCurves[fo_curve].unk1 * ((new_vol * voldiff) >> 0x10) >> + 0xc; + if (new_vol < 0) { + new_vol = 0; + } else { + if (0x10000 < new_vol) { + new_vol = 0x10000; + } + } + new_vol = (new_vol * volume) >> 0x10; + } + } else { + new_vol = 0; + } } - - distance = sqrt_table[distance >> 24] >> steps; - } else { - distance = 0; } - - if (distance <= (u32)min) { - return volume; + if (fo_curve == 11 && new_vol < 0x180) { + new_vol = 0x180; } - - if (distance >= (u32)max) { - return 0; - } - - s32 start = distance - min; - s32 end = max - min; - - while (start > 0xFFFF) { - start >>= 1; - end >>= 1; - } - - s32 v13 = (start << 16) / end; - if (v13 == 0x10000) { - return volume; - } - - s32 factor = ((gCurves[fo_curve].unk4 << 16) + gCurves[fo_curve].unk3 * v13 + - gCurves[fo_curve].unk2 * ((v13 * v13) >> 16) + - gCurves[fo_curve].unk1 * (((((v13 * v13) >> 16) * v13) >> 16) >> 16)) >> - 12; - - if (factor > 0x10000) { - factor = 0x10000; - } - - s32 ret = (factor * volume) >> 16; - if (fo_curve == 11 && ret < 0x180) { - ret = 0x180; - } - - return ret; + return new_vol; } s32 GetVolume(Sound* sound) { diff --git a/game/overlord/jak2/ssound.cpp b/game/overlord/jak2/ssound.cpp index 824e9614fd..002a5f0ac1 100644 --- a/game/overlord/jak2/ssound.cpp +++ b/game/overlord/jak2/ssound.cpp @@ -49,10 +49,10 @@ void InitSound_overlord() { StreamVoice[3] = SD_VOICE(0, 3); for (int i = 0; i < 91; i++) { - s16 opposing_front = static_cast(((i * 0x33ff) / 0x5a) + 0xc00); + s16 opposing_front = static_cast(((i * 0x33ff) / 90) + 0xc00); - s16 rear_right = static_cast(((i * -0x2800) / 0x5a) + 0x3400); - s16 rear_left = static_cast(((i * -0xbff) / 0x5a) + 0x3fff); + s16 rear_right = static_cast(((i * -0x2800) / 90) + 0x3400); + s16 rear_left = static_cast(((i * -0xbff) / 90) + 0x3fff); gPanTable[90 - i].left = 0x3FFF; gPanTable[180 - i].left = opposing_front; diff --git a/goal_src/goal-lib.gc b/goal_src/goal-lib.gc index 36e6e7e6a3..e2fef56b57 100644 --- a/goal_src/goal-lib.gc +++ b/goal_src/goal-lib.gc @@ -1034,6 +1034,15 @@ ) ) +(defmacro string->enum (enum input default) + "return the value of an enum name" + + `(case-str ,input + ,@(apply (lambda (x) `((,(symbol->string (car x))) (,enum ,(car x)))) (get-enum-vals enum)) + (else ,default) + ) + ) + (defmacro doenum (bindings &rest body) "run body while iterating through an enum. WARNING: enums are NOT A RUNTIME TYPE! There is an UNWOUND loop with body in it!! Use with caution." @@ -1042,11 +1051,12 @@ `(begin ,@(apply (lambda (x) ;; (fmt #t "{}\n" x) `(let ( - (,(first bindings) ,(symbol->string (car x))) ;; name - (,(second bindings) ,(cdr x)) ;; value + (,(car bindings) ,(symbol->string (car x))) ;; name + (,(cadr bindings) ,(cdr x)) ;; value ) ,@body - )) (get-enum-vals (third bindings)))) + )) (get-enum-vals (caddr bindings))) + ,@(cdddr bindings)) ) diff --git a/goal_src/jak1/engine/common-obs/nav-enemy.gc b/goal_src/jak1/engine/common-obs/nav-enemy.gc index 2aa8f39aa2..bf191469f7 100644 --- a/goal_src/jak1/engine/common-obs/nav-enemy.gc +++ b/goal_src/jak1/engine/common-obs/nav-enemy.gc @@ -17,7 +17,7 @@ (>= arg0 (rand-vu)) ) -(defbehavior nav-enemy-rnd-float-range nav-enemy ((arg0 float) (arg1 float)) +(defun nav-enemy-rnd-float-range ((arg0 float) (arg1 float)) (+ arg0 (* (rand-vu) (- arg1 arg0))) ) diff --git a/goal_src/jak1/pc/pckernel-common.gc b/goal_src/jak1/pc/pckernel-common.gc index 167e3a0ffd..47364e3c6e 100644 --- a/goal_src/jak1/pc/pckernel-common.gc +++ b/goal_src/jak1/pc/pckernel-common.gc @@ -587,8 +587,8 @@ ;; remember to delete this when major changes to the version number are made (when (and (= PC_KERNEL_VER_MAJOR 1) (= PC_KERNEL_VER_MINOR 10) - (or (!= PC_KERNEL_VER_BUILD (-> version build)) - (!= PC_KERNEL_VER_REVISION (-> version revision)))) + (or (> 3 (-> version build)) + (and (= 3 (-> version build)) (> 1 (-> version revision))))) ;; 1.10 upgrade: turn envmap on (set! (-> obj force-envmap?) #t) ) @@ -707,7 +707,6 @@ (("panic") (when (file-stream-read-symbol file) (reset obj #t) - (set-display-mode! obj #f #t) (return #f) ) ) diff --git a/goal_src/jak1/pc/pckernel-h.gc b/goal_src/jak1/pc/pckernel-h.gc index 62d86dc4ae..a1b8f67ebd 100644 --- a/goal_src/jak1/pc/pckernel-h.gc +++ b/goal_src/jak1/pc/pckernel-h.gc @@ -346,7 +346,8 @@ ;; get screen size and set to borderless at screen res (if retail) (pc-get-active-display-size (&-> obj width) (&-> obj height)) (if (not *debug-segment*) - (set-display-mode! obj 'borderless call-handlers)) + (set-display-mode! obj 'borderless call-handlers) + (set-display-mode! obj 'windowed call-handlers)) (set! (-> obj gfx-msaa) PC_DEFAULT_MSAA) ;; default msaa 0) diff --git a/goal_src/jak2/dgos/game.gd b/goal_src/jak2/dgos/game.gd index 8008b0c52d..208727d813 100644 --- a/goal_src/jak2/dgos/game.gd +++ b/goal_src/jak2/dgos/game.gd @@ -29,6 +29,7 @@ "dma-buffer.o" "dma-bucket.o" "dma-disasm.o" + "statistics-h.o" ;; added "pckernel-h.o" ;; added "pckernel-impl.o" ;; added "pc-debug-common.o" ;; added @@ -434,6 +435,7 @@ "nav-enemy-h.o" "rigid-body-h.o" "damage-number.o" ;; added + "statistics.o" ;; added "enemy.o" "nav-enemy.o" "base-plat.o" diff --git a/goal_src/jak2/engine/ai/enemy-h.gc b/goal_src/jak2/engine/ai/enemy-h.gc index b2a0356f8a..a403ffce33 100644 --- a/goal_src/jak2/engine/ai/enemy-h.gc +++ b/goal_src/jak2/engine/ai/enemy-h.gc @@ -16,42 +16,42 @@ (defenum enemy-flag :type int64 :bitfield #t - (lock-focus 0) - (death-start 1) - (enable-on-active 2) - (checking-water 3) - (check-water 4) - (spawn-gem 5) - (chase-startup 6) - (attackable-backup 7) - (look-at-focus 8) - (use-notice-distance 9) - (enable-on-notice 10) - (look-at-move-dest 11) - (notice 12) - (auto-reset-penetrate 13) - (jump-check-blocked 14) - (drawn-mirrored 15) - (multi-focus 16) - (alert 17) - (victory 18) - (dangerous-backup 19) - (actor-pause-backup 20) - (trackable 21) - (called-dying 22) - (check-water-backup 23) - (no-initial-move-to-ground 24) - (cam-attack-mode 25) - (trackable-backup 26) - (enable-on-hostile 27) - (directed-ready 28) - (use-trigger 29) - (directed 30) - (dislike-combo 31) - (recover-applied-velocity 32) - (vulnerable-backup 33) - (vulnerable 34) - (recover 35) + (look-at-focus 0) + (look-at-move-dest 1) + (vulnerable 2) + (vulnerable-backup 3) + (dangerous-backup 4) + (notice 5) + (alert 6) + (auto-reset-penetrate 7) + (victory 8) + (cam-attack-mode 9) + (use-notice-distance 10) + (attackable-backup 11) + (actor-pause-backup 12) + (enable-on-notice 13) + (enable-on-active 14) + (enable-on-hostile 15) + (dislike-combo 16) + (directed 17) + (directed-ready 18) + (chase-startup 19) + (lock-focus 20) + (multi-focus 21) + (use-trigger 22) + (trackable 23) + (trackable-backup 24) + (spawn-gem 25) + (check-water 26) + (check-water-backup 27) + (checking-water 28) + (recover 29) + (recover-applied-velocity 30) + (drawn-mirrored 31) + (called-dying 32) + (no-initial-move-to-ground 33) + (jump-check-blocked 34) + (death-start 35) (enemy-flag36 36) (enemy-flag37 37) (enemy-flag38 38) @@ -75,20 +75,19 @@ ) ;; ---enemy-aware - -;; +++knocked-type -(defenum knocked-type +(defenum enemy-jump-flags + :bitfield #t :type uint8 - (knocked-type-0 0) - (knocked-type-1 1) - (knocked-type-2 2) - (knocked-type-3 3) - (knocked-type-4 4) ;; what the heck is this! (its on gator, and cant trigger it for the life of me) - (knocked-type-5 5) - (knocked-type-6 6) - (knocked-type-7 7) + (enjflag-0) + (enjflag-1) + (enjflag-2) + (enjflag-3) + (enjflag-4) + (enjflag-5) + (enjflag-6) + (enjflag-7) ) -;; ---knocked-type + ;; DECOMP BEGINS @@ -202,7 +201,7 @@ (deftype enemy-jump-info (structure) - ((flags uint8) + ((flags enemy-jump-flags) (anim-speed float) (hang-time time-frame) (start-pos vector :inline) @@ -228,7 +227,7 @@ (blue-juggle-count uint8) (attacker-handle handle) (attack-time time-frame) - (penetrate-using uint64) + (penetrate-using penetrate) (attacker-pos vector :inline) (attack-direction vector :inline) ) @@ -313,7 +312,7 @@ (enemy-method-52 (_type_ vector) none) (enemy-method-53 (_type_ process-focusable) symbol) (enemy-method-54 (_type_) enemy-flag) - (track-target! (_type_) none) + (common-post (_type_) none) (damage-amount-from-attack (_type_ process event-message-block) int) (update-target-awareness! (_type_ process-focusable enemy-best-focus) enemy-aware) (enemy-method-58 (_type_ process event-message-block) symbol) @@ -322,8 +321,8 @@ (enemy-method-61 (_type_ int) int :behavior enemy) (enemy-method-62 (_type_) none) (enemy-method-63 (_type_ process-focusable enemy-aware) symbol) - (enemy-method-64 (_type_) none) - (enemy-method-65 (_type_) none) + (go-dormant (_type_) object) + (go-dormant-aware (_type_) object) (go-ambush (_type_) object) (go-stare (_type_) object) (go-stare2 (_type_) object) @@ -335,8 +334,8 @@ (general-event-handler (_type_ process int symbol event-message-block) object) (enemy-method-75 (_type_ process event-message-block) object) (enemy-method-76 (_type_ process event-message-block) symbol) - (enemy-method-77 (_type_ (pointer float)) symbol) - (enemy-method-78 (_type_ (pointer float)) symbol) + (enemy-method-77 (_type_ enemy-knocked-info) symbol) + (enemy-method-78 (_type_ enemy-knocked-info) symbol) (enemy-method-79 (_type_ int enemy-knocked-info) symbol) (enemy-method-80 (_type_ enemy-knocked-info) symbol) (enemy-method-81 (_type_) symbol) @@ -350,7 +349,7 @@ (enemy-method-89 (_type_ enemy-jump-info) symbol) (enemy-method-90 (_type_ int enemy-jump-info) symbol) (enemy-method-91 (_type_ int enemy-jump-info) none) - (enemy-method-92 (_type_ int nav-poly) none) + (enemy-method-92 (_type_ int enemy-jump-info) none) (enemy-method-93 (_type_) none) (enemy-method-94 (_type_ vector float) symbol) (enemy-method-95 (_type_ vector float) symbol) @@ -364,9 +363,9 @@ (enemy-method-103 (_type_) collide-spec) (enemy-method-104 (_type_ process touching-shapes-entry uint) symbol :behavior process) (enemy-method-105 (_type_ process) enemy-flag) - (enemy-method-106 (_type_ process object int attack-info) none :behavior enemy) + (set-incoming-attack-info (_type_ process object penetrate attack-info) none :behavior enemy) (get-enemy-target (_type_) process-focusable) - (enemy-method-108 (_type_ enemy event-message-block) int) + (enemy-method-108 (_type_ process-drawable event-message-block) int) (look-at-target! (_type_ enemy-flag) none) (stop-looking-at-target! (_type_) none) (enemy-method-111 (_type_) none :behavior enemy) @@ -375,24 +374,24 @@ (init-enemy-collision! (_type_) none) (init-enemy! (_type_) none) (go-idle (_type_) none) - (get-rand-float (_type_) float) - (get-rand-float-range (_type_ float float) float) - (get-rand-int (_type_ int) int) - (enemy-method-120 (_type_ int int) int) - (get-rand-int-range (_type_ int int) int) - (rng-hit? (_type_ float) symbol) - (enemy-method-123 (_type_ float) symbol) + (rnd-float (_type_) float) + (rnd-float-range (_type_ float float) float) + (rnd-int-count (_type_ int) int) + (rnd-bit (_type_ int int) int) + (rnd-int-range (_type_ int int) int) + (rnd-percent? (_type_ float) symbol) + (rnd-go-idle? (_type_ float) symbol) (enemy-method-124 (_type_) collide-spec) - (enemy-method-125 (_type_ collide-query collide-spec float float float) pat-surface) + (ground-pat-set! (_type_ collide-query collide-spec float float float) pat-surface) (enemy-above-ground? (_type_ collide-query vector collide-spec float float float) symbol) (enemy-method-127 (_type_ float float symbol collide-spec) symbol) (enemy-method-128 (_type_ vector move-above-ground-params) none) (enemy-method-129 (_type_) none) (enemy-method-130 (_type_ float) symbol) - (enemy-method-131 (_type_ int) uint) - (dispose! (_type_) none) + (penetrate-using->knocked (_type_ penetrate) knocked-type) + (dying (_type_) none) (enemy-method-133 (_type_) symbol) - (enemy-method-134 (_type_ process attack-info) process-focusable) + (get-attacker (_type_ process attack-info) process-focusable) (enemy-method-135 (_type_ int) sound-id) (enemy-method-136 (_type_) enemy-flag) ) @@ -411,7 +410,7 @@ (s3-0 (t9-0 this arg0)) ) (when (not s3-0) - (logclear! (-> this flags) (enemy-flag lock-focus)) + (logclear! (-> this flags) (enemy-flag look-at-focus)) (set! (-> this aware) (the-as enemy-aware @@ -429,7 +428,7 @@ ) (set! (-> this aware) arg1) (if (not v0-0) - (logclear! (-> this flags) (enemy-flag lock-focus)) + (logclear! (-> this flags) (enemy-flag look-at-focus)) ) v0-0 ) @@ -441,6 +440,6 @@ (t9-0 this) ) (set! (-> this aware) (enemy-aware enemy-aware-0)) - (logclear! (-> this flags) (enemy-flag lock-focus)) + (logclear! (-> this flags) (enemy-flag look-at-focus)) (none) ) diff --git a/goal_src/jak2/engine/ai/enemy.gc b/goal_src/jak2/engine/ai/enemy.gc index d2dc71999d..7b82342313 100644 --- a/goal_src/jak2/engine/ai/enemy.gc +++ b/goal_src/jak2/engine/ai/enemy.gc @@ -31,41 +31,40 @@ (call-parent-method this arg0) ) -(defmethod get-rand-float ((this enemy)) +(defmethod rnd-float ((this enemy)) "@returns the result of calling [[rand-vu]]" (rand-vu) ) -(defmethod get-rand-float-range ((this enemy) (low float) (high float)) +(defmethod rnd-float-range ((this enemy) (low float) (high float)) "@param low The lower bound of the range (inclusive) @param high The upper bound of the range (exclusive) @returns A random float in the specified range" (+ low (* (rand-vu) (- high low))) ) -(defmethod get-rand-int ((this enemy) (high int)) +(defmethod rnd-int-count ((this enemy) (high int)) "@param high The upper bound of the range (exclusive) @returns a random integer in the range 0 to `high` @see [[rand-vu]]" (the int (* (rand-vu) (the float high))) ) -(defmethod get-rand-int-range ((this enemy) (low int) (high int)) +(defmethod rnd-int-range ((this enemy) (low int) (high int)) "@param low The lower bound of the range (inclusive) @param high The upper bound of the range (exclusive) @returns A random integer in the specified range" (+ low (the int (* (rand-vu) (the float (+ (- 1 low) high))))) ) -(defmethod rng-hit? ((this enemy) (chance float)) - "TODO - not the best name -@param chance The value to compare ([[>=]]) with the result from [[rand-vu]]. +(defmethod rnd-percent? ((this enemy) (chance float)) + "@param chance The value to compare ([[>=]]) with the result from [[rand-vu]]. @returns If `chance` is greater than the random draw" (>= chance (rand-vu)) ) ;; WARN: new jak 2 until loop case, check carefully -(defmethod enemy-method-120 ((this enemy) (arg0 int) (arg1 int)) +(defmethod rnd-bit ((this enemy) (arg0 int) (arg1 int)) "TODO" (let ((v1-0 0) (s5-0 0) @@ -80,7 +79,7 @@ ) ) (when (> v1-0 0) - (let ((v1-1 (get-rand-int this v1-0)) + (let ((v1-1 (rnd-int-count this v1-0)) (a0-1 1) ) (until #f @@ -105,7 +104,7 @@ ) ) -(defmethod enemy-method-123 ((this enemy) (arg0 float)) +(defmethod rnd-go-idle? ((this enemy) (arg0 float)) "TODO" (let* ((v1-5 (-> *display* frames (-> *display* last-screen) run-time)) (f1-2 (fmax 0.0 (fmin 1.0 (* 0.001 (+ -7000.0 (the float v1-5)))))) @@ -116,7 +115,7 @@ (defmethod coin-flip? ((this enemy)) "@returns The result of a 50/50 RNG roll" - (zero? (get-rand-int this 2)) + (zero? (rnd-int-count this 2)) ) ;; WARN: disable def twice: 40. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. @@ -178,7 +177,7 @@ (defmethod enemy-method-124 ((this enemy)) "TODO" (let* ((v1-0 (-> this enemy-info)) - (v0-0 (if (logtest? (enemy-flag use-trigger) (-> this enemy-flags)) + (v0-0 (if (logtest? (enemy-flag recover) (-> this enemy-flags)) (-> v1-0 recover-gnd-collide-with) (-> v1-0 gnd-collide-with) ) @@ -206,7 +205,7 @@ (water-info-init! s4-0 s5-0 (collide-action solid semi-solid)) (let ((s3-0 (-> s5-0 flags))) (when (logtest? (water-flags touch-water) s3-0) - (logior! (-> this enemy-flags) (enemy-flag directed-ready)) + (logior! (-> this enemy-flags) (enemy-flag checking-water)) (set! (-> this water-surface-height) (-> s5-0 trans y)) (when (not (focus-test? this touch-water under-water)) (let ((s2-0 (new 'stack-no-clear 'vector))) @@ -277,15 +276,15 @@ ) ) (logclear! (-> this focus-status) (focus-status touch-water under-water)) - (when (not (logtest? (enemy-flag use-trigger) (-> this enemy-flags))) - (let ((v0-9 (logclear (-> this enemy-flags) (enemy-flag directed-ready)))) + (when (not (logtest? (enemy-flag recover) (-> this enemy-flags))) + (let ((v0-9 (logclear (-> this enemy-flags) (enemy-flag checking-water)))) (set! (-> this enemy-flags) v0-9) v0-9 ) ) ) -(defmethod track-target! ((self enemy)) +(defmethod common-post ((self enemy)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -294,7 +293,7 @@ (set-time! (-> self last-draw-time)) ) (enemy-method-129 self) - (if (logtest? (enemy-flag use-trigger) (-> self enemy-flags)) + (if (logtest? (enemy-flag recover) (-> self enemy-flags)) (enemy-method-100 self) ) (when *target* @@ -305,7 +304,7 @@ )) ) (when (nonzero? (-> self neck)) - (when (logtest? (-> self enemy-flags) (enemy-flag lock-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag look-at-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)) @@ -313,10 +312,10 @@ ) ) ) - (when (and (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) + (when (and (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) (time-elapsed? (-> self auto-reset-penetrate-time) (seconds 0.1)) ) - (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) + (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) (set! (-> self root penetrated-by) (get-penetrate-info self)) (let ((v1-48 0)) (if (logtest? (penetrate knocked) (-> self root penetrate-using)) @@ -325,10 +324,10 @@ (set! (-> self root penetrate-using) (the-as penetrate v1-48)) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) (enemy-method-136 self) ) - (if (logtest? (enemy-flag trackable-backup directed-ready) (-> self enemy-flags)) + (if (logtest? (enemy-flag check-water checking-water) (-> self enemy-flags)) (enemy-method-54 self) ) (if (and *debug-segment* (-> self enemy-info debug-draw-neck) (nonzero? (-> self neck))) @@ -348,7 +347,7 @@ ) ) ) - (let ((v0-0 (logclear (-> this enemy-flags) (enemy-flag look-at-focus)))) + (let ((v0-0 (logclear (-> this enemy-flags) (enemy-flag victory)))) (set! (-> this enemy-flags) v0-0) v0-0 ) @@ -408,7 +407,7 @@ ) (defmethod enemy-method-62 ((this enemy)) - (when (not (logtest? (enemy-flag actor-pause-backup) (-> this enemy-flags))) + (when (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) (let* ((s4-0 (handle->process (-> this incoming attacker-handle))) (s5-0 (if (type? s4-0 process-focusable) s4-0 @@ -417,7 +416,7 @@ ) (when (enemy-method-53 this (the-as process-focusable s5-0)) (enemy-method-63 this (the-as process-focusable s5-0) (the-as enemy-aware #f)) - (logior! (-> this focus flags) (enemy-flag lock-focus)) + (logior! (-> this focus flags) (enemy-flag look-at-focus)) ) ) ) @@ -425,16 +424,16 @@ (none) ) -(defmethod enemy-method-108 ((this enemy) (arg0 enemy) (arg1 event-message-block)) +(defmethod enemy-method-108 ((this enemy) (arg0 process-drawable) (arg1 event-message-block)) (let ((s4-0 (the-as touching-shapes-entry (-> arg1 param 0)))) (when (and s4-0 - (and (logtest? (-> this incoming penetrate-using) 4096) - (not (logtest? (-> this incoming penetrate-using) 32)) + (and (logtest? (-> this incoming penetrate-using) (penetrate board)) + (not (logtest? (-> this incoming penetrate-using) (penetrate spin))) ) (begin (let ((s3-0 (-> s4-0 head))) (while s3-0 - (let ((s2-0 (get-touched-prim s3-0 (-> arg0 root) s4-0))) + (let ((s2-0 (get-touched-prim s3-0 (the-as collide-shape (-> arg0 root)) s4-0))) (get-touched-prim s3-0 (-> this root) s4-0) (when (logtest? (-> s2-0 prim-core action) (collide-action solid semi-solid deadly)) (let* ((a0-5 this) @@ -462,8 +461,7 @@ 0 ) -;; WARN: Return type mismatch object vs none. -(defmethod enemy-method-64 ((this enemy)) +(defmethod go-dormant ((this enemy)) (let ((v1-1 (-> this root root-prim))) (set! (-> v1-1 prim-core collide-as) (collide-spec)) (set! (-> v1-1 prim-core collide-with) (collide-spec)) @@ -472,11 +470,9 @@ (logior! (-> this draw status) (draw-control-status no-draw)) (logior! (-> this focus-status) (focus-status disable)) (go (method-of-object this dormant)) - (none) ) -;; WARN: Return type mismatch object vs none. -(defmethod enemy-method-65 ((this enemy)) +(defmethod go-dormant-aware ((this enemy)) (let ((v1-1 (-> this root root-prim))) (set! (-> v1-1 prim-core collide-as) (collide-spec)) (set! (-> v1-1 prim-core collide-with) (collide-spec)) @@ -485,7 +481,6 @@ (logior! (-> this draw status) (draw-control-status no-draw)) (logior! (-> this focus-status) (focus-status disable)) (go (method-of-object this dormant-aware)) - (none) ) (defmethod go-stare ((this enemy)) @@ -537,7 +532,7 @@ ;; WARN: Return type mismatch object vs none. (defmethod enemy-method-93 ((this enemy)) - (if (logtest? (enemy-flag alert) (-> this enemy-flags)) + (if (logtest? (enemy-flag directed) (-> this enemy-flags)) (go-directed this) (react-to-focus this) ) @@ -617,7 +612,7 @@ (shove-up (-> this enemy-info attack-shove-up)) (mode (-> this enemy-info attack-mode)) (damage (the float v1-1)) - (knock (the-as uint 8)) + (knock (knocked-type knocked-type-8)) ) ) ) @@ -639,13 +634,13 @@ ) (when (enemy-method-53 this (the-as process-focusable s5-0)) (let ((v1-10 (handle->process (-> this focus handle)))) - (when (or (= s5-0 v1-10) (and (not (logtest? (enemy-flag actor-pause-backup) (-> this enemy-flags))) - (or (not v1-10) (not (logtest? (-> this focus flags) (enemy-flag lock-focus)))) + (when (or (= s5-0 v1-10) (and (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) + (or (not v1-10) (not (logtest? (-> this focus flags) (enemy-flag look-at-focus)))) ) ) (enemy-method-63 this (the-as process-focusable s5-0) (the-as enemy-aware #f)) (set-time! (-> this hit-focus-time)) - (let ((v0-3 (logior (-> this enemy-flags) (enemy-flag look-at-focus)))) + (let ((v0-3 (logior (-> this enemy-flags) (enemy-flag victory)))) (set! (-> this enemy-flags) v0-3) v0-3 ) @@ -656,7 +651,7 @@ ) (defmethod enemy-method-49 ((this enemy)) - (logior! (-> this enemy-flags) (enemy-flag attackable-backup)) + (logior! (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) (let ((v0-0 (current-time))) (set! (-> this auto-reset-penetrate-time) v0-0) v0-0 @@ -675,50 +670,50 @@ (vector-xz-normalize! arg0 1.0) ) -;; WARN: Return type mismatch int vs uint. -(defmethod enemy-method-131 ((this enemy) (arg0 int)) - (the-as uint (cond - ((logtest? arg0 1024) - 7 - ) - ((logtest? #x1000000 arg0) - 6 - ) - ((logtest? #x4400000 arg0) - 4 - ) - ((logtest? #x800000 arg0) - 5 - ) - ((logtest? #xc0000 arg0) - 3 - ) - ((logtest? #xa200000 arg0) - 2 - ) - ((logtest? arg0 #x4000) - 1 - ) - (else - 0 - ) - ) +;; WARN: Return type mismatch int vs knocked-type. +(defmethod penetrate-using->knocked ((this enemy) (arg0 penetrate)) + (the-as knocked-type (cond + ((logtest? arg0 (penetrate vehicle)) + 7 + ) + ((logtest? (penetrate jak-blue-shot) arg0) + 6 + ) + ((logtest? (penetrate jak-yellow-shot enemy-yellow-shot) arg0) + 4 + ) + ((logtest? (penetrate jak-red-shot) arg0) + 5 + ) + ((logtest? (penetrate dark-bomb dark-giant) arg0) + 3 + ) + ((logtest? (penetrate explode jak-dark-shot enemy-dark-shot) arg0) + 2 + ) + ((logtest? arg0 (penetrate mech-punch)) + 1 + ) + (else + 0 + ) + ) ) ) -(defmethod enemy-method-106 ((this enemy) (arg0 process) (arg1 object) (arg2 int) (arg3 attack-info)) - (set! (-> this incoming penetrate-using) (the-as uint arg2)) +(defmethod set-incoming-attack-info ((this enemy) (arg0 process) (arg1 object) (arg2 penetrate) (arg3 attack-info)) + (set! (-> this incoming penetrate-using) arg2) (set! (-> this incoming attack-id) (-> arg3 id)) (let ((v1-3 (if (logtest? (attack-mask knock) (-> arg3 mask)) (-> arg3 knock) - (enemy-method-131 this arg2) + (penetrate-using->knocked this arg2) ) ) ) - (set! (-> this incoming knocked-type) (the-as knocked-type v1-3)) + (set! (-> this incoming knocked-type) v1-3) (let ((a0-4 (current-time))) (cond - ((!= v1-3 6) + ((!= v1-3 (knocked-type knocked-type-6)) (set! (-> this incoming blue-juggle-count) (the-as uint 0)) 0 ) @@ -732,7 +727,7 @@ (set! (-> this incoming attack-time) a0-4) ) (cond - ((= v1-3 7) + ((= v1-3 (knocked-type knocked-type-7)) (set! (-> this incoming attack-direction quad) (-> arg3 vector quad)) ) (else @@ -744,7 +739,7 @@ ) ) ) - (set! (-> this incoming attacker-handle) (process->handle (enemy-method-134 this arg0 arg3))) + (set! (-> this incoming attacker-handle) (process->handle (get-attacker this arg0 arg3))) 0 (none) ) @@ -753,13 +748,13 @@ "Logic for looking at the target that is locked on, sets some flags and adjusts the neck to look at the target if available @param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" (case arg0 - (((enemy-flag lock-focus)) - (logclear! (-> this enemy-flags) (enemy-flag death-start)) - (logior! (-> this enemy-flags) (enemy-flag lock-focus)) + (((enemy-flag look-at-focus)) + (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logior! (-> this enemy-flags) (enemy-flag look-at-focus)) ) - (((enemy-flag death-start)) - (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) - (logior! (-> this enemy-flags) (enemy-flag death-start)) + (((enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag look-at-focus)) + (logior! (-> this enemy-flags) (enemy-flag look-at-move-dest)) ) ) (if (nonzero? (-> this neck)) @@ -772,14 +767,14 @@ (defmethod stop-looking-at-target! ((this enemy)) "Will unset [[enemy-flag::death-start]] and [[enemy-flag::lock-focus]] and call [[joint-mod::shut-down]] if applicable" (when (nonzero? (-> this neck)) - (logclear! (-> this enemy-flags) (enemy-flag lock-focus death-start)) + (logclear! (-> this enemy-flags) (enemy-flag look-at-focus look-at-move-dest)) (shut-down (-> this neck)) ) 0 (none) ) -(defmethod enemy-method-125 ((this enemy) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) +(defmethod ground-pat-set! ((this enemy) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) (when (find-ground (-> this root) arg0 arg1 arg2 arg3 arg4) (let ((v0-1 (-> arg0 best-other-tri pat))) (set! (-> this root ground-pat) v0-1) @@ -797,7 +792,7 @@ (defmethod enemy-method-127 ((this enemy) (arg0 float) (arg1 float) (arg2 symbol) (arg3 collide-spec)) (let ((s4-0 (new 'stack-no-clear 'collide-query))) (cond - ((enemy-method-125 this s4-0 arg3 arg0 arg1 1024.0) + ((ground-pat-set! this s4-0 arg3 arg0 arg1 1024.0) (let ((s5-1 (-> this root))) (let ((s3-0 (new 'stack-no-clear 'vector))) (set! (-> s3-0 quad) (-> this root trans quad)) @@ -872,7 +867,7 @@ (set! (-> arg1 new-pos quad) (-> gp-0 trans quad)) (let ((s2-0 (new 'stack-no-clear 'collide-query))) (cond - ((enemy-method-125 this s2-0 (-> arg1 gnd-collide-with) (-> arg1 popup) 81920.0 1024.0) + ((ground-pat-set! this s2-0 (-> arg1 gnd-collide-with) (-> arg1 popup) 81920.0 1024.0) (when (>= (-> gp-0 gspot-pos y) (-> arg1 new-pos y)) (set! (-> arg1 on-ground?) #t) (set! (-> arg1 pat) (-> s2-0 best-other-tri pat)) @@ -1016,11 +1011,11 @@ (set! (-> a0-2 param1) #f) (set! (-> a0-2 param2) #f) ) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag dislike-combo) (-> this enemy-flags)))) + (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag drawn-mirrored) (-> this enemy-flags)))) ) (logior! (-> this mask) (process-mask enemy)) (logior! (-> this mask) (process-mask actor-pause)) - (logior! (-> this enemy-flags) (enemy-flag notice)) + (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (set-enemy-info! this arg0) (let ((a1-2 (-> this enemy-info idle-anim-script))) (if a1-2 @@ -1095,13 +1090,13 @@ (set! (-> this on-hostile) (res-lump-struct (-> this entity) 'on-hostile pair)) (set! (-> this on-death) (res-lump-struct (-> this entity) 'on-death pair)) (if (-> this on-notice) - (logior! (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) + (logior! (-> this enemy-flags) (enemy-flag enable-on-notice)) ) (if (-> this on-active) - (logior! (-> this enemy-flags) (enemy-flag jump-check-blocked)) + (logior! (-> this enemy-flags) (enemy-flag enable-on-active)) ) (if (-> this on-hostile) - (logior! (-> this enemy-flags) (enemy-flag drawn-mirrored)) + (logior! (-> this enemy-flags) (enemy-flag enable-on-hostile)) ) (let ((s4-0 (-> this root))) (set! (-> this penetrated-by-all) (-> s4-0 penetrated-by)) @@ -1110,32 +1105,26 @@ ) (set! (-> this penetrated-flinch) (-> arg0 penetrate-flinch)) (set! (-> this penetrated-knocked) (-> arg0 penetrate-knocked)) - (set! (-> this reaction-time) (the-as time-frame (get-rand-int-range this 30 180))) + (set! (-> this reaction-time) (the-as time-frame (rnd-int-range this 30 180))) (let* ((v1-79 (-> this enemy-flags)) (a0-28 (-> this fact enemy-options)) - (v1-80 (logior (enemy-flag - enable-on-active - checking-water - enable-on-notice - look-at-move-dest - check-water-backup - no-initial-move-to-ground - ) - v1-79 - ) - ) + (v1-80 + (logior (enemy-flag vulnerable vulnerable-backup use-notice-distance attackable-backup trackable trackable-backup) + v1-79 + ) + ) ) (if (logtest? (enemy-option multi-focus) a0-28) - (set! v1-80 (logior (enemy-flag trackable) v1-80)) + (set! v1-80 (logior (enemy-flag multi-focus) v1-80)) ) (if (logtest? (enemy-option has-trigger) a0-28) - (set! v1-80 (logior (enemy-flag called-dying) v1-80)) + (set! v1-80 (logior (enemy-flag use-trigger) v1-80)) ) (set! (-> this enemy-flags) v1-80) ) (logior! (-> this mask) (process-mask collectable)) (if (and (-> this enemy-info move-to-ground) - (not (logtest? (enemy-flag vulnerable-backup) (-> this enemy-flags))) + (not (logtest? (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) (not (logtest? (enemy-option ambush) (-> this fact enemy-options))) ) (enemy-method-127 this 40960.0 40960.0 #t (the-as collide-spec (-> this gnd-collide))) @@ -1155,10 +1144,12 @@ ) ) (if (-> arg1 directed?) - (logior! (-> self enemy-flags) (enemy-flag alert)) + (logior! (-> self enemy-flags) (enemy-flag directed)) ) (if (-> arg1 no-initial-move-to-ground?) - (set! (-> self enemy-flags) (the-as enemy-flag (logior (enemy-flag vulnerable-backup) (-> self enemy-flags)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logior (enemy-flag no-initial-move-to-ground) (-> self enemy-flags))) + ) ) (init-enemy-collision! self) (set! (-> self root trans quad) (-> arg1 trans quad)) @@ -1197,13 +1188,13 @@ (go-virtual view-anims) ) ((logtest? (enemy-option dormant) v1-43) - (enemy-method-64 self) + (go-dormant self) ) - ((logtest? (enemy-flag alert) (-> self enemy-flags)) + ((logtest? (enemy-flag directed) (-> self enemy-flags)) (go-directed self) ) ((logtest? (enemy-option dormant-aware) v1-43) - (enemy-method-65 self) + (go-dormant-aware self) ) ((logtest? (enemy-option ambush) (-> self fact enemy-options)) (go-ambush self) @@ -1263,10 +1254,10 @@ This commonly includes things such as: (go (method-of-object this view-anims)) ) ((logtest? (enemy-option dormant) v1-28) - (enemy-method-64 this) + (go-dormant this) ) ((logtest? (enemy-option dormant-aware) v1-28) - (enemy-method-65 this) + (go-dormant-aware this) ) (else (go-idle this) @@ -1307,9 +1298,9 @@ This commonly includes things such as: (let ((v1-4 (-> this enemy-flags))) (cond ((and a1-0 (not (logtest? (-> (the-as process-focusable a1-0) focus-status) (focus-status disable dead)))) - (when (and (logtest? (enemy-flag trackable) v1-4) - (not (logtest? (enemy-flag actor-pause-backup) v1-4)) - (not (logtest? (-> gp-0 flags) (enemy-flag lock-focus))) + (when (and (logtest? (enemy-flag multi-focus) v1-4) + (not (logtest? (enemy-flag lock-focus) v1-4)) + (not (logtest? (-> gp-0 flags) (enemy-flag look-at-focus))) ) (enemy-method-97 this) (return #f) @@ -1323,7 +1314,7 @@ This commonly includes things such as: ) (set! (-> gp-0 aware) (the-as enemy-aware v1-14)) (if (>= 1 v1-14) - (logclear! (-> gp-0 flags) (enemy-flag lock-focus)) + (logclear! (-> gp-0 flags) (enemy-flag look-at-focus)) ) ) (return #f) @@ -1339,7 +1330,7 @@ This commonly includes things such as: (clear-focused gp-0) ) ) - (if (not (logtest? (enemy-flag actor-pause-backup) (-> this enemy-flags))) + (if (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) (enemy-method-97 this) ) (none) @@ -1464,7 +1455,7 @@ This commonly includes things such as: (if (< 1 (the-as int (-> this focus aware))) (set! f0-1 (+ (the-as meters f0-1) (-> this enemy-info notice-distance-delta))) ) - (when (or (< f30-0 f0-1) (not (logtest? (-> this enemy-flags) (enemy-flag enable-on-notice)))) + (when (or (< f30-0 f0-1) (not (logtest? (-> this enemy-flags) (enemy-flag use-notice-distance)))) (set! s2-0 (in-aggro-range? this arg0 (the-as vector #f))) (if s2-0 (set! s3-1 #t) @@ -1496,7 +1487,7 @@ This commonly includes things such as: ) ) ) - (when (and (> s3-2 0) (logtest? (enemy-flag called-dying) (-> this enemy-flags))) + (when (and (> s3-2 0) (logtest? (enemy-flag use-trigger) (-> this enemy-flags))) (cond ((logtest? (enemy-option idle-til-trigger) (-> this fact enemy-options)) (if (not (enemy-method-130 this f30-0)) @@ -1546,7 +1537,7 @@ This commonly includes things such as: ) (label cfg-17) (when (zero? t1-1) - (logclear! (-> this enemy-flags) (enemy-flag called-dying)) + (logclear! (-> this enemy-flags) (enemy-flag use-trigger)) (return #t) ) ) @@ -1559,18 +1550,18 @@ This commonly includes things such as: (let ((v1-1 (< 1 arg0))) (cond (v1-1 - (when (not (logtest? (-> this enemy-flags) (enemy-flag spawn-gem))) - (logior! (-> this enemy-flags) (enemy-flag spawn-gem)) + (when (not (logtest? (-> this enemy-flags) (enemy-flag notice))) + (logior! (-> this enemy-flags) (enemy-flag notice)) (set-time! (-> this notice-time)) ) - (if (and (not (logtest? (-> this enemy-flags) (enemy-flag chase-startup))) + (if (and (not (logtest? (-> this enemy-flags) (enemy-flag alert))) (not (time-elapsed? (-> this notice-time) (-> this reaction-time))) ) (set! v1-1 #f) ) ) (else - (logclear! (-> this enemy-flags) (enemy-flag spawn-gem)) + (logclear! (-> this enemy-flags) (enemy-flag notice)) ) ) (cond @@ -1594,18 +1585,18 @@ This commonly includes things such as: (cond ((= arg2 'track) (and (nonzero? (-> this hit-points)) - (logtest? (-> this enemy-flags) (enemy-flag enable-on-active)) - (logtest? (enemy-flag check-water-backup) (-> this enemy-flags)) + (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) + (logtest? (enemy-flag trackable) (-> this enemy-flags)) ) ) ((= arg2 'combo) - (and (not (logtest? (enemy-flag multi-focus) (-> this enemy-flags))) (nonzero? (-> this hit-points))) + (and (not (logtest? (enemy-flag dislike-combo) (-> this enemy-flags))) (nonzero? (-> this hit-points))) ) ((= arg2 'touch) (enemy-method-75 this arg0 arg3) ) ((= arg2 'touched) - (when (logtest? (-> this enemy-flags) (enemy-flag attackable-backup)) + (when (logtest? (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) (let* ((s3-1 arg0) (v1-20 (if (type? s3-1 process-drawable) (the-as process-drawable s3-1) @@ -1659,16 +1650,16 @@ This commonly includes things such as: (let ((s2-0 (the-as object (-> arg3 param 1)))) (when (!= (-> (the-as attack-info s2-0) id) (-> this incoming attack-id)) (cond - ((and (logtest? (-> this enemy-flags) (enemy-flag enable-on-active)) + ((and (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) (not (logtest? (-> this focus-status) (focus-status grabbed))) ) (let* ((s1-0 this) - (s0-0 (method-of-object s1-0 enemy-method-106)) + (s0-0 (method-of-object s1-0 set-incoming-attack-info)) ) (set! sv-432 arg0) (set! sv-448 arg3) (let ((a3-3 (get-penetrate-using-from-attack-event (the-as process-drawable arg0) arg3))) - (s0-0 s1-0 sv-432 sv-448 (the-as int a3-3) (the-as attack-info s2-0)) + (s0-0 s1-0 sv-432 sv-448 a3-3 (the-as attack-info s2-0)) ) ) (send-event (ppointer->process (-> this parent)) 'child-hit) @@ -1692,14 +1683,14 @@ This commonly includes things such as: (#t (take-damage-from-attack this arg0 arg3))) ) - (let ((s2-1 (the-as attack-info (enemy-method-58 this arg0 arg3)))) + (let ((s2-1 (enemy-method-58 this arg0 arg3))) (when s2-1 - (logclear! (-> this enemy-flags) (enemy-flag called-dying)) - (enemy-method-108 this (the-as enemy arg0) arg3) + (logclear! (-> this enemy-flags) (enemy-flag use-trigger)) + (enemy-method-108 this (the-as process-drawable 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 message) 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)) @@ -1723,15 +1714,15 @@ This commonly includes things such as: (when (zero? (-> this hit-points)) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (kill-prefer-falling this) @@ -1741,15 +1732,15 @@ This commonly includes things such as: ((= arg2 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (when (zero? (-> this hit-points)) @@ -1765,15 +1756,15 @@ This commonly includes things such as: ((= arg2 'hit) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (if (zero? (-> this hit-points)) @@ -1786,9 +1777,9 @@ This commonly includes things such as: (zero? (-> this fated-time)) (not (logtest? (-> this focus-status) (focus-status grabbed))) ) - (let ((v1-162 (logtest? (enemy-flag alert) (-> this enemy-flags)))) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) - (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) + (let ((v1-162 (logtest? (enemy-flag directed) (-> this enemy-flags)))) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance directed directed-ready use-trigger)) + (logior! (-> this enemy-flags) (enemy-flag chase-startup)) (logclear! (-> this mask) (process-mask actor-pause)) (cond (v1-162 @@ -1816,7 +1807,7 @@ This commonly includes things such as: (zero? (-> this fated-time)) (not (logtest? (-> this focus-status) (focus-status grabbed))) ) - (logclear! (-> this enemy-flags) (enemy-flag alert victory called-dying)) + (logclear! (-> this enemy-flags) (enemy-flag directed directed-ready use-trigger)) (if (logtest? (enemy-option ambush) (-> this fact enemy-options)) (go-ambush this) (react-to-focus this) @@ -1836,7 +1827,7 @@ This commonly includes things such as: ) ) ((= arg2 'death-start) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag recover) (-> this enemy-flags)))) + (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag death-start) (-> this enemy-flags)))) (send-event (ppointer->process (-> this parent)) 'child-die) (drop-pickup (-> this fact) #t *entity-pool* (-> this fact) 0) (let ((s5-1 (-> this on-death))) @@ -1850,9 +1841,9 @@ This commonly includes things such as: (logior! (-> this skel effect flags) (effect-control-flag ecf2)) ) (logior! (-> this draw status) (draw-control-status no-draw)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this focus-status) (focus-status dangerous)) - (set! (-> this enemy-flags) (logclear (-> this enemy-flags) (enemy-flag check-water))) + (set! (-> this enemy-flags) (logclear (-> this enemy-flags) (enemy-flag dangerous-backup))) ) ((= arg2 'instant-death) (when (and (> (-> this hit-points) 0) (zero? (-> this fated-time))) @@ -1865,21 +1856,21 @@ This commonly includes things such as: ) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (kill-prefer-falling this) ) ) ((= arg2 'die-fast) (logior! (-> this draw status) (draw-control-status no-draw)) - (dispose! this) + (dying this) (send-event (ppointer->process (-> this parent)) 'child-die) (let ((s5-3 (-> this on-death))) (if s5-3 @@ -1955,7 +1946,7 @@ This commonly includes things such as: (let ((v1-0 (the-as attack-info (-> arg1 param 1)))) (if (logtest? (attack-mask damage) (-> v1-0 mask)) (the int (-> v1-0 damage)) - (penetrate-using->damage (the-as penetrate (-> this incoming penetrate-using))) + (penetrate-using->damage (-> this incoming penetrate-using)) ) ) ) @@ -1963,10 +1954,10 @@ This commonly includes things such as: (defmethod enemy-method-58 ((this enemy) (arg0 process) (arg1 event-message-block)) (let ((v1-0 (-> this incoming penetrate-using))) (cond - ((logtest? (the-as penetrate v1-0) (-> this penetrated-flinch)) + ((logtest? v1-0 (-> this penetrated-flinch)) 'hit-flinch ) - ((logtest? (the-as penetrate v1-0) (-> this penetrated-knocked)) + ((logtest? v1-0 (-> this penetrated-knocked)) 'hit-knocked ) (else @@ -1995,14 +1986,14 @@ This commonly includes things such as: ) ) (set! (-> this hit-points) s4-1) - (if (not (logtest? (-> this enemy-flags) (enemy-flag attackable-backup))) + (if (not (logtest? (-> this enemy-flags) (enemy-flag auto-reset-penetrate))) (set! (-> this root penetrated-by) (get-penetrate-info this)) ) (- s5-0 s4-1) ) ) -(defmethod enemy-method-134 ((this enemy) (arg0 process) (arg1 attack-info)) +(defmethod get-attacker ((this enemy) (arg0 process) (arg1 attack-info)) (find-offending-process-focusable arg0 arg1) ) @@ -2096,14 +2087,14 @@ This commonly includes things such as: ) (defbehavior enemy-simple-post enemy () - (track-target! self) + (common-post self) (update-transforms (-> self root)) 0 (none) ) (defbehavior enemy-falling-post enemy () - (logior! (-> self enemy-flags) (enemy-flag directed)) + (logior! (-> self enemy-flags) (enemy-flag recover-applied-velocity)) (let ((gp-0 (-> self root))) (cond ((focus-test? self under-water) @@ -2125,7 +2116,7 @@ This commonly includes things such as: ) ) (enemy-method-111 self) - (track-target! self) + (common-post self) (none) ) @@ -2139,7 +2130,7 @@ This commonly includes things such as: ) (defbehavior enemy-die-falling-post enemy () - (logior! (-> self enemy-flags) (enemy-flag directed)) + (logior! (-> self enemy-flags) (enemy-flag recover-applied-velocity)) (let ((gp-0 (-> self root))) (if (focus-test? self under-water) (enemy-method-47 self (-> gp-0 transv)) @@ -2159,7 +2150,7 @@ This commonly includes things such as: (move-to-point! gp-0 s5-1) ) ) - (track-target! self) + (common-post self) 0 (none) ) @@ -2170,20 +2161,20 @@ This commonly includes things such as: :enter (behavior () (set-time! (-> self state-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)) + (logclear! (-> self enemy-flags) (enemy-flag notice alert cam-attack-mode)) + (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (set! (-> self state-timeout) (seconds 0.5)) (if (-> self on-notice) - (logior! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (logior! (-> self enemy-flags) (enemy-flag enable-on-notice)) ) (if (-> self on-active) - (logior! (-> self enemy-flags) (enemy-flag jump-check-blocked)) + (logior! (-> self enemy-flags) (enemy-flag enable-on-active)) ) (if (-> self on-hostile) - (logior! (-> self enemy-flags) (enemy-flag drawn-mirrored)) + (logior! (-> self enemy-flags) (enemy-flag enable-on-hostile)) ) - (when (not (logtest? (enemy-flag dangerous-backup) (-> self enemy-flags))) - (if (logtest? (-> self enemy-flags) (enemy-flag notice)) + (when (not (logtest? (enemy-flag chase-startup) (-> self enemy-flags))) + (if (logtest? (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logior! (-> self mask) (process-mask actor-pause)) (logclear! (-> self mask) (process-mask actor-pause)) ) @@ -2221,8 +2212,8 @@ This commonly includes things such as: 0 (logior! (-> self draw status) (draw-control-status no-draw)) (set! (-> self draw origin quad) (-> self root trans quad)) - (if (logtest? (enemy-flag alert) (-> self enemy-flags)) - (logior! (-> self enemy-flags) (enemy-flag victory)) + (if (logtest? (enemy-flag directed) (-> self enemy-flags)) + (logior! (-> self enemy-flags) (enemy-flag directed-ready)) ) (logior! (-> self focus-status) (focus-status disable)) ) @@ -2233,7 +2224,7 @@ This commonly includes things such as: (set! (-> v1-3 prim-core collide-with) (-> self root backup-collide-with)) ) (logclear! (-> self draw status) (draw-control-status no-draw)) - (logclear! (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag directed-ready)) (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) ) :code sleep-code @@ -2265,7 +2256,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logior! (-> self enemy-flags) (enemy-flag alert)) ) :code (behavior () (go-virtual notice) @@ -2277,17 +2268,17 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set-time! (-> self state-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)) + (logclear! (-> self enemy-flags) (enemy-flag cam-attack-mode)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) (let ((gp-0 (-> self on-active))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) ) ) ) - (when (not (logtest? (enemy-flag dangerous-backup) (-> self enemy-flags))) - (if (logtest? (-> self enemy-flags) (enemy-flag notice)) + (when (not (logtest? (enemy-flag chase-startup) (-> self enemy-flags))) + (if (logtest? (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logior! (-> self mask) (process-mask actor-pause)) (logclear! (-> self mask) (process-mask actor-pause)) ) @@ -2322,13 +2313,13 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set-time! (-> self state-time)) - (let ((v1-3 (logior (-> self enemy-flags) (enemy-flag use-notice-distance)))) - (set! (-> self enemy-flags) (logclear v1-3 (enemy-flag called-dying))) + (let ((v1-3 (logior (-> self enemy-flags) (enemy-flag cam-attack-mode)))) + (set! (-> self enemy-flags) (logclear v1-3 (enemy-flag use-trigger))) ) (logclear! (-> self mask) (process-mask actor-pause)) - (look-at-target! self (enemy-flag lock-focus)) - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (look-at-target! self (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -2336,7 +2327,7 @@ This commonly includes things such as: ) ) (let ((gp-1 (-> self focus aware))) - (when (logtest? (-> self enemy-flags) (enemy-flag chase-startup)) + (when (logtest? (-> self enemy-flags) (enemy-flag alert)) (cond ((and (= gp-1 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) @@ -2350,11 +2341,11 @@ This commonly includes things such as: ) ) ) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logior! (-> self enemy-flags) (enemy-flag alert)) ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) (gp-0 (new 'stack-no-clear 'vector)) ) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) @@ -2378,12 +2369,12 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set-time! (-> self state-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)) + (look-at-target! self (enemy-flag look-at-focus)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) + (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) (logclear! (-> self mask) (process-mask actor-pause)) - (when (logtest? (-> self enemy-flags) (enemy-flag drawn-mirrored)) - (logclear! (-> self enemy-flags) (enemy-flag drawn-mirrored)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-hostile)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-hostile)) (let ((gp-0 (-> self on-hostile))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -2392,7 +2383,7 @@ This commonly includes things such as: ) ) :trans (behavior () - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (let ((gp-0 (-> self focus aware))) @@ -2412,7 +2403,7 @@ This commonly includes things such as: (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -2429,7 +2420,7 @@ This commonly includes things such as: :enter (behavior () (set-time! (-> self state-time)) (logclear! (-> self mask) (process-mask actor-pause)) - (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) ) :trans (behavior () (when (time-elapsed? (-> self state-time) (seconds 0.1)) @@ -2450,7 +2441,7 @@ This commonly includes things such as: ) :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self enemy-info idle-anim))) ) (until #f @@ -2470,12 +2461,12 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (logclear! (-> self mask) (process-mask actor-pause)) ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info victory-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -2495,8 +2486,8 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set-time! (-> self state-time)) - (look-at-target! self (enemy-flag lock-focus)) - (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) + (look-at-target! self (enemy-flag look-at-focus)) + (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) (logclear! (-> self mask) (process-mask actor-pause)) ) :trans (behavior () @@ -2510,7 +2501,7 @@ This commonly includes things such as: (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -2527,8 +2518,8 @@ This commonly includes things such as: ) (defmethod enemy-method-83 ((this enemy) (arg0 enemy-jump-info)) - (set! (-> arg0 flags) (the-as uint 1)) - (set! (-> arg0 anim-speed) (get-rand-float-range this 0.9 1.1)) + (set! (-> arg0 flags) (enemy-jump-flags enjflag-0)) + (set! (-> arg0 anim-speed) (rnd-float-range this 0.9 1.1)) (set! (-> arg0 hang-time) 0) (set! (-> arg0 dest-pos quad) (-> this event-param-point quad)) (set! (-> arg0 start-pos quad) (-> this root trans quad)) @@ -2580,9 +2571,8 @@ This commonly includes things such as: (set! (-> this root transv y) 0.0) ) -(defmethod enemy-method-92 ((this enemy) (arg0 int) (arg1 nav-poly)) - "TODO - nav-poly is a guess -@abstract" +(defmethod enemy-method-92 ((this enemy) (arg0 int) (arg1 enemy-jump-info)) + "@abstract" 0 (none) ) @@ -2590,7 +2580,7 @@ This commonly includes things such as: (defmethod enemy-method-91 ((this enemy) (arg0 int) (arg1 enemy-jump-info)) (case arg0 ((2 3) - (logior! (-> this enemy-flags) (enemy-flag directed)) + (logior! (-> this enemy-flags) (enemy-flag recover-applied-velocity)) (let ((f30-0 (the float (-> arg1 hang-time)))) (let ((a1-3 (compute-trans-at-time (-> arg1 traj) f30-0 (new 'stack-no-clear 'vector)))) (move-to-point! (-> this root) a1-3) @@ -2740,7 +2730,7 @@ This commonly includes things such as: (logclear! (-> self focus-status) (focus-status in-air)) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -2750,18 +2740,18 @@ This commonly includes things such as: (let ((s5-0 0)) (enemy-method-83 self gp-0) (if (and (-> self enemy-info use-jump-blocked) - (logtest? (enemy-flag vulnerable) (-> self enemy-flags)) + (logtest? (enemy-flag jump-check-blocked) (-> self enemy-flags)) (enemy-method-82 self gp-0) ) (go-virtual jump-blocked) ) - (when (logtest? (-> gp-0 flags) 1) + (when (logtest? (-> gp-0 flags) (enemy-jump-flags enjflag-0)) (until #f (if (enemy-method-90 self s5-0 gp-0) (goto cfg-12) ) (enemy-method-91 self s5-0 gp-0) - (enemy-method-92 self s5-0 (the-as nav-poly gp-0)) + (enemy-method-92 self s5-0 gp-0) (suspend) (set! s5-0 1) ) @@ -2776,7 +2766,7 @@ This commonly includes things such as: (+! (-> 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)) + (enemy-method-92 self s5-1 gp-0) (suspend) (set! s5-1 3) ) @@ -2789,14 +2779,14 @@ This commonly includes things such as: (goto cfg-19) ) (enemy-method-91 self s5-2 gp-0) - (enemy-method-92 self s5-2 (the-as nav-poly gp-0)) + (enemy-method-92 self s5-2 gp-0) (suspend) (set! s5-2 5) ) ) #f (label cfg-19) - (if (logtest? (enemy-flag alert) (-> self enemy-flags)) + (if (logtest? (enemy-flag directed) (-> self enemy-flags)) ((lambda :behavior enemy ((arg0 enemy-jump-info)) (send-event (ppointer->process (-> self parent)) 'child-jumped) @@ -2828,7 +2818,7 @@ This commonly includes things such as: ) :trans (behavior () (when (time-elapsed? (-> self state-time) (seconds 0.5)) - (if (logtest? (enemy-flag alert) (-> self enemy-flags)) + (if (logtest? (enemy-flag directed) (-> self enemy-flags)) (go-virtual jump) (enemy-method-93 self) ) @@ -2843,7 +2833,7 @@ This commonly includes things such as: ) ) ) - (let ((f30-0 (get-rand-float-range self 0.75 1.25))) + (let ((f30-0 (rnd-float-range self 0.75 1.25))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -2865,7 +2855,7 @@ This commonly includes things such as: :code (behavior () (local-vars (v1-37 enemy-flag) (v1-45 enemy-flag)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info hit-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -2875,29 +2865,29 @@ This commonly includes things such as: (ja :num! (seek! max f30-0)) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-36 (-> self enemy-flags))) - (if (logtest? v1-36 (enemy-flag checking-water)) - (set! v1-37 (logior v1-36 (enemy-flag enable-on-active))) - (set! v1-37 (logclear v1-36 (enemy-flag enable-on-active))) + (if (logtest? v1-36 (enemy-flag vulnerable-backup)) + (set! v1-37 (logior v1-36 (enemy-flag vulnerable))) + (set! v1-37 (logclear v1-36 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-37) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-44 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-44) - (set! v1-45 (logior (enemy-flag check-water-backup) v1-44)) - (set! v1-45 (logclear v1-44 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-44) + (set! v1-45 (logior (enemy-flag trackable) v1-44)) + (set! v1-45 (logclear v1-44 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-45) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (go-hostile self) ) @@ -2906,17 +2896,17 @@ This commonly includes things such as: ;; WARN: Return type mismatch collide-spec vs none. (defmethod enemy-method-101 ((this enemy)) - (when (not (logtest? (enemy-flag use-trigger) (-> this enemy-flags))) - (logior! (-> this enemy-flags) (enemy-flag use-trigger)) - (logclear! (-> this enemy-flags) (enemy-flag directed)) + (when (not (logtest? (enemy-flag recover) (-> this enemy-flags))) + (logior! (-> this enemy-flags) (enemy-flag recover)) + (logclear! (-> this enemy-flags) (enemy-flag recover-applied-velocity)) (enemy-method-124 this) ) (none) ) (defmethod enemy-method-103 ((this enemy)) - (when (logtest? (enemy-flag use-trigger) (-> this enemy-flags)) - (logclear! (-> this enemy-flags) (enemy-flag use-trigger directed)) + (when (logtest? (enemy-flag recover) (-> this enemy-flags)) + (logclear! (-> this enemy-flags) (enemy-flag recover recover-applied-velocity)) (enemy-method-124 this) ) ) @@ -2932,7 +2922,7 @@ This commonly includes things such as: (enemy-method-103 this) (return (the-as symbol #f)) ) - (when (not (logtest? (enemy-flag directed) (-> this enemy-flags))) + (when (not (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags))) (let ((s5-0 (-> this root))) (if (focus-test? this under-water) (enemy-method-47 this (-> s5-0 transv)) @@ -2953,7 +2943,7 @@ This commonly includes things such as: ) ) ) - (logclear! (-> this enemy-flags) (enemy-flag directed)) + (logclear! (-> this enemy-flags) (enemy-flag recover-applied-velocity)) (if (and (enemy-method-102 this) (not (logtest? (-> this focus-status) (focus-status dead)))) (kill-prefer-falling this) ) @@ -2997,19 +2987,19 @@ This commonly includes things such as: (let ((s5-0 (-> this enemy-info))) (case (-> this incoming knocked-type) (((knocked-type knocked-type-2)) - (let ((f30-0 (get-rand-float-range this 0.0 1.0))) + (let ((f30-0 (rnd-float-range this 0.0 1.0))) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-hard-vxz-lo) (-> s5-0 knocked-hard-vxz-hi) f30-0)) (set! (-> arg0 y) (lerp (-> s5-0 knocked-hard-vy-lo) (-> s5-0 knocked-hard-vy-hi) f30-0)) ) ) (((knocked-type knocked-type-1)) - (let ((f30-1 (get-rand-float-range this 0.0 1.0))) + (let ((f30-1 (rnd-float-range this 0.0 1.0))) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-medium-vxz-lo) (-> s5-0 knocked-medium-vxz-hi) f30-1)) (set! (-> arg0 y) (lerp (-> s5-0 knocked-medium-vy-lo) (-> s5-0 knocked-medium-vy-hi) f30-1)) ) ) (((knocked-type knocked-type-3)) - (let ((f30-2 (get-rand-float-range this 0.0 1.0))) + (let ((f30-2 (rnd-float-range this 0.0 1.0))) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-huge-vxz-lo) (-> s5-0 knocked-huge-vxz-hi) f30-2)) (set! (-> arg0 y) (lerp (-> s5-0 knocked-huge-vy-lo) (-> s5-0 knocked-huge-vy-hi) f30-2)) ) @@ -3023,7 +3013,7 @@ This commonly includes things such as: (vector-negate! arg0 arg0) ) ) - (let ((f30-3 (get-rand-float-range this 0.0 1.0))) + (let ((f30-3 (rnd-float-range this 0.0 1.0))) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-yellow-vxz-lo) (-> s5-0 knocked-yellow-vxz-hi) f30-3)) (set! (-> arg0 y) (lerp (-> s5-0 knocked-yellow-vy-lo) (-> s5-0 knocked-yellow-vy-hi) f30-3)) ) @@ -3034,7 +3024,7 @@ This commonly includes things such as: (f2-0 61440.0) (f1-3 (fmin f1-2 (* f2-0 f2-0))) (f2-3 61440.0) - (f30-5 (* (- f0-26 (/ f1-3 (* f2-3 f2-3))) (get-rand-float-range this 0.8 1.0))) + (f30-5 (* (- f0-26 (/ f1-3 (* f2-3 f2-3))) (rnd-float-range this 0.8 1.0))) ) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-red-vxz-lo) (-> s5-0 knocked-red-vxz-hi) f30-5)) (set! (-> arg0 y) (lerp (-> s5-0 knocked-red-vy-lo) (-> s5-0 knocked-red-vy-hi) f30-5)) @@ -3046,7 +3036,7 @@ This commonly includes things such as: (f2-6 122880.0) (f1-6 (fmin f1-5 (* f2-6 f2-6))) (f2-9 122880.0) - (f30-7 (* (- f0-34 (/ f1-6 (* f2-9 f2-9))) (get-rand-float-range this 0.8 1.0))) + (f30-7 (* (- f0-34 (/ f1-6 (* f2-9 f2-9))) (rnd-float-range this 0.8 1.0))) ) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-blue-vxz-lo) (-> s5-0 knocked-blue-vxz-hi) f30-7)) (cond @@ -3054,7 +3044,7 @@ This commonly includes things such as: (set! (-> arg0 y) (lerp (-> s5-0 knocked-blue-vy-lo) (-> s5-0 knocked-blue-vy-hi) f30-7)) ) (else - (if (zero? (get-rand-int this 3)) + (if (zero? (rnd-int-count this 3)) (set! (-> arg0 y) 40960.0) ) ) @@ -3065,7 +3055,7 @@ This commonly includes things such as: (set! (-> arg0 quad) (-> this incoming attack-direction quad)) ) (else - (let ((f30-8 (get-rand-float-range this 0.0 1.0))) + (let ((f30-8 (rnd-float-range this 0.0 1.0))) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-soft-vxz-lo) (-> s5-0 knocked-soft-vxz-hi) f30-8)) (set! (-> arg0 y) (lerp (-> s5-0 knocked-soft-vy-lo) (-> s5-0 knocked-soft-vy-hi) f30-8)) ) @@ -3123,27 +3113,27 @@ This commonly includes things such as: ) ) -(defmethod enemy-method-77 ((this enemy) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this enemy) (arg0 enemy-knocked-info)) (ja-channel-push! 1 0) (let ((a1-2 (-> this draw art-group data (-> this enemy-info knocked-anim))) (a0-4 (-> this skel root-channel 0)) ) (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-2)) (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-2) num-func-seek!) ) #t ) -(defmethod enemy-method-78 ((this enemy) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this enemy) (arg0 enemy-knocked-info)) (let ((v1-4 (-> this draw art-group data (-> this enemy-info knocked-land-anim))) (a0-3 (-> this skel root-channel 0)) ) (set! (-> a0-3 frame-group) (the-as art-joint-anim v1-4)) (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim v1-4) frames num-frames) -1))) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim v1-4) num-func-seek!) ) @@ -3187,7 +3177,7 @@ This commonly includes things such as: (let ((v1-0 arg0)) (cond ((zero? v1-0) - (enemy-method-77 this (the-as (pointer float) arg1)) + (enemy-method-77 this arg1) (set! s5-0 #f) ) ((= v1-0 1) @@ -3199,7 +3189,7 @@ This commonly includes things such as: ) ) ((= v1-0 2) - (set! s5-0 (not (enemy-method-78 this (the-as (pointer float) arg1)))) + (set! s5-0 (not (enemy-method-78 this arg1))) (set! (-> this incoming blue-juggle-count) (the-as uint 0)) ) ((= v1-0 3) @@ -3228,7 +3218,7 @@ This commonly includes things such as: :enter (behavior () (set-time! (-> self state-time)) (stop-looking-at-target! self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self mask) (process-mask actor-pause)) (let* ((v1-8 *game-info*) (a0-4 (+ (-> v1-8 attack-id) 1)) @@ -3238,7 +3228,7 @@ This commonly includes things such as: ) (enemy-method-103 self) (if (logtest? (enemy-option knocked-into-water) (-> self fact enemy-options)) - (logior! (-> self enemy-flags) (enemy-flag trackable-backup)) + (logior! (-> self enemy-flags) (enemy-flag check-water)) ) (let ((v1-16 (-> self root))) (logclear! (-> v1-16 status) (collide-status @@ -3273,12 +3263,12 @@ This commonly includes things such as: (set! (-> self desired-angle) (enemy-method-51 self)) ) (if (zero? (-> self hit-points)) - (dispose! self) + (dying self) (enemy-method-135 self 0) ) (logclear! (-> self focus-status) (focus-status dangerous)) (if (= (-> self incoming knocked-type) (knocked-type knocked-type-4)) - (logclear! (-> self enemy-flags) (enemy-flag check-water-backup)) + (logclear! (-> self enemy-flags) (enemy-flag trackable)) ) (set! (-> self root penetrate-using) (penetrate lunge vehicle knocked)) (enemy-method-49 self) @@ -3287,9 +3277,9 @@ This commonly includes things such as: :exit (behavior () (local-vars (v1-1 enemy-flag) (v1-15 enemy-flag) (v1-23 enemy-flag)) (let ((v1-0 (-> self enemy-flags))) - (if (logtest? (enemy-flag enable-on-hostile) v1-0) - (set! v1-1 (logior (enemy-flag trackable-backup) v1-0)) - (set! v1-1 (logclear v1-0 (enemy-flag trackable-backup))) + (if (logtest? (enemy-flag check-water-backup) v1-0) + (set! v1-1 (logior (enemy-flag check-water) v1-0)) + (set! v1-1 (logclear v1-0 (enemy-flag check-water))) ) ) (set! (-> self enemy-flags) v1-1) @@ -3298,29 +3288,29 @@ This commonly includes things such as: (the-as penetrate (logclear (-> self root penetrate-using) (penetrate knocked))) ) (enemy-method-46 self 2) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-14 (-> self enemy-flags))) - (if (logtest? v1-14 (enemy-flag checking-water)) - (set! v1-15 (logior v1-14 (enemy-flag enable-on-active))) - (set! v1-15 (logclear v1-14 (enemy-flag enable-on-active))) + (if (logtest? v1-14 (enemy-flag vulnerable-backup)) + (set! v1-15 (logior v1-14 (enemy-flag vulnerable))) + (set! v1-15 (logclear v1-14 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-15) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-22 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-22) - (set! v1-23 (logior (enemy-flag check-water-backup) v1-22)) - (set! v1-23 (logclear v1-22 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-22) + (set! v1-23 (logior (enemy-flag trackable) v1-22)) + (set! v1-23 (logclear v1-22 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-23) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) ) ) @@ -3332,7 +3322,7 @@ This commonly includes things such as: :code (behavior () (let ((gp-0 (new 'stack-no-clear 'enemy-knocked-info))) (let ((s5-0 0)) - (set! (-> gp-0 anim-speed) (get-rand-float-range self 0.9 1.1)) + (set! (-> gp-0 anim-speed) (rnd-float-range self 0.9 1.1)) (set! (-> gp-0 on-surface-count) 0) (set! (-> gp-0 move-count) 0) (until (enemy-method-80 self gp-0) @@ -3367,7 +3357,7 @@ This commonly includes things such as: ) #f (label cfg-15) - (if (and (not (logtest? (enemy-flag recover) (-> self enemy-flags))) + (if (and (not (logtest? (enemy-flag death-start) (-> self enemy-flags))) (or (time-elapsed? (-> gp-0 land-can-land-time) (seconds 0.1)) (enemy-method-81 self) (enemy-method-102 self)) ) (kill-prefer-falling self) @@ -3380,7 +3370,7 @@ This commonly includes things such as: (cond ((or (zero? (-> self hit-points)) (nonzero? (-> self fated-time))) (cond - ((logtest? (enemy-flag recover) (-> self enemy-flags)) + ((logtest? (enemy-flag death-start) (-> self enemy-flags)) (set! (-> self hit-points) 0) (let ((v1-67 (-> self root root-prim))) (set! (-> v1-67 prim-core collide-as) (collide-spec)) @@ -3407,15 +3397,13 @@ This commonly includes things such as: :post enemy-falling-post ) -(defmethod dispose! ((this enemy)) +(defmethod dying ((this enemy)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" - (when (not (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags))) - (set! (-> this enemy-flags) - (the-as enemy-flag (logior (enemy-flag recover-applied-velocity) (-> this enemy-flags))) - ) + (when (not (logtest? (enemy-flag called-dying) (-> this enemy-flags))) + (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag called-dying) (-> this enemy-flags)))) (enemy-method-135 this 1) (when (and (>= (-> this enemy-info gem-joint) 0) - (not (logtest? (enemy-flag cam-attack-mode) (-> this enemy-flags))) + (not (logtest? (enemy-flag spawn-gem) (-> this enemy-flags))) (or (and (not (and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status save)))) (-> this entity) ) @@ -3423,7 +3411,7 @@ This commonly includes things such as: (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) ) ) - (logior! (-> this enemy-flags) (enemy-flag cam-attack-mode)) + (logior! (-> this enemy-flags) (enemy-flag spawn-gem)) (remove-from-process *part-engine* this) (setup-masks (-> this draw) @@ -3437,18 +3425,23 @@ This commonly includes things such as: (birth-pickup-at-point a0-18 (pickup-type gem) 1.0 #t *entity-pool* (-> this fact)) ) ) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag check-water)) + (logclear! (-> this enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (logior! (-> this focus-status) (focus-status dead)) (if (-> this skel effect) (logior! (-> this skel effect flags) (effect-control-flag ecf1)) ) (stop-looking-at-target! this) + ;; og:preserve-this + ;; track statistics + (#when PC_PORT + (when (zero? (-> this hit-points)) + (add-to-kill-stats this (-> this incoming)))) ) (none) ) @@ -3457,7 +3450,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (dispose! self) + (dying self) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -3469,7 +3462,7 @@ This commonly includes things such as: ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info die-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -3506,7 +3499,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (dispose! self) + (dying self) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -3514,16 +3507,16 @@ This commonly includes things such as: 0 (set! (-> self hit-points) 0) (if (logtest? (enemy-option knocked-into-water) (-> self fact enemy-options)) - (logior! (-> self enemy-flags) (enemy-flag trackable-backup)) + (logior! (-> self enemy-flags) (enemy-flag check-water)) ) (enemy-method-103 self) ) :exit (behavior () (local-vars (v0-0 enemy-flag)) (let ((v1-0 (-> self enemy-flags))) - (if (logtest? (enemy-flag enable-on-hostile) v1-0) - (set! v0-0 (logior (enemy-flag trackable-backup) v1-0)) - (set! v0-0 (logclear v1-0 (enemy-flag trackable-backup))) + (if (logtest? (enemy-flag check-water-backup) v1-0) + (set! v0-0 (logior (enemy-flag check-water) v1-0)) + (set! v0-0 (logclear v1-0 (enemy-flag check-water))) ) ) (set! (-> self enemy-flags) v0-0) @@ -3536,7 +3529,7 @@ This commonly includes things such as: ) ) ) - (f30-0 (get-rand-float-range self 0.8 1.2)) + (f30-0 (rnd-float-range self 0.8 1.2)) ) (ja-no-eval :group! gp-0 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -3557,11 +3550,11 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag victory)) + (logior! (-> self enemy-flags) (enemy-flag directed-ready)) ((-> (method-of-type enemy idle) enter)) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag directed-ready)) ) :code (-> (method-of-type enemy idle) code) :post (-> (method-of-type enemy idle) post) diff --git a/goal_src/jak2/engine/anim/fma-sphere.gc b/goal_src/jak2/engine/anim/fma-sphere.gc index dd08e62cc0..298f32bc12 100644 --- a/goal_src/jak2/engine/anim/fma-sphere.gc +++ b/goal_src/jak2/engine/anim/fma-sphere.gc @@ -56,7 +56,7 @@ (mode 'eco-red) (attacker-velocity (-> self root transv)) (damage 2.0) - (knock (the-as uint 2)) + (knock (knocked-type knocked-type-2)) ) ) ) diff --git a/goal_src/jak2/engine/anim/joint-exploder.gc b/goal_src/jak2/engine/anim/joint-exploder.gc index 26d64c7b8d..d09e512e7b 100644 --- a/goal_src/jak2/engine/anim/joint-exploder.gc +++ b/goal_src/jak2/engine/anim/joint-exploder.gc @@ -124,8 +124,8 @@ ) (defun joint-exploder-joint-callback ((arg0 draw-control) (arg1 cspace-array) (arg2 joint-control)) - (let ((s4-0 (-> arg0 process))) - (let ((s3-0 (-> (the-as joint-exploder s4-0) joints))) + (let ((exploder (the-as joint-exploder (-> arg0 process)))) + (let ((s3-0 (-> exploder joints))) (countdown (s2-0 (-> s3-0 num-joints)) (let* ((v1-3 (-> s3-0 joint s2-0)) (a0-5 (-> arg1 data (-> v1-3 joint-index) bone transform)) @@ -134,10 +134,10 @@ ) ) ) - (let ((s4-1 (&-> s4-0 stack 96))) + (let ((s4-1 (-> exploder scale-vector))) (countdown (s3-1 (-> arg1 length)) (let ((a2-2 (-> arg1 data s3-1 bone transform))) - (scale-matrix! a2-2 (the-as vector s4-1) a2-2) + (scale-matrix! a2-2 s4-1 a2-2) ) ) ) diff --git a/goal_src/jak2/engine/camera/cam-states.gc b/goal_src/jak2/engine/camera/cam-states.gc index 3ba8a349f4..8c7379e1f6 100644 --- a/goal_src/jak2/engine/camera/cam-states.gc +++ b/goal_src/jak2/engine/camera/cam-states.gc @@ -1393,94 +1393,92 @@ ) -(defun los-cw-ccw ((arg0 (inline-array collide-cache-tri)) - (arg1 vector) - (arg2 vector) - (arg3 float) - (arg4 collide-los-result) - (arg5 vector) - (arg6 float) - ) +(defbehavior los-cw-ccw camera-slave ((arg0 (inline-array collide-cache-tri)) + (arg1 vector) + (arg2 vector) + (arg3 float) + (arg4 collide-los-result) + (arg5 vector) + (arg6 float) + ) (local-vars (sv-128 float) (sv-144 vector) (sv-160 vector) (sv-176 vector) (sv-192 vector) (sv-208 int)) - (with-pp - (set! sv-128 arg3) - (let ((gp-0 arg4)) - (set! sv-144 arg5) - (let ((s4-0 arg6)) - (set! sv-160 (new 'stack-no-clear 'vector)) - (set! sv-176 (new 'stack-no-clear 'vector)) - (let ((s5-0 (new 'stack-no-clear 'matrix))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((f30-0 0.0) - (s0-0 #f) - ) - (set! sv-208 0) - (while (< sv-208 4) - (cond - ((= sv-208 3) - (vector-! sv-160 sv-144 (the-as vector (&-> pp stack 432))) - (set! (-> s5-0 vector sv-208 z) 0.0) - ) - (else - (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) - (set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down))) - (vector-! sv-160 (-> arg0 0 vertex sv-208) (the-as vector (&-> pp stack 432))) - ) - ) - (vector-flatten! sv-160 sv-160 (-> *camera* local-down)) - (vector-cross! sv-176 sv-160 arg2) - (let ((f28-0 (vector-dot sv-176 (-> *camera* local-down)))) - (cond - ((< (* f28-0 f30-0) 0.0) - (set! s0-0 #t) - ) - ((!= f28-0 0.0) - (set! f30-0 f28-0) - ) - ) - (set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2)) - (cond - ((= sv-208 3) - (vector-! sv-192 sv-144 (the-as vector (&-> pp stack 432))) - (vector-flatten! sv-192 sv-192 arg1) - ) - (else - (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)) - ) - ) - (if (< f28-0 0.0) - (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) - (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)) - ) - ) - (set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x))) - (set! sv-208 (+ sv-208 1)) + (set! sv-128 arg3) + (let ((gp-0 arg4)) + (set! sv-144 arg5) + (let ((s4-0 arg6)) + (set! sv-160 (new 'stack-no-clear 'vector)) + (set! sv-176 (new 'stack-no-clear 'vector)) + (let ((s5-0 (new 'stack-no-clear 'matrix))) + (set! sv-192 (new 'stack-no-clear 'vector)) + (let ((f30-0 0.0) + (s0-0 #f) ) + (set! sv-208 0) + (while (< sv-208 4) (cond - ((and s0-0 (!= (the-as int s4-0) -859915232)) - (dotimes (s4-1 4) - (dist-info-append (-> gp-0 straddle) (the-as vector (+ (the-as uint s5-0) (* s4-1 16)))) - ) - #f - ) - ((< (-> s5-0 trans y) 0.0) - (dotimes (s4-2 4) - (when (>= (-> s5-0 trans y) (-> s5-0 vector s4-2 y)) - (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) - (dist-info-append (-> gp-0 ccw) (the-as vector (+ (the-as uint s5-0) (* s4-2 16)))) - ) - ) - #f + ((= sv-208 3) + (vector-! sv-160 sv-144 (-> self string-trans)) + (set! (-> s5-0 vector sv-208 z) 0.0) ) (else - (dotimes (s4-3 4) - (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 trans y)) - (dist-info-append (-> gp-0 cw) (the-as vector (+ (the-as uint s5-0) (* s4-3 16)))) - ) - ) - #f + (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) + (set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down))) + (vector-! sv-160 (-> arg0 0 vertex sv-208) (-> self string-trans)) ) ) + (vector-flatten! sv-160 sv-160 (-> *camera* local-down)) + (vector-cross! sv-176 sv-160 arg2) + (let ((f28-0 (vector-dot sv-176 (-> *camera* local-down)))) + (cond + ((< (* f28-0 f30-0) 0.0) + (set! s0-0 #t) + ) + ((!= f28-0 0.0) + (set! f30-0 f28-0) + ) + ) + (set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2)) + (cond + ((= sv-208 3) + (vector-! sv-192 sv-144 (-> self string-trans)) + (vector-flatten! sv-192 sv-192 arg1) + ) + (else + (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)) + ) + ) + (if (< f28-0 0.0) + (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) + (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)) + ) + ) + (set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x))) + (set! sv-208 (+ sv-208 1)) + ) + (cond + ((and s0-0 (!= (the-as int s4-0) -859915232)) + (dotimes (s4-1 4) + (dist-info-append (-> gp-0 straddle) (the-as vector (+ (the-as uint s5-0) (* s4-1 16)))) + ) + #f + ) + ((< (-> s5-0 trans y) 0.0) + (dotimes (s4-2 4) + (when (>= (-> s5-0 trans y) (-> s5-0 vector s4-2 y)) + (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) + (dist-info-append (-> gp-0 ccw) (the-as vector (+ (the-as uint s5-0) (* s4-2 16)))) + ) + ) + #f + ) + (else + (dotimes (s4-3 4) + (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 trans y)) + (dist-info-append (-> gp-0 cw) (the-as vector (+ (the-as uint s5-0) (* s4-3 16)))) + ) + ) + #f + ) ) ) ) diff --git a/goal_src/jak2/engine/game/game-h.gc b/goal_src/jak2/engine/game/game-h.gc index d9bf675cf2..69ea5022ea 100644 --- a/goal_src/jak2/engine/game/game-h.gc +++ b/goal_src/jak2/engine/game/game-h.gc @@ -85,6 +85,23 @@ (test 22) ;; hi 64 ) +;; +++knocked-type +(defenum knocked-type + :type uint8 + (knocked-type-0 0) + (knocked-type-1 1) + (knocked-type-2 2) + (knocked-type-3 3) + (knocked-type-4 4) ;; what the heck is this! (its on gator, and cant trigger it for the life of me) + (knocked-type-5 5) + (knocked-type-6 6) + (knocked-type-7 7) + (knocked-type-8 8) + (knocked-type-9 9) + (knocked-type-10 10) + ) +;; ---knocked-type + (defmacro static-attack-info (&key (mask ()) args) (let ((mask-actual mask)) @@ -105,7 +122,7 @@ ) (defmacro new-attack-id () - "generate a new attack-id" + "generate a new attack-id. TODO remove this, it's meant to be an inlined method" `(1+! (-> *game-info* attack-id)) ) @@ -342,7 +359,7 @@ (penetrate-using penetrate) (damage float) (shield-damage float) - (knock uint8) + (knock knocked-type) (test symbol) ) (:methods diff --git a/goal_src/jak2/engine/nav/nav-enemy.gc b/goal_src/jak2/engine/nav/nav-enemy.gc index 092185489d..261612fea2 100644 --- a/goal_src/jak2/engine/nav/nav-enemy.gc +++ b/goal_src/jak2/engine/nav/nav-enemy.gc @@ -69,7 +69,7 @@ (if (<= s4-0 0) (go process-drawable-art-error "no path") ) - (let ((s2-0 (get-rand-int this s4-0)) + (let ((s2-0 (rnd-int-count this s4-0)) (s5-0 (new 'stack-no-clear 'vector)) ) (countdown (s3-0 s4-0) @@ -142,7 +142,7 @@ (enemy-method-103 this) (return (the-as symbol #f)) ) - (when (not (logtest? (enemy-flag directed) (-> this enemy-flags))) + (when (not (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags))) (let ((s5-0 (-> this root))) (if (focus-test? this under-water) (enemy-method-47 this (-> s5-0 transv)) @@ -163,7 +163,7 @@ ) ) ) - (logclear! (-> this enemy-flags) (enemy-flag directed)) + (logclear! (-> this enemy-flags) (enemy-flag recover-applied-velocity)) (if (and (enemy-method-102 this) (not (logtest? (-> this focus-status) (focus-status dead)))) (kill-prefer-falling this) ) @@ -197,7 +197,7 @@ ) ) -(defmethod track-target! ((self nav-enemy)) +(defmethod common-post ((self nav-enemy)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -206,7 +206,7 @@ (set-time! (-> self last-draw-time)) ) (enemy-method-129 self) - (when (logtest? (enemy-flag use-trigger) (-> self enemy-flags)) + (when (logtest? (enemy-flag recover) (-> self enemy-flags)) (if (-> self nav) (enemy-method-100 self) (enemy-method-103 self) @@ -221,14 +221,14 @@ ) (when (nonzero? (-> self neck)) (cond - ((logtest? (-> self enemy-flags) (enemy-flag lock-focus)) + ((logtest? (-> self enemy-flags) (enemy-flag look-at-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)) + ((logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) (let ((s5-1 (-> self move-dest)) (v1-47 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self enemy-info neck-joint))) @@ -244,10 +244,10 @@ ) ) ) - (when (and (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) + (when (and (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) (time-elapsed? (-> self auto-reset-penetrate-time) (seconds 0.1)) ) - (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) + (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) (set! (-> self root penetrated-by) (get-penetrate-info self)) (let ((v1-62 0)) (if (logtest? (penetrate knocked) (-> self root penetrate-using)) @@ -256,10 +256,10 @@ (set! (-> self root penetrate-using) (the-as penetrate v1-62)) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) (enemy-method-136 self) ) - (if (logtest? (enemy-flag trackable-backup directed-ready) (-> self enemy-flags)) + (if (logtest? (enemy-flag check-water checking-water) (-> self enemy-flags)) (enemy-method-54 self) ) (let ((v1-73 (-> self restore-nav-radius-time))) @@ -296,12 +296,14 @@ (nav-enemy-method-177 this) (cond ((nav-enemy-method-174 this) - (logior! (-> this enemy-flags) (enemy-flag directed)) + (logior! (-> this enemy-flags) (enemy-flag recover-applied-velocity)) (let ((s5-0 (-> this nav))) (when (logtest? (-> s5-0 state flags) (nav-state-flag at-gap)) (let ((s4-0 (new 'stack-no-clear 'nav-gap-info))) (when (plan-over-pat1-polys-using-route (-> s5-0 state) s4-0) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag vulnerable) (-> this enemy-flags)))) + (set! (-> this enemy-flags) + (the-as enemy-flag (logior (enemy-flag jump-check-blocked) (-> this enemy-flags))) + ) (send-event this 'jump 1 (-> s4-0 dest)) ) ) @@ -335,7 +337,7 @@ 0 ) ) - (track-target! this) + (common-post this) (update-transforms (-> this root)) 0 (none) @@ -530,7 +532,7 @@ ) (set! (-> s5-0 y) 0.0) (vector-normalize! s5-0 1.0) - + ;; og:preserve-this modified for PC, see comment near definition in collide-shape-h.gc (normalized-heading-to-quaternion! (-> this root quat) s5-0) ) @@ -1066,11 +1068,11 @@ (set! (-> a0-2 param1) #f) (set! (-> a0-2 param2) #f) ) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag dislike-combo) (-> this enemy-flags)))) + (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag drawn-mirrored) (-> this enemy-flags)))) ) (logior! (-> this mask) (process-mask enemy)) (logior! (-> this mask) (process-mask actor-pause)) - (logior! (-> this enemy-flags) (enemy-flag notice)) + (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (set! (-> this nav-radius-backup) (-> this root nav-radius)) (set-enemy-info! this arg0) (set! (-> this enemy-info callback-info) *nav-enemy-callback-info*) @@ -1180,13 +1182,13 @@ (set! (-> this on-hostile) (res-lump-struct (-> this entity) 'on-hostile pair)) (set! (-> this on-death) (res-lump-struct (-> this entity) 'on-death pair)) (if (-> this on-notice) - (logior! (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) + (logior! (-> this enemy-flags) (enemy-flag enable-on-notice)) ) (if (-> this on-active) - (logior! (-> this enemy-flags) (enemy-flag jump-check-blocked)) + (logior! (-> this enemy-flags) (enemy-flag enable-on-active)) ) (if (-> this on-hostile) - (logior! (-> this enemy-flags) (enemy-flag drawn-mirrored)) + (logior! (-> this enemy-flags) (enemy-flag enable-on-hostile)) ) (set! (-> this incoming attacker-handle) (the-as handle #f)) (let ((s4-0 (-> this root))) @@ -1196,33 +1198,27 @@ ) (set! (-> this penetrated-flinch) (-> arg0 penetrate-flinch)) (set! (-> this penetrated-knocked) (-> arg0 penetrate-knocked)) - (set! (-> this reaction-time) (the-as time-frame (get-rand-int-range this 30 240))) + (set! (-> this reaction-time) (the-as time-frame (rnd-int-range this 30 240))) (let* ((v1-113 (-> this enemy-flags)) (a0-47 (-> this fact enemy-options)) - (v1-114 (logior (enemy-flag - enable-on-active - checking-water - enable-on-notice - look-at-move-dest - check-water-backup - no-initial-move-to-ground - ) - v1-113 - ) - ) + (v1-114 + (logior (enemy-flag vulnerable vulnerable-backup use-notice-distance attackable-backup trackable trackable-backup) + v1-113 + ) + ) ) (if (logtest? (enemy-option multi-focus) a0-47) - (set! v1-114 (logior (enemy-flag trackable) v1-114)) + (set! v1-114 (logior (enemy-flag multi-focus) v1-114)) ) (if (logtest? (enemy-option has-trigger) a0-47) - (set! v1-114 (logior (enemy-flag called-dying) v1-114)) + (set! v1-114 (logior (enemy-flag use-trigger) v1-114)) ) (set! (-> this enemy-flags) v1-114) ) (logior! (-> this mask) (process-mask collectable)) (do-navigation-to-destination (-> this nav state) (-> this root trans)) (if (and (-> this enemy-info move-to-ground) - (not (logtest? (enemy-flag vulnerable-backup) (-> this enemy-flags))) + (not (logtest? (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) (not (logtest? (enemy-option ambush) (-> this fact enemy-options))) ) (enemy-method-127 this 40960.0 40960.0 #t (the-as collide-spec (-> this gnd-collide))) @@ -1302,7 +1298,7 @@ This commonly includes things such as: ) (defbehavior nav-enemy-simple-post nav-enemy () - (track-target! self) + (common-post self) (update-transforms (-> self root)) 0 (none) @@ -1408,7 +1404,7 @@ This commonly includes things such as: ;; WARN: Return type mismatch int vs time-frame. (defmethod nav-enemy-method-144 ((this nav-enemy)) (set! (-> this root nav-radius) 4.096) - (let ((s5-1 (max (-> this restore-nav-radius-time) (+ (current-time) (get-rand-int-range this 1500 2400))))) + (let ((s5-1 (max (-> this restore-nav-radius-time) (+ (current-time) (rnd-int-range this 1500 2400))))) (set! (-> this restore-nav-radius-time) (the-as time-frame s5-1)) (the-as time-frame s5-1) ) @@ -1631,7 +1627,7 @@ This commonly includes things such as: ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info walk-anim)) :num! (seek! max f30-0) @@ -1641,7 +1637,7 @@ This commonly includes things such as: (suspend) (ja :num! (seek! max f30-0)) ) - (when (enemy-method-123 self 0.2) + (when (rnd-go-idle? self 0.2) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.6)) (let ((v1-37 self)) @@ -1659,7 +1655,7 @@ This commonly includes things such as: (suspend) (ja :num! (seek! max f30-0)) ) - (until (not (enemy-method-123 self 0.2)) + (until (not (rnd-go-idle? self 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -1737,7 +1733,7 @@ This commonly includes things such as: ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) (gp-0 (new 'stack-no-clear 'vector)) ) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) @@ -1783,7 +1779,7 @@ This commonly includes things such as: ) :trans (behavior () (nav-enemy-method-160 self) - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (when (time-elapsed? (-> self state-time) (-> self reaction-time)) @@ -1830,7 +1826,7 @@ This commonly includes things such as: (set! (-> self state-timeout) (the-as time-frame - (the int (+ (lerp-scale 300.0 1200.0 f0-0 32768.0 122880.0) (get-rand-float-range self 0.0 30.0))) + (the int (+ (lerp-scale 300.0 1200.0 f0-0 32768.0 122880.0) (rnd-float-range self 0.0 30.0))) ) ) ) @@ -1852,7 +1848,7 @@ This commonly includes things such as: ) :trans (behavior () (nav-enemy-method-160 self) - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (when (time-elapsed? (-> self state-time) (seconds 0.1)) @@ -1885,7 +1881,7 @@ This commonly includes things such as: (ja-channel-push! 1 (seconds 0.1)) (ja :group! (-> self draw art-group data (-> self enemy-info walk-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -1975,7 +1971,7 @@ This commonly includes things such as: ) :trans (behavior () (nav-enemy-method-160 self) - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (let ((gp-0 (-> self focus aware))) @@ -2013,7 +2009,7 @@ This commonly includes things such as: ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self enemy-info idle-anim))) ) (until #f @@ -2061,8 +2057,8 @@ This commonly includes things such as: ) :code (behavior () (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)) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) + (let ((gp-0 (rnd-int-range self 60 210)) (s5-0 (current-time)) (f28-0 f30-0) ) @@ -2095,8 +2091,8 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set-time! (-> self state-time)) - (look-at-target! self (enemy-flag lock-focus)) - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (look-at-target! self (enemy-flag look-at-focus)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (let ((v1-6 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-6 enemy-flags))) (set! (-> v1-6 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-6 enemy-flags)))) @@ -2112,9 +2108,9 @@ This commonly includes things such as: (nav-enemy-method-165 self) (logclear! (-> self mask) (process-mask actor-pause)) (set! (-> self move-dest quad) (-> self root trans quad)) - (set! (-> self state-timeout) (the-as time-frame (get-rand-int-range self 2100 3300))) + (set! (-> self state-timeout) (the-as time-frame (rnd-int-range self 2100 3300))) (set-time! (-> self starting-time)) - (if (zero? (get-rand-int self 2)) + (if (zero? (rnd-int-count 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)))) ) @@ -2158,7 +2154,7 @@ This commonly includes things such as: ) ) (when (>= 1024.0 (vector-vector-xz-distance (-> self root trans) (-> self move-dest))) - (when (and (time-elapsed? (-> self state-time) (-> self reaction-time)) (zero? (get-rand-int self 3))) + (when (and (time-elapsed? (-> self state-time) (-> self reaction-time)) (zero? (rnd-int-count self 3))) (nav-enemy-method-161 self) (go-stare2 self) ) @@ -2177,7 +2173,7 @@ This commonly includes things such as: (set! (-> s5-0 quad) (-> self focus-pos quad)) (vector-! s4-0 (-> self root trans) s5-0) (set! (-> s4-0 y) 0.0) - (vector-normalize! s4-0 (get-rand-float-range self 16384.0 49152.0)) + (vector-normalize! s4-0 (rnd-float-range self 16384.0 49152.0)) (vector-rotate-around-y! s4-0 s4-0 f30-1) (vector+! s5-0 s5-0 s4-0) (if (and (cloest-point-on-mesh (-> self nav) s5-0 s5-0 (the-as nav-poly #f)) @@ -2191,7 +2187,7 @@ This commonly includes things such as: ) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self enemy-info walk-anim))) ) (let ((v1-8 (ja-group))) @@ -2227,8 +2223,8 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set-time! (-> self state-time)) - (look-at-target! self (enemy-flag lock-focus)) - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (look-at-target! self (enemy-flag look-at-focus)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (let ((v1-6 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-6 enemy-flags))) (set! (-> v1-6 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-6 enemy-flags)))) @@ -2252,8 +2248,8 @@ This commonly includes things such as: (let ((f30-0 (-> self enemy-info circle-dist-lo)) (f28-0 (-> self enemy-info circle-dist-hi)) ) - (if (zero? (get-rand-int self 4)) - (set! (-> self desired-angle) (get-rand-float-range self f30-0 f28-0)) + (if (zero? (rnd-int-count self 4)) + (set! (-> self desired-angle) (rnd-float-range self f30-0 f28-0)) (set! (-> self desired-angle) (fmax (fmin (vector-vector-xz-distance (-> self focus-pos) (-> self root trans)) f28-0) f30-0) ) @@ -2298,7 +2294,7 @@ This commonly includes things such as: ) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self enemy-info walk-anim))) ) (let ((v1-8 (ja-group))) @@ -2441,7 +2437,7 @@ This commonly includes things such as: :code (behavior () (local-vars (v1-37 enemy-flag) (v1-45 enemy-flag)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info hit-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -2451,29 +2447,29 @@ This commonly includes things such as: (ja :num! (seek! max f30-0)) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-36 (-> self enemy-flags))) - (if (logtest? v1-36 (enemy-flag checking-water)) - (set! v1-37 (logior v1-36 (enemy-flag enable-on-active))) - (set! v1-37 (logclear v1-36 (enemy-flag enable-on-active))) + (if (logtest? v1-36 (enemy-flag vulnerable-backup)) + (set! v1-37 (logior v1-36 (enemy-flag vulnerable))) + (set! v1-37 (logclear v1-36 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-37) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-44 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-44) - (set! v1-45 (logior (enemy-flag check-water-backup) v1-44)) - (set! v1-45 (logclear v1-44 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-44) + (set! v1-45 (logior (enemy-flag trackable) v1-44)) + (set! v1-45 (logclear v1-44 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-45) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (go-hostile self) ) @@ -2558,14 +2554,13 @@ This commonly includes things such as: ) ;; WARN: Return type mismatch quaternion vs none. -(defmethod enemy-method-92 ((this nav-enemy) (arg0 int) (arg1 nav-poly)) - "TODO - nav-poly is a guess -@abstract" +(defmethod enemy-method-92 ((this nav-enemy) (arg0 int) (arg1 enemy-jump-info)) + "@abstract" (let ((v1-0 arg0)) (when (or (zero? v1-0) (= v1-0 1) (= v1-0 2) (= v1-0 3)) (let ((a1-4 this)) (if (logtest? (enemy-flag enemy-flag37) (-> a1-4 enemy-flags)) - (seek-to-point-toward-point! (-> this root) (-> arg1 vertex2) (-> this nav max-rotation-rate) (seconds 0.02)) + (seek-to-point-toward-point! (-> this root) (-> arg1 dest-pos) (-> this nav max-rotation-rate) (seconds 0.02)) ) ) ) @@ -2610,7 +2605,7 @@ This commonly includes things such as: (let ((s5-0 0)) (enemy-method-83 self gp-0) (if (and (-> self enemy-info use-jump-blocked) - (logtest? (enemy-flag vulnerable) (-> self enemy-flags)) + (logtest? (enemy-flag jump-check-blocked) (-> self enemy-flags)) (enemy-method-82 self gp-0) ) (go-virtual jump-blocked) @@ -2631,13 +2626,13 @@ This commonly includes things such as: (logior! (-> v1-18 shape nav-flags) (nav-flags has-extra-sphere)) ) 0 - (when (logtest? (-> gp-0 flags) 1) + (when (logtest? (-> gp-0 flags) (enemy-jump-flags enjflag-0)) (until #f (if (enemy-method-90 self s5-0 gp-0) (goto cfg-12) ) (enemy-method-91 self s5-0 gp-0) - (enemy-method-92 self s5-0 (the-as nav-poly gp-0)) + (enemy-method-92 self s5-0 gp-0) (suspend) (set! s5-0 1) ) @@ -2652,7 +2647,7 @@ This commonly includes things such as: (+! (-> 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)) + (enemy-method-92 self s5-1 gp-0) (suspend) (set! s5-1 3) ) @@ -2674,14 +2669,14 @@ This commonly includes things such as: (goto cfg-19) ) (enemy-method-91 self s5-2 gp-0) - (enemy-method-92 self s5-2 (the-as nav-poly gp-0)) + (enemy-method-92 self s5-2 gp-0) (suspend) (set! s5-2 5) ) ) #f (label cfg-19) - (if (logtest? (enemy-flag alert) (-> self enemy-flags)) + (if (logtest? (enemy-flag directed) (-> self enemy-flags)) ((lambda :behavior nav-enemy ((arg0 enemy-jump-info)) (send-event (ppointer->process (-> self parent)) 'child-jumped) @@ -2739,7 +2734,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag victory)) + (logior! (-> self enemy-flags) (enemy-flag directed-ready)) ((-> (method-of-type nav-enemy idle) enter)) ) :code (-> (method-of-type nav-enemy idle) code) diff --git a/goal_src/jak2/engine/target/board/board-states.gc b/goal_src/jak2/engine/target/board/board-states.gc index 9d069c32a7..77e9beaf9a 100644 --- a/goal_src/jak2/engine/target/board/board-states.gc +++ b/goal_src/jak2/engine/target/board/board-states.gc @@ -2955,7 +2955,7 @@ (set! (-> v1-6 invinc-time) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout))) (set! (-> v1-6 speed) 1.0) (set! (-> v1-6 damage) (-> *FACT-bank* health-default-inc)) - (set! (-> v1-6 knock) (the-as uint 0)) + (set! (-> v1-6 knock) (knocked-type knocked-type-0)) ) (case arg0 (('shove) @@ -3039,7 +3039,7 @@ ) ) (when (not (and (= (-> self game mode) 'play) (>= 0.0 (-> (the-as fact-info-target (-> self fact)) health)))) - (when (= (-> gp-0 knock) 8) + (when (= (-> gp-0 knock) (knocked-type knocked-type-8)) (set-quaternion! (-> self control) (-> self control dir-targ)) (set-forward-vel (* -3.0 (-> gp-0 shove-back))) (when (demo?) diff --git a/goal_src/jak2/engine/target/mech/grunt-mech.gc b/goal_src/jak2/engine/target/mech/grunt-mech.gc index bf7d3ba18e..c6144d8b54 100644 --- a/goal_src/jak2/engine/target/mech/grunt-mech.gc +++ b/goal_src/jak2/engine/target/mech/grunt-mech.gc @@ -179,12 +179,12 @@ ) -(defmethod track-target! ((this grunt-mech)) +(defmethod common-post ((this grunt-mech)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - ((method-of-type grunt track-target!) this) + ((method-of-type grunt common-post) this) 0 (none) ) @@ -240,7 +240,7 @@ (when (!= gp-0 -1) (let ((s3-1 (-> s4-0 holds gp-0 lower-hold))) (when (!= s3-1 -1) - (if (and (or (zero? (get-rand-int this 2)) + (if (and (or (zero? (rnd-int-count this 2)) (>= 14336.0 (vector-vector-xz-distance-squared (-> this root trans) (target-pos 0))) ) (grunt-mech-info-method-9 s4-0 s3-1 this #t) @@ -332,7 +332,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag37)))) ) @@ -347,7 +347,7 @@ (logclear! (-> self root nav-flags) (nav-flags has-root-sphere)) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) ) :trans (behavior () @@ -490,8 +490,8 @@ (vector-normalize! s5-1 1.0) (countdown (s4-0 3) (let ((s3-0 (new 'stack-no-clear 'vector))) - (vector-rotate-around-y! s3-0 s5-1 (get-rand-float-range this -10922.667 10922.667)) - (when (grunt-mech-method-195 this s3-0 (the-as vector (get-rand-float-range this 16384.0 24576.0)) s5-1) + (vector-rotate-around-y! s3-0 s5-1 (rnd-float-range this -10922.667 10922.667)) + (when (grunt-mech-method-195 this s3-0 (the-as vector (rnd-float-range this 16384.0 24576.0)) s5-1) #t (goto cfg-16) ) @@ -532,14 +532,14 @@ :event enemy-event-handler :enter (behavior () (set-time! (-> self state-time)) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (set! (-> self root root-prim prim-core collide-as) (collide-spec)) (stop-looking-at-target! self) - (set! (-> self state-timeout) (+ (current-time) (get-rand-int-range self 450 900))) + (set! (-> self state-timeout) (+ (current-time) (rnd-int-range self 450 900))) (logclear! (-> self root nav-flags) (nav-flags has-root-sphere)) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (-> self root backup-collide-as)) (set! (-> v1-3 prim-core collide-with) (-> self root backup-collide-with)) @@ -561,12 +561,12 @@ (let ((gp-0 0)) 0 (until #f - (set! gp-0 (enemy-method-120 self 3 (ash 1 gp-0))) + (set! gp-0 (rnd-bit self 3 (ash 1 gp-0))) (let ((v1-30 gp-0)) (cond ((zero? v1-30) (ja-channel-push! 1 (seconds 0.13)) - (countdown (s5-0 (get-rand-int-range self 1 2)) + (countdown (s5-0 (rnd-int-range self 1 2)) (let ((s4-0 #t)) (ja-no-eval :group! grunt-mech-head-butt-ja :num! (seek! (ja-aframe 17.0 0) 0.222) :frame-num 0.0) (until (ja-done? 0) @@ -588,7 +588,7 @@ ) ((= v1-30 1) (ja-channel-push! 1 (seconds 0.13)) - (countdown (s5-1 (get-rand-int-range self 1 3)) + (countdown (s5-1 (rnd-int-range self 1 3)) (let ((s4-1 #t)) (ja-no-eval :group! grunt-mech-punch-left-ja :num! (seek! (ja-aframe 24.0 0) 0.568) :frame-num 0.0) (until (ja-done? 0) @@ -613,7 +613,7 @@ ) (else (ja-channel-push! 1 (seconds 0.13)) - (countdown (s5-2 (get-rand-int-range self 1 3)) + (countdown (s5-2 (rnd-int-range self 1 3)) (let ((s4-2 #t)) (ja-no-eval :group! grunt-mech-double-pound-ja :num! (seek! (ja-aframe 30.0 0) 0.111) :frame-num 0.0) (until (ja-done? 0) @@ -638,7 +638,7 @@ ) ) ) - (when (= (get-rand-int self 4) 3) + (when (= (rnd-int-count self 4) 3) (ja-channel-push! 1 (seconds 0.13)) (ja-no-eval :group! grunt-mech-idle0-ja :num! (seek! max 0.090909) :frame-num 0.0) (until (ja-done? 0) @@ -744,7 +744,7 @@ :event enemy-event-handler :enter (behavior () ((-> (method-of-type grunt circling) enter)) - (set! (-> self state-timeout) (+ (current-time) (get-rand-int-range self 750 1200))) + (set! (-> self state-timeout) (+ (current-time) (rnd-int-range self 750 1200))) ) :trans (behavior () (let ((a0-1 (handle->process (-> self focus handle)))) @@ -802,7 +802,7 @@ :event enemy-event-handler :enter (behavior () ((-> (method-of-type grunt-mech mech-post-circling) enter)) - (set! (-> self state-timeout) (+ (current-time) (get-rand-int-range self 900 1800))) + (set! (-> self state-timeout) (+ (current-time) (rnd-int-range self 900 1800))) ) :trans (-> (method-of-type grunt-mech mech-post-circling) trans) :code (-> (method-of-type grunt-mech mech-post-circling) code) diff --git a/goal_src/jak2/engine/ui/text-id-h.gc b/goal_src/jak2/engine/ui/text-id-h.gc index c11c7f887d..0ead1d20d1 100644 --- a/goal_src/jak2/engine/ui/text-id-h.gc +++ b/goal_src/jak2/engine/ui/text-id-h.gc @@ -740,6 +740,45 @@ (progress-shadows-extended #x12a2) (progress-error-no-resolutions #x12a3) (progress-territory-auto #x12a4) + (progress-kill-stats #x12a5) + (progress-other-stats #x12a6) + (progress-ks-total-killed #x12a7) + (progress-ks-killed-by-jak #x12a8) + (progress-ks-killed-by-darkjak #x12a9) + (progress-ks-killed-by-daxter #x12aa) + (progress-ks-killed-by-others #x12ab) + (progress-ks-source-gun-yellow #x12ac) + (progress-ks-source-gun-red #x12ad) + (progress-ks-source-gun-blue #x12ae) + (progress-ks-source-gun-dark #x12af) + (progress-ks-source-board #x12b0) + (progress-ks-source-board-trick #x12b1) + (progress-ks-source-mech #x12b2) + (progress-ks-source-mech-bonk #x12b3) + (progress-ks-source-turret #x12b4) + (progress-ks-source-punch #x12b5) + (progress-ks-source-flop #x12b6) + (progress-ks-source-uppercut #x12b7) + (progress-ks-source-spin #x12b8) + (progress-ks-source-roll #x12b9) + (progress-ks-source-darkjak-punch #x12ba) + (progress-ks-source-darkjak-flop #x12bb) + (progress-ks-source-darkjak-uppercut #x12bc) + (progress-ks-source-darkjak-spin #x12bd) + (progress-ks-source-darkjak-roll #x12be) + (progress-ks-source-darkjak-bomb0 #x12bf) + (progress-ks-source-darkjak-bomb1 #x12c0) + (progress-ks-source-indax-punch #x12c1) + (progress-ks-source-indax-spin #x12c2) + (progress-ks-source-guard #x12c3) + (progress-ks-source-sig #x12c4) + (progress-ks-source-ashelin #x12c5) + (progress-ks-source-jinx #x12c6) + (progress-ks-source-grim #x12c7) + (progress-ks-source-mog #x12c8) + (progress-ks-source-metalhead #x12c9) + (progress-ks-source-other-bot #x12ca) + (progress-ks-source-other-enemy #x12cb) (progress-input-options-auto-hide-cursor #x1300) (progress-menu-reassign-binds #x1301) (progress-reassign-binds-controller #x1302) diff --git a/goal_src/jak2/levels/atoll/ash1-course.gc b/goal_src/jak2/levels/atoll/ash1-course.gc index 2080bb0d10..59fc178bb1 100644 --- a/goal_src/jak2/levels/atoll/ash1-course.gc +++ b/goal_src/jak2/levels/atoll/ash1-course.gc @@ -190,7 +190,7 @@ (set! (-> (the-as asht-wait-spot v1-24) check-done) (lambda ((arg0 asht-wait-spot) (arg1 ashelin-battle)) (with-pp - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (cond ((and (not (speech-playing? arg1 45)) (time-elapsed? (-> arg1 waypoint-time0) (seconds 2.5))) (play-speech arg1 45) @@ -260,8 +260,8 @@ (ashelin-method-250 arg0 #f) (remove-setting! 'airlock) (logclear! (-> arg0 bot-flags) (bot-flags bf10)) - (when (not (channel-active? arg0 (the-as uint 0))) - (let ((v1-12 (get-rand-int arg0 3))) + (when (not (channel-active? arg0 (gui-channel none))) + (let ((v1-12 (rnd-int-count arg0 3))) (cond ((zero? v1-12) (play-speech arg0 42) @@ -298,7 +298,7 @@ (when (time-elapsed? (-> 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))) + (not (channel-active? arg1 (gui-channel none))) (scene-play arg1 (the-as string (-> s5-0 scene)) #f) ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) @@ -361,7 +361,7 @@ :on-set (lambda ((arg0 ashelin-battle)) (process-entity-status! arg0 (entity-perm-status bit-4) #f) (process-entity-status! arg0 (entity-perm-status no-kill) #f) - (logclear! (-> arg0 enemy-flags) (enemy-flag use-notice-distance)) + (logclear! (-> arg0 enemy-flags) (enemy-flag cam-attack-mode)) (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) (set! (-> v1-3 bytes 5) 3) (set! (-> v1-3 bytes 6) 5) diff --git a/goal_src/jak2/levels/atoll/juicer.gc b/goal_src/jak2/levels/atoll/juicer.gc index f4aa08d6cc..ba3df807a1 100644 --- a/goal_src/jak2/levels/atoll/juicer.gc +++ b/goal_src/jak2/levels/atoll/juicer.gc @@ -677,12 +677,12 @@ (none) ) -(defmethod track-target! ((this juicer)) +(defmethod common-post ((this juicer)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (los-control-method-9 (-> this los) (the-as process-focusable #f) (the-as vector #f) 2048.0) @@ -698,7 +698,7 @@ ) ) ) - (zero? (get-rand-int this 3)) + (zero? (rnd-int-count this 3)) (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) (f1-0 32768.0) ) @@ -720,15 +720,15 @@ ((zero? (-> this hit-points)) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (juicer-method-180 this) @@ -749,15 +749,15 @@ (('hit) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (if (zero? (-> this hit-points)) @@ -777,15 +777,15 @@ ) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (juicer-method-180 this) @@ -820,10 +820,10 @@ ) ) ) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f - (let ((gp-0 (-> self draw art-group data (-> (&-> *juicer-global-info* patrol-anim (get-rand-int self 2)) 0))) - (s5-0 (get-rand-int-range self 1 8)) + (let ((gp-0 (-> self draw art-group data (-> (&-> *juicer-global-info* patrol-anim (rnd-int-count self 2)) 0))) + (s5-0 (rnd-int-range self 1 8)) ) (let ((v1-34 (ja-group))) (if (not (and v1-34 (= v1-34 gp-0))) @@ -838,7 +838,7 @@ ) ) ) - (when (zero? (get-rand-int self 2)) + (when (zero? (rnd-int-count self 2)) (let ((v1-58 self)) (set! (-> v1-58 enemy-flags) (the-as enemy-flag (logclear (-> v1-58 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-58 nav callback-info) *nav-enemy-null-callback-info*) @@ -846,8 +846,8 @@ 0 (ja-channel-push! 1 (seconds 0.3)) (let ((gp-1 0)) - (until (not (enemy-method-123 self 0.4)) - (let* ((v1-62 (enemy-method-120 self 3 gp-1)) + (until (not (rnd-go-idle? self 0.4)) + (let* ((v1-62 (rnd-bit self 3 gp-1)) (a1-16 (-> self draw art-group data (-> *juicer-global-info* idle-anim v1-62))) ) (set! gp-1 (ash 1 v1-62)) @@ -922,7 +922,9 @@ (until #f (let ((gp-0 (new 'stack-no-clear 'vector))) (get-point-in-path! (-> self intro-path) gp-0 1.0 'interp) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (let ((v1-5 (process->ppointer self))) (set! (-> a1-1 from) v1-5) @@ -955,7 +957,9 @@ (until #f (let ((gp-0 (new 'stack-no-clear 'vector))) (get-point-in-path! (-> self intro-path) gp-0 (the float (-> self ambush-path-pt)) 'interp) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (let ((v1-9 (process->ppointer self))) (set! (-> a1-1 from) v1-9) @@ -996,10 +1000,10 @@ ) ) ) - (let ((f30-1 (get-rand-float-range self 0.8 1.2)) + (let ((f30-1 (rnd-float-range self 0.8 1.2)) (gp-2 (new 'stack-no-clear 'vector)) ) - (let* ((a0-13 (enemy-method-120 self 2 s5-0)) + (let* ((a0-13 (rnd-bit self 2 s5-0)) (a1-8 (-> self draw art-group data (-> *juicer-global-info* notice-anim a0-13))) ) (ja-no-eval :group! a1-8 :num! (seek! max f30-1) :frame-num 0.0) @@ -1022,8 +1026,8 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.15)) - (let ((gp-1 (-> self draw art-group data (-> *juicer-global-info* celebrate-anim (get-rand-int self 2)))) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((gp-1 (-> self draw art-group data (-> *juicer-global-info* celebrate-anim (rnd-int-count self 2)))) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (ja-no-eval :group! gp-1 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -1062,7 +1066,7 @@ ) ) ) - (let* ((v1-16 (get-rand-int self 2)) + (let* ((v1-16 (rnd-int-count self 2)) (gp-0 (-> self draw art-group data (-> *juicer-global-info* charge-anim v1-16))) ) (set! (-> self charge-index) v1-16) @@ -1074,7 +1078,7 @@ (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim gp-0)) ) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -1230,7 +1234,7 @@ ) 0 (set! (-> self torso-track-player) (the-as basic #t)) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (set! (-> self hit-focus) #f) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-9 *game-info*) @@ -1242,10 +1246,10 @@ ) :exit (behavior () (set! (-> self torso-track-player) #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (juicer-method-184 self #f) (set-time! (-> self last-fire-time)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1286,7 +1290,7 @@ ) ) ) - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (b! @@ -1359,7 +1363,7 @@ ) 0 (nav-enemy-method-166 self) - (let* ((v1-23 (get-rand-int self 2)) + (let* ((v1-23 (rnd-int-count self 2)) (gp-0 (-> self draw art-group data (-> *juicer-global-info* charge-anim v1-23))) ) (set! (-> self charge-index) v1-23) @@ -1368,8 +1372,8 @@ (ja-channel-push! 1 (seconds 0.15)) ) ) - (let ((s5-0 (+ (get-rand-int self 6) 2)) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((s5-0 (+ (rnd-int-count self 6) 2)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (while (nonzero? s5-0) (+! s5-0 -1) @@ -1393,8 +1397,8 @@ 0 (vector-reset! (-> self root transv)) (ja-channel-push! 1 (seconds 0.1)) - (let ((gp-2 (-> self draw art-group data (-> *juicer-global-info* celebrate-anim (get-rand-int self 2)))) - (f30-2 (get-rand-float-range self 0.9 1.1)) + (let ((gp-2 (-> self draw art-group data (-> *juicer-global-info* celebrate-anim (rnd-int-count self 2)))) + (f30-2 (rnd-float-range self 0.9 1.1)) ) (ja-no-eval :group! gp-2 :num! (seek! max f30-2) :frame-num 0.0) (until (ja-done? 0) @@ -1413,7 +1417,7 @@ :code (behavior () (local-vars (v1-37 enemy-flag) (v1-45 enemy-flag)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info hit-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -1423,29 +1427,29 @@ (ja :num! (seek! max f30-0)) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-36 (-> self enemy-flags))) - (if (logtest? v1-36 (enemy-flag checking-water)) - (set! v1-37 (logior v1-36 (enemy-flag enable-on-active))) - (set! v1-37 (logclear v1-36 (enemy-flag enable-on-active))) + (if (logtest? v1-36 (enemy-flag vulnerable-backup)) + (set! v1-37 (logior v1-36 (enemy-flag vulnerable))) + (set! v1-37 (logclear v1-36 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-37) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-44 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-44) - (set! v1-45 (logior (enemy-flag check-water-backup) v1-44)) - (set! v1-45 (logclear v1-44 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-44) + (set! v1-45 (logior (enemy-flag trackable) v1-44)) + (set! v1-45 (logclear v1-44 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-45) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (go-virtual hostile) ) @@ -1455,7 +1459,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 1)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self enemy-info idle-anim))) ) (until #f @@ -1474,8 +1478,8 @@ :virtual #t :code (behavior () (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)) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) + (let ((gp-0 (rnd-int-range self 60 210)) (s5-0 (current-time)) (f28-0 f30-0) ) @@ -1502,20 +1506,20 @@ ) ) -(defmethod enemy-method-77 ((this juicer) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this juicer) (arg0 enemy-knocked-info)) (local-vars (a2-2 int)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (ja-channel-push! 1 0) (let* ((a2-0 (ash 1 (-> *juicer-global-info* prev-yellow-hit))) - (v1-3 (enemy-method-120 this 4 a2-0)) + (v1-3 (rnd-bit this 4 a2-0)) (a1-6 (-> this draw art-group data (-> *juicer-global-info* yellow-hit-anim v1-3))) ) (set! (-> *juicer-global-info* prev-yellow-hit) v1-3) (let ((a0-13 (-> this skel root-channel 0))) (set! (-> a0-13 frame-group) (the-as art-joint-anim a1-6)) (set! (-> a0-13 param 0) (the float (+ (-> (the-as art-joint-anim a1-6) frames num-frames) -1))) - (set! (-> a0-13 param 1) (-> arg0 0)) + (set! (-> a0-13 param 1) (-> arg0 anim-speed)) (set! (-> a0-13 frame-num) 0.0) (joint-control-channel-group! a0-13 (the-as art-joint-anim a1-6) num-func-seek!) ) @@ -1528,7 +1532,7 @@ (set! a2-2 (logior v1-11 7)) ) ) - (let* ((v1-15 (enemy-method-120 this 6 a2-2)) + (let* ((v1-15 (rnd-bit this 6 a2-2)) (s5-1 (-> this draw art-group data (-> *juicer-global-info* blue-hit-anim v1-15))) ) (set! (-> *juicer-global-info* prev-blue-hit) v1-15) @@ -1552,12 +1556,12 @@ ) ) (else - (let ((s4-1 (-> this draw art-group data (-> *juicer-global-info* knocked-anim (get-rand-int this 2))))) + (let ((s4-1 (-> this draw art-group data (-> *juicer-global-info* knocked-anim (rnd-int-count this 2))))) (ja-channel-push! 1 (seconds 0.17)) (let ((a0-37 (-> this skel root-channel 0))) (set! (-> a0-37 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-37 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-37 param 1) (-> arg0 0)) + (set! (-> a0-37 param 1) (-> arg0 anim-speed)) (set! (-> a0-37 frame-num) 0.0) (joint-control-channel-group! a0-37 (the-as art-joint-anim s4-1) num-func-seek!) ) @@ -1567,7 +1571,7 @@ #t ) -(defmethod enemy-method-78 ((this juicer) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this juicer) (arg0 enemy-knocked-info)) (cond ((= (-> this incoming knocked-type) (knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -1576,7 +1580,7 @@ (let ((a0-3 (-> this skel root-channel 0))) (set! (-> a0-3 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -1599,7 +1603,7 @@ (let ((a0-10 (-> this skel root-channel 0))) (set! (-> a0-10 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-10 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-10 param 1) (-> arg0 0)) + (set! (-> a0-10 param 1) (-> arg0 anim-speed)) (set! (-> a0-10 frame-num) 0.0) (joint-control-channel-group! a0-10 (the-as art-joint-anim s4-1) num-func-seek!) ) diff --git a/goal_src/jak2/levels/atoll/sig0-course.gc b/goal_src/jak2/levels/atoll/sig0-course.gc index 4f96dad24f..5383f830ec 100644 --- a/goal_src/jak2/levels/atoll/sig0-course.gc +++ b/goal_src/jak2/levels/atoll/sig0-course.gc @@ -155,7 +155,7 @@ ) (if (and (logtest? (-> arg0 bot-task-bits) (bot-task-bits botbits-4)) (not (speech-playing? arg0 26)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) (play-speech arg0 26) ) @@ -166,7 +166,7 @@ (defun sig-say-waste-the-suckers-if-should ((arg0 sig-atoll)) (if (and (logtest? (-> arg0 bot-task-bits) (bot-task-bits botbits-3)) (not (speech-playing? arg0 25)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) (play-speech arg0 25) ) @@ -358,7 +358,7 @@ :on-update (lambda ((arg0 sig-atoll)) (if (and (logtest? (-> arg0 bot-task-bits) (bot-task-bits botbits-1)) (not (speech-playing? arg0 33)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) (play-speech arg0 33) ) @@ -411,7 +411,7 @@ :on-update (lambda ((arg0 sig-atoll)) (if (and (logtest? (-> arg0 bot-task-bits) (bot-task-bits botbits-1)) (not (speech-playing? arg0 33)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) (play-speech arg0 33) ) @@ -452,7 +452,7 @@ ) :on-update (lambda ((arg0 sig-atoll)) (if (and (not (speech-playing? arg0 1)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) (< (-> arg0 root trans z) (-> (target-pos 0) z)) ) (play-speech arg0 1) @@ -497,7 +497,7 @@ (none) ) :on-update (lambda ((arg0 sig-atoll)) - (when (not (channel-active? arg0 (the-as uint 0))) + (when (not (channel-active? arg0 (gui-channel none))) (if (and (not (speech-playing? arg0 1)) (< (-> arg0 root trans z) (-> (target-pos 0) z))) (play-speech arg0 1) ) @@ -596,7 +596,7 @@ (the-as (function sigt-charge-plasma sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) - (if (and (not (channel-active? arg1 (the-as uint 0))) (sig-atoll-method-259 arg1)) + (if (and (not (channel-active? arg1 (gui-channel none))) (sig-atoll-method-259 arg1)) (sig-plasma-method-9 (-> arg1 plasma)) ) (when (and (sig-plasma-method-13 (-> arg1 plasma)) (scene-play arg1 "atoll-sig-tank" #f)) @@ -681,7 +681,7 @@ (else (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) (if (and (not (speech-playing? arg1 5)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (let ((f0-1 73728.0)) (>= (* f0-1 f0-1) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) ) @@ -857,7 +857,7 @@ ) (else (when (and (outside-spot-radius? arg0 (the-as bot-spot #f) (the-as vector #f) #f) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) (let ((a1-7 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-7 from) (process->ppointer pp)) @@ -950,7 +950,7 @@ ) (cond ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (process-grab? arg1 #t) (process-grab? *target* #t) ) @@ -1066,7 +1066,7 @@ ) a1-2 ) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (not (focus-test? s5-0 edge-grab)) (>= (- (-> s5-0 control trans y) (-> arg1 root trans y)) -4096.0) ) @@ -1207,7 +1207,7 @@ ) :on-update (lambda ((arg0 sig-atoll)) (with-pp - (b! (not (channel-active? arg0 (the-as uint 0))) cfg-2 :delay (empty-form)) + (b! (not (channel-active? arg0 (gui-channel none))) cfg-2 :delay (empty-form)) (set-time! (-> arg0 waypoint-time0)) (b! #t cfg-21 :delay (nop!)) (label cfg-2) @@ -1318,7 +1318,7 @@ :on-update (lambda ((arg0 sig-atoll)) (with-pp (if (and (not (speech-playing? arg0 13)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) (let ((a1-2 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-2 from) (process->ppointer pp)) (set! (-> a1-2 num-params) 1) @@ -1378,7 +1378,7 @@ ) (cond ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (process-grab? arg1 #t) (process-grab? *target* #t) ) @@ -1494,7 +1494,7 @@ ) a1-2 ) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (let ((f0-0 102400.0)) (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) @@ -1566,7 +1566,9 @@ (play-speech arg1 17) (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) ) - (when (and (logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) (not (channel-active? arg1 (the-as uint 0)))) + (when (and (logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) + (not (channel-active? arg1 (gui-channel none))) + ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) (go-to-waypoint! arg1 20 #f) (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) @@ -1610,7 +1612,7 @@ :on-update (lambda ((arg0 sig-atoll)) (if (and (time-elapsed? (-> arg0 waypoint-time0) (seconds 1.5)) (not (speech-playing? arg0 18)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) (play-speech arg0 18) ) @@ -1650,7 +1652,7 @@ ) (cond ((zero? v1-6) - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (let ((s5-0 (-> arg1 root trans)) (s4-0 (-> arg1 sig-course spots)) (f0-0 163840.0) @@ -1704,7 +1706,7 @@ ) ) ) - (if (and (not (speech-playing? arg1 20)) (not (channel-active? arg1 (the-as uint 0)))) + (if (and (not (speech-playing? arg1 20)) (not (channel-active? arg1 (gui-channel none)))) (play-speech arg1 20) ) (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) @@ -1780,7 +1782,7 @@ ) (cond ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (process-grab? arg1 #t) (process-grab? *target* #t) ) @@ -1894,7 +1896,7 @@ ) a1-2 ) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (let ((f0-0 102400.0)) (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) @@ -2127,7 +2129,7 @@ ) (cond ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (process-grab? arg1 #t) (process-grab? *target* #t) ) @@ -2248,7 +2250,7 @@ ) a1-2 ) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (let ((f0-0 102400.0)) (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) @@ -2319,7 +2321,9 @@ (play-speech arg1 24) (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) ) - (when (and (logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) (not (channel-active? arg1 (the-as uint 0)))) + (when (and (logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) + (not (channel-active? arg1 (gui-channel none))) + ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) (go-to-waypoint! arg1 31 #f) (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) @@ -2353,7 +2357,7 @@ (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) (go-to-waypoint! arg1 32 #f) @@ -2697,7 +2701,7 @@ (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (let ((f0-0 122880.0)) (if (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) @@ -2751,7 +2755,7 @@ ) (cond ((and (< f0-0 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (process-grab? arg1 #t) (process-grab? *target* #t) ) @@ -2881,7 +2885,7 @@ ) a1-2 ) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (let ((f0-0 102400.0)) (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) @@ -2897,7 +2901,7 @@ ) ) (when (and (sig-plasma-method-13 (-> arg1 plasma)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (scene-play arg1 "atoll-sniper-e" #f) ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) @@ -2978,7 +2982,7 @@ :on-set (lambda ((arg0 sig-atoll)) (task-node-close! (game-task-node atoll-sig-resolution)) (process-entity-status! arg0 (entity-perm-status bit-4) #f) - (logclear! (-> arg0 enemy-flags) (enemy-flag use-notice-distance)) + (logclear! (-> arg0 enemy-flags) (enemy-flag cam-attack-mode)) (logclear! (-> arg0 bot-flags) (bot-flags bf06)) (bot-method-196 arg0) (logior! (-> arg0 bot-flags) (bot-flags bf22)) diff --git a/goal_src/jak2/levels/atoll/sniper.gc b/goal_src/jak2/levels/atoll/sniper.gc index 027b3b0c03..98bdd601f4 100644 --- a/goal_src/jak2/levels/atoll/sniper.gc +++ b/goal_src/jak2/levels/atoll/sniper.gc @@ -215,7 +215,7 @@ (if (<= s4-0 0) (go process-drawable-art-error "no path") ) - (let ((s2-0 (get-rand-int this s4-0)) + (let ((s2-0 (rnd-int-count this s4-0)) (gp-0 (new 'stack-no-clear 'vector)) ) (countdown (s3-0 s4-0) @@ -250,7 +250,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info walk-anim)) :num! (seek! max f30-0) @@ -271,7 +271,7 @@ ) (nav-enemy-method-156 self) (nav-enemy-method-162 self) - (set! (-> self next-pick-time) (+ (current-time) (get-rand-int-range self 300 1050))) + (set! (-> self next-pick-time) (+ (current-time) (rnd-int-range self 300 1050))) ) (nav-enemy-method-176 self) ) @@ -285,7 +285,7 @@ (set-enemy-info! this *sniper-nav-enemy-info*) (logior! (-> this focus-status) (focus-status ignore)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag check-water)) + (logclear! (-> this enemy-flags) (enemy-flag dangerous-backup)) 0 (none) ) diff --git a/goal_src/jak2/levels/castle/boss/castle-baron.gc b/goal_src/jak2/levels/castle/boss/castle-baron.gc index 0b4ca555f7..553a504872 100644 --- a/goal_src/jak2/levels/castle/boss/castle-baron.gc +++ b/goal_src/jak2/levels/castle/boss/castle-baron.gc @@ -701,12 +701,12 @@ For example for an elevator pre-compute the distance between the first and last (set! (-> *krew-boss-clone-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod track-target! ((this krew-boss-clone)) +(defmethod common-post ((this krew-boss-clone)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (let ((s5-0 (new 'stack-no-clear 'vector)) @@ -825,13 +825,13 @@ For example for an elevator pre-compute the distance between the first and last (('track) (cond ((-> arg3 param 0) - (if (logtest? (-> this enemy-flags) (enemy-flag enable-on-active)) + (if (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) #t 'abort ) ) (else - (logtest? (-> this enemy-flags) (enemy-flag enable-on-active)) + (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) ) ) ) @@ -872,7 +872,7 @@ For example for an elevator pre-compute the distance between the first and last (go-virtual hostile) ) :post (behavior () - (logior! (-> self enemy-flags) (enemy-flag directed)) + (logior! (-> self enemy-flags) (enemy-flag recover-applied-velocity)) (let ((gp-0 (-> self root))) (let ((a1-0 (new-stack-vector0))) (vector-v++! (-> gp-0 transv) (compute-acc-due-to-gravity gp-0 a1-0 (-> self enemy-info slip-factor))) @@ -887,7 +887,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) (enemy-method-111 self) - (track-target! self) + (common-post self) ) ) @@ -903,7 +903,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) -(defmethod enemy-method-77 ((this krew-boss-clone) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this krew-boss-clone) (arg0 enemy-knocked-info)) (with-pp (ja-channel-push! 1 0) (cond @@ -954,7 +954,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) -(defmethod enemy-method-78 ((this krew-boss-clone) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this krew-boss-clone) (arg0 enemy-knocked-info)) (when (> (-> this hit-points) 0) (ja-channel-push! 1 (seconds 0.1)) (let ((a0-2 (-> this skel root-channel 0))) @@ -971,7 +971,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) ) - (set! (-> a0-2 param 1) (* 5.0 (-> arg0 0))) + (set! (-> a0-2 param 1) (* 5.0 (-> arg0 anim-speed))) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 @@ -988,7 +988,7 @@ For example for an elevator pre-compute the distance between the first and last (let ((v1-0 arg0)) (cond ((zero? v1-0) - (enemy-method-77 this (the-as (pointer float) arg1)) + (enemy-method-77 this arg1) #f ) ((= v1-0 1) @@ -997,7 +997,7 @@ For example for an elevator pre-compute the distance between the first and last s5-0 ) ((= v1-0 2) - (set! s5-0 (not (enemy-method-78 this (the-as (pointer float) arg1)))) + (set! s5-0 (not (enemy-method-78 this arg1))) (set! (-> this incoming blue-juggle-count) (the-as uint 0)) s5-0 ) @@ -1092,7 +1092,7 @@ For example for an elevator pre-compute the distance between the first and last :code (behavior () (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))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja :num! (loop! f30-0)) (when (time-elapsed? (-> self wiggle-time) (seconds 1)) @@ -1250,7 +1250,9 @@ For example for an elevator pre-compute the distance between the first and last (the-as pair 0) ) (logior! (-> this draw global-effect) (draw-control-global-effect disable-envmap)) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag vulnerable-backup) (-> this enemy-flags)))) + (set! (-> this enemy-flags) + (the-as enemy-flag (logior (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) + ) (set! (-> *krew-boss-clone-nav-enemy-info* nav-mesh) (nav-mesh-from-res-tag (-> this entity) 'nav-mesh-actor 1) ) @@ -1941,13 +1943,13 @@ For example for an elevator pre-compute the distance between the first and last (('track) (cond ((-> arg3 param 0) - (if (logtest? (-> this enemy-flags) (enemy-flag enable-on-active)) + (if (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) #t 'abort ) ) (else - (logtest? (-> this enemy-flags) (enemy-flag enable-on-active)) + (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) ) ) ) @@ -1974,7 +1976,7 @@ For example for an elevator pre-compute the distance between the first and last #f ) -(defmethod enemy-method-77 ((this krew-boss) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this krew-boss) (arg0 enemy-knocked-info)) (with-pp (ja-channel-push! 1 0) (cond @@ -2012,7 +2014,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) -(defmethod enemy-method-78 ((this krew-boss) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this krew-boss) (arg0 enemy-knocked-info)) (cond ((<= (-> this hit-points) 0) #f @@ -2033,7 +2035,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) ) - (set! (-> a0-2 param 1) (* 2.0 (-> arg0 0))) + (set! (-> a0-2 param 1) (* 2.0 (-> arg0 anim-speed))) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 @@ -2059,7 +2061,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) (krew-hit-speech self) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logclear! (-> self nav flags) (nav-control-flag update-heading-from-facing)) ) :exit (behavior () @@ -2071,9 +2073,9 @@ For example for an elevator pre-compute the distance between the first and last ) (set! (-> self floating) #f) (let ((v1-4 (-> self enemy-flags))) - (if (logtest? v1-4 (enemy-flag checking-water)) - (set! v1-5 (logior v1-4 (enemy-flag enable-on-active))) - (set! v1-5 (logclear v1-4 (enemy-flag enable-on-active))) + (if (logtest? v1-4 (enemy-flag vulnerable-backup)) + (set! v1-5 (logior v1-4 (enemy-flag vulnerable))) + (set! v1-5 (logclear v1-4 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-5) @@ -2083,7 +2085,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) :post (behavior () - (logior! (-> self enemy-flags) (enemy-flag directed)) + (logior! (-> self enemy-flags) (enemy-flag recover-applied-velocity)) (let ((gp-0 (-> self root))) (cond ((and (>= 1449984.0 (-> gp-0 trans y)) (< (-> gp-0 transv y) 0.0)) @@ -2111,7 +2113,7 @@ For example for an elevator pre-compute the distance between the first and last ) (enemy-method-111 self) (nav-enemy-method-142 self (-> self nav)) - (track-target! self) + (common-post self) ) ) @@ -2209,7 +2211,7 @@ For example for an elevator pre-compute the distance between the first and last (set! (-> v1-14 target-post quad) (-> a0-20 quad)) ) 0 - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (let ((v1-19 (-> self nav))) (set! (-> v1-19 sphere-mask) (the-as uint #x800fa)) ) @@ -2526,7 +2528,7 @@ For example for an elevator pre-compute the distance between the first and last :code (behavior () (ja-channel-push! 1 (seconds 0.1)) (ja :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! min) - (let ((f30-0 (get-rand-float-range self 0.3 0.5))) + (let ((f30-0 (rnd-float-range self 0.3 0.5))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -2671,8 +2673,8 @@ For example for an elevator pre-compute the distance between the first and last ) ) ) - (look-at-target! self (enemy-flag lock-focus)) - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (look-at-target! self (enemy-flag look-at-focus)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (let ((v1-58 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-58 enemy-flags))) (set! (-> v1-58 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-58 enemy-flags)))) @@ -2696,8 +2698,8 @@ For example for an elevator pre-compute the distance between the first and last (let ((f30-0 (-> self enemy-info circle-dist-lo)) (f28-0 (-> self enemy-info circle-dist-hi)) ) - (if (zero? (get-rand-int self 4)) - (set! (-> self desired-angle) (get-rand-float-range self f30-0 f28-0)) + (if (zero? (rnd-int-count self 4)) + (set! (-> self desired-angle) (rnd-float-range self f30-0 f28-0)) (set! (-> self desired-angle) (fmax (fmin (vector-vector-xz-distance (-> self focus-pos) (-> self root trans)) f28-0) f30-0) ) @@ -2736,9 +2738,9 @@ For example for an elevator pre-compute the distance between the first and last (set! (-> self next-shooting-frame) 0) (ja :chan 1 :num-func num-func-identity :frame-num 0.0) (let ((v1-24 (-> self enemy-flags))) - (if (logtest? v1-24 (enemy-flag checking-water)) - (set! v1-25 (logior v1-24 (enemy-flag enable-on-active))) - (set! v1-25 (logclear v1-24 (enemy-flag enable-on-active))) + (if (logtest? v1-24 (enemy-flag vulnerable-backup)) + (set! v1-25 (logior v1-24 (enemy-flag vulnerable))) + (set! v1-25 (logclear v1-24 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-25) @@ -2776,7 +2778,7 @@ For example for an elevator pre-compute the distance between the first and last (ja-channel-push! 2 (seconds 0.1)) (ja :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! min) (ja :chan 1 :group! (-> self draw art-group data (-> self enemy-info hostile-anim)) :num! min) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja :num! (loop! f30-0)) (when (!= (-> self next-shooting-frame) 100) diff --git a/goal_src/jak2/levels/castle/roboguard-level.gc b/goal_src/jak2/levels/castle/roboguard-level.gc index 1af854c869..e9cdabe6fd 100644 --- a/goal_src/jak2/levels/castle/roboguard-level.gc +++ b/goal_src/jak2/levels/castle/roboguard-level.gc @@ -341,7 +341,7 @@ (logior! (-> self flags) 4) (logior! (-> self nav flags) (nav-control-flag output-sphere-hash)) (let ((a1-1 (new 'stack-no-clear 'collide-query))) - (enemy-method-125 self a1-1 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (ground-pat-set! self a1-1 (collide-spec backgnd) 8192.0 81920.0 1024.0) ) (let* ((v1-11 (-> self nav)) (a1-2 (-> self root gspot-pos)) @@ -481,7 +481,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! roboguard-idle0-ja :num! (seek! 10.0 (* 0.1 f30-0)) :frame-num 9.0) (until (ja-done? 0) @@ -525,12 +525,12 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (logior! (-> self flags) 4) - (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) (logclear! (-> self mask) (process-mask actor-pause)) - (when (logtest? (-> self enemy-flags) (enemy-flag drawn-mirrored)) - (logclear! (-> self enemy-flags) (enemy-flag drawn-mirrored)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-hostile)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-hostile)) (let ((gp-0 (-> self on-hostile))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -565,7 +565,7 @@ ) :exit (behavior () (sound-stop (-> self roll-sound)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -598,7 +598,7 @@ 0 (nav-enemy-method-160 self) (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))))) + (set! (-> self roll-timer) (+ (current-time) (the int (* 300.0 (rnd-float-range self 3.0 5.0))))) (let ((gp-2 (handle->process (-> self focus handle)))) (when (and gp-2 (and gp-2 @@ -872,7 +872,7 @@ (none) ) -(defmethod enemy-method-77 ((this roboguard-level) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this roboguard-level) (arg0 enemy-knocked-info)) (ja-channel-push! 1 0) (case (-> this incoming knocked-type) (((knocked-type knocked-type-0) @@ -885,7 +885,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 21)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 21)) num-func-seek!) ) @@ -896,7 +896,7 @@ (set! (-> a0-6 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 23)) frames num-frames) -1)) ) - (set! (-> a0-6 param 1) (-> arg0 0)) + (set! (-> a0-6 param 1) (-> arg0 anim-speed)) (set! (-> a0-6 frame-num) 0.0) (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> this draw art-group data 23)) num-func-seek!) ) @@ -905,7 +905,7 @@ #t ) -(defmethod enemy-method-78 ((this roboguard-level) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this roboguard-level) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-0) (knocked-type knocked-type-1) @@ -917,7 +917,7 @@ (set! (-> v1-4 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 22)) frames num-frames) -1)) ) - (set! (-> v1-4 param 1) (-> arg0 0)) + (set! (-> v1-4 param 1) (-> arg0 anim-speed)) (set! (-> v1-4 frame-num) 0.0) (joint-control-channel-group! v1-4 (the-as art-joint-anim (-> this draw art-group data 22)) num-func-seek!) ) @@ -928,7 +928,7 @@ (set! (-> v1-8 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 24)) frames num-frames) -1)) ) - (set! (-> v1-8 param 1) (-> arg0 0)) + (set! (-> v1-8 param 1) (-> arg0 anim-speed)) (set! (-> v1-8 frame-num) 0.0) (joint-control-channel-group! v1-8 (the-as art-joint-anim (-> this draw art-group data 24)) num-func-seek!) ) @@ -1008,7 +1008,7 @@ :to this ) ) - (dispose! this) + (dying this) (go (method-of-object this explode)) ) ) @@ -1088,7 +1088,7 @@ (set! (-> v1-30 target-speed) (-> this speed)) ) 0 - (set! (-> this roll-timer) (+ (current-time) (the int (* 300.0 (get-rand-float-range this 3.0 5.0))))) + (set! (-> this roll-timer) (+ (current-time) (the int (* 300.0 (rnd-float-range this 3.0 5.0))))) (set! (-> this roll-dir quad) (-> s3-1 quad)) ) ) @@ -1151,17 +1151,22 @@ ) ) ) - (track-target! this) + (common-post this) (update-transforms (-> this root)) 0 (none) ) -(defmethod dispose! ((this roboguard-level)) +(defmethod dying ((this roboguard-level)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" - (when (not (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags))) + (when (not (logtest? (enemy-flag called-dying) (-> this enemy-flags))) (send-event (ppointer->process (-> this parent)) 'roboguard-die) - ((method-of-type nav-enemy dispose!) this) + ((method-of-type nav-enemy dying) this) + ;; og:preserve-this + ;; track statistics + (#when PC_PORT + (unless (zero? (-> this hit-points)) + (add-to-kill-stats this (-> this incoming)))) ) (none) ) @@ -1241,7 +1246,9 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-roboguard-level" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag vulnerable-backup) (-> this enemy-flags)))) + (set! (-> this enemy-flags) + (the-as enemy-flag (logior (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) + ) (init-enemy-behaviour-and-stats! this *roboguard-level-nav-enemy-info*) (let ((v1-8 (-> this nav))) (set! (-> v1-8 nav-cull-radius) 81920.0) diff --git a/goal_src/jak2/levels/city/bombbot/bombbot.gc b/goal_src/jak2/levels/city/bombbot/bombbot.gc index 5128911e06..41759efaa2 100644 --- a/goal_src/jak2/levels/city/bombbot/bombbot.gc +++ b/goal_src/jak2/levels/city/bombbot/bombbot.gc @@ -1141,13 +1141,13 @@ ) ) -(defmethod track-target! ((this bombbot)) +(defmethod common-post ((this bombbot)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (local-vars (sv-16 sparticle-launcher) (sv-20 sparticle-launcher)) - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (cond @@ -1243,17 +1243,17 @@ (defmethod damage-amount-from-attack ((this bombbot) (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]]" (-> arg1 param 1) - (let ((f0-1 (the float (penetrate-using->damage (the-as penetrate (-> this incoming penetrate-using)))))) + (let ((f0-1 (the float (penetrate-using->damage (-> this incoming penetrate-using))))) (cond - ((logtest? #xc0000 (-> this incoming penetrate-using)) - (if (and (logtest? #x40000 (-> this incoming penetrate-using)) - (logtest? #x80000 (-> this incoming penetrate-using)) + ((logtest? (penetrate dark-bomb dark-giant) (-> this incoming penetrate-using)) + (if (and (logtest? (penetrate dark-bomb) (-> this incoming penetrate-using)) + (logtest? (penetrate dark-giant) (-> this incoming penetrate-using)) ) #x42c80000 (the int (* 1.8 f0-1)) ) ) - ((logtest? #x20000 (-> this incoming penetrate-using)) + ((logtest? (penetrate dark-punch) (-> this incoming penetrate-using)) (the int (* 2.0 f0-1)) ) (else @@ -1801,7 +1801,7 @@ (t9-0) ) ) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (+! (-> self shield-hit-points) -1.0) ) :exit (behavior () @@ -1991,7 +1991,7 @@ ) ) (seek! (-> self root trans y) (-> self city-path node gp-1 position y) (* 16384.0 (seconds-per-frame))) - (track-target! self) + (common-post self) (update-transforms (-> self root)) ) (else diff --git a/goal_src/jak2/levels/city/farm/yakow.gc b/goal_src/jak2/levels/city/farm/yakow.gc index 90125fe6ca..5a28261f04 100644 --- a/goal_src/jak2/levels/city/farm/yakow.gc +++ b/goal_src/jak2/levels/city/farm/yakow.gc @@ -221,7 +221,7 @@ ) ) -(defmethod enemy-method-123 ((this yakow) (arg0 float)) +(defmethod rnd-go-idle? ((this yakow) (arg0 float)) "TODO" (>= arg0 (rand-vu)) ) @@ -229,8 +229,8 @@ ;; WARN: Function (method 156 yakow) has a return type of none, but the expression builder found a return statement. (defmethod nav-enemy-method-156 ((this yakow)) (dotimes (s5-0 16) - (let ((f30-1 (* 4096.0 (get-rand-float-range this -10.0 10.0))) - (f0-2 (* 4096.0 (get-rand-float-range this -10.0 10.0))) + (let ((f30-1 (* 4096.0 (rnd-float-range this -10.0 10.0))) + (f0-2 (* 4096.0 (rnd-float-range this -10.0 10.0))) (s4-0 (new 'stack-no-clear 'vector)) ) (set! (-> s4-0 quad) (-> this root trans quad)) @@ -303,7 +303,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info walk-anim)) :num! (seek! max f30-0) @@ -313,7 +313,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (when (enemy-method-123 self 0.2) + (when (rnd-go-idle? self 0.2) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.6)) (let ((v1-37 self)) @@ -339,7 +339,7 @@ ) (ja-channel-push! 1 (seconds 0.1)) ) - (if (enemy-method-123 self 0.2) + (if (rnd-go-idle? self 0.2) (goto cfg-15) ) ) diff --git a/goal_src/jak2/levels/city/kiddogescort/crocesc-states.gc b/goal_src/jak2/levels/city/kiddogescort/crocesc-states.gc index 600dc0f74e..c19fef59cb 100644 --- a/goal_src/jak2/levels/city/kiddogescort/crocesc-states.gc +++ b/goal_src/jak2/levels/city/kiddogescort/crocesc-states.gc @@ -23,7 +23,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -43,13 +43,13 @@ ) ) :code (behavior () - (let ((gp-0 (get-rand-int self 4))) + (let ((gp-0 (rnd-int-count self 4))) (until #f (let ((a2-0 (ash 1 gp-0))) (if (= gp-0 3) (set! a2-0 (logior a2-0 4)) ) - (set! gp-0 (enemy-method-120 self 4 a2-0)) + (set! gp-0 (rnd-bit self 4 a2-0)) ) (let ((v1-7 gp-0)) (cond @@ -68,7 +68,7 @@ ) ) ) - (let ((s5-0 (get-rand-int-range self 3 7))) + (let ((s5-0 (rnd-int-range self 3 7))) (dotimes (s4-0 s5-0) (ja-no-eval :group! crocadog-escort-idle-pant-ja :num! (seek! max 0.5) :frame-num 0.0) (until (ja-done? 0) @@ -106,7 +106,7 @@ ) ) ) - (let ((s5-4 (get-rand-int-range self 5 7))) + (let ((s5-4 (rnd-int-range self 5 7))) (dotimes (s4-1 s5-4) (ja-no-eval :group! crocadog-escort-idle-scratch-ja :num! (seek! max 0.5) :frame-num (ja-aframe 2.0 0)) (until (ja-done? 0) @@ -131,7 +131,7 @@ ) ) ) - (let ((s5-5 (get-rand-int-range self 3 7))) + (let ((s5-5 (rnd-int-range self 3 7))) (dotimes (s4-2 s5-5) (ja-no-eval :group! crocadog-escort-idle-wag-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) @@ -165,7 +165,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -368,7 +368,7 @@ ) ) (logior! (-> self focus-status) (focus-status pilot)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logior! (-> self focus-status) (focus-status disable)) (logclear! (-> self focus-status) (focus-status arrestable)) (logclear! (-> self bot-flags) (bot-flags bf15)) @@ -378,9 +378,9 @@ (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) (logclear! (-> self focus-status) (focus-status disable)) (let ((v1-5 (-> self enemy-flags))) - (if (logtest? v1-5 (enemy-flag checking-water)) - (set! v1-6 (logior v1-5 (enemy-flag enable-on-active))) - (set! v1-6 (logclear v1-5 (enemy-flag enable-on-active))) + (if (logtest? v1-5 (enemy-flag vulnerable-backup)) + (set! v1-6 (logior v1-5 (enemy-flag vulnerable))) + (set! v1-6 (logclear v1-5 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-6) @@ -518,7 +518,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logclear! (-> self root nav-flags) (nav-flags has-root-sphere)) (let ((v1-11 (-> self nav))) (logclear! (-> v1-11 shape nav-flags) (nav-flags has-extra-sphere)) @@ -531,9 +531,9 @@ (local-vars (v1-4 enemy-flag)) (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) (let ((v1-3 (-> self enemy-flags))) - (if (logtest? v1-3 (enemy-flag checking-water)) - (set! v1-4 (logior v1-3 (enemy-flag enable-on-active))) - (set! v1-4 (logclear v1-3 (enemy-flag enable-on-active))) + (if (logtest? v1-3 (enemy-flag vulnerable-backup)) + (set! v1-4 (logior v1-3 (enemy-flag vulnerable))) + (set! v1-4 (logclear v1-3 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-4) @@ -591,7 +591,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) (logior! (-> self focus-status) (focus-status disable)) ) @@ -600,8 +600,7 @@ (set! (-> self vehicle-seat-index) -1) (set! (-> self vehicle-handle) (the-as handle #f)) (logclear! (-> self bot-flags) (bot-flags bf16)) - (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) - ;; og:preserve-this fix potential use-after-free bug + (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) ;; og:preserve-this fix potential use-after-free bug (if (-> self nav) (let ((v1-5 (-> self nav))) (logclear! (-> v1-5 shape nav-flags) (nav-flags has-extra-sphere)) @@ -609,9 +608,9 @@ 0 (logclear! (-> self focus-status) (focus-status disable)) (let ((v1-10 (-> self enemy-flags))) - (if (logtest? v1-10 (enemy-flag checking-water)) - (set! v1-11 (logior v1-10 (enemy-flag enable-on-active))) - (set! v1-11 (logclear v1-10 (enemy-flag enable-on-active))) + (if (logtest? v1-10 (enemy-flag vulnerable-backup)) + (set! v1-11 (logior v1-10 (enemy-flag vulnerable))) + (set! v1-11 (logclear v1-10 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-11) @@ -755,7 +754,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -805,29 +804,29 @@ ) :code (behavior () (local-vars (v1-7 enemy-flag) (v1-15 enemy-flag)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-6 (-> self enemy-flags))) - (if (logtest? v1-6 (enemy-flag checking-water)) - (set! v1-7 (logior v1-6 (enemy-flag enable-on-active))) - (set! v1-7 (logclear v1-6 (enemy-flag enable-on-active))) + (if (logtest? v1-6 (enemy-flag vulnerable-backup)) + (set! v1-7 (logior v1-6 (enemy-flag vulnerable))) + (set! v1-7 (logclear v1-6 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-7) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-14 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-14) - (set! v1-15 (logior (enemy-flag check-water-backup) v1-14)) - (set! v1-15 (logclear v1-14 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-14) + (set! v1-15 (logior (enemy-flag trackable) v1-14)) + (set! v1-15 (logclear v1-14 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-15) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) @@ -865,7 +864,7 @@ (reset! *fail-mission-control*) ) (cond - ((zero? (get-rand-int self 3)) + ((zero? (rnd-int-count self 3)) (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! crocadog-escort-idle-bark-ja :num! (seek! (ja-aframe 3.0 0) 0.5) :frame-num 0.0) (until (ja-done? 0) @@ -880,7 +879,7 @@ ) (else (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.4 0.6))) + (let ((f30-0 (rnd-float-range self 0.4 0.6))) (ja-no-eval :group! crocadog-escort-angry-bark-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -944,13 +943,13 @@ (vector-reset! (-> self root transv)) (stop-looking-at-target! self) (logior! (-> self bot-flags) (bot-flags bf09)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> self focus-status) (focus-status dangerous)) - (logclear! (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> self mask) (process-mask collectable)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> self mask) (process-mask actor-pause)) - (logclear! (-> self enemy-flags) (enemy-flag notice)) + (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logclear! (-> self focus-status) (focus-status disable)) (set! (-> self travel-anim-interp) 0.0) ) diff --git a/goal_src/jak2/levels/city/kiddogescort/crocesc.gc b/goal_src/jak2/levels/city/kiddogescort/crocesc.gc index 8ee3c0fed2..f96819081f 100644 --- a/goal_src/jak2/levels/city/kiddogescort/crocesc.gc +++ b/goal_src/jak2/levels/city/kiddogescort/crocesc.gc @@ -210,7 +210,9 @@ (let* ((t9-0 (method-of-type bot bot-method-193)) (v0-0 (t9-0 this)) ) - (if (and (not v0-0) (logtest? #x1c00000 (-> this incoming penetrate-using))) + (if (and (not v0-0) + (logtest? (penetrate jak-yellow-shot jak-red-shot jak-blue-shot) (-> this incoming penetrate-using)) + ) (set! v0-0 #t) ) v0-0 @@ -438,7 +440,7 @@ This commonly includes things such as: ) (set! (-> this min-speed) 9011.2) (set! (-> this max-speed) 28672.0) - (set! (-> this channel) (the-as uint 31)) + (set! (-> this channel) (gui-channel crocadog)) (set! (-> this notice-enemy-dist) 24576.0) (set! (-> this travel-anim-interp) 0.0) (set! (-> this focus-info max-los-dist) 0.0) @@ -502,9 +504,9 @@ This commonly includes things such as: (quaternion-rotate-y! s5-0 s5-0 f30-0) ) (let ((v1-21 (-> this enemy-flags))) - (if (logtest? v1-21 (enemy-flag checking-water)) - (set! v1-22 (logior v1-21 (enemy-flag enable-on-active))) - (set! v1-22 (logclear v1-21 (enemy-flag enable-on-active))) + (if (logtest? v1-21 (enemy-flag vulnerable-backup)) + (set! v1-22 (logior v1-21 (enemy-flag vulnerable))) + (set! v1-22 (logclear v1-21 (enemy-flag vulnerable))) ) ) (set! (-> this enemy-flags) v1-22) @@ -517,7 +519,9 @@ This commonly includes things such as: this 'attack #f - (static-attack-info ((id (new-attack-id)) (vector s5-1) (attacker-velocity s5-1) (knock (the-as uint 8)))) + (static-attack-info + ((id (new-attack-id)) (vector s5-1) (attacker-velocity s5-1) (knock (knocked-type knocked-type-8))) + ) ) ) ) @@ -530,13 +534,13 @@ This commonly includes things such as: (defmethod go-hostile ((this crocadog-escort)) (cond ((logtest? (bot-flags bf17) (-> this bot-flags)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag check-water)) + (logclear! (-> this enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (logior! (-> this focus-status) (focus-status disable)) (go (method-of-object this knocked-off-vehicle)) ) @@ -633,14 +637,14 @@ This commonly includes things such as: #t ) -(defmethod enemy-method-78 ((this crocadog-escort) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this crocadog-escort) (arg0 enemy-knocked-info)) (ja-channel-push! 1 (seconds 0.1)) (let ((a1-2 (-> this draw art-group data (-> this enemy-info knocked-land-anim))) (a0-4 (-> this skel root-channel 0)) ) (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-2)) (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-2) num-func-seek!) ) diff --git a/goal_src/jak2/levels/city/kiddogescort/crocesc4-course.gc b/goal_src/jak2/levels/city/kiddogescort/crocesc4-course.gc index 8ea3fa912f..69366adcf8 100644 --- a/goal_src/jak2/levels/city/kiddogescort/crocesc4-course.gc +++ b/goal_src/jak2/levels/city/kiddogescort/crocesc4-course.gc @@ -28,7 +28,7 @@ 0 (move-to-point! (-> arg0 root) (the-as vector (-> arg0 course spots 0))) (logclear! (-> arg0 mask) (process-mask actor-pause)) - (logclear! (-> arg0 enemy-flags) (enemy-flag notice)) + (logclear! (-> arg0 enemy-flags) (enemy-flag actor-pause-backup)) (let ((v1-16 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) (set! (-> v1-16 bytes 5) 1) (set! (-> v1-16 bytes 6) 0) diff --git a/goal_src/jak2/levels/city/kiddogescort/hal4-course.gc b/goal_src/jak2/levels/city/kiddogescort/hal4-course.gc index e0b8c91314..2894b3ce35 100644 --- a/goal_src/jak2/levels/city/kiddogescort/hal4-course.gc +++ b/goal_src/jak2/levels/city/kiddogescort/hal4-course.gc @@ -99,7 +99,7 @@ (let ((t9-0 (method-of-type hal init-enemy!))) (t9-0 this) ) - (set! (-> this channel) (the-as uint 20)) + (set! (-> this channel) (gui-channel daxter)) 0 (none) ) @@ -117,7 +117,7 @@ (set! (-> this arrestor-handle) (the-as handle #f)) ) ((focus-test? (the-as process-focusable v1-3) hit) - (when (and (time-elapsed? (-> this played-defend-time) (seconds 6)) (not (channel-active? this (the-as uint 0)))) + (when (and (time-elapsed? (-> this played-defend-time) (seconds 6)) (not (channel-active? this (gui-channel none)))) (let ((a1-5 (bot-speech-list-method-9 (-> this hal4-course defend-speeches) this @@ -140,7 +140,7 @@ (if (and (not (speech-playing? this 30)) (nonzero? (-> this played-defend-time)) (time-elapsed? (-> this played-defend-time) (seconds 3)) - (not (channel-active? this (the-as uint 0))) + (not (channel-active? this (gui-channel none))) ) (play-speech this 30) ) @@ -563,7 +563,7 @@ ) (defmethod play-too-far-warn-speech ((this hal-escort)) - (when (not (channel-active? this (the-as uint 0))) + (when (not (channel-active? this (gui-channel none))) (let ((s5-0 0)) (let* ((v1-5 (-> this actor-group 0 data 1 actor)) (s4-0 (when v1-5 @@ -941,7 +941,7 @@ (lambda ((arg0 object) (arg1 hal-escort)) (if (and (not (speech-playing? arg1 3)) (time-elapsed? (-> arg1 waypoint-time0) (seconds 1)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 3) ) @@ -1251,7 +1251,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))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 7) ) @@ -1280,10 +1280,10 @@ (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 transv)) 40960.0) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) ) - (play-speech arg0 (if (zero? (get-rand-int arg0 2)) + (play-speech arg0 (if (zero? (rnd-int-count arg0 2)) 32 31 ) @@ -1294,7 +1294,7 @@ (when (and (zero? (-> arg0 locked-player-time)) (or (not (speech-playing? arg0 33)) (not (speech-playing? arg0 34))) (time-elapsed? (-> arg0 played-get-in-time) (seconds 6)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) (let ((a0-18 (handle->process (-> arg0 vehicle-handle)))) (when a0-18 @@ -1426,7 +1426,7 @@ (lambda ((arg0 object) (arg1 hal-escort)) (when (and (not (speech-playing? arg1 4)) (time-elapsed? (-> arg1 waypoint-time0) (seconds 2)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 15) (play-speech arg1 4) @@ -1565,7 +1565,7 @@ ) (when (and (process-grab? s4-1 #t) (process-grab? s3-2 #t) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (process-grab? s5-0 #f) ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) @@ -1703,7 +1703,7 @@ ) ) (when (and (time-elapsed? (-> arg1 waypoint-time0) (seconds 3)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (scene-play arg1 "dig-knock-down-scaffolding-intro" #t) ) (remove-setting! 'entity-name) diff --git a/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc b/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc index 56b0ff6857..0db2d64094 100644 --- a/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc +++ b/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc @@ -23,7 +23,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -97,7 +97,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -313,7 +313,7 @@ (put-rider-in-seat (the-as vehicle gp-0) (-> self vehicle-seat-index) self) ) (logior! (-> self focus-status) (focus-status pilot)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logior! (-> self focus-status) (focus-status disable)) (logclear! (-> self focus-status) (focus-status arrestable)) (logclear! (-> self bot-flags) (bot-flags bf15)) @@ -323,9 +323,9 @@ (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) (logclear! (-> self focus-status) (focus-status disable)) (let ((v1-5 (-> self enemy-flags))) - (if (logtest? v1-5 (enemy-flag checking-water)) - (set! v1-6 (logior v1-5 (enemy-flag enable-on-active))) - (set! v1-6 (logclear v1-5 (enemy-flag enable-on-active))) + (if (logtest? v1-5 (enemy-flag vulnerable-backup)) + (set! v1-6 (logior v1-5 (enemy-flag vulnerable))) + (set! v1-6 (logclear v1-5 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-6) @@ -453,7 +453,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logclear! (-> self root nav-flags) (nav-flags has-root-sphere)) (let ((v1-11 (-> self nav))) (logclear! (-> v1-11 shape nav-flags) (nav-flags has-extra-sphere)) @@ -466,9 +466,9 @@ (local-vars (v1-4 enemy-flag)) (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) (let ((v1-3 (-> self enemy-flags))) - (if (logtest? v1-3 (enemy-flag checking-water)) - (set! v1-4 (logior v1-3 (enemy-flag enable-on-active))) - (set! v1-4 (logclear v1-3 (enemy-flag enable-on-active))) + (if (logtest? v1-3 (enemy-flag vulnerable-backup)) + (set! v1-4 (logior v1-3 (enemy-flag vulnerable))) + (set! v1-4 (logclear v1-3 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-4) @@ -535,7 +535,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) (logior! (-> self focus-status) (focus-status disable)) (logclear! (-> self focus-status) (focus-status arrestable)) @@ -559,9 +559,9 @@ 0 (logclear! (-> self focus-status) (focus-status disable)) (let ((v1-16 (-> self enemy-flags))) - (if (logtest? v1-16 (enemy-flag checking-water)) - (set! v1-17 (logior v1-16 (enemy-flag enable-on-active))) - (set! v1-17 (logclear v1-16 (enemy-flag enable-on-active))) + (if (logtest? v1-16 (enemy-flag vulnerable-backup)) + (set! v1-17 (logior v1-16 (enemy-flag vulnerable))) + (set! v1-17 (logclear v1-16 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-17) @@ -693,7 +693,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -765,29 +765,29 @@ ) :code (behavior () (local-vars (v1-7 enemy-flag) (v1-15 enemy-flag)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-6 (-> self enemy-flags))) - (if (logtest? v1-6 (enemy-flag checking-water)) - (set! v1-7 (logior v1-6 (enemy-flag enable-on-active))) - (set! v1-7 (logclear v1-6 (enemy-flag enable-on-active))) + (if (logtest? v1-6 (enemy-flag vulnerable-backup)) + (set! v1-7 (logior v1-6 (enemy-flag vulnerable))) + (set! v1-7 (logclear v1-6 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-7) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-14 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-14) - (set! v1-15 (logior (enemy-flag check-water-backup) v1-14)) - (set! v1-15 (logclear v1-14 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-14) + (set! v1-15 (logior (enemy-flag trackable) v1-14)) + (set! v1-15 (logclear v1-14 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-15) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) @@ -826,7 +826,7 @@ (logior! (-> self focus-status) (focus-status arrestable)) (logclear! (-> self focus-status) (focus-status disable)) (if (logtest? (bot-flags bf19) (-> self bot-flags)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) ) :trans (behavior () @@ -865,7 +865,7 @@ ) ) (if v1-7 - (logclear! (-> (the-as crimson-guard v1-7) enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> (the-as crimson-guard v1-7) enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) ) ) @@ -905,7 +905,7 @@ ) ) (if v1-93 - (logclear! (-> (the-as crimson-guard v1-93) enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> (the-as crimson-guard v1-93) enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) ) ) @@ -998,13 +998,13 @@ (vector-reset! (-> self root transv)) (stop-looking-at-target! self) (logior! (-> self bot-flags) (bot-flags bf09)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> self focus-status) (focus-status dangerous)) - (logclear! (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> self mask) (process-mask collectable)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> self mask) (process-mask actor-pause)) - (logclear! (-> self enemy-flags) (enemy-flag notice)) + (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logior! (-> self focus-status) (focus-status arrestable)) (logior! (-> self focus-status) (focus-status disable)) (set! (-> self travel-anim-interp) 0.0) diff --git a/goal_src/jak2/levels/city/kiddogescort/kidesc.gc b/goal_src/jak2/levels/city/kiddogescort/kidesc.gc index 787ce20115..809d1559fc 100644 --- a/goal_src/jak2/levels/city/kiddogescort/kidesc.gc +++ b/goal_src/jak2/levels/city/kiddogescort/kidesc.gc @@ -211,11 +211,11 @@ (set! (-> a1-11 y) 0.0) (forward-up->quaternion (-> this root quat) a1-11 *up-vector*) ) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (send-event (handle->process (-> this master-handle)) 'notify 'arrest s5-1) ) (go (method-of-object this arrested)) @@ -460,7 +460,7 @@ This commonly includes things such as: ) (set! (-> this min-speed) 18022.4) (set! (-> this max-speed) 18432.0) - (set! (-> this channel) (the-as uint 26)) + (set! (-> this channel) (gui-channel kid)) (set! (-> this notice-enemy-dist) 122880.0) (set! (-> this travel-anim-interp) 0.0) (set! (-> this focus-info max-los-dist) 0.0) @@ -582,14 +582,14 @@ This commonly includes things such as: #t ) -(defmethod enemy-method-78 ((this kid-escort) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this kid-escort) (arg0 enemy-knocked-info)) (ja-channel-push! 1 (seconds 0.1)) (let ((a1-2 (-> this draw art-group data (-> this enemy-info knocked-land-anim))) (a0-4 (-> this skel root-channel 0)) ) (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-2)) (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-2) num-func-seek!) ) @@ -627,7 +627,9 @@ This commonly includes things such as: (let* ((t9-0 (method-of-type bot bot-method-193)) (v0-0 (t9-0 this)) ) - (if (and (not v0-0) (logtest? #x1c00000 (-> this incoming penetrate-using))) + (if (and (not v0-0) + (logtest? (penetrate jak-yellow-shot jak-red-shot jak-blue-shot) (-> this incoming penetrate-using)) + ) (set! v0-0 #t) ) v0-0 @@ -709,9 +711,9 @@ This commonly includes things such as: (quaternion-rotate-y! s4-0 s4-0 f30-0) ) (let ((v1-24 (-> this enemy-flags))) - (if (logtest? v1-24 (enemy-flag checking-water)) - (set! v1-25 (logior v1-24 (enemy-flag enable-on-active))) - (set! v1-25 (logclear v1-24 (enemy-flag enable-on-active))) + (if (logtest? v1-24 (enemy-flag vulnerable-backup)) + (set! v1-25 (logior v1-24 (enemy-flag vulnerable))) + (set! v1-25 (logclear v1-24 (enemy-flag vulnerable))) ) ) (set! (-> this enemy-flags) v1-25) @@ -721,7 +723,9 @@ This commonly includes things such as: this 'attack #f - (static-attack-info ((id (new-attack-id)) (vector s4-2) (attacker-velocity s4-2) (knock (the-as uint 8)))) + (static-attack-info + ((id (new-attack-id)) (vector s4-2) (attacker-velocity s4-2) (knock (knocked-type knocked-type-8))) + ) ) ) ) @@ -735,13 +739,13 @@ This commonly includes things such as: (cond ((logtest? (bot-flags bf17) (-> this bot-flags)) (logior! (-> this bot-flags) (bot-flags bf09)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag check-water)) + (logclear! (-> this enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (logior! (-> this focus-status) (focus-status disable)) (go (method-of-object this knocked-off-vehicle)) ) diff --git a/goal_src/jak2/levels/city/kiddogescort/kidesc4-course.gc b/goal_src/jak2/levels/city/kiddogescort/kidesc4-course.gc index 6aabf6b013..629385a392 100644 --- a/goal_src/jak2/levels/city/kiddogescort/kidesc4-course.gc +++ b/goal_src/jak2/levels/city/kiddogescort/kidesc4-course.gc @@ -49,7 +49,7 @@ 0 (move-to-point! (-> arg0 root) (the-as vector (-> arg0 course spots 0))) (logclear! (-> arg0 mask) (process-mask actor-pause)) - (logclear! (-> arg0 enemy-flags) (enemy-flag notice)) + (logclear! (-> arg0 enemy-flags) (enemy-flag actor-pause-backup)) (let ((v1-16 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) (set! (-> v1-16 bytes 5) 1) (set! (-> v1-16 bytes 6) 0) diff --git a/goal_src/jak2/levels/city/market/ashelin/ash4-course.gc b/goal_src/jak2/levels/city/market/ashelin/ash4-course.gc index 7d3d2bb25c..5297fbf96d 100644 --- a/goal_src/jak2/levels/city/market/ashelin/ash4-course.gc +++ b/goal_src/jak2/levels/city/market/ashelin/ash4-course.gc @@ -330,8 +330,8 @@ (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))) + (when (not (channel-active? arg0 (gui-channel none))) + (let ((v1-12 (rnd-int-count arg0 3))) (cond ((zero? v1-12) (play-speech arg0 42) @@ -355,7 +355,7 @@ (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))) + (not (channel-active? arg1 (gui-channel none))) (scene-play arg1 (the-as string (-> s5-0 scene)) #f) ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) diff --git a/goal_src/jak2/levels/city/market/ashelin/ctyasha-obs.gc b/goal_src/jak2/levels/city/market/ashelin/ctyasha-obs.gc index 6fb4c79116..ec825033f1 100644 --- a/goal_src/jak2/levels/city/market/ashelin/ctyasha-obs.gc +++ b/goal_src/jak2/levels/city/market/ashelin/ctyasha-obs.gc @@ -875,10 +875,10 @@ (displacement-between-points-at-percent-normalized! s5-0 s4-0 f30-0) (forward-up->quaternion (-> this root quat) s4-0 *up-vector*) ) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) - (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) - (logclear! (-> this mask) (process-mask actor-pause)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance directed directed-ready use-trigger)) (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this mask) (process-mask actor-pause)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (set-vector! (-> this root scale) 1.0 1.0 1.0 1.0) (go-hostile this) #t @@ -973,10 +973,10 @@ (displacement-between-points-at-percent-normalized! s5-0 s4-0 f30-0) (forward-up->quaternion (-> this root quat) s4-0 *up-vector*) ) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) - (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) - (logclear! (-> this mask) (process-mask actor-pause)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance directed directed-ready use-trigger)) (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this mask) (process-mask actor-pause)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (set-vector! (-> this root scale) 1.0 1.0 1.0 1.0) (go-hostile this) #t @@ -1442,14 +1442,14 @@ This commonly includes things such as: (v1-1 (new 'stack-no-clear 'vector)) ) (vector-! v1-1 (-> self root trans) (-> self prev-pos)) - (send-event - proc - 'attack - a2-1 - (static-attack-info - ((id (-> self attack-id)) (mode 'eco-red) (attacker-velocity v1-1) (damage 2.0) (knock (the-as uint 2))) - ) - ) + (send-event proc 'attack a2-1 (static-attack-info ((id (-> self attack-id)) + (mode 'eco-red) + (attacker-velocity v1-1) + (damage 2.0) + (knock (knocked-type knocked-type-2)) + ) + ) + ) ) ) ) diff --git a/goal_src/jak2/levels/city/meet-brutter/meet-brutter.gc b/goal_src/jak2/levels/city/meet-brutter/meet-brutter.gc index 389188ea1d..66cb9abe59 100644 --- a/goal_src/jak2/levels/city/meet-brutter/meet-brutter.gc +++ b/goal_src/jak2/levels/city/meet-brutter/meet-brutter.gc @@ -866,7 +866,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info run-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.45 0.65))) + (let ((f30-0 (rnd-float-range self 0.45 0.65))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -1469,7 +1469,9 @@ (set! (-> v1-22 prim-core collide-with) (collide-spec)) ) 0 - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 0 (-> self end-pos)) ) (if (and (time-elapsed? (-> self state-time) (seconds 1)) @@ -1482,7 +1484,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info run-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.45 0.65))) + (let ((f30-0 (rnd-float-range self 0.45 0.65))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -1566,7 +1568,9 @@ (set! (-> v1-27 prim-core collide-with) (collide-spec)) ) 0 - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 0 (-> self end-pos)) ) ) @@ -1575,7 +1579,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info run-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.45 0.65))) + (let ((f30-0 (rnd-float-range self 0.45 0.65))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -1808,7 +1812,12 @@ (let ((gp-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) (set! (-> gp-0 y) 1.0) (vector-normalize! gp-0 40960.0) - (send-event self 'attack #f (static-attack-info ((id (new-attack-id)) (vector gp-0) (knock (the-as uint 7))))) + (send-event + self + 'attack + #f + (static-attack-info ((id (new-attack-id)) (vector gp-0) (knock (knocked-type knocked-type-7)))) + ) ) ) ) diff --git a/goal_src/jak2/levels/city/shuttle/shuttle.gc b/goal_src/jak2/levels/city/shuttle/shuttle.gc index 76b20655d6..42508fb2cd 100644 --- a/goal_src/jak2/levels/city/shuttle/shuttle.gc +++ b/goal_src/jak2/levels/city/shuttle/shuttle.gc @@ -691,7 +691,7 @@ (let* ((t9-0 (method-of-type nav-enemy enemy-method-58)) (v0-0 (t9-0 this arg0 arg1)) ) - (if (logtest? #x4000000 (-> this incoming penetrate-using)) + (if (logtest? (penetrate enemy-yellow-shot) (-> this incoming penetrate-using)) (set! v0-0 #f) ) v0-0 @@ -777,7 +777,7 @@ (-> this neck) (set! (-> this info) *citizen-rebel-global-info*) (set! (-> this anim-shuffle) 10) - (let ((v1-16 (get-rand-int this 3))) + (let ((v1-16 (rnd-int-count this 3))) (cond ((zero? v1-16) (set! (-> this anim-walk) 11) @@ -796,7 +796,7 @@ ) ) ) - (let ((v1-31 (get-rand-int this 3))) + (let ((v1-31 (rnd-int-count this 3))) (cond ((zero? v1-31) (set! (-> this anim-panic-run) 17) @@ -810,7 +810,7 @@ ) ) (set! (-> this dist-run-anim) 28672.0) - (let ((v1-38 (get-rand-int this 3))) + (let ((v1-38 (rnd-int-count this 3))) (cond ((zero? v1-38) (set! (-> this anim-run) 14) @@ -828,12 +828,12 @@ (set! (-> this anim-dive) 19) (set! (-> this anim-get-up-front) 25) (set! (-> this anim-get-up-back) 26) - (let ((f30-0 (get-rand-float-range this 1.0 1.25)) - (f0-10 (get-rand-float-range this 1.0 1.25)) + (let ((f30-0 (rnd-float-range this 1.0 1.25)) + (f0-10 (rnd-float-range this 1.0 1.25)) ) (set-vector! (-> this root scale) f0-10 f30-0 f0-10 1.0) ) - (let ((f0-12 (get-rand-float-range this 0.9 1.0))) + (let ((f0-12 (rnd-float-range this 0.9 1.0))) (set-vector! (-> this draw color-mult) f0-12 f0-12 f0-12 1.0) ) (set! (-> this water-anim) 32) @@ -920,7 +920,7 @@ (setup-masks (-> this draw) 4 0) (setup-masks (-> this draw) 16 0) (setup-masks (-> this draw) 64 0) - (let ((v1-14 (get-rand-int this 3))) + (let ((v1-14 (rnd-int-count this 3))) (cond ((zero? v1-14) (setup-masks (-> this draw) 2 0) @@ -933,7 +933,7 @@ ) ) ) - (let ((v1-23 (get-rand-int this 2))) + (let ((v1-23 (rnd-int-count this 2))) (cond ((zero? v1-23) (setup-masks (-> this draw) 32 0) diff --git a/goal_src/jak2/levels/city/slums/kor/hal3-course.gc b/goal_src/jak2/levels/city/slums/kor/hal3-course.gc index b53a6e8253..acc5db9f03 100644 --- a/goal_src/jak2/levels/city/slums/kor/hal3-course.gc +++ b/goal_src/jak2/levels/city/slums/kor/hal3-course.gc @@ -8,15 +8,15 @@ ;; DECOMP BEGINS (deftype hal3-course (bot-course) - ((transport handle :offset-assert 48) + ((transport handle) ) ) (deftype hal-help-kid (hal) - ((nav-mesh nav-mesh :offset-assert 1024) - (alley-bbox bounding-box :inline :offset-assert 1040) - (suppress traffic-suppression-params 2 :inline :offset-assert 1072) + ((nav-mesh nav-mesh) + (alley-bbox bounding-box :inline) + (suppress traffic-suppression-params 2 :inline) ) (:methods (hal-help-kid-method-227 (_type_) none) @@ -25,12 +25,12 @@ ) -(defmethod init! ((obj hal-help-kid)) +(defmethod init! ((this hal-help-kid)) "Set defaults for various fields." (let ((t9-0 (method-of-type hal init!))) - (t9-0 obj) + (t9-0 this) ) - (let ((v1-1 (-> obj suppress))) + (let ((v1-1 (-> this suppress))) (set! (-> v1-1 0 duration) (seconds 1)) (set! (-> v1-1 0 id) -1) (let ((a0-4 (-> v1-1 0))) @@ -41,8 +41,8 @@ ) (set-vector! (-> v1-1 0 bbox max) 2785280.0 40960.0 20480.0 1.0) ) - (let ((v1-3 (-> obj suppress 1)) - (a1-4 (-> obj alley-bbox)) + (let ((v1-3 (-> this suppress 1)) + (a1-4 (-> this alley-bbox)) ) (set-vector! (-> a1-4 min) 2531328.0 20480.0 -675840.0 1.0) (set-vector! (-> a1-4 max) 2785280.0 40960.0 -233472.0 1.0) @@ -50,11 +50,11 @@ (set! (-> v1-3 id) -1) (mem-copy! (the-as pointer (-> v1-3 bbox)) (the-as pointer a1-4) 32) ) - (set! (-> obj channel) (the-as uint 30)) + (set! (-> this channel) (gui-channel guard)) (none) ) -(defmethod hal-help-kid-method-228 ((obj hal-help-kid) (arg0 vector)) +(defmethod hal-help-kid-method-228 ((this hal-help-kid) (arg0 vector)) (let ((v1-0 (new 'stack-no-clear 'traffic-danger-info))) (set! (-> v1-0 sphere quad) (-> arg0 quad)) (set! (-> v1-0 sphere r) 32768.0) @@ -69,43 +69,43 @@ (none) ) -(defmethod general-event-handler ((obj hal-help-kid) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler ((this hal-help-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" (local-vars (v0-0 object)) (case arg2 (('fail) - (set! v0-0 (logior (-> obj bot-task-bits) (bot-task-bits botbits-0))) - (set! (-> obj bot-task-bits) (the-as bot-task-bits v0-0)) + (set! v0-0 (logior (-> this bot-task-bits) (bot-task-bits botbits-0))) + (set! (-> this bot-task-bits) (the-as bot-task-bits v0-0)) v0-0 ) (('request) (case (-> arg3 param 0) (('scene-player) - (set! v0-0 (logior (-> obj bot-task-bits) (bot-task-bits botbits-3))) - (set! (-> obj bot-task-bits) (the-as bot-task-bits v0-0)) + (set! v0-0 (logior (-> this bot-task-bits) (bot-task-bits botbits-3))) + (set! (-> this bot-task-bits) (the-as bot-task-bits v0-0)) v0-0 ) (else - ((method-of-type hal general-event-handler) obj arg0 arg1 arg2 arg3) + ((method-of-type hal general-event-handler) this arg0 arg1 arg2 arg3) ) ) ) (else - ((method-of-type hal general-event-handler) obj arg0 arg1 arg2 arg3) + ((method-of-type hal general-event-handler) this arg0 arg1 arg2 arg3) ) ) ) -(defmethod hal-help-kid-method-227 ((obj hal-help-kid)) - (let ((s4-0 (-> obj suppress)) - (gp-0 (-> obj suppress 1)) +(defmethod hal-help-kid-method-227 ((this hal-help-kid)) + (let ((s4-0 (-> this suppress)) + (gp-0 (-> this suppress 1)) ) ((method-of-type traffic-suppression-params create-or-update-suppression-box) (the-as traffic-suppression-params s4-0) ) (let ((s5-0 (new 'stack-no-clear 'vector)) - (s3-1 (-> obj alley-bbox)) + (s3-1 (-> this alley-bbox)) ) (set! (-> s5-0 quad) (-> (target-pos 0) quad)) (mem-copy! (the-as pointer (-> gp-0 bbox)) (the-as pointer s3-1) 32) @@ -120,12 +120,12 @@ ) ;; WARN: Return type mismatch nav-mesh vs none. -(defmethod init-enemy! ((obj hal-help-kid)) +(defmethod init-enemy! ((this hal-help-kid)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (let ((t9-0 (method-of-type hal init-enemy!))) - (t9-0 obj) + (t9-0 this) ) - (set! (-> obj nav-mesh) (nav-mesh-from-res-tag (-> obj entity) 'nav-mesh-actor 0)) + (set! (-> this nav-mesh) (nav-mesh-from-res-tag (-> this entity) 'nav-mesh-actor 0)) (none) ) @@ -443,7 +443,7 @@ ) ) (when (and (not (logtest? (-> arg0 waypoint-bits) (waypoint-bits wabits-1))) - (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 3)) + (time-elapsed? (-> arg0 waypoint-time0) (seconds 3)) ) (logior! (-> arg0 waypoint-bits) (waypoint-bits wabits-1)) (let ((s5-0 (new 'stack-no-clear 'transport-params))) @@ -460,7 +460,7 @@ ) (hal-help-kid-method-227 arg0) (when (and (not (logtest? (-> arg0 waypoint-bits) (waypoint-bits wabits-0))) - (>= (- (current-time) (-> arg0 waypoint-time0)) (seconds 0.2)) + (time-elapsed? (-> arg0 waypoint-time0) (seconds 0.2)) ) (logior! (-> arg0 waypoint-bits) (waypoint-bits wabits-0)) (let ((a1-7 (new 'stack-no-clear 'event-message-block))) @@ -621,7 +621,7 @@ (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-help-kid)) (if (and *target* (not (logtest? (-> arg1 bot-task-bits) (bot-task-bits botbits-3)))) - (set! (-> arg1 waypoint-time0) (current-time)) + (set-time! (-> arg1 waypoint-time0)) ) (let ((v1-7 (get-current-task-event (-> arg1 task)))) (when (and (= (-> v1-7 action) (game-task-action say)) (scene-play arg1 (the-as string (-> v1-7 scene)) #f)) 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 fdff2fabac..e4e8fa4782 100644 --- a/goal_src/jak2/levels/city/slums/kor/kid-states.gc +++ b/goal_src/jak2/levels/city/slums/kor/kid-states.gc @@ -25,7 +25,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -94,7 +94,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -247,7 +247,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -380,7 +380,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -452,29 +452,29 @@ (suspend) (ja :num! (seek!)) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-30 (-> self enemy-flags))) - (if (logtest? v1-30 (enemy-flag checking-water)) - (set! v1-31 (logior v1-30 (enemy-flag enable-on-active))) - (set! v1-31 (logclear v1-30 (enemy-flag enable-on-active))) + (if (logtest? v1-30 (enemy-flag vulnerable-backup)) + (set! v1-31 (logior v1-30 (enemy-flag vulnerable))) + (set! v1-31 (logclear v1-30 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-31) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-38 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-38) - (set! v1-39 (logior (enemy-flag check-water-backup) v1-38)) - (set! v1-39 (logclear v1-38 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-38) + (set! v1-39 (logior (enemy-flag trackable) v1-38)) + (set! v1-39 (logclear v1-38 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-39) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) @@ -511,7 +511,7 @@ (stop-looking-at-target! self) (set! (-> self travel-anim-interp) 0.0) (if (logtest? (bot-flags bf20) (-> self bot-flags)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) ) :trans (behavior () @@ -556,7 +556,7 @@ ) ) (if v1-32 - (logclear! (-> (the-as crimson-guard v1-32) enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> (the-as crimson-guard v1-32) enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) ) (let ((v1-35 (ja-group))) diff --git a/goal_src/jak2/levels/city/slums/kor/kid.gc b/goal_src/jak2/levels/city/slums/kor/kid.gc index 721de7fb13..75a5d58474 100644 --- a/goal_src/jak2/levels/city/slums/kor/kid.gc +++ b/goal_src/jak2/levels/city/slums/kor/kid.gc @@ -210,11 +210,11 @@ (forward-up->quaternion (-> this root quat) a1-8 *up-vector*) ) ) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (send-event (handle->process (-> this master-handle)) 'notify 'arrest #f) (go (method-of-object this arrested)) ) @@ -438,7 +438,7 @@ ) (set! (-> this min-speed) 6144.0) (set! (-> this max-speed) 22528.0) - (set! (-> this channel) (the-as uint 26)) + (set! (-> this channel) (gui-channel kid)) (set! (-> this notice-enemy-dist) 122880.0) (set! (-> this travel-anim-interp) 0.0) (set! (-> this focus-info max-los-dist) 0.0) @@ -583,14 +583,14 @@ #t ) -(defmethod enemy-method-78 ((this kid) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this kid) (arg0 enemy-knocked-info)) (ja-channel-push! 1 (seconds 0.1)) (let ((a1-2 (-> this draw art-group data (-> this enemy-info knocked-land-anim))) (a0-4 (-> this skel root-channel 0)) ) (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-2)) (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-2) num-func-seek!) ) diff --git a/goal_src/jak2/levels/city/slums/kor/kid3-course.gc b/goal_src/jak2/levels/city/slums/kor/kid3-course.gc index 9594f8c5c9..4cd0614027 100644 --- a/goal_src/jak2/levels/city/slums/kor/kid3-course.gc +++ b/goal_src/jak2/levels/city/slums/kor/kid3-course.gc @@ -42,7 +42,7 @@ 0 (move-to-point! (-> arg0 root) (the-as vector (-> arg0 course spots 0))) (logclear! (-> arg0 mask) (process-mask actor-pause)) - (logclear! (-> arg0 enemy-flags) (enemy-flag notice)) + (logclear! (-> arg0 enemy-flags) (enemy-flag actor-pause-backup)) (let ((v1-16 (get-task-by-type (-> arg0 ai-ctrl) kidt-wait-spot arg0))) (set! (-> v1-16 bytes 5) 1) (set! (-> v1-16 bytes 6) 0) 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 63ed4b3678..4dcdd68b4a 100644 --- a/goal_src/jak2/levels/city/slums/kor/kor-states.gc +++ b/goal_src/jak2/levels/city/slums/kor/kor-states.gc @@ -23,7 +23,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -93,7 +93,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -256,7 +256,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -389,7 +389,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -461,29 +461,29 @@ (suspend) (ja :num! (seek!)) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-30 (-> self enemy-flags))) - (if (logtest? v1-30 (enemy-flag checking-water)) - (set! v1-31 (logior v1-30 (enemy-flag enable-on-active))) - (set! v1-31 (logclear v1-30 (enemy-flag enable-on-active))) + (if (logtest? v1-30 (enemy-flag vulnerable-backup)) + (set! v1-31 (logior v1-30 (enemy-flag vulnerable))) + (set! v1-31 (logclear v1-30 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-31) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-38 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-38) - (set! v1-39 (logior (enemy-flag check-water-backup) v1-38)) - (set! v1-39 (logclear v1-38 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-38) + (set! v1-39 (logior (enemy-flag trackable) v1-38)) + (set! v1-39 (logclear v1-38 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-39) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) @@ -520,7 +520,7 @@ (stop-looking-at-target! self) (set! (-> self travel-anim-interp) 0.0) (if (logtest? (bot-flags bf20) (-> self bot-flags)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) ) :trans (behavior () @@ -576,7 +576,7 @@ ) ) (if v1-49 - (logclear! (-> (the-as crimson-guard v1-49) enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> (the-as crimson-guard v1-49) enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) ) (ja-channel-push! 1 (seconds 0.1)) diff --git a/goal_src/jak2/levels/city/slums/kor/kor.gc b/goal_src/jak2/levels/city/slums/kor/kor.gc index dd006da53a..6158c7dc84 100644 --- a/goal_src/jak2/levels/city/slums/kor/kor.gc +++ b/goal_src/jak2/levels/city/slums/kor/kor.gc @@ -216,11 +216,11 @@ (forward-up->quaternion (-> this root quat) a1-8 *up-vector*) ) ) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (go (method-of-object this arrested)) ) (else @@ -439,7 +439,7 @@ ) (set! (-> this min-speed) 6144.0) (set! (-> this max-speed) 20889.6) - (set! (-> this channel) (the-as uint 27)) + (set! (-> this channel) (gui-channel kor)) (set! (-> this notice-enemy-dist) 122880.0) (set! (-> this travel-anim-interp) 0.0) (set! (-> this focus-info max-los-dist) 0.0) @@ -581,14 +581,14 @@ #t ) -(defmethod enemy-method-78 ((this kor) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this kor) (arg0 enemy-knocked-info)) (ja-channel-push! 1 (seconds 0.1)) (let ((a1-2 (-> this draw art-group data (-> this enemy-info knocked-land-anim))) (a0-4 (-> this skel root-channel 0)) ) (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-2)) (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-2) num-func-seek!) ) diff --git a/goal_src/jak2/levels/city/slums/kor/kor3-course.gc b/goal_src/jak2/levels/city/slums/kor/kor3-course.gc index bc75bab842..6152fc157d 100644 --- a/goal_src/jak2/levels/city/slums/kor/kor3-course.gc +++ b/goal_src/jak2/levels/city/slums/kor/kor3-course.gc @@ -42,7 +42,7 @@ 0 (move-to-point! (-> arg0 root) (the-as vector (-> arg0 course spots 0))) (logclear! (-> arg0 mask) (process-mask actor-pause)) - (logclear! (-> arg0 enemy-flags) (enemy-flag notice)) + (logclear! (-> arg0 enemy-flags) (enemy-flag actor-pause-backup)) (let ((v1-16 (get-task-by-type (-> arg0 ai-ctrl) kort-wait-spot arg0))) (set! (-> v1-16 bytes 5) 1) (set! (-> v1-16 bytes 6) 0) diff --git a/goal_src/jak2/levels/city/traffic/citizen/citizen-chick.gc b/goal_src/jak2/levels/city/traffic/citizen/citizen-chick.gc index 893b0f797a..709c464532 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/citizen-chick.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/citizen-chick.gc @@ -329,12 +329,12 @@ ) ) -(defmethod enemy-method-77 ((this citizen-chick) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this citizen-chick) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (ja-channel-push! 1 (seconds 0.01)) (let* ((a2-0 (ash 1 (-> this info prev-yellow-hit))) - (v1-3 (enemy-method-120 this 1 a2-0)) + (v1-3 (rnd-bit this 1 a2-0)) (a1-7 (-> this draw @@ -352,7 +352,7 @@ (let ((a0-15 (-> this skel root-channel 0))) (set! (-> a0-15 frame-group) (the-as art-joint-anim a1-7)) (set! (-> a0-15 param 0) (the float (+ (-> (the-as art-joint-anim a1-7) frames num-frames) -1))) - (set! (-> a0-15 param 1) (-> arg0 0)) + (set! (-> a0-15 param 1) (-> arg0 anim-speed)) (set! (-> a0-15 frame-num) 0.0) (joint-control-channel-group! a0-15 (the-as art-joint-anim a1-7) num-func-seek!) ) @@ -361,7 +361,7 @@ (((knocked-type knocked-type-6)) (ja-channel-push! 1 (seconds 0.01)) (let* ((a2-2 (ash 1 (-> this info prev-blue-hit))) - (v1-12 (enemy-method-120 this 3 a2-2)) + (v1-12 (rnd-bit this 3 a2-2)) (a1-14 (-> this draw @@ -396,7 +396,7 @@ (let ((a0-39 (-> this skel root-channel 0))) (set! (-> a0-39 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-39 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-39 param 1) (-> arg0 0)) + (set! (-> a0-39 param 1) (-> arg0 anim-speed)) (set! (-> a0-39 frame-num) 0.0) (joint-control-channel-group! a0-39 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -406,7 +406,7 @@ #t ) -(defmethod enemy-method-78 ((this citizen-chick) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this citizen-chick) (arg0 enemy-knocked-info)) (ja-channel-push! 1 (seconds 0.1)) (let ((a0-2 (-> this skel root-channel 0))) (set! (-> a0-2 frame-group) @@ -422,7 +422,7 @@ ) ) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 @@ -582,7 +582,7 @@ (try-update-focus (-> this focus) *target* this) (set-vector! (-> this neck twist-max) 10922.667 18204.445 0.0 1.0) (set! (-> this anim-shuffle) 26) - (let ((v1-18 (get-rand-int this 3))) + (let ((v1-18 (rnd-int-count this 3))) (cond ((zero? v1-18) (set! (-> this anim-walk) 4) @@ -601,7 +601,7 @@ ) ) ) - (let ((v1-33 (get-rand-int this 3))) + (let ((v1-33 (rnd-int-count this 3))) (cond ((zero? v1-33) (set! (-> this anim-panic-run) 11) @@ -614,7 +614,7 @@ ) ) ) - (let ((v1-39 (get-rand-int this 3))) + (let ((v1-39 (rnd-int-count this 3))) (cond ((zero? v1-39) (set! (-> this dist-run-anim) 26214.4) @@ -635,12 +635,12 @@ (set! (-> this anim-dive) 17) (set! (-> this anim-get-up-back) 25) (set! (-> this anim-get-up-front) 24) - (let ((f30-0 (get-rand-float-range this 1.0 1.25)) - (f0-17 (get-rand-float-range this 1.0 1.25)) + (let ((f30-0 (rnd-float-range this 1.0 1.25)) + (f0-17 (rnd-float-range this 1.0 1.25)) ) (set-vector! (-> this root scale) f0-17 f30-0 f0-17 1.0) ) - (let ((f0-19 (get-rand-float-range this 0.9 1.0))) + (let ((f0-19 (rnd-float-range this 0.9 1.0))) (set-vector! (-> this draw color-mult) f0-19 f0-19 f0-19 1.0) ) (set! (-> this water-anim) 12) @@ -659,7 +659,7 @@ (setup-masks (-> this draw) 0 -1) (setup-masks (-> this draw) 16 0) (setup-masks (-> this draw) 8 0) - (let ((v1-11 (get-rand-int this 3))) + (let ((v1-11 (rnd-int-count this 3))) (cond ((zero? v1-11) (setup-masks (-> this draw) 32 0) @@ -672,7 +672,7 @@ ) ) ) - (let ((v1-20 (get-rand-int this 3))) + (let ((v1-20 (rnd-int-count this 3))) (cond ((zero? v1-20) (setup-masks (-> this draw) 64 0) @@ -685,7 +685,7 @@ ) ) ) - (let ((v1-29 (get-rand-int this 3))) + (let ((v1-29 (rnd-int-count this 3))) (cond ((zero? v1-29) (setup-masks (-> this draw) 4 0) @@ -698,11 +698,11 @@ ) ) ) - (let ((v1-38 (get-rand-int this 3))) + (let ((v1-38 (rnd-int-count this 3))) (cond ((zero? v1-38) (setup-masks (-> this draw) 2 0) - (let ((v1-42 (get-rand-int this 2))) + (let ((v1-42 (rnd-int-count this 2))) (cond ((zero? v1-42) (setup-masks (-> this draw) 128 0) @@ -718,7 +718,7 @@ ) ((= v1-38 2) (setup-masks (-> this draw) 2048 0) - (let ((v1-54 (get-rand-int this 2))) + (let ((v1-54 (rnd-int-count this 2))) (cond ((zero? v1-54) (setup-masks (-> this draw) 128 0) diff --git a/goal_src/jak2/levels/city/traffic/citizen/citizen-enemy.gc b/goal_src/jak2/levels/city/traffic/citizen/citizen-enemy.gc index d96523eae1..1635e1c724 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/citizen-enemy.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/citizen-enemy.gc @@ -18,7 +18,7 @@ ) -(defmethod track-target! ((this citizen-enemy)) +(defmethod common-post ((this citizen-enemy)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -31,7 +31,7 @@ ) (when (and (not (focus-test? this disable dead ignore inactive)) (< (-> this next-update-target) (current-time)) - (not (logtest? (enemy-flag actor-pause-backup) (-> this enemy-flags))) + (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) (-> this next-state) (= (-> this next-state name) 'active) ) @@ -39,7 +39,7 @@ (set! (-> this next-update-target) (+ (current-time) (seconds 0.2))) (traffic-danger-init! this) ) - ((method-of-type citizen track-target!) this) + ((method-of-type citizen common-post) this) (none) ) @@ -220,7 +220,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info walk-anim)) :num! (seek! max f30-0) @@ -273,13 +273,13 @@ (set! (-> this dist-run-anim) (-> this enemy-info run-travel-speed)) (set! (-> this speed-run) (-> this enemy-info walk-travel-speed)) (set! (-> this fated-time) 0) - (logior! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logior! (-> this focus-status) (focus-status dangerous)) - (logior! (-> this enemy-flags) (enemy-flag check-water)) - (logior! (-> this enemy-flags) (enemy-flag check-water-backup no-initial-move-to-ground)) + (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> this enemy-flags) (enemy-flag trackable trackable-backup)) (logclear! (-> this focus-status) (focus-status dead)) (logior! (-> this mask) (process-mask collectable)) - (logior! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logior! (-> this enemy-flags) (enemy-flag attackable-backup)) (if (not (-> this minimap)) (set! (-> this minimap) (add-icon! *minimap* this (the-as uint 70) (the-as int #f) (the-as vector #t) 0)) ) diff --git a/goal_src/jak2/levels/city/traffic/citizen/citizen-fat.gc b/goal_src/jak2/levels/city/traffic/citizen/citizen-fat.gc index 181c6ab5df..e0eb98c660 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/citizen-fat.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/citizen-fat.gc @@ -329,12 +329,12 @@ ) ) -(defmethod enemy-method-77 ((this citizen-fat) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this citizen-fat) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (ja-channel-push! 1 (seconds 0.01)) (let* ((a2-0 (ash 1 (-> this info prev-yellow-hit))) - (v1-3 (enemy-method-120 this 1 a2-0)) + (v1-3 (rnd-bit this 1 a2-0)) (a1-7 (-> this draw @@ -352,7 +352,7 @@ (let ((a0-15 (-> this skel root-channel 0))) (set! (-> a0-15 frame-group) (the-as art-joint-anim a1-7)) (set! (-> a0-15 param 0) (the float (+ (-> (the-as art-joint-anim a1-7) frames num-frames) -1))) - (set! (-> a0-15 param 1) (-> arg0 0)) + (set! (-> a0-15 param 1) (-> arg0 anim-speed)) (set! (-> a0-15 frame-num) 0.0) (joint-control-channel-group! a0-15 (the-as art-joint-anim a1-7) num-func-seek!) ) @@ -361,7 +361,7 @@ (((knocked-type knocked-type-6)) (ja-channel-push! 1 (seconds 0.01)) (let* ((a2-2 (ash 1 (-> this info prev-blue-hit))) - (v1-12 (enemy-method-120 this 3 a2-2)) + (v1-12 (rnd-bit this 3 a2-2)) (a1-14 (-> this draw @@ -396,7 +396,7 @@ (let ((a0-39 (-> this skel root-channel 0))) (set! (-> a0-39 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-39 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-39 param 1) (-> arg0 0)) + (set! (-> a0-39 param 1) (-> arg0 anim-speed)) (set! (-> a0-39 frame-num) 0.0) (joint-control-channel-group! a0-39 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -406,7 +406,7 @@ #t ) -(defmethod enemy-method-78 ((this citizen-fat) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this citizen-fat) (arg0 enemy-knocked-info)) (ja-channel-push! 1 (seconds 0.1)) (let ((a0-2 (-> this skel root-channel 0))) (set! (-> a0-2 frame-group) @@ -422,7 +422,7 @@ ) ) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 @@ -619,7 +619,7 @@ (try-update-focus (-> this focus) *target* this) (set-vector! (-> this neck twist-max) 10922.667 18204.445 0.0 1.0) (set! (-> this anim-shuffle) 12) - (let ((v1-18 (get-rand-int this 3))) + (let ((v1-18 (rnd-int-count this 3))) (cond ((zero? v1-18) (set! (-> this anim-walk) 11) @@ -638,7 +638,7 @@ ) ) ) - (let ((v1-33 (get-rand-int this 3))) + (let ((v1-33 (rnd-int-count this 3))) (cond ((zero? v1-33) (set! (-> this anim-panic-run) 17) @@ -652,7 +652,7 @@ ) ) (set! (-> this dist-run-anim) 20480.0) - (let ((v1-40 (get-rand-int this 3))) + (let ((v1-40 (rnd-int-count this 3))) (cond ((zero? v1-40) (set! (-> this anim-run) 15) @@ -670,12 +670,12 @@ (set! (-> this anim-dive) 18) (set! (-> this anim-get-up-back) 25) (set! (-> this anim-get-up-front) 24) - (let ((f30-0 (get-rand-float-range this 1.0 1.25)) - (f0-15 (get-rand-float-range this 1.0 1.25)) + (let ((f30-0 (rnd-float-range this 1.0 1.25)) + (f0-15 (rnd-float-range this 1.0 1.25)) ) (set-vector! (-> this root scale) f0-15 f30-0 f0-15 1.0) ) - (let ((f0-17 (get-rand-float-range this 0.9 1.0))) + (let ((f0-17 (rnd-float-range this 0.9 1.0))) (set-vector! (-> this draw color-mult) f0-17 f0-17 f0-17 1.0) ) (set! (-> this water-anim) 32) @@ -691,11 +691,11 @@ (set! (-> this dive-reaction) (* 0.2 (rand-vu))) (logclear! (-> this mask) (process-mask enemy)) (setup-masks (-> this draw) 0 -1) - (let ((v1-7 (get-rand-int this 2))) + (let ((v1-7 (rnd-int-count this 2))) (cond ((zero? v1-7) (setup-masks (-> this draw) 8 0) - (let ((v1-11 (get-rand-int this 3))) + (let ((v1-11 (rnd-int-count this 3))) (cond ((zero? v1-11) (setup-masks (-> this draw) 4 0) @@ -708,7 +708,7 @@ ) ) ) - (let ((v1-20 (get-rand-int this 4))) + (let ((v1-20 (rnd-int-count this 4))) (cond ((zero? v1-20) (setup-masks (-> this draw) 2 0) @@ -722,7 +722,7 @@ ) ) (setup-masks (-> this draw) 512 0) - (let ((v1-31 (get-rand-int this 3))) + (let ((v1-31 (rnd-int-count this 3))) (cond ((zero? v1-31) (setup-masks (-> this draw) 64 0) @@ -735,7 +735,7 @@ ) ) ) - (let ((v1-40 (get-rand-int this 3))) + (let ((v1-40 (rnd-int-count this 3))) (cond ((zero? v1-40) (setup-masks (-> this draw) 32 0) @@ -748,7 +748,7 @@ ) ) ) - (let ((v1-49 (get-rand-int this 3))) + (let ((v1-49 (rnd-int-count this 3))) (cond ((zero? v1-49) (setup-masks (-> this draw) 16 0) @@ -765,7 +765,7 @@ ((= v1-7 1) (setup-masks (-> this draw) #x400000 0) (setup-masks (-> this draw) #x200000 0) - (let ((v1-63 (get-rand-int this 2))) + (let ((v1-63 (rnd-int-count this 2))) (cond ((zero? v1-63) (setup-masks (-> this draw) 4096 0) @@ -775,7 +775,7 @@ ) ) ) - (let ((v1-70 (get-rand-int this 2))) + (let ((v1-70 (rnd-int-count this 2))) (cond ((zero? v1-70) (setup-masks (-> this draw) 256 0) @@ -785,7 +785,7 @@ ) ) ) - (let ((v1-77 (get-rand-int this 4))) + (let ((v1-77 (rnd-int-count this 4))) (cond ((zero? v1-77) (setup-masks (-> this draw) 2 0) @@ -798,10 +798,10 @@ ) ) ) - (if (zero? (get-rand-int this 1)) + (if (zero? (rnd-int-count this 1)) (setup-masks (-> this draw) #x20000 0) ) - (let ((v1-91 (get-rand-int this 3))) + (let ((v1-91 (rnd-int-count this 3))) (cond ((zero? v1-91) (setup-masks (-> this draw) 16 0) diff --git a/goal_src/jak2/levels/city/traffic/citizen/citizen-norm.gc b/goal_src/jak2/levels/city/traffic/citizen/citizen-norm.gc index 82fa824639..bc02d1dd9f 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/citizen-norm.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/citizen-norm.gc @@ -341,7 +341,7 @@ ) ) -(defmethod enemy-method-77 ((this citizen-norm) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this citizen-norm) (arg0 enemy-knocked-info)) (local-vars (v1-36 knocked-type)) (cond ((logtest? (-> this flags) (citizen-flag knocked-out-car)) @@ -351,7 +351,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 33)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 33)) num-func-seek!) ) @@ -364,7 +364,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 34)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 34)) num-func-seek!) ) @@ -373,7 +373,7 @@ ((begin (set! v1-36 (-> this incoming knocked-type)) (= v1-36 (knocked-type knocked-type-4))) (ja-channel-push! 1 (seconds 0.1)) (let* ((a2-2 (ash 1 (-> this info prev-yellow-hit))) - (v1-39 (enemy-method-120 this 1 a2-2)) + (v1-39 (rnd-bit this 1 a2-2)) (a1-11 (-> this draw @@ -391,7 +391,7 @@ (let ((a0-21 (-> this skel root-channel 0))) (set! (-> a0-21 frame-group) (the-as art-joint-anim a1-11)) (set! (-> a0-21 param 0) (the float (+ (-> (the-as art-joint-anim a1-11) frames num-frames) -1))) - (set! (-> a0-21 param 1) (-> arg0 0)) + (set! (-> a0-21 param 1) (-> arg0 anim-speed)) (set! (-> a0-21 frame-num) 0.0) (joint-control-channel-group! a0-21 (the-as art-joint-anim a1-11) num-func-seek!) ) @@ -400,7 +400,7 @@ ((= v1-36 (knocked-type knocked-type-6)) (ja-channel-push! 1 (seconds 0.01)) (let* ((a2-4 (ash 1 (-> this info prev-blue-hit))) - (v1-48 (enemy-method-120 this 3 a2-4)) + (v1-48 (rnd-bit this 3 a2-4)) (a1-18 (-> this draw @@ -435,12 +435,12 @@ (if (or (= (-> this incoming knocked-type) (knocked-type knocked-type-2)) (= (-> this incoming knocked-type) (knocked-type knocked-type-3)) ) - (set! (-> arg0 0) (* 0.5 (-> arg0 0))) + (set! (-> arg0 anim-speed) (* 0.5 (-> arg0 anim-speed))) ) (let ((a0-47 (-> this skel root-channel 0))) (set! (-> a0-47 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-47 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-47 param 1) (-> arg0 0)) + (set! (-> a0-47 param 1) (-> arg0 anim-speed)) (set! (-> a0-47 frame-num) 0.0) (joint-control-channel-group! a0-47 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -450,9 +450,9 @@ #t ) -(defmethod enemy-method-78 ((this citizen-norm) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this citizen-norm) (arg0 enemy-knocked-info)) (ja-channel-push! 1 (seconds 0.1)) - (set! (-> arg0 0) 1.0) + (set! (-> arg0 anim-speed) 1.0) (let ((a0-2 (-> this skel root-channel 0))) (set! (-> a0-2 frame-group) (the-as art-joint-anim (-> this draw art-group data (-> this info knocked-land (-> this hit-face)))) @@ -467,7 +467,7 @@ ) ) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 @@ -764,7 +764,7 @@ (-> this neck) (set! (-> this info) *citizen-norm-global-info*) (set! (-> this anim-shuffle) 11) - (let ((v1-18 (get-rand-int this 3))) + (let ((v1-18 (rnd-int-count this 3))) (cond ((zero? v1-18) (set! (-> this anim-walk) 12) @@ -783,7 +783,7 @@ ) ) ) - (let ((v1-33 (get-rand-int this 3))) + (let ((v1-33 (rnd-int-count this 3))) (cond ((zero? v1-33) (set! (-> this anim-panic-run) 15) @@ -797,7 +797,7 @@ ) ) (set! (-> this dist-run-anim) 28672.0) - (let ((v1-40 (get-rand-int this 3))) + (let ((v1-40 (rnd-int-count this 3))) (cond ((zero? v1-40) (set! (-> this anim-run) 14) @@ -815,12 +815,12 @@ (set! (-> this anim-dive) 16) (set! (-> this anim-get-up-front) 22) (set! (-> this anim-get-up-back) 23) - (let ((f30-0 (get-rand-float-range this 1.0 1.25)) - (f0-11 (get-rand-float-range this 1.0 1.25)) + (let ((f30-0 (rnd-float-range this 1.0 1.25)) + (f0-11 (rnd-float-range this 1.0 1.25)) ) (set-vector! (-> this root scale) f0-11 f30-0 f0-11 1.0) ) - (let ((f0-13 (get-rand-float-range this 0.9 1.0))) + (let ((f0-13 (rnd-float-range this 0.9 1.0))) (set-vector! (-> this draw color-mult) f0-13 f0-13 f0-13 1.0) ) (set! (-> this water-anim) 29) @@ -837,7 +837,7 @@ (logclear! (-> this mask) (process-mask enemy)) (setup-masks (-> this draw) 0 -1) (setup-masks (-> this draw) 32 0) - (let ((v1-10 (get-rand-int this 4))) + (let ((v1-10 (rnd-int-count this 4))) (cond ((zero? v1-10) (setup-masks (-> this draw) 64 0) @@ -853,7 +853,7 @@ ) ) ) - (let ((v1-21 (get-rand-int this 3))) + (let ((v1-21 (rnd-int-count this 3))) (cond ((zero? v1-21) (setup-masks (-> this draw) 2 0) @@ -866,7 +866,7 @@ ) ) ) - (let ((v1-30 (get-rand-int this 4))) + (let ((v1-30 (rnd-int-count this 4))) (cond ((zero? v1-30) (setup-masks (-> this draw) 8 0) @@ -882,7 +882,7 @@ ) ) ) - (let ((v1-41 (get-rand-int this 5))) + (let ((v1-41 (rnd-int-count this 5))) (cond ((zero? v1-41) (setup-masks (-> this draw) 4 0) @@ -898,7 +898,7 @@ ) ) ) - (let ((v1-52 (get-rand-int this 4))) + (let ((v1-52 (rnd-int-count this 4))) (cond ((zero? v1-52) (setup-masks (-> this draw) 128 0) @@ -915,7 +915,7 @@ ) ) (setup-masks (-> this draw) 16 0) - (let ((v1-65 (get-rand-int this 4))) + (let ((v1-65 (rnd-int-count this 4))) (cond ((zero? v1-65) (setup-masks (-> this draw) 256 0) diff --git a/goal_src/jak2/levels/city/traffic/citizen/citizen.gc b/goal_src/jak2/levels/city/traffic/citizen/citizen.gc index 24e42bcb10..dea62f65d1 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/citizen.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/citizen.gc @@ -52,7 +52,7 @@ (logclear! (-> this focus-status) (focus-status disable dead inactive hit)) (logclear! (-> this flags) (citizen-flag persistent in-pursuit hostile)) (clear-focused (-> this focus)) - (set! (-> this enemy-flags) (the-as enemy-flag (logand (enemy-flag dislike-combo) (-> this enemy-flags)))) + (set! (-> this enemy-flags) (the-as enemy-flag (logand (enemy-flag drawn-mirrored) (-> this enemy-flags)))) (logclear! (-> this draw status) (draw-control-status no-draw lod-set)) (set! (-> this draw death-timer) (the-as uint 0)) (logior! (-> this root nav-flags) (nav-flags has-root-sphere)) @@ -78,12 +78,12 @@ dark-giant ) ) - (logior! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logior! (-> this focus-status) (focus-status dangerous)) - (logior! (-> this enemy-flags) (enemy-flag check-water)) - (logior! (-> this enemy-flags) (enemy-flag check-water-backup no-initial-move-to-ground)) + (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> this enemy-flags) (enemy-flag trackable trackable-backup)) (logior! (-> this mask) (process-mask collectable)) - (logior! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logior! (-> this enemy-flags) (enemy-flag attackable-backup)) (set! (-> this hit-points) (-> this enemy-info default-hit-points)) (set! (-> this fated-time) 0) (set! (-> this hit-by-player-count) 0) @@ -355,7 +355,7 @@ (none) ) -(defmethod track-target! ((this citizen)) +(defmethod common-post ((this citizen)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -370,7 +370,7 @@ (set! (-> s5-0 quad) (-> this danger-pos quad)) ) (when (< (vector-vector-distance s5-0 (-> this root trans)) 122880.0) - (look-at-target! this (enemy-flag lock-focus)) + (look-at-target! this (enemy-flag look-at-focus)) (target-set! (-> this neck) s5-0) ) ) @@ -378,18 +378,18 @@ ) (when (< (-> this stop-time-look-at) (current-time)) (shut-down (-> this neck)) - (set! (-> this next-time-look-at) (+ (current-time) (the int (* 300.0 (get-rand-float-range this 0.0 20.0))))) + (set! (-> this next-time-look-at) (+ (current-time) (the int (* 300.0 (rnd-float-range this 0.0 20.0))))) (set! (-> this stop-time-look-at) - (+ (-> this next-time-look-at) (the int (* 300.0 (get-rand-float-range this 5.0 10.0)))) + (+ (-> this next-time-look-at) (the int (* 300.0 (rnd-float-range this 5.0 10.0)))) ) ) ) ) (let ((a0-18 (-> this enemy-flags))) - (when (and (logtest? a0-18 (enemy-flag attackable-backup)) + (when (and (logtest? a0-18 (enemy-flag auto-reset-penetrate)) (time-elapsed? (-> this auto-reset-penetrate-time) (seconds 0.1)) ) - (set! (-> this enemy-flags) (logclear a0-18 (enemy-flag attackable-backup))) + (set! (-> this enemy-flags) (logclear a0-18 (enemy-flag auto-reset-penetrate))) (set! (-> this root penetrated-by) (get-penetrate-info this)) (let ((v1-50 0)) (if (logtest? (penetrate knocked) (-> this root penetrate-using)) @@ -428,7 +428,7 @@ ) ) ) - (when (logtest? (enemy-flag trackable-backup directed-ready) (-> this enemy-flags)) + (when (logtest? (enemy-flag check-water checking-water) (-> this enemy-flags)) (enemy-method-54 this) (when (and (focus-test? this touch-water) (< (-> this root trans y) (+ -11468.8 (-> this water-surface-height)))) (set! (-> this root trans y) (+ -11468.8 (-> this water-surface-height))) @@ -582,6 +582,7 @@ ) ;; og:preserve-this modified for PC, see comment near definition in collide-shape-h.gc (normalized-heading-to-quaternion! gp-0 s3-0) + (quaternion-normalize! gp-0) (quaternion-pseudo-seek s5-1 s5-1 @@ -611,7 +612,7 @@ ) ) ) - (track-target! this) + (common-post this) (update-transforms (-> this root)) 0 (none) @@ -629,9 +630,9 @@ (let ((t9-0 (method-of-type nav-enemy init-enemy-behaviour-and-stats!))) (t9-0 this arg0) ) - (set! (-> this speed-scale) (get-rand-float-range this 0.9 1.1)) + (set! (-> this speed-scale) (rnd-float-range this 0.9 1.1)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (vehicle-controller-method-9 (-> this controller)) (citizen-init! this) (if (zero? (-> this draw light-index)) @@ -1232,7 +1233,12 @@ This commonly includes things such as: (vector-normalize! s5-1 32768.0) (set! (-> s5-1 y) 71680.0) (vector+! s5-1 s5-1 (-> (the-as vehicle s4-0) root transv)) - (send-event this 'attack #f (static-attack-info ((id (new-attack-id)) (vector s5-1) (knock (the-as uint 7))))) + (send-event + this + 'attack + #f + (static-attack-info ((id (new-attack-id)) (vector s5-1) (knock (knocked-type knocked-type-7)))) + ) ) ) ) @@ -1254,7 +1260,7 @@ This commonly includes things such as: (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (set! (-> self wait-time) (the-as time-frame (get-rand-int-range self 300 1500))) + (set! (-> self wait-time) (the-as time-frame (rnd-int-range self 300 1500))) (if (= (-> self water-anim) -1) (go-inactive self) ) @@ -1389,7 +1395,7 @@ This commonly includes things such as: (set! (-> v1-16 target-speed) (* (-> self speed-scale) (-> self speed-walk))) ) 0 - (set! (-> self wait-time) (the-as time-frame (get-rand-int-range self 1200 9000))) + (set! (-> self wait-time) (the-as time-frame (rnd-int-range self 1200 9000))) (when (zero? (-> self controller branch)) (format 0 "citizen has no branch in active enter state~%") (citizen-method-195 self (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) @@ -1412,7 +1418,7 @@ This commonly includes things such as: 0 (when (= (-> self nav state speed) 0.0) (set! (-> self wait-return-state) (the-as (state citizen) (-> self state))) - (set! (-> self wait-time) (the-as time-frame (get-rand-int-range self 300 1500))) + (set! (-> self wait-time) (the-as time-frame (rnd-int-range self 300 1500))) (go-virtual wait) ) ) diff --git a/goal_src/jak2/levels/city/traffic/citizen/civilian.gc b/goal_src/jak2/levels/city/traffic/citizen/civilian.gc index 1200d1dc95..d050d067fc 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/civilian.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/civilian.gc @@ -124,13 +124,13 @@ (set! (-> this hit-points) (-> this enemy-info default-hit-points)) (set! (-> this hit-points) (rand-vu-int-range 1 4)) (set! (-> this fated-time) 0) - (logior! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logior! (-> this focus-status) (focus-status dangerous)) - (logior! (-> this enemy-flags) (enemy-flag check-water)) - (logior! (-> this enemy-flags) (enemy-flag check-water-backup no-initial-move-to-ground)) + (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> this enemy-flags) (enemy-flag trackable trackable-backup)) (logclear! (-> this focus-status) (focus-status dead)) (logior! (-> this mask) (process-mask collectable)) - (logior! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logior! (-> this enemy-flags) (enemy-flag attackable-backup)) (if (zero? (-> this hit-face)) (go (method-of-object this get-up-front)) (go (method-of-object this get-up-back)) @@ -183,7 +183,7 @@ ) ) -(defmethod enemy-method-108 ((this civilian) (arg0 enemy) (arg1 event-message-block)) +(defmethod enemy-method-108 ((this civilian) (arg0 process-drawable) (arg1 event-message-block)) 0 ) @@ -460,7 +460,7 @@ ) ) (when (< (-> self cp-next-time) (current-time)) - (set! (-> self cp-next-time) (+ (current-time) (get-rand-int-range self 600 1200))) + (set! (-> self cp-next-time) (+ (current-time) (rnd-int-range self 600 1200))) (citizen-method-190 self (-> self cp-force)) ) (add-offset-to-target! (-> self nav state) (-> self cp-force)) @@ -722,7 +722,7 @@ (set! (-> v1-9 target-speed) (* (-> self speed-scale) (-> self speed-walk))) ) 0 - (set! (-> self next-time) (+ (current-time) (get-rand-int-range self 300 600))) + (set! (-> self next-time) (+ (current-time) (rnd-int-range self 300 600))) (set! (-> self last-second-pos quad) (-> self root trans quad)) (set! (-> self last-distance) (vector-vector-xz-distance (-> self controller turn-exit-point) (-> self root trans)) @@ -847,7 +847,7 @@ (citizen-method-192 self) (when (< (-> self cp-next-time) (current-time)) (citizen-method-190 self (-> self cp-force)) - (set! (-> self cp-next-time) (+ (current-time) (get-rand-int-range self 1200 2400))) + (set! (-> self cp-next-time) (+ (current-time) (rnd-int-range self 1200 2400))) ) (let ((gp-1 (new 'stack-no-clear 'vector))) (citizen-method-188 self gp-1) @@ -899,7 +899,7 @@ (set! (-> v1-9 target-speed) (* (-> self speed-scale) (-> self speed-walk))) ) 0 - (set! (-> self cp-next-time) (+ (current-time) (get-rand-int-range self 1200 2400))) + (set! (-> self cp-next-time) (+ (current-time) (rnd-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) @@ -1129,7 +1129,7 @@ ) 0 (if (-> self dive-finished?) - (track-target! self) + (common-post self) (nav-enemy-method-176 self) ) ) @@ -1225,7 +1225,7 @@ (set! (-> a0-0 travel quad) (-> v1-1 quad)) ) 0 - (track-target! self) + (common-post self) ) ) @@ -1276,7 +1276,7 @@ (set! (-> a0-1 travel quad) (-> v1-3 quad)) ) 0 - (track-target! self) + (common-post self) ) ) @@ -1327,12 +1327,12 @@ (set! (-> a0-1 travel quad) (-> v1-3 quad)) ) 0 - (track-target! self) + (common-post self) ) ) (defbehavior civilian-falling-post civilian () - (logior! (-> self enemy-flags) (enemy-flag directed)) + (logior! (-> self enemy-flags) (enemy-flag recover-applied-velocity)) (let ((gp-0 (-> self root))) (cond ((focus-test? self under-water) @@ -1354,7 +1354,7 @@ ) ) (enemy-method-111 self) - (track-target! self) + (common-post self) (none) ) @@ -1803,7 +1803,7 @@ (go-virtual ride) ) :post (behavior () - (track-target! self) + (common-post self) ) ) @@ -1873,7 +1873,7 @@ #f ) :post (behavior () - (track-target! self) + (common-post self) ) ) @@ -2022,7 +2022,7 @@ (go-virtual active) ) :post (behavior () - (track-target! self) + (common-post self) ) ) diff --git a/goal_src/jak2/levels/city/traffic/citizen/guard.gc b/goal_src/jak2/levels/city/traffic/citizen/guard.gc index ca86e8aa23..3957109ac1 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/guard.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/guard.gc @@ -358,7 +358,7 @@ (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)) (set! (-> s0-0 quad) (-> this root trans quad)) (cond - ((logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) (let ((a1-6 s0-0)) (let ((v1-14 s0-0)) (let ((a0-9 s4-0)) @@ -451,12 +451,12 @@ (define *guard-min-id-hack* 255) -(defmethod track-target! ((this crimson-guard)) +(defmethod common-post ((this crimson-guard)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type citizen track-target!))) + (let ((t9-0 (method-of-type citizen common-post))) (t9-0 this) ) (update-transforms (-> this root)) @@ -527,7 +527,7 @@ ) (('combo) (and (not (and (-> this next-state) (= (-> this next-state name) 'inactive))) - (and (not (logtest? (enemy-flag multi-focus) (-> this enemy-flags))) (nonzero? (-> this hit-points))) + (and (not (logtest? (enemy-flag dislike-combo) (-> this enemy-flags))) (nonzero? (-> this hit-points))) ) ) (('avoid) @@ -741,7 +741,7 @@ (set! (-> a0-1 travel quad) (-> v1-3 quad)) ) 0 - (track-target! self) + (common-post self) ) ) @@ -802,7 +802,7 @@ (set! (-> a0-1 travel quad) (-> v1-3 quad)) ) 0 - (track-target! self) + (common-post self) ) ) @@ -857,7 +857,7 @@ ) ) -(defmethod enemy-method-77 ((this crimson-guard) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this crimson-guard) (arg0 enemy-knocked-info)) (cond ((logtest? (-> this flags) (citizen-flag knocked-out-car)) (ja-channel-push! 1 (seconds 0.1)) @@ -866,7 +866,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 42)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 42)) num-func-seek!) ) @@ -879,7 +879,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 43)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 43)) num-func-seek!) ) @@ -905,7 +905,7 @@ ) (set! (-> a0-11 frame-group) (the-as art-joint-anim a1-6)) (set! (-> a0-11 param 0) (the float (+ (-> (the-as art-joint-anim a1-6) frames num-frames) -1))) - (set! (-> a0-11 param 1) (-> arg0 0)) + (set! (-> a0-11 param 1) (-> arg0 anim-speed)) (set! (-> a0-11 frame-num) 0.0) (joint-control-channel-group! a0-11 (the-as art-joint-anim a1-6) num-func-seek!) ) @@ -916,7 +916,7 @@ (ja-channel-push! 1 (seconds 0.01)) (cond ((= (-> this small-hit) 1) - (set! (-> this yellow-anim) (the-as uint (get-rand-int this 2))) + (set! (-> this yellow-anim) (the-as uint (rnd-int-count this 2))) (let ((a1-12 (-> this draw art-group @@ -935,7 +935,7 @@ ) (set! (-> a0-23 frame-group) (the-as art-joint-anim a1-12)) (set! (-> a0-23 param 0) (the float (+ (-> (the-as art-joint-anim a1-12) frames num-frames) -1))) - (set! (-> a0-23 param 1) (-> arg0 0)) + (set! (-> a0-23 param 1) (-> arg0 anim-speed)) (set! (-> a0-23 frame-num) 0.0) (joint-control-channel-group! a0-23 (the-as art-joint-anim a1-12) num-func-seek!) ) @@ -946,7 +946,7 @@ ) (set! (-> a0-27 frame-group) (the-as art-joint-anim a1-13)) (set! (-> a0-27 param 0) (the float (+ (-> (the-as art-joint-anim a1-13) frames num-frames) -1))) - (set! (-> a0-27 param 1) (-> arg0 0)) + (set! (-> a0-27 param 1) (-> arg0 anim-speed)) (set! (-> a0-27 frame-num) 0.0) (joint-control-channel-group! a0-27 (the-as art-joint-anim a1-13) num-func-seek!) ) @@ -960,7 +960,7 @@ (set! (-> a0-30 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 10)) frames num-frames) -1)) ) - (set! (-> a0-30 param 1) (-> arg0 0)) + (set! (-> a0-30 param 1) (-> arg0 anim-speed)) (set! (-> a0-30 frame-num) 0.0) (joint-control-channel-group! a0-30 (the-as art-joint-anim (-> this draw art-group data 10)) num-func-seek!) ) @@ -968,11 +968,11 @@ (((knocked-type knocked-type-2)) (ja-channel-push! 1 (seconds 0.1)) (let ((a1-17 (-> this draw art-group data (-> this info knocked (-> this hit-face))))) - (set! (-> arg0 0) (* 0.5 (-> arg0 0))) + (set! (-> arg0 anim-speed) (* 0.5 (-> arg0 anim-speed))) (let ((a0-36 (-> this skel root-channel 0))) (set! (-> a0-36 frame-group) (the-as art-joint-anim a1-17)) (set! (-> a0-36 param 0) (the float (+ (-> (the-as art-joint-anim a1-17) frames num-frames) -1))) - (set! (-> a0-36 param 1) (-> arg0 0)) + (set! (-> a0-36 param 1) (-> arg0 anim-speed)) (set! (-> a0-36 frame-num) 0.0) (joint-control-channel-group! a0-36 (the-as art-joint-anim a1-17) num-func-seek!) ) @@ -985,7 +985,7 @@ ) (set! (-> a0-41 frame-group) (the-as art-joint-anim a1-19)) (set! (-> a0-41 param 0) (the float (+ (-> (the-as art-joint-anim a1-19) frames num-frames) -1))) - (set! (-> a0-41 param 1) (-> arg0 0)) + (set! (-> a0-41 param 1) (-> arg0 anim-speed)) (set! (-> a0-41 frame-num) 0.0) (joint-control-channel-group! a0-41 (the-as art-joint-anim a1-19) num-func-seek!) ) @@ -996,7 +996,7 @@ #t ) -(defmethod enemy-method-78 ((this crimson-guard) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this crimson-guard) (arg0 enemy-knocked-info)) (cond ((<= (-> this hit-points) 0) (ja-channel-push! 1 (seconds 0.1)) @@ -1005,7 +1005,7 @@ ) (set! (-> a0-5 frame-group) (the-as art-joint-anim a1-2)) (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim a1-2) num-func-seek!) ) @@ -1036,7 +1036,7 @@ ) (set! (-> a0-16 frame-group) (the-as art-joint-anim a1-7)) (set! (-> a0-16 param 0) (the float (+ (-> (the-as art-joint-anim a1-7) frames num-frames) -1))) - (set! (-> a0-16 param 1) (-> arg0 0)) + (set! (-> a0-16 param 1) (-> arg0 anim-speed)) (set! (-> a0-16 frame-num) 0.0) (joint-control-channel-group! a0-16 (the-as art-joint-anim a1-7) num-func-seek!) ) @@ -1049,7 +1049,7 @@ ) (set! (-> a0-20 frame-group) (the-as art-joint-anim a1-8)) (set! (-> a0-20 param 0) (the float (+ (-> (the-as art-joint-anim a1-8) frames num-frames) -1))) - (set! (-> a0-20 param 1) (-> arg0 0)) + (set! (-> a0-20 param 1) (-> arg0 anim-speed)) (set! (-> a0-20 frame-num) 0.0) (joint-control-channel-group! a0-20 (the-as art-joint-anim a1-8) num-func-seek!) ) @@ -1064,7 +1064,7 @@ (set! (-> a0-23 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 11)) frames num-frames) -1)) ) - (set! (-> a0-23 param 1) (-> arg0 0)) + (set! (-> a0-23 param 1) (-> arg0 anim-speed)) (set! (-> a0-23 frame-num) 0.0) (joint-control-channel-group! a0-23 (the-as art-joint-anim (-> this draw art-group data 11)) num-func-seek!) ) @@ -1074,11 +1074,11 @@ (else (ja-channel-push! 1 (seconds 0.1)) (let ((a1-12 (-> this draw art-group data (-> this info knocked-land (-> this hit-face))))) - (set! (-> arg0 0) 1.0) + (set! (-> arg0 anim-speed) 1.0) (let ((a0-28 (-> this skel root-channel 0))) (set! (-> a0-28 frame-group) (the-as art-joint-anim a1-12)) (set! (-> a0-28 param 0) (the float (+ (-> (the-as art-joint-anim a1-12) frames num-frames) -1))) - (set! (-> a0-28 param 1) (-> arg0 0)) + (set! (-> a0-28 param 1) (-> arg0 anim-speed)) (set! (-> a0-28 frame-num) 0.0) (joint-control-channel-group! a0-28 (the-as art-joint-anim a1-12) num-func-seek!) ) @@ -1302,7 +1302,7 @@ (let ((v1-3 (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 3))) (logclear! (-> v1-3 prim-core action) (collide-action deadly)) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1469,8 +1469,8 @@ (init-vf0-vector) (cond ((logtest? (-> this controller traffic alert-state flags) (traffic-alert-flag guard-multi-focus)) - (logior! (-> this enemy-flags) (enemy-flag trackable)) - (when (not (logtest? (enemy-flag actor-pause-backup) (-> this enemy-flags))) + (logior! (-> this enemy-flags) (enemy-flag multi-focus)) + (when (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) (let ((a0-4 (find-closest-to-with-collide-lists (-> this controller traffic) this (-> this focus collide-with)))) (if a0-4 (set! (-> this traffic-target-status handle) (process->handle a0-4)) @@ -1480,8 +1480,8 @@ ) ) (else - (when (logtest? (enemy-flag trackable) (-> this enemy-flags)) - (logclear! (-> this enemy-flags) (enemy-flag trackable)) + (when (logtest? (enemy-flag multi-focus) (-> this enemy-flags)) + (logclear! (-> this enemy-flags) (enemy-flag multi-focus)) (let* ((s5-0 (handle->process (-> this traffic-target-status handle))) (v1-21 (if (type? s5-0 process-focusable) s5-0 @@ -1872,7 +1872,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 (time-elapsed? (-> self state-time) (the int (* 300.0 (get-rand-float-range self 1.0 3.0)))) + (if (and (time-elapsed? (-> self state-time) (the int (* 300.0 (rnd-float-range self 1.0 3.0)))) (logtest? (-> self flags) (citizen-flag target-in-sight)) ) (go-virtual gun-shoot) @@ -1972,7 +1972,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let ((v1-4 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-4 enemy-flags))) @@ -2001,8 +2001,8 @@ (let ((v1-3 (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 3))) (logclear! (-> v1-3 prim-core action) (collide-action deadly)) ) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -2036,7 +2036,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (set! (-> self other-side) (if (< (rand-vu) 0.5) #t #f @@ -2077,7 +2077,7 @@ ) :exit (behavior () (set! (-> self joint-enable) #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () (crimson-guard-method-220 self) @@ -2113,7 +2113,7 @@ (local-vars (v1-35 object)) (speech-control-method-12 *speech-control* self (speech-type speech-type-9)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self anim-shoot 0 anim-index)) :num! (seek! max f30-0) :frame-num 0.0 @@ -2180,7 +2180,7 @@ #f ) (label cfg-40) - (let ((f30-1 (get-rand-float-range self 0.9 1.1))) + (let ((f30-1 (rnd-float-range self 0.9 1.1))) (ja-channel-push! 1 (seconds 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self anim-shoot 2 anim-index)) :num! (seek! max f30-1) @@ -2277,7 +2277,7 @@ 0 (ja-channel-push! 1 (seconds 0.1)) (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-right-ja :num! (seek! (ja-aframe 6.0 0)) :frame-num (ja-aframe 0.0 0)) (until (ja-done? 0) (let ((a0-20 (handle->process (-> self focus handle)))) @@ -2318,7 +2318,7 @@ ) 0 (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-right-ja :num! (seek! (ja-aframe 11.0 0)) :frame-num (ja-aframe 6.0 0)) (until (ja-done? 0) (suspend) @@ -2376,7 +2376,7 @@ 0 (ja-channel-push! 1 (seconds 0.1)) (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-left-ja :num! (seek! (ja-aframe 9.0 0)) :frame-num (ja-aframe 0.0 0)) (until (ja-done? 0) (let ((a0-20 (handle->process (-> self focus handle)))) @@ -2417,7 +2417,7 @@ ) 0 (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-left-ja :num! (seek! (ja-aframe 11.0 0)) :frame-num (ja-aframe 9.0 0)) (until (ja-done? 0) (suspend) @@ -2441,7 +2441,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (nav-enemy-method-167 self) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) @@ -2468,7 +2468,7 @@ ) :exit (behavior () (set! (-> self joint-enable) #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () (crimson-guard-method-220 self) @@ -2477,7 +2477,7 @@ :code (behavior () (speech-control-method-12 *speech-control* self (speech-type speech-type-13)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! crimson-guard-idle-to-stab-idle-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) (seek-toward-heading-vec! (-> self root) (-> self target-self-xz) 65536.0 (seconds 0.02)) @@ -2500,7 +2500,7 @@ ) #f (label cfg-17) - (let ((f30-1 (get-rand-float-range self 0.9 1.1))) + (let ((f30-1 (rnd-float-range self 0.9 1.1))) (ja-channel-push! 1 (seconds 0.2)) (ja-no-eval :group! crimson-guard-stab-idle-to-idle-ja :num! (seek! max f30-1) :frame-num 0.0) (until (ja-done? 0) @@ -2521,7 +2521,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (nav-enemy-method-167 self) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) @@ -2547,7 +2547,7 @@ ) :exit (behavior () (set! (-> self joint-enable) #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () (crimson-guard-method-220 self) @@ -2557,7 +2557,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! crimson-guard-idle-to-stab-idle-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -2571,7 +2571,7 @@ (ja :num! (seek!)) ) ) - (let ((f30-1 (get-rand-float-range self 0.9 1.1))) + (let ((f30-1 (rnd-float-range self 0.9 1.1))) (ja-channel-push! 1 (seconds 0.2)) (ja-no-eval :group! crimson-guard-stab-idle-to-idle-ja :num! (seek! max f30-1) :frame-num 0.0) (until (ja-done? 0) @@ -2980,7 +2980,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (set! (-> self joint-enable) #t) (logior! (-> self focus-status) (focus-status dangerous)) (let ((v1-5 self)) @@ -3024,8 +3024,8 @@ (set! (-> v1-5 state mode) (the-as lightning-mode a0-2)) ) (set! (-> self joint-enable) #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -3072,7 +3072,7 @@ (if (< (the-as degrees f0-6) 0.0) (set! f30-0 (- f30-0)) ) - (if (logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + (if (logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (set! f0-6 (- (the-as degrees f0-6))) ) (cond @@ -3586,7 +3586,9 @@ (ja :num! (loop! f30-0)) ) ) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 0 (-> self event-param-point)) (until #f (suspend) @@ -3794,7 +3796,7 @@ (set! (-> this fact pickup-amount) 10.0) (set! (-> this fact pickup-spawn-amount) 1.0) (set! (-> this traffic-target-status handle) (the-as handle #f)) - (let ((v1-24 (get-rand-int this 2))) + (let ((v1-24 (rnd-int-count this 2))) (cond ((zero? v1-24) (set! (-> this anim-shoot 0 anim-index) 19) diff --git a/goal_src/jak2/levels/city/traffic/citizen/metalhead-flitter.gc b/goal_src/jak2/levels/city/traffic/citizen/metalhead-flitter.gc index a163d11bd5..c85c90c0d0 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/metalhead-flitter.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/metalhead-flitter.gc @@ -201,7 +201,7 @@ ) ) -(defmethod enemy-method-77 ((this metalhead-flitter) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this metalhead-flitter) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (let ((a0-2 (-> this skel root-channel 0))) @@ -209,7 +209,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 20)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 20)) num-func-seek!) ) @@ -243,7 +243,7 @@ ) ) -(defmethod enemy-method-78 ((this metalhead-flitter) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this metalhead-flitter) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -275,8 +275,8 @@ (defstate ambush (metalhead-flitter) :virtual #t :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -390,7 +390,7 @@ (+! (-> self root trans y) -8192.0) (logior! (-> self draw status) (draw-control-status no-draw)) (let ((gp-3 (current-time))) - (until (time-elapsed? gp-3 (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) + (until (time-elapsed? gp-3 (the int (* 300.0 (rnd-float-range self 0.0 0.6)))) (suspend) ) ) @@ -415,11 +415,11 @@ (set! (-> v1-3 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-3 enemy-flags)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set-time! (-> self state-time)) (let ((gp-0 (-> self root))) (vector-reset! (-> gp-0 transv)) - (set! (-> gp-0 transv y) (* 4096.0 (get-rand-float-range self 34.0 38.0))) + (set! (-> gp-0 transv y) (* 4096.0 (rnd-float-range self 34.0 38.0))) ) ) :code (behavior () @@ -642,7 +642,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (until #f (when (not (enemy-method-96 self 2730.6667 #t)) (let ((v1-5 self)) @@ -776,7 +776,7 @@ ) :exit (behavior () (metalhead-flitter-method-208 self #f) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -846,11 +846,11 @@ 0 (ja-channel-push! 1 (seconds 0.1)) (metalhead-flitter-method-208 self #f) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) - (dotimes (gp-1 (get-rand-int self 3)) + (dotimes (gp-1 (rnd-int-count self 3)) (ja-no-eval :group! flitter-idle-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -874,7 +874,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (until #f (when (not (enemy-method-96 self 2730.6667 #t)) (let ((v1-5 self)) @@ -984,12 +984,12 @@ (ja-channel-push! 1 (seconds 0.2)) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info run-anim)) - :num! (seek! max (get-rand-float-range self 0.9 1.1)) + :num! (seek! max (rnd-float-range self 0.9 1.1)) :frame-num 0.0 ) (until (ja-done? 0) (suspend) - (ja :num! (seek! max (get-rand-float-range self 0.9 1.1))) + (ja :num! (seek! max (rnd-float-range self 0.9 1.1))) ) ) #f diff --git a/goal_src/jak2/levels/city/traffic/citizen/metalhead-grunt.gc b/goal_src/jak2/levels/city/traffic/citizen/metalhead-grunt.gc index 5aa2879bd6..394e0b8ef2 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/metalhead-grunt.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/metalhead-grunt.gc @@ -259,15 +259,15 @@ (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (cond @@ -280,7 +280,7 @@ ) ) ) - (zero? (get-rand-int this 3)) + (zero? (rnd-int-count this 3)) (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) (f1-0 32768.0) ) @@ -330,8 +330,8 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -405,7 +405,9 @@ (until #f (let ((gp-0 (new 'stack-no-clear 'vector))) (get-point-in-path! (-> self intro-path) gp-0 1.0 'interp) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (let ((v1-5 (process->ppointer self))) (set! (-> a1-1 from) v1-5) @@ -438,7 +440,9 @@ (until #f (let ((gp-0 (new 'stack-no-clear 'vector))) (get-point-in-path! (-> self intro-path) gp-0 (the float (-> self jumping-ambush-path-pt)) 'interp) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (let ((v1-9 (process->ppointer self))) (set! (-> a1-1 from) v1-9) @@ -474,15 +478,15 @@ ) ) ) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f - (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (get-rand-int self 4))) + (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (rnd-int-count self 4))) (let ((v1-28 (-> self nav))) (set! (-> v1-28 target-speed) (-> self patrol-anim travel-speed)) ) 0 (let ((gp-0 (-> self draw art-group data (-> self patrol-anim anim-index))) - (s5-0 (get-rand-int-range self 1 8)) + (s5-0 (rnd-int-range self 1 8)) ) (let ((v1-37 (ja-group))) (if (not (and v1-37 (= v1-37 gp-0))) @@ -506,7 +510,7 @@ ) 0 (let ((gp-1 (-> self draw art-group data (-> self patrol-anim anim-index))) - (s5-1 (get-rand-int-range self 2 5)) + (s5-1 (rnd-int-range self 2 5)) ) (ja-no-eval :group! gp-1 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -523,7 +527,7 @@ ) ) ) - (when (zero? (get-rand-int self 3)) + (when (zero? (rnd-int-count self 3)) (let ((v1-107 self)) (set! (-> v1-107 enemy-flags) (the-as enemy-flag (logclear (-> v1-107 enemy-flags) (enemy-flag enemy-flag36))) @@ -541,7 +545,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (until (not (enemy-method-123 self 0.2)) + (until (not (rnd-go-idle? self 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -636,7 +640,7 @@ ) ) (sound-play "grunt-warn") - (set! (-> self next-warn-time) (+ gp-0 (get-rand-int-range self 300 360))) + (set! (-> self next-warn-time) (+ gp-0 (rnd-int-range self 300 360))) ) ) ) @@ -655,7 +659,7 @@ ) ) ) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (let ((v1-19 (-> self use-charge-anim-index))) (cond ((>= v1-19 0) @@ -663,7 +667,7 @@ (set! (-> self use-charge-anim-index) -1) ) (else - (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (get-rand-int self 3))) + (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (rnd-int-count self 3))) ) ) ) @@ -700,7 +704,7 @@ (set! (-> v1-1 speed) (-> self enemy-info run-travel-speed)) ) 0 - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (set! (-> self root penetrate-using) (penetrate generic-attack lunge)) (enemy-method-49 self) @@ -723,21 +727,21 @@ ) (t9-0 a0-0) ) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () (enemy-method-49 self) - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "grunt-hit") ) ) :code (behavior () - (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (get-rand-int self 2))) + (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (rnd-int-count self 2))) (let ((v1-5 (-> self nav))) (set! (-> v1-5 target-speed) (-> self attack-anim travel-speed)) ) @@ -747,7 +751,7 @@ ) 0 (let ((gp-0 (-> self draw art-group data (-> self attack-anim anim-index))) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (let ((v1-17 (ja-group))) (if (not (and v1-17 (= v1-17 gp-0))) @@ -802,7 +806,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (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*) @@ -839,22 +843,22 @@ ) (t9-0 a0-0) ) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "grunt-hit") ) ) :code (behavior () - (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (get-rand-int self 2))) + (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (rnd-int-count self 2))) (let ((gp-0 (-> self draw art-group data (-> self attack-anim anim-index))) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (let ((v1-13 (ja-group))) (if (not (and v1-13 (= v1-13 gp-0))) @@ -891,12 +895,12 @@ (suspend) (ja-eval) ) - (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (get-rand-int self 4))) + (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (rnd-int-count self 4))) (let ((v1-14 (-> self nav))) (set! (-> v1-14 target-speed) (-> self patrol-anim travel-speed)) ) 0 - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self patrol-anim anim-index))) ) (let ((v1-24 (ja-group))) @@ -916,7 +920,7 @@ ) ) -(defmethod enemy-method-77 ((this metalhead-grunt) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this metalhead-grunt) (arg0 enemy-knocked-info)) (local-vars (v1-72 int) (a2-3 int) (a2-5 int)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) @@ -936,10 +940,10 @@ (set! a2-3 (logior v1-2 8)) ) ) - (let ((s4-0 (enemy-method-120 this 4 a2-3))) + (let ((s4-0 (rnd-bit this 4 a2-3))) (set! (-> *grunt-global-info* prev-yellow-hit-anim-index) s4-0) (set! (-> this yellow-hit-anim) (-> *grunt-global-info* yellow-hit-anim s4-0)) - (let ((v1-11 (get-rand-int this 3))) + (let ((v1-11 (rnd-int-count this 3))) (if (= s4-0 3) (set! v1-11 2) ) @@ -951,7 +955,7 @@ (let ((a0-19 (-> this skel root-channel 0))) (set! (-> a0-19 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-19 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-19 param 1) (-> arg0 0)) + (set! (-> a0-19 param 1) (-> arg0 anim-speed)) (set! (-> a0-19 frame-num) 0.0) (joint-control-channel-group! a0-19 (the-as art-joint-anim s4-1) num-func-seek!) ) @@ -998,7 +1002,7 @@ (set! a2-5 (logior v1-42 7)) ) ) - (let ((v1-46 (enemy-method-120 this 6 a2-5))) + (let ((v1-46 (rnd-bit this 6 a2-5))) (set! (-> *grunt-global-info* prev-blue-hit-anim-index) v1-46) (set! (-> this blue-hit-anim) (-> *grunt-global-info* blue-hit-anim v1-46)) ) @@ -1009,7 +1013,7 @@ (set! a2-6 (logior a2-6 4)) ) ) - (set! (-> this use-charge-anim-index) (enemy-method-120 this 3 a2-6)) + (set! (-> this use-charge-anim-index) (rnd-bit this 3 a2-6)) ) ) (let ((a1-26 (-> this draw art-group data (-> this blue-hit-anim anim-index))) @@ -1017,7 +1021,7 @@ ) (set! (-> a0-51 frame-group) (the-as art-joint-anim a1-26)) (set! (-> a0-51 param 0) (the float (+ (-> (the-as art-joint-anim a1-26) frames num-frames) -1))) - (set! (-> a0-51 param 1) (-> arg0 0)) + (set! (-> a0-51 param 1) (-> arg0 anim-speed)) (set! (-> a0-51 frame-num) 0.0) (joint-control-channel-group! a0-51 (the-as art-joint-anim a1-26) num-func-seek!) ) @@ -1038,7 +1042,7 @@ (set! s4-3 (logior s4-3 4)) ) ) - (set! v1-72 (enemy-method-120 this 3 s4-3)) + (set! v1-72 (rnd-bit this 3 s4-3)) ) ) ) @@ -1050,7 +1054,7 @@ (let ((a0-68 (-> this skel root-channel 0))) (set! (-> a0-68 frame-group) (the-as art-joint-anim s4-4)) (set! (-> a0-68 param 0) (the float (+ (-> (the-as art-joint-anim s4-4) frames num-frames) -1))) - (set! (-> a0-68 param 1) (-> arg0 0)) + (set! (-> a0-68 param 1) (-> arg0 anim-speed)) (set! (-> a0-68 frame-num) 0.0) (joint-control-channel-group! a0-68 (the-as art-joint-anim s4-4) num-func-seek!) ) @@ -1060,7 +1064,7 @@ ) ) -(defmethod enemy-method-78 ((this metalhead-grunt) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this metalhead-grunt) (arg0 enemy-knocked-info)) (cond ((= (-> this incoming knocked-type) (knocked-type knocked-type-6)) (when (or (logtest? (-> this grunt-flags) 2) (let ((v1-7 (if (> (-> this skel active-channels) 0) @@ -1082,7 +1086,7 @@ (let ((a0-16 (-> this skel root-channel 0))) (set! (-> a0-16 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-16 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-16 param 1) (-> arg0 0)) + (set! (-> a0-16 param 1) (-> arg0 anim-speed)) (set! (-> a0-16 frame-num) 0.0) (joint-control-channel-group! a0-16 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -1103,7 +1107,7 @@ ) (set! (-> a0-23 frame-group) (the-as art-joint-anim a1-6)) (set! (-> a0-23 param 0) (the float (+ (-> (the-as art-joint-anim a1-6) frames num-frames) -1))) - (set! (-> a0-23 param 1) (-> arg0 0)) + (set! (-> a0-23 param 1) (-> arg0 anim-speed)) (set! (-> a0-23 frame-num) 0.0) (joint-control-channel-group! a0-23 (the-as art-joint-anim a1-6) num-func-seek!) ) @@ -1120,7 +1124,7 @@ (let ((s5-0 (handle->process (-> self focus handle)))) (when s5-0 (let ((gp-0 (get-trans (the-as process-focusable s5-0) 0))) - (when (and (or (not (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice))) + (when (and (or (not (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance))) (>= 163840.0 (vector-vector-distance (-> self root trans) gp-0)) ) (or (not (logtest? (-> self fact enemy-options) (enemy-option user8))) @@ -1131,7 +1135,7 @@ ) (cond ((and (logtest? (-> self fact enemy-options) (enemy-option user9)) - (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance)) ) (let ((s5-1 (new 'stack-no-clear 'vector))) (vector-! s5-1 gp-0 (-> self root trans)) @@ -1292,15 +1296,15 @@ 0 (set-gravity-length (-> this root dynam) 573440.0) (let ((s5-2 *grunt-global-info*)) - (set! (-> this patrol-anim) (-> s5-2 patrol-anim (get-rand-int this 4))) - (set! (-> this charge-anim) (-> s5-2 charge-anim (get-rand-int this 3))) - (set! (-> this attack-anim) (-> s5-2 attack-anim (get-rand-int this 2))) + (set! (-> this patrol-anim) (-> s5-2 patrol-anim (rnd-int-count this 4))) + (set! (-> this charge-anim) (-> s5-2 charge-anim (rnd-int-count this 3))) + (set! (-> this attack-anim) (-> s5-2 attack-anim (rnd-int-count this 2))) ) (set! (-> this use-charge-anim-index) -1) - (if (zero? (get-rand-int this 2)) + (if (zero? (rnd-int-count this 2)) (logior! (-> this grunt-flags) 1) ) - (if (zero? (get-rand-int this 2)) + (if (zero? (rnd-int-count this 2)) (logior! (-> this grunt-flags) 4) ) (set! (-> this intro-path) (new 'process 'path-control this 'intro 0.0 (the-as entity #f) #t)) diff --git a/goal_src/jak2/levels/city/traffic/citizen/metalhead-predator.gc b/goal_src/jak2/levels/city/traffic/citizen/metalhead-predator.gc index 42d5a416e0..e12e56909c 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/metalhead-predator.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/metalhead-predator.gc @@ -378,12 +378,12 @@ (none) ) -(defmethod track-target! ((this metalhead-predator)) +(defmethod common-post ((this metalhead-predator)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type citizen-enemy track-target!))) + (let ((t9-0 (method-of-type citizen-enemy common-post))) (t9-0 this) ) (metalhead-predator-method-208 this) @@ -403,7 +403,7 @@ ) (('combo) (and (not (and (-> this next-state) (= (-> this next-state name) 'inactive))) - (and (not (logtest? (enemy-flag multi-focus) (-> this enemy-flags))) (nonzero? (-> this hit-points))) + (and (not (logtest? (enemy-flag dislike-combo) (-> this enemy-flags))) (nonzero? (-> this hit-points))) ) ) (else @@ -412,7 +412,7 @@ ) ) -(defmethod enemy-method-77 ((this metalhead-predator) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this metalhead-predator) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (case (-> this incoming knocked-type) @@ -423,7 +423,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 18)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 18)) num-func-seek!) ) @@ -435,7 +435,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 14)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 14)) num-func-seek!) ) @@ -447,7 +447,7 @@ (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (ja-channel-push! 1 (seconds 0.01)) - (let ((v1-32 (get-rand-int this 2))) + (let ((v1-32 (rnd-int-count this 2))) (cond ((zero? v1-32) (let ((a0-10 (-> this skel root-channel 0))) @@ -455,7 +455,7 @@ (set! (-> a0-10 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 21)) frames num-frames) -1)) ) - (set! (-> a0-10 param 1) (-> arg0 0)) + (set! (-> a0-10 param 1) (-> arg0 anim-speed)) (set! (-> a0-10 frame-num) 0.0) (joint-control-channel-group! a0-10 (the-as art-joint-anim (-> this draw art-group data 21)) num-func-seek!) ) @@ -466,7 +466,7 @@ (set! (-> a0-12 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 22)) frames num-frames) -1)) ) - (set! (-> a0-12 param 1) (-> arg0 0)) + (set! (-> a0-12 param 1) (-> arg0 anim-speed)) (set! (-> a0-12 frame-num) 0.0) (joint-control-channel-group! a0-12 (the-as art-joint-anim (-> this draw art-group data 22)) num-func-seek!) ) @@ -481,7 +481,7 @@ (set! (-> a0-15 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 18)) frames num-frames) -1)) ) - (set! (-> a0-15 param 1) (-> arg0 0)) + (set! (-> a0-15 param 1) (-> arg0 anim-speed)) (set! (-> a0-15 frame-num) 0.0) (joint-control-channel-group! a0-15 (the-as art-joint-anim (-> this draw art-group data 18)) num-func-seek!) ) @@ -493,7 +493,7 @@ (set! (-> a0-17 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 12)) frames num-frames) -1)) ) - (set! (-> a0-17 param 1) (-> arg0 0)) + (set! (-> a0-17 param 1) (-> arg0 anim-speed)) (set! (-> a0-17 frame-num) 0.0) (joint-control-channel-group! a0-17 (the-as art-joint-anim (-> this draw art-group data 12)) num-func-seek!) ) @@ -504,7 +504,7 @@ ) ) -(defmethod enemy-method-78 ((this metalhead-predator) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this metalhead-predator) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (case (-> this incoming knocked-type) @@ -515,7 +515,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 20)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 20)) num-func-seek!) ) @@ -527,7 +527,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 15)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 15)) num-func-seek!) ) @@ -544,7 +544,7 @@ (set! (-> a0-8 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 23)) frames num-frames) -1)) ) - (set! (-> a0-8 param 1) (-> arg0 0)) + (set! (-> a0-8 param 1) (-> arg0 anim-speed)) (set! (-> a0-8 frame-num) 0.0) (joint-control-channel-group! a0-8 (the-as art-joint-anim (-> this draw art-group data 23)) num-func-seek!) ) @@ -556,7 +556,7 @@ (set! (-> a0-11 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 19)) frames num-frames) -1)) ) - (set! (-> a0-11 param 1) (-> arg0 0)) + (set! (-> a0-11 param 1) (-> arg0 anim-speed)) (set! (-> a0-11 frame-num) 0.0) (joint-control-channel-group! a0-11 (the-as art-joint-anim (-> this draw art-group data 19)) num-func-seek!) ) @@ -568,7 +568,7 @@ (set! (-> a0-13 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 13)) frames num-frames) -1)) ) - (set! (-> a0-13 param 1) (-> arg0 0)) + (set! (-> a0-13 param 1) (-> arg0 anim-speed)) (set! (-> a0-13 frame-num) 0.0) (joint-control-channel-group! a0-13 (the-as art-joint-anim (-> this draw art-group data 13)) num-func-seek!) ) @@ -786,7 +786,7 @@ (t9-0) ) ) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () (let ((t9-0 (-> (method-of-type citizen-enemy active) trans))) @@ -808,7 +808,7 @@ (set! (-> self want-stop) #f) (set-time! (-> self state-time)) (set! (-> self next-change) (the-as int (+ (current-time) (the int (* 300.0 (rand-vu-float-range 4.0 8.0)))))) - (if (zero? (get-rand-int self 3)) + (if (zero? (rnd-int-count self 3)) (sound-play "pred-talk") ) ) @@ -872,10 +872,10 @@ (set! (-> self attack-id) a0-1) ) (traffic-danger-init! self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -939,7 +939,7 @@ :event enemy-event-handler :enter (behavior () (traffic-danger-init! self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (set! (-> self root penetrate-using) (penetrate generic-attack lunge)) (enemy-method-49 self) @@ -956,8 +956,8 @@ ) :exit (behavior () (metalhead-predator-method-205 self #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -987,7 +987,7 @@ (suspend) (ja :num! (seek!)) ) - (if (zero? (get-rand-int self 3)) + (if (zero? (rnd-int-count self 3)) (sound-play "pred-talk") ) (go-hostile self) diff --git a/goal_src/jak2/levels/city/traffic/traffic-engine.gc b/goal_src/jak2/levels/city/traffic/traffic-engine.gc index 66a0149ee4..10c75e686c 100644 --- a/goal_src/jak2/levels/city/traffic/traffic-engine.gc +++ b/goal_src/jak2/levels/city/traffic/traffic-engine.gc @@ -2669,7 +2669,7 @@ Process is recycled and moved to reserved, if it deactivates." ) ) ) - (let ((v1-42 (-> s0-0 stack 860))) + (let ((v1-42 (-> (the-as crimson-guard s0-0) guard-type))) (when (< v1-42 (the-as uint 6)) (+! s2-0 1) (+! (-> this alert-state guard-type-info-array v1-42 count) 1) diff --git a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-guard.gc b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-guard.gc index 73010238d1..caa08f0b8e 100644 --- a/goal_src/jak2/levels/city/traffic/vehicle/vehicle-guard.gc +++ b/goal_src/jak2/levels/city/traffic/vehicle/vehicle-guard.gc @@ -548,13 +548,15 @@ (deftype vehicle-guard (vehicle) ((ai-hook (function vehicle-guard none)) (turret turret-control :inline) - (target-flags turret-flag) + (target-flags traffic-target-flag) (target-in-sight-time time-frame) (minimap connection-minimap) (vehicle-guard-pad-k1jn23k1 uint32) (traffic-target-status traffic-target-status) (pursuit-target handle) - (vehicle-guard-pad-1kjh2nb3k1 uint32 16) + (vehicle-guard-pad-0jkfdjslf uint32 4) + (vehicle-guard-vector0341413 vector :inline) + (vehicle-guard-pad-1kjh2nb3k1 uint32 8) (lod2 symbol) ) (:state-methods @@ -696,7 +698,7 @@ (set-time! (-> this target-in-sight-time)) ) ) - (set! (-> this target-flags) (the-as turret-flag (-> v1-4 flags))) + (set! (-> this target-flags) (-> v1-4 flags)) ) ) (when (not (logtest? (rigid-body-object-flag in-pursuit) (-> this flags))) @@ -893,7 +895,7 @@ (none) ) -(defun vehicle-guard-choose-branch ((arg0 vehicle-controller) (arg1 vehicle)) +(defun vehicle-guard-choose-branch ((arg0 vehicle-controller) (arg1 vehicle-guard)) (let ((gp-0 (the-as nav-branch #f))) (cond ((logtest? (rigid-body-object-flag alert) (-> arg1 flags)) @@ -902,7 +904,7 @@ ) (set! (-> s4-0 4 x) -10000000000000000000000000000000000000.0) (set! (-> s4-0 3 quad) (-> arg1 root trans quad)) - (vector-! (-> s4-0 0) (-> s4-0 3) (the-as vector (&-> arg1 stack 896))) + (vector-! (-> s4-0 0) (-> s4-0 3) (-> arg1 vehicle-guard-vector0341413)) (vector-normalize! (-> s4-0 0) 1.0) (dotimes (s3-0 (-> s5-0 branch-count)) (let ((s2-0 (-> s5-0 branch-array s3-0))) @@ -1082,7 +1084,7 @@ (vehicle-method-121 this) (vehicle-method-106 this) (when (not (logtest? (rigid-body-object-flag in-pursuit) (-> this flags))) - (if (not (logtest? (-> this target-flags) (turret-flag aiming))) + (if (not (logtest? (-> this target-flags) (traffic-target-flag visible-recently))) (speech-control-method-12 *speech-control* this (speech-type speech-type-2)) ) (go (method-of-object this active)) diff --git a/goal_src/jak2/levels/common/ai/ashelin/ash-states.gc b/goal_src/jak2/levels/common/ai/ashelin/ash-states.gc index 35024f2f85..d017ad3716 100644 --- a/goal_src/jak2/levels/common/ai/ashelin/ash-states.gc +++ b/goal_src/jak2/levels/common/ai/ashelin/ash-states.gc @@ -22,7 +22,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -111,7 +111,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) (logclear! (-> self bot-flags) (bot-flags bf21)) ) @@ -250,7 +250,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) (logclear! (-> self bot-flags) (bot-flags bf21)) ) @@ -396,7 +396,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -455,14 +455,14 @@ ) 0 (nav-enemy-method-167 self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (if (not (handle->process (-> self focus handle))) (react-to-focus self) ) (set! (-> self travel-anim-interp) 0.0) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :code (behavior () (bot-method-223 self #t) @@ -488,10 +488,10 @@ ) (cond ((logtest? (-> self bot-flags) (bot-flags attacked)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (reset-attacker! self) ) - ((logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + ((logtest? (-> self enemy-flags) (enemy-flag victory)) (ashelin-method-245 self) ) ) @@ -659,7 +659,7 @@ ) 0 (nav-enemy-method-167 self) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -781,7 +781,7 @@ ) 0 (nav-enemy-method-167 self) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -903,7 +903,7 @@ ) 0 (nav-enemy-method-167 self) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -941,29 +941,29 @@ ) :code (behavior () (local-vars (v1-7 enemy-flag) (v1-15 enemy-flag)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-6 (-> self enemy-flags))) - (if (logtest? v1-6 (enemy-flag checking-water)) - (set! v1-7 (logior v1-6 (enemy-flag enable-on-active))) - (set! v1-7 (logclear v1-6 (enemy-flag enable-on-active))) + (if (logtest? v1-6 (enemy-flag vulnerable-backup)) + (set! v1-7 (logior v1-6 (enemy-flag vulnerable))) + (set! v1-7 (logclear v1-6 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-7) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-14 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-14) - (set! v1-15 (logior (enemy-flag check-water-backup) v1-14)) - (set! v1-15 (logclear v1-14 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-14) + (set! v1-15 (logior (enemy-flag trackable) v1-14)) + (set! v1-15 (logclear v1-14 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-15) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) @@ -1011,7 +1011,7 @@ (set! (-> self travel-anim-interp) 0.0) ) :code (behavior () - (let ((v1-1 (get-rand-int self 3))) + (let ((v1-1 (rnd-int-count self 3))) (cond ((zero? v1-1) (play-death-sound self "asha057") @@ -1041,7 +1041,7 @@ ) ) ) - (f30-0 (get-rand-float-range self 0.8 1.2)) + (f30-0 (rnd-float-range self 0.8 1.2)) ) (ja-no-eval :group! gp-0 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) diff --git a/goal_src/jak2/levels/common/ai/ashelin/ash-task.gc b/goal_src/jak2/levels/common/ai/ashelin/ash-task.gc index 8693101074..073a406352 100644 --- a/goal_src/jak2/levels/common/ai/ashelin/ash-task.gc +++ b/goal_src/jak2/levels/common/ai/ashelin/ash-task.gc @@ -7,48 +7,46 @@ ;; DECOMP BEGINS -(defmethod reset-task! asht-wait-spot ((obj asht-wait-spot)) - "Virtual" - (set! (-> obj check-done) #f) - (set! (-> obj which-spot) -1) - (set! (-> obj num-spots) (the-as uint 0)) +(defmethod reset-task! ((this asht-wait-spot)) + (set! (-> this check-done) #f) + (set! (-> this which-spot) -1) + (set! (-> this num-spots) (the-as uint 0)) 0 (none) ) -(defmethod ai-task-method-11 asht-wait-spot ((obj asht-wait-spot) (arg0 bot)) - "Virtual" - (let ((s4-0 (-> obj which-spot))) +(defmethod ai-task-method-11 ((this asht-wait-spot) (arg0 bot)) + (let ((s4-0 (-> this which-spot))) (when (>= s4-0 0) - (let ((s3-0 (-> arg0 course spots (-> obj spot-indexes s4-0)))) + (let ((s3-0 (-> arg0 course spots (-> this spot-indexes s4-0)))) (if (and (not (outside-spot-radius? arg0 s3-0 (the-as vector #f) #f)) (player-blocking-spot? arg0 s3-0)) (set! s4-0 -1) ) ) ) (when (< s4-0 0) - (set! s4-0 (choose-spot arg0 (the-as int (-> obj num-spots)) (the-as (pointer uint) (-> obj spot-indexes)))) - (set! (-> obj which-spot) s4-0) + (set! s4-0 (choose-spot arg0 (the-as int (-> this num-spots)) (the-as (pointer uint) (-> this spot-indexes)))) + (set! (-> this which-spot) s4-0) (mem-copy! (the-as pointer (-> arg0 spot)) - (the-as pointer (-> arg0 course spots (-> obj spot-indexes s4-0))) + (the-as pointer (-> arg0 course spots (-> this spot-indexes s4-0))) 20 ) ) (if (logtest? *display-bot-marks* (bot-marks-controls bmc16)) (bot-debug-draw-spot-sphere arg0 - (the-as int (-> obj num-spots)) - (the-as (pointer uint) (-> obj spot-indexes)) - (the-as int (-> obj spot-indexes s4-0)) + (the-as int (-> this num-spots)) + (the-as (pointer uint) (-> this spot-indexes)) + (the-as int (-> this spot-indexes s4-0)) ) ) ) - (when (not ((-> obj check-done) obj (the-as ashelin arg0))) + (when (not ((-> this check-done) this (the-as ashelin arg0))) (let ((a1-10 (handle->process (-> arg0 focus handle)))) (when (and a1-10 (attacked-by-player? arg0 (the-as process-focusable a1-10)) - (zero? (logand (-> arg0 focus-status) (focus-status grabbed))) + (not (logtest? (-> arg0 focus-status) (focus-status grabbed))) ) (get-task-by-type (-> arg0 ai-ctrl) asht-fight-focus arg0) (ai-task-control-method-10 (-> arg0 ai-ctrl) arg0) @@ -58,23 +56,22 @@ (none) ) -(defmethod ai-task-method-11 asht-fight-focus ((obj asht-fight-focus) (arg0 bot)) - "Virtual" +;; WARN: Return type mismatch object vs none. +(defmethod ai-task-method-11 ((this asht-fight-focus) (arg0 bot)) (let ((a1-1 (handle->process (-> arg0 focus handle)))) (if (and a1-1 (attacked-by-player? arg0 (the-as process-focusable a1-1)) - (zero? (logand (-> arg0 focus-status) (focus-status grabbed))) + (not (logtest? (-> arg0 focus-status) (focus-status grabbed))) ) (logior! (-> arg0 bot-flags) (bot-flags bf00)) - (ai-task-control-method-14 (-> arg0 ai-ctrl) obj arg0) + (ai-task-control-method-14 (-> arg0 ai-ctrl) this arg0) ) ) (none) ) ;; WARN: Return type mismatch bot-flags vs none. -(defmethod ai-task-method-10 asht-fight-focus ((obj asht-fight-focus) (arg0 bot)) - "Virtual" +(defmethod ai-task-method-10 ((this asht-fight-focus) (arg0 bot)) (logclear! (-> arg0 bot-flags) (bot-flags bf00)) (none) ) diff --git a/goal_src/jak2/levels/common/ai/ashelin/ash.gc b/goal_src/jak2/levels/common/ai/ashelin/ash.gc index 990c0138d1..8dd4cb914a 100644 --- a/goal_src/jak2/levels/common/ai/ashelin/ash.gc +++ b/goal_src/jak2/levels/common/ai/ashelin/ash.gc @@ -230,7 +230,7 @@ (let* ((t9-0 (method-of-type bot bot-method-193)) (v0-0 (t9-0 this)) ) - (when (and (not v0-0) (logtest? #x400000 (-> this incoming penetrate-using))) + (when (and (not v0-0) (logtest? (penetrate jak-yellow-shot) (-> this incoming penetrate-using))) (if (logtest? (bot-flags bf22) (-> this bot-flags)) (set! v0-0 #t) ) @@ -240,8 +240,8 @@ ) ) -(defmethod enemy-method-106 ((this ashelin) (arg0 process) (arg1 object) (arg2 int) (arg3 attack-info)) - (let ((t9-0 (method-of-type bot enemy-method-106))) +(defmethod set-incoming-attack-info ((this ashelin) (arg0 process) (arg1 object) (arg2 penetrate) (arg3 attack-info)) + (let ((t9-0 (method-of-type bot set-incoming-attack-info))) (t9-0 this arg0 arg1 arg2 arg3) ) (if (!= (-> this incoming knocked-type) (knocked-type knocked-type-6)) @@ -431,7 +431,7 @@ (defmethod init-enemy! ((this ashelin)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (init! this) - (set! (-> this channel) (the-as uint 22)) + (set! (-> this channel) (gui-channel ashelin)) (set! (-> this travel-anim-interp) 0.0) (set! (-> this focus-info max-los-dist) 204800.0) (set! (-> this hit-invuln-ignore-me-delay) (the-as uint 0)) @@ -541,7 +541,7 @@ ) (cond ((or (>= 8192.0 (fabs f0-5)) (>= (fabs f0-5) 24576.0)) - (let ((s3-1 (zero? (get-rand-int this 2))) + (let ((s3-1 (zero? (rnd-int-count this 2))) (s4-0 (new 'stack-no-clear 'vector)) ) (countdown (s2-0 2) @@ -582,7 +582,7 @@ (defmethod ashelin-method-242 ((this ashelin)) (let ((s5-0 0)) (cond - ((zero? (get-rand-int this 2)) + ((zero? (rnd-int-count this 2)) (when (>= 16384.0 (fabs (-> this focus-info ry-diff))) (let ((s4-0 (new 'stack-no-clear 'vector))) (when (ashelin-method-236 this s4-0 (+ 16384.0 (-> this focus-info bullseye-ry)) 8192.0 40707.93 34563.93) @@ -917,7 +917,7 @@ (set! v1-36 (-> this draw art-group data 7)) (set! f28-0 (the float (sar (shl (the int (+ 32768.0 f30-0)) 48) 48))) ) - ((zero? (get-rand-int this 3)) + ((zero? (rnd-int-count this 3)) (set! v1-36 (-> this draw art-group data 10)) ) (else @@ -935,7 +935,7 @@ ) ) -(defmethod enemy-method-77 ((this ashelin) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this ashelin) (arg0 enemy-knocked-info)) (local-vars (a2-0 int)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) @@ -957,7 +957,7 @@ ) ) ) - (let* ((v1-9 (enemy-method-120 this 6 a2-0)) + (let* ((v1-9 (rnd-bit this 6 a2-0)) (s5-2 (-> this draw art-group data (-> *ashelin-global-info* blue-hit-anim v1-9))) ) (set! (-> *ashelin-global-info* prev-blue-hit) v1-9) @@ -993,7 +993,7 @@ (let ((a0-40 (-> this skel root-channel 0))) (set! (-> a0-40 frame-group) (-> this knocked-anim)) (set! (-> a0-40 param 0) (the float (+ (-> this knocked-anim frames num-frames) -1))) - (set! (-> a0-40 param 1) (-> arg0 0)) + (set! (-> a0-40 param 1) (-> arg0 anim-speed)) (set! (-> a0-40 frame-num) 0.0) (joint-control-channel-group! a0-40 (-> this knocked-anim) num-func-seek!) ) @@ -1002,7 +1002,7 @@ ) ) -(defmethod enemy-method-78 ((this ashelin) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this ashelin) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (let* ((v1-1 *ashelin-global-info*) @@ -1056,7 +1056,7 @@ ) ) ) - ((and (or (zero? (-> this hit-points)) (nonzero? (-> this fated-time))) (nonzero? (get-rand-int this 3))) + ((and (or (zero? (-> this hit-points)) (nonzero? (-> this fated-time))) (nonzero? (rnd-int-count this 3))) (ja-channel-push! 1 (seconds 0.17)) (let ((a0-20 (-> this skel root-channel 0))) (set! (-> a0-20 frame-group) (the-as art-joint-anim (-> this draw art-group data 12))) @@ -1132,7 +1132,7 @@ (cond ((>= f0-4 22.0) (when (focus-test? this dangerous) - (if (logtest? (-> this enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> this enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> this focus-status) (focus-status dangerous)) (logclear! (-> this focus-status) (focus-status dangerous)) ) @@ -1163,7 +1163,7 @@ (cond ((>= f0-5 32.0) (when (focus-test? this dangerous) - (if (logtest? (-> this enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> this enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> this focus-status) (focus-status dangerous)) (logclear! (-> this focus-status) (focus-status dangerous)) ) @@ -1278,9 +1278,11 @@ (defmethod play-attacked-speech ((this ashelin)) (local-vars (v1-3 int) (a3-0 int)) - (when (not (channel-active? this (the-as uint 0))) + (when (not (channel-active? this (gui-channel none))) (let ((v1-2 0)) - (if (logtest? #x3c00000 (-> this incoming penetrate-using)) + (if (logtest? (penetrate jak-yellow-shot jak-red-shot jak-blue-shot jak-dark-shot) + (-> this incoming penetrate-using) + ) (set! v1-3 (logior v1-2 128)) (set! v1-3 (logior v1-2 64)) ) @@ -1306,7 +1308,7 @@ ) (defmethod ashelin-method-244 ((this ashelin)) - (when (not (channel-active? this (the-as uint 0))) + (when (not (channel-active? this (gui-channel none))) (let ((a1-2 (bot-speech-list-method-9 (-> this ash-course ouch-speeches) this @@ -1324,7 +1326,7 @@ ) (defmethod ashelin-method-245 ((this ashelin)) - (when (and (not (channel-active? this (the-as uint 0))) (>= (current-time) (-> this victory-speech-time))) + (when (and (not (channel-active? this (gui-channel none))) (>= (current-time) (-> this victory-speech-time))) (let ((s5-0 (bot-speech-list-method-9 (-> this ash-course victory-speeches) this @@ -1334,9 +1336,7 @@ ) ) (when (>= s5-0 0) - (set! (-> this victory-speech-time) - (the-as time-frame (+ (get-rand-int-range this 1200 2100) (current-time))) - ) + (set! (-> this victory-speech-time) (the-as time-frame (+ (rnd-int-range this 1200 2100) (current-time)))) (play-speech this s5-0) ) ) @@ -1346,7 +1346,7 @@ (defmethod enemy-method-136 ((this ashelin)) (when (time-elapsed? (-> this hit-focus-time) (seconds 2)) - (let ((v0-0 (logclear (-> this enemy-flags) (enemy-flag look-at-focus)))) + (let ((v0-0 (logclear (-> this enemy-flags) (enemy-flag victory)))) (set! (-> this enemy-flags) v0-0) v0-0 ) @@ -1358,7 +1358,7 @@ (let ((t9-0 (method-of-type bot play-speech))) (t9-0 this arg0) ) - (logclear! (-> this enemy-flags) (enemy-flag look-at-focus)) + (logclear! (-> this enemy-flags) (enemy-flag victory)) (none) ) diff --git a/goal_src/jak2/levels/common/ai/bot-h.gc b/goal_src/jak2/levels/common/ai/bot-h.gc index d1dbebc00c..f4731fe963 100644 --- a/goal_src/jak2/levels/common/ai/bot-h.gc +++ b/goal_src/jak2/levels/common/ai/bot-h.gc @@ -219,7 +219,7 @@ (hit-by-enemy-count uint16) (hit-by-player-count uint16) (notice-enemy-dist float) - (channel uint8) + (channel gui-channel) (focus-mode int8) (nav-mesh-index int8) (delay-too-far-check int8) @@ -279,13 +279,13 @@ (play-speech (_type_ int) none) (play-death-sound (_type_ string) none) (bot-method-208 (_type_) symbol) - (channel-active? (_type_ uint) symbol) + (channel-active? (_type_ gui-channel) symbol) (init! (_type_) none) (clear-speech-flags! (_type_) none) (reset-warn-time! (_type_) none) (go-to-waypoint! (_type_ int symbol) object) (bot-method-214 (_type_) symbol) - (skip-waypoint (_type_) none) + (skip-waypoint (_type_) object) (bot-method-216 (_type_) none) (speech-ended? (_type_ int) symbol) (speech-playing? (_type_ int) symbol) @@ -588,7 +588,7 @@ ) (reset-index sp-list #f) (if (logtest? (-> sp-list flags) 4) - (set! last-idx (+ (get-rand-int bot (-> sp-indexes length)) -1)) + (set! last-idx (+ (rnd-int-count bot (-> sp-indexes length)) -1)) (set! last-idx -1) ) ) @@ -679,7 +679,7 @@ (set! history-mask 0) ) ) - (let* ((last-idx (enemy-method-120 bot (-> this speech-indexes length) history-mask)) + (let* ((last-idx (rnd-bit bot (-> this speech-indexes length) history-mask)) (speech-idx (-> this speech-indexes last-idx)) (v1-47 (-> sp-info speech-idx flags)) ) diff --git a/goal_src/jak2/levels/common/ai/bot-states.gc b/goal_src/jak2/levels/common/ai/bot-states.gc index c70bfefe73..3b106371d5 100644 --- a/goal_src/jak2/levels/common/ai/bot-states.gc +++ b/goal_src/jak2/levels/common/ai/bot-states.gc @@ -30,7 +30,7 @@ :code (behavior () (local-vars (v1-37 enemy-flag) (v1-45 enemy-flag)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info hit-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -40,29 +40,29 @@ (ja :num! (seek! max f30-0)) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-36 (-> self enemy-flags))) - (if (logtest? v1-36 (enemy-flag checking-water)) - (set! v1-37 (logior v1-36 (enemy-flag enable-on-active))) - (set! v1-37 (logclear v1-36 (enemy-flag enable-on-active))) + (if (logtest? v1-36 (enemy-flag vulnerable-backup)) + (set! v1-37 (logior v1-36 (enemy-flag vulnerable))) + (set! v1-37 (logclear v1-36 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-37) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-44 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-44) - (set! v1-45 (logior (enemy-flag check-water-backup) v1-44)) - (set! v1-45 (logclear v1-44 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-44) + (set! v1-45 (logior (enemy-flag trackable) v1-44)) + (set! v1-45 (logclear v1-44 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-45) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) @@ -71,7 +71,7 @@ (defstate knocked (bot) :virtual #t :enter (behavior () - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (stop-speech self (the-as uint 0) #t) (if (and (logtest? (-> self bot-flags) (bot-flags attacked)) (nonzero? (-> self hit-points)) @@ -151,7 +151,7 @@ ) ) ) - (f30-0 (get-rand-float-range self 0.8 1.2)) + (f30-0 (rnd-float-range self 0.8 1.2)) ) (ja-no-eval :group! gp-0 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -159,7 +159,7 @@ (ja :num! (seek! max f30-0)) ) ) - (until (not (channel-active? self (the-as uint 0))) + (until (not (channel-active? self (gui-channel none))) (suspend) ) (until #f @@ -195,13 +195,13 @@ ) :trans (behavior () ((-> (method-of-type bot die-falling) trans)) - (if (channel-active? self (the-as uint 0)) + (if (channel-active? self (gui-channel none)) (set-time! (-> self state-time)) ) ) :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self enemy-info idle-anim))) ) (until #f @@ -237,7 +237,7 @@ 0 (logior! (-> self draw status) (draw-control-status no-draw)) (set! (-> self notice-enemy-dist) 0.0) - (logclear! (-> self enemy-flags) (enemy-flag trackable-backup)) + (logclear! (-> self enemy-flags) (enemy-flag check-water)) ) :exit (behavior () (local-vars (v0-0 enemy-flag)) @@ -248,9 +248,9 @@ (set! (-> v1-5 prim-core collide-with) (-> self root backup-collide-with)) ) (let ((v1-6 (-> self enemy-flags))) - (if (logtest? (enemy-flag enable-on-hostile) v1-6) - (set! v0-0 (logior (enemy-flag trackable-backup) v1-6)) - (set! v0-0 (logclear v1-6 (enemy-flag trackable-backup))) + (if (logtest? (enemy-flag check-water-backup) v1-6) + (set! v0-0 (logior (enemy-flag check-water) v1-6)) + (set! v0-0 (logclear v1-6 (enemy-flag check-water))) ) ) (set! (-> self enemy-flags) v0-0) diff --git a/goal_src/jak2/levels/common/ai/bot.gc b/goal_src/jak2/levels/common/ai/bot.gc index fe4463731f..bb64b209e6 100644 --- a/goal_src/jak2/levels/common/ai/bot.gc +++ b/goal_src/jak2/levels/common/ai/bot.gc @@ -111,7 +111,7 @@ ) ) -(defmethod enemy-method-108 ((this bot) (arg0 enemy) (arg1 event-message-block)) +(defmethod enemy-method-108 ((this bot) (arg0 process-drawable) (arg1 event-message-block)) 0 ) @@ -135,7 +135,7 @@ (let ((gp-0 #f)) (let ((v1-0 (-> this incoming penetrate-using))) (cond - ((logtest? #x800000 v1-0) + ((logtest? (penetrate jak-red-shot) v1-0) (when *target* (let ((s5-0 (new 'stack-no-clear 'vector)) (s3-0 (-> *target* gun fire-dir-out)) @@ -153,7 +153,7 @@ ) ) ) - ((and (logtest? #x10000 v1-0) (not (logtest? #x20000 v1-0))) + ((and (logtest? (penetrate dark-skin) v1-0) (not (logtest? (penetrate dark-punch) v1-0))) (set! gp-0 #t) ) ) @@ -295,8 +295,8 @@ ) ) -(defmethod enemy-method-106 ((this bot) (arg0 process) (arg1 object) (arg2 int) (arg3 attack-info)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-106))) +(defmethod set-incoming-attack-info ((this bot) (arg0 process) (arg1 object) (arg2 penetrate) (arg3 attack-info)) + (let ((t9-0 (method-of-type nav-enemy set-incoming-attack-info))) (t9-0 this arg0 arg1 arg2 arg3) ) (logclear! (-> this bot-flags) (bot-flags bf03 bf04)) @@ -438,7 +438,7 @@ (local-vars (s5-1 process)) (let ((s5-0 (-> this focus))) (cond - ((logtest? (enemy-flag actor-pause-backup) (-> this enemy-flags)) + ((logtest? (enemy-flag lock-focus) (-> this enemy-flags)) (set! s5-1 (handle->process (-> s5-0 handle))) ) (else @@ -760,13 +760,13 @@ (('too-far-fail) (when (not (logtest? (-> this bot-flags) (bot-flags too-far-fail bf09))) (logior! (-> this bot-flags) (bot-flags bf09)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag check-water)) + (logclear! (-> this enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (go (method-of-object this failed)) ) ) @@ -838,7 +838,7 @@ (when (if (type? s5-2 process-focusable) s5-2 ) - (logior! (-> this enemy-flags) (enemy-flag look-at-focus)) + (logior! (-> this enemy-flags) (enemy-flag victory)) (set-time! (-> this hit-focus-time)) ) ) @@ -1023,7 +1023,7 @@ ) (defmethod play-too-far-warn-speech ((this bot)) - (when (not (channel-active? this (the-as uint 0))) + (when (not (channel-active? this (gui-channel none))) (let ((idx (bot-speech-list-method-9 (-> this course too-far-warn-speeches) this @@ -1085,7 +1085,7 @@ If the player is too far, play a warning speech." (if (and (>= (current-time) (-> this next-too-far-warn-time)) (play-too-far-warn-speech this)) (set! (-> this next-too-far-warn-time) (+ (current-time) - (get-rand-int-range this (the-as int (-> this warn-min-delay)) (the-as int (-> this warn-max-delay))) + (rnd-int-range this (the-as int (-> this warn-min-delay)) (the-as int (-> this warn-max-delay))) ) ) ) @@ -1107,13 +1107,13 @@ If the player is too far, play a warning speech." (set! (-> this started-warning-time) 0) (set! (-> this next-too-far-warn-time) (+ (current-time) - (get-rand-int-range this (the-as int (-> this warn-min-delay)) (the-as int (-> this warn-max-delay))) + (rnd-int-range this (the-as int (-> this warn-min-delay)) (the-as int (-> this warn-max-delay))) ) ) (none) ) -(defmethod track-target! ((this bot)) +(defmethod common-post ((this bot)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -1146,7 +1146,7 @@ If the player is too far, play a warning speech." ) ) ) - (let ((t9-4 (method-of-type nav-enemy track-target!))) + (let ((t9-4 (method-of-type nav-enemy common-post))) (t9-4 this) ) (when (not (logtest? (-> this bot-flags) (bot-flags bf09))) @@ -1216,7 +1216,7 @@ If the player is too far, play a warning speech." (add-process *gui-control* this - (the-as gui-channel (-> this channel)) + (-> this channel) (gui-action play) (-> speech name) -99.0 @@ -1241,15 +1241,7 @@ If the player is too far, play a warning speech." ;; WARN: Return type mismatch sound-id vs none. (defmethod play-death-sound ((this bot) (sound string)) "Play one of our death sounds." - (add-process - *gui-control* - this - (the-as gui-channel (-> this channel)) - (gui-action play) - sound - -99.0 - (seconds 0.3) - ) + (add-process *gui-control* this (-> this channel) (gui-action play) sound -99.0 (seconds 0.3)) (none) ) @@ -1272,21 +1264,21 @@ If the player is too far, play a warning speech." ) ) -(defmethod channel-active? ((this bot) (channel uint)) +(defmethod channel-active? ((this bot) (channel gui-channel)) "Is the given [[gui-channel]] active?" - (if (zero? channel) + (if (= channel (gui-channel none)) (set! channel (-> this channel)) ) (nonzero? (get-status *gui-control* - (lookup-gui-connection-id *gui-control* (the-as string #f) (the-as gui-channel channel) (gui-action none)) + (lookup-gui-connection-id *gui-control* (the-as string #f) channel (gui-action none)) ) ) ) (defmethod stop-speech ((this bot) (channel uint) (arg1 symbol)) (if (zero? channel) - (set! channel (-> this channel)) + (set! channel (the-as uint (-> this channel))) ) (if arg1 (set-action! @@ -1367,7 +1359,6 @@ If the player is too far, play a warning speech." (go process-drawable-art-error "bad waypoint id") ) -;; WARN: Return type mismatch object vs none. (defmethod skip-waypoint ((this bot)) (let ((skip-id (-> this waypoint skip-to))) (when (>= skip-id 0) @@ -1376,7 +1367,6 @@ If the player is too far, play a warning speech." (go-to-waypoint! this skip-id #t) ) ) - (none) ) ;; WARN: Return type mismatch nav-enemy vs bot. @@ -1434,9 +1424,9 @@ If the player is too far, play a warning speech." (set! (-> this ai-ctrl) (new 'process 'ai-task-control *bot-task-pool*)) (logclear! (-> this mask) (process-mask enemy)) (logior! (-> this mask) (process-mask bot)) - (logior! (-> this enemy-flags) (enemy-flag use-notice-distance multi-focus)) + (logior! (-> this enemy-flags) (enemy-flag cam-attack-mode dislike-combo)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logior! (-> this focus-status) (focus-status disable)) (let ((v1-13 (-> this nav))) (set! (-> v1-13 sphere-mask) (the-as uint 78)) @@ -1699,7 +1689,7 @@ If the player is too far, play a warning speech." ) (defmethod play-attacked-speech ((this bot)) - (when (not (channel-active? this (the-as uint 0))) + (when (not (channel-active? this (gui-channel none))) (let ((idx (bot-speech-list-method-9 (-> this course attack-player-speeches) this @@ -1724,11 +1714,11 @@ If the player is too far, play a warning speech." ;; WARN: Return type mismatch bot-flags vs none. (defmethod fail-mission! ((this bot)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (logior! (-> this bot-flags) (bot-flags bf09)) (let ((mission-failed? #t)) (let ((master-handle (handle->process (-> this master-handle)))) @@ -1814,7 +1804,7 @@ If the player is too far, play a warning speech." (defmethod bot-method-191 ((this bot)) (logior! (-> this bot-flags) (bot-flags bf02)) (set-time! (-> this hit-invuln-starting-time)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable)) (if (nonzero? (-> this hit-invuln-ignore-me-delay)) (logior! (-> this focus-status) (focus-status ignore)) ) @@ -1830,13 +1820,13 @@ If the player is too far, play a warning speech." (let ((a1-0 (-> this hit-invuln-starting-time)) (v1-0 #t) ) - (if (not (logtest? (-> this enemy-flags) (enemy-flag enable-on-active))) + (if (not (logtest? (-> this enemy-flags) (enemy-flag vulnerable))) (set! v1-0 (cond ((time-elapsed? a1-0 (seconds 0.6)) (let ((a2-6 (-> this 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))) + (if (logtest? a2-6 (enemy-flag vulnerable-backup)) + (set! a2-7 (logior a2-6 (enemy-flag vulnerable))) + (set! a2-7 (logclear a2-6 (enemy-flag vulnerable))) ) ) (set! (-> this enemy-flags) a2-7) diff --git a/goal_src/jak2/levels/common/ai/halt/hal.gc b/goal_src/jak2/levels/common/ai/halt/hal.gc index cdc6dde799..afaba1aa4d 100644 --- a/goal_src/jak2/levels/common/ai/halt/hal.gc +++ b/goal_src/jak2/levels/common/ai/halt/hal.gc @@ -140,13 +140,13 @@ (cond ((zero? arg0) (let ((t9-0 (method-of-type bot stop-speech))) - (t9-0 this (-> this channel) arg1) + (t9-0 this (the-as uint (-> this channel)) arg1) ) (countdown (s4-0 3) (let ((v1-4 (handle->process (-> this slave-handle s4-0)))) (when v1-4 (let ((t9-1 (method-of-type bot stop-speech))) - (t9-1 (the-as bot v1-4) (-> v1-4 stack 580) arg1) + (t9-1 (the-as bot v1-4) (the-as uint (-> (the-as bot v1-4) channel)) arg1) ) ) ) @@ -173,7 +173,7 @@ (a1-11 (add-process *gui-control* a2-2 - (the-as gui-channel (-> a2-2 stack 580)) + (-> (the-as bot a2-2) channel) (gui-action play) (-> v1-2 name) -99.0 @@ -188,7 +188,7 @@ (let ((a1-14 (add-process *gui-control* this - (the-as gui-channel (-> this channel)) + (-> this channel) (gui-action play) (-> v1-2 name) -99.0 @@ -205,10 +205,10 @@ (none) ) -(defmethod channel-active? ((this hal) (arg0 uint)) +(defmethod channel-active? ((this hal) (arg0 gui-channel)) "Is the given [[gui-channel]] active?" (cond - ((zero? arg0) + ((= arg0 (gui-channel none)) (let ((t9-0 (method-of-type bot channel-active?))) (if (t9-0 this (-> this channel)) (return #t) @@ -218,7 +218,7 @@ (let ((v1-7 (handle->process (-> this slave-handle s5-0)))) (when v1-7 (let ((t9-1 (method-of-type bot channel-active?))) - (if (t9-1 (the-as bot v1-7) (-> v1-7 stack 580)) + (if (t9-1 (the-as bot v1-7) (-> (the-as bot v1-7) channel)) (return #t) ) ) @@ -323,7 +323,7 @@ (let ((t9-4 (method-of-type bot init-enemy!))) (t9-4 this) ) - (set! (-> this channel) (the-as uint 28)) + (set! (-> this channel) (gui-channel hal)) (set! (-> this spot-color) (the-as uint #x5000ffff)) (set! (-> this notice-enemy-dist) 0.0) (logior! (-> this focus-status) (focus-status disable)) @@ -504,7 +504,7 @@ (when (and (not (logtest? (-> self bot-flags) (bot-flags too-far-fail bf09))) (bot-check-too-far self)) (let ((gp-0 0)) (countdown (s5-0 3) - (let ((s4-0 (enemy-method-120 self 3 gp-0))) + (let ((s4-0 (rnd-bit self 3 gp-0))) (let ((a0-4 (handle->process (-> self slave-handle s4-0)))) (if (send-event a0-4 'request 'too-far-fail) (goto cfg-24) diff --git a/goal_src/jak2/levels/common/ai/ruffian/ruf-states.gc b/goal_src/jak2/levels/common/ai/ruffian/ruf-states.gc index 228f43e6eb..56364b48c1 100644 --- a/goal_src/jak2/levels/common/ai/ruffian/ruf-states.gc +++ b/goal_src/jak2/levels/common/ai/ruffian/ruf-states.gc @@ -22,7 +22,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -66,7 +66,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -104,7 +104,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -145,7 +145,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -210,7 +210,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -297,7 +297,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -354,7 +354,7 @@ ) 0 (nav-enemy-method-167 self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-11 *game-info*) (a0-6 (+ (-> v1-11 attack-id) 1)) @@ -365,8 +365,8 @@ (set! (-> self travel-anim-interp) 0.0) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -392,14 +392,14 @@ ) 0 (nav-enemy-method-167 self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (if (not (handle->process (-> self focus handle))) (react-to-focus self) ) (set! (-> self travel-anim-interp) 0.0) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :code nothing :post nav-enemy-simple-post diff --git a/goal_src/jak2/levels/common/ai/ruffian/ruf-task.gc b/goal_src/jak2/levels/common/ai/ruffian/ruf-task.gc index b24a6ab5eb..a85fa11927 100644 --- a/goal_src/jak2/levels/common/ai/ruffian/ruf-task.gc +++ b/goal_src/jak2/levels/common/ai/ruffian/ruf-task.gc @@ -111,7 +111,9 @@ (set! (-> v1-9 target-speed) 0.0) ) 0 - (set! (-> arg0 enemy-flags) (the-as enemy-flag (logclear (-> arg0 enemy-flags) (enemy-flag vulnerable)))) + (set! (-> arg0 enemy-flags) + (the-as enemy-flag (logclear (-> arg0 enemy-flags) (enemy-flag jump-check-blocked))) + ) (when (send-event arg0 'jump 0 (-> s5-0 center)) (mem-copy! (the-as pointer (-> arg0 spot)) (the-as pointer s5-0) 20) #t diff --git a/goal_src/jak2/levels/common/ai/ruffian/ruf.gc b/goal_src/jak2/levels/common/ai/ruffian/ruf.gc index 4566de984f..2600a0de13 100644 --- a/goal_src/jak2/levels/common/ai/ruffian/ruf.gc +++ b/goal_src/jak2/levels/common/ai/ruffian/ruf.gc @@ -7,80 +7,80 @@ ;; DECOMP BEGINS -(defmethod general-event-handler ruffian ((obj ruffian) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler ((this ruffian) (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" (case arg2 (('hit-knocked) (send-event - (handle->process (-> obj master-handle)) + (handle->process (-> this master-handle)) 'notify 'hit-by - (handle->process (-> obj incoming attacker-handle)) + (handle->process (-> this incoming attacker-handle)) ) - ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) + ((method-of-type bot general-event-handler) this arg0 arg1 arg2 arg3) ) (('request) (case (-> arg3 param 0) (('too-far-fail) (cond - ((logtest? (bot-flags bf19) (-> obj bot-flags)) - (send-event obj 'instant-death) + ((logtest? (bot-flags bf19) (-> this bot-flags)) + (send-event this 'instant-death) #t ) (else - (let ((v1-20 (-> obj ruf-course too-far-fail-speeches))) + (let ((v1-20 (-> this ruf-course too-far-fail-speeches))) ;; changed ;; (set! v1-20 (and (nonzero? v1-20) v1-20)) (if (and v1-20 (nonzero? v1-20)) - ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) + ((method-of-type bot general-event-handler) this arg0 arg1 arg2 arg3) ) ) ) ) ) (('bomb-recoil) - (if (and (and (-> obj next-state) (let ((v1-25 (-> obj next-state name))) - (or (= v1-25 'alert-idle) (= v1-25 'waiting-idle) (= v1-25 'scared-idle)) - ) + (if (and (and (-> this next-state) (let ((v1-25 (-> this next-state name))) + (or (= v1-25 'alert-idle) (= v1-25 'waiting-idle) (= v1-25 'scared-idle)) + ) ) - (not (logtest? (-> obj focus-status) (focus-status grabbed))) + (not (logtest? (-> this focus-status) (focus-status grabbed))) ) - (go (method-of-object obj bomb-recoil)) + (go (method-of-object this bomb-recoil)) ) ) (else - ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) + ((method-of-type bot general-event-handler) this arg0 arg1 arg2 arg3) ) ) ) (else - ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) + ((method-of-type bot general-event-handler) this arg0 arg1 arg2 arg3) ) ) ) ;; WARN: Return type mismatch object vs symbol. -(defmethod attacked-by-player? ruffian ((obj ruffian) (arg0 process-focusable)) +(defmethod attacked-by-player? ((this ruffian) (arg0 process-focusable)) "Were we attacked by the player?" (the-as symbol (and (and arg0 (not (logtest? (-> arg0 focus-status) (focus-status disable dead ignore grabbed)))) (or (and (logtest? (process-mask enemy) (-> arg0 mask)) - (>= 40960.0 (vector-vector-xz-distance (-> obj root trans) (get-trans arg0 3))) + (>= 40960.0 (vector-vector-xz-distance (-> this root trans) (get-trans arg0 3))) ) - (and (logtest? (-> arg0 mask) (process-mask target)) (logtest? (-> obj bot-flags) (bot-flags attacked))) + (and (logtest? (-> arg0 mask) (process-mask target)) (logtest? (-> this bot-flags) (bot-flags attacked))) ) ) ) ) -(defmethod ruffian-method-245 ruffian ((obj ruffian)) - (-> obj root) +(defmethod ruffian-method-245 ((this ruffian)) + (-> this root) (let ((s5-0 (new 'stack-no-clear 'vector))) - (vector-! s5-0 (target-pos 0) (-> obj root trans)) - (let* ((f0-1 (vector-dot (-> obj follow-dir) s5-0)) - (f0-2 (- (- (-> obj follow-offset)) f0-1)) + (vector-! s5-0 (target-pos 0) (-> this root trans)) + (let* ((f0-1 (vector-dot (-> this follow-dir) s5-0)) + (f0-2 (- (- (-> this follow-offset)) f0-1)) ) 0.0 (let ((f0-5 (if (>= f0-2 0.0) @@ -88,9 +88,9 @@ (* -0.000048828126 (fmax -20480.0 f0-2)) ) ) - (s5-1 (-> obj nav)) + (s5-1 (-> this nav)) ) - (set! (-> s5-1 target-speed) (lerp (-> obj min-speed) (-> obj max-speed) f0-5)) + (set! (-> s5-1 target-speed) (lerp (-> this min-speed) (-> this max-speed) f0-5)) ) ) ) @@ -98,8 +98,8 @@ (none) ) -(defmethod enemy-method-97 ruffian ((obj ruffian)) - (let* ((s5-0 (handle->process (-> obj attacker-handle))) +(defmethod enemy-method-97 ((this ruffian)) + (let* ((s5-0 (handle->process (-> this attacker-handle))) (v1-3 (if (type? s5-0 process-focusable) s5-0 ) @@ -108,25 +108,25 @@ (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)) + (when (or (not (logtest? (-> this bot-flags) (bot-flags attacked))) + (time-elapsed? (-> this attacker-time) (seconds 1.5)) ) - (if (logtest? (-> obj bot-flags) (bot-flags attacked)) - (reset-attacker! obj) + (if (logtest? (-> this bot-flags) (bot-flags attacked)) + (reset-attacker! this) ) (set! v1-3 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) + (set! (-> this attacker-handle) (the-as handle #f)) ) ) (else - (when (>= (- (current-time) (-> obj attacker-time)) (seconds 6)) + (when (time-elapsed? (-> this attacker-time) (seconds 6)) (set! v1-3 (the-as process #f)) - (set! (-> obj attacker-handle) (the-as handle #f)) + (set! (-> this attacker-handle) (the-as handle #f)) ) ) ) ) - (let ((a0-21 (-> obj focus-mode)) + (let ((a0-21 (-> this focus-mode)) (s5-1 (the-as process #f)) ) (cond @@ -135,11 +135,11 @@ (v1-3 (set! s5-1 v1-3) ) - ((begin (set! s5-1 (select-focus! obj)) s5-1) + ((begin (set! s5-1 (select-focus! this)) s5-1) (empty) ) (else - (let ((s4-0 (handle->process (-> obj poi-handle)))) + (let ((s4-0 (handle->process (-> this poi-handle)))) (set! s5-1 (if (type? s4-0 process-focusable) s4-0 ) @@ -158,7 +158,7 @@ (set! s5-1 v1-3) ) (else - (let ((s4-1 (handle->process (-> obj poi-handle)))) + (let ((s4-1 (handle->process (-> this poi-handle)))) (set! s5-1 (if (type? s4-1 process-focusable) s4-1 ) @@ -168,7 +168,7 @@ (s5-1 (empty) ) - ((begin (set! s5-1 (select-focus! obj)) s5-1) + ((begin (set! s5-1 (select-focus! this)) s5-1) (empty) ) (else @@ -181,14 +181,14 @@ ) (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)) + (try-update-focus (-> this focus) (the-as process-focusable s5-1) this) + (if (and (logtest? (-> this bot-flags) (bot-flags attacked)) (!= (-> s5-1 type) target)) + (logclear! (-> this bot-flags) (bot-flags attacked)) ) ) (else - (clear-focused (-> obj focus)) - (logclear! (-> obj bot-flags) (bot-flags attacked)) + (clear-focused (-> this focus)) + (logclear! (-> this bot-flags) (bot-flags attacked)) ) ) s5-1 @@ -197,61 +197,63 @@ ) ;; WARN: Return type mismatch bot-flags vs none. -(defmethod enemy-method-106 ruffian ((obj ruffian) (arg0 process) (arg1 object) (arg2 int) (arg3 attack-info)) - (let ((t9-0 (method-of-type bot enemy-method-106))) - (t9-0 obj arg0 arg1 arg2 arg3) +(defmethod set-incoming-attack-info ((this ruffian) (arg0 process) (arg1 object) (arg2 penetrate) (arg3 attack-info)) + (let ((t9-0 (method-of-type bot set-incoming-attack-info))) + (t9-0 this arg0 arg1 arg2 arg3) ) (if (= (-> arg3 mode) 'beam) - (set! (-> obj bot-flags) (logior (bot-flags bf25) (-> obj bot-flags))) - (logclear! (-> obj bot-flags) (bot-flags bf25)) + (logior! (-> this bot-flags) (bot-flags bf25)) + (logclear! (-> this bot-flags) (bot-flags bf25)) ) (none) ) -(defmethod ruffian-method-242 ruffian ((obj ruffian)) +(defmethod ruffian-method-242 ((this ruffian)) (local-vars (a3-0 int)) - (when (not (channel-active? obj (the-as uint 0))) + (when (not (channel-active? this (gui-channel none))) (let ((v1-2 0)) - (if (logtest? (bot-flags bf25) (-> obj bot-flags)) + (if (logtest? (bot-flags bf25) (-> this bot-flags)) (set! a3-0 (logior v1-2 128)) (set! a3-0 (logior v1-2 64)) ) ) (let ((a1-3 (bot-speech-list-method-9 - (-> obj ruf-course ouch-speeches) - obj - (-> obj ruf-course speeches) + (-> this ruf-course ouch-speeches) + this + (-> this ruf-course speeches) (the-as speech-flags a3-0) ) ) ) (if (>= a1-3 0) - (play-speech obj a1-3) + (play-speech this a1-3) ) ) ) (none) ) -(defmethod play-attacked-speech ruffian ((obj ruffian)) +(defmethod play-attacked-speech ((this ruffian)) (local-vars (a3-0 int)) - (when (not (channel-active? obj (the-as uint 0))) + (when (not (channel-active? this (gui-channel none))) (let ((v1-2 0)) - (if (logtest? #x3c00000 (-> obj incoming penetrate-using)) + (if (logtest? (penetrate jak-yellow-shot jak-red-shot jak-blue-shot jak-dark-shot) + (-> this incoming penetrate-using) + ) (set! a3-0 (logior v1-2 128)) (set! a3-0 (logior v1-2 64)) ) ) (let ((a1-3 (bot-speech-list-method-9 - (-> obj ruf-course attack-player-speeches) - obj - (-> obj ruf-course speeches) + (-> this ruf-course attack-player-speeches) + this + (-> this ruf-course speeches) (the-as speech-flags a3-0) ) ) ) (if (>= a1-3 0) - (play-speech obj a1-3) + (play-speech this a1-3) ) ) ) @@ -259,13 +261,13 @@ ) ;; WARN: Return type mismatch object vs symbol. -(defmethod alive? ruffian ((obj ruffian)) +(defmethod alive? ((this ruffian)) (let ((t9-0 (method-of-type bot alive?))) (the-as symbol - (and (t9-0 obj) - (-> obj next-state) - (let ((v1-3 (-> obj next-state name))) + (and (t9-0 this) + (-> this next-state) + (let ((v1-3 (-> this next-state name))) (or (= v1-3 'waiting-idle) (= v1-3 'waiting-turn) (= v1-3 'scared-idle) (= v1-3 'scared-turn)) ) ) @@ -273,103 +275,101 @@ ) ) -(defmethod ruffian-method-238 ruffian ((obj ruffian)) - (and (!= (-> obj focus-info fproc type) target) (>= 16384.0 (-> obj focus-info bullseye-xz-dist))) +(defmethod ruffian-method-238 ((this ruffian)) + (and (!= (-> this focus-info fproc type) target) (>= 16384.0 (-> this focus-info bullseye-xz-dist))) ) -(defmethod ruffian-method-237 ruffian ((obj ruffian)) - (or (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (= (-> obj focus-info fproc type) target)) - (and (>= 40960.0 (-> obj focus-info bullseye-xz-dist)) - (= (-> obj focus-info los) 1) - (>= (current-time) (-> obj next-fire-time)) +(defmethod ruffian-method-237 ((this ruffian)) + (or (and (logtest? (-> this bot-flags) (bot-flags attacked)) (= (-> this focus-info fproc type) target)) + (and (>= 40960.0 (-> this focus-info bullseye-xz-dist)) + (= (-> this focus-info los) 1) + (>= (current-time) (-> this next-fire-time)) ) ) ) -(defmethod ruffian-method-243 ruffian ((obj ruffian)) - (let ((v1-0 (-> obj bot-flags))) +(defmethod ruffian-method-243 ((this ruffian)) + (let ((v1-0 (-> this bot-flags))) (and (logtest? (bot-flags bf20) v1-0) (not (logtest? (bot-flags bf21) v1-0))) ) ) -(defmethod bot-method-190 ruffian ((obj ruffian)) - (if (logtest? (bot-flags bf19) (-> obj bot-flags)) +(defmethod bot-method-190 ((this ruffian)) + (if (logtest? (bot-flags bf19) (-> this bot-flags)) #t - ((method-of-type bot bot-method-190) obj) + ((method-of-type bot bot-method-190) this) ) ) -(defmethod go-hostile ruffian ((obj ruffian)) - (bot-method-223 obj #t) +(defmethod go-hostile ((this ruffian)) + (bot-method-223 this #t) (cond - ((not (bot-method-214 obj)) - (react-to-focus obj) + ((not (bot-method-214 this)) + (react-to-focus this) ) - ((ruffian-method-238 obj) - (go (method-of-object obj kick)) + ((ruffian-method-238 this) + (go (method-of-object this kick)) ) - ((ruffian-method-237 obj) - (go (method-of-object obj blast)) + ((ruffian-method-237 this) + (go (method-of-object this blast)) ) (else - (go (method-of-object obj alert-idle)) + (go (method-of-object this alert-idle)) ) ) - (none) ) -(defmethod react-to-focus ruffian ((obj ruffian)) +(defmethod react-to-focus ((this ruffian)) "@TODO - flesh out docs" (cond - ((bot-method-214 obj) - (go-hostile obj) + ((bot-method-214 this) + (go-hostile this) ) - ((ruffian-method-243 obj) - (go (method-of-object obj plant-bomb)) + ((ruffian-method-243 this) + (go (method-of-object this plant-bomb)) ) (else - (ruffian-method-240 obj) + (ruffian-method-240 this) + ) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod ruffian-method-241 ((this ruffian)) + (cond + ((bot-method-214 this) + (go (method-of-object this alert-turn)) + ) + ((logtest? (bot-flags bf19) (-> this bot-flags)) + (go (method-of-object this scared-turn)) + ) + (else + (go (method-of-object this waiting-turn)) ) ) (none) ) ;; WARN: Return type mismatch object vs none. -(defmethod ruffian-method-241 ruffian ((obj ruffian)) +(defmethod ruffian-method-240 ((this ruffian)) (cond - ((bot-method-214 obj) - (go (method-of-object obj alert-turn)) + ((bot-method-214 this) + (go (method-of-object this alert-idle)) ) - ((logtest? (bot-flags bf19) (-> obj bot-flags)) - (go (method-of-object obj scared-turn)) + ((ruffian-method-243 this) + (go (method-of-object this plant-bomb)) + ) + ((logtest? (bot-flags bf19) (-> this bot-flags)) + (go (method-of-object this scared-idle)) ) (else - (go (method-of-object obj waiting-turn)) + (go (method-of-object this waiting-idle)) ) ) (none) ) -;; WARN: Return type mismatch object vs none. -(defmethod ruffian-method-240 ruffian ((obj ruffian)) - (cond - ((bot-method-214 obj) - (go (method-of-object obj alert-idle)) - ) - ((ruffian-method-243 obj) - (go (method-of-object obj plant-bomb)) - ) - ((logtest? (bot-flags bf19) (-> obj bot-flags)) - (go (method-of-object obj scared-idle)) - ) - (else - (go (method-of-object obj waiting-idle)) - ) - ) - (none) - ) - -(defmethod go-idle ruffian ((obj ruffian)) - (ruffian-method-240 obj) +(defmethod go-idle ((this ruffian)) + (ruffian-method-240 this) (none) ) diff --git a/goal_src/jak2/levels/common/ai/sig/sig-states.gc b/goal_src/jak2/levels/common/ai/sig/sig-states.gc index 60f11a897c..4c10258cb9 100644 --- a/goal_src/jak2/levels/common/ai/sig/sig-states.gc +++ b/goal_src/jak2/levels/common/ai/sig/sig-states.gc @@ -22,18 +22,18 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logior! (-> self focus-status) (focus-status disable)) ) :exit (behavior () (local-vars (v1-1 enemy-flag)) (let ((v1-0 (-> self enemy-flags))) - (if (logtest? v1-0 (enemy-flag checking-water)) - (set! v1-1 (logior v1-0 (enemy-flag enable-on-active))) - (set! v1-1 (logclear v1-0 (enemy-flag enable-on-active))) + (if (logtest? v1-0 (enemy-flag vulnerable-backup)) + (set! v1-1 (logior v1-0 (enemy-flag vulnerable))) + (set! v1-1 (logclear v1-0 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-1) @@ -75,7 +75,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) ) @@ -169,7 +169,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) ) @@ -290,7 +290,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) ) @@ -633,7 +633,7 @@ ) (until #f (ja-channel-push! 1 (seconds 0.07)) - (countdown (gp-0 (get-rand-int-range self 2 4)) + (countdown (gp-0 (rnd-int-range self 2 4)) (ja-no-eval :group! sig-gun-fix-hit-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -706,7 +706,7 @@ (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) ) - (countdown (gp-1 (get-rand-int-range self 2 3)) + (countdown (gp-1 (rnd-int-range self 2 3)) (ja-channel-push! 1 (seconds 0.07)) (ja-no-eval :group! sig-gun-fix-stomp-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) @@ -789,7 +789,7 @@ 0 (cond ((= gp-0 1) - (let ((s5-0 (get-rand-int-range self 1 2))) + (let ((s5-0 (rnd-int-range self 1 2))) (ja-channel-push! 1 (seconds 0.13)) (while (nonzero? s5-0) (+! s5-0 -1) @@ -802,7 +802,7 @@ ) ) (else - (let ((s5-1 (get-rand-int-range self 1 4))) + (let ((s5-1 (rnd-int-range self 1 4))) (ja-channel-push! 1 (seconds 0.13)) (while (nonzero? s5-1) (+! s5-1 -1) @@ -911,7 +911,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) ) @@ -1066,7 +1066,7 @@ ) 0 (nav-enemy-method-167 self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-11 *game-info*) (a0-6 (+ (-> v1-11 attack-id) 1)) @@ -1078,8 +1078,8 @@ (set! (-> self travel-anim-interp) 0.0) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1112,7 +1112,7 @@ (ja-no-eval :group! a1-2 :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (when (and (focus-test? self dangerous) (< f30-0 (ja-aframe-num 0))) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1143,7 +1143,7 @@ ) 0 (nav-enemy-method-167 self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (if (not (handle->process (-> self focus handle))) (react-to-focus self) ) @@ -1151,7 +1151,7 @@ (set! (-> self travel-anim-interp) 0.0) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :code (behavior () (local-vars (gp-0 art-element)) @@ -1267,10 +1267,10 @@ (if (not (handle->process (-> self focus handle))) (go-virtual traveling) ) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :code (behavior () (push-anim-to-targ (-> self skel top-anim) (the-as art-joint-anim sig-upper-shoot-ja) 0.0 9 9 1.0 0.0 #f) @@ -1340,29 +1340,29 @@ (suspend) (ja :num! (seek!)) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-30 (-> self enemy-flags))) - (if (logtest? v1-30 (enemy-flag checking-water)) - (set! v1-31 (logior v1-30 (enemy-flag enable-on-active))) - (set! v1-31 (logclear v1-30 (enemy-flag enable-on-active))) + (if (logtest? v1-30 (enemy-flag vulnerable-backup)) + (set! v1-31 (logior v1-30 (enemy-flag vulnerable))) + (set! v1-31 (logclear v1-30 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-31) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-38 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-38) - (set! v1-39 (logior (enemy-flag check-water-backup) v1-38)) - (set! v1-39 (logclear v1-38 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-38) + (set! v1-39 (logior (enemy-flag trackable) v1-38)) + (set! v1-39 (logclear v1-38 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-39) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) @@ -1459,7 +1459,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) ) @@ -1518,7 +1518,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (logior! (-> self bot-flags) (bot-flags bf24)) @@ -1584,7 +1584,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) ) @@ -1644,7 +1644,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (logior! (-> self bot-flags) (bot-flags bf24)) @@ -1716,7 +1716,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) ) @@ -1776,7 +1776,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (vector-reset! (-> self root transv)) diff --git a/goal_src/jak2/levels/common/ai/sig/sig-task.gc b/goal_src/jak2/levels/common/ai/sig/sig-task.gc index 81fae1f2b5..7b350892d1 100644 --- a/goal_src/jak2/levels/common/ai/sig/sig-task.gc +++ b/goal_src/jak2/levels/common/ai/sig/sig-task.gc @@ -181,13 +181,16 @@ (s4-0 (-> arg0 root)) ) (when (>= 10012.445 - (fabs (deg- - (atan (- (-> v1-22 trans x) (-> s4-0 trans x)) (- (-> v1-22 trans z) (-> s4-0 trans z))) - (quaternion-y-angle (-> s4-0 quat)) - ) - ) + (fabs + (deg- + (atan (- (-> v1-22 trans x) (-> s4-0 trans x)) (- (-> v1-22 trans z) (-> s4-0 trans z))) + (quaternion-y-angle (-> s4-0 quat)) + ) + ) ) - (set! (-> arg0 enemy-flags) (the-as enemy-flag (logclear (-> arg0 enemy-flags) (enemy-flag vulnerable)))) + (set! (-> arg0 enemy-flags) + (the-as enemy-flag (logclear (-> arg0 enemy-flags) (enemy-flag jump-check-blocked))) + ) (when (send-event arg0 'jump 4 (-> (the-as process-focusable s5-1) root trans)) (set! (-> arg0 spot center quad) (-> (the-as process-focusable s5-1) root trans quad)) (set! (-> arg0 spot center w) 10240.0) @@ -277,7 +280,9 @@ ) 0 (let ((s5-1 (-> arg0 course spots (-> this spot-indexes (-> this which-spot))))) - (set! (-> arg0 enemy-flags) (the-as enemy-flag (logclear (-> arg0 enemy-flags) (enemy-flag vulnerable)))) + (set! (-> arg0 enemy-flags) + (the-as enemy-flag (logclear (-> arg0 enemy-flags) (enemy-flag jump-check-blocked))) + ) (when (send-event arg0 'jump 0 (-> s5-1 center)) (mem-copy! (the-as pointer (-> arg0 spot)) (the-as pointer s5-1) 20) (return #t) diff --git a/goal_src/jak2/levels/common/ai/sig/sig.gc b/goal_src/jak2/levels/common/ai/sig/sig.gc index ed3ac8ff3b..95ed39a468 100644 --- a/goal_src/jak2/levels/common/ai/sig/sig.gc +++ b/goal_src/jak2/levels/common/ai/sig/sig.gc @@ -366,7 +366,7 @@ ) ) -(defmethod track-target! ((this sig)) +(defmethod common-post ((this sig)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -415,7 +415,7 @@ ) ) ) - (let ((t9-2 (method-of-type bot track-target!))) + (let ((t9-2 (method-of-type bot common-post))) (t9-2 this) ) (when (logtest? (-> this bot-flags) (bot-flags too-far-fail)) @@ -610,7 +610,7 @@ (defmethod init-enemy! ((this sig)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (init! this) - (set! (-> this channel) (the-as uint 21)) + (set! (-> this channel) (gui-channel sig)) (set! (-> this notice-enemy-dist) 122880.0) (set! (-> this travel-anim-interp) 0.0) (set! (-> this plasma charge-speed) 0.125) @@ -823,10 +823,10 @@ ) ) -(defmethod enemy-method-77 ((this sig) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this sig) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) - (let* ((v1-3 (enemy-method-120 this 3 (ash 1 (-> *sig-global-info* prev-blue-hit)))) + (let* ((v1-3 (rnd-bit this 3 (ash 1 (-> *sig-global-info* prev-blue-hit)))) (s5-1 (-> this draw art-group data (-> *sig-global-info* blue-hit-anim v1-3 anim-index))) ) (set! (-> *sig-global-info* prev-blue-hit) v1-3) @@ -893,7 +893,7 @@ (let ((a0-25 (-> this skel root-channel 0))) (set! (-> a0-25 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-25 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-25 param 1) (-> arg0 0)) + (set! (-> a0-25 param 1) (-> arg0 anim-speed)) (set! (-> a0-25 frame-num) 0.0) (joint-control-channel-group! a0-25 (the-as art-joint-anim s4-1) num-func-seek!) ) @@ -905,7 +905,7 @@ ) ) -(defmethod enemy-method-78 ((this sig) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this sig) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -1150,7 +1150,7 @@ (set! (-> this sig-path-start-time) (-> this sig-path-clock frame-counter)) (set! (-> this sig-path-cur-time) (-> this sig-path-start-time)) (set! (-> this sig-path-prev-time) (-> this sig-path-start-time)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (none) ) diff --git a/goal_src/jak2/levels/common/battle.gc b/goal_src/jak2/levels/common/battle.gc index 721ee97a3b..55257415be 100644 --- a/goal_src/jak2/levels/common/battle.gc +++ b/goal_src/jak2/levels/common/battle.gc @@ -1156,7 +1156,7 @@ (a2-2 (handle->process (-> a1-5 creature))) ) (when (and a2-2 (= a2-2 v1-0)) - (when (not (logtest? (enemy-flag alert) (-> (the-as nav-enemy a2-2) enemy-flags))) + (when (not (logtest? (enemy-flag directed) (-> (the-as nav-enemy a2-2) enemy-flags))) (set! (-> a1-5 creature) (the-as handle #f)) (set! a1-5 (the-as battle-spawner #f)) ) @@ -1186,7 +1186,7 @@ ) (let ((s4-0 (handle->process (-> arg0 creature)))) (when s4-0 - (when (not (logtest? (enemy-flag alert) (-> (the-as enemy s4-0) enemy-flags))) + (when (not (logtest? (enemy-flag directed) (-> (the-as enemy s4-0) enemy-flags))) (set! (-> arg0 creature) (the-as handle #f)) (return #f) ) @@ -1197,7 +1197,7 @@ 0 ) ((zero? v1-20) - (when (or (logtest? (enemy-flag victory) (-> (the-as enemy s4-0) enemy-flags)) (not arg1)) + (when (or (logtest? (enemy-flag directed-ready) (-> (the-as enemy s4-0) enemy-flags)) (not arg1)) (cond ((spawner-in-intro? this arg0) (if (not (spawner-try-jump this arg0 (the-as enemy s4-0))) @@ -1237,7 +1237,9 @@ (get-point-in-path! (-> arg0 intro-path) s4-0 (the float s3-0) 'exact) (let ((s3-1 (-> arg0 mode))) (set! (-> arg0 mode) (the-as uint 2)) - (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) + (set! (-> arg1 enemy-flags) + (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag jump-check-blocked))) + ) (cond ((send-event arg1 'jump 3 s4-0) #t diff --git a/goal_src/jak2/levels/common/enemy/amphibian/amphibian.gc b/goal_src/jak2/levels/common/enemy/amphibian/amphibian.gc index e0e0418ba2..a657a3f2b8 100644 --- a/goal_src/jak2/levels/common/enemy/amphibian/amphibian.gc +++ b/goal_src/jak2/levels/common/enemy/amphibian/amphibian.gc @@ -268,15 +268,15 @@ (('hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (when (= (-> this incoming knocked-type) (knocked-type knocked-type-4)) @@ -292,7 +292,7 @@ ) ) (go (method-of-object this knocked)) - (if (and (logtest? (-> this incoming penetrate-using) 16) + (if (and (logtest? (-> this incoming penetrate-using) (penetrate punch)) (nonzero? (-> this hit-points)) (zero? (-> this fated-time)) ) @@ -353,11 +353,11 @@ ) ) -(defmethod enemy-method-106 ((this amphibian) (arg0 process) (arg1 object) (arg2 int) (arg3 attack-info)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-106))) +(defmethod set-incoming-attack-info ((this amphibian) (arg0 process) (arg1 object) (arg2 penetrate) (arg3 attack-info)) + (let ((t9-0 (method-of-type nav-enemy set-incoming-attack-info))) (t9-0 this arg0 arg1 arg2 arg3) ) - (let ((a0-3 (enemy-method-134 this arg0 arg3))) + (let ((a0-3 (get-attacker this arg0 arg3))) (if a0-3 (set! (-> this attacker-handle) (process->handle a0-3)) (set! (-> this attacker-handle) (the-as handle #f)) @@ -410,7 +410,7 @@ (cond ((and (nonzero? (-> this hit-points)) (zero? (-> this fated-time)) (!= (-> this incoming knocked-type) 6)) (enemy-method-50 this arg0) - (let ((f30-0 (get-rand-float-range this 0.0 1.0))) + (let ((f30-0 (rnd-float-range this 0.0 1.0))) (vector-float*! arg0 arg0 (lerp 43417.6 58982.4 f30-0)) (set! (-> arg0 y) (lerp 114688.0 116736.0 f30-0)) ) @@ -422,10 +422,10 @@ (none) ) -(defmethod enemy-method-77 ((this amphibian) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this amphibian) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) - (let* ((v1-3 (enemy-method-120 this 3 (ash 1 (-> *amphibian-global-info* prev-blue-hit)))) + (let* ((v1-3 (rnd-bit this 3 (ash 1 (-> *amphibian-global-info* prev-blue-hit)))) (s5-1 (-> this draw art-group data (-> *amphibian-global-info* blue-hit-anim v1-3))) ) (set! (-> *amphibian-global-info* prev-blue-hit) v1-3) @@ -443,7 +443,7 @@ (let ((v1-11 0)) (when (or (zero? (-> this hit-points)) (nonzero? (-> this fated-time))) (let ((a2-5 (logior (ash 1 (-> *amphibian-global-info* prev-knocked)) 1))) - (set! v1-11 (enemy-method-120 this 3 a2-5)) + (set! v1-11 (rnd-bit this 3 a2-5)) ) ) (set! (-> *amphibian-global-info* prev-knocked) v1-11) @@ -453,7 +453,7 @@ (let ((a0-25 (-> this skel root-channel 0))) (set! (-> a0-25 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-25 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-25 param 1) (-> arg0 0)) + (set! (-> a0-25 param 1) (-> arg0 anim-speed)) (set! (-> a0-25 frame-num) 0.0) (joint-control-channel-group! a0-25 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -464,7 +464,7 @@ #t ) -(defmethod enemy-method-78 ((this amphibian) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this amphibian) (arg0 enemy-knocked-info)) (cond ((= (-> this incoming knocked-type) (knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -474,7 +474,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 25)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 25)) num-func-seek!) ) @@ -493,7 +493,7 @@ (let ((a0-10 (-> this skel root-channel 0))) (set! (-> a0-10 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-10 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-10 param 1) (-> arg0 0)) + (set! (-> a0-10 param 1) (-> arg0 anim-speed)) (set! (-> a0-10 frame-num) 0.0) (joint-control-channel-group! a0-10 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -508,7 +508,7 @@ (set! (-> a0-1 param 0) 1.0) (joint-control-channel-group! a0-1 (the-as art-joint-anim #f) num-func-loop!) ) - (let* ((v1-5 (get-rand-int this 2)) + (let* ((v1-5 (rnd-int-count this 2)) (s4-0 (-> this draw art-group data (-> *amphibian-global-info* jump-wind-up-anim v1-5))) ) (set! (-> this jump-anim-index) v1-5) @@ -857,14 +857,14 @@ (go (method-of-object this hostile)) ) -(defmethod track-target! ((this amphibian)) +(defmethod common-post ((this amphibian)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (set! (-> this prev-ry) (-> this prev-ry1)) (set! (-> this prev-ry1) (quaternion-y-angle (-> this root quat))) - ((method-of-type nav-enemy track-target!) this) + ((method-of-type nav-enemy common-post) this) (none) ) @@ -921,7 +921,7 @@ ) (cond ((and v1-29 (= v1-29 (-> this draw art-group data 26))) - (when (and s5-0 (zero? (get-rand-int this 5))) + (when (and s5-0 (zero? (rnd-int-count this 5))) (ja-channel-push! 1 (seconds 0.15)) (let ((s5-3 (-> this skel root-channel 0))) (set! (-> s5-3 dist) 12288.0) @@ -1021,7 +1021,7 @@ (amphibian-method-187 self) (suspend) ) - (when (enemy-method-123 self 0.2) + (when (rnd-go-idle? self 0.2) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.6)) (let ((v1-15 self)) @@ -1036,7 +1036,7 @@ (suspend) (ja :num! (seek!)) ) - (until (not (enemy-method-123 self 0.2)) + (until (not (rnd-go-idle? self 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -1090,8 +1090,8 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) - (a1-3 (-> self draw art-group data (-> *amphibian-global-info* notice-anim (get-rand-int self 2)))) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) + (a1-3 (-> self draw art-group data (-> *amphibian-global-info* notice-anim (rnd-int-count self 2)))) (gp-1 (new 'stack-no-clear 'vector)) ) (vector-! gp-1 (-> self focus-pos) (-> self root trans)) @@ -1162,7 +1162,7 @@ (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (let ((v1-8 (-> self nav))) (set! (-> v1-8 turning-acceleration) 204800.0) ) @@ -1176,8 +1176,8 @@ ) (else (vector-z-quaternion! (-> self focus-pos) (-> self root quat)) - (let ((f30-0 (get-rand-float-range self 8192.0 16384.0))) - (if (zero? (get-rand-int self 2)) + (let ((f30-0 (rnd-float-range self 8192.0 16384.0))) + (if (zero? (rnd-int-count self 2)) (set! f30-0 (- f30-0)) ) (vector-rotate-around-y! (-> self focus-pos) (-> self focus-pos) f30-0) @@ -1195,11 +1195,11 @@ (t9-0) ) ) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "amphib-hit") ) ) @@ -1220,7 +1220,7 @@ ) (else (let ((v1-22 (>= (vector-dot s5-0 gp-0) 0.0))) - (if (logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + (if (logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (set! v1-22 (not v1-22)) ) (if v1-22 @@ -1263,7 +1263,7 @@ :trans (-> (method-of-type nav-enemy stare) trans) :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((gp-0 (get-rand-int-range self 1 3))) + (let ((gp-0 (rnd-int-range self 1 3))) (dotimes (s5-0 gp-0) (ja-no-eval :group! amphibian-idle-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) @@ -1285,8 +1285,8 @@ (t9-0) ) ) - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (go-virtual attack-spin) ) (let ((a0-2 (get-enemy-target self))) @@ -1326,7 +1326,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (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*) @@ -1352,15 +1352,15 @@ ) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "amphib-hit") ) ) @@ -1388,7 +1388,7 @@ (set! (-> v1-3 turning-acceleration) 204800.0) ) 0 - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (let ((v1-7 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-7 enemy-flags))) (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-7 enemy-flags)))) @@ -1404,15 +1404,15 @@ (logior! (-> self focus-status) (focus-status dangerous)) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "amphib-hit") ) ) @@ -1445,7 +1445,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) @@ -1455,15 +1455,15 @@ (nav-enemy-method-167 self) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "amphib-hit") ) ) @@ -1482,7 +1482,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (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*) @@ -1512,15 +1512,15 @@ ) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "amphib-hit") ) ) @@ -1541,7 +1541,7 @@ ) (else (let ((v1-22 (>= (vector-dot s5-0 gp-0) 0.0))) - (if (logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + (if (logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (set! v1-22 (not v1-22)) ) (if v1-22 @@ -1590,7 +1590,7 @@ (nav-enemy-method-167 self) (set! (-> self tongue-scale) 0.0) (set! (-> self tongue-mode) (the-as uint 0)) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (sound-play "tongue-warn") (let ((gp-1 (new 'stack-no-clear 'amphibian-tongue-attack-info))) (amphibian-method-185 self gp-1) @@ -1600,7 +1600,7 @@ ) :exit (behavior () (set! (-> self draw bounds w) 22528.0) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () (let ((v1-0 (-> self tongue-mode))) diff --git a/goal_src/jak2/levels/common/enemy/centurion.gc b/goal_src/jak2/levels/common/enemy/centurion.gc index ee694c8040..21f386c31e 100644 --- a/goal_src/jak2/levels/common/enemy/centurion.gc +++ b/goal_src/jak2/levels/common/enemy/centurion.gc @@ -601,7 +601,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info victory-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -637,7 +637,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! centurion-idle-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -753,7 +753,7 @@ (set! (-> self can-take-damage?) #f) (set! (-> self root root-prim specific 0) (-> self root root-prim specific 1)) (centurion-shield-big) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -855,7 +855,7 @@ (collide-action solid) ) (set! (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 3 local-sphere w) 5120.0) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -872,14 +872,14 @@ :post enemy-simple-post ) -(defmethod dispose! ((this centurion)) +(defmethod dying ((this centurion)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (play-communicator-speech! (-> *talker-speech* 58)) (call-parent-method this) (none) ) -(defmethod track-target! ((this centurion)) +(defmethod common-post ((this centurion)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -970,7 +970,7 @@ ) (logior! (-> this skel status) (joint-control-status sync-math)) (los-control-method-9 (-> this los) (the-as process-focusable #f) (the-as vector #f) 2048.0) - (let ((t9-12 (method-of-type nav-enemy track-target!))) + (let ((t9-12 (method-of-type nav-enemy common-post))) (t9-12 this) ) (when (not (logtest? (-> this draw status) (draw-control-status no-draw))) @@ -987,16 +987,16 @@ (set! (-> s5-1 trans quad) a2-11) ) (let ((s4-1 (new 'stack-no-clear 'matrix))) - (if (logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) (vector-negate-in-place! (the-as vector (-> s5-1 vector))) ) - (matrix-rotate-y! s4-1 (if (logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + (matrix-rotate-y! s4-1 (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) 2548.6223 -2548.6223 ) ) (matrix*! s5-1 s4-1 s5-1) - (matrix-rotate-z! s4-1 (if (logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + (matrix-rotate-z! s4-1 (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) 691.76886 -691.76886 ) @@ -1006,7 +1006,7 @@ (let ((a1-20 (-> s5-1 trans))) (let ((v1-143 (-> s5-1 trans))) (let ((a0-25 (-> s5-1 vector))) - (let ((a2-18 (the-as float (if (logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + (let ((a2-18 (the-as float (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) -997237719 #x43a3d70a ) @@ -1157,7 +1157,7 @@ ) ) :code (behavior () - (get-rand-float-range self 0.9 1.1) + (rnd-float-range self 0.9 1.1) -1 0.0 1.0 @@ -1169,7 +1169,7 @@ ) (let ((f30-0 24576.0)) (until #f - (set-vector! s5-0 (get-rand-float-range self -1.0 1.0) 0.0 (get-rand-float-range self -1.0 1.0) 1.0) + (set-vector! s5-0 (rnd-float-range self -1.0 1.0) 0.0 (rnd-float-range self -1.0 1.0) 1.0) (vector-normalize! s5-0 f30-0) (vector+! gp-0 (-> self root trans) s5-0) (if (centurion-method-182 self gp-0) @@ -1263,7 +1263,7 @@ :post nav-enemy-travel-post ) -(defmethod enemy-method-77 ((this centurion) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this centurion) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (ja-channel-push! 1 (seconds 0.17)) @@ -1272,7 +1272,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 5)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 5)) num-func-seek!) ) @@ -1283,14 +1283,14 @@ (((knocked-type knocked-type-4)) (ja-channel-push! 1 (seconds 0.1)) (let* ((a2-1 (ash 1 (-> *centurion-global-info* prev-yellow-hit))) - (v1-18 (enemy-method-120 this 1 a2-1)) + (v1-18 (rnd-bit this 1 a2-1)) (a1-8 (-> this draw art-group data (-> *centurion-global-info* yellow-hit-anim v1-18))) ) (set! (-> *centurion-global-info* prev-yellow-hit) v1-18) (let ((a0-15 (-> this skel root-channel 0))) (set! (-> a0-15 frame-group) (the-as art-joint-anim a1-8)) (set! (-> a0-15 param 0) (the float (+ (-> (the-as art-joint-anim a1-8) frames num-frames) -1))) - (set! (-> a0-15 param 1) (-> arg0 0)) + (set! (-> a0-15 param 1) (-> arg0 anim-speed)) (set! (-> a0-15 frame-num) 0.0) (joint-control-channel-group! a0-15 (the-as art-joint-anim a1-8) num-func-seek!) ) @@ -1298,7 +1298,7 @@ ) (((knocked-type knocked-type-6)) (let* ((a2-3 (ash 1 (-> *centurion-global-info* prev-blue-hit))) - (v1-27 (enemy-method-120 this 3 a2-3)) + (v1-27 (rnd-bit this 3 a2-3)) (a1-13 (-> this draw art-group data (-> *centurion-global-info* blue-hit-anim v1-27))) ) (set! (-> *centurion-global-info* prev-blue-hit) v1-27) @@ -1322,7 +1322,7 @@ (let ((a0-30 (-> this skel root-channel 0))) (set! (-> a0-30 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-30 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-30 param 1) (-> arg0 0)) + (set! (-> a0-30 param 1) (-> arg0 anim-speed)) (set! (-> a0-30 frame-num) 0.0) (joint-control-channel-group! a0-30 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -1334,7 +1334,7 @@ ) ) -(defmethod enemy-method-78 ((this centurion) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this centurion) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (ja-channel-push! 1 (seconds 0.17)) @@ -1343,7 +1343,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 33)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 33)) num-func-seek!) ) @@ -1358,7 +1358,7 @@ (let ((a0-5 (-> this skel root-channel 0))) (set! (-> a0-5 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (joint-control-channel-group! a0-5 (the-as art-joint-anim s4-0) num-func-seek!) ) ) @@ -1372,7 +1372,7 @@ (set! (-> a0-7 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 22)) frames num-frames) -1)) ) - (set! (-> a0-7 param 1) (-> arg0 0)) + (set! (-> a0-7 param 1) (-> arg0 anim-speed)) (joint-control-channel-group! a0-7 (the-as art-joint-anim (-> this draw art-group data 22)) num-func-seek!) ) #t diff --git a/goal_src/jak2/levels/common/enemy/flitter.gc b/goal_src/jak2/levels/common/enemy/flitter.gc index 89377f14ba..96c1059bea 100644 --- a/goal_src/jak2/levels/common/enemy/flitter.gc +++ b/goal_src/jak2/levels/common/enemy/flitter.gc @@ -543,7 +543,7 @@ ) ) -(defmethod enemy-method-77 ((this flitter) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this flitter) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (let ((a0-2 (-> this skel root-channel 0))) @@ -551,7 +551,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 20)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 20)) num-func-seek!) ) @@ -585,7 +585,7 @@ ) ) -(defmethod enemy-method-78 ((this flitter) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this flitter) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -620,8 +620,8 @@ (defstate ambush (flitter) :virtual #t :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -695,7 +695,7 @@ ) ) (let ((gp-3 (current-time))) - (until (time-elapsed? gp-3 (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) + (until (time-elapsed? gp-3 (the int (* 300.0 (rnd-float-range self 0.0 0.6)))) (suspend) ) ) @@ -720,11 +720,11 @@ (set! (-> v1-3 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-3 enemy-flags)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set-time! (-> self state-time)) (let ((gp-0 (-> self root))) (vector-reset! (-> gp-0 transv)) - (set! (-> gp-0 transv y) (* 4096.0 (get-rand-float-range self 34.0 38.0))) + (set! (-> gp-0 transv y) (* 4096.0 (rnd-float-range self 34.0 38.0))) ) ) :code (behavior () @@ -945,7 +945,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (until #f (when (not (enemy-method-96 self 2730.6667 #t)) (let ((v1-5 self)) @@ -1053,12 +1053,12 @@ (ja-channel-push! 1 (seconds 0.2)) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info run-anim)) - :num! (seek! max (get-rand-float-range self 0.9 1.1)) + :num! (seek! max (rnd-float-range self 0.9 1.1)) :frame-num 0.0 ) (until (ja-done? 0) (suspend) - (ja :num! (seek! max (get-rand-float-range self 0.9 1.1))) + (ja :num! (seek! max (rnd-float-range self 0.9 1.1))) ) ) #f @@ -1148,7 +1148,7 @@ ) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1216,11 +1216,11 @@ ) 0 (ja-channel-push! 1 (seconds 0.1)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) - (dotimes (gp-1 (get-rand-int self 3)) + (dotimes (gp-1 (rnd-int-count self 3)) (ja-no-eval :group! flitter-idle-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -1240,7 +1240,7 @@ ) ) -(defmethod dispose! ((this flitter)) +(defmethod dying ((this flitter)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (when (-> this minimap) (logior! (-> this minimap flags) (minimap-flag fade-out)) diff --git a/goal_src/jak2/levels/common/enemy/fodder/fodder.gc b/goal_src/jak2/levels/common/enemy/fodder/fodder.gc index 4987326069..65d3a8e7aa 100644 --- a/goal_src/jak2/levels/common/enemy/fodder/fodder.gc +++ b/goal_src/jak2/levels/common/enemy/fodder/fodder.gc @@ -315,12 +315,12 @@ ) ;; WARN: Return type mismatch object vs none. -(defmethod track-target! ((this fodder)) +(defmethod common-post ((this fodder)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((parent-method (method-of-type nav-enemy track-target!))) + (let ((parent-method (method-of-type nav-enemy common-post))) (parent-method this) ) (let ((proc (the-as process-drawable #f))) @@ -356,7 +356,7 @@ ) ) ) - ((logtest? (-> this enemy-flags) (enemy-flag lock-focus)) + ((logtest? (-> this enemy-flags) (enemy-flag look-at-focus)) (look-at-position! this (the-as vector #f)) ) ) @@ -384,10 +384,10 @@ (func) ) ) - (logclear! (-> self enemy-flags) (enemy-flag spawn-gem chase-startup use-notice-distance)) + (logclear! (-> self enemy-flags) (enemy-flag notice alert cam-attack-mode)) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info walk-anim)) :num! (seek! max f30-0) @@ -397,7 +397,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (when (enemy-method-123 self 0.8) + (when (rnd-go-idle? self 0.8) (let ((_self self)) (set! (-> _self enemy-flags) (the-as enemy-flag (logclear (-> _self enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> _self nav callback-info) *nav-enemy-null-callback-info*) @@ -454,7 +454,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) (gp-0 (new 'stack-no-clear 'vector)) ) (stop-looking-at-target! self) @@ -513,9 +513,9 @@ ) ) (label cfg-22) - (get-rand-float-range self 0.8 1.2) + (rnd-float-range self 0.8 1.2) (new 'stack-no-clear 'vector) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (stop-looking-at-target! self) (if (nonzero? (-> self left-eye)) (shut-down (-> self left-eye)) @@ -593,7 +593,7 @@ )) 0 (fodder-method-181 self #f) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -623,7 +623,7 @@ (ja-channel-push! 1 (seconds 0.08)) (ja :group! (-> self draw art-group data (-> self enemy-info idle-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -762,7 +762,7 @@ ) :code (behavior () (fodder-method-182 self) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -832,8 +832,8 @@ (ja-channel-push! 1 (seconds 0.1)) ) ) - (let ((s5-0 (get-rand-int self 8)) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((s5-0 (rnd-int-count self 8)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (while (nonzero? s5-0) (+! s5-0 -1) @@ -861,7 +861,7 @@ (ja-channel-push! 1 (seconds 0.1)) ) ) - (let ((f30-2 (get-rand-float-range self 0.9 1.1))) + (let ((f30-2 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info victory-anim)) :num! (seek! max f30-2) :frame-num 0.0 @@ -877,11 +877,11 @@ ) ) -(defmethod enemy-method-77 ((this fodder) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this fodder) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (let* ((a2-0 (ash 1 (-> *fodder-global-info* prev-blue-hit))) - (v1-3 (enemy-method-120 this 3 a2-0)) + (v1-3 (rnd-bit this 3 a2-0)) (s5-1 (-> this draw art-group data (-> *fodder-global-info* blue-hit-anim v1-3 anim-index))) ) (set! (-> *fodder-global-info* prev-blue-hit) v1-3) @@ -910,7 +910,7 @@ (let ((a0-20 (-> this skel root-channel 0))) (set! (-> a0-20 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-20 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-20 param 1) (-> arg0 0)) + (set! (-> a0-20 param 1) (-> arg0 anim-speed)) (set! (-> a0-20 frame-num) 0.0) (joint-control-channel-group! a0-20 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -920,7 +920,7 @@ #t ) -(defmethod enemy-method-78 ((this fodder) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this fodder) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) #f @@ -931,7 +931,7 @@ ) (set! (-> a0-3 frame-group) (the-as art-joint-anim v1-5)) (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim v1-5) frames num-frames) -1))) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim v1-5) num-func-seek!) ) diff --git a/goal_src/jak2/levels/common/enemy/grenadier.gc b/goal_src/jak2/levels/common/enemy/grenadier.gc index 0174157772..272a1a9e3f 100644 --- a/goal_src/jak2/levels/common/enemy/grenadier.gc +++ b/goal_src/jak2/levels/common/enemy/grenadier.gc @@ -407,11 +407,11 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let* ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let* ((f30-0 (rnd-float-range self 0.9 1.1)) (a0-2 '((grenadier-patrol-ja) (grenadier-patrol1-ja))) (gp-0 ((method-of-type (rtype-of a0-2) length) a0-2)) (s5-0 (new 'static 'array int64 2 9 10)) - (s4-0 (-> (the-as (pointer int32) (+ (* (get-rand-int self gp-0) 8) (the-as int s5-0))))) + (s4-0 (-> (the-as (pointer int32) (+ (* (rnd-int-count self gp-0) 8) (the-as int s5-0))))) ) (until #f (ja-no-eval :group! (-> self draw art-group data s4-0) :num! (seek! max f30-0) :frame-num 0.0) @@ -419,7 +419,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (when (enemy-method-123 self 0.2) + (when (rnd-go-idle? self 0.2) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.6)) (let ((v1-38 self)) @@ -436,7 +436,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (until (not (enemy-method-123 self 0.2)) + (until (not (rnd-go-idle? self 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -455,7 +455,7 @@ ) 0 (ja-no-eval :num! (loop!)) - (set! s4-0 (-> (the-as (pointer int32) (+ (* (get-rand-int self gp-0) 8) (the-as int s5-0))))) + (set! s4-0 (-> (the-as (pointer int32) (+ (* (rnd-int-count self gp-0) 8) (the-as int s5-0))))) (ja-channel-push! 1 (seconds 0.6)) (ja-no-eval :group! (-> self draw art-group data s4-0) :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -491,7 +491,7 @@ ) ) (grenadier-method-181 self) - (look-at-target! self (enemy-flag death-start)) + (look-at-target! self (enemy-flag look-at-move-dest)) (logclear! (-> self status-flags) (grenadier-flags grflags-0)) ) :trans (behavior () @@ -559,10 +559,10 @@ draw art-group data - (-> (the-as (pointer int32) (+ (* (get-rand-int self a1-3) 8) (the-as int gp-0)))) + (-> (the-as (pointer int32) (+ (* (rnd-int-count self a1-3) 8) (the-as int gp-0)))) ) ) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (until #f (ja-no-eval :group! gp-1 :num! (seek! max f30-0) :frame-num 0.0) @@ -667,7 +667,7 @@ (set! (-> v1-3 prim-core action) (collide-action)) (set! (-> v1-3 local-sphere w) 4096.0) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -702,7 +702,7 @@ ;; ERROR: function was not converted to expressions. Cannot decompile. -(defmethod enemy-method-78 ((this grenadier) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this grenadier) (arg0 enemy-knocked-info)) (cond ((= (-> this incoming knocked-type) (knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -711,7 +711,7 @@ (let ((a0-3 (-> this skel root-channel 0))) (set! (-> a0-3 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -729,7 +729,7 @@ ) (set! (-> a0-9 frame-group) (the-as art-joint-anim a1-4)) (set! (-> a0-9 param 0) (the float (+ (-> (the-as art-joint-anim a1-4) frames num-frames) -1))) - (set! (-> a0-9 param 1) (-> arg0 0)) + (set! (-> a0-9 param 1) (-> arg0 anim-speed)) (set! (-> a0-9 frame-num) 0.0) (joint-control-channel-group! a0-9 (the-as art-joint-anim a1-4) num-func-seek!) ) @@ -742,7 +742,7 @@ (set! (-> a0-11 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 33)) frames num-frames) -1)) ) - (set! (-> a0-11 param 1) (-> arg0 0)) + (set! (-> a0-11 param 1) (-> arg0 anim-speed)) (set! (-> a0-11 frame-num) 0.0) (joint-control-channel-group! a0-11 (the-as art-joint-anim (-> this draw art-group data 33)) num-func-seek!) ) @@ -831,7 +831,7 @@ (set! (-> v1-11 attack-id) a0-19) (set! (-> self attack-id) a0-19) ) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) ) :exit (behavior () (if (logtest? (enemy-flag enemy-flag43) (-> self enemy-flags)) @@ -839,13 +839,13 @@ (logclear! (-> self nav flags) (nav-control-flag update-heading-from-facing)) ) (logclear! (-> self status-flags) (grenadier-flags grflags-1)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (let ((f28-0 (vector-length (-> self root transv)))) (ja-channel-push! 1 (seconds 0.2)) (when (< 4096.0 f28-0) @@ -1007,29 +1007,29 @@ (suspend) (ja :num! (seek!)) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-43 (-> self enemy-flags))) - (if (logtest? v1-43 (enemy-flag checking-water)) - (set! v1-44 (logior v1-43 (enemy-flag enable-on-active))) - (set! v1-44 (logclear v1-43 (enemy-flag enable-on-active))) + (if (logtest? v1-43 (enemy-flag vulnerable-backup)) + (set! v1-44 (logior v1-43 (enemy-flag vulnerable))) + (set! v1-44 (logclear v1-43 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-44) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-51 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-51) - (set! v1-52 (logior (enemy-flag check-water-backup) v1-51)) - (set! v1-52 (logclear v1-51 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-51) + (set! v1-52 (logior (enemy-flag trackable) v1-51)) + (set! v1-52 (logclear v1-51 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-52) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (cond ((= (-> self focus aware) (enemy-aware enemy-aware-3)) @@ -1069,7 +1069,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (cond ((zero? (rand-vu-int-range 0 1)) (ja-no-eval :group! grenadier-victory-ja :num! (seek! max f30-0) :frame-num 0.0) @@ -1139,12 +1139,12 @@ (none) ) -(defmethod track-target! ((this grenadier)) +(defmethod common-post ((this grenadier)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (let ((a1-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 34)))) diff --git a/goal_src/jak2/levels/common/enemy/grunt.gc b/goal_src/jak2/levels/common/enemy/grunt.gc index 44bd9a2412..2bbf7170b5 100644 --- a/goal_src/jak2/levels/common/enemy/grunt.gc +++ b/goal_src/jak2/levels/common/enemy/grunt.gc @@ -52,7 +52,7 @@ (unknown-byte-n1k2n3 int8 :offset 636) (unknown-byte-m2j342 int8 :offset 637) (unknown-byte-1ji2n3 int8 :offset 638) - (unknown-byte-n123n int8 :offset 639) + (unknown-byte-n123n uint8 :offset 639) (state-timeout2 uint64) (next-warn-time time-frame) (dest vector :inline) @@ -336,15 +336,15 @@ (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (cond @@ -357,7 +357,7 @@ ) ) ) - (zero? (get-rand-int this 3)) + (zero? (rnd-int-count this 3)) (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) (f1-0 32768.0) ) @@ -407,8 +407,8 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -506,7 +506,9 @@ (until #f (let ((gp-0 (new 'stack-no-clear 'vector))) (get-point-in-path! (-> self intro-path) gp-0 1.0 'interp) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (let ((v1-5 (process->ppointer self))) (set! (-> a1-1 from) v1-5) @@ -539,7 +541,9 @@ (until #f (let ((gp-0 (new 'stack-no-clear 'vector))) (get-point-in-path! (-> self intro-path) gp-0 (the float (-> self unknown-byte-1ji2n3)) 'interp) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (let ((v1-9 (process->ppointer self))) (set! (-> a1-1 from) v1-9) @@ -575,15 +579,15 @@ ) ) ) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f - (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (get-rand-int self 4))) + (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (rnd-int-count self 4))) (let ((v1-28 (-> self nav))) (set! (-> v1-28 target-speed) (-> self patrol-anim travel-speed)) ) 0 (let ((gp-0 (-> self draw art-group data (-> self patrol-anim anim-index))) - (s5-0 (get-rand-int-range self 1 8)) + (s5-0 (rnd-int-range self 1 8)) ) (let ((v1-37 (ja-group))) (if (not (and v1-37 (= v1-37 gp-0))) @@ -607,7 +611,7 @@ ) 0 (let ((gp-1 (-> self draw art-group data (-> self patrol-anim anim-index))) - (s5-1 (get-rand-int-range self 2 5)) + (s5-1 (rnd-int-range self 2 5)) ) (ja-no-eval :group! gp-1 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -624,7 +628,7 @@ ) ) ) - (when (zero? (get-rand-int self 3)) + (when (zero? (rnd-int-count self 3)) (let ((v1-107 self)) (set! (-> v1-107 enemy-flags) (the-as enemy-flag (logclear (-> v1-107 enemy-flags) (enemy-flag enemy-flag36))) @@ -642,7 +646,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (until (not (enemy-method-123 self 0.2)) + (until (not (rnd-go-idle? self 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -737,7 +741,7 @@ ) ) (sound-play "grunt-warn") - (set! (-> self next-warn-time) (+ gp-0 (get-rand-int-range self 300 360))) + (set! (-> self next-warn-time) (+ gp-0 (rnd-int-range self 300 360))) ) ) ) @@ -756,7 +760,7 @@ ) ) ) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (let ((v1-19 (-> self unknown-byte-n1k2n3))) (cond ((>= v1-19 0) @@ -764,7 +768,7 @@ (set! (-> self unknown-byte-n1k2n3) -1) ) (else - (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (get-rand-int self 3))) + (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (rnd-int-count self 3))) ) ) ) @@ -801,7 +805,7 @@ (set! (-> v1-1 speed) (-> self enemy-info run-travel-speed)) ) 0 - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (set! (-> self root penetrate-using) (penetrate generic-attack lunge)) (enemy-method-49 self) @@ -813,21 +817,21 @@ ) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () (enemy-method-49 self) - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "grunt-hit") ) ) :code (behavior () - (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (get-rand-int self 2))) + (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (rnd-int-count self 2))) (let ((v1-5 (-> self nav))) (set! (-> v1-5 target-speed) (-> self attack-anim travel-speed)) ) @@ -837,7 +841,7 @@ ) 0 (let ((gp-0 (-> self draw art-group data (-> self attack-anim anim-index))) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (let ((v1-17 (ja-group))) (if (not (and v1-17 (= v1-17 gp-0))) @@ -892,7 +896,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (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*) @@ -918,22 +922,22 @@ ) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "grunt-hit") ) ) :code (behavior () - (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (get-rand-int self 2))) + (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (rnd-int-count self 2))) (let ((gp-0 (-> self draw art-group data (-> self attack-anim anim-index))) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (let ((v1-13 (ja-group))) (if (not (and v1-13 (= v1-13 gp-0))) @@ -979,7 +983,7 @@ ) ) (until #f - (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (get-rand-int self 3))) + (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (rnd-int-count self 3))) (let ((v1-22 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-22 enemy-flags))) (set! (-> v1-22 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-22 enemy-flags)))) @@ -1010,8 +1014,8 @@ (ja-channel-push! 1 (seconds 0.1)) ) ) - (let ((s5-0 (get-rand-int self 8)) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((s5-0 (rnd-int-count self 8)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (while (nonzero? s5-0) (+! s5-0 -1) @@ -1040,7 +1044,7 @@ (ja-channel-push! 1 (seconds 0.1)) ) ) - (let ((f30-2 (get-rand-float-range self 0.9 1.1))) + (let ((f30-2 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! grunt-celebrate-start-ja :num! (seek! max f30-2) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -1074,8 +1078,8 @@ ) ) ) - (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (get-rand-int self 4))) - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (rnd-int-count self 4))) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self patrol-anim anim-index))) ) (let ((v1-28 self)) @@ -1127,12 +1131,12 @@ (suspend) (ja-eval) ) - (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (get-rand-int self 4))) + (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (rnd-int-count self 4))) (let ((v1-14 (-> self nav))) (set! (-> v1-14 target-speed) (-> self patrol-anim travel-speed)) ) 0 - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self patrol-anim anim-index))) ) (let ((v1-24 (ja-group))) @@ -1152,7 +1156,7 @@ ) ) -(defmethod enemy-method-77 ((this grunt) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this grunt) (arg0 enemy-knocked-info)) (local-vars (v1-72 int) (a2-3 int) (a2-5 int)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) @@ -1172,10 +1176,10 @@ (set! a2-3 (logior v1-2 8)) ) ) - (let ((s4-0 (enemy-method-120 this 4 a2-3))) + (let ((s4-0 (rnd-bit this 4 a2-3))) (set! (-> *grunt-global-info* prev-yellow-hit-anim-index) s4-0) (set! (-> this yellow-hit-anim) (-> *grunt-global-info* yellow-hit-anim s4-0)) - (let ((v1-11 (get-rand-int this 3))) + (let ((v1-11 (rnd-int-count this 3))) (if (= s4-0 3) (set! v1-11 2) ) @@ -1187,7 +1191,7 @@ (let ((a0-19 (-> this skel root-channel 0))) (set! (-> a0-19 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-19 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-19 param 1) (-> arg0 0)) + (set! (-> a0-19 param 1) (-> arg0 anim-speed)) (set! (-> a0-19 frame-num) 0.0) (joint-control-channel-group! a0-19 (the-as art-joint-anim s4-1) num-func-seek!) ) @@ -1208,10 +1212,10 @@ ) ) (if (>= (-> this incoming blue-juggle-count) (the-as uint 2)) - (set! (-> this unknown-byte-n123n) (the-as int (logior (-> this stack 511) 2))) + (logior! (-> this unknown-byte-n123n) 2) ) (cond - ((and (not s4-2) (logtest? (-> this stack 511) 2)) + ((and (not s4-2) (logtest? (-> this unknown-byte-n123n) 2)) (set! s4-2 #t) (ja-channel-push! 1 (seconds 0.17)) ) @@ -1234,18 +1238,18 @@ (set! a2-5 (logior v1-42 7)) ) ) - (let ((v1-46 (enemy-method-120 this 6 a2-5))) + (let ((v1-46 (rnd-bit this 6 a2-5))) (set! (-> *grunt-global-info* prev-blue-hit-anim-index) v1-46) (set! (-> this blue-hit-anim) (-> *grunt-global-info* blue-hit-anim v1-46)) ) (let ((a2-6 0)) - (when (not (logtest? (-> this stack 511) 2)) + (when (not (logtest? (-> this unknown-byte-n123n) 2)) (if s4-2 (set! a2-6 (logior a2-6 3)) (set! a2-6 (logior a2-6 4)) ) ) - (set! (-> this unknown-byte-n1k2n3) (enemy-method-120 this 3 a2-6)) + (set! (-> this unknown-byte-n1k2n3) (rnd-bit this 3 a2-6)) ) ) (let ((a1-26 (-> this draw art-group data (-> this blue-hit-anim anim-index))) @@ -1253,7 +1257,7 @@ ) (set! (-> a0-51 frame-group) (the-as art-joint-anim a1-26)) (set! (-> a0-51 param 0) (the float (+ (-> (the-as art-joint-anim a1-26) frames num-frames) -1))) - (set! (-> a0-51 param 1) (-> arg0 0)) + (set! (-> a0-51 param 1) (-> arg0 anim-speed)) (set! (-> a0-51 frame-num) 0.0) (joint-control-channel-group! a0-51 (the-as art-joint-anim a1-26) num-func-seek!) ) @@ -1274,7 +1278,7 @@ (set! s4-3 (logior s4-3 4)) ) ) - (set! v1-72 (enemy-method-120 this 3 s4-3)) + (set! v1-72 (rnd-bit this 3 s4-3)) ) ) ) @@ -1286,7 +1290,7 @@ (let ((a0-68 (-> this skel root-channel 0))) (set! (-> a0-68 frame-group) (the-as art-joint-anim s4-4)) (set! (-> a0-68 param 0) (the float (+ (-> (the-as art-joint-anim s4-4) frames num-frames) -1))) - (set! (-> a0-68 param 1) (-> arg0 0)) + (set! (-> a0-68 param 1) (-> arg0 anim-speed)) (set! (-> a0-68 frame-num) 0.0) (joint-control-channel-group! a0-68 (the-as art-joint-anim s4-4) num-func-seek!) ) @@ -1296,34 +1300,35 @@ ) ) -(defmethod enemy-method-78 ((this grunt) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this grunt) (arg0 enemy-knocked-info)) (cond ((= (-> this incoming knocked-type) (knocked-type knocked-type-6)) - (when (or (logtest? (-> this stack 511) 2) (let ((v1-7 (if (> (-> this skel active-channels) 0) - (-> this skel root-channel 0 frame-group) - ) - ) - ) - (not (and v1-7 (or (= v1-7 (-> this draw art-group data 16)) - (= v1-7 (-> this draw art-group data 38)) - (= v1-7 (-> this draw art-group data 39)) - (= v1-7 (-> this draw art-group data 40)) - ) - ) - ) - ) + (when (or (logtest? (-> this unknown-byte-n123n) 2) + (let ((v1-7 (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + (not (and v1-7 (or (= v1-7 (-> this draw art-group data 16)) + (= v1-7 (-> this draw art-group data 38)) + (= v1-7 (-> this draw art-group data 39)) + (= v1-7 (-> this draw art-group data 40)) + ) + ) + ) + ) ) (let ((s4-0 (-> this draw art-group data 44))) (ja-channel-push! 1 (seconds 0.17)) (let ((a0-16 (-> this skel root-channel 0))) (set! (-> a0-16 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-16 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-16 param 1) (-> arg0 0)) + (set! (-> a0-16 param 1) (-> arg0 anim-speed)) (set! (-> a0-16 frame-num) 0.0) (joint-control-channel-group! a0-16 (the-as art-joint-anim s4-0) num-func-seek!) ) ) - (set! (-> this unknown-byte-n123n) (the-as int (logand -3 (-> this stack 511)))) + (logand! (-> this unknown-byte-n123n) -3) #t ) ) @@ -1339,7 +1344,7 @@ ) (set! (-> a0-23 frame-group) (the-as art-joint-anim a1-6)) (set! (-> a0-23 param 0) (the float (+ (-> (the-as art-joint-anim a1-6) frames num-frames) -1))) - (set! (-> a0-23 param 1) (-> arg0 0)) + (set! (-> a0-23 param 1) (-> arg0 anim-speed)) (set! (-> a0-23 frame-num) 0.0) (joint-control-channel-group! a0-23 (the-as art-joint-anim a1-6) num-func-seek!) ) @@ -1356,7 +1361,7 @@ (let ((s5-0 (handle->process (-> self focus handle)))) (when s5-0 (let ((gp-0 (get-trans (the-as process-focusable s5-0) 0))) - (when (and (or (not (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice))) + (when (and (or (not (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance))) (>= 163840.0 (vector-vector-distance (-> self root trans) gp-0)) ) (or (not (logtest? (-> self fact enemy-options) (enemy-option user8))) @@ -1367,7 +1372,7 @@ ) (cond ((and (logtest? (-> self fact enemy-options) (enemy-option user9)) - (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance)) ) (let ((s5-1 (new 'stack-no-clear 'vector))) (vector-! s5-1 gp-0 (-> self root trans)) @@ -1395,7 +1400,7 @@ :post (-> (method-of-type nav-enemy idle) post) ) -(defmethod dispose! ((this grunt)) +(defmethod dying ((this grunt)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (when (-> this minimap) (logior! (-> this minimap flags) (minimap-flag fade-out)) @@ -1535,16 +1540,16 @@ 0 (set-gravity-length (-> this root dynam) 573440.0) (let ((s5-2 *grunt-global-info*)) - (set! (-> this patrol-anim) (-> s5-2 patrol-anim (get-rand-int this 4))) - (set! (-> this charge-anim) (-> s5-2 charge-anim (get-rand-int this 3))) - (set! (-> this attack-anim) (-> s5-2 attack-anim (get-rand-int this 2))) + (set! (-> this patrol-anim) (-> s5-2 patrol-anim (rnd-int-count this 4))) + (set! (-> this charge-anim) (-> s5-2 charge-anim (rnd-int-count this 3))) + (set! (-> this attack-anim) (-> s5-2 attack-anim (rnd-int-count this 2))) ) (set! (-> this unknown-byte-n1k2n3) -1) - (if (zero? (get-rand-int this 2)) - (set! (-> this unknown-byte-n123n) (the-as int (logior (-> this stack 511) 1))) + (if (zero? (rnd-int-count this 2)) + (logior! (-> this unknown-byte-n123n) 1) ) - (if (zero? (get-rand-int this 2)) - (set! (-> this unknown-byte-n123n) (the-as int (logior (-> this stack 511) 4))) + (if (zero? (rnd-int-count this 2)) + (logior! (-> this unknown-byte-n123n) 4) ) (set! (-> this intro-path) (new 'process 'path-control this 'intro 0.0 (the-as entity #f) #t)) (add-connection 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 5e119760ca..8300c8a5d9 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 @@ -1367,7 +1367,7 @@ (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)) (set! (-> s0-0 quad) (-> this root trans quad)) (cond - ((logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) (let ((a1-6 s0-0)) (let ((v1-14 s0-0)) (let ((a0-9 s4-0)) @@ -1457,12 +1457,12 @@ ) ;; WARN: Return type mismatch object vs none. -(defmethod track-target! ((this crimson-guard-level)) +(defmethod common-post ((this crimson-guard-level)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (if (-> this joint-enable) @@ -1545,13 +1545,13 @@ :enter (behavior () (talker-spawn-func (-> *talker-speech* 10) *entity-pool* (target-pos 0) (the-as region #f)) (set-time! (-> self state-time)) - (let ((v1-4 (logior (-> self enemy-flags) (enemy-flag use-notice-distance)))) - (set! (-> self enemy-flags) (logclear v1-4 (enemy-flag called-dying))) + (let ((v1-4 (logior (-> self enemy-flags) (enemy-flag cam-attack-mode)))) + (set! (-> self enemy-flags) (logclear v1-4 (enemy-flag use-trigger))) ) (logclear! (-> self mask) (process-mask actor-pause)) - (look-at-target! self (enemy-flag lock-focus)) - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (look-at-target! self (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-1 (-> self on-notice))) (if gp-1 (script-eval gp-1 :vector (-> self root trans)) @@ -1559,7 +1559,7 @@ ) ) (let ((gp-2 (-> self focus aware))) - (when (logtest? (-> self enemy-flags) (enemy-flag chase-startup)) + (when (logtest? (-> self enemy-flags) (enemy-flag alert)) (cond ((and (= gp-2 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) @@ -1577,11 +1577,11 @@ ) ) (speech-control-method-12 *speech-control* self (speech-type speech-type-3)) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logior! (-> self enemy-flags) (enemy-flag alert)) ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) (gp-0 (new 'stack-no-clear 'vector)) ) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) @@ -1622,7 +1622,7 @@ (if (logtest? (-> self flags) 4) (go-virtual gun-shoot) ) - (set! (-> self reaction-time) (the-as time-frame (the int (* 300.0 (get-rand-float-range self 1.0 3.0))))) + (set! (-> self reaction-time) (the-as time-frame (the int (* 300.0 (rnd-float-range self 1.0 3.0))))) ) :exit (behavior () '() @@ -1688,7 +1688,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-1 (* 2.0 (get-rand-float-range self 0.9 1.1)))) + (let ((f30-1 (* 2.0 (rnd-float-range self 0.9 1.1)))) (until #f (suspend) (ja :num! (loop! f30-1)) @@ -1704,7 +1704,7 @@ :enter (behavior () ((-> (method-of-type nav-enemy hostile) enter)) (set-time! (-> self state-time)) - (set! (-> self reaction-time) (the-as time-frame (the int (* 300.0 (get-rand-float-range self 0.5 1.5))))) + (set! (-> self reaction-time) (the-as time-frame (the int (* 300.0 (rnd-float-range self 0.5 1.5))))) ) :exit (behavior () '() @@ -1747,7 +1747,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-1 (* 2.0 (get-rand-float-range self 0.9 1.1)))) + (let ((f30-1 (* 2.0 (rnd-float-range self 0.9 1.1)))) (until #f (suspend) (ja :num! (loop! f30-1)) @@ -1821,7 +1821,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-1 (* 2.0 (get-rand-float-range self 0.9 1.1)))) + (let ((f30-1 (* 2.0 (rnd-float-range self 0.9 1.1)))) (until #f (suspend) (ja :num! (loop! f30-1)) @@ -1893,7 +1893,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-1 (* 2.0 (get-rand-float-range self 0.9 1.1)))) + (let ((f30-1 (* 2.0 (rnd-float-range self 0.9 1.1)))) (until #f (suspend) (ja :num! (loop! f30-1)) @@ -1910,7 +1910,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (nav-enemy-method-167 self) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) @@ -1933,11 +1933,11 @@ (set! (-> self miss-amount) 0.0) (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))))) + (set! (-> self reaction-time) (the-as time-frame (the int (* 300.0 (rnd-float-range self 3.0 5.0))))) ) :exit (behavior () (set! (-> self joint-enable) #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () (crimson-guard-level-method-200 self) @@ -1960,7 +1960,7 @@ :code (behavior () (speech-control-method-12 *speech-control* self (speech-type speech-type-13)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! crimson-guard-idle-to-stab-idle-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) (seek-toward-heading-vec! (-> self root) (-> self target-self-xz) 65536.0 (seconds 0.02)) @@ -1982,7 +1982,7 @@ ) #f (label cfg-13) - (let ((f30-1 (get-rand-float-range self 0.9 1.1))) + (let ((f30-1 (rnd-float-range self 0.9 1.1))) (ja-channel-push! 1 (seconds 0.2)) (ja-no-eval :group! crimson-guard-stab-idle-to-idle-ja :num! (seek! max f30-1) :frame-num 0.0) (until (ja-done? 0) @@ -2060,7 +2060,7 @@ :code (behavior () (local-vars (v1-48 object)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self anim-shoot 0 anim-index)) :num! (seek! max f30-0) :frame-num 0.0 @@ -2149,7 +2149,7 @@ #f ) (label cfg-57) - (let ((f30-1 (get-rand-float-range self 0.9 1.1))) + (let ((f30-1 (rnd-float-range self 0.9 1.1))) (ja-channel-push! 1 (seconds 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self anim-shoot 2 anim-index)) :num! (seek! max f30-1) @@ -2573,7 +2573,7 @@ (let ((v1-3 (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 3))) (logior! (-> v1-3 prim-core action) (collide-action deadly)) ) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-8 *game-info*) (a0-4 (+ (-> v1-8 attack-id) 1)) @@ -2590,8 +2590,8 @@ (let ((v1-3 (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 3))) (logclear! (-> v1-3 prim-core action) (collide-action deadly)) ) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -2668,7 +2668,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag37)))) @@ -2685,8 +2685,8 @@ 0 ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -2751,7 +2751,7 @@ :event enemy-event-handler :enter (behavior () (set! (-> self joint-enable) #t) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-5 *game-info*) (a0-2 (+ (-> v1-5 attack-id) 1)) @@ -2803,8 +2803,8 @@ (set! (-> v1-11 state mode) (the-as lightning-mode a0-5)) ) (set! (-> self joint-enable) #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -3022,7 +3022,7 @@ (set! (-> a0-0 travel quad) (-> v1-1 quad)) ) 0 - (track-target! self) + (common-post self) ) ) @@ -3072,7 +3072,7 @@ (set! (-> a0-0 travel quad) (-> v1-1 quad)) ) 0 - (track-target! self) + (common-post self) ) ) @@ -3150,7 +3150,7 @@ 0 (ja-channel-push! 1 (seconds 0.1)) (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-right-ja :num! (seek! (ja-aframe 6.0 0)) :frame-num (ja-aframe 0.0 0)) (until (ja-done? 0) (let ((a0-20 (handle->process (-> self focus handle)))) @@ -3191,7 +3191,7 @@ ) 0 (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-right-ja :num! (seek! (ja-aframe 11.0 0)) :frame-num (ja-aframe 6.0 0)) (until (ja-done? 0) (suspend) @@ -3249,7 +3249,7 @@ 0 (ja-channel-push! 1 (seconds 0.1)) (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-left-ja :num! (seek! (ja-aframe 9.0 0)) :frame-num (ja-aframe 0.0 0)) (until (ja-done? 0) (let ((a0-20 (handle->process (-> self focus handle)))) @@ -3290,7 +3290,7 @@ ) 0 (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-left-ja :num! (seek! (ja-aframe 11.0 0)) :frame-num (ja-aframe 9.0 0)) (until (ja-done? 0) (suspend) @@ -3349,7 +3349,7 @@ ) ) -(defmethod enemy-method-77 ((this crimson-guard-level) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this crimson-guard-level) (arg0 enemy-knocked-info)) (let ((v1-1 (-> this root transv))) (cond ((< (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z)))) 57344.0) @@ -3369,7 +3369,7 @@ ) (set! (-> a0-5 frame-group) (the-as art-joint-anim a1-2)) (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim a1-2) num-func-seek!) ) @@ -3380,7 +3380,7 @@ (ja-channel-push! 1 (seconds 0.01)) (cond ((= (-> this small-hit) 1) - (set! (-> this yellow-anim anim-index-front) (get-rand-int this 2)) + (set! (-> this yellow-anim anim-index-front) (rnd-int-count this 2)) (let ((a1-8 (-> this draw @@ -3398,7 +3398,7 @@ ) (set! (-> a0-17 frame-group) (the-as art-joint-anim a1-8)) (set! (-> a0-17 param 0) (the float (+ (-> (the-as art-joint-anim a1-8) frames num-frames) -1))) - (set! (-> a0-17 param 1) (-> arg0 0)) + (set! (-> a0-17 param 1) (-> arg0 anim-speed)) (set! (-> a0-17 frame-num) 0.0) (joint-control-channel-group! a0-17 (the-as art-joint-anim a1-8) num-func-seek!) ) @@ -3409,7 +3409,7 @@ ) (set! (-> a0-21 frame-group) (the-as art-joint-anim a1-9)) (set! (-> a0-21 param 0) (the float (+ (-> (the-as art-joint-anim a1-9) frames num-frames) -1))) - (set! (-> a0-21 param 1) (-> arg0 0)) + (set! (-> a0-21 param 1) (-> arg0 anim-speed)) (set! (-> a0-21 frame-num) 0.0) (joint-control-channel-group! a0-21 (the-as art-joint-anim a1-9) num-func-seek!) ) @@ -3423,7 +3423,7 @@ (set! (-> a0-24 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 10)) frames num-frames) -1)) ) - (set! (-> a0-24 param 1) (-> arg0 0)) + (set! (-> a0-24 param 1) (-> arg0 anim-speed)) (set! (-> a0-24 frame-num) 0.0) (joint-control-channel-group! a0-24 (the-as art-joint-anim (-> this draw art-group data 10)) num-func-seek!) ) @@ -3435,7 +3435,7 @@ ) (set! (-> a0-29 frame-group) (the-as art-joint-anim a1-13)) (set! (-> a0-29 param 0) (the float (+ (-> (the-as art-joint-anim a1-13) frames num-frames) -1))) - (set! (-> a0-29 param 1) (-> arg0 0)) + (set! (-> a0-29 param 1) (-> arg0 anim-speed)) (set! (-> a0-29 frame-num) 0.0) (joint-control-channel-group! a0-29 (the-as art-joint-anim a1-13) num-func-seek!) ) @@ -3471,7 +3471,7 @@ ) ) -(defmethod enemy-method-78 ((this crimson-guard-level) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this crimson-guard-level) (arg0 enemy-knocked-info)) (cond ((<= (-> this hit-points) 0) (let ((a1-1 (-> this draw art-group data (-> this info knocked-land anim-index (-> this hit-face)))) @@ -3479,7 +3479,7 @@ ) (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-1)) (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-1) frames num-frames) -1))) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-1) num-func-seek!) ) @@ -3509,7 +3509,7 @@ ) (set! (-> a0-15 frame-group) (the-as art-joint-anim a1-6)) (set! (-> a0-15 param 0) (the float (+ (-> (the-as art-joint-anim a1-6) frames num-frames) -1))) - (set! (-> a0-15 param 1) (-> arg0 0)) + (set! (-> a0-15 param 1) (-> arg0 anim-speed)) (set! (-> a0-15 frame-num) 0.0) (joint-control-channel-group! a0-15 (the-as art-joint-anim a1-6) num-func-seek!) ) @@ -3522,7 +3522,7 @@ ) (set! (-> a0-19 frame-group) (the-as art-joint-anim a1-7)) (set! (-> a0-19 param 0) (the float (+ (-> (the-as art-joint-anim a1-7) frames num-frames) -1))) - (set! (-> a0-19 param 1) (-> arg0 0)) + (set! (-> a0-19 param 1) (-> arg0 anim-speed)) (set! (-> a0-19 frame-num) 0.0) (joint-control-channel-group! a0-19 (the-as art-joint-anim a1-7) num-func-seek!) ) @@ -3537,7 +3537,7 @@ (set! (-> a0-22 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 11)) frames num-frames) -1)) ) - (set! (-> a0-22 param 1) (-> arg0 0)) + (set! (-> a0-22 param 1) (-> arg0 anim-speed)) (set! (-> a0-22 frame-num) 0.0) (joint-control-channel-group! a0-22 (the-as art-joint-anim (-> this draw art-group data 11)) num-func-seek!) ) @@ -3551,7 +3551,7 @@ ) (set! (-> a0-27 frame-group) (the-as art-joint-anim a1-11)) (set! (-> a0-27 param 0) (the float (+ (-> (the-as art-joint-anim a1-11) frames num-frames) -1))) - (set! (-> a0-27 param 1) (-> arg0 0)) + (set! (-> a0-27 param 1) (-> arg0 anim-speed)) (set! (-> a0-27 frame-num) 0.0) (joint-control-channel-group! a0-27 (the-as art-joint-anim a1-11) num-func-seek!) ) @@ -3569,7 +3569,7 @@ ((enemy-method-133 self) (ja-channel-push! 1 (seconds 0.2)) (let ((gp-0 (-> self draw art-group data (-> self enemy-info die-falling-anim))) - (f30-0 (get-rand-float-range self 0.8 1.2)) + (f30-0 (rnd-float-range self 0.8 1.2)) ) (ja-no-eval :group! gp-0 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -4026,7 +4026,9 @@ (ja :num! (loop! f30-0)) ) ) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 0 (-> self event-param-point)) (until #f (suspend) @@ -4234,7 +4236,7 @@ (set! (-> this joint) (new 'process 'joint-mod (joint-mod-mode joint-set*-world) this 4)) (set! (-> this l-control) (new 'process 'lightning-control (-> *lightning-spec-id-table* 13) this 0.0)) (set! (-> this l-control state points-to-draw) 0) - (let ((v1-45 (get-rand-int this 2))) + (let ((v1-45 (rnd-int-count this 2))) (if (logtest? (-> this flags) 4) (set! v1-45 0) ) diff --git a/goal_src/jak2/levels/common/enemy/hopper.gc b/goal_src/jak2/levels/common/enemy/hopper.gc index b21b4a0145..98bc7ec760 100644 --- a/goal_src/jak2/levels/common/enemy/hopper.gc +++ b/goal_src/jak2/levels/common/enemy/hopper.gc @@ -72,11 +72,11 @@ ) ) -(defmethod enemy-method-77 ((this hopper) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this hopper) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (let* ((a2-0 (ash 1 (-> *hopper-global-info* prev-blue-hit))) - (v1-3 (enemy-method-120 this 3 a2-0)) + (v1-3 (rnd-bit this 3 a2-0)) (a1-5 (-> this draw art-group data (-> *hopper-global-info* blue-hit-anim v1-3 hit-anim-index))) ) (set! (-> *hopper-global-info* prev-blue-hit) v1-3) @@ -92,7 +92,7 @@ (else (ja-channel-push! 1 (seconds 0.1)) (let* ((a2-2 (ash 1 (-> *hopper-global-info* prev-yellow-hit))) - (v1-13 (enemy-method-120 this 3 a2-2)) + (v1-13 (rnd-bit this 3 a2-2)) (a1-11 (-> this draw art-group data (-> *hopper-global-info* yellow-hit-anim v1-13 hit-anim-index))) ) (set! (-> this land-anim-index) (-> *hopper-global-info* yellow-hit-anim v1-13 land-anim-index)) @@ -100,7 +100,7 @@ (let ((a0-27 (-> this skel root-channel 0))) (set! (-> a0-27 frame-group) (the-as art-joint-anim a1-11)) (set! (-> a0-27 param 0) (the float (+ (-> (the-as art-joint-anim a1-11) frames num-frames) -1))) - (set! (-> a0-27 param 1) (-> arg0 0)) + (set! (-> a0-27 param 1) (-> arg0 anim-speed)) (set! (-> a0-27 frame-num) 0.0) (joint-control-channel-group! a0-27 (the-as art-joint-anim a1-11) num-func-seek!) ) @@ -110,7 +110,7 @@ #t ) -(defmethod enemy-method-78 ((this hopper) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this hopper) (arg0 enemy-knocked-info)) (cond ((= (-> this incoming knocked-type) (knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -119,7 +119,7 @@ (let ((a0-3 (-> this skel root-channel 0))) (set! (-> a0-3 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -137,7 +137,7 @@ (+ (-> (the-as art-joint-anim (-> this draw art-group data (-> this land-anim-index))) frames num-frames) -1) ) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 @@ -641,7 +641,7 @@ 0 (set! (-> self speed-y) 0.0) (set! (-> self accel-y) 0.0) - (set! (-> self next-jump-time) (the-as int (+ (current-time) (get-rand-int-range self 0 120)))) + (set! (-> self next-jump-time) (the-as int (+ (current-time) (rnd-int-range self 0 120)))) (set! (-> self step-num) 0) (set! (-> self best-score) -2.0) ) @@ -666,7 +666,7 @@ ) ) 0.0 - (let ((s5-0 (get-rand-int self 2))) + (let ((s5-0 (rnd-int-count self 2))) (set! (-> self direction y) 0.0) (let* ((v1-12 s4-1) (f30-0 (sqrtf (+ (* (-> v1-12 x) (-> v1-12 x)) (* (-> v1-12 z) (-> v1-12 z))))) @@ -676,8 +676,8 @@ 0.0 (let ((s4-2 (new 'stack-no-clear 'vector)) (f28-0 (if (zero? s5-0) - (get-rand-float-range self 4096.0 8192.0) - (get-rand-float-range self 8192.0 (fmin 40960.0 (fmax 16384.0 (* 0.5 f30-0)))) + (rnd-float-range self 4096.0 8192.0) + (rnd-float-range self 8192.0 (fmin 40960.0 (fmax 16384.0 (* 0.5 f30-0)))) ) ) ) @@ -694,8 +694,6 @@ ) (set! (-> self best-score) -2.0) (set! (-> self origin quad) (-> self root trans quad)) - ;; ;; og:preserve-this - ; (b! #t cfg-17) (until (not (hopper-method-178 self)) (empty) ) @@ -725,7 +723,7 @@ (set! (-> self jump-start-anim) (the-as uint 10)) ) (cond - ((zero? (get-rand-int self 2)) + ((zero? (rnd-int-count self 2)) (set! (-> self jump-air-anim) (the-as uint 15)) (set! (-> self jump-land-anim) (the-as uint 16)) (set! (-> self jump-height-min) 12288.0) @@ -740,8 +738,10 @@ ) ) ) - (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)))) + (set! *hopper-next-jump-time* (+ (current-time) (rnd-int-range self 4 22))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 0 (-> self best-point)) ) ) @@ -770,8 +770,10 @@ (set! (-> self jump-anim-start-frame) 8.0) ) ) - (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)))) + (set! *hopper-next-jump-time* (+ (current-time) (rnd-int-range self 4 22))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 0 (-> self best-point)) ) ) @@ -797,7 +799,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! hopper-idle-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -815,10 +817,10 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) (gp-0 (new 'stack-no-clear 'vector)) ) - (if (zero? (get-rand-int self 2)) + (if (zero? (rnd-int-count self 2)) (ja :group! hopper-notice-ja) (ja :group! hopper-notice-alt-ja) ) @@ -839,8 +841,8 @@ (defstate ambush (hopper) :virtual #t :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -896,14 +898,16 @@ (set! (-> gp-0 y) (-> s5-0 best-other-tri intersect y)) ) ) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 2 gp-0) ) (go-virtual hostile) ) ) -(defmethod dispose! ((this hopper)) +(defmethod dying ((this hopper)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (when (-> this minimap) (logior! (-> this minimap flags) (minimap-flag fade-out)) @@ -1008,7 +1012,7 @@ (set! (-> this jump-height-min) 12288.0) (set! (-> this jump-anim-start-frame) 8.0) (set! (-> this land-anim-index) 26) - (set! (-> this side) (get-rand-float-range this -1.5 1.5)) + (set! (-> this side) (rnd-float-range this -1.5 1.5)) (when (logtest? (enemy-option ambush) (-> this fact enemy-options)) (set! (-> this path-intro) (new 'process 'path-control this 'intro 0.0 (-> this entity) #f)) (if (-> this path-intro) 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 bc6b46af06..7e21fe1237 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 @@ -585,7 +585,7 @@ ;; WARN: Return type mismatch int vs sound-id. (defmethod enemy-method-135 ((this crimson-guard-hover) (arg0 int)) - (if (and (zero? arg0) (logtest? #x4000000 (-> this incoming penetrate-using))) + (if (and (zero? arg0) (logtest? (penetrate enemy-yellow-shot) (-> this incoming penetrate-using))) (sound-play "hover-take-hit") (call-parent-method this arg0) ) @@ -600,7 +600,7 @@ (t9-0) ) ) - (set! (-> self last-fire-time) (+ (current-time) (the int (* 300.0 (get-rand-float-range self 2.0 3.0))))) + (set! (-> self last-fire-time) (+ (current-time) (the int (* 300.0 (rnd-float-range self 2.0 3.0))))) (go-virtual ambush-fly) ) :exit (behavior () @@ -926,29 +926,29 @@ (ja :num! (seek!)) ) (set! (-> self restart-fly-anims) #t) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-34 (-> self enemy-flags))) - (if (logtest? v1-34 (enemy-flag checking-water)) - (set! v1-35 (logior v1-34 (enemy-flag enable-on-active))) - (set! v1-35 (logclear v1-34 (enemy-flag enable-on-active))) + (if (logtest? v1-34 (enemy-flag vulnerable-backup)) + (set! v1-35 (logior v1-34 (enemy-flag vulnerable))) + (set! v1-35 (logclear v1-34 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-35) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-42 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-42) - (set! v1-43 (logior (enemy-flag check-water-backup) v1-42)) - (set! v1-43 (logclear v1-42 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-42) + (set! v1-43 (logior (enemy-flag trackable) v1-42)) + (set! v1-43 (logclear v1-42 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-43) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (hover-nav-control-method-21 (-> self hover)) (go-hostile self) @@ -959,7 +959,7 @@ :virtual #t :event enemy-event-handler :code (behavior () - (dispose! self) + (dying self) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -1113,9 +1113,9 @@ (hover-nav-control-method-20 (-> this hover)) (hover-enemy-method-140 this #t) (let ((v1-14 (-> this enemy-flags))) - (if (logtest? v1-14 (enemy-flag checking-water)) - (set! v1-15 (logior v1-14 (enemy-flag enable-on-active))) - (set! v1-15 (logclear v1-14 (enemy-flag enable-on-active))) + (if (logtest? v1-14 (enemy-flag vulnerable-backup)) + (set! v1-15 (logior v1-14 (enemy-flag vulnerable))) + (set! v1-15 (logclear v1-14 (enemy-flag vulnerable))) ) ) (set! (-> this enemy-flags) v1-15) @@ -1247,7 +1247,7 @@ ) (vector-negate! gp-1 gp-1) ) - (let ((f30-1 (get-rand-float-range this 0.0 1.0)) + (let ((f30-1 (rnd-float-range this 0.0 1.0)) (s5-1 (-> this enemy-info)) ) (vector-float*! gp-1 gp-1 (lerp (-> s5-1 knocked-hard-vxz-lo) (-> s5-1 knocked-hard-vxz-hi) f30-1)) @@ -1263,7 +1263,7 @@ (none) ) -(defmethod enemy-method-77 ((this crimson-guard-hover) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this crimson-guard-hover) (arg0 enemy-knocked-info)) (ja-channel-push! 1 0) (case (-> this incoming knocked-type) (((knocked-type knocked-type-5)) @@ -1272,7 +1272,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 12)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 12)) num-func-seek!) ) @@ -1284,7 +1284,7 @@ (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 10)) frames num-frames) -1)) ) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim (-> this draw art-group data 10)) num-func-seek!) ) @@ -1294,7 +1294,7 @@ #t ) -(defmethod enemy-method-78 ((this crimson-guard-hover) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this crimson-guard-hover) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (ja-channel-push! 1 (seconds 0.4)) @@ -1303,7 +1303,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 19)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 19)) num-func-seek!) ) @@ -1315,7 +1315,7 @@ ) ) -(defmethod track-target! ((this crimson-guard-hover)) +(defmethod common-post ((this crimson-guard-hover)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -1346,7 +1346,7 @@ (* 2.0 (seconds-per-frame)) ) ) - (let ((t9-6 (method-of-type hover-enemy track-target!))) + (let ((t9-6 (method-of-type hover-enemy common-post))) (t9-6 this) ) (los-control-method-9 (-> this los) (the-as process-focusable #f) (the-as vector #f) 2048.0) @@ -1743,7 +1743,7 @@ (set! (-> this gun-x-angle-final) 0.0) (set! (-> this hips-jmod) (the-as joint-mod (new 'process 'joint-mod-rotate-local this 18 #t))) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (set! sv-16 (new 'static 'res-tag)) (let ((v1-30 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) (if (and v1-30 (= (-> sv-16 elt-count) 1)) diff --git a/goal_src/jak2/levels/common/enemy/hover/flamer.gc b/goal_src/jak2/levels/common/enemy/hover/flamer.gc index a21bfee08a..9aee09614b 100644 --- a/goal_src/jak2/levels/common/enemy/hover/flamer.gc +++ b/goal_src/jak2/levels/common/enemy/hover/flamer.gc @@ -217,15 +217,15 @@ (('hit 'hit-flinch 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (go (method-of-object this knocked)) @@ -548,14 +548,14 @@ ) ) -(defmethod track-target! ((this flamer)) +(defmethod common-post ((this flamer)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (update-vol! (-> this sound) (-> this sound-volume)) (flamer-method-191 this) - ((method-of-type nav-enemy track-target!) this) + ((method-of-type nav-enemy common-post) this) (none) ) @@ -678,7 +678,7 @@ ((zero? v1-0) (let ((a1-1 (new 'stack-no-clear 'collide-query))) (cond - ((enemy-method-125 this a1-1 (collide-spec backgnd) 8192.0 26624.0 1024.0) + ((ground-pat-set! this a1-1 (collide-spec backgnd) 8192.0 26624.0 1024.0) (set! (-> this base-pos y) (+ 22528.0 (-> this root gspot-pos y))) ) (else @@ -829,7 +829,7 @@ ) ) (logclear! (-> self mask) (process-mask actor-pause)) - (logclear! (-> self enemy-flags) (enemy-flag notice)) + (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (if (not (-> self path)) (go-virtual notice) ) @@ -860,7 +860,7 @@ ) ) (logior! (-> self mask) (process-mask actor-pause)) - (logior! (-> self enemy-flags) (enemy-flag notice)) + (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (set! (-> self flit-joint twist-min-y) (the-as float #t)) (set! (-> self last-fire-time) (+ (current-time) (seconds -1.5))) ) @@ -896,7 +896,7 @@ :virtual #t :enter (behavior () (logclear! (-> self mask) (process-mask actor-pause)) - (logclear! (-> self enemy-flags) (enemy-flag notice)) + (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (if (not (-> self path)) (go-virtual active) ) @@ -951,7 +951,7 @@ ) :exit (behavior () (logior! (-> self mask) (process-mask actor-pause)) - (logior! (-> self enemy-flags) (enemy-flag notice)) + (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) ) :trans (behavior () (set! (-> self path-pos) (- (-> self path-pos) (* 0.33333334 (seconds-per-frame)))) @@ -1155,7 +1155,7 @@ ;; WARN: Return type mismatch object vs symbol. ;; WARN: Using new Jak 2 rtype-of -(defmethod enemy-method-77 ((this flamer) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this flamer) (arg0 enemy-knocked-info)) (let ((v1-0 (-> this incoming knocked-type))) (the-as symbol @@ -1166,7 +1166,7 @@ (s4-0 (new 'static 'array uint64 3 #x12 #x13 #x14)) (s3-0 (new 'static 'array int32 4 0 0 0 0)) (a2-0 (ash 1 (-> s3-0 0))) - (v1-6 (enemy-method-120 this a1-3 a2-0)) + (v1-6 (rnd-bit this a1-3 a2-0)) (s4-1 (-> this draw art-group data (-> (the-as (pointer int32) (+ (* v1-6 8) (the-as int s4-0)))))) ) (set! (-> s3-0 0) v1-6) @@ -1183,7 +1183,7 @@ (let ((a0-17 (-> this skel root-channel 0))) (set! (-> a0-17 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-17 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-17 param 1) (-> arg0 0)) + (set! (-> a0-17 param 1) (-> arg0 anim-speed)) (set! (-> a0-17 frame-num) 0.0) (joint-control-channel-group! a0-17 (the-as art-joint-anim s4-1) num-func-seek!) ) @@ -1196,7 +1196,7 @@ ) (set! (-> a0-21 frame-group) (the-as art-joint-anim a1-10)) (set! (-> a0-21 param 0) (the float (+ (-> (the-as art-joint-anim a1-10) frames num-frames) -1))) - (set! (-> a0-21 param 1) (-> arg0 0)) + (set! (-> a0-21 param 1) (-> arg0 anim-speed)) (set! (-> a0-21 frame-num) 0.0) (joint-control-channel-group! a0-21 (the-as art-joint-anim a1-10) num-func-seek!) ) @@ -1268,7 +1268,7 @@ 0 (set! (-> self hit-points) 0) (if (logtest? (enemy-option knocked-into-water) (-> self fact enemy-options)) - (logior! (-> self enemy-flags) (enemy-flag trackable-backup)) + (logior! (-> self enemy-flags) (enemy-flag check-water)) ) (let ((v1-8 self)) (set! (-> v1-8 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-8 enemy-flags)))) @@ -1284,10 +1284,10 @@ ) ) -(defmethod dispose! ((this flamer)) +(defmethod dying ((this flamer)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" - (let ((s5-1 (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags)))) - (let ((t9-0 (method-of-type nav-enemy dispose!))) + (let ((s5-1 (logtest? (enemy-flag called-dying) (-> this enemy-flags)))) + (let ((t9-0 (method-of-type nav-enemy dying))) (t9-0 this) ) (if (not s5-1) @@ -1410,7 +1410,7 @@ (set! (-> this scale) 1.6) (flamer-method-186 this 1.0) (logclear! (-> this nav flags) (nav-control-flag limit-rotation-rate)) - (set! (-> this sync-off) (the-as uint (get-rand-int this 600))) + (set! (-> this sync-off) (the-as uint (rnd-int-count this 600))) (set! (-> this flit-angle) 0.0) (set! (-> this flit-timer) 0) (set! (-> this root dynam gravity y) 225280.0) @@ -1441,7 +1441,7 @@ (set! (-> this sound) (new 'process 'ambient-sound (static-sound-spec "flamer-loop" :fo-max 80) (-> this root trans)) ) - (logior! (-> this enemy-flags) (enemy-flag multi-focus)) + (logior! (-> this enemy-flags) (enemy-flag dislike-combo)) (let ((v1-45 (-> this nav))) (set! (-> v1-45 sphere-mask) (the-as uint 0)) ) 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 15b53b1346..7b3dfb1d32 100644 --- a/goal_src/jak2/levels/common/enemy/hover/hover-enemy.gc +++ b/goal_src/jak2/levels/common/enemy/hover/hover-enemy.gc @@ -21,20 +21,20 @@ (('hit 'hit-knocked 'hit-flinch) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (cond ((zero? (-> this hit-points)) - (if (rng-hit? this 0.4) + (if (rnd-percent? this 0.4) (go (method-of-object this flying-death)) (go (method-of-object this flying-death-explode)) ) @@ -290,14 +290,14 @@ (none) ) -(defmethod track-target! ((this hover-enemy)) +(defmethod common-post ((this hover-enemy)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (hover-enemy-method-148 this) (enemy-method-129 this) - (let ((t9-2 (method-of-type enemy track-target!))) + (let ((t9-2 (method-of-type enemy common-post))) (t9-2 this) ) (hover-nav-control-method-13 (-> this hover)) @@ -441,7 +441,7 @@ (defstate ambush (hover-enemy) :virtual #t :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (hover-enemy-method-140 self #f) (if (logtest? (-> self path flags) (path-control-flag not-found)) (go process-drawable-art-error "no path") @@ -449,7 +449,7 @@ (set! (-> self scale-timer) (the-as uint (current-time))) (cond ((not (logtest? (-> self fact enemy-options) (enemy-option user0))) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (hover-enemy-method-141 self 0.0) ) (else @@ -509,9 +509,9 @@ (hover-nav-control-method-20 (-> self hover)) (hover-enemy-method-140 self #t) (let ((v1-4 (-> self enemy-flags))) - (if (logtest? v1-4 (enemy-flag checking-water)) - (set! v1-5 (logior v1-4 (enemy-flag enable-on-active))) - (set! v1-5 (logclear v1-4 (enemy-flag enable-on-active))) + (if (logtest? v1-4 (enemy-flag vulnerable-backup)) + (set! v1-5 (logior v1-4 (enemy-flag vulnerable))) + (set! v1-5 (logclear v1-4 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-5) @@ -536,11 +536,11 @@ (when (< f0-1 f1-0) (let ((f30-0 (fmin 1.0 (/ (+ 30.0 f0-1) f1-0)))) (hover-enemy-method-141 self f30-0) - (when (and (not (logtest? (-> self enemy-flags) (enemy-flag enable-on-active))) (>= f30-0 1.0)) + (when (and (not (logtest? (-> self enemy-flags) (enemy-flag vulnerable))) (>= f30-0 1.0)) (let ((v1-18 (-> self enemy-flags))) - (if (logtest? v1-18 (enemy-flag checking-water)) - (set! v1-19 (logior v1-18 (enemy-flag enable-on-active))) - (set! v1-19 (logclear v1-18 (enemy-flag enable-on-active))) + (if (logtest? v1-18 (enemy-flag vulnerable-backup)) + (set! v1-19 (logior v1-18 (enemy-flag vulnerable))) + (set! v1-19 (logclear v1-18 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-19) @@ -655,29 +655,29 @@ (ja :num! (seek!)) ) (set! (-> self restart-fly-anims) #t) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-37 (-> self enemy-flags))) - (if (logtest? v1-37 (enemy-flag checking-water)) - (set! v1-38 (logior v1-37 (enemy-flag enable-on-active))) - (set! v1-38 (logclear v1-37 (enemy-flag enable-on-active))) + (if (logtest? v1-37 (enemy-flag vulnerable-backup)) + (set! v1-38 (logior v1-37 (enemy-flag vulnerable))) + (set! v1-38 (logclear v1-37 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-38) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-45 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-45) - (set! v1-46 (logior (enemy-flag check-water-backup) v1-45)) - (set! v1-46 (logclear v1-45 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-45) + (set! v1-46 (logior (enemy-flag trackable) v1-45)) + (set! v1-46 (logclear v1-45 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-46) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (hover-nav-control-method-21 (-> self hover)) (go-hostile self) @@ -698,12 +698,12 @@ ) :enter (behavior () (set-time! (-> self state-time)) - (dispose! self) + (dying self) (stop-looking-at-target! self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self mask) (process-mask actor-pause)) (logclear! (-> self focus-status) (focus-status dangerous)) - (logclear! (-> self enemy-flags) (enemy-flag check-water-backup)) + (logclear! (-> self enemy-flags) (enemy-flag trackable)) (set! (-> self root penetrate-using) (penetrate lunge vehicle knocked)) (let ((gp-0 (-> self flying-death-transv))) (let ((a1-0 (handle->process (-> self incoming attacker-handle)))) @@ -715,10 +715,10 @@ (set! (-> gp-0 y) 0.0) (vector-normalize! gp-0 1.0) (vector-rotate90-around-y! gp-0 gp-0) - (if (rng-hit? self 0.5) + (if (rnd-percent? self 0.5) (vector-negate! gp-0 gp-0) ) - (let ((f30-0 (get-rand-float-range self 0.0 1.0))) + (let ((f30-0 (rnd-float-range self 0.0 1.0))) (vector-float*! gp-0 gp-0 (lerp 98304.0 172032.0 f30-0)) (set! (-> gp-0 y) (lerp 8192.0 98304.0 f30-0)) ) @@ -813,7 +813,7 @@ (defstate flying-death-explode (hover-enemy) :virtual #t :enter (behavior () - (dispose! self) + (dying self) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -881,13 +881,13 @@ (none) ) -(defmethod dispose! ((this hover-enemy)) +(defmethod dying ((this hover-enemy)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" - (when (not (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags))) + (when (not (logtest? (enemy-flag called-dying) (-> this enemy-flags))) (process-entity-status! this (entity-perm-status subtask-complete) #t) (send-event (ppointer->process (-> this parent)) 'hover-die) (hover-enemy-method-154 this) - ((method-of-type enemy dispose!) this) + ((method-of-type enemy dying) this) ) (none) ) @@ -908,7 +908,7 @@ (defmethod hover-enemy-method-155 ((this hover-enemy)) (set! (-> this hover-info) (hover-enemy-method-151 this)) - (set! (-> this fly-anim-speed) (get-rand-float-range this 0.8 1.2)) + (set! (-> this fly-anim-speed) (rnd-float-range this 0.8 1.2)) (vector-reset! (-> this rotation-vec)) (vector-reset! (-> this dest-pos)) (vector-reset! (-> this local-dir)) diff --git a/goal_src/jak2/levels/common/enemy/hover/wasp.gc b/goal_src/jak2/levels/common/enemy/hover/wasp.gc index d5bbfd2638..63502f9977 100644 --- a/goal_src/jak2/levels/common/enemy/hover/wasp.gc +++ b/goal_src/jak2/levels/common/enemy/hover/wasp.gc @@ -443,15 +443,15 @@ (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (if (zero? (-> this hit-points)) @@ -487,7 +487,7 @@ ) (vector-negate! gp-1 gp-1) ) - (let ((f30-1 (get-rand-float-range this 0.0 1.0)) + (let ((f30-1 (rnd-float-range this 0.0 1.0)) (s5-1 (-> this enemy-info)) ) (vector-float*! gp-1 gp-1 (lerp (-> s5-1 knocked-hard-vxz-lo) (-> s5-1 knocked-hard-vxz-hi) f30-1)) @@ -537,13 +537,13 @@ (none) ) -(defmethod track-target! ((this wasp)) +(defmethod common-post ((this wasp)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (seek! (-> this gun-x-angle) (-> this gun-x-angle-final) (* 21845.334 (seconds-per-frame))) - ((method-of-type hover-enemy track-target!) this) + ((method-of-type hover-enemy common-post) this) (none) ) @@ -597,7 +597,7 @@ ) ) :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (hover-enemy-method-140 self #f) (if (logtest? (-> self path flags) (path-control-flag not-found)) (go process-drawable-art-error "no path") @@ -616,9 +616,9 @@ (hover-nav-control-method-18 (-> self hover) (-> self path) -1 6) (set-time! (-> self last-fire-time)) (set! (-> self bridge-index) 0) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> self mask) (process-mask collectable)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) ) :exit (behavior () (let ((gp-0 (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) 0.0 'interp)) @@ -951,29 +951,29 @@ (ja :num! (seek!)) ) (set! (-> self restart-fly-anims) #t) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-34 (-> self enemy-flags))) - (if (logtest? v1-34 (enemy-flag checking-water)) - (set! v1-35 (logior v1-34 (enemy-flag enable-on-active))) - (set! v1-35 (logclear v1-34 (enemy-flag enable-on-active))) + (if (logtest? v1-34 (enemy-flag vulnerable-backup)) + (set! v1-35 (logior v1-34 (enemy-flag vulnerable))) + (set! v1-35 (logclear v1-34 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-35) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-42 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-42) - (set! v1-43 (logior (enemy-flag check-water-backup) v1-42)) - (set! v1-43 (logclear v1-42 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-42) + (set! v1-43 (logior (enemy-flag trackable) v1-42)) + (set! v1-43 (logclear v1-42 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-43) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (hover-nav-control-method-21 (-> self hover)) (go-hostile self) @@ -984,7 +984,7 @@ :virtual #t :event enemy-event-handler :code (behavior () - (dispose! self) + (dying self) (set! (-> self hit-points) 0) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) @@ -1045,7 +1045,7 @@ :virtual #t :event enemy-event-handler :code (behavior () - (dispose! self) + (dying self) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -1092,9 +1092,9 @@ ) ) -(defmethod enemy-method-77 ((this wasp) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this wasp) (arg0 enemy-knocked-info)) (cond - ((rng-hit? this 0.5) + ((rnd-percent? this 0.5) (set! (-> this knocked-anim) 10) (set! (-> this knocked-recover-anim) 11) ) @@ -1109,20 +1109,20 @@ ) (set! (-> a0-5 frame-group) (the-as art-joint-anim a1-3)) (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim a1-3) frames num-frames) -1))) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim a1-3) num-func-seek!) ) #t ) -(defmethod enemy-method-78 ((this wasp) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this wasp) (arg0 enemy-knocked-info)) (let ((v1-4 (-> this draw art-group data (-> this enemy-info knocked-land-anim))) (a0-3 (-> this skel root-channel 0)) ) (set! (-> a0-3 frame-group) (the-as art-joint-anim v1-4)) (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim v1-4) frames num-frames) -1))) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim v1-4) num-func-seek!) ) @@ -1469,7 +1469,7 @@ (set! (-> this neck up) (the-as uint 1)) (set! (-> this neck nose) (the-as uint 2)) (set! (-> this neck ear) (the-as uint 0)) - (set! (-> this scale) (get-rand-float-range this 0.9 1.3)) + (set! (-> this scale) (rnd-float-range this 0.9 1.3)) (set! (-> this sound-id) (new-sound-id)) (set! (-> this root dynam gravity y) 327680.0) (set! (-> this root dynam gravity-length) 327680.0) @@ -1480,7 +1480,7 @@ (set! (-> this gun-x-angle) 0.0) (set! (-> this gun-x-angle-final) 0.0) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (set! sv-16 (new 'static 'res-tag)) (let ((v1-28 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) (if (and v1-28 (= (-> sv-16 elt-count) 1)) diff --git a/goal_src/jak2/levels/common/enemy/metalmonk.gc b/goal_src/jak2/levels/common/enemy/metalmonk.gc index b35c150d29..09016ee870 100644 --- a/goal_src/jak2/levels/common/enemy/metalmonk.gc +++ b/goal_src/jak2/levels/common/enemy/metalmonk.gc @@ -360,12 +360,12 @@ (none) ) -(defmethod track-target! ((this metalmonk)) +(defmethod common-post ((this metalmonk)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (set! (-> this old-facing quad) (-> this new-facing quad)) @@ -381,15 +381,15 @@ (('hit 'hit-knocked 'hit-flinch) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (cond @@ -402,7 +402,7 @@ ) ) ) - (zero? (get-rand-int this 3)) + (zero? (rnd-int-count this 3)) (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) (f1-0 32768.0) ) @@ -568,10 +568,10 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) (gp-0 (new 'stack-no-clear 'vector)) ) - (ja :group! (-> self draw art-group data (-> *metalmonk-global-info* notice-anim (get-rand-int self 2)))) + (ja :group! (-> self draw art-group data (-> *metalmonk-global-info* notice-anim (rnd-int-count self 2)))) (ja-no-eval :group! (ja-group) :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) (let ((a1-4 (-> self nav state))) @@ -617,7 +617,7 @@ ) :code (behavior () (talker-spawn-func (-> *talker-speech* 95) *entity-pool* (target-pos 0) (the-as region #f)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (suspend) (until #f (metalmonk-method-181 self 1.2 0.1) @@ -645,10 +645,10 @@ ) ) ) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f - (let ((gp-0 (-> self draw art-group data (-> (&-> *metalmonk-global-info* patrol-anim (get-rand-int self 2)) 0))) - (s5-0 (get-rand-int-range self 1 8)) + (let ((gp-0 (-> self draw art-group data (-> (&-> *metalmonk-global-info* patrol-anim (rnd-int-count self 2)) 0))) + (s5-0 (rnd-int-range self 1 8)) ) (let ((v1-34 (ja-group))) (if (not (and v1-34 (= v1-34 gp-0))) @@ -663,7 +663,7 @@ ) ) ) - (when (zero? (get-rand-int self 2)) + (when (zero? (rnd-int-count self 2)) (let ((v1-58 self)) (set! (-> v1-58 enemy-flags) (the-as enemy-flag (logclear (-> v1-58 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-58 nav callback-info) *nav-enemy-null-callback-info*) @@ -671,8 +671,8 @@ 0 (ja-channel-push! 1 (seconds 0.3)) (let ((gp-1 0)) - (until (not (enemy-method-123 self 0.4)) - (let* ((v1-62 (enemy-method-120 self 3 gp-1)) + (until (not (rnd-go-idle? self 0.4)) + (let* ((v1-62 (rnd-bit self 3 gp-1)) (a1-16 (-> self draw art-group data (-> *metalmonk-global-info* idle-anim v1-62))) ) (set! gp-1 (ash 1 v1-62)) @@ -704,7 +704,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (metalmonk-method-180 self #t) (nav-enemy-method-169 self 6144.0 #f) (let ((v1-6 (-> self nav))) @@ -726,7 +726,7 @@ ) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (metalmonk-method-180 self #f) (nav-enemy-method-168 self) ;; og:preserve-this fix potential use-after-free bug @@ -735,7 +735,7 @@ (set! (-> v1-6 target-speed) (-> self enemy-info run-travel-speed)) )) 0 - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -756,7 +756,7 @@ (ja-no-eval :group! s5-0 :num! (seek!) :frame-num 0.0) ) (until (ja-done? 0) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) (set! gp-0 #t) ) (suspend) @@ -803,9 +803,9 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (ja :group! (-> self draw art-group data (-> *metalmonk-global-info* celebrate-anim (get-rand-int self 2)))) + (ja :group! (-> self draw art-group data (-> *metalmonk-global-info* celebrate-anim (rnd-int-count self 2)))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (ja-no-eval :group! (ja-group) :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -820,7 +820,7 @@ :virtual #t :code (behavior () (nav-enemy-method-166 self) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (suspend) (until #f (metalmonk-method-181 self 1.6 1.5) @@ -849,8 +849,8 @@ ) ) (nav-enemy-method-165 self) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) - (-> self draw art-group data (-> *metalmonk-global-info* patrol-anim (get-rand-int self 2))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) + (-> self draw art-group data (-> *metalmonk-global-info* patrol-anim (rnd-int-count self 2))) (until #f (metalmonk-method-182 self 1.2 0.5) (suspend) @@ -879,7 +879,9 @@ (until #f (let ((gp-0 (new 'stack-no-clear 'vector))) (get-point-at-percent-along-path! (-> self intro-path) gp-0 1.0 'interp) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (let ((v1-4 (process->ppointer self))) (set! (-> a1-1 from) v1-4) @@ -897,19 +899,19 @@ ) ) -(defmethod enemy-method-77 ((this metalmonk) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this metalmonk) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (ja-channel-push! 1 0) (let* ((a2-0 (ash 1 (-> *metalmonk-global-info* prev-yellow-hit))) - (v1-3 (enemy-method-120 this 4 a2-0)) + (v1-3 (rnd-bit this 4 a2-0)) (a1-6 (-> this draw art-group data (-> *metalmonk-global-info* yellow-hit-anim v1-3))) ) (set! (-> *metalmonk-global-info* prev-yellow-hit) v1-3) (let ((a0-13 (-> this skel root-channel 0))) (set! (-> a0-13 frame-group) (the-as art-joint-anim a1-6)) (set! (-> a0-13 param 0) (the float (+ (-> (the-as art-joint-anim a1-6) frames num-frames) -1))) - (set! (-> a0-13 param 1) (-> arg0 0)) + (set! (-> a0-13 param 1) (-> arg0 anim-speed)) (set! (-> a0-13 frame-num) 0.0) (joint-control-channel-group! a0-13 (the-as art-joint-anim a1-6) num-func-seek!) ) @@ -917,7 +919,7 @@ ) (((knocked-type knocked-type-6)) (let* ((a2-2 (ash 1 (-> *metalmonk-global-info* prev-blue-hit))) - (v1-12 (enemy-method-120 this 3 a2-2)) + (v1-12 (rnd-bit this 3 a2-2)) (s5-1 (-> this draw art-group data (-> *metalmonk-global-info* blue-hit-anim v1-12))) ) (set! (-> *metalmonk-global-info* prev-blue-hit) v1-12) @@ -945,7 +947,7 @@ (if (< (vector-dot (the-as vector (metalmonk-method-179 this (new 'stack-no-clear 'vector))) (-> this root transv)) 0.0 ) - (-> this draw art-group data (-> *metalmonk-global-info* knocked-anim (get-rand-int this 2))) + (-> this draw art-group data (-> *metalmonk-global-info* knocked-anim (rnd-int-count this 2))) (-> this draw art-group data 20) ) ) @@ -954,7 +956,7 @@ (let ((a0-38 (-> this skel root-channel 0))) (set! (-> a0-38 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-38 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-38 param 1) (-> arg0 0)) + (set! (-> a0-38 param 1) (-> arg0 anim-speed)) (set! (-> a0-38 frame-num) 0.0) (joint-control-channel-group! a0-38 (the-as art-joint-anim s4-1) num-func-seek!) ) @@ -964,7 +966,7 @@ #t ) -(defmethod enemy-method-78 ((this metalmonk) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this metalmonk) (arg0 enemy-knocked-info)) (cond ((= (-> this incoming knocked-type) (knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -973,7 +975,7 @@ (let ((a0-3 (-> this skel root-channel 0))) (set! (-> a0-3 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -1009,7 +1011,7 @@ (let ((a0-14 (-> this skel root-channel 0))) (set! (-> a0-14 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-14 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-14 param 1) (-> arg0 0)) + (set! (-> a0-14 param 1) (-> arg0 anim-speed)) (set! (-> a0-14 frame-num) 0.0) (joint-control-channel-group! a0-14 (the-as art-joint-anim s4-1) num-func-seek!) ) diff --git a/goal_src/jak2/levels/common/enemy/spyder.gc b/goal_src/jak2/levels/common/enemy/spyder.gc index 36b52556cd..16d92ea176 100644 --- a/goal_src/jak2/levels/common/enemy/spyder.gc +++ b/goal_src/jak2/levels/common/enemy/spyder.gc @@ -272,15 +272,15 @@ (('hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (when (zero? (-> this hit-points)) @@ -427,7 +427,7 @@ ) ;; WARN: Using new Jak 2 rtype-of -(defmethod enemy-method-77 ((this spyder) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this spyder) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (let ((a0-2 (-> this skel root-channel 0))) @@ -435,7 +435,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 15)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 15)) num-func-seek!) ) @@ -447,7 +447,7 @@ (s5-0 (new 'static 'array uint64 3 #x11 #x12 #x13)) (s4-0 (new 'static 'array int32 4 0 0 0 0)) (a2-1 (ash 1 (-> s4-0 0))) - (v1-20 (enemy-method-120 this a1-4 a2-1)) + (v1-20 (rnd-bit this a1-4 a2-1)) (s5-1 (-> this draw art-group data (-> (the-as (pointer int32) (+ (* v1-20 8) (the-as int s5-0)))))) ) (set! (-> s4-0 0) v1-20) @@ -479,7 +479,7 @@ (set! (-> a0-20 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 13)) frames num-frames) -1)) ) - (set! (-> a0-20 param 1) (-> arg0 0)) + (set! (-> a0-20 param 1) (-> arg0 anim-speed)) (set! (-> a0-20 frame-num) 0.0) (joint-control-channel-group! a0-20 (the-as art-joint-anim (-> this draw art-group data 13)) num-func-seek!) ) @@ -496,7 +496,7 @@ ) ) -(defmethod enemy-method-78 ((this spyder) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this spyder) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (cond @@ -659,7 +659,7 @@ (none) ) -(defmethod track-target! ((this spyder)) +(defmethod common-post ((this spyder)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -669,7 +669,7 @@ (update-trans! (-> this sound) (-> this root trans)) (update! (-> this sound)) (spyder-method-182 this) - (let ((t9-6 (method-of-type nav-enemy track-target!))) + (let ((t9-6 (method-of-type nav-enemy common-post))) (t9-6 this) ) (logclear! (-> this status-flags) (spyder-flags spflags-0)) @@ -854,7 +854,7 @@ ) ) (spyder-method-181 self) - (look-at-target! self (enemy-flag death-start)) + (look-at-target! self (enemy-flag look-at-move-dest)) (logclear! (-> self status-flags) (spyder-flags spflags-1)) (when (!= (-> self dest-fade) 128.0) (set! (-> self shock-effect-end) (+ (current-time) (seconds 1))) @@ -869,7 +869,7 @@ ) ) (logclear! (-> self status-flags) (spyder-flags spflags-5)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) ) :trans (behavior () (let ((t9-0 (-> (method-of-type nav-enemy hostile) trans))) @@ -1003,11 +1003,11 @@ (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-4 enemy-flags)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (look-at-target! self (enemy-flag look-at-focus)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ;; og:preserve-this fix potential use-after-free bug (if (-> self nav) (let ((v1-2 (-> self nav))) @@ -1016,7 +1016,7 @@ 0 ) :trans (behavior () - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (if (or (>= 2 (the-as int (-> self focus aware))) (not (get-enemy-target self))) diff --git a/goal_src/jak2/levels/common/entities/gun-buoy.gc b/goal_src/jak2/levels/common/entities/gun-buoy.gc index 48ee53d288..763ed906a5 100644 --- a/goal_src/jak2/levels/common/entities/gun-buoy.gc +++ b/goal_src/jak2/levels/common/entities/gun-buoy.gc @@ -584,7 +584,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (new 'stack-no-clear 'vector) (let* ((gp-0 (handle->process (-> self focus handle))) (a0-6 (if (type? gp-0 process-focusable) @@ -647,7 +647,7 @@ :code (behavior () (sound-play "buoy-guns-in") (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (ja-no-eval :group! gun-buoy-close-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -886,7 +886,7 @@ ) ) -(defmethod track-target! ((this gun-buoy)) +(defmethod common-post ((this gun-buoy)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -953,7 +953,7 @@ (water-control-method-10 (-> this water)) (update-trans! (-> this sound) (-> this root trans)) (update! (-> this sound)) - ((method-of-type nav-enemy track-target!) this) + ((method-of-type nav-enemy common-post) this) 0 (none) ) diff --git a/goal_src/jak2/levels/common/entities/spydroid.gc b/goal_src/jak2/levels/common/entities/spydroid.gc index 3c697d9d56..7798355517 100644 --- a/goal_src/jak2/levels/common/entities/spydroid.gc +++ b/goal_src/jak2/levels/common/entities/spydroid.gc @@ -620,12 +620,12 @@ (set! (-> *spydroid-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod track-target! ((this spydroid)) +(defmethod common-post ((this spydroid)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (when (< (-> this root scale x) 1.0) @@ -886,7 +886,7 @@ :event enemy-event-handler :enter (behavior () (set! (-> self hit-target) #f) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (let ((v1-2 (-> self nav))) (set! (-> v1-2 target-speed) (+ 8192.0 (-> self enemy-info run-travel-speed))) ) @@ -912,7 +912,7 @@ (ja :group! spydroid-attack-jump-ja :num! min) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (nav-enemy-method-168 self) ;; og:preserve-this fix potential use-after-free bug (if (-> self nav) @@ -920,7 +920,7 @@ (set! (-> v1-4 target-speed) (-> self enemy-info run-travel-speed)) )) 0 - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -928,7 +928,7 @@ :trans (behavior () (enemy-method-49 self) nav-state - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) (set! (-> self hit-target) (the-as basic #t)) ) (let ((v1-9 (ja-group))) @@ -1418,7 +1418,7 @@ (add-connection *part-engine* this 6 this 3185 (new 'static 'vector :w 163840.0)) (add-connection *part-engine* this 6 this 3186 (new 'static 'vector :w 163840.0)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) 0 (none) ) diff --git a/goal_src/jak2/levels/drill/drill-turret.gc b/goal_src/jak2/levels/drill/drill-turret.gc index 17060a2195..2146d360a3 100644 --- a/goal_src/jak2/levels/drill/drill-turret.gc +++ b/goal_src/jak2/levels/drill/drill-turret.gc @@ -8,20 +8,16 @@ ;; DECOMP BEGINS (deftype turret (base-turret) - ((hover-battle handle :offset-assert 568) - (hover-formation hover-formation :offset-assert 576) - (use-egg-hud symbol :offset-assert 580) - (hud-egg handle :offset-assert 584) - (use-cgh-hud symbol :offset-assert 592) - (hud-cgh handle :offset-assert 600) - (hud-cgh-event symbol :offset-assert 608) - (egg-timer time-frame :offset-assert 616) - (cgh-timer time-frame :offset-assert 624) + ((hover-battle handle) + (hover-formation hover-formation) + (use-egg-hud symbol) + (hud-egg handle) + (use-cgh-hud symbol) + (hud-cgh handle) + (hud-cgh-event symbol) + (egg-timer time-frame) + (cgh-timer time-frame) ) - :heap-base #x200 - :method-count-assert 49 - :size-assert #x278 - :flag-assert #x3102000278 ) @@ -363,10 +359,9 @@ ) ) ) - (none) ) :exit (behavior () - (let ((t9-1 (-> (the-as (state base-turret) (find-parent-method turret 29)) exit))) + (let ((t9-1 (-> (find-parent-state) exit))) (if t9-1 (t9-1) ) @@ -468,112 +463,112 @@ :virtual #t :enter (behavior () (speech-control-method-12 *speech-control* self (speech-type speech-type-10)) - (let ((t9-2 (-> (the-as (state base-turret) (find-parent-method turret 32)) enter))) + (let ((t9-2 (-> (find-parent-state) enter))) (if t9-2 (t9-2) ) ) - (none) ) ) -(defmethod turret-init! turret ((obj turret) (arg0 entity-actor) (arg1 matrix)) - (set! (-> obj hover-battle) (the-as handle #f)) - (let ((v1-1 (res-lump-value (-> obj entity) 'extra-id uint128 :default (the-as uint128 -1) :time -1000000000.0))) +(defmethod turret-init! ((this turret) (arg0 entity-actor) (arg1 matrix)) + (set! (-> this hover-battle) (the-as handle #f)) + (let ((v1-1 (res-lump-value (-> this entity) 'extra-id uint128 :default (the-as uint128 -1) :time -1000000000.0))) (cond ((zero? v1-1) - (set! (-> obj hover-battle) - (process->handle (hover-manager-spawn obj (-> obj entity) *drill-turret-10-battle*)) + (set! (-> this hover-battle) + (process->handle (hover-manager-spawn this (-> this entity) *drill-turret-10-battle*)) ) - (set! (-> obj use-egg-hud) #t) - (set! (-> obj use-cgh-hud) #f) + (set! (-> this use-egg-hud) #t) + (set! (-> this use-cgh-hud) #f) ) ((= (the-as uint v1-1) 1) - (set! (-> obj hover-battle) - (process->handle (hover-manager-spawn obj (-> obj entity) *drill-turret-11-battle*)) + (set! (-> this hover-battle) + (process->handle (hover-manager-spawn this (-> this entity) *drill-turret-11-battle*)) ) - (set! (-> obj use-egg-hud) #t) - (set! (-> obj use-cgh-hud) #f) + (set! (-> this use-egg-hud) #t) + (set! (-> this use-cgh-hud) #f) ) ((= (the-as uint v1-1) 2) - (set! (-> obj hover-battle) - (process->handle (hover-manager-spawn obj (-> obj entity) *drill-turret-12-battle*)) + (set! (-> this hover-battle) + (process->handle (hover-manager-spawn this (-> this entity) *drill-turret-12-battle*)) ) - (set! (-> obj use-egg-hud) #t) - (set! (-> obj use-cgh-hud) #f) + (set! (-> this use-egg-hud) #t) + (set! (-> this use-cgh-hud) #f) ) ((= (the-as uint v1-1) 3) - (set! (-> obj path-event) *turret-13-path*) - (set! (-> obj hover-battle) - (process->handle (hover-manager-spawn obj (-> obj entity) *drill-turret-13-battle*)) + (set! (-> this path-event) *turret-13-path*) + (set! (-> this hover-battle) + (process->handle (hover-manager-spawn this (-> this entity) *drill-turret-13-battle*)) ) - (set! (-> obj use-egg-hud) #f) - (set! (-> obj use-cgh-hud) #t) + (set! (-> this use-egg-hud) #f) + (set! (-> this use-cgh-hud) #t) ) ((= (the-as uint v1-1) 4) - (set! (-> obj path-event) *turret-14-path*) - (set! (-> obj use-egg-hud) #f) - (set! (-> obj use-cgh-hud) #f) + (set! (-> this path-event) *turret-14-path*) + (set! (-> this use-egg-hud) #f) + (set! (-> this use-cgh-hud) #f) ) (else - (set! (-> obj path-event) *turret-15-path*) - (set! (-> obj use-egg-hud) #f) - (set! (-> obj use-cgh-hud) #f) + (set! (-> this path-event) *turret-15-path*) + (set! (-> this use-egg-hud) #f) + (set! (-> this use-cgh-hud) #f) ) ) ) (let ((t9-5 (method-of-type base-turret turret-init!))) - (t9-5 obj arg0 arg1) + (t9-5 this arg0 arg1) ) - (set! (-> obj hud-egg) (the-as handle #f)) - (set! (-> obj hud-cgh) (the-as handle #f)) - (set! (-> obj hover-formation) (the-as hover-formation (entity-actor-lookup arg0 'formation-actor 0))) - (if (or (name= (-> obj name) "turret-14") (name= (-> obj name) "turret-15")) - (set! (-> obj shot-timeout) (seconds 2.667)) + (set! (-> this hud-egg) (the-as handle #f)) + (set! (-> this hud-cgh) (the-as handle #f)) + (set! (-> this hover-formation) (the-as hover-formation (entity-actor-lookup arg0 'formation-actor 0))) + (if (or (name= (-> this name) "turret-14") (name= (-> this name) "turret-15")) + (set! (-> this shot-timeout) (seconds 2.667)) ) (none) ) -(defmethod base-turret-method-39 turret ((obj turret) (arg0 turret-path-event)) +;; WARN: Return type mismatch object vs none. +(defmethod base-turret-method-39 ((this turret) (arg0 turret-path-event)) (case (-> arg0 event-type) (('trigger-battle) - (set! (-> obj hud-cgh-event) 'force-show) - (send-event (handle->process (-> obj hover-battle)) 'trigger) + (set! (-> this hud-cgh-event) 'force-show) + (send-event (handle->process (-> this hover-battle)) 'trigger) ) (else - ((method-of-type base-turret base-turret-method-39) obj arg0) + ((method-of-type base-turret base-turret-method-39) this arg0) ) ) (none) ) -(defmethod base-turret-method-34 turret ((obj turret) (arg0 process)) - (set! (-> obj hud) +(defmethod base-turret-method-34 ((this turret) (arg0 process)) + (set! (-> this hud) (ppointer->handle (process-spawn hud-drill-turret-health :init hud-init-by-other :to arg0)) ) - (if (-> obj use-egg-hud) - (set! (-> obj hud-egg) (ppointer->handle (process-spawn hud-gruntegg :init hud-init-by-other :to arg0))) + (if (-> this use-egg-hud) + (set! (-> this hud-egg) (ppointer->handle (process-spawn hud-gruntegg :init hud-init-by-other :to arg0))) ) - (when (-> obj use-cgh-hud) - (set! (-> obj hud-cgh) (ppointer->handle (process-spawn hud-crimsonhover :init hud-init-by-other :to arg0))) - (set! (-> obj hud-cgh-event) 'force-hide) + (when (-> this use-cgh-hud) + (set! (-> this hud-cgh) (ppointer->handle (process-spawn hud-crimsonhover :init hud-init-by-other :to arg0))) + (set! (-> this hud-cgh-event) 'force-hide) ) 0 (none) ) -(defmethod base-turret-method-35 turret ((obj turret)) - (if (-> obj use-egg-hud) - (send-event (handle->process (-> obj hud-egg)) 'force-show) +(defmethod base-turret-method-35 ((this turret)) + (if (-> this use-egg-hud) + (send-event (handle->process (-> this hud-egg)) 'force-show) ) - (if (-> obj use-cgh-hud) - (send-event (handle->process (-> obj hud-cgh)) (-> obj hud-cgh-event)) + (if (-> this use-cgh-hud) + (send-event (handle->process (-> this hud-cgh)) (-> this hud-cgh-event)) ) - ((the-as (function base-turret none) (find-parent-method turret 35)) obj) + (call-parent-method this) (none) ) -(defmethod base-turret-method-46 turret ((obj turret) (arg0 process)) +(defmethod base-turret-method-46 ((this turret) (arg0 process)) (if (type? arg0 hover-enemy) arg0 ) diff --git a/goal_src/jak2/levels/drill/ginsu.gc b/goal_src/jak2/levels/drill/ginsu.gc index 2991c61e0e..a592ef8044 100644 --- a/goal_src/jak2/levels/drill/ginsu.gc +++ b/goal_src/jak2/levels/drill/ginsu.gc @@ -323,7 +323,7 @@ (set! (-> s5-0 quad 2) a1-3) (set! (-> s5-0 trans quad) a2-2) ) - (when (logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + (when (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) (vector-negate! (the-as vector (-> s5-0 vector)) (the-as vector (-> s5-0 vector))) (set! (-> s5-0 vector 0 w) 0.0) ) @@ -346,13 +346,13 @@ ) ;; WARN: Return type mismatch symbol vs none. -(defmethod track-target! ((this ginsu)) +(defmethod common-post ((this ginsu)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (ginsu-method-180 this) - (let ((t9-1 (method-of-type nav-enemy track-target!))) + (let ((t9-1 (method-of-type nav-enemy common-post))) (t9-1 this) ) (cond @@ -429,7 +429,7 @@ ) (quaternion->matrix s4-0 (-> this root quat)) (let ((f0-1 (vector-dot s5-0 (the-as vector (-> s4-0 vector))))) - (if (logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) (set! f0-1 (- f0-1)) ) (cond @@ -655,7 +655,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let ((v1-4 (-> self nav))) (set! (-> v1-4 target-speed) 8192.0) @@ -666,8 +666,8 @@ (ja :group! ginsu-idle-ja :num! min) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -682,7 +682,7 @@ ) (go-virtual circling) ) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) (go-virtual circling) ) (if (time-elapsed? (-> self state-time) (seconds 0.75)) @@ -716,7 +716,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (ginsu-method-183 self #t) (set! (-> self root penetrate-using) (penetrate generic-attack lunge)) (enemy-method-49 self) @@ -735,8 +735,8 @@ (ja :group! ginsu-attack-ja :num! min) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -753,7 +753,7 @@ ) (go-virtual circling) ) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) (go-virtual circling) ) (ja :num! (seek!)) @@ -774,7 +774,7 @@ ) ) (logclear! (-> self mask) (process-mask actor-pause)) - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (ja-channel-set! 0) (set! (-> self root scale x) 0.01) (set! (-> self root scale y) 0.01) @@ -782,7 +782,7 @@ ) :exit (behavior () (logior! (-> self mask) (process-mask actor-pause)) - (logior! (-> self enemy-flags) (enemy-flag notice)) + (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) ) :trans (behavior () (let ((t9-0 (-> (method-of-type enemy ambush) trans))) diff --git a/goal_src/jak2/levels/forest/pegasus.gc b/goal_src/jak2/levels/forest/pegasus.gc index f433390ad8..c2d3d00b32 100644 --- a/goal_src/jak2/levels/forest/pegasus.gc +++ b/goal_src/jak2/levels/forest/pegasus.gc @@ -208,15 +208,15 @@ For pegasus, it will call [[enemy::57]] only if the [[pegasus]] has been targett ((zero? (-> this hit-points)) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action proc) (send-event proc 'get-attack-count 1) (kill-prefer-falling this) @@ -688,14 +688,14 @@ The faster it's moving the fast it flaps it's wings, etc ) ) -(defmethod track-target! ((this pegasus)) +(defmethod common-post ((this pegasus)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (track-how-long-aimed-at! this) (pegasus-show-runs) - ((method-of-type enemy track-target!) this) + ((method-of-type enemy common-post) this) (none) ) @@ -1145,7 +1145,7 @@ The faster it's moving the fast it flaps it's wings, etc (if (pegasus-calc-speed 61440.0 122880.0 204800.0 49152.0) (react-to-focus self) ) - (let ((anim-length (get-rand-float-range self 0.8 1.2))) + (let ((anim-length (rnd-float-range self 0.8 1.2))) (ja-channel-push! 1 (seconds 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) :num! (seek! max anim-length) @@ -1248,7 +1248,7 @@ The faster it's moving the fast it flaps it's wings, etc #f ) -(defmethod enemy-method-108 ((this pegasus) (arg0 enemy) (arg1 event-message-block)) +(defmethod enemy-method-108 ((this pegasus) (arg0 process-drawable) (arg1 event-message-block)) 0 ) diff --git a/goal_src/jak2/levels/forest/predator.gc b/goal_src/jak2/levels/forest/predator.gc index 82bec632ac..e5e59abb09 100644 --- a/goal_src/jak2/levels/forest/predator.gc +++ b/goal_src/jak2/levels/forest/predator.gc @@ -425,7 +425,7 @@ ) ) -(defmethod enemy-method-77 ((this predator) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this predator) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (case (-> this incoming knocked-type) @@ -436,7 +436,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 18)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 18)) num-func-seek!) ) @@ -448,7 +448,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 14)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 14)) num-func-seek!) ) @@ -460,7 +460,7 @@ (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (ja-channel-push! 1 (seconds 0.01)) - (let ((v1-32 (get-rand-int this 2))) + (let ((v1-32 (rnd-int-count this 2))) (cond ((zero? v1-32) (let ((a0-10 (-> this skel root-channel 0))) @@ -468,7 +468,7 @@ (set! (-> a0-10 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 21)) frames num-frames) -1)) ) - (set! (-> a0-10 param 1) (-> arg0 0)) + (set! (-> a0-10 param 1) (-> arg0 anim-speed)) (set! (-> a0-10 frame-num) 0.0) (joint-control-channel-group! a0-10 (the-as art-joint-anim (-> this draw art-group data 21)) num-func-seek!) ) @@ -479,7 +479,7 @@ (set! (-> a0-12 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 22)) frames num-frames) -1)) ) - (set! (-> a0-12 param 1) (-> arg0 0)) + (set! (-> a0-12 param 1) (-> arg0 anim-speed)) (set! (-> a0-12 frame-num) 0.0) (joint-control-channel-group! a0-12 (the-as art-joint-anim (-> this draw art-group data 22)) num-func-seek!) ) @@ -494,7 +494,7 @@ (set! (-> a0-15 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 18)) frames num-frames) -1)) ) - (set! (-> a0-15 param 1) (-> arg0 0)) + (set! (-> a0-15 param 1) (-> arg0 anim-speed)) (set! (-> a0-15 frame-num) 0.0) (joint-control-channel-group! a0-15 (the-as art-joint-anim (-> this draw art-group data 18)) num-func-seek!) ) @@ -506,7 +506,7 @@ (set! (-> a0-17 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 12)) frames num-frames) -1)) ) - (set! (-> a0-17 param 1) (-> arg0 0)) + (set! (-> a0-17 param 1) (-> arg0 anim-speed)) (set! (-> a0-17 frame-num) 0.0) (joint-control-channel-group! a0-17 (the-as art-joint-anim (-> this draw art-group data 12)) num-func-seek!) ) @@ -517,7 +517,7 @@ ) ) -(defmethod enemy-method-78 ((this predator) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this predator) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (case (-> this incoming knocked-type) @@ -528,7 +528,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 20)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 20)) num-func-seek!) ) @@ -540,7 +540,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 15)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 15)) num-func-seek!) ) @@ -557,7 +557,7 @@ (set! (-> a0-8 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 23)) frames num-frames) -1)) ) - (set! (-> a0-8 param 1) (-> arg0 0)) + (set! (-> a0-8 param 1) (-> arg0 anim-speed)) (set! (-> a0-8 frame-num) 0.0) (joint-control-channel-group! a0-8 (the-as art-joint-anim (-> this draw art-group data 23)) num-func-seek!) ) @@ -569,7 +569,7 @@ (set! (-> a0-11 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 19)) frames num-frames) -1)) ) - (set! (-> a0-11 param 1) (-> arg0 0)) + (set! (-> a0-11 param 1) (-> arg0 anim-speed)) (set! (-> a0-11 frame-num) 0.0) (joint-control-channel-group! a0-11 (the-as art-joint-anim (-> this draw art-group data 19)) num-func-seek!) ) @@ -581,7 +581,7 @@ (set! (-> a0-13 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 13)) frames num-frames) -1)) ) - (set! (-> a0-13 param 1) (-> arg0 0)) + (set! (-> a0-13 param 1) (-> arg0 anim-speed)) (set! (-> a0-13 frame-num) 0.0) (joint-control-channel-group! a0-13 (the-as art-joint-anim (-> this draw art-group data 13)) num-func-seek!) ) @@ -868,7 +868,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! predator-idle-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -915,7 +915,7 @@ ) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -972,7 +972,7 @@ :event enemy-event-handler :enter (behavior () (set-dangerous! self #t) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-6 *game-info*) (a0-3 (+ (-> v1-6 attack-id) 1)) @@ -987,7 +987,7 @@ ) :exit (behavior () (set-dangerous! self #f) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1008,7 +1008,7 @@ (suspend) (ja :num! (seek!)) ) - (if (zero? (get-rand-int self 3)) + (if (zero? (rnd-int-count self 3)) (sound-play "pred-talk") ) (go-virtual hostile) @@ -1159,7 +1159,7 @@ (set! (-> self next-change) (the-as uint (+ (current-time) (the int (* 300.0 (rand-vu-float-range 4.0 8.0))))) ) - (if (zero? (get-rand-int self 3)) + (if (zero? (rnd-int-count self 3)) (sound-play "pred-talk") ) ) @@ -1308,12 +1308,12 @@ #f ) -(defmethod track-target! ((this predator)) +(defmethod common-post ((this predator)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (predator-method-183 this) @@ -1466,7 +1466,7 @@ This commonly includes things such as: (t9-0 this arg0) ) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) 0 (none) ) @@ -1508,7 +1508,7 @@ This commonly includes things such as: (set! (-> this sound) (new 'process 'ambient-sound (static-sound-spec "pred-hum" :fo-min 2 :fo-max 30) (-> this root trans)) ) - (logior! (-> this enemy-flags) (enemy-flag trackable-backup enable-on-hostile)) + (logior! (-> this enemy-flags) (enemy-flag check-water check-water-backup)) (add-icon! *minimap* this (the-as uint 16) (the-as int #f) (the-as vector #t) 0) 0 (none) diff --git a/goal_src/jak2/levels/fortress/fort-turret.gc b/goal_src/jak2/levels/fortress/fort-turret.gc index 4052b881e2..f38ed07eae 100644 --- a/goal_src/jak2/levels/fortress/fort-turret.gc +++ b/goal_src/jak2/levels/fortress/fort-turret.gc @@ -503,12 +503,12 @@ (set! (-> *fort-turret-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod track-target! ((this fort-turret)) +(defmethod common-post ((this fort-turret)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type enemy track-target!))) + (let ((t9-0 (method-of-type enemy common-post))) (t9-0 this) ) (let ((s5-0 (-> this root))) @@ -708,7 +708,7 @@ (set! (-> self flash-state) #f) ) :trans (behavior () - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (when (time-elapsed? (-> self state-time) (-> self reaction-time)) @@ -789,7 +789,7 @@ (set-time! (-> self state-time)) ) :trans (behavior () - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (when (time-elapsed? (-> self state-time) (-> self reaction-time)) @@ -827,7 +827,7 @@ (ja :group! fort-turret-idle-ja) ) :trans (behavior () - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (when (time-elapsed? (-> self state-time) (-> self reaction-time)) @@ -892,7 +892,7 @@ (defstate die (fort-turret) :virtual #t :enter (behavior () - (dispose! self) + (dying self) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -936,7 +936,7 @@ (cleanup-for-death self) ) :post (behavior () - (track-target! self) + (common-post self) ) ) @@ -1034,7 +1034,7 @@ (set! (-> this invincible) #t) ) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (set! (-> this part) (create-launch-control (-> *part-group-id-table* 685) this)) (set! (-> this gun-tilt-jm) (new 'process 'joint-mod (joint-mod-mode joint-set*) this 4)) (set! (-> this gun-shadow-jm) (the-as joint-mod (new 'process 'joint-mod-set-local this 10 #f #f #t))) diff --git a/goal_src/jak2/levels/mountain/rhino.gc b/goal_src/jak2/levels/mountain/rhino.gc index 92d02779b0..cf504a63ff 100644 --- a/goal_src/jak2/levels/mountain/rhino.gc +++ b/goal_src/jak2/levels/mountain/rhino.gc @@ -134,7 +134,7 @@ charge ) (:methods - (rhino-method-182 (_type_ process event-message-block) symbol) + (hit-stomach? (_type_ process event-message-block) symbol) ) ) @@ -320,7 +320,7 @@ (set! (-> *rhino-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod rhino-method-182 ((this rhino) (arg0 process) (arg1 event-message-block)) +(defmethod hit-stomach? ((this rhino) (arg0 process) (arg1 event-message-block)) (let* ((gp-0 (-> arg1 param 0)) (s5-0 arg0) (s2-0 (if (type? s5-0 process-drawable) @@ -359,7 +359,7 @@ (let ((t9-0 (method-of-type nav-enemy enemy-method-58))) (t9-0 this arg0 arg1) ) - (if (rhino-method-182 this arg0 arg1) + (if (hit-stomach? this arg0 arg1) 'hit 'hit-flinch ) @@ -573,7 +573,7 @@ (t9-2) ) ) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) ) :exit (behavior () (local-vars (v0-1 enemy-flag)) @@ -583,9 +583,9 @@ ) ) (let ((v1-4 (-> self enemy-flags))) - (if (logtest? v1-4 (enemy-flag checking-water)) - (set! v0-1 (logior v1-4 (enemy-flag enable-on-active))) - (set! v0-1 (logclear v1-4 (enemy-flag enable-on-active))) + (if (logtest? v1-4 (enemy-flag vulnerable-backup)) + (set! v0-1 (logior v1-4 (enemy-flag vulnerable))) + (set! v0-1 (logclear v1-4 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v0-1) @@ -617,14 +617,14 @@ :virtual #t :enter (behavior () (remove-setting! 'sound-mode) - (dispose! self) + (dying self) (set! (-> self hit-points) 0) 0 ) :code (behavior () (set! (-> self smush-target) (the-as smush-control #t)) (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) (gp-0 #t) ) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info die-anim)) @@ -654,7 +654,7 @@ :code (behavior () (local-vars (v1-67 enemy-flag) (v1-75 enemy-flag)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info hit-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -677,29 +677,29 @@ ) ) (ja-channel-push! 1 (seconds 0.075)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-66 (-> self enemy-flags))) - (if (logtest? v1-66 (enemy-flag checking-water)) - (set! v1-67 (logior v1-66 (enemy-flag enable-on-active))) - (set! v1-67 (logclear v1-66 (enemy-flag enable-on-active))) + (if (logtest? v1-66 (enemy-flag vulnerable-backup)) + (set! v1-67 (logior v1-66 (enemy-flag vulnerable))) + (set! v1-67 (logclear v1-66 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-67) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-74 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-74) - (set! v1-75 (logior (enemy-flag check-water-backup) v1-74)) - (set! v1-75 (logclear v1-74 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-74) + (set! v1-75 (logior (enemy-flag trackable) v1-74)) + (set! v1-75 (logclear v1-74 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-75) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (go-hostile self) ) @@ -708,21 +708,21 @@ (defmethod damage-amount-from-attack ((this rhino) (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]]" (-> arg1 param 1) - (let ((f30-0 (the float (penetrate-using->damage (the-as penetrate (-> this incoming penetrate-using)))))) + (let ((f30-0 (the float (penetrate-using->damage (-> this incoming penetrate-using))))) (cond - ((rhino-method-182 this arg0 arg1) + ((hit-stomach? this arg0 arg1) (set! (-> this stomach-touched-once?) #t) (the int (* 4.0 f30-0)) ) - ((logtest? #xc0000 (-> this incoming penetrate-using)) - (if (and (logtest? #x40000 (-> this incoming penetrate-using)) - (logtest? #x80000 (-> this incoming penetrate-using)) + ((logtest? (penetrate dark-bomb dark-giant) (-> this incoming penetrate-using)) + (if (and (logtest? (penetrate dark-bomb) (-> this incoming penetrate-using)) + (logtest? (penetrate dark-giant) (-> this incoming penetrate-using)) ) #x420c0000 (the int (* 1.8 f30-0)) ) ) - ((logtest? #x20000 (-> this incoming penetrate-using)) + ((logtest? (penetrate dark-punch) (-> this incoming penetrate-using)) (the int (* 2.0 f30-0)) ) (else @@ -869,7 +869,7 @@ (set! (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 1 prim-core collide-with) (collide-spec) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1049,7 +1049,7 @@ (set! (-> self charge-straight) #f) (nav-enemy-method-166 self) (set-time! (-> self state-time)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) ) :trans (behavior () (let ((t9-0 (-> (method-of-type nav-enemy hostile) trans))) @@ -1138,7 +1138,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -1163,7 +1163,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-4 *game-info*) (a0-2 (+ (-> v1-4 attack-id) 1)) @@ -1190,8 +1190,8 @@ 0 ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1204,7 +1204,7 @@ (ja-channel-push! 1 (seconds 0.05)) (ja-no-eval :group! rhino-attack-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) (set! gp-0 #t) ) (suspend) @@ -1504,8 +1504,8 @@ (ja-channel-push! 1 (seconds 0.1)) ) ) - (let ((s5-0 (get-rand-int self 8)) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((s5-0 (rnd-int-count self 8)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (while (nonzero? s5-0) (+! s5-0 -1) @@ -1533,7 +1533,7 @@ (ja-channel-push! 1 (seconds 0.1)) ) ) - (let ((f30-2 (get-rand-float-range self 0.9 1.1))) + (let ((f30-2 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info victory-anim)) :num! (seek! max f30-2) :frame-num 0.0 @@ -1696,7 +1696,7 @@ (set-gravity-length (-> this root dynam) 573440.0) (logior! (-> this nav flags) (nav-control-flag momentum-ignore-heading)) (logior! (-> this focus-status) (focus-status dangerous)) - (logior! (-> this enemy-flags) (enemy-flag check-water)) + (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) 0 (none) ) diff --git a/goal_src/jak2/levels/nest/boss/metalkor-extras.gc b/goal_src/jak2/levels/nest/boss/metalkor-extras.gc index 3b1a6ae143..935d11e7e8 100644 --- a/goal_src/jak2/levels/nest/boss/metalkor-extras.gc +++ b/goal_src/jak2/levels/nest/boss/metalkor-extras.gc @@ -1496,12 +1496,12 @@ (none) ) -(defmethod dispose! ((this metalkor-flitter)) +(defmethod dying ((this metalkor-flitter)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (with-pp - (when (not (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags))) + (when (not (logtest? (enemy-flag called-dying) (-> this enemy-flags))) (when (and (>= (-> this enemy-info gem-joint) 0) - (not (logtest? (enemy-flag cam-attack-mode) (-> this enemy-flags))) + (not (logtest? (enemy-flag spawn-gem) (-> this enemy-flags))) (let ((a1-0 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-0 from) (process->ppointer pp)) (set! (-> a1-0 num-params) 0) @@ -1512,7 +1512,7 @@ ) ) ) - (logior! (-> this enemy-flags) (enemy-flag cam-attack-mode)) + (logior! (-> this enemy-flags) (enemy-flag spawn-gem)) (remove-from-process *part-engine* this) (setup-masks (-> this draw) @@ -1536,17 +1536,17 @@ ) ) ) - ((method-of-type flitter dispose!) this) + ((method-of-type flitter dying) this) (none) ) ) -(defmethod dispose! ((this metalkor-wasp)) +(defmethod dying ((this metalkor-wasp)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (with-pp - (when (not (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags))) + (when (not (logtest? (enemy-flag called-dying) (-> this enemy-flags))) (when (and (>= (-> this enemy-info gem-joint) 0) - (not (logtest? (enemy-flag cam-attack-mode) (-> this enemy-flags))) + (not (logtest? (enemy-flag spawn-gem) (-> this enemy-flags))) (let ((a1-0 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-0 from) (process->ppointer pp)) (set! (-> a1-0 num-params) 0) @@ -1557,7 +1557,7 @@ ) ) ) - (logior! (-> this enemy-flags) (enemy-flag cam-attack-mode)) + (logior! (-> this enemy-flags) (enemy-flag spawn-gem)) (remove-from-process *part-engine* this) (setup-masks (-> this draw) @@ -1581,7 +1581,7 @@ ) ) ) - ((method-of-type wasp dispose!) this) + ((method-of-type wasp dying) this) (none) ) ) @@ -2160,10 +2160,7 @@ This commonly includes things such as: (set! sv-400 (the-as symbol #f)) (set! sv-432 *launch-matrix*) (set! sv-416 (-> sv-432 trans)) - (let ((v1-27 - (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node metalkor-explode-lod0-jg head)) quad) - ) - ) + (let ((v1-27 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node metalkor-explode-lod0-jg head)) quad))) (set! (-> sv-416 quad) v1-27) ) ((the-as (function object object object object object object object object none) s5-0) diff --git a/goal_src/jak2/levels/nest/boss/metalkor-setup.gc b/goal_src/jak2/levels/nest/boss/metalkor-setup.gc index 3c9bf74040..331f4222a7 100644 --- a/goal_src/jak2/levels/nest/boss/metalkor-setup.gc +++ b/goal_src/jak2/levels/nest/boss/metalkor-setup.gc @@ -1563,11 +1563,9 @@ This commonly includes things such as: (let ((v1-48 (-> v1-47 0))) (when (>= (-> v1-48 length) 1) (let ((s5-2 (-> v1-48 data 0 actor))) - (let ((a0-52 (search-process-tree - *active-pool* - (lambda ((arg0 gem-tracker)) (= (-> arg0 type) flitter-gem-tracker) (none)) - ) - ) + (let ((a0-52 + (search-process-tree *active-pool* (lambda ((arg0 gem-tracker)) (= (-> arg0 type) flitter-gem-tracker))) + ) ) (if a0-52 (set! (-> this flitter-gem-tracker) (process->handle a0-52)) @@ -1578,9 +1576,7 @@ This commonly includes things such as: ) ) ) - (let ((a0-63 - (search-process-tree *active-pool* (lambda ((arg0 gem-tracker)) (= (-> arg0 type) wasp-gem-tracker) (none))) - ) + (let ((a0-63 (search-process-tree *active-pool* (lambda ((arg0 gem-tracker)) (= (-> arg0 type) wasp-gem-tracker)))) ) (if a0-63 (set! (-> this wasp-gem-tracker) (process->handle a0-63)) diff --git a/goal_src/jak2/levels/nest/boss/metalkor-states.gc b/goal_src/jak2/levels/nest/boss/metalkor-states.gc index 02646a5969..a0dfb8616e 100644 --- a/goal_src/jak2/levels/nest/boss/metalkor-states.gc +++ b/goal_src/jak2/levels/nest/boss/metalkor-states.gc @@ -523,19 +523,22 @@ (none) ) -;; WARN: Return type mismatch process vs none. +;; WARN: Return type mismatch process vs gem-tracker. +;; WARN: disable def twice: 9. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +;; WARN: disable def twice: 26. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. (defbehavior metalkor-get-gem-tracker metalkor ((arg0 process-focusable)) - (cond - ((type? arg0 metalkor-wasp) - (handle->process (-> self wasp-gem-tracker)) - ) - ((type? arg0 metalkor-flitter) - (handle->process (-> self flitter-gem-tracker)) - ) - (else - ) - ) - (none) + (the-as gem-tracker (cond + ((type? arg0 metalkor-wasp) + (handle->process (-> self wasp-gem-tracker)) + ) + ((type? arg0 metalkor-flitter) + (handle->process (-> self flitter-gem-tracker)) + ) + (else + (the-as process #f) + ) + ) + ) ) (defbehavior metalkor-handler metalkor ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) @@ -600,7 +603,7 @@ (set! (-> s4-0 param 3) (-> arg3 param 3)) (set! (-> s4-0 param 4) (-> arg3 param 4)) (set! (-> s4-0 param 5) (-> arg3 param 5)) - (send-event-function (the-as process-tree (metalkor-get-gem-tracker (the-as process-focusable arg0))) s4-0) + (send-event-function (metalkor-get-gem-tracker (the-as process-focusable arg0)) s4-0) ) ) (('setup-flitter-gem) diff --git a/goal_src/jak2/levels/nest/flying-spider.gc b/goal_src/jak2/levels/nest/flying-spider.gc index a329e89255..e590ee2fe6 100644 --- a/goal_src/jak2/levels/nest/flying-spider.gc +++ b/goal_src/jak2/levels/nest/flying-spider.gc @@ -174,16 +174,16 @@ (defstate ambush (flying-spider) :virtual #t :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) ) ) ) - (logclear! (-> self enemy-flags) (enemy-flag lock-focus death-start)) - (set! (-> self path-du) (get-rand-float-range self 0.2 0.5)) + (logclear! (-> self enemy-flags) (enemy-flag look-at-focus look-at-move-dest)) + (set! (-> self path-du) (rnd-float-range self 0.2 0.5)) (set-vector! (-> self root scale) 0.0 0.0 0.0 0.0) ) :trans (behavior () @@ -253,7 +253,7 @@ ) :post (behavior () (let ((a1-0 (new 'stack-no-clear 'collide-query))) - (enemy-method-125 self a1-0 (-> self root root-prim prim-core collide-with) 8192.0 81920.0 1024.0) + (ground-pat-set! self a1-0 (-> self root root-prim prim-core collide-with) 8192.0 81920.0 1024.0) ) (flying-spider-method-182 self (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) (nav-enemy-falling-post) @@ -497,14 +497,14 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (dispose! self) + (dying self) (set-time! (-> self state-time)) (set! (-> self hit-points) 0) (enemy-method-103 self) ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info die-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -535,15 +535,15 @@ (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (cond @@ -556,7 +556,7 @@ ) ) ) - (zero? (get-rand-int this 3)) + (zero? (rnd-int-count this 3)) (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) (f1-0 32768.0) ) @@ -595,17 +595,17 @@ ) ) -(defmethod track-target! ((this flying-spider)) +(defmethod common-post ((this flying-spider)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - ((method-of-type nav-enemy track-target!) this) + ((method-of-type nav-enemy common-post) this) (none) ) ;; WARN: Return type mismatch symbol vs pat-surface. -(defmethod enemy-method-125 ((this flying-spider) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) +(defmethod ground-pat-set! ((this flying-spider) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) (the-as pat-surface (when (find-ground (-> this root) arg0 arg1 arg2 arg3 arg4) diff --git a/goal_src/jak2/levels/nest/mammoth.gc b/goal_src/jak2/levels/nest/mammoth.gc index 5af7829dca..fdb1e0bb3e 100644 --- a/goal_src/jak2/levels/nest/mammoth.gc +++ b/goal_src/jak2/levels/nest/mammoth.gc @@ -450,7 +450,7 @@ (until #f (mammoth-walk-check-end) (set-nav-destination) - (let ((v1-20 (if (rng-hit? self 0.5) + (let ((v1-20 (if (rnd-percent? self 0.5) 6 7 ) @@ -507,9 +507,9 @@ :trans (behavior () (when (and (not (time-elapsed? (-> self lightning-timer) (seconds 3))) (< (-> self spawn-timer) (current-time))) (let ((s5-0 *mammoth-lightning-joint-tbl*)) - (mammoth-method-185 self (-> self root trans) (-> s5-0 (get-rand-int self (-> s5-0 length)))) + (mammoth-method-185 self (-> self root trans) (-> s5-0 (rnd-int-count self (-> s5-0 length)))) ) - (set! (-> self spawn-timer) (+ (current-time) (the int (* 300.0 (get-rand-float-range self 0.0 0.1))))) + (set! (-> self spawn-timer) (+ (current-time) (the int (* 300.0 (rnd-float-range self 0.0 0.1))))) ) ) :code (behavior () @@ -688,15 +688,15 @@ (('hit) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) ) @@ -791,7 +791,7 @@ ) ;; WARN: Return type mismatch symbol vs pat-surface. -(defmethod enemy-method-125 ((this mammoth) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) +(defmethod ground-pat-set! ((this mammoth) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) (the-as pat-surface (when (find-ground (-> this root) arg0 arg1 arg2 arg3 arg4) @@ -1331,13 +1331,13 @@ ) ) -(defmethod track-target! ((this mammoth)) +(defmethod common-post ((this mammoth)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (local-vars (sv-752 lightning-spec) (sv-768 int) (sv-784 symbol) (sv-800 mammoth)) - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (mammoth-update-ik) @@ -1448,7 +1448,7 @@ (set! sv-768 600) (set! sv-784 (the-as symbol #f)) (set! sv-800 this) - (let ((t2-0 (-> (the-as (pointer int32) (&+ s4-2 (* (get-rand-int this s3-2) 4))))) + (let ((t2-0 (-> (the-as (pointer int32) (&+ s4-2 (* (rnd-int-count this s3-2) 4))))) (t3-0 6) ) ((the-as (function object object object object object object object object none) s5-3) @@ -1468,7 +1468,7 @@ ) ) (set! (-> this lightning-attack-timer) - (+ (current-time) (the int (* 300.0 (get-rand-float-range this 0.067 0.1)))) + (+ (current-time) (the int (* 300.0 (rnd-float-range this 0.067 0.1)))) ) ) ) @@ -1679,7 +1679,7 @@ (set! (-> this lightning-timer) 0) (set! (-> this lightning-attack-timer) 0) (set-time! (-> this feet-ik-init-timer)) - (logclear! (-> this enemy-flags) (enemy-flag check-water-backup)) + (logclear! (-> this enemy-flags) (enemy-flag trackable)) 0 (none) ) diff --git a/goal_src/jak2/levels/nest/mantis.gc b/goal_src/jak2/levels/nest/mantis.gc index ffa71b3671..135935ce91 100644 --- a/goal_src/jak2/levels/nest/mantis.gc +++ b/goal_src/jak2/levels/nest/mantis.gc @@ -411,7 +411,7 @@ :code (behavior () (ja-channel-push! 1 (seconds 0.2)) (until #f - (let ((gp-0 (get-rand-int-range self 3 5))) + (let ((gp-0 (rnd-int-range self 3 5))) (dotimes (s5-0 gp-0) (ja-no-eval :group! mantis-idle0-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) @@ -425,7 +425,7 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-1 (get-rand-int self 3))) + (let ((gp-1 (rnd-int-count self 3))) (dotimes (s5-1 gp-1) (ja-no-eval :group! mantis-idle1-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) @@ -448,8 +448,8 @@ (defstate ambush (mantis) :virtual #t :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -530,12 +530,12 @@ ) (logior! (-> self draw status) (draw-control-status no-draw)) (let ((gp-2 (current-time))) - (until (time-elapsed? gp-2 (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) + (until (time-elapsed? gp-2 (the int (* 300.0 (rnd-float-range self 0.0 0.6)))) (suspend) ) ) (logclear! (-> self draw status) (draw-control-status no-draw)) - (if (rng-hit? self 0.5) + (if (rnd-percent? self 0.5) (go-virtual ambush-jumping) (go-virtual ambush-crawling) ) @@ -546,7 +546,7 @@ :virtual #t :event enemy-event-handler :code (behavior () - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self root trans y) (-> self base-height)) (ja-channel-push! 1 0) (ja-no-eval :group! mantis-ground-crawl-out-ja :num! (seek!) :frame-num 0.0) @@ -579,7 +579,7 @@ (set! (-> v1-3 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-3 enemy-flags)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set-time! (-> self state-time)) (set! (-> self root trans y) (+ -18841.6 (-> self base-height))) (let ((gp-0 (-> self root))) @@ -588,7 +588,7 @@ (set! (-> v1-11 y) 0.0) ) (vector-reset! (-> gp-0 transv)) - (set! (-> gp-0 transv y) (* 4096.0 (get-rand-float-range self 28.0 32.0))) + (set! (-> gp-0 transv y) (* 4096.0 (rnd-float-range self 28.0 32.0))) ) ) :code (behavior () @@ -769,7 +769,7 @@ (set! (-> v1-0 nav callback-info) *nav-enemy-null-callback-info*) ) 0 - (dotimes (gp-0 (get-rand-int-range self 1 2)) + (dotimes (gp-0 (rnd-int-range self 1 2)) (ja-no-eval :group! mantis-idle0-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -788,7 +788,7 @@ (s2-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) ) - (let ((f30-1 (* 4096.0 (get-rand-float-range self 8.0 12.0))) + (let ((f30-1 (* 4096.0 (rnd-float-range self 8.0 12.0))) (s1-0 (cloest-point-on-mesh (-> self nav) s5-0 s5-0 (the-as nav-poly #f))) ) (vector-normalize-copy! s2-0 s4-1 1.0) @@ -845,7 +845,7 @@ (set! (-> v1-73 nav callback-info) (-> v1-73 enemy-info callback-info)) ) 0 - (dotimes (gp-2 (get-rand-int-range self 3 5)) + (dotimes (gp-2 (rnd-int-range self 3 5)) (ja-no-eval :group! mantis-run0-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -881,7 +881,7 @@ (set-time! (-> self attack-timer)) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -897,7 +897,7 @@ (suspend) (ja :num! (seek!)) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -933,7 +933,7 @@ (set-time! (-> self attack-timer)) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -977,7 +977,7 @@ (suspend) (ja :num! (seek!)) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1105,8 +1105,8 @@ :event enemy-event-handler :enter (behavior () (set-time! (-> self state-time)) - (look-at-target! self (enemy-flag lock-focus)) - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (look-at-target! self (enemy-flag look-at-focus)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (let ((v1-6 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-6 enemy-flags))) (set! (-> v1-6 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-6 enemy-flags)))) @@ -1172,7 +1172,7 @@ ) ) ) - (dotimes (gp-1 (get-rand-int-range self 2 4)) + (dotimes (gp-1 (rnd-int-range self 2 4)) (ja-no-eval :group! mantis-idle0-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -1206,15 +1206,15 @@ (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (cond @@ -1227,7 +1227,7 @@ ) ) ) - (zero? (get-rand-int this 3)) + (zero? (rnd-int-count this 3)) (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) (f1-0 32768.0) ) @@ -1258,7 +1258,7 @@ ) ) -(defmethod enemy-method-77 ((this mantis) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this mantis) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (ja-channel-push! 1 (seconds 0.02)) @@ -1267,7 +1267,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 27)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 27)) num-func-seek!) ) @@ -1280,7 +1280,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 10)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 10)) num-func-seek!) ) @@ -1289,7 +1289,7 @@ ) ) -(defmethod enemy-method-78 ((this mantis) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this mantis) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (ja-channel-push! 1 (seconds 0.1)) @@ -1298,7 +1298,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 26)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 26)) num-func-seek!) ) @@ -1312,7 +1312,7 @@ (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 28)) frames num-frames) -1)) ) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim (-> this draw art-group data 28)) num-func-seek!) ) @@ -1325,7 +1325,7 @@ (set! (-> a0-6 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 11)) frames num-frames) -1)) ) - (set! (-> a0-6 param 1) (-> arg0 0)) + (set! (-> a0-6 param 1) (-> arg0 anim-speed)) (set! (-> a0-6 frame-num) 0.0) (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> this draw art-group data 11)) num-func-seek!) ) @@ -1335,7 +1335,7 @@ ) ;; WARN: Return type mismatch symbol vs pat-surface. -(defmethod enemy-method-125 ((this mantis) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) +(defmethod ground-pat-set! ((this mantis) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) (the-as pat-surface (when (find-ground (-> this root) arg0 arg1 arg2 arg3 arg4) @@ -1435,13 +1435,13 @@ ) ;; WARN: Return type mismatch vector vs none. -(defmethod track-target! ((this mantis)) +(defmethod common-post ((this mantis)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (local-vars (s5-0 vector)) - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (logclear! (-> this flags) (mantis-flag tracked)) @@ -1586,7 +1586,9 @@ (set! (-> s5-0 start-anim) (the-as uint 12)) (set! (-> s5-0 air-anim) (the-as uint 13)) (set! (-> s5-0 land-anim) (the-as uint 0)) - (set! (-> this enemy-flags) (the-as enemy-flag (logclear (-> this enemy-flags) (enemy-flag vulnerable)))) + (set! (-> this enemy-flags) + (the-as enemy-flag (logclear (-> this enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event this 'jump 0 (-> s5-0 destination)) ) ) @@ -1598,17 +1600,17 @@ (let ((s5-0 (-> this jump))) (vector-length arg1) (vector-normalize! arg1 1.0) - (vector-rotate-y! arg1 arg1 (* 182.04445 (get-rand-float-range this -45.0 45.0))) - (let ((a2-5 - (vector-normalize-copy! (new 'stack-no-clear 'vector) arg1 (* 4096.0 (get-rand-float-range this -4.0 -6.0))) - ) + (vector-rotate-y! arg1 arg1 (* 182.04445 (rnd-float-range this -45.0 45.0))) + (let ((a2-5 (vector-normalize-copy! (new 'stack-no-clear 'vector) arg1 (* 4096.0 (rnd-float-range this -4.0 -6.0)))) ) (when (mantis-method-189 this (-> s5-0 destination) a2-5) (set! (-> s5-0 direction) (the-as uint 1)) (set! (-> s5-0 start-anim) (the-as uint 14)) (set! (-> s5-0 air-anim) (the-as uint 15)) (set! (-> s5-0 land-anim) (the-as uint 16)) - (set! (-> this enemy-flags) (the-as enemy-flag (logclear (-> this enemy-flags) (enemy-flag vulnerable)))) + (set! (-> this enemy-flags) + (the-as enemy-flag (logclear (-> this enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event this 'jump 0 (-> s5-0 destination)) ) ) @@ -1620,9 +1622,9 @@ (let ((s5-0 (-> this jump))) (vector-length arg1) (vector-normalize! arg1 1.0) - (vector-rotate-y! arg1 arg1 (* 182.04445 (get-rand-float-range this -45.0 45.0))) + (vector-rotate-y! arg1 arg1 (* 182.04445 (rnd-float-range this -45.0 45.0))) (let ((a2-5 - (vector-normalize-copy! (new 'stack-no-clear 'vector) arg1 (* 4096.0 (get-rand-float-range this -15.0 -22.0))) + (vector-normalize-copy! (new 'stack-no-clear 'vector) arg1 (* 4096.0 (rnd-float-range this -15.0 -22.0))) ) ) (when (mantis-method-189 this (-> s5-0 destination) a2-5) @@ -1630,7 +1632,9 @@ (set! (-> s5-0 start-anim) (the-as uint 20)) (set! (-> s5-0 air-anim) (the-as uint 21)) (set! (-> s5-0 land-anim) (the-as uint 22)) - (set! (-> this enemy-flags) (the-as enemy-flag (logclear (-> this enemy-flags) (enemy-flag vulnerable)))) + (set! (-> this enemy-flags) + (the-as enemy-flag (logclear (-> this enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event this 'jump 0 (-> s5-0 destination)) ) ) @@ -1737,14 +1741,13 @@ ) ;; WARN: Return type mismatch quaternion vs none. -(defmethod enemy-method-92 ((this mantis) (arg0 int) (arg1 nav-poly)) - "TODO - nav-poly is a guess -@abstract" +(defmethod enemy-method-92 ((this mantis) (arg0 int) (arg1 enemy-jump-info)) + "@abstract" (let ((v1-0 arg0)) (when (or (zero? v1-0) (= v1-0 1) (= v1-0 2) (= v1-0 3)) (let ((a0-4 this)) (when (logtest? (enemy-flag enemy-flag37) (-> a0-4 enemy-flags)) - (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> arg1 vertex2) (-> this root trans)))) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> arg1 dest-pos) (-> this root trans)))) (vector-normalize! s5-1 1.0) (let ((v1-5 (-> this jump direction))) (cond diff --git a/goal_src/jak2/levels/ruins/mechtest-obs.gc b/goal_src/jak2/levels/ruins/mechtest-obs.gc index 9c5108adac..67a91aff89 100644 --- a/goal_src/jak2/levels/ruins/mechtest-obs.gc +++ b/goal_src/jak2/levels/ruins/mechtest-obs.gc @@ -10,7 +10,9 @@ (deftype mechblock (process-drawable) ((root collide-shape-moving :override) (origin vector :inline) - (drop-point vector :inline :offset 256) + (unknown-quat quaternion :inline) + (unknown-vector vector :inline) + (drop-point vector :inline) (allow-drag? symbol) (reset-on-land? symbol) (hit-something? symbol) @@ -81,7 +83,7 @@ (-> self root) (vector+! (new 'stack-no-clear 'vector) (-> self origin) (new 'static 'vector :y 81920.0 :w 1.0)) ) - (quaternion-copy! (-> self root quat) (the-as quaternion (&-> self stack 96))) + (quaternion-copy! (-> self root quat) (-> self unknown-quat)) (set-vector! (-> self root transv) 0.0 -4096.0 0.0 1.0) (set! (-> self drop-point quad) (-> self origin quad)) (go-virtual fall) diff --git a/goal_src/jak2/levels/ruins/rapid-gunner.gc b/goal_src/jak2/levels/ruins/rapid-gunner.gc index 798ddc2c36..f09dbafcb0 100644 --- a/goal_src/jak2/levels/ruins/rapid-gunner.gc +++ b/goal_src/jak2/levels/ruins/rapid-gunner.gc @@ -245,15 +245,15 @@ (('hit 'hit-flinch) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (go (method-of-object this knocked)) @@ -272,7 +272,7 @@ ;; WARN: Return type mismatch object vs symbol. ;; WARN: Using new Jak 2 rtype-of ;; WARN: Using new Jak 2 rtype-of -(defmethod enemy-method-77 ((this rapid-gunner) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this rapid-gunner) (arg0 enemy-knocked-info)) (let ((v1-0 (-> this incoming knocked-type))) (the-as symbol @@ -291,7 +291,7 @@ ) ) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 @@ -306,7 +306,7 @@ (s4-0 (new 'static 'array int64 3 20 21 22)) (s3-0 (new 'static 'array int32 4 0 0 0 0)) (a2-1 (ash 1 (-> s3-0 0))) - (v1-27 (enemy-method-120 this a1-11 a2-1)) + (v1-27 (rnd-bit this a1-11 a2-1)) (s4-1 (-> this draw art-group data (-> (the-as (pointer int32) (+ (* v1-27 8) (the-as int s4-0)))))) ) (set! (-> s3-0 0) v1-27) @@ -323,7 +323,7 @@ (let ((a0-19 (-> this skel root-channel 0))) (set! (-> a0-19 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-19 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-19 param 1) (-> arg0 0)) + (set! (-> a0-19 param 1) (-> arg0 anim-speed)) (set! (-> a0-19 frame-num) 0.0) (joint-control-channel-group! a0-19 (the-as art-joint-anim s4-1) num-func-seek!) ) @@ -339,7 +339,7 @@ (set! (-> a0-22 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 20)) frames num-frames) -1)) ) - (set! (-> a0-22 param 1) (-> arg0 0)) + (set! (-> a0-22 param 1) (-> arg0 anim-speed)) (set! (-> a0-22 frame-num) 0.0) (joint-control-channel-group! a0-22 (the-as art-joint-anim (-> this draw art-group data 20)) num-func-seek!) ) @@ -350,7 +350,7 @@ (s5-1 (new 'static 'array int64 3 24 25 26)) (s4-2 (new 'static 'array int32 4 0 0 0 0)) (a2-4 (ash 1 (-> s4-2 0))) - (v1-59 (enemy-method-120 this a1-21 a2-4)) + (v1-59 (rnd-bit this a1-21 a2-4)) (s5-2 (-> this draw art-group data (-> (the-as (pointer int32) (+ (* v1-59 8) (the-as int s5-1)))))) ) (set! (-> s4-2 0) v1-59) @@ -381,7 +381,7 @@ ) (set! (-> a0-43 frame-group) (the-as art-joint-anim a1-28)) (set! (-> a0-43 param 0) (the float (+ (-> (the-as art-joint-anim a1-28) frames num-frames) -1))) - (set! (-> a0-43 param 1) (-> arg0 0)) + (set! (-> a0-43 param 1) (-> arg0 anim-speed)) (set! (-> a0-43 frame-num) 0.0) (joint-control-channel-group! a0-43 (the-as art-joint-anim a1-28) num-func-seek!) ) @@ -413,7 +413,7 @@ (none) ) -(defmethod enemy-method-78 ((this rapid-gunner) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this rapid-gunner) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -423,7 +423,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 27)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 27)) num-func-seek!) ) @@ -441,7 +441,7 @@ ) (set! (-> a0-10 frame-group) (the-as art-joint-anim a1-5)) (set! (-> a0-10 param 0) (the float (+ (-> (the-as art-joint-anim a1-5) frames num-frames) -1))) - (set! (-> a0-10 param 1) (-> arg0 0)) + (set! (-> a0-10 param 1) (-> arg0 anim-speed)) (set! (-> a0-10 frame-num) 0.0) (joint-control-channel-group! a0-10 (the-as art-joint-anim a1-5) num-func-seek!) ) @@ -454,7 +454,7 @@ ) (set! (-> a0-13 frame-group) (the-as art-joint-anim a1-6)) (set! (-> a0-13 param 0) (the float (+ (-> (the-as art-joint-anim a1-6) frames num-frames) -1))) - (set! (-> a0-13 param 1) (-> arg0 0)) + (set! (-> a0-13 param 1) (-> arg0 anim-speed)) (set! (-> a0-13 frame-num) 0.0) (joint-control-channel-group! a0-13 (the-as art-joint-anim a1-6) num-func-seek!) ) @@ -565,12 +565,12 @@ (none) ) -(defmethod track-target! ((this rapid-gunner)) +(defmethod common-post ((this rapid-gunner)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (los-control-method-9 (-> this los) (the-as process-focusable #f) (the-as vector #f) 2048.0) @@ -603,20 +603,20 @@ (defstate notice (rapid-gunner) :virtual #t :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) - (look-at-target! self (enemy-flag lock-focus)) - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) + (look-at-target! self (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) ) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag chase-startup)) + (if (logtest? (-> self enemy-flags) (enemy-flag alert)) (go-virtual hostile) ) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logior! (-> self enemy-flags) (enemy-flag alert)) (let ((v1-23 self)) (set! (-> v1-23 enemy-flags) (the-as enemy-flag (logclear (-> v1-23 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-23 nav callback-info) *nav-enemy-null-callback-info*) @@ -647,7 +647,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -712,7 +712,7 @@ ) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -877,7 +877,7 @@ ) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -997,7 +997,7 @@ ) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1136,7 +1136,7 @@ 0 ) :trans (behavior () - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (let ((gp-0 (handle->process (-> self focus handle)))) @@ -1204,7 +1204,7 @@ ) ) ) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! rapid-gunner-aim-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -1249,7 +1249,7 @@ ) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) diff --git a/goal_src/jak2/levels/sewer/escort/grim.gc b/goal_src/jak2/levels/sewer/escort/grim.gc index 48e81bbbdb..996cbf08a9 100644 --- a/goal_src/jak2/levels/sewer/escort/grim.gc +++ b/goal_src/jak2/levels/sewer/escort/grim.gc @@ -85,7 +85,7 @@ (let ((t9-0 (method-of-type jinx init-enemy!))) (t9-0 this) ) - (set! (-> this channel) (the-as uint 25)) + (set! (-> this channel) (gui-channel grim)) (set! (-> this min-speed) 20480.0) (set! (-> this max-speed) 40960.0) (set! (-> this follow-offset) 12288.0) diff --git a/goal_src/jak2/levels/sewer/escort/jinx-shot.gc b/goal_src/jak2/levels/sewer/escort/jinx-shot.gc index 804c5887f6..5b141555dc 100644 --- a/goal_src/jak2/levels/sewer/escort/jinx-shot.gc +++ b/goal_src/jak2/levels/sewer/escort/jinx-shot.gc @@ -245,24 +245,20 @@ ) (deftype jinx-shot (projectile) - ((tail-pos vector :inline :offset-assert 480) - (hit-pos vector :inline :offset-assert 496) + ((tail-pos vector :inline) + (hit-pos vector :inline) ) - :heap-base #x180 - :method-count-assert 40 - :size-assert #x200 - :flag-assert #x2801800200 ) -(defmethod draw-laser-sight jinx-shot ((obj jinx-shot)) +(defmethod draw-laser-sight ((this jinx-shot)) "TODO - confirm If applicable, draw the laser sight particles" - (draw-beam (-> *part-id-table* 688) (-> obj tail-pos) (-> obj starting-dir) #f #t) + (draw-beam (-> *part-id-table* 688) (-> this tail-pos) (-> this starting-dir) #f #t) 0 (none) ) -(defmethod spawn-impact-particles jinx-shot ((obj jinx-shot)) +(defmethod spawn-impact-particles ((this jinx-shot)) "Spawns associated particles with the projectile if applicable" (rlet ((acc :class vf) (vf0 :class vf) @@ -272,8 +268,8 @@ (vf7 :class vf) ) (init-vf0-vector) - (let* ((v1-1 (-> obj root trans)) - (a1-0 (-> obj tail-pos)) + (let* ((v1-1 (-> this root trans)) + (a1-0 (-> this tail-pos)) (s5-1 (vector-! (new 'stack-no-clear 'vector) v1-1 a1-0)) (gp-0 (new 'stack-no-clear 'vector)) ) @@ -296,14 +292,7 @@ (set! (-> *part-id-table* 685 init-specs 4 initial-valuef) f30-0) ) (vector-normalize! s5-1 1.0) - (let ((t9-2 sp-launch-particles-var) - (a0-5 *sp-particle-system-2d*) - (a1-2 (-> *part-id-table* 686)) - (a2-3 *launch-matrix*) - ) - (set! (-> a2-3 trans quad) (-> gp-0 quad)) - (t9-2 a0-5 a1-2 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) - ) + (launch-particles (-> *part-id-table* 686) gp-0) (let ((f0-4 (vector-dot s5-1 (-> (camera-matrix) vector 2)))) (when (< 0.0 f0-4) (let ((f0-5 (* f0-4 f0-4)) @@ -312,14 +301,7 @@ ) (set! (-> *part-id-table* 687 init-specs 8 initial-valuef) (* f30-1 f0-5)) (set! (-> *part-id-table* 687 init-specs 8 random-rangef) (* f28-0 f0-5)) - (let ((t9-4 sp-launch-particles-var) - (a0-6 *sp-particle-system-2d*) - (a1-3 (-> *part-id-table* 687)) - (a2-4 *launch-matrix*) - ) - (set! (-> a2-4 trans quad) (-> gp-0 quad)) - (t9-4 a0-6 a1-3 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) - ) + (launch-particles (-> *part-id-table* 687) gp-0) (set! (-> *part-id-table* 687 init-specs 8 initial-valuef) f30-1) (set! (-> *part-id-table* 687 init-specs 8 random-rangef) f28-0) ) @@ -331,7 +313,7 @@ ) ) -(defmethod spawn-shell-particles jinx-shot ((obj jinx-shot)) +(defmethod spawn-shell-particles ((this jinx-shot)) "TODO - confirm" (let ((gp-0 (get-process *default-dead-pool* part-tracker #x4000))) (when gp-0 @@ -353,7 +335,7 @@ (t2-0 #f) (t3-0 *launch-matrix*) ) - (set! (-> t3-0 trans quad) (-> obj root trans quad)) + (set! (-> t3-0 trans quad) (-> this root trans quad)) ((the-as (function object object object object object object object object none) t9-2) a0-3 a1-2 @@ -372,31 +354,32 @@ (none) ) -(defmethod play-impact-sound jinx-shot ((obj jinx-shot) (arg0 projectile-options)) - (let ((v1-0 arg0)) - (cond - ((zero? v1-0) - (sound-play "jinx-shot-fire") - ) - ((= v1-0 (projectile-options lose-altitude)) - (sound-play "jinx-shot-hit") - ) - ) - ) - 0 - (none) - ) +;; method defined twice... +;; (defmethod play-impact-sound ((this jinx-shot) (arg0 projectile-options)) +;; (let ((v1-0 arg0)) +;; (cond +;; ((zero? v1-0) +;; (sound-play "jinx-shot-fire") +;; ) +;; ((= v1-0 (projectile-options lose-altitude)) +;; (sound-play "jinx-shot-hit") +;; ) +;; ) +;; ) +;; 0 +;; (none) +;; ) -(defmethod made-impact? jinx-shot ((obj jinx-shot)) +(defmethod made-impact? ((this jinx-shot)) "TODO - queries the collision cache, return true/false" - (let ((v1-0 (-> obj root)) + (let ((v1-0 (-> this root)) (t1-0 (new 'stack-no-clear 'collide-query)) ) (let ((a1-0 t1-0)) (set! (-> a1-0 radius) (-> v1-0 root-prim prim-core world-sphere w)) (set! (-> a1-0 collide-with) (-> v1-0 root-prim prim-core collide-with)) - (set! (-> a1-0 ignore-process0) obj) - (set! (-> a1-0 ignore-process1) (ppointer->process (-> obj parent))) + (set! (-> a1-0 ignore-process0) this) + (set! (-> a1-0 ignore-process1) (ppointer->process (-> this parent))) (set! (-> a1-0 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) (set! (-> a1-0 action-mask) (collide-action solid)) ) @@ -432,9 +415,9 @@ ) ;; WARN: Return type mismatch symbol vs none. -(defmethod init-proj-collision! jinx-shot ((obj jinx-shot)) +(defmethod init-proj-collision! ((this jinx-shot)) "Init the [[projectile]]'s [[collide-shape]]" - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) (the-as (function control-info collide-query vector vector collide-status) cshape-reaction-just-move) @@ -475,12 +458,12 @@ ) (set! (-> s5-0 max-iteration-count) (the-as uint 1)) (set! (-> s5-0 event-self) 'touched) - (set! (-> obj root) s5-0) + (set! (-> this root) s5-0) ) - (set! (-> obj root pat-ignore-mask) + (set! (-> this root pat-ignore-mask) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) ) - (let ((v1-23 (-> obj parent))) + (let ((v1-23 (-> this parent))) (when (not (logtest? (-> (the-as jinx (if v1-23 (the-as jinx (-> v1-23 0 self)) ) @@ -490,7 +473,7 @@ (bot-flags attacked) ) ) - (let* ((a0-17 (-> obj root)) + (let* ((a0-17 (-> this root)) (v1-27 (-> a0-17 root-prim)) ) (countdown (a0-18 (-> a0-17 total-prims)) @@ -503,28 +486,27 @@ (none) ) -;; method defined twice... -;; (defmethod play-impact-sound jinx-shot ((obj jinx-shot) (arg0 projectile-options)) -;; (let ((v1-0 arg0)) -;; (cond -;; ((zero? v1-0) -;; (sound-play "jinx-gun-fire") -;; ) -;; ((= v1-0 (projectile-options lose-altitude)) -;; (sound-play "jinx-shot-hit") -;; ) -;; ) -;; ) -;; 0 -;; (none) -;; ) - -(defmethod init-proj-settings! jinx-shot ((obj jinx-shot)) - "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc" - (set! (-> obj tail-pos quad) (-> obj root trans quad)) - (set! (-> obj attack-mode) 'eco-yellow) - (set! (-> obj max-speed) 307200.0) - (set! (-> obj move) jinx-shot-move) - (set! (-> obj timeout) (seconds 1.335)) +(defmethod play-impact-sound ((this jinx-shot) (arg0 projectile-options)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (sound-play "jinx-gun-fire") + ) + ((= v1-0 (projectile-options lose-altitude)) + (sound-play "jinx-shot-hit") + ) + ) + ) + 0 + (none) + ) + +(defmethod init-proj-settings! ((this jinx-shot)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc" + (set! (-> this tail-pos quad) (-> this root trans quad)) + (set! (-> this attack-mode) 'eco-yellow) + (set! (-> this max-speed) 307200.0) + (set! (-> this move) jinx-shot-move) + (set! (-> this timeout) (seconds 1.335)) (none) ) diff --git a/goal_src/jak2/levels/sewer/escort/jinx-states.gc b/goal_src/jak2/levels/sewer/escort/jinx-states.gc index fc5e42becd..f08c5601dd 100644 --- a/goal_src/jak2/levels/sewer/escort/jinx-states.gc +++ b/goal_src/jak2/levels/sewer/escort/jinx-states.gc @@ -38,7 +38,7 @@ ) ) (until #f - (let ((gp-0 (get-rand-int self 5))) + (let ((gp-0 (rnd-int-count self 5))) (while (>= gp-0 0) (let ((v1-57 (ja-group))) (if (not (and v1-57 (= v1-57 jinx-idle0-ja))) @@ -64,7 +64,7 @@ (suspend) (ja :num! (seek!)) ) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) ) #f ) @@ -210,7 +210,7 @@ ) (let ((gp-0 0)) (until #f - (countdown (s5-0 (get-rand-int-range self 1 3)) + (countdown (s5-0 (rnd-int-range self 1 3)) (let ((v1-57 (ja-group))) (if (not (and v1-57 (= v1-57 jinx-scared0-ja))) (ja-channel-push! 1 (seconds 0.1)) @@ -222,7 +222,7 @@ (ja :num! (seek!)) ) ) - (set! gp-0 (enemy-method-120 self 5 (logior (ash 1 gp-0) 1))) + (set! gp-0 (rnd-bit self 5 (logior (ash 1 gp-0) 1))) (let ((s5-1 (-> self draw art-group data (-> *jinx-global-info* scared-idle-anim gp-0)))) (let ((v1-98 (ja-group))) (if (not (and v1-98 (= v1-98 s5-1))) @@ -399,7 +399,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((a1-2 (-> self draw art-group data (-> *jinx-global-info* kick-anim (get-rand-int self 2))))) + (let ((a1-2 (-> self draw art-group data (-> *jinx-global-info* kick-anim (rnd-int-count self 2))))) (ja-no-eval :group! a1-2 :num! (seek!) :frame-num 0.0) ) (until (ja-done? 0) @@ -500,8 +500,8 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.07)) - (let ((gp-1 (-> self draw art-group data (-> *jinx-global-info* bomb-recoil-anim (get-rand-int self 2)))) - (f30-0 (get-rand-float-range self 0.4 0.8)) + (let ((gp-1 (-> self draw art-group data (-> *jinx-global-info* bomb-recoil-anim (rnd-int-count self 2)))) + (f30-0 (rnd-float-range self 0.4 0.8)) ) (ja-no-eval :group! gp-1 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -517,29 +517,29 @@ :virtual #t :code (behavior () (local-vars (v1-7 enemy-flag) (v1-15 enemy-flag)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-6 (-> self enemy-flags))) - (if (logtest? v1-6 (enemy-flag checking-water)) - (set! v1-7 (logior v1-6 (enemy-flag enable-on-active))) - (set! v1-7 (logclear v1-6 (enemy-flag enable-on-active))) + (if (logtest? v1-6 (enemy-flag vulnerable-backup)) + (set! v1-7 (logior v1-6 (enemy-flag vulnerable))) + (set! v1-7 (logclear v1-6 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-7) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-14 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-14) - (set! v1-15 (logior (enemy-flag check-water-backup) v1-14)) - (set! v1-15 (logclear v1-14 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-14) + (set! v1-15 (logior (enemy-flag trackable) v1-14)) + (set! v1-15 (logclear v1-14 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-15) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) diff --git a/goal_src/jak2/levels/sewer/escort/jinx.gc b/goal_src/jak2/levels/sewer/escort/jinx.gc index 6707eb7f83..f0e851793c 100644 --- a/goal_src/jak2/levels/sewer/escort/jinx.gc +++ b/goal_src/jak2/levels/sewer/escort/jinx.gc @@ -315,7 +315,7 @@ (set! (-> this min-speed) 24576.0) (set! (-> this max-speed) 49152.0) (set! (-> this follow-offset) 24576.0) - (set! (-> this channel) (the-as uint 24)) + (set! (-> this channel) (gui-channel jinx)) (set! (-> this notice-enemy-dist) 204800.0) (set! (-> this travel-anim-interp) 0.0) (set! (-> this focus-info max-los-dist) 61440.0) @@ -347,7 +347,7 @@ ;; WARN: Return type mismatch (pointer process) vs none. (defmethod fire-gun ((this jinx) (arg0 vector)) - (set! (-> this next-fire-time) (+ (current-time) (get-rand-int-range this 150 600))) + (set! (-> this next-fire-time) (+ (current-time) (rnd-int-range this 150 600))) (+! (-> this fired-gun-count) 1) (let ((s4-1 (new 'stack-no-clear 'projectile-init-by-other-params))) (set! (-> s4-1 ent) (-> this entity)) @@ -430,7 +430,7 @@ ) ) -(defmethod enemy-method-77 ((this jinx) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this jinx) (arg0 enemy-knocked-info)) (let ((v1-0 (-> this incoming knocked-type))) (cond ((= v1-0 (knocked-type knocked-type-6)) @@ -441,7 +441,7 @@ (vector-z-quaternion! s5-1 (-> this root quat)) (cond ((>= (vector-dot s4-0 s5-1) 0.0) - (let* ((v1-7 (enemy-method-120 this 3 (ash 1 (-> *jinx-global-info* prev-blue-hit-back)))) + (let* ((v1-7 (rnd-bit this 3 (ash 1 (-> *jinx-global-info* prev-blue-hit-back)))) (s5-2 (-> this draw art-group data (-> *jinx-global-info* blue-hit-back-anim v1-7))) ) (set! (-> *jinx-global-info* prev-blue-hit-back) v1-7) @@ -465,7 +465,7 @@ ) ) (else - (let* ((v1-24 (enemy-method-120 this 3 (ash 1 (-> *jinx-global-info* prev-blue-hit-front)))) + (let* ((v1-24 (rnd-bit this 3 (ash 1 (-> *jinx-global-info* prev-blue-hit-front)))) (s5-3 (-> this draw art-group data (-> *jinx-global-info* blue-hit-front-anim v1-24))) ) (set! (-> *jinx-global-info* prev-blue-hit-front) v1-24) @@ -503,7 +503,7 @@ (joint-control-channel-group! a0-34 (the-as art-joint-anim (-> this draw art-group data 23)) num-func-seek!) ) ) - ((zero? (get-rand-int this 3)) + ((zero? (rnd-int-count this 3)) (ja-channel-push! 1 (seconds 0.17)) (let ((a0-37 (-> this skel root-channel 0))) (set! (-> a0-37 frame-group) (the-as art-joint-anim (-> this draw art-group data 21))) @@ -533,7 +533,7 @@ (let ((a0-44 (-> this skel root-channel 0))) (set! (-> a0-44 frame-group) (the-as art-joint-anim s4-2)) (set! (-> a0-44 param 0) (the float (+ (-> (the-as art-joint-anim s4-2) frames num-frames) -1))) - (set! (-> a0-44 param 1) (-> arg0 0)) + (set! (-> a0-44 param 1) (-> arg0 anim-speed)) (set! (-> a0-44 frame-num) 0.0) (joint-control-channel-group! a0-44 (the-as art-joint-anim s4-2) num-func-seek!) ) @@ -546,7 +546,7 @@ #t ) -(defmethod enemy-method-78 ((this jinx) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this jinx) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) diff --git a/goal_src/jak2/levels/sewer/escort/mog.gc b/goal_src/jak2/levels/sewer/escort/mog.gc index cadf27bf4f..a52f9d36e2 100644 --- a/goal_src/jak2/levels/sewer/escort/mog.gc +++ b/goal_src/jak2/levels/sewer/escort/mog.gc @@ -276,7 +276,7 @@ (t9-0 this) ) (set-enemy-info! this *mog-nav-enemy-info*) - (set! (-> this channel) (the-as uint 23)) + (set! (-> this channel) (gui-channel mog)) (set! (-> this spot-color) (the-as uint #x50ff0000)) (set-vector! (-> this root scale) 1.15 1.15 1.15 1.0) (set! (-> this skel prebind-function) mog-prebind-function) diff --git a/goal_src/jak2/levels/sewer/gator.gc b/goal_src/jak2/levels/sewer/gator.gc index 823664c742..c40d5d13c5 100644 --- a/goal_src/jak2/levels/sewer/gator.gc +++ b/goal_src/jak2/levels/sewer/gator.gc @@ -274,12 +274,12 @@ ) ;; WARN: Return type mismatch vector vs none. -(defmethod track-target! ((this gator)) +(defmethod common-post ((this gator)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((func (method-of-type nav-enemy track-target!))) + (let ((func (method-of-type nav-enemy common-post))) (func this) ) (adjust-depth! this) @@ -351,7 +351,7 @@ ) ) :code (behavior () - (let ((circle-for (get-rand-float-range self 0.9 1.1))) + (let ((circle-for (rnd-float-range self 0.9 1.1))) (until #f (encircle-target! self 2.0 0.5 #t) (suspend) @@ -366,7 +366,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (let ((_self self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> _self enemy-flags))) (set! (-> _self enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> _self enemy-flags)))) @@ -393,8 +393,8 @@ ) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -409,7 +409,7 @@ (cond ((-> self lock-nav-target) ) - ((or (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + ((or (logtest? (-> self enemy-flags) (enemy-flag victory)) (logtest? (-> self nav state flags) (nav-state-flag at-target)) ) (set! (-> self lock-nav-target) #t) @@ -471,7 +471,7 @@ (defstate pacing (gator) :virtual #t :code (behavior () - (let ((circle-for? (get-rand-float-range self 0.9 1.1))) + (let ((circle-for? (rnd-float-range self 0.9 1.1))) (until #f (encircle-target! self 2.0 0.5 #f) (suspend) @@ -498,7 +498,7 @@ ) ) :code (behavior () - (let ((circle-for? (get-rand-float-range self 0.9 1.1))) + (let ((circle-for? (rnd-float-range self 0.9 1.1))) (until #f (encircle-target! self 2.0 0.5 #f) (suspend) diff --git a/goal_src/jak2/levels/sewer/grim2-course.gc b/goal_src/jak2/levels/sewer/grim2-course.gc index bc0e17f2af..a0e5f7f775 100644 --- a/goal_src/jak2/levels/sewer/grim2-course.gc +++ b/goal_src/jak2/levels/sewer/grim2-course.gc @@ -1054,7 +1054,7 @@ :nav-mesh-index -1 :skip-to 54 :on-set (lambda ((arg0 grim-sewer)) - (logior! (-> arg0 enemy-flags) (enemy-flag trackable-backup enable-on-hostile)) + (logior! (-> arg0 enemy-flags) (enemy-flag check-water check-water-backup)) (logior! (-> arg0 bot-flags) (bot-flags bf19)) (logclear! (-> arg0 focus-status) (focus-status disable)) (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) ruft-wait-spot arg0))) diff --git a/goal_src/jak2/levels/sewer/hal2-course.gc b/goal_src/jak2/levels/sewer/hal2-course.gc index ea468e4394..475af225cd 100644 --- a/goal_src/jak2/levels/sewer/hal2-course.gc +++ b/goal_src/jak2/levels/sewer/hal2-course.gc @@ -150,7 +150,7 @@ (defun hal2-force-fail-check-too-far ((arg0 hal-sewer)) (let ((gp-0 0)) - (if (and (not (channel-active? arg0 (the-as uint 0))) (logtest? (bot-flags bf24) (-> arg0 bot-flags))) + (if (and (not (channel-active? arg0 (gui-channel none))) (logtest? (bot-flags bf24) (-> arg0 bot-flags))) (set! gp-0 2) ) gp-0 @@ -678,7 +678,7 @@ (send-event s3-0 'request 'waypoint 9) ) ) - (when (and (not (channel-active? arg1 (the-as uint 0))) + (when (and (not (channel-active? arg1 (gui-channel none))) (not (speech-playing? arg1 6)) (begin (set! a0-8 s3-0) a0-8) (>= (the-as int (send-event a0-8 'query 'waypoint)) 9) @@ -702,7 +702,7 @@ ) (when (and (time-elapsed? (-> arg1 waypoint-time0) (seconds 4)) (not (speech-playing? arg1 2)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 2) (play-speech arg1 3) @@ -838,7 +838,7 @@ (when (and (and a0-20 (>= (the-as int (send-event a0-20 'query 'waypoint)) 11)) (and (not (speech-playing? arg1 12)) (not (speech-playing? arg1 8)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) ) (play-speech arg1 8) @@ -1335,7 +1335,7 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (cond ((speech-playing? arg1 12) (if (not (speech-playing? arg1 22)) @@ -1425,15 +1425,15 @@ #t ) (else - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (cond - ((zero? (get-rand-int arg1 2)) + ((zero? (rnd-int-count arg1 2)) (play-speech arg1 24) (play-speech arg1 25) (play-speech arg1 26) (play-speech arg1 27) ) - ((begin (play-speech arg1 77) (play-speech arg1 78) (set! v1-40 (get-rand-int arg1 4)) (zero? v1-40)) + ((begin (play-speech arg1 77) (play-speech arg1 78) (set! v1-40 (rnd-int-count arg1 4)) (zero? v1-40)) (play-speech arg1 79) ) ((= v1-40 1) @@ -1455,7 +1455,7 @@ ) ) (else - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (play-speech arg1 23) (let ((a1-23 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-23 from) (process->ppointer pp)) @@ -1722,7 +1722,7 @@ ) (if (and (not (speech-playing? arg1 28)) (time-elapsed? (-> arg1 waypoint-time0) (seconds 2)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 28) ) @@ -1821,7 +1821,7 @@ (cond ((logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) (when (and (not (speech-playing? arg1 29)) (not (speech-playing? arg1 30))) - (if (zero? (get-rand-int arg1 2)) + (if (zero? (rnd-int-count arg1 2)) (play-speech arg1 29) (play-speech arg1 30) ) @@ -2064,7 +2064,7 @@ (lambda ((arg0 object) (arg1 hal-sewer)) (with-pp (hal-sewer-method-228 arg1) - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (cond ((not (speech-playing? arg1 34)) (let* ((s5-0 arg1) @@ -2205,7 +2205,7 @@ ) ) ) - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (cond ((and (not (speech-playing? arg1 36)) (not s5-0) (not s4-0)) (play-speech arg1 36) @@ -2351,7 +2351,7 @@ (if (time-elapsed? (-> arg1 waypoint-time0) (seconds 2.25)) (send-event s3-0 'request 'waypoint 34) ) - (when (and (not (channel-active? arg1 (the-as uint 0))) + (when (and (not (channel-active? arg1 (gui-channel none))) (and (not (speech-playing? arg1 42)) (not (speech-playing? arg1 43)) (begin @@ -2366,7 +2366,7 @@ (>= (the-as int (send-event a0-10 'query 'waypoint)) 33) ) ) - (if (zero? (get-rand-int arg1 2)) + (if (zero? (rnd-int-count arg1 2)) (play-speech arg1 42) (play-speech arg1 43) ) @@ -2547,7 +2547,7 @@ (set-time! (-> arg1 waypoint-time0)) ) (else - (if (and (not (speech-playing? arg1 46)) (not (channel-active? arg1 (the-as uint 0)))) + (if (and (not (speech-playing? arg1 46)) (not (channel-active? arg1 (gui-channel none)))) (play-speech arg1 46) ) ) @@ -2627,7 +2627,7 @@ ) ) (when (and (not (speech-playing? arg1 47)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) s4-0 (focus-test? (the-as process-focusable s4-0) touch-water) ) @@ -2692,7 +2692,7 @@ (with-pp (if (and (not (speech-playing? arg1 52)) (speech-playing? arg1 49) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (let ((v1-10 (-> arg1 actor-group 0 data 20 actor))) (not (if v1-10 (-> v1-10 extra process) @@ -2829,7 +2829,7 @@ :skip-to 48 :on-set (lambda ((arg0 hal-sewer)) (with-pp - (if (zero? (get-rand-int arg0 2)) + (if (zero? (rnd-int-count arg0 2)) (play-speech arg0 53) (play-speech arg0 54) ) @@ -2966,7 +2966,7 @@ (logclear! (-> arg1 bot-flags) (bot-flags bf24)) (reset-warn-time! arg1) (set-time! (-> arg1 waypoint-time0)) - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (let ((v1-22 *target*)) (when (and v1-22 (focus-test? v1-22 in-air) (not (logtest? (-> v1-22 focus-status) (focus-status hit)))) (cond @@ -2985,7 +2985,7 @@ ) ) ) - ((channel-active? arg1 (the-as uint 0)) + ((channel-active? arg1 (gui-channel none)) (reset-warn-time! arg1) (set-time! (-> arg1 waypoint-time0)) ) @@ -3190,7 +3190,7 @@ (logclear! (-> arg1 bot-flags) (bot-flags bf24)) (reset-warn-time! arg1) (set-time! (-> arg1 waypoint-time0)) - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (let ((v1-22 *target*)) (when (and v1-22 (focus-test? v1-22 in-air) (not (logtest? (-> v1-22 focus-status) (focus-status hit)))) (cond @@ -3205,7 +3205,7 @@ ) ) ) - ((channel-active? arg1 (the-as uint 0)) + ((channel-active? arg1 (gui-channel none)) (reset-warn-time! arg1) (set-time! (-> arg1 waypoint-time0)) ) @@ -3470,7 +3470,7 @@ (send-event s4-0 'request 'waypoint 48) ) ) - (when (and (not (channel-active? arg1 (the-as uint 0))) (not (speech-playing? arg1 67))) + (when (and (not (channel-active? arg1 (gui-channel none))) (not (speech-playing? arg1 67))) (let* ((v1-141 (-> arg1 actor-group 0 data 1 actor)) (s4-1 (if v1-141 (-> v1-141 extra process) @@ -3602,7 +3602,7 @@ ) ) (if (and (not (speech-playing? arg1 70)) - (and (not (channel-active? arg1 (the-as uint 0))) + (and (not (channel-active? arg1 (gui-channel none))) (begin (set! a0-3 s5-0) a0-3) (>= (the-as int (send-event a0-3 'query 'waypoint)) 56) ) @@ -3659,7 +3659,7 @@ ((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)) + (when (and (not (channel-active? arg1 (gui-channel none))) (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) @@ -3668,7 +3668,7 @@ ) (else (cond - ((channel-active? arg1 (the-as uint 0)) + ((channel-active? arg1 (gui-channel none)) (set! (-> arg1 waypoint-time0) (+ (current-time) (seconds 9))) ) ((>= (current-time) (-> arg1 waypoint-time0)) @@ -3923,7 +3923,7 @@ (if (time-elapsed? (-> arg1 waypoint-time0) (seconds 4)) (send-event s4-0 'request 'waypoint 59) ) - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (cond ((and (not (speech-playing? arg1 75)) (time-elapsed? (-> arg1 waypoint-time0) (seconds 6))) (play-speech arg1 75) diff --git a/goal_src/jak2/levels/sewer/hosehead.gc b/goal_src/jak2/levels/sewer/hosehead.gc index 3a814108a8..49a7e059be 100644 --- a/goal_src/jak2/levels/sewer/hosehead.gc +++ b/goal_src/jak2/levels/sewer/hosehead.gc @@ -429,7 +429,7 @@ ) ) -(defmethod enemy-method-77 ((this hosehead) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this hosehead) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (ja-channel-push! 1 (seconds 0.17)) @@ -438,7 +438,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 18)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 18)) num-func-seek!) ) @@ -449,14 +449,14 @@ (((knocked-type knocked-type-4)) (ja-channel-push! 1 (seconds 0.1)) (let* ((a2-1 (ash 1 (-> *hosehead-global-info* prev-yellow-hit))) - (v1-18 (enemy-method-120 this 2 a2-1)) + (v1-18 (rnd-bit this 2 a2-1)) (a1-8 (-> this draw art-group data (-> *hosehead-global-info* yellow-hit-anim v1-18 hit-index))) ) (set! (-> *hosehead-global-info* prev-yellow-hit) v1-18) (let ((a0-15 (-> this skel root-channel 0))) (set! (-> a0-15 frame-group) (the-as art-joint-anim a1-8)) (set! (-> a0-15 param 0) (the float (+ (-> (the-as art-joint-anim a1-8) frames num-frames) -1))) - (set! (-> a0-15 param 1) (-> arg0 0)) + (set! (-> a0-15 param 1) (-> arg0 anim-speed)) (set! (-> a0-15 frame-num) 0.0) (joint-control-channel-group! a0-15 (the-as art-joint-anim a1-8) num-func-seek!) ) @@ -464,7 +464,7 @@ ) (((knocked-type knocked-type-6)) (let* ((a2-3 (ash 1 (-> *hosehead-global-info* prev-blue-hit))) - (v1-27 (enemy-method-120 this 3 a2-3)) + (v1-27 (rnd-bit this 3 a2-3)) (a1-13 (-> this draw art-group data (-> *hosehead-global-info* blue-hit-anim v1-27 hit-index))) ) (set! (-> *hosehead-global-info* prev-blue-hit) v1-27) @@ -480,14 +480,14 @@ (else (ja-channel-push! 1 (seconds 0.1)) (let* ((a2-5 (ash 1 (-> *hosehead-global-info* prev-knocked))) - (v1-37 (enemy-method-120 this 2 a2-5)) + (v1-37 (rnd-bit this 2 a2-5)) (a1-19 (-> this draw art-group data (-> *hosehead-global-info* knocked-anim v1-37 hit-index))) ) (set! (-> *hosehead-global-info* prev-knocked) v1-37) (let ((a0-39 (-> this skel root-channel 0))) (set! (-> a0-39 frame-group) (the-as art-joint-anim a1-19)) (set! (-> a0-39 param 0) (the float (+ (-> (the-as art-joint-anim a1-19) frames num-frames) -1))) - (set! (-> a0-39 param 1) (-> arg0 0)) + (set! (-> a0-39 param 1) (-> arg0 anim-speed)) (set! (-> a0-39 frame-num) 0.0) (joint-control-channel-group! a0-39 (the-as art-joint-anim a1-19) num-func-seek!) ) @@ -499,7 +499,7 @@ ) ) -(defmethod enemy-method-78 ((this hosehead) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this hosehead) (arg0 enemy-knocked-info)) (local-vars (v1-15 knocked-type)) (cond ((zero? (-> this hit-points)) @@ -509,7 +509,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 19)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 19)) num-func-seek!) ) @@ -523,7 +523,7 @@ (let ((a0-9 (-> this skel root-channel 0))) (set! (-> a0-9 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-9 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-9 param 1) (-> arg0 0)) + (set! (-> a0-9 param 1) (-> arg0 anim-speed)) (joint-control-channel-group! a0-9 (the-as art-joint-anim s4-0) num-func-seek!) ) ) @@ -540,7 +540,7 @@ (let ((a0-16 (-> this skel root-channel 0))) (set! (-> a0-16 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-16 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-16 param 1) (-> arg0 0)) + (set! (-> a0-16 param 1) (-> arg0 anim-speed)) (joint-control-channel-group! a0-16 (the-as art-joint-anim s4-1) num-func-seek!) ) ) @@ -765,15 +765,15 @@ (('cue-chase) (cond ((-> this on-wall?) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) - (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance directed directed-ready use-trigger)) + (logior! (-> this enemy-flags) (enemy-flag chase-startup)) (logclear! (-> this mask) (process-mask actor-pause)) (go (method-of-object this notice-wall)) ) ((-> this sentry?) (when (and (-> this next-state) (= (-> this next-state name) 'idle-sentry)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) - (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance directed directed-ready use-trigger)) + (logior! (-> this enemy-flags) (enemy-flag chase-startup)) (logclear! (-> this mask) (process-mask actor-pause)) (go (method-of-object this hostile-sentry)) ) @@ -942,7 +942,7 @@ ) ) (when (not (-> self sentry?)) - (logior! (-> self enemy-flags) (enemy-flag trackable)) + (logior! (-> self enemy-flags) (enemy-flag multi-focus)) (set! (-> self focus collide-with) (collide-spec jak bot player-list jak-vehicle)) (let ((gp-1 (-> self on-stop-sentry))) (if gp-1 @@ -981,7 +981,7 @@ (logclear! (-> self skel status) (joint-control-status sync-math)) (set! (-> self allow-head) #f) (set! (-> self fire-beam?) #f) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1012,7 +1012,7 @@ ) (+! (-> self target-pos y) 2867.2) (let ((f0-5 (* (-> self angle-sentry) (+ -0.5 (get-norm! (-> self sync) 0))))) - (if (logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + (if (logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (set! f0-5 (- f0-5)) ) (set! (-> self head-angle) f0-5) @@ -1028,7 +1028,7 @@ ) ) (when (not (-> self sentry?)) - (logior! (-> self enemy-flags) (enemy-flag trackable)) + (logior! (-> self enemy-flags) (enemy-flag multi-focus)) (set! (-> self focus collide-with) (collide-spec jak bot player-list jak-vehicle)) (let ((gp-2 (-> self on-stop-sentry))) (if gp-2 @@ -1049,7 +1049,7 @@ ) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-channel-push! 1 (seconds 0.01)) (set! (-> self fire-beam?) #t) (until #f @@ -1084,8 +1084,8 @@ (vf2 :class vf) (vf3 :class vf) ) - (set! (-> arg0 x) (get-rand-float-range this 5607424.0 5812224.0)) - (set! (-> arg0 z) (get-rand-float-range this 2027520.0 1961984.0)) + (set! (-> arg0 x) (rnd-float-range this 5607424.0 5812224.0)) + (set! (-> arg0 z) (rnd-float-range this 2027520.0 1961984.0)) (set! (-> arg0 y) -368680.97) (let ((gp-1 (new 'stack-no-clear 'vector))) (set! (-> gp-1 quad) (-> arg0 quad)) @@ -1262,15 +1262,15 @@ (set! (-> v1-6 prim-core collide-with) (collide-spec)) ) 0 - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) ) ) ) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logior! (-> self enemy-flags) (enemy-flag alert)) (let ((gp-1 (new 'stack-no-clear 'vector))) (let ((s5-0 (new 'stack-no-clear 'vector))) (hosehead-method-191 self gp-1 s5-0) @@ -1304,7 +1304,7 @@ (set! (-> self attack-id) a0-22) ) (if (logtest? (enemy-option water) (-> self fact enemy-options)) - (logior! (-> self enemy-flags) (enemy-flag trackable-backup enable-on-hostile)) + (logior! (-> self enemy-flags) (enemy-flag check-water check-water-backup)) ) (logclear! (-> self draw status) (draw-control-status no-draw)) ) @@ -1500,7 +1500,7 @@ (vf7 :class vf) ) (init-vf0-vector) - (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self enemy-flags) (enemy-flag alert)) ((-> (method-of-type nav-enemy notice) enter)) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) @@ -1596,7 +1596,9 @@ ) (when (< (- (-> self root trans y) (-> self jump-point y)) 40960.0) (hosehead-method-196 self) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 0 (-> self jump-point)) ) (suspend) @@ -1626,7 +1628,7 @@ :virtual #t :enter (behavior () (if (logtest? (enemy-option water) (-> self fact enemy-options)) - (logior! (-> self enemy-flags) (enemy-flag trackable-backup enable-on-hostile)) + (logior! (-> self enemy-flags) (enemy-flag check-water check-water-backup)) ) (let ((t9-0 (-> (method-of-type nav-enemy knocked) enter))) (if t9-0 @@ -1640,7 +1642,7 @@ :virtual #t :enter (behavior () (if (logtest? (enemy-option water) (-> self fact enemy-options)) - (logior! (-> self enemy-flags) (enemy-flag trackable-backup enable-on-hostile)) + (logior! (-> self enemy-flags) (enemy-flag check-water check-water-backup)) ) (let ((t9-0 (-> (method-of-type nav-enemy jump) enter))) (if t9-0 @@ -1722,13 +1724,13 @@ (logclear! (-> self skel status) (joint-control-status sync-math)) (set! (-> self allow-head) #f) (set! (-> self fire-beam?) #f) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (set! (-> self allow-head) #t) (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! hosehead-shoot-start-ja :num! (seek! max f30-0) :frame-num 0.0) @@ -1782,7 +1784,7 @@ ) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1790,7 +1792,7 @@ :code (behavior () (ja-channel-push! 1 (seconds 0.2)) (cond - ((zero? (get-rand-int self 2)) + ((zero? (rnd-int-count self 2)) (ja-no-eval :group! hosehead-attack1-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -1805,11 +1807,11 @@ ) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) - (let ((v1-57 (get-rand-int self 4))) + (let ((v1-57 (rnd-int-count self 4))) (cond ((zero? v1-57) (ja-no-eval :group! hosehead-idle1-ja :num! (seek!) :frame-num 0.0) @@ -1870,7 +1872,7 @@ 0 ) ((zero? (-> self next-lazer-time)) - (set! (-> self next-lazer-time) (+ (current-time) (the int (* 300.0 (get-rand-float-range self 1.0 2.0))))) + (set! (-> self next-lazer-time) (+ (current-time) (the int (* 300.0 (rnd-float-range self 1.0 2.0))))) ) ((>= (current-time) (-> self next-lazer-time)) (if (and (enemy-method-96 self 3640.889 #t) (and (< 40960.0 f30-0) (hosehead-method-190 self))) @@ -1882,12 +1884,12 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (if (zero? (get-rand-int self 5)) + (if (zero? (rnd-int-count self 5)) (ja :group! hosehead-run1-ja) (ja :group! hosehead-run-ja) ) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -1903,7 +1905,7 @@ :code (behavior () (set! (-> self come-from-notice) #t) (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (new 'stack-no-clear 'vector) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) :num! (seek! max f30-0) @@ -1967,7 +1969,7 @@ (set! (-> s5-0 x) (fmax -1820.4445 (fmin 1820.4445 (deg- (-> s3-0 x) (-> s4-0 x))))) (set! (-> s5-0 y) (fmax -3640.889 (fmin 3640.889 (deg- (-> s3-0 y) (-> s4-0 y))))) (set! (-> s5-0 z) 0.0) - (if (not (logtest? (enemy-flag dislike-combo) (-> this enemy-flags))) + (if (not (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags))) (set! (-> s5-0 y) (- (-> s5-0 y))) ) (+! (-> s5-0 y) (-> this head-angle)) @@ -1989,12 +1991,12 @@ (none) ) -(defmethod track-target! ((this hosehead)) +(defmethod common-post ((this hosehead)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (hosehead-method-194 this) @@ -2144,11 +2146,11 @@ ) ;; WARN: Return type mismatch symbol vs none. -(defmethod enemy-method-106 ((this hosehead) (arg0 process) (arg1 object) (arg2 int) (arg3 attack-info)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-106))) +(defmethod set-incoming-attack-info ((this hosehead) (arg0 process) (arg1 object) (arg2 penetrate) (arg3 attack-info)) + (let ((t9-0 (method-of-type nav-enemy set-incoming-attack-info))) (t9-0 this arg0 arg1 arg2 arg3) ) - (let ((a1-3 (enemy-method-134 this arg0 arg3))) + (let ((a1-3 (get-attacker this arg0 arg3))) (if (and a1-3 (logtest? (process-mask bot) (-> a1-3 mask))) (set! (-> this shot-by-ruffian?) #t) (set! (-> this shot-by-ruffian?) #f) @@ -2223,7 +2225,9 @@ (set! (-> this on-wall?) #f) (when (>= (res-lump-value (-> this entity) 'extra-id int :default (the-as uint128 -1) :time -1000000000.0) 0) (set! (-> this on-wall?) #t) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag vulnerable-backup) (-> this enemy-flags)))) + (set! (-> this enemy-flags) + (the-as enemy-flag (logior (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) + ) ) (init-enemy-behaviour-and-stats! this *hosehead-nav-enemy-info*) (set! (-> this sentry?) (logtest? (-> this fact enemy-options) (enemy-option user9))) diff --git a/goal_src/jak2/levels/sewer/jinx2-course.gc b/goal_src/jak2/levels/sewer/jinx2-course.gc index 2f2d5941ba..fc81a4d486 100644 --- a/goal_src/jak2/levels/sewer/jinx2-course.gc +++ b/goal_src/jak2/levels/sewer/jinx2-course.gc @@ -1123,7 +1123,7 @@ :nav-mesh-index -1 :skip-to 54 :on-set (lambda ((arg0 jinx-sewer)) - (logior! (-> arg0 enemy-flags) (enemy-flag trackable-backup enable-on-hostile)) + (logior! (-> arg0 enemy-flags) (enemy-flag check-water check-water-backup)) (logior! (-> arg0 bot-flags) (bot-flags bf19)) (logclear! (-> arg0 focus-status) (focus-status disable)) (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) ruft-wait-spot arg0))) diff --git a/goal_src/jak2/levels/sewer/mog2-course.gc b/goal_src/jak2/levels/sewer/mog2-course.gc index a149351bf4..f54f4babad 100644 --- a/goal_src/jak2/levels/sewer/mog2-course.gc +++ b/goal_src/jak2/levels/sewer/mog2-course.gc @@ -1065,7 +1065,7 @@ :nav-mesh-index -1 :skip-to 54 :on-set (lambda ((arg0 mog-sewer)) - (logior! (-> arg0 enemy-flags) (enemy-flag trackable-backup enable-on-hostile)) + (logior! (-> arg0 enemy-flags) (enemy-flag check-water check-water-backup)) (logior! (-> arg0 bot-flags) (bot-flags bf19)) (logclear! (-> arg0 focus-status) (focus-status disable)) (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) ruft-wait-spot arg0))) diff --git a/goal_src/jak2/levels/sewer/sew-gunturret.gc b/goal_src/jak2/levels/sewer/sew-gunturret.gc index 6130352058..eb4431966e 100644 --- a/goal_src/jak2/levels/sewer/sew-gunturret.gc +++ b/goal_src/jak2/levels/sewer/sew-gunturret.gc @@ -703,7 +703,7 @@ (set! (-> self flash-state) #f) ) :trans (behavior () - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (when (time-elapsed? (-> self state-time) (-> self reaction-time)) @@ -826,7 +826,7 @@ (defstate die (sew-gunturret) :virtual #t :enter (behavior () - (dispose! self) + (dying self) (let ((root-prim (-> self root root-prim))) (set! (-> root-prim prim-core collide-as) (collide-spec)) (set! (-> root-prim prim-core collide-with) (collide-spec)) @@ -872,7 +872,7 @@ ) ) :post (behavior () - (track-target! self) + (common-post self) ) ) @@ -1024,7 +1024,7 @@ (initialize-skeleton this (-> this params normal-sg) (the-as pair 0)) (init-enemy-behaviour-and-stats! this (-> this params enemy-info)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (set! (-> this part) (create-launch-control (-> *part-group-id-table* 1126) this)) (set! (-> this smoke-part) (create-launch-control (-> *part-group-id-table* 1127) this)) (set! (-> this casing-part) (create-launch-control (-> *part-group-id-table* 1128) this)) diff --git a/goal_src/jak2/levels/strip/strip-drop.gc b/goal_src/jak2/levels/strip/strip-drop.gc index a66208e418..4437dcbd6c 100644 --- a/goal_src/jak2/levels/strip/strip-drop.gc +++ b/goal_src/jak2/levels/strip/strip-drop.gc @@ -621,7 +621,7 @@ This commonly includes things such as: (shove-back (meters 3)) (shove-up (meters 2)) (mode 'deadly) - (knock (the-as uint 8)) + (knock (knocked-type knocked-type-8)) (damage 4.0) ) ) diff --git a/goal_src/jak2/levels/tomb/monster-frog.gc b/goal_src/jak2/levels/tomb/monster-frog.gc index 543a8e46b8..06f88b1d66 100644 --- a/goal_src/jak2/levels/tomb/monster-frog.gc +++ b/goal_src/jak2/levels/tomb/monster-frog.gc @@ -176,9 +176,9 @@ (set! (-> v1-0 nav callback-info) *nav-enemy-null-callback-info*) ) 0 - (dotimes (gp-0 (get-rand-int-range self 2 3)) + (dotimes (gp-0 (rnd-int-range self 2 3)) (cond - ((zero? (get-rand-int self 4)) + ((zero? (rnd-int-count self 4)) (let ((v1-7 (ja-group))) (if (not (and v1-7 (= v1-7 monster-frog-idle0-ja))) (ja-channel-push! 1 (seconds 0.1)) @@ -263,8 +263,8 @@ (defstate ambush (monster-frog) :virtual #t :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -314,7 +314,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (new 'stack-no-clear 'vector) (ja-no-eval :group! monster-frog-notice0-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -349,7 +349,7 @@ (defstate active (monster-frog) :virtual #t :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (nav-enemy-method-165 self) (ja-channel-push! 1 (seconds 0.2)) @@ -364,7 +364,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (when (enemy-method-123 self 0.2) + (when (rnd-go-idle? self 0.2) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.6)) (let ((v1-57 self)) @@ -382,7 +382,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (until (not (enemy-method-123 self 0.2)) + (until (not (rnd-go-idle? self 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -447,7 +447,7 @@ (defstate hostile (monster-frog) :virtual #t :enter (behavior () - (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self enemy-flags) (enemy-flag alert)) (let ((t9-0 (-> (method-of-type nav-enemy hostile) enter))) (if t9-0 (t9-0) @@ -460,7 +460,7 @@ ) :trans (behavior () (nav-enemy-method-160 self) - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (when (time-elapsed? (-> self state-time) (-> self reaction-time)) @@ -670,7 +670,7 @@ 0 ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -684,7 +684,7 @@ (ja :num! (seek!)) ) (nav-enemy-method-167 self) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -714,7 +714,7 @@ (ja :num! (seek!)) ) (cond - ((zero? (get-rand-int self 4)) + ((zero? (rnd-int-count self 4)) (let ((v1-28 (ja-group))) (if (not (and v1-28 (= v1-28 monster-frog-idle0-ja))) (ja-channel-push! 1 (seconds 0.1)) @@ -744,7 +744,7 @@ :post nav-enemy-simple-post ) -(defmethod enemy-method-77 ((this monster-frog) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this monster-frog) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (ja-channel-push! 1 0) @@ -753,7 +753,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 26)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 26)) num-func-seek!) ) @@ -766,7 +766,7 @@ (set! (-> a0-6 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 22)) frames num-frames) -1)) ) - (set! (-> a0-6 param 1) (-> arg0 0)) + (set! (-> a0-6 param 1) (-> arg0 anim-speed)) (set! (-> a0-6 frame-num) 0.0) (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> this draw art-group data 22)) num-func-seek!) ) @@ -781,7 +781,7 @@ (set! (-> a0-8 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 30)) frames num-frames) -1)) ) - (set! (-> a0-8 param 1) (-> arg0 0)) + (set! (-> a0-8 param 1) (-> arg0 anim-speed)) (set! (-> a0-8 frame-num) 0.0) (joint-control-channel-group! a0-8 (the-as art-joint-anim (-> this draw art-group data 30)) num-func-seek!) ) @@ -793,7 +793,7 @@ (set! (-> a0-10 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 32)) frames num-frames) -1)) ) - (set! (-> a0-10 param 1) (-> arg0 0)) + (set! (-> a0-10 param 1) (-> arg0 anim-speed)) (set! (-> a0-10 frame-num) 0.0) (joint-control-channel-group! a0-10 (the-as art-joint-anim (-> this draw art-group data 32)) num-func-seek!) ) @@ -804,7 +804,7 @@ ) ) -(defmethod enemy-method-78 ((this monster-frog) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this monster-frog) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (ja-channel-push! 1 (seconds 0.17)) @@ -813,7 +813,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 27)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 27)) num-func-seek!) ) @@ -826,7 +826,7 @@ (set! (-> a0-6 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 23)) frames num-frames) -1)) ) - (set! (-> a0-6 param 1) (-> arg0 0)) + (set! (-> a0-6 param 1) (-> arg0 anim-speed)) (set! (-> a0-6 frame-num) 0.0) (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> this draw art-group data 23)) num-func-seek!) ) @@ -841,7 +841,7 @@ (set! (-> a0-8 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 31)) frames num-frames) -1)) ) - (set! (-> a0-8 param 1) (-> arg0 0)) + (set! (-> a0-8 param 1) (-> arg0 anim-speed)) (set! (-> a0-8 frame-num) 0.0) (joint-control-channel-group! a0-8 (the-as art-joint-anim (-> this draw art-group data 31)) num-func-seek!) ) @@ -853,7 +853,7 @@ (set! (-> a0-10 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 33)) frames num-frames) -1)) ) - (set! (-> a0-10 param 1) (-> arg0 0)) + (set! (-> a0-10 param 1) (-> arg0 anim-speed)) (set! (-> a0-10 frame-num) 0.0) (joint-control-channel-group! a0-10 (the-as art-joint-anim (-> this draw art-group data 33)) num-func-seek!) ) @@ -864,13 +864,13 @@ ) ) -(defmethod track-target! ((this monster-frog)) +(defmethod common-post ((this monster-frog)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (water-control-method-10 (-> this water)) - ((method-of-type nav-enemy track-target!) this) + ((method-of-type nav-enemy common-post) this) (none) ) diff --git a/goal_src/jak2/levels/tomb/tomb-baby-spider.gc b/goal_src/jak2/levels/tomb/tomb-baby-spider.gc index 4789cb5515..12b05295ae 100644 --- a/goal_src/jak2/levels/tomb/tomb-baby-spider.gc +++ b/goal_src/jak2/levels/tomb/tomb-baby-spider.gc @@ -165,7 +165,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info walk-anim)) :num! (seek! max f30-0) @@ -175,7 +175,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (when (enemy-method-123 self 0.2) + (when (rnd-go-idle? self 0.2) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.2)) (let ((v1-37 self)) @@ -193,7 +193,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (until (not (enemy-method-123 self 0.2)) + (until (not (rnd-go-idle? self 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -234,7 +234,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (let ((gp-0 (new 'stack-no-clear 'vector))) (let ((a0-3 (handle->process (-> self focus handle)))) (cond @@ -270,7 +270,7 @@ :event enemy-event-handler :enter (behavior () (nav-enemy-method-166 self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let ((v1-9 (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 1))) (set! (-> v1-9 local-sphere w) 4915.2) @@ -288,8 +288,8 @@ (let ((v1-3 (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 1))) (set! (-> v1-3 local-sphere w) 819.2) ) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -297,8 +297,8 @@ ) :trans (behavior () (enemy-method-49 self) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) ) ) :code (behavior () @@ -427,7 +427,7 @@ ) ) -(defmethod enemy-method-77 ((this tomb-baby-spider) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this tomb-baby-spider) (arg0 enemy-knocked-info)) (let* ((a2-0 (the-as collide-shape-prim-group (-> this root root-prim))) (v1-2 (-> a2-0 child 3)) ) @@ -447,7 +447,7 @@ (set! (-> v1-6 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 20)) frames num-frames) -1)) ) - (set! (-> v1-6 param 1) (-> arg0 0)) + (set! (-> v1-6 param 1) (-> arg0 anim-speed)) (set! (-> v1-6 frame-num) 0.0) (joint-control-channel-group! v1-6 (the-as art-joint-anim (-> this draw art-group data 20)) num-func-seek!) ) @@ -459,7 +459,7 @@ (set! (-> v1-11 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 17)) frames num-frames) -1)) ) - (set! (-> v1-11 param 1) (-> arg0 0)) + (set! (-> v1-11 param 1) (-> arg0 anim-speed)) (set! (-> v1-11 frame-num) 0.0) (joint-control-channel-group! v1-11 (the-as art-joint-anim (-> this draw art-group data 17)) num-func-seek!) ) @@ -471,7 +471,7 @@ ) ) -(defmethod enemy-method-78 ((this tomb-baby-spider) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this tomb-baby-spider) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (let ((v1-3 (-> this skel root-channel 0))) @@ -479,7 +479,7 @@ (set! (-> v1-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 22)) frames num-frames) -1)) ) - (set! (-> v1-3 param 1) (-> arg0 0)) + (set! (-> v1-3 param 1) (-> arg0 anim-speed)) (set! (-> v1-3 frame-num) 0.0) (joint-control-channel-group! v1-3 (the-as art-joint-anim (-> this draw art-group data 22)) num-func-seek!) ) @@ -491,7 +491,7 @@ (set! (-> v1-8 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 18)) frames num-frames) -1)) ) - (set! (-> v1-8 param 1) (-> arg0 0)) + (set! (-> v1-8 param 1) (-> arg0 anim-speed)) (set! (-> v1-8 frame-num) 0.0) (joint-control-channel-group! v1-8 (the-as art-joint-anim (-> this draw art-group data 18)) num-func-seek!) ) @@ -595,7 +595,7 @@ (shove-up (* f0-0 (-> this enemy-info attack-shove-up))) (mode (-> this enemy-info attack-mode)) (damage (the float (-> this enemy-info attack-damage))) - (knock (the-as uint 8)) + (knock (knocked-type knocked-type-8)) ) ) ) diff --git a/goal_src/jak2/levels/tomb/tomb-beetle.gc b/goal_src/jak2/levels/tomb/tomb-beetle.gc index 384f950f95..53e0cdd4a1 100644 --- a/goal_src/jak2/levels/tomb/tomb-beetle.gc +++ b/goal_src/jak2/levels/tomb/tomb-beetle.gc @@ -533,8 +533,8 @@ (set! (-> gp-0 0 dist) (vector-vector-distance (-> self root trans) (the-as vector (-> gp-0 0)))) ) (vector-reset! (-> self root transv)) - (set! (-> self fly-away-acc) (get-rand-float-range self 204800.0 512000.0)) - (set! (-> self fly-away-ry-speed) (get-rand-float-range self 32768.0 109226.664)) + (set! (-> self fly-away-acc) (rnd-float-range self 204800.0 512000.0)) + (set! (-> self fly-away-ry-speed) (rnd-float-range self 32768.0 109226.664)) (set! (-> self flying?) #f) ) :trans (behavior () @@ -651,7 +651,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 1.8 2.2))) + (let ((f30-0 (rnd-float-range self 1.8 2.2))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info die-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -991,7 +991,7 @@ (set! (-> v1-5 sphere-mask) (the-as uint #x800fa)) ) 0 - (logclear! (-> this enemy-flags) (enemy-flag check-water-backup no-initial-move-to-ground)) + (logclear! (-> this enemy-flags) (enemy-flag trackable trackable-backup)) (set! (-> this flags) (the-as uint 0)) (logclear! (-> this mask) (process-mask actor-pause)) 0 diff --git a/goal_src/jak2/levels/tomb/tomb-boulder.gc b/goal_src/jak2/levels/tomb/tomb-boulder.gc index 8632cc7c0a..97e882b82e 100644 --- a/goal_src/jak2/levels/tomb/tomb-boulder.gc +++ b/goal_src/jak2/levels/tomb/tomb-boulder.gc @@ -99,7 +99,7 @@ ) (deftype tomb-spider (process-drawable) - ((root collide-shape-moving :override) + ((root collide-shape-moving :override) ) (:state-methods idle @@ -181,8 +181,8 @@ ) (deftype tomb-boulder-stop (process-drawable) - ((root collide-shape-moving :override) - (prefix string) + ((root collide-shape-moving :override) + (prefix string) ) (:state-methods idle @@ -521,7 +521,9 @@ (set! (-> self sub-mode) (the-as uint 0)) (set! (-> self current-speed) 0.0) (set! (-> self previous-y-vel) 0.0) - (set! (-> self previous-y) (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 4)) y)) + (set! (-> self previous-y) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node tomb-boulder-lod0-jg boulderrot)) y) + ) (set! (-> self spider) (process-spawn tomb-spider :init tomb-spider-init :to self)) (set! (-> self explode) (process-spawn @@ -760,7 +762,7 @@ ((or (zero? v1-0) (= v1-0 1)) (when (and (not (-> self target-pause)) (not (-> self current-pause))) (let ((gp-0 (new 'stack-no-clear 'collide-query))) - (vector<-cspace! (-> gp-0 start-pos) (-> self node-list data 4)) + (vector<-cspace! (-> gp-0 start-pos) (joint-node tomb-boulder-lod0-jg boulderrot)) (set-vector! (-> gp-0 move-dist) 0.0 -24576.0 0.0 1.0) (let ((v1-7 gp-0)) (set! (-> v1-7 radius) 409.6) @@ -968,11 +970,9 @@ (seek! (-> self target-speed) f30-3 (* 20.0 (seconds-per-frame))) ) (seek! (-> self target-speed) f30-3 (seconds-per-frame)) - (when (or (!= (-> self target-speed) (-> self current-speed)) - (>= (- (current-time) (-> self speed-time)) (seconds 0.2)) - ) + (when (or (!= (-> self target-speed) (-> self current-speed)) (time-elapsed? (-> self speed-time) (seconds 0.2))) (set! (-> self current-speed) (-> self target-speed)) - (set! (-> self speed-time) (current-time)) + (set-time! (-> self speed-time)) (when *sound-player-enable* (let ((v1-151 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) (set! (-> v1-151 command) (sound-command set-param)) @@ -998,15 +998,15 @@ ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! ((obj tomb-boulder) (arg0 entity-actor)) +(defmethod init-from-entity! ((this tomb-boulder) (arg0 entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (stack-size-set! (-> obj main-thread) 512) - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (stack-size-set! (-> this main-thread) 512) + (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s4-0 reaction) cshape-reaction-default) (set! (-> s4-0 no-reaction) @@ -1028,24 +1028,24 @@ This commonly includes things such as: (set! (-> s4-0 backup-collide-as) (-> v1-18 prim-core collide-as)) (set! (-> s4-0 backup-collide-with) (-> v1-18 prim-core collide-with)) ) - (set! (-> obj root) s4-0) + (set! (-> this root) s4-0) ) - (process-drawable-from-entity! obj arg0) - (logclear! (-> obj mask) (process-mask actor-pause)) + (process-drawable-from-entity! this arg0) + (logclear! (-> this mask) (process-mask actor-pause)) (initialize-skeleton - obj + this (the-as skeleton-group (art-group-get-by-name *level* "skel-tomb-boulder" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (logior! (-> obj skel status) (joint-control-status sync-math)) - (set! (-> obj art-name) "tomb-boulder") - (set! (-> obj loop-id) (new-sound-id)) - (set! (-> obj target-pause) #f) - (set! (-> obj current-pause) #f) - (set-vector! (-> obj dir) 1.0 0.0 0.0 1.0) - (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 739) obj)) - (set! (-> obj draw light-index) (the-as uint 11)) - (go (method-of-object obj idle)) + (logior! (-> this skel status) (joint-control-status sync-math)) + (set! (-> this art-name) "tomb-boulder") + (set! (-> this loop-id) (new-sound-id)) + (set! (-> this target-pause) #f) + (set! (-> this current-pause) #f) + (set-vector! (-> this dir) 1.0 0.0 0.0 1.0) + (set! (-> this part) (create-launch-control (-> *part-group-id-table* 739) this)) + (set! (-> this draw light-index) (the-as uint 11)) + (go (method-of-object this idle)) (none) ) @@ -1159,8 +1159,8 @@ This commonly includes things such as: ) (deftype spider-eyes (process-drawable) - ((root collide-shape-moving :override) - (node-index uint32) + ((root collide-shape-moving :override) + (node-index uint32) ) (:state-methods idle @@ -1171,7 +1171,7 @@ This commonly includes things such as: ) -(defmethod spider-eyes-method-21 ((obj spider-eyes)) +(defmethod spider-eyes-method-21 ((this spider-eyes)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1185,12 +1185,12 @@ This commonly includes things such as: (gp-0 (new 'stack-no-clear 'vector)) ) (let ((f0-3 (* 0.25 (sin (* 0.5 (-> *camera-other-fov* data)))))) - (set-vector! (-> obj root scale) f0-3 f0-3 f0-3 1.0) + (set-vector! (-> this root scale) f0-3 f0-3 f0-3 1.0) ) (set! (-> gp-0 quad) (-> *camera-other-trans* quad)) (vector-normalize-copy! s5-0 (-> s3-0 vector 2) 1.0) - (matrix->quaternion (-> obj root quat) s3-0) - (let ((v1-8 (-> obj root trans))) + (matrix->quaternion (-> this root quat) s3-0) + (let ((v1-8 (-> this root trans))) (let ((a0-8 2048.0)) (.mov vf7 a0-8) ) diff --git a/goal_src/jak2/levels/tomb/widow-baron.gc b/goal_src/jak2/levels/tomb/widow-baron.gc index 4213a585be..9e4bbe7379 100644 --- a/goal_src/jak2/levels/tomb/widow-baron.gc +++ b/goal_src/jak2/levels/tomb/widow-baron.gc @@ -1020,7 +1020,7 @@ This commonly includes things such as: ) ) (('child-jumped) - (set! v0-0 (logclear (-> (the-as spydroid arg0) enemy-flags) (enemy-flag alert))) + (set! v0-0 (logclear (-> (the-as spydroid arg0) enemy-flags) (enemy-flag directed))) (set! (-> (the-as spydroid arg0) enemy-flags) (the-as enemy-flag v0-0)) v0-0 ) diff --git a/goal_src/jak2/levels/under/centipede.gc b/goal_src/jak2/levels/under/centipede.gc index cc95506bd7..14efdf2719 100644 --- a/goal_src/jak2/levels/under/centipede.gc +++ b/goal_src/jak2/levels/under/centipede.gc @@ -319,7 +319,7 @@ ((and janim (= janim (-> this draw art-group data 4))) (when (ja-done? 1) (-> this draw art-group data 7) - (let ((v1-10 (get-rand-int this 100)) + (let ((v1-10 (rnd-int-count this 100)) (a0-9 (if (> (-> this skel active-channels) 0) (-> this skel root-channel 1 frame-group) ) @@ -332,7 +332,7 @@ ) ((= a0-9 (-> this draw art-group data 11)) (set! s5-0 (-> this draw art-group data 12)) - (set! (-> this anim-ctr) (get-rand-int-range this 0 3)) + (set! (-> this anim-ctr) (rnd-int-range this 0 3)) ) ((= a0-9 (-> this draw art-group data 12)) (let ((v1-20 (-> this anim-ctr))) @@ -349,7 +349,7 @@ ) ((= a0-9 (-> this draw art-group data 13)) (set! s5-0 (-> this draw art-group data 14)) - (set! (-> this anim-ctr) (get-rand-int-range this 0 3)) + (set! (-> this anim-ctr) (rnd-int-range this 0 3)) ) ((and (= a0-9 (-> this draw art-group data 14)) (> (-> this anim-ctr) 0)) (+! (-> this anim-ctr) -1) @@ -369,7 +369,7 @@ ) (else (set! s5-0 (-> this draw art-group data 7)) - (set! (-> this anim-ctr) (get-rand-int-range this 2 6)) + (set! (-> this anim-ctr) (rnd-int-range this 2 6)) ) ) ) @@ -412,7 +412,7 @@ (set! (-> a0-22 param 1) 1.0) (joint-control-channel-group! a0-22 (the-as art-joint-anim (-> this draw art-group data 7)) num-func-seek!) ) - (set! (-> this anim-ctr) (get-rand-int-range this 2 6)) + (set! (-> this anim-ctr) (rnd-int-range this 2 6)) (when (not (-> this using-chan1-effects?)) (set! (-> this using-chan1-effects?) #t) (let ((v1-106 (-> this skel effect))) @@ -609,12 +609,12 @@ (none) ) -(defmethod track-target! ((this centipede)) +(defmethod common-post ((this centipede)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (let ((a0-3 (handle->process (-> this focus handle)))) @@ -702,7 +702,7 @@ ) ((task-node-closed? (game-task-node under-sig-centipede1-start)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (process-entity-status! this (entity-perm-status no-kill) #t) (go (method-of-object this grab-cam)) ) @@ -722,7 +722,7 @@ ) ((task-node-closed? (game-task-node under-sig-centipede2-start)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (process-entity-status! this (entity-perm-status no-kill) #t) (go (method-of-object this grab-cam)) ) @@ -768,7 +768,7 @@ (set-chan1-effects self) ) :code (behavior () - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logior! (-> self enemy-flags) (enemy-flag alert)) (set! (-> self desired-talking-volume) 0.0) (centipede-method-187 self) (set-setting! 'interp-time 'abs 0.0 0) @@ -781,8 +781,8 @@ (until #f (let ((v1-13 *camera*)) (when (and v1-13 (-> v1-13 slave)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) - (logior! (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logclear! (-> self enemy-flags) (enemy-flag use-notice-distance directed directed-ready use-trigger)) + (logior! (-> self enemy-flags) (enemy-flag chase-startup)) (logclear! (-> self mask) (process-mask actor-pause)) (go-hostile self) ) @@ -803,8 +803,8 @@ ) ) (stop-looking-at-target! self) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> self enemy-flags) (enemy-flag alert)) (vector-reset! (-> self root transv)) (set! (-> self desired-talking-volume) 1.0) ) @@ -846,8 +846,8 @@ ) ) (stop-looking-at-target! self) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> self enemy-flags) (enemy-flag alert)) (vector-reset! (-> self root transv)) (set! (-> self desired-talking-volume) 1.0) ) @@ -872,8 +872,8 @@ ) ) (stop-looking-at-target! self) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> self enemy-flags) (enemy-flag alert)) (vector-reset! (-> self root transv)) (set! (-> self desired-talking-volume) 1.0) ) @@ -1031,7 +1031,7 @@ ) 0 (nav-enemy-method-167 self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (set! (-> self grabbed-focus?) #f) (vector-reset! (-> self root transv)) (set! (-> self desired-talking-volume) 0.0) @@ -1045,7 +1045,7 @@ (quaternion-copy! (-> self dest-quat) (-> self src-quat)) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () (when (-> self grabbed-focus?) @@ -1304,7 +1304,7 @@ ) 0 (set-gravity-length (-> this root dynam) 573440.0) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (set! (-> this bobbing) (the-as trsqv (new 'process 'joint-mod-set-world this 3 #t))) (set! (-> this sound) (new 'process 'ambient-sound (static-sound-spec "cent-talk" :fo-max 90) (-> this root trans)) diff --git a/goal_src/jak2/levels/under/jellyfish.gc b/goal_src/jak2/levels/under/jellyfish.gc index eb025b570f..150a7ac430 100644 --- a/goal_src/jak2/levels/under/jellyfish.gc +++ b/goal_src/jak2/levels/under/jellyfish.gc @@ -413,7 +413,7 @@ ) ) (set! (-> self charge-path-timer) 0) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) ) :trans (behavior () (local-vars (gp-0 vector)) @@ -503,7 +503,7 @@ :event enemy-event-handler :enter (behavior () (set! *jellyfish-mech-reserved* #t) - (look-at-target! self (enemy-flag death-start)) + (look-at-target! self (enemy-flag look-at-move-dest)) (hover-nav-control-method-14 (-> self hover) 8.0 10.0) (hover-nav-control-method-10 (-> self hover) @@ -516,7 +516,7 @@ ) :exit (behavior () (hover-nav-control-method-14 (-> self hover) 1.0 1.0) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -718,7 +718,7 @@ :virtual #t :event enemy-event-handler :code (behavior () - (dispose! self) + (dying self) (logclear! (-> self focus-status) (focus-status dangerous)) (enemy-method-52 self (-> self root transv)) (let ((gp-0 (current-time))) @@ -765,7 +765,7 @@ :virtual #t :event enemy-event-handler :code (behavior () - (dispose! self) + (dying self) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -792,15 +792,15 @@ (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (go (method-of-object this die)) @@ -1013,7 +1013,7 @@ (none) ) -(defmethod track-target! ((this jellyfish)) +(defmethod common-post ((this jellyfish)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -1050,7 +1050,7 @@ ) ) (set! (-> this path-my-u) (get-furthest-point-on-path (-> this path) (-> this root trans))) - ((method-of-type hover-enemy track-target!) this) + ((method-of-type hover-enemy common-post) this) (none) ) @@ -1180,7 +1180,7 @@ (set! (-> this root dynam gravity-length) 40960.0) (set! (-> this root dynam gravity-max) 40960.0) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (new-source! (-> this los) this (seconds 1) (collide-spec backgnd enemy obstacle hit-by-others-list)) (set-time! (-> this last-fire-time)) (set! (-> this last-attack-time) 0) diff --git a/goal_src/jak2/levels/under/pipe-grunt.gc b/goal_src/jak2/levels/under/pipe-grunt.gc index 37a401012d..c8e26076dc 100644 --- a/goal_src/jak2/levels/under/pipe-grunt.gc +++ b/goal_src/jak2/levels/under/pipe-grunt.gc @@ -31,9 +31,9 @@ (let ((f30-0 (vector-length s3-0))) (vector-normalize! s3-0 1.0) (vector-rotate90-around-y! s4-0 s3-0) - (vector-normalize-copy! (-> this event-param-point) s3-0 (get-rand-float-range this 0.0 f30-0)) + (vector-normalize-copy! (-> this event-param-point) s3-0 (rnd-float-range this 0.0 f30-0)) ) - (vector-normalize! s4-0 (get-rand-float-range this -16384.0 16384.0)) + (vector-normalize! s4-0 (rnd-float-range this -16384.0 16384.0)) (vector+! (-> this event-param-point) (-> this event-param-point) s4-0) ) (vector+! (-> this event-param-point) (-> this event-param-point) gp-0) @@ -45,8 +45,8 @@ :event enemy-event-handler :enter (behavior () (set-time! (-> self state-time)) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice alert victory)) + (logior! (-> self enemy-flags) (enemy-flag alert)) + (logclear! (-> self enemy-flags) (enemy-flag use-notice-distance directed directed-ready)) (let ((v1-7 (-> self root root-prim))) (set! (-> v1-7 prim-core collide-as) (-> self root backup-collide-as)) (set! (-> v1-7 prim-core collide-with) (-> self root backup-collide-with)) @@ -61,11 +61,11 @@ (vector-! (-> self pipe-dir) (-> self pipe-front) (-> self root trans)) (vector-normalize! (-> self pipe-dir) 1.0) (quaternion-look-at! (-> self root quat) (-> self pipe-dir) *up-vector*) - (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (get-rand-int self 3))) + (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (rnd-int-count self 3))) (vector-normalize-copy! (-> self root transv) (-> self pipe-dir) (-> self charge-anim travel-speed)) (let ((gp-0 (new 'stack-no-clear 'vector))) (vector-rotate90-around-y! gp-0 (-> self pipe-dir)) - (vector-normalize! gp-0 (get-rand-float-range self -4096.0 4096.0)) + (vector-normalize! gp-0 (rnd-float-range self -4096.0 4096.0)) (move-by-vector! (-> self root) gp-0) ) ) @@ -78,14 +78,16 @@ (vector-! v1-4 (-> self pipe-front) gp-0) (when (< (vector-dot v1-4 (-> self pipe-dir)) 0.0) (pipe-grunt-method-186 self) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 0 (-> self event-param-point)) ) ) ) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-channel-push! 1 0) (until #f (let ((a1-2 (-> self draw art-group data (-> self charge-anim anim-index)))) diff --git a/goal_src/jak2/levels/under/sig5-course.gc b/goal_src/jak2/levels/under/sig5-course.gc index c0fd3747e8..6c0566138d 100644 --- a/goal_src/jak2/levels/under/sig5-course.gc +++ b/goal_src/jak2/levels/under/sig5-course.gc @@ -38,7 +38,7 @@ (defmethod sig-under-method-263 ((this sig-under)) (let ((s5-0 (current-time))) (when (and (>= s5-0 (-> this next-chase-play-time)) - (not (channel-active? this (the-as uint 0))) + (not (channel-active? this (gui-channel none))) (>= (the-as int (sig-method-256 this)) 750) ) (let ((a1-2 (bot-speech-list-method-9 @@ -51,7 +51,7 @@ ) (when (>= a1-2 0) (play-speech this a1-2) - (set! (-> this next-chase-play-time) (+ s5-0 (get-rand-int-range this 1500 2700))) + (set! (-> this next-chase-play-time) (+ s5-0 (rnd-int-range this 1500 2700))) ) ) ) @@ -165,7 +165,7 @@ ) (cond ((speech-playing? this 7) - (and (not (channel-active? this (the-as uint 0))) (scene-play this "under-centipede-one" #f)) + (and (not (channel-active? this (gui-channel none))) (scene-play this "under-centipede-one" #f)) ) (else (play-speech this 7) @@ -178,7 +178,7 @@ (defmethod sig-under-method-264 ((this sig-under)) (and (logtest? (-> this bot-task-bits) (bot-task-bits botbits-3)) - (not (channel-active? this (the-as uint 0))) + (not (channel-active? this (gui-channel none))) (scene-play this "under-get-sig-out-res" #f) ) ) @@ -325,7 +325,7 @@ (vector-normalize! gp-0 1.0) (set-heading-vec! (-> self root) gp-0) ) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (let ((v1-11 self)) (set! (-> v1-11 enemy-flags) (the-as enemy-flag (logclear (-> v1-11 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-11 nav callback-info) *nav-enemy-null-callback-info*) @@ -336,7 +336,7 @@ (set! (-> self focus-mode) 1) (logior! (-> self bot-flags) (bot-flags bf11 bf18)) (logior! (-> self root penetrated-by) (penetrate jak-yellow-shot jak-red-shot jak-blue-shot jak-dark-shot)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) ) :exit (behavior () (logclear! (-> self bot-flags) (bot-flags bf18)) @@ -354,14 +354,14 @@ ) :code (behavior () (until #f - (let ((gp-0 (get-rand-int self 2))) + (let ((gp-0 (rnd-int-count self 2))) (let ((s5-0 (new 'stack-no-clear 'vector))) (if (and (not (logtest? (-> self bot-task-bits) (bot-task-bits botbits-0))) (zero? gp-0)) (set! (-> s5-0 quad) (-> self sig5-course spots 2 center quad)) (set! (-> s5-0 quad) (-> self sig5-course spots 1 center quad)) ) - (+! (-> s5-0 x) (get-rand-float-range self -20480.0 20480.0)) - (+! (-> s5-0 y) (get-rand-float-range self 0.0 20480.0)) + (+! (-> s5-0 x) (rnd-float-range self -20480.0 20480.0)) + (+! (-> s5-0 y) (rnd-float-range self 0.0 20480.0)) (send-event (ppointer->process (-> self my-simple-focus)) 'move-trans s5-0) ) (set! (-> self shot-at-growls-index) gp-0) @@ -395,7 +395,7 @@ (when #t (set-time! (-> self state-time)) (logclear! (-> self bot-flags) (bot-flags bf18)) - (let ((gp-3 (+ (current-time) (get-rand-int-range self 30 600)))) + (let ((gp-3 (+ (current-time) (rnd-int-range self 30 600)))) (ja-channel-push! 1 (seconds 0.5)) (ja-no-eval :group! sig-ready0-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) @@ -574,7 +574,7 @@ :on-set (lambda ((arg0 sig-under)) (logclear! (-> arg0 bot-task-bits) (bot-task-bits botbits-2)) (logior! (-> arg0 bot-flags) (bot-flags bf06)) - (logior! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> arg0 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (set! (-> arg0 notice-enemy-dist) 122880.0) (clear-poi-and-focus! arg0) (set! (-> arg0 focus-mode) 0) @@ -624,7 +624,7 @@ #t ) (else - (if (and (not (speech-playing? arg1 6)) (not (channel-active? arg1 (the-as uint 0)))) + (if (and (not (speech-playing? arg1 6)) (not (channel-active? arg1 (gui-channel none)))) (play-speech arg1 6) ) #f @@ -817,7 +817,7 @@ :nav-mesh-index 2 :skip-to -1 :on-set (lambda ((arg0 sig-under)) - (set! (-> arg0 next-chase-play-time) (+ (current-time) (get-rand-int-range arg0 900 1500))) + (set! (-> arg0 next-chase-play-time) (+ (current-time) (rnd-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)) @@ -896,7 +896,7 @@ :nav-mesh-index 3 :skip-to -1 :on-set (lambda ((arg0 sig-under)) - (logior! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> arg0 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (reset-warn-time! arg0) (move-to-point! (-> arg0 root) (the-as vector (-> arg0 sig5-course spots 10))) (set-vector! (-> arg0 root quat) 0.0 0.5874 0.0 0.8092) @@ -1107,12 +1107,12 @@ (lambda ((arg0 object) (arg1 sig-under)) (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) (not (speech-playing? arg1 10)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 10) (reset-warn-time! arg1) ) - (when (and (speech-playing? arg1 10) (not (channel-active? arg1 (the-as uint 0)))) + (when (and (speech-playing? arg1 10) (not (channel-active? arg1 (gui-channel none)))) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) (go-to-waypoint! arg1 19 #f) (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) @@ -1229,7 +1229,7 @@ (clear-poi-and-focus! arg0) (logior! (-> arg0 focus-status) (focus-status disable)) (set! (-> arg0 notice-enemy-dist) 0.0) - (logclear! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> arg0 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (clear-focused (-> arg0 focus)) (logior! (-> arg0 bot-flags) (bot-flags bf26)) (when (and (process-grab? arg0 #t) (process-grab? *target* #t)) @@ -1297,7 +1297,7 @@ (lambda ((arg0 object) (arg1 sig-under)) (if (and (not (speech-playing? arg1 12)) (time-elapsed? (-> arg1 waypoint-time0) (seconds 1.5)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 12) ) @@ -1417,7 +1417,7 @@ (label cfg-21) (when v1-14 (when (scene-play arg1 "under-centipede-three" #f) - (logclear! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> arg1 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (reset-warn-time! arg1) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) (go-to-waypoint! arg1 23 #f) @@ -1446,7 +1446,7 @@ ) (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) (logclear! (-> arg0 focus-status) (focus-status disable)) - (logior! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> arg0 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (process-entity-status! arg0 (entity-perm-status no-kill) #t) (logior! (-> arg0 bot-flags) (bot-flags bf06)) (set! (-> arg0 notice-enemy-dist) 122880.0) @@ -1498,7 +1498,7 @@ :nav-mesh-index 7 :skip-to -1 :on-set (lambda ((arg0 sig-under)) - (set! (-> arg0 next-chase-play-time) (+ (current-time) (get-rand-int-range arg0 600 1200))) + (set! (-> arg0 next-chase-play-time) (+ (current-time) (rnd-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) @@ -1521,14 +1521,16 @@ (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) ) ) - (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) + (set! (-> arg1 enemy-flags) + (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag jump-check-blocked))) + ) (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))) + (when (and (not (channel-active? arg1 (gui-channel none))) (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) + (case (rnd-int-count arg1 3) ((1) (set! s5-2 19) ) @@ -1587,11 +1589,11 @@ (not (logtest? (-> arg1 focus-status) (focus-status in-air))) ) (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-1)) - (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> arg1 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) (if (and (time-elapsed? (-> arg1 waypoint-time0) (seconds 1)) (not (speech-playing? arg1 21)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 21) ) @@ -1635,10 +1637,12 @@ ) ) ) - (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) + (set! (-> arg1 enemy-flags) + (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag jump-check-blocked))) + ) (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))) + (logclear! (-> arg1 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) + (if (not (channel-active? arg1 (gui-channel none))) (play-speech arg1 22) ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) @@ -1682,7 +1686,7 @@ (not (logtest? (-> arg1 focus-status) (focus-status in-air))) ) (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) - (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> arg1 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) (cond ((sig-under-method-264 arg1) @@ -1694,7 +1698,7 @@ (else (if (and (not (speech-playing? arg1 23)) (time-elapsed? (-> arg1 waypoint-time0) (seconds 3.5)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 23) ) @@ -1718,7 +1722,7 @@ :on-set (lambda ((arg0 sig-under)) (remove-setting! 'music) (stop-speech arg0 (the-as uint 0) #f) - (logclear! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> arg0 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (let ((v1-8 (-> arg0 sig5-course spots 35))) (set! (-> v1-8 center quad) (-> arg0 root trans quad)) (set! (-> v1-8 center w) 16384.0) @@ -1754,7 +1758,7 @@ :on-set (lambda ((arg0 sig-under)) (process-entity-status! arg0 (entity-perm-status bit-4) #f) (process-entity-status! arg0 (entity-perm-status no-kill) #f) - (logclear! (-> arg0 enemy-flags) (enemy-flag use-notice-distance)) + (logclear! (-> arg0 enemy-flags) (enemy-flag cam-attack-mode)) (logclear! (-> arg0 bot-flags) (bot-flags bf06)) (bot-method-196 arg0) (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) diff --git a/goal_src/jak2/pc/pckernel-impl.gc b/goal_src/jak2/pc/pckernel-impl.gc index 7b29dd36d7..d6f72a6dcb 100644 --- a/goal_src/jak2/pc/pckernel-impl.gc +++ b/goal_src/jak2/pc/pckernel-impl.gc @@ -81,7 +81,8 @@ (cheats-revealed pc-cheats) (cheats-purchased pc-cheats) (cheats-unlocked pc-cheats) - (cheats-backup pc-cheats) ;; backup for 'cheats', persisted to disk to be restored when disabling speedrunner mode + (cheats-mask pc-cheats) + (cheats-backup pc-cheats) ;; backup for 'cheats', persisted to disk to be restored when disabling speedrunner mode TODO use mask instead ;; music (music-unlocked bit-array) (flava-unlocked symbol 6) @@ -90,6 +91,8 @@ (fast-airlock? symbol) (fast-elevator? symbol) (fast-progress? symbol) + + (stats statistics) ;; gfx (smooth-minimap? symbol) @@ -169,6 +172,8 @@ (clear-all! (-> obj music-unlocked)) (dotimes (i 6) (set! (-> obj flava-unlocked i) #f)) + + (set! (-> obj stats) *statistics*) 0) (defmethod reset-input ((obj pc-settings-jak2) (device symbol) (call-handlers symbol)) @@ -286,9 +291,9 @@ (defmacro lock-cheat! (&rest cheats) `(begin (logclear! (-> *pc-settings* cheats) (pc-cheats ,@cheats)) - (logclear! (-> *pc-settings* purchased-cheats) (pc-cheats ,@cheats)) - (logclear! (-> *pc-settings* unlocked-cheats) (pc-cheats ,@cheats)) - (logclear! (-> *pc-settings* revealed-cheats) (pc-cheats ,@cheats)) + (logclear! (-> *pc-settings* cheats-purchased) (pc-cheats ,@cheats)) + (logclear! (-> *pc-settings* cheats-unlocked) (pc-cheats ,@cheats)) + (logclear! (-> *pc-settings* cheats-revealed) (pc-cheats ,@cheats)) ) ) diff --git a/goal_src/jak2/pc/pckernel.gc b/goal_src/jak2/pc/pckernel.gc index 57b90f3c39..55c734cf38 100644 --- a/goal_src/jak2/pc/pckernel.gc +++ b/goal_src/jak2/pc/pckernel.gc @@ -37,7 +37,7 @@ (defun pc-cheat-health-bars-unlock () "#t = cheat unlock requirements met. #f = locked" - #f) + (>= (get-count-for-enemy (-> *pc-settings* stats kill-stats) 'civilian) (-> *pc-cheat-state* kill-civvie-target))) (defun pc-cheat-vehicle-health-bars-unlock () "#t = cheat unlock requirements met. #f = locked" @@ -95,7 +95,7 @@ (defun pc-cheat-statistics-unlock () "#t = cheat unlock requirements met. #f = locked" - #f) + (killed-each-metalhead?)) (defun pc-cheat-suck-in-all-unlock () "#t = cheat unlock requirements met. #f = locked" @@ -134,7 +134,7 @@ (progress-cheats-music-player music-player #f fortress-escape-introduction) (progress-cheats-real-time-of-day real-time-of-day #t fortress-escape-resolution) (progress-cheats-board-tricks board-tricks #t stadium-board1-gold) - ;(progress-cheats-health-bars health-bars #t palace-boss-resolution :unlock (progress-cheats-health-bars-unlock pc-cheat-health-bars-unlock)) + (progress-cheats-health-bars health-bars #t palace-boss-resolution :unlock (progress-cheats-health-bars-unlock pc-cheat-health-bars-unlock)) ;(progress-cheats-vehicle-health-bars vehicle-health-bars #t palace-boss-resolution :unlock (progress-cheats-vehicle-health-bars-unlock pc-cheat-vehicle-health-bars-unlock)) (progress-cheats-weather-bad weather-bad #t fortress-escape-resolution :skill 85) (progress-cheats-weather-good weather-good #t fortress-escape-resolution :skill 85) @@ -148,7 +148,7 @@ ;(progress-cheats-slow-movies slow-movies #t nest-boss-resolution :skill 200) ;(progress-cheats-fast-speed fast-speed #t nest-boss-resolution :skill 250) ;(progress-cheats-slow-speed slow-speed #t nest-boss-resolution :skill 250) - ;(progress-cheats-statistics statistics auto nest-boss-resolution :unlock (progress-cheats-statistics-unlock pc-cheat-statistics-unlock)) + ;(progress-cheats-statistics statistics auto atoll-water-introduction :unlock (progress-cheats-statistics-unlock pc-cheat-statistics-unlock)) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -614,7 +614,7 @@ ;; turbo jet board cheat (cond - ((and (pc-cheats? (-> *pc-settings* cheats) turbo-board) + ((and (pc-cheats? (-> obj cheats) turbo-board) *target* (focus-test? *target* board) (inside-city?)) @@ -743,6 +743,27 @@ (set! (-> obj flava-unlocked i) (file-stream-read-symbol file)) ) ) + (("stats") + (dosettings (file) + (case-str *pc-temp-string* + (("kill-stats") + (initialize (-> obj stats kill-stats)) + (dosettings (file) + (let ((enemy-stats (alloc-slot (-> obj stats kill-stats) (string->symbol *pc-temp-string*)))) + (dosettings (file) + (let ((source (string->kill-source *pc-temp-string*)) + (amount (file-stream-read-int file))) + (when (!= source (kill-stats-source unknown)) + (set! (-> enemy-stats sources source) amount) + ) + ) + ) + ) + ) + ) + ) + ) + ) ) 0) @@ -762,16 +783,32 @@ (format file " (cheats-purchased #x~x)~%" (-> obj cheats-purchased)) (format file " (cheats-unlocked #x~x)~%" (-> obj cheats-unlocked)) (format file " (cheats-backup #x~x)~%" (-> obj cheats-backup)) + (format file " (music-unlocked") (dotimes (i (/ (align64 (-> obj music-unlocked length)) 64)) (format file " #x~x" (int64<-bit-array (-> obj music-unlocked) (* i 64))) ) (format file ")~%") + (format file " (flava-unlocked") (dotimes (i 6) (format file " ~A" (-> obj flava-unlocked i)) ) (format file ")~%") + + (format file " (stats~%") + (format file " (kill-stats~%") + (dotimes (i KILL_STATS_MAX_ENEMY_TYPES) + (when (-> obj stats kill-stats enemies i name) + (format file " (~A~%" (-> obj stats kill-stats enemies i name)) + (dotimes (ii KILL_STATS_MAX_SOURCE) + (when (nonzero? (-> obj stats kill-stats enemies i sources ii)) + (format file " (~A ~D)~%" (string->symbol (kill-source->string (the kill-stats-source ii))) (-> obj stats kill-stats enemies i sources ii)) + )) + (format file " )~%") + )) + (format file " )~%") + (format file " )~%") 0) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -782,6 +819,7 @@ (define-once *pc-settings* (new 'global 'pc-settings-jak2)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; other ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/goal_src/jak2/pc/progress/progress-draw-pc.gc b/goal_src/jak2/pc/progress/progress-draw-pc.gc index e3e88c2c11..3f6107b926 100644 --- a/goal_src/jak2/pc/progress/progress-draw-pc.gc +++ b/goal_src/jak2/pc/progress/progress-draw-pc.gc @@ -1514,7 +1514,7 @@ (set! (-> arg1 origin x) 100.0) (if (not (-> *pc-settings* use-vis?)) (set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x))))) - (set! (-> arg1 width) 366.0) + (set! (-> arg1 width) (if (= (get-aspect-ratio) 'aspect16x9) 332.0 366.0)) (if (not (-> *pc-settings* use-vis?)) (*! (-> arg1 width) (-> *pc-settings* aspect-ratio-reciprocal))) (begin-scissor-secret sv-120 arg0) diff --git a/goal_src/jak2/pc/statistics-h.gc b/goal_src/jak2/pc/statistics-h.gc new file mode 100644 index 0000000000..6ae58fd62b --- /dev/null +++ b/goal_src/jak2/pc/statistics-h.gc @@ -0,0 +1,380 @@ +;;-*-Lisp-*- +(in-package goal) + +#| + Header file for the statistics code. + |# + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; constants +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +(defconstant KILL_STATS_MAX_ENEMY_TYPES 127) +(defconstant KILL_STATS_MAX_SOURCE 35) + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; types and enums +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +(defenum kill-stats-source + :type uint8 + (unknown) + + (gun-yellow) + (gun-red) + (gun-blue) + (gun-dark) + (board) + (board-trick) + (mech) + (mech-bonk) + (turret) + (punch) + (flop) + (uppercut) + (spin) + (roll) + + (darkjak-punch) + (darkjak-flop) + (darkjak-uppercut) + (darkjak-spin) + (darkjak-roll) + (darkjak-bomb0) + (darkjak-bomb1) + + (indax-punch) + (indax-spin) + + (guard) + (sig) + (ashelin) + (jinx) + (grim) + (mog) + (metalhead) + + (bot) + (enemy) + + (max) + ) + + +(deftype kill-statistics-source-entry (structure) + ((name symbol) + (amount int32) + ) + ) + +(deftype kill-statistics-enemy-entry (structure) + ((name symbol) + (sources int16 KILL_STATS_MAX_SOURCE) + ) + ) + + +(deftype kill-statistics (structure) + ((enemies kill-statistics-enemy-entry KILL_STATS_MAX_ENEMY_TYPES :inline) + (allow-unknown? symbol) + ) + + (:methods + (initialize (_type_) int) + (alloc-slot (_type_ symbol) kill-statistics-enemy-entry) + + (get-total-count (_type_) int) + (get-enemy-stats (_type_ symbol) kill-statistics-enemy-entry) + (get-count-for-enemy (_type_ symbol) int) + (get-count-for-source (_type_ kill-stats-source) int) + (get-count (_type_ symbol kill-stats-source) int) + + (increment (_type_ symbol kill-stats-source) int) + + (print-stats (_type_ object) object) + ) + ) + + +(deftype statistics (basic) + ((kill-stats kill-statistics :inline) + ) + (:methods + (new (symbol type) _type_) + (print-stats (_type_ object) object)) + ) + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; serializing +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + + +(defun kill-source->string ((ks kill-stats-source)) + (enum->string kill-stats-source ks)) + + +(defun string->kill-source ((ks string)) + "return kill-source based on name" + (string->enum kill-stats-source ks (kill-stats-source unknown))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; methods +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + + +(defmethod new statistics ((allocation symbol) (type-to-make type)) + "make a new statistics" + (let ((obj (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (initialize (-> obj kill-stats)) + (false! (-> obj kill-stats allow-unknown?)) + obj)) + + +(defmethod print-stats ((this statistics) out) + "print the stats as a table to out" + + (print-stats (-> this kill-stats) out) + out) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; kill stats methods +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + + +(defmethod initialize ((this kill-statistics)) + "initialize a kill-statistics to the default values" + + (dotimes (i KILL_STATS_MAX_ENEMY_TYPES) + (set! (-> this enemies i name) #f) + (dotimes (ii KILL_STATS_MAX_SOURCE) + (set! (-> this enemies i sources ii) 0) + ) + ) + + 0) + + +(defmethod get-total-count ((this kill-statistics)) + "return the total kill count for every thing tracked in the stats" + + (let ((amount 0)) + (dotimes (i KILL_STATS_MAX_ENEMY_TYPES) + (when (-> this enemies i name) + (dotimes (ii KILL_STATS_MAX_SOURCE) + (+! amount (-> this enemies i sources ii)) + ))) + amount) + ) + + +(defmethod get-enemy-stats ((this kill-statistics) (name symbol)) + "return the enemy entry with that name. #f = not found" + + (dotimes (i KILL_STATS_MAX_ENEMY_TYPES) + (when (= (-> this enemies i name) name) + (return (-> this enemies i)))) + (the kill-statistics-enemy-entry #f)) + +(defmethod alloc-slot ((this kill-statistics) (name symbol)) + "allocates an enemy stats entry for that name and returns it. #f = out of memory" + (dotimes (i KILL_STATS_MAX_ENEMY_TYPES) + (when (not (-> this enemies i name)) + (set! (-> this enemies i name) name) + (dotimes (ii KILL_STATS_MAX_SOURCE) + (set! (-> this enemies i sources ii) 0)) + (return (-> this enemies i))) + ) + (the kill-statistics-enemy-entry #f)) + +(defmethod increment ((this kill-statistics) (name symbol) (source kill-stats-source)) + "adds one kill to the kill statistics" + + (let ((kill-stats (get-enemy-stats this name))) + (if (not kill-stats) + (set! kill-stats (alloc-slot this name))) + (when (not kill-stats) + (format 0 "out of stats memory!~%") + (return 0)) + + (+! (-> kill-stats sources source) 1)) + ) + + + +(defmethod get-count ((this kill-statistics) (name symbol) (source kill-stats-source)) + "return number of kills for that enemy with that cause of death" + + (let ((kill-stats (get-enemy-stats this name))) + (if (not kill-stats) + (return 0)) + + (-> kill-stats sources source)) + ) + +(defmethod get-count-for-enemy ((this kill-statistics) (name symbol)) + "return number of kills for that enemy" + + (let ((kill-stats (get-enemy-stats this name)) + (kills 0)) + (if (not kill-stats) + (return 0)) + + (dotimes (i KILL_STATS_MAX_SOURCE) + (+! kills (-> kill-stats sources i))) + kills) + ) + +(defmethod get-count-for-source ((this kill-statistics) (source kill-stats-source)) + "return number of kills for that source" + + (let ((kills 0)) + (dotimes (i KILL_STATS_MAX_ENEMY_TYPES) + (when (-> this enemies i name) + (+! kills (-> this enemies i sources source)) + ) + ) + kills) + ) + + +(defmethod print-stats ((this kill-statistics) out) + "print the stats as a table to out" + + (format out "----! kill stats (total: ~D) !----~%" (get-total-count this)) + (dotimes (i KILL_STATS_MAX_ENEMY_TYPES) + (when (-> this enemies i name) + (format out "~S: ~D total~%" (-> this enemies i name) (get-count-for-enemy this (-> this enemies i name))) + (dotimes (ii KILL_STATS_MAX_SOURCE) + (if (nonzero? (-> this enemies i sources ii)) + (format out " ~3D ~S~%" (-> this enemies i sources ii) (kill-source->string (the kill-stats-source ii)))) + ) + ) + ) + out) + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; global variables +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +(define *statistics* (new 'global 'statistics)) + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; helper functions +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +(defun get-kill-stats () + (-> *statistics* kill-stats)) + + + +(define-extern civilian type) +(define-extern sig type) +(define-extern ashelin type) +(define-extern jinx type) +(define-extern mog type) +(define-extern grim type) +(define-extern juicer type) +(define-extern grunt type) +(define-extern flitter type) +(define-extern wasp type) +(define-extern spyder type) +(define-extern metalhead-predator type) +(define-extern metalhead-grunt type) +(define-extern metalhead-flitter type) +(define-extern crimson-guard-hover type) +(define-extern crimson-guard-level type) +(define-extern roboguard-level type) +(defun remap-enemy-type-name ((en-type type)) + "returns the appropriate type name (symbol) for the stats tracker" + + (cond + ((symbol-member? (-> en-type symbol) '(kid kid-escort)) 'kid) + + ((= en-type metalhead-predator) 'predator) + ((= en-type metalhead-grunt) 'grunt) + ((= en-type metalhead-flitter) 'flitter) + ((= en-type crimson-guard-level) 'crimson-guard) + ((= en-type crimson-guard-hover) 'crimson-guard) + ((= en-type roboguard-level) 'roboguard) + + ((type-type? en-type civilian) 'civilian) + ((type-type? en-type sig) 'sig) + ((type-type? en-type ashelin) 'ashelin) + ((type-type? en-type juicer) 'juicer) + ((type-type? en-type grunt) 'grunt) + ((type-type? en-type flitter) 'flitter) + ((type-type? en-type wasp) 'wasp) + ((type-type? en-type spyder) 'spyder) + (else (-> en-type symbol))) + ) + +;; all types of metal head +(define *metalhead-types* + '(flitter + grunt + metalmonk + juicer + centurion + hopper + hosehead + rhino + spyder + grenadier + rapid-gunner + predator + flamer + wasp + ginsu + pegasus + mantis + jellyfish + flying-spider + )) + +(defun is-metalhead? ((p process)) + "is p a metal head enemy?" + + (let ((p-type (remap-enemy-type-name (-> p type))) + (iter *metalhead-types*)) + (while (not (null? iter)) + (let ((cur (the symbol (car iter)))) + (if (= p-type cur) + (return #t)) + ) + (set! iter (cdr iter)) + ) + ) + #f) + +(defun killed-each-metalhead? () + "#t = every metal head type has been killed once." + + (let ((iter *metalhead-types*)) + (while (not (null? iter)) + (let ((cur (the symbol (car iter)))) + (if (= (get-count-for-enemy (get-kill-stats) cur) 0) + (return #f)) + ) + (set! iter (cdr iter)) + ) + ) + #t) + diff --git a/goal_src/jak2/pc/statistics.gc b/goal_src/jak2/pc/statistics.gc new file mode 100644 index 0000000000..40199b8deb --- /dev/null +++ b/goal_src/jak2/pc/statistics.gc @@ -0,0 +1,130 @@ +;;-*-Lisp-*- +(in-package goal) + +#| + + Code for the statistics tracker. + + |# + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; debug functions +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +(defun-debug pu->string (out (pu penetrate)) + (bit-enum->string penetrate pu out) + ) + + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; functions +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +(defmacro pu? (pu &rest flags) + `(logtest? ,pu (penetrate ,@flags)) + ) + +(defmacro pu-all? (pu &rest flags) + `(logtesta? ,pu (penetrate ,@flags)) + ) + +(define-extern bot type) +(define-extern crimson-guard type) +(define-extern turret type) +(defun pu&attacker->kill-source ((pu penetrate) (attacker process)) + "returns the appropriate kill source based on penetrate-using and attacker" + + (cond + ((not attacker) + (format #t "got null attacker~%") + (kill-stats-source unknown)) + + ((type? attacker turret) + (kill-stats-source turret)) + + ((type? attacker target) + (case pu + (((penetrate spin touch)) (if (focus-test? (the target attacker) indax) (kill-stats-source indax-spin) (kill-stats-source spin))) + (((penetrate flop touch)) (kill-stats-source flop)) + (((penetrate uppercut touch)) (kill-stats-source uppercut)) + (((penetrate punch touch)) (if (focus-test? (the target attacker) indax) (kill-stats-source indax-punch) (kill-stats-source punch))) + + (((penetrate mech-punch mech punch touch)) (kill-stats-source mech)) + (((penetrate mech-bonk bonk touch)) (kill-stats-source mech-bonk)) + + (((penetrate board spin touch)) (kill-stats-source board-trick)) + (((penetrate board touch)) (kill-stats-source board)) + + (((penetrate dark-skin spin touch) (penetrate dark-giant dark-skin spin touch)) (kill-stats-source darkjak-spin)) + (((penetrate dark-skin flop touch) (penetrate dark-giant dark-skin flop touch)) (kill-stats-source darkjak-flop)) + (((penetrate dark-skin uppercut touch) (penetrate dark-giant dark-skin uppercut touch)) (kill-stats-source darkjak-uppercut)) + (((penetrate dark-punch dark-skin punch touch) (penetrate dark-giant dark-punch dark-skin punch touch)) (kill-stats-source darkjak-punch)) + (((penetrate dark-bomb dark-skin touch) (penetrate dark-giant dark-bomb dark-skin touch)) + (case (-> attacker state) + ((target-darkjak-bomb0) (kill-stats-source darkjak-bomb0)) + ((target-darkjak-bomb1) (kill-stats-source darkjak-bomb1)) + (else (kill-stats-source unknown)))) + (((penetrate dark-skin touch) (penetrate dark-giant dark-skin touch)) (kill-stats-source unknown)) + + (((penetrate jak-yellow-shot generic-attack)) (kill-stats-source gun-yellow)) + (((penetrate jak-red-shot generic-attack)) (kill-stats-source gun-red)) + (((penetrate jak-blue-shot generic-attack)) (kill-stats-source gun-blue)) + (((penetrate generic-attack)) (kill-stats-source gun-dark)) + + (else + (format #t "unhandled target penetrate-using #x~x for kill-source~%" pu) + (kill-stats-source unknown))) + ) + + ((is-metalhead? attacker) (kill-stats-source metalhead)) + + ((type? attacker sig) (kill-stats-source sig)) + ((type? attacker ashelin) (kill-stats-source ashelin)) + ((type? attacker mog) (kill-stats-source mog)) ;; note that mog and grim are subtypes of jinx + ((type? attacker grim) (kill-stats-source grim)) + ((type? attacker jinx) (kill-stats-source jinx)) + ((type? attacker bot) (kill-stats-source bot)) + ((type? attacker crimson-guard) (kill-stats-source guard)) + ((type? attacker enemy) (kill-stats-source enemy)) + + (else + (format #t "unknown attacker ~A~%" attacker) + (kill-stats-source unknown)) + ) + ) + + + +(defun add-to-kill-stats ((enemy enemy) (attack enemy-attack-info)) + "adds a kill to the statistics tracker" + + ;; (format #t "enemy ~A killed (incoming ~e sec ago)~%" (-> enemy name) (- (-> PP clock old-frame-counter) (-> attack attack-time))) + ;; (format #t "~Tattacker: ~A~%" (handle->process (-> attack attacker-handle))) + ;; (format #t "~Tpu: ") + ;; (pu->string #t (-> attack penetrate-using)) + ;; (format #t "~%") + + (let ((enemy-name (remap-enemy-type-name (-> enemy type))) + (source (pu&attacker->kill-source (-> attack penetrate-using) (handle->process (-> attack attacker-handle))))) + + (when *debug-segment* + (format #t "STATS : enemy ~S(~S) killed by ~S~%" enemy-name (-> enemy type symbol) (kill-source->string source))) + + (if (or (!= source (kill-stats-source unknown)) (-> *statistics* kill-stats allow-unknown?)) + (increment (-> *statistics* kill-stats) enemy-name source)) + ) + ) + + + +(defun reset-kill-stats () + (initialize (-> *statistics* kill-stats))) + + + diff --git a/test/decompiler/reference/jak1/engine/common-obs/nav-enemy_REF.gc b/test/decompiler/reference/jak1/engine/common-obs/nav-enemy_REF.gc index c966f54fa9..50b357f1a7 100644 --- a/test/decompiler/reference/jak1/engine/common-obs/nav-enemy_REF.gc +++ b/test/decompiler/reference/jak1/engine/common-obs/nav-enemy_REF.gc @@ -12,7 +12,7 @@ ) ;; definition for function nav-enemy-rnd-float-range -(defbehavior nav-enemy-rnd-float-range nav-enemy ((arg0 float) (arg1 float)) +(defun nav-enemy-rnd-float-range ((arg0 float) (arg1 float)) (+ arg0 (* (rand-vu) (- arg1 arg0))) ) diff --git a/test/decompiler/reference/jak2/engine/ai/enemy-h_REF.gc b/test/decompiler/reference/jak2/engine/ai/enemy-h_REF.gc index 3fe41b1f71..2f04ef6b41 100644 --- a/test/decompiler/reference/jak2/engine/ai/enemy-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/ai/enemy-h_REF.gc @@ -235,7 +235,7 @@ ;; definition of type enemy-jump-info (deftype enemy-jump-info (structure) - ((flags uint8) + ((flags enemy-jump-flags) (anim-speed float) (hang-time time-frame) (start-pos vector :inline) @@ -294,7 +294,7 @@ (blue-juggle-count uint8) (attacker-handle handle) (attack-time time-frame) - (penetrate-using uint64) + (penetrate-using penetrate) (attacker-pos vector :inline) (attack-direction vector :inline) ) @@ -412,7 +412,7 @@ (enemy-method-52 (_type_ vector) none) (enemy-method-53 (_type_ process-focusable) symbol) (enemy-method-54 (_type_) enemy-flag) - (track-target! (_type_) none) + (common-post (_type_) none) (damage-amount-from-attack (_type_ process event-message-block) int) (update-target-awareness! (_type_ process-focusable enemy-best-focus) enemy-aware) (enemy-method-58 (_type_ process event-message-block) symbol) @@ -421,8 +421,8 @@ (enemy-method-61 (_type_ int) int :behavior enemy) (enemy-method-62 (_type_) none) (enemy-method-63 (_type_ process-focusable enemy-aware) symbol) - (enemy-method-64 (_type_) none) - (enemy-method-65 (_type_) none) + (go-dormant (_type_) object) + (go-dormant-aware (_type_) object) (go-ambush (_type_) object) (go-stare (_type_) object) (go-stare2 (_type_) object) @@ -434,8 +434,8 @@ (general-event-handler (_type_ process int symbol event-message-block) object) (enemy-method-75 (_type_ process event-message-block) object) (enemy-method-76 (_type_ process event-message-block) symbol) - (enemy-method-77 (_type_ (pointer float)) symbol) - (enemy-method-78 (_type_ (pointer float)) symbol) + (enemy-method-77 (_type_ enemy-knocked-info) symbol) + (enemy-method-78 (_type_ enemy-knocked-info) symbol) (enemy-method-79 (_type_ int enemy-knocked-info) symbol) (enemy-method-80 (_type_ enemy-knocked-info) symbol) (enemy-method-81 (_type_) symbol) @@ -449,7 +449,7 @@ (enemy-method-89 (_type_ enemy-jump-info) symbol) (enemy-method-90 (_type_ int enemy-jump-info) symbol) (enemy-method-91 (_type_ int enemy-jump-info) none) - (enemy-method-92 (_type_ int nav-poly) none) + (enemy-method-92 (_type_ int enemy-jump-info) none) (enemy-method-93 (_type_) none) (enemy-method-94 (_type_ vector float) symbol) (enemy-method-95 (_type_ vector float) symbol) @@ -463,9 +463,9 @@ (enemy-method-103 (_type_) collide-spec) (enemy-method-104 (_type_ process touching-shapes-entry uint) symbol :behavior process) (enemy-method-105 (_type_ process) enemy-flag) - (enemy-method-106 (_type_ process object int attack-info) none :behavior enemy) + (set-incoming-attack-info (_type_ process object penetrate attack-info) none :behavior enemy) (get-enemy-target (_type_) process-focusable) - (enemy-method-108 (_type_ enemy event-message-block) int) + (enemy-method-108 (_type_ process-drawable event-message-block) int) (look-at-target! (_type_ enemy-flag) none) (stop-looking-at-target! (_type_) none) (enemy-method-111 (_type_) none :behavior enemy) @@ -474,24 +474,24 @@ (init-enemy-collision! (_type_) none) (init-enemy! (_type_) none) (go-idle (_type_) none) - (get-rand-float (_type_) float) - (get-rand-float-range (_type_ float float) float) - (get-rand-int (_type_ int) int) - (enemy-method-120 (_type_ int int) int) - (get-rand-int-range (_type_ int int) int) - (rng-hit? (_type_ float) symbol) - (enemy-method-123 (_type_ float) symbol) + (rnd-float (_type_) float) + (rnd-float-range (_type_ float float) float) + (rnd-int-count (_type_ int) int) + (rnd-bit (_type_ int int) int) + (rnd-int-range (_type_ int int) int) + (rnd-percent? (_type_ float) symbol) + (rnd-go-idle? (_type_ float) symbol) (enemy-method-124 (_type_) collide-spec) - (enemy-method-125 (_type_ collide-query collide-spec float float float) pat-surface) + (ground-pat-set! (_type_ collide-query collide-spec float float float) pat-surface) (enemy-above-ground? (_type_ collide-query vector collide-spec float float float) symbol) (enemy-method-127 (_type_ float float symbol collide-spec) symbol) (enemy-method-128 (_type_ vector move-above-ground-params) none) (enemy-method-129 (_type_) none) (enemy-method-130 (_type_ float) symbol) - (enemy-method-131 (_type_ int) uint) - (dispose! (_type_) none) + (penetrate-using->knocked (_type_ penetrate) knocked-type) + (dying (_type_) none) (enemy-method-133 (_type_) symbol) - (enemy-method-134 (_type_ process attack-info) process-focusable) + (get-attacker (_type_ process attack-info) process-focusable) (enemy-method-135 (_type_ int) sound-id) (enemy-method-136 (_type_) enemy-flag) ) @@ -508,112 +508,112 @@ ) (format #t "~2Tenemy-flags: #x~X : (enemy-flag " (-> this enemy-flags)) (let ((s5-0 (-> this enemy-flags))) - (if (= (logand (enemy-flag actor-pause-backup) s5-0) (enemy-flag actor-pause-backup)) + (if (= (logand (enemy-flag lock-focus) s5-0) (enemy-flag lock-focus)) (format #t "lock-focus ") ) - (if (= (logand (enemy-flag recover) s5-0) (shl 8 32)) + (if (= (logand (enemy-flag death-start) s5-0) (shl 8 32)) (format #t "death-start ") ) - (if (= (logand s5-0 (enemy-flag jump-check-blocked)) (enemy-flag jump-check-blocked)) + (if (= (logand s5-0 (enemy-flag enable-on-active)) (enemy-flag enable-on-active)) (format #t "enable-on-active ") ) - (if (= (logand (enemy-flag directed-ready) s5-0) (enemy-flag directed-ready)) + (if (= (logand (enemy-flag checking-water) s5-0) (enemy-flag checking-water)) (format #t "checking-water ") ) - (if (= (logand (enemy-flag trackable-backup) s5-0) (enemy-flag trackable-backup)) + (if (= (logand (enemy-flag check-water) s5-0) (enemy-flag check-water)) (format #t "check-water ") ) - (if (= (logand (enemy-flag cam-attack-mode) s5-0) (enemy-flag cam-attack-mode)) + (if (= (logand (enemy-flag spawn-gem) s5-0) (enemy-flag spawn-gem)) (format #t "spawn-gem ") ) - (if (= (logand (enemy-flag dangerous-backup) s5-0) (enemy-flag dangerous-backup)) + (if (= (logand (enemy-flag chase-startup) s5-0) (enemy-flag chase-startup)) (format #t "chase-startup ") ) - (if (= (logand s5-0 (enemy-flag look-at-move-dest)) (enemy-flag look-at-move-dest)) + (if (= (logand s5-0 (enemy-flag attackable-backup)) (enemy-flag attackable-backup)) (format #t "attackable-backup ") ) - (if (= (logand s5-0 (enemy-flag lock-focus)) (enemy-flag lock-focus)) + (if (= (logand s5-0 (enemy-flag look-at-focus)) (enemy-flag look-at-focus)) (format #t "look-at-focus ") ) - (if (= (logand s5-0 (enemy-flag enable-on-notice)) (enemy-flag enable-on-notice)) + (if (= (logand s5-0 (enemy-flag use-notice-distance)) (enemy-flag use-notice-distance)) (format #t "use-notice-distance ") ) - (if (= (logand s5-0 (enemy-flag auto-reset-penetrate)) (enemy-flag auto-reset-penetrate)) + (if (= (logand s5-0 (enemy-flag enable-on-notice)) (enemy-flag enable-on-notice)) (format #t "enable-on-notice ") ) - (if (= (logand s5-0 (enemy-flag death-start)) (enemy-flag death-start)) + (if (= (logand s5-0 (enemy-flag look-at-move-dest)) (enemy-flag look-at-move-dest)) (format #t "look-at-move-dest ") ) - (if (= (logand s5-0 (enemy-flag spawn-gem)) (enemy-flag spawn-gem)) + (if (= (logand s5-0 (enemy-flag notice)) (enemy-flag notice)) (format #t "notice ") ) - (if (= (logand s5-0 (enemy-flag attackable-backup)) (enemy-flag attackable-backup)) + (if (= (logand s5-0 (enemy-flag auto-reset-penetrate)) (enemy-flag auto-reset-penetrate)) (format #t "auto-reset-penetrate ") ) - (if (= (logand (enemy-flag vulnerable) s5-0) (shl 4 32)) + (if (= (logand (enemy-flag jump-check-blocked) s5-0) (shl 4 32)) (format #t "jump-check-blocked ") ) - (if (= (logand (enemy-flag dislike-combo) s5-0) (shl #x8000 16)) + (if (= (logand (enemy-flag drawn-mirrored) s5-0) (shl #x8000 16)) (format #t "drawn-mirrored ") ) - (if (= (logand (enemy-flag trackable) s5-0) (enemy-flag trackable)) + (if (= (logand (enemy-flag multi-focus) s5-0) (enemy-flag multi-focus)) (format #t "multi-focus ") ) - (if (= (logand s5-0 (enemy-flag chase-startup)) (enemy-flag chase-startup)) + (if (= (logand s5-0 (enemy-flag alert)) (enemy-flag alert)) (format #t "alert ") ) - (if (= (logand s5-0 (enemy-flag look-at-focus)) (enemy-flag look-at-focus)) + (if (= (logand s5-0 (enemy-flag victory)) (enemy-flag victory)) (format #t "victory ") ) - (if (= (logand s5-0 (enemy-flag check-water)) (enemy-flag check-water)) + (if (= (logand s5-0 (enemy-flag dangerous-backup)) (enemy-flag dangerous-backup)) (format #t "dangerous-backup ") ) - (if (= (logand s5-0 (enemy-flag notice)) (enemy-flag notice)) + (if (= (logand s5-0 (enemy-flag actor-pause-backup)) (enemy-flag actor-pause-backup)) (format #t "actor-pause-backup ") ) - (if (= (logand (enemy-flag check-water-backup) s5-0) (enemy-flag check-water-backup)) + (if (= (logand (enemy-flag trackable) s5-0) (enemy-flag trackable)) (format #t "trackable ") ) - (if (= (logand (enemy-flag recover-applied-velocity) s5-0) (shl 1 32)) + (if (= (logand (enemy-flag called-dying) s5-0) (shl 1 32)) (format #t "called-dying ") ) - (if (= (logand (enemy-flag enable-on-hostile) s5-0) (enemy-flag enable-on-hostile)) + (if (= (logand (enemy-flag check-water-backup) s5-0) (enemy-flag check-water-backup)) (format #t "check-water-backup ") ) - (if (= (logand (enemy-flag vulnerable-backup) s5-0) (shl 2 32)) + (if (= (logand (enemy-flag no-initial-move-to-ground) s5-0) (shl 2 32)) (format #t "no-initial-move-to-ground ") ) - (if (= (logand s5-0 (enemy-flag use-notice-distance)) (enemy-flag use-notice-distance)) + (if (= (logand s5-0 (enemy-flag cam-attack-mode)) (enemy-flag cam-attack-mode)) (format #t "cam-attack-mode ") ) - (if (= (logand (enemy-flag no-initial-move-to-ground) s5-0) (enemy-flag no-initial-move-to-ground)) + (if (= (logand (enemy-flag trackable-backup) s5-0) (enemy-flag trackable-backup)) (format #t "trackable-backup ") ) - (if (= (logand s5-0 (enemy-flag drawn-mirrored)) (enemy-flag drawn-mirrored)) + (if (= (logand s5-0 (enemy-flag enable-on-hostile)) (enemy-flag enable-on-hostile)) (format #t "enable-on-hostile ") ) - (if (= (logand (enemy-flag victory) s5-0) (enemy-flag victory)) + (if (= (logand (enemy-flag directed-ready) s5-0) (enemy-flag directed-ready)) (format #t "directed-ready ") ) - (if (= (logand (enemy-flag called-dying) s5-0) (enemy-flag called-dying)) + (if (= (logand (enemy-flag use-trigger) s5-0) (enemy-flag use-trigger)) (format #t "use-trigger ") ) - (if (= (logand (enemy-flag alert) s5-0) (enemy-flag alert)) + (if (= (logand (enemy-flag directed) s5-0) (enemy-flag directed)) (format #t "directed ") ) - (if (= (logand (enemy-flag multi-focus) s5-0) (enemy-flag multi-focus)) + (if (= (logand (enemy-flag dislike-combo) s5-0) (enemy-flag dislike-combo)) (format #t "dislike-combo ") ) - (if (= (logand (enemy-flag directed) s5-0) (enemy-flag directed)) + (if (= (logand (enemy-flag recover-applied-velocity) s5-0) (enemy-flag recover-applied-velocity)) (format #t "recover-applied-velocity ") ) - (if (= (logand s5-0 (enemy-flag checking-water)) (enemy-flag checking-water)) + (if (= (logand s5-0 (enemy-flag vulnerable-backup)) (enemy-flag vulnerable-backup)) (format #t "vulnerable-backup ") ) - (if (= (logand s5-0 (enemy-flag enable-on-active)) (enemy-flag enable-on-active)) + (if (= (logand s5-0 (enemy-flag vulnerable)) (enemy-flag vulnerable)) (format #t "vulnerable ") ) - (if (= (logand (enemy-flag use-trigger) s5-0) (enemy-flag use-trigger)) + (if (= (logand (enemy-flag recover) s5-0) (enemy-flag recover)) (format #t "recover ") ) ) @@ -685,7 +685,7 @@ (s3-0 (t9-0 this arg0)) ) (when (not s3-0) - (logclear! (-> this flags) (enemy-flag lock-focus)) + (logclear! (-> this flags) (enemy-flag look-at-focus)) (set! (-> this aware) (the-as enemy-aware @@ -704,7 +704,7 @@ ) (set! (-> this aware) arg1) (if (not v0-0) - (logclear! (-> this flags) (enemy-flag lock-focus)) + (logclear! (-> this flags) (enemy-flag look-at-focus)) ) v0-0 ) @@ -717,6 +717,6 @@ (t9-0 this) ) (set! (-> this aware) (enemy-aware enemy-aware-0)) - (logclear! (-> this flags) (enemy-flag lock-focus)) + (logclear! (-> this flags) (enemy-flag look-at-focus)) (none) ) diff --git a/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc b/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc index 92dc09d17b..281615175b 100644 --- a/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc +++ b/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc @@ -30,13 +30,13 @@ ) ;; definition for method 117 of type enemy -(defmethod get-rand-float ((this enemy)) +(defmethod rnd-float ((this enemy)) "@returns the result of calling [[rand-vu]]" (rand-vu) ) ;; definition for method 118 of type enemy -(defmethod get-rand-float-range ((this enemy) (low float) (high float)) +(defmethod rnd-float-range ((this enemy) (low float) (high float)) "@param low The lower bound of the range (inclusive) @param high The upper bound of the range (exclusive) @returns A random float in the specified range" @@ -44,7 +44,7 @@ ) ;; definition for method 119 of type enemy -(defmethod get-rand-int ((this enemy) (high int)) +(defmethod rnd-int-count ((this enemy) (high int)) "@param high The upper bound of the range (exclusive) @returns a random integer in the range 0 to `high` @see [[rand-vu]]" @@ -52,7 +52,7 @@ ) ;; definition for method 121 of type enemy -(defmethod get-rand-int-range ((this enemy) (low int) (high int)) +(defmethod rnd-int-range ((this enemy) (low int) (high int)) "@param low The lower bound of the range (inclusive) @param high The upper bound of the range (exclusive) @returns A random integer in the specified range" @@ -60,16 +60,15 @@ ) ;; definition for method 122 of type enemy -(defmethod rng-hit? ((this enemy) (chance float)) - "TODO - not the best name -@param chance The value to compare ([[>=]]) with the result from [[rand-vu]]. +(defmethod rnd-percent? ((this enemy) (chance float)) + "@param chance The value to compare ([[>=]]) with the result from [[rand-vu]]. @returns If `chance` is greater than the random draw" (>= chance (rand-vu)) ) ;; definition for method 120 of type enemy ;; WARN: new jak 2 until loop case, check carefully -(defmethod enemy-method-120 ((this enemy) (arg0 int) (arg1 int)) +(defmethod rnd-bit ((this enemy) (arg0 int) (arg1 int)) "TODO" (let ((v1-0 0) (s5-0 0) @@ -84,7 +83,7 @@ ) ) (when (> v1-0 0) - (let ((v1-1 (get-rand-int this v1-0)) + (let ((v1-1 (rnd-int-count this v1-0)) (a0-1 1) ) (until #f @@ -110,7 +109,7 @@ ) ;; definition for method 123 of type enemy -(defmethod enemy-method-123 ((this enemy) (arg0 float)) +(defmethod rnd-go-idle? ((this enemy) (arg0 float)) "TODO" (let* ((v1-5 (-> *display* frames (-> *display* last-screen) run-time)) (f1-2 (fmax 0.0 (fmin 1.0 (* 0.001 (+ -7000.0 (the float v1-5)))))) @@ -122,7 +121,7 @@ ;; definition for method 60 of type enemy (defmethod coin-flip? ((this enemy)) "@returns The result of a 50/50 RNG roll" - (zero? (get-rand-int this 2)) + (zero? (rnd-int-count this 2)) ) ;; definition for method 12 of type enemy @@ -188,7 +187,7 @@ (defmethod enemy-method-124 ((this enemy)) "TODO" (let* ((v1-0 (-> this enemy-info)) - (v0-0 (if (logtest? (enemy-flag use-trigger) (-> this enemy-flags)) + (v0-0 (if (logtest? (enemy-flag recover) (-> this enemy-flags)) (-> v1-0 recover-gnd-collide-with) (-> v1-0 gnd-collide-with) ) @@ -220,7 +219,7 @@ (water-info-init! s4-0 s5-0 (collide-action solid semi-solid)) (let ((s3-0 (-> s5-0 flags))) (when (logtest? (water-flags touch-water) s3-0) - (logior! (-> this enemy-flags) (enemy-flag directed-ready)) + (logior! (-> this enemy-flags) (enemy-flag checking-water)) (set! (-> this water-surface-height) (-> s5-0 trans y)) (when (not (focus-test? this touch-water under-water)) (let ((s2-0 (new 'stack-no-clear 'vector))) @@ -291,8 +290,8 @@ ) ) (logclear! (-> this focus-status) (focus-status touch-water under-water)) - (when (not (logtest? (enemy-flag use-trigger) (-> this enemy-flags))) - (let ((v0-9 (logclear (-> this enemy-flags) (enemy-flag directed-ready)))) + (when (not (logtest? (enemy-flag recover) (-> this enemy-flags))) + (let ((v0-9 (logclear (-> this enemy-flags) (enemy-flag checking-water)))) (set! (-> this enemy-flags) v0-9) v0-9 ) @@ -301,7 +300,7 @@ ;; definition for method 55 of type enemy ;; WARN: Return type mismatch int vs none. -(defmethod track-target! ((self enemy)) +(defmethod common-post ((self enemy)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -310,7 +309,7 @@ (set-time! (-> self last-draw-time)) ) (enemy-method-129 self) - (if (logtest? (enemy-flag use-trigger) (-> self enemy-flags)) + (if (logtest? (enemy-flag recover) (-> self enemy-flags)) (enemy-method-100 self) ) (when *target* @@ -318,7 +317,7 @@ (look-at! (-> *target* neck) (the-as vector (-> self root root-prim prim-core)) - (if (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance)) + (if (logtest? (-> self enemy-flags) (enemy-flag cam-attack-mode)) 'attacking ) self @@ -326,7 +325,7 @@ ) ) (when (nonzero? (-> self neck)) - (when (logtest? (-> self enemy-flags) (enemy-flag lock-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag look-at-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)) @@ -334,10 +333,10 @@ ) ) ) - (when (and (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) + (when (and (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) (time-elapsed? (-> self auto-reset-penetrate-time) (seconds 0.1)) ) - (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) + (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) (set! (-> self root penetrated-by) (get-penetrate-info self)) (let ((v1-48 0)) (if (logtest? (penetrate knocked) (-> self root penetrate-using)) @@ -346,10 +345,10 @@ (set! (-> self root penetrate-using) (the-as penetrate v1-48)) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) (enemy-method-136 self) ) - (if (logtest? (enemy-flag trackable-backup directed-ready) (-> self enemy-flags)) + (if (logtest? (enemy-flag check-water checking-water) (-> self enemy-flags)) (enemy-method-54 self) ) (if (and *debug-segment* (-> self enemy-info debug-draw-neck) (nonzero? (-> self neck))) @@ -370,7 +369,7 @@ ) ) ) - (let ((v0-0 (logclear (-> this enemy-flags) (enemy-flag look-at-focus)))) + (let ((v0-0 (logclear (-> this enemy-flags) (enemy-flag victory)))) (set! (-> this enemy-flags) v0-0) v0-0 ) @@ -435,7 +434,7 @@ ;; definition for method 62 of type enemy ;; WARN: Return type mismatch int vs none. (defmethod enemy-method-62 ((this enemy)) - (when (not (logtest? (enemy-flag actor-pause-backup) (-> this enemy-flags))) + (when (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) (let* ((s4-0 (handle->process (-> this incoming attacker-handle))) (s5-0 (if (type? s4-0 process-focusable) s4-0 @@ -444,7 +443,7 @@ ) (when (enemy-method-53 this (the-as process-focusable s5-0)) (enemy-method-63 this (the-as process-focusable s5-0) (the-as enemy-aware #f)) - (logior! (-> this focus flags) (enemy-flag lock-focus)) + (logior! (-> this focus flags) (enemy-flag look-at-focus)) ) ) ) @@ -453,16 +452,16 @@ ) ;; definition for method 108 of type enemy -(defmethod enemy-method-108 ((this enemy) (arg0 enemy) (arg1 event-message-block)) +(defmethod enemy-method-108 ((this enemy) (arg0 process-drawable) (arg1 event-message-block)) (let ((s4-0 (the-as touching-shapes-entry (-> arg1 param 0)))) (when (and s4-0 - (and (logtest? (-> this incoming penetrate-using) 4096) - (not (logtest? (-> this incoming penetrate-using) 32)) + (and (logtest? (-> this incoming penetrate-using) (penetrate board)) + (not (logtest? (-> this incoming penetrate-using) (penetrate spin))) ) (begin (let ((s3-0 (-> s4-0 head))) (while s3-0 - (let ((s2-0 (get-touched-prim s3-0 (-> arg0 root) s4-0))) + (let ((s2-0 (get-touched-prim s3-0 (the-as collide-shape (-> arg0 root)) s4-0))) (get-touched-prim s3-0 (-> this root) s4-0) (when (logtest? (-> s2-0 prim-core action) (collide-action solid semi-solid deadly)) (let* ((a0-5 this) @@ -491,8 +490,7 @@ ) ;; definition for method 64 of type enemy -;; WARN: Return type mismatch object vs none. -(defmethod enemy-method-64 ((this enemy)) +(defmethod go-dormant ((this enemy)) (let ((v1-1 (-> this root root-prim))) (set! (-> v1-1 prim-core collide-as) (collide-spec)) (set! (-> v1-1 prim-core collide-with) (collide-spec)) @@ -501,12 +499,10 @@ (logior! (-> this draw status) (draw-control-status no-draw)) (logior! (-> this focus-status) (focus-status disable)) (go (method-of-object this dormant)) - (none) ) ;; definition for method 65 of type enemy -;; WARN: Return type mismatch object vs none. -(defmethod enemy-method-65 ((this enemy)) +(defmethod go-dormant-aware ((this enemy)) (let ((v1-1 (-> this root root-prim))) (set! (-> v1-1 prim-core collide-as) (collide-spec)) (set! (-> v1-1 prim-core collide-with) (collide-spec)) @@ -515,7 +511,6 @@ (logior! (-> this draw status) (draw-control-status no-draw)) (logior! (-> this focus-status) (focus-status disable)) (go (method-of-object this dormant-aware)) - (none) ) ;; definition for method 67 of type enemy @@ -575,7 +570,7 @@ ;; definition for method 93 of type enemy ;; WARN: Return type mismatch object vs none. (defmethod enemy-method-93 ((this enemy)) - (if (logtest? (enemy-flag alert) (-> this enemy-flags)) + (if (logtest? (enemy-flag directed) (-> this enemy-flags)) (go-directed this) (react-to-focus this) ) @@ -663,7 +658,7 @@ (shove-up (-> this enemy-info attack-shove-up)) (mode (-> this enemy-info attack-mode)) (damage (the float v1-1)) - (knock (the-as uint 8)) + (knock (knocked-type knocked-type-8)) ) ) ) @@ -686,13 +681,13 @@ ) (when (enemy-method-53 this (the-as process-focusable s5-0)) (let ((v1-10 (handle->process (-> this focus handle)))) - (when (or (= s5-0 v1-10) (and (not (logtest? (enemy-flag actor-pause-backup) (-> this enemy-flags))) - (or (not v1-10) (not (logtest? (-> this focus flags) (enemy-flag lock-focus)))) + (when (or (= s5-0 v1-10) (and (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) + (or (not v1-10) (not (logtest? (-> this focus flags) (enemy-flag look-at-focus)))) ) ) (enemy-method-63 this (the-as process-focusable s5-0) (the-as enemy-aware #f)) (set-time! (-> this hit-focus-time)) - (let ((v0-3 (logior (-> this enemy-flags) (enemy-flag look-at-focus)))) + (let ((v0-3 (logior (-> this enemy-flags) (enemy-flag victory)))) (set! (-> this enemy-flags) v0-3) v0-3 ) @@ -704,7 +699,7 @@ ;; definition for method 49 of type enemy (defmethod enemy-method-49 ((this enemy)) - (logior! (-> this enemy-flags) (enemy-flag attackable-backup)) + (logior! (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) (let ((v0-0 (current-time))) (set! (-> this auto-reset-penetrate-time) v0-0) v0-0 @@ -726,53 +721,53 @@ ) ;; definition for method 131 of type enemy -;; WARN: Return type mismatch int vs uint. -(defmethod enemy-method-131 ((this enemy) (arg0 int)) - (the-as uint (cond - ((logtest? arg0 1024) - 7 - ) - ((logtest? #x1000000 arg0) - 6 - ) - ((logtest? #x4400000 arg0) - 4 - ) - ((logtest? #x800000 arg0) - 5 - ) - ((logtest? #xc0000 arg0) - 3 - ) - ((logtest? #xa200000 arg0) - 2 - ) - ((logtest? arg0 #x4000) - 1 - ) - (else - 0 - ) - ) +;; WARN: Return type mismatch int vs knocked-type. +(defmethod penetrate-using->knocked ((this enemy) (arg0 penetrate)) + (the-as knocked-type (cond + ((logtest? arg0 (penetrate vehicle)) + 7 + ) + ((logtest? (penetrate jak-blue-shot) arg0) + 6 + ) + ((logtest? (penetrate jak-yellow-shot enemy-yellow-shot) arg0) + 4 + ) + ((logtest? (penetrate jak-red-shot) arg0) + 5 + ) + ((logtest? (penetrate dark-bomb dark-giant) arg0) + 3 + ) + ((logtest? (penetrate explode jak-dark-shot enemy-dark-shot) arg0) + 2 + ) + ((logtest? arg0 (penetrate mech-punch)) + 1 + ) + (else + 0 + ) + ) ) ) ;; definition for method 106 of type enemy ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-106 ((this enemy) (arg0 process) (arg1 object) (arg2 int) (arg3 attack-info)) - (set! (-> this incoming penetrate-using) (the-as uint arg2)) +(defmethod set-incoming-attack-info ((this enemy) (arg0 process) (arg1 object) (arg2 penetrate) (arg3 attack-info)) + (set! (-> this incoming penetrate-using) arg2) (set! (-> this incoming attack-id) (-> arg3 id)) (let ((v1-3 (if (logtest? (attack-mask knock) (-> arg3 mask)) (-> arg3 knock) - (enemy-method-131 this arg2) + (penetrate-using->knocked this arg2) ) ) ) - (set! (-> this incoming knocked-type) (the-as knocked-type v1-3)) + (set! (-> this incoming knocked-type) v1-3) (let ((a0-4 (current-time))) (cond - ((!= v1-3 6) + ((!= v1-3 (knocked-type knocked-type-6)) (set! (-> this incoming blue-juggle-count) (the-as uint 0)) 0 ) @@ -786,7 +781,7 @@ (set! (-> this incoming attack-time) a0-4) ) (cond - ((= v1-3 7) + ((= v1-3 (knocked-type knocked-type-7)) (set! (-> this incoming attack-direction quad) (-> arg3 vector quad)) ) (else @@ -798,7 +793,7 @@ ) ) ) - (set! (-> this incoming attacker-handle) (process->handle (enemy-method-134 this arg0 arg3))) + (set! (-> this incoming attacker-handle) (process->handle (get-attacker this arg0 arg3))) 0 (none) ) @@ -809,13 +804,13 @@ "Logic for looking at the target that is locked on, sets some flags and adjusts the neck to look at the target if available @param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" (case arg0 - (((enemy-flag lock-focus)) - (logclear! (-> this enemy-flags) (enemy-flag death-start)) - (logior! (-> this enemy-flags) (enemy-flag lock-focus)) + (((enemy-flag look-at-focus)) + (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logior! (-> this enemy-flags) (enemy-flag look-at-focus)) ) - (((enemy-flag death-start)) - (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) - (logior! (-> this enemy-flags) (enemy-flag death-start)) + (((enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag look-at-focus)) + (logior! (-> this enemy-flags) (enemy-flag look-at-move-dest)) ) ) (if (nonzero? (-> this neck)) @@ -830,7 +825,7 @@ (defmethod stop-looking-at-target! ((this enemy)) "Will unset [[enemy-flag::death-start]] and [[enemy-flag::lock-focus]] and call [[joint-mod::shut-down]] if applicable" (when (nonzero? (-> this neck)) - (logclear! (-> this enemy-flags) (enemy-flag lock-focus death-start)) + (logclear! (-> this enemy-flags) (enemy-flag look-at-focus look-at-move-dest)) (shut-down (-> this neck)) ) 0 @@ -838,7 +833,7 @@ ) ;; definition for method 125 of type enemy -(defmethod enemy-method-125 ((this enemy) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) +(defmethod ground-pat-set! ((this enemy) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) (when (find-ground (-> this root) arg0 arg1 arg2 arg3 arg4) (let ((v0-1 (-> arg0 best-other-tri pat))) (set! (-> this root ground-pat) v0-1) @@ -859,7 +854,7 @@ (defmethod enemy-method-127 ((this enemy) (arg0 float) (arg1 float) (arg2 symbol) (arg3 collide-spec)) (let ((s4-0 (new 'stack-no-clear 'collide-query))) (cond - ((enemy-method-125 this s4-0 arg3 arg0 arg1 1024.0) + ((ground-pat-set! this s4-0 arg3 arg0 arg1 1024.0) (let ((s5-1 (-> this root))) (let ((s3-0 (new 'stack-no-clear 'vector))) (set! (-> s3-0 quad) (-> this root trans quad)) @@ -937,7 +932,7 @@ (set! (-> arg1 new-pos quad) (-> gp-0 trans quad)) (let ((s2-0 (new 'stack-no-clear 'collide-query))) (cond - ((enemy-method-125 this s2-0 (-> arg1 gnd-collide-with) (-> arg1 popup) 81920.0 1024.0) + ((ground-pat-set! this s2-0 (-> arg1 gnd-collide-with) (-> arg1 popup) 81920.0 1024.0) (when (>= (-> gp-0 gspot-pos y) (-> arg1 new-pos y)) (set! (-> arg1 on-ground?) #t) (set! (-> arg1 pat) (-> s2-0 best-other-tri pat)) @@ -1093,11 +1088,11 @@ (set! (-> a0-2 param1) #f) (set! (-> a0-2 param2) #f) ) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag dislike-combo) (-> this enemy-flags)))) + (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag drawn-mirrored) (-> this enemy-flags)))) ) (logior! (-> this mask) (process-mask enemy)) (logior! (-> this mask) (process-mask actor-pause)) - (logior! (-> this enemy-flags) (enemy-flag notice)) + (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (set-enemy-info! this arg0) (let ((a1-2 (-> this enemy-info idle-anim-script))) (if a1-2 @@ -1172,13 +1167,13 @@ (set! (-> this on-hostile) (res-lump-struct (-> this entity) 'on-hostile pair)) (set! (-> this on-death) (res-lump-struct (-> this entity) 'on-death pair)) (if (-> this on-notice) - (logior! (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) + (logior! (-> this enemy-flags) (enemy-flag enable-on-notice)) ) (if (-> this on-active) - (logior! (-> this enemy-flags) (enemy-flag jump-check-blocked)) + (logior! (-> this enemy-flags) (enemy-flag enable-on-active)) ) (if (-> this on-hostile) - (logior! (-> this enemy-flags) (enemy-flag drawn-mirrored)) + (logior! (-> this enemy-flags) (enemy-flag enable-on-hostile)) ) (let ((s4-0 (-> this root))) (set! (-> this penetrated-by-all) (-> s4-0 penetrated-by)) @@ -1187,32 +1182,26 @@ ) (set! (-> this penetrated-flinch) (-> arg0 penetrate-flinch)) (set! (-> this penetrated-knocked) (-> arg0 penetrate-knocked)) - (set! (-> this reaction-time) (the-as time-frame (get-rand-int-range this 30 180))) + (set! (-> this reaction-time) (the-as time-frame (rnd-int-range this 30 180))) (let* ((v1-79 (-> this enemy-flags)) (a0-28 (-> this fact enemy-options)) - (v1-80 (logior (enemy-flag - enable-on-active - checking-water - enable-on-notice - look-at-move-dest - check-water-backup - no-initial-move-to-ground - ) - v1-79 - ) - ) + (v1-80 + (logior (enemy-flag vulnerable vulnerable-backup use-notice-distance attackable-backup trackable trackable-backup) + v1-79 + ) + ) ) (if (logtest? (enemy-option multi-focus) a0-28) - (set! v1-80 (logior (enemy-flag trackable) v1-80)) + (set! v1-80 (logior (enemy-flag multi-focus) v1-80)) ) (if (logtest? (enemy-option has-trigger) a0-28) - (set! v1-80 (logior (enemy-flag called-dying) v1-80)) + (set! v1-80 (logior (enemy-flag use-trigger) v1-80)) ) (set! (-> this enemy-flags) v1-80) ) (logior! (-> this mask) (process-mask collectable)) (if (and (-> this enemy-info move-to-ground) - (not (logtest? (enemy-flag vulnerable-backup) (-> this enemy-flags))) + (not (logtest? (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) (not (logtest? (enemy-option ambush) (-> this fact enemy-options))) ) (enemy-method-127 this 40960.0 40960.0 #t (the-as collide-spec (-> this gnd-collide))) @@ -1234,10 +1223,12 @@ ) ) (if (-> arg1 directed?) - (logior! (-> self enemy-flags) (enemy-flag alert)) + (logior! (-> self enemy-flags) (enemy-flag directed)) ) (if (-> arg1 no-initial-move-to-ground?) - (set! (-> self enemy-flags) (the-as enemy-flag (logior (enemy-flag vulnerable-backup) (-> self enemy-flags)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logior (enemy-flag no-initial-move-to-ground) (-> self enemy-flags))) + ) ) (init-enemy-collision! self) (set! (-> self root trans quad) (-> arg1 trans quad)) @@ -1276,13 +1267,13 @@ (go-virtual view-anims) ) ((logtest? (enemy-option dormant) v1-43) - (enemy-method-64 self) + (go-dormant self) ) - ((logtest? (enemy-flag alert) (-> self enemy-flags)) + ((logtest? (enemy-flag directed) (-> self enemy-flags)) (go-directed self) ) ((logtest? (enemy-option dormant-aware) v1-43) - (enemy-method-65 self) + (go-dormant-aware self) ) ((logtest? (enemy-option ambush) (-> self fact enemy-options)) (go-ambush self) @@ -1343,10 +1334,10 @@ This commonly includes things such as: (go (method-of-object this view-anims)) ) ((logtest? (enemy-option dormant) v1-28) - (enemy-method-64 this) + (go-dormant this) ) ((logtest? (enemy-option dormant-aware) v1-28) - (enemy-method-65 this) + (go-dormant-aware this) ) (else (go-idle this) @@ -1392,9 +1383,9 @@ This commonly includes things such as: (let ((v1-4 (-> this enemy-flags))) (cond ((and a1-0 (not (logtest? (-> (the-as process-focusable a1-0) focus-status) (focus-status disable dead)))) - (when (and (logtest? (enemy-flag trackable) v1-4) - (not (logtest? (enemy-flag actor-pause-backup) v1-4)) - (not (logtest? (-> gp-0 flags) (enemy-flag lock-focus))) + (when (and (logtest? (enemy-flag multi-focus) v1-4) + (not (logtest? (enemy-flag lock-focus) v1-4)) + (not (logtest? (-> gp-0 flags) (enemy-flag look-at-focus))) ) (enemy-method-97 this) (return #f) @@ -1408,7 +1399,7 @@ This commonly includes things such as: ) (set! (-> gp-0 aware) (the-as enemy-aware v1-14)) (if (>= 1 v1-14) - (logclear! (-> gp-0 flags) (enemy-flag lock-focus)) + (logclear! (-> gp-0 flags) (enemy-flag look-at-focus)) ) ) (return #f) @@ -1424,7 +1415,7 @@ This commonly includes things such as: (clear-focused gp-0) ) ) - (if (not (logtest? (enemy-flag actor-pause-backup) (-> this enemy-flags))) + (if (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) (enemy-method-97 this) ) (none) @@ -1551,7 +1542,7 @@ This commonly includes things such as: (if (< 1 (the-as int (-> this focus aware))) (set! f0-1 (+ (the-as meters f0-1) (-> this enemy-info notice-distance-delta))) ) - (when (or (< f30-0 f0-1) (not (logtest? (-> this enemy-flags) (enemy-flag enable-on-notice)))) + (when (or (< f30-0 f0-1) (not (logtest? (-> this enemy-flags) (enemy-flag use-notice-distance)))) (set! s2-0 (in-aggro-range? this arg0 (the-as vector #f))) (if s2-0 (set! s3-1 #t) @@ -1583,7 +1574,7 @@ This commonly includes things such as: ) ) ) - (when (and (> s3-2 0) (logtest? (enemy-flag called-dying) (-> this enemy-flags))) + (when (and (> s3-2 0) (logtest? (enemy-flag use-trigger) (-> this enemy-flags))) (cond ((logtest? (enemy-option idle-til-trigger) (-> this fact enemy-options)) (if (not (enemy-method-130 this f30-0)) @@ -1634,7 +1625,7 @@ This commonly includes things such as: ) (label cfg-17) (when (zero? t1-1) - (logclear! (-> this enemy-flags) (enemy-flag called-dying)) + (logclear! (-> this enemy-flags) (enemy-flag use-trigger)) (return #t) ) ) @@ -1648,18 +1639,18 @@ This commonly includes things such as: (let ((v1-1 (< 1 arg0))) (cond (v1-1 - (when (not (logtest? (-> this enemy-flags) (enemy-flag spawn-gem))) - (logior! (-> this enemy-flags) (enemy-flag spawn-gem)) + (when (not (logtest? (-> this enemy-flags) (enemy-flag notice))) + (logior! (-> this enemy-flags) (enemy-flag notice)) (set-time! (-> this notice-time)) ) - (if (and (not (logtest? (-> this enemy-flags) (enemy-flag chase-startup))) + (if (and (not (logtest? (-> this enemy-flags) (enemy-flag alert))) (not (time-elapsed? (-> this notice-time) (-> this reaction-time))) ) (set! v1-1 #f) ) ) (else - (logclear! (-> this enemy-flags) (enemy-flag spawn-gem)) + (logclear! (-> this enemy-flags) (enemy-flag notice)) ) ) (cond @@ -1685,18 +1676,18 @@ This commonly includes things such as: (cond ((= arg2 'track) (and (nonzero? (-> this hit-points)) - (logtest? (-> this enemy-flags) (enemy-flag enable-on-active)) - (logtest? (enemy-flag check-water-backup) (-> this enemy-flags)) + (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) + (logtest? (enemy-flag trackable) (-> this enemy-flags)) ) ) ((= arg2 'combo) - (and (not (logtest? (enemy-flag multi-focus) (-> this enemy-flags))) (nonzero? (-> this hit-points))) + (and (not (logtest? (enemy-flag dislike-combo) (-> this enemy-flags))) (nonzero? (-> this hit-points))) ) ((= arg2 'touch) (enemy-method-75 this arg0 arg3) ) ((= arg2 'touched) - (when (logtest? (-> this enemy-flags) (enemy-flag attackable-backup)) + (when (logtest? (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) (let* ((s3-1 arg0) (v1-20 (if (type? s3-1 process-drawable) (the-as process-drawable s3-1) @@ -1750,16 +1741,16 @@ This commonly includes things such as: (let ((s2-0 (the-as object (-> arg3 param 1)))) (when (!= (-> (the-as attack-info s2-0) id) (-> this incoming attack-id)) (cond - ((and (logtest? (-> this enemy-flags) (enemy-flag enable-on-active)) + ((and (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) (not (logtest? (-> this focus-status) (focus-status grabbed))) ) (let* ((s1-0 this) - (s0-0 (method-of-object s1-0 enemy-method-106)) + (s0-0 (method-of-object s1-0 set-incoming-attack-info)) ) (set! sv-432 arg0) (set! sv-448 arg3) (let ((a3-3 (get-penetrate-using-from-attack-event (the-as process-drawable arg0) arg3))) - (s0-0 s1-0 sv-432 sv-448 (the-as int a3-3) (the-as attack-info s2-0)) + (s0-0 s1-0 sv-432 sv-448 a3-3 (the-as attack-info s2-0)) ) ) (send-event (ppointer->process (-> this parent)) 'child-hit) @@ -1767,14 +1758,14 @@ This commonly includes things such as: (if (not *debug-unkillable*) (take-damage-from-attack this arg0 arg3) ) - (let ((s2-1 (the-as attack-info (enemy-method-58 this arg0 arg3)))) + (let ((s2-1 (enemy-method-58 this arg0 arg3))) (when s2-1 - (logclear! (-> this enemy-flags) (enemy-flag called-dying)) - (enemy-method-108 this (the-as enemy arg0) arg3) + (logclear! (-> this enemy-flags) (enemy-flag use-trigger)) + (enemy-method-108 this (the-as process-drawable 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 message) 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)) @@ -1798,15 +1789,15 @@ This commonly includes things such as: (when (zero? (-> this hit-points)) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (kill-prefer-falling this) @@ -1816,15 +1807,15 @@ This commonly includes things such as: ((= arg2 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (when (zero? (-> this hit-points)) @@ -1840,15 +1831,15 @@ This commonly includes things such as: ((= arg2 'hit) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (if (zero? (-> this hit-points)) @@ -1861,9 +1852,9 @@ This commonly includes things such as: (zero? (-> this fated-time)) (not (logtest? (-> this focus-status) (focus-status grabbed))) ) - (let ((v1-162 (logtest? (enemy-flag alert) (-> this enemy-flags)))) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) - (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) + (let ((v1-162 (logtest? (enemy-flag directed) (-> this enemy-flags)))) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance directed directed-ready use-trigger)) + (logior! (-> this enemy-flags) (enemy-flag chase-startup)) (logclear! (-> this mask) (process-mask actor-pause)) (cond (v1-162 @@ -1891,7 +1882,7 @@ This commonly includes things such as: (zero? (-> this fated-time)) (not (logtest? (-> this focus-status) (focus-status grabbed))) ) - (logclear! (-> this enemy-flags) (enemy-flag alert victory called-dying)) + (logclear! (-> this enemy-flags) (enemy-flag directed directed-ready use-trigger)) (if (logtest? (enemy-option ambush) (-> this fact enemy-options)) (go-ambush this) (react-to-focus this) @@ -1911,7 +1902,7 @@ This commonly includes things such as: ) ) ((= arg2 'death-start) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag recover) (-> this enemy-flags)))) + (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag death-start) (-> this enemy-flags)))) (send-event (ppointer->process (-> this parent)) 'child-die) (drop-pickup (-> this fact) #t *entity-pool* (-> this fact) 0) (let ((s5-1 (-> this on-death))) @@ -1925,9 +1916,9 @@ This commonly includes things such as: (logior! (-> this skel effect flags) (effect-control-flag ecf2)) ) (logior! (-> this draw status) (draw-control-status no-draw)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this focus-status) (focus-status dangerous)) - (set! (-> this enemy-flags) (logclear (-> this enemy-flags) (enemy-flag check-water))) + (set! (-> this enemy-flags) (logclear (-> this enemy-flags) (enemy-flag dangerous-backup))) ) ((= arg2 'instant-death) (when (and (> (-> this hit-points) 0) (zero? (-> this fated-time))) @@ -1940,21 +1931,21 @@ This commonly includes things such as: ) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (kill-prefer-falling this) ) ) ((= arg2 'die-fast) (logior! (-> this draw status) (draw-control-status no-draw)) - (dispose! this) + (dying this) (send-event (ppointer->process (-> this parent)) 'child-die) (let ((s5-3 (-> this on-death))) (if s5-3 @@ -2031,7 +2022,7 @@ This commonly includes things such as: (let ((v1-0 (the-as attack-info (-> arg1 param 1)))) (if (logtest? (attack-mask damage) (-> v1-0 mask)) (the int (-> v1-0 damage)) - (penetrate-using->damage (the-as penetrate (-> this incoming penetrate-using))) + (penetrate-using->damage (-> this incoming penetrate-using)) ) ) ) @@ -2040,10 +2031,10 @@ This commonly includes things such as: (defmethod enemy-method-58 ((this enemy) (arg0 process) (arg1 event-message-block)) (let ((v1-0 (-> this incoming penetrate-using))) (cond - ((logtest? (the-as penetrate v1-0) (-> this penetrated-flinch)) + ((logtest? v1-0 (-> this penetrated-flinch)) 'hit-flinch ) - ((logtest? (the-as penetrate v1-0) (-> this penetrated-knocked)) + ((logtest? v1-0 (-> this penetrated-knocked)) 'hit-knocked ) (else @@ -2073,7 +2064,7 @@ This commonly includes things such as: ) ) (set! (-> this hit-points) s4-1) - (if (not (logtest? (-> this enemy-flags) (enemy-flag attackable-backup))) + (if (not (logtest? (-> this enemy-flags) (enemy-flag auto-reset-penetrate))) (set! (-> this root penetrated-by) (get-penetrate-info this)) ) (- s5-0 s4-1) @@ -2081,7 +2072,7 @@ This commonly includes things such as: ) ;; definition for method 134 of type enemy -(defmethod enemy-method-134 ((this enemy) (arg0 process) (arg1 attack-info)) +(defmethod get-attacker ((this enemy) (arg0 process) (arg1 attack-info)) (find-offending-process-focusable arg0 arg1) ) @@ -2180,7 +2171,7 @@ This commonly includes things such as: ;; definition for function enemy-simple-post ;; WARN: Return type mismatch int vs none. (defbehavior enemy-simple-post enemy () - (track-target! self) + (common-post self) (update-transforms (-> self root)) 0 (none) @@ -2189,7 +2180,7 @@ This commonly includes things such as: ;; definition for function enemy-falling-post ;; INFO: Used lq/sq (defbehavior enemy-falling-post enemy () - (logior! (-> self enemy-flags) (enemy-flag directed)) + (logior! (-> self enemy-flags) (enemy-flag recover-applied-velocity)) (let ((gp-0 (-> self root))) (cond ((focus-test? self under-water) @@ -2211,7 +2202,7 @@ This commonly includes things such as: ) ) (enemy-method-111 self) - (track-target! self) + (common-post self) (none) ) @@ -2229,7 +2220,7 @@ This commonly includes things such as: ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defbehavior enemy-die-falling-post enemy () - (logior! (-> self enemy-flags) (enemy-flag directed)) + (logior! (-> self enemy-flags) (enemy-flag recover-applied-velocity)) (let ((gp-0 (-> self root))) (if (focus-test? self under-water) (enemy-method-47 self (-> gp-0 transv)) @@ -2249,7 +2240,7 @@ This commonly includes things such as: (move-to-point! gp-0 s5-1) ) ) - (track-target! self) + (common-post self) 0 (none) ) @@ -2261,20 +2252,20 @@ This commonly includes things such as: :enter (behavior () (set-time! (-> self state-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)) + (logclear! (-> self enemy-flags) (enemy-flag notice alert cam-attack-mode)) + (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (set! (-> self state-timeout) (seconds 0.5)) (if (-> self on-notice) - (logior! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (logior! (-> self enemy-flags) (enemy-flag enable-on-notice)) ) (if (-> self on-active) - (logior! (-> self enemy-flags) (enemy-flag jump-check-blocked)) + (logior! (-> self enemy-flags) (enemy-flag enable-on-active)) ) (if (-> self on-hostile) - (logior! (-> self enemy-flags) (enemy-flag drawn-mirrored)) + (logior! (-> self enemy-flags) (enemy-flag enable-on-hostile)) ) - (when (not (logtest? (enemy-flag dangerous-backup) (-> self enemy-flags))) - (if (logtest? (-> self enemy-flags) (enemy-flag notice)) + (when (not (logtest? (enemy-flag chase-startup) (-> self enemy-flags))) + (if (logtest? (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logior! (-> self mask) (process-mask actor-pause)) (logclear! (-> self mask) (process-mask actor-pause)) ) @@ -2313,8 +2304,8 @@ This commonly includes things such as: 0 (logior! (-> self draw status) (draw-control-status no-draw)) (set! (-> self draw origin quad) (-> self root trans quad)) - (if (logtest? (enemy-flag alert) (-> self enemy-flags)) - (logior! (-> self enemy-flags) (enemy-flag victory)) + (if (logtest? (enemy-flag directed) (-> self enemy-flags)) + (logior! (-> self enemy-flags) (enemy-flag directed-ready)) ) (logior! (-> self focus-status) (focus-status disable)) ) @@ -2325,7 +2316,7 @@ This commonly includes things such as: (set! (-> v1-3 prim-core collide-with) (-> self root backup-collide-with)) ) (logclear! (-> self draw status) (draw-control-status no-draw)) - (logclear! (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag directed-ready)) (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) ) :code sleep-code @@ -2359,7 +2350,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logior! (-> self enemy-flags) (enemy-flag alert)) ) :code (behavior () (go-virtual notice) @@ -2372,17 +2363,17 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set-time! (-> self state-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)) + (logclear! (-> self enemy-flags) (enemy-flag cam-attack-mode)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) (let ((gp-0 (-> self on-active))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) ) ) ) - (when (not (logtest? (enemy-flag dangerous-backup) (-> self enemy-flags))) - (if (logtest? (-> self enemy-flags) (enemy-flag notice)) + (when (not (logtest? (enemy-flag chase-startup) (-> self enemy-flags))) + (if (logtest? (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logior! (-> self mask) (process-mask actor-pause)) (logclear! (-> self mask) (process-mask actor-pause)) ) @@ -2418,13 +2409,13 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set-time! (-> self state-time)) - (let ((v1-3 (logior (-> self enemy-flags) (enemy-flag use-notice-distance)))) - (set! (-> self enemy-flags) (logclear v1-3 (enemy-flag called-dying))) + (let ((v1-3 (logior (-> self enemy-flags) (enemy-flag cam-attack-mode)))) + (set! (-> self enemy-flags) (logclear v1-3 (enemy-flag use-trigger))) ) (logclear! (-> self mask) (process-mask actor-pause)) - (look-at-target! self (enemy-flag lock-focus)) - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (look-at-target! self (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -2432,7 +2423,7 @@ This commonly includes things such as: ) ) (let ((gp-1 (-> self focus aware))) - (when (logtest? (-> self enemy-flags) (enemy-flag chase-startup)) + (when (logtest? (-> self enemy-flags) (enemy-flag alert)) (cond ((and (= gp-1 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) @@ -2446,11 +2437,11 @@ This commonly includes things such as: ) ) ) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logior! (-> self enemy-flags) (enemy-flag alert)) ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) (gp-0 (new 'stack-no-clear 'vector)) ) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) @@ -2475,12 +2466,12 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set-time! (-> self state-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)) + (look-at-target! self (enemy-flag look-at-focus)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) + (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) (logclear! (-> self mask) (process-mask actor-pause)) - (when (logtest? (-> self enemy-flags) (enemy-flag drawn-mirrored)) - (logclear! (-> self enemy-flags) (enemy-flag drawn-mirrored)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-hostile)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-hostile)) (let ((gp-0 (-> self on-hostile))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -2489,7 +2480,7 @@ This commonly includes things such as: ) ) :trans (behavior () - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (let ((gp-0 (-> self focus aware))) @@ -2509,7 +2500,7 @@ This commonly includes things such as: (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -2527,7 +2518,7 @@ This commonly includes things such as: :enter (behavior () (set-time! (-> self state-time)) (logclear! (-> self mask) (process-mask actor-pause)) - (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) ) :trans (behavior () (when (time-elapsed? (-> self state-time) (seconds 0.1)) @@ -2548,7 +2539,7 @@ This commonly includes things such as: ) :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self enemy-info idle-anim))) ) (until #f @@ -2569,12 +2560,12 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (logclear! (-> self mask) (process-mask actor-pause)) ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info victory-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -2595,8 +2586,8 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set-time! (-> self state-time)) - (look-at-target! self (enemy-flag lock-focus)) - (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) + (look-at-target! self (enemy-flag look-at-focus)) + (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) (logclear! (-> self mask) (process-mask actor-pause)) ) :trans (behavior () @@ -2610,7 +2601,7 @@ This commonly includes things such as: (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -2630,8 +2621,8 @@ This commonly includes things such as: ;; definition for method 83 of type enemy ;; INFO: Used lq/sq (defmethod enemy-method-83 ((this enemy) (arg0 enemy-jump-info)) - (set! (-> arg0 flags) (the-as uint 1)) - (set! (-> arg0 anim-speed) (get-rand-float-range this 0.9 1.1)) + (set! (-> arg0 flags) (enemy-jump-flags enjflag-0)) + (set! (-> arg0 anim-speed) (rnd-float-range this 0.9 1.1)) (set! (-> arg0 hang-time) 0) (set! (-> arg0 dest-pos quad) (-> this event-param-point quad)) (set! (-> arg0 start-pos quad) (-> this root trans quad)) @@ -2688,9 +2679,8 @@ This commonly includes things such as: ;; definition for method 92 of type enemy ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-92 ((this enemy) (arg0 int) (arg1 nav-poly)) - "TODO - nav-poly is a guess -@abstract" +(defmethod enemy-method-92 ((this enemy) (arg0 int) (arg1 enemy-jump-info)) + "@abstract" 0 (none) ) @@ -2700,7 +2690,7 @@ This commonly includes things such as: (defmethod enemy-method-91 ((this enemy) (arg0 int) (arg1 enemy-jump-info)) (case arg0 ((2 3) - (logior! (-> this enemy-flags) (enemy-flag directed)) + (logior! (-> this enemy-flags) (enemy-flag recover-applied-velocity)) (let ((f30-0 (the float (-> arg1 hang-time)))) (let ((a1-3 (compute-trans-at-time (-> arg1 traj) f30-0 (new 'stack-no-clear 'vector)))) (move-to-point! (-> this root) a1-3) @@ -2855,7 +2845,7 @@ This commonly includes things such as: (logclear! (-> self focus-status) (focus-status in-air)) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -2865,18 +2855,18 @@ This commonly includes things such as: (let ((s5-0 0)) (enemy-method-83 self gp-0) (if (and (-> self enemy-info use-jump-blocked) - (logtest? (enemy-flag vulnerable) (-> self enemy-flags)) + (logtest? (enemy-flag jump-check-blocked) (-> self enemy-flags)) (enemy-method-82 self gp-0) ) (go-virtual jump-blocked) ) - (when (logtest? (-> gp-0 flags) 1) + (when (logtest? (-> gp-0 flags) (enemy-jump-flags enjflag-0)) (until #f (if (enemy-method-90 self s5-0 gp-0) (goto cfg-12) ) (enemy-method-91 self s5-0 gp-0) - (enemy-method-92 self s5-0 (the-as nav-poly gp-0)) + (enemy-method-92 self s5-0 gp-0) (suspend) (set! s5-0 1) ) @@ -2891,7 +2881,7 @@ This commonly includes things such as: (+! (-> 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)) + (enemy-method-92 self s5-1 gp-0) (suspend) (set! s5-1 3) ) @@ -2904,14 +2894,14 @@ This commonly includes things such as: (goto cfg-19) ) (enemy-method-91 self s5-2 gp-0) - (enemy-method-92 self s5-2 (the-as nav-poly gp-0)) + (enemy-method-92 self s5-2 gp-0) (suspend) (set! s5-2 5) ) ) #f (label cfg-19) - (if (logtest? (enemy-flag alert) (-> self enemy-flags)) + (if (logtest? (enemy-flag directed) (-> self enemy-flags)) ((lambda :behavior enemy ((arg0 enemy-jump-info)) (send-event (ppointer->process (-> self parent)) 'child-jumped) @@ -2944,7 +2934,7 @@ This commonly includes things such as: ) :trans (behavior () (when (time-elapsed? (-> self state-time) (seconds 0.5)) - (if (logtest? (enemy-flag alert) (-> self enemy-flags)) + (if (logtest? (enemy-flag directed) (-> self enemy-flags)) (go-virtual jump) (enemy-method-93 self) ) @@ -2959,7 +2949,7 @@ This commonly includes things such as: ) ) ) - (let ((f30-0 (get-rand-float-range self 0.75 1.25))) + (let ((f30-0 (rnd-float-range self 0.75 1.25))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -2982,7 +2972,7 @@ This commonly includes things such as: :code (behavior () (local-vars (v1-37 enemy-flag) (v1-45 enemy-flag)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info hit-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -2992,29 +2982,29 @@ This commonly includes things such as: (ja :num! (seek! max f30-0)) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-36 (-> self enemy-flags))) - (if (logtest? v1-36 (enemy-flag checking-water)) - (set! v1-37 (logior v1-36 (enemy-flag enable-on-active))) - (set! v1-37 (logclear v1-36 (enemy-flag enable-on-active))) + (if (logtest? v1-36 (enemy-flag vulnerable-backup)) + (set! v1-37 (logior v1-36 (enemy-flag vulnerable))) + (set! v1-37 (logclear v1-36 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-37) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-44 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-44) - (set! v1-45 (logior (enemy-flag check-water-backup) v1-44)) - (set! v1-45 (logclear v1-44 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-44) + (set! v1-45 (logior (enemy-flag trackable) v1-44)) + (set! v1-45 (logclear v1-44 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-45) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (go-hostile self) ) @@ -3024,9 +3014,9 @@ This commonly includes things such as: ;; definition for method 101 of type enemy ;; WARN: Return type mismatch collide-spec vs none. (defmethod enemy-method-101 ((this enemy)) - (when (not (logtest? (enemy-flag use-trigger) (-> this enemy-flags))) - (logior! (-> this enemy-flags) (enemy-flag use-trigger)) - (logclear! (-> this enemy-flags) (enemy-flag directed)) + (when (not (logtest? (enemy-flag recover) (-> this enemy-flags))) + (logior! (-> this enemy-flags) (enemy-flag recover)) + (logclear! (-> this enemy-flags) (enemy-flag recover-applied-velocity)) (enemy-method-124 this) ) (none) @@ -3034,8 +3024,8 @@ This commonly includes things such as: ;; definition for method 103 of type enemy (defmethod enemy-method-103 ((this enemy)) - (when (logtest? (enemy-flag use-trigger) (-> this enemy-flags)) - (logclear! (-> this enemy-flags) (enemy-flag use-trigger directed)) + (when (logtest? (enemy-flag recover) (-> this enemy-flags)) + (logclear! (-> this enemy-flags) (enemy-flag recover recover-applied-velocity)) (enemy-method-124 this) ) ) @@ -3054,7 +3044,7 @@ This commonly includes things such as: (enemy-method-103 this) (return (the-as symbol #f)) ) - (when (not (logtest? (enemy-flag directed) (-> this enemy-flags))) + (when (not (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags))) (let ((s5-0 (-> this root))) (if (focus-test? this under-water) (enemy-method-47 this (-> s5-0 transv)) @@ -3075,7 +3065,7 @@ This commonly includes things such as: ) ) ) - (logclear! (-> this enemy-flags) (enemy-flag directed)) + (logclear! (-> this enemy-flags) (enemy-flag recover-applied-velocity)) (if (and (enemy-method-102 this) (not (logtest? (-> this focus-status) (focus-status dead)))) (kill-prefer-falling this) ) @@ -3123,19 +3113,19 @@ This commonly includes things such as: (let ((s5-0 (-> this enemy-info))) (case (-> this incoming knocked-type) (((knocked-type knocked-type-2)) - (let ((f30-0 (get-rand-float-range this 0.0 1.0))) + (let ((f30-0 (rnd-float-range this 0.0 1.0))) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-hard-vxz-lo) (-> s5-0 knocked-hard-vxz-hi) f30-0)) (set! (-> arg0 y) (lerp (-> s5-0 knocked-hard-vy-lo) (-> s5-0 knocked-hard-vy-hi) f30-0)) ) ) (((knocked-type knocked-type-1)) - (let ((f30-1 (get-rand-float-range this 0.0 1.0))) + (let ((f30-1 (rnd-float-range this 0.0 1.0))) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-medium-vxz-lo) (-> s5-0 knocked-medium-vxz-hi) f30-1)) (set! (-> arg0 y) (lerp (-> s5-0 knocked-medium-vy-lo) (-> s5-0 knocked-medium-vy-hi) f30-1)) ) ) (((knocked-type knocked-type-3)) - (let ((f30-2 (get-rand-float-range this 0.0 1.0))) + (let ((f30-2 (rnd-float-range this 0.0 1.0))) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-huge-vxz-lo) (-> s5-0 knocked-huge-vxz-hi) f30-2)) (set! (-> arg0 y) (lerp (-> s5-0 knocked-huge-vy-lo) (-> s5-0 knocked-huge-vy-hi) f30-2)) ) @@ -3149,7 +3139,7 @@ This commonly includes things such as: (vector-negate! arg0 arg0) ) ) - (let ((f30-3 (get-rand-float-range this 0.0 1.0))) + (let ((f30-3 (rnd-float-range this 0.0 1.0))) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-yellow-vxz-lo) (-> s5-0 knocked-yellow-vxz-hi) f30-3)) (set! (-> arg0 y) (lerp (-> s5-0 knocked-yellow-vy-lo) (-> s5-0 knocked-yellow-vy-hi) f30-3)) ) @@ -3160,7 +3150,7 @@ This commonly includes things such as: (f2-0 61440.0) (f1-3 (fmin f1-2 (* f2-0 f2-0))) (f2-3 61440.0) - (f30-5 (* (- f0-26 (/ f1-3 (* f2-3 f2-3))) (get-rand-float-range this 0.8 1.0))) + (f30-5 (* (- f0-26 (/ f1-3 (* f2-3 f2-3))) (rnd-float-range this 0.8 1.0))) ) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-red-vxz-lo) (-> s5-0 knocked-red-vxz-hi) f30-5)) (set! (-> arg0 y) (lerp (-> s5-0 knocked-red-vy-lo) (-> s5-0 knocked-red-vy-hi) f30-5)) @@ -3172,7 +3162,7 @@ This commonly includes things such as: (f2-6 122880.0) (f1-6 (fmin f1-5 (* f2-6 f2-6))) (f2-9 122880.0) - (f30-7 (* (- f0-34 (/ f1-6 (* f2-9 f2-9))) (get-rand-float-range this 0.8 1.0))) + (f30-7 (* (- f0-34 (/ f1-6 (* f2-9 f2-9))) (rnd-float-range this 0.8 1.0))) ) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-blue-vxz-lo) (-> s5-0 knocked-blue-vxz-hi) f30-7)) (cond @@ -3180,7 +3170,7 @@ This commonly includes things such as: (set! (-> arg0 y) (lerp (-> s5-0 knocked-blue-vy-lo) (-> s5-0 knocked-blue-vy-hi) f30-7)) ) (else - (if (zero? (get-rand-int this 3)) + (if (zero? (rnd-int-count this 3)) (set! (-> arg0 y) 40960.0) ) ) @@ -3191,7 +3181,7 @@ This commonly includes things such as: (set! (-> arg0 quad) (-> this incoming attack-direction quad)) ) (else - (let ((f30-8 (get-rand-float-range this 0.0 1.0))) + (let ((f30-8 (rnd-float-range this 0.0 1.0))) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-soft-vxz-lo) (-> s5-0 knocked-soft-vxz-hi) f30-8)) (set! (-> arg0 y) (lerp (-> s5-0 knocked-soft-vy-lo) (-> s5-0 knocked-soft-vy-hi) f30-8)) ) @@ -3251,14 +3241,14 @@ This commonly includes things such as: ) ;; definition for method 77 of type enemy -(defmethod enemy-method-77 ((this enemy) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this enemy) (arg0 enemy-knocked-info)) (ja-channel-push! 1 0) (let ((a1-2 (-> this draw art-group data (-> this enemy-info knocked-anim))) (a0-4 (-> this skel root-channel 0)) ) (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-2)) (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-2) num-func-seek!) ) @@ -3266,13 +3256,13 @@ This commonly includes things such as: ) ;; definition for method 78 of type enemy -(defmethod enemy-method-78 ((this enemy) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this enemy) (arg0 enemy-knocked-info)) (let ((v1-4 (-> this draw art-group data (-> this enemy-info knocked-land-anim))) (a0-3 (-> this skel root-channel 0)) ) (set! (-> a0-3 frame-group) (the-as art-joint-anim v1-4)) (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim v1-4) frames num-frames) -1))) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim v1-4) num-func-seek!) ) @@ -3319,7 +3309,7 @@ This commonly includes things such as: (let ((v1-0 arg0)) (cond ((zero? v1-0) - (enemy-method-77 this (the-as (pointer float) arg1)) + (enemy-method-77 this arg1) (set! s5-0 #f) ) ((= v1-0 1) @@ -3331,7 +3321,7 @@ This commonly includes things such as: ) ) ((= v1-0 2) - (set! s5-0 (not (enemy-method-78 this (the-as (pointer float) arg1)))) + (set! s5-0 (not (enemy-method-78 this arg1))) (set! (-> this incoming blue-juggle-count) (the-as uint 0)) ) ((= v1-0 3) @@ -3361,7 +3351,7 @@ This commonly includes things such as: :enter (behavior () (set-time! (-> self state-time)) (stop-looking-at-target! self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self mask) (process-mask actor-pause)) (let* ((v1-8 *game-info*) (a0-4 (+ (-> v1-8 attack-id) 1)) @@ -3371,7 +3361,7 @@ This commonly includes things such as: ) (enemy-method-103 self) (if (logtest? (enemy-option knocked-into-water) (-> self fact enemy-options)) - (logior! (-> self enemy-flags) (enemy-flag trackable-backup)) + (logior! (-> self enemy-flags) (enemy-flag check-water)) ) (let ((v1-16 (-> self root))) (logclear! (-> v1-16 status) (collide-status @@ -3406,12 +3396,12 @@ This commonly includes things such as: (set! (-> self desired-angle) (enemy-method-51 self)) ) (if (zero? (-> self hit-points)) - (dispose! self) + (dying self) (enemy-method-135 self 0) ) (logclear! (-> self focus-status) (focus-status dangerous)) (if (= (-> self incoming knocked-type) (knocked-type knocked-type-4)) - (logclear! (-> self enemy-flags) (enemy-flag check-water-backup)) + (logclear! (-> self enemy-flags) (enemy-flag trackable)) ) (set! (-> self root penetrate-using) (penetrate lunge vehicle knocked)) (enemy-method-49 self) @@ -3420,9 +3410,9 @@ This commonly includes things such as: :exit (behavior () (local-vars (v1-1 enemy-flag) (v1-15 enemy-flag) (v1-23 enemy-flag)) (let ((v1-0 (-> self enemy-flags))) - (if (logtest? (enemy-flag enable-on-hostile) v1-0) - (set! v1-1 (logior (enemy-flag trackable-backup) v1-0)) - (set! v1-1 (logclear v1-0 (enemy-flag trackable-backup))) + (if (logtest? (enemy-flag check-water-backup) v1-0) + (set! v1-1 (logior (enemy-flag check-water) v1-0)) + (set! v1-1 (logclear v1-0 (enemy-flag check-water))) ) ) (set! (-> self enemy-flags) v1-1) @@ -3431,29 +3421,29 @@ This commonly includes things such as: (the-as penetrate (logclear (-> self root penetrate-using) (penetrate knocked))) ) (enemy-method-46 self 2) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-14 (-> self enemy-flags))) - (if (logtest? v1-14 (enemy-flag checking-water)) - (set! v1-15 (logior v1-14 (enemy-flag enable-on-active))) - (set! v1-15 (logclear v1-14 (enemy-flag enable-on-active))) + (if (logtest? v1-14 (enemy-flag vulnerable-backup)) + (set! v1-15 (logior v1-14 (enemy-flag vulnerable))) + (set! v1-15 (logclear v1-14 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-15) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-22 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-22) - (set! v1-23 (logior (enemy-flag check-water-backup) v1-22)) - (set! v1-23 (logclear v1-22 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-22) + (set! v1-23 (logior (enemy-flag trackable) v1-22)) + (set! v1-23 (logclear v1-22 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-23) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) ) ) @@ -3465,7 +3455,7 @@ This commonly includes things such as: :code (behavior () (let ((gp-0 (new 'stack-no-clear 'enemy-knocked-info))) (let ((s5-0 0)) - (set! (-> gp-0 anim-speed) (get-rand-float-range self 0.9 1.1)) + (set! (-> gp-0 anim-speed) (rnd-float-range self 0.9 1.1)) (set! (-> gp-0 on-surface-count) 0) (set! (-> gp-0 move-count) 0) (until (enemy-method-80 self gp-0) @@ -3500,7 +3490,7 @@ This commonly includes things such as: ) #f (label cfg-15) - (if (and (not (logtest? (enemy-flag recover) (-> self enemy-flags))) + (if (and (not (logtest? (enemy-flag death-start) (-> self enemy-flags))) (or (time-elapsed? (-> gp-0 land-can-land-time) (seconds 0.1)) (enemy-method-81 self) (enemy-method-102 self)) ) (kill-prefer-falling self) @@ -3513,7 +3503,7 @@ This commonly includes things such as: (cond ((or (zero? (-> self hit-points)) (nonzero? (-> self fated-time))) (cond - ((logtest? (enemy-flag recover) (-> self enemy-flags)) + ((logtest? (enemy-flag death-start) (-> self enemy-flags)) (set! (-> self hit-points) 0) (let ((v1-67 (-> self root root-prim))) (set! (-> v1-67 prim-core collide-as) (collide-spec)) @@ -3541,15 +3531,13 @@ This commonly includes things such as: ) ;; definition for method 132 of type enemy -(defmethod dispose! ((this enemy)) +(defmethod dying ((this enemy)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" - (when (not (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags))) - (set! (-> this enemy-flags) - (the-as enemy-flag (logior (enemy-flag recover-applied-velocity) (-> this enemy-flags))) - ) + (when (not (logtest? (enemy-flag called-dying) (-> this enemy-flags))) + (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag called-dying) (-> this enemy-flags)))) (enemy-method-135 this 1) (when (and (>= (-> this enemy-info gem-joint) 0) - (not (logtest? (enemy-flag cam-attack-mode) (-> this enemy-flags))) + (not (logtest? (enemy-flag spawn-gem) (-> this enemy-flags))) (or (and (not (and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status save)))) (-> this entity) ) @@ -3557,7 +3545,7 @@ This commonly includes things such as: (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) ) ) - (logior! (-> this enemy-flags) (enemy-flag cam-attack-mode)) + (logior! (-> this enemy-flags) (enemy-flag spawn-gem)) (remove-from-process *part-engine* this) (setup-masks (-> this draw) @@ -3571,13 +3559,13 @@ This commonly includes things such as: (birth-pickup-at-point a0-18 (pickup-type gem) 1.0 #t *entity-pool* (-> this fact)) ) ) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag check-water)) + (logclear! (-> this enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (logior! (-> this focus-status) (focus-status dead)) (if (-> this skel effect) (logior! (-> this skel effect flags) (effect-control-flag ecf1)) @@ -3592,7 +3580,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (dispose! self) + (dying self) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -3604,7 +3592,7 @@ This commonly includes things such as: ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info die-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -3643,7 +3631,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (dispose! self) + (dying self) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -3651,16 +3639,16 @@ This commonly includes things such as: 0 (set! (-> self hit-points) 0) (if (logtest? (enemy-option knocked-into-water) (-> self fact enemy-options)) - (logior! (-> self enemy-flags) (enemy-flag trackable-backup)) + (logior! (-> self enemy-flags) (enemy-flag check-water)) ) (enemy-method-103 self) ) :exit (behavior () (local-vars (v0-0 enemy-flag)) (let ((v1-0 (-> self enemy-flags))) - (if (logtest? (enemy-flag enable-on-hostile) v1-0) - (set! v0-0 (logior (enemy-flag trackable-backup) v1-0)) - (set! v0-0 (logclear v1-0 (enemy-flag trackable-backup))) + (if (logtest? (enemy-flag check-water-backup) v1-0) + (set! v0-0 (logior (enemy-flag check-water) v1-0)) + (set! v0-0 (logclear v1-0 (enemy-flag check-water))) ) ) (set! (-> self enemy-flags) v0-0) @@ -3673,7 +3661,7 @@ This commonly includes things such as: ) ) ) - (f30-0 (get-rand-float-range self 0.8 1.2)) + (f30-0 (rnd-float-range self 0.8 1.2)) ) (ja-no-eval :group! gp-0 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -3695,11 +3683,11 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag victory)) + (logior! (-> self enemy-flags) (enemy-flag directed-ready)) ((-> (method-of-type enemy idle) enter)) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag directed-ready)) ) :code (-> (method-of-type enemy idle) code) :post (-> (method-of-type enemy idle) post) 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 716d2ef48f..9a1bde417f 100644 --- a/test/decompiler/reference/jak2/engine/anim/fma-sphere_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/fma-sphere_REF.gc @@ -62,7 +62,7 @@ (mode 'eco-red) (attacker-velocity (-> self root transv)) (damage 2.0) - (knock (the-as uint 2)) + (knock (knocked-type knocked-type-2)) ) ) ) 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 6d2bf56cc5..b4303c008a 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint-exploder_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint-exploder_REF.gc @@ -246,8 +246,8 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun joint-exploder-joint-callback ((arg0 draw-control) (arg1 cspace-array) (arg2 joint-control)) - (let ((s4-0 (-> arg0 process))) - (let ((s3-0 (-> (the-as joint-exploder s4-0) joints))) + (let ((exploder (the-as joint-exploder (-> arg0 process)))) + (let ((s3-0 (-> exploder joints))) (countdown (s2-0 (-> s3-0 num-joints)) (let* ((v1-3 (-> s3-0 joint s2-0)) (a0-5 (-> arg1 data (-> v1-3 joint-index) bone transform)) @@ -256,10 +256,10 @@ ) ) ) - (let ((s4-1 (&-> s4-0 stack 96))) + (let ((s4-1 (-> exploder scale-vector))) (countdown (s3-1 (-> arg1 length)) (let ((a2-2 (-> arg1 data s3-1 bone transform))) - (scale-matrix! a2-2 (the-as vector s4-1) a2-2) + (scale-matrix! a2-2 s4-1 a2-2) ) ) ) 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 eed80206bb..214a30274f 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc @@ -1502,94 +1502,92 @@ ;; WARN: Stack slot offset 128 signed mismatch ;; WARN: Stack slot offset 128 signed mismatch ;; WARN: Stack slot offset 128 signed mismatch -(defun los-cw-ccw ((arg0 (inline-array collide-cache-tri)) - (arg1 vector) - (arg2 vector) - (arg3 float) - (arg4 collide-los-result) - (arg5 vector) - (arg6 float) - ) +(defbehavior los-cw-ccw camera-slave ((arg0 (inline-array collide-cache-tri)) + (arg1 vector) + (arg2 vector) + (arg3 float) + (arg4 collide-los-result) + (arg5 vector) + (arg6 float) + ) (local-vars (sv-128 float) (sv-144 vector) (sv-160 vector) (sv-176 vector) (sv-192 vector) (sv-208 int)) - (with-pp - (set! sv-128 arg3) - (let ((gp-0 arg4)) - (set! sv-144 arg5) - (let ((s4-0 arg6)) - (set! sv-160 (new 'stack-no-clear 'vector)) - (set! sv-176 (new 'stack-no-clear 'vector)) - (let ((s5-0 (new 'stack-no-clear 'matrix))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((f30-0 0.0) - (s0-0 #f) - ) - (set! sv-208 0) - (while (< sv-208 4) - (cond - ((= sv-208 3) - (vector-! sv-160 sv-144 (the-as vector (&-> pp stack 432))) - (set! (-> s5-0 vector sv-208 z) 0.0) - ) - (else - (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) - (set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down))) - (vector-! sv-160 (-> arg0 0 vertex sv-208) (the-as vector (&-> pp stack 432))) - ) - ) - (vector-flatten! sv-160 sv-160 (-> *camera* local-down)) - (vector-cross! sv-176 sv-160 arg2) - (let ((f28-0 (vector-dot sv-176 (-> *camera* local-down)))) - (cond - ((< (* f28-0 f30-0) 0.0) - (set! s0-0 #t) - ) - ((!= f28-0 0.0) - (set! f30-0 f28-0) - ) - ) - (set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2)) - (cond - ((= sv-208 3) - (vector-! sv-192 sv-144 (the-as vector (&-> pp stack 432))) - (vector-flatten! sv-192 sv-192 arg1) - ) - (else - (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)) - ) - ) - (if (< f28-0 0.0) - (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) - (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)) - ) - ) - (set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x))) - (set! sv-208 (+ sv-208 1)) + (set! sv-128 arg3) + (let ((gp-0 arg4)) + (set! sv-144 arg5) + (let ((s4-0 arg6)) + (set! sv-160 (new 'stack-no-clear 'vector)) + (set! sv-176 (new 'stack-no-clear 'vector)) + (let ((s5-0 (new 'stack-no-clear 'matrix))) + (set! sv-192 (new 'stack-no-clear 'vector)) + (let ((f30-0 0.0) + (s0-0 #f) ) + (set! sv-208 0) + (while (< sv-208 4) (cond - ((and s0-0 (!= (the-as int s4-0) -859915232)) - (dotimes (s4-1 4) - (dist-info-append (-> gp-0 straddle) (the-as vector (+ (the-as uint s5-0) (* s4-1 16)))) - ) - #f - ) - ((< (-> s5-0 trans y) 0.0) - (dotimes (s4-2 4) - (when (>= (-> s5-0 trans y) (-> s5-0 vector s4-2 y)) - (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) - (dist-info-append (-> gp-0 ccw) (the-as vector (+ (the-as uint s5-0) (* s4-2 16)))) - ) - ) - #f + ((= sv-208 3) + (vector-! sv-160 sv-144 (-> self string-trans)) + (set! (-> s5-0 vector sv-208 z) 0.0) ) (else - (dotimes (s4-3 4) - (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 trans y)) - (dist-info-append (-> gp-0 cw) (the-as vector (+ (the-as uint s5-0) (* s4-3 16)))) - ) - ) - #f + (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) + (set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down))) + (vector-! sv-160 (-> arg0 0 vertex sv-208) (-> self string-trans)) ) ) + (vector-flatten! sv-160 sv-160 (-> *camera* local-down)) + (vector-cross! sv-176 sv-160 arg2) + (let ((f28-0 (vector-dot sv-176 (-> *camera* local-down)))) + (cond + ((< (* f28-0 f30-0) 0.0) + (set! s0-0 #t) + ) + ((!= f28-0 0.0) + (set! f30-0 f28-0) + ) + ) + (set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2)) + (cond + ((= sv-208 3) + (vector-! sv-192 sv-144 (-> self string-trans)) + (vector-flatten! sv-192 sv-192 arg1) + ) + (else + (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)) + ) + ) + (if (< f28-0 0.0) + (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) + (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)) + ) + ) + (set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x))) + (set! sv-208 (+ sv-208 1)) + ) + (cond + ((and s0-0 (!= (the-as int s4-0) -859915232)) + (dotimes (s4-1 4) + (dist-info-append (-> gp-0 straddle) (the-as vector (+ (the-as uint s5-0) (* s4-1 16)))) + ) + #f + ) + ((< (-> s5-0 trans y) 0.0) + (dotimes (s4-2 4) + (when (>= (-> s5-0 trans y) (-> s5-0 vector s4-2 y)) + (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) + (dist-info-append (-> gp-0 ccw) (the-as vector (+ (the-as uint s5-0) (* s4-2 16)))) + ) + ) + #f + ) + (else + (dotimes (s4-3 4) + (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 trans y)) + (dist-info-append (-> gp-0 cw) (the-as vector (+ (the-as uint s5-0) (* s4-3 16)))) + ) + ) + #f + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/game/game-h_REF.gc b/test/decompiler/reference/jak2/engine/game/game-h_REF.gc index 5033fa53d6..abcdc5c1af 100644 --- a/test/decompiler/reference/jak2/engine/game/game-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/game-h_REF.gc @@ -291,7 +291,7 @@ (penetrate-using penetrate) (damage float) (shield-damage float) - (knock uint8) + (knock knocked-type) (test symbol) ) (:methods 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 4a04df1560..0ab392cf8e 100644 --- a/test/decompiler/reference/jak2/engine/nav/nav-enemy_REF.gc +++ b/test/decompiler/reference/jak2/engine/nav/nav-enemy_REF.gc @@ -71,7 +71,7 @@ (if (<= s4-0 0) (go process-drawable-art-error "no path") ) - (let ((s2-0 (get-rand-int this s4-0)) + (let ((s2-0 (rnd-int-count this s4-0)) (s5-0 (new 'stack-no-clear 'vector)) ) (countdown (s3-0 s4-0) @@ -148,7 +148,7 @@ (enemy-method-103 this) (return (the-as symbol #f)) ) - (when (not (logtest? (enemy-flag directed) (-> this enemy-flags))) + (when (not (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags))) (let ((s5-0 (-> this root))) (if (focus-test? this under-water) (enemy-method-47 this (-> s5-0 transv)) @@ -169,7 +169,7 @@ ) ) ) - (logclear! (-> this enemy-flags) (enemy-flag directed)) + (logclear! (-> this enemy-flags) (enemy-flag recover-applied-velocity)) (if (and (enemy-method-102 this) (not (logtest? (-> this focus-status) (focus-status dead)))) (kill-prefer-falling this) ) @@ -205,7 +205,7 @@ ;; definition for method 55 of type nav-enemy ;; WARN: Return type mismatch int vs none. -(defmethod track-target! ((self nav-enemy)) +(defmethod common-post ((self nav-enemy)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -214,7 +214,7 @@ (set-time! (-> self last-draw-time)) ) (enemy-method-129 self) - (when (logtest? (enemy-flag use-trigger) (-> self enemy-flags)) + (when (logtest? (enemy-flag recover) (-> self enemy-flags)) (if (-> self nav) (enemy-method-100 self) (enemy-method-103 self) @@ -225,7 +225,7 @@ (look-at! (-> *target* neck) (the-as vector (-> self root root-prim prim-core)) - (if (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance)) + (if (logtest? (-> self enemy-flags) (enemy-flag cam-attack-mode)) 'attacking ) self @@ -234,14 +234,14 @@ ) (when (nonzero? (-> self neck)) (cond - ((logtest? (-> self enemy-flags) (enemy-flag lock-focus)) + ((logtest? (-> self enemy-flags) (enemy-flag look-at-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)) + ((logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) (let ((s5-1 (-> self move-dest)) (v1-47 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self enemy-info neck-joint))) @@ -257,10 +257,10 @@ ) ) ) - (when (and (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) + (when (and (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) (time-elapsed? (-> self auto-reset-penetrate-time) (seconds 0.1)) ) - (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) + (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) (set! (-> self root penetrated-by) (get-penetrate-info self)) (let ((v1-62 0)) (if (logtest? (penetrate knocked) (-> self root penetrate-using)) @@ -269,10 +269,10 @@ (set! (-> self root penetrate-using) (the-as penetrate v1-62)) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) (enemy-method-136 self) ) - (if (logtest? (enemy-flag trackable-backup directed-ready) (-> self enemy-flags)) + (if (logtest? (enemy-flag check-water checking-water) (-> self enemy-flags)) (enemy-method-54 self) ) (let ((v1-73 (-> self restore-nav-radius-time))) @@ -313,12 +313,14 @@ (nav-enemy-method-177 this) (cond ((nav-enemy-method-174 this) - (logior! (-> this enemy-flags) (enemy-flag directed)) + (logior! (-> this enemy-flags) (enemy-flag recover-applied-velocity)) (let ((s5-0 (-> this nav))) (when (logtest? (-> s5-0 state flags) (nav-state-flag at-gap)) (let ((s4-0 (new 'stack-no-clear 'nav-gap-info))) (when (plan-over-pat1-polys-using-route (-> s5-0 state) s4-0) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag vulnerable) (-> this enemy-flags)))) + (set! (-> this enemy-flags) + (the-as enemy-flag (logior (enemy-flag jump-check-blocked) (-> this enemy-flags))) + ) (send-event this 'jump 1 (-> s4-0 dest)) ) ) @@ -352,7 +354,7 @@ 0 ) ) - (track-target! this) + (common-post this) (update-transforms (-> this root)) 0 (none) @@ -1147,11 +1149,11 @@ (set! (-> a0-2 param1) #f) (set! (-> a0-2 param2) #f) ) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag dislike-combo) (-> this enemy-flags)))) + (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag drawn-mirrored) (-> this enemy-flags)))) ) (logior! (-> this mask) (process-mask enemy)) (logior! (-> this mask) (process-mask actor-pause)) - (logior! (-> this enemy-flags) (enemy-flag notice)) + (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (set! (-> this nav-radius-backup) (-> this root nav-radius)) (set-enemy-info! this arg0) (set! (-> this enemy-info callback-info) *nav-enemy-callback-info*) @@ -1261,13 +1263,13 @@ (set! (-> this on-hostile) (res-lump-struct (-> this entity) 'on-hostile pair)) (set! (-> this on-death) (res-lump-struct (-> this entity) 'on-death pair)) (if (-> this on-notice) - (logior! (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) + (logior! (-> this enemy-flags) (enemy-flag enable-on-notice)) ) (if (-> this on-active) - (logior! (-> this enemy-flags) (enemy-flag jump-check-blocked)) + (logior! (-> this enemy-flags) (enemy-flag enable-on-active)) ) (if (-> this on-hostile) - (logior! (-> this enemy-flags) (enemy-flag drawn-mirrored)) + (logior! (-> this enemy-flags) (enemy-flag enable-on-hostile)) ) (set! (-> this incoming attacker-handle) (the-as handle #f)) (let ((s4-0 (-> this root))) @@ -1277,33 +1279,27 @@ ) (set! (-> this penetrated-flinch) (-> arg0 penetrate-flinch)) (set! (-> this penetrated-knocked) (-> arg0 penetrate-knocked)) - (set! (-> this reaction-time) (the-as time-frame (get-rand-int-range this 30 240))) + (set! (-> this reaction-time) (the-as time-frame (rnd-int-range this 30 240))) (let* ((v1-113 (-> this enemy-flags)) (a0-47 (-> this fact enemy-options)) - (v1-114 (logior (enemy-flag - enable-on-active - checking-water - enable-on-notice - look-at-move-dest - check-water-backup - no-initial-move-to-ground - ) - v1-113 - ) - ) + (v1-114 + (logior (enemy-flag vulnerable vulnerable-backup use-notice-distance attackable-backup trackable trackable-backup) + v1-113 + ) + ) ) (if (logtest? (enemy-option multi-focus) a0-47) - (set! v1-114 (logior (enemy-flag trackable) v1-114)) + (set! v1-114 (logior (enemy-flag multi-focus) v1-114)) ) (if (logtest? (enemy-option has-trigger) a0-47) - (set! v1-114 (logior (enemy-flag called-dying) v1-114)) + (set! v1-114 (logior (enemy-flag use-trigger) v1-114)) ) (set! (-> this enemy-flags) v1-114) ) (logior! (-> this mask) (process-mask collectable)) (do-navigation-to-destination (-> this nav state) (-> this root trans)) (if (and (-> this enemy-info move-to-ground) - (not (logtest? (enemy-flag vulnerable-backup) (-> this enemy-flags))) + (not (logtest? (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) (not (logtest? (enemy-option ambush) (-> this fact enemy-options))) ) (enemy-method-127 this 40960.0 40960.0 #t (the-as collide-spec (-> this gnd-collide))) @@ -1387,7 +1383,7 @@ This commonly includes things such as: ;; definition for function nav-enemy-simple-post ;; WARN: Return type mismatch int vs none. (defbehavior nav-enemy-simple-post nav-enemy () - (track-target! self) + (common-post self) (update-transforms (-> self root)) 0 (none) @@ -1508,7 +1504,7 @@ This commonly includes things such as: ;; WARN: Return type mismatch int vs time-frame. (defmethod nav-enemy-method-144 ((this nav-enemy)) (set! (-> this root nav-radius) 4.096) - (let ((s5-1 (max (-> this restore-nav-radius-time) (+ (current-time) (get-rand-int-range this 1500 2400))))) + (let ((s5-1 (max (-> this restore-nav-radius-time) (+ (current-time) (rnd-int-range this 1500 2400))))) (set! (-> this restore-nav-radius-time) (the-as time-frame s5-1)) (the-as time-frame s5-1) ) @@ -1749,7 +1745,7 @@ This commonly includes things such as: ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info walk-anim)) :num! (seek! max f30-0) @@ -1759,7 +1755,7 @@ This commonly includes things such as: (suspend) (ja :num! (seek! max f30-0)) ) - (when (enemy-method-123 self 0.2) + (when (rnd-go-idle? self 0.2) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.6)) (let ((v1-37 self)) @@ -1777,7 +1773,7 @@ This commonly includes things such as: (suspend) (ja :num! (seek! max f30-0)) ) - (until (not (enemy-method-123 self 0.2)) + (until (not (rnd-go-idle? self 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -1856,7 +1852,7 @@ This commonly includes things such as: ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) (gp-0 (new 'stack-no-clear 'vector)) ) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) @@ -1903,7 +1899,7 @@ This commonly includes things such as: ) :trans (behavior () (nav-enemy-method-160 self) - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (when (time-elapsed? (-> self state-time) (-> self reaction-time)) @@ -1951,7 +1947,7 @@ This commonly includes things such as: (set! (-> self state-timeout) (the-as time-frame - (the int (+ (lerp-scale 300.0 1200.0 f0-0 32768.0 122880.0) (get-rand-float-range self 0.0 30.0))) + (the int (+ (lerp-scale 300.0 1200.0 f0-0 32768.0 122880.0) (rnd-float-range self 0.0 30.0))) ) ) ) @@ -1973,7 +1969,7 @@ This commonly includes things such as: ) :trans (behavior () (nav-enemy-method-160 self) - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (when (time-elapsed? (-> self state-time) (seconds 0.1)) @@ -2006,7 +2002,7 @@ This commonly includes things such as: (ja-channel-push! 1 (seconds 0.1)) (ja :group! (-> self draw art-group data (-> self enemy-info walk-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -2097,7 +2093,7 @@ This commonly includes things such as: ) :trans (behavior () (nav-enemy-method-160 self) - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (let ((gp-0 (-> self focus aware))) @@ -2135,7 +2131,7 @@ This commonly includes things such as: ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self enemy-info idle-anim))) ) (until #f @@ -2184,8 +2180,8 @@ This commonly includes things such as: ) :code (behavior () (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)) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) + (let ((gp-0 (rnd-int-range self 60 210)) (s5-0 (current-time)) (f28-0 f30-0) ) @@ -2219,8 +2215,8 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set-time! (-> self state-time)) - (look-at-target! self (enemy-flag lock-focus)) - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (look-at-target! self (enemy-flag look-at-focus)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (let ((v1-6 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-6 enemy-flags))) (set! (-> v1-6 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-6 enemy-flags)))) @@ -2236,9 +2232,9 @@ This commonly includes things such as: (nav-enemy-method-165 self) (logclear! (-> self mask) (process-mask actor-pause)) (set! (-> self move-dest quad) (-> self root trans quad)) - (set! (-> self state-timeout) (the-as time-frame (get-rand-int-range self 2100 3300))) + (set! (-> self state-timeout) (the-as time-frame (rnd-int-range self 2100 3300))) (set-time! (-> self starting-time)) - (if (zero? (get-rand-int self 2)) + (if (zero? (rnd-int-count 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)))) ) @@ -2282,7 +2278,7 @@ This commonly includes things such as: ) ) (when (>= 1024.0 (vector-vector-xz-distance (-> self root trans) (-> self move-dest))) - (when (and (time-elapsed? (-> self state-time) (-> self reaction-time)) (zero? (get-rand-int self 3))) + (when (and (time-elapsed? (-> self state-time) (-> self reaction-time)) (zero? (rnd-int-count self 3))) (nav-enemy-method-161 self) (go-stare2 self) ) @@ -2301,7 +2297,7 @@ This commonly includes things such as: (set! (-> s5-0 quad) (-> self focus-pos quad)) (vector-! s4-0 (-> self root trans) s5-0) (set! (-> s4-0 y) 0.0) - (vector-normalize! s4-0 (get-rand-float-range self 16384.0 49152.0)) + (vector-normalize! s4-0 (rnd-float-range self 16384.0 49152.0)) (vector-rotate-around-y! s4-0 s4-0 f30-1) (vector+! s5-0 s5-0 s4-0) (if (and (cloest-point-on-mesh (-> self nav) s5-0 s5-0 (the-as nav-poly #f)) @@ -2315,7 +2311,7 @@ This commonly includes things such as: ) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self enemy-info walk-anim))) ) (let ((v1-8 (ja-group))) @@ -2352,8 +2348,8 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set-time! (-> self state-time)) - (look-at-target! self (enemy-flag lock-focus)) - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (look-at-target! self (enemy-flag look-at-focus)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (let ((v1-6 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-6 enemy-flags))) (set! (-> v1-6 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-6 enemy-flags)))) @@ -2377,8 +2373,8 @@ This commonly includes things such as: (let ((f30-0 (-> self enemy-info circle-dist-lo)) (f28-0 (-> self enemy-info circle-dist-hi)) ) - (if (zero? (get-rand-int self 4)) - (set! (-> self desired-angle) (get-rand-float-range self f30-0 f28-0)) + (if (zero? (rnd-int-count self 4)) + (set! (-> self desired-angle) (rnd-float-range self f30-0 f28-0)) (set! (-> self desired-angle) (fmax (fmin (vector-vector-xz-distance (-> self focus-pos) (-> self root trans)) f28-0) f30-0) ) @@ -2423,7 +2419,7 @@ This commonly includes things such as: ) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self enemy-info walk-anim))) ) (let ((v1-8 (ja-group))) @@ -2569,7 +2565,7 @@ This commonly includes things such as: :code (behavior () (local-vars (v1-37 enemy-flag) (v1-45 enemy-flag)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info hit-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -2579,29 +2575,29 @@ This commonly includes things such as: (ja :num! (seek! max f30-0)) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-36 (-> self enemy-flags))) - (if (logtest? v1-36 (enemy-flag checking-water)) - (set! v1-37 (logior v1-36 (enemy-flag enable-on-active))) - (set! v1-37 (logclear v1-36 (enemy-flag enable-on-active))) + (if (logtest? v1-36 (enemy-flag vulnerable-backup)) + (set! v1-37 (logior v1-36 (enemy-flag vulnerable))) + (set! v1-37 (logclear v1-36 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-37) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-44 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-44) - (set! v1-45 (logior (enemy-flag check-water-backup) v1-44)) - (set! v1-45 (logclear v1-44 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-44) + (set! v1-45 (logior (enemy-flag trackable) v1-44)) + (set! v1-45 (logclear v1-44 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-45) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (go-hostile self) ) @@ -2692,14 +2688,13 @@ This commonly includes things such as: ;; definition for method 92 of type nav-enemy ;; WARN: Return type mismatch quaternion vs none. -(defmethod enemy-method-92 ((this nav-enemy) (arg0 int) (arg1 nav-poly)) - "TODO - nav-poly is a guess -@abstract" +(defmethod enemy-method-92 ((this nav-enemy) (arg0 int) (arg1 enemy-jump-info)) + "@abstract" (let ((v1-0 arg0)) (when (or (zero? v1-0) (= v1-0 1) (= v1-0 2) (= v1-0 3)) (let ((a1-4 this)) (if (logtest? (enemy-flag enemy-flag37) (-> a1-4 enemy-flags)) - (seek-to-point-toward-point! (-> this root) (-> arg1 vertex2) (-> this nav max-rotation-rate) (seconds 0.02)) + (seek-to-point-toward-point! (-> this root) (-> arg1 dest-pos) (-> this nav max-rotation-rate) (seconds 0.02)) ) ) ) @@ -2743,7 +2738,7 @@ This commonly includes things such as: (let ((s5-0 0)) (enemy-method-83 self gp-0) (if (and (-> self enemy-info use-jump-blocked) - (logtest? (enemy-flag vulnerable) (-> self enemy-flags)) + (logtest? (enemy-flag jump-check-blocked) (-> self enemy-flags)) (enemy-method-82 self gp-0) ) (go-virtual jump-blocked) @@ -2764,13 +2759,13 @@ This commonly includes things such as: (logior! (-> v1-18 shape nav-flags) (nav-flags has-extra-sphere)) ) 0 - (when (logtest? (-> gp-0 flags) 1) + (when (logtest? (-> gp-0 flags) (enemy-jump-flags enjflag-0)) (until #f (if (enemy-method-90 self s5-0 gp-0) (goto cfg-12) ) (enemy-method-91 self s5-0 gp-0) - (enemy-method-92 self s5-0 (the-as nav-poly gp-0)) + (enemy-method-92 self s5-0 gp-0) (suspend) (set! s5-0 1) ) @@ -2785,7 +2780,7 @@ This commonly includes things such as: (+! (-> 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)) + (enemy-method-92 self s5-1 gp-0) (suspend) (set! s5-1 3) ) @@ -2807,14 +2802,14 @@ This commonly includes things such as: (goto cfg-19) ) (enemy-method-91 self s5-2 gp-0) - (enemy-method-92 self s5-2 (the-as nav-poly gp-0)) + (enemy-method-92 self s5-2 gp-0) (suspend) (set! s5-2 5) ) ) #f (label cfg-19) - (if (logtest? (enemy-flag alert) (-> self enemy-flags)) + (if (logtest? (enemy-flag directed) (-> self enemy-flags)) ((lambda :behavior nav-enemy ((arg0 enemy-jump-info)) (send-event (ppointer->process (-> self parent)) 'child-jumped) @@ -2874,7 +2869,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag victory)) + (logior! (-> self enemy-flags) (enemy-flag directed-ready)) ((-> (method-of-type nav-enemy idle) enter)) ) :code (-> (method-of-type nav-enemy idle) code) 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 0095b1e576..7f5b0b2340 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 @@ -2960,7 +2960,7 @@ (set! (-> v1-6 invinc-time) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout))) (set! (-> v1-6 speed) 1.0) (set! (-> v1-6 damage) (-> *FACT-bank* health-default-inc)) - (set! (-> v1-6 knock) (the-as uint 0)) + (set! (-> v1-6 knock) (knocked-type knocked-type-0)) ) (case arg0 (('shove) @@ -3044,7 +3044,7 @@ ) ) (when (not (and (= (-> self game mode) 'play) (>= 0.0 (-> (the-as fact-info-target (-> self fact)) health)))) - (when (= (-> gp-0 knock) 8) + (when (= (-> gp-0 knock) (knocked-type knocked-type-8)) (set-quaternion! (-> self control) (-> self control dir-targ)) (set-forward-vel (* -3.0 (-> gp-0 shove-back))) (when (demo?) diff --git a/test/decompiler/reference/jak2/engine/target/mech/grunt-mech_REF.gc b/test/decompiler/reference/jak2/engine/target/mech/grunt-mech_REF.gc index abc65713e9..03543390e7 100644 --- a/test/decompiler/reference/jak2/engine/target/mech/grunt-mech_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/mech/grunt-mech_REF.gc @@ -228,12 +228,12 @@ ;; definition for method 55 of type grunt-mech ;; WARN: Return type mismatch int vs none. -(defmethod track-target! ((this grunt-mech)) +(defmethod common-post ((this grunt-mech)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - ((method-of-type grunt track-target!) this) + ((method-of-type grunt common-post) this) 0 (none) ) @@ -289,7 +289,7 @@ (when (!= gp-0 -1) (let ((s3-1 (-> s4-0 holds gp-0 lower-hold))) (when (!= s3-1 -1) - (if (and (or (zero? (get-rand-int this 2)) + (if (and (or (zero? (rnd-int-count this 2)) (>= 14336.0 (vector-vector-xz-distance-squared (-> this root trans) (target-pos 0))) ) (grunt-mech-info-method-9 s4-0 s3-1 this #t) @@ -383,7 +383,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (let ((v1-2 self)) (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag37)))) ) @@ -398,7 +398,7 @@ (logclear! (-> self root nav-flags) (nav-flags has-root-sphere)) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) ) :trans (behavior () @@ -546,8 +546,8 @@ (vector-normalize! s5-1 1.0) (countdown (s4-0 3) (let ((s3-0 (new 'stack-no-clear 'vector))) - (vector-rotate-around-y! s3-0 s5-1 (get-rand-float-range this -10922.667 10922.667)) - (when (grunt-mech-method-195 this s3-0 (the-as vector (get-rand-float-range this 16384.0 24576.0)) s5-1) + (vector-rotate-around-y! s3-0 s5-1 (rnd-float-range this -10922.667 10922.667)) + (when (grunt-mech-method-195 this s3-0 (the-as vector (rnd-float-range this 16384.0 24576.0)) s5-1) #t (goto cfg-16) ) @@ -591,14 +591,14 @@ :event enemy-event-handler :enter (behavior () (set-time! (-> self state-time)) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (set! (-> self root root-prim prim-core collide-as) (collide-spec)) (stop-looking-at-target! self) - (set! (-> self state-timeout) (+ (current-time) (get-rand-int-range self 450 900))) + (set! (-> self state-timeout) (+ (current-time) (rnd-int-range self 450 900))) (logclear! (-> self root nav-flags) (nav-flags has-root-sphere)) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (-> self root backup-collide-as)) (set! (-> v1-3 prim-core collide-with) (-> self root backup-collide-with)) @@ -620,12 +620,12 @@ (let ((gp-0 0)) 0 (until #f - (set! gp-0 (enemy-method-120 self 3 (ash 1 gp-0))) + (set! gp-0 (rnd-bit self 3 (ash 1 gp-0))) (let ((v1-30 gp-0)) (cond ((zero? v1-30) (ja-channel-push! 1 (seconds 0.13)) - (countdown (s5-0 (get-rand-int-range self 1 2)) + (countdown (s5-0 (rnd-int-range self 1 2)) (let ((s4-0 #t)) (ja-no-eval :group! grunt-mech-head-butt-ja :num! (seek! (ja-aframe 17.0 0) 0.222) :frame-num 0.0) (until (ja-done? 0) @@ -647,7 +647,7 @@ ) ((= v1-30 1) (ja-channel-push! 1 (seconds 0.13)) - (countdown (s5-1 (get-rand-int-range self 1 3)) + (countdown (s5-1 (rnd-int-range self 1 3)) (let ((s4-1 #t)) (ja-no-eval :group! grunt-mech-punch-left-ja :num! (seek! (ja-aframe 24.0 0) 0.568) :frame-num 0.0) (until (ja-done? 0) @@ -672,7 +672,7 @@ ) (else (ja-channel-push! 1 (seconds 0.13)) - (countdown (s5-2 (get-rand-int-range self 1 3)) + (countdown (s5-2 (rnd-int-range self 1 3)) (let ((s4-2 #t)) (ja-no-eval :group! grunt-mech-double-pound-ja :num! (seek! (ja-aframe 30.0 0) 0.111) :frame-num 0.0) (until (ja-done? 0) @@ -697,7 +697,7 @@ ) ) ) - (when (= (get-rand-int self 4) 3) + (when (= (rnd-int-count self 4) 3) (ja-channel-push! 1 (seconds 0.13)) (ja-no-eval :group! grunt-mech-idle0-ja :num! (seek! max 0.090909) :frame-num 0.0) (until (ja-done? 0) @@ -803,7 +803,7 @@ :event enemy-event-handler :enter (behavior () ((-> (method-of-type grunt circling) enter)) - (set! (-> self state-timeout) (+ (current-time) (get-rand-int-range self 750 1200))) + (set! (-> self state-timeout) (+ (current-time) (rnd-int-range self 750 1200))) ) :trans (behavior () (let ((a0-1 (handle->process (-> self focus handle)))) @@ -862,7 +862,7 @@ :event enemy-event-handler :enter (behavior () ((-> (method-of-type grunt-mech mech-post-circling) enter)) - (set! (-> self state-timeout) (+ (current-time) (get-rand-int-range self 900 1800))) + (set! (-> self state-timeout) (+ (current-time) (rnd-int-range self 900 1800))) ) :trans (-> (method-of-type grunt-mech mech-post-circling) trans) :code (-> (method-of-type grunt-mech mech-post-circling) code) 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 65020f2c6e..e1589d97a2 100644 --- a/test/decompiler/reference/jak2/levels/atoll/ash1-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/ash1-course_REF.gc @@ -201,7 +201,7 @@ (set! (-> (the-as asht-wait-spot v1-24) check-done) (lambda ((arg0 asht-wait-spot) (arg1 ashelin-battle)) (with-pp - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (cond ((and (not (speech-playing? arg1 45)) (time-elapsed? (-> arg1 waypoint-time0) (seconds 2.5))) (play-speech arg1 45) @@ -271,8 +271,8 @@ (ashelin-method-250 arg0 #f) (remove-setting! 'airlock) (logclear! (-> arg0 bot-flags) (bot-flags bf10)) - (when (not (channel-active? arg0 (the-as uint 0))) - (let ((v1-12 (get-rand-int arg0 3))) + (when (not (channel-active? arg0 (gui-channel none))) + (let ((v1-12 (rnd-int-count arg0 3))) (cond ((zero? v1-12) (play-speech arg0 42) @@ -309,7 +309,7 @@ (when (time-elapsed? (-> 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))) + (not (channel-active? arg1 (gui-channel none))) (scene-play arg1 (the-as string (-> s5-0 scene)) #f) ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) @@ -372,7 +372,7 @@ :on-set (lambda ((arg0 ashelin-battle)) (process-entity-status! arg0 (entity-perm-status bit-4) #f) (process-entity-status! arg0 (entity-perm-status no-kill) #f) - (logclear! (-> arg0 enemy-flags) (enemy-flag use-notice-distance)) + (logclear! (-> arg0 enemy-flags) (enemy-flag cam-attack-mode)) (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) (set! (-> v1-3 bytes 5) 3) (set! (-> v1-3 bytes 6) 5) diff --git a/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc b/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc index 7068e1d272..6cfea35cf8 100644 --- a/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc @@ -783,12 +783,12 @@ ) ;; definition for method 55 of type juicer -(defmethod track-target! ((this juicer)) +(defmethod common-post ((this juicer)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (los-control-method-9 (-> this los) (the-as process-focusable #f) (the-as vector #f) 2048.0) @@ -805,7 +805,7 @@ ) ) ) - (zero? (get-rand-int this 3)) + (zero? (rnd-int-count this 3)) (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) (f1-0 32768.0) ) @@ -828,15 +828,15 @@ ((zero? (-> this hit-points)) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (juicer-method-180 this) @@ -857,15 +857,15 @@ (('hit) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (if (zero? (-> this hit-points)) @@ -885,15 +885,15 @@ ) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (juicer-method-180 this) @@ -929,10 +929,10 @@ ) ) ) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f - (let ((gp-0 (-> self draw art-group data (-> (&-> *juicer-global-info* patrol-anim (get-rand-int self 2)) 0))) - (s5-0 (get-rand-int-range self 1 8)) + (let ((gp-0 (-> self draw art-group data (-> (&-> *juicer-global-info* patrol-anim (rnd-int-count self 2)) 0))) + (s5-0 (rnd-int-range self 1 8)) ) (let ((v1-34 (ja-group))) (if (not (and v1-34 (= v1-34 gp-0))) @@ -947,7 +947,7 @@ ) ) ) - (when (zero? (get-rand-int self 2)) + (when (zero? (rnd-int-count self 2)) (let ((v1-58 self)) (set! (-> v1-58 enemy-flags) (the-as enemy-flag (logclear (-> v1-58 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-58 nav callback-info) *nav-enemy-null-callback-info*) @@ -955,8 +955,8 @@ 0 (ja-channel-push! 1 (seconds 0.3)) (let ((gp-1 0)) - (until (not (enemy-method-123 self 0.4)) - (let* ((v1-62 (enemy-method-120 self 3 gp-1)) + (until (not (rnd-go-idle? self 0.4)) + (let* ((v1-62 (rnd-bit self 3 gp-1)) (a1-16 (-> self draw art-group data (-> *juicer-global-info* idle-anim v1-62))) ) (set! gp-1 (ash 1 v1-62)) @@ -1034,7 +1034,9 @@ (until #f (let ((gp-0 (new 'stack-no-clear 'vector))) (get-point-in-path! (-> self intro-path) gp-0 1.0 'interp) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (let ((v1-5 (process->ppointer self))) (set! (-> a1-1 from) v1-5) @@ -1068,7 +1070,9 @@ (until #f (let ((gp-0 (new 'stack-no-clear 'vector))) (get-point-in-path! (-> self intro-path) gp-0 (the float (-> self ambush-path-pt)) 'interp) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (let ((v1-9 (process->ppointer self))) (set! (-> a1-1 from) v1-9) @@ -1110,10 +1114,10 @@ ) ) ) - (let ((f30-1 (get-rand-float-range self 0.8 1.2)) + (let ((f30-1 (rnd-float-range self 0.8 1.2)) (gp-2 (new 'stack-no-clear 'vector)) ) - (let* ((a0-13 (enemy-method-120 self 2 s5-0)) + (let* ((a0-13 (rnd-bit self 2 s5-0)) (a1-8 (-> self draw art-group data (-> *juicer-global-info* notice-anim a0-13))) ) (ja-no-eval :group! a1-8 :num! (seek! max f30-1) :frame-num 0.0) @@ -1137,8 +1141,8 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.15)) - (let ((gp-1 (-> self draw art-group data (-> *juicer-global-info* celebrate-anim (get-rand-int self 2)))) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((gp-1 (-> self draw art-group data (-> *juicer-global-info* celebrate-anim (rnd-int-count self 2)))) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (ja-no-eval :group! gp-1 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -1178,7 +1182,7 @@ ) ) ) - (let* ((v1-16 (get-rand-int self 2)) + (let* ((v1-16 (rnd-int-count self 2)) (gp-0 (-> self draw art-group data (-> *juicer-global-info* charge-anim v1-16))) ) (set! (-> self charge-index) v1-16) @@ -1190,7 +1194,7 @@ (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim gp-0)) ) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -1350,7 +1354,7 @@ ) 0 (set! (-> self torso-track-player) (the-as basic #t)) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (set! (-> self hit-focus) #f) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-9 *game-info*) @@ -1362,10 +1366,10 @@ ) :exit (behavior () (set! (-> self torso-track-player) #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (juicer-method-184 self #f) (set-time! (-> self last-fire-time)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1406,7 +1410,7 @@ ) ) ) - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (b! @@ -1480,7 +1484,7 @@ ) 0 (nav-enemy-method-166 self) - (let* ((v1-23 (get-rand-int self 2)) + (let* ((v1-23 (rnd-int-count self 2)) (gp-0 (-> self draw art-group data (-> *juicer-global-info* charge-anim v1-23))) ) (set! (-> self charge-index) v1-23) @@ -1489,8 +1493,8 @@ (ja-channel-push! 1 (seconds 0.15)) ) ) - (let ((s5-0 (+ (get-rand-int self 6) 2)) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((s5-0 (+ (rnd-int-count self 6) 2)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (while (nonzero? s5-0) (+! s5-0 -1) @@ -1514,8 +1518,8 @@ 0 (vector-reset! (-> self root transv)) (ja-channel-push! 1 (seconds 0.1)) - (let ((gp-2 (-> self draw art-group data (-> *juicer-global-info* celebrate-anim (get-rand-int self 2)))) - (f30-2 (get-rand-float-range self 0.9 1.1)) + (let ((gp-2 (-> self draw art-group data (-> *juicer-global-info* celebrate-anim (rnd-int-count self 2)))) + (f30-2 (rnd-float-range self 0.9 1.1)) ) (ja-no-eval :group! gp-2 :num! (seek! max f30-2) :frame-num 0.0) (until (ja-done? 0) @@ -1535,7 +1539,7 @@ :code (behavior () (local-vars (v1-37 enemy-flag) (v1-45 enemy-flag)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info hit-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -1545,29 +1549,29 @@ (ja :num! (seek! max f30-0)) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-36 (-> self enemy-flags))) - (if (logtest? v1-36 (enemy-flag checking-water)) - (set! v1-37 (logior v1-36 (enemy-flag enable-on-active))) - (set! v1-37 (logclear v1-36 (enemy-flag enable-on-active))) + (if (logtest? v1-36 (enemy-flag vulnerable-backup)) + (set! v1-37 (logior v1-36 (enemy-flag vulnerable))) + (set! v1-37 (logclear v1-36 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-37) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-44 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-44) - (set! v1-45 (logior (enemy-flag check-water-backup) v1-44)) - (set! v1-45 (logclear v1-44 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-44) + (set! v1-45 (logior (enemy-flag trackable) v1-44)) + (set! v1-45 (logclear v1-44 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-45) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (go-virtual hostile) ) @@ -1578,7 +1582,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 1)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self enemy-info idle-anim))) ) (until #f @@ -1598,8 +1602,8 @@ :virtual #t :code (behavior () (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)) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) + (let ((gp-0 (rnd-int-range self 60 210)) (s5-0 (current-time)) (f28-0 f30-0) ) @@ -1627,20 +1631,20 @@ ) ;; definition for method 77 of type juicer -(defmethod enemy-method-77 ((this juicer) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this juicer) (arg0 enemy-knocked-info)) (local-vars (a2-2 int)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (ja-channel-push! 1 0) (let* ((a2-0 (ash 1 (-> *juicer-global-info* prev-yellow-hit))) - (v1-3 (enemy-method-120 this 4 a2-0)) + (v1-3 (rnd-bit this 4 a2-0)) (a1-6 (-> this draw art-group data (-> *juicer-global-info* yellow-hit-anim v1-3))) ) (set! (-> *juicer-global-info* prev-yellow-hit) v1-3) (let ((a0-13 (-> this skel root-channel 0))) (set! (-> a0-13 frame-group) (the-as art-joint-anim a1-6)) (set! (-> a0-13 param 0) (the float (+ (-> (the-as art-joint-anim a1-6) frames num-frames) -1))) - (set! (-> a0-13 param 1) (-> arg0 0)) + (set! (-> a0-13 param 1) (-> arg0 anim-speed)) (set! (-> a0-13 frame-num) 0.0) (joint-control-channel-group! a0-13 (the-as art-joint-anim a1-6) num-func-seek!) ) @@ -1653,7 +1657,7 @@ (set! a2-2 (logior v1-11 7)) ) ) - (let* ((v1-15 (enemy-method-120 this 6 a2-2)) + (let* ((v1-15 (rnd-bit this 6 a2-2)) (s5-1 (-> this draw art-group data (-> *juicer-global-info* blue-hit-anim v1-15))) ) (set! (-> *juicer-global-info* prev-blue-hit) v1-15) @@ -1677,12 +1681,12 @@ ) ) (else - (let ((s4-1 (-> this draw art-group data (-> *juicer-global-info* knocked-anim (get-rand-int this 2))))) + (let ((s4-1 (-> this draw art-group data (-> *juicer-global-info* knocked-anim (rnd-int-count this 2))))) (ja-channel-push! 1 (seconds 0.17)) (let ((a0-37 (-> this skel root-channel 0))) (set! (-> a0-37 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-37 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-37 param 1) (-> arg0 0)) + (set! (-> a0-37 param 1) (-> arg0 anim-speed)) (set! (-> a0-37 frame-num) 0.0) (joint-control-channel-group! a0-37 (the-as art-joint-anim s4-1) num-func-seek!) ) @@ -1693,7 +1697,7 @@ ) ;; definition for method 78 of type juicer -(defmethod enemy-method-78 ((this juicer) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this juicer) (arg0 enemy-knocked-info)) (cond ((= (-> this incoming knocked-type) (knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -1702,7 +1706,7 @@ (let ((a0-3 (-> this skel root-channel 0))) (set! (-> a0-3 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -1725,7 +1729,7 @@ (let ((a0-10 (-> this skel root-channel 0))) (set! (-> a0-10 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-10 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-10 param 1) (-> arg0 0)) + (set! (-> a0-10 param 1) (-> arg0 anim-speed)) (set! (-> a0-10 frame-num) 0.0) (joint-control-channel-group! a0-10 (the-as art-joint-anim s4-1) num-func-seek!) ) 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 826f370c00..5803c075cc 100644 --- a/test/decompiler/reference/jak2/levels/atoll/sig0-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/sig0-course_REF.gc @@ -195,7 +195,7 @@ ) (if (and (logtest? (-> arg0 bot-task-bits) (bot-task-bits botbits-4)) (not (speech-playing? arg0 26)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) (play-speech arg0 26) ) @@ -207,7 +207,7 @@ (defun sig-say-waste-the-suckers-if-should ((arg0 sig-atoll)) (if (and (logtest? (-> arg0 bot-task-bits) (bot-task-bits botbits-3)) (not (speech-playing? arg0 25)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) (play-speech arg0 25) ) @@ -400,7 +400,7 @@ :on-update (lambda ((arg0 sig-atoll)) (if (and (logtest? (-> arg0 bot-task-bits) (bot-task-bits botbits-1)) (not (speech-playing? arg0 33)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) (play-speech arg0 33) ) @@ -453,7 +453,7 @@ :on-update (lambda ((arg0 sig-atoll)) (if (and (logtest? (-> arg0 bot-task-bits) (bot-task-bits botbits-1)) (not (speech-playing? arg0 33)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) (play-speech arg0 33) ) @@ -494,7 +494,7 @@ ) :on-update (lambda ((arg0 sig-atoll)) (if (and (not (speech-playing? arg0 1)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) (< (-> arg0 root trans z) (-> (target-pos 0) z)) ) (play-speech arg0 1) @@ -539,7 +539,7 @@ (none) ) :on-update (lambda ((arg0 sig-atoll)) - (when (not (channel-active? arg0 (the-as uint 0))) + (when (not (channel-active? arg0 (gui-channel none))) (if (and (not (speech-playing? arg0 1)) (< (-> arg0 root trans z) (-> (target-pos 0) z))) (play-speech arg0 1) ) @@ -638,7 +638,7 @@ (the-as (function sigt-charge-plasma sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) - (if (and (not (channel-active? arg1 (the-as uint 0))) (sig-atoll-method-259 arg1)) + (if (and (not (channel-active? arg1 (gui-channel none))) (sig-atoll-method-259 arg1)) (sig-plasma-method-9 (-> arg1 plasma)) ) (when (and (sig-plasma-method-13 (-> arg1 plasma)) (scene-play arg1 "atoll-sig-tank" #f)) @@ -723,7 +723,7 @@ (else (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) (if (and (not (speech-playing? arg1 5)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (let ((f0-1 73728.0)) (>= (* f0-1 f0-1) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) ) @@ -899,7 +899,7 @@ ) (else (when (and (outside-spot-radius? arg0 (the-as bot-spot #f) (the-as vector #f) #f) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) (let ((a1-7 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-7 from) (process->ppointer pp)) @@ -992,7 +992,7 @@ ) (cond ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (process-grab? arg1 #t) (process-grab? *target* #t) ) @@ -1108,7 +1108,7 @@ ) a1-2 ) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (not (focus-test? s5-0 edge-grab)) (>= (- (-> s5-0 control trans y) (-> arg1 root trans y)) -4096.0) ) @@ -1249,7 +1249,7 @@ ) :on-update (lambda ((arg0 sig-atoll)) (with-pp - (b! (not (channel-active? arg0 (the-as uint 0))) cfg-2 :delay (empty-form)) + (b! (not (channel-active? arg0 (gui-channel none))) cfg-2 :delay (empty-form)) (set-time! (-> arg0 waypoint-time0)) (b! #t cfg-21 :delay (nop!)) (label cfg-2) @@ -1360,7 +1360,7 @@ :on-update (lambda ((arg0 sig-atoll)) (with-pp (if (and (not (speech-playing? arg0 13)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) (let ((a1-2 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-2 from) (process->ppointer pp)) (set! (-> a1-2 num-params) 1) @@ -1420,7 +1420,7 @@ ) (cond ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (process-grab? arg1 #t) (process-grab? *target* #t) ) @@ -1536,7 +1536,7 @@ ) a1-2 ) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (let ((f0-0 102400.0)) (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) @@ -1608,7 +1608,9 @@ (play-speech arg1 17) (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) ) - (when (and (logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) (not (channel-active? arg1 (the-as uint 0)))) + (when (and (logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) + (not (channel-active? arg1 (gui-channel none))) + ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) (go-to-waypoint! arg1 20 #f) (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) @@ -1652,7 +1654,7 @@ :on-update (lambda ((arg0 sig-atoll)) (if (and (time-elapsed? (-> arg0 waypoint-time0) (seconds 1.5)) (not (speech-playing? arg0 18)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) (play-speech arg0 18) ) @@ -1692,7 +1694,7 @@ ) (cond ((zero? v1-6) - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (let ((s5-0 (-> arg1 root trans)) (s4-0 (-> arg1 sig-course spots)) (f0-0 163840.0) @@ -1746,7 +1748,7 @@ ) ) ) - (if (and (not (speech-playing? arg1 20)) (not (channel-active? arg1 (the-as uint 0)))) + (if (and (not (speech-playing? arg1 20)) (not (channel-active? arg1 (gui-channel none)))) (play-speech arg1 20) ) (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) @@ -1822,7 +1824,7 @@ ) (cond ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (process-grab? arg1 #t) (process-grab? *target* #t) ) @@ -1936,7 +1938,7 @@ ) a1-2 ) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (let ((f0-0 102400.0)) (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) @@ -2169,7 +2171,7 @@ ) (cond ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (process-grab? arg1 #t) (process-grab? *target* #t) ) @@ -2290,7 +2292,7 @@ ) a1-2 ) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (let ((f0-0 102400.0)) (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) @@ -2361,7 +2363,9 @@ (play-speech arg1 24) (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) ) - (when (and (logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) (not (channel-active? arg1 (the-as uint 0)))) + (when (and (logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) + (not (channel-active? arg1 (gui-channel none))) + ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) (go-to-waypoint! arg1 31 #f) (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) @@ -2395,7 +2399,7 @@ (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) (go-to-waypoint! arg1 32 #f) @@ -2739,7 +2743,7 @@ (function sigt-wait-spot sig symbol) (lambda ((arg0 object) (arg1 sig-atoll)) (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (let ((f0-0 122880.0)) (if (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) @@ -2793,7 +2797,7 @@ ) (cond ((and (< f0-0 (* f1-0 f1-0)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (process-grab? arg1 #t) (process-grab? *target* #t) ) @@ -2923,7 +2927,7 @@ ) a1-2 ) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (let ((f0-0 102400.0)) (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) @@ -2939,7 +2943,7 @@ ) ) (when (and (sig-plasma-method-13 (-> arg1 plasma)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (scene-play arg1 "atoll-sniper-e" #f) ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) @@ -3020,7 +3024,7 @@ :on-set (lambda ((arg0 sig-atoll)) (task-node-close! (game-task-node atoll-sig-resolution)) (process-entity-status! arg0 (entity-perm-status bit-4) #f) - (logclear! (-> arg0 enemy-flags) (enemy-flag use-notice-distance)) + (logclear! (-> arg0 enemy-flags) (enemy-flag cam-attack-mode)) (logclear! (-> arg0 bot-flags) (bot-flags bf06)) (bot-method-196 arg0) (logior! (-> arg0 bot-flags) (bot-flags bf22)) diff --git a/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc b/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc index 7dac08e3fc..8c5455219c 100644 --- a/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc @@ -231,7 +231,7 @@ (if (<= s4-0 0) (go process-drawable-art-error "no path") ) - (let ((s2-0 (get-rand-int this s4-0)) + (let ((s2-0 (rnd-int-count this s4-0)) (gp-0 (new 'stack-no-clear 'vector)) ) (countdown (s3-0 s4-0) @@ -267,7 +267,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info walk-anim)) :num! (seek! max f30-0) @@ -288,7 +288,7 @@ ) (nav-enemy-method-156 self) (nav-enemy-method-162 self) - (set! (-> self next-pick-time) (+ (current-time) (get-rand-int-range self 300 1050))) + (set! (-> self next-pick-time) (+ (current-time) (rnd-int-range self 300 1050))) ) (nav-enemy-method-176 self) ) @@ -304,7 +304,7 @@ (set-enemy-info! this *sniper-nav-enemy-info*) (logior! (-> this focus-status) (focus-status ignore)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag check-water)) + (logclear! (-> this enemy-flags) (enemy-flag dangerous-backup)) 0 (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 e88ac23e84..f7fccbd477 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 @@ -803,12 +803,12 @@ For example for an elevator pre-compute the distance between the first and last ;; definition for method 55 of type krew-boss-clone ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod track-target! ((this krew-boss-clone)) +(defmethod common-post ((this krew-boss-clone)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (let ((s5-0 (new 'stack-no-clear 'vector)) @@ -928,13 +928,13 @@ For example for an elevator pre-compute the distance between the first and last (('track) (cond ((-> arg3 param 0) - (if (logtest? (-> this enemy-flags) (enemy-flag enable-on-active)) + (if (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) #t 'abort ) ) (else - (logtest? (-> this enemy-flags) (enemy-flag enable-on-active)) + (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) ) ) ) @@ -976,7 +976,7 @@ For example for an elevator pre-compute the distance between the first and last (go-virtual hostile) ) :post (behavior () - (logior! (-> self enemy-flags) (enemy-flag directed)) + (logior! (-> self enemy-flags) (enemy-flag recover-applied-velocity)) (let ((gp-0 (-> self root))) (let ((a1-0 (new-stack-vector0))) (vector-v++! (-> gp-0 transv) (compute-acc-due-to-gravity gp-0 a1-0 (-> self enemy-info slip-factor))) @@ -991,7 +991,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) (enemy-method-111 self) - (track-target! self) + (common-post self) ) ) @@ -1009,7 +1009,7 @@ For example for an elevator pre-compute the distance between the first and last ) ;; definition for method 77 of type krew-boss-clone -(defmethod enemy-method-77 ((this krew-boss-clone) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this krew-boss-clone) (arg0 enemy-knocked-info)) (with-pp (ja-channel-push! 1 0) (cond @@ -1061,7 +1061,7 @@ For example for an elevator pre-compute the distance between the first and last ) ;; definition for method 78 of type krew-boss-clone -(defmethod enemy-method-78 ((this krew-boss-clone) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this krew-boss-clone) (arg0 enemy-knocked-info)) (when (> (-> this hit-points) 0) (ja-channel-push! 1 (seconds 0.1)) (let ((a0-2 (-> this skel root-channel 0))) @@ -1078,7 +1078,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) ) - (set! (-> a0-2 param 1) (* 5.0 (-> arg0 0))) + (set! (-> a0-2 param 1) (* 5.0 (-> arg0 anim-speed))) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 @@ -1096,7 +1096,7 @@ For example for an elevator pre-compute the distance between the first and last (let ((v1-0 arg0)) (cond ((zero? v1-0) - (enemy-method-77 this (the-as (pointer float) arg1)) + (enemy-method-77 this arg1) #f ) ((= v1-0 1) @@ -1105,7 +1105,7 @@ For example for an elevator pre-compute the distance between the first and last s5-0 ) ((= v1-0 2) - (set! s5-0 (not (enemy-method-78 this (the-as (pointer float) arg1)))) + (set! s5-0 (not (enemy-method-78 this arg1))) (set! (-> this incoming blue-juggle-count) (the-as uint 0)) s5-0 ) @@ -1207,7 +1207,7 @@ For example for an elevator pre-compute the distance between the first and last :code (behavior () (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))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja :num! (loop! f30-0)) (when (time-elapsed? (-> self wiggle-time) (seconds 1)) @@ -1371,7 +1371,9 @@ For example for an elevator pre-compute the distance between the first and last (the-as pair 0) ) (logior! (-> this draw global-effect) (draw-control-global-effect disable-envmap)) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag vulnerable-backup) (-> this enemy-flags)))) + (set! (-> this enemy-flags) + (the-as enemy-flag (logior (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) + ) (set! (-> *krew-boss-clone-nav-enemy-info* nav-mesh) (nav-mesh-from-res-tag (-> this entity) 'nav-mesh-actor 1) ) @@ -2119,13 +2121,13 @@ For example for an elevator pre-compute the distance between the first and last (('track) (cond ((-> arg3 param 0) - (if (logtest? (-> this enemy-flags) (enemy-flag enable-on-active)) + (if (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) #t 'abort ) ) (else - (logtest? (-> this enemy-flags) (enemy-flag enable-on-active)) + (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) ) ) ) @@ -2154,7 +2156,7 @@ For example for an elevator pre-compute the distance between the first and last ) ;; definition for method 77 of type krew-boss -(defmethod enemy-method-77 ((this krew-boss) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this krew-boss) (arg0 enemy-knocked-info)) (with-pp (ja-channel-push! 1 0) (cond @@ -2193,7 +2195,7 @@ For example for an elevator pre-compute the distance between the first and last ) ;; definition for method 78 of type krew-boss -(defmethod enemy-method-78 ((this krew-boss) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this krew-boss) (arg0 enemy-knocked-info)) (cond ((<= (-> this hit-points) 0) #f @@ -2214,7 +2216,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) ) - (set! (-> a0-2 param 1) (* 2.0 (-> arg0 0))) + (set! (-> a0-2 param 1) (* 2.0 (-> arg0 anim-speed))) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 @@ -2242,7 +2244,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) (krew-hit-speech self) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logclear! (-> self nav flags) (nav-control-flag update-heading-from-facing)) ) :exit (behavior () @@ -2254,9 +2256,9 @@ For example for an elevator pre-compute the distance between the first and last ) (set! (-> self floating) #f) (let ((v1-4 (-> self enemy-flags))) - (if (logtest? v1-4 (enemy-flag checking-water)) - (set! v1-5 (logior v1-4 (enemy-flag enable-on-active))) - (set! v1-5 (logclear v1-4 (enemy-flag enable-on-active))) + (if (logtest? v1-4 (enemy-flag vulnerable-backup)) + (set! v1-5 (logior v1-4 (enemy-flag vulnerable))) + (set! v1-5 (logclear v1-4 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-5) @@ -2266,7 +2268,7 @@ For example for an elevator pre-compute the distance between the first and last ) ) :post (behavior () - (logior! (-> self enemy-flags) (enemy-flag directed)) + (logior! (-> self enemy-flags) (enemy-flag recover-applied-velocity)) (let ((gp-0 (-> self root))) (cond ((and (>= 1449984.0 (-> gp-0 trans y)) (< (-> gp-0 transv y) 0.0)) @@ -2294,7 +2296,7 @@ For example for an elevator pre-compute the distance between the first and last ) (enemy-method-111 self) (nav-enemy-method-142 self (-> self nav)) - (track-target! self) + (common-post self) ) ) @@ -2396,7 +2398,7 @@ For example for an elevator pre-compute the distance between the first and last (set! (-> v1-14 target-post quad) (-> a0-20 quad)) ) 0 - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (let ((v1-19 (-> self nav))) (set! (-> v1-19 sphere-mask) (the-as uint #x800fa)) ) @@ -2422,7 +2424,7 @@ For example for an elevator pre-compute the distance between the first and last :code (behavior () (ja-channel-push! 1 (seconds 0.1)) (ja :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! min) - (let ((f30-0 (get-rand-float-range self 0.3 0.5))) + (let ((f30-0 (rnd-float-range self 0.3 0.5))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -2572,8 +2574,8 @@ For example for an elevator pre-compute the distance between the first and last ) ) ) - (look-at-target! self (enemy-flag lock-focus)) - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (look-at-target! self (enemy-flag look-at-focus)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (let ((v1-58 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-58 enemy-flags))) (set! (-> v1-58 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-58 enemy-flags)))) @@ -2597,8 +2599,8 @@ For example for an elevator pre-compute the distance between the first and last (let ((f30-0 (-> self enemy-info circle-dist-lo)) (f28-0 (-> self enemy-info circle-dist-hi)) ) - (if (zero? (get-rand-int self 4)) - (set! (-> self desired-angle) (get-rand-float-range self f30-0 f28-0)) + (if (zero? (rnd-int-count self 4)) + (set! (-> self desired-angle) (rnd-float-range self f30-0 f28-0)) (set! (-> self desired-angle) (fmax (fmin (vector-vector-xz-distance (-> self focus-pos) (-> self root trans)) f28-0) f30-0) ) @@ -2637,9 +2639,9 @@ For example for an elevator pre-compute the distance between the first and last (set! (-> self next-shooting-frame) 0) (ja :chan 1 :num-func num-func-identity :frame-num 0.0) (let ((v1-24 (-> self enemy-flags))) - (if (logtest? v1-24 (enemy-flag checking-water)) - (set! v1-25 (logior v1-24 (enemy-flag enable-on-active))) - (set! v1-25 (logclear v1-24 (enemy-flag enable-on-active))) + (if (logtest? v1-24 (enemy-flag vulnerable-backup)) + (set! v1-25 (logior v1-24 (enemy-flag vulnerable))) + (set! v1-25 (logclear v1-24 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-25) @@ -2677,7 +2679,7 @@ For example for an elevator pre-compute the distance between the first and last (ja-channel-push! 2 (seconds 0.1)) (ja :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! min) (ja :chan 1 :group! (-> self draw art-group data (-> self enemy-info hostile-anim)) :num! min) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja :num! (loop! f30-0)) (when (!= (-> self next-shooting-frame) 100) diff --git a/test/decompiler/reference/jak2/levels/castle/roboguard-level_REF.gc b/test/decompiler/reference/jak2/levels/castle/roboguard-level_REF.gc index 214e4f1c71..bf655f97c2 100644 --- a/test/decompiler/reference/jak2/levels/castle/roboguard-level_REF.gc +++ b/test/decompiler/reference/jak2/levels/castle/roboguard-level_REF.gc @@ -369,7 +369,7 @@ (logior! (-> self flags) 4) (logior! (-> self nav flags) (nav-control-flag output-sphere-hash)) (let ((a1-1 (new 'stack-no-clear 'collide-query))) - (enemy-method-125 self a1-1 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (ground-pat-set! self a1-1 (collide-spec backgnd) 8192.0 81920.0 1024.0) ) (let* ((v1-11 (-> self nav)) (a1-2 (-> self root gspot-pos)) @@ -509,7 +509,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! roboguard-idle0-ja :num! (seek! 10.0 (* 0.1 f30-0)) :frame-num 9.0) (until (ja-done? 0) @@ -555,12 +555,12 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (logior! (-> self flags) 4) - (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) (logclear! (-> self mask) (process-mask actor-pause)) - (when (logtest? (-> self enemy-flags) (enemy-flag drawn-mirrored)) - (logclear! (-> self enemy-flags) (enemy-flag drawn-mirrored)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-hostile)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-hostile)) (let ((gp-0 (-> self on-hostile))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -595,7 +595,7 @@ ) :exit (behavior () (sound-stop (-> self roll-sound)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -628,7 +628,7 @@ 0 (nav-enemy-method-160 self) (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))))) + (set! (-> self roll-timer) (+ (current-time) (the int (* 300.0 (rnd-float-range self 3.0 5.0))))) (let ((gp-2 (handle->process (-> self focus handle)))) (when (and gp-2 (and gp-2 @@ -910,7 +910,7 @@ ) ;; definition for method 77 of type roboguard-level -(defmethod enemy-method-77 ((this roboguard-level) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this roboguard-level) (arg0 enemy-knocked-info)) (ja-channel-push! 1 0) (case (-> this incoming knocked-type) (((knocked-type knocked-type-0) @@ -923,7 +923,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 21)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 21)) num-func-seek!) ) @@ -934,7 +934,7 @@ (set! (-> a0-6 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 23)) frames num-frames) -1)) ) - (set! (-> a0-6 param 1) (-> arg0 0)) + (set! (-> a0-6 param 1) (-> arg0 anim-speed)) (set! (-> a0-6 frame-num) 0.0) (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> this draw art-group data 23)) num-func-seek!) ) @@ -944,7 +944,7 @@ ) ;; definition for method 78 of type roboguard-level -(defmethod enemy-method-78 ((this roboguard-level) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this roboguard-level) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-0) (knocked-type knocked-type-1) @@ -956,7 +956,7 @@ (set! (-> v1-4 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 22)) frames num-frames) -1)) ) - (set! (-> v1-4 param 1) (-> arg0 0)) + (set! (-> v1-4 param 1) (-> arg0 anim-speed)) (set! (-> v1-4 frame-num) 0.0) (joint-control-channel-group! v1-4 (the-as art-joint-anim (-> this draw art-group data 22)) num-func-seek!) ) @@ -967,7 +967,7 @@ (set! (-> v1-8 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 24)) frames num-frames) -1)) ) - (set! (-> v1-8 param 1) (-> arg0 0)) + (set! (-> v1-8 param 1) (-> arg0 anim-speed)) (set! (-> v1-8 frame-num) 0.0) (joint-control-channel-group! v1-8 (the-as art-joint-anim (-> this draw art-group data 24)) num-func-seek!) ) @@ -1049,7 +1049,7 @@ :to this ) ) - (dispose! this) + (dying this) (go (method-of-object this explode)) ) ) @@ -1131,7 +1131,7 @@ (set! (-> v1-30 target-speed) (-> this speed)) ) 0 - (set! (-> this roll-timer) (+ (current-time) (the int (* 300.0 (get-rand-float-range this 3.0 5.0))))) + (set! (-> this roll-timer) (+ (current-time) (the int (* 300.0 (rnd-float-range this 3.0 5.0))))) (set! (-> this roll-dir quad) (-> s3-1 quad)) ) ) @@ -1200,18 +1200,18 @@ ) ) ) - (track-target! this) + (common-post this) (update-transforms (-> this root)) 0 (none) ) ;; definition for method 132 of type roboguard-level -(defmethod dispose! ((this roboguard-level)) +(defmethod dying ((this roboguard-level)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" - (when (not (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags))) + (when (not (logtest? (enemy-flag called-dying) (-> this enemy-flags))) (send-event (ppointer->process (-> this parent)) 'roboguard-die) - ((method-of-type nav-enemy dispose!) this) + ((method-of-type nav-enemy dying) this) ) (none) ) @@ -1297,7 +1297,9 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-roboguard-level" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag vulnerable-backup) (-> this enemy-flags)))) + (set! (-> this enemy-flags) + (the-as enemy-flag (logior (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) + ) (init-enemy-behaviour-and-stats! this *roboguard-level-nav-enemy-info*) (let ((v1-8 (-> this nav))) (set! (-> v1-8 nav-cull-radius) 81920.0) diff --git a/test/decompiler/reference/jak2/levels/city/bombbot/bombbot_REF.gc b/test/decompiler/reference/jak2/levels/city/bombbot/bombbot_REF.gc index 610df8ee79..3030ec00e1 100644 --- a/test/decompiler/reference/jak2/levels/city/bombbot/bombbot_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/bombbot/bombbot_REF.gc @@ -780,6 +780,7 @@ ) ;; definition for method 3 of type ik-setup +;; INFO: this function exists in multiple non-identical object files (defmethod inspect ((this ik-setup)) (when (not this) (set! this this) @@ -1265,13 +1266,13 @@ ;; definition for method 55 of type bombbot ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod track-target! ((this bombbot)) +(defmethod common-post ((this bombbot)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (local-vars (sv-16 sparticle-launcher) (sv-20 sparticle-launcher)) - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (cond @@ -1370,17 +1371,17 @@ (defmethod damage-amount-from-attack ((this bombbot) (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]]" (-> arg1 param 1) - (let ((f0-1 (the float (penetrate-using->damage (the-as penetrate (-> this incoming penetrate-using)))))) + (let ((f0-1 (the float (penetrate-using->damage (-> this incoming penetrate-using))))) (cond - ((logtest? #xc0000 (-> this incoming penetrate-using)) - (if (and (logtest? #x40000 (-> this incoming penetrate-using)) - (logtest? #x80000 (-> this incoming penetrate-using)) + ((logtest? (penetrate dark-bomb dark-giant) (-> this incoming penetrate-using)) + (if (and (logtest? (penetrate dark-bomb) (-> this incoming penetrate-using)) + (logtest? (penetrate dark-giant) (-> this incoming penetrate-using)) ) #x42c80000 (the int (* 1.8 f0-1)) ) ) - ((logtest? #x20000 (-> this incoming penetrate-using)) + ((logtest? (penetrate dark-punch) (-> this incoming penetrate-using)) (the int (* 2.0 f0-1)) ) (else @@ -1940,7 +1941,7 @@ (t9-0) ) ) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (+! (-> self shield-hit-points) -1.0) ) :exit (behavior () @@ -2130,7 +2131,7 @@ ) ) (seek! (-> self root trans y) (-> self city-path node gp-1 position y) (* 16384.0 (seconds-per-frame))) - (track-target! self) + (common-post self) (update-transforms (-> self root)) ) (else 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 93e89f8d39..35e910ad0c 100644 --- a/test/decompiler/reference/jak2/levels/city/farm/yakow_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/farm/yakow_REF.gc @@ -236,7 +236,7 @@ ) ;; definition for method 123 of type yakow -(defmethod enemy-method-123 ((this yakow) (arg0 float)) +(defmethod rnd-go-idle? ((this yakow) (arg0 float)) "TODO" (>= arg0 (rand-vu)) ) @@ -247,8 +247,8 @@ ;; WARN: Function (method 156 yakow) has a return type of none, but the expression builder found a return statement. (defmethod nav-enemy-method-156 ((this yakow)) (dotimes (s5-0 16) - (let ((f30-1 (* 4096.0 (get-rand-float-range this -10.0 10.0))) - (f0-2 (* 4096.0 (get-rand-float-range this -10.0 10.0))) + (let ((f30-1 (* 4096.0 (rnd-float-range this -10.0 10.0))) + (f0-2 (* 4096.0 (rnd-float-range this -10.0 10.0))) (s4-0 (new 'stack-no-clear 'vector)) ) (set! (-> s4-0 quad) (-> this root trans quad)) @@ -323,7 +323,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info walk-anim)) :num! (seek! max f30-0) @@ -333,7 +333,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (when (enemy-method-123 self 0.2) + (when (rnd-go-idle? self 0.2) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.6)) (let ((v1-37 self)) @@ -359,7 +359,7 @@ ) (ja-channel-push! 1 (seconds 0.1)) ) - (if (enemy-method-123 self 0.2) + (if (rnd-go-idle? self 0.2) (goto cfg-15) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc-states_REF.gc b/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc-states_REF.gc index c71ec9040d..25bd73f7e7 100644 --- a/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc-states_REF.gc @@ -18,7 +18,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -38,13 +38,13 @@ ) ) :code (behavior () - (let ((gp-0 (get-rand-int self 4))) + (let ((gp-0 (rnd-int-count self 4))) (until #f (let ((a2-0 (ash 1 gp-0))) (if (= gp-0 3) (set! a2-0 (logior a2-0 4)) ) - (set! gp-0 (enemy-method-120 self 4 a2-0)) + (set! gp-0 (rnd-bit self 4 a2-0)) ) (let ((v1-7 gp-0)) (cond @@ -63,7 +63,7 @@ ) ) ) - (let ((s5-0 (get-rand-int-range self 3 7))) + (let ((s5-0 (rnd-int-range self 3 7))) (dotimes (s4-0 s5-0) (ja-no-eval :group! crocadog-escort-idle-pant-ja :num! (seek! max 0.5) :frame-num 0.0) (until (ja-done? 0) @@ -101,7 +101,7 @@ ) ) ) - (let ((s5-4 (get-rand-int-range self 5 7))) + (let ((s5-4 (rnd-int-range self 5 7))) (dotimes (s4-1 s5-4) (ja-no-eval :group! crocadog-escort-idle-scratch-ja :num! (seek! max 0.5) :frame-num (ja-aframe 2.0 0)) (until (ja-done? 0) @@ -126,7 +126,7 @@ ) ) ) - (let ((s5-5 (get-rand-int-range self 3 7))) + (let ((s5-5 (rnd-int-range self 3 7))) (dotimes (s4-2 s5-5) (ja-no-eval :group! crocadog-escort-idle-wag-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) @@ -161,7 +161,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -367,7 +367,7 @@ ) ) (logior! (-> self focus-status) (focus-status pilot)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logior! (-> self focus-status) (focus-status disable)) (logclear! (-> self focus-status) (focus-status arrestable)) (logclear! (-> self bot-flags) (bot-flags bf15)) @@ -377,9 +377,9 @@ (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) (logclear! (-> self focus-status) (focus-status disable)) (let ((v1-5 (-> self enemy-flags))) - (if (logtest? v1-5 (enemy-flag checking-water)) - (set! v1-6 (logior v1-5 (enemy-flag enable-on-active))) - (set! v1-6 (logclear v1-5 (enemy-flag enable-on-active))) + (if (logtest? v1-5 (enemy-flag vulnerable-backup)) + (set! v1-6 (logior v1-5 (enemy-flag vulnerable))) + (set! v1-6 (logclear v1-5 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-6) @@ -518,7 +518,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logclear! (-> self root nav-flags) (nav-flags has-root-sphere)) (let ((v1-11 (-> self nav))) (logclear! (-> v1-11 shape nav-flags) (nav-flags has-extra-sphere)) @@ -531,9 +531,9 @@ (local-vars (v1-4 enemy-flag)) (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) (let ((v1-3 (-> self enemy-flags))) - (if (logtest? v1-3 (enemy-flag checking-water)) - (set! v1-4 (logior v1-3 (enemy-flag enable-on-active))) - (set! v1-4 (logclear v1-3 (enemy-flag enable-on-active))) + (if (logtest? v1-3 (enemy-flag vulnerable-backup)) + (set! v1-4 (logior v1-3 (enemy-flag vulnerable))) + (set! v1-4 (logclear v1-3 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-4) @@ -592,7 +592,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) (logior! (-> self focus-status) (focus-status disable)) ) @@ -608,9 +608,9 @@ 0 (logclear! (-> self focus-status) (focus-status disable)) (let ((v1-10 (-> self enemy-flags))) - (if (logtest? v1-10 (enemy-flag checking-water)) - (set! v1-11 (logior v1-10 (enemy-flag enable-on-active))) - (set! v1-11 (logclear v1-10 (enemy-flag enable-on-active))) + (if (logtest? v1-10 (enemy-flag vulnerable-backup)) + (set! v1-11 (logior v1-10 (enemy-flag vulnerable))) + (set! v1-11 (logclear v1-10 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-11) @@ -755,7 +755,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -807,29 +807,29 @@ ) :code (behavior () (local-vars (v1-7 enemy-flag) (v1-15 enemy-flag)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-6 (-> self enemy-flags))) - (if (logtest? v1-6 (enemy-flag checking-water)) - (set! v1-7 (logior v1-6 (enemy-flag enable-on-active))) - (set! v1-7 (logclear v1-6 (enemy-flag enable-on-active))) + (if (logtest? v1-6 (enemy-flag vulnerable-backup)) + (set! v1-7 (logior v1-6 (enemy-flag vulnerable))) + (set! v1-7 (logclear v1-6 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-7) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-14 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-14) - (set! v1-15 (logior (enemy-flag check-water-backup) v1-14)) - (set! v1-15 (logclear v1-14 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-14) + (set! v1-15 (logior (enemy-flag trackable) v1-14)) + (set! v1-15 (logclear v1-14 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-15) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) @@ -869,7 +869,7 @@ (reset! *fail-mission-control*) ) (cond - ((zero? (get-rand-int self 3)) + ((zero? (rnd-int-count self 3)) (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! crocadog-escort-idle-bark-ja :num! (seek! (ja-aframe 3.0 0) 0.5) :frame-num 0.0) (until (ja-done? 0) @@ -884,7 +884,7 @@ ) (else (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.4 0.6))) + (let ((f30-0 (rnd-float-range self 0.4 0.6))) (ja-no-eval :group! crocadog-escort-angry-bark-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -950,13 +950,13 @@ (vector-reset! (-> self root transv)) (stop-looking-at-target! self) (logior! (-> self bot-flags) (bot-flags bf09)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> self focus-status) (focus-status dangerous)) - (logclear! (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> self mask) (process-mask collectable)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> self mask) (process-mask actor-pause)) - (logclear! (-> self enemy-flags) (enemy-flag notice)) + (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logclear! (-> self focus-status) (focus-status disable)) (set! (-> self travel-anim-interp) 0.0) ) diff --git a/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc4-course_REF.gc b/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc4-course_REF.gc index f28a775718..53f9ed83a6 100644 --- a/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc4-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc4-course_REF.gc @@ -23,7 +23,7 @@ 0 (move-to-point! (-> arg0 root) (the-as vector (-> arg0 course spots 0))) (logclear! (-> arg0 mask) (process-mask actor-pause)) - (logclear! (-> arg0 enemy-flags) (enemy-flag notice)) + (logclear! (-> arg0 enemy-flags) (enemy-flag actor-pause-backup)) (let ((v1-16 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) (set! (-> v1-16 bytes 5) 1) (set! (-> v1-16 bytes 6) 0) diff --git a/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc_REF.gc b/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc_REF.gc index 35bd122cb8..770c755260 100644 --- a/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc_REF.gc @@ -209,7 +209,9 @@ (let* ((t9-0 (method-of-type bot bot-method-193)) (v0-0 (t9-0 this)) ) - (if (and (not v0-0) (logtest? #x1c00000 (-> this incoming penetrate-using))) + (if (and (not v0-0) + (logtest? (penetrate jak-yellow-shot jak-red-shot jak-blue-shot) (-> this incoming penetrate-using)) + ) (set! v0-0 #t) ) v0-0 @@ -448,7 +450,7 @@ This commonly includes things such as: ) (set! (-> this min-speed) 9011.2) (set! (-> this max-speed) 28672.0) - (set! (-> this channel) (the-as uint 31)) + (set! (-> this channel) (gui-channel crocadog)) (set! (-> this notice-enemy-dist) 24576.0) (set! (-> this travel-anim-interp) 0.0) (set! (-> this focus-info max-los-dist) 0.0) @@ -518,9 +520,9 @@ This commonly includes things such as: (quaternion-rotate-y! s5-0 s5-0 f30-0) ) (let ((v1-21 (-> this enemy-flags))) - (if (logtest? v1-21 (enemy-flag checking-water)) - (set! v1-22 (logior v1-21 (enemy-flag enable-on-active))) - (set! v1-22 (logclear v1-21 (enemy-flag enable-on-active))) + (if (logtest? v1-21 (enemy-flag vulnerable-backup)) + (set! v1-22 (logior v1-21 (enemy-flag vulnerable))) + (set! v1-22 (logclear v1-21 (enemy-flag vulnerable))) ) ) (set! (-> this enemy-flags) v1-22) @@ -533,7 +535,9 @@ This commonly includes things such as: this 'attack #f - (static-attack-info ((id (new-attack-id)) (vector s5-1) (attacker-velocity s5-1) (knock (the-as uint 8)))) + (static-attack-info + ((id (new-attack-id)) (vector s5-1) (attacker-velocity s5-1) (knock (knocked-type knocked-type-8))) + ) ) ) ) @@ -547,13 +551,13 @@ This commonly includes things such as: (defmethod go-hostile ((this crocadog-escort)) (cond ((logtest? (bot-flags bf17) (-> this bot-flags)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag check-water)) + (logclear! (-> this enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (logior! (-> this focus-status) (focus-status disable)) (go (method-of-object this knocked-off-vehicle)) ) @@ -658,14 +662,14 @@ This commonly includes things such as: ) ;; definition for method 78 of type crocadog-escort -(defmethod enemy-method-78 ((this crocadog-escort) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this crocadog-escort) (arg0 enemy-knocked-info)) (ja-channel-push! 1 (seconds 0.1)) (let ((a1-2 (-> this draw art-group data (-> this enemy-info knocked-land-anim))) (a0-4 (-> this skel root-channel 0)) ) (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-2)) (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-2) num-func-seek!) ) diff --git a/test/decompiler/reference/jak2/levels/city/kiddogescort/hal4-course_REF.gc b/test/decompiler/reference/jak2/levels/city/kiddogescort/hal4-course_REF.gc index e70db9386f..01654c1270 100644 --- a/test/decompiler/reference/jak2/levels/city/kiddogescort/hal4-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kiddogescort/hal4-course_REF.gc @@ -146,7 +146,7 @@ (let ((t9-0 (method-of-type hal init-enemy!))) (t9-0 this) ) - (set! (-> this channel) (the-as uint 20)) + (set! (-> this channel) (gui-channel daxter)) 0 (none) ) @@ -165,7 +165,7 @@ (set! (-> this arrestor-handle) (the-as handle #f)) ) ((focus-test? (the-as process-focusable v1-3) hit) - (when (and (time-elapsed? (-> this played-defend-time) (seconds 6)) (not (channel-active? this (the-as uint 0)))) + (when (and (time-elapsed? (-> this played-defend-time) (seconds 6)) (not (channel-active? this (gui-channel none)))) (let ((a1-5 (bot-speech-list-method-9 (-> this hal4-course defend-speeches) this @@ -188,7 +188,7 @@ (if (and (not (speech-playing? this 30)) (nonzero? (-> this played-defend-time)) (time-elapsed? (-> this played-defend-time) (seconds 3)) - (not (channel-active? this (the-as uint 0))) + (not (channel-active? this (gui-channel none))) ) (play-speech this 30) ) @@ -627,7 +627,7 @@ ;; definition for method 204 of type hal-escort (defmethod play-too-far-warn-speech ((this hal-escort)) - (when (not (channel-active? this (the-as uint 0))) + (when (not (channel-active? this (gui-channel none))) (let ((s5-0 0)) (let* ((v1-5 (-> this actor-group 0 data 1 actor)) (s4-0 (when v1-5 @@ -1007,7 +1007,7 @@ (lambda ((arg0 object) (arg1 hal-escort)) (if (and (not (speech-playing? arg1 3)) (time-elapsed? (-> arg1 waypoint-time0) (seconds 1)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 3) ) @@ -1317,7 +1317,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))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 7) ) @@ -1346,10 +1346,10 @@ (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 transv)) 40960.0) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) ) - (play-speech arg0 (if (zero? (get-rand-int arg0 2)) + (play-speech arg0 (if (zero? (rnd-int-count arg0 2)) 32 31 ) @@ -1360,7 +1360,7 @@ (when (and (zero? (-> arg0 locked-player-time)) (or (not (speech-playing? arg0 33)) (not (speech-playing? arg0 34))) (time-elapsed? (-> arg0 played-get-in-time) (seconds 6)) - (not (channel-active? arg0 (the-as uint 0))) + (not (channel-active? arg0 (gui-channel none))) ) (let ((a0-18 (handle->process (-> arg0 vehicle-handle)))) (when a0-18 @@ -1492,7 +1492,7 @@ (lambda ((arg0 object) (arg1 hal-escort)) (when (and (not (speech-playing? arg1 4)) (time-elapsed? (-> arg1 waypoint-time0) (seconds 2)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 15) (play-speech arg1 4) @@ -1631,7 +1631,7 @@ ) (when (and (process-grab? s4-1 #t) (process-grab? s3-2 #t) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (process-grab? s5-0 #f) ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) @@ -1769,7 +1769,7 @@ ) ) (when (and (time-elapsed? (-> arg1 waypoint-time0) (seconds 3)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (scene-play arg1 "dig-knock-down-scaffolding-intro" #t) ) (remove-setting! 'entity-name) diff --git a/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc-states_REF.gc b/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc-states_REF.gc index 43e2884c8d..6ef7255b39 100644 --- a/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc-states_REF.gc @@ -18,7 +18,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -93,7 +93,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -312,7 +312,7 @@ (put-rider-in-seat (the-as vehicle gp-0) (-> self vehicle-seat-index) self) ) (logior! (-> self focus-status) (focus-status pilot)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logior! (-> self focus-status) (focus-status disable)) (logclear! (-> self focus-status) (focus-status arrestable)) (logclear! (-> self bot-flags) (bot-flags bf15)) @@ -322,9 +322,9 @@ (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) (logclear! (-> self focus-status) (focus-status disable)) (let ((v1-5 (-> self enemy-flags))) - (if (logtest? v1-5 (enemy-flag checking-water)) - (set! v1-6 (logior v1-5 (enemy-flag enable-on-active))) - (set! v1-6 (logclear v1-5 (enemy-flag enable-on-active))) + (if (logtest? v1-5 (enemy-flag vulnerable-backup)) + (set! v1-6 (logior v1-5 (enemy-flag vulnerable))) + (set! v1-6 (logclear v1-5 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-6) @@ -453,7 +453,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logclear! (-> self root nav-flags) (nav-flags has-root-sphere)) (let ((v1-11 (-> self nav))) (logclear! (-> v1-11 shape nav-flags) (nav-flags has-extra-sphere)) @@ -466,9 +466,9 @@ (local-vars (v1-4 enemy-flag)) (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) (let ((v1-3 (-> self enemy-flags))) - (if (logtest? v1-3 (enemy-flag checking-water)) - (set! v1-4 (logior v1-3 (enemy-flag enable-on-active))) - (set! v1-4 (logclear v1-3 (enemy-flag enable-on-active))) + (if (logtest? v1-3 (enemy-flag vulnerable-backup)) + (set! v1-4 (logior v1-3 (enemy-flag vulnerable))) + (set! v1-4 (logclear v1-3 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-4) @@ -536,7 +536,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logior! (-> self root nav-flags) (nav-flags has-root-sphere)) (logior! (-> self focus-status) (focus-status disable)) (logclear! (-> self focus-status) (focus-status arrestable)) @@ -558,9 +558,9 @@ 0 (logclear! (-> self focus-status) (focus-status disable)) (let ((v1-16 (-> self enemy-flags))) - (if (logtest? v1-16 (enemy-flag checking-water)) - (set! v1-17 (logior v1-16 (enemy-flag enable-on-active))) - (set! v1-17 (logclear v1-16 (enemy-flag enable-on-active))) + (if (logtest? v1-16 (enemy-flag vulnerable-backup)) + (set! v1-17 (logior v1-16 (enemy-flag vulnerable))) + (set! v1-17 (logclear v1-16 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-17) @@ -693,7 +693,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -767,29 +767,29 @@ ) :code (behavior () (local-vars (v1-7 enemy-flag) (v1-15 enemy-flag)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-6 (-> self enemy-flags))) - (if (logtest? v1-6 (enemy-flag checking-water)) - (set! v1-7 (logior v1-6 (enemy-flag enable-on-active))) - (set! v1-7 (logclear v1-6 (enemy-flag enable-on-active))) + (if (logtest? v1-6 (enemy-flag vulnerable-backup)) + (set! v1-7 (logior v1-6 (enemy-flag vulnerable))) + (set! v1-7 (logclear v1-6 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-7) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-14 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-14) - (set! v1-15 (logior (enemy-flag check-water-backup) v1-14)) - (set! v1-15 (logclear v1-14 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-14) + (set! v1-15 (logior (enemy-flag trackable) v1-14)) + (set! v1-15 (logclear v1-14 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-15) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) @@ -830,7 +830,7 @@ (logior! (-> self focus-status) (focus-status arrestable)) (logclear! (-> self focus-status) (focus-status disable)) (if (logtest? (bot-flags bf19) (-> self bot-flags)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) ) :trans (behavior () @@ -869,7 +869,7 @@ ) ) (if v1-7 - (logclear! (-> (the-as crimson-guard v1-7) enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> (the-as crimson-guard v1-7) enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) ) ) @@ -909,7 +909,7 @@ ) ) (if v1-93 - (logclear! (-> (the-as crimson-guard v1-93) enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> (the-as crimson-guard v1-93) enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) ) ) @@ -1005,13 +1005,13 @@ (vector-reset! (-> self root transv)) (stop-looking-at-target! self) (logior! (-> self bot-flags) (bot-flags bf09)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> self focus-status) (focus-status dangerous)) - (logclear! (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> self mask) (process-mask collectable)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> self mask) (process-mask actor-pause)) - (logclear! (-> self enemy-flags) (enemy-flag notice)) + (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logior! (-> self focus-status) (focus-status arrestable)) (logior! (-> self focus-status) (focus-status disable)) (set! (-> self travel-anim-interp) 0.0) diff --git a/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc4-course_REF.gc b/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc4-course_REF.gc index ac8a384ddf..e1bc6384c5 100644 --- a/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc4-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc4-course_REF.gc @@ -45,7 +45,7 @@ 0 (move-to-point! (-> arg0 root) (the-as vector (-> arg0 course spots 0))) (logclear! (-> arg0 mask) (process-mask actor-pause)) - (logclear! (-> arg0 enemy-flags) (enemy-flag notice)) + (logclear! (-> arg0 enemy-flags) (enemy-flag actor-pause-backup)) (let ((v1-16 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) (set! (-> v1-16 bytes 5) 1) (set! (-> v1-16 bytes 6) 0) diff --git a/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc_REF.gc b/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc_REF.gc index a9e61c279e..2bb548553f 100644 --- a/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc_REF.gc @@ -208,11 +208,11 @@ (set! (-> a1-11 y) 0.0) (forward-up->quaternion (-> this root quat) a1-11 *up-vector*) ) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (send-event (handle->process (-> this master-handle)) 'notify 'arrest s5-1) ) (go (method-of-object this arrested)) @@ -465,7 +465,7 @@ This commonly includes things such as: ) (set! (-> this min-speed) 18022.4) (set! (-> this max-speed) 18432.0) - (set! (-> this channel) (the-as uint 26)) + (set! (-> this channel) (gui-channel kid)) (set! (-> this notice-enemy-dist) 122880.0) (set! (-> this travel-anim-interp) 0.0) (set! (-> this focus-info max-los-dist) 0.0) @@ -598,14 +598,14 @@ This commonly includes things such as: ) ;; definition for method 78 of type kid-escort -(defmethod enemy-method-78 ((this kid-escort) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this kid-escort) (arg0 enemy-knocked-info)) (ja-channel-push! 1 (seconds 0.1)) (let ((a1-2 (-> this draw art-group data (-> this enemy-info knocked-land-anim))) (a0-4 (-> this skel root-channel 0)) ) (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-2)) (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-2) num-func-seek!) ) @@ -646,7 +646,9 @@ This commonly includes things such as: (let* ((t9-0 (method-of-type bot bot-method-193)) (v0-0 (t9-0 this)) ) - (if (and (not v0-0) (logtest? #x1c00000 (-> this incoming penetrate-using))) + (if (and (not v0-0) + (logtest? (penetrate jak-yellow-shot jak-red-shot jak-blue-shot) (-> this incoming penetrate-using)) + ) (set! v0-0 #t) ) v0-0 @@ -734,9 +736,9 @@ This commonly includes things such as: (quaternion-rotate-y! s4-0 s4-0 f30-0) ) (let ((v1-24 (-> this enemy-flags))) - (if (logtest? v1-24 (enemy-flag checking-water)) - (set! v1-25 (logior v1-24 (enemy-flag enable-on-active))) - (set! v1-25 (logclear v1-24 (enemy-flag enable-on-active))) + (if (logtest? v1-24 (enemy-flag vulnerable-backup)) + (set! v1-25 (logior v1-24 (enemy-flag vulnerable))) + (set! v1-25 (logclear v1-24 (enemy-flag vulnerable))) ) ) (set! (-> this enemy-flags) v1-25) @@ -746,7 +748,9 @@ This commonly includes things such as: this 'attack #f - (static-attack-info ((id (new-attack-id)) (vector s4-2) (attacker-velocity s4-2) (knock (the-as uint 8)))) + (static-attack-info + ((id (new-attack-id)) (vector s4-2) (attacker-velocity s4-2) (knock (knocked-type knocked-type-8))) + ) ) ) ) @@ -761,13 +765,13 @@ This commonly includes things such as: (cond ((logtest? (bot-flags bf17) (-> this bot-flags)) (logior! (-> this bot-flags) (bot-flags bf09)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag check-water)) + (logclear! (-> this enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (logior! (-> this focus-status) (focus-status disable)) (go (method-of-object this knocked-off-vehicle)) ) diff --git a/test/decompiler/reference/jak2/levels/city/market/ashelin/ash4-course_REF.gc b/test/decompiler/reference/jak2/levels/city/market/ashelin/ash4-course_REF.gc index 6aa6386289..b24b9fbf46 100644 --- a/test/decompiler/reference/jak2/levels/city/market/ashelin/ash4-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/market/ashelin/ash4-course_REF.gc @@ -343,8 +343,8 @@ (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))) + (when (not (channel-active? arg0 (gui-channel none))) + (let ((v1-12 (rnd-int-count arg0 3))) (cond ((zero? v1-12) (play-speech arg0 42) @@ -368,7 +368,7 @@ (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))) + (not (channel-active? arg1 (gui-channel none))) (scene-play arg1 (the-as string (-> s5-0 scene)) #f) ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) diff --git a/test/decompiler/reference/jak2/levels/city/market/ashelin/ctyasha-obs_REF.gc b/test/decompiler/reference/jak2/levels/city/market/ashelin/ctyasha-obs_REF.gc index 1641bfa08f..f1add1f0e5 100644 --- a/test/decompiler/reference/jak2/levels/city/market/ashelin/ctyasha-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/market/ashelin/ctyasha-obs_REF.gc @@ -938,10 +938,10 @@ (displacement-between-points-at-percent-normalized! s5-0 s4-0 f30-0) (forward-up->quaternion (-> this root quat) s4-0 *up-vector*) ) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) - (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) - (logclear! (-> this mask) (process-mask actor-pause)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance directed directed-ready use-trigger)) (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this mask) (process-mask actor-pause)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (set-vector! (-> this root scale) 1.0 1.0 1.0 1.0) (go-hostile this) #t @@ -1055,10 +1055,10 @@ (displacement-between-points-at-percent-normalized! s5-0 s4-0 f30-0) (forward-up->quaternion (-> this root quat) s4-0 *up-vector*) ) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) - (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) - (logclear! (-> this mask) (process-mask actor-pause)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance directed directed-ready use-trigger)) (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this mask) (process-mask actor-pause)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (set-vector! (-> this root scale) 1.0 1.0 1.0 1.0) (go-hostile this) #t @@ -1582,14 +1582,14 @@ This commonly includes things such as: (v1-1 (new 'stack-no-clear 'vector)) ) (vector-! v1-1 (-> self root trans) (-> self prev-pos)) - (send-event - proc - 'attack - a2-1 - (static-attack-info - ((id (-> self attack-id)) (mode 'eco-red) (attacker-velocity v1-1) (damage 2.0) (knock (the-as uint 2))) - ) - ) + (send-event proc 'attack a2-1 (static-attack-info ((id (-> self attack-id)) + (mode 'eco-red) + (attacker-velocity v1-1) + (damage 2.0) + (knock (knocked-type knocked-type-2)) + ) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/meet-brutter/meet-brutter_REF.gc b/test/decompiler/reference/jak2/levels/city/meet-brutter/meet-brutter_REF.gc index 877425e9e1..558d342ea7 100644 --- a/test/decompiler/reference/jak2/levels/city/meet-brutter/meet-brutter_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/meet-brutter/meet-brutter_REF.gc @@ -943,7 +943,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info run-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.45 0.65))) + (let ((f30-0 (rnd-float-range self 0.45 0.65))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -1553,7 +1553,9 @@ (set! (-> v1-22 prim-core collide-with) (collide-spec)) ) 0 - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 0 (-> self end-pos)) ) (if (and (time-elapsed? (-> self state-time) (seconds 1)) @@ -1566,7 +1568,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info run-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.45 0.65))) + (let ((f30-0 (rnd-float-range self 0.45 0.65))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -1651,7 +1653,9 @@ (set! (-> v1-27 prim-core collide-with) (collide-spec)) ) 0 - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 0 (-> self end-pos)) ) ) @@ -1660,7 +1664,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info run-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.45 0.65))) + (let ((f30-0 (rnd-float-range self 0.45 0.65))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -1906,7 +1910,12 @@ (let ((gp-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) (set! (-> gp-0 y) 1.0) (vector-normalize! gp-0 40960.0) - (send-event self 'attack #f (static-attack-info ((id (new-attack-id)) (vector gp-0) (knock (the-as uint 7))))) + (send-event + self + 'attack + #f + (static-attack-info ((id (new-attack-id)) (vector gp-0) (knock (knocked-type knocked-type-7)))) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/shuttle/shuttle_REF.gc b/test/decompiler/reference/jak2/levels/city/shuttle/shuttle_REF.gc index 6412913df8..23f7fbace1 100644 --- a/test/decompiler/reference/jak2/levels/city/shuttle/shuttle_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/shuttle/shuttle_REF.gc @@ -723,7 +723,7 @@ (let* ((t9-0 (method-of-type nav-enemy enemy-method-58)) (v0-0 (t9-0 this arg0 arg1)) ) - (if (logtest? #x4000000 (-> this incoming penetrate-using)) + (if (logtest? (penetrate enemy-yellow-shot) (-> this incoming penetrate-using)) (set! v0-0 #f) ) v0-0 @@ -813,7 +813,7 @@ (-> this neck) (set! (-> this info) *citizen-rebel-global-info*) (set! (-> this anim-shuffle) 10) - (let ((v1-16 (get-rand-int this 3))) + (let ((v1-16 (rnd-int-count this 3))) (cond ((zero? v1-16) (set! (-> this anim-walk) 11) @@ -832,7 +832,7 @@ ) ) ) - (let ((v1-31 (get-rand-int this 3))) + (let ((v1-31 (rnd-int-count this 3))) (cond ((zero? v1-31) (set! (-> this anim-panic-run) 17) @@ -846,7 +846,7 @@ ) ) (set! (-> this dist-run-anim) 28672.0) - (let ((v1-38 (get-rand-int this 3))) + (let ((v1-38 (rnd-int-count this 3))) (cond ((zero? v1-38) (set! (-> this anim-run) 14) @@ -864,12 +864,12 @@ (set! (-> this anim-dive) 19) (set! (-> this anim-get-up-front) 25) (set! (-> this anim-get-up-back) 26) - (let ((f30-0 (get-rand-float-range this 1.0 1.25)) - (f0-10 (get-rand-float-range this 1.0 1.25)) + (let ((f30-0 (rnd-float-range this 1.0 1.25)) + (f0-10 (rnd-float-range this 1.0 1.25)) ) (set-vector! (-> this root scale) f0-10 f30-0 f0-10 1.0) ) - (let ((f0-12 (get-rand-float-range this 0.9 1.0))) + (let ((f0-12 (rnd-float-range this 0.9 1.0))) (set-vector! (-> this draw color-mult) f0-12 f0-12 f0-12 1.0) ) (set! (-> this water-anim) 32) @@ -960,7 +960,7 @@ (setup-masks (-> this draw) 4 0) (setup-masks (-> this draw) 16 0) (setup-masks (-> this draw) 64 0) - (let ((v1-14 (get-rand-int this 3))) + (let ((v1-14 (rnd-int-count this 3))) (cond ((zero? v1-14) (setup-masks (-> this draw) 2 0) @@ -973,7 +973,7 @@ ) ) ) - (let ((v1-23 (get-rand-int this 2))) + (let ((v1-23 (rnd-int-count this 2))) (cond ((zero? v1-23) (setup-masks (-> this draw) 32 0) 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 f218b72b36..7588982a14 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 @@ -18,7 +18,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -88,7 +88,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -243,7 +243,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -378,7 +378,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -452,29 +452,29 @@ (suspend) (ja :num! (seek!)) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-30 (-> self enemy-flags))) - (if (logtest? v1-30 (enemy-flag checking-water)) - (set! v1-31 (logior v1-30 (enemy-flag enable-on-active))) - (set! v1-31 (logclear v1-30 (enemy-flag enable-on-active))) + (if (logtest? v1-30 (enemy-flag vulnerable-backup)) + (set! v1-31 (logior v1-30 (enemy-flag vulnerable))) + (set! v1-31 (logclear v1-30 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-31) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-38 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-38) - (set! v1-39 (logior (enemy-flag check-water-backup) v1-38)) - (set! v1-39 (logclear v1-38 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-38) + (set! v1-39 (logior (enemy-flag trackable) v1-38)) + (set! v1-39 (logclear v1-38 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-39) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) @@ -513,7 +513,7 @@ (stop-looking-at-target! self) (set! (-> self travel-anim-interp) 0.0) (if (logtest? (bot-flags bf20) (-> self bot-flags)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) ) :trans (behavior () @@ -558,7 +558,7 @@ ) ) (if v1-32 - (logclear! (-> (the-as crimson-guard v1-32) enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> (the-as crimson-guard v1-32) enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) ) (let ((v1-35 (ja-group))) diff --git a/test/decompiler/reference/jak2/levels/city/slums/kor/kid3-course_REF.gc b/test/decompiler/reference/jak2/levels/city/slums/kor/kid3-course_REF.gc index 551f344ca1..0b31682187 100644 --- a/test/decompiler/reference/jak2/levels/city/slums/kor/kid3-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/slums/kor/kid3-course_REF.gc @@ -38,7 +38,7 @@ 0 (move-to-point! (-> arg0 root) (the-as vector (-> arg0 course spots 0))) (logclear! (-> arg0 mask) (process-mask actor-pause)) - (logclear! (-> arg0 enemy-flags) (enemy-flag notice)) + (logclear! (-> arg0 enemy-flags) (enemy-flag actor-pause-backup)) (let ((v1-16 (get-task-by-type (-> arg0 ai-ctrl) kidt-wait-spot arg0))) (set! (-> v1-16 bytes 5) 1) (set! (-> v1-16 bytes 6) 0) 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 582243cfe6..a22d1a4e5a 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 @@ -207,11 +207,11 @@ (forward-up->quaternion (-> this root quat) a1-8 *up-vector*) ) ) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (send-event (handle->process (-> this master-handle)) 'notify 'arrest #f) (go (method-of-object this arrested)) ) @@ -441,7 +441,7 @@ ) (set! (-> this min-speed) 6144.0) (set! (-> this max-speed) 22528.0) - (set! (-> this channel) (the-as uint 26)) + (set! (-> this channel) (gui-channel kid)) (set! (-> this notice-enemy-dist) 122880.0) (set! (-> this travel-anim-interp) 0.0) (set! (-> this focus-info max-los-dist) 0.0) @@ -598,14 +598,14 @@ ) ;; definition for method 78 of type kid -(defmethod enemy-method-78 ((this kid) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this kid) (arg0 enemy-knocked-info)) (ja-channel-push! 1 (seconds 0.1)) (let ((a1-2 (-> this draw art-group data (-> this enemy-info knocked-land-anim))) (a0-4 (-> this skel root-channel 0)) ) (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-2)) (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-2) num-func-seek!) ) 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 e382156275..2996be66ce 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 @@ -18,7 +18,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -89,7 +89,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -254,7 +254,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -389,7 +389,7 @@ ) 0 (vector-reset! (-> self root transv)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -463,29 +463,29 @@ (suspend) (ja :num! (seek!)) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-30 (-> self enemy-flags))) - (if (logtest? v1-30 (enemy-flag checking-water)) - (set! v1-31 (logior v1-30 (enemy-flag enable-on-active))) - (set! v1-31 (logclear v1-30 (enemy-flag enable-on-active))) + (if (logtest? v1-30 (enemy-flag vulnerable-backup)) + (set! v1-31 (logior v1-30 (enemy-flag vulnerable))) + (set! v1-31 (logclear v1-30 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-31) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-38 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-38) - (set! v1-39 (logior (enemy-flag check-water-backup) v1-38)) - (set! v1-39 (logclear v1-38 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-38) + (set! v1-39 (logior (enemy-flag trackable) v1-38)) + (set! v1-39 (logclear v1-38 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-39) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) @@ -524,7 +524,7 @@ (stop-looking-at-target! self) (set! (-> self travel-anim-interp) 0.0) (if (logtest? (bot-flags bf20) (-> self bot-flags)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) ) :trans (behavior () @@ -580,7 +580,7 @@ ) ) (if v1-49 - (logclear! (-> (the-as crimson-guard v1-49) enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> (the-as crimson-guard v1-49) enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) ) (ja-channel-push! 1 (seconds 0.1)) diff --git a/test/decompiler/reference/jak2/levels/city/slums/kor/kor3-course_REF.gc b/test/decompiler/reference/jak2/levels/city/slums/kor/kor3-course_REF.gc index 2d8b2db3f5..9c9683d594 100644 --- a/test/decompiler/reference/jak2/levels/city/slums/kor/kor3-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/slums/kor/kor3-course_REF.gc @@ -38,7 +38,7 @@ 0 (move-to-point! (-> arg0 root) (the-as vector (-> arg0 course spots 0))) (logclear! (-> arg0 mask) (process-mask actor-pause)) - (logclear! (-> arg0 enemy-flags) (enemy-flag notice)) + (logclear! (-> arg0 enemy-flags) (enemy-flag actor-pause-backup)) (let ((v1-16 (get-task-by-type (-> arg0 ai-ctrl) kort-wait-spot arg0))) (set! (-> v1-16 bytes 5) 1) (set! (-> v1-16 bytes 6) 0) 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 3d1ce7f5a7..f8378f0497 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 @@ -225,11 +225,11 @@ (forward-up->quaternion (-> this root quat) a1-8 *up-vector*) ) ) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (go (method-of-object this arrested)) ) (else @@ -454,7 +454,7 @@ ) (set! (-> this min-speed) 6144.0) (set! (-> this max-speed) 20889.6) - (set! (-> this channel) (the-as uint 27)) + (set! (-> this channel) (gui-channel kor)) (set! (-> this notice-enemy-dist) 122880.0) (set! (-> this travel-anim-interp) 0.0) (set! (-> this focus-info max-los-dist) 0.0) @@ -608,14 +608,14 @@ ) ;; definition for method 78 of type kor -(defmethod enemy-method-78 ((this kor) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this kor) (arg0 enemy-knocked-info)) (ja-channel-push! 1 (seconds 0.1)) (let ((a1-2 (-> this draw art-group data (-> this enemy-info knocked-land-anim))) (a0-4 (-> this skel root-channel 0)) ) (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-2)) (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-2) num-func-seek!) ) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-chick_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-chick_REF.gc index a01ea15430..44aecfab73 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-chick_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-chick_REF.gc @@ -345,12 +345,12 @@ ) ;; definition for method 77 of type citizen-chick -(defmethod enemy-method-77 ((this citizen-chick) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this citizen-chick) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (ja-channel-push! 1 (seconds 0.01)) (let* ((a2-0 (ash 1 (-> this info prev-yellow-hit))) - (v1-3 (enemy-method-120 this 1 a2-0)) + (v1-3 (rnd-bit this 1 a2-0)) (a1-7 (-> this draw @@ -368,7 +368,7 @@ (let ((a0-15 (-> this skel root-channel 0))) (set! (-> a0-15 frame-group) (the-as art-joint-anim a1-7)) (set! (-> a0-15 param 0) (the float (+ (-> (the-as art-joint-anim a1-7) frames num-frames) -1))) - (set! (-> a0-15 param 1) (-> arg0 0)) + (set! (-> a0-15 param 1) (-> arg0 anim-speed)) (set! (-> a0-15 frame-num) 0.0) (joint-control-channel-group! a0-15 (the-as art-joint-anim a1-7) num-func-seek!) ) @@ -377,7 +377,7 @@ (((knocked-type knocked-type-6)) (ja-channel-push! 1 (seconds 0.01)) (let* ((a2-2 (ash 1 (-> this info prev-blue-hit))) - (v1-12 (enemy-method-120 this 3 a2-2)) + (v1-12 (rnd-bit this 3 a2-2)) (a1-14 (-> this draw @@ -412,7 +412,7 @@ (let ((a0-39 (-> this skel root-channel 0))) (set! (-> a0-39 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-39 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-39 param 1) (-> arg0 0)) + (set! (-> a0-39 param 1) (-> arg0 anim-speed)) (set! (-> a0-39 frame-num) 0.0) (joint-control-channel-group! a0-39 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -423,7 +423,7 @@ ) ;; definition for method 78 of type citizen-chick -(defmethod enemy-method-78 ((this citizen-chick) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this citizen-chick) (arg0 enemy-knocked-info)) (ja-channel-push! 1 (seconds 0.1)) (let ((a0-2 (-> this skel root-channel 0))) (set! (-> a0-2 frame-group) @@ -439,7 +439,7 @@ ) ) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 @@ -607,7 +607,7 @@ (try-update-focus (-> this focus) *target* this) (set-vector! (-> this neck twist-max) 10922.667 18204.445 0.0 1.0) (set! (-> this anim-shuffle) 26) - (let ((v1-18 (get-rand-int this 3))) + (let ((v1-18 (rnd-int-count this 3))) (cond ((zero? v1-18) (set! (-> this anim-walk) 4) @@ -626,7 +626,7 @@ ) ) ) - (let ((v1-33 (get-rand-int this 3))) + (let ((v1-33 (rnd-int-count this 3))) (cond ((zero? v1-33) (set! (-> this anim-panic-run) 11) @@ -639,7 +639,7 @@ ) ) ) - (let ((v1-39 (get-rand-int this 3))) + (let ((v1-39 (rnd-int-count this 3))) (cond ((zero? v1-39) (set! (-> this dist-run-anim) 26214.4) @@ -660,12 +660,12 @@ (set! (-> this anim-dive) 17) (set! (-> this anim-get-up-back) 25) (set! (-> this anim-get-up-front) 24) - (let ((f30-0 (get-rand-float-range this 1.0 1.25)) - (f0-17 (get-rand-float-range this 1.0 1.25)) + (let ((f30-0 (rnd-float-range this 1.0 1.25)) + (f0-17 (rnd-float-range this 1.0 1.25)) ) (set-vector! (-> this root scale) f0-17 f30-0 f0-17 1.0) ) - (let ((f0-19 (get-rand-float-range this 0.9 1.0))) + (let ((f0-19 (rnd-float-range this 0.9 1.0))) (set-vector! (-> this draw color-mult) f0-19 f0-19 f0-19 1.0) ) (set! (-> this water-anim) 12) @@ -686,7 +686,7 @@ (setup-masks (-> this draw) 0 -1) (setup-masks (-> this draw) 16 0) (setup-masks (-> this draw) 8 0) - (let ((v1-11 (get-rand-int this 3))) + (let ((v1-11 (rnd-int-count this 3))) (cond ((zero? v1-11) (setup-masks (-> this draw) 32 0) @@ -699,7 +699,7 @@ ) ) ) - (let ((v1-20 (get-rand-int this 3))) + (let ((v1-20 (rnd-int-count this 3))) (cond ((zero? v1-20) (setup-masks (-> this draw) 64 0) @@ -712,7 +712,7 @@ ) ) ) - (let ((v1-29 (get-rand-int this 3))) + (let ((v1-29 (rnd-int-count this 3))) (cond ((zero? v1-29) (setup-masks (-> this draw) 4 0) @@ -725,11 +725,11 @@ ) ) ) - (let ((v1-38 (get-rand-int this 3))) + (let ((v1-38 (rnd-int-count this 3))) (cond ((zero? v1-38) (setup-masks (-> this draw) 2 0) - (let ((v1-42 (get-rand-int this 2))) + (let ((v1-42 (rnd-int-count this 2))) (cond ((zero? v1-42) (setup-masks (-> this draw) 128 0) @@ -745,7 +745,7 @@ ) ((= v1-38 2) (setup-masks (-> this draw) 2048 0) - (let ((v1-54 (get-rand-int this 2))) + (let ((v1-54 (rnd-int-count this 2))) (cond ((zero? v1-54) (setup-masks (-> this draw) 128 0) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-enemy_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-enemy_REF.gc index b7f8707f89..d9ea9300b4 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-enemy_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-enemy_REF.gc @@ -28,7 +28,7 @@ ) ;; definition for method 55 of type citizen-enemy -(defmethod track-target! ((this citizen-enemy)) +(defmethod common-post ((this citizen-enemy)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -41,7 +41,7 @@ ) (when (and (not (focus-test? this disable dead ignore inactive)) (< (-> this next-update-target) (current-time)) - (not (logtest? (enemy-flag actor-pause-backup) (-> this enemy-flags))) + (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) (-> this next-state) (= (-> this next-state name) 'active) ) @@ -49,7 +49,7 @@ (set! (-> this next-update-target) (+ (current-time) (seconds 0.2))) (traffic-danger-init! this) ) - ((method-of-type citizen track-target!) this) + ((method-of-type citizen common-post) this) (none) ) @@ -239,7 +239,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info walk-anim)) :num! (seek! max f30-0) @@ -295,13 +295,13 @@ (set! (-> this dist-run-anim) (-> this enemy-info run-travel-speed)) (set! (-> this speed-run) (-> this enemy-info walk-travel-speed)) (set! (-> this fated-time) 0) - (logior! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logior! (-> this focus-status) (focus-status dangerous)) - (logior! (-> this enemy-flags) (enemy-flag check-water)) - (logior! (-> this enemy-flags) (enemy-flag check-water-backup no-initial-move-to-ground)) + (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> this enemy-flags) (enemy-flag trackable trackable-backup)) (logclear! (-> this focus-status) (focus-status dead)) (logior! (-> this mask) (process-mask collectable)) - (logior! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logior! (-> this enemy-flags) (enemy-flag attackable-backup)) (if (not (-> this minimap)) (set! (-> this minimap) (add-icon! *minimap* this (the-as uint 70) (the-as int #f) (the-as vector #t) 0)) ) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-fat_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-fat_REF.gc index bc2552dabd..11cd1ffbdf 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-fat_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-fat_REF.gc @@ -345,12 +345,12 @@ ) ;; definition for method 77 of type citizen-fat -(defmethod enemy-method-77 ((this citizen-fat) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this citizen-fat) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (ja-channel-push! 1 (seconds 0.01)) (let* ((a2-0 (ash 1 (-> this info prev-yellow-hit))) - (v1-3 (enemy-method-120 this 1 a2-0)) + (v1-3 (rnd-bit this 1 a2-0)) (a1-7 (-> this draw @@ -368,7 +368,7 @@ (let ((a0-15 (-> this skel root-channel 0))) (set! (-> a0-15 frame-group) (the-as art-joint-anim a1-7)) (set! (-> a0-15 param 0) (the float (+ (-> (the-as art-joint-anim a1-7) frames num-frames) -1))) - (set! (-> a0-15 param 1) (-> arg0 0)) + (set! (-> a0-15 param 1) (-> arg0 anim-speed)) (set! (-> a0-15 frame-num) 0.0) (joint-control-channel-group! a0-15 (the-as art-joint-anim a1-7) num-func-seek!) ) @@ -377,7 +377,7 @@ (((knocked-type knocked-type-6)) (ja-channel-push! 1 (seconds 0.01)) (let* ((a2-2 (ash 1 (-> this info prev-blue-hit))) - (v1-12 (enemy-method-120 this 3 a2-2)) + (v1-12 (rnd-bit this 3 a2-2)) (a1-14 (-> this draw @@ -412,7 +412,7 @@ (let ((a0-39 (-> this skel root-channel 0))) (set! (-> a0-39 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-39 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-39 param 1) (-> arg0 0)) + (set! (-> a0-39 param 1) (-> arg0 anim-speed)) (set! (-> a0-39 frame-num) 0.0) (joint-control-channel-group! a0-39 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -423,7 +423,7 @@ ) ;; definition for method 78 of type citizen-fat -(defmethod enemy-method-78 ((this citizen-fat) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this citizen-fat) (arg0 enemy-knocked-info)) (ja-channel-push! 1 (seconds 0.1)) (let ((a0-2 (-> this skel root-channel 0))) (set! (-> a0-2 frame-group) @@ -439,7 +439,7 @@ ) ) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 @@ -644,7 +644,7 @@ (try-update-focus (-> this focus) *target* this) (set-vector! (-> this neck twist-max) 10922.667 18204.445 0.0 1.0) (set! (-> this anim-shuffle) 12) - (let ((v1-18 (get-rand-int this 3))) + (let ((v1-18 (rnd-int-count this 3))) (cond ((zero? v1-18) (set! (-> this anim-walk) 11) @@ -663,7 +663,7 @@ ) ) ) - (let ((v1-33 (get-rand-int this 3))) + (let ((v1-33 (rnd-int-count this 3))) (cond ((zero? v1-33) (set! (-> this anim-panic-run) 17) @@ -677,7 +677,7 @@ ) ) (set! (-> this dist-run-anim) 20480.0) - (let ((v1-40 (get-rand-int this 3))) + (let ((v1-40 (rnd-int-count this 3))) (cond ((zero? v1-40) (set! (-> this anim-run) 15) @@ -695,12 +695,12 @@ (set! (-> this anim-dive) 18) (set! (-> this anim-get-up-back) 25) (set! (-> this anim-get-up-front) 24) - (let ((f30-0 (get-rand-float-range this 1.0 1.25)) - (f0-15 (get-rand-float-range this 1.0 1.25)) + (let ((f30-0 (rnd-float-range this 1.0 1.25)) + (f0-15 (rnd-float-range this 1.0 1.25)) ) (set-vector! (-> this root scale) f0-15 f30-0 f0-15 1.0) ) - (let ((f0-17 (get-rand-float-range this 0.9 1.0))) + (let ((f0-17 (rnd-float-range this 0.9 1.0))) (set-vector! (-> this draw color-mult) f0-17 f0-17 f0-17 1.0) ) (set! (-> this water-anim) 32) @@ -718,11 +718,11 @@ (set! (-> this dive-reaction) (* 0.2 (rand-vu))) (logclear! (-> this mask) (process-mask enemy)) (setup-masks (-> this draw) 0 -1) - (let ((v1-7 (get-rand-int this 2))) + (let ((v1-7 (rnd-int-count this 2))) (cond ((zero? v1-7) (setup-masks (-> this draw) 8 0) - (let ((v1-11 (get-rand-int this 3))) + (let ((v1-11 (rnd-int-count this 3))) (cond ((zero? v1-11) (setup-masks (-> this draw) 4 0) @@ -735,7 +735,7 @@ ) ) ) - (let ((v1-20 (get-rand-int this 4))) + (let ((v1-20 (rnd-int-count this 4))) (cond ((zero? v1-20) (setup-masks (-> this draw) 2 0) @@ -749,7 +749,7 @@ ) ) (setup-masks (-> this draw) 512 0) - (let ((v1-31 (get-rand-int this 3))) + (let ((v1-31 (rnd-int-count this 3))) (cond ((zero? v1-31) (setup-masks (-> this draw) 64 0) @@ -762,7 +762,7 @@ ) ) ) - (let ((v1-40 (get-rand-int this 3))) + (let ((v1-40 (rnd-int-count this 3))) (cond ((zero? v1-40) (setup-masks (-> this draw) 32 0) @@ -775,7 +775,7 @@ ) ) ) - (let ((v1-49 (get-rand-int this 3))) + (let ((v1-49 (rnd-int-count this 3))) (cond ((zero? v1-49) (setup-masks (-> this draw) 16 0) @@ -792,7 +792,7 @@ ((= v1-7 1) (setup-masks (-> this draw) #x400000 0) (setup-masks (-> this draw) #x200000 0) - (let ((v1-63 (get-rand-int this 2))) + (let ((v1-63 (rnd-int-count this 2))) (cond ((zero? v1-63) (setup-masks (-> this draw) 4096 0) @@ -802,7 +802,7 @@ ) ) ) - (let ((v1-70 (get-rand-int this 2))) + (let ((v1-70 (rnd-int-count this 2))) (cond ((zero? v1-70) (setup-masks (-> this draw) 256 0) @@ -812,7 +812,7 @@ ) ) ) - (let ((v1-77 (get-rand-int this 4))) + (let ((v1-77 (rnd-int-count this 4))) (cond ((zero? v1-77) (setup-masks (-> this draw) 2 0) @@ -825,10 +825,10 @@ ) ) ) - (if (zero? (get-rand-int this 1)) + (if (zero? (rnd-int-count this 1)) (setup-masks (-> this draw) #x20000 0) ) - (let ((v1-91 (get-rand-int this 3))) + (let ((v1-91 (rnd-int-count this 3))) (cond ((zero? v1-91) (setup-masks (-> this draw) 16 0) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-norm_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-norm_REF.gc index 4884804316..fa4402b414 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-norm_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen-norm_REF.gc @@ -356,7 +356,7 @@ ) ;; definition for method 77 of type citizen-norm -(defmethod enemy-method-77 ((this citizen-norm) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this citizen-norm) (arg0 enemy-knocked-info)) (local-vars (v1-36 knocked-type)) (cond ((logtest? (-> this flags) (citizen-flag knocked-out-car)) @@ -366,7 +366,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 33)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 33)) num-func-seek!) ) @@ -379,7 +379,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 34)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 34)) num-func-seek!) ) @@ -388,7 +388,7 @@ ((begin (set! v1-36 (-> this incoming knocked-type)) (= v1-36 (knocked-type knocked-type-4))) (ja-channel-push! 1 (seconds 0.1)) (let* ((a2-2 (ash 1 (-> this info prev-yellow-hit))) - (v1-39 (enemy-method-120 this 1 a2-2)) + (v1-39 (rnd-bit this 1 a2-2)) (a1-11 (-> this draw @@ -406,7 +406,7 @@ (let ((a0-21 (-> this skel root-channel 0))) (set! (-> a0-21 frame-group) (the-as art-joint-anim a1-11)) (set! (-> a0-21 param 0) (the float (+ (-> (the-as art-joint-anim a1-11) frames num-frames) -1))) - (set! (-> a0-21 param 1) (-> arg0 0)) + (set! (-> a0-21 param 1) (-> arg0 anim-speed)) (set! (-> a0-21 frame-num) 0.0) (joint-control-channel-group! a0-21 (the-as art-joint-anim a1-11) num-func-seek!) ) @@ -415,7 +415,7 @@ ((= v1-36 (knocked-type knocked-type-6)) (ja-channel-push! 1 (seconds 0.01)) (let* ((a2-4 (ash 1 (-> this info prev-blue-hit))) - (v1-48 (enemy-method-120 this 3 a2-4)) + (v1-48 (rnd-bit this 3 a2-4)) (a1-18 (-> this draw @@ -450,12 +450,12 @@ (if (or (= (-> this incoming knocked-type) (knocked-type knocked-type-2)) (= (-> this incoming knocked-type) (knocked-type knocked-type-3)) ) - (set! (-> arg0 0) (* 0.5 (-> arg0 0))) + (set! (-> arg0 anim-speed) (* 0.5 (-> arg0 anim-speed))) ) (let ((a0-47 (-> this skel root-channel 0))) (set! (-> a0-47 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-47 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-47 param 1) (-> arg0 0)) + (set! (-> a0-47 param 1) (-> arg0 anim-speed)) (set! (-> a0-47 frame-num) 0.0) (joint-control-channel-group! a0-47 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -466,9 +466,9 @@ ) ;; definition for method 78 of type citizen-norm -(defmethod enemy-method-78 ((this citizen-norm) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this citizen-norm) (arg0 enemy-knocked-info)) (ja-channel-push! 1 (seconds 0.1)) - (set! (-> arg0 0) 1.0) + (set! (-> arg0 anim-speed) 1.0) (let ((a0-2 (-> this skel root-channel 0))) (set! (-> a0-2 frame-group) (the-as art-joint-anim (-> this draw art-group data (-> this info knocked-land (-> this hit-face)))) @@ -483,7 +483,7 @@ ) ) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 @@ -792,7 +792,7 @@ (-> this neck) (set! (-> this info) *citizen-norm-global-info*) (set! (-> this anim-shuffle) 11) - (let ((v1-18 (get-rand-int this 3))) + (let ((v1-18 (rnd-int-count this 3))) (cond ((zero? v1-18) (set! (-> this anim-walk) 12) @@ -811,7 +811,7 @@ ) ) ) - (let ((v1-33 (get-rand-int this 3))) + (let ((v1-33 (rnd-int-count this 3))) (cond ((zero? v1-33) (set! (-> this anim-panic-run) 15) @@ -825,7 +825,7 @@ ) ) (set! (-> this dist-run-anim) 28672.0) - (let ((v1-40 (get-rand-int this 3))) + (let ((v1-40 (rnd-int-count this 3))) (cond ((zero? v1-40) (set! (-> this anim-run) 14) @@ -843,12 +843,12 @@ (set! (-> this anim-dive) 16) (set! (-> this anim-get-up-front) 22) (set! (-> this anim-get-up-back) 23) - (let ((f30-0 (get-rand-float-range this 1.0 1.25)) - (f0-11 (get-rand-float-range this 1.0 1.25)) + (let ((f30-0 (rnd-float-range this 1.0 1.25)) + (f0-11 (rnd-float-range this 1.0 1.25)) ) (set-vector! (-> this root scale) f0-11 f30-0 f0-11 1.0) ) - (let ((f0-13 (get-rand-float-range this 0.9 1.0))) + (let ((f0-13 (rnd-float-range this 0.9 1.0))) (set-vector! (-> this draw color-mult) f0-13 f0-13 f0-13 1.0) ) (set! (-> this water-anim) 29) @@ -867,7 +867,7 @@ (logclear! (-> this mask) (process-mask enemy)) (setup-masks (-> this draw) 0 -1) (setup-masks (-> this draw) 32 0) - (let ((v1-10 (get-rand-int this 4))) + (let ((v1-10 (rnd-int-count this 4))) (cond ((zero? v1-10) (setup-masks (-> this draw) 64 0) @@ -883,7 +883,7 @@ ) ) ) - (let ((v1-21 (get-rand-int this 3))) + (let ((v1-21 (rnd-int-count this 3))) (cond ((zero? v1-21) (setup-masks (-> this draw) 2 0) @@ -896,7 +896,7 @@ ) ) ) - (let ((v1-30 (get-rand-int this 4))) + (let ((v1-30 (rnd-int-count this 4))) (cond ((zero? v1-30) (setup-masks (-> this draw) 8 0) @@ -912,7 +912,7 @@ ) ) ) - (let ((v1-41 (get-rand-int this 5))) + (let ((v1-41 (rnd-int-count this 5))) (cond ((zero? v1-41) (setup-masks (-> this draw) 4 0) @@ -928,7 +928,7 @@ ) ) ) - (let ((v1-52 (get-rand-int this 4))) + (let ((v1-52 (rnd-int-count this 4))) (cond ((zero? v1-52) (setup-masks (-> this draw) 128 0) @@ -945,7 +945,7 @@ ) ) (setup-masks (-> this draw) 16 0) - (let ((v1-65 (get-rand-int this 4))) + (let ((v1-65 (rnd-int-count this 4))) (cond ((zero? v1-65) (setup-masks (-> this draw) 256 0) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen_REF.gc index 9ec1565958..8c0d74a428 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen_REF.gc @@ -51,7 +51,7 @@ (logclear! (-> this focus-status) (focus-status disable dead inactive hit)) (logclear! (-> this flags) (citizen-flag persistent in-pursuit hostile)) (clear-focused (-> this focus)) - (set! (-> this enemy-flags) (the-as enemy-flag (logand (enemy-flag dislike-combo) (-> this enemy-flags)))) + (set! (-> this enemy-flags) (the-as enemy-flag (logand (enemy-flag drawn-mirrored) (-> this enemy-flags)))) (logclear! (-> this draw status) (draw-control-status no-draw lod-set)) (set! (-> this draw death-timer) (the-as uint 0)) (logior! (-> this root nav-flags) (nav-flags has-root-sphere)) @@ -77,12 +77,12 @@ dark-giant ) ) - (logior! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logior! (-> this focus-status) (focus-status dangerous)) - (logior! (-> this enemy-flags) (enemy-flag check-water)) - (logior! (-> this enemy-flags) (enemy-flag check-water-backup no-initial-move-to-ground)) + (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> this enemy-flags) (enemy-flag trackable trackable-backup)) (logior! (-> this mask) (process-mask collectable)) - (logior! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logior! (-> this enemy-flags) (enemy-flag attackable-backup)) (set! (-> this hit-points) (-> this enemy-info default-hit-points)) (set! (-> this fated-time) 0) (set! (-> this hit-by-player-count) 0) @@ -384,7 +384,7 @@ ;; definition for method 55 of type citizen ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod track-target! ((this citizen)) +(defmethod common-post ((this citizen)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -399,7 +399,7 @@ (set! (-> s5-0 quad) (-> this danger-pos quad)) ) (when (< (vector-vector-distance s5-0 (-> this root trans)) 122880.0) - (look-at-target! this (enemy-flag lock-focus)) + (look-at-target! this (enemy-flag look-at-focus)) (target-set! (-> this neck) s5-0) ) ) @@ -407,18 +407,18 @@ ) (when (< (-> this stop-time-look-at) (current-time)) (shut-down (-> this neck)) - (set! (-> this next-time-look-at) (+ (current-time) (the int (* 300.0 (get-rand-float-range this 0.0 20.0))))) + (set! (-> this next-time-look-at) (+ (current-time) (the int (* 300.0 (rnd-float-range this 0.0 20.0))))) (set! (-> this stop-time-look-at) - (+ (-> this next-time-look-at) (the int (* 300.0 (get-rand-float-range this 5.0 10.0)))) + (+ (-> this next-time-look-at) (the int (* 300.0 (rnd-float-range this 5.0 10.0)))) ) ) ) ) (let ((a0-18 (-> this enemy-flags))) - (when (and (logtest? a0-18 (enemy-flag attackable-backup)) + (when (and (logtest? a0-18 (enemy-flag auto-reset-penetrate)) (time-elapsed? (-> this auto-reset-penetrate-time) (seconds 0.1)) ) - (set! (-> this enemy-flags) (logclear a0-18 (enemy-flag attackable-backup))) + (set! (-> this enemy-flags) (logclear a0-18 (enemy-flag auto-reset-penetrate))) (set! (-> this root penetrated-by) (get-penetrate-info this)) (let ((v1-50 0)) (if (logtest? (penetrate knocked) (-> this root penetrate-using)) @@ -454,7 +454,7 @@ ) ) ) - (when (logtest? (enemy-flag trackable-backup directed-ready) (-> this enemy-flags)) + (when (logtest? (enemy-flag check-water checking-water) (-> this enemy-flags)) (enemy-method-54 this) (when (and (focus-test? this touch-water) (< (-> this root trans y) (+ -11468.8 (-> this water-surface-height)))) (set! (-> this root trans y) (+ -11468.8 (-> this water-surface-height))) @@ -646,7 +646,7 @@ ) ) ) - (track-target! this) + (common-post this) (update-transforms (-> this root)) 0 (none) @@ -668,9 +668,9 @@ (let ((t9-0 (method-of-type nav-enemy init-enemy-behaviour-and-stats!))) (t9-0 this arg0) ) - (set! (-> this speed-scale) (get-rand-float-range this 0.9 1.1)) + (set! (-> this speed-scale) (rnd-float-range this 0.9 1.1)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (vehicle-controller-method-9 (-> this controller)) (citizen-init! this) (if (zero? (-> this draw light-index)) @@ -1316,7 +1316,12 @@ This commonly includes things such as: (vector-normalize! s5-1 32768.0) (set! (-> s5-1 y) 71680.0) (vector+! s5-1 s5-1 (-> (the-as vehicle s4-0) root transv)) - (send-event this 'attack #f (static-attack-info ((id (new-attack-id)) (vector s5-1) (knock (the-as uint 7))))) + (send-event + this + 'attack + #f + (static-attack-info ((id (new-attack-id)) (vector s5-1) (knock (knocked-type knocked-type-7)))) + ) ) ) ) @@ -1339,7 +1344,7 @@ This commonly includes things such as: (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (set! (-> self wait-time) (the-as time-frame (get-rand-int-range self 300 1500))) + (set! (-> self wait-time) (the-as time-frame (rnd-int-range self 300 1500))) (if (= (-> self water-anim) -1) (go-inactive self) ) @@ -1476,7 +1481,7 @@ This commonly includes things such as: (set! (-> v1-16 target-speed) (* (-> self speed-scale) (-> self speed-walk))) ) 0 - (set! (-> self wait-time) (the-as time-frame (get-rand-int-range self 1200 9000))) + (set! (-> self wait-time) (the-as time-frame (rnd-int-range self 1200 9000))) (when (zero? (-> self controller branch)) (format 0 "citizen has no branch in active enter state~%") (citizen-method-195 self (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) @@ -1499,7 +1504,7 @@ This commonly includes things such as: 0 (when (= (-> self nav state speed) 0.0) (set! (-> self wait-return-state) (the-as (state citizen) (-> self state))) - (set! (-> self wait-time) (the-as time-frame (get-rand-int-range self 300 1500))) + (set! (-> self wait-time) (the-as time-frame (rnd-int-range self 300 1500))) (go-virtual wait) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/civilian_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/civilian_REF.gc index 4089c9dea3..d22fb4b562 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/civilian_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/civilian_REF.gc @@ -201,13 +201,13 @@ (set! (-> this hit-points) (-> this enemy-info default-hit-points)) (set! (-> this hit-points) (rand-vu-int-range 1 4)) (set! (-> this fated-time) 0) - (logior! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logior! (-> this focus-status) (focus-status dangerous)) - (logior! (-> this enemy-flags) (enemy-flag check-water)) - (logior! (-> this enemy-flags) (enemy-flag check-water-backup no-initial-move-to-ground)) + (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> this enemy-flags) (enemy-flag trackable trackable-backup)) (logclear! (-> this focus-status) (focus-status dead)) (logior! (-> this mask) (process-mask collectable)) - (logior! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logior! (-> this enemy-flags) (enemy-flag attackable-backup)) (if (zero? (-> this hit-face)) (go (method-of-object this get-up-front)) (go (method-of-object this get-up-back)) @@ -261,7 +261,7 @@ ) ;; definition for method 108 of type civilian -(defmethod enemy-method-108 ((this civilian) (arg0 enemy) (arg1 event-message-block)) +(defmethod enemy-method-108 ((this civilian) (arg0 process-drawable) (arg1 event-message-block)) 0 ) @@ -552,7 +552,7 @@ ) ) (when (< (-> self cp-next-time) (current-time)) - (set! (-> self cp-next-time) (+ (current-time) (get-rand-int-range self 600 1200))) + (set! (-> self cp-next-time) (+ (current-time) (rnd-int-range self 600 1200))) (citizen-method-190 self (-> self cp-force)) ) (add-offset-to-target! (-> self nav state) (-> self cp-force)) @@ -820,7 +820,7 @@ (set! (-> v1-9 target-speed) (* (-> self speed-scale) (-> self speed-walk))) ) 0 - (set! (-> self next-time) (+ (current-time) (get-rand-int-range self 300 600))) + (set! (-> self next-time) (+ (current-time) (rnd-int-range self 300 600))) (set! (-> self last-second-pos quad) (-> self root trans quad)) (set! (-> self last-distance) (vector-vector-xz-distance (-> self controller turn-exit-point) (-> self root trans)) @@ -949,7 +949,7 @@ (citizen-method-192 self) (when (< (-> self cp-next-time) (current-time)) (citizen-method-190 self (-> self cp-force)) - (set! (-> self cp-next-time) (+ (current-time) (get-rand-int-range self 1200 2400))) + (set! (-> self cp-next-time) (+ (current-time) (rnd-int-range self 1200 2400))) ) (let ((gp-1 (new 'stack-no-clear 'vector))) (citizen-method-188 self gp-1) @@ -1002,7 +1002,7 @@ (set! (-> v1-9 target-speed) (* (-> self speed-scale) (-> self speed-walk))) ) 0 - (set! (-> self cp-next-time) (+ (current-time) (get-rand-int-range self 1200 2400))) + (set! (-> self cp-next-time) (+ (current-time) (rnd-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) @@ -1233,7 +1233,7 @@ ) 0 (if (-> self dive-finished?) - (track-target! self) + (common-post self) (nav-enemy-method-176 self) ) ) @@ -1328,7 +1328,7 @@ (set! (-> a0-0 travel quad) (-> v1-1 quad)) ) 0 - (track-target! self) + (common-post self) ) ) @@ -1380,7 +1380,7 @@ (set! (-> a0-1 travel quad) (-> v1-3 quad)) ) 0 - (track-target! self) + (common-post self) ) ) @@ -1432,14 +1432,14 @@ (set! (-> a0-1 travel quad) (-> v1-3 quad)) ) 0 - (track-target! self) + (common-post self) ) ) ;; definition for function civilian-falling-post ;; INFO: Used lq/sq (defbehavior civilian-falling-post civilian () - (logior! (-> self enemy-flags) (enemy-flag directed)) + (logior! (-> self enemy-flags) (enemy-flag recover-applied-velocity)) (let ((gp-0 (-> self root))) (cond ((focus-test? self under-water) @@ -1461,7 +1461,7 @@ ) ) (enemy-method-111 self) - (track-target! self) + (common-post self) (none) ) @@ -1914,7 +1914,7 @@ (go-virtual ride) ) :post (behavior () - (track-target! self) + (common-post self) ) ) @@ -1985,7 +1985,7 @@ #f ) :post (behavior () - (track-target! self) + (common-post self) ) ) @@ -2135,7 +2135,7 @@ (go-virtual active) ) :post (behavior () - (track-target! self) + (common-post self) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/guard_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/guard_REF.gc index e6f8445282..1515b5f436 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/guard_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/guard_REF.gc @@ -459,7 +459,7 @@ (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)) (set! (-> s0-0 quad) (-> this root trans quad)) (cond - ((logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) (let ((a1-6 s0-0)) (let ((v1-14 s0-0)) (let ((a0-9 s4-0)) @@ -556,12 +556,12 @@ (define *guard-min-id-hack* 255) ;; definition for method 55 of type crimson-guard -(defmethod track-target! ((this crimson-guard)) +(defmethod common-post ((this crimson-guard)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type citizen track-target!))) + (let ((t9-0 (method-of-type citizen common-post))) (t9-0 this) ) (update-transforms (-> this root)) @@ -637,7 +637,7 @@ ) (('combo) (and (not (and (-> this next-state) (= (-> this next-state name) 'inactive))) - (and (not (logtest? (enemy-flag multi-focus) (-> this enemy-flags))) (nonzero? (-> this hit-points))) + (and (not (logtest? (enemy-flag dislike-combo) (-> this enemy-flags))) (nonzero? (-> this hit-points))) ) ) (('avoid) @@ -853,7 +853,7 @@ (set! (-> a0-1 travel quad) (-> v1-3 quad)) ) 0 - (track-target! self) + (common-post self) ) ) @@ -915,7 +915,7 @@ (set! (-> a0-1 travel quad) (-> v1-3 quad)) ) 0 - (track-target! self) + (common-post self) ) ) @@ -972,7 +972,7 @@ ) ;; definition for method 77 of type crimson-guard -(defmethod enemy-method-77 ((this crimson-guard) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this crimson-guard) (arg0 enemy-knocked-info)) (cond ((logtest? (-> this flags) (citizen-flag knocked-out-car)) (ja-channel-push! 1 (seconds 0.1)) @@ -981,7 +981,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 42)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 42)) num-func-seek!) ) @@ -994,7 +994,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 43)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 43)) num-func-seek!) ) @@ -1020,7 +1020,7 @@ ) (set! (-> a0-11 frame-group) (the-as art-joint-anim a1-6)) (set! (-> a0-11 param 0) (the float (+ (-> (the-as art-joint-anim a1-6) frames num-frames) -1))) - (set! (-> a0-11 param 1) (-> arg0 0)) + (set! (-> a0-11 param 1) (-> arg0 anim-speed)) (set! (-> a0-11 frame-num) 0.0) (joint-control-channel-group! a0-11 (the-as art-joint-anim a1-6) num-func-seek!) ) @@ -1031,7 +1031,7 @@ (ja-channel-push! 1 (seconds 0.01)) (cond ((= (-> this small-hit) 1) - (set! (-> this yellow-anim) (the-as uint (get-rand-int this 2))) + (set! (-> this yellow-anim) (the-as uint (rnd-int-count this 2))) (let ((a1-12 (-> this draw art-group @@ -1050,7 +1050,7 @@ ) (set! (-> a0-23 frame-group) (the-as art-joint-anim a1-12)) (set! (-> a0-23 param 0) (the float (+ (-> (the-as art-joint-anim a1-12) frames num-frames) -1))) - (set! (-> a0-23 param 1) (-> arg0 0)) + (set! (-> a0-23 param 1) (-> arg0 anim-speed)) (set! (-> a0-23 frame-num) 0.0) (joint-control-channel-group! a0-23 (the-as art-joint-anim a1-12) num-func-seek!) ) @@ -1061,7 +1061,7 @@ ) (set! (-> a0-27 frame-group) (the-as art-joint-anim a1-13)) (set! (-> a0-27 param 0) (the float (+ (-> (the-as art-joint-anim a1-13) frames num-frames) -1))) - (set! (-> a0-27 param 1) (-> arg0 0)) + (set! (-> a0-27 param 1) (-> arg0 anim-speed)) (set! (-> a0-27 frame-num) 0.0) (joint-control-channel-group! a0-27 (the-as art-joint-anim a1-13) num-func-seek!) ) @@ -1075,7 +1075,7 @@ (set! (-> a0-30 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 10)) frames num-frames) -1)) ) - (set! (-> a0-30 param 1) (-> arg0 0)) + (set! (-> a0-30 param 1) (-> arg0 anim-speed)) (set! (-> a0-30 frame-num) 0.0) (joint-control-channel-group! a0-30 (the-as art-joint-anim (-> this draw art-group data 10)) num-func-seek!) ) @@ -1083,11 +1083,11 @@ (((knocked-type knocked-type-2)) (ja-channel-push! 1 (seconds 0.1)) (let ((a1-17 (-> this draw art-group data (-> this info knocked (-> this hit-face))))) - (set! (-> arg0 0) (* 0.5 (-> arg0 0))) + (set! (-> arg0 anim-speed) (* 0.5 (-> arg0 anim-speed))) (let ((a0-36 (-> this skel root-channel 0))) (set! (-> a0-36 frame-group) (the-as art-joint-anim a1-17)) (set! (-> a0-36 param 0) (the float (+ (-> (the-as art-joint-anim a1-17) frames num-frames) -1))) - (set! (-> a0-36 param 1) (-> arg0 0)) + (set! (-> a0-36 param 1) (-> arg0 anim-speed)) (set! (-> a0-36 frame-num) 0.0) (joint-control-channel-group! a0-36 (the-as art-joint-anim a1-17) num-func-seek!) ) @@ -1100,7 +1100,7 @@ ) (set! (-> a0-41 frame-group) (the-as art-joint-anim a1-19)) (set! (-> a0-41 param 0) (the float (+ (-> (the-as art-joint-anim a1-19) frames num-frames) -1))) - (set! (-> a0-41 param 1) (-> arg0 0)) + (set! (-> a0-41 param 1) (-> arg0 anim-speed)) (set! (-> a0-41 frame-num) 0.0) (joint-control-channel-group! a0-41 (the-as art-joint-anim a1-19) num-func-seek!) ) @@ -1112,7 +1112,7 @@ ) ;; definition for method 78 of type crimson-guard -(defmethod enemy-method-78 ((this crimson-guard) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this crimson-guard) (arg0 enemy-knocked-info)) (cond ((<= (-> this hit-points) 0) (ja-channel-push! 1 (seconds 0.1)) @@ -1121,7 +1121,7 @@ ) (set! (-> a0-5 frame-group) (the-as art-joint-anim a1-2)) (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim a1-2) num-func-seek!) ) @@ -1152,7 +1152,7 @@ ) (set! (-> a0-16 frame-group) (the-as art-joint-anim a1-7)) (set! (-> a0-16 param 0) (the float (+ (-> (the-as art-joint-anim a1-7) frames num-frames) -1))) - (set! (-> a0-16 param 1) (-> arg0 0)) + (set! (-> a0-16 param 1) (-> arg0 anim-speed)) (set! (-> a0-16 frame-num) 0.0) (joint-control-channel-group! a0-16 (the-as art-joint-anim a1-7) num-func-seek!) ) @@ -1165,7 +1165,7 @@ ) (set! (-> a0-20 frame-group) (the-as art-joint-anim a1-8)) (set! (-> a0-20 param 0) (the float (+ (-> (the-as art-joint-anim a1-8) frames num-frames) -1))) - (set! (-> a0-20 param 1) (-> arg0 0)) + (set! (-> a0-20 param 1) (-> arg0 anim-speed)) (set! (-> a0-20 frame-num) 0.0) (joint-control-channel-group! a0-20 (the-as art-joint-anim a1-8) num-func-seek!) ) @@ -1180,7 +1180,7 @@ (set! (-> a0-23 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 11)) frames num-frames) -1)) ) - (set! (-> a0-23 param 1) (-> arg0 0)) + (set! (-> a0-23 param 1) (-> arg0 anim-speed)) (set! (-> a0-23 frame-num) 0.0) (joint-control-channel-group! a0-23 (the-as art-joint-anim (-> this draw art-group data 11)) num-func-seek!) ) @@ -1190,11 +1190,11 @@ (else (ja-channel-push! 1 (seconds 0.1)) (let ((a1-12 (-> this draw art-group data (-> this info knocked-land (-> this hit-face))))) - (set! (-> arg0 0) 1.0) + (set! (-> arg0 anim-speed) 1.0) (let ((a0-28 (-> this skel root-channel 0))) (set! (-> a0-28 frame-group) (the-as art-joint-anim a1-12)) (set! (-> a0-28 param 0) (the float (+ (-> (the-as art-joint-anim a1-12) frames num-frames) -1))) - (set! (-> a0-28 param 1) (-> arg0 0)) + (set! (-> a0-28 param 1) (-> arg0 anim-speed)) (set! (-> a0-28 frame-num) 0.0) (joint-control-channel-group! a0-28 (the-as art-joint-anim a1-12) num-func-seek!) ) @@ -1428,7 +1428,7 @@ (let ((v1-3 (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 3))) (logclear! (-> v1-3 prim-core action) (collide-action deadly)) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1601,8 +1601,8 @@ (init-vf0-vector) (cond ((logtest? (-> this controller traffic alert-state flags) (traffic-alert-flag guard-multi-focus)) - (logior! (-> this enemy-flags) (enemy-flag trackable)) - (when (not (logtest? (enemy-flag actor-pause-backup) (-> this enemy-flags))) + (logior! (-> this enemy-flags) (enemy-flag multi-focus)) + (when (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) (let ((a0-4 (find-closest-to-with-collide-lists (-> this controller traffic) this (-> this focus collide-with)))) (if a0-4 (set! (-> this traffic-target-status handle) (process->handle a0-4)) @@ -1612,8 +1612,8 @@ ) ) (else - (when (logtest? (enemy-flag trackable) (-> this enemy-flags)) - (logclear! (-> this enemy-flags) (enemy-flag trackable)) + (when (logtest? (enemy-flag multi-focus) (-> this enemy-flags)) + (logclear! (-> this enemy-flags) (enemy-flag multi-focus)) (let* ((s5-0 (handle->process (-> this traffic-target-status handle))) (v1-21 (if (type? s5-0 process-focusable) s5-0 @@ -2013,7 +2013,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 (time-elapsed? (-> self state-time) (the int (* 300.0 (get-rand-float-range self 1.0 3.0)))) + (if (and (time-elapsed? (-> self state-time) (the int (* 300.0 (rnd-float-range self 1.0 3.0)))) (logtest? (-> self flags) (citizen-flag target-in-sight)) ) (go-virtual gun-shoot) @@ -2114,7 +2114,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let ((v1-4 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-4 enemy-flags))) @@ -2143,8 +2143,8 @@ (let ((v1-3 (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 3))) (logclear! (-> v1-3 prim-core action) (collide-action deadly)) ) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -2179,7 +2179,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (set! (-> self other-side) (if (< (rand-vu) 0.5) #t #f @@ -2220,7 +2220,7 @@ ) :exit (behavior () (set! (-> self joint-enable) #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () (crimson-guard-method-220 self) @@ -2256,7 +2256,7 @@ (local-vars (v1-35 object)) (speech-control-method-12 *speech-control* self (speech-type speech-type-9)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self anim-shoot 0 anim-index)) :num! (seek! max f30-0) :frame-num 0.0 @@ -2323,7 +2323,7 @@ #f ) (label cfg-40) - (let ((f30-1 (get-rand-float-range self 0.9 1.1))) + (let ((f30-1 (rnd-float-range self 0.9 1.1))) (ja-channel-push! 1 (seconds 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self anim-shoot 2 anim-index)) :num! (seek! max f30-1) @@ -2422,7 +2422,7 @@ 0 (ja-channel-push! 1 (seconds 0.1)) (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-right-ja :num! (seek! (ja-aframe 6.0 0)) :frame-num (ja-aframe 0.0 0)) (until (ja-done? 0) (let ((a0-20 (handle->process (-> self focus handle)))) @@ -2463,7 +2463,7 @@ ) 0 (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-right-ja :num! (seek! (ja-aframe 11.0 0)) :frame-num (ja-aframe 6.0 0)) (until (ja-done? 0) (suspend) @@ -2522,7 +2522,7 @@ 0 (ja-channel-push! 1 (seconds 0.1)) (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-left-ja :num! (seek! (ja-aframe 9.0 0)) :frame-num (ja-aframe 0.0 0)) (until (ja-done? 0) (let ((a0-20 (handle->process (-> self focus handle)))) @@ -2563,7 +2563,7 @@ ) 0 (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-left-ja :num! (seek! (ja-aframe 11.0 0)) :frame-num (ja-aframe 9.0 0)) (until (ja-done? 0) (suspend) @@ -2588,7 +2588,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (nav-enemy-method-167 self) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) @@ -2615,7 +2615,7 @@ ) :exit (behavior () (set! (-> self joint-enable) #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () (crimson-guard-method-220 self) @@ -2624,7 +2624,7 @@ :code (behavior () (speech-control-method-12 *speech-control* self (speech-type speech-type-13)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! crimson-guard-idle-to-stab-idle-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) (seek-toward-heading-vec! (-> self root) (-> self target-self-xz) 65536.0 (seconds 0.02)) @@ -2647,7 +2647,7 @@ ) #f (label cfg-17) - (let ((f30-1 (get-rand-float-range self 0.9 1.1))) + (let ((f30-1 (rnd-float-range self 0.9 1.1))) (ja-channel-push! 1 (seconds 0.2)) (ja-no-eval :group! crimson-guard-stab-idle-to-idle-ja :num! (seek! max f30-1) :frame-num 0.0) (until (ja-done? 0) @@ -2669,7 +2669,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (nav-enemy-method-167 self) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) @@ -2695,7 +2695,7 @@ ) :exit (behavior () (set! (-> self joint-enable) #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () (crimson-guard-method-220 self) @@ -2705,7 +2705,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! crimson-guard-idle-to-stab-idle-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -2719,7 +2719,7 @@ (ja :num! (seek!)) ) ) - (let ((f30-1 (get-rand-float-range self 0.9 1.1))) + (let ((f30-1 (rnd-float-range self 0.9 1.1))) (ja-channel-push! 1 (seconds 0.2)) (ja-no-eval :group! crimson-guard-stab-idle-to-idle-ja :num! (seek! max f30-1) :frame-num 0.0) (until (ja-done? 0) @@ -3133,7 +3133,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (set! (-> self joint-enable) #t) (logior! (-> self focus-status) (focus-status dangerous)) (let ((v1-5 self)) @@ -3177,8 +3177,8 @@ (set! (-> v1-5 state mode) (the-as lightning-mode a0-2)) ) (set! (-> self joint-enable) #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -3225,7 +3225,7 @@ (if (< (the-as degrees f0-6) 0.0) (set! f30-0 (- f30-0)) ) - (if (logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + (if (logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (set! f0-6 (- (the-as degrees f0-6))) ) (cond @@ -3748,7 +3748,9 @@ (ja :num! (loop! f30-0)) ) ) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 0 (-> self event-param-point)) (until #f (suspend) @@ -3965,7 +3967,7 @@ (set! (-> this fact pickup-amount) 10.0) (set! (-> this fact pickup-spawn-amount) 1.0) (set! (-> this traffic-target-status handle) (the-as handle #f)) - (let ((v1-24 (get-rand-int this 2))) + (let ((v1-24 (rnd-int-count this 2))) (cond ((zero? v1-24) (set! (-> this anim-shoot 0 anim-index) 19) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-flitter_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-flitter_REF.gc index d9e7fcbecd..06c23232ef 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-flitter_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-flitter_REF.gc @@ -222,7 +222,7 @@ ) ;; definition for method 77 of type metalhead-flitter -(defmethod enemy-method-77 ((this metalhead-flitter) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this metalhead-flitter) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (let ((a0-2 (-> this skel root-channel 0))) @@ -230,7 +230,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 20)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 20)) num-func-seek!) ) @@ -265,7 +265,7 @@ ) ;; definition for method 78 of type metalhead-flitter -(defmethod enemy-method-78 ((this metalhead-flitter) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this metalhead-flitter) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -299,8 +299,8 @@ (defstate ambush (metalhead-flitter) :virtual #t :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -414,7 +414,7 @@ (+! (-> self root trans y) -8192.0) (logior! (-> self draw status) (draw-control-status no-draw)) (let ((gp-3 (current-time))) - (until (time-elapsed? gp-3 (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) + (until (time-elapsed? gp-3 (the int (* 300.0 (rnd-float-range self 0.0 0.6)))) (suspend) ) ) @@ -440,11 +440,11 @@ (set! (-> v1-3 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-3 enemy-flags)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set-time! (-> self state-time)) (let ((gp-0 (-> self root))) (vector-reset! (-> gp-0 transv)) - (set! (-> gp-0 transv y) (* 4096.0 (get-rand-float-range self 34.0 38.0))) + (set! (-> gp-0 transv y) (* 4096.0 (rnd-float-range self 34.0 38.0))) ) ) :code (behavior () @@ -676,7 +676,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (until #f (when (not (enemy-method-96 self 2730.6667 #t)) (let ((v1-5 self)) @@ -814,7 +814,7 @@ ) :exit (behavior () (metalhead-flitter-method-208 self #f) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -884,11 +884,11 @@ 0 (ja-channel-push! 1 (seconds 0.1)) (metalhead-flitter-method-208 self #f) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) - (dotimes (gp-1 (get-rand-int self 3)) + (dotimes (gp-1 (rnd-int-count self 3)) (ja-no-eval :group! flitter-idle-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -914,7 +914,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (until #f (when (not (enemy-method-96 self 2730.6667 #t)) (let ((v1-5 self)) @@ -1025,12 +1025,12 @@ (ja-channel-push! 1 (seconds 0.2)) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info run-anim)) - :num! (seek! max (get-rand-float-range self 0.9 1.1)) + :num! (seek! max (rnd-float-range self 0.9 1.1)) :frame-num 0.0 ) (until (ja-done? 0) (suspend) - (ja :num! (seek! max (get-rand-float-range self 0.9 1.1))) + (ja :num! (seek! max (rnd-float-range self 0.9 1.1))) ) ) #f diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-grunt_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-grunt_REF.gc index 3076abaf3b..b507b2127d 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-grunt_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-grunt_REF.gc @@ -285,15 +285,15 @@ (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (cond @@ -306,7 +306,7 @@ ) ) ) - (zero? (get-rand-int this 3)) + (zero? (rnd-int-count this 3)) (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) (f1-0 32768.0) ) @@ -358,8 +358,8 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -435,7 +435,9 @@ (until #f (let ((gp-0 (new 'stack-no-clear 'vector))) (get-point-in-path! (-> self intro-path) gp-0 1.0 'interp) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (let ((v1-5 (process->ppointer self))) (set! (-> a1-1 from) v1-5) @@ -469,7 +471,9 @@ (until #f (let ((gp-0 (new 'stack-no-clear 'vector))) (get-point-in-path! (-> self intro-path) gp-0 (the float (-> self jumping-ambush-path-pt)) 'interp) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (let ((v1-9 (process->ppointer self))) (set! (-> a1-1 from) v1-9) @@ -506,15 +510,15 @@ ) ) ) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f - (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (get-rand-int self 4))) + (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (rnd-int-count self 4))) (let ((v1-28 (-> self nav))) (set! (-> v1-28 target-speed) (-> self patrol-anim travel-speed)) ) 0 (let ((gp-0 (-> self draw art-group data (-> self patrol-anim anim-index))) - (s5-0 (get-rand-int-range self 1 8)) + (s5-0 (rnd-int-range self 1 8)) ) (let ((v1-37 (ja-group))) (if (not (and v1-37 (= v1-37 gp-0))) @@ -538,7 +542,7 @@ ) 0 (let ((gp-1 (-> self draw art-group data (-> self patrol-anim anim-index))) - (s5-1 (get-rand-int-range self 2 5)) + (s5-1 (rnd-int-range self 2 5)) ) (ja-no-eval :group! gp-1 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -555,7 +559,7 @@ ) ) ) - (when (zero? (get-rand-int self 3)) + (when (zero? (rnd-int-count self 3)) (let ((v1-107 self)) (set! (-> v1-107 enemy-flags) (the-as enemy-flag (logclear (-> v1-107 enemy-flags) (enemy-flag enemy-flag36))) @@ -573,7 +577,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (until (not (enemy-method-123 self 0.2)) + (until (not (rnd-go-idle? self 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -670,7 +674,7 @@ ) ) (sound-play "grunt-warn") - (set! (-> self next-warn-time) (+ gp-0 (get-rand-int-range self 300 360))) + (set! (-> self next-warn-time) (+ gp-0 (rnd-int-range self 300 360))) ) ) ) @@ -689,7 +693,7 @@ ) ) ) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (let ((v1-19 (-> self use-charge-anim-index))) (cond ((>= v1-19 0) @@ -697,7 +701,7 @@ (set! (-> self use-charge-anim-index) -1) ) (else - (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (get-rand-int self 3))) + (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (rnd-int-count self 3))) ) ) ) @@ -735,7 +739,7 @@ (set! (-> v1-1 speed) (-> self enemy-info run-travel-speed)) ) 0 - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (set! (-> self root penetrate-using) (penetrate generic-attack lunge)) (enemy-method-49 self) @@ -758,21 +762,21 @@ ) (t9-0 a0-0) ) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () (enemy-method-49 self) - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "grunt-hit") ) ) :code (behavior () - (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (get-rand-int self 2))) + (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (rnd-int-count self 2))) (let ((v1-5 (-> self nav))) (set! (-> v1-5 target-speed) (-> self attack-anim travel-speed)) ) @@ -782,7 +786,7 @@ ) 0 (let ((gp-0 (-> self draw art-group data (-> self attack-anim anim-index))) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (let ((v1-17 (ja-group))) (if (not (and v1-17 (= v1-17 gp-0))) @@ -838,7 +842,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (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*) @@ -875,22 +879,22 @@ ) (t9-0 a0-0) ) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "grunt-hit") ) ) :code (behavior () - (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (get-rand-int self 2))) + (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (rnd-int-count self 2))) (let ((gp-0 (-> self draw art-group data (-> self attack-anim anim-index))) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (let ((v1-13 (ja-group))) (if (not (and v1-13 (= v1-13 gp-0))) @@ -928,12 +932,12 @@ (suspend) (ja-eval) ) - (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (get-rand-int self 4))) + (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (rnd-int-count self 4))) (let ((v1-14 (-> self nav))) (set! (-> v1-14 target-speed) (-> self patrol-anim travel-speed)) ) 0 - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self patrol-anim anim-index))) ) (let ((v1-24 (ja-group))) @@ -954,7 +958,7 @@ ) ;; definition for method 77 of type metalhead-grunt -(defmethod enemy-method-77 ((this metalhead-grunt) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this metalhead-grunt) (arg0 enemy-knocked-info)) (local-vars (v1-72 int) (a2-3 int) (a2-5 int)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) @@ -974,10 +978,10 @@ (set! a2-3 (logior v1-2 8)) ) ) - (let ((s4-0 (enemy-method-120 this 4 a2-3))) + (let ((s4-0 (rnd-bit this 4 a2-3))) (set! (-> *grunt-global-info* prev-yellow-hit-anim-index) s4-0) (set! (-> this yellow-hit-anim) (-> *grunt-global-info* yellow-hit-anim s4-0)) - (let ((v1-11 (get-rand-int this 3))) + (let ((v1-11 (rnd-int-count this 3))) (if (= s4-0 3) (set! v1-11 2) ) @@ -989,7 +993,7 @@ (let ((a0-19 (-> this skel root-channel 0))) (set! (-> a0-19 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-19 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-19 param 1) (-> arg0 0)) + (set! (-> a0-19 param 1) (-> arg0 anim-speed)) (set! (-> a0-19 frame-num) 0.0) (joint-control-channel-group! a0-19 (the-as art-joint-anim s4-1) num-func-seek!) ) @@ -1036,7 +1040,7 @@ (set! a2-5 (logior v1-42 7)) ) ) - (let ((v1-46 (enemy-method-120 this 6 a2-5))) + (let ((v1-46 (rnd-bit this 6 a2-5))) (set! (-> *grunt-global-info* prev-blue-hit-anim-index) v1-46) (set! (-> this blue-hit-anim) (-> *grunt-global-info* blue-hit-anim v1-46)) ) @@ -1047,7 +1051,7 @@ (set! a2-6 (logior a2-6 4)) ) ) - (set! (-> this use-charge-anim-index) (enemy-method-120 this 3 a2-6)) + (set! (-> this use-charge-anim-index) (rnd-bit this 3 a2-6)) ) ) (let ((a1-26 (-> this draw art-group data (-> this blue-hit-anim anim-index))) @@ -1055,7 +1059,7 @@ ) (set! (-> a0-51 frame-group) (the-as art-joint-anim a1-26)) (set! (-> a0-51 param 0) (the float (+ (-> (the-as art-joint-anim a1-26) frames num-frames) -1))) - (set! (-> a0-51 param 1) (-> arg0 0)) + (set! (-> a0-51 param 1) (-> arg0 anim-speed)) (set! (-> a0-51 frame-num) 0.0) (joint-control-channel-group! a0-51 (the-as art-joint-anim a1-26) num-func-seek!) ) @@ -1076,7 +1080,7 @@ (set! s4-3 (logior s4-3 4)) ) ) - (set! v1-72 (enemy-method-120 this 3 s4-3)) + (set! v1-72 (rnd-bit this 3 s4-3)) ) ) ) @@ -1088,7 +1092,7 @@ (let ((a0-68 (-> this skel root-channel 0))) (set! (-> a0-68 frame-group) (the-as art-joint-anim s4-4)) (set! (-> a0-68 param 0) (the float (+ (-> (the-as art-joint-anim s4-4) frames num-frames) -1))) - (set! (-> a0-68 param 1) (-> arg0 0)) + (set! (-> a0-68 param 1) (-> arg0 anim-speed)) (set! (-> a0-68 frame-num) 0.0) (joint-control-channel-group! a0-68 (the-as art-joint-anim s4-4) num-func-seek!) ) @@ -1099,7 +1103,7 @@ ) ;; definition for method 78 of type metalhead-grunt -(defmethod enemy-method-78 ((this metalhead-grunt) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this metalhead-grunt) (arg0 enemy-knocked-info)) (cond ((= (-> this incoming knocked-type) (knocked-type knocked-type-6)) (when (or (logtest? (-> this grunt-flags) 2) (let ((v1-7 (if (> (-> this skel active-channels) 0) @@ -1121,7 +1125,7 @@ (let ((a0-16 (-> this skel root-channel 0))) (set! (-> a0-16 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-16 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-16 param 1) (-> arg0 0)) + (set! (-> a0-16 param 1) (-> arg0 anim-speed)) (set! (-> a0-16 frame-num) 0.0) (joint-control-channel-group! a0-16 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -1142,7 +1146,7 @@ ) (set! (-> a0-23 frame-group) (the-as art-joint-anim a1-6)) (set! (-> a0-23 param 0) (the float (+ (-> (the-as art-joint-anim a1-6) frames num-frames) -1))) - (set! (-> a0-23 param 1) (-> arg0 0)) + (set! (-> a0-23 param 1) (-> arg0 anim-speed)) (set! (-> a0-23 frame-num) 0.0) (joint-control-channel-group! a0-23 (the-as art-joint-anim a1-6) num-func-seek!) ) @@ -1160,7 +1164,7 @@ (let ((s5-0 (handle->process (-> self focus handle)))) (when s5-0 (let ((gp-0 (get-trans (the-as process-focusable s5-0) 0))) - (when (and (or (not (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice))) + (when (and (or (not (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance))) (>= 163840.0 (vector-vector-distance (-> self root trans) gp-0)) ) (or (not (logtest? (-> self fact enemy-options) (enemy-option user8))) @@ -1171,7 +1175,7 @@ ) (cond ((and (logtest? (-> self fact enemy-options) (enemy-option user9)) - (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance)) ) (let ((s5-1 (new 'stack-no-clear 'vector))) (vector-! s5-1 gp-0 (-> self root trans)) @@ -1340,15 +1344,15 @@ 0 (set-gravity-length (-> this root dynam) 573440.0) (let ((s5-2 *grunt-global-info*)) - (set! (-> this patrol-anim) (-> s5-2 patrol-anim (get-rand-int this 4))) - (set! (-> this charge-anim) (-> s5-2 charge-anim (get-rand-int this 3))) - (set! (-> this attack-anim) (-> s5-2 attack-anim (get-rand-int this 2))) + (set! (-> this patrol-anim) (-> s5-2 patrol-anim (rnd-int-count this 4))) + (set! (-> this charge-anim) (-> s5-2 charge-anim (rnd-int-count this 3))) + (set! (-> this attack-anim) (-> s5-2 attack-anim (rnd-int-count this 2))) ) (set! (-> this use-charge-anim-index) -1) - (if (zero? (get-rand-int this 2)) + (if (zero? (rnd-int-count this 2)) (logior! (-> this grunt-flags) 1) ) - (if (zero? (get-rand-int this 2)) + (if (zero? (rnd-int-count this 2)) (logior! (-> this grunt-flags) 4) ) (set! (-> this intro-path) (new 'process 'path-control this 'intro 0.0 (the-as entity #f) #t)) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-predator_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-predator_REF.gc index f93b70f77e..64172112ba 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-predator_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-predator_REF.gc @@ -423,12 +423,12 @@ ) ;; definition for method 55 of type metalhead-predator -(defmethod track-target! ((this metalhead-predator)) +(defmethod common-post ((this metalhead-predator)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type citizen-enemy track-target!))) + (let ((t9-0 (method-of-type citizen-enemy common-post))) (t9-0 this) ) (metalhead-predator-method-208 this) @@ -449,7 +449,7 @@ ) (('combo) (and (not (and (-> this next-state) (= (-> this next-state name) 'inactive))) - (and (not (logtest? (enemy-flag multi-focus) (-> this enemy-flags))) (nonzero? (-> this hit-points))) + (and (not (logtest? (enemy-flag dislike-combo) (-> this enemy-flags))) (nonzero? (-> this hit-points))) ) ) (else @@ -459,7 +459,7 @@ ) ;; definition for method 77 of type metalhead-predator -(defmethod enemy-method-77 ((this metalhead-predator) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this metalhead-predator) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (case (-> this incoming knocked-type) @@ -470,7 +470,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 18)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 18)) num-func-seek!) ) @@ -482,7 +482,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 14)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 14)) num-func-seek!) ) @@ -494,7 +494,7 @@ (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (ja-channel-push! 1 (seconds 0.01)) - (let ((v1-32 (get-rand-int this 2))) + (let ((v1-32 (rnd-int-count this 2))) (cond ((zero? v1-32) (let ((a0-10 (-> this skel root-channel 0))) @@ -502,7 +502,7 @@ (set! (-> a0-10 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 21)) frames num-frames) -1)) ) - (set! (-> a0-10 param 1) (-> arg0 0)) + (set! (-> a0-10 param 1) (-> arg0 anim-speed)) (set! (-> a0-10 frame-num) 0.0) (joint-control-channel-group! a0-10 (the-as art-joint-anim (-> this draw art-group data 21)) num-func-seek!) ) @@ -513,7 +513,7 @@ (set! (-> a0-12 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 22)) frames num-frames) -1)) ) - (set! (-> a0-12 param 1) (-> arg0 0)) + (set! (-> a0-12 param 1) (-> arg0 anim-speed)) (set! (-> a0-12 frame-num) 0.0) (joint-control-channel-group! a0-12 (the-as art-joint-anim (-> this draw art-group data 22)) num-func-seek!) ) @@ -528,7 +528,7 @@ (set! (-> a0-15 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 18)) frames num-frames) -1)) ) - (set! (-> a0-15 param 1) (-> arg0 0)) + (set! (-> a0-15 param 1) (-> arg0 anim-speed)) (set! (-> a0-15 frame-num) 0.0) (joint-control-channel-group! a0-15 (the-as art-joint-anim (-> this draw art-group data 18)) num-func-seek!) ) @@ -540,7 +540,7 @@ (set! (-> a0-17 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 12)) frames num-frames) -1)) ) - (set! (-> a0-17 param 1) (-> arg0 0)) + (set! (-> a0-17 param 1) (-> arg0 anim-speed)) (set! (-> a0-17 frame-num) 0.0) (joint-control-channel-group! a0-17 (the-as art-joint-anim (-> this draw art-group data 12)) num-func-seek!) ) @@ -552,7 +552,7 @@ ) ;; definition for method 78 of type metalhead-predator -(defmethod enemy-method-78 ((this metalhead-predator) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this metalhead-predator) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (case (-> this incoming knocked-type) @@ -563,7 +563,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 20)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 20)) num-func-seek!) ) @@ -575,7 +575,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 15)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 15)) num-func-seek!) ) @@ -592,7 +592,7 @@ (set! (-> a0-8 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 23)) frames num-frames) -1)) ) - (set! (-> a0-8 param 1) (-> arg0 0)) + (set! (-> a0-8 param 1) (-> arg0 anim-speed)) (set! (-> a0-8 frame-num) 0.0) (joint-control-channel-group! a0-8 (the-as art-joint-anim (-> this draw art-group data 23)) num-func-seek!) ) @@ -604,7 +604,7 @@ (set! (-> a0-11 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 19)) frames num-frames) -1)) ) - (set! (-> a0-11 param 1) (-> arg0 0)) + (set! (-> a0-11 param 1) (-> arg0 anim-speed)) (set! (-> a0-11 frame-num) 0.0) (joint-control-channel-group! a0-11 (the-as art-joint-anim (-> this draw art-group data 19)) num-func-seek!) ) @@ -616,7 +616,7 @@ (set! (-> a0-13 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 13)) frames num-frames) -1)) ) - (set! (-> a0-13 param 1) (-> arg0 0)) + (set! (-> a0-13 param 1) (-> arg0 anim-speed)) (set! (-> a0-13 frame-num) 0.0) (joint-control-channel-group! a0-13 (the-as art-joint-anim (-> this draw art-group data 13)) num-func-seek!) ) @@ -841,7 +841,7 @@ (t9-0) ) ) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () (let ((t9-0 (-> (method-of-type citizen-enemy active) trans))) @@ -864,7 +864,7 @@ (set! (-> self want-stop) #f) (set-time! (-> self state-time)) (set! (-> self next-change) (the-as int (+ (current-time) (the int (* 300.0 (rand-vu-float-range 4.0 8.0)))))) - (if (zero? (get-rand-int self 3)) + (if (zero? (rnd-int-count self 3)) (sound-play "pred-talk") ) ) @@ -929,10 +929,10 @@ (set! (-> self attack-id) a0-1) ) (traffic-danger-init! self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -997,7 +997,7 @@ :event enemy-event-handler :enter (behavior () (traffic-danger-init! self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (set! (-> self root penetrate-using) (penetrate generic-attack lunge)) (enemy-method-49 self) @@ -1014,8 +1014,8 @@ ) :exit (behavior () (metalhead-predator-method-205 self #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1045,7 +1045,7 @@ (suspend) (ja :num! (seek!)) ) - (if (zero? (get-rand-int self 3)) + (if (zero? (rnd-int-count self 3)) (sound-play "pred-talk") ) (go-hostile self) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/traffic-engine_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/traffic-engine_REF.gc index 7aacbea467..7bf6d72eec 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/traffic-engine_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/traffic-engine_REF.gc @@ -2831,7 +2831,7 @@ Process is recycled and moved to reserved, if it deactivates." ) ) ) - (let ((v1-42 (-> s0-0 stack 860))) + (let ((v1-42 (-> (the-as crimson-guard s0-0) guard-type))) (when (< v1-42 (the-as uint 6)) (+! s2-0 1) (+! (-> this alert-state guard-type-info-array v1-42 count) 1) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-guard_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-guard_REF.gc index c46a0e5a2c..c203c6dc6b 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-guard_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-guard_REF.gc @@ -647,13 +647,15 @@ (deftype vehicle-guard (vehicle) ((ai-hook (function vehicle-guard none)) (turret turret-control :inline) - (target-flags turret-flag) + (target-flags traffic-target-flag) (target-in-sight-time time-frame) (minimap connection-minimap) (vehicle-guard-pad-k1jn23k1 uint32) (traffic-target-status traffic-target-status) (pursuit-target handle) - (vehicle-guard-pad-1kjh2nb3k1 uint32 16) + (vehicle-guard-pad-0jkfdjslf uint32 4) + (vehicle-guard-vector0341413 vector :inline) + (vehicle-guard-pad-1kjh2nb3k1 uint32 8) (lod2 symbol) ) (:state-methods @@ -690,19 +692,19 @@ (format #t "~2Tturret: #~%" (-> this turret)) (format #t "~2Ttarget-flags: #x~X : (traffic-target-flag " (-> this target-flags)) (let ((s5-0 (-> this target-flags))) - (if (= (logand s5-0 (turret-flag firing)) (turret-flag firing)) + (if (= (logand s5-0 (traffic-target-flag visible-now)) (traffic-target-flag visible-now)) (format #t "visible-now ") ) - (if (= (logand s5-0 (turret-flag should-shoot)) (turret-flag should-shoot)) + (if (= (logand s5-0 (traffic-target-flag visible-ever)) (traffic-target-flag visible-ever)) (format #t "visible-ever ") ) - (if (= (logand s5-0 (turret-flag display-marks)) (turret-flag display-marks)) + (if (= (logand s5-0 (traffic-target-flag force-visible)) (traffic-target-flag force-visible)) (format #t "force-visible ") ) - (if (= (logand s5-0 (turret-flag aiming)) (turret-flag aiming)) + (if (= (logand s5-0 (traffic-target-flag visible-recently)) (traffic-target-flag visible-recently)) (format #t "visible-recently ") ) - (if (= (logand s5-0 (turret-flag targetting-laser)) (turret-flag targetting-laser)) + (if (= (logand s5-0 (traffic-target-flag updated)) (traffic-target-flag updated)) (format #t "updated ") ) ) @@ -845,7 +847,7 @@ (set-time! (-> this target-in-sight-time)) ) ) - (set! (-> this target-flags) (the-as turret-flag (-> v1-4 flags))) + (set! (-> this target-flags) (-> v1-4 flags)) ) ) (when (not (logtest? (rigid-body-object-flag in-pursuit) (-> this flags))) @@ -1052,7 +1054,7 @@ ;; definition for function vehicle-guard-choose-branch ;; INFO: Used lq/sq -(defun vehicle-guard-choose-branch ((arg0 vehicle-controller) (arg1 vehicle)) +(defun vehicle-guard-choose-branch ((arg0 vehicle-controller) (arg1 vehicle-guard)) (let ((gp-0 (the-as nav-branch #f))) (cond ((logtest? (rigid-body-object-flag alert) (-> arg1 flags)) @@ -1061,7 +1063,7 @@ ) (set! (-> s4-0 4 x) -10000000000000000000000000000000000000.0) (set! (-> s4-0 3 quad) (-> arg1 root trans quad)) - (vector-! (-> s4-0 0) (-> s4-0 3) (the-as vector (&-> arg1 stack 896))) + (vector-! (-> s4-0 0) (-> s4-0 3) (-> arg1 vehicle-guard-vector0341413)) (vector-normalize! (-> s4-0 0) 1.0) (dotimes (s3-0 (-> s5-0 branch-count)) (let ((s2-0 (-> s5-0 branch-array s3-0))) @@ -1253,7 +1255,7 @@ (vehicle-method-121 this) (vehicle-method-106 this) (when (not (logtest? (rigid-body-object-flag in-pursuit) (-> this flags))) - (if (not (logtest? (-> this target-flags) (turret-flag aiming))) + (if (not (logtest? (-> this target-flags) (traffic-target-flag visible-recently))) (speech-control-method-12 *speech-control* this (speech-type speech-type-2)) ) (go (method-of-object this active)) diff --git a/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash-states_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash-states_REF.gc index ce21089a8a..5ecf9e5ba5 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash-states_REF.gc @@ -17,7 +17,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -107,7 +107,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) (logclear! (-> self bot-flags) (bot-flags bf21)) ) @@ -247,7 +247,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) (logclear! (-> self bot-flags) (bot-flags bf21)) ) @@ -395,7 +395,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -456,14 +456,14 @@ ) 0 (nav-enemy-method-167 self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (if (not (handle->process (-> self focus handle))) (react-to-focus self) ) (set! (-> self travel-anim-interp) 0.0) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :code (behavior () (bot-method-223 self #t) @@ -489,10 +489,10 @@ ) (cond ((logtest? (-> self bot-flags) (bot-flags attacked)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (reset-attacker! self) ) - ((logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + ((logtest? (-> self enemy-flags) (enemy-flag victory)) (ashelin-method-245 self) ) ) @@ -662,7 +662,7 @@ ) 0 (nav-enemy-method-167 self) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -785,7 +785,7 @@ ) 0 (nav-enemy-method-167 self) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -908,7 +908,7 @@ ) 0 (nav-enemy-method-167 self) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -947,29 +947,29 @@ ) :code (behavior () (local-vars (v1-7 enemy-flag) (v1-15 enemy-flag)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-6 (-> self enemy-flags))) - (if (logtest? v1-6 (enemy-flag checking-water)) - (set! v1-7 (logior v1-6 (enemy-flag enable-on-active))) - (set! v1-7 (logclear v1-6 (enemy-flag enable-on-active))) + (if (logtest? v1-6 (enemy-flag vulnerable-backup)) + (set! v1-7 (logior v1-6 (enemy-flag vulnerable))) + (set! v1-7 (logclear v1-6 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-7) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-14 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-14) - (set! v1-15 (logior (enemy-flag check-water-backup) v1-14)) - (set! v1-15 (logclear v1-14 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-14) + (set! v1-15 (logior (enemy-flag trackable) v1-14)) + (set! v1-15 (logclear v1-14 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-15) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) @@ -1019,7 +1019,7 @@ (set! (-> self travel-anim-interp) 0.0) ) :code (behavior () - (let ((v1-1 (get-rand-int self 3))) + (let ((v1-1 (rnd-int-count self 3))) (cond ((zero? v1-1) (play-death-sound self "asha057") @@ -1049,7 +1049,7 @@ ) ) ) - (f30-0 (get-rand-float-range self 0.8 1.2)) + (f30-0 (rnd-float-range self 0.8 1.2)) ) (ja-no-eval :group! gp-0 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) diff --git a/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash-task_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash-task_REF.gc new file mode 100644 index 0000000000..ab7a12229d --- /dev/null +++ b/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash-task_REF.gc @@ -0,0 +1,80 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 9 of type asht-wait-spot +;; WARN: Return type mismatch int vs none. +(defmethod reset-task! ((this asht-wait-spot)) + (set! (-> this check-done) #f) + (set! (-> this which-spot) -1) + (set! (-> this num-spots) (the-as uint 0)) + 0 + (none) + ) + +;; definition for method 11 of type asht-wait-spot +(defmethod ai-task-method-11 ((this asht-wait-spot) (arg0 bot)) + (let ((s4-0 (-> this which-spot))) + (when (>= s4-0 0) + (let ((s3-0 (-> arg0 course spots (-> this spot-indexes s4-0)))) + (if (and (not (outside-spot-radius? arg0 s3-0 (the-as vector #f) #f)) (player-blocking-spot? arg0 s3-0)) + (set! s4-0 -1) + ) + ) + ) + (when (< s4-0 0) + (set! s4-0 (choose-spot arg0 (the-as int (-> this num-spots)) (the-as (pointer uint) (-> this spot-indexes)))) + (set! (-> this which-spot) s4-0) + (mem-copy! + (the-as pointer (-> arg0 spot)) + (the-as pointer (-> arg0 course spots (-> this spot-indexes s4-0))) + 20 + ) + ) + (if (logtest? *display-bot-marks* (bot-marks-controls bmc16)) + (bot-debug-draw-spot-sphere + arg0 + (the-as int (-> this num-spots)) + (the-as (pointer uint) (-> this spot-indexes)) + (the-as int (-> this spot-indexes s4-0)) + ) + ) + ) + (when (not ((-> this check-done) this (the-as ashelin arg0))) + (let ((a1-10 (handle->process (-> arg0 focus handle)))) + (when (and a1-10 + (attacked-by-player? arg0 (the-as process-focusable a1-10)) + (not (logtest? (-> arg0 focus-status) (focus-status grabbed))) + ) + (get-task-by-type (-> arg0 ai-ctrl) asht-fight-focus arg0) + (ai-task-control-method-10 (-> arg0 ai-ctrl) arg0) + ) + ) + ) + (none) + ) + +;; definition for method 11 of type asht-fight-focus +;; WARN: Return type mismatch object vs none. +(defmethod ai-task-method-11 ((this asht-fight-focus) (arg0 bot)) + (let ((a1-1 (handle->process (-> arg0 focus handle)))) + (if (and a1-1 + (attacked-by-player? arg0 (the-as process-focusable a1-1)) + (not (logtest? (-> arg0 focus-status) (focus-status grabbed))) + ) + (logior! (-> arg0 bot-flags) (bot-flags bf00)) + (ai-task-control-method-14 (-> arg0 ai-ctrl) this arg0) + ) + ) + (none) + ) + +;; definition for method 10 of type asht-fight-focus +;; WARN: Return type mismatch bot-flags vs none. +(defmethod ai-task-method-10 ((this asht-fight-focus) (arg0 bot)) + (logclear! (-> arg0 bot-flags) (bot-flags bf00)) + (none) + ) + + + + diff --git a/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash_REF.gc index bb20044564..62d64db176 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash_REF.gc @@ -256,7 +256,7 @@ (let* ((t9-0 (method-of-type bot bot-method-193)) (v0-0 (t9-0 this)) ) - (when (and (not v0-0) (logtest? #x400000 (-> this incoming penetrate-using))) + (when (and (not v0-0) (logtest? (penetrate jak-yellow-shot) (-> this incoming penetrate-using))) (if (logtest? (bot-flags bf22) (-> this bot-flags)) (set! v0-0 #t) ) @@ -268,8 +268,8 @@ ;; definition for method 106 of type ashelin ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-106 ((this ashelin) (arg0 process) (arg1 object) (arg2 int) (arg3 attack-info)) - (let ((t9-0 (method-of-type bot enemy-method-106))) +(defmethod set-incoming-attack-info ((this ashelin) (arg0 process) (arg1 object) (arg2 penetrate) (arg3 attack-info)) + (let ((t9-0 (method-of-type bot set-incoming-attack-info))) (t9-0 this arg0 arg1 arg2 arg3) ) (if (!= (-> this incoming knocked-type) (knocked-type knocked-type-6)) @@ -466,7 +466,7 @@ (defmethod init-enemy! ((this ashelin)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (init! this) - (set! (-> this channel) (the-as uint 22)) + (set! (-> this channel) (gui-channel ashelin)) (set! (-> this travel-anim-interp) 0.0) (set! (-> this focus-info max-los-dist) 204800.0) (set! (-> this hit-invuln-ignore-me-delay) (the-as uint 0)) @@ -581,7 +581,7 @@ ) (cond ((or (>= 8192.0 (fabs f0-5)) (>= (fabs f0-5) 24576.0)) - (let ((s3-1 (zero? (get-rand-int this 2))) + (let ((s3-1 (zero? (rnd-int-count this 2))) (s4-0 (new 'stack-no-clear 'vector)) ) (countdown (s2-0 2) @@ -623,7 +623,7 @@ (defmethod ashelin-method-242 ((this ashelin)) (let ((s5-0 0)) (cond - ((zero? (get-rand-int this 2)) + ((zero? (rnd-int-count this 2)) (when (>= 16384.0 (fabs (-> this focus-info ry-diff))) (let ((s4-0 (new 'stack-no-clear 'vector))) (when (ashelin-method-236 this s4-0 (+ 16384.0 (-> this focus-info bullseye-ry)) 8192.0 40707.93 34563.93) @@ -972,7 +972,7 @@ (set! v1-36 (-> this draw art-group data 7)) (set! f28-0 (the float (sar (shl (the int (+ 32768.0 f30-0)) 48) 48))) ) - ((zero? (get-rand-int this 3)) + ((zero? (rnd-int-count this 3)) (set! v1-36 (-> this draw art-group data 10)) ) (else @@ -991,7 +991,7 @@ ) ;; definition for method 77 of type ashelin -(defmethod enemy-method-77 ((this ashelin) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this ashelin) (arg0 enemy-knocked-info)) (local-vars (a2-0 int)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) @@ -1013,7 +1013,7 @@ ) ) ) - (let* ((v1-9 (enemy-method-120 this 6 a2-0)) + (let* ((v1-9 (rnd-bit this 6 a2-0)) (s5-2 (-> this draw art-group data (-> *ashelin-global-info* blue-hit-anim v1-9))) ) (set! (-> *ashelin-global-info* prev-blue-hit) v1-9) @@ -1049,7 +1049,7 @@ (let ((a0-40 (-> this skel root-channel 0))) (set! (-> a0-40 frame-group) (-> this knocked-anim)) (set! (-> a0-40 param 0) (the float (+ (-> this knocked-anim frames num-frames) -1))) - (set! (-> a0-40 param 1) (-> arg0 0)) + (set! (-> a0-40 param 1) (-> arg0 anim-speed)) (set! (-> a0-40 frame-num) 0.0) (joint-control-channel-group! a0-40 (-> this knocked-anim) num-func-seek!) ) @@ -1059,7 +1059,7 @@ ) ;; definition for method 78 of type ashelin -(defmethod enemy-method-78 ((this ashelin) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this ashelin) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (let* ((v1-1 *ashelin-global-info*) @@ -1113,7 +1113,7 @@ ) ) ) - ((and (or (zero? (-> this hit-points)) (nonzero? (-> this fated-time))) (nonzero? (get-rand-int this 3))) + ((and (or (zero? (-> this hit-points)) (nonzero? (-> this fated-time))) (nonzero? (rnd-int-count this 3))) (ja-channel-push! 1 (seconds 0.17)) (let ((a0-20 (-> this skel root-channel 0))) (set! (-> a0-20 frame-group) (the-as art-joint-anim (-> this draw art-group data 12))) @@ -1190,7 +1190,7 @@ (cond ((>= f0-4 22.0) (when (focus-test? this dangerous) - (if (logtest? (-> this enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> this enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> this focus-status) (focus-status dangerous)) (logclear! (-> this focus-status) (focus-status dangerous)) ) @@ -1221,7 +1221,7 @@ (cond ((>= f0-5 32.0) (when (focus-test? this dangerous) - (if (logtest? (-> this enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> this enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> this focus-status) (focus-status dangerous)) (logclear! (-> this focus-status) (focus-status dangerous)) ) @@ -1342,9 +1342,11 @@ ;; definition for method 203 of type ashelin (defmethod play-attacked-speech ((this ashelin)) (local-vars (v1-3 int) (a3-0 int)) - (when (not (channel-active? this (the-as uint 0))) + (when (not (channel-active? this (gui-channel none))) (let ((v1-2 0)) - (if (logtest? #x3c00000 (-> this incoming penetrate-using)) + (if (logtest? (penetrate jak-yellow-shot jak-red-shot jak-blue-shot jak-dark-shot) + (-> this incoming penetrate-using) + ) (set! v1-3 (logior v1-2 128)) (set! v1-3 (logior v1-2 64)) ) @@ -1371,7 +1373,7 @@ ;; definition for method 244 of type ashelin (defmethod ashelin-method-244 ((this ashelin)) - (when (not (channel-active? this (the-as uint 0))) + (when (not (channel-active? this (gui-channel none))) (let ((a1-2 (bot-speech-list-method-9 (-> this ash-course ouch-speeches) this @@ -1390,7 +1392,7 @@ ;; definition for method 245 of type ashelin (defmethod ashelin-method-245 ((this ashelin)) - (when (and (not (channel-active? this (the-as uint 0))) (>= (current-time) (-> this victory-speech-time))) + (when (and (not (channel-active? this (gui-channel none))) (>= (current-time) (-> this victory-speech-time))) (let ((s5-0 (bot-speech-list-method-9 (-> this ash-course victory-speeches) this @@ -1400,9 +1402,7 @@ ) ) (when (>= s5-0 0) - (set! (-> this victory-speech-time) - (the-as time-frame (+ (get-rand-int-range this 1200 2100) (current-time))) - ) + (set! (-> this victory-speech-time) (the-as time-frame (+ (rnd-int-range this 1200 2100) (current-time)))) (play-speech this s5-0) ) ) @@ -1413,7 +1413,7 @@ ;; definition for method 136 of type ashelin (defmethod enemy-method-136 ((this ashelin)) (when (time-elapsed? (-> this hit-focus-time) (seconds 2)) - (let ((v0-0 (logclear (-> this enemy-flags) (enemy-flag look-at-focus)))) + (let ((v0-0 (logclear (-> this enemy-flags) (enemy-flag victory)))) (set! (-> this enemy-flags) v0-0) v0-0 ) @@ -1426,7 +1426,7 @@ (let ((t9-0 (method-of-type bot play-speech))) (t9-0 this arg0) ) - (logclear! (-> this enemy-flags) (enemy-flag look-at-focus)) + (logclear! (-> this enemy-flags) (enemy-flag victory)) (none) ) diff --git a/test/decompiler/reference/jak2/levels/common/ai/bot-h_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/bot-h_REF.gc index ece4c67884..d3f505b932 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/bot-h_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/bot-h_REF.gc @@ -258,7 +258,7 @@ (hit-by-enemy-count uint16) (hit-by-player-count uint16) (notice-enemy-dist float) - (channel uint8) + (channel gui-channel) (focus-mode int8) (nav-mesh-index int8) (delay-too-far-check int8) @@ -318,13 +318,13 @@ (play-speech (_type_ int) none) (play-death-sound (_type_ string) none) (bot-method-208 (_type_) symbol) - (channel-active? (_type_ uint) symbol) + (channel-active? (_type_ gui-channel) symbol) (init! (_type_) none) (clear-speech-flags! (_type_) none) (reset-warn-time! (_type_) none) (go-to-waypoint! (_type_ int symbol) object) (bot-method-214 (_type_) symbol) - (skip-waypoint (_type_) none) + (skip-waypoint (_type_) object) (bot-method-216 (_type_) none) (speech-ended? (_type_ int) symbol) (speech-playing? (_type_ int) symbol) @@ -711,7 +711,7 @@ ) (reset-index sp-list #f) (if (logtest? (-> sp-list flags) 4) - (set! last-idx (+ (get-rand-int bot (-> sp-indexes length)) -1)) + (set! last-idx (+ (rnd-int-count bot (-> sp-indexes length)) -1)) (set! last-idx -1) ) ) @@ -839,7 +839,7 @@ (set! history-mask 0) ) ) - (let* ((last-idx (enemy-method-120 bot (-> this speech-indexes length) history-mask)) + (let* ((last-idx (rnd-bit bot (-> this speech-indexes length) history-mask)) (speech-idx (-> this speech-indexes last-idx)) (v1-47 (-> sp-info speech-idx flags)) ) 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 8b01e2318b..8428cc0b72 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 @@ -25,7 +25,7 @@ :code (behavior () (local-vars (v1-37 enemy-flag) (v1-45 enemy-flag)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info hit-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -35,29 +35,29 @@ (ja :num! (seek! max f30-0)) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-36 (-> self enemy-flags))) - (if (logtest? v1-36 (enemy-flag checking-water)) - (set! v1-37 (logior v1-36 (enemy-flag enable-on-active))) - (set! v1-37 (logclear v1-36 (enemy-flag enable-on-active))) + (if (logtest? v1-36 (enemy-flag vulnerable-backup)) + (set! v1-37 (logior v1-36 (enemy-flag vulnerable))) + (set! v1-37 (logclear v1-36 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-37) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-44 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-44) - (set! v1-45 (logior (enemy-flag check-water-backup) v1-44)) - (set! v1-45 (logclear v1-44 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-44) + (set! v1-45 (logior (enemy-flag trackable) v1-44)) + (set! v1-45 (logclear v1-44 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-45) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) @@ -67,7 +67,7 @@ (defstate knocked (bot) :virtual #t :enter (behavior () - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (stop-speech self (the-as uint 0) #t) (if (and (logtest? (-> self bot-flags) (bot-flags attacked)) (nonzero? (-> self hit-points)) @@ -148,7 +148,7 @@ ) ) ) - (f30-0 (get-rand-float-range self 0.8 1.2)) + (f30-0 (rnd-float-range self 0.8 1.2)) ) (ja-no-eval :group! gp-0 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -156,7 +156,7 @@ (ja :num! (seek! max f30-0)) ) ) - (until (not (channel-active? self (the-as uint 0))) + (until (not (channel-active? self (gui-channel none))) (suspend) ) (until #f @@ -193,13 +193,13 @@ ) :trans (behavior () ((-> (method-of-type bot die-falling) trans)) - (if (channel-active? self (the-as uint 0)) + (if (channel-active? self (gui-channel none)) (set-time! (-> self state-time)) ) ) :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self enemy-info idle-anim))) ) (until #f @@ -236,7 +236,7 @@ 0 (logior! (-> self draw status) (draw-control-status no-draw)) (set! (-> self notice-enemy-dist) 0.0) - (logclear! (-> self enemy-flags) (enemy-flag trackable-backup)) + (logclear! (-> self enemy-flags) (enemy-flag check-water)) ) :exit (behavior () (local-vars (v0-0 enemy-flag)) @@ -247,9 +247,9 @@ (set! (-> v1-5 prim-core collide-with) (-> self root backup-collide-with)) ) (let ((v1-6 (-> self enemy-flags))) - (if (logtest? (enemy-flag enable-on-hostile) v1-6) - (set! v0-0 (logior (enemy-flag trackable-backup) v1-6)) - (set! v0-0 (logclear v1-6 (enemy-flag trackable-backup))) + (if (logtest? (enemy-flag check-water-backup) v1-6) + (set! v0-0 (logior (enemy-flag check-water) v1-6)) + (set! v0-0 (logclear v1-6 (enemy-flag check-water))) ) ) (set! (-> self enemy-flags) v0-0) 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 1431b33454..4e31a0b893 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc @@ -113,7 +113,7 @@ ) ;; definition for method 108 of type bot -(defmethod enemy-method-108 ((this bot) (arg0 enemy) (arg1 event-message-block)) +(defmethod enemy-method-108 ((this bot) (arg0 process-drawable) (arg1 event-message-block)) 0 ) @@ -139,7 +139,7 @@ (let ((gp-0 #f)) (let ((v1-0 (-> this incoming penetrate-using))) (cond - ((logtest? #x800000 v1-0) + ((logtest? (penetrate jak-red-shot) v1-0) (when *target* (let ((s5-0 (new 'stack-no-clear 'vector)) (s3-0 (-> *target* gun fire-dir-out)) @@ -157,7 +157,7 @@ ) ) ) - ((and (logtest? #x10000 v1-0) (not (logtest? #x20000 v1-0))) + ((and (logtest? (penetrate dark-skin) v1-0) (not (logtest? (penetrate dark-punch) v1-0))) (set! gp-0 #t) ) ) @@ -303,8 +303,8 @@ ;; definition for method 106 of type bot ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-106 ((this bot) (arg0 process) (arg1 object) (arg2 int) (arg3 attack-info)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-106))) +(defmethod set-incoming-attack-info ((this bot) (arg0 process) (arg1 object) (arg2 penetrate) (arg3 attack-info)) + (let ((t9-0 (method-of-type nav-enemy set-incoming-attack-info))) (t9-0 this arg0 arg1 arg2 arg3) ) (logclear! (-> this bot-flags) (bot-flags bf03 bf04)) @@ -453,7 +453,7 @@ (local-vars (s5-1 process)) (let ((s5-0 (-> this focus))) (cond - ((logtest? (enemy-flag actor-pause-backup) (-> this enemy-flags)) + ((logtest? (enemy-flag lock-focus) (-> this enemy-flags)) (set! s5-1 (handle->process (-> s5-0 handle))) ) (else @@ -782,13 +782,13 @@ (('too-far-fail) (when (not (logtest? (-> this bot-flags) (bot-flags too-far-fail bf09))) (logior! (-> this bot-flags) (bot-flags bf09)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag check-water)) + (logclear! (-> this enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (go (method-of-object this failed)) ) ) @@ -860,7 +860,7 @@ (when (if (type? s5-2 process-focusable) s5-2 ) - (logior! (-> this enemy-flags) (enemy-flag look-at-focus)) + (logior! (-> this enemy-flags) (enemy-flag victory)) (set-time! (-> this hit-focus-time)) ) ) @@ -1049,7 +1049,7 @@ ;; definition for method 204 of type bot (defmethod play-too-far-warn-speech ((this bot)) - (when (not (channel-active? this (the-as uint 0))) + (when (not (channel-active? this (gui-channel none))) (let ((idx (bot-speech-list-method-9 (-> this course too-far-warn-speeches) this @@ -1114,7 +1114,7 @@ If the player is too far, play a warning speech." (if (and (>= (current-time) (-> this next-too-far-warn-time)) (play-too-far-warn-speech this)) (set! (-> this next-too-far-warn-time) (+ (current-time) - (get-rand-int-range this (the-as int (-> this warn-min-delay)) (the-as int (-> this warn-max-delay))) + (rnd-int-range this (the-as int (-> this warn-min-delay)) (the-as int (-> this warn-max-delay))) ) ) ) @@ -1137,14 +1137,14 @@ If the player is too far, play a warning speech." (set! (-> this started-warning-time) 0) (set! (-> this next-too-far-warn-time) (+ (current-time) - (get-rand-int-range this (the-as int (-> this warn-min-delay)) (the-as int (-> this warn-max-delay))) + (rnd-int-range this (the-as int (-> this warn-min-delay)) (the-as int (-> this warn-max-delay))) ) ) (none) ) ;; definition for method 55 of type bot -(defmethod track-target! ((this bot)) +(defmethod common-post ((this bot)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -1177,7 +1177,7 @@ If the player is too far, play a warning speech." ) ) ) - (let ((t9-4 (method-of-type nav-enemy track-target!))) + (let ((t9-4 (method-of-type nav-enemy common-post))) (t9-4 this) ) (when (not (logtest? (-> this bot-flags) (bot-flags bf09))) @@ -1251,7 +1251,7 @@ If the player is too far, play a warning speech." (add-process *gui-control* this - (the-as gui-channel (-> this channel)) + (-> this channel) (gui-action play) (-> speech name) -99.0 @@ -1277,15 +1277,7 @@ If the player is too far, play a warning speech." ;; WARN: Return type mismatch sound-id vs none. (defmethod play-death-sound ((this bot) (sound string)) "Play one of our death sounds." - (add-process - *gui-control* - this - (the-as gui-channel (-> this channel)) - (gui-action play) - sound - -99.0 - (seconds 0.3) - ) + (add-process *gui-control* this (-> this channel) (gui-action play) sound -99.0 (seconds 0.3)) (none) ) @@ -1311,14 +1303,14 @@ If the player is too far, play a warning speech." ) ;; definition for method 209 of type bot -(defmethod channel-active? ((this bot) (channel uint)) +(defmethod channel-active? ((this bot) (channel gui-channel)) "Is the given [[gui-channel]] active?" - (if (zero? channel) + (if (= channel (gui-channel none)) (set! channel (-> this channel)) ) (nonzero? (get-status *gui-control* - (lookup-gui-connection-id *gui-control* (the-as string #f) (the-as gui-channel channel) (gui-action none)) + (lookup-gui-connection-id *gui-control* (the-as string #f) channel (gui-action none)) ) ) ) @@ -1327,7 +1319,7 @@ If the player is too far, play a warning speech." ;; WARN: Return type mismatch int vs none. (defmethod stop-speech ((this bot) (channel uint) (arg1 symbol)) (if (zero? channel) - (set! channel (-> this channel)) + (set! channel (the-as uint (-> this channel))) ) (if arg1 (set-action! @@ -1410,7 +1402,6 @@ If the player is too far, play a warning speech." ) ;; definition for method 215 of type bot -;; WARN: Return type mismatch object vs none. (defmethod skip-waypoint ((this bot)) (let ((skip-id (-> this waypoint skip-to))) (when (>= skip-id 0) @@ -1419,7 +1410,6 @@ If the player is too far, play a warning speech." (go-to-waypoint! this skip-id #t) ) ) - (none) ) ;; definition for method 7 of type bot @@ -1483,9 +1473,9 @@ If the player is too far, play a warning speech." (set! (-> this ai-ctrl) (new 'process 'ai-task-control *bot-task-pool*)) (logclear! (-> this mask) (process-mask enemy)) (logior! (-> this mask) (process-mask bot)) - (logior! (-> this enemy-flags) (enemy-flag use-notice-distance multi-focus)) + (logior! (-> this enemy-flags) (enemy-flag cam-attack-mode dislike-combo)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logior! (-> this focus-status) (focus-status disable)) (let ((v1-13 (-> this nav))) (set! (-> v1-13 sphere-mask) (the-as uint 78)) @@ -1762,7 +1752,7 @@ If the player is too far, play a warning speech." ;; definition for method 203 of type bot (defmethod play-attacked-speech ((this bot)) - (when (not (channel-active? this (the-as uint 0))) + (when (not (channel-active? this (gui-channel none))) (let ((idx (bot-speech-list-method-9 (-> this course attack-player-speeches) this @@ -1789,11 +1779,11 @@ If the player is too far, play a warning speech." ;; definition for method 197 of type bot ;; WARN: Return type mismatch bot-flags vs none. (defmethod fail-mission! ((this bot)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> this mask) (process-mask collectable)) - (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> this enemy-flags) (enemy-flag attackable-backup)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (logior! (-> this bot-flags) (bot-flags bf09)) (let ((mission-failed? #t)) (let ((master-handle (handle->process (-> this master-handle)))) @@ -1883,7 +1873,7 @@ If the player is too far, play a warning speech." (defmethod bot-method-191 ((this bot)) (logior! (-> this bot-flags) (bot-flags bf02)) (set-time! (-> this hit-invuln-starting-time)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable)) (if (nonzero? (-> this hit-invuln-ignore-me-delay)) (logior! (-> this focus-status) (focus-status ignore)) ) @@ -1900,13 +1890,13 @@ If the player is too far, play a warning speech." (let ((a1-0 (-> this hit-invuln-starting-time)) (v1-0 #t) ) - (if (not (logtest? (-> this enemy-flags) (enemy-flag enable-on-active))) + (if (not (logtest? (-> this enemy-flags) (enemy-flag vulnerable))) (set! v1-0 (cond ((time-elapsed? a1-0 (seconds 0.6)) (let ((a2-6 (-> this 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))) + (if (logtest? a2-6 (enemy-flag vulnerable-backup)) + (set! a2-7 (logior a2-6 (enemy-flag vulnerable))) + (set! a2-7 (logclear a2-6 (enemy-flag vulnerable))) ) ) (set! (-> this enemy-flags) a2-7) diff --git a/test/decompiler/reference/jak2/levels/common/ai/halt/hal_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/halt/hal_REF.gc index 1903d6a7b7..b6e0947ee6 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/halt/hal_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/halt/hal_REF.gc @@ -138,13 +138,13 @@ (cond ((zero? arg0) (let ((t9-0 (method-of-type bot stop-speech))) - (t9-0 this (-> this channel) arg1) + (t9-0 this (the-as uint (-> this channel)) arg1) ) (countdown (s4-0 3) (let ((v1-4 (handle->process (-> this slave-handle s4-0)))) (when v1-4 (let ((t9-1 (method-of-type bot stop-speech))) - (t9-1 (the-as bot v1-4) (-> v1-4 stack 580) arg1) + (t9-1 (the-as bot v1-4) (the-as uint (-> (the-as bot v1-4) channel)) arg1) ) ) ) @@ -172,7 +172,7 @@ (a1-11 (add-process *gui-control* a2-2 - (the-as gui-channel (-> a2-2 stack 580)) + (-> (the-as bot a2-2) channel) (gui-action play) (-> v1-2 name) -99.0 @@ -187,7 +187,7 @@ (let ((a1-14 (add-process *gui-control* this - (the-as gui-channel (-> this channel)) + (-> this channel) (gui-action play) (-> v1-2 name) -99.0 @@ -205,10 +205,10 @@ ) ;; definition for method 209 of type hal -(defmethod channel-active? ((this hal) (arg0 uint)) +(defmethod channel-active? ((this hal) (arg0 gui-channel)) "Is the given [[gui-channel]] active?" (cond - ((zero? arg0) + ((= arg0 (gui-channel none)) (let ((t9-0 (method-of-type bot channel-active?))) (if (t9-0 this (-> this channel)) (return #t) @@ -218,7 +218,7 @@ (let ((v1-7 (handle->process (-> this slave-handle s5-0)))) (when v1-7 (let ((t9-1 (method-of-type bot channel-active?))) - (if (t9-1 (the-as bot v1-7) (-> v1-7 stack 580)) + (if (t9-1 (the-as bot v1-7) (-> (the-as bot v1-7) channel)) (return #t) ) ) @@ -332,7 +332,7 @@ (let ((t9-4 (method-of-type bot init-enemy!))) (t9-4 this) ) - (set! (-> this channel) (the-as uint 28)) + (set! (-> this channel) (gui-channel hal)) (set! (-> this spot-color) (the-as uint #x5000ffff)) (set! (-> this notice-enemy-dist) 0.0) (logior! (-> this focus-status) (focus-status disable)) @@ -518,7 +518,7 @@ (when (and (not (logtest? (-> self bot-flags) (bot-flags too-far-fail bf09))) (bot-check-too-far self)) (let ((gp-0 0)) (countdown (s5-0 3) - (let ((s4-0 (enemy-method-120 self 3 gp-0))) + (let ((s4-0 (rnd-bit self 3 gp-0))) (let ((a0-4 (handle->process (-> self slave-handle s4-0)))) (if (send-event a0-4 'request 'too-far-fail) (goto cfg-24) diff --git a/test/decompiler/reference/jak2/levels/common/ai/ruffian/ruf-states_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/ruffian/ruf-states_REF.gc index 4ebcb37215..4c42f42549 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/ruffian/ruf-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/ruffian/ruf-states_REF.gc @@ -17,7 +17,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -62,7 +62,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -101,7 +101,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -143,7 +143,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -210,7 +210,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -299,7 +299,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self travel-anim-interp) 0.0) ) :trans (behavior () @@ -358,7 +358,7 @@ ) 0 (nav-enemy-method-167 self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-11 *game-info*) (a0-6 (+ (-> v1-11 attack-id) 1)) @@ -369,8 +369,8 @@ (set! (-> self travel-anim-interp) 0.0) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -397,14 +397,14 @@ ) 0 (nav-enemy-method-167 self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (if (not (handle->process (-> self focus handle))) (react-to-focus self) ) (set! (-> self travel-anim-interp) 0.0) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :code nothing :post nav-enemy-simple-post diff --git a/test/decompiler/reference/jak2/levels/common/ai/ruffian/ruf-task_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/ruffian/ruf-task_REF.gc index 64eb0cde99..3a350cb03f 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/ruffian/ruf-task_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/ruffian/ruf-task_REF.gc @@ -112,7 +112,9 @@ (set! (-> v1-9 target-speed) 0.0) ) 0 - (set! (-> arg0 enemy-flags) (the-as enemy-flag (logclear (-> arg0 enemy-flags) (enemy-flag vulnerable)))) + (set! (-> arg0 enemy-flags) + (the-as enemy-flag (logclear (-> arg0 enemy-flags) (enemy-flag jump-check-blocked))) + ) (when (send-event arg0 'jump 0 (-> s5-0 center)) (mem-copy! (the-as pointer (-> arg0 spot)) (the-as pointer s5-0) 20) #t diff --git a/test/decompiler/reference/jak2/levels/common/ai/sig/sig-states_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/sig/sig-states_REF.gc index db040b863c..ab086df9bf 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/sig/sig-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/sig/sig-states_REF.gc @@ -17,18 +17,18 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (logior! (-> self focus-status) (focus-status disable)) ) :exit (behavior () (local-vars (v1-1 enemy-flag)) (let ((v1-0 (-> self enemy-flags))) - (if (logtest? v1-0 (enemy-flag checking-water)) - (set! v1-1 (logior v1-0 (enemy-flag enable-on-active))) - (set! v1-1 (logclear v1-0 (enemy-flag enable-on-active))) + (if (logtest? v1-0 (enemy-flag vulnerable-backup)) + (set! v1-1 (logior v1-0 (enemy-flag vulnerable))) + (set! v1-1 (logclear v1-0 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-1) @@ -71,7 +71,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) ) @@ -166,7 +166,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) ) @@ -288,7 +288,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) ) @@ -634,7 +634,7 @@ ) (until #f (ja-channel-push! 1 (seconds 0.07)) - (countdown (gp-0 (get-rand-int-range self 2 4)) + (countdown (gp-0 (rnd-int-range self 2 4)) (ja-no-eval :group! sig-gun-fix-hit-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -707,7 +707,7 @@ (logclear! (-> self bot-flags) (bot-flags bf19 bf21)) (go-virtual waiting-close) ) - (countdown (gp-1 (get-rand-int-range self 2 3)) + (countdown (gp-1 (rnd-int-range self 2 3)) (ja-channel-push! 1 (seconds 0.07)) (ja-no-eval :group! sig-gun-fix-stomp-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) @@ -791,7 +791,7 @@ 0 (cond ((= gp-0 1) - (let ((s5-0 (get-rand-int-range self 1 2))) + (let ((s5-0 (rnd-int-range self 1 2))) (ja-channel-push! 1 (seconds 0.13)) (while (nonzero? s5-0) (+! s5-0 -1) @@ -804,7 +804,7 @@ ) ) (else - (let ((s5-1 (get-rand-int-range self 1 4))) + (let ((s5-1 (rnd-int-range self 1 4))) (ja-channel-push! 1 (seconds 0.13)) (while (nonzero? s5-1) (+! s5-1 -1) @@ -915,7 +915,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) ) @@ -1072,7 +1072,7 @@ ) 0 (nav-enemy-method-167 self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-11 *game-info*) (a0-6 (+ (-> v1-11 attack-id) 1)) @@ -1084,8 +1084,8 @@ (set! (-> self travel-anim-interp) 0.0) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1118,7 +1118,7 @@ (ja-no-eval :group! a1-2 :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (when (and (focus-test? self dangerous) (< f30-0 (ja-aframe-num 0))) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1150,7 +1150,7 @@ ) 0 (nav-enemy-method-167 self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (if (not (handle->process (-> self focus handle))) (react-to-focus self) ) @@ -1158,7 +1158,7 @@ (set! (-> self travel-anim-interp) 0.0) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :code (behavior () (local-vars (gp-0 art-element)) @@ -1276,10 +1276,10 @@ (if (not (handle->process (-> self focus handle))) (go-virtual traveling) ) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :code (behavior () (push-anim-to-targ (-> self skel top-anim) (the-as art-joint-anim sig-upper-shoot-ja) 0.0 9 9 1.0 0.0 #f) @@ -1350,29 +1350,29 @@ (suspend) (ja :num! (seek!)) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-30 (-> self enemy-flags))) - (if (logtest? v1-30 (enemy-flag checking-water)) - (set! v1-31 (logior v1-30 (enemy-flag enable-on-active))) - (set! v1-31 (logclear v1-30 (enemy-flag enable-on-active))) + (if (logtest? v1-30 (enemy-flag vulnerable-backup)) + (set! v1-31 (logior v1-30 (enemy-flag vulnerable))) + (set! v1-31 (logclear v1-30 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-31) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-38 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-38) - (set! v1-39 (logior (enemy-flag check-water-backup) v1-38)) - (set! v1-39 (logclear v1-38 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-38) + (set! v1-39 (logior (enemy-flag trackable) v1-38)) + (set! v1-39 (logclear v1-38 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-39) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) @@ -1473,7 +1473,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) ) @@ -1533,7 +1533,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (logior! (-> self bot-flags) (bot-flags bf24)) @@ -1600,7 +1600,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) ) @@ -1661,7 +1661,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (logior! (-> self bot-flags) (bot-flags bf24)) @@ -1734,7 +1734,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) ) @@ -1795,7 +1795,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (vector-reset! (-> self root transv)) diff --git a/test/decompiler/reference/jak2/levels/common/ai/sig/sig-task_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/sig/sig-task_REF.gc index dc74566662..ca57c8043a 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/sig/sig-task_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/sig/sig-task_REF.gc @@ -186,13 +186,16 @@ (s4-0 (-> arg0 root)) ) (when (>= 10012.445 - (fabs (deg- - (atan (- (-> v1-22 trans x) (-> s4-0 trans x)) (- (-> v1-22 trans z) (-> s4-0 trans z))) - (quaternion-y-angle (-> s4-0 quat)) - ) - ) + (fabs + (deg- + (atan (- (-> v1-22 trans x) (-> s4-0 trans x)) (- (-> v1-22 trans z) (-> s4-0 trans z))) + (quaternion-y-angle (-> s4-0 quat)) + ) + ) ) - (set! (-> arg0 enemy-flags) (the-as enemy-flag (logclear (-> arg0 enemy-flags) (enemy-flag vulnerable)))) + (set! (-> arg0 enemy-flags) + (the-as enemy-flag (logclear (-> arg0 enemy-flags) (enemy-flag jump-check-blocked))) + ) (when (send-event arg0 'jump 4 (-> (the-as process-focusable s5-1) root trans)) (set! (-> arg0 spot center quad) (-> (the-as process-focusable s5-1) root trans quad)) (set! (-> arg0 spot center w) 10240.0) @@ -287,7 +290,9 @@ ) 0 (let ((s5-1 (-> arg0 course spots (-> this spot-indexes (-> this which-spot))))) - (set! (-> arg0 enemy-flags) (the-as enemy-flag (logclear (-> arg0 enemy-flags) (enemy-flag vulnerable)))) + (set! (-> arg0 enemy-flags) + (the-as enemy-flag (logclear (-> arg0 enemy-flags) (enemy-flag jump-check-blocked))) + ) (when (send-event arg0 'jump 0 (-> s5-1 center)) (mem-copy! (the-as pointer (-> arg0 spot)) (the-as pointer s5-1) 20) (return #t) diff --git a/test/decompiler/reference/jak2/levels/common/ai/sig/sig_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/sig/sig_REF.gc index 950c5f3809..b5b21015b7 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/sig/sig_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/sig/sig_REF.gc @@ -393,7 +393,7 @@ ) ;; definition for method 55 of type sig -(defmethod track-target! ((this sig)) +(defmethod common-post ((this sig)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -442,7 +442,7 @@ ) ) ) - (let ((t9-2 (method-of-type bot track-target!))) + (let ((t9-2 (method-of-type bot common-post))) (t9-2 this) ) (when (logtest? (-> this bot-flags) (bot-flags too-far-fail)) @@ -644,7 +644,7 @@ (defmethod init-enemy! ((this sig)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (init! this) - (set! (-> this channel) (the-as uint 21)) + (set! (-> this channel) (gui-channel sig)) (set! (-> this notice-enemy-dist) 122880.0) (set! (-> this travel-anim-interp) 0.0) (set! (-> this plasma charge-speed) 0.125) @@ -872,10 +872,10 @@ ) ;; definition for method 77 of type sig -(defmethod enemy-method-77 ((this sig) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this sig) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) - (let* ((v1-3 (enemy-method-120 this 3 (ash 1 (-> *sig-global-info* prev-blue-hit)))) + (let* ((v1-3 (rnd-bit this 3 (ash 1 (-> *sig-global-info* prev-blue-hit)))) (s5-1 (-> this draw art-group data (-> *sig-global-info* blue-hit-anim v1-3 anim-index))) ) (set! (-> *sig-global-info* prev-blue-hit) v1-3) @@ -942,7 +942,7 @@ (let ((a0-25 (-> this skel root-channel 0))) (set! (-> a0-25 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-25 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-25 param 1) (-> arg0 0)) + (set! (-> a0-25 param 1) (-> arg0 anim-speed)) (set! (-> a0-25 frame-num) 0.0) (joint-control-channel-group! a0-25 (the-as art-joint-anim s4-1) num-func-seek!) ) @@ -955,7 +955,7 @@ ) ;; definition for method 78 of type sig -(defmethod enemy-method-78 ((this sig) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this sig) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -1210,7 +1210,7 @@ (set! (-> this sig-path-start-time) (-> this sig-path-clock frame-counter)) (set! (-> this sig-path-cur-time) (-> this sig-path-start-time)) (set! (-> this sig-path-prev-time) (-> this sig-path-start-time)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (none) ) diff --git a/test/decompiler/reference/jak2/levels/common/battle_REF.gc b/test/decompiler/reference/jak2/levels/common/battle_REF.gc index bc09d124ab..93d6eaea72 100644 --- a/test/decompiler/reference/jak2/levels/common/battle_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/battle_REF.gc @@ -1292,7 +1292,7 @@ (a2-2 (handle->process (-> a1-5 creature))) ) (when (and a2-2 (= a2-2 v1-0)) - (when (not (logtest? (enemy-flag alert) (-> (the-as nav-enemy a2-2) enemy-flags))) + (when (not (logtest? (enemy-flag directed) (-> (the-as nav-enemy a2-2) enemy-flags))) (set! (-> a1-5 creature) (the-as handle #f)) (set! a1-5 (the-as battle-spawner #f)) ) @@ -1323,7 +1323,7 @@ ) (let ((s4-0 (handle->process (-> arg0 creature)))) (when s4-0 - (when (not (logtest? (enemy-flag alert) (-> (the-as enemy s4-0) enemy-flags))) + (when (not (logtest? (enemy-flag directed) (-> (the-as enemy s4-0) enemy-flags))) (set! (-> arg0 creature) (the-as handle #f)) (return #f) ) @@ -1334,7 +1334,7 @@ 0 ) ((zero? v1-20) - (when (or (logtest? (enemy-flag victory) (-> (the-as enemy s4-0) enemy-flags)) (not arg1)) + (when (or (logtest? (enemy-flag directed-ready) (-> (the-as enemy s4-0) enemy-flags)) (not arg1)) (cond ((spawner-in-intro? this arg0) (if (not (spawner-try-jump this arg0 (the-as enemy s4-0))) @@ -1376,7 +1376,9 @@ (get-point-in-path! (-> arg0 intro-path) s4-0 (the float s3-0) 'exact) (let ((s3-1 (-> arg0 mode))) (set! (-> arg0 mode) (the-as uint 2)) - (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) + (set! (-> arg1 enemy-flags) + (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag jump-check-blocked))) + ) (cond ((send-event arg1 'jump 3 s4-0) #t 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 0d06657b43..38ccb34d6c 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 @@ -347,15 +347,15 @@ (('hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (when (= (-> this incoming knocked-type) (knocked-type knocked-type-4)) @@ -371,7 +371,7 @@ ) ) (go (method-of-object this knocked)) - (if (and (logtest? (-> this incoming penetrate-using) 16) + (if (and (logtest? (-> this incoming penetrate-using) (penetrate punch)) (nonzero? (-> this hit-points)) (zero? (-> this fated-time)) ) @@ -438,11 +438,11 @@ ;; definition for method 106 of type amphibian ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-106 ((this amphibian) (arg0 process) (arg1 object) (arg2 int) (arg3 attack-info)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-106))) +(defmethod set-incoming-attack-info ((this amphibian) (arg0 process) (arg1 object) (arg2 penetrate) (arg3 attack-info)) + (let ((t9-0 (method-of-type nav-enemy set-incoming-attack-info))) (t9-0 this arg0 arg1 arg2 arg3) ) - (let ((a0-3 (enemy-method-134 this arg0 arg3))) + (let ((a0-3 (get-attacker this arg0 arg3))) (if a0-3 (set! (-> this attacker-handle) (process->handle a0-3)) (set! (-> this attacker-handle) (the-as handle #f)) @@ -498,7 +498,7 @@ (cond ((and (nonzero? (-> this hit-points)) (zero? (-> this fated-time)) (!= (-> this incoming knocked-type) 6)) (enemy-method-50 this arg0) - (let ((f30-0 (get-rand-float-range this 0.0 1.0))) + (let ((f30-0 (rnd-float-range this 0.0 1.0))) (vector-float*! arg0 arg0 (lerp 43417.6 58982.4 f30-0)) (set! (-> arg0 y) (lerp 114688.0 116736.0 f30-0)) ) @@ -511,10 +511,10 @@ ) ;; definition for method 77 of type amphibian -(defmethod enemy-method-77 ((this amphibian) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this amphibian) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) - (let* ((v1-3 (enemy-method-120 this 3 (ash 1 (-> *amphibian-global-info* prev-blue-hit)))) + (let* ((v1-3 (rnd-bit this 3 (ash 1 (-> *amphibian-global-info* prev-blue-hit)))) (s5-1 (-> this draw art-group data (-> *amphibian-global-info* blue-hit-anim v1-3))) ) (set! (-> *amphibian-global-info* prev-blue-hit) v1-3) @@ -532,7 +532,7 @@ (let ((v1-11 0)) (when (or (zero? (-> this hit-points)) (nonzero? (-> this fated-time))) (let ((a2-5 (logior (ash 1 (-> *amphibian-global-info* prev-knocked)) 1))) - (set! v1-11 (enemy-method-120 this 3 a2-5)) + (set! v1-11 (rnd-bit this 3 a2-5)) ) ) (set! (-> *amphibian-global-info* prev-knocked) v1-11) @@ -542,7 +542,7 @@ (let ((a0-25 (-> this skel root-channel 0))) (set! (-> a0-25 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-25 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-25 param 1) (-> arg0 0)) + (set! (-> a0-25 param 1) (-> arg0 anim-speed)) (set! (-> a0-25 frame-num) 0.0) (joint-control-channel-group! a0-25 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -554,7 +554,7 @@ ) ;; definition for method 78 of type amphibian -(defmethod enemy-method-78 ((this amphibian) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this amphibian) (arg0 enemy-knocked-info)) (cond ((= (-> this incoming knocked-type) (knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -564,7 +564,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 25)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 25)) num-func-seek!) ) @@ -583,7 +583,7 @@ (let ((a0-10 (-> this skel root-channel 0))) (set! (-> a0-10 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-10 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-10 param 1) (-> arg0 0)) + (set! (-> a0-10 param 1) (-> arg0 anim-speed)) (set! (-> a0-10 frame-num) 0.0) (joint-control-channel-group! a0-10 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -599,7 +599,7 @@ (set! (-> a0-1 param 0) 1.0) (joint-control-channel-group! a0-1 (the-as art-joint-anim #f) num-func-loop!) ) - (let* ((v1-5 (get-rand-int this 2)) + (let* ((v1-5 (rnd-int-count this 2)) (s4-0 (-> this draw art-group data (-> *amphibian-global-info* jump-wind-up-anim v1-5))) ) (set! (-> this jump-anim-index) v1-5) @@ -961,14 +961,14 @@ ) ;; definition for method 55 of type amphibian -(defmethod track-target! ((this amphibian)) +(defmethod common-post ((this amphibian)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (set! (-> this prev-ry) (-> this prev-ry1)) (set! (-> this prev-ry1) (quaternion-y-angle (-> this root quat))) - ((method-of-type nav-enemy track-target!) this) + ((method-of-type nav-enemy common-post) this) (none) ) @@ -1027,7 +1027,7 @@ ) (cond ((and v1-29 (= v1-29 (-> this draw art-group data 26))) - (when (and s5-0 (zero? (get-rand-int this 5))) + (when (and s5-0 (zero? (rnd-int-count this 5))) (ja-channel-push! 1 (seconds 0.15)) (let ((s5-3 (-> this skel root-channel 0))) (set! (-> s5-3 dist) 12288.0) @@ -1128,7 +1128,7 @@ (amphibian-method-187 self) (suspend) ) - (when (enemy-method-123 self 0.2) + (when (rnd-go-idle? self 0.2) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.6)) (let ((v1-15 self)) @@ -1143,7 +1143,7 @@ (suspend) (ja :num! (seek!)) ) - (until (not (enemy-method-123 self 0.2)) + (until (not (rnd-go-idle? self 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -1198,8 +1198,8 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) - (a1-3 (-> self draw art-group data (-> *amphibian-global-info* notice-anim (get-rand-int self 2)))) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) + (a1-3 (-> self draw art-group data (-> *amphibian-global-info* notice-anim (rnd-int-count self 2)))) (gp-1 (new 'stack-no-clear 'vector)) ) (vector-! gp-1 (-> self focus-pos) (-> self root trans)) @@ -1274,7 +1274,7 @@ (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (let ((v1-8 (-> self nav))) (set! (-> v1-8 turning-acceleration) 204800.0) ) @@ -1288,8 +1288,8 @@ ) (else (vector-z-quaternion! (-> self focus-pos) (-> self root quat)) - (let ((f30-0 (get-rand-float-range self 8192.0 16384.0))) - (if (zero? (get-rand-int self 2)) + (let ((f30-0 (rnd-float-range self 8192.0 16384.0))) + (if (zero? (rnd-int-count self 2)) (set! f30-0 (- f30-0)) ) (vector-rotate-around-y! (-> self focus-pos) (-> self focus-pos) f30-0) @@ -1307,11 +1307,11 @@ (t9-0) ) ) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "amphib-hit") ) ) @@ -1332,7 +1332,7 @@ ) (else (let ((v1-22 (>= (vector-dot s5-0 gp-0) 0.0))) - (if (logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + (if (logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (set! v1-22 (not v1-22)) ) (if v1-22 @@ -1376,7 +1376,7 @@ :trans (-> (method-of-type nav-enemy stare) trans) :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((gp-0 (get-rand-int-range self 1 3))) + (let ((gp-0 (rnd-int-range self 1 3))) (dotimes (s5-0 gp-0) (ja-no-eval :group! amphibian-idle-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) @@ -1399,8 +1399,8 @@ (t9-0) ) ) - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (go-virtual attack-spin) ) (let ((a0-2 (get-enemy-target self))) @@ -1441,7 +1441,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (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*) @@ -1467,15 +1467,15 @@ ) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "amphib-hit") ) ) @@ -1504,7 +1504,7 @@ (set! (-> v1-3 turning-acceleration) 204800.0) ) 0 - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (let ((v1-7 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-7 enemy-flags))) (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-7 enemy-flags)))) @@ -1520,15 +1520,15 @@ (logior! (-> self focus-status) (focus-status dangerous)) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "amphib-hit") ) ) @@ -1562,7 +1562,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) @@ -1572,15 +1572,15 @@ (nav-enemy-method-167 self) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "amphib-hit") ) ) @@ -1600,7 +1600,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (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*) @@ -1630,15 +1630,15 @@ ) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "amphib-hit") ) ) @@ -1659,7 +1659,7 @@ ) (else (let ((v1-22 (>= (vector-dot s5-0 gp-0) 0.0))) - (if (logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + (if (logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (set! v1-22 (not v1-22)) ) (if v1-22 @@ -1709,7 +1709,7 @@ (nav-enemy-method-167 self) (set! (-> self tongue-scale) 0.0) (set! (-> self tongue-mode) (the-as uint 0)) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (sound-play "tongue-warn") (let ((gp-1 (new 'stack-no-clear 'amphibian-tongue-attack-info))) (amphibian-method-185 self gp-1) @@ -1719,7 +1719,7 @@ ) :exit (behavior () (set! (-> self draw bounds w) 22528.0) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () (let ((v1-0 (-> self tongue-mode))) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/centurion_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/centurion_REF.gc index b24a525969..6295d9fba1 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/centurion_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/centurion_REF.gc @@ -689,7 +689,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info victory-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -727,7 +727,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! centurion-idle-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -847,7 +847,7 @@ (set! (-> self can-take-damage?) #f) (set! (-> self root root-prim specific 0) (-> self root root-prim specific 1)) (centurion-shield-big) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -950,7 +950,7 @@ (collide-action solid) ) (set! (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 3 local-sphere w) 5120.0) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -968,7 +968,7 @@ ) ;; definition for method 132 of type centurion -(defmethod dispose! ((this centurion)) +(defmethod dying ((this centurion)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (play-communicator-speech! (-> *talker-speech* 58)) (call-parent-method this) @@ -977,7 +977,7 @@ ;; definition for method 55 of type centurion ;; INFO: Used lq/sq -(defmethod track-target! ((this centurion)) +(defmethod common-post ((this centurion)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -1068,7 +1068,7 @@ ) (logior! (-> this skel status) (joint-control-status sync-math)) (los-control-method-9 (-> this los) (the-as process-focusable #f) (the-as vector #f) 2048.0) - (let ((t9-12 (method-of-type nav-enemy track-target!))) + (let ((t9-12 (method-of-type nav-enemy common-post))) (t9-12 this) ) (when (not (logtest? (-> this draw status) (draw-control-status no-draw))) @@ -1085,16 +1085,16 @@ (set! (-> s5-1 trans quad) a2-11) ) (let ((s4-1 (new 'stack-no-clear 'matrix))) - (if (logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) (vector-negate-in-place! (the-as vector (-> s5-1 vector))) ) - (matrix-rotate-y! s4-1 (if (logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + (matrix-rotate-y! s4-1 (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) 2548.6223 -2548.6223 ) ) (matrix*! s5-1 s4-1 s5-1) - (matrix-rotate-z! s4-1 (if (logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + (matrix-rotate-z! s4-1 (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) 691.76886 -691.76886 ) @@ -1104,7 +1104,7 @@ (let ((a1-20 (-> s5-1 trans))) (let ((v1-143 (-> s5-1 trans))) (let ((a0-25 (-> s5-1 vector))) - (let ((a2-18 (the-as float (if (logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + (let ((a2-18 (the-as float (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) -997237719 #x43a3d70a ) @@ -1260,7 +1260,7 @@ ) ) :code (behavior () - (get-rand-float-range self 0.9 1.1) + (rnd-float-range self 0.9 1.1) -1 0.0 1.0 @@ -1272,7 +1272,7 @@ ) (let ((f30-0 24576.0)) (until #f - (set-vector! s5-0 (get-rand-float-range self -1.0 1.0) 0.0 (get-rand-float-range self -1.0 1.0) 1.0) + (set-vector! s5-0 (rnd-float-range self -1.0 1.0) 0.0 (rnd-float-range self -1.0 1.0) 1.0) (vector-normalize! s5-0 f30-0) (vector+! gp-0 (-> self root trans) s5-0) (if (centurion-method-182 self gp-0) @@ -1367,7 +1367,7 @@ ) ;; definition for method 77 of type centurion -(defmethod enemy-method-77 ((this centurion) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this centurion) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (ja-channel-push! 1 (seconds 0.17)) @@ -1376,7 +1376,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 5)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 5)) num-func-seek!) ) @@ -1387,14 +1387,14 @@ (((knocked-type knocked-type-4)) (ja-channel-push! 1 (seconds 0.1)) (let* ((a2-1 (ash 1 (-> *centurion-global-info* prev-yellow-hit))) - (v1-18 (enemy-method-120 this 1 a2-1)) + (v1-18 (rnd-bit this 1 a2-1)) (a1-8 (-> this draw art-group data (-> *centurion-global-info* yellow-hit-anim v1-18))) ) (set! (-> *centurion-global-info* prev-yellow-hit) v1-18) (let ((a0-15 (-> this skel root-channel 0))) (set! (-> a0-15 frame-group) (the-as art-joint-anim a1-8)) (set! (-> a0-15 param 0) (the float (+ (-> (the-as art-joint-anim a1-8) frames num-frames) -1))) - (set! (-> a0-15 param 1) (-> arg0 0)) + (set! (-> a0-15 param 1) (-> arg0 anim-speed)) (set! (-> a0-15 frame-num) 0.0) (joint-control-channel-group! a0-15 (the-as art-joint-anim a1-8) num-func-seek!) ) @@ -1402,7 +1402,7 @@ ) (((knocked-type knocked-type-6)) (let* ((a2-3 (ash 1 (-> *centurion-global-info* prev-blue-hit))) - (v1-27 (enemy-method-120 this 3 a2-3)) + (v1-27 (rnd-bit this 3 a2-3)) (a1-13 (-> this draw art-group data (-> *centurion-global-info* blue-hit-anim v1-27))) ) (set! (-> *centurion-global-info* prev-blue-hit) v1-27) @@ -1426,7 +1426,7 @@ (let ((a0-30 (-> this skel root-channel 0))) (set! (-> a0-30 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-30 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-30 param 1) (-> arg0 0)) + (set! (-> a0-30 param 1) (-> arg0 anim-speed)) (set! (-> a0-30 frame-num) 0.0) (joint-control-channel-group! a0-30 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -1439,7 +1439,7 @@ ) ;; definition for method 78 of type centurion -(defmethod enemy-method-78 ((this centurion) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this centurion) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (ja-channel-push! 1 (seconds 0.17)) @@ -1448,7 +1448,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 33)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 33)) num-func-seek!) ) @@ -1463,7 +1463,7 @@ (let ((a0-5 (-> this skel root-channel 0))) (set! (-> a0-5 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (joint-control-channel-group! a0-5 (the-as art-joint-anim s4-0) num-func-seek!) ) ) @@ -1477,7 +1477,7 @@ (set! (-> a0-7 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 22)) frames num-frames) -1)) ) - (set! (-> a0-7 param 1) (-> arg0 0)) + (set! (-> a0-7 param 1) (-> arg0 anim-speed)) (joint-control-channel-group! a0-7 (the-as art-joint-anim (-> this draw art-group data 22)) num-func-seek!) ) #t diff --git a/test/decompiler/reference/jak2/levels/common/enemy/flitter_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/flitter_REF.gc index ce74351c1b..89695a68ac 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/flitter_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/flitter_REF.gc @@ -580,7 +580,7 @@ ) ;; definition for method 77 of type flitter -(defmethod enemy-method-77 ((this flitter) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this flitter) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (let ((a0-2 (-> this skel root-channel 0))) @@ -588,7 +588,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 20)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 20)) num-func-seek!) ) @@ -623,7 +623,7 @@ ) ;; definition for method 78 of type flitter -(defmethod enemy-method-78 ((this flitter) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this flitter) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -660,8 +660,8 @@ (defstate ambush (flitter) :virtual #t :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -735,7 +735,7 @@ ) ) (let ((gp-3 (current-time))) - (until (time-elapsed? gp-3 (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) + (until (time-elapsed? gp-3 (the int (* 300.0 (rnd-float-range self 0.0 0.6)))) (suspend) ) ) @@ -761,11 +761,11 @@ (set! (-> v1-3 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-3 enemy-flags)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set-time! (-> self state-time)) (let ((gp-0 (-> self root))) (vector-reset! (-> gp-0 transv)) - (set! (-> gp-0 transv y) (* 4096.0 (get-rand-float-range self 34.0 38.0))) + (set! (-> gp-0 transv y) (* 4096.0 (rnd-float-range self 34.0 38.0))) ) ) :code (behavior () @@ -995,7 +995,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (until #f (when (not (enemy-method-96 self 2730.6667 #t)) (let ((v1-5 self)) @@ -1104,12 +1104,12 @@ (ja-channel-push! 1 (seconds 0.2)) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info run-anim)) - :num! (seek! max (get-rand-float-range self 0.9 1.1)) + :num! (seek! max (rnd-float-range self 0.9 1.1)) :frame-num 0.0 ) (until (ja-done? 0) (suspend) - (ja :num! (seek! max (get-rand-float-range self 0.9 1.1))) + (ja :num! (seek! max (rnd-float-range self 0.9 1.1))) ) ) #f @@ -1203,7 +1203,7 @@ ) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1271,11 +1271,11 @@ ) 0 (ja-channel-push! 1 (seconds 0.1)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) - (dotimes (gp-1 (get-rand-int self 3)) + (dotimes (gp-1 (rnd-int-count self 3)) (ja-no-eval :group! flitter-idle-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -1297,7 +1297,7 @@ ) ;; definition for method 132 of type flitter -(defmethod dispose! ((this flitter)) +(defmethod dying ((this flitter)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (when (-> this minimap) (logior! (-> this minimap flags) (minimap-flag fade-out)) 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 d62f3b55ed..aff6595ab3 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 @@ -368,12 +368,12 @@ ;; definition for method 55 of type fodder ;; WARN: Return type mismatch object vs none. -(defmethod track-target! ((this fodder)) +(defmethod common-post ((this fodder)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((parent-method (method-of-type nav-enemy track-target!))) + (let ((parent-method (method-of-type nav-enemy common-post))) (parent-method this) ) (let ((proc (the-as process-drawable #f))) @@ -409,7 +409,7 @@ ) ) ) - ((logtest? (-> this enemy-flags) (enemy-flag lock-focus)) + ((logtest? (-> this enemy-flags) (enemy-flag look-at-focus)) (look-at-position! this (the-as vector #f)) ) ) @@ -439,10 +439,10 @@ (func) ) ) - (logclear! (-> self enemy-flags) (enemy-flag spawn-gem chase-startup use-notice-distance)) + (logclear! (-> self enemy-flags) (enemy-flag notice alert cam-attack-mode)) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info walk-anim)) :num! (seek! max f30-0) @@ -452,7 +452,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (when (enemy-method-123 self 0.8) + (when (rnd-go-idle? self 0.8) (let ((_self self)) (set! (-> _self enemy-flags) (the-as enemy-flag (logclear (-> _self enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> _self nav callback-info) *nav-enemy-null-callback-info*) @@ -510,7 +510,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) (gp-0 (new 'stack-no-clear 'vector)) ) (stop-looking-at-target! self) @@ -569,9 +569,9 @@ ) ) (label cfg-22) - (get-rand-float-range self 0.8 1.2) + (rnd-float-range self 0.8 1.2) (new 'stack-no-clear 'vector) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (stop-looking-at-target! self) (if (nonzero? (-> self left-eye)) (shut-down (-> self left-eye)) @@ -647,7 +647,7 @@ ) 0 (fodder-method-181 self #f) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -677,7 +677,7 @@ (ja-channel-push! 1 (seconds 0.08)) (ja :group! (-> self draw art-group data (-> self enemy-info idle-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -816,7 +816,7 @@ ) :code (behavior () (fodder-method-182 self) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -888,8 +888,8 @@ (ja-channel-push! 1 (seconds 0.1)) ) ) - (let ((s5-0 (get-rand-int self 8)) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((s5-0 (rnd-int-count self 8)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (while (nonzero? s5-0) (+! s5-0 -1) @@ -917,7 +917,7 @@ (ja-channel-push! 1 (seconds 0.1)) ) ) - (let ((f30-2 (get-rand-float-range self 0.9 1.1))) + (let ((f30-2 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info victory-anim)) :num! (seek! max f30-2) :frame-num 0.0 @@ -934,11 +934,11 @@ ) ;; definition for method 77 of type fodder -(defmethod enemy-method-77 ((this fodder) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this fodder) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (let* ((a2-0 (ash 1 (-> *fodder-global-info* prev-blue-hit))) - (v1-3 (enemy-method-120 this 3 a2-0)) + (v1-3 (rnd-bit this 3 a2-0)) (s5-1 (-> this draw art-group data (-> *fodder-global-info* blue-hit-anim v1-3 anim-index))) ) (set! (-> *fodder-global-info* prev-blue-hit) v1-3) @@ -967,7 +967,7 @@ (let ((a0-20 (-> this skel root-channel 0))) (set! (-> a0-20 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-20 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-20 param 1) (-> arg0 0)) + (set! (-> a0-20 param 1) (-> arg0 anim-speed)) (set! (-> a0-20 frame-num) 0.0) (joint-control-channel-group! a0-20 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -978,7 +978,7 @@ ) ;; definition for method 78 of type fodder -(defmethod enemy-method-78 ((this fodder) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this fodder) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) #f @@ -989,7 +989,7 @@ ) (set! (-> a0-3 frame-group) (the-as art-joint-anim v1-5)) (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim v1-5) frames num-frames) -1))) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim v1-5) num-func-seek!) ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/grenadier_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/grenadier_REF.gc index 921effbe69..d8bee2f22d 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/grenadier_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/grenadier_REF.gc @@ -438,11 +438,11 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let* ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let* ((f30-0 (rnd-float-range self 0.9 1.1)) (a0-2 '((grenadier-patrol-ja) (grenadier-patrol1-ja))) (gp-0 ((method-of-type (rtype-of a0-2) length) a0-2)) (s5-0 (new 'static 'array int64 2 9 10)) - (s4-0 (-> (the-as (pointer int32) (+ (* (get-rand-int self gp-0) 8) (the-as int s5-0))))) + (s4-0 (-> (the-as (pointer int32) (+ (* (rnd-int-count self gp-0) 8) (the-as int s5-0))))) ) (until #f (ja-no-eval :group! (-> self draw art-group data s4-0) :num! (seek! max f30-0) :frame-num 0.0) @@ -450,7 +450,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (when (enemy-method-123 self 0.2) + (when (rnd-go-idle? self 0.2) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.6)) (let ((v1-38 self)) @@ -467,7 +467,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (until (not (enemy-method-123 self 0.2)) + (until (not (rnd-go-idle? self 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -486,7 +486,7 @@ ) 0 (ja-no-eval :num! (loop!)) - (set! s4-0 (-> (the-as (pointer int32) (+ (* (get-rand-int self gp-0) 8) (the-as int s5-0))))) + (set! s4-0 (-> (the-as (pointer int32) (+ (* (rnd-int-count self gp-0) 8) (the-as int s5-0))))) (ja-channel-push! 1 (seconds 0.6)) (ja-no-eval :group! (-> self draw art-group data s4-0) :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -524,7 +524,7 @@ ) ) (grenadier-method-181 self) - (look-at-target! self (enemy-flag death-start)) + (look-at-target! self (enemy-flag look-at-move-dest)) (logclear! (-> self status-flags) (grenadier-flags grflags-0)) ) :trans (behavior () @@ -592,10 +592,10 @@ draw art-group data - (-> (the-as (pointer int32) (+ (* (get-rand-int self a1-3) 8) (the-as int gp-0)))) + (-> (the-as (pointer int32) (+ (* (rnd-int-count self a1-3) 8) (the-as int gp-0)))) ) ) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (until #f (ja-no-eval :group! gp-1 :num! (seek! max f30-0) :frame-num 0.0) @@ -702,7 +702,7 @@ (set! (-> v1-3 prim-core action) (collide-action)) (set! (-> v1-3 local-sphere w) 4096.0) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -739,7 +739,7 @@ ;; ERROR: function was not converted to expressions. Cannot decompile. ;; definition for method 78 of type grenadier -(defmethod enemy-method-78 ((this grenadier) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this grenadier) (arg0 enemy-knocked-info)) (cond ((= (-> this incoming knocked-type) (knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -748,7 +748,7 @@ (let ((a0-3 (-> this skel root-channel 0))) (set! (-> a0-3 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -766,7 +766,7 @@ ) (set! (-> a0-9 frame-group) (the-as art-joint-anim a1-4)) (set! (-> a0-9 param 0) (the float (+ (-> (the-as art-joint-anim a1-4) frames num-frames) -1))) - (set! (-> a0-9 param 1) (-> arg0 0)) + (set! (-> a0-9 param 1) (-> arg0 anim-speed)) (set! (-> a0-9 frame-num) 0.0) (joint-control-channel-group! a0-9 (the-as art-joint-anim a1-4) num-func-seek!) ) @@ -779,7 +779,7 @@ (set! (-> a0-11 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 33)) frames num-frames) -1)) ) - (set! (-> a0-11 param 1) (-> arg0 0)) + (set! (-> a0-11 param 1) (-> arg0 anim-speed)) (set! (-> a0-11 frame-num) 0.0) (joint-control-channel-group! a0-11 (the-as art-joint-anim (-> this draw art-group data 33)) num-func-seek!) ) @@ -869,7 +869,7 @@ (set! (-> v1-11 attack-id) a0-19) (set! (-> self attack-id) a0-19) ) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) ) :exit (behavior () (if (logtest? (enemy-flag enemy-flag43) (-> self enemy-flags)) @@ -877,13 +877,13 @@ (logclear! (-> self nav flags) (nav-control-flag update-heading-from-facing)) ) (logclear! (-> self status-flags) (grenadier-flags grflags-1)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (let ((f28-0 (vector-length (-> self root transv)))) (ja-channel-push! 1 (seconds 0.2)) (when (< 4096.0 f28-0) @@ -1046,29 +1046,29 @@ (suspend) (ja :num! (seek!)) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-43 (-> self enemy-flags))) - (if (logtest? v1-43 (enemy-flag checking-water)) - (set! v1-44 (logior v1-43 (enemy-flag enable-on-active))) - (set! v1-44 (logclear v1-43 (enemy-flag enable-on-active))) + (if (logtest? v1-43 (enemy-flag vulnerable-backup)) + (set! v1-44 (logior v1-43 (enemy-flag vulnerable))) + (set! v1-44 (logclear v1-43 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-44) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-51 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-51) - (set! v1-52 (logior (enemy-flag check-water-backup) v1-51)) - (set! v1-52 (logclear v1-51 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-51) + (set! v1-52 (logior (enemy-flag trackable) v1-51)) + (set! v1-52 (logclear v1-51 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-52) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (cond ((= (-> self focus aware) (enemy-aware enemy-aware-3)) @@ -1110,7 +1110,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (cond ((zero? (rand-vu-int-range 0 1)) (ja-no-eval :group! grenadier-victory-ja :num! (seek! max f30-0) :frame-num 0.0) @@ -1184,12 +1184,12 @@ ) ;; definition for method 55 of type grenadier -(defmethod track-target! ((this grenadier)) +(defmethod common-post ((this grenadier)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (let ((a1-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 34)))) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/grunt_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/grunt_REF.gc index 313ca9658d..3bbf812950 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/grunt_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/grunt_REF.gc @@ -82,7 +82,7 @@ (unknown-byte-n1k2n3 int8 :offset 636) (unknown-byte-m2j342 int8 :offset 637) (unknown-byte-1ji2n3 int8 :offset 638) - (unknown-byte-n123n int8 :offset 639) + (unknown-byte-n123n uint8 :offset 639) (state-timeout2 uint64) (next-warn-time time-frame) (dest vector :inline) @@ -122,7 +122,7 @@ (format #t "~2Tuse-charge-anim-index: ~D~%" (-> this unknown-byte-n1k2n3)) (format #t "~2Tknocked-anim-index: ~D~%" (-> this unknown-byte-m2j342)) (format #t "~2Tjumping-ambush-path-pt: ~D~%" (-> this unknown-byte-1ji2n3)) - (format #t "~2Tgrunt-flags: ~D~%" (-> this stack 511)) + (format #t "~2Tgrunt-flags: ~D~%" (-> this unknown-byte-n123n)) (format #t "~2Tstate-timeout2: ~D~%" (-> this state-timeout2)) (format #t "~2Tnext-warn-time: ~D~%" (-> this next-warn-time)) (format #t "~2Tdest: #~%" (-> this dest)) @@ -399,15 +399,15 @@ (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (cond @@ -420,7 +420,7 @@ ) ) ) - (zero? (get-rand-int this 3)) + (zero? (rnd-int-count this 3)) (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) (f1-0 32768.0) ) @@ -472,8 +472,8 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -573,7 +573,9 @@ (until #f (let ((gp-0 (new 'stack-no-clear 'vector))) (get-point-in-path! (-> self intro-path) gp-0 1.0 'interp) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (let ((v1-5 (process->ppointer self))) (set! (-> a1-1 from) v1-5) @@ -607,7 +609,9 @@ (until #f (let ((gp-0 (new 'stack-no-clear 'vector))) (get-point-in-path! (-> self intro-path) gp-0 (the float (-> self unknown-byte-1ji2n3)) 'interp) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (let ((v1-9 (process->ppointer self))) (set! (-> a1-1 from) v1-9) @@ -644,15 +648,15 @@ ) ) ) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f - (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (get-rand-int self 4))) + (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (rnd-int-count self 4))) (let ((v1-28 (-> self nav))) (set! (-> v1-28 target-speed) (-> self patrol-anim travel-speed)) ) 0 (let ((gp-0 (-> self draw art-group data (-> self patrol-anim anim-index))) - (s5-0 (get-rand-int-range self 1 8)) + (s5-0 (rnd-int-range self 1 8)) ) (let ((v1-37 (ja-group))) (if (not (and v1-37 (= v1-37 gp-0))) @@ -676,7 +680,7 @@ ) 0 (let ((gp-1 (-> self draw art-group data (-> self patrol-anim anim-index))) - (s5-1 (get-rand-int-range self 2 5)) + (s5-1 (rnd-int-range self 2 5)) ) (ja-no-eval :group! gp-1 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -693,7 +697,7 @@ ) ) ) - (when (zero? (get-rand-int self 3)) + (when (zero? (rnd-int-count self 3)) (let ((v1-107 self)) (set! (-> v1-107 enemy-flags) (the-as enemy-flag (logclear (-> v1-107 enemy-flags) (enemy-flag enemy-flag36))) @@ -711,7 +715,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (until (not (enemy-method-123 self 0.2)) + (until (not (rnd-go-idle? self 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -808,7 +812,7 @@ ) ) (sound-play "grunt-warn") - (set! (-> self next-warn-time) (+ gp-0 (get-rand-int-range self 300 360))) + (set! (-> self next-warn-time) (+ gp-0 (rnd-int-range self 300 360))) ) ) ) @@ -827,7 +831,7 @@ ) ) ) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (let ((v1-19 (-> self unknown-byte-n1k2n3))) (cond ((>= v1-19 0) @@ -835,7 +839,7 @@ (set! (-> self unknown-byte-n1k2n3) -1) ) (else - (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (get-rand-int self 3))) + (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (rnd-int-count self 3))) ) ) ) @@ -873,7 +877,7 @@ (set! (-> v1-1 speed) (-> self enemy-info run-travel-speed)) ) 0 - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (set! (-> self root penetrate-using) (penetrate generic-attack lunge)) (enemy-method-49 self) @@ -885,21 +889,21 @@ ) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () (enemy-method-49 self) - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "grunt-hit") ) ) :code (behavior () - (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (get-rand-int self 2))) + (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (rnd-int-count self 2))) (let ((v1-5 (-> self nav))) (set! (-> v1-5 target-speed) (-> self attack-anim travel-speed)) ) @@ -909,7 +913,7 @@ ) 0 (let ((gp-0 (-> self draw art-group data (-> self attack-anim anim-index))) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (let ((v1-17 (ja-group))) (if (not (and v1-17 (= v1-17 gp-0))) @@ -965,7 +969,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (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*) @@ -991,22 +995,22 @@ ) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :trans (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) (sound-play "grunt-hit") ) ) :code (behavior () - (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (get-rand-int self 2))) + (set! (-> self attack-anim) (-> *grunt-global-info* attack-anim (rnd-int-count self 2))) (let ((gp-0 (-> self draw art-group data (-> self attack-anim anim-index))) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (let ((v1-13 (ja-group))) (if (not (and v1-13 (= v1-13 gp-0))) @@ -1053,7 +1057,7 @@ ) ) (until #f - (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (get-rand-int self 3))) + (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (rnd-int-count self 3))) (let ((v1-22 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-22 enemy-flags))) (set! (-> v1-22 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-22 enemy-flags)))) @@ -1084,8 +1088,8 @@ (ja-channel-push! 1 (seconds 0.1)) ) ) - (let ((s5-0 (get-rand-int self 8)) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((s5-0 (rnd-int-count self 8)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (while (nonzero? s5-0) (+! s5-0 -1) @@ -1114,7 +1118,7 @@ (ja-channel-push! 1 (seconds 0.1)) ) ) - (let ((f30-2 (get-rand-float-range self 0.9 1.1))) + (let ((f30-2 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! grunt-celebrate-start-ja :num! (seek! max f30-2) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -1149,8 +1153,8 @@ ) ) ) - (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (get-rand-int self 4))) - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (rnd-int-count self 4))) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self patrol-anim anim-index))) ) (let ((v1-28 self)) @@ -1203,12 +1207,12 @@ (suspend) (ja-eval) ) - (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (get-rand-int self 4))) + (set! (-> self patrol-anim) (-> *grunt-global-info* patrol-anim (rnd-int-count self 4))) (let ((v1-14 (-> self nav))) (set! (-> v1-14 target-speed) (-> self patrol-anim travel-speed)) ) 0 - (let ((f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) (gp-0 (-> self draw art-group data (-> self patrol-anim anim-index))) ) (let ((v1-24 (ja-group))) @@ -1229,7 +1233,7 @@ ) ;; definition for method 77 of type grunt -(defmethod enemy-method-77 ((this grunt) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this grunt) (arg0 enemy-knocked-info)) (local-vars (v1-72 int) (a2-3 int) (a2-5 int)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) @@ -1249,10 +1253,10 @@ (set! a2-3 (logior v1-2 8)) ) ) - (let ((s4-0 (enemy-method-120 this 4 a2-3))) + (let ((s4-0 (rnd-bit this 4 a2-3))) (set! (-> *grunt-global-info* prev-yellow-hit-anim-index) s4-0) (set! (-> this yellow-hit-anim) (-> *grunt-global-info* yellow-hit-anim s4-0)) - (let ((v1-11 (get-rand-int this 3))) + (let ((v1-11 (rnd-int-count this 3))) (if (= s4-0 3) (set! v1-11 2) ) @@ -1264,7 +1268,7 @@ (let ((a0-19 (-> this skel root-channel 0))) (set! (-> a0-19 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-19 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-19 param 1) (-> arg0 0)) + (set! (-> a0-19 param 1) (-> arg0 anim-speed)) (set! (-> a0-19 frame-num) 0.0) (joint-control-channel-group! a0-19 (the-as art-joint-anim s4-1) num-func-seek!) ) @@ -1285,10 +1289,10 @@ ) ) (if (>= (-> this incoming blue-juggle-count) (the-as uint 2)) - (set! (-> this unknown-byte-n123n) (the-as int (logior (-> this stack 511) 2))) + (logior! (-> this unknown-byte-n123n) 2) ) (cond - ((and (not s4-2) (logtest? (-> this stack 511) 2)) + ((and (not s4-2) (logtest? (-> this unknown-byte-n123n) 2)) (set! s4-2 #t) (ja-channel-push! 1 (seconds 0.17)) ) @@ -1311,18 +1315,18 @@ (set! a2-5 (logior v1-42 7)) ) ) - (let ((v1-46 (enemy-method-120 this 6 a2-5))) + (let ((v1-46 (rnd-bit this 6 a2-5))) (set! (-> *grunt-global-info* prev-blue-hit-anim-index) v1-46) (set! (-> this blue-hit-anim) (-> *grunt-global-info* blue-hit-anim v1-46)) ) (let ((a2-6 0)) - (when (not (logtest? (-> this stack 511) 2)) + (when (not (logtest? (-> this unknown-byte-n123n) 2)) (if s4-2 (set! a2-6 (logior a2-6 3)) (set! a2-6 (logior a2-6 4)) ) ) - (set! (-> this unknown-byte-n1k2n3) (enemy-method-120 this 3 a2-6)) + (set! (-> this unknown-byte-n1k2n3) (rnd-bit this 3 a2-6)) ) ) (let ((a1-26 (-> this draw art-group data (-> this blue-hit-anim anim-index))) @@ -1330,7 +1334,7 @@ ) (set! (-> a0-51 frame-group) (the-as art-joint-anim a1-26)) (set! (-> a0-51 param 0) (the float (+ (-> (the-as art-joint-anim a1-26) frames num-frames) -1))) - (set! (-> a0-51 param 1) (-> arg0 0)) + (set! (-> a0-51 param 1) (-> arg0 anim-speed)) (set! (-> a0-51 frame-num) 0.0) (joint-control-channel-group! a0-51 (the-as art-joint-anim a1-26) num-func-seek!) ) @@ -1351,7 +1355,7 @@ (set! s4-3 (logior s4-3 4)) ) ) - (set! v1-72 (enemy-method-120 this 3 s4-3)) + (set! v1-72 (rnd-bit this 3 s4-3)) ) ) ) @@ -1363,7 +1367,7 @@ (let ((a0-68 (-> this skel root-channel 0))) (set! (-> a0-68 frame-group) (the-as art-joint-anim s4-4)) (set! (-> a0-68 param 0) (the float (+ (-> (the-as art-joint-anim s4-4) frames num-frames) -1))) - (set! (-> a0-68 param 1) (-> arg0 0)) + (set! (-> a0-68 param 1) (-> arg0 anim-speed)) (set! (-> a0-68 frame-num) 0.0) (joint-control-channel-group! a0-68 (the-as art-joint-anim s4-4) num-func-seek!) ) @@ -1374,34 +1378,35 @@ ) ;; definition for method 78 of type grunt -(defmethod enemy-method-78 ((this grunt) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this grunt) (arg0 enemy-knocked-info)) (cond ((= (-> this incoming knocked-type) (knocked-type knocked-type-6)) - (when (or (logtest? (-> this stack 511) 2) (let ((v1-7 (if (> (-> this skel active-channels) 0) - (-> this skel root-channel 0 frame-group) - ) - ) - ) - (not (and v1-7 (or (= v1-7 (-> this draw art-group data 16)) - (= v1-7 (-> this draw art-group data 38)) - (= v1-7 (-> this draw art-group data 39)) - (= v1-7 (-> this draw art-group data 40)) - ) - ) - ) - ) + (when (or (logtest? (-> this unknown-byte-n123n) 2) + (let ((v1-7 (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + (not (and v1-7 (or (= v1-7 (-> this draw art-group data 16)) + (= v1-7 (-> this draw art-group data 38)) + (= v1-7 (-> this draw art-group data 39)) + (= v1-7 (-> this draw art-group data 40)) + ) + ) + ) + ) ) (let ((s4-0 (-> this draw art-group data 44))) (ja-channel-push! 1 (seconds 0.17)) (let ((a0-16 (-> this skel root-channel 0))) (set! (-> a0-16 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-16 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-16 param 1) (-> arg0 0)) + (set! (-> a0-16 param 1) (-> arg0 anim-speed)) (set! (-> a0-16 frame-num) 0.0) (joint-control-channel-group! a0-16 (the-as art-joint-anim s4-0) num-func-seek!) ) ) - (set! (-> this unknown-byte-n123n) (the-as int (logand -3 (-> this stack 511)))) + (logand! (-> this unknown-byte-n123n) -3) #t ) ) @@ -1417,7 +1422,7 @@ ) (set! (-> a0-23 frame-group) (the-as art-joint-anim a1-6)) (set! (-> a0-23 param 0) (the float (+ (-> (the-as art-joint-anim a1-6) frames num-frames) -1))) - (set! (-> a0-23 param 1) (-> arg0 0)) + (set! (-> a0-23 param 1) (-> arg0 anim-speed)) (set! (-> a0-23 frame-num) 0.0) (joint-control-channel-group! a0-23 (the-as art-joint-anim a1-6) num-func-seek!) ) @@ -1435,7 +1440,7 @@ (let ((s5-0 (handle->process (-> self focus handle)))) (when s5-0 (let ((gp-0 (get-trans (the-as process-focusable s5-0) 0))) - (when (and (or (not (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice))) + (when (and (or (not (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance))) (>= 163840.0 (vector-vector-distance (-> self root trans) gp-0)) ) (or (not (logtest? (-> self fact enemy-options) (enemy-option user8))) @@ -1446,7 +1451,7 @@ ) (cond ((and (logtest? (-> self fact enemy-options) (enemy-option user9)) - (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logtest? (-> self enemy-flags) (enemy-flag use-notice-distance)) ) (let ((s5-1 (new 'stack-no-clear 'vector))) (vector-! s5-1 gp-0 (-> self root trans)) @@ -1475,7 +1480,7 @@ ) ;; definition for method 132 of type grunt -(defmethod dispose! ((this grunt)) +(defmethod dying ((this grunt)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (when (-> this minimap) (logior! (-> this minimap flags) (minimap-flag fade-out)) @@ -1621,16 +1626,16 @@ 0 (set-gravity-length (-> this root dynam) 573440.0) (let ((s5-2 *grunt-global-info*)) - (set! (-> this patrol-anim) (-> s5-2 patrol-anim (get-rand-int this 4))) - (set! (-> this charge-anim) (-> s5-2 charge-anim (get-rand-int this 3))) - (set! (-> this attack-anim) (-> s5-2 attack-anim (get-rand-int this 2))) + (set! (-> this patrol-anim) (-> s5-2 patrol-anim (rnd-int-count this 4))) + (set! (-> this charge-anim) (-> s5-2 charge-anim (rnd-int-count this 3))) + (set! (-> this attack-anim) (-> s5-2 attack-anim (rnd-int-count this 2))) ) (set! (-> this unknown-byte-n1k2n3) -1) - (if (zero? (get-rand-int this 2)) - (set! (-> this unknown-byte-n123n) (the-as int (logior (-> this stack 511) 1))) + (if (zero? (rnd-int-count this 2)) + (logior! (-> this unknown-byte-n123n) 1) ) - (if (zero? (get-rand-int this 2)) - (set! (-> this unknown-byte-n123n) (the-as int (logior (-> this stack 511) 4))) + (if (zero? (rnd-int-count this 2)) + (logior! (-> this unknown-byte-n123n) 4) ) (set! (-> this intro-path) (new 'process 'path-control this 'intro 0.0 (the-as entity #f) #t)) (add-connection 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 bba55038f2..bf444d9ece 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 @@ -1486,7 +1486,7 @@ (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)) (set! (-> s0-0 quad) (-> this root trans quad)) (cond - ((logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) (let ((a1-6 s0-0)) (let ((v1-14 s0-0)) (let ((a0-9 s4-0)) @@ -1578,12 +1578,12 @@ ;; definition for method 55 of type crimson-guard-level ;; WARN: Return type mismatch object vs none. -(defmethod track-target! ((this crimson-guard-level)) +(defmethod common-post ((this crimson-guard-level)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (if (-> this joint-enable) @@ -1669,13 +1669,13 @@ :enter (behavior () (talker-spawn-func (-> *talker-speech* 10) *entity-pool* (target-pos 0) (the-as region #f)) (set-time! (-> self state-time)) - (let ((v1-4 (logior (-> self enemy-flags) (enemy-flag use-notice-distance)))) - (set! (-> self enemy-flags) (logclear v1-4 (enemy-flag called-dying))) + (let ((v1-4 (logior (-> self enemy-flags) (enemy-flag cam-attack-mode)))) + (set! (-> self enemy-flags) (logclear v1-4 (enemy-flag use-trigger))) ) (logclear! (-> self mask) (process-mask actor-pause)) - (look-at-target! self (enemy-flag lock-focus)) - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (look-at-target! self (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-1 (-> self on-notice))) (if gp-1 (script-eval gp-1 :vector (-> self root trans)) @@ -1683,7 +1683,7 @@ ) ) (let ((gp-2 (-> self focus aware))) - (when (logtest? (-> self enemy-flags) (enemy-flag chase-startup)) + (when (logtest? (-> self enemy-flags) (enemy-flag alert)) (cond ((and (= gp-2 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) @@ -1701,11 +1701,11 @@ ) ) (speech-control-method-12 *speech-control* self (speech-type speech-type-3)) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logior! (-> self enemy-flags) (enemy-flag alert)) ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) (gp-0 (new 'stack-no-clear 'vector)) ) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) @@ -1747,7 +1747,7 @@ (if (logtest? (-> self flags) 4) (go-virtual gun-shoot) ) - (set! (-> self reaction-time) (the-as time-frame (the int (* 300.0 (get-rand-float-range self 1.0 3.0))))) + (set! (-> self reaction-time) (the-as time-frame (the int (* 300.0 (rnd-float-range self 1.0 3.0))))) ) :exit (behavior () '() @@ -1813,7 +1813,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-1 (* 2.0 (get-rand-float-range self 0.9 1.1)))) + (let ((f30-1 (* 2.0 (rnd-float-range self 0.9 1.1)))) (until #f (suspend) (ja :num! (loop! f30-1)) @@ -1830,7 +1830,7 @@ :enter (behavior () ((-> (method-of-type nav-enemy hostile) enter)) (set-time! (-> self state-time)) - (set! (-> self reaction-time) (the-as time-frame (the int (* 300.0 (get-rand-float-range self 0.5 1.5))))) + (set! (-> self reaction-time) (the-as time-frame (the int (* 300.0 (rnd-float-range self 0.5 1.5))))) ) :exit (behavior () '() @@ -1873,7 +1873,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-1 (* 2.0 (get-rand-float-range self 0.9 1.1)))) + (let ((f30-1 (* 2.0 (rnd-float-range self 0.9 1.1)))) (until #f (suspend) (ja :num! (loop! f30-1)) @@ -1948,7 +1948,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-1 (* 2.0 (get-rand-float-range self 0.9 1.1)))) + (let ((f30-1 (* 2.0 (rnd-float-range self 0.9 1.1)))) (until #f (suspend) (ja :num! (loop! f30-1)) @@ -2021,7 +2021,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-1 (* 2.0 (get-rand-float-range self 0.9 1.1)))) + (let ((f30-1 (* 2.0 (rnd-float-range self 0.9 1.1)))) (until #f (suspend) (ja :num! (loop! f30-1)) @@ -2039,7 +2039,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (nav-enemy-method-167 self) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) @@ -2062,11 +2062,11 @@ (set! (-> self miss-amount) 0.0) (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))))) + (set! (-> self reaction-time) (the-as time-frame (the int (* 300.0 (rnd-float-range self 3.0 5.0))))) ) :exit (behavior () (set! (-> self joint-enable) #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () (crimson-guard-level-method-200 self) @@ -2089,7 +2089,7 @@ :code (behavior () (speech-control-method-12 *speech-control* self (speech-type speech-type-13)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! crimson-guard-idle-to-stab-idle-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) (seek-toward-heading-vec! (-> self root) (-> self target-self-xz) 65536.0 (seconds 0.02)) @@ -2111,7 +2111,7 @@ ) #f (label cfg-13) - (let ((f30-1 (get-rand-float-range self 0.9 1.1))) + (let ((f30-1 (rnd-float-range self 0.9 1.1))) (ja-channel-push! 1 (seconds 0.2)) (ja-no-eval :group! crimson-guard-stab-idle-to-idle-ja :num! (seek! max f30-1) :frame-num 0.0) (until (ja-done? 0) @@ -2190,7 +2190,7 @@ :code (behavior () (local-vars (v1-48 object)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self anim-shoot 0 anim-index)) :num! (seek! max f30-0) :frame-num 0.0 @@ -2279,7 +2279,7 @@ #f ) (label cfg-57) - (let ((f30-1 (get-rand-float-range self 0.9 1.1))) + (let ((f30-1 (rnd-float-range self 0.9 1.1))) (ja-channel-push! 1 (seconds 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self anim-shoot 2 anim-index)) :num! (seek! max f30-1) @@ -2708,7 +2708,7 @@ (let ((v1-3 (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 3))) (logior! (-> v1-3 prim-core action) (collide-action deadly)) ) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-8 *game-info*) (a0-4 (+ (-> v1-8 attack-id) 1)) @@ -2725,8 +2725,8 @@ (let ((v1-3 (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 3))) (logclear! (-> v1-3 prim-core action) (collide-action deadly)) ) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -2807,7 +2807,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag37)))) @@ -2824,8 +2824,8 @@ 0 ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -2891,7 +2891,7 @@ :event enemy-event-handler :enter (behavior () (set! (-> self joint-enable) #t) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-5 *game-info*) (a0-2 (+ (-> v1-5 attack-id) 1)) @@ -2943,8 +2943,8 @@ (set! (-> v1-11 state mode) (the-as lightning-mode a0-5)) ) (set! (-> self joint-enable) #f) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -3163,7 +3163,7 @@ (set! (-> a0-0 travel quad) (-> v1-1 quad)) ) 0 - (track-target! self) + (common-post self) ) ) @@ -3214,7 +3214,7 @@ (set! (-> a0-0 travel quad) (-> v1-1 quad)) ) 0 - (track-target! self) + (common-post self) ) ) @@ -3294,7 +3294,7 @@ 0 (ja-channel-push! 1 (seconds 0.1)) (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-right-ja :num! (seek! (ja-aframe 6.0 0)) :frame-num (ja-aframe 0.0 0)) (until (ja-done? 0) (let ((a0-20 (handle->process (-> self focus handle)))) @@ -3335,7 +3335,7 @@ ) 0 (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-right-ja :num! (seek! (ja-aframe 11.0 0)) :frame-num (ja-aframe 6.0 0)) (until (ja-done? 0) (suspend) @@ -3394,7 +3394,7 @@ 0 (ja-channel-push! 1 (seconds 0.1)) (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-left-ja :num! (seek! (ja-aframe 9.0 0)) :frame-num (ja-aframe 0.0 0)) (until (ja-done? 0) (let ((a0-20 (handle->process (-> self focus handle)))) @@ -3435,7 +3435,7 @@ ) 0 (cond - ((logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + ((logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (ja-no-eval :group! crimson-guard-jump-left-ja :num! (seek! (ja-aframe 11.0 0)) :frame-num (ja-aframe 9.0 0)) (until (ja-done? 0) (suspend) @@ -3496,7 +3496,7 @@ ) ;; definition for method 77 of type crimson-guard-level -(defmethod enemy-method-77 ((this crimson-guard-level) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this crimson-guard-level) (arg0 enemy-knocked-info)) (let ((v1-1 (-> this root transv))) (cond ((< (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z)))) 57344.0) @@ -3516,7 +3516,7 @@ ) (set! (-> a0-5 frame-group) (the-as art-joint-anim a1-2)) (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim a1-2) num-func-seek!) ) @@ -3527,7 +3527,7 @@ (ja-channel-push! 1 (seconds 0.01)) (cond ((= (-> this small-hit) 1) - (set! (-> this yellow-anim anim-index-front) (get-rand-int this 2)) + (set! (-> this yellow-anim anim-index-front) (rnd-int-count this 2)) (let ((a1-8 (-> this draw @@ -3545,7 +3545,7 @@ ) (set! (-> a0-17 frame-group) (the-as art-joint-anim a1-8)) (set! (-> a0-17 param 0) (the float (+ (-> (the-as art-joint-anim a1-8) frames num-frames) -1))) - (set! (-> a0-17 param 1) (-> arg0 0)) + (set! (-> a0-17 param 1) (-> arg0 anim-speed)) (set! (-> a0-17 frame-num) 0.0) (joint-control-channel-group! a0-17 (the-as art-joint-anim a1-8) num-func-seek!) ) @@ -3556,7 +3556,7 @@ ) (set! (-> a0-21 frame-group) (the-as art-joint-anim a1-9)) (set! (-> a0-21 param 0) (the float (+ (-> (the-as art-joint-anim a1-9) frames num-frames) -1))) - (set! (-> a0-21 param 1) (-> arg0 0)) + (set! (-> a0-21 param 1) (-> arg0 anim-speed)) (set! (-> a0-21 frame-num) 0.0) (joint-control-channel-group! a0-21 (the-as art-joint-anim a1-9) num-func-seek!) ) @@ -3570,7 +3570,7 @@ (set! (-> a0-24 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 10)) frames num-frames) -1)) ) - (set! (-> a0-24 param 1) (-> arg0 0)) + (set! (-> a0-24 param 1) (-> arg0 anim-speed)) (set! (-> a0-24 frame-num) 0.0) (joint-control-channel-group! a0-24 (the-as art-joint-anim (-> this draw art-group data 10)) num-func-seek!) ) @@ -3582,7 +3582,7 @@ ) (set! (-> a0-29 frame-group) (the-as art-joint-anim a1-13)) (set! (-> a0-29 param 0) (the float (+ (-> (the-as art-joint-anim a1-13) frames num-frames) -1))) - (set! (-> a0-29 param 1) (-> arg0 0)) + (set! (-> a0-29 param 1) (-> arg0 anim-speed)) (set! (-> a0-29 frame-num) 0.0) (joint-control-channel-group! a0-29 (the-as art-joint-anim a1-13) num-func-seek!) ) @@ -3620,7 +3620,7 @@ ) ;; definition for method 78 of type crimson-guard-level -(defmethod enemy-method-78 ((this crimson-guard-level) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this crimson-guard-level) (arg0 enemy-knocked-info)) (cond ((<= (-> this hit-points) 0) (let ((a1-1 (-> this draw art-group data (-> this info knocked-land anim-index (-> this hit-face)))) @@ -3628,7 +3628,7 @@ ) (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-1)) (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-1) frames num-frames) -1))) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-1) num-func-seek!) ) @@ -3658,7 +3658,7 @@ ) (set! (-> a0-15 frame-group) (the-as art-joint-anim a1-6)) (set! (-> a0-15 param 0) (the float (+ (-> (the-as art-joint-anim a1-6) frames num-frames) -1))) - (set! (-> a0-15 param 1) (-> arg0 0)) + (set! (-> a0-15 param 1) (-> arg0 anim-speed)) (set! (-> a0-15 frame-num) 0.0) (joint-control-channel-group! a0-15 (the-as art-joint-anim a1-6) num-func-seek!) ) @@ -3671,7 +3671,7 @@ ) (set! (-> a0-19 frame-group) (the-as art-joint-anim a1-7)) (set! (-> a0-19 param 0) (the float (+ (-> (the-as art-joint-anim a1-7) frames num-frames) -1))) - (set! (-> a0-19 param 1) (-> arg0 0)) + (set! (-> a0-19 param 1) (-> arg0 anim-speed)) (set! (-> a0-19 frame-num) 0.0) (joint-control-channel-group! a0-19 (the-as art-joint-anim a1-7) num-func-seek!) ) @@ -3686,7 +3686,7 @@ (set! (-> a0-22 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 11)) frames num-frames) -1)) ) - (set! (-> a0-22 param 1) (-> arg0 0)) + (set! (-> a0-22 param 1) (-> arg0 anim-speed)) (set! (-> a0-22 frame-num) 0.0) (joint-control-channel-group! a0-22 (the-as art-joint-anim (-> this draw art-group data 11)) num-func-seek!) ) @@ -3700,7 +3700,7 @@ ) (set! (-> a0-27 frame-group) (the-as art-joint-anim a1-11)) (set! (-> a0-27 param 0) (the float (+ (-> (the-as art-joint-anim a1-11) frames num-frames) -1))) - (set! (-> a0-27 param 1) (-> arg0 0)) + (set! (-> a0-27 param 1) (-> arg0 anim-speed)) (set! (-> a0-27 frame-num) 0.0) (joint-control-channel-group! a0-27 (the-as art-joint-anim a1-11) num-func-seek!) ) @@ -3719,7 +3719,7 @@ ((enemy-method-133 self) (ja-channel-push! 1 (seconds 0.2)) (let ((gp-0 (-> self draw art-group data (-> self enemy-info die-falling-anim))) - (f30-0 (get-rand-float-range self 0.8 1.2)) + (f30-0 (rnd-float-range self 0.8 1.2)) ) (ja-no-eval :group! gp-0 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -4185,7 +4185,9 @@ (ja :num! (loop! f30-0)) ) ) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 0 (-> self event-param-point)) (until #f (suspend) @@ -4402,7 +4404,7 @@ (set! (-> this joint) (new 'process 'joint-mod (joint-mod-mode joint-set*-world) this 4)) (set! (-> this l-control) (new 'process 'lightning-control (-> *lightning-spec-id-table* 13) this 0.0)) (set! (-> this l-control state points-to-draw) 0) - (let ((v1-45 (get-rand-int this 2))) + (let ((v1-45 (rnd-int-count this 2))) (if (logtest? (-> this flags) 4) (set! v1-45 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 d71e7c7b03..568d0f1fbf 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hopper_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hopper_REF.gc @@ -129,11 +129,11 @@ ) ;; definition for method 77 of type hopper -(defmethod enemy-method-77 ((this hopper) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this hopper) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (let* ((a2-0 (ash 1 (-> *hopper-global-info* prev-blue-hit))) - (v1-3 (enemy-method-120 this 3 a2-0)) + (v1-3 (rnd-bit this 3 a2-0)) (a1-5 (-> this draw art-group data (-> *hopper-global-info* blue-hit-anim v1-3 hit-anim-index))) ) (set! (-> *hopper-global-info* prev-blue-hit) v1-3) @@ -149,7 +149,7 @@ (else (ja-channel-push! 1 (seconds 0.1)) (let* ((a2-2 (ash 1 (-> *hopper-global-info* prev-yellow-hit))) - (v1-13 (enemy-method-120 this 3 a2-2)) + (v1-13 (rnd-bit this 3 a2-2)) (a1-11 (-> this draw art-group data (-> *hopper-global-info* yellow-hit-anim v1-13 hit-anim-index))) ) (set! (-> this land-anim-index) (-> *hopper-global-info* yellow-hit-anim v1-13 land-anim-index)) @@ -157,7 +157,7 @@ (let ((a0-27 (-> this skel root-channel 0))) (set! (-> a0-27 frame-group) (the-as art-joint-anim a1-11)) (set! (-> a0-27 param 0) (the float (+ (-> (the-as art-joint-anim a1-11) frames num-frames) -1))) - (set! (-> a0-27 param 1) (-> arg0 0)) + (set! (-> a0-27 param 1) (-> arg0 anim-speed)) (set! (-> a0-27 frame-num) 0.0) (joint-control-channel-group! a0-27 (the-as art-joint-anim a1-11) num-func-seek!) ) @@ -168,7 +168,7 @@ ) ;; definition for method 78 of type hopper -(defmethod enemy-method-78 ((this hopper) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this hopper) (arg0 enemy-knocked-info)) (cond ((= (-> this incoming knocked-type) (knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -177,7 +177,7 @@ (let ((a0-3 (-> this skel root-channel 0))) (set! (-> a0-3 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -195,7 +195,7 @@ (+ (-> (the-as art-joint-anim (-> this draw art-group data (-> this land-anim-index))) frames num-frames) -1) ) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 @@ -713,7 +713,7 @@ 0 (set! (-> self speed-y) 0.0) (set! (-> self accel-y) 0.0) - (set! (-> self next-jump-time) (the-as int (+ (current-time) (get-rand-int-range self 0 120)))) + (set! (-> self next-jump-time) (the-as int (+ (current-time) (rnd-int-range self 0 120)))) (set! (-> self step-num) 0) (set! (-> self best-score) -2.0) ) @@ -739,7 +739,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! hopper-idle-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -758,10 +758,10 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) (gp-0 (new 'stack-no-clear 'vector)) ) - (if (zero? (get-rand-int self 2)) + (if (zero? (rnd-int-count self 2)) (ja :group! hopper-notice-ja) (ja :group! hopper-notice-alt-ja) ) @@ -783,8 +783,8 @@ (defstate ambush (hopper) :virtual #t :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -840,7 +840,9 @@ (set! (-> gp-0 y) (-> s5-0 best-other-tri intersect y)) ) ) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 2 gp-0) ) (go-virtual hostile) @@ -848,7 +850,7 @@ ) ;; definition for method 132 of type hopper -(defmethod dispose! ((this hopper)) +(defmethod dying ((this hopper)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (when (-> this minimap) (logior! (-> this minimap flags) (minimap-flag fade-out)) @@ -958,7 +960,7 @@ (set! (-> this jump-height-min) 12288.0) (set! (-> this jump-anim-start-frame) 8.0) (set! (-> this land-anim-index) 26) - (set! (-> this side) (get-rand-float-range this -1.5 1.5)) + (set! (-> this side) (rnd-float-range this -1.5 1.5)) (when (logtest? (enemy-option ambush) (-> this fact enemy-options)) (set! (-> this path-intro) (new 'process 'path-control this 'intro 0.0 (-> this entity) #f)) (if (-> this path-intro) 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 c15ad141ab..ed16c6d584 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 @@ -659,7 +659,7 @@ ;; definition for method 135 of type crimson-guard-hover ;; WARN: Return type mismatch int vs sound-id. (defmethod enemy-method-135 ((this crimson-guard-hover) (arg0 int)) - (if (and (zero? arg0) (logtest? #x4000000 (-> this incoming penetrate-using))) + (if (and (zero? arg0) (logtest? (penetrate enemy-yellow-shot) (-> this incoming penetrate-using))) (sound-play "hover-take-hit") (call-parent-method this arg0) ) @@ -675,7 +675,7 @@ (t9-0) ) ) - (set! (-> self last-fire-time) (+ (current-time) (the int (* 300.0 (get-rand-float-range self 2.0 3.0))))) + (set! (-> self last-fire-time) (+ (current-time) (the int (* 300.0 (rnd-float-range self 2.0 3.0))))) (go-virtual ambush-fly) ) :exit (behavior () @@ -1009,29 +1009,29 @@ (ja :num! (seek!)) ) (set! (-> self restart-fly-anims) #t) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-34 (-> self enemy-flags))) - (if (logtest? v1-34 (enemy-flag checking-water)) - (set! v1-35 (logior v1-34 (enemy-flag enable-on-active))) - (set! v1-35 (logclear v1-34 (enemy-flag enable-on-active))) + (if (logtest? v1-34 (enemy-flag vulnerable-backup)) + (set! v1-35 (logior v1-34 (enemy-flag vulnerable))) + (set! v1-35 (logclear v1-34 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-35) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-42 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-42) - (set! v1-43 (logior (enemy-flag check-water-backup) v1-42)) - (set! v1-43 (logclear v1-42 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-42) + (set! v1-43 (logior (enemy-flag trackable) v1-42)) + (set! v1-43 (logclear v1-42 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-43) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (hover-nav-control-method-21 (-> self hover)) (go-hostile self) @@ -1043,7 +1043,7 @@ :virtual #t :event enemy-event-handler :code (behavior () - (dispose! self) + (dying self) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -1200,9 +1200,9 @@ (hover-nav-control-method-20 (-> this hover)) (hover-enemy-method-140 this #t) (let ((v1-14 (-> this enemy-flags))) - (if (logtest? v1-14 (enemy-flag checking-water)) - (set! v1-15 (logior v1-14 (enemy-flag enable-on-active))) - (set! v1-15 (logclear v1-14 (enemy-flag enable-on-active))) + (if (logtest? v1-14 (enemy-flag vulnerable-backup)) + (set! v1-15 (logior v1-14 (enemy-flag vulnerable))) + (set! v1-15 (logclear v1-14 (enemy-flag vulnerable))) ) ) (set! (-> this enemy-flags) v1-15) @@ -1338,7 +1338,7 @@ ) (vector-negate! gp-1 gp-1) ) - (let ((f30-1 (get-rand-float-range this 0.0 1.0)) + (let ((f30-1 (rnd-float-range this 0.0 1.0)) (s5-1 (-> this enemy-info)) ) (vector-float*! gp-1 gp-1 (lerp (-> s5-1 knocked-hard-vxz-lo) (-> s5-1 knocked-hard-vxz-hi) f30-1)) @@ -1355,7 +1355,7 @@ ) ;; definition for method 77 of type crimson-guard-hover -(defmethod enemy-method-77 ((this crimson-guard-hover) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this crimson-guard-hover) (arg0 enemy-knocked-info)) (ja-channel-push! 1 0) (case (-> this incoming knocked-type) (((knocked-type knocked-type-5)) @@ -1364,7 +1364,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 12)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 12)) num-func-seek!) ) @@ -1376,7 +1376,7 @@ (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 10)) frames num-frames) -1)) ) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim (-> this draw art-group data 10)) num-func-seek!) ) @@ -1387,7 +1387,7 @@ ) ;; definition for method 78 of type crimson-guard-hover -(defmethod enemy-method-78 ((this crimson-guard-hover) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this crimson-guard-hover) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (ja-channel-push! 1 (seconds 0.4)) @@ -1396,7 +1396,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 19)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 19)) num-func-seek!) ) @@ -1410,7 +1410,7 @@ ;; definition for method 55 of type crimson-guard-hover ;; WARN: Return type mismatch int vs none. -(defmethod track-target! ((this crimson-guard-hover)) +(defmethod common-post ((this crimson-guard-hover)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -1441,7 +1441,7 @@ (* 2.0 (seconds-per-frame)) ) ) - (let ((t9-6 (method-of-type hover-enemy track-target!))) + (let ((t9-6 (method-of-type hover-enemy common-post))) (t9-6 this) ) (los-control-method-9 (-> this los) (the-as process-focusable #f) (the-as vector #f) 2048.0) @@ -1858,7 +1858,7 @@ (set! (-> this gun-x-angle-final) 0.0) (set! (-> this hips-jmod) (the-as joint-mod (new 'process 'joint-mod-rotate-local this 18 #t))) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (set! sv-16 (new 'static 'res-tag)) (let ((v1-30 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) (if (and v1-30 (= (-> sv-16 elt-count) 1)) 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 cbe7deeca9..11cb34910a 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 @@ -270,15 +270,15 @@ (('hit 'hit-flinch 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (go (method-of-object this knocked)) @@ -619,14 +619,14 @@ ) ;; definition for method 55 of type flamer -(defmethod track-target! ((this flamer)) +(defmethod common-post ((this flamer)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (update-vol! (-> this sound) (-> this sound-volume)) (flamer-method-191 this) - ((method-of-type nav-enemy track-target!) this) + ((method-of-type nav-enemy common-post) this) (none) ) @@ -755,7 +755,7 @@ ((zero? v1-0) (let ((a1-1 (new 'stack-no-clear 'collide-query))) (cond - ((enemy-method-125 this a1-1 (collide-spec backgnd) 8192.0 26624.0 1024.0) + ((ground-pat-set! this a1-1 (collide-spec backgnd) 8192.0 26624.0 1024.0) (set! (-> this base-pos y) (+ 22528.0 (-> this root gspot-pos y))) ) (else @@ -913,7 +913,7 @@ ) ) (logclear! (-> self mask) (process-mask actor-pause)) - (logclear! (-> self enemy-flags) (enemy-flag notice)) + (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (if (not (-> self path)) (go-virtual notice) ) @@ -944,7 +944,7 @@ ) ) (logior! (-> self mask) (process-mask actor-pause)) - (logior! (-> self enemy-flags) (enemy-flag notice)) + (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (set! (-> self flit-joint twist-min-y) (the-as float #t)) (set! (-> self last-fire-time) (+ (current-time) (seconds -1.5))) ) @@ -981,7 +981,7 @@ :virtual #t :enter (behavior () (logclear! (-> self mask) (process-mask actor-pause)) - (logclear! (-> self enemy-flags) (enemy-flag notice)) + (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (if (not (-> self path)) (go-virtual active) ) @@ -1037,7 +1037,7 @@ ) :exit (behavior () (logior! (-> self mask) (process-mask actor-pause)) - (logior! (-> self enemy-flags) (enemy-flag notice)) + (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) ) :trans (behavior () (set! (-> self path-pos) (- (-> self path-pos) (* 0.33333334 (seconds-per-frame)))) @@ -1248,7 +1248,7 @@ ;; definition for method 77 of type flamer ;; WARN: Return type mismatch object vs symbol. ;; WARN: Using new Jak 2 rtype-of -(defmethod enemy-method-77 ((this flamer) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this flamer) (arg0 enemy-knocked-info)) (let ((v1-0 (-> this incoming knocked-type))) (the-as symbol @@ -1259,7 +1259,7 @@ (s4-0 (new 'static 'array uint64 3 #x12 #x13 #x14)) (s3-0 (new 'static 'array int32 4 0 0 0 0)) (a2-0 (ash 1 (-> s3-0 0))) - (v1-6 (enemy-method-120 this a1-3 a2-0)) + (v1-6 (rnd-bit this a1-3 a2-0)) (s4-1 (-> this draw art-group data (-> (the-as (pointer int32) (+ (* v1-6 8) (the-as int s4-0)))))) ) (set! (-> s3-0 0) v1-6) @@ -1276,7 +1276,7 @@ (let ((a0-17 (-> this skel root-channel 0))) (set! (-> a0-17 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-17 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-17 param 1) (-> arg0 0)) + (set! (-> a0-17 param 1) (-> arg0 anim-speed)) (set! (-> a0-17 frame-num) 0.0) (joint-control-channel-group! a0-17 (the-as art-joint-anim s4-1) num-func-seek!) ) @@ -1289,7 +1289,7 @@ ) (set! (-> a0-21 frame-group) (the-as art-joint-anim a1-10)) (set! (-> a0-21 param 0) (the float (+ (-> (the-as art-joint-anim a1-10) frames num-frames) -1))) - (set! (-> a0-21 param 1) (-> arg0 0)) + (set! (-> a0-21 param 1) (-> arg0 anim-speed)) (set! (-> a0-21 frame-num) 0.0) (joint-control-channel-group! a0-21 (the-as art-joint-anim a1-10) num-func-seek!) ) @@ -1363,7 +1363,7 @@ 0 (set! (-> self hit-points) 0) (if (logtest? (enemy-option knocked-into-water) (-> self fact enemy-options)) - (logior! (-> self enemy-flags) (enemy-flag trackable-backup)) + (logior! (-> self enemy-flags) (enemy-flag check-water)) ) (let ((v1-8 self)) (set! (-> v1-8 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-8 enemy-flags)))) @@ -1380,10 +1380,10 @@ ) ;; definition for method 132 of type flamer -(defmethod dispose! ((this flamer)) +(defmethod dying ((this flamer)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" - (let ((s5-1 (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags)))) - (let ((t9-0 (method-of-type nav-enemy dispose!))) + (let ((s5-1 (logtest? (enemy-flag called-dying) (-> this enemy-flags)))) + (let ((t9-0 (method-of-type nav-enemy dying))) (t9-0 this) ) (if (not s5-1) @@ -1514,7 +1514,7 @@ (set! (-> this scale) 1.6) (flamer-method-186 this 1.0) (logclear! (-> this nav flags) (nav-control-flag limit-rotation-rate)) - (set! (-> this sync-off) (the-as uint (get-rand-int this 600))) + (set! (-> this sync-off) (the-as uint (rnd-int-count this 600))) (set! (-> this flit-angle) 0.0) (set! (-> this flit-timer) 0) (set! (-> this root dynam gravity y) 225280.0) @@ -1545,7 +1545,7 @@ (set! (-> this sound) (new 'process 'ambient-sound (static-sound-spec "flamer-loop" :fo-max 80) (-> this root trans)) ) - (logior! (-> this enemy-flags) (enemy-flag multi-focus)) + (logior! (-> this enemy-flags) (enemy-flag dislike-combo)) (let ((v1-45 (-> this nav))) (set! (-> v1-45 sphere-mask) (the-as uint 0)) ) 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 68684c4d6e..2bf79fb1eb 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 @@ -17,20 +17,20 @@ (('hit 'hit-knocked 'hit-flinch) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (cond ((zero? (-> this hit-points)) - (if (rng-hit? this 0.4) + (if (rnd-percent? this 0.4) (go (method-of-object this flying-death)) (go (method-of-object this flying-death-explode)) ) @@ -306,14 +306,14 @@ ) ;; definition for method 55 of type hover-enemy -(defmethod track-target! ((this hover-enemy)) +(defmethod common-post ((this hover-enemy)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (hover-enemy-method-148 this) (enemy-method-129 this) - (let ((t9-2 (method-of-type enemy track-target!))) + (let ((t9-2 (method-of-type enemy common-post))) (t9-2 this) ) (hover-nav-control-method-13 (-> this hover)) @@ -462,7 +462,7 @@ (defstate ambush (hover-enemy) :virtual #t :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (hover-enemy-method-140 self #f) (if (logtest? (-> self path flags) (path-control-flag not-found)) (go process-drawable-art-error "no path") @@ -470,7 +470,7 @@ (set! (-> self scale-timer) (the-as uint (current-time))) (cond ((not (logtest? (-> self fact enemy-options) (enemy-option user0))) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) (hover-enemy-method-141 self 0.0) ) (else @@ -530,9 +530,9 @@ (hover-nav-control-method-20 (-> self hover)) (hover-enemy-method-140 self #t) (let ((v1-4 (-> self enemy-flags))) - (if (logtest? v1-4 (enemy-flag checking-water)) - (set! v1-5 (logior v1-4 (enemy-flag enable-on-active))) - (set! v1-5 (logclear v1-4 (enemy-flag enable-on-active))) + (if (logtest? v1-4 (enemy-flag vulnerable-backup)) + (set! v1-5 (logior v1-4 (enemy-flag vulnerable))) + (set! v1-5 (logclear v1-4 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-5) @@ -557,11 +557,11 @@ (when (< f0-1 f1-0) (let ((f30-0 (fmin 1.0 (/ (+ 30.0 f0-1) f1-0)))) (hover-enemy-method-141 self f30-0) - (when (and (not (logtest? (-> self enemy-flags) (enemy-flag enable-on-active))) (>= f30-0 1.0)) + (when (and (not (logtest? (-> self enemy-flags) (enemy-flag vulnerable))) (>= f30-0 1.0)) (let ((v1-18 (-> self enemy-flags))) - (if (logtest? v1-18 (enemy-flag checking-water)) - (set! v1-19 (logior v1-18 (enemy-flag enable-on-active))) - (set! v1-19 (logclear v1-18 (enemy-flag enable-on-active))) + (if (logtest? v1-18 (enemy-flag vulnerable-backup)) + (set! v1-19 (logior v1-18 (enemy-flag vulnerable))) + (set! v1-19 (logclear v1-18 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-19) @@ -680,29 +680,29 @@ (ja :num! (seek!)) ) (set! (-> self restart-fly-anims) #t) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-37 (-> self enemy-flags))) - (if (logtest? v1-37 (enemy-flag checking-water)) - (set! v1-38 (logior v1-37 (enemy-flag enable-on-active))) - (set! v1-38 (logclear v1-37 (enemy-flag enable-on-active))) + (if (logtest? v1-37 (enemy-flag vulnerable-backup)) + (set! v1-38 (logior v1-37 (enemy-flag vulnerable))) + (set! v1-38 (logclear v1-37 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-38) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-45 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-45) - (set! v1-46 (logior (enemy-flag check-water-backup) v1-45)) - (set! v1-46 (logclear v1-45 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-45) + (set! v1-46 (logior (enemy-flag trackable) v1-45)) + (set! v1-46 (logclear v1-45 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-46) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (hover-nav-control-method-21 (-> self hover)) (go-hostile self) @@ -724,12 +724,12 @@ ) :enter (behavior () (set-time! (-> self state-time)) - (dispose! self) + (dying self) (stop-looking-at-target! self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self mask) (process-mask actor-pause)) (logclear! (-> self focus-status) (focus-status dangerous)) - (logclear! (-> self enemy-flags) (enemy-flag check-water-backup)) + (logclear! (-> self enemy-flags) (enemy-flag trackable)) (set! (-> self root penetrate-using) (penetrate lunge vehicle knocked)) (let ((gp-0 (-> self flying-death-transv))) (let ((a1-0 (handle->process (-> self incoming attacker-handle)))) @@ -741,10 +741,10 @@ (set! (-> gp-0 y) 0.0) (vector-normalize! gp-0 1.0) (vector-rotate90-around-y! gp-0 gp-0) - (if (rng-hit? self 0.5) + (if (rnd-percent? self 0.5) (vector-negate! gp-0 gp-0) ) - (let ((f30-0 (get-rand-float-range self 0.0 1.0))) + (let ((f30-0 (rnd-float-range self 0.0 1.0))) (vector-float*! gp-0 gp-0 (lerp 98304.0 172032.0 f30-0)) (set! (-> gp-0 y) (lerp 8192.0 98304.0 f30-0)) ) @@ -840,7 +840,7 @@ (defstate flying-death-explode (hover-enemy) :virtual #t :enter (behavior () - (dispose! self) + (dying self) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -916,13 +916,13 @@ ) ;; definition for method 132 of type hover-enemy -(defmethod dispose! ((this hover-enemy)) +(defmethod dying ((this hover-enemy)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" - (when (not (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags))) + (when (not (logtest? (enemy-flag called-dying) (-> this enemy-flags))) (process-entity-status! this (entity-perm-status subtask-complete) #t) (send-event (ppointer->process (-> this parent)) 'hover-die) (hover-enemy-method-154 this) - ((method-of-type enemy dispose!) this) + ((method-of-type enemy dying) this) ) (none) ) @@ -948,7 +948,7 @@ ;; WARN: Return type mismatch int vs none. (defmethod hover-enemy-method-155 ((this hover-enemy)) (set! (-> this hover-info) (hover-enemy-method-151 this)) - (set! (-> this fly-anim-speed) (get-rand-float-range this 0.8 1.2)) + (set! (-> this fly-anim-speed) (rnd-float-range this 0.8 1.2)) (vector-reset! (-> this rotation-vec)) (vector-reset! (-> this dest-pos)) (vector-reset! (-> this local-dir)) 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 c0c6c5b509..4abe45cb42 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 @@ -479,15 +479,15 @@ (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (if (zero? (-> this hit-points)) @@ -524,7 +524,7 @@ ) (vector-negate! gp-1 gp-1) ) - (let ((f30-1 (get-rand-float-range this 0.0 1.0)) + (let ((f30-1 (rnd-float-range this 0.0 1.0)) (s5-1 (-> this enemy-info)) ) (vector-float*! gp-1 gp-1 (lerp (-> s5-1 knocked-hard-vxz-lo) (-> s5-1 knocked-hard-vxz-hi) f30-1)) @@ -580,13 +580,13 @@ ) ;; definition for method 55 of type wasp -(defmethod track-target! ((this wasp)) +(defmethod common-post ((this wasp)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (seek! (-> this gun-x-angle) (-> this gun-x-angle-final) (* 21845.334 (seconds-per-frame))) - ((method-of-type hover-enemy track-target!) this) + ((method-of-type hover-enemy common-post) this) (none) ) @@ -645,7 +645,7 @@ ) ) :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (hover-enemy-method-140 self #f) (if (logtest? (-> self path flags) (path-control-flag not-found)) (go process-drawable-art-error "no path") @@ -664,9 +664,9 @@ (hover-nav-control-method-18 (-> self hover) (-> self path) -1 6) (set-time! (-> self last-fire-time)) (set! (-> self bridge-index) 0) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (logclear! (-> self mask) (process-mask collectable)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> self enemy-flags) (enemy-flag attackable-backup)) ) :exit (behavior () (let ((gp-0 (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) 0.0 'interp)) @@ -1007,29 +1007,29 @@ (ja :num! (seek!)) ) (set! (-> self restart-fly-anims) #t) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-34 (-> self enemy-flags))) - (if (logtest? v1-34 (enemy-flag checking-water)) - (set! v1-35 (logior v1-34 (enemy-flag enable-on-active))) - (set! v1-35 (logclear v1-34 (enemy-flag enable-on-active))) + (if (logtest? v1-34 (enemy-flag vulnerable-backup)) + (set! v1-35 (logior v1-34 (enemy-flag vulnerable))) + (set! v1-35 (logclear v1-34 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-35) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-42 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-42) - (set! v1-43 (logior (enemy-flag check-water-backup) v1-42)) - (set! v1-43 (logclear v1-42 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-42) + (set! v1-43 (logior (enemy-flag trackable) v1-42)) + (set! v1-43 (logclear v1-42 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-43) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (hover-nav-control-method-21 (-> self hover)) (go-hostile self) @@ -1041,7 +1041,7 @@ :virtual #t :event enemy-event-handler :code (behavior () - (dispose! self) + (dying self) (set! (-> self hit-points) 0) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) @@ -1103,7 +1103,7 @@ :virtual #t :event enemy-event-handler :code (behavior () - (dispose! self) + (dying self) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -1152,9 +1152,9 @@ ) ;; definition for method 77 of type wasp -(defmethod enemy-method-77 ((this wasp) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this wasp) (arg0 enemy-knocked-info)) (cond - ((rng-hit? this 0.5) + ((rnd-percent? this 0.5) (set! (-> this knocked-anim) 10) (set! (-> this knocked-recover-anim) 11) ) @@ -1169,7 +1169,7 @@ ) (set! (-> a0-5 frame-group) (the-as art-joint-anim a1-3)) (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim a1-3) frames num-frames) -1))) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim a1-3) num-func-seek!) ) @@ -1177,13 +1177,13 @@ ) ;; definition for method 78 of type wasp -(defmethod enemy-method-78 ((this wasp) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this wasp) (arg0 enemy-knocked-info)) (let ((v1-4 (-> this draw art-group data (-> this enemy-info knocked-land-anim))) (a0-3 (-> this skel root-channel 0)) ) (set! (-> a0-3 frame-group) (the-as art-joint-anim v1-4)) (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim v1-4) frames num-frames) -1))) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim v1-4) num-func-seek!) ) @@ -1549,7 +1549,7 @@ (set! (-> this neck up) (the-as uint 1)) (set! (-> this neck nose) (the-as uint 2)) (set! (-> this neck ear) (the-as uint 0)) - (set! (-> this scale) (get-rand-float-range this 0.9 1.3)) + (set! (-> this scale) (rnd-float-range this 0.9 1.3)) (set! (-> this sound-id) (new-sound-id)) (set! (-> this root dynam gravity y) 327680.0) (set! (-> this root dynam gravity-length) 327680.0) @@ -1560,7 +1560,7 @@ (set! (-> this gun-x-angle) 0.0) (set! (-> this gun-x-angle-final) 0.0) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (set! sv-16 (new 'static 'res-tag)) (let ((v1-28 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) (if (and v1-28 (= (-> sv-16 elt-count) 1)) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/metalmonk_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/metalmonk_REF.gc index ad4289577f..81f7576be1 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/metalmonk_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/metalmonk_REF.gc @@ -419,12 +419,12 @@ ;; definition for method 55 of type metalmonk ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod track-target! ((this metalmonk)) +(defmethod common-post ((this metalmonk)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (set! (-> this old-facing quad) (-> this new-facing quad)) @@ -441,15 +441,15 @@ (('hit 'hit-knocked 'hit-flinch) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (cond @@ -462,7 +462,7 @@ ) ) ) - (zero? (get-rand-int this 3)) + (zero? (rnd-int-count this 3)) (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) (f1-0 32768.0) ) @@ -632,10 +632,10 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) (gp-0 (new 'stack-no-clear 'vector)) ) - (ja :group! (-> self draw art-group data (-> *metalmonk-global-info* notice-anim (get-rand-int self 2)))) + (ja :group! (-> self draw art-group data (-> *metalmonk-global-info* notice-anim (rnd-int-count self 2)))) (ja-no-eval :group! (ja-group) :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) (let ((a1-4 (-> self nav state))) @@ -682,7 +682,7 @@ ) :code (behavior () (talker-spawn-func (-> *talker-speech* 95) *entity-pool* (target-pos 0) (the-as region #f)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (suspend) (until #f (metalmonk-method-181 self 1.2 0.1) @@ -711,10 +711,10 @@ ) ) ) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f - (let ((gp-0 (-> self draw art-group data (-> (&-> *metalmonk-global-info* patrol-anim (get-rand-int self 2)) 0))) - (s5-0 (get-rand-int-range self 1 8)) + (let ((gp-0 (-> self draw art-group data (-> (&-> *metalmonk-global-info* patrol-anim (rnd-int-count self 2)) 0))) + (s5-0 (rnd-int-range self 1 8)) ) (let ((v1-34 (ja-group))) (if (not (and v1-34 (= v1-34 gp-0))) @@ -729,7 +729,7 @@ ) ) ) - (when (zero? (get-rand-int self 2)) + (when (zero? (rnd-int-count self 2)) (let ((v1-58 self)) (set! (-> v1-58 enemy-flags) (the-as enemy-flag (logclear (-> v1-58 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-58 nav callback-info) *nav-enemy-null-callback-info*) @@ -737,8 +737,8 @@ 0 (ja-channel-push! 1 (seconds 0.3)) (let ((gp-1 0)) - (until (not (enemy-method-123 self 0.4)) - (let* ((v1-62 (enemy-method-120 self 3 gp-1)) + (until (not (rnd-go-idle? self 0.4)) + (let* ((v1-62 (rnd-bit self 3 gp-1)) (a1-16 (-> self draw art-group data (-> *metalmonk-global-info* idle-anim v1-62))) ) (set! gp-1 (ash 1 v1-62)) @@ -771,7 +771,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (metalmonk-method-180 self #t) (nav-enemy-method-169 self 6144.0 #f) (let ((v1-6 (-> self nav))) @@ -793,14 +793,14 @@ ) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (metalmonk-method-180 self #f) (nav-enemy-method-168 self) (let ((v1-6 (-> self nav))) (set! (-> v1-6 target-speed) (-> self enemy-info run-travel-speed)) ) 0 - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -821,7 +821,7 @@ (ja-no-eval :group! s5-0 :num! (seek!) :frame-num 0.0) ) (until (ja-done? 0) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) (set! gp-0 #t) ) (suspend) @@ -869,9 +869,9 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (ja :group! (-> self draw art-group data (-> *metalmonk-global-info* celebrate-anim (get-rand-int self 2)))) + (ja :group! (-> self draw art-group data (-> *metalmonk-global-info* celebrate-anim (rnd-int-count self 2)))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (ja-no-eval :group! (ja-group) :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -887,7 +887,7 @@ :virtual #t :code (behavior () (nav-enemy-method-166 self) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (suspend) (until #f (metalmonk-method-181 self 1.6 1.5) @@ -917,8 +917,8 @@ ) ) (nav-enemy-method-165 self) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) - (-> self draw art-group data (-> *metalmonk-global-info* patrol-anim (get-rand-int self 2))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) + (-> self draw art-group data (-> *metalmonk-global-info* patrol-anim (rnd-int-count self 2))) (until #f (metalmonk-method-182 self 1.2 0.5) (suspend) @@ -948,7 +948,9 @@ (until #f (let ((gp-0 (new 'stack-no-clear 'vector))) (get-point-at-percent-along-path! (-> self intro-path) gp-0 1.0 'interp) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (let ((v1-4 (process->ppointer self))) (set! (-> a1-1 from) v1-4) @@ -967,19 +969,19 @@ ) ;; definition for method 77 of type metalmonk -(defmethod enemy-method-77 ((this metalmonk) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this metalmonk) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (ja-channel-push! 1 0) (let* ((a2-0 (ash 1 (-> *metalmonk-global-info* prev-yellow-hit))) - (v1-3 (enemy-method-120 this 4 a2-0)) + (v1-3 (rnd-bit this 4 a2-0)) (a1-6 (-> this draw art-group data (-> *metalmonk-global-info* yellow-hit-anim v1-3))) ) (set! (-> *metalmonk-global-info* prev-yellow-hit) v1-3) (let ((a0-13 (-> this skel root-channel 0))) (set! (-> a0-13 frame-group) (the-as art-joint-anim a1-6)) (set! (-> a0-13 param 0) (the float (+ (-> (the-as art-joint-anim a1-6) frames num-frames) -1))) - (set! (-> a0-13 param 1) (-> arg0 0)) + (set! (-> a0-13 param 1) (-> arg0 anim-speed)) (set! (-> a0-13 frame-num) 0.0) (joint-control-channel-group! a0-13 (the-as art-joint-anim a1-6) num-func-seek!) ) @@ -987,7 +989,7 @@ ) (((knocked-type knocked-type-6)) (let* ((a2-2 (ash 1 (-> *metalmonk-global-info* prev-blue-hit))) - (v1-12 (enemy-method-120 this 3 a2-2)) + (v1-12 (rnd-bit this 3 a2-2)) (s5-1 (-> this draw art-group data (-> *metalmonk-global-info* blue-hit-anim v1-12))) ) (set! (-> *metalmonk-global-info* prev-blue-hit) v1-12) @@ -1015,7 +1017,7 @@ (if (< (vector-dot (the-as vector (metalmonk-method-179 this (new 'stack-no-clear 'vector))) (-> this root transv)) 0.0 ) - (-> this draw art-group data (-> *metalmonk-global-info* knocked-anim (get-rand-int this 2))) + (-> this draw art-group data (-> *metalmonk-global-info* knocked-anim (rnd-int-count this 2))) (-> this draw art-group data 20) ) ) @@ -1024,7 +1026,7 @@ (let ((a0-38 (-> this skel root-channel 0))) (set! (-> a0-38 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-38 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-38 param 1) (-> arg0 0)) + (set! (-> a0-38 param 1) (-> arg0 anim-speed)) (set! (-> a0-38 frame-num) 0.0) (joint-control-channel-group! a0-38 (the-as art-joint-anim s4-1) num-func-seek!) ) @@ -1035,7 +1037,7 @@ ) ;; definition for method 78 of type metalmonk -(defmethod enemy-method-78 ((this metalmonk) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this metalmonk) (arg0 enemy-knocked-info)) (cond ((= (-> this incoming knocked-type) (knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -1044,7 +1046,7 @@ (let ((a0-3 (-> this skel root-channel 0))) (set! (-> a0-3 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim s4-0) num-func-seek!) ) @@ -1080,7 +1082,7 @@ (let ((a0-14 (-> this skel root-channel 0))) (set! (-> a0-14 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-14 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-14 param 1) (-> arg0 0)) + (set! (-> a0-14 param 1) (-> arg0 anim-speed)) (set! (-> a0-14 frame-num) 0.0) (joint-control-channel-group! a0-14 (the-as art-joint-anim s4-1) num-func-seek!) ) 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 38188aeb71..d6e6b448da 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/spyder_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/spyder_REF.gc @@ -304,15 +304,15 @@ (('hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (when (zero? (-> this hit-points)) @@ -465,7 +465,7 @@ ;; definition for method 77 of type spyder ;; WARN: Using new Jak 2 rtype-of -(defmethod enemy-method-77 ((this spyder) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this spyder) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (let ((a0-2 (-> this skel root-channel 0))) @@ -473,7 +473,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 15)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 15)) num-func-seek!) ) @@ -485,7 +485,7 @@ (s5-0 (new 'static 'array uint64 3 #x11 #x12 #x13)) (s4-0 (new 'static 'array int32 4 0 0 0 0)) (a2-1 (ash 1 (-> s4-0 0))) - (v1-20 (enemy-method-120 this a1-4 a2-1)) + (v1-20 (rnd-bit this a1-4 a2-1)) (s5-1 (-> this draw art-group data (-> (the-as (pointer int32) (+ (* v1-20 8) (the-as int s5-0)))))) ) (set! (-> s4-0 0) v1-20) @@ -517,7 +517,7 @@ (set! (-> a0-20 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 13)) frames num-frames) -1)) ) - (set! (-> a0-20 param 1) (-> arg0 0)) + (set! (-> a0-20 param 1) (-> arg0 anim-speed)) (set! (-> a0-20 frame-num) 0.0) (joint-control-channel-group! a0-20 (the-as art-joint-anim (-> this draw art-group data 13)) num-func-seek!) ) @@ -535,7 +535,7 @@ ) ;; definition for method 78 of type spyder -(defmethod enemy-method-78 ((this spyder) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this spyder) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (cond @@ -712,7 +712,7 @@ ) ;; definition for method 55 of type spyder -(defmethod track-target! ((this spyder)) +(defmethod common-post ((this spyder)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -722,7 +722,7 @@ (update-trans! (-> this sound) (-> this root trans)) (update! (-> this sound)) (spyder-method-182 this) - (let ((t9-6 (method-of-type nav-enemy track-target!))) + (let ((t9-6 (method-of-type nav-enemy common-post))) (t9-6 this) ) (logclear! (-> this status-flags) (spyder-flags spflags-0)) @@ -928,7 +928,7 @@ ) ) (spyder-method-181 self) - (look-at-target! self (enemy-flag death-start)) + (look-at-target! self (enemy-flag look-at-move-dest)) (logclear! (-> self status-flags) (spyder-flags spflags-1)) (when (!= (-> self dest-fade) 128.0) (set! (-> self shock-effect-end) (+ (current-time) (seconds 1))) @@ -943,7 +943,7 @@ ) ) (logclear! (-> self status-flags) (spyder-flags spflags-5)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) ) :trans (behavior () (let ((t9-0 (-> (method-of-type nav-enemy hostile) trans))) @@ -1081,18 +1081,18 @@ (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-4 enemy-flags)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (look-at-target! self (enemy-flag look-at-focus)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (let ((v1-2 (-> self nav))) (set! (-> v1-2 max-rotation-rate) (-> *spyder-nav-enemy-info* maximum-rotation-rate)) ) 0 ) :trans (behavior () - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (if (or (>= 2 (the-as int (-> self focus aware))) (not (get-enemy-target self))) 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 1622a7a711..4620e57825 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 @@ -634,7 +634,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (new 'stack-no-clear 'vector) (let* ((gp-0 (handle->process (-> self focus handle))) (a0-6 (if (type? gp-0 process-focusable) @@ -698,7 +698,7 @@ :code (behavior () (sound-play "buoy-guns-in") (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (ja-no-eval :group! gun-buoy-close-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -946,7 +946,7 @@ ;; definition for method 55 of type gun-buoy ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod track-target! ((this gun-buoy)) +(defmethod common-post ((this gun-buoy)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -1013,7 +1013,7 @@ (water-control-method-10 (-> this water)) (update-trans! (-> this sound) (-> this root trans)) (update! (-> this sound)) - ((method-of-type nav-enemy track-target!) this) + ((method-of-type nav-enemy common-post) this) 0 (none) ) 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 920c65d540..b8c6fa2976 100644 --- a/test/decompiler/reference/jak2/levels/common/entities/spydroid_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/entities/spydroid_REF.gc @@ -669,12 +669,12 @@ ;; definition for method 55 of type spydroid ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod track-target! ((this spydroid)) +(defmethod common-post ((this spydroid)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (when (< (-> this root scale x) 1.0) @@ -939,7 +939,7 @@ :event enemy-event-handler :enter (behavior () (set! (-> self hit-target) #f) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (let ((v1-2 (-> self nav))) (set! (-> v1-2 target-speed) (+ 8192.0 (-> self enemy-info run-travel-speed))) ) @@ -965,13 +965,13 @@ (ja :group! spydroid-attack-jump-ja :num! min) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (nav-enemy-method-168 self) (let ((v1-4 (-> self nav))) (set! (-> v1-4 target-speed) (-> self enemy-info run-travel-speed)) ) 0 - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -979,7 +979,7 @@ :trans (behavior () (enemy-method-49 self) nav-state - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) (set! (-> self hit-target) (the-as basic #t)) ) (let ((v1-9 (ja-group))) @@ -1481,7 +1481,7 @@ (add-connection *part-engine* this 6 this 3185 (new 'static 'vector :w 163840.0)) (add-connection *part-engine* this 6 this 3186 (new 'static 'vector :w 163840.0)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) 0 (none) ) diff --git a/test/decompiler/reference/jak2/levels/drill/ginsu_REF.gc b/test/decompiler/reference/jak2/levels/drill/ginsu_REF.gc index ba22ed6352..feded89c19 100644 --- a/test/decompiler/reference/jak2/levels/drill/ginsu_REF.gc +++ b/test/decompiler/reference/jak2/levels/drill/ginsu_REF.gc @@ -382,7 +382,7 @@ (set! (-> s5-0 quad 2) a1-3) (set! (-> s5-0 trans quad) a2-2) ) - (when (logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + (when (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) (vector-negate! (the-as vector (-> s5-0 vector)) (the-as vector (-> s5-0 vector))) (set! (-> s5-0 vector 0 w) 0.0) ) @@ -407,13 +407,13 @@ ;; definition for method 55 of type ginsu ;; WARN: Return type mismatch symbol vs none. -(defmethod track-target! ((this ginsu)) +(defmethod common-post ((this ginsu)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (ginsu-method-180 this) - (let ((t9-1 (method-of-type nav-enemy track-target!))) + (let ((t9-1 (method-of-type nav-enemy common-post))) (t9-1 this) ) (cond @@ -493,7 +493,7 @@ ) (quaternion->matrix s4-0 (-> this root quat)) (let ((f0-1 (vector-dot s5-0 (the-as vector (-> s4-0 vector))))) - (if (logtest? (enemy-flag dislike-combo) (-> this enemy-flags)) + (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags)) (set! f0-1 (- f0-1)) ) (cond @@ -726,7 +726,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let ((v1-4 (-> self nav))) (set! (-> v1-4 target-speed) 8192.0) @@ -737,8 +737,8 @@ (ja :group! ginsu-idle-ja :num! min) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -753,7 +753,7 @@ ) (go-virtual circling) ) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) (go-virtual circling) ) (if (time-elapsed? (-> self state-time) (seconds 0.75)) @@ -788,7 +788,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (ginsu-method-183 self #t) (set! (-> self root penetrate-using) (penetrate generic-attack lunge)) (enemy-method-49 self) @@ -807,8 +807,8 @@ (ja :group! ginsu-attack-ja :num! min) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -825,7 +825,7 @@ ) (go-virtual circling) ) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) (go-virtual circling) ) (ja :num! (seek!)) @@ -847,7 +847,7 @@ ) ) (logclear! (-> self mask) (process-mask actor-pause)) - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (ja-channel-set! 0) (set! (-> self root scale x) 0.01) (set! (-> self root scale y) 0.01) @@ -855,7 +855,7 @@ ) :exit (behavior () (logior! (-> self mask) (process-mask actor-pause)) - (logior! (-> self enemy-flags) (enemy-flag notice)) + (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) ) :trans (behavior () (let ((t9-0 (-> (method-of-type enemy ambush) trans))) diff --git a/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc b/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc index 4a982db060..7118bf4874 100644 --- a/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc +++ b/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc @@ -261,15 +261,15 @@ For pegasus, it will call [[enemy::57]] only if the [[pegasus]] has been targett ((zero? (-> this hit-points)) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action proc) (send-event proc 'get-attack-count 1) (kill-prefer-falling this) @@ -754,14 +754,14 @@ The faster it's moving the fast it flaps it's wings, etc ) ;; definition for method 55 of type pegasus -(defmethod track-target! ((this pegasus)) +(defmethod common-post ((this pegasus)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (track-how-long-aimed-at! this) (pegasus-show-runs) - ((method-of-type enemy track-target!) this) + ((method-of-type enemy common-post) this) (none) ) @@ -1220,7 +1220,7 @@ The faster it's moving the fast it flaps it's wings, etc (if (pegasus-calc-speed 61440.0 122880.0 204800.0 49152.0) (react-to-focus self) ) - (let ((anim-length (get-rand-float-range self 0.8 1.2))) + (let ((anim-length (rnd-float-range self 0.8 1.2))) (ja-channel-push! 1 (seconds 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) :num! (seek! max anim-length) @@ -1326,7 +1326,7 @@ The faster it's moving the fast it flaps it's wings, etc ) ;; definition for method 108 of type pegasus -(defmethod enemy-method-108 ((this pegasus) (arg0 enemy) (arg1 event-message-block)) +(defmethod enemy-method-108 ((this pegasus) (arg0 process-drawable) (arg1 event-message-block)) 0 ) diff --git a/test/decompiler/reference/jak2/levels/forest/predator_REF.gc b/test/decompiler/reference/jak2/levels/forest/predator_REF.gc index e7b4a1f3aa..f59d8369d6 100644 --- a/test/decompiler/reference/jak2/levels/forest/predator_REF.gc +++ b/test/decompiler/reference/jak2/levels/forest/predator_REF.gc @@ -482,7 +482,7 @@ ) ;; definition for method 77 of type predator -(defmethod enemy-method-77 ((this predator) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this predator) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (case (-> this incoming knocked-type) @@ -493,7 +493,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 18)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 18)) num-func-seek!) ) @@ -505,7 +505,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 14)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 14)) num-func-seek!) ) @@ -517,7 +517,7 @@ (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (ja-channel-push! 1 (seconds 0.01)) - (let ((v1-32 (get-rand-int this 2))) + (let ((v1-32 (rnd-int-count this 2))) (cond ((zero? v1-32) (let ((a0-10 (-> this skel root-channel 0))) @@ -525,7 +525,7 @@ (set! (-> a0-10 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 21)) frames num-frames) -1)) ) - (set! (-> a0-10 param 1) (-> arg0 0)) + (set! (-> a0-10 param 1) (-> arg0 anim-speed)) (set! (-> a0-10 frame-num) 0.0) (joint-control-channel-group! a0-10 (the-as art-joint-anim (-> this draw art-group data 21)) num-func-seek!) ) @@ -536,7 +536,7 @@ (set! (-> a0-12 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 22)) frames num-frames) -1)) ) - (set! (-> a0-12 param 1) (-> arg0 0)) + (set! (-> a0-12 param 1) (-> arg0 anim-speed)) (set! (-> a0-12 frame-num) 0.0) (joint-control-channel-group! a0-12 (the-as art-joint-anim (-> this draw art-group data 22)) num-func-seek!) ) @@ -551,7 +551,7 @@ (set! (-> a0-15 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 18)) frames num-frames) -1)) ) - (set! (-> a0-15 param 1) (-> arg0 0)) + (set! (-> a0-15 param 1) (-> arg0 anim-speed)) (set! (-> a0-15 frame-num) 0.0) (joint-control-channel-group! a0-15 (the-as art-joint-anim (-> this draw art-group data 18)) num-func-seek!) ) @@ -563,7 +563,7 @@ (set! (-> a0-17 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 12)) frames num-frames) -1)) ) - (set! (-> a0-17 param 1) (-> arg0 0)) + (set! (-> a0-17 param 1) (-> arg0 anim-speed)) (set! (-> a0-17 frame-num) 0.0) (joint-control-channel-group! a0-17 (the-as art-joint-anim (-> this draw art-group data 12)) num-func-seek!) ) @@ -575,7 +575,7 @@ ) ;; definition for method 78 of type predator -(defmethod enemy-method-78 ((this predator) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this predator) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (case (-> this incoming knocked-type) @@ -586,7 +586,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 20)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 20)) num-func-seek!) ) @@ -598,7 +598,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 15)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 15)) num-func-seek!) ) @@ -615,7 +615,7 @@ (set! (-> a0-8 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 23)) frames num-frames) -1)) ) - (set! (-> a0-8 param 1) (-> arg0 0)) + (set! (-> a0-8 param 1) (-> arg0 anim-speed)) (set! (-> a0-8 frame-num) 0.0) (joint-control-channel-group! a0-8 (the-as art-joint-anim (-> this draw art-group data 23)) num-func-seek!) ) @@ -627,7 +627,7 @@ (set! (-> a0-11 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 19)) frames num-frames) -1)) ) - (set! (-> a0-11 param 1) (-> arg0 0)) + (set! (-> a0-11 param 1) (-> arg0 anim-speed)) (set! (-> a0-11 frame-num) 0.0) (joint-control-channel-group! a0-11 (the-as art-joint-anim (-> this draw art-group data 19)) num-func-seek!) ) @@ -639,7 +639,7 @@ (set! (-> a0-13 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 13)) frames num-frames) -1)) ) - (set! (-> a0-13 param 1) (-> arg0 0)) + (set! (-> a0-13 param 1) (-> arg0 anim-speed)) (set! (-> a0-13 frame-num) 0.0) (joint-control-channel-group! a0-13 (the-as art-joint-anim (-> this draw art-group data 13)) num-func-seek!) ) @@ -935,7 +935,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! predator-idle-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -985,7 +985,7 @@ ) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1043,7 +1043,7 @@ :event enemy-event-handler :enter (behavior () (set-dangerous! self #t) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-6 *game-info*) (a0-3 (+ (-> v1-6 attack-id) 1)) @@ -1058,7 +1058,7 @@ ) :exit (behavior () (set-dangerous! self #f) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1079,7 +1079,7 @@ (suspend) (ja :num! (seek!)) ) - (if (zero? (get-rand-int self 3)) + (if (zero? (rnd-int-count self 3)) (sound-play "pred-talk") ) (go-virtual hostile) @@ -1233,7 +1233,7 @@ (set! (-> self next-change) (the-as uint (+ (current-time) (the int (* 300.0 (rand-vu-float-range 4.0 8.0))))) ) - (if (zero? (get-rand-int self 3)) + (if (zero? (rnd-int-count self 3)) (sound-play "pred-talk") ) ) @@ -1388,12 +1388,12 @@ ;; definition for method 55 of type predator ;; WARN: Return type mismatch int vs none. -(defmethod track-target! ((this predator)) +(defmethod common-post ((this predator)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (predator-method-183 this) @@ -1557,7 +1557,7 @@ This commonly includes things such as: (t9-0 this arg0) ) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) 0 (none) ) @@ -1601,7 +1601,7 @@ This commonly includes things such as: (set! (-> this sound) (new 'process 'ambient-sound (static-sound-spec "pred-hum" :fo-min 2 :fo-max 30) (-> this root trans)) ) - (logior! (-> this enemy-flags) (enemy-flag trackable-backup enable-on-hostile)) + (logior! (-> this enemy-flags) (enemy-flag check-water check-water-backup)) (add-icon! *minimap* this (the-as uint 16) (the-as int #f) (the-as vector #t) 0) 0 (none) 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 9dbf57a4eb..f7fd52e6bc 100644 --- a/test/decompiler/reference/jak2/levels/fortress/fort-turret_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/fort-turret_REF.gc @@ -558,12 +558,12 @@ (set! (-> *fort-turret-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for method 55 of type fort-turret -(defmethod track-target! ((this fort-turret)) +(defmethod common-post ((this fort-turret)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type enemy track-target!))) + (let ((t9-0 (method-of-type enemy common-post))) (t9-0 this) ) (let ((s5-0 (-> this root))) @@ -771,7 +771,7 @@ (set! (-> self flash-state) #f) ) :trans (behavior () - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (when (time-elapsed? (-> self state-time) (-> self reaction-time)) @@ -853,7 +853,7 @@ (set-time! (-> self state-time)) ) :trans (behavior () - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (when (time-elapsed? (-> self state-time) (-> self reaction-time)) @@ -892,7 +892,7 @@ (ja :group! fort-turret-idle-ja) ) :trans (behavior () - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (when (time-elapsed? (-> self state-time) (-> self reaction-time)) @@ -959,7 +959,7 @@ (defstate die (fort-turret) :virtual #t :enter (behavior () - (dispose! self) + (dying self) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -1003,7 +1003,7 @@ (cleanup-for-death self) ) :post (behavior () - (track-target! self) + (common-post self) ) ) @@ -1110,7 +1110,7 @@ (set! (-> this invincible) #t) ) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (set! (-> this part) (create-launch-control (-> *part-group-id-table* 685) this)) (set! (-> this gun-tilt-jm) (new 'process 'joint-mod (joint-mod-mode joint-set*) this 4)) (set! (-> this gun-shadow-jm) (the-as joint-mod (new 'process 'joint-mod-set-local this 10 #f #f #t))) diff --git a/test/decompiler/reference/jak2/levels/mountain/rhino_REF.gc b/test/decompiler/reference/jak2/levels/mountain/rhino_REF.gc index a44712db90..384f79ca61 100644 --- a/test/decompiler/reference/jak2/levels/mountain/rhino_REF.gc +++ b/test/decompiler/reference/jak2/levels/mountain/rhino_REF.gc @@ -133,7 +133,7 @@ charge ) (:methods - (rhino-method-182 (_type_ process event-message-block) symbol) + (hit-stomach? (_type_ process event-message-block) symbol) ) ) @@ -578,7 +578,7 @@ (set! (-> *rhino-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for method 182 of type rhino -(defmethod rhino-method-182 ((this rhino) (arg0 process) (arg1 event-message-block)) +(defmethod hit-stomach? ((this rhino) (arg0 process) (arg1 event-message-block)) (let* ((gp-0 (-> arg1 param 0)) (s5-0 arg0) (s2-0 (if (type? s5-0 process-drawable) @@ -618,7 +618,7 @@ (let ((t9-0 (method-of-type nav-enemy enemy-method-58))) (t9-0 this arg0 arg1) ) - (if (rhino-method-182 this arg0 arg1) + (if (hit-stomach? this arg0 arg1) 'hit 'hit-flinch ) @@ -835,7 +835,7 @@ (t9-2) ) ) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable)) ) :exit (behavior () (local-vars (v0-1 enemy-flag)) @@ -845,9 +845,9 @@ ) ) (let ((v1-4 (-> self enemy-flags))) - (if (logtest? v1-4 (enemy-flag checking-water)) - (set! v0-1 (logior v1-4 (enemy-flag enable-on-active))) - (set! v0-1 (logclear v1-4 (enemy-flag enable-on-active))) + (if (logtest? v1-4 (enemy-flag vulnerable-backup)) + (set! v0-1 (logior v1-4 (enemy-flag vulnerable))) + (set! v0-1 (logclear v1-4 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v0-1) @@ -880,14 +880,14 @@ :virtual #t :enter (behavior () (remove-setting! 'sound-mode) - (dispose! self) + (dying self) (set! (-> self hit-points) 0) 0 ) :code (behavior () (set! (-> self smush-target) (the-as smush-control #t)) (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) (gp-0 #t) ) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info die-anim)) @@ -918,7 +918,7 @@ :code (behavior () (local-vars (v1-67 enemy-flag) (v1-75 enemy-flag)) (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info hit-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -941,29 +941,29 @@ ) ) (ja-channel-push! 1 (seconds 0.075)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-66 (-> self enemy-flags))) - (if (logtest? v1-66 (enemy-flag checking-water)) - (set! v1-67 (logior v1-66 (enemy-flag enable-on-active))) - (set! v1-67 (logclear v1-66 (enemy-flag enable-on-active))) + (if (logtest? v1-66 (enemy-flag vulnerable-backup)) + (set! v1-67 (logior v1-66 (enemy-flag vulnerable))) + (set! v1-67 (logclear v1-66 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-67) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-74 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-74) - (set! v1-75 (logior (enemy-flag check-water-backup) v1-74)) - (set! v1-75 (logclear v1-74 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-74) + (set! v1-75 (logior (enemy-flag trackable) v1-74)) + (set! v1-75 (logclear v1-74 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-75) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (go-hostile self) ) @@ -973,21 +973,21 @@ (defmethod damage-amount-from-attack ((this rhino) (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]]" (-> arg1 param 1) - (let ((f30-0 (the float (penetrate-using->damage (the-as penetrate (-> this incoming penetrate-using)))))) + (let ((f30-0 (the float (penetrate-using->damage (-> this incoming penetrate-using))))) (cond - ((rhino-method-182 this arg0 arg1) + ((hit-stomach? this arg0 arg1) (set! (-> this stomach-touched-once?) #t) (the int (* 4.0 f30-0)) ) - ((logtest? #xc0000 (-> this incoming penetrate-using)) - (if (and (logtest? #x40000 (-> this incoming penetrate-using)) - (logtest? #x80000 (-> this incoming penetrate-using)) + ((logtest? (penetrate dark-bomb dark-giant) (-> this incoming penetrate-using)) + (if (and (logtest? (penetrate dark-bomb) (-> this incoming penetrate-using)) + (logtest? (penetrate dark-giant) (-> this incoming penetrate-using)) ) #x420c0000 (the int (* 1.8 f30-0)) ) ) - ((logtest? #x20000 (-> this incoming penetrate-using)) + ((logtest? (penetrate dark-punch) (-> this incoming penetrate-using)) (the int (* 2.0 f30-0)) ) (else @@ -1140,7 +1140,7 @@ (set! (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 1 prim-core collide-with) (collide-spec) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1322,7 +1322,7 @@ (set! (-> self charge-straight) #f) (nav-enemy-method-166 self) (set-time! (-> self state-time)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) ) :trans (behavior () (let ((t9-0 (-> (method-of-type nav-enemy hostile) trans))) @@ -1411,7 +1411,7 @@ (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -1437,7 +1437,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let* ((v1-4 *game-info*) (a0-2 (+ (-> v1-4 attack-id) 1)) @@ -1464,8 +1464,8 @@ 0 ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1478,7 +1478,7 @@ (ja-channel-push! 1 (seconds 0.05)) (ja-no-eval :group! rhino-attack-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) (set! gp-0 #t) ) (suspend) @@ -1782,8 +1782,8 @@ (ja-channel-push! 1 (seconds 0.1)) ) ) - (let ((s5-0 (get-rand-int self 8)) - (f30-0 (get-rand-float-range self 0.9 1.1)) + (let ((s5-0 (rnd-int-count self 8)) + (f30-0 (rnd-float-range self 0.9 1.1)) ) (while (nonzero? s5-0) (+! s5-0 -1) @@ -1811,7 +1811,7 @@ (ja-channel-push! 1 (seconds 0.1)) ) ) - (let ((f30-2 (get-rand-float-range self 0.9 1.1))) + (let ((f30-2 (rnd-float-range self 0.9 1.1))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info victory-anim)) :num! (seek! max f30-2) :frame-num 0.0 @@ -1979,7 +1979,7 @@ (set-gravity-length (-> this root dynam) 573440.0) (logior! (-> this nav flags) (nav-control-flag momentum-ignore-heading)) (logior! (-> this focus-status) (focus-status dangerous)) - (logior! (-> this enemy-flags) (enemy-flag check-water)) + (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) 0 (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 22b909fc6e..8488c97cf7 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 @@ -1546,12 +1546,12 @@ ) ;; definition for method 132 of type metalkor-flitter -(defmethod dispose! ((this metalkor-flitter)) +(defmethod dying ((this metalkor-flitter)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (with-pp - (when (not (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags))) + (when (not (logtest? (enemy-flag called-dying) (-> this enemy-flags))) (when (and (>= (-> this enemy-info gem-joint) 0) - (not (logtest? (enemy-flag cam-attack-mode) (-> this enemy-flags))) + (not (logtest? (enemy-flag spawn-gem) (-> this enemy-flags))) (let ((a1-0 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-0 from) (process->ppointer pp)) (set! (-> a1-0 num-params) 0) @@ -1562,7 +1562,7 @@ ) ) ) - (logior! (-> this enemy-flags) (enemy-flag cam-attack-mode)) + (logior! (-> this enemy-flags) (enemy-flag spawn-gem)) (remove-from-process *part-engine* this) (setup-masks (-> this draw) @@ -1586,18 +1586,18 @@ ) ) ) - ((method-of-type flitter dispose!) this) + ((method-of-type flitter dying) this) (none) ) ) ;; definition for method 132 of type metalkor-wasp -(defmethod dispose! ((this metalkor-wasp)) +(defmethod dying ((this metalkor-wasp)) "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (with-pp - (when (not (logtest? (enemy-flag recover-applied-velocity) (-> this enemy-flags))) + (when (not (logtest? (enemy-flag called-dying) (-> this enemy-flags))) (when (and (>= (-> this enemy-info gem-joint) 0) - (not (logtest? (enemy-flag cam-attack-mode) (-> this enemy-flags))) + (not (logtest? (enemy-flag spawn-gem) (-> this enemy-flags))) (let ((a1-0 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-0 from) (process->ppointer pp)) (set! (-> a1-0 num-params) 0) @@ -1608,7 +1608,7 @@ ) ) ) - (logior! (-> this enemy-flags) (enemy-flag cam-attack-mode)) + (logior! (-> this enemy-flags) (enemy-flag spawn-gem)) (remove-from-process *part-engine* this) (setup-masks (-> this draw) @@ -1632,7 +1632,7 @@ ) ) ) - ((method-of-type wasp dispose!) this) + ((method-of-type wasp dying) this) (none) ) ) 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 5172c66e10..4eaab33990 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 @@ -2041,11 +2041,9 @@ This commonly includes things such as: (let ((v1-48 (-> v1-47 0))) (when (>= (-> v1-48 length) 1) (let ((s5-2 (-> v1-48 data 0 actor))) - (let ((a0-52 (search-process-tree - *active-pool* - (lambda ((arg0 gem-tracker)) (= (-> arg0 type) flitter-gem-tracker) (none)) - ) - ) + (let ((a0-52 + (search-process-tree *active-pool* (lambda ((arg0 gem-tracker)) (= (-> arg0 type) flitter-gem-tracker))) + ) ) (if a0-52 (set! (-> this flitter-gem-tracker) (process->handle a0-52)) @@ -2056,9 +2054,7 @@ This commonly includes things such as: ) ) ) - (let ((a0-63 - (search-process-tree *active-pool* (lambda ((arg0 gem-tracker)) (= (-> arg0 type) wasp-gem-tracker) (none))) - ) + (let ((a0-63 (search-process-tree *active-pool* (lambda ((arg0 gem-tracker)) (= (-> arg0 type) wasp-gem-tracker)))) ) (if a0-63 (set! (-> this wasp-gem-tracker) (process->handle a0-63)) @@ -2101,3 +2097,7 @@ 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 df71188c70..bcf3bc1c38 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 @@ -544,19 +544,22 @@ ) ;; definition for function metalkor-get-gem-tracker -;; WARN: Return type mismatch process vs none. +;; WARN: Return type mismatch process vs gem-tracker. +;; WARN: disable def twice: 9. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +;; WARN: disable def twice: 26. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. (defbehavior metalkor-get-gem-tracker metalkor ((arg0 process-focusable)) - (cond - ((type? arg0 metalkor-wasp) - (handle->process (-> self wasp-gem-tracker)) - ) - ((type? arg0 metalkor-flitter) - (handle->process (-> self flitter-gem-tracker)) - ) - (else - ) - ) - (none) + (the-as gem-tracker (cond + ((type? arg0 metalkor-wasp) + (handle->process (-> self wasp-gem-tracker)) + ) + ((type? arg0 metalkor-flitter) + (handle->process (-> self flitter-gem-tracker)) + ) + (else + (the-as process #f) + ) + ) + ) ) ;; definition for function metalkor-handler @@ -623,7 +626,7 @@ (set! (-> s4-0 param 3) (-> arg3 param 3)) (set! (-> s4-0 param 4) (-> arg3 param 4)) (set! (-> s4-0 param 5) (-> arg3 param 5)) - (send-event-function (the-as process-tree (metalkor-get-gem-tracker (the-as process-focusable arg0))) s4-0) + (send-event-function (metalkor-get-gem-tracker (the-as process-focusable arg0)) s4-0) ) ) (('setup-flitter-gem) @@ -2833,3 +2836,7 @@ (do-push-aways (-> self root)) ) ) + + + + 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 319ade617d..64af5463f0 100644 --- a/test/decompiler/reference/jak2/levels/nest/flying-spider_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/flying-spider_REF.gc @@ -206,16 +206,16 @@ (defstate ambush (flying-spider) :virtual #t :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) ) ) ) - (logclear! (-> self enemy-flags) (enemy-flag lock-focus death-start)) - (set! (-> self path-du) (get-rand-float-range self 0.2 0.5)) + (logclear! (-> self enemy-flags) (enemy-flag look-at-focus look-at-move-dest)) + (set! (-> self path-du) (rnd-float-range self 0.2 0.5)) (set-vector! (-> self root scale) 0.0 0.0 0.0 0.0) ) :trans (behavior () @@ -286,7 +286,7 @@ ) :post (behavior () (let ((a1-0 (new 'stack-no-clear 'collide-query))) - (enemy-method-125 self a1-0 (-> self root root-prim prim-core collide-with) 8192.0 81920.0 1024.0) + (ground-pat-set! self a1-0 (-> self root root-prim prim-core collide-with) 8192.0 81920.0 1024.0) ) (flying-spider-method-182 self (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) (nav-enemy-falling-post) @@ -536,14 +536,14 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (dispose! self) + (dying self) (set-time! (-> self state-time)) (set! (-> self hit-points) 0) (enemy-method-103 self) ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info die-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -575,15 +575,15 @@ (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (cond @@ -596,7 +596,7 @@ ) ) ) - (zero? (get-rand-int this 3)) + (zero? (rnd-int-count this 3)) (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) (f1-0 32768.0) ) @@ -636,19 +636,19 @@ ) ;; definition for method 55 of type flying-spider -(defmethod track-target! ((this flying-spider)) +(defmethod common-post ((this flying-spider)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - ((method-of-type nav-enemy track-target!) this) + ((method-of-type nav-enemy common-post) this) (none) ) ;; definition for method 125 of type flying-spider ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs pat-surface. -(defmethod enemy-method-125 ((this flying-spider) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) +(defmethod ground-pat-set! ((this flying-spider) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) (the-as pat-surface (when (find-ground (-> this root) arg0 arg1 arg2 arg3 arg4) diff --git a/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc b/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc index d6569393be..dcbcce5f7e 100644 --- a/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc @@ -518,7 +518,7 @@ (until #f (mammoth-walk-check-end) (set-nav-destination) - (let ((v1-20 (if (rng-hit? self 0.5) + (let ((v1-20 (if (rnd-percent? self 0.5) 6 7 ) @@ -576,9 +576,9 @@ :trans (behavior () (when (and (not (time-elapsed? (-> self lightning-timer) (seconds 3))) (< (-> self spawn-timer) (current-time))) (let ((s5-0 *mammoth-lightning-joint-tbl*)) - (mammoth-method-185 self (-> self root trans) (-> s5-0 (get-rand-int self (-> s5-0 length)))) + (mammoth-method-185 self (-> self root trans) (-> s5-0 (rnd-int-count self (-> s5-0 length)))) ) - (set! (-> self spawn-timer) (+ (current-time) (the int (* 300.0 (get-rand-float-range self 0.0 0.1))))) + (set! (-> self spawn-timer) (+ (current-time) (the int (* 300.0 (rnd-float-range self 0.0 0.1))))) ) ) :code (behavior () @@ -760,15 +760,15 @@ (('hit) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) ) @@ -870,7 +870,7 @@ ;; definition for method 125 of type mammoth ;; WARN: Return type mismatch symbol vs pat-surface. -(defmethod enemy-method-125 ((this mammoth) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) +(defmethod ground-pat-set! ((this mammoth) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) (the-as pat-surface (when (find-ground (-> this root) arg0 arg1 arg2 arg3 arg4) @@ -1427,13 +1427,13 @@ ;; definition for method 55 of type mammoth ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod track-target! ((this mammoth)) +(defmethod common-post ((this mammoth)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (local-vars (sv-752 lightning-spec) (sv-768 int) (sv-784 symbol) (sv-800 mammoth)) - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (mammoth-update-ik) @@ -1544,7 +1544,7 @@ (set! sv-768 600) (set! sv-784 (the-as symbol #f)) (set! sv-800 this) - (let ((t2-0 (-> (the-as (pointer int32) (&+ s4-2 (* (get-rand-int this s3-2) 4))))) + (let ((t2-0 (-> (the-as (pointer int32) (&+ s4-2 (* (rnd-int-count this s3-2) 4))))) (t3-0 6) ) ((the-as (function object object object object object object object object none) s5-3) @@ -1564,7 +1564,7 @@ ) ) (set! (-> this lightning-attack-timer) - (+ (current-time) (the int (* 300.0 (get-rand-float-range this 0.067 0.1)))) + (+ (current-time) (the int (* 300.0 (rnd-float-range this 0.067 0.1)))) ) ) ) @@ -1782,7 +1782,7 @@ (set! (-> this lightning-timer) 0) (set! (-> this lightning-attack-timer) 0) (set-time! (-> this feet-ik-init-timer)) - (logclear! (-> this enemy-flags) (enemy-flag check-water-backup)) + (logclear! (-> this enemy-flags) (enemy-flag trackable)) 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 feba8cafc6..53a3039106 100644 --- a/test/decompiler/reference/jak2/levels/nest/mantis_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/mantis_REF.gc @@ -455,7 +455,7 @@ :code (behavior () (ja-channel-push! 1 (seconds 0.2)) (until #f - (let ((gp-0 (get-rand-int-range self 3 5))) + (let ((gp-0 (rnd-int-range self 3 5))) (dotimes (s5-0 gp-0) (ja-no-eval :group! mantis-idle0-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) @@ -469,7 +469,7 @@ (suspend) (ja :num! (seek!)) ) - (let ((gp-1 (get-rand-int self 3))) + (let ((gp-1 (rnd-int-count self 3))) (dotimes (s5-1 gp-1) (ja-no-eval :group! mantis-idle1-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) @@ -493,8 +493,8 @@ (defstate ambush (mantis) :virtual #t :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -575,12 +575,12 @@ ) (logior! (-> self draw status) (draw-control-status no-draw)) (let ((gp-2 (current-time))) - (until (time-elapsed? gp-2 (the int (* 300.0 (get-rand-float-range self 0.0 0.6)))) + (until (time-elapsed? gp-2 (the int (* 300.0 (rnd-float-range self 0.0 0.6)))) (suspend) ) ) (logclear! (-> self draw status) (draw-control-status no-draw)) - (if (rng-hit? self 0.5) + (if (rnd-percent? self 0.5) (go-virtual ambush-jumping) (go-virtual ambush-crawling) ) @@ -592,7 +592,7 @@ :virtual #t :event enemy-event-handler :code (behavior () - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set! (-> self root trans y) (-> self base-height)) (ja-channel-push! 1 0) (ja-no-eval :group! mantis-ground-crawl-out-ja :num! (seek!) :frame-num 0.0) @@ -626,7 +626,7 @@ (set! (-> v1-3 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-3 enemy-flags)))) ) 0 - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) (set-time! (-> self state-time)) (set! (-> self root trans y) (+ -18841.6 (-> self base-height))) (let ((gp-0 (-> self root))) @@ -635,7 +635,7 @@ (set! (-> v1-11 y) 0.0) ) (vector-reset! (-> gp-0 transv)) - (set! (-> gp-0 transv y) (* 4096.0 (get-rand-float-range self 28.0 32.0))) + (set! (-> gp-0 transv y) (* 4096.0 (rnd-float-range self 28.0 32.0))) ) ) :code (behavior () @@ -816,7 +816,7 @@ (set! (-> v1-0 nav callback-info) *nav-enemy-null-callback-info*) ) 0 - (dotimes (gp-0 (get-rand-int-range self 1 2)) + (dotimes (gp-0 (rnd-int-range self 1 2)) (ja-no-eval :group! mantis-idle0-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -835,7 +835,7 @@ (s2-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) ) - (let ((f30-1 (* 4096.0 (get-rand-float-range self 8.0 12.0))) + (let ((f30-1 (* 4096.0 (rnd-float-range self 8.0 12.0))) (s1-0 (cloest-point-on-mesh (-> self nav) s5-0 s5-0 (the-as nav-poly #f))) ) (vector-normalize-copy! s2-0 s4-1 1.0) @@ -892,7 +892,7 @@ (set! (-> v1-73 nav callback-info) (-> v1-73 enemy-info callback-info)) ) 0 - (dotimes (gp-2 (get-rand-int-range self 3 5)) + (dotimes (gp-2 (rnd-int-range self 3 5)) (ja-no-eval :group! mantis-run0-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -929,7 +929,7 @@ (set-time! (-> self attack-timer)) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -945,7 +945,7 @@ (suspend) (ja :num! (seek!)) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -982,7 +982,7 @@ (set-time! (-> self attack-timer)) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1026,7 +1026,7 @@ (suspend) (ja :num! (seek!)) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1157,8 +1157,8 @@ :event enemy-event-handler :enter (behavior () (set-time! (-> self state-time)) - (look-at-target! self (enemy-flag lock-focus)) - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (look-at-target! self (enemy-flag look-at-focus)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) (let ((v1-6 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-6 enemy-flags))) (set! (-> v1-6 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-6 enemy-flags)))) @@ -1224,7 +1224,7 @@ ) ) ) - (dotimes (gp-1 (get-rand-int-range self 2 4)) + (dotimes (gp-1 (rnd-int-range self 2 4)) (ja-no-eval :group! mantis-idle0-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -1259,15 +1259,15 @@ (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (cond @@ -1280,7 +1280,7 @@ ) ) ) - (zero? (get-rand-int this 3)) + (zero? (rnd-int-count this 3)) (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) (f1-0 32768.0) ) @@ -1312,7 +1312,7 @@ ) ;; definition for method 77 of type mantis -(defmethod enemy-method-77 ((this mantis) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this mantis) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (ja-channel-push! 1 (seconds 0.02)) @@ -1321,7 +1321,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 27)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 27)) num-func-seek!) ) @@ -1334,7 +1334,7 @@ (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 10)) frames num-frames) -1)) ) - (set! (-> a0-5 param 1) (-> arg0 0)) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) (set! (-> a0-5 frame-num) 0.0) (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> this draw art-group data 10)) num-func-seek!) ) @@ -1344,7 +1344,7 @@ ) ;; definition for method 78 of type mantis -(defmethod enemy-method-78 ((this mantis) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this mantis) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (ja-channel-push! 1 (seconds 0.1)) @@ -1353,7 +1353,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 26)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 26)) num-func-seek!) ) @@ -1367,7 +1367,7 @@ (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 28)) frames num-frames) -1)) ) - (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) (set! (-> a0-4 frame-num) 0.0) (joint-control-channel-group! a0-4 (the-as art-joint-anim (-> this draw art-group data 28)) num-func-seek!) ) @@ -1380,7 +1380,7 @@ (set! (-> a0-6 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 11)) frames num-frames) -1)) ) - (set! (-> a0-6 param 1) (-> arg0 0)) + (set! (-> a0-6 param 1) (-> arg0 anim-speed)) (set! (-> a0-6 frame-num) 0.0) (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> this draw art-group data 11)) num-func-seek!) ) @@ -1392,7 +1392,7 @@ ;; definition for method 125 of type mantis ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs pat-surface. -(defmethod enemy-method-125 ((this mantis) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) +(defmethod ground-pat-set! ((this mantis) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) (the-as pat-surface (when (find-ground (-> this root) arg0 arg1 arg2 arg3 arg4) @@ -1501,13 +1501,13 @@ ;; definition for method 55 of type mantis ;; INFO: Used lq/sq ;; WARN: Return type mismatch vector vs none. -(defmethod track-target! ((this mantis)) +(defmethod common-post ((this mantis)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (local-vars (s5-0 vector)) - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (logclear! (-> this flags) (mantis-flag tracked)) @@ -1658,7 +1658,9 @@ (set! (-> s5-0 start-anim) (the-as uint 12)) (set! (-> s5-0 air-anim) (the-as uint 13)) (set! (-> s5-0 land-anim) (the-as uint 0)) - (set! (-> this enemy-flags) (the-as enemy-flag (logclear (-> this enemy-flags) (enemy-flag vulnerable)))) + (set! (-> this enemy-flags) + (the-as enemy-flag (logclear (-> this enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event this 'jump 0 (-> s5-0 destination)) ) ) @@ -1671,17 +1673,17 @@ (let ((s5-0 (-> this jump))) (vector-length arg1) (vector-normalize! arg1 1.0) - (vector-rotate-y! arg1 arg1 (* 182.04445 (get-rand-float-range this -45.0 45.0))) - (let ((a2-5 - (vector-normalize-copy! (new 'stack-no-clear 'vector) arg1 (* 4096.0 (get-rand-float-range this -4.0 -6.0))) - ) + (vector-rotate-y! arg1 arg1 (* 182.04445 (rnd-float-range this -45.0 45.0))) + (let ((a2-5 (vector-normalize-copy! (new 'stack-no-clear 'vector) arg1 (* 4096.0 (rnd-float-range this -4.0 -6.0)))) ) (when (mantis-method-189 this (-> s5-0 destination) a2-5) (set! (-> s5-0 direction) (the-as uint 1)) (set! (-> s5-0 start-anim) (the-as uint 14)) (set! (-> s5-0 air-anim) (the-as uint 15)) (set! (-> s5-0 land-anim) (the-as uint 16)) - (set! (-> this enemy-flags) (the-as enemy-flag (logclear (-> this enemy-flags) (enemy-flag vulnerable)))) + (set! (-> this enemy-flags) + (the-as enemy-flag (logclear (-> this enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event this 'jump 0 (-> s5-0 destination)) ) ) @@ -1695,9 +1697,9 @@ (let ((s5-0 (-> this jump))) (vector-length arg1) (vector-normalize! arg1 1.0) - (vector-rotate-y! arg1 arg1 (* 182.04445 (get-rand-float-range this -45.0 45.0))) + (vector-rotate-y! arg1 arg1 (* 182.04445 (rnd-float-range this -45.0 45.0))) (let ((a2-5 - (vector-normalize-copy! (new 'stack-no-clear 'vector) arg1 (* 4096.0 (get-rand-float-range this -15.0 -22.0))) + (vector-normalize-copy! (new 'stack-no-clear 'vector) arg1 (* 4096.0 (rnd-float-range this -15.0 -22.0))) ) ) (when (mantis-method-189 this (-> s5-0 destination) a2-5) @@ -1705,7 +1707,9 @@ (set! (-> s5-0 start-anim) (the-as uint 20)) (set! (-> s5-0 air-anim) (the-as uint 21)) (set! (-> s5-0 land-anim) (the-as uint 22)) - (set! (-> this enemy-flags) (the-as enemy-flag (logclear (-> this enemy-flags) (enemy-flag vulnerable)))) + (set! (-> this enemy-flags) + (the-as enemy-flag (logclear (-> this enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event this 'jump 0 (-> s5-0 destination)) ) ) @@ -1816,14 +1820,13 @@ ;; definition for method 92 of type mantis ;; WARN: Return type mismatch quaternion vs none. -(defmethod enemy-method-92 ((this mantis) (arg0 int) (arg1 nav-poly)) - "TODO - nav-poly is a guess -@abstract" +(defmethod enemy-method-92 ((this mantis) (arg0 int) (arg1 enemy-jump-info)) + "@abstract" (let ((v1-0 arg0)) (when (or (zero? v1-0) (= v1-0 1) (= v1-0 2) (= v1-0 3)) (let ((a0-4 this)) (when (logtest? (enemy-flag enemy-flag37) (-> a0-4 enemy-flags)) - (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> arg1 vertex2) (-> this root trans)))) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> arg1 dest-pos) (-> this root trans)))) (vector-normalize! s5-1 1.0) (let ((v1-5 (-> this jump direction))) (cond 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 bb7348026b..e81a8e53b8 100644 --- a/test/decompiler/reference/jak2/levels/ruins/mechtest-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/ruins/mechtest-obs_REF.gc @@ -5,7 +5,9 @@ (deftype mechblock (process-drawable) ((root collide-shape-moving :override) (origin vector :inline) - (drop-point vector :inline :offset 256) + (unknown-quat quaternion :inline) + (unknown-vector vector :inline) + (drop-point vector :inline) (allow-drag? symbol) (reset-on-land? symbol) (hit-something? symbol) @@ -97,7 +99,7 @@ (-> self root) (vector+! (new 'stack-no-clear 'vector) (-> self origin) (new 'static 'vector :y 81920.0 :w 1.0)) ) - (quaternion-copy! (-> self root quat) (the-as quaternion (&-> self stack 96))) + (quaternion-copy! (-> self root quat) (-> self unknown-quat)) (set-vector! (-> self root transv) 0.0 -4096.0 0.0 1.0) (set! (-> self drop-point quad) (-> self origin quad)) (go-virtual fall) 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 7f1ca5c127..5d7927aa33 100644 --- a/test/decompiler/reference/jak2/levels/ruins/rapid-gunner_REF.gc +++ b/test/decompiler/reference/jak2/levels/ruins/rapid-gunner_REF.gc @@ -265,15 +265,15 @@ (('hit 'hit-flinch) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (go (method-of-object this knocked)) @@ -293,7 +293,7 @@ ;; WARN: Return type mismatch object vs symbol. ;; WARN: Using new Jak 2 rtype-of ;; WARN: Using new Jak 2 rtype-of -(defmethod enemy-method-77 ((this rapid-gunner) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this rapid-gunner) (arg0 enemy-knocked-info)) (let ((v1-0 (-> this incoming knocked-type))) (the-as symbol @@ -312,7 +312,7 @@ ) ) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 @@ -327,7 +327,7 @@ (s4-0 (new 'static 'array int64 3 20 21 22)) (s3-0 (new 'static 'array int32 4 0 0 0 0)) (a2-1 (ash 1 (-> s3-0 0))) - (v1-27 (enemy-method-120 this a1-11 a2-1)) + (v1-27 (rnd-bit this a1-11 a2-1)) (s4-1 (-> this draw art-group data (-> (the-as (pointer int32) (+ (* v1-27 8) (the-as int s4-0)))))) ) (set! (-> s3-0 0) v1-27) @@ -344,7 +344,7 @@ (let ((a0-19 (-> this skel root-channel 0))) (set! (-> a0-19 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-19 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-19 param 1) (-> arg0 0)) + (set! (-> a0-19 param 1) (-> arg0 anim-speed)) (set! (-> a0-19 frame-num) 0.0) (joint-control-channel-group! a0-19 (the-as art-joint-anim s4-1) num-func-seek!) ) @@ -360,7 +360,7 @@ (set! (-> a0-22 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 20)) frames num-frames) -1)) ) - (set! (-> a0-22 param 1) (-> arg0 0)) + (set! (-> a0-22 param 1) (-> arg0 anim-speed)) (set! (-> a0-22 frame-num) 0.0) (joint-control-channel-group! a0-22 (the-as art-joint-anim (-> this draw art-group data 20)) num-func-seek!) ) @@ -371,7 +371,7 @@ (s5-1 (new 'static 'array int64 3 24 25 26)) (s4-2 (new 'static 'array int32 4 0 0 0 0)) (a2-4 (ash 1 (-> s4-2 0))) - (v1-59 (enemy-method-120 this a1-21 a2-4)) + (v1-59 (rnd-bit this a1-21 a2-4)) (s5-2 (-> this draw art-group data (-> (the-as (pointer int32) (+ (* v1-59 8) (the-as int s5-1)))))) ) (set! (-> s4-2 0) v1-59) @@ -402,7 +402,7 @@ ) (set! (-> a0-43 frame-group) (the-as art-joint-anim a1-28)) (set! (-> a0-43 param 0) (the float (+ (-> (the-as art-joint-anim a1-28) frames num-frames) -1))) - (set! (-> a0-43 param 1) (-> arg0 0)) + (set! (-> a0-43 param 1) (-> arg0 anim-speed)) (set! (-> a0-43 frame-num) 0.0) (joint-control-channel-group! a0-43 (the-as art-joint-anim a1-28) num-func-seek!) ) @@ -436,7 +436,7 @@ ) ;; definition for method 78 of type rapid-gunner -(defmethod enemy-method-78 ((this rapid-gunner) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this rapid-gunner) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) @@ -446,7 +446,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 27)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 27)) num-func-seek!) ) @@ -464,7 +464,7 @@ ) (set! (-> a0-10 frame-group) (the-as art-joint-anim a1-5)) (set! (-> a0-10 param 0) (the float (+ (-> (the-as art-joint-anim a1-5) frames num-frames) -1))) - (set! (-> a0-10 param 1) (-> arg0 0)) + (set! (-> a0-10 param 1) (-> arg0 anim-speed)) (set! (-> a0-10 frame-num) 0.0) (joint-control-channel-group! a0-10 (the-as art-joint-anim a1-5) num-func-seek!) ) @@ -477,7 +477,7 @@ ) (set! (-> a0-13 frame-group) (the-as art-joint-anim a1-6)) (set! (-> a0-13 param 0) (the float (+ (-> (the-as art-joint-anim a1-6) frames num-frames) -1))) - (set! (-> a0-13 param 1) (-> arg0 0)) + (set! (-> a0-13 param 1) (-> arg0 anim-speed)) (set! (-> a0-13 frame-num) 0.0) (joint-control-channel-group! a0-13 (the-as art-joint-anim a1-6) num-func-seek!) ) @@ -599,12 +599,12 @@ ;; definition for method 55 of type rapid-gunner ;; WARN: Return type mismatch int vs none. -(defmethod track-target! ((this rapid-gunner)) +(defmethod common-post ((this rapid-gunner)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (los-control-method-9 (-> this los) (the-as process-focusable #f) (the-as vector #f) 2048.0) @@ -641,20 +641,20 @@ (defstate notice (rapid-gunner) :virtual #t :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) - (look-at-target! self (enemy-flag lock-focus)) - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) + (look-at-target! self (enemy-flag look-at-focus)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) ) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag chase-startup)) + (if (logtest? (-> self enemy-flags) (enemy-flag alert)) (go-virtual hostile) ) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logior! (-> self enemy-flags) (enemy-flag alert)) (let ((v1-23 self)) (set! (-> v1-23 enemy-flags) (the-as enemy-flag (logclear (-> v1-23 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-23 nav callback-info) *nav-enemy-null-callback-info*) @@ -685,7 +685,7 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -751,7 +751,7 @@ ) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -918,7 +918,7 @@ ) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1039,7 +1039,7 @@ ) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1181,7 +1181,7 @@ 0 ) :trans (behavior () - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (let ((gp-0 (handle->process (-> self focus handle)))) @@ -1249,7 +1249,7 @@ ) ) ) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! rapid-gunner-aim-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -1295,7 +1295,7 @@ ) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) diff --git a/test/decompiler/reference/jak2/levels/sewer/escort/grim_REF.gc b/test/decompiler/reference/jak2/levels/sewer/escort/grim_REF.gc index 9d877e37ee..8fba9aa2d9 100644 --- a/test/decompiler/reference/jak2/levels/sewer/escort/grim_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/escort/grim_REF.gc @@ -82,7 +82,7 @@ (let ((t9-0 (method-of-type jinx init-enemy!))) (t9-0 this) ) - (set! (-> this channel) (the-as uint 25)) + (set! (-> this channel) (gui-channel grim)) (set! (-> this min-speed) 20480.0) (set! (-> this max-speed) 40960.0) (set! (-> this follow-offset) 12288.0) 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 4a90b118b9..991b1161f4 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 @@ -33,7 +33,7 @@ ) ) (until #f - (let ((gp-0 (get-rand-int self 5))) + (let ((gp-0 (rnd-int-count self 5))) (while (>= gp-0 0) (let ((v1-57 (ja-group))) (if (not (and v1-57 (= v1-57 jinx-idle0-ja))) @@ -59,7 +59,7 @@ (suspend) (ja :num! (seek!)) ) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) ) #f ) @@ -207,7 +207,7 @@ ) (let ((gp-0 0)) (until #f - (countdown (s5-0 (get-rand-int-range self 1 3)) + (countdown (s5-0 (rnd-int-range self 1 3)) (let ((v1-57 (ja-group))) (if (not (and v1-57 (= v1-57 jinx-scared0-ja))) (ja-channel-push! 1 (seconds 0.1)) @@ -219,7 +219,7 @@ (ja :num! (seek!)) ) ) - (set! gp-0 (enemy-method-120 self 5 (logior (ash 1 gp-0) 1))) + (set! gp-0 (rnd-bit self 5 (logior (ash 1 gp-0) 1))) (let ((s5-1 (-> self draw art-group data (-> *jinx-global-info* scared-idle-anim gp-0)))) (let ((v1-98 (ja-group))) (if (not (and v1-98 (= v1-98 s5-1))) @@ -402,7 +402,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.1)) - (let ((a1-2 (-> self draw art-group data (-> *jinx-global-info* kick-anim (get-rand-int self 2))))) + (let ((a1-2 (-> self draw art-group data (-> *jinx-global-info* kick-anim (rnd-int-count self 2))))) (ja-no-eval :group! a1-2 :num! (seek!) :frame-num 0.0) ) (until (ja-done? 0) @@ -505,8 +505,8 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.07)) - (let ((gp-1 (-> self draw art-group data (-> *jinx-global-info* bomb-recoil-anim (get-rand-int self 2)))) - (f30-0 (get-rand-float-range self 0.4 0.8)) + (let ((gp-1 (-> self draw art-group data (-> *jinx-global-info* bomb-recoil-anim (rnd-int-count self 2)))) + (f30-0 (rnd-float-range self 0.4 0.8)) ) (ja-no-eval :group! gp-1 :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -523,29 +523,29 @@ :virtual #t :code (behavior () (local-vars (v1-7 enemy-flag) (v1-15 enemy-flag)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) (let ((v1-6 (-> self enemy-flags))) - (if (logtest? v1-6 (enemy-flag checking-water)) - (set! v1-7 (logior v1-6 (enemy-flag enable-on-active))) - (set! v1-7 (logclear v1-6 (enemy-flag enable-on-active))) + (if (logtest? v1-6 (enemy-flag vulnerable-backup)) + (set! v1-7 (logior v1-6 (enemy-flag vulnerable))) + (set! v1-7 (logclear v1-6 (enemy-flag vulnerable))) ) ) (set! (-> self enemy-flags) v1-7) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup)) (logior! (-> self mask) (process-mask collectable)) (logclear! (-> self mask) (process-mask collectable)) ) (let ((v1-14 (-> self enemy-flags))) - (if (logtest? (enemy-flag no-initial-move-to-ground) v1-14) - (set! v1-15 (logior (enemy-flag check-water-backup) v1-14)) - (set! v1-15 (logclear v1-14 (enemy-flag check-water-backup))) + (if (logtest? (enemy-flag trackable-backup) v1-14) + (set! v1-15 (logior (enemy-flag trackable) v1-14)) + (set! v1-15 (logclear v1-14 (enemy-flag trackable))) ) ) (set! (-> self enemy-flags) v1-15) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) (logclear! (-> self focus-status) (focus-status hit)) (react-to-focus self) ) diff --git a/test/decompiler/reference/jak2/levels/sewer/escort/jinx_REF.gc b/test/decompiler/reference/jak2/levels/sewer/escort/jinx_REF.gc index 28dc2dc970..a5dc7e0778 100644 --- a/test/decompiler/reference/jak2/levels/sewer/escort/jinx_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/escort/jinx_REF.gc @@ -347,7 +347,7 @@ (set! (-> this min-speed) 24576.0) (set! (-> this max-speed) 49152.0) (set! (-> this follow-offset) 24576.0) - (set! (-> this channel) (the-as uint 24)) + (set! (-> this channel) (gui-channel jinx)) (set! (-> this notice-enemy-dist) 204800.0) (set! (-> this travel-anim-interp) 0.0) (set! (-> this focus-info max-los-dist) 61440.0) @@ -381,7 +381,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch (pointer process) vs none. (defmethod fire-gun ((this jinx) (arg0 vector)) - (set! (-> this next-fire-time) (+ (current-time) (get-rand-int-range this 150 600))) + (set! (-> this next-fire-time) (+ (current-time) (rnd-int-range this 150 600))) (+! (-> this fired-gun-count) 1) (let ((s4-1 (new 'stack-no-clear 'projectile-init-by-other-params))) (set! (-> s4-1 ent) (-> this entity)) @@ -467,7 +467,7 @@ ) ;; definition for method 77 of type jinx -(defmethod enemy-method-77 ((this jinx) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this jinx) (arg0 enemy-knocked-info)) (let ((v1-0 (-> this incoming knocked-type))) (cond ((= v1-0 (knocked-type knocked-type-6)) @@ -478,7 +478,7 @@ (vector-z-quaternion! s5-1 (-> this root quat)) (cond ((>= (vector-dot s4-0 s5-1) 0.0) - (let* ((v1-7 (enemy-method-120 this 3 (ash 1 (-> *jinx-global-info* prev-blue-hit-back)))) + (let* ((v1-7 (rnd-bit this 3 (ash 1 (-> *jinx-global-info* prev-blue-hit-back)))) (s5-2 (-> this draw art-group data (-> *jinx-global-info* blue-hit-back-anim v1-7))) ) (set! (-> *jinx-global-info* prev-blue-hit-back) v1-7) @@ -502,7 +502,7 @@ ) ) (else - (let* ((v1-24 (enemy-method-120 this 3 (ash 1 (-> *jinx-global-info* prev-blue-hit-front)))) + (let* ((v1-24 (rnd-bit this 3 (ash 1 (-> *jinx-global-info* prev-blue-hit-front)))) (s5-3 (-> this draw art-group data (-> *jinx-global-info* blue-hit-front-anim v1-24))) ) (set! (-> *jinx-global-info* prev-blue-hit-front) v1-24) @@ -540,7 +540,7 @@ (joint-control-channel-group! a0-34 (the-as art-joint-anim (-> this draw art-group data 23)) num-func-seek!) ) ) - ((zero? (get-rand-int this 3)) + ((zero? (rnd-int-count this 3)) (ja-channel-push! 1 (seconds 0.17)) (let ((a0-37 (-> this skel root-channel 0))) (set! (-> a0-37 frame-group) (the-as art-joint-anim (-> this draw art-group data 21))) @@ -570,7 +570,7 @@ (let ((a0-44 (-> this skel root-channel 0))) (set! (-> a0-44 frame-group) (the-as art-joint-anim s4-2)) (set! (-> a0-44 param 0) (the float (+ (-> (the-as art-joint-anim s4-2) frames num-frames) -1))) - (set! (-> a0-44 param 1) (-> arg0 0)) + (set! (-> a0-44 param 1) (-> arg0 anim-speed)) (set! (-> a0-44 frame-num) 0.0) (joint-control-channel-group! a0-44 (the-as art-joint-anim s4-2) num-func-seek!) ) @@ -584,7 +584,7 @@ ) ;; definition for method 78 of type jinx -(defmethod enemy-method-78 ((this jinx) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this jinx) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (when (>= (-> this incoming blue-juggle-count) (the-as uint 2)) diff --git a/test/decompiler/reference/jak2/levels/sewer/escort/mog_REF.gc b/test/decompiler/reference/jak2/levels/sewer/escort/mog_REF.gc index aa2b7d0c03..bb6b531dd3 100644 --- a/test/decompiler/reference/jak2/levels/sewer/escort/mog_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/escort/mog_REF.gc @@ -276,7 +276,7 @@ (t9-0 this) ) (set-enemy-info! this *mog-nav-enemy-info*) - (set! (-> this channel) (the-as uint 23)) + (set! (-> this channel) (gui-channel mog)) (set! (-> this spot-color) (the-as uint #x50ff0000)) (set-vector! (-> this root scale) 1.15 1.15 1.15 1.0) (set! (-> this skel prebind-function) mog-prebind-function) diff --git a/test/decompiler/reference/jak2/levels/sewer/gator_REF.gc b/test/decompiler/reference/jak2/levels/sewer/gator_REF.gc index b54d327b1a..6cbcdcb1c7 100644 --- a/test/decompiler/reference/jak2/levels/sewer/gator_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/gator_REF.gc @@ -296,12 +296,12 @@ ;; definition for method 55 of type gator ;; INFO: Used lq/sq ;; WARN: Return type mismatch vector vs none. -(defmethod track-target! ((this gator)) +(defmethod common-post ((this gator)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((func (method-of-type nav-enemy track-target!))) + (let ((func (method-of-type nav-enemy common-post))) (func this) ) (adjust-depth! this) @@ -379,7 +379,7 @@ ) ) :code (behavior () - (let ((circle-for (get-rand-float-range self 0.9 1.1))) + (let ((circle-for (rnd-float-range self 0.9 1.1))) (until #f (encircle-target! self 2.0 0.5 #t) (suspend) @@ -395,7 +395,7 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (let ((_self self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> _self enemy-flags))) (set! (-> _self enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> _self enemy-flags)))) @@ -422,8 +422,8 @@ ) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -438,7 +438,7 @@ (cond ((-> self lock-nav-target) ) - ((or (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) + ((or (logtest? (-> self enemy-flags) (enemy-flag victory)) (logtest? (-> self nav state flags) (nav-state-flag at-target)) ) (set! (-> self lock-nav-target) #t) @@ -501,7 +501,7 @@ (defstate pacing (gator) :virtual #t :code (behavior () - (let ((circle-for? (get-rand-float-range self 0.9 1.1))) + (let ((circle-for? (rnd-float-range self 0.9 1.1))) (until #f (encircle-target! self 2.0 0.5 #f) (suspend) @@ -529,7 +529,7 @@ ) ) :code (behavior () - (let ((circle-for? (get-rand-float-range self 0.9 1.1))) + (let ((circle-for? (rnd-float-range self 0.9 1.1))) (until #f (encircle-target! self 2.0 0.5 #f) (suspend) 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 9af0350111..40f709f081 100644 --- a/test/decompiler/reference/jak2/levels/sewer/grim2-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/grim2-course_REF.gc @@ -1063,7 +1063,7 @@ :nav-mesh-index -1 :skip-to 54 :on-set (lambda ((arg0 grim-sewer)) - (logior! (-> arg0 enemy-flags) (enemy-flag trackable-backup enable-on-hostile)) + (logior! (-> arg0 enemy-flags) (enemy-flag check-water check-water-backup)) (logior! (-> arg0 bot-flags) (bot-flags bf19)) (logclear! (-> arg0 focus-status) (focus-status disable)) (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) ruft-wait-spot arg0))) 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 2f71f8ffd2..5b2bb700b9 100644 --- a/test/decompiler/reference/jak2/levels/sewer/hal2-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/hal2-course_REF.gc @@ -194,7 +194,7 @@ ;; definition for function hal2-force-fail-check-too-far (defun hal2-force-fail-check-too-far ((arg0 hal-sewer)) (let ((gp-0 0)) - (if (and (not (channel-active? arg0 (the-as uint 0))) (logtest? (bot-flags bf24) (-> arg0 bot-flags))) + (if (and (not (channel-active? arg0 (gui-channel none))) (logtest? (bot-flags bf24) (-> arg0 bot-flags))) (set! gp-0 2) ) gp-0 @@ -730,7 +730,7 @@ (send-event s3-0 'request 'waypoint 9) ) ) - (when (and (not (channel-active? arg1 (the-as uint 0))) + (when (and (not (channel-active? arg1 (gui-channel none))) (not (speech-playing? arg1 6)) (begin (set! a0-8 s3-0) a0-8) (>= (the-as int (send-event a0-8 'query 'waypoint)) 9) @@ -754,7 +754,7 @@ ) (when (and (time-elapsed? (-> arg1 waypoint-time0) (seconds 4)) (not (speech-playing? arg1 2)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 2) (play-speech arg1 3) @@ -890,7 +890,7 @@ (when (and (and a0-20 (>= (the-as int (send-event a0-20 'query 'waypoint)) 11)) (and (not (speech-playing? arg1 12)) (not (speech-playing? arg1 8)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) ) (play-speech arg1 8) @@ -1387,7 +1387,7 @@ (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 object) (arg1 hal-sewer)) - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (cond ((speech-playing? arg1 12) (if (not (speech-playing? arg1 22)) @@ -1477,15 +1477,15 @@ #t ) (else - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (cond - ((zero? (get-rand-int arg1 2)) + ((zero? (rnd-int-count arg1 2)) (play-speech arg1 24) (play-speech arg1 25) (play-speech arg1 26) (play-speech arg1 27) ) - ((begin (play-speech arg1 77) (play-speech arg1 78) (set! v1-40 (get-rand-int arg1 4)) (zero? v1-40)) + ((begin (play-speech arg1 77) (play-speech arg1 78) (set! v1-40 (rnd-int-count arg1 4)) (zero? v1-40)) (play-speech arg1 79) ) ((= v1-40 1) @@ -1507,7 +1507,7 @@ ) ) (else - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (play-speech arg1 23) (let ((a1-23 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-23 from) (process->ppointer pp)) @@ -1774,7 +1774,7 @@ ) (if (and (not (speech-playing? arg1 28)) (time-elapsed? (-> arg1 waypoint-time0) (seconds 2)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 28) ) @@ -1873,7 +1873,7 @@ (cond ((logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) (when (and (not (speech-playing? arg1 29)) (not (speech-playing? arg1 30))) - (if (zero? (get-rand-int arg1 2)) + (if (zero? (rnd-int-count arg1 2)) (play-speech arg1 29) (play-speech arg1 30) ) @@ -2116,7 +2116,7 @@ (lambda ((arg0 object) (arg1 hal-sewer)) (with-pp (hal-sewer-method-228 arg1) - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (cond ((not (speech-playing? arg1 34)) (let* ((s5-0 arg1) @@ -2257,7 +2257,7 @@ ) ) ) - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (cond ((and (not (speech-playing? arg1 36)) (not s5-0) (not s4-0)) (play-speech arg1 36) @@ -2403,7 +2403,7 @@ (if (time-elapsed? (-> arg1 waypoint-time0) (seconds 2.25)) (send-event s3-0 'request 'waypoint 34) ) - (when (and (not (channel-active? arg1 (the-as uint 0))) + (when (and (not (channel-active? arg1 (gui-channel none))) (and (not (speech-playing? arg1 42)) (not (speech-playing? arg1 43)) (begin @@ -2418,7 +2418,7 @@ (>= (the-as int (send-event a0-10 'query 'waypoint)) 33) ) ) - (if (zero? (get-rand-int arg1 2)) + (if (zero? (rnd-int-count arg1 2)) (play-speech arg1 42) (play-speech arg1 43) ) @@ -2599,7 +2599,7 @@ (set-time! (-> arg1 waypoint-time0)) ) (else - (if (and (not (speech-playing? arg1 46)) (not (channel-active? arg1 (the-as uint 0)))) + (if (and (not (speech-playing? arg1 46)) (not (channel-active? arg1 (gui-channel none)))) (play-speech arg1 46) ) ) @@ -2679,7 +2679,7 @@ ) ) (when (and (not (speech-playing? arg1 47)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) s4-0 (focus-test? (the-as process-focusable s4-0) touch-water) ) @@ -2744,7 +2744,7 @@ (with-pp (if (and (not (speech-playing? arg1 52)) (speech-playing? arg1 49) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) (let ((v1-10 (-> arg1 actor-group 0 data 20 actor))) (not (if v1-10 (-> v1-10 extra process) @@ -2881,7 +2881,7 @@ :skip-to 48 :on-set (lambda ((arg0 hal-sewer)) (with-pp - (if (zero? (get-rand-int arg0 2)) + (if (zero? (rnd-int-count arg0 2)) (play-speech arg0 53) (play-speech arg0 54) ) @@ -3018,7 +3018,7 @@ (logclear! (-> arg1 bot-flags) (bot-flags bf24)) (reset-warn-time! arg1) (set-time! (-> arg1 waypoint-time0)) - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (let ((v1-22 *target*)) (when (and v1-22 (focus-test? v1-22 in-air) (not (logtest? (-> v1-22 focus-status) (focus-status hit)))) (cond @@ -3037,7 +3037,7 @@ ) ) ) - ((channel-active? arg1 (the-as uint 0)) + ((channel-active? arg1 (gui-channel none)) (reset-warn-time! arg1) (set-time! (-> arg1 waypoint-time0)) ) @@ -3242,7 +3242,7 @@ (logclear! (-> arg1 bot-flags) (bot-flags bf24)) (reset-warn-time! arg1) (set-time! (-> arg1 waypoint-time0)) - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (let ((v1-22 *target*)) (when (and v1-22 (focus-test? v1-22 in-air) (not (logtest? (-> v1-22 focus-status) (focus-status hit)))) (cond @@ -3257,7 +3257,7 @@ ) ) ) - ((channel-active? arg1 (the-as uint 0)) + ((channel-active? arg1 (gui-channel none)) (reset-warn-time! arg1) (set-time! (-> arg1 waypoint-time0)) ) @@ -3522,7 +3522,7 @@ (send-event s4-0 'request 'waypoint 48) ) ) - (when (and (not (channel-active? arg1 (the-as uint 0))) (not (speech-playing? arg1 67))) + (when (and (not (channel-active? arg1 (gui-channel none))) (not (speech-playing? arg1 67))) (let* ((v1-141 (-> arg1 actor-group 0 data 1 actor)) (s4-1 (if v1-141 (-> v1-141 extra process) @@ -3654,7 +3654,7 @@ ) ) (if (and (not (speech-playing? arg1 70)) - (and (not (channel-active? arg1 (the-as uint 0))) + (and (not (channel-active? arg1 (gui-channel none))) (begin (set! a0-3 s5-0) a0-3) (>= (the-as int (send-event a0-3 'query 'waypoint)) 56) ) @@ -3711,7 +3711,7 @@ ((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)) + (when (and (not (channel-active? arg1 (gui-channel none))) (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) @@ -3720,7 +3720,7 @@ ) (else (cond - ((channel-active? arg1 (the-as uint 0)) + ((channel-active? arg1 (gui-channel none)) (set! (-> arg1 waypoint-time0) (+ (current-time) (seconds 9))) ) ((>= (current-time) (-> arg1 waypoint-time0)) @@ -3975,7 +3975,7 @@ (if (time-elapsed? (-> arg1 waypoint-time0) (seconds 4)) (send-event s4-0 'request 'waypoint 59) ) - (when (not (channel-active? arg1 (the-as uint 0))) + (when (not (channel-active? arg1 (gui-channel none))) (cond ((and (not (speech-playing? arg1 75)) (time-elapsed? (-> arg1 waypoint-time0) (seconds 6))) (play-speech arg1 75) diff --git a/test/decompiler/reference/jak2/levels/sewer/hosehead_REF.gc b/test/decompiler/reference/jak2/levels/sewer/hosehead_REF.gc index 17d88ef241..c16a908d13 100644 --- a/test/decompiler/reference/jak2/levels/sewer/hosehead_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/hosehead_REF.gc @@ -431,6 +431,7 @@ ) ;; definition for method 3 of type ik-setup +;; INFO: this function exists in multiple non-identical object files (defmethod inspect ((this ik-setup)) (when (not this) (set! this this) @@ -520,7 +521,7 @@ ) ;; definition for method 77 of type hosehead -(defmethod enemy-method-77 ((this hosehead) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this hosehead) (arg0 enemy-knocked-info)) (cond ((zero? (-> this hit-points)) (ja-channel-push! 1 (seconds 0.17)) @@ -529,7 +530,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 18)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 18)) num-func-seek!) ) @@ -540,14 +541,14 @@ (((knocked-type knocked-type-4)) (ja-channel-push! 1 (seconds 0.1)) (let* ((a2-1 (ash 1 (-> *hosehead-global-info* prev-yellow-hit))) - (v1-18 (enemy-method-120 this 2 a2-1)) + (v1-18 (rnd-bit this 2 a2-1)) (a1-8 (-> this draw art-group data (-> *hosehead-global-info* yellow-hit-anim v1-18 hit-index))) ) (set! (-> *hosehead-global-info* prev-yellow-hit) v1-18) (let ((a0-15 (-> this skel root-channel 0))) (set! (-> a0-15 frame-group) (the-as art-joint-anim a1-8)) (set! (-> a0-15 param 0) (the float (+ (-> (the-as art-joint-anim a1-8) frames num-frames) -1))) - (set! (-> a0-15 param 1) (-> arg0 0)) + (set! (-> a0-15 param 1) (-> arg0 anim-speed)) (set! (-> a0-15 frame-num) 0.0) (joint-control-channel-group! a0-15 (the-as art-joint-anim a1-8) num-func-seek!) ) @@ -555,7 +556,7 @@ ) (((knocked-type knocked-type-6)) (let* ((a2-3 (ash 1 (-> *hosehead-global-info* prev-blue-hit))) - (v1-27 (enemy-method-120 this 3 a2-3)) + (v1-27 (rnd-bit this 3 a2-3)) (a1-13 (-> this draw art-group data (-> *hosehead-global-info* blue-hit-anim v1-27 hit-index))) ) (set! (-> *hosehead-global-info* prev-blue-hit) v1-27) @@ -571,14 +572,14 @@ (else (ja-channel-push! 1 (seconds 0.1)) (let* ((a2-5 (ash 1 (-> *hosehead-global-info* prev-knocked))) - (v1-37 (enemy-method-120 this 2 a2-5)) + (v1-37 (rnd-bit this 2 a2-5)) (a1-19 (-> this draw art-group data (-> *hosehead-global-info* knocked-anim v1-37 hit-index))) ) (set! (-> *hosehead-global-info* prev-knocked) v1-37) (let ((a0-39 (-> this skel root-channel 0))) (set! (-> a0-39 frame-group) (the-as art-joint-anim a1-19)) (set! (-> a0-39 param 0) (the float (+ (-> (the-as art-joint-anim a1-19) frames num-frames) -1))) - (set! (-> a0-39 param 1) (-> arg0 0)) + (set! (-> a0-39 param 1) (-> arg0 anim-speed)) (set! (-> a0-39 frame-num) 0.0) (joint-control-channel-group! a0-39 (the-as art-joint-anim a1-19) num-func-seek!) ) @@ -591,7 +592,7 @@ ) ;; definition for method 78 of type hosehead -(defmethod enemy-method-78 ((this hosehead) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this hosehead) (arg0 enemy-knocked-info)) (local-vars (v1-15 knocked-type)) (cond ((zero? (-> this hit-points)) @@ -601,7 +602,7 @@ (set! (-> a0-2 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 19)) frames num-frames) -1)) ) - (set! (-> a0-2 param 1) (-> arg0 0)) + (set! (-> a0-2 param 1) (-> arg0 anim-speed)) (set! (-> a0-2 frame-num) 0.0) (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 19)) num-func-seek!) ) @@ -615,7 +616,7 @@ (let ((a0-9 (-> this skel root-channel 0))) (set! (-> a0-9 frame-group) (the-as art-joint-anim s4-0)) (set! (-> a0-9 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1))) - (set! (-> a0-9 param 1) (-> arg0 0)) + (set! (-> a0-9 param 1) (-> arg0 anim-speed)) (joint-control-channel-group! a0-9 (the-as art-joint-anim s4-0) num-func-seek!) ) ) @@ -632,7 +633,7 @@ (let ((a0-16 (-> this skel root-channel 0))) (set! (-> a0-16 frame-group) (the-as art-joint-anim s4-1)) (set! (-> a0-16 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1))) - (set! (-> a0-16 param 1) (-> arg0 0)) + (set! (-> a0-16 param 1) (-> arg0 anim-speed)) (joint-control-channel-group! a0-16 (the-as art-joint-anim s4-1) num-func-seek!) ) ) @@ -868,15 +869,15 @@ (('cue-chase) (cond ((-> this on-wall?) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) - (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance directed directed-ready use-trigger)) + (logior! (-> this enemy-flags) (enemy-flag chase-startup)) (logclear! (-> this mask) (process-mask actor-pause)) (go (method-of-object this notice-wall)) ) ((-> this sentry?) (when (and (-> this next-state) (= (-> this next-state name) 'idle-sentry)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) - (logior! (-> this enemy-flags) (enemy-flag dangerous-backup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance directed directed-ready use-trigger)) + (logior! (-> this enemy-flags) (enemy-flag chase-startup)) (logclear! (-> this mask) (process-mask actor-pause)) (go (method-of-object this hostile-sentry)) ) @@ -1050,7 +1051,7 @@ ) ) (when (not (-> self sentry?)) - (logior! (-> self enemy-flags) (enemy-flag trackable)) + (logior! (-> self enemy-flags) (enemy-flag multi-focus)) (set! (-> self focus collide-with) (collide-spec jak bot player-list jak-vehicle)) (let ((gp-1 (-> self on-stop-sentry))) (if gp-1 @@ -1090,7 +1091,7 @@ (logclear! (-> self skel status) (joint-control-status sync-math)) (set! (-> self allow-head) #f) (set! (-> self fire-beam?) #f) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1121,7 +1122,7 @@ ) (+! (-> self target-pos y) 2867.2) (let ((f0-5 (* (-> self angle-sentry) (+ -0.5 (get-norm! (-> self sync) 0))))) - (if (logtest? (enemy-flag dislike-combo) (-> self enemy-flags)) + (if (logtest? (enemy-flag drawn-mirrored) (-> self enemy-flags)) (set! f0-5 (- f0-5)) ) (set! (-> self head-angle) f0-5) @@ -1137,7 +1138,7 @@ ) ) (when (not (-> self sentry?)) - (logior! (-> self enemy-flags) (enemy-flag trackable)) + (logior! (-> self enemy-flags) (enemy-flag multi-focus)) (set! (-> self focus collide-with) (collide-spec jak bot player-list jak-vehicle)) (let ((gp-2 (-> self on-stop-sentry))) (if gp-2 @@ -1158,7 +1159,7 @@ ) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-channel-push! 1 (seconds 0.01)) (set! (-> self fire-beam?) #t) (until #f @@ -1195,8 +1196,8 @@ (vf2 :class vf) (vf3 :class vf) ) - (set! (-> arg0 x) (get-rand-float-range this 5607424.0 5812224.0)) - (set! (-> arg0 z) (get-rand-float-range this 2027520.0 1961984.0)) + (set! (-> arg0 x) (rnd-float-range this 5607424.0 5812224.0)) + (set! (-> arg0 z) (rnd-float-range this 2027520.0 1961984.0)) (set! (-> arg0 y) -368680.97) (let ((gp-1 (new 'stack-no-clear 'vector))) (set! (-> gp-1 quad) (-> arg0 quad)) @@ -1377,15 +1378,15 @@ (set! (-> v1-6 prim-core collide-with) (collide-spec)) ) 0 - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) ) ) ) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logior! (-> self enemy-flags) (enemy-flag alert)) (let ((gp-1 (new 'stack-no-clear 'vector))) (let ((s5-0 (new 'stack-no-clear 'vector))) (hosehead-method-191 self gp-1 s5-0) @@ -1419,7 +1420,7 @@ (set! (-> self attack-id) a0-22) ) (if (logtest? (enemy-option water) (-> self fact enemy-options)) - (logior! (-> self enemy-flags) (enemy-flag trackable-backup enable-on-hostile)) + (logior! (-> self enemy-flags) (enemy-flag check-water check-water-backup)) ) (logclear! (-> self draw status) (draw-control-status no-draw)) ) @@ -1620,7 +1621,7 @@ (vf7 :class vf) ) (init-vf0-vector) - (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self enemy-flags) (enemy-flag alert)) ((-> (method-of-type nav-enemy notice) enter)) (let ((v1-4 self)) (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag36)))) @@ -1716,7 +1717,9 @@ ) (when (< (- (-> self root trans y) (-> self jump-point y)) 40960.0) (hosehead-method-196 self) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 0 (-> self jump-point)) ) (suspend) @@ -1748,7 +1751,7 @@ :virtual #t :enter (behavior () (if (logtest? (enemy-option water) (-> self fact enemy-options)) - (logior! (-> self enemy-flags) (enemy-flag trackable-backup enable-on-hostile)) + (logior! (-> self enemy-flags) (enemy-flag check-water check-water-backup)) ) (let ((t9-0 (-> (method-of-type nav-enemy knocked) enter))) (if t9-0 @@ -1763,7 +1766,7 @@ :virtual #t :enter (behavior () (if (logtest? (enemy-option water) (-> self fact enemy-options)) - (logior! (-> self enemy-flags) (enemy-flag trackable-backup enable-on-hostile)) + (logior! (-> self enemy-flags) (enemy-flag check-water check-water-backup)) ) (let ((t9-0 (-> (method-of-type nav-enemy jump) enter))) (if t9-0 @@ -1847,13 +1850,13 @@ (logclear! (-> self skel status) (joint-control-status sync-math)) (set! (-> self allow-head) #f) (set! (-> self fire-beam?) #f) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (set! (-> self allow-head) #t) (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! hosehead-shoot-start-ja :num! (seek! max f30-0) :frame-num 0.0) @@ -1908,7 +1911,7 @@ ) ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -1916,7 +1919,7 @@ :code (behavior () (ja-channel-push! 1 (seconds 0.2)) (cond - ((zero? (get-rand-int self 2)) + ((zero? (rnd-int-count self 2)) (ja-no-eval :group! hosehead-attack1-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) @@ -1931,11 +1934,11 @@ ) ) ) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) - (let ((v1-57 (get-rand-int self 4))) + (let ((v1-57 (rnd-int-count self 4))) (cond ((zero? v1-57) (ja-no-eval :group! hosehead-idle1-ja :num! (seek!) :frame-num 0.0) @@ -1997,7 +2000,7 @@ 0 ) ((zero? (-> self next-lazer-time)) - (set! (-> self next-lazer-time) (+ (current-time) (the int (* 300.0 (get-rand-float-range self 1.0 2.0))))) + (set! (-> self next-lazer-time) (+ (current-time) (the int (* 300.0 (rnd-float-range self 1.0 2.0))))) ) ((>= (current-time) (-> self next-lazer-time)) (if (and (enemy-method-96 self 3640.889 #t) (and (< 40960.0 f30-0) (hosehead-method-190 self))) @@ -2009,12 +2012,12 @@ ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (if (zero? (get-rand-int self 5)) + (if (zero? (rnd-int-count self 5)) (ja :group! hosehead-run1-ja) (ja :group! hosehead-run-ja) ) (ja :num-func num-func-identity :frame-num 0.0) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (suspend) (ja :num! (loop! f30-0)) @@ -2031,7 +2034,7 @@ :code (behavior () (set! (-> self come-from-notice) #t) (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (new 'stack-no-clear 'vector) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) :num! (seek! max f30-0) @@ -2099,7 +2102,7 @@ (set! (-> s5-0 x) (fmax -1820.4445 (fmin 1820.4445 (deg- (-> s3-0 x) (-> s4-0 x))))) (set! (-> s5-0 y) (fmax -3640.889 (fmin 3640.889 (deg- (-> s3-0 y) (-> s4-0 y))))) (set! (-> s5-0 z) 0.0) - (if (not (logtest? (enemy-flag dislike-combo) (-> this enemy-flags))) + (if (not (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags))) (set! (-> s5-0 y) (- (-> s5-0 y))) ) (+! (-> s5-0 y) (-> this head-angle)) @@ -2123,12 +2126,12 @@ ) ;; definition for method 55 of type hosehead -(defmethod track-target! ((this hosehead)) +(defmethod common-post ((this hosehead)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (hosehead-method-194 this) @@ -2282,11 +2285,11 @@ ;; definition for method 106 of type hosehead ;; WARN: Return type mismatch symbol vs none. -(defmethod enemy-method-106 ((this hosehead) (arg0 process) (arg1 object) (arg2 int) (arg3 attack-info)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-106))) +(defmethod set-incoming-attack-info ((this hosehead) (arg0 process) (arg1 object) (arg2 penetrate) (arg3 attack-info)) + (let ((t9-0 (method-of-type nav-enemy set-incoming-attack-info))) (t9-0 this arg0 arg1 arg2 arg3) ) - (let ((a1-3 (enemy-method-134 this arg0 arg3))) + (let ((a1-3 (get-attacker this arg0 arg3))) (if (and a1-3 (logtest? (process-mask bot) (-> a1-3 mask))) (set! (-> this shot-by-ruffian?) #t) (set! (-> this shot-by-ruffian?) #f) @@ -2367,7 +2370,9 @@ (set! (-> this on-wall?) #f) (when (>= (res-lump-value (-> this entity) 'extra-id int :default (the-as uint128 -1) :time -1000000000.0) 0) (set! (-> this on-wall?) #t) - (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag vulnerable-backup) (-> this enemy-flags)))) + (set! (-> this enemy-flags) + (the-as enemy-flag (logior (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) + ) ) (init-enemy-behaviour-and-stats! this *hosehead-nav-enemy-info*) (set! (-> this sentry?) (logtest? (-> this fact enemy-options) (enemy-option user9))) diff --git a/test/decompiler/reference/jak2/levels/sewer/jinx2-course_REF.gc b/test/decompiler/reference/jak2/levels/sewer/jinx2-course_REF.gc index 8f3e0225b8..5841b8d95f 100644 --- a/test/decompiler/reference/jak2/levels/sewer/jinx2-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/jinx2-course_REF.gc @@ -1134,7 +1134,7 @@ :nav-mesh-index -1 :skip-to 54 :on-set (lambda ((arg0 jinx-sewer)) - (logior! (-> arg0 enemy-flags) (enemy-flag trackable-backup enable-on-hostile)) + (logior! (-> arg0 enemy-flags) (enemy-flag check-water check-water-backup)) (logior! (-> arg0 bot-flags) (bot-flags bf19)) (logclear! (-> arg0 focus-status) (focus-status disable)) (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) ruft-wait-spot arg0))) 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 7be5f4abea..443a83e050 100644 --- a/test/decompiler/reference/jak2/levels/sewer/mog2-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/mog2-course_REF.gc @@ -1074,7 +1074,7 @@ :nav-mesh-index -1 :skip-to 54 :on-set (lambda ((arg0 mog-sewer)) - (logior! (-> arg0 enemy-flags) (enemy-flag trackable-backup enable-on-hostile)) + (logior! (-> arg0 enemy-flags) (enemy-flag check-water check-water-backup)) (logior! (-> arg0 bot-flags) (bot-flags bf19)) (logclear! (-> arg0 focus-status) (focus-status disable)) (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) ruft-wait-spot arg0))) diff --git a/test/decompiler/reference/jak2/levels/sewer/sew-gunturret_REF.gc b/test/decompiler/reference/jak2/levels/sewer/sew-gunturret_REF.gc index 42520960ac..bccbcad91e 100644 --- a/test/decompiler/reference/jak2/levels/sewer/sew-gunturret_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/sew-gunturret_REF.gc @@ -784,7 +784,7 @@ (set! (-> self flash-state) #f) ) :trans (behavior () - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (when (time-elapsed? (-> self state-time) (-> self reaction-time)) @@ -910,7 +910,7 @@ (defstate die (sew-gunturret) :virtual #t :enter (behavior () - (dispose! self) + (dying self) (let ((root-prim (-> self root root-prim))) (set! (-> root-prim prim-core collide-as) (collide-spec)) (set! (-> root-prim prim-core collide-with) (collide-spec)) @@ -956,7 +956,7 @@ ) ) :post (behavior () - (track-target! self) + (common-post self) ) ) @@ -1118,7 +1118,7 @@ (initialize-skeleton this (-> this params normal-sg) (the-as pair 0)) (init-enemy-behaviour-and-stats! this (-> this params enemy-info)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (set! (-> this part) (create-launch-control (-> *part-group-id-table* 1126) this)) (set! (-> this smoke-part) (create-launch-control (-> *part-group-id-table* 1127) this)) (set! (-> this casing-part) (create-launch-control (-> *part-group-id-table* 1128) this)) 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 9ece7e0b85..a626c87cb5 100644 --- a/test/decompiler/reference/jak2/levels/strip/strip-drop_REF.gc +++ b/test/decompiler/reference/jak2/levels/strip/strip-drop_REF.gc @@ -717,7 +717,7 @@ This commonly includes things such as: (shove-back (meters 3)) (shove-up (meters 2)) (mode 'deadly) - (knock (the-as uint 8)) + (knock (knocked-type knocked-type-8)) (damage 4.0) ) ) diff --git a/test/decompiler/reference/jak2/levels/tomb/monster-frog_REF.gc b/test/decompiler/reference/jak2/levels/tomb/monster-frog_REF.gc index f9834d2f93..3944a46c2c 100644 --- a/test/decompiler/reference/jak2/levels/tomb/monster-frog_REF.gc +++ b/test/decompiler/reference/jak2/levels/tomb/monster-frog_REF.gc @@ -187,9 +187,9 @@ (set! (-> v1-0 nav callback-info) *nav-enemy-null-callback-info*) ) 0 - (dotimes (gp-0 (get-rand-int-range self 2 3)) + (dotimes (gp-0 (rnd-int-range self 2 3)) (cond - ((zero? (get-rand-int self 4)) + ((zero? (rnd-int-count self 4)) (let ((v1-7 (ja-group))) (if (not (and v1-7 (= v1-7 monster-frog-idle0-ja))) (ja-channel-push! 1 (seconds 0.1)) @@ -276,8 +276,8 @@ (defstate ambush (monster-frog) :virtual #t :enter (behavior () - (when (logtest? (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) - (logclear! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) (let ((gp-0 (-> self on-notice))) (if gp-0 (script-eval gp-0 :vector (-> self root trans)) @@ -328,7 +328,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (new 'stack-no-clear 'vector) (ja-no-eval :group! monster-frog-notice0-ja :num! (seek! max f30-0) :frame-num 0.0) (until (ja-done? 0) @@ -364,7 +364,7 @@ (defstate active (monster-frog) :virtual #t :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (nav-enemy-method-165 self) (ja-channel-push! 1 (seconds 0.2)) @@ -379,7 +379,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (when (enemy-method-123 self 0.2) + (when (rnd-go-idle? self 0.2) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.6)) (let ((v1-57 self)) @@ -397,7 +397,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (until (not (enemy-method-123 self 0.2)) + (until (not (rnd-go-idle? self 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -466,7 +466,7 @@ (defstate hostile (monster-frog) :virtual #t :enter (behavior () - (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self enemy-flags) (enemy-flag alert)) (let ((t9-0 (-> (method-of-type nav-enemy hostile) enter))) (if t9-0 (t9-0) @@ -479,7 +479,7 @@ ) :trans (behavior () (nav-enemy-method-160 self) - (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) (go-virtual victory) ) (when (time-elapsed? (-> self state-time) (-> self reaction-time)) @@ -691,7 +691,7 @@ 0 ) :exit (behavior () - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -705,7 +705,7 @@ (ja :num! (seek!)) ) (nav-enemy-method-167 self) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -736,7 +736,7 @@ (ja :num! (seek!)) ) (cond - ((zero? (get-rand-int self 4)) + ((zero? (rnd-int-count self 4)) (let ((v1-28 (ja-group))) (if (not (and v1-28 (= v1-28 monster-frog-idle0-ja))) (ja-channel-push! 1 (seconds 0.1)) @@ -767,7 +767,7 @@ ) ;; definition for method 77 of type monster-frog -(defmethod enemy-method-77 ((this monster-frog) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this monster-frog) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (ja-channel-push! 1 0) @@ -776,7 +776,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 26)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 26)) num-func-seek!) ) @@ -789,7 +789,7 @@ (set! (-> a0-6 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 22)) frames num-frames) -1)) ) - (set! (-> a0-6 param 1) (-> arg0 0)) + (set! (-> a0-6 param 1) (-> arg0 anim-speed)) (set! (-> a0-6 frame-num) 0.0) (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> this draw art-group data 22)) num-func-seek!) ) @@ -804,7 +804,7 @@ (set! (-> a0-8 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 30)) frames num-frames) -1)) ) - (set! (-> a0-8 param 1) (-> arg0 0)) + (set! (-> a0-8 param 1) (-> arg0 anim-speed)) (set! (-> a0-8 frame-num) 0.0) (joint-control-channel-group! a0-8 (the-as art-joint-anim (-> this draw art-group data 30)) num-func-seek!) ) @@ -816,7 +816,7 @@ (set! (-> a0-10 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 32)) frames num-frames) -1)) ) - (set! (-> a0-10 param 1) (-> arg0 0)) + (set! (-> a0-10 param 1) (-> arg0 anim-speed)) (set! (-> a0-10 frame-num) 0.0) (joint-control-channel-group! a0-10 (the-as art-joint-anim (-> this draw art-group data 32)) num-func-seek!) ) @@ -828,7 +828,7 @@ ) ;; definition for method 78 of type monster-frog -(defmethod enemy-method-78 ((this monster-frog) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this monster-frog) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-4)) (ja-channel-push! 1 (seconds 0.17)) @@ -837,7 +837,7 @@ (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 27)) frames num-frames) -1)) ) - (set! (-> a0-3 param 1) (-> arg0 0)) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) (set! (-> a0-3 frame-num) 0.0) (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> this draw art-group data 27)) num-func-seek!) ) @@ -850,7 +850,7 @@ (set! (-> a0-6 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 23)) frames num-frames) -1)) ) - (set! (-> a0-6 param 1) (-> arg0 0)) + (set! (-> a0-6 param 1) (-> arg0 anim-speed)) (set! (-> a0-6 frame-num) 0.0) (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> this draw art-group data 23)) num-func-seek!) ) @@ -865,7 +865,7 @@ (set! (-> a0-8 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 31)) frames num-frames) -1)) ) - (set! (-> a0-8 param 1) (-> arg0 0)) + (set! (-> a0-8 param 1) (-> arg0 anim-speed)) (set! (-> a0-8 frame-num) 0.0) (joint-control-channel-group! a0-8 (the-as art-joint-anim (-> this draw art-group data 31)) num-func-seek!) ) @@ -877,7 +877,7 @@ (set! (-> a0-10 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 33)) frames num-frames) -1)) ) - (set! (-> a0-10 param 1) (-> arg0 0)) + (set! (-> a0-10 param 1) (-> arg0 anim-speed)) (set! (-> a0-10 frame-num) 0.0) (joint-control-channel-group! a0-10 (the-as art-joint-anim (-> this draw art-group data 33)) num-func-seek!) ) @@ -889,13 +889,13 @@ ) ;; definition for method 55 of type monster-frog -(defmethod track-target! ((this monster-frog)) +(defmethod common-post ((this monster-frog)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" (water-control-method-10 (-> this water)) - ((method-of-type nav-enemy track-target!) this) + ((method-of-type nav-enemy common-post) this) (none) ) diff --git a/test/decompiler/reference/jak2/levels/tomb/tomb-baby-spider_REF.gc b/test/decompiler/reference/jak2/levels/tomb/tomb-baby-spider_REF.gc index 3da84c9652..92564bd181 100644 --- a/test/decompiler/reference/jak2/levels/tomb/tomb-baby-spider_REF.gc +++ b/test/decompiler/reference/jak2/levels/tomb/tomb-baby-spider_REF.gc @@ -176,7 +176,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (until #f (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info walk-anim)) :num! (seek! max f30-0) @@ -186,7 +186,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (when (enemy-method-123 self 0.2) + (when (rnd-go-idle? self 0.2) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.2)) (let ((v1-37 self)) @@ -204,7 +204,7 @@ (suspend) (ja :num! (seek! max f30-0)) ) - (until (not (enemy-method-123 self 0.2)) + (until (not (rnd-go-idle? self 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -246,7 +246,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) (let ((gp-0 (new 'stack-no-clear 'vector))) (let ((a0-3 (handle->process (-> self focus handle)))) (cond @@ -283,7 +283,7 @@ :event enemy-event-handler :enter (behavior () (nav-enemy-method-166 self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (logior! (-> self focus-status) (focus-status dangerous)) (let ((v1-9 (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 1))) (set! (-> v1-9 local-sphere w) 4915.2) @@ -301,8 +301,8 @@ (let ((v1-3 (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 1))) (set! (-> v1-3 local-sphere w) 819.2) ) - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -310,8 +310,8 @@ ) :trans (behavior () (enemy-method-49 self) - (if (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) - (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) + (if (logtest? (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self enemy-flags) (enemy-flag victory)) ) ) :code (behavior () @@ -443,7 +443,7 @@ ) ;; definition for method 77 of type tomb-baby-spider -(defmethod enemy-method-77 ((this tomb-baby-spider) (arg0 (pointer float))) +(defmethod enemy-method-77 ((this tomb-baby-spider) (arg0 enemy-knocked-info)) (let* ((a2-0 (the-as collide-shape-prim-group (-> this root root-prim))) (v1-2 (-> a2-0 child 3)) ) @@ -463,7 +463,7 @@ (set! (-> v1-6 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 20)) frames num-frames) -1)) ) - (set! (-> v1-6 param 1) (-> arg0 0)) + (set! (-> v1-6 param 1) (-> arg0 anim-speed)) (set! (-> v1-6 frame-num) 0.0) (joint-control-channel-group! v1-6 (the-as art-joint-anim (-> this draw art-group data 20)) num-func-seek!) ) @@ -475,7 +475,7 @@ (set! (-> v1-11 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 17)) frames num-frames) -1)) ) - (set! (-> v1-11 param 1) (-> arg0 0)) + (set! (-> v1-11 param 1) (-> arg0 anim-speed)) (set! (-> v1-11 frame-num) 0.0) (joint-control-channel-group! v1-11 (the-as art-joint-anim (-> this draw art-group data 17)) num-func-seek!) ) @@ -488,7 +488,7 @@ ) ;; definition for method 78 of type tomb-baby-spider -(defmethod enemy-method-78 ((this tomb-baby-spider) (arg0 (pointer float))) +(defmethod enemy-method-78 ((this tomb-baby-spider) (arg0 enemy-knocked-info)) (case (-> this incoming knocked-type) (((knocked-type knocked-type-6)) (let ((v1-3 (-> this skel root-channel 0))) @@ -496,7 +496,7 @@ (set! (-> v1-3 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 22)) frames num-frames) -1)) ) - (set! (-> v1-3 param 1) (-> arg0 0)) + (set! (-> v1-3 param 1) (-> arg0 anim-speed)) (set! (-> v1-3 frame-num) 0.0) (joint-control-channel-group! v1-3 (the-as art-joint-anim (-> this draw art-group data 22)) num-func-seek!) ) @@ -508,7 +508,7 @@ (set! (-> v1-8 param 0) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 18)) frames num-frames) -1)) ) - (set! (-> v1-8 param 1) (-> arg0 0)) + (set! (-> v1-8 param 1) (-> arg0 anim-speed)) (set! (-> v1-8 frame-num) 0.0) (joint-control-channel-group! v1-8 (the-as art-joint-anim (-> this draw art-group data 18)) num-func-seek!) ) @@ -614,7 +614,7 @@ (shove-up (* f0-0 (-> this enemy-info attack-shove-up))) (mode (-> this enemy-info attack-mode)) (damage (the float (-> this enemy-info attack-damage))) - (knock (the-as uint 8)) + (knock (knocked-type knocked-type-8)) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/tomb/tomb-beetle_REF.gc b/test/decompiler/reference/jak2/levels/tomb/tomb-beetle_REF.gc index c5730d18d2..f6d4369048 100644 --- a/test/decompiler/reference/jak2/levels/tomb/tomb-beetle_REF.gc +++ b/test/decompiler/reference/jak2/levels/tomb/tomb-beetle_REF.gc @@ -580,8 +580,8 @@ (set! (-> gp-0 0 dist) (vector-vector-distance (-> self root trans) (the-as vector (-> gp-0 0)))) ) (vector-reset! (-> self root transv)) - (set! (-> self fly-away-acc) (get-rand-float-range self 204800.0 512000.0)) - (set! (-> self fly-away-ry-speed) (get-rand-float-range self 32768.0 109226.664)) + (set! (-> self fly-away-acc) (rnd-float-range self 204800.0 512000.0)) + (set! (-> self fly-away-ry-speed) (rnd-float-range self 32768.0 109226.664)) (set! (-> self flying?) #f) ) :trans (behavior () @@ -699,7 +699,7 @@ :virtual #t :code (behavior () (ja-channel-push! 1 (seconds 0.075)) - (let ((f30-0 (get-rand-float-range self 1.8 2.2))) + (let ((f30-0 (rnd-float-range self 1.8 2.2))) (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info die-anim)) :num! (seek! max f30-0) :frame-num 0.0 @@ -1046,7 +1046,7 @@ (set! (-> v1-5 sphere-mask) (the-as uint #x800fa)) ) 0 - (logclear! (-> this enemy-flags) (enemy-flag check-water-backup no-initial-move-to-ground)) + (logclear! (-> this enemy-flags) (enemy-flag trackable trackable-backup)) (set! (-> this flags) (the-as uint 0)) (logclear! (-> this mask) (process-mask actor-pause)) 0 diff --git a/test/decompiler/reference/jak2/levels/tomb/widow-baron_REF.gc b/test/decompiler/reference/jak2/levels/tomb/widow-baron_REF.gc index 603db0897c..5cece71ed3 100644 --- a/test/decompiler/reference/jak2/levels/tomb/widow-baron_REF.gc +++ b/test/decompiler/reference/jak2/levels/tomb/widow-baron_REF.gc @@ -1228,7 +1228,7 @@ This commonly includes things such as: ) ) (('child-jumped) - (set! v0-0 (logclear (-> (the-as spydroid arg0) enemy-flags) (enemy-flag alert))) + (set! v0-0 (logclear (-> (the-as spydroid arg0) enemy-flags) (enemy-flag directed))) (set! (-> (the-as spydroid arg0) enemy-flags) (the-as enemy-flag v0-0)) v0-0 ) diff --git a/test/decompiler/reference/jak2/levels/under/centipede_REF.gc b/test/decompiler/reference/jak2/levels/under/centipede_REF.gc index 1148f0b557..fcf30b51f7 100644 --- a/test/decompiler/reference/jak2/levels/under/centipede_REF.gc +++ b/test/decompiler/reference/jak2/levels/under/centipede_REF.gc @@ -369,7 +369,7 @@ ((and janim (= janim (-> this draw art-group data 4))) (when (ja-done? 1) (-> this draw art-group data 7) - (let ((v1-10 (get-rand-int this 100)) + (let ((v1-10 (rnd-int-count this 100)) (a0-9 (if (> (-> this skel active-channels) 0) (-> this skel root-channel 1 frame-group) ) @@ -382,7 +382,7 @@ ) ((= a0-9 (-> this draw art-group data 11)) (set! s5-0 (-> this draw art-group data 12)) - (set! (-> this anim-ctr) (get-rand-int-range this 0 3)) + (set! (-> this anim-ctr) (rnd-int-range this 0 3)) ) ((= a0-9 (-> this draw art-group data 12)) (let ((v1-20 (-> this anim-ctr))) @@ -399,7 +399,7 @@ ) ((= a0-9 (-> this draw art-group data 13)) (set! s5-0 (-> this draw art-group data 14)) - (set! (-> this anim-ctr) (get-rand-int-range this 0 3)) + (set! (-> this anim-ctr) (rnd-int-range this 0 3)) ) ((and (= a0-9 (-> this draw art-group data 14)) (> (-> this anim-ctr) 0)) (+! (-> this anim-ctr) -1) @@ -419,7 +419,7 @@ ) (else (set! s5-0 (-> this draw art-group data 7)) - (set! (-> this anim-ctr) (get-rand-int-range this 2 6)) + (set! (-> this anim-ctr) (rnd-int-range this 2 6)) ) ) ) @@ -462,7 +462,7 @@ (set! (-> a0-22 param 1) 1.0) (joint-control-channel-group! a0-22 (the-as art-joint-anim (-> this draw art-group data 7)) num-func-seek!) ) - (set! (-> this anim-ctr) (get-rand-int-range this 2 6)) + (set! (-> this anim-ctr) (rnd-int-range this 2 6)) (when (not (-> this using-chan1-effects?)) (set! (-> this using-chan1-effects?) #t) (let ((v1-106 (-> this skel effect))) @@ -672,12 +672,12 @@ ;; definition for method 55 of type centipede ;; INFO: Used lq/sq -(defmethod track-target! ((this centipede)) +(defmethod common-post ((this centipede)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (let ((t9-0 (method-of-type nav-enemy track-target!))) + (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) (let ((a0-3 (handle->process (-> this focus handle)))) @@ -766,7 +766,7 @@ ) ((task-node-closed? (game-task-node under-sig-centipede1-start)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (process-entity-status! this (entity-perm-status no-kill) #t) (go (method-of-object this grab-cam)) ) @@ -786,7 +786,7 @@ ) ((task-node-closed? (game-task-node under-sig-centipede2-start)) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (process-entity-status! this (entity-perm-status no-kill) #t) (go (method-of-object this grab-cam)) ) @@ -834,7 +834,7 @@ (set-chan1-effects self) ) :code (behavior () - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logior! (-> self enemy-flags) (enemy-flag alert)) (set! (-> self desired-talking-volume) 0.0) (centipede-method-187 self) (set-setting! 'interp-time 'abs 0.0 0) @@ -847,8 +847,8 @@ (until #f (let ((v1-13 *camera*)) (when (and v1-13 (-> v1-13 slave)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) - (logior! (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logclear! (-> self enemy-flags) (enemy-flag use-notice-distance directed directed-ready use-trigger)) + (logior! (-> self enemy-flags) (enemy-flag chase-startup)) (logclear! (-> self mask) (process-mask actor-pause)) (go-hostile self) ) @@ -870,8 +870,8 @@ ) ) (stop-looking-at-target! self) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> self enemy-flags) (enemy-flag alert)) (vector-reset! (-> self root transv)) (set! (-> self desired-talking-volume) 1.0) ) @@ -914,8 +914,8 @@ ) ) (stop-looking-at-target! self) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> self enemy-flags) (enemy-flag alert)) (vector-reset! (-> self root transv)) (set! (-> self desired-talking-volume) 1.0) ) @@ -941,8 +941,8 @@ ) ) (stop-looking-at-target! self) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> self enemy-flags) (enemy-flag alert)) (vector-reset! (-> self root transv)) (set! (-> self desired-talking-volume) 1.0) ) @@ -1105,7 +1105,7 @@ ) 0 (nav-enemy-method-167 self) - (logior! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) (set! (-> self grabbed-focus?) #f) (vector-reset! (-> self root transv)) (set! (-> self desired-talking-volume) 0.0) @@ -1119,7 +1119,7 @@ (quaternion-copy! (-> self dest-quat) (-> self src-quat)) ) :exit (behavior () - (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) ) :trans (behavior () (when (-> self grabbed-focus?) @@ -1383,7 +1383,7 @@ ) 0 (set-gravity-length (-> this root dynam) 573440.0) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (set! (-> this bobbing) (the-as trsqv (new 'process 'joint-mod-set-world this 3 #t))) (set! (-> this sound) (new 'process 'ambient-sound (static-sound-spec "cent-talk" :fo-max 90) (-> this root trans)) diff --git a/test/decompiler/reference/jak2/levels/under/jellyfish_REF.gc b/test/decompiler/reference/jak2/levels/under/jellyfish_REF.gc index 6e91e6aded..b574489b45 100644 --- a/test/decompiler/reference/jak2/levels/under/jellyfish_REF.gc +++ b/test/decompiler/reference/jak2/levels/under/jellyfish_REF.gc @@ -521,7 +521,7 @@ ) ) (set! (-> self charge-path-timer) 0) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) ) :trans (behavior () (local-vars (gp-0 vector)) @@ -613,7 +613,7 @@ :event enemy-event-handler :enter (behavior () (set! *jellyfish-mech-reserved* #t) - (look-at-target! self (enemy-flag death-start)) + (look-at-target! self (enemy-flag look-at-move-dest)) (hover-nav-control-method-14 (-> self hover) 8.0 10.0) (hover-nav-control-method-10 (-> self hover) @@ -626,7 +626,7 @@ ) :exit (behavior () (hover-nav-control-method-14 (-> self hover) 1.0 1.0) - (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) (logior! (-> self focus-status) (focus-status dangerous)) (logclear! (-> self focus-status) (focus-status dangerous)) ) @@ -830,7 +830,7 @@ :virtual #t :event enemy-event-handler :code (behavior () - (dispose! self) + (dying self) (logclear! (-> self focus-status) (focus-status dangerous)) (enemy-method-52 self (-> self root transv)) (let ((gp-0 (current-time))) @@ -878,7 +878,7 @@ :virtual #t :event enemy-event-handler :code (behavior () - (dispose! self) + (dying self) (let ((v1-3 (-> self root root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -906,15 +906,15 @@ (('hit 'hit-knocked) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this focus-status) (focus-status dangerous)) - (logclear! (-> this enemy-flags) (enemy-flag enable-on-notice)) - (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) (logior! (-> this focus-status) (focus-status hit)) (if (zero? (-> this hit-points)) (logior! (-> this focus-status) (focus-status dead)) ) - (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) (enemy-method-62 this) - (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (go (method-of-object this die)) @@ -1135,7 +1135,7 @@ ;; definition for method 55 of type jellyfish ;; INFO: Used lq/sq -(defmethod track-target! ((this jellyfish)) +(defmethod common-post ((this jellyfish)) "Does a lot of various things relating to interacting with the target - tracks when the enemy was last drawn - looks at the target and handles attacking @@ -1172,7 +1172,7 @@ ) ) (set! (-> this path-my-u) (get-furthest-point-on-path (-> this path) (-> this root trans))) - ((method-of-type hover-enemy track-target!) this) + ((method-of-type hover-enemy common-post) this) (none) ) @@ -1312,7 +1312,7 @@ (set! (-> this root dynam gravity-length) 40960.0) (set! (-> this root dynam gravity-max) 40960.0) (logclear! (-> this mask) (process-mask actor-pause)) - (logclear! (-> this enemy-flags) (enemy-flag notice)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) (new-source! (-> this los) this (seconds 1) (collide-spec backgnd enemy obstacle hit-by-others-list)) (set-time! (-> this last-fire-time)) (set! (-> this last-attack-time) 0) diff --git a/test/decompiler/reference/jak2/levels/under/pipe-grunt_REF.gc b/test/decompiler/reference/jak2/levels/under/pipe-grunt_REF.gc index d46f1e3db9..9bda2a15fc 100644 --- a/test/decompiler/reference/jak2/levels/under/pipe-grunt_REF.gc +++ b/test/decompiler/reference/jak2/levels/under/pipe-grunt_REF.gc @@ -42,9 +42,9 @@ (let ((f30-0 (vector-length s3-0))) (vector-normalize! s3-0 1.0) (vector-rotate90-around-y! s4-0 s3-0) - (vector-normalize-copy! (-> this event-param-point) s3-0 (get-rand-float-range this 0.0 f30-0)) + (vector-normalize-copy! (-> this event-param-point) s3-0 (rnd-float-range this 0.0 f30-0)) ) - (vector-normalize! s4-0 (get-rand-float-range this -16384.0 16384.0)) + (vector-normalize! s4-0 (rnd-float-range this -16384.0 16384.0)) (vector+! (-> this event-param-point) (-> this event-param-point) s4-0) ) (vector+! (-> this event-param-point) (-> this event-param-point) gp-0) @@ -57,8 +57,8 @@ :event enemy-event-handler :enter (behavior () (set-time! (-> self state-time)) - (logior! (-> self enemy-flags) (enemy-flag chase-startup)) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice alert victory)) + (logior! (-> self enemy-flags) (enemy-flag alert)) + (logclear! (-> self enemy-flags) (enemy-flag use-notice-distance directed directed-ready)) (let ((v1-7 (-> self root root-prim))) (set! (-> v1-7 prim-core collide-as) (-> self root backup-collide-as)) (set! (-> v1-7 prim-core collide-with) (-> self root backup-collide-with)) @@ -73,11 +73,11 @@ (vector-! (-> self pipe-dir) (-> self pipe-front) (-> self root trans)) (vector-normalize! (-> self pipe-dir) 1.0) (quaternion-look-at! (-> self root quat) (-> self pipe-dir) *up-vector*) - (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (get-rand-int self 3))) + (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (rnd-int-count self 3))) (vector-normalize-copy! (-> self root transv) (-> self pipe-dir) (-> self charge-anim travel-speed)) (let ((gp-0 (new 'stack-no-clear 'vector))) (vector-rotate90-around-y! gp-0 (-> self pipe-dir)) - (vector-normalize! gp-0 (get-rand-float-range self -4096.0 4096.0)) + (vector-normalize! gp-0 (rnd-float-range self -4096.0 4096.0)) (move-by-vector! (-> self root) gp-0) ) ) @@ -90,14 +90,16 @@ (vector-! v1-4 (-> self pipe-front) gp-0) (when (< (vector-dot v1-4 (-> self pipe-dir)) 0.0) (pipe-grunt-method-186 self) - (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (set! (-> self enemy-flags) + (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag jump-check-blocked))) + ) (send-event self 'jump 0 (-> self event-param-point)) ) ) ) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) (ja-channel-push! 1 0) (until #f (let ((a1-2 (-> self draw art-group data (-> self charge-anim anim-index)))) diff --git a/test/decompiler/reference/jak2/levels/under/sig5-course_REF.gc b/test/decompiler/reference/jak2/levels/under/sig5-course_REF.gc index ff1c35386d..b058431208 100644 --- a/test/decompiler/reference/jak2/levels/under/sig5-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/under/sig5-course_REF.gc @@ -76,7 +76,7 @@ (defmethod sig-under-method-263 ((this sig-under)) (let ((s5-0 (current-time))) (when (and (>= s5-0 (-> this next-chase-play-time)) - (not (channel-active? this (the-as uint 0))) + (not (channel-active? this (gui-channel none))) (>= (the-as int (sig-method-256 this)) 750) ) (let ((a1-2 (bot-speech-list-method-9 @@ -89,7 +89,7 @@ ) (when (>= a1-2 0) (play-speech this a1-2) - (set! (-> this next-chase-play-time) (+ s5-0 (get-rand-int-range this 1500 2700))) + (set! (-> this next-chase-play-time) (+ s5-0 (rnd-int-range this 1500 2700))) ) ) ) @@ -208,7 +208,7 @@ ) (cond ((speech-playing? this 7) - (and (not (channel-active? this (the-as uint 0))) (scene-play this "under-centipede-one" #f)) + (and (not (channel-active? this (gui-channel none))) (scene-play this "under-centipede-one" #f)) ) (else (play-speech this 7) @@ -222,7 +222,7 @@ ;; definition for method 264 of type sig-under (defmethod sig-under-method-264 ((this sig-under)) (and (logtest? (-> this bot-task-bits) (bot-task-bits botbits-3)) - (not (channel-active? this (the-as uint 0))) + (not (channel-active? this (gui-channel none))) (scene-play this "under-get-sig-out-res" #f) ) ) @@ -374,7 +374,7 @@ (vector-normalize! gp-0 1.0) (set-heading-vec! (-> self root) gp-0) ) - (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (let ((v1-11 self)) (set! (-> v1-11 enemy-flags) (the-as enemy-flag (logclear (-> v1-11 enemy-flags) (enemy-flag enemy-flag36)))) (set! (-> v1-11 nav callback-info) *nav-enemy-null-callback-info*) @@ -385,7 +385,7 @@ (set! (-> self focus-mode) 1) (logior! (-> self bot-flags) (bot-flags bf11 bf18)) (logior! (-> self root penetrated-by) (penetrate jak-yellow-shot jak-red-shot jak-blue-shot jak-dark-shot)) - (look-at-target! self (enemy-flag lock-focus)) + (look-at-target! self (enemy-flag look-at-focus)) ) :exit (behavior () (logclear! (-> self bot-flags) (bot-flags bf18)) @@ -403,14 +403,14 @@ ) :code (behavior () (until #f - (let ((gp-0 (get-rand-int self 2))) + (let ((gp-0 (rnd-int-count self 2))) (let ((s5-0 (new 'stack-no-clear 'vector))) (if (and (not (logtest? (-> self bot-task-bits) (bot-task-bits botbits-0))) (zero? gp-0)) (set! (-> s5-0 quad) (-> self sig5-course spots 2 center quad)) (set! (-> s5-0 quad) (-> self sig5-course spots 1 center quad)) ) - (+! (-> s5-0 x) (get-rand-float-range self -20480.0 20480.0)) - (+! (-> s5-0 y) (get-rand-float-range self 0.0 20480.0)) + (+! (-> s5-0 x) (rnd-float-range self -20480.0 20480.0)) + (+! (-> s5-0 y) (rnd-float-range self 0.0 20480.0)) (send-event (ppointer->process (-> self my-simple-focus)) 'move-trans s5-0) ) (set! (-> self shot-at-growls-index) gp-0) @@ -444,7 +444,7 @@ (when #t (set-time! (-> self state-time)) (logclear! (-> self bot-flags) (bot-flags bf18)) - (let ((gp-3 (+ (current-time) (get-rand-int-range self 30 600)))) + (let ((gp-3 (+ (current-time) (rnd-int-range self 30 600)))) (ja-channel-push! 1 (seconds 0.5)) (ja-no-eval :group! sig-ready0-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) @@ -628,7 +628,7 @@ :on-set (lambda ((arg0 sig-under)) (logclear! (-> arg0 bot-task-bits) (bot-task-bits botbits-2)) (logior! (-> arg0 bot-flags) (bot-flags bf06)) - (logior! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> arg0 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (set! (-> arg0 notice-enemy-dist) 122880.0) (clear-poi-and-focus! arg0) (set! (-> arg0 focus-mode) 0) @@ -678,7 +678,7 @@ #t ) (else - (if (and (not (speech-playing? arg1 6)) (not (channel-active? arg1 (the-as uint 0)))) + (if (and (not (speech-playing? arg1 6)) (not (channel-active? arg1 (gui-channel none)))) (play-speech arg1 6) ) #f @@ -871,7 +871,7 @@ :nav-mesh-index 2 :skip-to -1 :on-set (lambda ((arg0 sig-under)) - (set! (-> arg0 next-chase-play-time) (+ (current-time) (get-rand-int-range arg0 900 1500))) + (set! (-> arg0 next-chase-play-time) (+ (current-time) (rnd-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)) @@ -950,7 +950,7 @@ :nav-mesh-index 3 :skip-to -1 :on-set (lambda ((arg0 sig-under)) - (logior! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> arg0 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (reset-warn-time! arg0) (move-to-point! (-> arg0 root) (the-as vector (-> arg0 sig5-course spots 10))) (set-vector! (-> arg0 root quat) 0.0 0.5874 0.0 0.8092) @@ -1161,12 +1161,12 @@ (lambda ((arg0 object) (arg1 sig-under)) (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) (not (speech-playing? arg1 10)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 10) (reset-warn-time! arg1) ) - (when (and (speech-playing? arg1 10) (not (channel-active? arg1 (the-as uint 0)))) + (when (and (speech-playing? arg1 10) (not (channel-active? arg1 (gui-channel none)))) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) (go-to-waypoint! arg1 19 #f) (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) @@ -1283,7 +1283,7 @@ (clear-poi-and-focus! arg0) (logior! (-> arg0 focus-status) (focus-status disable)) (set! (-> arg0 notice-enemy-dist) 0.0) - (logclear! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> arg0 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (clear-focused (-> arg0 focus)) (logior! (-> arg0 bot-flags) (bot-flags bf26)) (when (and (process-grab? arg0 #t) (process-grab? *target* #t)) @@ -1351,7 +1351,7 @@ (lambda ((arg0 object) (arg1 sig-under)) (if (and (not (speech-playing? arg1 12)) (time-elapsed? (-> arg1 waypoint-time0) (seconds 1.5)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 12) ) @@ -1471,7 +1471,7 @@ (label cfg-21) (when v1-14 (when (scene-play arg1 "under-centipede-three" #f) - (logclear! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> arg1 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (reset-warn-time! arg1) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) (go-to-waypoint! arg1 23 #f) @@ -1500,7 +1500,7 @@ ) (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) (logclear! (-> arg0 focus-status) (focus-status disable)) - (logior! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> arg0 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (process-entity-status! arg0 (entity-perm-status no-kill) #t) (logior! (-> arg0 bot-flags) (bot-flags bf06)) (set! (-> arg0 notice-enemy-dist) 122880.0) @@ -1552,7 +1552,7 @@ :nav-mesh-index 7 :skip-to -1 :on-set (lambda ((arg0 sig-under)) - (set! (-> arg0 next-chase-play-time) (+ (current-time) (get-rand-int-range arg0 600 1200))) + (set! (-> arg0 next-chase-play-time) (+ (current-time) (rnd-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) @@ -1575,14 +1575,16 @@ (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) ) ) - (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) + (set! (-> arg1 enemy-flags) + (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag jump-check-blocked))) + ) (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))) + (when (and (not (channel-active? arg1 (gui-channel none))) (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) + (case (rnd-int-count arg1 3) ((1) (set! s5-2 19) ) @@ -1641,11 +1643,11 @@ (not (logtest? (-> arg1 focus-status) (focus-status in-air))) ) (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-1)) - (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> arg1 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) (if (and (time-elapsed? (-> arg1 waypoint-time0) (seconds 1)) (not (speech-playing? arg1 21)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 21) ) @@ -1689,10 +1691,12 @@ ) ) ) - (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) + (set! (-> arg1 enemy-flags) + (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag jump-check-blocked))) + ) (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))) + (logclear! (-> arg1 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) + (if (not (channel-active? arg1 (gui-channel none))) (play-speech arg1 22) ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) @@ -1736,7 +1740,7 @@ (not (logtest? (-> arg1 focus-status) (focus-status in-air))) ) (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) - (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logior! (-> arg1 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) ) (cond ((sig-under-method-264 arg1) @@ -1748,7 +1752,7 @@ (else (if (and (not (speech-playing? arg1 23)) (time-elapsed? (-> arg1 waypoint-time0) (seconds 3.5)) - (not (channel-active? arg1 (the-as uint 0))) + (not (channel-active? arg1 (gui-channel none))) ) (play-speech arg1 23) ) @@ -1772,7 +1776,7 @@ :on-set (lambda ((arg0 sig-under)) (remove-setting! 'music) (stop-speech arg0 (the-as uint 0) #f) - (logclear! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> arg0 enemy-flags) (enemy-flag vulnerable vulnerable-backup)) (let ((v1-8 (-> arg0 sig5-course spots 35))) (set! (-> v1-8 center quad) (-> arg0 root trans quad)) (set! (-> v1-8 center w) 16384.0) @@ -1808,7 +1812,7 @@ :on-set (lambda ((arg0 sig-under)) (process-entity-status! arg0 (entity-perm-status bit-4) #f) (process-entity-status! arg0 (entity-perm-status no-kill) #f) - (logclear! (-> arg0 enemy-flags) (enemy-flag use-notice-distance)) + (logclear! (-> arg0 enemy-flags) (enemy-flag cam-attack-mode)) (logclear! (-> arg0 bot-flags) (bot-flags bf06)) (bot-method-196 arg0) (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0)))